PageSourceSearch

https://newaccount.wecu.com/_next/static/chunks/pages/application/[id]/[[...view]]-4b0cd64f271bc3df.js

js wecu.com collected 2026-10-02 06:16:07 UTC 663,692 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[704],{7352:(e,n,i)=>{"use strict";i.d(n,{h:()=>x});var t=i(65437),l=i(69768),o=i(67970),a=i(88568),r=i(90726),d=i(43331),s=i(54047);let c={display:"flex",flexFlow:"column",alignItems:"stretch",lineHeight:"1.75rem",padding:"1rem"},u={marginBottom:".75rem"},p={padding:"revert"},m={marginBottom:"2.5rem"},h={height:"3.875rem"},v=e=>{let{taxId:n,dateOfBirth:i}=e;return(0,t.Y)("li",{children:n?(0,t.FD)(t.FK,{children:[(0,t.Y)("strong",{children:"Tax ID: "}),n]}):(0,t.FD)(t.FK,{children:[(0,t.Y)("strong",{children:"Date of Birth: "}),i]})})},g=e=>{let{loginProfilePii:{email:n,taxId:i,dateOfBirth:l},resendEmailOtp:{onResendClick:o,isLoading:g},closeModal:f}=e,{clientDetails:{clientName:y,customerServiceNumber:I}}=(0,s.t)();return(0,t.FD)("div",{style:c,...(0,d.F)({isPrivate:!1}),children:[(0,t.Y)(r.A.H3,{style:u,children:"Didn't Receive a Code?"}),(0,t.Y)("div",{children:"We've looked up your account with these details:"}),(0,t.FD)("ul",{style:p,...(0,d.F)({isPrivate:!0}),children:[(0,t.Y)(v,{taxId:i,dateOfBirth:l}),(0,t.FD)("li",{children:[(0,t.Y)("strong",{children:"Email: "}),n]})]}),(0,t.Y)("div",{style:m,children:(0,t.FD)("p",{children:["The email receiving the passcode may not be the same as the one provided. If you don't receive an email, please contact"," ",y,I&&" at ".concat(I)]})}),(0,t.Y)(a.A,{style:h,onClick:async()=>{await o(),f()},"data-testid":"resend-otp-btn",isLoading:g,children:"Resend Code"})]})};var f=i(26539),y=i(24675);let I=/^\/application\/[^/]+\/([^/]+)\/?$/,A={[y.QL.code]:y.QL},b=e=>{let n={};if(!e||"object"!=typeof e)return n;for(let[i,t]of Object.entries(e))"string"==typeof t&&(n[i]=t);return n};var C=i(11187),S=i(27910),w=i(72155);let x=()=>{let e=(0,w.ZM)(),n=(()=>{let{applyRedirect:e}=(0,C.A)(),{currentView:n,setCurrentView:i}=(0,l.At)(),{navigate:t}=(0,S._)();return async()=>{let l=(e=>{if(!e||"object"!=typeof e||!("postOtpRedirect"in e))return null;let n=e.postOtpRedirect;if(!n||"object"!=typeof n||!("pathname"in n)||"string"!=typeof n.pathname||!n.pathname.startsWith("/application/"))return null;let i=b("additionalQuery"in n?n.additionalQuery:void 0),t=b("viewData"in n?n.viewData:void 0),l=(e=>{var n;let i=(e=>{var n;let i=e.match(I);return null!=(n=null==i?void 0:i[1])?n:null})(e.pathname);if(!i)return null;let t=e.view;return t&&"object"==typeof t&&"code"in t&&"title"in t&&"string"==typeof t.code&&"string"==typeof t.title?t.code!==i?null:{code:t.code,title:t.title}:null!=(n=A[i])?n:null})({pathname:n.pathname,view:"view"in n?n.view:void 0});return l?{pathname:n.pathname,additionalQuery:i,viewData:t,view:l}:null})(null==n?void 0:n.data);if(l){await t(l.pathname,l.additionalQuery,{replace:!0});
1let e=Object.keys(l.viewData).length>0;i({...l.view,...e?{data:{...l.viewData}}:{}});return}await e()}})(),{onSubmitFunc:i,isLoading:a}=(0,w.Zw)({onSucceeded:n}),{openModal:r,modal:d}=(()=>{let e=(0,w.Cy)(),n=(0,w.WZ)();return(0,o.hS)(i=>(0,t.Y)(g,{loginProfilePii:e,resendEmailOtp:n,closeModal:i}),{"data-testid":"resend-otp-modal"})})();return(0,t.FD)(t.FK,{children:[d,(0,t.Y)(f.A,{onResendClick:r,onSubmit:i,showSpinnerInsteadOfResendButton:a,onGoBackToLogin:e})]})}},8394:(e,n,i)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/application/[id]/[[...view]]",function(){return i(99331)}])},63191:(e,n,i)=>{"use strict";i.d(n,{A:()=>l});var t=i(27910);let l=()=>{let{navigate:e}=(0,t._)();return{navigateToMyApplications:async()=>{await e("/applications")}}}},99331:(e,n,i)=>{"use strict";i.r(n),i.d(n,{default:()=>mP});var t={};i.r(t),i.d(t,{computeCheckUsernameFailureResponse:()=>rq,computeCheckUsernameResponse:()=>rU,computeEnrollUserFailureResponse:()=>rj,computeEnrollUserResponse:()=>rK,computeEnrollmentPreflowFailureResponse:()=>rV,computeEnrollmentPreflowResponse:()=>rB,computeFixedEnrollmentPreflowResponse:()=>rz,dummyInternalServerErrorOccurs:()=>rx,dummyNetworkErrorOccurs:()=>rw,getDummyPolicies:()=>rR,getRandomPolicies:()=>rL,maybeRandomInt:()=>rD,randomBool:()=>rY,randomInt:()=>rT,simulateNetworkRequest:()=>rF,useDummyCheckUsernameFactory:()=>r$,useDummyEnrollUserFactory:()=>rG,useDummyEnrollmentPreflowFactory:()=>rQ,useSimulatedCheckUsername:()=>rH,useSimulatedEnrollUser:()=>rW,useSimulatedEnrollmentPreflow:()=>r_});var l=i(65437),o=i(92323),a=i(81237),r=i(24675),d=i(69922),s=i(87634),c=i(50560),u=i(917),p=i(27910),m=i(5489),h=i.n(m),v=i(53239),g=i(59842),f=i(29124),y=i(64110),I=i(54008),A=i(34959),b=i(58469),C=i.n(b),S=i(22026),w=i(88568),x=i(3182),F=i(42418),Y=i(80164),T=i(70916),D=i(54047),E=i(45979),k=i(77347),P=i(74161),O=i(62261);let R={contentContainer:{maxWidth:560,margin:"0 auto",width:"100%"},buttons:{textAlign:"center",display:"flex",margin:"-16px 0 16px"},button:{padding:4,flex:"1 0 50%",button:{width:"100%"}}},L=e=>{let{fieldIds:n,fields:i,entityType:t}=e;return n.flatMap(e=>[e,...(0,E.J0)({fieldId:e,fields:i,entityType:t})])},N=e=>{let{topLevelFields:n,skipRequirement:i}=e,{formState:{submitCount:t,isValid:o,isSubmitSuccessful:a}}=(0,S.xW)();return(0,F.A)({submitCount:t,isValid:o,isSubmitSuccessful:a}),n.map(e=>
1(0,l.Y)(Y.A,{fieldId:e,theme:"externalLabel",skipRequirement:i},e))},B=e=>{let{eddQuestionnaireType:n,entityType:i,onCancel:t,onSubmit:o,isUpdating:a,submitText:r="Save",title:d,description:s,skipRequirement:c=!0}=e,{fields:u}=(0,T.d)(),p=(0,D.t)(),m=(0,S.xW)(),h="organization"===i?"business":i,v=(0,A.FD)({entityType:h,name:n,configEddQuestionnaire:p.eddQuestionnaires});if(!n)return(0,l.Y)(O.A,{});if(!v)return(0,l.Y)(P.A,{icon:"cancel",heading:"Uh oh!",subheading:"This page cannot be found. Try to reload the page or go back."});let{selfServeTitle:g,selfServeDescription:f,topLevelFields:y}=v,I=c?()=>{let e=m.getValues(),n=L({fieldIds:y,fields:u,entityType:i});return o((0,E.Nz)(C()(e,n)))}:m.handleSubmit(e=>{let n=L({fieldIds:y,fields:u,entityType:i});return o((0,E.Nz)(C()(e,n)))});return(0,l.FD)(l.FK,{children:[(0,l.Y)(k.A,{children:(0,l.FD)("div",{css:R.contentContainer,children:[(0,l.Y)(x.A,{heading:d||"".concat(g),subheading:s||f,theme:"small"}),(0,l.Y)(N,{topLevelFields:y,skipRequirement:c})]})}),(0,l.Y)("div",{css:R.contentContainer,children:(0,l.FD)("div",{css:R.buttons,children:[t&&(0,l.Y)("div",{css:R.button,children:(0,l.Y)(w.A,{type:"button",theme:"outline",onClick:t,children:"Back"})}),(0,l.Y)("div",{css:R.button,children:(0,l.Y)(w.A,{onClick:I,type:"submit",isLoading:a,children:r})})]})})]})},M=e=>{var n,i,t,o,a,r,d,s,c,u,p;let{eddQuestionnaireType:m,application:h,namePrefix:v,account:g,...f}
1=e,A=null==g||null==(n=g.newAccountRelationshipData)?void 0:n.find(e=>e.isPrimaryEntity),b=null==h||null==(i=h.persons)?void 0:i.find(e=>A&&"personId"in A&&e.id===(null==A?void 0:A.personId));return(0,l.Y)(y.A,{theme:"fillHeight",initialValues:g,children:(0,l.Y)(I.Ay,{account:g,application:h,addressPrimaryState:(null==b||null==(t=b.rawFields)?void 0:t.addressPrimaryState)||(null==h||null==(r=h.persons)||null==(a=r[0])||null==(o=a.rawFields)?void 0:o.addressPrimaryState)||void 0,maritalStatus:(null==b||null==(d=b.rawFields)?void 0:d.maritalStatus)||(null==h||null==(u=h.persons)||null==(c=u[0])||null==(s=c.rawFields)?void 0:s.maritalStatus)||void 0,newAccountRelationshipData:(null==g?void 0:g.newAccountRelationshipData)||void 0,organizationType:(null==(p=h.organization)?void 0:p.type)||void 0,organizationKycEvaluationTags:null==h?void 0:h.organizationKycEvaluationTags,personKycEvaluationTags:null==h?void 0:h.personKycEvaluationTags,underwritingTags:[],children:(0,l.Y)(B,{eddQuestionnaireType:m,entityType:"account",...f})})})};var z=i(1022),V=i(73045);let _=e=>{var n,i;let{application:t,onClickAccount:o,eddType:a}=e,r=(0,D.t)(),d=(0,g.FM)(null==t?void 0:t.requirements).filter(e=>e.eddType===a),s=null==d?void 0:d.map(e=>{var n,i;return null==(i=t.fields)||null==(n=i.accounts)?void 0:n.find(n=>n.referenceId===e.accountReferenceId)}),c=(0,A.WK)("account"),u=null==(n=c[a])?void 0:n.selfServeTitle,p=null==(i=c[a])?void 0:i.selfServeDescription;return(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{heading:u||"",subheading:p||""}),null==s?void 0:s.map(e=>{var n;return e&&(0,l.Y)(V.A,{size:"large",title:null==(n=(0,z.Jhp)({product:r.products[e.productId],accountVariant:e.accountVariant}))?void 0:n.name,titleTag:(e=>{var n,i;let t=(null==d||null==(n=d.find(n=>n.accountReferenceId===e))?void 0:n.status)==="incomplete",l=(null==d||null==(i=d.find(n=>n.accountReferenceId===e))?void 0:i.status)==="complete";return t?{text:"Required",theme:"danger"}:l?{text:"Completed",theme:"success",isAnimated:!0}:null})(e.referenceId),description:null==e?void 0:e.accountName,onClick:()=>o(e.referenceId)},e.referenceId)})]})};var U=i(54951),q=i(96654),H=i(69768),K=i(4364);let j=()=>{let{application:e,validateApplication:n,getView:i,updateOffer:t,updatePreOffer:l,submitApplication:o,updateClosing:a}=(0,u.YY)(),{setCurrentView:d}=(0,H.At)();return{routeToNextActionOrSubmitApplication:async()=>{let s=e?(0,q.ZM)(e):null;if(null===s&&((null==e?void 0:e.reviewStatus)==="incomplete"||e&&(0,K.A)(e)))return await n(),d(i());switch(s){case"preOffer":return await l({variables:{applicationId:null==e?void 0:e.id}}),d(i());case"offer":return await t({variables:{applicationId:null==e?void 0:e.id}}),d(i());case"closing":return await a({variables:{applicationId:null==e?void 0:e.id}}),d(i());default:if((null==e?void 0:e.reviewStatus)==="incomplete"||e&&(0,K.A)(e))return await n(),d(i());return d({...r.rv,data:{submitApplicationPromise:o({})}})}}}};var W=i(70388),G=i(59968),$=i(63044),Q=i(71760),J=i(62767),Z=i(95603),X=i(12302),ee=i(13418),en=i(23648),ei=i(66552);let et=e=>{let{title:n,tag:i,isDisabled:t}=e;return(0,l.Y)(ee.A,{title:n,tag:i,fieldIds:$.A.PERSON.MEMBERSHIP_ELIGIBILITY_CRITERIA,isDisabled:t})},el=e=>{let{person:n,organization:i}=e;return(null==n?void 0:n.isSoleProprietor)||(null==n?void 0:n.isOwnershipProng)?"Owner":(null==n?void 0:n.isControlProng)?"Control Prong":(null==i?void 0:i.type)?"Business":null},eo=e=>{var n,i;let{application:t,onSubmit:o,isSubmitting:a}=e,{experiences:{selfServe:{pages:{editBusinessEligibility:{headerText:r,subheaderText:d,formInfoText:s,formInfoTooltip:c}={}}}}}=(0,D.t)(),{type:u,organization:p,persons:m}=t,h={organization:{creditUnionEligibilityCriteria:null==p?void 0:p.creditUnionEligibilityCriteria,creditUnionOrganizationRegion:null==p?void 0:p.creditUnionOrganizationRegion,creditUnionMembershipEligibilityReason:null==p?void 0:p.creditUnionMembershipEligibilityReason,creditUnionMembershipSegCode:null==p?void 0:p.creditUnionMembershipSegCode},...m.reduce((e,n)=>((0,Q.HO)(null==n?void 0:n.id),e[n.id]={creditUnionMembershipSegCode:null==n?void 0:n.creditUnionMembershipSegCode,creditUnionEligibilityCriteria:null==n?void 0:n.creditUnionEligibilityCriteria,creditUnionResidentialRegion:null==n?void 0:n.creditUnionResidentialRegion}
1,e),{})};return(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{heading:r||"Membership Eligibility",subheading:d||"To finish opening your new account, we need to know how you’re eligible for credit union membership."}),(0,l.FD)(y.A,{onSubmit:o,initialValues:h,children:[(0,l.FD)(ei.A,{theme:"small",children:[(0,l.Y)(X.A,{applicationFields:t.rawFields,applicationType:u,originatingExperience:t.originatingExperience,organizationType:null==p?void 0:p.type,isEIN:(null==p?void 0:p.taxIdType)==="EIN",coreSyncedFields:(null==p?void 0:p.coreSyncedFields)||[],namePrefix:"organization",externalCoreMembershipId:null==p?void 0:p.externalCoreMembershipId,kycEvaluationTags:(null==t||null==(i=t.organizationKycSnapshot)||null==(n=i.find(e=>(null==e?void 0:e.organizationId)===(null==p?void 0:p.id)))?void 0:n.tags)||[],allowlistCategory:null==p?void 0:p.allowlistCategory,children:(0,l.Y)(ee.A,{title:(null==p?void 0:p.legalName)||"Business",tag:el({organization:p}),fieldIds:(e=>"municipality"===(e?(0,G.KG)(e):"business")?[...$.A.MUNICIPALITY.MEMBERSHIP_ELIGIBILITY_FIELDS,...$.A.MUNICIPALITY.MEMBERSHIP_ELIGIBILITY_TRIGGERED_FIELDS]:[...$.A.BUSINESS.MEMBERSHIP_ELIGIBILITY_FIELDS])(null==p?void 0:p.type)})}),m.map(e=>{var n,i;return(0,l.Y)(en.A,{applicationFields:t.rawFields,personId:e.id,applicationType:u,originatingExperience:t.originatingExperience,coreSyncedFields:e.coreSyncedFields,isOwnershipProng:e.isOwnershipProng,isSoleProprietor:e.isSoleProprietor,taxIdLastFour:e.taxIdLastFour,isMissingTaxId:!1===e.hasTaxId,namePrefix:"".concat(e.id),kycEvaluationTags:(null==t||null==(i=t.personKycSnapshot)||null==(n=i.find(n=>(null==n?void 0:n.personId)===(null==e?void 0:e.id)))?void 0:n.tags)||[],children:(0,l.Y)(et,{title:(0,J.L)(e),tag:el({person:e})})},e.id)})]}),(0,l.Y)(w.A,{type:"submit",isFull:!0,isLoading:a,children:"Save Membership Eligibility"})]}),s?(0,l.Y)("div",{css:{marginTop:16},children:(0,l.Y)(Z.A,{icon:"info-circle",tooltipIcon:c?"info-circle":null,tooltipContent:c,content:s})}):null]})};var ea=i(19661),er=i.n(ea),ed=i(3205),es=i.n(ed);let ec=function(){let{allowBrowserNavigationToViews:e=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(0,m.useRouter)(),{setCurrentView:i,currentView:t}=(0,H.At)();(0,v.useEffect)(()=>{if(!e.length)return;let l=()=>{let n=e.find(e=>{var n,i;return e.code===(null==(i=h().router)||null==(n=i.query.view)?void 0:n[0])});n&&n.code!==(null==t?void 0:t.code)&&i(n)};return n.events.on("routeChangeComplete",l),()=>{n.events.off("routeChangeComplete",l)}},[e])};var eu=i(90390),ep=i(45818);let em={buttons:{textAlign:"center",display:"flex",margin:"0 -8px"},button:{padding:4,flex:"1 0 50%",button:{width:"100%"}}},eh=e=>{let{application:n,userId:i,onChange:t,onCancel:o,handoffRecipient:a}=e,{formState:{isSubmitting:r}}=(0,S.xW)(),d=n.persons.filter(e=>e.id!==i).map(e=>({value:e.id,label:(0,J.L)(e),tagLabel:e.isControlProng?"Control Prong":void 0})),s=!!a&&n.persons.find(e=>e.id===a);return(0,l.FD)(l.FK,{children:[(0,l.Y)(ei.A,{theme:"small",children:(0,l.Y)(ep.A,{label:"Select a Handoff Recipient",ariaLabel:"Select a Handoff Recipient",onChange:t,name:"handoffRecipient",options:d,value:a})}),s&&(0,l.Y)(ei.A,{theme:"small",children:(0,l.FD)("p",{children:[s.firstName||s.lastName?(0,J.L)(s):"Recipient"," ","will be emailed an invitation to complete the application process at"," ",s.emailPrimary,"."]})}),(0,l.Y)(ei.A,{theme:"small",children:(0,l.Y)(Z.A,{theme:"warning",icon:"info-circle",content:"By handing off this application, you will transfer access from yourself to the recipient, and you will no longer be able to edit or update this application."})}),(0,l.Y)(ei.A,{theme:"small",children:(0,l.FD)("div",{css:em.buttons,children:[!!o&&(0,l.Y)("div",{css:em.button,children:(0,l.Y)(w.A,{type:"button",theme:"outline",onClick:o,children:"Go Back to Review & Sign"})}),(0,l.Y)("div",{css:em.button,children:(0,l.Y)(w.A,{type:"submit",isFull:!0,isLoading:r,children:"Hand Off Application"})})]})})]})},ev=e=>{var n;let{application:i,userId:t,onSubmit:o,onCancel:a}=e,r=null==(n=i.persons.find(e=>e.isControlProng)||i.persons[0])?void 0:n.id,[d,s]=(0,v.useState)(r),c=(0,v.useCallback)(()=>o({handoffRecipient:d}),[d]);return(0,l.Y)(y.A,{onSubmit:c,children:(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{heading:"Ap
1plication Handoff",subheading:"We're ready to handoff your application. Select a recipient with authority to open this account."}),(0,l.Y)(eh,{application:i,onChange:e=>{"string"==typeof e&&s(e)},onCancel:a,handoffRecipient:d,userId:t})]})})};var eg=i(55674),ef=i(76734),ey=i(25577),eI=i(6540),eA=i(51196);let eb=()=>{let[e]=(0,ey.n)(eA.eb),[n]=(0,ey.n)(eA.Ot),{getQueryParams:i}=(0,p._)(),t=i(eI.C7);return{updateApplicationWithSignificantParty:async n=>{let{application:i,userId:l}=n;if(!i)throw Error("cannot add organization without application");let o={applicationId:i.id,fields:{applicantId:l,...t}},{data:a}=await e({variables:o}),r=null==a?void 0:a.updateCreateAccountApplication;if(!r)throw Error("did not receive updated application");return r},handoffApplication:n}};function eC(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Unexpected null value";if(null===e)throw Error(n)}var eS=i(35767),ew=i(80511),ex=i(46424),eF=i.n(ex),eY=i(45492),eT=i(71877);let eD=(e,n,i,t)=>{let l=e[i||""];return l?(0,eT.y)(l,t).name:"".concat(eF()(n)," Account")},eE=e=>"otherAdult"===e?"coBorrower":"guarantor"===e?"guarantor":"primarySigner";var ek=i(12409),eP=i.n(ek);let eO=(e,n)=>{var i,t;return(null==(i=e.qualifyingScopes)||!i.length||!!e.qualifyingScopes.some(e=>n.includes(e)))&&!(null==(t=e.disqualifyingScopes)?void 0:t.some(e=>n.includes(e)))},eR=e=>{let n=new Blob([Uint8Array.from(atob(e),e=>e.charCodeAt(0))],{type:"application/pdf"});return URL.createObjectURL(n)};var eL=i(36240),eN=i(27766),eB=i(44250),eM=i(20797),ez=i.n(eM),eV=i(25286),e_=i.n(eV),eU=i(57604),eq=i(19139),eH=i(56142),eK=i(79279),ej=i.n(eK),eW=i(95326),eG=i.n(eW),e$=i(85209),eQ=i(48112),eJ=i(48863),eZ=i(57372);let{rawSpeeds:{slow:eX},easingFunctions:{easeOutQuint:e0}}=eJ.Ay.animations,e9=e=>{let{fontStacks:n}=e;return{"& h2":{margin:0,fontFamily:n.sans,fontWeight:700,fontSize:"16px",lineHeight:"150%",letterSpacing:"0.01em",verticalAlign:"middle"},"& h2 + p":{margin:"2px 0 0 0",fontFamily:n.sans,fontWeight:400,fontSize:"14px",lineHeight:"150%",letterSpacing:"0.02em",verticalAlign:"middle"}}},e1={bannerContainer:{transitionProperty:"max-height, opacity",transitionDuration:"".concat(eX,"ms"),transitionTimingFunction:"".concat(e0),justifyContent:"center",width:"100%",maxWidth:"100%",height:"100%",[eQ.Ay.medium]:{width:"auto"}}},e2=e=>{var n;let{animateInOut:i,onDismiss:t,theme:o,snackbarMessageProps:a,children:r}=e,d=(0,v.useRef)(null),[s,c]=(0,v.useState)(!1),[u,p]=(0,v.useState)(null==d||null==(n=d.current)?void 0:n.clientHeight),m=()=>{var e,n,i;let t=null==d||null==(e=d.current)?void 0:e.childNodes;p(eG()([null==d||null==(n=d.current)?void 0:n.clientHeight,null==t||null==(i=t[0])?void 0:i.clientHeight]))};(0,v.useEffect)(()=>s?(window.addEventListener("resize",ej()(m,100)),()=>window.removeEventListener("resize",ej()(m,100))):(c(!0),m(),()=>!1),[s]);let h={entering:{maxHeight:"".concat(u,"px"),opacity:1},entered:{maxHeight:"".concat(u,"px"),opacity:1},exiting:{maxHeight:"0px",opacity:0,overflow:"hidden"},exited:{maxHeight:"0px",opacity:0,overflow:"hidden"},unmounted:{maxHeight:"0px",opacity:0,overflow:"hidden"}};return(0,l.Y)(e$.Ay,{timeout:eX,in:i,unmountOnExit:!0,nodeRef:d,children:e=>(0,l.Y)("div",{css:e1.bannerContainer,ref:d,style:{...h[e]},children:(0,l.Y)(eZ.A,{...void 0!==o?{theme:o}:{},...a,isNarrowLayout:!0,onDismiss:t,state:"entered",children:(0,l.Y)("div",{css:e9,children:r})})})})};var e6=i(2716),e5=i(40990);let e4={name:e=>{let{fontScales:n}=e;return{...n.default,display:"flex",alignItems:"center",fontWeight:700}},icon:{marginRight:8,display:"inline-block"},details:{padding:"10px 0"},secondaryDetails:{margin:"-10px 0 0"},subheading:e=>{let{fontScales:n,colors:i}=e;return{...n.default,fontWeight:400,color:i.blue8}}},e3=e=>{let{title:n,icon:i,details:t,secondaryDetails:o,subheading:a,children:r}=e,d=t&&t.length&&t.filter(e=>!!e[1]);return(0,l.FD)(eU.A,{collapsedContent:o&&(e=>{let n=e&&e.length&&e.filter(e=>!!e[1]);return n&&n.length?(0,l.Y)("div",{css:e4.secondaryDetails,children:(0,l.Y)(e5.A,{keyValueMap:n})}):null})(o),variant:"grey",children:[(0,l.FD)("div",{css:e4.name,children:[i&&(0,l.Y)(eH.A,{css:e4.icon,name:i,brandColor:"secondaryLight",size:"large"}),n]}),a&&(0,l.Y)("div",{css:e4.subheading,children:a}),d&&(0,l.Y)("div",{css:e4.details,children:(0,l.Y)(e5.A,{keyValueMap:d,isValuesRightAligned:!0})}),r]})};var e8=i(66055),e7=i(25935),ne=i(78822),nn=i(84425);let ni=e=>{var n,i,t,o,a;let{children:r,addressPrimaryState:d,dynamicOptions:s,application:c,maritalStatus:u,namePrefix:p,organizationKycEvaluationTags:m,personKycEvaluationTags:h,organizationType:v,taxIdType:g,applicationType:f,underwritingTags:y,usResidencyStatus:I}=e,A=(0,D.t)(),b=(0,eS.rC)(null==c?void 0:c.rawFields),C=(0,eS.qk)(null==c?void 0:c.rawFields),S=(0,e7.o)({person:{maritalStatus:u,addressPrimaryState:d,usResidencyStatus:I},applicationType:null!=f?f:null==c?void 0:c.type,originatingExperience:null!=(n=null==c?void 0:c.originatingExperience)?n:"selfServe",accountInfo:(0,ne.SP)(null==c?void 0:c.rawFields),newAccountRelationshipD
1ata:b,organizationType:v,taxIdType:g,organizationKycEvaluationTags:m||void 0,personKycEvaluationTags:h||void 0,underwritingTags:y,closingStatus:null!=(i=null==c?void 0:c.closingStatus)?i:null,preOfferStatus:null!=(t=null==c?void 0:c.preOfferStatus)?t:null,offerStatus:null!=(o=null==c?void 0:c.offerStatus)?o:null,purposeOfLoan:null!=(a=null==C?void 0:C.purposeOfLoan)?a:null},A),w=(0,nn.A)({entityType:"application",namePrefix:p,scopes:S}),x=e=>e in w.fields;for(let e in s)if(x(e)&&e in w.fields){let n=w.fields[e];n&&"options"in n&&(n.options=s[e])}return(0,l.Y)(T.A,{...w,namePrefix:p,children:r})};var nt=i(35369),nl=i(78744),no=i.n(nl);let na=e=>no()(e.filter(e=>!!e.isDisplayedAsCheckboxInSelfServe&&!e.optional),"type");var nr=i(82031),nd=i(75342),ns=i.n(nd),nc=i(11933),nu=i.n(nc),np=i(90726),nm=i(46608),nh=i(67315),nv=i(11939),ng=i(86739),nf=i(48933);i(94646),i(94068);var ny=i(54414);let nI=(e,n)=>{let[i,t]=(0,v.useState)(null);return(0,v.useEffect)(()=>{var n;let i=()=>{let n=e.current;if(!(null==n?void 0:n.parentElement))return;let i=n.style.width;n.style.width="0px";let l=n.parentElement.clientWidth;n.style.width=i,l>0&&t(l)};i(),window.addEventListener("resize",i);let l="undefined"!=typeof ResizeObserver?new ResizeObserver(i):void 0;return(null==(n=e.current)?void 0:n.parentElement)&&l&&l.observe(e.current.parentElement),()=>{window.removeEventListener("resize",i),null==l||l.disconnect()}},[n]),i};var nA=i(23727);let nb=v.lazy(()=>Promise.all([i.e(200),i.e(484)]).then(i.bind(i,43484)).then(e=>({default:e.Document}))),nC=v.lazy(()=>Promise.all([i.e(200),i.e(484)]).then(i.bind(i,43484)).then(e=>({default:e.Page}))),nS={},nw=async()=>{let e=await Promise.all([i.e(200),i.e(484)]).then(i.bind(i,43484)).then(e=>e.pdfjs),n=void 0!==nA?"/static/pdfjs":null;n&&(e.GlobalWorkerOptions.workerSrc="".concat(n,"/build/pdf.worker.min.mjs"),nS={cMapUrl:"".concat(n,"/cmaps/"),standardFontDataUrl:"".concat(n,"/standard_fonts/")})},nx={container:{position:"relative",width:"100%",maxWidth:"654px",margin:"0 auto"},viewerContainer:{position:"relative",width:"100%",height:"850px",overflow:"auto",border:"1px solid #ccc"},viewerContainerFit:{position:"relative",width:"100%"},pageContainer:{position:"relative",display:"block"},spinnerOverlay:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},overlay:{position:"absolute",inset:0,zIndex:2e3,pointerEvents:"none"}},nF=11/8.5,nY=e=>{let{documents:n,width:i,renderPageOverlay:t,onDocumentPageCountsChange:o,onPagesRendered:a,fitToContent:r}=e,[d,s]=(0,v.useState)(!1),[c,u]=(0,v.useState)([]),[p,m]=(0,v.useState)({}),h=(0,v.useRef)(!1),g=(0,v.useRef)(null),f=nI(g,d),y=n.map(e=>e.id).join(","),I=(0,v.useMemo)(()=>n,[y]),A=(0,v.useMemo)(()=>Date.now().toString(),[y]);(0,v.useEffect)(()=>{nw().then(()=>s(!0))},[]),(0,v.useEffect)(()=>{null==o||o(c)},[c,o]),(0,v.useEffect)(()=>{h.current=!1,m({}),u(Array(I.length).fill(0))},[A]);let b=(e,n)=>{m(i=>i[e]===n?i:{...i,[e]:n})};if((0,v.useEffect)(()=>{if(!a||h.current)return;let e=I.length>0&&c.length===I.length&&c.every(e=>e>0),n=c.reduce((e,n)=>e+(n||0),0);e&&Object.keys(p).length>=n&&(h.current=!0,a())},[p,c,I,a]),!d)return(0,l.Y)("div",{ref:g,css:nx.container,role:"region","aria-label":"Agreements PDF viewer","data-testid":"pdf-viewer",children:(0,l.Y)(ny.A,{size:"large"})});let C=window.innerWidth,S=null!=i?i:Math.min(654,C-40,null!=f?f:Number.MAX_SAFE_INTEGER);return(0,l.Y)("div",{ref:g,css:nx.container,role:"region","aria-label":"Agreements PDF viewer","data-testid":"pdf-viewer",children:(0,l.Y)("div",{css:r?nx.viewerContainerFit:nx.viewerContainer,children:I.map((e,n)=>(0,l.Y)("div",{"data-testid":"document-".concat(e.id),"data-file-url":e.content,"data-dynamic-agreement-type":e.dynamicAgreementType,children:(0,l.Y)(nb,{file:e.content,onLoadSuccess:n=>((e,n)=>{let{numPages:i}=e;u(e=>{let t=I.findIndex(e=>e.id===n);if(-1===t)return e;let l=I.map((n,i)=>e[i]||0);return l[t]=i,l})})(n,e.id),loading:(0,l.Y)(ny.A,{size:"large"}),error:"Error loading PDF",options:nS,children:Array.from(Array(c[n]||0),(i,o)=>{let a=c.slice(0,n).reduce((e,n)=>e+(n||0),0)+o,r="".concat(e.id,"-").concat(o),d=p[r],s=void 0!==d;return(0,l.FD)("div",{css:nx.pageContainer,style:{width:S,...s?{}:{minHeight:S*nF}},children:[(0,l.Y)(nC,{pageNumber:o+1,width:S,error:"Error loading page",loading:(0,l.Y)(l.FK,{}),onRenderSuccess:e=>((e,n)=>{b(e,"number"==typeof(null==n?void 0:n.height)?n.height:null)})(r,e),onRenderError:()=>{b(r,null)}}),!s&&(0,l.Y)("div",{css:nx.spinnerOverlay,children:(0,l.Y)(ny.A,{size:"large"})}),t&&"number"==typeof d&&(0,l.Y)("div",{css:nx.overlay,children:t(a,S,d)})]},r)})},"".concat(e.id,"-").concat(A))},e.id))})})};function nT(){let e=(0,ng._)(["\n    position: sticky;\n    right: 100%;\n    top: ",";\n    margin-left: -212px;\n    margin-top: -51px;\n    z-index: 1000;\n    white-space: nowrap;\n    transition: top 0.5s ease;\n    button {\n      width: 180px;\n    }\n    @media (max-width: ","px) {\n      position: static;\n      margin-top: 16px;\n      margin-bottom: 16px;\n      margin-right: 0;\n      margin-left: 0;\n    }\n    @media (max-width: ","px) {\n      position: fixed;\n      bottom: 16px;\n      left: 16px;\n      right: 16px;\n      top: auto;\n      margin: 0;\n      width: calc(100% - 32px);\n      button {\n        width: 100%;\n      }\n    }\n  "]);return nT=function(){return e},e}function nD(){let e=(0,ng._)(["\n            @import url('https://fonts.googleapis.com/css2?family=Alex+Brush&display=block');\n          "]);return nD=function(){return e},e}let nE={navigation:e=>(0,nf.css)(nT(),e?"50vh":"16px",eQ.Ay.raw.max.minWidth-1,eQ.Ay.raw.medium.minWidth-1),signingButton:{position:"relative",display:"flex",alignItems:"center",height:"100%",left:5,pointerEvents:"auto",whiteSpace:"nowrap"},signingText:e=>({fontSize:"".concat(Math.round(e),"px"),height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"left",pointerEvents:"auto",fontFamily:"Alex Brush",whiteSpace:"nowrap",marginTop:"3%"})},nk=e=>{let{documents:n,onClickToSignCompleted:i,fitToContent:t}=e,[o,a]=(0,v.useState)(new Set),[r,d]=(0,v.useState)([]),[s,c]=(0,v.useState)(!1),u=(0,v.useRef)(null),p=(0,v.useMemo)(()=>n.flatMap(e=>{var n,i;return(null==(i=e.metadata)||null==(n=i.signingInputs)?void 0:n.map(n=>({...n,documentId:e.id})))||[]}).sort((e,i)=>n.findIndex(n=>n.id===e.documentId)-n.findIndex(e=>e.id===i.documentId)||e.pageIndex-i.pageIndex||e.yPct-i.yPct||e.xPct-i.xPct),[n.map(e=>e.id).join(",")]),m=p.some(e=>!o.has("".concat(e.documentId,"-").concat(e.id))),h=r.length===n.length&&n.length>0&&r.every(e=>e>0);(0,v.useEffect)(()=>{h&&!m&&(null==i||i())},[h,m,i]);let g=e=>{if(!e)return;let n=document.querySelector('[data-sig-anchor="'.concat(e.documentId,"-").concat(e.id,'"]'));if(!n){u.current=e;return}u.current=null,n.scrollIntoView({behavior:"smooth",block:"center"})},f=()=>{let e=document.querySelector('[data-sig-anchor="complete"]');null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},y=(0,v.useMemo)(()=>
1{if(!h)return new Map;let e=new Map;return p.forEach(i=>{let t=n.findIndex(e=>e.id===i.documentId),l=r[t]||0;if(i.pageIndex>=l)return void console.warn("Invalid placement: page index exceeds document page count",{placementId:i.id,documentId:i.documentId,placementPageIndex:i.pageIndex,documentPageCount:l,documentIndex:t});let o=r.slice(0,t).reduce((e,n)=>e+(n||0),0)+i.pageIndex;e.has(o)||e.set(o,[]),e.get(o).push(i)}),e},[p,r.join(","),n.map(e=>e.id).join(","),h]);return(0,l.FD)("div",{"data-testid":"pdf-signer",children:[(0,l.Y)(nf.Global,{styles:[(0,nf.css)(nD())]}),m&&(0,l.Y)("div",{css:nE.navigation(s),children:(0,l.Y)(w.A,{onClick:()=>{if(0===p.length)return;c(!0);let e=p.find(e=>!o.has("".concat(e.documentId,"-").concat(e.id)));e&&g(e)},isDisabled:0===p.length,children:s||o.size>0?"Sign":"Start"})}),(0,l.Y)(nY,{documents:n.map(e=>{let{id:n,content:i,dynamicAgreementType:t}=e;return{id:n,content:i,dynamicAgreementType:t}}),renderPageOverlay:(e,n,i)=>{var t;return(null!=(t=y.get(e))?t:[]).map(e=>{let t="".concat(e.documentId,"-").concat(e.id),r=o.has(t),d=p.findIndex(e=>"".concat(e.documentId,"-").concat(e.id)===t),s=d===p.length-1,c=Math.min(20*n/654,Math.max(10*n/654,i*e.hPct));return(0,l.Y)("div",{"data-sig-anchor":t,style:{position:"absolute",left:"".concat(100*e.xPct,"%"),top:"".concat(100*e.yPct,"%"),width:"".concat(100*e.wPct,"%"),height:"".concat(100*e.hPct,"%")},children:r?(0,l.Y)("div",{css:nE.signingText(c),children:e.name}):(0,l.Y)("div",{css:nE.signingButton,children:(0,l.Y)(w.A,{size:"smallMedium",theme:"arrowButton",preserveCase:!0,onClick:()=>{if(a(e=>new Set([...e,t])),s)return void setTimeout(()=>f(),100);let e=p.slice(d+1).find(e=>!o.has("".concat(e.documentId,"-").concat(e.id)));e?setTimeout(()=>g(e),100):setTimeout(()=>f(),100)},children:"Click to Sign"})})},t)})},onDocumentPageCountsChange:d,onPagesRendered:()=>{u.current&&g(u.current)},fitToContent:t}),(0,l.Y)("div",{"data-sig-anchor":"complete"})]})};var nP=i(23727);function nO(){let e=(0,ng._)(["\n    position: sticky;\n    right: 100%;\n    top: ",";\n    margin-left: -212px;\n    margin-top: -51px;\n    z-index: 1000;\n    white-space: nowrap;\n    transition: top 0.5s ease;\n    button {\n      width: 180px;\n    }\n    @media (max-width: ","px) {\n      position: static;\n      margin-top: 16px;\n      margin-bottom: 16px;\n      margin-right: 0;\n      margin-left: 0;\n    }\n    @media (max-width: ","px) {\n      position: fixed;\n      bottom: 16px;\n      left: 16px;\n      right: 16px;\n      top: auto;\n      margin: 0;\n      width: calc(100% - 32px);\n      button {\n        width: 100%;\n      }\n    }\n  "]);return nO=function(){return e},e}function nR(){let e=(0,ng._)(["\n            @import url('https://fonts.googleapis.com/css2?family=Alex+Brush&display=block');\n          "]);return nR=function(){return e},e}let nL=v.lazy(()=>Promise.all([i.e(200),i.e(484)]).then(i.bind(i,43484)).then(e=>({default:e.Document}))),nN=v.lazy(()=>Promise.all([i.e(200),i.e(484)]).then(i.bind(i,43484)).then(e=>({default:e.Page}))),nB={},nM=async()=>{let e=await Promise.all([i.e(200),i.e(484)]).then(i.bind(i,43484)).then(e=>e.pdfjs),n=void 0!==nP?"/static/pdfjs":null;n&&(e.GlobalWorkerOptions.workerSrc="".concat(n,"/build/pdf.worker.min.mjs"),nB={cMapUrl:"".concat(n,"/cmaps/"),standardFontDataUrl:"".concat(n,"/standard_fonts/")})},nz={container:{position:"relative",width:"100%",maxWidth:"654px",margin:"0 auto"},viewerContainer:{position:"relative",width:"100%",height:"850px",overflow:"auto",border:"1px solid #ccc"},viewerContainerFit:{position:"relative",width:"100%"},navigation:e=>(0,nf.css)(nO(),e?"50vh":"16px",eQ.Ay.raw.max.minWidth-1,eQ.Ay.raw.medium.minWidth-1),signingButtonsContainer:{position:"absolute",inset:0,zIndex:2e3,pointerEvents:"none"},signingButton:{position:"relative",display:"flex",alignItems:"center",height:"100%",left:5,pointerEvents:"auto",whiteSpace:"nowrap"},signingText:e=>({fontSize:"".concat(Math.round(e),"px"),height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"left",pointerEvents:"auto",fontFamily:"Alex Brush",whiteSpace:"nowrap",marginTop:"3%"}),pageContainer:{position:"relative",display:"block"},spinnerOverlay:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"}},nV=e=>{let{documents:n,enableClickToSign:i=!0,onClickToSignCompleted:t,fitToContent:o}=e,[a,r]=(0,v.useState)(new Set),[d,s]=(0,v.useState)(!1),[c,u]=(0,v.useState)([]),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)({}),f=(0,v.useRef)(null),y=(0,v.useRef)(null),I=nI(y,d),A="".concat(n.map(e=>e.id)),b=(0,v.useMemo)(()=>n,[A]),C=(0,v.useMemo)(()=>Date.now().toString(),[A]);(0,v.useEffect)(()=>{g({}),u(Array(b.length).fill(0))},[C]),(0,v.useEffect)(()=>{nM().then(()=>{s(!0)})},[]);let S=(0,v.useMemo)(()=>b.flatMap(e=>{var n,i;return(null==(i=e.metadata)||null==(n=i.signingInputs)?void 0:n.map(n=>({...n,documentId:e.id})))||[]}).sort((e,n)=>b.findIndex(n=>n.id===e.documentId)-b.findIndex(e=>e.id===n.documentId)||e.pageIndex-n.pageIndex||e.yPct-n.yPct||e.xPct-n.xPct),[b]),x=(0,v.useMemo)(()=>S.some(e=>!a.has("".concat(e.documentId,"-").concat(e.id))),[S,a]);(0,v.useEffect)(()=>{i&&!x&&(null==t||t())},[i,x,t]);let F=e=>{if(!e)return;let n=document.querySelector('[data-sig-anchor="'.concat(e.documentId,"-").concat(e.id,'"]'));if(!n){f.current=e;return}f.current=null,n.scrollIntoView({behavior:"smooth",block:"center"})};(0,v.useEffect)(()=>
1{if(!f.current)return;let e=b.length>0&&c.length===b.length&&c.every(e=>e>0),n=c.reduce((e,n)=>e+(n||0),0);e&&Object.keys(h).length>=n&&F(f.current)},[h,c,b]);let Y=()=>{let e=document.querySelector('[data-sig-anchor="complete"]');e&&e.scrollIntoView({behavior:"smooth",block:"start"})},T=(0,v.useMemo)(()=>{if(c.length!==b.length||c.some(e=>0===e))return new Map;let e=new Map;return S.forEach(n=>{let i=b.findIndex(e=>e.id===n.documentId),t=c[i]||0;if(n.pageIndex>=t)return void console.warn("Invalid placement: page index exceeds document page count",{placementId:n.id,documentId:n.documentId,placementPageIndex:n.pageIndex,documentPageCount:t,documentIndex:i});let l=c.slice(0,i).reduce((e,n)=>e+(n||0),0)+n.pageIndex;e.has(l)||e.set(l,[]),e.get(l).push(n)}),e},[S,c,b]),D=(e,n)=>{g(i=>i[e]===n?i:{...i,[e]:n})};if(!d)return(0,l.Y)("div",{ref:y,css:nz.container,role:"region","aria-label":"Agreements PDF viewer","data-testid":"pdf-viewer",children:(0,l.Y)(ny.A,{size:"large"})});let E=Math.min(654,window.innerWidth-40,null!=I?I:Number.MAX_SAFE_INTEGER);return(0,l.FD)("div",{ref:y,css:nz.container,role:"region","aria-label":"Agreements PDF viewer","data-testid":"pdf-viewer",children:[(0,l.Y)(nf.Global,{styles:[(0,nf.css)(nR())]}),i&&x&&(0,l.Y)("div",{css:nz.navigation(p),children:(0,l.Y)(w.A,{onClick:()=>{if(0===S.length)return;m(!0);let e=S.find(e=>!a.has("".concat(e.documentId,"-").concat(e.id)));e&&F(e)},isDisabled:0===S.length,children:p||a.size>0?"Sign":"Start"})}),(0,l.Y)("div",{css:o?nz.viewerContainerFit:nz.viewerContainer,children:b.map((e,n)=>(0,l.Y)("div",{"data-testid":"document-".concat(e.id),"data-file-url":e.content,"data-dynamic-agreement-type":e.dynamicAgreementType,children:(0,l.Y)(nL,{file:e.content,onLoadSuccess:n=>((e,n)=>{let{numPages:i}=e;u(e=>{let t=b.findIndex(e=>e.id===n);if(-1===t)return e;let l=b.map((n,i)=>e[i]||0);return l[t]=i,l})})(n,e.id),loading:(0,l.Y)(ny.A,{size:"large"}),error:"Error loading PDF",options:nB,children:Array.from(Array(c[n]||0),(t,o)=>{let d=c.slice(0,n).reduce((e,n)=>e+(n||0),0)+o,s="".concat(e.id,"-").concat(o),u=h[s],p=void 0!==u;return(0,l.FD)("div",{css:nz.pageContainer,style:{width:E,...p?{}:{minHeight:E*nF}},children:[(0,l.Y)(nN,{pageNumber:o+1,width:E,error:"Error loading page",loading:(0,l.Y)(l.FK,{}),onRenderSuccess:e=>((e,n)=>{D(e,"number"==typeof(null==n?void 0:n.height)?n.height:null)})(s,e),onRenderError:()=>{D(s,null)}}),!p&&(0,l.Y)("div",{css:nz.spinnerOverlay,children:(0,l.Y)(ny.A,{size:"large"})}),"number"==typeof u&&(0,l.Y)("div",{css:nz.signingButtonsContainer,children:((e,n,t)=>{var o;return i?(null!=(o=T.get(e))?o:[]).map(e=>{let i="".concat(e.documentId,"-").concat(e.id),o=a.has(i),d=S.findIndex(e=>"".concat(e.documentId,"-").concat(e.id)===i),s=d===S.length-1,c=Math.min(20*n/654,Math.max(10*n/654,t*e.hPct));return(0,l.Y)("div",{"data-sig-anchor":i,style:{position:"absolute",left:"".concat(100*e.xPct,"%"),top:"".concat(100*e.yPct,"%"),width:"".concat(100*e.wPct,"%"),height:"".concat(100*e.hPct,"%")},children:o?(0,l.Y)("div",{css:nz.signingText(c),children:e.name}):(0,l.Y)("div",{css:nz.signingButton,children:(0,l.Y)(w.A,{size:"smallMedium",theme:"arrowButton",preserveCase:!0,onClick:()=>{if(r(e=>new Set([...e,i])),s)setTimeout(()=>Y(),100);else{let e=S.slice(d+1).find(e=>!a.has("".concat(e.documentId,"-").concat(e.id)));e?setTimeout(()=>F(e),100):setTimeout(()=>Y(),100)}},children:"Click to Sign"})})},i)}):null})(d,E,u)})]},s)})},"".concat(e.id,"-").concat(C))},e.id))}),(0,l.Y)("div",{"data-sig-anchor":"complete"})]})},n_=(0,v.createContext)(void 0),nU=e=>{let{report:n,children:i}=e;return(0,l.Y)(n_.Provider,{value:n,children:i})},nq={container:e=>{let{colors:n}=e;return{color:n.grey1,ul:{margin:"14px 0 22px 20px","&:last-child":{marginBottom:0}},li:{marginBottom:4}}},childContent:{marginTop:16},agreementsPreviewWrapper:{margin:"20px 0 0",overflow:"hidden"},agreementsPreview:e=>{let{colors:n}=e;return{background:n.white,border:"1px solid ".concat(n.grey10),borderRadius:8,width:"100%",height:350}},agreementsPreviewPdf:{width:"calc(100% + 20px)",marginTop:-10,marginLeft:-10},buttonContainer:{margin:"16px 0"},modalCardContainer:e=>{let{fontScales:n}=e;return{margin:"16px 0",...n.default,fontWeight:700}},modalHeader:e=>{let{colors:n,fontScales:i}=e;return{...i.large,color:n.grey7}},modalInner:{padding:"12px 16px"},modalSectionTitle:e=>{let{colors:n,fontScales:i}=e;return{...i.default,fontWeight:700,color:n.grey7,marginTop:"16px"}},compactBulletList:e=>{let{fontScales:n}=e;return{...n.small}},containerWithClickToAgree:{position:"relative"},clickToAgree:e=>{let{breakpoints:n}=e;return{display:"none",position:"absolute",right:"calc(100% + 3px)",whiteSpace:"nowrap",zIndex:1,transition:"top 0.4s ease",WebkitFontSmoothing:"antialiased",[n.max]:{display:"block"},button:{marginRight:0}}},clickToAgreeInline:e=>{let{breakpoints:n}=e;return{marginTop:12,marginLeft:-31,WebkitFontSmoothing:"antialiased",[n.max]:{display:"none"}}},progressContainer:e=>{let{colors:n,fontScales:i}=e;return{display:"flex",alignItems:"center",gap:12,margin:"16px 0",...i.small,color:n.grey1}},progressTrack:e=>{let{colors:n}=e;return{flex:1,height:4,borderRadius:2,background:n.grey3,overflow:"hidden"}},progressFill:e=>{let{colors:n}=e;return{height:"100%",borderRadius:2,background:n.brand.primary,transition:"width 0.3s ease"}},progressCount:{whiteSpace:"nowrap"},certifyIntroSpacing:{marginTop:24}},nH=e=>{let{attestationsToDisplay:n,isCompact:i=!1}=e,t=no()(n,"type").filter(e=>!e.isDisplayedAsCheckboxInSelfServe);return(0,l.Y)("ul",{css:i?nq.compactBulletList:void 0,children:t.map(e=>{let{type:n,displayedCopy:i}=e;return(0,l.Y)("li",{children:(0,l.Y)(e6.A,{source:i,isInline:!1})},n)})})},nK=e=>{let{displayedCopy:n}=e;return(0,l.Y)(e6.A,{source:n,isInline:!1})},nj=e=>{var n;let{onClick:i,topOffset:t=2}=e,o=null!=(n=(0,eL.FF)("PART-1058-enable-new-self-serve-component-designs"))&&n;
1return(0,l.Y)("div",{css:nq.clickToAgree,style:{top:o?t+6:t},"data-testid":"click-to-agree",children:(0,l.Y)(w.A,{theme:"arrowButtonRight",size:"smallMedium",onClick:i,preserveCase:!0,children:"Click to Agree"})})},nW=e=>{let{onClick:n}=e;return(0,l.Y)("div",{css:nq.clickToAgreeInline,"data-testid":"click-to-agree-inline",children:(0,l.Y)(w.A,{theme:"primary",size:"smallMedium",onClick:e=>{null==e||e.preventDefault(),n()},preserveCase:!0,children:"Click to Agree"})})},nG=e=>{let{targetType:n,containerRef:i,onClickToAgree:t}=e,[o,a]=(0,v.useState)(null);return((0,v.useEffect)(()=>{let e=()=>{let e=i.current,t=n?null==e?void 0:e.querySelector('[data-attestation-anchor="'.concat(n,'"]')):void 0;e&&t&&a(t.getBoundingClientRect().top-e.getBoundingClientRect().top+2)};e(),window.addEventListener("resize",e);let t="undefined"!=typeof ResizeObserver?new ResizeObserver(e):void 0;return i.current&&t&&t.observe(i.current),()=>{window.removeEventListener("resize",e),null==t||t.disconnect()}},[n,i]),n&&null!==o)?(0,l.Y)(nj,{topOffset:o,onClick:()=>t(n)}):null},n$=e=>{let{checkedCount:n,totalCount:i}=e;return(0,l.FD)("div",{css:nq.progressContainer,"data-testid":"attestation-progress-bar",children:[(0,l.Y)("div",{css:nq.progressTrack,role:"progressbar","aria-label":"Attestations agreed","aria-valuemin":0,"aria-valuemax":i,"aria-valuenow":n,"aria-valuetext":"".concat(n," of ").concat(i),children:(0,l.Y)("div",{css:nq.progressFill,style:{width:"".concat(n/i*100,"%")}})}),(0,l.FD)("span",{css:nq.progressCount,children:[n," of ",i]})]})},nQ=e=>{let{allCheckboxAttestations:n,attestationsToDisplay:i,previousAttestationChecked:t,onAttestationCheckboxChecked:o,improvementsEnabled:a=!1,clickToAgreeTargetType:r,onClickToAgree:d}=e,s=i.filter(e=>!!e.isDisplayedAsCheckboxInSelfServe&&!e.optional);return(0,l.Y)(l.FK,{children:no()(s,"type").map(e=>{let{type:i,displayedCopy:s}=e,c=(0,l.Y)(nv.A.Checkbox,{name:i,label:(0,l.FD)(l.FK,{children:[(0,l.Y)(nK,{displayedCopy:s}),i===r&&d&&(0,l.Y)(nW,{onClick:()=>d(i)})]}),labelTheme:a?"attestation":void 0,validate:{checked:!0},isDisabled:!t(i,n),onChange:e=>{o({checked:e,type:i})}},i);return a?(0,l.Y)("div",{"data-attestation-anchor":i,children:c},i):c})})},nJ=(e,n)=>null==e?void 0:e.find(e=>{var i;return e.agreementId===n.agreementId&&(null!=(i=e.dynamicDataHash)?i:void 0)===n.dynamicDataHash}),nZ=e=>{var n,i,t,o,a,r,d,s;let{agreements:c,attestations:u,children:p,contentCopy:m="Finish your application by carefully reviewing the following legal information. Please open documents in a new tab to print or save for your records. By clicking **Agree & Submit** you are attesting that you have read and agree to each agreement.",dynamicAgreements:h,application:g,onClickToSignCompleted:f,hidePdfViewerUi:y=!1,headerCopy:I,enableClickToSign:A=!0,hideViewByAccountUi:b=!1,hideClickToAgree:C=!1,pdfFitToContent:F=!1,agreementPdfProxyPath:Y="/api/agreements/pdf"}=e,{watch:T,setValue:E}=(0,S.xW)(),[k,P]=(0,v.useState)(!1),[O,R]=(0,v.useState)(!1),L=(0,v.useRef)(null),N=null!=(o=(0,eL.FF)("ENH-3012-react-pdf-agreement-display"))&&o,B=null!=(a=(0,eL.FF)("LOAN-1586-attestations-improvements"))&&a,M=null!=(r=(0,eL.FF)("ENH-3793-new-agreements-requirements"))&&r,V=(0,v.useMemo)(()=>{var e;return null!=(e=null==h?void 0:h.filter(e=>"filledPdf"!==e.dynamicAgreementType))?e:[]},[null!=(d=null==h?void 0:h.map(e=>"".concat(e.id,":").concat(e.dynamicAgreementType)).join(","))?d:""]),{products:_}=(0,D.t)(),U=null!=(s=null==(n=g.fields)?void 0:n.accounts)?s:[{...null==g?void 0:g.fields,referenceId:z.ZSb}],q=(0,v.useContext)(n_),H=nu()((null!=c?c:[]).map(e=>e.agreementId)),K=nu()((null!=u?u:[]).filter(e=>!e.optional).map(e=>e.type)),j=nu()((null!=u?u:[]).filter(e=>e.optional).map(e=>e.type));(0,v.useEffect)(()=>{let e=H.length>0||K.length>0||j.length>0;q&&e&&q({displayedAgreementIds:H,displayedRequiredAttestationTypes:K,displayedOptionalAttestationTypes:j})},[q,H.join(","),K.join(","),j.join(",")]);let W=Array.isArray(c)&&!!c.length||!!(null==h?void 0:h.length),G=Array.isArray(u)&&!!u.length;if(!W&&!G)return null;let $=u.filter(e=>!!(null==e?void 0:e.displayAboveAgreements)),J=u.filter(e=>!(null==e?void 0:e.displayAboveAgreements)),Z=[...$,...J],X=no()(Z.filter(e=>!!e.isDisplayedAsCheckboxInSelfServe),"displayedCopy"),ee=X.filter(e=>e.optional),en=ee.length>0,et=U.length>1,el=na(Z),eo=T(),ea=el.filter(e=>!!eo[e.type]).length,er=B&&el.length>1?null==(i=el.find(e=>!eo[e.type]))?void 0:i.type:void 0,ed=e=>{let n=el.findIndex(n=>n.type===e),i=el.slice(n+1).find(e=>!T()[e.type]);setTimeout(()=>{var e,n,t;let l=i?null==(e=L.current)?void 0:e.querySelector('[data-attestation-anchor="'.concat(CSS.escape(i.type),'"]')):null==(t=L.current)||null==(n=t.closest("form"))?void 0:n.querySelector('button[type="submit"]');if(!l)return;let o=l.getBoundingClientRect().height<window.innerHeight;l.scrollIntoView({behavior:"smooth",block:i?o?"center":"start":"nearest"})},100)},es=e=>{let{checked:n,type:i}=e;if(!n){let e=new Set(X.map(e=>
1e.type)),n=Object.keys(T()),t=n.indexOf(i);-1!==t&&n.slice(t+1).filter(n=>e.has(n)).forEach(e=>E(e,!1))}E(i,n),n&&B&&el.some(e=>e.type===i)&&ed(i)},ec=e=>{E(e,!0,{shouldValidate:!0,shouldDirty:!0,shouldTouch:!0}),ed(e)},eu=e=>e.reduce((e,n)=>(e.find(e=>e&&(null==e?void 0:e.productId)===n.productId&&(null==e?void 0:e.accountVariant)===n.accountVariant)||e.push(n),e),[]),ep=(e,n)=>{if(!n.length||e===n[0].type)return!0;let i=Object.keys(T());if(!i.length)return!1;let t=i[i.indexOf(e)-1];return T()[t]||!1},em=e=>{let n=U.find(n=>n&&(null==n?void 0:n.referenceId)===e);if(n&&(null==n?void 0:n.productId)){var i;return null==(i=(0,z.Jhp)({product:_[n.productId],accountVariant:n.accountVariant}))?void 0:i.name}},eh=W&&$.some(e=>!!e.isDisplayedAsCheckboxInSelfServe&&!e.optional),ev=B&&el.length>1?(0,l.Y)(n$,{checkedCount:ea,totalCount:el.length}):null;return(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{headingTag:"h2",heading:I||(W?"Legal Agreements":"Attestations"),theme:"small"}),(0,l.Y)(ei.A,{theme:"small",children:(0,l.Y)(eU.A,{flushMobile:!0,variant:"grey",children:(0,l.FD)("div",{ref:L,css:[nq.container,B&&nq.containerWithClickToAgree],children:[B&&!C&&(0,l.Y)(nG,{targetType:er,containerRef:L,onClickToAgree:ec}),W&&$.length>0?(0,l.FD)(l.FK,{children:[(0,l.Y)("p",{children:"I certify under the penalty of perjury that:"}
1),(0,l.Y)(nH,{attestationsToDisplay:W?$:u,isCompact:B}),eh?ev:null,(0,l.Y)(nQ,{attestationsToDisplay:W?$:u,allCheckboxAttestations:X,previousAttestationChecked:ep,onAttestationCheckboxChecked:es,improvementsEnabled:B,clickToAgreeTargetType:C?void 0:er,onClickToAgree:ec})]}):null,W&&(0,l.FD)(l.FK,{children:[(0,l.Y)(e6.A,{source:m,isInline:!1}),(()=>{var e,n,i;let t;(0,Q.Z1)(c);let o=no()(c,"name").find(e=>e.hasPreview),a=(null==o?void 0:o.dynamicAgreementType)==="filledPdf"||(null==o?void 0:o.dynamicAgreementType)==="thirdPartyDynamicPdf",r=a||(null==o?void 0:o.agreementUrl.endsWith(".pdf"));t=a?M?null==(e=nJ(h,o))?void 0:e.content:null==h||null==(n=h.find(e=>e.id===o.agreementId))?void 0:n.content:null==o?void 0:o.agreementUrl;let d=y&&r?"".concat(t,"#toolbar=0&navpanes=0&scrollbar=0&view=FitH"):t,s=y&&r?[nq.agreementsPreview,nq.agreementsPreviewPdf]:nq.agreementsPreview;if(!t)return(0,l.Y)(l.FK,{});let u=/^https?:\/\//i.test(t)&&(null==o?void 0:o.agreementId)?"".concat(Y,"?agreementId=").concat(encodeURIComponent(o.agreementId)):t;return N&&r?(0,l.Y)("div",{css:nq.agreementsPreviewWrapper,"data-testid":"agreement-preview-react-pdf",children:(0,l.Y)(nY,{documents:[{id:null!=(i=null==o?void 0:o.agreementId)?i:"agreement-preview",content:u}]})}):(0,l.Y)("div",{css:nq.agreementsPreviewWrapper,children:(0,l.Y)("iframe",{src:d,frameBorder:"0",css:s,title:"Agreement preview","data-testid":"agreement-preview-iframe",id:"agreement-preview-iframe"})})})(),(0,l.Y)("ul",{children:null==(t=M?no()(c,e=>"".concat(e.agreementId,":").concat(e.dynamicDataHash)):no()(c,"name"))?void 0:t.map(e=>{var n,i;let{agreementId:t,agreementUrl:o,dynamicDataHash:a,name:r}=e,d=(e=>{if(!e)return"";switch(e.split(".").pop()){case"pdf":return"PDF Document";case"docx":case"doc":return"Word document";case"jpg":case"jpeg":case"png":return"Image";default:return"HTML document"}})(o),s=M?null==(n=nJ(h,{agreementId:t,dynamicDataHash:a}))?void 0:n.content:null==h||null==(i=h.find(e=>e.id===t))?void 0:i.content;return(0,l.Y)("li",{children:(0,l.Y)(nm.A,{href:null!=s?s:o,theme:"underline",ariaLabel:"".concat(r," ").concat(d),children:(0,l.Y)(e6.A,{source:r})})},"".concat(t,":").concat(a))})})]}),!!(null==V?void 0:V.length)&&(N?A?(0,l.Y)(nk,{documents:V,onClickToSignCompleted:f,fitToContent:F}):(0,l.Y)(nY,{documents:V.map(e=>{let{id:n,content:i,dynamicAgreementType:t}=e;return{id:n,content:i,dynamicAgreementType:t}}),fitToContent:F}):(0,l.Y)(nV,{documents:V,enableClickToSign:A,onClickToSignCompleted:f,fitToContent:F})),et&&!b&&(0,l.Y)("div",{css:nq.buttonContainer,children:(0,l.Y)(w.A,{theme:"opaque",isFull:!0,size:"mediumPreserveCase",onClick:()=>R(!0),children:"View Agreements by Account"})}),(0,l.Y)(nh.A,{isOpen:O,onClose:()=>R(!1),onClickAway:()=>R(!1),children:(0,l.FD)("div",{css:nq.modalInner,children:[(0,l.Y)(np.A.Base,{css:nq.modalHeader,children:"Agreements"}),(()=>{if(!c)return null;let e=eu(U).map(e=>e.referenceId),n=(M?c.flatMap(e=>{var n;return((null==(n=e.accountReferenceIds)?void 0:n.length)?e.accountReferenceIds:[e.referenceId]).map(n=>({...e,referenceId:n}))}):c).filter(n=>null==e?void 0:e.some(e=>e===n.referenceId)),i=ns()(n,"referenceId");return Object.keys(i).map(e=>(0,l.FD)(v.Fragment,{children:[(0,l.Y)("div",{css:nq.modalSectionTitle,children:em(e)}),i[e].map(e=>{var n,i;let t=M&&null!=(i=null==(n=nJ(h,e))?void 0:n.content)?i:e.agreementUrl,o=M?"".concat(e.agreementId,":").concat(e.dynamicDataHash):e.name;return(0,l.Y)("div",{css:nq.modalCardContainer,children:(0,l.FD)(eU.A,{children:[(0,l.Y)(e6.A,{source:e.name}),(0,l.Y)("span",{style:{marginRight:"8px"}}),(0,l.Y)(nm.A,{href:t,ariaLabel:"".concat(e.name),children:(0,l.Y)(eH.A,{size:"small",name:"expand"})})]})},o)})]},e))})()]})}),G&&(0,l.FD)(l.FK,{children:[(0,l.FD)("p",{css:W?nq.certifyIntroSpacing:void 0,children:["I ",W?"also":""," certify under the penalty of perjury that:"]}
1),(0,l.Y)(nH,{attestationsToDisplay:W?J:u,isCompact:B}),eh?null:ev,(0,l.Y)(nQ,{attestationsToDisplay:W?J:u,allCheckboxAttestations:X,previousAttestationChecked:ep,onAttestationCheckboxChecked:es,improvementsEnabled:B,clickToAgreeTargetType:C?void 0:er,onClickToAgree:ec})]}),et&&!b&&(0,l.Y)("div",{css:nq.buttonContainer,children:(0,l.Y)(w.A,{theme:"opaque",isFull:!0,size:"mediumPreserveCase",onClick:()=>P(!0),children:"View Attestations by Account"})}),(0,l.Y)(nh.A,{isOpen:k,onClose:()=>P(!1),onClickAway:()=>P(!1),children:(0,l.FD)("div",{css:nq.modalInner,children:[(0,l.Y)(np.A.Base,{css:nq.modalHeader,children:"Attestations"}),(()=>{let e=eu(U).map(e=>e.referenceId),n=u.filter(n=>null==e?void 0:e.some(e=>e===n.referenceId)),i=ns()(n,"referenceId");return Object.keys(i).map(e=>(0,l.FD)(v.Fragment,{children:[(0,l.Y)("div",{css:nq.modalSectionTitle,children:em(e)}),i[e].map(e=>(0,l.Y)("div",{css:nq.modalCardContainer,children:(0,l.Y)(eU.A,{children:(0,l.Y)(e6.A,{source:e.displayedCopy})})},e.displayedCopy))]},e))})()]})}),p&&(0,l.Y)("div",{css:nq.childContent,children:p})]})})}),en&&(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{headingTag:"h2",heading:"Optional",theme:"small"}),(0,l.Y)(ei.A,{theme:"small",children:(0,l.Y)("div",{css:nq.container,children:ee.map(e=>{let{type:n,displayedCopy:i}=e;return(0,l.Y)(nv.A.Checkbox,{name:n,label:(0,l.Y)(nK,{displayedCopy:i}),labelTheme:B?"attestation":void 0,onChange:e=>{es({checked:e,type:n})}},n)})})})]})]})};var nX=i(80049),n0=i.n(nX);let n9=["atv","auto","boat","campingTrailer","engine","golfCart","jetSki","motorcycle","motorcycleTrailer","motorhome","personalWatercraft","rv","sidecar","snowmobile","sportUtility","trailer","travelTrailer","truckCamper","tractor","tractorAttachment"],n1=["home","parkModel"];[...n9,...n1],i(425),i(11853),i(58696);var n2=i(70128),n6=i.n(n2);let n5=["internalAccount","cd","share"];var n4=i(55239),n3=i.n(n4),n8=i(81626),n7=i(86946);let ie={container:e=>{let{breakpoints:n,isNestedCard:i}=e;return{marginTop:16*!!i,marginBottom:32*!i,position:"relative",[n.medium]:{marginLeft:0,marginRight:0}}},name:e=>{let{fontScales:n}=e;return{...n.medium,display:"flex",alignItems:"center",fontWeight:"700"}},info:e=>{let{breakpoints:n}=e;return{display:"block",[n.medium]:{display:"inline"}}},infoSpacer:e=>{let{breakpoints:n}=e;return{display:"none",margin:"0 4px",[n.medium]:{display:"inline"}}},tagContainer:{marginBottom:3},sectionSmall:{marginBottom:2},sectionLarge:{marginTop:16},tag:{marginRight:6},description:{lineHeight:"120%"},editButton:(e,n)=>{let{colors:i}=e;return{position:"absolute",right:8,top:5,zIndex:999,button:{padding:0,border:"none",backgroundColor:"transparent",outline:"none"},svg:{cursor:"pointer",border:"2px solid ".concat(i.grey14),borderRadius:n,marginTop:10,marginRight:5,padding:6,background:i.white}}},primaryShareSubtitle:e=>{let{colors:n}=e;return{color:n.abyss5,fontSize:"12px"}},subtitle:e=>{let{colors:n,fontScales:i}=e;return{color:n.abyss5,...i.small}}},ii=e=>{let{name:n,subtitle:i,description:t,isEditable:o,onEditClick:a,tags:r,tagTheme:d="outline",variant:s="default",isKeyValueTableRightAligned:c=!1,mainInfo:u,attributes:p,isFlushMobile:m=!0,hideDetails:h,hideAttributes:g,primaryShareSubtitle:f,hasError:y,isNestedCard:I=!1,isViewable:A,onViewClick:b,children:C,dataTestId:S}=e,x=(0,eL.FF)("PART-1058-enable-new-self-serve-component-designs"),F=null==p?void 0:p.filter(e=>{let n=null==e?void 0:e[1];return!n3()(n)&&""!==n}),Y=null==u?void 0:u.filter(e=>!!e);return(0,l.Y)("div",{id:"".concat(n0()(n),"-card"),css:e=>ie.container({...e,isNestedCard:I}),"data-testid":S,children:(0,l.FD)(eU.A,{variant:s,flushMobile:m,hasError:y,children:[(0,l.Y)("div",{css:e=>[ie.name(e),ie.sectionSmall],children:n}),!h&&(0,l.FD)(l.FK,{children:[Array.isArray(r)&&(0,l.Y)("div",{css:ie.tagContainer,children:r.map(e=>(0,l.Y)("span",{css:ie.tag,children:(0,l.Y)(n7.A,{theme:d,children:e})},e))}),Y&&(0,l.Y)("div",{css:ie.sectionSmall,role:"main-info",children:Y.map((e,n)=>(0,l.FD)(v.Fragment,{children:[(0,l.Y)("span",{css:ie.info,children:e}),n+1!==Y.length&&(0,l.Y)("span",{css:ie.infoSpacer,children:"|"})]},n))}),f&&(0,l.Y)("span",{css:ie.primaryShareSubtitle,children:f}),i&&(0,l.Y)("span",{css:ie.subtitle,children:i}),t&&(0,l.Y)("div",{css:ie.description,children:(0,l.Y)(e6.A,{source:t})})]}),!h&&!g&&F&&!!F.length&&(0,l.Y)("div",{css:ie.sectionLarge,children:(0,l.Y)(e5.A,{keyValueMap:F,isValuesRightAligned:c})}),o&&a&&(0,l.Y)("div",{css:e=>ie.editButton(e,x?(0,n8.N)(e.borderShape):8),children:(0,l.Y)(w.A,{name:"Edit",onClick:a,"data-testid":"edit-button",children:(0,l.Y)(eH.A,{name:"pencil-minimal",color:"grey2",size:"large"})})}),A&&b&&(0,l.Y)("div",{css:e=>ie.editButton(e,x?(0,n8.N)(e.borderShape):8),children:(0,l.Y)(w.A,{name:"View",onClick:b,"data-testid":"view-button",children:(0,l.Y)(eH.A,{name:"view",color:"grey2",size:"large"})})}),C]})})},it=e=>{switch(e){case"auto":return"Vehicle";case"boat":return"Boat";case"rv":return"RV";case"motorhome":return"Motorhome";case"truckCamper":return"Truck Camper";case"motorcycle":return"Motorcycle";case"jetSki":return"Jet Ski";case"personalWatercraft":return"Personal Watercraft";case"sidecar":return"Sidecar";case"snowmobile":return"Snowmobile";case"sportUtility":return"Sport Utility";case"trailer":return"Trailer";case"travelTrailer":return"Travel Trailer";case"campingTrailer":return"Camping Trailer";case"motorcycleTrailer":return"Motorcycle Trailer";case"internalAccount":return"Account";case"cd":return"Certificate of Deposit";case"share":return"Share";case"home":return"Home";case"parkModel":return"Park Model";case"tractor":return"Tractor";case"tractorAttachment":return"Tractor Attachment";case"atv":return"ATV";case"engine":return"Engine";case"golfCart":return"Golf Cart";case"usGovernmentSecurities":return"US Government Securities";case"federalAgencySecurities":return"Federal Agency Securities";case"cashSurrenderValueLifeInsurance":return"Cash Surrender Value Life Insurance";case"listedSecurities":return"Listed Securities";case"unlistedSecurities":return"Unlisted Securities";case"municipalBonds":return"Municipal Bonds";case"corporateBonds":return"Corporate Bonds";case"mutualFunds":return"Mutual Funds";case"accountsReceivable":return"Accounts Receivable";case"rawInventory":return"Raw Inventory";case"workInProcess":return"Work in Process";case"finishedGoods":return"Finished Goods";case"otherPersonalSecured":return"Other Personal Secured"}},il=(e,n)=>Object.entries(e).map(e=>{let i,[t,o]=e,a=t in n?n[t]:void 0;if("currency"===o.type&&("string"==typeof a||"number"==typeof a))i=(0,eN.CQ)(a);else if("singleOptionSelect"===o.type&&"options"in o&&o.options){if(""===(i=(0,E.kK)({f
1ieldValue:null==a||"string"==typeof a?a:void 0,fieldConfig:o})))return null}else if("boolean"===o.type&&"options"in o&&o.options){var r;let e=o.options.find(e=>e.value===a);if(""===(i=null!=(r=null==e?void 0:e.label)?r:""))return null}else if("fieldCollection"===o.type&&"fields"in o&&"topLevelFields"in o){if(null===(i=((e,n)=>{if(!Array.isArray(n)||0===n.length)return null;let{fields:i,topLevelFields:t}=e,o=n.map(e=>{if(!e||"object"!=typeof e)return null;let n=[];for(let l of t){let t=i[l];if(t)if("costName"===l)if("otherAssessments"===e.costName){let i=e.otherAssessmentName;i&&""!==String(i).trim()&&n.push(String(i).trim())}else{let i=(0,E.uS)(t,e.costName);i&&n.push(i)}else if("inEscrow"===l)!0===e.inEscrow?n.push("In Escrow"):!1===e.inEscrow&&n.push("Not In Escrow");else{let i=(0,E.uS)(t,e[l]);i&&n.push(i)}}return n.length>0?n.join(" \xb7 "):null}).filter(e=>null!==e);return 0===o.length?null:1===o.length?o[0]:(0,l.Y)(l.FK,{children:o.map((e,n)=>(0,l.FD)(v.Fragment,{children:[n>0?(0,l.Y)("br",{}):null,e]},n))})})(o,a)))return null}else i=n[t];return[o.displayLabel,i]}).filter(e=>null!==e),io=e=>{let{collateral:n,additionalWetSignaturesNames:i,isNestedCard:t=!1,onEditClick:o}=e,a=n.rawFields,r=(0,nn.A)({entityType:"collateral"}),d=(0,nn.A)({entityType:"account"}),s=[],c=(e=>{let n,i,t;if(n=e,n9.some(e=>e===n))return"vehicle";if(i=e,n1.some(e=>e===i))return"property";return(t=e,n5.some(e=>e===t))?"financial":"other"})(a.type);if("vehicle"===c){let{type:e,idNumber:n,isUsed:i,mileage:t,make:l,model:o,year:d,...c}=r.fields;s.push([null==e?void 0:e.displayLabel,it(a.type)],...a.year&&a.make&&a.model?[["Vehicle","".concat(a.year," ").concat(a.make," ").concat(a.model)]]:[["Make",a.make],["Model",a.model],["Year",a.year]],[null==n?void 0:n.displayLabel,a.idNumber],[null==i?void 0:i.displayLabel,!0===a.isUsed?"Used":!1===a.isUsed?"New":void 0],[null==t?void 0:t.displayLabel,a.mileage],...il(c,a))}else if("property"===c){let{addressPrimary:e,type:n,...i}=r.fields,{addressPrimaryLine1:t,addressPrimaryLine2:l,addressPrimaryCity:o,addressPrimaryState:d,addressPrimaryZip:c}=a,u=t&&o&&d&&c?(0,nt.$P)({line1:t,line2:l,city:o,state:d,zip:c}):null;s.push([null==n?void 0:n.displayLabel,it(a.type)],["Address",u],...il(i,a))}else if("financial"===c){let{type:e,accountNumber:i,...t}=r.fields;s.push([null==e?void 0:e.displayLabel,it(a.type)],[null==i?void 0:i.displayLabel,"***".concat(n.accountNumberLastFour)],...il(t,a))}else{let{type:e,...n}=r.fields;s.push([null==e?void 0:e.displayLabel,it(a.type)],...il(n,a))}if(null==i?void 0:i.length){var u;s.push([null==(u=d.fields.additionalWetSignaturesNames)?void 0:u.displayLabel,i.map(e=>{let{firstName:n,lastName:i}=e;return"".concat(n," ").concat(i)}).join(", ")])}return(0,l.Y)(ii,{dataTestId:"collateral-card-".concat(n.id),name:a.isPrimaryCollateral?"Primary Collateral":"Additional Collateral",attributes:s,isNestedCard:t,isEditable:!!o,onEditClick:o,isKeyValueTableRightAligned:!0})},ia=e=>{var n,i;let t,{application:o,accountFields:a,onEditCollateralClick:r}=e,d=(e=>e&&"collateralIds"in e&&e.collateralIds||[])(a);if(0===d.length)return null;let s=(null==(n=o.collateral)?void 0:n.filter(e=>d.includes(e.id)).sort((e,n)=>{var i;return(null==(i=e.rawFields)?void 0:i.isPrimaryCollateral)?-1:1}))||[];return 0===s.length?null:(a&&"additionalWetSignaturesNames"in a&&(t=null!=(i=a.additionalWetSignaturesNames)?i:void 0),s.map(e=>(0,l.Y)(io,{collateral:e,additionalWetSignaturesNames:t,isNestedCard:!0,onEditClick:r},e.id)))};var ir=i(67970),id=i(93979);let is=["debtProtection","lifeCreditProtection","ahCreditProtection"],ic=e=>is.includes(e),iu=(e,n)=>{var i,t,l,o,a,r;let d=null==(i=e.planOptions)?void 0:i.find(i=>{var t;return i.planName===(null==n||null==(t=n[e.addOnId])?void 0:t.planName)}),s=null==d?void 0:d.planBorrowerTypes;if(!s)return;let c="joint";if((null==n||null==(l=n[e.addOnId])||null==(t=l.personIds)?void 0:t.length)===1){let i=null==(r=e.qualifyingPersonsAndPersonas)||null==(a=r.find(i=>{var t,l;return i.personId===(null==n||null==(l=n[e.addOnId])||null==(t=l.personIds)?void 0:t[0])}))?void 0:a.persona;i&&(c=i)}if("coBorrower"===c&&(null==d||null==(o=d.qualification)?void 0:o.coborrowerCoverageSupported)===!1)return;let u=s[c];if(u)return{planId:u.planId,planType:c,rate:null==u?void 0:u.rate}},ip={section:{marginTop:16},sectionTitle:e=>{let{fontScales:n}=e;return{...n.small,fontWeight:700,marginBottom:8}},dottedRow:e=>{let{fontScales:n}=e;return{...n.small,display:"flex",alignItems:"baseline",gap:8,paddingTop:4,paddingBottom:4,"&:first-of-type":{paddingTop:0}}},dottedLabel:e=>{let{colors:n}=e;return{color:n.abyss5,flexShrink:0}},dottedLeader:e=>{let{colors:n}=e;return{flex:1,minWidth:0,borderBottom:"1px dotted ".concat(n.grey14),margin:"0 4px",alignSelf:"flex-end",height:"0.75em"}},dottedValue:{flexShrink:0}},im=e=>{let{rows:n}=e;return(0,l.Y)("div",{children:n.map((e,n)=>{let[i,t]=e;return(0,l.FD)("div",{css:e=>ip.dottedRow(e),"data-testid":"addon-row-".concat(n),children:[(0,l.Y)("span",{css:e=>ip.dottedLabel(e),children:i}),(0,l.Y)("span",{css:e=>ip.dottedLeader(e)}),(0,l.Y)("span",{css:ip.dottedValue,children:t})]},n)})})},ih=e=>{let{application:n,onEditClick:i}=e,t=(e=>{var n,i,t,l,o,a,r,d,s;let c=e.rawFields?(0,eS.qk)(e.rawFields):void 0,u=null!=(n=null==c?void 0:c.selectedAddOns)?n:[],p=null!=(i=e.qualifiedAddOns)?i:[],m=null!=(t=e.persons)?t:[],h=[];for(let e of u){let n=p.find(n=>n.addOnId===e.addOnKey),i=null!=(l=null==n?void 0:n.name)?l:eF()(e.addOnKey),t=[],c=e.costs,u=null==n?void 0:n.type;if(u&&ic(u)){let i=(null==c?void 0:c.estimatedMonthlyPaymentInCents)&&Number(c.estimatedMonthlyPaymentInCents)>0?c.estimatedMonthlyPaymentInCents:void 0;if(i)t.push(["Monthly Cost",(0,eN.CQ)(i)]);
1else{let i=n&&(null==(a=iu(n,{[n.addOnId]:{addOnKey:n.addOnId,planName:null!=(r=e.planName)?r:void 0,personIds:null!=(d=e.personIds)?d:void 0,selected:!0}}))?void 0:a.rate);i&&t.push(["Rate","$".concat(new ew.A(i).toFixed(3)," per $100 of the Monthly Outstanding Loan Balance")])}if(e.planName&&t.push(["Plan",e.planName]),null==(o=e.personIds)?void 0:o.length){let n=e.personIds.map(e=>m.find(n=>n.id===e)).filter(Boolean).map(e=>(0,J.L)(e));n.length&&t.push(["Borrower(s)",n.join(", ")])}}else if("mbpCoverage"===u||"vehicleServiceContract"===u||"gapCoverage"===u){let i=(null==c?void 0:c.totalBaseCostInCents)?(0,eN.CQ)(c.totalBaseCostInCents):void 0;i&&t.push(["Amount",i]),e.planName&&t.push(["Plan",e.planName]);let l=null==n||null==(s=n.planOptions)?void 0:s.find(n=>n.planId===e.planId||n.planName===e.planName);(null==l?void 0:l.deductibleInCents)&&t.push(["Deductible",(0,eN.CQ)(l.deductibleInCents)]),!l||n3()(l.monthsCovered)||n3()(l.milesCovered)||t.push(["Coverage Terms","".concat(l.monthsCovered," Months/").concat(l.milesCovered.toLocaleString()," miles")])}else{let n=(null==c?void 0:c.totalBaseCostInCents)?(0,eN.CQ)(c.totalBaseCostInCents):void 0;n&&t.push(["Cost",n]),e.planName&&t.push(["Plan",e.planName])}t.length>0&&h.push({sectionTitle:i,rows:t})}return h})(n);return 0===t.length?null:(0,l.Y)(ii,{name:"Add-ons",isEditable:!!i,onEditClick:i,isNestedCard:!0,hideDetails:!0,hideAttributes:!0,children:t.map((e,n)=>(0,l.FD)("div",{css:ip.section,"data-testid":"addon-section-".concat(e.sectionTitle.replace(/\s/g,"-")),children:[(0,l.Y)("div",{css:e=>ip.sectionTitle(e),children:e.sectionTitle}),(0,l.Y)(im,{rows:e.rows})]},n))})},iv={modalContainer:{padding:24,textAlign:"left",display:"flex"},modalContent:{width:"100%",overflow:"hidden"},summaryTable:{display:"flex",flexDirection:"column",gap:8},summaryRow:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},icon:{width:24,height:24,display:"inline-block",verticalAlign:"middle"},dismissButton:{display:"flex",margin:"-8px -12px 0 0",justifyContent:"flex-end",alignSelf:"flex-start"},feeContainer:{display:"flex",flexFlow:"column",justifyContent:"space-around",alignItems:"flex-start",marginBottom:8},feeSectionHeader:e=>{let{fontScales:n,colors:i}=e;return{...n.small,color:i.grey7,fontWeight:700}},feeLabel:e=>{let{fontScales:n,colors:i}=e;return{...n.xsmall,color:i.grey7,fontWeight:700,textTransform:"uppercase"}},feeDescription:e=>{let{fontScales:n,colors:i}=e;return{...n.xsmall,wordWrap:"break-word",color:i.grey2,maxWidth:"100%",fontWeight:400,overflowWrap:"break-word"}},labelContainer:{display:"flex",alignItems:"center",gap:2}},ig=(e,n)=>{var i,t,l;let o=null==e?void 0:e.purposeOfLoan,a=null==e?void 0:e.purposeOfLoanList;if(o){let e=null!=(i=null==n?void 0:n.purposeOfLoan)?i:null;if(e&&"options"in e){let n=null==(t=e.options.find(e=>e.value===o))?void 0:t.label;if(n)return n}}if(a){let e=null!=(l=null==n?void 0:n.purposeOfLoanList)?l:null;if(e&&"options"in e)return e.options.filter(e=>a.includes(e.value)).map(e=>e.label).join(", ")}return""},iy=e=>{let{header:n,details:i,onClick:t}=e,o=i?(0,l.Y)(x.A,{heading:n,theme:"xsmall"}):(0,l.Y)(x.A,{heading:"",subheading:n,theme:"xsmall"}),a=[[o,(0,l.Y)("div",{css:iv.dismissButton,children:(0,l.Y)(w.A,{"data-testid":"modalClose",type:"button",theme:"inlineLink",size:"smallMedium",onClick:t,children:"CLOSE"})})],...(null==i?void 0:i.filter(e=>void 0!==e[0]&&null!==e[0]))||[]];return(0,l.Y)("div",{css:iv.modalContainer,children:(0,l.Y)("div",{css:iv.modalContent,children:(0,l.Y)("div",{css:iv.summaryTable,children:a.map((e,n)=>(0,l.FD)("div",{id:"row",css:iv.summaryRow,children:[(0,l.Y)("div",{id:"left",children:e[0]}),(0,l.Y)("div",{id:"right",children:e[1]})]},n))})})})},iI=(e,n)=>(0,l.FD)("div",{css:iv.feeContainer,children:[(0,l.Y)("h4",{css:e=>iv.feeLabel(e),children:e}),n&&(0,l.Y)(e6.A,{source:n,css:e=>iv.feeDescription(e)})]}),iA=(e,n,i)=>[(0,l.Y)("h4",{css:e=>iv.feeLabel(e),children:e},i),(0,eN.CQ)(n)],ib=e=>{let{label:n,modalControl:i,showIcon:t}=e;return(0,l.FD)("div",{css:iv.labelContainer,children:[(0,l.Y)("span",{children:n}),!1!==t&&(0,l.Y)("div",{id:"".concat(n0()(n),"-modal-info"),"data-testid":"".concat(n0()(n),"-modal-info"),css:iv.icon,onClick:i.openModal,children:(0,l.Y)(eH.A,{name:"info"})})]})},iC=e=>{var n,i,t,o,a,r;let{application:d,isClosing:s=!1,useOfferLoanAmount:c=!1,onEditAutopay:u,onCollateralEditClick:p,calculatePaymentAmount:m}=e,{products:h,clientDetails:{clientName:g,customerServiceNumber:y}}=(0,D.t)(),I=(0,ir.h9)(),A=(0,ir.h9)(),b=(0,ir.h9)(),C=(0,ir.h9)(),{watch:w}=(0,S.xW)(),{fields:x}=(0,T.d)(),{triggerMessage:F}=(0,f.d)(),[Y,E]=(0,v.useState)(null),[k,P]=(0,v.useState)(!1),O
1=w("acceptedLoanAmountCents"),{products:R,disbursalMethods:L}=d,N=(0,eS.qk)(d.rawFields),B=null==R?void 0:R.find(e=>"loan"===e.type),M=((e,n,i,t)=>{var l,o,a;return i?null!=(l=null==e?void 0:e.acceptedLoanAmountCents)?l:"0":t?null!=(o=null==e?void 0:e.offerLoanAmountCents)?o:"0":null!=(a=new ew.A(n||"0").toString())?a:"0"})(N,O,s,c),z=L.find(e=>{var n;return null==N||null==(n=N.disbursalMethods)?void 0:n.some(n=>"accountId"in n.method&&n.method.accountId===e.id)}),V=!!(null==N?void 0:N.autopayDiscountRate),_=z&&h&&"".concat(eD(h,z.productType,z.productId,z.accountVariant)," ").concat((0,eN.DY)(z.maskedAccountNumber||z.lastFour)),U=(0,v.useMemo)(()=>{var e;return null!=(e=null==N?void 0:N.selectedAddOns)?e:[]},[null==N?void 0:N.selectedAddOns]),q=null!=(i=null==Y?void 0:Y.fees)?i:[],H=q.filter(e=>!e.isAddOn),K=q.filter(e=>e.isAddOn),j=null==Y?void 0:Y.totalFeesAndAddOnsAmountCents,W=null!=(t=null==Y?void 0:Y.totalFeesAmountCents)?t:"0",G=null!=(o=null==Y?void 0:Y.totalAddOnsAmountCents)?o:"0",$=null==Y?void 0:Y.disbursalAmountCents,Q=q.some(e=>"subtracted"===e.type),J=U.length?"Fees & Add Ons":"Fees",Z=ib({label:J,modalControl:I,showIcon:q.length>0}),X=ib({label:"Disbursal Amount",modalControl:A,showIcon:Q}),ee=ib({label:"Interest Rate",modalControl:C,showIcon:V}),en=ib({label:"Payment Amount",modalControl:b}),ei=ib({label:"Rate Discount",modalControl:C}),et=null!=(a=null==N?void 0:N.acceptedLoanRate)?a:null==N?void 0:N.offerLoanRate,el=(null==B?void 0:B.loanType)==="creditCard",eo=(null==B?void 0:B.loanType)==="lineOfCredit",ea=!m||!et||!M,er=(0,v.useMemo)(()=>({applicationId:d.id}),[d.id]),ed=(0,v.useCallback)(async()=>{if(ea){E(null),P(!1);return}try{let e=await m({amountFinanced:M,selectedAddOns:U,...er});if(!e){E(null),F("Payment calculation failed. Please call us ".concat(y),{theme:"error"});return}E(e)}catch(e){E(null),F("Payment calculation failed. Please call us ".concat(y),{theme:"error"})}finally{P(!1)}},[m,ea,d.id,M,er,U,F,y]),es=(0,v.useMemo)(()=>ej()(ed,500),[ed]);(0,v.useEffect)(()=>ea?void P(!1):(P(!0),es(),()=>{es.cancel()}),[m,null==N?void 0:N.acceptedLoanTermMonths,et,M,d.id,ea,es]);let ec=s||c,eu=!el,ep=!!(null==B?void 0:B.fees)&&(null==B?void 0:B.loanType)==="termLoan",em=!el&&!eo&&!ea&&!!et&&!!(null==N?void 0:N.offerLoanTermMonths)&&!!M,eh=(()=>{var e,n;return[{key:"loanAmount",label:null!=(n=null==x||null==(e=x.offerLoanAmountCents)?void 0:e.displayLabel)?n:"Loan Amount",getValue:()=>(0,eN.CQ)(M),condition:()=>!!ec&&!!M},{key:"productType",label:"Product Type",getValue:()=>{var e;return null!=(e=(null==B?void 0:B.type)&&e_()(B.type))?e:null}},{key:"repaymentTerm",label:"Repayment Term",getValue:()=>"".concat(null==N?void 0:N.offerLoanTermMonths," months"),condition:()=>eu&&!!(null==N?void 0:N.offerLoanTermMonths)},{key:"interestRate",label:ee,getValue:()=>"".concat(et,"%"),condition:()=>!!et},{key:"purpose",label:"Purpose",getValue:()=>ig(N,x)},{key:"loanDisbursal",label:"Loan Disbursal",getValue:()=>"Upon signing closing docs",condition:()=>s},{key:"disbursalAccount",label:"Disbursal Account",getValue:()=>null!=_?_:null,condition:()=>s&&!!_},{key:"fees",label:Z,getValue:()=>k?(0,l.Y)(ny.A,{size:"small"}):"string"==typeof j?(0,eN.CQ)(j):"-",condition:()=>!!(null==B?void 0:B.fees)||U.length>0},{key:"disbursal",label:X,getValue:()=>k?(0,l.Y)(ny.A,{size:"small"}):"string"==typeof $?(0,eN.CQ)($):"-",condition:()=>ep},{key:"paymentAmount",label:en,getValue:()=>k?(0,l.Y)(ny.A,{size:"small"}):(null==Y?void 0:Y.paymentAmount)?(0,eN.CQ)(Y.paymentAmount):"-",condition:()=>em},{key:"balloonPayment",label:"Balloon Payment",getValue:()=>(0,eN.CQ)(null==N?void 0:N.balloonPaymentAmountCents),condition:()=>!!(null==N?void 0:N.balloonPaymentAmountCents)},{key:"offerExpiration",label:"Offer Expiration",getValue:()=>(0,eY.wV)(d.expireAt,{dateFormat:eY.Kn.FULL_MONTH_DAY_YEAR})}]})().filter(e=>!e.condition||e.condition()).map(e=>[e.label,e.getValue()]).filter(e=>{let[,n]=e;return null!==n&&""!==n}),ev=!!d.autopayRequirement&&"disabled"!==d.autopayRequirement,eg=d.autopayFundingSource,ef=eg&&(0,id.po)({name:"CustomerInternalAccountFundingSource"===eg.__typename?(0,id.pS)({internalAccount:eg,configProducts:h}):"name"in eg&&eg.name,lastFour:eg.lastFour,accountType:"accountType"in eg&&eg.accountType,institutionName:"CustomerInternalAccountFundingSource"===eg.type?g:"institutionName"in eg&&eg.institutionName,logo:"logo"in eg&&eg.logo}),ey=(null==B?void 0:B.loanType)&&!["posDirectUnderwriting","posSkipUnderwriting"].includes(B.loanType)?eF()(B.loanType):"Loan Details";return(0,l.FD)(l.FK,{children:[(0,l.FD)(e3,{title:ey,details:eh,children:[ev&&(0,l.Y)(ii,{name:"Automatic Payment",attributes:eg?[["Payment Source",null==ef?void 0:ef.accountAttribute],["Payment Institution",null==ef?void 0:ef.institutionNameWithLogo],[ei,(null==N?void 0:N.autopayDiscountRate)?"".concat(null==N?void 0:N.autopayDiscountRate,"%"):null]]:[["Signed up","No"]],isEditable:!s,onEditClick:u,isNestedCard:!0,isKeyValueTableRightAligned:!0}),!s&&(0,l.Y)(ia,{application:d,accountFields:N,onEditCollateralClick:p}),(null!=(r=null==N||null==(n=N.selectedAddOns)?void 0:n.length)?r:0)>0&&(0,l.Y)(ih,{application:d})]}),(0,l.Y)(nh.A,{isOpen:I.modalIsOpen,onClose:I.closeModal,onClickAway:I.closeModal,canClose:!1,children:(0,l.Y)(iy,{header:J,details:((e,n,i,t,o)=>{let a=!!n.length,r=e.filter(e=>"accounting"!==e.type&&"lenderPaid"!==e.type).map(e=>{let{label:n,description:i,amountCents:t}=e;return[iI(n,i),(0,eN.CQ)(t)]}),d=n.map(e=>{let{label:n,description:i,amountCents:t}=e;return[iI(n,i),(0,eN.CQ)(t)]}),s=a?iA("Fees Subtotal",t,"fees-subtotal"):[],c=a?iA("Add Ons Subtotal",o,"add-ons-subtotal"):[],u=iA(a?"Total Fees & Add Ons":"Total Fees",i,"total-fees-add-ons"),p=[...a?[(0,l.Y)("h4",{css:e=>iv.feeSectionHeader(e),children:"Fees"},"fees")]:[]];return[[...a?[(0,l.Y)("h4",{css:e=>iv.feeSectionHeader(e),children:"Add Ons"},"add-ons")]:[]],...d,p,...r,c,s,u]})(H,K,null!=j?j:"0",W,G),onClick:I.closeModal})}),(0,l.Y)(nh.A,{isOpen:A.modalIsOpen,onClose:A.closeModal,onClickAway:A.closeModal,canClose:!1,children:(0,l.Y)(iy,{header:"Disbur
1sal Amount",details:((e,n,i)=>{let t=["Loan amount",(0,eN.CQ)(n)];return[t,...e.filter(e=>"subtracted"===e.type).map(e=>{let{label:n,amountCents:i}=e;return[n,"-".concat((0,eN.CQ)(i))]}),["Disbursal amount",(0,eN.CQ)(i)]]})(q,M,null!=$?$:M),onClick:A.closeModal})}),(0,l.Y)(nh.A,{isOpen:b.modalIsOpen,onClose:b.closeModal,onClickAway:b.closeModal,canClose:!1,children:(0,l.Y)(iy,{header:"Estimated payment amount is for informational purposes only. Final payment amounts will be based on the agreed-upon loan terms and the date at which loan closing occurs.",onClick:b.closeModal})}),(0,l.Y)(nh.A,{isOpen:C.modalIsOpen,onClose:C.closeModal,onClickAway:C.closeModal,canClose:!1,children:(0,l.Y)(iy,{header:"Interest Rate",details:(e=>{let n=["Base interest rate","".concat(null==e?void 0:e.offerLoanRate,"%")],i=["Auto payment rate discount",(null==e?void 0:e.autopayDiscountRate)?"-".concat(null==e?void 0:e.autopayDiscountRate,"%"):"0.00%"],t=null==e?void 0:e.acceptedLoanRate;return[n,i,["Final interest rate",t?"".concat(t,"%"):"".concat(null==e?void 0:e.offerLoanRate,"%")]]})(N),onClick:C.closeModal})})]})};var iS=i(38724),iw=i(16635);let ix={innerBannerContainer:{display:"flex",alignItems:"center"},bannerTitle:e=>{let{fontScales:n}=e;return{fontWeight:500,...n.default}},bannerBody:e=>{let{fontScales:n}=e;return{...n.small}}},iF=e=>{let{attestations:n,confirmAgreementCopy:i,improvementsEnabled:t,pdfSigningComplete:o,confirmAgreement:a,onConfirmAgreementChange:r}=e,d=(0,v.useMemo)(()=>na(n).map(e=>e.type),[n]),s=(0,S.FH)({name:d}).every(e=>!!e);return(0,l.FD)(eU.A,{variant:"grey",children:[(0,l.Y)(x.A,{heading:"Signatures",theme:"small"}),(0,l.FD)("div",{css:{position:"relative"},children:[t&&!a&&o&&s&&(0,l.Y)(nj,{onClick:()=>r(!0)}),(0,l.Y)(eq.A,{id:"confirm-agreement",name:"confirmAgreement",type:"checkbox",label:t?(0,l.Y)(nK,{displayedCopy:i}):(0,l.Y)(e6.A,{source:i}),labelTheme:t?"attestation":void 0,isChecked:a,onChange:e=>r(e.target.checked),"aria-description":"By signing, you agree to the terms contained in the agreement"})]})]})},iY=e=>{var n,i;let{application:t,agreements:o,attestations:a,handleSubmit:r,isLoading:d,dynamicAgreements:s,calculatePaymentAmount:c}=e,u=s.some(e=>{var n,i;return null==e||null==(i=e.metadata)||null==(n=i.signingInputs)?void 0:n.length}),p=null!=(i=(0,eL.FF)("LOAN-1586-attestations-improvements"))&&i,[m,h]=(0,v.useState)(!1),[g,f]=(0,v.useState)(!1);(0,v.useEffect)(()=>{f(window.innerWidth<eQ.Ay.raw.large.minWidth)},[]);let{products:A,organization:b,persons:C,primarySigner:S}=t,F=(0,eS.qk)(t.rawFields),Y=null==A?void 0:A.find(e=>"loan"===e.type),T=(null==b?void 0:b.rawFields.taxIdType)===nr.LC.EIN,D=null==t?void 0:t.expireAt,E=(e=>{if(!e)return -1;let n=Date.now();return(0,iS.A)(n,e)?-1:(0,iw.A)(e,n)})(D?(0,eB.A)(new Date(D)):void 0),[P,O]=(0,v.useState)(!1),[R,L]=(0,v.useState)(E>=0&&E<=7),N=o.find(e=>!!e.dynamicAgreementType);(0,Q.Z1)(N,"no dynamic agreement");let B=C.find(e=>e.id===S);(0,Q.Z1)(B,"no primary signer set");
1let M=null==F||null==(n=F.newAccountRelationshipData)?void 0:n.filter(e=>"guarantor"===e.role).map(e=>"personId"in e&&e.personId),z=ez()(C,e=>e.id!==S).map(e=>{let{id:n,firstName:i,lastName:t,middleName:l,suffix:o,emailPrimary:a,rawFields:r,existingSignatures:d}=e;if(null==M?void 0:M.includes(n)){let e;return d&&d.length>0&&(e=((e,n,i)=>{let t=e.find(e=>e.personId===i&&e.agreementId===n);if(t)return(0,eY.wV)(t.createdAt,{dateFormat:eY.Kn.MONTH_DAY_YEAR_WITH_SLASHES})})(d,null==N?void 0:N.agreementId,n)),{name:(0,J.L)({firstName:i,lastName:t,middleName:l,suffix:o}),role:"Guarantor",email:a,addressFirstLine:(0,eN.QE)({addressPrimaryLine1:r.addressPrimaryLine1,addressPrimaryLine2:r.addressPrimaryLine2}),addressSecondLine:(0,eN.Ax)({addressPrimaryCity:r.addressPrimaryCity,addressPrimaryState:r.addressPrimaryState,addressPrimaryZip:r.addressPrimaryZip}),dateOfSignature:e}}return null}).filter(Boolean),V=z.length>1?"Persons":"Person",_=s.length>1?"By signing, you agree to the terms contained in the agreements.":"By signing, you agree to the terms contained in the agreement.";(0,Q.Z1)(null==F?void 0:F.acceptedLoanAmountCents,"no accepted loan amount set");let U=(0,l.FD)(ei.A,{children:[(0,l.Y)(x.A,{headingTag:"h2",heading:"".concat(e_()((null==Y?void 0:Y.type)||"")," Details"),theme:"small"}),(0,l.Y)(I.Ay,{account:null!=F?F:{},application:t,organizationKycEvaluationTags:null==t?void 0:t.organizationKycEvaluationTags,personKycEvaluationTags:null==t?void 0:t.personKycEvaluationTags,children:(0,l.Y)(iC,{application:t,isClosing:!0,calculatePaymentAmount:c})})]}),q=b&&(0,l.FD)(ei.A,{children:[(0,l.Y)(x.A,{headingTag:"h2",theme:"small",heading:"Business Information"}),(0,l.Y)(e3,{title:(null==b?void 0:b.legalName)||"",details:[["Business type",(0,eN.In)((null==b?void 0:b.type)||"")],["Tax ID number (".concat(T?"EIN":"SSN",")"),(0,l.Y)(e8.A,{taxIdLastFour:null==b?void 0:b.taxIdLastFour,isEIN:T},"taxId")],["Address",(0,nt.M0)((null==b?void 0:b.rawFields)||"")]]})]}),H=(0,l.Y)(l.FK,{children:M&&M.length>0&&(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{headingTag:"h2",theme:"small",heading:"".concat(V," Information")}),(0,l.Y)("div",{css:{display:"flex",flexDirection:"column",flexWrap:"wrap",gap:"24px",paddingBottom:"48px"},children:z.map(e=>(0,l.Y)(l.FK,{children:e&&(0,l.Y)(e3,{title:e.name,subheading:e.email||"",details:[["Role",e.role]]},e.name)}))})]})});return(0,l.FD)(l.FK,{children:[(0,l.Y)(e2,{animateInOut:R,onDismiss:()=>L(!1),children:(0,l.FD)("div",{css:ix.innerBannerContainer,children:[(0,l.Y)("div",{style:{marginRight:"0.5rem"},children:(0,l.Y)(eH.A,{name:"alert-circle"})}),(0,l.FD)("div",{children:[(0,l.FD)("p",{css:ix.bannerTitle,children:["Offer expires"," ",(0,eY.wV)(D,{dateFormat:eY.Kn.MONTH_DAY})]}),(0,l.Y)("p",{css:ix.bannerBody,children:"Your application will be canceled if it's not completed ".concat((e=>1===e?"within 1 day":e<1?"today":"within ".concat(e," days"))(E),".")})]})]})}),(0,l.Y)(k.A,{children:(0,l.FD)(y.A,{onSubmit:r,children:[(0,l.FD)(ni,{application:t,organizationKycEvaluationTags:null==t?void 0:t.organizationKycEvaluationTags,personKycEvaluationTags:null==t?void 0:t.personKycEvaluationTags,children:[(0,l.Y)(x.A,{heading:"Sign Closing Documents",subheading:"Please review all of the information below, agree and sign agreements to complete your ".concat(null==Y?void 0:Y.type," application.")}),U,q,H,(0,l.Y)(nZ,{dynamicAgreements:s,agreements:[],attestations:a,application:t,onClickToSignCompleted:()=>h(!0),hideViewByAccountUi:!0,hideClickToAgree:u&&!m,pdfFitToContent:g})]}),(0,l.Y)("div",{css:{marginBottom:24},children:(0,l.Y)(iF,{attestations:a,confirmAgreementCopy:_,improvementsEnabled:p,pdfSigningComplete:!u||m,confirmAgreement:P,onConfirmAgreementChange:O})}),(0,l.Y)(w.A,{type:"submit",name:"submit",isFull:!0,isLoading:d,isDisabled:!P||u&&!m,children:u?"Submit":"Click to Sign"})]})})]})};var iT=i(57200);let iD=()=>{let[e,{loading:n,error:i}]=(0,iT._)(eA.iQ),[t,l]=(0,v.useState)(!1),[o,a]=(0,v.useState)(null);return{calculatePayment:(0,v.useCallback)(async n=>{l(!0);try{var i,t,o;let l=await e({variables:n});return a((null==(t=l.data)||null==(i=t.calculatePaymentAmount)?void 0:i.paymentAmount)||null),null==(o=l.data)?void 0:o.calculatePaymentAmount}catch(e){throw a(null),e}finally{l(!1)}},[e]),result:o,loading:n,error:i,isCalculating:t}};var iE=i(38595),ik=i(49542);function iP(){let e=(0,ng._)(["\n  query GetDynamicDocuments(\n    $applicationId: ID!\n    $documentRequestType: DynamicDocumentRequestType!\n    $signerType: SignerType\n  ) {\n    dynamicDocuments(\n      applicationId: $applicationId\n      documentRequestType: $documentRequestType\n      signerType: $signerType\n    ) {\n      id\n      applicationId\n      type\n      content\n      name\n      dynamicAgreementType\n      forSignerId\n      requireInBranchClosing\n      agreementId\n      dynamicDataHash\n      metadata {\n        signingInputs {\n          id\n          pageIndex\n          xPct\n          yPct\n          wPct\n          hPct\n          name\n        }\n      }\n    }\n  }\n"]);return iP=function(){return e},e}
1let iO=(0,iE.J1)(iP()),iR=e=>{let{signerType:n=null,documentRequestType:i,skip:t=!1}=e,{applicationId:l}=(0,u.YY)(),{data:{dynamicDocuments:o=[]}={},loading:a,refetch:r,error:d}=(0,ik.I)(iO,{variables:{applicationId:l,documentRequestType:i,signerType:n},skip:!l||t});return{dynamicDocuments:o,isLoading:a,refetch:r,error:d}};var iL=i(23840),iN=i(38596),iB=i(62898),iM=i(23675);let iz=e=>{var n,i,t;let{application:o,onSubmitDisbursalMethod:a,onSubmitDisbursalProduct:r}=e,{products:d,funding:s}=(0,D.t)(),c=o.disbursalMethods.map(e=>({value:e.id,label:eD(d,e.productType,e.productId,e.accountVariant),description:(0,eN.DY)(e.maskedAccountNumber||e.lastFour)})),[u,p]=(0,v.useState)(null),{isLoading:m,onClick:h}=(0,iB.A)({onClick:a}),{isLoading:g,onClick:f}=(0,iB.A)({onClick:r}),y=null==(n=o.products)?void 0:n.find(e=>"loan"===e.type),I=null==y?void 0:y.disbursalProduct,A=I?d[I.productId]:null,b=A?(0,eT.y)(A,null==I?void 0:I.accountVariant):null,C=null!=(t=null==b?void 0:b.disqualifyingProductIds)?t:[],S=A&&!C.includes(A.id)?{sourceType:"INTERNAL_TRANSFER",inputId:A.id,logo:null}:null,F=[{fundingMethods:(null==y?void 0:y.fundingMethods)?y.fundingMethods:void 0,sourceType:"MANUAL",inputId:"sendCheck",logo:null},...c.map(e=>({...e,fundingMethods:(null==y?void 0:y.fundingMethods)?y.fundingMethods:void 0,sourceType:"INTERNAL_TRANSFER",inputId:e.value,logo:null}))].filter(e=>((e,n)=>{var i,t,l,o,a;if(!e.fundingMethods)return!1;let r="INTERNAL_TRANSFER"===e.sourceType?null==(i=e.fundingMethods.internalTransfer)?void 0:i.id:null==(t=e.fundingMethods.manual)?void 0:t.id,d=!!r&&(null==(l=n[r])?void 0:l.enabled)&&"isDisbursalFundingMethod"in n[r]&&n[r].isDisbursalFundingMethod;return("INTERNAL_TRANSFER"===e.sourceType?null==(o=e.fundingMethods.internalTransfer)?void 0:o.enabled:null==(a=e.fundingMethods.manual)?void 0:a.enabled)&&d})(e,s.methods)),Y=!!S,T=F.some(e=>"INTERNAL_TRANSFER"===e.sourceType),E=!Y&&!T&&1===F.length&&"MANUAL"===F[0].sourceType,P=(0,eS.qk)(o.rawFields),O=!(null==P||null==(i=P.disbursalMethods)?void 0:i.length);return E&&O?(0,l.Y)(iM.A,{}):(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{heading:"Select the account for loan distribution",subheading:"Select the account where your loan will be distributed to."}),!!(null==c?void 0:c.length)&&(0,l.FD)(ei.A,{children:[Y&&(0,l.Y)(x.A,{theme:"xsmall",heading:"Select an Existing Account",headingTag:"h2",tag:"recommended"}),(0,l.Y)(iL.A,{options:c,onChange:p,name:"disbursalMethods",type:"radio",theme:"fullWidth",labelTheme:"row"}),(0,l.Y)(w.A,{isFull:!0,isDisabled:!u,isLoading:m,onClick:()=>{if(u)return h({type:"internalTransfer",accountId:u})},children:"Next"})]}),Y&&(0,l.FD)(ei.A,{children:[(0,l.Y)(x.A,{theme:"xsmall",heading:"Open a New Account",headingTag:"h2"}),A&&(0,l.Y)(iN.A,{product:A,buttonText:"Select",onClick:()=>{let e=null==I?void 0:I.productId,n=null==I?void 0:I.accountVariant,i=null==A?void 0:A.type;if(!e||!n||!i)throw Error("Disbursal product or account variant not found");return f({productId:e,accountVariant:n,productType:i})},isLoading:g})]})]})};var iV=i(70105),i_=i(86366);let iU={outerShell:{padding:"1rem"},container:{display:"flex",flexDirection:"column",alignItems:"center"},heading:{textAlign:"center",width:"100%"},centerIconShell:{height:"8.75rem",margin:"2.5rem 0"},centerIcon:{height:"140px",width:"unset"},headerWeight:{fontWeight:600},continueInTheApp:{marginBottom:".75rem"},signInWithYourNewCredentials:{marginBottom:"2rem"},buttonShell:{maxWidth:"21.5rem",width:"100%"}},iq=e=>{var n;let{buttonUrl:i,onManageAccountServicesClick:t}=e,{mantlFeatures:o}=(0,D.t)();return(0,l.FD)("div",{css:[iU.container,iU.outerShell],children:[(0,l.Y)("div",{css:iU.heading,children:(0,l.Y)("div",{css:[i_.A.xxlarge,iU.headerWeight],children:"You're All Set!"})}),(0,l.Y)("div",{css:iU.centerIconShell,children:(0,l.Y)(eH.A,{css:iU.centerIcon,name:"illustration-mobile-banking",size:"xxlarge"})}),(0,l.Y)("div",{css:[iU.heading,iU.continueInTheApp,iU.headerWeight,i_.A.large],children:"Continue in the App"}),(0,l.FD)("div",{css:[iU.container,iU.signInWithYourNewCredentials,i_.A.default],children:["Sign in with your new credentials to:",(0,l.FD)("ul",{css:iU.container,children:[(0,l.Y)("li",{children:"Get your card"}),(0,l.Y)("li",{children:"Make transfers"}),(0,l.Y)("li",{children:"Setup alerts, and more!"})]})]}),(0,l.FD)("div",{css:iU.buttonShell,children:[(0,l.Y)(w.A,{isFull:!0,name:"downloadTheAppButton",size:"large",theme:"primary",href:i,children:"Go to Mobile App"}),(null==(n=o.alkami)?void 0:n.showOnboardingButton)&&(0,l.Y)(w.A,{isFull:!0,name:"manageAccountServicesButton",size:"large",theme:"link",onClick:t,children:"Manage Account Services"})]})]})};var iH=i(65603),iK=i(68886),ij=i(40610),iW=i(40037),iG=i(98287);let i$=e=>{let{application:n,account:i,maritalStatus:t,addressPrimaryState:o}=e,a=(0,S.FH)({name:"purposeOfLoan"});return(0,l.Y)(iG.A,{children:(0,l.FD)(I.Ay,{account:null!=i?i:null,application:n,maritalStatus:t,addressPrimaryState:o,organizationKycEvaluationTags:null==n?void 0:n.organizationKycEvaluationTags,personKycEvaluationTags:null==n?void 0:n.personKycEvaluationTags,selectedPurposeOfLoan:a,children:[(0,l.Y)(ee.A,{fieldIds:$.A.ACCOUNT.PROFILE_FIELDS}),(0,l.Y)(ee.A,{fieldIds:$.A.ACCOUNT.PREFERRED_BRANCH_FIELDS}),(0,l.Y)(ee.A,{fieldIds:$.A.ACCOUNT.INTEREST_EARNED_FIELDS})]})})},iQ=e=>{var n,i;let{application:t,activeAccount:o,maritalStatus:a,addressPrimaryState:r,submitText:d="Continue",headerText:s="Application Info",subheaderText:c,onSubmit:u,isSubmitting:p,config:m}=e,h=C()(null==t?void 0:t.fields,[...$.A.ACCOUNT.PROFILE_FIELDS,...$.A.ACCOUNT.PREFERRED_BRANCH_FIELDS,...$.A.ACCOUNT.INTEREST_EARNED_FIELDS]),v=(0,eS.qk)(null==t?void 0:t.rawFields),g=(0,eS.bb)(null==t?void 0:t.rawFields),f=null!=(n=null!=o?o:v)?n:g?void 0:t.rawFields,I=(null==f?void 0:f.productId)?(0,eT.y)(m.products[f.productId],null!=(i=f.accountVariant)?i:void 0).displayName:"";return(0,l.Y)(y.A,{onSubmit:u,initialValues:h,children:(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{heading:s,subheading:c||"We'll collect some basic information for your **".concat(I,"** application.")}),(0,l.Y)(ei.A,{theme:"small",children:(0,l.Y)(i$,{application:t,account:f,maritalStatus:a,addressPrimaryState:r})}),(0,l.Y)(w.A,{type:"submit",isFull:!0,isLoading:p,children:d})]})})},iJ=e=>{let{requirements:n,accountsWithRequirements:i,onClickAccount:t}=e,o=(0,D.t)();return(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{heading:"Provide Additional Information"}),null==i?void 0:i.map(e=>{var i;return e&&(0,l.Y)(V.A,{size:"large",title:null==(i=(0,z.Jhp)({product:o.products[e.productId],accountVariant:e.accountVariant}))?void 0:i.name,titleTag:(e=>{var i,t;let l=(null==n||null==(i=n.find(n=>n.accountReferenceId===e))?void 0:i.status)==="incomplete",o=(null==n||null==(t=n.find(n=>n.accountReferenceId===e))?void 0:t.status)==="complete";return l?{text:"Required",theme:"danger"}:o?{text:"Completed",theme:"success",isAnimated:!0}:null})(e.referenceId),description:null==e?void 0:e.accountName,onClick:()=>t(e.referenceId)},e.referenceId)})]})};var iZ=i(70418);i(50985);let iX=e=>{var n,i;let{totalExistingSecondaryAccountOwners:t,totalPendingApplicants:l=0,accountVariant:o,product:a,hasPendingCDASO:r=!1}=e,d=o&&(null==a||null==(i=a.accountVariants)||null==(n=i[o])?void 0:n.maxSecondaryOwners)||(null==a?void 0:a.maxSecondaryOwners)||1;return{hasMaxJointOwnership:t+l>=d||r,hasMaxPendingJointOwnership:d-t<l}};var i0=i(91924),i9=i(95499);let i1={container:{marginBottom:"1rem"},name:{fontWeight:"bold"},email:e=>{let{colors:n,fontScales:i}=e;return{...i.small,color:n.grey1,marginBottom:8}},actionsRow:{display:"flex",justifyContent:"space-between",marginTop:"1.25rem"},actionButton:{width:"calc(50% - 5px)"}},i2=e=>{let{jointOwner:n,onEditClick:i,onRemoveClick:t}=e,o=(0,J.L)(n);return(0,l.Y)("div",{css:i1.container,children:(0,l.FD)(eU.A,{flushMobile:!0,children:[(0,l.Y)(np.A.Base,{css:i1.name,children:o}),(0,l.Y)("p",{css:i1.email,children:n.emailPrimary}),(0,l.FD)("div",{css:i1.actionsRow,children:[(0,l.Y)("div",{css:i1.actionButton,children:(0,l.Y)(w.A,{theme:"opaque",size:"mediumPreserveCase",isFull:!0,onClick:i,staticid:"".concat(n0()(o),"-edit"),children:(0,l.Y)(np.A.H5,{children:"Edit"})})}),(0,l.Y)("div",{css:i1.actionButton,children:(0,l.Y)(w.A,{theme:"opaque",size:"mediumPreserveCase",isFull:!0,onClick:t,staticid:"".concat(n0()(o),"-remove"),children:(0,l.Y)(np.A.H5,{children:"Remove"})})})]})]})})};var i6=i(58250),i5=i(37034);let i4={formSection:{marginBottom:32}},i3=e=>{let{children:n,heading:i,subheading:t,icon:o,isCentered:a,"data-testid":r}=e;return(0,l.FD)("div",{"data-testid":r,css:i4.formSection,children:[(0,l.Y)(x.A,{headingTag:"h2",heading:i,subheading:t,icon:o,theme:"xsmall",isCentered:a}),n]})},i8={formContainer:{padding:"1rem"}},i7=e=>{let{onClose:n,isOpen:i,children:t}=e;return i5.createPortal((0,l.Y)(nh.A,{onClose:n,isOpen:i,children:t}),document.body)},te=e=>{let{allowConsumerFiduciaryAuthSigners:n,modalIsOpen:i,onModalClose:t,onSubmit:o,jointOwnerToEdit:a}=e,{formHeader:r,buttonCopy:d}=n?{formHeader:"New Authorized Signer",buttonCopy:"Add Authorized Signer"}:{formHeader:"New Joint Owner",buttonCopy:"Add Joint Owner"};return(0,l.Y)(i7,{isOpen:i,onClose:t,children:(0,l.Y)(y.A,{initialValues:a||null,onSubmit:e=>{o(e)},children:(0,l.FD)("div",{css:i8.formContainer,children:[(0,l.Y)(i3,{heading:r,children:(0,l.Y)(ee.A,{fieldIds:["firstName","lastName","emailPrimary"]})}),(0,l.Y)(w.A,{name:"addJointOwner",type:"submit",isFull:!0,children:d})]})})})}
1,tn={backButton:e=>{let{colors:n}=e;return{display:"flex",alignItems:"center",color:n.brand.primary,cursor:"pointer",transition:"0.15s linear opacity",marginBottom:"2rem","&:hover":{opacity:"0.8"}}},icon:{width:"2rem",height:"2rem",marginRight:"-0.25rem",marginLeft:"-0.5rem"}},ti=e=>{var n,i,t;let{onGoToPreviousView:o,onSubmit:a,product:r,account:d,allowConsumerFiduciaryAuthSigners:s,isInvitingJointOwners:c}=e,[u,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(null),[g,f]=(0,v.useState)(!1),{addJointOwner:y,removeJointOwner:I,updateJointOwner:A,jointOwners:b}=(0,i6.P1)(),{hasMaxJointOwnership:C}=iX({totalExistingSecondaryAccountOwners:null!=(t=null==d||null==(n=d.persons)?void 0:n.filter(e=>(null==e?void 0:e.status)==="booked"&&"secondary"===e.relationshipType).length)?t:0,totalPendingApplicants:b.length,accountVariant:null==d||null==(i=d.fields)?void 0:i.accountVariant,product:r}),S=!C||s,x=s?"Add Authorized Signers":"Add Joint Owners",F=s?"Add New Authorized Signer":"Add New Joint Owner",Y=(0,i0.X)({isCreditUnionMember:!1,isNonresidentAlien:!1,isResidentAlien:!1,isMissingTaxId:!1,isAddingJointOwner:!0,hasUsAddress:null}),D=(0,nn.A)({entityType:"person",scopes:Y});return(0,l.FD)(k.A,{children:[(0,l.FD)(ei.A,{theme:"small",children:[(0,l.FD)("div",{css:e=>tn.backButton(e),onClick:()=>f(!0),children:[(0,l.Y)(eH.A,{name:"chevron-left",css:tn.icon}),(0,l.Y)(np.A.Base,{children:"Back"})]}),(0,l.Y)(np.A.H2,{children:x})]}),(0,l.FD)(ei.A,{children:[b.map(e=>(0,l.Y)(i2,{jointOwner:e,onEditClick:()=>{h(e),p(!0)},onRemoveClick:()=>I(e.__refId)},e.__refId)),S&&(0,l.Y)(w.A,{onClick:()=>p(!0),isFull:!0,theme:"outline",children:F}),!!b.length&&(0,l.Y)("div",{css:{marginTop:"16px"},children:(0,l.Y)(w.A,{onClick:()=>{a(b)},isLoading:c,isFull:!0,children:"Save and Send Invitation"})})]}),(0,l.Y)(T.A,{...D,children:(0,l.Y)(te,{modalIsOpen:u,onSubmit:e=>{m?(A(e.__refId,{...e}),h(null)):y(e),p(!1)},onModalClose:()=>p(!1),allowConsumerFiduciaryAuthSigners:s,jointOwnerToEdit:m})}),(0,l.Y)(i9.A,{isOpen:g,buttonText:"Yes, Discard Progress",onConfirm:()=>void(f(!1),o()),heading:"Are you sure?",subheading:"Going back will discard your current progress on adding ".concat(s?"authorized signers":"joint owners"),onClose:()=>f(!1)})]})};var tt=i(38297);function tl(){let e=(0,ng._)(["\n  query GetAccount($applicationId: ID!, $accountId: ID) {\n    account(applicationId: $applicationId, accountId: $accountId) {\n      ...AccountFragment\n    }\n  }\n  ","\n"]);return tl=function(){return e},e}function to(){let e=(0,ng._)(["\n  mutation InviteExistingPersonAsAuthorizedSigner(\n    $personId: ID!\n    $accountId: ID!\n  ) {\n    inviteExistingPersonAsAuthorizedSigner(\n      personId: $personId\n      accountId: $accountId\n    ) {\n      id\n    }\n  }\n"]);return to=function(){return e},e}function ta(){let e=(0,ng._)(["\n  mutation InviteNewAuthorizedSigner(\n    $emailPrimary: String!\n    $firstName: String!\n    $accountId: ID!\n  ) {\n    inviteNewAuthorizedSigner(\n      emailPrimary: $emailPrimary\n      firstName: $firstName\n      accountId: $accountId\n    ) {\n      ...AccountFragment\n    }\n  }\n  ","\n"]);return ta=function(){return e},e}function tr(){let e=(0,ng._)(["\n  mutation SendReminderCompletionRequest($applicationId: ID!) {\n    sendReminderCompletionRequest(applicationId: $applicationId) {\n      id\n    }\n  }\n"]);return tr=function(){return e},e}function td(){let e=(0,ng._)(["\n  mutation RemovePersonFromAccount($relationshipPersonAccountId: ID!) {\n    removePersonFromAccount(\n      relationshipPersonAccountId: $relationshipPersonAccountId\n    ) {\n      id\n    }\n  }\n"]);return td=function(){return e},e}function ts(){let e=(0,ng._)(["\n  mutation InviteSecondaryOwner(\n    $emailPrimary: String!\n    $firstName: String!\n    $accountId: ID!\n  ) {\n    inviteSecondaryOwner(\n      emailPrimary: $emailPrimary\n      firstName: $firstName\n      accountId: $accountId\n    ) {\n      ...AccountFragment\n    }\n  }\n  ","\n"]);return ts=function(){return e},e}function tc(){let e=(0,ng._)(["\n  mutation InviteJointOwners(\n    $applicants: [JointOwnerApplicantFields!]!\n    $accountId: ID!\n  ) {\n    inviteJointOwners(applicants: $applicants, accountId: $accountId) {\n      ...AccountFragment\n    }\n  }\n  ","\n"]);return tc=function(){return e},e}function tu(){let e=(0,ng._)(["\n  mutation CreateUpdateAccountApplication(\n    $emailPrimary: String!\n    $firstName: String!\n    $accountId: ID!\n    $accountVariant: String!\n    $productId: ID!\n  ) {\n    createUpdateAccountApplication(\n      emailPrimary: $emailPrimary\n      firstName: $firstName\n      accountId: $accountId\n      accountVariant: $accountVariant\n      productId: $productId\n    ) {\n      ...AccountFragment\n    }\n  }\n  ","\n"]);return tu=function(){return e},e}let tp=(0,iE.J1)(tl(),tt.Dj),tm=(0,iE.J1)(to()),th=(0,iE.J1)(ta(),tt.Dj),tv=(0,iE.J1)(tr()),tg=(0,iE.J1)(td()),tf=(0,iE.J1)(ts(),tt.Dj),ty=(0,iE.J1)(tc(),tt.Dj),tI=(0,iE.J1)(tu(
1),tt.Dj),tA=e=>{let{applicationId:n,accountId:i,queryOptions:t}=e,{data:l,loading:o,error:a,refetch:r}=(0,ik.I)(tp,{variables:{applicationId:n||"",accountId:i},skip:!n,...t||{}}),d={refetchQueries:[{query:tp,variables:{applicationId:n}}],awaitRefetchQueries:!0},{account:s}=l||{},[c,{loading:u}]=(0,ey.n)(tm,d),[p,{loading:m}]=(0,ey.n)(th,d),[h,{loading:v}]=(0,ey.n)(tv,d),[g,{loading:f}]=(0,ey.n)(eA.Cy,d),[y,{loading:I}]=(0,ey.n)(tg,d),[A,{loading:b}]=(0,ey.n)(tf,d),[C,{loading:S}]=(0,ey.n)(ty,d),[w,{loading:x}]=(0,ey.n)(tI,d);return{account:s,accountError:a,refetchAccount:r,inviteNewAuthorizedSigner:p,inviteExistingPersonAsAuthorizedSigner:c,sendReminderCompletionRequest:h,cancelApplication:g,removePersonFromAccount:y,loading:o,isInvitingExisting:u,isInvitingNew:m,isReminding:v,isCanceling:f,isRemoving:I,inviteSecondaryOwner:A,isInvitingSecondaryOwner:b,inviteJointOwners:C,isInvitingJointOwners:S,createUpdateAccountApplication:w,isCreatingUpdateAccountApplication:x}},tb={cardContainer:{marginBottom:"2rem"},infoRow:{display:"flex",alignItems:"center",marginBottom:8,"&:last-child":{marginBottom:0}},title:e=>{let{colors:n,fontScales:i}=e;return{...i.small,display:"flex",justifyContent:"center",color:n.grey7,marginBottom:8}},infoCopy:e=>{let{colors:n}=e;return{color:n.grey7,fontWeight:"bold",marginLeft:"0.5rem"}}},tC=e=>(0,l.FD)("div",{css:tb.infoRow,children:[(0,l.Y)(eH.A,{name:"circled-us-dollar"}),(0,l.Y)(np.A.Base,{css:tb.infoCopy,children:e})]}),tS=e=>{let{isMissingAccountingData:n,isMissingBankingData:i,submitText:t="Let's get going",headerText:o="Financial Data",subheaderText:a="\n    We need to collect some additional information on the business. You will be asked to sign in to the business' financial accounts.\n\n    This will enable the quickest decisioning possible and reduce the need to collect additional documentation.\n  ",isLoading:r,onClick:d}=e;return(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{heading:o,subheading:a}),(0,l.FD)(ei.A,{theme:"small",children:[(0,l.Y)("div",{css:tb.cardContainer,children:(0,l.FD)(eU.A,{children:[(0,l.Y)("div",{css:tb.title,children:"Additional verification needed"}),n&&tC("Verify Business Financials"),i&&tC("Verify Operational Bank Account")]})}),(0,l.Y)(w.A,{type:"button",isFull:!0,isLoading:r,onClick:d,children:t})]})]})};var tw=i(39102);function tx(){let e=(0,ng._)(["\n  mutation getOrCreateCodatCompany($applicationId: ID!) {\n    getOrCreateCodatCompany(applicationId: $applicationId) {\n      ...ApplicationFragment\n    }\n  }\n  ","\n"]);return tx=function(){return e},e}let tF=(0,iE.J1)(tx(),tt.Ay),tY=e=>{let[n,i]=(0,v.useState)(null);return(0,v.useEffect)(()=>{import("https://link-sdk.codat.io").then(i=>{let{CodatLink:t}=i;n&&new t({target:n,props:e})})},[n]),(0,l.Y)("div",{style:{height:640},ref:i})};var tT=i(93039),tD=i(77248),tE=i(28658),tk=i(69068),tP=i(14518),tO=i(71738),tR=i(91909);let tL={numberedSectionHeading:{marginBottom:8},actionGroup:{marginBottom:32},actionNote:{padding:8,textAlign:"left"}},tN=e=>{var n,i;let{type:t,name:l,config:o,entityType:a,organization:r}=e,d=nr.yu[t];if(d)return d;let s=(null==o?void 0:o.eddQuestionnaires)||{},c="organization"===a?(0,G.KG)((null==r?void 0:r.type)||""):a,u=(0,tk.A)({entityType:c,scopes:[],config:o});if("eddRequirement"===t){let e=(0,A.FD)({entityType:c,name:l,configEddQuestionnaire:s});return{title:(null==e?void 0:e.selfServeTitle)||(0,tR.n)(l),icon:null===nr.A8||void 0===nr.A8||null==(n=nr.A8[l])?void 0:n.icon}}if("missingDocument"===t){let e=null==u?void 0:u[l];return{title:(null==e?void 0:e.displayLabel)||(0,tR.n)(l),icon:(null===nr.Uu||void 0===nr.Uu||null==(i=nr.Uu[l])?void 0:i.icon)||"upload"}}if("automatedIdentityVerification"===t)return{title:(0,tO.rM)().person.proofOfIdentity.selfServeLabel,icon:"upload"}},tB=e=>{let{actionGroups:n=[],onSubmit:i}=e,t=n.flatMap(e=>e.actions).every(e=>"complete"===e.status),o=(0,D.t)();return(0,l.FD)("div",{children:[!!n.length&&n.map((e,n)=>{let{title:i,actions:t}=e;return(0,l.FD)("div",{css:tL.actionGroup,children:[i&&(0,l.Y)("div",{css:tL.numberedSectionHeading,children:(0,l.Y)(np.A.H2,{theme:"large",children:i})}),(0,l.Y)("div",{"data-setstaticid":!0,"data-uid":"requiredActions",children:t.map((e,n)=>{var t,a,r;let d="rejectedInitialDeposit"===e.type,s="person"===e.entityType?(e=>{var n;let{action:i,config:t}=e,{person:l}=i,o=tN({...i,entityType:"person",config:t});return{title:null!=(n=null==o?void 0:o.title)?n:(0,J.L)(null!=l?l:{}),icon:null==o?void 0:o.icon}})({action:e,config:o}):tN({...e,config:o}),c="rejectionNote"in e?e.rejectionNote:void 0,u="applicantNote"in e?e.applicantNote:void 0,p=!!(c&&"complete"!==e.status),m=!!(u&&"complete"!==e.status),h=null!=(r=e.subtitle)?r:"person"===e.entityType?(0,J.L)(null!=(a=e.person)?a:{}):"organization"===e.entityType?null==(t=e.organization)?void 0:t.legalName:void 0;return(0,l.FD)(V.A,{"aria-label":"".concat(e.type," for ").concat(i),...e,icon:"user",...s,title:null==s?void 0:s.title,de
1scription:h,tag:((e,n,i)=>{switch(e){case"complete":return{text:"Complete",theme:"success",isAnimated:n};case"loading":return{text:"Loading",theme:"neutral",isAnimated:n};default:return i?{text:"Required",theme:"danger",isAnimated:n}:{text:"Incomplete",theme:"neutral",isAnimated:n}}})(e.status,e.isAnimated,d),children:[p&&(0,l.Y)("div",{css:tL.actionNote,children:(0,l.Y)(Z.A,{icon:"info-circle",content:c,theme:"warning"})}),m&&(0,l.Y)("div",{css:tL.actionNote,children:(0,l.Y)(Z.A,{icon:"info-circle",content:u})})]},n)})})]},n)}),(0,l.Y)(w.A,{isFull:!0,isDisabled:!t,onClick:i,children:"Submit Verification"})]})},tM=e=>{let{personActions:n=[],applicationActions:i=[],fundingActions:t=[],products:o,application:a,onSubmit:r}=e,{preOfferStatus:d}=a,s=null==o?void 0:o[0],{experiences:{selfServe:{pages:{actionRequired:{headerText:c,subheaderText:u,formInfoText:p,formInfoTooltip:m}={}}}}}=(0,D.t)(),h=t.length?{title:"",actions:t}:null,v=[...h?[h]:[],{title:"",actions:[...n,...i]}],g=null==o?void 0:o.find(e=>(null==e?void 0:e.type)==="loan"),f=g?g.name:null==o?void 0:o.map(e=>null==e?void 0:e.name).join(", ");return(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{heading:"incomplete"===d||"manualReviewRequired"===d?c||"Finalize Your Application":c||"Additional Verification",subheading:"incomplete"===d||"manualReviewRequired"===d?u||"Please provide the remaining tasks so we can get you an exclusive offer!":u||(0,l.FD)(l.FK,{children:["Based on your answers we need to collect some additional information in order to finalize your application",f&&(0,l.FD)(l.FK,{children:[" ","for a ",(0,l.Y)(tP.yN,{children:f})," account"]}),"."]}),productId:null==s?void 0:s.id}),(0,l.Y)(tB,{actionGroups:v,onSubmit:r}),!!p&&(0,l.Y)(Z.A,{icon:"info-circle",content:p,tooltipIcon:m?"info-circle":null,tooltipContent:m})]})},tz=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null==e?void 0:e[0].organization,t=n?"Financial":(0,tR.n)((0,G.KG)((null==i?void 0:i.type)||""));return"".concat((null==i?void 0:i.legalName)?"".concat(i.legalName," "):"").concat(t," Verification")},tV=e=>{let{applicationActions:n=[],organizationActions:i=[],personActions:t=[],fundingActions:o=[],products:a,onSubmit:r,headerText:d="",subheaderText:s="",offerStatus:c}=e,[u,...p]=Object.entries(ns()(i,"organization.id")||{}).map(e=>{let[,n]=e;return{title:tz(n),actions:n}})||[],m=[...n,...(null==u?void 0:u.actions)||[]],h=m.length&&{title:tz(null==u?void 0:u.actions,"incomplete"===c),actions:m},v=Object.entries(ns()(t,"person.id")).map(e=>{let[,n]=e;return{title:(0,J.L)(n[0].person),actions:n}}),g=o.some(e=>"rejectedInitialDeposit"===e.type),f=[o.length?{title:g?"Funding Failure":"Funding",actions:o}:null,...v,h,...p].filter(Boolean),y=null==a?void 0:a.map(e=>e.name).join(", ");return(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{heading:d||"Additional verification",subheading:s||(0,l.FD)(l.FK,{children:["Based on your answers we need to collect some additional information in order to finalize your application",y&&(0,l.FD)(l.FK,{children:[" ","for ",(0,l.Y)(tP.yN,{children:y})]}),"."]})}),(0,l.Y)(tB,{actionGroups:f,onSubmit:r})]})};var t_=i(98616),tU=i(26919),tq=i(22877),tH=i(21615);function tK(){let e=(0,ng._)(["\n  query GetDocuments($applicationId: ID!) {\n    documents(applicationId: $applicationId) {\n      id\n      type\n      originalFilename\n      name\n      personId\n      organizationId\n      applicationId\n      meta\n    }\n  }\n"]);return tK=function(){return e},e}function tj(){let e=(0,ng._)(["\n  mutation UploadDocument(\n    $file: Upload!\n    $documentType: String!\n    $name: String!\n    $entityType: EntityType!\n    $applicationId: ID!\n    $organizationId: ID\n    $personId: ID\n    $documentRequestId: ID\n  ) {\n    uploadDocument(\n      file: $file\n      documentType: $documentType\n      name: $name\n      entityType: $entityType\n      applicationId: $applicationId\n      organizationId: $organizationId\n      personId: $personId\n      documentRequestId: $documentRequestId\n    ) {\n      id\n      type\n      personId\n      organizationId\n      applicationId\n    }\n  }\n"]);return tj=function(){return e},e}function tW(){let e=(0,ng._)(["\n  mutation DeleteDocument($id: ID!) {\n    deleteDocument(id: $id) {\n      id\n    }\n  }\n"]);return tW=function(){return e},e}let tG=(0,iE.J1)(tK()),t$=(0,iE.J1)(tj()),tQ=(0,iE.J1)(tW()),tJ=()=>{let{applicationId:e,application:n}=(0,u.YY)(),{data:{documents:i=[]}={},loading:t}=(0,ik.I)(tG,{variables:{applicationId:e},skip:!e}),[l,{loading:o}]=(0,ey.n)(t$,{refetchQueries:["GetDocuments"],awaitRefetchQueries:!0}),[a,{loading:r}]=(0,ey.n)(tQ,{refetchQueries:["GetDocuments"],awaitRefetchQueries:!0}),{config:d}=(0,s.UK)(),{documentTypes:c,fields:p}=d,m=e=>c["organization"===e?"business":e],h=(e,i)=>{var t,l,o,a,r,s,c,u,p,m,h,v,g,f,y,I,A;if(!n)return null;let b="organization"===e&&(null==i?void 0:i.__typename)==="Organization"?(0,G.KG)(null!=(t=null==i?void 0:i.type)?t:""):e,C=[],S=(0,ne.SP)(n.rawFields),w=(0,eS.qk)(n.rawFields);if("person"===e&&(null==i?void 0:i.__typename)==="Person"){let e=null!=(p=null==(a=n.fields)||null==(o=a.skippedFields)||null==(l=o.find(e=>(null==e?void 0:e.personId)===(null==i?void 0:i.id)))?void 0:l.fields)?p:[];C=(0,tT.H)({applicationType:null!=(m=null==n?void 0:n.type)?m:"createAccount",originatingExperience:null!=(h=null==n?void 0:n.originatingExperience)?h:"selfServe",isNonresidentAlien:"nonresidentAlienForScope"===i.usResidencyStatus,isResidentAlien:"residentAlien"===i.usResidencyStatus,isMissingTaxId:!1===i.hasTaxId,hasUsAddress:i.hasUsAddress,isControlProngAuthorizedSigner:(null==n||null==(r=n.fields)?void 0:r.isControlProngAuthorizedSigner)||null,isCreditUnionMember:!!(null==i?void 0:i.externalCoreMembershipId),isMinor:(null==i?void 0:i.isMinor)||void 0,accountInfo:S,role:null==(s=(0,eS.VU)((0,eS.rC)(n.rawFields),null==i?void 0:i.id))?void 0:s.role,kycEvaluationTags:null!=(v=null==n||null==(c=n.personKycSnapshot)?void 0:c.filter(e=>null!==e&&e.personId===(null==i?void 0:i.id)).flatMap(e=>{var n;return null!=(n=null==e?void 0:e.tags)?n:[]}))?v:[],underwritingTags:null!=(g=null==n||null==(u=n.consumerUnderwritingSnapshot)?void 0:u.filter(e=>null!==e&&e.personId===(null==i?void 0:i.id)).flatMap(e=>{var n;return null!=(n=null==e?void 0:e.tags)?n:[]}))?g:[],contextOrganizations:[{data:null,personRelationship:{isControlProng:!!(null==i?void 0:i.isControlProng),isOwnershipProng:!!(null==i?void 0:i.isOwnershipProng),isSoleProprietor:!!(null==i?void 0:i.isSoleProprietor)}}],skippedPersonFields:e,isAddingJointOwner:!1,purposeOfLoan:null!=(f=null==w?void 0:w.purposeOfLoan)?f:null},d)}return"organization"===e&&(null==i?void 0:i.__typename)==="Organization"&&(C=(0,tD.e)({applicationType:null==n?void 0:n.type,originatingExperience:null!=(I=null==n?void 0:n.originatingExperience)?I:"selfServe",accountInfo:S,isBusinessAccountVariant:!0,kycEvaluationTags:null!=(A=null==n||null==(y=n.organizationKycSnapshot)?void 0:y.filter(e=>null!==e&&e.organizationId===(null==i?void 0:i.id)).flatMap(e=>{var n;return null!=(n=null==e?void 0:e.tags)?n:[]}))?A:[],taxIdType:(null==i?void 0:i.taxIdType)||void 0,organizationType:(null==i?void 0:i.type)||void 0,isCreditUnionMember:!!i.externalCoreMembershipId,allowlistCategory:null==i?void 0:i.allowlistCategory},d)),"application"===e&&(C=(0,tH.oT)(n,d)),{scopes:C,fieldConfigEntityType:b}},v=(e,n,i)=>{let t=h(n,i);if(!t)return[];let{scopes:l,fieldConfigEntityType:o}
1=t,a=m(o),r=(0,iW.cw)({fields:p,entityType:o,scopes:l,experience:"selfServe"})[e],d=r&&"documentTypes"in r?r.documentTypes:[];return d.length?Object.values((0,tq.pick)(a,d)):[{type:"other",name:"Other"}]},g=(e,n,t)=>{let l=v(e,n,t),o=null==i?void 0:i.filter(e=>"application"===n||"organization"===n&&t&&"id"in t&&(null==t?void 0:t.id)===(null==e?void 0:e.organizationId)||"person"===n&&t&&"id"in t&&(null==t?void 0:t.id)===(null==e?void 0:e.personId));return null==o?void 0:o.some(e=>l.some(n=>n.type===(null==e?void 0:e.type)))};return{documents:i,isLoading:t,uploadDocument:l,isUploading:o,deleteDocument:a,isDeleting:r,getEntityDocumentTypes:m,hasDocumentsWhichSatisfyVerificationRequirement:g,getVerificationRequirementCompletionStatus:(e,n,i)=>g(e,n,i)?"complete":"incomplete",getDocumentTypesForVerificationRequirement:v,doesDocumentTypeSatisfyVerificationRequirement:e=>{let{documentType:n,verificationRequirement:i,entityType:t,entityData:l}=e;return v(i,t,l).includes(n)},isFieldDisabledForSelfServe:(e,n,i)=>{let t=h(n,i);if(!t)return!1;let{scopes:l,fieldConfigEntityType:o}=t;return(0,tH.Zi)({fields:p,entityType:o,scopes:l,fieldName:e})}}};var tZ=i(38338);let{publicRuntimeConfig:{MANTL_ENV:tX}}=i.n(tZ)()(),t0={application:r.rK,person:r.g,organization:r.sZ};var t9=i(94888);let t1=e=>{var n,i;let{selectedProduct:t,counterOfferOrCrossSellProduct:l,accountVariant:a,variantType:r}=e,d=t&&a&&(null==(n=t.accountVariants)?void 0:n[a])&&(0,o.Gm)(a,t)[r];return d&&(!d||(null==l||null==(i=l.accountVariants)?void 0:i[d]))?d:l?(0,o.uY)(l):void 0};var t2=i(87696);let t6=e=>{let{view:{code:n},handoffRecipient:i}=e,{getOrCreateProductApplication:t,setAndGoToApplication:o}=(0,t2.A)(),{application:a,products:r,setApplicationCounterOffer:d,userId:c}=(0,u.YY)(),{counterOfferAccountVariantProduct:p,counterOfferAccountVariant:h}=(()=>{var e,n,i,t;let{application:l}=(0,u.YY)(),{config:o}=(0,s.UK)(),{productIsEnabled:a,validateProductEligibility:r,validateProductEligibilityResult:d}=(0,t2.A)(),c=(e=>null==e?void 0:e.find(e=>{var n;return(null==e?void 0:e.productId)&&(null==(n=o.products[e.productId])?void 0:n.counterOfferProductId)}))((null==l||null==(e=l.fields)?void 0:e.accounts)||[null==l?void 0:l.rawFields]);if(!(null==c?void 0:c.productId))return{counterOfferAccountVariantProduct:void 0,counterOfferAccountVariant:void 0};let p=o.products[c.productId],m=o.products[p.counterOfferProductId],h=t1({selectedProduct:p,counterOfferOrCrossSellProduct:m,accountVariant:null==c?void 0:c.accountVariant,variantType:"counterOfferAccountVariant"}),g=m?(0,z.Jhp)({product:m,accountVariant:h}):void 0,f=(null==l||null==(n=l.fields)?void 0:n.counterOfferStatus)==="pending"&&(null==d||null==(t=d.data)||null==(i=t.validateProductEligibility)?void 0:i.status)==="GOOD";return(0,v.useEffect)(()=>{if(m&&a(m)){var e;r({variables:{productId:m.id,customerType:m.customerType,organizationId:null==l||null==(e=l.organization)?void 0:e.id}})}},[m]),{counterOfferAccountVariantProduct:f&&h?g:void 0,counterOfferAccountVariant:f?h:void 0}})(),g=(0,m.useRouter)();"manualReviewRequired"===n&&a&&(0,tU.z)({application:a,event:"application.view.manualReview",userId:c});let f=async()=>{if(p){var e;let n=await t({product:p,organizationId:null==a||null==(e=a.organization)?void 0:e.id,accountVariant:h});a&&await d({variables:{counterOfferProductId:null==p?void 0:p.id,childApplicationId:null==n?void 0:n.id,applicationId:a.id}}),n&&o({id:null==n?void 0:n.id})}},y=async()=>{await g.push("/products")};return a?(0,l.Y)(t9.Ay,{products:r,counterOfferProduct:p,onCounterOfferProductClick:f,onGoToProducts:y,viewCode:n,application:a,handoffRecipient:i}):(0,l.Y)(W.A,{})};var t5=i(78824),t4=i.n(t5),t3=i(31067);let t8=e=>new ew.A(e).div(100).toString(),t7=e=>((null==e?void 0:e.__typename)==="InstantAccountVerificationFundingSource"||(null==e?void 0:e.__typename)==="ManualAccountFundingSource")&&"personal"!==e.holderCategory&&"business"!==e.holderCategory,le=[{value:"personal",label:"Personal"},{value:"business",label:"Business"}],ln=e=>{let{productAllowsSkipFunding:n,userIsNonSignerApplicant:i,isCreditUnion:t,canSkipSelectedShareFunding:l}=e,o=n||i;return!t||i?o:!!l&&o},li={container:{display:"flex",flexDirection:"column",gap:16,padding:16}},lt={business:"business",consumer:"personal"},ll=e=>{let{isOpen:n,fundingSource:i,productCustomerType:t,isLoading:o,onClose:a,onConfirm:r}=e,{products:d}=(0,D.t)(),[s,c]=(0,v.useState)(()=>((e,n)=>{let i=le.find(n=>n.value===e);return i?i.value:n?lt[n]:"personal"})(i.holderCategory,t)),u=le.map(e=>({...e,id:e.value,isChecked:e.value===s}));return(0,l.Y)(nh.A,{isOpen:n,onClose:a,onClickAway:a,"data-testid":"account-holder-category-modal",children:(0,l.FD)("div",{css:li.container,children:[(0,l.Y)(x.A,{heading:"Confirm Account Type",subheading:"To fund using the account below, confirm whether it is a personal or business account.",theme:"medium"}),(0,l.Y)(t3.Ay,{fundingSource:i,theme:"grey",configProducts:d,hideArrow:!0}),(0,l.Y)(iL.A,{name:"holderCategory",type:"radio",options:u,onChange:e=>{let n=le.find(n=>n.value===e);n&&c(n.value)}}),(0,l.Y)(w.A,{isFull:!0,onClick:()=>{r(s)},isLoading:o,children:"Continue"})]})})},lo=e=>{var n;let{routingNumber:i,clientConfig:t}=e;return(null==(n=t.funding.disallowedAchInternalRoutingNumbers)?void 0:n.includes(i))||!1},la=()=>{let{formState:{isSubmitting:e}}=(0,S.xW)(),n=(0,D.t)(),{clientName:i}
1=n.clientDetails,t=n.mantlFeatures.accountOpening.funding.collectAccountHolderCategory;return(0,l.FD)(l.FK,{children:[(0,l.FD)(ei.A,{theme:"small",children:[(0,l.FD)(i3,{heading:"Verify Your Identity",children:[(0,l.Y)(nv.A.Input,{name:"idNumber",label:"Driver’s License / State ID Number",validate:{required:!0}}),(0,l.Y)(nv.A.Dropdown,{name:"idState",label:"Issuing State of ID",ariaLabel:"Issuing State of ID",options:nr.Ky,validate:{required:!0}})]}),(0,l.FD)(i3,{heading:"Enter Your Account Details",children:[t&&(0,l.Y)(nv.A.RadioGroup,{name:"holderCategory",options:le.map(e=>({...e,id:e.value}))}),(0,l.Y)(nv.A.Dropdown,{name:"accountType",label:"Account Type",ariaLabel:"Account Type",options:[{label:"Checking",value:"checking"},{label:"Savings",value:"savings"}],validate:{required:!0}}),(0,l.Y)(nv.A.Input,{name:"routingNumber",label:"Routing Number",infoTooltip:"A routing number is a nine-digit number used to identify a financial institution, and identifies the location where your account was opened. You can find your routing number on the bottom left corner of your checks.",mask:"routingNumber",validate:{required:!0,routingNumber:!0,validationFn:e=>(e=>{var n;let{routingNumber:i,clientConfig:t}=e;return(null==(n=t.funding.disallowedAchExternalRoutingNumbers)?void 0:n.includes(i))||!1})({routingNumber:e,clientConfig:n})?"Pulling funds from accounts at the institution provided is not supported, please use an account from another institution.":lo({routingNumber:e,clientConfig:n})?"To transfer funds from an account at ".concat(i,", please select one of your existing accounts."):void 0},inputMode:"numeric"}),(0,l.Y)(nv.A.Input,{name:"accountNumber",label:"Account Number",infoTooltip:"An account number identifies your individual account, and is usually between 8 and 12 digits. You can find your account number on the bottom of your checks, next to your routing number.",validate:{required:!0,maxLength:17},mask:"accountNumber",inputMode:"numeric"})]})]}),(0,l.Y)(ei.A,{theme:"small",children:(0,l.Y)(w.A,{type:"submit",isFull:!0,isLoading:e,children:"Continue"})})]})},lr=e=>{var n;let{person:i,productCustomerType:t,onSubmit:o}=e,a=(0,D.t)(),r=(null==i||null==(n=i.rawFields)?void 0:n.driversLicenseNumber)?{idNumber:i.rawFields.driversLicenseNumber,idState:i.rawFields.driversLicenseState}:(null==i?void 0:i.rawFields.stateIdNumber)?{idNumber:i.rawFields.stateIdNumber,idState:i.rawFields.stateIdState}:{},d=a.mantlFeatures.accountOpening.funding.collectAccountHolderCategory?{...r,holderCategory:"business"===t?"business":"personal"}:r;return(0,l.FD)("div",{children:[(0,l.Y)(x.A,{heading:"Add Your Account",subheading:"Verify your information and enter your account & routing number below"}),(0,l.Y)(y.A,{initialValues:d,onSubmit:o,children:(0,l.Y)(la,{})})]})};var ld=i(27208),ls=i(54334);let lc=()=>{let{formState:{isSubmitting:e}}=(0,S.xW)(),n=(0,D.t)();return(0,l.FD)(l.FK,{children:[(0,l.Y)(nv.A.Input,{name:"nameOnCard",label:"Name on Card",autoComplete:"cc-name",validate:{required:!0}}),(0,l.Y)(nv.A.CardInput,{name:"cardNumber",label:"Card Number",validate:{required:!0}}),(0,l.FD)(ls.A,{children:[(0,l.Y)(ld.A,{children:(0,l.Y)(nv.A.Input,{name:"expirationDate",label:"Exp Date",autoComplete:"cc-exp",mask:"debitCardExpiration",validate:{required:!0,futureDate:{allowCurrentDate:!0,format:"MMyy",resolution:"month"}},isHalfField:!0})}),(0,l.Y)(ld.A,{children:(0,l.Y)(nv.A.Input,{name:"cvvCode",label:"Security Code (CVV)",autoComplete:"cc-exp",mask:"cvv",validate:{required:!0,cvv:!0,maxLength:4},infoTooltip:"The CVV is a 3-digit number on the back of debit cards with the VISA\xae, Mastercard\xae or Discover\xae logo to the right of the signature panel. It is a 4-digit number on the front of American Express\xae debit cards above the 15-digit card number.",isHalfField:!0})})]}),n.mantlFeatures.accountOpening.funding.collectZipCodeForDebitCards&&(0,l.Y)(nv.A.Input,{name:"zipCode",label:"ZIP Code",autoComplete:"postal-code",mask:"zipCode",validate:{required:!0,zipCode:!0},infoTooltip:"Enter the ZIP code associated with your billing address"}),(0,l.Y)(ei.A,{theme:"small",children:(0,l.Y)(w.A,{type:"submit",isFull:!0,isLoading:e,children:"Continue"})})]})},lu=e=>{let{person:n,onSubmit:i}=e;return(0,l.FD)("div",{children:[(0,l.Y)(x.A,{heading:"Add a Card",theme:"xsmall"}),(0,l.Y)(y.A,{initialValues:{idNumber:null==n?void 0:n.driversLicenseNumber,idState:null==n?void 0:n.driversLicenseState},onSubmit:i,children:(0,l.Y)(lc,{})})]})},lp=e=>{var n,i,t;let{iavFundingIsLoading:o=!1,iavFundingError:a=!1,product:r,displayRolloverOrTransferOption:d,onEditFundingSourceClick:s,theme:c="default",size:u="default",sectionTitle:p,isAutopaySetup:m}=e,{experiences:{selfServe:{pages:{fundAccount:h,autopay:v}}}}=(0,D.t)(),g=(0,id.Zv)({autopayFundingMethods:null!=(i=null==r||null==(n=r.autopay)?void 0:n.autopayFundingMethods)?i:{},fundingMethodsForProduct:null!=(t=null==r?void 0:r.fundingMethods)?t:{},fundAccountPageConfiguration:m?v:h,hideRecommendedTag:d}),f=(m?["instantAccountVerification","manualBankAccount"]:["instantAccountVerification","manualBankAccount","card"]).map(e=>{let n=g[e],i="instantAccountVerification"===e&&o,t="instantAccountVerification"===e&&a;return n&&(!m||null==r||!r.autopay||!r.autopay.autopayFundingMethods||(e=>{var n,i;return(null==r||null==(i=r.autopay)||null==(n=i.autopayFundingMethods)?void 0:n[e])!==void 0}
1)(e))&&(0,l.Y)(V.A,{title:n.title,description:n.description,icon:n.icon,theme:c,isLoading:i,isDisabled:t,size:u,titleTag:n.titleTag,onClick:()=>s(n)},e)}).filter(Boolean),y=(null==f?void 0:f.length)>0;return(0,l.FD)("div",{children:[y&&p&&(0,l.Y)(x.A,{theme:"xsmall",heading:p}),y?f:null]})},lm={container:()=>({display:"flex",flexDirection:"column",padding:"16px 16px 0"}),row:{marginLeft:"4px",marginRight:"4px"},fundingSourceList:{marginTop:10,marginLeft:10},button:{padding:"16px",flex:"1 1 100%",button:{paddingTop:16,paddingBottom:16,marginTop:6}}},lh=e=>{let{person:n,product:i,iavFundingAccounts:t,isOpen:o,iavFundingIsLoading:a,isCreatingIavFundingExternalAccounts:r,displayRolloverOrTransferOption:d,iavFundingError:s,editingFundingSource:c,onClose:u,onExternalCardSubmit:p,onExternalAccountSubmit:m,onEditFundingSourceClick:h,onCurrentFundingSourceClick:g,onSelectFundingSource:y,onSelectRolloverOrTransfer:I,configProducts:A,...b}=e,{dismissMessage:C}=(0,f.d)(),[S]=(0,v.useState)(null),F=e=>async n=>{try{await e(n)}finally{u()}};return(0,l.FD)(nh.A,{isOpen:o,onClose:()=>{S&&C(S),u()},onClickAway:u,...b,children:[(0,l.FD)("div",{css:lm.container,children:[(null==c?void 0:c.id)==="instantAccountVerification"&&(0,l.FD)("div",{css:lm.fundingSourceList,children:[(0,l.Y)(x.A,{icon:"illustration-wallet",heading:"Select an Account",theme:"small",isCentered:!0}),r&&(0,l.Y)("div",{children:(0,l.Y)(ny.A,{size:"small"})}),!r&&Array.isArray(t)&&t.map(e=>(0,l.Y)(t3.Ay,{fundingSource:e,onClick:()=>{y(e),u()},configProducts:A},e.id))]}),(null==c?void 0:c.id)==="card"&&(0,l.Y)(lu,{onSubmit:F(p)}),(null==c?void 0:c.id)==="manualBankAccount"&&(0,l.Y)(lr,{person:n,productCustomerType:null==i?void 0:i.customerType,onSubmit:F(m)}),(0,l.Y)("div",{css:lm.fundingSourceList,children:(0,l.Y)(x.A,{icon:"illustration-wallet",heading:"Add a New Funding Source",theme:"small"})}),(0,l.FD)("div",{css:lm.row,children:[d&&(0,l.Y)(V.A,{title:"Rollover or Transfer",description:"Move funds from an existing retirement account into your new one",icon:"transfer",theme:"default",size:"large",titleTag:{theme:"primary",text:"recommended"},onClick:I},"rolloverOrTransfer"),(0,l.Y)(lp,{iavFundingIsLoading:a,iavFundingError:s,product:i,displayRolloverOrTransferOption:d,onEditFundingSourceClick:h,size:"large",sectionTitle:d?"Fund instantly":null})]})]}),(0,l.Y)("div",{css:lm.button,children:(0,l.Y)(w.A,{theme:"outline",isFull:!0,name:"confirm",onClick:()=>{u(),g()},children:"Use Existing Funding Method"})})]})},lv={logo:{width:24}},lg=e=>{let{internalAccounts:n,product:i,configProducts:t,isAutopaySetup:o,theme:a,size:r,onSelectFundingSource:d}=e;return Array.isArray(n)&&0!==n.length?n.map((e,n)=>{let s={id:"internalTransfer",title:(e=>{let n=(0,id.pS)({internalAccount:e,configProducts:t}),i=e.maskedAccountNumber||e.lastFour;return(0,l.Y)(l.FK,{children:(0,l.FD)("div",{css:{display:"flex",width:"100%"},children:[(0,l.Y)(tP.yN,{css:{overflow:"hidden","text-overflow":"ellipsis",flex:4},children:n}),(0,l.Y)("span",{css:{flex:1,marginLeft:10,textWrap:"nowrap"},children:"••••".concat(i)})]})})})(e),description:(e=>"Available: ".concat(e.availableBalance?(0,eN.CQ)((0,eN.LL)(e.availableBalance)):"Unknown Amount"))(e),icon:"bank-institution",source:{...e}},c=o||(0,id.nP)({internalAccount:s.source,product:i});return(0,l.Y)(V.A,{prepend:s.source.logo?(0,l.Y)("img",{css:lv.logo,alt:"".concat((0,id.pS)({internalAccount:s.source,configProducts:t})||"Internal Account Funding Source"," Logo"),src:s.source.logo}):null,title:s.title,description:s.description,theme:a,isLoading:!1,size:r,onClick:c?()=>d(s.source):void 0,tag:c?void 0:{text:"Insufficient Funds",theme:"neutral"},hideArrow:!c,isDisabled:!c},"internalTransfer-".concat(n))}):null},lf={cardGroup:{marginBottom:24}},ly=e=>{var n,i;let{displayRolloverOrTransferOption:t,handleSelectRolloverOrTransfer:o,internalAccountFundingSources:a,productAllowsInternalTransfer:r,externalFundingSources:d,iavFundingIsLoading:s,iavFundingError:c,product:u,isAutopaySetup:p,onEditFundingSourceClick:m,onSelectFundingSource:h}=e,{products:v,clientDetails:g}
1=(0,D.t)(),f=p&&!!(null==u?void 0:u.autopay)&&1===Object.keys(null!=(n=u.autopay.autopayFundingMethods)?n:{}).length&&"internalTransfer"===Object.keys(null!=(i=u.autopay.autopayFundingMethods)?i:{})[0];return(0,l.FD)(l.FK,{children:[t&&(0,l.Y)("section",{css:lf.cardGroup,children:(0,l.Y)(V.A,{title:"Rollover or Transfer",description:"Move funds from an existing retirement account into your new one",icon:"transfer",theme:"default",size:"large",titleTag:{theme:"primary",text:"recommended"},onClick:o},"rolloverOrTransfer")}),a.length&&r?(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{theme:"xsmall",heading:p?"Select your ".concat(g.clientName," account"):"Fund with your ".concat(g.clientName," account")}),(0,l.Y)("section",{css:lf.cardGroup,children:(0,l.Y)(lg,{internalAccounts:a,product:u,configProducts:v,onSelectFundingSource:h,isAutopaySetup:p})})]}):null,d.length?(0,l.Y)(x.A,{theme:"xsmall",heading:p?"Pay from another account":"Fund instantly"}):null,d.length?(0,l.Y)("section",{css:lf.cardGroup,children:d.map((e,n)=>(0,l.Y)(t3.Ay,{fundingSource:e,onClick:()=>h(e),configProducts:v,isDisallowedRoutingNumber:(0,id.gV)({fundingSource:e,hasInternalFundingSources:a.length>0})},n))}):null,!f&&(0,l.Y)(lp,{iavFundingIsLoading:s,iavFundingError:c,product:u,displayRolloverOrTransferOption:t,onEditFundingSourceClick:m,size:"large",sectionTitle:a.length||d.length||t?a.length||d.length?p?"Additional ways to select an account":"Additional ways to fund your account":"Fund instantly":null,isAutopaySetup:p})]})},lI={checkboxOrRadio:{"& + &":{marginTop:16}},container:()=>({display:"flex",flexDirection:"column",padding:16}),row:{marginLeft:"4px",marginRight:"4px"},fundingSourceList:{marginBottom:5},spinner:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",minHeight:150},button:{padding:"0px 16px 16px 16px",marginTop:"-6px",flex:"1 1 100%",button:{paddingTop:16,paddingBottom:16,marginTop:6}}},lA=e=>{let{disableExternalAccountsForAutopay:n,heading:i,subheading:t,person:o,product:a,fundingSources:r,iavFundingAccounts:d,iavFundingError:s,selectedFundingSourceId:c,editingFundingSource:u,isOpen:p,iavFundingIsLoading:m,isCreatingIavFundingExternalAccounts:h,isAutopaySetup:g,displayRolloverOrTransferOption:y,onClose:I,onConnectIavFundingAccount:A,onSelectFundingSource:b,onExternalAccountSubmit:C,onExternalCardSubmit:S,onEditFundingSourceClick:F,onSelectRolloverOrTransfer:Y,onAddNewFundingSourceClick:T,handleCurrentFundingSourceClick:E,...k}=e,{triggerMessage:P,dismissMessage:O}=(0,f.d)(),R=(0,D.t)(),{products:L}=R,[N,B]=(0,v.useState)(null),M=()=>{N&&O(N)},{clientDetails:{clientName:z}}=R,V=()=>{M(),I()},_=(0,id.B$)({fundingSources:r,product:a}).filter(Boolean),U=_.some(e=>(0,id.En)(e)),q="To transfer funds from an account at ".concat(z,", please select one of your existing accounts."),H="This financial institution is not supported for funding accounts.",K=(null==u?void 0:u.id)==="instantAccountVerification"&&!h&&!(null==d?void 0:d.length);K&&V();let j=null==d?void 0:d.map(e=>({...e,isDisallowedRoutingNumber:(0,id.gV)({fundingSource:e,hasInternalFundingSources:U}),isDisallowedInternalRoutingNumber:e.isDisallowedInternalRoutingNumber,isDisallowedExternalRoutingNumber:e.isDisallowedExternalRoutingNumber})),W=null==j?void 0:j.every(e=>e.isDisallowedInternalRoutingNumber),G=null==j?void 0:j.every(e=>e.isDisallowedRoutingNumber);return(0,v.useEffect)(()=>{(null==u?void 0:u.id)==="instantAccountVerification"&&!h&&G&&B(P(W?q:H,{theme:"error",isModal:!1}))},[u,h,G,W]),(0,l.Y)(l.FK,{children:(0,l.FD)(nh.A,{isOpen:p,onClose:V,onClickAway:e=>{let n=document.querySelector('[role="alert"]');(null==n?void 0:n.contains(e.target))||V()},...k,children:[(0,l.FD)("div",{css:lI.container,children:[(null==u?void 0:u.id)==="instantAccountVerification"&&(0,l.FD)("div",{css:lI.fundingSourceList,children:[(0,l.Y)(x.A,{icon:"illustration-wallet",heading:"Select an Account",subheading:"Select which bank account to use to fund your account",theme:"small"}),h&&(0,l.Y)("div",{css:lI.spinner,children:(0,l.Y)(ny.A,{size:"small"})}),!h&&Array.isArray(j)&&j.map(e=>{let n=c===e.id;return(0,l.Y)("div",{css:lI.checkboxOrRadio,children:(0,l.Y)(eq.A,{id:e.id,theme:"row",type:"none",name:"editingFundingSource","aria-description":"Press enter to use this funding source and return to the initial deposit setup",isChecked:n,onChange:e.isDisallowedRoutingNumber?void 0:()=>{b(e)}
1,label:(0,l.Y)(t3.Ay,{fundingSource:e,theme:"inline",configProducts:L,isDisallowedRoutingNumber:e.isDisallowedRoutingNumber,hideArrow:!0})},e.id)},e.id)})]}),(null==u?void 0:u.id)==="card"&&(0,l.Y)(lu,{onSubmit:async e=>{try{await S(e)}finally{V()}}}),(null==u?void 0:u.id)==="manualBankAccount"&&(0,l.Y)(lr,{person:o,productCustomerType:null==a?void 0:a.customerType,onSubmit:async e=>{if(U&&"routingNumber"in e&&lo({routingNumber:e.routingNumber,clientConfig:R}))P(q,{theme:"error",isModal:!1}),c?E():V();else try{await C(e)}finally{V()}}}),!u&&(0,l.FD)("div",{css:lI.fundingSourceList,children:[(0,l.Y)(x.A,{heading:i,subheading:t,theme:"small"}),(0,l.Y)("div",{css:lI.row,children:_.map(e=>{let n=(e=>(0,id.Qj)(e)?{isDisallowedExternalRoutingNumber:!!e.isDisallowedExternalRoutingNumber,isDisallowedInternalRoutingNumber:!!e.isDisallowedInternalRoutingNumber}:{isDisallowedExternalRoutingNumber:!1,isDisallowedInternalRoutingNumber:!1})(e),i=c===(null==e?void 0:e.id),t=!!(0,id.En)(e)&&!(0,id.nP)({internalAccount:e,product:a})&&!g,o=(0,id.gV)({fundingSource:e,hasInternalFundingSources:U});return(0,l.Y)("div",{css:lI.checkboxOrRadio,children:(0,l.Y)(eq.A,{id:null==e?void 0:e.id,theme:"row",type:"none",name:"editingFundingSource","aria-description":"Press enter to use this funding source and return to the initial deposit setup",isChecked:i,onChange:()=>b(e),label:(0,l.Y)(t3.Ay,{insufficientBalance:t,isDisallowedRoutingNumber:o,fundingSource:e,configProducts:L,theme:"inline",hideArrow:!0}),onClick:()=>(e=>{let{internalAccountIsUnderBalance:n,disallowedRoutingNumberData:i}=e;i.isDisallowedInternalRoutingNumber&&U&&B(P(q,{theme:"error",isModal:!1})),i.isDisallowedExternalRoutingNumber&&B(P(H,{theme:"error",isModal:!1})),n&&B(P("Insufficient Funds",{theme:"error",isModal:!1}))})({internalAccountIsUnderBalance:t,disallowedRoutingNumberData:n}),isDisabled:t||o},null==e?void 0:e.id)},null==e?void 0:e.id)})})]})]}),!h&&!K&&(!u||"instantAccountVerification"===u.id)&&(0,l.FD)("div",{css:lI.button,children:[(0,l.Y)(w.A,{isFull:!0,name:"confirm",onClick:V,children:(null==u?void 0:u.id)==="instantAccountVerification"&&G?"Close":"Save and Close"}),!n&&(0,l.Y)(w.A,{theme:"outline",isFull:!0,name:"add",onClick:()=>{M(),T()},children:"Add a New Funding Source"})]})]})})},lb={spinner:{width:"100%",textAlign:"center",marginTop:100},infoBoxContainer:{marginTop:16}},lC=e=>{var n,i,t,o;let{application:a,currentAccount:r,fundingSources:d,isLoadingFundingSources:s,selectedFundingSource:c,product:u,person:p,onSubmit:m,onSkipFunding:h,iavFundingAccounts:g,onConnectIavFundingAccount:I,onExternalAccountSubmit:A,onSelectFundingSource:b,isCreatingIavFundingExternalAccounts:C,errorCreatingIavFundingExternalAccounts:S,iavFundingIsOpen:F,iavFundingIsLoading:Y,iavFundingError:T,isAutopayRequired:E=!1,onUpdateExternalAccountHolderCategory:P}=e,O=(0,D.t)(),{products:R,experiences:{selfServe:{pages:{autopay:{headerText:L,subheaderText:N,formInfoText:B,formInfoTooltip:M}={}}}}}=O,{triggerMessage:z}=(0,f.d)(),V=null==r?void 0:r.productId,[_,U]=(0,v.useState)(!1),[q,H]=(0,v.useState)(null),K=(0,ir.h9)(),j=(0,ir.h9)(),W=(0,ir.h9)(),G=(0,ir.h9)(),[$,Q]=(0,v.useState)(!1),J=O.mantlFeatures.accountOpening.funding.collectAccountHolderCategory,X=(0,v.useRef)(null),ee=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(F){var e;null==(e=document.querySelector('iframe[title="Plaid Link"]'))||e.focus(),K.modalIsOpen&&(ee.current=!0,K.closeModal()),j.modalIsOpen&&j.closeModal()}else ee.current&&K.openModal()},[F]),(0,v.useEffect)(()=>{var e;(null==(e=a.requiredActions)?void 0:e.some(e=>"incorrectPrimaryShareFundingTransaction"===e.type))&&z("The funding transaction could not be processed. Please review and resubmit your funding request",{theme:"error"})},[]);let en=d.filter(e=>"CustomerInternalAccountFundingSource"!==e.type),et=d.filter(e=>"CustomerInternalAccountFundingSource"===e.type),el=en.filter(e=>"InstantAccountVerificationFundingSource"===e.type),eo=(null==u?void 0:u.id)?(0,eT.y)(R[null==u?void 0:u.id],null==r?void 0:r.accountVariant):void 0,ea=(null==eo||null==(n=eo.autopay)?void 0:n.autopayFundingMethods)&&1===Object.keys(eo.autopay.autopayFundingMethods).length&&!!eo.autopay.autopayFundingMethods.internalTransfer,er=e=>{if((null==e?void 0:e.id)==="instantAccountVerification")return void I();H(e),K.openModal(),j.closeModal()},ed=()=>{H(null),K.openModal()};(e=>{let{onSelectionRequired:n,onPlaidError:i,isCreatingIavFundingExternalAccounts:t,errorCreatingIavFundingExternalAccounts:l,iavFundingIsOpen:o}=e,[a,r]=(0,v.useState)(!1);(0,v.useEffect)(()=>{t&&r(!0)},[t]),(0,v.useEffect)(()=>
1{a&&!o&&(n(),r(!1))},[a,o]),(0,v.useEffect)(()=>{l&&i()},[l])})({onSelectionRequired:()=>{var e,n,i,t;H(null!=(t=(0,id.Zv)({autopayFundingMethods:null!=(n=null==u||null==(e=u.autopay)?void 0:e.autopayFundingMethods)?n:{},fundingMethodsForProduct:null!=(i=null==u?void 0:u.fundingMethods)?i:{}}).instantAccountVerification)?t:null),K.openModal()},isCreatingIavFundingExternalAccounts:C,errorCreatingIavFundingExternalAccounts:S,onPlaidError:()=>H(null),iavFundingIsOpen:F});let es=async()=>{try{U(!0),await h()}finally{U(!1)}},ec=async()=>c?J&&P&&t7(c)?(G.openModal(),null):m({fundingSource:c}):null,eu=async e=>{if(t7(c))try{Q(!0),await (null==P?void 0:P(c.id,e)),await m({fundingSource:c})}catch(e){G.closeModal()}finally{Q(!1)}},{isLoading:ep,onClick:em}=(0,iB.A)({onClick:ec}),eh=()=>{K.closeModal(),j.closeModal(),W.openModal()},ev={heading:L||"Set Up Automatic Payments!",subheading:N||"Select the account used to repay your loan.",...{productId:V||(null==u?void 0:u.id)}},eg=s||!c||E?"small":"xSmall";return(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{...ev}),(0,l.Y)(ei.A,{theme:eg,children:s?(0,l.Y)("div",{css:lb.spinner,children:(0,l.Y)(ny.A,{size:"large"})}):c?(0,l.Y)(l.FK,{children:(0,l.FD)(y.A,{onSubmit:em,children:[(0,l.Y)(ei.A,{theme:"small",children:(0,l.Y)(t3.Ay,{fundingSource:c,onClick:ed,"aria-description":"This is your currently selected funding source. Press enter to select a different funding method.",configProducts:R})}),(0,l.Y)(w.A,{type:"submit",isFull:!0,isLoading:ep,children:"Continue"})]})}):(0,l.Y)(ly,{displayRolloverOrTransferOption:!1,handleSelectRolloverOrTransfer:eh,internalAccountFundingSources:et,productAllowsInternalTransfer:!!(null==u||null==(i=u.fundingMethods)?void 0:i.internalTransfer)||!!(null==u||null==(o=u.autopay)||null==(t=o.autopayFundingMethods)?void 0:t.internalTransfer),disableExternalAccountsForAutopay:null!=ea&&ea,externalFundingSources:el,iavFundingIsLoading:Y,iavFundingError:T,product:u,onEditFundingSourceClick:er,onSelectFundingSource:b,isAutopaySetup:!0})}),!E&&(0,l.Y)(w.A,{onClick:es,type:"button",theme:"outline",isFull:!0,isLoading:_,children:"Skip Auto Pay For Now"}),!!B&&(0,l.Y)("div",{css:lb.infoBoxContainer,children:(0,l.Y)(Z.A,{icon:"info-circle",content:B,productId:V||(null==u?void 0:u.id),tooltipIcon:M?"info-circle":null,tooltipContent:M})}),(0,l.Y)(lA,{heading:"Select Funding Method",subheading:"Select from a saved account source or add a new one",person:p,product:u,fundingSources:[...en,...et],disableExternalAccountsForAutopay:ea,iavFundingAccounts:g,iavFundingError:T,selectedFundingSourceId:(null==c?void 0:c.id)||void 0,editingFundingSource:q,isOpen:K.modalIsOpen,iavFundingIsLoading:Y,isCreatingIavFundingExternalAccounts:C,isAutopaySetup:!0,displayRolloverOrTransferOption:!1,onClose:()=>{var e;K.closeModal(),null==(e=X.current)||e.focus()},onSelectFundingSource:b,onConnectIavFundingAccount:I,onExternalAccountSubmit:A,onSelectRolloverOrTransfer:eh,onEditFundingSourceClick:er,onAddNewFundingSourceClick:()=>{K.closeModal(),H(null),j.openModal()},onExternalCardSubmit:t4(),handleCurrentFundingSourceClick:ed}),(0,l.Y)(lh,{person:p,product:u,iavFundingAccounts:g,iavFundingError:T,editingFundingSource:q,isOpen:j.modalIsOpen,iavFundingIsLoading:Y,isCreatingIavFundingExternalAccounts:C,displayRolloverOrTransferOption:!1,onClose:()=>{var e;j.closeModal(),null==(e=X.current)||e.focus()},onEditFundingSourceClick:er,onSelectFundingSource:b,onSelectRolloverOrTransfer:eh,onExternalAccountSubmit:A,onCurrentFundingSourceClick:ed,onExternalCardSubmit:t4(),configProducts:R}),G.modalIsOpen&&t7(c)&&(0,l.Y)(ll,{isOpen:!0,fundingSource:c,productCustomerType:null==u?void 0:u.customerType,isLoading:$,onClose:G.closeModal,onConfirm:eu})]})};var lS=i(35651),lw=i(69793);let lx=e=>{let{plaidInstance:n,plaidAccounts:i,isLoadingIavPostFlowData:t,createPlaidExternalAccountsError:o,plaidIsOpen:a,plaidIsLoading:r,plaidError:d}=(0,lw.A)();return(0,l.Y)(lC,{...e,iavFundingAccounts:i,iavFundingIsOpen:a,iavFundingIsLoading:r,iavFundingError:d,isCreatingIavFundingExternalAccounts:t,errorCreatingIavFundingExternalAccounts:!!o,onConnectIavFundingAccount:()=>n.open()})};i(34036);let lF=e=>{var n,i;
1let{contingent:t,children:o,namePrefix:a,entityType:r}=e,d=(e=>{let n=[],i=(null==e?void 0:e.contingent)?"contingent":"primary";return"person"===e.entityType&&n.push("planBeneficiary:".concat(i)),"organization"===e.entityType&&(n.push("organizationPlanBeneficiary:".concat(i)),n.push("einTaxIdType")),n})({contingent:t,entityType:r}),s=(0,nn.A)({entityType:"beneficiary",namePrefix:a,scopes:d}),c={...s,isEIN:(null==s||null==(i=s.fields)||null==(n=i.taxId)?void 0:n.taxIdType)==="EIN"};return(0,l.Y)(T.A,{...c,namePrefix:a,children:o})},lY={container:{margin:"16px 0"}},lT=e=>{let{container:n}=e,{formState:{submitCount:i,isValid:t}}=(0,S.xW)(),{showValidationMessage:o,message:a,scrollToError:r}=(0,F.A)({submitCount:i,isValid:t,container:n,triggerSnackbarMessage:!1,scrollToTopOnShow:!0});return o?(0,l.Y)("div",{css:lY.container,children:(0,l.Y)(eZ.A,{state:"entered",theme:"alert",buttonTheme:"alert",size:"small",action:{text:"Go to first error",onClick:r},children:a})}):null};var lD=i(68604),lE=i(31482),lk=i(58036),lP=i.n(lk),lO=i(42583),lR=i(43549),lL=i(33285);let lN={addressContainer:e=>{let{colors:n}=e;return{backgroundColor:n.grey4,padding:"1.5rem",borderRadius:"8px",marginBottom:24}},removeButton:{margin:"-12px -10px -12px 0",float:"right"},addAddressButton:e=>{let{isInModal:n}=e;return{marginTop:4,marginBottom:"1.25rem",...n&&{marginTop:0}}},modalBody:{padding:24},modalTitle:e=>{let{fontScales:n}=e;return{marginBottom:8,...n.large}},radioOption:{marginBottom:16}},lB=e=>e.replace("address",""),lM=e=>{let{personOrBusiness:n,isUsingPassedInAddress:i=!1,hasMailingAddressToCopy:t=!1,isDisabled:o=!1,isInModal:a=!1}=e,{namePrefix:r,fields:d}=(0,T.d)(),[s,c]=(0,v.useState)(!1),[u,p]=(0,v.useState)(),m=lE.jv.filter(e=>{let n=d[e];return(null==n?void 0:n.requirement)==="required"||(null==n?void 0:n.requirement)==="systemRequired"||(null==n?void 0:n.requirement)==="locked"}),h=lE.jv.filter(e=>{let n=d[e];return(null==n?void 0:n.requirement)==="optional"}),[g,f]=(0,v.useState)(()=>m.length||1!==h.length||o?lE.jv.filter(e=>!m.includes(e)&&((e,n)=>!!n&&(0,lD._w)(e).some(e=>!!n[e]))(e,n)):h);(0,v.useEffect)(()=>{m.length||1!==h.length||f(h)},[m.length,h.length]);let y=i&&t,I=y&&!g.includes("addressMailing")?[...g,"addressMailing"]:g,A=h.filter(e=>!I.includes(e)),{setValue:b,setTouched:C,clearErrors:x}=(0,S.xW)(),{onFieldGroupChange:F}=(0,lR.lN)();if(0===m.length&&0===I.length)return null;let Y=e=>{let n=d[e],i=null==n?void 0:n.formLabel;return(null==n?void 0:n.requirement)==="optional"?"".concat(i," (Optional)"):i};return(0,l.FD)(l.FK,{children:[m.map(e=>{let t=(0,lD.sn)(e),r=o&&lP()((0,lD.HR)(n,t),e=>!n3()(e)&&""!==e);return(0,l.Y)("div",{css:!a&&lN.addressContainer,id:"".concat(e,"-field-group"),children:(0,l.Y)(lO.A,{title:Y(e),isTitleBold:!0,children:(0,l.Y)(lL.A,{addressTypePrefix:e,isDisabled:r||i},"".concat(e,"-field-group"))})},"".concat(e,"-field-group"))}),(0,l.Y)(ee.A,{fieldIds:$.A.PERSON.ADDITIONAL_ADDRESS_FIELDS}),I.map(e=>{let n="addressMailing"===e&&y;return(0,l.Y)("div",{"data-testid":"".concat(e,"-field-group"),css:!a&&lN.addressContainer,children:(0,l.Y)(lO.A,{title:Y(e),action:n?null:(0,l.Y)("div",{css:lN.removeButton,children:(0,l.Y)(w.A,{size:"mediumPreserveCase",theme:"link",onClick:()=>(e=>{f(n=>n.filter(n=>n!==e));let n=(0,lD._w)(e),i=Object.fromEntries(n.map(e=>[e,null]));F("".concat(e,"FieldGroup"),r,i);let t=n.map(e=>"".concat(r,".").concat(e));t.forEach(e=>{b(e,null),C(e,!1)}),x(t)})(e),"data-testid":"remove-".concat(e),children:(0,l.Y)(eH.A,{name:"trash"})})}),isTitleBold:!0,children:(0,l.Y)(lL.A,{addressTypePrefix:e,isDisabled:n})})},"".concat(e,"-field-group"))}),!o&&!!A.length&&(0,l.Y)("div",{css:lN.addAddressButton({isInModal:a}),children:(0,l.Y)(w.A,{type:"button",theme:"outline",isFull:!0,onClick:1===A.length?()=>f([...g,A[0]]):()=>c(!0),"data-testid":"add-address-button",children:1===A.length?"Add\n            ".concat(lB(A[0])," Address"):"Add Address"})}),(0,l.Y)(nh.A,{isOpen:s,onClose:()=>{p(null),c(!1)},fixToMaxHeight:a,children:(0,l.FD)("div",{css:lN.modalBody,children:[(0,l.Y)("div",{css:lN.modalTitle,children:"Add Address"}),A.map(e=>(0,l.Y)("div",{css:lN.radioOption,children:(0,l.Y)(eq.A,{name:"".concat(e,"-radio"),value:e,label:"".concat(lB(e)," Address"),type:"radio",isChecked:u===e,onChange:e=>{p(e.target.value)}})},"".concat(e,"-radio}"))),(0,l.Y)(w.A,{type:"button",size:"large",isFull:!0,isDisabled:!u,onClick:()=>{u&&(f([...g,u]),c(!1))},children:"Continue"})]})})]})},lz={container:{padding:"16px 16px 48px"},heading:{marginBottom:16},radioContainer:{display:"flex",justifyContent:"space-between",gap:"16px",marginBottom:"16
1px"}},lV=e=>{let{modalDialogRef:n,beneficiary:i,beneficiaryType:t}=e,o=null==i?void 0:i.contingent,a=(null==i?void 0:i.inProgress)?"Add Beneficiary":"Update Beneficiary";return(0,l.FD)(lF,{contingent:!!o,entityType:t,namePrefix:"",children:[(0,l.Y)(lT,{container:null==n?void 0:n.current}),(0,l.Y)(iG.A,{children:(0,l.Y)(ee.A,{fieldIds:$.A.BENEFICIARY.BASIC_INFO_FIELDS})}),(0,l.FD)(ei.A,{theme:"small",children:[(0,l.Y)(Y.A,{fieldId:"percentage"}),(0,l.Y)(lM,{personOrBusiness:i,isInModal:!0}),(0,l.Y)(Z.A,{content:"If this is the only beneficiary, set their allocation to 100%.",icon:"info-circle"})]}),(0,l.Y)(w.A,{isFull:!0,type:"submit",children:a})]})},l_=e=>{let{onClose:n,onSubmit:i,isOpen:t,beneficiary:o}=e,[a,r]=(0,v.useState)((null==o?void 0:o.type)||"person"),d={...o,...(null==o?void 0:o.dateOfBirth)?{dateOfBirth:(0,eY.wV)(o.dateOfBirth,{dateFormat:"MMddyyyy"})}:{}},s=e=>{i({beneficiary:{...e,type:a}})};return(0,v.useEffect)(()=>{t&&r((null==o?void 0:o.type)||"person")},[t]),(0,l.Y)(nh.A,{isOpen:t,onClose:n,fixToMaxHeight:!0,children:e=>{let{modalDialogRef:n}=e;return(0,l.FD)("div",{css:lz.container,children:[(0,l.Y)(x.A,{theme:"medium",heading:"Beneficiary Information"}),(0,l.FD)("div",{css:lz.radioContainer,children:[(0,l.Y)(eq.A,{name:"type",id:"type-person",type:"radio",label:"Person",value:"person",onChange:()=>r("person"),"aria-description":"Person Beneficiary",isChecked:"person"===a,isDisabled:!!(null==o?void 0:o.type)}),(0,l.Y)(eq.A,{name:"type",id:"type-organization",type:"radio",label:"Organization",value:"organization",onChange:()=>r("organization"),"aria-description":"Organization Beneficiary",isChecked:"organization"===a,isDisabled:!!(null==o?void 0:o.type)})]}),"person"===a?(0,l.FD)(y.A,{initialValues:d,onSubmit:s,children:[(0,l.Y)("div",{css:lz.heading}),(0,l.Y)(lV,{modalDialogRef:n,beneficiary:o,beneficiaryType:"person"})]},"person"):(0,l.FD)(y.A,{initialValues:d,onSubmit:s,children:[(0,l.Y)("div",{css:lz.heading}),(0,l.Y)(lV,{modalDialogRef:n,beneficiary:o,beneficiaryType:"organization"})]},"organization")]})}})};var lU=i(56994);let lq={cardOuterContainer:{margin:"1rem 0"},innerCard:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"1rem"},beneficiaryName:e=>{let{colors:n,fontScales:i}=e;return{...i.default,color:n.grey7}},beneficiaryPercentage:e=>{let{colors:n,fontScales:i}=e;return{...i.default,color:n.grey2}},actionsRow:{display:"flex",justifyContent:"space-between",marginTop:"1.25rem"},actionButton:{width:"calc(50% - 5px)"}},lH=e=>{let{beneficiary:n,onEdit:i,onRemove:t}=e;return(0,l.Y)("div",{css:lq.cardOuterContainer,children:(0,l.FD)(eU.A,{children:[(0,l.FD)("div",{css:lq.innerCard,children:[(0,l.Y)("p",{css:lq.beneficiaryName,children:(null==n?void 0:n.firstName)&&(null==n?void 0:n.lastName)?"".concat(n.firstName," ").concat(n.lastName):(null==n?void 0:n.legalName)?n.legalName:""}),(0,l.FD)("p",{css:lq.beneficiaryPercentage,children:["".concat(n.percentage),"%"]})]}),(0,l.FD)("div",{css:lq.actionsRow,children:[(0,l.Y)("div",{css:lq.actionButton,children:(0,l.Y)(w.A,{onClick:i,isFull:!0,size:"mediumPreserveCase",theme:"opaque",children:"Edit"})}),(0,l.Y)("div",{css:lq.actionButton,children:(0,l.Y)(w.A,{onClick:t,isFull:!0,size:"mediumPreserveCase",theme:"opaque",children:"Remove"})})]})]})},n.id)},lK=e=>{let{children:n,namePrefix:i,planKey:t}=e,o=(e=>{let n=[];return e&&n.push("plan:".concat(e)),n})(t),a=(0,nn.A)({entityType:"plan",namePrefix:i,scopes:o});return(0,l.Y)(T.A,{...a,namePrefix:i,children:n})},lj={backButton:e=>{let{colors:n}=e;return{display:"flex",alignItems:"center",color:n.brand.primary,cursor:"pointer",transition:"0.15s linear opacity",marginBottom:"2rem","&:hover":{opacity:"0.8"}}},icon:{width:"2rem",height:"2rem",marginRight:"-0.25rem",marginLeft:"-0.5rem"},beneficiaryTitle:e=>{let{fontScales:n}=e;return{...n.medium,marginBottom:"0.5rem",fontWeight:700}},beneficiarySection:{marginBottom:"2rem"},chipInner:e=>{let{colors:n}=e;return{display:"flex",alignItems:"center",padding:"4px",gap:"4px",color:n.grey7}},chipText:e=>{let{fontScales:n}=e;return{...n.small,fontWeight:400}}},lW=e=>{let{formRef:n}=e,{getValues:i,trigger:t}=(0,S.xW)();return n.current={getValues:i,trigger:t},null},lG=e=>{let{totalBeneficiaryPercentage:n}=e,i=100===n;return(0,l.Y)(lU.A,{theme:"chip",size:"small",status:i?"success":"warning",children:(0,l.FD)("div",{css:lj.chipInner,children:[(0,l.Y)(eH.A,{status:i?"success":"warning",name:i?"circle-check":"alert-circle-white"}),(0,l.FD)("p",{children:["".concat(n,"/100%"),(0,l.Y)("span",{css:lj.chipText,children:" allocated"})]})]})})},l$=e=>{let{isLoading:n,onSubmit:i,dispatch:t,currentPlan:o,onBack:a,hasExistingPlans:r,decedentFields:d,planKey:s}=e,[c,u]=(0,v.useState)(!1),{triggerMessage:p}=(0,f.d)(),{getFieldIsEnabled:m}=(0,T.d)(),h=(0,v.useRef)(null),g=m("decedentFields"),I=o.filter(e=>!(null==e?void 0:e.contingent)&&!(null==e?void 0:e.inProgress)),A=o.filter(e=>(null==e?void 0:e.contingent)&&!(null==e?void 0:e.inProgress)),b=e=>e.reduce((e,n)=>(Number(null==n?void 0:n.percentage)||0)+e,0),C=b(I),S=b(A),F=async()=>{var e,n;if(!g||!h.current||await h.current.trigger())return I.length&&100!==C||A.length&&100!==S?p("Combined allocation percentages must equal 100% in order to save benef
1iciaries.",{theme:"error"}):A.length&&!I.length?p("If adding contingent beneficiaries, you must add at least one primary beneficiary.",{theme:"error"}):i(o,null==(n=h.current)||null==(e=n.getValues())?void 0:e.decedentFields)};return(0,l.FD)(k.A,{children:[r&&(0,l.FD)("div",{css:e=>lj.backButton(e),onClick:()=>o.length?u(!0):a(),children:[(0,l.Y)(eH.A,{name:"chevron-left",css:lj.icon}),(0,l.Y)(np.A.Base,{children:"Back"})]}),(0,l.Y)(x.A,{heading:"Create a New Plan",subheading:"Designate the beneficiaries you'd like on your new plan."}),g&&(0,l.FD)("section",{css:lj.beneficiarySection,children:[(0,l.Y)("p",{css:lj.beneficiaryTitle,children:"Original Plan Owner"}),(0,l.Y)(y.A,{initialValues:{decedentFields:d||{}},children:(0,l.FD)(lK,{planKey:s,namePrefix:"",children:[(0,l.Y)(lW,{formRef:h}),(0,l.Y)(ee.A,{fieldIds:$.A.PLAN.DECEDENT_FIELDS})]})})]}),(0,l.FD)("section",{css:lj.beneficiarySection,children:[(0,l.Y)("p",{css:lj.beneficiaryTitle,children:"Primary Beneficiaries"}),!!C&&(0,l.Y)(lG,{totalBeneficiaryPercentage:C}),I.map(e=>(0,l.Y)(lH,{beneficiary:e,onEdit:()=>t({type:"change_task",task:"editBeneficiary",beneficiaryId:(null==e?void 0:e.id)||""}),onRemove:()=>t({type:"remove_beneficiary",beneficiaryId:(null==e?void 0:e.id)||""})},null==e?void 0:e.id)),(0,l.Y)(w.A,{theme:"outline",isFull:!0,onClick:()=>t({type:"change_task",task:"addBeneficiary",contingent:!1}),children:"Add Primary Beneficiary"})]}),(0,l.FD)("section",{css:lj.beneficiarySection,children:[(0,l.Y)("p",{css:lj.beneficiaryTitle,children:"Contingent Beneficiaries"}),!!S&&(0,l.Y)(lG,{totalBeneficiaryPercentage:S}),A.map(e=>(0,l.Y)(lH,{beneficiary:e,onEdit:()=>t({type:"change_task",task:"editBeneficiary",beneficiaryId:(null==e?void 0:e.id)||""}),onRemove:()=>t({type:"remove_beneficiary",beneficiaryId:(null==e?void 0:e.id)||""})},e.id)),(0,l.Y)(w.A,{theme:"outline",isFull:!0,onClick:()=>t({type:"change_task",task:"addBeneficiary",contingent:!0}),children:"Add Contingent Beneficiary"})]}),o.length?(0,l.Y)(w.A,{isFull:!0,isLoading:n,onClick:F,children:"Save Beneficiaries"}):(0,l.Y)(w.A,{isFull:!0,theme:"link",isLoading:n,onClick:F,children:"Proceed Without Beneficiaries"}),(0,l.Y)(i9.A,{canClose:!1,onCancel:()=>u(!1),isOpen:c,onConfirm:()=>a(),buttonText:"Yes, discard progress",cancelText:"Cancel",children:"This will discard your current progress on adding beneficiaries. Are you sure?"})]})},lQ=e=>{let{planKey:n,...i}=e;return(0,l.Y)(lK,{planKey:n,children:(0,l.Y)(l$,{planKey:n,...i})})},lJ=(e,n)=>{let i=e.findIndex(e=>e.id===n),t=[...e];return t.splice(i,1),t},lZ=(e,n)=>{var i,t;switch(n.type){case"change_task":{if("editBeneficiary"===n.task)return{...e,task:n.task,beneficiaryIdBeingEdited:n.beneficiaryId};if("addBeneficiary"===n.task){let t,l=(t=n.contingent,{id:String(Math.random()),contingent:t,type:void 0,inProgress:!0});return{...e,task:n.task,beneficiaryIdBeingEdited:null!=(i=l.id)?i:"",incompletePlan:[...e.incompletePlan,l]}}let t=e.incompletePlan;return{...e,incompletePlan:t,task:n.task,beneficiaryIdBeingEdited:""}}case"add_beneficiary":case"edit_beneficiary":{let{id:i,contingent:l,type:o,inProgress:a,...r}=n.beneficiary;return{...e,task:"manage",beneficiaryIdBeingEdited:"",decedentFields:null!=(t=n.decedentFields)?t:e.decedentFields,incompletePlan:((e,n,i)=>{let t=e.findIndex(e=>e.id===n),l=[...e];return l.splice(t,1,er()({...i,dateOfBirth:(0,eY.C)(null==i?void 0:i.dateOfBirth)},"inProgress")),l})(e.incompletePlan,e.beneficiaryIdBeingEdited,{id:i,contingent:l,type:o,inProgress:a,...n6()(r,e=>""!==e&&void 0!==e)})}}case"remove_beneficiary":return{...e,incompletePlan:lJ(e.incompletePlan,n.beneficiaryId)};case"cancel_add_beneficiary":return{...e,task:"manage",incompletePlan:lJ(e.incompletePlan,e.beneficiaryIdBeingEdited),beneficiaryIdBeingEdited:""}}},lX=e=>{let{isLoading:n,onSubmit:i,onBack:t,hasExistingPlans:o,planKey:a}=e,[r,d]=(0,v.useReducer)(lZ,{task:"manage",incompletePlan:[],beneficiaryIdBeingEdited:"",decedentFields:void 0}),s=r.incompletePlan.find(e=>(null==e?void 0:e.id)===(null==r?void 0:r.beneficiaryIdBeingEdited));return(0,l.FD)(l.FK,{children:[(0,l.Y)(lQ,{hasExistingPlans:o,isLoading:n,onSubmit:(e,n)=>((e,n)=>i(e.map(e=>{var n;return(0,E.kx)({...er()(e,["id","inProgress"]),type:null!=(n=e.type)?n:void 0,contingent:e.contingent})}),n?(0,E.jE)(n):void 0))(e,n),dispatch:d,currentPlan:r.incompletePlan,onBack:t,planKey:a,decedentFields:r.decedentFields}),(0,l.Y)(l_,{beneficiary:s,isOpen:"addBeneficiary"===r.task,onClose:()=>d({type:"cancel_add_beneficiary"}),onSubmit:e=>
1{let{beneficiary:n}=e;return d({type:"add_beneficiary",beneficiary:n,decedentFields:r.decedentFields})}}),(0,l.Y)(l_,{beneficiary:s,isOpen:"editBeneficiary"===r.task,onClose:()=>d({type:"change_task",task:"manage"}),onSubmit:e=>{let{beneficiary:n}=e;return d({type:"edit_beneficiary",beneficiary:n,decedentFields:r.decedentFields})}})]})};var l0=i(47461);let l9={cardInner:{display:"flex",verticalAlign:"middle",padding:16},imageContainer:{width:64,height:64,flexShrink:0},image:{width:"100%",height:"100%",backgroundSize:"contain",backgroundRepeat:"no-repeat",backgroundPosition:"center center"},trashContainer:{flexBasis:24,display:"flex",flexDirection:"column",justifyContent:"center",flexShrink:0},trashSVG:{cursor:"pointer","&:hover":{transform:"scale(1.1)"}},filename:{flexGrow:1,display:"flex",flexDirection:"column",justifyContent:"center",width:"100%",minWidth:0,margin:"0 16px"},filenameNoImage:{marginLeft:0},filenameInner:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"100%",display:"block"}},l1=e=>{let{filename:n,imageSrc:i,onRemove:t}=e;return(0,l.Y)(eU.A,{noPadding:!0,flushMobile:!0,children:(0,l.FD)("div",{css:l9.cardInner,children:[i&&(0,l.Y)("div",{css:l9.imageContainer,children:(0,l.Y)("div",{css:l9.image,style:{backgroundImage:"url(".concat(i,")")}})}),(0,l.Y)("div",{css:[l9.filename,!i&&l9.filenameNoImage],children:(0,l.Y)("div",{css:l9.filenameInner,children:n})}),(0,l.Y)("div",{css:l9.trashContainer,children:(0,l.Y)(eH.A,{name:"trash",css:l9.trashSVG,onClick:t})})]})})},l2={link:e=>{let{colors:n}=e;return{textDecoration:"underline",color:n.brand.primary,cursor:"pointer","&:hover":{color:n.brand.secondary}}}},l6=e=>{let{children:n,onClick:i}=e;return(0,l.Y)("div",{onClick:i,css:l2.link,"data-setstaticid":!0,children:n})},l5={container:e=>{let{colors:n}=e;return{backgroundImage:"url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' stroke='rgb(13, 62, 111)' stroke-width='4' stroke-dasharray='4%2c 12' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e\")",borderRadius:4,padding:"64px 16px",textAlign:"center",cursor:"pointer","&:hover":{backgroundColor:n.grey4}}},containerDraggedOver:e=>{let{colors:n}=e;return{backgroundColor:n.blue5}},header:()=>({fontWeight:"bold"}),description:e=>{let{fontScales:n,colors:i}=e;return{...n.small,color:i.grey2}}},l4=e=>{let{onChange:n,allowedMimeTypes:i,maxFileSizeMb:t=1/0}=e,o=(0,v.useRef)(null),[a,r]=(0,v.useState)(!1),{triggerMessage:d}=(0,f.d)(),s=(0,v.useMemo)(()=>Array.isArray(i)&&i.map(l0.extension).filter(Boolean).map(e=>null==e?void 0:e.toUpperCase()),[i]),c=e=>{e.preventDefault(),e.stopPropagation(),r(!0)},u=e=>{e.preventDefault(),e.stopPropagation(),r(!1)},p=e=>{if(e.length>1)return d("Please only select one file.");let l=e[0];return 0===l.size?d("The file uploaded is an empty file.",{theme:"error"}):i&&!i.includes(l.type)?d("This file type is not supported. Allowed types are ".concat(s.join(", "),".")):l.size/1e6>t?d("This file exceeds the maximum file size of ".concat(t,"MB")):null==n?void 0:n(l)};return(0,l.FD)("div",{css:e=>[l5.container(e),a&&l5.containerDraggedOver(e)],onDragEnter:c,onDragOver:c,onDragLeave:u,onDrop:e=>{var n;u(e),p(null==e||null==(n=e.dataTransfer)?void 0:n.files)},onClick:()=>{var e,n;return null==(n=o.current)||null==(e=n.click)?void 0:e.call(n)},children:[(0,l.Y)("div",{css:l5.header,children:"Upload Document"}),(0,l.FD)("div",{children:[(0,l.Y)("input",{type:"file",hidden:!0,ref:o,"data-setstaticid":!0,onChange:e=>{var n;p(null==e||null==(n=e.currentTarget)?void 0:n.files)},accept:Array.isArray(i)&&i.join(",")||"",id:"drag-and-drop-target-input","aria-label":"Select File"}),(0,l.FD)("div",{css:l5.description,children:[(0,l.Y)(l6,{children:"Select file"})," to upload",s&&(0,l.Y)("span",{children:" (".concat(s.join(", "),")")}),isFinite(t)&&(0,l.FD)("div",{children:["Max file size: ",t,"mb"]})]})]})]})},l3=e=>{let{value:n,onChange:i}=e,[t,o]=(0,v.useState)();return(0,v.useEffect)(()=>{if(n.type.match("image.*")){let e=new FileReader;e.onload=e=>{var n;o(null==e||null==(n=e.target)?void 0:n.result)}
1,e.readAsDataURL(n)}},[n]),(0,l.Y)(l1,{imageSrc:t,onRemove:()=>null==i?void 0:i(),filename:null==n?void 0:n.name})},l8=e=>{let{value:n,...i}=e;return n?(0,l.Y)(l3,{value:n,...i}):(0,l.Y)(l4,{...i})},l7={contentContainer:{width:"100%",maxWidth:590,margin:"0 auto"},dropTarget:{marginTop:24},buttons:{textAlign:"center",display:"flex",margin:"0 -8px"},button:{padding:4,flex:"1 0 50%",button:{width:"100%"}},secondaryHeading:{textAlign:"left",marginBottom:14,marginTop:24,fontWeight:700},confirmFilename:{marginTop:24},docLink:{marginBottom:24},rejectionNote:{marginBottom:24},applicantNote:{marginBottom:24}},oe=(0,l.Y)(n7.A,{theme:"success",children:"Upload Complete"}),on=e=>{var n;let{verificationRequirement:i,documents:t=[],person:o,onSubmit:a,onCancel:r,onDelete:d,isUploading:s,isDeleting:c,heading:u,subheading:p,rejectionNote:m,applicantNote:h}=e,{fields:g,entityType:f}=(0,T.d)(),y=g[i],{documentTypes:I}=(0,D.t)(),A=null!=(n=null==y?void 0:y.displayLabel)?n:i,b=y&&"documentTypes"in y&&(null==y?void 0:y.documentTypes)||[],C=f in I?I[f]:void 0,S=b.map(e=>null==C?void 0:C[e]).filter(Boolean),F=S.length?S:[{type:"other",name:"Other"}],[Y,E]=(0,v.useState)(()=>1===F.length?F[0].type:void 0),P=F.find(e=>e.type===Y),[O,R]=(0,v.useState)(null),[L,N]=(0,v.useState)(null),B=()=>N(null),M=Array.isArray(t)&&!!t.length,z=!!(null==P?void 0:P.url),_={...o?{heading:(0,J.L)(o),subheading:M?oe:A}:{heading:null!=A?A:"Upload Document",subheading:M?oe:"Please upload one of the following documents to verify ".concat(A,".")},...u&&{heading:u},...p&&{subheading:p},...(null==y?void 0:y.description)&&{subheading:y.description}},U=async()=>{try{await d(L)}catch(e){}N(null)};return(0,l.FD)(k.A,{children:[(0,l.FD)("div",{css:l7.contentContainer,children:[(0,l.Y)(x.A,{..._}),m&&(0,l.Y)("div",{css:l7.rejectionNote,children:(0,l.Y)(Z.A,{icon:"info-circle",content:m,theme:"warning"})}),h&&(0,l.Y)("div",{css:l7.applicantNote,children:(0,l.Y)(Z.A,{icon:"info-circle",content:h})}),(0,l.Y)(ei.A,{children:M?t.filter(Boolean).map(e=>(0,l.FD)(v.Fragment,{children:[(0,l.Y)("div",{css:l7.secondaryHeading,children:(0,l.Y)(np.A.H2,{theme:"large",children:e.name})}),(0,l.Y)(l1,{filename:e.originalFilename||"",onRemove:()=>N(e)},e.id)]},e.id)):(0,l.FD)(l.FK,{children:[(0,l.Y)("div",{css:l7.secondaryHeading,children:(0,l.Y)(np.A.H2,{theme:"medium",children:"Select Document"})}),(0,l.Y)(ep.A,{name:"documentType",label:"Select Document Type",ariaLabel:"Select Document Type",onChange:e=>E(e),value:Y,options:null==F?void 0:F.map(e=>{let{type:n,name:i}=e;return{label:i,value:n}})}),Y&&(0,l.FD)("div",{css:l7.dropTarget,children:[(null==P?void 0:P.description)&&(0,l.Y)(ei.A,{theme:"small",children:(0,l.Y)(Z.A,{content:P.description,heading:P.name})}),z&&(0,l.Y)("div",{css:l7.docLink,children:(0,l.Y)(nm.A,{href:null==P?void 0:P.url,download:!0,children:(0,l.Y)(V.A,{title:"Download Document Template",hideArrow:!0,description:(null==P?void 0:P.selfServeUrlDescription)||(null==P?void 0:P.name)||(null==P?void 0:P.url),icon:"download",onClick:()=>{}})})}),(0,l.Y)(l8,{value:O,onChange:R,maxFileSizeMb:25,allowedMimeTypes:["image/png","image/jpeg","application/pdf"]})]})]})})]}),(0,l.Y)("div",{css:l7.contentContainer,children:(0,l.FD)("div",{css:l7.buttons,children:[!!r&&(0,l.Y)("div",{css:l7.button,children:(0,l.Y)(w.A,{type:"button",theme:"outline",onClick:r,children:M?"Go Back to Additional Verification":"Back"})}),!M&&(0,l.Y)("div",{css:l7.button,children:(0,l.Y)(w.A,{type:"button",isLoading:s,isDisabled:!O||!Y,onClick:()=>a({documentType:Y,file:O}),children:"Upload"})})]})}),(0,l.FD)(i9.A,{isOpen:!!L,buttonText:"Remove File",onClose:B,onConfirm:U,onClickAway:B,isLoading:c,children:[(0,l.FD)(np.A.H1,{theme:"large",children:["Are you sure you want to remove this ",null==L?void 0:L.name," ","document?"]}),(0,l.Y)("div",{css:l7.confirmFilename,children:(0,l.Y)(np.A.Base,{children:null==L?void 0:L.originalFilename})})]})]})},oi=e=>{var n,i,t,o,a,r,d,s,c,u,p,m,h;let{entityType:v,application:g,person:f,organization:I,...A}=e,b=(0,eS.rC)(null==g?void 0:g.rawFields);switch(v){case"person":return(0,l.Y)(y.A,{initialValues:f,children:(0,l.Y)(en.A,{applicationFields:g.rawFields,personId:null==f?void 0:f.id,applicationType:g.type,originatingExperience:g.originatingExperience,isControlProng:null==f?void 0:f.isControlProng,isOwnershipProng:null==f?void 0:f.isOwnershipProng,isSoleProprietor:null==f?void 0:f.isSoleProprietor,isControlProngAuthorizedSigner:null==(n=g.fields)?void 0:n.isControlProngAuthorizedSigner,isMissingTaxId:(null==f?void 0:f.hasTaxId)===!1,coreSyncedFields:null==f?void 0:f.coreSyncedFields,isCreditUnionMember:!!(null==f?void 0:f.externalCoreMembershipId),isMinor:null==f?void 0:f.isMinor,role:null==b||null==(i=b.find(e=>e&&"personId"in e&&e.personId===(null==f?void 0:f.id)))?void 0:i.role,isEIN:!1,kycEvaluationTags:(null==g||null==(o=g.personKycSnapshot)||null==(t=o.find(e=>(null==e?void 0:e.personId)===(null==f?void 0:f.id)))?void 0:t.tags)||[],children:(0,l.Y)(on,{person:f,...A})})});case"organization":return(0,l.Y)(y.A,{initialValues:I,children:(0,l.Y)(X.A,{applicationFields:g.rawFields,applicationType:g.type,originatingExperience:g.originatingExperience,organizationType:(null==I?void 0:I.type)||void 0,coreSyncedFields:(null==I?void 0:I.coreSyncedFields)||[],isEIN:(null==I?void 0:I.taxIdType)==="E
1IN",externalCoreMembershipId:null==I?void 0:I.externalCoreMembershipId,kycEvaluationTags:(null==g||null==(r=g.organizationKycSnapshot)||null==(a=r.find(e=>(null==e?void 0:e.organizationId)===(null==I?void 0:I.id)))?void 0:a.tags)||[],allowlistCategory:null==I?void 0:I.allowlistCategory,children:(0,l.Y)(on,{entityType:v,...A})})});case"application":return(0,l.Y)(y.A,{initialValues:g,children:(0,l.Y)(ni,{application:g,addressPrimaryState:(null==g||null==(c=g.persons)||null==(s=c[0])||null==(d=s.rawFields)?void 0:d.addressPrimaryState)||void 0,maritalStatus:(null==g||null==(m=g.persons)||null==(p=m[0])||null==(u=p.rawFields)?void 0:u.maritalStatus)||void 0,newAccountRelationshipData:b||void 0,organizationType:(null==(h=g.organization)?void 0:h.type)||void 0,personKycEvaluationTags:(null==g?void 0:g.personKycEvaluationTags)||[],organizationKycEvaluationTags:(null==g?void 0:g.organizationKycEvaluationTags)||[],children:(0,l.Y)(on,{entityType:v,...A})})});default:return null}};i(47201);let ot={modalOverlay:{common:(0,nf.css)({position:"fixed",top:0,left:0,width:"100vw",height:"100vh",transition:"background 175ms linear",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"}),visible:(0,nf.css)({background:"rgba(0, 0, 0, 0.5)",pointerEvents:"all"}),hidden:(0,nf.css)({background:"rgba(0, 0, 0, 0)",pointerEvents:"none"}),loadingViewContainer:(0,nf.css)({position:"fixed",zIndex:-1})},container:(0,nf.css)({display:"flex",alignItems:"center",flexDirection:"column",gap:24})},ol=e=>{let{launchSDK:n,SDKState:i,SDKContainerId:t,goToPreviousView:o}=e,a=(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{heading:"Additional Verification Required",subheading:"In order to validate your personal information we will be using a camera to verify your identity.",isCentered:!0,icon:"illustration-shield-warning"}),(0,l.Y)(w.A,{isFull:!0,type:"button",onClick:n,isDisabled:"launched"===i,children:"Let's Get Going"}),(0,l.Y)(w.A,{isFull:!0,theme:"outline",type:"button",onClick:o,children:"Go Back"})]}),r=(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{heading:"Verification Complete",subheading:"Your additional verification has been submitted.",isCentered:!0,icon:"illustration-success"}),(0,l.Y)(w.A,{isFull:!0,type:"button",onClick:o,children:"Done"})]});return(0,l.FD)(l.FK,{children:[i5.createPortal((0,l.Y)("div",{css:[ot.modalOverlay.common,ot.modalOverlay["launched"===i?"visible":"hidden"]],id:t,children:"launched"===i&&(0,l.Y)("div",{css:ot.modalOverlay.loadingViewContainer,children:(0,l.Y)(ny.A,{size:"extraLarge"})})}),document.body),(0,l.Y)(k.A,{children:(0,l.Y)("div",{css:ot.container,children:"complete"===i?r:a})})]})};var oo=i(93675),oa=i(95275),or=i.n(oa);function od(){let e=(0,ng._)(["\n  mutation UploadAutomatedIdentityVerificationResults(\n    $requestedEvaluationId: ID!\n    $providerData: JSONObject!\n  ) {\n    uploadAutomatedIdentityVerificationResults(\n      requestedEvaluationId: $requestedEvaluationId\n      providerData: $providerData\n    )\n  }\n"]);return od=function(){return e},e}let os=(0,iE.J1)(od()),oc=e=>{var n,i;let{eddQuestionnaireType:t,application:o,organization:a,...r}=e;return(0,l.Y)(y.A,{theme:"fillHeight",initialValues:r.initialValues,children:(0,l.Y)(X.A,{applicationFields:o.rawFields,applicationType:o.type,originatingExperience:o.originatingExperience,coreSyncedFields:(null==a?void 0:a.coreSyncedFields)||[],organizationType:(null==a?void 0:a.type)||void 0,isEIN:(null==a?void 0:a.taxIdType)==="EIN",kycEvaluationTags:(null==o||null==(i=o.organizationKycSnapshot)||null==(n=i.find(e=>(null==e?void 0:e.organizationId)===(null==a?void 0:a.id)))?void 0:n.tags)||[],externalCoreMembershipId:a.externalCoreMembershipId,allowlistCategory:a.allowlistCategory,children:(0,l.Y)(B,{eddQuestionnaireType:t,entityType:"organization",...r})})})},ou=e=>{var n,i,t,o;let{eddQuestionnaireType:a,application:r,person:d,...s}=e,c=(0,eS.rC)(null==r?void 0:r.rawFields),u=((e,n)=>{var i,t;return null!=(t=null==(i=e.consumerUnderwritingSnapshot)?void 0:i.filter(e=>e.personId===n).flatMap(e=>{var n;return null!=(n=e.tags)?n:[]}))?t:[]})(r,d.id);return(0,l.Y)(y.A,{theme:"fillHeight",initialValues:s.initialValues,children:(0,l.Y)(en.A,{applicationFields:r.rawFields,personId:d.id,applicationType:r.type,originatingExperience:r.originatingExperience,isControlProng:d.isControlProng,isOwnershipProng:d.isOwnershipProng,isSoleProprietor:d.isSoleProprietor,isControlProngAuthorizedSigner:null==(n=r.fields)?void 0:n.isControlProngAuthorizedSigner,coreSyncedFields:d.coreSyncedFields,isCreditUnionMember:!!d.externalCoreMembershipId,isMinor:d.isMinor,isMissingTaxId:(null==d?void 0:d.hasTaxId)===!1,role:null==c||null==(i=c.find(e=>e&&"personId"in e&&e.personId===d.id))?void 0:i.role,isEIN:!1,kycEvaluationTags:(null==r||null==(o=r.personKycSnapshot)||null==(t=o.find(e=>(null==e?void 0:e.personId)===(null==d?void 0:d.id)))?void 0:t.tags)||[],underwritingTags:u,children:(0,l.Y)(B,{eddQuestionnaireType:a,entityType:"person",...s})})})},op=[...{PERSON:{ADDRESS_FIELDS:lE.jv,EMAILS_FIELDS:["emailPrimary","emailSecondary","emails"],PHONE_NUMBER_FIELDS:["phoneMobile","phoneWork","phoneHome","phoneFax"],ADDITIONAL_ADDRESS_FIELDS:["ownOrRent","residenceType","yearsAtAddress","monthlyHousingCostsCents","requiresPreviousResidences","preferredBranch","monthsAtPrimaryAddress","countyOfResidence"],ATTRIBUTION:[["originatingBranchCode","costCenterCode"],["primaryOfficerNumber","secondaryOfficerNumber"],["tertiaryOfficerNumber","fourthOfficerNumber"],["fifthOfficerNumber"]],PROFILE_FIELDS:[["salutation","firstName","middleName","lastName","suffix"],["alternativeFirstName","alternativeMiddleName","alternativeLastName"],"dateOfBirth","gender","ethnicity","race"],IDENTITY_VERIFICATION_FIELDS:["usResidencyStatus","hasUsAddress","nraAccountDepositSource","purposeOfStay","hasTaxId"],ADDITIONAL_DETAILS_FIELDS:["idType","sourceOfWealth","sourceOfIncome","estimatedPersonalNetWorth","totalYearsEmployed","schoolAttended","supplementalNote","employmentStatus","employerCurrent","monthsAtCurrentEmployer","occupation","meetsMinimumWorkRequirements","truStageHealthQuestion1","truStageHealthQuestion2","employeeId","employerCode","requiresPreviousEmployers","currentSalaryCe
1nts","sourceOfIncomeList","referenceList","motherMaidenName","securityPhrase","securityPhraseHint","securityPin","isPoliticallyExposed","hasLargeOutstandingLoans","hasLoansSecuredByMarketableSecurities","hasLoansSecuredByCash","isEstablishedCustomerOfBank","doesExpectLargeCashTransactions","doesExpectLargeDomesticWireTransfers","doesExpectLargeInternationalWireTransfers","doesExpectLargeDomesticAchTransfers","doesExpectLargeForeignAchTransfers","doesExpectLargeAchOriginations","isSourceOfFundsCashIntensiveBusiness","referralSource","maritalStatus","numberOfDependents","annualIncome","isSubjectToBackupWithholding","isExemptFromFactaReporting","doesExpectToUseSafetyDepositBox","doesExpectToUseInterpreter","doesTravelInternationally","hasDualCitizenship","isFrequentTraveler","isProfessionalServicesProviderConsumer","customerCode","isPoliticallyExposedEmployeeOfEmbassyOrForeignConsulate","role","relationshipToUSAddress","preferredLanguage","coveredMilitaryBorrower","communicationPreferenceForApplicant","hasOutstandingJudgmentOrBankruptcy","isCoMakerOrGuarantor","isIncomeLikelyToDecline"],PROTECTED_PARTY_FIELDS:["isEmployee","isInsider"],MEMBERSHIP_ELIGIBILITY_FIELDS:["creditUnionEligibilityCriteria","creditUnionMinorEligibilityCriteria"],MEMBERSHIP_ELIGIBILITY_TRIGGERED_FIELDS:["creditUnionMembershipEligibilityReason"],ORGANIZATION_RELATIONSHIP_FIELDS:["title","type","isControlProng","isOwnershipProng","isSoleProprietor"],TRIGGERED_FIELDS:[...lE.qr.PERSON,...lE.qr.ORGANIZATION_RELATIONSHIP],EDD_TRIGGERED_FIELDS:lE.iD.PERSON.EDD_TRIGGERED_FIELDS,REASON_FOR_SKIPPED_RECOMMENDED_FIELDS:["reasonForNoEmail"]},BUSINESS:{ADD_FIELDS:["type","taxId","legalName","isPubliclyTraded"],TRIGGERED_FIELDS:lE.qr.BUSINESS,ATTRIBUTION:[["originatingBranchCode","costCenterCode"],["primaryOfficerNumber","secondaryOfficerNumber"],["tertiaryOfficerNumber","fourthOfficerNumber"],["fifthOfficerNumber"]],PROFILE_FIELDS:[["legalName","taxId"],["dateEstablished","websiteUrl"],"type","registrationCountry","detailedBusinessDescription","phoneFax","phonePrimary","emailPrimary"],ADDRESS_FIELDS:lE.jv,ADDITIONAL_ADDRESS_FIELDS:["preferredBranch"],OPERATIONS_FIELDS:["hasChangedNameInLast12Months","isStartupBusiness","naicsCode","numberOfEmployees","numberOfBusinessLocations","hasForeignBusinessLocations","annualSales","sourcesOfRevenueList","riskyBusinessActivitiesList","riskyBusinessTypesList","hasAtmsOnSite","isFinancialInstitution","isRegisteredInStateWhereApplyingForNewAccount","isMarijuanaRelatedBusiness","isCbdRelatedBusiness","isHempRelatedBusiness","involvedIndirectlyInMarijuanaTradeDescription","isInvolvedInDigitalCurrency","doesExpectRevenueFromInternetGambling","isMoneyServiceBusiness","isForeignConsulateOrEmbassy","isBusinessLocatedWithinBanksGeographicalArea","hasRelationshipsWithForeignShellBanks","hasPrivateBankingRelationshipsWithPepOrNras","doesThirdPartyPaymentProcessing","isThirdPartyServiceProvider","isOwnedByAForeignEntityOrIndiv
1idual","isForeignBusiness","marketAreasServed","stateBarNumbers","doesExpectToUseSafetyDepositBoxBusiness","businessDepositTransactionTypes"],ADDITIONAL_DETAILS_FIELDS:["majorCustomersAndSuppliersDescription","doesProvideGoodsOrServicesToBank","majorCustomersDescription","majorSuppliersDescription","customerTypeList","isPubliclyTraded","isMajorityOwnedByPublicCompany","isCompanyFinancialMarketUtility","doesTradeFinance","doesOver50PercentOutOfStateTrade","doesOver50PercentInternationalTrade","hasLargeOutstandingLoans","hasLoansSecuredByMarketableSecurities","hasLoansSecuredByCash","isPoliticalAccount","isSubjectToBackupWithholding","moneyServiceBusinessType","customerCode","vipCode","referralSource","segment"],MEMBERSHIP_ELIGIBILITY_FIELDS:["creditUnionEligibilityCriteria"],MEMBERSHIP_ELIGIBILITY_TRIGGERED_FIELDS:["creditUnionOrganizationRegion","creditUnionMembershipSegCode","creditUnionEmployer","creditUnionMemberOfOrganizationName","creditUnionRelatedMemberAccountNumber","creditUnionRelatedMemberFirstName","creditUnionRelatedMemberLastName","creditUnionResidentialRegion","creditUnionMembershipEligibilityReason","schoolName"],EDD_TRIGGERED_FIELDS:lE.iD.BUSINESS.EDD_TRIGGERED_FIELDS},APPLICATION:{UNUSED_SELF_SERVE_FIELDS:["productId","productBranchCode"],TRIGGERED_FIELDS:lE.qr.APPLICATION,EDD_TRIGGERED_FIELDS:lE.iD.APPLICATION.EDD_TRIGGERED_FIELDS},ACCOUNT:{UNUSED_IN_CONSOLE:["productId","productBranchCode"],WET_SIGNATURE_FIELDS:["additionalWetSignaturesNames"],ATTRIBUTION:[["originatingBranchCode","costCenterCode"],["primaryOfficerNumber","secondaryOfficerNumber"],["tertiaryOfficerNumber","fourthOfficerNumber"],["fifthOfficerNumber"]],ADDRESS_FIELDS:lE.jv,CLOSING_DOCUMENTS_AND_SIGNATURES_FIELDS:["closingDate"],INTEREST_EARNED_FIELDS:["interestEarnedPaymentFrequency","interestEarnedPayment","cdRenewal","isRenegotiatedCertificateOfDeposit"],LOAN_DESIRED:["desiredLoanAmountCents","desiredMonthlyPaymentCents","desiredLoanTermMonths","purposeOfLoan","purposeOfLoanList","hasCollateralPreSubmission","totalLoanExposureCents"],LOAN_PRICE_PRE_OFFER:["preOfferLoanAmountCents","preOfferLoanTermMonths","preOfferDecisionNote","preOfferLoanRateType","balloonPaymentAmountCents"],LOAN_PRICE_OFFER:["offerLoanAmountCents","offerLoanTermMonths","loanPricingNote","annualBusinessRevenue","loanRateType","balloonPaymentAmountCents"],LOAN_ACCEPTED:["acceptedLoanAmountCents","acceptedLoanTermMonths","loanTermExtension"],LOAN_PRE_OFFER_REJECTION:["denialReasons","preOfferDecisionNote"],LOAN_REJECTION:["denialReasons","offerDecisionNote"],LOAN_APPROVAL:["riskRating","offerDecisionNote"],CLOSING_ADDITIONAL_INFORMATION:["loanAssumptionPolicy","loanDemandFeature","latePaymentChargeEnabled","loanServicingIntent","negativeAmortizationFeature","partialPaymentsPolicy","liabilityAfterForeclosureProtection","hasEscrowAccount"],CLOSING_COSTS_DETAILS:["loanServicesBorrowerCannotShopFor","loanServicesBorrowerCanShopFor","taxesAndOtherGovernmentFees","loanPrepaids","initialEscrowPaymentsAtClosing","loanOtherCosts"],PROFILE_FIELDS:["accountName","doingBusinessAs","promoCode","referralCode","supplementalNote","ioltaExternalCoreId","hasPositivePayService","effectiveDate","requestedLoanOfficer","accountNumber","accountStatus"],NON_SOLE_PROP_FIELDS:["isControlProngAuthorizedSigner"],TRIGGERED_FIELDS:lE.qr.ACCOUNT,ADDITIONAL_DETAILS_FIELDS:["ocpf","ocpfFilerNumber","politicalRisk","sourceCode","statementCycleCode","xaaAnalysisType","overdraftProtection","charitableDonationGroup"]},TRUST:{ADD_FIELDS:["trustType","isStatutoryTrust","taxId","legalName"],ADDRESS_FIELDS:lE.jv,ADDITIONAL_ADDRESS_FIELDS:["preferredBranch"],ATTRIBUTION:[["originatingBranchCode","costCenterCode"],["primaryOfficerNumber","secondaryOfficerNumber"],["tertiaryOfficerNumber","fourthOfficerNumber"],["fifthOfficerNumber"]],PROFILE_FIELDS:[["legalName","taxId"],"dateEstablished","type","trustType","isStatutoryTrust","registrationCountry","phonePrimary","phoneFax","registrationState","naicsCode"],ADDITIONAL_DETAILS_FIELDS:["idType","accountName","promoCode","supplementalNote","customerCode"],TRIGGERED_FIELDS:lE.qr.TRUST,EDD_TRIGGERED_FIELDS:lE.iD.TRUST.EDD_TRIGGERED_FIELDS,MEMBERSHIP_ELIGIBILITY_FIELDS:["creditUnionEligibilityCriteria"],MEMBERSHIP_ELIGIBILITY_TRIGGERED_FIELDS:["creditUnionOrganizationRegion","creditUnionMembershipSegCode","creditUnionEmployer","creditUnionMemberOfOrganizationName","creditUnionRelatedMemberAccountNumber","creditUnionRelatedMemberFirstName","creditUnionRelatedMemberLastName","creditUnionResidentialRegion","creditUnionMembershipEligibilityReason","schoolName"]},MUNICIPALITY:{ADD_FIELDS:["taxId","legalName"],TRIGGERED_FIELDS:lE.qr.MUNICIPALITY,ATTRIBUTION:[["originatingBranchCode","costCenterCode"],["primaryOfficerNumber","secondaryOfficerNumber"],["tertiaryOfficerNumber","fourthOfficerNumber"],["fifthOfficerNumber"]],PROFILE_FIELDS:[["legalName","taxId"],["dateEstablished","websiteUrl"],"municipalityType","governmentOrganizationType","phonePrimary","detailedMunicipalityDescription","governmentAccountId","naicsCode","emailPrimary","registrationCountry"],ADDRESS_FIELDS:lE.jv,ADDITIONAL_ADDRESS_FIELDS:["preferredBranch"],OPERATIONS_FIELDS:["isNonProfit","riskyBusinessTypesList","isMarijuanaRelatedBusiness","isCbdRelatedBusiness","isHempRelatedBusiness","doesExpectRevenueFromInternetGambling","isForeignConsulateOrEmbassy"],ADDITIONAL_DETAILS_FIELDS:["customerCode"],MEMBERSHIP_ELIGIBILITY_FIELDS:["creditUnionEligibilityCriteria"],MEMBERSHIP_ELIGIBILITY_TRIGGERED_FIELDS:["creditUnionOrganizationRegion","creditUnionMembershipSegCode"]},ESTATE:{ADD_FIELDS:["legalName","taxId","decedentFullName"],ATTRIBUTION:[["originatingBranchCode","costCenterCode"],["primaryOfficerNumber","secondaryOfficerNumber"],["tertiaryOfficerNumber","fourthOfficerNumber"],["fifthOfficerNumber"]],PROFILE_FIELDS:[["legalName","taxId"],"dateEstablished","decedentFullName","decedentDateOfBirth","phonePrimary","phoneFax","registrationCountry","registrationState","taxIdType","naicsCode"],ADDRESS_FIELDS:lE.jv,ADDITIONAL_ADDRESS_FIELDS:["preferredBranch"],ADDITIONAL_DETAILS_FIELDS:["idType","customerCode"],TRIGGERED_FIELDS:lE.qr.ESTATE,MEMBERSHIP_ELIGIBILITY_FIELDS:["creditUnionEligibilityCriteria"],MEMBERSHIP_ELIGIBILITY_TRIGGERED_FIELDS:["creditUnionOrganizationRegion","creditUnionMembershipSegCode","creditUnionMembershipEligibilityReason"]},BENEFICIARY:{PROFILE_FIELDS:[["firstName","lastName"],"legalName",["dateOfBirth","relationshipToCustomer"],["gender"],["phoneNumber","phoneMobile"],["emailPrimary"],["taxId"]],ADDRESS_FIELDS:lE.jv,ALLOCATION:["percentage"]},RATE:{FIELDS:["negotiableRateNote"]},INDICATION_OF_INTEREST:{FIELDS:["cardPrimaryAccountNumber","cardPinOffset",["originatingBranchCode","costCenterCode"],["primaryOfficerNumber","secondaryOfficerNumber"],["tertiaryOfficerNumber","fourthOfficerNumber"],["fifthOfficerNumber"]]},PLAN:{FIELDS:["decedentFields"],DECEDENT_FIELDS:[["firstName","middleName","lastName"],["dateOfBirth","dateOfDeath"],"taxId"],SPOUSAL_DISTRIBUTION:["isSpousalIra"]},FUNDING:{},COLLATERAL:{TRIGGERED_FIELDS:lE.qr.COLLATERAL,FIELDS:["type"],ADDRESS_FIELDS:lE.jv,LOOKUP_FIELDS:lE.qr.COLLATERAL_LOOKUP_FIELDS}}.PERSON.ORGANIZATION_RELATIONSHIP_FIELDS,...lE.qr.ORGANIZATION_RELATIONSHIP];function om(e){var n;
1let{config:i,applicationType:t,accountInfo:l,organization:o,originatingExperience:a,ownershipCollectionCanBeDisabled:r}=e;if(!r||(null==o?void 0:o.type)==="trust")return!0;let d={accountInfo:l,applicationType:t,kycEvaluationTags:[],isTrust:!1,isCreditUnionMember:!1,role:void 0,isResidentAlien:!1,isControlProngAuthorizedSigner:!1,isMissingTaxId:!1,originatingExperience:a,isNonresidentAlien:!1,contextOrganizations:o?[{data:o,accountRoles:o.accountRoles}]:[],skippedPersonFields:[],isAddingJointOwner:!1,hasUsAddress:null},s=(0,tT.H)(d,i);return n=(0,iW.cw)({entityType:"person",scopes:s,fields:i.fields}),!!op.filter(e=>{let i=n[e];return(null==i?void 0:i.requirement)!=="disabled"}).length}let oh=(e,n)=>{let i=[...Object.values(e)].sort((e,n)=>Array.isArray(e)&&!Array.isArray(n)||e.ref&&!n.ref?-1:Array.isArray(n)&&!Array.isArray(e)||!e.ref&&n.ref?1:0)[0],t=(null==i?void 0:i.message)||"Please fix missing or invalid fields before continuing";(0,F.A)({submitCount:n,isValid:!Object.keys(e).length,message:t,hasScrollToError:Array.isArray(i)||!!(null==i?void 0:i.ref)})};var ov=i(36671);let{animations:{rawSpeeds:{default:og}}}=eJ.Ay,of={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0},exited:{opacity:0},unmounted:{opacity:0}},oy=e=>{let{isOpen:n,children:i,duration:t=og,mountOnEnter:o=!1,unmountOnExit:a=!1}=e;return(0,l.Y)(e$.Ay,{in:n,appear:!0,timeout:t,mountOnEnter:o,unmountOnExit:a,children:e=>(0,l.Y)("div",{style:{transition:"opacity ".concat(t,"ms ease-in-out"),opacity:0,...of[e]},children:i})})},oI=e=>{var n,i,t,o,a,r,d,s,c,u,p;let{person:m,userId:h,onEditClick:v,isEditable:g,getPersonTaxId:f,hasRelationshipError:y,personTags:I,isNestedCard:A=!1,isViewable:b,name:C,onViewClick:S,children:w,...x}=e,F=I||(e=>e.isSoleProprietor?[e.isSoleProprietor&&"Sole Proprietor",e.isOwnershipProng&&"Owner"].filter(Boolean):[e.isControlProng&&"Control Prong",e.isOwnershipProng&&"Owner"].filter(Boolean))(m),Y=(0,D.t)(),{fields:T}=(0,nn.A)({entityType:"person"}),k=(0,eL.FF)("LOAN-1356-protected-party-checks"),{protectedPartyTypes:P}=m,O=m?(0,nt.Vd)({addressData:m.rawFields,fields:T}):[],R=m.id===h||!Y.experiences.selfServe.enhancedTaxIdMasking,L=[[null==T||null==(n=T.title)?void 0:n.displayLabel,m.title],[null==T||null==(i=T.type)?void 0:i.displayLabel,m.type&&(0,E.kK)({fieldValue:m.type,fieldConfig:T.type})],[null==T||null==(t=T.ownershipPercentage)?void 0:t.displayLabel,m.isOwnershipProng&&m.ownershipPercentage?"".concat(m.ownershipPercentage,"%"):void 0],[null==(o=T.phoneMobile)?void 0:o.displayLabel,m.phoneMobile&&(0,eN.n4)(m.phoneMobile)],[null==(a=T.emailPrimary)?void 0:a.displayLabel,m.emailPrimary],[null==(r=T.emailSecondary)?void 0:r.displayLabel,m.emailSecondary],[null==(d=T.dateOfBirth)?void 0:d.displayLabel,m.dateOfBirth&&(0,eY.wV)(m.dateOfBirth,{dateFormat:eY.Kn.LONG_MONTH_DAY_YEAR})],[null==(s=T.taxId)?void 0:s.displayLabel,(null==m?void 0:m.taxIdLastFour)&&(0,l.Y)(e8.A,{getTaxId:R?f&&(()=>f(m.id)):void 0,taxIdLastFour:m.taxIdLastFour},"taxId")],...m.usResidencyStatus?[[null==(c=T.usResidencyStatus)?void 0:c.displayLabel,(0,E.kK)({fieldValue:m.usResidencyStatus,fieldConfig:T.usResidencyStatus})]]:[[]],...O.map(e=>{var n;return[null==(n=T["address".concat(null==e?void 0:e.addressType)])?void 0:n.displayLabel,(0,nt.$P)(er()(e,"addressType"))]}),...k&&P?[[null==(u=T.isEmployee)?void 0:u.displayLabel,P.includes("employee")?"Yes":"No"],[null==(p=T.isInsider)?void 0:p.displayLabel,P.includes("insider")?"Yes":"No"]]:[]];return(0,l.Y)(ii,{isEditable:g,onEditClick:v,isViewable:b,onViewClick:S,name:C||(0,J.L)(m),subtitle:F.join(", "),variant:A?"default":"grey",isKeyValueTableRightAligned:!0,attributes:L,hasError:y,isNestedCard:A,...x,children:w},m.id)};var oA=i(95286),ob=i(21632),oC=i.n(ob),oS=i(49438);let ow=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Control Prong";return e?i=>i?"".concat(e.firstName?"".concat((0,J.L)(e)," is already designated as the ").concat(n,". "):"","Only one person may be designated as having control over the company's finances."):!1===i?void 0:"This field is required":e=>e||!1===e?void 0:"This field is required"},ox={fieldsContainer:e=>{let{colors:n}=e;return{border:"1px solid ".concat(n.grey3),borderRadius:4,marginBottom:24,padding:"24px 16px 16px",background:"white"}},header:{marginBottom:24},title:{display:"flex"},icon:e=>{let{colors:n}=e;return{color:n.brand.secondary,width:24,height:24,marginRight:12}},titleText:e=>{let{fontScales:n}=e;return{...n.large}},headerSubtitle:e=>{let{fontScales:n,colors:i}=e;return{color:i.grey9,...n.small,marginTop:6}},removeButton:{marginTop:5}},oF=oS.A.user,oY=e=>{var n,i,t;let{person:o,savedPersons:a,onSave:r,onRemove:d,isLoading:s,formSectionName:c,ownershipChangesEnabled:u,businessHasControlProng:p,businessIsNonProfit:m,businessIsPubliclyTraded:h,allowOwnership:g,isControlProngAuthorizedSigner:f,getPersonTaxId:y,applicationType:I,originatingExperience:A,personsToValidate:b,setPersonsToValidate:C,organizationExistsInCore:
1x,organizationType:T,role:E,kycEvaluationTags:k,applicationFields:P,accounts:O}=e,{getValues:R,setError:L,clearErrors:N,setTouched:B,setValue:M,trigger:z,watch:V,formState:{errors:_}}=(0,S.xW)(),U=(0,D.t)(),q=null!=(t=(0,eL.FF)("APP-1758-no-pii-enabled"))&&t,H=!!(null==(i=U.mantlFeatures.accountOpening)||null==(n=i.nonControlProngBusinessApplicant)?void 0:n.enabled),[K,j]=(0,v.useState)(0),W=e=>"".concat(c,".").concat(e),Q=(0,D.t)(),J=T===nr.VH.SOLE_PROPRIETORSHIP,Z=(0,eL.FF)("APP-2192-allow-unsynced-rels-enforceBusinessOwnership"),X=(0,eL.FF)("LOAN-1356-protected-party-checks"),ei=(0,G.Pc)(Q,!!Z),et=V(W("id")),el=et&&(null==a?void 0:a.find(e=>e.id===et)),eo=oC()(_,c),ea=V(W("isControlProng")),er=V(W("isOwnershipProng")),ed=V(W("isSoleProprietor")),es=V(W("taxId")),ec=V(W("hasOrganizationRelationship")),eu=null==b?void 0:b.find(e=>(e.isControlProng||e.isSoleProprietor)&&e.id!==et);(0,F.A)({submitCount:K,isValid:!eo,message:"Please fix missing or invalid fields before saving this person"});let{existsInCore:ep,isCurrentUser:em,isCreditUnionMember:eh,coreSyncedFields:ev}=o,eg=H&&!J&&!x&&["businessDepositCreateAccount","createAccount"].includes(I),ef=!J&&(eg||u&&((null==el?void 0:el.isControlProng)||!p)),ey=g&&!m&&!J,eI=async()=>{await z();let e=oC()(_,c);if(j(K+1),e){B(c,e),e.emails&&Array.isArray(e.emails)&&e.emails.forEach((e,n)=>{e&&"object"==typeof e&&Object.keys(e).forEach(e=>{B("".concat(c,".emails.").concat(n,".").concat(e),!0)})});return}let{persons:n,applicant:i}=R(),t=[...(null==n?void 0:n.map(e=>({...e,emails:null==e?void 0:e.emails})))||[],...i?[{...i,emails:null==i?void 0:i.emails}]:[]],l=[...null==t?void 0:t.filter(e=>e.id===et),...b.filter(e=>(e.id||e.taxId)!==(e.id?et:es))];if(er){let e=(e=>null==e?void 0:e.reduce((e,n)=>{var i;return e+Number(null!=(i=n.ownershipPercentage)?i:0)},0))(l)>100?"The total ownership percentage cannot exceed 100%. Please update one or multiple owners before continuing.":null;if(e)return void L(W("ownershipPercentage"),{message:e});null==t||t.forEach((e,n)=>{e.isOwnershipProng&&N("persons.".concat(n,".ownershipPercentage"))})}return C(l),r()};(0,v.useEffect)(()=>{er||M(W("ownershipPercentage"),"")},[er]);let eA=ei&&!ea&&g&&"applicant"!==c;(0,v.useEffect)(()=>{eA&&M(W("isOwnershipProng"),!0)},[eA]),(0,v.useEffect)(()=>{!1===ec&&(M(W("isControlProng"),null),M(W("isOwnershipProng"),null),M(W("isSoleProprietor"),null))},[ec]),(0,v.useEffect)(()=>{m&&M(W("isOwnershipProng"),!1)},[m]),(0,v.useEffect)(()=>{T===nr.VH.SOLE_PROPRIETORSHIP&&(M(W("isControlProng"),null),M(W("isOwnershipProng"),null)),T&&T!==nr.VH.SOLE_PROPRIETORSHIP&&M(W("isSoleProprietor"),null)},[T]);let eb=em||!U.experiences.selfServe.enhancedTaxIdMasking,eC=null==O?void 0:O.map(e=>({productId:e.productId,accountVariant:e.accountVariant})),eS=!T||null==O||!O.length||om({organization:{type:T,isPubliclyTraded:!!h,isNonProfit:!!m},config:Q,applicationType:I,accountInfo:eC,ownershipCollectionCanBeDisabled:q,originatingExperience:A}),ew=!ei||ea||ed||er;return(0,l.Y)("div",{className:"person-field-collection",children:(0,l.Y)(en.A,{applicationFields:P,accountFields:O,personId:o.id,namePrefix:c,applicationType:I,originatingExperience:A,coreSyncedFields:ev,isCreditUnionMember:eh,isControlProng:ea,isOwnershipProng:er,isSoleProprietor:ed,isControlProngAuthorizedSigner:f,getTaxId:eb?()=>y(null==el?void 0:el.id):void 0,taxIdLastFour:null==el?void 0:el.taxIdLastFour,isMissingTaxId:(null==o?void 0:o.hasTaxId)===!1,organizationType:T,businessIsPubliclyTraded:h,businessIsNonProfit:m,role:"significantParty"===E&&ea?"controlProng":E,kycEvaluationTags:k,systemRequiredFields:["emailPrimary"],children:(0,l.FD)("div",{css:ox.fieldsContainer,children:[(0,l.FD)("div",{css:ox.header,children:[(0,l.FD)("div",{css:ox.title,children:[(0,l.Y)(oF,{css:ox.icon}),(0,l.Y)("div",{css:ox.titleText,children:em?"Your Information":"".concat(o.isOwnershipProng&&u?"Owner":"Person"," Information")})]}),!em&&u&&(0,l.Y)("div",{css:ox.headerSubtitle,children:"Additional people added to the application will be assumed to own 25% or more of the company."})]}),(0,l.Y)(ee.A,{title:"Basic Information",fieldIds:$.A.PERSON.BASIC_INFO_FIELDS,isFieldGroup:!0}),(0,l.Y)(ee.A,{title:"Verify Residency",fieldIds:$.A.PERSON.RESIDENCY_FIELDS,isFieldGroup:!0}),(0,l.Y)(lM,{personOrBusiness:o}),(0,l.Y)(ee.A,{title:"Verify Identity",fieldIds:[...$.A.PERSON.IDENTITY_FIELDS,...$.A.PERSON.DEMOGRAPHICS_FIELDS,...$.A.PERSON.EMPLOYMENT_FIELDS,...X?$.A.PERSON.PROTECTED_PARTY_FIELDS:[],...$.A.PERSON.SOURCES_OF_INCOME_FIELDS,...$.A.PERSON.ADDITIONAL_IDENTITY_FIELDS],isFieldGroup:!0}),!x&&eS&&(0,l.FD)(lO.A,{title:"Business Role",children:[ef&&(0,l.Y)(Y.A,{fieldId:"isControlProng",validationFn:ow(eu)}),(0,l.Y)(Y.A,{fieldId:"isSoleProprietor",validationFn:ow(eu,"Sole Proprietor")}),ey&&(0,l.Y)(Y.A,{fieldId:"isOwnershipProng",isHidden:eA}),ew&&(0,l.FD)(l.FK,{children:[(0,l.Y)(Y.A,{fieldId:"type"}),(0,l.Y)(Y.A,{fieldId:"title"})]})]}),(0,l.Y)(ee.A,{title:"Additional Details",fieldIds:$.A.PERSON.ADDITIONAL_QUESTIONS_FIELDS}),(0,l.Y)(lO.A,{children:(0,l.Y)("div",{"data-uid":"person-form-button",children:(0,l.Y)(w.A,{isLoading:s,isFull:!0,type:"button",theme:"outline",onClick:eI,children:"Save Person"})})}),!em&&!ep&&(0,l.Y)("div",{css:ox.removeButton,children:(0,l.Y)(w.A,{isFull:!0,type:"button",onClick:()=>{C(b.filter(e=>e.id!==et)),d()},theme:"link",children:"Remove"})})]})})})}
1,oT={sectionHeading:e=>{let{breakpoints:n}=e;return{fontSize:22,margin:"0px 0px 20px",[n.medium]:{margin:"0px 17px 20px"}}}},{animations:{rawSpeeds:{default:oD}}}=eJ.Ay,oE=e=>{var n,i,t,o,a,r;let{item:d={},nameGenerator:s,arrayHelpers:c,index:u=0,id:p,onItemSubmit:m,isDisabled:h,editPersonsOnLoad:g,scrollToPerson:f,isLoading:y,setIsLoading:I,onConfirmRemove:A,containerRefs:b,businessIsNonProfit:C,businessIsPubliclyTraded:w,allowOwnership:x,setRemoveAndScroll:F,getPersonTaxId:Y,userId:T,errorIndices:E,setErrorIndices:k,organizationExistsInCore:P,savedPersons:O,newAccountRelationshipData:R,personKycSnapshot:L,accounts:N,applicationFields:B,...M}=e,z=!!d.isPiiHidden,[V,_]=(0,v.useState)(!z&&(!d.id||Array.isArray(g)&&g.includes(d.id))),[U,q]=(0,v.useState)(!1),[H,K]=(0,v.useState)(!1),j=(0,ir.L$)(),W=(0,ir.L$)(),G=!!(null==(t=(0,D.t)().mantlFeatures)||null==(i=t.accountOpening)||null==(n=i.nonControlProngBusinessApplicant)?void 0:n.enabled),$=null==b?void 0:b.current[u],{setValue:Q,watch:J,setError:Z,clearErrors:X}=(0,S.xW)(),ee=()=>J(s()),en=!!J(s("id")),ei=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return(0,oA.V)($,{behavior:e?"smooth":"auto"})},et=async e=>{I(!0);let n=ee(),i=null==n?void 0:n.emails,t={...n,...i&&(null==i?void 0:i.length)&&{emails:i}},l=await m(t,e);H&&k(E.filter(e=>e!==u)),I(!1),l&&(Q(s(),{...n,...l,taxId:n.taxId}),ei(),W(()=>{_(!1)},700))},el=()=>{X(s()),X("isEditing"),(0,oA.V)(null==b?void 0:b.current[u],void 0,120),W(()=>q(!0),700),j(()=>c.remove(u),700+oD)};(0,v.useEffect)(()=>{K(null==E?void 0:E.includes(u))},[null==E?void 0:E.length]),(0,v.useEffect)(()=>{if(f&&f===d.id){let e=setTimeout(()=>{ei(!1)});return()=>clearTimeout(e)}},[f,$]),(0,v.useEffect)(()=>{V?Z("isEditing",{type:"required",message:"Unsaved person(s)"}):X("isEditing")},[V]);let eo=p?O.find(e=>e.id===p):O[u];return(0,l.Y)("div",{ref:e=>{b&&(b.current[u]=e)},children:(0,l.FD)(oy,{isOpen:!U,children:[(0,l.Y)(oy,{isOpen:V,mountOnEnter:!0,unmountOnExit:!0,children:(0,l.Y)(oY,{person:d,userId:T,savedPersons:O,formSectionName:s(),onRemove:()=>{en?(F(()=>el),A(ee())):el()},onSave:et,isLoading:y,businessIsNonProfit:C,businessIsPubliclyTraded:w,allowOwnership:x,getPersonTaxId:Y,applicationFields:B,organizationExistsInCore:P,accounts:N,role:null==R||null==(o=R.find(e=>e.personId===d.id))?void 0:o.role,kycEvaluationTags:(null==L||null==(a=L.find(e=>(null==e?void 0:e.personId)===(null==d?void 0:d.id)))?void 0:a.tags)||[],...M})}),!V&&(0,l.FD)(l.FK,{children:[!G&&(e=>0===e?(0,l.Y)("h3",{css:oT.sectionHeading,children:"Your Information"}):1===e?(0,l.Y)("h3",{css:oT.sectionHeading,children:"Additional People"}):(0,l.Y)(l.FK,{}))(u),(0,l.Y)(oI,{person:{...eo,dateOfBirth:null==eo||null==(r=eo.rawFields)?void 0:r.dateOfBirth},isEditable:!h&&!z,onEditClick:z?void 0:()=>_(!0),getPersonTaxId:d.id!==T&&d.existsInCore?void 0:Y,hasRelationshipError:H,userId:T})]})]})})},ok=e=>{let{savedPersons:n,name:i,onSubmit:t,onRemove:o,isDisabled:a=!1,editPersonsOnLoad:r,scrollToPerson:d,organizationType:s,businessIsPubliclyTraded:c,businessIsNonProfit:u,applicationType:p,originatingExperience:m,getPersonTaxId:h,isControlProngAuthorizedSigner:g,organizationTaxIdType:f,userId:y,errorIndices:I,setErrorIndices:A,personsToValidate:b,organizationExistsInCore:C,setPersonsToValidate:S,businessHasControlProng:w,productId:x,accountVariant:F,newAccountRelationshipD
1ata:Y,personKycSnapshot:T,applicationFields:E,accounts:k}=e,[P,O]=(0,v.useState)(!1),R=(0,v.useRef)([]),[L,N]=(0,v.useState)(null),[B,M]=(0,v.useState)(),z=()=>N(null),V=(0,D.t)(),_=async()=>{O(!0);try{await o(L),null==B||B(),N(null)}catch(e){console.error("cannot update user",e)}finally{O(!1)}},U=async e=>{N(e)},q=s===nr.VH.SOLE_PROPRIETORSHIP,H=(0,eL.FF)("APP-2192-allow-unsynced-rels-enforceBusinessOwnership"),K=(0,G.Pc)(V,!!H),j="business"===(0,G.KG)(s)&&!u,W=f===nr.LC.SSN||K&&!j;return(0,l.FD)(l.FK,{children:[(0,l.Y)(ov.A,{max:W?1:1/0,name:i,addButtonText:"Add person",itemRenderer:oE,onItemSubmit:t,onItemRemove:o,onConfirmRemove:U,isDisabled:a,editPersonsOnLoad:r,scrollToPerson:d,isLoading:P,setIsLoading:O,ownershipChangesEnabled:"businessDepositCreateAccount"!==p&&!q,businessHasControlProng:w,businessIsSoleProprietorship:q,businessIsNonProfit:u,allowOwnership:j,containerRefs:R,setRemoveAndScroll:M,getPersonTaxId:h,savedPersons:n,applicationType:p,originatingExperience:m,isControlProngAuthorizedSigner:g,userId:y,errorIndices:I,setErrorIndices:A,personsToValidate:b,setPersonsToValidate:S,organizationExistsInCore:C,showFormInfoBox:!0,productId:x,accountVariant:F,organizationType:s,businessIsPubliclyTraded:c,newAccountRelationshipD
1ata:Y,personKycSnapshot:T,applicationFields:E,accounts:k}),(0,l.Y)(i9.A,{isOpen:!!L,buttonText:"Remove Person",onClose:z,onConfirm:_,onCancel:z,onClickAway:z,isLoading:P,heading:"Remove Person",subheading:"Are you sure that you want to remove ".concat((null==L?void 0:L.firstName)&&(null==L?void 0:L.lastName)?"".concat((0,J.L)(L)):"this person"," from this application?"),icon:"illustration-people"})]})},oP=e=>{var n,i,t,o;let{application:a,onPersonSubmit:r,onPersonRemove:d,editPersonsOnLoad:s,scrollToPerson:c,organizationType:u,savedValues:p,getPersonTaxId:m,organizationTaxIdType:h,userId:g,setRelationshipErrorIndices:f,errorIndices:y}=e,{formState:{errors:I,isSubmitting:A,submitCount:b}}=(0,S.xW)(),{persons:C}=p,[F,Y]=(0,v.useState)(C);return oh(I,b),(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{heading:"Tell us about the people at your company",subheading:"Be sure to list all beneficial owners (i.e. anyone who owns 25% or more of the business), and designate who primarily controls the financial decisions of the business (i.e. the main contact person for the financial institution)."}),(0,l.Y)(ei.A,{children:(0,l.Y)(ok,{productId:(null==a||null==(n=a.fields)?void 0:n.productId)||null,accountVariant:(null==a||null==(i=a.fields)?void 0:i.accountVariant)||null,newAccountRelationshipD
1ata:null==a||null==(t=a.fields)?void 0:t.newAccountRelationshipData,savedPersons:C,name:"persons",onSubmit:r,onRemove:d,editPersonsOnLoad:s,scrollToPerson:c,organizationType:u,organizationTaxIdType:h,applicationType:"businessUpdatePersons",originatingExperience:null!=(o=null==a?void 0:a.originatingExperience)?o:"selfServe",getPersonTaxId:m,userId:g,errorIndices:y,setErrorIndices:f,personsToValidate:F,setPersonsToValidate:Y,businessHasControlProng:null==C?void 0:C.some(e=>e.isControlProng),personKycSnapshot:null==a?void 0:a.personKycSnapshot})}),(0,l.Y)(ei.A,{children:(0,l.Y)(w.A,{type:"submit",isFull:!0,isLoading:A,children:"Continue"})})]})},oO=e=>{let{application:n,persons:i,userId:t,onSubmit:o,onPersonSubmit:a,onFieldBlur:r,...d}=e,[s,c]=(0,v.useState)([]),u={persons:null==i?void 0:i.map(e=>(0,E.KE)(e,t))};return(0,l.Y)(y.A,{initialValues:u,onFieldBlur:r,onSubmit:()=>o(i),children:(0,l.Y)(oP,{application:n,onPersonSubmit:e=>a((0,E.qP)(e,!0)),savedValues:u,userId:t,errorIndices:s,setRelationshipErrorIndices:c,...d})})},oR=e=>{let{productName:n,organization:i,person:t,kycEvaluationTags:o,getPersonTaxId:a,originatingExperience:r}=e,{formState:{submitCount:d,isSubmitting:s,isValid:c},register:u}=(0,S.xW)();(0,F.A)({submitCount:d,isValid:c,message:"Please fix missing or invalid fields before continuing."});let p=(0,eL.FF)("LOAN-1356-protected-party-checks"),m=null==i?void 0:i.legalName;return(0,l.Y)(en.A,{applicationFields:{},personId:t.id,applicationType:"businessDepositAddAuthorizedSigner",originatingExperience:r,coreSyncedFields:t.coreSyncedFields,isCreditUnionMember:!!t.externalCoreMembershipId,namePrefix:"person",taxIdLastFour:t.taxIdLastFour,getTaxId:()=>a(t.id),isMissingTaxId:(null==t?void 0:t.hasTaxId)===!1,kycEvaluationTags:o,systemRequiredFields:["emailPrimary"],children:(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{heading:"You've been invited!",subheading:(0,l.FD)(l.FK,{children:["You've been invited to join ",m,"'s"," ",(0,l.Y)(tP.yN,{children:n})," account. Please fill out all of the details below to complete your application."]})}),(0,l.Y)("input",{...u("person.id"),type:"hidden"}),(0,l.Y)(ee.A,{title:"Your Information",fieldIds:$.A.PERSON.BASIC_INFO_FIELDS,isFieldGroup:!0}),(0,l.Y)(ee.A,{title:"Verify Residency",fieldIds:$.A.PERSON.RESIDENCY_FIELDS,isFieldGroup:!0}),(0,l.Y)(ee.A,{title:"Verify Identity",fieldIds:[...$.A.PERSON.IDENTITY_FIELDS,...$.A.PERSON.DEMOGRAPHICS_FIELDS,...$.A.PERSON.EMPLOYMENT_FIELDS,...p?$.A.PERSON.PROTECTED_PARTY_FIELDS:[],...$.A.PERSON.SOURCES_OF_INCOME_FIELDS,...$.A.PERSON.ADDITIONAL_IDENTITY_FIELDS],isFieldGroup:!0}),(0,l.Y)(ee.A,{fieldIds:$.A.PERSON.ADDRESS_FIELDS,isFieldGroup:!0}),(0,l.Y)(ee.A,{title:"Additional Details",fieldIds:$.A.PERSON.ADDITIONAL_QUESTIONS_FIELDS}),(0,l.Y)(ei.A,{children:(0,l.Y)(w.A,{type:"submit",isFull:!0,isLoading:s,children:"Continue"})})]})})},oL=e=>{var n,i,t;let{productName:o,application:a,onSubmit:r,onFieldBlur:d,getPersonTaxId:s}=e,c=null==a?void 0:a.organization,u=null==a?void 0:a.persons[0];return(0,Q.Z1)(u,"Missing person"),(0,l.Y)(y.A,{initialValues:{person:(0,E.tF)(u)},onFieldBlur:d,onSubmit:e=>r((0,E.JC)(e.person)),children:(0,l.Y)(oR,{organization:c,productName:o,person:u,getPersonTaxId:s,kycEvaluationTags:(null==a||null==(i=a.personKycSnapshot)||null==(n=i.find(e=>(null==e?void 0:e.personId)===(null==u?void 0:u.id)))?void 0:n.tags)||[],originatingExperience:null!=(t=null==a?void 0:a.originatingExperience)?t:"selfServe"})})};var oN=i(54418);let oB={container:(e,n)=>{let{colors:i}=e;return{display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:i.grey4,borderRadius:n,marginBottom:"1rem",padding:"1.5rem"}},address:{fontSize:"0.75rem",fontWeight:700,margin:0,lineHeight:"1.125rem"}},oM=e=>{let{addressData:n,icon:i,onClickEdit:t}=e,o=(0,eL.FF)("PART-1058-enable-new-self-serve-component-designs"),a=(0,nt.Vd)({addressData:n,addressTypes:["Primary"]})[0];return(0,l.FD)("div",{css:e=>oB.container(e,o?(0,n8.N)(e.borderShape):8),children:[(0,l.Y)("p",{css:oB.address,children:(0,nt.$P)(a)}),(0,l.Y)(eH.A,{name:i,size:"medium",onClick:t})]})},oz={container:{padding:"16px 24px 24px"},heading:{fontSize:18,fontWeight:700,marginBottom:16},subheading:{marginBottom:16}},oV=e=>{let{isOpen:n,onClose:i,onContinue:t,customerType:o,addressNotSupportedModalHeader:a,addressNotSupportedModalBody:r}=e,{getValues:d}=(0,S.xW)(),s=(e=>{var n,i,t,l,o,a,r,d,s,c,u,p;let{person:m,organization:h}=e;return m?{addressPrimaryCity:null!=(n=m.addressPrimaryCity)?n:void 0,addressPrimaryCountry:null!=(i=m.addressPrimaryCountry)?i:void 0,addressPrimaryLine1:null!=(t=m.addressPrimaryLine1)?t:void 0,addressPrimaryLine2:null!=(l=m.addressPrimaryLine2)?l:void 0,addressPrimaryState:null!=(o=m.addressPrimaryState)?o:void 0,addressPrimaryZip:null!=(a=m.addressPrimaryZip)?a:void 0}:h?{addressPrimaryCity:null!=(r=h.addressPrimaryCity)?r:void 0,addressPrimaryCountry:null!=(d=h.addressPrimaryCountry)?d:void 0,addressPrimaryLine1:null!=(s=h.addressPrimaryLine1)?s:void 0,addressPrimaryLine2:null!=(c=h.addressPrimaryLine2)?c:void 0,addressPrimaryState:null!=(u=h.addressPrimaryState)?u:void 0,addressPrimaryZip:null!=(p=h.addressPrimaryZip)?p:void 0}:null})(d()),{isLoading:c,onClick:u}=(0,iB.A)({onClick:()=>t(d())});return(0,l.Y)(nh.A,{isOpen:n,onClose:i,onClickAway:i,children:(0,l.FD)("div",{css:oz.container,children:[(0,l.Y)(np.A.H3,{css:oz.heading,children:a||"Address Not in Supported Area"}),(0,l.Y)("p",{css:oz.subheading,children:r||"The".concat("business"===o?" business":""," address you entered is not within our supported service area. Please confirm the address you have entered is correct and continue. If you are a current customer, please login to continue.")}),!!s&&(0,l.Y)(oM,{addressData:s,icon:"pencil",onClickEdit:i}),(0,l.Y)(w.A,{isFull:!0,name:"continue",onClick:u,isLoading:c,children:"Continue"})]})})};var o_=i(92180),oU=i.n(o_),oq=i(38694);let oH={container:e=>{let{breakpoints:n}=e;return{display:"flex",alignItems:"center",top:0,left:0,width:"100%",height:oq.HEADER_HEIGHT_MOBILE,background:"white",justifyContent:"space-between",zIndex:8888,padding:"0px 5px",[n.medium]:{height:oq.HEADER_HEIGHT_DESKTOP},[n.large]:{background:"transparent",justifyContent:"flex-start",height:"auto",zIndex:1}}},hasArrows:{justifyContent:"space-between"},counter:e=>{let{colors:n}=e;return{color:n.grey9,marginRight:12,display:"flex",alignItems:"center"}}
1,counterIndex:e=>{let{colors:n}=e;return{fontWeight:"normal",color:n.brand.secondary,marginRight:3}},arrowButton:{appearance:"none",border:0,width:56,height:56,background:"url(\"data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.37598 16.376L11.952 7.79998C12.1856 7.56558 12.5656 7.56558 12.7992 7.79918L12.8 7.79998L21.376 16.376' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\") no-repeat center center",transition:"opacity 0.2s",opacity:.6,"&:disabled":{opacity:"0.2"}},arrowButtonDown:{transform:"rotate(180deg)"},heading:{display:"flex",alignItems:"center"}},oK={default:{container:e=>{let{fontScales:n}=e;return{...n.large}},counter:e=>{let{fontScales:n}=e;return{...n.small}},counterIndex:e=>{let{fontScales:n}=e;return{...n.xxlarge}},counterTotal:()=>({transform:"translateY(-6px)"})},sticky:{container:e=>{let{fontScales:n,breakpoints:i}=e;return{...n.default,position:"sticky",margin:"0 -16px 32px",width:"auto",[i.medium]:{marginLeft:"calc(-100vw / 2 + ".concat(i.raw.medium.minWidth,"px / 2 - 40px)"),marginRight:0,width:"100vw"},[i.large]:{display:"none"}}},counter:e=>{let{fontScales:n}=e;return{...n.small}},counterIndex:e=>{let{fontScales:n}=e;return{...n.large}},counterTotal:e=>{let{fontScales:n}=e;return{...n.xxsmall,transform:"translateY(-2px)",fontWeight:400}}}},oj=e=>{var n;let{counter:i,children:t,theme:o="default",onNextClick:a,onPreviousClick:r,hasArrows:d}=e;return(0,l.FD)("div",{css:e=>[oH.container(e),oK[o].container(e),d&&oH.hasArrows],children:[d&&(0,l.Y)("button",{type:"button","aria-label":"Previous Section",css:oH.arrowButton,onClick:r}),(0,l.FD)("div",{css:oH.heading,children:[i&&(0,l.FD)("div",{css:e=>[oH.counter(e),oK[o].counter(e)],children:[(0,l.Y)("span",{css:e=>[oH.counterIndex(e),oK[o].counterIndex(e)],children:"0".concat(i.current)}),(0,l.Y)("span",{css:null==(n=oK[o])?void 0:n.counterTotal,children:" / 0".concat(i.total)})]}),t]}),d&&(0,l.Y)("button",{type:"button","aria-label":"Next Section",css:[oH.arrowButton,oH.arrowButtonDown],onClick:a,disabled:i.current>i.total})]})};var oW=i(89014);let oG=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return!!Object.keys(Array.isArray(n)?C()(e,n):e).length},o$=e=>{let{id:n,errors:i,fieldIds:t,hasErrorOverride:l,icon:o,entityType:a}=e,{onSectionLoad:r,onSectionStateChange:d,hasValidated:s,submitCount:c}=(0,lR.lN)(),u=(0,v.useRef)(null),p=(0,oW.A)({fieldIds:t||[],entityType:a}),m=t?oG(i,p):!!i,h=l||m?"error":"success",g="error"===h?c?"alert":o:"circle-check";return(0,v.useEffect)(()=>{s&&(r({formSection:n,state:h}),u.current=h)},[s]),(0,v.useEffect)(()=>{u.current&&u.current!==h&&(d({formSection:n,state:h}),u.current=h)},[h]),{...e,state:h,iconWithState:g,iconSize:g===o?"default":"small"}};var oQ=i(97444),oJ=i(56094),oZ=i(64720);let oX=e=>"waypoint-".concat(e),o0=e=>(0,oA.V)(oX(e)),o9=e=>{let{sections:n}=e,{setCurrentWaypointId:i,setWaypointSections:t,currentWaypointId:o}=(0,oJ.h)(),[a,r]=(0,v.useState)([]),d=n.find(e=>{let[n]=e;return a.includes(n)});return(0,v.useEffect)(()=>{d?i(d[0]):o||i(n[0][0])},[d]),(0,v.useEffect)(()=>{t(n)},[]),n.map(e=>{let[n,i]=e;return(0,l.Y)(oZ.Y,{topOffset:1,onEnter:e=>r([...a,n]),onLeave:e=>r(a.filter(e=>e!==n)),children:(0,l.Y)("div",{id:oX(n),children:i})},n)})};var o1=i(32732),o2=i.n(o1);let o6=e=>{let{name:n,hasMultiplePersonRelationships:i,onChange:t,onSave:o,...a}=e,[r,d]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[u,p]=(0,v.useState)(!1),m=(0,ir.FT)(i),{setValue:h}=(0,S.xW)(),{onFieldBlur:g}=(0,lR.lN)(),f=async(e,i)=>{null==t||t(e,i),await g({name:n,formUpdate:o2()({},n,e),saveOnBlur:!0}),null==o||o(e,i)},y=async()=>{p(!0);try{await f(nr.VH.SOLE_PROPRIETORSHIP,s)}finally{c(null),d(!1),p(!1)}},I=()=>{h(n,s),c(null),d(!1)};return(0,l.FD)(l.FK,{children:[(0,l.Y)(i9.A,{isOpen:r,buttonText:"Update",onConfirm:y,onCancel:I,onClose:I,isLoading:u,heading:"Are you sure?",subheading:"Switching to a Sole Proprietorship will remove ownership status for anyone who is not the Sole Proprietor."}),(0,l.Y)(nv.A.Dropdown,{name:n,saveOnBlur:!1,ariaLabel:a.label||n,...a,onChange:(e,n)=>{let{previousValue:i}=n;m.current&&e===nr.VH.SOLE_PROPRIETORSHIP?(d(!0),c(i)):f(e,i)}})]})},o5=e=>{var n;let{application:i,getPersonTaxId:t,userId:a}=e;if(!i)return null;let r=null==(n=i.fields)?void 0:n.accounts;return(null==r?void 0:r.length)?(0,l.Y)(l.FK,{children:r.map((e,n)=>{var r;if(!e)return null;
1let d=e.newAccountRelationshipData,s=(0,oN.aV)(d);if(!s.length)return null;let c=s.map(e=>{var n;return null==(n=i.persons)?void 0:n.find(n=>n.id===e)}).filter(Boolean);if(!c.length)return null;let u=null==(r=i.products)?void 0:r.find(n=>n.id===e.productId),p=(null==u?void 0:u.name)?"".concat(u.name):"Account";return(0,l.Y)(V.A,{icon:"wallet",size:"large",title:p,collapsibleContent:(0,l.Y)(l.FK,{children:c.map(n=>(0,l.Y)(oI,{person:n,userId:a,getPersonTaxId:t,isEditable:!1,isViewable:!1,personTags:((e,n,i,t)=>{if(!n||!i||!t)return[];let l=t.filter(n=>(null==n?void 0:n.personId)===e).map(e=>e.role).filter(Boolean).map(e=>{try{var t;return null==(t=(0,o.ei)(n,i,e))?void 0:t.label}catch(e){return null}}).filter(Boolean);return nu()(l)})(n.id,e.accountVariant,u,d)},n.id))}),collapsibleDefaultOpen:!0},(null==e?void 0:e.referenceId)||"account-".concat(n))})}):null},{breakpoints:{raw:{large:{minWidth:o4}}}}=eJ.Ay,o3={hideOnDesktop:e=>{let{breakpoints:n}=e;return{[n.large]:{display:"none"}}},counter:{marginBottom:"1rem",marginLeft:"2rem"},formSection:()=>({marginBottom:96}),intro:e=>{let{breakpoints:n}=e;return{paddingTop:oq.HEADER_HEIGHT_MOBILE,minHeight:"calc(100vh - ".concat(oq.HEADER_HEIGHT_MOBILE+40,"px)"),display:"flex",flexDirection:"column",[n.medium]:{paddingTop:oq.HEADER_HEIGHT_DESKTOP,minHeight:"calc(100vh - ".concat(oq.HEADER_HEIGHT_DESKTOP+40,"px)")}}}},o8=["taxIdType"],o7=()=>"applicant",ae=e=>{var n,i,t,o,a,r,d,s,c,u,p,m,h,g,f,y,I,A,b;let{application:C,onOwnerSubmit:F,onOwnerRemove:T,editOrganizationOnLoad:E,editPersonsOnLoad:P,scrollToPerson:O,savedValues:R,hasMultiplePersonRelationships:L,getPersonTaxId:N,getOrganizationTaxId:B,isControlProngAuthorizedSigner:M,userId:z}=e,_=(0,D.t)(),U=null!=(g=(0,eL.FF)("APP-1758-no-pii-enabled"))&&g,q=(0,eL.FF)("APP-2192-allow-unsynced-rels-enforceBusinessOwnership"),H=!!(null==(t=_.mantlFeatures)||null==(i=t.accountOpening)||null==(n=i.nonControlProngBusinessApplicant)?void 0:n.enabled),K=(0,G.Pc)(_,!!q),j=(0,oN.ic)(null==C||null==(o=C.fields)?void 0:o.accounts),W=(0,eS.rC)(null==C?void 0:C.rawFields),[Q,J]=(0,v.useState)(P),[en,et]=(0,v.useState)([...R.persons||[],...R.applicant?[R.applicant]:[]]),[el,eo]=(0,v.useState)(!1),{currentWaypointIndex:ea,totalWaypoints:er,waypointsAreLoading:ed,currentWaypointId:es}=(0,oJ.h)(),{getValues:ec,setValue:eu,resetField:ep,clearErrors:em,watch:eh,formState:{errors:ev,isSubmitting:eg,submitCount:ef}}=(0,S.xW)(),{persons:ey=[],organization:eI={}}=ec(),eA=(0,ir.FT)(R),{persons:eb,organization:eC,applicant:ew}=R,ex=j&&null!=(f=null==W?void 0:W.filter(e=>"personId"in e&&e.personId&&"authorizedSigner"===e.role).map(e=>e.personId).filter(e=>{let n=eb.find(n=>n.id===e);return!(null==n?void 0:n.isOwnershipProng)}))?f:[],eF=j?eb.filter(e=>!ex.includes(e.id)):eb;(0,v.useEffect)(()=>{if(j&&ex.length>0){let e=ec("persons");(null==e?void 0:e.length)!==eF.length&&eu("persons",eF)}},[j,ex.length,eF]);let eY=(null==ew?void 0:ew.isControlProng)||eb.some(e=>e.isControlProng),eT=()=>{J([]),et(eA.current.persons);let e=ec("persons");null==e||e.forEach((e,n)=>{e.id||ep("persons.".concat(n))}),eu("persons",eA.current.persons)},eD=e=>{eu("organization.taxId",e,{shouldValidate:!0,shouldDirty:!0}),eu("organization.taxIdLastFour","")},eE=()=>eD(""),ek=e=>{eu("organization.legalName",e,{shouldValidate:!0,shouldDirty:!0})};oh(ev,ef);let{existsInCore:eP=!1}=eC,eO=eh("organization.taxIdLastFour"),eR=eh("organization.taxIdType"),eN=eh("organization.type"),eB=eh("organization.isPubliclyTraded"),eM=(null==C||null==(r=C.organizationKycSnapshot)||null==(a=r.find(e=>(null==e?void 0:e.organizationId)===(null==eC?void 0:eC.id)))?void 0:a.tags)||[],ez={applicationFields:null==C?void 0:C.rawFields,namePrefix:"organization",applicationType:"businessDepositCreateAccount",originatingExperience:null!=(y=null==C?void 0:C.originatingExperience)?y:"selfServe",coreSyncedFields:eC.coreSyncedFields,taxIdLastFour:eO,isEIN:"EIN"===eR,getTaxId:B,organizationType:eN||void 0,externalCoreMembershipId:eC.externalCoreMembershipId,kycEvaluationTags:eM,allowlistCategory:eC.allowlistCategory,organizationId:null==eC?void 0:eC.id},{hasAnyEnabledFields:eV}=(0,X.Q)(ez),e_=ey&&!!ey.find(e=>e&&!e.id)||!!ev.isEditing;(0,v.useEffect)(()=>
1{if(E&&window.innerWidth<o4){let e=setTimeout(()=>{o0("businessProfile")});return()=>clearTimeout(e)}},[E]),(0,v.useEffect)(()=>{if(!O)return;let e=O===(null==ew?void 0:ew.id)?"applicantProfile":"ownershipProfile",n=setTimeout(()=>{o0(e)});return()=>clearTimeout(n)},[]);let eU=eI.isNonProfit||"nonProfit"===eI.type,eq=eU?"Organization Profile":"Ownership Profile",eH=(0,l.FD)(X.A,{...ez,children:[(0,l.FD)(l.FK,{children:[(0,l.Y)(Y.A,{fieldId:"type",Component:o6,hasMultiplePersonRelationships:L,onChange:(e,n)=>{n===nr.VH.SOLE_PROPRIETORSHIP&&ek("")},onSave:(e,n)=>{let i=n===nr.VH.SOLE_PROPRIETORSHIP,t=e===nr.VH.SOLE_PROPRIETORSHIP;(i||t)&&eT()},taxIdTypeNote:"We’ll collect your personal tax ID number later",onTaxIdTypeChange:e=>{e===nr.LC.EIN&&eE(),e===nr.LC.SSN&&em("organization.taxId")},onTaxIdTypeSave:()=>{let{legalName:e,taxIdType:n,taxId:i}=eI;if(n===nr.LC.EIN)return void eE();eD(i),ek(e),eT()},disableTriggeredValues:o8}),eR!==nr.LC.SSN&&(0,l.Y)(Y.A,{fieldId:"taxId"}),(0,l.Y)(ee.A,{fieldIds:((e,n)=>{var i;let t=null==(i=n.mantlFeatures.accountOpening.allowSolePropBusinessName)?void 0:i.enabled;return e!==nr.VH.SOLE_PROPRIETORSHIP||t?$.A.BUSINESS.PROFILE_PRIMARY_FIELDS:oU()($.A.BUSINESS.PROFILE_PRIMARY_FIELDS,"legalName")})(eI.type,_),isFieldGroup:!0}),(0,l.Y)(ee.A,{fieldIds:$.A.BUSINESS.PROFILE_ADDITIONAL_FIELDS})]}),(0,l.Y)(lM,{isDisabled:eC.existsInCore,personOrBusiness:eC.rawFields})]}),eK=(0,l.Y)(X.A,{...ez,children:(0,l.Y)(ee.A,{fieldIds:$.A.BUSINESS.OPERATIONS_FIELDS})}),ej=(0,v.useRef)([]),eW=(0,l.Y)(oE,{applicationType:"createAccount",applicationFields:null==C?void 0:C.fields,accounts:null!=(I=null==C||null==(d=C.fields)?void 0:d.accounts)?I:[null==C?void 0:C.fields],originatingExperience:null!=(A=null==C?void 0:C.originatingExperience)?A:"selfServe",item:ew,savedPersons:[ew],personsToValidate:en,setPersonsToValidate:et,getPersonTaxId:N,formSectionName:"applicant",onItemSubmit:F,editPersonsOnLoad:Q,isControlProngAuthorizedSigner:M,organizationTaxIdType:eR,businessHasControlProng:eY,businessIsNonProfit:eU,organizationType:eN,businessIsPubliclyTraded:eB,userId:z,containerRefs:ej,nameGenerator:o7,id:null==ew?void 0:ew.id,isLoading:el,setIsLoading:eo,ownershipChangesEnabled:!!H,allowOwnership:!0,role:null==W||null==(s=W.find(e=>"personId"in e&&e.personId===(null==ew?void 0:ew.id)))?void 0:s.role,organizationExistsInCore:eP,personKycSnapshot:null==C?void 0:C.personKycSnapshot}),eG=(0,l.FD)(l.FK,{children:[j&&(0,l.Y)("div",{css:{marginBottom:16},children:(0,l.Y)(Z.A,{icon:"info-circle",content:"If you'd like to give owner roles to your authorized signers, please contact us."})}),(0,l.Y)(ok,{productId:(null==C||null==(c=C.fields)?void 0:c.productId)||null,accountVariant:(null==C||null==(u=C.fields)?void 0:u.accountVariant)||null,newAccountRelationshipD
1ata:W,savedPersons:eF,personsToValidate:en,setPersonsToValidate:et,name:"persons",onSubmit:F,onRemove:T,isDisabled:eP,organizationExistsInCore:eP,editPersonsOnLoad:Q,businessIsNonProfit:eU,businessIsPubliclyTraded:eB,organizationType:eN,applicationType:"businessDepositCreateAccount",originatingExperience:null!=(b=null==C?void 0:C.originatingExperience)?b:"selfServe",getPersonTaxId:N,isControlProngAuthorizedSigner:M,businessHasControlProng:eY,organizationTaxIdType:eR,userId:z,personKycSnapshot:null==C?void 0:C.personKycSnapshot,applicationFields:null==C?void 0:C.fields,accounts:null==C||null==(p=C.fields)?void 0:p.accounts})]}),e$=(0,l.Y)(o5,{application:C,getPersonTaxId:N,userId:z}),eQ=eV($.A.BUSINESS.ADDITIONAL_QUESTIONS_FIELDS),eJ=eQ&&(0,l.Y)(X.A,{...ez,children:$.A.BUSINESS.ADDITIONAL_QUESTIONS_FIELDS.map(e=>(0,l.Y)(Y.A,{fieldId:e},e))}),eZ=!!C&&om({organization:{...eI,isPubliclyTraded:!!(null==eI||null==(m=eI.rawFields)?void 0:m.isPubliclyTraded)},config:_,applicationType:null==C?void 0:C.type,accountInfo:(0,ne.SP)(C.rawFields),ownershipCollectionCanBeDisabled:U,originatingExperience:C.originatingExperience}),eX=[o$({id:"businessProfile",heading:"Business Profile",subheading:"First, tell us the basics about your business.",icon:"illustration-business",fieldIds:[...oQ.zE,"taxId"],entityType:"business",errors:ev.organization,element:eH}),o$({id:"businessOperations",heading:"Business Operations",subheading:"Help us understand how your business operates.",icon:"illustration-operations",fieldIds:$.A.BUSINESS.OPERATIONS_FIELDS,entityType:"business",errors:ev.organization,element:eK}),o$({id:"applicantProfile",heading:"Applicant Information",subheading:"We'll need some basic information about you.",icon:"illustration-people",entityType:"person",errors:ev.applicant,hasErrorOverride:e_,element:eW,isHidden:!H}),o$({id:"ownershipProfile",heading:eq,subheading:H?"Define the other owners and people related to your business":"Tell us about yourself and the team.",icon:"illustration-people",errors:ev.persons,hasErrorOverride:e_,entityType:"person",element:eG,isHidden:H&&K&&eU&&(null==C?void 0:C.persons.find(e=>e.isControlProng))||!eZ}),o$({id:"authorizedSigners",heading:"Authorized Signers",subheading:"Review Authorized Signers on your Accounts",icon:"illustration-signature",entityType:"person",element:e$,isHidden:!j}),o$({id:"additionalDetails",heading:"Additional Details",subheading:"Let's get a few more details about your business.",icon:"illustration-clipboard",entityType:"business",fieldIds:oQ.t$,errors:ev.organization,element:eJ,isHidden:!eQ})].filter(e=>!e.isHidden),e0=eX.map(e=>[e.id,(0,l.FD)("div",{css:o3.formSection,children:[(0,l.Y)(x.A,{headingTag:"h2",heading:e.heading,subheading:e.subheading,icon:e.icon,theme:"inline",isCentered:!0}),e.element]},e.id)]),e9=e=>{let{hideCounter:n=!1,disableWaypoints:i}=e;return(0,l.FD)("div",{children:[!n&&(0,l.Y)("div",{css:o3.counter,children:(0,l.Y)(oj,{counter:{current:ed?1:ea+1,total:ed?4:er}})}),eX.map(e=>(0,l.Y)(V.A,{title:e.heading,size:"thin",brandColor:"secondaryLight",theme:i||es===e.id?"active":"inactive",icon:e.iconWithState,iconSize:e.iconSize,"data-isimpactedbyonblurbug":"true",onClick:()=>{o0(e.id)}},e.id))]})};return(0,l.Y)(l.FK,{children:(0,l.FD)(k.A,{secondary:(0,l.Y)(e9,{}),children:[(0,l.FD)("div",{id:oX("intro"),children:[(0,l.FD)("div",{css:e=>[o3.intro(e),o3.hideOnDesktop(e)],children:[(0,l.Y)(x.A,{heading:"Let’s get going!",subheading:"To open your new account we’ll need the following details about your business and team",isCentered:!0}),(0,l.Y)(ei.A,{children:(0,l.Y)(e9,{hideCounter:!0,disableWaypoints:!0})})]}),(0,l.Y)(oj,{theme:"sticky",counter:{current:ed?1:ea+1,total:ed?4:er},hasArrows:!0,onPreviousClick:()=>{var e;return o0((null==(e=eX[ea-1])?void 0:e.id)||"intro")},onNextClick:()=>{var e;return o0((null==(e=eX[ea+1])?void 0:e.id)||"submit")},children:null==(h=eX[ea])?void 0:h.heading}),(0,l.Y)(o9,{sections:e0})]}),(0,l.FD)("div",{id:oX("submit"),children:[(0,l.FD)("div",{css:o3.hideOnDesktop,children:[(0,l.Y)(x.A,{headingTag:"h2",heading:"Application Progress",subheading:"Please complete all sections below before submitting application for review.",isCentered:!0}),(0,l.Y)(ei.A,{children:(0,l.Y)(e9,{hideCounter:!0,disableWaypoints:!0})})]}),(0,l.Y)(ei.A,{children:(0,l.Y)(w.A,{type:"submit",isFull:!0,isLoading:eg,children:"Continue"})})]})]})})},an=e=>{var n,i,t,o,a,r,d,s,c,u,p;let{application:m,userId:h,onSubmit:g,validateOrganizationApplicationAddress:I,onOwnerSubmit:A,onFieldBlur:b,onSectionLoad:C,onSectionStateChange:S,onOwnerRemove:w,editOrganizationOnLoad:x,editPersonsOnLoad:F,scrollToPerson:Y,getPersonTaxId:T,getOrganizationTaxId:k,addressIneligible:P}=e,[O,R]=(0,v.useState)(null),{dismissMessage:L,triggerMessage:N}=(0,f.d)(),B=(0,ir.h9)(),M=!!m;(0,v.useEffect)(()=>
1{P&&M&&!B.modalIsOpen&&B.openModal()},[M,P]);let z=(0,D.t)(),{addressNotSupportedModalHeader:V,addressNotSupportedModalBody:_}=null!=(p=null==(t=z.experiences)||null==(i=t.selfServe)||null==(n=i.pages)?void 0:n.editAddress)?p:{},U=!!(null==(r=z.mantlFeatures)||null==(a=r.accountOpening)||null==(o=a.nonControlProngBusinessApplicant)?void 0:o.enabled),q=async e=>{var n,i;let t=document.querySelector(".person-field-collection"),l=null==m||null==(n=m.products)?void 0:n.flatMap(e=>e.regions).filter(Boolean),o=!!l&&l.length>0,a=(null==m?void 0:m.originatingExperience)==="console"||!!e.organization.externalCoreId;if(t){let e=N("You have an unsaved person. Please save or cancel before continuing.",{theme:"error",action:{text:"Go to person",onClick:()=>(0,oA.V)(t)}});return R(e),e}if(O&&(L(O),R(null)),o&&!a&&I){let n=await I((0,E.aC)(e));return(null==n||null==(i=n.requiredActions)?void 0:i.find(e=>"ineligibleRegion"===e.type))?void B.openModal():void await g({formData:(0,E.aC)(e)})}await g({formData:(0,E.aC)(e)})},H=async e=>{await g({formData:(0,E.aC)(e)})},K=m?(0,E.GW)(m,h,{hasAccountRelatedApplicants:U}):null;return(0,l.FD)(y.A,{initialValues:K,onSubmit:q,onFieldBlur:b,onSectionLoad:C,onSectionStateChange:S,children:[(0,l.Y)(ae,{application:m,onOwnerSubmit:e=>{var n,i;if((0,oN.ic)(null==m||null==(n=m.fields)?void 0:n.accounts)&&e.id){let n=(0,oN.aV)((0,eS.rC)(null==m?void 0:m.rawFields)),t=(null==m||null==(i=m.persons)?void 0:i.map(e=>e.id))||[];if(n.includes(e.id)&&!t.includes(e.id))return void N("This person has already been added as an authorized signer. If you'd like to give owner roles to your auth signers, please contact us.",{theme:"error"})}return A((0,E.qP)(e,!U||!!e.hasOrganizationRelationship))},savedValues:K,hasMultiplePersonRelationships:null!=m&&!!m.persons&&(null==m||null==(d=m.persons)?void 0:d.length)>1,isControlProngAuthorizedSigner:!!(null==m||null==(s=m.fields)?void 0:s.isControlProngAuthorizedSigner),userId:h,onOwnerRemove:w,editOrganizationOnLoad:x,editPersonsOnLoad:F,scrollToPerson:Y,getPersonTaxId:T,getOrganizationTaxId:k}),(0,l.Y)(oV,{isOpen:B.modalIsOpen,onClose:()=>B.closeModal(),onContinue:H,customerType:null==m||null==(u=m.products)||null==(c=u[0])?void 0:c.customerType,addressNotSupportedModalHeader:V,addressNotSupportedModalBody:_})]})};var ai=i(42393);function at(){let e=(0,ng._)(["\n  mutation getPersonTaxId($id: ID!, $applicationId: ID!) {\n    getPersonTaxId(id: $id, applicationId: $applicationId)\n  }\n"]);return at=function(){return e},e}function al(){let e=(0,ng._)(["\n  mutation getOrganizationTaxId($applicationId: ID!, $organizationId: ID!) {\n    getOrganizationTaxId(\n      applicationId: $applicationId\n      organizationId: $organizationId\n    )\n  }\n"]);return al=function(){return e},e}function ao(){let e=(0,ng._)(["\n  mutation getTaxReportingTaxId(\n    $applicationId: ID!\n    $accountReferenceId: String\n  ) {\n    getTaxReportingTaxId(\n      applicationId: $applicationId\n      accountReferenceId: $accountReferenceId\n    )\n  }\n"]);return ao=function(){return e},e}function aa(){let e=(0,ng._)(["\n  mutation getPlanBeneficiaries($planId: ID!, $applicationId: ID!) {\n    getPlanBeneficiaries(planId: $planId, applicationId: $applicationId)\n  }\n"]);return aa=function(){return e},e}function ar(){let e=(0,ng._)(["\n  mutation getDecedentFields($planId: ID!, $applicationId: ID!) {\n    getDecedentFields(planId: $planId, applicationId: $applicationId)\n  }\n"]);return ar=function(){return e},e}let ad=(0,iE.J1)(at()),as=(0,iE.J1)(al()),ac=(0,iE.J1)(ao()),au=(0,iE.J1)(aa()),ap=(0,iE.J1)(ar()),am=()=>{let{applicationId:e}=(0,u.YY)(),{triggerCustomerServiceError:n}=(0,ef.A)(),i={onError:()=>n(U.Zi,{includePhoneMessage:!1})},[t]=(0,ey.n)(ad,i),[l]=(0,ey.n)(as,i),[o]=(0,ey.n)(ac,i),[a]=(0,ey.n)(au,i),[r]=(0,ey.n)(ap,i);return{getPersonTaxId:async n=>{let{data:i}=await t({variables:{id:n,applicationId:e}});return null==i?void 0:i.getPersonTaxId},getOrganizationTaxId:async n=>{let{data:i}=await l({variables:{applicationId:e,organizationId:n}});return null==i?void 0:i.getOrganizationTaxId},getTaxReportingTaxId:async n=>{let{data:i}=await o({variables:{applicationId:e,accountReferenceId:n}});return null==i?void 0:i.getTaxReportingTaxId},getPlanBeneficiaries:async n=>{let{data:i}=await a({variables:{planId:n,applicationId:e}});return(null==i?void 0:i.getPlanBeneficiaries)||[]},getDecedentFields:async n=>{let{data:i}=await r({variables:{planId:n,applicationId:e}});return(null==i?void 0:i.getDecedentFields)||null}}};var ah=i(94708);let{KE:av}=E;
1var ag=i(58185),af=i(56714);let ay=e=>{let{isDisabled:n}=e;return(0,l.Y)(ee.A,{fieldIds:$.A.PERSON.RESIDENCY_FIELDS,isDisabled:n})},aI=e=>{let{namePrefix:n="person",shouldUsePassedInAddress:i=!1,passedInAddress:t={}}=e,{initialValues:{[n]:o},setValue:a,clearErrors:r}=(0,S.xW)(),d=(0,v.useRef)(null),s=!!t.addressMailingLine1,c=s?["addressPrimary","addressMailing"]:["addressPrimary"];return(0,v.useEffect)(()=>{c.forEach(e=>{(0,lD._w)(e).forEach(e=>{let l=i?t[e]:"",o="".concat(n,".").concat(e);(l||d.current)&&a(o,l),r(o)})}),d.current=!0},[i,s]),(0,l.FD)(iG.A,{children:[(0,l.Y)(ay,{}),(0,l.Y)(lM,{isDisabled:o.existsInCore||i,personOrBusiness:o.rawFields,isUsingPassedInAddress:i,hasMailingAddressToCopy:s})]})};var aA=i(99348);let ab={container:{paddingBottom:"1.5rem"}},aC=e=>{var n,i,t,a,r,d,s,c;let{application:u,applicant:p,userId:m,onSubmit:h,products:g,validatedPersonApplicationAddress:f,addressIneligible:y,role:I,ownershipType:A}=e,{experiences:{selfServe:{pages:{editAddress:{headerText:b,subheaderText:C,formInfoText:S,formInfoTooltip:w,addressNotSupportedModalHeader:x,addressNotSupportedModalBody:F}={}}}}}=(0,D.t)(),Y=(0,oW.A)({fieldIds:af.S.address,entityType:"person"}),T=null!=(c=null==u||null==(i=u.fields)||null==(n=i.accounts)?void 0:n[0])?c:null==u?void 0:u.fields,k=null==T?void 0:T.newAccountRelationshipD
1ata,P=(0,ir.h9)(),O=null==k||null==(t=k.find(e=>e.isPrimaryEntity))?void 0:t.personId,R=null==u||null==(a=u.persons)?void 0:a.find(e=>e.id===O),L=!!(null==R?void 0:R.addressPrimaryLine1),N="jointAdult"===A&&"otherAdult"===I,[B,M]=(0,v.useState)(N&&L),z=!!u;(0,v.useEffect)(()=>{y&&z&&!P.modalIsOpen&&P.openModal()},[z,y]);let V=async e=>{var n,i,t;let l=null!=(n=null==u?void 0:u.products)?n:g,o=null==l?void 0:l.flatMap(e=>e.regions).filter(Boolean);if(o&&o.length>0){let n=await f((0,E.UI)({formData:e,fieldIds:Y})),l=!!(null==n||null==(i=n.requiredActions)?void 0:i.find(e=>"ineligibleRegion"===e.type)),o=(null==u?void 0:u.originatingExperience)==="console"||!!(null==(t=e.person)?void 0:t.externalCoreId);if(l&&!o)return void P.openModal()}return h((0,E.UI)({formData:e,fieldIds:Y}))},_=async e=>{await h((0,E.UI)({formData:e,fieldIds:Y}))},U=(null==u||null==(d=u.fields)||null==(r=d.ownership)?void 0:r.type)&&k?(0,o.FZ)({ownershipType:null==u?void 0:u.fields.ownership.type,newAccountRelationshipData:k}):null,{heading:q,subheading:H}=N?{heading:"Add ".concat(null==p?void 0:p.firstName,"'s Address"),subheading:"Where does ".concat(null==p?void 0:p.firstName," live?")}:{heading:b||"Welcome".concat((null==p?void 0:p.firstName)?", ".concat(p.firstName,"!"):""),subheading:C||"Where do you live?"};return(0,l.FD)(aA.A,{application:u,applicant:p,userId:m,heading:q,subheading:H,formInfoText:S,formInfoTooltip:w,onSubmit:V,products:g,accountVariant:null==u||null==(s=u.fields)?void 0:s.accountVariant,role:I,ownershipType:A,children:[N&&(0,l.Y)("div",{css:ab.container,children:(0,l.Y)(eq.A,{name:"should-use-joint-ad
1dress",label:"Same address as yours",isChecked:B,onChange:e=>{let{target:{checked:n}}=e;M(n)}})}),(0,l.Y)(aI,{shouldUsePassedInAddress:B,passedInAddress:null==R?void 0:R.rawFields}),(0,l.Y)(oV,{isOpen:P.modalIsOpen,onClose:P.closeModal,onContinue:_,customerType:U,addressNotSupportedModalHeader:x,addressNotSupportedModalBody:F})]})},aS=e=>{let{isDisabled:n,showEmailFields:i}=e,t=(0,eL.FF)("LOAN-306-grouped-person-id-fields"),o=(0,eL.FF)("LOAN-1356-protected-party-checks"),a=[...$.A.PERSON.EMPLOYMENT_FIELDS];return o&&a.push(...$.A.PERSON.PROTECTED_PARTY_FIELDS),(0,l.FD)(l.FK,{children:[(0,l.Y)(ee.A,{...t&&{title:"Identity",icon:"user",theme:"bordered",isTitleBold:!0},fieldIds:[...$.A.PERSON.IDENTITY_FIELDS,...i?$.A.PERSON.EMAILS_FIELDS:[]],isDisabled:n}),(0,l.Y)(ee.A,{...t&&{title:"Employment",icon:"business",theme:"bordered",isTitleBold:!0},fieldIds:a,isDisabled:n}),(0,l.Y)(ee.A,{...t&&{title:"Sources of Income",icon:"wallet",theme:"bordered",isTitleBold:!0},fieldIds:$.A.PERSON.SOURCES_OF_INCOME_FIELDS,isDisabled:n}),(0,l.Y)(ee.A,{...t&&{title:"Additional Information",icon:"info-circle",theme:"bordered",isTitleBold:!0},fieldIds:[...$.A.PERSON.ADDITIONAL_IDENTITY_FIELDS,...$.A.PERSON.ADDITIONAL_QUESTIONS_FIELDS],isDisabled:n}),(0,l.Y)(ee.A,{...t&&{title:"Demographic Information",description:"These questions are required pursuant to government regulations. The law provides that we may not discriminate on the basis of this information, or whether you choose to provide it.",icon:"user",theme:"bordered",isTitleBold:!0},fieldIds:$.A.PERSON.DEMOGRAPHICS_FIELDS,isDisabled:n})]})},aw=e=>{var n;let{application:i,applicant:t,userId:o,onSubmit:a,products:r,getPersonTaxId:d,role:s,ownershipType:c}=e,{experiences:{selfServe:{pages:{editIdentity:{headerText:u,subheaderText:p,formInfoText:m,formInfoTooltip:h}={}}}}}=(0,D.t)(),v=(0,eL.FF)("LOAN-1356-protected-party-checks"),g=(0,oW.A)({fieldIds:v?[...af.S.identity,...$.A.PERSON.PROTECTED_PARTY_FIELDS]:af.S.identity,entityType:"person"}),{heading:f,subheading:y}="jointAdult"===c&&"otherAdult"===s?{heading:"Verify ".concat(null==t?void 0:t.firstName,"'s Identity"),subheading:"We'll need this information to open a secure account for you and ".concat(null==t?void 0:t.firstName,".")}:{heading:u||"Let’s verify your identity!",subheading:p||"Tell us about yourself."};return(0,l.Y)(aA.A,{application:i,applicant:t,userId:o,heading:f,subheading:y,formInfoText:m,formInfoTooltip:h,onSubmit:e=>a((0,E.UI)({formData:e,fieldIds:g})),products:r,accountVariant:null==i||null==(n=i.fields)?void 0:n.accountVariant,getPersonTaxId:d,role:s,ownershipType:c,children:(0,l.Y)(iG.A,{children:(0,l.Y)(aS,{showEmailFields:!0})})})},ax=e=>{var n;let{application:i,userId:t,onSubmit:o,products:a,applicant:r,role:d,ownershipType:s}=e,{experiences:{selfServe:{pages:{editEligibility:{headerText:c,subheaderText:u,formInfoText:p,formInfoTooltip:m}={}}}}}=(0,D.t)(),{heading:h,subheading:v}="jointAdult"===s&&"otherAdult"===d?{heading:"".concat(r.firstName,"'s Membership Eligibility"),subheading:"How is ".concat(r.firstName," eligible to open an account with us today?")}:{heading:c||"Membership Eligibility",subheading:u||"How are you eligible to open an account with us today?"};return(0,l.Y)(aA.A,{application:i,applicant:r,userId:t,heading:h,subheading:v,onSubmit:e=>o((0,E.UI)({formData:e,fieldIds:[...$.A.PERSON.MEMBERSHIP_ELIGIBILITY_CRITERIA,...$.A.PERSON.MEMBERSHIP_ELIGIBILITY_TRIGGERED_FIELDS]})),products:a,accountVariant:null==i||null==(n=i.fields)?void 0:n.accountVariant,formInfoText:p,formInfoTooltip:m,role:d,ownershipType:s,children:(0,l.Y)(et,{})})},aF=e=>{var n,i,t;let{application:o,userId:a,products:r,onSubmit:d}=e,{firstName:s}=null!=(t=null==o?void 0:o.persons.find(e=>e.isMinor))?t:{firstName:"Minor"},c=null==o||null==(n=o.persons)?void 0:n.find(e=>e.isMinor),u={minor:c?(0,E.tF)(c,a):{isMinor:!0}};return(0,l.Y)(aA.A,{application:o,userId:a,heading:"".concat(s,"'s Membership Eligibility"),subheading:"How is ".concat(s," eligible to open an account with us today?"),onSubmit:e=>d((0,E.UI)({formData:e,fieldIds:[...$.A.PERSON.MEMBERSHIP_ELIGIBILITY_CRITERIA,...$.A.PERSON.MEMBERSHIP_ELIGIBILITY_TRIGGERED_FIELDS],personKey:"minor"})),initialValues:u,namePrefix:"minor",role:"minor",products:r,accountVariant:null==o||null==(i=o.fields)?void 0:i.accountVariant,children:(0,l.Y)(et,{})})};var aY=i(68335),aT=i(5165),aD=i(81345),aE=i(48145),ak=i(4839),aP=i(83096);let aO=e=>{let{onSelectMinor:n,existingRelatedPersons:i,selectedMinor:t}=e,{fields:o}=(0,T.d)(),a=[{value:"addNewMinor",label:"Add New Minor",disabled:!1,dateOfBirth:null},...i.map(e=>{let n,{id:i,dateOfBirth:t,...l}=e,a=(0,J.L)(l),r=(0,aT.jr)(t,null==o?void 0:o.dateOfBirth),d=!(null==r?void 0:r.success);if(r.error){let e=aP.ZC6(r.error);n=e.errors.length>0?e.errors[0]:void 0}return d&&(a="".concat(a," - Not eligible for this product (").concat(n,")")),{value:i,label:a,disabled:d,dateOfBirth:t}}).filter(e=>{let n=(0,aD.A)((0,aE.A)(new Date),21);if(!e.dateOfBirth)return!1;let i=!(0,ak.A)((0,aE.A)(new Date(e.dateOfBirth)),n);return!e.disabled||!!i})],r=ez()(a,e=>+!!e.disabled);
1return(0,l.Y)(ep.A,{name:"selectedMinor",onChange:n,value:t,label:"Select a Minor",ariaLabel:"Select a Minor",options:r})},aR=e=>{var n,i;let{application:t,applicationType:o,userId:a,onSubmit:r,applicant:d,products:s,existingRelatedPersons:c=[],isUpdatingMinorFields:u,setIsUpdatingMinorFields:p,selectedMinor:m,setSelectedMinor:h}=e,g=(0,oW.A)({fieldIds:af.R.basicInfo,entityType:"person"});(0,v.useEffect)(()=>{c.length&&(h(void 0),p(!1))},[c.length]);let f=async e=>{if("addNewMinor"!==m||u)return r({...(0,E.UI)({formData:e,fieldIds:g,personKey:"minor"}),minorId:m});p(!0),h(void 0)},y=null==t||null==(n=t.persons)?void 0:n.find(e=>e.isMinor),I={minor:y&&m===y.id?(0,E.tF)(y,a):{isMinor:!0}};return(0,l.Y)(l.FK,{children:(0,l.FD)(aA.A,{application:t,applicationType:o,applicant:d,userId:a,heading:u?"Now the Minor's Information":"Select Existing Minor",subheading:u?"First, some basic details":"We've found at least one person related to your user account. Select the minor you'd like to create an account for, or add a new minor.",onSubmit:f,initialValues:I,namePrefix:"minor",accountVariant:null==t||null==(i=t.fields)?void 0:i.accountVariant,products:s,role:"minor",isDisabled:!u&&!m,children:[u&&(0,l.Y)(aY.A,{}),!u&&(0,l.Y)(aO,{onSelectMinor:e=>h(e),existingRelatedPersons:c,selectedMinor:m})]})})},aL=e=>{var n,i;let{application:t,userId:o,onSubmit:a,products:r}=e,d=(0,oW.A)({fieldIds:af.R.identity,entityType:"person"}),{firstName:s}=(null==t?void 0:t.persons.find(e=>e.isMinor))||{firstName:"Minor"},c="Verify ".concat(s,"'s Identity"),u="We'll need this information to open a secure account for you and ".concat(s,"."),p=null==t||null==(n=t.persons)?void 0:n.find(e=>e.isMinor),m={minor:p?(0,E.tF)(p,o):{isMinor:!0}};return(0,l.Y)(l.FK,{children:(0,l.Y)(aA.A,{application:t,userId:o,heading:c,subheading:u,onSubmit:e=>a((0,E.UI)({formData:e,fieldIds:d,personKey:"minor"})),namePrefix:"minor",initialValues:m,products:r,accountVariant:null==t||null==(i=t.fields)?void 0:i.accountVariant,children:(0,l.Y)(iG.A,{children:(0,l.Y)(aS,{showEmailFields:!0})})})})},aN={container:{paddingBottom:"1.5rem"}},aB=e=>{var n,i,t;let{application:o,userId:a,onSubmit:r,products:d}=e,{experiences:{selfServe:{pages:{editMinorAddress:{headerText:s,subheaderText:c,formInfoText:u,formInfoTooltip:p}={}}}}}=(0,D.t)(),m=null==o||null==(n=o.persons)?void 0:n.find(e=>!e.isMinor),h=null==o||null==(i=o.persons)?void 0:i.find(e=>e.isMinor),g=!!(null==h?void 0:h.addressPrimaryLine1),f=(0,oW.A)({fieldIds:af.R.address,entityType:"person"}),[y,I]=(0,v.useState)(!g),A=s||"Add ".concat((null==h?void 0:h.firstName)||"Minor","'s Address"),b=c||"Where does ".concat((null==h?void 0:h.firstName)||"the minor"," live?"),C={minor:h?(0,E.tF)(h,a):{isMinor:!0}};return(0,l.FD)(aA.A,{application:o,userId:null==h?void 0:h.id,heading:A,subheading:b,onSubmit:e=>r((0,E.UI)({formData:e,fieldIds:f,personKey:"minor"})),initialValues:C,namePrefix:"minor",products:d,accountVariant:null==o||null==(t=o.fields)?void 0:t.accountVariant,formInfoText:u,formInfoTooltip:p,children:[(0,l.Y)("div",{css:aN.container,children:(0,l.Y)(eq.A,{name:"should-use-guardian-address",label:"Same address as yours",type:"checkbox",isChecked:y,onChange:e=>{let{target:{checked:n}}=e;I(n)}})}),(0,l.Y)(aI,{shouldUsePassedInAddress:y,passedInAddress:null==m?void 0:m.rawFields,namePrefix:"minor"})]})},aM=e=>{var n,i,t,o,a;let{setCurrentView:d,view:c}=e,{application:p,userId:h,updatePerson:g,validateApplication:f,getView:y,products:I,addMinorToApplication:A,existingRelatedPersons:b,isLoadingExistingMinors:C,refetchExistingMinors:S,addPersonToApplication:w}=(0,u.YY)(),{user:x}=(0,eg.Ay)({includeAllFields:!0}),{account:F,loading:Y}=tA({applicationId:null==p?void 0:p.id,accountId:null==p||null==(n=p.fields)?void 0:n.accountId,queryOptions:{skip:!(null==p?void 0:p.isMultiApplicantsCDASO)}}),[T,D]=(0,v.useState)(!(null==b?void 0:b.length)),[E,k]=(0,v.useState)(void 0),{cancelApplication:P}=(0,ai.A)(),{productEligibilityCheck:O}=(0,t2.A)();(0,v.useEffect)(()=>{S()},[]);let{getPersonTaxId:R}=am();ec({allowBrowserNavigationToViews:[r.C3,r.zD,r.S2,r.X6,r.wY,r.jn,r.HC]});let{config:L,config:{fields:N}}=(0,s.UK)(),{triggerCustomerServiceError:B}=(0,ef.A)(),{query:M}=(0,m.useRouter)();if(!I||Y)return(0,l.Y)(W.A,{});let z=null==c||null==(i=c.data)?void 0:i.role,V=null==c||null==(t=c.data)?void 0:t.ownershipType,_=null==c||null==(o=c.data)?void 0:o.personId,q=!(null==c||null==(a=c.data)?void 0:a.personId)&&"jointAdult"===V,H=_?null==p?void 0:p.persons.find(e=>e.id===_):x,K=(null==H?void 0:H.id)===h?h:_,j=async e=>{let{person:n}=e;
1eC(p);let{data:i}=await g({variables:{fields:{...n.fields},personId:n.personId,applicationId:p.id}});return null==i?void 0:i.updatePerson},G=async e=>{let{person:n}=e;eC(p),await w({variables:{fields:n.fields,applicationId:p.id,role:z}});let i=y();i?d(i):B(U.OU)},$=async e=>{let{person:n,minorId:i}=e;eC(p);let t={applicationId:p.id,fields:n.fields,minorId:i};await A({variables:t})},J=async e=>{let{person:n}=e;eC(p);let{data:i}=await g({variables:{fields:n.fields,personId:n.personId,applicationId:p.id}});return null==i?void 0:i.updatePerson},Z=async e=>{await j(e);let{data:n}=await f();return null==n?void 0:n.validateApplication},X=async e=>{try{var n;switch(c.code){case r.HC.code:E&&T?await J({...e,personId:E}):await $(e);break;case r.gU.code:case r.S.code:await J(e);break;default:await j(e)}let{data:i}=await f(),t=null==i?void 0:i.validateApplication;if(p&&(null==t||null==(n=t.requiredActions)?void 0:n.find(e=>"ineligibleRegion"===e.type))){await P({variables:{applicationId:p.id}}),d(r.Vj);return}let l=(null==p?void 0:p.type)==="createAccount"&&t?(0,ah.A)(t,L,h,M):y(),o=l===r.tm&&(null==t?void 0:t.reviewStatus)==="actionRequired"?r.jn:l;if(o)return o.code===r.HC.code&&D(!0),d(o)}catch(e){B(U.OU)}};(0,Q.Z1)(I,"product is null or undefined");let ee={fields:N,application:p,userId:h,onSubmit:X,products:I},en=async e=>{if(!e.minorId)return X(e);{var n,i;let t=null!=(i=null==p||null==(n=p.fields)?void 0:n.accounts)?i:[null==p?void 0:p.fields];if(await Promise.all(t.map(n=>{var i;return O({accountVariant:null!=(i=null==n?void 0:n.accountVariant)?i:"",products:(null==n?void 0:n.productId)?[L.products[n.productId]]:I,minorId:e.minorId,role:"minor",ineligibleErrorMessage:"Minor is not eligible for product",applicationType:null==p?void 0:p.type})})).then(e=>e.every(e=>e)))return X(e)}};return p?(()=>{if(!p)return null;switch(c.code){case r.zD.code:if(q)return(0,l.Y)(ag.A,{...ee,onSubmit:G,applicant:void 0,userId:void 0,applicationType:null==p?void 0:p.type,accountForCurrentApplication:F,systemRequiredFields:["emailPrimary"],role:z,ownershipType:V});return(0,l.Y)(ag.A,{...ee,applicant:H,userId:K,applicationType:null==p?void 0:p.type,accountForCurrentApplication:F,systemRequiredFields:["emailPrimary"],role:z,ownershipType:V});case r.C3.code:var e;return(0,l.Y)(aC,{...ee,validatedPersonApplicationAddress:Z,applicant:H,userId:K,addressIneligible:null==c||null==(e=c.data)?void 0:e.addressIneligible,role:z,ownershipType:V});case r.S2.code:return(0,l.Y)(aw,{...ee,applicant:H,userId:K,getPersonTaxId:R,role:z,ownershipType:V});case r.X6.code:return(0,l.Y)(ax,{...ee,applicant:H,userId:K,role:z,ownershipType:V});case r.Xj.code:return(0,l.Y)(aF,{...ee});case r.HC.code:return C?(0,l.Y)(W.A,{}):(0,l.Y)(aR,{...ee,applicant:x,applicationType:null==p?void 0:p.type,isUpdatingMinorFields:T,setIsUpdatingMinorFields:D,selectedMinor:E,setSelectedMinor:k,onSubmit:en,existingRelatedPersons:null!=b?b:[]});case r.gU.code:return(0,l.Y)(aL,{...ee});case r.S.code:return(0,l.Y)(aB,{...ee});default:return null}})():(0,l.Y)(W.A,{})},az=e=>{var n,i,t,o,a,r,d,s;let{eddQuestionnaireType:c,application:u,namePrefix:p,...m}=e;return(0,l.Y)(y.A,{theme:"fillHeight",initialValues:m.initialValues,children:(0,l.Y)(ni,{application:u,addressPrimaryState:(null==u||null==(t=u.persons)||null==(i=t[0])||null==(n=i.rawFields)?void 0:n.addressPrimaryState)||void 0,maritalStatus:(null==u||null==(r=u.persons)||null==(a=r[0])||null==(o=a.rawFields)?void 0:o.maritalStatus)||void 0,newAccountRelationshipD
1ata:(null==(d=u.fields)?void 0:d.newAccountRelationshipData)||void 0,organizationType:(null==(s=u.organization)?void 0:s.type)||void 0,organizationKycEvaluationTags:null==u?void 0:u.organizationKycEvaluationTags,personKycEvaluationTags:null==u?void 0:u.personKycEvaluationTags,underwritingTags:[],children:(0,l.Y)(B,{eddQuestionnaireType:c,entityType:"application",...m})})})};var aV=i(49159),a_=i(4592),aU=i(76967);let aq={rowContainer:(e,n)=>{let{breakpoints:i}=e;return{padding:"8px 12px",display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",borderRadius:n,minHeight:"2.0625rem",[i.small]:{padding:"16px 18px",minHeight:67}}},content:{display:"flex",alignItems:"center",paddingRight:8,textAlign:"left"},icon:e=>{let{colors:n}=e;return{flexShrink:0,flexGrow:0,marginRight:19,display:"flex",alignItems:"center",justifyContent:"center",color:n.brand.primary,width:24,height:24}},subContent:{display:"flex",flexDirection:"column"},title:e=>{let{fontScales:n}=e;return{...n.default}},titleContent:{display:"flex",alignItems:"center",marginBottom:2},titleTag:{marginLeft:8},description:e=>{let{colors:n,fontScales:i}=e;return{...i.small,color:n.grey2}}},aH={default:e=>{let{colors:n}=e;return{border:"1px solid ".concat(n.grey3)}},noBorder:()=>({border:"2px solid transparent"}),active:e=>{let{colors:n}=e;return{border:"1px solid ".concat(n.brand.primary)}},inactive:e=>{let{colors:n}=e;return{opacity:.6,border:"1px solid ".concat(n.brand.primaryLight),"&:hover":{opacity:1,border:"1px solid ".concat(n.brand.primary)}}},grouped:e=>{let{colors:n}=e;return{borderRadius:0,marginBottom:0,border:"1px solid ".concat(n.grey3),"& + &":{borderTop:0}}},inline:e=>{let{breakpoints:n}=e;return{border:0,padding:0,[n.small]:{padding:0},background:"transparent"}}},aK=e=>{let{title:n,description:i,icon:t,titleTag:o,theme:a="default",iconSize:r,ariaDescribedBy:d}=e,s=(0,eL.FF)("PART-1058-enable-new-self-serve-component-designs");return(0,l.Y)("div",{"data-setstaticid":!0,"data-uid":n,css:e=>[aq.rowContainer(e,s?(0,n8.N)(e.borderShape):4),aH[a](e)],"aria-describedby":d||void 0,children:(0,l.FD)("div",{css:aq.content,children:[t&&(0,l.Y)("div",{css:e=>[aq.icon(e)],children:(0,l.Y)(eH.A,{name:t,size:r})}),(0,l.FD)("div",{css:aq.subContent,children:[(0,l.FD)("div",{css:aq.titleContent,children:[n&&(0,l.Y)("div",{css:e=>aq.title(e),children:n}),o&&(0,l.Y)("div",{css:aq.titleTag,children:(0,l.Y)(n7.A,{isAnimated:o.isAnimated,theme:o.theme,children:o.text})})]}),i&&(0,l.Y)("div",{css:aq.description,children:(0,l.Y)(e6.A,{isInline:!1,source:i})})]})]})})};var aj=i(91428);let aW=e=>{let{status:n,type:i}=e,t=!i,l="directDeposit"===i;switch(n){case"pending":case"failed":case"awaitingRetry":case"processing":if(l&&"pending"===n)return{text:"Processing",theme:"info"};if(l&&"failed"===n)return{text:"Retry",theme:"warning"};return{text:"Requested",theme:"info"};case"linked":if(t)return{text:"Linked",theme:"success"};return null;case"complete":if(t||"checks"===i)return{text:"Fulfilled",theme:"success"};if(l)return{text:"Configured",theme:"success"};return{text:"Complete",theme:"success"};default:return null}};var aG=i(83323),a$=i(11047);let aQ=e=>{let{isLinkedCard:n=!1,status:i,displayName:t,last4:o,updatedAt:a,cardDescription:r,onRequest:d,onRemove:s,theme:c="default",isPromoted:u=!1}=e,{isLoading:p,onClick:m}=(0,iB.A)({onClick:d||s||(()=>null)});return(0,l.Y)(a$.A,{title:t||null,actions:(()=>{if(d)return[o?{text:"Link","aria-label":"Link ".concat(t," ending in ").concat(o),isLoading:p,buttonTheme:"primary",onClick:u?m:void 0,confirm:u?void 0:{heading:"Link Card",subheading:"Are you sure you want to link ".concat(t," ending in ").concat(o," to your account?"),icon:"debit-card",buttonText:"Yes, Link Card",onConfirm:m}}:{text:"Request","aria-label":"Request a new ".concat(t),isLoading:p,buttonTheme:"primary",onClick:u?m:void 0,confirm:u?void 0:{heading:"Request New Card",subheading:"Are you sure you want to request a new ".concat(t," for this account?"),icon:"debit-card",buttonText:"Yes, Request New Card",onConfirm:m}}];if(s&&"complete"!==i&&"linked"!==i){let e=o?"to link ".concat(t," ending in ").concat(o," to your account"):"for a new ".concat(t);return[{text:"Cancel Request","aria-label":"Cancel request for ".concat(t),isLoading:p,confirm:{heading:"Cancel Request",subheading:"Are you sure you want to cancel your request ".concat(e,"?"),icon:"cancel",buttonText:"Yes, Cancel Request",onConfirm:m}}]}return[]})(),...(()=>{let e="complete"===i,t=e&&!!o,d={note:null!=r?r:void 0,noteAriaLabel:null!=r?r:void 0};return o&&(n||t)?{infoText:" ...".concat(o),infoTextAriaLabel:"Card ending with ".concat(o),append:(0,l.Y)(n7.A,{theme:"success",children:n?"Linked":"Fulfilled"}),...d}:i?{infoText:o?" ...".concat(o):null,infoTextAriaLabel:"Card ending with ".concat(o),...d,tag:{text:e?"fulfilled":"requested",theme:e?"success":"info",note:a?"on ".concat((0,eY.wV)(a,{dateFormat:eY.Kn.LONG_MONTH_DAY_YEAR})):null}}:o?{infoText:" ...".concat(o),infoTextAriaLabel:"Card ending with ".concat(o),...d}:{...d}})(),isLoading:p,theme:c,keepConfirmModalOpenWhileLoading:!0})},aJ={description:e=>{let{fontScales:n,colors:i}=e;return{...n.small,textAlign:"left",marginBottom:"1rem",color:i.grey7}},container:{cursor:"default"},cardHolderHeading:e=>{let{colors:n}=e;return{color:n.grey8,marginBottom:12,textAlign:"left"}},cardHolderContainer:{"&:not(:last-child)":{marginBottom:24}}},aZ=e=>{var n,i,t;let{eligibleCardService:o,card:a,cardHolder:r,onRequest:d,services:s,eligibleCardServicesAmount:c,theme:u="default",isOnOnboardingView:p}=e,m=a&&(null==a?void 0:a.serviceId)?null==s?void 0:s.find(e=>e.id===(null==a?void 0:a.serviceId)):null,h=null!=(n=null==o?void 0:o.name)?n:null==m?void 0:m.name,v=c>
11?null!=(i=null==o?void 0:o.description)?i:null==m?void 0:m.description:null;return(0,l.Y)(aQ,{displayName:h,last4:null==a?void 0:a.last4,onRequest:()=>o?d({serviceId:o.id,type:o.type,cardHolder:r,...["debitCard","atmCard"].includes(o.type)&&{cardFulfillmentType:"mail"},...a?{cardId:a.id}:{}}):null,theme:u,cardDescription:v,isPromoted:!p&&null!=(t=null==o?void 0:o.promoted)&&t},(null==a?void 0:a.id)||(null==o?void 0:o.id))},aX=e=>{let{eligibleCardServices:n,isOnOnboardingView:i,onRequest:t,cardHolder:o,services:a}=e;return(0,l.Y)("div",{children:(()=>{if(!Array.isArray(n))return null;let e=n.length;return n.reduce((n,l)=>{if(!l)return n;if(l.linkableCards){let r=l.linkableCards.map(n=>aZ({eligibleCardService:l,card:n,onRequest:t,cardHolder:o,services:a,theme:"inCollapsible",eligibleCardServicesAmount:e,isOnOnboardingView:i}));return n.concat(r)}let r=aZ({eligibleCardService:l,cardHolder:o,onRequest:t,services:a,theme:"inCollapsible",eligibleCardServicesAmount:e,isOnOnboardingView:i});return n.concat(r)},[])})()})},a0=e=>{let{cardHolder:n,services:i,isOnOnboardingView:t,onRequest:o,onRemove:a}=e,{bookedCard:r,cardIOI:d,cards:s,eligibleCardServices:c}=n,u=!!r&&(null==d?void 0:d.type)==="linkedCard";if(r){let e=i.find(e=>e.id===r.serviceId);return(0,l.Y)(aQ,{isLinkedCard:u,status:u?"linked":null==d?void 0:d.status,displayName:(null==e?void 0:e.name)||"",last4:r.last4,cardDescription:null==e?void 0:e.description,theme:"inCollapsible"})}if(d){var p;let{status:e,serviceId:t,updatedAt:o,cardId:r}=d,c=i.find(e=>e.id===t),u=null==s?void 0:s.find(e=>(null==e?void 0:e.id)===r),m=null==(p=i.find(e=>e.id===(null==u?void 0:u.serviceId)))?void 0:p.name,h=!a||"pending"!==e||(null==c?void 0:c.automated)?null:()=>a({id:d.id,cardHolder:n});return(0,l.Y)(aQ,{status:e,displayName:m||(null==c?void 0:c.name)||"",updatedAt:o,last4:null==u?void 0:u.last4,onRemove:h,cardDescription:null==c?void 0:c.description})}return(0,l.Y)(aX,{services:i,cardHolder:n,eligibleCardServices:c,onRequest:o,isOnOnboardingView:t})},a9=e=>{let{cardHolders:n,services:i,isOnOnboardingView:t,onRequest:o,onRemove:a,isLinkedCard:r}=e,d=async e=>{var n,t;let{type:l,serviceId:a,cardId:r,cardHolder:d,cardFulfillmentType:s}=e,c=!!r,u=null!=(t=d.personId)?t:d.id;o({type:l,serviceId:a,...u?{personId:u}:{},...c?{cardId:r}:{},...s&&{cardFulfillmentType:s}},(null==(n=i.find(e=>e.id===a))?void 0:n.confirmation)||(c?"Linking your card has been requested":"".concat((null==d?void 0:d.firstName)?"".concat(d.firstName,"'s"):"Your"," card has been requested")))},s=async e=>{let{id:n,cardHolder:i}=e,t="".concat((null==i?void 0:i.firstName)?"".concat(i.firstName,"'s"):"Your"," card request has been canceled");null==a||a(n,t)};return(0,l.FD)("div",{css:aJ.container,children:[(0,l.Y)("h6",{css:e=>aJ.description(e),children:(0,l.Y)(e6.A,{source:((e,n,i)=>{let t=[...aG.$g,"linkedCard"],l=n.filter(e=>t.includes(e.type)).filter(n=>!!e.find(e=>{var i;return null==(i=e.eligibleCardServices)?void 0:i.find(e=>(null==e?void 0:e.id)===n.id)})),o=e.length>1,a=!!l.find(e=>"linkedCard"===e.type),r="Please select a new".concat(a?" or existing":""," card").concat(o?" for each account holder":"",". ").concat(a?"Once linked, you will not be able to change your selection.":""),[{bookedCard:d=null,cardIOI:s=null}]=e;if(d)return i?"The following card has been linked to this account.":"The following card has been fulfilled for this account.";if(s){let e=n.find(e=>e.id===s.serviceId);return(null==e?void 0:e.confirmation)||("linkedCard"===s.type?"Your request to link your existing card to this account has been received.":"Your new card has been requested.")}return l.length>1?r:1===l.length&&l[0].description?l[0].description:r})(n,i,r),isInline:!1})}),n.map(e=>{var n;return(0,l.FD)("div",{css:aJ.cardHolderContainer,children:[(0,l.FD)(np.A.H2,{theme:"default",css:e=>[aJ.cardHolderHeading(e)],children:["For ",e.firstName]}),(0,l.Y)(a0,{isOnOnboardingView:t,cardHolder:e,services:i,onRequest:d,onRemove:a?s:void 0})]},null!=(n=e.personId)?n:e.id)})]})};i(57475);var a1=i(4738);let a2=(e,n)=>{var i;if(!e||!((e,n)=>{if("International"===n&&e["address".concat(n,"Country")])return!0;let i=!(0,a1.hN)(e["address".concat(n,"Country")]);return!!e["address".concat(n,"Line1")]&&!!e["address".concat(n,"City")]&&!!e["address".concat(n,"State")]&&(!i||!!e["address".concat(n,"Zip")])})(e,n))return null;let t=e["address".concat(n,"Line1")],l=e["address".concat(n,"City")],o=e["address".concat(n,"State")],a=e["address".concat(n,"Zip")],r=e["address".concat(n,"Country")];return t&&l&&o&&a&&r?{line1:t,line2:null!=(i=e["address".concat(n,"Line2")])?i:null,city:l,state:o,zip:a,country:r}:null},a6=e=>{var n;let{defaultAddressSelection:i,entity:t,account:l}=e,o="accountEntity"===i&&a2(l,"Primary")?l:t;return null!=(n=a2(o,"Mailing"))?n:a2(o,"Primary")},a5=(e,n,i)=>{let t=n&&"on ".concat((0,eY.wV)(n,{dateFormat:eY.Kn.LONG_MONTH_DAY_YEAR}));if(i)return{text:"Complete",theme:"success"};switch(e){case"processing":default:return;case"awaitingRetry":case"pending":case"failed":return{text:"Requested",theme:"info",note:t||""};case"complete":return{text:"Complete",theme:"success",note:t||""}}},a4={description:e=>{let{colors:n,fontScales:i}=e;return{...i.small,textAlign:"left",marginBottom:"1rem",color:n.grey7}}
1,cardHeader:e=>{let{colors:n,fontScales:i}=e;return{...i.default,textAlign:"left",color:n.grey8,marginBottom:16}},container:{cursor:"default"}},a3=e=>"defaultAddressSelection"in e?e.defaultAddressSelection:null,a8=e=>{let{address:n}=e;return(null==n?void 0:n.line1)?(0,l.Y)("div",{css:{marginBottom:"1rem"},"data-testid":"checks-shipping-address",children:(0,l.Y)(eU.A,{variant:"grey",flushMobile:!0,children:(0,l.Y)(e5.A,{keyValueMap:[["Mailing address",(0,nt.$P)({line1:n.line1,line2:n.line2,city:n.city,state:n.state,zip:n.zip,country:n.country})]],theme:"small",isValuesRightAligned:!0})})}):null},a7=e=>{let{service:n,indicationOfInterest:i,onRequest:t,onRemove:o,secondaryOnAccount:a,checkholderOnAccountName:r,forUserOnly:d,shippingAddress:s}=e,c=(null==i?void 0:i.id)?o:t||(()=>null),{isLoading:u,onClick:p}=(0,iB.A)({onClick:c}),m=(e=>{let{status:n,secondaryOnAccount:i,onClick:t,isLoading:l,canCancelRequest:o}=e;return n?"complete"!==n&&o?{text:"Remove",isLoading:l,onClick:t,confirm:{heading:"Cancel Request",subheading:"Are you sure you want to cancel this checkbook order?",icon:"cancel",buttonText:"Yes, Cancel Request",onConfirm:t}}:null:i?"booked"===i.status?{text:"Request",isLoading:l,onClick:()=>t(i.personId),confirm:{heading:"Request Joint Checks",subheading:"This will request joint checks for you and ".concat(i.firstName,"."),icon:"illustration-checking-account",buttonText:"Request joint checks",onConfirm:()=>t(i.personId)}}:{text:"Request",isLoading:l,onClick:t,confirm:{heading:"Request Checks",subheading:"To order joint checkbooks for yourself and a joint account holder, please wait to complete this request until after the second person has completed their application.",icon:"illustration-failure",buttonText:"Request checks for you only",onConfirm:t}}:{text:"Request",isLoading:l,onClick:t,confirm:{heading:"Request Checks",subheading:"This will request checks in your name.",icon:"illustration-checking-account",buttonText:"Request checks",onConfirm:t}}})({status:null==i?void 0:i.status,...a?{secondaryOnAccount:a}:{},onClick:e=>p(e||(null==i?void 0:i.id)),isLoading:u,canCancelRequest:!!o});return(0,l.FD)(l.FK,{children:[(0,l.Y)(a8,{address:null!=s?s:null}),(null==i?void 0:i.status)?(0,l.Y)(a$.A,{title:(e=>{var n,i;let{service:t,secondaryOnAccount:l,checkholderOnAccountName:o,indicationOfInterest:a,forUserOnly:r}=e,d="".concat(null!=(i=null==t?void 0:t.name)?i:"Checks");return r?d+=" For You":((null==l?void 0:l.status)==="booked"&&(null==l?void 0:l.firstName)&&(!a||(null==a||null==(n=a.fields)?void 0:n.secondaryPersonId)===(null==l?void 0:l.personId))?d+=" For You & ".concat(l.firstName):o&&(d+=" For ".concat(o)),d)})({service:n,secondaryOnAccount:a,indicationOfInterest:i,forUserOnly:d,checkholderOnAccountName:r}),tag:a5(null==i?void 0:i.status,null==i?void 0:i.updatedAt),actions:m&&[m],theme:"inCollapsible",keepConfirmModalOpenWhileLoading:!0}):(0,l.Y)(w.A,{onClick:()=>{var e;return null==m||null==(e=m.onClick)?void 0:e.call(m)},isLoading:u,isFull:!0,children:null==m?void 0:m.text})]})},re=e=>{var n,i,t;let{indicationOfInterest:o,personsOnAccount:a,persons:r,userId:d,onRequest:s,onRemove:c,isJointAdultApplication:u,service:p,accountAddresses:m}=e,h=a?null==a?void 0:a.find(e=>(null==e?void 0:e.personId)===d):null==r?void 0:r.find(e=>(null==e?void 0:e.id)===d);if(a){let e=null,t=null;u?e=o?null!=(n=null==a?void 0:a.find(e=>(null==e?void 0:e.personId)===(null==o?void 0:o.personId)))?n:null:h:(e=h,t=null!=(i=null==a?void 0:a.find(e=>(null==e?void 0:e.personId)!==d))?i:null);let r=(null==e?void 0:e.personId)===d?"You":null==e?void 0:e.firstName,v=a6({defaultAddressSelection:a3(p),entity:e,account:m});return o||(null==t?void 0:t.status)!=="booked"||u?(0,l.Y)(a7,{service:p,checkholderOnAccountName:r,indicationOfInterest:o,secondaryOnAccount:t,onRequest:s,onRemove:c,shippingAddress:v}):(0,l.FD)(l.FK,{children:[(0,l.FD)("h4",{css:e=>a4.cardHeader(e),children:["For ",r]}),(0,l.Y)(a7,{onRequest:s,onRemove:c,forUserOnly:!0,service:p,shippingAddress:v}),(0,l.FD)("div",{css:{marginTop:"1rem"},children:[(0,l.FD)("h4",{css:e=>a4.cardHeader(e),children:["For ",r," & ",null==t?void 0:t.firstName]}),(0,l.Y)(a7,{onRequest:s,onRemove:c,service:p,secondaryOnAccount:t,shippingAddress:v})]})]})}if(r){let e,n=(null==(e=u?o?null!=(t=null==r?void 0:r.find(e=>(null==e?void 0:e.id)===(null==o?void 0:o.personId)))?t:null:h:null!=h?h:null)?void 0:e.id)===d?"You":null==e?void 0:e.firstName,i=a6({defaultAddressSelection:a3(p),entity:e,account:m});return(0,l.Y)(a7,{service:p,checkholderOnAccountName:n,indicationOfInterest:o,secondaryOnAccount:null,onRequest:s,onRemove:c,shippingAddress:i})}return null},rn=e=>{let{service:n,indicationOfInterest:i,personsOnAccount:t,persons:o,userId:a,onRequest:r,onRemove:d,isJointAdultApplication:s,accountAddresses:c}=e,u=r?e=>
1{let i="Request submitted. ".concat(n.confirmation).concat(n.confirmation&&".");return r({ioiRequestData:{type:"checks",serviceId:null==n?void 0:n.id,...e?{secondaryPersonId:e}:{}},successMessage:i})}:null,p=d&&!n.automated&&a===(null==i?void 0:i.personId)?e=>d(e,"This check order has been canceled"):null,m=i?n.confirmation:n.description;return(0,l.FD)("div",{css:a4.container,children:[m&&(0,l.Y)("h6",{css:e=>a4.description(e),children:(0,l.Y)(e6.A,{source:m,isInline:!1})}),(0,l.Y)(re,{indicationOfInterest:i,isJointAdultApplication:s,personsOnAccount:t,persons:o,userId:a,service:n,accountAddresses:c,onRequest:u,onRemove:p})]})},ri={achOrigination:"ach-origination",atmCard:"debit-card",beneficiary:"user",contingentBeneficiary:"user",directDeposit:"transfer",billPay:"bill-pay",checks:"checks",courierServiceCash:"delivery",courierServiceNoCash:"delivery",creditCard:"credit-card",debitCard:"debit-card",eStatements:"email",facsimileStamp:"product-settings",fundsTransferAgreement:"transfer",linkedCard:"link",merchantServices:"merchant-services",onlineBanking:"online-banking",overdraftProtection:"overdraft-protection",specSheet:"invoice",twoSignaturesRequired:"signature",wireOrigination:"wire-origination",treasuryManagement:"treasury-management",loans:"loans",documentWithHand:"document-with-hand",penSigningPaper:"pen-signing-paper",browserWithPhone:"browser-with-phone",clipboardWithPen:"clipboard-with-pen",handOfferingCard:"hand-offering-card",usersWithMoney:"users-with-money",updateInformation:"complete-details"},rt=e=>{var n,i,t;let{indicationsOfInterest:l,service:o,getCollapsibleContentComponent:a}=e;return{id:o.id,type:o.type,title:o.name,description:o.description,autoApply:o.autoApply,icon:"custom"===o.type?ri[o.icon]:ri[o.type],status:null==l||null==(i=l.find)||null==(n=i.call(l,e=>(null==e?void 0:e.serviceId)===o.id))?void 0:n.status,collapsibleContent:a?a(o):null,qualifyingServiceIds:null!=(t=o.qualifyingServiceIds)?t:[],expandedInSelfServeByDefault:!!o.expandedInSelfServeByDefault,isMembershipService:o.isMembershipService,onePerMembership:o.onePerMembership}},rl=e=>{let{eligibleServices:n,serviceType:i,indicationsOfInterest:t,getCollapsibleContentComponent:l}=e,o=null==n?void 0:n.filter(e=>e.type===i);return o?o.map(e=>rt({service:e,getCollapsibleContentComponent:l,indicationsOfInterest:t})):[]},ro=e=>{let{eligibleServices:n,indicationsOfInterest:i,cardHolders:t,isJointAdultApplication:o,userId:a,persons:r,personsOnAccount:d,accountAddresses:s,getCollapsibleContentComponent:c,onRequest:u,onRemove:p,applicationId:m}=e,h=n.filter(e=>![...nr.K4,"checks","beneficiary","contingentBeneficiary","directDeposit",...aG.CB].includes(e.type)).map(e=>rt({service:e,indicationsOfInterest:i,getCollapsibleContentComponent:c})),v=(e=>{var n;let{eligibleServices:i,cardHolders:t,onRequest:o,onRemove:a,isOnOnboardingView:r}=e,{bookedCard:d,cardIOI:s,eligibleCardServices:c}=null!=(n=null==t?void 0:t[0])?n:{},u=(null==s?void 0:s.type)==="linkedCard";return c&&(null==c?void 0:c.length)>0||d||s?[{id:"card",cardServices:i.filter(e=>nr.K4.includes(e.type)),icon:"debit-card",title:"Add a Card",...(null==t?void 0:t.length)>1?{}:{status:u?"linked":null==s?void 0:s.status},collapsibleContent:(0,l.Y)(a9,{isLinkedCard:u,cardHolders:t,services:i,onRequest:o,onRemove:a,isOnOnboardingView:r}),expandedInSelfServeByDefault:!!i.find(e=>e.expandedInSelfServeByDefault)}]:[]})({eligibleServices:n,cardHolders:t,onRequest:(e,n)=>u({ioiRequestData:e,successMessage:n}),onRemove:p,isOnOnboardingView:!!d}),g=(e=>{let{eligibleServices:n,indicationsOfInterest:i,isJointAdultApplication:t,userId:o,persons:a,personsOnAccount:r,accountAddresses:d,onRequest:s,onRemove:c}=e,u=null==n?void 0:n.filter(e=>"checks"===e.type);return u?u.map(e=>{let n=rt({service:e,indicationsOfInterest:i}),u=i.find(e=>e.serviceId===(null==n?void 0:n.id));return{...n,collapsibleContent:(0,l.Y)(rn,{service:e,indicationOfInterest:u,personsOnAccount:null!=r?r:[],persons:a,accountAddresses:d,onRequest:s,onRemove:c,isJointAdultApplication:t,userId:o})}}):[]})({indicationsOfInterest:i,eligibleServices:n,isJointAdultApplication:o,userId:a,persons:r,personsOnAccount:d,accountAddresses:s,onRequest:e=>{let{ioiRequestData:n,successMessage:i}=e;return u({ioiRequestData:n,successMessage:i})},onRemove:p}),f=[...h,...v,...g];return m&&(f=[...f,...rl({indicationsOfInterest:i,eligibleServices:n,getCollapsibleContentComponent:c,serviceType:"beneficiary"}),...rl({indicationsOfInterest:i,eligibleServices:n,getCollapsibleContentComponent:c,serviceType:"contingentBeneficiary"})]),f},ra=e=>{let n={},i=[];
1return e.forEach(e=>{(null==e?void 0:e.id)&&(n[null==e?void 0:e.id]=e)}),e.sort((e,n)=>e.type||n.type?e.type?n.type?("rolloverFunds"===e.type||"transferFunds"===e.type)&&"rolloverFunds"!==n.type&&"transferFunds"!==n.type?-1:("rolloverFunds"===n.type||"transferFunds"===n.type)&&"rolloverFunds"!==e.type&&"transferFunds"!==e.type||e.qualifyingServiceIds&&!n.qualifyingServiceIds?1:!e.qualifyingServiceIds&&n.qualifyingServiceIds?-1:0:1:-1:0).forEach(t=>{var l;(null==t||null==(l=t.qualifyingServiceIds)?void 0:l.length)?null==t||t.qualifyingServiceIds.forEach(l=>{var o,a;let r=e.find(e=>(null==e?void 0:e.id)==="card"),d=null==r||null==(a=r.cardServices)||null==(o=a.find(e=>(null==e?void 0:e.id)===l))?void 0:o.type,s=d&&nr.K4.includes(d)?n.card:n[l];if(!s)return;let c=i.findIndex(e=>(null==e?void 0:e.id)===s.id);-1!==c&&i.splice(c+1,0,t)}):i.push(t)}),i.filter(Boolean)},rr="beneficiaryMatchesOwnerOrSigner",rd="This Tax ID is already associated with an owner or signer on this account and cannot be added as a beneficiary.",rs={container:{marginBottom:"1rem"},name:{fontWeight:"bold"},headerRow:{display:"flex",justifyContent:"space-between"},sectionLarge:{marginTop:"1rem"},ownershipPercentage:e=>{let{colors:n}=e;return{color:n.grey2,marginLeft:"auto"}},infoRow:{display:"flex",alignItems:"center"},actionsRow:{display:"flex",justifyContent:"space-between",marginTop:"1.25rem"},actionButton:{width:"calc(50% - 5px)"}},rc=e=>{let{beneficiary:n,onEditClick:i,onRemoveClick:t,allowTaxIdReveal:o}=e,{percentage:a}=n,r=(null==n?void 0:n.type)==="organization"?"business":"person",{fields:d}=(0,nn.A)({entityType:r}),s=(null==n?void 0:n.legalName)||(0,J.L)(n),c=(e=>{var n,i,t;let{beneficiary:o,fieldLabels:a,allowTaxIdReveal:r}=e,{dateOfBirth:d,gender:s,relationshipToCustomer:c,taxId:u,taxIdLastFour:p,phoneNumber:m,phoneMobile:h}=o,v=(0,lD.U1)(o),g=(null==o?void 0:o.type)==="organization",f=null!=p?p:null==u?void 0:u.slice(-4),y=(0,E.kK)({fieldValue:s,fieldConfig:a.gender});return[...f?[[null==(n=a.taxId)?void 0:n.displayLabel,(0,l.Y)(e8.A,{getTaxId:r&&u?()=>Promise.resolve(u):void 0,taxIdLastFour:f,isEIN:g},"taxId")]]:[],...m?[["Phone number",(0,eN.n4)(m)]]:[],...h?[["Mobile phone number",(0,eN.n4)(h)]]:[],...d?[[null==(i=a.dateOfBirth)?void 0:i.displayLabel,(0,eY.wV)(d)]]:[],...y?[[null==(t=a.gender)?void 0:t.displayLabel,y]]:[],...c?[["Relationship to customer",(0,tR.n)(c)]]:[],...v.map(e=>{var n,i,t,l,o;return[null==(n=a["address".concat(e.type)])?void 0:n.displayLabel,(0,nt.$P)({line1:null!=(i=e.addressLine1)?i:"",line2:e.addressLine2,city:null!=(t=e.addressCity)?t:"",state:null!=(l=e.addressState)?l:"",zip:null!=(o=e.addressZip)?o:"",country:e.addressCountry})]})].filter(e=>!n3()(null==e?void 0:e[1]))})({beneficiary:n,fieldLabels:d,allowTaxIdReveal:o});return(0,l.Y)("div",{css:rs.container,children:(0,l.FD)(eU.A,{flushMobile:!0,variant:"grey",children:[(0,l.FD)("div",{css:rs.headerRow,children:[(0,l.Y)(np.A.Base,{css:rs.name,children:s}),a&&(0,l.FD)(np.A.Base,{css:e=>rs.ownershipPercentage(e),children:[a,"% Share"]})]}),!!c.length&&(0,l.Y)("div",{css:rs.infoRow,children:(0,l.Y)("div",{css:rs.sectionLarge,children:(0,l.Y)(e5.A,{keyValueMap:c})})}),(!!i||!!t)&&(0,l.FD)("div",{css:rs.actionsRow,children:[(0,l.Y)("div",{css:rs.actionButton,children:(0,l.Y)(w.A,{theme:"opaque",size:"mediumPreserveCase",isFull:!0,onClick:i,children:(0,l.Y)(np.A.H5,{children:"Edit"})})}),(0,l.Y)("div",{css:rs.actionButton,children:(0,l.Y)(w.A,{theme:"opaque",size:"mediumPreserveCase",isFull:!0,onClick:t,children:(0,l.Y)(np.A.H5,{children:"Remove"})})})]})]})})},ru=(e,n)=>n.findIndex(n=>n.firstName===e.firstName&&n.lastName===e.lastName&&n.dateOfBirth===e.dateOfBirth),rp=e=>{let n={firstName:"",lastName:""};return Object.keys(e).forEach(i=>{let t=e[i];t&&"string"==typeof t&&(n[i]=t)}),n},rm=e=>e.map(e=>{let{dateOfBirth:n,...i}=e;return{...i,...n?{dateOfBirth:(0,eY.C)(n)}:{},...{percentage:i.percentage?i.percentage:void 0}}}),rh=e=>{var n,i;let{service:t,children:o,namePrefix:a,type:r}=e,d=((e,n)=>{let i=[];return i.push("".concat("organization"===n?"organizationBeneficiary":"beneficiary",":").concat("contingentBeneficiary"===e?"contingent":"primary")),"organization"===n&&i.push("einTaxIdType"),i})(t,r),s=(0,nn.A)({entityType:"beneficiary",namePrefix:a,scopes:d}
1),c={...s,isEIN:(null==s||null==(i=s.fields)||null==(n=i.taxId)?void 0:n.taxIdType)==="EIN"};return(0,l.Y)(T.A,{...c,namePrefix:a,children:o})},rv={formContainer:{padding:"1rem"},radioContainer:{display:"flex",justifyContent:"space-between",gap:"16px",marginBottom:"16px"}},rg=e=>{let{conflict:n}=e,{setError:i}=(0,S.xW)();return(0,v.useEffect)(()=>{if(!n)return;let e=()=>i("taxId",{type:"server",message:n.message});e();let t=setTimeout(e,0);return()=>clearTimeout(t)},[n]),null},rf=e=>{let{onClose:n,isOpen:i,children:t}=e;return i5.createPortal((0,l.Y)(nh.A,{onClose:n,isOpen:i,children:t}),document.body)},ry=e=>{let{beneficiaryType:n,editingBeneficiary:i=!1,isFirstBeneficiary:t=!1,setBeneficiaryType:o,beneficiaryEntityType:a,beneficiaryToEdit:r}=e,d=lE.QK.filter(e=>"firstName"===e||"lastName"===e),s=lE.QK.filter(e=>"percentage"===e),c=lE.QK.filter(e=>"percentage"!==e&&"firstName"!==e&&"lastName"!==e),{reset:u,formState:{submitCount:p,isSubmitting:m,isValid:h,isSubmitSuccessful:v}}=(0,S.xW)(),g=(0,T.d)(),f=Object.values(g.fields).some(e=>"scopedRequirements"in e&&(null==e?void 0:e.scopedRequirements)&&"organizationBeneficiary:".concat(n.toLowerCase())in e.scopedRequirements),y=e=>{u({type:e}),o(e)},I=g.getFieldIsEnabled("percentage"),A=i?"Editing ".concat(n," Beneficiary"):"New ".concat(n," Beneficiary");return(0,F.A)({submitCount:v||m?null:p,isValid:h,triggerSnackbarMessage:!1}),(0,l.FD)("div",{css:rv.formContainer,children:[(0,l.FD)(ei.A,{heading:{heading:A,isCentered:!1,theme:"small"},theme:"small",children:[f&&(0,l.FD)("div",{css:rv.radioContainer,children:[(0,l.Y)(eq.A,{name:"type",id:"type-person",type:"radio",label:"Person",value:"person",onChange:()=>y("person"),"aria-description":"Person Beneficiary",isChecked:"person"===a,isDisabled:!!(null==r?void 0:r.type),defaultChecked:(null==r?void 0:r.type)==="person"}),(0,l.Y)(eq.A,{name:"type",id:"type-organization",type:"radio",label:"Organization",value:"organization",onChange:()=>y("organization"),"aria-description":"Organization Beneficiary",isChecked:"organization"===a,isDisabled:!!(null==r?void 0:r.type),defaultChecked:(null==r?void 0:r.type)==="organization"})]}),(0,l.Y)("div",{children:(0,l.Y)(ee.A,{fieldIds:d,FieldParentElement:ls.A})}),(0,l.Y)(ee.A,{fieldIds:c}),I&&(0,l.FD)(l.FK,{children:[(0,l.Y)(np.A.Base,{css:{marginBottom:"1rem",marginTop:"0.5rem"},children:"What is this beneficiary’s allocation percentage?"}),(0,l.Y)(ee.A,{fieldIds:s}),t&&(0,l.Y)("div",{css:{marginTop:"1.5rem"},children:(0,l.Y)(Z.A,{icon:"info-circle",content:"If this is the only beneficiary, set their allocation to 100%."})})]})]}),(0,l.FD)(w.A,{type:"submit",isFull:!0,isLoading:m,isDisabled:m||!h,"data-testid":"beneficiaryFormButton",children:[i?"Edit":"Add"," Beneficiary"]})]})},rI=e=>{let{beneficiaryToEdit:n,service:i,isFirstBeneficiary:t,taxIdConflict:o,handleSubmit:a}=e,[r,d]=(0,v.useState)((null==n?void 0:n.type)||"person");return(0,l.Y)(rh,{service:null==i?void 0:i.type,type:r,namePrefix:"",children:(0,l.FD)(y.A,{initialValues:n?{...n,type:n.type||r,...n.dateOfBirth?{dateOfBirth:(0,eY.jo)(n.dateOfBirth)}:{}}:null,onSubmit:e=>a(e,r),children:[(0,l.Y)(ry,{beneficiaryType:"beneficiary"===i.type?"Primary":"Contingent",editingBeneficiary:!!n,isFirstBeneficiary:t,setBeneficiaryType:d,beneficiaryEntityType:r,beneficiaryToEdit:n}),(0,l.Y)(rg,{conflict:o})]})})},rA=e=>{let{service:n,modalIsOpen:i,onClose:t,onSubmit:o,beneficiaryToEdit:a,ownershipPercentage:r,isFirstBeneficiary:d=!1,taxIdConflict:s}=e,{triggerMessage:c}=(0,f.d)(),u=async(e,n)=>{if(null==e?void 0:e.percentage){let n=parseInt(null==e?void 0:e.percentage),i=(r||0)+n-(a&&(null==a?void 0:a.percentage)?parseInt(null==a?void 0:a.percentage):0);if(i>100)return void c("Combined allocation percentage must equal 100% in order to save beneficiaries (currently at ".concat(i,"%)."),{theme:"error"})}o({beneficiary:{type:n,...e,...e.dateOfBirth?{dateOfBirth:(0,eY.C)(e.dateOfBirth)}:{}},isExisting:!!a})};return(0,l.Y)(rf,{isOpen:i,onClose:t,children:(0,l.Y)(rI,{service:n,beneficiaryToEdit:a,isFirstBeneficiary:d,taxIdConflict:s,handleSubmit:u})})},rb={description:e=>{let{fontScales:n,colors:i}=e;return{...n.small,textAlign:"left",paddingBottom:"0.75rem",color:i.grey7}},container:{cursor:"default"}},rC=e=>{var n,i;let{indicationOfInterest:t,onRequest:o,service:a}=e;return(0,l.FD)(l.FK,{children:[t||a.informationalOnly?null:(0,l.Y)(w.A,{onClick:o,isFull:!0,children:"Request"}),!!t&&(null==t||null==(i=t.fields)||null==(n=i.beneficiary)?void 0:n.map(e=>(0,l.Y)(rc,{beneficiary:e},"".concat(t.id).concat(e.firstName))))]})},rS=e=>{let{service:n,indicationOfInterest:i,onRequest:t}
1=e,[o,a]=(0,v.useState)(!1),[r,d]=(0,v.useState)(null),s="beneficiary"===n.type&&!!n.collectSignature;(0,v.useEffect)(()=>{a(!1),d(null)},[i]);let c=async e=>{let{beneficiary:i}=e,l=n.maximumBeneficiaries>1,o=rp(i);if(l)t({beneficiary:[{...o,...(null==o?void 0:o.dateOfBirth)?{dateOfBirth:(0,eY.C)(o.dateOfBirth)}:{}}],service:n});else{var a;let e=await t({beneficiaryIoiRequestData:{beneficiary:rm([o]),type:n.type,serviceId:n.id},service:n});(null==e||null==(a=e.beneficiaryConflicts)?void 0:a.length)&&d({message:rd})}},u=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=arguments.length>1?arguments[1]:void 0;return!e&&n.description?n.description:e?"Contact your institution to modify your ".concat("beneficiary"===n.type?"primary":"contingent"," beneficiary arrangement."):null}(!!i,n);return(0,l.Y)(l.FK,{children:(0,l.FD)("div",{css:rb.container,children:[u&&(0,l.Y)("h6",{css:e=>rb.description(e),children:(0,l.Y)(e6.A,{source:u,isInline:!1})}),(0,l.Y)(rC,{indicationOfInterest:i,onRequest:()=>{if(s)return void t({service:n});d(null),a(!0)},service:n}),(0,l.Y)(rA,{service:n,modalIsOpen:o,onClose:()=>{a(!1),d(null)},onSubmit:c,isFirstBeneficiary:!0,taxIdConflict:r})]})})},rw=()=>.05>Math.random(),rx=()=>.05>Math.random(),rF=()=>new Promise((e,n)=>setTimeout(()=>{rw()&&n(Error("Dummy Network Error")),rx()&&n(Error("Dummy Internal Server Error: Enrollment failed")),e()},500)),rY=()=>.5>Math.random(),rT=(e,n)=>{let i=void 0!==n?e:0;return Math.floor(Math.random()*((void 0!==n?n:e)-i+1))+i},rD=(e,n)=>rY()?rT(e,n):void 0,rE={minLength:6,maxLength:256,disallowedChars:["@","$","*","_","-","=",".","!","~"]},rk={minLength:6,maxLength:32,minNumerical:1,minUpperAlphabetical:1,minLowerAlphabetical:1,minAlphaNumerical:1,minSpecialChars:1,maxDuplicateChars:2,maxConsecutiveSpecialChars:2,disallowedChars:[">","<"],disallowUsername:!0},rP={minLength:rT(3,10),maxLength:rD(16,42),minAlphaNumerical:rD(5),maxAlphaNumerical:rD(6,17),minSpecialChars:rD(5),maxSpecialChars:rD(6,17),disallowedChars:rY()?[]:["@","$","*","_","-","=",".","!","~"].slice(0,rT(10))},rO={minLength:rT(3,10),maxLength:rD(16,42),minNumerical:rD(5),minUpperAlphabetical:rD(5),minLowerAlphabetical:rD(5),maxDuplicateChars:rD(3),maxConsecutiveChars:rD(5),maxConsecutiveSpecialChars:rD(3),disallowNonASCII:rY(),disallowedChars:rY()?[]:["%","$","@","#"].slice(0,rT(4)),allowedSpecialChars:rY()?void 0:["_","-","!","&"].slice(0,rT(1,4)),minAlphabetical:rD(5),minSpecialChars:rD(5),disallowUsername:rY(),disallowedWords:rY()?void 0:["password"]},rR=()=>({username:rE,password:rk}),rL=()=>({username:rP,password:rO}),rN=e=>{let{computeSuccessResponse:n,computeFailureResponse:i}=e,[t,l]=(0,v.useState)(!1),[o,a]=(0,v.useState)(void 0),[r,d]=(0,v.useState)(void 0);return{performRequest:(0,v.useCallback)(async e=>{l(!0),a(void 0);try{await rF();let i=n(e);return d(i),{result:{code:200,timestamp:new Date().toISOString()},data:i}}catch(n){return a(n),d(i(e)),{result:{code:500,timestamp:new Date().toISOString()},errors:n}}finally{l(!1)}},[]),loading:t,error:o,response:r}},rB=(e,n)=>({enrollmentPreflow:{credentialCreationPolicies:n?void 0:e,outboundRedirect:n?{url:"https://www.google.com",newTab:!0}:void 0}}),rM=()=>{let e=.1>Math.random();return rB(rL(),e)},rz=()=>rB(rR(),!1),rV=()=>({enrollmentPreflow:{credentialCreationPolicies:void 0,outboundRedirect:void 0}}),r_=()=>{var e,n;let{performRequest:i,loading:t,error:l,response:o}=rN({computeSuccessResponse:rM,computeFailureResponse:rV});return{enrollmentPreflow:i,outboundRedirect:null==o||null==(e=o.enrollmentPreflow)?void 0:e.outboundRedirect,credentialCreationPolicies:null==o||null==(n=o.enrollmentPreflow)?void 0:n.credentialCreationPolicies,loading:t,error:l}},rU=e=>{let{variables:{username:n}}=e;return{checkUsername:{isAvailable:"takenUsername"!==n}}},rq=()=>({checkUsername:{isAvailable:void 0}}),rH=()=>{var e;let{performRequest:n,loading:i,error:t,response:l}=rN({computeSuccessResponse:rU,computeFailureResponse:rq});return{checkUsername:n,usernameIsAvailable:null==l||null==(e=l.checkUsername)?void 0:e.isAvailable,loading:i,error:t}},rK=e=>{let n,{success:i,usernameAndPasswordErrors:t,data:l,failSafeUrl:o}=e,a="https://www.mantl.com/";return i||t?!i&&t&&(a=""):(n="Dummy Error!",a=""),{enrollUser:{success:!!i,errors:n,outboundRedirectUrl:a,...!i&&t?t:{},data:l,failSafeUrl:o}}},rj=e=>{let{usernameAndPasswordErrors:n,failSafeUrl:i}=e;return rK({success:!1,usernameAndPasswordErrors:n,failSafeUrl:i})},rW=()=>{let{performRequest:e,loading:n,error:i}=rN({computeSuccessResponse:rK,computeFailureResponse:rj});return{enrollUser:e,loading:n,error:i}},rG=e=>()=>{let n=(null==e?void 0:e.shouldError)?rj({usernameAndPasswordErrors:null==e?void 0:e.usernameAndPasswordErrors,failSafeUrl:null==e?void 0:e.failSafeUrl}):rK({success:!0,data:null==e?void 0:e.data,failSafeUrl:null==e?void 0:e.failSafeUrl});return{enrollUser:async()=>({data:n,errors:(null==e?void 0:e.shouldError)&&!e.usernameAndPasswordErrors?Error("Dummy error!"):void 0}),...n.enrollUser,loading:!1,error:void 0}},r$=e=>()=>{let n=(null==e?void 0:e.shouldError)?rq():rU({variables:{username:"banana"}});return{usernameIsAvailable:!0,checkUsername:async()=>({data:n,errors:(null==e?void 0:e.shouldError)?Error("Dummy error!"):void 0}),...n.checkUsername,loading:!1,error:void 0}},rQ=e=>()=>{let n=(null==e?void 0:e.shouldError)?rV():rz();return{enrollmentPreflow:async()=>({data:n,errors:(null==e?void 0:e.shouldError)?Error("Dummy error!"):void 0}),...n.enrollmentPreflow,loading:!1,error:void 0}},rJ=(0,ir.rI)({},"ManageAccountEnrollmentHooksContext"),rZ=(0,ir.rI)({},"EnrollmentSheetHooksContext");rJ.displayName="ManageAccountEnrollmentHooksContext",rZ.displayName="EnrollmentSheetHooksContext";let rX={ManageAccountEnrollmentHooksContext:rJ,EnrollmentSheetHooksContext:rZ},r0={container:{cursor:"default"},description:e=>{let{fontScales:n,colors:i}=e;return{...n.small,textAlign:"left",paddingBottom:"0.75rem",color:i.grey7}}}
1,r9=(e,n)=>null==n?void 0:n.some(n=>n===e.type),r1=e=>{let{indicationOfInterest:n,action:i,service:t,membershipServices:o}=e;return(0,l.Y)(a$.A,{title:null==t?void 0:t.name,tag:a5(null==n?void 0:n.status,null==n?void 0:n.updatedAt,r9(t,o)),actions:i&&[i],theme:"inCollapsible"})},r2=e=>{let{service:n,indicationOfInterest:i,membershipServices:t,onRequest:o,onRemove:a}=e,r=o?()=>{let e=n.confirmation||"Request Submitted.";return o({ioiRequestData:{type:n.type,serviceId:n.id},successMessage:e})}:null,d=a?e=>a(e,"Service Cancelled"):null,s=r9(n,t),c=(null==i?void 0:i.id)?d:r||(()=>null),{isLoading:u,onClick:p}=(0,iB.A)({onClick:c}),m=s?null:(e=>{let{status:n,serviceType:i,onClick:t,onRemove:l,isLoading:o,service:a}=e;switch(n){case"processing":case"complete":return null;case"awaitingRetry":case"pending":case"failed":return!l||(null==a?void 0:a.automated)?null:{text:"Remove",isLoading:o,onClick:t,confirm:{heading:"Cancel Request",icon:"cancel",subheading:"Are you sure you want to remove this service?",buttonText:"Yes, Cancel Request",onConfirm:t}};default:return{text:"overdraftProtection"===i?"Enable":"Request",onClick:t,isLoading:o}}})({service:n,status:null==i?void 0:i.status,serviceType:null==n?void 0:n.type,onClick:()=>p(null==i?void 0:i.id),isLoading:u,onRemove:a});return(0,l.FD)("div",{css:r0.container,children:[n.description&&(0,l.Y)("h6",{css:e=>r0.description(e),children:(0,l.Y)(e6.A,{source:n.description,isInline:!1})}),(null==i?void 0:i.status)||s?(0,l.Y)(r1,{indicationOfInterest:i,action:n.informationalOnly?null:m,service:n,membershipServices:t}):n.informationalOnly?null:(0,l.Y)(w.A,{onClick:null==m?void 0:m.onClick,isFull:!0,isLoading:u,children:null==m?void 0:m.text})]})},r6={onboardingSurveyWrapper:e=>({marginTop:24,paddingTop:"12px",paddingBottom:"max(12px, env(safe-area-inset-bottom))"}),contentHeaderGroup:{display:"flex",alignItems:"center",marginBottom:"1.75rem"},contentHeaderGroupIcon:{marginRight:"1rem"},autoAppliedContainer:(e,n)=>{let{colors:i,borderShape:t}=e;return{border:"1px solid ".concat(i.grey3),borderRadius:n?(0,n8.N)(t):"0.5rem",padding:"0.25rem 1rem"}},autoAppliedService:e=>{let{colors:n}=e;return{"&:not(:last-child)":{borderBottom:"1px solid ".concat(n.grey3)},"> button":{padding:0,pointerEvents:"none"},"> button > div > div:last-child":{display:"none"}}},infoBox:{marginTop:"1.5rem"},infoBoxContent:{marginTop:"-0.5rem",marginBottom:"2rem"},triggerAnimation:{"&.enter":{opacity:0,minHeight:0,maxHeight:0,overflow:"hidden"},"&.enter-active":{opacity:1,minHeight:0,maxHeight:"69px",overflow:"hidden",transition:"opacity 300ms linear, max-height 250ms cubic-bezier(.47,1.64,.41,.8)"},"&.exit":{opacity:1,minHeight:0,maxHeight:"69px",overflow:"hidden"},"&.exit-active":{opacity:0,minHeight:0,maxHeight:0,overflow:"hidden",margin:0,transition:"opacity 175ms 125ms linear, max-height 100ms 225ms cubic-bezier(.47,1.64,.41,.8), margin 100ms 225ms linear"}}};var r5=function(e){return e.GET_STARTED="GET_STARTED",e.RESUME="RESUME",e.LOGIN_OTHER="LOGIN_OTHER",e.ADJUST="ADJUST",e}(r5||{});let r4={directDepositSwitchCollapsibleContent:e=>{let{colors:n}=e;return{padding:"1.5rem",backgroundColor:n.grey4,borderRadius:"0.5rem",display:"flex",flexDirection:"column",gap:"1rem"}},directDepositSwitchCollapsibleContentHeader:e=>{let{colors:n}=e;return{fontSize:"1rem",color:n.grey7,fontWeight:700}},directDepositSwitchCollapsibleContentButtons:{display:"flex",gap:"1rem",flexDirection:"row","& button":{width:"100%"}},directDepositSwitchCollapsibleContentIcon:{width:"200px",height:"40px",backgroundImage:"url(/static/images/direct-deposit-logo-group.png)",backgroundSize:"contain",backgroundRepeat:"no-repeat",backgroundPosition:"center"},directDepositSwitchPendingText:e=>{let{colors:n}=e;return{color:n.grey2}}},r3=e=>{let{accountId:n,service:i,existingDirectDepositSwitchIois:t,onOpenPinwheelModal:o,isWaitingForPinwheelToken:a}=e,[r,d]=(0,v.useState)(null),s=t.sort((e,n)=>new Date(n.createdAt).getTime()-new Date(e.createdAt).getTime())[0],c=null==s?void 0:s.status,u=aW({status:c,type:i.type}),p=i.description||"Tell us who pays you, and we&apos;ll find them and help you get set up.",m=e=>{let{buttonType:n,reAuthenticate:i}=e;d(n),o({reAuthenticate:i})};return(0,v.useEffect)(()=>{a||d(null)}
1,[a]),(0,l.Y)(a_.A,{timeout:750,css:r6.triggerAnimation,children:(0,l.Y)(V.A,{"aria-label":i.name,icon:ri[i.type],title:i.name,collapsibleContent:(0,l.Y)("div",{css:e=>r4.directDepositSwitchCollapsibleContent(e),children:"pending"===c?(0,l.Y)("p",{css:r4.directDepositSwitchPendingText,children:"The direct deposit switch is currently processing. You will be able to update the direct deposit details or add additional direct deposits once the switch is complete."}):(0,l.FD)(l.FK,{children:[(0,l.FD)("div",{children:[(0,l.Y)("h6",{css:r4.directDepositSwitchCollapsibleContentHeader,children:"Find Your Employer"}),(0,l.Y)("p",{children:(0,l.Y)(e6.A,{source:p})})]}),(0,l.Y)("div",{css:r4.directDepositSwitchCollapsibleContentIcon}),(()=>{var e;let i,{pinwheelAccountId:t,accountId:o}=JSON.parse(null!=(e=window.localStorage.getItem("pinwheelData"))?e:"{}");return s||t&&o===n?(0,l.FD)("div",{css:r4.directDepositSwitchCollapsibleContentButtons,children:[(0,l.Y)(w.A,{onClick:()=>m({buttonType:s?"ADJUST":"RESUME"}),isLoading:(i=s?"ADJUST":"RESUME",a&&r===i),children:s?"Adjust Current Setup":"Resume Setup"}),(0,l.Y)(w.A,{onClick:()=>m({buttonType:"LOGIN_OTHER",reAuthenticate:!0}),theme:"secondary",isLoading:a&&"LOGIN_OTHER"===r,children:"Login to Another Provider"})]}):(0,l.Y)(w.A,{onClick:()=>m({buttonType:"GET_STARTED",reAuthenticate:!0}),isLoading:a&&"GET_STARTED"===r,children:"Get Started"})})()]})}),description:null,tag:u,hideTagWhenCollapsed:!1,collapsibleDefaultOpen:"complete"!==c})})};var r8=i(27237),r7=i(85294);let de={description:e=>{let{fontScales:n,colors:i}=e;return{...n.small,textAlign:"left",paddingBottom:"0.75rem",color:i.grey7}},container:{cursor:"default"},applicantEmail:e=>{let{colors:n,fontScales:i}=e;return{...i.small,color:n.grey1,marginBottom:8}}},dn=e=>{let{status:n,updatedAt:i}=e,t=i&&"on ".concat((0,eY.wV)(i,{dateFormat:eY.Kn.LONG_MONTH_DAY_YEAR}));switch(n){case"booked":return{text:"Added",theme:"success",note:t};case"pending":return{text:"Pending Approval",theme:"info",note:t};default:return{}}},di=e=>{var n,i,t,a;let{personsOnAccount:r,allowConsumerFiduciaryAuthSigners:d,allowConsumerFiduciaryAccountOwners:s,account:c,product:u,userId:p,onCancelApplication:m,onGoToAddJointOwners:h}=e,{experiences:{selfServe:{pages:{onboarding:{addJointOwnerSubheader:g}}}}}=(0,D.t)(),[f,y]=(0,v.useState)(!1),{addJointOwner:I,clearJointOwners:A}=(0,i6.P1)(),b=d?"Add Authorized Signers":"Add Joint Owners",C=c&&(null==(n=c.fields)?void 0:n.accountVariant)&&(null==u?void 0:u.accountVariants)?(0,o.Gm)(c.fields.accountVariant,{accountVariants:u.accountVariants,name:u.name}):null,S=null==r?void 0:r.filter(e=>{if(C&&(null==c?void 0:c.fields)){var n,i,t,l;if("fiduciary"===C.ownershipType){let{primaryApplicationRole:n}=C;return s?(null==e?void 0:e.relationshipType)==="secondary":(null==(l=c.fields.newAccountRelationshipD
1ata)||null==(t=l.find(e=>e.role===n))?void 0:t.relationshipToAccount)!==(null==e?void 0:e.relationshipType)}let o=null==(i=c.fields.newAccountRelationshipData)||null==(n=i.find(e=>e.isPrimaryEntity))?void 0:n.relationshipToAccount;if(o)return o!==(null==e?void 0:e.relationshipType)}return(null==e?void 0:e.personId)!==p}).filter(Boolean),x=null==S?void 0:S.filter(e=>"booked"===e.status),F=ns()(null==S?void 0:S.filter(e=>"pending"===e.status),e=>e.applicationId),Y=null!=(t=null==r?void 0:r.some(e=>(null==e?void 0:e.status)==="pending"))&&t,{hasMaxJointOwnership:E}=iX({totalExistingSecondaryAccountOwners:null!=(a=null==r?void 0:r.filter(e=>(null==e?void 0:e.status)==="booked"&&"secondary"===e.relationshipType).length)?a:0,accountVariant:null==c||null==(i=c.fields)?void 0:i.accountVariant,product:u,hasPendingCDASO:Y}),k=d||!E,P=(0,i0.X)({isCreditUnionMember:!1,isNonresidentAlien:!1,isResidentAlien:!1,isMissingTaxId:!1,isAddingJointOwner:!0,hasUsAddress:null}),O=(0,nn.A)({entityType:"person",scopes:P});return(0,l.Y)(T.A,{...O,children:(0,l.FD)("div",{css:de.container,children:[(0,l.Y)("h6",{css:e=>de.description(e),children:(0,l.Y)(e6.A,{source:g||"Manage the people who have full access to your account",isInline:!1})}),(null==x?void 0:x.length)?x.map(e=>(0,l.Y)(a$.A,{title:(0,J.L)(e),description:e.emailPrimary,tag:dn(e)},e.personId)):null,Object.entries(F).map(e=>{let[n,i]=e;return(0,l.Y)(a$.A,{tag:dn(i[0]),...(e=>{let{status:n,...i}=e;return"pending"===n?{actions:[{text:"Cancel","aria-label":"Cancel invitation to invited joint owners",confirm:{heading:"This will cancel this pending invitation.<br>Are you sure?",buttonText:"Yes, Cancel Invitation",onConfirm:()=>!!(null==i?void 0:i.applicationId)&&m({applicationId:null==i?void 0:i.applicationId})}}]}:{actions:[]}})(i[0]),children:i.map(e=>(0,l.FD)("div",{children:[(0,l.Y)(np.A.Base,{children:(0,J.L)(e)}),(0,l.Y)("p",{css:de.applicantEmail,children:e.emailPrimary})]},e.personId))},n)}),k&&(0,l.Y)(w.A,{onClick:()=>y(!0),isFull:!0,children:b}),(0,l.Y)(te,{modalIsOpen:f,onSubmit:e=>{A(),I(e),y(!1),h()},onModalClose:()=>y(!1),allowConsumerFiduciaryAuthSigners:d})]})})},dt=()=>{let{reset:e,formState:{isSubmitSuccessful:n}}=(0,S.xW)();(0,v.useEffect)(()=>{e()},[n])},dl={inviteContainer:{marginTop:40},container:{cursor:"default"},description:e=>{let{fontScales:n,colors:i}=e;return{...n.small,textAlign:"left",paddingBottom:"0.75rem",color:i.grey7}},inviteHeading:{textAlign:"left",marginBottom:15}},da=()=>{let{formState:{submitCount:e,isSubmitting:n,isValid:i,isSubmitSuccessful:t}}=(0,S.xW)();return dt(),(0,F.A)({submitCount:t||n?null:e,isValid:i,message:"Please fix missing or invalid fields before continuing."}),(0,l.FD)(l.FK,{children:[(0,l.FD)(en.A,{applicationFields:{},applicationType:"businessDepositAddAuthorizedSigner",originatingExperience:"selfServe",isMissingTaxId:!1,kycEvaluationTags:[],systemRequiredFields:["emailPrimary"],children:[(0,l.Y)(Y.A,{fieldId:"firstName",label:"Enter signer's first name"}),(0,l.Y)(Y.A,{fieldId:"emailPrimary",label:"Enter an email to invite"})]}),(0,l.Y)(w.A,{name:"inviteEmail",type:"submit",size:"small",theme:"outline",isDisabled:n,isLoading:n,children:"invite"})]})},dr=e=>{let{personsOnAccount:n,onInvite:i,onResend:t,onCancelApplication:o,onRemoveSigner:a,isReminding:r,isCanceling:d,userId:s}=e,[c,u]=(0,v.useState)(),[p,m]=(0,v.useState)(),{triggerMessage:h}=(0,f.d)(),{isLoading:g}=(0,iB.A)({onClick:i||o}),{mantlFeatures:I}=(0,D.t)(),A=I.accountOpening.allowRemoveAuthorizedSignerFromBusinessAccount.enabled,b=d||r,C=async e=>{let{emailPrimary:n,firstName:t}=e;n&&t&&await i({emailPrimary:n,firstName:t})};return(0,l.FD)("div",{css:dl.container,children:[(0,l.FD)("div",{children:[(0,l.Y)("h6",{css:e=>dl.description(e),children:"Manage who is on your team and authorized to transact on the account"}),null==n?void 0:n.map(e=>{(0,Q.Z1)(e);let{emailPrimary:n,firstName:r,personId:v}=e,f=(0,J.L)(e),y=r?", ".concat(n):null,I=d?c===v:p===v,C=b&&I,S=b&&!I;return(0,l.Y)(a$.A,{theme:"grouped",title:f,infoText:y,tag:(e=>{let{status:n,updatedAt:i}=e,t=i&&"on ".concat((0,eY.wV)(i,{dateFormat:eY.Kn.LONG_MONTH_DAY_YEAR}));switch(n){case"booked":return{text:"Added",theme:"success",note:t};
1case"pending":return{text:"Invited",theme:"info",note:t};default:return{text:"Not On Account",theme:"neutral"}}})(e),...(e=>{let{status:n,...l}=e;(0,Q.Z1)(l);let{emailPrimary:r,firstName:d,personId:v,relationshipPersonAccountId:f}=l,y=(0,J.L)(l);switch(n){case"booked":if(!A)return[];return{actions:[{text:"Remove","aria-label":"Remove ".concat(y),theme:"neutralLink",isLoading:g&&c===v,confirm:{heading:"Remove Signer",subheading:"Are you sure you want to remove this Signer?",buttonText:"Yes, Remove Signer",icon:"illustration-people",onConfirm:()=>(u(v),f)?a({relationshipPersonAccountId:f}):void h("Applicant does not have a relationship to this account",{theme:"error"})}}]};case"pending":return{actionsMenu:{toggleText:"Options","aria-label":"View options",actions:[{text:"Cancel Invitation","aria-label":"Cancel invitation to ".concat(y),confirm:{heading:"Cancel Invitation",subheading:"Are you sure you want to cancel this invitation?",buttonText:"Yes, Cancel Invitation",icon:"illustration-people",onConfirm:()=>{u(v),o({applicationId:null==l?void 0:l.applicationId})}}},{text:"Resend Invitation","aria-label":"Resend invitation to ".concat(y),confirm:{heading:"Resend Invitation",subheading:"Are you sure you want to resend this invitation?",buttonText:"Yes, Resend Invitation",icon:"illustration-people",onConfirm:()=>(m(v),t({applicationId:null==l?void 0:l.applicationId}))}}]}};default:{let e=s===v?"Add":"Invite";return{actions:[{text:e,"aria-label":"".concat(e," ").concat(y),theme:"outline",isLoading:g&&p===v,confirm:{heading:"Add Signer",subheading:"Are you sure you want to add this Signer?",buttonText:"Yes, Add Signer",icon:"illustration-people",onConfirm:()=>(m(v),r)?i({emailPrimary:r,firstName:d||"",isExistingPerson:!0,personId:v}):void h("Applicant is missing an email address",{theme:"error"})}}]}}}})(e),isLoading:C,isDisabled:S},n)})]}),(0,l.FD)("div",{css:dl.inviteContainer,children:[(0,l.Y)(np.A.H2,{theme:"small",css:dl.inviteHeading,children:"Invite new signers"}),(0,l.Y)(y.A,{onSubmit:C,onSubmitError:e=>{if("EXISTING_EMAIL"!==e.message)throw e},children:(0,l.Y)(da,{})})]})]})},dd={description:e=>{let{fontScales:n,colors:i}=e;return(0,nf.css)({...n.small,textAlign:"left",paddingBottom:"0.75rem",color:i.grey7})},container:{cursor:"default"},formContainer:{textAlign:"left"}},ds=e=>{let{allowConsumerFiduciaryAuthSigners:n}=e,{formState:{submitCount:i,isSubmitting:t,isValid:o,isSubmitSuccessful:a}}=(0,S.xW)();return dt(),(0,F.A)({submitCount:a||t?null:i,isValid:o,message:"Please fix missing or invalid fields before continuing."}),(0,l.FD)("div",{css:dd.formContainer,children:[(0,l.FD)(en.A,{applicationFields:{},applicationType:"consumerDepositAddSecondaryOwner",originatingExperience:"selfServe",isMissingTaxId:!1,kycEvaluationTags:[],systemRequiredFields:["emailPrimary"],children:[(0,l.Y)(Y.A,{fieldId:"firstName",label:n?"Enter signer's first name":"Enter joint owner's first name"}),(0,l.Y)(Y.A,{fieldId:"emailPrimary",label:"Enter an email to invite"})]}),(0,l.Y)(w.A,{name:"inviteEmail",type:"submit",isFull:!0,isDisabled:t,isLoading:t,children:"invite"})]})},dc=e=>{var n,i;let{application:t,product:a,applicant:r,personsOnAccount:d,personsOnOtherConsumerAccounts:s,onInvite:c,onResend:u,onCancelApplication:p,clientFullName:m,isJointAdultApplication:h,allowConsumerFiduciaryAccountOwners:v,allowConsumerFiduciaryAuthSigners:g}=e,{experiences:{selfServe:{pages:{onboarding:{addJointOwnerSubheader:I}}}}}=(0,D.t)(),{isLoading:A}=(0,iB.A)({onClick:c||p}),{triggerMessage:b}=(0,f.d)(),C=t&&(null==(n=t.fields)?void 0:n.accountVariant)&&(null==a?void 0:a.accountVariants)?(0,o.Gm)(t.fields.accountVariant,{accountVariants:a.accountVariants,name:a.name}):null,S=h?null==d?void 0:d.filter(e=>(null==e?void 0:e.personId)!==(null==r?void 0:r.id)):[null==d?void 0:d.find(e=>{var n,i,l,o,a;if(C&&(null==t||null==(n=t.fields)?void 0:n.accountVariant)){if("fiduciary"===C.ownershipType){let{primaryApplicationRole:n}=C;return v?(null==e?void 0:e.relationshipType)==="secondary":(null==(a=t.fields.newAccountRelationshipD
1ata)||null==(o=a.find(e=>e.role===n))?void 0:o.relationshipToAccount)!==(null==e?void 0:e.relationshipType)}return(null==(l=t.fields.newAccountRelationshipData)||null==(i=l.find(e=>e.isPrimaryEntity))?void 0:i.relationshipToAccount)!==(null==e?void 0:e.relationshipType)}return(null==e?void 0:e.personId)!==(null==r?void 0:r.id)})].filter(Boolean),w=(null==s||null==(i=s.filter(Boolean))?void 0:i.length)&&!(null==S?void 0:S.length)?"We've found existing profile(s) associated with your other accounts. Would you like to invite them?":(null==S?void 0:S.length)?"":I||"Enter the email of the person you want to add to this account.",x=async e=>{let{emailPrimary:n,firstName:i}=e;n&&i&&await c({emailPrimary:n,firstName:i})},F=e=>{let{status:n,...i}=e,{emailPrimary:t,firstName:l}=i,o=(0,J.L)(i);switch(n){case"booked":return{actions:[]};case"pending":return{actionsMenu:{toggleText:"Edit","aria-label":"Edit invitation to ".concat(o),isLoading:A,actions:[{text:"Cancel Invitation","aria-label":"Cancel invitation to ".concat(o),confirm:{heading:"Cancel Invitation",subheading:"Are you sure you want to cancel this invitation?",icon:"illustration-people",buttonText:"Yes, Cancel Invitation",onConfirm:()=>!!(null==i?void 0:i.applicationId)&&p({applicationId:null==i?void 0:i.applicationId})}},{text:"Resend Invitation","aria-label":"Resend invitation to ".concat(o),confirm:{heading:"Resend Invitation",subheading:"Are you sure you want to resend this invitation?",icon:"illustration-people",buttonText:"Yes, Resend Invitation",onConfirm:()=>!!(null==i?void 0:i.applicationId)&&u({applicationId:null==i?void 0:i.applicationId})}}]}};default:return{actions:[{text:"Invite","aria-label":"Invite ".concat(o),...t?{confirm:{heading:"Invite ".concat(o),icon:"illustration-people",buttonText:"Invite",onConfirm:()=>x({emailPrimary:t,firstName:l})}}:{onClick:()=>{b("This account is missing an email, please contact ".concat(m," to update their profile and try again."),{theme:"error"})}}}]}}};return(0,l.FD)("div",{css:dd.container,children:[(0,l.Y)("h6",{css:e=>dd.description(e),children:(0,l.Y)(e6.A,{source:w,isInline:!1})}),(null==S?void 0:S.length)?S.map(e=>((0,Q.Z1)(e,"owner should exist"),(0,l.Y)(a$.A,{theme:"grouped",title:(0,J.L)(e),infoText:(e=>(null==e?void 0:e.firstName)&&e.emailPrimary?", ".concat(e.emailPrimary):null)(e),tag:(e=>{let{status:n,updatedAt:i}=e,t=i&&"on ".concat((0,eY.wV)(i,{dateFormat:eY.Kn.LONG_MONTH_DAY_YEAR}));switch(n){case"booked":return{text:"Added",theme:"success",note:t};case"pending":return{text:"Invited",theme:"info",note:t};default:return{text:"Not On Account",theme:"neutral"}}})(e),...F(e)},e.emailPrimary))):(0,l.FD)("div",{css:dd.container,children:[(null==s?void 0:s.length)?s.map((e,n)=>e?(0,l.Y)(a$.A,{theme:"default",title:(null==e?void 0:e.firstName)?(0,J.L)(e):"No email or name was imported for the person associated with this account",infoText:(null==e?void 0:e.firstName)&&(null==e?void 0:e.emailPrimary)?(0,l.FD)(l.FK,{children:[(0,l.Y)("br",{}),e.emailPrimary]}):null,...F(e)},n):null):null,(0,l.Y)(y.A,{onSubmit:x,onSubmitError:e=>{if("EXISTING_EMAIL"!==e.message)throw e},children:(0,l.Y)(ds,{allowConsumerFiduciaryAuthSigners:g})})]})]})},du={rolloverTransferCollapsibleContentContainer:{cursor:"default"},rolloverTransferCollapsibleContentCopy:e=>{let{fontScales:n,colors:i}=e;return{...n.small,textAlign:"left",paddingBottom:"0.75rem",color:i.grey7}}},dp=function(e){var n;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{id:e.id,title:e.name,type:e.type,icon:"transfer",collapsibleContent:(0,l.Y)("div",{css:du.rolloverTransferCollapsibleContentContainer,children:(0,l.Y)("h6",{css:e=>du.rolloverTransferCollapsibleContentCopy(e),children:(0,l.Y)(e6.A,{source:e.confirmation||"Contact your financial institution to move funds from your existing retirement account to <%= clientDetails.clientFullName %>.",isInline:!1})})}),expandedInSelfServeByDefault:null!=(n=e.expandedInSelfServeByDefault)?n:i}},dm=e=>{let{maskedEmail:n,onSendLoginCode:i}=e,[t,o]=(0,v.useState)(!1),a=async()=>{if(i&&!t){o(!0);try{await i()}finally{o(!1)}}};return(0,l.Y)("div",{css:{marginBottom:24},children:(0,l.FD)(e2,{animateInOut:!0,onDismiss:()=>void 0,snackbarMessageProps:{theme:"warning",size:"small",hasManualDismiss:!1,disableAutoDismiss:!0,buttonTheme:"warmSolid",action:{text:t?"Sending…":"Send code",isDisabled:!i||t,onClick:()=>a()}}
1,children:[(0,l.Y)("h2",{children:"Services Unavailable"}),(0,l.Y)("p",{children:"Send a confirmation code to (".concat(n,") to log in and finish setting up your services.")})]})})},dh=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return e?"_blank":"_self"};var dv=i(26617);let dg="username-input-field",df="password-input-field",dy=(0,v.createContext)({username:{},password:{}}),dI={backButton:e=>{let{colors:n}=e;return{display:"flex",alignItems:"center",color:n.brand.primary,cursor:"pointer",transition:"0.15s linear opacity",marginBottom:"2rem","&:hover":{opacity:"0.8"}}},chevronIcon:{width:"2rem",height:"2rem",marginRight:"-0.25rem",marginLeft:"-0.5rem"},usernameInput:{marginBottom:"0.25rem"},usernamePasswordInputSection:{marginBottom:"2rem",...i_.A.small},usernameAvailabilityMessage:e=>{let{colors:n}=e;return{...i_.A.xsmall,color:n.blue8,marginLeft:"0.25rem"}},usernameInputBlockNoMessage:{marginBottom:"2.25rem"},usernameInputBlockWithAvailabilityMessage:{marginBottom:"1.125rem"},errorAvailabilityMessage:e=>{let{colors:n}=e;return{color:n.red3}},policyViolationMessage:e=>{let{colors:n}=e;return{...i_.A.xsmall,color:n.red3,marginLeft:"0.25rem"}},validationResultSection:{padding:"1rem",...i_.A.small},validationHeader:{fontWeight:600,height:"1.25rem"},policyValidationResult:{display:"flex",flexFlow:"row",alignItems:"flex-start",marginBottom:"0.5rem",lineHeight:"1.5rem"},validationResultIcon:{flex:"none",height:"1.5rem",width:"1.5rem",padding:"0.1875rem"},passedValidationIcon:e=>{let{colors:n}=e;return{color:n.green3}},failedValidationIcon:e=>{let{colors:n}=e;return{color:n.red3}},marginAbsentValidation:{marginLeft:"1.5rem"},usernameValidationResultSection:{marginBottom:"1rem"}};var dA=i(59869);let db=(e,n)=>1===n?e:"".concat(e,"s"),dC=(e,n,i)=>e&&n?e===n?"exactly ".concat(e," ").concat(db(i,n)):"".concat(e,"-").concat(n," ").concat(db(i,n)):e?"at least ".concat(e," ").concat(db(i,e)):0===n?"no ".concat(db(i,n)):n?"no more than ".concat(n," ").concat(db(i,n)):null,dS={minAlphabetical:dA.minAlphabeticalLetters,maxAlphabetical:dA.maxAlphabeticalLetters,minLowerAlphabetical:dA.minLowerCase,maxLowerAlphabetical:dA.maxLowerCase,minUpperAlphabetical:dA.minUpperCase,maxUpperAlphabetical:dA.maxUpperCase,minAlphaNumerical:dA.minAlphanumeric,maxAlphaNumerical:dA.maxAlphanumeric,minNumerical:dA.minNumbers,maxNumerical:dA.maxNumbers,minSpecialChars:dA.minSpecialCharacters,maxSpecialChars:dA.maxSpecialCharacters},dw=Object.keys(dS),dx=e=>{var n;return"disallowedWords"in e?(null!=(n=e.disallowedWords)?n:[]).map(e=>e.trim()).filter(Boolean):[]},dF=[{name:"totalLength",enabled:e=>!!e.minLength||!!e.maxLength,message:e=>{let n=dC(e.minLength,e.maxLength,"character");return"Must include ".concat(n)},isValid:(e,n)=>{let i=!0;return n.minLength&&i&&(i=!dA.minLength(e,n.minLength)),n.maxLength&&i&&(i=!dA.maxLength(e,n.maxLength)),i}},{name:"composition",enabled:e=>dw.some(n=>void 0!==e[n]),message:e=>{let n=[dC(e.minAlphabetical,e.maxAlphabetical,"letter"),dC(e.minLowerAlphabetical,e.maxLowerAlphabetical,"lowercase letter"),dC(e.minUpperAlphabetical,e.maxUpperAlphabetical,"uppercase letter"),dC(e.minAlphaNumerical,e.maxAlphaNumerical,"letter or number"),dC(e.minNumerical,e.maxNumerical,"number"),dC(e.minSpecialChars,e.maxSpecialChars,"special character")],i=new Intl.ListFormat("en",{type:"conjunction"}).format(n.filter(Boolean));return"Must include ".concat(i)},isValid:(e,n)=>{for(let i of dw){let t=n[i],l=dS[i];if(void 0!==t&&(null==l?void 0:l(e,t)))return!1}return!0}},{name:"allowedChars",enabled:e=>{var n;return!!e.disallowNonASCII||!!e.allowedSpecialChars||!!(null==(n=e.disallowedChars)?void 0:n.length)},message:e=>{var n,i,t,l;let o=!!e.disallowNonASCII,a=null==(n=e.allowedSpecialChars)?void 0:n.join(" "),r=null==(i=e.disallowedChars)?void 0:i.join(" ");return a&&r?"Special characters are limited to ``".concat(a,"`` and these characters are not allowed ``").concat(r,"``"):r&&o?"Only standard English letters, numbers, and symbols are allowed, except ``".concat(r,"``"):a?"Can only contain the special ".concat(db("character",null==(t=e.allowedSpecialChars)?void 0:t.length)," ``").concat(a,"``"):r?"Must not contain the ".concat(db("character",null==(l=e.disallowedChars)?void 0:l.length)," ``").concat(r,"``"):""===a?"Only standard English letters and numbers are allowed":"Only standard English letters, numbers, and symbols are allowed"},isValid:(e,n)=>{var i;return!(dA.excludeCharList(e,null!=(i=n.disallowedChars)?i:[])||n.allowedSpecialChars&&dA.restrictedSpecialChars(e,n.allowedSpecialChars)||dA.limitPrintableASCII(e,!!n.disallowNonASCII))}},{name:"consecutiveChars",enabled:e=>!!e.maxConsecutiveChars,message:e=>"Must not have more than ".concat(e.maxConsecutiveChars," consecutive ").
1concat(db("character",e.maxConsecutiveChars)),isValid:(e,n)=>!dA.limitAdjacentChars(e,n.maxConsecutiveChars)},{name:"consecutiveSpecialChars",enabled:e=>!!e.maxConsecutiveSpecialChars,message:e=>"Must not have more than ".concat(e.maxConsecutiveSpecialChars," consecutive special ").concat(db("character",e.maxConsecutiveSpecialChars)),isValid:(e,n)=>!dA.limitAdjacentSpecialChars(e,n.maxConsecutiveSpecialChars)},{name:"duplicateChars",enabled:e=>!!e.maxDuplicateChars,message:e=>"Must not contain more than ".concat(e.maxDuplicateChars," repeating ").concat(db("character",e.maxConsecutiveChars)),isValid:(e,n)=>!dA.limitRepeatingCharacters(e,n.maxDuplicateChars)},{name:"disallowUsername",enabled:e=>"disallowUsername"in e&&!!e.disallowUsername,message:()=>"Must not contain the username",isValid:(e,n,i)=>{let{username:t=""}=i;return!dA.usernameDisallowedInPassword(e,!0,t)}},{name:"disallowedWords",enabled:e=>!!dx(e).length,message:e=>{let n=dx(e);return"Must not contain the ".concat(db("word",n.length)," ``").concat(n.join(", "),"``")},isValid:(e,n)=>!dA.excludeWordList(e,dx(n))},{name:"disallowAccountNumber",enabled:e=>"disallowAccountNumber"in e&&!!e.disallowAccountNumber,message:()=>"Must not contain the account number",isValid:(e,n,i)=>{let{accountNumber:t=""}=i;return!dA.accountNumberDisallowedInUsername(e,!0,t)}}],dY=e=>{let{policy:n,input:i,context:t}=e,l=[];for(let e of(dA.required(i)&&l.push("required"),dF))e.enabled(n)&&!e.isValid(i,n,t)&&l.push(e.name);return l.length?JSON.stringify(l):void 0},dT=e=>{let{message:n}=e;return n?(0,l.Y)("div",{css:dI.policyViolationMessage,children:n}):null},dD=()=>{let e=(0,v.useContext)(dy),{getValues:n,formState:{errors:i}}=(0,S.xW)(),t=(e=>{let n=e[df],i=(null==n?void 0:n.type)==="passwordPolicyViolation"&&(null==n?void 0:n.message)&&"string"==typeof n.message?JSON.parse(n.message):null;return Array.isArray(i)?i.join(", "):null})(i);return(0,l.FD)(l.FK,{children:[(0,l.Y)(nv.A.PasswordInput,{name:df,label:"Password",dataTestId:"enrollment-password-input-field",style:{marginBottom:"0"},hideError:!0,validationFn:i=>(e=>{let{password:n,username:i,policy:t}=e;return dY({policy:t,input:n,context:{username:i}})})({password:i,username:n(dg),policy:e.password}),autocomplete:"new-password"}),t&&(0,l.Y)(dT,{message:t})]})};var dE=i(86285);let dk=v.memo(e=>{let{message:n,passedValidation:i,fieldIsTruthy:t}=e,o=i?(0,l.Y)(eH.A,{size:"small",name:"complete-no-fill",color:"tiaga7",css:[dI.validationResultIcon]}):(0,l.Y)(eH.A,{size:"small",name:"minus-circled",color:"chaparral6",css:dI.validationResultIcon});return(0,l.FD)("div",{css:(e=>{let n=[dI.policyValidationResult];return e||n.push(dI.marginAbsentValidation),n})(t),children:[t&&o,(0,l.Y)(dE.A,{source:n})]})});dk.displayName="PolicyValidationResultItem";let dP=e=>{let{validationResults:n,fieldIsTruthy:i}=e;return(0,l.Y)(l.FK,{children:n.map(e=>(0,l.Y)(dk,{message:e.message,passedValidation:e.passedValidation,fieldIsTruthy:i},e.key))})},dO=e=>JSON.parse(e||"[]"),dR=e=>{var n;let{formState:{errors:i}}=(0,S.xW)();return dO(null==(n=i[e])?void 0:n.message)},dL=(e,n)=>{let i=dR(e);return dF.filter(e=>e.enabled(n)).map(e=>({key:e.name,message:e.message(n),passedValidation:!i.includes(e.name)}))},dN=e=>{let{getValues:n}=(0,S.xW)();return!!n(e)},dB=e=>{let{policy:n}=e,i=dL(dg,n),t=dN(dg);return(0,l.Y)(dP,{fieldIsTruthy:t,validationResults:i})},dM=e=>{let{policy:n}=e,i=dL(df,n),t=dN(df);return(0,l.Y)(dP,{fieldIsTruthy:t,validationResults:i})},dz=v.memo(e=>{let{headerText:n}=e;return(0,l.Y)("div",{css:dI.validationHeader,children:n})}),dV=v.memo(()=>{let e=(0,v.useContext)(dy);return(0,l.FD)("div",{"data-testid":"enrollment-validation-results",css:dI.validationResultSection,children:[(0,l.FD)("div",{"data-testid":"username-validation-results",css:dI.usernameValidationResultSection,children:[(0,l.Y)(dz,{headerText:"Username must contain:"}),(0,l.Y)(dB,{policy:e.username})]}),(0,l.FD)("div",{"data-testid":"password-validation-results",children:[(0,l.Y)(dz,{headerText:"Password must contain:"}),(0,l.Y)(dM,{policy:e.password})]})]})});dV.displayName="ValidationResultsSection";let d_=e=>{let n,{usernameIsAvailable:i,loading:t,availabilityIsDirty:o}=e,{getValues:a}=(0,S.xW)();return a(dg)&&(t?n=(0,l.Y)(ny.A,{"data-testid":"loadingSpinner",size:"xsmall"}):o||(n=i?"Username is available":"Username is not available")),n},dU=e=>{let{usernameIsAvailable:n,loading:i,availabilityIsDirty:t}=e,o=d_({usernameIsAvailable:n,loading:i,availabilityIsDirty:t});return o?(0,l.Y)("div",{css:(e=>{let n=[dI.usernameAvailabilityMessage];
1return e||n.push(dI.errorAvailabilityMessage),n})(n),children:o}):null};dU.displayName="UsernameAvailabilityMessage";let dq=e=>{let{validationFn:n,onBlur:i,onChange:t,onFocus:o}=e;return(0,l.Y)(nv.A.Input,{css:dI.usernameInput,style:{marginBottom:"0.25rem"},name:dg,label:"Username",dataTestId:"enrollment-username-input-field",hideError:!0,validationFn:n,onBlur:i,onChange:t,onFocus:o})},dH=async e=>{let{event:n,shouldCheckUsernameAvailability:i,checkUsername:t}=e;i&&t({variables:{username:n.target.value}})},dK=e=>{let{integrationId:n,accountNumber:i}=e,t=(0,v.useContext)(dy),[o,a]=(e=>{let[n,i]=(0,v.useState)(e),t=(0,v.useRef)(null),l=(0,v.useCallback)((e,n)=>{i(e),"function"==typeof n&&(t.current=n)},[]);return(0,v.useEffect)(()=>{t.current&&(t.current(n),t.current=null)},[n]),[n,l]})(!1),{usernameIsAvailable:r,loading:d,checkUsername:s}=(e=>{let{integrationId:n,setAvailabilityIsDirty:i}=e,{trigger:t}=(0,S.xW)(),{useCheckUsername:l}=(0,ir.ou)(rX.EnrollmentSheetHooksContext),{usernameIsAvailable:o,loading:a,checkUsername:r}=l({integrationId:n}),d=(()=>{let{triggerMessage:e}=(0,f.d)();return()=>{e("There was an error checking the username availability",{theme:"alert",timeout:2e3})}})();return{usernameIsAvailable:o,loading:a,checkUsername:async e=>{let n=await r(e);return n.data&&!n.errors?i(!1,()=>{t(dg)}):d(),n}}})({integrationId:n,setAvailabilityIsDirty:a}),c=(()=>{let{getValues:e}=(0,S.xW)(),n=dR(dg);return e(dg)&&!n.length})(),u=!!d_({usernameIsAvailable:r,loading:d,availabilityIsDirty:o}),{formState:{errors:p}}=(0,S.xW)(),m=(e=>{let n=e[dg],i=(null==n?void 0:n.type)==="usernamePolicyViolation"&&(null==n?void 0:n.message)&&"string"==typeof n.message?JSON.parse(n.message):null;return Array.isArray(i)?i.join(", "):null})(p),h=null!=i?i:"";return(0,l.FD)("div",{css:u?dI.usernameInputBlockWithAvailabilityMessage:dI.usernameInputBlockNoMessage,children:[(0,l.Y)(dq,{validationFn:e=>(e=>{let{usernameToValidate:n,usernamePolicy:i,usernameIsAvailable:t,accountNumberToValidate:l,loading:o,availabilityIsDirty:a}=e,r=(e=>{let{username:n,accountNumber:i,policy:t}=e;return dY({policy:t,input:n,context:{accountNumber:i}})})({username:n,accountNumber:l,policy:i});return!o&&(o||t||a)?r:JSON.stringify(dO(r).concat(["noDuplicateLoginName"]))})({usernameToValidate:e,availabilityIsDirty:o,usernamePolicy:t.username,usernameIsAvailable:r,loading:d,accountNumberToValidate:h}),onBlur:e=>{dH({event:e,shouldCheckUsernameAvailability:c,checkUsername:s})},onChange:()=>{a(!0)},onFocus:()=>{a(!0)}}),u&&!m&&(0,l.Y)(dU,{usernameIsAvailable:r,loading:d,availabilityIsDirty:o}),m&&(0,l.Y)(dT,{message:m})]})},dj=v.memo(e=>{let{integrationId:n,accountNumber:i}=e;return(0,l.Y)(l.FK,{children:(0,l.FD)(i3,{"data-testid":"enrollment-username-password",css:dI.usernamePasswordInputSection,children:[(0,l.Y)(dK,{integrationId:n,accountNumber:i}),(0,l.Y)(dD,{})]})})});dj.displayName="UsernamePasswordInputSection";let dW={username:"",password:""},dG=async e=>{let{values:n,enrollUser:i,triggerErrorSnackbar:t,onEnrollmentSuccess:l,newTab:o,setError:a,customerServiceNumber:r}=e;try{var d,s;let e=await i({variables:{username:n[dg],password:n[df]}}),{usernameError:c,passwordError:u}=(null==(d=e.data)?void 0:d.enrollUser)||{};if(c||u)c&&a(dg,{type:"usernamePolicyViolation",message:JSON.stringify([c])}),u&&a(df,{type:"passwordPolicyViolation",message:JSON.stringify([u])});else{let n=null==(s=e.data)?void 0:s.enrollUser;(null==n?void 0:n.success)&&!n.errors?l({outboundRedirectUrl:n.outboundRedirectUrl,newTab:o,data:n.data}):t({customerServiceNumber:r,failSafeUrl:null==n?void 0:n.failSafeUrl})}}catch(e){t({customerServiceNumber:r}),t4()(e)}},d$=e=>{let{policies:n,integrationId:i,enrollmentHooks:t,onEnrollmentSuccess:o,newTab:a,accountNumber:r}=e,{useEnrollUser:d}=t,{enrollUser:s,loading:c}=d({integrationId:i}),{clientDetails:{customerServiceNumber:u}}=(0,D.t)(),p=(()=>{let{triggerMessage:e}=(0,f.d)();return n=>{let{failSafeUrl:i,customerServiceNumber:t}=n;e((e=>{let{failSafeUrl:n,customerServiceNumber:i}=e;return n?(0,l.FD)(l.FK,{children:["Error while enrolling in online banking. Please"," ",(0,l.Y)("a",{href:n,children:"enroll here"}),"."]}):i?(0,l.FD)(l.FK,{children:["Error enrolling in online banking. Please contact customer service at"," ",(0,l.Y)("a",{href:"tel:".concat(i),children:i})," for assistance."]}):"There was an error submitting your request."})({failSafeUrl:i,customerServiceNumber:t}),{theme:"error",timeout:i||t?void 0:2e3})}})(),m=(0,S.xW)();return(0,l.FD)(dy.Provider,{value:n,children:[(0,l.Y)(x.A,{heading:"Create your login",subheading:"Complete to enroll in online banking","data-testid":"enrollment-sheet-heading"}),(0,l.Y)(dj,{integrationId:i,accountNumber:r}),(0,l.Y)(w.A,{name:"enrollmentSubmitButton",isFull:!0,size:"large",theme:"primary",type:"submit",isLoading:c,"data-testid":"enrollment-submit-button",onClick:m.handleSubmit(e=>dG({values:e,enrollUser:s,onEnrollmentSuccess:o,triggerErrorSnackbar:p,newTab:a,setError:m.setError,customerServiceNumber:u})),children:"Submit"}),(0,l.Y)(dV,{})]})},dQ=v.memo(e=>(0,l.Y)(rZ.Provider,{value:{...e.enrollmentHooks},children:(0,l.Y)(y.A,{...dW,children:(0,l.Y)(d$,{...e})})}));dQ.displayName="EnrollmentSheet";let dJ=e=>{let{text:n,url:i,newTab:t}=e;return(0,l.Y)("div",{css:{display:"flex",justifyContent:"center",marginBottom:"0.5rem"},children:(0,l.Y)(w.A,{href:i,hrefInNew:t,"data-testid":"overview-continuation-button",children:n})},i)},dZ=e=>{let{id:n,callToAction:i,accountNumber:t}=e,{useEnrollmentPreflow:o}=(0,ir.ou)(rX.ManageAccountEnrollmentHooksContext),a=(()=>{let{triggerMessage:e}=(0,f.d)();return()=>{e("There was an issue processing the request, please try again",{theme:"alert",timeout:2e3})}})(),{enrollmentPreflow:r,outboundRedirect:d,credentialCreationPolicies:s,loading:c}=o({integrationId:n}),{modal:u,openModal:p}=(e=>{let{integrationId:n,policies:i,newTab:t,accountNumber:o}=e,a=(0,ir.ou)(rX.ManageAccountEnrollmentHooksContext),r=(0,v.useCallback)(e=>i?(0,l.Y)(dv.t,{children:(0,l.Y)("div",{css:{margin:"20px"},children:(0,l.Y)(dQ,{integrationId:n,policies:i,newTab:t,accountNumber:o,onEnrollmentSuccess:n=>{let{outboundRedirectUrl:i}=n;window.open(i,dh(t)),e()},enrollmentHooks:a})})}
1):null,[i,o]);return(0,ir.hS)(e=>r(e),{"data-testid":"enrollment-integration-modal"})})({integrationId:n,policies:s,newTab:null==d?void 0:d.newTab,accountNumber:t}),m=async()=>{let e=d,n=s;if(!c&&!e&&!n){var i;let t=await r(),l=null==(i=t.data)?void 0:i.enrollmentPreflow;if(t.errors||!l)return void a();e=l.outboundRedirect,n=l.credentialCreationPolicies}if(e){let n=dh(e.newTab);window.open(e.url,n)}else n&&p()};return(0,l.FD)(l.FK,{children:[u,(0,l.Y)("div",{css:{display:"flex",justifyContent:"center",marginBottom:"1 rem"},children:(0,l.Y)(w.A,{"data-testid":"enrollment-integration-button",onClick:m,isLoading:c,children:i})})]})},dX={buttonContainer:{marginTop:"3rem"},viewAllButtonContainer:{display:"flex",justifyContent:"center"}},d0=e=>{let{continuationButtons:n,enrollmentIntegrations:i,enrollmentHooks:t,onClickViewApplications:o,viewAllButtonLabel:a="View All Accounts and Applications",accountNumber:r}=e,{isWrappedByAlkami:d}=(0,aj.Pk)();if(d)return null;let s=(0,l.FD)(l.FK,{children:[n.map(e=>(0,l.Y)(dJ,{...e},e.url)),i.map(e=>(0,l.Y)(dZ,{...e,accountNumber:r},e.id))]}),c=t?(0,l.Y)(rX.ManageAccountEnrollmentHooksContext.Provider,{value:t,children:s}):s;return(0,l.FD)("div",{css:dX.buttonContainer,children:[c,o&&(0,l.Y)("div",{css:dX.viewAllButtonContainer,children:(0,l.Y)(w.A,{theme:"link",onClick:o,children:a})})]})},d9=e=>{let{crossSellProduct:n,onCrossSellProductClick:i,continuationButtons:t,enrollmentIntegrations:o,onClickViewApplications:a,accountNumber:r}=e;return(0,l.FD)(l.FK,{children:[(0,l.Y)(d0,{continuationButtons:t,enrollmentIntegrations:o,onClickViewApplications:a,viewAllButtonLabel:"View Accounts and Applications",accountNumber:r}),n&&(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{headingTag:"h2",heading:"You may also be interested in",theme:"small"}),(0,l.Y)("div",{children:(0,l.Y)(iN.A,{product:n,onClick:i?(e,t)=>{i(n)}:void 0})})]})]})},d1=e=>{var n,i,t,a,r,d,s,c,u,p,m,h,v,g,f,y,I,A;let{account:b,application:C,indicationsOfInterest:S,eligibleServices:F,membershipServices:Y,cardHolders:T,onRequestIndicationOfInterest:E,onRemoveIndicationOfInterest:P,onRequestBeneficiary:O,onInvite:R,onCancelInvite:L,onResendInvite:N,onRemoveAuthorizedSigner:B,onGoToNewAccounts:M,onGoToAddJointOwners:z,product:_,continuationButtons:U,enrollmentIntegrations:q,enrollmentHooks:H,onClickViewApplications:K,applicant:j,organization:W,crossSellProduct:G,onCrossSellProductClick:$,isReminding:Q=!1,isCanceling:J=!1,userId:X,onOpenPinwheelModal:ee,isWaitingForPinwheelToken:en,onSendCoreSyncLoginCode:et}=e,el=null==C?void 0:C.type,eo=(null==_?void 0:_.type)==="loan",{fields:ea}=(0,nn.A)({entityType:"business"}),er=(0,D.t)(),ed=er.clientDetails.customerServiceNumber,{clientDetails:es,mantlFeatures:ec,experiences:{selfServe:{pages:{onboarding:{headerText:eu,subheaderText:ep,formInfoText:em,formInfoTooltip:eh}}}}}=er,ev=null!=(h=(0,eL.FF)("enableMultipleJoinOwners"))&&h,eg=null!=(v=(0,eL.FF)("PART-1058-enable-new-self-serve-component-designs"))&&v,ef=(null==C||null==(i=C.fields)||null==(n=i.ownership)?void 0:n.type)==="jointAdult",ey=!!(null==(t=ec.accountOpening.directDepositSwitch)?void 0:t.enabled),eI=(e,n)=>P({id:e,removeMessage:n}),{isWrappedByAlkami:eA}=(0,aj.Pk)(),eb=e=>{let{ioiRequestData:n,successMessage:i}=e;return E({ioiRequestData:n,successMessage:i})},eC=(e=>{let{applicationType:n,account:i,product:t,application:a,onInvite:r,isReminding:d,isCanceling:s,onRemoveAuthorizedSigner:c,onCancel:u,onResend:p,applicant:m,clientFullName:h,isJointAdultApplication:v,clientConfig:g,enableMultiJointOwners:f,userId:y,onGoToAddJointOwners:I}=e,A=r(!0);switch(n){case"createAccount":case"consumerDepositAddSecondaryOwner":{var b,C,S,w,x,F,Y,T,D,E,k,P,O,R,L,N;let e=!!(null==i||null==(b=i.persons)?void 0:b.some(e=>(null==e?void 0:e.personId)===y&&((null==e?void 0:e.isPrimaryEntity)||(null==e?void 0:e.relationshipType)==="primary"))),B=(0,r8.As)(null!=(k=null==a?void 0:a.rawFields)?k:{})&&e;if("consumerDepositAddSecondaryOwner"===n&&!B)return[];let M=(null==i||null==(C=i.fields)?void 0:C.accountVariant)||(null==a||null==(S=a.fields)?void 0:S.accountVariant),z=null==t?void 0:t.accountVariants,V=M&&z&&(null==(w=z[M])?void 0:w.ownershipType),_=(null==i||null==(x=i.fields)?void 0:x.newAccountRelationshipD
1ata)||(null==a||null==(F=a.fields)?void 0:F.newAccountRelationshipData),U="fiduciary"===V&&M&&_&&t?(0,o.fZ)({accountVariant:M,newAccountRelationshipData:_,product:t}):null,q=(null==U?void 0:U.primaryEntityIsOrganization)||V&&o.Jh.includes(V),H=g.applicationTypes.businessDepositAddAuthorizedSigner,K=(null==i?void 0:i.openDate)&&"expiration"in H&&(0,r7.v0)(i.openDate,H.expiration),j="expiration"in H&&H.expiration?H.expiration.selfServeLabel:"To add an authorized signer to this account, please contact us",W=null==a||null==(Y=a.fields)?void 0:Y.applicantId,G=!!y&&!!W&&y===W,$=!!(null==(D=g.mantlFeatures.accountOpening)||null==(T=D.nonControlProngBusinessApplicant)?void 0:T.enabled);if(q&&$&&!G)return[];if(q)return[{title:"Manage Authorized Signers",icon:"customers",numberOfSigners:null!=(R=null==i||null==(O=i.persons)||null==(P=O.filter(e=>(null==e?void 0:e.status)==="booked"&&(null==e?void 0:e.relationshipType)==="authorizedSigner"))?void 0:P.length)?R:0,collapsibleContent:K?(0,l.Y)(l.FK,{children:j}):(0,l.Y)(dr,{personsOnAccount:null==i?void 0:i.persons,onInvite:A,isReminding:d,isCanceling:s,onRemoveSigner:c,onCancelApplication:u,onResend:p,userId:null==m?void 0:m.id}),expandedInSelfServeByDefault:!1}];let Q=!!V&&o.YJ.includes(V),J=v||"jointAdult"===V||"minorAndAdult"===V||f;if(null==t||null==(E=t.disableJointOwners)?void 0:E.selfServe)return[];if((null==t?void 0:t.allowJointOwnership)&&Q||(null==U?void 0:U.allowConsumerFiduciaryAuthSigners)||(null==U?void 0:U.allowConsumerFiduciaryAccountOwners)){let e=(null==U?void 0:U.allowConsumerFiduciaryAuthSigners)?"Manage Authorized Signers":J?"Manage Joint Owners":"Add Joint Owner",n=(null==U?void 0:U.allowConsumerFiduciaryAuthSigners)||J?"customers":"add-person";if(f)return[{title:e,icon:n,expandedInSelfServeByDefault:!1,collapsibleContent:(0,l.Y)(di,{personsOnAccount:null==i?void 0:i.persons,allowConsumerFiduciaryAccountOwners:null==U?void 0:U.allowConsumerFiduciaryAccountOwners,allowConsumerFiduciaryAuthSigners:null==U?void 0:U.allowConsumerFiduciaryAuthSigners,account:i,product:t,userId:y,onCancelApplication:u,onGoToAddJointOwners:I})}];return[{title:e,icon:n,status:null==i||null==(N=i.persons)||null==(L=N.find(e=>!!m&&(null==e?void 0:e.personId)!==(null==m?void 0:m.id)))?void 0:L.status,collapsibleContent:(0,l.Y)(dc,{applicant:m,personsOnAccount:null==i?void 0:i.persons,personsOnOtherConsumerAccounts:null==i?void 0:i.personsOnOtherConsumerAccounts,onInvite:r(!1),onResend:p,onCancelApplication:u,clientFullName:h,application:a,product:t,isJointAdultApplication:v,allowConsumerFiduciaryAccountOwners:null==U?void 0:U.allowConsumerFiduciaryAccountOwners,allowConsumerFiduciaryAuthSigners:null==U?void 0:U.allowConsumerFiduciaryAuthSigners}),expandedInSelfServeByDefault:!1}]}return[]}default:return[]}})({applicationType:el,account:b,product:_,application:C,onInvite:R,isReminding:Q,isCanceling:J,onRemoveAuthorizedSigner:B,onCancel:L,onResend:N,applicant:j,clientFullName:es.clientFullName,isJointAdultApplication:ef,clientConfig:er,enableMultiJointOwners:ev,userId:X,onGoToAddJointOwners:z}),eS=C?(e=>{let{eligibleServices:n,application:i}=e,t=null==n?void 0:n.filter(e=>aG.CB.includes(e.type));if(!(null==t?void 0:t.length))return[];if(aG.CB.some(e=>{var n;return e===(null==(n=i.fundingTransaction)?void 0:n.type)})){let e=n.find(e=>{var n;return e.type===(null==(n=i.fundingTransaction)?void 0:n.type)});if(e)return[dp(e,!0)]}return t.map(e=>dp(e))})({application:C,eligibleServices:F}):[],ew=ro({indicationsOfInterest:S,eligibleServices:F,cardHolders:T,getCollapsibleContentComponent:e=>{let n=S.find(n=>n.serviceId===(null==e?void 0:e.id));switch(e.type){case"contingentBeneficiary":case"beneficiary":{let n=S.filter(n=>n.serviceId===(null==e?void 0:e.id)).sort((e,n)=>String(n.createdAt).localeCompare(String(e.createdAt)))[0];return(0,l.Y)(rS,{service:e,onRequest:O,indicationOfInterest:n})}default:return(0,l.Y)(r2,{service:e,onRequest:eb,onRemove:e.automated?void 0:eI,indicationOfInterest:n,membershipServices:Y})}},onRequest:eb,onRemove:eI,userId:null!=(g=null==j?void 0:j.id)?g:"",personsOnAccount:null!=(f=null==b||null==(a=b.persons)?void 0:a.filter(
1Boolean))?f:[],accountAddresses:null==b?void 0:b.fields,isJointAdultApplication:ef,applicationId:null==C?void 0:C.id}),ex=null==b||null==(r=b.fields)?void 0:r.accountVariant,eF=null==C?void 0:C.autopayFundingSource,eY=!!b&&!!eF,eT=[...eC,...eS,...ew],eD=ex?ra(eT.filter(e=>!e.autoApply)):ra(eC),eE=eC.length,ek=null==(d=eC[0])?void 0:d.title,eP=eT.filter(e=>e.autoApply),eO=F.find(e=>"directDeposit"===e.type&&ey),eR=null==C||null==(s=C.fields)?void 0:s.personIdMapping,eN=!eR||eR.find(e=>(null==e?void 0:e.syncedPersonId)===X),eB=null==eR?void 0:eR.find(e=>(null==e?void 0:e.applicationPersonId)===X),eM=null==eB?void 0:eB.syncedPersonId,ez=null==b||null==(c=b.persons)?void 0:c.find(e=>(null==e?void 0:e.personId)===eM),eV=(()=>{if(!(null==eR?void 0:eR.length)||eN||!eM||!ez)return;let e=ez.emailPrimary;return"string"==typeof e?e:void 0})(),e_=void 0!==eV,eU=(0,l.Y)(k.A,{children:(0,l.FD)("div",{children:[(null!=(y=null==C||null==(p=C.fields)||null==(u=p.accounts)?void 0:u.length)?y:0)>1&&(0,l.Y)(w.A,{theme:"backButton",onClick:M,children:"New Accounts"}),void 0!==eV&&(0,l.Y)(dm,{maskedEmail:eV,onSendLoginCode:et&&eM?()=>et(eM):void 0}),(0,l.FD)(ei.A,{children:[(0,l.Y)(x.A,{heading:eu||(null==_?void 0:_.name)||"Your Account",subheading:ep||"Your new account is open and ready to use",productId:null==_?void 0:_.id}),(0,l.Y)(aU.A,{account:b,product:_,application:C,organization:W,applicant:j,organizationFields:ea,defaultOpen:!eA})]}),eo&&C&&(0,l.Y)(ih,{application:C}),!e_&&(0,l.FD)(l.FK,{children:[eY&&eF&&(0,l.Y)(ei.A,{children:(0,l.Y)(e3,{title:"Automatic Payments",details:[["Enrolled","Yes"],["CustomerInternalAccountFundingSource"===eF.type?"Internal Account":"External Account","name"in eF&&null!=(I=eF.name)?I:null],["Account Number",eF.lastFour]]})}),eN&&eD.length>0&&(0,l.FD)(ei.A,{children:[(0,l.FD)("div",{css:r6.contentHeaderGroup,children:[(0,l.Y)(eH.A,{name:"illustration-card",size:"xlarge",brandColor:"primaryLight",css:r6.contentHeaderGroupIcon}),(0,l.Y)(x.A,{heading:"Get more out of your Account",subheading:"Take advantage of these options and services",theme:"medium",productId:null==_?void 0:_.id})]}),(0,l.FD)(aV.A,{component:"div",children:[eO&&ee&&(0,l.Y)(r3,{accountId:null==b?void 0:b.id,service:eO,existingDirectDepositSwitchIois:S.filter(e=>e.serviceId===eO.id),onOpenPinwheelModal:ee,isWaitingForPinwheelToken:!!en}),eD.map((e,n)=>{var i;let t=e.numberOfSigners?(e=>{let{status:n,numberOfSigners:i}=e;if(i&&Number(i))return{text:"".concat(i," Signer").concat(i>1?"s":""),theme:"success"};switch(n){case"pending":return{text:"Requested",theme:"info"};case"booked":return{text:"Added",theme:"success"};default:return null}})({status:e.status,numberOfSigners:e.numberOfSigners}):aW({status:e.status,type:e.type});return(0,l.Y)(a_.A,{timeout:750,css:r6.triggerAnimation,children:(0,l.Y)(V.A,{"aria-label":e.title,icon:e.icon,title:e.title,collapsibleContent:null!=(i=e.collapsibleContent)?i:void 0,description:null,tag:t,hideTagWhenCollapsed:"beneficiary"!==e.id&&"contingentBeneficiary"!==e.id,collapsibleDefaultOpen:e.expandedInSelfServeByDefault,additionalInfo:e.isMembershipService?"This service will be active on all shares included on this Membership.":void 0},n)},e.title)})]})]}),!ex&&(0,l.Y)("div",{css:r6.infoBoxContent,children:(0,l.Y)(Z.A,{content:eE?"Unfortunately, we can only process ".concat(ek," at this time. To add a service or speak with a representative, please call ").concat(ed,"."):"To add a service or speak with a representative, please call ".concat(ed,".")})}),eP.length>0&&(0,l.FD)(ei.A,{children:[(0,l.FD)("div",{css:r6.contentHeaderGroup,children:[(0,l.Y)(eH.A,{name:"illustration-celebrate",size:"xlarge",brandColor:"primaryLight",css:r6.contentHeaderGroupIcon}),(0,l.Y)(x.A,{heading:"Included with your account",subheading:"You automatically have access to these services",theme:"medium"})]}),(0,l.Y)("div",{css:e=>r6.autoAppliedContainer(e,eg),children:eP.map((e,n)=>(0,l.Y)("div",{css:e=>r6.autoAppliedService(e),children:(0,l.Y)(aK,{ariaDescribedBy:e.description,theme:"noBorder",icon:e.icon,title:e.title,description:e.description})},n))})]}),(0,l.Y)(d9,{crossSellProduct:G,onCrossSellProductClick:G?$:null,continuationButtons:U,enrollmentIntegrations:q,onClickViewApplications:K,accountNumber:null!=(A=null==b?void 0:b.number)?A:null==b||null==(m
1=b.fields)?void 0:m.accountNumber}),em?(0,l.Y)("div",{css:r6.infoBox,children:(0,l.Y)(Z.A,{icon:"info-circle",content:em,productId:null==_?void 0:_.id,tooltipIcon:eh?"info-circle":null,tooltipContent:eh})}):null,(null==_?void 0:_.onboardingSurvey)&&(0,l.Y)("div",{css:e=>r6.onboardingSurveyWrapper(e),children:(0,l.Y)(V.A,{theme:"onboardingSurvey",title:_.onboardingSurvey.title,description:_.onboardingSurvey.body,url:_.onboardingSurvey.url})})]})]})});return H?(0,l.Y)(rX.ManageAccountEnrollmentHooksContext.Provider,{value:H,children:eU}):eU};var d2=i(38210);let d6=e=>"object"==typeof e&&null!==e,d5=e=>{for(let n of(e=>{let n=Array.isArray(e)?e:[e],i=[];for(let e of n)if(d6(e))for(let n of d6(e.error)?[e,e.error]:[e])Array.isArray(n.graphQLErrors)&&n.graphQLErrors.forEach(e=>{d6(e)&&d6(e.extensions)&&i.push(e.extensions)}),d6(n.extensions)&&i.push(n.extensions);return i})(e)){let{attributes:e}=n;if(!d6(e)||e.code!==rr)continue;let i=(Array.isArray(e.conflicts)?e.conflicts:[]).filter(d6).map(e=>({code:rr,beneficiaryIndex:"number"==typeof e.beneficiaryIndex?e.beneficiaryIndex:0,taxId:"string"==typeof e.taxId?e.taxId:""}));if(i.length)return i}return null};var d4=i(81501),d3=i(44722);function d8(){let e=(0,ng._)(["\n  mutation InitiateCoreSyncEmailLogin(\n    $applicationId: ID!\n    $syncedPersonId: ID!\n    $taxId: String\n    $dateOfBirth: String\n  ) {\n    initiateCoreSyncEmailLogin(\n      applicationId: $applicationId\n      syncedPersonId: $syncedPersonId\n      taxId: $taxId\n      dateOfBirth: $dateOfBirth\n    ) {\n      state\n    }\n  }\n"]);return d8=function(){return e},e}let d7=(0,iE.J1)(d8());var se=i(73627),sn=i(15599).hp;function si(){let e=(0,ng._)(["\n  fragment IndicationOfInterestFragment on IndicationOfInterest {\n    id\n    type\n    status\n    updatedAt\n    serviceId\n    personId\n    cardId\n    createdAt\n    clientId\n    accountId\n    accountReferenceId\n    fields {\n      secondaryPersonId\n      beneficiary\n      cardFulfillmentType\n      pinwheelAccountId\n      pinwheelAllocationType\n      pinwheelAllocationValue\n      isMembershipService\n      onePerMembership\n    }\n  }\n"]);return si=function(){return e},e}function st(){let e=(0,ng._)(["\n  query GetIndicationsOfInterest($accountId: ID, $applicationId: ID) {\n    indicationsOfInterest(\n      accountId: $accountId\n      applicationId: $applicationId\n    ) {\n      ...IndicationOfInterestFragment\n    }\n  }\n  ","\n"]);return st=function(){return e},e}function sl(){let e=(0,ng._)(["\n  query GetMembershipServiceIds($accountId: ID!) {\n    membershipServices(accountId: $accountId)\n    existingOnePerMembershipServices(accountId: $accountId)\n  }\n"]);return sl=function(){return e},e}function so(){let e=(0,ng._)(["\n  mutation CreateIndicationOfInterest(\n    $type: IndicationOfInterestType!\n    $accountId: ID\n    $accountReferenceId: ID\n    $serviceId: ID!\n    $applicationId: ID!\n    $cardId: ID\n    $organizationId: ID\n    $personId: ID\n    $secondaryPersonId: ID\n    $beneficiary: [BeneficiaryFieldsJSONObject!]\n    $cardFulfillmentType: String\n    $status: IndicationOfInterestStatus\n    $pinwheelAccountId: ID\n    $pinwheelAllocationType: PinwheelAllocationType\n    $pinwheelAllocationValue: String\n    $isMembershipService: Boolean\n    $onePerMembership: Boolean\n  ) {\n    createIndicationOfInterest(\n      type: $type\n      accountId: $accountId\n      accountReferenceId: $accountReferenceId\n      serviceId: $serviceId\n      applicationId: $applicationId\n      cardId: $cardId\n      personId: $personId\n      organizationId: $organizationId\n      secondaryPersonId: $secondaryPersonId\n      beneficiary: $beneficiary\n      cardFulfillmentType: $cardFulfillmentType\n      status: $status\n      pinwheelAccountId: $pinwheelAccountId\n      pinwheelAllocationType: $pinwheelAllocationType\n      pinwheelAllocationValue: $pinwheelAllocationValue\n      isMembershipService: $isMembershipService\n      onePerMembership: $onePerMembership\n    ) {\n      ...IndicationOfInterestFragment\n    }\n  }\n  ","\n"]);return so=function(){return e},e}function sa(){let e=(0,ng._)(["\n  mutation UpdateIndicationOfInterest(\n    $id: ID!\n    $applicationId: ID!\n    $beneficiary: [BeneficiaryFieldsJSONObject!]\n  ) {\n    updateIndicationOfInterest(\n      id: $id\n      applicationId: $applicationId\n      beneficiary: $beneficiary\n    ) {\n      ...IndicationOfInterestFragment\n    }\n  }\n  ","\n"]);return sa=function(){return e},e}function sr(){let e=(0,ng._)(["\n  mutation RemoveIndicationOfInterest($id: ID!) {\n    deleteIndicationOfInterest(indicationOfInterestId: $id) {\n      id\n    }\n  }\n"]);return sr=function(){return e},e}function sd(){let e=(0,ng._)(["\n  mutation CreateDirectDepositLinkToken($pinwheelAccountId: ID) {\n    createDirectDepositLinkToken(pinwheelAccountId: $pinwheelAccountId) {\n      token\n      expires\n    }\n  }\n"]);return sd=function(){return e},e}let ss=(0,iE.J1)(si()),sc=(0,iE.J1)(st(),ss),su=(0,iE.J1)(sl()),sp=(0,iE.J1)(so(),ss),sm=(0,iE.J1)(sa(),ss),sh=(0,iE.J1)(sr()),sv=(0,iE.J1)(sd()),sg=e=>{var n,i,t,l,o;let{applicationId:a,accountId:r,userId:d,queryOptions:s}=e,{triggerMessage:c}=(0,f.d)(),{data:u,loading:p}
1=(0,ik.I)(sc,{...r||a?{variables:{accountId:r,applicationId:a}}:{skip:!0},...s||{}}),{data:m,loading:h}=(0,ik.I)(su,{...r?{variables:{accountId:r}}:{skip:!0},...s||{}}),v=(null!=(i=null==u?void 0:u.indicationsOfInterest)?i:[]).filter(Boolean),g=null!=(t=null==m?void 0:m.membershipServices)?t:[],y=null!=(l=null==m?void 0:m.existingOnePerMembershipServices)?l:[],[I,{loading:A}]=(0,ey.n)(sp,{awaitRefetchQueries:!1,update(e,n){let{data:i}=n,t=null==i?void 0:i.createIndicationOfInterest;t&&e.modify({fields:{indicationsOfInterest:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{toReference:n}=arguments.length>1?arguments[1]:void 0;return[...e,n(t)]}}})}}),[b,{loading:C}]=(0,ey.n)(sm),[S,{loading:w}]=(0,ey.n)(sh,{update(e,n){let{data:i}=n;e.modify({fields:{indicationsOfInterest:(e,n)=>{let{readField:t}=n;return e.filter(e=>{var n;return(null==i?void 0:i.deleteIndicationOfInterest)&&(null==i||null==(n=i.deleteIndicationOfInterest)?void 0:n.id)!==t("id",e)})}}})}}),[x,{loading:F}]=(0,ey.n)(sv),Y=r?v.filter(e=>(null==e?void 0:e.accountId)===r):v,T=null==Y?void 0:Y.filter(e=>{let n=[...se.r,"directDeposit"];return!!(null==e?void 0:e.type)&&!n.includes(e.type)||(null==e?void 0:e.personId)===d}),D=v.find(e=>["beneficiary","contingentBeneficiary"].includes(e.type)),E=null!=(o=null==D||null==(n=D.fields)?void 0:n.beneficiary)?o:[],k=async e=>{var n,i,t;let{type:l,serviceId:o,accountReferenceId:d,cardId:s,personId:u,organizationId:p,secondaryPersonId:m,cardFulfillmentType:h,beneficiary:g,status:f,pinwheelAccountId:y,pinwheelAllocationType:A,pinwheelAllocationValue:C,isMembershipService:S,onePerMembership:w}=e;if(!a)return void c("Error requesting ".concat(l," service."));let x="beneficiary"===l||"contingentBeneficiary"===l?null==(n=v.find(e=>e.type===l))?void 0:n.id:void 0;if(x){let e=await b({variables:{id:x,applicationId:a,beneficiary:g}});return null==e||null==(t=e.data)?void 0:t.updateIndicationOfInterest}let F=!!l&&se.r.includes(l),Y=await I({variables:{type:l,serviceId:o,accountId:r,applicationId:a,accountReferenceId:null!=d?d:void 0,cardId:s,personId:u,secondaryPersonId:m,organizationId:p,beneficiary:g,cardFulfillmentType:h,status:f,pinwheelAccountId:y,pinwheelAllocationType:A,pinwheelAllocationValue:C,isMembershipService:S,onePerMembership:w},...F?{refetchQueries:["GetApplication"]}:{}});return null==Y||null==(i=Y.data)?void 0:i.createIndicationOfInterest};return{accountIndicationsOfInterest:v,createDirectDepositLinkToken:async e=>{try{var n,i;let{data:t}=await x({variables:{pinwheelAccountId:e}}),l=null==t||null==(n=t.createDirectDepositLinkToken)?void 0:n.token,o=null==l||null==(i=l.split)?void 0:i.call(l,".")[1],a=JSON.parse(sn.from(null!=o?o:"","base64").toString("utf8")).data.token_id;return console.info("Link Token ID:",a),l}catch(e){console.error("There was an error creating the direct deposit switch token. Something is most likely wrong with the payload. If pinwheel support asks for an end user id, give them the personId. Check DataDog logs for more details."),c("There was a problem connecting to the direct deposit switch service. Please try again later or contact your bank.");return}},isCreatingDirectDepositLinkToken:F,currentUserIndicationsOfInterest:T,membershipServiceIds:g,existingOnePerMembershipServiceIds:y,isRemoving:w,isRequesting:A||C,loadingIndicationsOfInterest:p||null===v,loadingMembershipServices:h,beneficiariesOnPreBookedApplication:E,removeIndicationOfInterest:e=>S({variables:e}),requestIndicationOfInterest:k}},sf=e=>{let{person:n,userId:i,isMinorApp:t,application:l}=e,o="personId"in n,a="id"in n&&n.id===i,r=t&&!!n.isMinor;if(o){var d,s;let e=i;if(null==l||null==(s=l.fields)||null==(d=s.personIdMapping)?void 0:d.length){let n=l.fields.personIdMapping.find(e=>(null==e?void 0:e.applicationPersonId)===i);(null==n?void 0:n.syncedPersonId)&&(e=n.syncedPersonId)}return n.personId===e||r}return a||r},sy=function(){var e,n;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{accountId:t,allAccounts:l}=i,{isMinorApp:o,userId:a,applicationId:r,application:d}=(0,u.YY)(l?{includeAccounts:!0,includeCardholders:!0}:{}),{account:s}=tA({applicationId:r,accountId:t,queryOptions:{fetchPolicy:"cache-and-network",skip:!d}}),{accountIndicationsOfInterest:c}=sg({applicationId:r,userId:a,accountId:null==s?void 0:s.id}),p=null!=(e=null==c?void 0:c.filter(e=>(null==e?void 0:e.type)&&se.r.includes(null==e?void 0:e.type)))?e:[],m=null!=(n=a?(e=>{var n,i,t;let{account:l,application:o,userId:a,isMinorApp:r,cardIOIs:d}=e,s=l?l.persons:null==o?void 0:o.persons;return null==s||null==(t=s.filter(e=>!!e&&sf({person:e,userId:a,isMinorApp:r,application:o})))||null==(i=t.map(e=>{var n,i;return{...e,bookedCard:(e=>{let{accountId:n,cards:i}=e;return null==i?void 0:i.find(e=>{var i;return!!n&&(null==e||null==(i=e.relatedAccountIds)?void 0:i.includes(n))})})({accountId:l?null==l?void 0:l.id:(null==o||null==(n=o.fields)?void 0:n.accountId)||(null==o||null==(i=o.fields)?void 0:i.createdAccountId),cards:null==e?void 0:e.cards}),cardIOI:(e=>{var n;let{cardIOIs:i,person:t,accountId:l}=e,o=null==i?void 0:i.find(e=>!!t&&(!l||null==e||!e.accountId||(null==e?void 0:e.accountId)===l)&&("personId"in t?(null==e?void 0:e.personId)===(null==t?void 0:t.personId):"id"in t&&(null==e?void 0:e.personId)===t.id));if((null==o?void 0:o.type)!=="linkedCard")return o;let a=null==t||null==(n=t.cards)?void 0:n.find(e=>(null==e?void 0:e.id)===o.cardId);return{...o,linkedCard:a}})({cardIOIs:d,person:e,accountId:null==l?void 0:l.id})}}))||null==(n=i.filter(e=>{var n,i;return!!(null==(i=(n=e).eligibleCardServices)?void 0:i.length)||!!n.bookedCard||!!n.cardIOI}
1))?void 0:n.sort(e=>"personId"in e?e.personId===a?-1:1:"id"in e&&(null==e?void 0:e.id)===a?-1:1)})({account:s,application:d,userId:a,isMinorApp:o,cardIOIs:p}):[])?n:[];return l?{cardHolders:m,cardHoldersByAccountReferenceId:a?(e=>{var n,i;let{application:t,userId:l,isMinorApp:o}=e,a=new Map;for(let e of null!=(i=null==t||null==(n=t.fields)?void 0:n.accounts)?i:[]){let n=e&&"referenceId"in e?e.referenceId:null,i=e&&"cardholders"in e?e.cardholders:void 0;if(!n||!Array.isArray(i))continue;let r=i.flatMap(e=>e&&sf({person:e,userId:l,isMinorApp:o,application:t})?[e]:[]);a.set(n,r)}return a})({application:d,userId:a,isMinorApp:o}):new Map}:{cardHolders:m}},sI=e=>{var n,i,t,l,o,a,r,d,c,p,m,h;let{accountId:v}=e,{config:g}=(0,s.UK)(),{application:f}=(0,u.YY)();if(!f)return[];let y=g.experiences.selfServe.ombContinuationButtons,I=null==(i=f.fields)||null==(n=i.ownership)?void 0:n.type,A=null==(o=f.fields)||null==(l=o.createdAccounts)||null==(t=l.find(e=>e.id===v))?void 0:t.referenceId,b=!!(null==f||null==(r=f.fields)||null==(a=r.accounts)?void 0:a.length)&&A&&(null==f||null==(p=f.fields)||null==(c=p.accounts)||null==(d=c.find(e=>e.referenceId===A))?void 0:d.productType),C={applicationType:f.type,ownershipType:I,productType:b||(null==f||null==(h=f.products)||null==(m
1=h[0])?void 0:m.type)};return y.map(e=>e.find(e=>{let{filter:n={}}=e;return Object.entries(n).every(e=>{let[n,i]=e,t=C[n];return!!t&&i.includes(t)})})).filter(Boolean)},sA=["harlandClarkeVericast","deluxeOrderPro","mainStreet"];var sb=i(96815),sC=i(26684),sS=i(34994);let sw=(e,n)=>{var i,t;let l=n.find(n=>n.serviceId===e.id);if(!l)return e;let o=null==(t=e.statusOverrides)||null==(i=t[l.status])?void 0:i.description;return{...e,...o&&{description:o}}},sx=e=>!!e.promoted&&!["beneficiary","contingentBeneficiary"].includes(e.type),sF=function(){var e,n,i,t,l,o,a,r,d,c,p,m,h;let{accountId:g,includeCardholders:f}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{config:y}=(0,s.UK)(),{application:I,applicationId:A,userId:b}=(0,u.YY)({includeAccounts:!0,...void 0!==f?{includeCardholders:f}:{}}),{account:C}=tA({applicationId:null==I?void 0:I.id,accountId:g||void 0,queryOptions:{skip:!I}}),S=I,w=null==S?void 0:S.type,x=!!w&&sC.p.includes(w),F="consumerDepositAddSecondaryOwner"===w&&(0,r8.As)(null!=(r=null==I?void 0:I.rawFields)?r:{}),{currentUserIndicationsOfInterest:Y,accountIndicationsOfInterest:T,existingOnePerMembershipServiceIds:D}=sg({applicationId:A,userId:b,accountId:g}),E=null!=(d=(0,eL.FF)("ENH-3456-dbm-toggle-beneficiaries-with-signatures"))&&d;x&&(S=null!=(c=(0,sS.n)({application:S,account:C}))?c:void 0);let k=null==I||null==(i=I.fields)||null==(n=i.createdAccounts)||null==(e=n.find(e=>e.id===g))?void 0:e.referenceId,P=(0,sb.U)({application:S,config:y,referenceId:k}),O=(null==D?void 0:D.length)?new Set(D):new Set,R=P.filter(e=>!(e.onePerMembership&&O.has(e.id))),L=(e=>{let{application:n,userId:i}=e;if(!n)return!1;let{fields:t}=n,l=null==t?void 0:t.ownership;return(null==l?void 0:l.type)==="jointAdult"&&(null==l?void 0:l.entities.otherAdult)?l.entities.otherAdult.some(e=>"personId"in e&&e.personId===i):(null==t?void 0:t.accounts)?t.accounts.flatMap(e=>
1e.newAccountRelationshipData).some(e=>(null==e?void 0:e.personId)===i&&(null==e?void 0:e.role)==="otherAdult"):null!=t&&!!t.newAccountRelationshipData&&t.newAccountRelationshipData.some(e=>e.personId===i&&"otherAdult"===e.role)})({application:S,userId:b}),N=(e=>{var n,i,t;let{application:l,userId:o}=e,a=null==l||null==(i=l.fields)||null==(n=i.accounts)?void 0:n.flatMap(e=>e.newAccountRelationshipData);return(null==(t=(0,eS.VU)(a,o))?void 0:t.role)==="authorizedSigner"})({application:S,userId:b}),B=!!(null==C||null==(t=C.persons)?void 0:t.some(e=>(null==e?void 0:e.personId)===b&&((null==e?void 0:e.isPrimaryEntity)||(null==e?void 0:e.relationshipType)==="primary"))),M=e=>{let n=(E?[...se.H,"beneficiary","contingentBeneficiary"]:se.H).includes(e.type);return(!x||!!(F&&B))&&!L&&!N||n},z=e=>!aG.yc.includes(e.type)||e.fulfillmentType.mail.enabled,V=(e,n)=>{var i,t;if(null==e||null==(i=e.qualifyingServiceIds)||!i.length)return!0;{let i=null==n?void 0:n.filter(n=>{var i;return(null==n?void 0:n.serviceId)&&(null==e||null==(i=e.qualifyingServiceIds)?void 0:i.includes(null==n?void 0:n.serviceId))});return null!=i&&!!i.length&&(null==i||null==(t=i.filter(e=>null==e?void 0:e.status))?void 0:t.length)>0}},_=e=>{var n;return!sA.includes(null!=(n=e.integrationName)?n:"")},U=null==I||null==(l=I.fields)?void 0:l.accounts,q=new Map;null==U||U.forEach(e=>{let n="accountId"in e&&"string"==typeof e.accountId?e.accountId:"id"in e&&"string"==typeof e.id?e.id:null;n&&e.referenceId&&q.set(n,e.referenceId)}),null==I||null==(a=I.fields)||null==(o=a.createdAccounts)||o.forEach(e=>{e.id&&e.referenceId&&!q.has(e.id)&&q.set(e.id,e.referenceId)});let H=R.map(e=>e.id).join(","),K=null!=(p=null==Y?void 0:Y.map(e=>"".concat(e.serviceId,":").concat(e.status)).join(","))?p:"",j=null!=(m=null==T?void 0:T.map(e=>{var n;return"".concat(e.serviceId,":").concat(e.status,":").concat(null!=(n=e.accountId)?n:"")}).join(","))?m:"",W=null!=(h=null==U?void 0:U.map(e=>"".concat(e.productId,":").concat(e.accountVariant,":").concat(e.referenceId)).join(","))?h:"",G=(0,v.useMemo)(()=>Y?R.filter(e=>z(e)&&M(e)&&V(e,T)&&_(e)).map(e=>sw(e,Y)):[],[H,K,j,w,null==C?void 0:C.id]),$=(0,v.useMemo)(()=>G.filter(sx).map(e=>sw(e,Y)),[G,K]);return{eligibleServices:G,promotedServices:$,bulkEligibleServices:(0,v.useMemo)(()=>(()=>{if(!Array.isArray(U))return;let e=new Map,n=new Map;return U.forEach(i=>{i.referenceId&&i.productId&&(e=>{var n;let i=[...(0,r7.j5)({productId:e.productId,accountVariant:e.accountVariant,config:y}),...(0,r7.He)(y)],t=null!=(n=null==T?void 0:T.filter(n=>{let i="accountReferenceId"in n&&"string"==typeof n.accountReferenceId?n.accountReferenceId:null;return i?i===e.referenceId:null!=n&&!!n.accountId&&q.get(n.accountId)===e.referenceId}))?n:[];return i.filter(e=>{var n;return z(e)&&M(e)&&V(e,(null==(n=e.qualifyingServiceIds)?void 0:n.length)&&"atmCard"===e.type?null!=T?T:[]:t)&&_(e)}).map(e=>sw(e,t))})({productId:i.productId,accountVariant:i.accountVariant||"",referenceId:i.referenceId}).filter(sx).forEach(t=>{let l=e.get(t.id)||[];l.includes(i.referenceId)||e.set(t.id,[...l,i.referenceId]),n.has(t.id)||n.set(t.id,t)})}),{promotedServices:Array.from(n.values()),serviceToAccountsMap:e}})(),[W,j,H,w,null==C?void 0:C.id])}};function sY(){let e=(0,ng._)(["\n  query GetEnrollmentIntegrations($applicationId: ID!, $accountId: ID) {\n    enrollmentIntegrations(\n      applicationId: $applicationId\n      accountId: $accountId\n    ) {\n      id\n      name\n      callToAction\n    }\n  }\n"]);return sY=function(){return e},e}let sT=(0,iE.J1)(sY()),sD=e=>{var n;let{applicationId:i,accountId:t}=e,{data:l,loading:o,called:a}=(0,ik.I)(sT,{fetchPolicy:"cache-and-network",variables:{applicationId:i,accountId:t},skip:!i});return{enrollmentIntegrations:null!=(n=null==l?void 0:l.enrollmentIntegrations)?n:[],enrollmentIntegrationLoading:o,enrollmentIntegrationQueryCalled:a}};var sE=i(63191);function sk(){let e=(0,ng._)(["\n  query CheckUsername($integrationId: ID!, $username: String!) {\n    checkUsername(integrationId: $integrationId, username: $username) {\n      isAvailable\n    }\n  }\n"]);return sk=function(){return e},e}let sP=(0,iE.J1)(sk()),sO=e=>{var n;let{integrationId:i}=e,[t,{data:l,loading:o,error:a}]=(0,iT._)(sP,{variables:{integrationId:i,username:""}});return{checkUsername:t,usernameIsAvailable:null==l||null==(n=l.checkUsername)?void 0:n.isAvailable,loading:o,error:a}};function sR(){let e=(0,ng._)(["\n  query EnrollmentPreflow($applicationId: ID!, $integrationId: ID!) {\n    enrollmentPreflow(\n      applicationId: $applicationId\n      integrationId: $integrationId\n    ) {\n      outboundRedirect {\n        url\n        newTab\n      }\n      credentialCreationPolicies\n    }\n  }\n"]);return sR=function(){return e},e}let sL=(0,iE.J1)(sR()),sN=e=>{var n,i;let{data:t,loading:l,error:o,called:a}=e,r=null==t||null==(n=t.enrollmentPreflow)?void 0:n.outboundRedirect,d=null==t||null==(i=t.enrollmentPreflow)?void 0:i.credentialCreationPolicies;return{enrollmentPreflowResult:null==t?void 0:t.enrollmentPreflow,outboundRedirect:r,credentialCreationPolicies:d,loading:l,error:o,called:a}},sB=e=>{let{integrationId:n}=e,{applicationId:i}=(0,u.YY)(),[t,l]=(0,iT._)(sL,{variables:{applicationId:i,integrationId:n}});return{enrollmentPreflow:t,...sN(l)}},sM=e=>{let{integrationId:n}=e,{applicationId:i}=(0,u.YY)();return sN((0,ik.I)(sL,{variables:{applicationId:i,integrationId:n},skip:!i}))};function sz(){let e=(0,ng._)(["\n  mutation EnrollUser(\n    $applicationId: ID!\n    $integrationId: ID!\n    $username: String!\n    $password: String!\n  ) {\n    enrollUser(\n      applicationId: $applicationId\n      integrationId: $integrationId\n      username: $username\n      password: $password\n    ) {\n      success\n      outboundRedirectUrl\n      usernameError\n      passwordError\n      data\n      failSafeUrl\n      errors\n    }\n  }\n"]);return sz=function(){return e},e}let sV={username:"",password:""},s_=(0,iE.J1)(sz()),sU=e=>{let{integrationId:n}=e,{applicationId:i}=(0,u.YY)(),[t,{loading:l,error:o}]=(0,ey.n)(s_,{variables:{applicationId:i,integrationId:n,...sV},refetchQueries:[{query:sL,variables:{integrationId:n,applicationId:i}}],awaitRefetchQueries:!1});return{enrollUser:t,loading:l,error:o}},sq=e=>{var n;let{account:i,hasServices:t=!1,onGoToAccount:o}=e,a=(e=>{var n,i,t;let l=null!=(t=null==(n=e.product)?void 0:n.name)?t:"Account",o=e.maskedAccountNumber||(null==(i=e.number)?void 0:i.slice(-4));return o?"".concat(l," *****").concat(o):l})(i),r="active"===i.status?[{text:"Add Services",buttonTheme:"primary",onClick:()=>o(i.id)}]:void 0,d="Opened on ".concat((0,eY.wV)(i.openDate,{dateFormat:"MM/dd/yyyy"}));return(0,l.Y)(l.FK,{children:(0,l.Y)(a$.A,{actions:r,title:a,description:null==i||null==(n=i.fields)?void 0:n.accountName,tag:t?{text:"Services Requested",theme:"primary",note:d}:{text:"No Services Added",theme:"danger",note:d}})})},sH=e=>{let{accounts:n,onGoToAccount:i,indicationsOfInterest:t,onClickViewApplications:o,continuationButtons:a=[],enrollmentIntegrations:r=[],enrollmentHooks:d}=e;return(0,l.Y)(k.A,{children:(0,l.FD)(ei.A,{children:[(0,l.Y)(x.A,{heading:"Get the most out of your new accounts",subheading:"Here’s a summary of your accounts. Get the most out of your new accounts by activating services."}),null==n?void 0:n.map(e=>(0,l.Y)(sq,{account:e,hasServices:null==t?void 0:t.some(n=>n.accountId===e.id),onGoToAccount:i},e.id)),(0,l.Y)(d0,{continuationButtons:a,enrollmentIntegrations:r,enrollmentHooks:d,onClickViewApplications:o})]})})}
1,sK={backButton:e=>{let{colors:n}=e;return{display:"flex",alignItems:"center",color:n.brand.primary,cursor:"pointer",transition:"0.15s linear opacity",marginBottom:"2rem","&:hover":{opacity:"0.8"}}},icon:{width:"2rem",height:"2rem",marginRight:"-0.25rem",marginLeft:"-0.5rem"},addButton:{marginBottom:"1rem"}},sj=e=>{let{service:n,beneficiaries:i=[],onRequestBeneficiaries:t,onGoToPreviousView:o}=e,{triggerMessage:a}=(0,f.d)(),{isLoading:r,onClick:d}=(0,iB.A)({onClick:t}),{getFieldIsEnabled:s}=(0,T.d)(),[c,u]=(0,v.useState)(i||[]),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(!1),[y,I]=(0,v.useState)(null),[A,b]=(0,v.useState)(null),C=s("percentage"),S=!!i.find(e=>!!e.percentage),F=C||S,Y=F?c.reduce((e,n)=>(null==n?void 0:n.percentage)?new ew.z(e).plus(n.percentage).toNumber():e,0):null,D=new ew.z(Y||0),E=100===Y,P=E?"100%":"".concat(D.mod(1).eq(0)?D.toString():D.toFixed(2),"/100%"),O=F&&(Y&&Y<100||Y&&Y>100)||c.length<1,R=n.maximumBeneficiaries>1,L=c.length===n.maximumBeneficiaries,N=0===c.length,B="beneficiary"===n.type?"Primary":"Contingent",M=async()=>{var e;if(O)return void a("Combined allocation percentage must equal 100% in order to save beneficiaries.",{theme:"error"});let i=rm(c),t=await d({beneficiary:i,type:n.type,serviceId:n.id}),l=null==t||null==(e=t.beneficiaryConflicts)?void 0:e[0];if(!l)return;let o=c[l.beneficiaryIndex];o?(I(o),b({message:rd}),m(!0)):a(rd,{theme:"error"})};return(0,l.FD)(k.A,{children:[(0,l.Y)(rA,{beneficiaryToEdit:y,service:n,modalIsOpen:p,ownershipPercentage:Y,onClose:()=>void(m(!1),I(null),b(null)),onSubmit:e=>{let{beneficiary:n,isExisting:i}=e,t=rp(n);if(i&&y){let e=ru(y,c);c[e]=t,I(null),a("Beneficiary updated",{theme:"success"})}else c.push(t);u([...c]),m(!1),b(null)},isFirstBeneficiary:0===c.length,taxIdConflict:A}),(0,l.Y)(i9.A,{isOpen:h,buttonText:"Yes, Discard Progress",onConfirm:()=>void(g(!1),o()),heading:"Are you sure?",subheading:"Going back will discard your current progress on adding beneficiaries. Are you sure?",onClose:()=>g(!1)}),(0,l.FD)(ei.A,{theme:"small",children:[(0,l.FD)("div",{css:e=>sK.backButton(e),onClick:()=>g(!0),children:[(0,l.Y)(eH.A,{name:"chevron-left",css:sK.icon}),(0,l.Y)(np.A.Base,{children:"Back"})]}),(0,l.Y)(x.A,{heading:"".concat(B," Beneficiaries"),subheading:F&&
1!E?"Designate at least one".concat(c.length>0?" more":""," beneficiary of your account. The total allocation amount must be 100%."):n.description}),F?(0,l.Y)("div",{css:{marginBottom:"0.75rem"},children:(0,l.Y)(Z.A,{icon:E?"circle-check":"alert-circle-white",content:"**".concat(P,"** allocated"),theme:E?"success":"warning",size:"small"})}):null]}),(0,l.Y)(ei.A,{children:(0,l.FD)(l.FK,{children:[c.length>0?c.map((e,n)=>(0,l.Y)(rc,{beneficiary:(e=>{let{taxId:n,...i}=e;return{...i,taxIdLastFour:null==n?void 0:n.slice(-4)}})(e),onEditClick:()=>{b(null),I(e),m(!0)},onRemoveClick:()=>(e=>{a("Remove ".concat(e.firstName," ").concat(e.lastName,"..."),{isModal:!0,subheading:"Are you sure you want to remove this beneficiary?",buttonText:"Yes, remove this beneficiary",onConfirm:()=>(e=>{let n=ru(e,c);c.splice(n,1),u([...c]),a("".concat(e.firstName," ").concat(e.lastName," removed as beneficiary"),{theme:"success"})})(e),cancelText:"Cancel"})})(e)},n)):null,L&&(0,l.Y)("div",{css:{marginTop:"1.5rem",marginBottom:"1.5rem"},children:(0,l.Y)(Z.A,{icon:"info-circle",content:"".concat("You've reached the maximum number of permitted beneficiaries.").concat(F&&!E?" ".concat("To save beneficiaries, ensure the total allocation amount is 100%."):"")})}),(0,l.FD)("div",{children:[!(()=>{let e=!0!==R&&c.length>0,n=F&&!!Y;return e||n&&E||L})()&&(0,l.Y)("div",{css:sK.addButton,children:(0,l.Y)(w.A,{isFull:!0,theme:"outline",onClick:()=>m(!0),children:"Add Beneficiary"})}),!N&&(0,l.Y)(w.A,{onClick:()=>M(),isFull:!0,isLoading:r,children:"Save Beneficiaries"})]})]})})]})},sW=e=>{let{service:n,beneficiaries:i=[],onRequestBeneficiaries:t,onGoToPreviousView:o}=e;return(0,l.Y)(rh,{service:n.type,type:"person",children:(0,l.Y)(sj,{service:n,beneficiaries:i,onRequestBeneficiaries:t,onGoToPreviousView:o})})};function sG(){let e=(0,ng._)(["\n  mutation CreateBeneficiaryApplication(\n    $accountId: ID!\n    $serviceId: ID!\n    $beneficiary: [BeneficiaryFieldsJSONObject!]!\n  ) {\n    createBeneficiaryApplication(\n      accountId: $accountId\n      serviceId: $serviceId\n      beneficiary: $beneficiary\n    ) {\n      id\n    }\n  }\n"]);return sG=function(){return e},e}let s$=(0,iE.J1)(sG()),sQ=e=>n6()(e,e=>""!==e),sJ=e=>{var n,i;let{beneficiaries:t=[],service:o,accountId:a,successView:d,createBeneficiaryCdaso:s,setCurrentView:c,goToPreviousView:m}=e,{triggerMessage:h}=(0,f.d)(),{application:v,applicationId:g,userId:y}=(0,u.YY)(),I=a||(null==v||null==(n=v.fields)?void 0:n.accountId)||(null==v||null==(i=v.fields)?void 0:i.createdAccountId),{requestIndicationOfInterest:A}=sg({applicationId:g,userId:y,accountId:I}),{createBeneficiaryApplication:b}=(()=>{let[e,{loading:n}]=(0,ey.n)(s$);return{createBeneficiaryApplication:async n=>{var i;let{accountId:t,serviceId:l,beneficiary:o}=n;return null==(i=(await e({variables:{accountId:t,serviceId:l,beneficiary:o}})).data)?void 0:i.createBeneficiaryApplication},isCreatingBeneficiaryApplication:n}})(),{navigate:C}=(0,p._)(),S=null!=d?d:r.QL;ec({allowBrowserNavigationToViews:[S]});let w=async e=>{try{let n=(Array.isArray(e.beneficiary)?e.beneficiary:[e.beneficiary].filter(Boolean)).map(sQ),i="beneficiary"===o.type?"primary":"contingent",t=1===n.length?"beneficiary":"beneficiaries",l=o.confirmation?"".concat(o.confirmation,"."):"Request submitted to add your ".concat(i," ").concat(t,".");if(s){if(!I)return void h(U.hI,{theme:"error"});let e=await b({accountId:I,serviceId:o.id,beneficiary:n});if(!(null==e?void 0:e.id))return void h(U.hI,{theme:"error"});h(l,{theme:"success",persistAcrossViews:!0}),C("/application/".concat(e.id,"/").concat(r.jn.code));return}await A({...e,beneficiary:n,accountId:I}),h(l,{theme:"success",persistAcrossViews:!0});let a=S===r.QL?{...S,data:{accountId:I}}:S;setTimeout(()=>c(a),500)}catch(n){let e=d5(n);if(e)return{beneficiaryConflicts:e};h(U.hI,{theme:"error"})}};return(0,l.Y)(sW,{beneficiaries:t,service:o,onGoToPreviousView:m,onRequestBeneficiaries:w})};var sZ=i(40005),sX=i.n(sZ),s0=i(11618),s9=i.n(s0),s1=i(93515),s2=i(86046);let s6=e=>{var n,i,t,a,r,d;let{children:s,addressPrimaryState:c,dynamicOptions:u,application:p,maritalStatus:m,namePrefix:h,organizationKycEvaluationTags:v,organizationType:g,applicationType:f,underwritingTags:y,fundingTransactionType:I,currentAccount:A}
1=e,b=(0,D.t)(),C=(null==A?void 0:A.newAccountRelationshipData)?null==A?void 0:A.newAccountRelationshipData:null==p||null==(n=p.products)?void 0:n.flatMap(e=>e.newAccountRelationshipData).filter(Boolean),S=null==A?void 0:A.productId,w=null==A?void 0:A.accountVariant,x=(0,o.wZ)({accounts:[{accountVariant:w,productId:S}],config:b}),F=(0,eS.qk)(null==p?void 0:p.rawFields),Y=((e,n)=>{let i=((e,n)=>{var i;let t=[],l=null==(i=n.clientDetails)?void 0:i.previousYearContributionCutoffDay;return l&&r7.$n(l)&&t.push("qualifiesForPreviousYearContribution"),e.fundingTransactionType&&t.push("fundingTransactionType:".concat(e.fundingTransactionType)),t})(e,n),t=(0,e7.o)(e,n),l=e.accountInfo[0]?(0,o.e6)({clientConfig:n,...e.accountInfo[0]}):void 0;return e.fundingTransactionType&&l&&i.push("fundingTransactionType:".concat(e.fundingTransactionType,"-ownershipType:").concat(l)),e.fundingTransactionType&&e.planType&&i.push("fundingTransactionType:".concat(e.fundingTransactionType,"-planType:").concat(e.planType)),[...i,...t]})({person:{maritalStatus:m,addressPrimaryState:c},applicationType:null!=f?f:null==p?void 0:p.type,originatingExperience:null!=(i=null==p?void 0:p.originatingExperience)?i:"selfServe",accountInfo:(0,ne.SP)(null==p?void 0:p.rawFields),newAccountRelationshipD
1ata:C,organizationType:g,organizationKycEvaluationTags:v,underwritingTags:y,fundingTransactionType:I,planType:x,closingStatus:null!=(t=null==p?void 0:p.closingStatus)?t:null,preOfferStatus:null!=(a=null==p?void 0:p.preOfferStatus)?a:null,offerStatus:null!=(r=null==p?void 0:p.offerStatus)?r:null,purposeOfLoan:null!=(d=null==F?void 0:F.purposeOfLoan)?d:null},b),E=(0,nn.A)({entityType:"funding",namePrefix:h,scopes:Y}),k=e=>e in E.fields;for(let e in u)if(k(e)&&e in E.fields){let n=E.fields[e];n&&"options"in n&&(n.options=u[e])}return(0,l.Y)(T.A,{...E,namePrefix:h,children:s})},s5=e=>{var n,i,t;let o,{application:a,currentAccount:r,getReferenceIdIfPrimaryShareFundingTransactionExistsForPrimaryEntity:d}=e,{primaryShareData:s}=a.fields||{},{primaryShareFundingTransactionsToCreate:c}=s||{},{creditUnionFee:u,primaryShareOwnerEntityId:p,primaryShareOwnerEntityType:m}=(0,s1.qn)({primaryShareFundingTransactionsToCreate:c,account:r||null})||{};if("person"===m&&(o=null==(n=a.persons.find(e=>e.id===p))?void 0:n.firstName),!((null==u?void 0:u.amountCents)||(null==u?void 0:u.donationCents)))return null;if(r&&!("isPrimaryShareAccount"in r)||!(null==r?void 0:r.isPrimaryShareAccount)){let e=d(r);if(e&&r&&"referenceId"in r&&e!==r.referenceId)return null}let h=u.amountCents?t8(u.amountCents):null,v=(null==u?void 0:u.donationCents)?t8(u.donationCents):null;return(0,l.FD)(l.FK,{children:[(0,l.Y)(s2.A,{name:"creditUnionFee",value:null!=(i=u.amountCents.toString())?i:void 0,note:"Required with all new memberships",ariaLabel:"Credit union fee",ariaDescription:"Required with all new memberships",readOnly:!0,label:"".concat((null==u?void 0:u.paidByCustomerLabel)||"Membership Fee"),infoTooltip:(null==u?void 0:u.paidByCustomerTooltip)||"A $".concat(h," fee will be added to your transaction amount. This is required to fund all new membership shares. If ").concat(o||"the applicant"," is already a member, this $").concat(h," fee will not be withdrawn from your account.")},"creditUnionFee"),(null==u?void 0:u.donationCents)&&(0,l.Y)(s2.A,{name:"donationFee",value:null!=(t=u.donationCents.toString())?t:void 0,note:"Required with your selected membership eligibility",ariaLabel:"Donation fee",ariaDescription:"Required with your selected membership eligibility",readOnly:!0,label:(null==u?void 0:u.donationFeeLabel)||"Donation Fee",infoTooltip:(null==u?void 0:u.donationFeeTooltip)||"A $".concat(v," will be added to your total funding amount. This is required based on your selected membership eligibility.")},"donationFee")]})},s4={container:{position:"relative",marginBottom:"14px"},heading:e=>{let{colors:n}=e;return{fontSize:12,color:n.grey2,marginTop:"4px",marginBottom:"4px"}},error:e=>{let{colors:n}=e;return{color:n.red3,fontSize:12}}},s3=e=>{let{value:n,error:i}=e;return(0,l.FD)("div",{css:s4.container,children:[(0,l.Y)(np.A.H6,{css:s4.heading,children:"Total Amount"}),(0,l.Y)(np.A.H4,{children:(0,l.Y)("div",{css:{fontWeight:700},"aria-label":"Total Amount",children:(0,eN.CQ)(n,{style:"US"})})}),i&&(0,l.Y)("div",{css:s4.error,children:i})]})},s8=e=>{let{application:n,fundingAmountInCents:i,fundingTotalErrorMessage:t,transactionAmountsForPersons:o,setPrimaryShareFundingAmountInCents:a}=e,{primaryShareData:r}=n.fields||{},{primaryShareFundingTransactionsToCreate:d}=r||{};return(0,l.FD)(l.FK,{children:[null==d?void 0:d.map((e,i)=>{var t,r,s;let c,{creditUnionFee:u,primaryShareOwnerEntityId:p,primaryShareOwnerEntityType:m}=e;if("person"===m&&(c=null==(t=n.persons.find(e=>e.id===p))?void 0:t.firstName),!((null==u?void 0:u.amountCents)||(null==u?void 0:u.donationCents)))return null;let h=u.amountCents?t8(u.amountCents):null,v=(null==u?void 0:u.donationCents)?t8(u.donationCents):null;return(0,l.FD)(l.FK,{children:[(0,l.Y)(s2.A,{name:"creditUnionFee",value:null!=(r=u.amountCents.toString())?r:void 0,onChange:e=>a({...o,[p]:e}),note:"Required with all new memberships",ariaLabel:"Credit union fee",ariaDescription:"Required with all new memberships",readOnly:!0,label:"".concat((null==u?void 0:u.paidByCustomerLabel)||"Membership Fee").concat(d.length>1?" for ".concat(c||"Applicant"):""),infoTooltip:(null==u?void 0:u.paidByCustomerTooltip)||"A $".concat(h," fee will be added to your transaction amount. This is required to fund all new membership shares. If ").concat(c||"the applicant"," is already a member, this $").concat(h," fee will not be withdrawn from your account.")},"creditUnionFee".concat(i)),(null==u?void 0:u.donationCents)&&(0,l.Y)(s2.A,{name:"donationFee",value:null!=(s=u.donationCents.toString())?s:void 0,onChange:e=>a({...o,[p]:e}),note:"Required with your selected membership eligibility",ariaLabel:"Donation fee",ariaDescription:"Required with your selected membership eligibility",readOnly:!0,label:"".concat((null==u?void 0:u.donationFeeLabel)||"Donation Fee").concat(d.length>1?" for ".concat(c||"Applicant"):""),infoTooltip:(null==u?void 0:u.donationFeeTooltip)||"A $".concat(v," will be added to your total funding amount. This is required based on your selected membership eligibility.")},"donationFee".concat(i))]})}
1),(null==d?void 0:d.length)&&(0,l.Y)(s3,{value:(0,s1.cM)({fundingAmountInCents:Number(i),primaryShareFundingTransactions:d}),error:t})]})},s7=e=>{let{fundingSource:n,productCustomerType:i,isLoading:t,onClose:o,onConfirm:a}=e,{getValues:r}=(0,S.xW)();return(0,l.Y)(ll,{isOpen:!0,fundingSource:n,productCustomerType:i,isLoading:t,onClose:o,onConfirm:e=>a(e,r("retirementAccountFundingMethod"))})},ce=e=>{var n,i,t;let{application:o,currentAccount:a,isInBulkContext:r,fundingSources:d,product:s,handleSubmitFundingTransaction:c,handleSubmitPrimaryShareFundingTransaction:u,handleNextView:p,getInitialFundingAmountInCents:m,hasExistingFundingTransaction:h,userIsNonSignerApplicant:g,onCancel:f,handleCurrentFundingSourceClick:I,currentFundingSource:A,selectFundingSourceModal:b,cancelFundingTransactionModal:C,allowSkipFunding:S,isCreditUnionFeePaidByCustomer:x,canSkipSelectedShareFunding:F,isCancelingOrCreatingFundingTransaction:T,transactionAmountsForPersons:E,setPrimaryShareFundingAmountInCents:k,createPrimaryShareFundingTransactions:P,handleFundingTransactionErrorLogging:O,getReferenceIdIfPrimaryShareFundingTransactionExistsForPrimaryEntity:R,onUpdateExternalAccountHolderCategory:L}=e,{funding:N,clientDetails:B,mantlFeatures:M,products:z}=(0,D.t)(),V="creditUnion"===B.clientType,_=a&&"referenceId"in a?a.referenceId:null,U=null==a?void 0:a.productId,{primaryShareData:q}=o.fields||{},H=!!(null==s?void 0:s.allowSkipFunding),K=a&&"isPrimaryShareAccount"in a&&!!(null==a?void 0:a.isPrimaryShareAccount),[j,W]=(0,v.useState)(m(_)),[G,$]=(0,v.useState)(!1),Q=(0,ir.h9)(),[J,Z]=(0,v.useState)(!1),X=M.accountOpening.funding.collectAccountHolderCategory,ee=(0,v.useRef)(null),en=(()=>{if(A&&"logo"in A&&!A.logo){let e=d.filter(Boolean).find(e=>e&&e.id===A.id);if(null==e?void 0:e.logo)return{...A,logo:e.logo}}return A})(),et=(null==(n=o.fields)?void 0:n.accounts)&&o.fields.accounts.length>1,el=V&&!!(null==q?void 0:q.primaryShareFundingTransactionsToCreate.length)&&!et,{minTransactionAmountInCents:eo,maxTransactionAmountInCents:ea}=(e=>{var n;let{currentFundingSource:i,product:t,fundingAmountInCents:l,canSkipSelectedShareFunding:o}=e,a=i&&"InternalAccountFundingSource"!==i.type?nr.vw[i.type]:null,r=a&&(null==t||null==(n=t.fundingMethods)?void 0:n[a]);return{maxTransactionAmountInCents:new ew.A((null==r?void 0:r.maxTransactionAmountInCents)||"0").toNumber(),minTransactionAmountInCents:o&&!l?0:new ew.A((null==r?void 0:r.minTransactionAmountInCents)||"0").toNumber()}})({currentFundingSource:A,product:s,fundingAmountInCents:j,canSkipSelectedShareFunding:F}),{primaryShareFundingTransactionsToCreate:er}=q||{},{fundingErrorMessage:ed,fundingInputNote:es,fundingTotalErrorMessage:ec}=K?{fundingErrorMessage:"",fundingInputNote:"",fundingTotalErrorMessage:""}:(e=>{let{minTransactionAmountInCents:n,fundingAmountInCents:i,maxTransactionAmountInCents:t,currentFundingSource:l,canSkipSelectedShareFunding:o,fundingTotal:a}=e,r=(e=>e?(0,id.En)(e)?e.availableBalance||null:"balance"in e&&e.balance||null:null)(l),d=r&&""!==r?new ew.A(r).times(100):null,s=n&&"Minimum deposit amount is ".concat((0,eN.CQ)(n),"."),c=new ew.A(i||"0"),u=t&&c.gt(t)?"The maximum deposit for this funding method is ".concat((0,eN.CQ)(t),"."):null,p=d&&c.gt(d)?"The selected amount exceeds your available balance.":null,m=(o&&c.eq(0)?null:n&&c.lt(n)?s:null)||u||p;return{fundingInputNote:o&&!m?" ":m||s||"Enter funding amount before continuing",fundingErrorMessage:m,fundingTotalErrorMessage:d&&a&&d.lt(a)?"This exceeds your available account balance.":null}})({minTransactionAmountInCents:eo,fundingAmountInCents:j,maxTransactionAmountInCents:ea,currentFundingSource:A,canSkipSelectedShareFunding:F,fundingTotal:er&&(0,s1.cM)({fundingAmountInCents:Number(j),primaryShareFundingTransactions:er})}),eu=async e=>{let n=j?new ew.z(j).toNumber():null;try{let i,t,l=[];if(a&&"referenceId"in a&&A&&E){let e=(0,s1.qn)({primaryShareFundingTransactionsToCreate:er,account:a});if(e&&!el){let{primaryShareOwnerEntityId:n,primaryShareOwnerEntityType:i,primaryShareCreationInstructionName:l,membershipType:o}=e,r=R(a);r&&r!==a.referenceId||(t=await u({accountReferenceId:a.referenceId,productId:a.productId,primaryShareOwnerEntityId:n,primaryShareOwnerEntityType:i,primaryShareCreationInstructionName:l,isClientFundedPrimaryShareTransaction:!1,externalFundingSource:A,primaryShareFundingAmountInCents:E[n],membershipType:o}))}}el&&(l=await P()),(n||!F)&&A&&!K&&(i=await c({fundingSource:A,fundingAmountInCents:null!=j?j:"",...e?{retirementAccountFundingMethod:e}:{},...U?{productId:U}:{},...a&&"referenceId"in a?{accountReferenceId:a.referenceId}:{}}));let o=i||t||l[0];return o&&p({fundingTransaction:o,fundingAmount:n})}catch(e){O(e);return}},ep=async e=>{let{retirementAccountFundingMethod:n}=e,i=j?new ew.z(j).toNumber():null;
1if($(!0),!ed&&!ec){if(h&&!i&&F)return void C.openModal();if(X&&L&&t7(A))return void Q.openModal();await eu(n)}},em=async()=>{let e=ln({productAllowsSkipFunding:H,userIsNonSignerApplicant:g,canSkipSelectedShareFunding:F,isCreditUnion:V});h&&e?C.openModal():f()},eh=async(e,n)=>{if(t7(A))try{Z(!0),await (null==L?void 0:L(A.id,e)),await eu(n)}catch(e){O(e),Q.closeModal()}finally{Z(!1)}},{isLoading:ev,onClick:eg}=(0,iB.A)({onClick:ep}),ef=(null==A?void 0:A.type)?(e=>{var n,i,t,l,o;let a,r=null==s?void 0:s.fundingMethods;if("InternalAccountFundingSource"===e)return null;if("card"===nr.vw[e])a=null==r||null==(i=r.card)?void 0:i.id;else if("manualBankAccount"===nr.vw[e])a=null==r||null==(t=r.manualBankAccount)?void 0:t.id;else if("instantAccountVerification"===nr.vw[e])a=null==r||null==(l=r.instantAccountVerification)?void 0:l.id;else{if("internalTransfer"!==nr.vw[e])return null;a=null==r||null==(o=r.internalTransfer)?void 0:o.id}return a?null==(n=N.methods[a])?void 0:n.type:null})(A.type):null;return(0,l.Y)(l.FK,{children:(0,l.FD)(y.A,{onSubmit:eg,children:[(0,l.FD)(ei.A,{theme:"small",children:[!b.modalIsOpen&&(0,l.FD)(l.FK,{children:[!K&&(0,l.FD)(l.FK,{children:[(0,l.Y)(s6,{application:o,fundingTransactionType:ef,currentAccount:a,children:(0,l.Y)(Y.A,{fieldId:"retirementAccountFundingMethod"})}),(0,l.Y)(s2.A,{ref:ee,name:"fundingAmount",value:j||"",onChange:W,note:es,label:S?"Amount (optional)":"Amount",ariaLabel:"Funding amount",ariaDescription:es,autoFocus:!0,state:G&&ed?"error":void 0})]}),x&&(Number(null==o||null==(t=o.fields)||null==(i=t.accounts)?void 0:i.length)>1&&a&&"referenceId"in a?(0,l.Y)(s5,{application:o,currentAccount:a,getReferenceIdIfPrimaryShareFundingTransactionExistsForPrimaryEntity:R}):(0,l.Y)(s8,{application:o,fundingAmountInCents:j,fundingTotalErrorMessage:ec,transactionAmountsForPersons:E,setPrimaryShareFundingAmountInCents:k}))]}),(0,l.Y)(t3.Ay,{fundingSource:en,onClick:I,"aria-description":"This is your currently selected funding source. Press enter to select a different funding method.",configProducts:z})]}),r?(0,l.Y)(l.FK,{children:(0,l.FD)("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[(0,l.Y)(w.A,{type:"submit",isFull:!0,isLoading:ev,children:"Continue"}),(0,l.Y)(w.A,{onClick:em,type:"button",isFull:!0,isLoading:T,theme:"link",children:"Cancel"})]})}):(0,l.Y)(w.A,{type:"submit",isFull:!0,isLoading:ev,children:"Continue"}),Q.modalIsOpen&&t7(A)&&(0,l.Y)(s7,{fundingSource:A,productCustomerType:null==s?void 0:s.customerType,isLoading:J,onClose:Q.closeModal,onConfirm:eh})]})})},cn={spinner:{width:"100%",textAlign:"center",marginTop:100},infoBoxContainer:{marginTop:16}},ci=e=>{var n,i,t,o,a,r;let{application:d,currentAccount:s,accountIdToEdit:c,fundingSources:u,isLoadingFundingSources:p,currentFundingSource:m,product:h,rolloverOrTransferServices:g,handleSubmitFundingTransaction:f,handleSubmitPrimaryShareFundingTransaction:y,handleNextView:I,onSkipFunding:A,getInitialFundingAmountInCents:b,hasExistingFundingTransaction:C,hasFailedFunding:S,onSelectFundingSource:F,iavFundingIsLoading:Y,iavFundingError:T,userIsNonSignerApplicant:E,onCancel:k,handleCurrentFundingSourceClick:P,handleEditFundingSourceClick:O,handleSelectRolloverOrTransfer:R,selectFundingSourceModal:L,cancelFundingTransactionModal:N,accountsThatCanBeFunded:B,onUpdateExternalAccountHolderCategory:M}=e,{clientDetails:z,mantlFeatures:V,experiences:{selfServe:{pages:{fundAccount:{headerText:_,subheaderText:U,formInfoText:q,formInfoTooltip:H}={}}}}}=(0,D.t)(),[K,j]=(0,v.useState)(!1),W="creditUnion"===z.clientType,G=(0,eL.FF)("app-2656-dont-create-client-funded-transactions-in-fe"),$=null==V||null==(i=V.accountOpening)||null==(n=i.bulkApplications)?void 0:n.enabled,J=G||$,X=null==s?void 0:s.productId,{primaryShareData:ee}=d.fields||{},{primaryShareFundingTransactionsToCreate:en}=ee||{},et=!!(null==h?void 0:h.allowSkipFunding),[el,eo]=s9()(u,id.En),ea=(null==g?void 0:g.length)>0,er=!!(null==ee||null==(t=ee.primaryShareFundingTransactionsToCreate)?void 0:t.find(e=>{var n;return null==(n=e.creditUnionFee)?void 0:n.paidByCustomer})),ed=B&&(null==B?void 0:B.length)>1,es=(null==(o=d.fields)?void 0:o.accounts)&&d.fields.accounts.length>1,ec=e=>{var n,i;let t=d.fundingTransactions,l=e&&(null==(n=e.newAccountRelationshipD
1ata)?void 0:n.find(e=>e.isPrimaryEntity)),o=null==t?void 0:t.find(e=>l&&(null==e?void 0:e.primaryShareOwnerPersonId)&&"personId"in l&&(null==e?void 0:e.primaryShareOwnerPersonId)===(null==l?void 0:l.personId)||l&&!!(null==e?void 0:e.primaryShareOwnerOrganizationId)&&"organizationId"in l&&e.primaryShareOwnerOrganizationId===(null==l?void 0:l.organizationId));return null==o||null==(i=o.meta)?void 0:i.accountReferenceId},eu=ec(s),ep=(0,s1.qn)({primaryShareFundingTransactionsToCreate:en,account:s||null}),em=ep&&s&&"referenceId"in s&&(!eu||eu===s.referenceId),eh=(e=>{let{isCreditUnionFeePaidByCustomer:n,doesProductAllowSkipFunding:i,selectedProductIsPrimaryShare:t,hasCurrentFundingSource:l,selectedShareIsPrimaryShareBulk:o}=e;return o?i:i&&!(!t&&n&&!l)})({isCreditUnionFeePaidByCustomer:er,doesProductAllowSkipFunding:et,selectedProductIsPrimaryShare:!!(null==ee||null==(a=ee.primaryAccountRoleData)?void 0:a.isSelectedShareProduct),hasCurrentFundingSource:!!m,selectedShareIsPrimaryShareBulk:!!ed&&!!em}),ev=S?{heading:"Retry initial deposit!",subheading:"Something went wrong with your initial deposit. Please confirm your funding source and enter an amount before you continue.",...{productId:X||(null==h?void 0:h.id)}}:{heading:_||"Set up your initial deposit!",subheading:U||(0,l.FD)(l.FK,{children:["To open your ",(0,l.Y)(tP.yN,{children:null==h?void 0:h.name})," account, you'll need to deposit funds into the account."]}),...{productId:X||(null==h?void 0:h.id)}},eg=!c&&ed,ef=ln({productAllowsSkipFunding:et,userIsNonSignerApplicant:E,canSkipSelectedShareFunding:eh,isCreditUnion:W}),ey=ep&&er,eI=!p&&!ey&&(ef&&!eg||!m&&eg),eA=W&&!!(null==ee?void 0:ee.primaryShareFundingTransactionsToCreate.length)&&!es,eb=null==ee?void 0:ee.primaryShareFundingTransactionsToCreate.reduce((e,n)=>{var i,t;return(null==(i=n.creditUnionFee)?void 0:i.amountCents)||(null==(t=n.creditUnionFee)?void 0:t.donationCents)?{...e,[n.primaryShareOwnerEntityId]:new ew.A(n.creditUnionFee.amountCents).toString()}:e},{}),[eC,eS]=(0,v.useState)(eb),ex=async()=>((0,Q.HO)(en),Promise.all(en.reduce((e,n)=>{let{productId:i,primaryShareOwnerEntityId:t,primaryShareOwnerEntityType:l,creditUnionFee:o,membershipType:a,primaryShareCreationInstructionName:r}=n;return(null==o?void 0:o.paidByCustomer)?(null==eC?void 0:eC[t])&&m&&e.push(y({productId:i,primaryShareOwnerEntityId:t,primaryShareOwnerEntityType:l,primaryShareCreationInstructionName:r,isClientFundedPrimaryShareTransaction:!1,primaryShareFundingAmountInCents:eC[t],externalFundingSource:m,membershipType:a})):J||e.push(y({productId:i,primaryShareOwnerEntityId:t,primaryShareOwnerEntityType:l,primaryShareCreationInstructionName:r,isClientFundedPrimaryShareTransaction:!0,membershipType:a,creditUnionFee:o})),e},[]))),eF=e=>Array.isArray(e)&&e.forEach(e=>console.error(e)),eY=async()=>{let e=s&&"referenceId"in s?s.referenceId:null;if(C)N.openModal();else if(eA)try{j(!0),await ex(),await A(e)}catch(e){eF(e);return}finally{j(!1)}else try{j(!0),await A(e)}catch(e){eF(e);return}finally{j(!1)}},eT=m&&eI?"xSmall":"small";return(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{...ev}),(0,l.Y)(ei.A,{theme:eT,children:p?(0,l.Y)("div",{css:cn.spinner,children:(0,l.Y)(ny.A,{size:"large"})}):m?(0,l.Y)(l.FK,{children:(0,l.Y)(ce,{application:d,currentAccount:s,isInBulkContext:!!eg,fundingSources:u,product:h,handleSubmitFundingTransaction:f,handleSubmitPrimaryShareFundingTransaction:y,handleNextView:I,getInitialFundingAmountInCents:b,hasExistingFundingTransaction:C,userIsNonSignerApplicant:E,onCancel:k,handleCurrentFundingSourceClick:P,currentFundingSource:m,selectFundingSourceModal:L,cancelFundingTransactionModal:N,allowSkipFunding:ef,onSkipFunding:A,isCreditUnionFeePaidByCustomer:er,canSkipSelectedShareFunding:eh,isCancelingOrCreatingFundingTransaction:K,transactionAmountsForPersons:eC,setPrimaryShareFundingAmountInCents:eS,createPrimaryShareFundingTransactions:ex,handleFundingTransactionErrorLogging:eF,getReferenceIdIfPrimaryShareFundingTransactionExistsForPrimaryEntity:ec,onUpdateExternalAccountHolderCategory:M})}):(0,l.Y)(l.FK,{children:(0,l.Y)(ly,{displayRolloverOrTransferOption:ea,handleSelectRolloverOrTransfer:R,internalAccountFundingSources:el,productAllowsInternalTransfer:!!(null==h||null==(r=h.fundingMethods)?void 0:r.internalTransfer),externalFundingSources:eo,iavFundingIsLoading:Y,iavFundingError:T,product:h,onEditFundingSourceClick:O,onSelectFundingSource:F,isAutopaySetup:!1})})}),eI&&(0,l.Y)(l.FK,{children:(0,l.Y)(w.A,{onClick:eY,type:"button",isLoading:K,theme:"outline",isFull:!0,children:eg?"Return to Previous Page":"Skip Funding For Now"})}),!!q&&(0,l.Y)("div",{css:cn.infoBoxContainer,children:(0,l.Y)(Z.A,{icon:"info-circle",content:q,tooltipContent:H,tooltipIcon:"info-circle",productId:X||(null==h?void 0:h.id)})})]})},ct={container:{display:"flex",flexDirection:"column",padding:"16px 16px 0"},checkboxOrRadio:{"& + &":{marginTop:12}},checkboxOrRadioLabel:{marginBottom:0},infoBox:{padding:16},button:{padding:"16px",flex:"1 1 100%",button:{paddingTop:16,paddingBottom:16,marginTop:6}}},cl=e=>{let{isOpen:n,onClose:i,rolloverOrTransferServices:t,isRequestingRolloverOrTransfer:o,onRolloverOrTransferSubmit:a,selectedRolloverOrTransferService:r,setSelectedRolloverOrTransferService:d,...s}=e;return(0,l.FD)(nh.A,{isOpen:n,onClose:i,onClickAway:i,...s,children:[(0,l.FD)("div",{css:ct.container,children:[(0,l.Y)(x.A,{heading:"Rollover or Transfer",theme:"small"}),null==t?void 0:t.map(e=>{let n=(null==r?void 0:r.id)===e.id;return(0,l.Y)("div",{css:ct.checkboxOrRadio,children:(0,l.Y)(eq.A,{id:e.id,theme:"row",type:"radio",name:"selectingRolloverOrTransferFunding","aria-description":"Press enter to select this option and proceed to Review and Sign",isChecked:n,onChange:()=>d(e),label:(0,l.Y)(x.A,{heading:e.name,subheading:e.description,theme:"xsmall",css:ct.checkboxOrRadioLabel})})},e.id)})]}),r&&(0,l.Y)("div",{css:ct.infoBox,children:(0,l.Y)(Z.A,{icon:"info-circle",content:r.disclosure||"The institution holding your retirement account will typically provide you with a check that must then be deposited 
1with <%= clientDetails.clientFullName %>."})}),(0,l.Y)("div",{css:ct.button,children:(0,l.Y)(w.A,{isFull:!0,name:"confirm",onClick:a,isLoading:o,children:"Confirm"})})]})},co=e=>{let{application:n,currentAccount:i,accountIdToEdit:t,fundingSources:o,mostRecentlyUsedInternalAccountFundingSource:a,isLoadingFundingSources:r,selectedFundingSource:d,product:s,rolloverOrTransferServices:c,person:u,handleSubmitFundingTransaction:p,handleSubmitPrimaryShareFundingTransaction:m,handleNextView:h,onSkipFunding:g,onDismissSkipFunding:y,iavFundingAccounts:I,isHostedLinkRedirect:A,getInitialFundingAmountInCents:b,hasExistingFundingTransaction:C,hasFailedFunding:S,onConnectIavFundingAccount:w,onExternalAccountSubmit:x,onExternalCardSubmit:F,onRolloverOrTransferSubmit:Y,onSelectFundingSource:T,isCreatingIavFundingExternalAccounts:E,errorCreatingIavFundingExternalAccounts:P,iavFundingIsOpen:O,iavFundingIsLoading:R,iavFundingError:L,userIsNonSignerApplicant:N,onCancel:B,accountsThatCanBeFunded:M,onUpdateExternalAccountHolderCategory:z}=e,{triggerMessage:V}=(0,f.d)(),{products:_}=(0,D.t)(),U=i&&"referenceId"in i&&i.referenceId||null,[q,H]=(0,v.useState)(!1),[K,j]=(0,v.useState)(!1),[W,G]=(0,v.useState)(null),[$,Q]=(0,v.useState)((null==c?void 0:c.length)===1?c[0]:null),J=(0,ir.h9)(),Z=(0,ir.h9)(),X=(0,ir.h9)(),ee=(0,ir.h9)(),en=(0,v.useRef)(null),ei=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(O){var e;null==(e=document.querySelector('iframe[title="Plaid Link"]'))||e.focus(),J.modalIsOpen&&(ei.current=!0,J.closeModal()),Z.modalIsOpen&&Z.closeModal()}else ei.current&&J.openModal()},[O]),(0,v.useEffect)(()=>{var e;(null==(e=n.requiredActions)?void 0:e.some(e=>"incorrectPrimaryShareFundingTransaction"===e.type))&&V("The funding transaction could not be processed. Please review and resubmit your funding request",{theme:"error"})},[]);let[et,el]=s9()(o,id.En),eo=el.filter(e=>!(0,id.gV)({fundingSource:e,hasInternalFundingSources:et.length>0})),ea=e=>!!e&&!!(null==o?void 0:o.some(n=>n.type===e.type)),er=ea(a)?a:null,ed=sX()([...eo,...er?[er]:[]],"createdAt","desc")[0],es=(null==c?void 0:c.length)>0,ec=(ea(d)?d:null)||(es?null:ed),eu=e=>{if((null==e?void 0:e.id)==="instantAccountVerification")return void w();G(e),J.openModal(),Z.closeModal()},ep=()=>{G(null),J.openModal()};(e=>{let{onSelectionRequired:n,onPlaidError:i,isCreatingIavFundingExternalAccounts:t,errorCreatingIavFundingExternalAccounts:l,iavFundingIsOpen:o,isHostedLinkRedirect:a,iavFundingAccounts:r}=e,[d,s]=(0,v.useState)(!1);(0,v.useEffect)(()=>{t&&s(!0)},[t]),(0,v.useEffect)(()=>{a&&r&&r.length>0&&s(!0)},[a,r]),(0,v.useEffect)(()=>{d&&!o&&(n(),s(!1))},[d,o]),(0,v.useEffect)(()=>{l&&i()},[l])})({onSelectionRequired:()=>{var e,n;G(null!=(n=(0,id.Zv)({fundingMethodsForProduct:null!=(e=null==s?void 0:s.fundingMethods)?e:{}}).instantAccountVerification)?n:null),J.openModal()},isCreatingIavFundingExternalAccounts:E,errorCreatingIavFundingExternalAccounts:P,onPlaidError:()=>G(null),iavFundingIsOpen:O,isHostedLinkRedirect:A,iavFundingAccounts:I});let em=async()=>{if($)try{j(!0),await Y($)}finally{j(!1),X.closeModal()}},eh=async()=>{try{H(!0),await g(U)}finally{H(!1),ee.closeModal()}},ev=()=>{J.closeModal(),Z.closeModal(),X.openModal()};return(0,l.FD)(k.A,{children:[(0,l.Y)(ci,{application:n,currentAccount:i,accountIdToEdit:t,fundingSources:o,isLoadingFundingSources:r,currentFundingSource:ec,product:s,rolloverOrTransferServices:c,handleSubmitFundingTransaction:p,handleSubmitPrimaryShareFundingTransaction:m,handleNextView:h,onSkipFunding:g,getInitialFundingAmountInCents:b,hasExistingFundingTransaction:C,hasFailedFunding:S,onSelectFundingSource:T,iavFundingIsLoading:R,iavFundingError:L,userIsNonSignerApplicant:N,onCancel:B,handleCurrentFundingSourceClick:ep,handleEditFundingSourceClick:eu,handleSelectRolloverOrTransfer:ev,selectFundingSourceModal:J,cancelFundingTransactionModal:ee,accountsThatCanBeFunded:M,onUpdateExternalAccountHolderCategory:z}),(0,l.Y)(i9.A,{isOpen:!!ee.modalIsOpen,buttonText:"Yes, Cancel Initial Deposit",cancelText:"No, Keep Initial Deposit",onClose:ee.closeModal,onConfirm:eh,onCancel:()=>{y(),ee.closeModal()},onClickAway:ee.closeModal,isLoading:q,heading:"Remove Initial Deposit",subheading:"Are you sure that you want to cancel your initial deposit?",icon:"illustration-funding"}),(0,l.Y)(lA,{heading:"Select Funding Method",subheading:"Select from a saved account source or add a new one",person:u,product:s,fundingSources:[...el,...et],iavFundingAccounts:I,iavFundingError:L,selectedFundingSourceId:null==ec?void 0:ec.id,editingFundingSource:W,isOpen:J.modalIsOpen,iavFundingIsLoading:R,isCreatingIavFundingExternalAccounts:E,isAutopaySetup:!1,displayRolloverOrTransferOption:es,onClose:()=>{var e;J.closeModal(),null==(e=en.current)||e.focus()},onSelectFundingSource:T,onConnectIavFundingAccount:w,onExternalAccountSubmit:x,onExternalCardSubmit:F,onSelectRolloverOrTransfer:ev,onEditFundingSourceClick:eu,onAddNewFundingSourceClick:()=>{J.closeModal(),G(null),Z.openModal()},handleCurrentFundingSourceClick:ep}),(0,l.Y)(lh,{person:u,product:s,iavFundingAccounts:I,iavFundingError:L,editingFundingSource:W,isOpen:Z.modalIsOpen,iavFundingIsLoading:R,isCreatingIavFundingExternalAccounts:E,displayRolloverOrTransferOption:es,onClose:()=>{var e;Z.closeModal(),null==(e=en.current)||e.focus()},onEditFundingSourceClick:eu,onSelectFundingSource:T,onSelectRolloverOrTransfer:ev,onExternalCardSubmit:F,onExternalAccountSubmit:x,onCurrentFundingSourceClick:ep,configProducts:_}),(0,l.Y)(cl,{rolloverOrTransferServices:c,selectedRolloverOrTransferService:$,setSelectedRolloverOrTransferService:Q,isOpen:X.modalIsOpen,isRequestingRolloverOrTransfer:K,onClose:()=>{var e;X.closeModal(),null==(e=en.current)||e.focus()},onRolloverOrTransferSubmit:em})]})};var ca=i(34486);let cr={title:e=>{let{fontScales:n}=e;return{...n.medium,fontWeight:700}},cardContainer:{marginBottom:16},cardInnerFlex:{display:"flex",justifyContent:"space-between",alignItems:"center"}},cd={title:e=>{let{fontScales:n}=e;return{...n.medium,fontWeight:700}},description:e=>{let{fontScales:n}=e;return{...n.default,marginBottom:16}},titleContainer:{display:"flex",alignItems:"center",gap:2,marginBottom:8,marginTop:16}},cs=e=>{var n,i,t;let{application:o,missingFundingReferenceIds:a,fundingTransactions:r,isLoading:d,onNext:s,setAccountReferenceId
1BeingFunded:c}=e,{triggerMessage:u}=(0,f.d)(),p=(0,D.t)(),m=e=>a.includes(e)?{text:"Deposit Required",theme:"warning"}:null,h=null!=(t=null==(n=o.fields)?void 0:n.accounts)?t:[],v=e=>{let n=null==e?void 0:e[0];if(n&&((null==n?void 0:n.fundingSource)||(null==n?void 0:n.type)==="manual")){let{fundingSource:i,type:t}=n,l=e.reduce((e,n)=>e+(Number(n.fundingAmount)||0),0),o=l?["Amount:",(0,eN.CQ)(l)]:[],a="manual"===t?"In-Person Funding":null,r=(null==i?void 0:i.lastFour)?"".concat("institutionName"in i&&(null==i?void 0:i.institutionName)?null==i?void 0:i.institutionName:""," ").concat((e=>e?(0,eN.DY)("maskedAccountNumber"in e&&e.maskedAccountNumber?e.maskedAccountNumber:e.lastFour):null)(i)):null;return[o,a||r?["Source:",null!=a?a:r]:[]]}return null},g=null==r?void 0:r.reduce((e,n)=>e+Number((null==n?void 0:n.fundingAmount)||0),0),y=null==h?void 0:h.filter(e=>{var n,i,t;if(!e.isPrimaryShareAccount)return!0;let l=(0,s1.Ej)({primaryShareAccounts:null==o||null==(i=o.fields)||null==(n=i.primaryShareData)?void 0:n.primaryShareAccounts,account:e});return null!=l&&null!=(t=l.creditUnionFee)&&!!t.paidByCustomer}),[I,A]=s9()(y,"isPrimaryShareAccount"),b=(null==(i=p.experiences.selfServe.pages.fundAccount)?void 0:i.primaryShareAccountDescription)||"This is your required share that establishes your membership and partial ownership in the credit union.";return(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{heading:"Select accounts to fund",subheading:"Designate a funding amount and source for each account."}),null==A?void 0:A.map(e=>{var n;let i=null==r?void 0:r.filter(n=>{var i;return(null==(i=n.meta)?void 0:i.accountReferenceId)===e.referenceId}),t=(null==i?void 0:i.length)?v(i):null;return(0,l.Y)(V.A,{size:"large",title:null==(n=(0,z.Jhp)({product:p.products[e.productId],accountVariant:e.accountVariant}))?void 0:n.name,isDisabled:!!(null==i?void 0:i.find(e=>"manual"===e.type)),footerTag:m(e.referenceId),description:null==e?void 0:e.accountName,keyValueMap:t,onClick:()=>c(e.referenceId)},e.referenceId)}),(null==I?void 0:I.length)?(0,l.FD)(l.FK,{children:[(0,l.FD)("div",{css:cd.titleContainer,children:[(0,l.Y)("p",{css:e=>cd.title(e),children:"Included Primary Share Accounts"}),(0,l.Y)(ca.A,{placement:"right",id:"primary-share-info-tooltip",icon:"info-circle",content:b})]}),(0,l.Y)("div",{css:e=>cd.description(e),children:(0,l.Y)(e6.A,{isInline:!1,source:"Select the funding method you'd like to use to fund your account(s)."})}),null==I?void 0:I.map(e=>{var n;let i=null==r?void 0:r.find(n=>{var i;return(null==(i=n.meta)?void 0:i.accountReferenceId)===e.referenceId}),t=i?v([i]):null;return(0,l.Y)(V.A,{size:"large",title:null==(n=(0,z.Jhp)({product:p.products[e.productId],accountVariant:e.accountVariant}))?void 0:n.name,isDisabled:(null==i?void 0:i.type)==="manual",footerTag:m(e.referenceId),description:(e=>{var n,i;let t=(0,s1.Ej)({primaryShareAccounts:null==o||null==(i=o.fields)||null==(n=i.primaryShareData)?void 0:n.primaryShareAccounts,account:e});return"Included with ".concat((null==t?void 0:t.membershipTypeLabel)||""," membership")})(e),keyValueMap:t,onClick:()=>c(e.referenceId)},e.referenceId)})]}):null,!!g&&(0,l.Y)("div",{css:cr.cardContainer,children:(0,l.Y)(eU.A,{variant:"grey",children:(0,l.FD)("div",{css:cr.cardInnerFlex,children:[(0,l.Y)("div",{css:cr.title,children:"Total"}),(0,l.Y)("div",{children:"".concat((0,eN.CQ)(g))})]})})}),(0,l.Y)(w.A,{isFull:!0,theme:"primary",isLoading:d,onClick:()=>(null==a?void 0:a.length)?u("Add funding for ".concat((()=>{if((null==a?void 0:a.length)===1){let n=h.find(e=>e.referenceId===a[0]);if(n){var e;return null==(e=(0,z.Jhp)({product:p.products[n.productId],accountVariant:n.accountVariant}))?void 0:e.name}}return(null==a?void 0:a.length)>1?"".concat(a.length," required accounts"):"required accounts"})()," before continuing.")):s(),children:"Next"})]})};var cc=i(30633),cu=i(45762);let cp={FAILED:U.zu,EXPIRED:U.hV,TIMEOUT:U.zn,NO_TOKEN:U.r2},cm=e=>{let{plaidInstance:n,plaidAccounts:i,isHostedLinkRedirect:t,isLoadingIavPostFlowData:o,createPlaidExternalAccountsError:a,plaidIsOpen:r,plaidIsLoading:d,plaidError:s}=(0,lw.A)({viewSupportsHostedLink:!0}),{triggerMessage:c}=(0,f.d)();return(0,v.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get("iavError");
1if(!e)return;window.history.replaceState(null,"",window.location.pathname);let n=cp[e];n&&c(n,{theme:"error"})},[]),(0,l.Y)(co,{...e,iavFundingAccounts:i,isHostedLinkRedirect:t,iavFundingIsOpen:r,iavFundingIsLoading:d,iavFundingError:s,isCreatingIavFundingExternalAccounts:o,errorCreatingIavFundingExternalAccounts:!!a,onConnectIavFundingAccount:()=>n.open()})},ch=e=>{var n,i,t,a,p;let{setCurrentView:m,view:h,hasFailedFunding:g=!1,accountIdToEdit:f}=e,{products:y,application:I,applicationId:A,getView:b,userId:C,statusOverrides:S,validateApplication:w}=(0,u.YY)(),[x]=(0,ey.n)(eA.D3),F=(0,cc.v)(I),Y=f||((null==F?void 0:F.length)?(null==F?void 0:F.length)>1?null:F[0].referenceId:z.ZSb),[T,D]=(0,v.useState)(Y),[E,k]=(0,v.useState)(!1),P=()=>{var e,n,i,t;if(T&&T!==z.ZSb){let e=null==I||null==(t=I.fundingTransactions)?void 0:t.find(e=>{var n;return(null==(n=e.meta)?void 0:n.accountReferenceId)===T});return(0,cu.D)(null==e?void 0:e.fundingSource)?{...e,fundingSource:(0,cu.D)(null==e?void 0:e.fundingSource)?null==e?void 0:e.fundingSource:null}:null}return(0,cu.D)(null==I||null==(e=I.fundingTransaction)?void 0:e.fundingSource)?{...null==I?void 0:I.fundingTransaction,fundingSource:(0,cu.D)(null==I||null==(n=I.fundingTransaction)?void 0:n.fundingSource)?null==I||null==(i=I.fundingTransaction)?void 0:i.fundingSource:null}:null},{requestIndicationOfInterest:R}=sg({applicationId:A,userId:C}),[L,N]=(0,iZ.A)("skippedFunding",{applicationId:A,skipped:!1}),{config:B,config:{funding:M,services:V,products:_}}=(0,s.UK)(),q=M.iavProvider,H=null==y?void 0:y.flatMap(e=>e.optionalServiceIds).filter(Boolean),K=null==y?void 0:y.some(e=>{var n;return null==(n=e.fundingMethods)?void 0:n.internalTransfer}),j=(null==H?void 0:H.reduce((e,n)=>{let i=n?V[n]:void 0;return((null==i?void 0:i.type)==="rolloverFunds"||(null==i?void 0:i.type)==="transferFunds")&&e.push(i),e},[]))||[],[W,G]=(0,v.useState)(null==(n=P())?void 0:n.fundingSource);(e=>{let{selectedFundingSource:n,view:i}=e,t=(0,v.useRef)(n);(0,v.useEffect)(()=>{n&&!t.current&&(0,c.$3)({view:{...i,data:{selectedFundingSource:n}},pageName:"application"}),t.current=n},[n])})({selectedFundingSource:W,view:h});let $=()=>{if(T){var e,n;return(null==I||null==(n=I.rawFields)||null==(e=n.accounts)?void 0:e.length)?I.rawFields.accounts.find(e=>e.referenceId===T):null==I?void 0:I.rawFields}return null},J=$(),Z=(null==J?void 0:J.productId)?(0,z.Jhp)({product:_[J.productId],accountVariant:J.accountVariant}):null,{fundingSources:X,mostRecentlyUsedInternalAccount:ee,isLoadingFundingSources:en,createFundingTransaction:ei,cancelFundingTransaction:et,createManualExternalAccount:el,createExternalCard:eo,updateExternalAccountHolderCategory:ea}=(0,lS.Ay)({includeInternalAccounts:!!K,organizationId:null==I||null==(i=I.organization)?void 0:i.id,queryOptions:{fetchPolicy:"cache-and-network"},productId:null==J?void 0:J.productId,accountVariant:null==J?void 0:J.accountVariant,withAutopay:!1}),{removeIndicationOfInterest:er}=sg({applicationId:null==I?void 0:I.id,userId:C}),{triggerCustomerServiceError:ed}=(0,ef.A)(),es=!!I&&"createAccount"===I.type,eu=((null==F?void 0:F.length)||0)>1;ec({allowBrowserNavigationToViews:[r.zx,r.C3,r.zD,r.X6,r.S2,r.sA,r.n5,r.L5,r.jn,r.tm]});let ep=null==I||null==(t=I.persons)?void 0:t.find(e=>e.id===C),em=async e=>{var n,i;try{if(e){let i=null==I||null==(n=I.fundingTransactions)?void 0:n.filter(n=>{var i;return(null==(i=n.meta)?void 0:i.accountReferenceId)===e&&!(null==n?void 0:n.isPrimaryShareFundingTransaction)});i&&await Promise.all(i.map(e=>aG.CB.includes(e.type)?er({id:e.id}):et({variables:{fundingTransactionId:e.id},refetchQueries:[{query:eA.bh,variables:{applicationId:null==I?void 0:I.id,includeAccounts:!1,includeQualifiedAddOns:!1}}]})))}else(null==I?void 0:I.fundingTransaction)&&(aG.CB.includes(null==I?void 0:I.fundingTransaction.type)?await er({id:null==I?void 0:I.fundingTransaction.id}):await et({variables:{fundingTransactionId:I.fundingTransaction.id},refetchQueries:[{query:eA.bh,variables:{applicationId:I.id,includeAccounts:!1,includeQualifiedAddOns:!1}}]}))}catch(t){let{message:e,isBusinessLogicError:n}=null!=(i=null==t?void 0:t[0])?i:{};throw ed("".concat(U.FM," ").concat(n?"".concat(e,"."):"")),t}},eh=async()=>{let e=es&&b();e=e&&e.code===r.wY.code?r.jn:e,m(es&&e?e:r.jn)},ev=async e=>(await em(e),f&&g&&A)?(await x({variables:{applicationId:A,referenceId:f,fields:{skipFunding:!0}}}),m(r.tm)):f?eh():eu?D(null):void(await N({applicationId:A,skipped:!0}),await eh()),eg=async e=>{let{id:n,type:i}=e;await em();try{await R({serviceId:n,type:i,accountReferenceId:T});let{data:e}=await w(),t=null==e?void 0:e.validateApplication,l=es&&t?(0,ah.A)(t,B,C):null;m(es&&l?l:r.jn)}catch(i){var t;let{message:e,isBusinessLogicError:n}=null!=(t=null==i?void 0:i[0])?t:{};ed("".concat(U.f9," ").concat(n?"".concat(e,"."):""))}},eI=async()=>{k(!0);try{await N({applicationId:A,skipped:!0}),await eh()}catch(e){k(!1)}finally{k(!1)}},eb=async e=>{let{fundingTransaction:n,fundingAmount:i}=e,{data:t}=await w(),l=null==t?void 0:t.validateApplication;if(f&&g)return m(r.tm);if(eu&&!f)return D(null);i&&0!==i||await N({applicationId:A,skipped:!0});let o=es&&l?(0,ah.A)({...l,fundingTransaction:n},B,C):null,a=l?(0,d.Ay)({application:{...l,fundingTransaction:n,disbursalMethods:(null==l?void 0:l.disbursalMethods)||[]},overrides:S,userId:C,clientConfig:B}
1):null,s=es&&o?o:a;s&&m(s)},eC=async e=>{var n,i;let{fundingSource:t,fundingAmountInCents:l,errorMessage:o,membershipType:a,meta:r={}}=e;(0,Q.Qq)(A,"applicationId is undefined");let{data:d}=await ei({variables:{fields:{fundingAmount:l,fundingSourceId:null!=(i=null==t?void 0:t.id)?i:void 0,fundingSourceType:(null==t?void 0:t.type)||"InternalAccountFundingSource",membershipType:a,organizationId:null==I||null==(n=I.organization)?void 0:n.id,...r},applicationId:A},refetchQueries:[{query:eA.bh,variables:{applicationId:A,includeAccounts:!1,includeQualifiedAddOns:!1}}]}),s=null==d?void 0:d.createFundingTransaction;return(null==s||!s.executionStatus||["success","pending"].includes(null==s?void 0:s.executionStatus))&&(null==s?void 0:s.executionStatus)||ed(o),s},eS=async e=>{var n,i;try{let i,t,l=e.membershipType;if(e.isClientFundedPrimaryShareTransaction?i=null==(n=e.creditUnionFee)?void 0:n.amountCents.toString():(i=e.primaryShareFundingAmountInCents,t=e.externalFundingSource),!i||!e.isClientFundedPrimaryShareTransaction&&!t)throw Error("Funding source and funding amount are both undefined.");return await eC({fundingSource:t,fundingAmountInCents:i,meta:{isPrimaryShareFundingTransaction:!0,productId:e.productId,primaryShareOwnerPersonId:"person"===e.primaryShareOwnerEntityType?e.primaryShareOwnerEntityId:void 0,primaryShareOwnerOrganizationId:"organization"===e.primaryShareOwnerEntityType?e.primaryShareOwnerEntityId:void 0,...e.primaryShareCreationInstructionName&&{primaryShareCreationInstructionName:e.primaryShareCreationInstructionName},accountReferenceId:e.accountReferenceId},errorMessage:U.J7,membershipType:l})}catch(t){let{message:e,isBusinessLogicError:n}=null!=(i=null==t?void 0:t[0])?i:{};throw ed("".concat(U.J7," ").concat(n?"".concat(e,"."):"")),t}},ew=async e=>{let{fundingSource:n,fundingAmountInCents:i,retirementAccountFundingMethod:t,productId:l,accountReferenceId:o}=e;try{return await eC({fundingSource:n,fundingAmountInCents:i,meta:{retirementAccountFundingMethod:t,productId:l,accountReferenceId:o},errorMessage:U.k9})}catch(i){var a;let{message:e,isBusinessLogicError:n}=null!=(a=null==i?void 0:i[0])?a:{};throw ed("".concat(U.k9," ").concat(n?"".concat(e,"."):"")),i}},ex=async(e,n)=>{try{await ea({variables:{externalAccountId:e,holderCategory:n}})}catch(e){throw ed(U.Ye),e}},eF=async e=>{try{let{data:n}=await el({variables:{fields:{...e}}}),i=null==n?void 0:n.createManualExternalAccount;return G(i),i}catch(e){ed(U.b5);return}},eY=async e=>{(0,Q.Qq)(A,"applicationId is undefined");try{let n=e.expirationDate.slice(-2),i=e.expirationDate.slice(0,2),t="".concat(new Date().getFullYear().toString().slice(0,2)).concat(n,"-").concat(i),{data:l}=await eo({variables:{fields:{...e,expirationDate:t},applicationId:A}}),o=null==l?void 0:l.createExternalCard;return G(o),o}catch(e){ed(U.wZ);return}},eT=!!I&&!!C&&(e=>{var n,i,t,l,a,r,d;let{application:s,userId:c}=e,u="createAccount"===s.type,p=(null==(i=s.fields)||null==(n=i.ownership)?void 0:n.type)&&o.Jh.includes(s.fields.ownership.type),m=(null==(t=s.fields)?void 0:t.applicantId)===c,h=!!(null==s||null==(a=s.organization)||null==(l=a.persons)?void 0:l.find(e=>e.id===c&&e.isControlProng)),v=null==s||null==(d=s.fields)||null==(r=d.newAccountRelationshipD
1ata)?void 0:r.find(e=>e.personId===c);return u&&p&&m&&!h&&!v})({application:I,userId:C});if(!I)return(0,l.Y)(O.A,{});let eD=null!=(p=null==(a=I.requiredActions)?void 0:a.filter(e=>"missingInitialDeposit"===e.type&&"referenceId"in e&&!!(null==e?void 0:e.referenceId)).map(e=>e.referenceId))?p:[];return Z||f||!eu?"plaid"===q?(0,l.Y)(cm,{currentAccount:$(),application:I,product:Z,fundingSources:X,mostRecentlyUsedInternalAccountFundingSource:ee,isLoadingFundingSources:en,person:ep,selectedFundingSource:W,getInitialFundingAmountInCents:e=>{var n,i;if(!e)return null==(n=P())?void 0:n.fundingAmount;{let n=null==I||null==(i=I.fundingTransactions)?void 0:i.find(n=>{var i;return(null==(i=n.meta)?void 0:i.accountReferenceId)===e&&!(null==n?void 0:n.isPrimaryShareFundingTransaction)});return null==n?void 0:n.fundingAmount}},onSelectFundingSource:G,onExternalAccountSubmit:eF,onExternalCardSubmit:eY,rolloverOrTransferServices:j,onRolloverOrTransferSubmit:eg,handleNextView:eb,handleSubmitFundingTransaction:ew,handleSubmitPrimaryShareFundingTransaction:eS,onSkipFunding:ev,onDismissSkipFunding:()=>{var e,n;if((null==I||null==(n=I.fields)||null==(e=n.accounts)?void 0:e.length)&&!f)return D(null);let i=es&&b();m(es&&i?i:r.jn)},hasExistingFundingTransaction:!!P(),hasFailedFunding:g,userIsNonSignerApplicant:null!=eT&&eT,accountIdToEdit:f,onCancel:()=>{D(null),G(null)}
1,accountsThatCanBeFunded:F,onUpdateExternalAccountHolderCategory:ex}):(0,l.FD)(l.FK,{children:["Funding Provider ",q," is not supported"]}):(0,l.Y)(cs,{application:I,missingFundingReferenceIds:eD,fundingTransactions:I.fundingTransactions,isLoading:E,onNext:eI,setAccountReferenceIdBeingFunded:D})};var cv=i(54056),cg=i(50879);let cf={infoBox:{marginBottom:24},agreementsContainer:{"& + fieldset":{marginTop:-24}},submitBtn:{"fieldset + &":{marginTop:16}}},cy=e=>{let{agreements:n,attestations:i,dynamicAgreements:t,isLoading:o,application:a}=e,{experiences:{selfServe:{pages:{reviewAndSign:{formInfoText:r,formInfoTooltip:d}={}}}}}=(0,D.t)(),{formState:{submitCount:s,isSubmitting:c,isValid:u,isSubmitSuccessful:p}}=(0,S.xW)();return(0,F.A)({submitCount:p||c?null:s,isValid:u,message:"Please fix missing or invalid fields before continuing."}),(0,l.FD)(l.FK,{children:[(0,l.Y)("div",{css:cf.agreementsContainer,children:(0,l.Y)(nZ,{dynamicAgreements:t,agreements:n,attestations:i,application:a,hidePdfViewerUi:!0})}),(0,l.Y)("div",{children:(0,l.Y)(ee.A,{fieldIds:$.A.ACCOUNT.REVIEW_AND_SIGN_FIELDS})}),!!r&&(0,l.Y)("div",{css:cf.infoBox,children:(0,l.Y)(Z.A,{icon:"info-circle",content:r,tooltipIcon:d?"info-circle":null,tooltipContent:d})}),(0,l.Y)("div",{css:cf.submitBtn,children:(0,l.Y)(w.A,{type:"submit",name:"Submit",isFull:!0,isLoading:o,children:"Agree & Submit"})})]})},cI=e=>{var n,i,t,o;let{application:a,agreements:r,attestations:d,dynamicAgreements:s,onSubmit:c,userCanHandoffApplication:u=!1,onHandoffApplication:p,handleDeclineApplication:m}=e,[h,g]=(0,v.useState)(),[I,A]=(0,v.useState)(!1),{pickExpandedFields:b}=(0,T.d)(),{dismissMessage:C}=(0,f.d)(),S="businessUpdatePersons"===a.type,{isLoading:F,onClick:Y}=(0,iB.A)({onClick:e=>(S&&h&&(C(h),g(null)),c(e))}),D=null==(n=a.persons.find(e=>e.isControlProng)||a.persons[0])?void 0:n.id,E={applicationFields:b($.A.ACCOUNT.REVIEW_AND_SIGN_FIELDS,a.fields),handoffRecipient:D},k=a.isMultiApplicantsCDASO,P=null!=(i=a.fields)&&!!i.newAccountEntities&&(null==(o=a.fields)||null==(t=o.newAccountEntities)?void 0:t.length)>1;return(0,l.FD)(y.A,{initialValues:E,onSubmit:Y,"data-dd-privacy":"allow",children:[(0,l.Y)(cy,{application:a,agreements:r,attestations:d,dynamicAgreements:s,isLoading:F}),u&&!!p&&(0,l.FD)("div",{css:{marginTop:"2rem"},children:[(0,l.Y)(x.A,{theme:"xsmall",heading:"Hand Off Application Instead",subheading:"You can also hand this application off to a recipient with authority to open this account."}),(0,l.Y)(w.A,{onClick:()=>{null==p||p()},theme:"outline",isFull:!0,children:"Hand Off"})]}),k&&m?(0,l.FD)(l.FK,{children:[(0,l.Y)("div",{css:{marginTop:"1rem"},children:(0,l.Y)(w.A,{name:"Decline",onClick:()=>A(!0),isFull:!0,theme:"outline",children:"Decline"})}),(0,l.Y)(i9.A,{isOpen:I,buttonText:"Yes, Decline",onConfirm:()=>m(a),heading:"Decline Adding ".concat(P?"People":"Person"," to the Account"),subheading:"Are you sure you want to decline adding ".concat(P?"these people":"this person"," to your account?"),onClose:()=>A(!1),onCancel:()=>A(!1),onClickAway:()=>A(!1),icon:"cancel",isLoading:F})]}):null]})},cA=e=>{var n,i;let{beneficiariesOnPreBookedApplication:t}=e,{mantlFeatures:o}=(0,D.t)(),a=!!(null==o||null==(i=o.accountOpening)||null==(n=i.allowApplicantToViewBeneficiaryTaxId)?void 0:n.enabled);return(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{heading:"Beneficiaries",headingTag:"h2",theme:"small"}),(0,l.Y)(ei.A,{theme:"small",children:t.map((e,n)=>(0,l.Y)(rc,{beneficiary:e,allowTaxIdReveal:a},"".concat(e.lastName).concat(n)))})]})};var cb=i(23573),cC=i(57787),cS=i(91482);let cw=e=>{var n,i,t,o,a,r,d,s,c,u,p,m,h,v;let{organization:g,application:f,organizationFields:y,getOrganizationTaxId:I,children:A,isEditable:b,accountRoles:C,...S}=e;(0,cb.HO)(null==f?void 0:f.fields);let w=null!=(m=null==(n=f.fields)?void 0:n.accounts)?m:[f.fields],x=null==(i=(0,G.L)()[null==g||null==(t=g.rawFields)?void 0:t.type])?void 0:i.label,F=x?[x]:[];w.some(e=>"loan"===e.productType)&&(F=["Borrower",...F]),(null==(a=w[0])||null==(o=a.newAccountRelationshipD
1ata)?void 0:o.find(e=>e.organizationId===(null==g?void 0:g.id)&&"beneficiary"===e.role))&&C&&(F=[C.beneficiary.label,...F]);let Y=(null==g?void 0:g.rawFields.taxIdType)===nr.LC.EIN,T=(null==g||null==(r=g.rawFields)?void 0:r.naicsCode)&&(null==y||null==(s=y.naicsCode)||null==(d=s.options)?void 0:d.find(e=>e.value===(null==g?void 0:g.rawFields.naicsCode))),D=(null!=(h=null==f||null==(c=f.fields)?void 0:c.doingBusinessAs)?h:[]).map(e=>{var n;return null==g||null==(n=g.doingBusinessAsAliases)?void 0:n.find(n=>(null==n?void 0:n.id)===e)}),E=(0,nt.Vd)({addressData:null!=(v=null==g?void 0:g.rawFields)?v:{},fields:y}).map(e=>["".concat(e.addressType," Address"),(0,nt.$P)(e)]),k=(null==g?void 0:g.type)==="municipality",P=[[(0,cC.k)(null==y?void 0:y.phonePrimary)&&"Phone",(0,eN.n4)(null==g?void 0:g.rawFields.phonePrimary)||null],[(0,cC.k)(null==y?void 0:y.websiteUrl)&&"Website",(null==g?void 0:g.rawFields.websiteUrl)?(0,l.Y)(l.FK,{children:(0,cS.formatUrlLabel)(g.rawFields.websiteUrl)}):null],["DBA",D.map(e=>e.name).join(", ")||null],[null==y||null==(u=y.naicsCode)?void 0:u.displayLabel,null==T?void 0:T.label],[k&&"Municipality Type",e_()((null==g?void 0:g.rawFields.municipalityType)||"")],["Tax ID number (".concat(Y?"EIN":"SSN",")"),(0,l.Y)(e8.A,{getTaxId:I,taxIdLastFour:null==g?void 0:g.taxIdLastFour,isEIN:Y},"taxId")],[null==y||null==(p=y.decedentFullName)?void 0:p.displayLabel,null==g?void 0:g.rawFields.decedentFullName],...E.length?E:[]].filter(e=>!!e&&!!e[0]);return(0,l.Y)(l.FK,{children:(0,l.Y)(ii,{name:(null==g?void 0:g.legalName)||"",subtitle:F.join(", "),variant:"grey",isKeyValueTableRightAligned:!0,attributes:P,isEditable:b,...S,children:A})})},cx="Please review all of the information below, agree to the agreements and submit your application.",cF="Before submitting your application, please verify that the information below is complete and accurate.",cY=(e,n)=>(0,l.FD)(l.FK,{children:["You've been invited to join ",e,"'s ",(0,l.Y)(tP.yN,{children:n})," account."," ",cF]}),cT=e=>{var n;let{products:i,allowEditForAllOwnershipTypes:t}=e;return null!=(n=null==i?void 0:i.every(e=>e.accountVariantName&&(0,o.vu)({accountVariantName:e.accountVariantName,product:e,allowEditForAllOwnershipTypes:t})))&&n},cD=e=>{var n;let{application:i}=e;if((0,cg.q)(null==(n=i.meta)?void 0:n.complianceCollectionStatus))return!1;if("createAccount"===i.type){let{products:e}=i;if("business"===(e?(0,o.EV)(i):null))return!!e&&cT({products:e})&&!!i.userCanEditApplication}return!1},cE=e=>{var n;let{application:i}=e;if((0,cg.q)(null==(n=i.meta)?void 0:n.complianceCollectionStatus))return!1;if("createAccount"===i.type){let{products:e}=i;return!!i.isCurrentUserPrimarySigner&&!!e&&cT({products:e,allowEditForAllOwnershipTypes:!0})&&!!i.userCanEditApplication}return!0},ck=["manual","rolloverFunds","transferFunds"],cP=e=>{var n,i;let{application:t}=e;if((0,cg.q)(null==(n=t.meta)?void 0:n.complianceCollectionStatus)||(null==(i=t.fundingTransactions)?void 0:i.find(e=>(null==e?void 0:e.type)&&ck.includes(e.type))))return!1;if("createAccount"===t.type){let{products:e}=t;return!!e&&cT({products:e})&&!!t.userCanEditApplication}return!0},cO=e=>{let{application:n,onOrganizationEditClick:i,getOrganizationTaxId:t}=e,{organization:o}=n,{fields:a}=(0,nn.A)({entityType:"business"}),r="businessDepositAddAuthorizedSigner"===n.type,d=(0,ir.h9)(),s=null==o?void 0:o.externalCoreId;return(0,cb.HO)(n.fields),(0,cb.HO)(o),(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{headingTag:"h2",heading:"Organization Information",theme:"small"}),(0,l.Y)(cw,{organization:o,application:n,organizationFields:a,isEditable:cD({application:n}),onEditClick:()=>s?d.openModal():i(),hideAttributes:r,getOrganizationTaxId:()=>t(o.id)})]})},cR={container:{padding:"16px 16px 48px"}},cL=e=>{var n,i;let{modalDialogRef:t,getPersonTaxId:o,application:a,disableFields:r}=e,{formState:{isSubmitting:d},initialValues:{person:s,type:c}}=(0,S.xW)(),{isMultiApplicantsCDASO:u}=a,{isCreditUnionMember:p,coreSyncedFields:m,isControlProng:h,isOwnershipProng:v,isSoleProprietor:g,isControlProngAuthorizedSigner:f,isTrustee:y,isGrantor:I,isMinor:A,hasTaxId:b,taxIdLastFour:C}=s,x=(0,eS.rC)(null==a?void 0:a.rawFields),F=null==x?void 0:x.some(e=>"personId"in e&&e.personId===s.id&&"fiduciary"===e.role),Y=null==x?void 0:x.some(e=>"personId"in e&&e.personId===s.id&&"beneficiary"===e.role);return(0,l.FD)(en.A,{applicationFields:a.rawFields,personId:s.id,applicationType:c,originatingExperience:a.originatingExperience,coreSyncedFields:m,isCreditUnionMember:p,isControlProng:h,isOwnershipProng:v,isSoleProprietor:g,isControlProngAuthorizedSigner:f,isTrustee:y,isGrantor:I,isMinor:A,isFiduciary:F,isBeneficiary:Y,role:(0,E.MR)(a,s),namePrefix:"person",taxIdLastFour:C,getTaxId:o?()=>
1o(s.id):void 0,isMissingTaxId:!1===b,kycEvaluationTags:(null==a||null==(i=a.personKycSnapshot)||null==(n=i.find(e=>(null==e?void 0:e.personId)===(null==s?void 0:s.id)))?void 0:n.tags)||[],systemRequiredFields:["emailPrimary"],children:[(0,l.Y)(lT,{container:null==t?void 0:t.current}),(0,l.Y)(aY.A,{isDisabled:r,isMultiApplicantsCDASO:null!=u&&u}),(0,l.FD)(ei.A,{theme:"small",children:[(0,l.Y)(ay,{isDisabled:r}),(0,l.Y)(lM,{personOrBusiness:s,isDisabled:r,isInModal:!0}),(0,l.Y)(aS,{isDisabled:r,showEmailFields:!1}),(0,l.Y)(et,{isDisabled:r})]}),(0,l.Y)(w.A,{type:"submit",isFull:!0,isLoading:d,children:"Continue"})]})},cN=e=>{let{person:n,userId:i,application:t,modalDialogRef:o,getPersonTaxId:a,onSubmit:r,disableFields:d}=e,s={person:(0,E.tF)(n,i),id:null==t?void 0:t.id,type:null==t?void 0:t.type};return(0,l.FD)("div",{css:cR.container,children:[(0,l.Y)(x.A,{theme:"xsmall",heading:"Personal Information"}),(0,l.Y)(y.A,{initialValues:s,onSubmit:e=>r((0,E.JC)(e.person)),children:(0,l.Y)(cL,{modalDialogRef:o,getPersonTaxId:a,application:t,disableFields:d})})]})},cB=e=>{let{application:n,userId:i,getPersonTaxId:t,onClose:o,onExited:a,onSubmit:r,editingPerson:d,isOpen:s,disableFormFields:c}=e;return(0,l.Y)(nh.A,{isOpen:s,onClose:o,onClickAway:o,onExited:a,children:e=>{let{modalDialogRef:a}=e;return(0,l.Y)(cN,{person:d,userId:i,application:n,modalDialogRef:a,getPersonTaxId:t,onSubmit:c?o:r,disableFields:c})}})},cM={modalContainer:{padding:"16px 16px 20px 16px"},modalText:e=>{let{fontScales:n}=e;return{...n.small,marginTop:"2rem"}},modalButton:{marginTop:"2rem"}},cz=e=>{let{clientDetails:n}=e;return(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{theme:"xsmall",heading:"Something out of date?"}),(0,l.Y)("div",{css:cM.modalText,children:"Contact us at ".concat(n.customerServiceNumber," to update any outdated info before applying for your new account.")})]})},cV=e=>{let{updateInformationEligibleService:n,updateInformationIndicationOfInterest:i,handleRequestUpdateInformationIOI:t}=e,o=n.description?n.description:"Submit a request to update your information, and we will contact you shortly.",a=n.confirmation?n.confirmation:"Your request to update your information has been received";return(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{theme:"xsmall",heading:"Something out of date?"}),(0,l.Y)("div",{css:cM.modalText,children:o}),(0,l.Y)("div",{css:cM.modalButton,children:(0,l.Y)(w.A,{isFull:!0,isDisabled:!!i,name:"Request an update to your information",size:"smallMedium",onClick:()=>t({ioiRequestData:{type:n.type,serviceId:n.id},successMessage:a}),children:i?"Information Update Requested":"Request a Change"})})]})},c_=e=>{let{isOpen:n,updateInformationEligibleService:i,updateInformationIndicationOfInterest:t,onClose:o,handleRequestUpdateInformationIOI:a}=e,{clientDetails:r}=(0,D.t)(),d=!!i;return(0,l.Y)(nh.A,{isOpen:n,onClose:o,onClickAway:o,children:(0,l.Y)("div",{css:cM.modalContainer,children:d?(0,l.Y)(cV,{updateInformationEligibleService:i,updateInformationIndicationOfInterest:t,handleRequestUpdateInformationIOI:a}):(0,l.Y)(cz,{clientDetails:r})})})},cU=e=>{let{application:n,onPersonEditClick:i,userId:t,product:a,getPersonTaxId:r,canEditPersonsInline:d,shouldDisplayNewAccountSection:s,onPersonEditSubmit:c,updateInformationEligibleService:u,updateInformationIndicationOfInterest:p,handleRequestUpdateInformationIOI:m}=e,[h,g]=(0,v.useState)(null),[f,y]=(0,v.useState)(!1),[I]=(0,v.useState)([]),A=(0,ir.h9)(),{organization:b,organizations:C,persons:S}=n,w="consumerDepositAddSecondaryOwner"===n.type,F="businessDepositAddAuthorizedSigner"===n.type,Y=async e=>{try{await c(e)}finally{y(!1)}},T=b&&!F&&"createAccount"!==n.type,D=s||T||!!(null==C?void 0:C.length),{fields:E,type:k}=n;(0,cb.HO)(E);let P=null==E?void 0:E.accountVariant;return(0,l.FD)(l.FK,{children:[D&&(0,l.Y)(x.A,{headingTag:"h2",heading:"Personal Information",theme:"small"}),S.map((e,s)=>{let c,u=I.includes(s);if("minorDepositCreateAccount"===k&&a&&(c=[P?(0,o.WL)({role:e.isMinor?"minor":"adult",accounts:[{productId:a.id,accountVariant:P}],products:{[a.id]:a}}):e.isMinor?"Minor":"Parent/Guardian"]),"createAccount"===k&&P){var m,h;
1let n=e.applicationRole||(null==(h=E.newAccountRelationshipData)||null==(m=h.find(n=>(null==n?void 0:n.personId)===e.id))?void 0:m.role),i=n&&!!a&&(0,o.WL)({role:n,accounts:[{productId:a.id,accountVariant:P}],products:{[a.id]:a}});c=i?[i]:[]}let f=!!e.externalCoreId;return(!w||e.id===t)&&(0,l.Y)(v.Fragment,{children:(0,l.Y)(oI,{userId:t,person:e,isEditable:cE({application:n}),onEditClick:()=>((e,n)=>{if(n)return A.openModal();if(d){g(e),y(!0);return}null==i||i(e)})(e,f),getPersonTaxId:e.id!==t&&f?void 0:r,hasRelationshipError:u,personTags:c,children:p?(0,l.Y)(lU.A,{theme:"chip",size:"small",children:"Information Update Requested"}):null})},e.id)}),(0,l.Y)(c_,{isOpen:A.modalIsOpen,onClose:A.closeModal,updateInformationEligibleService:u,updateInformationIndicationOfInterest:p,handleRequestUpdateInformationIOI:m}),h?(0,l.Y)(cB,{onExited:()=>g(null),onClose:()=>y(!1),isOpen:f,application:n,userId:t,onSubmit:Y,editingPerson:h,getPersonTaxId:r}):null]})},cq=e=>{var n,i,t;let a,{application:r,onPersonEditClick:d,userId:s,product:c,getPersonTaxId:u,canEditPersonsInline:p,onPersonEditSubmit:m,person:h,updateInformationEligibleService:g,updateInformationIndicationOfInterest:f,handleRequestUpdateInformationIOI:y}=e,[I,A]=(0,v.useState)(null),[b,C]=(0,v.useState)(!1),S=(0,ir.h9)(),w=(0,D.t)(),x=!!h.externalCoreId,F=h.id===s||!w.experiences.selfServe.enhancedTaxIdMasking,Y=async e=>{try{await m(e)}finally{C(!1)}};(0,cb.HO)(r.fields);
1let{accountVariant:T,newAccountRelationshipData:E}=(null!=(t=null==(n=r.fields)?void 0:n.accounts)?t:[r.fields])[0],k=(null==E?void 0:E.filter(e=>(null==e?void 0:e.personId)===h.id).map(e=>e.role))||[];T&&(a=(null==k?void 0:k.map(e=>T&&e?(0,o.ei)(T,c,e):null).filter(Boolean)).map(e=>e.label)),(null==(i=r.fields)?void 0:i.applicantId)===h.id&&(a=[...a||[],"Applicant"]),a=nu()([...a||[]]);let P=!(0,oN.ZB)(r.fields,h.id)&&cE({application:r});return a=r.persons.find(e=>h.id===e.id&&e.isSoleProprietor)?a.filter(e=>"Control Prong"!==e):a,(0,l.FD)(v.Fragment,{children:[(0,l.Y)(oI,{userId:s,person:h,isEditable:P,onEditClick:()=>(e=>{if(x)return S.openModal();if(p){A(e),C(!0);return}null==d||d(e)})({...h,applicationRole:h.applicationRole||void 0}),isViewable:!P&&!h.isPiiHidden,onViewClick:()=>{A({...h,applicationRole:h.applicationRole||void 0}),C(!0)},getPersonTaxId:h.id!==s&&x?void 0:u,personTags:a,children:f?(0,l.Y)(lU.A,{theme:"chip",size:"small",children:"Information Update Requested"}):null}),(0,l.Y)(c_,{isOpen:S.modalIsOpen,onClose:S.closeModal,updateInformationEligibleService:g,updateInformationIndicationOfInterest:f,handleRequestUpdateInformationIOI:y}),I?(0,l.Y)(cB,{onExited:()=>A(null),onClose:()=>C(!1),isOpen:b,application:r,userId:s,onSubmit:Y,editingPerson:I,getPersonTaxId:F?u:void 0,disableFormFields:!P||!r.isCurrentUserPrimarySigner}):null]},h.id)};var cH=i(36622),cK=i.n(cH);let cj={ownershipProng:"Owner",controlProng:"Control Prong",soleProprietor:"Sole Proprietor"},cW=["trust"],cG=e=>{var n,i,t,a;let{application:r,product:d,onOrganizationEditClick:s,getOrganizationTaxId:c,getPersonTaxId:u,userId:p,entity:m}=e,{fields:h}=(0,nn.A)({entityType:(0,G.KG)((null==m?void 0:m.type)||"business")});(0,cb.HO)(r.fields);
1let{newAccountRelationshipData:v,accountVariant:g}=(null!=(t=null==(n=r.fields)?void 0:n.accounts)?t:[r.fields])[0],f=null==m?void 0:m.externalCoreId,y=(0,ir.h9)(),I=!!(null==m||null==(i=m.persons)?void 0:i.find(e=>e.id===p));(0,cb.HO)(g),(0,cb.HO)(d);let A=(0,o.Gm)(g,d),{primaryApplicationRole:b}=A,S=(0,z.wV1)(A),w=null==v?void 0:v.find(e=>e.personId===p&&e.role===b),x=sX()(m.persons,["isControlProng","isOwnershipProng"]),F=!cW.includes(null!=(a=m.type)?a:""),Y=!f&&cD({application:r});return(0,l.Y)(cw,{organization:m,application:r,organizationFields:h,onEditClick:()=>f?y.openModal():s(),accountRoles:S,isEditable:Y,...I||w?{getOrganizationTaxId:c}:c,children:F&&!!x&&!!x.length&&x.map(e=>{var n;let i=e.organizationRole?cj[e.organizationRole]:void 0,t=i?[i]:[];e.id===(null==(n=r.fields)?void 0:n.applicantId)&&(t=["Applicant",...t]),e.isOwnershipProng&&(t=["Owner",...t]),e.isControlProng&&(t=["Control Prong",...t]),e.isSoleProprietor&&(t=["Sole Proprietor",...t]),t=nu()(t);let o={...C()(e,[...op,"firstName","lastName","middleName","suffix","id"]),rawFields:{}};return(0,l.Y)(oI,{userId:p,person:o,personTags:t,getPersonTaxId:u,isNestedCard:!0},e.id)})},null==m?void 0:m.id)},c$=e=>{var n,i;let{application:t,product:o,onOrganizationEditClick:a,onPersonEditClick:r,canEditPersonsInline:d,userId:s,rolesSortedWithOrgsFirst:c,getOrganizationTaxId:u,getPersonTaxId:p,onPersonEditSubmit:m,updateInformationEligibleService:h,updateInformationIndicationOfInterest:g,handleRequestUpdateInformationIOI:f}=e,y=((e,n)=>{var i,t,l,o;let a=null!=(o=null==(i=e.fields)?void 0:i.accounts)?o:[e.fields],r=n.map(e=>e.filter(e=>"string"==typeof e)).flat(),d=null==(l=a[0])||null==(t=l.newAccountRelationshipD
1ata)?void 0:t.filter(e=>r.includes(e.role));return no()(ez()(d,e=>r.indexOf(e.role)),e=>e.personId)})(t,c),I=null!=(i=null==(n=t.fields)?void 0:n.accounts)?i:[t.fields],A=new Map;c.forEach(e=>{var n,i,t,l;let[o,a]=e,r=null!=(t=null==(i=I[0])||null==(n=i.newAccountRelationshipData)?void 0:n.filter(e=>e.role===o).length)?t:0;r>0&&A.set(a.label,(null!=(l=A.get(a.label))?l:0)+r)});let b=Array.from(A.entries()).map(e=>{let[n,i]=e;return i>1?"".concat(n,"s"):n}).join(" and ");return t.persons.find(e=>e.isSoleProprietor)&&(b=b.replace("Control Prong","Sole Proprietor")),(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{heading:b,headingTag:"h2",theme:"small"}),(0,l.Y)(v.Fragment,{children:y.map(e=>{var n,i;let{organizationId:c,personId:v}=e;if(c){let e=null==(n=t.organizations)?void 0:n.find(e=>(null==e?void 0:e.id)===c);return(0,Q.Z1)(e),(0,l.Y)(cG,{application:t,product:o,entity:e,getOrganizationTaxId:()=>u(c),userId:s,onOrganizationEditClick:a,getPersonTaxId:p},c)}if(v){let e=null==(i=t.persons)?void 0:i.find(e=>(null==e?void 0:e.id)===v);return e?(0,l.Y)(cq,{application:t,person:er()(e,op),canEditPersonsInline:d,getPersonTaxId:p,onPersonEditClick:r,onPersonEditSubmit:m,product:o,userId:s,updateInformationEligibleService:h,updateInformationIndicationOfInterest:g,handleRequestUpdateInformationIOI:f},e.id):null}return null})})]})},cQ=e=>{let{application:n,onOrganizationEditClick:i,onPersonEditClick:t,userId:o,getOrganizationTaxId:a,product:r,getPersonTaxId:d,canEditPersonsInline:s,onPersonEditSubmit:c,updateInformationEligibleService:u,updateInformationIndicationOfInterest:p,handleRequestUpdateInformationIOI:m,hydratedAccountVariant:h}=e;(0,cb.HO)(r);let v=(0,z.wV1)(h),g=ez()(cK()(v).filter(e=>{let[n,i]=e;return h.primarySignatureRolePriority.includes(n)}),e=>{let[n,i]=e;return i.entityType.includes("business")||i.entityType.includes("estate")||i.entityType.includes("trust")||i.entityType.includes("municipality")}),f=ez()(cK()(v).filter(e=>{let[n,i]=e;return!h.primarySignatureRolePriority.includes(n)}),e=>{let[n,i]=e;return i.entityType.includes("business")||i.entityType.includes("estate")||i.entityType.includes("trust")||i.entityType.includes("municipality")});return(0,l.FD)(l.FK,{children:[(0,l.Y)(c$,{application:n,rolesSortedWithOrgsFirst:g,getOrganizationTaxId:a,userId:o,product:r,onPersonEditClick:t,canEditPersonsInline:s,getPersonTaxId:d,onPersonEditSubmit:c,onOrganizationEditClick:i,updateInformationEligibleService:u,updateInformationIndicationOfInterest:p,handleRequestUpdateInformationIOI:m}),(0,l.Y)(c$,{application:n,rolesSortedWithOrgsFirst:f,getOrganizationTaxId:a,userId:o,product:r,onPersonEditClick:t,canEditPersonsInline:s,getPersonTaxId:d,onPersonEditSubmit:c,onOrganizationEditClick:i,updateInformationEligibleService:u,updateInformationIndicationOfInterest:p,handleRequestUpdateInformationIOI:m})]})},cJ=(e,n)=>{let i=(0,J.L)({firstName:e.firstName,lastName:e.lastName});if(!e.relationshipToAccount)return i;let t=(e=>{var n,i,t,l;let{coreConfig:o,entityType:a,relationshipType:r,coreValue:d}=e,s=null==(n=((e,n)=>{var i,t;switch(e){case"person":return null==(i=n.relationshipMaps)?void 0:i.relationshipPersonAccountTypes;case"organization":return null==(t=n.relationshipMaps)?void 0:t.relationshipOrganizationAccountTypes}})(a,o))?void 0:n[r],c=null==s?void 0:s.coreValueMaps,u="object"==typeof(null==s?void 0:s.defaultCoreValue)?null==s||null==(i=s.defaultCoreValue)?void 0:i.displayName:null==c||null==(t=c[(null==s?void 0:s.defaultCoreValue)||""])?void 0:t.displayName;return d&&(null==c||null==(l=c[d])?void 0:l.displayName)||u||eF()(r)||""})({coreConfig:n,entityType:"person",relationshipType:e.relationshipToAccount});return"".concat(i," (").concat(t,")")},cZ=e=>{var n,i,t,o,a,r,d,s;let{application:c,account:u,userId:p,getPersonTaxId:m,onPersonEditClick:h,onPersonEditSubmit:g,canEditPersonsInline:f}
1=e,{fields:y,persons:I,userIsInvitedJointOwner:A}=c,b=(0,D.t)(),[C,S]=(0,v.useState)(null),[w,F]=(0,v.useState)(!1),Y=((null==u||null==(i=u.persons)||null==(n=i.filter(Boolean))?void 0:n.filter(e=>"booked"===e.status))||[]).filter(e=>null==e?void 0:e.personId).map(e=>({id:e.personId||"",firstName:e.firstName,lastName:e.lastName,emailPrimary:e.emailPrimary,middleName:e.middleName,suffix:e.suffix,relationshipType:e.relationshipType,rawFields:{}})),T=null!=(d=null==y||null==(t=y.newAccountEntities)?void 0:t.filter(Boolean).filter(e=>e.personId!==p))?d:[],E=null==y||null==(o=y.newAccountEntities)?void 0:o.find(e=>(null==e?void 0:e.personId)===p),k=null==E?void 0:E.personId,P=I.find(e=>e.id===k),O=I.find(e=>e.id===(null==y?void 0:y.jointOwnerInviterPersonId)),R=!!(null==y||null==(a=y.newAccountEntities)?void 0:a.length),L=O?((e,n)=>{let i=(0,J.L)(e);return n?["Added by ".concat(i)]:["Invited by ".concat(i)]})(O,null!=(s=null==u?void 0:u.userIsExistingAccountOwner)&&s):null,N=async e=>{try{await g(e)}finally{F(!1)}};return(0,l.FD)(l.FK,{children:[R&&(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{heading:"Pending Account Owners",headingTag:"h2",theme:"small"}),A&&P?(0,l.FD)(l.FK,{children:[(0,l.Y)(oI,{userId:p,isEditable:!0,onEditClick:()=>(e=>{if(f){S(e),F(!0);return}null==h||h(e)})(P),person:P,name:E&&cJ(E,b.core),getPersonTaxId:(null==P?void 0:P.id)===p?m:void 0,personTags:L}),T.map(e=>(0,l.Y)(ii,{name:cJ(e,b.core),attributes:[["Email Address",e.emailPrimary]],subtitle:L?L.join(", "):"",variant:"grey",isKeyValueTableRightAligned:!0,isEditable:!1},e.referenceId))]}):null==y||null==(r=y.newAccountEntities)?void 0:r.filter(Boolean).map(e=>(0,l.Y)(ii,{name:cJ(e,b.core),attributes:[["Email Address",e.emailPrimary]],subtitle:L?L.join(", "):"",variant:"grey",isKeyValueTableRightAligned:!0,isEditable:!1},e.referenceId))]}),(0,l.Y)(x.A,{heading:"Account Owners",headingTag:"h2",theme:"small"}),Y.map(e=>(0,l.Y)(oI,{isEditable:!1,person:e,name:cJ({firstName:e.firstName,lastName:e.lastName,relationshipToAccount:e.relationshipType},b.core)},e.id)),C?(0,l.Y)(cB,{onExited:()=>S(null),onClose:()=>F(!1),isOpen:w,application:c,userId:p,onSubmit:N,editingPerson:C,getPersonTaxId:m}):null]})},cX=e=>{var n,i,t;let{application:a,account:r,onOrganizationEditClick:d,onPersonEditClick:s,userId:c,products:u,getPersonTaxId:p,getOrganizationTaxId:m,canEditPersonsInline:h,shouldDisplayNewAccountSection:v,onPersonEditSubmit:g,updateInformationEligibleService:f,updateInformationIndicationOfInterest:y,handleRequestUpdateInformationIOI:I}=e;if("createAccount"===a.type){(0,cb.HO)(u),(0,cb.HO)(u[0]),(0,cb.HO)(u[0].accountVariantName);let e=(0,o.Gm)(u[0].accountVariantName,u[0]);if((null==(i=a.fields)||null==(n=i.ownership)?void 0:n.type)==="jointAdult"){let n=e.primaryAccountRoleConfig.default,i=e[n].label;return(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{heading:i?"".concat(i,"s"):"Joint Owners",headingTag:"h2",theme:"small"}),a.persons.map(e=>(0,l.Y)(cq,{application:a,person:e,canEditPersonsInline:h,getPersonTaxId:p,onPersonEditClick:s,onPersonEditSubmit:g,product:u[0],userId:c,updateInformationEligibleService:f,updateInformationIndicationOfInterest:y,handleRequestUpdateInformationIOI:I},e.id))]})}return(0,l.Y)(cQ,{application:a,product:u[0],getOrganizationTaxId:m,userId:c,canEditPersonsInline:h,hydratedAccountVariant:e,getPersonTaxId:p,onOrganizationEditClick:d,onPersonEditClick:s,onPersonEditSubmit:g,updateInformationEligibleService:f,updateInformationIndicationOfInterest:y,handleRequestUpdateInformationIOI:I})}let{organization:A}=a,b="businessDepositAddAuthorizedSigner"===a.type,C=a.isMultiApplicantsCDASO||(0,r8.As)(null!=(t=a.rawFields)?t:{});return(0,l.FD)(l.FK,{children:[!b&&!!A&&(0,l.Y)(cO,{application:a,onOrganizationEditClick:d,getOrganizationTaxId:m}),C?(0,l.Y)(cZ,{account:r,application:a,userId:c,getPersonTaxId:p,onPersonEditClick:s,onPersonEditSubmit:g,canEditPersonsInline:h}):(0,l.Y)(cU,{application:a,canEditPersonsInline:h,onPersonEditClick:s,userId:c,product:null==u?void 0:u[0],getPersonTaxId:p,shouldDisplayNewAccountSection:v,onPersonEditSubmit:g,updateInformationEligibleService:f,updateInformationIndicationOfInterest:y,handleRequestUpdateInformationIOI:I})]})};var c0=i(34492),c9=i.n(c0),c1=i(7733),c2=i.n(c1);let c6={container:{position:"relative",marginTop:8},spacer:{marginBottom:12,marginTop:12},key:{position:"absolute",left:0},copy:{paddingLeft:26}},c5=e=>{let{disclosures:n}=e;return Array.isArray(n)&&0!==n.length?(0,l.Y)("div",{css:c6.container,children:n.map((e,n)=>(0,l.FD)("div",{css:[!e.key&&c6.spacer],children:[e.key&&(0,l.Y)("div",{css:c6.key,children:e.key}),(0,l.Y)("div",{css:c6.copy,children:(0,l.Y)(e6.A,{isInline:!0,source:e.copy})})]},n))}):null},c4={wrapper:e=>{let{breakpoints:n}=e;return{margin:"0 0 -16px",[n.medium]:{marginBottom:-48}}},container:e=>{let{colors:n,breakpoints:i}=e;
1return{background:"white",color:n.grey2,padding:"0 16px",width:"100%",[i.medium]:{paddingLeft:24,paddingRight:24},[i.max]:{paddingLeft:48,paddingRight:48}}},content:e=>{let{fontScales:n}=e;return{...n.small,maxWidth:eQ.kr,margin:"0 auto",paddingTop:32,paddingBottom:48}},divider:e=>{let{colors:n}=e;return{borderBottom:"2px solid ".concat(n.grey5),width:"100%",display:"block"}}},c3=e=>{let{children:n}=e;return(0,l.Y)("div",{css:c4.wrapper,children:(0,l.FD)("div",{css:c4.container,children:[(0,l.Y)("div",{css:c4.content,children:n}),(0,l.Y)("span",{css:c4.divider})]})})},c8=(0,l.Y)("p",{children:"USA PATRIOT Act - To help the government fight the funding of terrorism and money laundering activities, federal law requires all US financial institutions to obtain, verify, and record information that identifies each person who opens an account. What this means for you: When you open an account, we will ask for your name, address, date of birth, and other information that will allow us to identify you. We may also ask to see your identifying documents."}),c7=(0,l.Y)("p",{children:"USA PATRIOT Act - To help the government fight the funding of terrorism and money laundering activities, federal law requires all financial institutions to obtain, verify, and record information that identifies each person or business entity that opens an account. What this means for you: When you open an account, you must provide us with your business entity name, principal address, and, if different, local address, date of establishment, taxpayer identification number, and other information. We may also seek additional information and documents about you and your authorized signers."});var ue=i(1885);let un=e=>{let{application:n}=e,{experiences:{selfServe:{pages:{reviewAndSign:{showDisclosures:i,showUsPatriotAct:t}}}}}=(0,D.t)(),o="createAccount"===n.type?(0,ue.A)(n):n.type.startsWith("business"),a=n.products,r=c2()(null==a?void 0:a.flatMap(e=>e.disclosures).filter(Boolean),c9()),d=Array.isArray(r)&&r.length>0;return(0,l.FD)(c3,{"data-dd-privacy":"allow",children:[t?o?c7:c8:null,i&&d?(0,l.Y)(c5,{disclosures:r}):null]})},ui=e=>{let{application:n,account:i,userCanHandoffApplication:t=!1}=e,{experiences:{selfServe:{pages:{reviewAndSign:{headerText:o,subheaderText:a}={}}}}}=(0,D.t)(),r=(e=>{var n,i,t;let{application:o,account:a,subheaderText:r,userCanHandoffApplication:d=!1}=e;if(r)return r;let{organization:s,products:c,type:u}=o,p=null==s?void 0:s.legalName,m=null==c?void 0:c.map(e=>e.name).join(", ");switch(u){case"businessDepositCreateAccount":return cF;case"businessDepositAddAuthorizedSigner":return cY(null!=p?p:"",null!=(n=null==c?void 0:c[0].name)?n:"");case"businessUpdatePersons":return(0,l.FD)(l.FK,{children:["You've been asked to review the people on file relating to"," ",(0,l.Y)(tP.yN,{children:p}),"."," ",cF]});case"consumerDepositAddSecondaryOwner":{let e=null==a||null==(i=a.persons)?void 0:i.find(e=>(null==e?void 0:e.status)==="booked"&&e.isPrimaryEntity);if(!e)return cx;let n=(0,J.L)(e);if((0,r8.As)(null!=(t=o.rawFields)?t:{}))return(0,l.FD)(l.FK,{children:["Please review the beneficiary updates to ",n,"'s ",(0,l.Y)(tP.yN,{children:m})," ","account. ",cF]});if(null==a?void 0:a.userIsExistingAccountOwner)return(0,l.FD)(l.FK,{children:["Please review the invited joint owners to ",n,"'s ",(0,l.Y)(tP.yN,{children:m})," ","account. ",cF]});if(null==o?void 0:o.userIsInvitedJointOwner)return cY(n,null!=m?m:"");return cx}case"createAccount":if(d)return"Before handing off your application, please verify that the information below is complete and accurate.";return cx;default:return cx}})({application:n,account:i,subheaderText:a,userCanHandoffApplication:t}),d=(e=>{let{account:n,headerText:i}=e;return(null==n?void 0:n.userIsExistingAccountOwner)?"Review and Submit":i||"Review your information"})({headerText:o,account:i});return(0,l.Y)(x.A,{heading:d,subheading:r})};var ut=i(67869),ul=i(1126);let uo=e=>{var n,i;let{name:t="Funding",fundingTransaction:o,onEditClick:a,isEditable:r=!1,isNestedCard:d,creditUnionFee:s,application:c,onUpdateExternalAccountHolderCategory:u}=e,p=(0,D.t)(),m=(0,id.ik)(o),h=(0,ir.h9)(),[g,f]=(0,v.useState)(!1),y=p.mantlFeatures.accountOpening.funding.collectAccountHolderCategory,I=null==o?void 0:o.fundingSource,A=!!y&&!!u&&!!I&&(0,id.Qj)(I),b=null==c||null==(n=c.products)?void 0:n.find(e=>e.id===(null==o?void 0:o.productId)),C=async e=>{if(A){f(!0);try{await u(I.id,e)}catch(e){}finally{f(!1),h.closeModal()}}};return(0,l.FD)(l.FK,{children:[(0,l.Y)(ii,{name:t,attributes:((e,n,i,t,l)=>{let{fundingSource:o,fundingAmount:a,type:r,meta:d}=e||{},s=null==d?void 0:d.retirementAccountFundingMethod,c=(0,id.QW)(e);if("rolloverFunds"===r)return[["Deposit Type","Rollover"]];if("transferFunds"===r)return[["Deposit Type","Transfer"]];let{name:u,lastFour:p,accountType:m,institutionName:h,logo:v,cardType:g}=(0,id.yE)(o)||{},f=(0,id.N5)(o)?o.routingNumber:null,y={accountAttribute:"--",institutionNameWithLogo:"--"};e&&(y=(0,id.po)({name:u,lastFour:p,accountType:m,institutionName:h,logo:v,cardType:g,type:r}));let I=(0,s1.er)(a,null==n?void 0:n.donationCents),{membershipLabel:A,donationLabel:b}=(0,s1.yx)(n),C=[["Funding Type",c],["Funding Institution",y.institutionNameWithLogo],[y.accountAttribute?"Funding Source":null,y.accountAttribute],l,["Routing Number",f],[(null==I?void 0:I.donationFeeInDollars)?A:"Funding Amou
1nt",I.membershipFeeInDollars],[b,(null==I?void 0:I.donationFeeInDollars)?"".concat(null==I?void 0:I.donationFeeInDollars):null],g?["Funding Card",y.cardNumberWithLogo]:null,["Initiated On",t]];if(s){let e=i?((e,n)=>{var i,t;if(!n)return null;let l=(0,tO.rM)(),o=(null==e||null==(t=e.fields)||null==(i=t.funding)?void 0:i.retirementAccountFundingMethod)&&"options"in e.fields.funding.retirementAccountFundingMethod?e.fields.funding.retirementAccountFundingMethod.options:void 0,a=l.funding.retirementAccountFundingMethod&&"options"in l.funding.retirementAccountFundingMethod?l.funding.retirementAccountFundingMethod.options:void 0,r=o||a;if(!r)return null;if("string"==typeof r)return n;let d=r.find(e=>e.value===n);return d?d.label:null})(i,s):s;C.push(["Retirement Contribution Type",e])}return C.filter(Boolean)})(o,s,p,m,A?["Account Type",(0,l.Y)(ul.A,{iconName:"pencil-minimal",name:"Edit account type",onClick:h.openModal,dataTestId:"account-type-button",children:null!=(i=(e=>{var n,i;return null!=(i=null==(n=le.find(n=>n.value===e))?void 0:n.label)?i:null})(I.holderCategory))?i:"--"},"account-type")]:null),isKeyValueTableRightAligned:!0,onEditClick:a,isEditable:r,isNestedCard:d,isFlushMobile:!d}),h.modalIsOpen&&A&&(0,l.Y)(ll,{isOpen:!0,fundingSource:I,productCustomerType:null==b?void 0:b.customerType,isLoading:g,onClose:h.closeModal,onConfirm:C})]})};var ua=i(11831);let ur=e=>{let{clientName:n,clientFullName:i,fundingAmountCents:t,maturityDate:o,fundingSource:a,creditUnionFeeConfig:r}=e,d=t?(0,eN.CQ)(t):null;if(!(null==r?void 0:r.paidByCustomer))return[["Funding Amount",d],["Funding Source",(0,l.Y)(()=>(0,l.Y)(l.FK,{children:(0,l.FD)("span",{children:[n,(0,l.Y)(ua.A,{content:"To establish your share in ".concat(i||n,", ").concat(n," will deposit a complimentary ").concat(d," into this account on your behalf."),isInline:!0,name:"primary_share_note"})]})}),{},n)],["Maturity Date",o]];let{name:s,lastFour:c,accountType:u,institutionName:p,logo:m,cardType:h}=(0,id.yE)(a)||{},v={accountAttribute:"--",institutionNameWithLogo:"--"};v=(0,id.po)({name:s,lastFour:c,accountType:u,institutionName:p,logo:m,cardType:h});let g=(0,s1.er)(t,null==r?void 0:r.donationCents),f=e=>{let{feeAmount:t,tooltip:o,isDonationFee:a}=e;return(0,l.FD)("span",{children:[t,(0,l.Y)(ua.A,{content:o||"To establish your share in ".concat(i||n,",\n            ").concat(n," requires an additional ").concat(t," ").concat(a?"donation fee":"fee","."),isInline:!0,name:"primary_share_note"})]},n)},{membershipLabel:y,donationLabel:I}=(0,s1.yx)(r);return[[(null==g?void 0:g.donationFeeInDollars)?y:"Funding Amount",f({feeAmount:g.membershipFeeInDollars,tooltip:r.paidByCustomerTooltip})],[I,(null==g?void 0:g.donationFeeInDollars)?f({feeAmount:g.donationFeeInDollars,tooltip:r.donationFeeTooltip,isDonationFee:!0}):null],[v.accountAttribute?"Funding Source":null,v.accountAttribute],[h?"Funding Card":null,v.cardNumberWithLogo],["Funding Institution",v.institutionNameWithLogo],["Maturity Date",o]]},ud=e=>{let{productName:n,maturityDate:i,clientName:t,clientFullName:o,fundingAmountCents:a,entityName:r,membershipTypeLabel:d,fundingSource:s,isNestedCard:c,name:u,creditUnionFeeConfig:p}=e;return(0,l.Y)(ii,{name:u||n,attributes:ur({clientName:t,clientFullName:o,fundingAmountCents:a,maturityDate:i,fundingSource:s,creditUnionFeeConfig:p}),tags:r?["For ".concat(r)]:null,primaryShareSubtitle:(e=>{let{label:n,paidByCustomer:i}=e;return"".concat(i?"Required with":"Included for"," all new ").concat(n?"".concat(n," "):"","memberships")})({label:d,paidByCustomer:null==p?void 0:p.paidByCustomer}),isNestedCard:c})};var us=i(73849);let uc=e=>{var n,i;let{personId:t,organizationId:o,primaryShareFundingTransaction:a,primaryAccountRoleData:r,application:d}=e,{clientDetails:s}=(0,D.t)(),{accountVariant:c="",productId:u=""}=d.fields||{};(0,Q.Qq)(c,"application has undefined accountVariant"),(0,Q.Qq)(u,"application has undefined productId");let p=d.persons.find(e=>e.id===t),m=null==(n=d.organizations)?void 0:n.find(e=>(null==e?void 0:e.id)===o),h=(null==a?void 0:a.primaryShareOwnerOrganizationId)?null==m?void 0:m.legalName:null==p?void 0:p.firstName,v=null==r?void 0:r.isSelectedShareProduct,g=m||p?a:null;return v&&(null==r?void 0:r.creditUnionFee)&&g&&(0,l.Y)(ud,{name:"Additional Funding",isNestedCard:!0,clientName:s.clientName,clientFullName:s.clientFullName,entityName:h||"",membershipTypeLabel:null==r?void 0:r.membershipTypeLabel,productName:(null==r||null==(i=r.product)?void 0:i.name)||"",maturityDate:(0,us.A)(r.product),fundingAmountCents:g.fundingAmount,fundingSource:null==g?void 0:g.fundingSource,creditUnionFeeConfig:r.creditUnionFee},null==r?void 0:r.membershipTypeLabel)};var uu=i(80725),up=i.n(uu);let um=e=>{let{application:n,onAccountDetailsEditClick:i,isNestedCard:t,accountReferenceId:o}=e,{fields:a}=(0,T.d)(),{core:r}=(0,D.t)(),d=((e,n,i,t)=>{var l,o,a,r,d,s,c,u,p,m,h,v,g,f,y,I,A,b,C,S,w,x,F,Y,T,D,E,k;
1let{desiredLoanAmountCents:P,desiredMonthlyPaymentCents:O,desiredLoanTermMonths:R,purposeOfLoan:L,purposeOfLoanList:N,ioltaExternalCoreId:B,currentLender:M,currentMonthlyPayment:z,initialLoanAmount:V,tradingInAVehicle:_,existingLoanOnVehicleBeingTradedIn:U,tradeInLoanAmount:q,tradeInPaymentAmount:H,interestEarnedPayment:K,interestEarnedPaymentFrequency:j}=(null!=(a=null==(o=e.rawFields)||null==(l=o.accounts)?void 0:l.find(e=>e.referenceId===t))?a:e.fields)||{},W=[];if(P&&W.push([null==n||null==(r=n.desiredLoanAmountCents)?void 0:r.formLabel,(0,eN.CQ)(P)]),O&&W.push([null==n||null==(d=n.desiredMonthlyPaymentCents)?void 0:d.formLabel,(0,eN.CQ)(O)]),R&&W.push([null==n||null==(s=n.desiredLoanTermMonths)?void 0:s.displayLabel,"".concat(R," months")]),L){let e,i=null!=(u=null==n?void 0:n.purposeOfLoan)?u:null;if(i&&"options"in i){let n=[...i.options],t=null==n||null==(p=n.find(e=>e.value===L))?void 0:p.label;e=t||e_()(up()(L))}W.push([null==n||null==(c=n.purposeOfLoan)?void 0:c.displayLabel,e])}if(N){let e,i=null!=(h=null==n?void 0:n.purposeOfLoanList)?h:null;i&&"options"in i&&(e=i.options.filter(e=>N.includes(e.value)).map(e=>e.label).join(", ")),W.push([null==n||null==(m=n.purposeOfLoanList)?void 0:m.displayLabel,e])}if(M&&W.push([null==n||null==(v=n.currentLender)?void 0:v.formLabel,M]),z&&W.push([null==n||null==(g=n.currentMonthlyPayment)?void 0:g.formLabel,(0,eN.CQ)(z)]),V&&W.push([null==n||null==(f=n.initialLoanAmount)?void 0:f.formLabel,(0,eN.CQ)(V)]),_){let e,i=null!=(I=null==n?void 0:n.tradingInAVehicle)?I:null;if(i&&"options"in i){let n=[...i.options],t=null==n||null==(A=n.find(e=>e.value===_))?void 0:A.label;t&&(e=t)}W.push([null==n||null==(y=n.tradingInAVehicle)?void 0:y.displayLabel,e])}if(U){let e,i=null!=(C=null==n?void 0:n.existingLoanOnVehicleBeingTradedIn)?C:null;if(i&&"options"in i){let n=[...i.options],t=null==n||null==(S=n.find(e=>e.value===U))?void 0:S.label;t&&(e=t)}W.push([null==n||null==(b=n.existingLoanOnVehicleBeingTradedIn)?void 0:b.displayLabel,e])}if(q&&W.push([null==n||null==(w=n.tradeInLoanAmount)?void 0:w.formLabel,(0,eN.CQ)(q)]),H&&W.push([null==n||null==(x=n.tradeInPaymentAmount)?void 0:x.formLabel,(0,eN.CQ)(H)]),j){let e,i=null!=(F=null==n?void 0:n.interestEarnedPaymentFrequency)?F:null;if(i&&"options"in i){let n=[...i.options],t=null==n||null==(Y=n.find(e=>e.value===j))?void 0:Y.label;t&&(e=t)}W.push(["Interest Payment Frequency",e])}if(K){let e,i=null!=(T=null==n?void 0:n.interestEarnedPayment)?T:null;if(i&&"options"in i){let n=[...i.options],t=null==n||null==(D=n.find(e=>e.value===K))?void 0:D.label;t&&(e=t)}W.push(["Interest Earned Payment",e])}if(B){let e=null==(E=i.ioltaOrganizations)?void 0:E.find(e=>e.externalCoreId===B);e&&W.push([null==n||null==(k=n.ioltaExternalCoreId)?void 0:k.displayLabel,null==e?void 0:e.label])}return W})(n,a,r,o);return d.length?(0,l.Y)(ii,{name:"Details",attributes:d,onEditClick:i,isEditable:(e=>{var n;let{application:i}=e;return!!i.userCanEditApplication&&!(0,cg.q)(null==(n=i.meta)?void 0:n.complianceCollectionStatus)})({application:n}),isNestedCard:t,isFlushMobile:!t}):null},uh=e=>(null==e?void 0:e.donationCents)&&e.amountCents?"Fees":(0,s1.yx)(e).membershipLabel,uv=e=>{var n,i,t,o;let{accountReferenceId:a,personId:r,organizationId:d,application:s,fundingEnabled:c,onAccountDetailsEditClick:u,onFundingEditClick:p,primaryAccountRoleData:m,primaryShareFundingTransaction:h,creditUnionFee:v,accountFields:g,onCollateralEditClick:f,onUpdateExternalAccountHolderCategory:y,getTaxReportingTaxId:A,userId:b}=e,C=(0,D.t)(),S=C.experiences.selfServe.pages.reviewAndSign.showInterestRateAndApy,w=(null==g?void 0:g.productId)?(0,z.Jhp)({product:C.products[g.productId],accountVariant:g.accountVariant}):null==s||null==(n=s.products)?void 0:n[0],x=w?(0,ut.j9)({taxReportingEntities:s.taxReportingEntities,userId:b,enhancedTaxIdMasking:C.experiences.selfServe.enhancedTaxIdMasking,getTaxReportingTaxId:A,application:s,product:w,clientDetails:C.clientDetails,reviewAndSignConfig:C.experiences.selfServe.pages.reviewAndSign,showInterestRateAndApy:S,accountReferenceId:a}):[],F=null!=(o=a?null==(t=s.rawFields)||null==(i=t.accounts)?void 0:i.find(e=>e.referenceId===a):s.rawFields)?o:null,Y=$.A.ACCOUNT.PROFILE_FIELDS.some(e=>{var n;return!n3()(null==(n=s.fields)?void 0:n[e])}),T=cP({application:s})&&c,E=(e=>{let{type:n,fundingTransactions:i=[],paidByCustomerAndSelectedProductIsPrimaryShare:t}=e;return i.find(e=>{var l;let o=(null==(l=e.fundingSource)?void 0:l.__typename)==="InternalAccountFundingSource";return"selectedProduct"===n?!!t&&1===i.length&&!e.isPrimaryShareFundingTransaction||!e.isPrimaryShareFundingTransaction&&!o:"customerFundedPrimaryShare"===n&&!!t&&i.length>1&&e.isPrimaryShareFundingTransaction&&!o})})({type:"selectedProduct",fundingTransactions:s.fundingTransactions||[],paidByCustomerAndSelectedProductIsPrimaryShare:(null==m?void 0:m.isSelectedShareProduct)&&(null==v?void 0:v.paidByCustomer)});return(0,l.FD)(ii,{name:null==w?void 0:w.name,attributes:x,isEditable:T,onEditClick:p,variant:"grey",children:[Y&&(0,l.Y)(I.Ay,{account:F,application:s,organizationKycEvaluationTags:null==s?void 0:s.organizationKycEvaluationTags,personKycEvaluationTags:null==s?void 0:s.personKycEvaluationTags,children:(0,l.Y)(um,{application:s,onAccountDetailsEditClick:u,isNestedCard:!0})}),c?(0,l.FD)(l.FK,{children:[(0,l.Y)(uo,{fundingTransaction:E,isNestedCard:!0,application:s,onUpdateExter
1nalAccountHolderCategory:y}),(null==v?void 0:v.paidByCustomer)&&h?(null==m?void 0:m.isSelectedShareProduct)&&(0,l.Y)(uo,{name:v&&uh(v),fundingTransaction:h,creditUnionFee:v,isEditable:!1,isNestedCard:!0,application:s}):(0,l.Y)(uc,{personId:r,organizationId:d,primaryShareFundingTransaction:h,application:s,primaryAccountRoleData:m})]}):null,(0,l.Y)(ia,{application:s,accountFields:F,onEditCollateralClick:f})]})};var ug=i(21166),uf=i(65282),uy=i(26558),uI=i(97140);let uA=function(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max((e-i)*(1-n),0)},ub=e=>{var n,i,t,o,a,r,d,s,c,u,p,m,h,v,g;let{application:f,product:y,fundingTransaction:I}=e,{fundingSource:A,type:b}=I||{},C=(0,D.t)(),S=(0,id.ik)(I),w=(0,id.QW)(I),x=(0,id.N5)(A)?A.routingNumber:null,{name:F,lastFour:Y,accountType:T,institutionName:E,logo:k,cardType:P}=(0,id.yE)(A)||{},O=(0,id.po)({name:F,lastFour:Y,accountType:T,institutionName:E,logo:k,cardType:P,type:b}),R=((e,n)=>{var i;let{clientDetails:t,experiences:l}=e,o=(null==l||null==(i=l.timezone)?void 0:i.zone)||"UTC";if(t.safeDepositBoxRentalPeriod)return 0;if(t.safeDepositBoxMonthlyRenewalDate){let e=(0,uy.A)(new Date(Date.now()),o);e.setDate(t.safeDepositBoxMonthlyRenewalDate);let n=(0,uy.A)(new Date(Date.now()),o);return e.setFullYear(n.getFullYear()),n.getTime()>=e.getTime()&&(e=(0,ug.A)(e,1)),+(1-(0,iw.A)(e,n)/(0,iw.A)((0,ug.A)(n,1),n)).toFixed(2)}if(!t.safeDepositBoxYearlyRenewalDate)return 0;{let e=new Date(Date.parse(t.safeDepositBoxYearlyRenewalDate)),i=(0,uy.A)(new Date(Date.now()),o);e.setFullYear(i.getFullYear()),e=(0,uy.A)(e,o),i.getTime()>=e.getTime()&&e.setFullYear(e.getFullYear()+1);let l=(0,iw.A)(e,i),a=(0,uf.A)(e,i);return+("daily"===(n||"daily")?1-l/365:1-a/12).toFixed(2)}})({clientDetails:C.clientDetails,experiences:C.experiences});return(0,l.Y)(ii,{name:"Funding Details",attributes:[["Funding Type",w],["Funding Institution",O.institutionNameWithLogo],["Funding Source",O.accountAttribute],["Routing Number",x],["Recurring Box Fee",(null==(t=f.rawFields)||null==(i=t.accounts)||null==(n=i[0])?void 0:n.boxCostInCents)?(0,eN.CQ)(null==(r=f.rawFields)||null==(a=r.accounts)||null==(o=a[0])?void 0:o.boxCostInCents):null],(null==I||null==(d=I.meta)?void 0:d.boxDiscountAmount)?["Discount",null==I||null==(s=I.meta)?void 0:s.boxDiscountAmount]:null,["Prorated %","".concat((100*R).toFixed(2),"%")],(null==(p=f.rawFields)||null==(u=p.accounts)||null==(c=u[0])?void 0:c.boxCostInCents)&&["Total Initial Fee",(0,eN.CQ)(uA(parseInt(null==(v=f.rawFields)||null==(h=v.accounts)||null==(m
1=h[0])?void 0:m.boxCostInCents),R,(null==I||null==(g=I.meta)?void 0:g.boxDiscountAmount)||0))],["Initiated On",S]].filter(e=>null!==e),isEditable:!1},null==y?void 0:y.id)},uC=e=>{var n,i,t,o,a;let{fundingTransaction:r}=e,d=(0,D.t)(),{renewalDate:s}=((e,n)=>{var i;let{clientDetails:t,experiences:l}=e,o=(null==l||null==(i=l.timezone)?void 0:i.zone)||"UTC",a=n?(0,uI.A)(n,o):(0,uy.A)(new Date(Date.now()),o),r=0;if(t.safeDepositBoxRentalPeriod)switch(t.safeDepositBoxRentalPeriod){case"monthly":a=(0,ug.A)(a,1),r=(0,iw.A)((0,uy.A)(new Date(Date.now()),o),a);break;case"yearly":a.setFullYear(a.getFullYear()+1),r=365;break;default:a.setDate(a.getDate()+t.safeDepositBoxRentalPeriod),r=t.safeDepositBoxRentalPeriod}else if(t.safeDepositBoxMonthlyRenewalDate){a.setDate(t.safeDepositBoxMonthlyRenewalDate);let e=(0,uy.A)(new Date(Date.now()),o);a.setFullYear(e.getFullYear()),e.getTime()>=a.getTime()&&(a=(0,ug.A)(a,1)),r=(0,iw.A)(a,e)}else if(t.safeDepositBoxYearlyRenewalDate){a=new Date(Date.parse(t.safeDepositBoxYearlyRenewalDate));let e=(0,uy.A)(new Date(Date.now()),o);a.setFullYear(e.getFullYear()),a=(0,uy.A)(a,o),e.getTime()>=a.getTime()&&a.setFullYear(a.getFullYear()+1),r=(0,iw.A)(a,e)}return{renewalDate:a,daysRemaining:r}})({clientDetails:d.clientDetails,experiences:d.experiences},null==r||null==(n=r.meta)?void 0:n.safeDepositBoxCustomRenewalDate),c=(null==r||null==(i=r.meta)?void 0:i.safeDepositBoxCustomRenewalDate)?new Date((0,uI.A)(null==r||null==(t=r.meta)?void 0:t.safeDepositBoxCustomRenewalDate,(null==(a=d.experiences)||null==(o=a.timezone)?void 0:o.zone)||"UTC")):new Date;return(0,l.Y)(ii,{name:"Fee Schedule",attributes:[["Initial Charge Date",(0,eY.wV)(c.toISOString())],["Rental Period",(e=>{if(e.clientDetails.safeDepositBoxYearlyRenewalDate)return"Yearly";if(e.clientDetails.safeDepositBoxMonthlyRenewalDate)return"Monthly";if(!e.clientDetails.safeDepositBoxRentalPeriod)return"";if("yearly"===e.clientDetails.safeDepositBoxRentalPeriod)return"Yearly";if("monthly"===e.clientDetails.safeDepositBoxRentalPeriod)return"Monthly";else return"".concat(e.clientDetails.safeDepositBoxRentalPeriod," days")})(d)],["Renewal Date",(0,eY.wV)(s.toISOString())]],isEditable:!1},"fee_schedule")},uS=e=>{let{application:n,product:i}=e;return(0,l.FD)(l.FK,{children:[(0,l.Y)(ub,{application:n,product:i,fundingTransaction:n.fundingTransaction}),(0,l.Y)(uC,{fundingTransaction:n.fundingTransaction})]})},uw=e=>{var n,i,t,a,r,d,s,c,u,p,m,h;let{accountReferenceId:v,application:g,fundingEnabled:f,onFundingEditClick:y,onAccountDetailsEditClick:A,getTaxReportingTaxId:b,userId:C,product:S,fundingTransactions:w,isPrimaryShare:x,onCollateralEditClick:F,onUpdateExternalAccountHolderCategory:Y}=e,T=(0,D.t)(),E=null!=(m=(0,eL.FF)("app-2656-dont-create-client-funded-transactions-in-fe"))&&m,k=null==(n=T.mantlFeatures.accountOpening.bulkApplications)?void 0:n.enabled,P="both"===T.experiences.timezone.experience?T.experiences.timezone.zone:null,O=T.experiences.selfServe.pages.reviewAndSign.showInterestRateAndApy,R=S?(0,ut.j9)({application:g,product:S,clientDetails:T.clientDetails,reviewAndSignConfig:T.experiences.selfServe.pages.reviewAndSign,showInterestRateAndApy:O,accountReferenceId:v,timezone:P,taxReportingEntities:g.taxReportingEntities,userId:C,enhancedTaxIdMasking:T.experiences.selfServe.enhancedTaxIdMasking,getTaxReportingTaxId:b}):[],L=null!=(h=v&&v!==z.ZSb?null==g||null==(t=g.rawFields)||null==(i=t.accounts)?void 0:i.find(e=>e.referenceId===v):g.rawFields)?h:null,N=[...$.A.ACCOUNT.PROFILE_FIELDS,...$.A.ACCOUNT.INTEREST_EARNED_FIELDS].some(e=>L&&e in L||g.fields&&e in g.fields),B=cP({application:g});if((null==S?void 0:S.type)==="safeDepositBox")return(0,l.Y)(ii,{name:null==S?void 0:S.name,variant:"grey",children:(0,l.Y)(uS,{application:g,product:S})});let M=(null==S?void 0:S.type)==="loan",V=(null==S?void 0:S.loanType)&&!["posDirectUnderwriting","posSkipUnderwriting"].includes(S.loanType)?eF()(S.loanType):"Loan",_=S&&(null==L?void 0:L.accountVariant)&&(null==(a=(0,o.Gm)(null==L?void 0:L.accountVariant,S
1))?void 0:a.label),U=M?V:null==S?void 0:S.name,q=(0,s1.Ej)({primaryShareAccounts:null==g||null==(d=g.fields)||null==(r=d.primaryShareData)?void 0:r.primaryShareAccounts,account:L}),H=(0,s1.qn)({primaryShareFundingTransactionsToCreate:null==g||null==(c=g.fields)||null==(s=c.primaryShareData)?void 0:s.primaryShareFundingTransactionsToCreate,account:L}),K=null==H?void 0:H.creditUnionFee,j=(null==K?void 0:K.paidByCustomer)===!1&&(E||k),W=null==(u=(0,s1.ls)(T.clientDetails,null==w||null==(p=w.find(e=>!!(null==e?void 0:e.primaryShareCreationInstructionName)))?void 0:p.primaryShareCreationInstructionName))?void 0:u.creditUnionFee,G=!x||!!(null==W?void 0:W.paidByCustomer),Q=!!(0,eS.qk)(g.rawFields);return(0,l.FD)(ii,{name:U,subtitle:!(null==q?void 0:q.membershipTypeLabel)&&_||void 0,variant:"grey",isKeyValueTableRightAligned:!0,attributes:R,isEditable:B&&G&&f,onEditClick:y,primaryShareSubtitle:Q&&q?"Included for all new loan customers":(null==q?void 0:q.membershipTypeLabel)?"Included for ".concat(null==q?void 0:q.membershipTypeLabel," membership"):void 0,children:[N?(0,l.Y)(I.Ay,{application:g,account:L,organizationKycEvaluationTags:null==g?void 0:g.organizationKycEvaluationTags,personKycEvaluationTags:null==g?void 0:g.personKycEvaluationTags,children:(0,l.Y)(um,{application:g,accountReferenceId:v,onAccountDetailsEditClick:A,isNestedCard:!0})}):null,(0,l.Y)(ia,{application:g,accountFields:L,onEditCollateralClick:F}),f&&(null==w?void 0:w.length)?w.map(e=>(0,l.Y)(uo,{fundingTransaction:e,isEditable:!1,isNestedCard:!0,application:g,creditUnionFee:W,onUpdateExternalAccountHolderCategory:Y},e.id)):f&&!j&&(0,l.Y)(uo,{fundingTransaction:null,isEditable:!1,isNestedCard:!0,application:g,creditUnionFee:W}),j&&(0,l.Y)(ii,{isNestedCard:!0,name:K&&uh(K),isKeyValueTableRightAligned:!0,attributes:ur({clientName:T.clientDetails.clientName,clientFullName:T.clientDetails.clientFullName,fundingAmountCents:(null==K?void 0:K.amountCents.toString())||"",creditUnionFeeConfig:K})})]},null==S?void 0:S.id)},ux=e=>{let{application:n,onFundingEditClick:i,onAccountDetailsEditClick:t,fundingEnabled:o,allAccountsFields:a,onCollateralEditClick:r,onUpdateExternalAccountHolderCategory:d,getTaxReportingTaxId:s,userId:c}=e,u=n.products&&n.products.length>1?"New Accounts":"New Account";return(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{headingTag:"h2",heading:u,theme:"small"}),a.map(e=>{var a;return(0,l.Y)(uw,{accountReferenceId:null==e?void 0:e.referenceId,application:n,fundingEnabled:o,onFundingEditClick:()=>i(null==e?void 0:e.referenceId),fundingTransactions:(e=>{var i;return e!==z.ZSb&&e?null==n||null==(i=n.fundingTransactions)?void 0:i.filter(n=>{var i;return(null==n||null==(i=n.meta)?void 0:i.accountReferenceId)===e||aG.CB.includes(n.type)}):n.fundingTransaction?[n.fundingTransaction]:null})(e.referenceId),onAccountDetailsEditClick:t,getTaxReportingTaxId:s,userId:c,product:null==(a=n.products)?void 0:a.find(n=>n.id===e.productId),isPrimaryShare:"isPrimaryShareAccount"in e&&(null==e?void 0:e.isPrimaryShareAccount),onCollateralEditClick:r,onUpdateExternalAccountHolderCategory:d},null==e?void 0:e.referenceId)})]})},uF={totalCopy:{fontWeight:700},infoContainer:{display:"flex",alignItems:"center",gap:"8px"}},uY=e=>{var n,i,t,o,a,r,d,s,c,u,p;let m,h,{application:v,onFundingEditClick:g,onAccountDetailsEditClick:f,fundingEnabled:y,allAccountsFields:I,onCollateralEditClick:A,onUpdateExternalAccountHolderCategory:b,getTaxReportingTaxId:C,userId:S}=e,{products:w,clientDetails:F}=(0,D.t)(),{membershipInfo:Y,primaryShareData:T}=v.fields||{};if(null==(i=v.fields)||null==(n=i.accounts)?void 0:n.length){let e=null==(s=v.fields)||null==(d=s.accounts)?void 0:d.find(e=>!e.isPrimaryShareAccount);m=null==e?void 0:e.accountVariant,h=null==e?void 0:e.productId}else m=null==(c=v.fields)?void 0:c.accountVariant,h=null==(u=v.fields)?void 0:u.productId;(0,Q.Z1)(h,"undefined productId in application.fields"),(0,Q.Z1)(m,"undefined accountVariant");let E=I.some(e=>"loan"===e.productType),k=v.fundingTransactions||[],P=(e=>{let{fundingTransactions:n,personsCoreData:i,organizationsCoreData:t,membershipInfo:l}=e;return n.filter(e=>e.primaryShareOwnerOrganizationId?!((null==t?void 0:t.find(n=>!!(null==n?void 0:n.externalCoreMembershipId)&&n.id===e.primaryShareOwnerOrganizationId))&&!(l&&"createMembership"in l))&&e.isPrimaryShareFundingTransaction:e.primaryShareOwnerPersonId?!(i.find(n=>!!n.externalCoreMembershipId&&n.id===e.primaryShareOwnerPersonId)&&!(l&&"createMembership"in l))&&e.isPrimaryShareFundingTransaction:null)})({fundingTransactions:k,personsCoreData:v.persons,organizationsCoreData:null!=(p=v.organizations)?p:[],membershipInfo:Y}),O=P.length>1,R=!(P.length>0)||(null==T||null==(t=T.primaryAccountRoleData)?void 0:t.isSelectedShareProduct)?"New Account":"New Accounts",L=e=>{var n;
1return null==e||null==(n=e.newAccountRelationshipData)?void 0:n.find(e=>e.isPrimaryEntity)},N=P.find(e=>{var n,i;return e.primaryShareOwnerOrganizationId?e.primaryShareOwnerOrganizationId===(null==(n=L(I[0]))?void 0:n.organizationId):e.primaryShareOwnerPersonId===(null==(i=L(I[0]))?void 0:i.personId)}),B=null==(o=(0,s1.ls)(F,null==N?void 0:N.primaryShareCreationInstructionName))?void 0:o.creditUnionFee,M=null==T||null==(a=T.primaryShareAccounts.find(e=>e.isPrimaryShare))?void 0:a.product.name;return(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{headingTag:"h2",heading:R,theme:"small"}),I.map(e=>{let n=L(e);return(0,l.Y)(l.FK,{children:(0,l.Y)(uv,{accountReferenceId:null==e?void 0:e.referenceId,personId:null==n?void 0:n.personId,organizationId:null==n?void 0:n.organizationId,primaryAccountRoleData:null==T?void 0:T.primaryAccountRoleData,application:v,fundingEnabled:y,onFundingEditClick:()=>g(null==e?void 0:e.referenceId),onAccountDetailsEditClick:f,getTaxReportingTaxId:C,userId:S,primaryShareFundingTransaction:N,creditUnionFee:B,accountFields:e,onCollateralEditClick:A,onUpdateExternalAccountHolderCategory:b},null==e?void 0:e.referenceId)})}),T&&T.primaryShareAccounts.length>0?(0,l.FD)(l.FK,{children:[E&&(0,l.Y)(ii,{name:"Member Share Account",children:(0,l.Y)("div",{css:{padding:"8px 0"},children:(0,l.Y)(eU.A,{variant:"grey",children:(0,l.FD)("div",{css:uF.infoContainer,children:[(0,l.Y)(eH.A,{name:"info",size:"medium"}),(0,l.Y)(e6.A,{source:"**".concat(M,"** account is required to open a loan.")})]})})})}),T.primaryShareAccounts.map((e,n)=>{var i;let t=v.persons.find(n=>n.id===e.personId),o=null==(i=v.organizations)?void 0:i.find(n=>(null==n?void 0:n.id)===e.organizationId),a=O&&(null==t?void 0:t.firstName),r=O&&(null==o?void 0:o.legalName),d=P.find(e=>e.primaryShareOwnerOrganizationId?e.primaryShareOwnerOrganizationId===(null==o?void 0:o.id):e.primaryShareOwnerPersonId===(null==t?void 0:t.id)),s=(null==d?void 0:d.primaryShareOwnerOrganizationId)?r:a;return d&&e.creditUnionFee?(0,l.Y)(ud,{clientName:F.clientName,clientFullName:F.clientFullName,entityName:s||"",membershipTypeLabel:e.membershipTypeLabel,productName:e.product.name,maturityDate:(0,us.A)(e.product),fundingAmountCents:d.fundingAmount,fundingSource:d.fundingSource,creditUnionFeeConfig:e.creditUnionFee},"primaryShareAccountCard".concat(n)):null})]}):null,[...k,...P].length>1?(0,l.Y)(ii,{name:"Total Deposit",attributes:(e=>{var n,i;let t,o,a,{selectedProductIsPrimaryShare:r,application:d,products:s,primaryShareFundingTransactions:c}=e,{fundingTransactions:u,products:p,persons:m,fields:h}=d;if(null==h||null==(n=h.accounts)?void 0:n.length){let e=null==h||null==(i=h.accounts)?void 0:i.find(e=>!e.isPrimaryShareAccount);o=null==e?void 0:e.accountVariant,a=null==e?void 0:e.newAccountRelationshipD
1ata,t=null==p?void 0:p.find(n=>n.id===(null==e?void 0:e.productId))}else t=null==p?void 0:p[0],o=null==h?void 0:h.accountVariant,a=null==h?void 0:h.newAccountRelationshipData;(0,Q.Z1)(u,"undefined fundingTransactions"),(0,Q.Z1)(o,"undefined accountVariant"),(0,Q.Z1)(t,"undefined product"),(0,Q.Z1)(a,"undefined newAccountRelationshipData");let v=u.find(e=>!e.isPrimaryShareFundingTransaction),g=c.length>1,f=new ew.z((null==v?void 0:v.fundingAmount)||0).toNumber(),y=c.length?(c.sort((e,n)=>e.productId===t.id?-1:+(n.productId===t.id)),c.reduce((e,n)=>{var i;let{productId:t,primaryShareOwnerPersonId:l,primaryShareOwnerOrganizationId:o,fundingAmount:d,paidByCustomer:c,paidByCustomerLabel:u}=n;if(!t||!(l||o))return e;let p=(e=>{var n;let{productName:i,personId:t,organizationId:l,paidByCustomer:o,paidByCustomerLabel:d}=e,s=a.find(e=>e.personId===t&&e.isPrimaryEntity),c=a.find(e=>e.organizationId===l&&e.isPrimaryEntity);if((s||c)&&r&&v)if(o)return null!=d?d:"Membership Fee";else return"Additional Funding";let u=null==(n=m.find(e=>e.id===t))?void 0:n.firstName;return"".concat(null!=i?i:"Additional Funding").concat(g?" - For ".concat(u):"")})({productName:null==(i=s[t])?void 0:i.name,personId:l,organizationId:o,paidByCustomer:c,paidByCustomerLabel:u});return e.push([p,(0,eN.CQ)(d)]),e},[])):[],I=[v,...c].filter(Boolean).filter(e=>!["rolloverFunds","transferFunds"].includes(e.type)).reduce((e,n)=>new ew.z(e).add(new ew.z(n.fundingAmount)).toNumber(),0);return[v&&[null==t?void 0:t.name,(0,eN.CQ)(f)],...y,[(0,l.Y)("span",{css:uF.totalCopy,children:"Total"},"funding-total"),(0,l.Y)("span",{css:uF.totalCopy,children:(0,eN.CQ)(I)},"funding-amount-total")]]})({selectedProductIsPrimaryShare:!!(null==T||null==(r=T.primaryAccountRoleData)?void 0:r.isSelectedShareProduct),application:v,products:w,primaryShareFundingTransactions:P})}):null]})};var uT=i(93902),uD=i.n(uT);let uE={modalContainer:{width:"480px",padding:"1.5rem"},modalHeader:{display:"flex",alignItems:"center",marginBottom:"1rem"},modalTitle:e=>{let{fontScales:n}=e;return{...n.medium,fontWeight:700}}},uk={...uE,newEmailInput:{marginBottom:"1rem"},newEmailTypeInput:{marginBottom:"1rem"},buttonContainer:{display:"flex",columnGap:"16px"}},uP=e=>{var n,i;let{isOpen:t,onClose:o,selectedPerson:a,onAddNewEmail:r}=e,{handleSubmit:d,watch:s,unregister:c,trigger:u,getValues:p,setValue:m}=(0,S.xW)(),{fields:h}=(0,T.d)()||{},g=null!=(n=s("newEmail"))?n:"",f=null!=(i=s("newEmailType"))?i:"",y=!!((null==g?void 0:g.trim())&&f),I=()=>(0,cv.q4)(h).filter(e=>{var n,i;return((null==(i=a.emails)||null==(n=i.filter(n=>n.type===e.type))?void 0:n.length)||0)<e.limit||f===e.type}).map(e=>({label:uD()(e.type),value:e.type}));(0,v.useEffect)(()=>{if(t){let e=I();m("newEmail",""),m("newEmailType",1===e.length?e[0].value:"")}},[t,m]);let A=async e=>{var n;if(!await u(["newEmail","newEmailType"]))return;let{newEmail:i,newEmailType:t}=e,l="".concat(a.id,".newEmails"),o=null!=(n=p(l))?n:[];i&&t&&(m(l,[...o,{value:i,type:t}],{shouldDirty:!0,shouldValidate:!0}),r(),c("newEmail",{keepDefaultValue:!1}),c("newEmailType",{keepDefaultValue:!1}))},b=()=>{c("newEmail",{keepDefaultValue:!1}),c("newEmailType",{keepDefaultValue:!1}),o()};return(0,l.Y)(nh.A,{isOpen:t,onClose:b,children:(0,l.FD)("div",{css:uk.modalContainer,children:[(0,l.FD)("div",{css:uk.modalHeader,children:[(0,l.Y)(eH.A,{name:"chevron-left",onClick:b}),(0,l.FD)("h2",{css:uk.modalTitle,children:["Add New Email Address:",a?" ".concat((0,J.L)({firstName:a.firstName,lastName:a.lastName,suffix:a.suffix})):""]})]}),(0,l.Y)("div",{css:uk.newEmailInput,children:(0,l.Y)(nv.A.Input,{name:"newEmail",label:"Email Address",placeholder:"Enter Email Address",inputMode:"email",validate:{required:!0}})}),(0,l.Y)("div",{css:uk.newEmailTypeInput,children:(0,l.Y)(nv.A.Dropdown,{name:"newEmailType",label:"Email Type",options:I(),placeholder:"Select Email Type",validate:{required:!0}},"newEmailType")}),(0,l.FD)("div",{css:uk.buttonContainer,children:[(0,l.Y)(w.A,{onClick:b,theme:"outline",isFull:!0,children:"Back"}),(0,l.Y)(w.A,{onClick:d(A),theme:"primary",isFull:!0,isDisabled:!y,children:"Add"})]})]})})},uO={...uE,personContainer:{marginBottom:"0.5rem",gap:"0.125rem"},dropdown:{marginBottom:"1rem"}},uR=e=>{let{person:n,setSelectedPerson:i,setIsAddEmailModalOpen:t}=e,o=(0,J.L)({firstName:null==n?void 0:n.firstName,lastName:null==n?void 0:n.lastName,suffix:null==n?void 0:n.suffix}),{getValues:a,setValue:r,watch:d}=(0,S.xW)(),{fields:s}=(0,T.d)()||{},c=a(),u=((e,n,i)=>{var t,l,o;let a=[];
1return null==(t=e.emails)||t.forEach(e=>{e&&a.push({label:null==e?void 0:e.address,value:null==e?void 0:e.address})}),null==(o=i[e.id])||null==(l=o.newEmails)||l.forEach(e=>{e&&a.push({label:null==e?void 0:e.value,value:null==e?void 0:e.value})}),(a.length||0)<n&&a.push({label:"Add New Email Address",value:"add_new_email"}),a})(n,(0,cv.Av)(s),c),p=d(n.id).notification.value,m=u.some(e=>e.value===p)||"add_new_email"===p?p:u.length>0?u[0].value.toString():"";return(0,l.Y)("div",{css:uO.personContainer,children:(0,l.Y)("div",{css:uO.dropdown,children:(0,l.Y)(ep.A,{name:n.id,label:o,options:u,value:m,onChange:e=>e&&!Array.isArray(e)&&(e=>{if(e&&"string"==typeof e){if("add_new_email"===e){i(n),t(!0);return}r(n.id,{...c[n.id],notification:{value:e}})}})(e),placeholder:"Select email address"})})},n.id)},uL=e=>{let{onClose:n,onSave:i}=e,{getValues:t}=(0,S.xW)(),o=t(),a=async()=>{let e=Object.entries(o),t=e.map(e=>{let[n,i]=e;return{personId:n,email:i.notification.value}}),l=e.flatMap(e=>{var n;let[i,t]=e;return null==t||null==(n=t.newEmails)?void 0:n.map(e=>({personId:i,email:{address:e.value,type:e.type}}))}).filter(Boolean);await i(t,l),n&&n()},{isLoading:r,onClick:d}=(0,iB.A)({onClick:a});return(0,l.Y)(w.A,{onClick:d,theme:"primary",isFull:!0,isLoading:r,children:"Save"})},uN=e=>{var n,i;let{isOpen:t,onClose:o,application:a,onSave:r}=e,d=null==(n=a.fields)?void 0:n.notifications,s=a.persons,[c,u]=(0,v.useState)(!1),[p,m]=(0,v.useState)(null),h=(0,v.useMemo)(()=>{let e={};for(let n of s){let i=n.emailPrimary||"";e[n.id]={notification:{value:i}}}for(let n of null!=d?d:[])(null==n?void 0:n.personId)&&(null==n?void 0:n.email)&&(e[n.personId]={notification:{value:n.email}});return e},[s,d]),g=()=>{u(!1),m(null)};return(0,l.FD)(y.A,{initialValues:h,children:[(0,l.Y)(nh.A,{isOpen:t,onClose:o,children:(0,l.FD)("div",{css:uO.modalContainer,children:[(0,l.Y)("div",{css:uO.modalHeader,children:(0,l.Y)(np.A.H4,{css:e=>uO.modalTitle(e),children:"Email Notifications"})}),(0,l.Y)("div",{children:s.map(e=>{var n;return(0,l.Y)(en.A,{applicationFields:a.rawFields,personId:null==e?void 0:e.id,applicationType:a.type,originatingExperience:a.originatingExperience,isControlProng:null==e?void 0:e.isControlProng,isOwnershipProng:null==e?void 0:e.isOwnershipProng,isSoleProprietor:null==e?void 0:e.isSoleProprietor,isControlProngAuthorizedSigner:null==(n=a.fields)?void 0:n.isControlProngAuthorizedSigner,isMissingTaxId:(null==e?void 0:e.hasTaxId)===!1,coreSyncedFields:null==e?void 0:e.coreSyncedFields,isCreditUnionMember:!!(null==e?void 0:e.externalCoreMembershipId),isMinor:null==e?void 0:e.isMinor,isEIN:!1,kycEvaluationTags:[],children:(0,l.Y)(uR,{person:e,setIsAddEmailModalOpen:u,setSelectedPerson:m})},"email-".concat(e.id))})}),(0,l.Y)(uL,{onSave:r,onClose:o})]})}),p?(0,l.Y)(en.A,{applicationFields:a.rawFields,personId:null==p?void 0:p.id,applicationType:a.type,originatingExperience:a.originatingExperience,isControlProng:null==p?void 0:p.isControlProng,isOwnershipProng:null==p?void 0:p.isOwnershipProng,isSoleProprietor:null==p?void 0:p.isSoleProprietor,isControlProngAuthorizedSigner:null==(i=a.fields)?void 0:i.isControlProngAuthorizedSigner,isMissingTaxId:(null==p?void 0:p.hasTaxId)===!1,coreSyncedFields:null==p?void 0:p.coreSyncedFields,isCreditUnionMember:!!(null==p?void 0:p.externalCoreMembershipId),isMinor:null==p?void 0:p.isMinor,isEIN:!1,kycEvaluationTags:[],children:(0,l.Y)(uP,{isOpen:c,onClose:g,selectedPerson:p,onAddNewEmail:g})}):null]})},uB={descriptionContainer:e=>({display:"flex",alignItems:"center",...e&&{marginBottom:"16px"}}),editButton:e=>{let{colors:n}=e;return{marginLeft:"8px",button:{padding:0,border:"none",backgroundColor:"transparent",outline:"none"},svg:{cursor:"pointer",border:"2px solid ".concat(n.grey14),borderRadius:8,marginTop:10,marginRight:5,padding:6,background:n.white}}}},uM=e=>{var n;let{application:i,onSaveEmailNotifications:t,isEditable:o=!0}=e,[a,r]=(0,v.useState)(!1),{persons:d,fields:s}=i,[c,u]=(0,v.useState)((null==s||null==(n=s.notifications)?void 0:n.reduce((e,n)=>(null==n?void 0:n.personId)&&(null==n?void 0:n.email)?{...e,[n.personId]:{email:n.email}}:e,{}))||{}),p=(0,v.useMemo)(()=>d.map(e=>[(0,J.L)({firstName:e.firstName,middleName:e.middleName,lastName:e.lastName,suffix:e.suffix}),((e,n)=>n&&n[e.id]?n[e.id].email:e.emailPrimary?e.emailPrimary:null)(e,c)]),[d]),m=async(e,n)=>{u(e.reduce((e,n)=>{let{personId:i,email:t}=n;return{...e,[i]:{email:t}}},{})),await t(e,n)},h=o?"Please select the correct email ".concat(d.length>1?"per person ":"","that you wish to use for email communications sent on behalf of this application."):"The following email addresses will be used for c
1ommunications sent on behalf of this application.";return(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{headingTag:"h2",heading:"Email Notifications",theme:"small"}),(0,l.Y)(ei.A,{theme:"small",children:(0,l.FD)(eU.A,{flushMobile:!0,variant:"grey",children:[(0,l.FD)("div",{css:uB.descriptionContainer(o),children:[h,o&&(0,l.Y)("div",{css:uB.editButton,children:(0,l.Y)(w.A,{name:"Edit",onClick:()=>{r(!0)},"data-testid":"edit-button-notifications",children:(0,l.Y)(eH.A,{name:"pencil-minimal",color:"grey2",size:"large"})})})]}),(0,l.Y)(e5.A,{isValuesRightAligned:!0,keyValueMap:p})]})}),o&&(0,l.Y)(uN,{application:i,isOpen:a,onClose:()=>{r(!1)},onSave:m})]})},uz={planLabel:e=>{let{fontScales:n}=e;return{...n.default,fontWeight:700}},beneficiarySectionLabel:e=>{let{fontScales:n}=e;return{...n.default,fontWeight:500,marginBottom:6}},sectionSmall:{marginBottom:6,display:"flex",justifyContent:"space-between"},sectionLarge:{marginTop:16}},uV=e=>{var n,i,t,a;let{plan:r,enforceOnePlanPerPlanType:d,userId:s,getPlanBeneficiaries:c,getDecedentFields:u}=e,p=(0,D.t)(),{fields:m}=(0,nn.A)({entityType:"beneficiary"}),[h,g]=(0,v.useState)((null==r||null==(n=r.fields)?void 0:n.beneficiaries)||[]),[f,y]=(0,v.useState)(!1),[I,A]=(0,v.useState)(null==r||null==(i=r.fields)?void 0:i.decedentFields),[b,C]=(0,v.useState)(!1),S=null==h?void 0:h.filter(e=>!e.contingent),w=null==h?void 0:h.filter(e=>e.contingent),F=!p.experiences.selfServe.enhancedTaxIdMasking||(null==r?void 0:r.personId)===s,Y=async(e,n)=>{if(r.id&&c)try{if(f){let i=h.filter(e=>n?!e.contingent:e.contingent)[e];return null==i?void 0:i.taxId}let i=(await c(r.id)).map(e=>{if(e.taxId&&!e.taxIdLastFour){let n=e.taxId.toString();e.taxIdLastFour=n.length>=4?n.slice(-4):n}return e});i&&i.length>0&&(g(i),y(!0));let t=i.filter(e=>n?!e.contingent:e.contingent)[e];return null==t?void 0:t.taxId}catch(e){console.error("Error fetching beneficiary tax IDs:",e);return}},T=async()=>{if(r.id&&u)try{if(b)return null==I?void 0:I.taxId;let e=await u(r.id);return e&&(A(e),C(!0)),null==e?void 0:e.taxId}catch(e){console.error("Error fetching decedent tax ID:",e);return}},k=(e,n,i)=>{var t,o,a,r,d,s,c,u,p;let h=e?(0,nt.Vd)({addressData:e,fields:m}):[],v=[["Name",(null==e?void 0:e.firstName)?"".concat(null==e?void 0:e.firstName," ").concat(null==e?void 0:e.lastName):void 0],[null==(t=m.legalName)?void 0:t.displayLabel,null==e?void 0:e.legalName],[null==(o=m.taxId)?void 0:o.displayLabel,(null==e?void 0:e.taxIdLastFour)?(0,l.Y)(e8.A,{taxIdLastFour:e.taxIdLastFour,isEIN:"organization"===e.type,getTaxId:F?()=>Y(n,i):void 0}):void 0],[null==(a=m.dateOfBirth)?void 0:a.displayLabel,(null==e?void 0:e.dateOfBirth)?(0,eY.wV)(e.dateOfBirth,{dateFormat:eY.Kn.LONG_MONTH_DAY_YEAR}):void 0],[null==(r=m.gender)?void 0:r.displayLabel,(0,E.kK)({fieldValue:null==e?void 0:e.gender,fieldConfig:m.gender})||void 0],[null==(d=m.emailPrimary)?void 0:d.displayLabel,null==e?void 0:e.emailPrimary],[null==(s=m.phoneNumber)?void 0:s.displayLabel,(null==e?void 0:e.phoneNumber)?(0,eN.n4)(e.phoneNumber):void 0],[null==(c=m.phoneMobile)?void 0:c.displayLabel,(null==e?void 0:e.phoneMobile)?(0,eN.n4)(e.phoneMobile):void 0],...h.map(e=>{var n;return[null==(n=m["address".concat(null==e?void 0:e.addressType)])?void 0:n.displayLabel,(0,nt.$P)(er()(e,"addressType"))]}),[null==(u=m.relationshipToCustomer)?void 0:u.displayLabel,null==e?void 0:e.relationshipToCustomer],[null==(p=m.percentage)?void 0:p.displayLabel,(null==e?void 0:e.percentage)?"".concat(null==e?void 0:e.percentage,"%"):void 0]].filter(e=>void 0!==e[1]&&null!==e[1]);return(0,l.Y)("div",{css:uz.sectionLarge,children:(0,l.Y)(eU.A,{children:(0,l.Y)(e5.A,{keyValueMap:v,isValuesRightAligned:!0})})},n)},P=null==(t=r.fields)?void 0:t.decedentFields,O=Object.keys(I||{}).length,R=[["Decedent Name",(null==I?void 0:I.firstName)?"".concat(null==I?void 0:I.firstName," ").concat(null==I?void 0:I.lastName):void 0],["Decedent Birth Date",(null==I?void 0:I.dateOfBirth)?(0,eY.wV)(I.dateOfBirth,{dateFormat:eY.Kn.LONG_MONTH_DAY_YEAR}):void 0],["Decedent Death Date",(null==I?void 0:I.dateOfBirth)?(0,eY.wV)(I.dateOfDeath,{dateFormat:eY.Kn.LONG_MONTH_DAY_YEAR}):void 0],["Decedent Tax Id",(null==I?void 0:I.taxIdLastFour)||(null==I?void 0:I.taxId)?(0,l.Y)(e8.A,{taxIdLastFour:null==P?void 0:P.taxIdLastFour,isEIN:!1,getTaxId:F?()=>T():void 0}):void 0],["Spousal IRA",(null==I?void 0:I.isSpousalIra)?"Yes":"No"],["Sole Spousal Distribution",(null==I?void 0:I.soleSpouseDistribution)?"Yes":"No"]].filter(e=>void 0!==e[1]);return(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{heading:"Plan Details",headingTag:"h2",theme:"small"}),(0,l.FD)(eU.A,{variant:"grey",children:[!!(null==(a=r.fields)?void 0:a.label)&&(0,l.Y)("div",{css:e=>[uz.planLabel(e),uz.sectionSmall],children:(0,o.WV)({planLabel:r.fields.label,planCode:r.fields.code,externalCoreId:r.externalCoreId,enforceOnePlanPerPlanType:d})}),!!O&&(0,l.Y)(e5.A,{keyValueMap:R,isValuesRightAligned:!0}),(null==S?void 0:S.length)>0&&(0,l.FD)("section",{css:uz.sectionLarge,children:[(0,l.Y)("div",{css:uz.beneficiarySectionLabel,children:"Primary Beneficiaries"}),S.map((e,n)=>k(e,n,!0))]}),(null==w?void 0:w.length)>0&&(0,l.FD)("section",{css:uz.sectionLarge,children:[(0,l.Y)("div",{css:uz.beneficiarySectionLabel,children:"Contingent Beneficiaries"}),w.map((e,n)=>k(e,n,!1))]})]})]})},u_=e=>{var n,i,t,a,r,d,s,c,u,p,m,h,v,g,f,y,A,b,C,S;let{application:w,account:F,agreements:Y,attestations:T,beneficiariesOnPreBookedApplication:E,dynamicAgreements:P,onOrganizationEditClick:O,onPersonEditClick:R,onFundingEditClick:L,onAccountDetailsEditClick:N,onSubmit:B,onHandoffApplication:M,userId:V,getPersonTaxId:_,getOrganizationTaxId:U,getTaxReportingTaxId:q,getPlanBeneficiaries:H,getDecedentFields:K,canEditPersonsInline:j,onPersonEditSubmit:W,fundingEnabled:G,updateInformationEligibleService:$,updateInformationIndicationOfInterest:Q,handleRequestUpdateInformationIOI:J,handleDeclineApplication:Z,onSaveEmailNotifications:X,onCollateralEditClick:ee,onUpdateExter
1nalAccountHolderCategory:en}=e,et=(0,D.t)(),{clientDetails:el,mantlFeatures:eo}=et,ea="consumerDepositAddSecondaryOwner"===w.type,er="businessDepositAddAuthorizedSigner"===w.type,ed="businessUpdatePersons"===w.type,es="creditUnion"===el.clientType,ec=!ed&&!ea&&!er,eu=w.isMultiApplicantsCDASO||(0,r8.As)(null!=(C=w.rawFields)?C:{}),ep=!!E.length,em=(0,cv.GF)(et),eh=(e=>{var n,i,t,l,a,r,d,s,c,u;let{application:p,userId:m,mantlFeatures:h}=e,v=!!(null==h||null==(i=h.accountOpening)||null==(n=i.nonControlProngBusinessApplicant)?void 0:n.enabled),g=!!(null==h||null==(l=h.accountOpening)||null==(t=l.nonControlProngBusinessApplicant)?void 0:t.allowApplicantTransferFromSelfServe),f="createAccount"===p.type,y=(null==(r=p.fields)||null==(a=r.ownership)?void 0:a.type)&&o.Jh.includes(null==(s=p.fields)||null==(d=s.ownership)?void 0:d.type),I=(null==(c=p.fields)?void 0:c.applicantId)===m;return v&&g&&f&&I&&!!y&&(null==(u=p.persons)?void 0:u.length)>1})({application:w,userId:V,mantlFeatures:eo}),ev=null!=(S=null==w||null==(n=w.rawFields)?void 0:n.accounts)?S:[{...null==w?void 0:w.rawFields,referenceId:z.ZSb}],eg=(e=>{var n;if(e)return null!=(n=(e=>{var n;if(e)return null==e||null==(n=e.find(e=>null==e?void 0:e.planId))?void 0:n.planId})(e.accounts))?n:e.planId})(w.fields),ef=w.products&&w.products.length>0?w.products:void 0,ey=!!(null==(t=w.fields)||null==(i=t.ownership)?void 0:i.type)&&o.Jh.includes(w.fields.ownership.type),eI=!!(null==(r=w.fields)||null==(a=r.newAccountRelationshipD
1ata)?void 0:a.some(e=>e.personId===V&&"authorizedSigner"===e.role)),eA=(0,cg.q)(null==(d=w.meta)?void 0:d.complianceCollectionStatus),eb=eg&&(()=>{let e;return w.persons.some(n=>{var i;return null==(i=n.plans)?void 0:i.find(n=>n.id===eg&&(e=n,!0))}),e})();return(0,l.FD)(l.FK,{children:[(0,l.FD)(k.A,{children:[(0,l.Y)(ui,{application:w,account:F,userCanHandoffApplication:eh}),(0,l.Y)(ei.A,{children:(0,l.FD)("div",{css:{">div:last-of-type":{marginBottom:0}},children:[ec?es&&!(((null==(c=w.fields)||null==(s=c.accounts)?void 0:s.length)||0)>1)&&(null==(u=w.fields)?void 0:u.primaryShareData)?(0,l.Y)(uY,{userId:V,application:w,onFundingEditClick:L,onAccountDetailsEditClick:N,fundingEnabled:G,allAccountsFields:ev,onCollateralEditClick:ee,onUpdateExternalAccountHolderCategory:en,getTaxReportingTaxId:q}):(0,l.Y)(ux,{userId:V,application:w,onFundingEditClick:L,onAccountDetailsEditClick:N,fundingEnabled:G,allAccountsFields:ev,onCollateralEditClick:ee,onUpdateExternalAccountHolderCategory:en,getTaxReportingTaxId:q}):null,eu?(0,l.FD)(l.FK,{children:[(0,l.Y)(x.A,{headingTag:"h2",heading:"Your Account",theme:"small"}),(0,l.Y)(ii,{name:null==(m=w.products)||null==(p=m[0])?void 0:p.name,variant:"grey",isEditable:!1})]}):null,(0,l.Y)(cX,{application:w,account:F,canEditPersonsInline:j,getOrganizationTaxId:U,getPersonTaxId:_,onOrganizationEditClick:O,onPersonEditClick:R,products:ef,shouldDisplayNewAccountSection:ec,userId:V,onPersonEditSubmit:W,updateInformationEligibleService:$,updateInformationIndicationOfInterest:Q,handleRequestUpdateInformationIOI:J}),ep&&(0,l.Y)(cA,{beneficiariesOnPreBookedApplication:E}),em&&(0,l.Y)(uM,{application:w,onSaveEmailNotifications:X,isEditable:!(ey&&eI)}),!!eb&&(0,l.Y)(uV,{plan:eb,enforceOnePlanPerPlanType:(null==(h=eo.accountOpening.enforceOnePlanPerPlanType)?void 0:h.enabled)||!1,userId:V,getPlanBeneficiaries:H,getDecedentFields:K})]})}),(0,l.Y)(I.Ay,{namePrefix:"applicationFields",calculateAllAccounts:!0,application:w,addressPrimaryState:(null==w||null==(f=w.persons)||null==(g=f[0])||null==(v=g.rawFields)?void 0:v.addressPrimaryState)||void 0,maritalStatus:(null==w||null==(b=w.persons)||null==(A=b[0])||null==(y=A.rawFields)?void 0:y.maritalStatus)||void 0,organizationKycEvaluationTags:null==w?void 0:w.organizationKycEvaluationTags,personKycEvaluationTags:null==w?void 0:w.personKycEvaluationTags,children:(0,l.Y)(cI,{application:w,agreements:Y,attestations:T,dynamicAgreements:P,onSubmit:B,userCanHandoffApplication:eh&&!eA,onHandoffApplication:M,handleDeclineApplication:Z})})]}),(0,l.Y)(un,{application:w})]})};var uU=i(27033),uq=i(93450),uH=i(14822),uK=i(97335);function uj(){let e=(0,ng._)(["\n  mutation PushComplianceShadowViewEvent(\n    $input: ComplianceShadowViewEventInput!\n  ) {\n    pushComplianceShadowViewEvent(fields: $input) {\n      id\n    }\n  }\n"]);return uj=function(){return e},e}let uW=(0,iE.J1)(uj());var uG=i(85293),u$=i(78457),uQ=i(72942),uJ=i(64085);let uZ=e=>{var n,i,t;let{organizations:o=[],value:a,onChange:r,label:d="Select Your Business"}=e,{clientDetails:s}=(0,D.t)(),c="creditUnion"===s.clientType,u=(0,uQ.Ji)(o),p=u.map(e=>{var n,i;return{label:null!=(n=e[0].legalName)?n:"",value:null!=(i=e[0].id)?i:""}}),m=null!=(t=null==(i=u.find(e=>e.some(e=>e.id===a)))||null==(n=i[0])?void 0:n.id)?t:a;return(0,l.Y)(ep.A,{name:"businessId",ariaLabel:d,label:d,options:p,value:m,onChange:e=>{"string"==typeof e&&r(e)},formatOptionLabel:(e,n)=>{let{context:i}=n;return(0,uQ.Mb)(e,i,u,c)}})},uX={sectionHeader:e=>{let{colors:n,fontScales:i}=e;return{color:n.grey7,...i.medium,fontWeight:700,marginBottom:"1rem"}}},u0=e=>{let{membershipWithAccountsList:n,isLoading:i,onSubmit:t,showNewMembershipButton:o,newMembershipTypeLabel:a,eligibleMembershipIdsFromRequirement:r,ineligibleReasonByMembershipId:d,isLoadingEligibility:s,entityName:c,taxId:u,organizations:p,selectedOrganizationId:m,onSelectBusiness:h,stampCreateOrganizationWithMembership:g}=e,[f,y]=(0,v.useState)(null),[I,A]=(0,v.useState)(void 0);return(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{heading:"Select Membership",subheading:"Select a membership to be associated with this new account."}),h&&!!(null==p?void 0:p.length)&&(0,l.Y)(ei.A,{theme:"small",children:(0,l.Y)(uZ,{organizations:p,value:m,onChange:h})}),(0,l.FD)(ei.A,{theme:"small",children:[(0,l.Y)(np.A.H2,{css:uX.sectionHeader,children:"Memberships"}),null==n?void 0:n.map(e=>{let{membership:n,relatedAccounts:i,organizationCoreId:t}=e;return(0,l.Y)(uJ.A,{membership:n,entityName:c,taxId:u,onSelect:()=>{y({selectedMembershipId:n.externalCoreMembershipId}),A(t)},isActive:!!(f&&"selectedMembershipId"in f&&(null==f?void 0:f.selectedMembershipId)===n.externalCoreMembershipId),relatedAccounts:i,membershipIsNotProductEligible:(e=>null!=d&&!!d[e]||!!(null==r?void 0:r.length)&&!r.includes(e))(n.externalCoreMembershipId),ineligibleReason:null==d?void 0:d[n.externalCoreMembershipId]},n.externalCoreMembershipId)}),o&&(0,l.Y)(uJ.A,{entityName:c,taxId:u,onSelect:()=>{y({createMembership:!0}),A(void 0)},isActive:!!(f&&"createMembership"in f&&(null==f?void 0:f.createMembership)),newMembershipTypeLabel:a,membershipIsNotProductEligible:!1},"newMembership")]}),(0,l.Y)(w.A,{isFull:!0,isDisabled:!f||s,isLoading:i,onClick:()=>
1{if(!f)return;let e={membershipInfo:f};I?e.organizationCoreEntitySelection={selectedOrganizationCoreId:I}:g&&"createMembership"in f&&(e.organizationCoreEntitySelection={createOrganization:!0}),t(e)},children:"Next"})]})};var u9=i(72315),u1=i.n(u9),u2=i(68119),u6=i(80378),u5=i(21900);function u4(){let e=(0,ng._)(["\n  query GetOrganizationCoreData($organizationId: ID!) {\n    organizationCoreData(organizationId: $organizationId) {\n      coreData\n    }\n  }\n"]);return u4=function(){return e},e}let u3=(0,iE.J1)(u4());function u8(){let e=(0,ng._)(["\n  query GetPersonCoreData($personId: ID!) {\n    personCoreData(personId: $personId) {\n      coreData\n    }\n  }\n"]);return u8=function(){return e},e}let u7=(0,iE.J1)(u8()),pe=e=>{let{personId:n,queryOptions:i}=e,{authData:t}=(0,u5.A)(),{data:{personCoreData:l}={},loading:o,called:a}=(0,ik.I)(u7,{skip:!t,variables:{personId:n},...i||{}});return{personCoreData:l,isLoadingGetPersonCoreData:o,hasCalledGetPersonCoreData:a}};var pn=i(18076),pi=i(87661);let pt=e=>{var n,i,t,l,o,a;let{organization:r,application:d,fields:s,attributionFields:c,organizationCoreEntitySelection:u}=e,p={role:"business",organizationId:r.id},m=[...((null==d||null==(t=d.fields)||null==(i=t.accounts)||null==(n=i[0])?void 0:n.newAccountRelationshipD
1ata)||(null==d||null==(l=d.fields)?void 0:l.newAccountRelationshipData)||[]).filter(e=>!!e&&"business"!==e.role).map(e=>{let{role:n,personId:i,organizationId:t}=e;return i?{role:n,personId:i}:t?{role:n,organizationId:t}:null}).filter(Boolean),p];return{applicationId:d.id,fields:{newAccountRelationshipData:m,...void 0!==s.doingBusinessAs&&{doingBusinessAs:(0,pi.gU)(s.doingBusinessAs)},organizationId:r.id,...u&&{organizationCoreEntitySelection:u},accounts:null==d||null==(a=d.fields)||null==(o=a.accounts)?void 0:o.map(e=>{var n,i,t;return{...e,isPrimaryShareAccount:null!=(i=e.isPrimaryShareAccount)?i:void 0,skipFunding:null!=(t=e.skipFunding)?t:void 0,purposeOfLoanList:(null==(n=e.purposeOfLoanList)?void 0:n.filter(Boolean))||null,newAccountRelationshipData:[...m]}}),...c}}};var pl=i(8036);let po=["authorizedSigner","controlProng"];var pa=i(7633);let pr=JSON.parse('{"ip":0,"fr":60,"v":"5.1.20","assets":[],"layers":[{"ty":4,"nm":"Line1","ip":0,"st":0,"ind":13,"hix":1,"ks":{"o":{"a":0,"k":100},"or":{"a":0,"k":[0,0,0]},"a":{"a":0,"k":[2.5,8,0]},"p":{"s":true,"x":{"a":0,"k":47.975},"y":{"a":0,"k":20.131}},"rx":{"a":0,"k":0},"ry":{"a":0,"k":0},"rz":{"a":0,"k":0},"s":{"a":0,"k":[100,100,100]}},"shapes":[{"ty":"gr","nm":"Line1 shape group","it":[{"ty":"sh","ks":{"a":0,"k":{"c":false,"v":[[3.46376,1.71875],[2.24689,14.5979]],"i":[[0,0],[1.28639,-4.163799999999998]],"o":[[0.4837699999999998,4.33106],[0,0]]}}},{"ty":"st","o":{"a":0,"k":100},"c":{"a":0,"k":[0,0,0,1]},"lc":2,"lj":2,"ml":1,"w":{"a":0,"k":2.5},"d":[{"n":"d","v":{"a":0,"k":100},"nm":"0"},{"n":"g","v":{"a":0,"k":100},"nm":"1"},{"n":"o","v":{"a":1,"k":[{"t":0,"s":[185],"e":[185],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":51,"s":[185],"e":[200],"i":{"x":[0.32],"y":[1.275]},"o":{"x":[0.175],"y":[0.885]}},{"t":74}]},"nm":"2"}]},{"ty":"fl","o":{"a":0,"k":0},"c":{"a":0,"k":[0,0,0,0]},"r":1},{"ty":"tr","o":{"a":0,"k":100},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"p":{"a":0,"k":[0,0]},"r":{"a":0,"k":0}}]}],"op":101},{"ty":4,"nm":"Line2","ip":0,"st":0,"ind":12,"hix":2,"ks":{"o":{"a":0,"k":100},"or":{"a":0,"k":[0,0,0]},"a":{"a":0,"k":[2.5,5,0]},"p":{"s":true,"x":{"a":0,"k":57.093},"y":{"a":0,"k":20.121}},"rx":{"a":0,"k":0},"ry":{"a":0,"k":0},"rz":{"a":0,"k":0},"s":{"a":0,"k":[100,100,100]}},"shapes":[{"ty":"gr","nm":"Line2 shape group","it":[{"ty":"sh","ks":{"a":0,"k":{"c":false,"v":[[2.97044,1.87679],[1.75586,7.95199]],"i":[[0,0],[0,0]],"o":[[0,0],[0,0]]}}},{"ty":"st","o":{"a":0,"k":100},"c":{"a":0,"k":[0,0,0,1]},"lc":2,"lj":2,"ml":1,"w":{"a":0,"k":2.5},"d":[{"n":"d","v":{"a":0,"k":100},"nm":"0"},{"n":"g","v":{"a":0,"k":100},"nm":"1"},{"n":"o","v":{"a":1,"k":[{"t":0,"s":[185],"e":[185],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":50,"s":[185],"e":[200],"i":{"x":[0.32],"y":[1.275]},"o":{"x":[0.175],"y":[0.885]}},{"t":73}]},"nm":"2"}]},{"ty":"fl","o":{"a":0,"k":0},"c":{"a":0,"k":[0,0,0,0]},"r":1},{"ty":"tr","o":{"a":0,"k":100},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"p":{"a":0,"k":[0,0]},"r":{"a":0,"k":0}}]}],"op":101},{"ty":4,"nm":"Line3","ip":0,"st":0,"ind":11,"hix":3,"ks":{"o":{"a":0,"k":100},"or":{"a":0,"k":[0,0,0]},"a":{"a":0,"k":[5,2.5,0]},"p":{"s":true,"x":{"a":0,"k":66.532},"y":{"a":0,"k":29.649}},"rx":{"a":0,"k":0},"ry":{"a":0,"k":0},"rz":{"a":0,"k":0},"s":{"a":0,"k":[100,100,100]}},"shapes":[{"ty":"gr","nm":"Line3 shape group","it":[{"ty":"sh","ks":{"a":0,"k":{"c":false,"v":[[8.12318,2.02945],[2.04797,3.24403]],"i":[[0,0],[0,0]],"o":[[0,0],[0,0]]}}},{"ty":"st","o":{"a":0,"k":100},"c":{"a":0,"k":[0,0,0,1]},"lc":2,"lj":2,"ml":1,"w":{"a":0,"k":2.5},"d":[{"n":"d","v":{"a":0,"k":100},"nm":"0"},{"n":"g","v":{"a":0,"k":100},"nm":"1"},{"n":"o","v":{"a":1,"k":[{"t":0,"s":[185],"e":[185],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":55,"s":[185],"e":[200],"i":{"x":[0.32],"y":[1.275]},"o":{"x":[0.175],"y":[0.885]}},{"t":73}]},"nm":"2"}]},{"ty":"fl","o":{"a":0,"k":0},"c":{"a":0,"k":[0,0,0,0]},"r":1},{"ty":"tr","o":{"a":0,"k":100},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"p":{"a":0,"k":[0,0]},"r":{"a":0,"k":0}}]}],"op":101},{"ty":4,"nm":"Line4","ip":0,"st":0,"ind":10,"hix":4,"ks":{"o":{"a":0,"k":100},"or":{"a":0,"k":[0,0,0]},"a":{"a":0,"k":[8,2.5,0]},"p":{"s":true,"x":{"a":0,"k":66.53},"y":{"a":0,"k":38.624}},"rx":{"a":0,"k":0},"ry":{"a":0,"k":0},"rz":{"a":0,"k":0},"s":{"a":0,"k":[100,100,100]}},"shapes":[{"ty":"gr","nm":"Line4 shape group","it":[{"ty":"sh","ks":{"a":0,"k":{"c":false,"v":[[14.2812,1.53605],[1.40207,2.75293]],"i":[[0,0],[4.16381,-1.28
164000000000002]],"o":[[-4.33103,-0.48375999999999997],[0,0]]}}},{"ty":"st","o":{"a":0,"k":100},"c":{"a":0,"k":[0,0,0,1]},"lc":2,"lj":2,"ml":1,"w":{"a":0,"k":2.5},"d":[{"n":"d","v":{"a":0,"k":100},"nm":"0"},{"n":"g","v":{"a":0,"k":100},"nm":"1"},{"n":"o","v":{"a":1,"k":[{"t":0,"s":[185],"e":[185],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":52,"s":[185],"e":[200],"i":{"x":[0.32],"y":[1.275]},"o":{"x":[0.175],"y":[0.885]}},{"t":70}]},"nm":"2"}]},{"ty":"fl","o":{"a":0,"k":0},"c":{"a":0,"k":[0,0,0,0]},"r":1},{"ty":"tr","o":{"a":0,"k":100},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"p":{"a":0,"k":[0,0]},"r":{"a":0,"k":0}}]}],"op":101},{"ty":4,"nm":"Ellipse 2","ip":0,"st":0,"ind":9,"hix":5,"ks":{"o":{"a":1,"k":[{"t":0,"s":[0],"e":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":52,"s":[0],"e":[100],"i":{"x":[0.515],"y":[0.955]},"o":{"x":[0.455],"y":[0.03]}},{"t":65}]},"or":{"a":0,"k":[0,0,0]},"a":{"a":0,"k":[2.5,3,0]},"p":{"s":true,"x":{"a":1,"k":[{"t":0,"s":[64.8],"e":[64.8],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":101}]},"y":{"a":1,"k":[{"t":0,"s":[44.993],"e":[44.993],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":101}]}},"rx":{"a":0,"k":0},"ry":{"a":0,"k":0},"rz":{"a":0,"k":0},"s":{"a":1,"k":[{"t":0,"s":[20,20],"e":[20,20],"i":{"x":[1,1],"y":[1,1]},"o":{"x":[0,0],"y":[0,0]}},{"t":66,"s":[20,20],"e":[100,100],"i":{"x":[0.32,0.32],"y":[1.275,1.275]},"o":{"x":[0.175,0.175],"y":[0.885,0.885]}},{"t":92}]}},"shapes":[{"ty":"gr","nm":"Ellipse 2 shape group","it":[{"ty":"el","p":{"a":0,"k":[2,2]},"s":{"a":0,"k":[4.2,4.2]}},{"ty":"st","o":{"a":0,"k":0},"w":{"a":0,"k":0},"c":{"a":0,"k":[0,0,0,0]},"lc":3,"lj":1,"ml":1},{"ty":"fl","o":{"a":0,"k":100},"r":1,"c":{"a":0,"k":[0,0,0,1]}},{"ty":"tr","o":{"a":0,"k":100},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"p":{"a":0,"k":[0,0]},"r":{"a":0,"k":0}}]}],"op":101},{"ty":4,"nm":"Ellipse 2","ip":0,"st":0,"ind":8,"hix":6,"ks":{"o":{"a":1,"k":[{"t":0,"s":[0],"e":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":53,"s":[0],"e":[100],"i":{"x":[0.515],"y":[0.955]},"o":{"x":[0.455],"y":[0.03]}},{"t":63}]},"or":{"a":0,"k":[0,0,0]},"a":{"a":0,"k":[2.5,3,0]},"p":{"s":true,"x":{"a":1,"k":[{"t":0,"s":[64.798],"e":[64.798],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":98}]},"y":{"a":1,"k":[{"t":0,"s":[20.692],"e":[20.692],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":98}]}},"rx":{"a":0,"k":0},"ry":{"a":0,"k":0},"rz":{"a":0,"k":0},"s":{"a":1,"k":[{"t":0,"s":[20,20],"e":[20,20],"i":{"x":[1,1],"y":[1,1]},"o":{"x":[0,0],"y":[0,0]}},{"t":65,"s":[20,20],"e":[100,100],"i":{"x":[0.32,0.32],"y":[1.275,1.275]},"o":{"x":[0.175,0.175],"y":[0.885,0.885]}},{"t":93}]}},"shapes":[{"ty":"gr","nm":"Ellipse 2 shape group","it":[{"ty":"el","p":{"a":0,"k":[2,2]},"s":{"a":0,"k":[4.2,4.2]}},{"ty":"st","o":{"a":0,"k":0},"w":{"a":0,"k":0},"c":{"a":0,"k":[0,0,0,0]},"lc":3,"lj":1,"ml":1},{"ty":"fl","o":{"a":0,"k":100},"r":1,"c":{"a":0,"k":[0,0,0,1]}},{"ty":"tr","o":{"a":0,"k":100},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"p":{"a":0,"k":[0,0]},"r":{"a":0,"k":0}}]}],"op":101},{"ty":4,"nm":"Ellipse 2","ip":0,"st":0,"ind":7,"hix":7,"ks":{"o":{"a":1,"k":[{"t":0,"s":[0],"e":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":51,"s":[0],"e":[100],"i":{"x":[0.515],"y":[0.955]},"o":{"x":[0.455],"y":[0.03]}},{"t":63}]},"or":{"a":0,"k":[0,0,0]},"a":{"a":0,"k":[2.5,3,0]},"p":{"s":true,"x":{"a":1,"k":[{"t":0,"s":[55.049],"e":[55.049],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":100}]},"y":{"a":1,"k":[{"t":0,"s":[30.464],"e":[30.464],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":100}]}},"rx":{"a":0,"k":0},"ry":{"a":0,"k":0},"rz":{"a":0,"k":0},"s":{"a":1,"k":[{"t":0,"s":[20,20],"e":[20,20],"i":{"x":[1,1],"y":[1,1]},"o":{"x":[0,0],"y":[0,0]}},{"t":64,"s":[20,20],"e":[100,100],"i":{"x":[0.32,0.32],"y":[1.275,1.275]},"o":{"x":[0.175,0.175],"y":[0.885,0.885]}},{"t":94}]}},"shapes":[{"ty":"gr","nm":"Ellipse 2 shape group","it":[{"ty":"el","p":{"a":0,"k":[2,2]},"s":{"a":0,"k":[4.2,4.2]}},{"ty":"st","o":{"a":0,"k":0},"w":{"a":0,"k":0},"c":{"a":0,"k":[0,0,0,0]},"lc":3,"lj":1,"ml":1},{"ty":"fl","o":{"a":0,"k":100},"r":1,"c":{"a":0,"k":[0,0,0,1]}},{"ty":"tr","o":{"a":0,"k":100},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"p":{"a":0,"k":[0,0]},"r":{"a":0,"k":0}}]}],"op":101},{"ty":4,"nm":"Ellipse 1","ip":0,"st":0,"ind":6,"hix":8,"ks":{"o":{"a":1,"k":[{"t":0,"s":[0],"e":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}}
1,{"t":50,"s":[0],"e":[100],"i":{"x":[0.515],"y":[0.955]},"o":{"x":[0.455],"y":[0.03]}},{"t":62}]},"or":{"a":0,"k":[0,0,0]},"a":{"a":0,"k":[2.5,3,0]},"p":{"s":true,"x":{"a":1,"k":[{"t":0,"s":[38.113],"e":[38.113],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":99}]},"y":{"a":1,"k":[{"t":0,"s":[23.15],"e":[23.15],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":99}]}},"rx":{"a":0,"k":0},"ry":{"a":0,"k":0},"rz":{"a":0,"k":0},"s":{"a":1,"k":[{"t":0,"s":[20,20],"e":[20,20],"i":{"x":[1,1],"y":[1,1]},"o":{"x":[0,0],"y":[0,0]}},{"t":62,"s":[20,20],"e":[100,100],"i":{"x":[0.32,0.32],"y":[1.275,1.275]},"o":{"x":[0.175,0.175],"y":[0.885,0.885]}},{"t":94}]}},"shapes":[{"ty":"gr","nm":"Ellipse 1 shape group","it":[{"ty":"el","p":{"a":0,"k":[2,2]},"s":{"a":0,"k":[4.2,4.2]}},{"ty":"st","o":{"a":0,"k":0},"w":{"a":0,"k":0},"c":{"a":0,"k":[0,0,0,0]},"lc":3,"lj":1,"ml":1},{"ty":"fl","o":{"a":0,"k":100},"r":1,"c":{"a":0,"k":[0,0,0,1]}},{"ty":"tr","o":{"a":0,"k":100},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"p":{"a":0,"k":[0,0]},"r":{"a":0,"k":0}}]}],"op":101},{"ty":4,"nm":"cone-topper","ip":0,"st":0,"ind":4,"hix":9,"ks":{"o":{"a":0,"k":100},"or":{"a":0,"k":[0,0,0]},"a":{"a":0,"k":[11.5,11.5,0]},"p":{"s":true,"x":{"a":0,"k":46.066},"y":{"a":0,"k":40.628}},"rx":{"a":0,"k":0},"ry":{"a":0,"k":0},"rz":{"a":0,"k":0},"s":{"a":0,"k":[100,100,100]}},"shapes":[{"ty":"gr","nm":"cone-topper shape group","it":[{"ty":"sh","ks":{"a":0,"k":{"c":true,"v":[[7.17034,15.8292],[14.4318,20.599],[19.9314,20.0829],[20.4475,14.5833],[15.6777,7.32182],[8.41622,2.55207],[2.91665,3.06813],[2.40059,8.5677],[7.17034,15.8292]],"i":[[0,0],[-2.3931000000000004,-0.7977999999999987],[-1.1280999999999999,1.1280999999999999],[0.797699999999999,2.393200000000002],[2.2563000000000013,2.2563000000000004],[2.393180000000001,0.79773],[1.1281500000000002,-1.12814],[-0.7977199999999998,-2.39316],[-2.256290000000001,-2.2562999999999995]],"o":[[2.2563000000000004,2.2562999999999995],[2.3931999999999984,0.797699999999999],[1.1281999999999996,-1.1281999999999996],[-0.7978000000000023,-2.3930999999999987],[-2.2562999999999995,-2.25629],[-2.3931699999999996,-0.79772],[-1.1281500000000002,1.1281499999999998],[0.79773,2.3932],[0,0]]}}},{"ty":"st","o":{"a":0,"k":100},"c":{"a":0,"k":[0,0,0,1]},"lc":2,"lj":2,"ml":1,"w":{"a":0,"k":2.5},"d":[{"n":"d","v":{"a":0,"k":200},"nm":"0"},{"n":"g","v":{"a":0,"k":200},"nm":"1"},{"n":"o","v":{"a":1,"k":[{"t":0,"s":[200],"e":[140],"i":{"x":[0.515],"y":[0.955]},"o":{"x":[0.455],"y":[0.03]}},{"t":72}]},"nm":"2"}]},{"ty":"fl","o":{"a":0,"k":0},"c":{"a":0,"k":[0,0,0,0]},"r":1},{"ty":"tr","o":{"a":0,"k":100},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"p":{"a":0,"k":[0,0]},"r":{"a":0,"k":0}}]}],"op":101},{"ty":4,"nm":"cone","ip":0,"st":0,"ind":3,"hix":11,"ks":{"o":{"a":0,"k":100},"or":{"a":0,"k":[0,0,0]},"a":{"a":0,"k":[17.5,17.5,0]},"p":{"s":true,"x":{"a":0,"k":36.877},"y":{"a":0,"k":49.822}},"rx":{"a":0,"k":0},"ry":{"a":0,"k":0},"rz":{"a":0,"k":0},"s":{"a":0,"k":[100,100,100]}},"shapes":[{"ty":"gr","nm":"cone shape group","it":[{"ty":"sh","ks":{"a":0,"k":{"c":false,"v":[[16.9582,2.22905],[2.03491,28.4022],[1.7708,30.4472],[2.72441,32.2754],[4.55263,33.229],[6.59762,32.9649],[32.7707,18.053]],"i":[[0,0],[0,0],[-0.12329999999999997,-0.6926999999999985],[-0.49746000000000024,-0.4974999999999987],[-0.6926299999999999,-0.12330000000000041],[-0.6385699999999996,0.29520000000000124],[0,0]],"o":[[0,0],[-0.29522000000000004,0.6386000000000003],[0.12329999999999997,0.6926000000000023],[0.49746999999999986,0.4975000000000023],[0.6926300000000003,0.12330000000000041],[0,0],[0,0]]}}},{"ty":"st","o":{"a":0,"k":100},"c":{"a":0,"k":[0,0,0,1]},"lc":2,"lj":2,"ml":1,"w":{"a":0,"k":2.5},"d":[{"n":"d","v":{"a":0,"k":200},"nm":"0"},{"n":"g","v":{"a":0,"k":200},"nm":"1"},{"n":"o","v":{"a":1,"k":[{"t":0,"s":[200],"e":[132],"i":{"x":[0.07],"y":[1]},"o":{"x":[0.86],"y":[0]}},{"t":74}]},"nm":"2"}]},{"ty":"fl","o":{"a":0,"k":0},"c":{"a":0,"k":[0,0,0,0]},"r":1},{"ty":"tr","o":{"a":0,"k":100},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"p":{"a":0,"k":[0,0]},"r":{"a":0,"k":0}}]}],"op":101},{"ty":4,"nm":"whitecone","ip":0,"st":0,"ind":2,"hix":10,"ks":{"o":{"a":0,"k":100},"or":{"a":0,"k":[0,0,0]},"a":{"a":0,"k":[17.5,17.5,0]},"p":{"s":true,"x":{"a":0,"k":39.16},"y":{"a":0,"k":49.559}},"rx":{"a":0,"k":0},"ry":{"a":0,"k":0},"rz":{"a":0,"k":0},"s":{"a":0,"k":[100,100,100]}},"shapes":[{"ty":"gr","nm":"whitecone shape group","it":[{"ty":"sh","ks":{"a":0,"k":{"c":true,"v":[[30.0844,19.5008],[33.0184,18.4981],[33.5345,12.9985],[28.7647,5.73703],[21.5032,0.967281],[16.0037,1.48334],[15.0144,3.86706],[0.608981,29.1319],[0.344865,31.1769],[1.29848,33.0051],[3.1267,33.9587],[5.17169,33.6946]],"i":[[0,0],[-0.6918000000000006,0.6918000000000006],[0.797699999999999,2.3932],[2.2562999999999995,2.2563000000000004],[2.3932,0.797719],[1.1280999999999999,-1.1281480000000002],[0.07189999999999941,-0.98312],[0,0],[-0.12329999999999997,-0.6926999999999985],[-0.49746400000000013,-0.4975000000000023],[-0.6926399999999999,-0.12330000000000041],[-0.6385800000000001,0.29520000000000124]],"o":[[1.2308000000000021,0.026499999999998636],[1.1281999999999996,-1.1281999999999996],[-0.797699999999999,-2.3931000000000004],[-2.2561999999999998,-2.2563],[-2.3931000000000004,-0.79772
119999999999],[-0.5856999999999992,0.5857199999999998],[0,0],[-0.295229,0.6385999999999967],[0.12330100000000005,0.6925999999999988],[0.49746,0.49739999999999895],[0.6926299999999999,0.12330000000000041],[0,0]]}}},{"ty":"st","o":{"a":0,"k":0},"w":{"a":0,"k":0},"c":{"a":0,"k":[0,0,0,0]},"lc":3,"lj":1,"ml":1},{"ty":"fl","o":{"a":0,"k":100},"r":2,"c":{"a":0,"k":[1,1,1,1]}},{"ty":"tr","o":{"a":0,"k":100},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"p":{"a":0,"k":[0,0]},"r":{"a":0,"k":0}}]}],"op":101},{"ty":4,"nm":"Organic shape","ip":0,"st":0,"ind":1,"hix":12,"ks":{"o":{"a":1,"k":[{"t":0,"s":[0],"e":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":12,"s":[0],"e":[100],"i":{"x":[0.675],"y":[0.19]},"o":{"x":[0.55],"y":[0.055]}},{"t":36}]},"or":{"a":0,"k":[0,0,0]},"a":{"a":0,"k":[42.5,35.5,0]},"p":{"s":true,"x":{"a":1,"k":[{"t":0,"s":[47.423],"e":[47.423],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":12}]},"y":{"a":1,"k":[{"t":0,"s":[38.303],"e":[38.303],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":12}]}},"rx":{"a":0,"k":0},"ry":{"a":0,"k":0},"rz":{"a":0,"k":0},"s":{"a":1,"k":[{"t":0,"s":[40,40],"e":[40,40],"i":{"x":[1,1],"y":[1,1]},"o":{"x":[0,0],"y":[0,0]}},{"t":12,"s":[40,40],"e":[100,100],"i":{"x":[0.265,0.265],"y":[1.5,1.5]},"o":{"x":[0.68,0.68],"y":[-0.55,-0.55]}},{"t":86}]}},"shapes":[{"ty":"gr","nm":"Organic shape shape group","it":[{"ty":"sh","ks":{"a":0,"k":{"c":true,"v":[[72.1022,65.4261],[70.5949,13.1357],[17.427,4.98876],[1.14464,39.3683],[29.8647,54.9484]],"i":[[-22.661399999999993,14.078699999999998],[16.450900000000004,19.243900000000004],[18.0764,-10.65311],[-5.30121,-16.406799999999997],[-11.776499999999999,-5.882100000000001]],"o":[[19.6854,-12.229800000000004],[-9.101299999999995,-10.64648],[-7.15,4.213769999999999],[5.48582,16.9782],[15.134500000000003,7.5595]]}}},{"ty":"st","o":{"a":0,"k":0},"w":{"a":0,"k":0},"c":{"a":0,"k":[0,0,0,0]},"lc":3,"lj":1,"ml":1},{"ty":"fl","o":{"a":0,"k":100},"r":2,"c":{"a":0,"k":[0.9058823529411765,0.9372549019607843,0.9803921568627451,1]}},{"ty":"tr","o":{"a":0,"k":100},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"p":{"a":0,"k":[0,0]},"r":{"a":0,"k":0}}]}],"op":101}],"op":101,"w":96,"h":78}'),pd=JSON.parse('{"v":"5.7.5","fr":100,"ip":0,"op":300,"w":78,"h":72,"nm":"Comp 1","ddd":0,"metadata":{},"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}},"ao":0,"shapes":[{"ty":"gr","nm":"Shape Layer 1","it":[{"ty":"sh","d":1,"ks":{"a":0,"k":{"c":false,"v":[[-10.93292236328125,1.9649028778076172],[-4.8870697021484375,7.809232711791992],[10.93292236328125,-7.809232711791992]],"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]]}}},{"ty":"tm","s":{"a":0,"k":0,"ix":2},"e":{"a":1,"k":[{"t":2,"s":[0],"i":{"x":[0.40804597701149425],"y":[1.030612244897959]},"o":{"x":[0.7988505747126436],"y":[0]}},{"t":100,"s":[100],"i":{"x":[0.75],"y":[0.75]},"o":{"x":[0.25],"y":[0.25]}}],"ix":2},"o":{"a":0,"k":0,"ix":2},"m":1},{"ty":"st","c":{"a":0,"k":[0,0,0],"ix":2},"o":{"a":0,"k":100,"ix":2},"w":{"a":0,"k":2,"ix":2},"lc":2,"lj":2,"ml":4},{"ty":"tr","p":{"a":0,"k":[40.023231506347656,36.325523376464844],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]}],"ip":0,"op":301,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Path","sr":1,"ks":{"p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"gr","nm":"Path","it":[{"ty":"gr","nm":"Path","it":[{"ty":"sh","d":1,"ks":{"a":0,"k":{"c":true,"v":[[0.03497312864694102,21.53040982665908],[0.02197312864694112,20.97450982665908],[0.03497312864694102,20.41860982665908],[0.03497312864694102,21.53040982665908],[0.03497312864694102,21.53040982665908]],"i":[[0,0],[0,0.6114000000000033],[-0.007200000000000983,-0.30579999999999785],[0.007199999999999207,-0.30579999999999785],[0,0]],"o":[[-0.007200000000000983,0.30570000000000164],[0,-0.6114999999999995],[0.007199999999999207,0.30570000000000164],[0,0],[0,0]]}}},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]},{"ty":"gr","nm":"Path","it":[{"ty":"sh","d":1,"ks":{"a":0,"k":{"c":true,"v":[[12.93597312864694,4.487009826659081],[19.680273128646945,2.6659098266590835],[21.21157312864694,2.6617098266590826],[24.555473128646945,2.9774098266590823],[33.042673128646946,7.152509826659083],[39.21867312864694,18.918709826659082],[39.21787312864694,23.030209826659082],[37.84087312864694,28.203009826659084],[29.09897312864694,37.41930982665908],[23.015573128646942,39.21250982665908],[18.946073128646944,39.21250982665908],[12.98847312864694,37.485109826659084],[4.119873128646942,28.204709826659084],[2.743773128646941,23.030209826659082],[2.74277312864694,18.918709826659082],[4.462573128646939,12.991509826659081],[12.93597312864694,4.487009826659081],[12.93597312864694,4.487009826659081]],"i":[[0,0],[-2.4969000000000037,0.21069999999999922],[-0.7383999999999986,-0.006499999999999062],[-1.2192000000000007,-0.24159999999999826],[-2.3474000000000004,-2.0764999999999993],[-0.5703999999999994,-4.665999999999999],[0.1069000000000031,-0.8652000000000015],[0.7169000000000025,-1.6781000000000006],[3.8826000000000036,-1.8943999999999974],[2.305399999999999,-0.2897999999999996],[0.8384999999999962,0.10540000000000305],[1.959500000000002,0.9364999999999952],[1.7158999999999978,4.0229],[0.23410000000000153,1.89
167000000000027],[-0.1062999999999974,0.8718999999999966],[-0.9031999999999982,1.8749000000000002],[-3.6567000000000007,1.7654000000000032],[0,0]],"o":[[2.1782000000000004,-1.051599999999997],[0.10379999999999967,-0.008800000000000807],[1.476700000000001,0.013000000000001677],[3.1370000000000005,0.6214000000000013],[3.5072999999999936,3.102499999999999],[0.10650000000000404,0.871299999999998],[-0.2336999999999989,1.8932000000000002],[-1.7093999999999951,4.000999999999998],[-2.0178999999999974,0.9846000000000004],[-0.8385999999999996,0.10540000000000305],[-2.2424999999999997,-0.28190000000000026],[-3.9177999999999997,-1.872400000000006],[-0.7177000000000007,-1.6826000000000008],[-0.10670000000000002,-0.8641000000000005],[0.26030000000000086,-2.134900000000002],[1.776600000000002,-3.687899999999999],[0,0],[0,0]]}}},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]},{"ty":"gr","nm":"Path","it":[{"ty":"sh","d":1,"ks":{"a":0,"k":{"c":true,"v":[[9.63427312864694,3.3233098266590826],[19.512373128646942,0.04240982665908355],[23.665873128646943,0.1665098266590821],[41.18017312864694,15.289609826659083],[41.89937312864694,19.41050982665908],[41.96397312864694,19.859009826659083],[41.99997312864694,20.93000982665908],[41.96417312864694,22.02330982665908],[41.900073128646945,22.516309826659082],[41.19857312864694,26.596409826659084],[35.811273128646945,35.804909826659085],[23.477073128646943,41.80260982665908],[13.240273128646942,40.47450982665908],[2.236273128646941,30.39320982665908],[2.9402731286469415,10.255109826659082],[9.63427312864694,3.3233098266590826],[9.63427312864694,3.3233098266590826]],"i":[[0,0],[-3.501400000000004,0.24069999999999858],[-1.275100000000002,-0.16239999999999988],[-2.2935000000000016,-8.1038],[-0.07589999999999719,-1.2563999999999993],[-0.019899999999999807,0.012299999999996203],[0,-0.6013000000000019],[0.019700000000000273,0],[0.01559999999999917,-0.2711000000000041],[0.3459000000000003,-1.2103000000000037],[2.565899999999999,-2.5659000000000063],[4.645299999999999,-0.5437999999999974],[3.2689000000000004,1.2937000000000012],[2.3063000000000002,4.586399999999998],[-3.653500000000001,6.168200000000004],[-2.6937999999999995,1.7295000000000016],[0,0]],"o":[[2.976099999999999,-1.9107999999999983],[1.2601999999999975,-0.08660000000000068],[8.317999999999998,1.0589000000000013],[0.373899999999999,1.3212000000000028],[0.01570000000000249,0.2589000000000041],[0.019800000000003593,-0.012199999999999989],[0,0.6013000000000019],[-0.019700000000000273,0],[-0.06909999999999883,1.2036999999999978],[-1.017400000000002,3.5589999999999975],[-3.338300000000004,3.3382999999999967],[-3.5234999999999985,0.4125000000000014],[-4.7532,-1.8811999999999998],[-3.2143999999999995,-6.392400000000002],[1.6236999999999995,-2.741299999999999],[0,0],[0,0]]}}},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]},{"ty":"fl","c":{"a":0,"k":[0,0,0],"ix":2},"o":{"a":0,"k":100,"ix":2},"r":1,"bm":0,"hd":true},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]},{"ty":"gr","nm":"Path","it":[{"ty":"sh","d":1,"ks":{"a":0,"k":{"c":true,"v":[[12.93597312864694,4.487009826659081],[19.680273128646945,2.6659098266590835],[21.21157312864694,2.6617098266590826],[24.555473128646945,2.9774098266590823],[33.042673128646946,7.152509826659083],[39.21867312864694,18.918709826659082],[39.21787312864694,23.030209826659082],[37.84087312864694,28.203009826659084],[29.09897312864694,37.41930982665908],[23.015573128646942,39.21250982665908],[18.946073128646944,39.21250982665908],[12.98847312864694,37.485109826659084],[4.119873128646942,28.204709826659084],[2.743773128646941,23.030209826659082],[2.74277312864694,18.918709826659082],[4.462573128646939,12.991509826659081],[12.93597312864694,4.487009826659081],[12.93597312864694,4.487009826659081]],"i":[[0,0],[-2.4969000000000037,0.21069999999999922],[-0.7383999999999986,-0.006499999999999062],[-1.2192000000000007,-0.24159999999999826],[-2.3474000000000004,-2.0764999999999993],[-0.5703999999999994,-4.665999999999999],[0.1069000000000031,-0.8652000000000015],[0.7169000000000025,-1.6781000000000006],[3.8826000000000036,-1.8943999999999974],[2.305399999999999,-0.2897999999999996],[0.8384999999999962,0.10540000000000305],[1.959500000000002,0.9364999999999952],[1.7158999999999978,4.0229],[0.23410000000000153,1.89
167000000000027],[-0.1062999999999974,0.8718999999999966],[-0.9031999999999982,1.8749000000000002],[-3.6567000000000007,1.7654000000000032],[0,0]],"o":[[2.1782000000000004,-1.051599999999997],[0.10379999999999967,-0.008800000000000807],[1.476700000000001,0.013000000000001677],[3.1370000000000005,0.6214000000000013],[3.5072999999999936,3.102499999999999],[0.10650000000000404,0.871299999999998],[-0.2336999999999989,1.8932000000000002],[-1.7093999999999951,4.000999999999998],[-2.0178999999999974,0.9846000000000004],[-0.8385999999999996,0.10540000000000305],[-2.2424999999999997,-0.28190000000000026],[-3.9177999999999997,-1.872400000000006],[-0.7177000000000007,-1.6826000000000008],[-0.10670000000000002,-0.8641000000000005],[0.26030000000000086,-2.134900000000002],[1.776600000000002,-3.687899999999999],[0,0],[0,0]]}}},{"ty":"fl","c":{"a":0,"k":[1,1,1],"ix":2},"o":{"a":0,"k":100,"ix":2},"r":1,"bm":0},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]},{"ty":"tr","p":{"a":0,"k":[40.000022888183594,35.97563934326172],"ix":2},"a":{"a":0,"k":[20.999986648559574,20.97563934326172],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]}],"ip":0,"op":301,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Circle","sr":1,"ks":{"p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}},"ao":0,"shapes":[{"ty":"gr","nm":"Circle","it":[{"ty":"el","d":1,"s":{"a":0,"k":[38,38],"ix":2},"p":{"a":0,"k":[0,0],"ix":2}},{"ty":"tm","s":{"a":0,"k":0,"ix":2},"e":{"a":1,"k":[{"t":0,"s":[0],"i":{"x":[0.3218390804597701],"y":[1]},"o":{"x":[0.7701149425287356],"y":[0]}},{"t":100,"s":[100],"i":{"x":[0.75],"y":[0.75]},"o":{"x":[0.25],"y":[0.25]}}],"ix":2},"o":{"a":0,"k":0,"ix":2},"m":1},{"ty":"st","c":{"a":0,"k":[0,0,0],"ix":2},"o":{"a":0,"k":100,"ix":2},"w":{"a":0,"k":2,"ix":2},"lc":2,"lj":1,"ml":4},{"ty":"fl","c":{"a":0,"k":[1,1,1],"ix":2},"o":{"a":0,"k":100,"ix":2},"r":1,"bm":0},{"ty":"tr","p":{"a":0,"k":[40.00000762939453,36.00000762939453],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]}],"ip":0,"op":301,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Path","sr":1,"ks":{"p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}},"ao":0,"shapes":[{"ty":"gr","nm":"Path","it":[{"ty":"sh","d":1,"ks":{"a":0,"k":{"c":true,"v":[[61.0747988211775,55.41971166405107],[59.7979988211775,11.126711664051072],[14.761698821177497,4.225711664051072],[0.969576821177498,33.34731166405107],[25.2970988211775,46.54451166405107],[61.0747988211775,55.41971166405107],[61.0747988211775,55.41971166405107]],"i":[[0,0],[13.934899999999999,16.3007],[15.311700000000002,-9.023769999999999],[-4.490437999999999,-13.897599999999997],[-9.975400000000002,-4.982500000000002],[-19.195500000000003,11.925500000000007],[0,0]],"o":[[16.674699999999994,-10.359299999999998],[-7.709299999999999,-9.01822],[-6.0564599999999995,3.5694],[4.646812000000001,14.381500000000003],[12.819899999999997,6.4033000000000015],[0,0],[0,0]]}}},{"ty":"fl","c":{"a":0,"k":[0.9058823529411765,0.9372549019607843,0.9803921568627451],"ix":2},"o":{"a":0,"k":100,"ix":2},"r":1,"bm":0},{"ty":"tr","p":{"a":0,"k":[38.999996185302734,36],"ix":2},"a":{"a":0,"k":[35.999983244277225,30.000005136630634],"ix":2},"s":{"a":1,"k":[{"t":33,"s":[49.99999999999996,49.99999999999998],"i":{"x":[0.2413793103448276],"y":[1.297290712203249]},"o":{"x":[0.6206896551724138],"y":[0.1379019158683882]}},{"t":130,"s":[100,100],"i":{"x":[0.75],"y":[0.75]},"o":{"x":[0.25],"y":[0.25]}}],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]}],"ip":0,"op":301,"st":0,"bm":0}],"markers":[]}'),ps={container:{display:"flex",flexDirection:"column",alignItems:"center"},heading:{textAlign:"center",width:"100%"},headingHeader:{fontWeight:600}},pc=e=>({transition:"transform ".concat(e,"ms ease-in-out, opacity ").concat(e,"ms ease-in-out")}),pu={entering:{transform:"translateY(-40px)",opacity:0}
1,entered:{transform:"translateY(0)",opacity:1}},pp={entering:{transform:"translateY(40px)",opacity:0},entered:{transform:"translateY(0)",opacity:1}},pm=e=>{var n,t,o,a,r,d,s;let{productName:c="Savings",timeout:u=750,numberOfAccounts:p,application:m,existingAccount:h,heading:v,subheading:g,text:f,animationType:y="booked",children:I}=e,{Player:A}=i(57417),b=p&&p>1,C=null==h||null==(n=h.product)?void 0:n.name,S=(null==h||null==(t=h.fields)?void 0:t.accountVariant)&&(null==h?void 0:h.product)?(0,eT.y)(h.product,null==h||null==(o=h.fields)?void 0:o.accountVariant):null,w=(null==S?void 0:S.overrideSecondaryOwnerRelationshipType)==="authorizedSigner",F=(0,r8.As)(null!=(d=null==m?void 0:m.rawFields)?d:{}),Y=(null==m?void 0:m.type)==="consumerDepositAddSecondaryOwner"&&!F&&!!h,T=null==h?void 0:h.userIsExistingAccountOwner,D=null!=(s=null==m||null==(r=m.fields)||null==(a=r.newAccountEntities)?void 0:a.length)?s:1,E=T?"New ".concat(D>1?"owners have":"owner has"," been added to the ").concat(C," account."):"You're now ".concat(w?"an Authorized Signer":"a Joint Owner"," on this ").concat(C," account."),k="Beneficiaries have been added".concat(C?" to the ".concat(C," account"):"","."),P=F?{heading:"Beneficiaries Added!",subHeading:"Success!",text:k}:{heading:Y?"Added to Account!":b?"Accounts Opened!":"Account Opened!",subHeading:T?"Success!":"Congratulations!",text:Y?E:b?"Your ".concat(p," accounts are open and ready to use."):"Your new".concat(c?" ".concat(c," "):"","account is open and ready to use.")};return(0,l.FD)("div",{css:ps.container,children:[(0,l.Y)(e$.Ay,{appear:!0,in:!0,timeout:0,children:e=>(0,l.Y)("div",{css:ps.heading,style:{...pc(u),...pu[e]},children:(0,l.Y)(np.A.H1,{css:ps.headingHeader,children:v||P.heading})})}),(0,l.Y)(A,{autoplay:!0,keepLastFrame:!0,src:"approved"===y?pd:pr,style:{height:"140px",margin:"40px auto 30px"}}),(0,l.Y)(e$.Ay,{appear:!0,in:!0,timeout:0,children:e=>(0,l.FD)("div",{css:ps.heading,style:{...pc(u),...pp[e]},children:[(0,l.Y)(ei.A,{theme:"xSmall",children:(0,l.Y)(x.A,{headingTag:"h2",heading:null!=g?g:P.subHeading,subheading:null!=f?f:P.text,theme:"small",isCentered:!0})}),I]})})]})};var ph=i(43331);let pv={container:e=>({display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - ".concat(e?oq.FDIC_HEIGHT_MOBILE:0,"px - 72px)"),justifyContent:"center"}),heading:{textAlign:"center",marginBottom:34},loader:{display:"inline-block",margin:"0 auto"}},pg={entering:{transform:"translateY(0)"},entered:{transform:"translateY(0)"},exiting:{transform:"translateY(40px)"},exited:{transform:"translateY(40px)"},unmounted:{transform:"translateY(40px)"}},pf={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0},exited:{opacity:0},unmounted:{opacity:0}},py=e=>{let{heading:n,steps:i=[],stepTimer:t,isComplete:o,onComplete:a,isBooked:r,productName:d,numberOfAccounts:s,application:c,existingAccount:u,skipSuccessSplash:p}=e,[m,h]=(0,v.useState)(!1),[g,f]=(0,v.useState)(!1),{isWrappedByAlkami:y}=(0,aj.Pk)(),{clientDetails:{clientType:I}}=(0,D.t)(),A="bank"===I&&!y;return(0,l.Y)(k.A,{theme:"centered",children:g&&!p?(0,l.Y)(pm,{productName:d,numberOfAccounts:s,application:c,existingAccount:u}):(0,l.Y)(e$.Ay,{appear:!0,in:!m,onExited:()=>f(!0),timeout:600,enter:!1,unmountOnExit:!0,children:e=>(0,l.FD)("div",{css:pv.container(A),style:{transition:"opacity ".concat(600,"ms ease-in-out"),opacity:1,...pf[e]},children:[(0,l.Y)("div",{css:pv.heading,...(0,ph.F)({isPrivate:!1}),children:(0,l.Y)(np.A.H1,{theme:"large",children:n})}),(0,l.Y)("div",{css:pv.loader,style:{transition:"transform ".concat(600,"ms ease-in-out"),transform:"translateY(0)",...pg[e]},children:(0,l.Y)(pa.A,{steps:i,stepTimer:t,isComplete:o,onComplete:a,showFollowup:r&&!p?h:null})})]})})})},pI=e=>(null==e?void 0:e.code)==="onboarding"||(null==e?void 0:e.code)==="enrollmentPreflow"||(null==e?void 0:e.code)==="newAccounts",pA=function(){var e;let{forceAutoBook:n,submitAppPromiseIsPending:i,pollingTimeout:t=45e3,pollingInterval:l=2e3,includeCardholders:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{application:a,refetchApplication:d,startPollingApplication:c,stopPollingApplication:p,userId:m}=(0,u.YY)({includeAccounts:!0,includeCardholders:o}),h=(()=>{var e;let{getView:n}=(0,u.YY)({includeAccounts:!0}),{config:{mantlFeatures:i}}=(0,s.UK)(),t=null==(e=i.alkami)?void 0:e.skipOnboarding,l=n();return t&&((null==l?void 0:l.code)===r.GX.code||(null==l?void 0:l.code)===r.QL.code)?r.qL:l})(),{config:{mantlFeatures:{accountOpening:{autoBookApprovedApplications:{enabled:g}}},experiences:{selfServe:{appSubmissionTimeoutSeconds:f}}}}=(0,s.UK)(),[y,I]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=setTimeout(()=>I(!0),f?1e3*f:t);return()=>{clearTimeout(e)}},[]);let[A,b]=(0,v.useState)(!1);(0,v.useEffect)(()=>{(!i||y)&&(async()=>{await d(),b(!0)})()},[i,y]);let C=h===r.jj,S=(null==a?void 0:a.executionStatus)==="externalProcessing",w=h===r.Es&&(g||!!n)&&!S,x=A&&!C&&!w;(0,v.useEffect)(()=>(!A||x||y||c(l),()=>{p()}),[A,x,y]);let F=x||y&&A,Y=null==a||null==(e=a.products)?void 0:e.map(e=>e.name).join(", ");return{application:a,userId:m,applicationPollingIsComplete:F,nextView:h,applicationIsBooked:(null==a?void 0:a.executionStatus)==="booked"&&(sC.w.includes(null==a?void 0:a.type)||!!(null==a?void 0:a.type)&&sC.p.includes(null==a?void 0:a.type)&&pI(h)),productName:Y,reviewStatus:null==a?void 0:a.reviewStatus,executionStatus:null==a?void 0:a.executionStatus,stopPollingApplication:p,startPollingApplication:c}};var pb=i(6669),pC=i(10305),pS=i(94445),pw=i(56017);let px=e=>{var n,i,t,o,a,r,d,s;let{application:c,calculatePaymentAmount:u,formInfoTooltipContent:p}=e,m=(0,ir.h9)(),{triggerMessage:h}=(0,f.d)(),{fields:g}=(0,T.d)(),[y,I]=(0,v.useState)(null),[A,b]=(0,v.useState)(null),[C,S]=(0,v.useState)(!1),w=(0,eS.qk)(c.rawFields),x=null==(n=c.products)?void 0:n.find(e=>"loan"===e.type),F=(null==x?void 0:x.loanType)==="lineOfCredit",Y="preOffer"===(0,q.ZM)(c)?{loanOfferAmountCents:null!=(i=null==w?void 0:w.preOfferLoanAmountCents)?i:"0",loanOfferInterestRate:null!=(t=null==w?void 0:w.preOfferLoanRate)?t:"0",loanOfferTermMonths:null!=(o=null==w?void 0:w.preOfferLoanTermMonths)?o:"0"}:{loanOfferAmountCents:null!=(a=null==w?void 0:w.offerLoanAmountCents)?a:"0",loanOfferInterestRate:null!=(r=null==w?void 0:w.offerLoanRate)?r:"0",loanOfferTermMonths:null!=(d=null==w?void 0:w.offerLoanTermMonths)?d:"0"},D=null!=(s=null==x?void 0:x.name)?s:"Home Equity Loan",E=F||!u||!Y.loanOfferInterestRate,k=(0,v.useMemo)(()=>({applicationId:c.id}),[c.id]),P=(0,v.useCallback)(async()=>
1{if(E){I(null),b(null);return}S(!0);try{var e;let n=await u({...k});if(!n){I(null),b(null);return}I(n.paymentAmount),b(null!=(e=n.totalClosingCosts)?e:null)}catch(e){h("Payment calculation failed. Please try again.",{theme:"error"}),I(null),b(null)}finally{S(!1)}},[u,E,k,h]),O=(0,v.useMemo)(()=>ej()(P,500),[P]);(0,v.useEffect)(()=>(O(),()=>{O.cancel()}),[u,Y.loanOfferTermMonths,Y.loanOfferInterestRate,c.id]);let R=ib({label:"Closing Costs",modalControl:m,showIcon:!0}),L=[["Amount",(0,eN.CQ)(Y.loanOfferAmountCents)],["Interest Rate",(null==w?void 0:w.loanRateType)==="fixed"?"".concat(null==w?void 0:w.preOfferLoanRate,"% (Fixed)"):(null==w?void 0:w.loanRateType)==="variable"?"".concat(null==w?void 0:w.preOfferLoanRate,"% (Variable)"):"".concat(null==w?void 0:w.preOfferLoanRate,"%")],["Repayment Term",Y.loanOfferTermMonths?"".concat(new ew.A(Y.loanOfferTermMonths).div(12).toString()," years (").concat(Y.loanOfferTermMonths," months)"):"N/A"],...F?[]:[["Monthly Payment",C?(0,l.Y)(ny.A,{size:"small"}):y?(0,eN.CQ)(y):"N/A"],[R,C?(0,l.Y)(ny.A,{size:"small"}):A?(0,eN.CQ)(A):"$0"],["Estimated Cash To Close",(()=>{if(C)return(0,l.Y)(ny.A,{size:"small"});let e=new ew.A(Y.loanOfferAmountCents).minus(null!=A?A:0),n=e.gt(0);return"".concat((0,eN.CQ)(e.toFixed(0))," ").concat(n?"(Paid to You)":"(Paid to Lender)")})()]]];return(0,l.FD)(l.FK,{children:[(0,l.Y)(e3,{title:D,subheading:ig(w,g),details:L}),(0,l.Y)(nh.A,{isOpen:m.modalIsOpen,onClose:m.closeModal,onClickAway:m.closeModal,canClose:!1,children:(0,l.Y)(iy,{header:null!=p?p:"Closing costs are the administrative and legal fees required to process your loan and secure it against your home’s equity. They cover tasks like the property valuation, credit report, and recording the new lien with the county.",onClick:m.closeModal})})]})},pF=e=>{var n,i,t,o,a;let{application:r,isLoading:d,handleAcceptOffer:s,handleDeclineOffer:c,handleEditAutopay:u,handleEditCoverageOptions:p,calculatePaymentAmount:m,agreements:h,dynamicAgreements:g}=e,{experiences:{selfServe:{pages:{offerAcceptance:{productId:f,formInfoText:A,formInfoTooltip:b,headerText:C,subheaderText:S}={}}}}}=(0,D.t)(),[F,Y]=(0,v.useState)(!1),T=null!=(a=(0,eL.FF)("LOAN-1148-addons-to-preoffer"))&&a,E=(0,eS.qk)(r.rawFields),P=null==(n=r.products)?void 0:n.find(e=>"loan"===e.type),O=(null==P?void 0:P.id)&&(null==f?void 0:f[null==P?void 0:P.id])?null==f?void 0:f[null==P?void 0:P.id]:null,R=(null==E?void 0:E.purposeOfLoan)==="refinance",L=(null==E?void 0:E.offerLoanAmountCents)||"0",N={account:null!=E?E:{},application:r,organizationKycEvaluationTags:null==r?void 0:r.organizationKycEvaluationTags,personKycEvaluationTags:null==r?void 0:r.personKycEvaluationTags},{fields:B}=(0,I.wD)(N),M=B.desiredLoanAmountCents,z=M&&"validationOptions"in M&&(null==M?void 0:M.validationOptions)&&"minValue"in M.validationOptions&&(null==M||null==(i=M.validationOptions)?void 0:i.minValue),V=null==P?void 0:P.allowPreApproval,_=(null==P?void 0:P.loanType)==="posDirectUnderwriting"||V&&(null==P?void 0:P.externalClosing),U=!!(null==P||null==(t=P.addOns)?void 0:t.length),q=!!(R||(null==P?void 0:P.lockOfferLoanAmount)),H=!!(null==P||null==(o=P.offerUnderwritingAgreements)?void 0:o.length),K="You qualify for a ".concat(null==P?void 0:P.type," up to ").concat((0,eN.CQ)(L)),j=H&&(!!(null==h?void 0:h.length)||!!(null==g?void 0:g.length));return(0,l.Y)(k.A,{children:(0,l.FD)(y.A,{onSubmit:s,initialValues:{acceptedLoanAmountCents:q?L:Math.min(new ew.A((null==E?void 0:E.desiredLoanAmountCents)==="0"||!(null==E?void 0:E.desiredLoanAmountCents)?L:(null==E?void 0:E.desiredLoanAmountCents)||L).toNumber(),new ew.A(L).toNumber()).toString()},children:[(0,l.Y)(x.A,{heading:(null==O?void 0:O.headerText)?null==O?void 0:O.headerText:C||(_?"You're Pre-Qualified for a Loan!":"You're Approved for a Loan!"),data:{offerLoanAmountCents:(0,eN.CQ)(L)},subheading:(null==O?void 0:O.subheaderText)?null==O?void 0:O.subheaderText:S||K}),(0,l.FD)(I.Ay,{...N,children:[!q&&(0,l.Y)(nv.A.CurrencyInput,{name:"acceptedLoanAmountCents",label:"Loan amount (Max: ".concat((0,eN.CQ)(L),")"),validate:{required:!0,maxAmount:L,minAmount:z}}),H?(0,l.Y)(ei.A,{children:(0,l.Y)(px,{application:r,calculatePaymentAmount:m,formInfoTooltipContent:null!=b?b:void 0})}):(0,l.Y)(ei.A,{children:(0,l.Y)(iC,{application:r,onEditAutopay:u,useOfferLoanAmount:q,calculatePaymentAmount:m})}),j&&(0,l.Y)(nZ,{application:r,agreements:null!=h?h:[],dynamicAgreements:null!=g?g:[],attestations:[],headerCopy:"Review Closing Disclosure",enableClickToSign:!1,hideViewByAccountUi:!0})]}),(0,l.FD)("section",{css:{display:"flex",flexDirection:"column",gap:"1rem",marginBottom:"1.5rem"},children:[U&&!T&&(0,l.Y)(w.A,{isFull:!0,theme:"white",onClick:p,children:"Edit Coverage Options"}),(0,l.Y)(w.A,{isFull:!0,isLoading:d,type:"submit",children:"Accept Offer"}),(0,l.Y)(w.A,{isFull:!0,theme:"outline",onClick:()=>Y(!0),children:"Decline Offer"})]}),A?(0,l.Y)(Z.A,{icon:"info-circle",content:A,tooltipIcon:b?"info-circle":null,tooltipContent:b}):null,(0,l.Y)(i9.A,{isOpen:F,buttonText:"Yes, Decline Loan Offer",onConfirm:()=>c(),heading:"Decline Loan Offer",subheading:"Are you sure that you want to decline this offer?",onClose:()=>Y(!1),onCancel:()=>Y(!1),onClickAway:()=>Y(!1),icon:"cancel",isLoading:d})]})})},pY=e=>{let{onSubmit:n,onSelectHandoff:i,isUploading:t,onDelete:o,isDeleting:a,entityType:r,application:d}=e;return(0,l.FD)(l.FK,{children:[(0,l.Y)(oi,{application:d,verificationRequirement:"proofOfAccountOpeningAuthority",entityType:r,heading:"Have authority to open this account?",subheading:"If you have account-opening authority as a significant party, you can upload a document that attests to this.",onSubmit:n,isUploading:t,onDelete:o,isDeleting:a}),(0,l.Y)(k.A,{children:(0,l.Y)(ei.A,{children:(0,l.Y)(w.A,{isFull:!0,onClick:i,theme:"outline",children:"Hand Off"})})})]})};var pT=i(88883);let pD={container:e=>{let{colors:n,animations:i}=e;return{position:"relative",border:"1px solid ".concat(n.grey3),padding:0,marginBottom:8,width:"100%",borderRadius:8,background:n.white,transition:"background-color ".concat(i.speeds.default,", border ").concat(i.speeds.default),"&:last-child":{marginBottom:0}}},flatRow:e=>{let{breakpoints:n}=e;return{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",[n.small]:{padding:"16px",minHeight:67}}},accountInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0,paddingRight:"1rem",textAlign:"left"},accountName:e=>{let{colors:n,fontScales:i}=e;return{...i.default,fontWeight:600,color:n.grey1,marginBottom:2}},accountDescription:e=>{let{colors:n,fontScales:i}=e;return{...i.small,color:n.grey2}},accountHeader:{padding:"12px 16px 0"},serviceRow:e=>{let{colors:n}=e;return{display:"flex",alignItems:"center",justifyContent:"space-between",margin:"12px 16px",padding:"12px 16px",border:"1px solid ".concat(n.grey3),borderRadius:8,background:n.white,minHeight:48}},serviceLeft:{display:"flex",flexDirection:"column",flex:1,minWidth:0},serviceName:e=>{let{colors:n,fontScales:i}=e;return{...i.small,fontWeight:600,color:n.grey1}},serviceStatus:{display:"flex",alignItems:"center",gap:6,marginTop:4},serviceDate:e=>{let{colors:n,fontScales:i}=e;return{...i.small,color:n.grey2}}},pE=e=>{var n;let{accountNameDisplay:i,accountDescription:t,service:o,ioi:a,onRequestIoi:r}
1=e,d=null!=(n=null==a?void 0:a.status)?n:null,s=aW({status:d,type:o.type}),c="overdraftProtection"===o.type?"Enable":"Request",u=!!d&&"failed"!==d,p=(null==a?void 0:a.createdAt)&&(0,eY.wV)(a.createdAt,{dateFormat:eY.Kn.LONG_MONTH_DAY_YEAR});return u?(0,l.FD)("div",{css:pD.container,children:[(0,l.FD)("div",{css:pD.accountHeader,children:[(0,l.Y)("div",{css:pD.accountName,children:i}),t&&(0,l.Y)("div",{css:pD.accountDescription,children:t})]}),(0,l.Y)("div",{css:pD.serviceRow,children:(0,l.FD)("div",{css:pD.serviceLeft,children:[(0,l.Y)("div",{css:pD.serviceName,children:o.name}),s&&(0,l.FD)("div",{css:pD.serviceStatus,children:[(0,l.Y)(n7.A,{theme:s.theme,children:s.text}),p&&(0,l.FD)("span",{css:pD.serviceDate,children:["on ",p]})]})]})})]}):(0,l.Y)("div",{css:pD.container,children:(0,l.FD)("div",{css:pD.flatRow,children:[(0,l.FD)("div",{css:pD.accountInfo,children:[(0,l.Y)("div",{css:pD.accountName,children:i}),t&&(0,l.Y)("div",{css:pD.accountDescription,children:t})]}),(0,l.Y)(w.A,{onClick:r,theme:"primary",size:"small",children:c})]})})},pk={accountName:e=>{let{colors:n,fontScales:i}=e;return{...i.default,fontWeight:600,color:n.grey1}},collapsibleContent:{display:"flex",flexDirection:"column",gap:16},personSection:{display:"flex",flexDirection:"column",gap:8},personName:e=>{let{colors:n,fontScales:i}=e;return{...i.small,color:n.grey2}}},pP=e=>{let{accountNameDisplay:n,accountDescription:i,accountReferenceId:t,service:o,cardHolders:a,indicationsOfInterest:r,defaultOpen:d=!1,onRequest:s,onRemove:c}=e,u=(0,l.Y)("div",{css:pk.collapsibleContent,children:a.map(e=>{var n,i;let a=null!=(i=null!=(n=e.personId)?n:e.id)?i:"",d=[e.firstName,e.lastName].filter(Boolean).join(" ")||"Account Holder",u=(e=>{var n;let i=null!=(n=e.personId)?n:e.id;return r.find(e=>e.serviceId===o.id&&e.accountReferenceId===t&&e.personId===i)})(e),p=u&&c&&"pending"===u.status&&!o.automated?()=>c(u,e):void 0;return(0,l.FD)("div",{css:pk.personSection,"data-testid":"".concat(o.name,"-").concat(a),children:[(0,l.Y)("div",{css:pk.personName,children:d}),(0,l.Y)(aQ,{displayName:o.name,status:null==u?void 0:u.status,updatedAt:null==u?void 0:u.updatedAt,onRequest:u?void 0:()=>s(e),onRemove:p,theme:"inCollapsible",isPromoted:!0})]},a)})});return(0,l.Y)(V.A,{title:(0,l.Y)("span",{css:pk.accountName,children:n}),description:i,collapsibleContent:u,collapsibleDefaultOpen:d})},pO=e=>{let{cardHolders:n,serviceId:i,accountReferenceId:t,indicationsOfInterest:l}=e;return n.filter(e=>!!(e=>{var n;let o=null!=(n=e.personId)?n:e.id;return l.find(e=>e.serviceId===i&&e.accountReferenceId===t&&e.personId===o)})(e)||(e=>{var n;return(null!=(n=e.eligibleCardServices)?n:[]).some(e=>null!==e&&e.id===i)})(e))},pR={serviceContainer:{marginBottom:"32px","&:last-child":{marginBottom:0}},serviceHeader:{marginBottom:"16px"},serviceTitle:e=>{let{fontScales:n}=e;return{...n.medium,fontWeight:700,marginBottom:"0.25rem"}},serviceDescription:e=>{let{colors:n,fontScales:i}=e;return{...i.small,color:n.grey2}},accountsContainer:{marginTop:"16px",marginBottom:"16px"}},pL=e=>{let{service:n,accounts:i,indicationsOfInterest:t,cardHoldersByAccountReferenceId:o,defaultOpen:a,onRequestIndicationOfInterest:r}=e;if(0===i.length)return null;let d=nr.K4.includes(n.type);return d&&o&&!i.some(e=>{var i;if(!e.referenceId)return!1;let l=null!=(i=o.get(e.referenceId))?i:[];return 0!==l.length&&pO({cardHolders:l,serviceId:n.id,accountReferenceId:e.referenceId,indicationsOfInterest:t}).length>0})?null:(0,l.Y)(ei.A,{theme:"xSmall",children:(0,l.FD)("div",{css:pR.serviceContainer,"data-testid":"".concat(n.name,"--service-section"),children:[(0,l.FD)("div",{css:pR.serviceHeader,children:[(0,l.Y)("div",{css:pR.serviceTitle,children:n.name}),n.description&&(0,l.Y)("div",{css:pR.serviceDescription,children:(0,l.Y)(e6.A,{source:n.description})})]}),(0,l.Y)("div",{css:pR.accountsContainer,children:i.map(e=>{var i;let{accountNameDisplay:s,accountDescription:c}=(e=>{let n=e.maskedAccountNumber||e.number,i=n?"****".concat(n.slice(-4)):null;return{accountNameDisplay:e.productName?i?"".concat(e.productName," ").concat(i):e.productName:e.accountName||"Account",accountDescription:e.accountName?e.accountName:void 0}})(e),u=o&&e.referenceId&&null!=(i=o.get(e.referenceId))?i:[];if(d&&0===u.length)return null;let p=d&&e.referenceId?pO({cardHolders:u,serviceId:n.id,accountReferenceId:e.referenceId,indicationsOfInterest:t}):[];return d&&0===p.length?null:d&&p.length>0?(0,l.Y)(pP,{accountNameDisplay:s,accountDescription:c,accountReferenceId:e.referenceId,service:n,cardHolders:p,indicationsOfInterest:t,defaultOpen:a,onRequest:i=>((e,i)=>{var t;let l=null!=(t=i.personId)?t:i.id,o=n.confirmation||"".concat(i.firstName?"".concat(i.firstName,"'s"):"Your"," card has been requested.");r({ioiRequestData:{type:n.type,serviceId:n.id,...e.referenceId&&{accountReferenceId:e.referenceId},...l&&{personId:l}
1,...["debitCard","atmCard"].includes(n.type)&&{cardFulfillmentType:"mail"}},successMessage:o})})(e,i)},e.referenceId||e.productId):(0,l.Y)(pE,{accountNameDisplay:s,accountDescription:c,service:n,ioi:(e=>{var i;return null!=(i=((e,n,i)=>{if(n)return i.find(i=>i.accountReferenceId===e&&i.serviceId===n)})(e.referenceId,n.id,t))?i:null})(e),onRequestIoi:()=>(e=>{let i=n.confirmation||"Your service has been requested.";r({ioiRequestData:{type:n.type,serviceId:n.id,...e.referenceId&&{accountReferenceId:e.referenceId}},successMessage:i})})(e)},e.referenceId||e.productId)})})]})})},pN={contentHeaderGroup:{display:"flex",alignItems:"center",marginBottom:"1.75rem"},contentHeaderGroupIcon:{marginRight:"1rem"},infoBox:{marginBottom:"2rem"},buttonContainer:{marginTop:"2.5rem"},triggerAnimation:{"&.enter":{opacity:0,minHeight:0,maxHeight:0,overflow:"hidden"},"&.enter-active":{opacity:1,minHeight:0,maxHeight:"150px",overflow:"hidden",transition:"opacity 300ms linear, max-height 250ms cubic-bezier(.47,1.64,.41,.8)"},"&.exit":{opacity:1,minHeight:0,maxHeight:"150px",overflow:"hidden"},"&.exit-active":{opacity:0,minHeight:0,maxHeight:0,overflow:"hidden",margin:0,transition:"opacity 175ms 125ms linear, max-height 100ms 225ms cubic-bezier(.47,1.64,.41,.8), margin 100ms 225ms linear"}}},pB=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return{transition:"transform ".concat(e,"ms ease-in-out").concat(n?" ".concat(n,"ms"):"",", opacity ").concat(e,"ms ease-in-out").concat(n?" ".concat(n,"ms"):"")}},pM={entering:{opacity:0},entered:{opacity:1},exiting:{opacity:0},exited:{opacity:0},unmounted:{opacity:0}},pz=e=>{var n,i,t,o,a;let{application:r,userId:d,accountsAreOpened:s,indicationsOfInterest:c,allAccountIndicationsOfInterest:u,product:p,services:m,bulkEligibleServices:h,cardHolders:g=[],cardHoldersByAccountReferenceId:y,onRequestIndicationOfInterest:I,onContinue:A}=e,[b,C]=(0,v.useState)(!1),[S,F]=(0,v.useState)(!0),{experiences:{selfServe:{pages:{promotedServices:Y}}}}=(0,D.t)(),{triggerMessage:T}=(0,f.d)(),{headerText:E,subheaderText:P,formInfoText:O,formInfoTooltip:R}=null!=Y?Y:{},L=pT.A.rawSpeeds.slow,N=!!(null==h||null==(n=h.promotedServices)?void 0:n.length)&&h.serviceToAccountsMap.size>0,B=N?[]:g.map(e=>{var n;return{...e,eligibleCardServices:null==e||null==(n=e.eligibleCardServices)?void 0:n.filter(e=>null==e?void 0:e.promoted)}}),M=u.some(e=>(null==e?void 0:e.serviceId)&&m.map(e=>e.id).includes(null==e?void 0:e.serviceId)),z=null==r||null==(i=r.accounts)?void 0:i.find(e=>{var n;return e.id===(null==(n=r.fields)?void 0:n.accountId)}),_=(null==r||null==(o=r.fields)||null==(t=o.ownership)?void 0:t.type)==="jointAdult",U=e=>{let{formattedService:n,ioiRequestData:i,successMessage:t}=e;if(i)I({ioiRequestData:i,successMessage:null!=t?t:"Your service has been requested."});else{let{id:e,type:i}=null!=n?n:{};if(!e||!i)return void T("There was an error requesting this service.");let t=m.find(n=>n.id===e);I({ioiRequestData:{type:i,serviceId:e},successMessage:(null==t?void 0:t.confirmation)?null==t?void 0:t.confirmation:"Your service has been requested."})}},q=()=>{F(!1)},H=ra(ro({indicationsOfInterest:c,eligibleServices:m,cardHolders:B,onRequest:U,isJointAdultApplication:_,userId:null!=d?d:"",persons:null!=(a=null==r?void 0:r.persons)?a:[],applicationId:null==r?void 0:r.id})),K=Array.from((e=>{var n,i;let t=new Map,l=null==e||null==(n=e.fields)?void 0:n.accounts,o=null==e?void 0:e.products,a=null==e||null==(i=e.fields)?void 0:i.createdAccounts;return null==l||l.forEach(e=>{var n;if(!e.referenceId)return;let i=null==o?void 0:o.find(n=>n.id===e.productId);t.set(e.referenceId,{referenceId:e.referenceId,productId:e.productId,productName:null==i?void 0:i.name,accountName:null!=(n=e.accountName)?n:void 0})}),null==a||a.forEach(e=>{var n,i;let l=null!=(n=null==e?void 0:e.referenceId)?n:void 0;if(!l)return;let o=null!=(i=t.get(l))?i:{};t.set(l,{...o,referenceId:l,...void 0!==e.number&&null!==e.number&&{number:e.number},...void 0!==e.maskedAccountNumber&&null!==e.maskedAccountNumber&&{maskedAccountNumber:e.maskedAccountNumber}})}),t})(r).values());return(0,l.Y)(l.FK,{children:b?(0,l.Y)(k.A,{theme:"centered",children:(0,l.Y)(pm,{productName:null==p?void 0:p.name,timeout:L,application:r,existingAccount:z})}):(0,l.Y)(e$.Ay,{appear:!0,in:S,timeout:750*!S,onExited:()=>{s&&C(!0),setTimeout(()=>{A()},s?L+1750:L)},unmountOnExit:!0,children:e=>(0,l.Y)(k.A,{children:(0,l.FD)("div",{style:{...pB(750),...pM[e]},children:[(0,l.Y)(ei.A,{theme:"xSmall",children:(0,l.FD)("div",{css:pN.contentHeaderGroup,children:[(0,l.Y)(eH.A,{name:"illustration-card",size:"xlarge",brandColor:"primaryLight",css:pN.contentHeaderGroupIcon}),(0,l.Y)(x.A,{heading:null!=E?E:"Get more out of your Account",subheading:null!=P?P:"Take advantage of these options and services",theme:"medium",productId:null==p?void 0:p.id})]})}),(0,l.Y)(ei.A,{theme:"xSmall",children:N?h.promotedServices.map(e=>{var n;let i=null!=(n=h.serviceToAccountsMap.get(e.id))?n:[],t=K.filter(e=>e.referenceId&&i.includes(e.referenceId)),o=nr.K4.includes(e.type)&&y?t.filter(e=>{var n;return e.referenceId&&(null!=(n=y.get(e.referenceId))?n:[]).length>0}):t;return 0===o.length?null:(0,l.Y)(pL,{service:e,accounts:o,defaultOpen:!0,indicationsOfInterest:u,cardHoldersByAccountReferenceId:y,onRequestIndicationOfInterest:I},e.id)}):(0,l.Y)(aV.A,{component:"div",children:H.map(e=>{var n;let i=aW({status:e.status,type:e.type}),t="overdraftProtection"===e.type?"Enable":"Request";return(0,l.Y)(a_.A,{timeout:L,css:pN.triggerAnimation,children:(0,l.Y)(V.A,{"aria-label":e.title,icon:e.icon,title:e.title,de
1scription:e.collapsibleContent?void 0:e.description,tag:i,size:"large",onClick:e.status?void 0:()=>U({formattedService:e}),collapsibleContent:null!=(n=e.collapsibleContent)?n:void 0,collapsibleDefaultOpen:!!e.collapsibleContent,buttonText:e.status||e.collapsibleContent?void 0:t,hideArrow:!e.collapsibleContent,tabIndex:0})},e.id)})})}),O?(0,l.Y)("div",{css:pN.infoBox,children:(0,l.Y)(Z.A,{icon:"info-circle",content:O,tooltipIcon:R?"info-circle":null,tooltipContent:R})}):null,(0,l.Y)("div",{css:pN.buttonContainer,children:(0,l.Y)(w.A,{isFull:!0,theme:"outline",onClick:q,children:M?"Continue":"Skip"})})]})})})})},pV={container:{display:"flex",flexDirection:"column",alignItems:"center"},heading:{textAlign:"center"},headingHeader:{fontWeight:600},waitingIcon:{marginTop:"2.25rem",marginBottom:"1.5rem",height:"7rem",width:"7rem"},spinner:{marginTop:"2rem",opacity:0}},p_=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return{transition:"transform ".concat(e,"ms ease-in-out").concat(n?" ".concat(n,"ms"):"",", opacity ").concat(e,"ms ease-in-out").concat(n?" ".concat(n,"ms"):"")}},pU={entering:{transform:"translateY(-40px)",opacity:0},entered:{transform:"translateY(0)",opacity:1}},pq={entering:{transform:"translateY(40px)",opacity:0},entered:{transform:"translateY(0)",opacity:1}},pH={entering:{opacity:0},entered:{opacity:1}},pK={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0},exited:{opacity:0},unmounted:{opacity:0}},pj=e=>{let{productName:n,accountIsOpened:i,accountIsPending:t,onPollingComplete:o,numberOfAccounts:a,existingAccount:r}=e,[d,s]=(0,v.useState)(!1),c=a&&a>1;return(0,l.Y)(k.A,{theme:"centered",children:d?(0,l.Y)(pm,{productName:n,timeout:750,numberOfAccounts:a,existingAccount:r}):(0,l.Y)(e$.Ay,{appear:!0,in:!i&&!t,onExited:()=>{i&&setTimeout(()=>{s(!0)},250),setTimeout(()=>{o()},i?2550:750)},timeout:0,enter:!1,unmountOnExit:!0,children:e=>(0,l.FD)("div",{css:pV.container,style:{...p_(600),...pK[e]},children:[(0,l.Y)(e$.Ay,{appear:!0,in:!0,timeout:0,children:e=>(0,l.Y)("div",{css:pV.heading,style:{...p_(750),...pU[e]},children:(0,l.Y)(np.A.H1,{css:pV.headingHeader,children:"Opening Your Account".concat(c?"s":"")})})}),(0,l.Y)(e$.Ay,{appear:!0,in:!0,timeout:0,children:e=>(0,l.Y)("div",{css:pV.waitingIcon,style:{...p_(750,250),...pH[e]},children:(0,l.Y)(eH.A,{name:"illustration-waiting",size:"fill",brandColor:"primaryLight"})})}),(0,l.Y)(e$.Ay,{appear:!0,in:!0,timeout:0,children:e=>(0,l.Y)("div",{css:pV.heading,style:{...p_(750),...pq[e]},children:(0,l.Y)(x.A,{headingTag:"h2",heading:"Please wait...",subheading:"Hang tight while we get your new account".concat(c?"s":""," opened. This will just take a moment."),theme:"small",isCentered:!0})})}),(0,l.Y)(e$.Ay,{appear:!0,in:!0,timeout:0,children:e=>(0,l.Y)("div",{css:pV.spinner,style:{...p_(750,750),...pH[e]},children:(0,l.Y)(ny.A,{size:"large"})})})]})})})};var pW=i(75062);let pG={container:{display:"block",cursor:"pointer",marginBottom:"1rem"},disabledContainer:{cursor:"not-allowed"},headerRow:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:16},planLabel:e=>{let{fontScales:n,colors:i}=e;return{...n.default,fontWeight:700,color:i.grey7}},beneficiarySectionHeader:e=>{let{fontScales:n,colors:i}=e;return{fontWeight:500,color:i.blue8,...n.small,marginTop:"1rem","&:first-of-type":{marginTop:"0.5rem"}}},beneficiaries:{marginTop:8,display:"flex",flexDirection:"column",gap:8},beneficiaryBox:e=>{let{colors:n}=e;return{background:n.grey4,borderRadius:8,padding:"16px 12px 16px 16px",display:"flex",alignItems:"center",justifyContent:"space-between",gap:16}},beneficiaryName:e=>{let{colors:n,fontScales:i}=e;return{...i.small,fontWeight:700,color:n.grey7}},beneficiaryPercentage:e=>{let{colors:n,fontScales:i}=e;return{...i.small,color:n.grey2}}},p$=e=>{var n,i,t,o,a;let{plan:r,onSelect:d,isActive:s,planLabel:c,isLoading:u}=e,p="Select ".concat(c),m=null==r||null==(i=r.fields)||null==(n=i.beneficiaries)?void 0:n.filter(e=>!(null==e?void 0:e.contingent)),h=null==r||null==(o=r.fields)||null==(t=o.beneficiaries)?void 0:t.filter(e=>!!(null==e?void 0:e.contingent)),v=(e,n)=>(0,l.Y)("div",{css:pG.beneficiaries,children:e.map((e,i)=>(0,l.FD)("div",{css:pG.beneficiaryBox,children:[(0,l.Y)("p",{css:pG.beneficiaryName,children:(e=>(null==e?void 0:e.firstName)&&(null==e?void 0:e.lastName)?"".concat(e.firstName," ").concat(e.lastName):(null==e?void 0:e.legalName)?e.legalName:"")(e)}),(0,l.FD)("p",{css:pG.beneficiaryPercentage,children:["".concat(e.percentage),"%"]})]},"".concat(n).concat(i)))});return(0,l.Y)("label",{css:[pG.container,u&&pG.disabledContainer],"aria-checked":s,children:(0,l.FD)(eU.A,{isActive:s,children:[(0,l.FD)("div",{css:pG.headerRow,children:[(0,l.Y)("p",{css:pG.planLabel,children:c}),(0,l.Y)(pW.A,{name:"planSelection",value:null!=(a=null==r?void 0:r.id)?a:"",isChecked:s,isDisabled:u,onSelect:d,ariaLabel:p})]}),(0,l.FD)("div",{children:[!(null==m?void 0:m.length)&&!(null==h?void 0:h.length)&&(0,l.Y)("p",{css:pG.beneficiarySectionHeader,children:"No Beneficiaries Allocated"}),!!(null==m?void 0:m.length)&&(0,l.FD)(l.FK,{children:[(0,l.Y)("p",{css:pG.beneficiarySectionHeader,children:"Primary Beneficiaries"}),v(m,"primary")]}),!!(null==h?void 0:h.length)&&(0,l.FD)(l.FK,{children:[(0,l.Y)("p",{css:pG.beneficiarySectionHeader,children:"Contingent Beneficiaries"}),v(h,"contingent")]})]})]})})},pQ="NEW_PLAN",pJ={container:{display:"block",cursor:"pointer",marginBottom:"1rem"},disabledContainer:{cursor:"not-allowed"},planLabel:e=>{let{fontScales:n,colors:i}=e;return{...n.default,fontWeight:700,color:i.grey7}},headerRow:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",ga
1p:16},newPlanDescription:e=>{let{fontScales:n,colors:i}=e;return{...n.small,color:i.grey7,marginTop:"0.5rem"}}},pZ=e=>{let{plans:n,isLoading:i,onSubmit:t,planLabel:o,canCreateNewPlan:a}=e,[r,d]=(0,v.useState)("");return(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{heading:"Select Beneficiary Plan",subheading:"Select a beneficiary arrangement to be associated with this new account."}),n.map(e=>{var n;return(0,l.Y)(p$,{plan:e,onSelect:()=>d(e.id),isActive:r===e.id,planLabel:(null==e||null==(n=e.fields)?void 0:n.label)||o,isLoading:i},e.id)}),a&&(0,l.Y)("label",{css:[pJ.container,i&&pJ.disabledContainer],"aria-checked":r===pQ,children:(0,l.Y)(eU.A,{isActive:r===pQ,children:(0,l.FD)("div",{css:pJ.headerRow,children:[(0,l.FD)("div",{children:[(0,l.Y)("p",{css:pJ.planLabel,children:"Create a New Plan"}),(0,l.Y)("p",{css:pJ.newPlanDescription,children:"You'll be prompted to add beneficiaries"})]}),(0,l.Y)(pW.A,{name:"planSelection",value:pQ,isChecked:r===pQ,isDisabled:i,onSelect:()=>d(pQ),ariaLabel:"Create a new plan"})]})})}),(0,l.Y)(w.A,{isFull:!0,isDisabled:!r,isLoading:i,onClick:()=>t(r),children:"Next"})]})};var pX=i(97595),p0=i(44119);let p9=e=>{var n,i,t,o;let{application:a,children:r,namePrefix:d,collateralType:s,primaryCollateralType:c,isUsed:u,productType:p,lockedCollateralType:m,fundingSources:h,isLoadingFundingSources:v,showSameAddressAsPrimaryCheckbox:g=!1,shouldUsePrimaryAddress:f=!1,setShouldUsePrimaryAddress:y,primaryPersonAddress:I}=e,A=(0,eS.qk)(a.rawFields),b=(e=>{let{accountInfo:n,closingStatus:i,preOfferStatus:t,offerStatus:l,purposeOfLoan:o,collateral:a,primaryCollateralType:r}=e,{type:d,isUsed:s,productType:c}=a,u=[];return n.forEach(e=>{let{productId:n,accountVariant:i}=e;u.push("product:".concat(n)),i&&u.push("accountVariant:".concat(i))}),i&&["manualReviewRequired","incomplete"].includes(i)&&u.push("loanStatus:closing"),t&&["approved","incomplete","complete"].includes(t)&&u.push("loanStatus:preOfferApproved"),"manualReviewRequired"===t&&u.push("loanStatus:preOffer"),"incomplete"===l&&u.push("loanStatus:offerUnderwriting"),o&&u.push("purposeOfLoan:".concat(o)),d&&u.push("collateralType:".concat(d)),r&&u.push("primaryCollateralType:".concat(r)),s&&u.push("isUsedVehicle"),c&&u.push("productType:".concat(c)),u})({accountInfo:(0,ne.SP)(null==a?void 0:a.rawFields),closingStatus:null!=(n=a.closingStatus)?n:null,preOfferStatus:null!=(i=a.preOfferStatus)?i:null,offerStatus:null!=(t=a.offerStatus)?t:null,purposeOfLoan:null!=(o=null==A?void 0:A.purposeOfLoan)?o:null,collateral:{type:s,isUsed:u,productType:p},primaryCollateralType:c}),C=(0,nn.A)({entityType:"collateral",namePrefix:d,scopes:b});return m&&C.fields.type&&(C.fields.type.type="hidden"),(0,l.Y)(p0.A,{application:a,fundingSources:h,isLoading:v,children:(0,l.Y)(T.A,{...C,namePrefix:d,showSameAddressAsPrimaryCheckbox:g,shouldUsePrimaryAddress:f,setShouldUsePrimaryAddress:y,primaryPersonAddress:I,children:r})})},p1=e=>{var n,i,t;let{application:o,fundingSources:a,isLoadingFundingSources:r,namePrefix:d,primaryCollateralType:s,lockedCollateralType:c}=e,{formState:{submitCount:u,isSubmitting:p,isValid:m,isSubmitSuccessful:h},watch:g,setValue:f}=(0,S.xW)();(0,v.useEffect)(()=>{c&&!g("".concat(d,".type"))&&f("".concat(d,".type"),c)},[c,d,f]),(0,F.A)({submitCount:h||p?null:u,isValid:m,message:"Please fix missing or invalid fields before continuing."});let y=null!=(t=g("".concat(d,".type")))?t:c,I=g("".concat(d,".isPrimaryCollateral")),A=g("".concat(d,".isUsed")),b="home"===y,C=(0,eS.qk)(o.rawFields),w=null==C||null==(n=C.newAccountRelationshipD
1ata)?void 0:n.find(e=>e.isPrimaryEntity&&"personId"in e),x=w&&"personId"in w?null==(i=o.persons)?void 0:i.find(e=>e.id===w.personId):null,Y=!!(null==x?void 0:x.addressPrimaryLine1)&&b,[T,D]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{D(Y)},[Y]),(0,l.Y)(iG.A,{children:(0,l.Y)(p9,{application:o,collateralType:y,primaryCollateralType:s,lockedCollateralType:c,isUsed:A,fundingSources:a,isLoadingFundingSources:r,showSameAddressAsPrimaryCheckbox:b,shouldUsePrimaryAddress:T,setShouldUsePrimaryAddress:D,namePrefix:d,primaryPersonAddress:Y?{addressPrimaryLine1:null==x?void 0:x.addressPrimaryLine1,addressPrimaryLine2:null==x?void 0:x.addressPrimaryLine2,addressPrimaryCity:null==x?void 0:x.addressPrimaryCity,addressPrimaryState:null==x?void 0:x.addressPrimaryState,addressPrimaryZip:null==x?void 0:x.addressPrimaryZip,addressPrimaryCountry:null==x?void 0:x.addressPrimaryCountry}:null,children:(0,l.Y)(ee.A,{fieldIds:$.A.COLLATERAL.FIELDS,renderTriggeredCollateral:(e,n)=>null==e?void 0:e.map(e=>(0,l.Y)("div",{css:{marginBottom:"1rem"},children:(0,l.Y)(ov.A,{name:"".concat(d,".triggeredCollaterals.").concat(e),namePrefix:"".concat(d,".triggeredCollaterals.").concat(e),itemLabel:e,itemRenderer:p1,application:o,fundingSources:a,isLoadingFundingSources:r,lockedCollateralType:e,primaryCollateralType:s||(I?y:null),firstItemOpen:!0,scrollToItem:!1,hideAddButton:!n||1===n,max:n,addButtonText:"Add Additional ".concat(eF()(e))},e)},e))})})})},p2=e=>{var n,i;let{application:t,isLoadingFundingSources:o,isLoading:a,fundingSources:r,lockedCollateralType:d,product:s,initialValuesType:c}=e,{experiences:{selfServe:{pages:{addCollateral:u={}}}}}=(0,D.t)(),{fields:p}=(0,nn.A)({entityType:"collateral"}),{watch:m,reset:h}=(0,S.xW)(),g=(null==p?void 0:p.type)&&"disabled"!==p.type.requirement&&"hideIfOnlyOneOption"in p.type&&p.type.hideIfOnlyOneOption&&1===p.type.options.length&&p.type.options[0].value,f=m("collateral.type"),y=f||d||g;(0,v.useEffect)(()=>{f!==c&&h({collateral:{type:f,isPrimaryCollateral:!0,triggeredCollaterals:{}}})},[f,h]);let A=null==u||null==(n=u.collateralType)?void 0:n[y],b={...u,...A};return(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{heading:b.headerText||"Add Collateral",subheading:b.subheaderText||"We'll collect some basic information for your **".concat(null==s?void 0:s.name,"** application.")}),(0,l.FD)(ei.A,{theme:"small",children:[(0,l.Y)(p1,{application:t,fundingSources:r,isLoadingFundingSources:o,namePrefix:"collateral",lockedCollateralType:d}),(0,l.Y)(I.Ay,{account:null!=(i=(0,eS.qk)(t.rawFields))?i:null,application:t,organizationKycEvaluationTags:t.organizationKycEvaluationTags,personKycEvaluationTags:t.personKycEvaluationTags,namePrefix:"account",children:(0,l.Y)(ee.A,{fieldIds:$.A.ACCOUNT.WET_SIGNATURE_FIELDS})})]}),(0,l.Y)(w.A,{type:"submit",isFull:!0,isLoading:a,children:"Continue"}),b.formInfoText&&(0,l.Y)(Z.A,{icon:"info-circle",content:b.formInfoText,productId:null==s?void 0:s.id,tooltipIcon:b.formInfoTooltip?"info-circle":null,tooltipContent:b.formInfoTooltip})]})},p6=e=>{var n,i,t,o,a,r,d;let{application:s,fundingSources:c,isLoadingFundingSources:u,onSubmit:p}=e,m=null==(n=s.products)?void 0:n.find(e=>"loan"===e.type),h=null==m||null==(i=m.collateral)?void 0:i.primaryCollateralType,v=(null==(t=s.collateral)?void 0:t.find(e=>{var n,i;return(null==(n=e.rawFields)?void 0:n.isPrimaryCollateral)||(null==(i=e.rawFields)?void 0:i.type)===h}))||(null==(o=s.collateral)?void 0:o[0]),g=v?{...null==v?void 0:v.rawFields,id:null==v?void 0:v.id}:{type:h||null},f=(null==(r=s.collateral)||null==(a=r.filter(e=>{var n;return(null==(n=e.rawFields)?void 0:n.type)!==(null==g?void 0:g.type)}))?void 0:a.map(e=>({...e.rawFields,id:e.id})))||[],A=ns()(f,"type"),b=(0,eS.qk)(s.rawFields),{getFieldIsEnabled:C}=(0,I.wD)({account:null!=b?b:null,application:s,organizationKycEvaluationTags:s.organizationKycEvaluationTags,personKycEvaluationTags:s.personKycEvaluationTags}),S=C("additionalWetSignaturesNames"),{isLoading:w,onClick:x}=(0,iB.A)({onClick:e=>p((e=>{let{collateral:n,collateral:{triggeredCollaterals:i},account:t}=e;return{collaterals:[(0,E.bP)(n),...Object.values(i||{}).flatMap(e=>(null==e?void 0:e.map(E.bP))||[])||[]],...S?{accountFields:t}:{}}})(e))}),F={collateral:{...g,isPrimaryCollateral:!0,triggeredCollaterals:A},account:{additionalWetSignaturesNames:null!=(d=null==b?void 0:b.additionalWetSignaturesNames)?d:[]}};return(0,l.Y)(y.A,{onSubmit:x,initialValues:F,children:(0,l.Y)(p2,{application:s,isLoading:w,fundingSources:c,isLoadingFundingSources:u,lockedCollateralType:h,product:m,initialValuesType:F.collateral.type})})};function p5(){let e=(0,ng._)(["\n  mutation UpsertCollaterals(\n    $applicationId: ID!\n    $collaterals: [JSONObject!]!\n  ) {\n    upsertCollaterals(\n      applicationId: $applicationId\n      collaterals: $collaterals\n    ) {\n      id\n      rawFields\n    }\n  }\n"]);return p5=function(){return e},e}let p4=(0,iE.J1)(p5());function p3(){let e=(0,ng._)(["\n  query DecodeVIN($vin: String!) {\n    decodeVIN(vin: $vin) {\n      make\n      model\n      modelYear\n      trim\n      trim2\n      VIN\n      errorCode\n      errors\n    }\n  }\n"]);return p3=function(){return e},e}let p8=(0,iE.J1)(p3()),p7={listContainer:{listStylePosition:"inside",marginTop:-16},infoBoxContainer:{marginTop:16}},me=e=>{var n,i,t,o;let{application:a,applicationId:r,handleContinueClick:d,isLoading:s,calculatePaymentAmount:c,isCalculating:u}=e,{experiences:{selfServe:{pages:{preApprovalOfferApproved:{formInfoText:p,formInfoTooltip:m}={}}}}}=(0,D.t)(),h=(0,eS.qk)(a.rawFields),g=null!=(t=null==h?void 0:h.preOfferLoanAmountCents)?t:"0",f=null==h?void 0:h.preOfferLoanRate,y=null==h?void 0:h.preOfferLoanTermMonths,I=null==(n=a.products)?void 0:n.find(e=>"loan"===e.type),A=null!=(o=null==I||null==(i=I.loanOfferExpirationInDays)?void 0:i.toString())?o:"30",[b,C]=(0,v.useState)(null),S=(null==I?void 0:I.loanType)&&["credit
1Card","lineOfCredit"].includes(I.loanType)||!f||!y||!g,x=(0,v.useCallback)(async()=>{if(S)return void C(null);try{let e=await c({applicationId:r});C((null==e?void 0:e.paymentAmount)||null)}catch(e){console.error("Error calculating payment amount:",e),C(null)}},[c,r]),F=(0,v.useMemo)(()=>ej()(x,500),[x]);return(0,v.useEffect)(()=>(F(),()=>{F.cancel()}),[c,g,y,f,r]),(0,l.Y)(k.A,{theme:"centered",children:(0,l.FD)(pm,{animationType:"approved",heading:"You’re Pre-Approved!",subheading:(0,l.Y)(np.A.H4,{children:"You’ve been pre-approved for up to:"}),text:(0,l.Y)(tP.yN,{children:(0,l.Y)(np.A.H2,{children:"".concat((0,eN.CQ)(g))})}),children:[(0,l.Y)(ei.A,{children:(0,l.FD)("ul",{css:p7.listContainer,children:[f&&(0,l.FD)("li",{children:["Estimated rate ",f,"% APR"]}),u?(0,l.Y)("li",{children:"Calculating monthly payment..."}):b?(0,l.Y)("li",{children:"".concat((0,eN.CQ)(b)," monthly for ").concat(y," months")}):null,(0,l.FD)("li",{children:["Pre-approval offer valid for ",A," days"]})]})}),(0,l.Y)(w.A,{onClick:d,theme:"primary",isLoading:s,isFull:!0,children:"Continue"}),(0,l.Y)("div",{css:p7.infoBoxContainer,children:p?(0,l.Y)(Z.A,{icon:"info-circle",content:p,tooltipIcon:m?"info-circle":null,tooltipContent:m}):null})]})})},mn=e=>{var n;let{application:i,dynamicAgreements:t,handleAccept:o,handleDecline:a,isLoading:r,userId:d,calculatePaymentAmount:s}=e,[c,u]=(0,v.useState)(!1),[p,m]=(0,v.useState)(!1),{experiences:{selfServe:{pages:{preApprovalLoanEstimate:{productId:h,formInfoTooltip:g,headerText:f,subheaderText:A}={}}}}}=(0,D.t)(),b=(0,eS.qk)(i.rawFields),C=null==(n=i.products)?void 0:n.find(e=>"loan"===e.type),S=t.filter(e=>!e.forSignerId||e.forSignerId===d),F=S.some(e=>{var n,i;return null==e||null==(i=e.metadata)||null==(n=i.signingInputs)?void 0:n.length}),Y=(null==C?void 0:C.id)&&(null==h?void 0:h[null==C?void 0:C.id])?null==h?void 0:h[null==C?void 0:C.id]:null;return(0,l.Y)(k.A,{children:(0,l.FD)(y.A,{onSubmit:o,children:[(0,l.FD)(I.sf,{account:null!=b?b:{},application:i,organizationKycEvaluationTags:null==i?void 0:i.organizationKycEvaluationTags,personKycEvaluationTags:null==i?void 0:i.personKycEvaluationTags,children:[(0,l.Y)(x.A,{heading:(null==Y?void 0:Y.headerText)?null==Y?void 0:Y.headerText:f||"Your Loan Estimate",subheading:(null==Y?void 0:Y.subheaderText)?null==Y?void 0:Y.subheaderText:A||"Verify the details of your loan offer before moving forward."}),b&&(0,l.Y)(ei.A,{children:(0,l.Y)(px,{application:i,calculatePaymentAmount:s,formInfoTooltipContent:g})}),(0,l.Y)(nZ,{dynamicAgreements:S,agreements:[],attestations:[],application:i,headerCopy:"Review Initial Disclosures",contentCopy:"Please carefully review your official Loan Estimate and the accompanying legal documents below. By submitting, you acknowledge receipt of these disclosures and confirm your intent to proceed with this application.",onClickToSignCompleted:()=>m(!0),hideViewByAccountUi:!0})]}),(0,l.FD)("section",{css:{display:"flex",flexDirection:"column",gap:"1rem"},children:[(0,l.Y)(w.A,{type:"submit",isFull:!0,isLoading:r,isDisabled:F&&!p,children:"Accept"}),(0,l.Y)(w.A,{isFull:!0,theme:"outline",onClick:()=>u(!0),isDisabled:r,children:"Decline"})]}),(0,l.Y)(i9.A,{isOpen:c,buttonText:"Yes, Decline Loan",onConfirm:()=>a(),heading:"Decline Loan",subheading:"Are you sure you want to decline this loan?",onClose:()=>u(!1),onCancel:()=>u(!1),onClickAway:()=>u(!1),icon:"cancel",isLoading:r})]})})},mi=e=>{var n;let{application:i,handleContinueClick:t}=e,o=(0,eS.qk)(i.rawFields),a=null!=(n=null==o?void 0:o.offerLoanAmountCents)?n:"0";return(0,l.Y)(k.A,{children:(0,l.Y)(pm,{animationType:"approved",heading:"You’re Approved for a Loan!",subheading:(0,l.Y)(np.A.H4,{children:"You have been approved for:"}),text:(0,l.Y)(tP.yN,{children:(0,l.Y)(np.A.H3,{children:(0,eN.CQ)(a)})}),children:(0,l.Y)(w.A,{isFull:!0,onClick:t,children:"View Your Offer Details"})})})},mt={container:{display:"flex",flexDirection:"column",alignItems:"center",gap:"20px"},listContainer:{display:"flex",flexDirection:"column",gap:"8px",listStyleType:"none",textAlign:"center",fontWeight:600},cardContainer:{marginBottom:36}},ml=e=>{var n,i;let{application:t,handleContinueClick:o,isLoading:a}=e,r=(0,D.t)(),d=(0,tk.A)({entityType:"application",scopes:[],config:r}),s=(0,tk.A)({entityType:"person",scopes:[],config:r}),c=(e,n)=>{var i;return null==(i=t.preOfferActions)?void 0:i.filter(n=>"missingDocument"===n.type&&n.entityType===e).flatMap(e=>
1e.data).filter(Boolean).map(e=>{var i;let t=null==n?void 0:n[e];return null!=(i=null==t?void 0:t.displayLabel)?i:(0,tR.n)(e)})},u=c("person",s),p=c("application",d),m=null==(n=t.preOfferActions)?void 0:n.some(e=>"missingAddOnSelection"===e.type),h=[...u||[],...p||[]],v=null==(i=t.preOfferActions)?void 0:i.some(e=>"missingCollateral"===e.type||"missingEntityFields"===e.type&&"collateral"===e.entityType);return(0,l.Y)(k.A,{children:(0,l.FD)("div",{css:mt.container,children:[(0,l.Y)(x.A,{heading:"Thanks for Applying!",subheading:"Thank you for applying! It looks like we need some additional information to get you qualified. ",icon:"illustration-search",isCentered:!0}),(0,l.Y)("div",{css:mt.cardContainer,children:(0,l.FD)(eU.A,{children:[(0,l.Y)(np.A.H4,{css:{marginBottom:"8px"},children:"Additional verification needed"}),(0,l.FD)("ul",{css:mt.listContainer,children:[m&&(0,l.Y)("li",{children:(0,l.Y)(e6.A,{source:"Select Add-ons"})}),v&&(0,l.Y)("li",{children:(0,l.Y)(e6.A,{source:"Complete Collateral"})}),null==h?void 0:h.map(e=>(0,l.Y)("li",{children:(0,l.Y)(e6.A,{source:e})},e))]})]})}),(0,l.Y)(w.A,{onClick:o,isLoading:a,theme:"primary",isFull:!0,children:"Let's get going"})]})})};var mo=i(86820);let ma=(0,mo.A)("div",{target:"e1izy4r10",label:"MultiOptionModal-MultiOptionModal-ContentContainer"})("display:flex;flex-direction:column;padding:1.5rem;gap:1rem;"),mr=(0,mo.A)(w.A,{target:"e1izy4r11",label:"MultiOptionModal-MultiOptionModal-ModalButton"})("margin-top:1rem;"),md=e=>{let{isOpen:n,onClose:i,onContinueClick:t,onSelectionChange:o,modalOptionsConfig:a,buttonLabel:r="Submit",isButtonDisabled:d=!1,heading:s,subHeading:c}=e,u=Object.entries(a).map(e=>{let[n,i]=e;return{name:n,label:i.label,defaultValue:i.defaultValue,isDisabled:i.isDisabled,options:i.options,type:i.optionType}});return(0,l.Y)(nh.A,{isOpen:n,onClose:i,canClose:!0,children:(0,l.FD)(ma,{children:[(0,l.Y)(x.A,{heading:s||"Select plan options.",headingTag:"h4",theme:"small",subheading:c||"Select plan options."}),u.map((e,n)=>(0,l.Y)(nv.A.Dropdown,{onChange:n=>{o({label:e.name,value:n})},name:e.name,defaultValue:e.defaultValue,isDisabled:e.isDisabled,label:e.label,placeholder:e.label,options:e.options,..."MultiSelectDropdown"===e.type?{isMulti:!0}:{}},"".concat(e.name,"-").concat(n))),(0,l.Y)(mr,{"data-testid":"multi-option-modal-add-button",onClick:t,isFull:!0,isDisabled:d,children:r})]})})},ms={cardHeadingGroup:{flexDirection:"column"},cardHeaderRow:{display:"flex",marginBottom:"1rem",position:"relative"},subHeaderGroup:{color:i(12464).A.grey2,fontSize:"0.875rem",fontWeight:400},cardFooter:{marginTop:"1rem"},addedPill:{position:"absolute",top:0,right:0},editAndRemoveButtons:{display:"flex",gap:"1rem"}},mc=e=>{let{isSelected:n,addOnCosts:i,onShowModalOptions:t,addOnConfig:o}=e;return(0,l.Y)("div",{css:ms.cardFooter,children:(0,l.FD)("div",{css:ms.editAndRemoveButtons,children:[(0,l.Y)(w.A,{isFull:!0,theme:n?"outline":"primary",onClick:()=>{var e,i;if(o.selectableFields&&Object.keys(o.selectableFields).length>0)return void t(o.id);n?null==(e=o.handleClearSelection)||e.call(o):null==(i=o.handleCompleteSelection)||i.call(o)},children:(()=>{if(n)return Object.keys(o.selectableFields).length>1?"Edit options":"Remove";if(Object.values(o.selectableFields).length<=1){var e;return"Add for ".concat((0,eN.CQ)(null!=(e=null==i?void 0:i.estimatedMonthlyPaymentInCents)?e:"0")," per Month")}return"Select Plan Options to Add"})()}),n&&Object.keys(o.selectableFields).length>1&&(0,l.Y)(w.A,{isFull:!0,theme:"outline",onClick:()=>{var e;null==(e=o.handleClearSelection)||e.call(o)},children:"Remove"})]})})},mu=e=>{let{name:n,isSelected:i,paymentLoading:t,copy:o}=e;return(0,l.Y)("div",{css:ms.cardHeaderRow,children:(0,l.FD)("div",{css:ms.cardHeadingGroup,children:[(0,l.Y)(np.A.H3,{children:(0,l.Y)(tP.yN,{children:n})}),i&&(0,l.FD)(l.FK,{children:[(0,l.Y)("div",{css:ms.subHeaderGroup,children:t?(0,l.Y)(ny.A,{size:"xsmall"}):o?(0,l.Y)(e6.A,{source:o}):null}),(0,l.Y)("div",{css:ms.addedPill,children:(0,l.Y)(lU.A,{theme:"chip",children:"ADDED"})})]})]})})},mp=e=>{var n,i,t,o,a;let{addOn:r,configBuilder:d,persons:s,selectedAddOnDataSnapshot:c,showModalOptions:u,onShowModalOptions:p,onCloseModalOptions:m,externalCalculationCallback:h,Callout:g,paymentLoading:f}=e,y="addOns.".concat(r.addOnId),{setValue:I}=(0,S.xW)(),A=(0,v.useMemo)(()=>d(y,r,c,I,s),[d,r,s,c]),b=Object.keys(A.selectableFields).length>0,C=!!(null==c||null==(n=c[r.addOnId])?void 0:n.planId)||!!(null==c||null==(i=c[r.addOnId])?void 0:i.addOnKey),w=(0,v.useMemo)(()=>Object.entries(A.selectableFields).filter(e=>{let[n,i]=e;return i&&!!i.options}).reduce((e,n)=>{var i,t,l,o;let[a,r]=n;return{...e,["".concat(y,".").concat(a)]:{label:null!=(i=null==r?void 0:r.displayLabel)?i:"Select an option",options:null!=(t=null==r?void 0:r.options)?t:[],defaultValue:null!=(l=null==r?void 0:r.defaultValue)?l:void 0,isDisabled:null!=(o=null==r?void 0:r.isDisabled)&&o,optionType:null==r?void 0:r.optionType}}},{}),[A.selectableFields,r.addOnId,c]),x=(0,v.useMemo)(()=>{var e,n;return null!=(n=null==(e=A.getCosts)?void 0:e.call(A))?n:void 0},[A.getCosts]),{header:F,description:Y}=null!=(a=null==(t=A.getDisplayCopy)?void 0:t.call(A))?a:{header:r.name,description:r.description};return(0,v.useEffect)(()=>{let e=async()=>{var e,n,i,t,l,o;let a=await (null==h?void 0:h({addOnCosts:x,addOn:r,selectedPlanId:null!=(l=null==c||null==(e=c[r.addOnId])?void 0:e.planId)?l:void 0,selectedPlanName:null==c||null==(n=c[r.addOnId])?void 0:n.planName,selectedPlanType:null!=(o=null==c||null==(i=c[r.addOnId])?void 0:i.planType)?o:void 0})),d=ic(r.type)?null==(t=a.fees)?void 0:t.find(e=>e.id===r.type):void 0;if(d){I("".concat(y,".costs.estimatedMonthlyPaymentInCents"),d.monthlyCostCents),I("".concat(y,".costs.totalBaseCostInCents"),d.totalAmountCents);return}ic(r.type)||I("".concat(y,".costs.estimatedMonthlyPaymentInCents"),a.estimatedMonthlyPaymentInCents)};!C||(null==x?void 0:x.estimatedMonthlyPaymentInCents)||e()},[C,null==x?void 0:x.estimatedMonthlyPaymentInCents]),(0,l.FD)(eU.A,{id:r.addOnId,testId:r.addOnId,children:[(0,l.Y)(mu,{name:F,isSelected:C,paymentLoading:null!=f&&f,copy:(()=>{var e;let n=null==x?void 0:x.estimatedMonthlyPaymentInCents;if(n&&Number(n)>0)return"".concat((0,eN.CQ)(n)," PER MONTH");let i=null==(e=iu(r,c))?void 0:e.rate;if(i)return"$".concat(new ew.A(i).toFixed(3)," per $100 of the Monthly Outstanding Loan Balance")})()}),(0,l.Y)(e6.A,{source:Y,isInline:!1}),g&&(0,l.Y)(g,{}),(0,l.Y)(mc,{isSelected:C,addOnCosts:x,onShowModalOptions:p,addOnConfig:A}),b&&(0,l.Y)(md,{heading:r.name,isOpen:u,onClose:()=>{var e,n;(null==c||null==(e=c[r.addOnId])?void 0:e.planId)||null==(n=A.handleClearSelection)||n.call(A),m()},onContinueClick:()=>{var e;null==(e=A.handleCompleteSelection)||e.call(A),m()},isButtonDisabled:!(null==c||null==(o=c[r.addOnId])?void 0:o.selected),buttonLabel:"Select Plan Options",onSelectionChange:e=>{var n;null==(n=A.handleSelectionChange)||n.call(A,e)},modalOptionsConfig:w})]})},mm=e=>{var n,i,t;return null!=(t=null==(n=e.planOptions)?void 0:n.find(e=>e.recommended))?t:null==(i=e.planOptions)?void 0:i[0]},mh=(e,n,i,t,l)=>({id:null==n?void 0:n.addOnId,selectableFields:{planName:(e=>{var n,i;return{displayLabel:"Plan",options:null!=(i=null==(n=e.planOptions)?void 0:n.map(e=>({value:e.planName,label:e.planName})))?i:[],defaultValue:void 0,isDisabled:!1}})(n),personIds:((e,n,i)=>{var t,l,o,a,r,d;let s=null==i||null==(t=i[e.addOnId])?void 0:t.planName;return{displayLabel:"Borrower",options:null!=(r=null==e||null==(l=e.qualifyingPersonsAndPersonas)?void 0:l.map(e=>{var i;let t=null==n?void 0:n.find(n=>(null==n?void 0:n.id)===(null==e?void 0:e.personId));if(t&&(!s||(null==(i=e.eligiblePlans)?void 0:i.includes(s))))return{value:e.personId,label:(0,J.L)(t),displayLabel:"Borrower Options"}}
1).filter(Boolean))?r:[],defaultValue:null!=(d=null==i||null==(o=i[e.addOnId])?void 0:o.personIds)?d:void 0,isDisabled:!(null==i||null==(a=i[e.addOnId])?void 0:a.planName),optionType:"MultiSelectDropdown"}})(n,null!=l?l:[],i)},getCosts:()=>{var e,t;return null!=(t=null==i||null==(e=i[n.addOnId])?void 0:e.costs)?t:null},handleSelectionChange:l=>{var o,a,r,d,s,c;t("".concat(e,".planId"),void 0),t("".concat(e,".selected"),!1),(l.label!=="".concat(e,".personIds")||l.value&&0!==l.value.length)&&(l.label==="".concat(e,".planName")&&(null==i||null==(a=i[n.addOnId])||null==(o=a.personIds)?void 0:o.length)&&(null==i||null==(r=i[n.addOnId])?void 0:r.personIds.length)>0&&t("".concat(e,".personIds"),[]),(null==i||null==(d=i[n.addOnId])?void 0:d.planName)&&(null==i||null==(s=i[n.addOnId])?void 0:s.personIds)&&(null==i||null==(c=i[n.addOnId])?void 0:c.personIds.length)>0&&iu(n,i)?t("".concat(e,".selected"),!0):t("".concat(e,".selected"),!1))},handleCompleteSelection:()=>{t("".concat(e,".costs"),void 0);let l=iu(n,i);l&&(t("".concat(e,".planId"),l.planId),t("".concat(e,".planType"),l.planType))},handleClearSelection:()=>{t("".concat(e,".planId"),void 0),t("".concat(e,".planType"),void 0),t("".concat(e,".planName"),""),t("".concat(e,".personIds"),[]),t("".concat(e,".selected"),!1),t("".concat(e,".costs"),void 0),t("".concat(e,".addOnKey"),"")}}),mv={gapCoverage:(e,n,i,t)=>({id:n.addOnId,selectableFields:{},getCosts:()=>{var e,t,l,o;let a=null!=(l=null==(e=mm(n))?void 0:e.costs)?l:n.costs;return null!=(o=null!=a?a:null==i||null==(t=i[n.addOnId])?void 0:t.costs)?o:null},getDisplayCopy:()=>{let e=mm(n);return{header:(null==e?void 0:e.planName)||n.name,description:(null==e?void 0:e.planDescription)||n.description}},handleCompleteSelection:()=>{let i=mm(n);if(i){var l;t("".concat(e,".planId"),null!=(l=i.planId)?l:""),t("".concat(e,".planName"),i.planName),t("".concat(e,".selected"),!0)}},handleClearSelection:()=>{t("".concat(e,".planId"),void 0),t("".concat(e,".planName"),void 0),t("".concat(e,".selected"),!1),t("".concat(e,".addOnKey"),"")}}),mbpCoverage:(e,n,i,t)=>{let l=n.planOptions||[],o=null==i?void 0:i[n.addOnId],a=null==o?void 0:o.planName,r=null==o?void 0:o.deductible,d=null==o?void 0:o.coverageTerm;return{id:n.addOnId,selectableFields:{planName:{displayLabel:"Plan",options:no()(l.map(e=>({value:e.planName,label:e.planName})),"value"),defaultValue:void 0,isDisabled:!1},deductible:((e,n,i)=>{if(!n)return{displayLabel:"Deductible",options:[],defaultValue:void 0,isDisabled:!0};let t=e.filter(e=>e.planName===n);if(i){let[e,n]=i.split("-").map(Number);t=t.filter(i=>i.monthsCovered===e&&i.milesCovered===n)}return{displayLabel:"Deductible",options:no()(t.map(e=>({value:e.deductibleInCents.toString(),label:(0,eN.CQ)(e.deductibleInCents)})),"value"),defaultValue:void 0,isDisabled:!1}})(l,a,d),coverageTerm:((e,n,i)=>{if(!n)return{displayLabel:"Coverage Term",options:[],defaultValue:void 0,isDisabled:!0};let t=e.filter(e=>e.planName===n);return i&&(t=t.filter(e=>{var n;return(null==(n=e.deductibleInCents)?void 0:n.toString())===i})),{displayLabel:"Coverage Term",options:no()(t.map(e=>({value:"".concat(e.monthsCovered,"-").concat(e.milesCovered),label:"".concat(e.monthsCovered," months or ").concat(e.milesCovered.toLocaleString()," miles")})),"value"),defaultValue:void 0,isDisabled:!1}})(l,a,null!=r?r:"")},getCosts:()=>{var e,t,l,o,a;let r=null==(e=n.planOptions)?void 0:e.find(e=>{var t;return e.planId===(null==i||null==(t=i[n.addOnId])?void 0:t.planId)});return null!=(a=null!=(o=null!=(l=null==i||null==(t=i[n.addOnId])?void 0:t.costs)?l:null==r?void 0:r.costs)?o:n.costs)?a:null},handleSelectionChange:l=>{l.label==="".concat(e,".planName")&&(t("".concat(e,".deductible"),""),t("".concat(e,".coverageTerm"),""),t("".concat(e,".selected"),!1));let o=null==i?void 0:i[n.addOnId];(null==o?void 0:o.planName)&&(null==o?void 0:o.deductible)&&(null==o?void 0:o.coverageTerm)?t("".concat(e,".selected"),!0):t("".concat(e,".selected"),!1)},handleCompleteSelection:()=>{var o,a,r;t("".concat(e,".costs"),void 0);let d=null==i?void 0:i[n.addOnId],s=((e,n,i,t)=>{let[l,o]=t.split("-").map(Number),a=e.find(e=>{var t;return e.planName===n&&(null==(t=e.deductibleInCents)?void 0:t.toString())===i&&e.monthsCovered===l&&e.milesCovered===o});if(null==a?void 0:a.planId)return{planId:a.planId,planName:a.planName}})(l,null!=(o=null==d?void 0:d.planName)?o:"",null!=(a=null==d?void 0:d.deductible)?a:"",null!=(r=null==d?void 0:d.coverageTerm)?r:"");s&&t("".concat(e,".planId"),s.planId)},handleClearSelection:()=>{t("".concat(e,".planName"),""),t("".concat(e,".deductible"),""),t("".concat(e,".coverageTerm"),""),t("".concat(e,".planId"),void 0),t("".concat(e,".selected"),!1),t("".concat(e,".addOnKey"),"")}}},debtProtection:mh,lifeCreditProtection:mh,ahCreditProtection:mh,vehicleServiceContract:(e,n,i,t)=>({id:n.addOnId,selectableFields:{},getCosts:()=>{var e,t,l;return null!=(l=null!=(t=null==i||null==(e=i[n.addOnId])?void 0:e.costs)?t:n.costs)?l:null},handleCompleteSelection:()=>{var i;t("".concat(e,".addOnKey"),n.addOnId),t("".concat(e,".costs"),null!=(i=null==n?void 0:n.costs)?i:null),t("".concat(e,".selected"),!0)},handleClearSelection:()=>{t("".concat(e,".addOnKey"),""),t("".concat(e,".selected"),!1),t("".concat(e,".costs"),void 0)}})},mg={sectionContainer:{display:"flex",flexDirection:"column",gap:"1rem",flexGrow:1,margin:"1rem 0"},buttonContainer:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},debtProtectionCallout:{marginTop:"1rem"}},mf=e=>{let{addOnDisclosures:n,isSaving:i,selectedAddOnDataSnapshot:t}=e;return(0,l.FD)("section",{css:mg.buttonContainer,children:[n.length>0&&(0,l.Y)(w.A,{isFull:!0,theme:"white",onClick:()=>{let e=n[0].url;window.open(e,"_blank","noopener,noreferrer")},children:"View Disclosures"}),(0,l.Y)(w.A,{isFull:!0,theme:"primary",type:"submit",isLoading:i,isDisabled:i,children:Object.entries(null!=t?t:{}).some(e=>{let[n,i]=e;return(null==i?void 0:i.planId)||!!(null==i?void 0:i.addOnKey)})?"Continue":"Continue without Full Protection"})]})},my=e=>{let{calculatePaymentForPlan:n,qualifiedAddOns:i,persons:t,loanProduct:o,isSaving:a,isPreOfferStage:r,preOfferLoanAmountCents:d,paymentLoading:s}=e,{experiences:{selfServe:{pages:{loansAddOns:c}}},agreements:u}=(0,D.t)(),p=(0,S.FH)({name:"addOns"}),[m,h]=(0,v.useState)(null),g=(0,eL.FF)("LOAN-1148-addons-to-preoffer"),f=(0,v.useCallback)(e=>{h(e)},[]),y=(0,v.useCallback)(()=>{h(null)},[]),I=(null==c?void 0:c.headerText)||"Protect Your Investment",A=(null==c?void 0:c.subheaderText)||"Take advantage of these loan services to give you peace of mind on the road. Costs of each coverage option will be added to your total loan amount.",b=Object.values(u).filter(e=>{var n;return null==o||null==(n=o.addOnsDisclosures)?void 0:n.includes(e.id)}),C=r&&g&&i.some(e=>ic(e.type))&&d,w={debtProtection:"Debt Protection",lifeCreditProtection:"Credit Life",ahCreditProtection:"Credit Disability"};return(0,l.FD)(k.A,{children:[(0,l.Y)(x.A,{heading:I,headingTag:"h2",subheading:A}),(0,l.Y)(np.A.H3,{children:(0,l.Y)(tP.yN,{children:"Loan Coverage Protection"})}),(0,l.Y)("div",{css:mg.sectionContainer,children:i.map(e=>(0,l.Y)(mp,{addOn:e,persons:t,selectedAddOnDataSnapshot:p,configBuilder:mv[e.type],showModalOptions:m===e.addOnId,onShowModalOptions:f,onCloseModalOptions:y,externalCalculationCallback:n,paymentLoading:null!=s&&s,Callout:(e=>{if(!C||!ic(e))return;let n=w[e];return()=>(0,l.Y)("div",{css:mg.debtProtectionCallout,children:(0,l.Y)(Z.A,{icon:"info-circle",theme:"warning",content:"".concat(n," monthly costs are calculated based on your pre-approved loan amount of **").concat((0,eN.CQ)(d),"**. *(Costs are variable and may change based on your final approved loan amount)*")}
1)})})(e.type)},e.addOnId))}),(0,l.Y)(mf,{addOnDisclosures:b,isSaving:a,selectedAddOnDataSnapshot:p})]})},mI=()=>{let e=new iH.O().getResult(),n=e.device.type,i=e.os.name;return("mobile"===n||"tablet"===n)&&("Android"===i||"iOS"===i)},mA=e=>{let{MyEnrollmentIntegrationComponent:n}=e,{applicationId:i}=(0,u.YY)(),{enrollmentIntegrations:t,enrollmentIntegrationLoading:o}=sD({applicationId:i}),a=(0,m.useRouter)(),r=t.find(e=>"alkamiEnrollment"===e.name),d=null==r?void 0:r.id;return((0,v.useEffect)(()=>{o||d||a.replace("/_error")},[o,d,a]),o||!d)?(0,l.Y)(W.A,{}):(0,l.Y)(n,{integrationId:d})},mb=e=>{let{integrationId:n}=e;return(e=>{let{outboundRedirect:n,credentialCreationPolicies:i}=sM({integrationId:e}),{setCurrentView:t}=(0,H.At)(),l=(0,m.useRouter)(),o=!!n,{preflowErrorHasOccurred:a,shouldShowLoadingView:d}=(e=>{let{enrollmentPreflowResult:n,loading:i,error:t,called:l}=sM({integrationId:e}),o=i||!l;return{preflowErrorHasOccurred:!o&&(t||!n),shouldShowLoadingView:o}})(e),{isWrappedByAlkami:s}=(0,aj.Pk)();(0,v.useEffect)(()=>{if(!d)if(a)l.push("/_error");else if(o){let e=dh(null==n?void 0:n.newTab);s?t(r.HV):mI()?t(r._Q):(window.open(n.url,e),l.push("/products"))}else i?t({...r.bP,data:{integrationId:e,policies:i}}):l.push("/_error")},[d,a])})(n),(0,l.Y)(W.A,{})},mC={container:e=>{let{breakpoints:n}=e;return{padding:"0 16px",background:"white",top:0,width:"100vw",zIndex:1e3,display:"flex",flexFlow:"column",alignItems:"center",[n.medium]:{paddingLeft:24,paddingRight:24,position:"relative",zIndex:5}}},inner:{maxWidth:eQ.kr,width:"100%"}},mS=e=>{let{outboundRedirectUrl:n,newTab:i,data:t,closeModal:l}=e;t?(e=>{let{outboundRedirectUrl:n,newTab:i,data:t}=e,l=document.createElement("form");for(let[e,o]of(l.method="POST",l.action=n,l.style.display="none",l.target=i?"_blank":"_self",l.enctype="application/x-www-form-urlencoded",Object.entries(t))){let n=document.createElement("input");n.name=e,n.value=o,l.appendChild(n)}document.body.appendChild(l),l.submit(),document.body.removeChild(l)})({outboundRedirectUrl:n,newTab:i,data:t}):window.open(n,dh(i)),null==l||l(n)},mw=e=>{let{onMobileEnrollmentSuccess:n,isMobile:i,...t}=e;return(0,l.Y)("div",{css:mC.container,children:(0,l.Y)("div",{css:mC.inner,children:(0,l.Y)(dQ,{...t,onEnrollmentSuccess:i?n:mS})})})};var mx=i(60661);let mF={outerShell:{padding:"1rem"},container:{display:"flex",flexDirection:"column",alignItems:"center"},heading:{textAlign:"center",width:"100%"},centerIconShell:{height:"8.75rem",margin:"2.5rem 0"},centerIcon:{height:"140px",width:"unset"},headerWeight:{fontWeight:600},continueInTheApp:{marginBottom:".75rem"},signInWithYourNewCredentials:{marginBottom:"2rem"},buttonShell:{maxWidth:"21.5rem",width:"100%",marginBottom:"2rem"}},mY={entering:{transform:"translateY(20px)",opacity:0},entered:{transform:"translateY(0)",opacity:1},exiting:{transform:"translateY(0)",opacity:1},exited:{transform:"translateY(0)",opacity:1},unmounted:{transform:"translateY(20px)",opacity:0}},mT=()=>{let e=(0,mx.Z)(),{experiences:{selfServe:{pages:{alkamiAppEndOfFlow:{formInfoText:n}={}}}}}=(0,D.t)();return(0,l.Y)(k.A,{theme:"centered",children:(0,l.Y)(e$.Ay,{appear:!0,in:!0,timeout:0,children:i=>(0,l.FD)("div",{css:[mF.container,mF.outerShell],style:{...(e=>({transition:"transform ".concat(e,"ms ease-in-out, opacity ").concat(e,"ms ease-in-out")}))(500),...mY[i]},children:[(0,l.Y)("div",{css:mF.heading,children:(0,l.Y)("div",{css:[i_.A.xxlarge,mF.headerWeight],children:"Account Opened!"})}),(0,l.Y)("div",{css:mF.centerIconShell,children:(0,l.Y)(eH.A,{css:mF.centerIcon,name:"illustration-celebrate-blue",size:"xxlarge"})}),(0,l.Y)("div",{css:[mF.heading,mF.continueInTheApp,mF.headerWeight,i_.A.large],children:"Congratulations!"}),(0,l.Y)("div",{css:[mF.container,mF.signInWithYourNewCredentials,i_.A.default],children:"Your new account is open and ready to use."}),(0,l.Y)("div",{css:mF.buttonShell,children:(0,l.Y)(w.A,{isFull:!0,size:"large",theme:"primary",onClick:()=>e("closeAndNavigateToAccounts"),children:"View Your Accounts"})}),n&&(0,l.Y)(Z.A,{icon:"info-circle",content:n})]})})})},mD=()=>{let{config:{clientDetails:{customerServiceNumber:e,customerServiceUrl:n}}}=(0,s.UK)();return(0,l.Y)(P.A,{icon:"cancel",heading:"Please Contact Your Bank",subheading:"There is an issue with your application. Please contact us.",links:[n&&{url:n,text:"Visit customer support"},e&&{url:"tel:".concat(e),text:"Call Us: ".concat(e)}]})};var mE=i(7352);let mk={[r.sA.code]:e=>{var n,i,t,o,a,d,c,p,m,h,y;let{setCurrentView:I}=e,{triggerMessage:A}=(0,f.d)();ec({allowBrowserNavigationToViews:[r.jn,r.zx]});let{userId:b,application:C,updateAccountProfileFields:S,isUpdatingAccountProfileFields:w,updateApplicationAccountProfileFields:x,isUpdatingApplicationAccountProfileFields:F,validateApplication:Y,isValidatingApplication:T,getView:D}=(0,u.YY)(),{config:E}=(0,s.UK)(),[k,P]=(0,iZ.A)("skippedOriginatingBranchCodeSelection",{applicationId:null==C?void 0:C.id,skipped:!1}),O=(0,g.tx)(null==C?void 0:C.requirements),R=null==O?void 0:O.map(e=>{var n,i;return null==C||null==(i=C.fields)||null==(n=i.accounts)?void 0:n.find(n=>n.referenceId===e.accountReferenceId)}).filter(e=>void 0!==e),L=(0,eS.bb)(null!=(a=null==C?void 0:C.rawFields)?a:null),N=null==R?void 0:R.find(e=>"loan"===e.productType),B=(null==R?void 0:R.length)===1?R[0].referenceId:null!=(d=null==N?void 0:N.referenceId)?d:null,[M,z]=(0,v.useState)(B);if(!(null==C?void 0:C.fields))return(0,l.Y)(W.A,{});if(!(null==C?void 0:C.products))return(0,l.Y)(eu.A,{});let V=null==(i=C.rawFields)||null==(n=i.accounts)?void 0:n.find(e=>e.referenceId===M),_=(0,ij.J)({applicationType:C.type,closingStatus:null!=(c=C.closingStatus)?c:null,preOfferStatus:null!=(p=C.preOfferStatus)?p:null,offerStatus:null!=(m=C.offerStatus)?m:null,originatingExperience:C.originatingExperience,account:null!=V?V:null,purposeOfLoan:null!=(h=null==V?void 0:V.purposeOfLoan)?h:null},E),{originatingBranchCode:q}=(0,iW.cw)({fields:E.fields,entityType:"account",scopes:_,experience:"selfServe"}),H=null==(o=C.persons)||null==(t=o.find(e=>b===e.id))?void 0:t.rawFields,K=async e=>{try{var n,i,t;let l;l=(0,eS.bb)(null==C?void 0:C.rawFields)?await S({variables:{applicationId:null==C?void 0:C.id,fields:e,referenceId:M}}):await x({variables:{fields:e,applicationId:null==C?void 0:C.id}});let o=null==(n=(0,g.tx)(null==l||null==(t=l.data)||null==(i=t.updateAccountProfileFields)?void 0:i.requirements))?void 0:n.filter(e=>"incomplete"===e.status);if(await Y(),(null==q?void 0:q.showInSelfServe)&&"optional"===q.requirement&&!e.originatingBranchCode&&await P({applicationId:null==C?void 0:C.id,skipped:!0}),!(null==o?void 0:o.length)){let e=D();e&&I(e)}z(null)}catch(e){A(U.f9,{theme:"error"})}};return V||!L?(0,l.Y)(iQ,{activeAccount:V,application:C,maritalStatus:null!=(y=null==H?void 0:H.maritalStatus)?y:null,addressPrimaryState:null==H?void 0:H.addressPrimaryState,onSubmit:K,config:E,isSubmitting:T||F||w}):(0,l.Y)(iJ,{accountsWithRequirements:R,requirements:O,onClickAccount:z})},[r.L5.code]:()=>{var e,n,i,t,o;let{triggerMessage:a}=(0,f.d)(),{application:r,updateApplicationAccount:d,isUpdatingApplicationAccount:s,isValidatingApplication:c,updateApplicationEddFields:p,isUpdatingApplicationEddFields:m}=(0,u.YY)(),{routeToNextActionOrSubmitApplication:h}=j(),y=(null==r?void 0:r.requiredActions)&&r.requiredActions.filter(e=>(null==e?void 0:e.type)==="eddRequirement"&&(null==e?void 0:e.entityType)==="account").map(e=>{var n;return{type:null==e||null==(n=e.data)?void 0:n[0],referenceId:null==e?void 0:e.referenceId}}),I=null==y||null==(e=y[0])?void 0:e.type,A=null==r||null==(n=r.requirements)?void 0:n.filter(e=>"eddType"in e&&e.eddType===I),b=A&&1===A.length,[C,S]=(0,v.useState)((()=>{var e;return b&&"accountReferenceId"in A[0]?"accountReferenceId"in A[0]?null==(e=A[0])?void 0:e.accountReferenceId:(null==r?void 0:r.id)||null:null})());if(!(null==r?void 0:r.fields))return(0,l.Y)(W.A,{});let w=async e=>{try{var n,i,t,l,o;let a,s={variables:{fields:{eddFields:e},applicationId:null==r?void 0:r.id,referenceId:C}};a=(null==r||null==(i=r.rawFields)||null==(n=i.accounts)?void 0:n.length)?await d(s):await p(s);let c=null==(t=(0,g.FM)(null==a||null==(o=a.data)||null==(l=o.updateApplicationAccount)?void 0:l.requirements))?void 0:t.filter(e=>e.eddType===I&&"incomplete"===e.status);if(b||!(null==c?void 0:c.length))return h();S(null)}catch(e){a(U.f9,{theme:"error"})}},x=(null==r||null==(i=r.rawFields)?void 0:i.accounts)?null==(o=r.rawFields)||null==(t=o.accounts)?void 0:t.find(e=>e.referenceId===C):r.rawFields;return x?(0,l.Y)(M,{application:r,eddQuestionnaireType:I,onSubmit:w,submitText:"Save",isUpdating:s||m||c,skipRequirement:!1,account:x}):(0,l.Y)(_,{application:r,onClickAccount:e=>{S(e)},eddType:I})},[r.gN.code]:e=>{var n,i;let{setCurrentView:t,goToPreviousView:o,accountId:a}=e,{triggerMessage:d}=(0,f.d)(),{triggerCustomerServiceError:s}=(0,ef.A)(),c=(0,m.useRouter)(),{applicationId:p,products:h,application:v}=(0,u.YY)({includeAccounts:!0}),g=a||"string"==typeof c.query.accountId&&c.query.accountId||(null==v||null==(n=v.fields)?void 0:n.accountId)||(null==v||null==(i=v.fields)?void 0:i.createdAccountId),{account:y,inviteJointOwners:I,isInvitingJointOwners:A}=tA({applicationId:p,accountId:g});ec({allowBrowserNavigationToViews:[r.QL]});let b=h?h[0]:null,C=async e=>{let n=e.map(e=>({firstName:e.firstName,lastName:e.lastName,emailPrimary:e.emailPrimary}));try{await I({variables:{applicants:n,accountId:g}}),d("Invitation sent",{theme:"success"}),setTimeout(()=>t({...r.QL,data:{accountId:g}}),500)}catch(e){s(U.kD)}};return(0,l.Y)(ti,{onGoToPreviousView:o,account:y,product:b,onSubmit:C,isInvitingJointOwners:A})},[r.rF.code]:e=>{var n;let{setCurrentView:i}=e,{application:t,getView:o,validateApplication:a,isValidatingApplication:d}=(0,u.YY)(),{triggerMessage:s}=(0,f.d)(),[c,p]=(0,v.useState)(!1),{codatCompanyId:m,onConnection:h,onClose:g,onError:y,onFinish:I}=(e=>{var n,i;let{application:t}=(0,u.YY)(),l=null==t||null==(n=t.organization)?void 0:n.codatCompanyId,{triggerCustomerServiceError:o}=(0,ef.A)(),[a,{loading:r,error:d}]=(0,ey.n)(tF,{onError:e=>{console.error(e),o(U.jP)}});return(0,v.useEffect)(()=>{(null==t?void 0:t.organization)&&!l&&a({variables:{applicationId:t.id}})},[null==t||null==(i=t.organization)?void 0:i.id]),{codatCompanyId:l,isCreatingCodatCompany:r,errorCreatingCodatCompany:d,onConnection:e=>{var n;
1let{connectionId:i}=e;null==(n=window.heap)||n.track("Codat connection created",{connectionId:i,codatCompanyId:l})},onClose:()=>{var n;return null==(n=window.heap)||n.track("Codat closed",{codatCompanyId:l}),e()},onFinish:()=>{var n;return null==(n=window.heap)||n.track("Codat flow completed",{codatCompanyId:l}),e()},onError:e=>{var n;null==(n=window.heap)||n.track("Codat error",{error:e,codatCompanyId:l}),tw.L.addError(Error(e))}}})(async()=>{try{p(!1),await a();let e=o();e?i(e):s(U.f9,{theme:"error"})}catch(e){s(U.f9,{theme:"error"})}});ec({allowBrowserNavigationToViews:[r.jn,r.sA,r.zx]});let A=null==t||null==(n=t.requiredActions)?void 0:n.find(e=>(null==e?void 0:e.type)==="missingFinancialDataConnections");if(!A){let e=o();return e?i(e):s(U.f9,{theme:"error"}),(0,l.Y)(W.A,{})}let b=A.data;return(0,l.FD)(l.FK,{children:[(0,l.Y)(tS,{isMissingAccountingData:b.includes("Accounting"),isMissingBankingData:b.includes("Banking"),isLoading:!m||d,onClick:()=>p(!0)}),m&&c&&(0,l.Y)(nh.A,{isOpen:c,canClose:!1,children:(0,l.Y)(tY,{companyId:m,onConnection:h,onFinish:I,onClose:g,onError:y})})]})},[r.tm.code]:e=>{var n,i,t,o,a,c,p,h,v;let{setCurrentView:g,uploadedDocumentType:f,satisfiedEddQuestionnaire:y,recentlyCompletedDocVId:I,previousView:b}=e,{application:C,products:S,userId:w,refetchApplication:x}=(0,u.YY)(),{documents:F,getVerificationRequirementCompletionStatus:Y,doesDocumentTypeSatisfyVerificationRequirement:T,isFieldDisabledForSelfServe:D}=tJ(),{routeToNextActionOrSubmitApplication:E}=j(),{config:k}=(0,s.UK)(),{persons:P,offerStatus:O}=C||{},{mockRequiredActions:R}=(0,m.useRouter)().query;C&&(0,tU.z)({application:C,event:"application.view.actionRequired",userId:w});let L=[...null!=(o=null==C?void 0:C.offerActions)?o:[],...null!=(a=null==C?void 0:C.preOfferActions)?a:[],...null!=(c=null==C?void 0:C.closingActions)?c:[]],N=L.filter(e=>"missingDocument"===e.type).map(e=>({...e,type:"missingDocument"})),B=L.filter(e=>"eddRequirement"===e.type),M=[...null!=(p=null==C?void 0:C.requiredActions)?p:[],...N,...B],V=no()(M,e=>{var n,i,t;return null!=(t=e.documentRequestId)?t:"".concat(e.type,":").concat(e.entityId,":").concat(e.entityType,":").concat(null==(n=e.data)?void 0:n.join(","),":").concat("referenceId"in e&&null!=(i=e.referenceId)?i:"")}),_=R&&"production"!==tX?(e=>{if(!e)return[];let n=e.persons.map(e=>({type:"eddRequirement",entityId:e.id,entityType:"person",data:["politicallyExposedPerson","professionalServicesProviderConsumer","frozenConsumerReport"]})),i=e.persons.map(e=>{let{id:n}=e;return{type:"automatedIdentityVerification",entityId:n,entityType:"person",data:[],dataObject:{provider:"alloyEvaluations-vouched",publicKey:"028d85e0-aa24-4ca1-99f2-90e3ee3f4e6b",entityToken:"mock-entity-token",requestedEvaluationId:"C56A4180-65AA-42EC-A945-5FD21DEC0538"}}}),t=e.organization&&{type:"eddRequirement",entityId:e.organization.id,entityType:"organization",data:["ngoOrCharity","professionalServicesProvider","cashIntensiveBusiness","atmOperator","nonBankingFinancialInstitution","politicalOrganization","marijuanaRelatedBusiness","unionOrganization"]},l={type:"eddRequirement",entityId:e.id,entityType:"application",data:[e.type.startsWith("consumer")?"consumerSingleDepositAccount":"businessSingleDepositAccount"]};return[...n,...i,t,e.organization&&{type:"missingDocument",entityId:e.organization.id,entityType:"organization",data:["llcProofOfName","llcProofOfAddress"]},l,{type:"rejectedInitialDeposit",entityId:e.id,entityType:"application",data:[]}].filter(Boolean)})(C):V.map(e=>{let{__typename:n,...i}=e;return i}).filter(e=>d.E.includes(e.type)),U=e=>{let{requiredAction:n,entityData:i}=e;switch(n.type){case"eddRequirement":return(e=>{let{requiredAction:{data:n,entityType:i},entityData:t}=e;return null==n?void 0:n.map(e=>{var n;return{type:"eddRequirement",name:e,entityType:"organization"===i&&t&&"type"in t?(0,G.KG)((null==t?void 0:t.type)||null):i,status:(null==(n=(e=>{var n,i;let{config:t,entityType:l,eddQuestionnaireType:o,entityData:a,application:r}=e,d=(e=>{switch(e){case"person":case"application":return e;case"organization":return"business";case"document":case"fundingTransaction":case"account":case"collateral":return null}})(l);if(!r||!d)return[];let s=(0,A.WK)(d),c=(e=>{var n,i,t,l,o,a,r,d,s,c,u,p,m,h,v,g,f,y,I,A,b,C,S,w,x,F,Y,T,D;let{entityType:E,entityData:k,application:P,config:O}=e,R=(0,ne.SP)(P.rawFields),L=(0,eS.rC)(null==P?void 0:P.rawFields),N=null==L||null==(n=L.find(e=>e&&"personId"in e?e.personId===(null==k?void 0:k.id):e&&"organizationId"in e&&e.organizationId===(null==k?void 0:k.id)))?void 0:n.role,B=(0,eS.qk)(null==P?void 0:P.rawFields);switch(E){case"person":{let e=P.consumerUnderwritingSnapshot,n=null==(t=P.organizations)||null==(i=t[0])?void 0:i.type,I=[{data:n?{type:n,isNonProfit:!!(null==(o=P.organizations)||null==(l=o[0])?void 0:l.isNonProfit),isPubliclyTraded:!!(null==(r=P.organizations)||null==(a=r[0])?void 0:a.isPubliclyTraded),allowlistCategory:null==(s=P.organizations)||null==(d=s[0])?void 0:d.allowlistCategory}:null,personRelationship:{isControlProng:!!(null==k?void 0:k.isControlProng),isOwnershipProng:!!(null==k?void 0:k.isOwnershipProng),isSoleProprietor:!!(null==k?void 0:k.isSoleProprietor),isTrustee:!!(null==k?void 0:k.isTrustee),isGrantor:!!(null==k?void 0:k.isGrantor)}}],A=null!=(g=null==(p=P.fields)||null==(u=p.skippedFields)||null==(c=u.find(e=>(null==e?void 0:e.personId)===k.id))?void 0:c.fields)?g:[];return(0,tT.H)({applicationType:P.type,originatingExperience:P.originatingExperience,isControlProngAuthorizedSigner:!!(null==(m=P.fields)?void 0:m.isControlProngAuthorizedSigner),isCreditUnionMember:!!(null==k?void 0:k.externalCoreMembershipId),isFiduciary:"fiduciary"===N,isBeneficiary:"benef
1iciary"===N,isNonresidentAlien:(null==k?void 0:k.usResidencyStatus)==="nonresidentAlienForScope",isMissingTaxId:(null==k?void 0:k.hasTaxId)===!1,isMinor:"minor"===N,isResidentAlien:(null==k?void 0:k.usResidencyStatus)==="residentAlien",hasUsAddress:null==k?void 0:k.hasUsAddress,accountInfo:R,role:N,kycEvaluationTags:(null==(v=P.personKycSnapshot)||null==(h=v.find(e=>(null==e?void 0:e.personId)===(null==k?void 0:k.id)))?void 0:h.tags)||[],contextOrganizations:I,skippedPersonFields:A,isAddingJointOwner:!1,purposeOfLoan:null!=(f=null==B?void 0:B.purposeOfLoan)?f:null,underwritingTags:null!=(y=null==e?void 0:e.filter(e=>e.personId===k.id).flatMap(e=>{var n;return null!=(n=e.tags)?n:[]}))?y:[]},O)}case"business":return(0,tD.e)({applicationType:P.type,originatingExperience:P.originatingExperience,isBusinessAccountVariant:!0,kycEvaluationTags:(null==(A=P.organizationKycSnapshot)||null==(I=A.find(e=>(null==e?void 0:e.organizationId)===(null==k?void 0:k.id)))?void 0:I.tags)||[],accountInfo:R,organizationType:null==k?void 0:k.type,taxIdType:(null==k?void 0:k.taxIdType)==="EIN"?"EIN":"SSN",isCreditUnionMember:!!(null==k?void 0:k.externalCoreMembershipId),allowlistCategory:null==k?void 0:k.allowlistCategory},O);case"application":return(0,e7.o)({applicationType:P.type,originatingExperience:P.originatingExperience,accountInfo:R,newAccountRelationshipD
1ata:(null==(b=P.fields)?void 0:b.newAccountRelationshipData)||void 0,organizationType:(null==(S=P.organizations)||null==(C=S[0])?void 0:C.type)||void 0,taxIdType:(null==(x=P.organizations)||null==(w=x[0])?void 0:w.taxIdType)||void 0,organizationKycEvaluationTags:P.organizationKycEvaluationTags||[],personKycEvaluationTags:P.personKycEvaluationTags||[],underwritingTags:[],closingStatus:null!=(F=P.closingStatus)?F:null,preOfferStatus:null!=(Y=P.preOfferStatus)?Y:null,offerStatus:null!=(T=P.offerStatus)?T:null,purposeOfLoan:null!=(D=null==B?void 0:B.purposeOfLoan)?D:null},O)}})({entityType:d,entityData:a,application:r,config:t}),u={...a,..."taxIdLastFour"in a&&a.taxIdLastFour&&{taxId:a.taxIdLastFour}},p=(0,tk.A)({config:t,entityType:d,scopes:c}),m=(0,tE.TO)({fields:null!=(i=null==(n=s[o])?void 0:n.topLevelFields)?i:[],fieldValues:u,fieldConfigs:p});return null==m?void 0:m.filter(e=>{let n=u[e];return Array.isArray(n)?!(null==n?void 0:n.length):!n&&!1!==n})})({config:k,entityType:i,eddQuestionnaireType:e,entityData:t,application:C}))?void 0:n.length)?"incomplete":"complete",isAnimated:y&&y.name===e&&(!y.entityId||y.entityId===(null==t?void 0:t.id)),[i]:t,onClick:()=>g({...t0[i],data:{name:e,person:"person"===i&&t,organization:"organization"===i&&t,application:C}})}})})({requiredAction:n,entityData:i});case"missingDocument":return(e=>{let{requiredAction:{data:n,entityType:i,rejectionNote:t,documentRequestId:l},entityData:o}=e;return l?[]:null==n?void 0:n.filter(e=>!D(e,i,o)).map(e=>({type:"missingDocument",name:e,entityType:"organization"===i&&o&&"type"in o?(0,G.KG)((null==o?void 0:o.type)||null):i,status:Y(e,i,o),isAnimated:f&&T({verificationRequirement:e,entityType:i,documentType:f,entityData:o}),...t&&{rejectionNote:t},[i]:o,onClick:()=>g({...r.Ge,data:{verificationRequirement:e,entityType:i,person:"person"===i&&o,organization:"organization"===i&&o,...t&&{rejectionNote:t}}})}))})({requiredAction:n,entityData:i});case"automatedIdentityVerification":return[(e=>{var n;let{requiredAction:{type:i,entityType:t,dataObject:l},entityData:o}=e,a=I&&I===(null==l?void 0:l.requestedEvaluationId)||(null==C||null==(n=C.documentVerificationCompletions.find(e=>{let{evaluationId:n}=e;return(null==l?void 0:l.requestedEvaluationId)===n}))?void 0:n.completions.includes(o.id));return{type:i,entityType:t,onClick:()=>{var e;g({...r.EW,data:{person:o,refetchApplication:x,complete:a,requiredActionDataObject:l,clientId:k.clientDetails.clientId,providerId:R?"alloyJourneys":(null==(e=k.kyc.documentVerification)?void 0:e.enabled)&&k.kyc.documentVerification.provider}})},status:a?"complete":"incomplete",person:o}})({requiredAction:n,entityData:i})];default:return[]}},q=e=>{let{entityType:n,entityData:i}=e;return _.filter(e=>e.entityType===n).filter(e=>"application"===e.entityType||i&&"id"in i&&e.entityId===(null==i?void 0:i.id)).flatMap(e=>U({requiredAction:e,entityData:i}))},H=(e,n)=>{var i;let t=((e,n)=>"application"===e?null==C?void 0:C.id:n&&"id"in n?n.id:void 0)(e,n);return(null!=(i=null==C?void 0:C.documentRequests)?i:[]).filter(n=>n.entityType===e&&n.entityId===t).map(i=>{var t;let l=_.some(e=>"missingDocument"===e.type&&e.documentRequestId===i.id),o=(null!=F?F:[]).some(e=>{var n;return(null==e||null==(n=e.meta)?void 0:n.documentRequestId)===i.id}),a=null==(t=_.find(e=>"missingDocument"===e.type&&e.documentRequestId===i.id))?void 0:t.rejectionNote;return{type:"missingDocument",name:i.name,entityType:i.entityType,status:!l||o?"complete":"incomplete",isAnimated:!1,...a&&{rejectionNote:a},...i.instructions&&{applicantNote:i.instructions},[e]:n,onClick:()=>g({...r.Ge,data:{verificationRequirement:i.requirementType,entityType:i.entityType,person:"person"===i.entityType&&n,organization:"organization"===i.entityType&&n,...a&&{rejectionNote:a},...i.instructions&&{applicantNote:i.instructions},documentRequestId:i.id}})}})},K=[...q({entityType:"application",entityData:null==C?void 0:C.fields}).filter(Boolean),...H("application",null==C?void 0:C.fields)],$=(null!=P?P:[]).flatMap(e=>[..._.filter(n=>n.entityId===e.id).filter(e=>(0,t_.hA)({application:C,requiredAction:e,userId:w,clientConfig:k})).flatMap(n=>U({requiredAction:n,entityData:{...e,...null==e?void 0:e.rawFields}})),...(0,t_.$k)({application:C,personId:e.id,userId:w,clientConfig:k})?H("person",{...e,...null==e?void 0:e.rawFields}
1):[]]).filter(Boolean),Q=(null!=(h=null==C||null==(n=C.fields)?void 0:n.accounts)?h:[]).map(e=>e.referenceId),J=(null!=(v=null==C?void 0:C.requirements)?v:[]).filter(e=>"kycVerification"===e.type).sort((e,n)=>Q.indexOf(e.accountReferenceId)-Q.indexOf(n.accountReferenceId)),Z=e=>{var n,i;let t=e?null==C||null==(i=C.fields)||null==(n=i.accounts)?void 0:n.find(n=>n.referenceId===e):null,l=(null==t?void 0:t.productId)?(0,z.Jhp)({product:k.products[t.productId],accountVariant:t.accountVariant}):null;if(null==l?void 0:l.name)return(null==t?void 0:t.accountName)?"".concat(l.name," (").concat(t.accountName,")"):l.name},X=[...J.map(e=>{let{accountReferenceId:n,status:i}=e,t=Z(n),l="complete"===i;return{type:"rejectedInitialDeposit",accountReferenceId:null!=n?n:void 0,subtitle:t,status:l?"complete":void 0,isAnimated:(null==b?void 0:b.code)===r.f0.code&&l,onClick:()=>g({...r.f0,data:{hasFailedFunding:!0,accountIdToEdit:null!=n?n:void 0}})}}),...(_||[]).filter(e=>"missingInitialDeposit"===e.type).map(e=>{var n;let i="referenceId"in e&&null!=(n=e.referenceId)?n:null,t=Z(i);return{type:e.type,accountReferenceId:null!=i?i:void 0,subtitle:t,status:void 0,isAnimated:!1,onClick:()=>g({...r.f0,data:{hasFailedFunding:!0,accountIdToEdit:null!=i?i:void 0}})}})],ee=async()=>E();if(!C)return(0,l.Y)(W.A,{});if(!(null==C||null==(i=C.organizations)?void 0:i.length))return(0,l.Y)(tM,{products:S,applicationActions:K,personActions:$,fundingActions:X,application:C,onSubmit:ee});let en=null==C||null==(t=C.organizations)?void 0:t.flatMap(e=>e&&[...q({entityType:"organization",entityData:{...e,...null==e?void 0:e.rawFields}}),...H("organization",{...e,...null==e?void 0:e.rawFields})]).filter(Boolean);return(0,l.Y)(tV,{products:S,applicationActions:K,organizationActions:en,personActions:$,fundingActions:X,offerStatus:O,onSubmit:ee})},[r.Es.code]:t6,[r.se.code]:e=>{var n,i,t,o;let{setCurrentView:a}=e,{products:d,application:c,userId:p,applicationId:m,updateAutopayMethod:h,getView:g}=(0,u.YY)(),{config:f}=(0,s.UK)(),{funding:y,products:I}=f,A=y.iavProvider,b=(0,eS.qk)(null==c?void 0:c.rawFields),C=(null==b?void 0:b.productId)?(0,z.Jhp)({product:I[b.productId],accountVariant:b.accountVariant}):null,S=(null==d?void 0:d.some(e=>{var n;return null==(n=e.fundingMethods)?void 0:n.internalTransfer}))||!!(null==C||null==(i=C.autopay)||null==(n=i.autopayFundingMethods)?void 0:n.internalTransfer),[w,x]=(0,v.useState)(null==c?void 0:c.autopayFundingSource),F=(null==c?void 0:c.autopayRequirement)==="required",{fundingSources:Y,isLoadingFundingSources:T,createManualExternalAccount:D,updateExternalAccountHolderCategory:E}=(0,lS.Ay)({withAutopay:!0,includeInternalAccounts:!!S,organizationId:null==c||null==(t=c.organization)?void 0:t.id,queryOptions:{fetchPolicy:"cache-and-network"},productId:null==b?void 0:b.productId,accountVariant:null==b?void 0:b.accountVariant}),{triggerCustomerServiceError:k}=(0,ef.A)();ec({allowBrowserNavigationToViews:[r.zx,r.C3,r.zD,r.X6,r.S2,r.sA,r.n5,r.L5,r.jn,r.tm]});let P=null==c||null==(o=c.persons)?void 0:o.find(e=>e.id===p),R=Y.filter(e=>"InstantAccountVerificationFundingSource"===e.type||"CustomerInternalAccountFundingSource"===e.type).filter(Boolean),L=async e=>{try{let{data:n}=await D({variables:{fields:{...e}}}),i=null==n?void 0:n.createManualExternalAccount;return x(i),i}catch(e){k(U.b5);return}},N=async(e,n)=>{try{await E({variables:{externalAccountId:e,holderCategory:n}})}catch(e){throw k(U.Ye),e}},B=async()=>{await h({variables:{skipAutopay:!0,applicationId:m}}),a(g())},M=async e=>{let n=e.fundingSource.type;if(!["InstantAccountVerificationFundingSource","ManualAccountFundingSource","CustomerInternalAccountFundingSource"].includes(n))throw Error("Invalid autopay funding source type");let i="CustomerInternalAccountFundingSource"===n?{internalAccountId:e.fundingSource.id}:{externalAccountId:e.fundingSource.id};await h({variables:{autopayMethod:i,applicationId:m}}),a(g())};return c?"plaid"===A?(0,l.Y)(lx,{currentAccount:b,application:c,product:C,fundingSources:R,isLoadingFundingSources:T,person:P,selectedFundingSource:w,onSelectFundingSource:x,onExternalAccountSubmit:L,onSubmit:M,onSkipFunding:B,onCancel:()=>{x(null)}
1,isAutopayRequired:F,onUpdateExternalAccountHolderCategory:N}):(0,l.FD)(l.FK,{children:["Funding Provider ",A," is not supported"]}):(0,l.Y)(O.A,{})},[r.wS.code]:t6,[r.RQ.code]:()=>{var e,n,i;let{application:t,isLoadingApplication:a}=(0,u.YY)(),{routeToNextActionOrSubmitApplication:r}=j(),{config:d}=(0,s.UK)(),{triggerMessage:c}=(0,f.d)(),{setCurrentView:p,previousView:m}=(0,H.At)(),[h,{loading:v}]=(0,ey.n)(eA.MM);if(a)return(0,l.Y)(O.A,{});let{products:g}=d;if(!(null==t?void 0:t.fields))throw Error("no fields on application");let{accountVariant:y,productId:I,newAccountRelationshipData:A}=(null!=(i=null==t||null==(e=t.fields)?void 0:e.accounts)?i:[t.fields]).find(e=>{let n=(null==e?void 0:e.productId)&&g[e.productId];return!!n&&!!(null==e?void 0:e.accountVariant)&&"plan"in(0,o.Gm)(e.accountVariant,n)})||{};if(!y||!I||!A)throw Error("accountVariant, productID and NARDs are required");let b=g[I];if(!b)throw Error("product is required");let C=(0,o.Gm)(y,b),S=null==A?void 0:A.find(e=>e.isPrimaryEntity),w=null==t?void 0:t.persons.find(e=>S&&"personId"in S&&e.id===(null==S?void 0:S.personId));if(!w)throw Error("Primary person not found");let x="plan"in C?C.plan:void 0;(0,Q.Z1)(x,"no plan config");let F=null==w||null==(n=w.plans)?void 0:n.filter(e=>{var n,i,t,l,o,a;return(null==C?void 0:C.plan)&&(null==e||null==(n=e.fields)?void 0:n.type)===(null==(i=d.plans[C.plan])?void 0:i.type)&&(!(null==(t=d.plans[C.plan])?void 0:t.codes)||(null==(a=d.plans[C.plan])||null==(o=a.codes)?void 0:o.includes((null==e||null==(l=e.fields)?void 0:l.code)||"")))}),Y=async(e,n)=>{try{await h({variables:{beneficiaries:e,personId:w.id,applicationId:null==t?void 0:t.id,...n&&{decedentFields:n}}})}catch(e){c(U.Yx,{theme:"error"})}try{await r()}catch(e){c(U.FF,{theme:"error"})}};return(0,l.Y)(lX,{hasExistingPlans:!!(null==F?void 0:F.length),isLoading:v,planKey:x,onSubmit:Y,onBack:()=>m&&p(m)})},[r.Ge.code]:e=>{let{setCurrentView:n,goToPreviousView:i,verificationRequirement:t,entityType:o,person:a,organization:d,rejectionNote:s,applicantNote:c,documentRequestId:p}=e,{triggerMessage:m}=(0,f.d)(),{triggerCustomerServiceError:h}=(0,ef.A)(),{uploadDocument:v,isUploading:g,deleteDocument:y,isDeleting:I,getDocumentTypesForVerificationRequirement:A,documents:b}=tJ(),{application:C}=(0,u.YY)(),S=A(t,o,"organization"===o?d:a),w=null==b?void 0:b.filter(e=>{if(p){var n;return(null==e||null==(n=e.meta)?void 0:n.documentRequestId)===p}return S.some(n=>n.type===(null==e?void 0:e.type))}).filter(e=>"organization"===o?(null==e?void 0:e.organizationId)===(null==d?void 0:d.id):"person"===o?(null==e?void 0:e.personId)===(null==a?void 0:a.id):"application"===o&&(null==e?void 0:e.applicationId)===(null==C?void 0:C.id)),x=async e=>{var i;let{file:t,documentType:l}=e;eC(C);let s=null==(i=S.find(e=>e.type===l))?void 0:i.name;try{await v({variables:{file:t,documentType:l,name:s,entityType:o,applicationId:C.id,organizationId:null==d?void 0:d.id,personId:null==a?void 0:a.id,...p&&{documentRequestId:p}}}),n({...r.tm,data:{uploadedDocumentType:l}})}catch(e){e instanceof Array&&e.some(e=>"FILE_EMPTY_ERROR"===e.code)?m(U.Y2,{theme:"error"}):m(U.f9,{theme:"error"})}},F=async e=>{try{await y({variables:{id:null==e?void 0:e.id}})}catch(e){h(U.h5)}await y({variables:{id:null==e?void 0:e.id}})};return C?(0,l.Y)(oi,{verificationRequirement:t,application:C,person:a,organization:d||void 0,entityType:o,onSubmit:x,onCancel:i,isUploading:g,documents:w,onDelete:F,isDeleting:I,rejectionNote:null!=s?s:void 0,applicantNote:null!=c?c:void 0}):(0,l.Y)(W.A,{})},[r.EW.code]:e=>{let{setCurrentView:n,person:i,complete:t,requiredActionDataObject:o,providerId:a,clientId:d,refetchApplication:c}=e,{triggerMessage:u}=(0,f.d)(),{config:p}=(0,s.UK)(),m=((e,n)=>{var i;return"production"===n||"uat"===n&&(null==e||null==(i=e.kyc)?void 0:i.runUATInSandbox)===!1})(p,(0,oo.S)()),{requestedEvaluationId:h}=o,[g]=(0,ey.n)(os),y=()=>u(U.oH,{theme:"error"}),I=async e=>{await g({variables:{requestedEvaluationId:h,providerData:e}}).catch(y)},A={complete:t,handleError:y,person:i,onClose:I,requiredActionDataObject:o,clientId:d,isProductionKYC:m},b=(e=>{let{complete:n,handleError:i,person:t,onClose:l,requiredActionDataObject:o,isProductionKYC:a}=e,{colors:r}=eJ.Ay,{publicKey:d,entityToken:s}=o,c=()=>{let e=window.alloy;return e||(i(),null)},u="alloyContainerId",[p,m]=(0,v.useState)(n?"complete":"idle"),h=e=>{document.body.style.position="",document.body.style.top="",(null==e?void 0:e.status)==="complete"?(null==l||l(e),m("complete")):m("idle")};return{src:"https://scripts.alloy.com/2/2/alloy_sdk_bundle.js",launch:()=>{let e=c();e&&(document.body.style.position="fixed",document.body.style.top="-".concat(window.scrollY,"px"),e.open(h,u),m("launched"))},state:p,containerId:u,onLoad:()=>{var e;if(!t)return void i();let{firstName:n,lastName:l,addressPrimaryLine1:o,addressPrimaryLine2:u,addressPrimaryCity:p,addressPrimaryState:m,addressPrimaryZip:h,addressPrimaryCountry:v,dateOfBirth:g,id:f}=t,y={key:d,entityToken:s,externalEntityId:f,evaluationData:{nameFirst:n,nameLast:l,addressLine1:o,addressLine2:u,addressCity:p,addressState:m,addressPostalCode:h,addressCountryCode:v,birthDate:g},production:a,customStyle:{theme:{primaryColor:r.brand.primary,borderRadius:"4px",iconColor:r.brand.primary,textColor:r.grey7,successColor:r.green3,errorColor:r.red3}}};null==(e=c())||e.init(y)}}})(A),C=(e=>{let{complete:n,handleError:i,onClose:t,requiredActionDataObject:l={},isProductionKYC:o}=e,{publicKey:a,journeyToken:r,journeyApplicationToken:d,entityToken:s}=l,c=()=>{let e=window.alloy;return e||(i(),null)},u="alloyContainerId",[p,m]=(0,v.useState)(n?"complete":"idle"),h=e=>{var n,i;document.body.style.position="",document.body.style.top="",e&&(null==(i=e._embedded)||null==(n=i.events)?void 0:n.some(e=>{var n;return e.entity_token===s&&(null==(n=e._embedded.node.name)?void 0:n.toLowerCase().startsWith("document verification"))&&"completed_evaluation"===e.type}))?(null==t||t(e),m("complete")):m("idle")};return{src:"https://scripts.alloy.com/2/2/alloy_sdk_bundle.js",launch:()=>{let e=c();e&&(document.body.style.position="fixed",document.body.style.top="-".concat(window.scrollY,"px"),e.open(h,u),m("launched"))},state:p,containerId:u,onLoad:()=>{var e;let{colors:n}=eJ.Ay;if(!a||!r||!d||!s)return void i();let t={key:a,journeyToken:r,journeyApplicationToken:d,entityToken:s,isSingleEntity:!0,production:o,customStyle:{theme:{primaryColor:n.brand.primary,borderRadius:"4px",iconColor:n.brand.primary,textColor:n.grey7,successColor:n.green3,errorColor:n.red3}}};null==(e=c())||e.init(t)}}})(A),S={"alloyEvaluations-onfido":b,"alloyEvaluations-vouched":b,"alloyJourneys-onfido":C,"alloyJourneys-vouched":C,e2eMockProvider:(e=>{let{onClose:n}=e,[i,t]=(0,v.useState)("idle");return{src:"",launch:()=>{t("complete"),null==n||n({document_token_front:"nice",document_token_back:"test",document_token_selfie:"you",evaluation_token:"got",entity_token:"here",outcome:"daniel",status:"complete",evaluationAttempts:1})},state:i,containerId:"",onLoad:()=>{}}})(A),vouched:(e=>{let{complete:n,handleError:i,person:t,requiredActionDataObject:l,clientId:o,onClose:a}=e,[r,d]=(0,v.useState)(n?"complete":"idle"),{colors:s}=eJ.Ay,c="vouchedContainerId",u=(0,v.useRef)(),p=()=>{let e=u.current;return e||(i(),null)},m=e=>{let n=p();n&&(n.unmount("#".concat(c)),(null==e?void 0:e.status)==="completed"?(null==a||a(e),d("complete")):d("idle"))};return{src:null,launch:()=>{var e;return null==(e=p())?void 0:e.mount("#".concat(c)).then(()=>d("launched"))},state:r,containerId:c,onLoad:()=>{var e,n;if(!t)return void i();let{firstName:a,lastName:r}=t,{publicKey:d}=l,c={onDone:m,verification:{firstName:a,lastName:r}
1,appId:d,callbackURL:"https://webhooks.".concat((0,oo.C)(),".mantl.com/vouched/").concat(o),crossDevice:!0,crossDeviceQRCode:!0,crossDeviceSMS:!0,theme:{baseColor:s.brand.primary,iconColor:s.brand.primary,fontColor:s.grey7,secondaryButtonColor:s.brand.secondary,iconLabelColor:s.grey7}};u.current=null==(e=(n=window).Vouched)?void 0:e.call(n,c),p()}}})(A)}[a],[w,x]=or()({src:S.src,onload:S.onLoad});(0,v.useEffect)(()=>{S.src||S.onLoad()},[S.src]),(0,v.useEffect)(()=>{x&&y()},[x]);let F={launchSDK:S.launch,SDKState:S.state,SDKContainerId:S.containerId,goToPreviousView:()=>{let e="complete"===S.state;e&&c(),n({...r.tm,data:e?{recentlyCompletedDocVId:h}:void 0})}};return w?(0,l.Y)(O.A,{}):(0,l.Y)(ol,{...F})},[r.sZ.code]:e=>{let{name:n,organization:i,goToPreviousView:t,setCurrentView:o}=e,{triggerMessage:a}=(0,f.d)(),{application:d,updateOrganizationEddFields:s,isUpdatingOrganizationEddFields:c}=(0,u.YY)(),p=async e=>{eC(d);try{await s({variables:{organizationId:i.id,fields:e,applicationId:d.id}}),o({...r.tm,data:{satisfiedEddQuestionnaire:{name:n}}})}catch(e){a(U.f9,{theme:"error"})}};if(!d||!i)return(0,l.Y)(W.A,{});let m={...i,...i.rawFields};return(0,l.Y)(oc,{application:d,organization:i,eddQuestionnaireType:n,initialValues:m,onSubmit:p,onCancel:()=>t(),isUpdating:c})},[r.g.code]:e=>{let{name:n,person:i,goToPreviousView:t,setCurrentView:o}=e,{triggerMessage:a}=(0,f.d)(),{updatePersonEddFields:d,isUpdatingPersonEddFields:s,application:c,getView:p}=(0,u.YY)(),m=async e=>{try{await d({variables:{applicationId:null==c?void 0:c.id,personId:i.id,fields:e}});let t=p();(null==t?void 0:t.code)==="actionRequired"?o({...r.tm,data:{satisfiedEddQuestionnaire:{name:n,entityId:i.id}}}):o(t)}catch(e){a(U.f9,{theme:"error"})}};if(!c||!i)return(0,l.Y)(W.A,{});let h={...i,...i.rawFields};return(0,l.Y)(ou,{application:c,person:i,eddQuestionnaireType:n,initialValues:h,onSubmit:m,onCancel:()=>t(),isUpdating:s})},[r.zx.code]:e=>{var n,i,t,o,a,d;let{setCurrentView:p,editPersonsOnLoad:h,scrollToPerson:v,editOrganizationOnLoad:g,addressIneligible:y}=e;ec({allowBrowserNavigationToViews:[r.jn,r.wY,r.n5,r.L5,r.sA]});let{application:I,applicationType:A,products:b,userId:S,updateApplicationOrganizationFields:w,updatePerson:x,updatePersonWithOrganization:F,createOwner:Y,removeOwner:T,createPersonOnBupApplication:D,updatePersonOnBupApplication:E,removePersonFromBupApplication:k,validateApplication:P,getView:O}=(0,u.YY)(),{cancelApplication:R}=(0,ai.A)(),{triggerCustomerServiceError:L}=(0,ef.A)(),{clearMessages:N}=(0,f.d)(),{getPersonTaxId:B,getOrganizationTaxId:M}=am(),{config:z}=(0,s.UK)(),{query:V}=(0,m.useRouter)(),_=null!=(o=(0,eL.FF)("APP-1758-no-pii-enabled"))&&o,q=(0,eL.FF)("APP-2192-allow-unsynced-rels-enforceBusinessOwnership"),H=(null==I||null==(n=I.organization)?void 0:n.id)&&(null==I||null==(i=I.organization)?void 0:i.type)?{id:I.organization.id,type:I.organization.type,isPubliclyTraded:!!I.organization.rawFields.isPubliclyTraded}:null,K=!!I&&H&&om({organization:H,config:z,applicationType:null==I?void 0:I.type,accountInfo:(0,ne.SP)(I.rawFields),ownershipCollectionCanBeDisabled:_,originatingExperience:I.originatingExperience}),j=!!(null==I||null==(t=I.organization)?void 0:t.externalCoreId),W=async e=>{try{var n;let i=await w({variables:{fields:e,applicationId:null==I?void 0:I.id}});if(null==(n=i.missingFields)?void 0:n.length)return L(U.a4,{includePhoneMessage:!1});return i.data.updateApplicationOrganizationFields}catch(e){tw.L.addError(Error("Error updating organization"),{err:e,applicationId:null==I?void 0:I.id}),L(U.OU)}},$=async e=>{let{organization:n}=e;try{return await W(n)}catch(e){tw.L.addError(Error("Error saving BDCA app"),{err:e,applicationId:null==I?void 0:I.id}),L(U.OU)}},Q=async e=>{await $(e);let{data:n}=await P();return null==n?void 0:n.validateApplication},J=async e=>{var n,i,t,l;let{formData:o}=e;if(K&&"soleProprietorship"!==o.organization.type&&!(null==I||null==(n=I.persons)?void 0:n.find(e=>e.isControlProng))&&!j)return void L(U.t9,{includePhoneMessage:!1});if(((null==I?void 0:I.persons)||[]).filter(e=>e.isControlProng).length>1)return void L(U.ob,{includePhoneMessage:!1});if((null==I||null==(i=I.organization)?void 0:i.type)==="soleProprietorship"&&!(null==I||null==(t=I.persons)?void 0:t.find(e=>e.isSoleProprietor))&&K)return void L(U.BZ,{includePhoneMessage:!1});await $(o);let{data:a}=await P(),d=null==a?void 0:a.validateApplication;if(I&&(null==d||null==(l=d.requiredActions)?void 0:l.find(e=>"ineligibleRegion"===e.type))){await R({variables:{applicationId:I.id}}),p(r.Vj);return}let s="createAccount"===A&&d?(0,ah.A)(d,z,S,V):O(),c=s===r.tm&&(null==d?void 0:d.reviewStatus)==="actionRequired"?r.jn:s;c&&p(c)},Z=async e=>{var n;eC(I),N();let i=null==I||null==(n=I.organization)?void 0:n.type,t="soleProprietorship"!==i&&!(null==e?void 0:e.find(e=>e.isControlProng)),l=(e||[]).filter(e=>e.isControlProng).length>1;t&&L(U.t9,{includePhoneMessage:!1}),l&&L(U.ob,{includePhoneMessage:!1});let o=i&&(0,G.Zs)(i,e,z,!!q);o&&L(U.yS,{includePhoneMessage:!1}),t||o||l||p(r.jn)},X=async e=>{var n;eC(I);let i=await x({variables:{...e,applicationId:I.id}});return null==i||null==(n=i.data)?void 0:n.updatePerson},ee=async e=>{try{if(!await X(e))throw Error("updatePerson returned undefined or null")}catch(e){tw.L.addError(Error("Error updating person"),{err:e,applicationId:null==I?void 0:I.id}),L("Failed to update person. Please try again.");return}try{await P()}catch(e){tw.L.addError(Error("Error validating application"),{err:e,applicationId:null==I?void 0:I.id}),L("Failed to validate application. Please try again.");return}p(r.jn)},en=async e=>{eC(I);let n=(0,G.Pc)(z,!!q),i=!!(e.relationshipPersonOrganizationFields.isControlProng||e.relationshipPersonOrganizationFields.isSoleProprietor||e.relationshipPersonOrganizationFields.isOwnershipProng),t=j?e.hasOrganizationRelationship:K&&(!n||i);try{let{data:{updatePersonWithOrganization:n}}=await F({variables:{...e,hasOrganizationRelationship:t,applicationId:null==I?void 0:I.id}});return n}catch(e){tw.L.addError(Error("Error updating person with organization"),{err:e,applicationId:I.id}),L(U.F)}},ei=async e=>{let{id:n}=e;if(!n)return!0;try{if(!I)throw Error("No application exists to remove owner on.");let{data:e}=await T({variables:{personId:n,applicationId:I.id}});return null==e?void 0:e.removeOwner}catch(e){tw.L.addError(Error("Error removing owner"),{err:e,applicationId:null==I?void 0:I.id}),L(U.x5);return}},et=async e=>{let n=(0,G.Pc)(z,!!q),i=e.relationshipPersonOrganizationFields.isControlProng||e.relationshipPersonOrganizationFields.isSoleProprietor||e.relationshipPersonOrganizationFields.isOwnershipProng;
1try{let{data:{createOwner:t}}=await Y({variables:{...C()(e,["fields","relationshipPersonOrganizationFields"]),hasOrganizationRelationship:!j&&(!n||i),applicationId:null==I?void 0:I.id}});return t}catch(e){tw.L.addError(Error("Error creating owner"),{error:e,applicationId:null==I?void 0:I.id}),L(U.Dd)}},el=async e=>{let n=await (e.personId?en(e):et(e));return n&&av(n,S)},eo=async e=>{eC(I);try{let{data:{createPersonOnBupApplication:n}}=await D({variables:{applicationId:I.id,...e}});return n}catch(e){tw.L.addError(Error("Error creating BUP person"),{err:e,applicationId:null==I?void 0:I.id}),L(U.Dd)}},ea=async e=>{eC(I);try{let{data:{updatePersonOnBupApplication:n}}=await E({variables:{...e,applicationId:I.id}});return n}catch(e){tw.L.addError(Error("Error updating BUP person"),{err:e,applicationId:null==I?void 0:I.id}),L(U.F)}},er=async e=>{eC(I);try{let{data:{removePersonFromBupApplication:n}}=await k({variables:{personId:e.id,applicationId:I.id}});return n}catch(e){tw.L.addError(Error("Error removing BUP person"),{err:e,applicationId:null==I?void 0:I.id}),L(U.x5)}},ed=async e=>{let n=await (e.personId?ea(e):eo(e));return n&&av(n,S)},es=((e,n)=>i=>{(0,c.QO)(i);let{formUpdate:t,state:l,saveOnBlur:o}=i;if("error"!==l&&o)return t.person?n({person:{personId:e,fields:t.person}}):n(t)})(S||"",e=>"businessDepositCreateAccount"===A&&e.organization?$(e):"businessDepositAddAuthorizedSigner"===A&&e.person?X(e.person):void 0),eu=null==b?void 0:b.map(e=>e.name).join(", ");switch(A){case"businessUpdatePersons":return(0,l.Y)(oO,{userId:S,application:I,organizationType:null==I||null==(a=I.organization)?void 0:a.type,organizationTaxIdType:null==I||null==(d=I.organization)?void 0:d.taxIdType,persons:null==I?void 0:I.persons,onSubmit:Z,onPersonSubmit:ed,onPersonRemove:er,editPersonsOnLoad:h,scrollToPerson:v,onFieldBlur:es,getPersonTaxId:B});case"businessDepositAddAuthorizedSigner":return(0,l.Y)(oL,{productName:eu,application:I,onSubmit:ee,onFieldBlur:es,getPersonTaxId:B});case"businessDepositCreateAccount":case"createAccount":return(0,l.Y)(an,{application:I,userId:S,onSubmit:J,validateOrganizationApplicationAddress:Q,onOwnerSubmit:el,onOwnerRemove:ei,editPersonsOnLoad:h,scrollToPerson:v,editOrganizationOnLoad:g,onFieldBlur:es,onSectionLoad:c.vH,onSectionStateChange:c.d6,getPersonTaxId:B,getOrganizationTaxId:()=>{var e,n;return(null==I||null==(e=I.organization)?void 0:e.id)?M(null==I||null==(n=I.organization)?void 0:n.id):tq.noop},addressIneligible:y});default:return null}},[r.zD.code]:aM,[r.S2.code]:aM,[r.C3.code]:aM,[r.X6.code]:aM,[r._9.code]:e=>{let{setCurrentView:n}=e,{triggerMessage:i}=(0,f.d)(),{application:t,updateOrganizationFields:o,isUpdatingOrganizationFields:a,updatePersonWithOrganization:d,isUpdatingPersonWithOrganization:s,validateApplication:c,isValidatingApplication:p,getView:m}=(0,u.YY)();if(ec({allowBrowserNavigationToViews:[r.jn,r.wY,r.n5,r.L5,r.sA]}),!t)return(0,l.Y)(eu.A,{});let h=async e=>{try{var l,a;let r=er()(e,"organization"),s=0!==es()(r)?(e=>{try{return Object.entries(e).map(e=>{let[n,i]=e;if(!i.creditUnionEligibilityCriteria)return null;let l=t.persons.find(e=>e.id===n),o={isControlProng:null==l?void 0:l.isControlProng,isOwnershipProng:null==l?void 0:l.isOwnershipProng,isSoleProprietor:null==l?void 0:l.isSoleProprietor,ownershipPercentage:null==l?void 0:l.ownershipPercentage,title:null==l?void 0:l.title,type:null==l?void 0:l.type};return d({variables:{applicationId:t.id,personId:n,fields:i,hasOrganizationRelationship:!0,relationshipPersonOrganizationFields:o}})})}catch(e){i(U.f9,{theme:"error"});return}})(r):null,u=o({variables:{fields:{...e.organization,type:null==(l=t.organization)?void 0:l.type,taxIdType:null==(a=t.organization)?void 0:a.taxIdType}}});await Promise.all([...null!=s?s:[],u]),await c();let p=m();p&&n(p)}catch(e){i(U.f9,{theme:"error"})}};return(0,l.Y)(eo,{onSubmit:h,application:t,isSubmitting:a||s||p})},[r.n5.code]:()=>{var e,n;let{triggerMessage:i}=(0,f.d)(),{routeToNextActionOrSubmitApplication:t}=j(),{application:o,updateApplicationEddFields:a,isUpdatingApplicationEddFields:r,isValidatingApplication:d}=(0,u.YY)(),s=(null==o?void 0:o.requiredActions)&&(null==(n=o.requiredActions.find(e=>(null==e?void 0:e.type)==="eddRequirement"&&(null==e?void 0:e.entityType)==="application"))||null==(e=n.data)?void 0:e[0]);if(!(null==o?void 0:o.fields)||!s)return(0,l.Y)(W.A,{});let c=async e=>{try{await a({variables:{fields:e,applicationId:null==o?void 0:o.id}}),await t()}catch(e){i(U.f9,{theme:"error"})}};return(0,l.Y)(az,{application:o,eddQuestionnaireType:s,initialValues:o.fields,onSubmit:c,submitText:"Continue",isUpdating:r||d,skipRequirement:!1})},[r.ff.code]:eu.A,[r.rK.code]:e=>{let{name:n,goToPreviousView:i,setCurrentView:t}=e,{triggerMessage:o}=(0,f.d)(),{application:a,updateApplicationEddFields:d,isUpdatingApplicationEddFields:s}=(0,u.YY)(),c=async e=>{eC(a);try{await d({variables:{fields:e,applicationId:a.id}}),t({...r.tm,data:{satisfiedEddQuestionnaire:{name:n}}})}catch(e){o(U.f9,{theme:"error"})}};return(null==a?void 0:a.fields)?(0,l.Y)(az,{application:a,eddQuestionnaireType:n,initialValues:a.fields,onSubmit:c,onCancel:()=>i(),isUpdating:s,skipRequirement:!1}):(0,l.Y)(W.A,{})}
1,[r.yz.code]:t6,[r.DU.code]:t6,[r.DE.code]:t6,[r.w3.code]:t6,[r.a7.code]:t6,[r.KG.code]:t6,[r.F5.code]:W.A,[r.cT.code]:t6,[r.QL.code]:e=>{var n,i,t,o,a,d,c,p,h,g;let{setCurrentView:y,accountId:I}=e,A=null!=(p=(0,eL.FF)("enh-505-update-account"))&&p,b=null!=(h=(0,eL.FF)("APP-1027-bulk-account"))&&h,C=(0,m.useRouter)(),{config:{mantlFeatures:{accountOpening:S}}}=(0,s.UK)();ec({allowBrowserNavigationToViews:[r.GX]});let{application:w,applicationId:x,userId:F,products:Y,isLoadingApplication:T}=(0,u.YY)({includeAccounts:!0}),D="string"==typeof C.query.accountId&&C.query.accountId||I||(null==w||null==(n=w.fields)?void 0:n.accountId)||(null==w||null==(i=w.fields)?void 0:i.createdAccountId)||void 0;(0,v.useEffect)(()=>{b&&I&&C.query.accountId!==I&&C.replace({query:{...C.query,accountId:I,view:r.QL.code}},void 0,{shallow:!0})},[C.query.accountId,I]);let{account:E,inviteNewAuthorizedSigner:k,inviteExistingPersonAsAuthorizedSigner:P,removePersonFromAccount:O,inviteSecondaryOwner:R,createUpdateAccountApplication:L,sendReminderCompletionRequest:N,cancelApplication:B,isReminding:M,isCanceling:V,loading:_,accountError:q,refetchAccount:K}=tA({applicationId:x,accountId:D,queryOptions:{fetchPolicy:"cache-and-network",skip:!w}}),j=sI({accountId:D}),{enrollmentIntegrations:G}=sD({applicationId:x,accountId:D}),{loadingIndicationsOfInterest:$,createDirectDepositLinkToken:Z,isCreatingDirectDepositLinkToken:X,currentUserIndicationsOfInterest:ee,requestIndicationOfInterest:en,removeIndicationOfInterest:ei,membershipServiceIds:et}=sg({applicationId:x,userId:F,accountId:null==E?void 0:E.id,queryOptions:{fetchPolicy:"cache-and-network"}}),{eligibleServices:el}=sF({accountId:null==E?void 0:E.id}),{cardHolders:eo}=sy({accountId:D}),{getOrCreateProductApplication:ea,setAndGoToApplication:er}=(0,t2.A)(),{triggerMessage:ed}=(0,f.d)(),{triggerCustomerServiceError:es}=(0,ef.A)(),{resetCurrentView:ep}=(0,H.At)(),[em]=(0,ey.n)(d7),{handleLoginSuccess:eh}=null!=(g=(0,d3.J)())?g:{},{getPersonTaxId:ev}=am(),[eg,eI]=(0,v.useState)(E),{crossSellAccountVariantProduct:eA,crossSellAccountVariant:eb}=(e=>{var n,i,t,l,o,a;let{application:r,products:d,userId:c}=(0,u.YY)(),{config:p}=(0,s.UK)(),{productIsEnabled:m,validateProductEligibility:h,validateProductEligibilityResult:g}=(0,t2.A)(),f=null==e||null==(n=e.fields)?void 0:n.accountVariant,y=null==d?void 0:d.find(n=>{var i;return n.id===(null==e||null==(i=e.fields)?void 0:i.productId)&&n.accountVariantName===f}),I=y&&p.products[y.id],A=I&&(null==(i=(0,eT.y)(I,f))?void 0:i.crossSellProductId),b=A?p.products[A]:void 0,C=t1({selectedProduct:y,counterOfferOrCrossSellProduct:b,accountVariant:null==e||null==(t=e.fields)?void 0:t.accountVariant,variantType:"crossSellAccountVariant"}),S=b?(0,z.Jhp)({product:b,accountVariant:C}):void 0,w=null==r||null==(l=r.persons)?void 0:l.find(e=>e.id===c),x=!!(null==w?void 0:w.isControlProng),F=(null==y?void 0:y.customerType)!=="business"||x,Y=(null==g||null==(a=g.data)||null==(o=a.validateProductEligibility)?void 0:o.status)==="GOOD";return(0,v.useEffect)(()=>{if(b&&m(b)&&F){var e;h({variables:{productId:b.id,customerType:b.customerType,organizationId:null==r||null==(e=r.organization)?void 0:e.id,applicationType:null==r?void 0:r.type,accountVariant:C,role:null==w?void 0:w.applicationRole}})}},[b]),{crossSellAccountVariantProduct:Y&&C?S:void 0,crossSellAccountVariant:Y?C:void 0}})(null!=eg?eg:null);eg&&(0,tU.Eq)({account:eg}),(0,v.useEffect)(()=>{E&&eI({...E})},[E]),(0,v.useEffect)(()=>{w&&!E&&K()},[w]);let{navigateToMyApplications:eC}=(0,sE.A)(),eS=null==el?void 0:el.find(e=>"directDeposit"===e.type),{isPinwheelModalOpen:ew,pinwheelToken:ex,handleOpenPinwheelModal:eF,onPinwheelLogin:eD,onPinwheelExit:eE,onPinwheelError:ek,onPinwheelSuccess:eP,isWaitingForPinwheelToken:eO}=(e=>{let{isEligibleForDirectDepositSwitch:n,directDepositService:i,existingDirectDepositSwitchIoi:t,createDirectDepositLinkToken:l,isCreatingDirectDepositLinkToken:o,requestIndicationOfInterest:a,accountId:r}=e,[d,s]=(0,v.useState)(!1),[c,u]=(0,v.useState)(void 0),[p,m]=(0,iZ.A)("pinwheelData",null),{triggerCustomerServiceError:h}=(0,ef.A)();if(!r)return{};let g=()=>{u(void 0),s(!1)},f=async()=>{try{if(!i)return;if(!(null==p?void 0:p.pinwheelAccountId))return void console.error("Pinwheel account ID is required to create a pending IOI",p);await a({type:"directDeposit",serviceId:i.id,pinwheelAccountId:p.pinwheelAccountId,status:"pending"})}catch(e){h(U.hI)}},y=async function(){let{reAuthenticate:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n&&!o)if(e)return l();else{var i,a;if(e||c)return c;return l(null!=(a=null==t||null==(i=t.fields)?void 0:i.pinwheelAccountId)?a:null==p?void 0:p.pinwheelAccountId)}};return{isPinwheelModalOpen:d,pinwheelToken:c,handleOpenPinwheelModal:async e=>{let{reAuthenticate:n=!1}=e,i=await y({reAuthenticate:n});i&&(s(!0),u(i))},onPinwheelLogin:async e=>{let{accountId:n}=e;return m({accountId:r,pinwheelAccountId:n}
1)},onPinwheelExit:()=>g(),onPinwheelError:async e=>{let{pendingRetry:n}=e;n&&await f(),g()},onPinwheelSuccess:async e=>{let n,t,{accountId:l,params:o}=e,r=!!(null==o?void 0:o.action);if(i){if((null==o?void 0:o.action)==="partial_switch"){if(n=o.allocation.type,"amount"===o.allocation.type||"percentage"===o.allocation.type){var d,s;t=null==(s=o.allocation)||null==(d=s.value)?void 0:d.toString()}}else(null==o?void 0:o.action)==="full_switch"&&(n="percentage",t="100");try{await a({type:"directDeposit",serviceId:i.id,pinwheelAccountId:l,pinwheelAllocationType:n,pinwheelAllocationValue:t,...r&&{status:"complete"}})}catch(e){console.error(e)}g()}},isWaitingForPinwheelToken:!c&&o}})({isEligibleForDirectDepositSwitch:!!eS&&!!(null==(t=S.directDepositSwitch)?void 0:t.enabled),directDepositService:eS,existingDirectDepositSwitchIoi:null==ee?void 0:ee.find(e=>"directDeposit"===e.type&&(null==E?void 0:E.id)===e.accountId),createDirectDepositLinkToken:Z,isCreatingDirectDepositLinkToken:X,requestIndicationOfInterest:en,accountId:null==E?void 0:E.id}),eR=$||!el,eN=null==w||null==(d=w.fields)||null==(a=d.personIdMapping)||null==(o=a.find(e=>(null==e?void 0:e.syncedPersonId)===F))?void 0:o.applicationPersonId,eB=null==w||null==(c=w.persons)?void 0:c.find(e=>e.id===(eN||F)),eM=(0,v.useCallback)(async e=>{let n;if(!x)return void es(U.Fl);if((null==eB?void 0:eB.hasTaxId)&&eB.id)try{let e=await ev(eB.id);e&&(n=e)}catch(e){tw.L.addError(e,{coreSyncEmailLoginTaxIdLookupFailed:!0})}let i=(0,eY.C)(null==eB?void 0:eB.dateOfBirth),t=(0,eY.s6)(i);if(!n&&!t){tw.L.addError(Error("initiateCoreSyncEmailLogin skipped: no taxId and no parseable dateOfBirth"),{coreSyncEmailLoginMissingPii:!0,applicantHasTaxId:!!(null==eB?void 0:eB.hasTaxId),applicantDateOfBirthFieldPresent:!!(null==eB?void 0:eB.dateOfBirth),parsedDateOfBirthIsIsoFormat:t}),es(U.Ex);return}let l=n?{taxId:n}:{dateOfBirth:i},o={loginProfilePii:l,postOtpRedirect:((e,n)=>{let i={pathname:"/application/".concat(e,"/").concat(r.QL.code),additionalQuery:{},viewData:{},view:r.QL};return void 0!==n&&""!==n&&(i.additionalQuery.accountId=n,i.viewData.accountId=n),i})(x,D)};try{var a,d,s;let n=await em({variables:{applicationId:x,syncedPersonId:e,...l},errorPolicy:"all"}),i=null==(d=n.data)||null==(a=d.initiateCoreSyncEmailLogin)?void 0:a.state;if(null==(s=n.errors)?void 0:s.length)return void es(U.Fl);if((0,Q.Z1)(i,"initiateCoreSyncEmailLogin did not return state"),"expectingTin"===i||"expectingDoB"===i)es(U.sF),ep();else if("coreSyncMemberEmailMissing"===i)es(U.ww);else if("rejected"===i)y({...r.AR,data:o});else if("succeeded"===i)throw Error("initiateCoreSyncEmailLogin returned succeeded; OTP completion must use updateAuthenticationFlow");else if("expectingOtp"===i){null==eh||eh();let e=(0,d4.c)(i);y({...e,data:o})}else{let e=(0,d4.c)(i);y({...e,data:o})}}catch(e){tw.L.addError(e,{coreSyncEmailLoginMutationFailed:!0}),es(U.Fl)}},[D,x,null==eB?void 0:eB.dateOfBirth,null==eB?void 0:eB.hasTaxId,null==eB?void 0:eB.id,ev,eh,em,ep,y,es]);if(q)return(0,l.Y)(eu.A,{});let ez=!(null==eg?void 0:eg.id)&&_||!(null==eg?void 0:eg.id)||!eB;if(T||ez||eR)return(0,l.Y)(W.A,{});let eV=(null==Y?void 0:Y.length)===1?Y[0]:null==Y?void 0:Y.find(e=>{var n;return e.id===(null==E||null==(n=E.fields)?void 0:n.productId)}),e_=Object.keys((null==eV?void 0:eV.accountVariants)||{}).reduce((e,n)=>{let i=null==eV?void 0:eV.accountVariants[n];return"jointAdult"===i.ownershipType&&(e[n]=i),e},{}),eU=async e=>{let{applicationId:n}=e;try{await N({variables:{applicationId:n}}),ed("Reminder sent",{theme:"success"})}catch(e){es(U.kD)}},eq=async e=>{let{applicationId:n}=e;try{await B({variables:{applicationId:n}}),ed("Application canceled",{theme:"success"})}catch(e){es(U.cp)}},eH=async e=>{let{relationshipPersonAccountId:n}=e;try{await O({variables:{relationshipPersonAccountId:n}}),ed("Signer removed from account",{theme:"success"})}catch(e){es(U.ac)}},eK=async e=>{var n;let i=await ea({product:e,organizationId:null==w||null==(n=w.organization)?void 0:n.id,accountVariant:eb});if(!i)return void es(U.Iq);er(i)},ej=async e=>{let{ioiRequestData:n,successMessage:i}=e;try{await en(n),ed(i,{theme:"success"})}catch(e){ed(U.hI,{theme:"error"})}},eW=async e=>{let{id:n,removeMessage:i}=e;try{await ei({id:n}),ed(i,{theme:"success"})}catch(e){ed(U.hg,{theme:"error"})}},eG=async e=>
1{let{beneficiary:n,service:i,beneficiaryIoiRequestData:t}=e;if((null==i?void 0:i.type)==="beneficiary"&&i.collectSignature)return void y({...r.kz,data:{beneficiaries:n,service:i,accountId:I,createBeneficiaryCdaso:!0}});if(t)try{var l,o;await en({...t,accountId:D});let e=Array.isArray(null==t?void 0:t.beneficiary)&&(null==t||null==(l=t.beneficiary)?void 0:l.length)?null==t||null==(o=t.beneficiary)?void 0:o[0]:null,n=e?(0,J.L)(e):"beneficiary",a=(null==i?void 0:i.confirmation)?null==i?void 0:i.confirmation:"Request submitted to add ".concat(n," as your ").concat((null==i?void 0:i.type)==="beneficiary"?"primary":"contingent"," beneficiary.");ed(a,{theme:"success"})}catch(n){let e=d5(n);if(e)return{beneficiaryConflicts:e};ed(U.hI,{theme:"error"})}else y({...r.kz,data:{beneficiaries:n,service:i,accountId:I}})};return(0,l.FD)(l.FK,{children:[(0,l.Y)(d1,{account:eg,organization:null==w?void 0:w.organization,applicant:eB,application:w,product:eV,indicationsOfInterest:ee,cardHolders:eo,eligibleServices:el,crossSellProduct:eA,onOpenPinwheelModal:eF,isWaitingForPinwheelToken:eO,onRequestIndicationOfInterest:ej,onRemoveIndicationOfInterest:eW,onRequestBeneficiary:eG,onInvite:e=>async n=>{let{emailPrimary:i,firstName:t,isExistingPerson:l=!1,personId:o}=n;if(eg&&eV)try{e?l&&o?await P({variables:{personId:o,accountId:eg.id}}):await k({variables:{emailPrimary:i,firstName:t,accountId:eg.id}}):A?await L({variables:{emailPrimary:i,firstName:t,accountId:eg.id,accountVariant:Object.keys(e_)[0],productId:eV.id}}):await R({variables:{emailPrimary:i,firstName:t,accountId:eg.id}}),ed("Invitation sent",{theme:"success"})}catch(e){es(U.kD)}else es(U.kD)},onResendInvite:eU,onCancelInvite:eq,onRemoveAuthorizedSigner:eH,isReminding:M,isCanceling:V,onCrossSellProductClick:eK,continuationButtons:j,onClickViewApplications:eC,onGoToNewAccounts:()=>y(r.GX),onGoToAddJointOwners:()=>y({...r.gN,data:{accountId:eg.id}}),userId:F,enrollmentHooks:{useCheckUsername:sO,useEnrollmentPreflow:sB,useEnrollUser:sU},enrollmentIntegrations:G,membershipServices:et,onSendCoreSyncLoginCode:eM}),ex&&(0,l.Y)(d2.A,{linkToken:ex,open:ew,onExit:eE,onSuccess:eP,onLogin:eD,onError:ek})]})},[r.Ec.code]:mE.h,[r.GX.code]:e=>{let{setCurrentView:n}=e,{application:i,applicationId:t,userId:o}=(0,u.YY)({includeAccounts:!0}),a=sI({}),{enrollmentIntegrations:d}=sD({applicationId:t}),{navigateToMyApplications:s}=(0,sE.A)(),{currentUserIndicationsOfInterest:c}=sg({applicationId:t,userId:o,queryOptions:{fetchPolicy:"cache-and-network"}});return i?(0,l.Y)(sH,{accounts:i.accounts||[],indicationsOfInterest:c||[],onGoToAccount:e=>{n({...r.QL,data:{accountId:e}})},onClickViewApplications:s,continuationButtons:a,enrollmentIntegrations:d,enrollmentHooks:{useCheckUsername:sO,useEnrollmentPreflow:sB,useEnrollUser:sU}}):(0,l.Y)(O.A,{})},[r.kz.code]:sJ,[r.Vp.code]:e=>{var n,i,t,o,a;let{setCurrentView:d,goToPreviousView:c}=e,{config:p}=(0,s.UK)(),{application:m,applicationId:h,userId:v}=(0,u.YY)(),g=null!=(t=null==m||null==(n=m.fields)?void 0:n.accountId)?t:null==m||null==(i=m.fields)?void 0:i.createdAccountId,f=(0,r8.As)(null!=(o=null==m?void 0:m.rawFields)?o:{}),{eligibleServices:y}=sF({accountId:g}),{beneficiariesOnPreBookedApplication:I,loadingIndicationsOfInterest:A}=sg({applicationId:h,userId:v,accountId:g}),b=f?Object.values(null!=(a=p.services)?a:{}).find(e=>aG.ab.includes(e.type)):y.find(e=>aG.ab.includes(e.type));return A||!b?(0,l.Y)(W.A,{}
1):(0,l.Y)(sJ,{beneficiaries:I.map(e=>({...e})),service:b,successView:r.jn,goToPreviousView:c,setCurrentView:d})},[r.Vj.code]:t6,[r.f0.code]:ch,[r.jn.code]:e=>{var n,i,t,a,d,c,p,m,h,g,y,I,A,b,C;let{setCurrentView:S,previousView:w}=e,{config:x}=(0,s.UK)(),{triggerMessage:F}=(0,f.d)(),{application:Y,applicationId:T,applicationType:D,submitApplication:E,submitApplicationMutation:{loading:k},updatePerson:P,refetchApplication:O,attestationFields:R,signatureFields:L,userId:N,updateCreateAccountApplicationFields:B}=(0,u.YY)(),{cancelApplication:M}=(0,ai.A)(),{account:z,loading:V}=tA({applicationId:null==Y?void 0:Y.id,accountId:null==Y||null==(n=Y.fields)?void 0:n.accountId,queryOptions:{skip:!(null==Y?void 0:Y.isMultiApplicantsCDASO)&&!(0,r8.As)(null!=(y=null==Y?void 0:Y.rawFields)?y:{})}}),{eligibleServices:_}=sF(),q=(e=>{let[n]=(0,ey.n)(uW),i=(0,v.useRef)();return(0,v.useCallback)(t=>{e&&i.current!==e&&(i.current=e,n({variables:{input:{applicationId:e,...t}}}).catch(e=>{console.error("Failed to push compliance shadow view event",e)}))},[e,n])})(null==Y?void 0:Y.id),{beneficiariesOnPreBookedApplication:H,currentUserIndicationsOfInterest:K,requestIndicationOfInterest:j}=sg({applicationId:T,userId:N,accountId:null!=(I=null==Y||null==(i=Y.fields)?void 0:i.accountId)?I:null==Y||null==(t=Y.fields)?void 0:t.createdAccountId}),{getPersonTaxId:G,getOrganizationTaxId:$,getTaxReportingTaxId:Q,getPlanBeneficiaries:J,getDecedentFields:Z}=am(),{triggerCustomerServiceError:X}=(0,ef.A)(),{updateApplicationWithSignificantParty:ee}=eb(),{updateExternalAccountHolderCategory:en}=(()=>{let[e]=(0,ey.n)(lS.yR);return{updateExternalAccountHolderCategory:e}})();ec({allowBrowserNavigationToViews:[r.zx,r.C3,r.zD,r.S2,r.sA,r.n5,r.L5,r.wY,r.ei]});let ei=!!(null==(d=x.mantlFeatures.accountOpening)||null==(a=d.nonControlProngBusinessApplicant)?void 0:a.enabled),et=(null!=(A=null==Y||null==(p=Y.fields)||null==(c=p.accounts)?void 0:c.length)?A:0)>1?null:null!=(b=null==_?void 0:_.find(e=>"updateInformation"===e.type))?b:null,el=null!=(C=null==K?void 0:K.find(e=>(null==e?void 0:e.type)==="updateInformation"))?C:null,eo=!!Y&&!!x&&(0,uG.SM)(Y,x);(0,v.useEffect)(()=>{(null==w?void 0:w.code)===r.rv.code&&X(U.FF)},[w]);let{dynamicDocuments:ea,isLoading:er}=iR({documentRequestType:"dynamicAgreements"}),ed=(0,v.useMemo)(()=>(null==ea?void 0:ea.map(e=>({...e,content:(e=>{let n=new Blob([Uint8Array.from(atob(e.content),e=>e.charCodeAt(0))],{type:"application/pdf"});return URL.createObjectURL(n)})(e)})))||[],[ea]);if(!Y||V||er)return(0,l.Y)(W.A,{});let es=(null==(h=Y.fields)||null==(m=h.ownership)?void 0:m.type)&&o.Jh.includes(null==(g=Y.fields)?void 0:g.ownership.type),eu=!!D&&!es&&["consumerDepositCreateAccount","consumerDepositAddSecondaryOwner","minorDepositCreateAccount","createAccount"].includes(D),ep=async e=>{let{ioiRequestData:n,successMessage:i}=e;try{await j(n),F(i,{theme:"success"})}catch(e){F(U.hI,{theme:"error"})}},em=async e=>{eC(Y);try{let{data:n}=await P({variables:{personId:null==e?void 0:e.personId,fields:null==e?void 0:e.fields,applicationId:Y.id}}),i=null==n?void 0:n.updatePerson;return await O(),i}catch(e){X(U.OU);return}},eh=async(e,n)=>{eC(Y);try{if(n&&n.length){let{persons:e}=Y;await Promise.all(n.map(async n=>{var i;let t=e.find(e=>e.id===n.personId),l=null==t||null==(i=t.emails)?void 0:i.map(e=>({...(0,uK.omit)(e,"__typename"),type:e.type&&["personal","business"].includes(e.type)?e.type:void 0})),o={applicationId:Y.id,personId:n.personId,fields:{emails:[...Array.isArray(l)?l:[],{address:n.email.address,type:["personal","business"].includes(n.email.type)?n.email.type:void 0,verified:!1,coreSynced:!1}]}};await em(o)}))}await B({variables:{applicationId:Y.id,fields:{notifications:e}}})}catch(e){X(U.IV);return}},ev=async function(e){var n,i,t,l,a,d,s,c,u,p,m;let h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{applicationFields:v}=e;eC(Y);let g=null==v?void 0:v.promoCode,f=null==v?void 0:v.referralCode;if((g||f)&&(null==(i=Y.rawFields)||null==(n=i.accounts)?void 0:n.length)){let e=null==(p=Y.rawFields)?void 0:p.accounts.map(e=>({...e,promoCode:g,referralCode:f}));v={...(0,uK.omit)(v,["promoCode","referralCode"]),accounts:e}}let y=Y.persons.find(e=>e.id===N),I=(null==y?void 0:y.isControlProng)||(null==y?void 0:y.isSoleProprietor),A=(null==Y||null==(l=Y.fields)||null==(t=l.accounts)?void 0:t[0])?Y.fields.accounts.flatMap(e=>
1e.newAccountRelationshipData).filter(Boolean):null==Y||null==(a=Y.fields)?void 0:a.newAccountRelationshipData,b=null==A?void 0:A.some(e=>e.personId===N),C=(null==(s=Y.fields)||null==(d=s.ownership)?void 0:d.type)?(0,o.bi)(null==(u=Y.fields)||null==(c=u.ownership)?void 0:c.type):[];ei&&!I&&!b&&C.includes("significantParty")&&(eC(N),await ee({application:Y,userId:N}));let w=R.reduce((n,i)=>(e[i.type]&&n.push(i),i.isDisplayedAsCheckboxInSelfServe||n.push(i),n),[]),x=E({forcedReviewStatus:(null==h?void 0:h.forcedReviewStatus)||e.forcedReviewStatus,forceAutoBook:null==h?void 0:h.forceAutoBook,applicationFields:v,signatures:L,attestations:w});if((null==Y?void 0:Y.id)&&(0,tU.z)({application:Y,event:"application.submit",userId:N}),(null==Y?void 0:Y.reviewStatus)==="incomplete"&&Y.isAwaitingOtherSigners&&(Y.isMultiApplicantsCDASO||(0,r8.As)(null!=(m=Y.rawFields)?m:{})))return S(r.Dg);S({...r.rv,data:{forceAutoBook:null==h?void 0:h.forceAutoBook,submitApplicationPromise:x}})},eg=async(e,n)=>{try{await en({variables:{externalAccountId:e,holderCategory:n}})}catch(e){throw X(U.Ye),e}},eI=async e=>{let{id:n}=e;await M({variables:{applicationId:n}}),S(r.a7)};return(0,l.FD)(l.FK,{children:[(0,l.Y)(nU,{report:q,children:(0,l.Y)(u_,{application:Y,account:z,agreements:L||[],attestations:R||[],beneficiariesOnPreBookedApplication:H,dynamicAgreements:ed,onOrganizationEditClick:()=>{S({...r.zx,data:{editOrganizationOnLoad:!0}})},onPersonEditClick:e=>{let{id:n}=e;if(eu)S(uq.P[0].view);else if("createAccount"!==D||es)S({...r.zx,data:{editPersonsOnLoad:[n],scrollToPerson:n}});
1else{let{newAccountRelationshipData:e}=(null==Y?void 0:Y.fields)||{},i=null==e?void 0:e.find(e=>e.personId===n);S({...uH.p[0].view,data:{personId:n,role:i}})}},onSubmit:ev,onFundingEditClick:e=>{e?S({...r.wY,data:{accountIdToEdit:e}}):S(r.wY)},onAccountDetailsEditClick:()=>S(r.sA),userId:N||"",getPersonTaxId:G,getOrganizationTaxId:$,getTaxReportingTaxId:Q,getPlanBeneficiaries:J,getDecedentFields:Z,canEditPersonsInline:eu,onPersonEditSubmit:em,fundingEnabled:eo,handleRequestUpdateInformationIOI:ep,updateInformationEligibleService:et,updateInformationIndicationOfInterest:(null==el?void 0:el.clientId)?{...el,fields:null}:null,onHandoffApplication:()=>{S({...r.rT})},handleDeclineApplication:eI,onSaveEmailNotifications:eh,onCollateralEditClick:()=>{S(r.ei)},onUpdateExternalAccountHolderCategory:eg})}),uU.A&&(0,l.FD)("div",{style:{marginTop:100},children:[u.NT.map(e=>(0,l.Y)("div",{children:(0,l.FD)("button",{style:{margin:5},type:"button",disabled:k,onClick:()=>ev({forcedReviewStatus:e,applicationFields:{}}),"data-setstaticid":!0,"data-uid":"status=".concat(e),children:["Submit with status ",e]})},e)),(0,l.Y)("div",{children:(0,l.Y)("button",{style:{margin:5},type:"button",onClick:()=>ev({applicationFields:{}},{forcedReviewStatus:"approved",forceAutoBook:!0}),disabled:k,"data-setstaticid":!0,"data-uid":"status=approveAndBook",children:"Approve and execute"})},"execute")]})]})},[r.Dg.code]:t6,[r.cA.code]:e=>{var n,i,t,o,a,r,d,c,m;let{setCurrentView:h}=e,{application:g,isSettingApplicationMembership:y,setApplicationMembership:I,isLoadingApplication:A,refetchApplication:b}=(0,u.YY)(),{routeToNextActionOrSubmitApplication:C}=j(),{config:S}=(0,s.UK)(),{triggerMessage:w}=(0,f.d)(),{user:x}=(0,eg.Ay)(),{organizations:F}=(0,pn.A)(),{getQueryParams:Y}=(0,p._)(),T=null!=(r=(0,eL.FF)("APP-2732-shared-ein-orgs"))&&r,{eligibilityByOrgId:D,isLoadingEligibility:E}=(0,u2.A)({applicationId:T?null==g?void 0:g.id:void 0}),[k]=(0,ey.n)(eA.eb),[P,R]=(0,v.useState)({}),L=(0,v.useCallback)((e,n)=>R(i=>({...i,[e]:n})),[]),N=null==g||null==(n=g.requiredActions)?void 0:n.find(e=>"membershipSelectionRequirement"===e.type),B=null==g?void 0:g.persons.find(e=>e.id===(null==N?void 0:N.entityId)),M=null==g||null==(i=g.organizations)?void 0:i.find(e=>(null==e?void 0:e.id)===(null==N?void 0:N.entityId)),z=(null==M?void 0:M.taxIdType)==="EIN",{personCoreData:V,isLoadingGetPersonCoreData:_}=pe({personId:(null==B?void 0:B.id)||"",queryOptions:{fetchPolicy:"cache-and-network",skip:!!(null==M?void 0:M.id)}}),{organizationCoreData:q,isLoadingGetOrganizationCoreData:H}=(e=>{let{organizationId:n,queryOptions:i}=e,{authData:t}=(0,u5.A)(),{data:{organizationCoreData:l}={},loading:o,called:a}=(0,ik.I)(u3,{skip:!t,variables:{organizationId:n},...i||{}});return{organizationCoreData:l,isLoadingGetOrganizationCoreData:o,hasCalledGetOrganizationCoreData:a}})({organizationId:(null==M?void 0:M.id)||"",queryOptions:{fetchPolicy:"cache-and-network",skip:!!(null==B?void 0:B.id)}}),{relationshipOrganizationAccounts:K,isLoadingGetOrganizationAccounts:W}=(0,u6.A)({organizationId:(null==M?void 0:M.id)||"",queryOptions:{fetchPolicy:"cache-and-network",skip:!!q||!M}}),{relationshipPersonAccounts:G,isLoadingGetPersonAccounts:$}=(e=>{let{personId:n,queryOptions:i}=e,{authData:t}=(0,u5.A)(),{data:{relationshipPersonAccounts:l=[]}={},loading:o,called:a}=(0,ik.I)(eA.zF,{skip:!t,variables:{personId:n},...i||{}});return{relationshipPersonAccounts:l,isLoadingGetPersonAccounts:o,hasCalledGetPersonAccounts:a}})({personId:(null==B?void 0:B.id)||"",queryOptions:{fetchPolicy:"cache-and-network",skip:!!V||!B}}),Q=(0,v.useMemo)(()=>{if(T&&(null==M?void 0:M.id))return(0,uQ.Ji)(F).find(e=>e.some(e=>e.id===M.id))},[T,F,null==M?void 0:M.id]);if(A||_||H||W||$)return(0,l.Y)(O.A,{});if(!N)return null;let Z=null!=(d=null==B?void 0:B.id)?d:null==M?void 0:M.id,X=(e=>{let{requirements:n,entityId:i}=e;return null==n?void 0:n.find(e=>((e,n)=>!!n&&!!e&&"membershipSelection"===e.type&&!!e.entity&&("personId"in e.entity?e.entity.personId===n:"organizationId"in e.entity&&e.entity.organizationId===n))(e,i))})({requirements:null==g?void 0:g.requirements,entityId:Z}),ee=(e=>{var n,i,t,l,o,a,r;let{config:d,primaryOrganization:s,primaryPerson:c,organizationCoreData:u,personCoreData:p,relationshipOrganizationAccounts:m,relationshipPersonAccounts:h,sharedEinOrgsEnabled:v,candidateOrganizations:g}=e,f=null==u?void 0:u.coreData,y=!!s,I=!!v&&!!s&&!!(null==g?void 0:g.length),A=e=>!!e&&(y?po.includes(e):"primary"!==e),b=y?null!=(o=null==f?void 0:f.coreOrganization.membershipList)?o:null==s?void 0:s.membershipList:null!=(a=null==p||null==(n=p.coreData)?void 0:n.corePerson.membershipList)?a:null==c?void 0:c.membershipList,C=I?g.flatMap(e=>e.membershipList.map(n=>({membership:n,organizationCoreId:e.organizationCoreId}))):(null!=b?b:[]).map(e=>({membership:e,organizationCoreId:void 0})),S=y?null==f?void 0:f.coreRelationshipOrganizationAccounts:null==p||null==(i=p.coreData)?void 0:i.coreRelationshipPersonAccounts,w=y?null==f?void 0:f.coreAccounts:null==p||null==(t=p.coreData)?void 0:t.coreAccounts,x=y?m:h,F=y||null==p||null==(l=p.coreData)?void 0:l.corePersons,Y=(null!=(r=null==f?void 0:f.coreRelationshipPersonOrganizations)?r:[]).filter(e=>!0===e.isControlProng||A(e.relationshipType)).map(e=>e.name).filter(e=>!!e).map(e=>["Authorized Signer:",e]);return C.length?C.map(e=>{var n,i;let t,{membership:l,organizationCoreId:o}=e;if(l.membershipType&&(t=(0,r7.XL)(d.clientDetails,l.membershipType)),S){let e=(null!=(n=S.filter(e=>e.externalCoreMembershipId===l.externalCoreMembershipId))?n:[]).map(e=>{var n,i,t;let l=null==w?void 0:w.find(n=>n.accountId===e.accountId),o=null!=(n=null==l?void 0:l.majorCode)?n:void 0,a=null!=(i=null==l?void 0:l.minorCode)?i:void 0,r=(0,u$.B)({accountDisplayName:null==l?void 0:l.accountDisplayName,accountName:null==l?void 0:l.accountName,productDisplayName:(0,r7._s)(d,o,a,null==l?void 0:l.coreInterestRateId),accountDescription:null==l?void 0:l.accountDescription});if(!F)return{accountId:e.accountId,productName:r,majorCode:o,minorCode:a,jointOwners:[]};let s=null==F?void 0:F.filter(n=>A(e.type)&&n.externalCoreId===e.externalCoreId),c=null!=(t=null==s?void 0:s.filter(
1Boolean).map(e=>["Joint Owner:",(0,J.L)(e)]))?t:[];return{accountId:e.accountId,productName:r,majorCode:o,minorCode:a,jointOwners:c}}),i=Object.values(ns()(e,"accountId")).map(e=>{let n;return{...e[0],jointOwners:(n=F?nu()(u1()(e,"jointOwners")):[],Y.length?Y:n)}}),a=(0,s1.RH)(i,d);return{membership:{...l,label:null==t?void 0:t.label},relatedAccounts:a,...o?{organizationCoreId:o}:{}}}let a=(null!=(i=null==x?void 0:x.filter(e=>{var n,i;return(null==(n=e.fields)?void 0:n.externalCoreMembershipId)===l.externalCoreMembershipId&&!["CLOSED","INACTIVE"].includes((null!=(i=e.status)?i:"").toUpperCase())}))?i:[]).map(e=>{var n,i,t,l,o,a,r,s,c,u;let p=null!=(s=null==(n=e.coreSnapshot)?void 0:n.majorCode)?s:void 0,m=null!=(c=null==(i=e.coreSnapshot)?void 0:i.minorCode)?c:void 0,h=(0,u$.B)({accountDisplayName:null==(t=e.fields)?void 0:t.accountDisplayName,accountName:null==(l=e.fields)?void 0:l.accountName,productDisplayName:(0,r7._s)(d,p,m,null==(o=e.coreSnapshot)?void 0:o.coreInterestRateId),productName:null==(a=e.product)?void 0:a.name}),v=null!=(u=null==(r=e.persons)?void 0:r.filter(Boolean).filter(e=>A(e.relationshipType)).map(e=>["Joint Owner:",(0,J.L)(e)]))?u:[];return{accountId:e.number,productName:h,majorCode:p,minorCode:m,jointOwners:v}}),r=(0,s1.RH)(a,d);return{membership:{...l,label:null==t?void 0:t.label},relatedAccounts:r,...o?{organizationCoreId:o}:{}}}):null})({config:S,primaryOrganization:M,primaryPerson:B,organizationCoreData:q,personCoreData:V,relationshipOrganizationAccounts:K,relationshipPersonAccounts:G,sharedEinOrgsEnabled:T,candidateOrganizations:null==X?void 0:X.candidateOrganizations}),en=(null!=Q?Q:[]).filter(e=>!!e.id&&!!e.externalCoreMembershipId),ei=en.length>1,et=ei?en.map(e=>{var n;return{membership:{externalCoreMembershipId:e.externalCoreMembershipId},relatedAccounts:null!=(n=P[e.id])?n:[]}}):void 0,el=ei?en.reduce((e,n)=>{var i;let t=null==(i=D[n.id])?void 0:i.ineligibleReason;return t?{...e,[n.externalCoreMembershipId]:t}:e},{}):void 0,eo=(ei?en.map(e=>e.id):(null==M?void 0:M.id)?[M.id]:[]).map(e=>D[e]).filter(Boolean),ea=eo.length>0&&!eo.some(e=>e.createNewEligible),er=!!T&&!!M,ed=null==g||null==(a=g.fields)||null==(o=a.primaryShareData)||null==(t=o.primaryAccountRoleData)?void 0:t.membershipTypeLabel,es=async e=>{try{await I({variables:{fields:e,applicationId:null==g?void 0:g.id}});try{await C()}catch(e){w(U.FF,{theme:"error"})}}catch(e){w(U.j4,{theme:"error"})}},ec=async e=>{let n=e===(null==M?void 0:M.id)||!!(null==Q?void 0:Q.some(n=>n.id===e));if(g&&!n)try{let{data:n}=await k({variables:pt({organization:{id:e},application:g,fields:{},attributionFields:Y(eI.C7)})}),i=null==n?void 0:n.updateCreateAccountApplication;if(!i)throw Error("did not receive updated application");await b(),h((0,ah.A)(i,S,null==x?void 0:x.id))}catch(e){w("Unable to change the selected business",{theme:"error"})}},eu=void 0!==X&&X.creationAllowedByApplicant&&!ea,ep=M?null!=(c=M.legalName)?c:void 0:B?(0,J.L)(B):void 0,em=null!=(m=null==M?void 0:M.taxIdLastFour)?m:null==B?void 0:B.taxIdLastFour,eh=em?"".concat(z?"** - ***":"***-**-").concat(em):void 0;return(0,l.FD)(l.FK,{children:[ei&&en.map(e=>(0,l.Y)(pl.A,{organizationId:e.id,onLoaded:L},e.id)),(0,l.Y)(u0,{membershipWithAccountsList:null!=et?et:ee,isLoading:y,onSubmit:es,showNewMembershipButton:eu,newMembershipTypeLabel:ed,entityName:ep,taxId:eh,stampCreateOrganizationWithMembership:er,eligibleMembershipIdsFromRequirement:ei||void 0===X?void 0:X.eligibleMembershipIds,ineligibleReasonByMembershipId:el,isLoadingEligibility:E,organizations:T&&M?F:void 0,selectedOrganizationId:null==M?void 0:M.id,onSelectBusiness:T&&M?ec:void 0})]})},[r.rv.code]:e=>{var n,i,t,o,a;let{setCurrentView:d,submitApplicationPromise:c,forceAutoBook:u,pollingTimeout:p,pollingInterval:h}=e,[g,f]=(0,v.useState)(!!c),{promotedServices:y}=sF(),{applicationIsBooked:I,applicationPollingIsComplete:A,nextView:b,productName:C,application:S,userId:w,stopPollingApplication:x}=pA({forceAutoBook:u,submitAppPromiseIsPending:g,pollingTimeout:p,pollingInterval:h}),F=(0,m.useRouter)(),{account:Y}=tA({applicationId:null==S?void 0:S.id,accountId:null==S||null==(n=S.fields)?void 0:n.accountId,queryOptions:{skip:!(null==S?void 0:S.isMultiApplicantsCDASO)&&!(0,r8.As)(null!=(a=null==S?void 0:S.rawFields)?a:{})}}),T=y.length>0,{config:D}=(0,s.UK)(),E=(0,eL.FF)("APP-2711-promoted-services-bulk"),k=!!S&&pI(b)&&(0,pb.E)({application:S,clientConfig:D,showBulkPromotedServices:null!=E&&E});(0,v.useEffect)(()=>(c&&(async()=>{try{await c}catch(e){tw.L.addError(Error("Error submitting application"),{error:e,applicationId:null==S?void 0:S.id})}finally{f(!1)}})(),()=>x()),[]);let P=(null==S||null==(i=S.fields)?void 0:i.accounts)&&(null==S||null==(t=S.fields)?void 0:t.accounts.length)>1?null==S||null==(o=S.fields)?void 0:o.accounts.length:1,{isWrappedByAlkami:O}=(0,aj.Pk)();return(0,l.Y)(py,{heading:"We’re submitting your application",steps:["Packaging Application","Verifying Identity","Checking Eligibility","Submitting Application"],stepTimer:T?1e3:2e3,isComplete:A,isBooked:!T&&I,productName:C,onComplete:()=>{if(b)S?("manualReviewRequired"===b.code&&(0,tU.z)({application:S,event:"application.route.manualReview",userId:w}),"actionRequired"===b.code&&(0,tU.z)({application:S,event:"application.route.actionRequired",userId:w})):console.warn("Application data missing during submission completion GTM check"),d(k?r.GT:b);else{let e="Submitting completed but no nextView was provided";tw.L.addError(Error(e),{applicationId:null==S?void 0:S.id,userId:w,nextView:b}),console.error(e),S?F.push("/application/".concat(S.id)):F.push("/applications")}},numberOfAccounts:P,application:S,existingAccount:Y,skipSuccessSplash:O&&(null==b?void 0:b.code)===r.qL.code})},[r.jj.code]:t6,[r.wY.code]:ch,[r.KB.code]:t6,[r.JE.code]:t6,[r.HC.code]:aM,[r.gU.code]:aM,[r.Xj.code]:aM,[r.S.code]:aM,[r.hp.code]:e=>{var n,i,t,o,a,r,d;let{setCurrentView:c}=e,[m,h]=(0,v.useState)(!1),[g,y]=(0,v.useState)(!1),[I,A]=(0,v.useState)(!1),{triggerMessage:b}=(0,f.d)(),{user:C}=(0,eg.Ay)(),{config:S}=(0,s.UK)(),{application:w}=(0,u.YY)(),{getQueryParams:x}=(0,p._)(),F=x(eI.C7),{requiresBusinessSelect:Y,isLoadingSelectBusiness:T,organizations:D}=(0,pn.A)(),E=null!=(r=(0,eL.FF)("APP-2732-shared-ein-orgs"))&&r,{eligibilityByOrgId:k,isLoadingEligibility:P}=(0,u2.A)({applicationId:E?null==w?void 0:w.id:void 0}),[O,R]=(0,v.useState)([]),[L,N]=(0,v.useState)({}),B=(0,v.useCallback)((e,n)=>N(i=>({...i,[e]:n})),[]),{createOrganization:M}=(0,pw.A)(),[z]=(0,ey.n)(eA.eb),V=async(e,n)=>{if(!w)throw Error("cannot add organization without application");let i=pt({organization:e,application:w,fields:n,attributionFields:F,organizationCoreEntitySelection:I?{createOrganization:!0}:void 0}),{data:t}=await z({variables:i}),l=null==t?void 0:t.updateCreateAccountApplication;if(!l)throw Error("did not receive updated application");c((0,ah.A)(l,S,null==C?void 0:C.id))},_=async e=>{if(y(!0),!w)throw Error("cannot add organization without application");try{var n,i,t;h(!0);let l=await M({variables:{fields:(0,pi.Te)(e,C,S,F)}});if(!l.data)throw Error("could not create organization");if((null==(i=w.fields)||null==(n=i.ownership)?void 0:n.type)!=="business")throw Error("Cannot create org for account variants that are not business ownership types. Account variant used: ".concat(null==(t=w.fields)?void 0:t.accountVariant));await V(l.data.createOrganization,e)}catch(e){b("Unable to add organization to application",{theme:"error"})}finally{h(!1)}},U=async(e,n)=>{try{h(!0),await V({id:e},{doingBusinessAs:n})}catch(e){b("Unable to add selected organization to application",{theme:"error"})}finally{h(!1)}};return T?(0,l.Y)(W.A,{}):Y&&!g?E?(0,l.FD)(l.FK,{children:[O.map(e=>(0,l.Y)(pl.A,{organizationId:e,onLoaded:B},e)),(0,l.Y)(uQ.Ay,{onSelectBusiness:e=>U(e),onAddNewBusiness:()=>y(!0),onCreateNewProfile:()=>{A(!0),y(!0)},organizations:D,onSelectedGroupChange:R,accountsByOrgId:L,eligibilityByOrgId:k,isLoadingEligibility:P})]}):(0,l.Y)(pC.A,{onSelectBusiness:U,onAddNewBusiness:()=>y(!0),organizations:D,account:null}):(0,l.Y)(pS.A,{onSubmit:_,productId:(null==w||null==(t=w.fields)||null==(i=t.accounts)||null==(n=i[0])?void 0:n.productId)||
1(null==w||null==(o=w.fields)?void 0:o.productId),accountVariant:null==w||null==(a=w.fields)?void 0:a.accountVariant,isLoading:m,originatingExperience:null!=(d=null==w?void 0:w.originatingExperience)?d:"selfServe"})},[r.f5.code]:e=>{var n,i,t,o,a,d;let{setCurrentView:c}=e,{triggerMessage:p}=(0,f.d)(),{calculatePayment:m}=iD(),{config:h}=(0,s.UK)(),g=(0,v.useRef)(new Map),{application:y,acceptOffer:I,isAcceptingOffer:A,declineOffer:b,isDecliningOffer:C,isValidatingApplication:S,isLoadingApplication:w,getView:x,userId:F}=(0,u.YY)({includeQualifiedAddOns:!0}),Y=(0,eS.qk)(null==y?void 0:y.rawFields),T=null==y||null==(n=y.products)?void 0:n.find(e=>"loan"===e.type),D=!!(null==T||null==(i=T.offerUnderwritingAgreements)?void 0:i.length),{dynamicDocuments:E,isLoading:k,error:P}=iR({documentRequestType:"loanDisclosures",signerType:eE(null==Y||null==(o=Y.newAccountRelationshipData)||null==(t=o.find(e=>"personId"in e&&e.personId===F))?void 0:t.role),skip:!D}),O=null==h?void 0:h.agreements,R=null!=(d=null==h||null==(a=h.clientDetails)?void 0:a.clientName)?d:"",L=(0,v.useMemo)(()=>{var e;return(null==T||null==(e=T.offerUnderwritingAgreements)?void 0:e.length)&&O?T.offerUnderwritingAgreements.map(e=>{let n=O[e];return n?{clientName:R,agreementId:n.id,name:n.name,agreementUrl:n.url,hasPreview:n.hasPreview,dynamicAgreementType:n.dynamicAgreementType}:null}).filter(e=>null!==e).filter(e=>!e.dynamicAgreementType):[]},[null==T?void 0:T.offerUnderwritingAgreements,O,R]),N=(0,v.useMemo)(()=>!P&&(null==E?void 0:E.length)?E.map(e=>{let n=g.current.get(e.id);return n||(n=eR(e.content),g.current.set(e.id,n)),{...e,content:n}}):[],[E,P]);if((0,v.useEffect)(()=>{var e;if(!D)return;let n=g.current,i=new Set(null!=(e=null==E?void 0:E.map(e=>e.id))?e:[]);n.forEach((e,t)=>{i.has(t)||(URL.revokeObjectURL(e),n.delete(t))})},[E,D]),(0,v.useEffect)(()=>()=>{g.current.forEach(e=>URL.revokeObjectURL(e)),g.current.clear()},[]),w||k)return(0,l.Y)(W.A,{});if(!y||!y.fields||P)return(0,l.Y)(eu.A,{});let B=async e=>{let{acceptedLoanAmountCents:n}=e;try{await I({variables:{acceptedLoanAmountCents:n,...(null==Y?void 0:Y.offerLoanTermMonths)&&{acceptedLoanTermMonths:null==Y?void 0:Y.offerLoanTermMonths},applicationId:y.id}});let e=x();e?c(e===r.jj?r.rv:e):p(U.f9,{theme:"error"})}catch(e){p(U.f9,{theme:"error"})}},M=async()=>{try{await b({variables:{applicationId:y.id}});let e=x();e?c(e):p(U.f9,{theme:"error"})}catch(e){p(U.f9,{theme:"error"})}},z=async()=>{c(r.iF)};return(0,l.Y)(pF,{application:y,isLoading:A||C||S,handleAcceptOffer:B,handleDeclineOffer:M,handleEditAutopay:()=>c(r.se),handleEditCoverageOptions:z,calculatePaymentAmount:m,agreements:L,dynamicAgreements:N})},[r.Yu.code]:t6,[r.yl.code]:e=>{let{setCurrentView:n}=e,{application:i,getView:t}=(0,u.YY)(),{config:o}=(0,s.UK)(),{user:a}=(0,eg.Ay)(),[r,d]=(0,iZ.A)("significantParty",{applicationId:null==i?void 0:i.id,skipped:!1}),{updateApplicationWithSignificantParty:c}=eb(),{triggerCustomerServiceError:p}=(0,ef.A)(),{triggerMessage:m}=(0,f.d)(),{uploadDocument:h,isUploading:v,deleteDocument:g,isDeleting:y,getDocumentTypesForVerificationRequirement:I}=tJ(),A=async()=>{eC(i),await d({applicationId:null==i?void 0:i.id,skipped:!0}),n(t())},b=I("proofOfAccountOpeningAuthority","application",null==i?void 0:i.fields),C=async e=>{let{file:t,documentType:l}=e;eC(i);let{name:r}=b.find(e=>e.type===l);try{var d;eC(i),await h({variables:{file:t,documentType:l,name:r,entityType:"application",applicationId:i.id,organizationId:null==(d=i.organization)?void 0:d.id}});let e=await c({application:i,userId:a.id}),s=(0,ah.A)(e,o,null==a?void 0:a.id);n(s)}catch(e){m(U.f9,{theme:"error"})}},S=async e=>{try{await g({variables:{id:e.id}})}catch(e){p(U.h5)}return g({variables:{id:e.id}})};return i?(0,l.Y)(pY,{entityType:"application",application:i,onSubmit:C,documentTypes:b,onSelectHandoff:A,isUploading:v,onDelete:S,isDeleting:y}):null},[r.rT.code]:e=>{let{setCurrentView:n,goToPreviousView:i}=e,{application:t}=(0,u.YY)(),{user:o}=(0,eg.Ay)(),{triggerCustomerServiceError:a}=(0,ef.A)();ec({allowBrowserNavigationToViews:[r.jn]});let{handoffApplication:d}=eb(),s=async e=>{var i;let{handoffRecipient:l}=e;eC(t),await d({variables:{applicationId:t.id,applicantId:l}});let o=null==(i=t.persons)?void 0:i.find(e=>e.id===l);if(!o)return void a(U.l6);n({...r.CW,data:{handoffRecipient:(0,J.L)(o)}})};return t?(0,l.Y)(ev,{application:t,userId:o.id,onSubmit:s,onCancel:()=>i()}):(0,l.Y)(O.A,{})},[r.CW.code]:t6,[r.EN.code]:e=>{let{setCurrentView:n}=e,{application:i,isLoadingApplication:t,updateDisbursalMethod:o,updateDisbursalProduct:a,getView:r}=(0,u.YY)();if(t)return(0,l.Y)(W.A,{});if(!i||!i.fields)return(0,l.Y)(eu.A,{});let d=async e=>
1{await o({variables:{applicationId:i.id,disbursalMethod:e}});let t=r();t&&n(t)},s=async e=>{await a({variables:{applicationId:i.id,disbursalProduct:e}});let t=r();t&&n(t)};return(0,l.Y)(iz,{application:i,onSubmitDisbursalMethod:d,onSubmitDisbursalProduct:s})},[r.L1.code]:e=>{var n,i,t,o,a,d,p,m;let{setCurrentView:h}=e,{triggerMessage:g}=(0,f.d)(),{calculatePayment:y}=iD(),I=(0,v.useRef)(new Map),A=null!=(a=(0,eL.FF)("LOAN-1833-resolved-closing-agreements"))&&a,{application:b,isLoadingApplication:C,products:S,submitClosingDocuments:w,isSubmittingClosingDocuments:x,userId:F}=(0,u.YY)({includeQualifiedAddOns:!0,includeClosingAgreements:A}),Y=(0,eS.qk)(null==b?void 0:b.rawFields),{dynamicDocuments:T,isLoading:D}=iR({signerType:eE(null==Y||null==(i=Y.newAccountRelationshipData)||null==(n=i.find(e=>"personId"in e&&e.personId===F))?void 0:n.role),documentRequestType:"closingDocuments"}),E=null==S?void 0:S.flatMap(e=>e.closingAttestations).filter(Boolean),{config:k}=(0,s.UK)(),P=(null!=(d=null==b||null==(t=b.rawFields)?void 0:t.accounts)?d:[]).flatMap(e=>{var n;let i=k.products[e.productId];return i&&null!=(n=(0,eT.y)(i,e.accountVariant).closingAgreements)?n:[]}),{attestationTypes:O,agreements:R,clientDetails:{clientName:L}}=k,N=(e=>{var n,i,t;let l=[];if((null==(n=e.addOns)?void 0:n.length)&&e.addOns.forEach(e=>{e.selected?l.push("addOnSelected:".concat(e.id)):l.push("addOnDeclined:".concat(e.id)),e.eligible?l.push("addOnEligible:".concat(e.id)):l.push("addOnIneligible:".concat(e.id))}),(null==(i=e.roles)?void 0:i.length)&&e.roles.forEach(e=>{l.push("role:".concat(e))}),e.borrowerState&&l.push("state:".concat(e.borrowerState.toUpperCase())),e.autopayMethod&&("internalAccountId"in e.autopayMethod&&e.autopayMethod.internalAccountId&&l.push("autopaySelected:internal"),"externalAccountId"in e.autopayMethod&&e.autopayMethod.externalAccountId&&l.push("autopaySelected:external")),e.signerCreditScores){let n=e.signerCreditScores.filter(e=>"number"==typeof e.value);if(0===n.length&&l.push("noCreditScore"),n.length>0){let i=eP()(n,"value"),o=null==i?void 0:i.value,a="underCreditScore:";if(void 0!==o){let n=null==(t=e.agreementQualifyingScopes)?void 0:t.find(e=>{if(!e.startsWith(a))return!1;let n=e.slice(a.length);try{return new ew.A(o).lt(n)}catch(e){return!1}});n&&l.push(n)}}}return l})({autopayMethod:null==Y?void 0:Y.autopayMethod}),B=null!=(p=null==E?void 0:E.filter(e=>eO(O[e],N)).map(e=>({title:O[e].title,type:e,displayedCopy:O[e].copy,isDisplayedAsCheckboxInSelfServe:O[e].isDisplayedAsCheckboxInSelfServe,displayAboveAgreements:O[e].displayAboveAgreements})))?p:[],M=(A?nu()(null!=(m=null==b||null==(o=b.closingAgreements)?void 0:o.map(e=>e.agreementId))?m:[]):P).filter(e=>{let n=R[e];return(null!=n?n:null)!==null&&!n.requireInBranchClosing}).map(e=>({clientName:L,agreementId:R[e].id,name:R[e].name,agreementUrl:R[e].url,hasPreview:R[e].hasPreview,dynamicAgreementType:R[e].dynamicAgreementType})),z=(0,v.useMemo)(()=>(null==T?void 0:T.length)?T.map(e=>{let n=I.current.get(e.id);return n||(n=eR(e.content),I.current.set(e.id,n)),{...e,content:n}}):[],[T]);(0,v.useEffect)(()=>{var e;let n=I.current,i=new Set(null!=(e=null==T?void 0:T.map(e=>e.id))?e:[]);n.forEach((e,t)=>{i.has(t)||(URL.revokeObjectURL(e),n.delete(t))})},[T]),(0,v.useEffect)(()=>()=>{I.current.forEach(e=>URL.revokeObjectURL(e)),I.current.clear()},[]);let V=nu()(z.filter(e=>!e.requireInBranchClosing).map(e=>e.id).concat(M.map(e=>e.agreementId))),_=async()=>{try{let e=(0,c.$L)(),n=w({variables:{attestationFields:null==B?void 0:B.map(e=>{let{type:n}=e;return{type:n}}),signatureFields:V.map(n=>({agreementId:n,sessionSnapshot:e})),applicationId:b.id}});h({...r.rv,data:{submitApplicationPromise:n}})}catch(e){g(U.f9,{theme:"error"})}};return C||D?(0,l.Y)(W.A,{}):E&&S&&b?(0,l.Y)(iY,{application:b,agreements:M,handleSubmit:_,isLoading:x,attestations:B,dynamicAgreements:z,calculatePaymentAmount:y}):(0,l.Y)(eu.A,{})},[r.K1.code]:t6,[r.GT.code]:e=>{var n,i,t,o,a,d,s;let{setCurrentView:c}=e,{nextView:p,executionStatus:m,applicationPollingIsComplete:h,application:g,applicationIsBooked:y,userId:I}=pA({includeCardholders:!0}),A=(0,eL.FF)("APP-2711-promoted-services-bulk"),b=(null!=(d=null==g||null==(i=g.fields)||null==(n=i.accounts)?void 0:n.length)?d:0)>1,C=A||b,S=null!=(s=null==g||null==(t=g.fields)?void 0:t.createdAccountId)?s:null==g||null==(o=g.fields)?void 0:o.accountId,{cardHolders:w,cardHoldersByAccountReferenceId:x}=sy({allAccounts:C}),{applicationId:F}=(0,u.YY)(),{promotedServices:Y,bulkEligibleServices:T}=sF({includeCardholders:!0}),{currentUserIndicationsOfInterest:D,accountIndicationsOfInterest:E,requestIndicationOfInterest:k}=sg({applicationId:F,userId:I,accountId:b&&A?void 0:null!=S?S:void 0,queryOptions:{fetchPolicy:"cache-and-network"}}),{triggerMessage:P}=(0,f.d)(),O=y&&"booked"===m&&pI(p),R=h&&"booked"!==m,[L,N]=(0,iZ.A)("viewedPromotedServices"),B=async()=>{(R||O)&&p?c(p):c(r.Zn)},M=async e=>{let{ioiRequestData:n,successMessage:i}=e;try{await k(n),P(i,{theme:"success"})}catch(e){P(U.hI,{theme:"error"})}};(0,v.useEffect)(()=>
1{if(!(null==g?void 0:g.id))return;let e=g.id;if((null==L?void 0:L[e])==="true")return void B();N({...L||{},[e]:"true"})},[null==g?void 0:g.id]);let z=null==g||null==(a=g.products)?void 0:a[0];return b&&!A?(y&&p&&c(p),null):(0,l.Y)(pz,{application:g,cardHolders:w,cardHoldersByAccountReferenceId:x,services:Y,indicationsOfInterest:D,allAccountIndicationsOfInterest:E,onContinue:B,onRequestIndicationOfInterest:M,product:z,bulkEligibleServices:C?T:void 0,accountsAreOpened:O,userId:I})},[r.Zn.code]:e=>{var n,i,t,o;let{setCurrentView:a}=e,{applicationPollingIsComplete:r,nextView:d,applicationIsBooked:s,productName:c,executionStatus:u,application:p}=pA(),h=(0,m.useRouter)(),v=null==p?void 0:p.id,{account:g}=tA({applicationId:v,accountId:null==p||null==(n=p.fields)?void 0:n.accountId,queryOptions:{skip:!(null==p?void 0:p.isMultiApplicantsCDASO)}}),f=s&&"booked"===u&&pI(d),y=r&&"booked"!==u,I=(null==p||null==(i=p.fields)?void 0:i.accounts)&&(null==p||null==(t=p.fields)?void 0:t.accounts.length)>1?null==p||null==(o=p.fields)?void 0:o.accounts.length:1;return(0,l.Y)(pj,{productName:c,accountIsOpened:f,accountIsPending:y,onPollingComplete:()=>{if(d&&(f||y))a(d);else{let e="polling completed but account booking could not be confirmed";tw.L.addError(Error(e),{nextView:d,applicationIsBooked:s,executionStatus:u,applicationId:v}),d?pI(d)?console.error(e):console.error("next view is not for booked account"):console.error("next view can't be found for account opening"),h.push("/application/".concat(v))}},numberOfAccounts:I,existingAccount:g})},[r.N4.code]:()=>{var e,n,i,t,a,d,c,p,m,h,v,g,y;let I,{application:A,isLoadingApplication:b}=(0,u.YY)(),{routeToNextActionOrSubmitApplication:C}=j(),{config:S}=(0,s.UK)(),{triggerMessage:w}=(0,f.d)(),{setCurrentView:x}=(0,H.At)(),[F,{loading:Y}]=(0,ey.n)(eA.eb),[T,{loading:D}]=(0,ey.n)(eA.D3),{products:E}=S;if(!(null==A?void 0:A.fields))throw Error("no fields on application");
1let{accountVariant:k,productId:P,newAccountRelationshipData:R}=(null!=(y=null==A||null==(e=A.fields)?void 0:e.accounts)?y:[A.fields]).find(e=>{let n=(null==e?void 0:e.productId)&&E[e.productId];return!!n&&!!(null==e?void 0:e.accountVariant)&&"plan"in(0,o.Gm)(e.accountVariant,n)})||{};if(!k||!P||!R)throw Error("accountVariant, productID and NARDs are required");let L=E[P],N=(0,o.Gm)(k,L),B=null==R?void 0:R.find(e=>e.isPrimaryEntity),M=null==A?void 0:A.persons.find(e=>B&&"personId"in B&&e.id===(null==B?void 0:B.personId));if(!M)throw Error("Primary person not found");let{personCoreData:z,isLoadingGetPersonCoreData:V}=pe({personId:(null==M?void 0:M.id)||"",queryOptions:{fetchPolicy:"cache-and-network"}});if(V)return(0,l.Y)(O.A,{});let _=N.plan?S.plans[N.plan]:void 0,q=(null==M?void 0:M.membershipList)?M.membershipList.map(e=>({...(0,uK.omit)(e,"externalCoreMembershipId"),membershipId:e.externalCoreMembershipId})):[],K=(null==z||null==(n=z.coreData)?void 0:n.corePrimaryMemberships)||q,W=(0,r7.US)(S);if(K)try{I=(0,s1.RZ)({memberships:K,disambiguationStrategy:W})}catch(e){I=null}else I=null;let G=(null==z||null==(a=z.coreData)||null==(t=a.corePerson)||null==(i=t.plans)?void 0:i.length)?null==z||null==(c=z.coreData)||null==(d=c.corePerson)?void 0:d.plans:M.plans;(0,Q.Z1)(_,"product plan does not match any configured plans");let $=(e=>{let{applicationMembershipInfo:n,personPlans:i,personExternalCoreMembershipId:t,defaultMembership:l,configPlan:o}=e;return null==i?void 0:i.filter(e=>{var i,a,r,d,s,c;if(e.externalCoreId&&o.isDecedentPlan||!((!o.codes||(null==(a=o.codes)?void 0:a.includes((null==e||null==(i=e.fields)?void 0:i.code)||"")))&&(null==(r=e.fields)?void 0:r.type)===(null==o?void 0:o.type)))return!1;let u=null==(d=e.fields)?void 0:d.externalCoreMembershipId;if(!u)return!0;if(n)return(!n||!("createMembership"in n))&&u===n.selectedMembershipId;{let n=t===(null==(s=e.fields)?void 0:s.externalCoreMembershipId);return l?(null==(c=l.selectedMembership)?void 0:c.membershipId)===u:n}})})({applicationMembershipInfo:null==A||null==(p=A.fields)?void 0:p.membershipInfo,personPlans:G,personExternalCoreMembershipId:(null==z||null==(h=z.coreData)||null==(m=h.corePerson)?void 0:m.externalCoreMembershipId)||(null==M?void 0:M.externalCoreMembershipId),defaultMembership:I,configPlan:_}),J=(()=>{var e,n;return n=!!(null==_?void 0:_.codes)&&(null==(e=_.codes.filter(e=>!(null==$?void 0:$.find(n=>{var i;return(null==n||null==(i=n.fields)?void 0:i.code)===e}))))?void 0:e.length)>0,n})()&&!(null==(g=S.mantlFeatures.accountOpening)||null==(v=g.enforceOnePlanPerPlanType)?void 0:v.enabled),Z=_?null==_?void 0:_.label:"",X=async e=>{var n,i;if("NEW_PLAN"===e)return x(r.RQ);let t=null==A||null==(i=A.fields)||null==(n=i.accounts)?void 0:n.filter(e=>{let n=(0,o.Gm)(e.accountVariant,L);return!!(null==n?void 0:n.plan)});try{(null==t?void 0:t.length)?await Promise.all(t.map(n=>T({variables:{fields:{planId:e},applicationId:null==A?void 0:A.id,referenceId:n.referenceId}}))):await F({variables:{fields:{planId:e},applicationId:null==A?void 0:A.id}})}catch(e){w(U.Yx,{theme:"error"})}try{await C()}catch(e){w(U.FF,{theme:"error"})}};return b?(0,l.Y)(O.A,{}):(null==$?void 0:$.length)?(0,l.Y)(pZ,{plans:$,planLabel:Z,isLoading:Y||D,onSubmit:X,canCreateNewPlan:J}):x(r.RQ)},[r.dh.code]:t6,[r.ei.code]:e=>{var n,i,t,o;let{setCurrentView:a}=e,{triggerMessage:d}=(0,f.d)(),{upsertCollaterals:c}=(()=>{let[e,{loading:n}]=(0,ey.n)(p4);return{upsertCollaterals:e,isUpsertingCollaterals:n}})(),{decodeVIN:p}=(()=>{let[e]=(0,iT._)(p8,{fetchPolicy:"no-cache"});return{decodeVIN:async n=>{let{data:i,error:t}=await e({variables:{vin:n}});if(t||!(null==i?void 0:i.decodeVIN))throw Error("Error getting vehicle data");return i.decodeVIN}}})(),{config:{products:m}}=(0,s.UK)();ec({allowBrowserNavigationToViews:[r.jn,r.sA]});let{application:h,getView:v,validateApplication:g,updateApplicationAccount:y}=(0,u.YY)(),I=null!=(o=(0,eS.qk)(null==h?void 0:h.rawFields))?o:null==h?void 0:h.rawFields,A=null==I?void 0:I.productId,b=A&&(null==m?void 0:m[A]),C=null==I?void 0:I.accountVariant,S=b?(0,eT.y)(b,C):null,w=null==S||null==(n=S.collateral)?void 0:n.allowedSecuredDepositTypes,x=null==S||null==(i=S.collateral)?void 0:i.allowedSecuredProducts,F=!!(null==w?void 0:w.length)||!!(null==x?void 0:x.length),{fundingSources:Y,isLoadingFundingSources:T}=(0,lS.Ay)({includeInternalAccounts:!0,includeInternalAccountPersons:!0,includeCertificateAccounts:!0,organizationId:null==h||null==(t=h.organization)?void 0:t.id,queryOptions:{fetchPolicy:"cache-and-network"},productId:null==I?void 0:I.productId,accountVariant:null==I?void 0:I.accountVariant,isSecuredLoan:F}),D=Y.filter(e=>"CustomerInternalAccountFundingSource"===e.type).filter(e=>e.currentBalance&&new ew.A((0,eN.LL)(e.currentBalance)).gt(0));if(!h)return(0,l.Y)(W.A,{});let E=async e=>{let{collaterals:n,accountFields:i}=e;try{if(n.length>0&&await c({variables:{collaterals:n,applicationId:null==h?void 0:h.id}}),i){let e=I&&"referenceId"in I?I.referenceId:void 0;if(!e)throw Error("Cannot save wet signature names: loan account referenceId is missing");await y({variables:{applicationId:null==h?void 0:h.id,referenceId:e,fields:i}})}await g();let e=v();e&&a(e)}catch(e){tw.L.addError(Error("Error adding or updating collateral"),{errors:e,applicationId:null==h?void 0:h.id}),d(U.f9,{theme:"error"})}};return(0,l.Y)(pX.A,{decodeVIN:p,children:(0,l.Y)(p6,{application:h,fundingSources:D,onSubmit:E,isLoadingFundingSources:T})})},[r.$j.code]:e=>{let{setCurrentView:n}=e,{triggerMessage:i}=(0,f.d)(),{calculatePayment:t,isCalculating:o}=iD(),{application:a,applicationId:d,isLoadingApplication:s,getView:c,updatePreOffer:p,isUpdatingPreOffer:m}=(0,u.YY)(),[,h]=(0,iZ.A)("hasSeenLoanApproval",{applicationId:d,viewed:!1});if(s)return(0,l.Y)(W.A,{});if(!a||!a.fields||!d)return(0,l.Y)(eu.A,{});let v=async()=>{try{let{data:e}=await p({variables:{applicationId:a.id}}),t=null==e?void 0:e.updatePreOffer;if((null==t?void 0:t.preOfferActions)&&t.preOfferActions.length>0)n(r.zZ);else{let e=c();e?((null==e?void 0:e.code)===r.hV.code&&(await h({applicationId:d,viewed:!0}),e=c()),n(e)):i(U.f9,{theme:"error"})}}catch(e){i(U.f9,{theme:"error"})}};return(0,l.Y)(me,{application:a,applicationId:d,handleContinueClick:v,isLoading:m,calculatePaymentAmount:t,isCalculating:o})},[r.in.code]:e=>{var n,i,t,o,a;let{setCurrentView:d}=e,{triggerMessage:p}=(0,f.d)(),{calculatePayment:m}=iD(),{application:h,applicationId:g,isLoadingApplication:y,getView:I,submitPreOfferSignatures:A,updatePreOffer:b,isSubmittingPreOfferSignatures:C,isUpdatingPreOffer:S,declinePreOffer:w,isDecliningPreOffer:x,userId:F}=(0,u.YY)(),{config:Y}=(0,s.UK)(),T=(0,v.useRef)(new Map),D=(0,eS.qk)(null==h?void 0:h.rawFields),{dynamicDocuments:E,isLoading:k,error:P}
1=iR({signerType:eE(null==D||null==(i=D.newAccountRelationshipData)||null==(n=i.find(e=>"personId"in e&&e.personId===F))?void 0:n.role),documentRequestType:"loanDisclosures"}),O=null==h||null==(t=h.products)?void 0:t.find(e=>"loan"===e.type),R=(e=>{let{preOfferAgreementIds:n,clientConfig:i,isLoanEstimateReissuePending:t}=e,l=t?["isReIssuedAgreement:loanDisclosure"]:[],o=Object.values(i.agreements),a=e=>o.find(n=>n.id===e),r=(null!=n?n:[]).filter(e=>{let n=a(e),i=null==n?void 0:n.dynamicAgreementType;return!!n&&!!["loanDisclosure","loanEstimate"].includes(null!=i?i:"")&&eO(n,l)}),d=e=>{var n,i;return!!(null==(i=a(e))||null==(n=i.qualifyingScopes)?void 0:n.includes("isReIssuedAgreement:loanDisclosure"))},s=e=>{var n;return(null==(n=a(e))?void 0:n.dynamicAgreementType)==="loanEstimate"},c=r.filter(d);return[...c,...r.filter(e=>s(e)&&!d(e)),...r.filter(e=>!d(e)&&!s(e))]})({preOfferAgreementIds:null==O?void 0:O.preOfferAgreements,clientConfig:Y,isLoanEstimateReissuePending:null!=(a=null==D||null==(o=D.loanEstimateReissue)?void 0:o.isLoanEstimateReissuePending)&&a}),L=(0,v.useMemo)(()=>!P&&(null==E?void 0:E.length)?E.map(e=>{let n=T.current.get(e.id);return n||(n=eR(e.content),T.current.set(e.id,n)),{...e,content:n}}):[],[P,E]);if((0,v.useEffect)(()=>{var e;let n=T.current,i=new Set(null!=(e=null==E?void 0:E.map(e=>e.id))?e:[]);n.forEach((e,t)=>{i.has(t)||(URL.revokeObjectURL(e),n.delete(t))})},[E]),(0,v.useEffect)(()=>()=>{T.current.forEach(e=>URL.revokeObjectURL(e)),T.current.clear()},[]),y||k)return(0,l.Y)(W.A,{});if(!h||!g||P)return(0,l.Y)(eu.A,{});let N=null==O?void 0:O.isTridLoan,B=async()=>{try{var e,n;let i,t=(0,c.$L)();if(N){let{data:e}=await A({variables:{applicationId:g,signatureFields:R.map(e=>({agreementId:e,sessionSnapshot:t}))}});i=null==e?void 0:e.submitPreOfferSignatures}else{let{data:e}=await b({variables:{applicationId:h.id}});i=null==e?void 0:e.updatePreOffer}let l=null==i||null==(e=i.preOfferActions)?void 0:e.some(e=>"missingPreOfferSignatures"===e.type);if((null==i||null==(n=i.preOfferActions)?void 0:n.length)&&i.preOfferActions.length>0&&!l)d(r.zZ);else{let e=I();e?d(e):p(U.f9,{theme:"error"})}}catch(e){p(U.f9,{theme:"error"})}},M=async()=>{if(g)try{await w({variables:{applicationId:g}});let e=I();e?d(e):p(U.f9,{theme:"error"})}catch(e){p(U.f9,{theme:"error"})}};return(0,l.Y)(mn,{application:h,dynamicAgreements:L,userId:F,handleAccept:B,handleDecline:M,isLoading:C||S||x,calculatePaymentAmount:m})},[r.hV.code]:e=>{let{setCurrentView:n}=e,{application:i,applicationId:t,isLoadingApplication:o,getView:a}=(0,u.YY)(),[,r]=(0,iZ.A)("hasSeenLoanApproval",{applicationId:t,viewed:!1});if(o)return(0,l.Y)(W.A,{});if(!i||!i.fields)return(0,l.Y)(eu.A,{});let d=async()=>{await r({applicationId:t,viewed:!0}),n(a())};return(0,l.Y)(mi,{application:i,handleContinueClick:d})},[r.zZ.code]:e=>{let{setCurrentView:n}=e,{triggerMessage:i}=(0,f.d)(),{application:t,isLoadingApplication:o,getView:a,updatePreOffer:r,isUpdatingPreOffer:d}=(0,u.YY)();if(o)return(0,l.Y)(W.A,{});if(!t||!t.fields)return(0,l.Y)(eu.A,{});let s=async()=>{try{await r({variables:{applicationId:t.id}});let e=a();e?n(e):i(U.f9,{theme:"error"})}catch(e){i(U.f9,{theme:"error"})}};return(0,l.Y)(ml,{application:t,handleContinueClick:s,isLoading:d})},[r.iF.code]:e=>{var n,i,t;let{setCurrentView:o}=e,{application:a,applicationId:r,isLoadingApplication:d,getView:s,updateOffer:c,updatePreOffer:p,userId:m}=(0,u.YY)({includeQualifiedAddOns:!0}),{triggerMessage:h}=(0,f.d)(),{calculatePayment:g,loading:I}=iD(),[A,b]=(0,v.useState)(!1),C=(0,eL.FF)("LOAN-1148-addons-to-preoffer"),S=(0,v.useRef)(null),w=(0,eS.qk)(null==a?void 0:a.rawFields),x="preOffer"===(a?(0,q.ZM)(a):null),{transformedSelectedAddOnsByType:F}=((e,n)=>{let i=(0,v.useMemo)(()=>{var i;return null==n||null==(i=n.selectedAddOns)?void 0:i.reduce((n,i)=>{if(i.addOnKey){var t,l;n[i.addOnKey]={...i,selected:!0,...null!=(l=((e,n)=>{var i,t;let l,o,a=null==n?void 0:n.find(n=>n.addOnId===e.addOnKey),r=e.planId,d=e.planType,s=null!=(i=e.planName)?i:void 0,c=e.costs;if(r&&a&&a.planOptions){let e=a.planOptions.find(e=>e.planId===r);e&&(s=e.planName,l=e.deductibleInCents,o="".concat(e.monthsCovered,"-").concat(e.milesCovered),c=null!=(t=e.costs)?t:c)}return{planName:s,deductible:l,coverageTerm:o,costs:c,planId:r,planType:d}})(i,null!=(t=null==e?void 0:e.qualifiedAddOns)?t:[]))?l:{}}}return n},{})},[null==e?void 0:e.qualifiedAddOns,null==n?void 0:n.selectedAddOns]);return{transformedSelectedAddOnsByType:null!=i?i:{}}})(a,w);Object.values(F).length>0&&(S.current=F);let Y=async e=>{var n,i,t,l,o,a,d;let s=!!(null==(n=e.addOn)?void 0:n.type)&&ic(e.addOn.type),c=null!=(a=null==(i=e.addOn)?void 0:i.addOnId)?a:"",u=[{addOnKey:c,planName:e.selectedPlanName,planId:e.selectedPlanId,planType:e.selectedPlanType,...!s&&(null==(t=e.addOnCosts)?void 0:t.costType)?{costs:{costType:e.addOnCosts.costType,totalBaseCostInCents:e.addOnCosts.totalBaseCostInCents}}:{}}],p=r?await g({applicationId:r,selectedAddOns:u}):null,m=null==p||null==(l=p.fees)?void 0:l.find(e=>e.id===c);return{estimatedMonthlyPaymentInCents:null==m?void 0:m.monthlyCostCents,fees:null!=(d=null==p||null==(o=p.fees)?void 0:o.map(e=>{var n;return{...e,isAddOn:null!=(n=e.isAddOn)&&n}}))?d:void 0}},[T,D]=(0,v.useState)(!1),E=null==a||null==(n=a.products)?void 0:n.find(e=>"loan"===e.type);if((0,v.useEffect)(()=>{var e;!d&&r&&a&&(0!==(null!=(e=a.qualifiedAddOns)?e:[]).length&&E||(D(!0),o(s())))},[a,d,r,s,o]),T||d||!r)return(0,l.Y)(O.A,{});if(!a||!E)return(0,l.Y)(eu.A,{});let k=async e=>{if((0,tq.isEqual)(e.addOns,S.current))return void o(s());b(!0);let n=Object.entries(e.addOns).filter(e=>{let[n,i]=e;return i.selected}).map(e=>{var n;let[i,t]=e,{selected:l,deductible:o,coverageTerm:r,costs:d,...s}=t,c=(null!=(n=a.qualifiedAddOns)?n:[]).find(e=>e.addOnId===i);return{...s,addOnKey:i,type:null==c?void 0:c.type}});try{x&&C?await p({variables:{applicationId:r,fields:{selectedAddOns:n,hasSeenSelfServeAddOns:!0}}}):await c({variables:{applicationId:r,condition:"addOns",fields:{selectedAddOns:n,hasSeenSelfServeAddOns:!0}}});let e=s();o(e)}catch(e){tw.L.addError(Error("Error adding add-ons to loan"),{userId:m,applicationId:r,errors:e}),h(U.f9,{theme:"error"})}finally{b(!1)}};return(0,l.Y)(y.A,{initialValues:{addOns:F},onSubmit:k,children:(0,l.Y)(my,{persons:null!=(i=a.persons)?i:[],loanProduct:E,qualifiedAddOns:null!=(t=a.qualifiedAddOns)?t:[],calculatePaymentForPlan:Y,isSaving:A,isPreOfferStage:x,preOfferLoanAmountCents:null==w?void 0:w.preOfferLoanAmountCents,paymentLoading:I})})},[r.cV.code]:t6,[r.qL.code]:()=>(0,l.Y)(mA,{MyEnrollmentIntegrationComponent:mb}),[r.bP.code]:()=>{let{currentView:e}=(0,H.UM)(),{integrationId:n,policies:i,accountNumber:t}=e.data,o=(0,m.useRouter)(),{setCurrentView:a}=(0,H.At)(),{isWrappedByAlkami:d}=(0,aj.Pk)();return(0,v.useEffect)(()=>{n&&i||o.push("/_error")},[n,i]),(0,l.Y)(mw,{integrationId:n,policies:i,accountNumber:t,enrollmentHooks:{useCheckUsername:sO,useEnrollUser:sU},isMobile:mI(),onMobileEnrollmentSuccess:()=>
1{if(d)return void a(r.HV);a(r._Q)}})},[r._Q.code]:()=>{let e=(()=>{let{config:{clientDetails:e}}=(0,s.UK)();return"iOS"===new iH.O().getOS().name?e.iosAppStoreLink:e.androidPlayStoreLink})(),{application:n}=(0,u.YY)(),{config:i}=(0,s.UK)(),{query:t}=(0,m.useRouter)(),{setCurrentView:o}=(0,H.At)();return e?(0,l.Y)("div",{style:{marginTop:"2rem"},children:(0,l.Y)(iq,{buttonUrl:e,onManageAccountServicesClick:()=>{if(n){let e=(0,iK.j)(n,i,t);e&&o(e)}}})}):(console.error("Missing download app url in clientDetails"),(0,l.Y)(iV.A,{}))},[r.HV.code]:()=>(0,l.Y)(mT,{})},mP=()=>{let{applicationError:e,application:n,userId:i}=(0,u.YY)(),{config:t}=(0,s.UK)(),{initialView:r,appRequiresResync:m,syncViewToRoute:g,router:f}=(()=>{let{applicationId:e,isLoadingApplication:n,initialView:i,refetchApplication:t}=(0,u.YY)(),{router:l,navigate:o}=(0,p._)(),{query:{id:a,view:[r]=[]}}=l;(0,c.Dw)();let s=!n&&e&&e!==a;return(0,v.useEffect)(()=>{s&&t()},[s]),{syncViewToRoute:e=>{var n,i;let t=null===h()||void 0===h()||null==(i=h().query)||null==(n=i.view)?void 0:n[0];if(t!==e.code)return o("/application/".concat(a,"/").concat(e.code),void 0,{replace:!t,shallow:!0})},appRequiresResync:s,initialView:i?(0,d.DM)(i,r):null,router:l}})(),y=(()=>{let{application:e,applicationId:n,applicationType:i,userId:t}=(0,u.YY)();return(0,v.useMemo)(()=>{var n,l,o;let a=(null==e||null==(n=e.organization)?void 0:n.rawFields.type)==="soleProprietorship";return"businessDepositCreateAccount"===i&&!a&&!(null==e||null==(o=e.persons)||null==(l=o.find(e=>e.id===t))?void 0:l.isControlProng)},[n])})();if(e)return(0,l.Y)(eu.A,{});if(!r||m)return(0,l.Y)(W.A,{});if(y)return(0,l.Y)(mD,{});let I=r;if((null==n?void 0:n.type)==="createAccount"){var A,b;let e=null==(b=n.fields)||null==(A=b.ownership)?void 0:A.type,l=e&&o.Se.includes(e),a=e&&o.Sy.includes(e),r=e&&o.Jh.includes(e);(l||a||r)&&(I=(0,ah.A)(n,t,i,f.query))}return(0,l.Y)(a.A,{name:"application",views:mk,initialView:I,onInitialViewLoad:g,onBeforeRouteChange:g})}}},e=>{e.O(0,[808,830,320,951,189,648,977,267,153,357,61,793,365,266,593,636,792],()=>e(e.s=8394)),_N_E=e.O()}]);

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.