PageSourceSearch

https://xyc.ai/static/js/async/4548.7e59e1c844.js

js xyc.ai collected 2026-10-05 14:39:25 UTC 13,794 bytes, 1 lines download raw bytes

1"use strict";(self.rspackChunknewapi_web=self.rspackChunknewapi_web||[]).push([[4548],{32094(e,t,a){a.d(t,{OP:()=>j,S$:()=>h,SO:()=>N,TK:()=>d,UL:()=>m,XD:()=>p,Xw:()=>o,ZC:()=>x,f:()=>g,hG:()=>c,kg:()=>l,lo:()=>n,tg:()=>u,wz:()=>i,x5:()=>r,zm:()=>f});var s=a(64577);async function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{p:t=1,page_size:a=10}=e;return(await s.FH.get(`/api/user/?p=${t}&page_size=${a}`)).data}async function r(e){let{keyword:t="",group:a="",role:n="",status:r="",p:i=1,page_size:l=10}=e,d=new URLSearchParams;return d.set("keyword",t),d.set("group",a),n&&d.set("role",n),r&&d.set("status",r),d.set("p",String(i)),d.set("page_size",String(l)),(await s.FH.get(`/api/user/search?${d.toString()}`)).data}async function i(e){return(await s.FH.get(`/api/user/${e}`)).data}async function l(e){return(await s.FH.post("/api/user/",e)).data}async function d(e){return(await s.FH.put("/api/user/",e)).data}async function c(e){return(await s.FH.delete(`/api/user/${e}/`)).data}async function x(e,t){return(await s.FH.post("/api/user/manage",{id:e,action:t})).data}async function o(e){return(await s.FH.post("/api/user/manage",e)).data}async function m(e,t){return(await s.FH.post("/api/user/tier",{user_id:e,tier:t})).data}async function u(e){return(await s.FH.delete(`/api/user/${e}/reset_passkey`)).data}async function h(e){return(await s.FH.delete(`/api/user/${e}/2fa`)).data}async function g(){return(await s.FH.get("/api/group/")).data}async function p(e){return(await s.FH.get(`/api/user/${e}/oauth/bindings`)).data}async function f(e,t){return(await s.FH.delete(`/api/user/${e}/bindings/${t}`)).data}async function j(e,t){return(await s.FH.delete(`/api/user/${e}/oauth/bindings/${t}`)).data}async function N(){return(await s.FH.get("/api/user/topup/overview")).data.data}},51215(e,t,a){a.r(t),a.d(t,{component:()=>H});var s=a(72361),n=a(68413),r=a(53540),i=a(6702),l=a(61631),d=a(81204),c=a(54023),x=a(61309),o=a(18434),m=a(1951),u=a(32999),h=a(67267),g=a(64577);async function p(e){let t=new URLSearchParams;t.set("start_date",e.start_date),t.set("end_date",e.end_date),e.exclude_admin&&t.set("exclude_admin","true");let a=await g.FH.get(`/api/reconciliation/upstream?${t.toString()}`);if(!a.data?.success)throw Error(a.data?.message||"Failed to load reconciliation data");return a.data.data}var f=a(32094);let j={CN:{name:"中国大陆",flag:"🇨🇳"},HK:{name:"中国香港",flag:"🇭🇰"},TW:{name:"中国台湾",flag:"🇹🇼"},MO:{name:"中国澳门",flag:"🇲🇴"},US:{name:"美国",flag:"🇺🇸"},JP:{name:"日本",flag:"🇯🇵"},SG:{name:"新加坡",flag:"🇸🇬"},KR:{name:"韩国",flag:"🇰🇷"},GB:{name:"英国",flag:"🇬🇧"},DE:{name:"德国",flag:"🇩🇪"},CA:{name:"加拿大",flag:"🇨🇦"},AU:{name:"澳大利亚",flag:"🇦🇺"},MY:{name:"马来西亚",flag:"🇲🇾"},"??":{name:"未知",flag:"🌐"}};function N(e){return j[e]??{name:e,flag:"🌐"}}function b(e){let{icon:t,label:a,value:n,sub:r,accent:i}=e;return(0,s.jsxs)("div",{className:"border-border bg-background flex items-center gap-3 rounded-xl border p-4",children:[(0,s.jsx)("div",{className:(0,d.cn)("flex size-10 shrink-0 items-center justify-center rounded-lg",i),children:t}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("div",{className:"text-muted-foreground truncate text-xs font-medium",children:a}),(0,s.jsx)("div",{className:"text-foreground truncate text-lg font-semibold tabular-nums",children:n}),r?(0,s.jsx)("div",{className:"text-muted-foreground truncate text-[11px]",children:r}):null]})]})}function y(e){let{geo:t,sampled:a,cnLabel:n,otherLabel:r,ofLabel:i}=e,c=[...t].sort((e,t)=>t.users-e.users),x=c.reduce((e,t)=>e+t.users,0)||1,o=Math.round((t.find(e=>"CN"===e.country)?.users??0)/x*100);return(0,s.jsxs)("div",{className:"border-border bg-background flex flex-col rounded-xl border p-4",children:[(0,s.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(l.qzq,{className:"text-muted-foreground size-4"}),(0,s.jsx)("span",{className:"text-foreground text-sm font-semibold",children:n})]}),(0,s.jsx)("span",{className:"text-muted-foreground text-xs tabular-nums",children:i.replace("{n}",String(a))})]}),0===c.length?(0,s.jsx)("div",{className:"text-muted-foreground flex-1 py-6 text-center text-xs",children:r}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mb-3 text-2xl font-bold tabular-nums",children:[o,"%",(0,s.jsx)("span",{className:"text-muted-foreground ml-1.5 text-xs font-normal",children:N("CN").name})]}),(0,s.jsx)("div",{className:"space-y-2",children:c.slice(0,6).map(e=>{let t=N(e.country),a=Math.round(e.users/x*100);return(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"w-20 shrink-0 truncate text-xs",children:[(0,s.jsx)("span",{className:"mr-1",children:t.flag}),t.name]}),(0,s.jsx)("div",{className:"bg-muted h-2 flex-1 overflow-hidden rounded-full",children:(0,s.jsx)("div",{className:(0,d.cn)("h-full rounded-full","CN"===e.country?"bg-red-500":"bg-indigo-500"),style:{width:`${Math.max(a,2)}%`}})}),(0,s.jsxs)("span",{className:"text-muted-foreground w-14 shrink-0 text-right text-xs tabular-nums",children:[e.users," · ",a,"%"]})]},e.country)})})]})]})}function v(){let{t:e}=(0,i.Bd)(),{data:t,isLoading:a}=(0,r.I)({queryKey:["topup-overview"],queryFn:f.SO,staleTime:12e4});if(a||!t)return(0,s.jsx)(o.E,{className:"mb-4 h-40 w-full rounded-xl"});let n=t.geo_sampled_users,d=t.paid_total_users;return(0,s.jsxs)("div",{className:"mb-4 grid grid-cols-1 gap-3 lg:grid-cols-2",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[(0,s.jsx)(b,{icon:(0,s.jsx)(l.ntg,{className:"size-5 text-indigo-600"}),accent:"bg-indigo-500/10",label:e("Today paying users"),value:String(t.today_users)}),(0,s.jsx)(b,{icon:(0,s.jsx)(l.y5g,{className:"size-5 text-emerald-600"}),accent:"bg-emerald-500/10",label:e("Today top-up amount"),value:`$${t.today_money.toFixed(2)}`}),(0,s.jsx)(b,{icon:(0,s.jsx)(l.uWV,{className:"size-5 text-amber-600"}),accent:"bg-amber-500/10",label:e("Paid users remaining balance"),value:`$${t.paid_remain_usd.toFixed(2)}`,sub:e("{{n}} paid users",{n:d})})]}),(0,s.jsx)(y,{geo:t.geo,sampled:n,cnLabel:e("Paid users by region"),otherLabel:e("No IP data yet"),ofLabel:e("based on {n} orders with IP")})]})}
1function w(e){return`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function _(e){return`\xa5${e.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function k(e){return`${(100*e).toFixed(1)}%`}function F(e){return Math.abs(e)>=1e9?`${(e/1e9).toFixed(2)}B`:Math.abs(e)>=1e6?`${(e/1e6).toFixed(2)}M`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function $(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=new Date;return t.setDate(t.getDate()+e),t.toISOString().slice(0,10)}function S(e){let{label:t,value:a,positive:n}=e;return(0,s.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,s.jsx)("span",{className:"text-text-tertiary text-xs",children:t}),(0,s.jsx)("span",{className:(0,d.cn)("font-sans text-2xl font-semibold tracking-tight tabular-nums",!0===n&&"text-emerald-600 dark:text-emerald-400",!1===n&&"text-red-600 dark:text-red-400"),children:a})]})}let H=function(){let{t:e}=(0,i.Bd)(),[t,a]=(0,n.useState)(()=>$()),[g,f]=(0,n.useState)(()=>$()),[j,N]=(0,n.useState)(!0),{data:b,isLoading:y,isError:H,error:A,dataUpdatedAt:C}=(0,r.I)({queryKey:["reconciliation",t,g,j],queryFn:()=>p({start_date:t,end_date:g,exclude_admin:j}),refetchInterval:3e5,refetchOnWindowFocus:!1,staleTime:3e5}),z=b?.summary,M=b?.rows??[],P=z?.week_growth??0,D=(0,n.useMemo)(()=>C?new Date(C).toLocaleTimeString():"",[C]);return(0,s.jsxs)(h.Ni,{children:[(0,s.jsx)(h.Ni.Title,{children:(0,s.jsxs)("span",{className:"flex items-center gap-2",children:[(0,s.jsx)(l.FE9,{className:"text-muted-foreground/60 size-5"}),e("Upstream Reconciliation")]})}),(0,s.jsxs)(h.Ni.Description,{children:[e("Compare client-side billed usage against upstream provider deductions, grouped by upstream key."),D?` \xb7 ${e("Last updated")}: ${D} \xb7 ${e("Auto-refreshes every 5 minutes")}`:null]}),(0,s.jsx)(h.Ni.Content,{children:(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsx)(v,{}),(0,s.jsx)("div",{className:"border-border/70 bg-card rounded-lg border p-5",children:(0,s.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-5",children:[(0,s.jsx)("div",{className:"flex flex-wrap gap-8",children:y?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.E,{className:"h-12 w-28"}),(0,s.jsx)(o.E,{className:"h-12 w-24"}),(0,s.jsx)(o.E,{className:"h-12 w-28"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(S,{label:e("Total Profit"),value:w(z?.total_profit??0),positive:(z?.total_profit??0)>=0}),(0,s.jsx)(S,{label:e("Overall Margin"),value:k(z?.total_margin??0),positive:(z?.total_margin??0)>=0}),(0,s.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,s.jsx)("span",{className:"text-text-tertiary text-xs",children:e("Upstream cost")}),(0,s.jsx)("span",{className:"font-sans text-2xl font-semibold tracking-tight tabular-nums",children:_(z?.upstream_amount_cny??0)}),(0,s.jsxs)("span",{className:"text-text-tertiary text-[11px]",children:["≈",w(z?.upstream_amount??0)," @"," ",(z?.usd_to_cny??0).toFixed(3)]})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,s.jsx)("span",{className:"text-text-tertiary text-xs",children:e("Week-over-week Growth")}),(0,s.jsxs)("span",{className:(0,d.cn)("flex items-center gap-1 font-sans text-2xl font-semibold tracking-tight tabular-nums",P>=0?"text-emerald-600 dark:text-emerald-400":"text-red-600 dark:text-red-400"),children:[P>=0?(0,s.jsx)(l.ntg,{className:"size-5"}):(0,s.jsx)(l.klo,{className:"size-5"}),k(P)]}),(0,s.jsx)("span",{className:"text-text-tertiary text-[11px]",children:e("This week {{cur}} vs last week {{prev}}",{cur:w(z?.week_profit??0),prev:w(z?.prev_week_profit??0)})})]})]})}),(0,s.jsxs)("div",{className:"flex flex-wrap items-end gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 pb-1.5",children:[(0,s.jsx)(m.d,{id:"exclude-admin",checked:j,onCheckedChange:N}),(0,s.jsxs)(x.J,{htmlFor:"exclude-admin",className:"cursor-pointer text-xs leading-snug",children:[e("Exclude admin (xyuu) own usage"),(0,s.jsx)("span",{className:"text-text-tertiary block text-[11px]",children:e("Probe users are kept and counted as cost")})]})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)(x.J,{htmlFor:"recon-start",className:"text-xs",children:e("Start date")}),(0,s.jsx)(c.p,{id:"recon-start",type:"date",value:t,max:g,onChange:e=>a(e.target.value),className:"h-9 w-40"})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)(x.J,{htmlFor:"recon-end",className:"text-xs",children:e("End date")}),(0,s.jsx)(c.p,{id:"recon-end",type:"date",value:g,min:t,max:$(),onChange:e=>f(e.target.value),className:"h-9 w-40"})]})]})]})}),(0,s.jsx)("div",{className:"border-border/70 overflow-hidden rounded-lg border",children:(0,s.jsxs)(u.XI,{children:[(0,s.jsx)(u.A0,{children:(0,s.jsxs)(u.Hj,{children:[(0,s.jsx)(u.nd,{children:e("Group")}),(0,s.jsx)(u.nd,{className:"text-right",children:e("Margin")}),(0,s.jsx)(u.nd,{className:"text-right",children:e("Client billed tokens")}),(0,s.jsx)(u.nd,{className:"text-right",children:e("Upstream billed tokens")}),(0,s.jsx)(u.nd,{className:"text-right",children:e("Token delta")}),(0,s.jsx)(u.nd,{className:"text-right",children:e("Client billed amount")}),(0,s.jsxs)(u.nd,{className:"text-right",children:[e("Upstream billed amount")," (¥)"]}),(0,s.jsx)(u.nd,{className:"text-right",children:e("Probe cost")}),(0,s.jsx)(u.nd,{className:"text-right",children:e("Profit")})]})}),(0,s.jsx)(u.BF,{children:y?Array.from({length:5}).map((e,t)=>(0,s.jsx)(u.Hj,{children:Array.from({length:9}).map((e,t)=>(0,s.jsx)(u.nA,{children:(0,s.jsx)(o.E,{className:"h-4 w-full"})},t))},t)):H?(0,s.jsx)(u.Hj,{children:(0,s.jsx)(u.nA,{colSpan:9,className:"text-destructive h-24 text-center text-sm",children:A?.message||e("Failed to load data")})}):0===M.length?(0,s.jsx)(u.Hj,{children:(0,s.jsx)(u.nA,{colSpan:9,className:"text-text-tertiary h-24 text-center text-sm",children:e("No data in the selected range")})}):M.map(t=>(0,s.jsxs)(u.Hj,{children:[(0,s.jsxs)(u.nA,{children:[(0,s.jsx)("div",{className:"font-medium",children:t.group_name}),(0,s.jsx)("div",{className:"text-text-tertiary text-xs",children:t.channel_names||e("No local channel matched")})]}),(0,s.jsx)(u.nA,{className:(0,d.cn)("text-right font-medium tabular-nums",t.margin>=0?"text-emerald-600 dark:text-emerald-400":"text-red-600 dark:text-red-400"),children:t.client_amount>0?k(t.margin):"—"}),(0,s.jsx)(u.nA,{className:"text-right tabular-nums",children:F(t.client_tokens)}),(0,s.jsx)(u.nA,{className:"text-right tabular-nums",children:F(t.upstream_tokens)}),(0,s.jsxs)(u.nA,{className:(0,d.cn)("text-right tabular-nums",t.token_delta<0&&"text-amber-600 dar
1k:text-amber-400"),children:[t.token_delta>0?"+":"",F(t.token_delta)]}),(0,s.jsx)(u.nA,{className:"text-right tabular-nums",children:w(t.client_amount)}),(0,s.jsxs)(u.nA,{className:"text-right tabular-nums",children:[(0,s.jsx)("div",{children:_(t.upstream_amount_cny)}),(0,s.jsxs)("div",{className:"text-text-tertiary text-xs",children:["≈",w(t.upstream_amount)]})]}),(0,s.jsx)(u.nA,{className:"text-text-tertiary text-right tabular-nums",children:t.probe_amount>0?w(t.probe_amount):"—"}),(0,s.jsx)(u.nA,{className:(0,d.cn)("text-right font-medium tabular-nums",t.profit>=0?"text-emerald-600 dark:text-emerald-400":"text-red-600 dark:text-red-400"),children:w(t.profit)})]},t.upstream_key_id))})]})})]})})]})}}}]);

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.