PageSourceSearch

https://handballscore.onrender.com/assets/TeamTrainings-nWjq17vU.js

js handballscore.onrender.com collected 2026-10-03 11:41:37 UTC 20,745 bytes, 1 lines download raw bytes

1import{D as it,c as Ze,r as Ke,j as s,B as xe,m as nt,T as ot,n as ct,E as Qe,h as rt,o as at,k as Je,u as mt}from"./index-ItQ9IC6Y.js";import{T as dt}from"./Title-ClonZBwO.js";import{C as Re}from"./checkbox-C_Awn3dd.js";import{D as ft,a as ht,b as pt,d as gt,e as ut,c as xt,f as yt}from"./dialog-D1D4aVsP.js";import{I as H}from"./input-BdKiMncn.js";import{L as I}from"./label-HDd5d1dI.js";import{d as jt,a as Tt,b as vt,c as bt,S as _t}from"./select-AOAhITFU.js";import{T as Nt}from"./textarea-BbcXF0y9.js";import{D as He,f as St}from"./Talent-BCLBRHPO.js";import{P as Ct}from"./plus-DyAwvYjr.js";import{B as Xe}from"./badge-DIF09fSn.js";import{C as et,c as tt}from"./card-F8Asu6zr.js";import{u as kt}from"./useAllCategories-DCQeMiUi.js";import{g as Ft}from"./CourtService-DySibYBp.js";import{g as It,S as wt,a as Dt}from"./trainingSessions-D-x6O0Y6.js";import{P as Pt,T as Ot}from"./trash-Cl7nYSfv.js";import{M as At}from"./map-pin-Dgqno8Jr.js";import{C as Bt}from"./clock-_h4cKJXD.js";import"./index-DXh-VhcJ.js";import"./check-CeidorNy.js";import"./index-Iboqi5h0.js";import"./index-BUz41SNz.js";import"./index-BdQq_4o_.js";import"./index-Cy4V9Xey.js";import"./chevron-down-7FGeOVyw.js";import"./CategoriesService-CWbR5HtF.js";const $t=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]],Et=it("calendar-check",$t),st={categoryIds:[],placeId:"",daysOfWeek:[1],startTime:"",endTime:"",customTimes:!1,sessionTimes:{},acceptsBeginners:!1,trialClassAvailable:!1,monthlyFee:"",contactName:"",contactPhone:"",notes:""};function Wt(t){const e=Ze.c(165),{open:m,onOpenChange:u,initialData:n,categories:x,courts:f,onSubmit:v,isSubmitting:w}=t,[a,r]=Ke.useState(st);let p,b;e[0]!==n||e[1]!==m?(p=()=>{if(!m)return;if(!n){r(st);return}const l=n.sessions.map(Rt),i=l[0],z=l.every(F=>F.start===i?.start&&F.end===i?.end);r({categoryIds:n.category_ids,placeId:n.place_id,daysOfWeek:l.map(Mt),startTime:i?.start??"",endTime:i?.end??"",customTimes:!z,sessionTimes:Object.fromEntries(l.map(Lt)),acceptsBeginners:n.accepts_beginners,trialClassAvailable:n.trial_class_available,monthlyFee:n.monthly_fee!=null?String(n.monthly_fee):"",contactName:n.contact_name,contactPhone:n.contact_phone,notes:n.notes})},b=[m,n],e[0]=n,e[1]=m,e[2]=p,e[3]=b):(p=e[2],b=e[3]),Ke.useEffect(p,b);let D;e[4]===Symbol.for("react.memo_cache_sentinel")?(D=l=>{r(i=>({...i,daysOfWeek:i.daysOfWeek.includes(l)?i.daysOfWeek.filter(z=>z!==l):[...i.daysOfWeek,l]}))},e[4]=D):D=e[4];const P=D;let _;e[5]===Symbol.for("react.memo_cache_sentinel")?(_=l=>{r(i=>({...i,customTimes:l,sessionTimes:l?Object.fromEntries(i.daysOfWeek.map(z=>[z,i.sessionTimes[z]??{start:i.startTime,end:i.endTime}])):i.sessionTimes}))},e[5]=_):_=e[5];const B=_;let N;e[6]!==a.endTime||e[7]!==a.sessionTimes||e[8]!==a.startTime?(N=l=>a.sessionTimes[l]??{start:a.startTime,end:a.endTime},e[6]=a.endTime,e[7]=a.sessionTimes,e[8]=a.startTime,e[9]=N):N=e[9];const h=N;let q;e[10]===Symbol.for("react.memo_cache_sentinel")?(q=(l,i,z)=>{r(F=>{const Ve=F.sessionTimes[l]??{start:F.startTime,end:F.endTime};return{...F,sessionTimes:{...F.sessionTimes,[l]:{...Ve,[i]:z}}}})},e[10]=q):q=e[10];const M=q;let O,$,E,S,C,y,j,k,W,T,A,g,d,L,R,K;if(e[11]!==x||e[12]!==f||e[13]!==a.acceptsBeginners||e[14]!==a.categoryIds||e[15]!==a.contactName||e[16]!==a.contactPhone||e[17]!==a.customTimes||e[18]!==a.daysOfWeek||e[19]!==a.endTime||e[20]!==a.monthlyFee||e[21]!==a.notes||e[22]!==a.placeId||e[23]!==a.startTime||e[24]!==a.trialClassAvailable||e[25]!==n||e[26]!==u||e[27]!==v||e[28]!==m||e[29]!==h){const l=[...a.daysOfWeek].sort(qt);let i;e[46]===Symbol.for("react.memo_cache_sentinel")?(i=o=>{r(c=>({...c,categoryIds:c.categoryIds.includes(o)?c.categoryIds.filter(Me=>Me!==o):[...c.categoryIds,o]}))},e[46]=i):i=e[46];const z=i;let F;e[47]!==h?(F=o=>h(o).start!=="",e[47]=h,e[48]=F):F=e[48];const Ve=l.every(F);E=a.categoryIds.length>0&&a.placeId!==""&&l.length>0&&Ve,S=async()=>{E&&await v({category_ids:a.categoryIds,place_id:a.placeId,sessions:l.map(o=>{const c=a.customTimes?h(o):{start:a.startTime,end:a.endTime};return{day_of_week:o,start_time:c.start,end_time:c.end}}),accepts_beginners:a.acceptsBeginners,trial_class_available:a.trialClassAvailable,monthly_fee:a.monthlyFee===""?null:Number(a.monthlyFee),contact_name:a.contactName,contact_phone:a.contactPhone,notes:a.notes})},$=ft,A=m,g=u;let Oe;e[49]===Symbol.for("react.memo_cache_sentinel")?(Oe=s.jsx(nt,{asChild:!0,children:s.jsx(ht,{asChild:!0,children:s.jsx(xe,{className:"fixed bottom-6 right-6 md:bottom-8 md:right-8 z-50 rounded-full w-14 h-14 shadow-lg text-white cursor-pointer hover:scale-105 transition-all duration-300 p-0",children:s.jsx(Ct,{className:"w-6 h-6"})})})}),e[49]=Oe):Oe=e[49],e[50]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsxs(ot,{children:[Oe,s.jsx(ct,{side:"left",children:s.jsx("p",{children:"Agregar horario"})})]}),e[50]=d):d=e[50],O=pt,W="max-h-[90vh] overflow-y-auto";const Ye=n?"Editar horario":"Nuevo horario";let me;e[51]!==Ye?(me=s.jsx(gt,{children:Ye}),e[51]=Ye,e[52]=me):me=e[52];let Ae;e[53]===Symbol.for("react.memo_cache_sentinel")?(Ae=s.jsx(ut,{children:"Un entrenamiento agrupa las categorías que lo comparten, la cancha y todos sus días."}),e[53]=Ae):Ae=e[53],e[54]!==me?(T=s.jsxs(xt,{children:[me,Ae]}),e[54]=me,e[55]=T):T=e[55],C="flex flex-col gap-4";let Be;e[56]===Symbol.for("react.memo_cache_sentinel")?(Be=s.jsx(I,{children:"Categorías"}),e[56]=Be):Be=e[56];let de;if(e[57]!==x||e[58]!==a.categoryIds){let o;e[60]!==a.categoryIds?(o=c=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Re,{id:`category-${c.id}`,checked:a.categoryIds.includes(c.id??""),onCheckedChange:()=>z(c.id??"")}),s.jsx(I,{htmlFor:`category-${c.id}`,className:"text-sm font-normal",children:St(c.name,c.gender)})]},c.id),e[60]=a.categoryIds,e[61]=o):o=e[61],de=x.map(o),e[57]=x,e[58]=a.categoryIds,e[59]=de}else de=e[59];let fe;e[62]!==de?(fe=s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 rounded-md border p-3 max-h-48 overflow-y-auto",children:de}),e[62]=de,e[63]=fe):fe=e[63];let $e;e[64]===Symbol.for("react.memo_cache_sentinel")?($e=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Todas las que entrenen juntas, en esta cancha y estos horarios. Si alguna entrena en otro lado, va en un entrenamiento aparte."}),e[64]=$e):$e=e[64],e[65]!==fe?(y=s.jsxs("div",{className:"flex flex-col gap-2",children:[Be,fe,$e]}),e[65]=fe,e[66]=y):y=e[66];let Ee;e[67]===Symbol.for("react.memo_cache_sentinel")?(Ee=s.jsx(I,{htmlFor:"place",children:"Lugar"}),e[67]=Ee):Ee=e[67];const lt=a.placeId;let We;e[68]===Symbol.for("react.memo_cache_sentinel")?(We=o=>r(c=>({...c,placeId:o})),e[68]=We):We=e[68];let ze;e[69]===Symbol.for("react.memo_cache_sentinel")?(ze=s.jsx(Tt,{id:"place",children:s.jsx(vt,{placeholder:"Elegí la cancha"})}),e[69]=ze):ze=e[69];let he;e[70]!==f?(he=f.map(zt),e[70]=f,e[71]=he):he=e[71];let pe;e[72]!==he?(pe=s.jsx(bt,{children:he}
1),e[72]=he,e[73]=pe):pe=e[73];let ge;e[74]!==a.placeId||e[75]!==pe?(ge=s.jsxs(_t,{value:lt,onValueChange:We,children:[ze,pe]}),e[74]=a.placeId,e[75]=pe,e[76]=ge):ge=e[76];let qe;e[77]===Symbol.for("react.memo_cache_sentinel")?(qe=s.jsx("p",{className:"text-xs text-muted-foreground",children:"La ubicación sale de la cancha. Si la cancha se cargó sin dirección, este horario no aparece en las búsquedas por cercanía."}),e[77]=qe):qe=e[77],e[78]!==ge?(j=s.jsxs("div",{className:"flex flex-col gap-2",children:[Ee,ge,qe]}),e[78]=ge,e[79]=j):j=e[79];let Le;e[80]===Symbol.for("react.memo_cache_sentinel")?(Le=s.jsx(I,{children:"Días"}),e[80]=Le):Le=e[80];let ue;e[81]!==a.daysOfWeek?(ue=He.map((o,c)=>{const Me=a.daysOfWeek.includes(c);return s.jsx(xe,{type:"button",size:"sm",variant:Me?"default":"outline","aria-pressed":Me,className:"w-full px-0",onClick:()=>P(c),children:o.slice(0,3)},o)}),e[81]=a.daysOfWeek,e[82]=ue):ue=e[82],e[83]!==ue?(k=s.jsxs("div",{className:"flex flex-col gap-2",children:[Le,s.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-7 gap-1.5",children:ue})]}),e[83]=ue,e[84]=k):k=e[84],L="flex flex-col gap-3",e[85]!==a.customTimes||e[86]!==a.endTime||e[87]!==a.startTime?(R=!a.customTimes&&s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(I,{htmlFor:"startTime",children:"Desde"}),s.jsx(H,{id:"startTime",type:"time",value:a.startTime,onChange:o=>r(c=>({...c,startTime:o.target.value}))})]}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(I,{htmlFor:"endTime",children:"Hasta"}),s.jsx(H,{id:"endTime",type:"time",value:a.endTime,onChange:o=>r(c=>({...c,endTime:o.target.value}))})]})]}),e[85]=a.customTimes,e[86]=a.endTime,e[87]=a.startTime,e[88]=R):R=e[88],K=a.customTimes&&l.length>0&&s.jsx("div",{className:"flex flex-col gap-2 rounded-md border p-3",children:l.map(o=>s.jsxs("div",{className:"grid grid-cols-[3.25rem_1fr_1fr] items-center gap-2",children:[s.jsx("span",{className:"text-sm",children:He[o].slice(0,3)}),s.jsx(H,{type:"time","aria-label":`Desde, ${He[o]}`,value:h(o).start,onChange:c=>M(o,"start",c.target.value)}),s.jsx(H,{type:"time","aria-label":`Hasta, ${He[o]}`,value:h(o).end,onChange:c=>M(o,"end",c.target.value)})]},o))}),e[11]=x,e[12]=f,e[13]=a.acceptsBeginners,e[14]=a.categoryIds,e[15]=a.contactName,e[16]=a.contactPhone,e[17]=a.customTimes,e[18]=a.daysOfWeek,e[19]=a.endTime,e[20]=a.monthlyFee,e[21]=a.notes,e[22]=a.placeId,e[23]=a.startTime,e[24]=a.trialClassAvailable,e[25]=n,e[26]=u,e[27]=v,e[28]=m,e[29]=h,e[30]=O,e[31]=$,e[32]=E,e[33]=S,e[34]=C,e[35]=y,e[36]=j,e[37]=k,e[38]=W,e[39]=T,e[40]=A,e[41]=g,e[42]=d,e[43]=L,e[44]=R,e[45]=K}else O=e[30],$=e[31],E=e[32],S=e[33],C=e[34],y=e[35],j=e[36],k=e[37],W=e[38],T=e[39],A=e[40],g=e[41],d=e[42],L=e[43],R=e[44],K=e[45];let ye;e[89]===Symbol.for("react.memo_cache_sentinel")?(ye=l=>B(l===!0),e[89]=ye):ye=e[89];let Q;e[90]!==a.customTimes?(Q=s.jsx(Re,{id:"customTimes",checked:a.customTimes,onCheckedChange:ye}),e[90]=a.customTimes,e[91]=Q):Q=e[91];let je;e[92]===Symbol.for("react.memo_cache_sentinel")?(je=s.jsx(I,{htmlFor:"customTimes",className:"font-normal",children:"Algún día entrena en otro horario"}),e[92]=je):je=e[92];let G;e[93]!==Q?(G=s.jsxs("div",{className:"flex items-center gap-2",children:[Q,je]}),e[93]=Q,e[94]=G):G=e[94];let U;e[95]!==G||e[96]!==L||e[97]!==R||e[98]!==K?(U=s.jsxs("div",{className:L,children:[R,K,G]}),e[95]=G,e[96]=L,e[97]=R,e[98]=K,e[99]=U):U=e[99];let Te;e[100]===Symbol.for("react.memo_cache_sentinel")?(Te=l=>r(i=>({...i,acceptsBeginners:l===!0})),e[100]=Te):Te=e[100];let V;e[101]!==a.acceptsBeginners?(V=s.jsx(Re,{id:"acceptsBeginners",checked:a.acceptsBeginners,onCheckedChange:Te}),e[101]=a.acceptsBeginners,e[102]=V):V=e[102];let ve;e[103]===Symbol.for("react.memo_cache_sentinel")?(ve=s.jsx(I,{htmlFor:"acceptsBeginners",className:"font-normal",children:"Recibimos gente sin experiencia"}),e[103]=ve):ve=e[103];let Y;e[104]!==V?(Y=s.jsxs("div",{className:"flex items-center gap-2",children:[V,ve]}),e[104]=V,e[105]=Y):Y=e[105];let be;e[106]===Symbol.for("react.memo_cache_sentinel")?(be=l=>r(i=>({...i,trialClassAvailable:l===!0}
1)),e[106]=be):be=e[106];let J;e[107]!==a.trialClassAvailable?(J=s.jsx(Re,{id:"trialClassAvailable",checked:a.trialClassAvailable,onCheckedChange:be}),e[107]=a.trialClassAvailable,e[108]=J):J=e[108];let _e;e[109]===Symbol.for("react.memo_cache_sentinel")?(_e=s.jsx(I,{htmlFor:"trialClassAvailable",className:"font-normal",children:"Pueden venir a una clase de prueba"}),e[109]=_e):_e=e[109];let X;e[110]!==J?(X=s.jsxs("div",{className:"flex items-center gap-2",children:[J,_e]}),e[110]=J,e[111]=X):X=e[111];let Z;e[112]!==Y||e[113]!==X?(Z=s.jsxs("div",{className:"flex flex-col gap-3",children:[Y,X]}),e[112]=Y,e[113]=X,e[114]=Z):Z=e[114];let Ne;e[115]===Symbol.for("react.memo_cache_sentinel")?(Ne=s.jsx(I,{htmlFor:"monthlyFee",children:"Cuota mensual (opcional)"}),e[115]=Ne):Ne=e[115];let Se;e[116]===Symbol.for("react.memo_cache_sentinel")?(Se=l=>r(i=>({...i,monthlyFee:l.target.value})),e[116]=Se):Se=e[116];let ee;e[117]!==a.monthlyFee?(ee=s.jsxs("div",{className:"flex flex-col gap-2",children:[Ne,s.jsx(H,{id:"monthlyFee",type:"number",min:0,placeholder:"No publicar",value:a.monthlyFee,onChange:Se})]}),e[117]=a.monthlyFee,e[118]=ee):ee=e[118];let Ce;e[119]===Symbol.for("react.memo_cache_sentinel")?(Ce=s.jsx(I,{htmlFor:"contactPhone",children:"Teléfono de contacto"}),e[119]=Ce):Ce=e[119];let ke;e[120]===Symbol.for("react.memo_cache_sentinel")?(ke=l=>r(i=>({...i,contactPhone:l.target.value})),e[120]=ke):ke=e[120];let te;e[121]!==a.contactPhone?(te=s.jsxs("div",{className:"flex flex-col gap-2",children:[Ce,s.jsx(H,{id:"contactPhone",value:a.contactPhone,onChange:ke})]}),e[121]=a.contactPhone,e[122]=te):te=e[122];let se;e[123]!==ee||e[124]!==te?(se=s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[ee,te]}),e[123]=ee,e[124]=te,e[125]=se):se=e[125];let Fe;e[126]===Symbol.for("react.memo_cache_sentinel")?(Fe=s.jsx(I,{htmlFor:"contactName",children:"Referente (opcional)"}),e[126]=Fe):Fe=e[126];let Ie;e[127]===Symbol.for("react.memo_cache_sentinel")?(Ie=l=>r(i=>({...i,contactName:l.target.value})),e[127]=Ie):Ie=e[127];let ae;e[128]!==a.contactName?(ae=s.jsxs("div",{className:"flex flex-col gap-2",children:[Fe,s.jsx(H,{id:"contactName",value:a.contactName,onChange:Ie})]}),e[128]=a.contactName,e[129]=ae):ae=e[129];let we;e[130]===Symbol.for("react.memo_cache_sentinel")?(we=s.jsx(I,{htmlFor:"notes",children:"Notas (opcional)"}),e[130]=we):we=e[130];let De;e[131]===Symbol.for("react.memo_cache_sentinel")?(De=l=>r(i=>({...i,notes:l.target.value})),e[131]=De):De=e[131];let le;e[132]!==a.notes?(le=s.jsxs("div",{className:"flex flex-col gap-2",children:[we,s.jsx(Nt,{id:"notes",placeholder:"Ej: traer zapatillas de goma y botella de agua",value:a.notes,onChange:De})]}),e[132]=a.notes,e[133]=le):le=e[133];let ie;e[134]!==C||e[135]!==y||e[136]!==j||e[137]!==k||e[138]!==U||e[139]!==Z||e[140]!==se||e[141]!==ae||e[142]!==le?(ie=s.jsxs("div",{className:C,children:[y,j,k,U,Z,se,ae,le]}),e[134]=C,e[135]=y,e[136]=j,e[137]=k,e[138]=U,e[139]=Z,e[140]=se,e[141]=ae,e[142]=le,e[143]=ie):ie=e[143];let ne;e[144]!==u?(ne=s.jsx(xe,{variant:"outline",className:"w-full sm:w-auto",onClick:()=>u(!1),children:"Cancelar"}),e[144]=u,e[145]=ne):ne=e[145];const Ge=!E||w,Ue=w?"Guardando...":"Guardar";let oe;e[146]!==S||e[147]!==Ge||e[148]!==Ue?(oe=s.jsx(xe,{className:"w-full sm:w-auto",onClick:S,disabled:Ge,children:Ue}),e[146]=S,e[147]=Ge,e[148]=Ue,e[149]=oe):oe=e[149];let ce;e[150]!==ne||e[151]!==oe?(ce=s.jsxs(yt,{children:[ne,oe]}),e[150]=ne,e[151]=oe,e[152]=ce):ce=e[152];let re;e[153]!==O||e[154]!==W||e[155]!==T||e[156]!==ie||e[157]!==ce?(re=s.jsxs(O,{className:W,children:[T,ie,ce]}),e[153]=O,e[154]=W,e[155]=T,e[156]=ie,e[157]=ce,e[158]=re):re=e[158];let Pe;return e[159]!==$||e[160]!==A||e[161]!==g||e[162]!==d||e[163]!==re?(Pe=s.jsxs($,{open:A,onOpenChange:g,children:[d,re]}),e[159]=$,e[160]=A,e[161]=g,e[162]=d,e[163]=re,e[164]=Pe):Pe=e[164],Pe}function zt(t){return s.jsx(jt,{value:t.id,children:t.name},t.id)}function qt(t,e){return t-e}function Lt(t){return[t.day,{start:t.start,end:t.end}]}function Mt(t){return t.day}function Rt(t){return{day:t.day_of_week,start:t.start_time,end:t.end_time}}const Ht=async({teamId:t,categoryId:e,page:m=1,pageSize:u=100})=>{const n=new URLSearchParams;return n.append("page",m.toString()),n.append("pageSize",u.toString()),t&&n.append("teamId",t),e&&n.append("categoryId",e),(await Qe.get("/teamTraining/filter",{params:n})).data},Kt=async t=>(await Qe.post("/teamTraining",t)).data,Qt=async(t,e)=>(await Qe.put(`/teamTraining?id=${t}`,e)).data,Gt=async t=>(await Qe.delete(`/teamTraining?id=${t}`)).data,Ut=t=>{const e=Ze.c(21);let m;e[0]!==t?(m=t===void 0?{}:t,e[0]=t,e[1]=m):m=e[1];const{teamId:u}=m,n=rt();let x;e[2]!==n?(x=()=>n.invalidateQueries({queryKey:["teamTrainings"]}),e[2]=n,e[3]=x):x=e[3];const f=x;let v;e[4]!==u?(v={queryKey:["teamTrainings",u],queryFn:()=>Ht({teamId:u})},e[4]=u,e[5]=v):v=e[5];const{data:w,isLoading:a,error:r}=at(v);let p;e[6]!==w?.items?(p=w?.items??[],e[6]=w?.items,e[7]=p):p=e[7];let b;e[8]!==f?(b={mutationFn:Kt,onSuccess:f},e[8]=f,e[9]=b):b=e[9];const D=Je(b);let P;e[10]!==f?(P={mutationFn:Vt,onSuccess:f}
1,e[10]=f,e[11]=P):P=e[11];const _=Je(P);let B;e[12]!==f?(B={mutationFn:Gt,onSuccess:f},e[12]=f,e[13]=B):B=e[13];const N=Je(B);let h;return e[14]!==r||e[15]!==a||e[16]!==N||e[17]!==p||e[18]!==D||e[19]!==_?(h={trainings:p,isLoading:a,error:r,create:D,update:_,remove:N},e[14]=r,e[15]=a,e[16]=N,e[17]=p,e[18]=D,e[19]=_,e[20]=h):h=e[20],h};function Vt(t){const{id:e,training:m}=t;return Qt(e,m)}function Ns(){const t=Ze.c(41),{roleTeamId:e}=mt(),m=e??void 0;let u;t[0]!==m?(u={teamId:m},t[0]=m,t[1]=u):u=t[1];const{trainings:n,isLoading:x,create:f,update:v,remove:w}=Ut(u),[a,r]=Ke.useState(!1),[p,b]=Ke.useState(null),{categories:D,categoryName:P}=kt();let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_={queryKey:["courts","all"],queryFn:Jt},t[2]=_):_=t[2];const{data:B}=at(_);let N;t[3]!==B?.items?(N=B?.items??[],t[3]=B?.items,t[4]=N):N=t[4];const h=N;let q;t[5]!==h?(q=g=>h.find(d=>d.id===g)?.name??"",t[5]=h,t[6]=q):q=t[6];const M=q;let O;t[7]!==f||t[8]!==p||t[9]!==v?(O=async g=>{p?await v.mutateAsync({id:p.id,training:g}):await f.mutateAsync(g),r(!1),b(null)},t[7]=f,t[8]=p,t[9]=v,t[10]=O):O=t[10];const $=O;let E;t[11]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx(dt,{title:"Horarios de entrenamiento",description:"Lo que cargues acá es lo que ve quien está buscando dónde jugar."}),t[11]=E):E=t[11];let S;t[12]!==x?(S=x&&s.jsx("p",{className:"text-sm text-muted-foreground",children:"Cargando..."}),t[12]=x,t[13]=S):S=t[13];let C;t[14]!==x||t[15]!==n.length?(C=!x&&n.length===0&&s.jsx(et,{children:s.jsx(tt,{className:"py-8 text-center text-sm text-muted-foreground",children:"Todavía no cargaste horarios. Tocá el botón + para agregar el primero: hasta entonces tu club no aparece cuando alguien busca dónde jugar."})}),t[14]=x,t[15]=n.length,t[16]=C):C=t[16];let y;if(t[17]!==P||t[18]!==M||t[19]!==w||t[20]!==n){let g;t[22]!==P||t[23]!==M||t[24]!==w?(g=d=>s.jsx(et,{children:s.jsxs(tt,{className:"flex flex-col gap-3 py-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsx("div",{className:"flex flex-wrap gap-1.5",children:d.category_ids.map(L=>s.jsx(Xe,{variant:"secondary",children:P(L)},L))}),s.jsxs("div",{className:"flex shrink-0 gap-1 -mt-1 -mr-2",children:[s.jsx(xe,{size:"icon",variant:"ghost","aria-label":"Editar horario",onClick:()=>{b(d),r(!0)},children:s.jsx(Pt,{className:"size-4"})}),s.jsx(xe,{size:"icon",variant:"ghost","aria-label":"Borrar horario",onClick:()=>w.mutate(d.id),children:s.jsx(Ot,{className:"size-4"})})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5 text-sm",children:[It(d.sessions).map(Yt),s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(At,{className:"size-4 shrink-0 mt-0.5 text-muted-foreground"}),s.jsx("span",{children:M(d.place_id)})]})]}),(d.accepts_beginners||d.trial_class_available)&&s.jsxs("div",{className:"flex flex-wrap gap-1.5 border-t pt-3",children:[d.accepts_beginners&&s.jsxs(Xe,{variant:"outline",className:"gap-1 font-normal",children:[s.jsx(wt,{className:"size-3"}),"Recibe principiantes"]}),d.trial_class_available&&s.jsxs(Xe,{variant:"outline",className:"gap-1 font-normal",children:[s.jsx(Et,{className:"size-3"}),"Clase de prueba"]})]})]})},d.id),t[22]=P,t[23]=M,t[24]=w,t[25]=g):g=t[25],y=n.map(g),t[17]=P,t[18]=M,t[19]=w,t[20]=n,t[21]=y}else y=t[21];let j;t[26]!==y?(j=s.jsx("div",{className:"flex flex-col gap-3 pb-24",children:y}),t[26]=y,t[27]=j):j=t[27];let k;t[28]===Symbol.for("react.memo_cache_sentinel")?(k=g=>{r(g),g||b(null)},t[28]=k):k=t[28];const W=f.isPending||v.isPending;let T;t[29]!==D||t[30]!==h||t[31]!==p||t[32]!==$||t[33]!==a||t[34]!==W?(T=s.jsx(Wt,{open:a,onOpenChange:k,initialData:p,categories:D,courts:h,onSubmit:$,isSubmitting:W}),t[29]=D,t[30]=h,t[31]=p,t[32]=$,t[33]=a,t[34]=W,t[35]=T):T=t[35];let A;return t[36]!==j||t[37]!==T||t[38]!==S||t[39]!==C?(A=s.jsxs("div",{className:"px-2 mt-4 flex flex-col gap-4",children:[E,S,C,j,T]}),t[36]=j,t[37]=T,t[38]=S,t[39]=C,t[40]=A):A=t[40],A}function Yt(t){return s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Bt,{className:"size-4 shrink-0 mt-0.5 text-muted-foreground"}),s.jsxs("span",{children:[s.jsx("span",{className:"font-medium",children:Dt(t.days)})," ","de ",t.startTime,t.endTime?` a ${t.endTime}`:""]})]},`${t.days.join("-")}-${t.startTime}`)}function Jt(){return Ft({page:1,pageSize:100})}export{Ns 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.