1import{ab as T,y as N,cu as q,cv as ae,r as j,j as e,B as u,x as p,I as J,C as $,cw as re,cx as ne,bQ as oe,bR as le,bS as ie,bT as G,cy as de,p as R,L as M,aE as k,cz as ce,a as me,a8 as ue,cA as xe,cB as he,cC as pe,cD as ge,N as be,a1 as Q,bJ as fe,af as je,X as ye,P as Ne}from"./index-BSztYaZi.js";import{C as Y}from"./copy-Lh3nZHCu.js";import{R as ve}from"./refresh-cw-DXNU1kd7.js";import{U as we}from"./user-plus-Bb5K15lC.js";import{C as Ce,a as ke}from"./ClubPerks-DgLuxKL0.js";import{T as Me,a as Se,b as _,c as D}from"./tabs-xYAmU4EY.js";import{P as Te,A as Ae}from"./PostMeetupDialog-C5jNjJY2.js";import{h as $e}from"./heicToJpeg-BvTutbo1.js";import{m as _e}from"./avatarModeration.functions-Bl9Cb-wk.js";import{C as De}from"./camera-DpW3ZoeO.js";import{M as S}from"./MemberAvatar-DUvWFMC_.js";import{C as O}from"./ClubRoutePreviewMap-CEJgfr-u.js";import{m as K,C as Ie}from"./ShowOnRouteToggle-onflunfr.js";import{A as Re,a as Ue,b as Pe,c as Le,d as Ee,e as Be,g as ze,f as Fe}from"./alert-dialog-R_BqCCfK.js";import{E as Ge}from"./ellipsis-DVM3Sf8F.js";import{U as Oe}from"./user-round-COayq3xv.js";import{S as He}from"./shield-check-CcsB_1nA.js";import{R as We}from"./route-B2N5fHhh.js";import{A as V}from"./arrow-right-CzGP4T6o.js";import{P as qe}from"./pencil-B2mxxVrB.js";import{M as Je}from"./map-pinned-a1B-MC16.js";import{C as Qe}from"./calendar-days-BIYVOrHa.js";import{T as Ye}from"./trophy-B_16WlW4.js";import{M as Ke}from"./mountain-DJf8Oxyh.js";import"./strava.functions-D3tZ_4O9.js";import"./garmin.functions-yIegy3EM.js";import"./watch-BOxggAi5.js";import"./textarea-CUos0fnl.js";import"./label-CwDZaTN-.js";import"./switch-BgxGL2V5.js";import"./index-C1pMV_g7.js";import"./dialog-5jjcUS5d.js";import"./index-DniW_pNe.js";import"./gift-CldBub2v.js";import"./map-pin-CNkEmVDf.js";import"./trash-2-DXBSkZ7f.js";import"./lock-D0F06OiE.js";import"./gpxParser-EiBReaLT.js";import"./triangle-alert-DRGAxv1V.js";import"./DrawableMap-Bfo7_Rd9.js";/* empty css *//* empty css */import"./locate-fixed-B5QXhpzU.js";import"./createRoute-vFthse1L.js";import"./undo-2-BXmprGxY.js";import"./repeat-DvqQYkwy.js";import"./sparkles-BvtDwD0_.js";import"./avatar-EGp69fBz.js";import"./earth-Nc15Gac9.js";const Ve=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 14V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"bce9hv"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m16 20 2 2 4-4",key:"13tcca"}]],Xe=T("calendar-check-2",Ve);const Ze=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],es=T("globe",Ze);const ss=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],ts=T("message-circle",ss);const as=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],rs=T("user-minus",as);const ns=[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]],os=T("user-round-check",ns);function ls(a,r,o){const n=o?` 2 3Next run: ${o.title}, ${o.when}.`:"";return`Join ${a} on Skamper ð 4 5One place for our club routes and meet-ups. Tap "I'm in" so we know who's coming, and connect Strava or Garmin to get your turn-ups counted automatically.${n} 6 7Free, and it takes about a minute: 8${r}`}function is({clubId:a,clubName:r,inviteUrl:o,nextMeetup:n,onChanged:l}){const d=N(q),b=N(ae),[g,c]=j.useState(""),[m,i]=j.useState(!1),x=ls(r,o,n),y=async v=>{if(v.preventDefault(),!!g.trim()){i(!0);try{const f=await b({data:{clubId:a,email:g.trim()}});f.status==="no_account"?p.error("There's no Skamper account with that email. Send them the WhatsApp invite instead."):f.status==="already_member"?p.info("They're already a member."):(p.success(f.emailed?"Added. We've emailed them a link to the club.":"Added to the club."),c(""),l())}catch(f){p.error(f instanceof Error?f.message:"Couldn't add them")}finally{i(!1)}}};return e.jsxs("div",{className:"space-y-4 rounded-2xl border bg-card p-5 shadow-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-bold uppercase text-primary",children:"Invite runners"}),e.jsx("h3",{className:"mt-1 font-semibold",children:"Share in your WhatsApp group"}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["They'll get a ready-written message and a preview card for ",r,"."]})]}),e.jsx("pre",{className:"whitespace-pre-wrap rounded-xl bg-muted/50 p-3 font-sans text-xs text-muted-foreground",children:x}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(u,{asChild:!0,children:e.jsxs("a",{href:`https://wa.me/?text=${encodeURIComponent(x)}`,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(ts,{className:"mr-1.5 h-4 w-4"}),"Share on WhatsApp"]})}),e.jsxs(u,{variant:"outline",onClick:()=>{navigator.clipboard.writeText(x),p.success("Message copied")},children:[e.jsx(Y,{className:"mr-1.5 h-4 w-4"}),"Copy message"]}),e.jsxs(u,{variant:"ghost",onClick:async()=>{confirm("Make a new link? The old one will stop working.")&&(await d({data:{clubId:a}}),l(),p.success("New link made"))},children:[e.jsx(ve,{className:"mr-1.5 h-4 w-4"}),"Reset link"]})]}),e.jsxs("form",{onSubmit:y,className:"border-t pt-4",children:[e.jsx("label",{className:"text-sm font-medium",htmlFor:"add-member-email",children:"Already on Skamper? Add them by email"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx(J,{id:"add-member-email",type:"email",placeholder:"[email protected]",value:g,onChange:v=>c(v.target.value),maxLength:255}),e.jsxs(u,{type:"submit",disabled:m,children:[m?e.jsx($,{className:"h-4 w-4 animate-spin"}):e.jsx(we,{className:"mr-1.5 h-4 w-4"}),"Add"]})]}),e.jsx("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"We'll email them to say they've been added, with a link to the club."})]})]})}const H="https://skamper.com";function ds({clubName:a,inviteCode:r}){const[o,n]=j.useState("box"),l=`${H}/embed/club/${r}`,d=`${H}/clubs/join/${r}?utm_source=club_website&utm_medium=button`,b=`<iframe src="${l}" title="${a} meet-ups on Skamper" style="width:100%;max-width:640px;height:560px;border:0;" loading="lazy"></iframe>`,g=`<a href="${d}" target="_blank" rel="noopener" style="display:inline-block;background:#3b2fc9;color:#fff;font-weight:600;padding:12px 22px;border-radius:10px;text-decoration:none;font-family:sans-serif;">Join ${a} on Skamper</a>`,c=o==="box"?b:g,m=async()=>{await navigator.clipboard.writeText(c),p.success("Copied. Paste it into your website.")};return e.jsxs("div",{className:"rounded-2xl border bg-card p-5 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"grid h-8 w-8 place-items-center rounded-lg bg-primary/10 text-primary",children:e.jsx(es,{className:"h-4 w-4"})}),e.jsx("h3",{className:"font-semibold",children:"Put this on your club website"})]}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Show your next meet-ups on your own site. It updates by itself, and visitors can join in a couple of taps. Member names are never shown."}),e.jsx("div",{className:"mt-4 inline-flex rounded-full border bg-muted/40 p-1 text-sm",children:[["box","Meet-ups box"],["button","Join button"]].map(([i,x])=>e.jsx("button",{type:"button",onClick:()=>n(i),className:`rounded-full px-3 py-1 font-semibold ${o===i?"bg-background shadow-sm":"text-muted-foreground"}`,children:x},i))}),o==="box"&&e.jsx("iframe",{src:`/embed/club/${r}`,title:"Preview",className:"mt-4 h-[420px] w-full max-w-xl rounded-xl border",loading:"lazy"}),e.jsx("pre",{className:"mt-4 max-h-28 overflow-auto whitespace-pre-wrap break-all rounded-xl bg-muted p-3 text-xs",children:c}),e.jsxs(u,{className:"mt-3",onClick:m,children:[e.jsx(Y,{className:"mr-1.5 h-4 w-4"}),"Copy code"]}),e.jsxs("details",{className:"mt-4 text-sm",children:[e.jsx("summary",{className:"cursor-pointer font-semibold",children:"How to add it to WordPress"}),e.jsxs("ol",{className:"mt-2 list-decimal space-y-1 pl-5 text-muted-foreground",children:[e.jsx("li",{children:'Edit the page where you want it (for example your home or "Join us" page).'}),e.jsxs("li",{children:["If the page uses Elementor (most ThemeREX themes do), drag in the ",e.jsx("strong",{children:"HTML"})," widget. Otherwise add a ",e.jsx("strong",{children:"Custom HTML"})," block."]}),e.jsx("li",{children:"Paste the code and click Update."})]}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Resetting the invite link switches the box and button off. You'd then paste the new code."})]})]})}const cs=5*1024*1024;function ms({clubId:a,onSaved:r}){const o=j.useRef(null),[n,l]=j.useState(!1),d=N(re),b=N(ne),g=N(_e),c=async m=>{const i=await $e(m);if(!i.type.startsWith("image/"))return p.error("Please choose an image file.");if(i.size>cs)return p.error("Logo must be 5MB or smaller.");l(!0);try{const x=(i.name.split(".").pop()||"jpg").toLowerCase().replace(/[^a-z0-9]/g,""),y=await d({data:{clubId:a,extension:x||"jpg"}});if(!(await fetch(y.upload_url,{method:y.method,body:i,headers:i.type?{"Content-Type":i.type}:void 0})).ok)throw new Error("The logo could not be uploaded.");const f=await g({data:{imageUrl:y.public_url}});if(!f.ok)throw new Error(f.reason);await b({data:{clubId:a,logoUrl:y.public_url}}),p.success("Club logo updated"),r()}catch(x){p.error(x instanceof Error?x.message:"The logo could not be updated.")}finally{l(!1),o.current&&(o.current.value="")}};return e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:o,className:"hidden",type:"file",accept:"image/png,image/jpeg,image/webp,.heic,.heif",onChange:m=>m.target.files?.[0]&&c(m.target.files[0])}),e.jsx(u,{type:"button",size:"icon",variant:"outline",className:"absolute -bottom-2 -right-2 roun
8ded-full border-4 border-primary bg-club-pop text-foreground shadow-md hover:bg-club-pop/90",onClick:()=>o.current?.click(),disabled:n,"aria-label":"Change club logo",title:"Change club logo",children:n?e.jsx($,{className:"animate-spin"}):e.jsx(De,{})})]})}function us({name:a,role:r,disabledReason:o,onAction:n}){const[l,d]=j.useState(null),[b,g]=j.useState(!1),c=l==="make_organiser",m=l==="remove",i=c?"Make organiser":m?"Remove from club":"Change to member",x=o||(c?`${a} will be able to manage members, routes, invites and meet-ups.`:m?`${a} will lose access to this club's routes and meet-ups.`:`${a} will no longer be able to manage the club.`);return e.jsxs(e.Fragment,{children:[e.jsxs(oe,{children:[e.jsx(le,{asChild:!0,children:e.jsx(u,{type:"button",variant:"ghost",size:"icon",className:"h-11 w-11 shrink-0","aria-label":`Manage ${a}`,children:e.jsx(Ge,{className:"h-5 w-5"})})}),e.jsxs(ie,{align:"end",children:[e.jsxs(G,{disabled:!!o,onSelect:()=>d(r==="organiser"?"make_member":"make_organiser"),children:[r==="organiser"?e.jsx(Oe,{className:"mr-2 h-4 w-4"}):e.jsx(He,{className:"mr-2 h-4 w-4"}),r==="organiser"?"Change to member":"Make organiser"]}),e.jsx(de,{}),e.jsxs(G,{disabled:!!o,className:"text-destructive focus:text-destructive",onSelect:()=>d("remove"),children:[e.jsx(rs,{className:"mr-2 h-4 w-4"}),"Remove from club"]})]})]}),e.jsx(Re,{open:!!l,onOpenChange:y=>!y&&d(null),children:e.jsxs(Ue,{children:[e.jsxs(Pe,{children:[e.jsxs(Le,{children:[i,"?"]}),e.jsx(Ee,{children:x})]}),e.jsxs(Be,{children:[e.jsx(ze,{children:"Keep as they are"}),e.jsx(Fe,{disabled:b||!!o,onClick:async y=>{if(y.preventDefault(),!!l){g(!0);try{await n(l),d(null)}finally{g(!1)}}},children:i})]})]})})]})}function xs({meetups:a,achievements:r}){const o=[{label:"Meet-ups completed",value:r.completedMeetups,icon:Xe},{label:"Verified turn-ups",value:r.verifiedTurnUps,icon:os},{label:"Runners involved",value:r.runnersTurnedUp,icon:R}];return e.jsxs("section",{className:"border-t pt-8",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-bold uppercase text-primary",children:"Club history"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold",children:"Together so far"})]}),e.jsx("div",{className:"mt-4 grid grid-cols-3 overflow-hidden rounded-xl border bg-card shadow-sm",children:o.map(({label:n,value:l,icon:d},b)=>e.jsxs("div",{className:`min-w-0 px-3 py-4 text-center sm:px-5 ${b?"border-l":""}`,children:[e.jsx(d,{className:"mx-auto h-5 w-5 text-primary"}),e.jsx("div",{className:"mt-2 text-2xl font-bold tabular-nums sm:text-3xl",children:l}),e.jsx("div",{className:"mt-1 text-xs leading-tight text-muted-foreground",children:n})]},n))}),e.jsxs("div",{className:"mt-7 flex items-center justify-between gap-3",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Recent meet-ups"}),a.length>0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Most recent first"})]}),a.length===0?e.jsxs("div",{className:"mt-3 border-l-2 border-club-pop px-4 py-3",children:[e.jsx("p",{className:"font-semibold",children:"The story starts with the first run."}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Completed meet-ups and verified turn-ups will build the club's history here."})]}):e.jsx("ol",{className:"relative mt-4 space-y-3 before:absolute before:bottom-5 before:left-5 before:top-5 before:w-px before:bg-border",children:a.map(n=>{const l=new Date(n.startsAt),d=l.toLocaleDateString("en-GB",{month:"short"}).toUpperCase(),b=l.getDate(),g=l.toLocaleDateString("en-GB",{weekday:"long",day:"numeric",month:"long"});return e.jsxs("li",{className:"relative pl-12",children:[e.jsx("span",{className:"absolute left-[1.05rem] top-6 h-2.5 w-2.5 rounded-full bg-club-pop ring-4 ring-background","aria-hidden":"true"}),e.jsxs(M,{to:"/meetups/$id",params:{id:n.id},className:"group grid gap-3 rounded-xl border bg-card p-4 shadow-sm transition-colors hover:border-primary/30 sm:grid-cols-[3.5rem_minmax(0,1fr)_auto] sm:items-center",children:[e.jsxs("div",{className:"hidden rounded-lg bg-primary px-2 py-2 text-center text-primary-foreground sm:block",children:[e.jsx("div",{className:"text-[10px] font-semibold",children:d}),e.jsx("div",{className:"text-xl font-bold leading-none",children:b})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xs text-muted-foreground sm:hidden",children:g}),e.jsx("h4",{className:"mt-0.5 truncate font-semibold",children:K(n.title,n.startsAt)}),e.jsxs("p",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-sm text-muted-foreground",children:[e.jsx(We,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"truncate",children:n.routeTitle})]}),e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Hosted by ",n.hostName]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 sm:justify-end",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex -sp
8ace-x-2",children:n.attendees.slice(0,4).map(c=>e.jsx(S,{name:c.name,src:c.avatar,size:"sm"},c.userId))}),e.jsxs("span",{className:"ml-2 whitespace-nowrap text-xs font-semibold",children:[n.turnedUp," turned up"]})]}),e.jsx(V,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-1"})]})]})]},n.id)})})]})}function hs(a){const r=new Date(a);return{day:r.toLocaleDateString("en-GB",{weekday:"short"}).toUpperCase(),date:r.getDate(),time:r.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"}),full:r.toLocaleString("en-GB",{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})}}const W=a=>a?`${(a/1e3).toFixed(1)} km`:"";function mt(){const{slug:a}=ce.useParams(),{session:r,loading:o}=me(),n=ue(),l=N(xe),d=N(he),b=N(pe);N(q);const g=N(ge),[c,m]=j.useState(!1),[i,x]=j.useState(!1),[y,v]=j.useState(!1),[f,U]=j.useState(""),[P,L]=j.useState(!1),[A,X]=j.useState("month"),Z=["club",a,r?.user.id],{data:t,isLoading:ee}=be({queryKey:Z,queryFn:()=>l({data:{slug:a}}),enabled:!!r}),w=()=>n.invalidateQueries({queryKey:["club",a]});if(o||r&&ee)return e.jsx(I,{children:e.jsx($,{className:"h-5 w-5 animate-spin"})});if(!r)return e.jsx(I,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Sign in to see this club."}),e.jsx(u,{asChild:!0,children:e.jsx(M,{to:"/login",children:"Sign in"})})]})});if(!t)return e.jsx(I,{children:"Club not found."});const E=(A==="all"?t.tableAll:t.table)??[],C=t.role==="organiser"||t.isStaff,B=!!t.role||t.isStaff,z=t.inviteCode?`${typeof window<"u"?window.location.origin:"https://skamper.com"}/clubs/join/${t.inviteCode}`:null,se=()=>{U(t.name),v(!0)},te=async()=>{const s=f.trim();if(s.length<2||s===t.name){v(!1);return}L(!0);try{await g({data:{clubId:t.id,name:s}}),await w(),v(!1),p.success("Club name updated")}catch(h){p.error(h instanceof Error?h.message:"Could not update the club name")}finally{L(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(Q,{}),e.jsxs("main",{className:"pb-28",children:[e.jsxs("section",{className:"relative overflow-hidden border-b bg-primary text-primary-foreground",children:[e.jsx("div",{className:"absolute inset-y-0 right-0 w-1/3 bg-club-pop opacity-10 [clip-path:polygon(35%_0,100%_0,100%_100%,0_100%)]"}),e.jsx("div",{className:"relative mx-auto max-w-6xl px-4 py-8 md:px-6 md:py-12",children:e.jsxs("div",{className:"flex items-start gap-5 md:gap-7",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx(fe,{name:t.name,logo:t.logoUrl,size:88,onPrimary:!0}),e.jsx("span",{className:"absolute -bottom-1 -left-1 h-5 w-5 rounded-full border-4 border-primary bg-club-pop","aria-hidden":"true"}),C&&e.jsx(ms,{clubId:t.id,onSaved:w})]}),e.jsxs("div",{className:"min-w-0 flex-1 pt-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[y?e.jsxs("form",{className:"flex min-w-0 flex-1 items-center gap-2",onSubmit:s=>{s.preventDefault(),te()},children:[e.jsx(J,{autoFocus:!0,value:f,onChange:s=>U(s.target.value),maxLength:80,"aria-label":"Club name",className:"h-11 max-w-md border-primary-foreground/30 bg-primary-foreground text-xl font-bold text-foreground md:text-2xl"}),e.jsx(u,{type:"submit",size:"icon",variant:"secondary",disabled:P||f.trim().length<2,"aria-label":"Save club name",title:"Save club name",children:P?e.jsx($,{className:"h-4 w-4 animate-spin"}):e.jsx(je,{className:"h-4 w-4"})}),e.jsx(u,{type:"button",size:"icon",variant:"ghost",className:"text-primary-foreground hover:bg-primary-foreground/10 hover:text-primary-foreground",onClick:()=>v(!1),"aria-label":"Cancel renaming",title:"Cancel",children:e.jsx(ye,{className:"h-4 w-4"})})]}):e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("h1",{className:"truncate text-3xl font-bold leading-tight md:text-4xl",children:t.name}),C&&e.jsx(u,{type:"button",size:"icon",variant:"ghost",className:"shrink-0 text-primary-foreground/80 hover:bg-primary-foreground/10 hover:text-primary-foreground",onClick:se,"aria-label":"Rename club",title:"Rename club",children:e.jsx(qe,{className:"h-4 w-4"})})]}
8),e.jsx(k,{className:"border-primary-foreground/20 bg-primary-foreground/10 text-primary-foreground hover:bg-primary-foreground/10",children:"Active club"})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-sm text-primary-foreground/75",children:[t.areas.length>0&&e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(Je,{className:"h-4 w-4 text-club-pop"}),t.areas.join(" · ")]}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-semibold text-primary-foreground",children:[e.jsx(R,{className:"h-4 w-4 text-club-pop"}),t.memberCount," member",t.memberCount===1?"":"s"]})]}),t.description&&e.jsx("p",{className:"mt-3 max-w-xl text-sm leading-relaxed text-primary-foreground/80",children:t.description})]})]})})]}),e.jsxs("div",{className:"mx-auto max-w-6xl px-4 pt-6 md:px-6 md:pt-8",children:[B?e.jsxs(e.Fragment,{children:[e.jsx(Ce,{className:"mb-6"}),e.jsxs(Me,{defaultValue:"meetups",children:[e.jsxs(Se,{className:"grid h-12 w-full grid-cols-3 rounded-2xl bg-muted/70 p-1.5",children:[e.jsx(_,{value:"meetups",className:"rounded-xl font-semibold data-[state=active]:shadow-sm",children:"Meet-ups"}),e.jsxs(_,{value:"routes",className:"rounded-xl font-semibold data-[state=active]:shadow-sm",children:["Routes ",e.jsx("span",{className:"ml-1 text-xs opacity-60",children:t.routes.length})]}),e.jsx(_,{value:"members",className:"rounded-xl font-semibold data-[state=active]:shadow-sm",children:"Members"})]}),e.jsxs(D,{value:"meetups",className:"mt-8 space-y-10",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-bold uppercase text-primary",children:"Run together"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold",children:"Next meet-ups"})]}),e.jsxs(u,{className:"rounded-xl shadow-md",onClick:()=>m(!0),children:[e.jsx(Ie,{className:"mr-1.5 h-4 w-4"}),"Post one"]})]}),t.meetups.length===0?e.jsxs("button",{type:"button",onClick:()=>m(!0),className:"group -mt-5 flex w-full flex-col items-center rounded-2xl border-2 border-dashed bg-card px-6 py-10 text-center transition-colors hover:border-primary/40 hover:bg-muted/30",children:[e.jsx("span",{className:"flex h-12 w-12 items-center justify-center rounded-xl bg-muted text-muted-foreground transition-colors group-hover:bg-primary/10 group-hover:text-primary",children:e.jsx(Qe,{className:"h-6 w-6"})}),e.jsx("span",{className:"mt-4 font-semibold",children:"Nothing planned yet"}),e.jsx("span",{className:"mt-1 text-sm text-muted-foreground",children:"Running tomorrow? Post it and see who's in."})]}):e.jsx("ul",{className:"grid gap-4 lg:grid-cols-2",children:t.meetups.map(s=>{const h=hs(s.startsAt);return e.jsx("li",{children:e.jsxs(M,{to:"/meetups/$id",params:{id:s.id},className:"group grid min-h-64 overflow-hidden rounded-2xl border bg-card shadow-sm transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-elevated sm:grid-cols-[1.1fr_1fr]",children:[e.jsx(O,{gpxUrl:s.gpxUrl,lat:s.lat,lng:s.lng,className:"min-h-40 sm:min-h-full"}),e.jsxs("div",{className:"flex min-w-0 flex-col p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"rounded-xl bg-primary px-3 py-2 text-center text-primary-foreground",children:[e.jsx("div",{className:"text-[10px] font-semibold",children:h.day}),e.jsx("div",{className:"text-xl font-bold leading-none",children:h.date})]}),s.myStatus==="going"?e.jsx(k,{children:"You're in"}):e.jsx(V,{className:"h-5 w-5 text-muted-foreground transition-transform group-hover:translate-x-1"})]}),e.jsx("h3",{className:"mt-5 text-xl font-semibold",children:K(s.title,s.startsAt)}),e.jsx("p",{className:"mt-1 truncate text-sm font-medium text-foreground/75",children:s.routeTitle}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:[h.time,W(s.distanceM),s.pace].filter(Boolean).join(" · ")}),e.jsxs("div",{className:"mt-auto flex items-center justify-between gap-3 pt-5 text-xs",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(S,{name:s.hostName,src:s.hostAvatar,size:"sm"}),e.jsxs("span",{className:"truncate",children:["by ",s.hostName]})]}),e.jsxs("span",{className:"shrink-0 font-semibold",children:[s.going," going"]})]})]})]})},s.id)})}),e.jsx(ke,{clubId:t.id,clubName:t.name,clubLogo:t.logoUrl,userId:r.user.id,userName:t.members.find(s=>s.userId===r.user.id)?.name??"Member"}),e.jsx(xs,{meetups:t.pastMeetups??[],achievements:t.achievements??{completedMeetups:0,verifiedTurnUps:0,runnersTurnedUp:0}}),e.jsxs("div",{className:"grid gap-6 border-t pt-8 lg:grid-cols-[minmax(0,1.2fr)_minmax(18rem,.8fr)]",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"flex items-center gap-2 text-xl font-semibold",children:[e.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-club-pop/25",children:e.jsx(Ye,{className:"h-4 w-4 text-foreground"})}),"Turn-up table"]}),e.jsx("div",{className:"mt-3 inline-flex rounded-full border bg-muted/40 p-1 text-sm",role:"tablist","aria-label":"Table period",children:[["month","This month"],["all","All time"]].map(([s,h])=>e.jsx("button",{type:"button",role:"tab","aria-selected":A===s,onClick:()=>X(s),className:`rounded-full px-3 py-1 font-semibold transition-colors ${A===s?"bg-background text-foreground shadow-sm":"text-muted-foreground"}`,children:h},s))}),e.jsx("p",{className:"mt-2 max-w-lg text-sm text-muted-foreground",children:"Verified runs at meet-ups via Garmin or Strava. The percentage shows how often someone who said yes actually ran."}),E.length===0?e.jsxs("div",{className:"mt-5 rounded-2xl border bg-muted/40 px-6 py-8 text-center",children:[e.jsx("div",{className:"text-4xl font-bold text-muted-foreground
8/30",children:"0%"}),e.jsx("p",{className:"mt-2 text-sm font-medium text-muted-foreground",children:A==="month"?"No verified turn-ups yet this month.":"No verified turn-ups yet."})]}):e.jsx("ol",{className:"mt-2 divide-y rounded-xl border",children:E.map((s,h)=>e.jsxs("li",{className:`flex items-center gap-3 px-3 py-2 text-sm ${s.isMe?"bg-primary/5 font-semibold":""}`,children:[e.jsx("span",{className:"w-5 text-muted-foreground",children:h+1}),e.jsx(S,{name:s.isMe?"You":s.name,src:s.avatar,size:"sm"}),e.jsx("span",{className:"flex-1 truncate",children:s.isMe?"You":s.name}),e.jsxs("span",{children:[s.ran," run",s.ran===1?"":"s"]}),e.jsxs("span",{className:"w-12 text-right text-muted-foreground",children:[s.followThrough,"%"]})]},s.userId))})]}),e.jsxs("aside",{className:"rounded-2xl bg-primary p-6 text-primary-foreground shadow-elegant",children:[e.jsx("span",{className:"grid h-11 w-11 place-items-center rounded-xl bg-club-pop text-foreground",children:e.jsx(Ke,{className:"h-5 w-5"})}),e.jsx("h3",{className:"mt-5 text-xl font-semibold",children:"Made for showing up"}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-primary-foreground/75",children:"Meet-ups stay informal. Garmin or Strava verifies the run, so the table celebrates the people who actually made it out."}),e.jsx("div",{className:"mt-6 flex -space-x-2",children:t.members.slice(0,5).map(s=>e.jsx(S,{name:s.name,src:s.avatar},s.userId))})]})]})]}),e.jsxs(D,{value:"routes",className:"mt-8 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Members only · not part of Skamper's curated guide."}),C&&e.jsxs(u,{size:"sm",variant:"outline",onClick:()=>x(!0),children:[e.jsx(Ne,{className:"mr-1 h-4 w-4"}),"Add routes"]})]}),t.routes.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No club routes yet."}):e.jsx("ul",{className:"grid gap-4 sm:grid-cols-2",children:t.routes.map(s=>e.jsx("li",{children:e.jsxs(M,{to:"/clubs/$slug/routes/$routeSlug",params:{slug:a,routeSlug:s.slug},className:"group block overflow-hidden rounded-2xl border bg-card shadow-sm transition-all hover:-translate-y-0.5 hover:shadow-md",children:[e.jsx(O,{gpxUrl:s.gpxUrl,lat:s.lat,lng:s.lng,className:"h-40"}),e.jsxs("div",{className:"flex items-start gap-3 p-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-medium",children:s.title}),e.jsx("div",{className:"text-xs text-muted-foreground",children:[W(s.distanceM),s.ascent?`${Math.round(s.ascent)} m climb`:"",s.locationName].filter(Boolean).join(" · ")})]}),e.jsx(ps,{status:s.status})]})]})},s.id))})]}),e.jsxs(D,{value:"members",className:"mt-8 space-y-4",children:[z&&e.jsx(is,{clubId:t.id,clubName:t.name,inviteUrl:z,nextMeetup:t.meetups[0]?{title:t.meetups[0].title||t.meetups[0].routeTitle,when:new Date(t.meetups[0].startsAt).toLocaleString("en-GB",{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})}:null,onChanged:w}),C&&t.inviteCode&&e.jsx(ds,{clubName:t.name,inviteCode:t.inviteCode}),e.jsx("ul",{className:"divide-y overflow-hidden rounded-2xl border bg-card shadow-sm",children:t.members.map(s=>e.jsxs("li",{className:"flex items-center gap-3 px-3 py-2 text-sm",children:[e.jsx(S,{name:s.name,src:s.avatar}),e.jsx("span",{className:"flex-1 truncate",children:s.name}),s.role==="organiser"&&e.jsx(k,{variant:"secondary",children:"Organiser"}),C&&s.userId!==r.user.id&&e.jsx(us,{name:s.name,role:s.role,disabledReason:s.role==="organiser"&&t.members.filter(h=>h.role==="organiser").length===1?"Make someone else an organiser first. Every club needs at least one organiser.":null,onAction:async h=>{try{await b({data:{clubId:t.id,userId:s.userId,action:h}}),p.success(h==="remove"?`${s.name} removed`:`${s.name}'s role updated`),w()}catch(F){p.error(F instanceof Error?F.message:"Couldn't update this member")}}})]},s.userId))}),t.role&&e.jsx(u,{variant:"ghost",size:"sm",className:"text-muted-foreground",onClick:async()=>{confirm("Leave this club?")&&(await d({data:{clubId:t.id}}),n.invalidateQueries({queryKey:["clubs"]}),w())},children:"Leave club"})]})]})]}):e.jsxs("div",{className:"rounded-2xl border bg-card p-6 text-center shadow-sm",children:[e.jsx(R,{className:"mx-auto h-7 w-7 text-primary"}),e.jsx("h2",{className:"mt-3 text-lg font-semibold",children:"This is a members-only club"}),e.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:"Ask an organiser for the invite link to see the routes, meet-ups and members."}),e.jsxs("div",{className:"mt-5 flex flex-wrap justify-center gap-2",children:[e.jsx(u,{asChild:!0,children:e.jsx(M,{to:"/clubs",children:"My clubs"})}),e.jsx(u,{asChild:!0,variant:"outline",children:e.jsx(M,{to:"/runs/explore",children:"Explore Skamper routes"})})]})]}),B&&e.jsx(Te,{open:c,onOpenChange:m,clubId:t.id,canAddRoutes:C,onRoutesChanged:w}),C&&e.jsx(Ae,{open:i,onOpenChange:x,clubId:t.id,onAdded:w})]})]})]})}function ps({status:a}){return a==="curated"?e.jsx(k,{children:"In the Skamper guide"}):a==="nominated"?e.jsx(k,{variant:"secondary",children:"Nominated"}):a==="not_accepted"?e.jsx(k,{variant:"outline",children:"Not accepted"}):e.jsx(k,{variant:"outline",children:"Club route"})}function I({children:a}){return e.jsxs(e.Fragment,{children:[e.jsx(Q,{}),e.jsx("main",{className:"flex min-h-[60vh] items-center justify-center px-4 text-sm text-muted-foreground",children:a})]})}export{ps as RouteStatus,mt as component,hs as fmtWhen};
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.