PageSourceSearch

https://app.wodbump.com/assets/NutritionTemplatePlanEditorPage-u0QpeGrx.js

js wodbump.com collected 2026-10-02 01:49:29 UTC 21,030 bytes, 1 lines download raw bytes

1import{r as d,j as n,b3 as pt,ad as yt,aD as ht,ay as Qe,az as xt,ak as gt,u as bt,a as vt,N as Me,B as kt,b2 as wt}from"./vendor-CAFxqyA_.js";import{c as re,b as Ke,o as Nt,p as St,u as It,k as jt,C as Ee,l as Re,m as Ct,q as Dt}from"./index-BK8JT8yM.js";import{N as Wt,a as Tt,c as Ae,d as Le,n as Ot,p as Fe,b as Pt}from"./NutritionEditorWeekGrid-DpdbPYhJ.js";import{r as Mt,N as $e,a as Kt}from"./NutritionVirtualAthletePreviewDrawer-DhKa9koc.js";import{l as Et,T as B,f as Rt,a as T,p as At,b as Lt}from"./programTemplateEditorUtils-BwtsOiAp.js";import{E as Be,A as Ft,k as _e,d as $t,s as ke,e as we,n as ye,I as ze,J as Ue,K as Bt,h as _t,i as zt,j as Ut,L as Yt,q as Ye,m as qt,r as qe,M as Vt,O as Gt,P as Ht,H as Jt,N as Qt}from"./nutritionPlans-BQQUjb0J.js";import{n as Xt}from"./nutritionDisplay-YzS_TzRt.js";import{P as Zt}from"./ProgramEditorMobileToolbars-F7kFV12V.js";import{O as Ve}from"./oneOnOneDrawerUi-Dqa5VZ7P.js";import{u as en}from"./editorClipboardStore-CXtSK83h.js";import{r as tn,n as nn,a as sn}from"./nutritionNavigation-DpWEVDrK.js";import"./firebase-D4orPhEo.js";import"./stripe-Cewq76PC.js";import"./statusBadges-B85EcjIx.js";import"./MarketingSmsStatBubble-Bw-ww8Ie.js";import"./nutritionMeals-ViHD3ENq.js";import"./nutritionEnrollmentAccess-B0EmSm2B.js";import"./SideDrawer-BM2asQnC.js";import"./BlockDragDropZone-DZH4cK6X.js";function rn(t){return Array.from({length:B},(f,m)=>({key:T(t,m),label:`Day ${Rt(t,m)}`}))}function Ie(t,f){return`${t}:${f}`}function Xe(t,f){const m=t.indexOf(":");if(m<0)return null;const b=t.slice(0,m),v=t.slice(m+1),x=f(b);return x?Ie(x,v):null}function an(t){const f=`clone-${Date.now()}-${Math.floor(Math.random()*1e4)}`;return t.kind==="ingredient"?{...t,id:f,foodId:t.foodId??t.id,source:"assigned",athleteStatus:"not-logged",assignedSnapshot:void 0}:{...t,id:f,mealId:t.mealId??t.id,source:"assigned",athleteStatus:"not-logged",assignedSnapshot:void 0,ingredients:t.ingredients.map((m,b)=>({...m,id:`${f}-ing-${b}`,foodId:m.foodId??m.id}))}}function on(t){const f={...t.sectionItemOverrides};for(let m=0;m<B;m+=1){const b=T(t.sourceWeekNum,m),v=T(t.targetWeekNum,m);for(const x of["breakfast","lunch","dinner","snack"]){const p=Ie(b,x),C=Ie(v,x),D=t.sectionItemOverrides[p];if(!D){delete f[C];continue}f[C]=D.map(O=>an(O))}}return f}function ln(t){const f=[...t.remainingWeeks].sort((v,x)=>v-x),m=new Map;f.forEach((v,x)=>{m.set(v,x+1)});const b={};for(const[v,x]of Object.entries(t.sectionItemOverrides)){const p=Xe(v,C=>{const D=C.match(/^week-(\d+)-day-(\d+)$/);if(!D)return null;const O=Number(D[1]),_=Number(D[2]);if(O===t.weekNumToDelete)return null;const z=m.get(O);return z==null?null:T(z,_)});p&&(b[p]=x)}return b}function Ge(t){const f={};for(const[m,b]of Object.entries(t.sectionItemOverrides)){const v=Xe(m,x=>{const p=x.match(/^week-(\d+)-day-(\d+)$/);if(!p)return x;const C=Number(p[1]),D=Number(p[2]);return C===t.firstWeekNum?T(t.secondWeekNum,D):C===t.secondWeekNum?T(t.firstWeekNum,D):x});v&&(f[v]=b)}return f}function Ne(t){return Et(t)}const cn="min-w-[66.5rem]";function He({weeks:t,planId:f,targets:m,sectionItemOverrides:b,onSectionItemOverridesChange:v,selectedItemKeys:x,onSelectedItemKeysChange:p,canPaste:C=!1,onPasteItems:D,dayMacroTargets:O,onMacroTargetsSave:_,singleDayKey:z,scrollableDayColumns:ae=!1,onAddWeek:U,onCloneWeek:he,onDeleteWeek:ce,onMoveWeekUp:X,onMoveWeekDown:Z}){const R=d.useRef(new Map),[k,A]=d.useState(null),te=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,K=k!=null,h=z?At(z):null,g=h!=null,oe=g&&h?t.filter(a=>a===h.weekNum):t,L=d.useCallback((a,w)=>{w==="up"?X(a):Z(a)},[Z,X]),ee=d.useCallback((a,w)=>{if(K)return;const N=t.indexOf(a),F=w==="up"?N-1:N+1;if(N<0||F<0||F>=t.length)return;const $=t[F];if(te){L(a,w);return}const E=R.current.get(a),P=R.current.get($);if(!E||!P){L(a,w);return}const S=E.getBoundingClientRect(),j=P.getBoundingClientRect(),M=w==="up"?j.top-S.top:j.bottom-S.bottom,ne=-M;A({movingWeekNum:a,partnerWeekNum:$,movingOffsetY:M,partnerOffsetY:ne,direction:w,phase:"prep"}),requestAnimationFrame(()=>{A(se=>se?{...se,phase:"go"}:null)})},[L,K,te,t]),W=d.useCallback((a,w)=>{if(w.propertyName!=="transform"||!k||a!==k.movingWeekNum)return;const{movingWeekNum:N,direction:F}=k;A(null),L(N,F)},[L,k]);return n.jsxs("div",{className:re("flex flex-col",g?"h-full min-h-0 flex-1":"gap-8 overflow-visible pb-4"),children:[oe.map((a,w)=>{const N=g&&h&&h.weekNum===a?[{key:z,label:`Day ${h.dayIndex+1+(a-1)*B}`}]:rn(a),F=g&&h&&h.weekNum===a?0:void 0,$=k?.movingWeekNum===a,E=k?.partnerWeekNum===a,P=$||E,S=P&&k?.phase==="go",j=$?S?k.movingOffsetY:0:E&&S?k.partnerOffsetY:0;return n.jsxs("section",{ref:M=>{M?R.current.set(a,M):R.current.delete(a)},onTransitionEnd:M=>W(a,M),style:P?{transform:`translateY(${j}px)`}:void 0,className:re(Nt,"flex min-h-0 flex-col",g&&"h-full flex-1 overflow-hidden",!g&&"overflow-visible",P&&"relative z-10 transition-transform duration-300 ease-in-out",$&&"border-gray-900 ring-2 ring-gray-900/20",E&&"opacity-90",ae&&!g&&cn),children:[g?null:n.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 bg-white px-4 py-3 sm:px-5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"flex flex-col items-center gap-0",children:[n.jsx("button",{type:"button",onClick:()=>ee(a,"up"),disabled:w===0||K,className:"rounded p-0.5 text-gray-500 transition hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-40","aria-label":`Move week ${a} up`,children:n.jsx(pt,{className:"h-4 w-4"})}),n.jsx("button",{type:"button",onClick:()=>ee(a,"down"),disabled:w===t.length-1||K,className:"rounded p-0.5 text-gray-500 transition hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-40","aria-label":`Move week ${a} down`,children:n.jsx(yt,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-sm font-semibold text-gray-900",children:["Week ",a]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{type:"button",onClick:()=>he(a),className:re(Ke,"px-2.5 py-1.5 text-xs"),children:[n.jsx(ht,{className:"h-3.5 w-3.5"}),"Clone"]}),n.jsxs("button",{type:"button",onClick:()=>ce(a),disabled:t.length<=1,className:re(Ke,"px-2.5 py-1.5 text-xs"),children:[n.jsx(Qe,{className:"h-3.5 w-3.5"}),"Delete"]})]})]}),n.jsx(Wt,{dayColumns:N,clientId:f,targets:m,mode:"plan",lockPolicy:"none",embedded:!0,singleDayIndex:F,scrollableColumnsOnNarrowScreens:ae&&!g,sectionItemOverrides:b,onSectionItemOverridesChange:v,selectedItemKeys:x,onSelectedItemKeysChange:p,canPaste:C,onPasteItems:D,dayMacroTargets:O,onMacroTargetsSave:_})]},a)}),g?null:n.jsx("div",{className:"pb-2 pt-1",children:n.jsxs("button",{type:"button",onClick:U,className:re(St,"mx-auto"),children:[n.jsx(xt,{className:"h-4 w-4"}),"Add Week"]})})]})}function dn(t,f){return Jt().map(m=>({...m,items:f[`${t}:${m.mealType}`]??[]}))}function Je(t){return t==="snack"?"Snacks":Qt[t]}function un(){return typeof window<"u"&&window.matchMedia("(max-width: 639px)").matches}function Se(t,f){return t&&f?.plan?.id===t?f.plan:null}function mn(t){const f=t.match(/^week-(\d+)-day-(\d+)$/);if(!f)return null;const m=Number(f[1])-1;return m>=0?m:null}function Pn(){const{planId:t}=gt(),f=bt(),m=vt(),{companyData:b}
1=It(),v=jt(b,"light"),x=f.state,[p,C]=d.useState(()=>Se(t,x)),[D,O]=d.useState(()=>Se(t,x)?"ready":t?"loading":"missing"),[_,z]=d.useState(Be),[ae,U]=d.useState("All changes saved"),[he,ce]=d.useState(!1),[X,Z]=d.useState(null),[R,k]=d.useState(!1),A=d.useRef(!1),te=d.useRef(_);te.current=_;const K=d.useRef({}),h=d.useRef(new Set),g=d.useRef(new Set),oe=d.useRef(!0),L=d.useRef(!1),ee=d.useRef(!1),W=d.useRef([]);d.useEffect(()=>{const e=Se(t,x);if(e&&(C(e),O("ready")),!t){O("missing");return}let s=!1;return e||O("loading"),(async()=>{const r=await Ft(t).catch(()=>null);if(s)return;if(!r){C(null),O("missing");return}if(b?.id&&r.companyId&&r.companyId!==b.id){C(null),O("missing");return}C({id:r.id,name:r.name,clientCount:r.clientCount??0,priceLabel:r.isFree?"Free":r.priceAmount!=null?String(r.priceAmount):"—",status:r.status,statusLabel:Xt(r.status),imageUrl:r.coverUrl||void 0,paymentType:r.paymentType,scaling:r.scaling});const y=_e(r.macroTargets??void 0)??Be;z(y),A.current=!1,O("ready")})(),()=>{s=!0}},[x,t,b?.id]);const[a,w]=d.useState([1]),[N,F]=d.useState({}),$=d.useRef(N);$.current=N;const[E,P]=d.useState({}),S=d.useRef(E);S.current=E;const[j,M]=d.useState(()=>new Set),{items:ne,canPaste:se,setItems:je}=en(),[V,de]=d.useState(null),[xe,ge]=d.useState("into-section"),[Ze,be]=d.useState(!1),Y=d.useMemo(()=>Ne(a),[a]),ve=!!Mt(p?.scaling??null),Ce=d.useMemo(()=>Y.map(e=>({key:e,label:Lt(e)})),[Y]),De=d.useCallback(e=>{const s=new Set([...$t(e),...h.current]);for(const r of s){const y=ke(we(e,r))[r],i=ye(y),u=K.current[r]??"";i!==u&&h.current.add(r)}},[]),q=d.useCallback(e=>{F(s=>{const r=typeof e=="function"?e(s):e;return De(r),r})},[De]),et=d.useCallback((e,s,r,y)=>{let i=y;if(s!=="this-day"){const u=Ne(a),l=u.indexOf(r);if(l>=0)if(s==="weekdays"){const c=l%B;i=u.filter((o,I)=>I>=l&&I%B===c)}else i=u.slice(l)}P(u=>{const l={...u};for(const c of i)l[c]=e,h.current.add(c),g.current.delete(c);return S.current=l,l}),s==="forward"&&(z(e),A.current=!0)},[a]),[ue,me]=d.useState(null),G=ue??Y[0]??"",tt=d.useMemo(()=>{if(!G)return a;const e=G.match(/^week-(\d+)-/),s=e?Number(e[1]):a[0];return a.includes(s)?[s]:a.slice(0,1)},[G,a]);d.useEffect(()=>{if(!t)return;let e=!1;return oe.current=!0,ce(!1),(async()=>{try{let s=await ze(t);if(s.length===0&&(await Ue(t,"w1",0,"Week 1"),s=await ze(t)),e)return;W.current=s;const r=s.map((l,c)=>c+1);w(r.length?r:[1]);const y={};if(await Promise.all(s.map(async(l,c)=>{const o=c+1,I=await Bt(t,l.id,o);Object.assign(y,I)})),e||(await _t(zt(y)),e))return;const i=Ut(y);F(l=>{if(h.current.size===0)return i;const c={...i};for(const[o,I]of Object.entries(l)){const H=o.slice(0,o.indexOf(":"));h.current.has(H)&&(c[o]=I)}return c});const u={};for(const[l,c]of Object.entries(y)){if(h.current.has(l))continue;const o=_e(c.macroTargets);o&&(u[l]=o),K.current[l]=ye(c)}for(let l=0;l<s.length;l+=1)for(let c=0;c<B;c+=1){const o=T(l+1,c);K.current[o]==null&&(K.current[o]="")}P(l=>{if(h.current.size===0)return S.current=u,u;const c={...u};for(const o of h.current)l[o]&&(c[o]=l[o]);return S.current=c,c})}catch(s){console.warn("[nutrition] template plan load failed",s)}finally{e||(oe.current=!1,ce(!0))}})(),()=>{e=!0}},[t]);const We=d.useCallback(e=>{const s=mn(e);return s==null?null:W.current[s]?.id??null},[]),fe=d.useCallback(async()=>{if(!(!t||oe.current)){if(L.current){ee.current=!0;return}L.current=!0;try{do{ee.current=!1;const e=[...h.current],s=A.current;if(e.length===0&&!s){U("All changes saved");break}U("Saving…");try{if(s){const r=te.current;await Yt(t,Ye(r)),te.current===r&&(A.current=!1)}if(e.length>0){const r={},y=[],i={},u={},l={},c=$.current;for(const o of W.current)u[o.id]=o.order;for(const o of e){const I=We(o);if(!I)continue;i[o]=I;const H=ke(we(c,o))[o]??{mealSlots:{}},J=g.current.has(o),Q=J?void 0:S.current[o],le={...qt({mealSlots:H.mealSlots??{}}),...Q?{macroTargets:Ye(Q)}:J?{clearMacroTargets:!0}:{}};l[o]=ye(le),qe(le)&&!J?(K.current[o]??"")!==""&&y.push(o):(!qe(le)||J)&&(r[o]=le)}await Vt(t,i,r,y,u);for(const o of e){if(!i[o])continue;const I=l[o]??"";K.current[o]=y.includes(o)?"":I;const H=ye(ke(we($.current,o))[o]??null),J=g.current.has(o),Q=!!S.current[o];H===I&&(!J||!Q)&&(h.current.delete(o),Q||g.current.delete(o))}}h.current.size===0&&!A.current&&!ee.current&&U("All changes saved")}catch(r){console.warn("[nutrition] template day save failed",r),U("Save failed — retrying on next edit");break}}while(ee.current)}finally{L.current=!1}}},[t,We]);if(d.useEffect(()=>{if(!t)return;const e=window.setTimeout(()=>{fe()},800);return()=>window.clearTimeout(e)},[t,N,E,_,fe]),d.useEffect(()=>{const e=s=>{(h.current.size>0||A.current||L.current)&&(s.preventDefault(),s.returnValue="")};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e),fe()}},[fe]),d.useEffect(()=>{if(!un()){me(null);return}me(e=>e??Y[0]??null)},[Y]),d.useEffect(()=>{ue&&(Y.includes(ue)||me(Y[0]??null))},[ue,Y]),!t||D==="missing")return n.jsx(Me,{to:"/nutrition?tab=plans",replace:!0});if(D==="loading"||!p)return n.jsx("div",{className:"flex h-screen items-center justify-center bg-white text-sm text-gray-500",children:"Loading plan…"});if(tn(p)!=="oneTime")return n.jsx(Me,{to:nn(p.id,"subscription"),replace:!0,state:{plan:p}});const nt=()=>{m("/nutrition?tab=plans")},Te=j.size>0,st=()=>{if(j.size===0)return;const e=Ae({clientId:p.id,selectedItemKeys:j,sectionItemOverrides:N,mode:"plan"});e.length!==0&&(je(e),M(new Set))},rt=()=>{if(j.size===0||!Te)return;const e=Ae({clientId:p.id,selectedItemKeys:j,sectionItemOverrides:N,mode:"plan"});if(e.length===0)return;je(e);const s=Le({clientId:p.id,selectedItemKeys:j,sectionItemOverrides:N,mode:"plan"});q(s.sectionItemOverrides),M(s.selectedItemKeys)},at=()=>{if(j.size===0)return;const e=Le({clientId:p.id,selectedItemKeys:j,sectionItemOverrides:N,mode:"plan"});q(e.sectionItemOverrides),M(e.selectedItemKeys)},ot=(e,s)=>{if(se){if(Ot(ne)){q(r=>Fe({clientId:p.id,dateKey:e,mealType:s,clipboardItems:ne,sectionItemOverrides:r,mode:"plan"}));return}ge("into-section"),de({dateKey:e,mealType:s})}},it=()=>{!V||!se||(q(e=>xe==="keep-meals"?Pt({clientId:p.id,dateKey:V.dateKey,clipboardItems:ne,sectionItemOverrides:e,mode:"plan"}):Fe({clientId:p.id,dateKey:V.dateKey,mealType:V.mealType,clipboardItems:ne,sectionItemOverrides:e,mode:"plan"})),de(null))},Oe=async e=>{if(t)for(;W.current.length<=e;){const s=W.current.length,r=`w${s+1}`;W.current=[...W.current,{id:r,order:s}],await Ue(t,r,s,`Week ${s+1}`)}},lt=()=>{(async()=>{k(!0);try{await Oe(a.length),w(e=>{const s=Math.max(...e,0)+1;return[...e,s]})}catch(e){console.warn("[nutrition] template week add failed",e),U("Save failed — retrying on next edit")}finally{k(!1)}})()},ct=e=>{(async()=>{k(!0);try{const s=Math.max(...a,0)+1;await Oe(a.length),q(r=>on({sectionItemOverrides:r,sourceWeekNum:e,targetWeekNum:s})),P(r=>{const y={...r};for(let i=0;i<B;i+=1){const u=T(e,i),l=T(s,i);r[u]&&(y[l]=r[u],h.current.add(l),g.current.delete(l))}return S.current=y,y}),w(r=>[...r,s])}catch(s){console.warn("[nutrition] template week clone failed",s),U("Save failed — retrying on next edit")}finally{k(!1)}})()},dt=e=>{a.length<=1||R||Z(e)},ut=()=>{const e=X;e==null||a.length<=1||(async()=>{k(!0);try{const s=a.indexOf(e),r=a.filter(i=>i!==e),y=s>=0?W.current[s]:void 0;s>=0&&(W.current=W.current.filter((i,u)=>u!==s).map((i,u)=>({...i,order:u}))),t&&y&&await Gt(t,y.id),t&&W.current.length>0&&await Ht(t,W.current),q(i=>ln({sectionItemOverrides:i,weekNumToDelete:e,remainingWeeks:r})),P(i=>{const u={},l=new Map;[...r].sort((c,o)=>
1c-o).forEach((c,o)=>{l.set(c,o+1)});for(const[c,o]of Object.entries(i)){const I=c.match(/^week-(\d+)-day-(\d+)$/);if(!I)continue;const H=Number(I[1]),J=Number(I[2]);if(H===e)continue;const Q=l.get(H);Q!=null&&(u[T(Q,J)]=o)}return S.current=u,u}),K.current={},g.current.clear();for(const i of Ne(r.map((u,l)=>l+1)))h.current.add(i);w(r.map((i,u)=>u+1)),M(new Set),Z(null)}catch(s){console.warn("[nutrition] template week delete failed",s),U("Save failed — retrying on next edit")}finally{k(!1)}})()},mt=e=>{const s=a.indexOf(e);if(s<=0)return;const r=a[s-1];q(y=>Ge({sectionItemOverrides:y,firstWeekNum:e,secondWeekNum:r})),P(y=>{const i={...y};for(let u=0;u<B;u+=1){const l=T(e,u),c=T(r,u),o=i[l];i[c]?i[l]=i[c]:delete i[l],o?i[c]=o:delete i[c],h.current.add(l),h.current.add(c),g.current.delete(l),g.current.delete(c)}return S.current=i,i})},ft=e=>{const s=a.indexOf(e);if(s<0||s>=a.length-1)return;const r=a[s+1];q(y=>Ge({sectionItemOverrides:y,firstWeekNum:e,secondWeekNum:r})),P(y=>{const i={...y};for(let u=0;u<B;u+=1){const l=T(e,u),c=T(r,u),o=i[l];i[c]?i[l]=i[c]:delete i[l],o?i[c]=o:delete i[c],h.current.add(l),h.current.add(c),g.current.delete(l),g.current.delete(c)}return S.current=i,i})},ie=a.length,pe=ie*B,Pe={weeks:a,planId:p.id,targets:_,dayMacroTargets:E,onMacroTargetsSave:et,sectionItemOverrides:N,onSectionItemOverridesChange:q,selectedItemKeys:j,onSelectedItemKeysChange:M,canPaste:se,onPasteItems:ot,onAddWeek:lt,onCloneWeek:ct,onDeleteWeek:dt,onMoveWeekUp:mt,onMoveWeekDown:ft};return n.jsxs("div",{className:"flex h-screen flex-col overflow-hidden bg-white",children:[n.jsx("header",{className:"shrink-0 border-b border-gray-200 bg-white",children:n.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3 sm:px-6",children:[n.jsx("div",{className:"shrink-0",children:v?n.jsx("img",{src:v,alt:"",className:"h-7 w-auto"}):null}),n.jsxs("div",{className:"min-w-0 text-right",children:[n.jsx("p",{className:"truncate text-sm font-semibold text-gray-900",children:p.name}),n.jsx("p",{className:re("text-xs",ae.startsWith("Save failed")?"text-red-600":"text-gray-500"),children:ae}),p.status==="DRAFT"?n.jsx("button",{type:"button",onClick:()=>m(sn(p.id,"pricing"),{state:{plan:p}}),className:"mt-1 text-xs font-medium text-gray-900 underline-offset-2 hover:underline",children:"Publish / Pricing"}):null]})]})}),n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[G?n.jsx(Zt,{dayKey:G,dayKeys:Y,onDayChange:me}):null,n.jsx("div",{className:"shrink-0 border-b border-gray-200 bg-white px-4 py-3 sm:hidden",children:n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("p",{className:"text-sm font-semibold text-gray-900",children:[ie," ",ie===1?"week":"weeks"]}),n.jsxs("p",{className:"text-xs text-gray-500",children:[pe," ",pe===1?"day":"days"]})]}),ve?n.jsx($e,{onClick:()=>be(!0),className:"px-2.5 py-1.5 text-xs"}):null]})}),n.jsx("div",{className:"hidden shrink-0 border-b border-gray-200 bg-white px-4 py-4 sm:block sm:px-6",children:n.jsxs("div",{className:"flex items-center justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("p",{className:"text-sm font-semibold text-gray-900",children:[ie," ",ie===1?"week":"weeks"]}),n.jsxs("p",{className:"text-xs text-gray-500",children:[pe," ",pe===1?"day":"days"]})]}),ve?n.jsx($e,{onClick:()=>be(!0)}):null]})}),n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[n.jsx("main",{className:"min-h-0 flex-1 overflow-hidden pb-3 pt-2 sm:overflow-x-auto sm:overflow-y-auto",children:he?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex h-full min-h-0 flex-1 flex-col px-4 sm:hidden",children:G?n.jsx(He,{...Pe,weeks:tt,singleDayKey:G}):null}),n.jsx("div",{className:"hidden flex-col gap-8 px-4 sm:flex sm:px-6",children:n.jsx(He,{...Pe,scrollableDayColumns:!0})})]}):n.jsx("div",{className:"flex h-full items-center justify-center px-4 text-sm text-gray-500",children:"Loading plan days…"})}),n.jsx(Tt,{selectedCount:j.size,canDelete:Te,onCopy:st,onCut:rt,onDelete:at,onClose:nt})]})]}),ve?n.jsx(Kt,{open:Ze,onClose:()=>
1be(!1),planScaling:p.scaling,days:Ce,initialDayKey:G||Ce[0]?.key,getTargets:e=>E[e]??_,getSections:e=>dn(e,N)}):null,n.jsx(Ee,{open:V!=null,onClose:()=>de(null),titleId:"nutrition-template-plan-editor-paste-mode-title",title:"Paste Items?",description:"Choose how copied items should be placed on this day.",overlayClassName:"z-[90]",icon:n.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-gray-100 text-gray-700",children:n.jsx(wt,{className:"h-5 w-5","aria-hidden":!0})}),actions:n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:()=>de(null),className:Re,children:"Cancel"}),n.jsx("button",{type:"button",onClick:it,className:Ct,children:n.jsxs("span",{className:"inline-flex items-center justify-center gap-1.5",children:[n.jsx(kt,{className:"h-4 w-4","aria-hidden":!0}),"Paste"]})})]}),children:V?n.jsxs("div",{className:"space-y-2",children:[n.jsx(Ve,{selected:xe==="into-section",title:`Paste All Into ${Je(V.mealType)}`,subtitle:`Place every copied item in ${Je(V.mealType).toLowerCase()}`,className:"w-full",onClick:()=>ge("into-section")}),n.jsx(Ve,{selected:xe==="keep-meals",title:"Keep In Meals",subtitle:"Preserve each item’s original breakfast, lunch, dinner, or snack section",className:"w-full",onClick:()=>ge("keep-meals")})]}):null}),n.jsx(Ee,{open:X!=null,onClose:()=>{R||Z(null)},closeDisabled:R,titleId:"nutrition-template-delete-week-title",title:X!=null?`Delete Week ${X}?`:"Delete Week?",description:"This removes that week’s meals and macros from the plan. This cannot be undone.",overlayClassName:"z-[90]",icon:n.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-red-50 text-red-600",children:n.jsx(Qe,{className:"h-5 w-5","aria-hidden":!0})}),actions:n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:()=>Z(null),disabled:R,className:Re,children:"Cancel"}),n.jsx("button",{type:"button",onClick:ut,disabled:R,className:Dt,children:R?"Deleting…":"Delete Week"})]})})]})}export{Pn as default};

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.