PageSourceSearch

https://vivart.ai/assets/AdminDashboard-DotCK_h-.js

js vivart.ai collected 2026-10-05 14:47:47 UTC 141,779 bytes, 14 lines download raw bytes

1import{r as a,j as e}from"./react-vendor-CNvx0oQm.js";import{A as ur,m as k,d as gr,b2 as it,b3 as Os,b4 as ta,b5 as K,b6 as wr,b7 as fr,b8 as jr,N as vr,b9 as Nr,ba as ae,bb as yr,bc as Vs,g as Lt,bd as zs,be as Cr,bf as kr,bg as Sr,bh as _r,bi as Ir,bj as Ar,bk as $r,bl as Lr,bm as Dr,bn as Pr,bo as Mr,bp as nt,bq as Tr,br as Er,bs as Fr,bt as Ur,bu as re,bv as Rr,bw as Kr,bx as Br}from"./index-BQf_T_Zv.js";import{r as Hs}from"./promptAssistRecord-BgDg6xDI.js";import{l as Gr,b as Or,r as Vr}from"./testerApplication-DKUTJ9v_.js";import B from"./icons-x-CRa6bIIW.js";import{b as Js}from"./icons-l-CH7lX_W_.js";import{c as zr,I as qs}from"./icons-i-QaBHOwu2.js";import{f as xt,t as Hr,b as Jr,d as qr,w as sa,m as Qr,k as ge,v as Xr,x as ot,e as Wr}from"./icons-c-fsvgkOz3.js";import{g as Yr,a as Zr,h as el}from"./icons-f-DIXpr9ke.js";import{c as tl,s as sl,b as Ge}from"./icons-p-Dta2O8IR.js";import{d as dt,a as al,i as rl}from"./icons-b-CH3Xfanu.js";import{e as ll,i as Qs,g as Dt,o as Re}from"./icons-s-CRibo1eD.js";import{U as Xs}from"./icons-u-DT3ttqpi.js";import{j as Ws,k as il}from"./icons-t-CsRekfkF.js";import{b as Ke}from"./icons-z-BaTRSvaf.js";import{R as nl,b as Ys}from"./icons-r-FrRD_B32.js";import{o as Pt,k as ct}from"./icons-a-BkSjOGTI.js";import{D as ol,b as Mt}from"./icons-d-DAr8vZwR.js";import{G as Zs}from"./icons-g-BJpaIHqr.js";import{a as Tt}from"./icons-e-dngfxdnk.js";import{n as dl}from"./icons-m-drNSL4rT.js";import"./lucide-core-CmglOHoc.js";import"./icons-h-BeLly2Mf.js";import"./icons-q-Dw42O6Rm.js";import"./icons-k-DVmbnQnX.js";const cl=[{key:"pending",label:"待审批"},{key:"approved",label:"已通过"},{key:"rejected",label:"已拒绝"},{key:"all",label:"全部"}];function ea(x){return x?new Date(x*1e3).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"—"}function xl({open:x,onClose:w}){const[L,G]=a.useState("pending"),[F,f]=a.useState([]),[A,D]=a.use
1State(!1),[P,M]=a.useState(null),[S,O]=a.useState(""),T=a.useCallback(async()=>{D(!0),O("");try{const m=await Gr(L,1,100);f(m.data)}catch(m){O(m?.message||"加载失败")}finally{D(!1)}},[L]);a.useEffect(()=>{x&&T()},[x,T]);const R=async m=>{M(m.id);try{await Or(m.id),await T()}catch(V){O(V?.message||"操作失败")}finally{M(null)}},W=async m=>{M(m.id);try{await Vr(m.id),await T()}catch(V){O(V?.message||"操作失败")}finally{M(null)}};return e.jsx(ur,{children:x&&e.jsx(k.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-center justify-center p-2 md:p-6",onClick:w,children:e.jsxs(k.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},onClick:m=>m.stopPropagation(),className:"bg-gray-900 border border-white/20 rounded-2xl max-w-4xl w-full max-h-[90vh] md:max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 border-b border-white/10 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"内测申请审批"}),e.jsx("p",{className:"text-xs text-white/50 mt-1",children:"通过后用户角色升级为 tester,可在 Lab 创建作品"})]}),e.jsx("button",{onClick:w,className:"text-white/60 hover:text-white",children:e.jsx(B,{className:"w-6 h-6"})})]}),e.jsx("div",{className:"px-6 pt-4 pb-2 border-b border-white/10 flex items-center gap-1.5",children:cl.map(m=>e.jsx("button",{onClick:()=>G(m.key),className:`px-3 py-1.5 rounded-lg text-sm transition-colors ${L===m.key?"bg-orange-500/20 text-orange-300 border border-orange-500/30":"text-white/60 hover:text-white border border-transparent hover:bg-white/5"}`,children:m.label},m.key))}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[S&&e.jsx("p",{className:"text-red-400 text-sm mb-3",children:S}),A?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(Js,{className:"w-6 h-6 animate-spin text-orange-400"})}):F.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-white/40",children:[e.jsx(zr,{className:"w-12 h-12 mb-3 opacity-40"}),e.jsx("p",{className:"text-sm",children:L==="pending"?"当前没有待审批的申请":"暂无记录"})]}):e.jsx("div",{className:"space-y-2",children:F.map(m=>e.jsxs("div",{className:"bg-white/[0.04] border border-white/10 rounded-xl p-4 flex items-start gap-4",children:[e.jsx("div",{className:"shrink-0",children:m.avatar_url?e.jsx("img",{src:m.avatar_url,alt:"",className:"w-10 h-10 rounded-full object-cover"}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-orange-500/30 to-amber-500/30 flex items-center justify-center text-sm font-medium text-white/80",children:(m.nickname||m.email).slice(0,1).toUpperCase()})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 mb-0.5",children:[e.jsx("span",{className:"text-sm font-medium text-white truncate",children:m.nickname||"(未设置昵称)"}),e.jsx("span",{className:"text-xs text-white/40 truncate",children:m.email})]}),e.jsxs("p",{className:"text-xs text-white/50 mb-2",children:["申请于 ",ea(m.applied_at),m.reviewed_at&&m.status!=="pending"&&e.jsxs(e.Fragment,{children:[" · ",m.status==="approved"?"已通过":"已拒绝"," ",ea(m.reviewed_at)]})]}),e.jsx("p",{className:"text-sm text-white/70 leading-relaxed whitespace-pre-wrap break-words",children:m.reason||e.jsx("span",{className:"text-white/30 italic",children:"(用户没有填写理由)"})})]}),e.jsx("div",{className:"shrink-0 flex items-center gap-1.5",children:m.status==="pending"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>R(m),disabled:P===m.id,className:"flex items-center gap-1 px-3 py-1.5 rounded-lg bg-emerald-500/20 hover:bg-emerald-500/30 text-emerald-300 text-xs font-medium border border-emerald-500/30 disabled:opacity-50 transition-colors",children:[P===m.id?e.jsx(Js,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(xt,{className:"w-3.5 h-3.5"}),"通过"]}),e.jsxs("button",{onClick:()=>W(m),disabled:P===m.id,className:"flex items-center gap-1 px-3 py-1.5 rounded-lg bg-white/5 hover:bg-red-500/20 text-white/60 hover:text-red-300 text-xs font-medium border border-white/10 hover:border-red-500/30 disabled:opacity-50 transition-colors",children:[e.jsx(Hr,{className:"w-3.5 h-3.5"}),"拒绝"]})]}):m.status==="approved"?e.jsxs("span",{className:"flex items-center gap-1 text-xs text-emerald-400",children:[e.jsx(Jr,{className:"w-3.5 h-3.5"})," 已通过"]}):e.jsxs("span",{className:"flex items-center gap-1 text-xs text-white/40",children:[e.jsx(qr,{className:"w-3.5 h-3.5"})," 已拒绝"]})})]},m.id))})]})]})})})}function Rl({user:x,loading:w,onLoginClick:L,onLogout:G,onRedeemClick:F}){const f=gr(),A=()=>window.matchMedia("(min-width: 768px)").matches,[D,P]=a.useState(null),[M,S]=a.useState(!0),[O,T]=a.useState(null),[R,W]=a.useState(10),[m,V]=a.useState(100),[E,le]=a.useState("GIFT"),[Y,we]=a.useState(0),[q,j]=a.useState(0),[y,o]=a.use
1State(0),[n,b]=a.useState([]),[u,N]=a.useState(!1),[v,ie]=a.useState("all"),[Z,ht]=a.useState(""),[fe,mt]=a.useState(""),[ne,bt]=a.useState(100),[oe,Oe]=a.useState(""),[_e,l]=a.useState(!1),[d,de]=a.useState(""),[$,ce]=a.useState(""),[Ve,aa]=a.useState(!1),[ze,Et]=a.useState([]),[xe,pt]=a.useState("ALL"),[He,Ft]=a.useState(!1),[Ut,ra]=a.useState(null),[la,Rt]=a.useState(0),[Kt,ia]=a.useState(!1),[Bt,Gt]=a.useState(!1),[he,Je]=a.useState(""),[Ot,na]=a.useState(0),[je,oa]=a.useState(""),[Ie,Vt]=a.useState(0),[Ae,zt]=a.useState(0),[ve,Ht]=a.useState(""),[Jt,qt]=a.useState(!1),[qe,da]=a.useState(1),[$e,ca]=a.useState(400),[Le,xa]=a.useState(10),[Qe,ha]=a.useState([]),[Qt,Xt]=a.useState(!1),[ma,Wt]=a.useState(null),[ba,Yt]=a.useState(!1),[pa,me]=a.useState(!1),[ua,Zt]=a.useState(!1),[es,ga]=a.useState([]),[Ne,ut]=a.useState([]),[ts,wa]=a.useState("ALL"),[ee,fa]=a.useState(""),[De,ja]=a.useState(""),[p,ss]=a.useState(null),[va,as]=a.useState(!1),[Na,be]=a.useState(!1),[g,ya]=a.useState(null),[Ca,rs]=a.useState(!1),[ka,Xe]=a.useState(!1),[gt,Sa]=a.useState(0),[ls,is]=a.useState(0),[wt,_a]=a.useState(!0),[We,ns]=a.useState(!1),[U,Ia]=a.useState(""),[Ye,ye]=a.useState(!1),[Aa,os]=a.use
1State(!1),[ds,$a]=a.useState([]),[Pe,cs]=a.useState(null),[xs,La]=a.useState("ALL"),[pe,hs]=a.useState(!0),[ms,bs]=a.useState("Google服务提桶跑路,稍后再来看看吧"),[ps,us]=a.useState(!1),[ft,Da]=a.useState("aistudio"),[gs,ws]=a.useState(!1),[Ce,te]=a.useState([]),[fs,Pa]=a.useState("Vivart 官方"),[Me,js]=a.useState(""),[vs,Ns]=a.useState(!1),[_,Ma]=a.useState("all"),[Te,Ta]=a.useState(""),[Ze,Ea]=a.useState(""),[et,Fa]=a.useState([]),[se,Ua]=a.useState(null),[Ra,ys]=a.useState(!1),[Cs,Ka]=a.useState([]),[ks,Ba]=a.useState("all"),[jt,Ss]=a.useState(!1),[Ga,_s]=a.useState(null),[Q,Oa]=a.useState(null),[Is,Va]=a.useState([]),[z,za]=a.useState(null),[Ha,vt]=a.useState(!1),[tt,As]=a.useState(""),[st,$s]=a.useState(""),[Ls,Ds]=a.useState(!1),[Ee,H]=a.useState([]),[Ps,ke]=a.useState([]),[Ja,at]=a.useState(!1),[ue,qa]=a.useState("aistudio"),[rt,Nt]=a.useState(""),[yt,Ct]=a.useState(""),[kt,St]=a.useState(""),[_t,It]=a.useState(""),[Ms,Ts]=a.useState(!1),[Es,Fs]=a.useState(null);a.useEffect(()=>{if(console.log("[AdminDashboard] 权限检查 - authLoading:",w,"user:",x),w){console.log("[AdminDashboard] 正在加载用户信息,等待...");return}if(!x){console.log("[AdminDashboard] 用户未登录,重定向到首页"),f("/",{replace:!0});return}if(console.log("[AdminDashboard] 用户角色:",x.role),x.role!=="admin"){console.log("[AdminDashboard] 用户不是管理员,角色为:",x.role),alert("⛔️ 需要管理员权限,当前角色:"+x.role),f("/",{replace:!0});return}console.log("[AdminDashboard] 权限验证通过,开始加载数据"),Qa(),Xa(),At();const s=new URLSearchParams(window.location.search).get("ledgerUser");s&&(Je(s),pt("ALL"),X("ALL",!1,s),window.history.replaceState({},"",window.location.pathname),setTimeout(()=>{document.getElementById("ledger-section")?.scrollIntoView({behavior:"smooth"})},500))},[x,w,f]);const Qa=async()=>{if(x)try{S(!0);const t=localStorage.getItem("jwt_token")||"",s=await it(t);P(s.data);try{const r=await Os(t,"ALL",1,0);cs(r.stats||null)}catch(r){console.error("Failed to load invite codes stats:",r)}}catch(t){console.error("Failed to load stats:",t),alert("加载统计数据失败:"+t.message)}finally{S(!1)}},Xa=async()=>{try{const t=localStorage.getItem("jwt_token")||"",s=await ta(t);if(s.settings?.generate_enabled&&hs(s.settings.generate_enabled.value!=="false"),s.settings?.generate_disabled_message&&bs(s.settings.generate_disabled_message.value||"Google服务提桶跑路,稍后再来看看吧"),s.settings?.api_provider){const r=s.settings.api_provider.value;(r==="aistudio"||r==="vertex"||r==="vertex-iam")&&Da(r)}s.modelSettings&&Array.isArray(s.modelSettings)&&te(s.modelSettings);try{const r=await K(t);H(r.routes),ke(r.credentials)}catch{console.log("No API credentials configured or endpoint not available")}}catch(t){console.error("Failed to load system settings:",t)}},Wa=async()=>{try{us(!0);const t=localStorage.getItem("jwt_token")||"";await zs(t,{generate_enabled:pe,generate_disabled_message:ms}),alert("✅ 设置已保存")}catch(t){alert("保存失败:"+t.message)}finally{us(!1)}},Ya=async()=>{try{ws(!0);const t=localStorage.getItem("jwt_token")||"";await zs(t,{api_provider:ft,model_settings:Ce.map(s=>({id:s.id,enabled:s.enabled,pointsCost:s.pointsCost,accessLevel:s.accessLevel,extraConfig:s.extraConfig}))}),alert("✅ 设置已保存")}catch(t){alert("保存失败:"+t.message)}finally{ws(!1)}},Za=async()=>{if(!Me.trim()){alert("请输入消息内容");return}if(_==="specific"&&!Te.trim()){alert("请输入目标用户邮箱");return}if(_==="registered_after"&&!Ze){alert("请选择注册日期");return}if(_==="airdrop_batch"&&!se){alert("请选择空投批次");return}let t="";if(_==="all")t="全体用户";else if(_==="specific")t=Te;else if(_==="registered_after")t=`${Ze} 后注册的用户`;else if(_==="airdrop_batch"){const s=et.find(r=>r.created_at===se.created_at&&r.reference===se.reference);t=`空投批次「${se.reference}」的 ${s?.user_count||"?"} 位用户`}if(confirm(`确认发送广播给 ${t}?
2
3内容:${Me.slice(0,100)}`))try{Ns(!0);const s=localStorage.getItem("jwt_token")||"",r=await Cr(s,fs,Me,_,_==="specific"?Te.trim():void 0,_==="registered_after"?Ze:void 0,_==="airdrop_batch"?se.created_at:void 0,_==="airdrop_batch"?se.reference:void 0);alert(`✅ ${r.message}`),js("")}catch(s){alert("发送失败:"+s.message)}finally{Ns(!1)}},At=async(t="all")=>{try{Ss(!0);const s=localStorage.getItem("jwt_token")||"",r=await wr(s,{limit:100,filter:t});
3Ka(r.logs),Oa(r.recentStats),Va(r.stats),za(r.orphans??null)}catch(s){console.error("Failed to load generation logs:",s)}finally{Ss(!1)}},er=async()=>{try{const t=localStorage.getItem("jwt_token")||"";await kr(t)}catch(t){alert("导出失败:"+t.message)}},tr=async()=>{if(x){if(R<1||R>1e3){alert("生成数量必须在 1-1000 之间");return}if(E==="PAID"){if(q<=0){alert("本金积分必须大于 0");return}if(Y<=0){alert("价格(CNY)必须大于 0");return}}else if(m<1||m>1e5){alert("积分数量必须在 1-100000 之间");return}try{N(!0);const t=localStorage.getItem("jwt_token")||"",r=await Sr(t,E==="PAID"?{count:R,type:"PAID",base_points:q,bonus_points:y,price_cny:Y}:{count:R,type:"GIFT",points:m});b(r.coupons),alert(`✅ 成功生成 ${r.coupons.length} 个${E==="PAID"?"付费":"福利"}卡密`);try{const i=localStorage.getItem("jwt_token")||"",c=await it(i);P(c.data)}catch(i){console.error("Failed to silently refresh stats:",i)}}catch(t){console.error("Failed to generate coupons:",t),alert("生成卡密失败:"+t.message)}finally{N(!1)}}},sr=async()=>{if(!x)return;if(ne<1||ne>1e5){alert("积分数量必须在 1-100000 之间");return}if(!oe.trim()){alert("请填写空投原因");return}if(v==="specific"&&!Z.trim()){alert("请输入目标用户邮箱");return}if(v==="registered_after"&&!fe){alert("请选择注册日期");return}if(v==="by_condition"&&!(d!=="")&&!($!=="")&&!Ve){alert("请至少设置一个筛选条件(余额范围或无充值历史)");return}let t="";if(v==="all")t="全体用户";else if(v==="specific")t=`用户 ${Z}`;else if(v==="registered_after")t=`${fe} 后注册的用户`;else if(v==="by_condition"){const s=[];if(d!==""||$!==""){const r=d!==""?d:"不限",i=$!==""?$:"不限";s.push(`余额 ${r}~${i}`)}Ve&&s.push("从未获得过积分"),t=`条件筛选(${s.join(",")})的用户`}if(confirm(`确认向 ${t} 空投 ${ne} 积分?
4原因: ${oe}`))try{l(!0);const s=localStorage.getItem("jwt_token")||"",r=await _r(s,{target:v,email:v==="specific"?Z.trim():void 0,registeredAfter:v==="registered_after"?fe:void 0,balanceMin:v==="by_condition"&&d!==""?parseInt(d):void 0,balanceMax:v==="by_condition"&&$!==""?parseInt($):void 0,neverReceivedPoints:v==="by_condition"?Ve:void 0,points:ne,reason:oe.trim()});alert(`✅ ${r.message}`),Oe(""),X(xe);try{const i=await it(s);P(i.data)}catch{}}catch(s){alert("空投失败:"+s.message)}finally{l(!1)}},ar=async()=>{if(!x)return;if(!je.trim()){alert("请输入用户邮箱");return}if(!ve.trim()){alert("请填写退款原因");return}if(Ae<0){alert("退款金额不能为负数");return}if(Ie<0){alert("退还积分不能为负数");return}const t=Ie>0?`确认从 ${je} 扣减 ${Ie} 积分,记录退款 ¥${Ae}?
5原因: ${ve}`:`确认记录退款 ¥${Ae} 给 ${je}(仅记账,不扣减积分)?
6原因: ${ve}`;if(confirm(t))try{qt(!0);const s=localStorage.getItem("jwt_token")||"",r=await Ir(s,{email:je.trim(),points:Ie,amountCny:Ae,reason:ve.trim()});alert(`✅ ${r.message}`),Ht(""),Vt(0),zt(0),X(xe);try{const i=await it(s);P(i.data)}catch{}}catch(s){alert("退款失败:"+s.message)}finally{qt(!1)}},X=async(t="ALL",s=!1,r=he)=>{try{s?Gt(!0):(Ft(!0),Rt(0));const i=localStorage.getItem("jwt_token")||"",c=s?la:0,h=await fr(i,t,50,c,r),C=h.data||[];Et(s?I=>[...I,...C]:C),ra(h.stats||null),ia(h.pagination?.hasMore||!1),na(h.pagination?.total||0),Rt(c+C.length)}catch(i){console.error("Failed to load ledger:",i)}finally{Ft(!1),Gt(!1)}},rr=t=>{if(Bt||!Kt)return;const{scrollTop:s,scrollHeight:r,clientHeight:i}=t.currentTarget;r-s-i<100&&X(xe,!0,he)},lr=()=>{Je(""),X(xe,!1,"")},ir=(t,s)=>{navigator.clipboard.writeText(t),T(s),setTimeout(()=>T(null),2e3)},nr=()=>{const t=n.map(s=>s.code).join(`
7`);navigator.clipboard.writeText(t),alert("✅ 已复制所有卡密到剪贴板")},or=async()=>{if(x){if(qe<1||qe>100){alert("生成数量必须在 1-100 之间");return}if($e<1||$e>1e5){alert("积分面额必须在 1-100000 之间");return}if(Le<1||Le>1e4){alert("可用次数必须在 1-10000 之间");return}try{Xt(!0);const t=localStorage.getItem("jwt_token")||"",s=await Ar(t,qe,$e,Le);ha(s.codes),alert(`✅ 成功生成 ${s.codes.length} 个邀请码`)}catch(t){console.error("Failed to generate invitation codes:",t),alert("生成邀请码失败:"+t.message)}finally{Xt(!1)}}},dr=(t,s)=>{navigator.clipboard.writeText(t),Wt(s),setTimeout(()=>Wt(null),2e3)},cr=()=>{const t=Qe.join(`
8`);navigator.clipboard.writeText(t),alert("✅ 已复制所有邀请码到剪贴板")},Us=async(t="ALL")=>{try{ye(!0);const s=localStorage.getItem("jwt_token")||"";if(console.log("[AdminDashboard] Loading coupons list, filter:",t,"token exists:",!!s),!s)throw new Error("请先登录");const r=await $r(s,t,100,0);console.log("[AdminDashboard] Coupons loaded:",r),ga(r.data||[])}catch(s){console.error("[AdminDashboard] Failed to load coupons:",s),alert("加载卡密列表失败:"+s.message)}finally{ye(!1)}},Se=async(t="",s=!1,r=U,i)=>{const h=i!==void 0?i:De;try{s?ns(!0):(ye(!0),is(0),ut([]));const C=localStorage.getItem("jwt_token")||"";if(!C)throw new Error("请先登录");const I=s?ls:0,J=await Lr(C,30,I,t,r,h);console.log("[AdminDashboard] Users loaded:",J);const lt=J.data||[],Gs=J.pagination?.total||0;ut(s?pr=>[...pr,...lt]:lt),Sa(Gs),is(I+lt.length),_a(I+lt.length<Gs)}catch(C){console.error("[AdminDashboard] Failed to load users:",C),alert("加载用户列表失败:"+C.message)}finally{ye(!1),ns(!1)}},Fe=async t=>{try{as(!0),be(!0);const s=localStorage.getItem("jwt_token")||"",r=await Dr(s,t);ss(r.data)}catch(s){console.error("Failed to load user detail:",s),be(!1)}finally{as(!1)}},Rs=async(t,s)=>{if(p){if(!s){const r=t==="can_publish"?`确定限制「${p.nickname}」公开作品吗?
9将立即下架其名下所有已公开作品,且其无法再公开。`:`确定限制「${p.nickname}」分享作品吗?
10将吊销其名下所有私密分享链接,且其无法再生成分享链接。`;if(!confirm(r))return}try{const r=localStorage.getItem("jwt_token")||"",i=await fetch("/api/admin/users/permissions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({userId:p.id,[t]:s})});if(!i.ok){const c=await i.json().catch(()=>null);throw new Error(c?.error||"操作失败")}ss(c=>c&&{...c,[t]:s?1:0})}catch(r){alert(r.message||"操作失败")}}},$t=async t=>{try{rs(!0),Xe(!0);const s=localStorage.getItem("jwt_token")||"",r=await Pr(s,t);ya(r.data)}catch(s){console.error("Failed to load task detail:",s),Xe(!1)}finally{rs(!1)}},Ks=a.useCallback(t=>{const s=t.currentTarget;if(We||!wt)return;(s.scrollTop+s.clientHeight)/s.scrollHeight>.8&&Se(ee,!0,U)},[We,wt,ee,ls,U,De]),Ue=t=>{const s=U===t?"":t;Ia(s),Se(ee,!1,s)},xr=t=>{const s=De===t?"":t;ja(s),Se(ee,!1,U,s)},hr=()=>{Yt(!0),Us(ts)},mr=()=>{me(!0),Se(ee,!1,"")},Bs=async(t="ALL")=>{try{ye(!0);const s=localStorage.getItem("jwt_token")||"";if(!s)throw new Error("请先登录");const r=await Os(s,t,100,0);$a(r.data||[]),cs(r.stats||null)}catch(s){console.error("[AdminDashboard] Failed to load invitation codes:",s),alert("加载邀请码列表失败:"+s.message)}finally{ye(!1)}},br=()=>{os(!0),Bs(xs)};return M?e.jsx(jr,{}):e.jsxs("div",{className:"min-h-screen bg-black text-white",children:[e.jsx(vr,{user:x,onLoginClick:L,onLogout:G,onRedeemClick:F}),e.jsxs("div",{className:"w-full max-w-[1400px] mx-auto px-1 md:px-6 py-20",children:[e.jsxs(k.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"mb-12",children:[e.jsx("h1",{className:"text-5xl font-bold mb-4 bg-gradient-to-r from-accent via-orange-400 to-yellow-400 bg-clip-text text-transparent",children:"管理后台"}),e.jsx("p",{className:"text-white/60 text-lg",children:"运营中台 · Admin Dashboard"}),e.jsxs("div",{className:"mt-6 flex flex-wrap gap-3",children:[e.jsxs("button",{onClick:()=>f("/admin/assets"),className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-white/[0.08] to-white/[0.04] hover:from-white/[0.12] hover:to-white/[0.08] border border-white/10 hover:border-white/25 rounded-xl transition-all duration-300 hover:shadow-[0_0_20px_rgba(34,197,94,0.15)] group",children:[e.jsx(Yr,{className:"w-4 h-4 text-green-400 group-hover:text-green-300"}),e.jsx("span",{className:"text-sm font-medium",children:"资源管理"})]}),e.jsxs("button",{onClick:()=>f("/admin/generations"),className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-white/[0.08] to-white/[0.04] hover:from-white/[0.12] hover:to-white/[0.08] border border-white/10 hover:border-white/25 rounded-xl transition-all duration-300 hover:shadow-[0_0_20px_rgba(168,85,247,0.15)] group",children:[e.jsx(qs,{className:"w-4 h-4 text-purple-400 group-hover:text-purple-300"}),e.jsx("span",{className:"text-sm font-medium",children:"作品管理"})]}),e.jsxs("button",{onClick:()=>f("/admin/poster-generator"),className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-white/[0.08] to-white/[0.04] hover:from-white/[0.12] hover:to-white/[0.08] border border-white/10 hover:border-white/25 rounded-xl transition-all duration-300 hover:shadow-[0_0_20px_rgba(59,130,246,0.15)] group",children:[e.jsx(tl,{className:"w-4 h-4 text-blue-400 group-hover:text-blue-300"}),e.jsx("span",{className:"text-sm font-medium",children:"海报生成"})]}),e.jsxs("button",{onClick:()=>f("/admin/lab-content"),className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-white/[0.08] to-white/[0.04] hover:from-white/[0.12] hover:to-white/[0.08] border border-white/10 hover:border-white/25 rounded-xl transition-all duration-300 hover:shadow-[0_0_20px_rgba(245,158,11,0.15)] group",children:[e.jsx(dt,{className:"w-4 h-4 text-amber-400 group-hover:text-amber-300"}),e.jsx("span",{className:"text-sm font-medium",children:"演示管理"})]}),e.jsxs("button",{onClick:()=>Zt(!0),className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-white/[0.08] to-white/[0.04] hover:from-white/[0.12] hover:to-white/[0.08] border border-white/10 hover:border-white/25 rounded-xl transition-all duration-300 hover:shadow-[0_0_20px_rgba(249,115,22,0.15)] group",children:[e.jsx(Zr,{className:"w-4 h-4 text-orange-400 group-hover:text-orange-300"}),e.jsx("span",{className:"text-sm font-medium",children:"内测申请"})]}),e.jsxs("button",{onClick:()=>f("/admin/prompts"),className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-white/[0.08] to-white/[0.04] hover:from-white/[0.12] hover:to-white/[0.08] border border-white/10 hover:border-white/25 rounded-xl transition-all duration-300 hover:shadow-[0_0_20px_rgba(6,182,212,0.15)] group",children:[e.jsx(ll,{className:"w-4 h-4 text-cyan-400 group-hover:text-cyan-300"}),e.jsx("span",{className:"text-sm font-medium",children:"提示词库"})]}),e.jsxs("button",{onClick:()=>f("/admin/chat-models"),className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-white/[0.08] to-white/[0.04] hover:from-white/[0.12] hover:to-white/[0.08] border border-white/10 hover:border-white/25 rounded-xl transition-all duration-300 hover:shadow-[0_0_20px_rgba(99,102,241,0.15)] group",children:[e.jsx(sa,{className:"w-4 h-4 text-indigo-400 group-hover:text-indigo-300"}),e.jsx("span",{className:"text-sm font-medium",children:"模型管理"})]}),e.jsxs("button",{onClick:()=>f("/admin/orgs"),className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-white/[0.08] to-white/[0.04] hover:from-white/[0.12] hover:to-white/[0.08] border border-white/10 hover:border-white/25 rounded-xl transition-all duration-300 hover:shadow-[0_0_20px_rgba(20,184,166,0.15)] group",children:[e.jsx(al,{className:"w-4 h-4 text-teal-400 group-hover:text-teal-300"}),e.jsx("span",{className:"text-sm font-medium",children:"机构管理"})]})]})]}),e.jsxs("div",{className:"w-full grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 ga
10p-4 mb-12",children:[e.jsx(Be,{icon:Xs,label:"总用户数",value:D?.totalUsers||0,color:"blue",delay:0,onClick:mr}),e.jsx(Be,{icon:Qr,label:"已分发积分",value:D?.totalPointsDistributed||0,color:"orange",delay:.1}),e.jsx(Be,{icon:Ws,label:"未使用卡密",value:D?.activeCoupons||0,color:"green",delay:.2,onClick:hr}),e.jsx(Be,{icon:Ke,label:"有效邀请码",value:Pe?.activeCount||0,color:"yellow",delay:.25,onClick:br}),e.jsx(Be,{icon:il,label:"最近7天新用户",value:D?.recentUsers||0,color:"blue",delay:.3})]}),e.jsxs(k.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.35},className:"w-full bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-6 mb-6 hover:border-white/20 transition-colors",children:[e.jsxs("h2",{className:"text-xl font-bold mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-red-500 to-orange-500 flex items-center justify-center shadow-lg",children:e.jsx(sl,{className:"w-5 h-5 text-white"})}),"系统控制"]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-3 h-3 rounded-full ${pe?"bg-green-500 animate-pulse":"bg-red-500"}`}),e.jsx("span",{className:"font-medium",children:"生成功能"}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${pe?"bg-green-500/20 text-green-400":"bg-red-500/20 text-red-400"}`,children:pe?"已开启":"已关闭"})]}),e.jsx("button",{onClick:()=>hs(!pe),className:`relative w-14 h-7 rounded-full transition-colors ${pe?"bg-green-500":"bg-gray-600"}`,children:e.jsx("div",{className:`absolute top-0.5 w-6 h-6 bg-white rounded-full transition-transform ${pe?"left-7":"left-0.5"}`})})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"关闭时的提示文案"}),e.jsx("input",{type:"text",value:ms,onChange:t=>
10bs(t.target.value),placeholder:"输入禁用时的提示...",className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-accent transition-colors"})]}),e.jsx("button",{onClick:Wa,disabled:ps,className:"w-full bg-gradient-to-r from-accent to-blue-600 hover:from-blue-600 hover:to-accent text-white font-medium px-4 py-2.5 rounded-lg transition-all duration-300 disabled:opacity-50 text-sm",children:ps?"保存中...":"保存设置"})]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(nl,{className:"w-4 h-4 text-orange-400"}),e.jsx("span",{className:"font-medium",children:"广播系统消息"})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"发送目标"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:[{id:"all",label:"全体用户",color:"orange"},{id:"specific",label:"指定用户",color:"blue"},{id:"registered_after",label:"指定日期后注册",color:"purple"},{id:"airdrop_batch",label:"指定空投批次",color:"emerald"}].map(({id:t,label:s,color:r})=>e.jsx("button",{onClick:async()=>{if(Ma(t),t==="airdrop_batch"&&et.length===0)try{ys(!0);const i=localStorage.getItem("jwt_token")||"",c=await Nr(i);Fa(c.batches||[])}catch(i){alert("加载空投批次失败: "+i.message)}finally{ys(!1)}},className:`px-3 py-1.5 rounded-lg text-xs transition-all border ${_===t?`bg-${r}-500/20 border-${r}-500/40 text-${r}-400`:"bg-white/5 border-white/5 text-white/40 hover:text-white/60"}`,children:s},t))})]}),_==="specific"&&e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"目标用户邮箱"}),e.jsx("input",{type:"email",value:Te,onChange:t=>Ta(t.target.value),placeholder:"输入用户邮箱",className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-blue-400 transition-colors"})]}),_==="registered_after"&&e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"注册日期之后"}),e.jsx("input",{type:"date",value:Ze,onChange:t=>Ea(t.target.value),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-purple-400 transition-colors"})]}),_==="airdrop_batch"&&e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"选择空投批次"}),Ra?e.jsx("div",{className:"text-center py-4 text-white/40 text-sm",children:"加载中..."}):et.length===0?e.jsx("div",{className:"text-center py-4 text-white/30 text-sm",children:"暂无空投记录"}):e.jsx("div",{className:"max-h-48 overflow-y-auto space-y-1.5 bg-black/20 rounded-lg p-2",children:et.map((t,s)=>{const r=se?.created_at===t.created_at&&se?.reference===t.reference,i=new Date(t.created_at*1e3).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});return e.jsxs("button",{onClick:()=>Ua({created_at:t.created_at,reference:t.reference}),className:`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-all border ${r?"bg-emerald-500/20 border-emerald-500/40 text-emerald-300":"bg-white/5 border-white/5 text-white/60 hover:bg-white/10 hover:text-white/80"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium truncate",children:t.reference}),e.jsx("span",{className:"text-xs text-white/40 shrink-0 ml-2",children:i})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-white/40",children:[e.jsxs("span",{children:[t.user_count," 位用户"]}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:["每人 ",t.amount," 积分"]})]})]},s)})})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"发送人"}),e.jsx("input",{type:"text",value:fs,onChange:t=>Pa(t.target.value),placeholder:"Vivart 官方",className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-accent transition-colors"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"消息内容"}),e.jsx("textarea",{value:Me,onChange:t=>js(t.target.value),placeholder:"输入要发送的消息...",rows:3,className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-accent transition-colors resize-none"})]}),e.jsxs("button",{onClick:Za,disabled:vs||!Me.trim(),className:"w-full bg-gradient-to-r from-orange-500 to-red-500 hover:from-red-500 hover:to-orange-500 text-white font-medium px-4 py-2.5 rounded-lg transition-all duration-300 disabled:opacity-50 flex items-center justify-center gap-2 text-sm",children:[e.jsx(Qs,{className:"w-4 h-4"}),vs?"发送中...":_==="all"?"发送给全体用户":_==="specific"?`发送给 ${Te||"指定用户"}`:_==="airdrop_batch"?"发送给空投批次用户":"发送给指定日期后注册用户"]})]})]})]}),e.jsxs(k.div,{initial:{opacity:0,y:20}
10,animate:{opacity:1,y:0},transition:{delay:.37},className:"w-full bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-6 mb-6 hover:border-white/20 transition-colors",children:[e.jsxs("h2",{className:"text-xl font-bold mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-purple-500 to-indigo-500 flex items-center justify-center shadow-lg",children:e.jsx(Ke,{className:"w-5 h-5 text-white"})}),"AI 通道设置"]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-3",children:"Gemini 默认通道"}),e.jsx("div",{className:"space-y-2",children:[{id:"aistudio",name:"脉冲引擎",desc:"AI Studio / API Key",color:"blue"},{id:"vertex",name:"星云引擎",desc:"Vertex AI / Express API",color:"purple"},{id:"vertex-iam",name:"矩阵引擎",desc:"Vertex IAM / Service Account",color:"green"}].map(t=>{const s=Ee.find(i=>i.route===t.id)?.is_default===1,r=Ee.find(i=>i.route===t.id)?.enabled;return e.jsxs("button",{onClick:async()=>{if(!r){alert("该路由已禁用,请先在下方启用");return}const i=localStorage.getItem("jwt_token");if(!i)return;await ae(i,{route:t.id,setDefault:!0});const c=await K(i);H(c.routes)},disabled:!r,className:`w-full flex items-center gap-3 px-4 py-3 rounded-lg border transition-all ${s?`bg-${t.color}-500/20 border-${t.color}-500/50 text-${t.color}-400`:r?"bg-white/5 border-white/10 text-white/60 hover:bg-white/10":"bg-white/5 border-white/5 text-white/30 curs
10or-not-allowed"}`,children:[e.jsx("div",{className:`w-3 h-3 rounded-full ${s?`bg-${t.color}-500`:"bg-white/20"}`}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsx("div",{className:"text-xs opacity-60",children:t.desc})]}),s&&e.jsx("span",{className:"text-xs px-2 py-0.5 bg-yellow-500/20 text-yellow-400 rounded",children:"默认"}),!r&&e.jsx("span",{className:"text-xs text-red-400",children:"已禁用"})]},t.id)})}),e.jsx("p",{className:"mt-3 text-xs text-white/40",children:"点击选择 Nano Banana Pro 模型的默认后端通道"})]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-cyan-500/20 lg:col-span-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("label",{className:"block text-sm text-cyan-400",children:"🌐 Gemini 服务器路由管理"}),e.jsxs("button",{onClick:()=>at(!0),className:"flex items-center gap-1 px-3 py-1.5 bg-cyan-500/20 text-cyan-400 rounded-lg hover:bg-cyan-500/30 transition-all text-sm",children:[e.jsx(Ge,{className:"w-4 h-4"}),"添加凭据"]})]}),e.jsx("div",{className:"grid grid-cols-3 gap-2 mb-4",children:Ee.map(t=>{const s=Ps.filter(c=>c.route===t.route).length,i={aistudio:"blue",vertex:"purple","vertex-iam":"green"}[t.route]||"gray";return e.jsxs("div",{className:`p-3 rounded-lg border ${t.enabled?`bg-${i}-500/10 border-${i}-500/30`:"bg-white/5 border-white/10 opacity-50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:`font-medium text-sm ${t.enabled?`text-${i}-400`:"text-white/40"}`,children:t.display_name}),t.is_default===1&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-yellow-500/20 text-yellow-400 rounded",children:"默认"})]}),e.jsxs("div",{className:"text-xs text-white/50 mt-1",children:[s," 个凭据 | ",t.enabled?"已启用":"已禁用"]}),e.jsxs("div",{className:"flex items-center gap-1 mt-2",children:[e.jsxs("select",{value:t.visibility||"all",onChange:async c=>{const h=localStorage.getItem("jwt_token");if(!h)return;await ae(h,{route:t.route,visibility:c.target.value});const C=await K(h);H(C.routes)},className:"text-xs px-1.5 py-1 bg-white/5 border border-white/10 rounded text-white/70 cursor-pointer",children:[e.jsx("option",{value:"all",children:"所有人"}),e.jsx("option",{value:"paid",children:"付费用户"}),e.jsx("option",{value:"admin",children:"仅管理员"})]}),!t.is_default&&t.enabled&&e.jsx("button",{onClick:async()=>{const c=localStorage.getItem("jwt_token");if(!c)return;await ae(c,{route:t.route,setDefault:!0});const h=await K(c);H(h.routes)},className:"text-xs px-2 py-1 bg-yellow-500/20 text-yellow-400 rounded hover:bg-yellow-500/30",children:"设为默认"}),e.jsx("button",{onClick:async()=>{const c=localStorage.getItem("jwt_token");if(!c)return;await ae(c,{route:t.route,routeEnabled:!t.enabled});const h=await K(c);H(h.routes)},className:`text-xs px-2 py-1 rounded ${t.enabled?"bg-red-500/20 text-red-400 hover:bg-red-500/30":"bg-green-500/20 text-green-400 hover:bg-green-500/30"}`,children:t.enabled?"禁用":"启用"})]})]},t.route)})}),["aistudio","vertex","vertex-iam"].map(t=>{const s=Ps.filter(h=>h.route===t),r=Ee.find(h=>h.route===t);if(!r)return null;const c={aistudio:"blue",vertex:"purple","vertex-iam":"green"}[t];return e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:`text-xs text-${c}-400 mb-2 flex items-center gap-2`,children:[e.jsx("div",{className:`w-2 h-2 rounded-full bg-${c}-500`}),r.display_name," (",s.length,")"]}),s.length===0?e.jsx("div",{className:"text-xs text-white/30 pl-4",children:"暂无凭据"}):e.jsx("div",{className:"space-y-1.5 pl-4",children:s.map((h,C)=>e.jsxs("div",{className:`flex items-center justify-between p-2 rounded-lg border text-sm ${h.enabled?C===0?`bg-${c}-500/10 border-${c}-500/30`:"bg-white/5 border-white/10":"bg-red-500/5 border-red-500/20 opacity-60"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${h.enabled?h.consecutiveFailures>0?"bg-yellow-500":C===0?`bg-${c}-500 animate-pulse`:"bg-white/30":"bg-red-500"}`}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-white",children:h.label}),C===0&&h.enabled&&e.jsx("span",{className:"text-xs ml-2 text-green-400",children:"[活跃]"}),!h.enabled&&e.jsx("span",{className:"text-xs ml-2 text-red-400",children:"[熔断]"}),h.consecutiveFailures>0&&h.enabled&&e.jsxs("span",{className:"text-xs ml-2 text-yellow-400",children:["[失败:",h.consecutiveFailures,"]"]})]}),e.jsx("span",{className:"text-xs text-white/40",children:h.apiKeyMasked||h.clientEmailMasked||"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[C>0&&e.jsx("button",{onClick:async()=>{const I=localStorage.getItem("jwt_token");if(!I)return;await ae(I,{id:h.id,priority:-1});const J=await K(I);ke(J.credentials)},className:"text-xs px-2 py-1 bg-blue-500/20 text-blue-400 rounded hover:bg-blue-500/30",title:"置顶",children:"↑"}),h.consecutiveFailures>0&&e.jsx("button",{onClick:async()=>{const I=localStorage.getItem("jwt_token");if(!I)return;await ae(I,{id:h.id,resetFailures:!0});const J=await K(I);ke(J.credentials)},className:"text-xs px-2 py-1 bg-yellow-500/20 text-yellow-400 rounded hover:bg-yellow-500/30",children:"重置"}),e.jsx("button",{onClick:async()=>
10{if(confirm(`确定删除 "${h.label}" 吗?`)){Fs(h.id);try{const I=localStorage.getItem("jwt_token");if(!I)return;await yr(I,h.id);const J=await K(I);ke(J.credentials),H(J.routes)}catch(I){alert(I.message)}finally{Fs(null)}}},disabled:Es===h.id,className:"text-xs px-2 py-1 bg-red-500/20 text-red-400 rounded hover:bg-red-500/30 disabled:opacity-50",children:Es===h.id?"...":"×"})]})]},h.id))})]},t)}),e.jsxs("div",{className:"mt-4 pt-4 border-t border-white/10",children:[e.jsx("div",{className:"text-xs text-white/50 mb-3",children:"⚡ 熔断保护设置 (各路由独立生效)"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:Ee.map(t=>{const r={aistudio:"blue",vertex:"purple","vertex-iam":"green"}[t.route]||"gray";return e.jsxs("div",{className:`p-3 rounded-lg bg-${r}-500/5 border border-${r}-500/20`,children:[e.jsx("div",{className:`text-xs text-${r}-400 mb-2 font-medium`,children:t.display_name}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-white/60",children:[e.jsxs("label",{className:"flex items-center gap-1",children:["熔断:",e.jsx("input",{type:"number",value:t.circuit_threshold,onChange:async i=>{const c=localStorage.getItem("jwt_token");if(!c)return;const h=parseInt(i.target.value)||3;await ae(c,{route:t.route,circuitThreshold:h});const C=await K(c);H(C.routes)},className:"w-10 px-1.5 py-1 bg-white/5 border border-white/10 rounded text-center text-white",min:1,max:10}),"次"]}),e.jsxs("label",{className:"flex items-center gap-1",children:["恢复:",e.jsx("input",{type:"number",value:t.circuit_reset_minutes,onChange:async i=>{const c=localStorage.getItem("jwt_token");if(!c)return;const h=parseInt(i.target.value)||30;await ae(c,{route:t.route,circuitResetMinutes:h});const C=await K(c);H(C.routes)},className:"w-12 px-1.5 py-1 bg-white/5 border border-white/10 rounded text-center text-white",min:5,max:1440}),"分"]})]})]},t.route)})}),e.jsx("div",{className:"text-xs text-white/40 mt-2",children:"💡 连续失败达到阈值后自动熔断该 Key,指定时间后自动恢复;最后一个 Key 不会被熔断"})]})]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-3",children:"模型管理"}),e.jsx("div",{className:"space-y-2",children:Ce.map(t=>{const s={"nano-banana-pro":"🍌","nano-banana-2":"🍌","nano-banana":"⚡","flux-klein":"🎨","flux-klein-4b":"🚀","crisp-upscale":"🔍","gpt-image-2":"🎨","gpt-image-2.5-flare":"🎨","gpt-image-2.5-sunburst":"✨"},r={"nano-banana-pro":"按通道设置","nano-banana-2":"按通道设置","nano-banana":"固定 AIStudio","flux-klein":"固定 Replicate","flux-klein-4b":"固定 Replicate","crisp-upscale":"清晰放大","gpt-image-2":"固定 Fal.ai","gpt-image-2.5-flare":"固定 Fal.ai","gpt-image-2.5-sunburst":"固定 Fal.ai"},i={"nano-banana-pro":"12积分 · 2K | 25积分 · 4K","nano-banana-2":"6积分 · 1K | 9积分 · 2K | 15积分 · 4K","nano-banana":"4积分/次 · 1K固定","flux-klein":"3积分/次 · 按MP设置","flux-klein-4b":"1积分/次 · 按MP设置","crisp-upscale":"2积分/次 · 清晰放大","gpt-image-2":"低/中/高 × 1K/2K/4K 浮动计费","gpt-image-2.5-flare":"低→极致 5 档 × 1K/2K/4K 浮动计费 · 快档","gpt-image-2.5-sunburst":"低→极致 5 档 × 1K/2K/4K 浮动计费 · 精工档"};return e.jsxs("div",{className:`flex items-center justify-between px-4 py-3 rounded-lg border transition-all ${t.enabled?"bg-green-500/10 border-green-500/30":"bg-white/5 border-white/10"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-lg",children:s[t.id]||"🤖"}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-white flex items-center gap-2",children:[t.displayName,e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 bg-blue-500/20 text-blue-400 rounded",children:r[t.id]||""})]}),e.jsx("div",{className:"text-xs text-white/50",children:i[t.id]||`${t.pointsCost} 积分/次`})]})]}),e.jsx("button",{onClick:()=>{te(c=>c.map(h=>h.id===t.id?{...h,enabled:!h.enabled}:h))},className:`px-3 py-1 rounded-lg text-sm font-medium transition-all ${t.enabled?"bg-green-500/20 text-green-400 hover:bg-red-500/20 hover:text-red-400":"bg-white/10 text-white/60 hover:bg-green-500/20 hover:text-green-400"}`,children:t.enabled?"已启用":"已禁用"})]},t.id)})})]}),Ce.filter(t=>t.providerType==="replicate").length>0&&e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-3",children:"Replicate 模型设置"}),e.jsx("div",{className:"space-y-4",children:Ce.filter(t=>t.providerType==="replicate").map(t=>{const s=t.id==="real-esrgan";return e.jsxs("div",{className:`p-3 rounded-lg border ${t.enabled?"border-green-500/30 bg-green-500/5":"border-white/10 bg-white/5 opacity-50"}`,children:[e.jsx("div",{className:"text-sm font-medium text-white mb-2",children:t.displayName}),s?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-xs text-white/50 w-16",children:"放大倍数:"}),e.jsx("div",{className:"flex gap-1",children:[2,4,6,8,10].map(r=>e.jsxs("button",{onClick:()=>{te(i=>i.map(c=>c.id===t.id?{...c,extraConfig:{...c.extraConfig,scale:r}}:c))},disabled:!t.enabled,className:`px-2 py-1 text-xs rounded border transition-all ${t.extraConfig?.scale===r?"bg-green-500/20 border-green-500/50 text-green-400":"bg-white/5 border-white/10 text-white/60"} ${t.enabled?"hover:bg-white/10":"cursor-not-allowed"}`,children:[r,"x"]},r))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-white/50 w-16",children:"人脸增强:"}),e.jsx("button",{onClick:()=>{te(r=>r.map(i=>i.id===t.id?{...i,extraConfig:{...i.extraConfig,face_enhance:!i.extraConfig?.face_enhance}}:i))},disabled:!t.enabled,className:`px-2 py-1 text-xs rounded border transition-all ${t.extraConfig?.face_enhance?"bg-green-500/20 border-green-500/50 text-green-400":"bg-white/5 border-white/10 text-white/60"} ${t.enabled?"hover:bg-white/10":"cursor-not-allowed"}`,children:t.extraConfig?.face_enhance?"开启":"关闭"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-xs text-white/50 w-16",children:"输出精度:"}),e.jsx("div",{className:"flex gap-1",children:["1","2","4"].map(r=>e.jsxs("button",{onClick:()=>{te(i=>i.map(c=>c.id===t.id?{...c,extraConfig:{...c.extraConfig,megapixels:r}}:c))},disabled:!t.enabled,className:`px-2 py-1 text-xs rounded border transition-all ${t.extraConfig?.megapixels===r?"bg-green-500/20 border-green-500/50 text-green-400":"bg-white/5 border-white/10 text-white/60"} ${t.enabled?"hover:bg-white/10":"cursor-not-allowed"}`,children:[r,"MP"]},r))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-white/50 w-16",children:"快速模式:"}),e.jsx("button",{onClick:()=>{te(r=>r.map(i=>i.id===t.id?{...i,extraConfig:{...i.extraConfig,go_fast:!i.extraConfig?.go_fast}}:i))},disabled:!t.enabled,className:`px-2 py-1 text-xs rounded border transition-all ${t.extraConfig?.go_fast?"bg-green-500/20 border-green-500/50 text-green-400":"bg-white/5 border-white/10 text-white/60"} ${t.enabled?"hover:bg-white/10":"cursor-not-allowed"}`,children:t.extraConfig?.go_fast?"开启":"关闭"})]})]})]},t.id)})}),e.jsx("p",{className:"mt-2 text-xs text-white/40",children:"生成模型: 1MP ≈ 1024px, 2MP ≈ 1448px, 4MP ≈ 2048px"})]}),Ce.filter(t=>t.providerType==="fal").length>0&&e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-3",children:"Fal.ai 模型设置"}),e.jsx("div",{className:"space-y-4",children:Ce.filter(t=>t.providerType==="fal").map(t=>e.jsxs("div",{className:`p-3 rounded-lg border ${t.enabled?"border-green-500/30 bg-green-500/5":"border-white/10 bg-white/5 opacity-50"}`,children:[e.jsx("div",{className:"text-sm font-medium text-white mb-2",children:t.displayName}),t.modelType==="upscale"&&e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-xs text-white/50 w-20",children:"安全检查:"}),e.jsx("button",{onClick:()=>{te(s=>s.map(r=>r.id===t.id?{...r,extraConfig:{...r.extraConfig,enable_safety_checker:!r.extraConfig?.enable_safety_checker}}:r))},disabled:!t.enabled,className:`px-2 py-1 text-xs rounded border transition-all ${t.extraConfig?.enable_safety_checker?"bg-green-500/20 border-green-500/50 text-green-400":"bg-white/5 border-white/10 text-white/60"} ${t.enabled?"hover:bg-white/10":"cursor-not-allowed"}`,children:t.extraConfig?.enable_safety_checker?"开启":"关闭"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-white/50 w-20",children:"开放层级:"}),e.jsx("div",{className:"flex gap-1",children:[{v:"registered",label:"注册用户"},{v:"paid",label:"付费+管理员"},{v:"admin",label:"仅管理员"}].map(s=>{const r=t.accessLevel||"registered";return e.jsx("button",{onClick:()=>{te(i=>i.map(c=>c.id===t.id?{...c,accessLevel:s.v}:c))},className:`px-2 py-1 text-xs rounded border transition-all ${r===s.v?"bg-blue-500/20 border-blue-500/50 text-blue-400":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,children:s.label},s.v)})})]})]},t.id))}),e.jsx("p",{className:"mt-2 text-xs text-white/40",children:"开放层级控制模型对用户的可见与可用范围(服务端强制)。Crisp Upscale 为固定倍数放大,安全检查可过滤敏感内容"})]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5 flex flex-col justify-end",children:[e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-white/60 mb-1",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${ft==="vertex"?"bg-purple-500":"bg-blue-500"}`}),"当前: ",ft==="vertex"?"Vertex AI":"AI Studio"]})}),e.jsx("button",{onClick:Ya,disabled:gs,className:"w-full bg-gradient-to-r from-purple-500 to-indigo-500 hover:from-indigo-500 hover:to-purple-500 text-white font-medium px-4 py-3 rounded-lg transition-all duration-300 disabled:opacity-50 text-sm",children:gs?"保存中...":"保存设置"})]})]})]}),e.jsx(hl,{}),e.jsxs(k.div,{initial:{opacity:0,y:20}
10,animate:{opacity:1,y:0},transition:{delay:.38},className:"w-full bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-6 mb-6 hover:border-white/20 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsxs("h2",{className:"text-xl font-bold flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-cyan-500 to-teal-500 flex items-center justify-center shadow-lg",children:e.jsx(Pt,{className:"w-5 h-5 text-white"})}),"生成日志监控"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:er,className:"px-3 py-1.5 bg-white/10 hover:bg-white/20 rounded-lg text-sm flex items-center gap-1.5 transition-colors",children:[e.jsx(ol,{className:"w-4 h-4"}),"导出CSV"]}),e.jsxs("button",{onClick:()=>At(ks),disabled:jt,className:"px-3 py-1.5 bg-white/10 hover:bg-white/20 rounded-lg text-sm flex items-center gap-1.5 transition-colors disabled:opacity-50",children:[e.jsx(Ys,{className:`w-4 h-4 ${jt?"animate-spin":""}`}),"刷新"]})]})]}),Q&&e.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-4",children:[e.jsxs("div",{className:"bg-white/5 rounded-lg p-3 text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:Q.total}),e.jsx("div",{className:"text-xs text-white/50",children:"最近1小时"})]}),e.jsxs("div",{className:"bg-green-500/10 rounded-lg p-3 text-center border border-green-500/20",children:[e.jsx("div",{className:"text-2xl font-bold text-green-400",children:Q.success}),e.jsx("div",{className:"text-xs text-white/50",children:"成功"})]}),e.jsxs("div",{className:"bg-red-500/10 rounded-lg p-3 text-center border border-red-500/20",children:[e.jsx("div",{className:"text-2xl font-bold text-red-400",children:Q.failed}),e.jsx("div",{className:"text-xs text-white/50",children:"失败"})]}),e.jsxs("div",{className:`rounded-lg p-3 text-center ${Q.successRate>=90?"bg-green-500/10 border border-green-500/20":Q.successRate>=70?"bg-yellow-500/10 border border-yellow-500/20":"bg-red-500/10 border border-red-500/20"}`,children:[e.jsxs("div",{className:`text-2xl font-bold ${Q.successRate>=90?"text-green-400":Q.successRate>=70?"text-yellow-400":"text-red-400"}`,children:[Q.successRate,"%"]}),e.jsx("div",{className:"text-xs text-white/50",children:"成功率"})]})]}),z&&z.total>0&&e.jsxs("div",{className:`mb-4 p-3 rounded-lg border ${z.recent>0?"bg-red-500/10 border-red-500/30":"bg-white/5 border-white/10"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:z.recent>0?"text-red-400":"text-white/40",children:z.recent>0?"🔴":"·"}),e.jsxs("span",{className:z.recent>0?"text-red-300 font-medium":"text-white/50",children:["孤儿作品:近 7 天 ",z.recent," 例"]}),e.jsxs("span",{className:"text-white/40 text-xs",children:["历史累计 ",z.total]})]}),e.jsx("div",{className:"mt-1 text-xs text-white/40",children:"任务结算成功、积分已扣,generations 里却没有对应行 —— 用户在「我的主页」看不到这张作品,deck 里引用它的图也可能已是死链"}),z.latest.length>0&&e.jsx("div",{className:"mt-2 space-y-1",children:z.latest.map(t=>e.jsxs("div",{className:"flex items-center gap-2 text-xs text-white/50",children:[e.jsx("span",{className:"text-white/30",children:t.completedAt?new Date(t.completedAt*1e3).toLocaleString("zh-CN"):"—"}),e.jsxs("button",{onClick:()=>$t(t.taskId),className:"font-mono hover:text-accent hover:underline",title:"查看生成参数",children:[t.taskId.slice(0,8),"…"]}),e.jsx("span",{className:"text-white/30",children:t.modelId}),e.jsxs("button",{onClick:()=>Fe(t.userId),className:"hover:text-accent hover:underline",title:"查看用户",children:[t.userId.slice(0,8),"…"]})]},t.taskId))})]}),Is.length>0&&e.jsxs("div",{className:"mb-4 p-3 bg-white/5 rounded-lg",children:[e.jsx("div",{className:"text-sm text-white/60 mb-2",children:"历史累计统计"}),e.jsx("div",{className:"flex flex-wrap gap-4 text-xs",children:Is.filter(t=>t.model_id!=="_global").reduce((t,s)=>{const r=t.find(i=>i.model_id===s.model_id);return r?r[s.stat_key]=s.value:t.push({model_id:s.model_id,[s.stat_key]:s.value}),t},[]).map(t=>e.jsxs("div",{className:"bg-white/5 px-2 py-1 rounded",children:[e.jsxs("span",{className:"text-white/70",children:[t.model_id,":"]})," ",e.jsxs("span",{className:"text-green-400",children:[t.success||0,"✓"]})," ",e.jsxs("span",{className:"text-red-400",children:[t.failed||0,"✗"]})]},t.model_id))})]}),e.jsx("div",{className:"flex gap-2 mb-4",children:["all","success","failed"].map(t=>e.jsx("button",{onClick:()=>{Ba(t),At(t)},className:`px-3 py-1.5 rounded-lg text-sm transition-colors ${ks===t?t==="failed"?"bg-red-500/20 text-red-400":t==="success"?"bg-green-500/20 text-green-400":"bg-white/20 text-white":"bg-white/5 text-white/60 hover:bg-white/10"}`,children:t==="all"?"全部":t==="success"?"成功":"失败"},t))}),e.jsx("div",{className:"max-h-80 overflow-y-auto space-y-2",children:Cs.length===0?e.jsx("div",{className:"text-center text-white/40 py-8",children:jt?"加载中...":"点击刷新按钮加载日志"}):Cs.map(t=>{const r=new Date(t.createdAt*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit"});return e.jsxs("div",{className:`flex items-center gap-3 px-3 py-2 rounded-lg text-sm ${t.success?"bg-white/5":"bg-red-500/10 border border-red-500/20"}
10`,children:[e.jsx("span",{className:t.success?"text-green-400":"text-red-400",children:t.success?"🟢":"🔴"}),e.jsx("button",{onClick:()=>{t.taskId&&$t(t.taskId)},className:`text-white/50 w-20 text-left ${t.taskId?"hover:text-accent hover:underline cursor-pointer":""}`,title:t.taskId?"点击查看生成参数":"无关联任务",disabled:!t.taskId,children:r}),e.jsx("button",{onClick:()=>{t.userId&&Fe(t.userId)},className:"text-white/70 w-24 truncate hover:text-accent hover:underline transition-colors text-left",title:t.userId?"点击查看用户详情":"",children:t.username}),e.jsx("button",{onClick:()=>{t.taskId&&$t(t.taskId)},className:`text-white/80 w-32 truncate text-left ${t.taskId?"hover:text-accent hover:underline cursor-pointer":""}`,title:t.taskId?"点击查看生成参数":"",disabled:!t.taskId,children:t.modelId}),e.jsx("span",{className:"text-white/50 w-28 truncate shrink-0",title:t.provider,children:t.provider}),t.success?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-white/50",children:t.durationMs?`${(t.durationMs/1e3).toFixed(1)}s`:"-"}),e.jsxs("span",{className:"text-yellow-400 ml-auto",children:[t.pointsCost,"pt"]})]}):e.jsxs("div",{className:"ml-auto flex flex-col items-end gap-0.5 max-w-[320px]",children:[e.jsxs("button",{onClick:()=>{t.errorMessage&&(navigator.clipboard.writeText(t.errorMessage),_s(t.id),setTimeout(()=>_s(null),2e3))},className:"flex items-center justify-end gap-2 group/error hover:bg-white/5 rounded px-2 py-0.5 transition-colors cursor-pointer",title:t.errorMessage?`点击复制完整错误信息:
11`+t.errorMessage:void 0,children:[e.jsxs("span",{className:"text-red-400 truncate text-right block",children:[t.errorCode," ",t.errorMessage?.substring(0,30)]}),e.jsx("div",{className:"w-4 h-4 flex items-center justify-center flex-shrink-0",children:Ga===t.id?e.jsx(xt,{className:"w-3.5 h-3.5 text-green-400"}):e.jsx(ge,{className:"w-3.5 h-3.5 text-white/40 opacity-0 group-hover/error:opacity-100 transition-opacity"})})]}),t.friendlyHint&&e.jsxs("span",{className:"text-amber-400/80 text-xs truncate max-w-full px-2",title:t.friendlyHint,children:["💬 ",t.friendlyHint]})]})]},t.id)})})]}),e.jsxs(k.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},className:"w-full bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-6 mb-6 hover:border-white/20 transition-colors",children:[e.jsxs("h2",{className:"text-xl font-bold mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-blue-500 to-cyan-500 flex items-center justify-center shadow-lg",children:e.jsx(Ws,{className:"w-5 h-5 text-white"})}),"卡密生成器"]}),e.jsxs("div",{className:"flex gap-3 mb-6",children:[e.jsxs("button",{onClick:()=>le("GIFT"),className:`flex items-center gap-2 px-5 py-2.5 rounded-xl border transition-all duration-300 ${E==="GIFT"?"bg-green-500/20 border-green-500/50 text-green-400 shadow-[0_0_15px_rgba(34,197,94,0.15)]":"bg-white/5 border-white/10 text-white/50 hover:border-white/25"}`,children:[e.jsx(Zs,{className:"w-4 h-4"}),"免费福利",e.jsx("span",{className:"text-xs opacity-60",children:"VIP-"})]}),e.jsxs("button",{onClick:()=>le("PAID"),className:`flex items-center gap-2 px-5 py-2.5 rounded-xl border transition-all duration-300 ${E==="PAID"?"bg-orange-500/20 border-orange-500/50 text-orange-400 shadow-[0_0_15px_rgba(249,115,22,0.15)]":"bg-white/5 border-white/10 text-white/50 hover:border-white/25"}`,children:[e.jsx(Mt,{className:"w-4 h-4"}),"付费充值",e.jsx("span",{className:"text-xs opacity-60",children:"PRO-"})]})]}),e.jsxs("div",{className:"w-full grid grid-cols-1 md:grid-cols-3 gap-6 mb-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"生成数量"}),e.jsx("input",{type:"number",min:"1",max:"1000",value:R,onChange:t=>W(parseInt(t.target.value)||1),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-accent transition-colors",placeholder:"1-1000"})]}),E==="GIFT"?e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"总积分"}),e.jsx("input",{type:"number",min:"1",max:"100000",value:m,onChange:t=>V(parseInt(t.target.value)||1),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-accent transition-colors",placeholder:"1-100000"})]}):e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"价格 (CNY ¥)"}),e.jsx("input",{type:"number",min:"0.01",step:"0.01",value:Y||"",onChange:t=>we(parseFloat(t.target.value)||0),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-orange-400 transition-colors",placeholder:"人民币金额"})]}),e.jsx("div",{className:"flex items-end",children:e.jsxs("button",{onClick:tr,disabled:u,className:`w-full font-medium px-6 py-3 rounded-lg transition-all duration-300 shadow-lg disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2 text-white ${E==="PAID"?"bg-gradient-to-r from-orange-500 to-red-500 hover:from-red-500 hover:to-orange-500 hover:shadow-orange-500/50":"bg-gradient-to-r from-accent to-blue-600 hover:from-blue-600 hover:to-accent hover:shadow-accent/50"}`,children:[e.jsx(Ge,{className:"w-5 h-5"}),u?"生成中...":E==="PAID"?"生成付费卡密":"生成福利卡密"]})})]}),E==="PAID"&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-6 p-4 bg-orange-500/5 border border-orange-500/10 rounded-xl",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-orange-300/80 mb-2",children:"本金积分"}),e.jsx("input",{type:"number",min:"1",value:q||"",onChange:t=>j(parseInt(t.target.value)||0),className:"w-full bg-white/5 border border-orange-500/20 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-orange-400 transition-colors",placeholder:"本金积分数"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-orange-300/80 mb-2",children:"赠送积分"}),e.jsx("input",{type:"number",min:"0",value:y||"",onChange:t=>o(parseInt(t.target.value)||0),className:"w-full bg-white/5 border border-orange-500/20 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-orange-400 transition-colors",placeholder:"赠送积分数(可选)"})]}),e.jsx("div",{className:"flex items-end",children:e.jsxs("div",{className:"w-full bg-orange-500/10 border border-orange-500/20 rounded-lg px-4 py-3 text-center",children:[e.jsx("span",{className:"text-xs text-white/40 block",children:"总积分"}),e.jsx("span",{className:"text-2xl font-bold text-orange-400",children:q+y})]})})]}),n.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("h3",{className:"text-lg font-medium",children:["已生成 ",n.length," 个",n[0]?.type==="PAID"?"付费":"福利","卡密"]}),e.jsxs("button",{onClick:nr,className:"text-sm text-accent hover:text-blue-400 transition-colors flex items-center gap-2",children:[e.jsx(ge,{className:"w-4 h-4"}),"复制全部"]})]}),e.jsx("div",{className:"bg-black/30 rounded-lg p-4 max-h-96 overflow-y-auto",children:e.jsx("div",{className:"space-y-2",children:n.map((t,s)=>e.jsxs("div",{className:`flex items-center justify-between rounded-lg px-4 py-3 transition-colors border ${t.type==="PAID"?"bg-
11orange-500/5 border-orange-500/15 hover:bg-orange-500/10":"bg-white/5 border-white/10 hover:bg-white/10"}`,children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"text-white/40 text-sm w-8",children:["#",s+1]}),e.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${t.type==="PAID"?"bg-orange-500/20 text-orange-400":"bg-green-500/20 text-green-400"}`,children:t.type==="PAID"?"付费":"福利"}),e.jsx("span",{className:"font-mono text-lg",children:t.code}),e.jsxs("span",{className:"text-accent text-sm",children:[t.points," 积分"]})]}),e.jsx("button",{onClick:()=>ir(t.code,s),className:"text-white/60 hover:text-accent transition-colors",children:O===s?e.jsx(xt,{className:"w-5 h-5 text-green-500"}):e.jsx(ge,{className:"w-5 h-5"})})]},s))})})]})]}),e.jsxs(k.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.45},className:"w-full bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-6 mb-6 hover:border-white/20 transition-colors",children:[e.jsxs("h2",{className:"text-xl font-bold mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-yellow-500 to-orange-500 flex items-center justify-center shadow-lg",children:e.jsx(Ke,{className:"w-5 h-5 text-white"})}),"邀请码生成器"]}),e.jsxs("div",{className:"w-full grid grid-cols-1 md:grid-cols-4 gap-6 mb-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"生成数量"}),e.jsx("input",{type:"number",min:"1",max:"100",value:qe,onChange:t=>da(parseInt(t.target.value)||1),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-accent transition-colors",placeholder:"1-100"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"积分面额"}),e.jsx("input",{type:"number",min:"1",max:"100000",value:$e,onChange:t=>ca(parseInt(t.target.value)||1),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-accent transition-colors",placeholder:"1-100000"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"可用次数"}),e.jsx("input",{type:"number",min:"1",max:"10000",value:Le,onChange:t=>xa(parseInt(t.target.value)||1),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-accent transition-colors",placeholder:"1-10000"})]}),e.jsx("div",{className:"flex items-end",children:e.jsxs("button",{onClick:or,disabled:Qt,className:"w-full bg-gradient-to-r from-yellow-500 to-orange-500 hover:from-orange-500 hover:to-yellow-500 text-white font-medium px-6 py-3 rounded-lg transition-all duration-300 shadow-lg hover:shadow-yellow-500/50 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:[e.jsx(Ke,{className:"w-5 h-5"}),Qt?"生成中...":"生成邀请码"]})})]}),Qe.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("h3",{className:"text-lg font-medium",children:["已生成 ",Qe.length," 个邀请码",e.jsxs("span",{className:"text-sm text-white/40 ml-2",children:["(每码 ",$e," 积分,可用 ",Le," 次)"]})]}),e.jsxs("button",{onClick:cr,className:"text-sm text-yellow-400 hover:text-yellow-300 transition-colors flex items-center gap-2",children:[e.jsx(ge,{className:"w-4 h-4"}),"复制全部"]})]}),e.jsx("div",{className:"bg-black/30 rounded-lg p-4 max-h-96 overflow-y-auto",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2",children:Qe.map((t,s)=>e.jsxs("div",{className:"flex items-center justify-between bg-yellow-500/10 border border-yellow-500/20 rounded-lg px-4 py-3 hover:bg-yellow-500/20 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-white/40 text-sm",children:["#",s+1]}),e.jsx("span",{className:"font-mono text-lg tracking-widest",children:t})]}),e.jsx("button",{onClick:()=>dr(t,s),className:"text-white/60 hover:text-yellow-400 transition-colors",children:ma===s?e.jsx(xt,{className:"w-5 h-5 text-green-500"}):e.jsx(ge,{className:"w-5 h-5"})})]},s))})})]})]}),e.jsxs(k.div,{initial:{opacity:0,y:20}
11,animate:{opacity:1,y:0},transition:{delay:.48},className:"w-full bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-6 mb-6 hover:border-white/20 transition-colors",children:[e.jsxs("h2",{className:"text-xl font-bold mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-emerald-500 to-teal-500 flex items-center justify-center shadow-lg",children:e.jsx(dt,{className:"w-5 h-5 text-white"})}),"账本与空投"]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-5 border border-white/5 mb-6",children:[e.jsxs("h3",{className:"text-base font-semibold mb-4 flex items-center gap-2",children:[e.jsx(Zs,{className:"w-4 h-4 text-emerald-400"}),"积分空投"]}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:[{id:"all",label:"全体用户",Icon:Xs},{id:"specific",label:"指定用户",Icon:Dt},{id:"registered_after",label:"指定日期后注册",Icon:Xr},{id:"by_condition",label:"条件筛选",Icon:el}].map(({id:t,label:s,Icon:r})=>e.jsxs("button",{onClick:()=>ie(t),className:`flex items-center gap-2 px-4 py-2 rounded-lg border text-sm transition-all ${v===t?"bg-emerald-500/20 border-emerald-500/50 text-emerald-400":"bg-white/5 border-white/10 text-white/50 hover:border-white/25"}`,children:[e.jsx(r,{className:"w-3.5 h-3.5"}),s]},t))}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4",children:[v==="specific"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"用户邮箱"}),e.jsx("input",{type:"email",value:Z,onChange:t=>ht(t.target.value),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-emerald-400 transition-colors",placeholder:"输入用户邮箱"})]}),v==="registered_after"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"注册日期"}),e.jsx("input",{type:"date",value:fe,onChange:t=>mt(t.target.value),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-emerald-400 transition-colors"})]}),v==="by_condition"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"余额下限(含)"}),e.jsx("input",{type:"number",min:"0",value:d,onChange:t=>de(t.target.value),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-emerald-400 transition-colors",placeholder:"留空不限"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"余额上限(含)"}),e.jsx("input",{type:"number",min:"0",value:$,onChange:t=>ce(t.target.value),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-emerald-400 transition-colors",placeholder:"留空不限"})]}),e.jsx("div",{className:"flex items-end",children:e.jsxs("label",{className:"flex items-center gap-2.5 px-4 py-2.5 bg-white/5 border border-white/20 rounded-lg cursor-pointer hover:border-emerald-400/50 transition-colors select-none",children:[e.jsx("input",{type:"checkbox",checked:Ve,onChange:t=>aa(t.target.checked),className:"w-4 h-4 rounded accent-emerald-500"}),e.jsx("span",{className:"text-sm text-white/70",children:"从未获得过积分"})]})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"积分数量"}),e.jsx("input",{type:"number",min:"1",max:"100000",value:ne,onChange:t=>bt(parseInt(t.target.value)||1),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-emerald-400 transition-colors",placeholder:"积分数量"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"原因 / 描述"}),e.jsx("input",{type:"text",value:oe,onChange:t=>Oe(t.target.value),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-emerald-400 transition-colors",placeholder:"如:百人破冰纪念"})]})]}),e.jsxs("button",{onClick:sr,disabled:_e||!oe.trim(),className:"bg-gradient-to-r from-emerald-500 to-teal-500 hover:from-teal-500 hover:to-emerald-500 text-white font-medium px-6 py-2.5 rounded-lg transition-all duration-300 disabled:opacity-50 flex items-center gap-2 text-sm",children:[e.jsx(Qs,{className:"w-4 h-4"}),_e?"发送中...":"发送空投"]})]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-5 border border-white/5 mb-6",children:[e.jsxs("h3",{className:"text-base font-semibold mb-4 flex items-center gap-2",children:[e.jsx(Mt,{className:"w-4 h-4 text-yellow-400"}),"退款记账"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"用户邮箱"}),e.jsx("input",{type:"email",value:je,onChange:t=>oa(t.target.value),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-yellow-400 transition-colors",placeholder:"输入用户邮箱"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"扣减积分"}),e.jsx("input",{type:"number",min:"0",value:Ie,onChange:t=>Vt(parseInt(t.target.value)||0),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-yellow-400 transition-colors",placeholder:"可为 0(仅记账)"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"退款金额 (CNY ¥)"}),e.jsx("input",{type:"number",min:"0",step:"0.01",value:Ae||"",onChange:t=>zt(parseFloat(t.target.value)||0),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-yellow-400 transition-colors",placeholder:"人民币金额"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"退款原因"}),e.jsx("input",{type:"text",value:ve,onChange:t=>Ht(t.target.value),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-yellow-400 transition-colors",placeholder:"如:用户手误购买"})]})]}),e.jsxs("button",{onClick:ar,disabled:Jt||!je.trim()||!ve.trim(),className:"bg-gradient-to-r from-yellow-500 to-orange-500 hover:from-orange-500 hover:to-yellow-500 text-white font-medium px-6 py-2.5 rounded-lg transition-all duration-300 disabled:opacity-50 flex items-center gap-2 text-sm",children:[e.jsx(Mt,{className:"w-4 h-4"}),Jt?"处理中...":"确认退款记账"]})]}),e.jsxs("div",{id:"ledger-section",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Pt,{className:"w-4 h-4 text-emerald-400"}),"积分流水",Ot>0&&e.jsxs("span",{className:"text-xs text-white/30 font-normal",children:["(",Ot," 条)"]})]}),e.jsxs("button",{onClick:()=>X(xe,!1,he),disabled:He,className:"text-sm text-emerald-400 hover:text-emerald-300 transition-colors flex items-center gap-1",children:[e.jsx(Ys,{className:`w-3.5 h-3.5 ${He?"animate-spin":""}`}),"刷新"]})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-3 px-3 py-2 bg-white/5 border border-white/10 rounded-lg text-sm focus-within:border-accent/40 transition-colors",children:[e.jsx(Dt,{className:"w-3.5 h-3.5 text-white/40 shrink-0"}
11),e.jsx("input",{type:"text",value:he,onChange:t=>Je(t.target.value),onKeyDown:t=>{t.key==="Enter"&&X(xe,!1,he)},className:"flex-1 bg-transparent outline-none text-white text-sm placeholder-white/30",placeholder:"输入邮箱或昵称筛选用户,回车搜索..."}),he&&e.jsx("button",{onClick:lr,className:"text-white/40 hover:text-white transition-colors shrink-0",children:e.jsx(B,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:[{id:"ALL",label:"全部"},{id:"RECHARGE",label:"充值"},{id:"AIRDROP",label:"空投"},{id:"CONSUME",label:"消费"},{id:"REFUND",label:"退款"}].map(({id:t,label:s})=>e.jsxs("button",{onClick:()=>{pt(t),X(t,!1,he)},className:`px-3 py-1.5 rounded-lg text-xs transition-all border ${xe===t?"bg-emerald-500/20 border-emerald-500/40 text-emerald-400":"bg-white/5 border-white/5 text-white/40 hover:text-white/60"}`,children:[s,Ut&&t!=="ALL"&&e.jsxs("span",{className:"ml-1 opacity-60",children:["(",Ut[t.toLowerCase()]||0,")"]})]},t))}),ze.length===0&&!He?e.jsxs("div",{className:"text-center py-8 text-white/30",children:[e.jsx(dt,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"暂无流水记录,点击“刷新”加载"})]}):e.jsx("div",{className:"bg-black/30 rounded-lg overflow-hidden",children:e.jsxs("div",{onScroll:rr,className:"overflow-x-auto max-h-[400px] overflow-y-auto",children:[e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"sticky top-0 bg-white/5 backdrop-blur-sm z-10",children:e.jsxs("tr",{className:"text-white/50 text-left",children:[e.jsx("th",{className:"px-4 py-3 font-medium",children:"时间"}),e.jsx("th",{className:"px-4 py-3 font-medium",children:"用户"}),e.jsx("th",{className:"hidden md:table-cell px-4 py-3 font-medium",children:"邮箱"}),e.jsx("th",{className:"px-4 py-3 font-medium",children:"类型"}),e.jsx("th",{className:"px-4 py-3 font-medium text-right",children:"变动"}),e.jsx("th",{className:"px-4 py-3 font-medium",children:"原因 / 参考"})]})}),e.jsx("tbody",{className:"divide-y divide-white/5",children:ze.map(t=>{const s={RECHARGE:"充值",AIRDROP:"空投",CONSUME:"消费",REFUND:"退款"},i={RECHARGE:"blue",AIRDROP:"emerald",CONSUME:"red",REFUND:"yellow"}[t.type]||"gray",c=String(t.reference||""),h=t.type==="CONSUME"?/(页面|演示)/.test(c)?"页面生成":/(图片|图像|生图)/.test(c)?"图像生成":null:null,C=h?`消费 · ${h}`:s[t.type]||t.type;return e.jsxs("tr",{className:"hover:bg-white/5 transition-colors",children:[e.jsx("td",{className:"px-4 py-3 text-white/50 whitespace-nowrap",children:new Date(t.created_at*1e3).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("button",{onClick:()=>{t.user_id&&Fe(t.user_id)},className:"text-white/70 hover:text-accent hover:underline transition-colors cursor-pointer text-left",title:"点击查看用户详情",children:t.user_nickname||t.user_email||t.user_id?.slice(0,8)})}),e.jsx("td",{className:"hidden md:table-cell px-4 py-3",children:e.jsx("span",{className:"text-white/40 text-xs",children:t.user_email||"-"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs whitespace-nowrap bg-${i}-500/20 text-${i}-400`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full bg-${i}-400 shrink-0`}),C]})}),e.jsxs("td",{className:`px-4 py-3 text-right font-mono font-medium whitespace-nowrap ${t.amount>0?"text-green-400":"text-red-400"}`,children:[t.amount>0?"+":"",t.amount]}),e.jsx("td",{className:"px-4 py-3 text-white/40 max-w-[200px] truncate",children:t.reference||"-"})]},t.id)})})]}),Bt&&e.jsx("div",{className:"py-3 text-center text-white/40 text-sm",children:"加载更多..."}),!Kt&&ze.length>0&&!He&&e.jsxs("div",{className:"py-3 text-center text-white/20 text-xs",children:["— 已加载全部 ",ze.length," 条记录 —"]})]})})]})]}),e.jsx(ml,{}),e.jsx(k.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.5},className:"w-full",children:e.jsxs("button",{onClick:()=>f("/"),className:"w-full bg-white/5 backdrop-blur-sm border border-white/10 rounded-2xl p-8 text-left hover:bg-white/10 hover:border-accent/50 transition-all duration-300 group",children:[e.jsx("h3",{className:"text-xl font-bold mb-2 group-hover:text-accent transition-colors",children:"返回首页"}),e.jsx("p",{className:"text-white/60",children:"查看前台展示效果"})]})})]}),ba&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-center justify-center p-6",children:e.jsxs(k.div,{initial:{opacity:0,scale:.95}
11,animate:{opacity:1,scale:1},className:"bg-gray-900 border border-white/20 rounded-2xl max-w-4xl w-full max-h-[80vh] overflow-hidden",children:[e.jsxs("div",{className:"p-6 border-b border-white/10 flex items-center justify-between",children:[e.jsx("h2",{className:"text-2xl font-bold",children:"卡密列表"}),e.jsx("button",{onClick:()=>Yt(!1),className:"text-white/60 hover:text-white",children:e.jsx(B,{className:"w-6 h-6"})})]}),e.jsx("div",{className:"p-6 border-b border-white/10",children:e.jsx("div",{className:"flex gap-2",children:["ALL","ACTIVE","USED","EXPIRED"].map(t=>e.jsx("button",{onClick:()=>{wa(t),Us(t)},className:`px-4 py-2 rounded-lg transition-colors ${ts===t?"bg-accent text-white":"bg-white/5 text-white/60 hover:bg-white/10"}`,children:t==="ALL"?"全部":t==="ACTIVE"?"未使用":t==="USED"?"已使用":"已过期"},t))})}),e.jsx("div",{className:"p-6 overflow-y-auto max-h-[50vh]",children:Ye?e.jsx("div",{className:"text-center py-12 text-white/40",children:"加载中..."}):es.length===0?e.jsx("div",{className:"text-center py-12 text-white/40",children:"暂无卡密"}):e.jsx("div",{className:"space-y-2",children:es.map(t=>e.jsx("div",{className:"bg-white/5 border border-white/10 rounded-lg px-4 py-3 hover:bg-white/10 transition-colors",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"font-mono text-lg",children:t.code}),e.jsxs("span",{className:"text-accent text-sm",children:[t.points," 积分"]}),e.jsx("span",{className:`px-2 py-0.5 rounded text-xs ${t.status==="ACTIVE"?"bg-green-500/20 text-green-400":t.status==="USED"?"bg-gray-500/20 text-gray-400":"bg-red-500/20 text-red-400"}`,children:t.status==="ACTIVE"?"未使用":t.status==="USED"?"已使用":"已过期"})]}),t.status==="USED"&&t.used_by_email&&e.jsxs("div",{className:"text-xs text-white/40 mt-1",children:["使用者: ",t.used_by_nickname||t.used_by_email," · ",new Date(t.used_at*1e3).toLocaleString()]})]}),t.status==="ACTIVE"&&e.jsx("button",{onClick:()=>{navigator.clipboard.writeText(t.code),alert("✅ 已复制")},className:"text-white/60 hover:text-accent",children:e.jsx(ge,{className:"w-5 h-5"})})]})},t.id))})})]})}),Ha&&e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsxs(k.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"bg-[#1a1a2e] rounded-2xl border border-green-500/20 w-full max-w-lg shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-white/5",children:[e.jsx("h3",{className:"text-lg font-semibold text-green-400",children:"🔑 添加 IAM Key"}),e.jsx("button",{onClick:()=>vt(!1),className:"text-white/40 hover:text-white",children:e.jsx(B,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-1",children:"名称"}),e.jsx("input",{type:"text",value:tt,onChange:t=>As(t.target.value),placeholder:"如: 主账号 / 备用A",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-lg text-white placeholder:text-white/30 focus:border-green-500/50 focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-1",children:"Service Account JSON Key"}),e.jsx("textarea",{value:st,onChange:t=>$s(t.target.value),placeholder:"粘贴完整的 JSON Key (单行或多行均可)",rows:6,className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-lg text-white placeholder:text-white/30 focus:border-green-500/50 focus:outline-none font-mono text-xs"}),e.jsx("p",{className:"text-xs text-white/40 mt-1",children:"从 Google Cloud Console 下载的 Service Account JSON 文件内容"})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 p-4 border-t border-white/5",children:[e.jsx("button",{onClick:()=>vt(!1),className:"px-4 py-2 text-white/60 hover:text-white",children:"取消"}),e.jsx("button",{onClick:async()=>
11{if(!tt.trim()||!st.trim()){alert("请填写名称和 JSON Key");return}Ds(!0);try{const t=localStorage.getItem("jwt_token");if(!t)return;await Vs(t,{route:"vertex-iam",label:tt.trim(),credentials_json:st.trim()});const s=await K(t);ke(s.credentials),H(s.routes),As(""),$s(""),vt(!1)}catch(t){alert(t.message)}finally{Ds(!1)}},disabled:Ls||!tt.trim()||!st.trim(),className:"px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 disabled:opacity-50 disabled:cursor-not-allowed",children:Ls?"添加中...":"添加"})]})]})}),Ja&&e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsxs(k.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"bg-[#1a1a2e] rounded-2xl border border-cyan-500/20 w-full max-w-lg shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-white/5",children:[e.jsx("h3",{className:"text-lg font-semibold text-cyan-400",children:"🌐 添加 API 凭据"}),e.jsx("button",{onClick:()=>at(!1),className:"text-white/40 hover:text-white",children:e.jsx(B,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"选择路由"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{id:"aistudio",name:"AIStudio快速通道",color:"blue"},{id:"vertex",name:"VertexAI备用通道1",color:"purple"},{id:"vertex-iam",name:"VertexIAM备用通道2",color:"green"}].map(t=>e.jsx("button",{onClick:()=>qa(t.id),className:`px-3 py-2 rounded-lg border transition-all ${ue===t.id?`bg-${t.color}-500/20 border-${t.color}-500/50 text-${t.color}-400`:"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,children:t.name},t.id))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-1",children:"名称"}),e.jsx("input",{type:"text",value:rt,onChange:t=>Nt(t.target.value),placeholder:"如: 主Key / 备用1",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-lg text-white placeholder:text-white/30 focus:border-cyan-500/50 focus:outline-none"})]}),ue!=="vertex-iam"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-1",children:"API Key"}),e.jsx("input",{type:"password",value:yt,onChange:t=>Ct(t.target.value),placeholder:"输入 API Key",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-lg text-white placeholder:text-white/30 focus:border-cyan-500/50 focus:outline-none font-mono"})]}),ue==="vertex"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-1",children:"Project ID"}),e.jsx("input",{type:"text",value:kt,onChange:t=>St(t.target.value),placeholder:"输入 GCP Project ID",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-lg text-white placeholder:text-white/30 focus:border-cyan-500/50 focus:outline-none"})]})]}),ue==="vertex-iam"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-1",children:"Service Account JSON"}),e.jsx("textarea",{value:_t,onChange:t=>It(t.target.value),placeholder:"粘贴完整的 JSON Key",rows:6,className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-lg text-white placeholder:text-white/30 focus:border-cyan-500/50 focus:outline-none font-mono text-xs"}),e.jsx("p",{className:"text-xs text-white/40 mt-1",children:"从 Google Cloud Console 下载的 Service Account JSON 文件"})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 p-4 border-t border-white/5",children:[e.jsx("button",{onClick:()=>{at(!1),Nt(""),Ct(""),St(""),It("")},className:"px-4 py-2 text-white/60 hover:text-white",children:"取消"}),e.jsx("button",{onClick:async()=>{if(!rt.trim()){alert("请填写名称");return}Ts(!0);try{const t=localStorage.getItem("jwt_token");if(!t)return;const s={route:ue,label:rt.trim()};if(ue==="vertex-iam"){if(!_t.trim()){alert("请填写 Service Account JSON");return}s.credentials_json=_t.trim()}else{if(!yt.trim()){alert("请填写 API Key");return}if(s.api_key=yt.trim(),ue==="vertex"){if(!kt.trim()){alert("Vertex 需要填写 Project ID");return}s.project_id=kt.trim()}}await Vs(t,s);const r=await K(t);ke(r.credentials),H(r.routes),Nt(""),Ct(""),St(""),It(""),at(!1)}catch(t){alert(t.message)}finally{Ts(!1)}},disabled:Ms||!rt.trim(),className:"px-4 py-2 bg-cyan-500 text-white rounded-lg hover:bg-cyan-600 disabled:opacity-50 disabled:cursor-not-allowed",children:Ms?"添加中...":"添加"})]})]})}),pa&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-center justify-center p-2 md:p-6",children:e.jsxs(k.div,{initial:{opacity:0,scale:.95}
11,animate:{opacity:1,scale:1},className:"bg-gray-900 border border-white/20 rounded-2xl max-w-6xl w-full max-h-[90vh] md:max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 border-b border-white/10 flex items-center justify-between",children:[e.jsx("h2",{className:"text-2xl font-bold",children:"用户列表"}),e.jsx("button",{onClick:()=>me(!1),className:"text-white/60 hover:text-white",children:e.jsx(B,{className:"w-6 h-6"})})]}),e.jsxs("div",{className:"p-4 md:p-6 border-b border-white/10 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 bg-white/5 rounded-lg px-4 py-2 border border-white/10",children:[e.jsx(Dt,{className:"w-5 h-5 text-white/40"}),e.jsx("input",{type:"text",placeholder:"搜索邮箱或昵称...",value:ee,onChange:t=>fa(t.target.value),onKeyDown:t=>t.key==="Enter"&&Se(ee,!1,U),className:"flex-1 bg-transparent outline-none text-white"}),e.jsx("button",{onClick:()=>Se(ee,!1,U),className:"px-4 py-1 bg-accent rounded-lg hover:bg-accent/80 transition-colors",children:"搜索"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:[{key:"paid",label:"付费用户",icon:e.jsx(ot,{className:"w-3 h-3"}),activeClass:"bg-yellow-500/20 border-yellow-500/40 text-yellow-400"},{key:"admin",label:"管理员",icon:e.jsx(Re,{className:"w-3 h-3"}),activeClass:"bg-purple-500/20 border-purple-500/40 text-purple-400"},{key:"active7d",label:"近7天活跃",icon:e.jsx(Pt,{className:"w-3 h-3"}),activeClass:"bg-green-500/20 border-green-500/40 text-green-400"},{key:"new7d",label:"近7天新注册",icon:e.jsx(Ge,{className:"w-3 h-3"}),activeClass:"bg-blue-500/20 border-blue-500/40 text-blue-400"}].map(({key:t,label:s,icon:r,activeClass:i})=>e.jsxs("button",{onClick:()=>xr(t),className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs transition-all border ${De===t?i:"bg-white/5 border-white/10 text-white/50 hover:border-white/20"}`,children:[r,s,De===t&&gt>0&&e.jsxs("span",{className:"opacity-60",children:["(",gt,")"]})]},t))})]}),e.jsxs("div",{onScroll:Ks,className:"hidden md:block overflow-auto max-h-[50vh]",children:[e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-white/5 border-b border-white/10 sticky top-0 z-10",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold text-white/80",children:"用户"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold text-white/80",children:"邮箱"}),e.jsx("th",{onClick:()=>Ue("balance"),className:"px-4 py-3 text-left text-sm font-semibold text-white/80 cursor-pointer hover:text-accent transition-colors select-none",children:e.jsxs("span",{className:"flex items-center gap-1",children:["余额",U==="balance"&&e.jsx(ct,{className:"w-3.5 h-3.5 text-accent"})]})}),e.jsx("th",{onClick:()=>Ue("generation_count"),className:"px-4 py-3 text-left text-sm font-semibold text-white/80 cursor-pointer hover:text-accent transition-colors select-none",children:e.jsxs("span",{className:"flex items-center gap-1",children:["生成",U==="generation_count"&&e.jsx(ct,{className:"w-3.5 h-3.5 text-accent"})]})}),e.jsx("th",{onClick:()=>Ue("points_paid"),className:"px-4 py-3 text-left text-sm font-semibold text-white/80 cursor-pointer hover:text-accent transition-colors select-none",children:e.jsxs("span",{className:"flex items-center gap-1",children:["付费",U==="points_paid"&&e.jsx(ct,{className:"w-3.5 h-3.5 text-accent"})]})}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold text-white/80",children:"赠分"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold text-white/80",children:"空投"}),e.jsx("th",{onClick:()=>Ue("total_points_spent"),className:"px-4 py-3 text-left text-sm font-semibold text-white/80 cursor-pointer hover:text-accent transition-colors select-none",children:e.jsxs("span",{className:"flex items-center gap-1",children:["消费",U==="total_points_spent"&&e.jsx(ct,{className:"w-3.5 h-3.5 text-accent"})]})}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold text-white/80",children:"注册"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold text-white/80",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-white/10",children:Ye?e.jsx("tr",{children:e.jsx("td",{colSpan:10,className:"px-6 py-12 text-center text-white/40",children:"加载中..."})}):Ne.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:10,className:"px-6 py-12 text-center text-white/40",children:"暂无用户"})}):Ne.map(t=>{const s=t.is_paid===1,r=t.role==="admin",i=s?"text-yellow-400":r?"text-purple-400":"text-white",c=s?"text-yellow-400/60":"text-white/60";return e.jsxs("tr",{className:"hover:bg-white/5",children:[e.jsx("td",{className:"px-4 py-3 text-sm",children:e.jsxs("button",{onClick:()=>Fe(t.id),className:`flex items-center gap-1.5 ${i} hover:underline text-left`,children:[s&&e.jsx(ot,{className:"w-3.5 h-3.5 text-yellow-400 shrink-0"}),r&&e.jsx(Re,{className:"w-3.5 h-3.5 text-purple-400 shrink-0"}),e.jsx("span",{className:"truncate max-w-[120px]",children:t.nickname})]})}),e.jsx("td",{className:`px-4 py-3 text-sm ${c}`,children:t.email}),e.jsx("td",{className:"px-4 py-3 text-sm",children:e.jsx("span",{className:"text-accent font-semibold",children:t.balance})}),e.jsx("td",{className:"px-4 py-3 text-sm",children:t.generation_count||0}),e.jsx("td",{className:"px-4 py-3 text-sm text-yellow-400",children:t.points_paid||0}),e.jsx("td",{className:"px-4 py-3 text-sm text-green-400",children:t.points_gift||0}),e.jsx("td",{className:"px-4 py-3 text-sm text-emerald-400",children:t.points_airdrop||0}),e.jsx("td",{className:"px-4 py-3 text-sm text-orange-400",children:t.total_points_spent||0}),e.jsx("td",{className:"px-4 py-3 text-sm text-white/60",children:new Date(t.created_at*1e3).toLocaleDateString()}),e.jsx("td",{className:"px-4 py-3 text-sm",children:e.jsx("button",{onClick:()=>{const h=`/admin/generations?userId=${encodeURIComponent(t.id)}`;A()?window.open(h,"_blank"):(me(!1),f(h))},className:"text-accent hover:text-accent/80 underline",children:"查看作品"})})]},t.id)})})]}),We&&e.jsx("div",{className:"py-4 text-center text-white/40 text-sm",children:"加载更多..."})]}),e.jsxs("div",{onScroll:Ks,className:"md:hidden overflow-y-auto max-h-[60vh] px-4 py-2 space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 pb-2 border-b border-white/10",children:[e.jsx("span",{className:"text-xs text-white/40 w-full mb-1",children:"排序:"}),[{key:"balance",label:"积分"},{key:"generation_count",label:"次数"},{key:"points_paid",label:"付费"},{key:"total_points_spent",label:"消费"}].map(({key:t,label:s})=>e.jsxs("button",{onClick:()=>Ue(t),className:`px-3 py-1 rounded-full text-xs transition-colors ${U===t?"bg-accent text-white":"bg-white/10 text-white/60 hover:bg-white/20"}`,children:[s," ",U===t&&"↓"]},t))]}),Ye?e.jsx("div",{className:"py-12 text-center text-white/40",children:"加载中..."}):Ne.length===0?e.jsx("div",{className:"py-12 text-center text-white/40",children:"暂无用户"}):Ne.map(t=>{const s=t.is_paid===1,r=t.role==="admin";return e.jsxs("div",{className:`bg-white/5 border rounded-xl p-4 space-y-2 ${s?"border-yellow-500/30":"border-white/10"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("button",{onClick:()=>Fe(t.id),className:`flex items-center gap-1.5 font-semibold ${s?"text-yellow-400":r?"text-purple-400":"text-white"} hover:underline text-left`,children:[s&&e.jsx(ot,{className:"w-3.5 h-3.5 text-yellow-400 shrink-0"}),r&&e.jsx(Re,{className:"w-3.5 h-3.5 text-purple-400 shrink-0"}),t.nickname]}),e.jsxs("span",{className:"text-accent font-bold",children:[t.balance," 积分"]})]}),e.jsx("div",{className:`text-xs truncate ${s?"text-yellow-400/50":"text-white/50"}`,children:t.email}),e.jsxs("div",{className:"grid grid-cols-4 gap-2 text-xs pt-2 border-t border-white/10",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-white/40",children:"生成"}),e.jsx("div",{className:"text-white",children:t.generation_count||0})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white/40",children:"付费"}),e.jsx("div",{className:"text-yellow-400",children:t.points_paid||0})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white/40",children:"赠分"}),e.jsx("div",{className:"text-green-400",children:t.points_gift||0})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white/40",children:"消费"}),e.jsx("div",{className:"text-orange-400",children:t.total_points_spent||0})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 text-xs",children:[e.jsx("span",{className:"text-white/40",children:new Date(t.created_at*1e3).toLocaleDateString()}),e.jsx("button",{onClick:()=>{me(!1),f(`/admin/generations?userId=${encodeURIComponent(t.id)}`)},className:"text-accent hover:text-accent/80 text-xs",children:"查看作品 →"})]})]},t.id)}),We&&e.jsx("div",{className:"py-4 text-center text-white/40 text-sm",children:"加载更多..."})]}),Ne.length>0&&e.jsxs("div",{className:"px-6 py-3 border-t border-white/10 text-sm text-white/50 flex justify-between",children:[e.jsxs("span",{children:["已加载 ",
11Ne.length," / ",gt," 位用户"]}),!wt&&e.jsx("span",{className:"text-green-400/60",children:"已显示全部"})]})]})}),Aa&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-center justify-center p-6",children:e.jsxs(k.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"bg-gray-900 border border-white/20 rounded-2xl max-w-4xl w-full max-h-[80vh] overflow-hidden",children:[e.jsxs("div",{className:"p-6 border-b border-white/10 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(Ke,{className:"w-6 h-6 text-yellow-400"}),"邀请码管理"]}),Pe&&e.jsxs("p",{className:"text-sm text-white/60 mt-1",children:["共 ",Pe.total," 个 · 有效 ",Pe.activeCount," 个 · 剩余可用 ",Pe.totalRemainingUses," 次"]})]}),e.jsx("button",{onClick:()=>os(!1),className:"text-white/60 hover:text-white",children:e.jsx(B,{className:"w-6 h-6"})})]}),e.jsx("div",{className:"p-6 border-b border-white/10",children:e.jsx("div",{className:"flex gap-2",children:["ALL","ACTIVE","EXHAUSTED"].map(t=>e.jsx("button",{onClick:()=>{La(t),Bs(t)},className:`px-4 py-2 rounded-lg transition-colors ${xs===t?"bg-yellow-500 text-white":"bg-white/5 text-white/60 hover:bg-white/10"}`,children:t==="ALL"?"全部":t==="ACTIVE"?"有效":"已用尽"},t))})}),e.jsx("div",{className:"p-6 overflow-y-auto max-h-[50vh]",children:Ye?e.jsx("div",{className:"text-center py-12 text-white/40",children:"加载中..."}):ds.length===0?e.jsx("div",{className:"text-center py-12 text-white/40",children:"暂无邀请码"}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:ds.map(t=>e.jsxs("div",{className:`p-4 rounded-lg border ${t.used_count>=t.max_uses?"bg-white/5 border-white/10 opacity-50":"bg-yellow-500/10 border-yellow-500/20"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"font-mono text-lg tracking-widest",children:t.code}),t.used_count<t.max_uses&&e.jsx("button",{onClick:()=>{navigator.clipboard.writeText(t.code),alert("✅ 已复制")},className:"text-white/60 hover:text-yellow-400",children:e.jsx(ge,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("span",{className:"text-yellow-400",children:[t.credit_amount," 积分"]}),e.jsxs("span",{className:t.remaining_uses>0?"text-green-400":"text-red-400",children:["剩余 ",t.remaining_uses,"/",t.max_uses," 次"]})]})]},t.code))})})]})}),Na&&e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[60] flex items-center justify-center p-4",onClick:()=>be(!1),children:e.jsx(k.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},onClick:t=>t.stopPropagation(),className:"bg-gray-900 border border-white/20 rounded-2xl w-full max-w-md overflow-hidden shadow-2xl",children:va?e.jsx("div",{className:"p-8 text-center text-white/40",children:"加载中..."}):p?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`p-5 border-b border-white/10 ${p.is_paid===1?"bg-gradient-to-r from-yellow-500/10 to-transparent":""}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:p.avatar_url||`https://api.dicebear.com/7.x/thumbs/svg?seed=${p.email}`,alt:"",className:"w-12 h-12 rounded-full border-2 border-white/10"}),e.jsxs("div",{children:[e.jsxs("div",{className:`flex items-center gap-1.5 font-bold text-lg ${p.is_paid===1?"text-yellow-400":p.role==="admin"?"text-purple-400":"text-white"}`,children:[p.is_paid===1&&e.jsx(ot,{className:"w-4 h-4 text-yellow-400"}),p.role==="admin"&&e.jsx(Re,{className:"w-4 h-4 text-purple-400"}),p.nickname]}),e.jsx("div",{className:`text-sm ${p.is_paid===1?"text-yellow-400/60":"text-white/50"}`,children:p.email})]})]}),e.jsx("button",{onClick:()=>be(!1),className:"text-white/40 hover:text-white",children:e.jsx(B,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/40",children:[e.jsxs("span",{children:["注册于 ",new Date(p.created_at*1e3).toLocaleDateString()]}),p.is_paid===1&&e.jsx("span",{className:"px-2 py-0.5 rounded-full bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"付费用户"}),p.role==="admin"&&e.jsx("span",{className:"px-2 py-0.5 rounded-full bg-purple-500/20 text-purple-400 border border-purple-500/30",children:"管理员"})]})]}),e.jsxs("div",{className:"p-5 space-y-4",children:[e.jsxs("div",{className:"text-center py-3 bg-white/5 rounded-xl border border-white/10",children:[e.jsx("div",{className:"text-3xl font-bold text-accent",children:p.balance?.toLocaleStr
11ing()}),e.jsx("div",{className:"text-xs text-white/40 mt-1",children:"当前积分余额"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"生成次数"}),e.jsx("div",{className:"text-white font-semibold",children:p.generation_count?.toLocaleString()||0})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"累计消费"}),e.jsx("div",{className:"text-orange-400 font-semibold",children:p.total_points_spent?.toLocaleString()||0}),p.points_spent_images||p.points_spent_other?e.jsxs("div",{className:"text-[10px] text-white/35 mt-1 leading-snug",children:["图 ",(p.points_spent_images||0).toLocaleString()," · ","页/文档 ",(p.points_spent_other||0).toLocaleString()]}):null]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"付费充值"}),e.jsx("div",{className:"text-yellow-400 font-semibold",children:p.points_paid?.toLocaleString()||0})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"赠分"}),e.jsx("div",{className:"text-green-400 font-semibold",children:p.points_gift?.toLocaleString()||0})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3 col-span-2",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"空投"}),e.jsx("div",{className:"text-emerald-400 font-semibold",children:p.points_airdrop?.toLocaleString()||0})]})]}),p.role!=="admin"&&e.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-white/80",children:[e.jsx(Re,{className:"w-4 h-4 text-accent"}),"内容权限"]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm text-white/90",children:"允许公开作品"}),e.jsx("div",{className:"text-xs text-white/40 leading-snug",children:"关闭后立即下架其全部公开作品,且无法再公开"})]}),e.jsx("button",{onClick:()=>Rs("can_publish",p.can_publish===0),className:`relative shrink-0 w-12 h-6 rounded-full transition-colors ${p.can_publish!==0?"bg-green-500":"bg-gray-600"}`,title:p.can_publish!==0?"点击限制公开":"点击恢复公开",children:e.jsx("div",{className:`absolute top-0.5 w-5 h-5 bg-white rounded-full transition-transform ${p.can_publish!==0?"left-6":"left-0.5"}`})})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm text-white/90",children:"允许私密分享"}),e.jsx("div",{className:"text-xs text-white/40 leading-snug",children:"关闭后吊销其全部分享链接,且无法再生成"})]}),e.jsx("button",{onClick:()=>Rs("can_share",p.can_share===0),className:`relative shrink-0 w-12 h-6 rounded-full transition-colors ${p.can_share!==0?"bg-green-500":"bg-gray-600"}`,title:p.can_share!==0?"点击限制分享":"点击恢复分享",children:e.jsx("div",{className:`absolute top-0.5 w-5 h-5 bg-white rounded-full transition-transform ${p.can_share!==0?"left-6":"left-0.5"}`})})]}),(p.can_publish===0||p.can_share===0)&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-2.5 py-1.5",children:[e.jsx(rl,{className:"w-3.5 h-3.5 shrink-0"}),"已限制",p.can_publish===0?"公开":"",p.can_publish===0&&p.can_share===0?" 与 ":"",p.can_share===0?"分享":""]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:()=>{A()?window.open(`/admin?ledgerUser=${encodeURIComponent(p.email)}`,"_blank"):(be(!1),me(!1),Je(p.email),pt("ALL"),X("ALL",!1,p.email),setTimeout(()=>{document.getElementById("ledger-section")?.scrollIntoView({behavior:"smooth"})},100))},className:"flex-1 flex items-center justify-center gap-2 px-4 py-2.5 bg-white/5 border border-white/10 rounded-xl text-sm text-white/70 hover:bg-white/10 hover:text-white transition-colors",children:[e.jsx(dt,{className:"w-4 h-4"}),"查看流水"]}),e.jsxs("button",{onClick:()=>{const t=`/admin/generations?userId=${encodeURIComponent(p.id)}`;A()?window.open(t,"_blank"):(be(!1),me(!1),f(t))},className:"flex-1 flex items-center justify-center gap-2 px-4 py-2.5 bg-accent/20 border border-accent/30 rounded-xl text-sm text-accent hover:bg-accent/30 transition-colors",children:[e.jsx(qs,{className:"w-4 h-4"}),"查看作品"]})]}),e.jsxs("button",{onClick:()=>{const t=`/profile/${p.id}`;A()?window.open(t,"_blank"):(be(!1),me(!1),f(t))},className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 bg-white/5 border border-white/10 rounded-xl text-sm text-white/50 hover:bg-white/10 hover:text-white/70 transition-colors",children:[e.jsx(Tt,{className:"w-4 h-4"}),"查看公开主页"]})]})]}):e.jsx("div",{className:"p-8 text-center text-white/40",children:"用户不存在"})})}),ka&&e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[60] flex items-center justify-center p-4",onClick:()=>Xe(!1),children:e.jsx(k.div,{initial:{opacity:0,scale:.95}
11,animate:{opacity:1,scale:1},onClick:t=>t.stopPropagation(),className:"bg-gray-900 border border-white/20 rounded-2xl w-full max-w-lg overflow-hidden shadow-2xl max-h-[85vh] overflow-y-auto",children:Ca?e.jsx("div",{className:"p-8 text-center text-white/40",children:"加载中..."}):g?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`p-5 border-b border-white/10 flex items-center justify-between ${g.status==="success"?"bg-green-500/5":g.status==="failed"?"bg-red-500/5":""}`,children:[e.jsxs("div",{children:[e.jsxs("div",{className:"font-bold text-lg text-white flex items-center gap-2",children:[e.jsx("span",{className:g.status==="success"?"text-green-400":g.status==="failed"?"text-red-400":"text-yellow-400",children:g.status==="success"?"🟢":g.status==="failed"?"🔴":"🟡"}),"生成任务详情"]}),e.jsx("div",{className:"text-xs text-white/40 mt-1 font-mono",children:g.id})]}),e.jsx("button",{onClick:()=>Xe(!1),className:"text-white/40 hover:text-white",children:e.jsx(B,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-5 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"模型"}),e.jsx("div",{className:"text-white font-medium",children:g.modelId})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"通道"}),e.jsx("div",{className:"text-white font-medium",children:g.provider})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"积分"}),e.jsxs("div",{className:"text-yellow-400 font-medium",children:[g.pointsCost,"pt"]})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"耗时"}),e.jsx("div",{className:"text-white font-medium",children:g.completedAt&&g.createdAt?`${g.completedAt-g.createdAt}s`:"-"})]})]}),g.config&&Object.keys(g.config).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-white/40 mb-2 font-medium",children:"配置参数"}),e.jsx("div",{className:"bg-white/5 rounded-lg p-3 flex flex-wrap gap-2",children:Object.entries(g.config).map(([t,s])=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-white/5 rounded text-xs border border-white/10",children:[e.jsxs("span",{className:"text-white/40",children:[t,":"]}),e.jsx("span",{className:"text-white/80",children:String(s)})]},t))})]}),g.prompt&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-xs text-white/40 font-medium",children:"提示词"}),Hs(g.config)&&e.jsx("span",{className:"px-2 py-0.5 rounded-full bg-[#f6973d]/10 border border-[#f6973d]/30 text-[10px] text-[#f6973d] font-medium",children:"AI 帮写"})]}),e.jsx("div",{className:"bg-white/5 rounded-lg p-3 text-sm text-white/80 whitespace-pre-wrap break-words max-h-40 overflow-y-auto border border-white/10",children:g.prompt})]}),(()=>{const t=Hs(g.config);return t?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[e.jsx("span",{className:"text-xs text-white/40 font-medium",children:"用户原始意图"}),t.technique&&e.jsxs("span",{className:"px-2 py-0.5 rounded-full bg-white/5 border border-white/10 text-[10px] text-white/50",children:["技法 · ",t.technique]}),t.translated&&e.jsx("span",{className:"px-2 py-0.5 rounded-full bg-white/5 border border-white/10 text-[10px] text-white/50",children:"后经翻译"}),e.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] border ${t.aiPrompt?"bg-amber-500/10 border-amber-500/30 text-amber-400":"bg-emerald-500/10 border-emerald-500/30 text-emerald-400"}`,children:t.aiPrompt?"提交前改过":"AI 原稿直接用"})]}),e.jsx("div",{className:"bg-[#f6973d]/[0.06] rounded-lg p-3 text-sm text-white/80 whitespace-pre-wrap break-words max-h-32 overflow-y-auto border border-[#f6973d]/20",children:t.intent}),t.aiPrompt&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-xs text-white/40 mb-2 mt-3 font-medium",children:"AI 写的原稿(用户提交前改过)"}),e.jsx("div",{className:"bg-white/5 rounded-lg p-3 text-xs text-white/55 whitespace-pre-wrap break-words max-h-40 overflow-y-auto border border-white/10",children:t.aiPrompt})]})]}):null})(),(g.baseImageUrl||g.referenceImageUrls&&g.referenceImageUrls.length>0)&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-white/40 mb-2 font-medium",children:"输入图片"}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[g.baseImageUrl&&e.jsxs("div",{className:"relative group",children:[e.jsx("div",{className:"text-[10px] text-white/30 mb-1",children:"底图"}),e.jsx("a",{href:g.baseImageUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx("img",{src:Lt(g.baseImageUrl,{width:256,height:256,fit:"cover",quality:70}),alt:"底图",className:"w-24 h-24 md:w-32 md:h-32 object-cover rounded-lg border border-white/10 hover:border-accent/50 transition-colors cursor-pointer"})})]}),g.referenceImageUrls?.map((t,s)=>e.jsxs("div",{className:"relative group",children:[e.jsxs("div",{className:"text-[10px] text-white/30 mb-1",children:["参考图 ",s+1]}),e.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:e.jsx("img",{src:Lt(t,{width:256,height:256,fit:"cover",quality:70}),alt:`参考图 ${s+1}`,className:"w-24 h-24 md:w-32 md:h-32 object-cover rounded-lg border border-white/10 hover:border-accent/50 transition-colors cursor-pointer"})})]},s))]})]}),g.status==="success"&&(g.resultThumbnailUrl||g.resultImageUrl)&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-white/40 mb-2 font-medium",children:"生成结果"}),e.jsx("a",{href:g.resultImageUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx("img",{src:g.resultThumbnailUrl||Lt(g.resultImageUrl,{width:400,height:400,fit:"contain",quality:75}),alt:"生成结果",className:"max-w-full max-h-48 rounded-lg border border-white/10 hover:border-green-500/50 transition-colors cursor-pointer"})})]}),g.status==="failed"&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-white/40 mb-2 font-medium",children:"错误信息"}),e.jsxs("div",{className:"bg-red-500/10 border border-red-500/20 rounded-lg p-3 text-sm",children:[e.jsx("div",{className:"text-red-400 font-medium mb-1",children:g.errorCode}),e.jsx("div",{className:"text-red-400/70 text-xs break-words",children:g.errorMessage})]})]}),e.jsxs("div",{className:"text-xs text-white/30 space-y-1 pt-2 border-t border-white/10",children:[e.jsxs("div",{children:["创建: ",g.createdAt?new Date(g.createdAt*1e3).toLocaleStr
11ing("zh-CN"):"-"]}),g.startedAt&&e.jsxs("div",{children:["开始: ",new Date(g.startedAt*1e3).toLocaleString("zh-CN")]}),g.completedAt&&e.jsxs("div",{children:["完成: ",new Date(g.completedAt*1e3).toLocaleString("zh-CN")]})]})]})]}):e.jsx("div",{className:"p-8 text-center text-white/40",children:"任务不存在(仅异步生成的任务可查看参数)"})})}),e.jsx(xl,{open:ua,onClose:()=>Zt(!1)})]})}function hl(){const[x,w]=a.useState([]),[L,G]=a.useState(5),[F,f]=a.useState("5"),[A,D]=a.useState(!0),[P,M]=a.useState(!1),[S,O]=a.useState("vertex"),[T,R]=a.useState(""),[W,m]=a.useState(""),[V,E]=a.useState(""),[le,Y]=a.useState(""),[we,q]=a.useState(!1),[j,y]=a.useState(null),[o,n]=a.useState("600"),b=()=>localStorage.getItem("jwt_token")||"",u=async()=>{try{D(!0);const l=await Ur(b());w(l.credentials),G(l.concurrency),f(String(l.concurrency)),y(l.queue??null),l.queue&&n(String(l.queue.waitMaxS))}catch(l){console.error("[ComposePool] load failed",l)}finally{D(!1)}};a.useEffect(()=>{u()},[]);const N=async()=>{if(!T.trim()){alert("请填写名称");return}try{q(!0),await Rr(b(),{route:S,label:T.trim(),api_key:S==="vertex"?W.trim():void 0,project_id:S==="vertex"?V.trim():void 0,credentials_json:S==="vertex-iam"?le.trim():void 0}),R(""),m(""),E(""),Y(""),M(!1),await u()}catch(l){alert("添加失败:"+(l?.message||l))}finally{q(!1)}},v=async l=>{try{await re(b(),{id:l.id,setActive:!0}),await u()}catch(d){alert("操作失败:"+(d?.message||d))}},ie=async()=>{const l=Math.max(1,Math.min(20,parseInt(F,10)||5));if(f(String(l)),l!==L)try{await re(b(),{concurrency:l}),await u()}catch(d){alert("保存失败:"+(d?.message||d))}},Z=async l=>{try{await re(b(),{id:l.id,resetFailures:!0}),await u()}catch(d){alert("操作失败:"+(d?.message||d))}},ht=async()=>{if(!j)return;const l=!j.enabled;if(!(!l&&!confirm("关闭队列 = 所有批量铺图立即回退直发(无限流保护)。确认关闭?")))try{await re(b(),{queueEnabled:l}),await u()}catch(d){alert("操作失败:"+(d?.message||d))}},fe=async()=>{if(!j)return;const l=Math.max(60,Math.min(3600,parseInt(o,10)||600));if(n(String(l)),l!==j.waitMaxS)try{await re(b(),{queueWaitMaxS:l}),await u()}catch(d){alert("保存失败:"+(d?.message||d))}},mt=async(l,d)=>{const de=prompt(`设置 ${l} 的初始在飞上限 target(1-50):
12撞 429 会临时降档,静默 5 分钟自动回此值`,String(d));if(de===null)return;const $=parseInt(de.trim(),10);if(!Number.isFinite($)||$<1){alert("无效数值");return}try{await re(b(),{limiter:{modelId:l,target:$}}),await u()}catch(ce){alert("设置失败:"+(ce?.message||ce))}},ne=async(l,d)=>{const de=prompt(`设置 ${l} 的初始发射间隔 spacing(毫秒,0-10000):
13两次发射的最小间隔;撞 429 每档 +300ms,静默 5 分钟回此值`,String(d));if(de===null)return;const $=parseInt(de.trim(),10);if(!Number.isFinite($)||$<0){alert("无效数值");return}try{await re(b(),{limiter:{modelId:l,spacing:$}}),await u()}catch(ce){alert("设置失败:"+(ce?.message||ce))}},bt=async l=>{if(confirm(`把 ${l} 重置为初始值?(清掉当前 429 退避,生效值立刻回到你设的初始 target / spacing)`))try{await re(b(),{limiter:{modelId:l,reset:!0}}),await u()}catch(d){alert("重置失败:"+(d?.message||d))}},oe=l=>{if(!l)return"—";const d=Math.max(0,Math.floor((Date.now()/1e3-l)/60));return d<1?"刚刚":d<60?`${d} 分钟前`:d<1440?`${Math.floor(d/60)} 小时前`:"很久前"},Oe=async l=>{if(confirm(`确认删除通道「${l.label}」(${l.projectId||"?"})?`))try{await Kr(b(),l.id),await u()}catch(d){alert("删除失败:"+(d?.message||d))}},_e=l=>x.filter(d=>d.route===l);return e.jsxs(k.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-6 mb-6 hover:border-white/20 transition-colors",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-2",children:[e.jsxs("h2",{className:"text-xl font-bold flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-teal-500 to-emerald-500 flex items-center justify-center shadow-lg",children:e.jsx(sa,{className:"w-5 h-5 text-white"})}),"Compose 生图通道"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-white/50",children:"并发数"}),e.jsx("input",{value:F,onChange:l=>f(l.target.value),onBlur:ie,title:"单个工作通道内的并发数 K(1–20,默认 5)",className:"w-14 px-2 py-1 text-sm text-center bg-white/5 border border-white/15 rounded text-white focus:outline-none focus:border-emerald-400"}),e.jsxs("button",{onClick:()=>M(l=>!l),className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-emerald-500/15 hover:bg-emerald-500/25 border border-emerald-400/30 text-emerald-200 rounded-lg transition-colors",children:[e.jsx(Ge,{className:"w-4 h-4"})," 添加通道"]})]})]}),e.jsxs("p",{className:"text-white/50 text-sm mb-4",children:["专供演示(Compose)批量铺图,与 Studio 通道池物理分开。",e.jsx("b",{children:"可填多条,但代码只认一条「工作通道」"}),"(任意时刻只打这一个 GCP project,杜绝多 project 同时并发=Google ToS 违规、会封号)。",e.jsx("b",{children:"未设工作通道时,演示自动回退串行(用 Studio 那条通道)。"}),"队列管家上线后「并发数 K」的角色 = ",e.jsx("b",{children:"每个用户"}),"前端并行处理张数(天然的每用户公平上限); 真正打向 Google 的全局节流在下方「队列管家」的 target。"]}),j&&e.jsxs("div",{className:"bg-black/25 rounded-xl p-4 border border-white/10 mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5 flex-wrap gap-2",children:[e.jsx("div",{className:"text-sm font-semibold text-white/80",children:"🚦 队列管家(批量铺图限流)"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs",children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-white/60",children:["排队上限",e.jsx("input",{value:o,onChange:l=>n(l.target.value),onBlur:fe,title:"任务排队超过此秒数 → 主动失败退款(60-3600)",className:"w-16 px-2 py-1 text-center bg-white/5 border border-white/15 rounded text-white focus:outline-none focus:border-emerald-400"}),"秒"]}),e.jsx("button",{onClick:ht,className:`px-3 py-1 rounded-lg border transition-colors ${j.enabled?"bg-emerald-500/15 border-emerald-400/30 text-emerald-200 hover:bg-emerald-500/25":"bg-red-500/15 border-red-400/35 text-red-200 hover:bg-red-500/25"}`,title:"生产回滚闸:关闭后所有批量铺图立即回退直发(免部署秒级生效)",children:j.enabled?"队列运行中":"已关闭(直发)"})]})]}),e.jsx("p",{className:"text-[11px] text-white/40 mb-2.5",children:"target = 同时打向 Google 的全局在飞上限,间隔 = 两次发射的最小 spacing。撞 429 → 自动 target−1、间隔 +300ms(渐进退避); 静默 5 分钟无 429 → 自动回到你设的初始值(按时间自愈,不数成功)。「重置」= 立即清掉退避回初始。关闭队列 = 回滚闸(秒级回直发)。"}),e.jsx("div",{className:"space-y-1",children:j.limiters.map(l=>{const d=l.backoff>0;return e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-1.5 sm:gap-3 text-xs bg-white/[0.03] rounded-lg px-3 py-2 sm:py-1.5",children:[e.jsx("span",{className:"sm:w-40 shrink-0 font-mono text-white/70 break-all",children:l.modelId}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 flex-1 min-w-0",children:[e.jsxs("span",{className:"sm:w-28 shrink-0",children:["target ",e.jsx("b",{className:d?"text-amber-300":"text-emerald-300",children:l.effectiveTarget}),d&&e.jsxs("span",{className:"text-white/35",children:[" ←",l.initTarget]}),e.jsxs("span",{className:"text-white/35",children:["/",l.maxTarget]})]}),e.jsxs("span",{className:"sm:w-28 shrink-0",children:["间隔 ",e.jsx("b",{className:d?"text-amber-300":"text-white/70",children:l.effectiveSpacing}),d&&e.jsxs("span",{className:"text-white/35",children:[" ←",l.initSpacing]}),e.jsx("span",{className:"text-white/35",children:"ms"})]}),e.jsxs("span",{className:"sm:w-28 shrink-0 text-white/45",children:["最近429:",oe(l.last429At)]}),e.jsx("span",{className:"sm:flex-1 text-white/45",children:d?`退避档 ${l.backoff}`:"健康"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("button",{onClick:()=>mt(l.modelId,l.initTarget),className:"px-2 py-0.5 rounded bg-white/8 hover:bg-white/15 border border-white/15 text-white/70 transition-colors",children:"设 target"}),e.jsx("button",{onClick:()=>ne(l.modelId,l.initSpacing),className:"px-2 py-0.5 rounded bg-white/8 hover:bg-white/15 border border-white/15 text-white/70 transition-colors",children:"设 间隔"}),e.jsx("button",{onClick:()=>bt(l.modelId),className:"px-2 py-0.5 rounded bg-white/5 hover:bg-white/12 border border-white/10 text-white/50 transition-colors",children:"重置"})]})]},l.modelId)})})]}),P&&e.jsxs("div",{className:"bg-black/25 rounded-xl p-4 border border-white/10 mb-4 space-y-3",children:[e.jsx("div",{className:"flex gap-2",children:["vertex","vertex-iam"].map(l=>e.jsx("button",{onClick:()=>O(l),className:`px-3 py-1.5 rounded-lg text-xs border transition-all ${S===l?"bg-emerald-500/20 border-emerald-400/40 text-emerald-300":"bg-white/5 border-white/10 text-white/50"}`,children:l==="vertex"?"星云引擎 · Express API":"矩阵引擎 · IAM JSON"},l))}),e.jsx("input",{value:T,onChange:l=>R(l.target.value),placeholder:"通道名称(自定义,便于辨认)",className:"w-full bg-white/5 border border-white/15 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-emerald-400"}),S==="vertex"?e.jsxs(e.Fragment,{children:[e.jsx("input",{value:W,onChange:l=>m(l.target.value),placeholder:"Vertex Express API Key",className:"w-full bg-white/5 border border-white/15 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-emerald-400"}),e.jsx("input",{value:V,onChange:l=>E(l.target.value),placeholder:"GCP Project ID(并发单元,务必不同)",className:"w-full bg-white/5 border border-white/15 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-emerald-400"})]}):e.jsx("textarea",{value:le,onChange:l=>Y(l.target.value),placeholder:"Service Account JSON(含 project_id / client_email / private_key)",rows:4,className:"w-full bg-white/5 border border-white/15 rounded-lg px-3 py-2 text-white text-xs font-mono focus:outline-none focus:border-emerald-400"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:N,disabled:we,className:"px-4 py-2 text-sm bg-emerald-500/20 hover:bg-emerald-500/30 border border-emerald-400/30 text-emerald-200 rounded-lg disabled:opacity-50",children:we?"添加中...":"确认添加"}),e.jsx("button",{onClick:()=>M(!1),className:"px-4 py-2 text-sm bg-white/5 hover:bg-white/10 border border-white/10 text-white/60 rounded-lg",children:"取消"})]})]}),A?e.jsx("div",{className:"text-center py-6 text-white/40 text-sm",children:"加载中..."}):x.length===0?e.jsx("div",{className:"text-center py-6 text-white/30 text-sm",children:"尚未配置任何通道 —— 演示批量铺图当前走串行回退。点「添加通道」开始。"}):e.jsx("div",{className:"space-y-4",children:["vertex","vertex-iam"].map(l=>_e(l).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-white/45 mb-2",children:l==="vertex"?"🌥️ 星云引擎 · Vertex Express API":"🔷 矩阵引擎 · Vertex IAM JSON"}),e.jsx("div",{className:"space-y-2",children:_e(l).map(d=>e.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 rounded-lg border transition-all ${d.isActive?"bg-emerald-500/12 border-emerald-400/45":"bg-white/5 border-white/10"}`,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-sm text-white truncate",children:[d.label,d.isActive&&e.jsx("span",{className:"ml-2 text-[11px] text-emerald-300",children:"✅ 工作中"}),d.consecutiveFailures>0&&e.jsxs("span",{className:"ml-2 text-[11px] text-amber-300/80",children:["失败×",d.consecutiveFailures]})]}),e.jsxs("div",{className:"text-[11px] text-white/40 truncate",children:["project:",d.projectId||"—",d.apiKeyMasked?` · key ${d.apiKeyMasked}`:"",d.clientEmailMasked?` · ${d.clientEmailMasked}`:""]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.consecutiveFailures>0&&e.jsx("button",{onClick:()=>Z(d),className:"px-2 py-1 text-[11px] bg-white/5 hover:bg-white/10 border border-white/10 text-white/60 rounded",children:"重置"}),d.isActive?e.jsx("span",{className:"px-2 py-1 text-[11px] rounded border bg-emerald-500/15 border-emerald-400/30 text-emerald-300",children:"工作中"}):e.jsx("button",{onClick:()=>v(d),className:"px-2 py-1 text-[11px] rounded border bg-white/5 hover:bg-emerald-500/15 border-white/10 hover:border-emerald-400/30 text-white/60 hover:text-emerald-300 transition-colors",children:"设为工作通道"}),e.jsx("button",{onClick:()=>Oe(d),className:"px-2 py-1 text-[11px] bg-red-500/10 hover:bg-red-500/20 border border-red-400/25 text-red-300 rounded",children:"删除"})]})]},d.id))})]},l))}),e.jsxs("div",{className:"text-xs text-white/40 mt-3",children:["💡 填多条只为方便切换(比如某 project 被限速/封了,点「设为工作通道」秒切备用)。",e.jsx("b",{children:"任意æ—
13¶åˆ»åªæœ‰ä¸€æ¡å·¥ä½œé€šé“在被调用"}),"——并发只在它内部、由并发数 K 控制(建议先 5,观察 429 再调)。",e.jsx("b",{children:'绝不要为了"凑速度"去填同一个谷歌账号的多个 project 并发——那正是上次封号的原因。'})]})]})}function ml(){const[x,w]=a.useState(Mr()),[L,G]=a.useState(!0),[F,f]=a.useState(!1),[A,D]=a.useState(!1),[P,M]=a.useState(!1),[S,O]=a.useState(!1);a.useEffect(()=>{(async()=>{try{const n=localStorage.getItem("jwt_token")||"",b=await ta(n);if(b.settings?.promo_config?.value)try{const u=JSON.parse(b.settings.promo_config.value);w(u)}catch{console.warn("[PromoMgmt] Failed to parse promo_config from settings")}}catch(n){console.error("[PromoMgmt] Failed to load:",n)}finally{G(!1)}})()},[]);const T=async o=>{try{f(!0);const n=localStorage.getItem("jwt_token")||"";return await Br(n,o),!0}catch(n){return alert("保存失败:"+n.message),!1}finally{f(!1)}},R=async()=>{await T(x)&&alert("✅ 促销配置已保存到数据库")},W=async()=>{const o={...x,enabled:!x.enabled};w(o),await T(o)},m=(o,n,b)=>{w(u=>({...u,tiers:u.tiers.map((N,v)=>v===o?{...N,[n]:b}:N)}))},V=()=>{w(o=>({...o,tiers:[...o.tiers,{startDate:"",endDate:"",label:"",bonusPerHundred:0}],modalContent:{...o.modalContent,tiers:[...o.modalContent.tiers,{period:"",examples:[""]}]}}))},E=o=>{w(n=>({...n,tiers:n.tiers.filter((b,u)=>u!==o),modalContent:{...n.modalContent,tiers:n.modalContent.tiers.filter((b,u)=>u!==o)}}))},le=(o,n,b)=>{w(u=>({...u,modalContent:{...u.modalContent,tiers:u.modalContent.tiers.map((N,v)=>v===o?{...N,[n]:b}:N)}}))},Y=(o,n,b)=>{w(u=>({...u,modalContent:{...u.modalContent,tiers:u.modalContent.tiers.map((N,v)=>v===o?{...N,examples:N.examples.map((ie,Z)=>Z===n?b:ie)}:N)}}))},we=o=>{w(n=>({...n,modalContent:{...n.modalContent,tiers:n.modalContent.tiers.map((b,u)=>u===o?{...b,examples:[...b.examples,""]}:b)}}))},q=(o,n)=>{w(b=>({...b,modalContent:{...b.modalContent,tiers:b.modalContent.tiers.map((u,N)=>N===o?{...u,examples:u.examples.filter((v,ie)=>ie!==n)}:u)}}))},j="w-full bg-white/5 border border-white/20 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-accent transition-colors",y="block text-xs text-white/50 mb-1 font-medium";return e.jsxs(e.Fragment,{children:[e.jsxs(k.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.32},className:"w-full bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-6 mb-6 hover:border-white/20 transition-colors",children:[e.jsxs("div",{className:`flex items-center justify-between ${S?"mb-5":""}`,children:[e.jsxs("button",{type:"button",onClick:()=>O(o=>!o),className:"flex items-center gap-3 group",children:[e.jsxs("h2",{className:"text-xl font-bold flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-red-500 to-amber-500 flex items-center justify-center shadow-lg",children:e.jsx(dl,{className:"w-5 h-5 text-white"})}),"促销通知管理"]}),!S&&!L&&e.jsx("span",{className:`text-xs px-2 py-0.5 rounded font-medium ${nt(x)?"bg-green-500/20 text-green-400":x.enabled?"bg-yellow-500/20 text-yellow-400":"bg-gray-500/20 text-gray-400"}`,children:nt(x)?"进行中":x.enabled?"未到时间":"已关闭"}),e.jsx(Wr,{className:`w-4 h-4 text-white/40 group-hover:text-white/80 transition-transform ${S?"rotate-180":""}`})]}),S&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>D(!A),className:`flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium transition-all ${A?"bg-amber-500/20 text-amber-300 border border-amber-500/30":"bg-white/5 text-white/60 border border-white/10 hover:bg-white/10"}`,children:[e.jsx(Tt,{className:"w-3.5 h-3.5"}),A?"关闭预览":"Banner 预览"]}),e.jsxs("button",{onClick:()=>M(!0),className:"flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium bg-white/5 text-white/60 border border-white/10 hover:bg-white/10 transition-all",children:[e.jsx(Tt,{className:"w-3.5 h-3.5"}),"弹窗预览"]})]})]}),S&&L&&e.jsx("div",{className:"text-white/40 text-sm",children:"加载促销配置中..."}),S&&!L&&e.jsxs(e.Fragment,{children:[A&&e.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden border border-amber-500/20",children:[e.jsx("div",{className:"text-xs text-amber-300/60 px-3 py-1 bg-amber-500/5 border-b border-amber-500/10",children:"⬇️ 预览模式 — 以下是用户看到的效果"}),e.jsx(Tr,{config:x,forceShow:!0,onClickDetail:()=>M(!0)})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-3 h-3 rounded-full ${x.enabled?"bg-green-500 animate-pulse":"bg-gray-500"}`}),e.jsx("span",{className:"font-medium text-sm",children:"活动开关"}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded font-medium ${nt(x)?"bg-green-500/20 text-green-400":x.enabled?"bg-yellow-500/20 text-yellow-400":"bg-gray-500/20 text-gray-400"}`,children:nt(x)?"进行中":x.enabled?"未到时间":"已关闭"})]}),e.jsx("button",{onClick:W,disabled:F,className:`relative w-14 h-7 rounded-full transition-colors ${x.enabled?"bg-green-500":"bg-gray-600"}`,children:e.jsx("div",{className:`absolute top-0.5 w-6 h-6 bg-white rounded-full transition-transform ${x.enabled?"left-7":"left-0.5"}`})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:y,children:"活动 ID"}),e.jsx("input",{className:j,value:x.id,onChange:o=>w(n=>({...n,id:o.target.value})),placeholder:"如:may-day-2026"})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"今日日期"}),e.jsx("div",{className:"text-sm text-white/60 py-2 font-mono",children:Er()})]})]})]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5 space-y-3",children:[e.jsx("span",{className:"text-sm font-medium text-white/80",children:"Banner 文案"}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"主标题"}),e.jsx("input",{className:j,value:x.title,onChange:o=>w(n=>({...n,title:o.target.value})),placeholder:"🔥 五一充值特惠"})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"副标题"}),e.jsx("input",{className:j,value:x.subtitle,onChange:o=>w(n=>({...n,subtitle:o.target.value})),placeholder:"充 10 元最高得 180 积分!"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:y,children:"开始日期"}),e.jsx("input",{type:"date",className:j,value:x.startDate,onChange:o=>w(n=>({...n,startDate:o.target.value}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"结束日期"}),e.jsx("input",{type:"date",className:j,value:x.endDate,onChange:o=>w(n=>({...n,endDate:o.target.value}))})]})]})]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium text-white/80",children:"促销档位"}),e.jsxs("button",{onClick:V,className:"flex items-center gap-1 text-xs text-accent hover:text-accent/80 transition-colors",children:[e.jsx(Ge,{className:"w-3.5 h-3.5"})," 添加档位"]})]}),x.tiers.map((o,n)=>e.jsxs("div",{className:"bg-white/[0.02] border border-white/5 rounded-lg p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-white/40",children:["档位 ",n+1]}),e.jsx("button",{onClick:()=>E(n),className:"text-red-400/60 hover:text-red-400 transition-colors",children:e.jsx(B,{className:"w-3.5 h-3.5"})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:y,children:"开始"}),e.jsx("input",{type:"date",className:j,value:o.startDate,onChange:b=>m(n,"startDate",b.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"结束"}),e.jsx("input",{type:"date",className:j,value:o.endDate,onChange:b=>m(n,"endDate",b.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"充100送"}),e.jsx("input",{type:"number",className:j,value:o.bonusPerHundred,onChange:b=>m(n,"bonusPerHundred",parseInt(b.target.value)||0)})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"标签"}),e.jsx("input",{className:j,value:o.label,onChange:b=>m(n,"label",b.target.value),placeholder:"🔥 预热抢先价"})]})]},n))]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5 space-y-3",children:[e.jsx("span",{className:"text-sm font-medium text-white/80",children:"弹窗内容"}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"标题"}),e.jsx("input",{className:j,value:x.modalContent.heading,onChange:o=>w(n=>({...n,modalContent:{...n.modalContent,heading:o.target.value}})),placeholder:"🎉 五一充值特惠"})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"描述(支持多行,
13回车换行)"}),e.jsx("textarea",{className:`${j} resize-y`,rows:4,value:x.modalContent.description,onChange:o=>w(n=>({...n,modalContent:{...n.modalContent,description:o.target.value}})),placeholder:`限时积分加量活动
14充得越多送得越多!`})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"二维码下方附加文案(可选,为空不显示)"}),e.jsx("input",{className:j,value:x.modalContent.footer,onChange:o=>w(n=>({...n,modalContent:{...n.modalContent,footer:o.target.value}})),placeholder:"如:充值方式:微信转账,秒发专属兑换卡密。"})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"右栏底部提示(可选,为空不显示黄色提示条)"}),e.jsx("input",{className:j,value:x.modalContent.tipText||"",onChange:o=>w(n=>({...n,modalContent:{...n.modalContent,tipText:o.target.value}})),placeholder:"如:转账时备注「活动」即可"})]})]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium text-white/80",children:"左栏底部声明(每条前自动加 *)"}),e.jsx("button",{onClick:()=>w(o=>({...o,modalContent:{...o.modalContent,disclaimers:[...o.modalContent.disclaimers||[],""]}})),className:"text-xs text-accent hover:text-accent/80",children:"+ 添加"})]}),(x.modalContent.disclaimers||[]).map((o,n)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-white/30 text-xs",children:"*"}),e.jsx("input",{className:`${j} flex-1`,value:o,onChange:b=>{const u=[...x.modalContent.disclaimers||[]];u[n]=b.target.value,w(N=>({...N,modalContent:{...N.modalContent,disclaimers:u}}))},placeholder:"活动期间赠送比例升级,替代日常赠送。"}),e.jsx("button",{onClick:()=>w(b=>({...b,modalContent:{...b.modalContent,disclaimers:(b.modalContent.disclaimers||[]).filter((u,N)=>N!==n)}})),className:"text-red-400/40 hover:text-red-400 p-1",children:e.jsx(B,{className:"w-3 h-3"})})]},n))]}),x.modalContent.tiers.map((o,n)=>e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5 space-y-3",children:[e.jsxs("span",{className:"text-xs text-white/40",children:["弹窗档位 ",n+1]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"时段描述"}),e.jsx("input",{className:j,value:o.period,onChange:b=>le(n,"period",b.target.value),placeholder:"🔥 预热抢先价 · 4.29-4.30"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("label",{className:y,children:"金额示例"}),e.jsx("button",{onClick:()=>we(n),className:"text-xs text-accent hover:text-accent/80",children:"+ 添加"})]}),o.examples.map((b,u)=>e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("input",{className:`${j} flex-1`,value:b,onChange:N=>Y(n,u,N.target.value),placeholder:"充 10 元 → 到账 180 积分"}),o.examples.length>1&&e.jsx("button",{onClick:()=>q(n,u),className:"text-red-400/40 hover:text-red-400 p-1",children:e.jsx(B,{className:"w-3 h-3"})})]},u))]})]},n)),e.jsx("button",{onClick:R,disabled:F,className:"w-full bg-gradient-to-r from-red-500 to-amber-500 hover:from-red-600 hover:to-amber-600 text-white font-medium px-4 py-3 rounded-xl transition-all duration-300 disabled:opacity-50 text-sm shadow-lg shadow-red-500/20",children:F?"保存中...":"💾 保存促销配置到数据库"})]})]})]})]}),e.jsx(Fr,{isOpen:P,onClose:()=>M(!1),config:x})]})}function Be({icon:x,label:w,value:L,color:G,delay:F,onClick:f}){const A={blue:"from-blue-500 to-blue-600",orange:"from-orange-500 to-orange-600",green:"from-green-500 to-green-600",yellow:"from-yellow-500 to-yellow-600"},D={blue:"hover:shadow-[0_0_25px_rgba(59,130,246,0.4)]",orange:"hover:shadow-[0_0_25px_rgba(249,115,22,0.4)]",green:"hover:shadow-[0_0_25px_rgba(34,197,94,0.4)]",yellow:"hover:shadow-[0_0_25px_rgba(234,179,8,0.4)]"},P=f?"button":"div";return e.jsx(k.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:F},whileHover:{y:-4,transition:{duration:.2}},children:e.jsxs(P,{onClick:f,className:`w-full h-full text-center bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-5 transition-all duration-300 ${D[G]}
14 ${f?"hover:border-white/30 cursor-pointer":"hover:border-white/20"}`,children:[e.jsx("div",{className:`w-11 h-11 rounded-xl bg-gradient-to-br ${A[G]} flex items-center justify-center mb-3 shadow-lg mx-auto`,children:e.jsx(x,{className:"w-5 h-5 text-white"})}),e.jsx("div",{className:"text-2xl font-bold mb-0.5 text-white",children:L.toLocaleString()}),e.jsx("div",{className:"text-white/50 text-xs font-medium",children:w})]})})}export{Rl 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.