import{g as j,aT as q,aV as ot,m as K,r as E,h as u,bw as G,E as V,n as H,o,c as l,a as t,H as O,aj as $,s as L,t as x,x as p,d as z,j as s,bb as pt,bc as ht,K as xt,cO as _t,aP as ft,aN as mt,b7 as vt,u as bt,by as R,i as gt,w as yt,q as S,am as Ct,b as nt,aC as kt,au as Pt,bK as Tt,bx as at,bz as Et,cP as At,p as It,f as St,_ as Ut}from"./D-NqFN1U.js";const Nt={class:"tw-absolute tw-z-10 tw-top-full tw-w-full tw-left-0 tw-pt-[9px] tw-opacity-0 tw-invisible tw-transition-all group-hover/drop:tw-opacity-100 group-hover/drop:tw-visible"},Rt={class:"tw-bg-white tw-p-2 tw-rounded-[7px] tw-text-[16px] tw-leading-none tw-font-medium tw-text-left tw-shadow-nl-12"},Dt=["onClick"],Ot={key:0},$t={key:1},Mt=j({__name:"ChangePlanPopup",props:{show:{type:Boolean}},emits:["show"],setup(T,{emit:n}){const _=n,i=q(),r=ot(),f=K(),w=E(),v=u(()=>i.selectedPlan);function k(d){w.value=d&&i.plans.find(N=>N.id==d),A()}function P(){_("show",!1)}async function A(){if(v.value&&v.value.id==w.value.id)return P(),h();v.value&&v.value.threshold>w.value.threshold?await m():await U(),f.replace({query:{...f.currentRoute.value.query,plan:w.value.slug}}),h(),P()}async function m(){await i.UPDATE_PLAN({planId:w.value.id,sourceUrl:window.location.href})}async function U(){await i.UPDATE_PLAN({planId:w.value.id,sourceUrl:window.location.href}),r.pendingCartItem&&r.pendingCartItem.sku&&await I.value.addProduct(r.pendingCartItem,window.location.href)}function h(){r.SET_PRODUCT_ABOUT_TO_BE_ADDED_TO_CART(null)}const I=u(()=>new G(i.$state));return V(()=>v.value,d=>{w.value=d}),H(()=>{w.value=v.value}),(d,N)=>(o(),l("div",Nt,[t("ul",Rt,[(o(!0),l(O,null,$(s(i).plans,C=>(o(),l("li",{key:C.id},[t("a",{href:"#",onClick:L(W=>k(C.id),["prevent"]),class:"tw-block tw-py-3 tw-px-2 tw-rounded-[7px] hover:tw-bg-[#e7f2ed] hover:tw-font-bold tw-transition-all"},[t("span",null,[t("span",null,x(C.threshold),1),C.can_exceed_threshold?(o(),l("span",Ot,x(C.can_exceed_threshold?"+":""),1)):p("",!0),z(" items "),C.description?(o(),l("span",$t,"("+x(C.description)+")",1)):p("",!0)])],8,Dt)]))),128))])]))}}),Ft={class:"tw-flex tw-flex-col tw-gap-[12px]"},Bt=["onClick"],Lt={class:"tw-text-center tw-w-[51px] tw-h-full tw-font-black tw-font-agenda tw-text-[32px] tw-uppercase tw-leading-3 tw-flex tw-justify-center tw-items-center tw-rounded-tl-[6px] tw-rounded-bl-[6px] tw-bg-[#DAE8E1]"},zt=t("div",{class:"tw-px-[18px] tw-max-w-[145px] tw-w-full tw-font-bold"},"items per week",-1),jt={class:"tw-ml-auto tw-pr-[9px] tw-pt-[5px] tw-flex tw-flex-col tw-mb-auto tw-h-full tw-w-full tw-max-w-[69px] tw-items-end"},qt={key:0,class:"tw-relative tw-w-[46px] tw-mb-[8px] tw-h-full"},Kt=t("svg",{class:"tw-absolute tw-z-1",width:"49",height:"22",viewBox:"0 0 49 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("path",{d:"M22.2287 1.35628C17.1879 -0.762878 8.99348 -0.762975 3.95251 4.00538C-5.56897 13.0118 4.32651 21.5906 10.4668 20.4288C16.0678 19.3691 17.809 19.6174 26.7094 21.4883C31.7502 22.548 39.0313 22.0182 44.0721 19.3692C53.0734 14.6389 48.6477 1.02945 39.5914 1.88609C33.9906 2.41588 30.1742 4.69659 22.2287 1.35628Z",fill:"#008753"})],-1),Gt={class:"tw-text-[#FFFFFF] tw-text-[12px] tw-z-3 tw-relative tw-z-2 tw-w-full tw-flex tw-justify-center tw-items-center tw-h-full tw-max-h-[20px] tw-font-semibold"},Vt={key:1,class:"tw-text-[11px] tw-leading-4 tw-font-medium tw-whitespace-nowrap"},Ht=j({__name:"SelectPlan",setup(T){const n=q(),_=ot(),i=K(),r=E(),f=pt(),w=u(()=>n.selectedPlan);function v(h){r.value=h&&n.plans.find(I=>I.id==h),k()}async function k(){var h;if(Number((h=f==null?void 0:f.user)==null?void 0:h.id)>0){window.location.href=ht;return}if(w.value&&w.value.id==r.value.id)return m();w.value&&w.value.threshold>r.value.threshold?await P():await A(),i.replace({query:{...i.currentRoute.value.query,plan:r.value.slug}}),m()}async function P(){await n.UPDATE_PLAN({planId:r.value.id,sourceUrl:window.location.href})}async function A(){await n.UPDATE_PLAN({planId:r.value.id,sourceUrl:window.location.href}),_.pendingCartItem&&_.pendingCartItem.sku&&await U.value.addProduct(_.pendingCartItem,window.location.href)}function m(){_.SET_PRODUCT_ABOUT_TO_BE_ADDED_TO_CART(null)}const U=u(()=>new G(n.$state));return V(()=>w.value,h=>{r.value=h}),H(()=>{r.value=w.value}),(h,I)=>(o(),l("ul",Ft,[(o(!0),l(O,null,$(s(n).plans,d=>(o(),l("li",{key:d.id,onClick:N=>v(d.id),class:"tw-right-0 tw-flex tw-max-w-[280px] tw-w-full tw-h-[51px] tw-items-center tw-justify-start tw-cursor-pointer tw-bg-[#F2F9F6] tw-rounded-[6px] tw-shadow-[3.71px_3.71px_4.64px_0px_#00000033] tw-outline tw-outline-transparent hover:tw-outline-[#008753]"},[t("div",Lt,x(d.threshold),1),zt,t("div",jt,[d.description?(o(),l("div",qt,[Kt,t("p",Gt,x(d.description),1)])):p("",!0),d.tag?(o(),l("div",Vt,[t("span",null,x(d.tag)+"!",1)])):p("",!0)])],8,Bt))),128))]))}}),Wt=xt("/assets/images/menu/m-divider.svg");class Yt extends Error{constructor(n){super(n),this.errorMessage=n}dispatchFlahsNotification(){let n=new CustomEvent("flashMessage",{detail:{type:"error",message:this.errorMessage},bubbles:!0});document.dispatchEvent(n)}}const y=T=>(It("data-v-6968ed4c"),T=T(),St(),T),Zt={key:0,class:"tw-overflow-y-auto custom-h"},Jt={class:"tw-overflow-y-auto tw-overflow-x-hidden"},Qt={class:"tw-p-3 tw-pb-4 tw-text-center tw-shadow-nl-3"},Xt=y(()=>t("strong",{class:"tw-block tw-text-[20px] tw-leading-[1.75] tw-uppercase tw-font-black"},"Your Box",-1)),te={class:"tw-block tw-font-black tw-text-[40px] tw-leading-none tw-mb-px"},ee={key:0},se={href:"#",class:"tw-inline-flex tw-items-center tw-gap-1 tw-bg-nl-white-100 tw-text-[14px] tw-leading-[1.2] tw-font-medium tw-rounded-[6px] tw-shadow-nl-9 tw-uppercase tw-px-3 tw-py-[3px]"},ne=["textContent"],ae={key:1,class:"tw-py-5 tw-px-[39px] tw-text-center tw-text-[16px] tw-leading-none tw-font-medium"},oe=y(()=>t("h3",{class:"tw-text-[21px] tw-leading-none tw-font-bold tw-mb-[14px]"}," Not sure where to start? ",-1)),le=y(()=>t("p",{class:"tw-mb-3"}," Mix & match any combination of items to create an order that fits your family’s need! ",-1)),ie=y(()=>t("p",{class:"tw-mb-3"}," Or choose one of the options below and we’ll fill your order with our top-rated favorites by category. ",-1)),ce=[oe,le,ie],we={class:"tw-flex tw-justify-end"},re={key:0,class:"tw-flex tw-flex-col tw-gap-[9px]"},de={class:"tw-flex-1 tw-flex tw-items-center tw-gap-[14px]"},ue={class:"tw-size-[88px] lg:tw-size-[55px] xxl:tw-size-[88px]"},pe=["src","alt"],he={class:"tw-flex-1"},xe={class:"tw-block tw-text-[16px] tw-leading-none tw-font-black tw-mb-[5px]"},_e={key:0,class:"tw-block tw-text-[14px] tw-leading-[1.07] tw-font-medium"},fe={class:"tw-shrink-0 tw-w-[100px] lg:tw-w-[60px] xxl:tw-w-[108px] tw-h-[30px] tw-white tw-bg-nl-green-300 tw-rounded-[6px] tw-flex tw-items-center tw-justify-between tw-text-white"},me=["onClick"],ve={class:"tw-text-[16px] tw-leading-none tw-font-bold"},be=["onClick"],ge={key:1,class:"tw-pt-[19px] tw-pb-[10px] tw-flex tw-justify-center tw-items-center"},ye=y(()=>t("img",{src:Wt,alt:"divider",class:"tw-w-[294px]"},null,-1)),Ce=[ye],ke={key:2,class:"tw-text-center tw-pb-5"},Pe=y(()=>t("strong",{class:"tw-block tw-uppercase tw-text-[16px] tw-leading-[1.2065] tw-font-bold tw-mb-[9px]"},"Complete with top-rated meals",-1)),Te={class:"tw-max-w-[247px] tw-mx-auto tw-flex tw-flex-col tw-gap-[6px]"},Ee=["onClick"],Ae={class:"tw-hidden md:tw-block"},Ie={key:0,class:"tw-px-1 tw-pt-4"},Se=["apiKey","chainId","storeId","baseUrl"],Ue=y(()=>t("span",{id:"autoscroll"},null,-1)),Ne={class:"tw-absolute tw-bottom-0 tw-right-0 tw-w-[343px] lg:tw-w-[270px] xxl:tw-w-[343px]"},Re={class:"tw-flex tw-flex-col tw-items-center tw-text-center tw-text-[16px] tw-leading-none tw-font-bold tw-bg-nl-yellow-100 tw-shadow-nl-4 tw-py-[9px] tw-uppercase -tw-px-2 tw-gap-[10px]"},De={class:"tw-w-full md:tw-hidden"},Oe={key:0,class:"tw-px-1"},$e=["apiKey","chainId","storeId","baseUrl"],Me={class:"tw-w-full tw-px-4"},Fe=["disabled"],Be={key:1,class:"tw-flex tw-h-full tw-flex-col tw-items-center tw-px-[25px]"},Le=y(()=>t("h1",{class:"tw-mt-[48px] tw-text-center tw-font-black tw-font-agenda tw-text-[32px] tw-uppercase tw-mb-[3px] tw-leading-9"}," Choose your plan to add to cart! ",-1)),ze=y(()=>t("p",{class:"tw-mb-[12px]"},"The more you get, the more you save!",-1)),je=y(()=>t("p",{class:"tw-text-center"}," We’re all about flexibility! Update your plan size, skip weeks, or cancel your account any time. ",-1)),qe=j({__name:"index",setup(T){_t(e=>({b4a40ed6:s(U),"0b6fc04c":s(v)}));const n=q(),{isAnyTopBannerVisible:_}=ft(n),i=mt(),r=vt(),f=K(),w=Tt(),v=E("180px"),k=E(),P=E(!1),A=E(),m=E(!1);bt({script:[{type:"module",crossorigin:"anonymous",src:"https://production-beam-widgets.beamimpact.com/web-sdk/v1.40.0/dist/components/select-nonprofit.js"}]});const U=u(()=>{var e,a;return((a=(e=k==null?void 0:k.value)==null?void 0:e.getBoundingClientRect())==null?void 0:a.height)+"px"});async function h(e){await n.FILL_CART_WITH_BESTSELLERS({bestsellerGroupId:e,sourceUrl:window.location.href})}async function I(e){await i.SUBTRACT_PRODUCT({sku:e,sourceUrl:window.location.href})}async function d(e){await n.UPDATE_PLAN({planId:e.id,sourceUrl:window.location.href})}async function N(){const e=n.plans.find(a=>{var g;return a.threshold>Number((g=b==null?void 0:b.value)==null?void 0:g.threshold)});e&&await d(e),f.replace({query:{...f.currentRoute.value.query,plan:e==null?void 0:e.slug}})}async function C(e){W();try{await Z.value.addProduct({sku:e,quantity:1},window.location.href)}catch(a){if(a instanceof Yt)return a.dispatchFlahsNotification();throw a}}function W(){var e,a,g;if((n.isCheckoutStepAvailable||i.cartProductsCount>=Number((e=n==null?void 0:n.selectedPlan)==null?void 0:e.threshold))&&((a=n.largestPlan)==null?void 0:a.id)!==((g=n.selectedPlan)==null?void 0:g.id))N();else return}function Y(){i.UPDATE_CART_STATE({isOpen:!1}),document.body.classList.remove("cart-box-active")}function lt(){if(Y(),n.isCheckoutStepAvailable)return at.includes(r.name)?f.push({name:R.CHECKOUT}):window.location.href=Et;if(r.name!==R.MENUS)return at.includes(r.name)?f.push({name:R.MENUS}):window.location.href=At}function it(e){let a=e;return e!=null&&e.startsWith("Finger")?"Finger Food":e!=null&&e.startsWith("Kids")?"Kids Meal":a}const Z=u(()=>new G(n.$state)),J=u(()=>i.cartProductsCount===0),Q=u(()=>{var e;return(e=n==null?void 0:n.selectedPlan)==null?void 0:e.threshold}),ct=u(()=>{var e,a;return((e=n==null?void 0:n.selectedPlan)==null?void 0:e.id)===((a=n==null?void 0:n.largestPlan)==null?void 0:a.id)}),wt=u(()=>n.isCheckoutStepAvailable?!ct.value:!0),M=u(()=>Number(Q.value)-i.cartProductsCount),rt=u(()=>r.name===R.SIGNUP||r.name===R.ONBOARDING_PLANS?!1:i.isCartOpen),b=u(()=>n.selectedPlan),F=u(()=>n.plans.find(e=>{var a;return e.threshold>Number((a=b==null?void 0:b.value)==null?void 0:a.threshold)}));H(async()=>{await n.GET_BESTSELLER_GROUPS({abandonedCartId:Z.value.state.abandonedCartId})}),V(()=>A.value,e=>{e?P.value=!0:P.value=!1});const dt=()=>{const e=document.getElementById("autoscroll");e&&e.scrollIntoView({behavior:"smooth",block:"end"})},X=u(()=>{var g;if(!b.value)return null;let e=b.value.threshold,a=i.cartProductsCount;if(a<e&&b.value.discount===0){let D=e-a;return"ADD "+D+(D===1?" ITEM!":" ITEMS!")}return((g=F.value)==null?void 0:g.discount)>0&&a===e?"ADD "+(F.value.threshold-a)+" ITEMS TO GET $"+F.value.discount+" OFF!":a<e?"ADD "+(e-a)+" ITEMS TO GET $"+b.value.discount+" OFF!":null});return(e,a)=>{const g=Mt,D=Ht;return o(),gt(Pt,{"enter-active-class":"tw-ease-out-quad tw-transition-all tw-duration-300","leave-active-class":"tw-ease-in-quad tw-transition-all tw-duration-200","enter-class":"tw-md:tw-opacity-0","enter-to-class":"tw-md:tw-opacity-100","leave-class":"tw-opacity-100","leave-to-class":"tw-opacity-0"},{default:yt(()=>{var tt,et;return[s(rt)?(o(),l("div",{key:0,role:"dialog","aria-labelledby":"modal-cart-title",class:S(["max-lg:tw-fixed max-lg:tw-inset-0 max-lg:tw-bg-nl-green-100/[0.35] max-lg:tw-z-50 max-lg:tw-flex max-lg:tw-justify-end lg:tw-sticky",{"lg:tw-top-[72px]":!s(_),"lg:tw-top-[128px]":s(_)}])},[t("span",{onClick:Y,"aria-label":"Close Dialog",class:"icon-main-times tw-text-[12px] tw-cursor-pointer tw-absolute tw-right-[18px] tw-top-[18px] tw-z-10 lg:tw-hidden"}),t("div",{class:S(["tw-h-[calc(--vh)] tw-w-[343px] lg:tw-w-[270px] xxl:tw-w-[343px] tw-shadow-nl-10 tw-z-[9] tw-bg-nl-yellow-100 tw-relative",{"lg:tw-h-[calc(var(--vh)-72px)]":!s(_),"lg:tw-h-[calc(var(--vh)-128px)]":s(_)}])},[s(n).selectedPlan?(o(),l("div",Zt,[t("div",Jt,[t("div",Qt,[Xt,t("strong",te,[z(x(s(i).cartProductsCount)+" ",1),s(i).cartProductsCount<=Number((et=(tt=s(n))==null?void 0:tt.largestPlan)==null?void 0:et.threshold)?(o(),l("span",ee,"/"+x(s(Q)),1)):p("",!0)]),t("div",{onMouseover:a[1]||(a[1]=c=>m.value=!0),onMouseleave:a[2]||(a[2]=c=>m.value=!1),class:"tw-group/drop tw-relative tw-inline-flex tw-min-w-[153px]"},[t("a",se,[z(" Change plan size "),t("span",{class:S(["icon-main-chevron-bold-right tw-inline-block tw-align-center tw-text-[10px] tw-relative tw-transition-all tw-transform tw-mt-px",[s(m)?"tw-rotate-90 tw-mt-0.5":""]])},null,2)]),Ct(nt(g,{show:s(m),onShow:a[0]||(a[0]=c=>m.value=c)},null,8,["show"]),[[kt,s(m)]])],32)]),s(X)?(o(),l("a",{key:0,href:"#",class:S([{"shake-animation":!(s(M)>0&&s(wt))},"tw-block tw-bg-nl-green-100 tw-p-3 tw-text-center"])},[t("span",{class:"tw-uppercase tw-text-[16px] tw-leading-[1.2] tw-font-bold tw-text-nl-yellow-100",textContent:x(s(X))},null,8,ne)],2)):p("",!0),s(i).cartProductsCount<1?(o(),l("div",ae,ce)):p("",!0),t("div",{ref_key:"mainSectionRef",ref:k,class:S(["tw-p-2.5 tw-pr-[15px]",[s(P)?"custom-h-with-beam":"custom-h"]])},[t("div",we,[s(J)?p("",!0):(o(),l("button",{key:0,onClick:a[3]||(a[3]=(...c)=>s(i).EMPTY_CART&&s(i).EMPTY_CART(...c)),class:"tw-inline-block tw-bg-nl-white-100 tw-text-[14px] tw-leading-[1.2] tw-font-medium tw-rounded-[6px] tw-shadow-nl-9 tw-uppercase tw-px-3 tw-py-[3px]"}," Empty Box "))]),s(J)?p("",!0):(o(),l("div",re,[(o(!0),l(O,null,$(s(i).cartProducts,c=>{var B,st;return o(),l("div",{key:c.sku,class:"tw-flex tw-items-center tw-gap-[11px]"},[t("div",de,[t("div",ue,[t("img",{src:c.image.cartMobile,alt:c.name,class:"tw-w-full tw-h-full tw-object-cover"},null,8,pe)]),t("div",he,[t("strong",xe,x(c.name),1),(B=c==null?void 0:c.category)!=null&&B.name?(o(),l("span",_e,x(it((st=c==null?void 0:c.category)==null?void 0:st.name)),1)):p("",!0)])]),t("div",fe,[t("span",{onClick:ut=>I(c.sku),"aria-label":"Decrease quantity",class:"tw-w-[30px] tw-h-[30px] tw-text-[24px] tw-leading-none tw-flex tw-items-center tw-justify-center tw-cursor-pointer -tw-mt-0.5"},"-",8,me),t("span",ve,x(c.quantity),1),t("span",{onClick:ut=>C(c.sku),"aria-label":"Increase quantity",class:"tw-w-[30px] tw-h-[30px] tw-text-[24px] tw-leading-none tw-flex tw-items-center tw-justify-center tw-cursor-pointer -tw-mt-0.5"},"+",8,be)])])}),128))])),s(M)>0&&s(n).bestsellerGroups.length>0?(o(),l("div",ge,Ce)):p("",!0),s(M)>0&&s(n).bestsellerGroups.length>0?(o(),l("div",ke,[Pe,t("ul",Te,[(o(!0),l(O,null,$(s(n).bestsellerGroupsShownOnCart,c=>(o(),l("li",{key:c.id},[t("a",{href:"#",onClick:L(B=>h(c.id),["prevent"]),class:"tw-block tw-bg-nl-white-100 tw-text-[16px] tw-leading-[1.2] tw-font-medium tw-rounded-[6px] tw-shadow-nl-9 tw-uppercase tw-px-4 tw-py-[7px]"},x(c.cart_cta?c.cart_cta:c.name),9,Ee)]))),128))])])):p("",!0)],2)]),t("div",Ae,[s(r).name!=="checkout"&&s(i).cartProducts.length>0?(o(),l("div",Ie,[t("beam-select-nonprofit",{apiKey:s(w).public.beamApiKey,chainId:s(w).public.beamChainId,storeId:parseInt(s(w).public.beamStoreId),baseUrl:s(w).public.beamApiUrl,debug:"",onClick:dt,class:"tw-px-2"},null,8,Se),Ue])):p("",!0)]),t("div",Ne,[t("div",Re,[t("div",De,[s(r).name!=="checkout"&&s(i).cartProducts.length>0?(o(),l("div",Oe,[t("beam-select-nonprofit",{ref_key:"beamSelectNonrofitRef",ref:A,apiKey:s(w).public.beamApiKey,chainId:s(w).public.beamChainId,storeId:parseInt(s(w).public.beamStoreId),baseUrl:s(w).public.beamApiUrl,debug:"",class:"tw-px-2"},null,8,$e)])):p("",!0)]),t("div",Me,[t("button",{onClick:L(lt,["prevent"]),disabled:!s(n).isCheckoutStepAvailable,class:S([{"tw-bg-nl-violet-100":s(n).isCheckoutStepAvailable},"tw-w-full k tw-rounded tw-bg-[#aa8dce] tw-text-white tw-p-3 tw-max-w-[257px] tw-mx-auto tw-transition-all hover:tw-bg-nl-violet-100 tw-uppercase"])}," Checkout ",10,Fe)])])])])):(o(),l("div",Be,[Le,ze,nt(D,{class:"tw-mb-[29px]"}),je]))],2)],2)):p("",!0)]}),_:1})}}}),Ge=Ut(qe,[["__scopeId","data-v-6968ed4c"]]);export{Yt as M,Ge as _};
//# sourceMappingURL=CBaN07Ap.js.map