PageSourceSearch

https://perqt.ai/assets/add.lazy-Dob1SIrB.js

js perqt.ai collected 2026-10-02 01:14:09 UTC 106,985 bytes, 4 lines download raw bytes

1import{f as ma,v as ze,w as Te,x as De,b as J,r as m,j as e,B as M,c as Xa,u as $e,a as Za,h as Me,e as ue,E as me,t as X,g as Ja,L as ta,i as F,A as fa,C as ce,s as G,I as Z,T as pa,k as Ne,l as ke,m as _e,n as oe}from"./index-BKuXz_lx.js";import{B as xa}from"./back-link-Cu1gDYAu.js";import{u as ie}from"./useQuery-Bz14us_N.js";import{u as ha}from"./useMutation-BF1Hdgha.js";import{C as Oe}from"./card-art-CPn1_v3v.js";import{f as Ue,u as Y,a as et}from"./format-xqYhVKQ8.js";import{F as ga}from"./fit-text-BNPR0xB6.js";import{C as Ee,c as Ie}from"./card-Cez4CVsR.js";import{B as at}from"./badge-Ctlu4O3Q.js";import{S as ba,a as va,b as ja,c as ya,d as Be}from"./select-wMiXnjQh.js";import{u as tt}from"./use-plan-Bfh_geKy.js";import{u as st}from"./use-is-admin-Bnpe837v.js";import{H as sa}from"./help-link-KE_L5oq9.js";import{I as Re}from"./inline-info-C34Z9MmS.js";import{s as rt,a as nt}from"./import-benefits-stream-C5ccAJX0.js";import{u as wa,i as it}from"./use-session-expired-BJrKf_KU.js";import{u as fe}from"./useServerFn-DruDSVLX.js";import{a as lt}from"./card-mask.functions-Bq-MNGhs.js";import{a as ot}from"./seed-earning-rates.functions-CwhjeLqD.js";import{E as ct}from"./earning-rates-list-BPZWelpH.js";import{P as dt}from"./plaid-link-button-CYO5ZuyC.js";import{D as ut,a as mt,b as ra,c as na,d as ia}from"./dialog-G5RKiVzh.js";import{s as ft}from"./send-By6xeTbc.js";import{c as Na}from"./current-rates-VMJhufFO.js";import{S as ka}from"./shield-check-D4DHkjPh.js";import{L as _a}from"./lock-B-70KJuR.js";import{S as Fe}from"./sparkles-bm4VxieG.js";import{A as pt}from"./arrow-left-CjswZ4jf.js";import{C as xt}from"./crown-umN3wGt1.js";import{S as He}from"./star-Dh3BBAj_.js";import{L as Ce}from"./loader-circle-CBLTRqHC.js";import{S as ht}from"./search-4Sv1hCIU.js";import{G as Ca}from"./gift-BhePpaff.js";import{R as gt}from"./refresh-cw-DBVO72O8.js";import{W as bt}from"./wand-sparkles-DssD89dh.js";import{P as vt}from"./plus-3PGhWy5v.js";import{C as Sa}from"./chevron-down-C-0pMlkS.js";import{I as jt}from"./info-ZGWILGHP.js";import"./circle-question-mark-IlT_yKgj.js";import"./popover-CFu30of3.js";import"./index-BTvNrtwn.js";import"./ai-cost.functions-CioM0F2e.js";import"./fuel-BAhe_lNz.js";import"./utensils-B2EBV6li.js";import"./shopping-cart-Bfa7CSnL.js";import"./plane-CHfanmuT.js";import"./hotel-BLTa106k.js";import"./shopping-bag-Wq8Ym6UF.js";import"./building-2-DDUOAwB-.js";import"./briefcase-D5hiSsT7.js";import"./wallet-CtwHADVG.js";import"./credit-card-B2uIOlHY.js";import"./clock-C8smJZOC.js";import"./plaid.functions-DFKWUb9g.js";import"./circle-check-ByACOMw5.js";import"./triangle-alert-BqWhhR-9.js";import"./perqt-logo-approved.png.asset-AWu4BTBK.js";import"./link-2-BrBmZL4v.js";import"./index-CJgWmXI4.js";import"./x-DVmJ5vLc.js";const yt=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]],wt=ma("calendar-check",yt);const Nt=[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]],kt=ma("radar",Nt),_t=[{triggers:["lounge","lounges","salon","salón","sala vip","salas vip","priority pass","centurion","sky club"],matches:["lounge","priority pass","centurion","sky club","loungebuddy","admirals club","plaza premium"],label:{en:"airport lounge access",es:"acceso a salas VIP"}},{triggers:["precheck","tsa","global entry","clear","airport security","seguridad aeropuerto"],matches:["global entry","tsa precheck","tsa pre","clear plus","clear "],label:{en:"Global Entry / TSA PreCheck / CLEAR credit",es:"crédito Global Entry / TSA PreCheck / CLEAR"}},{triggers:["hotel","hoteles","resort","free night","noche gratis"],matches:["hotel","resort","free night","fine hotels","the hotel collection","prepaid hotels"],label:{en:"hotel benefits",es:"benef
1icios de hotel"}},{triggers:["travel credit","flight credit","credito de viaje","crédito de viaje","airline fee","incidental"],matches:["travel credit","flight credit","airline fee","airline incidental","travel statement credit"],label:{en:"travel / airline credit",es:"crédito de viaje o aéreo"}},{triggers:["streaming","netflix","disney","hulu","espn","spotify","apple tv"],matches:["streaming","netflix","disney","hulu","espn","spotify","apple tv","apple music"],label:{en:"streaming credits",es:"créditos de streaming"}},{triggers:["uber","lyft","rideshare","transit","transporte","viajes compartidos"],matches:["uber","lyft","rideshare","transit","taxi"],label:{en:"rideshare & transit",es:"viajes compartidos y transporte"}},{triggers:["dining","restaurant","restaurants","restaurante","restaurantes","comida"],matches:["dining","restaurant","resy","food deliver","grubhub","doordash"],label:{en:"dining rewards & credits",es:"recompensas y créditos en restaurantes"}},{triggers:["grocery","groceries","supermarket","supermercado","comestibles"],matches:["grocer","supermarket","whole foods"],label:{en:"grocery rewards",es:"recompensas en supermercados"}},{triggers:["gas","fuel","gasolina","combustible","ev charging"],matches:["gas ","gas station","fuel","ev charg"],label:{en:"gas & fuel rewards",es:"recompensas en gasolina"}},{triggers:["cash back","cashback","efectivo","reembolso"],matches:["cash back","cashback","statement credit"],label:{en:"cash back",es:"reembolso en efectivo"}},{triggers:["cell phone","phone protection","celular","telefono","teléfono"],matches:["cell phone","cellular telephone","phone protection"],label:{en:"cell phone protection",es:"protección de teléfono"}},{triggers:["companion","acompañante","companion pass","companion certificate"],matches:["companion"],label:{en:"companion benefit",es:"beneficio de acompañante"}},{triggers:["checked bag","free bag","maleta","equipaje"],matches:["checked bag","baggage","free bag"],label:{en:"checked bag benefit",es:"beneficio de equipaje"}},{triggers:["status","elite","estatus"],matches:["status","elite","mosaic","gold status","platinum status"],label:{en:"elite status",es:"estatus élite"}},{triggers:["no annual fee","sin cuota","sin anualidad"],matches:["no annual fee"],label:{en:"no annual fee",es:"sin cuota anual"}},{triggers:["welcome","sign up bonus","signup bonus","bono","bienvenida"],matches:["welcome","bonus","after you spend"],label:{en:"welcome bonus",es:"bono de bienvenida"}},{triggers:["insurance","protection","seguro","proteccion","protección","trip delay"],matches:["insurance","protection","trip delay","trip cancel","purchase protection"],label:{en:"insurance & protections",es:"seguros y protecciones"}},{triggers:["office","advertising","shipping","negocio","empresarial","business software"],matches:["office supply","advertising","shipping","business software","cloud"],label:{en:"business categories",es:"categorías empresariales"}}];function Ct(a,n){const x=new Map;for(const t of a)x.set(t.id,{identity:`${t.issuer} ${t.name} ${t.network}`.toLowerCase(),benefits:[t.rewards_summary??"",t.description??"",n.get(t.id)??""].join(" ").toLowerCase()});return x}function la(a){return a.toLowerCase().split(/\s+/).map(n=>n.trim()).filter(Boolean)}function St(a){const n=a.toLowerCase();return _t.filter(x=>x.triggers.some(t=>n.includes(t)))}function At(a,n){if(la(a).length===0)return{match:!0,reasons:[]};if(!n)return{match:!1,reasons:[]};const t=St(a),c=[];let d=a.toLowerCase();for(const r of t)for(const u of r.triggers)!u.includes(" ")||!d.includes(u)||!(n.benefits.includes(u)||r.matches.some(h=>n.benefits.includes(h)))||(d=d.split(u).join(" "),c.push(r.label));for(const r of la(d)){if(n.identity.includes(r))continue;if(n.benefits.includes(r)){const b=t.find(h=>h.triggers.some(y=>y.includes(r)||r.includes(y)));b&&c.push(b.label);continue}const u=t.find(b=>b.triggers.some(h=>h.includes(r)||r.includes(h))&&b.matches.some(h=>n.benefits.includes(h)));if(u){c.push(u.label);continue}return{match:!1,reasons:[]}}const C=new Set;return{match:!0,reasons:c.filter(r=>C.has(r.en)?!1:(C.add(r.en),!0))}}const qt=["lounge","Global Entry","groceries","streaming"],Aa=[{key:"all",label:{en:"All",es:"Todas"},query:""},{key:"travel",label:{en:"Travel",es:"Viajes"},query:"travel"},{key:"premium",label:{en:"Premium",es:"Premium"},query:"lounge"},{key:"airline",label:{en:"Airline",es:"Aerolínea"},query:"airline"},{key:"hotel",label:{en:"Hotel",es:"Hotel"},query:"hotel"},{key:"welcome",label:{en:"Welcome Offer",es:"Oferta de bienvenida"},query:"welcome"}];function Pt(a,n){return[a,n].filter(x=>x.trim().length>0).join(" ").trim()}const oa=[{en:"lounge",es:"salas VIP"},{en:"Global Entry",es:"Global Entry"},{en:"groceries",es:"supermercados"},{en:"Amex Platinum",es:"Amex Platinum"},{en:"hotel credit",es:"crédito de hotel"}],Et=ze({method:"POST"}).middleware([Te]).handler(De("be94c35cd185a865973fda20e20d9241d3096ee119a9dc76677aad1b972fee17"));function It({open:a,candidates:n,submitting:x,onCancel:t,onConfirm:c}){const{t:d}=J(),[C,_]=m.useState(1),[r,u]=m.useState(null),[b,h]=m.useState(!1),y=m.useRef(null),q=n.filter(i=>i.likely),I=n.filter(i=>!i.likely),f=b||q.length===0?n:q,l=n.find(i=>i.id===r)??null;return e.jsx(ut,{open:a,onOpenChange:i=>{!i&&!x&&t()},children:e.jsx(mt,{ref:y,tabIndex:-1,onOpenAutoFocus:i=>{i.preventDefault(),y.current?.focus()},className:"max-w-lg bg-metallic border-metallic focus:outline-none",children:C===1?e.jsxs(e.Fragment,{children:[e.jsxs(ra,{children:[e.jsx(na,{className:"font-display text-xl",children:d("Is this card replacing one already in your wallet?","¿Esta tarjeta reemplaza a una que ya está en tu cartera?")}),e.jsx(ia,{children:d("Select the previous card so Perqt can keep your history connected.","Selecciona la tarjeta anterior para que Perqt mantenga tu historial conectado.")})]}),e.jsxs("div",{className:"space-y-2",children:[f.map(i=>e.jsxs("button",{type:"button",onClick:()=>{u(i.id),_(2)},className:"w-full text-left rounded-xl border border-metallic/70 bg-background/40 px-4 py-3 hover:border-gold/60 transition-colors",children:[e.jsx("span",{className:"block text-sm font-medium",children:i.label}),e.jsx("span",{className:"block text-xs text-titanium",children:i.last4?`•••• ${i.last4}`:d("No last four on file","Sin últimos cuatro")})]},i.id)),!b&&I.length>0&&e.jsx("button",{type:"button",onClick:()=>h(!0),className:"w-full text-left rounded-xl border border-dashed border-metallic/70 px-4 py-3 text-sm text-titanium hover:text-foreground",children:d("Another card","Otra tarjeta")}),e.jsx(M,{variant:"outline",className:"w-full",disabled:x,onClick:()=>c(null),children:d("No, this is an additional card","No, es una tarjeta adicional")})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(ra,{children:[e.jsx(na,{className:"font-display text-xl",children:d("We'll keep your card history connected.","Mantendremos tu historial de tarjetas conectado.")}),e.jsx(ia,{children:d("Your benefit usage, eligible spending, rewards value, welcome-offer progress, and renewal history will carry forward. Your previous card will be removed from your active wallet.","Tu uso de beneficios, gasto elegible, valor de recompensas, progreso de la oferta de bienvenida y el historial de renovación se mantendrán. Tu tarjeta anterior saldrá de tu cartera activa.")})]}),l&&e.jsxs("p",{className:"text-sm text-titanium",children:[d("Replacing","Reemplaza a"),":"," ",e.jsx("span",{className:"text-foreground font-medium",children:l.label}),l.last4?` •••• ${l.last4}`:""]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(M,{variant:"outline",disabled:x,onClick:()=>_(1),children:d("Back","Atrás")}),e.jsx(M,{className:"flex-1",disabled:x||!r,onClick:()=>c(r),children:x?d("Working…","Procesando…"):d("Continue","Continuar")})]})]})})})}const Bt=ze({method:"POST"}).middleware([Te]).handler(De("ad9fcf8ab748f744ab34080a829192ea339f157c62d3b43aec9d13b887e4403e")),Rt=ze({method:"POST"}).middleware([Te]).handler(De("41c9cf15aa0fd89ab1fea17050a9b779bf2dc447585d9d3fe0e62a72d9512042")),Ft="/__l5e/assets-v1/af8a3ced-823e-4ea7-a02a-d04296c5d174/issuer-amex.png",Lt={url:Ft},zt="/assets/issuer-chase-CYGwNGuA.webp",qa="/assets/issuer-capital-one-CLc3-m3b.webp",Pa="/assets/issuer-citi-DqikZOZ_.webp",Ea="/assets/issuer-bofa-DohsdvdY.webp",Ia="/assets/issuer-barclays-ZYPPGlrB.webp",Ba="/assets/issuer-hsbc-BSxHFY_5.webp",Ra="/assets/issuer-robinhood-BHg4ZevL.webp",Fa="/assets/issuer-usbank-C_ICEo8y.webp",La="/assets/issuer-wellsfargo-DNrsVHQE.webp",za="data:image/webp;base64,UklGRnIEAABXRUJQVlA4IGYEAACwIwCdASoAAQABPlEok0ajoqIhIXXYWHAKCWlu/HxaroXcPqfHHY+SfZLKTvh/yA9b/7H4g7VX93/IzLevmf+X7o70M05GOj0GPmD005s4Pnwkbxw+EK7zmR/J2p9aSZ98rbfLguW6xTbYCAHBefgXx1Hbv7h1JIRmBuHSncOX5azlL7v8g6/JC8qLPya2/Cv0yTSAvwrmprS7ehtYfikh5oNd/BUNvcAiUT3u9jYUNN4oB
1BvMcBVlCDsa42U0weIrhKYsMAW2krWTpU26BpACLaz9AMEolUqWjzAioURPGzX9JvJQ7YxGA4Pzn20/CZGsxF5MITR0i35sokm/KYlDLTSkkFaTEqgnBebv3hG33EBSQiGmpt1kJrmyq6HxIUx7L6x5ssAA/vsZ5SloxUpAcx/Q001gbk9ThdQC1ZjnP6cRXrEWEOqlDmC4wCeVerJlVIp9jEudMjMdndZiRiGkAeOJksPJLhxoQm9bRPcjdudfWHgtLbOA8DMh7ldPYq4WobzdLMG1KV5YTa4xg7UJ1Kzky5dPqWna7Dz99D40XtaNh4bvxX2wdPz2BabR5jC2szTq08NCLZsPA6/0koxIigE5KXHEe8GOWdWP8EMZ6oPc7j4I+bFzwfciBJ9Z743yqIzj6GHlWzy/D4RDzyJVQkaZzOtqbU6peiR26Sbqtfvi64p7zX9h+x567HY+QWsdzL1LcgSaJ8G+pF+BS5sB+yeIbYKpXrb7G6sOgKQ3OLqe8739Ze90RFGfAONbGdK+NliFjg50JMJ14OUxx66LdGPb2FflvP/taVu8VQ9uecf56+nqBz0l3ipPwWN9nex5vtUCx//Z3CG9Oj4v7653Q1Gmk24TbAr+ZCxDkxvracgKRXcKj4x5nLIx0siVZ1JfNH/9B78wHrHpHXlLjGrMQmb7/JG7+2ETtrwEuEmCbzpSBtGxRrkvgBAhG5Q5V8rgDGZpw83Kog1JV+fySQ9+9eLwX9Q5AYbTv94Cc8ag+GDYrCz1Um0T0EZ9X6+YWf+844sLFy0aVr73ZGkwXjOpLXhSMj8b7AkJzb1JEo3EGeYqmbe8hzv5v3+sCUm1XLySxzyIx38c9CQQu/YvmFuZ3PvDJwUgT2MQUZeNa+EEGgqtmtPtAvvq1/vVZbvRHz4Jhln2Rn715Mt/67M0VAlYN6+xXY1Z50CG5DAzk1mYxrM/magod9Hg5bGDGv62ZmZ4bJ6xpW/YKYSU1jp5RySx6TzTeYX7n2ofAzJQImvvjx66DAMPL0p8Zel7GUejI76dmRX+6cIKae+DsPlvpoMm/vYHkVZSjtfWi5u1OmOhR32bOk8ty1rAumDnziAo/UTrIaj7XV6FlMDYEcgsH8oZLQaNPsdDktAz7zxb6nXFn/NbwaJ52fztAibf9Rc1qduXl/S8/aUp/d+AsLNHm9xw2yQ8ILTv5EcwsctvVpc+Q9CTsjRI45SWBplDwzj1V4Qiac+1X07C5zIfBmjAhYsD8IHdgAAA",Tt="/__l5e/assets-v1/a9b0ac86-3075-4c96-b1d8-979a9913e448/issuer-luxury-card.png",Dt={url:Tt},$t="/__l5e/assets-v1/a1114620-ccc7-419b-a44e-9f11f9070b3c/issuer-coinbase.png",Mt={url:$t},Ot="/__l5e/assets-v1/31f173b9-8540-43ba-a61f-6741e7ff4265/issuer-gemini.png",Ut={url:Ot},Ht=Ja("/_authenticated/cards/add"),Ta=Lt.url,Gt=Dt.url,Da=Mt.url,$a=Ut.url,Yt={queryKey:["catalog"],queryFn:async()=>{const{data:a,error:n}=await G.from("card_catalog").select("*").eq("is_recommendable",!0).order("annual_fee",{ascending:!1});if(n)throw n;return a??[]},staleTime:300*1e3},mr=Xa("/_authenticated/cards/add")({component:Vt}),Qt={queryKey:["catalog-rate-search-text"],queryFn:async()=>{const{data:a,error:n}=await Na(G.from("card_earning_rates").select("card_catalog_id, category, reward_program, portal, notes, condition"));if(n)throw n;const x=new Map;for(const t of a??[]){const c=x.get(t.card_catalog_id)??"";x.set(t.card_catalog_id,`${c} ${t.category??""} ${t.reward_program??""} ${t.portal??""} ${t.notes??""} ${t.condition??""}`)}return x},staleTime:300*1e3},ca=["Select","Benefits","Link"],Wt=/\b(business|ink|spark)\b/i;function we(a){return a.card_type==="business"?!0:a.card_type==="personal"?!1:Wt.test(a.name)}function Kt(a,n){const x=Date.now()-new Date(a).getTime(),t=Math.max(1,Math.floor(x/1e3));if(t<60)return n("just now","ahora");const c=Math.floor(t/60);if(c<60)return`${c}${n("m ago","m")}`;const d=Math.floor(c/60);return d<24?`${d}${n("h ago","h")}`:`${Math.floor(d/24)}${n("d ago","d")}`}function Vt(){const{user:a}=$e(),{t:n}=J(),x=Za(),t=wa(),c=Me(),{data:d,isLoading:C}=tt(),{catalog:_,type:r}=Ht.useSearch(),[u,b]=m.useState(0),[h,y]=m.useState(""),[q,I]=m.useState("all"),[f,l]=m.useState(null),[i,N]=m.useState([]),[S,P]=m.useState(!1),[ee,E]=m.useState(!1),[te,p]=m.useState(""),[T,se]=m.useState(""),[R,$]=m.useState(""),[g,B]=m.useState(""),[A,j]=m.useState(""),[w,re]=m.useState(""),[ne,be]=m.useState(!1),[Q,ve]=m.useState(null),[W,pe]=m.useState(null),[je,ye]=m.useState(null),xe=m.useRef(crypto.randomUUID()),[Se,s]=m.useState(!1),[o,U]=m.useState(null),[K,Ae]=m.useState(!1),D=fe(Bt),ae=fe(Rt),{data:he}=ie({queryKey:["lineage-replacement-candidates",f?.id],enabled:u===2&&!!f,queryFn:()=>D({data:{catalogId:f.id}}),staleTime:6e4}),qe=he?.enabled?he.candidates:[];m.useEffect(()=>{ue(me.CardAddStarted)},[]),m.useEffect(()=>{typeof window>"u"||window.scrollTo({top:0,behavior:"smooth"})},[u]);function Ge(){if(je){ye(null);return}if(typeof window<"u"&&window.history.length>1){window.history.back();return}x({to:"/cards"})}const{data:le=[]}=ie(Yt),{data:Ye}=ie(Qt),Qe=m.useMemo(()=>Ct(le,Ye??new Map),[le,Ye]),Ua=Aa.find(v=>v.key===q)?.query??"",We=Pt(Ua,h),{filtered:Ha,matchHints:Ga}=m.useMemo(()=>{const v=new Map;return{filtered:le.filter(L=>{const O=At(We,Qe.get(L.id));return O.match&&O.reasons.length&&v.set(L.id,O.reasons),O.match}),matchHints:v}},[le,We,Qe]);m.useEffect(()=>{if(!_||f||le.length===0)return;const v=le.find(k=>k.id===_);v&&(l(v),b(1))},[_,le,f]),m.useEffect(()=>{u!==1||!f||(N([]),Xe())},[u,f?.id]);const Ya=fe(ot),Qa=fe(lt),Wa=fe(nt),Ka=fe(Et);async function Ke(v,k=!1){try{const L=await Ka({data:{catalogIds:[v]}});if(!L.ok)throw new Error(L.error);return c.invalidateQueries({queryKey:["welcome-offer",v]}),!0}catch{return k?!1:(await new Promise(O=>setTimeout(O,1500)),Ke(v,!0))}}async function Ve(v){E(!0);const k=await Ke(v);E(!1),k||X.error(n("Couldn't refresh welcome offer","No se pudo actualizar la oferta de bienvenida"),{description:n("The offer shown may be outdated. You can retry from the welcome offer panel.","La oferta mostrada puede estar desactualizada. Puedes reintentar desde el panel.")})}
1async function Xe(){if(!f)return;P(!0),N([]),Ya({data:{card_catalog_id:f.id}}).catch(()=>{}),Ve(f.id);let v=0;try{await rt({issuer:f.issuer,name:f.name,annual_fee:f.annual_fee},{onBenefit:k=>{const L=V=>V.toLowerCase().replace(/[^a-z0-9]+/g,""),O=L(k.name??"");O&&N(V=>V.some(H=>L(H.name)===O)?V:(v++,[...V,{name:k.name,description:k.description??"",dollar_value:Number(k.dollar_value)||0,frequency:k.frequency,category:k.category??"other",partner:k.partner??"",redemption:k.redemption??"",spend_threshold:k.spend_threshold??null,period_unit:k.period_unit??null,period_amount:k.period_amount??null,source_url:k.source_url??null,source_snippet:k.source_snippet??null,source_confidence:k.source_confidence??null,selected:!0}]))},onDone:k=>{ue(me.AiBenefitsImported,{card_catalog_id:f.id,issuer:f.issuer,name:f.name,count:k}),X.success(`Imported ${k} benefits`)},onError:k=>{if(it(k)){t();return}X.error(k)}})}finally{P(!1)}}const de=ha({mutationFn:async()=>{if(!f||!a)throw new Error("Missing card");const v=i.filter(H=>H.selected&&!H.id);if(v.length>0){const H=v.map(z=>({card_catalog_id:f.id,name:z.name,description:z.description||null,dollar_value:z.dollar_value,frequency:z.frequency==="semi_annual"?"annual":z.frequency,category:z.category,partner:z.partner||null,redemption:z.redemption||null,spend_threshold:z.spend_threshold??null,period_unit:z.period_unit??(z.frequency==="semi_annual"?"semi_annual":null),period_amount:z.period_amount??(z.frequency==="semi_annual"?z.dollar_value:null),source_url:z.source_url??null,source_snippet:z.source_snippet??null,source_confidence:z.source_confidence??null})).filter(z=>z.name&&z.name.trim().length>0);H.length>0&&await Wa({data:{rows:H}})}if(!W||!Q?.plaid_item_id)throw new Error("Link this card via Plaid to finish adding it — Perqt needs a live transaction feed to track credits and recommend cards.");const k=W,L=xe.current;let{data:O,error:V}=await G.from("user_cards").insert({id:L,user_id:a.id,card_catalog_id:f.id,last4:te||null,nickname:T||null,holder_name:R||null,exp_month:g?Number(g):null,exp_year:A?Number(A):null,opened_at:ge||new Date().toISOString().slice(0,10),plaid_account_id:k,plaid_item_id:Q?.plaid_item_id??null}).select("id").single();if(V&&V.code==="23505"){const H=await G.from("user_cards").select("id").eq("id",L).eq("user_id",a.id).maybeSingle();H.data&&(O=H.data,V=null)}if(V)throw V;if(!O)throw new Error("Could not create the card row");if(o&&O){const H=await ae({data:{successorId:O.id,predecessorId:o,effectiveAt:ge?new Date(ge).toISOString():null,flow:Q?"plaid_link":"manual",dateFromUser:!!ge&&!ne&&!Va}});if(!H.ok&&H.reason!=="not_enabled")throw new Error(`Could not connect your previous card (${H.reason}). The new card was added.`)}if(Q?.plaid_item_id)try{await Qa({data:{plaidItemId:Q.plaid_item_id}})}catch{}return G.functions.invoke("auto-sync",{body:{force:!0}}),O},onSuccess:async v=>{if(c.invalidateQueries({queryKey:["my-cards"]}),c.invalidateQueries({queryKey:["dashboard-cards"]}),c.invalidateQueries({queryKey:["dashboard-targeted-offers-ytd"]}),c.invalidateQueries({queryKey:["dashboard-wallet-points"]}),c.invalidateQueries({queryKey:["card-points-earnings"]}),c.invalidateQueries({queryKey:["card-spend-ytd"]}),c.invalidateQueries({queryKey:["card-spend-history"]}),c.invalidateQueries({queryKey:["connected-cards"]}),c.invalidateQueries({queryKey:["card-sync-state"]}),c.invalidateQueries({queryKey:["plan"]}),ue(me.CardLinked,{user_card_id:v.id,card_catalog_id:f?.id,issuer:f?.issuer,name:f?.name,annual_fee:f?.annual_fee,benefit_count:i.filter(L=>L.selected).length,estimated_annual_value:i.filter(L=>L.selected).reduce((L,O)=>L+O.dollar_value,0)}),a?.email&&f)try{await ft({templateName:"card-added",recipientEmail:a.email,idempotencyKey:`card-added:${v.id}`,templateData:{name:a.user_metadata?.full_name||a.email?.split("@")[0],cardTitle:Ue(f.issuer,f.name),last4:te||null,walletType:f.card_type??"personal"}})}catch(L){console.warn("card-added email enqueue failed",L)}X.success(n("Card added to your wallet","Tarjeta añadida a tu cartera"));let k=!1;if(a){const{data:L}=await G.from("profiles").select("onboarding_completed_at").eq("id",a.id).maybeSingle();k=!L?.onboarding_completed_at}x(k?{to:"/onboarding"}:{to:"/dashboard",search:{highlight:v.id}})},onError:v=>{const k=v?.message??"";k.toLowerCase().includes("card limit")?(X.error(n("You've hit your plan's card limit. Upgrade to add more.","Alcanzaste el límite de tarjetas de tu plan. Mejora para añadir más.")),x({to:"/billing"})):X.error(k||n("Could not add card","No se pudo añadir la tarjeta"))}}),Ze=i.filter(v=>v.selected).reduce((v,k)=>v+k.dollar_value,0),ge=ne?new Date().toISOString().slice(0,10):w,Je=Q?.accounts.find(v=>v.plaid_account_id===W)?.opened_at??null,Va=!!Je&&w===Je;function ea(){if(!de.isPending){if(!K&&qe.length>0){s(!0);return}de.mutate()}}const aa=u===0?!!f:u===1?i.some(v=>v.selected):!!ge&&!!W&&!!Q?.plaid_item_id;return!C&&d?.atLimit?e.jsx(ns,{tier:d.tier,used:d.used,limit:d.limit??0,onBack:()=>x({to:"/cards"})}):e.jsxs("div",{"data-no-ptr":!0,className:"max-w-5xl mx-auto px-6 py-10",children:[e.jsx("p",{className:"text-xs uppercase tracking-[0.2em] text-titanium",children:n("Add a card","Añadir tarjeta")}),e.jsx("h1",{className:"font-display text-3xl sm:text-4xl mt-1 leading-tight",children:n("Onboard a new card","Registra una nueva tarjeta")}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-4 gap-y-1",children:[e.jsx(sa,{faq:"link-card",children:n("How does linking work?","¿Cómo funciona la vinculación?")}),e.jsx(sa,{faq:"data-pulled",children:n("What data does Perqt pull?","¿Qué datos recoge Perqt?")})]}),e.jsx(Xt,{step:u}),u===0&&e.jsx("div",{className:"mb-2",children:e.jsx(xa,{onClick:Ge,children:n("Go Back","Volver")})}),u>0&&e.jsx(da,{step:u,canAdvance:aa,plaidReady:!!Q?.plaid_item_id&&!!W,finalizing:de.isPending,onBack:()=>b(u-1),onContinue:()=>b(u+1),onFinalize:ea,className:"mb-6"}),u===0&&e.jsx(es,{search:h,setSearch:y,category:q,setCategory:I,filtered:Ha,matchHints:Ga,selected:f,setSelected:l,issuer:je,setIssuer:ye,initialSegment:r??"personal",onAdvance:v=>{l(v),b(1)}}),u===1&&f&&e.jsx(ts,{card:f,benefits:i,setBenefits:N,aiLoading:S,onReimport:Xe,totalValue:Ze,welcomeRefreshing:ee,onRetryWelcome:()=>Ve(f.id)}),u===2&&f&&e.jsx(rs,{card:f,nickname:T,setNickname:se,last4:te,setLast4:p,holder
1Name:R,setHolderName:$,expMonth:g,setExpMonth:B,expYear:A,setExpYear:j,openedAt:w,setOpenedAt:re,openedUnknown:ne,setOpenedUnknown:be,totalValue:Ze,benefitCount:i.filter(v=>v.selected).length,plaidLink:Q,plaidAccountId:W,onPlaidLinked:v=>{ue(me.OnboardingPlaidSucceeded,{institution:v.institution_name,account_count:v.accounts.length}),ve(v),pe(v.accounts.length===1?v.accounts[0].plaid_account_id:null)},onPlaidAccount:pe,onPlaidReset:()=>{ve(null),pe(null)},onPlaidStart:()=>ue(me.OnboardingPlaidStarted),onPlaidExit:()=>ue(me.OnboardingPlaidDismissed)}),e.jsx(da,{step:u,canAdvance:aa,plaidReady:!!Q?.plaid_item_id&&!!W,finalizing:de.isPending,onBack:()=>u===0?Ge():b(u-1),onContinue:()=>b(u+1),onFinalize:ea,className:"mt-10"}),qe.length>0&&e.jsx(It,{open:Se,candidates:qe,submitting:de.isPending,onCancel:()=>s(!1),onConfirm:v=>{U(v),Ae(!0),s(!1),de.mutate()}})]})}function da({step:a,canAdvance:n,plaidReady:x,finalizing:t,onBack:c,onContinue:d,onFinalize:C,className:_}){const{t:r}=J();return e.jsxs("div",{className:F("flex items-center justify-between",_),children:[e.jsx(xa,{onClick:c,children:a===0?r("Go Back","Volver"):r("Back","Atrás")}),a<2?e.jsxs(M,{disabled:!n,onClick:d,variant:"gold",children:[r("Continue","Continuar")," ",e.jsx(fa,{className:"size-4"})]}):x?e.jsx(M,{disabled:t||!n,onDoubleClick:C,variant:"gold",title:r("Double-click to confirm and finish adding this card","Haz doble clic para confirmar y terminar de añadir esta tarjeta"),children:t?e.jsxs(e.Fragment,{children:[e.jsx(Ce,{className:"size-4 animate-spin"})," ",r("Linking…","Vinculando…")]}):e.jsxs(e.Fragment,{children:[r("Double-click to confirm","Doble clic para confirmar")," ",e.jsx(ce,{className:"size-4"})]})}):e.jsx(M,{disabled:!0,variant:"gold",title:r("Press “Link Card” below and finish the Plaid connection first","Pulsa “Vincular tarjeta” abajo y completa la conexión Plaid primero"),children:r("Link Card below to continue","Vincula la tarjeta abajo para continuar")})]})}function Xt({step:a}){const{t:n}=J(),x=[n("Select","Selecciona"),n("Benefits","Beneficios"),n("Link","Vincula")];return e.jsx("ol",{className:"flex items-center gap-2 sm:gap-3 mt-6 mb-8",children:ca.map((t,c)=>e.jsxs("li",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsxs("div",{className:F("flex items-center justify-center gap-1.5 sm:gap-2 px-2.5 sm:px-3 py-1.5 rounded-full border text-[13px] sm:text-sm font-bold transition-colors min-w-[92px] sm:min-w-[108px]",c<a&&"border-gold/70 bg-gold/15 text-gold",c===a&&"border-gold bg-gold/25 text-gold shadow-[0_0_0_1px_rgba(212,175,55,0.35)]",c>a&&"border-gold/40 bg-transparent text-gold/70"),children:[e.jsx("span",{className:F("size-4 sm:size-5 rounded-full border flex items-center justify-center text-[10px] sm:text-xs font-bold",c<=a?"border-gold bg-gold/20 text-gold":"border-gold/50 text-gold/70"),children:c<a?e.jsx(ce,{className:"size-3"}):c+1}),x[c]]}),c<ca.length-1&&e.jsx("div",{className:"h-px w-5 sm:w-8 bg-gradient-to-r from-gold/60 to-transparent"})]},c))})}const Ma={"American Express":{gradient:"from-[#2e77bb] via-[#1d8ece] to-[#6cc4ee]",accent:"#9bd4f5",mono:"AMEX",initials:"AX",domain:"americanexpress.com",logoSlug:"amer
1icanexpress"},Chase:{gradient:"from-[#06182d] via-[#0f3d6e] to-[#1f78c1]",accent:"#3aa0e6",mono:"CHASE",initials:"CH",domain:"chase.com",logoSlug:"chase"},Citi:{gradient:"from-[#D9261C] via-[#D9261C] to-[#003B70]",accent:"#D9261C",mono:"CITIBANK",initials:"Ci",displayName:"citi",domain:"citi.com",logoSlug:"citibank",arc:!0},"Bank of America":{gradient:"from-[#001a4d] via-[#0a3170] to-[#e31837]",accent:"#e31837",mono:"BofA",initials:"BA",domain:"bankofamerica.com",logoSlug:"bankofamerica"},"Capital One":{gradient:"from-[#004879] via-[#004879] to-[#D22E1E]",accent:"#D22E1E",mono:"CAP1",initials:"C1",domain:"capitalone.com",logoSlug:"capitalone"},"Wells Fargo":{gradient:"from-[#B7132C] via-[#B7132C] to-[#B89558]",accent:"#B89558",mono:"WF",initials:"WF",domain:"wellsfargo.com",logoSlug:"wellsfargo"},Discover:{gradient:"from-[#c64600] via-[#ff6000] to-[#ffb672]",accent:"#ff8a3d",mono:"DISC",initials:"DS",domain:"discover.com",logoSlug:"discover"},"U.S. Bank":{gradient:"from-[#D8273F] via-[#FFFFFF] to-[#00438F]",accent:"#D8273F",mono:"U.S.BANK",initials:"US",displayName:"U.S. Bank",domain:"usbank.com",logoSlug:"usbank"},"US Bank":{gradient:"from-[#D8273F] via-[#FFFFFF] to-[#00438F]",accent:"#D8273F",mono:"U.S.BANK",initials:"US",displayName:"U.S. Bank",domain:"usbank.com",logoSlug:"usbank"},Barclays:{gradient:"from-[#00AFE9] via-[#00AFE9] to-[#00AFE9]",accent:"#00aeef",mono:"BARCL",initials:"B",domain:"barclays.com",logoSlug:"barclays"},HSBC:{gradient:"from-[#EF241C] via-[#EF241C] to-[#EF241C]",accent:"#ff5158",mono:"HSBC",initials:"H",domain:"hsbc.com"},Robinhood:{gradient:"from-white via-white to-white",accent:"#ffffff",mono:"RH",initials:"RH",domain:"robinhood.com",logoSlug:"robinhood"},Synchrony:{gradient:"from-[#0d2b4f] via-[#0072ce] to-[#7ed3ff]",accent:"#0072ce",mono:"SYF",initials:"SY",domain:"synchrony.com"},Bilt:{gradient:"from-[#0a0a0a] via-[#1a1a1a] to-[#3a3a3a]",accent:"#c9a86a",mono:"BILT",initials:"B",domain:"biltrewards.com"},"Bread Financial":{gradient:"from-[#3a1a0a] via-[#7a3a1a] to-[#d97942]",accent:"#d97942",mono:"BREAD",initials:"BF",domain:"breadfinancial.com"},Fidelity:{gradient:"from-[#0a3d2a] via-[#147a4a] to-[#3fb27f]",accent:"#3fb27f",mono:"FIDELITY",initials:"F",domain:"fidelity.com"},Petal:{gradient:"from-[#1a0a3d] via-[#5a2a9b] to-[#b07cff]",accent:"#b07cff",mono:"PETAL",initials:"P",domain:"petalcard.com"},PNC:{gradient:"from-[#3d1a00] via-[#a8470a] to-[#f58025]",accent:"#f58025",mono:"PNC",initials:"P",domain:"pnc.com"},"TD Bank":{gradient:"from-[#0a3d1a] via-[#1a6e2e] to-[#2e8b2e]",accent:"#43b049",mono:"TD",initials:"TD",domain:"td.com"},Truist:{gradient:"from-[#3d0a1a] via-[#7a1a3a] to-[#c8246a]",accent:"#5e2c8a",mono:"TRUIST",initials:"T",domain:"truist.com"},X1:{gradient:"from-[#0a0a0a] via-[#1a1a1a] to-[#4a4a4a]",accent:"#e0e0e0",mono:"X1",initials:"X1",domain:"x1creditcard.com"},"Luxury Card":{gradient:"from-[#0a0a0a] via-[#1a1a1a] to-[#2a2a2a]",accent:"#c9a86a",mono:"LUXURY",initials:"LC",displayName:"Luxury Card",domain:"luxurycard.com"},Coinbase:{gradient:"from-[#0a1a4a] via-[#0052ff] to-[#3b82f6]",accent:"#0052ff",mono:"COINBASE",initials:"CB",displayName:"Coinbase",domain:"coinbase.com"},Gemini:{gradient:"from-black via-black to-black",accent:"#00dcfa",mono:"GEMINI",initials:"G",displayName:"Gemini",domain:"gemini.com"}};function Le(a){return Ma[a]??{gradient:"from-zinc-800 via-zinc-600 to-zinc-400",accent:"#a1a1aa",mono:a.toUpperCase().slice(0,5),initials:a.split(/\s+/).map(n=>n[0]).filter(Boolean).slice(0,2).join("")}}function Oa({issuer:a,style:n,tone:x="onGradient"}){const t=a.toLowerCase(),c=n.displayName??a,d=x==="onLight",C=d?"#15202b":"#ffffff",_=d?"rgba(21,32,43,0.72)":"rgba(255,255,255,0.88)",r=d?"none":"0 3px 12px rgba(0,0,0,0.45)",u={color:C,textShadow:r};return t.includes("american express")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("img",{src:Ta,alt:"American Express",className:"w-full h-full object-contain bg-white p-3 rounded-2xl",draggable:!1})}):t.includes("chase")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("img",{src:zt,alt:"Chase",className:"w-full h-full object-contain bg-white p-2 rounded-2xl",draggable:!1})}):t.includes("citi")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("img",{src:Pa,alt:"citi",className:"w-full h-full object-contain bg-white p-8 rounded-2xl",draggable:!1})}):t.includes("capital one")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("img",{src:qa,alt:"Capital One",className:"w-full h-full object-contain bg-white p-2 rounded-2xl",draggable:!1})}):t.includes("bank of america")?e.jsx("div",{className:"w-full h-full flex items-center justify-center p-[4%]",children:e.jsx("img",{src:Ea,alt:"Bank of America",className:"max-w-full max-h-full object-contain",draggable:!1})}):t.includes("barclays")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("img",{src:Ia,alt:"Barclays",className:"w-full h-full object-contain bg-white p-5 rounded-2xl",draggable:!1})}):t.includes("bilt")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("img",{src:za,alt:"Bilt",className:"w-full h-full object-cover rounded-2xl",draggable:!1})}):t.includes("luxury card")?e.jsx("div",{className:"w-full h-full flex items-center justify-center bg-white rounded-2xl",children:e.jsx("img",{src:Gt,alt:"Luxury Card",className:"w-[140%] h-[140%] object-contain",draggable:!1})}):t.includes("coinbase")?e.jsx("div",{className:"w-full h-full flex items-center justify-center rounded-2xl overflow-hidden",children:e.jsx("img",{src:Da,alt:"Coinbase",className:"w-full h-full object-cover",draggable:!1})}):t.includes("gemini")?e.jsx("div",{className:"w-full h-full flex items-center justify-center rounded-2xl overflow-hidden",children:e.jsx("img",{src:$a,alt:"Gemini",className:"w-full h-full object-cover",draggable:!1})}):t.includes("u.s. bank")||t.includes("us bank")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("img",{src:Fa,alt:"U.S. Bank",className:"w-full h-full object-contain bg-white p-5 rounded-2xl",draggable:!1})}):t.includes("hsbc")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("img",{src:Ba,alt:"HSBC",className:"w-full h-full object-contain bg-white p-5 rounded-2xl",draggable:!1})}):t.includes("robinhood")?e.jsx("div",{className:"w-full h-full flex items-center justify-center bg-white",children:e.jsx("img",{src:Ra,alt:"Robinhood",className:"w-full h-full object-contain bg-white p-5 rounded-2xl",draggable:!1})}):t.includes("discover")?e.jsxs("div",{className:"relative w-full h-full flex items-center justify-center",children:[e.jsx("span",{"aria-hidden":"true",className:"absolute w-[38%] aspect-square rounded-full bg-[#ff8a00]/90 blur-sm"}),e.jsx("span",{className:"relative font-display font-semibold tracking-tight leading-none text-[clamp(1.35rem,10cqw,2.8rem)]",style:u,children:"Discover"})]}):t.includes("wells fargo")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("img",{src:La,alt:"Wells Fargo",className:"w-full h-full object-contain bg-white p-5 rounded-2xl",draggable:!1})}):t.includes("pnc")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("div",{className:"flex items-center gap-[3%] px-3 py-2 rounded-md bg-[#f58025] shadow-[0_8px_20px_rgba(0,0,0,0.28)]",children:e.jsx("span",{className:"font-display font-extrabold text-white leading-none text-[clamp(1.6rem,12cqw,3.2rem)]",children:"PNC"})})}):t.includes("td bank")||t==="td"?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-[5%] px-3 py-2 rounded-md bg-[#2e8b2e] shadow-[0_8px_20px_rgba(0,0,0,0.28)]",children:[e.jsx("span",{className:"font-display font-extrabold text-white leading-none text-[clamp(1.5rem,11cqw,3rem)]",children:"TD"}),e.jsx("span",{className:"font-display font-semibold text-white leading-none text-[clamp(1rem,7.5cqw,2rem)]",children:"Bank"})]})}):t.includes("synchrony")?e.jsxs("div",{className:"w-full h-full flex items-center justify-center gap-[5%]",children:[e.jsx("span",{"aria-hidden":"true",className:"w-[14%] aspect-square rounded-full bg-[#fbb900]"}),e.jsx("span",{className:"font-display font-semibold tracking-tight leading-none text-[clamp(1.1rem,8.5cqw,2.4rem)]",style:u,children:"Synchrony"})]}):t.includes("ally")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("span",{className:"font-display font-extrabold lowercase tracking-tight leading-none text-[clamp(1.8rem,14cqw,3.8rem)]",style:{color:d?"#7e2d8a":"#ffffff",textShadow:r},children:"ally"})}):t.includes("usaa")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("div",{className:"px-3 py-1.5 rounded-md bg-[#003c71] shadow-[0_8px_20px_rgba(0,0,0,0.28)]",children:e.jsx("span",{className:"font-display font-extrabold tracking-wider text-white leading-none text-[clamp(1.4rem,11cqw,3rem)]",children:"USAA"})})}):t.includes("navy federal")?e.jsxs("div",{className:"w-full h-full flex items-center justify-center gap-[5%]",children:[e.jsxs("svg",{viewBox:"0 0 40 40","aria-hidden":"true",className:"w-[18%] max-w-10 min-w-7 shrink-0",children:[e.jsx("circle",{cx:"20",cy:"20",r:"18",fill:"#003366"}),e.jsx("path",{d:"M20 8l3 8h8l-6.5 5 2.5 9-7-5-7 5 2.5-9L9 16h8z",fill:"#ffd700"})]}),e.jsxs("span",{className:"font-display font-semibold leading-tight text-[clamp(0.95rem,7.2cqw,1.95rem)]",style:u,children:["Navy",e.jsx("br",{}),"Federal"]})]}):t.includes("penfed")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("div",{className:"px-3 py-1.5 rounded-md bg-[#003087] shadow-[0_8px_20px_rgba(0,0,0,0.28)]",children:e.jsx("span",{className:"font-display font-extrabold tracking-tight text-white leading-none text-[clamp(1.3rem,10cqw,2.8rem)]",children:"PenFed"})})}
1):t.includes("truist")?e.jsxs("div",{className:"w-full h-full flex items-center justify-center gap-[5%]",children:[e.jsx("span",{"aria-hidden":"true",className:"w-[14%] aspect-square rounded-sm bg-[#5a2c81] rotate-45"}),e.jsx("span",{className:"font-display font-semibold tracking-tight leading-none text-[clamp(1.3rem,10cqw,2.8rem)]",style:u,children:"Truist"})]}):t.includes("fifth third")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("div",{className:"px-3 py-1.5 rounded-md bg-[#00482b] shadow-[0_8px_20px_rgba(0,0,0,0.28)]",children:e.jsx("span",{className:"font-display font-semibold text-white leading-none text-[clamp(1rem,7.8cqw,2.1rem)]",children:"Fifth Third"})})}):t.includes("regions")?e.jsxs("div",{className:"w-full h-full flex items-center justify-center gap-[5%]",children:[e.jsx("span",{"aria-hidden":"true",className:"w-[14%] aspect-square rounded-full bg-[#7ac142]"}),e.jsx("span",{className:"font-display font-semibold tracking-tight leading-none text-[clamp(1.3rem,10cqw,2.8rem)]",style:u,children:"Regions"})]}):t.includes("keybank")||t==="key"?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("div",{className:"px-3 py-1.5 rounded-md bg-[#d6001c] shadow-[0_8px_20px_rgba(0,0,0,0.28)]",children:e.jsx("span",{className:"font-display font-extrabold tracking-tight text-white leading-none text-[clamp(1.3rem,10cqw,2.8rem)]",children:"KeyBank"})})}):t.includes("citizens")?e.jsxs("div",{className:"w-full h-full flex items-center justify-center gap-[5%]",children:[e.jsx("span",{"aria-hidden":"true",className:"w-[14%] aspect-square rounded-full bg-[#00833e]"}),e.jsx("span",{className:"font-display font-semibold tracking-tight leading-none text-[clamp(1.2rem,9cqw,2.5rem)]",style:u,children:"Citizens"})]}):t.includes("m&t")||t.includes("m and t")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("div",{className:"px-3 py-1.5 rounded-md bg-[#00833e] shadow-[0_8px_20px_rgba(0,0,0,0.28)]",children:e.jsx("span",{className:"font-display font-extrabold tracking-wider text-white leading-none text-[clamp(1.4rem,11cqw,3rem)]",children:"M&T"})})}):t.includes("first national")||t.includes("fnbo")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("div",{className:"px-3 py-1.5 rounded-md bg-[#003a70] shadow-[0_8px_20px_rgba(0,0,0,0.28)]",children:e.jsx("span",{className:"font-display font-extrabold tracking-wider text-white leading-none text-[clamp(1.4rem,11cqw,3rem)]",children:"FNBO"})})}):t.includes("comenity")?e.jsxs("div",{className:"w-full h-full flex items-center justify-center gap-[5%]",children:[e.jsx("span",{"aria-hidden":"true",className:"w-[12%] aspect-square rounded-full bg-[#e4002b]"}),e.jsx("span",{className:"font-display font-semibold tracking-tight leading-none text-[clamp(1.15rem,9cqw,2.5rem)]",style:u,children:"Comenity"})]}):t.includes("bread")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("span",{className:"font-display font-extrabold tracking-tight leading-none text-[clamp(1.5rem,12cqw,3.2rem)]",style:{color:d?"#1a1a1a":"#ffffff",textShadow:r},children:"bread"})}):t.includes("credit one")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("div",{className:"px-3 py-1.5 rounded-md bg-[#0a4d8c] shadow-[0_8px_20px_rgba(0,0,0,0.28)]",children:e.jsx("span",{className:"font-display font-extrabold tracking-tight text-white leading-none text-[clamp(1rem,8cqw,2.1rem)]",children:"Credit One"})})}):t.includes("first premier")||t.includes("first national bank of omaha")?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("div",{className:"px-3 py-1.5 rounded-md bg-[#0a2540] shadow-[0_8px_20px_rgba(0,0,0,0.28)]",children:e.jsx("span",{className:"font-display font-semibold tracking-tight text-white leading-none text-[clamp(1rem,7.5cqw,2rem)]",children:"First Premier"})})}):e.jsx("span",{className:"font-display font-semibold text-center leading-tight text-[clamp(1.05rem,8cqw,2.5rem)]",style:{color:_,textShadow:r},children:c})}function Zt({issuer:a,style:n}){return e.jsx("div",{className:"@container w-full h-full flex items-center justify-center",children:e.jsx(Oa,{issuer:a,style:n,tone:"onGradient"})})}function ua({style:a,fallback:n}){return e.jsx(Oa,{issuer:n,style:a,tone:"onLight"})}function Jt({issuers:a,favSet:n,holdersByIssuer:x,onSelect:t,onToggleFavorite:c}){const{t:d}=J(),C=m.useRef(null),_=m.useRef([]),[r,u]=m.useState(0),[b,h]=m.useState(""),y=m.useId();function q(){const l=_.current.filter(Boolean);if(l.length<2)return 1;const i=l[0].offsetTop;let N=0;for(const S of l){if(S.offsetTop!==i)break;N++}return Math.max(1,N)}function I(l){const i=_.current,N=Math.max(0,Math.min(i.length-1,l));
1i[N]?.focus(),u(N)}function f(l){const i=q(),N=a.length-1;let S=r;switch(l.key){case"ArrowRight":S=Math.min(N,r+1);break;case"ArrowLeft":S=Math.max(0,r-1);break;case"ArrowDown":S=Math.min(N,r+i);break;case"ArrowUp":S=Math.max(0,r-i);break;case"Home":S=0;break;case"End":S=N;break;case"f":case"F":{const P=a[r]?.[0];P&&(c(P),h(n.has(P)?d(`Removed ${P} from favorites`,`${P} eliminado de favoritos`):d(`Added ${P} to favorites`,`${P} añadido a favoritos`))),l.preventDefault();return}default:return}l.preventDefault(),I(S)}return e.jsxs("div",{role:"region","aria-labelledby":`${y}-title`,children:[e.jsx("h2",{id:`${y}-title`,className:"sr-only",children:d("Choose a card issuer","Elige un emisor de tarjeta")}),e.jsx("p",{id:y,className:"text-sm text-titanium mb-4",children:d("Pick your card's issuer to see their lineup. Use arrow keys to move, Enter to open, and F to toggle a favorite. Tap the star to pin favorites to the top.","Elige el emisor de tu tarjeta para ver su catálogo. Usa las flechas para moverte, Enter para abrir y F para marcar como favorito. Toca la estrella para fijar favoritos arriba.")}),e.jsx("div",{ref:C,role:"grid","aria-label":d("Card issuers","Emisores de tarjetas"),"aria-describedby":y,"aria-rowcount":Math.ceil(a.length/Math.max(1,q())),onKeyDown:f,className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-5",children:a.map(([l,i],N)=>{const S=Le(l),P=n.has(l),ee=N===r?0:-1;return e.jsxs("div",{role:"gridcell",className:"relative group",children:[e.jsxs("button",{ref:E=>{_.current[N]=E},onClick:()=>{u(N),t(l),h(d(`Opened ${l}, ${i} cards available`,`Abierto ${l}, ${i} tarjetas disponibles`))},onKeyDown:E=>{E.key!=="Enter"&&E.key!==" "||(E.preventDefault(),E.stopPropagation(),u(N),t(l),h(d(`Opened ${l}, ${i} cards available`,`Abierto ${l}, ${i} tarjetas disponibles`)))},onFocus:()=>u(N),tabIndex:ee,"aria-label":d(`${l}, ${i} ${i===1?"card":"cards"}${P?", favorited":""}. Press Enter to view cards, F to toggle favorite.`,`${l}, ${i} ${i===1?"tarjeta":"tarjetas"}${P?", en favoritos":""}. Pulsa Enter para ver las tarjetas, F para marcar favorito.`),className:F("relative w-full aspect-square rounded-3xl overflow-hidden transform-gpu [backface-visibility:hidden] [-webkit-font-smoothing:subpixel-antialiased]",l==="Bank of America"?"bg-white":"bg-gradient-to-br","transition-[transform,box-shadow,filter] duration-200 ease-out cursor-pointer will-change-transform","hover:-translate-y-2 hover:brightness-110 hover:saturate-125","active:translate-y-0.5 active:brightness-90 active:duration-75","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-platinum focus-visible:ring-offset-2 focus-visible:ring-offset-background",l!=="Bank of America"&&S.gradient),style:{containerType:"inline-size","--rest-shadow":`0 18px 32px -12px rgba(0,0,0,0.7), 0 6px 12px -4px rgba(0,0,0,0.5), inset 0 2px 0 rgba(255,255,255,0.35), inset 0 -3px 6px rgba(0,0,0,0.45), inset 0 0 0 1px ${S.accent}66, 0 0 0 1px rgba(0,0,0,0.4)`,"--hover-shadow":`0 28px 50px -12px rgba(0,0,0,0.85), 0 10px 20px -6px rgba(0,0,0,0.6), 0 0 0 2px ${S.accent}, 0 0 28px ${S.accent}80, inset 0 2px 0 rgba(255,255,255,0.45), inset 0 -3px 8px rgba(0,0,0,0.5)`,"--press-shadow":`0 6px 14px -6px rgba(0,0,0,0.85), inset 0 4px 12px rgba(0,0,0,0.6), inset 0 -1px 0 rgba(255,255,255,0.15), inset 0 0 0 1px ${S.accent}99`,boxShadow:"var(--rest-shadow)"},onPointerEnter:E=>{E.currentTarget.style.boxShadow="var(--hover-shadow)"},onPointerLeave:E=>{E.currentTarget.style.boxShadow="var(--rest-shadow)"},onPointerDown:E=>{E.currentTarget.style.boxShadow="var(--press-shadow)"},onPointerUp:E=>{E.currentTarget.style.boxShadow="var(--hover-shadow)"},onPointerCancel:E=>{E.currentTarget.style.boxShadow="var(--rest-shadow)"},children:[e.jsx("div",{"aria-hidden":"true",className:"absolute inset-x-0 top-0 h-1/2 bg-gradient-to-b from-white/25 via-white/5 to-transparent pointer-events-none"}),e.jsx("div",{"aria-hidden":"true",className:"absolute -inset-1 bg-gradient-to-tr from-transparent via-white/15 to-transparent rotate-12 translate-y-4 group-hover:translate-y-0 transition-transform duration-500 pointer-events-none"}),l!=="Bank of America"&&e.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 opacity-60 pointer-events-none",style:{background:`radial-gradient(circle at 30% 20%, ${S.accent}55 0%, transparent 55%)`}}),e.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 opacity-[0.18] mix-blend-overlay pointer-events-none",style:{backgroundImage:`url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/></svg>")`}}),S.arc&&e.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 200 200",className:"absolute inset-0 w-full h-full pointer-events-none",preserveAspectRatio:"xMidYMid slice",children:[e.jsx("path",{d:"M 28 96 A 72 50 0 0 1 172 96",fill:"none",stroke:S.accent,strokeWidth:"6",strokeLinecap:"round",opacity:"0.95"}),e.jsx("path",{d:"M 28 96 A 72 50 0 0 1 172 96",fill:"none",stroke:"#ffffff",strokeWidth:"1.5",strokeLinecap:"round",opacity:"0.35"})]}),e.jsx("div",{"aria-hidden":"true",className:`absolute inset-0 flex items-center justify-center text-center ${l==="Bank of America"?"px-[12%] pt-[10%] pb-[22%]":"px-[6%] pt-[8%] pb-[22%]"}`,children:e.jsx(Zt,{issuer:l,style:S})}),e.jsxs("div",{"aria-hidden":"true",className:"absolute bottom-2 left-2 right-2 flex items-end justify-between gap-1",children:[e.jsxs("span",{className:"text-[10px] font-medium text-white/90 tabular-nums bg-black/40 backdrop-blur-md rounded-full px-2 py-0.5 border border-white/20",children:[(x.get(l)??0).toLocaleStr
1ing()," ",(x.get(l)??0)===1?d("holder","titular"):d("holders","titulares")]}),e.jsxs("span",{className:"text-[10px] font-medium text-white/90 tabular-nums bg-black/40 backdrop-blur-md rounded-full px-2 py-0.5 border border-white/20",children:[i," ",i===1?d("card","tarjeta"):d("cards","tarjetas")]})]})]}),e.jsx("button",{type:"button",onClick:E=>{E.stopPropagation(),c(l),h(P?d(`Removed ${l} from favorites`,`${l} eliminado de favoritos`):d(`Added ${l} to favorites`,`${l} añadido a favoritos`))},"aria-label":P?d(`Unfavorite ${l}`,`Quitar ${l} de favoritos`):d(`Favorite ${l}`,`Marcar ${l} como favorito`),"aria-pressed":P,className:F("absolute top-2 right-2 size-8 rounded-full flex items-center justify-center z-10","bg-black/50 backdrop-blur-md border border-white/25 shadow-lg","transition-all hover:scale-110 active:scale-95","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-platinum focus-visible:ring-offset-2 focus-visible:ring-offset-background",P?"text-gold":"text-white/80 hover:text-white"),children:e.jsx(He,{"aria-hidden":"true",className:F("size-4",P&&"fill-current")})})]},l)})}),e.jsx("div",{role:"status","aria-live":"polite",className:"sr-only",children:b})]})}function es({search:a,setSearch:n,category:x,setCategory:t,filtered:c,matchHints:d,selected:C,setSelected:_,issuer:r,setIssuer:u,onAdvance:b,initialSegment:h="personal"}){const{user:y}=$e(),q=Me(),[I,f]=m.useState(h),l=m.useRef(null),i=m.useRef(!1);m.useEffect(()=>{typeof window>"u"||r&&window.scrollTo({top:0,behavior:"smooth"})},[r]);const N=c.filter(s=>I==="business"?we(s):!we(s)),{data:S=[]}=ie({queryKey:["favorite-issuers",y?.id],enabled:!!y,queryFn:async()=>{const{data:s,error:o}=await G.from("favorite_issuers").select("issuer");if(o)throw o;return(s??[]).map(U=>U.issuer)}}),P=new Set(S),{data:ee=[]}=ie({queryKey:["catalog-popularity"],staleTime:1e3*60*5,queryFn:async()=>{const{data:s,error:o}=await G.rpc("card_catalog_popularity");if(o)throw o;return s??[]}}),E=new Map(ee.map(s=>[s.catalog_id,Number(s.holders)||0])),{data:te=[]}=ie({queryKey:["welcome-offers-active"],staleTime:1e3*60*10,queryFn:async()=>{const{data:s,error:o}=await G.from("card_welcome_offers").select("card_catalog_id, estimated_value_usd, bonus_amount, bonus_unit").eq("is_active",!0);if(o)throw o;return s??[]}}),p=new Map(te.map(s=>[s.card_catalog_id,s])),T=new Map;for(const s of N){const o=E.get(s.id)??0;T.set(s.issuer,(T.get(s.issuer)??0)+o)}const se=new Map,R=new Map;for(const s of N){const o=R.get(s.issuer)??[];o.push(s),R.set(s.issuer,o)}for(const[,s]of R)[...s].sort((o,U)=>Number(U.annual_fee)-Number(o.annual_fee)).forEach((o,U)=>se.set(o.id,U+1));const $=ha({mutationFn:async s=>{if(!y)throw new Error("Not signed in");if(P.has(s)){const{error:o}=await G.from("favorite_issuers").delete().eq("user_id",y.id).eq("issuer",s);if(o)throw o;return{name:s,favorited:!1}}else{const{error:o}=await G.from("favorite_issuers").insert({user_id:y.id,issuer:s});if(o)throw o;return{name:s,favorited:!0}}},onSuccess:()=>q.invalidateQueries({queryKey:["favorite-issuers",y?.id]}),onError:s=>X.error(s.message)}),g=Array.from(N.reduce((s,o)=>(s.set(o.issuer,(s.get(o.issuer)??0)+1),s),new Map)).sort((s,o)=>{const U=P.has(s[0])?1:0,K=P.has(o[0])?1:0;return U!==K?K-U:s[0].localeCompare(o[0],void 0,{sensitivity:"base"})}),B=r?N.filter(s=>s.issuer===r).sort((s,o)=>s.name.localeCompare(o.name,void 0,{sensitivity:"base"})):[],A=a.trim().length>0||x!=="all",{t:j,lang:w}=J(),re=s=>s==="personal"?j("personal","personal"):j("business","empresarial"),ne=j("Search by issuer, name, or benefit…","Busca por emisor, nombre o beneficio…"),be=m.useRef(null),[Q,ve]=m.useState(0),[W,pe]=m.useState(!1),[je,ye]=m.useState(!1);m.useEffect(()=>{typeof window>"u"||(pe(window.matchMedia("(prefers-reduced-motion: reduce)").matches),ye(/Mac|iPhone|iPad/.test(window.navigator.platform||"")))},[]),m.useEffect(()=>{if(W||a.length>0)return;const s=window.setInterval(()=>ve(o=>(o+1)%oa.length),2800);return()=>window.clearInterval(s)},[W,a]),m.useEffect(()=>{const s=o=>
1{o.key.toLowerCase()==="k"&&(o.metaKey||o.ctrlKey)&&(o.preventDefault(),be.current?.focus())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[]);const xe=oa[Q],Se=W||!xe?ne:j(`Try "${xe.en}"`,`Prueba "${xe.es}"`);return e.jsxs("div",{children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{role:"tablist","aria-label":j("Card type","Tipo de tarjeta"),className:"mb-6 inline-flex items-center gap-1 p-1 rounded-full border border-metallic bg-metallic/30",children:["personal","business"].map(s=>{const o=I===s;return e.jsx("button",{role:"tab","aria-selected":o,onClick:()=>{f(s),r&&(c.some(K=>K.issuer===r&&(s==="business"?we(K):!we(K)))||u(null))},className:F("px-4 py-1.5 rounded-full text-sm font-semibold transition-colors capitalize",o?"bg-gold/20 text-gold border border-gold/60 shadow-[0_0_0_1px_rgba(212,175,55,0.25)]":"text-titanium hover:text-platinum"),children:re(s)},s)})})}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-center text-balance font-semibold tracking-tight text-platinum text-xl sm:text-3xl",children:j("What kind of card are you looking for?","¿Qué tipo de tarjeta estás buscando?")}),e.jsx("div",{role:"group","aria-label":j("Filter by card category","Filtrar por c
1ategoría de tarjeta"),className:"mt-4 grid grid-cols-3 sm:grid-cols-6 gap-1.5 sm:gap-2 place-items-center",children:Aa.map(s=>{const o=x===s.key;return e.jsx("button",{type:"button","aria-pressed":o,onClick:()=>{t(s.key),u(null)},className:F("w-full rounded-full px-2 py-1.5 text-[11px] sm:text-[12px] font-medium transition-colors border text-center whitespace-normal leading-tight",o?"bg-gold/20 text-gold border-gold/60":"border-metallic bg-metallic/20 text-titanium hover:text-platinum hover:border-gold/40"),children:j(s.label.en,s.label.es)},s.key)})}),e.jsx("div",{className:"mt-5 search-pill-ring rounded-full p-[1.5px]",children:e.jsxs("div",{className:"relative rounded-full bg-background",children:[e.jsx(ht,{className:"size-4 sm:size-[18px] absolute left-4 sm:left-5 top-1/2 -translate-y-1/2 text-titanium pointer-events-none"}),e.jsx(Z,{ref:be,value:a,onChange:s=>{n(s.target.value),s.target.value&&u(null)},placeholder:Se,"aria-label":j("Search cards by issuer, name, or benefit","Buscar tarjetas por emisor, nombre o beneficio"),className:"h-12 sm:h-14 rounded-full border-0 bg-transparent pl-11 sm:pl-14 pr-4 sm:pr-24 text-[13px] sm:text-base placeholder:text-[13px] sm:placeholder:text-base focus-visible:ring-0 focus-visible:ring-offset-0"}),e.jsxs("span",{"aria-hidden":"true",className:"hidden sm:flex absolute right-5 top-1/2 -translate-y-1/2 items-center gap-1 pointer-events-none",children:[e.jsx("kbd",{className:"rounded-md border border-metallic bg-metallic/40 px-1.5 py-0.5 text-[10px] font-medium text-titanium",children:je?"⌘":"Ctrl"}),e.jsx("kbd",{className:"rounded-md border border-metallic bg-metallic/40 px-1.5 py-0.5 text-[10px] font-medium text-titanium",children:"K"})]})]})})]}),!A&&!r&&e.jsx(Jt,{issuers:g,favSet:P,holdersByIssuer:T,onSelect:s=>{u(s)},onToggleFavorite:s=>$.mutate(s)}),!A&&r&&(()=>{const s=Le(r),o=s.displayName??r;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4 sm:hidden",children:e.jsxs("p",{className:"text-sm text-titanium",children:[e.jsx("span",{className:"text-platinum font-medium",children:o})," · ",B.length," ",B.length===1?j("card","tarjeta"):j("cards","tarjetas")]})}),e.jsxs("div",{className:F("hidden sm:block relative mb-6 rounded-3xl overflow-hidden border border-metallic shadow-platinum","bg-gradient-to-br",s.gradient),style:{"--accent":s.accent},children:[e.jsx("div",{"aria-hidden":"true",className:"absolute inset-x-0 top-0 h-1/2 bg-gradient-to-b from-white/20 via-white/5 to-transparent pointer-events-none"}),e.jsx("div",{"aria-hidden":"true",className:"absolute -top-24 -right-24 size-72 rounded-full blur-3xl op
1acity-60 pointer-events-none",style:{background:`radial-gradient(circle, ${s.accent}80 0%, transparent 70%)`}}),e.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 opacity-[0.15] mix-blend-overlay pointer-events-none",style:{backgroundImage:`url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/></svg>")`}}),e.jsxs("div",{className:"relative flex items-center gap-5 px-6 sm:px-8 py-6 sm:py-8",children:[o==="American Express"?e.jsx("div",{className:"@container flex items-center justify-center w-24 h-24 sm:w-28 sm:h-28 shrink-0 overflow-hidden",children:e.jsx("img",{src:Ta,alt:"American Express",className:"w-full h-full object-contain",draggable:!1})}):o==="Bank of America"?e.jsx("div",{className:"@container bg-white flex items-center justify-center w-32 h-32 sm:w-40 sm:h-40 shrink-0 overflow-hidden rounded-3xl",children:e.jsx("img",{src:Ea,alt:"Bank of America",className:"w-full h-full object-contain scale-110 bg-white",draggable:!1})}):o==="Barclays"?e.jsx("div",{className:"@container bg-white flex items-center justify-center w-32 h-32 sm:w-40 sm:h-40 shrink-0 overflow-hidden rounded-3xl",children:e.jsx("img",{src:Ia,alt:"Barclays",className:"w-full h-full object-contain bg-white p-5 rounded-2xl",draggable:!1})}):o==="Chase"?e.jsx("div",{className:"@container bg-[#FFFFFF] rounded-2xl shadow-xl flex items-center justify-center w-20 h-20 sm:w-24 sm:h-24 p-2 shrink-0 overflow-hidden",children:e.jsx("div",{className:"w-full h-full flex items-center justify-center overflow-hidden",children:e.jsx(ua,{style:s,fallback:o})})}):o==="Bilt"?e.jsx("div",{className:"@container flex items-center justify-center w-32 h-32 sm:w-40 sm:h-40 shrink-0 overflow-hidden rounded-3xl",children:e.jsx("img",{src:za,alt:"BILT",className:"w-full h-full object-cover",draggable:!1})}):o==="Capital One"?e.jsx("div",{className:"@container bg-white flex items-center justify-center w-32 h-32 sm:w-40 sm:h-40 shrink-0 overflow-hidden rounded-3xl p-4",children:e.jsx("img",{src:qa,alt:"Capital One",className:"w-full h-full object-contain",draggable:!1})}):o==="citi"?e.jsx("div",{className:"@container bg-white flex items-center justify-center w-32 h-32 sm:w-40 sm:h-40 shrink-0 overflow-hidden rounded-3xl p-8",children:e.jsx("img",{src:Pa,alt:"citi",className:"w-full h-full object-contain",draggable:!1})}):o==="HSBC"?e.jsx("div",{className:"@container bg-white flex items-center justify-center w-32 h-32 sm:w-40 sm:h-40 shrink-0 overflow-hidden rounded-3xl p-4",children:e.jsx("img",{src:Ba,alt:"HSBC",className:"w-full h-full object-contain",draggable:!1})}):o==="Robinhood"?e.jsx("div",{className:"@container bg-white flex items-center justify-center w-32 h-32 sm:w-40 sm:h-40 shrink-0 overflow-hidden rounded-3xl p-2",children:e.jsx("img",{src:Ra,alt:"Robinhood",className:"w-full h-full object-contain",draggable:!1})}):o==="U.S. Bank"||o==="US Bank"?e.jsx("div",{className:"@container bg-white flex items-center justify-center w-32 h-32 sm:w-40 sm:h-40 shrink-0 overflow-hidden rounded-3xl p-5",children:e.jsx("img",{src:Fa,alt:"U.S. Bank",className:"w-full h-full object-contain",draggable:!1})}):o==="Wells Fargo"?e.jsx("div",{className:"@container bg-white flex items-center justify-center w-32 h-32 sm:w-40 sm:h-40 shrink-0 overflow-hidden rounded-3xl p-5",children:e.jsx("img",{src:La,alt:"Wells Fargo",className:"w-full h-full object-contain",draggable:!1})}):o==="Coinbase"?e.jsx("div",{className:"@container flex items-center justify-center w-32 h-32 sm:w-40 sm:h-40 shrink-0 overflow-hidden rounded-3xl",children:e.jsx("img",{src:Da,alt:"Coinbase",className:"w-full h-full object-cover",draggable:!1})}):o==="Gemini"?e.jsx("div",{className:"@container flex items-center justify-center w-32 h-32 sm:w-40 sm:h-40 shrink-0 overflow-hidden rounded-3xl",children:e.jsx("img",{src:$a,alt:"Gemini",className:"w-full h-full object-cover",draggable:!1})}):e.jsx("div",{className:"@container bg-white/95 rounded-2xl shadow-xl flex items-center justify-center w-20 h-20 sm:w-24 sm:h-24 p-3 shrink-0 overflow-hidden",children:e.jsx("div",{className:"w-full h-full flex items-center justify-center overflow-hidden",children:e.jsx(ua,{style:s,fallback:o})})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:F("font-display text-3xl sm:text-4xl tracking-tight break-words",o==="Robinhood"||o==="U.S. Bank"||o==="US Bank"?"text-black":"text-white drop-shadow-[0_2px_8px_rgba(0,0,0,0.5)]",o==="American Express"&&"uppercase tracking-wider",o==="Bilt"&&"uppercase tracking-wider"),children:o==="Bilt"?"BILT":o}),e.jsxs("p",{className:F("text-sm mt-1",o==="Robinhood"||o==="U.S. Bank"||o==="US Bank"?"text-black/70":"text-white/80"),children:[B.length," ",B.length===1?j("c
1ard available","tarjeta disponible"):j("cards available","tarjetas disponibles")," · ",j("Pick one to import its benefits","Elige una para importar sus beneficios")]})]})]})]})]})})(),(A||r)&&e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:(A?N:B).map(s=>{const o=C?.id===s.id,U=E.get(s.id)??0,K=se.get(s.id),Ae=(R.get(s.issuer)??[]).length;return e.jsxs("button",{onTouchStart:D=>{const ae=D.touches[0];l.current={x:ae.clientX,y:ae.clientY},i.current=!1},onTouchMove:D=>{const ae=l.current;if(!ae)return;const he=D.touches[0];(Math.abs(he.clientX-ae.x)>10||Math.abs(he.clientY-ae.y)>10)&&(i.current=!0)},onClick:D=>{if(i.current){D.preventDefault(),i.current=!1;return}_(s)},onDoubleClick:()=>{b(s)},className:F("text-left p-4 rounded-xl border bg-metallic/40 transition-all duration-150 flex flex-col items-stretch w-full h-full touch-pan-y",o?"border-gold shadow-[0_0_0_1px_rgba(212,175,55,0.45)] -translate-y-px":"border-metallic hover:border-gold/60 hover:-translate-y-px"),children:[e.jsx(Oe,{issuer:s.issuer,name:s.name,network:s.network,colorHex:s.color_hex,annualFee:s.annual_fee,imageUrl:s.image_url,size:"sm"}),e.jsxs("div",{className:"mt-3 flex items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-platinum",children:Ue(s.issuer,s.name)}),e.jsxs("p",{className:"text-xs font-semibold text-gold/90",children:[j("Annual fee","Cuota anual")," ",Y(s.annual_fee)]})]}),o&&e.jsx(at,{className:"bg-gold text-background hover:bg-gold/90 font-bold",children:j("Selected","Seleccionada")})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[e.jsxs("span",{className:"text-[10px] uppercase tracking-wide font-bold text-gold bg-gold/10 border border-gold/40 rounded-full px-2 py-0.5 tabular-nums",children:[j("Held by","En poder de")," ",U.toLocaleString()," ",U===1?j("user","usuario"):j("users","usuarios")]}),K&&Ae>1&&e.jsxs("span",{className:"text-[10px] uppercase tracking-wide font-bold text-gold bg-gold/15 border border-gold/50 rounded-full px-2 py-0.5 tabular-nums",children:["#",K," ",j("fee in","cuota en")," ",Le(s.issuer).displayName??s.issuer]}),(()=>{const D=p.get(s.id);if(!D)return null;const ae=D.estimated_value_usd&&Number(D.estimated_value_usd)>0?`${Y(Number(D.estimated_value_usd))} ${j("bonus","bono")}`:D.bonus_amount&&D.bonus_unit?`${Number(D.bonus_amount).toLocaleString()} ${String(D.bonus_unit).replace("_"," ")}`:j("Welcome offer","Oferta de bienvenida");return e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] uppercase tracking-wide font-bold text-gold bg-gradient-to-r from-gold/25 to-gold/10 border border-gold/60 rounded-full px-2 py-0.5",children:[e.jsx(Ca,{className:"size-2.5"})," ",ae]})})()]}),A&&(d?.get(s.id)?.length??0)>0&&e.jsxs("p",{className:"mt-2 text-[11px] text-titanium",children:[j("Matches","Coincide con"),":"," ",d.get(s.id).map(D=>w==="es"?D.es:D.en).join(", ")]})]},s.id)})}),A&&N.length===0&&e.jsxs("div",{className:"rounded-xl border border-metallic bg-metallic/30 p-5",children:[e.jsx("p",{className:"text-sm text-platinum font-medium",children:j("No cards match that search.","Ninguna tarjeta coincide con esa búsqueda.")}),e.jsx("p",{className:"mt-1 text-xs text-titanium",children:j("You can search by issuer, card name, or a benefit — try one of these:","Puedes buscar por emisor, nombre de tarjeta o un beneficio — prueba uno de estos:")}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:qt.map(s=>e.jsx("button",{type:"button",onClick:()=>n(s),className:"text-[11px] rounded-full border border-metallic bg-metallic/40 px-2 py-0.5 text-titanium hover:text-platinum hover:border-gold/50 transition-colors",children:s},s))})]}),e.jsx(as,{})]})}function as(){const{t:a}=J(),{user:n}=$e(),x=wa(),[t,c]=m.useState(!1),[d,C]=m.useState(""),[_,r]=m.useState(!1),[u,b]=m.useState(""),[h,y]=m.useState(!1),[q,I]=m.useState(""),[f,l]=m.useState(""),[i,N]=m.useState(""),[S,P]=m.useState(!1),ee=m.useRef(null),E=m.useRef(null),te=m.useRef(null),[p,T]=m.useState(0);m.useEffect(()=>{if(!_)return;function R($){ee.current?.contains($.target)||r(!1)}return document.addEventListener("pointerdown",R),()=>document.removeEventListener("pointerdown",R)},[_]),m.useEffect(()=>{_&&(T(0),requestAnimationFrame(()=>E.current?.focus()))},[_]),m.useEffect(()=>{T(0)},[u]);async function se(){const R=d.trim(),$=q.trim();if(R.length<1||$.length<1){X.error(a("Please enter both issuer and card name","Por favor ingresa el emisor y el nombre de la tarjeta"));return}if(R.length>100||$.length>100||i.length>4e3){X.error(a("Input is too long","La entrada es demasiado larga"));return}P(!0);try{const g=[`Issuer: ${R}`,`Card name: ${$}`,f?`Card type: ${f==="business"?"Business":"Personal"}`:null,i.trim()?`Notes: ${i.trim()}
1`:null].filter(Boolean).join(`
2`),B=n?.user_metadata?.full_name?.trim()||n?.email?.split("@")[0]||"Member",A=n?.email??"";if(!A){x();return}const j=await fetch("/api/public/contact-submit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B,email:A,topic:"card_request",message:`New card request
3
4${g}`})});if(!j.ok){const w=await j.json().catch(()=>({}));throw new Error(w?.error??`Request failed (${j.status})`)}X.success(a("Request submitted — check your email for confirmation","Solicitud enviada — revisa tu correo para la confirmación")),C(""),b(""),y(!1),I(""),N(""),l(""),c(!1)}catch(g){X.error(g?.message??a("Could not submit request","No se pudo enviar la solicitud"))}finally{P(!1)}}return e.jsxs("div",{className:"mt-8 rounded-2xl border border-dashed border-gold/40 bg-gold/5 p-5 flex flex-col sm:flex-row sm:items-center gap-3 justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-display text-lg text-platinum",children:a("Don't see your card?","¿No ves tu tarjeta?")}),e.jsx("p",{className:"text-sm text-titanium mt-0.5",children:a("Submit a request and we'll add it to the catalog so you can link it.","Envía una solicitud y la añadiremos al catálogo para que puedas vincularla.")})]}),t?null:e.jsxs(M,{variant:"gold",onClick:()=>c(!0),children:[e.jsx(vt,{className:"size-4"})," ",a("Request a card","Solicitar una tarjeta")]}),t&&e.jsxs("div",{className:"w-full sm:max-w-md grid gap-2",children:[(()=>{const R=Array.from(new Set(Object.entries(Ma).map(([g,B])=>B.displayName??g).filter(g=>!!g))).sort((g,B)=>g.localeCompare(B)),$=u.trim()?R.filter(g=>g.toLowerCase().includes(u.trim().toLowerCase())):R;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{ref:ee,className:"relative",children:[e.jsxs(M,{variant:"outline",type:"button",role:"combobox","aria-expanded":_,"aria-controls":"issuer-request-options",onClick:()=>{r(g=>!g),b("")},className:F("w-full justify-between bg-transparent border border-metallic text-platinum hover:bg-metallic hover:text-platinum",!d&&"text-titanium"),children:[d||a("Issuer","Emisor"),e.jsx(Sa,{className:F("ml-2 h-4 w-4 shrink-0 opacity-50 transition-transform",_&&"rotate-180")})]}),_&&e.jsxs("div",{className:"mt-1 flex flex-col overflow-hidden rounded-xl border border-metallic bg-metallic p-2 text-platinum shadow-platinum ring-1 ring-gold/20",style:{height:"min(22rem, 60vh)"},children:[e.jsx(Z,{ref:E,value:u,onChange:g=>b(g.target.value),onKeyDown:g=>{const B=$.length+1;if(g.key==="ArrowDown")g.preventDefault(),T(A=>Math.min(A+1,B-1));else if(g.key==="ArrowUp")g.preventDefault(),T(A=>Math.max(A-1,0));else if(g.key==="Home")g.preventDefault(),T(0);else if(g.key==="End")g.preventDefault(),T(B-1);else if(g.key==="Enter")if(g.preventDefault(),p<$.length){const A=$[p];A&&(C(A),b(""),y(!1),r(!1))}else C(""),b(""),y(!0),r(!1);else g.key==="Escape"&&(g.preventDefault(),r(!1))},placeholder:a("Search issuer…","Buscar emisor…"),autoComplete:"off",className:"mb-2 shrink-0 text-platinum placeholder:text-titanium"}),e.jsxs("div",{ref:te,id:"issuer-request-options",role:"listbox","aria-label":a("Issuer options","Opciones de emisor"),className:"flex-1 min-h-0 overflow-y-auto overscroll-contain pr-1 [scrollbar-width:thin]",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:[$.length===0?e.jsx("p",{className:"px-3 py-6 text-center text-sm text-titanium",children:a("No issuer found.","No se encontró el emisor.")}):$.map((g,B)=>{const A=B===p;return e.jsxs("button",{type:"button",role:"option","aria-selected":d===g,ref:j=>{A&&j&&j.scrollIntoView({block:"nearest"})},onMouseEnter:()=>T(B),onClick:()=>{C(g),b(""),y(!1),r(!1)},className:F("flex min-h-10 w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm text-platinum focus-visible:outline-none",A?"bg-gold/20":"hover:bg-gold/10"),children:[e.jsx(ce,{className:F("h-4 w-4",d===g?"opacity-100":"opacity-0")}),e.jsx("span",{children:(()=>{const j=u.trim();if(!j)return g;const re=g.toLowerCase().indexOf(j.toLowerCase());if(re<0)return g;const ne=re+j.length;return e.jsxs(e.Fragment,{children:[g.slice(0,re),e.jsx("mark",{className:"bg-transparent text-gold font-semibold",children:g.slice(re,ne)}),g.slice(ne)]})})()})]},g)}),(()=>{const g=$.length,B=g===p;return e.jsxs("button",{type:"button",role:"option","aria-selected":h,ref:A=>{B&&A&&A.scrollIntoView({block:"nearest"})},onMouseEnter:()=>T(g),onClick:()=>{C(""),b(""),y(!0),r(!1)},className:F("flex min-h-10 w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm text-platinum focus-visible:outline-none",B?"bg-gold/20":"hover:bg-gold/10"),
4children:[e.jsx(ce,{className:F("h-4 w-4",h?"opacity-100":"opacity-0")}),e.jsx("span",{children:a("Other","Otro")})]})})()]})]})]}),h&&e.jsx(Z,{placeholder:a("Enter issuer name…","Ingresa el nombre del emisor…"),value:d,onChange:g=>C(g.target.value.slice(0,100)),maxLength:100,autoComplete:"off",className:"mt-1"})]})})(),e.jsx(Z,{placeholder:a("Card name (e.g. Sapphire Reserve)","Nombre de la tarjeta (p. ej. Sapphire Reserve)"),value:q,onChange:R=>I(R.target.value.slice(0,100)),maxLength:100}),e.jsxs(ba,{value:f,onValueChange:R=>l(R),children:[e.jsx(va,{"aria-label":a("Credit Card Type","Tipo de tarjeta de crédito"),children:e.jsx(ja,{placeholder:a("Credit Card Type","Tipo de tarjeta de crédito")})}),e.jsxs(ya,{children:[e.jsx(Be,{value:"personal",children:a("Personal","Personal")}),e.jsx(Be,{value:"business",children:a("Business","Empresarial")})]})]}),e.jsx(Z,{placeholder:a("Notes (optional) — link, annual fee, etc.","Notas (opcional) — enlace, cuota anual, etc."),value:i,onChange:R=>N(R.target.value.slice(0,4e3)),maxLength:4e3}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(M,{variant:"ghost",size:"sm",onClick:()=>c(!1),disabled:S,children:a("Cancel","Cancelar")}
4),e.jsx(M,{variant:"gold",size:"sm",onClick:se,disabled:S,children:S?e.jsxs(e.Fragment,{children:[e.jsx(Ce,{className:"size-4 animate-spin"})," ",a("Sending…","Enviando…")]}):e.jsx(e.Fragment,{children:a("Submit request","Enviar solicitud")})})]})]})]})}function ts({card:a,benefits:n,setBenefits:x,aiLoading:t,onReimport:c,totalValue:d,welcomeRefreshing:C,onRetryWelcome:_}){const{t:r}=J(),u=(l,i)=>x(N=>N.map((S,P)=>P===l?{...S,...i}:S)),b=l=>x(i=>i.filter((N,S)=>S!==l)),{data:h,isLoading:y}=ie({queryKey:["welcome-offer",a.id],queryFn:async()=>{const{data:l}=await G.from("card_welcome_offers").select("*").eq("card_catalog_id",a.id).eq("is_active",!0).order("verified_at",{ascending:!1}).limit(1).maybeSingle();return l},refetchInterval:t?3e3:!1}),{data:q=[],isLoading:I}=ie({queryKey:["earning-rates",a.id],queryFn:async()=>{const{data:l}=await Na(G.from("card_earning_rates").select("category,multiplier,unit,reward_program,condition,portal,notes,is_default,display_order").eq("card_catalog_id",a.id)).order("is_default",{ascending:!1}).order("multiplier",{ascending:!1}).order("display_order",{ascending:!0});return l??[]},refetchInterval:t?3e3:!1}),f=Array.from(new Set(q.map(l=>l.reward_program).filter(Boolean)));return e.jsx(Ee,{children:e.jsxs(Ie,{className:"p-6 space-y-5",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-full max-w-[260px]",children:e.jsx(Oe,{issuer:a.issuer,name:a.name,network:a.network,colorHex:a.color_hex,annualFee:a.annual_fee,imageUrl:a.image_url,size:"sm"})})}),e.jsxs("h2",{className:"font-display text-platinum min-w-0 flex items-center justify-center gap-2",children:[e.jsx(Fe,{className:"size-5 text-gold shrink-0"}),e.jsx(ga,{text:`${r("Benefits for","Beneficios de")} ${Ue(a.issuer,a.name)}`,className:"font-display text-center flex-1",minPx:12,maxPx:28})]}),t?e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsxs("p",{className:"text-sm font-semibold text-gold/90 text-center",children:[r("AI is researching this card…","La IA está investigando esta tarjeta…")," ",n.length>0?`${n.length} ${r("found so far","encontrados hasta ahora")}`:""]}),e.jsxs(M,{variant:"outline",onClick:c,disabled:!0,className:"border-gold/60 bg-gradient-to-b from-gold/20 via-gold/10 to-gold/5 text-gold shadow-[0_2px_0_0_rgba(201,168,76,0.35),0_8px_24px_-8px_rgba(201,168,76,0.5),inset_0_1px_0_0_rgba(255,255,255,0.08)] hover:from-gold/30 hover:via-gold/15 active:translate-y-px",children:[e.jsx(Ce,{className:"size-4 animate-spin"}
4),r("Re-import Benefits with AI","Reimportar beneficios con IA")]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-center",children:e.jsxs("span",{className:"inline-flex flex-col items-center gap-0.5 rounded-2xl border border-gold/70 bg-gradient-to-br from-gold/25 via-gold/10 to-transparent px-5 py-2.5 shadow-[0_0_28px_-6px_rgba(201,168,76,0.65)] ring-1 ring-gold/40",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] uppercase tracking-[0.22em] text-gold font-semibold",children:[r("Est. savings / yr","Ahorro est. / año"),e.jsx(Re,{className:"text-gold/80 hover:text-gold",label:r("Estimated savings per year = the sum of the AI-estimated dollar value of every benefit you've selected for this card, projected over 12 months. Perqt analyzes your spend and typical redemption value for each benefit (credits, lounge access, points, status perks, etc.) to estimate how much you'd realistically save. Actual savings depend on how you use the card.","Ahorro estimado por año = la suma del valor en dólares estimado por la IA de cada beneficio que has seleccionado para esta tarjeta, proyectado a 12 meses. Perqt analiza tu gasto y el valor típico de canje de cada beneficio (créditos, acceso a salas VIP, puntos, beneficios de estatus, etc.) para estimar cuánto ahorrarías de forma realista. El ahorro real depende de cómo uses la tarjeta.")})]}),e.jsx("span",{className:"font-display text-3xl sm:text-4xl text-gold tabular-nums leading-none drop-shadow-[0_2px_18px_rgba(201,168,76,0.55)]",children:Y(d)})]})}),e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-sm font-medium text-titanium text-center",children:[n.filter(l=>l.selected).length," ",r("Benefits Selected","Beneficios seleccionados"),e.jsx(Re,{className:"text-titanium/80 hover:text-titanium",label:r("This counts how many benefits you've turned ON for this card. Only the benefits you select are included in your estimated annual savings.","Esto cuenta cuántos beneficios has activado para esta tarjeta. Solo los beneficios seleccionados se incluyen en tu ahorro anual estimado.")})]}),e.jsx(pa,{delayDuration:150,children:e.jsxs(Ne,{children:[e.jsx(ke,{asChild:!0,children:e.jsxs(M,{variant:"outline",onClick:c,className:"border-gold/60 bg-gradient-to-b from-gold/25 via-gold/10 to-gold/5 text-gold shadow-[0_2px_0_0_rgba(201,168,76,0.35),0_8px_24px_-8px_rgba(201,168,76,0.5),inset_0_1px_0_0_rgba(255,255,255,0.1)] hover:from-gold/35 hover:via-gold/20 hover:to-gold/10 hover:border-gold active:translate-y-px transition-all",children:[e.jsx(Fe,{className:"size-4"}
4),r("Re-import Benefits with AI","Reimportar beneficios con IA")]})}),e.jsx(_e,{side:"bottom",className:"max-w-[260px] text-center",children:r("Run a fresh AI search to pull the latest benefits, perks, and credits for this card — useful if the issuer recently updated them or you think something's missing.","Ejecuta una nueva búsqueda con IA para obtener los beneficios, ventajas y créditos más recientes de esta tarjeta — útil si el emisor los actualizó o crees que falta algo.")})]})})]})]})]}),e.jsxs("div",{className:"rounded-lg border border-gold/40 bg-gradient-to-br from-gold/10 to-transparent p-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 mb-2",children:[e.jsxs(Ne,{children:[e.jsx(ke,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-2 cursor-help min-w-0",children:[e.jsx(Ca,{className:"size-4 text-gold shrink-0"}),e.jsx("h3",{className:"text-sm font-bold uppercase tracking-wide text-gold truncate",children:r("Current welcome offer","Oferta de bienvenida actual")}),C&&e.jsx(Ce,{className:"size-3.5 text-gold/80 animate-spin shrink-0"})]})}),e.jsx(_e,{className:"w-[min(20rem,calc(100vw-1.5rem))] bg-card-elevated text-platinum border border-gold/40",children:r("Eligibility required: most issuers only award welcome bonuses to new cardmembers, or to those who haven't held this card (or one in its family) within a set period — typically 24–48 months. Check the issuer's terms before applying.","Sujeto a elegibilidad: la mayoría de los emisores s
4olo otorgan el bono de bienvenida a nuevos titulares, o a quienes no hayan tenido esta tarjeta (o una de su familia) en un período determinado, normalmente de 24 a 48 meses. Revisa los términos del emisor antes de solicitarla.")})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[h?.verified_at&&!C&&e.jsxs("span",{className:"text-[10px] uppercase tracking-wide text-titanium/70",children:[r("Updated","Actualizada")," ",Kt(h.verified_at,r)]}),e.jsxs("button",{type:"button",onClick:_,disabled:C,className:"inline-flex items-center gap-1.5 rounded-full border border-gold/60 bg-gradient-to-b from-gold/25 via-gold/10 to-gold/5 px-3 py-1 text-[11px] font-semibold uppercase tracking-wide text-gold shadow-[0_2px_0_0_rgba(201,168,76,0.35),0_6px_18px_-8px_rgba(201,168,76,0.5),inset_0_1px_0_0_rgba(255,255,255,0.08)] hover:from-gold/35 hover:via-gold/20 hover:to-gold/10 hover:border-gold active:translate-y-px disabled:opacity-50 disabled:cursor-not-allowed transition-all","aria-label":r("Refresh welcome offer","Actualizar oferta de bienvenida"),children:[e.jsx(gt,{className:`size-3.5 ${C?"animate-spin":""}`}),C?r("Refreshing…","Actualizando…"):r("Refresh","Actualizar")]})]})]}),y||t&&!h?e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 w-3/4 rounded bg-metallic/40 animate-pulse"}),e.jsx("div",{className:"h-3 w-1/2 rounded bg-metallic/30 animate-pulse"})]}):h?e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("p",{className:"text-platinum font-semibold",children:[h.bonus_amount?`${Number(h.bonus_amount).toLocaleString()} ${h.bonus_unit??r("points","puntos")} — `:"",h.bonus_description]}),e.jsxs("div",{className:"flex flex-wrap gap-2 text-xs text-titanium",children:[h.minimum_spend&&e.jsxs("span",{className:"rounded-full border border-metallic/60 px-2 py-0.5",children:[r("Spend","Gasta")," ",Y(Number(h.minimum_spend)),h.spend_window_months?` ${r("in","en")} ${h.spend_window_months} ${r("mo","meses")}`:""]}),h.estimated_value_usd&&e.jsxs("span",{className:"rounded-full border border-gold/50 px-2 py-0.5 text-gold",children:[Y(Number(h.estimated_value_usd))," ",r("value","valor")]}),h.first_year_fee_waived&&e.jsx("span",{className:"rounded-full border border-emerald-500/50 px-2 py-0.5 text-emerald-300",children:r("First-year fee waived","Cuota del primer año sin coste")}),h.expires_at&&e.jsxs("span",{className:"rounded-full border border-metallic/60 px-2 py-0.5",children:[r("Ends","Termina")," ",new Date(h.expires_at).toLocaleDateString()]})]}),h.offer_url&&e.jsx("a",{href:h.offer_url,target:"_blank",rel:"noopener noreferrer",className:"inline-block text-xs text-gold hover:underline",children:r("View offer details →","Ver detalles de la oferta →")})]}):e.jsx("p",{className:"text-xs text-titanium",children:r("No active welcome offer found for this card.","No se encontró ninguna oferta de bienvenida activa para esta tarjeta.")})]}),e.jsxs("div",{className:"rounded-lg border border-metallic bg-metallic/10 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(He,{className:"size-4 text-gold"}),e.jsx("h3",{className:"text-sm font-bold uppercase tracking-wide text-gold",children:r("Point earning rates","Tasas de acumulación de puntos")})]}),I||t&&q.length===0?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Array.from({length:4}).map((l,i)=>e.jsx("div",{className:"h-20 rounded-xl bg-metallic/40 animate-pulse"},i))}):e.jsx(ct,{catalogId:a.id,autoSeed:!1,emptyHint:r("No earning rates imported yet.","Aún no se han importado tasas de acumulación.")}),f.length>0&&e.jsxs("p",{className:"mt-3 text-[11px] uppercase tracking-wide text-titanium",children:[r("Program:","Programa:")," ",f.join(" · ")]})]}),t&&n.length>0&&e.jsx("div",{className:"h-1.5 rounded-full bg-gold/15 border border-gold/30 overflow-hidden",children:e.jsx("div",{className:"h-full bg-gold animate-pulse shadow-[0_0_12px_rgba(212,175,55,0.6)]",style:{width:"100%"}})}),t&&n.length===0?e.jsx("div",{className:"grid sm:grid-cols-2 gap-3",children:Array.from({length:4}).map((l,i)=>e.jsx("div",{className:"h-28 rounded-lg border border-metallic bg-metallic/30 animate-pulse"},i))}):e.jsx("div",{className:"space-y-2",children:n.map((l,i)=>
4e.jsx(ss,{benefit:l,onChange:N=>u(i,N),onRemove:()=>b(i)},i))})]})})}function ss({benefit:a,onChange:n,onRemove:x}){const{t}=J(),[c,d]=m.useState(!1),[C,_]=m.useState(!1),r=Number(a.dollar_value)||0,u=a.period_unit??(a.frequency==="annual"?"annual":a.frequency),b=a.period_amount!=null&&Number(a.period_amount)>0?Number(a.period_amount):r,h=u==="monthly"?b*12:u==="quarterly"?b*4:u==="semi_annual"?b*2:b,y=u==="one_time"?"":t("/yr","/año"),q=u==="monthly"?`${Y(b)}${t("/mo","/mes")}`:u==="quarterly"?`${Y(b)}${t("/qtr","/trim")}`:u==="semi_annual"?`${Y(b)}${t("/6 mo","/6 meses")}`:null;return e.jsxs("div",{className:F("rounded-lg border transition-colors",a.selected?"border-gold/50 bg-gold/5 shadow-[inset_0_0_0_1px_rgba(212,175,55,0.15)]":"border-metallic/40 bg-metallic/10 opacity-60"),children:[e.jsxs("div",{className:"flex items-center gap-2 p-3",children:[e.jsx("input",{type:"checkbox",checked:a.selected,onChange:I=>n({selected:I.target.checked}),onClick:I=>I.stopPropagation(),className:"accent-gold size-4 shrink-0","aria-label":t(`Include ${a.name}`,`Incluir ${a.name}`)}),e.jsxs("button",{type:"button",onClick:()=>d(I=>!I),className:"flex-1 min-w-0 flex items-center gap-2 text-left","aria-expanded":c,children:[a.name?e.jsx(ga,{text:a.name,className:"flex-1 min-w-0 font-medium text-platinum",minPx:10,maxPx:14}):e.jsx("span",{className:"flex-1 min-w-0 text-sm text-titanium italic",children:t("Unnamed benefit","Beneficio sin nombre")}),e.jsxs("span",{className:"font-mono text-xs tabular-nums text-gold font-bold shrink-0",children:[Y(h),y]}),e.jsx(Sa,{className:F("size-4 text-titanium shrink-0 transition-transform",c&&"rotate-180")})]})]}),c&&e.jsxs("div",{className:"border-t border-metallic/40 p-3 space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm font-semibold text-platinum break-words",children:a.name||e.jsx("span",{className:"text-titanium italic",children:t("Unnamed benefit","Beneficio sin nombre")})}),a.description&&e.jsx("p",{className:"text-xs text-titanium whitespace-pre-wrap break-words leading-relaxed",children:a.description})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx(pa,{delayDuration:150,children:e.jsxs(Ne,{open:C,onOpenChange:_,children:[e.jsx(ke,{asChild:!0,children:e.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),_(f=>!f)},className:"inline-flex items-center gap-1 text-[11px] font-bold uppercase tracking-wide text-gold/80 cursor-help underline decoration-dotted decoration-gold/40 underline-offset-2",children:[t("Value","Valor")," ",e.jsx(jt,{className:"size-3"})]})}),e.jsx(_e,{onPointerDownOutside:()=>_(!1),className:"w-[min(20rem,calc(100vw-1.5rem))] bg-card-elevated text-platinum border border-gold/40",children:t("This is Perqt's AI-estimated dollar savings value of this benefit. Perqt analyzes your spend and costs against the benefit's typical redemption value to estimate how much you are realistically saving. Actual savings and value depend on how you use the benefit.","Este es el valor de ahorro en dólares de este beneficio estimado por la IA de Perqt. Perqt analiza tu gasto y costes frente al valor típico de canje del beneficio para estimar cuánto estás ahorrando de forma realista. El ahorro y valor reales dependen del uso que le des.")})]})}),e.jsxs("div",{className:"text-platinum font-mono tabular-nums",children:[Y(h),y,q&&e.jsxs("span",{className:"text-titanium font-normal",children:[" (",q,")"]})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wide text-gold/80",children:t("Category","Categoría")}),e.jsx("div",{className:"text-platinum break-words",children:et(a.category)})]})]}),(a.partner||a.redemption)&&e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 text-xs",children:[a.partner&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wide text-gold/80",children:t("Partner / program","Socio / programa")}),e.jsx("div",{className:"text-platinum whitespace-pre-wrap break-words leading-relaxed",children:a.partner})]}),a.redemption&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wide text-gold/80",children:t("Redemption","Canje")}),e.jsx("div",{className:"text-platinum whitespace-pre-wrap break-words leading-relaxed",children:a.redemption})]})]})]})]})}function rs({card:a,nickname:n,setNickname:x,last4:t,setLast4:c,holderName:d,setHolderName:C,expMonth:_,setExpMonth:r,expYear:u,setExpYear:b,openedAt:h,setOpenedAt:y,openedUnknown:q,setOpenedUnknown:I,totalValue:f,benefitCount:l,plaidLink:i,plaidAccountId:N,onPlaidLinked:S,onPlaidAccount:P,onPlaidReset:ee,onPlaidStart:E,onPlaidExit:te}){const{t:p}=J(),T=f-Number(a.annual_fee),se=new Date().toISOString().slice(0,10),R=()=>{I(!1),y(se)},$=!q&&!h,B=(i?.accounts.find(w=>w.plaid_account_id===N)??null)?.opened_at??null,A=!!B&&h===B;m.useEffect(()=>{B&&(I(!1),y(B))},[B]);const j=a.issuer==="Coinbase"||a.issuer==="Gemini";return e.jsxs("div",{className:"grid md:grid-cols-[1fr_360px] gap-6",children:[e.jsx(Ee,{children:e.jsxs(Ie,{className:"p-6 space-y-4",children:[e.jsx("h2",{className:"font-display text-2xl text-platinum",children:p("Link this card to your wallet","Vincula esta tarjeta a tu cartera")}),j?e.jsx("div",{className:"rounded-lg border border-titanium/30 bg-titanium/5 p-3 text-xs text-titanium",children:p(`Heads up: ${a.issuer}
4's card coverage through our bank-link partner is inconsistent. If the card doesn't appear after linking, it can still be tracked — reach out and we'll set it up manually.`,`Aviso: la cobertura de la tarjeta de ${a.issuer} a través de nuestro socio de vinculación bancaria es inconsistente. Si la tarjeta no aparece después de vincular, aún se puede rastrear — contáctanos y la configuraremos manualmente.`)}):null,e.jsxs("p",{className:"text-sm text-titanium",children:[p("We only need a few cosmetic details to identify this card in your wallet.","Solo necesitamos algunos detalles cosméticos para identificar esta tarjeta en tu cartera."),e.jsxs("strong",{className:"text-platinum",children:[" ",p("We never ask for or store your full card number, CVC, or PIN","Nunca te pedimos ni almacenamos tu número de tarjeta completo, CVC o PIN")]})," —",p("transactions are pulled securely through your read-only issuer connection.","las transacciones se obtienen de forma segura mediante tu conexión de solo lectura con el emisor.")]}),e.jsxs("div",{className:`rounded-xl border p-4 space-y-4 ${i?"border-gold/40 bg-gold/5":"border-gold/60 bg-gold/5"}`,children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("p",{className:"text-sm font-semibold text-platinum flex flex-wrap items-center gap-2",children:[p("Connect your credit card via Plaid","Conecta tu tarjeta de crédito vía Plaid"),e.jsx("span",{className:"text-[10px] uppercase tracking-wider text-gold",children:p("Required","Obligatorio")})]}),e.jsx("p",{className:"text-xs text-titanium mt-0.5",children:i?p(`Linked to ${i.institution_name??"your bank"}. Pick the credit-card account for this Perqt card.`,`Vinculado a ${i.institution_name??"tu banco"}. Elige la cuenta de tarjeta de crédito para esta tarjeta Perqt.`):p("Perqt needs a live transaction feed to auto-match credits, calculate ROI, and recommend better cards. One secure connection takes about 20 seconds.","Perqt necesita un feed de transacciones en vivo para emparejar créditos, calcular el ROI y recomendar mejores tarjetas. Una conexión segura toma unos 20 segundos.")})]}),e.jsx("div",{className:"shrink-0 w-full sm:w-auto flex flex-col sm:flex-row items-start sm:items-center gap-2",children:i?e.jsx(M,{type:"button",variant:"ghost",size:"sm",onClick:ee,className:"w-full sm:w-auto whitespace-nowrap",children:p("Re-link","Re-vincular")}):e.jsxs(e.Fragment,{children:[e.jsx(dt,{onLinked:S,onStart:E,onExit:te,label:p("Link Card","Vincular tarjeta"),className:"w-full sm:w-auto whitespace-nowrap"}),e.jsxs(Ne,{children:[e.jsx(ke,{asChild:!0,children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] text-titanium/80 hover:text-gold transition-colors cursor-help",children:[e.jsx(ka,{className:"size-3.5 text-gold"}),p("No card number needed","Sin número de tarjeta")]})}),e.jsx(_e,{side:"top",className:"max-w-xs",children:p("You never type your full credit card number into Perqt. The secure connection is handled entirely by Plaid.","Nunca escribes tu número de tarjeta completo en Perqt. La conexión segura está gestionada completamente por Plaid.")})]})]})})]}),!i&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid sm:grid-cols-3 gap-3 pt-1",children:[e.jsxs("div",{className:"rounded-lg bg-onyx/40 border border-metallic/30 p-3.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wt,{className:"size-4 text-gold shrink-0"}),e.jsx("p",{className:"text-sm font-semibold text-foreground leading-tight",children:p("Auto-detect open date","Detecta fecha de apertura")})]}),e.jsx("p",{className:"text-xs text-titanium mt-1.5 leading-snug",children:p("We pull it from your issuer so you don't have to remember.","La obtenemos de tu emisor para que no tengas que recordarla.")})]}),e.jsxs("div",{className:"rounded-lg bg-onyx/40 border border-metallic/30 p-3.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(kt,{className:"size-4 text-gold shrink-0"}),e.jsx("p",{className:"text-sm font-semibold text-foreground leading-tight",children:p("Catch every credit","Captura cada crédito")})]}),e.jsx("p",{className:"text-xs text-titanium mt-1.5 leading-snug",children:p("Auto-match real transactions to benefits you'd otherwise miss.","Empareja transacciones reales con beneficios que de otro modo perderías.")})]}),e.jsxs("div",{className:"rounded-lg bg-onyx/40 border border-metallic/30 p-3.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(bt,{className:"size-4 text-gold shrink-0"}),e.jsx("p",{className:"text-sm font-semibold text-foreground leading-tight",children:p("Zero manual entry","Cero entrada manual")})]}),e.jsx("p",{className:"text-xs text-titanium mt-1.5 leading-snug",children:p("No typing receipts or tracking spend in a spreadsheet.","Sin escribir recibos ni rastrear gastos en una hoja de cálculo.")})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[11px] text-titanium pt-1 border-t border-metallic/20",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(_a,{className:"size-3 text-gold"}),p("Bank-level 256-bit encryption","Cifrado de nivel bancario de 256 bits")]}),e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(ce,{className:"size-3 text-gold"}),p("Read-only — we can't move money","Solo lectura — no podemos mover dinero")]}),e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(ce,{className:"size-3 text-gold"}),p("Powered by Plaid · used by Venmo, Robinhood, SoFi","Con tecnología Plaid · usado por Venmo, Robinhood, SoFi")]})]})]}),i&&i.accounts.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{children:p("Which account is this card?","¿Qué cuenta es esta tarjeta?")}),e.jsxs(ba,{value:N??"",onValueChange:P,children:[e.jsx(va,{children:e.jsx(ja,{placeholder:p("Choose account…","Elige cuenta…")})}),e.jsx(ya,{children:i.accounts.map(w=>e.jsxs(Be,{value:w.plaid_account_id,children:[w.name,w.mask?` •••• ${w.mask}`:"",w.subtype?` · ${w.subtype}`:""]},w.plaid_account_id))})]})]})]}),e.jsxs("div",{className:`space-y-2 rounded-xl border p-3 sm:p-4 overflow-hidden min-w-0 ${A?"border-emerald-500/40 bg-emerald-500/5":$?"border-gold/60 bg-gold/5":"border-metallic/40 bg-onyx/40"}`,children:[e.jsxs(oe,{htmlFor:"openedAt",className:"flex items-center gap-2",children:[p("When did you open this card?","¿Cuándo abriste esta tarjeta?"),A?e.jsxs("span",{className:"text-[10px] uppercase tracking-wider text-emerald-400 inline-flex items-center gap-1",children:[e.jsx(ce,{className:"size-3"})," ",p("Auto-filled from your bank","Rellenado desde tu banco")]}):e.jsx("span",{className:"text-[10px] uppercase tracking-wider text-gold",children:p("Required","Obligatorio")})]}),e.jsx("p",{className:"text-xs text-titanium",children:A?p("We pulled the origination date from your linked account. Adjust only if your issuer reported the wrong date.","Obtuvimos la fecha de apertura desde tu cuenta vinculada. Ajústala solo si tu emisor reportó una fecha incorrecta."):p("Your bank didn't share the origination date, so we need it from you. We use this to track welcome-bonus eligibility, prorate the annual fee, and set your renewal reminder.","Tu banco no compartió la fecha de apertura, así que la necesitamos. La usamos para rastrear el bono de bienvenida, prorratear la cuota anual y programar tu renovación.")}),e.jsx(Z,{id:"openedAt",type:"date",max:se,value:q?"":h,disabled:q,onCh
4ange:w=>{I(!1),y(w.target.value)},className:"w-full min-w-0 max-w-full block"}),!A&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[e.jsx(M,{type:"button",variant:"outline",size:"sm",onClick:R,children:p("I opened it today","La abrí hoy")}),e.jsx(M,{type:"button",variant:q?"default":"ghost",size:"sm",onClick:()=>{I(!q),q||y("")},children:p("I don't remember","No recuerdo")})]}),e.jsx("p",{className:"text-[11px] text-titanium pt-1",children:p("Tip: if you can't remember, your card's renewal/anniversary date works too — it's typically when the account was originally opened.","Consejo: si no la recuerdas, la fecha de aniversario/renovación funciona igual — suele ser la fecha original de apertura.")}),q&&e.jsx("p",{className:"text-[11px] text-gold/80",children:p("We'll use today's date for now. You can correct it anytime from the card's detail page — welcome-bonus tracking will be off until you do.","Usaremos la fecha de hoy por ahora. Puedes corregirla en cualquier momento desde la página de detalle de la tarjeta — el seguimiento del bono de bienvenida estará desfasado hasta que lo hagas.")})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"holder",children:p("Name on card","Nombre en la tarjeta")}),e.jsx(Z,{id:"holder",value:d,onChange:w=>C(w.target.value.toUpperCase().slice(0,30)),placeholder:p("JANE A. DOE","JUAN A. PÉREZ"),autoComplete:"cc-name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"last4",children:p("Last 4 digits","Últimos 4 dígitos")}),e.jsx(Z,{id:"last4",value:t,onChange:w=>c(w.target.value.replace(/\D/g,"").slice(0,4)),onPaste:w=>{w.preventDefault(),c(w.clipboardData.getData("text").replace(/\D/g,"").slice(-4))},placeholder:"1234",inputMode:"numeric",className:"font-mono tracking-widest"}),e.jsx("p",{className:"text-[11px] font-bold uppercase tracking-wide text-gold/80",children:p("Helps you tell your cards apart. We never store the full number.","Te ayuda a distinguir tus tarjetas. Nunca almacenamos el número completo.")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"expMonth",children:p("Exp. month","Mes venc.")}),e.jsx(Z,{id:"expMonth",value:_,onChange:w=>r(w.target.value.replace(/\D/g,"").slice(0,2)),onPaste:w=>{w.preventDefault(),r(w.clipboardData.getData("text").replace(/\D/g,"").slice(0,2))},placeholder:"MM",inputMode:"numeric",autoComplete:"cc-exp-month"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"expYear",children:p("Exp. year","Año venc.")}),e.jsx(Z,{id:"expYear",value:u,onChange:w=>b(w.target.value.replace(/\D/g,"").slice(0,4)),onPaste:w=>{w.preventDefault(),b(w.clipboardData.getData("text").replace(/\D/g,"").slice(0,4))},placeholder:p("YYYY","AAAA"),inputMode:"numeric",autoComplete:"cc-exp-year"})]})]}),e.jsxs("div",{className:"space-y-2 pt-2 border-t border-metallic/40",children:[e.jsx(oe,{htmlFor:"nickname",children:p("Nickname (optional)","Apodo (opcional)")}),e.jsx(Z,{id:"nickname",value:n,onChange:w=>x(w.target.value),placeholder:p("e.g. travel card","p. ej. tarjeta de viajes")})]})]})}),e.jsx(Ee,{children:e.jsxs(Ie,{className:"p-6 space-y-4",children:[e.jsx(Oe,{issuer:a.issuer,name:a.name,network:a.network,colorHex:a.color_hex,annualFee:a.annual_fee,imageUrl:a.image_url,nickname:n,last4:t,holderName:d,expMonth:_,expYear:u,size:"sm"}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsx(Pe,{label:p("Annual fee","Cuota anual"),value:Y(a.annual_fee)}),e.jsx(Pe,{label:p("Tracked benefits","Beneficios rastreados"),value:`${l}`}),e.jsxs("div",{className:"rounded-xl border border-gold/60 bg-gradient-to-br from-gold/20 via-gold/5 to-transparent px-3 py-2.5 shadow-[0_0_18px_-6px_rgba(201,168,76,0.5)] ring-1 ring-gold/30",children:[e.jsxs("p",{className:"inline-flex items-center gap-1 text-[10px] uppercase tracking-[0.22em] text-gold font-semibold",children:[p("Estimated savings / yr","Ahorro estimado / año"),e.jsx(Re,{className:"text-gold/80 hover:text-gold",label:p("Estimated savings per year = the sum of the AI-estimated dollar value of every benefit you've selected for this card, projected over 12 months. Perqt analyzes your spend and typical redemption value for each benefit (credits, lounge access, points, status perks, etc.) to estimate how much you'd realistically save. Actual savings depend on how you use the card.","Ahorro estimado por año = la suma del valor en dólares estimado por la IA de cada beneficio que has seleccionado para esta tarjeta, proyectado a 12 meses. Perqt analiza tu gasto y el valor típico de canje de cada beneficio (créditos, acceso a salas VIP, puntos, benef
4icios de estatus, etc.) para estimar cuánto ahorrarías. El ahorro real depende de cómo uses la tarjeta.")})]}),e.jsx("p",{className:"font-display text-2xl text-gold mt-0.5 tabular-nums drop-shadow-[0_2px_12px_rgba(201,168,76,0.35)]",children:Y(f)})]}),e.jsx(Pe,{label:p("Projected net","Neto proyectado"),value:(T>=0?"+":"")+Y(T),accent:T>=0?"gold":"destructive"})]})]})})]})}function Pe({label:a,value:n,accent:x}){return e.jsxs("div",{className:"flex items-center justify-between border-b border-metallic/40 pb-2 last:border-0",children:[e.jsx("span",{className:"text-titanium",children:a}),e.jsx("span",{className:F("font-medium",x==="gold"&&"text-gold",x==="destructive"&&"text-destructive"),children:n})]})}function ns({tier:a,used:n,limit:x,onBack:t}){const{t:c}=J(),d=Me(),{isAdmin:C}=st(),[_,r]=m.useState(!1);m.useEffect(()=>{typeof window>"u"||r(window.localStorage.getItem("viewAsNonAdmin")==="1")},[]);const u=()=>{typeof window<"u"&&window.localStorage.removeItem("viewAsNonAdmin"),r(!1),d.invalidateQueries({queryKey:["plan"]})},b=(()=>{const f=["free","starter","plus","pro"],l=f.indexOf(a);return l>=0&&l<f.length-1?f[l+1]:null})(),h={free:1,starter:2,plus:3,pro:null},y={free:"Standard",starter:"Starter",plus:"Plus",pro:"Pro"},q={free:"$0",starter:"$5.99/mo",plus:"$8.99/mo",pro:"$11.99/mo"},I=["starter","plus","pro"];return e.jsxs("div",{className:"max-w-2xl mx-auto px-6 py-12",children:[e.jsx("p",{className:"text-xs uppercase tracking-[0.2em] text-titanium",children:c("Add a card","Añadir tarjeta")}),C&&_&&e.jsxs("div",{"data-qa":"admin-preview-escape",className:"mt-4 rounded-2xl border border-amber-500/40 bg-amber-500/10 p-4 flex flex-col sm:flex-row sm:items-center gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-amber-200",children:c("Admin preview is on","La vista admin está activa")}),e.jsx("p",{className:"text-xs text-amber-200/80 mt-1",children:c("You're seeing what a standard member sees, so your wallet looks limited. Exit preview to restore full admin access.","Estás viendo lo que ve un miembro estándar, por eso tu cartera parece limitada. Sal de la vista previa para restaurar el acceso admin.")})]}),e.jsxs(M,{variant:"gold",size:"sm",className:"shrink-0",onClick:u,children:[e.jsx(ka,{className:"size-4"}),c("Exit admin preview","Salir de la vista admin")]})]}),e.jsxs("div",{className:"mt-6 relative overflow-hidden rounded-3xl border border-gold/30 bg-gradient-to-br from-gold/15 via-background to-background p-8 sm:p-10",children:[e.jsx("div",{className:"pointer-events-none absolute -top-24 -right-24 size-64 rounded-full bg-gold/20 blur-3xl"}),e.jsx("div",{className:"pointer-events-none absolute -bottom-32 -left-20 size-72 rounded-full bg-gold/10 blur-3xl"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"relative inline-flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 rounded-full bg-gold/30 blur-2xl"}),e.jsx("div",{className:"relative size-16 rounded-2xl border border-gold/50 bg-gradient-to-br from-gold/30 to-gold/5 flex items-center justify-center shadow-[0_0_40px_-8px_rgba(212,175,55,0.6)]",children:e.jsx(_a,{className:"size-7 text-gold"})})]}),e.jsx("h1",{className:"font-display text-3xl sm:text-4xl mt-6 leading-tight",children:c("You've maxed out your wallet","Has alcanzado el límite")}),e.jsx("p",{className:"text-titanium mt-2 text-sm sm:text-base max-w-md",children:c(`Your ${y[a]} plan includes ${x} ${x===1?"card":"cards"}. Upgrade to unlock more and earn every perk.`,`Tu plan ${y[a]} incluye ${x} ${x===1?"tarjeta":"tarjetas"}. Mejora para añadir más.`)}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-titanium mb-2",children:[e.jsx("span",{className:"uppercase tracking-[0.15em]",children:c("Cards used","Tarjetas")}),e.jsxs("span",{className:"font-medium text-foreground",children:[n," / ",x]})]}
4),e.jsx("div",{className:"h-2 rounded-full bg-foreground/10 overflow-hidden",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-gold to-gold/70 rounded-full transition-all",style:{width:"100%"}})})]}),b&&e.jsxs("div",{className:"mt-7 flex flex-col sm:flex-row gap-3",children:[e.jsx(M,{asChild:!0,variant:"gold",size:"lg",className:"shadow-[0_8px_32px_-8px_rgba(212,175,55,0.6)]",children:e.jsxs(ta,{to:"/billing",children:[e.jsx(Fe,{className:"size-4"}),c("Upgrade to Another Plan","Mejorar a otro plan"),e.jsxs("span",{className:"opacity-80 font-normal",children:["· ",q[b]]})]})}),e.jsxs(M,{variant:"ghost",size:"lg",onClick:t,children:[e.jsx(pt,{className:"size-4"}),c("Back to wallet","Volver a la cartera")]})]})]})]}),e.jsxs("div",{className:"mt-8",children:[e.jsx("p",{className:"text-xs uppercase tracking-[0.2em] text-titanium mb-3",children:c("Choose your plan","Elige tu plan")}),e.jsx("div",{className:"grid gap-3",children:I.map(f=>{const l=f===b,i=h[f];return e.jsxs(ta,{to:"/billing",className:F("group flex items-center justify-between rounded-2xl border p-4 transition-all",l?"border-gold/50 bg-gradient-to-r from-gold/10 to-transparent hover:border-gold/70":"border-metallic/30 bg-card-elevated hover:border-metallic/50"),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:F("size-10 rounded-xl flex items-center justify-center shrink-0",l?"bg-gold/20 text-gold":"bg-foreground
4/5 text-titanium"),children:f==="pro"?e.jsx(xt,{className:"size-5"}):e.jsx(He,{className:"size-5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-medium",children:y[f]}),l&&e.jsx("span",{className:"text-[10px] uppercase tracking-wider px-2 py-0.5 rounded-full bg-gold/20 text-gold border border-gold/30",children:c("Recommended","Recomendado")})]}),e.jsx("p",{className:"text-xs text-titanium mt-0.5",children:i===null?c("Unlimited cards","Tarjetas ilimitadas"):c(`Up to ${i} cards`,`Hasta ${i} tarjetas`)})]})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx("span",{className:"text-sm font-medium",children:q[f]}),e.jsx(fa,{className:"size-4 text-titanium group-hover:text-gold group-hover:translate-x-0.5 transition-all"})]})]},f)})})]})]})}export{mr as Route};

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.