1import{u as Q,a as G,r,s as x,j as e,D as J,a8 as K,B as u,o as X,z as Z,A as $,E as ee,aq as se,F as te,k as p,T as ae,q as re,t as le,v as ie,w as ne,x as oe,C as i,b as o,p as ce,h as de,d as T,aC as me,a1 as xe,ah as ue,l as h}from"./index-B4uU8uFL.js";import{T as pe,a as he,b as f,c as g}from"./tabs-CTzU9D1Y.js";import{H as fe,I as ge}from"./HomeHeader-C5Jr0K4-.js";import{B as je}from"./BackToFeed-DDvYO2kb.js";import{T as Ne,P as be,v as ve}from"./TaxIdentityForm-BUecIyYX.js";import{L as j}from"./link-2-6IY4efam.js";import{M as k}from"./mouse-pointer-click-BrLNpVKh.js";import{I as ye}from"./indian-rupee-DsDBf9qR.js";import"./ShareAppDialog-D65xZIm9.js";import"./circle-check-big-dNRec2pf.js";import"./shield-BFRAXl0i.js";import"./shield-alert-GCl78zLm.js";import"./bell-DLABeHUL.js";import"./user-BTruzePb.js";import"./bot-BZbXnPVY.js";import"./flame-BPvqj8Sm.js";import"./user-plus-CkAcFUUj.js";import"./store-Bb091AsP.js";import"./wallet-DCQmgPcG.js";import"./gauge-B1G2_uxB.js";import"./chart-column-DpOgq9No.js";import"./badge-check-DDoEjv-a.js";import"./database-BxtL3cor.js";import"./radio-B-0D8lYy.js";import"./clipboard-list-w0knwEbQ.js";import"./activity-D-Da8pKM.js";import"./megaphone-CAye8W5w.js";import"./package-BjstwNy4.js";import"./arrow-left-BVyl_oZu.js";import"./checkbox-X_0SxdwM.js";const Se=["general","tech","fashion","beauty","fitness","food","travel","gaming","finance","education"],a={creatorShare:75,platformShare:25,settlementTime:"12:00 PM daily",minPayout:500,description:"All affiliate commissions are credited to DilTube's central account. Registered creators receive their 75% share settlement before 12:00 PM daily (for previous day's confirmed clicks). Minimum payout: â¹500."},es=()=>{const{user:c}=Q(),z=G(),[A,L]=r.useState([]),[t,R]=r.useState(null),[D,I]=r.useState(!0),[m,E]=r.useState(""),[M,N]=r.useState(!1),[d,B]=r.useState(""),[b,F]=r.useState(""),[v,H]=r.useState("general"),[y,q]=r.useState(""),[S,C]=r.useState(!1),[l,Y]=r.useState({gstin:"",pan_number:"",state_code:"",consent:!1});r.useEffect(()=>{w()},[c]);const w=async()=>{const[s,n]=await Promise.all([x.from("partner_affiliate_creators").select("*").eq("is_active",!0).order("total_clicks",{ascending:!1}),c?x.from("partner_affiliate_creators").select("*").eq("owner_id",c.id).maybeSingle():Promise.resolve({data:null})]);L(s.data||[]),R(n.data),I(!1)},O=async()=>{if(!c||!d.trim())return;const s=ve(l);if(s)return h.error(s);C(!0);const{error:n}=await x.from("partner_affiliate_creators").insert({owner_id:c.id,name:d.trim(),description:b.trim(),niche:v,website_url:y.trim()||null,gstin:l.gstin||null,pan_number:l.pan_number||null,state_code:l.state_code||null,tax_consent_at:(l.gstin||l.pan_number)&&l.consent?new Date().toISOString():null});n?h.error(n.message):(h.success("Registered as Partner AffiliatePlus creator!"),N(!1),w()),C(!1)},P=A.filter(s=>!m||s.name.toLowerCase().includes(m.toLowerCase())),U=(t==null?void 0:t.total_clicks)||0,_=Number((t==null?void 0:t.total_earnings)||0),V=_*(a.creatorShare/100),W=_*(a.platformShare/100);return e.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[e.jsx(fe,{}),e.jsxs("main",{className:"flex-1 max-w-6xl mx-auto w-full px-4 py-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx(je,{}),e.jsxs("h1",{className:"text-xl font-bold text-foreground flex items-center gap-2",children:[e.jsx(j,{className:"text-primary",size:24})," Partner AffiliatePlus"]}),!t&&e.jsxs(J,{open:M,onOpenChange:N,children:[e.jsx(K,{asChild:!0,children:e.jsxs(u,{size:"sm",children:[e.jsx(X,{size:14,className:"mr-1"})," Register as Creator"]})}),e.jsxs(Z,{children:[e.jsxs($,{children:[e.jsx(ee,{children:"Register as AffiliatePlus Creator"}),e.jsx(se,{children:"Join the official Partner AffiliatePlus program and earn 75% of every commission."})]}),e.jsx(te,{className:"max-h-[60vh] pr-3",children:e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsx(p,{placeholder:"Creator / brand name *",value:d,onChange:s=>B(s.target.value)}),e.jsx(ae,{placeholder:"What do you promote? Audience, niche, style...",value:b,onChange:s=>F(s.target.value)}),e.jsxs(re,{value:v,onValueChange:H,children:[e.jsx(le,{children:e.jsx(ie,{})}),e.jsx(ne,{children:Se.map(s=>e.jsx(oe,{value:s,children:s.charAt(0).toUpperCase()+s.slice(1)},s))})]}),e.jsx(p,{placeholder:"Website / channel URL (optional)",value:y,onChange:s=>q(s.target.value)}
1),e.jsx(Ne,{value:l,onChange:Y,compact:!0}),e.jsxs("div",{className:"p-3 bg-muted rounded-lg space-y-2",children:[e.jsxs("p",{className:"text-sm font-semibold text-foreground flex items-center gap-1",children:[e.jsx(be,{size:14})," Revenue Sharing Policy"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 text-center p-2 bg-card rounded border border-border",children:[e.jsxs("p",{className:"text-lg font-bold text-primary",children:[a.creatorShare,"%"]}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Your Share"})]}),e.jsxs("div",{className:"flex-1 text-center p-2 bg-card rounded border border-border",children:[e.jsxs("p",{className:"text-lg font-bold text-muted-foreground",children:[a.platformShare,"%"]}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Platform Fee"})]})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a.description})]}),e.jsx(u,{className:"w-full",onClick:O,disabled:S||!d.trim(),children:S?"Registering...":"Register & Accept Terms"})]})})]})]})]}),e.jsx(i,{className:"bg-primary/5 border-primary/20",children:e.jsx(o,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ge,{size:18,className:"text-primary shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("p",{className:"font-semibold text-foreground mb-1",children:["Revenue Sharing: ",a.creatorShare,"% Creator / ",a.platformShare,"% DilTube"]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Commissions settle daily before ",a.settlementTime,". Min payout: â¹",a.minPayout,"."]})]})]})})}),e.jsxs(pe,{defaultValue:t?"my-profile":"browse",children:[e.jsxs(he,{className:"w-full",children:[e.jsx(f,{value:"browse",className:"flex-1",children:"Browse Creators"}),t&&e.jsx(f,{value:"my-profile",className:"flex-1",children:"My Profile"}),t&&e.jsx(f,{value:"earnings",className:"flex-1",children:"Earnings"})]}),e.jsxs(g,{value:"browse",className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(ce,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",size:16}),e.jsx(p,{placeholder:"Search creators...",className:"pl-9",value:m,onChange:s=>E(s.target.value)})]}),D?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(de,{className:"animate-spin text-primary"})}):P.length===0?e.jsx(i,{className:"p-8 text-center text-sm text-muted-foreground",children:"No creators registered yet. Be the first!"}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:P.map(s=>{var n;return e.jsx(i,{className:"hover:shadow-md transition-shadow",children:e.jsxs(o,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center",children:e.jsx(j,{size:22,className:"text-primary"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm text-foreground truncate",children:s.name}),e.jsx(T,{variant:"outline",className:"text-[10px]",children:s.niche})]})]}),s.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-2 line-clamp-2",children:s.description}),e.jsxs("div",{className:"flex items-center gap-3 mt-3 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(me,{size:12,className:"text-amber-500"})," ",Number(s.rating||0).toFixed(1)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(k,{size:12})," ",((n=s.total_clicks)==null?void 0:n.toLocaleString())||0," clicks"]})]})]})},s.id)})})]}),t&&e.jsx(g,{value:"my-profile",className:"mt-4",children:e.jsx(i,{children:e.jsxs(o,{className:"p-6 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-16 h-16 rounded-xl bg-primary/10 flex items-center justify-center",children:e.jsx(j,{size:30,className:"text-primary"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-foreground",children:t.name}),e.jsx(T,{variant:"outline",children:t.niche})]})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),t.website_url&&e.jsx("a",{href:t.website_url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline",children:t.website_url}),e.jsx(u,{className:"w-full",onClick:()=>z("/affiliate"),children:"Go to AffiliatePlus to start tagging"})]})})}),t&&e.jsxs(g,{value:"earnings",className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsx(i,{children:e.jsxs(o,{className:"p-4 text-center",children:[e.jsx(k,{size:18,className:"mx-auto text-primary mb-1"}),e.jsx("p",{className:"text-xl font-bold text-foreground",children:U.toLocaleStr
1ing()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Clicks"})]})}),e.jsx(i,{children:e.jsxs(o,{className:"p-4 text-center",children:[e.jsx(xe,{size:18,className:"mx-auto text-emerald-500 mb-1"}),e.jsxs("p",{className:"text-xl font-bold text-emerald-600",children:["â¹",V.toLocaleString()]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Your Earnings (",a.creatorShare,"%)"]})]})}),e.jsx(i,{children:e.jsxs(o,{className:"p-4 text-center",children:[e.jsx(ye,{size:18,className:"mx-auto text-muted-foreground mb-1"}),e.jsxs("p",{className:"text-xl font-bold text-muted-foreground",children:["â¹",W.toLocaleString()]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Platform Fee (",a.platformShare,"%)"]})]})})]}),e.jsx(i,{children:e.jsxs(o,{className:"p-4 space-y-2 text-sm",children:[e.jsxs("h3",{className:"font-semibold text-foreground flex items-center gap-2",children:[e.jsx(ue,{size:16})," Settlement Schedule"]}),e.jsxs("div",{className:"flex justify-between p-2 bg-muted rounded",children:[e.jsx("span",{className:"text-muted-foreground",children:"Settlement Time"}),e.jsx("span",{className:"font-medium text-foreground",children:"Before 12:00 PM daily"})]}),e.jsxs("div",{className:"flex justify-between p-2 bg-muted rounded",children:[e.jsx("span",{className:"text-muted-foreground",children:"Minimum Payout"}),e.jsxs("span",{className:"font-medium text-foreground",children:["â¹",a.minPayout]})]}),e.jsxs("div",{className:"flex justify-between p-2 bg-muted rounded",children:[e.jsx("span",{className:"text-muted-foreground",children:"Your Share"}),e.jsxs("span",{className:"font-medium text-primary",children:[a.creatorShare,"%"]})]})]})})]})]})]})]})};export{es 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.