1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4353],{2991:(e,t,s)=>{"use strict";s.d(t,{A:()=>d});var n=s(64255),o=s(1179),i=s(90110),r=s(68559);let a={textAlign:{xs:"left",sm:"center"}},l={fontSize:{sm:20},fontWeight:700,mx:{sm:2}},c={mt:{xs:1,sm:0},mx:{sm:2}},u={mt:{xs:8,sm:10},mb:{sm:10}},d=({title:e,subtitle:t,isError:s,errorMessage:d,children:m})=>{let h=(0,r.Vb)();return(0,n.jsxs)(o.A,{children:[(0,n.jsxs)(o.A,{sx:a,children:[(0,n.jsx)(i.A,{sx:l,component:"h1",gutterBottom:!0,variant:"Body/Bold/LG",children:e}),(0,n.jsx)(i.A,{variant:"Body/Regular/SM",component:"p",sx:c,children:t}),!!s&&(0,n.jsx)(i.A,{color:"error",component:"p",variant:"Body/Regular/SM",role:"alert",children:h(d)})]}),(0,n.jsx)(o.A,{sx:u,children:m})]})}},15593:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/account/create/goals",function(){return s(94508)}])},46606:(e,t,s)=>{"use strict";s.d(t,{A:()=>h});var n=s(64255),o=s(55714),i=s(1179),r=s(90110),a=s(68559),l=s(3952);let c={display:"flex",justifyContent:"center",zIndex:2,position:{sm:"sticky"},bottom:0,left:{xs:0,sm:"unset"},bgcolor:"common.neutrals.white",py:{xs:4,sm:0},width:{xs:"100%",sm:"auto"},mt:{xs:16,sm:0}},u={maxWidth:{xs:"100%",sm:181},mr:{xs:1,sm:4},width:{xs:"100%"},height:{sm:56}},d={position:{xs:"fixed",sm:"unset"},bottom:{xs:0,sm:"unset"},bgcolor:{xs:"white",sm:"unset"},py:{xs:2,sm:"unset"},width:{xs:"calc(100% - 32px)"},maxWidth:{xs:"none",sm:181}},m={py:{sm:3},height:{sm:56}},h=function({backUrl:e,loadingStatus:t,nextButtonDisplayFinish:s,disabled:h=!1}){let p=(0,a.Vb)(),x=(0,o.A)(e=>e.breakpoints.only("xs"));return(0,n.jsxs)(i.A,{component:"nav",sx:c,children:[!x&&(0,n.jsx)(l.A,{fullWidth:!0,sx:u,variant:"outlined",href:e,children:(0,n.jsx)(r.A,{variant:"Button/Caps/LG",children:p("back")})}),(0,n.jsx)(i.A,{sx:d,children:(0,n.jsx)(l.A,{type:"submit",fullWidth:!0,loading:t,disabled:t||h,sx:m,children:(0,n.jsx)(r.A,{variant:"Button/Caps/LG",children:p(s?"finish":"next")})})})]})}},94508:(e,t,s)=>{"use strict";s.r(t),s.d(t,{createGoalsSchema:()=>w,default:()=>G});var n=s(64255),o=s(1179),i=s(26081),r=s(35515),a=s(1456),l=s(90110),c=s(9243),u=s(41695),d=s(18021),m=s.n(d),h=s(86692),p=s(27034),x=s(68559),g=s(67230),f=s(17391),_=s(90999),b=s(46606),A=s(29568),j=s(2991);function w(e){return h.Ik().shape({weightChangeGoal:h.YO().min(1,"accountCreateGoalsError")})}let y=["lose_weight","maintain_weight","gain_weight"];function v(){let e=(0,c.useRouter)(),t=(0,x.Vb)(),s=(0,u.useRef)(null),d=(0,u.useMemo)(()=>w(t),[t]),{data:m,setData:h}=(0,p.Pj)(g.ZC),[A,v]=(0,u.useState)(void 0),[G,C]=(0,u.useState)(!1),[S,O]=(0,u.useState)(""),[k,E]=(0,u.useState)([]),[B,M]=(0,u.useState)([]);(0,u.useEffect)(()=>{m.isInputNamePageComplete||e.push("/account/create/welcome")},[m.isInputNamePageComplete,e]),(0,u.useEffect)(()=>{let e=[],t=m?.unified_goals?m?.unified_goals.filter(({selection:e})=>e===f.Oz["primary-account-goal"].id)[0].subSelections:[];t.map(t=>{y.includes(t)?O(t):e.push(t)}),E(e),M(t)},[m,E,O]);let N=({selectedOptions:t,weightGoal:n})=>{C(!0);let o=f.Oz["primary-account-goal"].options.reduce((e,{value:s})=>(t.includes(s)&&e.push(s),e),[]);d.validate({weightChangeGoal:B}).then(()=>{for(let[e,t]of Object.entries({isGoalsPageComplete:!0,weightChangeGoal:n||"maintain_weight",unified_goals:[{selection:"primary_goal",subSelections:[...o]}]}))h(e,t);e.push("/account/create/goals/big-step")}).catch(e=>{(0,_.dU)([_.YM],"onboarding_goals_error",{error_type:"alert_select_responses"}),v(e.message),C(!1),s.current.scrollIntoView({behavior:"smooth"})})},I=(e,t)=>{(0,_.dU)([_.YM],"cta_tapped_onboarding",{action:"onboarding_responses",screen_name:"primary_goal",question_name:"primary_goal",responses:e,state:t})},P=(e,t)=>{let n,o=y.includes(t),i=k.includes(t);if(o&&t===S){O(""),v(""),M([...k]),I(t,"deselected");return}if((S?2===k.length:3===k.length)&&!i){(0,_.dU)([_.YM],"onboarding_goals_error",{error_type:"alert_too_many_responses"}),v("onboarding.unifiedGoals.maxResponses"),s.current.scrollIntoView({behavior:"smooth"});return}if(o&&t!==S){let e=[t,...k];O(t),M(e),I(t,"selected"),3===e.length&&N({selectedOptions:e,weightGoal:t});return}if(i){let e=k.indexOf(t);k.splice(e,1),E(k),v(""),I(t,"deselected")}else k.push(t),E(k),I(t,"selected");S?M(n=[S,...k]):M(n=[...k]),3===n.length&&N({selectedOptions:n,weightGoal:S})};return(0,n.jsx)(o.A,{ref:s,component:"form",onSubmit:e=>{e.preventDefault(),N({selectedOptions:B,weightGoal:S})},children:(0,n.jsxs)(i.A,{container:!0,direction:"column",children:[(0,n.jsx)(j.A,{title:t("onboarding.unifiedGoals.nowForGoals",{name:m?.first_name}),subtitle:t("onboarding.unifiedGoals.selectUpTo3Goals"),isError:!!A,errorMessage:A,children:(0,n.jsx)(r.A,{orientation:"vertical",value:B,fullWidth:!0,children:f.Oz["primary-account-goal"].options.map(({value:e,optionsPageButtonText:s})=>(0,n.jsx)(a.A,{onClick:P,value:e,children:(0,n.jsx)(l.A,{children:t(s)})},e))})}),(0,n.jsx)(b.A,{backUrl:"/account/create/input-name",loadingStatus:G})]})})}v.Layout=A.A,v.propTypes={classes:m().object};let G=v}},e=>{e.O(0,[7124,6692,9584,8357,9704,9568,636,6593,8792],()=>e(e.s=15593)),_N_E=e.O()}]); 2//# sourceMappingURL=goals-d535ac638136d55c.js.map
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.