1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="67fee56f-c133-4787-9670-a0f0436f7124",e._sentryDebugIdIdentifier="sentry-dbid-67fee56f-c133-4787-9670-a0f0436f7124")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2846],{69672:function(e,r,o){(window.__NEXT_P=window.__NEXT_P||[]).push(["/meal-plan",function(){return o(39381)}])},47099:function(e,r,o){"use strict";var t=o(64836);r.Z=void 0;var i=t(o(47955)),n=o(85893);r.Z=(0,i.default)((0,n.jsx)("path",{d:"M17 2c-.55 0-1 .45-1 1v1H8V3c0-.55-.45-1-1-1s-1 .45-1 1v1H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-1V3c0-.55-.45-1-1-1m2 18H5V10h14zm-8-7c0-.55.45-1 1-1s1 .45 1 1-.45 1-1 1-1-.45-1-1m-4 0c0-.55.45-1 1-1s1 .45 1 1-.45 1-1 1-1-.45-1-1m8 0c0-.55.45-1 1-1s1 .45 1 1-.45 1-1 1-1-.45-1-1m-4 4c0-.55.45-1 1-1s1 .45 1 1-.45 1-1 1-1-.45-1-1m-4 0c0-.55.45-1 1-1s1 .45 1 1-.45 1-1 1-1-.45-1-1m8 0c0-.55.45-1 1-1s1 .45 1 1-.45 1-1 1-1-.45-1-1"}),"CalendarMonthRounded")},82290:function(e,r,o){"use strict";var t=o(64836);r.Z=void 0;var i=t(o(47955)),n=o(85893);r.Z=(0,i.default)((0,n.jsx)("path",{d:"M14.71 6.71a.9959.9959 0 0 0-1.41 0L8.71 11.3c-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L10.83 12l3.88-3.88c.39-.39.38-1.03 0-1.41"}),"ChevronLeftRounded")},60892:function(e,r,o){"use strict";var t=o(64836);r.Z=void 0;var i=t(o(47955)),n=o(85893);r.Z=(0,i.default)((0,n.jsx)("path",{d:"M9.29 6.71c-.39.39-.39 1.02 0 1.41L13.17 12l-3.88 3.88c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41L10.7 6.7c-.38-.38-1.02-.38-1.41.01"}),"ChevronRightRounded")},27727:function(e,r,o){"use strict";var t=o(64836);r.Z=void 0;var i=t(o(47955)),n=o(85893);r.Z=(0,i.default)((0,n.jsx)("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2m6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2"}),"PauseRounded")},26196:function(e,r,o){"use strict";var t=o(64836);r.Z=void 0;var i=t(o(47955)),n=o(85893);r.Z=(0,i.default)((0,n.jsx)("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18c.62-.39.62-1.29 0-1.69L9.54 5.98C8.87 5.55 8 6.03 8 6.82"}),"PlayArrowRounded")},60195:function(e,r,o){"use strict";var t=o(85893),i=o(67294),n=o(14440),l=o(33367),a=o(82290),s=o(60892),d=o(13674);r.Z=e=>{let{children:r}=e,o=(0,d.lh)(),c=(0,i.useRef)(null),[u,x]=(0,i.useState)(!0),[p,f]=(0,i.useState)(!0),g=(0,i.useCallback)(()=>{let e=c.current;if(!e)return;let{scrollLeft:r,scrollWidth:o,clientWidth:t}=e;x(r<=1),f(r+t>=o-1)},[]);(0,i.useEffect)(()=>{g();let e=c.current;if(e)return e.addEventListener("scroll",g,{passive:!0}),window.addEventListener("resize",g),()=>{e.removeEventListener("scroll",g),window.removeEventListener("resize",g)}},[g,r]);let h=e=>{let r=c.current;r&&r.scrollBy({left:e*r.clientWidth*.8,behavior:"smooth"})},m=(e,r)=>({position:"absolute",top:0,bottom:0,[e]:0,width:56,pointerEvents:"none",zIndex:1,opacity:r?1:0,background:"linear-gradient(to ".concat("left"===e?"right":"left",", ").concat(o.backgroundColor,", transparent)"),transition:(0,d.eR)(["opacity"]),...d.Gd}),b={position:"absolute",top:"40%",transform:"translateY(-50%)",zIndex:2,width:38,height:38,backgroundColor:o.backgroundColor,color:o.textColor,border:"1px solid ".concat(o.outlineColor),boxShadow:"0 2px 10px rgba(0, 0, 0, 0.12)",opacity:0,transition:(0,d.eR)(["opacity","background-color"]),...d.Gd,"&:hover":{backgroundColor:o.cardBackgroundColor}};return(0,t.jsxs)(n.Z,{sx:{position:"relative","&:hover .hscroll-arrow":{opacity:1}},children:[(0,t.jsx)(n.Z,{ref:c,sx:{display:"flex",gap:2,overflowX:"auto",scrollBehavior:"smooth",scrollSnapType:"x proximity","& > *":{scrollSnapAlign:"start"},scrollbarWidth:"none",msOverflowStyle:"none","&::-webkit-scrollbar":{display:"none"}},children:r}),(0,t.jsx)(n.Z,{sx:m("left",!u),"aria-hidden":!0}),(0,t.jsx)(n.Z,{sx:m("right",!p),"aria-hidden":!0}),!u&&(0,t.jsx)(l.Z,{className:"hscroll-arrow","aria-label":"Scroll left",onClick:()=>h(-1),sx:{...b,left:6},children:(0,t.jsx)(a.Z,{})}),!p&&(0,t.jsx)(l.Z,{className:"hscroll-arrow","aria-label":"Scroll right",onClick:()=>h(1),sx:{...b,right:6},children:(0,t.jsx)(s.Z,{})})]})}},37228:function(e,r,o){"use strict";o.d(r,{M:function(){return u},M9:function(){return x},Tl:function(){return c},gG:function(){return f},iy:function(){return d},p4:function(){return p}});var t=o(90109),i=o(12343),n=o(67748);let l=e=>(Array.isArray(e)?e:[]).map(e=>({meals:(Array.isArray(null==e?void 0:e.meals)?e.meals:[]).map(e=>{var r,o;return{id:null!==(r=null==e?void 0:e.id)&&void 0!==r?r:"",name:null!==(o=null==e?void 0:e.name)&&void 0!==o?o:"",recipes:(Array.isArray(null==e?void 0:e.recipes)?e.recipes:[]).map(e=>{var r,o;return{recipeId:null!==(r=null==e?void 0:e.id)&&void 0!==r?r:"",servings:null!==(o=null==e?void 0:e.servings)&&void 0!==o?o:null}})}})})),a=e=>"number"==typeof e?e:e&&"function"==typeof e.toMillis?e.toMillis():null,s=(e,r)=>{var o,t,i,n,s,d;return{docId:e,name:null!==(o=r.name)&&void 0!==o?o:"",description:null!==(t=r.description)&&void 0!==t?t:"",descriptionRich:null!==(i=r.descriptionRich)&&void 0!==i?i:null,imageUrl:null!==(n=r.image_url)&&void 0!==n?n:"",premium:!!r.premium,createdBy:null!==(s=r.created_by)&&void 0!==s?s:"",createdAt:Number(null!==(d=r.created_at)&&void 0!==d?d:0),releaseDate:a(r["release-date"]),days:l(r.days)}},d=async()=>{let e=await (0,t.PL)((0,t.hJ)(i.db,n.ym.MEAL_PLAN)),r=Date.now();return e.docs.map(e=>s(e.id,e.data())).filter(e=>!e.createdBy&&(null==e.releaseDate||e.releaseDate<r))},c=async e=>{let r=[...new Set(e.filter(Boolean))];return 0===r.length?[]:(await Promise.all(r.map(e=>(0,t.QT)((0,t.JU)(i.db,n.ym.MEAL_PLAN,e))))).filter(e=>e.exists()).map(e=>s(e.id,e.data()))},u=async e=>{let r=await (0,t.QT)((0,t.JU)(i.db,n.ym.MEAL_PLAN,e));return r.exists()?s(r.id,r.data()):null},x=async e=>{let{userId:r,planId:o}=e,l=(0,t.JU)(i.db,n.ym.USER,r),a=await (0,t.QT)(l),s=a.exists()?a.data().active_meals:void 0;Array.isArray(s)?await (0,t.r7)(l,{active_meals:[...s,o]}):await (0,t.r7)(l,{active_meals:(0,t.vr)(o)})},p=async e=>{let{userId:r,planId:o}=e;await (0,t.r7)((0,t.JU)(i.db,n.ym.USER,r),{active_meals:(0,t.Ab)(o)})},f=async e=>{var r,o;let{userId:l,planId:a,log:s}=e,d=(0,t.JU)(i.db,n.ym.USER,l),c=await (0,t.QT)(d),u=c.exists()&&null!==(r=c.data().meal_plan_cooking_logs)&&void 0!==r?r:[],x={day:s.day,group_id:s.groupId,recipe_id:s.recipeId}
1,p=u.findIndex(e=>(null==e?void 0:e.id)===a);if(-1===p)u.push({id:a,cooked_recipe:[x]});else{let e=Array.isArray(null===(o=u[p])||void 0===o?void 0:o.cooked_recipe)?[...u[p].cooked_recipe]:[],r=e.findIndex(e=>(null==e?void 0:e.day)===x.day&&(null==e?void 0:e.group_id)===x.group_id&&(null==e?void 0:e.recipe_id)===x.recipe_id);-1===r?e.push(x):e.splice(r,1),u[p]={...u[p],cooked_recipe:e}}await (0,t.r7)(d,{meal_plan_cooking_logs:u})}},39381:function(e,r,o){"use strict";o.r(r),o.d(r,{default:function(){return et}});var t=o(85893),i=o(67294),n=o(9008),l=o.n(n),a=o(11163),s=o(14440),d=o(94246),c=o(33367),u=o(97353),x=o(34934),p=o(23066),f=o(26196),g=o(27727),h=o(82290),m=o(60892),b=o(74645),y=o(46623),v=o(47099),C=o(57349),j=o(39424),k=o(80158),Z=o(12208),w=o(8658),S=o(67748),I=o(30117),E=o(48099),_=o(3817),M=o(21805),R=o(93471),T=o(32559),A=o(40417),L=o(49277),z=o(37228),P=o(10340),G=o(36583),N=o(88949),W=o(86006),D=o(75536),B=o(85922),O=o(62329),U=o(13674),H=o(77865),F=o(60195),V=o(19976),J=o(8639),q=o(42714),K=o(28693);let Q={bg:"#eaf6ee",text:"#298a47",border:"#bfe4cc"};var X=e=>{let{recipe:r,servings:o,cooked:i,locked:n,showLogAction:l,logBusy:a,onOpen:c,onToggleLog:u}=e,p=(0,U.lh)(),{i18n:f,language:g}=(0,k.CG)(e=>e.config),h=e=>(0,w.i0)({i18nDocs:f,language:g,text:e});return(0,t.jsxs)(s.Z,{role:"button",tabIndex:0,"aria-label":h(r.name),onClick:c,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),c())},sx:{width:236,maxWidth:"100%",flexShrink:0,borderRadius:"16px",overflow:"hidden",cursor:"pointer",backgroundColor:p.cardBackgroundColor,border:"1px solid ".concat(p.outlineColor),transition:(0,U.eR)(["box-shadow","transform"]),...U.Gd,"&:hover":{boxShadow:"0 12px 26px rgba(0, 0, 0, 0.12)",transform:"translateY(-2px)"},...(0,U.aE)(p)},children:[(0,t.jsxs)(s.Z,{sx:{position:"relative",height:150},children:[r.imageUrl?(0,t.jsx)(s.Z,{component:"img",src:r.imageUrl,alt:"",loading:"lazy",sx:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):null,i&&!l?(0,t.jsxs)(s.Z,{sx:{position:"absolute",top:10,left:10,display:"inline-flex",alignItems:"center",gap:.5,px:1,py:.25,borderRadius:"999px",backgroundColor:Q.bg},children:[(0,t.jsx)(V.Z,{sx:{color:Q.text,fontSize:13}}),(0,t.jsx)(d.Z,{sx:{color:Q.text,fontSize:11.5,fontWeight:700},children:h("Cooked")})]}):null,n?(0,t.jsx)(s.Z,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.30)"},children:(0,t.jsx)(s.Z,{sx:{width:36,height:36,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255,255,255,0.22)",backdropFilter:"blur(4px)"},children:(0,t.jsx)(q.Z,{sx:{color:"#fff",fontSize:18}})})}):null]}),(0,t.jsxs)(s.Z,{sx:{p:"14px 15px 15px"},children:[(0,t.jsx)(d.Z,{sx:{color:p.textColor,fontSize:15,fontWeight:700,lineHeight:1.25,minHeight:38,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:h(r.name)}),(0,t.jsxs)(s.Z,{sx:{mt:1,display:"flex",alignItems:"center",gap:1},children:[r.minutes?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(s.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(K.Z,{sx:{color:p.subTextColor,fontSize:14}}),(0,t.jsx)(d.Z,{sx:{color:p.subTextColor,fontSize:13,fontWeight:600},children:"".concat(r.minutes," ").concat(h("min"))})]}),(0,t.jsx)(s.Z,{sx:{width:3,height:3,borderRadius:"50%",backgroundColor:p.outlineColor}})]}):null,(0,t.jsx)(d.Z,{sx:{color:p.subTextColor,fontSize:13,fontWeight:600},children:"".concat(o," ").concat(h(o>1?"servings":"serving"))})]}),l?(0,t.jsxs)(s.Z,{component:"button",type:"button",disabled:a,onClick:e=>{e.stopPropagation(),u()},onKeyDown:e=>e.stopPropagation(),sx:{mt:1.5,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:.75,borderRadius:"11px",py:1.25,fontSize:13.5,fontWeight:700,cursor:a?"default":"pointer",opacity:a?.6:1,transition:(0,U.eR)(["background-color","border-color","color"]),...U.Gd,...i?{backgroundColor:Q.bg,color:Q.text,border:"1.5px solid ".concat(Q.border)}:{backgroundColor:p.cardBackgroundColor,color:p.primaryColor,border:"1.5px solid ".concat((0,U.fG)(p.primaryColor,.35)),"&:hover":{backgroundColor:(0,U.fG)(p.primaryColor,.06),borderColor:p.primaryColor}},...(0,U.aE)(p)},children:[a?(0,t.jsx)(x.Z,{size:14,thickness:5,sx:{color:i?Q.text:p.primaryColor}}):i?(0,t.jsx)(V.Z,{sx:{fontSize:15}}):(0,t.jsx)(J.Z,{sx:{fontSize:15}}
1),h(i?"Added to Log":"Add to Log")]}):null]})]})},Y=o(21113),$=o(35674),ee=o(70309);let er=[{bg:"#fde6ee",text:"#e04d7e"},{bg:"#eaf6ee",text:"#298a47"},{bg:"#fdeede",text:"#c9803a"},{bg:"#ecebfa",text:"#6a63c4"}],eo={bg:"#eaf6ee",text:"#298a47"};var et=()=>{var e,r,o,n,V,J,q;let K=(0,k.CG)(e=>e.config),Q=(0,k.CG)(e=>e.auth),et=(0,k.CG)(e=>e.db.media),ei=(0,k.CG)(e=>e.db.freeAccessDrops),en=(0,k.TL)(),el=(0,a.useRouter)(),ea=(0,U.lh)(),{i18n:es,language:ed}=K,ec=(e,r)=>{var o,t;return(0,w.j8)({name:e,availableInLanguage:r,i18nDocs:es,language:ed,defaultLanguage:null===(t=K.appSetting)||void 0===t?void 0:null===(o=t.i18n)||void 0===o?void 0:o.defaultLanguage})},eu=e=>(0,w.i0)({i18nDocs:es,language:ed,text:e});(0,H.D)("meal_plan_details");let[ex,ep]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=el.query.id;e&&ep(e)},[el.query.id]);let[ef,eg]=(0,i.useState)(null),[eh,em]=(0,i.useState)({}),[eb,ey]=(0,i.useState)({}),[ev,eC]=(0,i.useState)(!0),[ej,ek]=(0,i.useState)(1),[eZ,ew]=(0,i.useState)(!1),[eS,eI]=(0,i.useState)(!1),[eE,e_]=(0,i.useState)({}),[eM,eR]=(0,i.useState)(!1),[eT,eA]=(0,i.useState)(!1),[eL,ez]=(0,i.useState)(null);(0,i.useEffect)(()=>{if(!eL||eM)return;let e=()=>eA(eL.scrollHeight>eL.clientHeight+1);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[eL,eM,null==ef?void 0:ef.description,ed]),(0,i.useEffect)(()=>{if(!ex)return;let e=!1;return eC(!0),(async()=>{try{let r=await (0,z.M)(ex);if(e)return;if(eg(r),ek(1),!r){em({}),ey({});return}let o=Array.from(new Set(r.days.flatMap(e=>e.meals).flatMap(e=>e.recipes.map(e=>e.recipeId)).filter(Boolean))),t=await Promise.all(o.map(async e=>{try{return await (0,G.wb)(e)}catch(e){return j.Tb(e),null}}));if(e)return;let i={};t.forEach(e=>{e&&(i[e.docId]=e)}),em(i);let n=Array.from(new Set(Object.values(i).flatMap(e=>e.ingredientGroups).flatMap(e=>e.ingredients.map(e=>e.ingredientId)).filter(Boolean))),l=new Map((null!=et?et:[]).map(e=>[e.docId,e])),a={},s=[];n.forEach(e=>{let r=l.get(e);r?a[e]=(0,G.ES)(r,e):s.push(e)});let d=s.length?await (0,G.ks)(s):{};e||ey({...a,...d})}catch(e){j.Tb(e)}finally{e||eC(!1)}})(),()=>{e=!0}},[ex,et]);let eP=(0,I.B)({lifetime:Q.lifetimeSubscription,subscriptionFromRC:Q.subscriptionFromRC,subscriptionFromCode:Q.subscriptionFromCode,subscriptions:Q.subscriptions}),eG=null!==(V=Q.firebaseUserId)&&void 0!==V?V:"",{appUser:eN}=Q,eW=!!ef&&(null!==(J=null==eN?void 0:eN.activeMeals)&&void 0!==J?J:[]).includes(ef.docId),eD=(0,i.useMemo)(()=>{var e;return!!ef&&!!ef.premium&&!eP&&!((0,E.fK)({unlockedMedias:null!==(e=Q.unlockedMedias)&&void 0!==e?e:[],mediaId:ef.docId})||(0,E.HJ)({drops:ei,mediaId:ef.docId,isLoggedIn:!!eN,isSubscribed:eP}))},[ef,eP,Q.unlockedMedias,ei,eN]),eB=e=>{var r;return!(!e.premium||null!=e.freeUntil&&e.freeUntil>new Date)&&!eP&&!((0,E.fK)({unlockedMedias:null!==(r=Q.unlockedMedias)&&void 0!==r?r:[],mediaId:e.docId})||(0,E.HJ)({drops:ei,mediaId:e.docId,isLoggedIn:!!eN,isSubscribed:eP}))},eO=(e,r)=>{var o,t;return!!(null===(o=(null!==(t=null==eN?void 0:eN.mealPlanCookingLogs)&&void 0!==t?t:[]).find(e=>e.id===(null==ef?void 0:ef.docId)))||void 0===o?void 0:o.cookedRecipes.some(o=>o.day===ej&&o.groupId===r&&o.recipeId===e))},eU=async e=>{let{eventName:r,data:o}=e,t=(0,_.Bd)(o);try{(0,M.j)(r,t)}catch(e){console.log("Firebase Analytics Log Error: ",e)}try{let e=await (0,R._)();null==e||e.event.push(r,t)}catch(e){console.log("CleverTap Log Error: ",e)}if("true"===S.S$.metaPixelEnabled)try{T.B("trackCustom",r,t)}catch(e){console.log("Meta Pixel Log Error: ",e)}},eH=(0,i.useRef)(null);(0,i.useEffect)(()=>{ef&&eH.current!==ef.docId&&(eH.current=ef.docId,eU({eventName:S.jH.OPEN_PAGE_MEAL_PLAN_DETAILS,data:{}}))},[ef]);let eF=async()=>{eG&&en((0,A.xs)(await (0,N.qk)({userId:eG,wait:!0})))},eV=e=>()=>{if(eD){el.push(S.Z6.SUBSCRIPTION);return}if(!eG){el.push(S.Z6.SIGNIN);return}e()},eJ=eV(async()=>{if(ef&&!eZ){ew(!0);try{eW?(await (0,z.p4)({userId:eG,planId:ef.docId}),eU({eventName:S.jH.MEAL_PLAN_DEACTIVATED,data:{[S.jg.CONTENT_ID]:ef.name}})):(await (0,z.M9)({userId:eG,planId:ef.docId}),eU({eventName:S.jH.MEAL_PLAN_ACTIVATED,data:{[S.jg.CONTENT_NAME]:ec(ef.name,null)}})),await eF(),en((0,Z.ss)({open:!0,severity:"success",message:eu(eW?"Meal plan deactivated":"Meal plan activated")}))}catch(e){j.Tb(e),en((0,Z.ss)({open:!0,severity:"error",message:eu("Something went wrong. Please try again.")}))}finally{ew(!1)}}}),eq=eV(async()=>{var e,r;if(!ef||eS)return;let o=(null!==(r=null===(e=ef.days[ej-1])||void 0===e?void 0:e.meals)&&void 0!==r?r:[]).flatMap(e=>e.recipes.flatMap(e=>{var r,o,t;return Array(Math.max(0,Math.trunc(null!==(t=null!==(o=e.servings)&&void 0!==o?o:null===(r=eh[e.recipeId])||void 0===r?void 0:r.defaultServings)&&void 0!==t?t:1))).fill(e.recipeId)}));if(0!==o.length){eI(!0);try{await (0,P.AV)({userId:eG,recipeIds:o}),eU({eventName:S.jH.MEAL_PLAN_TO_SHOPPING,data:{[S.jg.CONTENT_NAME]:ec(ef.name,null)}}),en((0,Z.ss)({open:!0,severity:"success",message:eu("You're one step closer! Ingredients added to your shopping list.")}))}catch(e){j.Tb(e),en((0,Z.ss)({open:!0,severity:"error",message:eu("Something went wrong. Please try again.")}))}finally{eI(!1)}}}),eK=(e,r)=>eV(async()=>
1{if(!ef)return;let o="".concat(r,"-").concat(e.docId);if(!eE[o]){e_(e=>({...e,[o]:!0}));try{if(!eO(e.docId,r)){await (0,N.UK)({minutes:0,mediaId:e.docId,mediaName:e.name,userId:eG,skipUserStatistic:!0}),(0,$.xp)({uid:eG,design:K.design,appUser:Q.appUser,stats:null,contentMediaIds:[e.docId]}).then(e=>{var r,o;return(0,ee.g)({achievements:e,streakEnabled:null===(o=null===(r=Q.appUser)||void 0===r?void 0:r.streakEnabled)||void 0===o||o})}),await (0,G.JB)({userId:eG,recipeId:e.docId});let r=e.ingredientGroups.flatMap(e=>e.ingredients).filter(e=>{var r;return null===(r=eb[e.ingredientId])||void 0===r?void 0:r.isPlantBased}).length;await (0,G.vK)({userId:eG,count:r})}await (0,z.gG)({userId:eG,planId:ef.docId,log:{day:ej,groupId:r,recipeId:e.docId}}),await eF()}catch(e){j.Tb(e),en((0,Z.ss)({open:!0,severity:"error",message:eu("Something went wrong. Please try again.")}))}finally{e_(e=>({...e,[o]:!1}))}}})(),eQ=e=>{if(eB(e)){el.push(S.Z6.SUBSCRIPTION);return}el.push({pathname:S.Z6.RECIPE,query:{id:e.docId}})},eX=null!==(q=null==ef?void 0:ef.days[ej-1])&&void 0!==q?q:null,eY=e=>{let r=eh[e];return!r||null==r.releaseDate||r.releaseDate>new Date?null:r},e$=(0,i.useMemo)(()=>{if(!eX)return[];let e=new Map;return eX.meals.forEach(r=>{r.recipes.forEach(r=>{var o;let t=eY(r.recipeId);if(!t)return;let i=null!==(o=r.servings)&&void 0!==o?o:t.defaultServings;t.ingredientGroups.forEach(r=>r.ingredients.forEach(r=>{var o;if(!eb[r.ingredientId])return;let n=(0,L.wO)({defaultServing:t.defaultServings,totalAmount:String(r.quantity),selectedServings:i});e.set(r.ingredientId,(null!==(o=e.get(r.ingredientId))&&void 0!==o?o:0)+n)}))})}),Array.from(e.entries()).map(e=>{let[r,o]=e;return{ingredient:eb[r],quantity:o}})},[eX,eh,eb]),e0=(0,i.useMemo)(()=>{if(!eX)return null;let e=0,r=0,o=0;return(eX.meals.forEach(t=>t.recipes.forEach(t=>{let i=eY(t.recipeId);(null==i?void 0:i.nutritionSummary)&&(e+=i.nutritionSummary.protein,r+=i.nutritionSummary.carbs,o+=i.nutritionSummary.fat)})),e+r+o===0)?null:{protein:e,carbs:r,fat:o}},[eX,eh]);if(K.isLoading||Q.isLoading||!ex)return(0,t.jsx)(W.Z,{});let e1={backgroundColor:ea.cardBackgroundColor,borderRadius:"20px",boxShadow:"0 12px 30px rgba(0, 0, 0, 0.06)",overflow:"hidden"},e5=e=>{let{title:r,trailing:o}=e;return(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:1.25,mb:2},children:[(0,t.jsx)(s.Z,{sx:{width:5,height:22,borderRadius:"3px",backgroundColor:ea.primaryColor,flexShrink:0}}),(0,t.jsx)(d.Z,{component:"h2",sx:{color:ea.textColor,fontSize:20,fontWeight:700,letterSpacing:"-0.01em"},children:eu(r)}),o?(0,t.jsx)(s.Z,{sx:{ml:"auto"},children:o}):null]})},e2=(null===(o=K.design)||void 0===o?void 0:null===(r=o.media_page)||void 0===r?void 0:null===(e=r.recipe)||void 0===e?void 0:e.plural)||"Recipes";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l(),{children:[(0,t.jsx)("link",{rel:"icon",href:null===(n=K.paywall)||void 0===n?void 0:n.logoUrl,type:"image/jpg",sizes:"32x32"}),(0,t.jsx)("title",{children:ef?eu(ef.name):eu("Meal Plan")})]}),(0,t.jsx)(s.Z,{sx:{backgroundColor:ea.backgroundColor,minHeight:"100vh"},children:(0,t.jsx)(s.Z,{sx:{maxWidth:980,mx:"auto",px:{xs:2,sm:3},py:{xs:2.5,sm:4}},children:ev?(0,t.jsx)(B.Z,{}):ef?(0,t.jsxs)(s.Z,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,t.jsxs)(s.Z,{sx:e1,children:[(0,t.jsxs)(s.Z,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:2.5,md:4},p:{xs:2.5,md:3.5}},children:[(0,t.jsxs)(s.Z,{sx:{position:"relative",flexShrink:0,alignSelf:"flex-start",width:{xs:"100%",md:340},height:{md:340},aspectRatio:"1 / 1",borderRadius:"18px",overflow:"hidden",backgroundColor:ea.backgroundColor,boxShadow:"0 14px 32px ".concat((0,U.fG)(ea.primaryColor,.18))},children:[ef.imageUrl?(0,t.jsx)(s.Z,{component:"img",src:ef.imageUrl,alt:"",sx:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):null,(0,t.jsx)(c.Z,{"aria-label":eu("Back"),onClick:()=>window.history.length>1?el.back():el.push(S.Z6.HOME),sx:{position:"absolute",top:12,left:12,width:40,height:40,backgroundColor:"rgba(255,255,255,0.92)",color:ea.primaryColor,boxShadow:"0 3px 10px rgba(0,0,0,0.14)","&:hover":{backgroundColor:"#fff"},...(0,U.aE)(ea)},children:(0,t.jsx)(p.Z,{})}),(0,t.jsx)(s.Z,{sx:{position:"absolute",left:14,bottom:14,px:1.5,py:.6,borderRadius:"999px",backgroundColor:"rgba(0, 0, 0, 0.62)",backdropFilter:"blur(4px)"},children:(0,t.jsx)(d.Z,{sx:{color:"#fff",fontSize:12,fontWeight:600},children:"".concat(eu("Day")," ").concat(ej," ").concat(eu("of")," ").concat(ef.days.length)})})]}),(0,t.jsxs)(s.Z,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:"column",minHeight:{md:340}},children:[(0,t.jsxs)(s.Z,{sx:{alignSelf:"flex-start",display:"inline-flex",alignItems:"center",gap:.9,px:1.5,py:.6,borderRadius:"999px",backgroundColor:eW?"#eaf6ee":(0,U.fG)(ea.subTextColor,.12)},children:[(0,t.jsx)(s.Z,{sx:{width:8,height:8,borderRadius:"50%",backgroundColor:eW?"#34c759":ea.subTextColor}}),(0,t.jsx)(d.Z,{sx:{color:eW?"#298a47":ea.subTextColor,fontSize:11.5,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase"},children:eu(eW?"Active Plan":"Not Active")}
1)]}),(0,t.jsx)(d.Z,{component:"h1",sx:{flexShrink:0,color:ea.textColor,fontSize:{xs:26,md:30},fontWeight:800,lineHeight:1.15,letterSpacing:"-0.02em",mt:1},children:eu(ef.name)}),ef.description||ef.descriptionRich?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.Z,{sx:{mt:1.25},children:(0,t.jsx)(d.Z,{ref:ez,component:"div",sx:{color:ea.subTextColor,fontSize:15,lineHeight:1.6,maxWidth:"60ch",...eM?{}:{display:"-webkit-box",WebkitLineClamp:5,WebkitBoxOrient:"vertical",overflow:"hidden"}},children:(0,t.jsx)(D.Z,{descriptionRich:ef.descriptionRich,fallbackText:eu(ef.description),linkColor:ea.primaryColor,analyticsSource:"/mealPlan"})})}),eT?(0,t.jsx)(s.Z,{component:"button",type:"button",onClick:()=>eR(e=>!e),sx:{flexShrink:0,alignSelf:"flex-start",mt:.5,p:0,border:"none",background:"none",cursor:"pointer",color:ea.primaryColor,fontSize:14,fontWeight:600,borderRadius:"4px",...(0,U.aE)(ea)},children:eu(eM?"Show less":"Read more")}):null]}):null,(0,t.jsx)(s.Z,{sx:{mt:2,display:"flex",gap:1.25,flexWrap:"wrap"},children:[e0?{icon:(0,t.jsx)(b.Z,{sx:{color:ea.primaryColor,fontSize:18}}),value:"".concat(Math.round(4*e0.protein+4*e0.carbs+9*e0.fat)),label:"".concat(eu("kcal")," / ").concat(eu("day"))}:null,eX?{icon:(0,t.jsx)(y.Z,{sx:{color:ea.primaryColor,fontSize:18}}),value:"".concat(eX.meals.length),label:"".concat(eu("meals")," / ").concat(eu("day"))}:null,{icon:(0,t.jsx)(v.Z,{sx:{color:ea.primaryColor,fontSize:18}}),value:"".concat(ef.days.length),label:eu("day plan")}].filter(Boolean).map((e,r)=>(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:1,px:1.75,py:1.25,borderRadius:"12px",backgroundColor:(0,U.fG)(ea.subTextColor,.08)},children:[e.icon,(0,t.jsxs)(s.Z,{children:[(0,t.jsx)(d.Z,{sx:{color:ea.textColor,fontSize:15,fontWeight:700,lineHeight:1},children:e.value}),(0,t.jsx)(d.Z,{sx:{color:ea.subTextColor,fontSize:11,mt:.25},children:e.label})]})]},r))}),(0,t.jsxs)(s.Z,{sx:{flexShrink:0,mt:"auto",pt:2.5,display:"flex",alignItems:"center",gap:1.75},children:[(0,t.jsx)(d.Z,{sx:{color:ea.subTextColor,fontSize:14,fontWeight:600},children:eu("Viewing")}),(0,t.jsxs)(s.Z,{sx:{display:"inline-flex",alignItems:"center",border:"1.5px solid ".concat((0,U.fG)(ea.primaryColor,.3)),borderRadius:"12px",overflow:"hidden",backgroundColor:ea.cardBackgroundColor},children:[(0,t.jsx)(c.Z,{"aria-label":eu("Previous day"),onClick:()=>ek(e=>Math.max(1,e-1)),disabled:ej<=1,sx:{borderRadius:0,width:38,height:42,color:ea.primaryColor,backgroundColor:(0,U.fG)(ea.primaryColor,.08),"&:hover":{backgroundColor:(0,U.fG)(ea.primaryColor,.16)},"&.Mui-disabled":{color:ea.subTextColor,opacity:.5}},children:(0,t.jsx)(h.Z,{})}),(0,t.jsx)(d.Z,{sx:{minWidth:90,textAlign:"center",color:ea.textColor,fontSize:15,fontWeight:700},children:"".concat(eu("Day")," ").concat(ej)}),(0,t.jsx)(c.Z,{"aria-label":eu("Next day"),onClick:()=>ek(e=>Math.min(ef.days.length,e+1)),disabled:ej>=ef.days.length,sx:{borderRadius:0,width:38,height:42,color:ea.primaryColor,backgroundColor:(0,U.fG)(ea.primaryColor,.08),"&:hover":{backgroundColor:(0,U.fG)(ea.primaryColor,.16)},"&.Mui-disabled":{color:ea.subTextColor,opacity:.5}},children:(0,t.jsx)(m.Z,{})})]})]})]})]}),(0,t.jsxs)(s.Z,{sx:{display:"flex",gap:1.5,flexWrap:{xs:"wrap",sm:"nowrap"},p:{xs:2,md:2.5},borderTop:"1px solid ".concat(ea.outlineColor),backgroundColor:(0,U.fG)(ea.primaryColor,.04)},children:[eW?(0,t.jsx)(u.Z,{onClick:eq,disabled:eS,disableElevation:!0,startIcon:eS?(0,t.jsx)(x.Z,{size:18,thickness:5,sx:{color:ea.textOnPrimary}}):(0,t.jsx)(C.Z,{}),sx:{flex:1.4,minWidth:{xs:"100%",sm:0},py:1.75,borderRadius:"14px",textTransform:"none",fontSize:15.5,fontWeight:700,backgroundColor:ea.primaryColor,color:ea.textOnPrimary,boxShadow:"0 10px 24px ".concat((0,U.fG)(ea.primaryColor,.4)),"&:hover":{backgroundColor:ea.primaryColor},"&.Mui-disabled":{backgroundColor:(0,U.fG)(ea.primaryColor,.6),color:ea.textOnPrimary},transition:(0,U.eR)(["transform","box-shadow"]),...U.Gd,"&:active":{transform:"scale(0.99)"},...(0,U.aE)(ea)},children:eu("Add to shopping list")}):null,(0,t.jsx)(u.Z,{onClick:eJ,disabled:eZ,disableElevation:!0,startIcon:eZ?(0,t.jsx)(x.Z,{size:18,thickness:5,sx:{color:eW?ea.primaryColor:ea.textOnPrimary}}):eW?(0,t.jsx)(g.Z,{}):(0,t.jsx)(f.Z,{}),sx:{flex:1,py:1.75,borderRadius:"14px",textTransform:"none",fontSize:15.5,fontWeight:700,...eW?{color:ea.primaryColor,backgroundColor:ea.cardBackgroun
1dColor,border:"2px solid ".concat((0,U.fG)(ea.primaryColor,.35)),"&:hover":{backgroundColor:(0,U.fG)(ea.primaryColor,.06),borderColor:ea.primaryColor}}:{backgroundColor:ea.primaryColor,color:ea.textOnPrimary,boxShadow:"0 10px 24px ".concat((0,U.fG)(ea.primaryColor,.4)),"&:hover":{backgroundColor:ea.primaryColor},"&.Mui-disabled":{backgroundColor:(0,U.fG)(ea.primaryColor,.6),color:ea.textOnPrimary}},transition:(0,U.eR)(["transform","box-shadow"]),...U.Gd,"&:active":{transform:"scale(0.99)"},...(0,U.aE)(ea)},children:eu(eW?"Deactivate Meal Plan":"Activate Meal Plan")})]})]}),eX&&eX.meals.length>0?(0,t.jsxs)(s.Z,{sx:{...e1,p:{xs:2.5,md:3.5}},children:[(0,t.jsx)(e5,{title:e2,trailing:(0,t.jsx)(d.Z,{sx:{color:ea.subTextColor,fontSize:12.5,fontWeight:600,px:1.5,py:.5,borderRadius:"999px",backgroundColor:(0,U.fG)(ea.subTextColor,.08)},children:"".concat(eu("Day")," ").concat(ej)})}),eX.meals.map((e,r)=>{let o=e.recipes.map(e=>({ref:e,recipe:eY(e.recipeId)})).filter(e=>e.recipe);if(0===o.length)return null;let i=er[r%er.length];return(0,t.jsxs)(s.Z,{sx:{mb:3},children:[(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:1.25,mb:1.5},children:[e.name?(0,t.jsx)(d.Z,{sx:{px:1.5,py:.6,borderRadius:"999px",backgroundColor:i.bg,color:i.text,fontSize:11.5,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase"},children:eu(e.name)}):null,(0,t.jsx)(d.Z,{sx:{color:ea.subTextColor,fontSize:12.5},children:"".concat(o.length," ").concat(eu(o.length>1?"recipes":"recipe"))})]}),(0,t.jsx)(F.Z,{children:(0,t.jsx)(s.Z,{sx:{display:"flex",gap:2},children:o.map(r=>{var o;let{ref:i,recipe:n}=r;return(0,t.jsx)(X,{recipe:n,servings:null!==(o=i.servings)&&void 0!==o?o:n.defaultServings,cooked:eO(n.docId,e.id),locked:eB(n),showLogAction:eW&&!!eG,logBusy:!!eE["".concat(e.id,"-").concat(n.docId)],onOpen:()=>eQ(n),onToggleLog:()=>eK(n,e.id)},"".concat(e.id,"-").concat(n.docId))})})})]},e.id)})]}):(0,t.jsx)(O.Z,{}),e$.length>0?(0,t.jsxs)(s.Z,{sx:{...e1,p:{xs:2.5,md:3.5}},children:[(0,t.jsx)(e5,{title:"Ingredients",trailing:(0,t.jsx)(d.Z,{sx:{color:ea.subTextColor,fontSize:12.5,fontWeight:600,px:1.5,py:.5,borderRadius:"999px",backgroundColor:(0,U.fG)(ea.subTextColor,.08)},children:"".concat(e$.length," ").concat(eu("items"))})}),(0,t.jsx)(s.Z,{sx:{columnGap:5,columns:{xs:"1",sm:"2"}},children:e$.map(e=>{let{ingredient:r,quantity:o}=e;return(0,t.jsxs)(s.Z,{sx:{breakInside:"avoid",display:"flex",alignItems:"flex-start",gap:1.5,py:1.25,borderBottom:"1px solid ".concat(ea.outlineColor)},children:[(0,t.jsx)(s.Z,{sx:{width:7,height:7,borderRadius:"50%",backgroundColor:ea.primaryColor,mt:"8px",flexShrink:0}}),(0,t.jsxs)(d.Z,{sx:{color:ea.textColor,fontSize:15,lineHeight:1.5},children:[0!==o?(0,t.jsx)(s.Z,{component:"span",sx:{fontWeight:700},children:"".concat((0,L.TM)(o)," ")}):null,[eu(r.unitOfMeasurement),eu(r.name).toLowerCase()].filter(Boolean).join(" ")]})]},r.docId)})})]}):null,e0?(0,t.jsxs)(s.Z,{sx:{...e1,p:{xs:2.5,md:3.5}},children:[(0,t.jsx)(e5,{title:"Nutrition",trailing:(0,t.jsx)(d.Z,{sx:{color:eo.text,fontSize:12.5,fontWeight:700,px:1.5,py:.5,borderRadius:"999px",backgroundColor:eo.bg},children:"".concat(eu("Day")," ").concat(ej," ").concat(eu("total"))})}),(0,t.jsx)(Y.Z,{summary:e0,variant:"bars"})]}):null]}):(0,t.jsx)(O.Z,{})})})]})}}},function(e){e.O(0,[3288,8304,2888,9774,179],function(){return e(e.s=69672)}),_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.