vendor: 9,318 bytes, line 1
1import{d as Dt,u as Yt,C as qt,a as Wt,o as Jt,w as Gt,c as l,h as s,e as t,f as v,g as y,F as c,p as dt,i,W as S,t as r,r as g,j as u,n as k,m as re,X as ie,x as d,_ as Qt,z as Je,y as de,b as n,k as A,v as $,$ as ut,q as ue,s as Ge,A as Kt,am as Xt}from"./aDqk-s0q.js";import{u as Zt}from"./BS1J8NmY.js";import{a as es}from"./DfCulfNa.js";const ts={class:"space-y-5"},ss={key:0,class:"bg-surface-container-lowest rounded-xl p-6 text-center"},as={key:0,class:"py-16 flex justify-center"},os={class:"rounded-2xl bg-gradient-to-br from-blue-50 to-indigo-50 border border-blue-200 p-6 text-center"},ns={key:0,class:"rounded-2xl border border-outline/30 bg-surface p-5 space-y-4"},ls=["disabled"],rs=["disabled"],is={label:"Banks"},ds=["value"],us={label:"E-Wallets"},cs=["value"],fs=["disabled"],ms=["disabled"],ps={key:1,class:"rounded-xl border border-red-200 bg-red-50 text-red-600 text-xs p-3 flex items-center gap-2"},bs=["disabled"],xs={key:0,class:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24"},vs=["disabled"],ys={class:"rounded-2xl bg-red-50 border border-red-200 p-8 text-center"},gs={class:"rounded-2xl bg-surface-variant border border-outline/30 p-8 text-center"},ks={class:"flex items-start justify-between gap-3"},_s={class:"text-sm text-on-surface-variant mt-0.5"},hs={class:"flex gap-2 flex-wrap"},ws=["onClick"],Cs={class:"material-symbols-outlined text-sm"},Ss={key:0,class:"space-y-4"},As={key:0,class:"py-8 flex justify-center"},Bs={key:1,class:"rounded-xl border border-amber-200 bg-amber-50 text-amber-700 text-xs p-3 flex items-center gap-2"},Ls={key:2,class:"grid grid-cols-2 gap-3"},Ts={class:"bg-surface-container-lowest rounded-2xl p-4 border border-outline/20"},Ps={class:"text-base font-bold text-primary"},Ms={class:"bg-surface-container-lowest rounded-2xl p-4 border border-outline/20"},js={class:"text-base font-bold text-green-600"},Fs={class:"bg-surface-container-lowest rounded-2xl p-4 border border-outline/20"},Ns={class:"text-base font-bold text-on-surface"},Es={key:0,class:"bg-surface-container-lowest rounded-2xl p-4 border border-outline/20"},Rs={class:"text-base font-bold text-amber-600"},Is={key:3,class:"rounded-xl bg-surface-container-lowest border border-outline/20 p-4"},$s={class:"flex items-center gap-2"},Os={class:"flex-1 text-xs text-primary font-medium bg-surface border border-outline/30 rounded-lg px-3 py-2 truncate"},Us={class:"material-symbols-outlined text-base"},Vs={class:"flex items-center justify-between bg-surface-container-lowest rounded-xl px-4 py-3 border border-outline/20"},zs={class:"text-sm font-bold text-on-surface"},Hs=["disabled"],Ds={key:4,class:"text-xs text-center text-on-surface-variant"},Ys={key:1,class:"space-y-3"},qs={class:"flex items-center justify-between"},Ws={class:"text-xs text-on-surface-variant"},Js={key:0,class:"py-8 flex justify-center"},Gs={key:1,class:"rounded-xl border border-amber-200 bg-amber-50 text-amber-700 text-xs p-3 flex items-center gap-2"},Qs={key:2,class:"py-12 text-center text-on-surface-variant"},Ks={key:3,class:"space-y-3"},Xs={class:"flex items-center gap-3 mb-3"},Zs=["src"],ea={key:1,class:"w-10 h-10 rounded-lg bg-surface-variant flex items-center justify-center shrink-0"},ta={class:"flex-1 min-w-0"},sa={class:"text-sm font-semibold text-on-surface truncate"},aa={class:"flex items-center gap-1.5 mt-0.5"},oa={key:0,class:"text-[10px] font-bold bg-blue-100 text-blue-700 px-2 py-0.5 rounded-full"},na={key:1,class:"text-[10px] font-bold bg-surface-variant text-on-surface-variant px-2 py-0.5 rounded-full"},la={class:"flex items-center gap-2 mb-3"},ra={class:"flex-1 text-xs text-primary font-medium bg-surface border border-outline/30 rounded-lg px-3 py-2 truncate"},ia=["onClick"],da={class:"material-symbols-outlined text-base"},ua={class:"flex items-center gap-3 text-xs text-on-surface-variant mb-3"},ca={class:"flex items-center gap-1"},fa={class:"flex items-center gap-1"},ma={class:"flex items-center gap-1"},pa={class:"flex items-center gap-2"},ba=["onClick"],xa=["onClick","disabled"],va={key:0,class:"w-3.5 h-3.5 animate-spin",fill:"none",viewBox:"0 0 24 24"},ya={key:1,class:"material-symbols-outlined text-sm",style:{"font-variation-settings":"'FILL' 1"}},ga={key:2,class:"space-y-4"},ka={key:0,class:"py-8 flex justify-center"},_a={key:1,class:"rounded-xl border border-amber-200 bg-amber-50 text-amber-700 text-xs p-3 flex items-center gap-2"},ha={key:0,class:"space-y-3"},wa={class:"flex items-center gap-2 mb-3"},Ca={class:"text-sm font-bold text-on-surface font-mono"},Sa={key:0,class:"text-[10px] font-bold uppercase bg-surface-variant text-on-surface-variant px-2 py-0.5 rounded-full"},Aa={key:1,class:"ml-auto text-[10px] font-bold bg-green-100 text-green-700 px-2 py-0.5 rounded-full"},Ba={class:"flex items-center gap-2"},La={class:"flex-1 text-xs text-on-surface-variant bg-surface border border-outline/30 rounded-lg px-3 py-2 truncate"},Ta={class:"font-mono font-bold text-primary"},Pa=["onClick"],Ma={class:"material-symbols-outlined text-base"},ja={class:"space-y-3"},Fa={key:0,class:"py-12 text-center text-on-surface-variant"},Na={key:1,class:"space-y-3"},Ea={class:"flex items-start gap-3 mb-3"},Ra={class:"flex-1 min-w-0"},Ia={class:"text-sm font-semibold text-on-surface truncate"},$a={class:"flex items-center gap-1.5 mt-0.5 flex-wrap"},Oa={class:"text-[10px] font-bold bg-green-100 text-green-700 px-2 py-0.5 rounded-full"},Ua={class:"text-[10px] font-bold bg-amber-100 text-amber-700 px-2 py-0.5 rounded-full"},Va={key:0,class:"text-xs text-on-surface-variant mb-3"},za={class:"flex items-center justify-between"},Ha={key:0,class:"text-xs text-on-surface-variant"},Da={key:1,class:"text-xs text-on-surface-variant"},Ya=["onClick","disabled"],qa={key:3,class:"space-y-3"},Wa={class:"flex gap-2 flex-wrap"},Ja=["onClick"],Ga={key:0,class:"py-8 flex justify-center"},Qa={key:1,class:"rounded-xl border border-amber-200 bg-amber-50 text-amber-700 text-xs p-3 flex items-center gap-2"},Ka={key:2,class:"py-12 text-center text-on-surface-variant"},Xa={key:3,class:"space-y-3"},Za={class:"bg-surface-variant"},eo=["src","alt"],to={key:1,class:"px-4 py-5 text-sm text-on-surface-variant italic"},so={class:"p-3"},ao={class:"text-xs font-bold text-on-surface"},oo={key:0,class:"text-xs text-on-surface-variant mt-0.5"},no={class:"flex gap-2 mt-2"},lo=["onClick"],ro={class:"material-symbols-outlined text-sm"},io=["onClick"],uo={class:"material-symbols-outlined text-sm"},co={key:4,class:"space-y-3"},fo={class:"flex gap-2 flex-wrap"},mo=["onClick"],po={key:0,class:"py-8 flex justify-center"},bo={key:1,class:"rounded-xl border border-amber-200 bg-amber-50 text-amber-700 text-xs p-3 flex items-center gap-2"},xo={key:2,class:"py-12 text-center text-on-surface-variant"},vo={key:3,class:"space-y-2"},yo={class:"flex items-center gap-2"},go={class:"flex items-center text-xs text-on-surface-variant"},ko={class:"font-semibold text-on-surface"},_o={class:"ml-auto"},ho={class:"flex items-center text-xs gap-3"},wo={class:"font-semibold text-on-surface"},Co={class:"font-bold text-green-600"},So={key:0,class:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24"},Ao={key:5,class:"space-y-3"},Bo={class:"flex items-center justify-between"},Lo={class:"text-xs text-on-surface-variant"},To={key:0,class:"py-8 flex justify-center"},Po={key:1,class:"rounded-xl border border-amber-200 bg-amber-50 text-amber-700 text-xs p-3 flex items-center gap-2"},Mo={key:2,class:"py-12 text-center text-on-surface-variant"},jo={key:3,class:"space-y-2"},Fo={class:"flex items-start gap-3 mb-3"},No={class:"flex-1 min-w-0"},Eo={class:"text-sm font-bold text-on-surface"},Ro={class:"text-xs text-on-surface-variant font-mono mt-0.5"},Io={class:"text-xs text-on-surface-variant mt-0.5"},$o={key:0,class:"text-[10px] font-bold uppercase bg-green-100 text-green-700 px-2 py-0.5 rounded-full shrink-0"},Oo={class:"flex items-center gap-2"},Uo=["onClick"],Vo=["onClick"],zo={key:6,class:"rounded-xl border border-red-200 bg-red-50 text-red-600 text-xs p-3 flex items-center gap-2"},Ho={key:0,class:"w-full max-w-lg bg-surface rounded-t-2xl px-5 pt-3 pb-10 max-h-[85vh] overflow-y-auto"},Do={class:"flex items-start gap-3 mb-5"},Yo={class:"space-y-3 mb-5"},qo={class:"flex items-center justify-between text-sm py-2 border-b border-outline/10"},Wo={class:"text-on-surface"},Jo={key:0,class:"flex items-center justify-between text-sm py-2 border-b border-outline/10"},Go={class:"text-on-surface"},Qo={key:0,class:"rounded-xl border border-red-200 bg-red-50 text-red-600 text-xs p-3 mb-3 flex items-center gap-2"},Ko={key:1,class:"rounded-xl border border-green-200 bg-green-50 text-green-700 text-xs p-3 mb-3 flex items-center gap-2"},Xo={class:"space-y-2"},Zo=["disabled"],en=["disabled"],tn={key:0,class:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24"},sn={key:0,class:"w-full max-w-lg bg-surface rounded-t-2xl px-5 pt-3 pb-10 max-h-[85vh] overflow-y-auto"},an={class:"space-y-3 mb-5"},on={key:0,class:"py-6 flex justify-center"},nn={key:1,class:"py-8 text-center text-on-surface-variant"},ln={key:2,class:"space-y-2"},rn=["onClick"],dn=["src"],un={key:1,class:"w-10 h-10 rounded-lg bg-surface-variant flex items-center justify-center shrink-0"},cn={class:"flex-1 min-w-0"},fn={class:"text-sm font-semibold text-on-surface truncate"},mn={class:"text-xs text-on-surface-variant"}
1,pn={key:2,class:"material-symbols-outlined text-primary text-xl shrink-0",style:{"font-variation-settings":"'FILL' 1"}},bn={key:3},xn=["disabled"],vn={key:4,class:"rounded-xl border border-red-200 bg-red-50 text-red-600 text-xs p-3 flex items-center gap-2"},yn={class:"space-y-2"},gn=["disabled"],kn=["disabled"],_n={key:0,class:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24"},hn={key:0,class:"w-full max-w-lg bg-surface rounded-t-2xl px-5 pt-3 pb-10 max-h-[85vh] overflow-y-auto"},wn={class:"flex items-start gap-3 mb-5"},Cn={class:"text-xs text-on-surface-variant mt-0.5"},Sn={class:"rounded-xl border border-green-200 bg-green-50 text-green-700 text-xs p-3 mb-4 flex items-center gap-2"},An={class:"font-mono"},Bn={class:"flex items-center gap-2 mb-5"},Ln={class:"flex-1 text-xs text-on-surface-variant bg-surface border border-outline/30 rounded-lg px-3 py-2 truncate"},Tn={class:"font-mono font-bold text-primary"},Pn={class:"material-symbols-outlined text-base"},Mn={class:"space-y-3 mb-5"},jn={class:"flex items-center gap-1.5 flex-wrap"},Fn={class:"text-[10px] font-bold bg-green-100 text-green-700 px-2 py-0.5 rounded-full"},Nn={class:"text-[10px] font-bold bg-amber-100 text-amber-700 px-2 py-0.5 rounded-full"},En=["disabled"],Rn={class:"text-xs text-on-surface-variant mt-1"},In={class:"font-mono"},$n={key:0,class:"rounded-xl border border-red-200 bg-red-50 text-red-600 text-xs p-3 flex items-center gap-2"},On={class:"space-y-2"},Un=["disabled"],Vn=["disabled"],zn={key:0,class:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24"},Hn={key:0,class:"w-full max-w-lg bg-surface rounded-t-2xl px-5 pt-3 pb-10"},Dn={class:"flex items-start gap-3 mb-5"},Yn={class:"flex flex-col items-center py-4 gap-3"},qn={key:0,class:"w-6 h-6 animate-spin text-primary",fill:"none",viewBox:"0 0 24 24"},Wn=["src"],Jn={class:"text-xs text-on-surface-variant text-center break-all"},Gn={key:0,class:"w-full max-w-lg bg-surface rounded-t-2xl px-5 pt-3 pb-10 max-h-[85vh] overflow-y-auto"},Qn={class:"space-y-4 mb-5"},Kn=["disabled"],Xn={label:"Banks"},Zn=["value"],el={label:"E-Wallets"},tl=["value"],sl=["disabled"],al=["disabled"],ol={class:"flex items-center gap-2 cursor-pointer"},nl=["disabled"],ll={key:0,class:"rounded-xl border border-red-200 bg-red-50 text-red-600 text-xs p-3 flex items-center gap-2"},rl={class:"space-y-2"},il=["disabled"],dl=["disabled"],ul={key:0,class:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24"},ct=20,bl=Dt({__name:"affiliate",setup(cl){Yt({title:"Affiliate · xquare hub"});const ft=Zt(),{isAuthenticated:ce}=qt(),mt=Wt(),Pe=es(),pt=[{value:"overview",label:"Overview",icon:"dashboard"},{value:"links",label:"Product Links",icon:"link"},{value:"vanity",label:"Vanity Codes",icon:"sell"},{value:"creatives",label:"Creatives",icon:"image"},{value:"referrals",label:"Referrals",icon:"bar_chart"},{value:"banks",label:"Bank Accounts",icon:"account_balance"}],bt=[{value:"",label:"All"},{value:"banner",label:"Banner"},{value:"image",label:"Image"},{value:"text",label:"Text"},{value:"video",label:"Video"}],xt=[{value:"",label:"All"},{value:"draft",label:"Pending"},{value:"unpaid",label:"Processing"},{value:"paid",label:"Paid"},{value:"rejected",label:"Rejected"}],vt={draft:"Pending",unpaid:"Processing",paid:"Paid",rejected:"Rejected"},Qe=[{code:"BCA",name:"Bank BCA"},{code:"MANDIRI",name:"Bank Mandiri"},{code:"BNI",name:"Bank BNI"},{code:"BRI",name:"Bank BRI"},{code:"CIMB",name:"CIMB Niaga"},{code:"DANAMON",name:"Bank Danamon"},{code:"PERMATA",name:"Bank Permata"},{code:"BTN",name:"Bank BTN"},{code:"BSI",name:"Bank BSI (Syariah)"},{code:"MAYBANK",name:"Maybank"},{code:"PANIN",name:"Bank Panin"},{code:"JENIUS",name:"Jenius (BTPN)"},{code:"NEO",name:"Bank Neo Commerce"},{code:"JAGO",name:"Bank Jago"},{code:"ALLO",name:"Allo Bank"}],Ke=[{code:"GOPAY",name:"GoPay"},{code:"OVO",name:"OVO"},{code:"DANA",name:"DANA"},{code:"LINKAJA",name:"LinkAja"},{code:"SHOPEEPAY",name:"ShopeePay"}],fe=d(!0),O=d(null),m=d(null),E=d("overview"),G=d(!1),M=d(!1),Q=d(null),f=Je({phone_number:"",bank_code:"",account_number:"",account_holder_name:""}),_=Je({total_earned:0,total_paid:0,available:0,pending:0}),me=d(!1),pe=d(null),U=d([]),be=d(!1),Me=d(!1),xe=d(null),ve=d(""),je=d(0),Xe=d(!1),j=d([]),Fe=d(!1),K=d(!1),B=d(!1),F=d(null),p=Je({bank_code:"",account_number:"",account_holder_name:"",is_primary:!1}),ye=d([]),Ne=d(!1),ge=d(null),ke=d(""),L=d(null),N=d([]),Ee=d(!1),_e=d(null),X=d(null),he=d(null),W=d(!1),Ze=d(""),we=d("");let Ce=null;async function yt(){return Ce||(Ce=await Xt(()=>import("./-PMJQafu.js").then(o=>o.b),[],import.meta.url)),Ce.default??Ce}const Z=d(!1),ee=d(""),Se=d([]),Re=d(!1),T=d(null),V=d(""),z=d(!1),R=d(null);let Ie=null;const H=d(!1),te=d(!1),se=d(null),ae=d(!1),Ae=d(!1),oe=d([]),$e=d(!1),Be=d(null),D=d(null),Le=d(!1),x=d(null),I=d(""),Y=d(!1),ne=d(null),P=d(null),et=de(()=>m.value?.slug?`${Pe.value}?ref=${m.value.slug}`:""),J=de(()=>j.value.find(o=>o.is_primary)??null),tt=de(()=>ke.value?ye.value.filter(o=>o.creative_type===ke.value):ye.value),q=de(()=>_.available),st=de(()=>oe.value.filter(o=>o.my_claim).map(o=>({...o.my_claim,offer:o})));
1function C(o){return"Rp "+Math.round(o||0).toLocaleString("id-ID")}function gt(o){return o?new Date(o).toLocaleDateString("id-ID",{day:"numeric",month:"short",year:"numeric"}):"â"}function Oe(o,e){return e==="flat"?C(o):`${o}%`}function kt(o){return{visit:"Visit",coupon:"Coupon",auto_referral:"Auto",customer_link:"Customer Link",manual:"Manual",campaign:"Campaign"}[o]||o}function at(o){return!o||o.length<=4?o:"â¢â¢â¢â¢"+o.slice(-4)}function _t(o){return`Use code ${o?.code||""} at checkout${Pe.value?` â ${Pe.value}`:""}`}function Ue(o){return o?o.discount_type==="percentage"&&o.discount_value!=null?`${o.discount_value}% off`:o.discount_type==="flat"&&o.discount_value!=null?`${C(o.discount_value)} off`:"Attribution only":""}async function b(o,e={}){return ft.commerceFetch(o,e)}async function Ve(){try{const o=await b("/store/affiliate/me");m.value=o?.affiliate??null}catch(o){o?.statusCode===404||o?.status===404?m.value=null:O.value="Failed to load affiliate profile."}finally{fe.value=!1}}async function ze(){me.value=!0,pe.value=null;try{const e=(await b("/store/affiliate/me/balance"))?.balance??{};_.total_earned=e.total_earned??0,_.total_paid=e.total_paid??0,_.available=e.available??0,_.pending=e.pending??0}catch(o){pe.value=o?.statusMessage||o?.data?.message||"Failed to load balance."}finally{me.value=!1}}async function He(o=!0){o&&(U.value=[],je.value=0,xe.value=null),be.value=o,Me.value=!o;try{const e=new URLSearchParams({limit:String(ct),offset:String(je.value)});ve.value&&e.set("status",ve.value);const a=(await b(`/store/affiliate/me/referrals?${e}`))?.referrals??[];o?U.value=a:U.value.push(...a),Xe.value=a.length===ct,je.value+=a.length}catch(e){xe.value=e?.statusMessage||e?.data?.message||"Failed to load referrals."}finally{be.value=!1,Me.value=!1}}function ht(){He(!1)}function wt(o){ve.value=o,He(!0)}async function le(){Fe.value=!0,F.value=null;try{const o=await b("/store/affiliate/me/bank-accounts");j.value=o?.bank_accounts??[]}catch(o){F.value=o?.statusMessage||o?.data?.message||"Failed to load bank accounts."}finally{Fe.value=!1}}async function Ct(o){E.value=o,o==="overview"&&!me.value&&ze(),o==="links"&&N.value.length===0&&De(),o==="vanity"&&oe.value.length===0&<(),o==="creatives"&&ye.value.length===0&&ot(),o==="referrals"&&U.value.length===0&&He(),o==="banks"&&j.value.length===0&&le()}async function ot(){Ne.value=!0,ge.value=null;try{const o=await b("/store/affiliate/me/creatives");ye.value=o?.creatives??[]}catch(o){ge.value=o?.statusMessage||o?.data?.message||"Failed to load creatives."}finally{Ne.value=!1}}function St(o){ke.value=o}async function At(o){try{await navigator.clipboard.writeText(o.tagged_url||o.url),L.value=o.id+":url",setTimeout(()=>{L.value===o.id+":url"&&(L.value=null)},2e3)}catch{}}async function Bt(o){try{await navigator.clipboard.writeText(o.affiliate_html||""),L.value=o.id+":html",setTimeout(()=>{L.value===o.id+":html"&&(L.value=null)},2e3)}catch{}}async function De(){Ee.value=!0,_e.value=null;try{const o=await b("/store/affiliate/me/product-links?limit=100");N.value=o?.product_links??[]}catch(o){_e.value=o?.statusMessage||o?.data?.message||"Failed to load product links."}finally{Ee.value=!1}}async function Lt(o){try{await navigator.clipboard.writeText(o.shareable_url),X.value=o.id,setTimeout(()=>{X.value===o.id&&(X.value=null)},2e3)}catch{}}async function Tt(o){he.value=o.id;try{const e=await b(`/store/affiliate/me/product-links/${o.id}`,{method:"PATCH",body:JSON.stringify({is_active:!o.is_active})}),h=N.value.findIndex(a=>a.id===o.id);h!==-1&&e?.product_link&&(N.value[h]={...N.value[h],...e.product_link})}catch(e){O.value=e?.statusMessage??e?.data?.message??"Failed to update link."}finally{he.value=null}}async function Pt(o){Ze.value=o.shareable_url,we.value="",W.value=!0;try{const e=await yt();we.value=await e.toDataURL(o.shareable_url,{width:240,margin:1})}catch{}}function Mt(){Z.value=!0,ee.value="",T.value=null,V.value="",R.value=null,Se.value=[],nt("")}function Ye(){z.value||(Z.value=!1)}function jt(){Ie&&clearTimeout(Ie),Ie=setTimeout(()=>nt(ee.value),300)}async function nt(o){Re.value=!0,R.value=null;try{const e=new URLSearchParams({limit:"20"});o&&e.set("q",o);const h=await b(`/store/affiliate/me/eligible-products?${e}`);Se.value=h?.products??[]}catch(e){R.value=e?.statusMessage||e?.data?.message||"Failed to search products."}finally{Re.value=!1}}async function Ft(){if(T.value){z.value=!0,R.value=null;try{const o={product_id:T.value.id};
1V.value?.trim()&&V.value.trim()!=="default"&&(o.label=V.value.trim()),await b("/store/affiliate/me/product-links",{method:"POST",body:JSON.stringify(o)}),Z.value=!1,await De()}catch(o){o?.data?.code==="link_exists"&&o?.data?.product_link?R.value=`Link already exists (${o.data.product_link.short_code}). Try a different label.`:R.value=o?.statusMessage??o?.data?.message??"Failed to create link."}finally{z.value=!1}}}async function lt(){$e.value=!0,Be.value=null;try{const o=await b("/store/affiliate/me/vanity-offers");oe.value=o?.vanity_offers??[]}catch(o){Be.value=o?.statusMessage||o?.data?.message||"Failed to load vanity offers."}finally{$e.value=!1}}function Nt(o){x.value=o,I.value=o?.code_rules?.prefix||"",ne.value=null,P.value=null,Le.value=!0}function Te(){Y.value||(Le.value=!1)}async function Et(){if(!(!x.value||!I.value.trim())){Y.value=!0,ne.value=null;try{const o=await b("/store/affiliate/me/vanity-claims",{method:"POST",body:JSON.stringify({offer_id:x.value.id,code:I.value.trim()})}),e=o?.vanity_claim??o;P.value=e,await lt()}catch(o){const e=o?.data?.code,h={missing_fields:"Please fill in all required fields.",not_approved:"Your affiliate account isn't approved yet.",offer_not_found:"This offer is no longer available.",offer_inactive:"This offer is no longer active.",offer_not_started:"This offer hasn't started yet.",offer_ended:"This offer has ended.",seller_cap_missing:"This offer isn't accepting claims right now.",seller_cap_unverifiable:"This offer isn't accepting claims right now.",already_claimed:"You've already claimed a code for this offer.",budget_exhausted:"This offer has reached its claim limit.",invalid_chars:"Use only letters and numbers in your code.",reserved_code:"That code is reserved and can't be used. Try another.",prefix_required:"Your code must start with the required prefix.",too_short:"That code is too short.",too_long:"That code is too long.",brand_impersonation:"That code looks like a brand name and can't be used.",code_taken:"That code is already taken. Try another.",promotion_create_failed:"Something went wrong creating your code. Try again.",link_insert_failed:"Something went wrong saving your co
1de. Try again.",claim_insert_failed:"Something went wrong saving your claim. Try again."};ne.value=e&&h[e]||o?.statusMessage||o?.data?.message||"Failed to claim code."}finally{Y.value=!1}}}async function rt(o){try{await navigator.clipboard.writeText(_t(o)),D.value=o.id??o.code,setTimeout(()=>{D.value===(o.id??o.code)&&(D.value=null)},2e3)}catch{}}function qe(){f.phone_number="",f.bank_code="",f.account_number="",f.account_holder_name="",Q.value=null}async function Rt(){if(f.phone_number){M.value=!0,Q.value=null;try{const o={phone_number:f.phone_number};f.bank_code&&f.account_number&&f.account_holder_name&&(o.bank_code=f.bank_code,o.account_number=f.account_number,o.account_holder_name=f.account_holder_name),await b("/store/affiliate/register",{method:"POST",body:JSON.stringify(o)}),G.value=!1,qe(),await Ve()}catch(o){if(o?.statusCode===409||o?.status===409){G.value=!1,qe(),await Ve();return}Q.value=o?.statusMessage??o?.data?.message??"Registration failed. Please try again."}finally{M.value=!1}}}function It(){p.bank_code="",p.account_number="",p.account_holder_name="",p.is_primary=j.value.length===0,F.value=null,K.value=!0}function We(){B.value||(K.value=!1)}async function $t(){B.value=!0,F.value=null;try{await b("/store/affiliate/me/bank-accounts",{method:"POST",body:JSON.stringify({...p})}),K.value=!1,await le()}catch(o){F.value=o?.statusMessage??o?.data?.message??"Failed to save account."}finally{B.value=!1}}async function Ot(o){try{await b(`/store/affiliate/me/bank-accounts/${o}`,{method:"PUT",body:JSON.stringify({is_primary:!0})}),await le()}catch(e){O.value=e?.statusMessage??e?.data?.message??"Failed to update account."}}async function Ut(o){if(confirm("Remove this bank account?"))try{await b(`/store/affiliate/me/bank-accounts/${o}`,{method:"DELETE"}),await le()}catch(e){O.value=e?.statusMessage??e?.data?.message??"Failed to delete account."}}function Vt(){se.value=null,ae.value=!1,H.value=!0}async function zt(){te.value=!0,se.value=null;try{await b("/store/affiliate/me/withdraw",{method:"POST"}),ae.value=!0,await ze(),setTimeout(()=>{H.value=!1,ae.value=!1},2e3)}catch(o){se.value=o?.statusMessage??o?.data?.message??"Withdrawal failed. Please try again."}finally{te.value=!1}}async function Ht(){try{await navigator.clipboard.writeText(et.value),Ae.value=!0,setTimeout(()=>{Ae.value=!1},2e3)}catch{}}async function it(){ce.value&&(m.value||!fe.value||(await Ve(),m.value?.status==="approved"&&(ze(),le(),De(),ot())))}return Jt(()=>{ce.value&&it()}),Gt(ce,o=>{o?it():(m.value=null,fe.value=!0,O.value=null,_.total_earned=0,_.total_paid=0,_.available=0,_.pending=0,U.value=[],j.value=[])}),(o,e)=>{const h=Qt;return n(),l("div",ts,[s(ce)?(n(),l(c,{key:1},[s(fe)?(n(),l("div",as,[...e[22]||(e[22]=[t("svg",{class:"w-7 h-7 animate-spin text-primary",fill:"none",viewBox:"0 0 24 24"},[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})],-1)])])):s(m)?s(m).status==="pending"?(n(),l(c,{key:2},[e[36]||(e[36]=dt('<header><h1 class="text-2xl font-extrabold font-headline tracking-tight text-on-surface">Affiliate Program</h1></header><div class="rounded-2xl bg-yellow-50 border border-yellow-200 p-8 text-center"><span class="material-symbols-outlined text-yellow-600 text-5xl block mb-3">hourglass_empty</span><p class="text-base font-bold text-on-surface mb-1">Application Under Review</p><p class="text-sm text-on-surface-variant">We've received your affiliate application and will review it within 1â3 business days. We'll notify you by email once approved.</p></div>',2))],64)):s(m).status==="rejected"?(n(),l(c,{key:3},[e[41]||(e[41]=t("header",null,[t("h1",{class:"text-2xl font-extrabold font-headline tracking-tight text-on-surface"},"Affiliate Program")],-1)),t("div",ys,[e[38]||(e[38]=t("span",{class:"material-symbols-outlined text-red-500 text-5xl block mb-3"},"cancel",-1)),e[39]||(e[39]=t("p",{class:"text-base font-bold text-on-surface mb-1"},"Application Not Approved",-1)),e[40]||(e[40]=t("p",{class:"text-sm text-on-surface-variant mb-4"},"Unfortunately your affiliate application was not approved at this time. Please contact our support team if you have questions.",-1)),v(h,{to:"/account",class:"inline-block px-5 py-2.5 rounded-xl border border-primary text-primary text-sm font-semibold"},{default:y(()=>
1[...e[37]||(e[37]=[i("Contact Support",-1)])]),_:1})])],64)):s(m).status==="suspended"?(n(),l(c,{key:4},[e[46]||(e[46]=t("header",null,[t("h1",{class:"text-2xl font-extrabold font-headline tracking-tight text-on-surface"},"Affiliate Program")],-1)),t("div",gs,[e[43]||(e[43]=t("span",{class:"material-symbols-outlined text-on-surface-variant text-5xl block mb-3"},"block",-1)),e[44]||(e[44]=t("p",{class:"text-base font-bold text-on-surface mb-1"},"Account Suspended",-1)),e[45]||(e[45]=t("p",{class:"text-sm text-on-surface-variant mb-4"},"Your affiliate account has been suspended. Please contact support to resolve this.",-1)),v(h,{to:"/account",class:"inline-block px-5 py-2.5 rounded-xl border border-primary text-primary text-sm font-semibold"},{default:y(()=>[...e[42]||(e[42]=[i("Contact Support",-1)])]),_:1})])],64)):s(m).status==="approved"?(n(),l(c,{key:5},[t("header",ks,[t("div",null,[e[47]||(e[47]=t("h1",{class:"text-2xl font-extrabold font-headline tracking-tight text-on-surface"},"Affiliate Dashboard",-1)),t("p",_s,r(s(m).slug?`@${s(m).slug}`:"Approved affiliate"),1)]),e[48]||(e[48]=t("span",{class:"inline-flex items-center gap-1 text-xs font-bold bg-green-100 text-green-700 px-3 py-1.5 rounded-full shrink-0"},[t("span",{class:"material-symbols-outlined text-sm",style:{"font-variation-settings":"'FILL' 1"}},"verified"),i("Approved ")],-1))]),t("div",hs,[(n(),l(c,null,g(pt,a=>t("button",{key:a.value,onClick:w=>Ct(a.value),class:k(["flex items-center gap-1.5 px-4 py-1.5 rounded-full text-xs font-semibold border transition-colors",s(E)===a.value?"bg-primary text-white border-primary":"bg-surface text-on-surface-variant border-outline/40 hover:border-primary/50 hover:text-primary"])},[t("span",Cs,r(a.icon),1),i(r(a.label),1)],10,ws)),64))]),s(E)==="overview"?(n(),l("div",Ss,[s(me)?(n(),l("div",As,[...e[49]||(e[49]=[t("svg",{class:"w-6 h-6 animate-spin text-primary",fill:"none",viewBox:"0 0 24 24"},[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})],-1)])])):s(pe)?(n(),l("div",Bs,[e[50]||(e[50]=t("span",{class:"material-symbols-outlined text-base"},"warning",-1)),i(r(s(pe)),1)])):(n(),l("div",Ls,[t("div",Ts,[e[51]||(e[51]=t("p",{class:"text-[10px] uppercase tracking-wider text-on-surface-variant font-semibold mb-1"},"Total Earned",-1)),t("p",Ps,r(C(s(_).total_earned)),1)]),t("div",Ms,[e[52]||(e[52]=t("p",{class:"text-[10px] uppercase tracking-wider text-on-surface-variant font-semibold mb-1"},"Available",-1)),t("p",js,r(C(s(q))),1)]),t("div",Fs,[e[53]||(e[53]=t("p",{class:"text-[10px] uppercase tracking-wider text-on-surface-variant font-semibold mb-1"},"Paid Out",-1)),t("p",Ns,r(C(s(_).total_paid)),1)]),s(_).pending>0?(n(),l("div",Es,[e[54]||(e[54]=t("p",{class:"text-[10px] uppercase tracking-wider text-on-surface-variant font-semibold mb-1"},"Processing",-1)),t("p",Rs,r(C(s(_).pending)),1)])):u("",!0)])),s(m).slug?(n(),l("div",Is,[e[55]||(e[55]=t("p",{class:"text-xs font-semibold text-on-surface-variant mb-2 flex items-center gap-1"},[t("span",{class:"material-symbols-outlined text-sm"},"link"),i("Your Referral Link ")],-1)),t("div",$s,[t("span",Os,r(s(et)),1),t("button",{onClick:Ht,class:k(["w-9 h-9 flex items-center justify-center rounded-lg text-white text-sm transition-colors shrink-0",s(Ae)?"bg-green-600":"bg-primary"])},[t("span",Us,r(s(Ae)?"check":"content_copy"),1)],2)])])):u("",!0),t("div",Vs,[e[56]||(e[56]=t("span",{class:"text-sm text-on-surface-variant flex items-center gap-1.5"},[t("span",{class:"material-symbols-outlined text-base"},"percent"),i("Your commission rate ")],-1)),t("span",zs,r(Oe(s(m).commission_rate,s(m).commission_type)),1)]),t("button",{onClick:Vt,disabled:s(q)<=0||!s(J),class:k(["w-full flex items-center justify-center gap-2 py-3.5 rounded-xl text-sm font-semibold text-white transition-opacity disabled:opacity-40",s(q)>0&&s(J)?"bg-gradient-to-r from-green-600 to-green-700":"bg-surface-variant"])},[e[57]||(e[57]=t("span",{class:"material-symbols-outlined text-base"},"upload",-1)),i(" "+r(s(q)>0?"Request Payout â "+C(s(q)):"No funds available"),1)],10,Hs),s(q)>0&&!s(J)?(n(),l("p",Ds,[...e[58]||(e[58]=[t("span",{class:"material-symbols-outlined text-xs align-middle"},"info",-1),i(" Add a primary bank account in Bank Accounts tab to withdraw. ",-1)])])):u("",!0)])):u("",!0),s(E)==="links"?(n(),l("div",Ys,[t("div",qs,[t("span",Ws,r(s(N).length)+" link"+r(s(N).length!==1?"s":""),1),t("button",{onClick:Mt,class:"flex items-center gap-1 px-3 py-1.5 rounded-xl bg-primary text-white text-xs font-semibold"},[...e[59]||(e[59]=[t("span",{class:"material-symbols-outlined text-sm"},"add",-1),i("Generate Link ",-1)])])]),s(Ee)?(n(),l("div",Js,[...e[60]||(e[60]=[t("svg",{class:"w-6 h-6 animate-spin text-primary",fill:"none",viewBox:"0 0 24 24"},[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})],-1)])])):s(_e)?(n(),l("div",Gs,[e[61]||(e[61]=t("span",{class:"material-symbols-outlined text-base"},"warning",-1)),i(r(s(_e)),1)])):s(N).length===0?(n(),l("div",Qs,[...e[62]||(e[62]=[t("span",{class:"material-symbols-outlined text-5xl block mb-2 opacity-30"},"link",-1),t("p",{class:"text-sm font-semibold"},"No product links yet",-1),t("p",{class:"text-xs mt-1"},"Generate one for any product you have a commission rate on.",-1)])])):(n(),l("div",Ks,[(n(!0),l(c,null,g(s(N),a=>(n(),l("div",{key:a.id,class:k(["bg-surface-container-lowest rounded-xl p-4 border border-outline/20",{"opacity-60":!a.is_active}])},[t("div",Xs,[a.product_thumbnail?(n(),l("img",{key:0,src:a.product_thumbnail,class:"w-10 h-10 rounded-lg object-cover shrink-0",alt:""},null,8,Zs)):(n(),l("div",ea,[...e[63]||(e[63]=[t("span",{class:"material-symbols-outlined text-on-surface-variant text-xl"},"shopping_bag",-1)])])),t("div",ta,[t("p",sa,r(a.product_title||"Product"),1),t("div",aa,[a.label&&a.label!=="default"?(n(),l("span",oa,r(a.label),1)):u("",!0),a.is_active?u("",!0):(n(),l("span",na,"Inactive"))])])]),t("div",la,[t("span",ra,r(a.shareable_url),1),t("button",{onClick:w=>Lt(a),class:k(["w-9 h-9 flex items-center justify-center rounded-lg text-white text-sm transition-colors shrink-0",s(X)===a.id?"bg-green-600":"bg-primary"])},[t("span",da,r(s(X)===a.id?"check":"content_copy"),1)],10,ia)]),t("div",ua,[t("span",ca,[e[64]||(e[64]=t("span",{class:"material-symbols-outlined text-sm"},"ads_click",-1)),i(r(a.click_count)+" clicks",1)]),t("span",fa,[e[65]||(e[65]=t("span",{class:"material-symbols-outlined text-sm"},"shopping_cart",-1)),i(r(a.conversion_count)+" sales",1)]),t("span",ma,[e[66]||(e[66]=t("span",{class:"material-symbols-outlined text-sm"},"payments",-1)),i(r(C(a.commission_total_cents??a.revenue_cents??0)),1)])]),t("div",pa,[t("button",{onClick:w=>Pt(a),class:"flex items-center gap-1 px-3 py-1.5 rounded-lg border border-outline/40 text-xs font-semibold text-on-surface-variant hover:border-primary hover:text-primary transition-colors"},[...e[67]||(e[67]=[t("span",{class:"material-symbols-outlined text-sm"},"qr_code",-1),i("QR ",-1)])],8,ba),t("button",{onClick:w=>Tt(a),disabled:s(he)===a.id,class:"flex items-center gap-1 px-3 py-1.5 rounded-lg border border-outline/40 text-xs font-semibold text-on-surface-variant hover:border-primary hover:text-primary transition-colors disabled:opacity-50"},[s(he)===a.id?(n(),l("svg",va,[...e[68]||(e[68]=[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"},null,-1)])])):(n(),l("span",ya,r(a.is_active?"toggle_on":"toggle_off"),1)),i(" "+r(a.is_active?"Pause":"Activate"),1)],8,xa)])],2))),128))]))])):u("",!0),s(E)==="vanity"?(n(),l("div",ga,[e[79]||(e[79]=t("p",{class:"text-xs text-on-surface-variant"}," Claim a personalised code from a seller's offer. Buyers who use your co
1de get the offer's discount, and you earn the offer's commission â tracked as a coupon referral. ",-1)),s($e)?(n(),l("div",ka,[...e[69]||(e[69]=[t("svg",{class:"w-6 h-6 animate-spin text-primary",fill:"none",viewBox:"0 0 24 24"},[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})],-1)])])):s(Be)?(n(),l("div",_a,[e[70]||(e[70]=t("span",{class:"material-symbols-outlined text-base"},"warning",-1)),i(r(s(Be)),1)])):(n(),l(c,{key:2},[s(st).length?(n(),l("div",ha,[e[74]||(e[74]=t("p",{class:"text-xs font-bold uppercase tracking-wider text-on-surface-variant"},"Your Codes",-1)),(n(!0),l(c,null,g(s(st),a=>(n(),l("div",{key:a.id??a.code,class:"bg-surface-container-lowest rounded-xl p-4 border border-outline/20"},[t("div",wa,[t("span",Ca,r(a.code),1),a.status&&a.status!=="active"?(n(),l("span",Sa,r(a.status),1)):u("",!0),a.offer?(n(),l("span",Aa,r(Ue(a.offer)),1)):u("",!0)]),e[73]||(e[73]=t("p",{class:"text-xs text-on-surface-variant mb-3"},"Buyers enter this code at checkout to get the discount â and you earn the commission.",-1)),t("div",Ba,[t("span",La,[e[71]||(e[71]=i("Use code ",-1)),t("span",Ta,r(a.code),1),e[72]||(e[72]=i(" at checkout",-1))]),t("button",{onClick:w=>rt(a),title:"Copy code + checkout hint",class:k(["w-9 h-9 flex items-center justify-center rounded-lg text-white text-sm transition-colors shrink-0",s(D)===(a.id??a.code)?"bg-green-600":"bg-primary"])},[t("span",Ma,r(s(D)===(a.id??a.code)?"check":"content_copy"),1)],10,Pa)])]))),128))])):u("",!0),t("div",ja,[e[78]||(e[78]=t("p",{class:"text-xs font-bold uppercase tracking-wider text-on-surface-variant"},"Available Offers",-1)),s(oe).length===0?(n(),l("div",Fa,[...e[75]||(e[75]=[t("span",{class:"material-symbols-outlined text-5xl block mb-2 opacity-30"},"sell",-1),t("p",{class:"text-sm font-semibold"},"No vanity offers available",-1),t("p",{class:"text-xs mt-1"},"When a seller publishes a vanity-code offer, it'll show up here.",-1)])])):(n(),l("div",Na,[(n(!0),l(c,null,g(s(oe),a=>(n(),l("div",{key:a.id,class:"bg-surface-container-lowest rounded-xl p-4 border border-outline/20"},[t("div",Ea,[e[76]||(e[76]=t("div",{class:"w-10 h-10 rounded-xl bg-blue-100 flex items-center justify-center shrink-0"},[t("span",{class:"material-symbols-outlined text-primary text-xl"},"sell")],-1)),t("div",Ra,[t("p",Ia,r(a.title||a.seller_name||"Vanity offer"),1),t("div",$a,[t("span",Oa,r(Ue(a)),1),t("span",Ua,"Earn "+r(Oe(a.commission_rate,a.commission_type)),1)])])]),a.description?(n(),l("p",Va,r(a.description),1)):u("",!0),t("div",za,[a.max_claims!=null?(n(),l("span",Ha,r(Math.max(0,a.max_claims-(a.claims_used||0)))+" left",1)):(n(),l("span",Da)),t("button",{onClick:w=>Nt(a),disabled:!!a.my_claim||a.max_claims!=null&&(a.claims_used||0)>=a.max_claims,class:"flex items-center gap-1 px-4 py-1.5 rounded-xl bg-primary text-white text-xs font-semibold disabled:opacity-40"},[e[77]||(e[77]=t("span",{class:"material-symbols-outlined text-sm"},"add",-1)),i(r(a.my_claim?"Claimed":a.max_claims!=null&&(a.claims_used||0)>=a.max_claims?"Fully claimed":"Claim Code"),1)],8,Ya)])]))),128))]))])],64))])):u("",!0),s(E)==="creatives"?(n(),l("div",qa,[t("div",Wa,[(n(),l(c,null,g(bt,a=>t("button",{key:a.value,onClick:w=>St(a.value),class:k(["px-3 py-1 rounded-full text-xs font-semibold border transition-colors",s(ke)===a.value?"bg-primary text-white border-primary":"bg-surface text-on-surface-variant border-outline/40 hover:border-primary/50"])},r(a.label),11,Ja)),64))]),s(Ne)?(n(),l("div",Ga,[...e[80]||(e[80]=[t("svg",{class:"w-6 h-6 animate-spin text-primary",fill:"none",viewBox:"0 0 24 24"},[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})],-1)])])):s(ge)?(n(),l("div",Qa,[e[81]||(e[81]=t("span",{class:"material-symbols-outlined text-base"},"warning",-1)),i(r(s(ge)),1)])):s(tt).length===0?(n(),l("div",Ka,[...e[82]||(e[82]=[t("span",{class:"material-symbols-outlined text-5xl block mb-2 opacity-30"},"image",-1),t("p",{class:"text-sm font-semibold"},"No creatives yet",-1),t("p",{class:"text-xs mt-1"},"Banners and embed snippets your vendor publishes will appear here.",-1)])])):(n(),l("div",Xa,[(n(!0),l(c,null,g(s(tt),a=>(n(),l("div",{key:a.id,class:"bg-surface-container-lowest rounded-xl border border-outline/20 overflow-hidden"},[t("div",Za,[a.image_url?(n(),l("img",{key:0,src:a.image_url,alt:a.name,class:"w-full max-h-40 object-cover"},null,8,eo)):(n(),l("div",to,[e[83]||(e[83]=t("span",{class:"material-symbols-outlined text-base align-middle mr-1"},"text_fields",-1)),i(r(a.creative_text||a.name),1)]))]),t("div",so,[t("p",ao,r(a.name),1),a.description?(n(),l("p",oo,r(a.description),1)):u("",!0),t("div",no,[t("button",{onClick:w=>At(a),class:k(["flex items-center gap-1 px-3 py-1.5 rounded-lg text-xs font-semibold border transition-colors",s(L)===a.id+":url"?"bg-green-100 text-green-700 border-green-200":"border-outline/40 text-on-surface-variant hover:border-primary hover:text-primary"])},[t("span",ro,r(s(L)===a.id+":url"?"check":"link"),1),e[84]||(e[84]=i("Link ",-1))],10,lo),a.affiliate_html?(n(),l("button",{key:0,onClick:w=>Bt(a),class:k(["flex items-center gap-1 px-3 py-1.5 rounded-lg text-xs font-semibold border transition-colors",s(L)===a.id+":html"?"bg-green-100 text-green-700 border-green-200":"border-outline/40 text-on-surface-variant hover:border-primary hover:text-primary"])}
1,[t("span",uo,r(s(L)===a.id+":html"?"check":"code"),1),e[85]||(e[85]=i("Embed ",-1))],10,io)):u("",!0)])])]))),128))]))])):u("",!0),s(E)==="referrals"?(n(),l("div",co,[t("div",fo,[(n(),l(c,null,g(xt,a=>t("button",{key:a.value,onClick:w=>wt(a.value),class:k(["px-3 py-1 rounded-full text-xs font-semibold border transition-colors",s(ve)===a.value?"bg-primary text-white border-primary":"bg-surface text-on-surface-variant border-outline/40 hover:border-primary/50"])},r(a.label),11,mo)),64))]),s(be)?(n(),l("div",po,[...e[86]||(e[86]=[t("svg",{class:"w-6 h-6 animate-spin text-primary",fill:"none",viewBox:"0 0 24 24"},[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})],-1)])])):s(xe)?(n(),l("div",bo,[e[87]||(e[87]=t("span",{class:"material-symbols-outlined text-base"},"warning",-1)),i(r(s(xe)),1)])):s(U).length===0?(n(),l("div",xo,[...e[88]||(e[88]=[t("span",{class:"material-symbols-outlined text-5xl block mb-2 opacity-30"},"bar_chart",-1),t("p",{class:"text-sm font-semibold"},"No referrals yet",-1),t("p",{class:"text-xs mt-1"},"Share your referral link to start earning.",-1)])])):(n(),l("div",vo,[(n(!0),l(c,null,g(s(U),a=>(n(),l("div",{key:a.id,class:"bg-surface-container-lowest rounded-xl p-4 border border-outline/20 space-y-2"},[t("div",yo,[t("span",{class:k(["text-[10px] font-bold uppercase tracking-wide px-2 py-0.5 rounded-full",a.source==="campaign"?"bg-violet-100 text-violet-700":a.source==="coupon"?"bg-amber-100 text-amber-700":"bg-blue-100 text-blue-700"])},r(kt(a.source)),3),t("span",{class:k(["ml-auto text-[10px] font-bold uppercase tracking-wide px-2 py-0.5 rounded-full",a.status==="paid"?"bg-green-100 text-green-700":a.status==="unpaid"?"bg-amber-100 text-amber-700":a.status==="rejected"?"bg-red-100 text-red-600":"bg-surface-variant text-on-surface-variant"])},r(vt[a.status]??a.status),3)]),t("div",go,[t("span",ko,r(a.order_id?"#"+a.order_id.slice(-8):"â"),1),t("span",_o,r(gt(a.created_at)),1)]),t("div",ho,[e[89]||(e[89]=t("span",{class:"text-on-surface-variant"},"Order",-1)),t("span",wo,r(C(a.order_amount||0)),1),e[90]||(e[90]=t("span",{class:"text-on-surface-variant ml-auto"},"Commission",-1)),t("span",Co,r(C(a.commission_amount||0)),1)])]))),128))])),!s(be)&&s(Xe)?(n(),l("button",{key:4,onClick:ht,class:"w-full py-3 rounded-xl bg-surface-container-lowest border border-outline/30 text-sm text-on-surface-variant flex items-center justify-center gap-2"},[s(Me)?(n(),l("svg",So,[...e[91]||(e[91]=[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"},null,-1)])])):u("",!0),e[92]||(e[92]=i(" Load More ",-1))])):u("",!0)])):u("",!0),s(E)==="banks"?(n(),l("div",Ao,[t("div",Bo,[t("span",Lo,r(s(j).length)+" account"+r(s(j).length!==1?"s":""),1),t("button",{onClick:It,class:"flex items-center gap-1 px-3 py-1.5 rounded-xl bg-primary text-white text-xs font-semibold"},[...e[93]||(e[93]=[t("span",{class:"material-symbols-outlined text-sm"},"add",-1),i("Add Account ",-1)])])]),s(Fe)?(n(),l("div",To,[...e[94]||(e[94]=[t("svg",{class:"w-6 h-6 animate-spin text-primary",fill:"none",viewBox:"0 0 24 24"},[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})],-1)])])):s(F)?(n(),l("div",Po,[e[95]||(e[95]=t("span",{class:"material-symbols-outlined text-base"},"warning",-1)),i(r(s(F)),1)])):s(j).length===0?(n(),l("div",Mo,[...e[96]||(e[96]=[t("span",{class:"material-symbols-outlined text-5xl block mb-2 opacity-30"},"account_balance",-1),t("p",{class:"text-sm font-semibold"},"No bank accounts",-1),t("p",{class:"text-xs mt-1"},"Add a bank account to receive affiliate payouts.",-1)])])):(n(),l("div",jo,[(n(!0),l(c,null,g(s(j),a=>(n(),l("div",{key:a.id,class:"bg-surface-container-lowest rounded-xl p-4 border border-outline/20"},[t("div",Fo,[e[97]||(e[97]=t("div",{class:"w-10 h-10 rounded-xl bg-blue-100 flex items-center justify-center shrink-0"},[t("span",{class:"material-symbols-outlined text-primary text-xl"},"account_balance")],-1)),t("div",No,[t("p",Eo,r(a.bank_code),1),t("p",Ro,r(at(a.account_number)),1),t("p",Io,r(a.account_holder_name),1)]),a.is_primary?(n(),l("span",$o,"Primary")):u("",!0)]),t("div",Oo,[a.is_primary?u("",!0):(n(),l("button",{key:0,onClick:w=>Ot(a.id),class:"text-xs font-semibold px-3 py-1.5 rounded-lg border border-primary text-primary hover:bg-primary hover:text-white transition-colors"}," Set Primary ",8,Uo)),t("button",{onClick:w=>Ut(a.id),class:"ml-auto flex items-center gap-1 text-xs font-semibold px-3 py-1.5 rounded-lg border border-red-200 text-red-500 hover:bg-red-50 transition-colors"},[...e[98]||(e[98]=[t("span",{class:"material-symbols-outlined text-sm"},"delete",-1)])],8,Vo)])]))),128))]))])):u("",!0)],64)):u("",!0):(n(),l(c,{key:1},[e[35]||(e[35]=t("header",null,[t("h1",{class:"text-2xl font-extrabold font-headline tracking-tight text-on-surface"},"Affiliate Program"),t("p",{class:"text-sm text-on-surface-variant mt-1"}
1,"Earn commission by sharing your favourite spaces")],-1)),t("div",os,[e[24]||(e[24]=dt('<span class="material-symbols-outlined text-primary text-5xl block mb-3" style="font-variation-settings:'FILL' 1;">campaign</span><h2 class="text-base font-bold text-on-surface mb-1">Become an Affiliate</h2><p class="text-sm text-on-surface-variant mb-4">Share space links with your audience and earn commission on every booking, order, or voucher purchase.</p><ul class="text-sm text-on-surface space-y-2 text-left inline-block mb-5"><li class="flex items-center gap-2"><span class="material-symbols-outlined text-green-600 text-base" style="font-variation-settings:'FILL' 1;">check_circle</span>Up to 20% commission per sale </li><li class="flex items-center gap-2"><span class="material-symbols-outlined text-green-600 text-base" style="font-variation-settings:'FILL' 1;">check_circle</span>Real-time referral tracking </li><li class="flex items-center gap-2"><span class="material-symbols-outlined text-green-600 text-base" style="font-variation-settings:'FILL' 1;">check_circle</span>Payout to any Indonesian bank or e-wallet </li><li class="flex items-center gap-2"><span class="material-symbols-outlined text-green-600 text-base" style="font-variation-settings:'FILL' 1;">check_circle</span>Shareable product links with click stats </li></ul>',4)),t("button",{class:"w-full flex items-center justify-center gap-2 py-3 rounded-xl bg-primary text-white text-sm font-semibold",onClick:e[0]||(e[0]=a=>G.value=!0)},[...e[23]||(e[23]=[t("span",{class:"material-symbols-outlined text-base"},"person_add",-1),i("Apply Now ",-1)])])]),v(S,{"enter-active-class":"transition-all duration-200","enter-from-class":"opacity-0 -translate-y-2","leave-active-class":"transition-all duration-150","leave-to-class":"opacity-0 -translate-y-2"},{default:y(()=>[s(G)?(n(),l("div",ns,[e[33]||(e[33]=t("h3",{class:"text-sm font-bold text-on-surface"},"Your Details",-1)),t("div",null,[e[25]||(e[25]=t("label",{class:"block text-xs font-semibold text-on-surface-variant mb-1"},[i("Phone Number "),t("span",{class:"text-red-500"},"*")],-1)),A(t("input",{"onUpdate:modelValue":e[1]||(e[1]=a=>s(f).phone_number=a),type:"tel",placeholder:"081234567890",disabled:s(M),class:"w-full rounded-xl border border-outline px-3 py-2 text-sm bg-surface text-on-surface focus:outline-none focus:ring-2 focus:ring-primary disabled:opacity-50"},null,8,ls),[[$,s(f).phone_number]])]),e[34]||(e[34]=t("p",{class:"text-xs font-semibold text-on-surface-variant uppercase tracking-wider"},[i("Bank Account "),t("span",{class:"font-normal normal-case text-on-surface-variant/70"},"(optional â can add later)")],-1)),t("div",null,[e[27]||(e[27]=t("label",{class:"block text-xs font-semibold text-on-surface-variant mb-1"},"Bank / E-Wallet",-1)),A(t("select",{"onUpdate:modelValue":e[2]||(e[2]=a=>s(f).bank_code=a),disabled:s(M),class:"w-full rounded-xl border border-outline px-3 py-2 text-sm bg-surface text-on-surface focus:outline-none focus:ring-2 focus:ring-primary disabled:opacity-50"},[e[26]||(e[26]=t("option",{value:""},"Skip for now",-1)),t("optgroup",is,[(n(),l(c,null,g(Qe,a=>t("option",{key:a.code,value:a.code},r(a.name),9,ds)),64))]),t("optgroup",us,[(n(),l(c,null,g(Ke,a=>t("option",{key:a.code,value:a.code},r(a.name),9,cs)),64))])],8,rs),[[ut,s(f).bank_code]])]),s(f).bank_code?(n(),l(c,{key:0},[t("div",null,[e[28]||(e[28]=t("label",{class:"block text-xs font-semibold text-on-surface-variant mb-1"},"Account Number",-1)),A(t("input",{"onUpdate:modelValue":e[3]||(e[3]=a=>s(f).account_number=a),type:"text",placeholder:"1234567890",disabled:s(M),class:"w-full rounded-xl border border-outline px-3 py-2 text-sm bg-surface text-on-surface focus:outline-none focus:ring-2 focus:ring-primary disabled:opacity-50"},null,8,fs),[[$,s(f).account_number]])]),t("div",null,[e[29]||(e[29]=t("label",{class:"block text-xs font-semibold text-on-surface-variant mb-1"},"Account Holder Name",-1)),A(t("input",{"onUpdate:modelValue":e[4]||(e[4]=a=>s(f).account_holder_name=a),type:"text",placeholder:"Full name as on account",disabled:s(M),class:"w-full rounded-xl border border-outline px-3 py-2 text-sm bg-surface text-on-surface focus:outline-none focus:ring-2 focus:ring-primary disabled:opacity-50"},null,8,ms),[[$,s(f).account_holder_name]])])],64)):u("",!0),s(Q)?(n(),l("div",ps,[e[3
10]||(e[30]=t("span",{class:"material-symbols-outlined text-base"},"error",-1)),i(r(s(Q)),1)])):u("",!0),t("button",{class:"w-full py-3 rounded-xl bg-primary text-white text-sm font-semibold flex items-center justify-center gap-2 disabled:opacity-50",disabled:s(M)||!s(f).phone_number,onClick:Rt},[s(M)?(n(),l("svg",xs,[...e[31]||(e[31]=[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"},null,-1)])])):u("",!0),e[32]||(e[32]=i(" Submit Application ",-1))],8,bs),t("button",{class:"w-full py-2.5 rounded-xl border border-outline text-sm text-on-surface-variant font-medium disabled:opacity-50",disabled:s(M),onClick:e[5]||(e[5]=a=>{G.value=!1,qe()})}," Cancel ",8,vs)])):u("",!0)]),_:1})],64)),s(O)?(n(),l("div",zo,[e[99]||(e[99]=t("span",{class:"material-symbols-outlined text-base"},"error",-1)),i(r(s(O)),1)])):u("",!0)],64)):(n(),l("div",ss,[e[21]||(e[21]=t("p",{class:"text-sm text-on-surface-variant mb-3"},"Sign in to view your affiliate account.",-1)),v(h,{to:`/sign-in?redirect=${encodeURIComponent(s(mt).fullPath)}`,class:"inline-flex items-center gap-2 px-4 py-2 rounded-xl bg-primary text-white text-sm font-semibold"},{default:y(()=>[...e[20]||(e[20]=[i("Sign in",-1)])]),_:1},8,["to"])])),(n(),re(ie,{to:"body"},[v(S,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","leave-active-class":"transition-opacity duration-150","leave-to-class":"opacity-0"},{default:y(()=>[s(H)?(n(),l("div",{key:0,class:"fixed inset-0 z-50 bg-black/50 flex items-end justify-center backdrop-blur-sm",onClick:e[8]||(e[8]=ue(a=>H.value=!1,["self"]))},[v(S,{"enter-active-class":"transition-transform duration-200","enter-from-class":"translate-y-full","leave-active-class":"transition-transform duration-200","leave-to-class":"translate-y-full"},{default:y(()=>[s(H)?(n(),l("div",Ho,[e[108]||(e[108]=t("div",{class:"w-10 h-1 bg-outline-variant rounded-full mx-auto mb-5"},null,-1)),t("div",Do,[e[101]||(e[101]=t("div",null,[t("p",{class:"text-base font-bold text-on-surface"},"Request Payout"),t("p",{class:"text-xs text-on-surface-variant mt-0.5"},"Funds will be sent to your primary account")],-1)),t("button",{onClick:e[6]||(e[6]=a=>H.value=!1),class:"ml-auto w-8 h-8 rounded-full bg-surface-variant flex items-center justify-center text-on-surface-variant"},[...e[100]||(e[100]=[t("span",{class:"material-symbols-outlined text-base"},"close",-1)])])]),t("div",Yo,[t("div",qo,[e[102]||(e[102]=t("span",{class:"text-on-surface-variant"},"Available balance",-1)),t("strong",Wo,r(C(s(q))),1)]),s(J)?(n(),l("div",Jo,[e[103]||(e[103]=t("span",{class:"text-on-surface-variant"},"Pay to",-1)),t("strong",Go,r(s(J).bank_code)+" · "+r(at(s(J).account_number)),1)])):u("",!0)]),s(se)?(n(),l("div",Qo,[e[104]||(e[104]=t("span",{class:"material-symbols-outlined text-base"},"error",-1)),i(r(s(se)),1)])):u("",!0),s(ae)?(n(),l("div",Ko,[...e[105]||(e[105]=[t("span",{class:"material-symbols-outlined text-base",style:{"font-variation-settings":"'FILL' 1"}},"check_circle",-1),i("Payout requested! Funds will arrive within 1â2 business days. ",-1)])])):u("",!0),t("div",Xo,[t("button",{onClick:e[7]||(e[7]=a=>H.value=!1),disabled:s(te),class:"w-full py-3 rounded-xl border border-outline text-sm font-semibold text-on-surface disabled:opacity-50"}," Cancel ",8,Zo),t("button",{onClick:zt,disabled:s(te)||s(ae),class:"w-full py-3 rounded-xl bg-primary text-white text-sm font-semibold flex items-center justify-center gap-2 disabled:opacity-50"},[s(te)?(n(),l("svg",tn,[...e[106]||(e[106]=[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"},null,-1)])])):u("",!0),e[107]||(e[107]=i(" Confirm Payout ",-1))],8,en)])])):u("",!0)]),_:1})])):u("",!0)]),_:1})])),(n(),re(ie,{to:"body"},[v(S,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","leave-active-class":"transition-opacity duration-150","leave-to-class":"opacity-0"},{default:y(()=>[s(Z)?(n(),l("div",{key:0,class:"fixed inset-0 z-50 bg-black/50 flex items-end justify-center backdrop-blur-sm",onClick:ue(Ye,["self"])},[v(S,{"enter-active-class":"transition-transform duration-200","enter-from-class":"translate-y-full","leave-active-class":"transition-transform duration-200","leave-to-class":"translate-y-full"},{default:y(()=>[s(Z)?(n(),l("div",sn,[e[119]||(e[119]=t("div",{class:"w-10 h-1 bg-outline-variant rounded-full mx-auto mb-5"},null,-1)),t("div",{class:"flex items-start gap-3 mb-5"},[e[110]||(e[110]=t("div",null,[t("p",{class:"text-base font-bold text-on-surface"},"Generate Product Link"),t("p",{class:"text-xs text-on-surface-variant mt-0.5"},"Pick a product you have a rate on")],-1)),t("button",{onClick:Ye,class:"ml-auto w-8 h-8 rounded-full bg-surface-variant flex items-center justify-center text-on-surface-variant"},[...e[109]||(e[109]=[t("span",{class:"material-symbols-outlined text-base"},"close",-1)])])]),t("div",an,[A(t("input",{"onUpdate:modelValue":e[9]||(e[9]=a=>Ge(ee)?ee.value=a:null),type:"search",placeholder:"Search products...",onInput:jt,class:"w-full rounded-xl border border-outline px-3 py-2 text-sm bg-surface text-on-surface focus:outline-none focus:ring-2 focus:ring-primary"},null,544),[[$,s(ee)]]),s(Re)?(n(),l("div",on,[...e[111]||(e[111]=[t("svg",{class:"w-5 h-5 animate-spin text-primary",fill:"none",viewBox:"0 0 24 24"},[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})],-1)])])):s(Se).length===0?(n(),l("div",nn,[...e[112]||(e[112]=[t("span",{class:"material-symbols-outlined text-4xl block mb-2 opacity-30"},"shopping_bag",-1),t("p",{class:"text-sm font-semibold"},"No eligible products",-1),t("p",{class:"text-xs mt-1"},"Your vendor needs to set a commission rate first.",-1)])])):(n(),l("div",ln,[(n(!0),l(c,null,g(s(Se),a=>(n(),l("button",{key:a.id,type:"button",onClick:w=>T.value=a,class:k(["w-full flex items-center gap-3 rounded-xl p-3 border text-left transition-colors",s(T)&&s(T).id===a.id?"border-primary bg-primary/5":"border-outline/30 hover:border-primary/50"])},[a.thumbnail?(n(),l("img",{key:0,src:a.thumbnail,class:"w-10 h-10 rounded-lg object-cover shrink-0",alt:""},null,8,dn)):(n(),l("div",un,[...e[113]||(e[113]=[t("span",{class:"material-symbols-outlined text-on-surface-variant"},"shopping_bag",-1)])])),t("div",cn,[t("p",fn,r(a.title),1),t("p",mn,"/"+r(a.handle),1)]),s(T)&&s(T).id===a.id?(n(),l("span",pn,"check_circle")):u("",!0)],10,rn))),128))])),s(T)?(n(),l("div",bn,[e[114]||(e[114]=t("label",{class:"block text-xs font-semibold text-on-surface-variant mb-1"},[i("Channel label "),t("span",{class:"font-normal text-on-surface-variant/70"},"(optional)")],-1)),A(t("input",{"onUpdate:modelValue":e[10]||(e[10]=a=>Ge(V)?V.value=a:null),type:"text",placeholder:"instagram, tiktok...",maxlength:"32",disabled:s(z),class:"w-full rounded-xl border border-outline px-3 py-2 text-sm bg-surface text-on-surface focus:outline-none focus:ring-2 focus:ring-primary disabled:opacity-50"},null,8,xn),[[$,s(V)]]),e[115]||(e[115]=t("p",{class:"text-xs text-on-surface-variant mt-1"},"Same product can have multiple links with different labels.",-1))])):u("",!0),s(R)?(n(),l("div",vn,[e[116]||(e[116]=t("span",{class:"material-symbols-outlined text-base"},"error",-1)),i(r(s(R)),1)])):u("",!0)]),t("div",yn,[t("button",{onClick:Ye,disabled:s(z),class:"w-full py-3 rounded-xl border border-outline text-sm font-semibold text-on-surface disabled:opacity-50"},"Cancel",8,gn),t("button",{onClick:Ft,disabled:s(z)||!s(T),class:"w-full py-3 rounded-xl bg-primary text-white text-sm font-semibold flex items-center justify-center gap-2 disabled:opacity-50"},[s(z)?(n(),l("svg",_n,[...e[117]||(e[117]=[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"},null,-1)])])):u("",!0),e[118]||(e[118]=i(" Generate Link ",-1))],8,kn)])])):u("",!0)]),_:1})])):u("",!0)]),_:1})])),(n(),re(ie,{to:"body"},[v(S,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","leave-active-class":"transition-opacity duration-150","leave-to-class":"opacity-0"},{default:y(()=>[s(Le)?(n(),l("div",{key:0,class:"fixed inset-0 z-50 bg-black/50 flex items-end justify-center backdrop-blur-sm",onClick:ue(Te,["self"])},[v(S,{"enter-active-class":"transition-transform duration-200","enter-from-class":"translate-y-full","leave-active-class":"transition-transform duration-200","leave-to-class":"translate-y-full"},{default:y(()=>[s(Le)?(n(),l("div",hn,[e[136]||(e[136]=t("div",{class:"w-10 h-1 bg-outline-variant rounded-full mx-auto mb-5"},null,-1)),t("div",wn,[t("div",null,[e[120]||(e[120]=t("p",{class:"text-base font-bold text-on-surface"},"Claim Your Vanity Code",-1)),t("p",Cn,r(s(x)?.title||s(x)?.seller_name||"Pick a code to share"),1)]),t("button",{onClick:Te,class:"ml-auto w-8 h-8 rounded-full bg-surface-variant flex items-center justify-center text-on-surface-variant"},[...e[121]||(e[121]=[t("span",{class:"material-symbols-outlined text-base"},"close",-1)])])]),s(P)?(n(),l(c,{key:0},[t("div",Sn,[e[122]||(e[122]=t("span",{class:"material-symbols-outlined text-base",style:{"font-variation-settings":"'FILL' 1"}},"check_circle",-1)),e[123]||(e[123]=i(" Code ",-1)),t("strong",An,r(s(P).code),1),e[124]||(e[124]=i(" is yours! Share it with your audience. ",-1))]),e[127]||(e[127]=t("p",{class:"text-xs text-on-surface-variant mb-2"},"Buyers enter this code at checkout to get the discount â and you earn the commission.",-1)),t("div",Bn,[t("span",Ln,[e[125]||(e[125]=i("Use code ",-1)),t("span",Tn,r(s(P).code),1),e[126]||(e[126]=i(" at checkout",-1))]),t("button",{onClick:e[11]||(e[11]=a=>rt(s(P))),title:"Copy code + checkout hint",class:k(["w-9 h-9 flex items-center justify-center rounded-lg text-white text-sm transition-colors shrink-0",s(D)===(s(P).id??s(P).code)?"bg-green-600":"bg-primary"])},[t("span",Pn,r(s(D)===(s(P).id??s(P).code)?"check":"content_copy"),1)],2)]),t("button",{onClick:Te,class:"w-full py-3 rounded-xl bg-primary text-white text-sm font-semibold"},"Done")],64)):(n(),l(c,{key:1},[t("div",Mn,[t("div",jn,[t("span",Fn,r(Ue(s(x))),1),t("span",Nn,"Earn "+r(Oe(s(x)?.commission_rate,s(x)?.commission_type)),1)]),t("div",null,[e[132]||(e[132]=t("label",{class:"block text-xs font-semibold text-on-surface-variant mb-1"},[i("Your code "),t("span",{class:"text-red-500"},"*")],-1)),A(t("input",{"onUpdate:modelValue":e[12]||(e[12]=a=>Ge(I)?I.value=a:null),type:"text",placeholder:"e.g. ANDRE10",disabled:s(Y),class:"w-full rounded-xl border border-outline px-3 py-2 text-sm bg-surface text-on-surface font-mono uppercase focus:outline-none focus:ring-2 focus:ring-primary disabled:opacity-50"},null,8,En),[[$,s(I)]]),t("p",Rn,[e[130]||(e[130]=i(" Buyers type ",-1)),t("span",In,r((s(I)||"YOURCODE").trim().toUpperCase()),1),e[131]||(e[131]=i(" at checkout. ",-1)),s(x)?.code_rules?(n(),l(c,{key:0},[s(x).code_rules.prefix?(n(),l(c,{key:0},[e[128]||(e[128]=i("Must start with ",-1)),t("strong",null,r(s(x).code_rules.prefix),1),e[129]||(e[129]=i(". ",-1))],64)):u("",!0),s(x).code_rules.min_len?(n(),l(c,{key:1},[i(r(s(x).code_rules.min_len)+"â"+r(s(x).code_rules.max_len||"â")+" chars.",1)],64)):u("",!0)],64)):u("",!0)])]),s(ne)?(n(),l("div",$n,[e[133]||(e[133]=t("span",{class:"material-symbols-outlined text-base"},"error",-1)),i(r(s(ne)),1)])):u("",!0)]),t("div",On,[t("button",{onClick:Te,disabled:s(Y),class:"w-full py-3 rounded-xl border border-outline text-sm font-semibold text-on-surface disabled:opacity-50"},"Cancel",8,Un),t("button",{onClick:Et,disabled:s(Y)||!s(I).trim(),class:"w-full py-3 rounded-xl bg-primary text-white text-sm font-semibold flex items-center justify-center gap-2 disabled:opacity-50"},[s(Y)?(n(),l("svg",zn,[...e[134]||(e[134]=[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"},null,-1)])])):u("",!0),e[135]||(e[135]=i(" Claim Code ",-1))],8,Vn)])],64))])):u("",!0)]),_:1})])):u("",!0)]),_:1})])),(n(),re(ie,{to:"body"},[v(S,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","leave-active-class":"transition-opacity duration-150","leave-to-class":"opacity-0"},{default:y(()=>[s(W)?(n(),l("div",{key:0,class:"fixed inset-0 z-50 bg-black/50 flex items-end justify-center backdrop-blur-sm",onClick:e[15]||(e[15]=ue
1(a=>W.value=!1,["self"]))},[v(S,{"enter-active-class":"transition-transform duration-200","enter-from-class":"translate-y-full","leave-active-class":"transition-transform duration-200","leave-to-class":"translate-y-full"},{default:y(()=>[s(W)?(n(),l("div",Hn,[e[140]||(e[140]=t("div",{class:"w-10 h-1 bg-outline-variant rounded-full mx-auto mb-5"},null,-1)),t("div",Dn,[e[138]||(e[138]=t("div",null,[t("p",{class:"text-base font-bold text-on-surface"},"Share via QR Code"),t("p",{class:"text-xs text-on-surface-variant mt-0.5"},"Scan with phone camera")],-1)),t("button",{onClick:e[13]||(e[13]=a=>W.value=!1),class:"ml-auto w-8 h-8 rounded-full bg-surface-variant flex items-center justify-center text-on-surface-variant"},[...e[137]||(e[137]=[t("span",{class:"material-symbols-outlined text-base"},"close",-1)])])]),t("div",Yn,[s(we)?(n(),l("img",{key:1,src:s(we),class:"w-48 h-48 rounded-xl",alt:"QR code"},null,8,Wn)):(n(),l("svg",qn,[...e[139]||(e[139]=[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"},null,-1)])])),t("p",Jn,r(s(Ze)),1)]),t("button",{onClick:e[14]||(e[14]=a=>W.value=!1),class:"w-full py-3 rounded-xl bg-primary text-white text-sm font-semibold"},"Close")])):u("",!0)]),_:1})])):u("",!0)]),_:1})])),(n(),re(ie,{to:"body"},[v(S,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","leave-active-class":"transition-opacity duration-150","leave-to-class":"opacity-0"},{default:y(()=>[s(K)?(n(),l("div",{key:0,class:"fixed inset-0 z-50 bg-black/50 flex items-end justify-center backdrop-blur-sm",onClick:ue(We,["self"])},[v(S,{"enter-active-class":"transition-transform duration-200","enter-from-class":"translate-y-full","leave-active-class":"transition-transform duration-200","leave-to-class":"translate-y-full"},{default:y(()=>[s(K)?(n(),l("div",Gn,[e[151]||(e[151]=t("div",{class:"w-10 h-1 bg-outline-variant rounded-full mx-auto mb-5"},null,-1)),t("div",{class:"flex items-start gap-3 mb-5"},[e[142]||(e[142]=t("div",null,[t("p",{class:"text-base font-bold text-on-surface"},"Add Bank Account"),t("p",{class:"text-xs text-on-surface-variant mt-0.5"},"For affiliate commission payouts")],-1)),t("button",{onClick:We,class:"ml-auto w-8 h-8 rounded-full bg-surface-variant flex items-center justify-center text-on-surface-variant"},[...e[141]||(e[141]=[t("span",{class:"material-symbols-outlined text-base"},"close",-1)])])]),t("div",Qn,[t("div",null,[e[144]||(e[144]=t("label",{class:"block text-xs font-semibold text-on-surface-variant mb-1"},[i("Bank / E-Wallet "),t("span",{class:"text-red-500"},"*")],-1)),A(t("select",{"onUpdate:modelValue":e[16]||(e[16]=a=>s(p).bank_code=a),disabled:s(B),class:"w-full rounded-xl border border-outline px-3 py-2 text-sm bg-surface text-on-surface focus:outline-none focus:ring-2 focus:ring-primary disabled:opacity-50"},[e[143]||(e[143]=t("option",{value:""},"Select...",-1)),t("optgroup",Xn,[(n(),l(c,null,g(Qe,a=>t("option",{key:a.code,value:a.code},r(a.name),9,Zn)),64))]),t("optgroup",el,[(n(),l(c,null,g(Ke,a=>t("option",{key:a.code,value:a.code},r(a.name),9,tl)),64))])],8,Kn),[[ut,s(p).bank_code]])]),t("div",null,[e[145]||(e[145]=t("label",{class:"block text-xs font-semibold text-on-surface-variant mb-1"},[i("Account Number "),t("span",{class:"text-red-500"},"*")],-1)),A(t("input",{"onUpdate:modelValue":e[17]||(e[17]=a=>s(p).account_number=a),type:"text",placeholder:"1234567890",disabled:s(B),class:"w-full rounded-xl border border-outline px-3 py-2 text-sm bg-surface text-on-surface focus:outline-none focus:ring-2 focus:ring-primary disabled:opacity-50"},null,8,sl),[[$,s(p).account_number]])]),t("div",null,[e[146]||(e[146]=t("label",{class:"block text-xs font-semibold text-on-surface-variant mb-1"},[i("Account Holder Name "),t("span",{class:"text-red-500"},"*")],-1)),A(t("input",{"onUpdate:modelValue":e[18]||(e[18]=a=>s(p).account_holder_name=a),type:"text",placeholder:"Full name as on account",disabled:s(B),class:"w-full rounded-xl border border-outline px-3 py-2 text-sm bg-surface text-on-surface focus:outline-none focus:ring-2 focus:ring-primary disabled:opacity-50"},null,8,al),[[$,s(p).account_holder_name]])]),t("label",ol,[A(t("input",{type:"checkbox","onUpdate:modelValue":e[19]||(e[19]=a=>s(p).is_primary=a),disabled:s(B),class:"w-4 h-4 rounded border-outline accent-primary"},null,8,nl),[[Kt,s(p).is_primary]]),e[147]||(e[147]=t("span",{class:"text-xs text-on-surface"},"Set as primary payout account",-1))]),s(F)?(n(),l("div",ll,[e[148]||(e[148]=t("span",{class:"material-symbols-outlined text-base"},"error",-1)),i(r(s(F)),1)])):u("",!0)]),t("div",rl,[t("button",{onClick:We,disabled:s(B),class:"w-full py-3 rounded-xl border border-outline text-sm font-semibold text-on-surface disabled:opacity-50"}," Cancel ",8,il),t("button",{onClick:$t,disabled:s(B)||!s(p).bank_code||!s(p).account_number||!s(p).account_holder_name,class:"w-full py-3 rounded-xl bg-primary text-white text-sm font-semibold flex items-center justify-center gap-2 disabled:opacity-50"},[s(B)?(n(),l("svg",ul,[...e[149]||(e[149]=[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"}
1,null,-1)])])):u("",!0),e[150]||(e[150]=i(" Save Account ",-1))],8,dl)])])):u("",!0)]),_:1})])):u("",!0)]),_:1})]))])}}});export{bl 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.