1import{f as E,r as d,o as C,b as h,j as e,w as F,x as A,c as L,K as I,k as b}from"./index-CtR2Cm7C.js";import O from"./ProPlayerCard-U_ncr1-g.js";import{P as B}from"./pen-line-BqEWsO_Q.js";import{S as D}from"./send-2bR1st9w.js";import{C as U}from"./chevron-up-CR-LX1he.js";import{C as K}from"./circle-x-DEaQAqwj.js";import{C as $}from"./circle-check-big-CtQTi4fB.js";import{C as M}from"./clock-Crn-bV_Q.js";import"./camera-DdQQyZBY.js";import"./shield-check-D6RITCT8.js";import"./upload-Dy_G_Nx3.js";import"./VerificationBadge-_rI8B_Sf.js";import"./TeamHeraldicVerification-CevnxECq.js";import"./lock-open-CyktMdjX.js";import"./heart-0Z-ZBULV.js";import"./badge-check-BfgCfP4E.js";import"./move-BTvoDr2w.js";import"./crosshair-Lt41x66M.js";import"./target-CNMRKRHG.js";const z=["IGL","Fragger","Support","Rusher","Flex","Sniper"],G=["LATAM_NORTE","LATAM_SUR","BRASIL","NA","EU","ASIA","GLOBAL"],Q=["bronze","silver","gold","diamond","legend"],x={nick:"Nick",real_name:"Nombre real",avatar_url:"Foto (URL)",banner_url:"Banner (URL)",team_name:"Equipo",position:"Posición",region:"Región",country:"PaÃs",country_flag:"Bandera (emoji)",ff_id:"FF ID",kills_avg:"Kills promedio",damage_avg:"Daño promedio",win_rate:"Win Rate %",tournaments_played:"Torneos jugados",titles:"TÃtulos",rating:"Rating (0-100)",bio:"Bio",social_tiktok:"TikTok",social_instagram:"Instagram",social_youtube:"YouTube",tier:"Tier",card_color:"Color tarjeta"},P={pending:{label:"Pendiente",icon:M,cls:"text-yellow-400"},approved:{label:"Aprobado",icon:$,cls:"text-green-400"},rejected:{label:"Rechazado",icon:K,cls:"text-red-400"}},y="w-full bg-white/[0.06] border border-white/[0.1] rounded-xl px-3 py-2 text-[13px] text-white outline-none focus:border-white/30 transition-colors placeholder-white/20",g="w-full bg-[#111] border border-white/[0.1] rounded-xl px-3 py-2 text-[13px] text-white outline-none focus:border-white/30 transition-colors";function H({field:s,label:m,value:l,onChange:r,player:n}){if(s==="position")return e.jsx("select",{value:l,onChange:a=>r(a.target.value),className:g,children:z.map(a=>e.jsx("option",{value:a,className:"bg-[#111]",children:a},a))});if(s==="region")return e.jsx("select",{value:l,onChange:a=>r(a.target.value),className:g,children:G.map(a=>e.jsx("option",{value:a,className:"bg-[#111]",children:a},a))});if(s==="tier")return e.jsx("select",{value:l,onChange:a=>r(a.target.value),className:g,children:Q.map(a=>e.jsx("option",{value:a,className:"bg-[#111]",children:a.toUpperCase()},a))});if(s==="bio")return e.jsx("textarea",{value:l,onChange:a=>r(a.target.value),className:`${y} h-20 resize-none`,placeholder:`Nuevo valor para ${m}...`});const p=["kills_avg","damage_avg","win_rate","tournaments_played","titles","rating"].includes(s);return e.jsx("input",{type:p?"number":"text",value:l,onChange:a=>r(a.target.value),className:y,placeholder:"Nuevo valor..."})}function xe({user:s}){const m=E(),[l,r]=d.useState(!1),[n,p]=d.useState({}),[a,j]=d.useState(""),[w,v]=d.useState(!1),[N,S]=d.useState(!1),{data:o}=C({queryKey:["my-proplayer",s?.email],queryFn:()=>h.entities.ProPlayer.filter({user_email:s.email}),enabled:!!s?.email,select:t=>t[0]||null}),{data:u=[]}=C({queryKey:["my-proplayer-requests",s?.email],queryFn:()=>h.entities.ProPlayerChangeRequest.filter({requester_email:s.email},"-created_date",20),enabled:!!s?.email});if(d.useEffect(()=>h.entities.ProPlayer.subscribe(()=>{m.invalidateQueries({queryKey:["my-proplayer",s?.email]})}),[m,s?.email]),!o)return null;const f=u.find(t=>t.status==="pending"),_=(t,i)=>{p(c=>({...c,[t]:i}))},q=t=>{p(i=>{const c={...i};return delete c[t],c})},R=async()=>{if(Object.keys(n).length===0)return b.error("Debes modificar al menos un campo");v(!0);try{await h.entities.ProPlayerChangeRequest.create({pro_player_id:o.id,player_nick:o.nick,requester_email:s.email,requester_name:s.nickname||s.full_name||s.email,changes:n,message:a||null,status:"pending"}
1),m.invalidateQueries({queryKey:["my-proplayer-requests",s.email]}),b.success("â
Solicitud enviada al administrador"),p({}),j(""),r(!1)}catch(t){b.error("Error: "+t.message)}finally{v(!1)}},T=Object.keys(x);return e.jsxs("div",{className:"mt-6 mx-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-wider text-amber-400/70 mb-2 px-1",children:"Tu Tarjeta Pro Player"}),e.jsx("div",{className:"max-w-[230px] mx-auto",children:e.jsx(O,{player:o})})]}),e.jsxs("div",{className:"rounded-2xl border border-blue-500/20 bg-blue-500/5 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-blue-300 text-[12px] font-bold",children:"ð Tu perfil Pro Player está vinculado"}),e.jsx("p",{className:"text-white/40 text-[11px]",children:"Puedes solicitar cambios al administrador de la liga"})]}),e.jsxs("button",{onClick:()=>r(t=>!t),className:"flex items-center gap-1.5 px-3 py-1.5 bg-blue-500/20 hover:bg-blue-500/30 border border-blue-500/30 rounded-xl text-[12px] text-blue-300 font-bold transition",children:[e.jsx(B,{className:"w-3.5 h-3.5"}),l?"Cancelar":"Solicitar cambio"]})]}),f&&!l&&e.jsx("div",{className:"mx-4 mb-3 px-3 py-2 rounded-xl bg-yellow-500/10 border border-yellow-500/20",children:e.jsx("p",{className:"text-yellow-400 text-[11px] font-bold",children:"â³ Tienes una solicitud pendiente de revisión"})}),e.jsx(F,{children:l&&e.jsx(A.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:e.jsxs("div",{className:"px-4 pb-4 space-y-4 border-t border-white/[0.06] pt-3",children:[f&&e.jsx("div",{className:"px-3 py-2 rounded-xl bg-yellow-500/10 border border-yellow-500/20",children:e.jsx("p",{className:"text-yellow-400 text-[11px]",children:"â ï¸ Ya tienes una solicitud pendiente. Puedes enviar otra, pero el admin revisará ambas."})}),e.jsx("p",{className:"text-white/50 text-[11px]",children:"Selecciona los campos que quieres cambiar y escribe el nuevo valor."}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-black text-white/25 uppercase tracking-wider mb-2",children:"Campos a modificar"}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:T.map(t=>{const i=t in n;return e.jsx("button",{"aria-label":"Eliminar",onClick:()=>i?q(t):_(t,o[t]??""),className:`text-[10px] px-2 py-1 rounded-full font-bold transition border ${i?"bg-blue-500/20 text-blue-300 border-blue-500/30":"border-white/[0.08] text-white/35 hover:text-white/60"}`,children:x[t]},t)})}),Object.keys(n).length>0&&e.jsx("div",{className:"space-y-3",children:Object.keys(n).map(t=>e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-white/40 font-semibold uppercase tracking-wider mb-1",children:x[t]}),e.jsx(H,{field:t,label:x[t],value:n[t]??"",onChange:i=>_(t,i),player:o})]},t))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-white/40 font-semibold uppercase tracking-wider mb-1",children:"Mensaje para el admin (opcional)"}),e.jsx("textarea",{value:a,onChange:t=>j(t.target.value),placeholder:"Explica el motivo del cambio...",className:`${y} h-16 resize-none`})]}),e.jsxs("button",{onClick:R,disabled:w||Object.keys(n).length===0,className:"w-full flex items-center justify-center gap-2 py-2.5 bg-blue-600 hover:bg-blue-500 disabled:opacity-50 text-white text-[13px] font-bold rounded-xl transition",children:[w?e.jsx(L,{className:"w-4 h-4 animate-spin"}):e.jsx(D,{className:"w-4 h-4"}),"Enviar solicitud"]})]})})}),u.length>0&&e.jsxs("div",{className:"border-t border-white/[0.06]",children:[e.jsxs("button",{onClick:()=>S(t=>!t),className:"w-full flex items-center justify-between px-4 py-2.5 hover:bg-white/[0.03] transition",children:[e.jsxs("span",{className:"text-[11px] text-white/40 font-bold",children:["Historial de solicitudes (",u.length,")"]}),N?e.jsx(U,{className:"w-3.5 h-3.5 text-white/30"}):e.jsx(I,{className:"w-3.5 h-3.5 text-white/30"})]}),N&&e.jsx("div",{className:"px-4 pb-3 space-y-2",children:u.map(t=>{const i=P[t.status]||P.pending,c=i.icon;return e.jsxs("div",{className:"flex items-start gap-2.5 p-3 bg-white/[0.03] rounded-xl border border-white/[0.05]",children:[e.jsx(c,{className:`w-4 h-4 flex-shrink-0 mt-0.5 ${i.cls}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`text-[9px] font-black uppercase ${i.cls}`,children:i.label}),e.jsx("span",{className:"text-white/20 text-[10px]",children:new Date(t.created_date).toLocaleDateString()})]}),e.jsx("p",{className:"text-white/50 text-[11px] mt-0.5",children:Object.keys(t.changes||{}).map(k=>x[k]||k).join(", ")}),t.admin_response&&e.jsxs("p",{className:"text-white/40 text-[11px] mt-1 italic",children:["Admin: ",t.admin_response]})]})]},t.id)})})]})]})]})}export{xe as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.