1import{j as e,m as w}from"./vendor-motion-f-lEJJ3p.js";import{r as i}from"./vendor-charts-CR-R150p.js";import{s as y,C as p,d as b,ai as B,a5 as Y,B as A,a as V,n as O,aq as z,Y as R,af as D,E as G,h as C,F as $,a7 as J,a8 as K,a9 as X,aa as Q,ab as Z,U as ee,ac as se,aT as re,al as k,D as ae,S as te,aF as ie,aw as oe,au as ne}from"./index-BqVW9VJZ.js";import{u as le,a as de,b as ce,c as me,B as ue,C as xe,d as he,S as pe}from"./suggest-broker-modal-C7j8sJ9n.js";import{C as be}from"./credits-display-n9ZG3Sth.js";import{L as ge}from"./label-IxQBxpFl.js";import{C as fe}from"./clock-DlwmAbAs.js";import{C as E}from"./circle-x-zSy6SD8V.js";import{A as je}from"./arrow-down-BrFxI1Bq.js";import"./vendor-supabase-4ECGrJoe.js";import"./vendor-radix-2Gpnlba9.js";import"./index.esm--5c5AzQh.js";import"./zod-DjBgo8yk.js";import"./select-djCtWb6Y.js";import"./chevron-up-BJk5GoZd.js";import"./alert-C2aMsI4p.js";import"./table-CqAa5UOM.js";import"./format-BproCB3y.js";function ye(){const[a,l]=i.useState([]),[u,f]=i.useState(!0);i.useEffect(()=>{async function h(){const{data:r}=await y.auth.getUser();if(!r.user){f(!1);return}const{data:d,error:g}=await y.from("partner_credit_claims").select("broker_name, verified_at").eq("user_id",r.user.id).eq("status","approved");if(!g&&d){const c=new Map;d.forEach(n=>{c.has(n.broker_name)||c.set(n.broker_name,{broker_name:n.broker_name,approved_at:n.verified_at||""})}),l(Array.from(c.values()))}f(!1)}h()},[]);const x=h=>a.some(r=>r.broker_name===h),j=a.some(h=>h.broker_name.toLowerCase().startsWith("aimsfx"));return{memberships:a,loading:u,isMemberOf:x,isAimsfxMember:j}}function ve({memberships:a,loading:l}){return l?e.jsx(p,{className:"border-dashed",children:e.jsxs(b,{className:"pt-6 flex items-center gap-2 text-muted-foreground",children:[e.jsx(B,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{children:"Checking membership status..."})]})}):a.length===0?e.jsx(p,{className:"border-dashed",children:e.jsx(b,{className:"pt-6",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"You are not a WOBR Member Partner of any broker yet. Open an account through our referral links and claim your reward credits to become a member."})})}):e.jsx(p,{className:"border border-green-500/30 bg-green-500/5",children:e.jsx(b,{className:"pt-6",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{className:"h-5 w-5 text-green-500"}),e.jsx("span",{className:"font-semibold text-sm",children:"WOBR Member Partner"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:a.map(u=>e.jsxs(A,{variant:"secondary",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:["â ",u.broker_name]},u.broker_name))})]})})})}const S={pending:{label:"Pending Verification",color:"bg-amber-500/10 text-amber-400 border-amber-500/30",icon:fe},verified:{label:"Verified â",color:"bg-emerald-500/10 text-emerald-400 border-emerald-500/30",icon:re},rejected:{label:"Rejected",color:"bg-rose-500/10 text-rose-400 border-rose-500/30",icon:E},expired:{label:"Expired",color:"bg-slate-500/10 text-slate-400 border-slate-500/30",icon:E}};function Ne(){const{user:a}=V(),[l,u]=i.useState([]),[f,x]=i.useState({}),[j,h]=i.useState(!0),[r,d]=i.useState(null),[g,c]=i.useState(""),[n,v]=i.useState(!1);i.useEffect(()=>{let s=!1;return(async()=>{try{const[{data:t},{data:o}]=await Promise.all([y.from("broker_partners").select("slug, display_name, signup_url, bonus_credits, description, region, display_order, logo_url").eq("is_active",!0).order("display_order"),a!=null&&a.id?y.from("broker_bonus_claims").select("id, broker_slug, status, bonus_credits, awarded_at, rejected_reason").eq("user_id",a.id):Promise.resolve({data:[]})]);if(s)return;u(t??[]);const m={};(o??[]).forEach(N=>{m[N.broker_slug]=N}),x(m)}catch(t){console.error("Failed to load broker bonus:",t)}finally{s||h(!1)}})(),()=>{s=!0}},[a==null?void 0:a.id]);const _=async()=>{if(!(!(a!=null&&a.id)||!r)){if(g.trim().length<3){k.error("Please enter a valid account ID (at least 3 characters).");return}v(!0);try{const{data:s,error:t}=await y.from("broker_bonus_claims").insert({user_id:a.id,broker_slug:r.slug,broker_account_id:g.trim(),status:"pending",bonus_credits:r.bonus_credits}).select("id, broker_slug, status, bonus_credits, awarded_at, rejected_reason").single();if(t)if(t.code==="23505")k.error("You've already submitted a claim for this broker. Please wait for verification.");else throw t;else if(s){const o=s;x(m=>({...m,[o.broker_slug]:o})),k.success("Claim submitted! Verification typically takes 1â3 business days."),d(null),c("")}}catch(s){console.error("submit claim error:",s),k.error("Failed to submit claim. Please try again.")}finally{v(!1)}}};return j?e.jsx(p,{children:e.jsx(b,{className:"flex items-center justify-center py-12",children:e.jsx(B,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):l.length===0?null:e.jsxs(p,{className:"border-2 border-amber-500/40 shadow-lg shadow-amber-500/5 overflow-hidden",children:[e.jsx(O,{className:"bg-gradient-to-r from-amber-500/10 via-orange-500/10 to-transparent",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-xl bg-gradient-to-br from-amber-500 to-orange-600 flex items-center justify-center text-white shadow-lg",children:e.jsx(z,{className:"h-6 w-6"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs(R,{className:"text-xl flex items-center gap-2",children:["Broker Bonus â Open an A
1ccount, Earn Reward Credits",e.jsx(A,{variant:"outline",className:"text-[10px] border-amber-500/40 text-amber-400",children:"NEW"})]}),e.jsx(D,{className:"text-base",children:"Open a verified account with a supported broker â receive Reward Credits."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ð¹ð Open an account with a supported broker â receive Reward Credits right after verification (1â3 business days)"})]})]})}),e.jsxs(b,{className:"pt-6",children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:l.map(s=>{const t=f[s.slug],o=t==null?void 0:t.status,m=o?S[o].icon:null;return e.jsxs("div",{className:"border border-border rounded-xl p-4 bg-card/40 backdrop-blur space-y-3 hover:border-amber-500/40 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-base",children:s.display_name}),s.region&&e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:s.region})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Bonus"}),e.jsxs("div",{className:"font-bold text-amber-400 text-base flex items-center justify-end gap-1",children:[e.jsx(G,{className:"h-3.5 w-3.5"}),s.bonus_credits.toLocaleString()]})]})]}),s.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),o?e.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 rounded-lg border text-xs ${S[o].color}`,children:[m&&e.jsx(m,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"font-medium",children:S[o].label})]}):e.jsxs("div",{className:"flex gap-2",children:[e.jsx("a",{href:s.signup_url,target:"_blank",rel:"noopener noreferrer",className:"flex-1",children:e.jsxs(C,{variant:"outline",size:"sm",className:"w-full",children:[e.jsx($,{className:"h-3.5 w-3.5 mr-1.5"}),"Sign Up"]})}),e.jsx(C,{size:"sm",className:"flex-1 bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600",onClick:()=>d(s),children:"Claim"})]})]},s.slug)})}),e.jsx("p",{className:"text-[11px] text-muted-foreground/70 mt-5 text-center",children:"Bonus is paid as Reward Credits after broker confirms account opening. WOBR is not a broker."})]}),e.jsx(J,{open:!!r,onOpenChange:s=>!s&&d(null),children:e.jsxs(K,{children:[e.jsxs(X,{children:[e.jsxs(Q,{children:["Claim ",r==null?void 0:r.display_name," Bonus"]}),e.jsxs(Z,{children:["Enter your broker account ID. Your claim will be verified within 1â3 business days. Once verified, ",e.jsxs("span",{className:"text-amber-400 font-semibold",children:[r==null?void 0:r.bonus_credits.toLocaleString()," Reward Credits"]})," will be credited."]})]}),e.jsxs("div",{className:"space-y-2 py-2",children:[e.jsx(ge,{htmlFor:"account-id",children:"Broker Account ID"}),e.jsx(ee,{id:"account-id",value:g,onChange:s=>c(s.target.value),placeholder:"e.g. 123456789",autoComplete:"off"}),e.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["This is the account number provided by ",r==null?void 0:r.display_name," when you opened the account."]})]}),e.jsxs(se,{children:[e.jsx(C,{variant:"outline",onClick:()=>d(null),disabled:n,children:"Cancel"}),e.jsxs(C,{onClick:_,disabled:n,children:[n&&e.jsx(B,{className:"h-4 w-4 mr-2 animate-spin"}),"Submit Claim"]})]})]})})]})}const Fe=()=>{const[a,l]=i.useState(!1),{memberships:u,loading:f}=ye(),{brokers:x,isLoadingBrokers:j,fetchBrokers:h}=le(),{claimHistory:r,isLoadingHistory:d,fetchClaimHistory:g}=de(),{coreCredits:c,partnerCredits:n,updateCredits:v}=ce(),{searchTerm:_,setSearchTerm:s,isSearchFocused:t,setIsSearchFocused:o,filteredBrokers:m,selectedBroker:N,handleSelectBroker:M,handleClearSelection:W}=me(x),[P,I]=i.useState([]);i.useEffect(()=>{I(r)},[r]);const T=(L,H,F)=>{const q={id:`temp-${Date.now()}`,broker_name:L,port_number:H,status:"pending",credit_amount:F,claim_date:new Date().toISOString(),verified_at:null};I(U=>[q,...U]),setTimeout(()=>{g()},500)};return e.jsxs("div",{className:"container mx-auto py-6 space-y-8 max-w-7xl",children:[e.jsx(ae,{pageKey:"partners-member"}),e.jsxs(w.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-violet-600 via-indigo-600 to-blue-700 p-8 md:p-12 text-white",children:[e.jsxs("div",{className:"absolute inset-0 opacity-10",children:[e.jsx("div",{className:"absolute top-0 right-0 w-96 h-96 bg-white rounded-full blur-3xl -translate-y-1/2 translate-x-1/2"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-64 h-64 bg-white rounded-full blur-3xl translate-y-1/2 -translate-x-1/2"})]}),e.jsxs("div",{className:"relative z-10 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(te,{className:"h-6 w-6 text-yellow-300"}),e.jsx(A,{className:"bg-white/20 text-white border-white/30 hover:bg-white/30",children:"WOBR Credits Program"})]}),e.jsx("h1",{className:"text-3xl md:text-4xl font-bold",children:"WOBR Credits Program"}),e.jsx("p",{className:"text-white/80 text-lg max-w-2xl",children:"Earn WOBR Credits automatically from your trading activity. Redeem credits for courses, AI tools, and EA services on WOBR."}),e.jsx("p",{className:"text-white/70 text-base max-w-2xl",children:"Earn WOBR Credits from your trading volume and redeem them for discounts on courses, AI tools, and Bot Services across the platform."})]})]}),e.jsx(ve,{memberships:u,loading:f}),e.jsx(Ne,{}),e.jsx(p,{className:"bg-muted/40",children:e.jsx(b,{className:"pt-6",children:e.jsx(be,{coreCredits:c,partnerCredits:n,totalCredits:c+n,onCreditsUpdate:v})})}),e.jsx(w.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},children:e.jsxs(p,{className:"border-2 border-violet-500/50 shadow-lg shadow-violet-500/10",children:[e.jsx(O,{className:"bg-gradient-to-r from-violet-500/10 via-indigo-500/10 to-transparent pb-4",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-xl bg-gradient-to-br from-violet-500 to-indigo-600 flex items-center justify-center text-white font-bold text-xl shadow-lg",children:"1"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs(R,{className:"text-xl flex items-center gap-2",children:[e.jsx(ie,{className:"h-5 w-5 text-violet-500"}),"AI Broker Insights â Compare Brokers"]}),e.jsx(D,{className:"text-base",children:"Compare brokers using AI performance metrics and community data â for research and educational purposes only"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Compare brokers using AI scores and community data â for analysis and educational purposes only."})]})]})}),e.jsxs(b,{className:"pt-4",children:[e.jsx("div",{className:"mb-4 p-3 rounded-xl bg-gradient-to-r from-amber-500/10 via-orange-500/10 to-yellow-500/10 border border-amber-500/30",children:e.jsxs("p",{className:"text-sm font-medium text-amber-700 dark:text-amber-400 flex items-center gap-2",children:[e.jsx("span",{className:"text-lg",children:"ð"})," Browse brokers you're interested in"]})}),e.jsx(ue,{searchTerm:_,setSearchTerm:s,isSearchFocused:t,setIsSearchFocused:o,filteredBrokers:m,allBrokers:x,selectedBroker:N,handleSelectBroker:M,handleClearSelection:W,isLoadingBrokers:j,setShowSuggestionModal:l})]})]})}),e.jsx("div",{className:"flex justify-center",children:e.jsx(w.div,{animate:{y:[0,8,0]},transition:{repeat:1/0,duration:1.5},children:e.jsx(je,{className:"h-8 w-8 text-violet-500/60"})})}),e.jsx(w.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:e.jsxs(p,{className:"border-2 border-emerald-500/50 shadow-lg shadow-emerald-500/10 overflow-hidden",children:[e.jsx(O,{className:"bg-gradient-to-r from-emerald-500/10 via-green-500/10 to-transparent pb-4",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-xl bg-gradient-to-br from-emerald-500 to-green-600 flex items-center justify-center text-white font-bold text-xl shadow-lg",children:"2"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs(R,{className:"text-xl flex items-center gap-2",children:[e.jsx(oe,{className:"h-5 w-5 text-emerald-500"}),"Redeem Trading Credits â Convert Your Trading Volume"]}),e.jsx(D,{className:"text-base",children:"If you trade with one of our supported brokers, you may convert trading volume (lots) into WOBR Credits. Participation is optional."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"If you trade with a supported broker, you can convert your trading volume (lots) into WOBR Credits â participation is voluntary, with no requirement to open an account or deposit funds."})]})]})}),e.jsx(b,{className:"pt-4",children:e.jsx(xe,{onClaimSubmitted:T,brokers:x})}),e.jsxs(ne,{className:"bg-muted/30 flex-col items-start gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"ð Credits are verified based on trading volume with supported brokers. No deposit or account opening is required through WOBR."}
1),e.jsx("p",{className:"text-xs text-muted-foreground/70",children:"WOBR is not a broker and does not provide brokerage services. We provide AI tools, education, and analytics only."})]})]})}),e.jsx(he,{claims:P,isLoadingHistory:d}),e.jsx(pe,{isOpen:a,onClose:()=>l(!1)})]})};export{Fe as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.