PageSourceSearch

https://rankingrun.cloudj.workers.dev/assets/ranking-BSeUxMpU.js

js rankingrun.cloudj.workers.dev collected 2026-10-03 08:09:54 UTC 33,110 bytes, 14 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/es-D3pia4vj.js","assets/dist-BJAFxcYu.js"])))=>i.map(i=>d[i]);
2import{i as e}from"./dist-BJAFxcYu.js";import{M as t,O as n,j as r,k as i,s as a,t as o}from"./jsx-runtime-DOhyBulg.js";import{n as s}from"./store-Cwy2aUvL.js";var c=e(t(),1),l={en:{title:`RankingRun - Global Leaderboard`,description:`Compete with runners worldwide!`,leaderboardTitle:`Global Leaderboard`,leaderboardSub:`Check fair rankings verified by AI`,refresh:`Refresh ranking`,analyze:`Analyze My Record (.fit) with AI`,nicknamePlaceholder:`Enter your nickname`,nicknameRequired:`Please enter a nickname! It's required to record your activity.`,nicknameTaken:`This nickname is already in use. Please choose another one!`,analyzing:`AI is analyzing...`,topRanked:`Top Ranked Feeds`,noData:`No data available.`,uploadSuccess:`Upload successful!`,uploadError:`An error occurred during upload.`,distance:`Distance`,pace:`Pace`,elevation:`Elevation`,aiScore:`AI Score`,sports:{Running:`Running`,Walking:`Walking`,Hiking:`Hiking`,Swimming:`Swimming`,Treadmill:`Treadmill`},coaching:{default:`AI analysis server is busy. Assigned a base score.`,anomaly:`Data anomaly detected. Manipulated records are not reflected in rankings.`},fitOnly:`Only .fit files can be uploaded.`},ko:{title:`RankingRun - 글로벌 리더보드`,description:`전 세계 러너들과 경쟁하세요!`,leaderboardTitle:`글로벌 리더보드`,leaderboardSub:`AI가 검증한 공정한 순위를 확인하세요`,refresh:`랭킹 새로고침`,analyze:`내 기록 (.fit) AI 분석하기`,nicknamePlaceholder:`닉네임을 입력하세요`,nicknameRequired:`닉네임을 입력해주세요! 기록을 남기기 위해 필요합니다.`,nicknameTaken:`이미 사용 중인 닉네임입니다. 다른 닉네임을 선택해주세요!`,analyzing:`AI가 분석 중입니다...`,topRanked:`인기 피드`,noData:`데이터가 없습니다.`,uploadSuccess:`업로드 성공!`,uploadError:`업로드 중 오류가 발생했습니다.`,distance:`거리`,pace:`페이스`,elevation:`고도`,aiScore:`AI 점수`,sports:{Running:`러닝`,Walking:`걷기`,Hiking:`등산`,Swimming:`수영`,Treadmill:`트레드밀`},coaching:{default:`AI 분석 서버가 혼잡하여 기본 점수를 부여했습니다.`,anomaly:`데이터 이상이 감지되었습니다. 조작된 기록은 랭킹에 반영되지 않습니다.`},fitOnly:`FIT 파일만 업로드 가능합니다.`},ja:{title:`RankingRun - グローバルリーダーボード`,description:`世界中のランナーと競いましょう!`,leaderboardTitle:`グローバルリーダーボード`,leaderboardSub:`AIが検証した公正なランキングを確認してください`,refresh:`ランキングを更新`,analyze:`記録 (.fit) をAIで分析する`,nicknamePlaceholder:`ニックネームを入力してください`,nicknameRequired:`ニックネームを入力してください!活動を記録するために必要です。`,nicknameTaken:`このニックネームは既に使用されています。別の名前を選んでください!`,analyzing:`AIが分析中です...`,topRanked:`トップランクフィード`,noData:`データがありません。`,uploadSuccess:`アップロード成功!`,uploadError:`アップロード中にエラーが発生しました。`,distance:`距離`,pace:`ペース`,elevation:`獲得高度`,aiScore:`AIスコア`,sports:{Running:`ランニング`,Walking:`ウォーキング`,Hiking:`ハイキング`,Swimming:`水泳`,Treadmill:`トレッドミル`},coaching:{default:`AI分析サーバーが混雑しています。基本スコアを付与しました。`,anomaly:`データの異常が検出されました。操作された記録はランキングに反映されません。`},fitOnly:`FITファイルのみアップロード可能です。`},"zh-TW":{title:`RankingRun - 全球排行榜`,description:`與全球跑者競爭!`,leaderboardTitle:`全球排行榜`,leaderboardSub:`查看由 AI 驗證的公平排名`,refresh:`更新排行榜`,analyze:`使用 AI 分析我的紀錄 (.fit)`,nicknamePlaceholder:`請輸入暱稱`,nicknameRequired:`請輸入暱稱!這是記錄您活動的必要資訊。`,nicknameTaken:`此暱稱已被使用。請選擇另一個!`,analyzing:`AI 分析中...`,topRanked:`熱門動態`,noData:`目前沒有數據。`,uploadSuccess:`上傳成功!`,uploadError:`上傳過程中發生錯誤。`,distance:`距離`,pace:`配速`,elevation:`高度`,aiScore:`AI 評分`,sports:{Running:`跑步`,Walking:`健走`,Hiking:`登山`,Swimming:`游泳`,Treadmill:`跑步機`},coaching:{default:`AI 分析伺服器忙碌中。已給予基本分數。`,anomaly:`檢測到數據異常。造假紀錄將不會反映在排行榜中。`},fitOnly:`Only .fit files can be uploaded.`}},u=()=>`en`,d=()=>{let e=u();return{t:l[e]||l.en,locale:e}},f=o();function p({activityId:e,isOpen:t,onClose:n,onCommentAdded:r}){let[i,a]=(0,c.useState)([]),[o,s]=(0,c.useState)(``),[l,u]=(0,c.useState)(!1),[d,p]=(0,c.useState)(!1),m=async()=>{u(!0);try{let t=await(await fetch(`/api/activities/${e}/comments`)).json();t.success&&a(t.data)}catch{}finally{u(!1)}};return(0,c.useEffect)(()=>(t?(m(),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.body.style.overflow=`unset`}),[t,e]),t?(0,f.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-end sm:items-center justify-center sm:p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-slate-900/60 backdrop-blur-sm transition-opacity`,onClick:n}),(0,f.jsxs)(`div`,{className:`relative w-full max-w-lg bg-white dark:bg-slate-900 rounded-t-[2.5rem] sm:rounded-[2rem] 
2shadow-2xl overflow-hidden flex flex-col h-[85vh] sm:h-auto sm:max-h-[80vh] animate-in slide-in-from-bottom sm:zoom-in-95 duration-300`,children:[(0,f.jsx)(`div`,{className:`sm:hidden flex justify-center py-3`,onClick:n,children:(0,f.jsx)(`div`,{className:`w-12 h-1.5 bg-slate-200 dark:bg-slate-800 rounded-full`})}),(0,f.jsxs)(`div`,{className:`px-6 py-4 sm:p-6 border-b border-slate-100 dark:border-slate-800 flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h2`,{className:`text-xl font-black text-slate-900 dark:text-white`,children:`Comments`}),(0,f.jsx)(`p`,{className:`text-xs text-slate-500 font-bold uppercase tracking-wider`,children:`Community Feedback`})]}),(0,f.jsxs)(`button`,{onClick:n,className:`flex items-center gap-2 px-4 py-2 rounded-xl bg-slate-50 dark:bg-slate-800 text-slate-500 hover:text-red-500 dark:hover:text-red-400 transition-all active:scale-95 border border-slate-100 dark:border-slate-700`,children:[(0,f.jsx)(`span`,{className:`text-xs font-black uppercase tracking-widest`,children:`CLOSE`}),(0,f.jsx)(`span`,{className:`text-lg font-bold`,children:`✕`})]})]}),(0,f.jsx)(`div`,{className:`flex-1 overflow-y-auto p-6 space-y-6 no-scrollbar`,children:l&&i.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-slate-400 gap-4`,children:[(0,f.jsx)(`div`,{className:`w-10 h-10 border-4 border-blue-600 border-t-transparent rounded-full animate-spin`}),(0,f.jsx)(`p`,{className:`text-sm font-bold tracking-tighter uppercase`,children:`Fetching conversations...`})]}):i.length===0?(0,f.jsxs)(`div`,{className:`text-center py-12`,children:[(0,f.jsx)(`div`,{className:`text-4xl mb-4`,children:`💬`}),(0,f.jsx)(`p`,{className:`text-slate-400 font-bold italic text-sm`,children:`No comments yet. Be the first to cheer!`})]}):i.map(e=>(0,f.jsxs)(`div`,{className:`flex gap-3 sm:gap-4 group`,children:[(0,f.jsx)(`div`,{className:`w-10 h-10 rounded-2xl shrink-0 flex items-center justify-center text-sm font-black shadow-lg
3                  ${e.authorType===`ai`?`bg-blue-600 text-white`:`bg-slate-100 dark:bg-slate-800 text-slate-500 dark:text-slate-300`}
4                `,children:e.authorType===`ai`?`AI`:(e.user?.username||`U`).charAt(0).toUpperCase()}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,f.jsx)(`span`,{className:`text-[10px] sm:text-xs font-black uppercase tracking-tighter truncate ${e.authorType===`ai`?`text-blue-600`:`text-slate-900 dark:text-slate-200`}`,children:e.authorType===`ai`?`AI COACH`:e.user?.username||`Anonymous`}),(0,f.jsx)(`span`,{className:`text-[9px] text-slate-400 font-bold shrink-0`,children:new Date(e.createdAt).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})]}),(0,f.jsx)(`div`,{className:`mt-1.5 p-3 sm:p-4 rounded-2xl text-xs sm:text-sm leading-relaxed font-bold
5                    ${e.authorType===`ai`?`bg-blue-50 dark:bg-blue-900/10 text-slate-700 dark:text-slate-200 border border-blue-100/50 dark:border-blue-900/20`:`bg-slate-50/50 dark:bg-slate-800/30 text-slate-600 dark:text-slate-400`}
6                  `,children:e.content})]})]},e.id))}),(0,f.jsxs)(`div`,{className:`p-4 sm:p-6 bg-slate-50 dark:bg-slate-950 border-t border-slate-100 dark:border-slate-800 pb-8 sm:pb-6`,children:[(0,f.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),!o.trim())return;let n=localStorage.getItem(`rr_user_id`);if(!n){alert(`Please upload a FIT file first to comment!`);return}p(!0);try{let t=await(await fetch(`/api/comments`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({activityId:e,userId:n,content:o.trim()})})).json();
6t.success?(s(``),m(),r&&r()):alert(t.error||`Failed to post comment`)}catch{}finally{p(!1)}},className:`relative`,children:[(0,f.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:`Cheer them on...`,className:`w-full bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-2xl pl-4 pr-20 py-4 text-sm font-bold focus:outline-none focus:ring-4 focus:ring-blue-500/10 focus:border-blue-500 transition-all dark:text-white`}),(0,f.jsx)(`button`,{type:`submit`,disabled:d||!o.trim(),className:`absolute right-2 top-2 bottom-2 bg-blue-600 text-white px-5 rounded-xl text-[10px] font-black hover:bg-blue-700 disabled:opacity-50 active:scale-95 transition-all shadow-lg shadow-blue-600/20 uppercase tracking-widest`,children:d?`...`:`SEND`})]}),(0,f.jsx)(`button`,{onClick:n,className:`w-full mt-4 py-3 bg-slate-100 dark:bg-slate-900 text-slate-500 dark:text-slate-400 rounded-2xl text-xs font-black uppercase tracking-widest hover:bg-slate-200 dark:hover:bg-slate-800 transition-all active:scale-[0.98] sm:hidden`,children:`Close Window`})]})]})]}):null}function m({routeData:e}){try{let t=typeof e==`string`?JSON.parse(e):e;if(!t||t.length<2)return null;let n=t.map(e=>e.position&&(e.position.lat!==void 0||e.position.lon!==void 0)?{lat:e.position.lat,lon:e.position.lon||e.position.long}:e.position_lat!==void 0&&e.position_long!==void 0?{lat:e.position_lat,lon:e.position_long}:null).filter(e=>e&&e.lat!=null&&e.lon!=null);if(n.length<2)return null;let r=n.map(e=>e.lat),i=n.map(e=>e.lon),a=Math.min(...r),o=Math.max(...r),s=Math.min(...i),c=Math.max(...i),l=(a+o)/2,u=Math.cos(l*Math.PI/180),d=o-a||1e-4,p=c-s||1e-4,m=d,h=p*u,g=Math.max(m,h),_=m/g*80,v=h/g*80,y=(80-v)/2+10,b=(80-_)/2+10,x=n.map(e=>{let t=(e.lon-s)/p*v+y,n=80-(e.lat-a)/d*_+b;return`${t.toFixed(2)},${n.toFixed(2)}`}).join(` `),S=(n[0].lon-s)/p*v+y,C=80-(n[0].lat-a)/d*_+b,w=(n[n.length-1].lon-s)/p*v+y,T=80-(n[n.length-1].lat-a)/d*_+b;return(0,f.jsxs)(`svg`,{viewBox:`0 0 100 100`,className:`w-full h-full p-8`,children:[(0,f.jsx)(`polyline`,{points:x,fill:`none`,stroke:`#3b82f6`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`drop-shadow-lg`}),(0,f.jsx)(`circle`,{cx:S,cy:C,r:`3`,fill:`#10b981`,stroke:`white`,strokeWidth:`1`}),(0,f.jsx)(`circle`,{cx:w,cy:T,r:`3`,fill:`#ef4444`,stroke:`white`,strokeWidth:`1`})]})}catch{return null}}function h({post:e,isMe:t}){let{t:n,locale:i}=d(),a=(0,c.useRef)(null),o=new Date(e.createdAt),l=o.toUTCString().replace(`GMT`,`UTC`),u=e.sportType!==`Swimming`&&e.sportType!==`Treadmill`,h=new Date,g=Date.UTC(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate()),_=Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()),v=Math.floor((g-_)/(1e3*60*60*24)),y=v>30,b=s(e=>e.triggerRefresh),x=async()=>{if(confirm(`Are you sure you want to delete this activity?`))try{let t=await fetch(`/api/activities/${e.id}?userId=${localStorage.getItem(`rr_user_id`)}`,{method:`DELETE`});if(t.ok)b();else{let e=await t.json();alert(e.error||`Delete failed`)}}catch{alert(`An error occurred`)}},[S,C]=(0,c.useState)(e.isLiked),[w,T]=(0,c.useState)(e.likesCount||0),[E,D]=(0,c.useState)(e.commentsCount||0),[O,k]=(0,c.useState)(!1),[A,j]=(0,c.useState)(!1),M=async t=>{t.preventDefault();let n=localStorage.getItem(`rr_user_id`);if(!n){alert(`Please upload a FIT file first to like!`);return}let r=!S;C(r),T(e=>r?e+1:e-1);try{(await(await fetch(`/api/kudos`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({activityId:e.id,userId:n})})).json()).success||(C(!r),T(e=>r?e-1:e+1))}catch{C(!r),T(e=>r?e-1:e+1)}},N=({className:t=``})=>(0,f.jsxs)(`div`,{className:t,children:[(0,f.jsxs)(`div`,{className:`flex gap-6`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-wider opacity-70`,children:n.distance}),(0,f.jsxs)(`div`,{className:`text-xl font-black`,children:[e.distance,`km`]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-wider opacity-70`,children:n.pace}),(0,f.jsxs)(`div`,{className:`text-xl font-black`,children:[e.avgPace,`/km`]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-wider opacity-70`,children:`Time`}),(0,f.jsxs)(`div`,{className:`text-xl font-black`,children:[Math.floor(e.duration/60),`m `,e.duration%60,`s`]})]})]}),(0,f.jsxs)(`div`,{className:`flex gap-4 mt-2 overflow-x-auto no-scrollbar`,children:[e.avgHr&&(0,f.jsxs)(`div`,{className:`flex items-center gap-1 bg-white/10 dark:bg-slate-700/50 px-2 py-1 rounded-md backdrop-blur-sm whitespace-nowrap border border-white/5 dark:border-slate-600/50`,children:[(0,f.jsx)(`span`,{className:`text-xs text-red-400`,children:`💓`}),(0,f.jsxs)(`span`,{className:`text-xs font-bold text-inherit`,children:[e.avgHr,` bpm`]})]}),e.avgCadence&&(0,f.jsxs)(`div`,{className:`flex items-center gap-1 bg-white/10 dark:bg-slate-700/50 px-2 py-1 rounded-md backdrop-blur-sm whitespace-nowrap border border-white/5 dark:border-slate-600/50`,children:[(0,f.jsx)(`span`,{className:`text-xs`,children:`🔄`}),(0,f.jsxs)(`span`,{className:`text-xs font-bold text-inherit`,children:[e.avgCadence,` rpm`]})]}),e.avgPower&&(0,f.jsxs)(`div`,{className:`flex items-center gap-1 bg-white/10 dark:bg-slate-700/50 px-2 py-1 rounded-md backdrop-blur-sm whitespace-nowrap border border-white/5 dark:border-slate-600/50`,children:[(0,f.jsx)(`span`,{className:`text-xs`,children:`⚡`}),(0,f.jsxs)(`span`,{className:`text-xs font-bold text-inherit`,children:[e.avgPower,`w`]})]})]})]});return(0,f.jsxs)(`article`,{ref:a,"data-card-id":e.id,className:`bg-white dark:bg-slate-800 rounded-3xl overflow-hidden shadow-xl border transition-all duration-300 
7        ${t?`ring-4 ring-blue-500 ring-offset-4 dark:ring-offset-slate-900 border-blue-500`:`shadow-slate-200/50 dark:shadow-none border-slate-100 dar
7k:border-slate-700`}
8        ${y?`opacity-40 blur-[0.5px]`:`opacity-100`}
9      `,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ring-2
10            ${t?`bg-blue-600 ring-blue-200 text-white`:`bg-slate-100 dark:bg-slate-700 ring-blue-50 dark:ring-slate-700 text-slate-500 dark:text-slate-300`}
11          `,children:(0,f.jsx)(`span`,{className:`text-sm font-bold`,children:(e.user.username||`U`).charAt(0).toUpperCase()})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,f.jsxs)(`div`,{className:`font-bold text-slate-900 dark:text-white leading-tight`,children:[e.user.username,` `,t&&(0,f.jsx)(`span`,{className:`text-[10px] bg-blue-100 text-blue-600 px-1.5 py-0.5 rounded ml-1`,children:`YOU`})]})}),(0,f.jsx)(`div`,{className:`text-[10px] text-slate-400 dark:text-slate-500 flex items-center gap-1.5 mt-0.5`,children:(0,f.jsx)(`span`,{children:l})})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,f.jsx)(`div`,{className:`bg-slate-50 dark:bg-slate-700 px-2.5 py-0.5 rounded-full text-[9px] font-bold text-slate-500 dark:text-slate-400 border border-slate-100 dark:border-slate-600`,children:n.sports[e.sportType]||e.sportType}),e.locationName&&(0,f.jsxs)(`div`,{className:`text-[9px] font-black text-blue-500 dark:text-blue-400 uppercase tracking-tighter bg-blue-50/50 dark:bg-blue-900/20 px-1.5 py-0.5 rounded border border-blue-100/50 dark:border-blue-900/30 flex items-center gap-1`,children:[(0,f.jsx)(`span`,{className:`text-[8px]`,children:`📍`}),` `,e.locationName]})]}),t&&(0,f.jsx)(`button`,{onClick:x,className:`p-1.5 text-slate-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-full transition-all active:scale-90 ml-1`,title:`Delete Activity`,children:(0,f.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`w-4 h-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2.5,d:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`})})}),(0,f.jsx)(`div`,{className:`text-2xl font-black italic tracking-tighter leading-none ${y?`text-red-500`:`text-blue-600`}`,children:v===0?`TODAY`:`${v} days`})]})]}),u?(0,f.jsxs)(`div`,{className:`aspect-square bg-slate-100 dark:bg-slate-900 relative overflow-hidden flex items-center justify-center`,children:[e.routeData?(0,f.jsx)(m,{routeData:e.routeData}):(0,f.jsx)(`img`,{src:e.r2ImagePath||`/map_placeholder.png`,alt:`activity map`,className:`w-full h-full object-cover opacity-50`}),(0,f.jsx)(N,{className:`absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/60 to-transparent p-6 pt-12 text-white`})]}):(0,f.jsx)(`div`,{className:`px-6 py-4 bg-slate-50 dark:bg-slate-900/50 border-y border-slate-100 dark:border-slate-700`,children:(0,f.jsx)(N,{className:`text-slate-900 dark:text-white`})}),(0,f.jsxs)(`div`,{className:`p-5`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-6 mb-4`,children:[(0,f.jsxs)(`button`,{onClick:M,className:`flex items-center gap-2 transition-all active:scale-90 ${S?`text-red-500`:`text-slate-500 hover:text-red-400`}`,children:[(0,f.jsx)(`span`,{className:`text-xl`,children:S?`❤️`:`👏`}),(0,f.jsx)(`span`,{className:`text-sm font-black`,children:w})]}),(0,f.jsxs)(`button`,{onClick:async()=>{let{triggerAd:e}=await r(async()=>{let{triggerAd:e}=await import(`./monetag-Bgb5Atzi.js`);return{triggerAd:e}},[]);e(),k(!0)},className:`flex items-center gap-2 transition-all active:scale-90 ${O?`text-blue-600`:`text-slate-500 hover:text-blue-500`}`,children:[(0,f.jsx)(`span`,{className:`text-xl`,children:`💬`}),(0,f.jsx)(`span`,{className:`text-sm font-black`,children:E})]}),(0,f.jsxs)(`button`,{disabled:A,onClick:async()=>{if(A)return;j(!0);let t=`🏆 RankingRun: ${e.user?.username||`Athlete`}'s ${e.sportType} Record!\n🔥 AI Score: ${e.aiScore}\n🏃 Distance: ${e.distance}km\n🚀 "${e.aiFeedback}"\n\nCheck it out here: https://rankingrun.cloudj.workers.dev`;try{try{await navigator.clipboard.writeText(t)}
11catch(e){console.error(`Clipboard fail`,e)}if(a.current){let{toBlob:n}=await r(async()=>{let{toBlob:e}=await import(`./es-D3pia4vj.js`);return{toBlob:e}},__vite__mapDeps([0,1]));a.current.classList.add(`is-capturing`);let i=await n(a.current,{cacheBust:!0,backgroundColor:document.documentElement.classList.contains(`dark`)?`#111827`:`#f8fafc`,fontEmbedCSS:``});if(a.current.classList.remove(`is-capturing`),!i){j(!1),alert(`Error: Generated image is empty.`);return}let o=new File([i],`rankingrun-${e.sportType}.png`,{type:`image/png`,lastModified:Date.now()});if(navigator.share&&navigator.canShare&&navigator.canShare({files:[o]}))try{await navigator.share({files:[o],title:`RankingRun Record`,text:t}),j(!1);return}catch(e){console.log(`Share cancelled or failed`,e)}let s=URL.createObjectURL(i),c=document.createElement(`a`);c.href=s,c.download=`rankingrun-${e.sportType}.png`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(s),alert(`Image downloaded & text copied! (Native sharing not supported)`),j(!1)}else j(!1),alert(`Error: Card element not found.`)}catch(e){console.error(`Share error`,e),j(!1),alert(`Share failed: ${e.message||`Unknown error`}`)}},className:`flex items-center gap-2 transition-all active:scale-90 ml-auto ${A?`text-green-500 animate-pulse`:`text-slate-500 hover:text-green-500`}`,title:`Share`,children:[(0,f.jsx)(`span`,{className:`text-xl`,children:A?`⌛`:`🔗`}),(0,f.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-tighter hidden sm:inline`,children:A?`Preparing...`:`Share`})]})]}),(0,f.jsxs)(`div`,{className:`bg-blue-50/50 dark:bg-blue-900/20 rounded-2xl p-4 border border-blue-100/50 dark:border-blue-900/30 relative overflow-hidden`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,f.jsx)(`span`,{className:`bg-blue-600 text-white text-[10px] font-black px-2 py-0.5 rounded italic`,children:`AI COACH`}),(0,f.jsx)(`div`,{className:`h-px flex-1 bg-blue-100 dark:bg-blue-800`}),(0,f.jsx)(`div`,{className:`text-blue-600 dark:text-blue-400 font-black text-lg`,children:e.aiScore})]}),(0,f.jsxs)(`p`,{className:`text-sm text-slate-700 dark:text-slate-200 leading-relaxed font-medium`,children:[`"`,e.aiFeedback,`"`]})]}
11),(0,f.jsxs)(`div`,{"data-watermark":!0,className:`hidden mt-12 pt-10 border-t-2 border-slate-100 dark:border-slate-800 flex-col items-center gap-6 w-full`,children:[(0,f.jsx)(`span`,{className:`text-[11px] font-black text-slate-400 dark:text-slate-500 uppercase tracking-[0.4em]`,children:`Join the Global Race`}),(0,f.jsx)(`div`,{className:`bg-slate-900 px-8 py-5 rounded-3xl border-2 border-yellow-400/70 shadow-2xl shadow-yellow-400/20 flex items-center justify-center`,children:(0,f.jsx)(`span`,{className:`text-[17px] font-black text-yellow-400 tracking-tighter italic whitespace-nowrap leading-none`,children:`https://rankingrun.cloudj.workers.dev`})}),(0,f.jsx)(`div`,{className:`text-[11px] font-black text-slate-400 dark:text-slate-600 uppercase tracking-widest mt-2`,children:`#RankingRun #AthleticRanking`})]}),(0,f.jsx)(p,{activityId:e.id,isOpen:O,onClose:()=>k(!1),onCommentAdded:()=>D(e=>e+1)})]})]})}function g({}){return[{title:`RankingRun - Global Leaderboard`},{name:`description`,content:`Compete with runners worldwide!`}]}var _=[{id:`Running`,label:`Running`,icon:`🏃‍♂️`},{id:`Walking`,label:`Walking`,icon:`🚶‍♂️`},{id:`Hiking`,label:`Hiking`,icon:`⛰️`},{id:`Swimming`,label:`Swimming`,icon:`🏊‍♂️`},{id:`Treadmill`,label:`Treadmill`,icon:`🏃`}],v=i(function(){let{t:e}=d(),[t,i]=(0,c.useState)(`Running`),[o,l]=(0,c.useState)([]),[u,p]=(0,c.useState)({}),[m,g]=(0,c.useState)(!1),[v,y]=(0,c.useState)(!1),[b,x]=(0,c.useState)(``),[S,C]=(0,c.useState)(null),w=n();(0,c.useEffect)(()=>{let e=localStorage.getItem(`rr_user_id`);e||(e=crypto.randomUUID(),localStorage.setItem(`rr_user_id`,e)),C(e);let t=localStorage.getItem(`rr_nickname`);t&&x(t)},[]);let T=e=>{let t=document.getElementById(`post-${e}`);t&&(t.scrollIntoView({behavior:`smooth`,block:`center`}),t.classList.add(`ring-4`,`ring-blue-500`,`ring-offset-8`,`rounded-3xl`),setTimeout(()=>{t.classList.remove(`ring-4`,`ring-blue-500`,`ring-offset-8`)},3e3))},E=async()=>{g(!0);try{let e=await fetch(`/api/ranking?sport=${t}`);if(!e.ok)throw Error(`Server Error: ${e.status}`);let n=await e.json();n.success&&l(n.data)}catch{l([])}finally{g(!1)}},D=async()=>{try{let e=await(await fetch(`/api/sport-counts`)).json();e.success&&p(e.data)}catch{}};(0,c.useEffect)(()=>{E(),D()},[t,w]);let O=s(e=>e.refreshTrigger);(0,c.useEffect)(()=>{O>0&&(E(),D())},[O]),(0,c.useEffect)(()=>{new URL(window.location.href).searchParams.get(`focus`)&&E()},[w]),(0,c.useEffect)(()=>{let e=new URL(window.location.href).searchParams.get(`focus`);if(e&&o.length>0){let t=setTimeout(()=>{T(e),window.history.replaceState({},``,`/`)},500);return()=>clearTimeout(t)}},[o]);let k=o.slice(0,3);o.slice(3);let[A,j]=(0,c.useState)(!1);return(0,f.jsxs)(`main`,{className:`container-custom py-12 min-h-screen`,children:[(0,f.jsxs)(`section`,{className:`text-center mb-12`,children:[(0,f.jsxs)(`h1`,{className:`text-4xl font-extrabold text-slate-900 dark:text-white tracking-tight mb-3`,children:[e.leaderboardTitle.split(` `)[0],` `,(0,f.jsx)(`span`,{className:`text-blue-600`,children:e.leaderboardTitle.split(` `).slice(1).join(` `)})]}),(0,f.jsx)(`p`,{className:`text-slate-500 font-medium`,children:e.leaderboardSub})]}),(0,f.jsx)(`div`,{className:`sticky top-16 z-40 bg-white/95 dark:bg-slate-900/95 backdrop-blur-md border-b border-slate-100 dark:border-slate-800 mb-8 -mx-4 px-4 py-3 transition-colors duration-300`,children:(0,f.jsx)(`div`,{className:`flex gap-2 sm:gap-3 overflow-x-auto no-scrollbar md:overflow-visible justify-start md:justify-center md:flex-wrap px-4 pb-1`,children:_.map(n=>(0,f.jsxs)(`button`,{onClick:()=>i(n.id),className:`flex items-center gap-1.5 sm:gap-2 px-4 sm:px-6 py-2 rounded-full text-xs sm:text-sm font-black transition-all whitespace-nowrap btn-active-scale
12                ${t===n.id?`bg-blue-600 text-white shadow-xl shadow-blue-500/20 dark:shadow-none scale-105`:`bg-slate-100 text-slate-500 hover:bg-slate-200 dark:bg-slate-800 dark:text-slate-400 dark:hover:bg-slate-700`}`,children:[(0,f.jsx)(`span`,{className:`text-sm sm:text-base`,children:n.icon}),(0,f.jsx)(`span`,{className:`uppercase tracking-tighter`,children:e.sports[n.id]}),(0,f.jsx)(`span`,{className:`ml-1 text-[10px] font-black px-1.5 py-0.5 rounded-md ${t===n.id?`bg-white/20 text-white`:`bg-slate-200 dark:bg-slate-700 text-slate-500 dark:text-slate-400`}`,children:u[n.id]||0})]},n.id))})}),m?(0,f.jsx)(`div`,{className:`flex justify-center py-20`,children:(0,f.jsx)(`div`,{className:`w-12 h-12 border-4 border-blue-600 border-t-transparent roun
12ded-full animate-spin`})}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:`flex flex-col md:grid md:grid-cols-3 gap-4 md:gap-6 mb-12 items-end`,children:k.map((e,t)=>{let n=t===0?`1ST`:t===1?`2ND`:`3RD`,r=e.userId===S;return(0,f.jsx)(`div`,{className:`w-full order-${t===0?`1 md:order-2`:t===1?`2 md:order-1`:`3 md:order-3`} cursor-pointer`,onClick:()=>T(e.id),children:(0,f.jsxs)(`div`,{className:`bg-white dark:bg-slate-800 p-4 md:p-6 rounded-3xl text-center relative pt-10 md:pt-12 hover:scale-[1.02] md:hover:scale-105 transition-all border-2 
13                    ${r?`border-blue-500 shadow-xl shadow-blue-100 dark:shadow-none`:`border-transparent shadow-sm`}`,children:[(0,f.jsx)(`div`,{className:`absolute -top-6 md:-top-8 left-1/2 -translate-x-1/2 w-12 h-12 md:w-16 md:h-16 rounded-2xl md:rounded-full border-4 border-white dark:border-slate-800 flex items-center justify-center shadow-md 
14                      ${r?`bg-blue-600 text-white`:`bg-slate-100 dark:bg-slate-700 text-slate-500`}`,children:(0,f.jsx)(`span`,{className:`text-lg md:text-xl font-black`,children:(e.user.username||`U`).charAt(0).toUpperCase()})}),t===0&&(0,f.jsx)(`div`,{className:`absolute top-2 right-2 text-2xl md:text-3xl`,children:`👑`}),(0,f.jsxs)(`div`,{className:`text-[10px] md:text-sm font-black text-slate-400 dark:text-slate-300 mb-1 tracking-tighter uppercase`,children:[n,` `,r&&`(YOU)`]}),(0,f.jsx)(`div`,{className:`text-base md:text-lg font-black text-slate-800 dark:text-white truncate`,children:e.user.username}),(0,f.jsxs)(`div`,{className:`text-blue-600 dark:text-blue-400 font-black text-xl md:text-2xl mt-1`,children:[e.aiScore,` `,(0,f.jsx)(`span`,{className:`text-[10px] md:text-xs font-bold opacity-60`,children:`SCORE`})]})]})},e.id)})}),(0,f.jsxs)(`div`,{className:`flex flex-col gap-8 mb-24`,children:[(0,f.jsxs)(`h2`,{className:`text-2xl font-black text-slate-800 dark:text-white px-4`,children:[e.topRanked.split(` `)[0],` `,(0,f.jsx)(`span`,{className:`text-blue-600`,children:e.topRanked.split(` `).slice(1).join(` `)})]}),o.map((e,t)=>(0,f.jsxs)(`div`,{id:`post-${e.id}`,className:`relative transition-all duration-500`,children:[(0,f.jsx)(`div`,{className:`absolute -left-3 -top-3 z-10 w-12 h-12 bg-gradient-to-br from-blue-600 to-indigo-600 text-white rounded-full flex items-center justify-center font-black text-xl shadow-lg border-4 border-white dark:border-slate-900`,children:t+1}),(0,f.jsx)(`div`,{className:`pl-4`,children:(0,f.jsx)(h,{post:e,isMe:e.userId===S})})]},e.id)),o.length===0&&(0,f.jsx)(`div`,{className:`py-20 text-center text-slate-400 font-medium italic`,children:e.noData})]})]}),(0,f.jsx)(`div`,{className:`fixed bottom-6 right-4 left-4 md:left-auto md:right-8 z-[60] flex flex-col items-stretch md:items-end gap-3 transition-all duration-300 ${A?`translate-y-0`:`md:translate-y-0`}`,children:v?(0,f.jsxs)(`div`,{className:`glass-mobile text-slate-900 dark:text-white px-6 py-4 rounded-3xl font-black shadow-2xl flex items-center gap-4 border-blue-500/30 w-full max-w-sm md:w-auto animate-pulse`,children:[(0,f.jsx)(`div`,{className:`w-6 h-6 border-4 border-blue-600 border-t-transparent rounded-full animate-spin`}),(0,f.jsx)(`span`,{className:`text-sm uppercase tracking-tighter`,children:e.analyzing})]}):(0,f.jsxs)(f.Fragment,{children:[A&&(0,f.jsxs)(`div`,{className:`flex flex-col gap-3 animate-in slide-in-from-bottom-10 duration-300`,children:[(0,f.jsx)(`input`,{type:`text`,placeholder:e.nicknamePlaceholder,value:b,onChange:e=>x(e.target.value),className:`px-5 py-4 rounded-2xl glass-mobile shadow-2xl focus:outline-none focus:ring-4 focus:ring-blue-500/20 text-sm w-full font-bold`}),(0,f.jsxs)(`div`,{className:`glass-mobile p-4 rounded-2xl shadow-2xl flex items-start gap-3 border-slate-200/50`,children:[(0,f.jsx)(`input`,{type:`checkbox`,id:`legal-consent`,className:`mt-1 w-5 h-5 rounded-lg border-slate-300 text-blue-600 focus:ring-4 focus:ring-blue-500/20 cursor-pointer`}),(0,f.jsxs)(`label`,{htmlFor:`legal-consent`,className:`text-[10px] leading-relaxed text-slate-500 dark:text-slate-400 font-black uppercase tracking-tight cursor-pointer`,children:[`Agree to`,(0,f.jsx)(a,{to:`/terms`,className:`text-blue-600 hover:underline`,children:` TOS`}),` &`,(0,f.jsx)(a,{to:`/privacy`,className:`text-blue-600 hover:underline`,children:` PRIVACY`}),`(Incl. Health Data)`]})]})]}),(0,f.jsx)(`div`,{className:`flex gap-2 w-full md:w-auto`,children:A?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`button`,{onClick:()=>
14j(!1),className:`bg-slate-100 dark:bg-slate-800 text-slate-500 px-6 py-5 rounded-3xl font-black shadow-xl btn-active-scale`,children:`✕`}),(0,f.jsxs)(`label`,{onClick:t=>{if(!b.trim()){t.preventDefault(),alert(e.nicknameRequired);return}if(!document.getElementById(`legal-consent`)?.checked){t.preventDefault(),alert(`Please agree to the Terms of Service and Privacy Policy to continue.`);return}},className:`flex-1 md:flex-none flex items-center justify-center gap-3 bg-blue-600 text-white px-10 py-5 rounded-3xl font-black shadow-2xl shadow-blue-600/40 btn-active-scale cursor-pointer`,children:[(0,f.jsx)(`span`,{className:`text-2xl`,children:`🔥`}),(0,f.jsx)(`span`,{className:`uppercase tracking-tighter`,children:e.analyze}),(0,f.jsx)(`input`,{type:`file`,accept:`.fit`,className:`hidden`,onClick:e=>{if(!b.trim()){e.preventDefault();return}e.target.value=null},onChange:async e=>{let n=e.target.files?.[0];if(!n)return;if(!n.name.toLowerCase().endsWith(`.fit`)){alert(`Only FIT files are allowed.`);return}let a=b.trim(),o=localStorage.getItem(`rr_user_id`);y(!0);try{let{parseFitFile:e}=await r(async()=>{let{parseFitFile:e}=await import(`./FileParser-1jfxrSNa.js`);return{parseFitFile:e}},[]),s=await e(n),c=s.sport||t,l=await(await fetch(`/api/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({parsedData:s,sportType:c,nickname:a,userId:o,r2ImagePath:``})})).json();if(l.success){localStorage.setItem(`rr_nickname`,a),i(c),await E();let{handleSubmissionComplete:e}=await r(async()=>{let{handleSubmissionComplete:e}=await import(`./monetag-Bgb5Atzi.js`);return{handleSubmissionComplete:e}},[]);e(l.activityId,w)}else alert(l.error||`Upload failed.`)}catch(e){alert(`An error occurred: ${e.message||`Please try again.`}`)}finally{y(!1)}}})]})]}):(0,f.jsxs)(`button`,{onClick:()=>j(!0),className:`flex-1 md:flex-none flex items-center justify-center gap-3 bg-blue-600 text-white px-8 py-5 rounded-3xl font-black shadow-2xl shadow-blue-600/40 btn-active-scale`,children:[(0,f.jsx)(`span`,{className:`text-2xl`,children:`⚡`}),(0,f.jsx)(`span`,{className:`uppercase tracking-tighter`,children:`New Activity`})]})})]})})]})});export{v as default,g as meta};

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.