PageSourceSearch

https://edgemxtiming.com/assets/OverlayStagePage-Bm_ZuMQE.js

js edgemxtiming.com collected 2026-10-02 01:31:11 UTC 12,477 bytes, 6 lines download raw bytes

1import{l as k,r as g,j as s,s as S,K as z,h as M}from"./index-Ct8eLu1I.js";import{e as T,l as q,t as I}from"./streamBoxLayers-b_ieUFxu.js";import{u as R}from"./usePublicLabLiveTiming-Cag7extT.js";import{u as F}from"./useTimingRaceOrder-CrSEwQiR.js";import"./lapOutliers-CZi5QlI6.js";import"./endurance-B_3nOsV8.js";function B(e,t,o=!1){return k({queryKey:["stage-active-event",e,t??""],enabled:o&&!!e,refetchInterval:15e3,refetchIntervalInBackground:!0,queryFn:async()=>{const{data:a,error:i}=await S.functions.invoke("fetch-public-overlay-event",{body:{org_slug:e,event_name:t??""}});if(i)throw i;return(a==null?void 0:a.event)??null}})}function C(e,t=!1){return k({queryKey:["stage-sponsors",e],enabled:t&&!!e,staleTime:12e4,queryFn:async()=>{const{data:o}=await S.from("sponsors").select("id, name, logo_url").eq("organization_id",e).eq("is_active",!0).order("display_order",{ascending:!0}).order("name",{ascending:!0});return o??[]}})}function A(e,t,o){return R(o?e:void 0,(t==null?void 0:t.name)??void 0,(t==null?void 0:t.id)??void 0,(t==null?void 0:t.event_date)??void 0)}function D(e,t,o){return F(o?e:void 0,(t==null?void 0:t.name)??void 0,(t==null?void 0:t.id)??void 0)}const j=(e,t=2.8)=>`${e.fontSize??t}vh`;function P(e){if(!e||e<=0)return"--";const t=e/1e3,o=Math.floor(t/60),a=t-o*60;return o>0?`${o}:${a.toFixed(2).padStart(5,"0")}`:a.toFixed(2)}function $(e){return e.flatMap(([,t])=>t)}function _({seconds:e,children:t}){return s.jsx("div",{className:"flex h-full w-full items-center overflow-hidden",children:s.jsxs("div",{className:"flex h-full shrink-0 items-center gap-[3vh] whitespace-nowrap pr-[3vh]",style:{animation:`bp-marquee ${Math.max(6,e)}s linear infinite`},children:[t,t]})})}function H({layer:e,sponsors:t}){const o=t.filter(l=>!!l.logo_url),[a,i]=g.useState(0),u=e.sponsorMode==="bug",f=Math.max(3,e.speed??15);if(g.useEffect(()=>{if(!u||o.length<2)return;const l=setInterval(()=>i(p=>(p+1)%o.length),f*1e3);return()=>clearInterval(l)},[u,o.length,f]),o.length===0)return null;const d=Math.max(10,Math.min(100,e.logoScale??80)),m={height:"auto",width:"auto",maxHeight:`${d}cqh`,maxWidth:`${d}cqw`};if(u){const l=o[a%o.length];return s.jsxs("div",{className:"flex h-full w-full min-w-0 items-center justify-center gap-[1vh] overflow-hidden p-[0.5vh]",style:{animation:"bp-fade 700ms ease",containerType:"size"},children:[s.jsx("img",{src:l.logo_url,alt:l.name,className:"block shrink-0 object-contain",style:m}),e.showSponsorNames&&s.jsx("span",{className:"shrink-0 font-semibold",style:{fontSize:j(e,2.2)},children:l.name})]},l.id)}return s.jsx("div",{className:"h-full w-full overflow-hidden",style:{containerType:"size"},children:s.jsx(_,{seconds:e.speed??30,children:o.map(l=>s.jsxs("span",{className:"flex h-full shrink-0 items-center gap-[1vh]",children:[s.jsx("img",{src:l.logo_url,alt:l.name,className:"block shrink-0 object-contain",style:m}),e.showSponsorNames&&s.jsx("span",{className:"font-semibold",style:{fontSize:j(e,2.2)},children:l.name})]},l.id))})})}function K({layer:e,sponsors:t}){const o=e.sponsorLogos?t.filter(i=>!!i.logo_url):[],a=j(e,3);return e.scroll?s.jsxs(_,{seconds:e.speed??28,children:[s.jsx("span",{className:"font-semibold tracking-wide",style:{fontSize:a},children:e.text}),o.map(i=>s.jsxs("span",{className:"flex h-full items-center gap-[1vh]",children:[s.jsx("img",{src:i.logo_url,alt:i.name,className:"max-h-[80%] w-auto object-contain"}),e.showSponsorNames&&s.jsx("span",{className:"font-semibold",style:{fontSize:a},children:i.name})]},i.id))]}):s.jsxs("div",{className:"flex h-full w-full items-center justify-center gap-[1.5vh] px-[1vh]",children:[o.slice(0,4).map(i=>s.jsx("img",{src:i.logo_url,alt:i.name,className:"max-h-[80%] w-auto object-contain"},i.id)),s.jsx("span",{className:"font-semibold tracking-wide",style:{fontSize:a},children:e.text})]})}function O({layer:e,order:t}){const o=j(e,2.8),a=g.useMemo(()=>{const i=(t==null?void 0:t.rows)??[];
1if(i.length===0)return"Race order coming up";const u=(t==null?void 0:t.current_race_number)??null,f=u==null?-1:i.findIndex(c=>c.race_number===u),d=c=>i[c],m=c=>c?`Race ${c.race_number} — ${c.class_name}${c.subclass_name?` ${c.subclass_name}`:""} (Moto ${c.moto_number})`:null,l=c=>{if(!(c!=null&&c.approx_time_iso))return"";const r=new Date(c.approx_time_iso);return Number.isNaN(r.getTime())?"":` · ~${r.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",timeZone:"America/Denver"})}`},p=[];f>=0&&p.push(`ON TRACK: ${m(d(f))}`);const h=f>=0?f+1:0;return d(h)&&p.push(`UP NEXT: ${m(d(h))}${l(d(h))}`),d(h+1)&&p.push(`ON DECK: ${m(d(h+1))}${l(d(h+1))}`),d(h+2)&&p.push(`THEN: ${m(d(h+2))}`),p.join("     •     ")},[t]);return e.scroll===!1?s.jsx("div",{className:"flex h-full w-full items-center justify-center overflow-hidden px-[1vh]",children:s.jsx("span",{className:"truncate font-semibold tracking-wide",style:{fontSize:o},children:a})}):s.jsx(_,{seconds:e.speed??32,children:s.jsx("span",{className:"font-semibold tracking-wide",style:{fontSize:o},children:a})})}function Q({layer:e,live:t}){const o=j(e,2.6),a=$(t.rowsByClass).slice(0,Math.max(3,e.topN??10));if(a.length===0)return null;const i=a.map(u=>s.jsxs("span",{className:"flex items-center gap-[0.8vh]",style:{fontSize:o},children:[s.jsxs("span",{className:"rounded-sm bg-white/20 px-[0.7vh] font-bold",children:["P",u.position]}),s.jsxs("span",{className:"font-bold",children:["#",u.bikeNumber]}),s.jsx("span",{className:"font-medium",children:u.riderName}),s.jsx("span",{className:"opacity-75",children:u.isLeader?"Lead":u.gapText})]},u.entryId));return e.scroll===!1?s.jsx("div",{className:"flex h-full w-full items-center gap-[3vh] overflow-hidden px-[1vh]",children:i}):s.jsx(_,{seconds:e.speed??30,children:i})}function G(e){switch(e){case"running":return{color:"#22c55e",label:"GREEN",blink:!1};case"pending":return{color:"#eab308",label:"STAGING",blink:!1};case"stopped":return{color:"#f5f5f5",label:"CHECKERED",blink:!1};case"finalized":return{color:"#f5f5f5",label:"FINAL",blink:!1};default:return{color:"#9ca3af",label:"STANDBY",blink:!1}}}function X({layer:e,live:t}){var x;const o=j(e,2.4),a=t.session,[i,u]=g.useState(()=>Date.now());if(g.useEffect(()=>{const y=setInterval(()=>u(Date.now()),500);return()=>clearInterval(y)},[]),!a)return null;const f=a.label||(a.classes??[]).filter(Boolean).join(" / ")||"Live",m=((x=$(t.rowsByClass)[0])==null?void 0:x.laps)??0,l=G(a.state),p=a.started_at?Date.parse(a.started_at):0,h=a.state==="running"&&p?Math.max(0,i-p):a.stopped_at&&p?Math.max(0,Date.parse(a.stopped_at)-p):0,c=Math.floor(h/6e4),r=Math.floor(h%6e4/1e3);return s.jsxs("div",{className:"flex h-full w-full items-center gap-[1.2vh] px-[1.2vh]",children:[e.showFlag!==!1&&s.jsx("span",{className:"shrink-0 rounded-full",style:{width:"1.6vh",height:"1.6vh",background:l.color,boxShadow:`0 0 1.2vh ${l.color}`,animation:a.state==="running"?"bp-pulse 2s ease-in-out infinite":void 0}}),s.jsxs("div",{className:"min-w-0 flex-1 leading-tight",children:[s.jsx("div",{className:"truncate font-bold uppercase tracking-wide",style:{fontSize:o},children:f}),s.jsxs("div",{className:"truncate opacity-80",style:{fontSize:`calc(${o} * 0.72)`},children:[l.label,m>0?` · Lap ${m}`:""]})]}),e.showClock!==!1&&s.jsxs("div",{className:"shrink-0 font-mono font-bold tabular-nums",style:{fontSize:o},children:[c,":",String(r).padStart(2,"0")]})]})}function U({layer:e,live:t}){const o=j(e,3),a=t.session,i=(a==null?void 0:a.id)??null,u=$(t.rowsByClass),[f,d]=g.useState([]),m=g.useRef(new Set),l=g.useRef(0);g.useEffect(()=>{m.current=new Set,l.current=0,d([])},[i]);const p=r=>{m.current.has(r.key)||(m.current.add(r.key),d(x=>[...x,r]))},h=k({queryKey:["stage-holeshots",i],enabled:!!i&&e.alertHoleshot!==!1,refetchInterval:5e3,refetchIntervalInBackground:!0,queryFn:async()=>{const{data:r}=await S.from("timing_lab_holeshots").select("id, class_name, rider_name, bike_number, crossed_at").eq("session_id",i).order("crossed_at",{ascending:!0});return r??[]}});g.useEffect(()=>{if(e.alertHoleshot!==!1)for(const r of h.data??[])p({key:`hs:${r.id}`,kind:"HOLESHOT",title:`#${r.bike_number??"--"} ${r.rider_name??"Rider"}`,lines:[r.class_name??""]})},[h.data,e.alertHoleshot]),g.useEffect(()=>{if(e.alertFastLap===!1)return;let r=null;for(const x of u)x.bestLapMs>0&&(!r||x.bestLapMs<r.bestLapMs)&&(r=x);r&&(l.current===0||r.bestLapMs<l.current)&&(l.current=r.bestLapMs,p({key:`fl:${i}:${r.entryId}:${r.bestLapMs}
1`,kind:"FASTEST LAP",title:`#${r.bikeNumber} ${r.riderName}`,lines:[`${P(r.bestLapMs)} · ${r.className}`]}))},[u,e.alertFastLap,i]),g.useEffect(()=>{if(e.alertPodium!==!1&&!(!a||a.state!=="stopped"&&a.state!=="finalized"))for(const[r,x]of t.rowsByClass){const y=x.slice(0,3);y.length!==0&&p({key:`pod:${a.id}:${r}`,kind:"PODIUM",title:r,lines:y.map((v,N)=>`${N+1}. #${v.bikeNumber} ${v.riderName}`)})}},[a==null?void 0:a.state,t.rowsByClass,e.alertPodium]);const c=f[0]??null;return g.useEffect(()=>{if(!c)return;const r=Math.max(3,e.alertSeconds??8)*1e3,x=setTimeout(()=>d(y=>y.slice(1)),r);return()=>clearTimeout(x)},[c,e.alertSeconds]),c?s.jsxs("div",{className:"flex h-full w-full flex-col justify-center gap-[0.4vh] px-[1.6vh]",style:{animation:"bp-slide 400ms ease"},children:[s.jsx("div",{className:"font-black uppercase tracking-[0.18em] opacity-80",style:{fontSize:`calc(${o} * 0.55)`},children:c.kind}),s.jsx("div",{className:"truncate font-black uppercase",style:{fontSize:o},children:c.title}),c.lines.filter(Boolean).map(r=>s.jsx("div",{className:"truncate font-semibold opacity-90",style:{fontSize:`calc(${o} * 0.62)`},children:r},r))]}):null}const Y=`
2@keyframes bp-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
3@keyframes bp-fade { from { opacity: 0; } to { opacity: 1; } }
4@keyframes bp-slide { from { opacity: 0; transform: translateX(-4%); } to { opacity: 1; transform: none; } }
5@keyframes bp-pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
6`;function w(e){switch(e){case"dark":return"bg-black/70 text-white";case"light":return"bg-white/85 text-black";case"brand":return"bg-primary/85 text-primary-foreground";default:return""}}function te(){var N;const{orgSlug:e}=z(),[t]=M(),o=g.useMemo(()=>T(t.get("cfg")),[t]),a=t.get("event")??"";g.useEffect(()=>{const n=document.documentElement.style.background,b=document.body.style.background;return document.documentElement.style.background="transparent",document.body.style.background="transparent",()=>{document.documentElement.style.background=n,document.body.style.background=b}},[]);const i=k({queryKey:["stage-org",e],enabled:!!e,staleTime:6e4,queryFn:async()=>{const{data:n}=await S.from("organizations").select("id, name, slug, logo_url, primary_color").eq("slug",e).maybeSingle();return n}}),u=o.filter(n=>n.visible!==!1),f=n=>u.some(b=>b.type===n),d=f("sponsors")||u.some(n=>n.type==="text"&&n.sponsorLogos),m=f("crawler")||f("nowracing")||f("alerts"),l=f("schedule"),h=B(e,a,m||l).data??null,c=A(e,h,m),r=D(e,h,l),y=C((N=i.data)==null?void 0:N.id,d).data??[],v=n=>`/org/${e}/overlay/sidebar?${I(n,a)}`;return s.jsxs("div",{className:"relative h-screen w-screen overflow-hidden bg-transparent",children:[u.map(n=>{var L;const b=q(n);if(n.type==="timing")return s.jsx("div",{style:b,children:s.jsx("iframe",{title:n.name,src:v(n),className:"h-full w-full border-0 bg-transparent",allowTransparency:!0})},n.id);if(n.type==="web")return s.jsx("div",{style:b,children:n.url?s.jsx("iframe",{title:n.name,src:n.url,className:"h-full w-full border-0 bg-transparent",allowTransparency:!0}):null},n.id);if(n.type==="image"){const E=n.url||((L=i.data)==null?void 0:L.logo_url)||"";return s.jsx("div",{style:b,className:w(n.plate),children:E?s.jsx("img",{src:E,alt:n.name,className:"h-full w-full object-contain"}):null},n.id)}return n.type==="sponsors"?s.jsx("div",{style:b,className:w(n.plate),children:s.jsx(H,{layer:n,sponsors:y})},n.id):n.type==="schedule"?s.jsx("div",{style:b,className:w(n.plate),children:s.jsx(O,{layer:n,order:r.data})},n.id):n.type==="crawler"?s.jsx("div",{style:b,className:w(n.plate),children:s.jsx(Q,{layer:n,live:c})},n.id):n.type==="nowracing"?s.jsx("div",{style:b,className:`${w(n.plate)} rounded-[0.6vh]`,children:s.jsx(X,{layer:n,live:c})},n.id):n.type==="alerts"?s.jsx("div",{style:b,className:`${w(n.plate)} rounded-[0.6vh]`,children:s.jsx(U,{layer:n,live:c})},n.id):s.jsx("div",{style:b,className:w(n.plate),children:s.jsx(K,{layer:n,sponsors:y})},n.id)}),s.jsx("style",{children:Y})]})}export{te 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.