1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Do2d937u.js","assets/mapbox-Dsi-_OTH.js","assets/index-BLn5qNRQ.css"])))=>i.map(i=>d[i]); 2import{c as le,u as oe,bv as kt,b as U,j as t,dh as be,q as Z,bo as ae,bx as ne,r as fl,e8 as qt,al as Ze,O as qe,hC as xl,am as ze,cL as An,b3 as pl,n as X,hD as bl,hE as hl,hF as ms,hG as Ht,hH as gl,hI as _s,hJ as vl,hK as as,hL as fs,hM as Qs,hN as Xs,hO as yl,hP as Zs,hQ as Js,ge as jl,hR as en,hS as Nl,hT as tn,hU as Sl,G as pt,hV as kl,hW as wl,l as ge,aJ as Cl,hX as Pl,cT as El,fo as Dn,hY as Ms,hZ as _l,hn as xs,hm as Rn,ak as Ml,fF as Qt,H as Et,h_ as Ll,eC as Fn,h3 as Il,cY as Mt,h$ as Tl,i0 as Ls,ee as Ks,i1 as sn,i2 as Al,i3 as Dl,i4 as Rl,i5 as Fl,t as On,e9 as Ol,i6 as Bl,i7 as Vl,g as Ul,i8 as Bn,N as $l,h4 as Vn,i9 as Kl,ia as zl,ib as ql,ic as Gl,id as Hl,ie as Is,ig as Wl,ih as Yl,ii as Ql,ij as Xl,ik as Zl,il as Jl,im as er,io as tr,ip as Ts,iq as sr,ir as nr,hl as lr,is as rr,it as Un,iu as ir,iv as ar,iw as nn,ix as ln,iy as rn,iz as or,iA as an,iB as on,ev as ps,iC as $n,gz as Kn,gA as zn,iD as cr,iE as dr,hi as ur,hh as mr,iF as qn,f$ as cn,iG as dn,iH as un,iI as fr,fj as bs,fh as hs,bA as Gn,iJ as zs,iK as xr,iL as pr,iM as br,iN as hr,iO as gr,fD as mn,fE as vr,fK as yr,bV as jr,ad as Lt,aH as Hn,bU as Nr,bR as Xt,gQ as fn,hz as Sr,gs as kr,gq as xn,eB as wr,iP as Cr,ha as Pr,cg as Er,dD as _r,ax as Mr,eq as Lr,o as Wn,iQ as Ir,iR as As,iS as Yn,iT as qs,iU as gs,iV as Tr,iW as Ar,iX as Dr,ck as Rr,cf as Fr,iY as vs,gT as Or,Y as Qn,dc as Br,iZ as Vr,i_ as Xn,i$ as Zn,j0 as Ur,j1 as $r,j2 as Kr,cl as pn,j3 as zr,j4 as qr,j5 as Gr,j6 as Hr,j7 as Wr,j8 as Yr,bX as Qr,j9 as Xr,ja as Zr,jb as Jr,jc as ei,jd as ti}from"./index-Do2d937u.js";import{R as si,S as Jn,d as zt,m as Ds,D as ni,p as bn,f as li,i as ri,T as ii,V as ai,a as oi,A as ci,P as di,b as ui,u as mi,c as fi,g as xi}from"./useGpxUpload-DC0uEnjo.js";import{P as we}from"./ProfileSubScreenHeader-JEIqoIal.js";import{C as el}from"./clubName-B8pbLcQz.js";import{P as pi}from"./PhoneInput-DZuJDIdT.js";import{v as hn,g as gn,R as bi,L as Us,u as hi,F as gi}from"./useIdentityVerification-D5_KJzIY.js";import{g as Gs}from"./geocode-CBG2NOrV.js";import{g as vi,b as yi,a as ji,u as Ni}from"./useMyOrganizerEvents-BYOO8Jnq.js";import{u as Si}from"./useOrganizerStripeAccount-Du7FrqWA.js";import{e as os,M as vn,a as tl,s as ki}from"./sportMoments-DOiPIfSt.js";import{a as wi,b as Ci,T as Pi}from"./TennisLevelIcon-CuxhhgH1.js";import{u as sl,C as Ei}from"./useSportHasCentres-Bc6y4qO1.js";import{B as nl}from"./badge-DTCWZX-G.js";import{S as _i}from"./SectionTabs-CeamVeXV.js";import{b as Mi,f as Hs,i as $s}from"./shopCatalog-CIrfiWJr.js";import{u as Li}from"./usePointsBalance-DI5n9Efn.js";import{u as Ii,a as Ti,M as Ai}from"./MyWeeklySortieScreen-ByBYnuD2.js";import{a as Di}from"./usePartnerEvents-FxS2eDeL.js";import{D as Ri}from"./DelegationFields-BJajKUO7.js";import{l as Fi,L as yn}from"./LegalScreen-DeJDbQOS.js";import{P as Oi}from"./PhoneIcon-DXcVIHCn.js";import{u as Bi,S as Vi}from"./useSportRemovalFlow-COIlR5AX.js";import{S as cs}from"./SectionTitle-D6-CmD1g.js";import{u as Ui}from"./useMyRecurringSlots-BPNlBv_P.js";import{u as $i}from"./useUserClubs-Bl_BH6Y2.js";import"./mapbox-Dsi-_OTH.js";import"./clubPermissions-B6E1T8pP.js";import"./index.esm-yxmPMiUw.js";import"./clubRecurringEventsRepo-CKaHipXN.js";import"./nativeCameraPermission-DQqZ6uW0.js";import"./useFavoriteTerrains-L8N-h6Ol.js";import"./ClubEventCard-jmatmRq0.js";import"./useSocialClubs-DUoaTUOX.js";import"./CreateClubForm-QuOK_2f0.js";import"./recurringSlotsRepo-DJkMNcsG.js";function Ki(a){const e=le.c(55),{onBack:n}=a,{t:l}=oe(),{updatePassword:s}=kt();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={newPassword:"",confirmPassword:""},e[0]=r):r=e[0];const[i,c]=U.useState(r),[x,m]=U.useState(!1);let o;e[1]!==i.confirmPassword||e[2]!==i.newPassword||e[3]!==n||e[4]!==l||e[5]!==s?(o=async()=>{if(i.newPassword.length<6){Z.error(l("profileSub.passwordMin"));return}if(i.newPassword!==i.confirmPassword){Z.error(l("profileSub.passwordMismatch"));return}m(!0);const{error:F}=await s(i.newPassword);if(m(!1),F){const O=F.message==="New password should be different from the old password."?l("profileSub.passwordSameAsOld"):F.message;Z.error(O)}else Z.success(l("profileSub.passwordChanged")),c({newPassword:"",confirmPassword:""}),n()},e[1]=i.confirmPassword,e[2]=i.newPassword,e[3]=n,e[4]=l,e[5]=s,e[6]=o):o=e[6];const d=o;let v;e[7]!==l?(v=l("profileSub.changePassword"),e[7]=l,e[8]=v):v=e[8];let u;e[9]!==l?(u=l("profileSub.newPasswordSubtitle"),e[9]=l,e[10]=u):u=e[10];let p;e[11]!==n?(p=()=>{c({newPassword:"",confirmPassword:""}),n()},e[11]=n,e[12]=p):p=e[12];let f;
2e[13]!==v||e[14]!==u||e[15]!==p?(f=t.jsx(we,{title:v,subtitle:u,onBack:p}),e[13]=v,e[14]=u,e[15]=p,e[16]=f):f=e[16];let b;e[17]!==l?(b=l("profileSub.newPassword"),e[17]=l,e[18]=b):b=e[18];let j;e[19]!==b?(j=t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:b}),e[19]=b,e[20]=j):j=e[20];let h;e[21]!==i?(h=F=>c({...i,newPassword:F.target.value}),e[21]=i,e[22]=h):h=e[22];let y;e[23]!==i.newPassword||e[24]!==h?(y=t.jsx(be,{type:"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:i.newPassword,onChange:h,minLength:6}),e[23]=i.newPassword,e[24]=h,e[25]=y):y=e[25];let w;e[26]!==y||e[27]!==j?(w=t.jsxs("div",{children:[j,y]}),e[26]=y,e[27]=j,e[28]=w):w=e[28];let P;e[29]!==l?(P=l("profileSub.confirmPassword"),e[29]=l,e[30]=P):P=e[30];let L;e[31]!==P?(L=t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:P}),e[31]=P,e[32]=L):L=e[32];let g;e[33]!==i?(g=F=>c({...i,confirmPassword:F.target.value}),e[33]=i,e[34]=g):g=e[34];let I;e[35]!==i.confirmPassword||e[36]!==g?(I=t.jsx(be,{type:"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:i.confirmPassword,onChange:g,minLength:6}),e[35]=i.confirmPassword,e[36]=g,e[37]=I):I=e[37];let S;e[38]!==L||e[39]!==I?(S=t.jsxs("div",{children:[L,I]}),e[38]=L,e[39]=I,e[40]=S):S=e[40];const B=x||!i.newPassword||!i.confirmPassword;let D;e[41]!==x||e[42]!==l?(D=l(x?"profileSub.changingPassword":"profileSub.changePasswordBtn"),e[41]=x,e[42]=l,e[43]=D):D=e[43];let M;e[44]!==d||e[45]!==B||e[46]!==D?(M=t.jsx(ae,{className:"w-full mt-2",onClick:d,disabled:B,children:D}),e[44]=d,e[45]=B,e[46]=D,e[47]=M):M=e[47];let R;e[48]!==w||e[49]!==S||e[50]!==M?(R=t.jsx("div",{className:"px-4",children:t.jsx(ne,{className:"p-5",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[w,S,M]})})}),e[48]=w,e[49]=S,e[50]=M,e[51]=R):R=e[51];let T;return e[52]!==R||e[53]!==f?(T=t.jsxs("div",{className:"flex-1 overflow-y-auto pb-4",children:[f,R]}),e[52]=R,e[53]=f,e[54]=T):T=e[54],T}const zi=fl("NativeNotificationSettings");async function qi(){if(!qt.isNativePlatform())return!1;try{return await zi.open(),!0}catch{return!1}}const Gi={padel:"padelAlertsEnabled",tennis:"tennisAlertsEnabled",running:"runningAlertsEnabled",foot5:"foot5AlertsEnabled",hiking:"hikingAlertsEnabled",velo:"veloAlertsEnabled",fitness:"fitnessAlertsEnabled"},jn={padel:"padelLiveAlertsEnabled",tennis:"tennisLiveAlertsEnabled",running:"runningLiveAlertsEnabled",foot5:"foot5LiveAlertsEnabled",hiking:"hikingLiveAlertsEnabled",velo:"veloLiveAlertsEnabled",fitness:"fitnessLiveAlertsEnabled"};function ys(a){const e=le.c(10),{enabled:n,onChange:l}=a,s=n?"bg-primary":"bg-secondary";let r;e[0]!==s?(r=X("w-12 h-7 rounded-full transition-colors relative shrink-0",s),e[0]=s,e[1]=r):r=e[1];const i=n?"translate-x-6":"translate-x-1";let c;e[2]!==i?(c=X("absolute top-1 w-5 h-5 rounded-full bg-white transition-transform",i),e[2]=i,e[3]=c):c=e[3];let x;e[4]!==c?(x=t.jsx("div",{className:c}),e[4]=c,e[5]=x):x=e[5];let m;return e[6]!==l||e[7]!==r||e[8]!==x?(m=t.jsx("button",{className:r,onClick:l,children:x}),e[6]=l,e[7]=r,e[8]=x,e[9]=m):m=e[9],m}const js="flex w-14 items-center justify-center shrink-0";function Hi(a,e){const n=new Set([...Object.keys(a),...Object.keys(e)]);for(const l of n){const s=a[l],r=e[l];if(Array.isArray(s)&&Array.isArray(r)){if(s.length!==r.length||s.some((i,c)=>i!==r[c]))return!1;continue}if(s!==r)return!1}return!0}function ye(a){const e=le.c(22),{icon:n,title:l,description:s,push:r,email:i}=a,{t:c}=oe();let x;e[0]!==l?(x=t.jsx("p",{className:"text-sm font-medium",children:l}),e[0]=l,e[1]=x):x=e[1];let m;e[2]!==s?(m=t.jsx("p",{className:"text-xs text-muted-foreground",children:s}),e[2]=s,e[3]=m):m=e[3];let o;e[4]!==x||e[5]!==m?(o=t.jsxs("div",{className:"min-w-0",children:[x,m]}),e[4]=x,e[5]=m,e[6]=o):o=e[6];let d;e[7]!==n||e[8]!==o?(d=t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n,o]}),e[7]=n,e[8]=o,e[9]=d):d=e[9];let v;e[10]!==r||e[11]!==c?(v=t.jsx("div",{className:js,children:r?t.jsx(ys,{enabled:r.enabled,onChange:r.onChange}):t.jsx("span",{role:"img","aria-label":c("notifSettings.pushNotAvailable"),className:"text-muted-foreground
2/30 select-none",children:"-"})}),e[10]=r,e[11]=c,e[12]=v):v=e[12];let u;e[13]!==i||e[14]!==c?(u=t.jsx("div",{className:js,children:i?t.jsx(ys,{enabled:i.enabled,onChange:i.onChange}):t.jsx("span",{role:"img","aria-label":c("notifSettings.emailNotAvailable"),className:"text-muted-foreground/30 select-none",children:"-"})}),e[13]=i,e[14]=c,e[15]=u):u=e[15];let p;e[16]!==v||e[17]!==u?(p=t.jsxs("div",{className:"flex items-center shrink-0",children:[v,u]}),e[16]=v,e[17]=u,e[18]=p):p=e[18];let f;return e[19]!==d||e[20]!==p?(f=t.jsxs("div",{className:"flex items-center justify-between",children:[d,p]}),e[19]=d,e[20]=p,e[21]=f):f=e[21],f}function Pt(){const a=le.c(1);let e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:"flex items-center justify-end text-muted-foreground",children:[t.jsxs("div",{className:X(js,"gap-1"),children:[t.jsx("span",{className:"text-xs",children:"Push"}),t.jsx(ms,{className:"h-4 w-4"})]}),t.jsxs("div",{className:X(js,"gap-1"),children:[t.jsx("span",{className:"text-xs",children:"Email"}),t.jsx(fs,{className:"h-4 w-4"})]})]}),a[0]=e):e=a[0],e}function Wi(a){const e=le.c(106),{onBack:n,currentUser:l}=a,{t:s}=oe(),r=Ze(),i=qe(r),{profile:c,updateProfile:x}=kt(),[m,o]=U.useState(!1);let d;e[0]!==s||e[1]!==x?(d=async pe=>{o(!0);const{error:Qe}=await x({email_marketing_enabled:pe});o(!1),Qe?Z.error(s("profileSub.updateError")):Z.success(s(pe?"profileSub.emailsEnabled":"profileSub.emailsDisabled"))},e[0]=s,e[1]=x,e[2]=d):d=e[2];const v=d,{isSupported:u,permission:p,isSubscribed:f,isLoading:b,subscribe:j,unsubscribe:h}=xl(l.id),{enabled:y}=ze("push_open_settings_enabled"),{preferences:w,savePreferences:P}=An(l.id),{enabled:L}=ze("recurring_slots_enabled"),{enabled:g}=ze("streak_push_enabled"),{enabled:I}=ze("club_recurring_events_enabled"),{enabled:S}=ze("demand_alerts_enabled"),{enabled:B}=ze("club_announcements_enabled"),{enabled:D}=ze("club_member_join_notifs"),{enabled:M}=ze("session_photo_nudge_enabled"),{enabled:R}=ze("session_rebook_nudge_enabled"),{enabled:T}=ze(pl),{enabled:F}=ze("club_new_session_notifs"),{enabled:O}=ze("centre_announcements_enabled"),{enabled:G}=ze("centre_slot_notifs"),{enabled:E}=ze("live_session_alerts_enabled"),q=c?.role==="admin",[V,$]=U.useState(!1),[K,C]=U.useState(!1),[Q,J]=U.useState(null);let N;e[3]!==l.id||e[4]!==w?(N=w??{userId:l.id,newSessionAlertsEnabled:!0,sessionPlayersEnabled:!0,sessionUpdateEnabled:!0,sessionReminderEnabled:!0,emailSessionReminderEnabled:!0,emailSessionInvitationEnabled:!0,chatMessageEnabled:!0,feedCommentEnabled:!0,feedReactionEnabled:!0,chatMentionEnabled:!0,attendanceReminderEnabled:!0,sessionFeedbackEnabled:!0,sessionRecapEnabled:!0,emailSessionRecapEnabled:!0,levelFeedbackEnabled:!0,emailLevelFeedbackEnabled:!0,newUserRegisteredEnabled:!0,directMessageEnabled:!0,favoritePlayerActivityEnabled:!0,addedAsFavoriteEnabled:!0,womenOnlyOnly:!1,recurringSlotEnabled:!0,streakPushEnabled:!0,clubEventUpdateEnabled:!0,demandAlertEnabled:!0,clubAnnouncementEnabled:!0,clubMemberJoinedEnabled:!0,clubNewSessionEnabled:!0,centreAnnouncementEnabled:!0,centreSlotsEnabled:!0,sessionPhotoNudgeEnabled:!0,sessionRebookNudgeEnabled:!0,buddizRunEnabled:!0,emailNewSessionAlertsEnabled:!0,emailSessionPlayersEnabled:!0,emailSessionUpdateEnabled:!0,emailChatMessageEnabled:!0,emailChatMentionEnabled:!0,emailAttendanceReminderEnabled:!0,emailSessionFeedbackEnabled:!0,emailNewUserRegisteredEnabled:!0,emailFavoritePlayerActivityEnabled:!0,emailDirectMessageEnabled:!0,emailAddedAsFavoriteEnabled:!0,favoriteTerrainIds:[],preferredDays:[],timeSlotStart:null,timeSlotEnd:null,levelMin:null,levelMax:null,alertCity:null,alertCityLat:null,alertCityLng:null,alertRadiusKm:20,alertRunTypes:[],alertRunningSurfaces:[],padelAlertsEnabled:!1,tennisAlertsEnabled:!1,runningAlertsEnabled:!1,foot5AlertsEnabled:!1,hikingAlertsEnabled:!1,veloAlertsEnabled:!1,fitnessAlertsEnabled:!1,emailPadelAlertsEnabled:!1,emailTennisAlertsEnabled:!1,emailRunningAlertsEnabled:!1,emailFoot5AlertsEnabled:!1,emailHikingAlertsEnabled:!1,emailVeloAlertsEnabled:!1,emailFitnessAlertsEnabled:!1,padelLiveAlertsEnabled:!1,tennisLiveAlertsEnabled:!1,runningLiveAlertsEnabled:!1,foot5LiveAlertsEnabled:!1,hikingLiveAlertsEnabled:!1,veloLiveAlertsEnabled:!1,fitnessLiveAlertsEnabled:!1,newClubNearbyEnabled:!1,badgeUnlockedEnabled:!0,binomeMutualEnabled:!0,flashAvailabilityEnabled:!0,eventTrainingEnabled:!0,organizerNewEventEnabled:!0,sessionIncompleteNudgeEnabled:!0,afterSessionPerkEnabled:!0},e[3]=l.id,e[4]=w,e[5]=N):N=e[5];const A=N,k=Q??A;let H;e[6]!==Q||e[7]!==A?(H=Q!==null&&!Hi(Q,A),e[6]=Q,e[7]=A,e[8]=H):H=e[8];const ee=H;let Y;e[9]!==j||e[10]!==s?(Y=async()=>{C(!0);const{error:pe}=await j();C(!1),pe==="Permission denied"?Z.error(s("notifSettings.permissionDenied")):pe==="Database error"?Z.error(s("notifSettings.dbError")):pe?Z.error(s("notifSettings.error",{error:pe})):Z.success(s("notifSettings.enabled"))},e[9]=j,e[10]=s,e[11]=Y):Y=e[11];const te=Y;let z;e[12]!==s||e[13]!==h?(z=async()=>{C(!0);const{error:pe}=await h();C(!1),pe?Z.error(s("notifSettings.disableError")):Z.success(s("notifSettings.disabled"))},e[12]=s,e[13]=h,e[14]=z):z=e[14];const se=z;let re;e[15]!==s?(re=async()=>{await qi()||Z.error(s("notifSettings.openSettingsManual"))},e[15]=s,e[16]=re):re=e[16];const ie=re;let de;e[17]!==k||e[18]!==P||e[19]!==s?(de=async()=>{$(!0);const{error:pe}=await P(k);$(!1),pe?Z.error(s("notifSettings.saveError")):Z.success(s("notifSettings.saveSuccess"))},e[17]=k,e[18]=P,e[19]=s,e[20]=de):de=e[20];const ue=de;let me;e[21]!==k||e[22]!==ee||e[23]!==n||e[24]!==P||e[25]!==s?(me=async()=>
2{if(!ee){n();return}$(!0);const{error:pe}=await P(k);if($(!1),pe){Z.error(s("notifSettings.saveError"));return}Z.success(s("notifSettings.saveSuccess")),n()},e[21]=k,e[22]=ee,e[23]=n,e[24]=P,e[25]=s,e[26]=me):me=e[26];const je=me;let he;e[27]!==k?(he=pe=>{J({...k,...pe})},e[27]=k,e[28]=he):he=e[28];const fe=he;let Ue;e[29]!==k||e[30]!==fe?(Ue=pe=>({enabled:k[pe],onChange:()=>fe({[pe]:!k[pe]})}),e[29]=k,e[30]=fe,e[31]=Ue):Ue=e[31];const ve=Ue;let Ge;e[32]!==ve||e[33]!==f?(Ge=pe=>f?ve(pe):void 0,e[32]=ve,e[33]=f,e[34]=Ge):Ge=e[34];const Ce=Ge,Je=()=>{const pe=jn[r],Qe=!k[pe];fe({[pe]:Qe}),Qe&&typeof navigator<"u"&&navigator.geolocation&&navigator.geolocation.getCurrentPosition(st=>{ge.from("profiles").update({live_lat:st.coords.latitude,live_lng:st.coords.longitude,live_position_updated_at:new Date().toISOString()}).eq("id",l.id)},Yi,{enableHighAccuracy:!0,timeout:12e3,maximumAge:0})},at="flex-1 overflow-y-auto pb-4";let Ae;e[35]!==s?(Ae=s("notifSettings.title"),e[35]=s,e[36]=Ae):Ae=e[36];let He;e[37]!==s?(He=s("notifSettings.subtitle"),e[37]=s,e[38]=He):He=e[38];let Ee;e[39]!==je||e[40]!==Ae||e[41]!==He?(Ee=t.jsx(we,{title:Ae,subtitle:He,onBack:je}),e[39]=je,e[40]=Ae,e[41]=He,e[42]=Ee):Ee=e[42];const Xe="px-4 flex flex-col gap-4";let Ie;e[43]!==s?(Ie=s("profileSub.communications"),e[43]=s,e[44]=Ie):Ie=e[44];let De;e[45]!==Ie?(De=t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2 px-1",children:Ie}),e[45]=Ie,e[46]=De):De=e[46];let Ke;e[47]===Symbol.for("react.memo_cache_sentinel")?(Ke=t.jsx(fs,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),e[47]=Ke):Ke=e[47];let _e;e[48]!==s?(_e=s("profileSub.emailsBuddiz"),e[48]=s,e[49]=_e):_e=e[49];let Re;e[50]!==_e?(Re=t.jsx("p",{className:"text-sm font-medium",children:_e}),e[50]=_e,e[51]=Re):Re=e[51];let Fe;e[52]!==s?(Fe=s("profileSub.emailsDesc"),e[52]=s,e[53]=Fe):Fe=e[53];let Te;e[54]!==Fe?(Te=t.jsx("p",{className:"text-xs text-muted-foreground",children:Fe}),e[54]=Fe,e[55]=Te):Te=e[55];let Me;e[56]!==Re||e[57]!==Te?(Me=t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[Ke,t.jsxs("div",{className:"min-w-0",children:[Re,Te]})]}),e[56]=Re,e[57]=Te,e[58]=Me):Me=e[58];let Pe;e[59]!==v||e[60]!==c?.email_marketing_enabled?(Pe=()=>v(!(c?.email_marketing_enabled??!0)),e[59]=v,e[60]=c?.email_marketing_enabled,e[61]=Pe):Pe=e[61];const $e=c?.email_marketing_enabled??!0?"bg-primary":"bg-secondary";let Le;e[62]!==$e?(Le=X("w-12 h-7 rounded-full transition-colors relative shrink-0 disabled:opacity-50",$e),e[62]=$e,e[63]=Le):Le=e[63];const We=c?.email_marketing_enabled??!0?"translate-x-6":"translate-x-1";let Oe;e[64]!==We?(Oe=X("absolute top-1 w-5 h-5 rounded-full bg-white transition-transform",We),e[64]=We,e[65]=Oe):Oe=e[65];let Be;e[66]!==Oe?(Be=t.jsx("div",{className:Oe}),e[66]=Oe,e[67]=Be):Be=e[67];let Ve;e[68]!==m||e[69]!==Pe||e[70]!==Le||e[71]!==Be?(Ve=t.jsx("button",{type:"button",disabled:m,onClick:Pe,className:Le,children:Be}),e[68]=m,e[69]=Pe,e[70]=Le,e[71]=Be,e[72]=Ve):Ve=e[72];let Ye;e[73]!==Me||e[74]!==Ve?(Ye=t.jsx(ne,{className:"p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[Me,Ve]})}),e[73]=Me,e[74]=Ve,e[75]=Ye):Ye=e[75];let _;e[76]!==De||e[77]!==Ye?(_=t.jsxs("div",{children:[De,Ye]}),e[76]=De,e[77]=Ye,e[78]=_):_=e[78];let ce;e[79]!==u||e[80]!==s?(ce=!u&&t.jsxs(ne,{className:"p-5 text-center",children:[t.jsx(bl,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground"}),t.jsx("p",{className:"text-sm font-medium mb-1",children:s("notifSettings.notSupported")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:s("notifSettings.notSupportedDesc")})]}),e[79]=u,e[80]=s,e[81]=ce):ce=e[81];let et;e[82]!==ie||e[83]!==y||e[84]!==p||e[85]!==u||e[86]!==s?(et=u&&p==="denied"&&t.jsxs(ne,{className:"p-5 text-center",children:[t.jsx(hl,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground"}),t.jsx("p",{className:"text-sm font-medium mb-1",children:s("notifSettings.blocked")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:qt.isNativePlatform()?s("notifSettings.blockedDescNative"):s("notifSettings.blockedDesc")}),y&&qt.isNativePlatform()&&t.jsx(ae,{className:"mt-4",onClick:ie,children:s("notifSettings.openSettingsBtn")})]}),e[82]=ie,e[83]=y,e[84]=p,e[85]=u,e[86]=s,e[87]=et):et=e[87];const ot=u&&p!=="denied"&&!f&&!b&&t.jsxs(ne,{className:"p-5 text-center",children:[t.jsx(ms,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground"}),t.jsx("p",{className:"text-sm font-medium mb-1",children:s("notifSettings.activate")}),t.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:s("notifSettings.activateDesc",{session:i.sessionLabel})}),t.jsx(ae,{onClick:te,disabled:K,children:s(K?"notifSettings.activating":"notifSettings.activateBtn")})]});let nt;e[88]!==b?(nt=b&&t.jsx(ne,{className:"p-5 flex items-center justify-center",children:t.jsx("span",{className:"w-5 h-5 border-2 border-primary border-t-transparent roun
2ded-full animate-spin"})}),e[88]=b,e[89]=nt):nt=e[89];let lt;e[90]!==se||e[91]!==f||e[92]!==K||e[93]!==s?(lt=f&&t.jsx(ne,{className:"p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx(ms,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium",children:s("notifSettings.masterTitle")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:s("notifSettings.masterDesc")})]})]}),t.jsx(ys,{enabled:!0,onChange:()=>{K||se()}})]})}),e[90]=se,e[91]=f,e[92]=K,e[93]=s,e[94]=lt):lt=e[94];const ct=!b&&t.jsxs(t.Fragment,{children:[t.jsxs(ne,{className:"p-4 space-y-4",children:[t.jsx(Pt,{}),t.jsx(ye,{icon:t.jsx(ms,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.newSessionAlerts",{sessions:i.sessionLabelPlural}),description:s("notifSettings.newSessionAlertsDesc",{session:i.sessionLabel}),push:Ce(Gi[r])}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx(Ht,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium",children:s("notifSettings.sessionRelance")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:s("notifSettings.sessionRelanceDesc",{session:i.sessionLabel})})]})]}),t.jsx(ys,{...ve("newSessionAlertsEnabled")})]})]}),f&&E&&t.jsxs(ne,{className:"p-4 space-y-4",children:[t.jsx(Pt,{}),t.jsx(ye,{icon:t.jsx(gl,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.liveSessionAlerts"),description:s("notifSettings.liveSessionAlertsDesc",{session:i.sessionLabel}),push:{enabled:k[jn[r]],onChange:Je}})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2 px-1",children:s("notifSettings.sessionActivity",{session:i.sessionLabel})}),t.jsxs(ne,{className:"p-4 space-y-4",children:[t.jsx(Pt,{}),t.jsx(ye,{icon:t.jsx(_s,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.sessionPlayers"),description:s("notifSettings.sessionPlayersDesc",{session:i.sessionLabel}),push:Ce("sessionPlayersEnabled"),email:ve("emailSessionPlayersEnabled")}),t.jsx(ye,{icon:t.jsx(vl,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.sessionUpdate",{session:i.sessionLabel}),description:s("notifSettings.sessionUpdateDesc",{session:i.sessionLabel}),push:Ce("sessionUpdateEnabled"),email:ve("emailSessionUpdateEnabled")}),t.jsx(ye,{icon:t.jsx(as,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.sessionReminder",{session:i.sessionLabel}),description:s("notifSettings.sessionReminderDesc",{session:i.sessionLabel}),push:Ce("sessionReminderEnabled"),email:ve("emailSessionReminderEnabled")}),t.jsx(ye,{icon:t.jsx(fs,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.sessionInvitation"),description:s("notifSettings.sessionInvitationDesc"),push:void 0,email:ve("emailSessionInvitationEnabled")}),t.jsx(ye,{icon:t.jsx(Qs,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.chatMessages"),description:s("notifSettings.chatMessagesDesc"),push:Ce("chatMessageEnabled"),email:ve("emailChatMessageEnabled")}),f&&t.jsx(ye,{icon:t.jsx(Qs,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.feedComments"),description:s("notifSettings.feedCommentsDesc"),push:Ce("feedCommentEnabled")}),f&&t.jsx(ye,{icon:t.jsx(Xs,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.feedReactions"),description:s("notifSettings.feedReactionsDesc"),push:Ce("feedReactionEnabled")}),f&&t.jsx(ye,{icon:t.jsx(yl,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.chatMentions"),description:s("notifSettings.chatMentionsDesc"),push:ve("chatMentionEnabled")}),t.jsx(ye,{icon:t.jsx(fs,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.directMessages"),description:s("notifSettings.directMessagesDesc"),push:Ce("directMessageEnabled"),email:ve("emailDirectMessageEnabled")})]})]}),f&&t.jsxs(ne,{className:"p-4 space-y-4",children:[t.jsx(Pt,{}),t.jsx(ye,{icon:t.jsx(Zs,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.favoriteActivity"),description:s("notifSettings.favoriteActivityDesc",{session:i.sessionLabel}),push:ve("favoritePlayerActivityEnabled")})]}),f&&t.jsxs(ne,{className:"p-4 space-y-4",children:[t.jsx(Pt,{}),t.jsx(ye,{icon:t.jsx(Xs,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.addedAsFavorite"),description:s("notifSettings.addedAsFavoriteDesc"),push:ve("addedAsFavoriteEnabled")})]}),f&&t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2 px-1",children:s("notifSettings.engagement")}),t.jsxs(ne,{className:"p-4 space-y-4",children:[t.jsx(Pt,{}),t.jsx(ye,{icon:t.jsx(Js,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.rankUp"),description:s("notifSettings.rankUpDesc"),push:{enabled:k.badgeUnlockedEnabled,onChange:()=>fe({badgeUnlockedEnabled:!k.badgeUnlockedEnabled})}}),t.jsx(ye,{icon:t.jsx(jl,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.flashAvailability"),description:s("notifSettings.flashAvailabilityDesc"),push:{enabled:k.flashAvailabilityEnabled,onChange:()=>fe({flashAvailabilityEnabled:!k.flashAvailabilityEnabled})}}),L?t.jsx(ye,{icon:t.jsx(as,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.recurringSlot"),description:s("notifSettings.recurringSlotDesc"),push:{enabled:k.recurringSlotEnabled,onChange:()=>fe({recurringSlotEnabled:!k.recurringSlotEnabled})}}):null,g?t.jsx(ye,{icon:t.jsx(en,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.streakPush"),description:s("notifSettings.streakPushDesc"),push:{enabled:k.streakPushEnabled,onChange:()=>fe({streakPushEnabled:!k.streakPushEnabled})}}):null,I?t.jsx(ye,{icon:t.jsx(Ht,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.clubEventUpdate"),description:s("notifSettings.clubEventUpdateDesc"),push:{enabled:k.clubEventUpdateEnabled,onChange:()=>fe({clubEventUpdateEnabled:!k.clubEventUpdateEnabled})}}):null,S?t.jsx(ye,{icon:t.jsx(Nl,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.demandAlert"),description:s("notifSettings.demandAlertDesc"),push:{enabled:k.demandAlertEnabled,onChange:()=>fe({demandAlertEnabled:!k.demandAlertEnabled})}}):null,B?t.jsx(ye,{icon:t.jsx(Ht,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.clubAnnouncement"),description:s("notifSettings.clubAnnouncementDesc"),push:{enabled:k.clubAnnouncementEnabled,onChange:()=>fe({clubAnnouncementEnabled:!k.clubAnnouncementEnabled})}}):null,D?t.jsx(ye,{icon:t.jsx(tn,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.clubMemberJoined"),description:s("notifSettings.clubMemberJoinedDesc"),push:{enabled:k.clubMemberJoinedEnabled,onChange:()=>fe({clubMemberJoinedEnabled:!k.clubMemberJoinedEnabled})}}):null,F?t.jsx(ye,{icon:t.jsx(as,{className:"h-5 w-5 shrink-0 text-muted-foreground"}
2),title:s("notifSettings.clubNewSession",{sessionLabelPlural:i.sessionLabelPlural}),description:s("notifSettings.clubNewSessionDesc",{sessionLabelPlural:i.sessionLabelPlural}),push:{enabled:k.clubNewSessionEnabled,onChange:()=>fe({clubNewSessionEnabled:!k.clubNewSessionEnabled})}}):null,O?t.jsx(ye,{icon:t.jsx(Ht,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.centreAnnouncement"),description:s("notifSettings.centreAnnouncementDesc"),push:{enabled:k.centreAnnouncementEnabled,onChange:()=>fe({centreAnnouncementEnabled:!k.centreAnnouncementEnabled})}}):null,G?t.jsx(ye,{icon:t.jsx(Ht,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.centreSlots"),description:s("notifSettings.centreSlotsDesc"),push:{enabled:k.centreSlotsEnabled,onChange:()=>fe({centreSlotsEnabled:!k.centreSlotsEnabled})}}):null,t.jsx(ye,{icon:t.jsx(Js,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.eventTraining"),description:s("notifSettings.eventTrainingDesc"),push:{enabled:k.eventTrainingEnabled,onChange:()=>fe({eventTrainingEnabled:!k.eventTrainingEnabled})}}),t.jsx(ye,{icon:t.jsx(as,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.organizerNewEvent"),description:s("notifSettings.organizerNewEventDesc"),push:{enabled:k.organizerNewEventEnabled,onChange:()=>fe({organizerNewEventEnabled:!k.organizerNewEventEnabled})}}),t.jsx(ye,{icon:t.jsx(_s,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.sessionIncompleteNudge"),description:s("notifSettings.sessionIncompleteNudgeDesc"),push:{enabled:k.sessionIncompleteNudgeEnabled,onChange:()=>fe({sessionIncompleteNudgeEnabled:!k.sessionIncompleteNudgeEnabled})}}),t.jsx(ye,{icon:t.jsx(_s,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.afterSessionPerk"),description:s("notifSettings.afterSessionPerkDesc"),push:{enabled:k.afterSessionPerkEnabled,onChange:()=>fe({afterSessionPerkEnabled:!k.afterSessionPerkEnabled})}})]})]}),f&&t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2 px-1",children:s("notifSettings.postSession",{session:i.sessionLabel})}),t.jsxs(ne,{className:"p-4 space-y-4",children:[t.jsx(Pt,{}),M?t.jsx(ye,{icon:t.jsx(Sl,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.photoNudge"),description:s("notifSettings.photoNudgeDesc",{session:i.sessionLabel}),push:{enabled:k.sessionPhotoNudgeEnabled,onChange:()=>fe({sessionPhotoNudgeEnabled:!k.sessionPhotoNudgeEnabled})}}):null,R?t.jsx(ye,{icon:t.jsx(si,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.rebookNudge"),description:s("notifSettings.rebookNudgeDesc",{session:i.sessionLabel}),push:{enabled:k.sessionRebookNudgeEnabled,onChange:()=>fe({sessionRebookNudgeEnabled:!k.sessionRebookNudgeEnabled})}}):null,T?t.jsx(ye,{icon:t.jsx(pt,{name:"run",className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.buddizRun"),description:s("notifSettings.buddizRunDesc"),push:{enabled:k.buddizRunEnabled,onChange:()=>fe({buddizRunEnabled:!k.buddizRunEnabled})}}):null,t.jsx(ye,{icon:t.jsx(kl,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.attendanceReminder"),description:s("notifSettings.attendanceReminderDesc",{session:i.sessionLabel}),push:ve("attendanceReminderEnabled")}),t.jsx(ye,{icon:t.jsx(Zs,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.feedbackReminder"),description:s("notifSettings.feedbackReminderDesc"),push:ve("sessionFeedbackEnabled")}),t.jsx(ye,{icon:t.jsx(en,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.sessionRecap"),description:s("notifSettings.sessionRecapDesc",{session:i.sessionLabel}),push:ve("sessionRecapEnabled")}),t.jsx(ye,{icon:t.jsx(wl,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.levelFeedback"),description:s("notifSettings.levelFeedbackDesc"),push:ve("levelFeedbackEnabled")})]})]}),q&&t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2 px-1",children:s("notifSettings.administration")}),t.jsxs(ne,{className:"p-4 space-y-4",children:[t.jsx(Pt,{}),t.jsx(ye,{icon:t.jsx(tn,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),title:s("notifSettings.newRegistrations"),description:s("notifSettings.newRegistrationsDesc"),push:Ce("newUserRegisteredEnabled"),email:ve("emailNewUserRegisteredEnabled")})]})]}),t.jsx(ae,{className:"w-full",onClick:ue,disabled:V,children:s(V?"notifSettings.saving":"notifSettings.save")})]});let dt;e[95]!==_||e[96]!==ce||e[97]!==et||e[98]!==ot||e[99]!==nt||e[100]!==lt||e[101]!==ct?(dt=t.jsxs("div",{className:Xe,children:[_,ce,et,ot,nt,lt,ct]}),e[95]=_,e[96]=ce,e[97]=et,e[98]=ot,e[99]=nt,e[100]=lt,e[101]=ct,e[102]=dt):dt=e[102];let tt;return e[103]!==Ee||e[104]!==dt?(tt=t.jsxs("div",{className:at,children:[Ee,dt]}),e[103]=Ee,e[104]=dt,e[105]=tt):tt=e[105],tt}function Yi(){}const Nn=["06:00","07:00","08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"];function Qi({onBack:a,currentUser:e}){const{t:n}=oe(),l=Ze(),s=e.gender==="female",r=qe(l),i=r.modes.hasSportAlerts,{preferences:c,savePreferences:x}=An(e.id),[m,o]=U.useState(!1),[d,v]=U.useState(!1),u=U.useRef(null),[p,f]=U.useState(null),b=p??c??null,
2j=U.useMemo(()=>[{value:"lundi",label:n("notifPrefs.dayMon")},{value:"mardi",label:n("notifPrefs.dayTue")},{value:"mercredi",label:n("notifPrefs.dayWed")},{value:"jeudi",label:n("notifPrefs.dayThu")},{value:"vendredi",label:n("notifPrefs.dayFri")},{value:"samedi",label:n("notifPrefs.daySat")},{value:"dimanche",label:n("notifPrefs.daySun")}],[n]);U.useEffect(()=>{const E=q=>{u.current&&!u.current.contains(q.target)&&v(!1)};return d&&document.addEventListener("mousedown",E),()=>{document.removeEventListener("mousedown",E)}},[d]);const h=b??{userId:e.id,newSessionAlertsEnabled:!0,sessionPlayersEnabled:!0,sessionUpdateEnabled:!0,chatMessageEnabled:!0,feedCommentEnabled:!0,feedReactionEnabled:!0,chatMentionEnabled:!0,attendanceReminderEnabled:!0,sessionReminderEnabled:!0,emailSessionReminderEnabled:!0,emailSessionInvitationEnabled:!0,sessionFeedbackEnabled:!0,sessionRecapEnabled:!0,emailSessionRecapEnabled:!0,levelFeedbackEnabled:!0,emailLevelFeedbackEnabled:!0,newUserRegisteredEnabled:!0,directMessageEnabled:!0,favoritePlayerActivityEnabled:!0,emailNewSessionAlertsEnabled:!0,emailSessionPlayersEnabled:!0,emailSessionUpdateEnabled:!0,emailChatMessageEnabled:!0,emailChatMentionEnabled:!0,emailAttendanceReminderEnabled:!0,emailSessionFeedbackEnabled:!0,emailNewUserRegisteredEnabled:!0,emailFavoritePlayerActivityEnabled:!0,emailDirectMessageEnabled:!0,addedAsFavoriteEnabled:!0,emailAddedAsFavoriteEnabled:!0,womenOnlyOnly:!1,recurringSlotEnabled:!0,streakPushEnabled:!0,clubEventUpdateEnabled:!0,demandAlertEnabled:!0,clubAnnouncementEnabled:!0,clubMemberJoinedEnabled:!0,clubNewSessionEnabled:!0,centreAnnouncementEnabled:!0,centreSlotsEnabled:!0,sessionPhotoNudgeEnabled:!0,sessionRebookNudgeEnabled:!0,buddizRunEnabled:!0,favoriteTerrainIds:[],preferredDays:[],timeSlotStart:null,timeSlotEnd:null,levelMin:null,levelMax:null,alertCity:null,alertCityLat:null,alertCityLng:null,alertRadiusKm:20,alertRunTypes:[],alertRunningSurfaces:[],padelAlertsEnabled:!1,tennisAlertsEnabled:!1,runningAlertsEnabled:!1,foot5AlertsEnabled:!1,hikingAlertsEnabled:!1,veloAlertsEnabled:!1,fitnessAlertsEnabled:!1,emailPadelAlertsEnabled:!1,emailTennisAlertsEnabled:!1,emailRunningAlertsEnabled:!1,emailFoot5AlertsEnabled:!1,emailHikingAlertsEnabled:!1,emailVeloAlertsEnabled:!1,emailFitnessAlertsEnabled:!1,padelLiveAlertsEnabled:!1,tennisLiveAlertsEnabled:!1,runningLiveAlertsEnabled:!1,foot5LiveAlertsEnabled:!1,hikingLiveAlertsEnabled:!1,veloLiveAlertsEnabled:!1,fitnessLiveAlertsEnabled:!1,newClubNearbyEnabled:!1,badgeUnlockedEnabled:!0,binomeMutualEnabled:!0,flashAvailabilityEnabled:!0,eventTrainingEnabled:!0,organizerNewEventEnabled:!0,sessionIncompleteNudgeEnabled:!0,afterSessionPerkEnabled:!0},y=async()=>{o(!0);const{error:E}=await x(h);o(!1),E?Z.error(n("alerts.saveError")):Z.success(n("alerts.saveSuccess"))},w=E=>{f({...h,...E})},P=E=>{w({preferredDays:h.preferredDays.includes(E)?h.preferredDays.filter(q=>q!==E):[...h.preferredDays,E]})},L=E=>{w({favoriteTerrainIds:h.favoriteTerrainIds.includes(E)?h.favoriteTerrainIds.filter(q=>q!==E):[...h.favoriteTerrainIds,E]})},[g,I]=U.useState(""),{userPosition:S}=Cl(),{byId:B}=Pl(h.favoriteTerrainIds),{terrains:D}=El({query:g,sport:l,position:S,enabled:d}),M=U.useMemo(()=>{const E=h.favoriteTerrainIds.map(V=>B.get(V)).filter(V=>!!V),q=new Set(E.map(V=>V.id));return[...E,...D.filter(V=>!q.has(V.id))]},[h.favoriteTerrainIds,B,D]),R=E=>{w({alertRunTypes:h.alertRunTypes.includes(E)?h.alertRunTypes.filter(q=>q!==E):[...h.alertRunTypes,E]})},T=E=>{w({alertRunningSurfaces:h.alertRunningSurfaces.includes(E)?h.alertRunningSurfaces.filter(q=>q!==E):[...h.alertRunningSurfaces,E]})},F=async E=>{if(w({alertCity:E||null,alertCityLat:null,alertCityLng:null}),!(E.length<3))try{const{mapboxGeocode:q}=await Ml(async()=>{const{mapboxGeocode:$}=await import("./index-Do2d937u.js").then(K=>K.of);return{mapboxGeocode:$}},__vite__mapDeps([0,1,2])),V=await q(E);V&&w({alertCity:E,alertCityLat:V.lat,alertCityLng:V.lng})}catch{}},O=E=>{w({alertCity:E.name,alertCityLat:E.lat,alertCityLng:E.lng})},G=h.favoriteTerrainIds.length>0||h.preferredDays.length>0||h.timeSlotStart!==null||h.levelMin!==null||h.alertCity!==null||h.alertRunTypes.length>0||h.alertRunningSurfaces.length>0;return t.jsxs("div",{className:"flex-1 overflow-y-auto pb-4",children:[t.jsx(we,{title:n("alerts.title"),subtitle:n("alerts.subtitle",{sessionLabel:r.sessionLabel}),onBack:a}),t.jsxs("div",{className:"px-4 flex flex-col gap-4",children:[s&&t.jsx(ne,{className:"p-4 bg-pink-50 dark:bg-pink-950/20 border-pink-200 dark:border-pink-900/40",children:t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex flex-col",children:[t.jsx("label",{className:"text-sm font-semibold text-foreground",children:n("alerts.womenOnlyOnlyLabel",{sessionLabelPlural
2:r.sessionLabelPlural})}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n("alerts.womenOnlyOnlyHint",{sessionLabelPlural:r.sessionLabelPlural})})]}),t.jsx(Dn,{checked:h.womenOnlyOnly,onCheckedChange:E=>w({womenOnlyOnly:E})})]})}),t.jsx(ne,{className:"p-4",children:t.jsxs("div",{className:"space-y-4",children:[r.hasCentres&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:n("notifPrefs.favoriteTerrains",{placeLabel:r.placeLabel,placeLabelPlural:r.placeLabelPlural})}),t.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:n("notifPrefs.favoritesTerrainsDesc",{placeLabel:r.placeLabel,placeLabelPlural:r.placeLabelPlural})}),t.jsxs("div",{className:"relative",ref:u,children:[t.jsxs("button",{type:"button",className:X("w-full h-10 rounded-lg border bg-card px-3 text-sm text-left flex items-center justify-between",d?"border-primary":"border-border"),onClick:()=>v(!d),children:[t.jsx("span",{className:h.favoriteTerrainIds.length===0?"text-muted-foreground":"",children:h.favoriteTerrainIds.length===0?n("notifPrefs.allTerrains",{placeLabel:r.placeLabel,placeLabelPlural:r.placeLabelPlural}):n("notifPrefs.terrainsSelected",{count:h.favoriteTerrainIds.length,placeLabel:r.placeLabel,placeLabelPlural:r.placeLabelPlural})}),t.jsx("svg",{className:X("w-4 h-4 text-muted-foreground transition-transform",d&&"rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),d&&t.jsxs("div",{className:"absolute z-20 w-full mt-1 bg-card border border-border rounded-lg shadow-lg max-h-48 overflow-y-auto",children:[t.jsx("div",{className:"sticky top-0 bg-card p-2 border-b border-border",children:t.jsx("input",{type:"search",value:g,onChange:E=>I(E.target.value),placeholder:n("notifPrefs.searchTerrain",{placeLabel:r.placeLabel}),"aria-label":n("notifPrefs.searchTerrain",{placeLabel:r.placeLabel}),className:"w-full h-8 rounded-md border border-border bg-background px-2 text-sm"})}),M.map(E=>t.jsxs("label",{className:"flex items-center gap-3 px-3 py-2 hover:bg-secondary/50 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:h.favoriteTerrainIds.includes(E.id),onChange:()=>L(E.id),className:"w-4 h-4 rounded border-border text-primary focus-visible:ring-primary"}),t.jsx("span",{className:"text-sm",children:E.name})]},E.id))]})]}),h.favoriteTerrainIds.length===0&&t.jsx("p",{className:"text-xs text-muted-foreground mt-2 italic",children:n("notifPrefs.noTerrainHint",{placeLabel:r.placeLabel,placeLabelPlural:r.placeLabelPlural})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:n("notifPrefs.preferredDays")}),t.jsx("div",{className:"flex gap-1.5",children:j.map(({value:E,label:q})=>t.jsx("button",{className:X("flex-1 py-2 rounded-lg border text-xs font-medium transition-all",h.preferredDays.includes(E)?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>P(E),children:q},E))}),h.preferredDays.length===0&&t.jsx("p",{className:"text-xs text-muted-foreground mt-2 italic",children:n("notifPrefs.noDayHint")})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:n("notifPrefs.timeSlot")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("select",{className:"flex-1 h-10 rounded-lg border border-border bg-card px-3 text-sm",value:h.timeSlotStart??"",onChange:E=>w({timeSlotStart:E.target.value||null}),children:[t.jsx("option",{value:"",children:n("notifPrefs.start")}),Nn.map(E=>t.jsx("option",{value:E,children:E},E))]}),t.jsx("span",{className:"text-muted-foreground",children:n("notifPrefs.to")}),t.jsxs("select",{className:"flex-1 h-10 rounded-lg border border-border bg-card px-3 text-sm",value:h.timeSlotEnd??"",onChange:E=>w({timeSlotEnd:E.target.value||null}),children:[t.jsx("option",{value:"",children:n("notifPrefs.end")}),Nn.map(E=>t.jsx("option",{value:E,children:E},E))]})]}),(!h.timeSlotStart||!h.timeSlotEnd)&&t.jsx("p",{className:"text-xs text-muted-foreground mt-2 italic",children:n("notifPrefs.noTimeSlotHint")})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:n("alerts.geoZone")}),t.jsx(el,{value:h.alertCity??"",onChange:F,onSelect:O,placeholder:n("alerts.cityPlaceholder")}),h.alertCity&&t.jsxs("div",{className:"mt-2",children:[t.jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:n("alerts.radius",{km:h.alertRadiusKm})}),t.jsx("input",{type:"range",min:5,max:50,step:5,value:h.alertRadiusKm,onChange:E=>w({alertRadiusKm:Number(E.target.value)}),className:"w-full accent-primary"}),t.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[t.jsx("span",{children:"5 km"}),t.jsx("span",{children:"50 km"})]})]}),!h.alertCity&&t.jsx("p",{className:"text-xs text-muted-foreground mt-2 italic",children:n("alerts.noCityHint")})]}),i&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:n("alerts.runType")}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.keys(Ms).map(E=>t.jsx("button",{className:X("py-1.5 px-3 rounded-lg border text-xs font-medium transition-all",h.alertRunTypes.includes(E)?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>R(E),children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(pt,{name:_l[E],className:"w-3.5 h-3.5 shrink-0"}),n(Ms[E])]})},E))}),h.alertRunTypes.length===0&&t.jsx("p",{className:"text-xs text-muted-foreground mt-2 italic",children:n("alerts.noRunTypeHint")})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:n("alerts.surface")}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.keys(xs).map(E=>t.jsx("button",{className:X("py-1.5 px-3 rounded-lg border text-xs font-medium transition-all",h.alertRunningSurfaces.includes(E)?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>T(E),children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(pt,{name:Rn[E],className:"w-3.5 h-3.5 shrink-0"}),n(xs[E])]})},E))}),h.alertRunningSurfaces.length===0&&t.jsx("p",{className:"text-xs text-muted-foreground mt-2 italic",children:n("alerts.noSurfaceHint")})]})]}),r.hasLevel&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:n("notifPrefs.participantLevel")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("select",{className:"flex-1 h-10 rounded-lg border border-border bg-card px-3 text-sm",value:h.levelMin??"",onChange:E=>w({levelMin:E.target.value?Number(E.target.value):null}),children:[t.jsx("option",{value:"",children:n("alerts.min")}),[1,2,3,4,5,6,7,8,9,10].map(E=>t.jsx("option",{value:E,children:n("notifPrefs.levelN",{level:E})},E))]}),t.jsx("span",{className:"text-muted-foreground",children:n("notifPrefs.to")}),t.jsxs("select",{className:"flex-1 h-10 rounded-lg border border-border bg-card px-3 text-sm",value:h.levelMax??"",onChange:E=>w({levelMax:E.target.value?Number(E.target.value):null}),children:[t.jsx("option",{value:"",children:n("alerts.max")}),[1,2,3,4,5,6,7,8,9,10].map(E=>t.jsx("option",{value:E,children:n("notifPrefs.levelN",{level:E})},E))]})]}),(!h.levelMin||!h.levelMax)&&t.jsx("p",{className:"text-xs text-muted-foreground mt-2 italic",children:n("notifPrefs.noLevelHint")})]})]})}),G&&t.jsxs(ne,{className:"p-3 bg-primary/10 border-primary/20",children:[t.jsx("p",{className:"text-xs text-primary font-medium mb-1",children:n("notifPrefs.filterSummary")}
2),t.jsxs("ul",{className:"text-xs text-muted-foreground space-y-0.5",children:[r.hasCentres&&h.favoriteTerrainIds.length>0&&t.jsxs("li",{children:[n("notifPrefs.summaryTerrains",{placeLabel:r.placeLabel,placeLabelPlural:r.placeLabelPlural})," ",h.favoriteTerrainIds.map(E=>B.get(E)?.name).filter(Boolean).join(", ")]}),h.preferredDays.length>0&&t.jsxs("li",{children:[n("notifPrefs.summaryDays")," ",h.preferredDays.join(", ")]}),h.timeSlotStart&&h.timeSlotEnd&&t.jsxs("li",{children:[n("notifPrefs.summaryTime")," ",h.timeSlotStart," - ",h.timeSlotEnd]}),r.hasLevel&&h.levelMin&&h.levelMax&&t.jsx("li",{children:n("notifPrefs.summaryLevel",{min:h.levelMin,max:h.levelMax})}),h.alertCity&&t.jsx("li",{children:n("alerts.summaryZone",{city:h.alertCity,km:h.alertRadiusKm})}),i&&h.alertRunTypes.length>0&&t.jsxs("li",{children:[n("alerts.summaryTypes")," ",h.alertRunTypes.map(E=>n(Ms[E])).join(", ")]}),i&&h.alertRunningSurfaces.length>0&&t.jsxs("li",{children:[n("alerts.summarySurfaces")," ",h.alertRunningSurfaces.map(E=>n(xs[E])).join(", ")]})]})]}),t.jsx(ae,{className:"w-full",onClick:y,disabled:m,children:n(m?"notifPrefs.saving":"common.save")})]})]})}function ll(a){const e=le.c(5),{className:n}=a;let l,s,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("path",{d:"M16 3h5v5"}),s=t.jsx("path",{d:"m21 3-6.75 6.75"}),r=t.jsx("circle",{cx:"10",cy:"14",r:"6"}),e[0]=l,e[1]=s,e[2]=r):(l=e[0],s=e[1],r=e[2]);let i;return e[3]!==n?(i=t.jsxs(Qt,{className:n,children:[l,s,r]}),e[3]=n,e[4]=i):i=e[4],i}const rl=120,Xi=/(?:(?:\+33|0033)\s*[67]|0\s*[67])[\s.-]?\d{2}[\s.-]?\d{2}[\s.-]?\d{2}[\s.-]?\d{2}/,Zi=/https?:\/\/|www\./i,Ji=/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/,ea=/@[a-zA-Z0-9_]{2,}/,ta=/\b(?:insta(?!nt)|snap(?:chat)?|tiktok|telegram|whatsapp)\b/i;function sa(a){const e=a.trim();return e?e.length>rl?{valid:!1,reason:"too_long"}:Xi.test(e)?{valid:!1,reason:"phone"}:Zi.test(e)?{valid:!1,reason:"url"}:Ji.test(e)?{valid:!1,reason:"social"}:ea.test(e)?{valid:!1,reason:"social"}:ta.test(e)?{valid:!1,reason:"social"}:{valid:!0}:{valid:!0}}function Sn(){return{too_long:Et.t("data.bio.tooLong",{max:rl}),phone:Et.t("data.bio.phoneNotAllowed"),url:Et.t("data.bio.urlNotAllowed"),social:Et.t("data.bio.socialNotAllowed"),email:Et.t("data.bio.emailNotAllowed"),moderation:Et.t("data.bio.moderationFailed")}}function na({currentUser:a,onBack:e}){const{t:n}=oe(),{updateProfile:l}=kt(),[s,r]=U.useState({firstName:a.firstName,lastName:a.lastName??"",dateOfBirth:a.dateOfBirth??"",city:a.city,phone:a.phone??"",phoneVisibility:a.phoneVisibility??"never",stravaUsername:a.stravaUsername??"",gender:a.gender??null,bio:a.bio??""}),[i,c]=U.useState(null),[x,m]=U.useState(!1),[o,d]=U.useState(null),v=f=>{r(b=>({...b,city:f})),f||d(null)},u=f=>{d({lat:f.lat,lng:f.lng})},p=async()=>{if(!s.firstName.trim()){Z.error(n("profileSub.firstNameRequired"));return}if(s.firstName.trim().length<2){Z.error(n("profileSub.firstNameMin"));return}if(s.lastName.trim()&&s.lastName.trim().length<2){Z.error(n("profileSub.lastNameMin"));return}const f=hn(s.firstName);if(!f.valid){Z.error(gn()[f.reason]);return}const b=hn(s.lastName);if(!b.valid){Z.error(gn()[b.reason]);return}if(s.lastName.trim()&&s.firstName.trim().toLowerCase()===s.lastName.trim().toLowerCase()){Z.error(n("profileSub.namesMustDiffer"));return}if(!a.dateOfBirth&&s.dateOfBirth&&!Tl(s.dateOfBirth)){Z.error(n("profileSub.dateOfBirthInvalid"));return}const j=s.bio.trim(),h=sa(j);if(!h.valid){c(Sn()[h.reason]);return}if(c(null),j&&j!==(a.bio??"")){m(!0);try{const{data:g}=await ge.functions.invoke("moderate-bio",{body:{bio:j}});if(g&&!g.approved){c(Sn().moderation),m(!1);return}}catch{}m(!1)}const y=s.city!==a.city,w=o||(y&&s.city?await Gs(s.city).catch(()=>null):null),P=s.lastName.trim(),{error:L}=await l({first_name:Ls(s.firstName.trim()),last_name:P?Ls(P):"",...!a.dateOfBirth&&s.dateOfBirth&&{date_of_birth:s.dateOfBirth},city:s.city?Ls(s.city.trim()):s.city,...w&&{lat:w.lat,lng:w.lng},phone:s.phone||null,phone_visibility:s.phone?s.phoneVisibility:"never",strava_username:s.stravaUsername.trim()||null,...!a.gender&&s.gender&&{gender:s.gender},bio:j||null});if(L){Z.error(n("profileSub.updateError"));return}Z.success(n("profileSub.profileUpdated")),e()};return t.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[t.jsxs("div",{className:"flex-1 overflow-y-auto",children:[t.jsx(we,{title:n("profileSub.personalInfo"),onBack:e}),t.jsx("div",{className:"px-4 pb-4 flex flex-col gap-4 mt-2",children:t.jsxs(ne,{className:"p-5",children:[t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:"info-firstname",className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:n("profileSub.firstName")}
2),t.jsx(be,{id:"info-firstname",value:s.firstName,onChange:f=>r({...s,firstName:f.target.value}),placeholder:n("profileSub.firstNamePlaceholder"),autoComplete:"off","data-1p-ignore":!0,"data-lpignore":"true","data-form-type":"other"})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"info-lastname",className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:n("profileSub.lastName")}),t.jsx(be,{id:"info-lastname",value:s.lastName,onChange:f=>r({...s,lastName:f.target.value}),placeholder:n("profileSub.lastNamePlaceholder"),autoComplete:"off","data-1p-ignore":!0,"data-lpignore":"true","data-form-type":"other"})]})]}),t.jsx("p",{className:"text-xs text-muted-foreground -mt-1",children:n("profileSub.nameVisibleNote")}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"info-dob",className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:n("profileSub.dateOfBirth")}),t.jsx(be,{id:"info-dob",type:"date",value:s.dateOfBirth,onChange:f=>r({...s,dateOfBirth:f.target.value}),min:"1900-01-01",max:new Date().toISOString().slice(0,10),disabled:!!a.dateOfBirth,className:X(!!a.dateOfBirth&&"opacity-60 cursor-not-allowed")}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:a.dateOfBirth?n("profileSub.dateOfBirthLocked"):n("profileSub.dateOfBirthNote")})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"info-city",className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:n("profileSub.city")}),t.jsx(el,{id:"info-city",value:s.city,onChange:v,onSelect:u,placeholder:n("profileSub.searchCityPlaceholder")})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"info-phone",className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:n("profileSub.phone")}),t.jsx(pi,{id:"info-phone",value:s.phone,onChange:f=>r({...s,phone:f}),placeholder:n("profileSub.phonePlaceholder")}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:n("profileSub.phoneNote")}),s.phone&&t.jsxs("div",{className:"mt-3",children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:n("profileSub.phoneVisibility")}),t.jsx("div",{className:"flex gap-2",children:[{value:"never",label:n("profileSub.phoneNever"),Icon:Ll},{value:"session",label:n("profileSub.phoneAfterSession",{sessionLabel:qe(Ze()).sessionLabel}),Icon:Fn},{value:"public",label:n("profileSub.phonePublic"),Icon:Il}].map(f=>t.jsxs("button",{className:X("flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg border text-xs font-medium cursor-pointer transition-all",s.phoneVisibility===f.value?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>r({...s,phoneVisibility:f.value}),children:[t.jsx(f.Icon,{className:"w-4 h-4"}),f.label]},f.value))}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:s.phoneVisibility==="never"?n("profileSub.phoneNeverDesc"):s.phoneVisibility==="session"?n("profileSub.phoneSessionDesc",{sessionLabel:qe(Ze()).sessionLabel}):n("profileSub.phonePublicDesc")})]})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"info-strava",className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:n("profileSub.stravaProfile")}),t.jsx(be,{id:"info-strava",type:"text",value:s.stravaUsername,onChange:f=>{let b=f.target.value;const j=b.match(/strava\.com\/athletes\/([^/?#]+)/);if(j)b=j[1];else{const h=b.match(/(https?:\/\/strava\.app\.link\/[^\s]+)/);h&&(b=h[1])}r({...s,stravaUsername:b})},placeholder:n("profileSub.stravaPlaceholder")}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:n("profileSub.stravaNote")})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:n("profileSub.gender")}),t.jsx("div",{className:"flex gap-2",children:[{value:"female",label:n("profileSub.female"),Icon:f=>t.jsx(Mt,{name:"venus",className:f.className})},{value:"male",label:n("profileSub.male"),Icon:ll},{value:"other",label:n("profileSub.other"),Icon:f=>t.jsx(Mt,{name:"user",className:f.className})}].map(f=>t.jsxs("button",{disabled:!!a.gender,className:X("flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg border text-xs font-medium transition-all",s.gender===f.value?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50",a.gender?"opacity-60 cursor-not-allowed":"cursor-pointer"),onClick:()=>!a.gender&&r({...s,gender:f.value}),children:[t.jsx(f.Icon,{className:"w-4 h-4"}),f.label]},f.value))}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:a.gender?n("profileSub.genderLocked"):n("profileSub.genderNote")})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:n("profileSub.bio")}),t.jsx("textarea",{value:s.bio,onChange:f=>{r({...s,bio:f.target.value}),c(null)},placeholder:(()=>{const f=Ze();return{padel:n("profileSub.bioPlaceholderPadel"),foot5:n("profileSub.bioPlaceholderFoot5"),running:n("profileSub.bioPlaceholderRunning"),hiking:n("profileSub.bioPlaceholderHiking"),velo:n("profileSub.bioPlaceholderVelo")}[f]??n("profileSub.bioPlaceholderDefault")})(),maxLength:120,rows:2,className:"w-full rounded-lg border border-border bg-input px-3 py-2 text-sm placeholder:text-muted-foreground resize-none focus:outline-none focus:ring-2 focus:ring-ring"}),t.jsxs("div",{className:"flex justify-between mt-1",children:[i?t.jsx("p",{className:"text-xs text-destructive",children:i}):t.jsx("p",{className:"text-xs text-muted-foreground",children:n("profileSub.bioVisible")}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.bio.length,"/120"]})]})]})]})})]}),t.jsx("div",{className:"shrink-0 bg-background/95 backdrop-blur-lg border-t border-border p-4",children:t.jsx(ae,{className:"w-full",onClick:p,disabled:x,children:n(x?"profileSub.checking":"common.save")})})]})}function la(a,e){return!Number.isFinite(a)||!Number.isFinite(e)||a<0||e<0||a===0||e>a?null:Math.round(e/a*100)}function ra(a,e){const n=le.c(10);let l;n[0]===Symbol.for("react.memo_cache_sentinel")?(l={stats:null,volunteers:[],loadedKey:null,error:!1},n[0]=l):l=n[0];const[s,r]=U.useState(l);let i,c;n[1]!==e||n[2]!==a?(i=()=>
2{if(a===null)return;let o=!1;return Promise.all([vi(a),yi(a)]).then(d=>{const[v,u]=d;o||r({stats:v,volunteers:u,loadedKey:String(a),error:!1})}).catch(()=>{o||r({stats:null,volunteers:[],loadedKey:String(a),error:!0})}),()=>{o=!0}},c=[e,a],n[1]=e,n[2]=a,n[3]=i,n[4]=c):(i=n[3],c=n[4]),U.useEffect(i,c);const x=a!==null&&s.loadedKey!==String(a);let m;return n[5]!==x||n[6]!==s.error||n[7]!==s.stats||n[8]!==s.volunteers?(m={stats:s.stats,volunteers:s.volunteers,loading:x,error:s.error},n[5]=x,n[6]=s.error,n[7]=s.stats,n[8]=s.volunteers,n[9]=m):m=n[9],m}function ia(a,e){const n=[a.firstName,a.lastName].filter(Boolean).join(" ").trim();return n.length>0?n:e}function aa(a){const e=le.c(31),{event:n}=a,{t:l}=oe(),[s,r]=U.useState(!1),{stats:i,volunteers:c,loading:x,error:m}=ra(n.id,!0);let o,d,v,u;if(e[0]!==m||e[1]!==n.city||e[2]!==n.date||e[3]!==n.title||e[4]!==x||e[5]!==i?.clickUsers||e[6]!==i?.interestCount||e[7]!==i?.registeredCount||e[8]!==l){const b=la(i?.clickUsers??0,i?.registeredCount??0);o="rounded-xl border border-border bg-card p-4",e[13]!==n.title?(d=t.jsx("p",{className:"font-semibold",children:n.title}),e[13]=n.title,e[14]=d):d=e[14];let j;e[15]!==n.date?(j=Ks(n.date),e[15]=n.date,e[16]=j):j=e[16],e[17]!==n.city||e[18]!==j?(v=t.jsxs("p",{className:"text-xs text-muted-foreground",children:[j," · ",n.city]}),e[17]=n.city,e[18]=j,e[19]=v):v=e[19],u=m?t.jsx("p",{className:"mt-3 text-sm text-destructive",children:l("organizerSpace.error")}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":"organizer-funnel",className:"mt-3 grid grid-cols-3 gap-2 text-center",children:[t.jsxs("div",{className:"rounded-lg bg-muted/40 py-2",children:[t.jsx("p",{className:"text-lg font-semibold tabular-nums",children:x?"â¦":i?.interestCount??0}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:l("organizerSpace.stats.interested")})]}),t.jsxs("div",{className:"rounded-lg bg-muted/40 py-2",children:[t.jsx("p",{className:"text-lg font-semibold tabular-nums",children:x?"â¦":i?.clickUsers??0}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:l("organizerSpace.stats.clicks")})]}),t.jsxs("div",{"data-testid":"organizer-registered",className:"rounded-lg bg-emerald-500/10 py-2",children:[t.jsx("p",{className:"text-lg font-semibold tabular-nums text-emerald-700 dark:text-emerald-400",children:x?"â¦":i?.registeredCount??0}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:l("organizerSpace.stats.registered")})]})]}),!x&&b!==null&&t.jsx("p",{"data-testid":"organizer-conversion",className:"mt-2 text-xs text-muted-foreground",children:l("organizerSpace.stats.conversion",{rate:b})}),!x&&(i?.registeredCount??0)>0&&t.jsx("p",{"data-testid":"organizer-registered-source",className:"mt-1 text-[11px] text-muted-foreground",children:l("organizerSpace.stats.registeredSource")})]}),e[0]=m,e[1]=n.city,e[2]=n.date,e[3]=n.title,e[4]=x,e[5]=i?.clickUsers,e[6]=i?.interestCount,e[7]=i?.registeredCount,e[8]=l,e[9]=o,e[10]=d,e[11]=v,e[12]=u}else o=e[9],d=e[10],v=e[11],u=e[12];let p;e[20]!==m||e[21]!==s||e[22]!==l||e[23]!==c?(p=!m&&c.length>0&&t.jsxs("div",{className:"mt-3",children:[t.jsx("button",{type:"button",onClick:()=>r(oa),className:"text-sm text-primary underline underline-offset-2",children:s?l("organizerSpace.volunteers.hide"):l("organizerSpace.volunteers.show",{count:c.length})}),s&&t.jsx("ul",{className:"mt-2 flex flex-col gap-2",children:c.map(b=>t.jsxs("li",{className:"rounded-lg border border-border px-3 py-2 text-sm",children:[t.jsx("p",{className:"font-medium",children:ia(b,l("organizerSpace.volunteers.anonymous"))}),b.message&&t.jsx("p",{className:"text-xs text-muted-foreground",children:b.message}),t.jsxs("div",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs",children:[b.email&&t.jsx("a",{href:`mailto:${b.email}`,className:"text-primary underline underline-offset-2",children:b.email}),b.phone&&t.jsx("a",{href:`tel:${b.phone}`,className:"text-primary underline underline-offset-2",children:b.phone})]})]},b.userId))})]}),e[20]=m,e[21]=s,e[22]=l,e[23]=c,e[24]=p):p=e[24];let f;return e[25]!==o||e[26]!==d||e[27]!==v||e[28]!==u||e[29]!==p?(f=t.jsxs("div",{className:o,children:[d,v,u,p]}),e[25]=o,e[26]=d,e[27]=v,e[28]=u,e[29]=p,e[30]=f):f=e[30],f}function oa(a){return!a}function ca(a){const e=le.c(29),{userId:n,onBack:l}=a,{t:s}=oe(),{events:r,loading:i,error:c}=ji(n);let x;e[0]!==s?(x=s("organizerSpace.title"),e[0]=s,e[1]=x):x=e[1];let m;e[2]!==l||e[3]!==x?(m=t.jsx(we,{title:x,onBack:l}),e[2]=l,e[3]=x,e[4]=m):m=e[4];let o;e[5]!==i||e[6]!==s?(o=i&&t.jsx("p",{className:"text-sm text-muted-foreground",children:s("organizerSpace.loading")}),e[5]=i,e[6]=s,e[7]=o):o=e[7];let d;e[8]!==c||e[9]!==i||e[10]!==s?(d=!i&&c&&t.jsx("p",{className:"text-sm text-destructive",children:s("organizerSpace.error")}),e[8]=c,e[9]=i,e[10]=s,e[11]=d):d=e[11];let v;e[12]!==c||e[13]!==r||e[14]!==i||e[15]!==s?(v=!i&&!c&&r.length===0&&t.jsx("p",{className:"text-sm text-muted-foreground",children:s("organizerSpace.empty")}),e[12]=c,e[13]=r,e[14]=i,e[15]=s,e[16]=v):v=e[16];let u;e[17]!==c||e[18]!==r||e[19]!==i?(u=!i&&!c&&r.map(da),e[17]=c,e[18]=r,e[19]=i,e[20]=u):u=e[20];let p;e[21]!==o||e[22]!==d||e[23]!==v||e[24]!==u?(p=t.jsxs("div",{className:"flex flex-col gap-3 px-5 pt-2",children:[o,d,v,u]}),e[21]=o,e[22]=d,e[23]=v,e[24]=u,e[25]=p):p=e[25];let f;return e[26]!==m||e[27]!==p?(f=t.jsxs("div",{className:"flex-1 overflow-y-auto pb-6",children:[m,p]}),e[26]=m,e[27]=p,e[28]=f):f=e[28],f}function da(a){return t.jsx(aa,{event:a},a.id)}const ua=[{test:a=>a.includes("external_account")||a.includes("bank_account"),i18nKey:"connectPayments.req.bank"},{test:a=>a.startsWith("individual.dob")||a.includes(".dob."),i18nKey:"connectPayments.req.dob"},{test:a=>a.includes("address"),i18nKey:"connectPayments.req.address"},{test:a=>a.includes("phone"),i18nKey:"connectPayments.req.phone"},{test:a=>a.endsWith(".email")||a==="email",i18nKey:"connectPayments.req.email"},{test:a=>a.includes("first_name")||a.includes("last_name")||a.includes("full_name_aliases"),i18nKey:"connectPayments.req.name"},{test:a=>a.includes("verification.document")||a.includes("verification.additional_document")||a.includes("id_number")||a.includes("ssn_last_4"),i18nKey:"connectPayments.req.identity"},{test:a=>a.startsWith("tos_acceptance"),i18nKey:"connectPayments.req.tos"},{test:a=>a.startsWith("company"),i18nKey:"connectPayments.req.company"},{test:a=>a.startsWith("business_profile"),i18nKey:"connectPayments.req.business"}],ma="connectPayments.req.other";function kn(a){const e=[];for(const n of a){const l=ua.find(r=>r.test(n)),s=l?l.i18nKey:ma;e.includes(s)||e.push(s)}return e}function fa(){return typeof window<"u"&&window.location?.origin&&!qt.isNativePlatform()?window.location.origin:Ul()}function xa({userId:a,onBack:e}){const{t:n}=oe(),{account:l,chargesEnabled:s,loading:r,reload:i}=Si(a),[c,x]=U.useState([]),[m,o]=U.useState(!1),[d,v]=U.useState(!1),u=async()=>
2{if(!m){o(!0);try{const K=await sn();K&&(x(kn(K.currentlyDue)),i())}finally{o(!1)}}};U.useEffect(()=>{let K=!1;return(async()=>{const C=await sn();!K&&C&&(x(kn(C.currentlyDue)),i())})(),()=>{K=!0}},[i]);const[p,f]=U.useState(!1),[b,j]=U.useState(!1),[h,y]=U.useState(!1),[w,P]=U.useState(!1),L=!!l?.termsAcceptedAt&&l?.termsVersion===Al,g=async()=>{if(!(w||!h)){P(!0);try{await Rl(),Z.success(n("connectPayments.terms.accepted")),i()}catch{Z.error(n("connectPayments.terms.acceptError"))}finally{P(!1)}}},[I,S]=U.useState(void 0),[B,D]=U.useState(void 0),[M,R]=U.useState(void 0),T=I!==void 0?I:l?.orgType??null,F=B!==void 0?B:l?.siren??"",O=M!==void 0?M:l?.legalName??"",G=T==="association"||T==="company",E=()=>{if(!T)return Z.error(n("connectPayments.orgTypeRequired")),null;const K=F.replace(/\s/g,"");return G&&!/^\d{9}$/.test(K)?(Z.error(n("connectPayments.sirenInvalid")),null):{orgType:T,siren:G?K:null,taxId:l?.taxId??null,legalName:O.trim()||null}},q=async()=>{if(b)return;const K=E();if(K){j(!0);try{await Dl(K),Z.success(n("connectPayments.infoSaved")),i()}catch{Z.error(n("connectPayments.infoSaveError"))}finally{j(!1)}}},V=async()=>{if(!p&&window.confirm(n("connectPayments.disconnectConfirm"))){f(!0);try{await Bl(),Z.success(n("connectPayments.disconnected")),i()}catch(K){const C=K instanceof Vl?K.message:"";Z.error(n(C==="HAS_ACTIVE_ORDERS"?"connectPayments.disconnectHasOrders":"connectPayments.disconnectError"))}finally{f(!1)}}},$=async()=>{if(d)return;const K=E();if(K){v(!0);try{const C=fa(),{url:Q}=await Fl({refreshUrl:`${C}/?connect=refresh`,returnUrl:`${C}/?connect=done`,orgInfo:K});On("paid_session_connect_started"),qt.isNativePlatform()?Ol.open({url:Q}):window.location.assign(Q)}catch{Z.error(n("connectPayments.error"))}finally{v(!1)}}};return t.jsxs("div",{className:"flex-1 overflow-y-auto pb-6",children:[t.jsx(we,{title:n("connectPayments.title"),onBack:e}),t.jsxs("div",{className:"flex flex-col gap-4 px-5 pt-2",children:[t.jsx("p",{className:"text-sm text-muted-foreground",children:n("connectPayments.intro")}),t.jsxs("div",{className:"rounded-xl border border-border p-3",children:[t.jsx("p",{className:"text-sm font-semibold",children:n("connectPayments.orgSectionTitle")}),t.jsx("p",{className:"mt-1 mb-3 text-xs text-muted-foreground",children:n("connectPayments.orgSectionHint")}),t.jsx("div",{className:"grid grid-cols-3 gap-2",children:["individual","association","company"].map(K=>t.jsx("button",{type:"button",onClick:()=>S(K),className:X("rounded-lg border px-2 py-2 text-xs",T===K?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground"),children:n(`connectPayments.orgType.${K}`)},K))}),G&&t.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[t.jsx(be,{value:F,onChange:K=>D(K.target.value),placeholder:n("connectPayments.sirenPlaceholder"),inputMode:"numeric",maxLength:11}),t.jsx(be,{value:O,onChange:K=>R(K.target.value),placeholder:n("connectPayments.legalNamePlaceholder"),maxLength:200})]}),T==="individual"&&t.jsx("p",{className:"mt-2 text-xs text-amber-600 dark:text-amber-500",children:n("connectPayments.individualWarning")}),!r&&l&&t.jsx(ae,{variant:"outline",className:"mt-3 w-full",onClick:q,disabled:b,children:n("connectPayments.saveInfo")})]}),!r&&l&&t.jsxs("div",{className:"rounded-xl border border-border p-3",children:[t.jsx("p",{className:"text-sm font-semibold",children:n("connectPayments.terms.title")}),t.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:n("connectPayments.terms.intro")}),t.jsx("div",{className:"mt-2 max-h-44 overflow-y-auto rounded-lg border border-border bg-muted/40 p-2 text-[11px] leading-relaxed whitespace-pre-line text-muted-foreground",children:n("connectPayments.terms.body")}),L?t.jsx("p",{className:"mt-3 text-xs font-medium text-emerald-700 dark:text-emerald-400",children:n("connectPayments.terms.acceptedOn",{date:Ks(l.termsAcceptedAt)})}):t.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[t.jsxs("label",{className:"flex items-start gap-2 text-xs text-foreground",children:[t.jsx("input",{type:"checkbox",className:"mt-0.5 h-4 w-4 accent-primary",checked:h,onChange:K=>y(K.target.checked)}),t.jsx("span",{children:n("connectPayments.terms.checkboxLabel")})]}),t.jsx(ae,{variant:"outline",className:"w-full",onClick:g,disabled:!h||w,children:n("connectPayments.terms.acceptButton")})]})]}),r&&t.jsx("p",{className:"text-sm text-muted-foreground",children:n("connectPayments.loading")}),!r&&s&&t.jsx("div",{className:"rounded-xl border border-emerald-500/30 bg-emerald-500/10 p-4 text-sm text-emerald-700 dark:text-emerald-400",children:n("connectPayments.active")}),!r&&l&&!s&&t.jsxs("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm text-amber-700 dark:text-amber-500",children:[t.jsx("p",{children:n("connectPayments.pending")}),c.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"mt-2 font-semibold",children:n("connectPayments.stillNeeded")}),t.jsx("ul",{className:"mt-1 list-disc pl-5",children:c.map(K=>t.jsx("li",{children:n(K)},K))})]})]}),!r&&!s&&t.jsx(ae,{className:"w-full",onClick:$,disabled:d,children:n(l?"connectPayments.continue":"connectPayments.connect")}),!r&&l&&!s&&t.jsx("button",{type:"button",className:"self-center text-xs text-muted-foreground underline disabled:opacity-50",onClick:u,disabled:m,children:n("connectPayments.refresh")}),!r&&l&&t.jsx("button",{type:"button",className:"mt-2 self-center text-xs text-destructive underline disabled:opacity-50",onClick:V,disabled:p,children:n("connectPayments.disconnect")})]})]})}function it(a){const e=le.c(35),{icon:n,label:l,labelClass:s,iconBgClass:r,iconColorClass:i,isLast:c,onClick:x,badge:m,badgeClass:o,value:d,valueTestId:v,loading:u}
2=a,p=r===void 0?"bg-primary/10":r,f=i===void 0?"text-primary":i,b=c===void 0?!1:c,j=u===void 0?!1:u,h=!b&&"border-b border-border",y=j?"opacity-60 pointer-events-none":"cursor-pointer active:bg-card/80";let w;e[0]!==h||e[1]!==y?(w=X("py-3 px-4 flex items-center justify-between transition-colors",h,y),e[0]=h,e[1]=y,e[2]=w):w=e[2];const P=j?void 0:x;let L;e[3]!==p||e[4]!==f?(L=X("w-[34px] h-[34px] rounded-lg flex items-center justify-center text-base",f,p),e[3]=p,e[4]=f,e[5]=L):L=e[5];let g;e[6]!==n||e[7]!==L?(g=t.jsx("div",{className:L,children:n}),e[6]=n,e[7]=L,e[8]=g):g=e[8];const I=d&&"truncate";let S;e[9]!==s||e[10]!==I?(S=X("text-sm font-medium",I,s),e[9]=s,e[10]=I,e[11]=S):S=e[11];let B;e[12]!==l||e[13]!==S?(B=t.jsx("span",{className:S,children:l}),e[12]=l,e[13]=S,e[14]=B):B=e[14];let D;e[15]!==g||e[16]!==B?(D=t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[g,B]}),e[15]=g,e[16]=B,e[17]=D):D=e[17];let M;e[18]!==d||e[19]!==v?(M=d&&t.jsx("span",{"data-testid":v,className:"text-sm text-muted-foreground truncate",children:d}),e[18]=d,e[19]=v,e[20]=M):M=e[20];let R;e[21]!==m||e[22]!==o?(R=m&&t.jsx("span",{className:X("min-w-5 h-5 px-1.5 inline-flex items-center justify-center rounded-full text-xs font-semibold leading-none",o),children:m}),e[21]=m,e[22]=o,e[23]=R):R=e[23];let T;e[24]!==j?(T=j?t.jsx("span",{className:"w-4 h-4 shrink-0 border-2 border-primary border-t-transparent rounded-full animate-spin"}):t.jsx("span",{className:"text-muted-foreground text-base shrink-0",children:"âº"}),e[24]=j,e[25]=T):T=e[25];let F;e[26]!==M||e[27]!==R||e[28]!==T?(F=t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[M,R,T]}),e[26]=M,e[27]=R,e[28]=T,e[29]=F):F=e[29];let O;return e[30]!==D||e[31]!==F||e[32]!==w||e[33]!==P?(O=t.jsxs("div",{className:w,onClick:P,children:[D,F]}),e[30]=D,e[31]=F,e[32]=w,e[33]=P,e[34]=O):O=e[34],O}function pa(a){const e=le.c(108),{currentUser:n,onBack:l,onOpenIdentityVerification:s}=a,{t:r}=oe(),{updateProfile:i}=kt(),c=n.emergencyContactName??"",x=n.emergencyContactPhone??"",m=n.emergencyContactRelation??"";let o;e[0]!==c||e[1]!==x||e[2]!==m?(o={emergencyContactName:c,emergencyContactPhone:x,emergencyContactRelation:m},e[0]=c,e[1]=x,e[2]=m,e[3]=o):o=e[3];const[d,v]=U.useState(o),[u,p]=U.useState(!1);let f;e[4]!==d.emergencyContactName||e[5]!==d.emergencyContactPhone||e[6]!==d.emergencyContactRelation||e[7]!==l||e[8]!==r||e[9]!==i?(f=async()=>{const he=d.emergencyContactName.trim(),fe=d.emergencyContactPhone.trim(),Ue=d.emergencyContactRelation.trim();if(!he&&fe){Z.error(r("emergencyContact.nameRequired"));return}if(he&&!fe){Z.error(r("emergencyContact.phoneRequired"));return}p(!0);const{error:ve}=await i({emergency_contact_name:he||null,emergency_contact_phone:fe||null,emergency_contact_relation:Ue||null});if(p(!1),ve){Z.error(r("profileSub.updateError"));return}Z.success(r("emergencyContact.saved")),l()},e[4]=d.emergencyContactName,e[5]=d.emergencyContactPhone,e[6]=d.emergencyContactRelation,e[7]=l,e[8]=r,e[9]=i,e[10]=f):f=e[10];const b=f;let j;e[11]!==r?(j=r("profileMenu.security"),e[11]=r,e[12]=j):j=e[12];let h;e[13]!==l||e[14]!==j?(h=t.jsx(we,{title:j,onBack:l}),e[13]=l,e[14]=j,e[15]=h):h=e[15];let y;e[16]!==r?(y=r("emergencyContact.title"),e[16]=r,e[17]=y):y=e[17];let w;e[18]!==y?(w=t.jsx("h3",{className:"text-sm font-semibold",children:y}),e[18]=y,e[19]=w):w=e[19];let P;e[20]!==r?(P=r("emergencyContact.subtitle"),e[20]=r,e[21]=P):P=e[21];let L;e[22]!==P?(L=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:P}),e[22]=P,e[23]=L):L=e[23];let g;e[24]!==L||e[25]!==w?(g=t.jsxs("div",{children:[w,L]}),e[24]=L,e[25]=w,e[26]=g):g=e[26];let I;e[27]!==r?(I=r("emergencyContact.nameLabel"),e[27]=r,e[28]=I):I=e[28];let S;e[29]!==I?(S=t.jsx("label",{htmlFor:"sec-emerg-name",className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:I}),e[29]=I,e[30]=S):S=e[30];const B=d.emergencyContactName;let D;e[31]!==d?(D=he=>v({...d,emergencyContactName:he.target.value}),e[31]=d,e[32]=D):D=e[32];let M;e[33]!==r?(M=r("emergencyContact.namePlaceholder"),e[33]=r,e[34]=M):M=e[34];let R;e[35]!==d.emergencyContactName||e[36]!==D||e[37]!==M?(R=t.jsx(be,{id:"sec-emerg-name",value:B,onChange:D,placeholder:M,autoComplete:"off","data-1p-ignore":!0,"data-lpignore":"true","data-form-type":"other"}),e[35]=d.emergencyContactName,e[36]=D,e[37]=M,e[38]=R):R=e[38];let T;e[39]!==S||e[40]!==R?(T=t.jsxs("div",{children:[S,R]}),e[39]=S,e[40]=R,e[41]=T):T=e[41];let F;e[42]!==r?(F=r("emergencyContact.phoneLabel"),e[42]=r,e[43]=F):F=e[43];let O;e[44]!==F?(O=t.jsx("label",{htmlFor:"sec-emerg-phone",className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:F}),e[44]=F,e[45]=O):O=e[45];const G=d.emergencyContactPhone;let E;e[46]!==d?(E=he=>v({...d,emergencyContactPhone:he.target.value}),e[46]=d,e[47]=E):E=e[47];let q;e[48]!==r?(q=r("emergencyContact.phonePlaceholder"),e[48]=r,e[49]=q):q=e[49];let V;e[50]!==d.emergencyContactPhone||e[51]!==E||e[52]!==q?(V=t.jsx(be,{id:"sec-emerg-phone",type:"tel",value:G,onChange:E,placeholder:q,autoComplete:"off","data-1p-ignore":!0,"data-lpignore":"true","data-form-type":"other"}),e[50]=d.emergencyContactPhone,e[51]=E,e[52]=q,e[53]=V):V=e[53];let $;e[54]!==O||e[55]!==V?($=t.jsxs("div",{children:[O,V]}),e[54]=O,e[55]=V,e[56]=$):$=e[56];let K;e[57]!==r?(K=r("emergencyContact.relationLabel"),e[57]=r,e[58]=K):K=e[58];let C;e[59]!==K?(C=t.jsx("label",{htmlFor:"sec-emerg-relation",className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:K}),e[59]=K,e[60]=C):C=e[60];const Q=d.emergencyContactRelation;let J;e[61]!==d?(J=he=>v({...d,emergencyContactRelation:he.target.value}),e[61]=d,e[62]=J):J=e[62];let N;e[63]!==r?(N=r("emergencyContact.relationPlaceholder"),e[63]=r,e[64]=N):N=e[64];let A;e[65]!==d.emergencyContactRelation||e[66]!==J||e[67]!==N?(A=t.jsx(be,{id:"sec-emerg-relation",value:Q,onChange:J,placeholder:N,autoComplete:"off","data-1p-ignore":!0,"data-lpignore":"true","data-form-type":"other"}),e[65]=d.emergencyContactRelation,e[66]=J,e[67]=N,e[68]=A):A=e[68];let k;e[69]!==C||e[70]!==A?(k=t.jsxs("div",{children:[C,A]}),e[69]=C,e[70]=A,e[71]=k):k=e[71];let H;e[72]!==r?(H=r("emergencyContact.sectionDescription"),e[72]=r,e[73]=H):H=e[73];let ee;e[74]!==H?(ee=t.jsx("p",{className:"text-xs text-muted-foreground",children:H}),e[74]=H,e[75]=ee):ee=e[75];let Y;e[76]!==g||e[77]!==T||e[78]!==$||e[79]!==k||e[80]!==ee?(Y=t.jsx(ne,{className:"p-5",children:t.jsxs("div",{className:"flex flex-col gap-3",children:[g,T,$,k,ee]})}),e[76]=g,e[77]=T,e[78]=$,e[79]=k,e[80]=ee,e[81]=Y):Y=e[81];let te;
2e[82]===Symbol.for("react.memo_cache_sentinel")?(te=t.jsx(Bn,{}),e[82]=te):te=e[82];let z;e[83]!==r?(z=r("security.identityVerification"),e[83]=r,e[84]=z):z=e[84];let se;e[85]!==n.identityVerified||e[86]!==r?(se=n.identityVerified?r("security.identityVerified"):void 0,e[85]=n.identityVerified,e[86]=r,e[87]=se):se=e[87];let re;e[88]!==s||e[89]!==z||e[90]!==se?(re=t.jsx(ne,{className:"overflow-hidden",children:t.jsx(it,{icon:te,label:z,badge:se,badgeClass:"bg-emerald-500/15 text-emerald-600",onClick:s,isLast:!0})}),e[88]=s,e[89]=z,e[90]=se,e[91]=re):re=e[91];let ie;e[92]!==Y||e[93]!==re?(ie=t.jsxs("div",{className:"px-4 pb-4 flex flex-col gap-4 mt-2",children:[Y,re]}),e[92]=Y,e[93]=re,e[94]=ie):ie=e[94];let de;e[95]!==ie||e[96]!==h?(de=t.jsxs("div",{className:"flex-1 overflow-y-auto",children:[h,ie]}),e[95]=ie,e[96]=h,e[97]=de):de=e[97];let ue;e[98]!==u||e[99]!==r?(ue=r(u?"emergencyContact.saving":"common.save"),e[98]=u,e[99]=r,e[100]=ue):ue=e[100];let me;e[101]!==b||e[102]!==u||e[103]!==ue?(me=t.jsx("div",{className:"shrink-0 bg-background/95 backdrop-blur-lg border-t border-border p-4",children:t.jsx(ae,{className:"w-full",onClick:b,disabled:u,children:ue})}),e[101]=b,e[102]=u,e[103]=ue,e[104]=me):me=e[104];let je;return e[105]!==de||e[106]!==me?(je=t.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[de,me]}),e[105]=de,e[106]=me,e[107]=je):je=e[107],je}function ba(a,e){return new Date(2024,0,1+tl.indexOf(a)).toLocaleDateString(e,{weekday:"long"})}function ha(a){const e=le.c(66),{sports:n,sport:l,onSelectSport:s,value:r,onChange:i}=a,{t:c,i18n:x}=oe();let m;e[0]!==r.cells?(m=new Set(r.cells.map(os)),e[0]=r.cells,e[1]=m):m=e[1];const o=m;let d;e[2]!==o||e[3]!==i||e[4]!==r.cells?(d=C=>{const Q=os(C),J=o.has(Q)?r.cells.filter(N=>os(N)!==Q):ki([...r.cells,C]);i({cells:J,varies:!1})},e[2]=o,e[3]=i,e[4]=r.cells,e[5]=d):d=e[5];const v=d;let u;e[6]!==i?(u=C=>{i({cells:[],varies:C})},e[6]=i,e[7]=u):u=e[7];const p=u;let f;e[8]!==s?(f=C=>()=>{s(C)},e[8]=s,e[9]=f):f=e[9];const b=f;let j;e[10]!==v?(j=C=>()=>{v(C)},e[10]=v,e[11]=j):j=e[11];const h=j;let y;e[12]!==c?(y=c("sportMoments.editorTitle"),e[12]=c,e[13]=y):y=e[13];let w;e[14]!==y?(w=t.jsx("h3",{className:"text-sm font-semibold",children:y}),e[14]=y,e[15]=w):w=e[15];let P;e[16]!==c?(P=c("sportMoments.editorHint"),e[16]=c,e[17]=P):P=e[17];let L;e[18]!==P?(L=t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:P}),e[18]=P,e[19]=L):L=e[19];let g;e[20]!==w||e[21]!==L?(g=t.jsxs("div",{children:[w,L]}),e[20]=w,e[21]=L,e[22]=g):g=e[22];let I;e[23]!==b||e[24]!==l||e[25]!==n||e[26]!==c?(I=n.length>1&&t.jsx("div",{role:"group","aria-label":c("sportMoments.editorSport"),className:"flex gap-1.5 flex-wrap",children:n.map(C=>t.jsx("button",{type:"button","aria-pressed":C===l,onClick:b(C),className:X("px-3 py-1.5 rounded-full border text-xs font-medium cursor-pointer transition-all",C===l?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),children:c(`sport.${C}.label`)},C))}),e[23]=b,e[24]=l,e[25]=n,e[26]=c,e[27]=I):I=e[27];let S;e[28]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx("th",{scope:"col",className:"w-10"}),e[28]=S):S=e[28];let B;e[29]!==c?(B=vn.map(C=>t.jsx("th",{scope:"col",className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide",children:c(`intentions.daypart.${C}.label`)},C)),e[29]=c,e[30]=B):B=e[30];let D;e[31]!==B?(D=t.jsx("thead",{children:t.jsxs("tr",{children:[S,B]})}),e[31]=B,e[32]=D):D=e[32];let M;e[33]!==o||e[34]!==h||e[35]!==x||e[36]!==c||e[37]!==r.varies?(M=tl.map(C=>t.jsxs("tr",{children:[t.jsx("th",{scope:"row",className:"text-xs font-medium text-left pr-1",children:c(`weekGrid.weekdayShort.${C}`)}),vn.map(Q=>{const J={day:C,daypart:Q},N=o.has(os(J));return t.jsx("td",{children:t.jsx("button",{type:"button","aria-pressed":N,"aria-label":c("sportMoments.cellLabel",{day:ba(C,x.language),moment:c(`intentions.daypart.${Q}.label`)}),disabled:r.varies,onClick:h(J),className:X("h-9 w-full rounded-lg border transition-colors disabled:cursor-not-allowed disabled:opacity-40",N?"bg-primary border-primary":"bg-card border-border hover:border-primary/50")})},Q)})]},C)),e[33]=o,e[34]=h,e[35]=x,e[36]=c,e[37]=r.varies,e[38]=M):M=e[38];let R;e[39]!==M?(R=t.jsx("tbody",{children:M}),e[39]=M,e[40]=R):R=e[40];let T;e[41]!==D||e[42]!==R?(T=t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full border-separate border-spacing-1",children:[D,R]})}),e[41]=D,e[42]=R,e[43]=T):T=e[43];let F;e[44]!==c?(F=c("sportMoments.varies"),e[44]=c,e[45]=F):F=e[45];let O;e[46]!==F?(O=t.jsx("p",{id:"sport-moments-varies",className:"text-sm font-medium",children:F}),e[46]=F,e[47]=O):O=e[47];let G;e[48]!==c?(G=c("sportMoments.variesHint"),e[48]=c,e[49]=G):G=e[49];let E;e[50]!==G?(E=t.jsx("p",{className:"text-xs text-muted-foreground",children:G}),e[50]=G,e[51]=E):E=e[51];let q;e[52]!==O||e[53]!==E?(q=t.jsxs("div",{children:[O,E]}),e[52]=O,e[53]=E,e[54]=q):q=e[54];let V;e[55]!==p||e[56]!==r.varies?(V=t.jsx(Dn,{checked:r.varies,onCheckedChange:p,"aria-labelledby":"sport-moments-varies"}),e[55]=p,e[56]=r.varies,e[57]=V):V=e[57];let $;e[58]!==q||e[59]!==V?($=t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[q,V]}),e[58]=q,e[59]=V,e[60]=$):$=e[60];let K;return e[61]!==g||e[62]!==I||e[63]!==T||e[64]!==$?(K=t.jsxs("div",{className:"flex flex-col gap-4",children:[g,I,T,$]}),e[61]=g,e[62]=I,e[63]=T,e[64]=$,e[65]=K):K=e[65],K}const wn={cells:[],varies:!1};function ga({currentUser:a,onBack:e}){const{t:n}=oe(),{updateProfile:l}=kt(),[s,r]=U.useState({isAvailable:a.isAvailable??!0,contactGenderPref:a.contactGenderPref??"everyone",dmPrivacy:a.dmPrivacy??"everyone",searchableByName:a.searchableByName??!0,profileVisibility:a.profileVisibility??"public",suggestable:a.suggestable!==!1}),i=U.useMemo(()=>(a.onboardingCompletedSports??[]).filter($l),[a.onboardingCompletedSports]),c=i.length>0,{moments:x,save:m}=Ni(c?a.id:null),[o,d]=U.useState({}),[v,u]=U.useState(null),p=Ze(),f=v??(i.includes(p)?p:i[0]??null),b=f?o[f]??x[f]??wn:wn,j=y=>{f&&d(w=>({...w,[f]:y}))},h=async()=>
2{if((await l({is_available:s.isAvailable,contact_gender_pref:s.contactGenderPref,dm_privacy:s.dmPrivacy,searchable_by_name:s.searchableByName,profile_visibility:s.profileVisibility,suggestable:s.suggestable})).error){Z.error(n("profileSub.updateError"));return}if(c)try{for(const[w,P]of Object.entries(o))await m(w,P)}catch{Z.error(n("sportMoments.saveError"));return}Z.success(n("profileSub.profileUpdated")),e()};return t.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[t.jsxs("div",{className:"flex-1 overflow-y-auto",children:[t.jsx(we,{title:n("profileMenu.privacyAvailability"),onBack:e}),t.jsxs("div",{className:"px-4 pb-4 flex flex-col gap-4 mt-2",children:[t.jsx(ne,{className:"p-5",children:t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-semibold",children:s.isAvailable?n("profileSub.available"):n("profileSub.paused")}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:s.isAvailable?n("profileSub.availableDesc"):n("profileSub.pausedDesc")})]}),t.jsx("button",{type:"button",role:"switch","aria-checked":s.isAvailable,onClick:()=>r({...s,isAvailable:!s.isAvailable}),className:X("relative shrink-0 w-11 h-6 rounded-full transition-colors",s.isAvailable?"bg-primary":"bg-muted"),children:t.jsx("span",{className:X("absolute top-0.5 left-0.5 w-5 h-5 rounded-full bg-white shadow transition-transform",s.isAvailable?"translate-x-5":"translate-x-0")})})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:n("profileSub.profileVisibility")}),t.jsx("div",{className:"flex flex-col gap-1.5",children:[{value:"public",label:n("profileSub.profilePublic"),desc:n("profileSub.profilePublicDesc")},{value:"private",label:n("profileSub.profilePrivate"),desc:n("profileSub.profilePrivateDesc")}].map(y=>t.jsxs("button",{type:"button","data-testid":`privacy-visibility-${y.value}`,className:X("flex items-start gap-3 px-3 py-2.5 rounded-lg border text-left cursor-pointer transition-all",s.profileVisibility===y.value?"bg-primary/10 border-primary":"bg-card border-border hover:border-primary/50"),onClick:()=>r({...s,profileVisibility:y.value}),children:[t.jsx("span",{className:X("mt-0.5 shrink-0 w-4 h-4 rounded-full border-2 flex items-center justify-center",s.profileVisibility===y.value?"border-primary":"border-muted-foreground/40"),children:s.profileVisibility===y.value&&t.jsx("span",{className:"w-2 h-2 rounded-full bg-primary"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium leading-none",children:y.label}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:y.desc})]})]},y.value))}),s.profileVisibility==="private"&&t.jsxs("div",{"data-testid":"privacy-visibility-note",className:"mt-2.5 rounded-lg border border-border bg-secondary/40 px-3 py-2.5",children:[t.jsx("p",{className:"text-[13px] leading-snug",children:n("profileSub.profileVisibilityKept")}),t.jsx("p",{className:"text-[13px] leading-snug mt-1.5 text-muted-foreground",children:n("profileSub.profileVisibilityCost")})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:n("profileSub.suggestions")}),t.jsx("div",{className:"flex flex-col gap-1.5",children:[{value:!0,label:n("profileSub.suggestionsOn"),desc:n("profileSub.suggestionsOnDesc")},{value:!1,label:n("profileSub.suggestionsOff"),desc:n("profileSub.suggestionsOffDesc")}].map(y=>t.jsxs("button",{type:"button","data-testid":`privacy-suggestable-${y.value}`,className:X("flex items-start gap-3 px-3 py-2.5 rounded-lg border text-left cursor-pointer transition-all",s.suggestable===y.value?"bg-primary/10 border-primary":"bg-card border-border hover:border-primary/50"),onClick:()=>r({...s,suggestable:y.value}),children:[t.jsx("span",{className:X("mt-0.5 shrink-0 w-4 h-4 rounded-full border-2 flex items-center justify-center",s.suggestable===y.value?"border-primary":"border-muted-foreground
2/40"),children:s.suggestable===y.value&&t.jsx("span",{className:"w-2 h-2 rounded-full bg-primary"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium leading-none",children:y.label}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:y.desc})]})]},String(y.value)))}),!s.suggestable&&t.jsx("div",{"data-testid":"privacy-suggestable-note",className:"mt-2.5 rounded-lg border border-border bg-secondary/40 px-3 py-2.5",children:t.jsx("p",{className:"text-[13px] leading-snug",children:n("profileSub.suggestionsOffKept")})})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:n("profileSub.whoCanContact")}),t.jsx("div",{className:"flex gap-2",children:[{value:"everyone",label:n("profileSub.everyone"),Icon:Vn},{value:"women_only",label:n("profileSub.womenOnly"),Icon:y=>t.jsx(Mt,{name:"venus",className:y.className})},{value:"men_only",label:n("profileSub.menOnly"),Icon:ll}].map(y=>t.jsxs("button",{type:"button",className:X("flex-1 flex items-center justify-center gap-1.5 px-2 py-2 rounded-lg border text-xs font-medium cursor-pointer transition-all",s.contactGenderPref===y.value?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>r({...s,contactGenderPref:y.value}),children:[t.jsx(y.Icon,{className:"w-4 h-4"}),y.label]},y.value))}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:n("profileSub.contactFilterDesc")})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:n("profileSub.directMessages")}),t.jsx("div",{className:"flex flex-col gap-1.5",children:[{value:"everyone",label:n("profileSub.dmEveryone"),desc:n("profileSub.dmEveryoneDesc")},{value:"connections_only",label:n("profileSub.dmConnectionsOnly"),desc:n("profileSub.dmConnectionsDesc",{sessionLabelPlural:qe(Ze()).sessionLabelPlural,SessionLabelPlural:qe(Ze()).SessionLabelPlural})},{value:"disabled",label:n("profileSub.dmDisabled"),desc:n("profileSub.dmDisabledDesc")}].map(y=>t.jsxs("button",{type:"button",className:X("flex items-start gap-3 px-3 py-2.5 rounded-lg border text-left cursor-pointer transition-all",s.dmPrivacy===y.value?"bg-primary/10 border-primary":"bg-card border-border hover:border-primary/50"),onClick:()=>r({...s,dmPrivacy:y.value}),children:[t.jsx("span",{className:X("mt-0.5 shrink-0 w-4 h-4 rounded-full border-2 flex items-center justify-center",s.dmPrivacy===y.value?"border-primary":"border-muted-foreground/40"),children:s.dmPrivacy===y.value&&t.jsx("span",{className:"w-2 h-2 rounded-full bg-primary"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium leading-none",children:y.label}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:y.desc})]})]},y.value))})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:n("profileSub.nameSearch")}),t.jsx("div",{className:"flex flex-col gap-1.5",children:[{value:!0,label:n("profileSub.nameSearchOn"),desc:n("profileSub.nameSearchOnDesc")},{value:!1,label:n("profileSub.nameSearchOff"),desc:n("profileSub.nameSearchOffDesc")}].map(y=>t.jsxs("button",{type:"button",className:X("flex items-start gap-3 px-3 py-2.5 rounded-lg border text-left cursor-pointer transition-all",s.searchableByName===y.value?"bg-primary/10 border-primary":"bg-card border-border hover:border-primary/50"),onClick:()=>r({...s,searchableByName:y.value}),children:[t.jsx("span",{className:X("mt-0.5 shrink-0 w-4 h-4 rounded-full border-2 flex items-center justify-center",s.searchableByName===y.value?"border-primary":"border-muted-foreground/40"),children:s.searchableByName===y.value&&t.jsx("span",{className:"w-2 h-2 rounded-full bg-primary"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium leading-none",children:y.label}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:y.desc})]})]},String(y.value)))})]})]})}),c&&f&&t.jsx(ne,{className:"p-5",children:t.jsx(ha,{sports:i,sport:f,onSelectSport:u,value:b,onChange:j})})]})]}),t.jsx("div",{className:"shrink-0 bg-background/95 backdrop-blur-lg border-t border-border p-4",children:t.jsx(ae,{className:"w-full",onClick:h,children:n("common.save")})})]})}function Cn(a){const e=le.c(4),{className:n}=a;let l,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("path",{d:"M5 12h14"}),s=t.jsx("path",{d:"m12 5 7 7-7 7"}),e[0]=l,e[1]=s):(l=e[0],s=e[1]);let r;return e[2]!==n?(r=t.jsxs(Qt,{className:n,children:[l,s]}),e[2]=n,e[3]=r):r=e[3],r}const va=[{value:2,labelKey:"intentions.profile.runningMinPartners.optionTwo",defaultLabel:"OK Ã 2 personnes"},{value:3,labelKey:"intentions.profile.runningMinPartners.optionThree",defaultLabel:"Au moins 3 personnes"}];function ya(){const a=le.c(21),{t:e}=oe(),{value:n,saving:l,setValue:s}=Kl();if(n===null)return null;let r;a[0]!==e?(r=e("intentions.profile.runningMinPartners.title",{defaultValue:"Sorties running"}),a[0]=e,a[1]=r):r=a[1];let i;a[2]!==r?(i=t.jsx("h3",{className:"text-sm font-semibold",children:r}),a[2]=r,a[3]=i):i=a[3];let c;a[4]!==e?(c=e("intentions.profile.runningMinPartners.help",{defaultValue:"Ã partir de combien de personnes tu acceptes une sortie running compatible ?"}),a[4]=e,a[5]=c):c=a[5];let x;a[6]!==c?(x=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:c}),a[6]=c,a[7]=x):x=a[7];let m;a[8]!==i||a[9]!==x?(m=t.jsxs("div",{children:[i,x]}),a[8]=i,a[9]=x,a[10]=m):m=a[10];let o;a[11]!==l||a[12]!==s||a[13]!==e||a[14]!==n?(o=va.map(u=>{const p=n===u.value;return t.jsxs("button",{type:"button",role:"radio","aria-checked":p,"aria-label":e(u.labelKey,{defaultValue:u.defaultLabel}),disabled:l,onClick:()=>{s(u.value)},className:X("flex items-center gap-3 rounded-md border p-3 text-left text-sm",p?"border-primary bg-primary/5":"border-border bg-background"),children:[t.jsx("span",{"aria-hidden":!0,
2className:X("inline-flex h-4 w-4 items-center justify-center rounded-full border",p?"bg-primary border-primary":"border-border"),children:p?t.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-primary-foreground"}):null}),t.jsx("span",{children:e(u.labelKey,{defaultValue:u.defaultLabel})})]},u.value)}),a[11]=l,a[12]=s,a[13]=e,a[14]=n,a[15]=o):o=a[15];let d;a[16]!==o?(d=t.jsx("div",{className:"flex flex-col gap-2",role:"radiogroup","aria-label":"running-min-partners",children:o}),a[16]=o,a[17]=d):d=a[17];let v;return a[18]!==m||a[19]!==d?(v=t.jsxs(ne,{"data-testid":"running-min-partners-toggle",className:"p-4 flex flex-col gap-3",children:[m,d]}),a[18]=m,a[19]=d,a[20]=v):v=a[20],v}const Wt="block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5";function il(a){return X("px-3 py-1.5 rounded-full border text-xs font-medium cursor-pointer transition-all inline-flex items-center gap-1.5",a?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50")}function ds(a){const e=le.c(11),{options:n,isSelected:l,onPick:s}=a,{t:r}=oe();let i;if(e[0]!==l||e[1]!==s||e[2]!==n||e[3]!==r){let x;e[5]!==l||e[6]!==s||e[7]!==r?(x=m=>t.jsxs("button",{type:"button","aria-pressed":l(m.value),className:il(l(m.value)),onClick:()=>s(m.value),children:[t.jsx(pt,{name:m.icon,className:"w-4 h-4 shrink-0"}),r(m.labelKey)]},m.value),e[5]=l,e[6]=s,e[7]=r,e[8]=x):x=e[8],i=n.map(x),e[0]=l,e[1]=s,e[2]=n,e[3]=r,e[4]=i}else i=e[4];let c;return e[9]!==i?(c=t.jsx("div",{className:"flex gap-1.5 flex-wrap",children:i}),e[9]=i,e[10]=c):c=e[10],c}function ja(a){const e=le.c(113),{value:n,onChange:l,userId:s}=a,{t:r}=oe(),i=sl("fitness");let c;e[0]!==l||e[1]!==n?(c=z=>{const se=Is(n.fitnessVenue,z),re=se==="gym"?n.fitnessGymId:null;l({...n,fitnessVenue:se,fitnessGymId:re})},e[0]=l,e[1]=n,e[2]=c):c=e[2];const x=c;let m;e[3]!==l||e[4]!==n?(m=z=>{l({...n,fitnessGymId:z?Number(z):null})},e[3]=l,e[4]=n,e[5]=m):m=e[5];const o=m;let d;e[6]!==r?(d=r("sportProfile.fitnessDisciplines"),e[6]=r,e[7]=d):d=e[7];let v;e[8]!==d?(v=t.jsx("label",{className:Wt,children:d}),e[8]=d,e[9]=v):v=e[9];let u;e[10]!==r?(u=r("sportProfile.fitnessDisciplinesHint"),e[10]=r,e[11]=u):u=e[11];let p;e[12]!==u?(p=t.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:u}),e[12]=u,e[13]=p):p=e[13];let f;e[14]!==l||e[15]!==r||e[16]!==n?(f=zl.map(z=>t.jsxs("button",{type:"button",className:il(n.preferredFitnessDisciplines.includes(z)),onClick:()=>l({...n,preferredFitnessDisciplines:Hl(n.preferredFitnessDisciplines,z)}),children:[t.jsx(pt,{name:ql[z],className:"w-4 h-4 shrink-0"}),r(Gl[z])]},z)),e[14]=l,e[15]=r,e[16]=n,e[17]=f):f=e[17];let b;e[18]!==f?(b=t.jsx("div",{className:"flex gap-1.5 flex-wrap",children:f}),e[18]=f,e[19]=b):b=e[19];let j;e[20]!==v||e[21]!==p||e[22]!==b?(j=t.jsxs(ne,{className:"p-5",children:[v,p,b]}),e[20]=v,e[21]=p,e[22]=b,e[23]=j):j=e[23];let h;e[24]!==r?(h=r("sportProfile.fitnessVenue"),e[24]=r,e[25]=h):h=e[25];let y;e[26]!==h?(y=t.jsx("label",{className:Wt,children:h}),e[26]=h,e[27]=y):y=e[27];let w;e[28]!==r?(w=r("sportProfile.fitnessVenueHint"),e[28]=r,e[29]=w):w=e[29];let P;e[30]!==w?(P=t.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:w}),e[30]=w,e[31]=P):P=e[31];let L;e[32]!==n.fitnessVenue?(L=z=>n.fitnessVenue===z,e[32]=n.fitnessVenue,e[33]=L):L=e[33];let g;e[34]!==x||e[35]!==L?(g=t.jsx(ds,{options:Wl,isSelected:L,onPick:x}),e[34]=x,e[35]=L,e[36]=g):g=e[36];let I;e[37]!==o||e[38]!==i||e[39]!==r||e[40]!==s||e[41]!==n.fitnessGymId||e[42]!==n.fitnessVenue?(I=n.fitnessVenue==="gym"&&i&&t.jsx("div",{className:"mt-3",children:t.jsx(Ei,{sport:"fitness",userId:s,value:n.fitnessGymId!=null?String(n.fitnessGymId):"",onChange:o,placeholder:r("sportProfile.fitnessGymPlaceholder")})}),e[37]=o,e[38]=i,e[39]=r,e[40]=s,e[41]=n.fitnessGymId,e[42]=n.fitnessVenue,e[43]=I):I=e[43];let S;e[44]!==i||e[45]!==r||e[46]!==n.fitnessGymId||e[47]!==n.fitnessVenue?(S=n.fitnessVenue==="gym"&&!i&&n.fitnessGymId==null&&t.jsx("p",{className:"text-xs text-muted-foreground mt-3",children:r("sportProfile.fitnessNoGym")}),e[44]=i,e[45]=r,e[46]=n.fitnessGymId,e[47]=n.fitnessVenue,e[48]=S):S=e[48];let B;e[49]!==y||e[50]!==P||e[51]!==g||e[52]!==I||e[53]!==S?(B=t.jsxs("div",{children:[y,P,g,I,S]}),e[49]=y,e[50]=P,e[51]=g,e[52]=I,e[53]=S,e[54]=B):B=e[54];let D;e[55]!==r?(D=r("sportProfile.fitnessFrequency"),e[55]=r,e[56]=D):D=e[56];let M;e[57]!==D?(M=t.jsx("label",{className:Wt,children:D}),e[57]=D,e[58]=M):M=e[58];let R;e[59]!==n.fitnessFrequency?(R=z=>n.fitnessFrequency===z,e[59]=n.fitnessFrequency,e[60]=R):R=e[60];let T;e[61]!==l||e[62]!==n?(T=z=>l({...n,fitnessFrequency:Is(n.fitnessFrequency,z)}),e[61]=l,e[62]=n,e[63]=T):T=e[63];let F;e[64]!==R||e[65]!==T?(F=t.jsx(ds,{options:Yl,isSelected:R,onPick:T}),e[64]=R,e[65]=T,e[66]=F):F=e[66];let O;e[67]!==M||e[68]!==F?(O=t.jsxs("div",{children:[M,F]}),e[67]=M,e[68]=F,e[69]=O):O=e[69];let G;e[70]!==r?(G=r("sportProfile.fitnessExperience"),e[70]=r,e[71]=G):G=e[71];let E;e[72]!==G?(E=t.jsx("label",{className:Wt,children:G}),e[72]=G,e[73]=E):E=e[73];let q;e[74]!==n.fitnessExperience?(q=z=>
2n.fitnessExperience===z,e[74]=n.fitnessExperience,e[75]=q):q=e[75];let V;e[76]!==l||e[77]!==n?(V=z=>l({...n,fitnessExperience:Is(n.fitnessExperience,z)}),e[76]=l,e[77]=n,e[78]=V):V=e[78];let $;e[79]!==q||e[80]!==V?($=t.jsx(ds,{options:Ql,isSelected:q,onPick:V}),e[79]=q,e[80]=V,e[81]=$):$=e[81];let K;e[82]!==E||e[83]!==$?(K=t.jsxs("div",{children:[E,$]}),e[82]=E,e[83]=$,e[84]=K):K=e[84];let C;e[85]!==r?(C=r("sportProfile.fitnessGoals"),e[85]=r,e[86]=C):C=e[86];let Q;e[87]!==C?(Q=t.jsx("label",{className:Wt,children:C}),e[87]=C,e[88]=Q):Q=e[88];let J;e[89]!==r?(J=r("sportProfile.fitnessGoalsHint"),e[89]=r,e[90]=J):J=e[90];let N;e[91]!==J?(N=t.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:J}),e[91]=J,e[92]=N):N=e[92];let A;e[93]!==n.fitnessGoals?(A=z=>n.fitnessGoals.includes(z),e[93]=n.fitnessGoals,e[94]=A):A=e[94];let k;e[95]!==l||e[96]!==n?(k=z=>l({...n,fitnessGoals:Xl(n.fitnessGoals,z)}),e[95]=l,e[96]=n,e[97]=k):k=e[97];let H;e[98]!==A||e[99]!==k?(H=t.jsx(ds,{options:Zl,isSelected:A,onPick:k}),e[98]=A,e[99]=k,e[100]=H):H=e[100];let ee;e[101]!==Q||e[102]!==N||e[103]!==H?(ee=t.jsxs("div",{children:[Q,N,H]}),e[101]=Q,e[102]=N,e[103]=H,e[104]=ee):ee=e[104];let Y;e[105]!==B||e[106]!==O||e[107]!==K||e[108]!==ee?(Y=t.jsx(ne,{className:"p-5",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[B,O,K,ee]})}),e[105]=B,e[106]=O,e[107]=K,e[108]=ee,e[109]=Y):Y=e[109];let te;return e[110]!==Y||e[111]!==j?(te=t.jsxs(t.Fragment,{children:[j,Y]}),e[110]=Y,e[111]=j,e[112]=te):te=e[112],te}function Na(a){const e=le.c(240),{currentUser:n,onBack:l}=a,{t:s}=oe(),{updateProfile:r,patchProfileLocal:i}=kt(),c=Ze(),x=qe(c);let m;e[0]!==s?(m=s("sportProfile.elevationFlat"),e[0]=s,e[1]=m):m=e[1];let o;e[2]!==s?(o=s("sportProfile.elevationFlatDesc"),e[2]=s,e[3]=o):o=e[3];let d;e[4]!==m||e[5]!==o?(d={value:"flat",Icon:Cn,label:m,description:o},e[4]=m,e[5]=o,e[6]=d):d=e[6];let v;e[7]!==s?(v=s("sportProfile.elevationModerate"),e[7]=s,e[8]=v):v=e[8];let u;e[9]!==s?(u=s("sportProfile.elevationModerateDesc"),e[9]=s,e[10]=u):u=e[10];let p;e[11]!==v||e[12]!==u?(p={value:"moderate",Icon:cn,label:v,description:u},e[11]=v,e[12]=u,e[13]=p):p=e[13];let f;e[14]!==s?(f=s("sportProfile.elevationHilly"),e[14]=s,e[15]=f):f=e[15];let b;e[16]!==s?(b=s("sportProfile.elevationHillyRunDesc"),e[16]=s,e[17]=b):b=e[17];let j;e[18]!==f||e[19]!==b?(j={value:"hilly",Icon:dn,label:f,description:b},e[18]=f,e[19]=b,e[20]=j):j=e[20];let h;e[21]!==d||e[22]!==p||e[23]!==j?(h=[d,p,j],e[21]=d,e[22]=p,e[23]=j,e[24]=h):h=e[24];const y=h;let w;e[25]!==s?(w=s("sportProfile.elevationFlat"),e[25]=s,e[26]=w):w=e[26];let P;e[27]!==s?(P=s("sportProfile.elevationFlatDesc"),e[27]=s,e[28]=P):P=e[28];let L;e[29]!==w||e[30]!==P?(L={value:"flat",Icon:Cn,label:w,description:P},e[29]=w,e[30]=P,e[31]=L):L=e[31];let g;e[32]!==s?(g=s("sportProfile.elevationModerate"),e[32]=s,e[33]=g):g=e[33];let I;e[34]!==s?(I=s("sportProfile.elevationModerateDesc"),e[34]=s,e[35]=I):I=e[35];let S;e[36]!==g||e[37]!==I?(S={value:"moderate",Icon:cn,label:g,description:I},e[36]=g,e[37]=I,e[38]=S):S=e[38];let B;e[39]!==s?(B=s("sportProfile.elevationHilly"),e[39]=s,e[40]=B):B=e[40];let D;e[41]!==s?(D=s("sportProfile.elevationHillyHikeDesc"),e[41]=s,e[42]=D):D=e[42];let M;e[43]!==B||e[44]!==D?(M={value:"hilly",Icon:dn,label:B,description:D},e[43]=B,e[44]=D,e[45]=M):M=e[45];let R;e[46]!==L||e[47]!==S||e[48]!==M?(R=[L,S,M],e[46]=L,e[47]=S,e[48]=M,e[49]=R):R=e[49];const T=R;let F;e[50]!==s?(F=s("sportProfile.noPreference"),e[50]=s,e[51]=F):F=e[51];let O;e[52]!==F?(O={value:null,label:F,icon:""},e[52]=F,e[53]=O):O=e[53];let G;e[54]!==s?(G=s("sportProfile.left"),e[54]=s,e[55]=G):G=e[55];let E;e[56]!==G?(E={value:"left",label:G,icon:"â"},e[56]=G,e[57]=E):E=e[57];let q;e[58]!==s?(q=s("sportProfile.right"),e[58]=s,e[59]=q):q=e[59];let V;e[60]!==q?(V={value:"right",label:q,icon:"â¶"},e[60]=q,e[61]=V):V=e[61];let $;e[62]!==s?($=s("sportProfile.both"),e[62]=s,e[63]=$):$=e[63];let K;e[64]!==$?(K={value:"both",label:$,icon:"â"},e[64]=$,e[65]=K):K=e[65];let C;e[66]!==O||e[67]!==E||e[68]!==V||e[69]!==K?(C=[O,E,V,K],e[66]=O,e[67]=E,e[68]=V,e[69]=K,e[70]=C):C=e[70];const Q=C;let J;e[71]!==s?(J=s("sportProfile.noPreference"),e[71]=s,e[72]=J):J=e[72];let N;e[73]!==J?(N={value:null,label:J,icon:""},e[73]=J,e[74]=N):N=e[74];let A;e[75]!==s?(A=s("sportProfile.footRight"),e[75]=s,e[76]=A):A=e[76];let k;e[77]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(un,{className:"w-4 h-4"}),e[77]=k):k=e[77];let H;e[78]!==A?(H={value:"right",label:A,icon:k},e[78]=A,e[79]=H):H=e[79];let ee;e[80]!==s?(ee=s("sportProfile.footLeft"),e[80]=s,e[81]=ee):ee=e[81];let Y;e[82]===Symbol.for("react.memo_cache_sentinel")?(Y=t.jsx(un,{className:"w-4 h-4"}),e[82]=Y):Y=e[82];let te;e[83]!==ee?(te={value:"left",label:ee,icon:Y},e[83]=ee,e[84]=te):te=e[84];let z;e[85]!==s?(z=s("sportProfile.both"),e[85]=s,e[86]=z):z=e[86];let se;e[87]!==z?(se={value:"both",label:z,icon:"â"},e[87]=z,e[88]=se):se=e[88];let re;e[89]!==N||e[90]!==H||e[91]!==te||e[92]!==se?(re=[N,H,te,se],e[89]=N,e[90]=H,e[91]=te,e[92]=se,e[93]=re):re=e[93];
2const ie=re,de=n.preferredSide??null;let ue;e[94]!==n.preferredSurfaces?(ue=n.preferredSurfaces??[],e[94]=n.preferredSurfaces,e[95]=ue):ue=e[95];const me=ue,je=n.runningLevel??null,he=n.runningPaceMin??null,fe=n.runningPaceMax??null,Ue=n.runningDistanceMin??null,ve=n.runningDistanceMax??null,Ge=n.runningElevationPref??null,Ce=n.foot5Level??null,Je=n.tennisLevel??null,at=n.preferredFoot??null,Ae=n.hikingPaceMin??null,He=n.hikingPaceMax??null,Ee=n.hikingDistanceMin??null,Xe=n.hikingDistanceMax??null;let Ie;e[96]!==n.preferredHikingSurfaces?(Ie=n.preferredHikingSurfaces??[],e[96]=n.preferredHikingSurfaces,e[97]=Ie):Ie=e[97];const De=Ie,Ke=n.veloSpeedMin??null,_e=n.veloSpeedMax??null,Re=n.veloDistanceMin??null,Fe=n.veloDistanceMax??null;let Te;e[98]!==n.preferredBikeTypes?(Te=n.preferredBikeTypes??[],e[98]=n.preferredBikeTypes,e[99]=Te):Te=e[99];const Me=Te;let Pe;e[100]!==n.preferredFitnessDisciplines?(Pe=n.preferredFitnessDisciplines??[],e[100]=n.preferredFitnessDisciplines,e[101]=Pe):Pe=e[101];const $e=Pe,Le=n.fitnessVenue??null,We=n.fitnessGymId??null,Oe=n.fitnessFrequency??null,Be=n.fitnessExperience??null;let Ve;e[102]!==n.fitnessGoals?(Ve=n.fitnessGoals??[],e[102]=n.fitnessGoals,e[103]=Ve):Ve=e[103];let Ye;e[104]!==n.level||e[105]!==de||e[106]!==me||e[107]!==je||e[108]!==he||e[109]!==fe||e[110]!==Ue||e[111]!==ve||e[112]!==Ge||e[113]!==Ce||e[114]!==Je||e[115]!==at||e[116]!==Ae||e[117]!==He||e[118]!==Ee||e[119]!==Xe||e[120]!==De||e[121]!==Ke||e[122]!==_e||e[123]!==Re||e[124]!==Fe||e[125]!==Me||e[126]!==$e||e[127]!==Le||e[128]!==We||e[129]!==Oe||e[130]!==Be||e[131]!==Ve?(Ye={level:n.level,preferredSide:de,preferredSurfaces:me,runningLevel:je,runningPaceMin:he,runningPaceMax:fe,runningDistanceMin:Ue,runningDistanceMax:ve,runningElevationPref:Ge,foot5Level:Ce,tennisLevel:Je,preferredFoot:at,hikingPaceMin:Ae,hikingPaceMax:He,hikingDistanceMin:Ee,hikingDistanceMax:Xe,preferredHikingSurfaces:De,veloSpeedMin:Ke,veloSpeedMax:_e,veloDistanceMin:Re,veloDistanceMax:Fe,preferredBikeTypes:Me,preferredFitnessDisciplines:$e,fitnessVenue:Le,fitnessGymId:We,fitnessFrequency:Oe,fitnessExperience:Be,fitnessGoals:Ve},e[104]=n.level,e[105]=de,e[106]=me,e[107]=je,e[108]=he,e[109]=fe,e[110]=Ue,e[111]=ve,e[112]=Ge,e[113]=Ce,e[114]=Je,e[115]=at,e[116]=Ae,e[117]=He,e[118]=Ee,e[119]=Xe,e[120]=De,e[121]=Ke,e[122]=_e,e[123]=Re,e[124]=Fe,e[125]=Me,e[126]=$e,e[127]=Le,e[128]=We,e[129]=Oe,e[130]=Be,e[131]=Ve,e[132]=Ye):Ye=e[132];const[_,ce]=U.useState(Ye);let et;e[133]!==n.fitnessGymId||e[134]!==n.fitnessVenue||e[135]!==n.id||e[136]!==_.fitnessExperience||e[137]!==_.fitnessFrequency||e[138]!==_.fitnessGoals||e[139]!==_.fitnessGymId||e[140]!==_.fitnessVenue||e[141]!==_.foot5Level||e[142]!==_.hikingDistanceMax||e[143]!==_.hikingDistanceMin||e[144]!==_.hikingPaceMax||e[145]!==_.hikingPaceMin||e[146]!==_.level||e[147]!==_.preferredBikeTypes||e[148]!==_.preferredFitnessDisciplines||e[149]!==_.preferredFoot||e[150]!==_.preferredHikingSurfaces||e[151]!==_.preferredSide||e[152]!==_.preferredSurfaces||e[153]!==_.runningDistanceMax||e[154]!==_.runningDistanceMin||e[155]!==_.runningElevationPref||e[156]!==_.runningLevel||e[157]!==_.runningPaceMax||e[158]!==_.runningPaceMin||e[159]!==_.tennisLevel||e[160]!==_.veloDistanceMax||e[161]!==_.veloDistanceMin||e[162]!==_.veloSpeedMax||e[163]!==_.veloSpeedMin||e[164]!==l||e[165]!==i||e[166]!==s||e[167]!==r?(et=async()=>{const{error:W}=await r({level:_.level,preferred_side:_.preferredSide,preferred_surfaces:_.preferredSurfaces,running_level:_.runningLevel,running_pace_min:_.runningPaceMin,running_pace_max:_.runningPaceMax,running_distance_min:_.runningDistanceMin,running_distance_max:_.runningDistanceMax,running_elevation_pref:_.runningElevationPref,foot5_level:_.foot5Level,tennis_level:_.tennisLevel,preferred_foot:_.preferredFoot,hiking_pace_min:_.hikingPaceMin,hiking_pace_max:_.hikingPaceMax,hiking_distance_min:_.hikingDistanceMin,hiking_distance_max:_.hikingDistanceMax,preferred_hiking_surfaces:_.preferredHikingSurfaces,velo_speed_min:_.veloSpeedMin,velo_speed_max:_.veloSpeedMax,velo_distance_min:_.veloDistanceMin,velo_distance_max:_.veloDistanceMax,preferred_bike_types:_.preferredBikeTypes,preferred_fitness_disciplines:_.preferredFitnessDisciplines,fitness_frequency:_.fitnessFrequency,fitness_experience:_.fitnessExperience,fitness_goals:_.f
2itnessGoals});if(W){Z.error(s("profileSub.updateError"));return}if(_.fitnessVenue!==(n.fitnessVenue??null)||_.fitnessGymId!==(n.fitnessGymId??null)){const Ne={venue:_.fitnessVenue,gymId:_.fitnessGymId},{error:It}=await fr(n.id,Ne);if(It){Z.error(s("profileSub.updateError"));return}i({fitness_venue:Ne.venue,fitness_gym_id:Ne.gymId})}Z.success(s("profileSub.profileUpdated")),l()},e[133]=n.fitnessGymId,e[134]=n.fitnessVenue,e[135]=n.id,e[136]=_.fitnessExperience,e[137]=_.fitnessFrequency,e[138]=_.fitnessGoals,e[139]=_.fitnessGymId,e[140]=_.fitnessVenue,e[141]=_.foot5Level,e[142]=_.hikingDistanceMax,e[143]=_.hikingDistanceMin,e[144]=_.hikingPaceMax,e[145]=_.hikingPaceMin,e[146]=_.level,e[147]=_.preferredBikeTypes,e[148]=_.preferredFitnessDisciplines,e[149]=_.preferredFoot,e[150]=_.preferredHikingSurfaces,e[151]=_.preferredSide,e[152]=_.preferredSurfaces,e[153]=_.runningDistanceMax,e[154]=_.runningDistanceMin,e[155]=_.runningElevationPref,e[156]=_.runningLevel,e[157]=_.runningPaceMax,e[158]=_.runningPaceMin,e[159]=_.tennisLevel,e[160]=_.veloDistanceMax,e[161]=_.veloDistanceMin,e[162]=_.veloSpeedMax,e[163]=_.veloSpeedMin,e[164]=l,e[165]=i,e[166]=s,e[167]=r,e[168]=et):et=e[168];const ot=et,nt="flex-1 flex flex-col min-h-0",lt="flex-1 overflow-y-auto",ct=we,dt=s("sportProfile.title",{sport:x.label});let tt;e[169]!==ct||e[170]!==l||e[171]!==dt?(tt=t.jsx(ct,{title:dt,onBack:l}),e[169]=ct,e[170]=l,e[171]=dt,e[172]=tt):tt=e[172];let pe;e[173]!==_||e[174]!==ce||e[175]!==x.modes.profileSectionKind||e[176]!==s?(pe=x.modes.profileSectionKind==="velo"&&t.jsx(ne,{className:"p-5",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:s("sportProfile.speedRange")}),t.jsx("div",{className:"flex gap-1.5 flex-wrap",children:Jl.map(W=>{const Se=_.veloSpeedMin!=null&&_.veloSpeedMax!=null&&_.veloSpeedMin<=W.min&&_.veloSpeedMax>=W.max;return t.jsx("button",{className:X("px-3 py-1.5 rounded-full border text-xs font-medium cursor-pointer transition-all",Se?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>{const Ne=er(_.veloSpeedMin,_.veloSpeedMax,W);ce({..._,veloSpeedMin:Ne.min,veloSpeedMax:Ne.max})},children:W.label},W.label)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:s("sportProfile.distanceRange")}),t.jsx("div",{className:"flex gap-1.5 flex-wrap",children:tr.map(W=>{const Se=_.veloDistanceMin!=null&&_.veloDistanceMax!=null&&_.veloDistanceMin<=W.min&&_.veloDistanceMax>=W.max;return t.jsx("button",{className:X("px-3 py-1.5 rounded-full border text-xs font-medium cursor-pointer transition-all",Se?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>{const Ne=Ts(_.veloDistanceMin,_.veloDistanceMax,W);ce({..._,veloDistanceMin:Ne.min,veloDistanceMax:Ne.max})},children:W.label},W.label)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:s("sportProfile.bikeTypes")}),t.jsx("div",{className:"flex gap-1.5 flex-wrap",children:Object.entries(sr).map(W=>{const[Se,Ne]=W;return t.jsx("button",{className:X("px-3 py-1.5 rounded-full border text-xs font-medium cursor-pointer transition-all",_.preferredBikeTypes.includes(Se)?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>ce({..._,preferredBikeTypes:nr(_.preferredBikeTypes,Se)}),children:s(Ne)},Se)})})]})]})}),e[173]=_,e[174]=ce,e[175]=x.modes.profileSectionKind,e[176]=s,e[177]=pe):pe=e[177];let Qe;e[178]!==n.id||e[179]!==_||e[180]!==ce||e[181]!==x.modes.profileSectionKind?(Qe=x.modes.profileSectionKind==="fitness"&&t.jsx(ja,{value:_,onChange:W=>ce({..._,...W}),userId:n.id}),e[178]=n.id,e[179]=_,e[180]=ce,e[181]=x.modes.profileSectionKind,e[182]=Qe):Qe=e[182];let st;e[183]!==_||e[184]!==ce||e[185]!==x.modes.profileSectionKind||e[186]!==s?(st=x.modes.profileSectionKind==="running"&&t.jsxs(ne,{className:"p-5",children:[t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:s("sportProfile.preferredSurfaces")}),t.jsx("div",{className:"grid grid-cols-2 gap-2",children:lr.map(W=>{const Se=_.preferredSurfaces.includes(W);return t.jsxs("button",{type:"button",className:X("flex items-start gap-2 px-3 py-2.5 rounded-lg border text-left cursor-pointer transition-all",Se?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>ce({..._,preferredSurfaces:Un(_.preferredSurfaces,W)}),children:[t.jsx(pt,{name:Rn[W],className:"w-4 h-4 shrink-0 mt-0.5"}),t.jsxs("span",{className:"flex flex-col gap-0.5 min-w-0",children:[t.jsx("span",{className:"text-xs font-medium leading-tight",children:s(xs[W])}),t.jsx("span",{className:X("text-[10px] leading-snug",Se?"text-primary-foreground
2/75":"text-muted-foreground/80"),children:s(rr[W])})]})]},W)})}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:s("sportProfile.surfaceMatchingHint")})]}),e[183]=_,e[184]=ce,e[185]=x.modes.profileSectionKind,e[186]=s,e[187]=st):st=e[187];let bt;e[188]!==y||e[189]!==_||e[190]!==ce||e[191]!==x.modes.profileSectionKind||e[192]!==s?(bt=x.modes.profileSectionKind==="running"&&t.jsx(ne,{className:"p-5",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:s("sportProfile.level")}),t.jsx("div",{className:"flex flex-col gap-1.5",children:ir.map(W=>t.jsxs("button",{className:X("flex items-center gap-2.5 px-3 py-2.5 rounded-lg border text-left text-xs font-medium cursor-pointer transition-all",_.runningLevel===W.value?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>ce({..._,runningLevel:W.value}),children:[t.jsx(bi,{level:W.value,className:X("w-4 h-4 shrink-0",_.runningLevel===W.value&&"text-primary-foreground")}),t.jsxs("div",{children:[t.jsx("span",{className:X(_.runningLevel!==W.value&&"text-foreground"),children:s(W.labelKey)}),t.jsx("span",{className:"ml-1.5 opacity-70",children:s(W.descriptionKey)})]})]},W.value))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:s("sportProfile.paceRange")}),t.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:s("sportProfile.paceRangeHint")}),t.jsxs("div",{className:"flex gap-1.5 flex-wrap",children:[ar.map(W=>{const Se=_.runningPaceMin!=null&&_.runningPaceMax!=null&&_.runningPaceMin<=W.min&&_.runningPaceMax>=W.max;return t.jsx("button",{className:X("px-3 py-1.5 rounded-full border text-xs font-medium cursor-pointer transition-all",Se?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>{const Ne=nn(_.runningPaceMin,_.runningPaceMax,W);ce({..._,runningPaceMin:Ne.min,runningPaceMax:Ne.max})},children:W.label},W.label)}),t.jsx("button",{className:X("px-3 py-1.5 rounded-full border text-xs font-medium cursor-pointer transition-all",rn(_.runningPaceMin,_.runningPaceMax)?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>ce({..._,runningPaceMin:ln.min,runningPaceMax:ln.max}),children:s("sportProfile.paceBeginner")})]}),rn(_.runningPaceMin,_.runningPaceMax)&&t.jsxs("p",{className:"text-xs text-muted-foreground italic mt-2",children:[t.jsx(Us,{className:"inline-block w-3.5 h-3.5 align-[-0.15em] mr-1"}),s("sportProfile.paceBeginnerNotice")]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:s("sportProfile.distanceRange")}),t.jsxs("div",{className:"flex gap-1.5 flex-wrap",children:[or.map(W=>{const Se=_.runningDistanceMin!=null&&_.runningDistanceMax!=null&&_.runningDistanceMin<=W.min&&_.runningDistanceMax>=W.max;return t.jsx("button",{className:X("px-3 py-1.5 rounded-full border text-xs font-medium cursor-pointer transition-all",Se?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>{const Ne=Ts(_.runningDistanceMin,_.runningDistanceMax,W);ce({..._,runningDistanceMin:Ne.min,runningDistanceMax:Ne.max})},children:W.label},W.label)}),t.jsx("button",{className:X("px-3 py-1.5 rounded-full border text-xs font-medium cursor-pointer transition-all",on(_.runningDistanceMin,_.runningDistanceMax)?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>ce({..._,runningDistanceMin:an.min,runningDistanceMax:an.max}),children:s("sportProfile.distanceBeginner")})]}),on(_.runningDistanceMin,_.runningDistanceMax)&&t.jsxs("p",{className:"text-xs text-muted-foreground italic mt-2",children:[t.jsx(Us,{className:"inline-block w-3.5 h-3.5 align-[-0.15em] mr-1"}),s("sportProfile.distanceBeginnerNotice")]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:s("sportProfile.elevationPref")}),t.jsx("div",{className:"flex flex-col gap-1.5",children:y.map(W=>t.jsxs("button",{className:X("flex items-center gap-2.5 px-3 py-2.5 rounded-lg border text-left text-xs font-medium cursor-pointer transition-all",_.runningElevationPref===W.value?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>ce({..._,runningElevationPref:_.runningElevationPref===W.value?null:W.value}),children:[t.jsx(W.Icon,{className:"w-4 h-4"}),t.jsxs("div",{children:[t.jsx("span",{className:X(_.runningElevationPref!==W.value&&"text-foreground"),children:W.label}),t.jsx("span",{className:"ml-1.5 opacity-70",children:W.description})]})]},W.value))})]})]})}),e[188]=y,e[189]=_,e[190]=ce,e[191]=x.modes.profileSectionKind,e[192]=s,e[193]=bt):bt=e[193];let wt;e[194]!==x.modes.hasMinPartnersSetting?(wt=x.modes.hasMinPartnersSetting&&t.jsx(ya,{}),e[194]=x.modes.hasMinPartnersSetting,e[195]=wt):wt=e[195];let ht;e[196]!==_||e[197]!==ce||e[198]!==Q||e[199]!==x.modes.profileSectionKind||e[200]!==s?(ht=x.modes.profileSectionKind==="padelGame"&&t.jsxs(ne,{className:"p-5",children:[t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:s("sportProfile.gameplay")}),t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:s("sportProfile.level")}),t.jsx("div",{className:"flex gap-1.5 flex-wrap",children:[1,2,3,4,5,6,7,8,9,10].map(W=>t.jsx("button",{className:X("px-3 py-1.5 rounded-full border text-xs font-medium cursor-pointer transition-all",_.level===W?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>ce({..._,level:W}),children:W},W))}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:ps[_.level]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:s("sportProfile.preferredSide")}),t.jsx("div",{className:"flex gap-2 flex-wrap",children:Q.map(W=>t.jsxs("button",{className:X("px-3 py-2 rounded-lg border text-xs font-medium cursor-pointer transition-all flex items-center gap-1.5",_.preferredSide===W.value?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>ce({..._,preferredSide:W.value}),children:[W.icon&&t.jsx("span",{children:W.icon}),W.label]},W.value??"none"))}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:s("sportProfile.preferredSideHint")})]})]})]}),e[196]=_,e[197]=ce,e[198]=Q,e[199]=x.modes.profileSectionKind,e[200]=s,e[201]=ht):ht=e[201];let gt;e[202]!==_||e[203]!==ce||e[204]!==x.modes.profileSectionKind||e[205]!==s?(gt=x.modes.profileSectionKind==="tennis"&&t.jsx(ne,{className:"p-5",children:t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:s("sportProfile.level")}),t.jsx("div",{className:"flex gap-2",children:wi.map(W=>t.jsxs("button",{className:X("flex-1 py-2.5 px-2 rounded-lg border text-center cursor-pointer transition-all flex flex-col items-center gap-1",_.tennisLevel===W.value?`border-current ${Pi[W.value]}`:"border-border bg-card text-muted-foreground hover:border-primary/50"),onClick:()=>ce({..._,tennisLevel:_.tennisLevel===W.value?null:W.value}),children:[t.jsx(Ci,{level:W.value,className:"w-4 h-4"}),t.jsx("span",{className:"text-xs font-semibold",children:s(W.labelKey)})]},W.value))})]})}),e[202]=_,e[203]=ce,e[204]=x.modes.profileSectionKind,e[205]=s,e[206]=gt):gt=e[206];let vt;e[207]!==ie||e[208]!==_||e[209]!==ce||e[210]!==x.modes.profileSectionKind||e[211]!==s?(vt=x.modes.profileSectionKind==="foot5"&&t.jsx(ne,{className:"p-5",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:s("sportProfile.level")}),t.jsx("div",{className:"flex gap-2",children:$n.map(W=>t.jsxs("button",{className:X("flex-1 py-2.5 px-2 rounded-lg border text-center cursor-pointer transition-all flex flex-col items-center gap-1",_.foot5Level===W.value?`border-current ${zn[W.value]}`:"border-border bg-card text-muted-foreground hover:border-primary/50"),onClick:()=>ce({..._,foot5Level:_.foot5Level===W.value?null:W.value}),children:[t.jsx(Kn,{level:W.value,className:"w-4 h-4"}),t.jsx("span",{className:"text-xs font-semibold",children:s(W.labelKey)})]},W.value))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:s("sportProfile.preferredFoot")}),t.jsx("div",{className:"flex gap-2 flex-wrap",children:ie.map(W=>t.jsxs("button",{className:X("px-3 py-2 rounded-lg border text-xs font-medium cursor-pointer transition-all flex items-center gap-1.5",_.preferredFoot===W.value?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>ce({..._,preferredFoot:W.value}),children:[W.icon&&t.jsx("span",{children:W.icon}),W.label]},W.value??"none"))})]})]})}),e[207]=ie,e[208]=_,e[209]=ce,e[210]=x.modes.profileSectionKind,e[211]=s,e[212]=vt):vt=e[212];let yt;e[213]!==_||e[214]!==T||e[215]!==ce||e[216]!==x.modes.profileSectionKind||e[217]!==s?(yt=x.modes.profileSectionKind==="hiking"&&t.jsx(ne,{className:"p-5",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:s("sportProfile.paceRange")}),t.jsx("div",{className:"flex gap-1.5 flex-wrap",children:cr.map(W=>{const Se=_.hikingPaceMin!=null&&_.hikingPaceMax!=null&&_.hikingPaceMin<=W.min&&_.hikingPaceMax>=W.max;return t.jsx("button",{className:X("px-3 py-1.5 rounded-full border text-xs font-medium cursor-pointer transition-all",Se?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>{const Ne=nn(_.hikingPaceMin,_.hikingPaceMax,W);ce({..._,hikingPaceMin:Ne.min,hikingPaceMax:Ne.max})},children:W.label},W.label)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:s("sportProfile.distanceRange")}),t.jsx("div",{className:"flex gap-1.5 flex-wrap",children:dr.map(W=>{const Se=_.hikingDistanceMin!=null&&_.hikingDistanceMax!=null&&_.hikingDistanceMin<=W.min&&_.hikingDistanceMax>=W.max;return t.jsx("button",{className:X("px-3 py-1.5 rounded-full border text-xs font-medium cursor-pointer transition-all",Se?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>{const Ne=Ts(_.hikingDistanceMin,_.hikingDistanceMax,W);ce({..._,hikingDistanceMin:Ne.min,hikingDistanceMax:Ne.max})},children:W.label},W.label)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:s("sportProfile.preferredSurfaces")}),t.jsx("div",{className:"flex gap-1.5 flex-wrap",children:Object.entries(ur).map(W=>{const[Se,Ne]=W;return t.jsx("button",{className:X("px-3 py-1.5 rounded-full border text-xs font-medium cursor-pointer transition-all flex items-center gap-1",_.preferredHikingSurfaces.includes(Se)?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>ce({..._,preferredHikingSurfaces:qn(_.preferredHikingSurfaces,Se)}),children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(pt,{name:mr[Se],className:"w-4 h-4 shrink-0"}),s(Ne)]})},Se)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:s("sportProfile.elevationPref")}),t.jsx("div",{className:"flex flex-col gap-1.5",children:T.map(W=>t.jsxs("button",{className:X("flex items-center gap-2.5 px-3 py-2.5 rounded-lg border text-left text-xs font-medium cursor-pointer transition-all",_.runningElevationPref===W.value?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>ce({..._,runningElevationPref:_.runningElevationPref===W.value?null:W.value}),children:[t.jsx(W.Icon,{className:"w-4 h-4"}),t.jsxs("div",{children:[t.jsx("span",{className:X(_.runningElevationPref!==W.value&&"text-foreground"),children:W.label}),t.jsx("span",{className:"ml-1.5 opacity-70",children:W.description})]})]},W.value))})]})]})}),e[213]=_,e[214]=T,e[215]=ce,e[216]=x.modes.profileSectionKind,e[217]=s,e[218]=yt):yt=e[218];let jt;e[219]!==pe||e[220]!==Qe||e[221]!==st||e[222]!==bt||e[223]!==wt||e[224]!==ht||e[225]!==gt||e[226]!==vt||e[227]!==yt?(jt=t.jsxs("div",{className:"px-4 pb-4 flex flex-col gap-4 mt-2",children:[pe,Qe,st,bt,wt,ht,gt,vt,yt]}),e[219]=pe,e[220]=Qe,e[221]=st,e[222]=bt,e[223]=wt,e[224]=ht,e[225]=gt,e[226]=vt,e[227]=yt,e[228]=jt):jt=e[228];let Nt;e[229]!==tt||e[230]!==jt?(Nt=t.jsxs("div",{className:lt,children:[tt,jt]}),e[229]=tt,e[230]=jt,e[231]=Nt):Nt=e[231];let ut;e[232]!==s?(ut=s("common.save"),e[232]=s,e[233]=ut):ut=e[233];let mt;e[234]!==ot||e[235]!==ut?(mt=t.jsx("div",{className:"shrink-0 bg-background/95 backdrop-blur-lg border-t border-border p-4",children:t.jsx(ae,{className:"w-full",onClick:ot,children:ut})}),e[234]=ot,e[235]=ut,e[236]=mt):mt=e[236];let St;return e[237]!==Nt||e[238]!==mt?(St=t.jsxs("div",{className:nt,children:[Nt,mt]}),e[237]=Nt,e[238]=mt,e[239]=St):St=e[239],St}function al(a){const e=le.c(4),{className:n}=a;let l,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),s=t.jsx("path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"}),e[0]=l,e[1]=s):(l=e[0],s=e[1]);let r;return e[2]!==n?(r=t.jsxs(Qt,{className:n,children:[l,s]}),e[2]=n,e[3]=r):r=e[3],r}function Sa({onBack:a}){const{t:e}=oe(),[n,l]=U.useState([]),[s,r]=U.useState(!0),[i,c]=U.useState(null),[x,m]=U.useState(null),[o,d]=U.useState({name:"",address:"",city:"",indoor:!1,sport:"padel"}),[v,u]=U.useState(null),p=U.useCallback(async()=>{const{data:g,error:I}=await ge.from("terrain_suggestions").select("*, profiles:user_id(first_name, last_name)").order("created_at",{ascending:!1});if(I){Z.error(e("suggestions.loadError"));return}l(g??[]),r(!1)},[]);U.useEffect(()=>{p()},[]),U.useEffect(()=>{if(x===null){u(null);return}const g=o.name.trim();if(!g){u(null);return}let I=!1;const S=setTimeout(async()=>{const{data:B,error:D}=await ge.from("terrains").select("id, name").ilike("name",g).limit(1).maybeSingle();if(!I){if(D||!B){u(null);return}u({id:B.id,name:B.name})}},200);return()=>{I=!0,clearTimeout(S)}},[x,o.name]);
2function f(g){m(g.id),d({name:g.name,address:g.address,city:g.city,indoor:g.indoor,sport:g.sport??"padel"}),u(null)}async function b(g){c(g.id);const I=o.city?`${o.address}, ${o.city}`:o.address,S=await Gs(I);if(!S){Z.error(e("suggestions.geocodeError")),c(null);return}const{error:B}=await ge.rpc("create_terrain_from_suggestion",{p_name:o.name,p_address:`${o.address}, ${o.city}`,p_indoor:o.indoor,p_lat:S.lat,p_lng:S.lng,p_sports:[o.sport],p_website:g.website,p_notes:g.notes});if(B){Z.error(e("suggestions.createError")),c(null);return}const{error:D}=await ge.from("terrain_suggestions").update({status:"approved",reviewed_at:new Date().toISOString()}).eq("id",g.id);D?Z.error(e("suggestions.updateError")):(Z.success(e("suggestions.approvedSuccess")),bs({userId:g.user_id,type:"suggestion_approved",...hs.suggestionApproved(o.name)})),m(null),await p(),c(null)}async function j(g){c(g.id);const{error:I}=await ge.from("terrain_suggestions").update({status:"rejected",reviewed_at:new Date().toISOString()}).eq("id",g.id);I?Z.error(e("suggestions.rejectError")):(Z.success(e("suggestions.rejectedSuccess")),bs({userId:g.user_id,type:"suggestion_rejected",...hs.suggestionRejected(g.name)})),await p(),c(null)}async function h(g){c(g.id);const{error:I}=await ge.from("terrain_suggestions").delete().eq("id",g.id);I?Z.error(e("suggestions.deleteError")):Z.success(e("suggestions.deletedSuccess")),await p(),c(null)}const y=n.filter(g=>g.status==="pending"),w=n.filter(g=>g.status!=="pending"),P={pending:{label:e("suggestions.pending"),className:"bg-amber-100 text-amber-800 border-amber-200"},approved:{label:e("suggestions.approved"),className:"bg-green-100 text-green-800 border-green-200"},rejected:{label:e("suggestions.rejected"),className:"bg-red-100 text-red-800 border-red-200"}};function L(g){const I=i===g.id,S=x===g.id,B=P[g.status],D=g.profiles?`${g.profiles.first_name} ${g.profiles.last_name}`:e("suggestions.unknown");return t.jsxs(ne,{className:"p-4",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3 mb-3",children:[t.jsx("h3",{className:"font-semibold text-sm",children:g.name}),t.jsx(nl,{variant:"outline",className:X("text-xs shrink-0",B.className),children:B.label})]}),S?t.jsxs("div",{className:"space-y-2.5 mb-3",children:[v&&t.jsx("div",{"data-testid":"existing-terrain-warning",className:"p-2.5 rounded-md bg-amber-50 border border-amber-200",children:t.jsx("p",{className:"text-xs text-amber-900 font-medium",children:e("suggestions.existingTerrainWarning",{id:v.id,name:v.name})})}),t.jsxs("div",{children:[t.jsx("label",{className:"text-[10px] font-medium text-muted-foreground uppercase",children:e("suggestions.nameLabel")}),t.jsx(be,{className:"h-8 text-sm mt-0.5",value:o.name,disabled:!!v,onChange:M=>d(R=>({...R,name:M.target.value}))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-[10px] font-medium text-muted-foreground uppercase",children:e("suggestions.addressLabel")}),t.jsx(be,{className:"h-8 text-sm mt-0.5",value:o.address,disabled:!!v,onChange:M=>d(R=>({...R,address:M.target.value}))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-[10px] font-medium text-muted-foreground uppercase",children:e("suggestions.cityLabel")}),t.jsx(be,{className:"h-8 text-sm mt-0.5",value:o.city,disabled:!!v,onChange:M=>d(R=>({...R,city:M.target.value}))})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("label",{className:"text-[10px] font-medium text-muted-foreground uppercase",children:e("suggestions.typeLabel")}),t.jsxs("select",{className:"text-xs bg-secondary rounded px-2 py-1 border border-border disabled:opacity-50",value:o.indoor?"indoor":"outdoor",disabled:!!v,onChange:M=>d(R=>({...R,indoor:M.target.value==="indoor"})),children:[t.jsx("option",{value:"indoor",children:e("suggestions.indoor")}),t.jsx("option",{value:"outdoor",children:e("suggestions.outdoor")})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("label",{className:"text-[10px] font-medium text-muted-foreground uppercase",children:e("suggestions.sportLabel")}),t.jsxs("select",{className:"text-xs bg-secondary rounded px-2 py-1 border border-border disabled:opacity-50",value:o.sport,disabled:!!v,onChange:M=>d(R=>({...R,sport:M.target.value})),children:[t.jsx("option",{value:"padel",children:e("sport.padel.label")}),t.jsx("option",{value:"foot5",children:e("sport.foot5.label")}),t.jsx("option",{value:"running",children:e("sport.running.label")}),t.jsx("option",{value:"hiking",children:e("sport.hiking.label")}),t.jsx("option",{value:"velo",children:e("sport.velo.label")})]})]})]}),g.notes&&t.jsx("p",{className:"text-xs text-muted-foreground italic",children:e("suggestions.note",{note:g.notes})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:e("suggestions.submittedBy",{name:D,date:new Date(g.created_at).toLocaleDateString()})}),t.jsxs("div",{className:"flex gap-2 pt-1",children:[t.jsx(ae,{size:"sm",className:"h-7 text-xs",disabled:I||!o.name.trim()||!o.address.trim()||!o.city.trim(),onClick:()=>b(g),children:e(I?"suggestions.creating":v?"suggestions.mergeWebsiteAndNotes":"suggestions.confirmAndCreate")}),t.jsx(ae,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>m(null),children:e("common.cancel")})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-1.5 mb-3",children:[t.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.address,", ",g.city]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs px-2 py-0.5 rounded-md bg-secondary text-muted-foreground",children:g.indoor?e("suggestions.indoor"):e("suggestions.outdoor")}),g.sport&&t.jsx("span",{className:"text-xs px-2 py-0.5 rounded-md bg-secondary text-muted-foreground",children:g.sport})]}),g.website&&t.jsx("p",{className:"text-xs text-muted-foreground",children:g.website}),g.notes&&t.jsx("p",{className:"text-xs text-muted-foreground italic",children:g.notes})]}),t.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:e("suggestions.submittedBy",{name:D,date:new Date(g.created_at).toLocaleDateString()})}),t.jsxs("div",{className:"flex gap-2",children:[g.status==="pending"&&t.jsxs(t.Fragment,{children:[t.jsx(ae,{size:"sm",className:"h-7 text-xs",disabled:I,onClick:()=>f(g),children:e("suggestions.approve")}),t.jsx(ae,{size:"sm",variant:"outline",className:"h-7 text-xs",disabled:I,onClick:()=>j(g),children:e("suggestions.reject")})]}),t.jsx(ae,{size:"sm",variant:"ghost",className:"h-7 text-xs text-destructive hover:text-destructive",disabled:I,onClick:()=>h(g),children:e("common.delete")})]})]})]},g.id)}return t.jsxs("div",{className:"flex-1 overflow-y-auto pb-4",children:[t.jsx(we,{title:e("suggestions.title"),subtitle:e("suggestions.subtitle"),onBack:a}),t.jsx("div",{className:"px-4 flex flex-col gap-3",children:s?t.jsx("div",{className:"flex justify-center py-12",children:t.jsx("div",{className:"h-6 w-6 border-2 border-primary border-t-transparent roun
2ded-full animate-spin"})}):n.length===0?t.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[t.jsx(al,{className:"w-8 h-8 mb-3 mx-auto text-muted-foreground"}),t.jsx("p",{className:"text-sm",children:e("suggestions.noSuggestions")})]}):t.jsxs(t.Fragment,{children:[y.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:e("suggestions.pendingCount",{count:y.length})}),y.map(L)]}),w.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mt-2",children:e("suggestions.reviewedCount",{count:w.length})}),w.map(L)]})]})})]})}function ka({onBack:a}){const{t:e}=oe(),[n,l]=U.useState([]),[s,r]=U.useState(!0),[i,c]=U.useState(null),x=U.useCallback(async()=>{const{data:b,error:j}=await ge.from("club_suggestions").select("id, user_id, name, city, description, strava_url, instagram_url, whatsapp_url, notes, sports, status, created_at, reviewed_at, profiles:user_id(first_name, last_name)").order("created_at",{ascending:!1});if(j){Z.error(e("clubSuggestions.loadError"));return}l(b??[]),r(!1)},[]);U.useEffect(()=>{x()},[x]);async function m(b){c(b.id);const j=await Gs(b.city);if(!j){Z.error(e("clubSuggestions.geocodeError")),c(null);return}const{error:h}=await ge.rpc("approve_club_suggestion",{p_suggestion_id:b.id,p_lat:j.lat,p_lng:j.lng});if(h){h.message.includes("suggestion_already_reviewed")?(Z.error(e("clubSuggestions.alreadyReviewed")),await x()):Z.error(e("clubSuggestions.approveError")),c(null);return}Z.success(e("clubSuggestions.approvedSuccess")),bs({userId:b.user_id,type:"suggestion_approved",...hs.suggestionApproved(b.name)}),await x(),c(null)}async function o(b){c(b.id);const{error:j}=await ge.from("club_suggestions").update({status:"rejected",reviewed_at:new Date().toISOString()}).eq("id",b.id);j?Z.error(e("clubSuggestions.rejectError")):(Z.success(e("clubSuggestions.rejectedSuccess")),bs({userId:b.user_id,type:"suggestion_rejected",...hs.suggestionRejected(b.name)})),await x(),c(null)}async function d(b){c(b.id);const{error:j}=await ge.from("club_suggestions").delete().eq("id",b.id);j?Z.error(e("clubSuggestions.deleteError")):Z.success(e("clubSuggestions.deletedSuccess")),await x(),c(null)}const v=n.filter(b=>b.status==="pending"),u=n.filter(b=>b.status!=="pending"),p={pending:{label:e("clubSuggestions.pending"),className:"bg-amber-100 text-amber-800 border-amber-200"},approved:{label:e("clubSuggestions.approved"),className:"bg-green-100 text-green-800 border-green-200"},rejected:{label:e("clubSuggestions.rejected"),className:"bg-red-100 text-red-800 border-red-200"}};function f(b){const j=i===b.id,h=p[b.status],y=b.profiles?`${b.profiles.first_name} ${b.profiles.last_name??""}`.trim():e("clubSuggestions.unknown");return t.jsxs(ne,{className:"p-4",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3 mb-3",children:[t.jsx("h3",{className:"font-semibold text-sm",children:b.name}),t.jsx(nl,{variant:"outline",className:X("text-xs shrink-0",h.className),children:h.label})]}),t.jsxs("div",{className:"space-y-1.5 mb-3",children:[t.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.city,b.sports&&b.sports.length>0&&` · ${b.sports.map(w=>qe(w).label).join(", ")}`]}),b.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:b.description}),b.strava_url&&t.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:["Strava: ",b.strava_url]}),b.instagram_url&&t.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:["Instagram: ",b.instagram_url]}),b.whatsapp_url&&t.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:["WhatsApp: ",b.whatsapp_url]}),b.notes&&t.jsx("p",{className:"text-xs text-muted-foreground italic",children:b.notes})]}),t.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:e("clubSuggestions.submittedBy",{name:y,date:new Date(b.created_at).toLocaleDateString()})}),t.jsxs("div",{className:"flex gap-2",children:[b.status==="pending"&&t.jsxs(t.Fragment,{children:[t.jsx(ae,{size:"sm",className:"h-7 text-xs",disabled:j,onClick:()=>m(b),children:e("clubSuggestions.approve")}),t.jsx(ae,{size:"sm",variant:"outline",className:"h-7 text-xs",disabled:j,onClick:()=>o(b),children:e("clubSuggestions.reject")})]}),t.jsx(ae,{size:"sm",variant:"ghost",className:"h-7 text-xs text-destructive hover:text-destructive",disabled:j,onClick:()=>d(b),children:e("common.delete")})]})]},b.id)}return t.jsxs("div",{className:"flex-1 overflow-y-auto pb-4",children:[t.jsx(we,{title:e("clubSuggestions.title"),subtitle:e("clubSuggestions.subtitle"),onBack:a}),t.jsx("div",{className:"px-4 flex flex-col gap-3",children:s?t.jsx("div",{className:"flex justify-center py-12",children:t.jsx("div",{className:"h-6 w-6 border-2 border-primary border-t-transparent roun
2ded-full animate-spin"})}):n.length===0?t.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[t.jsx(al,{className:"w-8 h-8 mb-3 mx-auto text-muted-foreground"}),t.jsx("p",{className:"text-sm",children:e("clubSuggestions.noSuggestions")})]}):t.jsxs(t.Fragment,{children:[v.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:e("clubSuggestions.pendingCount",{count:v.length})}),v.map(f)]}),u.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mt-2",children:e("clubSuggestions.reviewedCount",{count:u.length})}),u.map(f)]})]})})]})}const wa="a89f2a0c-2dec-4be1-812f-86af48a3b558",Ca=[null,...zs()];function Pa(){const a=Ze();return[{labelKey:"admin.broadcast.targetHome",descKey:"admin.broadcast.targetHomeDesc",url:"/"},{labelKey:"admin.broadcast.targetMap",descKey:"admin.broadcast.targetMapDesc",url:`/${a}/?tab=map`},{labelKey:"admin.broadcast.targetCommunity",descKey:"admin.broadcast.targetCommunityDesc",url:`/${a}/?tab=community`}
2,{labelKey:"admin.broadcast.targetDeals",descKey:"admin.broadcast.targetDealsDesc",url:`/${a}/?tab=profile&sub=deals`},{labelKey:"admin.broadcast.targetCreate",descKey:"admin.broadcast.targetCreateDesc",url:`/${a}/?tab=create`},{labelKey:"admin.broadcast.targetDeclareIntention",descKey:"admin.broadcast.targetDeclareIntentionDesc",url:`/${a}/?intentions=declare`},{labelKey:"admin.broadcast.targetInstagram",descKey:"admin.broadcast.targetInstagramDesc",url:"https://www.instagram.com/buddiz.app/"},{labelKey:"admin.broadcast.targetFacebook",descKey:"admin.broadcast.targetFacebookDesc",url:"https://www.facebook.com/buddiz.partenaires.de.sport"}]}function Ea({onBack:a}){const{t:e}=oe(),n=U.useMemo(()=>Pa(),[]),[l,s]=U.useState(""),[r,i]=U.useState(""),[c,x]=U.useState(()=>n[0].url),[m,o]=U.useState(null),[d,v]=U.useState(!1),[u,p]=U.useState(!1),[f,b]=U.useState(!1),[j,h]=U.useState(null),y=l.trim().length>0&&r.trim().length>0&&c.trim().length>0,w=u||f,P=n.find(M=>M.url===c)??null,L={type:"marketing_announcement",title:l.trim(),body:r.trim(),url:c.trim(),...m?{sport:m}:{}},g=async()=>{if(!(!y||d)){v(!0);try{const[M,R]=await Promise.all([ge.functions.invoke("send-notification",{body:{...L,userId:wa}}),ge.functions.invoke("send-notification",{body:{...L,broadcast:!0,countOnly:!0}})]);if(M.error)throw M.error;const T=R.data?.pushTargets??R.data?.count;R.error||T==null?(Z.warning(e("admin.broadcast.testWarning")),h(null)):h(T),Z.success(e("admin.broadcast.testSentToast")),p(!0)}catch(M){Z.error(e("admin.broadcast.testError")),console.error("Broadcast test error:",M)}finally{v(!1)}}},I=async()=>{if(!(!y||!u||d)){if(j===0){Z.error(e("admin.broadcast.noRecipients"));return}v(!0);try{const{data:M,error:R}=await ge.functions.invoke("send-notification",{body:{...L,broadcast:!0}});if(R)throw R;const T=M?.sent??0,F=M?.failed??0;F>0?Z.warning(e("admin.broadcast.sentPartial",{sent:T,failed:F})):Z.success(e("admin.broadcast.sentSuccess",{count:T})),b(!0)}catch(M){Z.error(e("admin.broadcast.sendError")),console.error("Broadcast error:",M)}finally{v(!1)}}},S=()=>{p(!1),h(null)},B=()=>{s(""),i(""),x(n[0].url),o(null),p(!1),b(!1),h(null)},D=u&&j!==null&&j>0;return t.jsxs("div",{className:"flex-1 overflow-y-auto pb-4",children:[t.jsx(we,{title:e("admin.broadcast.title"),onBack:a}),t.jsxs("div",{className:"px-4 space-y-4",children:[t.jsxs(ne,{className:"p-4 space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:"broadcast-title",className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:e("admin.broadcast.labelTitle")}),t.jsx("input",{id:"broadcast-title",type:"text",className:"w-full h-10 rounded-lg border border-border bg-background px-3 text-sm outline-none focus-visible:border-primary transition-colors",placeholder:e("admin.broadcast.placeholderTitle"),value:l,onChange:M=>s(M.target.value),maxLength:100,disabled:w}),t.jsxs("p",{className:"text-xs text-muted-foreground mt-1 text-right",children:[l.length,"/100"]})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"broadcast-body",className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:e("admin.broadcast.labelMessage")}),t.jsx("textarea",{id:"broadcast-body",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm outline-none focus-visible:border-primary transition-colors resize-none",placeholder:e("admin.broadcast.placeholderMessage"),value:r,onChange:M=>i(M.target.value),maxLength:200,rows:3,disabled:w}),t.jsxs("p",{className:"text-xs text-muted-foreground mt-1 text-right",children:[r.length,"/200"]})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"broadcast-url",className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:e("admin.broadcast.labelDestination")}),t.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:n.map(M=>t.jsx("button",{type:"button",className:X("px-3 py-1.5 rounded-full border text-xs font-medium transition-all",P?.url===M.url?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>x(M.url),disabled:w,children:e(M.labelKey)},M.url))}),t.jsx("input",{id:"broadcast-url",type:"text",className:"w-full h-9 rounded-lg border border-border bg-background px-3 text-sm outline-none focus-visible:border-primary transition-colors font-mono",placeholder:"https://...",value:c,onChange:M=>x(M.target.value),disabled:w}),P&&t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e(P.descKey)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:e("admin.broadcast.labelSportFilter")}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:Ca.map(M=>t.jsx("button",{type:"button",className:X("px-3 py-1.5 rounded-full border text-xs font-medium transition-all",m===M?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-muted-foreground hover:border-primary/50"),onClick:()=>o(M),disabled:w,children:e(M?`sport.${M}.label`:"admin.broadcast.all")},String(M)))}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:m?e("admin.broadcast.onlyMembers",{sport:e(`sport.${m}.label`)}):e("admin.broadcast.allMembers")})]})]}),y&&t.jsxs(ne,{className:"p-4",children:[t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:e("admin.broadcast.preview")}),t.jsxs("div",{className:"bg-secondary rounded-lg p-3",children:[t.jsx("p",{className:"text-sm font-semibold",children:l}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:r}),t.jsx("p",{className:"text-xs text-primary mt-1.5 break-all",children:P?e(P.labelKey):c.trim()})]}),u&&j!==null&&t.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:e("admin.broadcast.recipientCount",{count:j})})]}),t.jsx("div",{className:"flex flex-col gap-2",children:f?t.jsx(ae,{className:"w-full",variant:"outline",onClick:B,children:e("admin.broadcast.sendAnother")}):t.jsxs(t.Fragment,{children:[!u&&t.jsx(ae,{className:"w-full",variant:"outline",onClick:g,disabled:!y||d,children:e(d?"admin.broadcast.testSending":"admin.broadcast.testOnMyAccount")}
2),u&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between px-1",children:[t.jsxs("span",{className:"flex items-center gap-1 text-xs text-primary font-medium",children:[t.jsx(Gn,{className:"w-3.5 h-3.5"}),e("admin.broadcast.testSentConfirm")]}),t.jsx("button",{type:"button",className:"text-xs text-muted-foreground underline underline-offset-2",onClick:S,disabled:d,children:e("admin.modify")})]}),t.jsx(ae,{className:"w-full",onClick:I,disabled:!D||d,children:d?e("admin.broadcast.sending"):j!==null?e("admin.broadcast.sendTo",{count:j}):e("admin.broadcast.sendToAll")})]})]})})]})]})}function _a(a,e,n){const[l,s]=U.useState(!0),[r,i]=U.useState([]),{balance:c,refresh:x}=Li(),[m,o]=U.useState(e),[d,v]=U.useState(n),[u,p]=U.useState(null),f=Ze();U.useEffect(()=>{let h=!1;return(async()=>{const[y,w]=await Promise.all([ge.from("flex_items").select("code, kind, price, sort_order, available_until, event_label, event_theme, event_sports").eq("enabled",!0).order("sort_order",{ascending:!0}),ge.from("flex_inventory").select("item_code").eq("user_id",a)]);if(h)return;const P=new Set((w.data??[]).map(g=>g.item_code)),L=y.data??[];xr(L.filter(g=>g.kind==="card_frame"&&g.event_theme!==null)),i(Mi(L,P,f)),s(!1)})(),()=>{h=!0}},[a,f]);const b=U.useCallback(async h=>{p(h.code);try{const{error:y}=await ge.rpc("purchase_flex_item",{p_code:h.code,p_sport:f});return y?!1:(i(w=>w.map(P=>P.code===h.code?{...P,owned:!0}:P)),h.kind==="card_frame"?o(h.code):v(h.code),await x(),!0)}finally{p(null)}},[x,f]),j=U.useCallback(async(h,y)=>{p(y??"__unequip__");try{const{error:w}=await ge.rpc("equip_flex_item",{p_kind:h,p_code:y,p_sport:f});return w?!1:(h==="card_frame"?o(y):v(y),!0)}finally{p(null)}},[f]);return{loading:l,items:r,balance:c,equippedFrame:m,equippedTitle:d,busyCode:u,purchase:b,equip:j}}function Ma(a){const e=le.c(17),{style:n,editionName:l}=a,s=l&&n.edition?n.edition:null,r=!s,i=s?"h-20":"h-16";let c;e[0]!==n.animationClass||e[1]!==n.frame||e[2]!==i?(c=X("flex w-full items-center justify-center rounded-xl border-2 px-3",i,"bg-gradient-to-br from-slate-950 via-slate-900 to-slate-950",n.frame,n.animationClass),e[0]=n.animationClass,e[1]=n.frame,e[2]=i,e[3]=c):c=e[3];let x;e[4]!==n.glow?(x=n.glow?{boxShadow:n.glow}:{},e[4]=n.glow,e[5]=x):x=e[5];let m;e[6]!==n.frameStyle||e[7]!==x?(m={...n.frameStyle,...x},e[6]=n.frameStyle,e[7]=x,e[8]=m):m=e[8];let o;e[9]!==l||e[10]!==s?(o=s&&t.jsxs("span",{className:X("inline-flex max-w-full items-center gap-1.5 rounded-full px-3 py-1","text-[11px] font-bold",s.plaqueClass),children:[t.jsx(br,{name:s.icon,className:"h-3.5 w-3.5 shrink-0"}),t.jsx("span",{className:"truncate",children:l})]}),e[9]=l,e[10]=s,e[11]=o):o=e[11];let d;return e[12]!==r||e[13]!==c||e[14]!==m||e[15]!==o?(d=t.jsx("div",{"aria-hidden":r,className:c,style:m,children:o}),e[12]=r,e[13]=c,e[14]=m,e[15]=o,e[16]=d):d=e[16],d}function La(a){const e=le.c(14),{code:n}=a,{t:l}=oe();let s,r,i,c,x;if(e[0]!==n||e[1]!==l){x=Symbol.for("react.early_return_sentinel");e:{const d=hr(n);if(!d){x=null;break e}i=!0,c="flex h-16 w-full items-center justify-center rounded-xl px-3 text-center bg-gradient-to-br from-slate-950 via-slate-900 to-slate-950",
2s=X("text-[11px] font-bold uppercase leading-relaxed tracking-[0.14em]",d.textClass),r=l(d.labelKey)}e[0]=n,e[1]=l,e[2]=s,e[3]=r,e[4]=i,e[5]=c,e[6]=x}else s=e[2],r=e[3],i=e[4],c=e[5],x=e[6];if(x!==Symbol.for("react.early_return_sentinel"))return x;let m;e[7]!==s||e[8]!==r?(m=t.jsx("span",{className:s,children:r}),e[7]=s,e[8]=r,e[9]=m):m=e[9];let o;return e[10]!==i||e[11]!==c||e[12]!==m?(o=t.jsx("div",{"aria-hidden":i,className:c,children:m}),e[10]=i,e[11]=c,e[12]=m,e[13]=o):o=e[13],o}function Ia(a){const e=le.c(36),{item:n,equipped:l,busy:s,missingPoints:r,onPurchase:i,onEquip:c,onUnequip:x}=a,{t:m}=oe();let o;e[0]!==n||e[1]!==m?(o=$s(n,m),e[0]=n,e[1]=m,e[2]=o):o=e[2];const d=o;if(!d)return null;let v;e[3]!==n?(v=Hs(n),e[3]=n,e[4]=v):v=e[4];const u=v,p=!!u?.edition,f=p&&"col-span-2";let b;e[5]!==f?(b=X("relative p-3 flex flex-col gap-2",f),e[5]=f,e[6]=b):b=e[6];const j=`flex-item-${n.code}`;let h;e[7]!==n.code||e[8]!==n.limited||e[9]!==m?(h=n.limited&&t.jsx("span",{"data-testid":`flex-limited-${n.code}`,className:"absolute right-2 top-2 z-10 rounded-full bg-amber-500/90 px-2 py-0.5 text-[10px] font-bold text-slate-950",children:m("flexShop.limited")}),e[7]=n.code,e[8]=n.limited,e[9]=m,e[10]=h):h=e[10];let y;e[11]!==u||e[12]!==p||e[13]!==n.code||e[14]!==d?(y=u?t.jsx(Ma,{style:u,editionName:p?d:null}):t.jsx(La,{code:n.code}),e[11]=u,e[12]=p,e[13]=n.code,e[14]=d,e[15]=y):y=e[15];let w;e[16]!==p||e[17]!==d?(w=!p&&t.jsx("p",{className:"text-sm font-semibold",children:d}),e[16]=p,e[17]=d,e[18]=w):w=e[18];let P;e[19]!==s||e[20]!==l||e[21]!==n.owned||e[22]!==n.price||e[23]!==r||e[24]!==c||e[25]!==i||e[26]!==x||e[27]!==m?(P=n.owned?l?t.jsx(ae,{size:"sm",variant:"outline",disabled:s,onClick:x,children:m("flexShop.unequip")}):t.jsx(ae,{size:"sm",disabled:s,onClick:c,children:m("flexShop.equip")}):t.jsx(ae,{size:"sm",disabled:s||r!==null,onClick:i,children:r!==null?m("flexShop.missingPoints",{missing:r}):m("flexShop.buy",{price:n.price})}),e[19]=s,e[20]=l,e[21]=n.owned,e[22]=n.price,e[23]=r,e[24]=c,e[25]=i,e[26]=x,e[27]=m,e[28]=P):P=e[28];let L;return e[29]!==b||e[30]!==j||e[31]!==h||e[32]!==y||e[33]!==w||e[34]!==P?(L=t.jsxs(ne,{className:b,"data-testid":j,children:[h,y,w,P]}),e[29]=b,e[30]=j,e[31]=h,e[32]=y,e[33]=w,e[34]=P,e[35]=L):L=e[35],L}function Ta(a){const e=le.c(40),{userId:n,initialEquippedFrame:l,initialEquippedTitle:s,onBack:r}=a,{t:i}=oe(),{refetchProfile:c}=kt(),{loading:x,items:m,balance:o,equippedFrame:d,equippedTitle:v,busyCode:u,purchase:p,equip:f}=_a(n,l,s),b=m.filter(Va),j=m.filter(Ba),h=m.filter(Oa),[y,w]=U.useState("frames"),P=[{value:"frames",list:b,key:"flexShop.sectionFrames"},{value:"editions",list:j,key:"flexShop.sectionEditions"},{value:"titles",list:h,key:"flexShop.sectionTitles"}].filter(Fa).map(J=>{const{value:N,key:A}=J;return{value:N,label:i(A)}}),L=P.some(J=>J.value===y)?y:P[0]?.value??"frames";let g;e[0]!==p||e[1]!==c||e[2]!==i?(g=async function(N){if(!await p(N)){Z.error(i("flexShop.purchaseError"));return}Z.success(i("flexShop.purchased",{name:$s(N,i)??N.code})),c()},e[0]=p,e[1]=c,e[2]=i,e[3]=g):g=e[3];const I=g;let S;e[4]!==f||e[5]!==m||e[6]!==c||e[7]!==i?(S=async function(N,A){if(!await f(N,A)){Z.error(i("flexShop.equipError"));return}if(A===null)Z.success(i("flexShop.unequippedToast"));else{const H=m.find(ee=>ee.code===A);Z.success(i("flexShop.equippedToast",{name:(H&&$s(H,i))??A}))}c()},e[4]=f,e[5]=m,e[6]=c,e[7]=i,e[8]=S):S=e[8];const B=S;let D;e[9]!==o||e[10]!==u||e[11]!==B||e[12]!==I?(D=function(N,A,k){return A.length===0?null:t.jsx("section",{className:"grid grid-cols-2 gap-3",children:A.map(H=>t.jsx(Ia,{item:H,equipped:k===H.code,busy:u!==null,missingPoints:o!==null&&!H.owned&&o<H.price?H.price-o:null,onPurchase:()=>{I(H)},onEquip:()=>{B(N,H.code)},onUnequip:()=>{B(N,null)}},H.code))})},e[9]=o,e[10]=u,e[11]=B,e[12]=I,e[13]=D):D=e[13];const M=D,R="flex-1 overflow-y-auto pb-4";let T;e[14]!==i?(T=i("flexShop.title"),e[14]=i,e[15]=T):T=e[15];let F;e[16]!==i?(F=i("flexShop.subtitle"),e[16]=i,e[17]=F):F=e[17];let O;e[18]!==r||e[19]!==T||e[20]!==F?(O=t.jsx(we,{title:T,subtitle:F,onBack:r}),e[18]=r,e[19]=T,e[20]=F,e[21]=O):O=e[21];const G="px-4 flex flex-col gap-5";let E;e[22]!==o?(E=o!==null&&t.jsx(pr,{points:o,testId:"flex-shop-balance"}),e[22]=o,e[23]=E):E=e[23];let q;e[24]!==m||e[25]!==x||e[26]!==i?(q=!x&&m.some(Ra)&&t.jsx("p",{className:"text-center text-xs font-semibold text-muted-foreground","data-testid":"flex-shop-owned-count",children:i("flexShop.ownedCount",{count:m.filter(Da).length})}),e[24]=m,e[25]=x,e[26]=i,e[27]=q):q=e[27];const V=x?t.jsx("div",{className:"grid grid-cols-2 gap-3",children:[0,1,2,3].map(Aa)}):m.length===0?t.jsx(ne,{className:"p-4 text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:i("flexShop.empty")})}):t.jsxs(t.Fragment,{children:[P.length>1&&t.jsx(_i,{tabs:P,active:L,onChange:w,ariaLabel:i("flexShop.tabsAria"),testIdPrefix:"flex-shop-tab"}),L==="frames"&&M("card_frame",b,d),L==="editions"&&M("card_frame",j,d),L==="titles"&&M("card_title",h,v)]});let $;e[28]!==i?($=i("flexShop.footer"),e[28]=i,e[29]=$):$=e[29];let K;
2e[30]!==$?(K=t.jsx("p",{className:"text-xs text-muted-foreground text-center leading-relaxed pb-4",children:$}),e[30]=$,e[31]=K):K=e[31];let C;e[32]!==E||e[33]!==q||e[34]!==V||e[35]!==K?(C=t.jsxs("div",{className:G,children:[E,q,V,K]}),e[32]=E,e[33]=q,e[34]=V,e[35]=K,e[36]=C):C=e[36];let Q;return e[37]!==C||e[38]!==O?(Q=t.jsxs("div",{className:R,children:[O,C]}),e[37]=C,e[38]=O,e[39]=Q):Q=e[39],Q}function Aa(a){return t.jsx("div",{className:"h-32 rounded-lg bg-muted animate-pulse"},a)}function Da(a){return a.owned}function Ra(a){return a.owned}function Fa(a){const{list:e}=a;return e.length>0}function Oa(a){return a.kind==="card_title"}function Ba(a){return a.kind==="card_frame"&&Hs(a)?.edition}function Va(a){return a.kind==="card_frame"&&!Hs(a)?.edition}function Ua(a){const e=le.c(7);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=[],e[0]=n):n=e[0];const[l,s]=U.useState(n),[r,i]=U.useState(!0);let c,x;e[1]!==a?(c=()=>{let o=!1;return(async()=>{const{data:d,error:v}=await ge.rpc("get_referral_history",{p_user_id:a});if(o)return;if(v||!d){i(!1);return}const u=d,p=u.map($a),f=new Map;if(p.length>0){const{data:b}=await ge.from("profiles").select("id, identity_verified").in("id",p);for(const j of b??[])f.set(j.id,j.identity_verified===!0)}o||(i(!1),s(u.map(b=>({id:b.id,firstName:b.first_name,lastName:b.last_name,avatar:b.avatar,avatarUrl:b.avatar_url,joinedAt:b.joined_at,sessionsCount:Number(b.sessions_count),sports:b.sports??[],isActive:b.is_active,identityVerified:f.get(b.id)===!0}))))})(),()=>{o=!0}},x=[a],e[1]=a,e[2]=c,e[3]=x):(c=e[2],x=e[3]),U.useEffect(c,x);let m;return e[4]!==l||e[5]!==r?(m={history:l,loading:r},e[4]=l,e[5]=r,e[6]=m):m=e[6],m}function $a(a){return a.id}function Ka(a){const e=le.c(7);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=new Set,e[0]=n):n=e[0];const[l,s]=U.useState(n),[r,i]=U.useState(!0);let c,x;e[1]!==a?(c=()=>{let o=!1;return(async()=>{const d=await ge.from("referral_progress").select("filleul_id").eq("referrer_id",a);if(o)return;const v=d.data??[];s(new Set(v.map(za))),i(!1)})(),()=>{o=!0}},x=[a],e[1]=a,e[2]=c,e[3]=x):(c=e[2],x=e[3]),U.useEffect(c,x);let m;return e[4]!==r||e[5]!==l?(m={validatedIds:l,validatedCount:l.size,loading:r},e[4]=r,e[5]=l,e[6]=m):m=e[6],m}function za(a){return a.filleul_id}const Rs=3;function qa(a){const e=le.c(27),{history:n,loading:l,validatedIds:s}=a,{t:r}=oe(),[i,c]=U.useState(!1);if(l){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("div",{className:"flex flex-col gap-2",children:[0,1].map(Ha)}),e[0]=u):u=e[0],u}if(n.length===0){let u;e[1]!==r?(u=r("referral.noReferralsYet"),e[1]=r,e[2]=u):u=e[2];let p;e[3]!==u?(p=t.jsx("p",{className:"text-sm text-muted-foreground",children:u}),e[3]=u,e[4]=p):p=e[4];let f;e[5]!==r?(f=r("referral.shareToGetReferrals"),e[5]=r,e[6]=f):f=e[6];let b;e[7]!==f?(b=t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:f}),e[7]=f,e[8]=b):b=e[8];let j;return e[9]!==p||e[10]!==b?(j=t.jsxs(ne,{className:"p-4 text-center",children:[p,b]}),e[9]=p,e[10]=b,e[11]=j):j=e[11],j}let x;e[12]!==i||e[13]!==n?(x=i?n:n.slice(0,Rs),e[12]=i,e[13]=n,e[14]=x):x=e[14];const m=x;let o;if(e[15]!==m||e[16]!==s){let u;e[18]!==s?(u=p=>t.jsx(Wa,{entry:p,validated:s.has(p.id)},p.id),e[18]=s,e[19]=u):u=e[19],o=m.map(u),e[15]=m,e[16]=s,e[17]=o}else o=e[17];let d;e[20]!==i||e[21]!==n.length||e[22]!==r?(d=n.length>Rs&&t.jsx("button",{className:"text-xs text-primary text-center pt-1 hover:underline",onClick:()=>c(Ga),children:i?r("referral.showLess"):r("referral.showMore",{count:n.length-Rs})}),e[20]=i,e[21]=n.length,e[22]=r,e[23]=d):d=e[23];let v;return e[24]!==o||e[25]!==d?(v=t.jsxs("div",{className:"flex flex-col gap-2",children:[o,d]}),e[24]=o,e[25]=d,e[26]=v):v=e[26],v}function Ga(a){return!a}function Ha(a){return t.jsx("div",{className:"h-14 rounded-lg bg-muted animate-pulse"},a)}function Wa(a){const e=le.c(64),{entry:n,validated:l}=a,{t:s,i18n:r}=oe();let i,c,x,m,o,d,v,u;if(e[0]!==n.avatar||e[1]!==n.avatarUrl||e[2]!==n.firstName||e[3]!==n.id||e[4]!==n.identityVerified||e[5]!==n.joinedAt||e[6]!==n.lastName||e[7]!==n.sports||e[8]!==r.language||e[9]!==s||e[10]!==l){const L=new Date(n.joinedAt).toLocaleDateString(r.language,{day:"numeric",month:"short",year:"numeric"}),g=n.sports.filter(Qa),I=n.lastName??"";let S;e[19]!==n.avatar||e[20]!==n.avatarUrl||e[21]!==n.firstName||e[22]!==n.id||e[23]!==n.identityVerified||e[24]!==I?(S={id:n.id,firstName:n.firstName,lastName:I,avatar:n.avatar,avatarUrl:n.avatarUrl,level:1,city:"",identityVerified:n.identityVerified},e[19]=n.avatar,e[20]=n.avatarUrl,e[21]=n.firstName,e[22]=n.id,e[23]=n.identityVerified,e[24]=I,e[25]=S):S=e[25];const B=S;i=ne,v="p-3 flex items-center gap-3",e[26]!==B?(u=t.jsx(Nr,{user:B,size:36}),e[26]=B,e[27]=u):u=e[27],o="flex-1 min-w-0";const D=n.lastName?` ${n.lastName}`:"";let M;e[28]!==n.firstName||e[29]!==D?(M=t.jsxs("p",{className:"text-sm font-medium truncate",children:[n.firstName,D]}),e[28]=n.firstName,e[29]=D,e[30]=M):M=e[30];let R;e[31]!==s||e[32]!==l?(R=l?t.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[10px] font-semibold text-green-600 dark:text-green-400 bg-green-500/10 rounded-full px-1.5 py-0.5 shrink-0",children:[t.jsx(pt,{name:"check",className:"w-3 h-3 shrink-0"}),s("referral.validated")]}):t.jsx("span",{className:"text-[10px] text-muted-foreground bg-muted rounded-full px-1.5 py-0.5 shrink-0",children:s("referral.inProgress")}),e[31]=s,e[32]=l,e[33]=R):R=e[33],e[34]!==M||e[35]!==R?(d=t.jsxs("div",{className:"flex items-center gap-1.5",children:[M,R]}),e[34]=M,e[35]=R,e[36]=d):d=e[36],c="flex items-center gap-2 mt-0.5";const T=s("referral.since",{date:L});e[37]!==T?(x=t.jsx("p",{className:"text-xs text-muted-foreground",children:T}),e[37]=T,e[38]=x):x=e[38],m=g.length>0&&t.jsx("span",{className:"inline-flex items-center gap-1",children:g.map(Ya)}),e[0]=n.avatar,e[1]=n.avatarUrl,e[2]=n.firstName,e[3]=n.id,e[4]=n.identityVerified,e[5]=n.joinedAt,e[6]=n.lastName,e[7]=n.sports,e[8]=r.language,e[9]=s,e[10]=l,e[11]=i,e[12]=c,e[13]=x,e[14]=m,e[15]=o,e[16]=d,e[17]=v,e[18]=u}else i=e[11],c=e[12],x=e[13],m=e[14],o=e[15],d=e[16],v=e[17],u=e[18];let p;e[39]!==c||e[40]!==x||e[41]!==m?(p=t.jsxs("div",{className:c,children:[x,m]}),e[39]=c,e[40]=x,e[41]=m,e[42]=p):p=e[42];let f;e[43]!==o||e[44]!==d||e[45]!==p?(f=t.jsxs("div",{className:o,children:[d,p]}),e[43]=o,e[44]=d,e[45]=p,e[46]=f):f=e[46];const b=`text-center shrink-0 ${n.isActive?"text-green-600 dark:text-green-400":"text-muted-foreground"}`;let j;e[47]!==n.sessionsCount?(j=t.jsx("p",{className:"text-sm font-bold leading-none",children:n.sessionsCount}),e[47]=n.sessionsCount,e[48]=j):j=e[48];let h;e[49]!==n.sessionsCount||e[50]!==s?(h=s("referral.session",{count:n.sessionsCount}),e[49]=n.sessionsCount,e[50]=s,e[51]=h):h=e[51];let y;e[52]!==h?(y=t.jsx("p",{className:"text-[10px]",children:h}),e[52]=h,e[53]=y):y=e[53];let w;e[54]!==b||e[55]!==j||e[56]!==y?(w=t.jsxs("div",{className:b,children:[j,y]}),e[54]=b,e[55]=j,e[56]=y,e[57]=w):w=e[57];let P;return e[58]!==i||e[59]!==w||e[60]!==v||e[61]!==u||e[62]!==f?(P=t.jsxs(i,{className:v,children:[u,f,w]}),e[58]=i,e[59]=w,e[60]=v,e[61]=u,e[62]=f,e[63]=P):P=e[63],P}function Ya(a){return t.jsx(Lt,{sport:a,size:14},a)}function Qa(a){return Hn.some(e=>e.id===a)}function Xa(a){const e=le.c(86),{userId:n,onBack:l}=a,{t:s}=oe(),[r,i]=U.useState(null),{history:c,loading:x}=Ua(n),{validatedIds:m,validatedCount:o,loading:d}=Ka(n);let v,u;e[0]!==n?(v=()=>{let je=!1;return(async()=>{const{data:he}=await ge.rpc("get_my_profile").select("referral_code").eq("id",n).single();if(je||!he)return;const fe=he.referral_code;
2i(fe),je||On("referral_screen_viewed",{})})(),()=>{je=!0}},u=[n],e[0]=n,e[1]=v,e[2]=u):(v=e[1],u=e[2]),U.useEffect(v,u);const p=x?null:c.filter(Za).length;let f;e[3]!==r?(f=r?vr(r):null,e[3]=r,e[4]=f):f=e[4];const b=f,{share:j,copy:h}=Ii(b,"screen"),y=gr(d?0:o),w="flex-1 overflow-y-auto pb-4";let P;e[5]!==s?(P=s("referral.title"),e[5]=s,e[6]=P):P=e[6];let L;e[7]!==s?(L=s("referral.subtitle"),e[7]=s,e[8]=L):L=e[8];let g;e[9]!==l||e[10]!==P||e[11]!==L?(g=t.jsx(we,{title:P,subtitle:L,onBack:l}),e[9]=l,e[10]=P,e[11]=L,e[12]=g):g=e[12];const I="px-4 flex flex-col gap-6",S=ne,B="p-4 flex items-center gap-4";let D;e[13]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:t.jsx(yr,{className:"w-6 h-6 shrink-0 text-primary"})}),e[13]=D):D=e[13];const M=p===null?s("referral.loading"):p===0?s("referral.noReferrals"):s("referral.referralCount",{count:p});let R;e[14]!==M?(R=t.jsx("p",{className:"text-sm text-muted-foreground",children:M}),e[14]=M,e[15]=R):R=e[15];let T;e[16]!==d||e[17]!==s||e[18]!==o?(T=!d&&o>0&&t.jsx("p",{className:"text-xs font-semibold text-green-600 dark:text-green-400 mt-0.5",children:s("referral.validatedCount",{count:o})}),e[16]=d,e[17]=s,e[18]=o,e[19]=T):T=e[19];const F=y&&t.jsxs("span",{className:"text-xs font-semibold text-primary mt-1 inline-flex items-center gap-1",children:[t.jsx(pt,{name:y.icon,className:"w-3.5 h-3.5 shrink-0"}),s(y.labelKey)]});let O;e[20]!==r||e[21]!==p||e[22]!==s?(O=r!==null&&p!==null&&t.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:s("referral.onlyConfirmedCount",{sessionLabel:qe(Ze()).sessionLabel})}),e[20]=r,e[21]=p,e[22]=s,e[23]=O):O=e[23];let G;e[24]!==R||e[25]!==T||e[26]!==F||e[27]!==O?(G=t.jsxs("div",{children:[R,T,F,O]}),e[24]=R,e[25]=T,e[26]=F,e[27]=O,e[28]=G):G=e[28];let E;e[29]!==S||e[30]!==D||e[31]!==G?(E=t.jsxs(S,{className:B,children:[D,G]}),e[29]=S,e[30]=D,e[31]=G,e[32]=E):E=e[32];let q;e[33]!==s?(q=s("referral.reward",{referrerPoints:mn.referrer,refereePoints:mn.referee}),e[33]=s,e[34]=q):q=e[34];let V;e[35]!==q?(V=t.jsx("p",{"data-testid":"referral-reward",className:"text-sm leading-relaxed rounded-xl bg-primary/10 px-4 py-3",children:q}),e[35]=q,e[36]=V):V=e[36];let $;e[37]!==s?($=s("referral.yourLink"),e[37]=s,e[38]=$):$=e[38];let K;e[39]!==$?(K=t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:$}),e[39]=$,e[40]=K):K=e[40];let C;e[41]!==h||e[42]!==b||e[43]!==s?(C=b?t.jsxs(ne,{className:"p-3 flex items-center gap-2",children:[t.jsx("p",{className:"flex-1 text-xs font-mono text-muted-foreground truncate",children:b}),t.jsx("button",{onClick:h,className:"shrink-0 text-primary hover:opacity-70 transition-opacity","aria-label":s("referral.copyLink"),children:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),t.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})]}):t.jsx("div",{className:"h-10 rounded-lg bg-muted animate-pulse"}),e[41]=h,e[42]=b,e[43]=s,e[44]=C):C=e[44];let Q;e[45]!==K||e[46]!==C?(Q=t.jsxs("div",{children:[K,C]}),e[45]=K,e[46]=C,e[47]=Q):Q=e[47];const J=!b;let N;e[48]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(jr,{className:"mr-2"}),e[48]=N):N=e[48];let A;e[49]!==s?(A=s("referral.shareButton"),e[49]=s,e[50]=A):A=e[50];let k;e[51]!==j||e[52]!==J||e[53]!==A?(k=t.jsxs(ae,{className:"w-full",onClick:j,disabled:J,children:[N,A]}),e[51]=j,e[52]=J,e[53]=A,e[54]=k):k=e[54];const H=x?"â¦":c.length;let ee;e[55]!==s||e[56]!==H?(ee=s("referral.myReferrals",{count:H}),e[55]=s,e[56]=H,e[57]=ee):ee=e[57];let Y;e[58]!==ee?(Y=t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:ee}),e[58]=ee,e[59]=Y):Y=e[59];let te;e[60]!==s?(te=s("referral.validatedHint",{sessionLabelPlural:qe(Ze()).sessionLabelPlural}),e[60]=s,e[61]=te):te=e[61];let z;e[62]!==te?(z=t.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:te}),e[62]=te,e[63]=z):z=e[63];let se;e[64]!==c||e[65]!==x||e[66]!==m?(se=t.jsx(qa,{history:c,loading:x,val
2idatedIds:m}),e[64]=c,e[65]=x,e[66]=m,e[67]=se):se=e[67];let re;e[68]!==Y||e[69]!==z||e[70]!==se?(re=t.jsxs("div",{children:[Y,z,se]}),e[68]=Y,e[69]=z,e[70]=se,e[71]=re):re=e[71];let ie;e[72]!==s?(ie=s("referral.footerExplanation"),e[72]=s,e[73]=ie):ie=e[73];let de;e[74]!==ie?(de=t.jsx("p",{className:"text-xs text-muted-foreground text-center leading-relaxed pb-4",children:ie}),e[74]=ie,e[75]=de):de=e[75];let ue;e[76]!==E||e[77]!==V||e[78]!==Q||e[79]!==k||e[80]!==re||e[81]!==de?(ue=t.jsxs("div",{className:I,children:[E,V,Q,k,re,de]}),e[76]=E,e[77]=V,e[78]=Q,e[79]=k,e[80]=re,e[81]=de,e[82]=ue):ue=e[82];let me;return e[83]!==ue||e[84]!==g?(me=t.jsxs("div",{className:w,children:[g,ue]}),e[83]=ue,e[84]=g,e[85]=me):me=e[85],me}function Za(a){return a.isActive}function Ja(a){const e=le.c(16),n=a;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[0]=l):l=e[0];const[s,r]=U.useState(l),[i,c]=U.useState(!0);let x;e[1]!==n?(x=async()=>{let j=ge.from("deals").select("*").order("created_at",{ascending:!1});const{data:h,error:y}=await j;!y&&h&&r(h.map(eo)),c(!1)},e[1]=n,e[2]=x):x=e[2];const m=x;let o,d;e[3]!==m?(o=()=>{m()},d=[m],e[3]=m,e[4]=o,e[5]=d):(o=e[4],d=e[5]),U.useEffect(o,d);let v;e[6]!==m?(v=async j=>{const{error:h}=await ge.from("deals").insert({partner:j.partner,logo_url:j.logoUrl||null,title:j.title,description:j.description,code:j.code||null,url:j.url||null,tag:j.tag||null,created_by:(await ge.auth.getUser()).data.user?.id});return h||await m(),{error:h}},e[6]=m,e[7]=v):v=e[7];const u=v;let p;e[8]!==m?(p=async(j,h)=>{const{error:y}=await ge.from("deals").update({active:h}).eq("id",j);return y||await m(),{error:y}},e[8]=m,e[9]=p):p=e[9];const f=p;let b;return e[10]!==u||e[11]!==s||e[12]!==m||e[13]!==i||e[14]!==f?(b={deals:s,loading:i,createDeal:u,toggleDeal:f,refetch:m},e[10]=u,e[11]=s,e[12]=m,e[13]=i,e[14]=f,e[15]=b):b=e[15],b}function eo(a){return{id:a.id,partner:a.partner,logoUrl:a.logo_url,title:a.title,description:a.description,code:a.code,url:a.url,tag:a.tag,active:a.active,createdAt:a.created_at}}function to(a){const e=le.c(37),{onBack:n}=a,{t:l}=oe(),{deals:s,loading:r,createDeal:i,toggleDeal:c}=Ja(!0),[x,m]=U.useState(!1),[o,d]=U.useState(!1);let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v={partner:"",title:"",description:"",code:"",url:"",tag:"",logoUrl:""},e[0]=v):v=e[0];const[u,p]=U.useState(v);let f;e[1]!==i||e[2]!==u.code||e[3]!==u.description||e[4]!==u.logoUrl||e[5]!==u.partner||e[6]!==u.tag||e[7]!==u.title||e[8]!==u.url||e[9]!==l?(f=async()=>{if(!u.partner.trim()||!u.title.trim()||!u.description.trim()){Z.error(l("admin.deals.requiredFields"));return}d(!0);const{error:S}=await i({partner:u.partner.trim(),title:u.title.trim(),description:u.description.trim(),code:u.code.trim()||void 0,url:u.url.trim()||void 0,tag:u.tag.trim()||void 0,logoUrl:u.logoUrl.trim()||void 0});d(!1),S?Z.error(l("admin.deals.publishError")):(Z.success(l("admin.deals.publishSuccess")),p({partner:"",title:"",description:"",code:"",url:"",tag:"",logoUrl:""}),m(!1))},e[1]=i,e[2]=u.code,e[3]=u.description,e[4]=u.logoUrl,e[5]=u.partner,e[6]=u.tag,e[7]=u.title,e[8]=u.url,e[9]=l,e[10]=f):f=e[10];const b=f;let j;e[11]!==l||e[12]!==c?(j=async(S,B)=>{const{error:D}=await c(S,B);D?Z.error(l("admin.deals.toggleError")):Z.success(l(B?"admin.deals.reactivateSuccess":"admin.deals.deactivateSuccess"))},e[11]=l,e[12]=c,e[13]=j):j=e[13];const h=j;let y;e[14]!==l?(y=l("admin.deals.title"),e[14]=l,e[15]=y):y=e[15];let w;e[16]!==n||e[17]!==y?(w=t.jsx(we,{title:y,onBack:n}),e[16]=n,e[17]=y,e[18]=w):w=e[18];let P;e[19]!==u||e[20]!==b||e[21]!==o||e[22]!==x||e[23]!==l?(P=x?t.jsxs(ne,{className:"p-4 mb-4",children:[t.jsx("p",{className:"text-sm font-semibold mb-3",children:l("admin.deals.newDeal")}),t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.deals.partnerLabel")}),t.jsx(be,{placeholder:l("admin.deals.partnerPlaceholder"),value:u.partner,onChange:S=>p({...u,partner:S.target.value})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.deals.offerTitleLabel")}),t.jsx(be,{placeholder:l("admin.deals.offerTitlePlaceholder"),value:u.title,onChange:S=>p({...u,title:S.target.value})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.deals.descriptionLabel")}),t.jsx(Xt,{placeholder:l("admin.deals.descriptionPlaceholder"),value:u.description,onChange:S=>p({...u,description:S.target.value}),rows:3})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.deals.promoCodeL
2abel")}),t.jsx(be,{placeholder:"BUDDIZ20",value:u.code,onChange:S=>p({...u,code:S.target.value})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.deals.tagLabel")}),t.jsx(be,{placeholder:l("admin.deals.tagPlaceholder"),value:u.tag,onChange:S=>p({...u,tag:S.target.value})})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.deals.linkLabel")}),t.jsx(be,{placeholder:"https://...",value:u.url,onChange:S=>p({...u,url:S.target.value})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.deals.logoUrlLabel")}),t.jsx(be,{placeholder:"https://...",value:u.logoUrl,onChange:S=>p({...u,logoUrl:S.target.value})})]}),t.jsxs("div",{className:"flex gap-2 mt-1",children:[t.jsx(ae,{variant:"outline",className:"flex-1",onClick:()=>m(!1),disabled:o,children:l("common.cancel")}),t.jsx(ae,{className:"flex-1",onClick:b,disabled:o,children:l(o?"admin.deals.publishing":"admin.deals.publish")})]})]})]}):t.jsx(ae,{className:"w-full mb-4",onClick:()=>m(!0),children:l("admin.deals.addDeal")}),e[19]=u,e[20]=b,e[21]=o,e[22]=x,e[23]=l,e[24]=P):P=e[24];let L;e[25]!==s||e[26]!==h||e[27]!==r||e[28]!==x||e[29]!==l?(L=r?t.jsx("p",{className:"text-xs text-muted-foreground text-center mt-4",children:l("common.loading")}):s.length===0&&!x?t.jsx("p",{className:"text-xs text-muted-foreground text-center mt-4",children:l("admin.deals.nonePublished")}):t.jsx("div",{className:"flex flex-col gap-2",children:s.map(S=>t.jsx(ne,{className:"p-3",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:S.title}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:S.partner})]}),t.jsx("button",{className:"text-xs px-2.5 py-1 rounded-md border border-border text-muted-foreground hover:text-foreground transition-colors shrink-0",onClick:()=>h(S.id,!S.active),children:S.active?l("admin.deals.deactivate"):l("admin.deals.reactivate")})]})},S.id))}),e[25]=s,e[26]=h,e[27]=r,e[28]=x,e[29]=l,e[30]=L):L=e[30];let g;e[31]!==P||e[32]!==L?(g=t.jsxs("div",{className:"mx-4 mt-2",children:[P,L]}),e[31]=P,e[32]=L,e[33]=g):g=e[33];let I;return e[34]!==w||e[35]!==g?(I=t.jsxs("div",{className:"flex-1 overflow-y-auto pb-6",children:[w,g]}),e[34]=w,e[35]=g,e[36]=I):I=e[36],I}const so=zs(),Pn={sports:["running"],partnerName:"",title:"",description:"",date:"",locationName:"",city:"",lat:void 0,lng:void 0,websiteUrl:"",registrationUrl:"",facebookUrl:"",mapsUrl:"",imageUrl:"",partnerLogoUrl:""};function no(a){const e=le.c(60),{onBack:n}=a,{t:l}=oe(),{events:s,loading:r,createEvent:i,updateEvent:c,deleteEvent:x}=Di(),[m,o]=U.useState(!1),[d,v]=U.useState(null),[u,p]=U.useState(!1),[f,b]=U.useState(Pn);let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[0]=j):j=e[0];const[h,y]=U.useState(j),[w,P]=U.useState(""),[L,g]=U.useState("trail");let I;e[1]===Symbol.for("react.memo_cache_sentinel")?(I=k=>{b({sports:k.sports,partnerName:k.partnerName,title:k.title,description:k.description??"",date:k.date,locationName:k.locationName,city:k.city,lat:k.lat??void 0,lng:k.lng??void 0,mapsUrl:k.mapsUrl??"",websiteUrl:k.websiteUrl??"",registrationUrl:k.registrationUrl??"",facebookUrl:k.facebookUrl??"",imageUrl:k.imageUrl??"",partnerLogoUrl:k.partnerLogoUrl??""}),y(k.distances),v(k.id),o(!0)},e[1]=I):I=e[1];const S=I;let B;e[2]===Symbol.for("react.memo_cache_sentinel")?(B=()=>{b(Pn),y([]),v(null),o(!1)},e[2]=B):B=e[2];const D=B;let M;e[3]!==w||e[4]!==L?(M=()=>{const k=w.trim();k&&(y(H=>[...H,{label:k,type:L}]),P(""))},e[3]=w,e[4]=L,e[5]=M):M=e[5];const R=M;let T;e[6]===Symbol.for("react.memo_cache_sentinel")?(T=k=>{y(H=>H.filter((ee,Y)=>Y!==k))},e[6]=T):T=e[6];const F=T;let O;e[7]!==i||e[8]!==h||e[9]!==d||e[10]!==f.city||e[11]!==f.date||e[12]!==f.description||e[13]!==f.facebookUrl||e[14]!==f.imageUrl||e[15]!==f.lat||e[16]!==f.lng||e[17]!==f.locationName||e[18]!==f.mapsUrl||e[19]!==f.partnerLogoUrl||e[20]!==f.partnerName||e[21]!==f.registrationUrl||e[22]!==f.sports||e[23]!==f.title||e[24]!==f.websiteUrl||e[25]!==l||e[26]!==c?(O=async()=>
2{if(!f.partnerName.trim()||!f.title.trim()||!f.date||!f.locationName.trim()||!f.city.trim()||f.sports.length===0){Z.error(l("admin.partnerEvents.requiredFields"));return}p(!0);const k={sports:f.sports,partnerName:f.partnerName.trim(),title:f.title.trim(),description:f.description.trim()||null,date:f.date,locationName:f.locationName.trim(),city:f.city.trim(),lat:f.lat??null,lng:f.lng??null,mapsUrl:f.mapsUrl.trim()||null,websiteUrl:f.websiteUrl.trim()||null,registrationUrl:f.registrationUrl.trim()||null,facebookUrl:f.facebookUrl.trim()||null,imageUrl:f.imageUrl.trim()||null,partnerLogoUrl:f.partnerLogoUrl.trim()||null,distances:h},{error:H}=d?await c(d,k):await i(k);p(!1),H?Z.error(l(d?"admin.partnerEvents.editError":"admin.partnerEvents.createError")):(Z.success(l(d?"admin.partnerEvents.editSuccess":"admin.partnerEvents.createSuccess")),D())},e[7]=i,e[8]=h,e[9]=d,e[10]=f.city,e[11]=f.date,e[12]=f.description,e[13]=f.facebookUrl,e[14]=f.imageUrl,e[15]=f.lat,e[16]=f.lng,e[17]=f.locationName,e[18]=f.mapsUrl,e[19]=f.partnerLogoUrl,e[20]=f.partnerName,e[21]=f.registrationUrl,e[22]=f.sports,e[23]=f.title,e[24]=f.websiteUrl,e[25]=l,e[26]=c,e[27]=O):O=e[27];const G=O;let E;e[28]!==x||e[29]!==l?(E=async(k,H)=>{if(!confirm(l("admin.partnerEvents.deleteConfirm",{title:H})))return;const{error:ee}=await x(k);ee?Z.error(l("admin.partnerEvents.deleteError")):Z.success(l("admin.partnerEvents.deleteSuccess"))},e[28]=x,e[29]=l,e[30]=E):E=e[30];const q=E;let V;e[31]===Symbol.for("react.memo_cache_sentinel")?(V=new Date().toISOString().split("T"),e[31]=V):V=e[31];const $=V[0];let K;e[32]!==l?(K=l("admin.partnerEvents.title"),e[32]=l,e[33]=K):K=e[33];let C;e[34]!==n||e[35]!==K?(C=t.jsx(we,{title:K,onBack:n}),e[34]=n,e[35]=K,e[36]=C):C=e[36];let Q;e[37]!==h||e[38]!==d||e[39]!==f||e[40]!==R||e[41]!==G||e[42]!==w||e[43]!==L||e[44]!==u||e[45]!==m||e[46]!==l?(Q=m?t.jsxs(ne,{className:"p-4 mb-4",children:[t.jsx("p",{className:"text-sm font-semibold mb-3",children:l(d?"admin.partnerEvents.editEvent":"admin.partnerEvents.newEvent")}),t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.partnerEvents.sportsLabel")}),t.jsx("div",{className:"flex flex-wrap gap-2",children:so.map(k=>{const H=f.sports.includes(k);return t.jsx("button",{type:"button",className:X("py-1.5 px-3 rounded-lg border text-xs font-medium transition-all cursor-pointer",H?"border-primary bg-primary/10 text-primary":"border-border bg-input text-muted-foreground"),onClick:()=>{const ee=H?f.sports.filter(Y=>Y!==k):[...f.sports,k];ee.length>0&&b({...f,sports:ee})},children:l(`sport.${k}.label`)},k)})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.partnerEvents.partnerLabel")}),t.jsx(be,{placeholder:l("admin.partnerEvents.partnerPlaceholder"),value:f.partnerName,onChange:k=>b({...f,partnerName:k.target.value})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.partnerEvents.logoUrlLabel")}),t.jsx(be,{placeholder:"https://...",value:f.partnerLogoUrl,onChange:k=>b({...f,partnerLogoUrl:k.target.value})})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.partnerEvents.eventTitleLabel")}),t.jsx(be,{placeholder:l("admin.partnerEvents.eventTitlePlaceholder"),value:f.title,onChange:k=>b({...f,title:k.target.value})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.partnerEvents.descriptionLabel")}),t.jsx(Xt,{placeholder:l("admin.partnerEvents.descriptionPlaceholder"),value:f.description,onChange:k=>b({...f,description:k.target.value}),rows:4})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.partnerEvents.dateLabel")}),t.jsx(be,{type:"date",min:$,value:f.date,onChange:k=>b({...f,date:k.target.value})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.partnerEvents.locationLabel")}),t.jsx(be,{placeholder:l("admin.partnerEvents.locationPlaceholder"),value:f.locationName,onChange:k=>b({...f,locationName:k.target.value})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.partnerEvents.cityLabel")}),t.jsx(be,{placeholder:l("admin.partnerEvents.cityPlaceholder"),value:f.city,onChange:k=>b({...f,city:k.target.value})})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.partnerEvents.mapsLinkLabel")}),t.jsx(be,{placeholder:"https://maps.google.com/...",value:f.mapsUrl,onChange:k=>b({...f,mapsUrl:k.target.value})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.partnerEvents.registrationLinkLabel")}),t.jsx(be,{placeholder:"https://...",value:f.registrationUrl,onChange:k=>b({...f,registrationUrl:k.target.value})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.partnerEvents.websiteLabel")}),t.jsx(be,{placeholder:"https://...",value:f.websiteUrl,onChange:k=>b({...f,websiteUrl:k.target.value})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.partnerEvents.facebookLabel")}),t.jsx(be,{placeholder:"https://...",value:f.facebookUrl,onChange:k=>b({...f,facebookUrl:k.target.value})})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.partnerEvents.coverImageLabel")}),t.jsx(be,{placeholder:"https://...",value:f.imageUrl,onChange:k=>b({...f,imageUrl:k.target.value})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:l("admin.partnerEvents.distancesLabel")}),h.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:h.map((k,H)=>t.jsxs("span",{className:"text-xs font-medium py-0.5 px-2 rounded-md bg-amber-100 text-amber-700 dark:bg-amber-950/40 dark:text-amber-400 flex items-center gap-1",children:[k.label,t.jsx("button",{type:"button",className:"text-amber-500 hover:text-amber-800 ml-0.5",onClick:()=>F(H),children:"Ã"})]},H))}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(be,{placeholder:l("admin.partnerEvents.distancePlaceholder"),value:w,onChange:k=>P(k.target.value),className:"flex-1",onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),R())}}),t.jsxs(Jn,{value:L,onChange:k=>
2g(k.target.value),className:"w-24",children:[t.jsx(zt,{value:"trail",children:l("admin.partnerEvents.distanceTrail")}),t.jsx(zt,{value:"road",children:l("admin.partnerEvents.distanceRoad")}),t.jsx(zt,{value:"mixed",children:l("admin.partnerEvents.distanceMixed")}),t.jsx(zt,{value:"hiking",children:l("admin.partnerEvents.distanceHiking")}),t.jsx(zt,{value:"nordic",children:l("admin.partnerEvents.distanceNordic")})]}),t.jsx(ae,{type:"button",variant:"outline",size:"sm",onClick:R,disabled:!w.trim(),children:"+"})]})]}),t.jsxs("div",{className:"flex gap-2 mt-1",children:[t.jsx(ae,{variant:"outline",className:"flex-1",onClick:D,disabled:u,children:l("common.cancel")}),t.jsx(ae,{className:"flex-1",onClick:G,disabled:u,children:l(u?d?"admin.partnerEvents.editing":"admin.partnerEvents.creating":d?"common.save":"admin.partnerEvents.create")})]})]})]}):t.jsx(ae,{className:"w-full mb-4",onClick:()=>o(!0),children:l("admin.partnerEvents.addEvent")}),e[37]=h,e[38]=d,e[39]=f,e[40]=R,e[41]=G,e[42]=w,e[43]=L,e[44]=u,e[45]=m,e[46]=l,e[47]=Q):Q=e[47];let J;e[48]!==s||e[49]!==q||e[50]!==r||e[51]!==m||e[52]!==l?(J=r?t.jsx("p",{className:"text-xs text-muted-foreground text-center mt-4",children:l("common.loading")}):s.length===0&&!m?t.jsx("p",{className:"text-xs text-muted-foreground text-center mt-4",children:l("admin.partnerEvents.noEvents")}):t.jsx("div",{className:"flex flex-col gap-2",children:s.map(k=>{const H=k.date<$;return t.jsx(ne,{className:X("p-3",H&&"opacity-60"),children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:k.title}),t.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[k.partnerName," · ",Ks(k.date)," · ",k.city]}),k.distances.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:k.distances.map(lo)})]}),t.jsxs("div",{className:"flex gap-1.5 shrink-0",children:[t.jsx("button",{className:"text-xs px-2.5 py-1 rounded-md border border-border text-muted-foreground hover:text-foreground transition-colors",onClick:()=>S(k),children:l("admin.modify")}),t.jsx("button",{className:"text-xs px-2.5 py-1 rounded-md border border-border text-destructive hover:bg-destructive/10 transition-colors",onClick:()=>q(k.id,k.title),children:l("admin.delete")})]})]})},k.id)})}),e[48]=s,e[49]=q,e[50]=r,e[51]=m,e[52]=l,e[53]=J):J=e[53];let N;e[54]!==Q||e[55]!==J?(N=t.jsxs("div",{className:"mx-4 mt-2",children:[Q,J]}),e[54]=Q,e[55]=J,e[56]=N):N=e[56];let A;return e[57]!==C||e[58]!==N?(A=t.jsxs("div",{className:"flex-1 overflow-y-auto pb-6",children:[C,N]}),e[57]=C,e[58]=N,e[59]=A):A=e[59],A}function lo(a,e){return t.jsx("span",{className:"text-[10px] py-0.5 px-1.5 rounded bg-amber-100 text-amber-700 dark:bg-amber-950/40 dark:text-amber-400",children:a.label},e)}function ro(a){return{id:a.id,creatorId:a.creator_id,active:a.active,dayOfWeek:a.day_of_week,timeStart:a.time_start.slice(0,5),timeEnd:a.time_end?a.time_end.slice(0,5):null,sport:a.sport,terrainId:a.terrain_id??null,description:a.description??"",sessionName:a.session_name??null,acceptanceMode:a.acceptance_mode??"auto",visibility:a.visibility??"public",womenOnly:a.women_only??!1,levelMin:a.level_min??null,levelMax:a.level_max??null,placesTotal:a.places_total??null,courtId:a.court_id??null,courtNumber:a.court_number??null,balancedSides:a.balanced_sides??!1,runType:a.run_type??null,runningSurfaces:a.running_surfaces??[],difficulty:a.difficulty??null,gpxFileUrl:a.gpx_file_url??null,distanceKm:a.distance_km??null,durationMinutes:a.duration_minutes??null,elevationM:a.elevation_m??null,paceMin:a.pace_min??null,paceMax:a.pace_max??null,meetingPointAddress:a.meeting_point_address??null,meetingPointLat:a.meeting_point_lat??null,meetingPointLng:a.meeting_point_lng??null,maxParticipants:a.max_participants??null,foot5Levels:a.foot5_levels??[],hikeType:a.hike_type??null,activityType:a.activity_type??null,hikingSurfaces:a.hiking_surfaces??[],bikeType:a.bike_type??null,veloTerrains:a.velo_terrains??[],autoCancelHours:a.auto_cancel_hours??24,createdForName:a.created_for_name??null,createdForLogo:a.created_for_logo??null,clubId:a.club_id??null,createdAt:a.created_at,deactivatedAt:a.deactivated_at??null,endsAt:a.ends_at??null,expiry2Notified:a.expiry_2_notified??!1,expiry1Notified:a.expiry_1_notified??!1}}function io(){const[a,e]=U.useState([]),[n,l]=U.useState(!0),s=U.useCallback(async()=>
2{l(!0);try{const{data:m,error:o}=await ge.from("recurring_sessions").select("*").order("active",{ascending:!1}).order("day_of_week",{ascending:!0});if(o){console.error("Error fetching recurring sessions:",o),e([]);return}e((m??[]).map(ro))}finally{l(!1)}},[]);return U.useEffect(()=>{s()},[s]),{templates:a,loading:n,createTemplate:async m=>{const{data:{user:o}}=await ge.auth.getUser();if(!o)return{error:new Error("Not authenticated")};const{error:d}=await ge.from("recurring_sessions").insert({creator_id:o.id,sport:m.sport,day_of_week:m.dayOfWeek,time_start:m.timeStart,time_end:m.timeEnd||null,terrain_id:m.terrainId??null,description:m.description??"",session_name:m.sessionName||null,acceptance_mode:m.acceptanceMode??"auto",visibility:m.visibility??"public",women_only:m.womenOnly??!1,level_min:m.levelMin??null,level_max:m.levelMax??null,places_total:m.placesTotal??null,court_id:m.courtId??null,court_number:m.courtNumber||null,balanced_sides:m.balancedSides??!1,run_type:m.runType||null,running_surfaces:m.runningSurfaces??[],difficulty:m.difficulty||null,gpx_file_url:m.gpxFileUrl||null,distance_km:m.distanceKm??null,duration_minutes:m.durationMinutes??null,elevation_m:m.elevationM??null,pace_min:m.paceMin??null,pace_max:m.paceMax??null,meeting_point_address:m.meetingPointAddress||null,meeting_point_lat:m.meetingPointLat??null,meeting_point_lng:m.meetingPointLng??null,max_participants:m.maxParticipants??null,foot5_levels:m.foot5Levels??[],activity_type:m.activityType||null,hike_type:m.hikeType||null,hiking_surfaces:m.hikingSurfaces??[],bike_type:m.bikeType||null,velo_terrains:m.veloTerrains??[],auto_cancel_hours:m.autoCancelHours??24,created_for_name:m.createdForName||null,created_for_logo:m.createdForLogo||null,club_id:m.clubId??null});return d||await s(),{error:d}},updateTemplate:async(m,o)=>{const d={};o.dayOfWeek!==void 0&&(d.day_of_week=o.dayOfWeek),o.timeStart!==void 0&&(d.time_start=o.timeStart),o.timeEnd!==void 0&&(d.time_end=o.timeEnd||null),o.terrainId!==void 0&&(d.terrain_id=o.terrainId),o.description!==void 0&&(d.description=o.description),o.sessionName!==void 0&&(d.session_name=o.sessionName||null),o.acceptanceMode!==void 0&&(d.acceptance_mode=o.acceptanceMode),o.visibility!==void 0&&(d.visibility=o.visibility),o.womenOnly!==void 0&&(d.women_only=o.womenOnly),o.levelMin!==void 0&&(d.level_min=o.levelMin),o.levelMax!==void 0&&(d.level_max=o.levelMax),o.placesTotal!==void 0&&(d.places_total=o.placesTotal),o.courtId!==void 0&&(d.court_id=o.courtId),o.courtNumber!==void 0&&(d.court_number=o.courtNumber||null),o.balancedSides!==void 0&&(d.balanced_sides=o.balancedSides),o.runType!==void 0&&(d.run_type=o.runType||null),o.runningSurfaces!==void 0&&(d.running_surfaces=o.runningSurfaces),o.difficulty!==void 0&&(d.difficulty=o.difficulty||null),o.distanceKm!==void 0&&(d.distance_km=o.distanceKm),o.durationMinutes!==void 0&&(d.duration_minutes=o.durationMinutes),o.elevationM!==void 0&&(d.elevation_m=o.elevationM),o.paceMin!==void 0&&(d.pace_min=o.paceMin),o.paceMax!==void 0&&(d.pace_max=o.paceMax),o.meetingPointAddress!==void 0&&(d.meeting_point_address=o.meetingPointAddress||null),o.meetingPointLat!==void 0&&(d.meeting_point_lat=o.meetingPointLat),o.meetingPointLng!==void 0&&(d.meeting_point_lng=o.meetingPointLng),o.maxParticipants!==void 0&&(d.max_participants=o.maxParticipants),o.foot5Levels!==void 0&&(d.foot5_levels=o.foot5Levels),o.activityType!==void 0&&(d.activity_type=o.activityType||null),o.hikeType!==void 0&&(d.hike_type=o.hikeType||null),o.hikingSurfaces!==void 0&&(d.hiking_surfaces=o.hikingSurfaces),o.bikeType!==void 0&&(d.bike_type=o.bikeType||null),o.veloTerrains!==void 0&&(d.velo_terrains=o.veloTerrains),o.autoCancelHours!==void 0&&(d.auto_cancel_hours=o.autoCancelHours),o.gpxFileUrl!==void 0&&(d.gpx_file_url=o.gpxFileUrl||null),o.createdForName!==void 0&&(d.created_for_name=o.createdForName||null),o.createdForLogo!==void 0&&(d.created_for_logo=o.createdForLogo||null),o.clubId!==void 0&&(d.club_id=o.clubId);const{error:v}=await ge.from("recurring_sessions").update(d).eq("id",m);if(v)return{error:v};const u=new Date().toISOString().split("T")[0],p={};for(const[f,b]of Object.entries(d))f==="day_of_week"||f==="auto_cancel_hours"||(p[f]=b);return Object.keys(p).length>0&&await ge.from("sessions").update(p).eq("recurring_group_id",m).gte("date",u).is("deleted_at",null),await s(),{error:null}},deactivateTemplate:async m=>{const{error:o}=await ge.from("recurring_sessions").update({active:!1,deactivated_at:new Date().toISOString()}).eq("id",m);return o||await s(),{error:o}},reactivateTemplate:async m=>{const{error:o}=await ge.from("recurring_sessions").update({active:!0,deactivated_at:null}).eq("id",m);return o||await s(),{error:o}},refetch:s}}function ao(a){const e=le.c(92),{set:n,levelMin:l,levelMax:s,places:r,balancedSides:i,creatorSide:c,setCreatorSide:x,handleLevelClick:m}=a,{t:o}=oe();let d;e[0]!==o?(d=o("createForm.levelRequired"),e[0]=o,e[1]=d):d=e[1];let v;e[2]!==d?(v=t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:d}),e[2]=d,e[3]=v):v=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=[1,2,3,4,5,6,7,8,9,10],e[4]=u):u=e[4];let p;e[5]!==m||e[6]!==s||e[7]!==l?(p=t.jsx("div",{className:"flex gap-1 mb-2",children:u.map(z=>{const se=l??1,re=s??10,ie=z>=se&&z<=re,de=se===1&&re===10;return t.jsx("button",{type:"button",className:X("flex-1 h-[34px] rounded-[7px] flex items-center justify-center text-[13px] font-bold cursor-pointer transition-all border min-w-0",ie&&!de?"bg-primary text-primary-foreground border-primary":ie&&de?"bg-secondary text-muted-foreground border-border":"bg-input text-muted-foreground border-border hover:border-primary/50"),onClick:()=>m(z),children:z},z)})}),e[5]=m,e[6]=s,e[7]=l,e[8]=p):p=e[8];let f;e[9]!==s||e[10]!==l||e[11]!==o?(f=l===null||l===1&&s===10?o("createForm.allLevels"):l===s?`${l} - ${ps[l]}`:`${l} ${ps[l]} â ${s} ${ps[s]}`,e[9]=s,e[10]=l,e[11]=o,e[12]=f):f=e[12];let b;e[13]!==f?(b=t.jsx("div",{className:"text-xs text-muted-foreground text-center",children:f}),e[13]=f,e[14]=b):b=e[14];let j;e[15]!==p||e[16]!==b?(j=t.jsxs("div",{className:"bg-input border border-border rounded-[10px] p-3",children:[p,b]}),e[15]=p,e[16]=b,e[17]=j):j=e[17];let h;e[18]!==v||e[19]!==j?(h=t.jsxs("div",{className:"mb-4",children:[v,j]}),e[18]=v,e[19]=j,e[20]=h):h=e[20];let y;e[21]!==o?(y=o("createForm.missingPlayers"),e[21]=o,e[22]=y):y=e[22];let w;e[23]!==y?(w=t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:y}),e[23]=y,e[24]=w):w=e[24];let P;e[25]!==r||e[26]!==n?(P=t.jsx("button",{type:"button",className:"w-[38px] h-[38px] rounded-[10px] border border-border bg-input text-foreground text-xl flex items-center justify-center cursor-pointer hover:border-primary hover:text-primary",onClick:()=>n("placesTotal",Math.max(1,r-1)),children:"â"}),e[25]=r,e[26]=n,e[27]=P):P=e[27];let L;e[28]!==r?(L=t.jsx("span",{className:"text-lg font-semibold min-w-6 text-center",children:r}),e[28]=r,e[29]=L):L=e[29];let g;e[30]!==r||e[31]!==n?(g=t.jsx("button",{type:"button",className:"w-[38px] h-[38px] rounded-[10px] border border-border bg-input text-foreground text-xl flex items-center justify-center cursor-pointer hover:border-primary hover:text-primary",onClick:()=>n("placesTotal",Math.min(3,r+1)),children:"+"}),e[30]=r,e[31]=n,e[32]=g):g=e[32];const I=4-r,S=r>1?"s":"";let B;e[33]!==r||e[34]!==o||e[35]!==I||e[36]!==S?(B=o("recurring.playersCount",{existing:
2I,places:r,plural:S}),e[33]=r,e[34]=o,e[35]=I,e[36]=S,e[37]=B):B=e[37];let D;e[38]!==B?(D=t.jsx("span",{className:"text-xs text-muted-foreground",children:B}),e[38]=B,e[39]=D):D=e[39];let M;e[40]!==P||e[41]!==L||e[42]!==g||e[43]!==D?(M=t.jsxs("div",{className:"flex items-center gap-3.5",children:[P,L,g,D]}),e[40]=P,e[41]=L,e[42]=g,e[43]=D,e[44]=M):M=e[44];let R;e[45]!==w||e[46]!==M?(R=t.jsxs("div",{className:"mb-4",children:[w,M]}),e[45]=w,e[46]=M,e[47]=R):R=e[47];let T;e[48]!==o?(T=o("createForm.balancedComposition"),e[48]=o,e[49]=T):T=e[49];let F;e[50]!==T?(F=t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:T}),e[50]=T,e[51]=F):F=e[51];const O=i?"border-emerald-500 bg-emerald-500/10":"border-border bg-input";let G;e[52]!==O?(G=X("w-full flex items-center gap-3 py-3 px-4 rounded-[10px] border text-left cursor-pointer transition-all",O),e[52]=O,e[53]=G):G=e[53];let E;e[54]!==i||e[55]!==n?(E=()=>n("balancedSides",!i),e[54]=i,e[55]=n,e[56]=E):E=e[56];const q=i?"bg-emerald-500":"bg-muted-foreground/30";let V;e[57]!==q?(V=X("w-10 h-6 rounded-full relative transition-colors shrink-0",q),e[57]=q,e[58]=V):V=e[58];const $=i?"translate-x-[18px]":"translate-x-0.5";let K;e[59]!==$?(K=X("absolute top-0.5 w-5 h-5 rounded-full bg-white transition-transform",$),e[59]=$,e[60]=K):K=e[60];let C;e[61]!==K?(C=t.jsx("div",{className:K}),e[61]=K,e[62]=C):C=e[62];let Q;e[63]!==V||e[64]!==C?(Q=t.jsx("div",{className:V,children:C}),e[63]=V,e[64]=C,e[65]=Q):Q=e[65];const J=i?"text-emerald-500":"text-muted-foreground";let N;e[66]!==J?(N=X("text-[13px] font-medium",J),e[66]=J,e[67]=N):N=e[67];let A;e[68]!==o?(A=o("createForm.balancedDesc"),e[68]=o,e[69]=A):A=e[69];let k;e[70]!==N||e[71]!==A?(k=t.jsx("span",{className:N,children:A}),e[70]=N,e[71]=A,e[72]=k):k=e[72];let H;e[73]!==G||e[74]!==E||e[75]!==Q||e[76]!==k?(H=t.jsxs("button",{type:"button",className:G,onClick:E,children:[Q,k]}),e[73]=G,e[74]=E,e[75]=Q,e[76]=k,e[77]=H):H=e[77];let ee;e[78]!==i||e[79]!==c||e[80]!==r||e[81]!==x||e[82]!==o?(ee=i&&t.jsxs("div",{className:"mt-3",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:o("createForm.yourSide")}),t.jsx("div",{className:"flex gap-2",children:["left","right","both"].map(z=>t.jsx("button",{type:"button",className:X("flex-1 py-2 rounded-[10px] border text-[13px] text-center cursor-pointer font-medium transition-all",c===z?"border-emerald-500 bg-emerald-500/10 text-emerald-500":"border-border bg-input text-muted-foreground"),onClick:()=>x(c===z?null:z),children:o(z==="left"?"createForm.left":z==="right"?"createForm.right":"createForm.both")},z))}),fn([c],0).summaryLong&&t.jsx("p",{className:"text-[12px] font-medium text-emerald-500 mt-1.5",children:fn([c],r).summaryLong})]}),e[78]=i,e[79]=c,e[80]=r,e[81]=x,e[82]=o,e[83]=ee):ee=e[83];let Y;e[84]!==F||e[85]!==H||e[86]!==ee?(Y=t.jsxs("div",{className:"mb-4",children:[F,H,ee]}),e[84]=F,e[85]=H,e[86]=ee,e[87]=Y):Y=e[87];let te;return e[88]!==R||e[89]!==Y||e[90]!==h?(te=t.jsxs(t.Fragment,{children:[h,R,Y]}),e[88]=R,e[89]=Y,e[90]=h,e[91]=te):te=e[91],te}function oo(a){const e=le.c(28),{form:n,set:l}=a,{t:s}=oe();let r;e[0]!==s?(r=s("createForm.format"),e[0]=s,e[1]=r):r=e[1];let i;e[2]!==r?(i=t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:r}),e[2]=r,e[3]=i):i=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=["5v5","4v4"],e[4]=c):c=e[4];let x;e[5]!==n||e[6]!==l||e[7]!==s?(x=t.jsx("div",{className:"flex gap-2",children:c.map(b=>{const j=b==="4v4"?8:10;return t.jsx("button",{type:"button",className:X("flex-1 py-2.5 rounded-[10px] border text-center cursor-pointer font-medium transition-all text-[13px]",n.placesTotal===j?"border-primary bg-primary/10 text-primary":"border-border bg-input text-muted-foreground"),onClick:()=>l("placesTotal",j),children:s(b==="5v5"?"createForm.format5v5":"createForm.format4v4")},b)})}),e[5]=n,e[6]=l,e[7]=s,e[8]=x):x=e[8];let m;e[9]!==i||e[10]!==x?(m=t.jsxs("div",{className:"mb-4",children:[i,x]}),e[9]=i,e[10]=x,e[11]=m):m=e[11];let o;e[12]!==s?(o=s("createForm.levelRequired"),e[12]=s,e[13]=o):o=e[13];let d;e[14]!==o?(d=t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:o}),e[14]=o,e[15]=d):d=e[15];let v;e[16]!==n||e[17]!==l||e[18]!==s?(v=$n.map(b=>{const j=(n.foot5Levels??[]).includes(b.value);return t.jsxs("button",{type:"button",className:X("flex-1 py-3 px-2 rounded-[10px] border text-center cursor-pointer transition-all flex flex-col items-center gap-1",j?`border-current ${zn[b.value]}`:"border-border bg-input text-muted-foreground hover:border-primary/50"),onClick:()=>{const h=n.foot5Levels??[];l("foot5Levels",h.includes(b.value)?h.filter(y=>y!==b.value):[...h,b.value])},children:[t.jsx(Kn,{level:b.value,className:"w-5 h-5 shrink-0"}),t.jsx("span",{className:"text-[13px] font-semibold",children:s(b.labelKey)}),t.jsx("span",{className:"text-[11px] leading-tight opacity-80",children:s(b.descriptionKey)})]},b.value)}),e[16]=n,e[17]=l,e[18]=s,e[19]=v):v=e[19];let u;e[20]!==v?(u=t.jsx("div",{className:"flex gap-2",children:v}),e[20]=v,e[21]=u):u=e[21];let p;e[22]!==d||e[23]!==u?(p=t.jsxs("div",{className:"mb-4",children:[d,u]}),e[22]=d,e[23]=u,e[24]=p):p=e[24];let f;
2return e[25]!==p||e[26]!==m?(f=t.jsxs(t.Fragment,{children:[m,p]}),e[25]=p,e[26]=m,e[27]=f):f=e[27],f}function co(a){const e=le.c(45),{value:n,onChange:l,presets:s}=a,{t:r}=oe(),i=s??Sr;let c;e[0]!==i||e[1]!==n?(c=n!=null?i.find(R=>R.value===n):void 0,e[0]=i,e[1]=n,e[2]=c):c=e[2];const x=c,[m,o]=U.useState(n!=null&&!x),[d,v]=U.useState(m&&n!=null?String(n):"");let u,p;e[3]!==i||e[4]!==n?(u=()=>{(n!=null?i.find(T=>T.value===n):void 0)?(o(!1),v("")):n!=null?(o(!0),v(String(n))):(o(!1),v(""))},p=[n,i],e[3]=i,e[4]=n,e[5]=u,e[6]=p):(u=e[5],p=e[6]),U.useEffect(u,p);let f;e[7]!==l||e[8]!==n?(f=R=>{n===R?l?.(void 0):(o(!1),v(""),l?.(R))},e[7]=l,e[8]=n,e[9]=f):f=e[9];const b=f;let j;e[10]!==l?(j=()=>{o(!0),l?.(void 0)},e[10]=l,e[11]=j):j=e[11];const h=j;let y;e[12]!==l?(y=R=>{if(v(R),R===""){l?.(void 0);return}const T=parseFloat(R);!isNaN(T)&&T>0&&l?.(T)},e[12]=l,e[13]=y):y=e[13];const w=y;let P;if(e[14]!==i||e[15]!==m||e[16]!==b||e[17]!==r||e[18]!==n){let R;e[20]!==m||e[21]!==b||e[22]!==r||e[23]!==n?(R=T=>t.jsx("button",{type:"button",className:X("py-2 px-3 rounded-[10px] border text-[13px] cursor-pointer font-medium transition-all",n===T.value&&!m?"border-primary bg-primary/10 text-primary":"border-border bg-input text-muted-foreground"),onClick:()=>b(T.value),"aria-pressed":n===T.value&&!m,children:T.labelKey?r(T.labelKey):T.label},T.value),e[20]=m,e[21]=b,e[22]=r,e[23]=n,e[24]=R):R=e[24],P=i.map(R),e[14]=i,e[15]=m,e[16]=b,e[17]=r,e[18]=n,e[19]=P}else P=e[19];const L=m?"border-primary bg-primary/10 text-primary":"border-border bg-input text-muted-foreground";let g;e[25]!==L?(g=X("py-2 px-3 rounded-[10px] border text-[13px] cursor-pointer font-medium transition-all",L),e[25]=L,e[26]=g):g=e[26];let I;e[27]!==r?(I=r("common.other"),e[27]=r,e[28]=I):I=e[28];let S;e[29]!==m||e[30]!==h||e[31]!==I||e[32]!==g?(S=t.jsx("button",{type:"button",className:g,onClick:h,"aria-pressed":m,children:I}),e[29]=m,e[30]=h,e[31]=I,e[32]=g,e[33]=S):S=e[33];let B;e[34]!==S||e[35]!==P?(B=t.jsxs("div",{className:"flex flex-wrap gap-2 mb-2",children:[P,S]}),e[34]=S,e[35]=P,e[36]=B):B=e[36];let D;e[37]!==m||e[38]!==d||e[39]!==w||e[40]!==r?(D=m&&t.jsx(be,{type:"number",step:"0.1",min:"0.5",max:"200",placeholder:r("distancePicker.distanceInKm"),value:d,onChange:R=>w(R.target.value),autoFocus:!0,className:"max-w-[180px]"}),e[37]=m,e[38]=d,e[39]=w,e[40]=r,e[41]=D):D=e[41];let M;return e[42]!==B||e[43]!==D?(M=t.jsxs("div",{children:[B,D]}),e[42]=B,e[43]=D,e[44]=M):M=e[44],M}const Fs=[{label:"30 min",value:30},{label:"45 min",value:45},{label:"1h",value:60},{label:"1h30",value:90},{label:"2h",value:120}];function uo(a){const e=le.c(45),{value:n,onChange:l}=a,{t:s}=oe();let r;e[0]!==n?(r=n!=null?Fs.find(V=>V.value===n):void 0,e[0]=n,e[1]=r):r=e[1];const i=r,[c,x]=U.useState(n!=null&&!i),[m,o]=U.useState("min");let d;e[2]!==c||e[3]!==n?(d=c&&n!=null?Ds(n,"min"):"",e[2]=c,e[3]=n,e[4]=d):d=e[4];const[v,u]=U.useState(d),[p,f]=U.useState(n),[b,j]=U.useState(n);if(n!==b&&(j(n),n!==p)){const V=n!=null?Fs.find($=>$.value===n):void 0;n==null||V?(x(!1),u("")):(x(!0),u(Ds(n,m)))}let h;e[5]!==l?(h=V=>{f(V),l?.(V)},e[5]=l,e[6]=h):h=e[6];const y=h;let w;e[7]!==y||e[8]!==n?(w=V=>{n===V?y(void 0):(x(!1),u(""),y(V))},e[7]=y,e[8]=n,e[9]=w):w=e[9];const P=w;let L;e[10]!==y?(L=()=>{x(!0),u(""),y(void 0)},e[10]=y,e[11]=L):L=e[11];const g=L;let I;e[12]!==y||e[13]!==m?(I=V=>{if(u(V),V.trim()===""){y(void 0);return}const $=bn(V,m);$!==null&&$>0&&y($)},e[12]=y,e[13]=m,e[14]=I):I=e[14];const S=I;let B;e[15]!==v||e[16]!==y||e[17]!==m?(B=V=>{if(V===m)return;const $=bn(v,m);$!==null&&$>0&&(u(Ds($,V)),y($)),o(V)},e[15]=v,e[16]=y,e[17]=m,e[18]=B):B=e[18];const D=B;let M;e[19]!==c||e[20]!==P||e[21]!==n?(M=Fs.map(V=>t.jsx("button",{type:"button",className:X("py-2 px-3 rounded-[10px] border text-[13px] cursor-pointer font-medium transition-all",n===V.value&&!c?"border-primary bg-primary/10 text-primary":"border-border bg-input text-muted-foreground"),onClick:()=>P(V.value),"aria-pressed":n===V.value&&!c,children:V.label},V.value)),e[19]=c,e[20]=P,e[21]=n,e[22]=M):M=e[22];const R=c?"border-primary bg-primary/10 text-primary":"border-border bg-input text-muted-foreground";let T;e[23]!==R?(T=X("py-2 px-3 rounded-[10px] border text-[13px] curs
2or-pointer font-medium transition-all",R),e[23]=R,e[24]=T):T=e[24];let F;e[25]!==s?(F=s("common.other"),e[25]=s,e[26]=F):F=e[26];let O;e[27]!==c||e[28]!==g||e[29]!==T||e[30]!==F?(O=t.jsx("button",{type:"button",className:T,onClick:g,"aria-pressed":c,children:F}),e[27]=c,e[28]=g,e[29]=T,e[30]=F,e[31]=O):O=e[31];let G;e[32]!==O||e[33]!==M?(G=t.jsxs("div",{className:"flex flex-wrap gap-2 mb-2",children:[M,O]}),e[32]=O,e[33]=M,e[34]=G):G=e[34];let E;e[35]!==c||e[36]!==v||e[37]!==S||e[38]!==D||e[39]!==s||e[40]!==m?(E=c&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(be,{type:"text",inputMode:m==="h"?"text":"numeric",placeholder:s(m==="h"?"durationPicker.durationInHours":"durationPicker.durationInMinutes"),value:v,onChange:V=>S(V.target.value),autoFocus:!0,className:"max-w-[180px]"}),t.jsx(ni,{unit:m,onUnitChange:D})]}),e[35]=c,e[36]=v,e[37]=S,e[38]=D,e[39]=s,e[40]=m,e[41]=E):E=e[41];let q;return e[42]!==G||e[43]!==E?(q=t.jsxs("div",{children:[G,E]}),e[42]=G,e[43]=E,e[44]=q):q=e[44],q}function mo(a){const e=le.c(12),{surfaceLabels:n,surfaceIcons:l,surfaceDescriptions:s,selected:r,onToggle:i}=a,{t:c}=oe(),m=!!s?"grid grid-cols-2":"flex flex-wrap";let o;e[0]!==m?(o=X("gap-2",m),e[0]=m,e[1]=o):o=e[1];let d;e[2]!==i||e[3]!==r||e[4]!==s||e[5]!==l||e[6]!==n||e[7]!==c?(d=Object.entries(n).map(u=>{const[p,f]=u,b=r.includes(p),j=s?.[p];return t.jsx("button",{type:"button",className:X("rounded-[10px] border cursor-pointer font-medium transition-all",j?"flex items-start gap-2 px-3 py-2.5 text-left":"py-2 px-3 text-[13px]",b?"border-primary bg-primary/10 text-primary":"border-border bg-input text-muted-foreground"),onClick:()=>i(p),children:j?t.jsxs(t.Fragment,{children:[t.jsx(pt,{name:l[p],className:"w-4 h-4 shrink-0 mt-0.5"}),t.jsxs("span",{className:"flex flex-col gap-0.5 min-w-0",children:[t.jsx("span",{className:"text-[13px] font-medium leading-tight",children:c(f)}),t.jsx("span",{className:X("text-[11px] leading-snug",b?"text-primary/80":"text-muted-foreground/80"),children:c(j)})]})]}):t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(pt,{name:l[p],className:"w-4 h-4 shrink-0"}),c(f)]})},p)}),e[2]=i,e[3]=r,e[4]=s,e[5]=l,e[6]=n,e[7]=c,e[8]=d):d=e[8];let v;return e[9]!==o||e[10]!==d?(v=t.jsx("div",{className:o,children:d}),e[9]=o,e[10]=d,e[11]=v):v=e[11],v}function fo(a){const e=le.c(124),{form:n,set:l,sport:s,sportData:r,currentType:i,currentSurfaces:c,showPace:x,gpxFile:m,setGpxFile:o,estimatedDuration:d,estimatedDistance:v,estimatedPace:u}=a,{t:p}=oe();let f,b,j,h,y,w,P;if(e[0]!==c||e[1]!==i||e[2]!==l||e[3]!==s||e[4]!==r.distancePresets.length||e[5]!==r.surfaceLabels||e[6]!==r.typeField||e[7]!==p){y=qe(s);const z=s==="running",se=s==="velo",re=(y.modes.activityTypes?.length??0)>0;let ie;e[15]!==r.surfaceLabels?(ie=Object.keys(r.surfaceLabels),e[15]=r.surfaceLabels,e[16]=ie):ie=e[16],h=ie.length>0,j=y.hasGpx,f=r.distancePresets.length>0,b=y.hasElevation;const de=r.typeField??"activityType";let ue;e[17]!==c||e[18]!==z||e[19]!==se||e[20]!==l?(ue=me=>{z?l("runningSurfaces",Un(c,me)):se?l("veloTerrains",Cr(c,me)):l("hikingSurfaces",qn(c,me))},e[17]=c,e[18]=z,e[19]=se,e[20]=l,e[21]=ue):ue=e[21],P=ue,w=re&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:p("enduranceEdit.outingType")}),t.jsx("div",{className:"flex flex-wrap gap-2",children:(y.modes.activityTypes??[]).map(me=>t.jsx("button",{type:"button",className:X("py-2 px-3 rounded-[10px] border text-[13px] cursor-pointer font-medium transition-all",i===me.value?"border-primary bg-primary/10 text-primary":"border-border bg-input text-muted-foreground"),onClick:()=>l(de,me.value),children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(pt,{name:me.icon,className:"w-4 h-4 shrink-0"}),p(me.labelKey)]})},me.value))})]}),e[0]=c,e[1]=i,e[2]=l,e[3]=s,e[4]=r.distancePresets.length,e[5]=r.surfaceLabels,e[6]=r.typeField,e[7]=p,e[8]=f,e[9]=b,e[10]=j,e[11]=h,e[12]=y,e[13]=w,e[14]=P}else f=e[8],b=e[9],j=e[10],h=e[11],y=e[12],w=e[13],P=e[14];let L;e[22]!==c||e[23]!==h||e[24]!==r.surfaceDescriptions||e[25]!==r.surfaceIcons||e[26]!==r.surfaceLabels||e[27]!==p||e[28]!==P?(L=h&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:p("enduranceEdit.surface")}),t.jsx(mo,{surfaceLabels:r.surfaceLabels,surfaceIcons:r.surfaceIcons,surfaceDescriptions:r.surfaceDescriptions,selected:c,onToggle:P})]}),e[22]=c,e[23]=h,e[24]=r.surfaceDescriptions,e[25]=r.surfaceIcons,e[26]=r.surfaceLabels,e[27]=p,e[28]=P,e[29]=L):L=e[29];let g;e[30]!==n.difficulty||e[31]!==l||e[32]!==f||e[33]!==r.difficultyLabels||e[34]!==p?(g=f&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:p("enduranceEdit.difficulty")}),t.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(r.difficultyLabels).map(z=>{const[se,re]=z;return t.jsxs("button",{type:"button",className:X("py-2 px-3 rounded-[10px] border text-[13px] curs
2or-pointer font-medium transition-all inline-flex items-center gap-1.5",n.difficulty===se?"border-primary bg-primary/10 text-primary":"border-border bg-input text-muted-foreground"),onClick:()=>l("difficulty",n.difficulty===se?null:se),children:[t.jsx(kr,{difficulty:se}),p(re)]},se)})})]}),e[30]=n.difficulty,e[31]=l,e[32]=f,e[33]=r.difficultyLabels,e[34]=p,e[35]=g):g=e[35];let I;e[36]!==n.gpxFileUrl||e[37]!==m||e[38]!==l||e[39]!==o||e[40]!==j||e[41]!==p?(I=j&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:p("enduranceFields.gpxTrace")}),m?t.jsxs("div",{className:"flex items-center gap-2 p-3 bg-card border border-border rounded-lg",children:[t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-primary shrink-0",children:[t.jsx("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"}),t.jsx("polyline",{points:"14 2 14 8 20 8"})]}),t.jsx("span",{className:"text-sm truncate flex-1",children:m.name}),t.jsx("button",{type:"button",className:"text-xs text-destructive hover:underline shrink-0",onClick:()=>o(null),children:p("recurring.gpxRemove")})]}):n.gpxFileUrl?t.jsxs("div",{className:"flex items-center gap-2 p-3 bg-card border border-border rounded-lg",children:[t.jsx("span",{className:"text-sm text-muted-foreground flex-1 truncate",children:p("recurring.gpxExistingFile")}),t.jsx("button",{type:"button",className:"text-xs text-destructive hover:underline shrink-0",onClick:()=>l("gpxFileUrl",null),children:p("recurring.gpxRemove")})]}):t.jsxs("label",{className:"flex items-center gap-2 p-3 bg-card border border-dashed border-border rounded-lg cursor-pointer hover:border-primary/40 transition-colors",children:[t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground shrink-0",children:[t.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),t.jsx("polyline",{points:"17 8 12 3 7 8"}),t.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),t.jsx("span",{className:"text-sm text-muted-foreground",children:p("recurring.gpxAdd")}),t.jsx("input",{type:"file",accept:".gpx",className:"hidden",onChange:z=>{const se=z.target.files?.[0];se&&o(se)}})]})]}),e[36]=n.gpxFileUrl,e[37]=m,e[38]=l,e[39]=o,e[40]=j,e[41]=p,e[42]=I):I=e[42];let S;e[43]!==v||e[44]!==n.distanceKm||e[45]!==n.durationMinutes||e[46]!==l||e[47]!==f||e[48]!==r.distancePresets||e[49]!==p?(S=f&&t.jsxs("div",{className:"mb-4",children:[t.jsxs("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:[p("enduranceEdit.distance"),!n.durationMinutes&&t.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),t.jsx(co,{value:n.distanceKm??void 0,onChange:z=>l("distanceKm",z??null),presets:r.distancePresets}),v&&!n.distanceKm&&t.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:p("recurring.estimatedDistance",{min:v.min.toFixed(1),max:v.max.toFixed(1)})})]}),e[43]=v,e[44]=n.distanceKm,e[45]=n.durationMinutes,e[46]=l,e[47]=f,e[48]=r.distancePresets,e[49]=p,e[50]=S):S=e[50];let B;e[51]!==p?(B=p("enduranceEdit.duration"),e[51]=p,e[52]=B):B=e[52];let D;e[53]!==n.distanceKm?(D=!n.distanceKm&&t.jsx("span",{className:"text-destructive ml-0.5",children:"*"}),e[53]=n.distanceKm,e[54]=D):D=e[54];let M;e[55]!==B||e[56]!==D?(M=t.jsxs("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:[B,D]}),e[55]=B,e[56]=D,e[57]=M):M=e[57];const R=n.durationMinutes??void 0;let T;e[58]!==l?(T=z=>l("durationMinutes",z??null),e[58]=l,e[59]=T):T=e[59];let F;e[60]!==T||e[61]!==R?(F=t.jsx(uo,{value:R,onChange:T}),e[60]=T,e[61]=R,e[62]=F):F=e[62];let O;e[63]!==d||e[64]!==n.durationMinutes||e[65]!==p?(O=d&&!n.durationMinutes&&t.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:p("recurring.estimatedDuration",{min:xn(d.min),max:xn(d.max)})}),e[63]=d,e[64]=n.durationMinutes,e[65]=p,e[66]=O):O=e[66];let G;e[67]!==F||e[68]!==O||e[69]!==M?(G=t.jsxs("div",{className:"mb-4",children:[M,F,O]}),e[67]=F,e[68]=O,e[69]=M,e[70]=G):G=e[70];let E;e[71]!==n.elevationM||e[72]!==l||e[73]!==b||e[74]!==p?(E=b&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:p("enduranceEdit.elevation")}),t.jsx(be,{type:"number",step:"1",min:"0",placeholder:p("enduranceEdit.elevationPlaceholder"),value:n.elevationM??"",onChange:z=>l("elevationM",z.target.value?parseInt(z.target.value):null),className:"max-w-[140px]"})]}),e[71]=n.elevationM,e[72]=l,e[73]=b,e[74]=p,e[75]=E):E=e[75];let q;e[76]!==u||e[77]!==n.paceMax||e[78]!==n.paceMin||e[79]!==l||e[80]!==x||e[81]!==s||e[82]!==y||e[83]!==r.speedMode||e[84]!==p?(q=x&&y.hasPace&&t.jsxs("div",{className:"mb-4",children:[t.jsx(li,{sport:s,paceMin:n.paceMin??null,paceMax:n.paceMax??null,allowOpen:!1,onChange:(z,se)=>{l("paceMin",z),l("paceMax",se)}}),!r.speedMode&&u&&!n.paceMin&&!n.paceMax&&t.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:p("recurring.estimatedPace",{pace:wr(u)})})]}),e[76]=u,e[77]=n.paceMax,e[78]=n.paceMin,e[79]=l,e[80]=x,e[81]=s,e[82]=y,e[83]=r.speedMode,e[84]=p,e[85]=q):q=e[85];let V;e[86]!==p?(V=p("enduranceEdit.limitParticipants"),e[86]=p,e[87]=V):V=e[87];let $;e[88]!==V?($=t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:V}),e[88]=V,e[89]=$):$=e[89];const K=n.maxParticipants!=null?"bg-primary":"bg-muted";let C;e[90]!==K?(C=X("relative w-10 h-[22px] rounded-full transition-colors",K),e[90]=K,e[91]=C):C=e[91];let Q;e[92]!==n.maxParticipants||e[93]!==l?(Q=()=>l("maxParticipants",n.maxParticipants!=null?null:10),e[92]=n.maxParticipants,e[93]=l,e[94]=Q):Q=e[94];const J=n.maxParticipants!=null&&"translate-x-[18px]";let N;e[95]!==J?(N=X("absolute top-0.5 left-0.5 w-[18px] h-[18px] rounded-full bg-white shadow transition-transform",J),e[95]=J,e[96]=N):N=e[96];let A;e[97]!==N?(A=t.jsx("span",{className:N}),e[97]=N,e[98]=A):A=e[98];let k;e[99]!==C||e[100]!==Q||e[101]!==A?(k=t.jsx("button",{type:"button",className:C,onClick:Q,children:A}),e[99]=C,e[100]=Q,e[101]=A,e[102]=k):k=e[102];let H;e[103]!==$||e[104]!==k?(H=t.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[$,k]}),e[103]=$,e[104]=k,e[105]=H):H=e[105];let ee;e[106]!==n.maxParticipants||e[107]!==l||e[108]!==r.participantLabelKey||e[109]!==p?(ee=n.maxParticipants!=null&&t.jsxs("div",{className:"flex items-center gap-3.5 mt-2",children:[t.jsx("button",{type:"button",className:"w-[38px] h-[38px] rounded-[10px] border border-border bg-input text-foreground text-xl flex items-center justify-center cursor-pointer hover:border-primary hover:text-primary",onClick:()=>l("maxParticipants",Math.max(2,(n.maxParticipants??10)-1)),children:"â"}),t.jsx("span",{className:"text-lg font-semibold min-w-6 text-center",children:n.maxParticipants}),t.jsx("button",{type:"button",className:"w-[38px] h-[38px] rounded-[10px] border border-border bg-input text-foreground text-xl flex items-center justify-center cursor-pointer hover:border-primary hover:text-primary",onClick:()=>l("maxParticipants",Math.min(50,(n.maxParticipants??10)+1)),children:"+"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:p(r.participantLabelKey)})]}),e[106]=n.maxParticipants,e[107]=l,e[108]=r.participantLabelKey,e[109]=p,e[110]=ee):ee=e[110];let Y;e[111]!==H||e[112]!==ee?(Y=t.jsxs("div",{className:"mb-4",children:[H,ee]}),e[111]=H,e[112]=ee,e[113]=Y):Y=e[113];let te;return e[114]!==w||e[115]!==G||e[116]!==E||e[117]!==q||e[118]!==L||e[119]!==Y||e[120]!==g||e[121]!==I||e[122]!==S?(te=t.
2jsxs(t.Fragment,{children:[w,L,g,I,S,G,E,q,Y]}),e[114]=w,e[115]=G,e[116]=E,e[117]=q,e[118]=L,e[119]=Y,e[120]=g,e[121]=I,e[122]=S,e[123]=te):te=e[123],te}function xo(a){const e=le.c(29),{sport:n,form:l,set:s,userId:r,terrains:i,courtsByTerrainId:c,addressPlaceholder:x,onTerrainAdded:m}=a,{t:o}=oe();let d;e[0]!==n?(d=qe(n),e[0]=n,e[1]=d):d=e[1];const v=d,u=v.hasCentres&&v.hasMeetingPoint,p=sl(n),[f,b]=U.useState(null);let j;e[2]!==l||e[3]!==p||e[4]!==f?(j=f??ri({hasCentresForSport:p,existing:l}),e[2]=l,e[3]=p,e[4]=f,e[5]=j):j=e[5];const h=j;let y;e[6]!==s?(y=S=>{b(S),S==="centre"?(s("meetingPointAddress",""),s("meetingPointLat",null),s("meetingPointLng",null)):(s("terrainId",null),s("courtNumber",""))},e[6]=s,e[7]=y):y=e[7];const w=y,P=v.hasCentres&&(!u||h==="centre");let L;e[8]!==w||e[9]!==u||e[10]!==n||e[11]!==h?(L=u&&t.jsx("div",{className:"mb-4",children:t.jsx(ai,{sport:n,value:h,onChange:w})}),e[8]=w,e[9]=u,e[10]=n,e[11]=h,e[12]=L):L=e[12];let g;e[13]!==x||e[14]!==c||e[15]!==l.courtNumber||e[16]!==l.meetingPointAddress||e[17]!==l.terrainId||e[18]!==m||e[19]!==s||e[20]!==P||e[21]!==n||e[22]!==o||e[23]!==i||e[24]!==r?(g=P?t.jsx("div",{className:"mb-4",children:t.jsx(ii,{sport:n,userId:r,terrains:i,courtsByTerrainId:c,terrainId:l.terrainId?String(l.terrainId):"",onTerrainIdChange:S=>{s("terrainId",S?parseInt(S,10):null),s("courtNumber","")},courtNumber:l.courtNumber,onCourtNumberChange:S=>s("courtNumber",S),onTerrainAdded:m})}):t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:o("enduranceEdit.meetingPoint")}),t.jsx(Pr,{value:l.meetingPointAddress??"",onChange:S=>{const{address:B,lat:D,lng:M}=S;s("meetingPointAddress",B),s("meetingPointLat",D),s("meetingPointLng",M)},placeholder:x})]}),e[13]=x,e[14]=c,e[15]=l.courtNumber,e[16]=l.meetingPointAddress,e[17]=l.terrainId,e[18]=m,e[19]=s,e[20]=P,e[21]=n,e[22]=o,e[23]=i,e[24]=r,e[25]=g):g=e[25];let I;return e[26]!==L||e[27]!==g?(I=t.jsxs(t.Fragment,{children:[L,g]}),e[26]=L,e[27]=g,e[28]=I):I=e[28],I}const po=[{value:1,key:"monday"},{value:2,key:"tuesday"},{value:3,key:"wednesday"},{value:4,key:"thursday"},{value:5,key:"friday"},{value:6,key:"saturday"},{value:0,key:"sunday"}];function En(a){return{sport:a?.sport??"running",dayOfWeek:a?.dayOfWeek??2,timeStart:a?.timeStart??"19:00",timeEnd:a?.timeEnd??"",sessionName:a?.sessionName??"",description:a?.description??"",terrainId:a?.terrainId??null,courtId:a?.courtId??null,courtNumber:a?.courtNumber??"",levelMin:a?.levelMin??null,levelMax:a?.levelMax??null,placesTotal:a?.placesTotal??null,balancedSides:a?.balancedSides??!1,acceptanceMode:a?.acceptanceMode??"auto",visibility:a?.visibility??"public",womenOnly:a?.womenOnly??!1,runType:a?.runType??null,runningSurfaces:a?.runningSurfaces??["road"],hikeType:a?.hikeType??null,hikingSurfaces:a?.hikingSurfaces??["sentier"],bikeType:a?.bikeType??null,veloTerrains:a?.veloTerrains??[],activityType:a?.activityType??null,difficulty:a?.difficulty??null,gpxFileUrl:a?.gpxFileUrl??null,distanceKm:a?.distanceKm??null,durationMinutes:a?.durationMinutes??null,elevationM:a?.elevationM??null,paceMin:a?.paceMin??null,paceMax:a?.paceMax??null,meetingPointAddress:a?.meetingPointAddress??"",meetingPointLat:a?.meetingPointLat??null,meetingPointLng:a?.meetingPointLng??null,maxParticipants:a?.maxParticipants??null,foot5Levels:a?.foot5Levels??[],autoCancelHours:a?.autoCancelHours??24}}function bo(a){const e=le.c(193),{initialData:n,terrains:l,courtsByTerrainId:s,userId:r,userGender:i,saving:c,onBack:x,onSubmit:m}=a,{t:o}=oe(),d=!!n;let v;e[0]!==n?(v=()=>En(n),e[0]=n,e[1]=v):v=e[1];const[u,p]=U.useState(v),[f,b]=U.useState(n?.createdForName??""),[j,h]=U.useState(n?.createdForLogo??""),[y,w]=U.useState(n?.clubId??null);let P;e[2]===Symbol.for("react.memo_cache_sentinel")?(P=[],e[2]=P):P=e[2];const[L,g]=U.useState(P),[I,S]=U.useState(null),[B,D]=U.useState(null),{uploadGpx:M,uploading:R}=oi();let T;e[3]===Symbol.for("react.memo_cache_sentinel")?(T=(xe,ke)=>p(Ct=>({...Ct,[xe]:ke})),e[3]=T):T=e[3];const F=T,O=u.sport,{user:G}=kt();G?.email;let E;if(e[4]!==O||e[5]!==G?.email){const xe=Er(G?.email);E=O&&!xe.includes(O)?[...xe,O]:xe,e[4]=O,e[5]=G?.email,e[6]=E}else E=e[6];const q=E,V=qe(O),$=O==="velo",K=O==="running",C=O==="padel",Q=O==="foot5",J=_r(O);let N;
2e[7]!==L||e[8]!==l?(N=[...l,...L],e[7]=L,e[8]=l,e[9]=N):N=e[9];const A=N,k=u.levelMin??1,H=u.levelMax??10,ee=u.placesTotal??3,Y=u.balancedSides??!1,te=u.distanceKm??void 0,z=u.durationMinutes??void 0,se=u.paceMin??void 0,re=u.paceMax??void 0;let ie;e[10]!==te||e[11]!==z||e[12]!==se||e[13]!==re?(ie={distanceKm:te,durationMinutes:z,paceMin:se,paceMax:re},e[10]=te,e[11]=z,e[12]=se,e[13]=re,e[14]=ie):ie=e[14];const{estimatedDuration:de,estimatedDistance:ue,estimatedPace:me}=Ti(ie),je=J?.typeField?u[J.typeField]:u.activityType??null;let he;e[15]!==u.hikingSurfaces||e[16]!==u.runningSurfaces||e[17]!==u.veloTerrains||e[18]!==K||e[19]!==$?(he=K?u.runningSurfaces??[]:$?u.veloTerrains??[]:u.hikingSurfaces??[],e[15]=u.hikingSurfaces,e[16]=u.runningSurfaces,e[17]=u.veloTerrains,e[18]=K,e[19]=$,e[20]=he):he=e[20];const fe=he,Ue=!J?.hidePaceForType||je!==J.hidePaceForType;let ve;e[21]!==H||e[22]!==k?(ve=function(ke){if(k===ke&&H===ke){F("levelMin",null),F("levelMax",null);return}if(k===null||H===null||k===1&&H===10){F("levelMin",ke),F("levelMax",ke);return}if(ke<k){F("levelMin",ke);return}if(ke>H){F("levelMax",ke);return}const Ct=ke-k,is=H-ke;Ct<=is?F("levelMin",ke):F("levelMax",ke)},e[21]=H,e[22]=k,e[23]=ve):ve=e[23];const Ge=ve;let Ce;e[24]!==n?(Ce=xe=>{p(En({...n,sport:xe})),S(null),D(null)},e[24]=n,e[25]=Ce):Ce=e[25];const Je=Ce,at=async xe=>{if(xe.preventDefault(),!u.timeStart){Z.error(o("recurring.startTimeRequired"));return}if(u.timeEnd&&u.timeStart>=u.timeEnd){Z.error(o("recurring.endTimeAfterStart"));return}const ke=V.hasCentres&&!!u.terrainId,Ct=V.hasMeetingPoint&&!!u.meetingPointAddress?.trim();if(!ke&&!Ct){const Gt=V.hasCentres&&V.hasMeetingPoint;Z.error(o(Gt?"recurring.venueRequired":V.hasCentres?"recurring.centreRequired":"recurring.meetingPointRequired"));return}let is=u.gpxFileUrl;if(B){const Gt=await M(B,Date.now());if(Gt.error){Z.error(Gt.error);return}is=Gt.url??null}const ml=!!u.terrainId,Es={...u,gpxFileUrl:is,...ml?{meetingPointAddress:null,meetingPointLat:null,meetingPointLng:null}:{terrainId:null,courtId:null,courtNumber:null}};K&&u.runType==="competition"&&(Es.paceMin=null,Es.paceMax=null),await m({...Es,createdForName:f.trim()||null,createdForLogo:j||null,clubId:y})};let Ae;e[26]!==R||e[27]!==d||e[28]!==c||e[29]!==o?(Ae=o(R?"createForm.uploadingGpx":c?d?"recurring.saving":"createForm.creating":d?"common.save":"recurring.createTemplate"),e[26]=R,e[27]=d,e[28]=c,e[29]=o,e[30]=Ae):Ae=e[30];const He=Ae;let Ee;e[31]!==d||e[32]!==o?(Ee=o(d?"recurring.editTemplate":"recurring.newRecurringSession"),e[31]=d,e[32]=o,e[33]=Ee):Ee=e[33];let Xe;e[34]!==x||e[35]!==Ee?(Xe=t.jsx(Mr,{title:Ee,onBack:x}),e[34]=x,e[35]=Ee,e[36]=Xe):Xe=e[36];let Ie;e[37]!==d||e[38]!==o?(Ie=o(d?"recurring.editSubtitle":"recurring.newSubtitle"),e[37]=d,e[38]=o,e[39]=Ie):Ie=e[39];let De;e[40]!==Ie?(De=t.jsx("div",{className:"mb-5",children:t.jsx("p",{className:"text-[13px] text-muted-foreground",children:Ie})}),e[40]=Ie,e[41]=De):De=e[41];let Ke;e[42]===Symbol.for("react.memo_cache_sentinel")?(Ke=t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:"Sport"}),e[42]=Ke):Ke=e[42];let _e;if(e[43]!==Je||e[44]!==O||e[45]!==q||e[46]!==o){let xe;e[48]!==Je||e[49]!==O||e[50]!==o?(xe=ke=>t.jsxs("button",{type:"button",className:X("flex flex-col items-center gap-0.5 py-2.5 rounded-[10px] border text-[12px] cursor-pointer font-medium transition-all",O===ke?"border-primary bg-primary/10 text-primary":"border-border bg-input text-muted-foreground"),onClick:()=>Je(ke),children:[t.jsx(Lt,{sport:ke,size:20}),o(`sport.${ke}.label`)]},ke),e[48]=Je,e[49]=O,e[50]=o,e[51]=xe):xe=e[51],_e=q.map(xe),e[43]=Je,e[44]=O,e[45]=q,e[46]=o,e[47]=_e}else _e=e[47];let Re;e[52]!==_e?(Re=t.jsxs("div",{className:"mb-4",children:[Ke,t.jsx("div",{className:"grid grid-cols-4 gap-1.5",children:_e})]}),e[52]=_e,e[53]=Re):Re=e[53];let Fe;e[54]===Symbol.for("react.memo_cache_sentinel")?(Fe=(xe,ke,Ct)=>{b(xe),h(ke),w(Ct??null)},e[54]=Fe):Fe=e[54];let Te;e[55]===Symbol.for("react.memo_cache_sentinel")?(Te=xe=>F("sessionName",xe.target.value),e[55]=Te):Te=e[55];let Me;e[56]!==o?(Me=o("recurring.recurrence"),e[56]=o,e[57]=Me):Me=e[57];let Pe;e[58]!==Me?(Pe=t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:Me}),e[58]=Me,e[59]=Pe):Pe=e[59];let $e;e[60]!==o?($e=o("recurring.day"),e[60]=o,e[61]=$e):$e=e[61];let Le;e[62]!==$e?(Le=t.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:$e}),e[62]=$e,e[63]=Le):Le=e[63];const We=String(u.dayOfWeek);let Oe;e[64]===Symbol.for("react.memo_cache_sentinel")?(Oe=xe=>F("dayOfWeek",parseInt(xe.target.value)),e[64]=Oe):Oe=e[64];let Be;e[65]!==o?(Be=po.map(xe=>t.jsx(zt,{value:String(xe.value),children:o(`recurring.${xe.key}`)},xe.value)),e[65]=o,e[66]=Be):Be=e[66];let Ve;e[67]!==We||e[68]!==Be?(Ve=t.jsx(Jn,{value:We,onChange:Oe,children:Be}),e[67]=We,e[68]=Be,e[69]=Ve):Ve=e[69];let Ye;e[70]!==Le||e[71]!==Ve?(Ye=t.jsxs("div",{children:[Le,Ve]}),e[70]=Le,e[71]=Ve,e[72]=Ye):Ye=e[72];let _;e[73]!==o?(_=o("recurring.start"),e[73]=o,e[74]=_):_=e[74];let ce;e[75]!==_?(ce=t.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:_}),e[75]=_,e[76]=ce):ce=e[76];let et;e[77]===Symbol.for("react.memo_cache_sentinel")?(et=xe=>F("timeStart",xe.target.value),e[77]=et):et=e[77];let ot;e[78]!==u.timeStart?(ot=t.jsx(be,{type:"time",value:u.timeStart,onCh
2ange:et}),e[78]=u.timeStart,e[79]=ot):ot=e[79];let nt;e[80]!==ce||e[81]!==ot?(nt=t.jsxs("div",{children:[ce,ot]}),e[80]=ce,e[81]=ot,e[82]=nt):nt=e[82];let lt;e[83]!==o?(lt=o("recurring.end"),e[83]=o,e[84]=lt):lt=e[84];let ct;e[85]!==lt?(ct=t.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:lt}),e[85]=lt,e[86]=ct):ct=e[86];const dt=u.timeEnd??"";let tt;e[87]===Symbol.for("react.memo_cache_sentinel")?(tt=xe=>F("timeEnd",xe.target.value||null),e[87]=tt):tt=e[87];let pe;e[88]!==dt?(pe=t.jsx(be,{type:"time",value:dt,onChange:tt}),e[88]=dt,e[89]=pe):pe=e[89];let Qe;e[90]!==ct||e[91]!==pe?(Qe=t.jsxs("div",{children:[ct,pe]}),e[90]=ct,e[91]=pe,e[92]=Qe):Qe=e[92];let st;e[93]!==Ye||e[94]!==nt||e[95]!==Qe?(st=t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[Ye,nt,Qe]}),e[93]=Ye,e[94]=nt,e[95]=Qe,e[96]=st):st=e[96];let bt;e[97]!==Pe||e[98]!==st?(bt=t.jsxs("div",{className:"mb-4",children:[Pe,st]}),e[97]=Pe,e[98]=st,e[99]=bt):bt=e[99];const wt=o(J?.addressPlaceholderKey??"recurring.meetingPointPlaceholder");let ht;e[100]===Symbol.for("react.memo_cache_sentinel")?(ht=xe=>{g(ke=>[...ke,xe]),F("terrainId",xe.id)},e[100]=ht):ht=e[100];let gt;e[101]!==A||e[102]!==s||e[103]!==u||e[104]!==O||e[105]!==wt||e[106]!==r?(gt=t.jsx(xo,{sport:O,form:u,set:F,userId:r,terrains:A,courtsByTerrainId:s,addressPlaceholder:wt,onTerrainAdded:ht},O),e[101]=A,e[102]=s,e[103]=u,e[104]=O,e[105]=wt,e[106]=r,e[107]=gt):gt=e[107];let vt;e[108]!==Y||e[109]!==I||e[110]!==Ge||e[111]!==C||e[112]!==H||e[113]!==k||e[114]!==ee?(vt=C&&t.jsx(ao,{set:F,levelMin:k,levelMax:H,places:ee,balancedSides:Y,creatorSide:I,setCreatorSide:S,handleLevelClick:Ge}),e[108]=Y,e[109]=I,e[110]=Ge,e[111]=C,e[112]=H,e[113]=k,e[114]=ee,e[115]=vt):vt=e[115];let yt;e[116]!==u||e[117]!==Q?(yt=Q&&t.jsx(oo,{form:u,set:F}),e[116]=u,e[117]=Q,e[118]=yt):yt=e[118];let jt;e[119]!==fe||e[120]!==je||e[121]!==ue||e[122]!==de||e[123]!==me||e[124]!==u||e[125]!==B||e[126]!==Ue||e[127]!==O||e[128]!==J?(jt=J&&t.jsx(fo,{form:u,set:F,sport:O,sportData:J,currentType:je,currentSurfaces:fe,showPace:Ue,gpxFile:B,setGpxFile:D,estimatedDuration:de,estimatedDistance:ue,estimatedPace:me}),e[119]=fe,e[120]=je,e[121]=ue,e[122]=de,e[123]=me,e[124]=u,e[125]=B,e[126]=Ue,e[127]=O,e[128]=J,e[129]=jt):jt=e[129];let Nt;e[130]===Symbol.for("react.memo_cache_sentinel")?(Nt=xe=>F("acceptanceMode",xe),e[130]=Nt):Nt=e[130];let ut;e[131]!==o?(ut=o("recurring.visibility"),e[131]=o,e[132]=ut):ut=e[132];let mt;e[133]!==ut?(mt=t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:ut}),e[133]=ut,e[134]=mt):mt=e[134];let St;e[135]!==o?(St=o("recurring.visibilityPublic"),e[135]=o,e[136]=St):St=e[136];let W;e[137]!==St?(W=["public",St],e[137]=St,e[138]=W):W=e[138];let Se;e[139]!==o?(Se=o("recurring.visibilityPrivate"),e[139]=o,e[140]=Se):Se=e[140];let Ne;e[141]!==Se?(Ne=["private",Se],e[141]=Se,e[142]=Ne):Ne=e[142];let It;e[143]!==W||e[144]!==Ne?(It=[W,Ne],e[143]=W,e[144]=Ne,e[145]=It):It=e[145];const Ns=It;let Tt;e[146]!==u.visibility||e[147]!==Ns?(Tt=t.jsx("div",{className:"flex gap-2",children:Ns.map(xe=>{const[ke,Ct]=xe;return t.jsx("button",{type:"button",className:X("flex-1 py-2.5 rounded-[10px] border text-[13px] text-center cursor-pointer font-medium transition-all",u.visibility===ke?"border-primary bg-primary/10 text-primary":"border-border bg-input text-muted-foreground"),onClick:()=>F("visibility",ke),children:Ct},ke)})}),e[146]=u.visibility,e[147]=Ns,e[148]=Tt):Tt=e[148];let Zt;e[149]!==mt||e[150]!==Tt?(Zt=t.jsxs("div",{className:"mb-4",children:[mt,Tt]}),e[149]=mt,e[150]=Tt,e[151]=Zt):Zt=e[151];let Jt;e[152]!==u.womenOnly||e[153]!==o||e[154]!==i?(Jt=i!=="male"&&t.jsx("div",{className:"mb-4",children:t.jsxs("button",{type:"button",className:X("w-full flex items-center gap-3 py-3 px-4 rounded-[10px] border text-left cursor-pointer transition-all",u.womenOnly?"border-pink-500 bg-pink-500/10":"border-border bg-input"),onClick:()=>F("womenOnly",!u.womenOnly),children:[t.jsx("div",{className:X("w-10 h-6 rounded-full relative transition-colors shrink-0",u.womenOnly?"bg-pink-500":"bg-muted-foreground
2/30"),children:t.jsx("div",{className:X("absolute top-0.5 w-5 h-5 rounded-full bg-white transition-transform",u.womenOnly?"translate-x-[18px]":"translate-x-0.5")})}),t.jsx("span",{className:X("text-[13px] font-medium",u.womenOnly?"text-pink-500":"text-muted-foreground"),children:o("recurring.womenOnly")})]})}),e[152]=u.womenOnly,e[153]=o,e[154]=i,e[155]=Jt):Jt=e[155];const dl="mb-4";let At;e[156]!==o?(At=o("recurring.description"),e[156]=o,e[157]=At):At=e[157];let Dt;e[158]!==At?(Dt=t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:At}),e[158]=At,e[159]=Dt):Dt=e[159];const Ss=Xt,ul=3,ks=o("recurring.descriptionPlaceholder",{sessionLabel:V.sessionLabel}),ws=u.description??"";let es;e[160]===Symbol.for("react.memo_cache_sentinel")?(es=xe=>F("description",xe.target.value),e[160]=es):es=e[160];let Rt;e[161]!==Ss||e[162]!==ks||e[163]!==ws?(Rt=t.jsx(Ss,{rows:ul,placeholder:ks,value:ws,onChange:es}),e[161]=Ss,e[162]=ks,e[163]=ws,e[164]=Rt):Rt=e[164];let ts;e[165]!==Dt||e[166]!==Rt?(ts=t.jsxs("div",{className:dl,children:[Dt,Rt]}),e[165]=Dt,e[166]=Rt,e[167]=ts):ts=e[167];let Ft;e[168]!==o?(Ft=o("recurring.autoCancel"),e[168]=o,e[169]=Ft):Ft=e[169];let Ot;e[170]!==Ft?(Ot=t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:Ft}),e[170]=Ft,e[171]=Ot):Ot=e[171];const Cs=u.autoCancelHours??24;let ss;e[172]===Symbol.for("react.memo_cache_sentinel")?(ss=xe=>F("autoCancelHours",parseInt(xe.target.value)||24),e[172]=ss):ss=e[172];let Bt;e[173]!==Cs?(Bt=t.jsx(be,{type:"number",min:1,max:168,value:Cs,onChange:ss,className:"w-[80px]"}),e[173]=Cs,e[174]=Bt):Bt=e[174];let Vt;e[175]!==o?(Vt=o("recurring.autoCancelHint"),e[175]=o,e[176]=Vt):Vt=e[176];let Ut;e[177]!==Vt?(Ut=t.jsx("span",{className:"text-sm text-muted-foreground",children:Vt}),e[177]=Vt,e[178]=Ut):Ut=e[178];let $t;e[179]!==Bt||e[180]!==Ut?($t=t.jsxs("div",{className:"flex items-center gap-3",children:[Bt,Ut]}),e[179]=Bt,e[180]=Ut,e[181]=$t):$t=e[181];let ns;e[182]!==Ot||e[183]!==$t?(ns=t.jsxs("div",{className:"mb-6",children:[Ot,$t]}),e[182]=Ot,e[183]=$t,e[184]=ns):ns=e[184];const Ps=c||R;let ls;e[185]!==He||e[186]!==Ps?(ls=t.jsx(ae,{type:"submit",className:"w-full",disabled:Ps,children:He}),e[185]=He,e[186]=Ps,e[187]=ls):ls=e[187];let Kt;e[188]!==o?(Kt=o("common.cancel"),e[188]=o,e[189]=Kt):Kt=e[189];let rs;return e[190]!==x||e[191]!==Kt?(rs=t.jsx(ae,{type:"button",variant:"outline",className:"w-full mt-2",onClick:x,children:Kt}),e[190]=x,e[191]=Kt,e[192]=rs):rs=e[192],t.jsxs("div",{className:"flex-1 overflow-y-auto overflow-x-hidden pb-4",children:[Xe,t.jsxs("form",{onSubmit:at,className:"px-5",children:[De,Re,t.jsx(Ri,{userId:r,sessionLabel:V.sessionLabel,createdForName:f,createdForLogo:j,onCreatedForChange:Fe,showBuddizClubs:!0,isAdmin:!0,sport:O}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:o("recurring.sessionNameLabel",{sessionLabel:V.sessionLabel})}),t.jsx(be,{placeholder:o("recurring.sessionNamePlaceholder",{sessionLabel:V.sessionLabel}),value:u.sessionName??"",onChange:Te,className:"max-w-[360px]"})]}),bt,gt,vt,yt,jt,t.jsx(ci,{value:u.acceptanceMode??"auto",sessionLabel:V.sessionLabel,hasReliability:V.hasReliability,onChange:Nt}),Zt,Jt,ts,ns,ls,rs]})]})}const ho=["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"];function go(a){const e=le.c(40),{onBack:n,terrains:l,courtsByTerrainId:s,userId:r,userGender:i}=a,{t:c}=oe(),{templates:x,loading:m,createTemplate:o,updateTemplate:d,deactivateTemplate:v,reactivateTemplate:u}=io(),[p,f]=U.useState(null),[b,j]=U.useState(!1),[h,y]=U.useState(!1);let w;e[0]!==o||e[1]!==p||e[2]!==c||e[3]!==d?(w=async $=>{y(!0);const{error:K}=p?await d(p.id,$):await o($);y(!1),K?Z.error(c(p?"admin.recurringSessions.editError":"admin.recurringSessions.createError")):(Z.success(c(p?"admin.recurringSessions.editSuccess":"admin.recurringSessions.createSuccess")),j(!1),f(null))},e[0]=o,e[1]=p,e[2]=c,e[3]=d,e[4]=w):w=e[4];const P=w;let L;e[5]===Symbol.for("react.memo_cache_sentinel")?(L=()=>{j(!1),f(null)},e[5]=L):L=e[5];const g=L;let I;e[6]===Symbol.for("react.memo_cache_sentinel")?(I=$=>{f($),j(!0)},e[6]=I):I=e[6];const S=I;let B;e[7]===Symbol.for("react.memo_cache_sentinel")?(B=()=>{f(null),j(!0)},e[7]=B):B=e[7];const D=B;let M;e[8]!==v||e[9]!==u||e[10]!==c?(M=async($,K)=>{if(K&&!confirm(c("admin.recurringSessions.deactivateConfirm")))return;const{error:C}=K?await v($):await u($);C?Z.error(c("admin.recurringSessions.toggleError")):Z.success(c(K?"admin.recurringSessions.deactivateSuccess":"admin.recurringSessions.reactivateSuccess"))},e[8]=v,e[9]=u,e[10]=c,e[11]=M):M=e[11];const R=M;if(b){const $=p??void 0;let K;return e[12]!==s||e[13]!==P||e[14]!==h||e[15]!==$||e[16]!==l||e[17]!==i||e[18]!==r?(K=t.jsx(bo,{initialData:$,terrains:l,courtsByTerrainId:s,userId:r,userGender:i,saving:h,onBack:g,onSubmit:P}),e[12]=s,e[13]=P,e[14]=h,e[15]=$,e[16]=l,e[17]=i,e[18]=r,e[19]=K):K=e[19],K}let T;e[20]!==c?(T=c("admin.recurringSessions.title"),e[20]=c,e[21]=T):T=e[21];let F;e[22]!==n||e[23]!==T?(F=t.jsx(we,{title:T,onBack:n}),e[22]=n,e[23]=T,e[24]=F):F=e[24];let O;e[25]!==c?(O=c("admin.recurringSessions.addSession"),e[25]=c,e[26]=O):O=e[26];let G;e[27]!==O?(G=t.jsx(ae,{className:"w-full mb-4",onClick:D,children:O}),e[27]=O,e[28]=G):G=e[28];let E;e[29]!==R||e[30]!==m||e[31]!==c||e[32]!==x?(E=m?t.jsx("p",{className:"text-xs text-muted-foreground text-center mt-4",children:c("common.loading")}):x.length===0?t.jsx("p",{className:"text-xs text-muted-foreground text-center mt-4",children:c("admin.recurringSessions.noSessions")}):t.jsx("div",{className:"flex flex-col gap-2",children:x.map($=>t.jsx(ne,{className:X("p-3",!$.active&&"opacity-50"),children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("p",{className:"text-sm font-medium truncate",children:[t.jsx(Lt,{sport:$.sport,size:14,className:"inline-block align-text-bottom mr-1"}),$.sessionName??`${qe($.sport).sessionLabel} ${c("admin.recurringSessions.recurringLabel")}`]}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:[ho[$.dayOfWeek]," · ",$.timeStart,$.timeEnd?` - ${$.timeEnd}`:"",$.meetingPointAddress?` · ${$.meetingPointAddress}`:"",$.createdForName?` · ${$.createdForName}`:""]})]}),t.jsxs("div",{className:"flex gap-1.5 shrink-0",children:[t.jsx("button",{className:"text-xs px-2.5 py-1 rounded-md border border-border text-muted-foreground hover:text-foreground transition-colors",onClick:()=>S($),children:c("admin.modify")}),t.jsx("button",{className:X("text-xs px-2.5 py-1 rounded-md border border-border transition-colors",$.active?"text-destructive hover:bg-destructive/10":"text-primary hover:bg-primary/10"),onClick:()=>R($.id,$.active),children:$.active?c("admin.deals.deactivate"):c("admin.deals.reactivate")})]})]})},$.id))}),e[29]=R,e[30]=m,e[31]=c,e[32]=x,e[33]=E):E=e[33];let q;e[34]!==E||e[35]!==G?(q=t.jsxs("div",{className:"mx-4 mt-2",children:[G,E]}),e[34]=E,e[35]=G,e[36]=q):q=e[36];let V;return e[37]!==q||e[38]!==F?(V=t.jsxs("div",{className:"flex-1 overflow-y-auto pb-6",children:[F,q]}),e[37]=q,e[38]=F,e[39]=V):V=e[39],V}function ol(a){const e=le.c(13),{className:n}=a;let l,s,r,i,c,x,m,o,d,v,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("path",{d:"m8 2 1.88 1.88"}),i=t.jsx("path",{d:"M14.12 3.88 16 2"}),c=t.jsx("path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"}),x=t.jsx("path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"}),m=t.jsx("path",{d:"M12 20v-9"}),o=t.jsx("path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5"}),d=t.jsx("path",{d:"M6 13H2"}),v=t.jsx("path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4"}),u=t.jsx("path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4"}),s=t.jsx("path",{d:"M22 13h-4"}),r=t.jsx("path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4"}),e[0]=l,e[1]=s,e[2]=r,e[3]=i,e[4]=c,e[5]=x,e[6]=m,e[7]=o,e[8]=d,e[9]=v,e[10]=u):(l=e[0],s=e[1],r=e[2],i=e[3],c=e[4],x=e[5],m=e[6],o=e[7],d=e[8],v=e[9],u=e[10]);let p;return e[11]!==n?(p=t.jsxs(Qt,{className:n,children:[l,i,c,x,m,o,d,v,u,s,r]}),e[11]=n,e[12]=p):p=e[12],p}function vo(a){const e=le.c(5),{className:n}=a;let l,s,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("circle",{cx:"12",cy:"12",r:"10"}),s=t.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),r=t.jsx("path",{d:"M12 17h.01"}),e[0]=l,e[1]=s,e[2]=r):(l=e[0],s=e[1],r=e[2]);let i;return e[3]!==n?(i=t.jsxs(Qt,{className:n,children:[l,s,r]}),e[3]=n,e[4]=i):i=e[4],i}const _n=2e3;function yo(){const a=qt.getPlatform();return a==="ios"?"ios":a==="android"?"android":"web"}function jo(a){const e=le.c(104),{onBack:n}=a,[l,s]=U.useState(null),[r,i]=U.useState(""),[c,x]=U.useState(!1),[m,o]=U.useState(!1),{t:d}=oe();let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=yo(),e[0]=v):v=e[0];const u=v;let p;e[1]!==d?(p=d("profileSub.bugReport"),e[1]=d,e[2]=p):p=e[2];let f;e[3]!==p?(f={value:"bug",label:p,Icon:ol},e[3]=p,e[4]=f):f=e[4];let b;e[5]!==d?(b=d("profileSub.question"),e[5]=d,e[6]=b):b=e[6];let j;e[7]!==b?(j={value:"question",label:b,Icon:vo},e[7]=b,e[8]=j):j=e[8];let h;e[9]!==d?(h=d("profileSub.improvementSuggestion"),e[9]=d,e[10]=h):h=e[10];let y;e[11]!==h?(y={value:"improvement",label:h,Icon:Us},e[11]=h,e[12]=y):y=e[12];let w;e[13]!==d?(w=d("profileSub.centreSuggestion"),e[13]=d,e[14]=w):w=e[14];let P;e[15]!==w?(P={value:"terrain",label:w,Icon:So},e[15]=w,e[16]=P):P=e[16];let L;e[17]!==d?(L=d("profileSub.otherSubject"),e[17]=d,e[18]=L):L=e[18];let g;e[19]!==L?(g={value:"other",label:L,Icon:No},e[19]=L,e[20]=g):g=e[20];let I;e[21]!==g||e[22]!==f||e[23]!==j||e[24]!==y||e[25]!==P?(I=[f,j,y,P,g],e[21]=g,e[22]=f,e[23]=j,e[24]=y,e[25]=P,e[26]=I):I=e[26];const S=I;let B;e[27]!==l||e[28]!==c||e[29]!==r?(B=l!==null&&r.trim().length>0&&!c,e[27]=l,e[28]=c,e[29]=r,e[30]=B):B=e[30];const D=B;let M;e[31]!==D||e[32]!==l||e[33]!==r||e[34]!==d?(M=async()=>
2{if(!D)return;x(!0);const{data:se,error:re}=await ge.functions.invoke("send-support-email",{body:{category:l,message:r.trim(),...l==="bug"?{platform:u}:{}}});if(x(!1),re||!se?.success){Z.error(d("profileSub.sendError"));return}o(!0)},e[31]=D,e[32]=l,e[33]=r,e[34]=d,e[35]=M):M=e[35];const R=M;if(m){let se;e[36]===Symbol.for("react.memo_cache_sentinel")?(se=t.jsx(Gn,{className:"w-14 h-14 text-emerald-500"}),e[36]=se):se=e[36];let re;e[37]!==d?(re=d("profileSub.messageSent"),e[37]=d,e[38]=re):re=e[38];let ie;e[39]!==re?(ie=t.jsx("h2",{className:"text-lg font-bold",children:re}),e[39]=re,e[40]=ie):ie=e[40];let de;e[41]!==d?(de=d("profileSub.messageSentDesc"),e[41]=d,e[42]=de):de=e[42];let ue;e[43]!==de?(ue=t.jsx("p",{className:"text-sm text-muted-foreground",children:de}),e[43]=de,e[44]=ue):ue=e[44];let me;e[45]!==d?(me=d("common.back"),e[45]=d,e[46]=me):me=e[46];let je;e[47]!==n||e[48]!==me?(je=t.jsx(ae,{variant:"outline",onClick:n,children:me}),e[47]=n,e[48]=me,e[49]=je):je=e[49];let he;return e[50]!==ie||e[51]!==ue||e[52]!==je?(he=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6 text-center gap-4",children:[se,ie,ue,je]}),e[50]=ie,e[51]=ue,e[52]=je,e[53]=he):he=e[53],he}let T;e[54]!==d?(T=d("profileSub.supportTitle"),e[54]=d,e[55]=T):T=e[55];let F;e[56]!==d?(F=d("profileSub.supportSubtitle"),e[56]=d,e[57]=F):F=e[57];let O;e[58]!==n||e[59]!==T||e[60]!==F?(O=t.jsx(we,{title:T,subtitle:F,onBack:n}),e[58]=n,e[59]=T,e[60]=F,e[61]=O):O=e[61];let G;e[62]!==d?(G=d("profileSub.subject"),e[62]=d,e[63]=G):G=e[63];let E;e[64]!==G?(E=t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:G}),e[64]=G,e[65]=E):E=e[65];let q;e[66]!==S||e[67]!==l?(q=t.jsx("div",{className:"flex flex-col gap-2",children:S.map(se=>t.jsxs("button",{className:X("flex items-center gap-3 px-4 py-3 rounded-lg border text-sm font-medium cursor-pointer transition-all text-left",l===se.value?"bg-primary border-primary text-primary-foreground":"bg-card border-border text-foreground hover:border-primary/50"),onClick:()=>s(se.value),children:[t.jsx(se.Icon,{className:"w-4 h-4"}),se.label]},se.value))}),e[66]=S,e[67]=l,e[68]=q):q=e[68];let V;e[69]!==E||e[70]!==q?(V=t.jsxs(ne,{className:"p-4",children:[E,q]}),e[69]=E,e[70]=q,e[71]=V):V=e[71];let $;e[72]!==d?($=d("profileSub.message"),e[72]=d,e[73]=$):$=e[73];let K;e[74]!==$?(K=t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:$}),e[74]=$,e[75]=K):K=e[75];let C;e[76]===Symbol.for("react.memo_cache_sentinel")?(C=se=>{se.target.value.length<=_n&&i(se.target.value)},e[76]=C):C=e[76];let Q;e[77]!==d?(Q=d("profileSub.messagePlaceholder"),e[77]=d,e[78]=Q):Q=e[78];let J;e[79]!==r||e[80]!==Q?(J=t.jsx(Xt,{value:r,onChange:C,placeholder:Q,rows:5}),e[79]=r,e[80]=Q,e[81]=J):J=e[81];let N;e[82]!==r.length?(N=t.jsxs("p",{className:"text-xs text-muted-foreground text-right mt-1.5",children:[r.length,"/",_n]}),e[82]=r.length,e[83]=N):N=e[83];let A;e[84]!==K||e[85]!==J||e[86]!==N?(A=t.jsxs(ne,{className:"p-4",children:[K,J,N]}),e[84]=K,e[85]=J,e[86]=N,e[87]=A):A=e[87];let k;e[88]!==V||e[89]!==A?(k=t.jsxs("div",{className:"px-4 pb-4 flex flex-col gap-4",children:[V,A]}),e[88]=V,e[89]=A,e[90]=k):k=e[90];let H;e[91]!==O||e[92]!==k?(H=t.jsxs("div",{className:"flex-1 overflow-y-auto",children:[O,k]}),e[91]=O,e[92]=k,e[93]=H):H=e[93];const ee=!D;let Y;e[94]!==c||e[95]!==d?(Y=d(c?"profileSub.sent":"profileSub.send"),e[94]=c,e[95]=d,e[96]=Y):Y=e[96];let te;e[97]!==R||e[98]!==ee||e[99]!==Y?(te=t.jsx("div",{className:"shrink-0 bg-background/95 backdrop-blur-lg border-t border-border p-4",children:t.jsx(ae,{className:"w-full",onClick:R,disabled:ee,children:Y})}),e[97]=R,e[98]=ee,e[99]=Y,e[100]=te):te=e[100];let z;return e[101]!==H||e[102]!==te?(z=t.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[H,te]}),e[101]=H,e[102]=te,e[103]=z):z=e[103],z}function No(a){return t.jsx(Mt,{name:"chat",className:a.className})}function So(a){return t.jsx(Mt,{name:"map-pin",className:a.className})}function ko(a){const e=le.c(20),{onClose:n,onConfirm:l,loading:s}=a,{t:r}=oe(),i=qe(Ze()),[c,x]=U.useState("reason"),[m,o]=U.useState(null),[d,v]=U.useState(""),u=[{value:"no_longer_playing",label:r("deleteAccount.noLongerPlaying"),Icon:di}
2,{value:"found_other_app",label:r("deleteAccount.foundOtherApp"),Icon:Oi},{value:"not_enough_players",label:r("deleteAccount.notEnoughPlayers"),Icon:Vn},{value:"privacy_concerns",label:r("deleteAccount.privacyConcerns"),Icon:Fn},{value:"technical_issues",label:r("deleteAccount.technicalIssues"),Icon:ol},{value:"other",label:r("deleteAccount.otherReason"),Icon:wo}];let p;e[0]!==m?(p=()=>{m&&x("confirm")},e[0]=m,e[1]=p):p=e[1];const f=p;let b;e[2]!==d||e[3]!==l||e[4]!==m?(b=async()=>{m&&await l(m,d||void 0)},e[2]=d,e[3]=l,e[4]=m,e[5]=b):b=e[5];const j=b,h="flex-1 overflow-y-auto pb-4";let y;e[6]!==r?(y=r("deleteAccount.title"),e[6]=r,e[7]=y):y=e[7];let w;e[8]!==r?(w=r("deleteAccount.irreversible"),e[8]=r,e[9]=w):w=e[9];let P;e[10]!==n||e[11]!==c?(P=c==="confirm"?()=>x("reason"):n,e[10]=n,e[11]=c,e[12]=P):P=e[12];let L;e[13]!==y||e[14]!==w||e[15]!==P?(L=t.jsx(we,{title:y,subtitle:w,onBack:P}),e[13]=y,e[14]=w,e[15]=P,e[16]=L):L=e[16];const g=c==="reason"?t.jsxs("div",{className:"px-4",children:[t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:r("deleteAccount.sadToSeeYouGo")}),t.jsx("div",{className:"space-y-2",children:u.map(S=>t.jsxs("button",{type:"button",className:X("w-full p-3 rounded-lg border text-left flex items-center gap-3 transition-colors",m===S.value?"border-primary bg-primary/10":"border-border bg-card hover:border-primary/50"),onClick:()=>o(S.value),children:[t.jsx(S.Icon,{className:"w-5 h-5 shrink-0"}),t.jsx("span",{className:"text-sm",children:S.label})]},S.value))}),m&&t.jsxs("div",{className:"mt-4",children:[t.jsx("label",{className:"block text-xs text-muted-foreground mb-1.5",children:r("deleteAccount.feedbackLabel")}),t.jsx(Xt,{rows:3,placeholder:r("deleteAccount.feedbackPlaceholder"),value:d,onChange:S=>v(S.target.value),maxLength:500})]}),t.jsxs("div",{className:"flex gap-2 mt-6",children:[t.jsx(ae,{variant:"outline",className:"flex-1",onClick:n,children:r("common.cancel")}),t.jsx(ae,{variant:"destructive",className:"flex-1",onClick:f,disabled:!m,children:r("deleteAccount.continue")})]})]}):t.jsxs("div",{className:"px-4",children:[t.jsxs("div",{className:"flex flex-col items-center text-center mt-4",children:[t.jsx("div",{className:"w-16 h-16 rounded-full bg-destructive/10 flex items-center justify-center mb-4",children:t.jsx(Lr,{className:"w-8 h-8 text-destructive"})}),t.jsx("h4",{className:"font-semibold mb-2",children:r("deleteAccount.areYouSure")}),t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:r("deleteAccount.confirmDesc")})]}),t.jsxs("div",{className:"bg-destructive/10 rounded-lg p-3 mb-6",children:[t.jsx("p",{className:"text-xs text-destructive",children:r("deleteAccount.youWillLose")}),t.jsxs("ul",{className:"text-xs text-destructive mt-2 space-y-1",children:[t.jsx("li",{children:`- ${r("deleteAccount.loseHistory",{sessionLabelPlural:i.sessionLabelPlural})}`}),t.jsx("li",{children:`- ${r("deleteAccount.loseRatings")}`}),t.jsx("li",{children:`- ${r("deleteAccount.loseProfile")}`})]})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ae,{variant:"outline",className:"flex-1",onClick:()=>x("reason"),disabled:s,children:r("common.back")}),t.jsx(ae,{variant:"destructive",className:"flex-1",onClick:j,disabled:s,children:r(s?"deleteAccount.deleting":"deleteAccount.deleteBtn")})]})]});let I;return e[17]!==L||e[18]!==g?(I=t.jsxs("div",{className:h,children:[L,g]}),e[17]=L,e[18]=g,e[19]=I):I=e[19],I}function wo(a){return t.jsx(Mt,{name:"chat",className:a.className})}function Co(a){const e=le.c(80),{onBack:n,onOpenSupport:l}=a,{t:s}=oe(),{deleteAccount:r}=kt(),[i,c]=U.useState(!1),[x,m]=U.useState(!1),[o,d]=U.useState(null);let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=()=>d(null),e[0]=v):v=e[0];const u=v;Wn(o!==null,u);let p;e[1]!==r||e[2]!==s?(p=async(te,z)=>{m(!0);const{error:se}=await r(te,z);m(!1),se?Z.error(s("profileSub.deleteError")):(Z.success(s("profileSub.deleteSuccess")),c(!1))},e[1]=r,e[2]=s,e[3]=p):p=e[3];const f=p;if(i){let te;e[4]===Symbol.for("react.memo_cache_sentinel")?(te=()=>c(!1),e[4]=te):te=e[4];let z;return e[5]!==x||e[6]!==f?(z=t.jsx(ko,{onClose:te,onConfirm:f,loading:x}),e[5]=x,e[6]=f,e[7]=z):z=e[7],z}if(o!==null){const te=`page-${o}`;let z;e[8]!==o||e[9]!==s?(z=s(Fi(o)),e[8]=o,e[9]=s,e[10]=z):z=e[10];let se;e[11]!==z?(se=t.jsx(we,{title:z,onBack:u}),e[11]=z,e[12]=se):se=e[12];let re;e[13]!==o?(re=t.jsx(yn,{page:o,embedded:!0}),e[13]=o,e[14]=re):re=e[14];let ie;return e[15]!==te||e[16]!==se||e[17]!==re?(ie=t.jsxs("div",{className:"flex-1 overflow-y-auto pb-4",children:[se,re]},te),e[15]=te,e[16]=se,e[17]=re,e[18]=ie):ie=e[18],ie}let b;e[19]!==s?(b=s("profileSub.help"),e[19]=s,e[20]=b):b=e[20];let j;e[21]!==n||e[22]!==b?(j=t.jsx(we,{title:b,onBack:n}),e[21]=n,e[22]=b,e[23]=j):j=e[23];let h;e[24]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(yn,{page:"faq",embedded:!0}),e[24]=h):h=e[24];let y;e[25]!==s?(y=s("helpHub.stillNeedHelpTitle",{defaultValue:"Toujours une question ?"}),e[25]=s,e[26]=y):y=e[26];let w;e[27]!==y?(w=t.jsx("h3",{className:"text-sm font-bold mb-1.5",children:y}),e[27]=y,e[28]=w):w=e[28];let P;e[29]!==s?(P=s("helpHub.stillNeedHelpDescription",{defaultValue:"Tu n'as pas trouvé la réponse, tu veux signaler un bug ou faire une suggestion ? Contacte-nous."}),e[29]=s,e[30]=P):P=e[30];let L;e[31]!==P?(L=t.jsx("p",{className:"text-xs text-muted-foreground mb-4 leading-snug",children:P}),e[31]=P,e[32]=L):L=e[32];let g;e[33]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(Ir,{size:16}),e[33]=g):g=e[33];let I;e[34]!==s?(I=s("profileSub.contactSupport"),e[34]=s,e[35]=I):I=e[35];let S;e[36]!==l||e[37]!==I?(S=t.jsxs("button",{type:"button",onClick:l,className:"w-full inline-flex items-center justify-center gap-2 h-10 rounded-full bg-primary text-primary-foreground hover:bg-primary/90 transition-colors text-sm font-bold cursor-pointer",children:[g,I]}),e[36]=l,e[37]=I,e[38]=S):S=e[38];let B;e[39]!==S||e[40]!==w||e[41]!==L?(B=t.jsx("div",{className:"px-4 mt-6 max-w-2xl mx-auto lg:max-w-none lg:mx-0",children:t.jsxs(ne,{className:"p-5 bg-gradient-to-br from-primary/5 via-card to-card border border-primary/30",children:[w,L,S]})}),e[39]=S,e[40]=w,e[41]=L,e[42]=B):B=e[42];let D;e[43]!==s?(D=s("profileSub.legalInfo"),e[43]=s,e[44]=D):D=e[44];let M;e[45]!==D?(M=t.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2 px-1",children:D}),e[45]=D,e[46]=M):M=e[46];let R;e[47]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx(As,{}),e[47]=R):R=e[47];let T;e[48]!==s?(T=s("profileSub.legalNotice"),e[48]=s,e[49]=T):T=e[49];let F;e[50]===Symbol.for("react.memo_cache_sentinel")?(F=()=>d("mentions"),e[50]=F):F=e[50];let O;
2e[51]!==T?(O=t.jsx(it,{icon:R,label:T,onClick:F}),e[51]=T,e[52]=O):O=e[52];let G;e[53]===Symbol.for("react.memo_cache_sentinel")?(G=t.jsx(As,{}),e[53]=G):G=e[53];let E;e[54]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx(it,{icon:G,label:"CGU",onClick:()=>d("cgu")}),e[54]=E):E=e[54];let q;e[55]===Symbol.for("react.memo_cache_sentinel")?(q=t.jsx(As,{}),e[55]=q):q=e[55];let V;e[56]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsx(it,{icon:q,label:"CGV",onClick:()=>d("cgv")}),e[56]=V):V=e[56];let $;e[57]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx(Yn,{}),e[57]=$):$=e[57];let K;e[58]!==s?(K=s("profileSub.privacyPolicy"),e[58]=s,e[59]=K):K=e[59];let C;e[60]===Symbol.for("react.memo_cache_sentinel")?(C=()=>d("privacy"),e[60]=C):C=e[60];let Q;e[61]!==K?(Q=t.jsx(it,{icon:$,label:K,onClick:C,isLast:!0}),e[61]=K,e[62]=Q):Q=e[62];let J;e[63]!==O||e[64]!==Q?(J=t.jsxs(ne,{className:"overflow-hidden",children:[O,E,V,Q]}),e[63]=O,e[64]=Q,e[65]=J):J=e[65];let N;e[66]!==M||e[67]!==J?(N=t.jsxs("div",{className:"px-4 mt-6 max-w-2xl mx-auto lg:max-w-none lg:mx-0",children:[M,J]}),e[66]=M,e[67]=J,e[68]=N):N=e[68];let A;e[69]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(qs,{}),e[69]=A):A=e[69];let k;e[70]!==s?(k=s("profileSub.deleteAccount"),e[70]=s,e[71]=k):k=e[71];let H;e[72]===Symbol.for("react.memo_cache_sentinel")?(H=()=>c(!0),e[72]=H):H=e[72];let ee;e[73]!==k?(ee=t.jsx("div",{className:"px-4 mt-4 max-w-2xl mx-auto lg:max-w-none lg:mx-0",children:t.jsx(ne,{className:"overflow-hidden",children:t.jsx(it,{icon:A,label:k,labelClass:"text-destructive",iconBgClass:"bg-destructive/10",iconColorClass:"text-destructive",onClick:H,isLast:!0})})}),e[73]=k,e[74]=ee):ee=e[74];let Y;return e[75]!==B||e[76]!==N||e[77]!==ee||e[78]!==j?(Y=t.jsxs("div",{className:"flex-1 overflow-y-auto pb-4",children:[j,h,B,N,ee]}),e[75]=B,e[76]=N,e[77]=ee,e[78]=j,e[79]=Y):Y=e[79],Y}function Po(a){const e=le.c(29),{onAccept:n,onClose:l}=a,{t:s}=oe();let r;e[0]!==s?(r=s("common.close",{defaultValue:"Fermer"}),e[0]=s,e[1]=r):r=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M18 6 6 18M6 6l12 12"})}),e[2]=i):i=e[2];let c;e[3]!==l||e[4]!==r?(c=t.jsx("div",{className:"flex justify-end p-4",children:t.jsx("button",{type:"button",onClick:l,"aria-label":r,className:"w-9 h-9 rounded-full bg-foreground
2/10 flex items-center justify-center cursor-pointer border-0",children:i})}),e[3]=l,e[4]=r,e[5]=c):c=e[5];let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("div",{className:"flex-1 flex items-center justify-center w-full",children:t.jsx("div",{className:"relative",children:t.jsx("div",{className:"w-48 h-48 rounded-full bg-primary/10 flex items-center justify-center",children:t.jsx("div",{className:"w-32 h-32 rounded-full bg-primary flex items-center justify-center shadow-lg shadow-primary/30",children:t.jsx("svg",{width:"60",height:"60",viewBox:"0 0 24 24",fill:"currentColor",className:"text-primary-foreground",children:t.jsx("path",{d:"M12 2 9.91 4.5 6.6 4l-.55 3.3L3 9.27l1.5 3-1.5 3L6.05 16.7 6.6 20l3.31-.5L12 22l2.09-2.5L17.4 20l.55-3.3L21 14.73l-1.5-3 1.5-3-2.95-1.97L17.4 4l-3.31.5Zm-1.4 13.4-3-3 1.4-1.4 1.6 1.58 4.6-4.58 1.4 1.4Z"})})})})})}),e[6]=x):x=e[6];let m;e[7]!==s?(m=s("certificationPitch.title",{defaultValue:"La certification inspire confiance"}),e[7]=s,e[8]=m):m=e[8];let o;e[9]!==m?(o=t.jsx("h2",{className:"text-3xl font-extrabold text-foreground leading-tight mb-3",children:m}),e[9]=m,e[10]=o):o=e[10];let d;e[11]!==s?(d=s("certificationPitch.subtitle",{defaultValue:"Les profils certifiés rassurent les autres buddiz et facilitent les rencontres pour des sessions sportives en toute confiance."}),e[11]=s,e[12]=d):d=e[12];let v;e[13]!==d?(v=t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:d}),e[13]=d,e[14]=v):v=e[14];let u;e[15]!==o||e[16]!==v?(u=t.jsxs("div",{className:"w-full max-w-md text-center mb-8",children:[o,v]}),e[15]=o,e[16]=v,e[17]=u):u=e[17];let p;e[18]!==s?(p=s("certificationPitch.cta",{defaultValue:"Certifier mon profil"}),e[18]=s,e[19]=p):p=e[19];let f;e[20]!==n||e[21]!==p?(f=t.jsx(ae,{type:"button",onClick:n,size:"lg",className:"w-full max-w-md h-14 rounded-full text-base",children:p}),e[20]=n,e[21]=p,e[22]=f):f=e[22];let b;e[23]!==f||e[24]!==u?(b=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-between px-6 pb-8",children:[x,u,f]}),e[23]=f,e[24]=u,e[25]=b):b=e[25];let j;return e[26]!==b||e[27]!==c?(j=t.jsxs("div",{className:"flex-1 flex flex-col bg-background",children:[c,b]}),e[26]=b,e[27]=c,e[28]=j):j=e[28],j}function Eo(a){const e=le.c(28),{onAccept:n,onRefuse:l}=a,{t:s}=oe();let r,i;e[0]!==l?(r=()=>{const j=h=>{h.key==="Escape"&&l()};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},i=[l],e[0]=l,e[1]=r,e[2]=i):(r=e[1],i=e[2]),U.useEffect(r,i);let c;e[3]!==s?(c=s("certificationConsent.title",{defaultValue:"Demande d'autorisation"}),e[3]=s,e[4]=c):c=e[4];let x;e[5]!==c?(x=t.jsx("h3",{id:"cert-consent-title",className:"text-base font-bold text-foreground mb-3",children:c}),e[5]=c,e[6]=x):x=e[6];let m;e[7]!==s?(m=s("certificationConsent.body",{defaultValue:"Pour pouvoir certifier ton profil, Buddiz a besoin de collecter des données biométriques à partir de ta vidéo afin de les comparer à ta photo de profil. La vidéo n'est jamais transmise à nos serveurs : tout se passe sur ton appareil. Tu peux retirer ton consentement à tout moment."}),e[7]=s,e[8]=m):m=e[8];let o;e[9]!==m?(o=t.jsx("p",{className:"text-sm text-foreground/80 leading-relaxed",children:m}),e[9]=m,e[10]=o):o=e[10];let d;e[11]!==x||e[12]!==o?(d=t.jsxs("div",{className:"p-6 text-center",children:[x,o]}),e[11]=x,e[12]=o,e[13]=d):d=e[13];let v;e[14]!==s?(v=s("certificationConsent.accept",{defaultValue:"Je suis d'accord"}),e[14]=s,e[15]=v):v=e[15];let u;e[16]!==n||e[17]!==v?(u=t.jsx(ae,{variant:"ghost",onClick:n,className:"w-full h-12 rounded-none border-0 border-t border-border text-primary",autoFocus:!0,children:v}),e[16]=n,e[17]=v,e[18]=u):u=e[18];let p;e[19]!==s?(p=s("certificationConsent.refuse",{defaultValue:"Je refuse"}),e[19]=s,e[20]=p):p=e[20];let f;e[21]!==l||e[22]!==p?(f=t.jsx(ae,{variant:"ghost",onClick:l,className:"w-full h-12 rounded-none border-0 border-t border-border text-primary",children:p}),e[21]=l,e[22]=p,e[23]=f):f=e[23];let b;return e[24]!==f||e[25]!==d||e[26]!==u?(b=t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center px-6 bg-black/40",role:"dialog","aria-modal":"true","aria-labelledby":"
2cert-consent-title",children:t.jsxs("div",{className:"w-full max-w-sm bg-card rounded-2xl overflow-hidden shadow-xl",children:[d,u,f]})}),e[24]=f,e[25]=d,e[26]=u,e[27]=b):b=e[27],b}var Os,Mn;function _o(){if(Mn)return Os;Mn=1;var a={linear:function(e,n,l,s){var r=l-n;return r*e/s+n},easeInQuad:function(e,n,l,s){var r=l-n;return r*(e/=s)*e+n},easeOutQuad:function(e,n,l,s){var r=l-n;return-r*(e/=s)*(e-2)+n},easeInOutQuad:function(e,n,l,s){var r=l-n;return(e/=s/2)<1?r/2*e*e+n:-r/2*(--e*(e-2)-1)+n},easeInCubic:function(e,n,l,s){var r=l-n;return r*(e/=s)*e*e+n},easeOutCubic:function(e,n,l,s){var r=l-n;return r*((e=e/s-1)*e*e+1)+n},easeInOutCubic:function(e,n,l,s){var r=l-n;return(e/=s/2)<1?r/2*e*e*e+n:r/2*((e-=2)*e*e+2)+n},easeInQuart:function(e,n,l,s){var r=l-n;return r*(e/=s)*e*e*e+n},easeOutQuart:function(e,n,l,s){var r=l-n;return-r*((e=e/s-1)*e*e*e-1)+n},easeInOutQuart:function(e,n,l,s){var r=l-n;return(e/=s/2)<1?r/2*e*e*e*e+n:-r/2*((e-=2)*e*e*e-2)+n},easeInQuint:function(e,n,l,s){var r=l-n;return r*(e/=s)*e*e*e*e+n},easeOutQuint:function(e,n,l,s){var r=l-n;return r*((e=e/s-1)*e*e*e*e+1)+n},easeInOutQuint:function(e,n,l,s){var r=l-n;return(e/=s/2)<1?r/2*e*e*e*e*e+n:r/2*((e-=2)*e*e*e*e+2)+n},easeInSine:function(e,n,l,s){var r=l-n;return-r*Math.cos(e/s*(Math.PI/2))+r+n},easeOutSine:function(e,n,l,s){var r=l-n;return r*Math.sin(e/s*(Math.PI/2))+n},easeInOutSine:function(e,n,l,s){var r=l-n;return-r/2*(Math.cos(Math.PI*e/s)-1)+n},easeInExpo:function(e,n,l,s){var r=l-n;return e==0?n:r*Math.pow(2,10*(e/s-1))+n},easeOutExpo:function(e,n,l,s){var r=l-n;return e==s?n+r:r*(-Math.pow(2,-10*e/s)+1)+n},easeInOutExpo:function(e,n,l,s){var r=l-n;return e===0?n:e===s?n+r:(e/=s/2)<1?r/2*Math.pow(2,10*(e-1))+n:r/2*(-Math.pow(2,-10*--e)+2)+n},easeInCirc:function(e,n,l,s){var r=l-n;return-r*(Math.sqrt(1-(e/=s)*e)-1)+n},easeOutCirc:function(e,n,l,s){var r=l-n;return r*Math.sqrt(1-(e=e/s-1)*e)+n},easeInOutCirc:function(e,n,l,s){var r=l-n;return(e/=s/2)<1?-r/2*(Math.sqrt(1-e*e)-1)+n:r/2*(Math.sqrt(1-(e-=2)*e)+1)+n},easeInElastic:function(e,n,l,s){var r=l-n,i,c,x;return x=1.70158,c=0,i=r,e===0?n:(e/=s)===1?n+r:(c||(c=s*.3),i<Math.abs(r)?(i=r,x=c/4):x=c/(2*Math.PI)*Math.asin(r/i),-(i*Math.pow(2,10*(e-=1))*Math.sin((e*s-x)*(2*Math.PI)/c))+n)},easeOutElastic:function(e,n,l,s){var r=l-n,i,c,x;return x=1.70158,c=0,i=r,e===0?n:(e/=s)===1?n+r:(c||(c=s*.3),i<Math.abs(r)?(i=r,x=c/4):x=c/(2*Math.PI)*Math.asin(r/i),i*Math.pow(2,-10*e)*Math.sin((e*s-x)*(2*Math.PI)/c)+r+n)},easeInOutElastic:function(e,n,l,s){var r=l-n,i,c,x;return x=1.70158,c=0,i=r,e===0?n:(e/=s/2)===2?n+r:(c||(c=s*(.3*1.5)),i<Math.abs(r)?(i=r,x=c/4):x=c/(2*Math.PI)*Math.asin(r/i),e<1?-.5*(i*Math.pow(2,10*(e-=1))*Math.sin((e*s-x)*(2*Math.PI)/c))+n:i*Math.pow(2,-10*(e-=1))*Math.sin((e*s-x)*(2*Math.PI)/c)*.5+r+n)},easeInBack:function(e,n,l,s,r){var i=l-n;return r===void 0&&(r=1.70158),i*(e/=s)*e*((r+1)*e-r)+n},easeOutBack:function(e,n,l,s,r){var i=l-n;return r===void 0&&(r=1.70158),i*((e=e/s-1)*e*((r+1)*e+r)+1)+n},easeInOutBack:function(e,n,l,s,r){var i=l-n;return r===void 0&&(r=1.70158),(e/=s/2)<1?i/2*(e*e*(((r*=1.525)+1)*e-r))+n:i/2*((e-=2)*e*(((r*=1.525)+1)*e+r)+2)+n},easeInBounce:function(e,n,l,s){var r=l-n,i;return i=a.easeOutBounce(s-e,0,r,s),r-i+n},easeOutBounce:function(e,n,l,s){var r=l-n;return(e/=s)<1/2.75?r*(7.5625*e*e)+n:e<2/2.75?r*(7.5625*(e-=1.5/2.75)*e+.75)+n:e<2.5/2.75?r*(7.5625*(e-=2.25/2.75)*e+.9375)+n:r*(7.5625*(e-=2.625/2.75)*e+.984375)+n},easeInOutBounce:function(e,n,l,s){var r=l-n,i;return e<s/2?(i=a.easeInBounce(e*2,0,r,s),i*.5+n):(i=a.easeOutBounce(e*2-s,0,r,s),i*.5+r*.5+n)}};return Os=a,Os}var Mo=_o();function Lo(a){return a*Math.PI/180}function ft(a,e){return a+Math.random()*(e-a)}function Io(a,e){return Math.floor(a+Math.random()*(e-a+1))}var Yt;(function(a){a[a.Circle=0]="Circle",a[a.Square=1]="Square",a[a.Strip=2]="Strip"})(Yt||(Yt={}));var _t;(function(a){a[a.Positive=1]="Positive",a[a.Negative=-1]="Negative"})(_t||(_t={}));const To=1e3/60;class Ao{constructor(e,n,l,s){this.getOptions=n;const{colors:r,initialVelocityX:i,initialVelocityY:c}=this.getOptions();this.context=e,this.x=l,this.y=s,this.w=ft(5,20),this.h=ft(5,20),this.radius=ft(5,10),this.vx=typeof i=="number"?ft(-i,i):ft(i.min,i.max),this.vy=typeof c=="number"?ft(-c,0):ft(c.min,c.max),this.shape=Io(0,2),this.angle=Lo(ft(0,360)),this.angularSpin=ft(-.2,.2),this.color=r[Math.floor(Math.random()*r.length)],this.rotateY=ft(0,1),this.rotationDirection=ft(0,1)?_t.Positive:_t.Negative}update(e){const{gravity:n,wind:l,friction:s,opacity:r,drawShape:i}=this.getOptions(),c=e/To;this.x+=this.vx*c,this.y+=this.vy*c,this.vy+=n*c,this.vx+=l*c,this.vx*=s**c,this.vy*=s**c,this.rotateY>=1&&this.rotationDirection===_t.Positive?this.rotationDirection=_t.Negative:this.rotateY<=-1&&this.rotationDirection===_t.Negative&&(this.rotationDirection=_t.Positive);const x=.1*this.rotationDirection*c;if(this.rotateY+=x,this.angle+=this.angularSpin,this.context.save(),this.context.translate(this.x,this.y),this.context.rotate(this.angle),this.context.scale(1,this.rotateY),this.context.rotate(this.angle),this.context.beginPath(),this.context.fillStyle=this.color,this.context.strokeStyle=this.color,this.context.globalAlpha=r,this.context.lineCap="round",this.context.lineWidth=2,i&&typeof i=="function")i.call(this,this.context);else switch(this.shape){case Yt.Circle:{this.context.beginPath(),this.context.arc(0,0,this.radius,0,2*Math.PI),this.context.fill();break}case Yt.Square:{this.context.fillRect(-this.w/2,-this.h/2,this.w,this.h);break}case Yt.Strip:{this.context.fillRect(-this.w/6,-this.h/2,this.w/3,this.h);break}}
2this.context.closePath(),this.context.restore()}}class Do{constructor(e,n){this.x=0,this.y=0,this.w=0,this.h=0,this.lastNumberOfPieces=0,this.tweenProgress=0,this.tweenFrom=0,this.particles=[],this.particlesGenerated=0,this.removeParticleAt=s=>{this.particles.splice(s,1)},this.getParticle=()=>{const s=ft(this.x,this.w+this.x),r=ft(this.y,this.h+this.y);return new Ao(this.context,this.getOptions,s,r)},this.animate=s=>{const{canvas:r,context:i,particlesGenerated:c,lastNumberOfPieces:x}=this,{run:m,recycle:o,numberOfPieces:d,debug:v,tweenFunction:u,tweenDuration:p}=this.getOptions();if(!m)return!1;const f=this.particles.length,b=o?f:c;if(b<d){x!==d&&(this.tweenProgress=0,this.tweenFrom=b,this.lastNumberOfPieces=d),this.tweenProgress=Math.min(p,Math.max(0,this.tweenProgress+s));const j=u(this.tweenProgress,this.tweenFrom,d,p),h=Math.round(j-b);for(let y=0;y<h;y++)this.particles.push(this.getParticle());this.particlesGenerated+=h}v&&(i.font="12px sans-serif",i.fillStyle="#333",i.textAlign="right",i.fillText(`Particles: ${f}`,r.width-10,r.height-20));for(let j=this.particles.length-1;j>=0;j--){const h=this.particles[j];h.update(s),(h.y>r.height||h.y<-100||h.x>r.width+100||h.x<-100)&&(o&&b<=d?this.particles[j]=this.getParticle():this.removeParticleAt(j))}return f>0||b<d},this.canvas=e;const l=this.canvas.getContext("2d");if(!l)throw new Error("Could not get canvas context");this.context=l,this.getOptions=n}}const Ws={width:typeof window<"u"?window.innerWidth:300,height:typeof window<"u"?window.innerHeight:200,numberOfPieces:200,friction:.99,wind:0,gravity:.1,initialVelocityX:4,initialVelocityY:10,colors:["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4CAF50","#8BC34A","#CDDC39","#FFEB3B","#FFC107","#FF9800","#FF5722","#795548"],opacity:1,debug:!1,tweenFunction:Mo.easeInOutQuad,tweenDuration:5e3,recycle:!0,run:!0};class Ro{constructor(e,n){this.lastFrameTime=0,this.setOptionsWithDefaults=s=>{const r={confettiSource:{x:0,y:0,w:this.canvas.width,h:0}};this._options={...r,...Ws,...s},Object.assign(this,s.confettiSource)},this.update=(s=0)=>{const{options:{run:r,onConfettiComplete:i,frameRate:c},canvas:x,context:m}=this,o=Math.min(s-this.lastFrameTime,50);if(c&&o<1e3/c){this.rafId=requestAnimationFrame(this.update);return}this.lastFrameTime=s-(c?o%c:0),r&&(m.fillStyle="white",m.clearRect(0,0,x.width,x.height)),this.generator.animate(o)?this.rafId=requestAnimationFrame(this.update):(i&&typeof i=="function"&&this.generator.particlesGenerated>0&&i.call(this,this),this._options.run=!1)},this.reset=()=>{this.generator&&this.generator.particlesGenerated>0&&(this.generator.particlesGenerated=0,this.generator.particles=[],this.generator.lastNumberOfPieces=0)},this.stop=()=>{this.options={run:!1},this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=void 0)},this.canvas=e;const l=this.canvas.getContext("2d");if(!l)throw new Error("Could not get canvas context");this.context=l,this.generator=new Do(this.canvas,()=>this.options),this.options=n,this.update()}get options(){return this._options}set options(e){const n=this._options?.run,l=this._options?.recycle;this.setOptionsWithDefaults(e),this.generator&&(Object.assign(this.generator,this.options.confettiSource),typeof e.recycle=="boolean"&&e.recycle&&l===!1&&(this.generator.lastNumberOfPieces=this.generator.particles.length)),typeof e.run=="boolean"&&e.run&&n===!1&&this.update()}}const Fo=gs.createRef();class Ys extends gs.Component{constructor(e){super(e),this.canvas=gs.createRef(),this.canvas=e.canvasRef||Fo}componentDidMount(){if(this.canvas.current){const e=Bs(this.props)[0];this.confetti=new Ro(this.canvas.current,e)}}componentDidUpdate(){const e=Bs(this.props)[0];this.confetti&&(this.confetti.options=e)}componentWillUnmount(){this.confetti&&this.confetti.stop(),this.confetti=void 0}render(){const[e,n]=Bs(this.props),l={zIndex:2,position:"absolute",pointerEvents:"none",top:0,left:0,bottom:0,right:0,...n.style};return t.jsx("canvas",{width:e.width,height:e.height,ref:this.canvas,...n,style:l})}}Ys.defaultProps={...Ws};Ys.displayName="ReactConfetti";function Bs(a){const e={},n={},l={},s=[...Object.keys(Ws),"confettiSource","drawShape","onConfettiComplete","frameRate"],r=["canvasRef"];for(const i in a){const c=a[i];s.includes(i)?e[i]=c:r.includes(i)?r[i]=c:l[i]=c}return[e,l,n]}const Oo=gs.forwardRef((a,e)=>t.jsx(Ys,{canvasRef:e,...a}));function Bo(a){const e=le.c(68),{verdict:n,attemptsUsed:l,maxAttempts:s,onRetry:r,onDone:i}=a,{t:c}=oe(),x=l<s&&n.kind!=="match",m=Vo();if(n.kind==="match"){let S;
2e[0]!==m.height||e[1]!==m.width?(S=t.jsx("div",{className:"pointer-events-none absolute inset-0",children:t.jsx(Oo,{width:m.width,height:m.height,numberOfPieces:250,recycle:!1,tweenDuration:4e3})}),e[0]=m.height,e[1]=m.width,e[2]=S):S=e[2];let B;e[3]===Symbol.for("react.memo_cache_sentinel")?(B=t.jsx("div",{className:"w-32 h-32 rounded-full bg-primary flex items-center justify-center mb-6",children:t.jsx("svg",{width:"60",height:"60",viewBox:"0 0 24 24",fill:"white",children:t.jsx("path",{d:"M20 6 9 17l-5-5",stroke:"white",strokeWidth:"3",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})}),e[3]=B):B=e[3];let D;e[4]!==c?(D=c("certificationResult.successTitle",{defaultValue:"Profil certifié !"}),e[4]=c,e[5]=D):D=e[5];let M;e[6]!==D?(M=t.jsx("h2",{className:"text-2xl font-extrabold text-foreground leading-tight mb-2",children:D}),e[6]=D,e[7]=M):M=e[7];let R;e[8]!==c?(R=c("certificationResult.successBody",{defaultValue:"Ton badge de certification est désormais visible sur ton profil. Bravo !"}),e[8]=c,e[9]=R):R=e[9];let T;e[10]!==R?(T=t.jsx("p",{className:"text-sm text-muted-foreground mb-8 max-w-xs",children:R}),e[10]=R,e[11]=T):T=e[11];let F;e[12]!==c?(F=c("certificationResult.done",{defaultValue:"Continuer"}),e[12]=c,e[13]=F):F=e[13];let O;e[14]!==i||e[15]!==F?(O=t.jsx(ae,{type:"button",onClick:i,size:"lg",className:"w-full max-w-sm h-12 rounded-full",children:F}),e[14]=i,e[15]=F,e[16]=O):O=e[16];let G;return e[17]!==S||e[18]!==M||e[19]!==T||e[20]!==O?(G=t.jsxs("div",{className:"min-h-[100dvh] flex flex-col items-center justify-center px-6 py-8 text-center bg-background relative overflow-hidden",children:[S,B,M,T,O]}),e[17]=S,e[18]=M,e[19]=T,e[20]=O,e[21]=G):G=e[21],G}let o;e:{switch(n.kind){case"no_face":{let S;e[22]!==c?(S=c("certificationResult.noFaceTitle",{defaultValue:"Visage non détecté"}),e[22]=c,e[23]=S):S=e[23],o=S;break e}case"no_face_in_avatar":{let S;e[24]!==c?(S=c("certificationResult.noFaceInAvatarTitle",{defaultValue:"Photo de profil illisible"}),e[24]=c,e[25]=S):S=e[25],o=S;break e}case"no_match":{let S;e[26]!==c?(S=c("certificationResult.noMatchTitle",{defaultValue:"Le visage ne correspond pas"}),e[26]=c,e[27]=S):S=e[27],o=S;break e}case"permission_denied":{let S;e[28]!==c?(S=c("certificationResult.permissionTitle",{defaultValue:"Caméra non autorisée"}),e[28]=c,e[29]=S):S=e[29],o=S;break e}case"internal_error":{let S;e[30]!==c?(S=c("certificationResult.errorTitle",{defaultValue:"Une erreur est survenue"}),e[30]=c,e[31]=S):S=e[31],o=S;break e}}o=void 0}const d=o;let v;e:{switch(n.kind){case"no_face":{let S;e[32]!==c?(S=c("certificationResult.noFaceBody",{defaultValue:"Réessaie dans un meilleur éclairage, en face de ta caméra et sans lunettes."}),e[32]=c,e[33]=S):S=e[33],v=S;break e}case"no_face_in_avatar":{let S;e[34]!==c?(S=c("certificationResult.noFaceInAvatarBody",{defaultValue:"On n'arrive pas à détecter ton visage sur ta photo de profil. Change-la pour une photo de face, sans casquette ni lunettes, puis réessaie."}),e[34]=c,e[35]=S):S=e[35],v=S;break e}case"no_match":{let S;e[36]!==c?(S=c("certificationResult.noMatchBody",{defaultValue:"Ta vidéo ne correspond pas à ta photo de profil. Vérifie que la photo est bien la tienne et réessaie."}),e[36]=c,e[37]=S):S=e[37],v=S;break e}case"permission_denied":{let S;e[38]!==c?(S=c("certificationResult.permissionBody",{defaultValue:"Autorise l'accès à la caméra dans les réglages de ton navigateur ou de ton appareil, puis réessaie."}),e[38]=c,e[39]=S):S=e[39],v=S;break e}case"internal_error":{v=n.message;break e}}v=void 0}const u=v,p=Math.min(l,s),f=n.kind!=="no_face_in_avatar"&&n.kind!=="permission_denied";let b;e[40]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("div",{className:"w-32 h-32 rounded-full bg-destructive/10 flex items-center justify-center mb-6",children:t.jsx("svg",{width:"60",height:"60",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"text-destructive",children:t.jsx("path",{d:"M12 9v4m0 4h.01M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z"})})}),e[40]=b):b=e[40];let j;e[41]!==d?(j=t.jsx("h2",{className:"text-2xl font-extrabold text-foreground leading-tight mb-2",children:d}),e[41]=d,e[42]=j):j=e[42];let h;e[43]!==u?(h=t.jsx("p",{className:"text-sm text-muted-foreground mb-8 max-w-xs",children:u}),e[43]=u,e[44]=h):h=e[44];let y;e[45]!==x||e[46]!==r||e[47]!==c?(y=x&&t.jsx(ae,{type:"button",onClick:r,size:"lg",className:"w-full h-12 rounded-full",children:c("certificationResult.retry",{defaultValue:"Réessayer"})}),e[45]=x,e[46]=r,e[47]=c,e[48]=y):y=e[48];let w;e[49]!==x||e[50]!==c?(w=x?c("certificationResult.cancel",{defaultValue:"Annuler"}):c("certificationResult.tryTomorrow",{defaultValue:"Réessaie demain"}),e[49]=x,e[50]=c,e[51]=w):w=e[51];let P;e[52]!==i||e[53]!==w?(P=t.jsx(ae,{type:"button",variant:"outline",onClick:i,size:"lg",className:"w-full h-12 rounded-full",children:w}),e[52]=i,e[53]=w,e[54]=P):P=e[54];let L;e[55]!==y||e[56]!==P?(L=t.jsxs("div",{className:"w-full max-w-sm flex flex-col gap-3",children:[y,P]}),e[55]=y,e[56]=P,e[57]=L):L=e[57];let g;e[58]!==p||e[59]!==s||e[60]!==f||e[61]!==c?(g=f&&t.jsx("p",{className:"text-xs text-muted-foreground mt-4",children:c("certificationResult.attempts",{used:p,max:s,defaultValue:`Tentative ${p} sur ${s}`})}),e[58]=p,e[59]=s,e[60]=f,e[61]=c,e[62]=g):g=e[62];let I;return e[63]!==g||e[64]!==j||e[65]!==h||e[66]!==L?(I=t.jsxs("div",{className:"min-h-[100dvh] flex flex-col items-center justify-center px-6 py-8 text-center bg-background",children:[b,j,h,L,g]}),e[63]=g,e[64]=j,e[65]=h,e[66]=L,e[67]=I):I=e[67],I}function Vo(){const a=le.c(2),[e,n]=U.useState(Uo);let l,s;return a[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{if(typeof window>"u")return;const r=()=>n({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},s=[],a[0]=l,a[1]=s):(l=a[0],s=a[1]),U.useEffect(l,s),e}function Uo(){return{width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0}}function $o(a){const e=le.c(35),{onConfirm:n,onCancel:l,loading:s}=a,{t:r}=oe();Wn(!0,l);let i,c;e[0]!==l?(i=()=>{const w=P=>{P.key==="Escape"&&l()};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},c=[l],e[0]=l,e[1]=i,e[2]=c):(i=e[1],c=e[2]),U.useEffect(i,c);let x;e[3]!==r?(x=r("identityVerification.revokeCta"),e[3]=r,e[4]=x):x=e[4];let m;e[5]!==x?(m=t.jsx("h3",{id:"revoke-confirm-title",className:"text-base font-bold text-foreground mb-3",children:x}),e[5]=x,e[6]=m):m=e[6];let o;e[7]!==r?(o=r("identityVerification.revokeConfirm"),e[7]=r,e[8]=o):o=e[8];let d;
2e[9]!==o?(d=t.jsx("p",{className:"text-sm text-foreground/80 leading-relaxed",children:o}),e[9]=o,e[10]=d):d=e[10];let v;e[11]!==m||e[12]!==d?(v=t.jsxs("div",{className:"p-6 text-center",children:[m,d]}),e[11]=m,e[12]=d,e[13]=v):v=e[13];let u;e[14]!==r?(u=r("common.confirm",{defaultValue:"Confirmer"}),e[14]=r,e[15]=u):u=e[15];let p;e[16]!==s||e[17]!==n||e[18]!==u?(p=t.jsx(ae,{variant:"ghost",className:"w-full h-12 rounded-none border-0 border-t border-border text-destructive",onClick:n,disabled:s,autoFocus:!0,children:u}),e[16]=s,e[17]=n,e[18]=u,e[19]=p):p=e[19];let f;e[20]!==r?(f=r("common.cancel",{defaultValue:"Annuler"}),e[20]=r,e[21]=f):f=e[21];let b;e[22]!==s||e[23]!==l||e[24]!==f?(b=t.jsx(ae,{variant:"ghost",className:"w-full h-12 rounded-none border-0 border-t border-border",onClick:l,disabled:s,children:f}),e[22]=s,e[23]=l,e[24]=f,e[25]=b):b=e[25];let j;e[26]!==b||e[27]!==p?(j=t.jsxs("div",{className:"flex flex-col",children:[p,b]}),e[26]=b,e[27]=p,e[28]=j):j=e[28];let h;e[29]!==j||e[30]!==v?(h=t.jsxs("div",{className:"w-full max-w-sm bg-card rounded-2xl overflow-hidden shadow-xl",onClick:Ko,children:[v,j]}),e[29]=j,e[30]=v,e[31]=h):h=e[31];let y;return e[32]!==l||e[33]!==h?(y=t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center px-6 bg-black/40",role:"dialog","aria-modal":"true","aria-labelledby":"revoke-confirm-title",onClick:l,children:h}),e[32]=l,e[33]=h,e[34]=y):y=e[34],y}function Ko(a){return a.stopPropagation()}const cl=3;function zo(a,e){return a?new Date(a).toLocaleDateString(e,{day:"2-digit",month:"long",year:"numeric"}):""}function qo(a){const e=le.c(67),{currentUser:n,onBack:l}=a,{t:s,i18n:r}=oe(),{submitFaceVerdict:i,revokeCertification:c,loading:x}=hi(),{enabled:m}=ze("identity_verification"),{refetchProfile:o}=kt(),d=qe(Ze()),[v,u]=U.useState("intro"),[p,f]=U.useState(null),[b,j]=U.useState(0),[h,y]=U.useState(!1),[w,P]=U.useState(!1);if(!m)return null;const L=n.identityVerified===!0,g=n.identityVerifiedAt??null,I=n.avatarUrl??null;let S;e[0]!==I||e[1]!==n.avatarIsMonogram?(S=Tr({avatarUrl:I,avatarIsMonogram:n.avatarIsMonogram}),e[0]=I,e[1]=n.avatarIsMonogram,e[2]=S):S=e[2];const B=S;let D;e[3]!==o||e[4]!==i||e[5]!==s?(D=async Y=>{if(Y.kind!=="no_face_in_avatar"&&Y.kind!=="permission_denied"&&j(Go),Y.kind!=="match"&&Dr({reason:Y.kind,surface:"profile",distance:Y.kind==="no_match"?Y.distance:void 0,stats:Y.kind==="no_face"?Y.stats:void 0}),Y.kind==="match"){const{success:z}=await i(Y);if(!z){f({kind:"internal_error",message:s("certificationResult.serverRejected")}),u("result");return}try{await o()}catch(se){console.warn("[IdentityVerification] refetchProfile failed",se)}}f(Y),u("result")},e[3]=o,e[4]=i,e[5]=s,e[6]=D):D=e[6];const M=D;let R;e[7]!==l||e[8]!==c||e[9]!==y?(R=async()=>{y(!1),await c(),l()},e[7]=l,e[8]=c,e[9]=y,e[10]=R):R=e[10];const T=R;if(v==="pitch"){let Y;return e[11]===Symbol.for("react.memo_cache_sentinel")?(Y=t.jsx(Po,{onAccept:()=>u("consent"),onClose:()=>u("intro")}),e[11]=Y):Y=e[11],Y}if(v==="consent"){let Y;return e[12]===Symbol.for("react.memo_cache_sentinel")?(Y=t.jsx(Eo,{onAccept:()=>u("capture"),onRefuse:()=>u("intro")}),e[12]=Y):Y=e[12],Y}if(v==="capture"&&B&&I){let Y;e[13]===Symbol.for("react.memo_cache_sentinel")?(Y=()=>u("intro"),e[13]=Y):Y=e[13];let te;return e[14]!==I||e[15]!==M?(te=t.jsx(gi,{referenceAvatarUrl:I,onVerdict:M,onCancel:Y}),e[14]=I,e[15]=M,e[16]=te):te=e[16],te}if(v==="result"&&p){let Y;e[17]===Symbol.for("react.memo_cache_sentinel")?(Y=()=>{f(null),u("capture")},e[17]=Y):Y=e[17];let te;e[18]!==l||e[19]!==p.kind?(te=()=>{f(null),u("intro"),p.kind==="match"&&l()},e[18]=l,e[19]=p.kind,e[20]=te):te=e[20];let z;return e[21]!==b||e[22]!==te||e[23]!==p?(z=t.jsx(Bo,{verdict:p,attemptsUsed:b,maxAttempts:cl,onRetry:Y,onDone:te}),e[21]=b,e[22]=te,e[23]=p,e[24]=z):z=e[24],z}const F="flex-1 overflow-y-auto pb-4";let O;e[25]!==s?(O=s("identityVerification.title"),e[25]=s,e[26]=O):O=e[26];let G;e[27]!==s?(G=s("identityVerification.subtitle"),e[27]=s,e[28]=G):G=e[28];let E;e[29]!==l||e[30]!==O||e[31]!==G?(E=t.jsx(we,{title:O,subtitle:G,onBack:l}),e[29]=l,e[30]=O,e[31]=G,e[32]=E):E=e[32];const q="px-4 flex flex-col gap-4",V=L&&"bg-primary/10 border-primary";let $;e[33]!==V?($=X("p-4 flex items-center gap-3",V),e[33]=V,e[34]=$):$=e[34];let K;e[35]===Symbol.for("react.memo_cache_sentinel")?(K=t.jsx(Rr,{verified:!0,size:"lg"}),e[35]=K):K=e[35];let C;e[36]!==r||e[37]!==L||e[38]!==s||e[39]!==g?(C=L?t.jsxs("div",{className:"flex flex-col",children:[t.jsx("p",{className:"text-sm font-semibold text-primary",children:s("identityVerification.statusVerified")}),g&&t.jsx("p",{className:"text-xs text-muted-foreground",children:s("identityVerification.statusVerifiedAt",{date:zo(g,r.language)})})]}):t.jsx("p",{className:"text-sm text-muted-foreground",children:s("identityVerification.explainer")}),e[36]=r,e[37]=L,e[38]=s,e[39]=g,e[40]=C):C=e[40];let Q;e[41]!==$||e[42]!==C?(Q=t.jsxs(ne,{className:$,children:[K,C]}),e[41]=$,e[42]=C,e[43]=Q):Q=e[43];const J=!L&&t.jsxs(t.Fragment,{children:[t.jsxs(ne,{className:"p-4",children:[t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:s("identityVerification.why")}),t.jsxs("ul",{className:"text-sm space-y-1.5",children:[t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{"aria-hidden":!0,
2children:"â¢"}),t.jsx("span",{children:s("identityVerification.whyPoint1",{sessionLabelPlural:d.sessionLabelPlural})})]}),t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{"aria-hidden":!0,children:"â¢"}),t.jsx("span",{children:s("identityVerification.whyPoint2")})]}),t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{"aria-hidden":!0,children:"â¢"}),t.jsx("span",{children:s("identityVerification.whyPoint3")})]})]})]}),t.jsxs(ne,{className:"p-4",children:[t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:s("identityVerification.howItWorks")}),t.jsxs("ol",{className:"text-sm space-y-1.5",children:[t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{className:"font-semibold",children:"1."}),t.jsx("span",{children:s("identityVerification.step1FaceApi")})]}),t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{className:"font-semibold",children:"2."}),t.jsx("span",{children:s("identityVerification.step2FaceApi")})]}),t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{className:"font-semibold",children:"3."}),t.jsx("span",{children:s("identityVerification.step3FaceApi")})]})]})]}),!B&&t.jsx(ne,{className:"p-3 border-amber-500/40 bg-amber-500/10",children:t.jsx("p",{className:"text-xs text-foreground",children:s("identityVerification.needAvatar")})}),B?t.jsx(ae,{className:"w-full",size:"lg",onClick:()=>{Ar({surface:"profile"}),u("pitch")},disabled:x||L,children:s("identityVerification.ctaStartFaceApi")}):t.jsx(ae,{className:"w-full",size:"lg",onClick:()=>P(!0),children:s("identityVerification.ctaAddPhoto")}),t.jsx("p",{className:"text-xs text-muted-foreground text-center px-4",children:s("identityVerification.privacyNoteFaceApi")})]});let N;e[44]!==L||e[45]!==x||e[46]!==y||e[47]!==s?(N=L&&t.jsx(ae,{variant:"ghost",className:"w-full text-destructive",onClick:()=>y(!0),disabled:x,children:s("identityVerification.revokeCta")}),e[44]=L,e[45]=x,e[46]=y,e[47]=s,e[48]=N):N=e[48];let A;e[49]!==Q||e[50]!==J||e[51]!==N?(A=t.jsxs("div",{className:q,children:[Q,J,N]}),e[49]=Q,e[50]=J,e[51]=N,e[52]=A):A=e[52];let k;e[53]!==T||e[54]!==x||e[55]!==y||e[56]!==h?(k=h&&t.jsx($o,{onConfirm:T,onCancel:()=>y(!1),loading:x}),e[53]=T,e[54]=x,e[55]=y,e[56]=h,e[57]=k):k=e[57];let H;e[58]!==n||e[59]!==P||e[60]!==w?(H=w&&t.jsx(Fr,{currentUser:n,onClose:()=>P(!1)}),e[58]=n,e[59]=P,e[60]=w,e[61]=H):H=e[61];let ee;return e[62]!==A||e[63]!==k||e[64]!==H||e[65]!==E?(ee=t.jsxs("div",{className:F,children:[E,A,k,H]}),e[62]=A,e[63]=k,e[64]=H,e[65]=E,e[66]=ee):ee=e[66],ee}function Go(a){return Math.min(a+1,cl)}function Ho(a){const e=le.c(13);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=[],e[0]=n):n=e[0];const[l,s]=U.useState(n);let r;e[1]!==a?(r=()=>!!a,e[1]=a,e[2]=r):r=e[2];const[i,c]=U.useState(r);let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[3]=x):x=e[3];const m=U.useRef(x);let o;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=y=>{s(w=>{const P=typeof y=="function"?y(w):y;return m.current=P,P})},e[4]=o):o=e[4];const d=o;let v,u;e[5]!==a?(v=()=>{if(!a)return;let y=!0;c(!0);const w=ge.from("meeting_places").select("id, sport, label, alias, lat, lng, use_count, last_used_at").eq("user_id",a).order("last_used_at",{ascending:!1});return Promise.resolve(w).then(P=>{const{data:L}=P;y&&(d((L??[]).map(Wo)),c(!1))}).catch(()=>{y&&c(!1)}),()=>{y=!1}},u=[a,d],e[5]=a,e[6]=v,e[7]=u):(v=e[6],u=e[7]),U.useEffect(v,u);let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=async y=>{const w=m.current,P=w.findIndex(I=>I.id===y);if(P===-1)return;const L=w[P];d(I=>I.filter(S=>S.id!==y));const{error:g}=await ge.from("meeting_places").delete().eq("id",y);g&&(d(I=>{const S=[...I];return S.splice(P,0,L),S}),Z.error(Et.t("hooks.deletePlaceError")))},e[8]=p):p=e[8];const f=p;let b;e[9]===Symbol.for("react.memo_cache_sentinel")?(b=async(y,w)=>{const P=w?.trim()??"",L=P.length===0?null:P.slice(0,60),I=m.current.find(D=>D.id===y);if(!I)return;const S=I.alias;d(D=>D.map(M=>M.id===y?{...M,alias:L}:M));const{error:B}=await ge.from("meeting_places").update({alias:L}).eq("id",y);B&&(d(D=>D.map(M=>M.id===y?{...M,alias:S}:M)),Z.error(Et.t("hooks.updateAliasError")))},e[9]=b):b=e[9];const j=b;let h;return e[10]!==i||e[11]!==l?(h={places:l,loading:i,deletePlace:f,updateAlias:j},e[10]=i,e[11]=l,e[12]=h):h=e[12],h}function Wo(a){return{id:a.id,sport:a.sport,label:a.label,alias:a.alias??null,lat:a.lat,lng:a.lng,useCount:a.use_count,lastUsedAt:a.last_used_at}}const Vs=60;function Yo(a){const e=le.c(90),{userId:n,onBack:l}=a,{t:s}=oe(),{places:r,loading:i,deletePlace:c,updateAlias:x}=Ho(n),[m,o]=U.useState("all"),[d,v]=U.useState(null),[u,p]=U.useState(null),[f,b]=U.useState(""),j=U.useRef(null);let h,y;e[0]!==u?(h=()=>{u&&requestAnimationFrame(()=>j.current?.focus())},y=[u],e[0]=u,e[1]=h,e[2]=y):(h=e[1],y=e[2]),U.useEffect(h,y);let w,P,L,g,I,S,B,D,M,R,T;if(e[3]!==f||e[4]!==d||e[5]!==c||e[6]!==m||e[7]!==i||e[8]!==l||e[9]!==r||e[10]!==u||e[11]!==s||e[12]!==x){let C;e[24]!==r?(C=z=>qe(z).modes.hasSavedMeetingPlaces&&r.some(se=>se.sport===z),e[24]=r,e[25]=C):C=e[25];const Q=zs().filter(C);w=m!=="all"&&!Q.includes(m)?"all":m;let J;e[26]!==w||e[27]!==r?(J=w==="all"?r:r.filter(z=>z.sport===w),e[26]=w,e[27]=r,e[28]=J):J=e[28],P=J;let N;e[29]===Symbol.for("react.memo_cache_sentinel")?(N=z=>v(z),e[29]=N):N=e[29],g=N;let A;
2e[30]!==d||e[31]!==c?(A=async()=>{d&&(v(null),await c(d))},e[30]=d,e[31]=c,e[32]=A):A=e[32],L=A;let k;e[33]===Symbol.for("react.memo_cache_sentinel")?(k=z=>{b(z.alias??""),p(z)},e[33]=k):k=e[33],S=k;let H;e[34]!==f||e[35]!==u||e[36]!==x?(H=async()=>{if(!u)return;const z=u;p(null),await x(z.id,f)},e[34]=f,e[35]=u,e[36]=x,e[37]=H):H=e[37],B=H;let ee;e[38]!==u||e[39]!==x?(ee=async()=>{if(!u)return;const z=u;p(null),await x(z.id,null)},e[38]=u,e[39]=x,e[40]=ee):ee=e[40],I=ee,R="flex-1 overflow-y-auto pb-4";let Y;e[41]!==s?(Y=s("meetingPlaces.title"),e[41]=s,e[42]=Y):Y=e[42];let te;e[43]!==s?(te=s("meetingPlaces.subtitle"),e[43]=s,e[44]=te):te=e[44],e[45]!==l||e[46]!==Y||e[47]!==te?(T=t.jsx(we,{title:Y,subtitle:te,onBack:l}),e[45]=l,e[46]=Y,e[47]=te,e[48]=T):T=e[48],D="px-4 flex flex-col gap-3",M=!i&&Q.length>=2&&t.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-1 scrollbar-none",children:[t.jsx("button",{type:"button",onClick:()=>o("all"),className:X("shrink-0 rounded-full px-3 py-1.5 text-xs font-medium border transition-colors",w==="all"?"border-primary bg-primary/10 text-primary":"border-border bg-card text-muted-foreground"),children:s("meetingPlaces.all")}),Q.map(z=>t.jsxs("button",{type:"button",onClick:()=>o(z),className:X("shrink-0 rounded-full px-3 py-1.5 text-xs font-medium border transition-colors",w===z?"border-primary bg-primary/10 text-primary":"border-border bg-card text-muted-foreground"),children:[t.jsx(Lt,{sport:z,size:16})," ",s(`sport.${z}.label`)]},z))]}),e[3]=f,e[4]=d,e[5]=c,e[6]=m,e[7]=i,e[8]=l,e[9]=r,e[10]=u,e[11]=s,e[12]=x,e[13]=w,e[14]=P,e[15]=L,e[16]=g,e[17]=I,e[18]=S,e[19]=B,e[20]=D,e[21]=M,e[22]=R,e[23]=T}else w=e[13],P=e[14],L=e[15],g=e[16],I=e[17],S=e[18],B=e[19],D=e[20],M=e[21],R=e[22],T=e[23];let F;e[49]!==i?(F=i&&t.jsx(ne,{className:"overflow-hidden",children:[1,2,3].map(Zo)}),e[49]=i,e[50]=F):F=e[50];let O;e[51]!==i||e[52]!==r||e[53]!==s?(O=!i&&r.length===0&&t.jsxs(ne,{className:"p-6 text-center",children:[t.jsx(Mt,{name:"map-pin",className:"w-7 h-7 mb-2 mx-auto text-muted-foreground"}),t.jsx("p",{className:"text-sm font-medium",children:s("meetingPlaces.emptyTitle")}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:s("meetingPlaces.emptyDescription")})]}),e[51]=i,e[52]=r,e[53]=s,e[54]=O):O=e[54];let G;e[55]!==w||e[56]!==P||e[57]!==i||e[58]!==r||e[59]!==s?(G=!i&&r.length>0&&P.length===0&&t.jsx(ne,{className:"p-6 text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:s("meetingPlaces.emptyForSport",{sport:s(`sport.${w}.label`)})})}),e[55]=w,e[56]=P,e[57]=i,e[58]=r,e[59]=s,e[60]=G):G=e[60];let E;e[61]!==P||e[62]!==g||e[63]!==S||e[64]!==i||e[65]!==s?(E=!i&&P.length>0&&t.jsx(ne,{className:"overflow-hidden",children:P.map(C=>t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border last:border-b-0",children:[t.jsx("div",{className:"h-9 w-9 rounded-full bg-primary/10 flex items-center justify-center text-base shrink-0",children:t.jsx(Lt,{sport:C.sport,size:20})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:C.alias??C.label}),C.alias&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:C.label}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("meetingPlaces.usedCount",{count:C.useCount})," ",new Date(C.lastUsedAt).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})]})]}),t.jsx("button",{type:"button","aria-label":s("meetingPlaces.renameAriaLabel",{name:C.alias??C.label}),className:"p-2 text-muted-foreground hover:text-primary transition-colors shrink-0",onClick:()=>S(C),children:t.jsx(vs,{size:16})}),t.jsx("button",{type:"button","aria-label":s("meetingPlaces.deleteAriaLabel",{name:C.alias??C.label}),className:"p-2 text-muted-foreground hover:text-destructive transition-colors shrink-0",onClick:()=>g(C.id),children:t.jsx(qs,{size:16})})]},C.id))}),e[61]=P,e[62]=g,e[63]=S,e[64]=i,e[65]=s,e[66]=E):E=e[66];let q;e[67]!==E||e[68]!==D||e[69]!==M||e[70]!==F||e[71]!==O||e[72]!==G?(q=t.jsxs("div",{className:D,children:[M,F,O,G,E]}),e[67]=E,e[68]=D,e[69]=M,e[70]=F,e[71]=O,e[72]=G,e[73]=q):q=e[73];let V;e[74]!==f||e[75]!==I||e[76]!==B||e[77]!==u||e[78]!==s?(V=u&&t.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 px-4",onClick:()=>p(null),children:t.jsxs("div",{className:"w-full max-w-sm rounded-2xl bg-card border border-border p-5 space-y-4",onClick:Xo,children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-semibold",children:s("meetingPlaces.renameTitle")}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:u.label})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("input",{ref:j,type:"text",value:f,onChange:C=>b(C.target.value.slice(0,Vs)),onKeyDown:C=>{C.key==="Enter"?(C.preventDefault(),B()):C.key==="Escape"&&(C.preventDefault(),p(null))},maxLength:Vs,placeholder:s("meetingPlaces.renamePlaceholder"),className:"w-full h-11 px-3 rounded-xl border border-border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/40","aria-label":s("meetingPlaces.renameTitle")}),t.jsxs("p",{className:"text-[10px] text-muted-foreground text-right",children:[f.length,"/",Vs]})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{type:"button",className:"flex-1 py-2.5 rounded-xl border border-border bg-card text-sm font-medium text-muted-foreground",onClick:()=>p(null),children:s("common.cancel")}),u.alias&&t.jsx("button",{type:"button",className:"flex-1 py-2.5 rounded-xl border border-border bg-card text-sm font-medium text-muted-foreground",onClick:I,children:s("meetingPlaces.renameClear")}),t.jsx("button",{type:"button",className:"flex-1 py-2.5 rounded-xl bg-primary text-primary-foreground text-sm font-medium disabled:opacity-50",disabled:f.trim()===(u.alias??"").trim(),onClick:B,children:s("common.save")})]})]})}),e[74]=f,e[75]=I,e[76]=B,e[77]=u,e[78]=s,e[79]=V):V=e[79];let $;e[80]!==d||e[81]!==L||e[82]!==s?($=d&&t.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 px-4",onClick:()=>v(null),children:t.jsxs("div",{className:"w-full max-w-sm rounded-2xl bg-card border border-border p-5 space-y-4",onClick:Qo,children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-semibold",children:s("meetingPlaces.deleteConfirmTitle")}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:s("meetingPlaces.deleteConfirmDescription")})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{type:"button",className:"flex-1 py-2.5 rounded-xl border border-border bg-card text-sm font-medium text-muted-foreground",onClick:()=>v(null),children:s("common.cancel")}),t.jsx("button",{type:"button",className:"flex-1 py-2.5 rounded-xl bg-destructive text-destructive-foreground text-sm font-medium",onClick:L,children:s("common.delete")})]})]})}),e[80]=d,e[81]=L,e[82]=s,e[83]=$):$=e[83];let K;return e[84]!==q||e[85]!==V||e[86]!==$||e[87]!==R||e[88]!==T?(K=t.jsxs("div",{className:R,children:[T,q,V,$]}),e[84]=q,e[85]=V,e[86]=$,e[87]=R,e[88]=T,e[89]=K):K=e[89],K}function Qo(a){return a.stopPropagation()}function Xo(a){return a.stopPropagation()}function Zo(a){return t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border last:border-b-0",children:[t.jsx("div",{className:"h-9 w-9 rounded-full bg-muted animate-pulse shrink-0"}),t.jsxs("div",{className:"flex-1 space-y-1.5",children:[t.jsx("div",{className:"h-3.5 w-48 bg-muted animate-pulse rounded"}),t.jsx("div",{className:"h-3 w-24 bg-muted animate-pulse rounded"})]})]},a)}function Jo(a){const e=le.c(11),{onBack:n}=a,{t:l}=oe();let s;e[0]!==l?(s=l("profileMenu.language"),e[0]=l,e[1]=s):s=e[1];let r;e[2]!==l?(r=l("profileMenu.languageSubtitle"),e[2]=l,e[3]=r):r=e[3];let i;e[4]!==n||e[5]!==s||e[6]!==r?(i=t.jsx(we,{title:s,subtitle:r,onBack:n}),e[4]=n,e[5]=s,e[6]=r,e[7]=i):i=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"px-4",children:t.jsx(Or,{className:"flex-col"})}),e[8]=c):c=e[8];let x;return e[9]!==i?(x=t.jsxs("div",{className:"flex-1 overflow-y-auto pb-4",children:[i,c]}),e[9]=i,e[10]=x):x=e[10],x}function ec(){const a=le.c(1);let e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("circle",{cx:"12",cy:"12",r:"4"}),t.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41
2M17.66 6.34l1.41-1.41"})]}),a[0]=e):e=a[0],e}function tc(){const a=le.c(1);let e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),a[0]=e):e=a[0],e}function sc(){const a=le.c(1);let e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),t.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),t.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),a[0]=e):e=a[0],e}const nc=[{value:"light",labelKey:"profileMenu.themeLight",descKey:"profileMenu.themeLightDesc",Icon:ec},{value:"dark",labelKey:"profileMenu.themeDark",descKey:"profileMenu.themeDarkDesc",Icon:tc},{value:"system",labelKey:"profileMenu.themeSystem",descKey:"profileMenu.themeSystemDesc",Icon:sc}];function lc(a){const e=le.c(20),{onBack:n}=a,{t:l}=oe(),{theme:s,setTheme:r}=Qn();let i;e[0]!==l?(i=l("profileMenu.theme"),e[0]=l,e[1]=i):i=e[1];let c;e[2]!==l?(c=l("profileMenu.themeSubtitle"),e[2]=l,e[3]=c):c=e[3];let x;e[4]!==n||e[5]!==i||e[6]!==c?(x=t.jsx(we,{title:i,subtitle:c,onBack:n}),e[4]=n,e[5]=i,e[6]=c,e[7]=x):x=e[7];let m;e[8]!==l?(m=l("profileMenu.theme"),e[8]=l,e[9]=m):m=e[9];let o;e[10]!==r||e[11]!==l||e[12]!==s?(o=nc.map(u=>{const{value:p,labelKey:f,descKey:b,Icon:j}=u,h=s===p;return t.jsxs(ne,{role:"radio",tabIndex:0,"aria-checked":h,onClick:()=>r(p),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),r(p))},className:X("p-4 flex items-center gap-3 cursor-pointer transition-colors",h?"border-primary bg-primary/5":"hover:border-primary/40"),children:[t.jsx("div",{className:X("w-10 h-10 rounded-full flex items-center justify-center shrink-0",h?"bg-primary/15 text-primary":"bg-muted text-foreground"),children:t.jsx(j,{})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-sm font-semibold text-foreground",children:l(f)}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:l(b)})]}),t.jsx("span",{"aria-hidden":"true",className:X("w-5 h-5 rounded-full border-2 shrink-0 grid place-items-center transition-colors",h?"border-primary":"border-border"),children:h&&t.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-primary"})})]},p)}),e[10]=r,e[11]=l,e[12]=s,e[13]=o):o=e[13];let d;e[14]!==m||e[15]!==o?(d=t.jsx("div",{className:"px-4 mt-2 flex flex-col gap-2",role:"radiogroup","aria-label":m,children:o}),e[14]=m,e[15]=o,e[16]=d):d=e[16];let v;return e[17]!==x||e[18]!==d?(v=t.jsxs("div",{className:"flex-1 overflow-y-auto pb-4",children:[x,d]}),e[17]=x,e[18]=d,e[19]=v):v=e[19],v}function rc(a){const e=le.c(26),{onBack:n}=a,{t:l}=oe(),{profile:s}=kt(),r=Bi();let i;e[0]!==s?.onboarding_completed_sports?(i=s?.onboarding_completed_sports??[],e[0]=s?.onboarding_completed_sports,e[1]=i):i=e[1];const c=i;let x;e[2]!==l?(x=l("mySports.title",{defaultValue:"Mes sports"}),e[2]=l,e[3]=x):x=e[3];let m;e[4]!==l?(m=l("mySports.subtitle",{defaultValue:"Gère les sports que tu pratiques sur Buddiz"}),e[4]=l,e[5]=m):m=e[5];let o;e[6]!==n||e[7]!==x||e[8]!==m?(o=t.jsx(we,{title:x,subtitle:m,onBack:n}),e[6]=n,e[7]=x,e[8]=m,e[9]=o):o=e[9];let d;e[10]!==r||e[11]!==c||e[12]!==l?(d=c.length===0?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:l("mySports.empty",{defaultValue:"Aucun sport sélectionné"})}):c.map(b=>{const j=qe(b),h=c.length===1;return t.jsxs(ne,{className:"p-4 flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-muted flex items-center justify-center text-xl shrink-0",children:t.jsx(Lt,{sport:j.id,size:22})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-sm font-semibold text-foreground",children:j.label}),h&&t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:l("mySports.onlySportHint",{defaultValue:"Seul sport actif"})})]}),t.jsx("button",{type:"button",disabled:r.busy||h,onClick:()=>{r.start(b)},title:h?l("mySports.cannotRemoveOnly",{defaultValue:"Tu dois garder au moins un sport actif"}):l("mySports.removeAction",{defaultValue:"Retirer"}),className:"text-xs font-semibold px-3 py-2 rounded-lg text-destructive bg-destructive/10 hover:bg-destructive/15 disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer border-0 transition-colors",children:l("mySports.removeAction",{defaultValue:"Retirer"})})]},b)}),e[10]=r,e[11]=c,e[12]=l,e[13]=d):d=e[13];let v;e[14]!==c.length||e[15]!==l?(v=c.length<Hn.length&&t.jsx("p",{className:"text-xs text-muted-foreground mt-4 text-center",children:l("mySports.addOtherHint",{defaultValue:"Pour ajouter un autre sport, change de sport via le sélecteur en haut de l'app."})}),e[14]=c.length,e[15]=l,e[16]=v):v=e[16];let u;e[17]!==d||e[18]!==v?(u=t.jsxs("div",{className:"px-4 mt-2 flex flex-col gap-2",children:[d,v]}),e[17]=d,e[18]=v,e[19]=u):u=e[19];let p;e[20]!==r?(p=t.jsx(Vi,{flow:r}),e[20]=r,e[21]=p):p=e[21];let f;return e[22]!==o||e[23]!==u||e[24]!==p?(f=t.jsxs("div",{className:"flex-1 overflow-y-auto pb-4",children:[o,u,p]}),e[22]=o,e[23]=u,e[24]=p,e[25]=f):f=e[25],f}const ic={primary:"bg-primary/15 text-primary",amber:"bg-amber-500/15 text-amber-600 dar
2k:text-amber-400",sky:"bg-sky-500/15 text-sky-600 dark:text-sky-400",violet:"bg-violet-500/15 text-violet-600 dark:text-violet-400",emerald:"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400",teal:"bg-teal-500/15 text-teal-600 dark:text-teal-400",indigo:"bg-indigo-500/15 text-indigo-600 dark:text-indigo-400",slate:"bg-slate-500/15 text-slate-600 dark:text-slate-300"};function rt(a){const e=le.c(21),{icon:n,label:l,onClick:s,tone:r,value:i,valueTestId:c,badge:x,testId:m}=a,d=ic[r===void 0?"primary":r];let v;e[0]!==d?(v=X("inline-flex h-10 w-10 items-center justify-center rounded-xl",d),e[0]=d,e[1]=v):v=e[1];let u;e[2]!==n||e[3]!==v?(u=t.jsx("span",{className:v,children:n}),e[2]=n,e[3]=v,e[4]=u):u=e[4];let p;e[5]!==l?(p=t.jsx("span",{className:"block text-sm font-semibold leading-snug text-foreground",children:l}),e[5]=l,e[6]=p):p=e[6];let f;e[7]!==i||e[8]!==c?(f=i&&t.jsx("span",{"data-testid":c,className:"mt-0.5 block truncate text-xs text-muted-foreground",children:i}),e[7]=i,e[8]=c,e[9]=f):f=e[9];let b;e[10]!==p||e[11]!==f?(b=t.jsxs("span",{className:"w-full min-w-0",children:[p,f]}),e[10]=p,e[11]=f,e[12]=b):b=e[12];let j;e[13]!==x?(j=x&&t.jsx("span",{"data-testid":"settings-tile-badge",className:"absolute right-3 top-3 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold leading-none text-primary-foreground",children:x}),e[13]=x,e[14]=j):j=e[14];let h;return e[15]!==s||e[16]!==u||e[17]!==b||e[18]!==j||e[19]!==m?(h=t.jsxs("button",{type:"button","data-testid":m,onClick:s,className:"relative flex min-h-[6.5rem] flex-col items-start gap-3 rounded-2xl border border-border bg-card p-3.5 text-left transition-transform active:scale-[0.98] cursor-pointer",children:[u,b,j]}),e[15]=s,e[16]=u,e[17]=b,e[18]=j,e[19]=m,e[20]=h):h=e[20],h}function ac(){const a=le.c(1);let e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[t.jsx("path",{d:"M17 2l4 4-4 4"}),t.jsx("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),t.jsx("path",{d:"M7 22l-4-4 4-4"}),t.jsx("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})]}),a[0]=e):e=a[0],e}function oc(a){const e=le.c(21),{sortie:n,onClick:l}=a,{t:s,i18n:r}=oe();let i,c,x,m,o;if(e[0]!==n.sport||e[1]!==s){const f=qe(n.sport).sessionLabel;i=rt,c="weekly-sortie-tile",e[7]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(ac,{}),e[7]=x):x=e[7],m="primary",o=s("weeklySortie.title",{sessionLabel:f}),e[0]=n.sport,e[1]=s,e[2]=i,e[3]=c,e[4]=x,e[5]=m,e[6]=o}else i=e[2],c=e[3],x=e[4],m=e[5],o=e[6];let d;e[8]!==r.language||e[9]!==n.dayOfWeek?(d=Br(n.dayOfWeek,r.language),e[8]=r.language,e[9]=n.dayOfWeek,e[10]=d):d=e[10];let v;e[11]!==n.timeStart?(v=n.timeStart.slice(0,5),e[11]=n.timeStart,e[12]=v):v=e[12];const u=`${d} · ${v}`;let p;return e[13]!==i||e[14]!==l||e[15]!==c||e[16]!==x||e[17]!==m||e[18]!==o||e[19]!==u?(p=t.jsx(i,{testId:c,icon:x,tone:m,label:o,value:u,valueTestId:"weekly-sortie-tile-value",onClick:l}),e[13]=i,e[14]=l,e[15]=c,e[16]=x,e[17]=m,e[18]=o,e[19]=u,e[20]=p):p=e[20],p}function cc(a){const e=le.c(63),{hasCentres:n,viewAsUser:l,onNavigate:s,onToggleViewAsUser:r}=a,{t:i}=oe();let c;e[0]!==i?(c=i("profileMenu.administration"),e[0]=i,e[1]=c):c=e[1];let x;e[2]!==c?(x=t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2 px-1",children:c}),e[2]=c,e[3]=x):x=e[3];let m;e[4]!==n||e[5]!==s||e[6]!==i?(m=n&&t.jsxs(t.Fragment,{children:[t.jsx(it,{icon:t.jsx(Vr,{}),label:i("profileMenu.createCentre"),onClick:()=>s("createCentre")}),t.jsx(it,{icon:t.jsx(vs,{}),label:i("profileMenu.suggestCentres"),onClick:()=>s("suggestions")})]}),e[4]=n,e[5]=s,e[6]=i,e[7]=m):m=e[7];let o;e[8]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(vs,{}),e[8]=o):o=e[8];let d;e[9]!==i?(d=i("profileMenu.suggestClubs"),e[9]=i,e[10]=d):d=e[10];let v;e[11]!==s?(v=()=>s("clubSuggestions"),e[11]=s,e[12]=v):v=e[12];let u;e[13]!==d||e[14]!==v?(u=t.jsx(it,{icon:o,label:d,onClick:v}),e[13]=d,e[14]=v,e[15]=u):u=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Zn,{}),e[16]=p):p=e[16];let f;e[17]!==i?(f=i("profileMenu.notificationBroadcast"),e[17]=i,e[18]=f):f=e[18];let b;e[19]!==s?(b=()=>s("broadcast"),e[19]=s,e[20]=b):b=e[20];let j;e[21]!==b||e[22]!==f?(j=t.jsx(it,{icon:p,label:f,onClick:b}),e[21]=b,e[22]=f,e[23]=j):j=e[23];let h;e[24]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(Ur,{}),e[24]=h):h=e[24];let y;e[25]!==i?(y=i("profileMenu.manageDeals"),e[25]=i,e[26]=y):y=e[26];let w;e[27]!==s?(w=()=>s("adminDeals"),e[27]=s,e[28]=w):w=e[28];let P;e[29]!==y||e[30]!==w?(P=t.jsx(it,{icon:h,label:y,onClick:w}),e[29]=y,e[30]=w,e[31]=P):P=e[31];let L;e[32]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsx($r,{}),e[32]=L):L=e[32];let g;e[33]!==i?(g=i("profileMenu.partnerEvents"),e[33]=i,e[34]=g):g=e[34];let I;e[35]!==s?(I=()=>s("adminPartnerEvents"),e[35]=s,e[36]=I):I=e[36];let S;e[37]!==g||e[38]!==I?(S=t.jsx(it,{icon:L,label:g,onClick:I}),e[37]=g,e[38]=I,e[39]=S):S=e[39];let B;e[40]===Symbol.for("react.memo_cache_sentinel")?(B=t.jsx(Kr,{}),e[40]=B):B=e[40];let D;e[41]!==i?(D=i("profileMenu.recurringSessions"),e[41]=i,e[42]=D):D=e[42];let M;e[43]!==s?(M=()=>s("adminRecurringSessions"),e[43]=s,e[44]=M):M=e[44];let R;e[45]!==D||e[46]!==M?(R=t.jsx(it,{icon:B,label:D,onClick:M}),e[45]=D,e[46]=M,e[47]=R):R=e[47];let T;e[48]!==r||e[49]!==i||e[50]!==l?(T=r&&t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-border",children:[t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx(Xn,{className:"text-muted-foreground"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium",children:i("profileMenu.viewAsUser")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("profileMenu.hideAdminFunctions")})]})]}),t.jsx("div",{className:`relative w-11 h-6 rounded-full transition-colors cursor-pointer ${l?"bg-amber-500":"bg-muted"}`,onClick:r,children:t.jsx("div",{className:`absolute top-0.5 left-0.5 w-
25 h-5 rounded-full bg-white shadow transition-transform ${l?"translate-x-5":""}`})})]}),e[48]=r,e[49]=i,e[50]=l,e[51]=T):T=e[51];let F;e[52]!==j||e[53]!==P||e[54]!==S||e[55]!==R||e[56]!==T||e[57]!==m||e[58]!==u?(F=t.jsxs(ne,{className:"overflow-hidden",children:[m,u,j,P,S,R,T]}),e[52]=j,e[53]=P,e[54]=S,e[55]=R,e[56]=T,e[57]=m,e[58]=u,e[59]=F):F=e[59];let O;return e[60]!==x||e[61]!==F?(O=t.jsxs("div",{className:"mx-4 mt-4",children:[x,F]}),e[60]=x,e[61]=F,e[62]=O):O=e[62],O}function Ln(){const a=le.c(1);let e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M17 2l4 4-4 4"}),t.jsx("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),t.jsx("path",{d:"M7 22l-4-4 4-4"}),t.jsx("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})]}),a[0]=e):e=a[0],e}function dc(a){const e=le.c(15),{onClick:n,isLast:l,variant:s}=a,r=s===void 0?"row":s,{t:i}=oe(),{enabled:c,loading:x}=ze("recurring_slots_enabled"),{slots:m}=Ui();if(x||!c)return null;if(r==="tile"){let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Ln,{}),e[0]=p):p=e[0];let f;e[1]!==i?(f=i("recurringSlots.profileMenu.label"),e[1]=i,e[2]=f):f=e[2];const b=m.length>0?String(m.length):void 0;let j;return e[3]!==n||e[4]!==f||e[5]!==b?(j=t.jsx(rt,{testId:"profile-rituals-menu-item",icon:p,tone:"amber",label:f,badge:b,onClick:n}),e[3]=n,e[4]=f,e[5]=b,e[6]=j):j=e[6],j}let o;e[7]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(Ln,{}),e[7]=o):o=e[7];let d;e[8]!==i?(d=i("recurringSlots.profileMenu.label"),e[8]=i,e[9]=d):d=e[9];const v=m.length>0?String(m.length):void 0;let u;return e[10]!==l||e[11]!==n||e[12]!==d||e[13]!==v?(u=t.jsx("div",{"data-testid":"profile-rituals-menu-item",children:t.jsx(it,{icon:o,label:d,badge:v,badgeClass:"bg-primary text-primary-foreground",onClick:n,isLast:l})}),e[10]=l,e[11]=n,e[12]=d,e[13]=v,e[14]=u):u=e[14],u}function In(){const a=le.c(1);let e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),t.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),t.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),t.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]}),a[0]=e):e=a[0],e}function uc(a){const e=le.c(13),{onClick:n,isLast:l,variant:s}=a,r=s===void 0?"row":s,{t:i}=oe(),{enabled:c,loading:x}=ze("session_templates_enabled");if(x||!c)return null;if(r==="tile"){let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(In,{}),e[0]=v):v=e[0];let u;e[1]!==i?(u=i("sessionTemplates.manageTitle"),e[1]=i,e[2]=u):u=e[2];let p;return e[3]!==n||e[4]!==u?(p=t.jsx(rt,{testId:"profile-templates-menu-item",icon:v,tone:"sky",label:u,onClick:n}),e[3]=n,e[4]=u,e[5]=p):p=e[5],p}let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(In,{}),e[6]=m):m=e[6];let o;e[7]!==i?(o=i("sessionTemplates.manageTitle"),e[7]=i,e[8]=o):o=e[8];let d;return e[9]!==l||e[10]!==n||e[11]!==o?(d=t.jsx("div",{"data-testid":"profile-templates-menu-item",children:t.jsx(it,{icon:m,label:o,onClick:n,isLast:l})}),e[9]=l,e[10]=n,e[11]=o,e[12]=d):d=e[12],d}const us="grid grid-cols-2 gap-3 sm:grid-cols-3",xt=20,mc={light:"profileMenu.themeLight",dark:"profileMenu.themeDark",system:"profileMenu.themeSystem"};function fc(a){const e=le.c(130),{onBack:n,onOpenNotifications:l,onOpenAlerts:s,onOpenPrivacy:r,onOpenLanguage:i,onOpenTheme:c,onOpenMySports:x,onOpenPassword:m,onOpenSecurity:o,onOpenPayments:d,onOpenMeetingPlaces:v,onOpenMyRituals:u,onOpenMyTemplates:p,onOpenHelp:f,onSignOut:b,onStartTour:j,isRealAdmin:h,viewAsUser:y,onToggleViewAsUser:w,onAdminNavigate:P,hasCentres:L}=a,{t:g,i18n:I}=oe(),{theme:S}=Qn();let B;e[0]!==I?(B=pn.find(Ve=>Ve.code===I.language)?.label??pn[0].label,e[0]=I,e[1]=B):B=e[1];const D=B,{enabled:M}=ze("recurring_slots_enabled"),{enabled:R}=ze("session_templates_enabled"),T=!!u&&M,{sortie:F,refetch:O}=ui(),[G,E]=U.useState(null);let q;e[2]!==F?(q=()=>{F&&E(F.sport)},e[2]=F,e[3]=q):q=e[3];const V=q;let $;e[4]!==O?($=()=>{E(null),O()},e[4]=O,e[5]=$):$=e[5];const K=$,C=!!v||T||R||F!==null;let Q;e[6]!==g?(Q=g("profileMenu.settings",{defaultValue:"Paramètres"}),e[6]=g,e[7]=Q):Q=e[7];let J;e[8]!==n||e[9]!==Q?(J=t.jsx(we,{title:Q,onBack:n}),e[8]=n,e[9]=Q,e[10]=J):J=e[10];let N;e[11]!==g?(N=g("settingsSections.system"),e[11]=g,e[12]=N):N=e[12];let A;e[13]!==N?(A=t.jsx(cs,{children:N}),e[13]=N,e[14]=A):A=e[14];let k;e[15]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(Zn,{size:xt}),e[15]=k):k=e[15];let H;
2e[16]!==g?(H=g("profile.notifications"),e[16]=g,e[17]=H):H=e[17];let ee;e[18]!==l||e[19]!==H?(ee=t.jsx(rt,{icon:k,tone:"amber",label:H,onClick:l}),e[18]=l,e[19]=H,e[20]=ee):ee=e[20];let Y;e[21]===Symbol.for("react.memo_cache_sentinel")?(Y=t.jsx(Qr,{size:xt}),e[21]=Y):Y=e[21];let te;e[22]!==g?(te=g("profileMenu.alerts"),e[22]=g,e[23]=te):te=e[23];let z;e[24]!==s||e[25]!==te?(z=t.jsx(rt,{icon:Y,tone:"violet",label:te,onClick:s}),e[24]=s,e[25]=te,e[26]=z):z=e[26];let se;e[27]===Symbol.for("react.memo_cache_sentinel")?(se=t.jsx(Xr,{size:xt}),e[27]=se):se=e[27];let re;e[28]!==g?(re=g("profileMenu.language"),e[28]=g,e[29]=re):re=e[29];let ie;e[30]!==D||e[31]!==i||e[32]!==re?(ie=t.jsx(rt,{icon:se,tone:"sky",label:re,value:D,valueTestId:"settings-value-language",onClick:i}),e[30]=D,e[31]=i,e[32]=re,e[33]=ie):ie=e[33];let de;e[34]===Symbol.for("react.memo_cache_sentinel")?(de=t.jsx(Zr,{size:xt}),e[34]=de):de=e[34];let ue;e[35]!==g?(ue=g("profileMenu.theme"),e[35]=g,e[36]=ue):ue=e[36];const me=mc[S];let je;e[37]!==g||e[38]!==me?(je=g(me),e[37]=g,e[38]=me,e[39]=je):je=e[39];let he;e[40]!==c||e[41]!==ue||e[42]!==je?(he=t.jsx(rt,{icon:de,tone:"indigo",label:ue,value:je,valueTestId:"settings-value-theme",onClick:c}),e[40]=c,e[41]=ue,e[42]=je,e[43]=he):he=e[43];let fe;e[44]!==x||e[45]!==g?(fe=x&&t.jsx(rt,{icon:t.jsx(zr,{size:xt}),label:g("profileMenu.mySports",{defaultValue:"Mes sports"}),onClick:x}),e[44]=x,e[45]=g,e[46]=fe):fe=e[46];let Ue;e[47]!==ee||e[48]!==z||e[49]!==ie||e[50]!==he||e[51]!==fe?(Ue=t.jsxs("div",{className:us,children:[ee,z,ie,he,fe]}),e[47]=ee,e[48]=z,e[49]=ie,e[50]=he,e[51]=fe,e[52]=Ue):Ue=e[52];let ve;e[53]!==Ue||e[54]!==A?(ve=t.jsxs("section",{className:"mx-4 mt-4",children:[A,Ue]}),e[53]=Ue,e[54]=A,e[55]=ve):ve=e[55];let Ge;e[56]!==g?(Ge=g("settingsSections.account"),e[56]=g,e[57]=Ge):Ge=e[57];let Ce;e[58]!==Ge?(Ce=t.jsx(cs,{children:Ge}),e[58]=Ge,e[59]=Ce):Ce=e[59];let Je;e[60]===Symbol.for("react.memo_cache_sentinel")?(Je=t.jsx(Bn,{size:xt}),e[60]=Je):Je=e[60];let at;e[61]!==g?(at=g("profileMenu.security"),e[61]=g,e[62]=at):at=e[62];let Ae;e[63]!==o||e[64]!==at?(Ae=t.jsx(rt,{icon:Je,tone:"emerald",label:at,onClick:o}),e[63]=o,e[64]=at,e[65]=Ae):Ae=e[65];let He;e[66]===Symbol.for("react.memo_cache_sentinel")?(He=t.jsx(Yn,{size:xt}),e[66]=He):He=e[66];let Ee;e[67]!==g?(Ee=g("profileMenu.privacyAvailability"),e[67]=g,e[68]=Ee):Ee=e[68];let Xe;e[69]!==r||e[70]!==Ee?(Xe=t.jsx(rt,{icon:He,tone:"teal",label:Ee,onClick:r}),e[69]=r,e[70]=Ee,e[71]=Xe):Xe=e[71];let Ie;e[72]===Symbol.for("react.memo_cache_sentinel")?(Ie=t.jsx(Jr,{size:xt}),e[72]=Ie):Ie=e[72];let De;e[73]!==g?(De=g("profileSub.changePassword"),e[73]=g,e[74]=De):De=e[74];let Ke;e[75]!==m||e[76]!==De?(Ke=t.jsx(rt,{icon:Ie,tone:"slate",label:De,onClick:m}),e[75]=m,e[76]=De,e[77]=Ke):Ke=e[77];let _e;e[78]!==d||e[79]!==g?(_e=d&&t.jsx(rt,{icon:t.jsx(qr,{size:xt}),tone:"violet",label:g("connectPayments.menuLabel"),onClick:d}),e[78]=d,e[79]=g,e[80]=_e):_e=e[80];let Re;e[81]!==Ae||e[82]!==Xe||e[83]!==Ke||e[84]!==_e?(Re=t.jsxs("div",{className:us,children:[Ae,Xe,Ke,_e]}),e[81]=Ae,e[82]=Xe,e[83]=Ke,e[84]=_e,e[85]=Re):Re=e[85];let Fe;e[86]!==Ce||e[87]!==Re?(Fe=t.jsxs("section",{className:"mx-4 mt-6",children:[Ce,Re]}),e[86]=Ce,e[87]=Re,e[88]=Fe):Fe=e[88];let Te;e[89]!==v||e[90]!==u||e[91]!==p||e[92]!==V||e[93]!==C||e[94]!==g||e[95]!==F?(Te=C&&t.jsxs("section",{className:"mx-4 mt-6",children:[t.jsx(cs,{children:g("settingsSections.content")}),t.jsxs("div",{className:us,children:[v&&t.jsx(rt,{icon:t.jsx(Gr,{size:xt}),label:g("profileMenu.meetingPlaces"),onClick:v}),F&&t.jsx(oc,{sortie:F,onClick:V}),u&&t.jsx(dc,{onClick:u,variant:"tile"}),t.jsx(uc,{onClick:p,variant:"tile"})]})]}),e[89]=v,e[90]=u,e[91]=p,e[92]=V,e[93]=C,e[94]=g,e[95]=F,e[96]=Te):Te=e[96];let Me;e[97]!==K||e[98]!==G?(Me=G&&t.jsx(Ai,{fallbackSport:G,onClose:K}),e[97]=K,e[98]=G,e[99]=Me):Me=e[99];let Pe;e[100]!==f||e[101]!==j||e[102]!==g?(Pe=(f||j)&&t.jsxs("section",{className:"mx-4 mt-6",children:[t.jsx(cs,{children:g("settingsSections.help")}),t.jsxs("div",{className:us,children:[f&&t.jsx(rt,{icon:t.jsx(Hr,{size:xt}),tone:"sky",label:g("profileSub.help"),onClick:f}),j&&t.jsx(rt,{icon:t.jsx(Wr,{size:xt}),tone:"violet",label:g("profileMenu.startTour"),onClick:j})]})]}),e[100]=f,e[101]=j,e[102]=g,e[103]=Pe):Pe=e[103];let $e;e[104]!==h||e[105]!==w||e[106]!==g||e[107]!==y?($e=h&&y&&w&&t.jsx("div",{className:"mx-4 mt-5",children:t.jsx(ne,{className:"overflow-hidden",children:t.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx(Xn,{className:"text-muted-foreground"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium",children:g("profileMenu.viewAsUser")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:g("profileMenu.hideAdminFunctions")})]})]}),t.jsx("button",{type:"button",onClick:w,className:"relative w-11 h-6 rounded-full transition-colors cursor-pointer bg-amber-500 border-0","aria-pressed":y,"aria-label":g("profileMenu.viewAsUser"),children:t.jsx("span",{className:"absolute top-0.5 left-0.5 w-
25 h-5 rounded-full bg-white shadow transition-transform translate-x-5"})})]})})}),e[104]=h,e[105]=w,e[106]=g,e[107]=y,e[108]=$e):$e=e[108];let Le;e[109]!==L||e[110]!==h||e[111]!==P||e[112]!==w||e[113]!==y?(Le=h&&!y&&P&&t.jsx(cc,{hasCentres:!!L,viewAsUser:!1,onNavigate:P,onToggleViewAsUser:w}),e[109]=L,e[110]=h,e[111]=P,e[112]=w,e[113]=y,e[114]=Le):Le=e[114];let We;e[115]!==b||e[116]!==g?(We=b&&t.jsx("div",{className:"mx-4 mt-8",children:t.jsxs("button",{type:"button",onClick:b,className:"flex w-full items-center justify-center gap-2 rounded-2xl border border-destructive/25 bg-destructive/5 py-3.5 cursor-pointer transition-transform active:scale-[0.99]",children:[t.jsx(Yr,{className:"text-destructive"}),t.jsx("span",{className:"text-sm font-semibold text-destructive",children:g("profileSub.signOut")})]})}),e[115]=b,e[116]=g,e[117]=We):We=e[117];let Oe;e[118]!==ve||e[119]!==Fe||e[120]!==Te||e[121]!==Me||e[122]!==Pe||e[123]!==$e||e[124]!==Le||e[125]!==We?(Oe=t.jsxs("div",{children:[ve,Fe,Te,Me,Pe,$e,Le,We]}),e[118]=ve,e[119]=Fe,e[120]=Te,e[121]=Me,e[122]=Pe,e[123]=$e,e[124]=Le,e[125]=We,e[126]=Oe):Oe=e[126];let Be;return e[127]!==Oe||e[128]!==J?(Be=t.jsxs("div",{className:"flex-1 overflow-y-auto pb-4",children:[J,Oe]}),e[127]=Oe,e[128]=J,e[129]=Be):Be=e[129],Be}const Tn=80;function xc(a){const e=le.c(52),{userId:n,onBack:l,onUseTemplate:s}=a,{t:r}=oe(),{templates:i,loading:c,rename:x,remove:m}=mi(n,!0),{clubs:o}=$i(n),{clubs:d}=fi(n),v=new Map(o.map(yc)),u=new Set(d.map(vc)),[p,f]=U.useState(null),[b,j]=U.useState(null),[h,y]=U.useState("");let w;e[0]!==y||e[1]!==j?(w=A=>{y(A.name),j(A)},e[0]=y,e[1]=j,e[2]=w):w=e[2];const P=w,L=i.filter(gc),g=new Map;for(const A of i)if(A.clubId!=null){const k=g.get(A.clubId)??[];k.push(A),g.set(A.clubId,k)}const I=[...g.entries()].map(A=>{const[k,H]=A;return{clubId:k,name:v.get(k)??r("sessionTemplates.clubTemplates"),templates:H,canManage:u.has(k)}});let S;e[3]!==p||e[4]!==m||e[5]!==f||e[6]!==r?(S=async()=>{if(p==null)return;const A=p;f(null);try{await m(A),Z.success(r("sessionTemplates.deleted"))}catch{Z.error(r("sessionTemplates.loadError"))}},e[3]=p,e[4]=m,e[5]=f,e[6]=r,e[7]=S):S=e[7];const B=S;let D;e[8]!==h||e[9]!==x||e[10]!==b||e[11]!==j||e[12]!==r?(D=async()=>{if(!b)return;const A=h.trim();if(A.length<1||A===b.name){j(null);return}const k=b;j(null);try{await x(k.id,A),Z.success(r("sessionTemplates.renamed"))}catch{Z.error(r("sessionTemplates.loadError"))}},e[8]=h,e[9]=x,e[10]=b,e[11]=j,e[12]=r,e[13]=D):D=e[13];const M=D;let R;e[14]!==s||e[15]!==P||e[16]!==f||e[17]!==r?(R=(A,k)=>t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border last:border-b-0",children:[t.jsxs("button",{type:"button",className:"flex items-center gap-3 flex-1 min-w-0 text-left",onClick:()=>s(A),children:[t.jsx("div",{className:"h-9 w-9 rounded-full bg-primary/10 flex items-center justify-center text-base shrink-0",children:t.jsx(Lt,{sport:A.sport,size:20})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:A.name}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:[r(`sport.${A.sport}.label`)," · ",r("sessionTemplates.startFrom")]})]})]}),k&&t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button","aria-label":r("sessionTemplates.rename"),className:"p-2 text-muted-foreground hover:text-primary transition-colors shrink-0",onClick:()=>P(A),children:t.jsx(vs,{size:16})}),t.jsx("button",{type:"button","aria-label":r("sessionTemplates.delete"),className:"p-2 text-muted-foreground hover:text-destructive transition-colors shrink-0",onClick:()=>f(A.id),children:t.jsx(qs,{size:16})})]})]},A.id),e[14]=s,e[15]=P,e[16]=f,e[17]=r,e[18]=R):R=e[18];const T=R,F="flex-1 overflow-y-auto pb-4";let O;e[19]!==r?(O=r("sessionTemplates.manageTitle"),e[19]=r,e[20]=O):O=e[20];let G;e[21]!==l||e[22]!==O?(G=t.jsx(we,{title:O,onBack:l}),e[21]=l,e[22]=O,e[23]=G):G=e[23];const E="px-4 flex flex-col gap-4";let q;e[24]!==c?(q=c&&t.jsx(ne,{className:"overflow-hidden",children:[1,2].map(hc)}),e[24]=c,e[25]=q):q=e[25];let V;e[26]!==c||e[27]!==r||e[28]!==i?(V=!c&&i.length===0&&t.jsxs(ne,{className:"p-6 text-center",children:[t.jsx("p",{className:"text-sm font-medium",children:r("sessionTemplates.empty")}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:r("sessionTemplates.emptyHint")})]}),e[26]=c,e[27]=r,e[28]=i,e[29]=V):V=e[29];const $=!c&&L.length>0&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-xs font-semibold text-muted-foreground px-1",children:r("sessionTemplates.myTemplates")}
2),t.jsx(ne,{className:"overflow-hidden",children:L.map(A=>T(A,!0))})]}),K=!c&&I.map(A=>t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-xs font-semibold text-muted-foreground px-1",children:A.name}),t.jsx(ne,{className:"overflow-hidden",children:A.templates.map(k=>T(k,A.canManage))})]},A.clubId));let C;e[30]!==q||e[31]!==V||e[32]!==$||e[33]!==K?(C=t.jsxs("div",{className:E,children:[q,V,$,K]}),e[30]=q,e[31]=V,e[32]=$,e[33]=K,e[34]=C):C=e[34];let Q;e[35]!==M||e[36]!==h||e[37]!==b||e[38]!==y||e[39]!==j||e[40]!==r?(Q=b&&t.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 px-4",onClick:()=>j(null),children:t.jsxs("div",{className:"w-full max-w-sm rounded-2xl bg-card border border-border p-5 space-y-4",onClick:bc,children:[t.jsx("p",{className:"text-sm font-semibold",children:r("sessionTemplates.rename")}),t.jsx("input",{autoFocus:!0,type:"text",value:h,onChange:A=>y(A.target.value.slice(0,Tn)),onKeyDown:A=>{A.key==="Enter"?(A.preventDefault(),M()):A.key==="Escape"&&(A.preventDefault(),j(null))},maxLength:Tn,placeholder:r("sessionTemplates.renamePrompt"),className:"w-full h-11 px-3 rounded-xl border border-border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/40","aria-label":r("sessionTemplates.rename")}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{type:"button",className:"flex-1 py-2.5 rounded-xl border border-border bg-card text-sm font-medium text-muted-foreground",onClick:()=>j(null),children:r("sessionTemplates.cancel")}),t.jsx("button",{type:"button",className:"flex-1 py-2.5 rounded-xl bg-primary text-primary-foreground text-sm font-medium disabled:opacity-50",disabled:h.trim().length<1||h.trim()===b.name,onClick:M,children:r("sessionTemplates.save")})]})]})}),e[35]=M,e[36]=h,e[37]=b,e[38]=y,e[39]=j,e[40]=r,e[41]=Q):Q=e[41];let J;e[42]!==p||e[43]!==B||e[44]!==f||e[45]!==r?(J=p!=null&&t.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 px-4",onClick:()=>f(null),children:t.jsxs("div",{className:"w-full max-w-sm rounded-2xl bg-card border border-border p-5 space-y-4",onClick:pc,children:[t.jsx("p",{className:"text-sm font-semibold",children:r("sessionTemplates.deleteConfirm")}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{type:"button",className:"flex-1 py-2.5 rounded-xl border border-border bg-card text-sm font-medium text-muted-foreground",onClick:()=>f(null),children:r("sessionTemplates.cancel")}),t.jsx("button",{type:"button",className:"flex-1 py-2.5 rounded-xl bg-destructive text-destructive-foreground text-sm font-medium",onClick:B,children:r("sessionTemplates.delete")})]})]})}),e[42]=p,e[43]=B,e[44]=f,e[45]=r,e[46]=J):J=e[46];let N;return e[47]!==C||e[48]!==Q||e[49]!==J||e[50]!==G?(N=t.jsxs("div",{className:F,children:[G,C,Q,J]}),e[47]=C,e[48]=Q,e[49]=J,e[50]=G,e[51]=N):N=e[51],N}function pc(a){return a.stopPropagation()}function bc(a){return a.stopPropagation()}function hc(a){return t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border last:border-b-0",children:[t.jsx("div",{className:"h-9 w-9 rounded-full bg-muted animate-pulse shrink-0"}),t.jsxs("div",{className:"flex-1 space-y-1.5",children:[t.jsx("div",{className:"h-3.5 w-40 bg-muted animate-pulse rounded"}),t.jsx("div",{className:"h-3 w-24 bg-muted animate-pulse rounded"})]})]},a)}function gc(a){return a.clubId===null}function vc(a){return a.id}function yc(a){return[a.id,a.name]}const nd=U.forwardRef(function(e,n){const l=le.c(122),{terrains:s,courtsByTerrainId:r,currentUser:i,onStartTour:c,isRealAdmin:x,viewAsUser:m,onToggleViewAsUser:o,initialSubScreen:d,onOpenMyRituals:v,onCreateFromTemplate:u,onSubScreenChange:p,onSignOut:f,onBack:b,exitOnRootBack:j}=e,h=j===void 0?!1:j,y=d??"main";let w;l[0]!==y?(w=[y],l[0]=y,l[1]=w):w=l[1];const[P,L]=U.useState(w),g=P[P.length-1];let I;l[2]===Symbol.for("react.memo_cache_sentinel")?(I=N=>{L(A=>A[A.length-1]===N?A:[...A,N])},l[2]=I):I=l[2];const S=I,B=N=>{L([N])};let D;l[3]!==h||l[4]!==P.length||l[5]!==g?(D=()=>{if(P.length>1)return L(jc),!0;if(h)return!1;const N=ei[g];return N===null?!1:(L([N]),!0)},l[3]=h,l[4]=P.length,l[5]=g,l[6]=D):D=l[6];const M=D,[R,T]=U.useState(d);d!==R&&(T(d),d&&B(d));const{enabled:F}=ze("paid_sessions");let O,G;l[7]===Symbol.for("react.memo_cache_sentinel")?(O=()=>{const N=()=>S("identityVerification");return window.addEventListener("buddiz:open-identity-verification",N),(
2)=>window.removeEventListener("buddiz:open-identity-verification",N)},G=[S],l[7]=O,l[8]=G):(O=l[7],G=l[8]),U.useEffect(O,G);let E,q;l[9]!==p||l[10]!==P||l[11]!==g?(E=()=>{p?.(g,ti(P))},q=[g,P,p],l[9]=p,l[10]=P,l[11]=g,l[12]=E,l[13]=q):(E=l[12],q=l[13]),U.useEffect(E,q);let V,$;l[14]!==M?(V=()=>({goBack:M}),$=[M],l[14]=M,l[15]=V,l[16]=$):(V=l[15],$=l[16]),U.useImperativeHandle(n,V,$);let K;l[17]!==M||l[18]!==b?(K=()=>{M()||b?.()},l[17]=M,l[18]=b,l[19]=K):K=l[19];const C=K;let Q;l[20]===Symbol.for("react.memo_cache_sentinel")?(Q=qe(Ze()),l[20]=Q):Q=l[20];const J=Q;if(!i){let N;return l[21]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"h-6 w-6 border-2 border-primary border-t-transparent rounded-full animate-spin"})}),l[21]=N):N=l[21],N}if(g==="personalInfo"){let N;return l[22]!==i||l[23]!==C?(N=t.jsx(na,{currentUser:i,onBack:C}),l[22]=i,l[23]=C,l[24]=N):N=l[24],N}if(g==="security"){let N;l[25]===Symbol.for("react.memo_cache_sentinel")?(N=()=>S("identityVerification"),l[25]=N):N=l[25];let A;return l[26]!==i||l[27]!==C?(A=t.jsx(pa,{currentUser:i,onBack:C,onOpenIdentityVerification:N}),l[26]=i,l[27]=C,l[28]=A):A=l[28],A}if(g==="privacy"){let N;return l[29]!==i||l[30]!==C?(N=t.jsx(ga,{currentUser:i,onBack:C}),l[29]=i,l[30]=C,l[31]=N):N=l[31],N}if(g==="sportProfile"){let N;return l[32]!==i||l[33]!==C?(N=t.jsx(Na,{currentUser:i,onBack:C}),l[32]=i,l[33]=C,l[34]=N):N=l[34],N}if(g==="password"){let N;return l[35]!==C?(N=t.jsx(Ki,{onBack:C}),l[35]=C,l[36]=N):N=l[36],N}if(g==="notifications"){let N;return l[37]!==i||l[38]!==C?(N=t.jsx(Wi,{currentUser:i,onBack:C}),l[37]=i,l[38]=C,l[39]=N):N=l[39],N}if(g==="alerts"){let N;return l[40]!==i||l[41]!==C?(N=t.jsx(Qi,{currentUser:i,onBack:C}),l[40]=i,l[41]=C,l[42]=N):N=l[42],N}if(g==="support"){let N;return l[43]!==C?(N=t.jsx(jo,{onBack:C}),l[43]=C,l[44]=N):N=l[44],N}if(g==="helpHub"){let N;l[45]===Symbol.for("react.memo_cache_sentinel")?(N=()=>S("support"),l[45]=N):N=l[45];let A;return l[46]!==C?(A=t.jsx(Co,{onBack:C,onOpenSupport:N}),l[46]=C,l[47]=A):A=l[47],A}if(g==="identityVerification"){let N;return l[48]!==i||l[49]!==C?(N=t.jsx(qo,{currentUser:i,onBack:C}),l[48]=i,l[49]=C,l[50]=N):N=l[50],N}if(g==="suggestions"){let N;return l[51]!==C?(N=t.jsx(Sa,{onBack:C}),l[51]=C,l[52]=N):N=l[52],N}if(g==="clubSuggestions"){let N;return l[53]!==C?(N=t.jsx(ka,{onBack:C}),l[53]=C,l[54]=N):N=l[54],N}if(g==="createCentre"){const N=i.id;let A;l[55]===Symbol.for("react.memo_cache_sentinel")?(A=Ze(),l[55]=A):A=l[55];let k;return l[56]!==i.id||l[57]!==C?(k=t.jsx(xi,{userId:N,onBack:C,sport:A,isAdmin:!0}),l[56]=i.id,l[57]=C,l[58]=k):k=l[58],k}if(g==="broadcast"){let N;return l[59]!==C?(N=t.jsx(Ea,{onBack:C}),l[59]=C,l[60]=N):N=l[60],N}if(g==="adminDeals"){let N;return l[61]!==C?(N=t.jsx(to,{onBack:C}),l[61]=C,l[62]=N):N=l[62],N}if(g==="adminPartnerEvents"){let N;return l[63]!==C?(N=t.jsx(no,{onBack:C}),l[63]=C,l[64]=N):N=l[64],N}if(g==="adminRecurringSessions"){let N;return l[65]!==r||l[66]!==i.gender||l[67]!==i.id||l[68]!==C||l[69]!==s?(N=t.jsx(go,{onBack:C,terrains:s,courtsByTerrainId:r,userId:i.id,userGender:i.gender}),l[65]=r,l[66]=i.gender,l[67]=i.id,l[68]=C,l[69]=s,l[70]=N):N=l[70],N}if(g==="flexShop"){const N=i.equippedCardFrame??null,A=i.equippedCardTitle??null;let k;return l[71]!==i.id||l[72]!==C||l[73]!==N||l[74]!==A?(k=t.jsx(Ta,{userId:i.id,initialEquippedFrame:N,initialEquippedTitle:A,onBack:C}),l[71]=i.id,l[72]=C,l[73]=N,l[74]=A,l[75]=k):k=l[75],k}if(g==="referral"){let N;return l[76]!==i.id||l[77]!==C?(N=t.jsx(Xa,{userId:i.id,onBack:C}),l[76]=i.id,l[77]=C,l[78]=N):N=l[78],N}if(g==="organizerSpace"){let N;return l[79]!==i.id||l[80]!==C?(N=t.jsx(ca,{userId:i.id,onBack:C}),l[79]=i.id,l[80]=C,l[81]=N):N=l[81],N}if(g==="connectPayments"){let N;return l[82]!==i.id||l[83]!==C?(N=t.jsx(xa,{userId:i.id,onBack:C}),l[82]=i.id,l[83]=C,l[84]=N):N=l[84],N}if(g==="myTemplates"){let N;l[85]!==u?(N=k=>u?.(k),l[85]=u,l[86]=N):N=l[86];let A;return l[87]!==i.id||l[88]!==C||l[89]!==N?(A=t.jsx(xc,{userId:i.id,onBack:C,onUseTemplate:N}),l[87]=i.id,l[88]=C,l[89]=N,l[90]=A):A=l[90],A}if(g==="meetingPlaces"){let N;return l[91]!==i.id||l[92]!==C?(N=t.jsx(Yo,{userId:i.id,onBack:C}),l[91]=i.id,l[92]=C,l[93]=N):N=l[93],N}if(g==="language"){let N;return l[94]!==C?(N=t.jsx(Jo,{onBack:C}),l[94]=C,l[95]=N):N=l[95],N}if(g==="theme"){let N;return l[96]!==C?(N=t.jsx(lc,{onBack:C}),l[96]=C,l[97]=N):N=l[97],N}if(g==="mySports"){let N;return l[98]!==C?(N=t.jsx(rc,{onBack:C}),l[98]=C,l[99]=N):N=l[99],N}if(g==="settings"){let N,A,k,H,ee,Y,te;l[100]===Symbol.for("react.memo_cache_sentinel")?(N=()=>S("notifications"),A=()=>S("alerts"),k=()=>S("privacy"),H=()=>S("language"),ee=()=>S("theme"),Y=()=>S("password"),te=()=>S("security"),l[100]=N,l[101]=A,l[102]=k,l[103]=H,l[104]=ee,l[105]=Y,l[106]=te):(N=l[100],A=l[101],k=l[102],H=l[103],ee=l[104],Y=l[105],te=l[106]);let z;l[107]!==F?(z=F?()=>S("connectPayments"):void 0,l[107]=F,l[108]=z):z=l[108];let se;l[109]===Symbol.for("react.memo_cache_sentinel")?(se=J.modes.hasSavedMeetingPlaces?()=>S("meetingPlaces"):void 0,l[109]=se):se=l[109];let re,ie;l[110]===Symbol.for("react.memo_cache_sentinel")?(re=()=>S("myTemplates"),ie=()=>S("helpHub"),l[110]=re,l[111]=ie):(re=l[110],ie=l[111]);let de;l[112]===Symbol.for("react.memo_cache_sentinel")?(de=me=>S(me),l[112]=de):de=l[112];let ue;return l[113]!==C||l[114]!==x||l[115]!==v||l[116]!==f||l[117]!==c||l[118]!==o||l[119]!==z||l[120]!==m?(ue=t.jsx(fc,{onBack:C,onOpenNotifications:N,onOpenAlerts:A,onOpenPrivacy:k,onOpenLanguage:H,onOpenTheme:ee,onOpenPassword:Y,onOpenSecurity:te,onOpenPayments:z,onOpenMeetingPlaces:se,onOpenMyRituals:v,onOpenMyTemplates:re,onOpenHelp:ie,onStartTour:c,onSignOut:f,isRealAdmin:x,viewAsUser:m,onToggleViewAsUser:o,onAdm
2inNavigate:de,hasCentres:J.hasCentres}),l[113]=C,l[114]=x,l[115]=v,l[116]=f,l[117]=c,l[118]=o,l[119]=z,l[120]=m,l[121]=ue):ue=l[121],ue}return null});function jc(a){return a.slice(0,-1)}export{nd as ProfileScreen,nd 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.