PageSourceSearch

https://edgemxtiming.com/assets/CombinedScheduleTab-CSBIifyD.js

js edgemxtiming.com collected 2026-09-24 14:43:10 UTC 10,837 bytes, 1 lines download raw bytes

1import{l as G,s as J,r as b,k as V,$ as X,j as e,O as Y,M as ee}from"./index-BCH4IFx8.js";import{B as te}from"./BpSpinner-Bqvfph1h.js";import{u as ne}from"./useTimingCombinedSchedule-B4_boewu.js";import{useScheduleEvent as se}from"./TimingSchedulePage-BkMRqVin.js";import{u as re}from"./useSelectedTimingEvent-3RcC6Kj0.js";import{u as U}from"./MyRidersFilterContext-DhyaPTl1.js";import{r as ie}from"./resolveClassNames-B8m22UiV.js";import{W as ae}from"./wrench-BCM-PgAk.js";import{F as z}from"./flag-CvB2R2ls.js";import{R as oe}from"./radio-DbgeS3_C.js";import"./useOrganizationSlug-DcRVJD25.js";import"./useTimingEvents-C-M7e7gJ.js";import"./TimingSelectionContext-Daw75Td3.js";import"./TimingTabMemoryContext-C18NPQmb.js";import"./calendar-clock-BiSYhr8S.js";import"./EventTitleBanner-6JmDo_zq.js";import"./sheet-CPIBZrRk.js";import"./TimingEventPicker-m5IR3W2w.js";import"./skeleton-Dt7yWY4K.js";import"./calendar-BcfRHKCP.js";import"./map-pin-Eqsqtagn.js";import"./users-Cp35uMGZ.js";import"./InnerLoader-VnbOTMud.js";import"./useRiderFamily-14KWoc-T.js";import"./useUserEmails-64UGJRED.js";import"./nicknameVariants-CT_QG-k6.js";function ce(){const{orgSlug:c,event:r}=re(),{active:w,available:j,myRiderNames:E,myFamilyMemberIds:F}=U(),{data:N}=G({queryKey:["timing-event-classes",c,(r==null?void 0:r.id)??(r==null?void 0:r.event_name),"ALL"],queryFn:async()=>{if(!c||!(r!=null&&r.id))return{rows:[]};const{data:x,error:y}=await J.functions.invoke("fetch-public-event-classes",{body:{org_slug:c,event_name:r.event_name,lab_event_id:r.id,event_date:r.event_date,class_name:"ALL"}});if(y)throw y;return x??{rows:[]}},enabled:j&&!!c&&!!(r!=null&&r.id),staleTime:3e4}),M=b.useMemo(()=>{const x=new Map;if(!j)return x;const y=l=>l.trim().toLowerCase().replace(/\s+/g," ");for(const l of(N==null?void 0:N.rows)??[]){const $=l.family_member_id,B=y(`${l.first_name??""} ${l.last_name??""}`);if(($&&F.has($)||B&&E.has(B))&&l.class_name){const _=`${l.first_name??""} ${l.last_name??""}`.trim(),T=x.get(l.class_name)??[];T.includes(_)||T.push(_),x.set(l.class_name,T)}}return x},[N,j,E,F]),o=b.useMemo(()=>w?new Set(M.keys()):new Set,[w,M]);return{active:w,classes:o,namesByClass:M,hasRiders:j}}function Q(c){return new Date(c).toLocaleTimeString("en-US",{timeZone:"America/Denver",hour:"numeric",minute:"2-digit",hour12:!0})}function Be(){const c=V(),w=X()==="running",{orgSlug:j,eventName:E,displayName:F,labEventId:N,eventDate:M}=se(),{data:o,isLoading:x,error:y}=ne(j,E,N,M),{namesByClass:l,hasRiders:$}=ce(),{active:B}=U(),q=$&&B,_=(o==null?void 0:o.rows)??[],T=(o==null?void 0:o.class_names_by_id)??{},D=_.reduce((t,m)=>m.kind==="practice"?Math.max(t,m.round??1):t,1),h=w?_.filter(t=>t.kind!=="practice"):_,Z=t=>{const m=[];for(const d of t)for(const u of l.get(d)??[])m.includes(u)||m.push(u);return m},I=t=>t.state==="running",O=t=>o?o.next_kind==="race"&&t.kind==="race"?t.race_number===o.next_race_number:o.next_kind==="practice"&&t.kind==="practice"?t.practice_number===o.next_practice_number:!1:!1,A=b.useRef(null),P=b.useRef(!1),K=()=>{const t=A.current;if(!t)return;const d=(n=>{let i=(n==null?void 0:n.parentElement)??null;for(;i;){const C=getComputedStyle(i).overflowY;if((C==="auto"||C==="scroll")&&i.scrollHeight>i.clientHeight)return i;i=i.parentElement}return window})(t),u=t.getBoundingClientRect();let a,s,p;if(d===window)p=window.innerHeight,a=window.scrollY,s=a+u.top-p/2+u.height/2;else{const n=d,i=n.getBoundingClientRect();p=n.clientHeight,a=n.scrollTop,s=a+(u.top-i.top)-p/2+u.height/2}const v=s-a;if(Math.abs(v)<4)return;const R=Math.min(2800,Math.max(1200,Math.abs(v)*1.6)),S=performance.now(),k=n=>n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2,g=n=>{const i=Math.min(1,(n-S)/R),f=a+v*k(i);d===window?window.scrollTo(0,f):d.scrollTop=f,i<1&&requestAnimationFrame(g)};requestAnimationFrame(g)};b.useEffect(()=>{const t=()=>K();return window.addEventListener("timing:scroll-to-active",t),()=>window.removeEventListener("timing:scroll-to-active",t)},[]);const H=h.some(t=>I(t)),W=h.some(t=>O(t));return b.useEffect(()=>{P.current||!h.length||!H&&!W||requestAnimationFrame(()=>{A.current&&(P.current=!0,K())})},[h,H,W]),e.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-card shadow-sm",children:[e.jsxs("div",{className:"bg-primary px-3 py-1.5 text-center text-primary-foreground",children:[e.jsx("div",{className:"text-sm font-bold tracking-wide leading-tight",children:"Schedule"}),e.jsx("div",{className:"text-[10px] opacity-90 leading-tight",children:F})]}),q&&e.jsxs("div",{className:"flex items-center justify-center gap-2 border-b border-border bg-warning/15 px-3 py-1.5 text-xs font-semibold text-warning-foreground",children:[e.jsx("span",{className:"inline-block h-3 w-3 rounded-sm border border-warning bg-warning"}),e.jsxs("span",{children:["Highlighted rows include your ",c.racer.toLowerCase(),"(s)"]})]}),h.length>0&&e.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-muted/50 px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-muted-foreground",children:[e.jsx("div",{className:"min-w-[44px] text-center",children:c.bib}),e.jsx("div",{className:"flex-1",children:c.class}),e.jsx("div",{className:"w-10 text-right",children:c.racers}),e.jsx("div",{className:"w-14 text-right",children:"Time"})]}),x&&e.jsx("div",{className:"flex h-28 items-center justify-center",children:e.jsx(te,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),y&&e.jsx("div",{className:"px-3 py-6 text-center text-sm text-destructive",children:"Failed to load schedule."}),!x&&!y&&h.length===0&&e.jsx("div",{className:"px-3 py-8 text-center text-sm text-muted-foreground",children:"Schedule not posted yet."}),e.jsx("div",{className:"divide-y divide-border",children:h.map((t,m)=>{const d=ie(t,T),u=m%2===0?"bg-background":"bg-muted/30",a=m>
10?h[m-1]:null,s=I(t),p=O(t),v=q?Z(d):[],R=v.length>0,S=v.slice(0,2),k=v.length-S.length;let g=null;t.kind==="practice"?a?a.kind==="race"?g=e.jsx("div",{className:"h-1 bg-muted","aria-hidden":!0}):D>1&&(a.round??1)!==(t.round??1)&&(g=e.jsxs("div",{className:"bg-secondary/40 px-3 py-1 text-center text-[10px] font-bold uppercase tracking-wider text-secondary-foreground",children:["Practice Round ",t.round??1," of ",D]})):g=e.jsx("div",{className:"bg-primary/90 px-3 py-1 text-center text-[10px] font-bold uppercase tracking-wider text-primary-foreground",children:"Practice"}):!w&&((a==null?void 0:a.kind)!=="race"||a.moto_number!==t.moto_number)&&(g=e.jsx("div",{className:"bg-primary/90 px-3 py-1 text-center text-[10px] font-bold uppercase tracking-wider text-primary-foreground",children:`${c.race} ${t.moto_number}`}));const n=s?e.jsxs("span",{className:"ml-1 inline-flex items-center gap-0.5 rounded bg-destructive px-1 py-0 text-[8px] font-bold uppercase text-destructive-foreground animate-pulse [animation-duration:1.8s]",children:[e.jsx(oe,{className:"h-2 w-2"}),"Live"]}):null,i=p&&!s?e.jsxs("span",{className:"ml-1 inline-flex items-center gap-0.5 rounded bg-success px-1 py-0 text-[8px] font-bold uppercase text-success-foreground",children:[e.jsx(z,{className:"h-2 w-2"}),"Next"]}):null,f=t.state==="finalized"||t.state==="stopped",C=f&&!s?e.jsxs("span",{className:"ml-1 inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0 text-[8px] font-bold uppercase text-muted-foreground",children:[e.jsx(ee,{className:"h-2 w-2"}),"Done"]}):null;return t.kind==="practice"?e.jsxs(b.Fragment,{children:[g,e.jsxs("div",{ref:s||p&&!H?A:void 0,className:Y("flex items-center gap-2 px-3 py-1.5 border-l-4 border-l-secondary scroll-mt-32",u,f&&!s&&"border-l-muted opacity-60",R&&!s&&!f&&"border-l-warning bg-warning/15",s&&"bg-primary/10 animate-pulse [animation-duration:2s]",p&&!s&&"border-l-success bg-success/10 animate-pulse [animation-duration:2.5s]"),children:[e.jsxs("div",{className:"flex min-w-[44px] flex-col items-center",children:[e.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-secondary px-1 py-0 text-[11px] font-bold text-secondary-foreground leading-tight",children:[e.jsx(ae,{className:"h-2.5 w-2.5"}),"P",t.practice_number]}),n,i,C]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[13px] font-semibold leading-snug whitespace-normal",children:t.label||"Practice"}),d.length>0&&e.jsx("div",{className:"text-[10px] leading-snug text-muted-foreground whitespace-normal",children:d.join(" · ")}),R&&e.jsxs("div",{className:"mt-1 flex flex-wrap justify-center gap-1",children:[S.map(L=>e.jsx("span",{className:"inline-flex items-center rounded bg-warning px-1.5 py-0.5 text-[10px] font-bold leading-none text-warning-foreground",children:L},L)),k>0&&e.jsxs("span",{className:"inline-flex items-center rounded bg-warning px-1.5 py-0.5 text-[10px] font-bold leading-none text-warning-foreground",children:["+",k," more"]})]})]}),e.jsx("div",{className:"w-10 text-right text-[11px] text-muted-foreground tabular-nums",children:t.num_riders>0?t.num_riders:""}),e.jsx("div",{className:"w-14 text-right text-[11px] text-muted-foreground tabular-nums",children:Q(t.approx_time_iso)})]})]},t.position):e.jsxs(b.Fragment,{children:[g,e.jsxs("div",{ref:s||p&&!H?A:void 0,className:Y("flex items-center gap-2 px-3 py-1.5 border-l-4 border-l-primary scroll-mt-32",u,f&&!s&&"border-l-muted opacity-60",R&&!s&&!f&&"border-l-warning bg-warning/15",s&&"bg-primary/15 animate-pulse [animation-duration:2s]",p&&!s&&"border-l-success bg-success/10 animate-pulse [animation-duration:2.5s]"),children:[e.jsxs("div",{className:"flex min-w-[44px] flex-col items-center",children:[e.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-primary px-1 py-0 text-[11px] font-bold text-primary-foreground leading-tight",children:[e.jsx(z,{className:"h-2.5 w-2.5"}),t.race_number]}),!w&&e.jsxs("span",{className:"mt-0.5 text-[9px] uppercase text-muted-foreground leading-none",children:["M",t.moto_number]}),n,i,C]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[13px] font-semibold leading-snug whitespace-normal",children:d.join(" · ")||t.label||"—"}),R&&e.jsxs("div",{className:"mt-1 flex flex-wrap justify-center gap-1",children:[S.map(L=>e.jsx("span",{className:"inline-flex items-center rounded bg-warning px-1.5 py-0.5 text-[10px] font-bold leading-none text-warning-foreground",children:L},L)),k>0&&e.jsxs("span",{className:"inline-flex items-center rounded bg-warning px-1.5 py-0.5 text-[10px] font-bold leading-none text-warning-foreground",children:["+",k," more"]})]})]}),e.jsx("div",{className:"w-10 text-right text-[11px] text-muted-foreground tabular-nums",children:t.num_riders>0?t.num_riders:""}),e.jsx("div",{className:"w-14 text-right text-[11px] text-muted-foreground tabular-nums",children:Q(t.approx_time_iso)})]})]},`${t.kind}-${t.race_number}-${t.moto_number}-${d.join("|")}`)})})]})}export{Be 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.