1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7716],{20120:(e,s,a)=>{a.d(s,{$v:()=>p,EO:()=>m,Lt:()=>o,Rx:()=>f,Zr:()=>g,ck:()=>h,r7:()=>u,wd:()=>x});var t=a(95155),r=a(12115),l=a(52498),i=a(25016),n=a(97003);let o=l.bL;l.l9;let c=l.ZL,d=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(l.hJ,{className:(0,i.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...r,ref:s})});d.displayName=l.hJ.displayName;let m=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsxs)(c,{children:[(0,t.jsx)(d,{}),(0,t.jsx)(l.UC,{ref:s,className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...r})]})});m.displayName=l.UC.displayName;let x=e=>{let{className:s,...a}=e;return(0,t.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-2 text-center sm:text-left",s),...a}
1)};x.displayName="AlertDialogHeader";let h=e=>{let{className:s,...a}=e;return(0,t.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...a})};h.displayName="AlertDialogFooter";let u=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(l.hE,{ref:s,className:(0,i.cn)("text-lg font-semibold",a),...r})});u.displayName=l.hE.displayName;let p=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(l.VY,{ref:s,className:(0,i.cn)("text-sm text-muted-foreground",a),...r})});p.displayName=l.VY.displayName;let f=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(l.rc,{ref:s,className:(0,i.cn)((0,n.r)(),a),...r})});f.displayName=l.rc.displayName;let g=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(l.ZD,{ref:s,className:(0,i.cn)((0,n.r)({variant:"outline"}),"mt-2 sm:mt-0",a),...r})});g.displayName=l.ZD.displayName},22646:(e,s,a)=>{a.d(s,{p:()=>c});var t=a(95155),r=a(12115),l=a(40725),i=a(25016),n=a(97450);let o={Caras:["\uD83D\uDE00","\uD83D\uDE03","\uD83D\uDE04","\uD83D\uDE01","\uD83D\uDE05","\uD83D\uDE02","\uD83E\uDD23","\uD83D\uDE0A","\uD83D\uDE07","\uD83D\uDE42","\uD83D\uDE09","\uD83D\uDE0D","\uD83E\uDD70","\uD83D\uDE18","\uD83D\uDE17","\uD83D\uDE0B","\uD83D\uDE1B","\uD83D\uDE1C","\uD83E\uDD2A","\uD83D\uDE0E","\uD83E\uDD29","\uD83E\uDD73","\uD83D\uDE0F","\uD83D\uDE12","\uD83D\uDE44","\uD83D\uDE2C","\uD83D\uDE0C","\uD83D\uDE14","\uD83D\uDE2A","\uD83E\uDD24","\uD83D\uDE37","\uD83E\uDD12","\uD83E\uDD15","\uD83E\uDD22","\uD83E\uDD2E","\uD83E\uDD27","\uD83E\uDD75","\uD83E\uDD76","\uD83D\uDE31","\uD83D\uDE28","\uD83D\uDE30","\uD83D\uDE25","\uD83D\uDE22","\uD83D\uDE2D","\uD83D\uDE24","\uD83D\uDE21","\uD83E\uDD2C","\uD83D\uDC80","\uD83D\uDCA9","\uD83E\uDD21","\uD83D\uDC79","\uD83D\uDC7A","\uD83D\uDC7B","\uD83D\uDC7D","\uD83E\uDD16"],Gestos:["\uD83D\uDC4D","\uD83D\uDC4E","\uD83D\uDC4A","â","\uD83E\uDD1B","\uD83E\uDD1C","\uD83E\uDD1D","\uD83D\uDC4F","\uD83D\uDE4C","\uD83D\uDC50","\uD83E\uDD32","\uD83D\uDE4F","âï¸","\uD83E\uDD1F","\uD83E\uDD18","\uD83E\uDD19","\uD83D\uDC48","\uD83D\uDC49","\uD83D\uDC46","\uD83D\uDC47","âï¸","â","\uD83E\uDD1A","\uD83D\uDD90ï¸","\uD83D\uDD96","\uD83D\uDC4B","\uD83E\uDD0F","\uD83D\uDCAA","\uD83E\uDDBE","\uD83E\uDDBF"],Corazones:["â¤ï¸","\uD83E\uDDE1","\uD83D\uDC9B","\uD83D\uDC9A","\uD83D\uDC99","\uD83D\uDC9C","\uD83D\uDDA4","\uD83E\uDD0D","\uD83E\uDD0E","\uD83D\uDC94","â£ï¸","\uD83D\uDC95","\uD83D\uDC9E","\uD83D\uDC93","\uD83D\uDC97","\uD83D\uDC96","\uD83D\uDC98","\uD83D\uDC9D","\uD83D\uDC9F"],Baile:["\uD83D\uDC83","\uD83D\uDD7A","\uD83D\uDC6F","\uD83D\uDC6Fââï¸","\uD83D\uDC6Fââï¸","\uD83C\uDFB5","\uD83C\uDFB6","\uD83C\uDFA4","\uD83C\uDFA7","\uD83C\uDFBC","\uD83C\uDFB9","\uD83E\uDD41","\uD83C\uDFBA","\uD83C\uDFB7","\uD83E\uDE98","\uD83E\uDE97"],Objetos:["\uD83C\uDF89","\uD83C\uDF8A","\uD83C\uDF81","\uD83C\uDFC6","\uD83E\uDD47","\uD83E\uDD48","\uD83E\uDD49","â","\uD83C\uDF1F","â¨","\uD83D\uDCAB","\uD83D\uDD25","\uD83D\uDCAF","â
","â","â ï¸","\uD83D\uDCC5","\uD83D\uDCC6","\uD83D\uDCB0","\uD83D\uDCB3","\uD83D\uDCF1","\uD83D\uDCBB","\uD83D\uDCE7","\uD83D\uDCDE","\uD83D\uDD17","\uD83D\uDCCD","\uD83C\uDFE0","\uD83C\uDFEB"]};function c(e){let{onEmojiSelect:s,className:a,buttonSize:c="lg"}=e,[d,m]=(0,r.useState)(!1),[x,h]=(0,r.useState)("Caras"),u={sm:{button:36,icon:20},md:{button:40,icon:24},lg:{button:44,icon:28},xl:{button:44,icon:32}}[c];return(0,t.jsxs)(n.AM,{open:d,onOpenChange:m,children:[(0,t.jsx)(n.Wv,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:(0,i.cn)("rounded-full hover:bg-gray-100 flex-shrink-0 flex items-center justify-center",a),style:{width:u.button,height:u.button,minWidth:u.button,minHeight:u.button},children:(0,t.jsx)(l.A,{className:"text-gray-500",style:{width:u.icon,height:u.icon,minWidth:u.icon,minHeight:u.icon}})})}),(0,t.jsxs)(n.hl,{className:"w-[calc(100vw-2rem)] sm:w-96 p-0 bg-white shadow-xl border border-gray-200 z-[100] rounded-2xl overflow-hidden",side:"top",align:"center",sideOffset:12,children:[(0,t.jsx)("div",{className:"flex gap-1.5 p-3 border-b overflow-x-auto bg-gray-50",children:Object.keys(o).map(e=>(0,t.jsx)("button",{onClick:()=>h(e),className:"px-4 py-2 text-sm font-medium rounded-full whitespace-nowrap transition-colors ".concat(x===e?"bg-primary text-white":"bg-white text-gray-600 hover:bg-gray-100 border border-gray-200"),children:e},e))}),(0,t.jsx)("div",{className:"p-3 max-h-64 overflow-y-auto",children:(0,t.jsx)("div",{className:"grid grid-cols-8 gap-1",children:o[x].map((e,a)=>(0,t.jsx)("button",{onClick:()=>{s(e),m(!1)},className:"w-10 h-10 flex items-center justify-center text-2xl hover:bg-gray-100 rounded-lg transition-colors active:scale-95",children:e},a))})})]})]})}},33884:(e,s,a)=>{a.d(s,{BK:()=>o,eu:()=>n,q5:()=>c});var t=a(95155),r=a(12115),l=a(63366),i=a(25016);let n=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(l.bL,{ref:s,className:(0,i.cn)("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",a),...r})});n.displayName=l.bL.displayName;let o=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(l._V,{ref:s,className:(0,i.cn)("aspect-square h-full w-full",a),...r})});o.displayName=l._V.displayName;let c=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(l.H4,{ref:s,className:(0,i.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",a),...r})});c.displayName=l.H4.displayName},54124:(e,s,a)=>{a.d(s,{Pk:()=>t});let t="Deuda reconocida de un alumno que ya no viene: no se le reclama sola y no cuenta como dinero por cobrar del mes, pero queda guardada y aparece si vuelve a darse de alta."},55779:(e,s,a)=>{a.d(s,{G:()=>t});function t(e,s){return fetch("/api/auth/log-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,method:s}),keepalive:!0})}},67812:(e,s,a)=>{a.d(s,{E:()=>n});var t=a(95155);a(12115);var r=a(83101),l=a(25016);let i=(0,r.F)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function n(e){let{className:s,variant:a,...r}=e;return(0,t.jsx)("div",{className:(0,l.cn)(i({variant:a}),s),...r})}},87716:(e,s,a)=>{a.r(s),a.d(s,{default:()=>eD});var t=a(95155),r=a(12115),l=a(20063),i=a(52619),n=a.n(i),o=a(37e3),c=a(15239),d=a(97003),m=a(67812),x=a(54679),h=a(20120),u=a(16485),p=a(21873),f=a(20508),g=a(95740),j=a(89442),b=a(12181),y=a(35299),N=a(42529),v=a(65229),w=a(91169),_=a(78519),C=a(52056),S=a(23327),k=a(54485),A=a(18514),E=a(60709),T=a(27937),P=a(87066),R=a(84926),F=a(7658),D=a(15815),O=a(4480),z=a(43586),M=a(82063),I=a(17188),L=a(57828),J=a(5937),V=a(54690),q=a(66955),$=a(39347),B=a(45345),G=a(19204),U=a(33789),H=a(90235),W=a(4750
17),Z=a(18720),X=a(95664),K=a(23664),Q=a(53873),Y=a(69141),ee=a(33884);let es=["Calle","Avenida","Plaza","Paseo","Carretera","Camino","Ronda","Traves\xeda","Urbanizaci\xf3n","Otro"],ea=[{value:"lider",label:"L\xedder"},{value:"follower",label:"Follower"},{value:"otro",label:"Otro"}],et=["XS","S","M","L","XL","XXL"],er="__none__";function el(e){let{open:s,onOpenChange:a,alumno:l,onSuccess:i}=e,[n,o]=(0,r.useState)(!1),[c,m]=(0,r.useState)(!1),[h,g]=(0,r.useState)(null),j=(0,r.useRef)(null),[b,N]=(0,r.useState)({rolBaile:"",tallaCamiseta:"",telefono:"",tipoVia:"",nombreVia:"",numeroDireccion:"",codigoPostal:"",ciudad:""});(0,r.useEffect)(()=>{s&&l&&(N({rolBaile:l.rolBaile||"",tallaCamiseta:l.tallaCamiseta||"",telefono:l.telefono||"",tipoVia:l.tipoVia||"",nombreVia:l.nombreVia||"",numeroDireccion:l.numeroDireccion||"",codigoPostal:l.codigoPostal||"",ciudad:l.ciudad||""}),g(l.fotoPerfil||null))},[s,l]);let C=async e=>{var s;let a=null==(s=e.target.files)?void 0:s[0];if(a){if(a.size>0xa00000)return void Z.oR.error("Imagen demasiado grande. M\xe1ximo 10MB");if(!["image/jpeg","image/png","image/gif","image/webp"].includes(a.type))return void Z.oR.error("Formato no v\xe1lido. Use JPG, PNG, GIF o WebP");m(!0);try{let e=await new Promise((e,s)=>{let t=new FileReader;t.onload=()=>e(t.result),t.onerror=s,t.readAsDataURL(a)}),s=await fetch("/api/alumnos/me/foto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({foto:e})});if(s.ok)g(e),Z.oR.success("Foto actualizada"),i();else{let e=await s.json();Z.oR.error(e.error||"Error al subir la foto")}}catch(e){Z.oR.error("Error al subir la foto")}finally{m(!1),j.current&&(j.current.value="")}}},S=async()=>{m(!0);try{(await fetch("/api/alumnos/me/foto",{method:"DELETE"})).ok?(g(null),Z.oR.success("Foto eliminada"),i()):Z.oR.error("Error al eliminar la foto")}catch(e){Z.oR.error("Error al eliminar la foto")}finally{m(!1)}},k=l?"".concat(l.nombre.charAt(0)).concat(l.apellidos.charAt(0)).toUpperCase():"",A=async e=>{if(e.preventDefault(),l){o(!0);try{let e=await fetch("/api/alumnos/update-profile",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l.id,...b})});if(e.ok)Z.oR.success("Perfil actualizado correctamente"),i(),a(!1);else{let s=await e.json();Z.oR.error(s.error||"Error al actualizar el perfil")}}catch(e){Z.oR.error("Error al actualizar el perfil")}finally{o(!1)}}};return l?(0,t.jsx)(x.lG,{open:s,onOpenChange:a,children:(0,t.jsxs)(x.Cf,{className:"w-full max-w-[95vw] sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[(0,t.jsxs)(x.c7,{children:[(0,t.jsxs)(x.L3,{className:"flex items-center gap-2",children:[(0,t.jsx)(f.A,{className:"h-5 w-5 text-primary"}),"Editar Mi Perfil"]}
1),(0,t.jsx)(x.rr,{children:"Actualiza tu informaci\xf3n personal"})]}),(0,t.jsxs)("form",{onSubmit:A,className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)(ee.eu,{className:"h-20 w-20 border-2 border-gray-200",children:[h?(0,t.jsx)(ee.BK,{src:h,alt:"Foto de perfil"}):null,(0,t.jsx)(ee.q5,{className:"text-lg font-semibold bg-primary/10 text-primary",children:k})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{var e;return null==(e=j.current)?void 0:e.click()},disabled:c,className:"absolute bottom-0 right-0 h-7 w-7 rounded-full bg-primary text-white flex items-center justify-center shadow-md hover:bg-primary/90 transition-colors disabled:opacity-50",children:c?(0,t.jsx)(y.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(X.A,{className:"h-3.5 w-3.5"})}),h&&!c&&(0,t.jsx)("button",{type:"button",onClick:S,className:"absolute top-0 right-0 h-5 w-5 rounded-full bg-red-500 text-white flex items-center justify-center shadow-md hover:bg-red-600 transition-colors",children:(0,t.jsx)(v.A,{className:"h-3 w-3"})})]}),(0,t.jsx)("input",{ref:j,type:"file",accept:"image/jpeg,image/png,image/gif,image/webp",onChange:C,className:"hidden"}),(0,t.jsx)("p",{className:"text-xs text-gray-400",children:"Toca para cambiar tu foto"})]}),(0,t.jsx)("div",{className:"bg-gray-50 p-4 rounded-lg space-y-3",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)(H.J,{className:"text-xs text-gray-500 flex items-center gap-1",children:[(0,t.jsx)(f.A,{className:"h-3 w-3"}),"Nombre completo"]}),(0,t.jsxs)("p",{className:"text-sm font-medium text-gray-900",children:[l.nombre," ",l.apellidos]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(H.J,{className:"text-xs text-gray-500 flex items-center gap-1",children:[(0,t.jsx)(u.A,{className:"h-3 w-3"}),"Fecha de nacimiento"]}),(0,t.jsx)("p",{className:"text-sm font-medium text-gray-900",children:(e=>{if(!e)return"No registrada";try{return new Date(e).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"})}catch(e){return"No registrada"}})(l.fechaNacimiento)})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(H.J,{className:"text-xs text-gray-500 flex items-center gap-1",children:[(0,t.jsx)(_.A,{className:"h-3 w-3"}),"DNI"]}),(0,t.jsx)("p",{className:"text-sm font-medium text-gray-900",children:l.dni||"No registrado"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(H.J,{className:"text-xs text-gray-500 flex items-center gap-1",children:[(0,t.jsx)(K.A,{className:"h-3 w-3"}),"Email"]}),(0,t.jsx)("p",{className:"text-sm font-medium text-gray-900",children:l.email})]})]})}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)(H.J,{htmlFor:"rolBaile",className:"flex items-center gap-1",children:[(0,t.jsx)(w.A,{className:"h-3 w-3 text-primary"}),"Rol de baile"]}),(0,t.jsxs)(W.l6,{value:b.rolBaile,onValueChange:e=>N({...b,rolBaile:e}),children:[(0,t.jsx)(W.bq,{className:"mt-1",children:(0,t.jsx)(W.yv,{placeholder:"Seleccionar..."})}),(0,t.jsx)(W.gC,{children:ea.map(e=>(0,t.jsx)(W.eb,{value:e.value,children:e.label},e.value))})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(H.J,{htmlFor:"tallaCamiseta",className:"flex items-center gap-1",children:[(0,t.jsx)(Q.A,{className:"h-3 w-3 text-primary"}),"Talla camiseta"]}),(0,t.jsxs)(W.l6,{value:b.tallaCamiseta||er,onValueChange:e=>N({...b,tallaCamiseta:e===er?"":e}),children:[(0,t.jsx)(W.bq,{className:"mt-1",children:(0,t.jsx)(W.yv,{placeholder:"Seleccionar..."})}),(0,t.jsxs)(W.gC,{children:[(0,t.jsx)(W.eb,{value:er,children:"Sin especificar"}),et.map(e=>(0,t.jsx)(W.eb,{value:e,children:e},e))]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(H.J,{htmlFor:"telefono",className:"flex items-center gap-1",children:[(0,t.jsx)(Y.A,{className:"h-3 w-3 text-primary"}),"Tel\xe9fono"]}),(0,t.jsx)(U.p,{id:"telefono",type:"tel",value:b.telefono,onChange:e=>N({...b,telefono:e.target.value}),placeholder:"612345678",className:"mt-1"})]})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)(H.J,{className:"flex items-center gap-1",children:[(0,t.jsx)(p.A,{className:"h-3 w-3 text-primary"}),"Direcci\xf3n"]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:[(0,t.jsxs)("div",{className:"sm:col-span-1",children:[(0,t.jsx)(H.J,{htmlFor:"tipoVia",className:"text-xs text-gray-500",children:"Tipo v\xeda"}),(0,t.jsxs)(W.l6,{value:b.tipoVia,onValueChange:e=>N({...b,tipoVia:e}),children:[(0,t.jsx)(W.bq,{className:"mt-1",children:(0,t.jsx)(W.yv,{placeholder:"Tipo"})}),(0,t.jsx)(W.gC,{children:es.map(e=>(0,t.jsx)(W.eb,{value:e,children:e},e))})]})]}),(0,t.jsxs)("div",{className:"sm:col-span-2",children:[(0,t.jsx)(H.J,{htmlFor:"nombreVia",className:"text-xs text-gray-500",children:"Nombre de la v\xeda"}),(0,t.jsx)(U.p,{id:"nombreVia",value:b.nombreVia,onChange:e=>N({...b,nombreVia:e.target.value}),placeholder:"Nombre de la calle",className:"mt-1"})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-5 ga
1p-2",children:[(0,t.jsxs)("div",{className:"col-span-1 sm:col-span-1",children:[(0,t.jsx)(H.J,{htmlFor:"numeroDireccion",className:"text-xs text-gray-500",children:"N\xfamero"}),(0,t.jsx)(U.p,{id:"numeroDireccion",value:b.numeroDireccion,onChange:e=>N({...b,numeroDireccion:e.target.value}),placeholder:"N\xba",className:"mt-1"})]}),(0,t.jsxs)("div",{className:"col-span-1 sm:col-span-1",children:[(0,t.jsx)(H.J,{htmlFor:"codigoPostal",className:"text-xs text-gray-500",children:"C.P."}),(0,t.jsx)(U.p,{id:"codigoPostal",value:b.codigoPostal,onChange:e=>N({...b,codigoPostal:e.target.value}),placeholder:"08000",maxLength:5,className:"mt-1"})]}),(0,t.jsxs)("div",{className:"col-span-2 sm:col-span-3",children:[(0,t.jsx)(H.J,{htmlFor:"ciudad",className:"text-xs text-gray-500",children:"Ciudad"}),(0,t.jsx)(U.p,{id:"ciudad",value:b.ciudad,onChange:e=>N({...b,ciudad:e.target.value}),placeholder:"Ciudad",className:"mt-1"})]})]})]})]}),(0,t.jsxs)(x.Es,{className:"flex-col sm:flex-row gap-2 pt-4",children:[(0,t.jsx)(d.$,{type:"button",variant:"outline",onClick:()=>a(!1),disabled:n,className:"w-full sm:w-auto",children:"Cancelar"}),(0,t.jsx)(d.$,{type:"submit",disabled:n,className:"w-full sm:w-auto bg-primary hover:bg-accent text-white",children:n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Guardando..."]}):"Guardar cambios"})]})]})]})}):null}var ei=a(55779),en=a(12834),eo=a(22646),ec=a(15438),ed=a(5917),em=a(71360),ex=a(52508);function eh(e){let{userId:s,email:l}=e,[i,n]=(0,r.useState)(!1),[o,c]=(0,r.useState)(!0),[m,x]=(0,r.useState)(!1),[h,u]=(0,r.useState)(!1),[p,f]=(0,r.useState)(!1);(0,r.useEffect)(()=>{f(!0);let e=!!window.PublicKeyCredential;u(e),e?g():c(!1)},[s]);let g=async()=>{try{let e=await fetch("/api/webauthn/check?userId=".concat(s)),a=await e.json();n(a.hasCredentials||!1)}catch(e){console.error("Error checking credentials:",e)}finally{c(!1)}},j=async()=>{if(!window.PublicKeyCredential)return void Z.oR.error("Tu navegador no soporta autenticaci\xf3n biom\xe9trica");x(!0);try{let{startRegistration:e}=await a.e(6830).then(a.bind(a,74449)),t=await fetch("/api/webauthn/register?email=".concat(encodeURIComponent(l),"&userId=").concat(s));if(!t.ok)throw Error("Error obteniendo opciones de registro");let r=await t.json(),i=await e({optionsJSON:r});if(!(await fetch("/api/webauthn/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:s,credential:i})})).ok)throw Error("Error verificando credencial");localStorage.setItem("rt_biometric_email",l),Z.oR.success("\xa1Face ID / Touch ID configurado correctamente!"),n(!0)}catch(e){console.error("Error registering biometric:",e),"NotAllowedError"===e.name?Z.oR.error("Autenticaci\xf3n cancelada"):Z.oR.error(e.message||"Error configurando autenticaci\xf3n biom\xe9trica")}finally{x(!1)}},b=async()=>{try{let e=await fetch("/api/webauthn/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:s})});if(e.ok)localStorage.removeItem("rt_biometric_email"),Z.oR.success("Autenticaci\xf3n biom\xe9trica eliminada"),n(!1);else{let s=await e.json();Z.oR.error(s.error||"Error eliminando credencial")}}catch(e){Z.oR.error("Error eliminando credencial")}};return p&&h?o?(0,t.jsx)("div",{className:"bg-white rounded-2xl p-4 border border-gray-100 mb-4",children:(0,t.jsx)("div",{className:"flex items-center justify-center py-2",children:(0,t.jsx)(y.A,{className:"h-5 w-5 animate-spin text-gray-400"})})}):(0,t.jsxs)("div",{className:"bg-white rounded-2xl p-4 border border-gray-100 mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)("div",{className:"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center",children:(0,t.jsx)(ec.A,{className:"h-5 w-5 text-primary"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-semibold text-gray-900",children:"Acceso r\xe1pido"}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Face ID / Touch ID"})]})]}),i?(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-primary",children:[(0,t.jsx)(ed.A,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"font-medium",children:"Configurado"})]}),(0,t.jsxs)(d.$,{variant:"ghost",size:"sm",onClick:b,className:"text-red-500 hover:text-red-600 hover:bg-red-50",children:[(0,t.jsx)(em.A,{className:"h-4 w-4 mr-1"}),"Eliminar"]})]}):(0,t.jsx)(d.$,{onClick:j,disabled:m,className:"w-full bg-primary hover:bg-accent text-white h-11 rounded-xl",children:m?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.A,{className:"h-4 w-4 animate-spin mr-2"}),"Configurando..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ex.A,{className:"h-4 w-4 mr-2"}),"Activar Face ID / Touch ID"]})})]}):null}
1var eu=a(1733),ep=a(26497),ef=a(71163),eg=a(35056);function ej(){let[e,s]=(0,r.useState)(!1),[a,l]=(0,r.useState)([]),[i,n]=(0,r.useState)(!1);(0,r.useEffect)(()=>(e?(o(),document.body.style.overflow="hidden"):document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]);let o=async()=>{n(!0);try{let e=await fetch("/api/festivos?publico=true"),s=await e.json();s.success&&l(s.data)}catch(e){console.error("Error cargando festivos:",e)}finally{n(!1)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(eu.P.button,{layoutId:"calendario-expandible",onClick:()=>s(!0),className:"w-full h-14 flex items-center justify-center gap-2 bg-white border-2 border-primary rounded-2xl hover:bg-primary/5 transition-colors shadow-sm",children:[(0,t.jsx)(u.A,{className:"h-4 w-4 text-primary"}),(0,t.jsx)("span",{className:"text-lg font-semibold text-primary",children:"Ver Calendario"})]}),(0,t.jsx)(ep.N,{children:e&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eu.P.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"fixed inset-0 bg-black/50 z-50",onClick:()=>s(!1)}),(0,t.jsxs)(eu.P.div,{layoutId:"calendario-expandible",className:"fixed inset-4 md:inset-8 lg:inset-16 z-50 bg-white rounded-2xl shadow-2xl overflow-hidden flex flex-col",transition:{type:"spring",damping:25,stiffness:200,duration:.3},children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 bg-gradient-to-r from-primary to-accent",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(u.A,{className:"w-6 h-6 text-white"}),(0,t.jsx)("h2",{className:"text-2xl font-bold text-white",children:"Calendario Escolar"})]}),(0,t.jsx)("button",{onClick:()=>s(!1),className:"p-2 hover:bg-white/20 rounded-lg transition-colors",children:(0,t.jsx)(v.A,{className:"w-6 h-6 text-white"})})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto p-6",children:i?(0,t.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"inline-block animate-spin rounded-full h-12 w-12 border-b-2 border-primary"}),(0,t.jsx)("p",{className:"text-gray-600 mt-4",children:"Cargando calendario..."})]})}):0===a.length?(0,t.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)(u.A,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),(0,t.jsx)("p",{className:"text-gray-600",children:"No hay eventos programados"})]})}):(0,t.jsxs)("div",{className:"max-w-4xl mx-auto",children:[(0,t.jsx)("p",{className:"text-gray-600 mb-6",children:"Aqu\xed puedes consultar todos los festivos, cierres y eventos especiales de la escuela."}),Object.entries(a.reduce((e,s)=>{let a=new Date(s.fecha).getFullYear();return e[a]||(e[a]=[]),e[a].push(s),e},{})).sort((e,s)=>{let[a]=e,[t]=s;return Number(t)-Number(a)}).map(e=>{let[s,a]=e;return(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsxs)("h3",{className:"text-xl font-bold text-gray-900 mb-4 flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-primary",children:s}),(0,t.jsxs)("span",{className:"text-sm font-normal text-gray-500",children:["(",a.length," ",1===a.length?"evento":"eventos",")"]})]}),(0,t.jsx)("div",{className:"grid gap-3",children:(e=>{if(0===e.length)return[];let s=[...e].sort((e,s)=>new Date(e.fecha).getTime()-new Date(s.fecha).getTime()),a=[],t={...s[0]};for(let e=1;e<s.length;e++){let r=s[e],l=new Date(r.fecha),i=new Date(t.fecha_fin||t.fecha),n=Math.floor((l.getTime()-i.getTime())/864e5);r.descripcion===t.descripcion&&r.tipo===t.tipo&&1===n?t.fecha_fin=r.fecha:(a.push(t),t={...r})}return a.push(t),a})(a).map(e=>{let s=!!e.fecha_fin,a=new Date(e.fecha),r=e.fecha_fin?new Date(e.fecha_fin):null;return(0,t.jsxs)(eu.P.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.2},className:"flex items-center gap-4 p-4 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:s?(0,t.jsxs)("div",{className:"text-center bg-white rounded-lg p-3 shadow-sm min-w-[100px]",children:[(0,t.jsx)("div",{className:"text-sm font-bold text-gray-900",children:(0,ef.GP)(a,"d MMM",{locale:eg.es}).toUpperCase()}),(0,t.jsx)("div",{className:"text-xs text-gray-500 my-1",children:"hasta"}),(0,t.jsx)("div",{className:"text-sm font-bold text-gray-900",children:(0,ef.GP)(r,"d MMM",{locale:eg.es}).toUpperCase()})]}):(0,t.jsxs)("div",{className:"text-center bg-white rounded-lg p-3 shadow-sm min-w-[80px]",children:[(0,t.jsx)("div",{className:"text-2xl font-bold text-gray-900",children:(0,ef.GP)(a,"d")}),(0,t.jsx)("div",{className:"text-xs text-gray-600 uppercase",children:(0,ef.GP)(a,"MMM",{locale:eg.es})}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:(0,ef.GP)(a,"EEEE",{locale:eg.es})})]})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h4",{className:"font-semibold text-gray-900 mb-1",children:e.descripcion}),(0,t.jsx)("span",{className:"inline-block px-2.5 py-1 rounded-full text-xs font-medium ".concat((e=>{switch(e){case"festivo":return"bg-red-100 text-red-800";case"cierre":return"bg-orange-100 text-orange-800";case"evento_especial":return"bg-blue-100 text-blue-800";default:return"bg-gray-100 text-gray-800"}})(e.tipo)),children:(e=>{switch(e){case"festivo":return"Festivo";
1case"cierre":return"Cierre";case"evento_especial":return"Evento Especial";default:return e}})(e.tipo)})]})]},e.id)})})]},s)})]})})]})]})})]})}let eb=["#FF6B6B","#4ECDC4","#FFE66D","#95E1D3","#FF8B94","#A8E6CF","#DDA0DD","#87CEEB","#FFA07A","#98D8C8"];function ey(e){let{globo:s}=e;return(0,t.jsx)(eu.P.div,{className:"absolute pointer-events-none",style:{left:"".concat(s.left,"%"),bottom:-100,fontSize:s.size},initial:{y:0,opacity:0},animate:{y:[0,-window.innerHeight-200],x:[0,s.wiggleAmount,-s.wiggleAmount,s.wiggleAmount,0],opacity:[0,1,1,1,0]},transition:{duration:s.duration,delay:s.delay,ease:"easeOut",x:{duration:s.duration,delay:s.delay,repeat:0,ease:"easeInOut"}},children:(0,t.jsxs)("svg",{width:s.size,height:1.3*s.size,viewBox:"0 0 50 65",fill:"none",children:[(0,t.jsx)("ellipse",{cx:"25",cy:"22",rx:"22",ry:"22",fill:s.color}),(0,t.jsx)("ellipse",{cx:"18",cy:"15",rx:"6",ry:"8",fill:"rgba(255,255,255,0.3)"}),(0,t.jsx)("path",{d:"M25 44 L22 48 L28 48 Z",fill:s.color}),(0,t.jsx)("path",{d:"M25 48 Q 23 55, 25 60 Q 27 55, 25 65",stroke:s.color,strokeWidth:"1.5",fill:"none"})]})})}function eN(e){let{nombre:s,onComplete:a}=e,[l,i]=(0,r.useState)(!0),[n]=(0,r.useState)(()=>Array.from({length:20},(e,s)=>({id:s,color:eb[Math.floor(Math.random()*eb.length)],left:5+90*Math.random(),size:40+30*Math.random(),delay:1.5*Math.random(),duration:4+2*Math.random(),wiggleAmount:10+20*Math.random()}))),o=(0,r.useCallback)(()=>{i(!1),setTimeout(a,500)},[a]);(0,r.useEffect)(()=>{let e=setTimeout(()=>{o()},6e3);return()=>clearTimeout(e)},[o]);let c=s.split(" ")[0];return(0,t.jsx)(ep.N,{children:l&&(0,t.jsxs)(eu.P.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},className:"fixed inset-0 z-[100] overflow-hidden",onClick:o,children:[(0,t.jsx)("div",{className:"absolute inset-0 bg-black/50"}),["\uD83C\uDF89","\uD83C\uDF8A","â¨","\uD83C\uDF88","\uD83C\uDF81"].map((e,s)=>(0,t.jsx)(eu.P.div,{className:"absolute text-4xl pointer-events-none",style:{left:"".concat(10+20*s,"%"),top:"30%"},initial:{opacity:0,scale:0,rotate:0},animate:{opacity:[0,1,1,0],scale:[0,1.2,1,.8],rotate:[0,15,-15,0],y:[0,-20,0,20]},transition:{duration:3,delay:.5+.2*s,ease:"easeInOut"},children:e},"confetti-".concat(s))),n.map(e=>(0,t.jsx)(ey,{globo:e},e.id)),(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,t.jsxs)(eu.P.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},transition:{delay:.3,type:"spring",stiffness:200,damping:15},className:"text-center px-6",children:[(0,t.jsx)(eu.P.div,{className:"text-7xl mb-4",animate:{scale:[1,1.1,1],rotate:[0,5,-5,0]},transition:{duration:2,repeat:1/0,repeatType:"reverse"},children:"\uD83C\uDF82"}),(0,t.jsxs)(eu.P.h1,{className:"text-3xl md:text-4xl font-bold text-white mb-3",style:{textShadow:"0 4px 20px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3)"},initial:{y:20},animate:{y:0},transition:{delay:.5},children:["\xa1Feliz Cumplea\xf1os,",(0,t.jsx)("br",{}),(0,t.jsx)("span",{className:"text-primary",children:c}),"!"]}),(0,t.jsx)(eu.P.p,{className:"text-white/90 text-lg",initial:{opacity:0}
1,animate:{opacity:1},transition:{delay:.8},children:"\uD83C\uDF89 Que tengas un d\xeda incre\xedble \uD83C\uDF89"}),(0,t.jsxs)(eu.P.p,{className:"text-white/70 text-sm mt-4",initial:{opacity:0},animate:{opacity:1},transition:{delay:1.2},children:["Con cari\xf1o, de parte de",(0,t.jsx)("br",{}),(0,t.jsx)("span",{className:"text-primary font-medium",children:"Miguel, Jenni y todo el equipo"})]}),(0,t.jsx)(eu.P.p,{className:"text-white/50 text-xs mt-6",initial:{opacity:0},animate:{opacity:1},transition:{delay:2},children:"Toca para continuar"})]})})]})})}var ev=a(89715);function ew(){let[e,s]=(0,r.useState)(!1);return(0,r.useEffect)(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eu.P.div,{layoutId:"normativa-expandible",onClick:()=>s(!0),className:"bg-white rounded-2xl p-4 mb-4 border border-gray-100 cursor-pointer hover:shadow-md transition-shadow",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center",children:(0,t.jsx)(ev.A,{className:"h-5 w-5 text-blue-600"})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("p",{className:"font-semibold text-gray-900",children:"Normativa de la escuela"}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Consulta las normas y condiciones"})]}),(0,t.jsx)(T.A,{className:"h-5 w-5 text-gray-400"})]})}),(0,t.jsx)(ep.N,{children:e&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eu.P.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"fixed inset-0 bg-black/50 z-50",onClick:()=>s(!1)}),(0,t.jsxs)(eu.P.div,{layoutId:"normativa-expandible",className:"fixed inset-4 md:inset-8 lg:inset-16 z-50 bg-white rounded-2xl shadow-2xl overflow-hidden flex flex-col",transition:{type:"spring",damping:25,stiffness:200,duration:.3},children:[(0,t.jsxs)("div",{className:"px-6 pt-6 pb-4 border-b",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900 text-left",children:"Normativa de la Escuela"}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-1 text-left",children:"Consulta las normas y condiciones de Ritmo y Tumbao"})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4 text-gray-700 leading-relaxed",children:(0,t.jsxs)("div",{className:"prose prose-sm max-w-none",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold text-gray-900 mt-0 mb-3",children:"Normas de la Escuela"}),(0,t.jsxs)("p",{className:"mb-4",children:["Bienvenido/a a ",(0,t.jsx)("strong",{children:"Ritmo y Tumbao"}),". Al registrarte como alumno/a, aceptas las siguientes normas y condiciones:"]}),(0,t.jsx)("h4",{className:"text-base font-semibold text-gray-900 mt-6 mb-2",children:"⢠Duraci\xf3n de las clases"}),(0,t.jsx)("p",{className:"mb-4 pl-4",children:"Cada clase tiene una duraci\xf3n de 55 minutos."}),(0,t.jsx)("h4",{className:"text-base font-semibold text-gray-900 mt-6 mb-2",children:"⢠Pagos"}),(0,t.jsx)("p",{className:"mb-4 pl-4",children:"Los pagos deben realizarse del d\xeda 1 al 15 de cada mes. El pago podr\xe1 efectuarse en efectivo o con tarjeta en recepci\xf3n, o a trav\xe9s del enlace web que se enviar\xe1 mensualmente."}),(0,t.jsx)("h4",{className:"text-base font-semibold text-gray-900 mt-6 mb-2",children:"⢠Calendario y n\xfamero de clases"}),(0,t.jsx)("div",{className:"mb-4 pl-4 space-y-2",children:(0,t.jsx)("p",{children:"El calendario de la escuela contempla la existencia de meses con 3 clases, as\xed como de meses con 5 clases (una m\xe1s de lo habitual). En los meses de mayor duraci\xf3n, el alumno no deber\xe1 abonar la clase adicional. En los meses que cuenten \xfanicamente con 3 semanas lectivas, el alumno deber\xe1 abonar el mes completo."})}),(0,t.jsx)("h4",{className:"text-base font-semibold text-gray-900 mt-6 mb-2",children:"⢠Festivos"}),(0,t.jsx)("p",{className:"mb-4 pl-4",children:"Los d\xedas festivos se encuentran incluidos dentro del calendario de la escuela y no son recuperables."}),(0,t.jsx)("h4",{className:"text-base font-semibold text-gray-900 mt-6 mb-2",children:"⢠Bajas, cambios de clase u horario"}),(0,t.jsx)("div",{className:"mb-4 pl-4 space-y-2",children:(0,t.jsx)("p",{children:"Para solicitar la baja, as\xed como para realizar cambios de clase o de horario, ser\xe1 obligatorio avisar con un m\xednimo de 15 d\xedas de antelaci\xf3n antes de la finalizaci\xf3n del mes en curso. En caso de no cumplir con este plazo, se proceder\xe1 al cobro del mes siguiente."})}),(0,t.jsx)("h4",{className:"text-base font-semibold text-gray-900 mt-6 mb-2",children:"⢠Suspensi\xf3n de clases por causas ajenas a la escuela"}),(0,t.jsx)("p",{className:"mb-4 pl-4",children:"Las clases que deban ser anuladas por causas ajenas a la escuela, tales como estado de alerta, restricciones oficiales, recomendaciones de las autoridades competentes, inclemencias meteorol\xf3gicas graves, emergencias sanitarias, cortes generales de suministro el\xe9ctrico o cualquier otra situaci\xf3n de fuerza mayor, no ser\xe1n recuperables."}),(0,t.jsx)("h4",{className:"text-base font-semibold text-gray-900 mt-6 mb-2",children:"⢠Cuota de mantenimiento"}),(0,t.jsx)("div",{className:"mb-4 pl-4 space-y-2",children:(0,t.jsx)("p",{children:"En aquellos casos en los que el alumno no pueda asistir a las clases durante uno o varios meses por lesi\xf3n u otro motivo justificado, deber\xe1 abonar una cuota de mantenimiento. Durante el mes de agosto tambi\xe9n ser\xe1 obligatorio el abono de dicha cuota. En caso de no realizar el pago de la cuota de mantenimiento, el alumno deber\xe1 abonar nuevamente la matr\xedcula para su reincorporaci\xf3n."})}),(0,t.jsxs)("div",{className:"bg-primary/10 border-l-4 border-primary p-4 mt
1-6 mb-4",children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-gray-900 mb-1",children:"CONFIRMACI\xd3N:"}),(0,t.jsx)("p",{className:"text-sm font-medium text-gray-900",children:"Al aceptar estas condiciones, confirmas que has le\xeddo, comprendido y aceptas todas las normas establecidas por Ritmo y Tumbao."})]})]})}),(0,t.jsx)("div",{className:"px-6 py-4 border-t bg-gray-50",children:(0,t.jsx)(d.$,{type:"button",onClick:()=>s(!1),className:"w-full bg-primary hover:bg-accent text-white",children:"Cerrar"})})]})]})})]})}var e_=a(45344),eC=a(25016);function eS(e){let{estado:s,onClick:a,size:r="md",className:l}=e,i=!!s.visto,n=s.adjunto_url&&"imagen"===s.tipo_contenido?s.adjunto_url:s.autor_foto||null;return(0,t.jsxs)("button",{type:"button",onClick:a,className:(0,eC.cn)("flex flex-col items-center gap-1 group",l),"aria-label":"Estado de ".concat(s.autor_nombre||"la escuela"),children:[(0,t.jsx)("div",{className:(0,eC.cn)("rounded-full p-[2px] border-2 transition",i?"border-gray-300":"border-primary"),children:(0,t.jsx)("div",{className:(0,eC.cn)("sm"===r?"h-12 w-12":"h-16 w-16","rounded-full overflow-hidden bg-gray-200 flex items-center justify-center text-white"),children:n?(0,t.jsx)("img",{src:n,alt:"",className:"w-full h-full object-cover"}):(0,t.jsx)("span",{className:"text-base font-semibold text-gray-500",children:(s.autor_nombre||"?").charAt(0).toUpperCase()})})}),(0,t.jsx)("span",{className:"text-[11px] text-gray-700 line-clamp-1 max-w-[64px] text-center",children:s.autor_nombre||"Escuela"})]})}function ek(e){let{estados:s,initialIndex:a=0,onClose:l,onSeen:i,perEstadoMs:n=5e3}=e,[o,c]=(0,r.useState)(Math.min(a,Math.max(0,s.length-1))),[d,m]=(0,r.useState)(!1),[x,h]=(0,r.useState)(0),u=(0,r.useRef)(null),p=(0,r.useRef)(performance.now()),f=(0,r.useRef)(0),g=(0,r.useRef)(new Set),j=s[o];if((0,r.useEffect)(()=>{j&&(g.current.has(j.id)||(g.current.add(j.id),null==i||i(j)),f.current=0,p.current=performance.now(),h(0))},[o,null==j?void 0:j.id]),(0,r.useEffect)(()=>{if(!j)return;let e=a=>{if(d){p.current=a-f.current,u.current=requestAnimationFrame(e);return}f.current=a-p.current;let t=Math.min(1,f.current/n);if(h(t),t>=1)return void(o<s.length-1?c(e=>e+1):l());u.current=requestAnimationFrame(e)};return u.current=requestAnimationFrame(e),()=>{u.current&&cancelAnimationFrame(u.current)}},[o,d,n,j,s.length,l]),(0,r.useEffect)(()=>{let e=e=>{"Escape"===e.key&&l(),"ArrowRight"===e.key&&c(e=>Math.min(s.length-1,e+1)),"ArrowLeft"===e.key&&c(e=>Math.max(0,e-1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[s.length,l]),!j)return null;let b="imagen"===j.tipo_contenido&&j.adjunto_url,y="video"===j.tipo_contenido&&j.adjunto_url,N="texto"===j.tipo_contenido;return(0,t.jsxs)("div",{className:"fixed inset-0 z-[200] bg-black flex flex-col select-none",children:[(0,t.jsx)("div",{className:"absolute top-0 left-0 right-0 flex gap-1 p-2 z-10",children:s.map((e,s)=>(0,t.jsx)("div",{className:"flex-1 h-0.5 bg-white/30 rounded-full overflow-hidden",children:(0,t.jsx)("div",{className:"h-full bg-white",style:{width:s<o?"100%":s===o?"".concat(100*x,"%"):"0%",transition:s===o?"none":"width 100ms linear"}})},s))}),(0,t.jsxs)("div",{className:"absolute top-3 left-0 right-0 flex items-center gap-3 px-4 z-10",children:[(0,t.jsx)("div",{className:"h-8 w-8 rounded-full overflow-hidden bg-white/30",children:j.autor_foto&&(0,t.jsx)("img",{src:j.autor_foto,alt:"",className:"w-full h-full object-cover"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"text-white text-sm font-medium truncate",children:j.autor_nombre||"Escuela"}),(0,t.jsx)("p",{className:"text-white/70 text-[11px]",children:new Date(j.fecha_creacion).toLocaleString("es-ES",{dateStyle:"short",timeStyle:"short"})})]}),(0,t.jsx)("button",{type:"button",onClick:l,className:"text-white p-1 rounded-full hover:bg-white/10","aria-label":"Cerrar",children:(0,t.jsx)(v.A,{className:"h-5 w-5"})})]}),(0,t.jsx)("button",{type:"button","aria-label":"Anterior",className:"absolute left-0 top-0 bottom-0 w-1/3 z-[5]",onMouseDown:()=>m(!0),onMouseUp:()=>m(!1),onMouseLeave:()=>m(!1),onClick:e=>{"Anterior"===e.target.getAttribute("aria-label")&&c(e=>Math.max(0,e-1))}}),(0,t.jsx)("button",{type:"button","aria-label":"Siguiente",className:"absolute right-0 top-0 bottom-0 w-2/3 z-[5]",onMouseDown:()=>m(!0),onMouseUp:()=>m(!1),onMouseLeave:()=>m(!1),onClick:()=>{o<s.length-1?c(e=>e+1):l()}}),(0,t.jsxs)("div",{className:"flex-1 flex items-center justify-center px-4 pt-16 pb-6",children:[b&&(0,t.jsx)("img",{src:j.adjunto_url,alt:j.contenido||"",className:"max-h-full max-w-full object-contain rounded-md"}),y&&(0,t.jsx)("video",{src:j.adjunto_url,controls:!0,autoPlay:!0,className:"max-h-full max-w-full object-contain rounded-md"}),N&&(0,t.jsx)("div",{className:(0,eC.cn)("w-full h-full flex items-center justify-center rounded-md p-6 text-center text-white text-2xl font-semibold whitespace-pre-wrap break-words"),style:{background:j.fondo_color||"#62d8ac"},children:j.contenido})]}),(b||y)&&j.contenido&&(0,t.jsx)("div",{className:"absolute bottom-4 left-4 right-4 text-white text-sm bg-black/40 rounded-md px-3 py-2 backdrop-blur",children:j.contenido})]})}var eA=a(26983),eE=a(78874),eT=a(6132),eP=a(53409),eR=a(54124);function eF(e){let{pagos:s}=e,[a,l]=(0,r.useState)(!1),[i,n]=(0,r.useState)("todos");(0,r.useEffect)(()=>(a?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[a]);let o=(0,r.useMemo)(()=>"todos"===i?s:s.filter(e=>e.estado===i),[s,i]),c=(0,r.useMemo)(()=>{let e=s.length;return{todos:e,pagados:s.filter(e=>"pagado"===e.estado).length,pendientes:s.filter(e=>"pendiente"===e.estado).length}},[s]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eu.P.div,{layoutId:"historial-pagos-expandible",onClick:()=>l(!0),className:"bg-white rounded-2xl p-4 mb-4 border border-gray-100 cursor-pointer hover:shadow-md transition-shadow",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"w-10 h-10 rounded-full bg-emerald-100 flex items-center justify-center",children:(0,t.jsx)(eP.A,{className:"h-5 w-5 text-emerald-600"})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("p",{className:"font-semibold text-gray-900",children:"Historial de pagos"}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Consulta todos tus pagos"})]}),(0,t.jsx)(T.A,{className:"h-5 w-5 text-gray-400"})]})}),(0,t.jsx)(ep.N,{children:a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eu.P.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"fixed inset-0 bg-black/50 z-50",onClick:()=>l(!1)}),(0,t.jsxs)(eu.P.div,{layoutId:"historial-pagos-expandible",className:"fixed inset-4 md:inset-8 lg:inset-16 z-50 bg-white rounded-2xl shadow-2xl overflow-hidden flex flex-col",transition:{type:"spring",damping:25,stiffness:200,duration:.3},children:[(0,t.jsxs)("div",{className:"px-6 pt-6 pb-4 border-b",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900 text-left",children:"Historial de Pagos"}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-1 text-left",children:"Consulta el historial completo de tus pagos"})]}),(0,t.jsx)("div",{className:"px-6 py-3 border-b bg-gray-50",children:(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)(d.$,{variant:"todos"===i?"default":"outline",size:"sm",onClick:()=>n("todos"),className:"todos"===i?"bg-primary hover:bg-accent":"",children:["Todos (",c.todos,")"]}),(0,t.jsxs)(d.$,{variant:"pagado"===i?"default":"outline",size:"sm",onClick:()=>n("pagado"),className:"pagado"===i?"bg-green-500 hover:bg-green-600":"",children:["Pagados (",c.pagados,")"]}),(0,t.jsxs)(d.$,{variant:"pendiente"===i?"default":"outline",size:"sm",onClick:()=>n("pendiente"),className:"pendiente"===i?"bg-yellow-500 hover:bg-yellow-600":"",children:["Pendientes (",c.pendientes,")"]})]})}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:0===o.length?(0,t.jsxs)("div",{className:"text-center py-12 text-gray-500",children:[(0,t.jsx)(eP.A,{className:"h-12 w-12 mx-auto mb-3 opacity-30"}),(0,t.jsxs)("p",{children:["No hay pagos ","todos"!==i?'con estado "'.concat(i,'"'):""]})]}):(0,t.jsx)("div",{className:"space-y-3",children:o.map(e=>(0,t.jsxs)("div",{className:"rounded-xl border p-4 ".concat("pendiente"===e.estado?"bg-yellow-50 border-yellow-200":"pagado"===e.estado?"bg-white border-gray-100":"bg-gray-50 border-gray-200"),children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"font-semibold text-gray-900 truncate",children:e.concepto}),(0,t.jsxs)("div",{className:"flex items-center gap-3 mt-1 text-sm text-gray-500",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(u.A,{className:"h-3.5 w-3.5"}),"Vence: ",e.fecha_vencimiento]}),e.fecha_pago&&(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(_.A,{className:"h-3.5 w-3.5"}),"Pagado: ",e.fecha_pago]})]})]}),(0,t.jsxs)("div",{className:"text-right flex flex-col items-end gap-1",children:[(0,t.jsxs)("p",{className:"text-xl font-bold ".concat("pendiente"===e.estado?"text-yellow-600":"pagado"===e.estado?"text-gray-900":"text-gray-500"),children:[Number(e.monto).toFixed(2),"â¬"]}),(e=>{switch(e){case"pagado":return(0,t.jsxs)(m.E,{className:"bg-green-100 text-green-700 hover:bg-green-100",children:[(0,t.jsx)(N.A,{className:"h-3 w-3 mr-1"}),"Pagado"]});case"pendiente":return(0,t.jsxs)(m.E,{className:"bg-yellow-100 text-yellow-700 hover:bg-yellow-100",children:[(0,t.jsx)(eA.A,{className:"h-3 w-3 mr-1"}),"Pendiente"]});case"fallido":return(0,t.jsxs)(m.E,{className:"bg-red-100 text-red-700 hover:bg-red-100",children:[(0,t.jsx)(eE.A,{className:"h-3 w-3 mr-1"}),"Fallido"]});case"reembolsado":return(0,t.jsxs)(m.E,{className:"bg-purple-100 text-purple-700 hover:bg-purple-100",children:[(0,t.jsx)(eT.A,{className:"h-3 w-3 mr-1"}),"Reembolsado"]});case"impagado":return(0,t.jsxs)(m.E,{className:"bg-slate-100 text-slate-700 hover:bg-slate-100",title:eR.Pk,children:[(0,t.jsx)(eT.A,{className:"h-3 w-3 mr-1"}),"Impagado"]});default:return(0,t.jsx)(m.E,{variant:"outline",children:e})}})(e.estado)]})]}),e.items&&e.items.length>1&&(0,t.jsxs)("div",{className:"mt-3 pt-3 border-t border-gray-200 space-y-1",children:[(0,t.jsxs)("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide flex items-center gap-1",children:[(0,t.jsx)(j.A,{className:"h-3 w-3"}),"Desglose"]}),e.items.map((e,s)=>(0,t.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600",children:e.descripcion}),(0,t.jsxs)("span",{className:"text-gray-800 font-medium",children:[e.monto.toFixed(2),"â¬"]})]},s))]})]},e.id))})}),(0,t.jsx)("div",{className:"px-6 py-4 border-t bg-gray-50",children:(0,t.jsx)(d.$,{type:"button",onClick:()=>l(!1),className:"w-full bg-primary hover:bg-accent text-white",children:"Cerrar"})})]})]})})]})}function eD(){var e,s,a,i,H,X,K,Q;let Y=(0,l.useRouter)(),ee=(0,o.z)(),es=ee.useUser(),[ea,et]=(0,r.useState)(null),[er,ec]=(0,r.useState)(!0),[ed,em]=(0,r.useState)("perfil"),[ex,eu]=(0,r.useState)([]),[ep,ef]=(0,r.useState)(new Set),[eg,eb]=(0,r.useState)(!1),[ey,ev]=(0,r.useState)(!1),[eC,eA]=(0,r.useState)(null),[eE,eT]=(0,r.useState)(null),[eP,eR]=(0,r.useState)(!1),[eD,eO]=(0,r.useState)(!1),[ez,eM]=(0,r.useState)(!1),[eI,eL]=(0,r.useState)(null),[eJ,eV]=(0,r.useState)(!1),[eq,e$]=(0,r.useState)(!1),[eB,eG]=(0,r.useState)(!1),[eU,eH]=(0,r.useState)(!1),[eW,eZ]=(0,r.useState)(!1),[eX,eK]=(0,r.useState)(!1),[eQ,eY]=(0,r.useState)(!1),[e0,e1]=(0,r.useState)(null),[e2,e5]=(0,r.useState)(null),[e4,e3]=(0,r.useState)([]),[e6,e9]=(0,r.useState)([]),[e8,e7]=(0,r.useState)(null),[se,ss]=(0,r.useState)(null),[sa,st]=(0,r.useState)(!1),[sr,sl]=(0,r.useState)("todos"),[si,sn]=(0,r.useState)("todos"),[so,sc]=(0,r.useState)("todos"),[sd,sm]=(0,r.useState)("todos"),[sx,sh]=(0,r.useState)([]),[su,sp]=(0,r.useState)(""),[sf,sg]=(0,r.useState)(!1),[sj,sb]=(0,r.useState)(!1),[sy,sN]=(0,r.useState)(0),[sv,sw]=(0,r.useState)(!1),[s_,sC]=(0,r.useState)(!1),sS=(0,r.useRef)(null),[sk,sA]=(0,r.useState)({}),[sE,sT]=(0,r.useState)([]),[sP,sR]=(0,r.useState)(!1),[sF,sD]=(0,r.useState)([]),[sO,sz]=(0,r.useState)(!1),[sM,sI]=(0,r.useState)(0),[sL,sJ]=(0,r.useState)(0),[sV,sq]=(0,r.useState)([]),[s$,sB]=(0,r.useState)(null),[sG,sU]=(0,r.useState)(!1),[sH,sW]=(0,r.useState)(!1),[sZ,sX]=(0,r.useState)(null),[sK,sQ]=(0,r.useState)(null),[sY,s0]=(0,r.useState)([]),[s1,s2]=(0,r.useState)(!1),[s5,s4]=(0,r.useState)(null),[s3,s6]=(0,r.useState)(0),[s9,s8]=(0,r.useState)(null),[s7,ae]=(0,r.useState)(null),[as,aa]=(0,r.useState)(!1),[at,ar]=(0,r.useState)(!1),[al,ai]=(0,r.useState)(null),[an,ao]=(0,r.useState)(""),[ac,ad]=(0,r.useState)(!1),[am,ax]=(0,r.useState)(null),[ah,au]=(0,r.useState)(!1),ap=es||eC;(0,r.useEffect)(()=>{(async()=>{try{let s=await fetch("/api/admin/impersonate",{credentials:"include"});if(s.ok){var e;let a=await s.json();(null==(e=a.data)?void 0:e.impersonating)&&(eM(!0),eL(a.data.alumno))}}catch(e){}})()},[]),(0,r.useEffect)(()=>{(async()=>
1{if(void 0!==es){if(es)return eO(!0);try{let a=await fetch("/api/auth/biometric-session");if(a.ok){var e,s;let t=await a.json();(null==(e=t.data)?void 0:e.authenticated)&&(null==(s=t.data)?void 0:s.user)&&eA(t.data.user)}}catch(e){console.error("Error checking biometric session:",e)}finally{eO(!0)}}})()},[es]),(0,r.useEffect)(()=>{!eD||es||eC||ez||Y.push("/alumno/login")},[eD,es,eC,ez,Y]),(0,r.useEffect)(()=>{ap&&eD&&(aj(),ab(),aN())},[ap,eD,eI]),(0,r.useEffect)(()=>{(null==ea?void 0:ea.id)&&(av(),aS(),ay())},[null==ea?void 0:ea.id]),(0,r.useEffect)(()=>{"mensajes"===ed&&(null==ea?void 0:ea.id)&&(aC(),sN(0))},[ed,null==ea?void 0:ea.id]),(0,r.useEffect)(()=>{"eventos"===ed&&(aA(),(null==ea?void 0:ea.id)&&aE())},[ed,null==ea?void 0:ea.id]),(0,r.useEffect)(()=>{(null==ea?void 0:ea.id)&&(aT(),aP(),af())},[null==ea?void 0:ea.id]);let af=async()=>{try{let e=await fetch("/api/estados",{cache:"no-store"}),s=await e.json();s.success&&sq(s.data.estados||[])}catch(e){}},ag=async e=>{try{await fetch("/api/estados/".concat(e.id,"/visto"),{method:"POST"}),sq(s=>s.map(s=>s.id===e.id?{...s,visto:!0}:s))}catch(e){}};(0,r.useEffect)(()=>{if(ez)return;let e=async()=>{try{let e=await fetch("/api/alumno/notificaciones/contadores"),s=await e.json();s.success&&sA(s.data)}catch(e){}};e();let s=setInterval(e,3e4);return()=>clearInterval(s)},[ez]),(0,r.useEffect)(()=>{if((null==ea?void 0:ea.id)&&(null==ea?void 0:ea.fechaNacimiento)){let e=new Date,s=new Date(ea.fechaNacimiento);if(e.getDate()===s.getDate()&&e.getMonth()===s.getMonth()){let e="rt_birthday_seen_".concat(ea.id);sessionStorage.getItem(e)||sU(!0)}}},[null==ea?void 0:ea.id,null==ea?void 0:ea.fechaNacimiento]),(0,r.useEffect)(()=>{(null==ea?void 0:ea.id)&&aR()},[null==ea?void 0:ea.id]),(0,r.useEffect)(()=>{setTimeout(()=>{var e;null==(e=sS.current)||e.scrollIntoView({behavior:"smooth",block:"end"})},100)},[sx]),(0,r.useEffect)(()=>{let e=async()=>{var e;if((null==ea||null==(e=ea.suscripcion)?void 0:e.alumnoSuscripcionId)&&(!ea.proximasClases||0===ea.proximasClases.length))try{(await fetch("/api/alumnos-suscripciones/".concat(ea.suscripcion.alumnoSuscripcionId),{method:"DELETE",credentials:"include"})).ok&&aj()}catch(e){console.error("Error:",e)}};!ea||er||ez||e()},[null==ea||null==(e=ea.suscripcion)?void 0:e.alumnoSuscripcionId,null==ea||null==(s=ea.proximasClases)?void 0:s.length,er]);let aj=async()=>{let e=ez&&eI?eI.email:(null==es?void 0:es.primaryEmail)||(null==eC?void 0:eC.email);if(e){if(!ez){let s="rt_access_logged_".concat(e);sessionStorage.getItem(s)||(sessionStorage.setItem(s,"true"),(0,ei.G)(e,"session").catch(()=>{}))}try{let a=await fetch("/api/alumnos/by-email",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({email:e,fullData:!0})});if(a.ok){var s;let e=null==(s=(await a.json()).data)?void 0:s.alumno;et(e),!e||e.terminosAceptados||ez||sW(!0)}}catch(e){console.error("Error:",e)}finally{ec(!1)}}},ab=async()=>{try{let e=await fetch("/api/suscripciones?activa=true",{credentials:"include"});if(e.ok){let s=await e.json();e3(s.data||[])}}catch(e){console.error("Error:",e)}},ay=async()=>{if(null==ea?void 0:ea.id)try{let e=await fetch("/api/lista-espera?alumno_id=".concat(ea.id),{credentials:"include"});if(e.ok){let s=await e.json();s.success&&Array.isArray(s.data)&&s0(s.data.map(e=>({clase_id:e.clase_id,posicion:e.posicion,clase_nombre:e.clase_nombre})))}}catch(e){console.error("Error fetching lista de espera:",e)}},aN=async()=>{try{let e=await fetch("/api/clases?activa=true",{credentials:"include"});if(e.ok){let s=await e.json();e9(s.data||[])}}catch(e){console.error("Error:",e)}},av=async()=>{if(null==ea?void 0:ea.id){ev(!0);try{let e=await fetch("/api/pagos?alumno_id=".concat(ea.id),{credentials:"include"});if(e.ok){let s=await e.json();eu(s.data||[])}}catch(e){console.error("Error fetching pagos:",e)}finally{ev(!1)}}},aw=async()=>{if(ez)return void Z.oR.info("No disponible en modo vista");if(an.trim()&&al){ad(!0);try{let e=await fetch("/api/descuentos/validar",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({codigo:an.toUpperCase(),alumno_id:null==ea?void 0:ea.id,monto_original:parseFloat(al.monto.toString())})}),s=await e.json();s.success?(ax(s.data),Z.oR.success("\xa1Descuento v\xe1lido! ".concat(s.data.nombre))):(ax(null),Z.oR.error(s.error||"C\xf3digo no v\xe1lido"))}catch(e){Z.oR.error("Error al validar el c\xf3digo"),console.error(e)}finally{ad(!1)}}},a_=async()=>
1{if(ez)return void Z.oR.info("No disponible en modo vista");if(al){au(!0);try{if(al.enlace_pago&&!am&&"pendiente"===al.estado){window.open(al.enlace_pago,"_blank"),ar(!1),au(!1);return}if("pagado"===al.estado){Z.oR.info("Este pago ya est\xe1 completado."),ar(!1),au(!1),av();return}let e=await fetch("/api/pagos/generar-enlace",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({pago_id:al.id,descuento_codigo:am?an.toUpperCase():void 0})}),s=await e.json();s.success?(s.data.pagado_gratis?Z.oR.success("\xa1Pago completado! Tu descuento ha sido aplicado."):window.open(s.data.enlace_pago,"_blank"),ar(!1),av()):Z.oR.error(s.error||"Error al procesar el pago")}catch(e){Z.oR.error("Error al procesar el pago"),console.error(e)}finally{au(!1)}}},aC=async()=>{if((null==ea?void 0:ea.id)&&(null==ea?void 0:ea.email)){sb(!0);try{let s="escuela_alumno_".concat(ea.id),a=await fetch("/api/mensajes?conversacion_id=".concat(s),{credentials:"include"});if(a.ok){var e;let s=await a.json();sh((null==(e=s.data)?void 0:e.mensajes)||s.mensajes||[]),ez||await fetch("/api/mensajes/marcar-leidos",{method:"POST",credentials:"include"})}}catch(e){console.error("Error fetching mensajes:",e)}finally{sb(!1)}}},aS=async()=>{if(null==ea?void 0:ea.id)try{let s=await fetch("/api/mensajes/no-leidos",{credentials:"include"});if(s.ok){var e;let a=await s.json();sN((null==(e=a.data)?void 0:e.count)||0)}}catch(e){console.error("Error fetching no leidos:",e)}},ak=async e=>{if(sk[e])try{await fetch("/api/alumno/notificaciones/leer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({categoria:e})}),sA(s=>({...s,[e]:0}))}catch(e){}},aA=async()=>{sR(!0);try{let e=await fetch("/api/eventos?proximos=true",{credentials:"include"});if(e.ok){let s=await e.json();sT(s.data||[])}}catch(e){console.error("Error fetching eventos:",e)}finally{sR(!1)}},aE=async()=>{sz(!0);try{let e=await fetch("/api/reservas-weekend/mis-reservas",{credentials:"include"});if(e.ok){let s=await e.json();sD(s.data||[])}}catch(e){console.error("Error fetching reservas weekend:",e)}finally{sz(!1)}},aT=async()=>{try{let s=await fetch("/api/encuestas?pendientes=true",{credentials:"include"});if(s.ok){var e;let a=await s.json();sI((null==(e=a.data)?void 0:e.length)||0)}}catch(e){console.error("Error fetching encuestas:",e)}},aP=async()=>{try{let e=await fetch("/api/alumno/listas",{credentials:"include"});if(e.ok){let s=((await e.json()).data||[]).filter(e=>!e.ya_apuntado);sJ(s.length)}}catch(e){console.error("Error fetching listas abiertas:",e)}},aR=async()=>{try{var e,s,a;let t=await fetch("/api/alumnos/me/pagador",{credentials:"include"});if(t.ok){let s=await t.json();(null==(e=s.data)?void 0:e.pagador)?sX(s.data.pagador):sX(null)}let r=await fetch("/api/alumnos/me/dependientes",{credentials:"include"});if(r.ok){let e=await r.json();(null==(a=e.data)||null==(s=a.dependientes)?void 0:s.length)>0?sQ({dependientes:e.data.dependientes.map(e=>({...e,pagos_pendientes:Array.isArray(e.pagos)?e.pagos.reduce((e,s)=>e+(s.monto||0),0):0})),total_pendiente:e.data.total_pendiente||0}):sQ(null)}}catch(e){console.error("Error fetching relaciones de pago:",e)}},[aF,aD]=(0,r.useState)([]),[aO,az]=(0,r.useState)([]),aM=async()=>{if(ez)return void Z.oR.info("No disponible en modo vista");if(!su.trim()||!(null==ea?void 0:ea.id)||!(null==ea?void 0:ea.email))return;let e=su.trim();sp(""),sg(!0),sC(!0);let s={id:Date.now(),esBot:!1,contenido:e,fecha:new Date().toISOString()};az(e=>[...e,s]),setTimeout(()=>{var e;null==(e=sS.current)||e.scrollIntoView({behavior:"smooth",block:"end"})},100);try{var a;let s=[...aF,{role:"user",content:e}],t=await fetch("/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({mensaje:e,historial:aF})}),r=await t.json();if(r.success&&(null==(a=r.data)?void 0:a.respuesta)){let e=r.data.respuesta,a={id:Date.now()+1,esBot:!0,contenido:e,fecha:new Date().toISOString()};az(e=>[...e,a]),aD([...s,{role:"assistant",content:e}])}else Z.oR.error(r.error||"Error al procesar tu mensaje")}catch(e){Z.oR.error("Error de conexi\xf3n con el asistente")}finally{sg(!1),sC(!1),setTimeout(()=>{var e;null==(e=sS.current)||e.scrollIntoView({behavior:"smooth",block:"end"})},200)}},aI=async()=>{try{await fetch("/api/admin/impersonate",{method:"DELETE"})}catch(e){}window.location.href="/admin/dashboard/alumnos"},aL=async()=>
1{if(ez)return void aI();(null==ea?void 0:ea.id)&&sessionStorage.removeItem("rt_birthday_seen_".concat(ea.id));try{await fetch("/api/auth/biometric-session",{method:"DELETE"})}catch(e){}es&&await ee.signOut(),eA(null),Y.push("/alumno/login")},aJ=(null==ea||null==(a=ea.proximasClases)?void 0:a.filter(e=>!e.esRefuerzo).length)||0,aV=e=>e<=1?e4.find(e=>1===e.num_clases_mes)||null:2===e?e4.find(e=>2===e.num_clases_mes)||null:e4.find(e=>null===e.num_clases_mes||-1===e.num_clases_mes)||null,aq=async()=>{if(ez)return void Z.oR.info("No disponible en modo vista");if(e8&&ea){st(!0);try{let e=await fetch("/api/inscripciones",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({alumno_id:ea.id,clase_id:e8.id})});if(e.ok)Z.oR.success("Te has inscrito a ".concat(e8.nombre)),eG(!1),e$(!1),e7(null),aj();else{let s=await e.json();Z.oR.error(s.error||"Error al inscribirse")}}catch(e){Z.oR.error("Error al inscribirse")}finally{st(!1)}}},a$=async()=>{if(ez)return void Z.oR.info("No disponible en modo vista");if(e8&&ea&&se){st(!0);try{var e;(null==(e=ea.suscripcion)?void 0:e.alumnoSuscripcionId)?await fetch("/api/alumnos-suscripciones/".concat(ea.suscripcion.alumnoSuscripcionId),{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({suscripcion_id:se.id})}):await fetch("/api/alumnos-suscripciones",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({alumno_id:ea.id,suscripcion_id:se.id,fecha_inicio:new Date().toISOString().split("T")[0],activa:!0})});let s=await fetch("/api/inscripciones",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({alumno_id:ea.id,clase_id:e8.id})});if(s.ok)Z.oR.success("Te has inscrito a ".concat(e8.nombre)),eH(!1),e$(!1),e7(null),ss(null),aj();else{let e=await s.json();Z.oR.error(e.error||"Error")}}catch(e){Z.oR.error("Error")}finally{st(!1)}}},aB=async()=>{var e;if(ez)return void Z.oR.info("No disponible en modo vista");if(null==ea||null==(e=ea.suscripcion)?void 0:e.alumnoSuscripcionId){st(!0);try{(await fetch("/api/alumnos-suscripciones/".concat(ea.suscripcion.alumnoSuscripcionId),{method:"DELETE",credentials:"include"})).ok?(Z.oR.success("Suscripci\xf3n cancelada"),eZ(!1),aj()):Z.oR.error("Error")}catch(e){Z.oR.error("Error")}finally{st(!1)}}},aG=async()=>{if(ez)return void Z.oR.info("No disponible en modo vista");if(e0&&ea){st(!0);try{if(e2){var e;(null==(e=ea.suscripcion)?void 0:e.alumnoSuscripcionId)?await fetch("/api/alumnos-suscripciones/".concat(ea.suscripcion.alumnoSuscripcionId),{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({suscripcion_id:e2.id})}):await fetch("/api/alumnos-suscripciones",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({alumno_id:ea.id,suscripcion_id:e2.id,activa:!0})})}let s=await fetch("/api/inscripciones",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({alumno_id:ea.id,clase_id:e0.id})});if(s.ok)Z.oR.success("\xa1Genial! Te has inscrito en ".concat(e0.nombre),{duration:4e3}),eY(!1),e1(null),e5(null),aj(),aN();else{let e=await s.json();Z.oR.error(e.error||"Error al inscribirse")}}catch(e){Z.oR.error("Error al procesar la inscripci\xf3n")}finally{st(!1)}}},aU=async()=>{if(ez)return void Z.oR.info("No disponible en modo vista");if(s5&&ea){st(!0);try{let e=await fetch("/api/lista-espera",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({alumno_id:ea.id,clase_id:s5.id})}),s=await e.json();e.ok&&s.success?(Z.oR.success(s.message||"Te has apuntado a la lista de espera",{duration:4e3}),s2(!1),s4(null),ay()):Z.oR.error(s.error||"Error al apuntarse a la lista de espera")}catch(e){Z.oR.error("Error al procesar la solicitud")}finally{st(!1)}}},aH=e=>{if(!e)return"";let[s,a]=e.split(":"),t=parseInt(a||"0");return t>0?"".concat(parseInt(s),":").concat(String(t).padStart(2,"0"),"h"):"".concat(parseInt(s),"h")},aW=e=>e?e.charAt(0).toUpperCase()+e.slice(1):"",aZ=(0,r.useMemo)(()=>{let e=new Set;
1return e6.forEach(s=>e.add(s.dia_semana.toLowerCase())),Array.from(e).sort((e,s)=>{let a=["lunes","martes","miercoles","jueves","viernes","sabado","domingo"];return a.indexOf(e)-a.indexOf(s)})},[e6]),aX=(0,r.useMemo)(()=>{let e=new Set;return e6.forEach(s=>s.tipo_baile&&e.add(s.tipo_baile)),Array.from(e).sort()},[e6]),aK=(0,r.useMemo)(()=>{let e=new Set;return e6.forEach(s=>s.nivel&&e.add(s.nivel)),Array.from(e).sort()},[e6]),aQ=(0,r.useMemo)(()=>{let e=new Set;return e6.forEach(s=>{s.profesor_nombre&&e.add("".concat(s.profesor_nombre," ").concat(s.profesor_apellidos||"")),s.profesor_2_nombre&&e.add("".concat(s.profesor_2_nombre," ").concat(s.profesor_2_apellidos||""))}),Array.from(e).sort()},[e6]),aY=(0,r.useMemo)(()=>e6.filter(e=>{if("todos"!==sr&&e.dia_semana.toLowerCase()!==sr||"todos"!==si&&e.tipo_baile!==si||"todos"!==so&&e.nivel!==so)return!1;if("todos"!==sd){let s="".concat(e.profesor_nombre||""," ").concat(e.profesor_apellidos||"").trim(),a="".concat(e.profesor_2_nombre||""," ").concat(e.profesor_2_apellidos||"").trim();if(s!==sd&&a!==sd)return!1}return!0}),[e6,sr,si,so,sd]),a0=(0,r.useMemo)(()=>{let e={};return["lunes","martes","miercoles","jueves","viernes","sabado","domingo"].forEach(s=>{let a=aY.filter(e=>e.dia_semana.toLowerCase()===s);a.length>0&&(e[s]=a.sort((e,s)=>e.hora_inicio.localeCompare(s.hora_inicio)))}),e},[aY]),a1=()=>{sl("todos"),sn("todos"),sc("todos"),sm("todos")},a2=ex.filter(e=>"pendiente"===e.estado);if(!ap)return(0,t.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:(0,t.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary"})});(0,r.useEffect)(()=>{"qr"===ed&&(null==ea?void 0:ea.id)&&!eE&&!eP&&(eR(!0),fetch("/api/alumnos/me/asistencias").then(e=>e.json()).then(e=>{e.success&&eT(e.data)}).catch(()=>{}).finally(()=>eR(!1)))},[ed,null==ea?void 0:ea.id]);let a5=ea?JSON.stringify({id:ea.id,email:ea.email,nombre:"".concat(ea.nombre," ").concat(ea.apellidos),ts:Date.now()}):"",a4=e=>{let s=[];return e.profesorNombre&&s.push(e.profesorNombre),e.profesor2Nombre&&s.push(e.profesor2Nombre),s.length>0?s.join(" y "):null},a3=(0,r.useMemo)(()=>{if(!e6||0===e6.length)return[];let e=["iniciaci\xf3n","inicio 1","inicio 2","b\xe1sico","inicio"];if(!(null==ea?void 0:ea.proximasClases)||0===ea.proximasClases.length)return e6.filter(s=>{var a;let t=(null==(a=s.nivel)?void 0:a.toLowerCase())||"";return e.some(e=>t.includes(e))}).slice(0,6);let s=new Set(ea.proximasClases.map(e=>{var s;return null==(s=e.tipoBaile)?void 0:s.toLowerCase()}));return e6.filter(a=>{var t,r,l;if((null==(t=ea.proximasClases)?void 0:t.some(e=>e.id===a.id))||s.has(null==(r=a.tipo_baile)?void 0:r.toLowerCase()))return!1;let i=(null==(l=a.nivel)?void 0:l.toLowerCase())||"";return e.some(e=>i.includes(e))}).slice(0,6)},[null==ea?void 0:ea.proximasClases,e6]);return(0,r.useEffect)(()=>{if(a3.length<=1||as)return;let e=setInterval(()=>{s6(e=>(e+1)%a3.length)},4e3);return()=>clearInterval(e)},[a3.length,as]),(0,t.jsxs)("div",{className:"min-h-screen bg-gray-50",children:[ez&&eI&&(0,t.jsxs)("div",{className:"sticky top-0 z-50 bg-amber-500 text-white px-4 py-3 shadow-md",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,t.jsx)(L.A,{className:"h-4 w-4 shrink-0"}),(0,t.jsxs)("span",{children:["Viendo como: ",eI.nombre," ",eI.apellidos]})]}),(0,t.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,t.jsx)("span",{className:"flex-1 bg-white/20 px-3 py-1.5 rounded-lg text-xs font-medium text-center",children:"Solo lectura"}),(0,t.jsxs)("button",{onClick:aI,className:"flex-1 flex items-center justify-center gap-1 text-sm font-medium bg-white/20 hover:bg-white/30 px-3 py-1.5 rounded-lg transition-colors",children:[(0,t.jsx)(v.A,{className:"h-4 w-4"}),"Salir"]})]})]}),sG&&ea&&(0,t.jsx)(eN,{nombre:ea.nombre,onComplete:()=>{if(null==ea?void 0:ea.id){let e="rt_birthday_seen_".concat(ea.id);sessionStorage.setItem(e,"true"),sU(!1)}}}),(0,t.jsx)("main",{className:"".concat(sv?"h-[100dvh]":ez?"h-[calc(100vh-148px)]":"h-[calc(100vh-100px)]"," pb-4"),children:er?(0,t.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,t.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary"})}):(0,t.jsxs)(t.Fragment,{children:["clases"===ed&&(0,t.jsxs)("div",{className:"flex flex-col px-5 pt-6 pb-4 animate-in fade-in duration-200 overflow-y-auto",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-gray-900",children:"Mis Clases"}),(0,t.jsx)("p",{className:"text-gray-500 mt-1",children:"Tu horario semanal"})]}),(0,t.jsx)("div",{className:"space-y-3",children:(null==ea?void 0:ea.proximasClases)&&ea.proximasClases.length>0?ea.proximasClases.map(e=>(0,t.jsx)("div",{className:"bg-white rounded-2xl p-4 shadow-sm border border-gray-100",children:(0,t.jsx)("div",{className:"flex items-start justify-between",children:(0,t.jsxs)("div",{className:"flex items-start gap-3 flex-1",children:[(0,t.jsx)("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center shrink-0 mt-0.5",children:(0,t.jsx)(u.A,{className:"h-5 w-5 text-primary"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,t.jsx)("p",{className:"font-semibold text-gray-900",children:e.nombre}),e.nivel&&(0,t.jsx)(m.E,{variant:"outline",className:"text-xs bg-primary/10 text-primary border-primary/30",children:e.nivel}),e.esRefuerzo&&(0,t.jsx)(m.E,{className:"text-xs bg-purple-100 text-purple-700 border-none",title:"Vas de refuerzo: esta clase no te cuenta para la cuota",children:"Refuerzo"})]}),(0,t.jsx)("p",{className:"text-gray-500 text-sm mt-1",children:e.horario}),(0,t.jsxs)("div",{className:"flex items-center gap-3 mt-1 text-xs text-gray-400",children:[e.aula&&(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(p.A,{className:"h-3 w-3"}),e.aula]}),a4(e)&&(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(f.A,{className:"h-3 w-3"}),a4(e)]})]})]})]})})},e.id)):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-8",children:[(0,t.jsx)("div",{className:"w-20 h-20 rounded-full bg-gray-100 flex items-center justify-center mb-4",children:(0,t.jsx)(u.A,{className:"h-10 w-10 text-gray-300"})}),(0,t.jsx)("p",{className:"text-gray-400 text-lg",children:"No tienes clases a\xfan"}),(0,t.jsx)("p",{className:"text-gray-300",children:"Explora los horarios disponibles"})]})}),(0,t.jsxs)(d.$,{className:"w-full h-14 text-lg font-semibold bg-primary hover:bg-accent text-white rounded-2xl shadow-lg shadow-primary/30 mt-6",onClick:()=>{aN(),ab(),e$(!0)},children:[(0,t.jsx)(u.A,{className:"h-4 w-4"}),"Ver horarios y apuntarme"]}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(ej,{})}),a3.length>0&&(0,t.jsxs)("div",{className:"mt-4 mb-3",children:[(0,t.jsxs)("p",{className:"text-sm text-gray-500 mb-2 flex items-center gap-1.5 font-medium",children:[(0,t.jsx)(g.A,{className:"h-4 w-4 text-purple-500"}),"Tambi\xe9n te puede interesar"]}),(0,t.jsxs)("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-purple-100 via-pink-50 to-purple-50 p-4 shadow-sm border border-purple-100 touch-pan-y",onTouchStart:e=>{ae(null),s8(e.targetTouches[0].clientX),aa(!0)},onTouchMove:e=>{ae(e.targetTouches[0].clientX)},onTouchEnd:()=>
1{if(!s9||!s7)return void aa(!1);let e=s9-s7;e>50&&s3<a3.length-1?s6(e=>e+1):e<-50&&s3>0&&s6(e=>e-1),setTimeout(()=>aa(!1),5e3)},children:[(0,t.jsx)("div",{className:"flex transition-transform duration-300 ease-out",style:{transform:"translateX(-".concat(100*s3,"%)")},children:a3.map((e,s)=>{var a,r;return(0,t.jsxs)("div",{className:"w-full shrink-0 px-1",children:[(0,t.jsxs)("div",{className:"flex items-start gap-4",children:[(0,t.jsx)("div",{className:"w-14 h-14 rounded-xl bg-white flex items-center justify-center shadow-md shrink-0",children:(0,t.jsx)(j.A,{className:"h-7 w-7 text-purple-500"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 pr-2",children:[(0,t.jsx)("p",{className:"font-bold text-gray-900 text-lg",children:e.nombre}),(0,t.jsxs)("p",{className:"text-sm text-gray-600 mt-0.5",children:[aW(e.dia_semana)," ",null==(a=e.hora_inicio)?void 0:a.substring(0,5),"h - ",null==(r=e.hora_fin)?void 0:r.substring(0,5),"h"]}),(e.profesor_nombre||e.profesor_2_nombre)&&(0,t.jsxs)("p",{className:"text-sm text-gray-500 mt-1 flex items-center gap-1",children:[(0,t.jsx)(f.A,{className:"h-3.5 w-3.5"}),e.profesor_nombre&&"".concat(e.profesor_nombre),e.profesor_nombre&&e.profesor_2_nombre&&" y ",e.profesor_2_nombre&&"".concat(e.profesor_2_nombre)]})]})]}),(0,t.jsx)("div",{className:"mt-3 flex items-center justify-end",children:(0,t.jsx)(d.$,{size:"sm",className:"h-9 px-4 text-sm bg-purple-500 hover:bg-purple-600 text-white font-semibold rounded-xl shadow-sm",onClick:()=>(e=>{let s=sY.find(s=>s.clase_id===e.id);if(s)return void Z.oR.info("Ya est\xe1s en lista de espera (posici\xf3n ".concat(s.posicion,")"));if(e.inscritos>=e.aforo_maximo){s4(e),s2(!0);return}e1(e);let a=null==ea?void 0:ea.suscripcion,t=aV(aJ+1);a?null!==a.clases&&-1!==a.clases&&t&&null!==t.num_clases_mes&&t.num_clases_mes>(a.clases||0)?e5(t):e5(null):e5(t),eY(!0)})(e),children:"\xa1Probar!"})})]},e.id)})}),a3.length>1&&(0,t.jsx)("div",{className:"flex justify-center gap-1.5 mt-3",children:a3.map((e,s)=>(0,t.jsx)("button",{onClick:()=>s6(s),className:"w-2 h-2 rounded-full transition-colors ".concat(s===s3?"bg-purple-500":"bg-purple-200")},s))})]})]})]}),"qr"===ed&&(0,t.jsxs)("div",{className:"flex flex-col h-full px-4 pt-4 pb-2 animate-in fade-in duration-200",children:[(0,t.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center",children:[ea?(0,t.jsx)("div",{className:"bg-white p-4 rounded-2xl shadow-lg border-2 border-primary/20",children:(0,t.jsx)(en.h,{value:a5,size:160,level:"H",includeMargin:!0,fgColor:"#1f2937",bgColor:"#ffffff"})}):(0,t.jsx)("div",{className:"animate-pulse bg-gray-200 h-[160px] w-[160px] rounded-2xl"}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-3 text-center",children:"Mu\xe9stralo al llegar a clase"})]}),(0,t.jsx)("div",{className:"border-t border-gray-200 my-3"}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-y-auto",children:[(0,t.jsxs)("h2",{className:"text-lg font-bold text-gray-900 flex items-center gap-2 mb-3",children:[(0,t.jsx)(b.A,{className:"h-5 w-5 text-primary"}),"Mi Asistencia"]}),eP?(0,t.jsx)("div",{className:"flex justify-center py-6",children:(0,t.jsx)(y.A,{className:"h-6 w-6 animate-spin text-primary"})}):eE?(0,t.jsxs)("div",{className:"space-y-3",children:[(null==(i=eE.resumen)?void 0:i.length)>0&&(0,t.jsx)("div",{className:"space-y-2",children:eE.resumen.map(e=>{let s=e.total>0?Math.round(e.asistencias/e.total*100):0;return(0,t.jsxs)("div",{className:"bg-white rounded-lg p-3 border border-gray-100",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-800",children:e.clase_nombre}),(0,t.jsxs)("span",{className:"text-sm font-bold text-primary",children:[s,"%"]})]}),(0,t.jsx)("div",{className:"w-full h-2 bg-gray-100 rounded-full overflow-hidden",children:(0,t.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:"".concat(s,"%")}})}),(0,t.jsxs)("p",{className:"text-xs text-gray-400 mt-1",children:[e.asistencias," de ",e.total," clases"]}
1)]},e.clase_id)})}),(null==(H=eE.historial)?void 0:H.length)>0&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Historial"}),eE.historial.slice(0,15).map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex items-center justify-between py-2 border-b border-gray-50 last:border-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[e.presente?(0,t.jsx)(N.A,{className:"h-4 w-4 text-green-500"}):(0,t.jsx)(v.A,{className:"h-4 w-4 text-red-400"}),(0,t.jsx)("span",{className:"text-sm text-gray-700",children:e.clase_nombre})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(null==(a=e.notas)?void 0:a.includes("QR"))&&(0,t.jsx)("span",{className:"text-[10px] bg-primary/10 text-primary px-1.5 py-0.5 rounded font-medium",children:"QR"}),(0,t.jsx)("span",{className:"text-xs text-gray-400",children:new Date(e.fecha).toLocaleDateString("es-ES",{day:"2-digit",month:"short"})})]})]},s)})]}),(null==(X=eE.resumen)?void 0:X.length)===0&&(null==(K=eE.historial)?void 0:K.length)===0&&(0,t.jsx)("p",{className:"text-sm text-gray-400 text-center py-4",children:"A\xfan no hay registros de asistencia"})]}):(0,t.jsx)("p",{className:"text-sm text-gray-400 text-center py-4",children:"No se pudieron cargar las asistencias"})]})]}),"eventos"===ed&&(0,t.jsxs)("div",{className:"flex flex-col h-full px-4 pt-4 pb-2 animate-in fade-in duration-200",children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsxs)("h1",{className:"text-xl font-bold text-gray-900 flex items-center gap-2",children:[(0,t.jsx)(F.A,{className:"h-6 w-6 text-primary"}),"Eventos"]})}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-4",children:[sF.length>0&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("h2",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide flex items-center gap-2",children:[(0,t.jsx)(D.A,{className:"h-4 w-4"}),"Mis reservas Weekend"]}),sF.map(e=>{let s=parseFloat(e.precio_total)-parseFloat(e.total_pagado||"0");return(0,t.jsxs)("div",{className:"bg-gradient-to-br from-purple-50 to-indigo-50 rounded-2xl border border-purple-100 overflow-hidden",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-purple-500 to-indigo-500 px-4 py-2 flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-white font-semibold text-sm",children:e.evento_nombre}),(0,t.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full ".concat("pagado"===e.estado?"bg-green-400/20 text-green-100":"bg-yellow-400/20 text-yellow-100"),children:"pagado"===e.estado?"â Pagado":"Pendiente"})]}),(0,t.jsxs)("div",{className:"p-4 space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[(0,t.jsx)(u.A,{className:"h-4 w-4 text-purple-500"}),(0,t.jsxs)("span",{children:[new Date(e.evento_fecha_inicio).toLocaleDateString("es-ES",{day:"numeric",month:"short"})," - ",new Date(e.evento_fecha_fin).toLocaleDateString("es-ES",{day:"numeric",month:"short",year:"numeric"})]})]}),e.evento_lugar&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[(0,t.jsx)(p.A,{className:"h-4 w-4 text-purple-500"}),(0,t.jsx)("span",{children:e.evento_lugar})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[(0,t.jsx)(O.A,{className:"h-4 w-4 text-purple-500"}),(0,t.jsxs)("span",{children:[e.hotel_nombre," ⢠",e.tipo_habitacion," ⢠",e.num_noches," noches"]})]}),e.num_acompanantes>0&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[(0,t.jsx)(w.A,{className:"h-4 w-4 text-purple-500"}),(0,t.jsxs)("span",{children:[e.num_acompanantes," acompa\xf1ante",e.num_acompanantes>1?"s":""]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-purple-100",children:[(0,t.jsxs)("div",{className:"text-sm",children:[(0,t.jsx)("span",{className:"text-gray-500",children:"Total: "}),(0,t.jsxs)("span",{className:"font-bold text-gray-800",children:[parseFloat(e.precio_total).toFixed(0),"â¬"]})]}),s>0?(0,t.jsxs)("div",{className:"text-sm text-orange-600",children:["Pendiente: ",(0,t.jsxs)("span",{className:"font-bold",children:[s.toFixed(0),"â¬"]})]}):(0,t.jsxs)("div",{className:"text-sm text-green-600 font-medium flex items-center gap-1",children:[(0,t.jsx)(N.A,{className:"h-4 w-4"}),"Pagado completo"]})]}),(0,t.jsxs)("div",{className:"text-xs text-gray-400 text-center pt-1",children:["C\xf3digo: ",(0,t.jsx)("span",{className:"font-mono",children:e.codigo_qr})]})]})]},e.id)})]}),(0,t.jsx)("div",{className:"space-y-3",children:sP?(0,t.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,t.jsx)(y.A,{className:"h-8 w-8 animate-spin text-primary"})}):0===sE.length?(0,t.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center text-center py-8",children:[(0,t.jsx)("div",{className:"w-20 h-20 rounded-full bg-gradient-to-br from-primary/20 to-primary/5 flex items-center justify-center mb-4",children:(0,t.jsx)(z.A,{className:"h-10 w-10 text-primary"})}),(0,t.jsx)("p",{className:"text-gray-600 font-medium mb-1",children:"No hay eventos pr\xf3ximos"}),(0,t.jsx)("p",{className:"text-gray-400 text-sm",children:"\xa1Pronto anunciaremos nuevos socials!"})]}):sE.map(e=>(0,t.jsxs)("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[e.imagen_url&&(0,t.jsx)("div",{className:"h-28 bg-gradient-to-r from-primary to-accent relative",children:(0,t.jsx)(c.default,{src:e.imagen_url,alt:e.nombre,fill:!0,className:"object-cover",style:{objectPosition:e.imagen_posicion||"center"},unoptimized:e.imagen_url.startsWith("/uploads")})}),!e.imagen_url&&(0,t.jsx)("div",{className:"h-20 bg-gradient-to-r from-primary to-accent flex items-center justify-center",children:(0,t.jsx)(z.A,{className:"h-10 w-10 text-white/80"})}),(0,t.jsxs)("div",{className:"p-3",children:[(0,t.jsx)("h3",{className:"font-bold text-gray-900",children:e.nombre}),(0,t.jsxs)("div",{className:"mt-2 space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,t.jsx)(u.A,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:new Date(e.fecha_inicio).toLocaleDateString("es-ES",{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})})]}),e.lugar&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,t.jsx)(p.A,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:e.lugar})]})]}),(e.dj||e.artistas_invitados)&&(0,t.jsxs)("div",{className:"mt-2 pt-2 border-t border-gray-100 text-sm text-gray-600 space-y-0.5",children:[e.dj&&(0,t.jsxs)("p",{className:"truncate",children:[(0,t.jsx)("span",{className:"font-medium text-purple-600",children:"DJ"})," ",e.dj]}),e.artistas_invitados&&(0,t.jsxs)("p",{className:"truncate",children:[(0,t.jsx)("span",{className:"font-medium text-amber-600",children:"Profes"})," ",e.artistas_invitados]})]}),(0,t.jsxs)(d.$,{className:"w-full mt-3 bg-primary hover:bg-accent h-10 font-semibold text-white",onClick:()=>Y.push("/alumno/eventos/".concat(e.id)),children:[(0,t.jsx)(M.A,{className:"h-4 w-4 mr-2"}),"Ver evento"]})]})]},e.id))})]})]}),"mensajes"===ed&&(0,t.jsxs)("div",{className:"flex flex-col h-full animate-in fade-in duration-200",children:[(0,t.jsxs)("div",{className:"bg-white border-b px-4 py-3 flex items-center gap-3 shrink-0",children:[(0,t.jsx)(c.default,{src:"/logo.webp",alt:"RT",width:40,height:40,className:"w-10 h-10 rounded-full"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"font-bold text-gray-900",children:"Ritmo y Tumbao"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"Miguel Tumbao"})]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto px-4 py-4 bg-gray-50",children:0===aO.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[(0,t.jsx)(c.default,{src:"/logo.webp",alt:"RT",width:64,height:64,className:"w-16 h-16 rounded-full mb-4"}),(0,t.jsx)("p",{className:"text-gray-500 font-medium",children:"Hola! Soy Miguel Tumbao, tu asistente"}),(0,t.jsx)("p",{className:"text-gray-400 text-sm mt-1",children:"Pregunta sobre horarios, pagos, clases o eventos"}),(0,t.jsx)("div",{className:"mt-4 flex flex-wrap justify-center gap-2",children:["Mis clases de esta semana","Pagos pen
1dientes","Mi suscripci\xf3n","Pr\xf3ximos eventos"].map(e=>(0,t.jsx)("button",{onClick:()=>sp(e),className:"text-xs bg-white border border-gray-200 rounded-full px-3 py-1.5 text-gray-600 hover:bg-gray-50 hover:border-primary/30 transition-colors",children:e},e))})]}):(0,t.jsxs)("div",{className:"space-y-3",children:[aO.map(e=>{var s,a;return(0,t.jsxs)("div",{className:"flex ".concat(e.esBot?"justify-start":"justify-end"),children:[e.esBot&&(0,t.jsx)("div",{className:"flex-shrink-0 mr-2 mt-1",children:(0,t.jsx)(c.default,{src:"/logo.webp",alt:"RT",width:28,height:28,className:"w-7 h-7 rounded-full"})}),(0,t.jsxs)("div",{className:"max-w-[85%] px-4 py-2 rounded-2xl ".concat(e.esBot?"bg-white border border-gray-200 text-gray-900 rounded-bl-md":"bg-primary text-white rounded-br-md"),children:[(0,t.jsx)("p",{className:"text-base break-words whitespace-pre-wrap",children:(s=e.contenido,a=!e.esBot,s.split(/(https?:\/\/[^\s]+)/g).map((e,s)=>{if(/^https?:\/\//.test(e)){let r=e.includes("/pago/")||e.includes("/tpv/")||e.includes("payment")||e.includes("redirigir")?"\uD83D\uDCB3 Enlace de pago":e.length>35?e.substring(0,35)+"...":e;return(0,t.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium ".concat(a?"text-white hover:text-white/80":"text-primary hover:text-accent"),children:r},s)}return e}))}),(0,t.jsx)("p",{className:"text-xs mt-1 ".concat(e.esBot?"text-gray-400":"text-white/70"),children:new Date(e.fecha).toLocaleTimeString("es-ES",{hour:"2-digit",minute:"2-digit"})})]})]},e.id)}),s_&&(0,t.jsxs)("div",{className:"flex justify-start",children:[(0,t.jsx)("div",{className:"flex-shrink-0 mr-2 mt-1",children:(0,t.jsx)(c.default,{src:"/logo.webp",alt:"RT",width:28,height:28,className:"w-7 h-7 rounded-full"})}),(0,t.jsx)("div",{className:"bg-white border border-gray-200 rounded-2xl rounded-bl-md px-4 py-3",children:(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),(0,t.jsx)("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),(0,t.jsx)("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})})]}),(0,t.jsx)("div",{ref:sS})]})}),(0,t.jsx)("div",{className:"bg-white border-t px-3 py-2 shrink-0 ".concat(sv?"pb-[calc(0.5rem+env(safe-area-inset-bottom))]":""),children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(eo.p,{onEmojiSelect:e=>sp(s=>s+e),buttonSize:"xl"}),(0,t.jsx)(U.p,{value:su,onChange:e=>sp(e.target.value),placeholder:"Pregunta a Miguel...",className:"flex-1 h-11 rounded-full bg-gray-100 border-0 focus-visible:ring-primary",onFocus:()=>sw(!0),onBlur:()=>sw(!1),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),aM())}}),(0,t.jsx)(d.$,{onClick:aM,disabled:!su.trim()||sf,className:"h-11 w-11 rounded-full bg-primary hover:bg-accent p-0",children:sf?(0,t.jsx)(y.A,{className:"h-5 w-5 animate-spin text-white"}):(0,t.jsx)(I.A,{className:"h-5 w-5 text-white"})})]})})]}),"perfil"===ed&&(0,t.jsxs)("div",{className:"flex flex-col h-full px-5 pt-4 pb-4 animate-in fade-in duration-200 overflow-y-auto",children:[(0,t.jsxs)("div",{className:"text-center mb-4",children:[(0,t.jsx)(c.default,{src:"https://ritmoytumbao-ds.es/wp-content/uploads/2022/08/Logo-Recto-Ritmo-y-Tumbao.webp",alt:"Ritmo y Tumbao",width:280,height:70,priority:!0,className:"mx-auto mb-3",style:{width:"auto",height:"64px"}}),(0,t.jsxs)("h1",{className:"text-2xl font-bold text-gray-900",children:[null==ea?void 0:ea.nombre," ",null==ea?void 0:ea.apellidos]}),(0,t.jsx)("p",{className:"text-gray-400",children:null==ea?void 0:ea.email})]}),sZ&&(0,t.jsx)("div",{className:"bg-blue-50 border-2 border-blue-200 rounded-2xl p-4 mb-4 shadow-sm",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center",children:(0,t.jsx)(b.A,{className:"h-5 w-5 text-blue-600"})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("p",{className:"font-bold text-blue-800",children:["Tu cuota es gestionada por ",sZ.nombre," ",sZ.apellidos]}),(0,t.jsx)("p",{className:"text-sm text-blue-600",children:"No necesitas realizar el pago mensual"})]})]})}),sK&&sK.dependientes.length>0&&(0,t.jsxs)("div",{className:"bg-purple-50 border-2 border-purple-200 rounded-2xl p-4 mb-4 shadow-sm",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-full bg-purple-100 flex items-center justify-center",children:(0,t.jsx)(w.A,{className:"h-5 w-5 text-purple-600"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-bold text-purple-800",children:"Personas a tu cargo"}),(0,t.jsxs)("p",{className:"text-sm text-purple-600",children:[sK.dependientes.length," ",1===sK.dependientes.length?"persona depende":"personas dependen"," de ti para el pago"]})]})]}),(0,t.jsxs)("div",{className:"bg-white rounded-xl p-3 border border-purple-200 space-y-2",children:[sK.dependientes.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between py-2 border-b border-gray-100 last:border-0",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{className:"font-medium text-gray-900",children:[e.nombre," ",e.apellidos]}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"A tu cargo"})]}
1),(0,t.jsx)("span",{className:"font-bold ".concat(e.pagos_pendientes>0?"text-purple-700":"text-green-600"),children:e.pagos_pendientes>0?"".concat(e.pagos_pendientes.toFixed(2),"â¬"):"â Al d\xeda"})]},e.id)),a2.length>0&&a2.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between py-2 border-b border-gray-100 last:border-0",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-900",children:"Tu cuota"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:e.concepto})]}),(0,t.jsxs)("span",{className:"font-bold text-purple-700",children:[Number(e.monto).toFixed(2),"â¬"]})]},e.id)),sK.total_pendiente>0&&(0,t.jsxs)("div",{className:"flex items-center justify-between pt-3 border-t-2 border-purple-200",children:[(0,t.jsx)("span",{className:"font-bold text-gray-900",children:"TOTAL A PAGAR"}),(0,t.jsxs)("span",{className:"text-2xl font-bold text-purple-700",children:[sK.total_pendiente.toFixed(2),"â¬"]})]}),0===sK.total_pendiente&&0===a2.length&&(0,t.jsx)("div",{className:"flex items-center justify-center pt-3 border-t-2 border-purple-200 gap-2",children:(0,t.jsx)("span",{className:"text-green-600 font-medium",children:"â Todos los pagos est\xe1n al d\xeda"})})]}),sK.total_pendiente>0&&(0,t.jsxs)(d.$,{className:"w-full mt-4 bg-purple-600 hover:bg-purple-700 h-12 font-semibold text-white text-lg",onClick:async()=>{Z.oR.info("Generando enlace de pago agrupado...");try{var e;let s=await fetch("/api/pagos/generar-enlace-agrupado",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({})}),a=await s.json();a.success&&(null==(e=a.data)?void 0:e.enlace_pago)?window.open(a.data.enlace_pago,"_blank"):Z.oR.error(a.error||"Error al generar el enlace de pago")}catch(e){Z.oR.error("Error al generar el enlace de pago")}},children:[(0,t.jsx)(_.A,{className:"h-5 w-5 mr-2"}),"Pagar todo (",sK.total_pendiente.toFixed(2),"â¬)"]})]}),a2.length>0&&!sK&&!sZ&&(0,t.jsxs)("div",{className:"bg-red-50 border-2 border-red-300 rounded-2xl p-4 mb-4 shadow-sm",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-full bg-red-100 flex items-center justify-center",children:(0,t.jsx)(C.A,{className:"h-5 w-5 text-red-500"})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("p",{className:"font-bold text-red-700",children:"Tienes pagos pendientes"}),(0,t.jsxs)("p",{className:"text-sm text-red-600",children:[a2.length," ",1===a2.length?"pago":"pagos"," sin realizar"]})]}),a2.length>1&&(0,t.jsx)("button",{type:"button",onClick:()=>{ep.size===a2.length?ef(new Set):ef(new Set(a2.map(e=>e.id)))},className:"text-xs font-semibold text-red-700 hover:text-red-900 underline",children:ep.size===a2.length?"Quitar todos":"Pagar varias"})]}),(0,t.jsx)("div",{className:"space-y-3",children:a2.map(e=>(0,t.jsxs)("div",{className:"bg-white rounded-xl p-3 border ".concat(ep.has(e.id)?"border-primary ring-1 ring-primary":"border-red-200"),children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[a2.length>1&&(0,t.jsx)("input",{type:"checkbox",checked:ep.has(e.id),onChange:()=>{ef(s=>{let a=new Set(s);return a.has(e.id)?a.delete(e.id):a.add(e.id),a})},className:"h-5 w-5 accent-primary flex-shrink-0"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"font-semibold text-gray-900",children:e.concepto}),(0,t.jsxs)("p",{className:"text-sm text-gray-500",children:["Vence: ",e.fecha_vencimiento]})]}),(0,t.jsx)("div",{className:"text-right",children:(0,t.jsxs)("p",{className:"text-2xl font-bold text-red-600",children:[Number(e.monto).toFixed(2),"â¬"]})})]}),e.items&&e.items.length>1&&(0,t.jsx)("div",{className:"mt-2 pt-2 border-t border-red-100 space-y-1",children:e.items.map((e,s)=>(0,t.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600",children:e.descripcion}),(0,t.jsxs)("span",{className:"text-gray-800 font-medium",children:[e.monto.toFixed(2),"â¬"]})]},s))}),(0,t.jsxs)(d.$,{className:"w-full mt-3 bg-primary hover:bg-accent h-10 font-semibold text-white",onClick:()=>{ai(e),ao(""),ax(null),ar(!0)},children:[(0,t.jsx)(_.A,{className:"h-4 w-4 mr-2 text-white"}),(0,t.jsx)("span",{className:"text-white",children:"Pagar ahora"})]})]},e.id))}),ep.size>1&&(0,t.jsxs)("div",{className:"mt-3 p-3 bg-white rounded-xl border-2 border-primary flex items-center justify-between gap-2 sticky bottom-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"Total a pagar"}),(0,t.jsxs)("p",{className:"text-xl font-bold text-primary",children:[a2.filter(e=>ep.has(e.id)).reduce((e,s)=>e+Number(s.monto),0).toFixed(2),"â¬"]})]}),(0,t.jsxs)(d.$,{disabled:eg,className:"bg-primary hover:bg-accent text-white font-semibold",onClick:async()=>{eb(!0);try{var e;let s=await fetch("/api/pagos/generar-enlace-multiple",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pago_ids:Array.from(ep)})}),a=await s.json();a.success&&(null==(e=a.data)?void 0:e.enlace_pago)?(window.open(a.data.enlace_pago,"_blank"),ef(new Set)):alert(a.error||"No se pudo generar el enlace")}catch(e){console.error(e),alert("Error de conexi\xf3n")}
1finally{eb(!1)}},children:[eg?(0,t.jsx)(y.A,{className:"h-4 w-4 mr-2 animate-spin"}):(0,t.jsx)(_.A,{className:"h-4 w-4 mr-2"}),"Pagar ",ep.size," cuotas"]})]})]}),(0,t.jsxs)("div",{className:"bg-gradient-to-r from-primary to-accent rounded-2xl p-5 mb-4 text-white shadow-lg shadow-primary/30",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-white/80 text-sm font-medium",children:"MI PLAN"}),(null==ea?void 0:ea.suscripcion)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"text-2xl font-bold mt-1",children:ea.suscripcion.nombre}),(0,t.jsx)("p",{className:"text-white/80",children:null===ea.suscripcion.clases||-1===ea.suscripcion.clases?"Clases ilimitadas":"".concat(ea.suscripcion.clases," clases/mes")})]}):(0,t.jsx)("p",{className:"text-xl font-semibold mt-1",children:"Sin plan activo"})]}),(null==ea?void 0:ea.suscripcion)&&(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsxs)("p",{className:"text-3xl font-bold",children:[Number(ea.suscripcion.precio).toFixed(2),"â¬"]}),(0,t.jsx)("p",{className:"text-white/70 text-sm",children:"/mes"})]})]}),(null==ea||null==(Q=ea.suscripcion)?void 0:Q.cambioPendiente)&&(0,t.jsx)("div",{className:"mt-4 bg-white/20 backdrop-blur-sm rounded-xl p-3 border border-white/30",children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"bg-white/30 rounded-full p-1.5 mt-0.5",children:(0,t.jsx)(S.A,{className:"h-4 w-4 text-white"})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("p",{className:"font-semibold text-white text-sm",children:"Cambio de plan programado"}),(0,t.jsxs)("p",{className:"text-white/80 text-sm mt-1",children:["A partir del ",(0,t.jsx)("span",{className:"font-semibold",children:ea.suscripcion.cambioPendiente.fechaEfectiva}),", tu plan cambiar\xe1 a ",(0,t.jsx)("span",{className:"font-semibold",children:ea.suscripcion.cambioPendiente.planNuevoNombre})," (",Number(ea.suscripcion.cambioPendiente.planNuevoPrecio).toFixed(2),"â¬/mes)"]}),(0,t.jsx)("p",{className:"text-white/60 text-xs mt-2",children:"Si a\xf1ades m\xe1s clases antes de esa fecha, el cambio se cancelar\xe1 autom\xe1ticamente."})]})]})})]}),ex.length>0&&0===a2.length&&(0,t.jsxs)("div",{className:"bg-white rounded-2xl p-4 mb-4 border border-gray-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,t.jsx)(k.A,{className:"h-5 w-5 text-primary"}),(0,t.jsx)("p",{className:"font-semibold text-gray-900",children:"\xdaltimos pagos"})]}),ex.slice(0,3).map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between py-2 border-b last:border-0",children:[(0,t.jsx)("span",{className:"text-gray-600",children:e.concepto}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("span",{className:"font-semibold",children:[Number(e.monto).toFixed(2),"â¬"]}),(0,t.jsx)("span",{className:"w-6 h-6 rounded-full bg-green-100 flex items-center justify-center text-green-600 text-xs",children:"â"})]})]},e.id))]}),(0,t.jsxs)("div",{className:"bg-white rounded-2xl p-4 mb-4 border border-gray-100",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(f.A,{className:"h-5 w-5 text-primary"}),(0,t.jsx)("p",{className:"font-semibold text-gray-900",children:"Mis datos"})]}),(0,t.jsxs)("button",{onClick:()=>eK(!0),className:"text-primary font-medium flex items-center gap-1",children:[(0,t.jsx)(A.A,{className:"h-4 w-4"})," Editar"]})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{className:"text-gray-500",children:"Tel\xe9fono"}),(0,t.jsx)("span",{className:"font-medium text-gray-900",children:(null==ea?void 0:ea.telefono)||"-"})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{className:"text-gray-500",children:"DNI"}),(0,t.jsx)("span",{className:"font-medium text-gray-900",children:(null==ea?void 0:ea.dni)||"-"})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{className:"text-gray-500",children:"Rol de baile"}),(0,t.jsx)("span",{className:"font-medium text-gray-900",children:(null==ea?void 0:ea.rolBaile)?aW(ea.rolBaile):"-"})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{className:"text-gray-500",children:"Talla camiseta"}),(0,t.jsx)("span",{className:"font-medium text-gray-900",children:(null==ea?void 0:ea.tallaCamiseta)||"-"})]})]})]}),(0,t.jsx)(ew,{}),(0,t.jsx)(eF,{pagos:ex}),(null==ea?void 0:ea.id)&&(null==ea?void 0:ea.email)&&(0,t.jsx)(eh,{userId:ea.id,email:ea.email}),(0,t.jsx)(n(),{href:"/alumno/referidos",children:(0,t.jsx)("div",{className:"bg-gradient-to-r from-amber-50 to-orange-50 border-2 border-amber-200 rounded-2xl p-4 mb-4 cursor-pointer hover:shadow-md transition-shadow",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"w-10 h-10 rounded-full bg-amber-100 flex items-center justify-center",children:(0,t.jsx)(E.A,{className:"h-5 w-5 text-amber-600"})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("p",{className:"font-semibold text-gray-900",children:"\xa1Invita a tus amigos!"}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Gana descuentos por cada referido"})]}),(0,t.jsx)(T.A,{className:"h-5 w-5 text-gray-400"})]})})}),sV.length>0&&(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-2xl p-4 mb-4",children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Estados de la escuela"}),(0,t.jsx)("div",{className:"flex gap-3 overflow-x-auto pb-1 -mx-1 px-1",children:sV.map((e,s)=>(0,t.jsx)(eS,{estado:e,size:"sm",onClick:()=>sB(s)},e.id))})]}),null!==s$&&sV.length>0&&(0,t.jsx)(ek,{estados:sV,initialIndex:s$,onClose:()=>sB(null),onSeen:ag}),sL>0&&(0,t.jsx)("div",{onClick:()=>Y.push("/alumno/listas"),className:"bg-white border border-gray-200 rounded-2xl p-4 mb-4 cursor-pointer hover:shadow-md transition-shadow",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"w-10 h-10 rounded-full border-2 border-emerald-300 flex items-center justify-center",children:(0,t.jsx)(P.A,{className:"h-5 w-5 text-emerald-600"})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("p",{className:"font-semibold text-gray-900",children:"Listas abiertas"}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:1===sL?"Hay 1 lista a la que puedes apuntarte":"Hay ".concat(sL," listas a las que puedes apuntarte")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"bg-emerald-500 text-white text-xs font-bold px-2 py-1 rounded-full",children:sL}),(0,t.jsx)(T.A,{className:"h-5 w-5 text-gray-400"})]})]})}),sM>0&&(0,t.jsx)("div",{onClick:()=>Y.push("/alumno/encuestas"),className:"bg-white border border-gray-200 rounded-2xl p-4 mb-4 cursor-pointer hover:shadow-md transition-shadow",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"w-10 h-10 rounded-full border-2 border-purple-300 flex items-center justify-center",children:(0,t.jsx)(P.A,{className:"h-5 w-5 text-purple-600"})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("p",{className:"font-semibold text-gray-900",children:"Encuestas pendientes"}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:1===sM?"Tienes 1 encuesta por responder":"Tienes ".concat(sM," encuestas por responder")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"bg-purple-500 text-white text-xs font-bold px-2 py-1 rounded-full",children:sM}),(0,t.jsx)(T.A,{className:"h-5 w-5 text-gray-400"})]})]})}),(0,t.jsxs)(d.$,{variant:"outline",className:"w-full h-12 bg-red-50 border-2 border-red-200 text-red-600 hover:bg-red-100 rounded-2xl font-semibold mt-4",onClick:aL,children:[(0,t.jsx)(R.A,{className:"h-5 w-5 mr-2"}),"Cerrar sesi\xf3n"]})]})]})}),!sv&&(0,t.jsxs)("nav",{className:"fixed bottom-0 left-0 right-0",children:[(0,t.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2 -top-6 z-10",children:(0,t.jsx)("button",{onClick:()=>em("perfil"),className:"flex items-center justify-center transition-all duration-200 ".concat("perfil"===ed?"scale-110":""),children:(0,t.jsx)(c.default,{src:"/logo.webp",alt:"RT",width:68,height:68,className:"rounded-full shadow-lg"})})}),(0,t.jsx)("div",{className:"bg-white border-t border-gray-100 px-3 pb-[calc(1.5rem+env(safe-area-inset-bottom))]",children:(0,t.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,t.jsxs)("button",{onClick:()=>em("mensajes"),className:"relative flex items-center justify-center w-14 h-14 roun
1ded-2xl transition-all duration-200 ml-1 ".concat("mensajes"===ed?"bg-primary/15 text-primary":"text-gray-400"),children:[(0,t.jsx)(J.A,{className:"h-7 w-7 ".concat("mensajes"===ed?"stroke-[2.5px]":"")}),sy>0&&"mensajes"!==ed&&(0,t.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] bg-red-500 text-white text-[10px] font-bold rounded-full flex items-center justify-center px-1",children:sy>9?"9+":sy})]}),(0,t.jsxs)("button",{onClick:()=>{em("clases"),ak("clases")},className:"relative flex items-center justify-center w-14 h-14 rounded-2xl transition-all duration-200 ".concat("clases"===ed?"bg-primary/15 text-primary":"text-gray-400"),children:[(0,t.jsx)(u.A,{className:"h-7 w-7 ".concat("clases"===ed?"stroke-[2.5px]":"")}),(sk.clases||0)>0&&"clases"!==ed&&(0,t.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] bg-primary text-white text-[10px] font-bold rounded-full flex items-center justify-center px-1",children:sk.clases>9?"9+":sk.clases})]}),(0,t.jsx)("div",{className:"w-14"}),(0,t.jsxs)("button",{onClick:()=>{em("eventos"),ak("eventos")},className:"relative flex items-center justify-center w-14 h-14 rounded-2xl transition-all duration-200 ".concat("eventos"===ed?"bg-primary/15 text-primary":"text-gray-400"),children:[(0,t.jsx)(F.A,{className:"h-7 w-7 ".concat("eventos"===ed?"stroke-[2.5px]":"")}),(sk.eventos||0)>0&&"eventos"!==ed&&(0,t.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] bg-primary text-white text-[10px] font-bold rounded-full flex items-center justify-center px-1",children:sk.eventos>9?"9+":sk.eventos})]}),(0,t.jsx)("button",{onClick:()=>em("qr"),className:"flex items-center justify-center w-14 h-14 rounded-2xl transition-all duration-200 mr-1 ".concat("qr"===ed?"bg-primary/15 text-primary":"text-gray-400"),children:(0,t.jsx)(V.A,{className:"h-7 w-7 ".concat("qr"===ed?"stroke-[2.5px]":"")})})]})})]}),(0,t.jsx)(x.lG,{open:eq,onOpenChange:e$,children:(0,t.jsxs)(x.Cf,{className:"w-full max-w-[95vw] sm:max-w-6xl h-[95vh] sm:h-auto sm:max-h-[90vh] p-0 gap-0 overflow-hidden rounded-2xl flex flex-col",children:[(0,t.jsxs)(x.c7,{className:"p-4 border-b shrink-0",children:[(0,t.jsx)(x.L3,{className:"text-xl",children:"Horario de Clases"}),(0,t.jsx)(x.rr,{children:"Toca una clase para inscribirte"})]}),(0,t.jsxs)("div",{className:"p-3 bg-gray-50 shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(q.A,{className:"h-4 w-4 text-gray-500"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:"Filtros"}),("todos"!==sr||"todos"!==si||"todos"!==so)&&(0,t.jsx)(d.$,{variant:"ghost",size:"sm",onClick:a1,className:"h-6 px-2 text-xs text-primary",children:"Limpiar"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:[(0,t.jsxs)(W.l6,{value:sr,onValueChange:sl,children:[(0,t.jsx)(W.bq,{className:"h-9 text-sm",children:(0,t.jsx)(W.yv,{placeholder:"D\xeda"})}),(0,t.jsxs)(W.gC,{children:[(0,t.jsx)(W.eb,{value:"todos",children:"Todos"}),aZ.map(e=>(0,t.jsx)(W.eb,{value:e,children:"miercoles"===e?"Mi\xe9rcoles":"sabado"===e?"S\xe1bado":aW(e)},e))]})]}),(0,t.jsxs)(W.l6,{value:si,onValueChange:sn,children:[(0,t.jsx)(W.bq,{className:"h-9 text-sm",children:(0,t.jsx)(W.yv,{placeholder:"Estilo"})}),(0,t.jsxs)(W.gC,{children:[(0,t.jsx)(W.eb,{value:"todos",children:"Todos"}),aX.map(e=>(0,t.jsx)(W.eb,{value:e,children:e},e))]})]}),(0,t.jsxs)(W.l6,{value:so,onValueChange:sc,children:[(0,t.jsx)(W.bq,{className:"h-9 text-sm",children:(0,t.jsx)(W.yv,{placeholder:"Nivel"})}),(0,t.jsxs)(W.gC,{children:[(0,t.jsx)(W.eb,{value:"todos",children:"Todos"}),aK.map(e=>(0,t.jsx)(W.eb,{value:e,children:e},e))]})]}),(0,t.jsxs)(W.l6,{value:sd,onValueChange:sm,children:[(0,t.jsx)(W.bq,{className:"h-9 text-sm",children:(0,t.jsx)(W.yv,{placeholder:"Profesor"})}),(0,t.jsxs)(W.gC,{children:[(0,t.jsx)(W.eb,{value:"todos",children:"Todos"}),aQ.map(e=>(0,t.jsx)(W.eb,{value:e,children:e},e))]})]})]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===Object.keys(a0).length?(0,t.jsxs)("div",{className:"text-center py-8 text-gray-500",children:[(0,t.jsx)("p",{children:"No hay clases con estos filtros"}),(0,t.jsx)(d.$,{variant:"link",onClick:a1,className:"text-primary",children:"Limpiar filtros"})]}):(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-0 sm:gap-4 sm:p-4",children:Object.entries(a0).map(e=>{let[s,a]=e;return(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"font-semibold text-gray-900 capitalize bg-gray-100 px-4 py-2 text-sm sticky top-0 z-10",children:"miercoles"===s?"Mi\xe9rcoles":"sabado"===s?"S\xe1bado":aW(s)}),(0,t.jsx)("div",{className:"p-3 space-y-2",children:a.map(e=>{var s;let a=null==ea||null==(s=ea.proximasClases)?void 0:s.some(s=>s.id===e.id),r=e.inscritos>=e.aforo_maximo;return(0,t.jsxs)("div",{onClick:()=>!a&&!r&&(e=>{var s;if(null==ea||null==(s=ea.proximasClases)?void 0:s.some(s=>s.id===e.id))return void Z.oR.error("Ya est\xe1s inscrito en esta clase");let a=sY.find(s=>
1s.clase_id===e.id);if(a)return void Z.oR.info("Ya est\xe1s en lista de espera (posici\xf3n ".concat(a.posicion,")"));if(e.inscritos>=e.aforo_maximo){s4(e),s2(!0);return}e7(e);let t=null==ea?void 0:ea.suscripcion;if(!t){ss(aV(aJ+1)),eH(!0);return}if(null===t.clases||-1===t.clases)return void eG(!0);let r=aV(aJ+1);if(r&&null!==r.num_clases_mes&&r.num_clases_mes>(t.clases||0)){ss(r),eH(!0);return}eG(!0)})(e),className:"p-4 rounded-xl border-2 transition-all ".concat(a?"bg-primary/10 border-primary":r?"bg-gray-100 opacity-60 border-gray-200":"bg-white border-gray-100 hover:border-primary hover:shadow-lg cursor-pointer active:scale-[0.98]"),children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsxs)("span",{className:"text-sm font-bold text-primary",children:[aH(e.hora_inicio)," - ",aH(e.hora_fin)]}),a&&(0,t.jsx)(m.E,{className:"bg-primary text-white",children:"Inscrito"}),r&&!a&&(0,t.jsx)(m.E,{variant:"outline",children:"Completo"})]}),(0,t.jsx)("p",{className:"font-semibold text-gray-900 text-lg",children:e.nombre}),(e.profesor_nombre||e.profesor_2_nombre)&&(0,t.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:[e.profesor_nombre&&"".concat(e.profesor_nombre," ").concat(e.profesor_apellidos||""),e.profesor_nombre&&e.profesor_2_nombre&&" y ",e.profesor_2_nombre&&"".concat(e.profesor_2_nombre," ").concat(e.profesor_2_apellidos||"")]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 mt-2 text-gray-500",children:[(0,t.jsx)(w.A,{className:"h-4 w-4"}),(0,t.jsxs)("span",{children:[e.inscritos,"/",e.aforo_maximo," plazas"]})]})]},e.id)})})]},s)})})}),(0,t.jsx)("div",{className:"p-4 border-t shrink-0",children:(0,t.jsx)(d.$,{onClick:()=>e$(!1),className:"w-full sm:w-auto h-12 bg-red-50 border-2 border-red-300 text-red-600 hover:bg-red-100 font-semibold rounded-xl",children:"Cerrar"})})]})}),(0,t.jsx)(x.lG,{open:eB,onOpenChange:eG,children:(0,t.jsxs)(x.Cf,{className:"w-[95vw] max-w-md rounded-2xl",children:[(0,t.jsx)(x.c7,{children:(0,t.jsx)(x.L3,{className:"text-xl",children:"Confirmar inscripci\xf3n"})}),e8&&(0,t.jsxs)("div",{className:"bg-primary/10 p-4 rounded-xl",children:[(0,t.jsx)("h3",{className:"font-bold text-xl text-gray-900",children:e8.nombre}),(0,t.jsxs)("p",{className:"text-gray-600 mt-1",children:[aW(e8.dia_semana)," ",aH(e8.hora_inicio)," - ",aH(e8.hora_fin)]})]}),(0,t.jsxs)(x.Es,{className:"flex-col sm:flex-row gap-2",children:[(0,t.jsx)(d.$,{variant:"outline",onClick:()=>eG(!1),disabled:sa,className:"h-12 rounded-xl",children:"Cancelar"}),(0,t.jsx)(d.$,{onClick:aq,disabled:sa,className:"bg-primary hover:bg-accent h-12 rounded-xl",children:sa?"Inscribiendo...":"Inscribirme"})]})]})}),(0,t.jsx)(x.lG,{open:eU,onOpenChange:eH,children:(0,t.jsxs)(x.Cf,{className:"w-[95vw] max-w-lg rounded-2xl",children:[(0,t.jsx)(x.c7,{children:(0,t.jsxs)(x.L3,{className:"flex items-center gap-2 text-xl",children:[(0,t.jsx)(C.A,{className:"h-6 w-6 text-amber-500"}),(null==ea?void 0:ea.suscripcion)?"Cambio de plan":"Suscripci\xf3n requerida"]})}),e8&&(0,t.jsxs)("div",{className:"bg-gray-100 p-4 rounded-xl",children:[(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Clase seleccionada:"}),(0,t.jsx)("p",{className:"font-bold text-lg",children:e8.nombre})]}),se&&(0,t.jsxs)("div",{className:"bg-blue-50 p-4 rounded-xl border-2 border-blue-200",children:[(0,t.jsx)("p",{className:"font-medium text-blue-800",children:"Plan necesario:"}),(0,t.jsxs)("p",{className:"text-blue-700 text-lg",children:[se.nombre," - ",(0,t.jsxs)("strong",{children:[Number(se.precio_mensual).toFixed(2),"â¬/mes"]})]})]}),(0,t.jsxs)(x.Es,{className:"flex-col sm:flex-row gap-2",children:[(0,t.jsx)(d.$,{variant:"outline",onClick:()=>eH(!1),disabled:sa,className:"h-12 rounded-xl",children:"Cancelar"}),(0,t.jsx)(d.$,{onClick:a$,disabled:sa||!se,className:"bg-primary hover:bg-accent h-12 rounded-xl text-white",children:sa?"Procesando...":"Aceptar"})]})]})}),(0,t.jsx)(h.Lt,{open:eW,onOpenChange:eZ,children:(0,t.jsxs)(h.EO,{className:"w-[95vw] max-w-md bg-white rounded-2xl",children:[(0,t.jsxs)(h.wd,{children:[(0,t.jsx)(h.r7,{className:"text-xl",children:"\xbfCancelar suscripci\xf3n?"}),(0,t.jsx)(h.$v,{children:"Perder\xe1s el acceso a las clases y todas tus inscripciones."})]}),(0,t.jsxs)(h.ck,{className:"flex-col sm:flex-row gap-2",children:[(0,t.jsx)(h.Zr,{disabled:sa,className:"h-12 rounded-xl",children:"Volver"}),(0,t.jsx)(h.Rx,{onClick:aB,disabled:sa,className:"bg-red-600 hover:bg-red-700 h-12 rounded-xl",children:sa?"Cancelando...":"S\xed, cancelar"})]})]})}),(0,t.jsx)(el,{open:eX,onOpenChange:eK,alumno:ea,onSuccess:aj}),(0,t.jsx)(h.Lt,{open:s1,onOpenChange:s2,children:(0,t.jsxs)(h.EO,{className:"w-[95vw] max-w-md bg-white rounded-2xl",children:[(0,t.jsxs)(h.wd,{children:[(0,t.jsxs)(h.r7,{className:"text-xl flex items-center gap-2",children:[(0,t.jsx)(w.A,{className:"h-5 w-5 text-amber-500"}),"Clase completa"]}),(0,t.jsx)(h.$v,{className:"text-base",children:"Esta clase no tiene plazas disponibles, pero puedes apuntarte a la lista de espera. Te avisaremos cuando se libere una plaza."})]}),s5&&(0,t.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-4",children:[(0,t.jsx)("h3",{className:"font-bold text-lg text-gray-900",children:s5.nombre}),(0,t.jsxs)("p",{className:"text-gray-600 mt-1",children:[aW(s5.dia_semana)," ",aH(s5.hora_inicio)," - ",aH(s5.hora_fin)]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-2 text-amber-700",children:[(0,t.jsx)(w.A,{className:"h-4 w-4"}),(0,t.jsxs)("span",{className:"text-sm font-medium",children:[s5.inscritos,"/",s5.aforo_maximo," inscritos"]})]})]}),(0,t.jsxs)(h.ck,{className:"flex-col sm:flex-row gap-2",children:[(0,t.jsx)(h.Zr,{disabled:sa,className:"h-12 rounded-xl",onClick:()=>s4(null),children:"Cancelar"}),(0,t.jsx)(h.Rx,{onClick:aU,disabled:sa,className:"bg-amber-500 hover:bg-amber-600 h-12 rounded-xl text-white",children:sa?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.A,{className:"h-4 w-4 mr-2 animate-spin"}),"Apuntando..."]}):"Apuntarme a la lista"})]})]})}),(0,t.jsx)(x.lG,{open:eQ,onOpenChange:eY,children:(0,t.jsxs)(x.Cf,{className:"w-[95vw] max-w-md rounded-2xl",children:[(0,t.jsxs)(x.c7,{children:[(0,t.jsxs)(x.L3,{className:"text-xl flex items-center gap-2",children:[(0,t.jsx)($.A,{className:"h-5 w-5 text-yellow-500"}),"\xa1Prueba esta clase!"]}),(0,t.jsx)(x.rr,{children:"Si no te convence, contacta con la escuela para gestionar tu baja."})]}),e0&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-br from-purple-50 to-pink-50 p-4 rounded-xl border border-purple-100",children:[(0,t.jsx)("h3",{className:"font-bold text-xl text-gray-900",children:e0.nombre}),(0,t.jsxs)("p",{className:"text-gray-600 mt-1",children:[aW(e0.dia_semana)," ",aH(e0.hora_inicio)," - ",aH(e0.hora_fin)]}),(e0.profesor_nombre||e0.profesor_2_nombre)&&(0,t.jsxs)("p",{className:"text-sm text-gray-500 mt-1 flex items-center gap-1",children:[(0,t.jsx)(f.A,{className:"h-3.5 w-3.5"}),e0.profesor_nombre&&"".concat(e0.profesor_nombre),e0.profesor_nombre&&e0.profesor_2_nombre&&" y ",e0.profesor_2_nombre&&"".concat(e0.profesor_2_nombre)]})]}),e2&&(0,t.jsxs)("div",{className:"bg-amber-50 border-2 border-amber-200 rounded-xl p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-amber-700 mb-2",children:[(0,t.jsx)(C.A,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"font-semibold",children:"Cambio de plan"})]}),(0,t.jsx)("p",{className:"text-amber-700 text-sm",children:"Para asistir a m\xe1s clases, tu plan cambiar\xe1 a:"}),(0,t.jsxs)("p",{className:"text-amber-800 font-bold text-lg mt-1",children:[e2.nombre," - ",Number(e2.precio_mensual).toFixed(2),"â¬/mes"]}),(0,t.jsx)("p",{className:"text-amber-600 text-xs mt-2",children:"Para darte de baja, contacta con la escuela."})]})]}),(0,t.jsxs)(x.Es,{className:"flex-col sm:flex-row gap-2 mt-2",children:[(0,t.jsx)(d.$,{variant:"outline",onClick:()=>{eY(!1),e1(null),e5(null)},disabled:sa,className:"h-12 rounded-xl",children:"Cancelar"}),(0,t.jsx)(d.$,{onClick:aG,disabled:sa,className:"bg-purple-500 hover:bg-purple-600 h-12 rounded-xl font-semibold text-white",children:sa?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.A,{className:"h-4 w-4 mr-2 animate-spin"}),"Inscribiendo..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)($.A,{className:"h-4 w-4 mr-2"}),"\xa1S\xed, quiero probar!"]})})]})]})}),(0,t.jsx)(x.lG,{open:at,onOpenChange:ar,children:(0,t.jsxs)(x.Cf,{className:"max-w-sm mx-4",children:[(0,t.jsxs)(x.c7,{children:[(0,t.jsxs)(x.L3,{className:"flex items-center gap-2 text-lg",children:[(0,t.jsx)(_.A,{className:"h-5 w-5 text-primary"}),"Realizar pago"]}),(0,t.jsx)(x.rr,{className:"text-left",children:null==al?void 0:al.concepto})]}),(0,t.jsxs)("div",{className:"space-y-4 py-2",children:[(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 text-center",children:[(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Importe a pagar"}),(0,t.jsxs)("p",{className:"text-3xl font-bold text-gray-900",children:[am?am.monto_final.toFixed(2):al?Number(al.monto).toFixed(2):"0.00","â¬"]}),am&&(0,t.jsxs)("div",{className:"mt-2 flex items-center justify-center gap-2 text-green-600",children:[(0,t.jsx)(N.A,{className:"h-4 w-4"}),(0,t.jsxs)("span",{className:"text-sm font-medium",children:["Descuento de ",am.monto_descuento.toFixed(2),"⬠aplicado"]}
1)]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm font-medium text-gray-700",children:[(0,t.jsx)(B.A,{className:"h-4 w-4"}),"\xbfTienes un c\xf3digo de descuento?"]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(U.p,{value:an,onChange:e=>{ao(e.target.value.toUpperCase()),ax(null)},placeholder:"Ej: VERANO2024",className:"font-mono text-center",disabled:!!am}),am?(0,t.jsx)(d.$,{variant:"outline",onClick:()=>{ax(null),ao("")},className:"shrink-0",children:(0,t.jsx)(v.A,{className:"h-4 w-4"})}):(0,t.jsx)(d.$,{variant:"outline",onClick:aw,disabled:!an.trim()||ac,className:"shrink-0",children:ac?(0,t.jsx)(y.A,{className:"h-4 w-4 animate-spin"}):"Aplicar"})]})]}),am&&(0,t.jsxs)("div",{className:"bg-green-50 border border-green-200 rounded-xl p-3 text-sm",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-green-700 font-medium mb-2",children:[(0,t.jsx)(G.A,{className:"h-4 w-4"}),am.nombre]}),(0,t.jsxs)("div",{className:"space-y-1 text-gray-600",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Precio original:"}),(0,t.jsxs)("span",{className:"line-through",children:[am.monto_original.toFixed(2),"â¬"]})]}),(0,t.jsxs)("div",{className:"flex justify-between text-green-600 font-medium",children:[(0,t.jsx)("span",{children:"Descuento:"}),(0,t.jsxs)("span",{children:["-",am.monto_descuento.toFixed(2),"â¬"]})]})]})]})]}),(0,t.jsxs)(x.Es,{className:"flex-col gap-2",children:[(0,t.jsx)(d.$,{className:"w-full h-12 bg-primary hover:bg-accent text-white font-semibold",onClick:a_,disabled:ah,children:ah?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.A,{className:"h-4 w-4 mr-2 animate-spin"}),"Procesando..."]}):(null==am?void 0:am.monto_final)===0?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(N.A,{className:"h-4 w-4 mr-2"}),"Completar pago (gratis)"]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_.A,{className:"h-4 w-4 mr-2"}),"Pagar ",am?am.monto_final.toFixed(2):al?Number(al.monto).toFixed(2):"0.00","â¬"]})}),(0,t.jsx)(d.$,{variant:"ghost",onClick:()=>ar(!1),className:"w-full text-gray-500",children:"Cancelar"})]})]})}),(0,t.jsx)(e_.r,{open:sH,onAccept:async()=>{try{let e=ez&&eI?eI.email:(null==es?void 0:es.primaryEmail)||(null==eC?void 0:eC.email);e&&(await fetch("/api/alumnos/aceptar-terminos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e})}),ea&&et({...ea,terminosAceptados:!0}))}catch(e){console.error("Error aceptando t\xe9rminos:",e)}sW(!1),Z.oR.success("Condiciones aceptadas correctamente")},onCancel:()=>{ee.signOut(),Y.push("/alumno/login")}})]})}},97450:(e,s,a)=>{a.d(s,{AM:()=>n,Wv:()=>o,hl:()=>c});var t=a(95155),r=a(12115),l=a(31138),i=a(25016);let n=l.bL,o=l.l9;l.Mz;let c=r.forwardRef((e,s)=>{let{className:a,align:r="center",sideOffset:n=4,...o}=e;return(0,t.jsx)(l.ZL,{children:(0,t.jsx)(l.UC,{ref:s,align:r,sideOffset:n,className:(0,i.cn)("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",a),...o})})});c.displayName=l.UC.displayName}}]);
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.