PageSourceSearch

https://www.pingpongathon.com/assets/EventCard-CKfDmd7S.js

js pingpongathon.com collected 2026-10-04 10:46:05 UTC 18,370 bytes, 1 lines download raw bytes

1import{Y as e,et as t,f as n,g as r,m as i,t as a}from"./jsx-runtime-Co6TVm03.js";import{t as o}from"./react-dom-p2QWhrdT.js";import{t as s}from"./luxon-DODVogmD.js";import{G as c,b as l,g as u,m as d,q as f,u as ee,y as p}from"./Objects-CGgF6iLN.js";import{n as m}from"./Routes-DbaLMCjn.js";import{t as h}from"./gsap-Bi_c5vh2.js";import{t as g}from"./Icon-DPAlW5PN.js";import{a as te,n as _,r as v,t as ne}from"./AchievementsBL-JdG_Xo3A.js";import{a as y,p as re}from"./Functions-CPvU6w3V.js";import{_ as ie,b as ae}from"./Fetch-CVcM6EkJ.js";import{n as oe,t as se}from"./PlayerCard-BeXtRHFF.js";import{t as b}from"./FeatureButton-BstGLGrY.js";import{m as x,n as S}from"./Analytics-DN1_j0qR.js";import{t as C}from"./src-BhoUhRR_.js";var w=a();function T({players:e,size:t=50,ringColor:n,rewards:r=[],frameInset:i}){return(0,w.jsx)(`div`,{className:`row`,style:{position:`relative`,alignItems:`center`},children:e.map((a,o)=>{let s=p(a,r),c=s?t+(i??3)*2:t;return(0,w.jsx)(y,{className:`outline`,src:l(a,r),size:c,cssClass:s,frameInset:i,style:{marginLeft:o===0?0:-(t*.3),zIndex:e.length-o,position:`relative`,background:`var(--accent-gradient)`,boxShadow:!s&&n?`0 0 0 4px ${n}`:void 0}},a.id??o)})})}var E=t(e(),1);function D(e){return e?.start_time?s.now()<s.fromISO(e.start_time):!1}function O(e){if(!e?.length)return`Unknown`;if(e.length>1)return e.map(e=>e.first||e.username).filter(Boolean).join(` & `)||`Unknown`;let t=e[0];return[t.first,t.last].filter(Boolean).join(` `)||t.username||`Unknown`}function ce({isLocked:e,canVerify:t}){return[{title:`Live View`,body:`This is the live view for your event.  Put this page up on a big screen at your event to see donations, rallies and players in real time.`,image:`/Live-Page-Example.jpeg`,imageAlt:`Example of the live event page`},{selector:`[data-tutorial="rally-or-update"]`,title:`Add a Rally`,body:`Click "+ Rally or Update" to log a new rally score or post an update for your event.`,fallback:e?{placeholderIcon:`lock-closed-outline`,placeholderText:`Scores are final for this event`,body:`While an event is running, players use "+ Rally or Update" here to log rally scores and post updates. This event has finished, so its scores are now final.`}:{placeholderIcon:`add-circle-outline`,placeholderText:`Appears when your event goes live`,body:`Once your event starts, a "+ Rally or Update" button appears here. Use it to log a rally score or post an update for your event.`}},{selector:`[data-tutorial="leaderboard"]`,title:`Leaderboard`,body:`Donations are always shown on the left. Switch rally types on the right to see different leaderboards. Click a player to see their full stats.`,mobileBody:`Switch rally types to see different leaderboards. Click a player to see their full stats.`,fallback:{placeholderIcon:`podium-outline`,placeholderText:`Appears when your event goes live`,body:`Once your event starts, donations show on the left and rally scores on the right. Switch rally types to see different leaderboards, and click a player to see their full stats.`,mobileBody:`Once your event starts, you'll be able to switch between donations and rally types here, and click a player to see their full stats.`}},t?{selector:`[data-tutorial="verify-scores"]`,clampToViewport:!0,title:`Verify Scores`,body:`As an event organiser, tap here to review and verify your players' rally scores. Only verified scores are official — and verified scores are the ones that show up on the leaderboards page.`,mobileBody:`As an event organiser, tap here to verify your players' rally scores. Only verified scores show up on the leaderboards page.`,note:`Tip: adding more event organisers to your organisation makes this easier — only event organisers can verify scores.`}:{title:`Verify Scores`,placeholderIcon:`shield-checkmark-outline`,placeholderText:`Ask your event organisers to verify your rally scores`,body:`Ask your event organiser to verify players' scores so they become official. Verified scores are the ones that show up on the leaderboards page.`}]}function k(e,t){let n=e.profiles.map(t=>({profile:t,total:e.donations.filter(e=>e.donated_to_id===t.id).reduce((e,t)=>
1e+(t.cents||0),0)})).sort((e,t)=>t.total-e.total);return t>0?n.slice(0,t):n}function A(e){if(!e?.profiles?.length)return null;let[t]=k(e,1);if(!t||t.total<=0)return null;let{first:n,last:r}=t.profile;return{name:[n,r].filter(Boolean).join(` `)||`Unknown`,cents:t.total}}function j(e){if(!e.length)return[];let t=Math.max(...e.map(e=>e.total),1);return e.map(e=>e.total/t*100)}function M(e,t){let n=k(e,t),r=j(n);return n.map((t,n)=>({id:t.profile.id,rank:n+1,players:[t.profile],primaryProfile:t.profile,scoreValue:t.total,donationCount:e.donations.filter(e=>e.donated_to_id===t.profile.id).length,scoreLabel:`$`+d(t.total),graphPercentage:r[n]||0,isVerified:!0}))}function le(e,t,n){let r=e.filter(e=>e.rally_types?.name===t).sort((e,t)=>t.num_hits-e.num_hits);n>0&&(r=r.slice(0,n));let i=r.length?Math.max(...r.map(e=>e.num_hits),1):1;return r.map((e,t)=>{let n=e.players_to_rallys.map(e=>e.profiles);return{id:e.id,rank:t+1,players:n,primaryProfile:n[0]??null,scoreValue:e.num_hits,scoreLabel:`${u(e.num_hits)} hits`,graphPercentage:e.num_hits/i*100,isVerified:e.is_verified}})}function N(e){return(e.players_to_rallys?.length??0)>0}function ue(e,t=[]){let n=new Set,r=[];for(let e of t)e.name&&!n.has(e.name)&&(n.add(e.name),r.push({value:e.name,label:e.name}));if(r.length>0)return r;for(let t of e){let e=t.rally_types?.name;e&&!n.has(e)&&N(t)&&(n.add(e),r.push({value:e,label:e}))}return r}function P(e,t){let n=new Set(t.filter(N).map(e=>e.rally_types?.name).filter(Boolean)),r=e.filter(e=>n.has(String(e.value)));return r.length>0?r:e}var F=`/new-record.mp3`,I=`/big-donation.mp3`;function L(e,t,n){let r=e.find(e=>String(e.rally_type_id)===String(n.rally_type_id)),i=null;if(r)i=Number(r.num_hits);else{let e=t.filter(e=>String(e.rally_type_id)===String(n.rally_type_id));e.length>0&&(i=Math.max(...e.map(e=>Number(e.num_hits))))}return i===null||Number(n.num_hits)>i}function R(e,t){if(!t.length)return null;let n=Number(e.num_hits);return{key:`rally-${e.id}`,kind:`highscore`,row:{id:e.id,rank:1,players:t,primaryProfile:t[0],scoreValue:n,scoreLabel:`${u(n)} hits`,graphPercentage:100,isVerified:e.is_verified||!1},label:`${u(n)} HIT RECORD!`,sound:F}}function z(e,t){if(t.is_hidden||Number(t.cents)<1e4||!t.donated_to_id)return null;let n=e.profiles?.find(e=>e.id===t.donated_to_id);if(!n)return null;let r=e.donations?.some(e=>e.id===t.id)?e.donations:[...e.donations??[],t],i=M({...e,donations:r},0).findIndex(e=>e.id===n.id)+1;return{key:`donation-${t.id}`,kind:`donation`,row:{id:`donation-${t.id}`,rank:i||1,players:[n],primaryProfile:n,scoreValue:t.cents,scoreLabel:`$`+d(t.cents),graphPercentage:100,isVerified:!0},label:`$${d(t.cents)} DONATION!`,sound:I}}function B({data:e,onClick:t,indexNumber:n=0,verticalAvatars:i=!1,showState:a=!1,showOrgLogo:o=!1,renderAction:s}){let l=r();return(0,w.jsx)(`div`,{className:`col mt-10`,children:e.map((e,r)=>{let u=r+1+n,d=u<=3?v(4-u):null;return(0,w.jsxs)(`div`,{style:{borderTop:`1px solid var(--accent-md)`},className:`row w-100 between middle gap-10 pb-10 pt-20 clickable r-0 shrink-wrap`,onClick:()=>t(e),children:[(0,w.jsxs)(`div`,{className:`row middle w-75 gap-10`,children:[(0,w.jsxs)(`div`,{className:`row middle between`,children:[(0,w.jsx)(`div`,{className:`col middle center`,style:{width:44,minWidth:44,flexShrink:0},children:d?(0,w.jsx)(`img`,{src:`${c}/${d.image}.png`,alt:`${d.name} tier trophy`,style:{height:44},loading:`lazy`}):(0,w.jsx)(`h4`,{children:u})}),o?(0,w.jsx)(`img`,{src:e.organisation?.logo_image??f,alt:`Organisation logo`,style:{width:50,height:50,borderRadius:`50%`,objectFit:`cover`,flexShrink:0},loading:`lazy`}):e.players?.length>0?i?(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(2, 50px)`,rowGap:-12,columnGap:2},children:e.players.map((e,t)=>(0,w.jsx)(`div`,{style:{marginTop:t>=2?-12:0},children:(0,w.jsx)(T,{players:[e],rewards:l.rewards})},e.id??t))}):(0,w.jsx)(T,{players:e.players,rewards:l.rewards}):(0,w.jsx)(`img`,{src:f,alt:``,style:{height:50},loading:`lazy`})]}),(0,w.jsxs)(`div`,{className:`w-100 col gap-5`,children:[(0,w.jsx)(`h2`,{style:{marginLeft:2,fontSize:`var(--text-h3)`},children:e.organisation?.name?e.organisation.name:O(e.players)}),!e.event&&a&&e.organisation?.state&&(0,w.jsx)(`p`,{style:{color:`var(--accent-lg)`},children:e.organisation.state}),e.donationCount!=null&&(0,w.jsxs)(`p`,{children:[e.donationCount,` donation`,e.donationCount===1?``:`s`]}),e.event&&(0,w.jsxs)(`div`,{className:`row middle gap-5`,children:[(0,w.jsx)(g,{name:`business`,color:`var(--accent-lg)`}),(0,w.jsxs)(`h4`,{className:``,style:{textTransform:`uppercase`,color:`var(--accent-lg)`},children:[e.event.name,a&&e.organisation?.state?` · ${e.organisation.state}`:``]}),(0,w.jsx)(g,{onClick:()=>{x(S.DONATION_TABLE_EVENT,l,{event_slug:e.event?.slug??null}),l.navigate(m(e.event?.slug))},name:`arrow-forward-circle-outline`,size:20,color:`var(--accent)`,className:`clickable`})]})]})]}),(0,w.jsxs)(`div`,{className:s&&!l.inShrink?`col gap-10 w-50`:`w-10 col gap-10`,style:s&&!l.inShrink?{flex:1,minWidth:0,width:`100%`}:{width:`100%`},children:[(0,w.jsx)(V,{isVerified:e.isVerified,percentage:e.graphPercentage,value:e.scoreLabel}),s&&l.inShrink&&(0,w.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:s(e)})]}),s&&!l.inShrink&&(0,w.jsx)(`div`,{className:``,onClick:e=>e.stopPropagation(),children:s(e)})]},r)})})}function V({percentage:e,value:t,isVerified:n}){let r=(0,E.useRef)(null);return C(()=>{r.current&&h.fromTo(r.current,{width:0},{width:`${e}%`,delay:.5,duration:1,ease:`back.out`})},[e]),(0,w.jsx)(`div`,{className:`w-100 r-lg`,style:{position:`relative`,background:`var(--accent-md)`},children:(0,w.jsxs)(`div`,{className:`p-10 r-lg row gap-5 ${e<50?`end`:`start`}`,style:{position:`relative`,overflow:`hidden`,alignItems:`center`},children:[(0,w.jsx)(`div`,{ref:r,className:`r-lg row`,style:{background:n?`var(--accent-gradient)`:`var(--warning)`,position:`absolute`,top:0,left:0,height:`100%`}}),(0,w.jsx)(`h3`,{style:{position:`relative`,fontSize:`var(--text-h4)`,zIndex:1,color:e>=50&&n?`var(--accent-sm)`:`var(--txt)`},children:t}),!n&&(0,w.jsxs)(`div`,{className:`row middle gap-5 boxed p-5 ml-5`,style:{zIndex:20},children:[(0,w.jsx)(g,{name:`warning`,color:e>50?`var(--accent-lg)`:`var(--warning)`}),(0,w.jsx)(`h4`,{style:{textTransform:`uppercase`,color:e>50?`var(--accent-lg)`:`var(--warning)`},children:`Unverified`})]})]})})}var H=t(o());function U(e,t){return{id:String(e.id),cssClass:e.css_class??void 0,icon:`🖼️`,label:e.name,unlocked:t,achievedHint:t?e.description??void 0:void 0,lockedHint:t?void 0:e.lock_description??void 0}}function W({active:e,onClose:t,event:a,isClosing:o=!1,noWrapper:s=!1,index:l=0,isEditable:u=!1,linkSource:f=S.EVENT_CARD}){let p=i(),h=n(),g=r();function v(){x(f,g,{event_id:a.id,event_slug:a.slug,page_url:h.pathname})}
1let[y,C]=(0,E.useState)(!1),[T,D]=(0,E.useState)(!1),O=o||T,[ce,k]=(0,E.useState)(!1),[A,j]=(0,E.useState)(null),[M,le]=(0,E.useState)(a.banner_url??null);(0,E.useRef)(null);let[N,ue]=(0,E.useState)(!1),[P,F]=(0,E.useState)([]),I=(0,E.useMemo)(()=>P.filter(e=>e.reward_type===`frame`),[P]),[L,R]=(0,E.useState)([]),[z,B]=(0,E.useState)([]);(0,E.useEffect)(()=>{let e=a.organisation_id;e&&Promise.all([ie(e),ae()]).then(([e,t])=>{F(t),R(te(e))}).catch(console.error)},[]),(0,E.useEffect)(()=>{L.length&&B(ne(L,P))},[L,P]);let V=(0,E.useMemo)(()=>new Set(z.flatMap(e=>e.rewards.filter(e=>e.unlocked).map(e=>e.rewardId))),[z]);(0,E.useEffect)(()=>{if(!I.length)return;let e=a.organisations?.card_frame_id??null;if(e==null)return;let t=I.find(t=>t.id===e);if(t){let e=t.unlock_type===`always`||V.has(t.id);j(U(t,e))}},[I,V]);let W=(0,E.useMemo)(()=>I.map(e=>U(e,e.unlock_type===`always`||V.has(e.id))),[I,V]),G=(0,E.useMemo)(()=>{let e=[0,0,0,0,0];for(let t of z)for(let n of t.savedTiers??[]){let t=Number(n.name);n.is_unlocked&&t>=1&&t<=5&&e[t-1]++}return e},[z]),{donationCount:K,totalRaisedCents:q}=(0,E.useMemo)(()=>{let e=a.donations??[];return{donationCount:e.length,totalRaisedCents:e.reduce((e,t)=>e+(t.cents||0),0)}},[a.donations]),{hasGoal:de,goalLabel:fe,goalPct:J}=ee(q,a.goal),Y=a.organisations?.logo_image,X=a.organisations?.name||``;function Z(){C(!1),D(!0),setTimeout(()=>{D(!1),t()},300)}function pe(e){let t=A?.id===e.id?null:e;j(t),k(!1);let n=a.organisation_id;n&&re(n,t?parseInt(t.id,10):null).catch(console.error)}if(!e)return null;let me=Y||M||a.banner_url,Q=a.name,he=(0,w.jsx)(`div`,{className:`player-card-perspective entry-reveal${O?` closing`:``}`,onClick:e=>e.stopPropagation(),style:l>0?{"--card-delay":`${l*.5}s`}:void 0,children:(0,w.jsxs)(`div`,{className:`player-card-container${y?` flipped`:``}`,onClick:()=>C(e=>!e),children:[(0,w.jsxs)(`div`,{className:`player-card-face pc-front${A?.cssClass?` ${A.cssClass}`:``}`,children:[(0,w.jsx)(`div`,{className:`pc-header`,children:(0,w.jsx)(`span`,{className:`pc-event-name`,children:X||`Event`})}),(0,w.jsxs)(`div`,{className:`pc-photo-area`,children:[(0,w.jsx)(`div`,{className:`pc-photo-glow`}),me?(0,w.jsx)(`img`,{src:me,alt:Q??void 0,className:`pc-photo`,loading:`lazy`}):(0,w.jsx)(`div`,{className:`pc-photo`,style:{background:`var(--color-surface)`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:`2.5rem`},children:`🏓`}),(0,w.jsx)(`div`,{className:`pc-photo-diagonal`})]}),(0,w.jsxs)(`div`,{className:`pc-stats-row`,children:[(0,w.jsxs)(`div`,{className:`pc-stat`,children:[(0,w.jsx)(`span`,{className:`pc-stat-value`,children:K}),(0,w.jsx)(`span`,{className:`pc-stat-label`,children:`Donations`})]}),(0,w.jsx)(`div`,{className:`pc-stat-divider`}),(0,w.jsxs)(`div`,{className:`pc-stat`,children:[(0,w.jsx)(`span`,{className:`pc-stat-value`,children:`$`+d(q,0)}),(0,w.jsx)(`span`,{className:`pc-stat-label`,children:`Raised`})]})]}),(0,w.jsxs)(`div`,{className:`pc-name-section`,children:[(0,w.jsx)(`h2`,{className:`pc-player-name`,children:Q}),(0,w.jsx)(`p`,{className:`pc-subtitle`,children:X})]}),(0,w.jsx)(`div`,{className:`m-10`,children:a.slug&&(0,w.jsx)(b,{onClick:e=>{e.stopPropagation(),h.pathname===m(a.slug)?Z():(v(),p(m(a.slug)))},children:`View Event`})}),(0,w.jsx)(`p`,{className:`pc-hint`,children:`Tap to flip →`})]}),(0,w.jsxs)(`div`,{className:`player-card-face pc-back${A?.cssClass?` ${A.cssClass}`:``}`,children:[(0,w.jsx)(`div`,{className:`pc-header`,children:(0,w.jsx)(`span`,{className:`pc-event-name`,children:`Community Account Stats`})}),(0,w.jsx)(`div`,{className:`pc-identity`,children:(0,w.jsx)(`h2`,{className:`pc-player-name`,children:Q})}),(0,w.jsx)(`div`,{className:`pc-back-divider`}),(0,w.jsxs)(`div`,{className:`pc-stats-grid`,children:[(0,w.jsxs)(`div`,{className:`pc-stat-box`,children:[(0,w.jsx)(`span`,{className:`pc-stat-value`,children:K}),(0,w.jsx)(`span`,{className:`pc-stat-label`,children:K===1?`Donation`:`Donations`})]}),(0,w.jsxs)(`div`,{className:`pc-stat-box`,children:[(0,w.jsx)(`span`,{className:`pc-stat-value`,children:`$`+d(q,0)}),(0,w.jsx)(`span`,{className:`pc-stat-label`,children:`Raised`})]}),(0,w.jsxs)(`div`,{className:`pc-stat-box`,children:[(0,w.jsx)(`span`,{className:`pc-stat-value`,children:fe}),(0,w.jsx)(`span`,{className:`pc-stat-label`,children:`Goal`})]})]}),de&&(0,w.jsxs)(`div`,{className:`pc-progress`,children:[(0,w.jsx)(`div`,{className:`pc-progress-bar mt
1-5`,children:(0,w.jsx)(`div`,{className:`pc-progress-fill`,style:{width:`${J}%`}})}),(0,w.jsxs)(`span`,{className:`pc-progress-text`,children:[J.toFixed(0),`% of goal`]})]}),(0,w.jsxs)(`div`,{className:`pc-medals-section`,children:[(0,w.jsx)(`div`,{className:`pc-medals-row`,children:[1,2,3].map(e=>{let t=_(e);return(0,w.jsxs)(`div`,{className:`pc-medal-item`,children:[(0,w.jsx)(`img`,{src:`${c}/${t.image}.png`,alt:t.name,className:`pc-medal-icon`,loading:`lazy`}),(0,w.jsx)(`span`,{className:`pc-medal-count`,style:{color:t.color},children:G[e-1]})]},e)})}),(0,w.jsx)(`div`,{className:`pc-medals-row`,style:{justifyContent:`space-evenly`},children:[4,5].map(e=>{let t=_(e);return(0,w.jsxs)(`div`,{className:`pc-medal-item`,children:[(0,w.jsx)(`img`,{src:`${c}/${t.image}.png`,alt:t.name,className:`pc-medal-icon pt-5`,loading:`lazy`}),(0,w.jsx)(`span`,{className:`pc-medal-count`,style:{color:t.color},children:G[e-1]})]},e)})})]}),(0,w.jsx)(`div`,{className:`pc-back-divider`}),u&&(0,w.jsxs)(`div`,{className:`pc-showcase-section`,children:[(0,w.jsx)(`span`,{className:`pc-section-title`,children:`Customisations`}),(0,w.jsxs)(`div`,{className:`row gap-20 mt-10`,children:[(0,w.jsxs)(`div`,{className:`col middle gap-5`,children:[(0,w.jsx)(`div`,{className:`pc-showcase-circle${Y?` filled`:``}`,onClick:e=>e.stopPropagation(),children:Y?(0,w.jsx)(`img`,{src:Y,alt:X,loading:`lazy`,style:{width:`100%`,height:`100%`,objectFit:`cover`,borderRadius:`50%`}}):(0,w.jsx)(`span`,{className:`pc-showcase-circle-icon`,children:`🏢`})}),(0,w.jsx)(`label`,{className:`txt`,children:`Org Logo`})]}),(0,w.jsx)(`div`,{className:`divider-vertical`}),(0,w.jsxs)(`div`,{className:`col middle gap-5`,children:[(0,w.jsx)(`div`,{className:`pc-showcase-circle${A?` filled`:``}${u?` editable`:``}`,onClick:e=>{e.stopPropagation(),u&&k(!0)},children:(0,w.jsx)(oe,{type:`frame`,cssClass:A?.cssClass,name:A?.label??`Frame`,description:A?.achievedHint,fallbackIcon:``})}),(0,w.jsx)(`label`,{className:`txt`,children:`Chosen Frame`})]})]})]}),(0,w.jsx)(`div`,{className:`pr-10 pl-10 mt-20`,children:a.slug&&(0,w.jsx)(b,{onClick:e=>{e.stopPropagation(),h.pathname===m(a.slug)?Z():(v(),p(m(a.slug)))},children:`View Event`})}),(0,w.jsx)(`p`,{className:`pc-hint`,style:{marginTop:`auto`},children:u?`← Flip | Tap circles to customise`:`← Tap to flip back`})]})]})}),$=ce?(0,w.jsx)(se,{active:!0,onClose:()=>k(!1),title:`Choose Frame`,items:W,selectedId:A?.id??null,onSelect:pe,excludeIds:[],zIndex:200}):null;return s?typeof document<`u`?(0,w.jsxs)(w.Fragment,{children:[he,$&&(0,H.createPortal)($,document.body)]}):null:typeof document<`u`?(0,H.createPortal)((0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`player-card-backdrop fade-sm${O?` closing`:``}`,onClick:Z}),(0,w.jsx)(`div`,{className:`player-card-overlay`,onClick:Z,children:he}),$]}),document.body):null}export{z as a,le as c,P as d,ue as f,T as g,L as h,F as i,ce as l,D as m,B as n,M as o,A as p,I as r,R as s,W as t,O as u};

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.