PageSourceSearch

https://www.experienciamx.com/assets/ProfilePage-DzlQRyCr.js

js experienciamx.com collected 2026-10-04 10:53:07 UTC 68,662 bytes, 11 lines download raw bytes

vendor: 4,099 bytes, lines 1-11
1import{c as Ke,an as B,a as $,b as Ce,aP as Ye,r as N,aI as F,s as E,j as e,aQ as is,m as w,aR as ie,B as D,a6 as Me,a7 as Te,a1 as ce,a8 as De,a9 as _,a5 as z,L as Q,aj as pe,X as os,aS as ls,aT as ds,aU as cs,aV as he,W as Pe,A as Oe,aW as S,Z as je,C as ne,aX as ms,k as Xe,a4 as xs,M as Ze,a2 as us,ap as ps,aq as hs,ar as gs,as as fs,at as bs,S as Qe,T as Je,aJ as js,aK as ge,aY as fe,aZ as Le,f as ys,a_ as Ns,_ as Ae,a$ as Re,U as ye,b0 as vs,b1 as H,b2 as K,b3 as V,b4 as Y,b5 as O,b6 as ws,ai as $e,R as es,ad as Cs,b7 as ks}from"./index-Dlwfq7KD.js";import{F as Fe}from"./Footer-BpU4N5pB.js";import{u as ke,a as ss,b as _s}from"./useProfile-bvWvunlz.js";import{b as Es}from"./useWishlist-DpiMgswJ.js";import{R as Ss}from"./ReferralCTA-CXzxylKW.js";import{P as Ms}from"./pencil-DJfiSSap.js";import{S as Ts}from"./shield-check-BKW4JO49.js";import{C as be}from"./copy-BW7qALpU.js";import{S as X}from"./share-2-ChREVvLj.js";import{L as Ds}from"./link-twe6k6Tu.js";import{M as Ps}from"./message-circle-CyVEVr_n.js";import{W as oe}from"./wallet-DkGUgmr-.js";import{t as Ne}from"./en-US-CQfvnoLQ.js";import{d as Ls,f as as}from"./format-B2zEwd-E.js";import{T as As}from"./trending-up-ORO0f42Y.js";import{C as Rs}from"./circle-alert-D5d7bjYC.js";import{C as _e}from"./circle-check-BuxNzsv5.js";import{A as $s,a as Fs,b as qs}from"./avatar-WYOF7gsQ.js";import{c as Us}from"./imageCompression-BBJCA1Fe.js";import{C as Is}from"./camera-CixUX6l_.js";import{T as zs}from"./textarea-BPUto-jT.js";import{t as rs}from"./confetti-EWbmT5C7.js";import{S as le}from"./sparkles-Dv6R3SLW.js";import{A as ve}from"./award-CWIXpfy4.js";import{C as Bs}from"./circle-x-CZjv95KM.js";import{G as we}from"./globe-DQ46dciE.js";import{S as Vs}from"./send-CWVaJvek.js";import{G as Ws,C as ts}from"./gem-Ba-kj38q.js";import{B as Gs}from"./BookingCard-Bxr28001.js";import{S as qe,a as Ue,b as Ie,c as ze,d as U}from"./select-BL2XpB3b.js";import{M as Be}from"./mail-Bh1_69pd.js";import{P as Hs}from"./phone-CeyxX5Xj.js";import{C as Ks}from"./calendar-DvxiIWpM.js";import{S as Ys}from"./stamp-C959AnO1.js";import"./youtube-D_VbFAnH.js";import"./instagram-Uk_a1A9h.js";import"./index-rtu4Vv-f.js";import"./bookingCalculations-D2ULNZeg.js";import"./progress-D84hdDOj.js";import"./credit-card-B5Az6nUm.js";import"./StripePaymentForm-CdR3jlTf.js";import"./index-BNxJ7Rxc.js";import"./switch-B36aNqDh.js";import"./index-DikORJAn.js";import"./download-CilXX-TA.js";import"./file-text-K7ksrzT9.js";import"./external-link-d-_Iu67d.js";import"./bed-double-BnWNl2LZ.js";import"./index-BdQq_4o_.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Os=Ke("Medal",[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Z=Ke("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);function Ve(a,s){const d=Ne(a),h=Ne(s),c=We(d,h),m=Math.abs(Ls(d,h));d.setDate(d.getDate()-c*m);const i=+(We(d,h)===-c),l=c*(m-i);return l===0?0:l}function We(a,s){const d=a.getFullYear()-s.getFullYear()||a.getMonth()-s.getMonth()||a.getDate()-s.getDate()||a.getHours()-s.getHours()||a.getMinutes()-s.getMinutes()||a.getSeconds()-s.getSeconds()||a.getMilliseconds()-s.getMilliseconds();return d<0?-1:d>0?1:d}
11function Xs(a){return+Ne(a)<Date.now()}const p=(a,s,d,h,c)=>({es:s,en:d,de:h,fr:c})[a]??d,Zs=()=>{const{user:a}=B(),{language:s}=$(),{formatPrice:d}=Ce(),h=Ye(),[c,m]=N.useState(!1),[i,l]=N.useState(!1),[r,j]=N.useState(!1),[t,x]=N.useState(""),[g,v]=N.useState(!1),[b,k]=N.useState(null),[T,M]=N.useState(!1),P=N.useRef(null),{data:R,isLoading:L}=F({queryKey:["profile-referral",a==null?void 0:a.id],queryFn:async()=>{if(!(a!=null&&a.id))return null;const{data:f,error:C}=await E.from("profiles").select("referral_code, code_customized").eq("user_id",a.id).single();if(C)throw C;return f},enabled:!!(a!=null&&a.id)}),{data:A}=F({queryKey:["referral-stats",a==null?void 0:a.id],queryFn:async()=>{if(!(a!=null&&a.id))return{successfulReferrals:0,totalCredit:0};const{data:f}=await E.from("referrals").select("id, status").eq("referrer_id",a.id).in("status",["completed","rewarded"]),{data:C}=await E.from("travel_credits").select("amount").eq("user_id",a.id).eq("is_active",!0).gt("expires_at",new Date().toISOString()),te=(C==null?void 0:C.reduce((G,q)=>G+Number(q.amount),0))||0;return{successfulReferrals:(f==null?void 0:f.length)||0,totalCredit:te}},enabled:!!(a!=null&&a.id)}),o=(R==null?void 0:R.referral_code)||"",y=o?`${window.location.origin}/ref/${o}`:"",J=async()=>{if(y)try{await navigator.clipboard.writeText(y),m(!0),S.success(p(s,"Enlace copiado","Link copied","Link kopiert","Lien copié")),setTimeout(()=>m(!1),2e3)}catch{S.error("Error")}},me=async()=>{if(o)try{await navigator.clipboard.writeText(o),l(!0),S.success(p(s,"Código copiado","Code copied","Code kopiert","Code copié")),setTimeout(()=>l(!1),2e3)}catch{S.error("Error")}},W=p(s,`¡Viaja conmigo! Usa mi código ${o} en Experiencia México y obtén un descuento en tu primer viaje 🌍 ${y}`,`Travel with me! Use my code ${o} on Experiencia México and get a discount on your first trip 🌍 ${y}`,`Reise mit mir! Nutze meinen Code ${o} auf Experiencia México und erhalte einen Rabatt auf deine erste Reise 🌍 ${y}`,`Voyage avec moi ! Utilise mon code ${o} sur Experiencia México et obtiens une réduction sur ton premier voyage 🌍 ${y}`),xe=async()=>{if(y&&typeof navigator<"u"&&navigator.share)try{await navigator.share({title:p(s,"Viaja conmigo","Travel with me","Reise mit mir","Voyage avec moi"),text:W})}catch{}},ee=typeof navigator<"u"&&navigator.share,Ee=()=>{window.open(`https://wa.me/?text=${encodeURIComponent(W)}`,"_blank")},ue=async()=>{try{await navigator.clipboard.writeText(W),S.success(p(s,"Texto copiado para Instagram","Text copied for Instagram","Text für Instagram kopiert","Texte copié pour Instagram"))}catch{S.error("Error")}},se=f=>f.toUpperCase().replace(/[^A-Z0-9-]/g,"").slice(0,20),ae=()=>{x(o),k(null),j(!0)},re=()=>{j(!1),x(""),k(null)};N.useEffect(()=>{if(r){if(P.current&&window.clearTimeout(P.current),t.length<6){k(null);return}if(t===o){k(!0);return}return v(!0),P.current=window.setTimeout(async()=>{const{data:f,error:C}=await E.rpc("check_code_available",{_code:t});if(v(!1),C){k(null);return}k(!!f)},500),()=>{P.current&&window.clearTimeout(P.current)}}},[t,r,o]);const n=async()=>{if(!(a!=null&&a.id)||!b||t.length<6||t===o)return;M(!0);const{data:f}=await E.rpc("check_code_available",{_code:t});if(!f){k(!1),M(!1);return}const{error:C}=await E.from("profiles").update({referral_code:t,code_customized:!0}).eq("user_id",a.id);if(M(!1),C){S.error(p(s,"Ya está en uso","Already in use","Bereits vergeben","Déjà utilisé")),k(!1);return}S.success(p(s,"Código actualizado","Code updated","Code aktualisiert","Code mis à jour")),j(!1),h.invalidateQueries({queryKey:["profile-referral",a.id]})},u=!(R!=null&&R.code_customized);return e.jsx(is,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs(w.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"text-center",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 rounded-full bg-primary/10 mb-4",children:e.jsx(ie,{className:"h-7 w-7 text-primary"})}),e.jsx("h2",{className:"font-display text-2xl md:text-3xl font-bold mb-2",children:p(s,"Programa de Referidos","Referral Program","Empfehlungsprogramm","Programme de parrainage")}),e.jsx("p",{className:"text-muted-foreground mb-1",children:p(s,"Invita a un amigo a viajar con nosotros","Invite a friend to travel with us","Lade einen Freund ein, mit uns zu reisen","Invitez un ami à voyager avec nous")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:p(s,"Ellos obtienen un descuento en su primer viaje — tú ganas crédito de viaje.","They get a discount on their first trip — you earn travel credit.","Sie erhalten einen Rabatt — du bekommst Reiseguthaben.","Ils obtiennent une réduction — vous gagnez du crédit voyage.")})]}),e.jsxs(w.div,{initial:{opacity:0,y:20}
11,animate:{opacity:1,y:0},transition:{delay:.1},className:"bg-card rounded-2xl border border-border p-5 md:p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-sm",children:[e.jsx(ie,{className:"h-4 w-4 text-primary"}),p(s,"Tu código de referido","Your referral code","Dein Empfehlungscode","Votre code de parrainage")]}),!L&&!r&&(u?e.jsxs(D,{variant:"ghost",size:"sm",onClick:ae,className:"h-8",children:[e.jsx(Ms,{className:"h-3.5 w-3.5 mr-1.5"}),p(s,"Editar código","Edit code","Code bearbeiten","Modifier le code")]}):e.jsxs(Me,{children:[e.jsx(Te,{asChild:!0,children:e.jsxs(ce,{variant:"secondary",className:"gap-1 cursor-help",children:[e.jsx(Ts,{className:"h-3 w-3"}),p(s,"Código personalizado","Custom code","Eigener Code","Code personnalisé")," ✓"]})}),e.jsx(De,{children:p(s,"Tu código ya fue personalizado. Contacta soporte si necesitas cambiarlo.","Your code has already been customized. Contact support if you need to change it.","Dein Code wurde bereits angepasst. Wende dich an den Support, falls nötig.","Votre code a déjà été personnalisé. Contactez le support si besoin.")})]}))]}),L?e.jsx(_,{className:"h-14 w-full"}):r?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(z,{value:t,onChange:f=>x(se(f.target.value)),maxLength:20,className:"font-mono uppercase text-center text-lg tracking-wider h-14 pr-12",placeholder:"MICODIGO",autoFocus:!0}),e.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2",children:[g&&e.jsx(Q,{className:"h-4 w-4 animate-spin text-muted-foreground"}),!g&&b===!0&&t.length>=6&&e.jsx(pe,{className:"h-5 w-5 text-success"}),!g&&b===!1&&e.jsx(os,{className:"h-5 w-5 text-destructive"})]})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:b===!0?"text-success":b===!1?"text-destructive":"text-muted-foreground",children:t.length<6?p(s,"Mínimo 6 caracteres","Minimum 6 characters","Mindestens 6 Zeichen","Minimum 6 caractères"):g?p(s,"Verificando…","Checking…","Wird geprüft…","Vérification…"):b===!0?p(s,"Disponible","Available","Verfügbar","Disponible"):b===!1?p(s,"Ya está en uso","Already in use","Bereits vergeben","Déjà utilisé"):p(s,"Solo letras, números y guiones","Letters, numbers and dashes only","Nur Buchstaben, Zahlen und Bindestriche","Lettres, chiffres et tirets uniquement")}),e.jsxs("span",{className:"text-muted-foreground",children:[t.length,"/20"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(D,{variant:"outline",onClick:re,disabled:T,className:"flex-1",children:p(s,"Cancelar","Cancel","Abbrechen","Annuler")}),e.jsx(D,{variant:"gradient",onClick:n,disabled:!b||T||t.length<6||t===o,className:"flex-1",children:T?e.jsx(Q,{className:"h-4 w-4 animate-spin"}):p(s,"Guardar","Save","Speichern","Enregistrer")})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground text-center",children:p(s,"Solo puedes cambiar tu código una vez.","You can only change your code once.","Du kannst deinen Code nur einmal ändern.","Vous ne pouvez modifier votre code qu'une seule fois.")})]}):e.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-3",children:[e.jsx("div",{className:"flex-1 w-full bg-primary/5 border-2 border-dashed border-primary/30 rounded-xl px-5 py-3 text-center",children:e.jsx("span",{className:"font-mono text-xl md:text-2xl font-bold tracking-wider text-primary",children:o||"—"})}),e.jsx(D,{onClick:me,variant:"outline",className:"w-full sm:w-auto",disabled:!o,children:i?e.jsxs(e.Fragment,{children:[e.jsx(pe,{className:"h-4 w-4 mr-2"}),p(s,"¡Copiado!","Copied!","Kopiert!","Copié !")]}):e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"h-4 w-4 mr-2"}),p(s,"Copiar código","Copy code","Kopieren","Copier")]})})]})]}),e.jsxs(w.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.15},className:"bg-card rounded-2xl border border-border p-5 md:p-6",children:[e.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2 text-sm",children:[e.jsx(X,{className:"h-4 w-4 text-primary"}),p(s,"Tu enlace de referido","Your referral link","Dein Empfehlungslink","Votre lien de parrainage")]}),L?e.jsx(_,{className:"h-12 w-full"}):e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsx("div",{className:"flex-1 bg-muted rounded-lg px-4 py-3 font-mono text-xs sm:text-sm truncate",children:y||"—"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(D,{onClick:J,variant:"outline",size:"sm",className:"flex-1 sm:flex-none",disabled:!y,children:c?e.jsxs(e.Fragment,{children:[e.jsx(pe,{className:"h-4 w-4 mr-1"}),p(s,"¡Copiado!","Copied!","Kopiert!","Copié !")]}):e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"h-4 w-4 mr-1"}),p(s,"Copiar","Copy","Kopieren","Copier")]})}),ee?e.jsxs(D,{onClick:xe,variant:"gradient",size:"sm",className:"flex-1 sm:flex-none",disabled:!y,children:[e.jsx(X,{className:"h-4 w-4 mr-1"}),p(s,"Compartir","Share","Teilen","Partager")]}):e.jsxs(ls,{children:[e.jsx(ds,{asChild:!0,children:e.jsxs(D,{variant:"gradient",size:"sm",className:"flex-1 sm:flex-none",disabled:!y,children:[e.jsx(X,{className:"h-4 w-4 mr-1"}),p(s,"Compartir","Share","Teilen","Partager")]})}),e.jsxs(cs,{align:"end",className:"w-56",children:[e.jsxs(he,{onClick:J,children:[e.jsx(Ds,{className:"h-4 w-4 mr-2"}),p(s,"Copiar enlace","Copy link","Link kopieren","Copier le lien")]}),e.jsxs(he,{onClick:Ee,children:[e.jsx(Ps,{className:"h-4 w-4 mr-2"}),"WhatsApp"]}),e.jsxs(he,{onClick:ue,children:[e.jsx(be,{className:"h-4 w-4 mr-2"}),p(s,"Copiar para Instagram","Copy for Instagram","Für Instagram kopieren","Copier pour Instagram")]})]})]})]})]})]}),e.jsxs(w.div,{initial:{opacity:0,y:20}
11,animate:{opacity:1,y:0},transition:{delay:.2},className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-card rounded-xl border border-border p-4 text-center",children:[e.jsx(Pe,{className:"h-5 w-5 text-primary mx-auto mb-2"}),e.jsx("p",{className:"text-xl font-bold",children:(A==null?void 0:A.successfulReferrals)??0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:p(s,"Referidos exitosos","Successful referrals","Erfolgreiche Empfehlungen","Parrainages réussis")})]}),e.jsxs("div",{className:"bg-card rounded-xl border border-border p-4 text-center",children:[e.jsx(oe,{className:"h-5 w-5 text-primary mx-auto mb-2"}),e.jsx("p",{className:"text-xl font-bold",children:d((A==null?void 0:A.totalCredit)??0)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:p(s,"Crédito ganado","Credit earned","Verdientes Guthaben","Crédit gagné")}),e.jsxs(Me,{children:[e.jsx(Te,{asChild:!0,children:e.jsx("button",{type:"button",className:"mt-2 text-[11px] font-medium text-primary underline-offset-2 transition-colors duration-200 hover:text-primary/80 hover:underline focus:outline-none cursor-help",children:p(s,"¿Cómo canjeo los créditos?","How can I redeem the credits?","Wie kann ich das Guthaben einlösen?","Comment utiliser mes crédits ?")})}),e.jsx(De,{side:"top",className:"max-w-56 text-center",children:p(s,"Tus créditos aparecerán en la sección de detalles de cada viaje, donde podrás canjearlos al reservar.","Your credits will be displayed in the details section on the trips page and can be redeemed there.","Dein Guthaben wird im Detailbereich der Reiseseite angezeigt und kann dort eingelöst werden.","Vos crédits apparaîtront dans la section des détails de la page du voyage et pourront y être utilisés.")})]})]})]}),e.jsxs(w.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},className:"bg-card rounded-2xl border border-border p-5 md:p-6",children:[e.jsx("h3",{className:"font-semibold mb-5 text-sm",children:p(s,"Cómo funciona","How it works","So funktioniert es","Comment ça marche")}),e.jsx("div",{className:"space-y-5",children:[{icon:X,title:p(s,"Comparte tu enlace","Share your link","Teile deinen Link","Partagez votre lien"),desc:p(s,"Envía tu enlace único a amigos y familiares.","Send your unique link to friends and family.","Sende deinen Link an Freunde und Familie.","Envoyez votre lien à vos proches.")},{icon:Pe,title:p(s,"Tu amigo reserva","Your friend books","Dein Freund bucht","Votre ami réserve"),desc:p(s,"Cuando reserven y paguen, obtienen un descuento.","When they book and pay, they get a discount.","Beim Buchen erhalten sie einen Rabatt.","Ils obtiennent une réduction.")},{icon:oe,title:p(s,"Tú ganas crédito","You earn credit","Du bekommst Guthaben","Vous gagnez du crédit"),desc:p(s,"Una vez confirmado el pago, recibes crédito.","Once payment is confirmed, you receive credit.","Nach Zahlungsbestätigung bekommst du Guthaben.","Vous recevez du crédit voyage.")}].map((f,C)=>e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"flex-shrink-0 w-9 h-9 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(f.icon,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium text-sm",children:f.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:f.desc})]}),C<2&&e.jsx(Oe,{className:"hidden sm:block h-4 w-4 text-muted-foreground/50 self-center"})]},C))})]}),e.jsx(w.div,{initial:{opacity:0}
11,animate:{opacity:1},transition:{delay:.4},className:"text-center",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:p(s,"El crédito expira 12 meses después de ser otorgado. No es transferible ni canjeable por efectivo. Aplica restricciones.","Credit expires 12 months after being granted. Not transferable or redeemable for cash. Restrictions apply.","Guthaben verfällt nach 12 Monaten. Nicht übertragbar oder in bar einlösbar.","Le crédit expire 12 mois après son attribution. Non transférable ni échangeable.")})})]})})},Qs=()=>{const{user:a}=B(),{language:s}=$(),{formatPrice:d}=Ce(),{data:h=[],isLoading:c}=F({queryKey:["user-travel-credits-all",a==null?void 0:a.id],queryFn:async()=>{if(!(a!=null&&a.id))return[];const{data:t,error:x}=await E.from("travel_credits").select("*").eq("user_id",a.id).order("expires_at",{ascending:!0});if(x)throw x;return t},enabled:!!(a!=null&&a.id)}),m=h.filter(t=>t.is_active&&t.amount>0&&!Xs(new Date(t.expires_at))),i=h.filter(t=>t.used_at||t.amount===0),l=m.reduce((t,x)=>t+Number(x.amount),0),r=i.reduce((t,x)=>t+Number(x.original_amount),0);if(c)return e.jsxs("div",{className:"bg-card rounded-2xl border border-border/50 shadow-soft overflow-hidden",children:[e.jsx("div",{className:"p-5 border-b border-border/50 bg-muted/20",children:e.jsx(_,{className:"h-5 w-36"})}),e.jsx("div",{className:"p-5 space-y-4",children:e.jsx(_,{className:"h-24 w-full rounded-xl"})})]});const j=t=>{const x=Ve(new Date(t),new Date);return x<=0?"expired":x<=30?"expiring-soon":"valid"};return e.jsxs("div",{className:"bg-card rounded-2xl border border-border/50 shadow-soft overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 sm:px-6 border-b border-border/50 bg-muted/20 flex items-center justify-between",children:[e.jsxs("h3",{className:"font-display font-semibold flex items-center gap-2",children:[e.jsx(oe,{className:"h-4 w-4 text-primary"}),s==="es"?"Crédito de Viaje":"Travel Credits"]}),e.jsxs(je,{to:"/referral",className:"text-xs text-primary hover:text-primary/80 font-medium flex items-center gap-1 transition-colors",children:[s==="es"?"Ganar más":"Earn more",e.jsx(Oe,{className:"h-3 w-3"})]})]}),e.jsxs("div",{className:"p-5 sm:p-6 space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"relative overflow-hidden rounded-xl p-4 text-center bg-success/8 border border-success/15",children:[e.jsx("div",{className:"absolute top-0 right-0 w-20 h-20 bg-success/5 rounded-full -translate-y-1/2 translate-x-1/2"}),e.jsx("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground mb-1 font-medium",children:s==="es"?"Disponible":"Available"}),e.jsx("p",{className:"text-2xl sm:text-3xl font-bold text-success relative",children:d(l)})]}),e.jsxs("div",{className:"relative overflow-hidden rounded-xl p-4 text-center bg-muted/50 border border-border/40",children:[e.jsx("div",{className:"absolute top-0 right-0 w-20 h-20 bg-muted/30 rounded-full -translate-y-1/2 translate-x-1/2"}),e.jsx("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground mb-1 font-medium",children:s==="es"?"Usado":"Used"}),e.jsx("p",{className:"text-2xl sm:text-3xl font-bold text-muted-foreground relative",children:d(r)})]})]}),m.length>0&&e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("h4",{className:"text-[11px] uppercase tracking-[0.15em] text-muted-foreground/70 font-semibold",children:s==="es"?"Créditos Activos":"Active Credits"}),e.jsx("div",{className:"space-y-2",children:m.map(t=>{const x=j(t.expires_at),g=Ve(new Date(t.expires_at),new Date);return e.jsxs("div",{className:"flex items-center justify-between p-3.5 rounded-xl bg-background border border-border/40 hover:border-border/60 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-success/10",children:e.jsx(As,{className:"h-4 w-4 text-success"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-sm",children:d(t.amount)}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.description||(s==="es"?"Crédito por referido":"Referral credit")})]})]}),e.jsxs(ce,{variant:"outline",className:`text-[10px] ${x==="expiring-soon"?"border-destructive/30 text-destructive bg-destructive/5":"border-border text-muted-foreground"}`,children:[x==="expiring-soon"&&e.jsx(Rs,{className:"h-3 w-3 mr-1"}),e.jsx(ne,{className:"h-3 w-3 mr-1"}),g,"d"]})]},t.id)})})]}),i.length>0&&e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("h4",{className:"text-[11px] uppercase tracking-[0.15em] text-muted-foreground
11/70 font-semibold",children:s==="es"?"Historial":"History"}),e.jsxs("div",{className:"space-y-1.5",children:[i.slice(0,3).map(t=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(_e,{className:"h-4 w-4 text-muted-foreground/50"}),e.jsx("span",{className:"text-sm text-muted-foreground line-through",children:d(t.original_amount)})]}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:t.used_at?as(new Date(t.used_at),"MMM d"):s==="es"?"Usado":"Used"})]},t.id)),i.length>3&&e.jsxs("p",{className:"text-[11px] text-muted-foreground text-center pt-1",children:["+",i.length-3," ",s==="es"?"más":"more"]})]})]}),h.length===0&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-14 h-14 mx-auto mb-3 rounded-2xl bg-muted/60 flex items-center justify-center",children:e.jsx(oe,{className:"h-6 w-6 text-muted-foreground/40"})}),e.jsx("p",{className:"text-sm text-muted-foreground font-medium",children:s==="es"?"Aún no tienes créditos":"No travel credits yet"}),e.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:s==="es"?"Refiere amigos para ganar créditos":"Refer friends to earn credits"})]})]})]})},Js=()=>{const{user:a}=B(),{data:s}=ke(),d=ss(),{language:h}=$(),c=N.useRef(null),[m,i]=N.useState(!1),l=()=>{var t;(t=c.current)==null||t.click()},r=async t=>{var g;const x=(g=t.target.files)==null?void 0:g[0];if(!(!x||!a)){if(!x.type.startsWith("image/")){S.error(h==="es"?"Solo se permiten imágenes":"Only images are allowed");return}i(!0);try{const v=await Us(x,{maxSizeMB:.5,maxWidthOrHeight:512}),b=v.name.split(".").pop()||"jpg",k=`${a.id}/avatar.${b}`,{error:T}=await E.storage.from("avatars").upload(k,v,{upsert:!0});if(T)throw T;const{data:M}=E.storage.from("avatars").getPublicUrl(k),P=`${M.publicUrl}?t=${Date.now()}`;await d.mutateAsync({avatar_url:P}),S.success(h==="es"?"Foto actualizada":"Photo updated")}catch(v){console.error("Avatar upload error:",v),S.error(h==="es"?"Error al subir la foto":"Error uploading photo")}finally{i(!1),c.current&&(c.current.value="")}}},j=((s==null?void 0:s.first_name)||(a==null?void 0:a.email)||"U")[0].toUpperCase();return e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsxs("div",{className:"relative group cursor-pointer",onClick:l,children:[e.jsx("div",{className:"absolute -inset-1 rounded-full bg-gradient-brand opacity-50 blur-sm group-hover:opacity-80 transition-opacity"}),e.jsxs($s,{className:"relative h-[clamp(5rem,12vw,7rem)] w-[clamp(5rem,12vw,7rem)] ring-[3px] ring-background shadow-elevated",children:[e.jsx(Fs,{src:(s==null?void 0:s.avatar_url)||void 0,className:"object-cover"}),e.jsx(qs,{className:"text-2xl sm:text-3xl font-bold bg-gradient-brand text-primary-foreground",children:j})]}),e.jsx("div",{className:"absolute inset-0 rounded-full bg-foreground
11/40 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center backdrop-blur-[2px]",children:m?e.jsx(Q,{className:"h-6 w-6 text-white animate-spin"}):e.jsx(Is,{className:"h-6 w-6 text-white"})}),e.jsx("div",{className:"absolute bottom-1 right-1 h-4 w-4 rounded-full bg-success border-2 border-background"})]}),e.jsx("button",{onClick:l,className:"text-xs text-primary/80 hover:text-primary font-medium transition-colors",disabled:m,children:m?h==="es"?"Subiendo...":"Uploading...":h==="es"?"Cambiar foto":"Change photo"}),e.jsx("input",{ref:c,type:"file",accept:"image/*",onChange:r,className:"hidden"})]})},de=[{key:"explorer",labelEn:"Explorer",labelEs:"Explorador",minBadges:0,icon:"🧭",gradient:"from-muted-foreground/20 to-muted/40"},{key:"adventurer",labelEn:"Adventurer",labelEs:"Aventurero",minBadges:5,icon:"🏔️",gradient:"from-info/20 to-info/5"},{key:"globetrotter",labelEn:"Globetrotter",labelEs:"Trotamundos",minBadges:15,icon:"🌍",gradient:"from-primary/20 to-secondary/10"},{key:"legend",labelEn:"Legend",labelEs:"Leyenda",minBadges:30,icon:"👑",gradient:"from-warning/25 to-primary/15"}];function ns(a){let s=de[0];for(const d of de)a>=d.minBadges&&(s=d);return s}function ea(a){for(const s of de)if(a<s.minBadges)return s;return null}const sa=({approvedCount:a,totalBadges:s,pendingCount:d,totalPoints:h,userName:c})=>{const{language:m}=$(),i=ns(a),l=ea(a),r=N.useRef(null),j=async()=>{const t=m==="es"?`🌍 Soy ${i.labelEs} en Experiencia México con ${a} insignias y ${h} pts!`:`🌍 I'm a ${i.labelEn} on Experiencia México with ${a} badges and ${h} pts!`;navigator.share?await navigator.share({title:"My Travel Passport",text:t,url:window.location.href}):(await navigator.clipboard.writeText(t),S.success(m==="es"?"¡Copiado al portapapeles!":"Copied to clipboard!"))};return e.jsxs("div",{ref:r,className:"relative overflow-hidden rounded-2xl border border-border/50 shadow-soft bg-card",children:[e.jsx("div",{className:`absolute inset-0 bg-gradient-to-br ${i.gradient}`}),e.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-primary/5 rounded-full blur-3xl -translate-y-1/2 translate-x-1/4"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-secondary/5 rounded-full blur-2xl translate-y-1/3 -translate-x-1/4"}),e.jsxs("div",{className:"relative p-5 sm:p-7",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-gradient-brand flex items-center justify-center shadow-brand shrink-0",children:e.jsx("span",{className:"text-3xl",children:i.icon})}),e.jsxs("div",{className:"text-center sm:text-left flex-1",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-[0.2em] text-muted-foreground/60 font-semibold mb-0.5",children:m==="es"?"Rango Actual":"Current Rank"}),e.jsx("h3",{className:"font-display text-xl font-bold",children:m==="es"?i.labelEs:i.labelEn}),c&&e.jsxs("p",{className:"text-sm text-muted-foreground mt-0.5",children:[c,m==="es"?" — Pasaporte de Viaje":" — Travel Passport"]})]}),e.jsx("div",{className:"flex gap-2",children:e.jsx(D,{variant:"outline",size:"icon",className:"rounded-xl h-9 w-9",onClick:j,children:e.jsx(X,{className:"h-4 w-4"})})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 mt-5",children:[e.jsxs("div",{className:"text-center px-3 py-2.5 rounded-xl bg-success/10 border border-success/20",children:[e.jsx("p",{className:"text-xl font-bold text-success",children:a}),e.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:m==="es"?"Ganadas":"Earned"})]}),e.jsxs("div",{className:"text-center px-3 py-2.5 rounded-xl bg-primary/10 border border-primary/20",children:[e.jsx("p",{className:"text-xl font-bold text-primary",children:h}),e.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:m==="es"?"Puntos":"Points"})]}),d>0?e.jsxs("div",{className:"text-center px-3 py-2.5 rounded-xl bg-warning/10 border border-warning/20",children:[e.jsx("p",{className:"text-xl font-bold text-warning",children:d}),e.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:m==="es"?"Pendientes":"Pending"})]}):e.jsxs("div",{className:"text-center px-3 py-2.5 rounded-xl bg-muted/50 border border-border/30",children:[e.jsx("p",{className:"text-xl font-bold text-muted-foreground",children:s}),e.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Total"})]})]}),l&&e.jsxs("div",{className:"mt-5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground mb-2",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Z,{className:"h-3 w-3"}),m==="es"?`Siguiente: ${l.labelEs}`:`Next: ${l.labelEn}`]}),e.jsxs("span",{className:"font-semibold",children:[a,"/",l.minBadges]})]}),e.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:e.jsx(w.div,{className:"h-full rounded-full bg-gradient-brand",initial:{width:0},animate:{width:`${Math.min(a/l.minBadges*100,100)}%`},transition:{duration:1,ease:"easeOut"}})})]}),e.jsx("div",{className:"flex items-center justify-center gap-1.5 mt-4",children:de.map(t=>{const x=t.key===i.key,g=a>=t.minBadges;return e.jsxs("div",{className:`flex items-center gap-1 px-2.5 py-1 rounded-lg text-[10px] font-medium transition-all ${x?"bg-foreground text-background scale-105":g?"bg-muted text-foreground":"bg-muted/40 text-muted-foreground
11/50"}`,children:[e.jsx("span",{children:t.icon}),e.jsx("span",{className:"hidden sm:inline",children:m==="es"?t.labelEs:t.labelEn})]},t.key)})})]})]})},Ge=[{count:1,icon:"🎯",labelEn:"First Steps",labelEs:"Primeros Pasos"},{count:5,icon:"⭐",labelEn:"Rising Star",labelEs:"Estrella Naciente"},{count:10,icon:"🔥",labelEn:"On Fire",labelEs:"En Llamas"},{count:25,icon:"💎",labelEn:"Diamond",labelEs:"Diamante"},{count:50,icon:"🏆",labelEn:"Champion",labelEs:"Campeón"}],aa=({approvedCount:a})=>{const{language:s}=$(),d=N.useRef(!1);return N.useEffect(()=>{if(d.current)return;Ge.find(c=>c.count===a)&&(d.current=!0,setTimeout(()=>rs(),500))},[a]),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h4",{className:"text-[11px] uppercase tracking-[0.15em] text-muted-foreground/70 font-semibold flex items-center gap-2",children:[e.jsx(le,{className:"h-3.5 w-3.5"}),s==="es"?"Hitos":"Milestones"]}),e.jsx("div",{className:"flex gap-2 overflow-x-auto pb-1 no-scrollbar",children:Ge.map(h=>{const c=a>=h.count;return e.jsxs(w.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:`flex flex-col items-center gap-1 min-w-[72px] shrink-0 p-2.5 rounded-xl border transition-all ${c?"bg-gradient-to-br from-warning/10 to-primary/5 border-warning/25 shadow-soft":"bg-muted/20 border-border/30 opacity-40"}`,children:[e.jsx("span",{className:`text-2xl ${c?"":"grayscale"}`,children:h.icon}),e.jsx("span",{className:"text-[10px] font-semibold text-center leading-tight",children:s==="es"?h.labelEs:h.labelEn}),e.jsxs("span",{className:"text-[9px] text-muted-foreground",children:[h.count," badges"]})]},h.count)})})]})},ra=({allBadges:a,approvedBadgeIds:s})=>{const{language:d}=$(),h=N.useRef(new Set),{data:c=[],isLoading:m}=F({queryKey:["passport-collections"],queryFn:async()=>{const{data:l,error:r}=await E.from("passport_collections").select("*").eq("is_active",!0);if(r)throw r;return l}});N.useEffect(()=>{c.length!==0&&c.forEach(l=>{const r=a.filter(g=>g.collection_id===l.id),j=r.filter(g=>s.has(g.id)).length,t=r.length;t>0&&j===t&&!h.current.has(l.id)&&(h.current.add(l.id),l.name_en.includes("7 Wonders")&&setTimeout(()=>{rs(),S.success(d==="es"?"🏛️ ¡Completaste las 7 Maravillas del Mundo! Nuestro equipo te contactará con tu recompensa.":"🏛️ You completed the 7 Wonders of the World! Our team will c
11ontact you with your reward.",{duration:8e3}),i(l)},600))})},[c,a,s,d]);const i=async l=>{try{const{data:{user:r}}=await E.auth.getUser();if(!r)return;await E.from("audit_logs").insert({admin_id:r.id,action_type:"collection_completed",target_table:"passport_collections",target_id:l.id,changes_made:{collection_name:l.name_en,message:`User completed "${l.name_en}" collection — eligible for reward`}})}catch{}};return m?e.jsx(_,{className:"h-32 rounded-2xl"}):c.length===0?null:e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-[11px] uppercase tracking-[0.15em] text-muted-foreground/70 font-semibold",children:d==="es"?"🗺️ Colecciones":"🗺️ Collections"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:c.map(l=>{const r=a.filter(b=>b.collection_id===l.id),j=r.filter(b=>s.has(b.id)).length,t=r.length,x=t>0&&j===t,g=t>0?j/t*100:0,v=l.name_en.includes("7 Wonders");return e.jsx(w.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:`rounded-xl border p-4 transition-all ${x?v?"bg-gradient-to-br from-warning/15 via-primary/10 to-secondary/10 border-warning/40 shadow-[0_0_20px_hsl(var(--warning)/0.15)]":"bg-gradient-to-br from-warning/10 to-primary/5 border-warning/30 shadow-soft":"bg-card border-border/50"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx("span",{className:"text-2xl",children:l.icon}),x&&v&&e.jsx(w.div,{className:"absolute -top-1 -right-1",animate:{rotate:[0,10,-10,0]},transition:{repeat:1/0,duration:2},children:e.jsx(ie,{className:"h-4 w-4 text-warning"})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("p",{className:"font-semibold text-sm truncate",children:d==="es"?l.name_es:l.name_en}),x&&e.jsx(_e,{className:"h-4 w-4 text-warning shrink-0"}),x&&v&&e.jsx("span",{className:"text-[9px] font-bold text-warning bg-warning/15 px-1.5 py-0.5 rounded-full uppercase tracking-wider",children:d==="es"?"Recompensa":"Reward"})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5 line-clamp-2",children:d==="es"?l.description_es:l.description_en}),e.jsxs("div",{className:"mt-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground mb-1",children:[e.jsxs("span",{children:[j,"/",t]}),x&&e.jsxs("span",{className:"text-warning font-semibold",children:["+",l.bonus_points," pts"]})]}),e.jsx("div",{className:"h-1.5 rounded-full bg-muted overflow-hidden",children:e.jsx(w.div,{className:`h-full rounded-full ${x&&v?"bg-gradient-to-r from-warning via-primary to-secondary":x?"bg-warning":"bg-gradient-brand"}`,initial:{width:0},animate:{width:`${g}%`},transition:{duration:.8,ease:"easeOut"}})})]}),e.jsx("div",{className:"flex gap-1 mt-2 flex-wrap",children:r.map(b=>{const k=s.has(b.id);return e.jsx("span",{className:`text-sm ${k?"":"grayscale opacity-30"}`,title:d==="es"?b.name_es:b.name_en,children:b.icon},b.id)})})]})]})},l.id)})})]})},ta=()=>{const{language:a}=$(),{user:s}=B(),{data:d=[],isLoading:h}=F({queryKey:["passport-leaderboard"],queryFn:async()=>{const{data:m,error:i}=await E.from("user_passport_badges").select("user_id").eq("status","approved");if(i)throw i;const l={};(m||[]).forEach(g=>{l[g.user_id]=(l[g.user_id]||0)+1});const r=Object.keys(l);if(r.length===0)return[];const{data:j,error:t}=await E.from("profiles").select("user_id, first_name, avatar_url").in("user_id",r);if(t)throw t;const x={};return(j||[]).forEach(g=>{x[g.user_id]=g}),r.map(g=>{var v,b;return{user_id:g,first_name:((v=x[g])==null?void 0:v.first_name)||null,avatar_url:((b=x[g])==null?void 0:b.avatar_url)||null,badge_count:l[g]}}).sort((g,v)=>v.badge_count-g.badge_count).slice(0,20)}}),c=[e.jsx(Z,{className:"h-5 w-5 text-warning"}),e.jsx(Os,{className:"h-5 w-5 text-muted-foreground"}),e.jsx(ve,{className:"h-5 w-5 text-amber-700"})];return h?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map((m,i)=>e.jsx(_,{className:"h-14 rounded-xl"},i))}):d.length===0?e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[e.jsx(Z,{className:"h-10 w-10 mx-auto mb-3 opacity-30"}),e.jsx("p",{className:"text-sm",children:a==="es"?"Aún no hay viajeros en el ranking":"No travelers on the leaderboard yet"})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h4",{className:"text-[11px] uppercase tracking-[0.15em] text-muted-foreground
11/70 font-semibold flex items-center gap-2",children:[e.jsx(Z,{className:"h-3.5 w-3.5"}),a==="es"?"Top Viajeros":"Top Travelers"]}),e.jsx("div",{className:"space-y-1.5",children:d.map((m,i)=>{const l=m.user_id===(s==null?void 0:s.id),r=ns(m.badge_count);return e.jsxs(w.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:i*.05},className:`flex items-center gap-3 p-3 rounded-xl border transition-all ${l?"bg-primary/5 border-primary/20 shadow-soft":"bg-card border-border/40"}`,children:[e.jsx("div",{className:"w-8 text-center shrink-0",children:i<3?c[i]:e.jsxs("span",{className:"text-sm font-bold text-muted-foreground",children:["#",i+1]})}),e.jsx("div",{className:"w-9 h-9 rounded-full bg-muted overflow-hidden shrink-0",children:m.avatar_url?e.jsx("img",{src:m.avatar_url,alt:"",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-sm font-bold text-muted-foreground",children:(m.first_name||"?")[0]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-sm font-semibold truncate",children:[m.first_name||(a==="es"?"Viajero":"Traveler"),l&&e.jsxs("span",{className:"text-primary ml-1 text-xs",children:["(",a==="es"?"tú":"you",")"]})]}),e.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[r.icon," ",a==="es"?r.labelEs:r.labelEn]})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsx("p",{className:"text-sm font-bold",children:m.badge_count}),e.jsx("p",{className:"text-[9px] text-muted-foreground uppercase",children:"badges"})]})]},m.user_id)})})]})},na={landmark:"bg-amber-500/10 text-amber-700 border-amber-300/30",adventure:"bg-info/10 text-info border-info/30",food:"bg-primary/10 text-primary border-primary/30",destination:"bg-secondary/10 text-secondary border-secondary/30",nature:"bg-success/10 text-success border-success/30"},He={landmark:{en:"Landmarks",es:"Monumentos"},adventure:{en:"Adventure",es:"Aventura"},food:{en:"Food & Drink",es:"Comida y Bebida"},destination:{en:"Destinations",es:"Destinos"},nature:{en:"Nature",es:"Naturaleza"}},I={common:{labelEn:"Common",labelEs:"Común",icon:e.jsx(Qe,{className:"h-3 w-3"}),glow:"",border:"border-border/50"},rare:{labelEn:"Rare",labelEs:"Rara",icon:e.jsx(Ws,{className:"h-3 w-3 text-info"}),glow:"shadow-[0_0_12px_hsl(var(--info)/0.15)]",border:"border-info/30"},legendary:{labelEn:"Legendary",labelEs:"Legendaria",icon:e.jsx(ts,{className:"h-3 w-3 text-warning"}),glow:"shadow-[0_0_18px_hsl(var(--warning)/0.2)]",border:"border-warning/30"}},ia=()=>{var se,ae,re;const{user:a}=B(),{language:s}=$(),{data:d}=ke(),h=Ye(),[c,m]=N.useState(""),[i,l]=N.useState(null),[r,j]=N.useState(null),[t,x]=N.useState(""),[g,v]=N.useState(""),[b,k]=N.useState("badges"),{data:T=[],isLoading:M}=F({queryKey:["passport-badges"],queryFn:async()=>{const{data:n,error:u}=await E.from("passport_badges").select("*").eq("is_active",!0).order("category",{ascending:!0});if(u)throw u;return n}}),{data:P=[],isLoading:R}=F({queryKey:["user-passport-badges",a==null?void 0:a.id],queryFn:async()=>{if(!a)return[];const{data:n,error:u}=await E.from("user_passport_badges").select("*").eq("user_id",a.id);if(u)throw u;return n},enabled:!!a}),L=ms({mutationFn:async({badgeId:n,note:u,visitedAt:f})=>{if(!a)throw new Error("Not authenticated");const{error:C}=await E.from("user_passport_badges").insert({user_id:a.id,badge_id:n,proof_note:u||null,visited_at:f||null,status:"pending"});if(C)throw C},onSuccess:()=>{h.invalidateQueries({queryKey:["user-passport-badges"]}),S.success(s==="es"?"¡Insignia reclamada! Pendiente de aprobación.":"Badge claimed! Pending approval."),j(null),x(""),v("")},onError:n=>{var u;(u=n.message)!=null&&u.includes("duplicate")?S.error(s==="es"?"Ya reclamaste esta insignia":"You already claimed this badge"):S.error(s==="es"?"Error al reclamar":"Error claiming badge")}}),A=n=>P.find(u=>u.badge_id===n),o=P.filter(n=>n.status==="approved"),y=o.length,J=P.filter(n=>n.status==="pending").length,me=N.useMemo(()=>new Set(o.map(n=>n.badge_id)),[o]),W=N.useMemo(()=>o.reduce((n,u)=>{const f=T.find(C=>C.id===u.badge_id);return n+((f==null?void 0:f.points)||10)},0),[o,T]),xe=[...new Set(T.map(n=>n.category))],ee=T.filter(n=>{const u=c===""||n.name_en.toLowerCase().includes(c.toLowerCase())||n.name_es.toLowerCase().includes(c.toLowerCase())||(n.country||"").toLowerCase().includes(c.toLowerCase())||(n.city||"").toLowerCase().includes(c.toLowerCase()),f=!i||n.category===i;return u&&f});if(M||R)return e.jsxs("div",{className:"space-y-6",children:[e.jsx(_,{className:"h-40 rounded-2xl"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:[...Array(6)].map((n,u)=>e.jsx(_,{className:"h-40 rounded-xl"},u))})]});const ue=[{key:"badges",labelEn:"Badges",labelEs:"Insignias",icon:e.jsx(le,{className:"h-3.5 w-3.5"})},{key:"collections",labelEn:"Collections",labelEs:"Colecciones",icon:e.jsx(we,{className:"h-3.5 w-3.5"})},{key:"leaderboard",labelEn:"Leaderboard",labelEs:"Ranking",icon:e.jsx(Z,{className:"h-3.5 w-3.5"})}];return e.jsxs("div",{className:"space-y-6",children:[e.jsx(sa,{approvedCount:y,totalBadges:T.length,pendingCount:J,totalPoints:W,userName:(d==null?void 0:d.first_name)||void 0}),e.jsx(aa,{approvedCount:y}),y>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h4",{className:"text-[11px] uppercase tracking-[0.15em] text-muted-foreground
11/70 font-semibold flex items-center gap-2",children:[e.jsx(le,{className:"h-3.5 w-3.5"}),s==="es"?"Insignias Ganadas":"Earned Badges"]}),e.jsx("div",{className:"flex gap-3 overflow-x-auto pb-2 no-scrollbar",children:o.map(n=>{const u=T.find(C=>C.id===n.badge_id);if(!u)return null;const f=I[u.rarity]||I.common;return e.jsxs(w.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},className:"flex flex-col items-center gap-1.5 min-w-[80px] shrink-0",children:[e.jsx("div",{className:`w-14 h-14 rounded-2xl bg-gradient-to-br from-primary/15 to-secondary/15 border flex items-center justify-center text-2xl hover:scale-110 transition-transform cursor-default ${f.border} ${f.glow}`,children:u.icon}),e.jsx("span",{className:"text-[10px] font-medium text-center leading-tight max-w-[80px]",children:s==="es"?u.name_es:u.name_en})]},n.id)})})]}),e.jsx("div",{className:"flex gap-1.5 bg-muted/50 rounded-xl p-1",children:ue.map(n=>e.jsxs("button",{onClick:()=>k(n.key),className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium transition-all ${b===n.key?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[n.icon,s==="es"?n.labelEs:n.labelEn]},n.key))}),e.jsxs(Xe,{mode:"wait",children:[b==="badges"&&e.jsxs(w.div,{initial:{opacity:0}
11,animate:{opacity:1},exit:{opacity:0},className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(xs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground/50"}),e.jsx(z,{placeholder:s==="es"?"Buscar insignias...":"Search badges...",value:c,onChange:n=>m(n.target.value),className:"pl-10 h-10 rounded-xl border-border/60"})]}),e.jsxs("div",{className:"flex gap-1.5 overflow-x-auto no-scrollbar",children:[e.jsx("button",{onClick:()=>l(null),className:`px-3 py-2 rounded-lg text-xs font-medium whitespace-nowrap transition-colors ${i?"bg-muted text-muted-foreground hover:bg-muted/80":"bg-foreground text-background"}`,children:s==="es"?"Todas":"All"}),xe.map(n=>{var u;return e.jsx("button",{onClick:()=>l(n===i?null:n),className:`px-3 py-2 rounded-lg text-xs font-medium whitespace-nowrap transition-colors ${i===n?"bg-foreground text-background":"bg-muted text-muted-foreground hover:bg-muted/80"}`,children:((u=He[n])==null?void 0:u[s])||n},n)})]})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3",children:ee.map(n=>{var Se;const u=A(n.id),f=(u==null?void 0:u.status)==="approved",C=(u==null?void 0:u.status)==="pending",te=(u==null?void 0:u.status)==="rejected",G=!!u,q=I[n.rarity]||I.common;return e.jsxs(w.div,{layout:!0,initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:`relative rounded-xl border p-4 transition-all ${q.glow} ${f?"bg-gradient-to-br from-success/5 to-success/10 border-success/25 shadow-soft":C?"bg-gradient-to-br from-warning/5 to-warning/10 border-warning/25":te?"bg-muted/30 border-border/40 opacity-60":`bg-card ${q.border} hover:shadow-soft cursor-pointer`}`,onClick:()=>{!G&&a&&j(n)},children:[n.rarity!=="common"&&e.jsxs("div",{className:"absolute top-2 left-2 flex items-center gap-0.5",children:[q.icon,e.jsx("span",{className:"text-[9px] font-semibold text-muted-foreground",children:s==="es"?q.labelEs:q.labelEn})]}),f&&e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx(_e,{className:"h-4 w-4 text-success"})}),C&&e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx(ne,{className:"h-4 w-4 text-warning"})}),te&&e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx(Bs,{className:"h-4 w-4 text-destructive"})}),e.jsx("div",{className:`text-3xl mb-3 ${n.rarity!=="common"?"mt-3":""} ${G?"":"grayscale opacity-40"} transition-all`,children:n.icon}),e.jsx("p",{className:"font-semibold text-sm leading-tight mb-1",children:s==="es"?n.name_es:n.name_en}),(n.city||n.country)&&e.jsxs("p",{className:"text-[11px] text-muted-foreground flex items-center gap-1",children:[e.jsx(Ze,{className:"h-3 w-3"}),[n.city,n.country].filter(Boolean).join(", ")]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-2",children:[e.jsx(ce,{variant:"outline",className:`text-[10px] ${na[n.category]||"border-border"}`,children:((Se=He[n.category])==null?void 0:Se[s])||n.category}),e.jsxs("span",{className:"text-[9px] text-muted-foreground font-medium",children:[n.points," pts"]})]}),f&&(u==null?void 0:u.visited_at)&&e.jsxs("p",{className:"text-[10px] text-success mt-1.5 flex items-center gap-1",children:[e.jsx(us,{className:"h-3 w-3"}),as(new Date(u.visited_at),"MMM yyyy")]}),!G&&a&&e.jsx("p",{className:"text-[10px] text-primary mt-2 font-medium",children:s==="es"?"Toca para reclamar →":"Tap to claim →"})]},n.id)})}),ee.length===0&&e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[e.jsx(we,{className:"h-10 w-10 mx-auto mb-3 opacity-30"}),e.jsx("p",{className:"text-sm",children:s==="es"?"No se encontraron insignias":"No badges found"})]})]},"badges"),b==="collections"&&e.jsx(w.div,{initial:{opacity:0}
11,animate:{opacity:1},exit:{opacity:0},children:e.jsx(ra,{allBadges:T,approvedBadgeIds:me})},"collections"),b==="leaderboard"&&e.jsx(w.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:e.jsx(ta,{})},"leaderboard")]}),e.jsx(ps,{open:!!r,onOpenChange:()=>{j(null),x(""),v("")},children:e.jsxs(hs,{className:"sm:max-w-md",children:[e.jsxs(gs,{children:[e.jsxs(fs,{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-3xl",children:r==null?void 0:r.icon}),e.jsxs("div",{children:[e.jsx("span",{children:r&&(s==="es"?r.name_es:r.name_en)}),r&&r.rarity!=="common"&&e.jsxs("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:[(se=I[r.rarity])==null?void 0:se.icon," ",s==="es"?(ae=I[r.rarity])==null?void 0:ae.labelEs:(re=I[r.rarity])==null?void 0:re.labelEn]})]})]}),e.jsx(bs,{children:r&&(s==="es"?r.description_es:r.description_en)})]}),e.jsxs("div",{className:"space-y-4 pt-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs uppercase tracking-wider text-muted-foreground font-medium mb-1.5 block",children:s==="es"?"¿Cuándo visitaste?":"When did you visit?"}),e.jsx(z,{type:"date",value:g,onChange:n=>v(n.target.value),className:"h-11 rounded-xl"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs uppercase tracking-wider text-muted-foreground font-medium mb-1.5 block",children:s==="es"?"Cuéntanos tu experiencia (opcional)":"Tell us about your experience (optional)"}),e.jsx(zs,{placeholder:s==="es"?"Comparte un recuerdo...":"Share a memory...",value:t,onChange:n=>x(n.target.value),rows:3,className:"rounded-xl resize-none"})]}),e.jsxs("div",{className:"bg-muted/50 rounded-xl p-3 flex items-start gap-2",children:[e.jsx(ne,{className:"h-4 w-4 text-muted-foreground shrink-0 mt-0.5"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s==="es"?"Tu insignia será revisada por un administrador antes de aparecer en tu pasaporte.":"Your badge will be reviewed by an admin before appearing in your passport."})]}),r&&e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground bg-muted/30 rounded-xl p-3",children:[e.jsx("span",{children:s==="es"?"Puntos al aprobar":"Points on approval"}),e.jsxs("span",{className:"font-bold text-primary",children:["+",r.points," pts"]})]}),e.jsxs(D,{onClick:()=>{r&&L.mutate({badgeId:r.id,note:t,visitedAt:g})},disabled:L.isPending,variant:"gradient",className:"w-full h-11 rounded-xl",children:[L.isPending?e.jsx(ne,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Vs,{className:"h-4 w-4 mr-2"}),s==="es"?"Reclamar Insignia":"Claim Badge"]})]})]})})]})},oa=()=>{const{user:a}=B(),{language:s}=$(),{data:d=[],isLoading:h}=F({queryKey:["user-roles",a==null?void 0:a.id],queryFn:async()=>{if(!a)return[];const{data:r}=await E.from("user_roles").select("role").eq("user_id",a.id);return(r||[]).map(j=>j.role)},enabled:!!a}),{data:c,isLoading:m}=F({queryKey:["ambassador-status",a==null?void 0:a.id],queryFn:async()=>{if(!a)return null;const{data:r}=await E.from("ambassador_applications").select("status").eq("user_id",a.id).maybeSingle();return(r==null?void 0:r.status)||null},enabled:!!a});if(h||m)return e.jsxs("div",{className:"bg-card rounded-2xl border border-border/50 shadow-soft p-5",children:[e.jsx(_,{className:"h-4 w-24 mb-4"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(_,{className:"h-20 w-36 rounded-xl"}),e.jsx(_,{className:"h-20 w-36 rounded-xl"})]})]});const l=[];return c==="active"&&l.push({icon:e.jsx(Qe,{className:"h-5 w-5"}),label:s==="es"?"Embajador":"Ambassador",sublabel:s==="es"?"Embajador activo":"Active ambassador",gradient:"from-amber-500/15 to-orange-500/10 border-amber-400/30",iconBg:"bg-amber-500/20 text-amber-600"}),d.includes("super_admin")?l.push({icon:e.jsx(ts,{className:"h-5 w-5"}),label:"Super Admin",sublabel:s==="es"?"Acceso total":"Full access",gradient:"from-primary/15 to-secondary/10 border-primary/30",iconBg:"bg-primary/20 text-primary"}):d.includes("admin")&&l.push({icon:e.jsx(Je,{className:"h-5 w-5"}),label:"Admin",sublabel:s==="es"?"Administrador":"Administrator",gradient:"from-primary/15 to-primary/5 border-primary/25",iconBg:"bg-primary/20 text-primary"}),l.push({icon:e.jsx(ve,{className:"h-5 w-5"}),label:s==="es"?"Viajero":"Traveler",sublabel:s==="es"?"Miembro de la comunidad":"Community member",gradient:"from-muted/80 to-muted/40 border-border/60",iconBg:"bg-foreground
11/10 text-foreground/70"}),e.jsxs("div",{className:"bg-card rounded-2xl border border-border/50 shadow-soft p-5 sm:p-6",children:[e.jsxs("h3",{className:"text-[11px] uppercase tracking-[0.15em] text-muted-foreground/70 font-semibold mb-4 flex items-center gap-2",children:[e.jsx(ve,{className:"h-3.5 w-3.5"}),s==="es"?"Insignias":"Badges"]}),e.jsx("div",{className:"flex flex-wrap gap-3",children:l.map((r,j)=>e.jsxs("div",{className:`flex items-center gap-3 px-4 py-3.5 rounded-xl border bg-gradient-to-br ${r.gradient} transition-all hover:scale-[1.02] hover:shadow-soft`,children:[e.jsx("div",{className:`p-2 rounded-lg ${r.iconBg}`,children:r.icon}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-sm leading-tight",children:r.label}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:r.sublabel})]})]},j))})]})},la=js({first_name:ge().min(2).max(100).optional().or(fe("")),phone:ge().max(20).optional().or(fe("")),country:ge().max(100).optional().or(fe("")),preferred_language:Le(["es","en","de"]).optional(),preferred_currency:Le(["USD","MXN","EUR","AUD"]).optional()}),da=[{id:"profile",icon:ye,labelEs:"Perfil",labelEn:"Profile",labelDe:"Profil",labelFr:"Profil"},{id:"passport",icon:Ys,labelEs:"Pasaporte",labelEn:"Passport",labelDe:"Reisepass",labelFr:"Passeport"},{id:"trips",icon:Ze,labelEs:"Mis Viajes",labelEn:"My Trips",labelDe:"Meine Reisen",labelFr:"Mes voyages"},{id:"wishlist",icon:es,labelEs:"Wishlist",labelEn:"Wishlist",labelDe:"Wunschliste",labelFr:"Favoris"},{id:"referral",icon:ie,labelEs:"Referidos",labelEn:"Referrals",labelDe:"Empfehlungen",labelFr:"Parrainages"}],nr=()=>{var A;const a=ys(),{user:s,loading:d,signOut:h}=B(),{language:c,setLanguage:m,tx:i}=$(),{setCurrency:l}=Ce(),{data:r,isLoading:j}=ke(),t=ss(),{data:x=[],isLoading:g}=_s(),{data:v=[],isLoading:b}=Es(),[k,T]=N.useState("profile"),M=Ns({resolver:ks(la),defaultValues:{first_name:"",phone:"",country:"",preferred_language:"es",preferred_currency:"USD"}});N.useEffect(()=>{!d&&!s&&a("/")},[s,d,a]),N.useEffect(()=>{r&&M.reset({first_name:r.first_name||"",phone:r.phone||"",country:r.country||"",preferred_language:r.preferred_language||"es",preferred_currency:r.preferred_currency||"USD"})},[r,M]);const P=async o=>{try{await t.mutateAsync(o),o.preferred_language&&m(o.preferred_language),o.preferred_currency&&l(o.preferred_currency),S.success(i("Perfil actualizado","Profile updated","Profil aktualisiert","Profil mis à jour"))}catch{S.error(i("Error al actualizar","Error updating profile","Fehler beim Aktualisieren","Erreur de mise à jour"))}};if(d||!s)return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(Ae,{}),e.jsx("div",{className:"pt-24 pb-16 container mx-auto px-4",children:e.jsx("div",{className:"flex items-center justify-center min-h-[50vh]",children:e.jsx(Q,{className:"h-8 w-8 animate-spin text-primary"})})}),e.jsx(Fe,{})]});const R=(r==null?void 0:r.first_name)||((A=s.email)==null?void 0:A.split("@")[0])||"",L=s.created_at?new Date(s.created_at).toLocaleDateString(c==="fr"?"fr-FR":c==="es"?"es-MX":c==="de"?"de-DE":"en-US",{month:"long",year:"numeric"}):"";return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(Ae,{}),e.jsxs("main",{className:"pt-20 pb-16",children:[e.jsxs("div",{className:"relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-primary/8 via-transparent to-secondary/8"}),e.jsx("div",{className:"absolute top-0 right-0 w-[500px] h-[500px] bg-primary/5 rounded-full blur-3xl -translate-y-1/2 translate-x-1/4"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-[400px] h-[400px] bg-secondary/5 rounded-full blur-3xl translate-y-1/2 -translate-x-1/4"}),e.jsx("div",{className:"container mx-auto px-4 relative",children:e.jsx("div",{className:"max-w-5xl mx-auto py-8 md:py-12",children:e.jsxs(w.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex flex-col sm:flex-row items-center sm:items-end gap-6",children:[e.jsx(Js,{}),e.jsxs("div",{className:"flex-1 text-center sm:text-left space-y-1.5",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3",children:[e.jsx("h1",{className:"font-display text-[clamp(1.5rem,4vw,2.5rem)] font-bold tracking-tight",children:R}),e.jsxs(ce,{variant:"outline",className:"border-primary/30 text-primary text-xs w-fit mx-auto 
11sm:mx-0",children:[e.jsx(le,{className:"h-3 w-3 mr-1"}),i("Miembro","Member","Mitglied","Membre")]})]}),e.jsxs("p",{className:"text-muted-foreground text-sm flex items-center justify-center sm:justify-start gap-1.5",children:[e.jsx(Be,{className:"h-3.5 w-3.5"}),s.email]}),L&&e.jsx("p",{className:"text-muted-foreground/60 text-xs",children:i(`Miembro desde ${L}`,`Member since ${L}`,`Mitglied seit ${L}`,`Membre depuis ${L}`)})]}),e.jsx("div",{className:"hidden sm:flex gap-2",children:e.jsxs(D,{variant:"outline",size:"sm",className:"text-destructive/70 hover:text-destructive border-border hover:border-destructive/30 hover:bg-destructive/5",onClick:()=>{h(),a("/")},children:[e.jsx(Re,{className:"h-3.5 w-3.5 mr-1.5"}),i("Salir","Log out","Abmelden","Déconnexion")]})})]})})})]}),e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsx(w.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.1},className:"sticky top-[56px] z-20 -mx-4 px-4 py-3 bg-background/80 backdrop-blur-lg border-b border-border/50",children:e.jsx("div",{className:"flex gap-1 overflow-x-auto no-scrollbar",children:da.map(o=>{const y=k===o.id;return e.jsxs("button",{onClick:()=>T(o.id),className:`relative flex items-center gap-2 px-4 py-2.5 rounded-xl text-sm font-medium transition-all whitespace-nowrap ${y?"text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(o.icon,{className:"h-4 w-4"}),e.jsx("span",{children:c==="fr"?o.labelFr:c==="es"?o.labelEs:c==="de"?o.labelDe:o.labelEn}),o.id==="trips"&&x.length>0&&e.jsx("span",{className:"ml-1 text-[10px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-semibold",children:x.length}),o.id==="wishlist"&&v.length>0&&e.jsx("span",{className:"ml-1 text-[10px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-semibold",children:v.length}),y&&e.jsx(w.div,{layoutId:"profileActiveTab",className:"absolute inset-0 bg-primary/8 rounded-xl",transition:{type:"spring",bounce:.15,duration:.5}})]},o.id)})})}),e.jsx("div",{className:"mt-6",children:e.jsx(Ss,{variant:"compact",className:"mb-6"})}),e.jsxs(Xe,{mode:"wait",children:[k==="profile"&&e.jsxs(w.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},transition:{duration:.2},className:"space-y-6",children:[e.jsx(oa,{}),e.jsx(Qs,{}),e.jsxs("div",{className:"bg-card rounded-2xl border border-border/50 shadow-soft overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 sm:px-7 sm:py-5 border-b border-border/50 bg-muted/20",children:[e.jsxs("h3",{className:"font-display font-semibold flex items-center gap-2",children:[e.jsx(ye,{className:"h-4 w-4 text-muted-foreground"}),i("Información Personal","Personal Information","Persönliche Daten")]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:i("Mantén tus datos actualizados","Keep your details up to date","Halte deine Daten aktuell")})]}),e.jsx("div",{className:"p-5 sm:p-7",children:j?e.jsx("div",{className:"space-y-6",children:[...Array(4)].map((o,y)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{className:"h-4 w-24"}),e.jsx(_,{className:"h-10 w-full"})]},y))}):e.jsx(vs,{...M,children:e.jsxs("form",{onSubmit:M.handleSubmit(P),className:"space-y-6",children:[e.jsxs("div",{className:"grid sm:grid-cols-2 gap-5",children:[e.jsx(H,{control:M.control,name:"first_name",render:({field:o})=>e.jsxs(K,{children:[e.jsx(V,{className:"text-xs uppercase tracking-wider text-muted-foreground",children:i("Nombre","First name","Vorname")}),e.jsx(Y,{children:e.jsxs("div",{className:"relative",children:[e.jsx(ye,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground/50"}),e.jsx(z,{placeholder:i("Tu nombre","Your first name","Dein Vorname"),className:"pl-10 h-11 rounded-xl border-border/60 focus:border-primary/50",...o})]})}),e.jsx(O,{})]})}),e.jsx(H,{control:M.control,name:"phone",render:({field:o})=>e.jsxs(K,{children:[e.jsx(V,{className:"text-xs uppercase tracking-wider text-muted-foreground",children:i("Teléfono","Phone","Telefon")}),e.jsx(Y,{children:e.jsxs("div",{className:"relative",children:[e.jsx(Hs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground
11/50"}),e.jsx(z,{className:"pl-10 h-11 rounded-xl border-border/60 focus:border-primary/50",...o})]})}),e.jsx(O,{})]})}),e.jsx(H,{control:M.control,name:"country",render:({field:o})=>e.jsxs(K,{children:[e.jsx(V,{className:"text-xs uppercase tracking-wider text-muted-foreground",children:i("País","Country","Land")}),e.jsx(Y,{children:e.jsxs("div",{className:"relative",children:[e.jsx(we,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground/50"}),e.jsx(z,{placeholder:i("México","Mexico","Mexiko"),className:"pl-10 h-11 rounded-xl border-border/60 focus:border-primary/50",...o})]})}),e.jsx(O,{})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(V,{className:"text-xs uppercase tracking-wider text-muted-foreground",children:i("Correo electrónico","Email","E-Mail")}),e.jsxs("div",{className:"relative",children:[e.jsx(Be,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground/50"}),e.jsx(z,{value:s.email||"",disabled:!0,className:"pl-10 h-11 rounded-xl bg-muted/40 border-border/40"})]}),e.jsxs("p",{className:"text-[11px] text-muted-foreground/60 flex items-center gap-1",children:[e.jsx(Je,{className:"h-3 w-3"}),i("El correo no se puede cambiar","Email cannot be changed","E-Mail kann nicht geändert werden")]})]})]}),e.jsxs("div",{className:"pt-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("div",{className:"h-px flex-1 bg-border/50"}),e.jsxs("span",{className:"text-xs uppercase tracking-wider text-muted-foreground font-medium flex items-center gap-1.5",children:[e.jsx(ws,{className:"h-3.5 w-3.5"}),i("Preferencias","Preferences","Einstellungen")]}),e.jsx("div",{className:"h-px flex-1 bg-border/50"})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-5",children:[e.jsx(H,{control:M.control,name:"preferred_language",render:({field:o})=>e.jsxs(K,{children:[e.jsx(V,{className:"text-xs uppercase tracking-wider text-muted-foreground",children:i("Idioma","Language","Sprache")}),e.jsxs(qe,{onValueChange:o.onChange,value:o.value,children:[e.jsx(Y,{children:e.jsx(Ue,{className:"h-11 rounded-xl border-border/60",children:e.jsx(Ie,{})})}),e.jsxs(ze,{children:[e.jsx(U,{value:"es",children:"🇲🇽 Español"}),e.jsx(U,{value:"en",children:"🇦🇺 English"}),e.jsx(U,{value:"de",children:"🇩🇪 Deutsch"})]})]}),e.jsx(O,{})]})}),e.jsx(H,{control:M.control,name:"preferred_currency",render:({field:o})=>e.jsxs(K,{children:[e.jsx(V,{className:"text-xs uppercase tracking-wider text-muted-foreground",children:i("Moneda","Currency","Währung")}),e.jsxs(qe,{onValueChange:o.onChange,value:o.value,children:[e.jsx(Y,{children:e.jsx(Ue,{className:"h-11 rounded-xl border-border/60",children:e.jsx(Ie,{})})}),e.jsxs(ze,{children:[e.jsx(U,{value:"USD",children:"🇺🇸 USD"}),e.jsx(U,{value:"MXN",children:"🇲🇽 MXN"}),e.jsx(U,{value:"EUR",children:"🇪🇺 EUR"}),e.jsx(U,{value:"AUD",children:"🇦🇺 AUD"})]})]}),e.jsx(O,{})]})})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 pt-4",children:[e.jsxs(D,{type:"submit",variant:"gradient",disabled:t.isPending,className:"w-full sm:w-auto h-11 px-8 rounded-xl",children:[t.isPending&&e.jsx(Q,{className:"mr-2 h-4 w-4 animate-spin"}),i("Guardar cambios","Save changes","Änderungen speichern")]}),e.jsxs(D,{type:"button",variant:"ghost",className:"w-full sm:w-auto sm:hidden text-destructive/70",onClick:()=>{h(),a("/")},children:[e.jsx(Re,{className:"h-4 w-4 mr-2"}),i("Cerrar sesión","Log out","Abmelden")]})]})]})})})]})]},"profile"),k==="passport"&&e.jsx(w.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},transition:{duration:.2},children:e.jsx(ia,{})},"passport"),k==="trips"&&e.jsx(w.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},transition:{duration:.2},className:"space-y-4",children:g?[...Array(3)].map((o,y)=>e.jsx("div",{className:"bg-card rounded-xl border border-border p-4 md:p-6",children:e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsx(_,{className:"w-full md:w-36 h-28 rounded-lg"}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx(_,{className:"h-6 w-48"}),e.jsx(_,{className:"h-4 w-64"}),e.jsx(_,{className:"h-4 w-32"})]})]})},y)):x.length===0?e.jsxs("div",{className:"text-center py-16 bg-card rounded-2xl border border-border/50 shadow-soft",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-primary/10 flex items-center justify-center",children:e.jsx(Ks,{className:"h-7 w-7 text-primary"})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:i("No tienes viajes aún","No trips yet","Noch keine Reisen")}),e.jsx("p",{className:"text-muted-foreground mb-6 px-4 max-w-md mx-auto text-sm",children:i("Explora nuestros viajes y reserva tu próxima aventura","Explore our trips and book your next adventure","Entdecke unsere Reisen und buche dein nächstes Abenteuer")}),e.jsx(D,{variant:"gradient",asChild:!0,className:"rounded-xl h-11 px-6",children:e.jsxs(je,{to:"/trips",children:[i("Explorar viajes","Explore trips","Reisen entdecken"),e.jsx($e,{className:"h-4 w-4 ml-1"})]})})]}):x.map(o=>e.jsx(Gs,{booking:o},o.id))},"trips"),k==="wishlist"&&e.jsx(w.div,{initial:{opacity:0,y:12}
11,animate:{opacity:1,y:0},exit:{opacity:0,y:-12},transition:{duration:.2},children:b?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 md:gap-6",children:[...Array(3)].map((o,y)=>e.jsxs("div",{className:"bg-card rounded-xl border border-border overflow-hidden",children:[e.jsx(_,{className:"aspect-[4/3] w-full"}),e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsx(_,{className:"h-5 w-3/4"}),e.jsx(_,{className:"h-4 w-1/2"})]})]},y))}):v.length===0?e.jsxs("div",{className:"text-center py-16 bg-card rounded-2xl border border-border/50 shadow-soft",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-primary/10 flex items-center justify-center",children:e.jsx(es,{className:"h-7 w-7 text-primary"})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:i("Tu wishlist está vacía","Your wishlist is empty","Deine Wunschliste ist leer")}),e.jsx("p",{className:"text-muted-foreground mb-6 px-4 max-w-md mx-auto text-sm",children:i("Guarda tus viajes favoritos para reservarlos después","Save your favorite trips to book them later","Speichere deine Lieblingsreisen, um sie später zu buchen")}),e.jsx(D,{variant:"gradient",asChild:!0,className:"rounded-xl h-11 px-6",children:e.jsxs(je,{to:"/trips",children:[i("Explorar viajes","Explore trips","Reisen entdecken"),e.jsx($e,{className:"h-4 w-4 ml-1"})]})})]}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 md:gap-6",children:v.map((o,y)=>e.jsx(Cs,{trip:o,index:y},o.id))})},"wishlist"),k==="referral"&&e.jsx(w.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},transition:{duration:.2},children:e.jsx(Zs,{})},"referral")]})]})})]}),e.jsx(Fe,{})]})};export{nr 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.