1/*! LICENSE: 195.384c4dd490.js.LICENSE.txt */ 2"use strict";(self.rspackChunknewapi_web=self.rspackChunknewapi_web||[]).push([[195],{96735(e,a,t){var l=t(72361);t(68413);var n=t(15875),r=t(56275);function s(e){let{...a}=e;return(0,l.jsx)(n._s.Root,{"data-slot":"drawer",...a})}function i(e){let{...a}=e;return(0,l.jsx)(n._s.Trigger,{"data-slot":"drawer-trigger",...a})}function o(e){let{...a}=e;return(0,l.jsx)(n._s.Portal,{"data-slot":"drawer-portal",...a})}function c(e){let{className:a,...t}=e;return(0,l.jsx)(n._s.Overlay,{"data-slot":"drawer-overlay",className:(0,r.cn)("data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 fixed inset-0 z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs",a),...t})}function d(e){let{className:a,children:t,...s}=e;return(0,l.jsxs)(o,{"data-slot":"drawer-portal",children:[(0,l.jsx)(c,{}),(0,l.jsxs)(n._s.Content,{"data-slot":"drawer-content",className:(0,r.cn)("group/drawer-content bg-background text-foreground fixed z-50 flex h-auto flex-col overflow-hidden text-sm shadow-none data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:border-t data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-r-xl data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-l-xl data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-b data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm",a),...s,children:[(0,l.jsx)("div",{className:"bg-muted mx-auto mt-4 hidden h-1 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),t]})]})}function u(e){let{className:a,...t}=e;return(0,l.jsx)("div",{"data-slot":"drawer-header",className:(0,r.cn)("flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-0.5 md:text-left",a),...t})}function m(e){let{className:a,...t}=e;return(0,l.jsx)("div",{"data-slot":"drawer-footer",className:(0,r.cn)("mt-auto flex flex-col gap-2 p-4",a),...t})}function p(e){let{className:a,...t}=e;return(0,l.jsx)(n._s.Title,{"data-slot":"drawer-title",className:(0,r.cn)("text-foreground text-base font-medium",a),...t})}function x(e){let{className:a,...t}=e;return(0,l.jsx)(n._s.Description,{"data-slot":"drawer-description",className:(0,r.cn)("text-muted-foreground text-sm",a),...t})}t.d(a,{BE:()=>u,I6:()=>x,Uz:()=>i,_s:()=>s,gk:()=>p,tb:()=>m,zj:()=>d})},34444(e,a,t){var l=t(89795),n=t(52523);function r(){let{user:e}=(0,n.n)(e=>e.auth);return(e?.role??0)>=l.z7.ADMIN}t.d(a,{h:()=>r})},8803(e,a,t){var l=t(68413);let n="page-size";function r(e){let{search:a,navigate:t,pagination:r,globalFilter:s,columnFilters:i=[]}=e,o=r?.pageKey??"page",c=r?.pageSizeKey??"pageSize",d=r?.defaultPage??1,u=r?.defaultPageSize??20,m=s?.key??"filter",p=s?.enabled??!0,x=s?.trim??!0,h=(0,l.useMemo)(()=>{let e=[];for(let t of i){let l=a[t.searchKey],n=t.deserialize??(e=>e);if("string"===t.type){let a=n(l)??"";"string"==typeof a&&""!==a.trim()&&e.push({id:t.columnId,value:a})}else{let a=n(l)??[];Array.isArray(a)&&a.length>0&&e.push({id:t.columnId,value:a})}}return e},[i,a]),[g,f]=(0,l.useState)(h);(0,l.useEffect)(()=>{f(h)},[a]);let b=(0,l.useMemo)(()=>{let e=a[o],t=a[c];return{pageIndex:Math.max(0,("number"==typeof e?e:d)-1),pageSize:"number"==typeof t?t:function(){try{let e=parseInt(localStorage.getItem(n)??"",10);return e>0?e:void 0}catch{return}}()??u}},[a,o,c,d,u]),[y,j]=(0,l.useState)(()=>
2{if(!p)return;let e=a[m];return"string"==typeof e?e:""}),v=p?e=>{let a="function"==typeof e?e(y??""):e,l=x?a.trim():a;j(l),t({search:e=>({...e,[o]:void 0,[m]:l||void 0})})}:void 0;return{globalFilter:p?y??"":void 0,onGlobalFilterChange:v,columnFilters:g,onColumnFiltersChange:e=>{let a="function"==typeof e?e(g):e;f(a);let l={};for(let e of i){let t=a.find(a=>a.id===e.columnId),n=e.serialize??(e=>e);if("string"===e.type){let a="string"==typeof t?.value?t.value:"";l[e.searchKey]=""!==a.trim()?n(a):void 0}else{let a=Array.isArray(t?.value)?t.value:[];l[e.searchKey]=a.length>0?n(a):void 0}}t({search:e=>({...e,[o]:void 0,...l})})},pagination:b,onPaginationChange:e=>{let a="function"==typeof e?e(b):e,l=a.pageIndex+1,r=a.pageSize;r!==b.pageSize&&function(e){try{localStorage.setItem(n,String(e))}catch{}}(r),t({search:e=>({...e,[o]:l<=d?void 0:l,[c]:r})})},ensurePageInRange:function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{resetTo:"first"},n=a[o],r="number"==typeof n?n:d;e>0&&r>e&&t({replace:!0,search:a=>({...a,[o]:"last"===l.resetTo?e:void 0})})}}}t.d(a,{c:()=>r})},69198(e,a,t){t.r(a),t.d(a,{component:()=>tG});var l=t(72361),n=t(2718),r=t(82799),s=t(68413),i=t(6702),o=t(47745),c=t(56920),d=t(20598),u=t(60641),m=t(33271),p=t(18372);function x(e){let{t:a}
2=(0,i.Bd)(),[t,n]=(0,s.useState)(!1),[r,o]=(0,s.useState)(null),c=(0,s.useRef)(0);(0,s.useEffect)(()=>{if(!e.open||!e.target?.rule_name||!e.target?.key_fp)return void o(null);let t=++c.current;n(!0),o(null),(0,p.Mb)(e.target).then(e=>{t===c.current&&(e.success?o(e.data||{}):d.oR.error(e.message||a("Request failed")))}).catch(()=>{t===c.current&&d.oR.error(a("Request failed"))}).finally(()=>{t===c.current&&n(!1)})},[e.open,e.target,a]);let x=(0,s.useMemo)(()=>{if(!r)return[];let t=[],l=Number(r.hit||0),n=Number(r.total||0);(r.rule_name||e.target?.rule_name)&&t.push({key:a("Rule"),value:r.rule_name||e.target?.rule_name||""}),(r.using_group||e.target?.using_group)&&t.push({key:a("Group"),value:r.using_group||e.target?.using_group||""}),e.target?.key_hint&&t.push({key:a("Key Summary"),value:e.target.key_hint}),(r.key_fp||e.target?.key_fp)&&t.push({key:a("Key Fingerprint"),value:r.key_fp||e.target?.key_fp||""}),Number(r.window_seconds||0)>0&&t.push({key:a("TTL (seconds)"),value:r.window_seconds}),n>0&&t.push({key:a("Hit Rate"),value:`${l}/${n} (${function(e,a){if(!a||a<=0)return"-";let t=e/a*100;return Number.isFinite(t)?`${t.toFixed(2)}%`:"-"}(l,n)})`}),Number(r.last_seen_at||0)>0&&t.push({key:a("Last Seen"),value:(0,m.fk)(r.last_seen_at)});let s=Number(r.prompt_tokens||0),i=Number(r.cached_tokens||0),o=Number(r.completion_tokens||0),c=Number(r.total_tokens||0);return s>0&&t.push({key:"Prompt tokens",value:s}),i>0&&t.push({key:"Cached tokens",value:i}),o>0&&t.push({key:"Completion tokens",value:o}),c>0&&t.push({key:"Total tokens",value:c}),t},[r,e.target,a]);return(0,l.jsxs)(u.l,{open:e.open,onOpenChange:e.onOpenChange,title:a("Channel Affinity: Upstream Cache Hit"),contentClassName:"sm:max-w-lg",contentHeight:"auto",bodyClassName:"space-y-4",children:[(0,l.jsx)("p",{className:"text-muted-foreground text-xs",children:a("Hit criteria: If cached tokens exist in usage, it counts as a hit.")}),t?(0,l.jsx)("div",{className:"text-muted-foreground py-8 text-center text-sm",children:a("Loading...")}):x.length>0?(0,l.jsx)("div",{className:"space-y-2",children:x.map(e=>(0,l.jsxs)("div",{className:"flex justify-between gap-4 border-b pb-1 text-sm",children:[(0,l.jsx)("span",{className:"text-muted-foreground",children:e.key}),(0,l.jsx)("span",{className:"text-right font-medium break-all",children:e.value})]},e.key))}):(0,l.jsx)("div",{className:"text-muted-foreground py-8 text-center text-sm",children:a("No data available")})]})}var h=t(82814),g=t(55724),f=t(11728),b=t(22990);let y={quota:0,rpm:0,tpm:0},j={items:[],total:0},v=[{value:0,label:"Unknown",color:"default"},{value:1,label:"Top-up",color:"cyan"},{value:2,label:"Consume",color:"green"},{value:3,label:"Manage",color:"orange"},{value:4,label:"System",color:"purple"},{value:5,label:"Error",color:"red"},{value:6,label:"Refund",color:"blue"},{value:7,label:"Login",color:"teal"}],_=[{label:"All Types",value:"0"},...v.filter(e=>0!==e.value).map(e=>({label:e.label,value:String(e.value)}))],N="IMAGINE",k="UPSCALE",w="VIDEO",C="EDITS",S="VARIATION",A="HIGH_VARIATION",T="LOW_VARIATION",I="DESCRIBE",M="BLEND",q="UPLOAD",z="SHORTEN",$="REROLL",D="INPAINT",F="SWAP_FACE",R="ZOOM",L="CUSTOM_ZOOM",K="generate",P="textGenerate",O="firstTailGenerate",E="referenceGenerate",B="remixGenerate",U="SUCCESS",V={[String(1)]:{label:"Submitted",variant:"green"},[String(21)]:{label:"Waiting",variant:"lime"},[String(22)]:{label:"Duplicate",variant:"orange"},[String(0)]:{label:"Not Submitted",variant:"yellow"}},W=[0,2,5,6],H=[2,5];function G(e){return W.includes(e)}function Z(e){return H.includes(e)}function Y(e){return v.find(a=>a.value===e)||v["0"]}function Q(){let e=new Date,a=new Date(e);return a.setHours(0,0,0,0),{start:a,end:new Date(e.getTime()+36e5)}}function J(e){let a=new URLSearchParams;return Object.entries(e).forEach(e=>{let[t,l]=e;null!=l&&""!==l&&a.append(t,String(l))}),a}function X(e,a){let t=e.startTime??e.endTime?null:Q(),l=(e,t)=>{let l,n=e||t?.getTime();return n?(l=n,a?l:Math.floor(l/1e3)):void 0};return{start_timestamp:l(e.startTime,t?.start),end_timestamp:l(e.endTime,t?.end)}}function ee(e){let{page:a,pageSize:t,searchParams:l,columnFilters:n=[],isAdmin:r}=e,s=e=>{let a=e=>{let a=Number(e);return Number.isFinite(a)?a:void 0};return Array.isArray(e)&&1===e.length?a(e[0]):"string"==typeof e&&""!==e?a(e):void 0},i={p:a,page_size:t,...l.type?{type:s(l.type)}:{},...l.model?{model_name:String(l.model)}
2:{},...l.token?{token_name:String(l.token)}:{},...l.group?{group:String(l.group)}:{},...r&&l.channel?{channel:Number(l.channel)||0}:{},...r&&l.username?{username:String(l.username)}:{},...l.requestId?{request_id:String(l.requestId)}:{},...l.upstreamRequestId?{upstream_request_id:String(l.upstreamRequestId)}:{},...X(l,!1)};return n.length>0&&n.forEach(e=>{let{id:a,value:t}=e;if(null!=t&&""!==t)switch(a){case"type":i.type=s(t);break;case"model_name":i.model_name=String(t);break;case"token_name":i.token_name=String(t);break;case"group":i.group=String(t);break;case"channel":r&&(i.channel=Number(t)||0);break;case"username":r&&(i.username=String(t))}}),i}async function ea(e){let{logCategory:a,isAdmin:t,page:l,pageSize:n,searchParams:r,columnFilters:s}=e;if("common"===a){let e=ee({page:l,pageSize:n,searchParams:r,columnFilters:s,isAdmin:t});return t?await er(e):await es(e)}let i={...function(e){let{page:a,pageSize:t,searchParams:l,useMilliseconds:n=!1}=e;return{p:a,page_size:t,...l.channel?{channel_id:String(l.channel)}:{},...X(l,n)}}({page:l,pageSize:n,searchParams:r,useMilliseconds:"drawing"===a}),..."drawing"===a?{mj_id:r.filter}:{},..."task"===a?{task_id:r.filter}:{}};return"drawing"===a?t?await ed(i):await eu(i):t?await em(i):await ep(i)}function et(e,a){return a?e:`${e}/self`}async function el(e,a,t){let l=J({p:a.p||1,page_size:a.page_size||20,...a}),n=et(e,t);return(await b.FH.get(`${n}?${l}`)).data}async function en(e,a,t){let l=J(a),n=et(e,t);return(await b.FH.get(`${n}/stat?${l}`)).data}let er=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return el("/api/log",e,!0)},es=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return el("/api/log",e,!1)},ei=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return en("/api/log",e,!0)},eo=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return en("/api/log",e,!1)};async function ec(e){return(await b.FH.get(`/api/user/${e}`)).data}let ed=e=>el("/api/mj",e,!0),eu=e=>el("/api/mj",e,!1),em=e=>el("/api/task",e,!0),ep=e=>el("/api/task",e,!1);function ex(e){let{userId:a,open:t,onOpenChange:n}=e,{t:r}=(0,i.Bd)(),[o,c]=(0,s.useState)(null),[p,x]=(0,s.useState)(!1),h=(0,s.useCallback)(async e=>{x(!0);try{let a=await ec(e);a.success?c(a.data||null):d.oR.error(a.message||r("Failed to fetch user information"))}catch(e){console.error("Failed to fetch user info:",e),d.oR.error(r("Failed to fetch user information"))}finally{x(!1)}},[r]);(0,s.useEffect)(()=>{t&&a&&h(a)},[t,a,h]);let b=e=>{let{label:a,value:t}=e;return(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(f.J,{className:"text-muted-foreground text-xs",children:a}),(0,l.jsx)("div",{className:"text-sm font-semibold",children:t})]})};return(0,l.jsx)(u.l,{open:t,onOpenChange:n,title:r("User Information"),description:r("View detailed information about this user including balance, usage statistics, and invitation details."),contentClassName:"sm:max-w-lg",contentHeight:"auto",bodyClassName:"space-y-4",children:p?(0,l.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,l.jsx)(g.A,{className:"text-muted-foreground size-6 animate-spin"})}):o?(0,l.jsxs)("div",{className:"space-y-4 py-4",children:[(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,l.jsx)(b,{label:r("Username"),value:o.username}),o.display_name&&(0,l.jsx)(b,{label:r("Display Name"),value:o.display_name})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,l.jsx)(b,{label:r("Balance"),value:(0,m.eN)(o.quota)}),(0,l.jsx)(b,{label:r("Used Quota"),value:(0,m.eN)(o.used_quota)})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,l.jsx)(b,{label:r("Request Count"),value:(0,m.wk)(o.request_count)}),o.group&&(0,l.jsx)(b,{label:r("User Group"),value:o.group})]}),(o.aff_code||void 0!==o.aff_count||void 0!==o.aff_quota&&o.aff_quota>0)&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[o.aff_code&&(0,l.jsx)(b,{label:r("Invitation Code"),value:o.aff_code}),void 0!==o.aff_count&&(0,l.jsx)(b,{label:r("Invited Users"),value:(0,m.wk)(o.aff_count)})]}),void 0!==o.aff_quota&&o.aff_quota>0&&(0,l.jsx)(b,{label:r("Invitation Quota"),value:(0,m.eN)(o.aff_quota)})]}),o.remark&&(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(f.J,{className:"text-muted-foreground text-xs",children:r("Remark")}),(0,l.jsx)("div",{className:"text-sm leading-relaxed font-semibold break-words",children:o.remark})]})]}):(0,l.jsx)("div",{className:"text-muted-foreground py-8 text-center text-sm",children:r("No user information available")})})}var eh=t(34444);let eg=(0,s.createContext)(void 0);function ef(e){let{children:a}
2=e,[t,n]=(0,s.useState)(null),[r,i]=(0,s.useState)(!1),[o,c]=(0,s.useState)(null),[d,u]=(0,s.useState)(!1),[m,p]=(0,s.useState)(!0),[x,h]=(0,s.useState)("all");return(0,l.jsx)(eg.Provider,{value:{selectedUserId:t,setSelectedUserId:n,userInfoDialogOpen:r,setUserInfoDialogOpen:i,affinityTarget:o,setAffinityTarget:c,affinityDialogOpen:d,setAffinityDialogOpen:u,sensitiveVisible:m,setSensitiveVisible:p,viewScope:x,setViewScope:h},children:a})}function eb(){let e=(0,s.useContext)(eg);if(!e)throw Error("useUsageLogsContext must be used within UsageLogsProvider");return e}function ey(){let e=(0,eh.h)(),{viewScope:a,setViewScope:t}=eb();return{canManageScope:e,viewScope:a,setViewScope:t,isAdminView:e&&"all"===a}}var ej=t(53540),ev=t(55045),e_=t(7579),eN=t(8803),ek=t(56275),ew=t(10823),eC=t(40315),eS=t(47296),eA=t(98622),eT=t(42817),eI=t(13683),eM=t(74501),eq=t(47303),ez=t(15585),e$=t(43459),eD=t(64832);let eF={set:"Set",delete:"Delete",copy:"Copy",move:"Move",append:"Append",prepend:"Prepend",trim_prefix:"Trim Prefix",trim_suffix:"Trim Suffix",ensure_prefix:"Ensure Prefix",ensure_suffix:"Ensure Suffix",trim_space:"Trim Space",to_lower:"To Lower",to_upper:"To Upper",replace:"Replace",regex_replace:"Regex Replace",set_header:"Set Header",delete_header:"Delete Header",copy_header:"Copy Header",move_header:"Move Header",pass_headers:"Pass Headers",sync_fields:"Sync Fields",return_error:"Return Error"};function eR(e){return!!e&&(!0===e.violation_fee||!!e.violation_fee_code||!!e.violation_fee_marker)}function eL(e){return"number"==typeof e&&Number.isFinite(e)&&e>0}function eK(e,a,t){return!0===e&&eL(a)&&eL(t)}function eP(e){if(!e)return null;try{return JSON.parse(e)}catch(e){return console.error("Failed to parse log other field:",e),null}}function eO(e){return e<5?"success":e<10?"warning":"danger"}function eE(e,a){var t;return a<100||e<=0?e<10?"success":e<30?"warning":"danger":(t=a/e)>=30?"success":t>=15?"warning":"danger"}function eB(e){if(!e)return"";try{let a="u">typeof window?window.atob(e):Buffer.from(e,"base64").toString("binary"),t=new Uint8Array(a.length);for(let e=0;e<a.length;e++)t[e]=a.charCodeAt(e);if("u">typeof TextDecoder)return new TextDecoder().decode(t);return decodeURIComponent(Array.prototype.map.call(t,e=>`%${e.toString(16).padStart(2,"0")}`).join(""))}catch{return""}}function eU(e){return!!e&&((e.cache_tokens||0)>0||(e.cache_creation_tokens||0)>0||(e.cache_creation_tokens_5m||0)>0||(e.cache_creation_tokens_1h||0)>0)}function eV(e){var a;if(!e||"tiered_expr"!==e.billing_mode)return null;let t=eB(e.expr_b64);if(!t)return null;let l=(0,eD.oK)(t),n=(a=e.matched_tier,0!==l.length&&a&&l.find(e=>{let t=(0,eD.wM)(e.label);return t===(0,eD.wM)(a)&&""!==t})||null);if(!n)return null;let r=eU(e),s=[];for(let e of eD.mq){if(!e.field||"cache"===e.group&&!r)continue;let a=Number(n[e.field]);Number.isFinite(a)&&a>0&&s.push({field:e.field,shortLabel:e.shortLabel,price:a})}return{tiers:l,tier:n,priceEntries:s}}let eW={login:"Logged in successfully via {{method}}","user.create":"Created user {{username}} (role {{role}})","user.update":"Updated user {{username}} (ID: {{id}})","user.delete":"Deleted user {{username}} (ID: {{id}})","user.manage":"Performed {{action}} on user {{username}} (ID: {{id}})","user.quota_add":"Increased user quota by {{quota}}","user.quota_subtract":"Decreased user quota by {{quota}}","user.quota_override":"Overrode user quota from {{from}} to {{to}}","user.binding_clear":"Cleared {{bindingType}} binding for user {{username}}","user.2fa_disable":"Force-disabled two-factor authentication for the user","user.passkey_register":"Registered a passkey","user.passkey_delete":"Deleted a passkey","user.topup_complete":"Completed top-up order for the user","user.reset_passkey":"Reset the user passkey","user.oauth_unbind":"Removed an OAuth binding for the user","option.update":"Updated system setting {{key}}","option.payment_compliance":"Confirmed payment compliance","option.reset_ratio":"Reset model ratios","option.clear_affinity_cache":"Cleared channel affinity cache","custom_oauth.create":"Created a custom OAuth provider","custom_oauth.update":"Updated a custom OAuth provider","custom_oauth.delete":"Deleted a custom OAuth provider","performance.clear_disk_cache":"Cleared disk cache","performance.gc":"Triggered garbage collection","performance.clear_logs":"Cleared log files","channel.create":"Created channel {{name}} (type {{type}}, count {{count}})","channel.update":"Updated channel {{name}} (ID: {{id}})","channel.delete":"Deleted channel {{name}} (ID: {{id}})","channel.delete_batch":"Batch deleted {{count}} channels","channel.delete_disabled":"Deleted all disabled channels ({{count}})","channel.key_view":"Viewed channel key {{name}} (ID: {{id}})","channel.tag_disable":"Disabled channels with tag {{tag}}","channel.tag_enable":"Enabled channels with tag {{tag}}","channel.tag_edit":"Edited channels with tag {{tag}}","channel.tag_batch_set":"Batch set tag for {{count}} channels","channel.copy":"Copied channel (source ID: {{sourceId}}) to {{name}} (new ID: {{id}})","channel.multi_key_manage":"Multi-key management {{action}} on channel (ID: {{id}})","channel.upstream_apply":"Applied upstream model changes to channel (ID: {{id}})","channel.upstream_apply_all":"Applied upstream model changes to {{count}} channels","redemption.create":"Created {{count}} redemption codes named {{name}} ({{quota}} each)","redemption.update":"Updated a redemption code","redemption.delete":"Deleted a redemption code","redemption.delete_invalid":"Deleted invali
2d redemption codes","prefill_group.create":"Created a prefill group","prefill_group.update":"Updated a prefill group","prefill_group.delete":"Deleted a prefill group","vendor.create":"Created a vendor","vendor.update":"Updated a vendor","vendor.delete":"Deleted a vendor","model.create":"Created a model","model.update":"Updated a model","model.delete":"Deleted a model","model.sync_upstream":"Synced upstream models","deployment.create":"Created a deployment","deployment.update":"Updated a deployment","deployment.delete":"Deleted a deployment","subscription.plan_create":"Created a subscription plan","subscription.plan_update":"Updated a subscription plan","subscription.bind":"Bound a subscription","log.clear":"Cleared historical logs","log.cleanup_start":"Log cleanup task started.",generic:"{{method}} {{route}}"};function eH(e,a){let t=e?.op;if(!t?.action)return null;let l=eW[t.action];return l?a(l,t.params??{}):null}var eG=t(67733),eZ=t(67834),eY=t(99893),eQ=t(35285),eJ=t(96855),eX=t(73606),e0=t(86094),e1=t(9781);let e2=(0,e1.A)("user-cog",[["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m14.305 16.53.923-.382",key:"1itpsq"}],["path",{d:"m15.228 13.852-.923-.383",key:"eplpkm"}],["path",{d:"m16.852 12.228-.383-.923",key:"13v3q0"}],["path",{d:"m16.852 17.772-.383.924",key:"1i8mnm"}],["path",{d:"m19.148 12.228.383-.923",key:"1q8j1v"}],["path",{d:"m19.53 18.696-.382-.924",key:"vk1qj3"}],["path",{d:"m20.772 13.852.924-.383",key:"n880s0"}],["path",{d:"m20.772 16.148.924.383",key:"1g6xey"}],["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);var e5=t(59736);let e3=(0,e1.A)("headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]),e4=(0,e1.A)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),e6=(0,e1.A)("cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);var e8=t(76336),e7=t(72868),e9=t(39649),ae=t(51346),aa=t(29625);let at="local",al={status:"Status",models:"Models",group:"Group",type:"Type",base_url:"Base URL",key:"Key"};function an(e){return"success"===e?"text-emerald-600":"warning"===e?"text-amber-600":"text-rose-600"}function ar(e){return(0,l.jsxs)("div",{className:"grid min-w-0 grid-cols-[5.25rem_minmax(0,1fr)] gap-2 text-sm sm:grid-cols-[7rem_minmax(0,1fr)] sm:gap-3",children:[(0,l.jsx)("span",{className:"text-muted-foreground min-w-0 text-xs",children:e.label}),(0,l.jsx)("span",{className:(0,ek.cn)("max-w-full min-w-0 text-xs break-all sm:wrap-break-word",e.mono&&"font-mono",e.muted&&"text-muted-foreground"),children:e.value})]})}function as(e){let a="danger"===e.variant,t=a?"destructive":e.iconTone;return(0,l.jsxs)("div",{className:"min-w-0 space-y-1.5",children:[(0,l.jsxs)(f.J,{className:(0,ek.cn)("flex items-center gap-1.5 text-xs font-semibold",a&&"text-red-500"),children:[e.icon&&(0,l.jsx)(e9.f,{tone:t,size:"xs",children:e.icon}),e.label]}),(0,l.jsx)("div",{className:(0,ek.cn)("min-w-0 space-y-1 overflow-hidden rounded-md border p-2.5 max-sm:p-2",a?"border-red-200 bg-red-50 dark:border-red-900 dark:bg-red-950/20":"bg-muted/30"),children:e.children})]})}function ai(e,a){switch(a?.usage_billing_path){case at:return e("Local Billing");case"billing-usage-openai":return e("Upstream Response (billing-usage-openai)");case"billing-usage-openai-estimated":return e("Upstream Response (billing-usage-openai-estimated)");case"billing-usage-anthropic":return e("Upstream Response (billing-usage-anthropic)");case"billing-usage-anthropic-estimated":return e("Upstream Response (billing-usage-anthropic-estimated)");case"billing-usage-gemini":return e("Upstream Response (billing-usage-gemini)");case"billing-usage-gemini-estimated":return e("Upstream Response (billing-usage-gemini-estimated)");case"upstream":return e("Upstream Response");default:return e(a?.local_count_tokens?"Local Billing":"Upstream Response")}}function ao(e){let{t:a}=(0,i.Bd)(),{log:t,other:n,isAdmin:r}=e,s=(n.model_price??0)>0,o=!0===n.claude,c="tiered_expr"===n.billing_mode,d=eV(n),u=[],p={digitsLarge:4,digitsSmall:6,abbreviate:!1},x=e=>(0,e$.AM)(e,p),h=null!=n.model_ratio?2*n.model_ratio:0;if(c)if(u.push({label:a("Billing Mode"),value:a("Dynamic Pricing")}),d)for(let e of(d.tier.label&&u.push({label:a("Matched Tier"),value:d.tier.label}
2),d.priceEntries))u.push({label:a(e.shortLabel),value:`${x(e.price)}/M`});else u.push({label:a("Matched Tier"),value:a("No matching results")});else s?(u.push({label:a("Billing Mode"),value:a("Per-call")}),null!=n.model_price&&u.push({label:a("Model Price"),value:x(n.model_price)})):(u.push({label:a("Billing Mode"),value:a("Per-token")}),null!=n.model_ratio&&u.push({label:a("Input"),value:`${x(h)}/M`}),null!=n.completion_ratio&&null!=n.model_ratio&&u.push({label:a("Output"),value:`${x(h*n.completion_ratio)}/M`}));let g=n.user_group_ratio,f=null!=g&&Number.isFinite(g)&&-1!==g,b=f?g:n.group_ratio;return(null!=b&&Number.isFinite(b)&&u.push({label:a(f?"User Exclusive Ratio":"Group Ratio"),value:`${null==b?"-":b.toFixed(4)}x`}),!c&&o&&eU(n)&&(null!=n.cache_ratio&&1!==n.cache_ratio&&u.push({label:a("Cache Read"),value:`${x(h*n.cache_ratio)}/M`}),null!=n.cache_creation_ratio&&1!==n.cache_creation_ratio&&u.push({label:a("Cache Creation"),value:`${x(h*n.cache_creation_ratio)}/M`}),null!=n.cache_creation_ratio_5m&&0!==n.cache_creation_ratio_5m&&u.push({label:a("Cache Creation (5m)"),value:`${x(h*n.cache_creation_ratio_5m)}/M`}),null!=n.cache_creation_ratio_1h&&0!==n.cache_creation_ratio_1h&&u.push({label:a("Cache Creation (1h)"),value:`${x(h*n.cache_creation_ratio_1h)}/M`})),c||(null!=n.audio_ratio&&1!==n.audio_ratio&&u.push({label:a("Audio input"),value:`${x(h*n.audio_ratio)}/M`}),null!=n.audio_completion_ratio&&1!==n.audio_completion_ratio&&u.push({label:a("Audio output"),value:`${x(h*n.audio_completion_ratio)}/M`}),null!=n.image_ratio&&1!==n.image_ratio&&u.push({label:a("Image input"),value:`${x(h*n.image_ratio)}/M`})),n.web_search&&n.web_search_call_count&&u.push({label:a("Web Search"),value:`${n.web_search_call_count}x${n.web_search_price?` (${x(n.web_search_price)})`:""}`}),n.file_search&&n.file_search_call_count&&u.push({label:a("File Search"),value:`${n.file_search_call_count}x${n.file_search_price?` (${x(n.file_search_price)})`:""}`}),n.image_generation_call&&n.image_generation_call_price&&u.push({label:a("Image Generation"),value:x(n.image_generation_call_price)}),n.audio_input_seperate_price&&n.audio_input_price&&u.push({label:a("Audio Input Price"),value:x(n.audio_input_price)}),r&&n.admin_info&&u.push({label:a("Billing Path"),value:ai(a,n.admin_info)}),u.push({label:a("Total Cost"),value:(0,m.qW)(t.quota)}),0===u.length)?null:(0,l.jsx)(as,{label:a("Billing Details"),children:u.map(e=>(0,l.jsx)(ar,{label:e.label,value:e.value,mono:!0},e.label))})}function ac(e){let{t:a}=(0,i.Bd)(),{log:t,other:n}=e,r=t.prompt_tokens||0,s=t.completion_tokens||0,o=n.cache_tokens||0,c=n.cache_creation_tokens||0,d=n.cache_creation_tokens_5m||0,u=n.cache_creation_tokens_1h||0;if(!(r>0||s>0))return null;let m=[];return m.push({label:a("Input Tokens"),value:r.toLocaleString()}),m.push({label:a("Output Tokens"),value:s.toLocaleString()}),o>0&&m.push({label:a("Cache Read"),value:o.toLocaleString()}),c>0&&0===d&&0===u&&m.push({label:a("Cache Write"),value:c.toLocaleString()}),d>0&&m.push({label:a("Cache Write (5m)"),value:d.toLocaleString()}),u>0&&m.push({label:a("Cache Write (1h)"),value:u.toLocaleString()}),n.image&&n.image_output&&m.push({label:a("Image Tokens"),value:n.image_output.toLocaleString()}),(0,l.jsx)(as,{label:a("Token Breakdown"),children:m.map(e=>(0,l.jsx)(ar,{label:e.label,value:e.value,mono:!0},e.label))})}function ad(e){var a,t;let{t:n}=(0,i.Bd)(),{copiedText:r,copyToClipboard:s}=(0,aa.C)({notify:!1}),o=e.log.content??"",c=eP(e.log.other),d=Y(e.log.type),p=eR(c),x=6===e.log.type,h=2===e.log.type,g=1===e.log.type,b=3===e.log.type,y=c?.billing_source==="subscription",j=h&&!p&&c?.billing_mode==="tiered_expr"&&!!c?.expr_b64,v=c?.ws||c?.audio,_=Z(e.log.type),N=!!e.log.ip&&(_||e.isAdmin&&g),k=c?.admin_info,w=g&&e.isAdmin&&k?[k.payment_method&&{label:n("Order Payment Method"),value:k.payment_method},k.callback_payment_method&&{label:n("Callback Payment Method"),value:k.callback_payment_method},k.caller_ip&&{label:n("Callback Caller IP"),value:k.caller_ip},k.server_ip&&{label:n("Server IP"),value:k.server_ip},k.node_name&&{label:n("Node Name"),value:k.node_name},k.version&&{label:n("System Version"),value:k.version}
2].filter(Boolean):[],C=g&&e.isAdmin&&!k,S=g&&e.isAdmin&&(w.length>0||C),A=(()=>{if(!b||!e.isAdmin||!k)return null;let a=k.admin_username,t=k.admin_id,l=null!=a&&""!==String(a).trim(),n=null!=t&&""!==String(t).trim();return l||n?l&&n?`${a} (ID: ${t})`:l?String(a):`ID: ${t}`:null})(),T=b&&e.isAdmin&&k?.auth_method?"access_token"===k.auth_method?n("Access Token"):"session"===k.auth_method?n("Session"):String(k.auth_method):"",I=eH(c,n),M=b&&e.isAdmin?c?.audit_info:void 0,q=(b&&e.isAdmin&&Array.isArray(c?.op?.params?.changed_fields)?c.op.params.changed_fields:[]).map(e=>n(al[e]??e)).join(", "),z=b&&e.isAdmin&&(null!=I||null!=M),$=7===e.log.type,D=$?[c?.login_method&&{label:n("Login Method"),value:String(c.login_method)},e.log.ip&&{label:n("IP Address"),value:e.log.ip},c?.user_agent&&{label:n("User Agent"),value:String(c.user_agent)}].filter(Boolean):[],F=c&&Array.isArray(c.request_conversion)?c.request_conversion.filter(Boolean):[],R=F.length<=1?n("Native format"):F.join(" -> "),L=e.isAdmin&&6!==e.log.type&&(c?.request_path||F.length>0),K=c?.admin_info?.use_channel,P=K&&K.length>0?K.join(" â "):void 0,O="green";return c?.reasoning_effort==="high"?O="orange":c?.reasoning_effort==="medium"&&(O="yellow"),(0,l.jsx)(u.l,{open:e.open,onOpenChange:e.onOpenChange,title:(0,l.jsxs)(l.Fragment,{children:[n("Log Details"),(0,l.jsx)(eT.Wh,{label:n(d.label),variant:d.color,size:"sm",copyable:!1})]}),description:n("View the complete details for this log entry"),contentClassName:(0,ek.cn)("min-w-0 overflow-hidden","max-sm:max-h-[calc(100dvh-1.5rem)] max-sm:w-[calc(100vw-1.5rem)] max-sm:max-w-[calc(100vw-1.5rem)] max-sm:p-4",j?"sm:max-w-4xl lg:max-w-5xl":"sm:max-w-lg"),headerClassName:"max-sm:gap-1",titleClassName:"flex items-center gap-2 text-base",descriptionClassName:"sr-only",contentHeight:"min(72dvh, 720px)",bodyClassName:"pr-2 sm:pr-4",children:(0,l.jsxs)("div",{className:"w-full max-w-full min-w-0 space-y-2.5 overflow-x-hidden py-1 sm:space-y-3",children:[(0,l.jsxs)("div",{className:"min-w-0 space-y-1",children:[e.log.request_id&&(0,l.jsx)(ar,{label:n("Request ID"),value:e.log.request_id,mono:!0}),e.log.upstream_request_id&&(0,l.jsx)(ar,{label:n("Upstream Request ID"),value:e.log.upstream_request_id,mono:!0}),e.isAdmin&&e.log.channel>0&&(0,l.jsx)(ar,{label:n("Channel"),value:(0,l.jsxs)("span",{children:[e.log.channel,e.log.channel_name&&(0,l.jsxs)("span",{className:"text-muted-foreground",children:[" ","(",e.log.channel_name,")"]})]}),mono:!0}),P&&e.isAdmin&&(0,l.jsx)(ar,{label:n("Retry Chain"),value:P,mono:!0}),e.log.token_name&&(0,l.jsx)(ar,{label:n("Token"),value:e.log.token_name,mono:!0}),(e.log.group||c?.group)&&(0,l.jsx)(ar,{label:n("Group"),value:e.log.group||c?.group||"",mono:!0}),N&&(0,l.jsx)(ar,{label:n("IP Address"),value:(0,l.jsxs)("span",{className:"flex items-center gap-1",children:[(0,l.jsx)(eG.A,{className:"size-3 text-amber-500","aria-hidden":"true"}),e.log.ip]}),mono:!0}),_&&e.log.use_time>0&&(0,l.jsx)(ar,{label:n("Response Time"),value:(0,l.jsxs)("span",{className:(0,ek.cn)("font-medium",an(eE(e.log.use_time,e.log.completion_tokens))),children:[(0,m.KK)(e.log.use_time),e.log.is_stream&&c?.frt!=null&&c.frt>0&&(0,l.jsxs)("span",{className:(0,ek.cn)("font-normal",an(eO(c.frt/1e3))),children:[" ","(FRT: ",(0,m.KK)(c.frt/1e3),")"]})]})})]}),L&&(0,l.jsx)(as,{label:n("Request Conversion"),children:(0,l.jsxs)("div",{className:"relative min-w-0",children:[(0,l.jsx)(e7.$,{variant:"ghost",size:"sm",className:"absolute top-0 right-0 h-5 w-5 p-0",onClick:()=>s(R),title:n("Copy to clipboard"),"aria-label":n("Copy to clipboard"),children:r===R?(0,l.jsx)(eZ.A,{className:"size-3 text-green-600"}):(0,l.jsx)(eY.A,{className:"size-3"})}),(0,l.jsxs)("div",{className:"min-w-0 space-y-1 pr-6",children:[c?.request_path&&(0,l.jsx)(ar,{label:n("Path"),value:c.request_path,mono:!0}),(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-xs",children:[(0,l.jsx)(eQ.A,{className:"text-muted-foreground size-3","aria-hidden":"true"}),(0,l.jsx)("span",{className:"min-w-0 break-all sm:wrap-break-word",children:R})]})]})]})}),e.isAdmin&&c?.admin_info?.quota_saturation&&(0,l.jsxs)(as,{icon:(0,l.jsx)(eJ.A,{className:"size-3.5","aria-hidden":"true"}),label:n("Quota clamped"),variant:"danger",children:[(0,l.jsx)("p",{className:"mb-1 text-xs wrap-break-word",children:n("Quota saturation protection triggered")}),(0,l.jsx)(ar,{label:n("Kind"),value:(a=c.admin_info.quota_saturation.kind,"overflow"===a?n("Overflow"):"underflow"===a?n("Underflow"):n("Invalid (NaN)"))}),(0,l.jsx)(ar,{label:n("Original value"),value:String(c.admin_info.quota_saturation.original),mono:!0}),(0,l.jsx)(ar,{label:n("Clamped to"),value:String(c.admin_info.quota_saturation.clamped),mono:!0}),(0,l.jsx)(ar,{label:n("Operation"),value:c.admin_info.quota_saturation.op,mono:!0})]}),e.isAdmin&&c?.reject_reason&&(0,l.jsx)(as,{icon:(0,l.jsx)(eJ.A,{className:"size-3.5","aria-hidden":"true"}),label:n("Reject Reason"),variant:"danger",children:(0,l.jsx)("p",{className:"text-xs wrap-break-word",children:c.reject_reason})}),p&&c&&(0,l.jsxs)(as,{icon:(0,l.jsx)(eJ.A,{className:"size-3.5","aria-hidden":"true"}),label:n("Violation Fee"),variant:"danger",children:[c.violation_fee_code&&(0,l.jsx)(ar,{label:n("Violation Code"),value:c.violation_fee_code,mono:!0}),c.violation_fee_marker&&(0,l.jsx)(ar,{label:n("Violation Marker"),value:c.violation_fee_marker}),(0,l.jsx)(ar,{label:n("Fee Amount"),value:(0,m.qW)(c.fee_quota??e.log.quota),mono:!0})]}),x&&c&&(c.task_id||c.reason)&&(0,l.jsxs)(as,{label:n("Refund Details"),children:[c.task_id&&(0,l.jsx)(ar,{label:n("Task ID"),value:c.task_id,mono:!0}),c.reason&&(0,l.jsx)(ar,{label:n("Reason"),value:c.reason})]}),S&&(0,l.jsxs)(as,{icon:(0,l.jsx)(eX.A,{className:"size-3.5","aria-hidden":"true"}),iconTone:"success",label:n("Top-up Audit Info"),children:[w.map(e=>(0,l.jsx)(ar,{label:e.label,value:e.value,mono:!0},e.label)),C&&(0,l.jsxs)("div",{className:"flex items-start gap-1.5 text-xs text-amber-600 dar
2k:text-amber-400",children:[(0,l.jsx)(e0.A,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":"true"}),(0,l.jsx)("span",{children:n("This historical record predates audit-info tracking and cannot be backfilled. The current instance already records server IP, callback IP, payment method, and system version for new top-ups going forward.")})]})]}),A&&(0,l.jsx)(ar,{label:(0,l.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,l.jsx)(e2,{className:"text-muted-foreground size-3.5","aria-hidden":"true"}),n("Operator Admin")]}),value:A,mono:!0}),z&&(0,l.jsxs)(as,{icon:(0,l.jsx)(eX.A,{className:"size-3.5","aria-hidden":"true"}),iconTone:"info",label:n("Operation Audit Info"),children:[null!=I&&(0,l.jsx)(ar,{label:n("Operation"),value:I}),""!==T&&(0,l.jsx)(ar,{label:n("Authentication Method"),value:T}),""!==q&&(0,l.jsx)(ar,{label:n("Changed Fields"),value:q}),M?.method&&M?.route&&(0,l.jsx)(ar,{label:n("Request"),value:`${M.method} ${M.route}`,mono:!0}),M?.status!=null&&(0,l.jsx)(ar,{label:n("Result"),value:
2M.success?`${n("Success")} (${M.status})`:`${n("Failed")} (${M.status})`,mono:!0})]}),$&&D.length>0&&(0,l.jsxs)(as,{icon:(0,l.jsx)(e5.A,{className:"size-3.5","aria-hidden":"true"}),iconTone:"info",label:n("Login Info"),children:[null!=I&&(0,l.jsx)(ar,{label:n("Operation"),value:I}),D.map(e=>(0,l.jsx)(ar,{label:e.label,value:e.value,mono:!0},e.label))]}),v&&c&&(0,l.jsxs)(as,{icon:(0,l.jsx)(e3,{className:"size-3.5","aria-hidden":"true"}),iconTone:"chart-4",label:n("Audio Tokens"),children:[null!=c.audio_input&&c.audio_input>0&&(0,l.jsx)(ar,{label:n("Audio Input"),value:(0,m._y)(c.audio_input),mono:!0}),null!=c.audio_output&&c.audio_output>0&&(0,l.jsx)(ar,{label:n("Audio Output"),value:(0,m._y)(c.audio_output),mono:!0}),null!=c.text_input&&c.text_input>0&&(0,l.jsx)(ar,{label:n("Text Input"),value:(0,m._y)(c.text_input),mono:!0}),null!=c.text_output&&c.text_output>0&&(0,l.jsx)(ar,{label:n("Text Output"),value:(0,m._y)(c.text_output),mono:!0})]}),c?.reasoning_effort&&(0,l.jsx)(ar,{label:n("Reasoning Effort"),value:(0,l.jsx)(eT.Wh,{label:c.reasoning_effort,variant:O,size:"sm",copyable:!1})}),c?.is_system_prompt_overwritten&&(0,l.jsx)(ar,{label:n("System Prompt"),value:(0,l.jsx)(eT.Wh,{label:n("Overwritten"),variant:"orange",size:"sm",copyable:!1})}),c?.is_model_mapped&&c?.upstream_model_name&&(0,l.jsxs)(as,{label:n("Model Mapping"),children:[(0,l.jsx)(ar,{label:n("Request Model"),value:e.log.model_name,mono:!0}),(0,l.jsx)(ar,{label:n("Actual Model"),value:c.upstream_model_name,mono:!0})]}),[0,2,5,6].includes(e.log.type)&&c&&(0,l.jsx)(ac,{log:e.log,other:c}),h&&c&&!p&&(0,l.jsx)(ao,{log:e.log,other:c,isAdmin:e.isAdmin}),j&&c?.expr_b64&&(0,l.jsx)(as,{label:n("Dynamic Pricing"),children:(0,l.jsx)(ae.N,{compact:!0,billingExpr:eB(c.expr_b64),matchedTierLabel:c.matched_tier,hideCacheColumns:!eU(c)})}),e.isAdmin&&!h&&6!==e.log.type&&c?.admin_info&&(0,l.jsx)(ar,{label:n("Billing Path"),value:(0,l.jsxs)("span",{className:"flex items-center gap-1",children:[(t=c.admin_info,t?.usage_billing_path?t.usage_billing_path===at:t?.local_count_tokens===!0)?(0,l.jsx)(e4,{className:"size-3 text-blue-500"}):(0,l.jsx)(e6,{className:"size-3 text-emerald-500"}),(0,l.jsx)("span",{className:"text-xs",children:ai(n,c.admin_info)})]})}),c?.stream_status&&"ok"!==c.stream_status.status&&(0,l.jsxs)(as,{label:n("Stream Status"),children:[(0,l.jsx)(ar,{label:n("Status"),value:(0,l.jsx)(eT.Wh,{label:c.stream_status.status||n("Error"),variant:"red",size:"sm",copyable:!1})}),c.stream_status.end_reason&&(0,l.jsx)(ar,{label:n("End Reason"),value:c.stream_status.end_reason}),(c.stream_status.error_count??0)>0&&(0,l.jsx)(ar,{label:n("Soft Errors"),value:String(c.stream_status.error_count)}),c.stream_status.end_error&&(0,l.jsx)(ar,{label:n("End Error"),value:c.stream_status.end_error}),Array.isArray(c.stream_status.errors)&&c.stream_status.errors.length>0&&(0,l.jsx)("pre",{className:"bg-background/60 mt-1 max-h-32 overflow-y-auto rounded border p-2 font-mono text-[11px] leading-relaxed wrap-break-word whitespace-pre-wrap",children:c.stream_status.errors.join("\n")})]}),y&&c&&(0,l.jsxs)(as,{label:n("Subscription Billing"),children:[c.subscription_plan_id&&(0,l.jsx)(ar,{label:n("Plan"),value:`#${c.subscription_plan_id} ${c.subscription_plan_title||""}`.trim()}),c.subscription_id&&(0,l.jsx)(ar,{label:n("Instance"),value:`#${c.subscription_id}`,mono:!0}),null!=c.subscription_pre_consumed&&(0,l.jsx)(ar,{label:n("Pre-consumed"),value:(0,m.qW)(c.subscription_pre_consumed),mono:!0}),null!=c.subscription_post_delta&&0!==c.subscription_post_delta&&(0,l.jsx)(ar,{label:n("Post Delta"),value:(0,m.qW)(c.subscription_post_delta),mono:!0}),null!=c.subscription_consumed&&(0,l.jsx)(ar,{label:n("Final Consumed"),value:(0,m.qW)(c.subscription_consumed),mono:!0}),null!=c.subscription_remain&&(0,l.jsx)(ar,{label:n("Remaining"),value:`${(0,m.qW)(c.subscription_remain)}${null!=c.subscription_total?` / ${(0,m.qW)(c.subscription_total)}`:""}`,mono:!0})]}),c?.po&&Array.isArray(c.po)&&c.po.length>0&&(0,l.jsx)(as,{icon:(0,l.jsx)(e8.A,{className:"size-3.5","aria-hidden":"true"}),iconTone:"chart-3",label:`${n("Param Override")} (${c.po.length}
2)`,children:c.po.filter(Boolean).map(e=>{var a;let t,r=function(e){if("string"!=typeof e)return null;let a=e.indexOf(" ");return a<=0?{action:e,content:e}:{action:e.slice(0,a),content:e.slice(a+1)}}(e);return r?(0,l.jsxs)("div",{className:"bg-background/60 flex min-w-0 flex-col gap-1.5 rounded border p-2 sm:flex-row sm:items-start sm:gap-2",children:[(0,l.jsx)(eT.Wh,{variant:"neutral",label:(a=r.action,(t=eF[a.toLowerCase()])?n(t):a),className:"shrink-0 font-medium",copyable:!1}),(0,l.jsx)("span",{className:"min-w-0 font-mono text-[11px] leading-relaxed break-all sm:wrap-break-word",children:r.content})]},`${r.action}-${r.content}`):null})}),o&&(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(f.J,{className:"text-xs font-semibold",children:n("Content")}),(0,l.jsxs)("div",{className:"bg-muted/30 relative min-w-0 overflow-hidden rounded-md border p-2.5",children:[(0,l.jsx)(e7.$,{variant:"ghost",size:"sm",className:"absolute top-1.5 right-1.5 h-5 w-5 p-0",onClick:()=>s(o),title:n("Copy to clipboard"),"aria-label":n("Copy to clipboard"),children:r===o?(0,l.jsx)(eZ.A,{className:"size-3 text-green-600"}):(0,l.jsx)(eY.A,{className:"size-3"})}),(0,l.jsx)("p",{className:"min-w-0 pr-6 text-xs leading-relaxed break-all whitespace-pre-wrap sm:wrap-break-word",children:o})]})]})]})})}let au=[["path",{d:"M20.3584 13.3567C19.1689 14.546 16.9308 14.4998 13.4992 14.4998C11.2914 14.4998 9.50138 12.7071 9.50024 10.4993C9.50024 7.07001 9.454 4.83065 10.6435 3.64138C11.8329 2.45212 12.3583 2.50027 17.6274 2.50027C18.1366 2.49809 18.3929 3.11389 18.0329 3.47394L15.3199 6.18714C14.6313 6.87582 14.6294 7.99233 15.3181 8.68092C16.0068 9.36952 17.1234 9.36959 17.8122 8.68109L20.5259 5.96855C20.886 5.60859 21.5019 5.86483 21.4997 6.37395C21.4997 11.6422 21.5479 12.1675 20.3584 13.3567Z",stroke:"currentColor",strokeWidth:"1.5",key:"0"}],["path",{d:"M13.5 14.5L7.32842 20.6716C6.22386 21.7761 4.433 21.7761 3.32843 20.6716C2.22386 19.567 2.22386 17.7761 3.32843 16.6716L9.5 10.5",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.5",key:"1"}],["path",{d:"M5.50896 18.5H5.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",key:"2"}]];var am=t(74401),ap=t(90879);function ax(){let{t:e}=(0,i.Bd)(),a=e("Includes tool-call surcharge");return(0,l.jsxs)(eq.m_,{children:[(0,l.jsx)(eq.k$,{render:(0,l.jsxs)(ap.E,{variant:"warning",className:"h-5 min-w-5 cursor-help gap-0 rounded-full px-1",role:"img","aria-label":a,tabIndex:0,"data-tool-surcharge-indicator":"true",children:[(0,l.jsx)(am.n,{icon:au,strokeWidth:2,"aria-hidden":"true"}),(0,l.jsx)("span",{className:"text-[9px] leading-none font-bold","aria-hidden":"true",children:"+"})]})}),(0,l.jsx)(eq.ZI,{children:a})]})}function ah(e){var a;let t,n=(t=(a=(0,m.qW)(e.quota)).match(/^([^0-9+\-.,\s]+)(.+)$/))?{prefix:t[1],amount:t[2]}:{prefix:"",amount:a};return(0,l.jsxs)("span",{className:"border-border/80 bg-muted/60 inline-flex h-6 w-fit items-center rounded-md border px-2 [font-family:var(--font-body)] text-sm leading-none font-semibold tabular-nums",children:[n.prefix?(0,l.jsx)("span",{className:"mr-1",children:n.prefix}):null,(0,l.jsx)("span",{children:n.amount})]})}function ag(e){let{t:a}=(0,i.Bd)();return(0,l.jsxs)(eq.m_,{children:[(0,l.jsx)(eq.k$,{render:(0,l.jsx)(eT.Wh,{label:a("Subscription"),variant:"success",size:"sm",copyable:!1,className:"cursor-help"})}),(0,l.jsx)(eq.ZI,{children:(0,l.jsxs)("span",{children:[a("Deducted by subscription"),": ",(0,m.qW)(e.quota)]})})]})}function af(e){var a;let t=e.other?.billing_source==="subscription",n=!!(a=e.other)&&(!!(Array.isArray(a.tool_surcharges)&&a.tool_surcharges.some(e=>"string"==typeof e?.name&&""!==e.name.trim()&&eL(e.count)&&eL(e.price))||eK(a.web_search,a.web_search_call_count,a.web_search_price)||eK(a.file_search,a.file_search_call_count,a.file_search_price))||!0===a.image_generation_call&&eL(a.image_generation_call_price));return t||n?(0,l.jsx)(eq.Bc,{children:(0,l.jsxs)("div",{className:"inline-flex items-center gap-1",children:[t?(0,l.jsx)(ag,{quota:e.quota}):(0,l.jsx)(ah,{quota:e.quota}),n?(0,l.jsx)(ax,{}):null]})}):(0,l.jsx)("div",{className:"flex flex-col gap-0.5",children:(0,l.jsx)(ah,{quota:e.quota})})}var ab=t(95327);function ay(e){let a,t,n=(a=e.modelName.toLowerCase(),(t=e=>e.some(e=>a.includes(e)))(["gpt-","chatgpt-","text-embedding-","omni-moderation","dall-e","whisper","tts-"])||/\bo[134](?:-|$)/.test(a)?{icon:"OpenAI.Color",label:"OpenAI"}:t(["claude-","anthropic"])?{icon:"Claude.Color",label:"Claude"}:t(["gemini-","learnlm-"])?{icon:"Gemini.Color",label:"Gemini"}:t(["grok-","xai-"])?{icon:"Grok.Color",label:"Grok"}:t(["deepseek-"])?{icon:"DeepSeek.Color",label:"DeepSeek"}
2:t(["qwen","qwq-"])?{icon:"Qwen.Color",label:"Qwen"}:t(["doubao-","volcengine"])?{icon:"Doubao.Color",label:"Doubao"}:t(["moonshot-","kimi-"])?{icon:"Moonshot.Color",label:"Moonshot"}:t(["minimax","abab"])?{icon:"Minimax.Color",label:"MiniMax"}:t(["glm-","chatglm","cogview","cogvideo"])?{icon:"Zhipu.Color",label:"Zhipu"}:t(["mimo-"])?{icon:"XiaomiMiMo",label:"MiMo"}:t(["ernie"])?{icon:"Wenxin.Color",label:"Baidu"}:t(["spark"])?{icon:"Spark.Color",label:"iFlyTek"}:t(["hunyuan"])?{icon:"Hunyuan.Color",label:"Tencent"}:t(["baichuan"])?{icon:"Baichuan.Color",label:"Baichuan"}:t(["internlm"])?{icon:"InternLM.Color",label:"InternLM"}:t(["step-"])?{icon:"Stepfun.Color",label:"StepFun"}:t(["yi-"])?{icon:"Yi.Color",label:"Yi"}:t(["mistral-","mixtral-"])?{icon:"Mistral.Color",label:"Mistral"}:t(["llama-","meta-"])?{icon:"Meta.Color",label:"Meta"}:t(["command-","cohere-"])?{icon:"Cohere.Color",label:"Cohere"}:null);return(0,l.jsx)(eT.Wh,{copyText:e.modelName,size:"sm",showDot:!n,autoColor:n?void 0:e.modelName,className:(0,ek.cn)("border-border/60 bg-muted/30 h-6 max-w-none gap-1.5 rounded-md border px-2 [font-family:var(--font-body)]",n&&"text-foreground",e.className),children:(0,l.jsxs)("span",{className:"flex max-w-none items-center gap-1.5",children:[n&&(0,l.jsx)("span",{className:"flex h-[18px] w-[18px] shrink-0 items-center justify-center",title:n.label,"aria-label":n.label,children:(0,ab.Y)(n.icon,18)}),(0,l.jsx)("span",{className:"whitespace-nowrap",children:e.modelName})]})})}function aj(e){let{t:a}=(0,i.Bd)();return e.actualModel?(0,l.jsxs)(eM.AM,{children:[(0,l.jsxs)(eM.Wv,{render:(0,l.jsx)("button",{type:"button",className:"inline-flex items-center gap-1"}),children:[(0,l.jsx)(ay,{...e}),(0,l.jsx)(eQ.A,{className:"text-muted-foreground size-3 shrink-0"})]}),(0,l.jsx)(eM.hl,{className:"w-72",children:(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,l.jsx)("span",{className:"text-muted-foreground text-xs",children:a("Request Model:")}),(0,l.jsx)("span",{className:"truncate font-mono text-xs font-medium",children:e.modelName})]}),(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,l.jsx)("span",{className:"text-muted-foreground text-xs",children:a("Actual Model:")}),(0,l.jsx)("span",{className:"truncate font-mono text-xs font-medium",children:e.actualModel})]})]})})]}):(0,l.jsx)(ay,{...e})}var av=t(52671);let a_={...eT.jk,success:"bg-success/90",warning:"bg-warning/80",danger:"bg-destructive/80",neutral:"bg-neutral/80"};function aN(e){let{t:a}=(0,i.Bd)(),t=e.indicator??"bar",n=e.isStream,r=null!=e.frtMs&&e.frtMs>0?e.frtMs/1e3:null,s=null==r?"neutral":eO(r),o=eE(e.useTimeSec,e.completionTokens),c=null==r?a("N/A"):(0,m.KK)(r),d=(0,m.KK)(e.useTimeSec),u=(0,l.jsxs)("div",{className:"flex min-h-8 min-w-0 flex-col justify-center gap-0.5 text-xs leading-tight",children:[n&&(0,l.jsxs)("div",{className:"flex items-baseline gap-1.5",children:["dot"===t&&(0,l.jsx)("span",{"aria-hidden":!0,className:(0,ek.cn)("size-1.5 shrink-0 rounded-full",eT.jk[s])}),(0,l.jsx)("span",{className:"text-muted-foreground shrink-0",children:a("First token")}),(0,l.jsx)("span",{className:(0,ek.cn)("tabular-nums",eT.BQ[s]),children:c})]}),(0,l.jsxs)("div",{className:"flex items-baseline gap-1.5",children:["dot"===t&&(0,l.jsx)("span",{"aria-hidden":!0,className:(0,ek.cn)("size-1.5 shrink-0 rounded-full",eT.jk[o])}),(0,l.jsx)("span",{className:"text-muted-foreground shrink-0",children:a("Duration")}),(0,l.jsx)("span",{className:(0,ek.cn)("tabular-nums",eT.BQ[o]),children:d})]})]});return"dot"===t?(0,l.jsx)("div",{className:(0,ek.cn)("flex items-stretch",e.className),children:u}):(0,l.jsxs)("div",{className:(0,ek.cn)("flex items-stretch gap-2",e.className),children:[(0,l.jsx)("span",{"aria-hidden":!0,className:(0,ek.cn)("flex w-1 shrink-0 flex-col overflow-hidden rounded-full",!n&&a_[o]),children:n&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:(0,ek.cn)("flex-1",a_[s])}),(0,l.jsx)("span",{className:(0,ek.cn)("flex-1",a_[o])})]})}),u]})}function ak(e){let{t:a}=(0,i.Bd)(),t=e.isStream&&e.streamStatus&&"ok"!==e.streamStatus.status,n=null!=e.tokensPerSecond?`${Math.round(e.tokensPerSecond)} t/s`:"â",r=a(e.isStream?"Stream":"Non-stream");return(0,l.jsxs)("div",{className:(0,ek.cn)("flex shrink-0 flex-col items-start justify-center gap-0.5 text-xs leading-tight",e.className),children:[(0,l.jsxs)("span",{className:(0,ek.cn)("inline-flex items-center gap-1 font-medium",e.isStream?"text-info":"text-muted-foreground"),children:[r,t&&(0,l.jsx)(eq.Bc,{children:(0,l.jsxs)(eq.m_,{children:[(0,l.jsx)(eq.k$,{render:(0,l.jsx)(av.A,{className:"text-destructive size-3"})}),(0,l.jsx)(eq.ZI,{children:(0,l.jsxs)("div",{className:"space-y-0.5 text-xs",children:[(0,l.jsxs)("p",{children:[a("Stream Status"),": ",a("Error")]}),(0,l.jsx)("p",{children:e.streamStatus?.end_reason||"unknown"}),(e.streamStatus?.error_count??0)>0&&(0,l.jsxs)("p",{children:[a("Soft Errors"),": ",e.streamStatus?.error_count]})]})})]})})]}
2),(0,l.jsx)("span",{className:"text-muted-foreground/60 px-0.5 tabular-nums",children:n})]})}function aw(e){return null!=e&&Number.isFinite(e)?e%1==0?String(e):e.toFixed(4).replace(/\.?0+$/,""):"-"}var aC=t(66701),aS=t(95397);let aA=(0,e1.A)("video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]),aT=(0,e1.A)("paintbrush",[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]]);var aI=t(94369);let aM=(0,e1.A)("move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);var aq=t(13236);let az=(0,e1.A)("blend",[["circle",{cx:"9",cy:"9",r:"7",key:"p2h5vp"}],["circle",{cx:"15",cy:"15",r:"7",key:"19ennj"}]]),a$=(0,e1.A)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]),aD=(0,e1.A)("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);var aF=t(54622),aR=t(30544),aL=t(83940);let aK=(0,e1.A)("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);var aP=t(5623);function aO(e){return{getLabel:function(a){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Unknown";return e[a]?.label??t},getVariant:function(a){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"neutral";return e[a]?.variant??t}}}let aE=aO({[N]:{label:"Draw",variant:"blue"},[k]:{label:"Upscale",variant:"orange"},[w]:{label:"Video",variant:"orange"},[C]:{label:"Edit",variant:"orange"},[S]:{label:"Vary",variant:"violet"},[A]:{label:"Vary (Strong)",variant:"violet"},[T]:{label:"Vary (Subtle)",variant:"violet"},PAN:{label:"Pan",variant:"cyan"},[I]:{label:"Describe",variant:"yellow"},[M]:{label:"Blend",variant:"lime"},[q]:{label:"Upload",variant:"blue"},[z]:{label:"Shorten",variant:"pink"},[$]:{label:"Reroll",variant:"indigo"},[D]:{label:"Inpaint",variant:"teal"},[F]:{label:"Swap Face",variant:"purple"},[R]:{label:"Zoom",variant:"green"},[L]:{label:"Custom Zoom",variant:"green"}}),aB=aO({SUCCESS:{label:"Success",variant:"green"},NOT_START:{label:"Not Started",variant:"neutral"},SUBMITTED:{label:"Queued",variant:"yellow"},IN_PROGRESS:{label:"In Progress",variant:"blue"},FAILURE:{label:"Failed",variant:"red"},MODAL:{label:"Waiting",variant:"amber"}}),aU=aO(V),aV=aO({MUSIC:{label:"Generate Music",variant:"neutral"},LYRICS:{label:"Generate Lyrics",variant:"pink"},[K]:{label:"Image to Video",variant:"blue"},[P]:{label:"Text to Video",variant:"blue"},[O]:{label:"First/Last Frame to Video",variant:"blue"},[E]:{label:"Reference Video",variant:"blue"},[B]:{label:"Video Remix",variant:"blue"}}),aW=aO({[U]:{label:"Success",variant:"green"},NOT_START:{label:"Not Started",variant:"neutral"},SUBMITTED:{label:"Queued",variant:"yellow"},IN_PROGRESS:{label:"In Progress",variant:"blue"},FAILURE:{label:"Failed",variant:"red"},QUEUED:{label:"Queued",variant:"orange"},UNKNOWN:{label:"Unknown",variant:"neutral"}});var aH=t(15161),aG=t(97785);function aZ(e){let{imageUrl:a,taskId:t,open:n,onOpenChange:r}=e,{t:o}=(0,i.Bd)(),[c,d]=(0,s.useState)(!0),[m,p]=(0,s.useState)(!1);return(0,l.jsx)(u.l,{open:n,onOpenChange:e=>{e&&(d(!0),p(!1)),r(e)},title:o("Image Preview"),description:t?`${o("Task ID:")} ${t}`:o("View the generated image"),contentClassName:"sm:max-w-3xl",contentHeight:"auto",bodyClassName:"space-y-4",children:(0,l.jsx)(aH.F,{className:"max-h-[600px]",children:(0,l.jsxs)("div",{className:"py-4",children:[(0,l.jsxs)("div",{className:"bg-muted/50 relative flex min-h-[300px] items-center justify-center rounded-lg border",children:[(c||m)&&(0,l.jsx)(aG.E,{className:"absolute inset-0 h-full w-full rounded-lg"}),(0,l.jsx)("img",{src:a,alt:o("Generated image"),className:`max-h-[550px] w-full rounded-lg object-contain ${c||m?"opacity-0":"opacity-100"}`,onLoad:()=>{d(!1),p(!1)},onError:()=>{d(!1),p(!0)},loading:"lazy"}),m&&(0,l.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,l.jsx)("p",{className:"text-muted-foreground text-sm",children:o("Failed to load image")})})]}),(0,l.jsx)("div",{className:"bg-muted mt-4 rounded-md p-3",children:(0,l.jsx)("p",{className:"text-muted-foreground font-mono text-xs break-all",children:a})})]})})})}function aY(e){let{prompt:a,promptEn:t,open:n,onOpenChange:r}=e,{t:s}=(0,i.Bd)(),{copiedText:o,copyToClipboard:c}=(0,aa.C)({notify:!1});return(0,l.jsx)(u.l,{open:n,onOpenChange:r,title:s("Prompt Details"),description:s("View the complete prompt and its English translation"),contentClassName:"sm:max-w-lg",contentHeight:"auto",bodyClassName:"space-y-4",children:(0,l.jsx)(aH.F,{className:"max-h-[500px] pr-4",children:(0,l.jsxs)("div",{className:"space-y-4 py-4",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(f.J,{className:"text-sm font-semibold",children:s("Prompt")}),(0,l.jsxs)("div",{className:"bg-muted/50 relative rounded-md border p-3",children:[(0,l.jsx)(e7.$,{variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-8 w-8 p-0",onClick:()=>
2c(a),title:s("Copy to clipboard"),children:o===a?(0,l.jsx)(eZ.A,{className:"size-4 text-green-600"}):(0,l.jsx)(eY.A,{className:"size-4"})}),(0,l.jsx)("p",{className:"pr-10 text-sm leading-relaxed break-words whitespace-pre-wrap",children:a||"-"})]})]}),t&&(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(f.J,{className:"text-sm font-semibold",children:s("Prompt (EN)")}),(0,l.jsxs)("div",{className:"bg-muted/50 relative rounded-md border p-3",children:[(0,l.jsx)(e7.$,{variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-8 w-8 p-0",onClick:()=>c(t),title:s("Copy to clipboard"),children:o===t?(0,l.jsx)(eZ.A,{className:"size-4 text-green-600"}):(0,l.jsx)(eY.A,{className:"size-4"})}),(0,l.jsx)("p",{className:"pr-10 text-sm leading-relaxed break-words whitespace-pre-wrap",children:t})]})]})]})})})}function aQ(e){let{failReason:a,open:t,onOpenChange:n}=e,{t:r}=(0,i.Bd)(),{copiedText:s,copyToClipboard:o}=(0,aa.C)({notify:!1});return(0,l.jsx)(u.l,{open:t,onOpenChange:n,title:r("Fail Reason Details"),description:r("View the complete error message and details"),contentClassName:"sm:max-w-lg",contentHeight:"auto",bodyClassName:"space-y-4",children:(0,l.jsx)(aH.F,{className:"max-h-[500px] pr-4",children:(0,l.jsx)("div",{className:"space-y-4 py-4",children:(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(f.J,{className:"text-sm font-semibold",children:r("Error Message")}),(0,l.jsxs)("div",{className:"bg-muted/50 relative rounded-md border border-red-200 p-3",children:[(0,l.jsx)(e7.$,{variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-8 w-8 p-0",onClick:()=>o(a),title:r("Copy to clipboard"),children:s===a?(0,l.jsx)(eZ.A,{className:"size-4 text-green-600"}):(0,l.jsx)(eY.A,{className:"size-4"})}),(0,l.jsx)("p",{className:"overflow-wrap-anywhere pr-10 text-sm leading-relaxed break-all whitespace-pre-wrap text-red-600",children:a||"-"})]})]})})})})}function aJ(e){let{submitTimeKey:a,finishTimeKey:t,unit:n="milliseconds",headerLabel:r,warningThresholdSec:s=60}=e;return{id:"duration",header:e=>{let{column:a}=e;return(0,l.jsx)(ev.wZ,{column:a,title:r})},cell:e=>{let{row:r}=e,i=r.original,o=function(e,a){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"milliseconds";if(!e||!a)return null;let l="milliseconds"===t?(a-e)/1e3:a-e;return{durationSec:l,variant:l>60?"red":"green"}}(i[a],i[t],n);if(!o)return(0,l.jsx)("span",{className:"text-muted-foreground/60 text-xs",children:"-"});let c=o.durationSec>s?"danger":"success";return(0,l.jsx)(eT.Wh,{label:`${o.durationSec.toFixed(1)}s`,variant:c,size:"sm",copyable:!1,className:(0,ek.cn)("rounded-md font-mono",{success:"border border-emerald-200/40 bg-emerald-50/35 !text-emerald-600 dark:border-emerald-900/40 dark:bg-emerald-950/15 dark:!text-emerald-400",warning:"border border-amber-200/45 bg-amber-50/35 !text-amber-600 dark:border-amber-900/40 dark:bg-amber-950/15 dark:!text-amber-400",danger:"border border-rose-200/50 bg-rose-50/35 !text-red-600 dark:border-rose-900/40 dark:bg-rose-950/15 dark:!text-red-400"}[c])})},meta:{label:r}}}function aX(e){let{accessorKey:a="channel_id",headerLabel:t}=e;return{accessorKey:a,header:e=>{let{column:a}=e;return(0,l.jsx)(ev.wZ,{column:a,title:t})},cell:e=>{let{row:t}=e,n=t.getValue(a);return n?(0,l.jsx)(eT.Wh,{label:`#${n}`,autoColor:String(n),copyText:String(n),size:"sm",showDot:!1,className:"font-mono"}):(0,l.jsx)("span",{className:"text-muted-foreground/60 text-xs",children:"-"})},meta:{label:t}}}function a0(e){let{accessorKey:a="progress",headerLabel:t}=e;return{accessorKey:a,header:e=>{let{column:a}=e;return(0,l.jsx)(ev.wZ,{column:a,title:t})},cell:e=>{let{row:t}=e,n=t.getValue(a);return n?(0,l.jsx)("span",{className:"border-border/60 bg-muted/30 inline-flex items-center rounded-md border px-1.5 py-0.5 font-mono text-xs",children:n}):(0,l.jsx)("span",{className:"text-muted-foreground/60 text-xs",children:"-"})},meta:{label:t}}}let a1={[N]:aC.A,[k]:aS.A,[w]:aA,[C]:aT,[S]:aI.A,[A]:aI.A,[T]:aI.A,PAN:aM,[I]:aq.A,[M]:az,[q]:a$,[z]:aD,[$]:aF.A,[D]:aR.A,[F]:aL.A,[R]:aK,[L]:aK},a2=(0,e1.A)("music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);var a5=t(66552);function a3(e){let{clip:a}=e,{t}
2=(0,i.Bd)(),[n,r]=(0,s.useState)(!1),o=(0,s.useRef)(null);(0,s.useEffect)(()=>{r(!1)},[a.audio_url]);let c=a.title||t("Untitled"),u=a.tags||a.metadata?.tags||"",m=a.duration||a.metadata?.duration,p=a.image_url||a.image_large_url,x=a.audio_url;return x?(0,l.jsxs)("div",{className:"bg-card flex gap-4 rounded-lg border p-4",children:[p&&(0,l.jsx)("img",{src:p,alt:c,className:"h-20 w-20 shrink-0 rounded-lg object-cover",onError:e=>{e.target.style.display="none"}}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"mb-1 flex items-center gap-2",children:[(0,l.jsx)("span",{className:"truncate text-sm font-medium",children:c}),null!=m&&m>0&&(0,l.jsx)(eT.Wh,{label:function(e){if(!e||e<=0)return"--:--";let a=Math.floor(e/60),t=Math.floor(e%60);return`${a}:${t.toString().padStart(2,"0")}`}(m),variant:"neutral",className:"shrink-0",copyable:!1})]}),u&&(0,l.jsx)("p",{className:"text-muted-foreground mb-2 truncate text-xs",children:u}),n?(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)("span",{className:"text-destructive text-xs",children:t("Audio playback failed")}),(0,l.jsxs)(e7.$,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:()=>window.open(x,"_blank"),children:[(0,l.jsx)(a5.A,{className:"h-3 w-3"}),t("Open in new tab")]}),(0,l.jsxs)(e7.$,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:()=>{navigator.clipboard.writeText(x),d.oR.success(t("Copied"))},children:[(0,l.jsx)(eY.A,{className:"h-3 w-3"}),t("Copy Link")]})]}):(0,l.jsx)("audio",{ref:o,src:x,controls:!0,preload:"none",onError:()=>r(!0),className:"h-9 w-full"})]})]}):null}function a4(e){let{t:a}=(0,i.Bd)(),t=Array.isArray(e.clips)?e.clips:[];return(0,l.jsx)(u.l,{open:e.open,onOpenChange:e.onOpenChange,title:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(e9.f,{tone:"chart-4",size:"sm",children:(0,l.jsx)(a2,{})}),a("Audio Preview")]}),contentClassName:"sm:max-w-lg",titleClassName:"flex items-center gap-2",contentHeight:"auto",bodyClassName:"space-y-4",children:0===t.length?(0,l.jsx)("p",{className:"text-muted-foreground py-4 text-center text-sm",children:a("None")}):(0,l.jsx)(aH.F,{className:"max-h-[60vh]",children:(0,l.jsx)("div",{className:"space-y-3 pr-2",children:t.map((e,a)=>(0,l.jsx)(a3,{clip:e},e.clip_id||e.id||a))})})})}function a6(e){if(Array.isArray(e))return e;if("string"==typeof e)try{let a=JSON.parse(e);return Array.isArray(a)?a:[]}catch{}return[]}function a8(e){let{log:a}=e,{t}=(0,i.Bd)(),[n,r]=(0,s.useState)(!1),o=(0,s.useMemo)(()=>a6(a.data).filter(e=>e&&"object"==typeof e&&e.audio_url),[a.data]);return 0===o.length?null:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("button",{type:"button",className:"group flex items-center gap-1 text-left text-xs",onClick:()=>r(!0),children:[(0,l.jsx)(a2,{className:"text-muted-foreground size-3"}),(0,l.jsx)("span",{className:"text-foreground leading-snug group-hover:underline",children:t("Click to preview audio")})]}),(0,l.jsx)(a4,{open:n,onOpenChange:r,clips:o})]})}var a7=t(96962),a9=t(26043),te=t(92429),ta=t(5333),tt=t(88288);function tl(e,a){let t={...e.startTime&&{startTime:e.startTime.getTime()},...e.endTime&&{endTime:e.endTime.getTime()},...e.channel&&{channel:e.channel}};switch(a){case"common":return{...t,...e.model&&{model:e.model},...e.token&&{token:e.token},...e.group&&{group:e.group},...e.username&&{username:e.username},...e.requestId&&{requestId:e.requestId},...e.upstreamRequestId&&{upstreamRequestId:e.upstreamRequestId}};case"drawing":return{...t,...e.mjId&&{filter:e.mjId}};case"task":return{...t,...e.taskId&&{filter:e.taskId}};default:return t}}let tn=(0,n.GY)("/_authenticated/usage-logs/$section");function tr(e){return(0,l.jsxs)("span",{className:"border-border/60 bg-muted/25 inline-flex h-7 items-center gap-2 rounded-md border px-2.5 text-xs shadow-xs",children:[(0,l.jsx)("span",{className:(0,ek.cn)("h-3.5 w-0.5 rounded-full",e.accent)}),(0,l.jsx)("span",{className:"text-muted-foreground",children:e.label}),(0,l.jsx)("span",{className:"text-foreground/85 font-mono font-semibold tabular-nums",children:e.value})]})}function ts(){let{t:e}=(0,i.Bd)(),{isAdminView:a}
2=ey(),t=tn.useSearch(),{sensitiveVisible:n}=eb(),{data:r,isLoading:s}=(0,ej.I)({queryKey:["usage-logs-stats",a,t],queryFn:async()=>{let e=ee({page:1,pageSize:1,searchParams:t,columnFilters:[],isAdmin:a}),l=a?await ei(e):await eo(e);return l.success&&l.data||y},placeholderData:e=>e});return s?(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(aG.E,{className:"h-7 w-[150px] rounded-md"}),(0,l.jsx)(aG.E,{className:"h-7 w-[100px] rounded-md"}),(0,l.jsx)(aG.E,{className:"h-7 w-[120px] rounded-md"})]}):(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(tr,{label:e("Usage"),value:n?(0,m.qW)(r?.quota||0):"â¢â¢â¢â¢",accent:"bg-sky-500/70"}),(0,l.jsx)(tr,{label:e("RPM"),value:r?.rpm||0,accent:"bg-rose-500/65"}),(0,l.jsx)(tr,{label:e("TPM"),value:r?.tpm||0,accent:"bg-slate-400/70"})]})}var ti=t(38288),to=t(1738),tc=t(84935);function td(e){return e?(0,tc.A)(e).format("YYYY-MM-DDTHH:mm"):""}function tu(e){if(!e)return;let a=new Date(e);return Number.isNaN(a.getTime())?void 0:a}function tm(e){let{start:a,end:t,onChange:n,className:r}=e,{t:o}=(0,i.Bd)(),[c,d]=(0,s.useState)(!1),[u,m]=(0,s.useState)(td(a)),[p,x]=(0,s.useState)(td(t)),h=(0,s.useMemo)(()=>{if(!a&&!t)return o("Date Range");let e=a?(0,tc.A)(a).format("YYYY-MM-DD HH:mm"):"-",l=t?(0,tc.A)(t).format("YYYY-MM-DD HH:mm"):"-";return`${e} ~ ${l}`},[t,a,o]),g=e=>{let a=(0,tc.A)(),t={today:{start:a.startOf("day").toDate(),end:a.endOf("day").toDate()},"7d":{start:a.subtract(6,"day").startOf("day").toDate(),end:a.endOf("day").toDate()},week:{start:a.startOf("week").toDate(),end:a.endOf("week").toDate()},"30d":{start:a.subtract(29,"day").startOf("day").toDate(),end:a.endOf("day").toDate()},month:{start:a.startOf("month").toDate(),end:a.endOf("month").toDate()}}[e];m(td(t.start)),x(td(t.end)),n(t),d(!1)};return(0,l.jsxs)(eM.AM,{open:c,onOpenChange:e=>{e&&(m(td(a)),x(td(t))),d(e)},children:[(0,l.jsxs)(eM.Wv,{render:(0,l.jsx)(e7.$,{type:"button",variant:"outline",className:(0,ek.cn)("w-full justify-start gap-2 px-2.5 text-sm leading-5 font-normal tabular-nums",!a&&!t&&"text-muted-foreground",r)}),children:[(0,l.jsx)(ti.A,{className:"text-muted-foreground size-4 shrink-0"}),(0,l.jsx)("span",{className:"truncate",children:h})]}),(0,l.jsx)(eM.hl,{align:"start",className:"w-[min(520px,calc(100vw-2rem))] p-3",children:(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto_1fr] sm:items-end",children:[(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)("div",{className:"text-muted-foreground text-xs",children:o("Start Time")}),(0,l.jsx)(to.p,{type:"datetime-local",value:u,onChange:e=>m(e.target.value),className:"h-8 text-sm leading-5 tabular-nums"})]}),(0,l.jsx)("span",{className:"text-muted-foreground hidden pb-2 text-xs sm:block",children:"~"}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)("div",{className:"text-muted-foreground text-xs",children:o("End Time")}),(0,l.jsx)(to.p,{type:"datetime-local",value:p,onChange:e=>x(e.target.value),className:"h-8 text-sm leading-5 tabular-nums"})]})]}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,l.jsx)(e7.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 flex-1 px-2 text-xs",onClick:()=>g("today"),children:o("Today")}),(0,l.jsx)(e7.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 flex-1 px-2 text-xs",onClick:()=>g("7d"),children:o("7 Days")}),(0,l.jsx)(e7.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 flex-1 px-2 text-xs",onClick:()=>g("week"),children:o("This week")}),(0,l.jsx)(e7.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 flex-1 px-2 text-xs",onClick:()=>g("30d"),children:o("30 Days")}),(0,l.jsx)(e7.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 flex-1 px-2 text-xs",onClick:()=>g("month"),children:o("This month")})]}),(0,l.jsx)("div",{className:"flex justify-end",children:(0,l.jsx)(e7.$,{size:"sm",className:"h-8",onClick:()=>{n({start:tu(u),end:tu(p)}),d(!1)},children:o("Confirm")})})]})})]})}var tp=t(37116),tx=t(96735);function th(e){return(0,l.jsx)("div",{className:(0,ek.cn)("min-w-0 [&_[data-slot=select-trigger]]:w-full [&_[data-slot=select-trigger]]:text-sm [&_[data-slot=select-value]]:leading-5",e.wide&&"sm:col-span-2",e.className),children:e.children})}function tg(e){return(0,l.jsx)(to.p,{...e,className:(0,ek.cn)("h-8 min-w-0 text-sm leading-5",e.className)})}function tf(e){let{t:a}
2=(0,i.Bd)(),[t,n]=(0,s.useState)(!1),[r,o]=(0,s.useState)(!1),[c,d]=(0,s.useState)(!1),u=(0,e_.Ub)("(max-width: 640px)"),m=null!=e.advancedFilters,p=e.advancedFilterCount??+!!e.hasAdvancedActiveFilters,x=e.mobileFilterCount??p,h=m?(0,l.jsxs)(e7.$,{type:"button",variant:"ghost",onClick:()=>n(e=>!e),"aria-expanded":t,className:(0,ek.cn)("text-muted-foreground hover:text-foreground gap-1 px-2",e.hasAdvancedActiveFilters&&!t&&"text-primary hover:text-primary"),children:[a(t?"Collapse":"Expand"),p>0&&(0,l.jsx)(ap.E,{className:"ml-0.5 size-5 justify-center p-0 text-[10px]",children:p}),(0,l.jsx)(tp.A,{className:(0,ek.cn)("size-3.5 transition-transform duration-200",t&&"rotate-180")})]}):null;return u&&null!=e.mobilePinnedFilters?(0,l.jsxs)(tx._s,{open:r,onOpenChange:o,children:[(0,l.jsxs)("div",{className:(0,ek.cn)("bg-card/50 rounded-lg border p-2.5",e.className),children:[!c&&(0,l.jsx)("div",{className:"grid gap-2",children:e.mobilePinnedFilters}),(0,l.jsxs)("div",{className:(0,ek.cn)("flex flex-col gap-2",!c&&"mt-2"),children:[!c&&e.stats,(0,l.jsxs)("div",{className:"flex items-center justify-end gap-1.5",children:[(0,l.jsx)(e7.$,{type:"button",variant:"ghost",size:"icon",onClick:()=>d(e=>!e),"aria-expanded":!c,"aria-label":a(c?"Expand":"Collapse"),className:"text-muted-foreground hover:text-foreground mr-auto size-7",children:(0,l.jsx)(tp.A,{className:(0,ek.cn)("size-3.5 transition-transform duration-200",!c&&"rotate-180")})}),e.actionStart,(0,l.jsx)(tx.Uz,{asChild:!0,children:(0,l.jsxs)(e7.$,{type:"button",variant:"ghost",className:(0,ek.cn)("text-muted-foreground hover:text-foreground gap-1 px-2",x>0&&"text-primary hover:text-primary"),children:[a("Filter"),x>0&&(0,l.jsx)(ap.E,{className:"ml-0.5 size-5 justify-center p-0 text-[10px]",children:x})]})}),(0,l.jsxs)(e7.$,{type:"button",onClick:e.onSearch,disabled:e.searchLoading,children:[e.searchLoading&&(0,l.jsx)(g.A,{className:"animate-spin"}),a("Search")]}),(0,l.jsx)(ev.io,{table:e.table})]})]})]}),(0,l.jsx)(tx.zj,{className:"max-h-[85dvh] p-0",children:(0,l.jsxs)("div",{className:"mx-auto flex w-full max-w-md flex-1 flex-col overflow-hidden",children:[(0,l.jsxs)(tx.BE,{className:"border-border/70 border-b px-4 py-3 text-left",children:[(0,l.jsx)(tx.gk,{children:a("Filter")}),(0,l.jsx)(tx.I6,{children:a("Adjust filters, then search to refresh the logs.")})]}),(0,l.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto px-4 py-3",children:e.mobileFilters??(0,l.jsxs)(l.Fragment,{children:[e.primaryFilters,e.advancedFilters]})}),(0,l.jsxs)(tx.tb,{className:"border-border/70 grid grid-cols-2 gap-2 border-t px-4 py-3",children:[(0,l.jsx)(e7.$,{type:"button",variant:"outline",onClick:()=>{e.onReset(),o(!1)},disabled:!e.hasActiveFilters,children:a("Reset")}),(0,l.jsxs)(e7.$,{type:"button",onClick:()=>{e.onSearch(),o(!1)},disabled:e.searchLoading,children:[e.searchLoading&&(0,l.jsx)(g.A,{className:"animate-spin"}),a("Search")]})]})]})})]}):(0,l.jsxs)("div",{className:(0,ek.cn)("bg-card/50 rounded-lg border p-2.5 sm:p-3",e.className),children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-start gap-2",children:[(0,l.jsx)("div",{className:"grid min-w-0 flex-1 grid-cols-1 gap-2 sm:grid-cols-[repeat(auto-fit,minmax(10rem,1fr))]",children:e.primaryFilters}),h&&(0,l.jsx)("div",{className:"flex shrink-0 items-center justify-end",children:h})]}),t&&e.advancedFilters&&(0,l.jsx)("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-[repeat(auto-fit,minmax(10rem,1fr))]",children:e.advancedFilters}),(0,l.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[e.stats,(0,l.jsxs)("div",{className:"ms-auto flex flex-wrap items-center justify-end gap-1.5 sm:gap-2",children:[e.actionStart,(0,l.jsx)(e7.$,{type:"button",variant:"outline",onClick:e.onReset,disabled:!e.hasActiveFilters,children:a("Reset")}),(0,l.jsxs)(e7.$,{type:"button",onClick:e.onSearch,disabled:e.searchLoading,children:[e.searchLoading&&(0,l.jsx)(g.A,{className:"animate-spin"}),a("Search")]}),(0,l.jsx)(ev.io,{table:e.table})]})]})]})}let tb=(0,n.GY)("/_authenticated/usage-logs/$section"),ty=new Set(_.map(e=>e.value));function tj(e){return[e.startTime,e.endTime,e.channel,e.model,e.token,e.group,e.username,e.requestId,e.upstreamRequestId,Array.isArray(e.type)?e.type.join(","):e.type].map(e=>String(e??"")).join("\x1f")}function tv(e){let{t:a}=(0,i.Bd)(),t=(0,r.Z)(),n=(0,a7.jE)(),o=tb.useSearch(),{isAdminView:c}=ey(),{sensitiveVisible:d,setSensitiveVisible:u}=eb(),m=(0,a9.C)({queryKey:["logs"]}),p=(0,s.useMemo)(()=>{var e,a;let{start:t,end:l}=Q(),n={startTime:o.startTime,endTime:o.endTime,channel:o.channel,model:o.model,token:o.token,group:o.group,username:o.username,requestId:o.requestId,upstreamRequestId:o.upstreamRequestId,type:o.type},r={startTime:o.startTime?new Date(o.startTime):t,endTime:o.endTime?new Date(o.endTime):l,channel:o.channel||void 0,model:o.model||void 0,token:o.token||void 0,group:o.group||void 0,username:o.username||void 0,requestId:o.requestId||void 0,upstreamRequestId:o.upstreamRequestId||void 0};return{sourceKey:tj(n),filters:r,logType:Array.isArray(e=o.type)&&1===e.length&&"string"==typeof e[0]&&(a=e[0],ty.has(a))?e[0]:"0"}},[o.startTime,o.endTime,o.channel,o.model,o.token,o.group,o.username,o.requestId,o.upstreamRequestId,o.type]),[x,h]=(0,s.use
2State)(()=>p),g=x.sourceKey===p.sourceKey?x:p,f=g.filters,b=g.logType,y=(0,s.useCallback)((e,a)=>{h(t=>{let l=t.sourceKey===p.sourceKey?t:p;return{sourceKey:p.sourceKey,filters:{...l.filters,[e]:a},logType:l.logType}})},[p]),j=(0,s.useCallback)(()=>{t({to:"/usage-logs/$section",params:{section:"common"},search:{...tl(f,"common"),type:[b],page:1}}),n.invalidateQueries({queryKey:["logs"]}),n.invalidateQueries({queryKey:["usage-logs-stats"]})},[f,b,t,n]),v=(0,s.useCallback)(()=>{let{start:e,end:a}=Q(),l={type:["0"],startTime:e.getTime(),endTime:a.getTime()};h({sourceKey:tj(l),filters:{startTime:e,endTime:a},logType:"0"}),t({to:"/usage-logs/$section",params:{section:"common"},search:{page:1,...l}}),n.invalidateQueries({queryKey:["logs"]}),n.invalidateQueries({queryKey:["usage-logs-stats"]})},[t,n]),N=(0,s.useCallback)(e=>{"Enter"===e.key&&j()},[j]),k=!!f.token||!!f.username||!!f.channel||!!f.requestId||!!f.upstreamRequestId,w="0"!==b,C=!!f.model||!!f.group||w||k,S=[f.token,c?f.username:void 0,c?f.channel:void 0,f.requestId,f.upstreamRequestId].filter(Boolean).length,A=d?"text":"password",T=(0,s.useMemo)(()=>_.map(e=>({value:e.value,label:a(e.label)})),[a]),I=T.find(e=>e.value===b)?.label??a("All Types"),M=(0,l.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,l.jsx)(ts,{})}),q=(0,l.jsxs)(eq.m_,{children:[(0,l.jsx)(eq.k$,{render:(0,l.jsx)(e7.$,{variant:"ghost",size:"icon",onClick:()=>u(!d),"aria-label":d?a("Hide"):a("Show"),className:"text-muted-foreground hover:text-foreground size-7"}),children:d?(0,l.jsx)(te.A,{}):(0,l.jsx)(ta.A,{})}),(0,l.jsx)(eq.ZI,{children:d?a("Hide"):a("Show")})]}),z=(0,l.jsx)(th,{wide:!0,children:(0,l.jsx)(tm,{start:f.startTime,end:f.endTime,onChange:e=>{let{start:a,end:t}=e;y("startTime",a),y("endTime",t)}})}),$=(0,l.jsx)(th,{children:(0,l.jsx)(tg,{placeholder:a("Model Name"),value:f.model||"",onChange:e=>y("model",e.target.value),onKeyDown:N})}),D=(0,l.jsx)(th,{children:(0,l.jsx)(tg,{placeholder:a("Group"),type:A,value:f.group||"",onChange:e=>y("group",e.target.value),onKeyDown:N})}),F=(0,l.jsx)(th,{children:(0,l.jsxs)(tt.l6,{items:T,value:b,onValueChange:e=>{let a=null!==e&&ty.has(e)?e:"0";h(e=>{let t=e.sourceKey===p.sourceKey?e:p;return{sourceKey:p.sourceKey,filters:t.filters,logType:a}})},children:[(0,l.jsx)(tt.bq,{children:(0,l.jsx)(tt.yv,{children:I})}),(0,l.jsx)(tt.gC,{alignItemWithTrigger:!1,children:(0,l.jsx)(tt.s3,{children:_.map(e=>(0,l.jsx)(tt.eb,{value:e.value,children:a(e.label)},e.value))})})]})}),R=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(th,{children:(0,l.jsx)(tg,{placeholder:a("Token Name"),type:A,value:f.token||"",onChange:e=>y("token",e.target.value),onKeyDown:N})}),c&&(0,l.jsx)(th,{children:(0,l.jsx)(tg,{placeholder:a("Username"),type:A,value:f.username||"",onChange:e=>y("username",e.target.value),onKeyDown:N})}),c&&(0,l.jsx)(th,{children:(0,l.jsx)(tg,{placeholder:a("Channel ID"),value:f.channel||"",onChange:e=>y("channel",e.target.value),onKeyDown:N})}),(0,l.jsx)(th,{children:(0,l.jsx)(tg,{placeholder:a("Request ID"),value:f.requestId||"",onChange:e=>y("requestId",e.target.value),onKeyDown:N})}),(0,l.jsx)(th,{children:(0,l.jsx)(tg,{placeholder:a("Upstream Request ID"),value:f.upstreamRequestId||"",onChange:e=>y("upstreamRequestId",e.target.value),onKeyDown:N})})]});return(0,l.jsx)(tf,{table:e.table,stats:M,actionStart:q,primaryFilters:(0,l.jsxs)(l.Fragment,{children:[z,$,D,F]}),advancedFilters:R,mobilePinnedFilters:z,mobileFilters:(0,l.jsxs)(l.Fragment,{children:[$,D,F,R]}),mobileFilterCount:[f.model,f.group,w].filter(Boolean).length+S,hasAdvancedActiveFilters:k,advancedFilterCount:S,hasActiveFilters:C,onSearch:j,searchLoading:m>0,onReset:v})}let t_=(0,n.GY)("/_authenticated/usage-logs/$section");function tN(e){let{t:a}=(0,i.Bd)(),t=(0,r.Z)(),n=(0,a7.jE)(),o=t_.useSearch(),{isAdminView:c}=ey(),d=(0,a9.C)({queryKey:["logs"]}),[u,m]=(0,s.useState)(()=>{let{start:e,end:a}=Q();return{startTime:e,endTime:a}});(0,s.useEffect)(()=>{let{start:a,end:t}=Q(),l={startTime:o.startTime?new Date(o.startTime):a,endTime:o.endTime?new Date(o.endTime):t,...o.channel?{channel:String(o.channel)}:{}};m("drawing"===e.logCategory?{...l,...o.filter?{mjId:o.filter}:{}}:{...l,...o.filter?{taskId:o.filter}:{}})},[e.logCategory,o.startTime,o.endTime,o.channel,o.filter]);let p=(0,s.useCallback)((e,a)=>{m(t=>({...t,[e]:a}))},[]),x=(0,s.useCallback)(()=>{let a=tl(u,e.logCategory);t({to:"/usage-logs/$section",params:{section:e.logCategory},search:{...a,page:1}}),n.invalidateQueries({queryKey:["logs"]})},[u,t,e.logCategory,n]),h=(0,s.useCallback)(()=>{let{start:a,end:l}=Q();m({startTime:a,endTime:l}),t({to:"/usage-logs/$section",params:{section:e.logCategory},search:{page:1,startTime:a.getTime(),endTime:l.getTime()}}),n.invalidateQueries({queryKey:["logs"]})},[t,e.logCategory,n]),g=(0,s.useCallback)(e=>{"Enter"===e.key&&x()},[x]),f=(0,s.useCallback)(a=>{m(t=>{var l;return l=e.logCategory,"drawing"===l?{...t,mjId:a}:{...t,taskId:a}})},[e.logCategory]),b="drawing"===e.logCategory?u.mjId||"":u.taskId||"",y=a("drawing"===e.logCategory?"Filter by MjProxy task ID":"Filter by task ID"),j=!!b||!!u.channel,v=(0,l.jsx)(th,{wide:!0,children:(0,l.jsx)(tm,{start:u.startTime,end:u.endTime,onChange:e=>{let{start:a,end:t}=e;p("startTime",a),p("endTime",t)}})}),_=(0,l.jsx)(th,{children:(0,l.jsx)(tg,{"aria-label":a("Task ID"),placeholder:y,value:b,onChange:e=>f(e.target.value),onKeyDown:g})}),N=c?(0,l.jsx)(th,{children:(0,l.jsx)(tg,{placeholder:a("Channel ID"),value:u.channel||"",onChange:e=>p("channel",e.target.value),onKeyDown:g})}):null;return(0,l.jsx)(tf,{table:e.table,primaryFilters:(0,l.jsxs)(l.Fragment,{children:[v,_,N]}),mobilePinnedFilters:v,mobileFilters:(0,l.jsxs)(l.Fragment,{children:[_,N]}
2),mobileFilterCount:[b,u.channel].filter(Boolean).length,hasActiveFilters:j,onSearch:x,searchLoading:d>0,onReset:h})}var tk=t(55581),tw=t(11397),tC=t(12393);let tS={5:"bg-rose-50/40 dark:bg-rose-950/20 border-rose-200/50 dark:border-rose-900/30",6:"bg-blue-50/30 dark:bg-blue-950/15 border-blue-200/50 dark:border-blue-900/30"};function tA(){return(0,l.jsx)("div",{className:"border-border/50 bg-card overflow-hidden rounded-lg border",children:[1,2,3].map(e=>(0,l.jsxs)("div",{className:"border-border/40 space-y-2.5 border-b p-3 last:border-b-0",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,l.jsx)(aG.E,{className:"h-5 w-40 rounded-md"}),(0,l.jsx)(aG.E,{className:"h-5 w-16 rounded-md"})]}),(0,l.jsx)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:[1,2,3,4,5,6].map(e=>(0,l.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,l.jsx)(aG.E,{className:"h-3 w-10 rounded"}),(0,l.jsx)(aG.E,{className:"h-4 w-full rounded"})]},e))})]},e))})}function tT(e){let{cell:a,fallback:t="-",className:n,primaryOnly:r=!1}=e;return(0,l.jsx)("div",{className:(0,ek.cn)("min-w-0 overflow-hidden leading-tight [&_button]:max-w-full [&_span]:max-w-full",r&&"[&_.flex-col]:min-w-0 [&_.flex-col>*:not(:first-child)]:hidden",n),children:a?(0,tk.Kv)(a.column.columnDef.cell,a.getContext()):(0,l.jsx)("span",{className:"text-muted-foreground/50",children:t})})}function tI(e){let{label:a,cell:t,className:n,valueClassName:r,primaryOnly:s=!1}=e;return t?(0,l.jsxs)("div",{className:(0,ek.cn)("bg-muted/20 min-w-0 rounded-md px-2 py-1.5",n),children:[null!=a&&""!==a&&(0,l.jsx)("div",{className:"text-muted-foreground mb-1 text-[11px] leading-none font-medium select-none",children:a}),(0,l.jsx)(tT,{cell:t,primaryOnly:s,className:r})]}):null}function tM(e){let{createdAt:a,type:t}=e,{t:n}=(0,i.Bd)(),r=Y(("number"==typeof t?t:void 0)??0),s=r.color;return(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsx)("div",{className:"font-mono text-xs leading-tight tabular-nums",children:(0,m.fk)("number"==typeof a?a:void 0)}),(0,l.jsxs)("div",{className:(0,ek.cn)("inline-flex items-center gap-1 text-xs leading-none font-medium",eT.BQ[s]),children:[(0,l.jsx)("span",{className:(0,ek.cn)("size-1.5 shrink-0 rounded-full",eT.jk[s]),"aria-hidden":"true"}),(0,l.jsx)("span",{children:n(r.label)})]})]})}function tq(e){let{log:a}=e,{t}=(0,i.Bd)();if(!G(a.type))return null;let n=a.prompt_tokens||0,r=a.completion_tokens||0;if(0===n&&0===r)return(0,l.jsx)("div",{className:"bg-muted/20 min-w-0 rounded-md px-2 py-1.5",children:(0,l.jsx)("span",{className:"text-muted-foreground text-xs",children:"-"})});let s=eP(a.other),o=s?.cache_tokens||0,c=s?.cache_creation_tokens_5m||0,d=s?.cache_creation_tokens_1h||0,u=c>0||d>0?c+d:s?.cache_creation_tokens||0,m=o>0||u>0;return(0,l.jsx)("div",{className:"bg-muted/20 min-w-0 rounded-md px-2 py-1.5",children:(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsxs)("span",{className:"font-mono text-xs font-medium tabular-nums",children:[n.toLocaleString()," / ",r.toLocaleString()]}),m?(0,l.jsxs)("div",{className:"text-muted-foreground flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-[11px] leading-none",children:[o>0&&(0,l.jsxs)("span",{children:[t("Cache"),"â ",o.toLocaleString()]}),u>0&&(0,l.jsxs)("span",{children:["â ",u.toLocaleString()]})]}):(0,l.jsx)("span",{className:"text-muted-foreground/50 text-[11px] leading-none",children:"â"})]})})}function tz(e){let{log:a}=e,{sensitiveVisible:t,setSelectedUserId:n,setUserInfoDialogOpen:r}=eb();return a.username?(0,l.jsxs)("button",{type:"button",className:"bg-muted/20 flex min-w-0 items-center gap-1.5 rounded-md px-2 py-1.5 text-left",onClick:e=>{e.stopPropagation(),n(a.user_id),r(!0)},children:[(0,l.jsx)(eI.eu,{className:"ring-border/60 size-6 shrink-0 ring-1",children:(0,l.jsx)(eI.q5,{className:(0,ek.cn)("text-[11px] font-semibold",!t&&"bg-muted text-muted-foreground"),style:t?(0,ez.u)(a.username):void 0,children:t?(0,ez.f)(a.username):"â¢"})}),(0,l.jsx)("span",{className:"text-foreground min-w-0 truncate text-sm",children:t?a.username:"â¢â¢â¢â¢"})]}):null}function t$(e){let{log:a}=e;if(!Z(a.type))return null;
2let t=eP(a.other),n=a.use_time||0,r=n>0&&a.completion_tokens>0?a.completion_tokens/n:null;return(0,l.jsxs)("div",{className:"bg-muted/20 flex min-w-0 items-center gap-2.5 rounded-md px-2 py-1.5",children:[(0,l.jsx)(aN,{useTimeSec:n,completionTokens:a.completion_tokens,frtMs:t?.frt,isStream:a.is_stream,indicator:"dot",className:"min-w-0 flex-1"}),(0,l.jsx)(ak,{isStream:a.is_stream,tokensPerSecond:r,streamStatus:t?.stream_status,className:"shrink-0"})]})}function tD(e){let{cells:a}=e,{t}=(0,i.Bd)(),n=a.get("model_name"),r=a.get("quota"),s=a.get("created_at")?.row.original;return(0,l.jsxs)("div",{className:"space-y-2.5",children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,l.jsx)(tT,{cell:n,className:"flex-1"}),(0,l.jsx)(tT,{cell:r,className:"shrink-0 text-right [&_.flex-col]:items-end"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)] gap-1.5",children:[(0,l.jsx)("div",{className:"bg-muted/20 min-w-0 rounded-md px-2 py-1.5",children:(0,l.jsx)(tM,{createdAt:s?.created_at,type:s?.type})}),(0,l.jsx)(tI,{cell:a.get("channel"),valueClassName:"[&_.flex-col]:max-w-none"}),s&&a.has("user")?(0,l.jsx)(tz,{log:s}):(0,l.jsx)(tI,{cell:a.get("user")}),(0,l.jsx)(tI,{cell:a.get("token_name"),valueClassName:"[&_.flex-col]:max-w-none [&_.flex-col>*:not(:first-child)]:text-[11px] [&_.flex-col>*:not(:first-child)]:leading-none"}),s?(0,l.jsx)(t$,{log:s}):(0,l.jsx)(tI,{cell:a.get("use_time")}),s?(0,l.jsx)(tq,{log:s}):(0,l.jsx)(tI,{cell:a.get("prompt_tokens")}),(0,l.jsx)(tI,{label:t("Details"),cell:a.get("content"),className:"col-span-2 bg-transparent px-0 py-0"})]})]})}function tF(e){let{cells:a}=e,{t}=(0,i.Bd)(),n=a.get("task_id"),r=a.get("status"),s=a.get("submit_time");return(0,l.jsxs)("div",{className:"space-y-2.5",children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[(0,l.jsx)(tT,{cell:n,className:"flex-1"}),(0,l.jsx)(tT,{cell:r,className:"shrink-0 text-right"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-1.5",children:[(0,l.jsx)(tI,{label:t("Submit Time"),cell:s}),(0,l.jsx)(tI,{label:t("User"),cell:a.get("user"),primaryOnly:!0}),(0,l.jsx)(tI,{label:t("Result"),cell:a.get("fail_reason"),className:"col-span-2 bg-transparent px-0 py-0"})]})]})}function tR(e){let{cells:a}=e,{t}=(0,i.Bd)(),n=a.get("action"),r=a.get("code"),s=a.get("submit_time");return(0,l.jsxs)("div",{className:"space-y-2.5",children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[(0,l.jsx)(tT,{cell:n,className:"flex-1"}),(0,l.jsx)(tT,{cell:r,className:"shrink-0 text-right"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-1.5",children:[(0,l.jsx)(tI,{label:t("Submit Time"),cell:s}),(0,l.jsx)(tI,{label:t("Channel"),cell:a.get("channel"),primaryOnly:!0}),(0,l.jsx)(tI,{label:t("Task ID"),cell:a.get("mj_id")}),(0,l.jsx)(tI,{label:t("Duration"),cell:a.get("duration"),primaryOnly:!0}),(0,l.jsx)(tI,{label:t("Image"),cell:a.get("image_url")}),(0,l.jsx)(tI,{label:t("Prompt"),cell:a.get("prompt"),primaryOnly:!0}),(0,l.jsx)(tI,{label:t("Fail Reason"),cell:a.get("fail_reason"),className:"col-span-2 bg-transparent px-0 py-0"})]})]})}function tL(e){let{table:a,isLoading:t=!1,emptyTitle:n,emptyDescription:r,logCategory:s}=e,{t:o}=(0,i.Bd)(),c=n??o("No Logs Found"),d=r??o("No usage logs available. Logs will appear here once API calls are made.");if(t)return(0,l.jsx)(tA,{});let u=a.getRowModel().rows;return u&&0!==u.length?(0,l.jsx)("div",{className:"border-border/50 bg-card overflow-hidden rounded-lg border",children:u.map(e=>{let a=new Map(e.getVisibleCells().map(e=>[e.column.id,e])),t=e.original.type,n=null!=t?tS[t]??"":"";return(0,l.jsxs)("div",{className:(0,ek.cn)("border-border/40 border-b border-l-2 border-l-transparent p-3 transition-colors last:border-b-0",n),children:["common"===s&&(0,l.jsx)(tD,{cells:a}),"task"===s&&(0,l.jsx)(tF,{cells:a}),"drawing"===s&&(0,l.jsx)(tR,{cells:a})]},e.id)})}):(0,l.jsx)("div",{className:"rounded-lg border p-6",children:(0,l.jsx)(tC.Sv,{className:"border-none p-0",children:(0,l.jsxs)(tC.FT,{children:[(0,l.jsx)(tC.Kr,{variant:"icon",children:(0,l.jsx)(tw.A,{className:"size-6"})}),(0,l.jsx)(tC.cz,{children:c}),(0,l.jsx)(tC.Ou,{children:d})]})})})}let tK=(0,n.GY)("/_authenticated/usage-logs/$section"),tP={5:"bg-rose-50/40 dark:bg-rose-950/20",6:"bg-blue-50/30 dark:bg-blue-950/15"};function tO(e){return(Array.isArray(e)?e:e?[e]:[]).filter(e=>"0"!==String(e))}function tE(e){let{logCategory:a}=e,{t}=(0,i.Bd)(),{isAdminView:n}=ey(),r=(0,e_.Ub)("(max-width: 640px)"),o=tK.useSearch(),{columnFilters:c,onColumnFiltersChange:u,pagination:p,onPaginationChange:x,ensurePageInRange:h}
2=(0,eN.c)({search:tK.useSearch(),navigate:tK.useNavigate(),pagination:{defaultPage:1,defaultPageSize:r?20:100},globalFilter:{enabled:!1},columnFilters:[{columnId:"created_at",searchKey:"type",type:"array",deserialize:tO},{columnId:"model_name",searchKey:"model",type:"string"},{columnId:"token_name",searchKey:"token",type:"string"},{columnId:"group",searchKey:"group",type:"string"},...n?[{columnId:"channel",searchKey:"channel",type:"string"},{columnId:"username",searchKey:"username",type:"string"}]:[]]}),{data:g,isLoading:f,isFetching:b}=(0,ej.I)({queryKey:["logs",a,n,p.pageIndex+1,p.pageSize,c,o,t],queryFn:async()=>{let e=await ea({logCategory:a,isAdmin:n,page:p.pageIndex+1,pageSize:p.pageSize,searchParams:o,columnFilters:c});return e?.success?e.data||j:(d.oR.error(e?.message||t("Failed to load logs")),j)},placeholderData:(e,t)=>{if(t?.queryKey[1]===a)return e}}),y=g?.items||[],v=function(e,a){let t=function(e){let{t:a}=(0,i.Bd)(),t=[{accessorKey:"created_at",header:a("Time"),cell:e=>{let{row:t}=e,n=t.original,r=t.getValue("created_at"),s=Y(n.type);return(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,l.jsx)("span",{className:"truncate font-mono text-xs tabular-nums",children:(0,m.fk)(r)}),(0,l.jsx)(eT.Wh,{label:a(s.label),variant:s.color,size:"sm",copyable:!1,className:"-ml-1.5 !text-xs [&_span]:!text-xs"})]})},filterFn:(e,a,t)=>!!(!Array.isArray(t)||0===t.length||t.includes("0"))||t.includes(String(e.original.type)),enableHiding:!1,size:180}];return e&&t.push({id:"channel",header:a("Channel"),accessorFn:e=>e.channel,cell:function(e){let{row:t}=e,{sensitiveVisible:n,setAffinityTarget:r,setAffinityDialogOpen:s}=eb(),i=t.original;if(!G(i.type))return null;let o=eP(i.other),c=o?.admin_info?.channel_affinity,d=o?.admin_info?.use_channel??[],u=Array.isArray(d)?d.map(String).filter(Boolean):[],m=u.length>1,p=m?u.join(" â "):void 0,x=i.channel_name?`${i.channel_name} #${i.channel}`:`#${i.channel}`,h=`#${i.channel}`,g=n?i.channel_name:"â¢â¢â¢â¢",f=o?.admin_info?.multi_key_index,b=o?.admin_info?.is_multi_key===!0&&"number"==typeof f&&Number.isFinite(f);return(0,l.jsx)(eq.Bc,{children:(0,l.jsxs)(eq.m_,{children:[(0,l.jsxs)(eq.k$,{render:(0,l.jsx)("div",{className:"flex max-w-[160px] flex-col gap-0.5"}),children:[(0,l.jsxs)("div",{className:"relative inline-flex w-fit items-center gap-1",children:[(0,l.jsx)(eT.Wh,{label:h,autoColor:String(i.channel),copyText:String(i.channel),size:"sm",showDot:!1,className:"font-mono"}),b&&(0,l.jsx)(eT.Wh,{label:String(f),size:"sm",showDot:!1,copyable:!1,variant:"neutral",className:"h-5 min-w-5 justify-center rounded-full px-1 font-mono text-xs","aria-label":`${a("Key")} ${f}`}),m&&(0,l.jsxs)(eM.AM,{children:[(0,l.jsx)(eM.Wv,{render:(0,l.jsx)("button",{type:"button",className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring inline-flex size-5 shrink-0 items-center justify-center rounded-full transition-colors focus-visible:ring-2 focus-visible:outline-none","aria-label":a("Retry Chain"),onClick:e=>e.stopPropagation()}),children:(0,l.jsx)(ew.A,{className:"size-3.5 text-amber-500","aria-hidden":"true"})}),(0,l.jsx)(eM.hl,{side:"top",align:"start",className:"w-64 text-xs",children:(0,l.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,l.jsx)("p",{className:"font-medium",children:a("Retry Chain")}),(0,l.jsx)("p",{className:"text-muted-foreground font-mono break-all",children:p})]})})]}),c&&(0,l.jsx)("button",{type:"button",className:"absolute -top-1 -right-1 leading-none text-amber-500",onClick:e=>{e.stopPropagation(),r({rule_name:c.rule_name||"",using_group:c.using_group||c.selected_group||"",key_hint:c.key_hint||"",key_fp:c.key_fp||""}),s(!0)},children:(0,l.jsx)(eC.A,{className:"size-3 fill-current"})})]}),i.channel_name&&(0,l.jsx)("span",{className:"text-muted-foreground/70 truncate [font-family:var(--font-body)] !text-xs",children:g})]}),(0,l.jsx)(eq.ZI,{children:(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsx)("p",{children:n?x:h}),p&&(0,l.jsxs)("p",{className:"text-muted-foreground text-xs",children:[a("Chain"),": ",p]}),b&&(0,l.jsxs)("p",{className:"text-muted-foreground text-xs",children:[a("Key"),": ",f]}),c&&(0,l.jsxs)("div",{className:"border-t pt-1 text-xs",children:[(0,l.jsx)("p",{className:"font-medium",children:a("Channel Affinity")}),(0,l.jsxs)("p",{children:[a("Rule"),": ",c.rule_name||"-"]}),(0,l.jsxs)("p",{children:[a("Group"),":"," ",n?c.using_group||
2c.selected_group||"-":"â¢â¢â¢â¢"]})]})]})})]})})}},{id:"user",header:a("User"),accessorFn:e=>e.username,cell:function(e){let{row:a}=e,{sensitiveVisible:t,setSelectedUserId:n,setUserInfoDialogOpen:r}=eb(),s=a.original;return s.username?(0,l.jsxs)("button",{type:"button",className:"flex items-center gap-1.5 text-left",onClick:e=>{e.stopPropagation(),n(s.user_id),r(!0)},children:[(0,l.jsx)(eI.eu,{className:"ring-border/60 size-6 ring-1 max-sm:hidden",children:(0,l.jsx)(eI.q5,{className:(0,ek.cn)("text-[11px] font-semibold",!t&&"bg-muted text-muted-foreground"),style:t?(0,ez.u)(s.username):void 0,children:t?(0,ez.f)(s.username):"â¢"})}),(0,l.jsx)(eq.Bc,{delay:300,children:(0,l.jsxs)(eq.m_,{children:[(0,l.jsx)(eq.k$,{render:(0,l.jsx)("span",{className:"text-muted-foreground max-w-[100px] truncate text-sm hover:underline"}),children:t?s.username:"â¢â¢â¢â¢"}),t&&s.username.length>12&&(0,l.jsx)(eq.ZI,{side:"top",children:s.username})]})})]}):null}}),t.push({accessorKey:"token_name",header:a("Token"),cell:function(e){let{row:a}=e,{sensitiveVisible:t}=eb(),n=a.original;if(!G(n.type))return null;let r=n.token_name;if(!r)return null;let s=eP(n.other),i=t?r:"â¢â¢â¢â¢",o=n.group;o||(o=s?.group||"");let c=function(e){let a=e?.user_group_ratio;if(null!=a&&-1!==a&&Number.isFinite(a))return a;let t=e?.group_ratio;return null!=t&&1!==t&&Number.isFinite(t)?t:null}(s);return(0,l.jsxs)("div",{className:"flex max-w-[200px] flex-col gap-0.5",children:[(0,l.jsx)(eq.Bc,{delay:300,children:(0,l.jsxs)(eq.m_,{children:[(0,l.jsx)(eq.k$,{render:(0,l.jsx)("div",{className:"max-w-full"}),children:(0,l.jsx)(eT.Wh,{label:i,icon:eS.A,copyText:t?r:void 0,size:"sm",showDot:!1,className:"border-border/60 bg-muted/30 text-foreground h-6 max-w-full gap-1.5 overflow-hidden rounded-md border px-2 py-0.5 [font-family:var(--font-body)]"})}),t&&r.length>16&&(0,l.jsx)(eq.ZI,{side:"top",className:"max-w-xs break-all",children:r})]})}),(o||null!=c)&&(0,l.jsxs)("span",{className:"block max-w-full truncate text-xs leading-none",children:[o?(0,l.jsx)(eA.d,{group:o,label:t?void 0:"â¢â¢â¢â¢",type:"text",size:"sm",className:"inline align-baseline text-xs leading-none [&>span]:leading-none"}):null,o&&null!=c?" ":null,null!=c?(0,l.jsxs)("span",{className:"text-muted-foreground/60 relative top-px align-baseline tabular-nums",children:[aw(c),"x"]}):null]})]})},size:160}),t.push({accessorKey:"model_name",header:a("Model"),cell:function(e){let a,t,{row:n}=e,r=n.original;if(!G(r.type))return null;let s=(a=eP(r.other),t=!!(a?.is_model_mapped&&a?.upstream_model_name&&""!==a.upstream_model_name),{name:r.model_name,isMapped:t,actualModel:t?a.upstream_model_name:void 0});return(0,l.jsx)("div",{className:"flex w-fit flex-col gap-0.5",children:(0,l.jsx)(aj,{modelName:s.name,actualModel:s.actualModel})})},meta:{mobileTitle:!0}},{accessorKey:"is_stream",header:a("Stream"),cell:e=>{let{row:a}=e,t=a.original;if(!Z(t.type))return null;let n=a.getValue("use_time"),r=eP(t.other),s=n>0&&t.completion_tokens>0?t.completion_tokens/n:null;return(0,l.jsx)(ak,{isStream:t.is_stream,tokensPerSecond:s,streamStatus:r?.stream_status})},meta:{label:a("Stream")}},{accessorKey:"prompt_tokens",header:"Tokens",cell:e=>{let{row:t}=e,n=t.original;if(!G(n.type))return null;let r=eP(n.other),s=n.prompt_tokens||0,i=n.completion_tokens||0;if(0===s&&0===i)return(0,l.jsx)("span",{className:"text-muted-foreground text-xs",children:"-"});let o=r?.cache_tokens||0,c=r?.cache_creation_tokens_5m||0,d=r?.cache_creation_tokens_1h||0,u=c>0||d>0?c+d:r?.cache_creation_tokens||0;return(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsxs)("span",{className:"font-mono text-xs font-medium tabular-nums",children:[s.toLocaleString()," /"," ",i.toLocaleString()]}),(o>0||u>0)&&(0,l.jsxs)("div",{className:"flex items-center gap-1 text-[11px]",children:[o>0&&(0,l.jsxs)("span",{className:"text-muted-foreground/60",children:[a("Cache"),"â ",o.toLocaleString()]}),u>0&&(0,l.jsxs)("span",{className:"text-muted-foreground/60",children:["â ",u.toLocaleString()]})]})]})}},{accessorKey:"quota",header:a("Cost"),cell:e=>{let{row:a}=e,t=a.original;if(!G(t.type))return null;let n=a.getValue("quota"),r=eP(t.other);return(0,l.jsx)(af,{quota:n,other:r})}},{accessorKey:"use_time",header:a("Timing"),cell:e=>{let{row:a}=e,t=a.original;if(!Z(t.type))return null;let n=a.getValue("use_time"),r=eP(t.other);return(0,l.jsx)(aN,{useTimeSec:n,completionTokens:t.completion_tokens,frtMs:r?.frt,isStream:t.is_stream})}},{accessorKey:"content",header:a("Details"),cell:function(t){let n,{row:r}
2=t,[i,o]=(0,s.useState)(!1),c=r.original,d=eP(c.other),u=(n=function(e,a,t){if(3===e.type||7===e.type){let e=eH(a,t);return e?[{text:e}]:[]}if(6===e.type)return[{text:t("Async task refund")}];if(2!==e.type)return[];if(eR(a)){let l=[];return l.push({text:t("Violation Fee"),danger:!0}),a?.violation_fee_code&&l.push({text:a.violation_fee_code,muted:!0}),l.push({text:`${t("Fee")}: ${(0,m.qW)(a?.fee_quota??e.quota)}`,muted:!0}),l}if(!a)return[];let l=[],n={digitsLarge:4,digitsSmall:6,abbreviate:!1},r=e=>(0,e$.AM)(e,n),s=(e,a)=>{let t=e.join(" / ");return a?`${t}/M`:t},i="tiered_expr"===a.billing_mode,o=eV(a);if(i)if(o){let e=o.priceEntries.filter(e=>["inputPrice","outputPrice"].includes(e.field)).map(e=>r(e.price));if(e.length>0){let a=o.tier.label||t("Default");l.push({text:`${a} \xb7 ${s(e,!0)}`})}let a=o.priceEntries.filter(e=>["cacheReadPrice","cacheCreatePrice","cacheCreate1hPrice"].includes(e.field)).map(e=>r(e.price));a.length>0&&l.push({text:`${t("Cache")} ${s(a,!1)}`,muted:!0});let i=o.priceEntries.filter(e=>!["inputPrice","outputPrice","cacheReadPrice","cacheCreatePrice","cacheCreate1hPrice"].includes(e.field)).map(e=>{let a;return`${t(e.shortLabel)} ${a=e.price,`${(0,e$.AM)(a,n)}/M`}`});i.length>0&&l.push({text:i.join(" · "),muted:!0})}else l.push({text:`${t("Dynamic Pricing")} \xb7 ${t("No matching results")}`,muted:!0});else{let e=a.model_price;if((e??0)>0&&null!=e)l.push({text:`${t("Per-call")} \xb7 ${(0,e$.AM)(e,n)}`});else if(null!=a.model_ratio){let e=2*a.model_ratio,n=[r(e)];if(null!=a.completion_ratio&&n.push(r(e*a.completion_ratio)),l.push({text:`${t("Standard")} \xb7 ${s(n,!0)}`}),eU(a)){let n=[null!=a.cache_ratio&&1!==a.cache_ratio?r(e*a.cache_ratio):null,null!=a.cache_creation_ratio&&1!==a.cache_creation_ratio?r(e*a.cache_creation_ratio):null,null!=a.cache_creation_ratio_1h&&0!==a.cache_creation_ratio_1h?r(e*a.cache_creation_ratio_1h):null].filter(Boolean);n.length>0&&l.push({text:`${t("Cache")} ${s(n,!1)}`,muted:!0})}}else{let e=a.user_group_ratio,n=a.group_ratio,r=null!=e&&Number.isFinite(e)&&-1!==e,s=r?e:n,i=r?t("User Exclusive Ratio"):t("Group Ratio");null!=s&&Number.isFinite(s)&&l.push({text:`${i} ${aw(s)}x`})}}return a.is_system_prompt_overwritten&&l.push({text:t("System Prompt Override"),danger:!0}),l}(c,d,a),e&&d?.admin_info?.quota_saturation?[{text:a("Quota clamped"),danger:!0},...n]:n),p=u[0],x=u.length>1,h="text-foreground";p?.muted?h="text-muted-foreground/60":p?.danger&&(h="text-red-600 dark:text-red-400");let g=(0,l.jsx)("span",{className:"text-muted-foreground/40",children:"â"});return p?g=(0,l.jsxs)("span",{className:(0,ek.cn)("truncate leading-snug group-hover:underline",h),children:[p.text,x&&(0,l.jsxs)("span",{className:"text-muted-foreground/40 ml-0.5",children:["+",u.length-1]})]}):c.content&&(g=(0,l.jsx)("span",{className:"text-muted-foreground truncate group-hover:underline",children:c.content})),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{type:"button",className:"group flex max-w-[200px] items-center gap-1 text-left text-xs",onClick:()=>o(!0),title:a("Click to view full details"),children:g}),(0,l.jsx)(ad,{log:c,isAdmin:e,open:i,onOpenChange:o})]})},size:180,maxSize:200}),t}(a),n=function(e){let{t:a}=(0,i.Bd)(),t=[{accessorKey:"submit_time",header:a("Submit Time"),cell:e=>{let{row:t}=e,n=t.original,r=t.getValue("submit_time");return(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,l.jsx)("span",{className:"truncate font-mono text-xs tabular-nums",children:(0,m.fk)(r,"milliseconds")}),(0,l.jsx)(eT.Wh,{label:a(aB.getLabel(n.status)),variant:aB.getVariant(n.status),size:"sm",copyable:!1})]})},size:180}];return e&&t.push(aX({headerLabel:a("Channel")})),t.push({accessorKey:"action",header:a("Type"),cell:e=>{let{row:t}=e,n=t.getValue("action");return(0,l.jsx)(eT.Wh,{label:a(aE.getLabel(n)),variant:aE.getVariant(n),icon:a1[n]??aP.A,size:"sm",copyable:!1,className:"-ml-1.5"})}}),t.push({accessorKey:"mj_id",header:a("Task ID"),cell:e=>{let{row:a}=e,t=a.getValue("mj_id");return t?(0,l.jsx)("div",{className:"flex max-w-[160px] flex-col gap-0.5",children:(0,l.jsx)(eT.Wh,{label:t,copyText:t,variant:"neutral",size:"sm",className:"border-border/60 bg-muted/30 !text-foreground max-w-full truncate rounded-md border px-1.5 py-0.5 font-mono"})}
2):(0,l.jsx)("span",{className:"text-muted-foreground/60 text-xs",children:"-"})},meta:{mobileTitle:!0}}),t.push(aJ({submitTimeKey:"submit_time",finishTimeKey:"finish_time",headerLabel:a("Duration")})),e&&t.push({accessorKey:"code",header:a("Submit Result"),cell:e=>{let{row:t}=e,n=t.getValue("code");return(0,l.jsx)(eT.Wh,{label:a(aU.getLabel(String(n))),variant:aU.getVariant(String(n)),size:"sm",copyable:!1,className:"-ml-1.5"})}}),t.push(a0({headerLabel:a("Progress")}),{accessorKey:"image_url",header:a("Image"),cell:function(e){let{row:t}=e,n=t.original,r=t.getValue("image_url"),[i,o]=(0,s.useState)(!1);return r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{type:"button",className:"group text-left text-xs",onClick:()=>o(!0),title:a("Click to view image"),children:(0,l.jsx)("span",{className:"text-foreground truncate leading-snug group-hover:underline",children:a("View")})}),(0,l.jsx)(aZ,{imageUrl:r,taskId:n.mj_id,open:i,onOpenChange:o})]}):(0,l.jsx)("span",{className:"text-muted-foreground/60 text-xs",children:"-"})}},{accessorKey:"prompt",header:a("Prompt"),cell:function(e){let{row:t}=e,n=t.original,r=t.getValue("prompt"),[i,o]=(0,s.useState)(!1);return r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{type:"button",className:"group flex max-w-[220px] items-center text-left text-xs",onClick:()=>o(!0),title:a("Click to view full prompt"),children:(0,l.jsx)("span",{className:"text-muted-foreground truncate leading-snug group-hover:underline",children:r})}),(0,l.jsx)(aY,{prompt:r,promptEn:n.prompt_en,open:i,onOpenChange:o})]}):(0,l.jsx)("span",{className:"text-muted-foreground/60 text-xs",children:"-"})},size:200,maxSize:220},function(e){let{accessorKey:a="fail_reason",headerLabel:t,cellTitle:n}=e;return{accessorKey:a,header:e=>{let{column:a}=e;return(0,l.jsx)(ev.wZ,{column:a,title:t})},cell:function(e){let{row:t}=e,r=t.getValue(a),[i,o]=(0,s.useState)(!1);return r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{type:"button",className:"group flex max-w-[200px] items-center gap-1 text-left text-xs",onClick:()=>o(!0),title:n,children:(0,l.jsx)("span",{className:"truncate leading-snug text-red-600 group-hover:underline dark:text-red-400",children:r})}),(0,l.jsx)(aQ,{failReason:r,open:i,onOpenChange:o})]}):(0,l.jsx)("span",{className:"text-muted-foreground/60 text-xs",children:"-"})},meta:{label:t}}}({headerLabel:a("Fail Reason"),cellTitle:a("Click to view full error message")})),t}(a),r=function(e){let{t:a}=(0,i.Bd)(),t=[{accessorKey:"submit_time",header:a("Submit Time"),cell:e=>{let{row:a}=e,t=a.original,n=a.getValue("submit_time");return(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,l.jsx)("span",{className:"truncate font-mono text-xs tabular-nums",children:(0,m.fk)(n,"seconds")}),t.finish_time?(0,l.jsx)("span",{className:"text-muted-foreground/60 truncate font-mono text-[11px] tabular-nums",children:(0,m.fk)(t.finish_time,"seconds")}):(0,l.jsx)("span",{className:"text-muted-foreground/50 text-[11px]",children:"-"})]})},size:180}];return e&&t.push(aX({headerLabel:a("Channel")}),{id:"user",header:a("User"),accessorFn:e=>e.username||e.user_id,cell:function(e){let{row:a}=e,{sensitiveVisible:t,setSelectedUserId:n,setUserInfoDialogOpen:r}=eb(),s=a.original,i=s.username||String(s.user_id||"?");return(0,l.jsxs)("button",{type:"button",className:"flex items-center gap-1.5 text-left",onClick:e=>{e.stopPropagation(),n(s.user_id),r(!0)},children:[(0,l.jsx)(eI.eu,{className:"ring-border/60 size-6 ring-1 max-sm:hidden",children:(0,l.jsx)(eI.q5,{className:(0,ek.cn)("text-[11px] font-semibold",!t&&"bg-muted text-muted-foreground"),style:t?(0,ez.u)(i):void 0,children:t?(0,ez.f)(i):"â¢"})}),(0,l.jsx)("span",{className:"text-muted-foreground truncate text-sm hover:underline",children:t?i:"â¢â¢â¢â¢"})]})}}),t.push({accessorKey:"task_id",header:a("Task ID"),cell:e=>{let{row:t}=e,n=t.original,r=t.getValue("task_id");return r?(0,l.jsxs)("div",{className:"flex max-w-[170px] flex-col gap-0.5",children:[(0,l.jsx)(eT.Wh,{label:r,copyText:r,variant:"neutral",size:"sm",className:"border-border/60 bg-muted/30 !text-foreground max-w-full truncate rounded-md border px-1.5 py-0.5 font-mono"}
2),(0,l.jsxs)("span",{className:"text-muted-foreground/60 truncate text-[11px]",children:[a(n.platform)," · ",a(aV.getLabel(n.action))]})]}):(0,l.jsx)("span",{className:"text-muted-foreground/60 text-xs",children:"-"})},meta:{mobileTitle:!0}},aJ({submitTimeKey:"submit_time",finishTimeKey:"finish_time",unit:"seconds",headerLabel:a("Duration"),warningThresholdSec:300}),{accessorKey:"status",header:a("Status"),cell:e=>{let{row:t}=e,n=t.getValue("status");return(0,l.jsx)(eT.Wh,{label:a(aW.getLabel(n,n||"Submitting")),variant:aW.getVariant(n),size:"sm",copyable:!1,className:"-ml-1.5"})}},a0({headerLabel:a("Progress")}),{accessorKey:"fail_reason",header:a("Details"),cell:function(e){let{row:t}=e,n=t.original,r=t.getValue("fail_reason"),i=n.status,[o,c]=(0,s.useState)(!1);if("suno"===n.platform&&i===U&&a6(n.data).some(e=>e&&"object"==typeof e&&e.audio_url))return(0,l.jsx)(a8,{log:n});let d=n.action===K||n.action===P||n.action===O||n.action===E||n.action===B,u=r?.startsWith("http");if(i===U&&d&&u){let e=`/v1/videos/${n.task_id}/content`;return(0,l.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-foreground text-xs hover:underline",children:a("Click to preview video")})}return r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{type:"button",className:"group flex max-w-[200px] items-center gap-1 text-left text-xs",onClick:()=>c(!0),title:a("Click to view full error message"),children:(0,l.jsx)("span",{className:"truncate leading-snug text-red-600 group-hover:underline dark:text-red-400",children:r})}),(0,l.jsx)(aQ,{failReason:r,open:o,onOpenChange:c})]}):(0,l.jsx)("span",{className:"text-muted-foreground/60 text-xs",children:"-"})},size:200,maxSize:220}),t}(a);switch(e){case"common":default:return t;case"drawing":return n;case"task":return r}}(a,n),_=f||b&&!g,{table:N}=(0,ev.uI)({data:y,columns:v,columnFilters:c,columnVisibilityStorageKey:`usage-logs:${a}:${n?"admin":"user"}:column-visibility`,pagination:p,enableRowSelection:!1,onPaginationChange:x,onColumnFiltersChange:u,manualPagination:!0,manualFiltering:!0,totalCount:g?.total||0,ensurePageInRange:h}),k="common"===a;return(0,l.jsx)(ev.cx,{table:N,columns:v,isLoading:_,isFetching:b,emptyTitle:t("No Logs Found"),emptyDescription:t("No usage logs available. Logs will appear here once API calls are made."),skeletonKeyPrefix:"usage-log-skeleton",applyHeaderSize:!0,tableClassName:(0,ek.cn)("[&_[data-slot=table]]:text-[13px] [&_[data-slot=table]_td]:text-[13px] [&_[data-slot=table]_td_*]:text-[13px] [&_[data-slot=table]_th]:text-[13px] [&_[data-slot=table]_th_*]:text-[13px]"),mobile:(0,l.jsx)(tL,{table:N,isLoading:_,logCategory:a}),toolbar:k?(0,l.jsx)(tv,{table:N}):(0,l.jsx)(tN,{table:N,logCategory:a}),renderRow:e=>{let a=e.original.type,t=k&&null!=a?tP[a]??"":"";if(k&&n){let a=eP(e.original.other??"");a?.admin_info?.quota_saturation&&(t="bg-amber-50/60 dark:bg-amber-950/25")}return(0,l.jsx)(ev.J2,{row:e,className:(0,ek.cn)("transition-colors",t),getColumnClassName:()=>k?"py-2":"py-3.5"},e.id)}})}var tB=t(51581);let tU=(0,n.GY)("/_authenticated/usage-logs/$section"),tV=["drawing","task"],tW={common:{titleKey:"Common Logs"},drawing:{titleKey:"Drawing Logs"},task:{titleKey:"Task Logs"}};function tH(){let{t:e}=(0,i.Bd)(),a=(0,r.Z)(),t=tU.useParams(),n=t.section&&(0,tB.Dk)(t.section)?t.section:tB.Ck,{selectedUserId:d,userInfoDialogOpen:u,setUserInfoDialogOpen:m,affinityTarget:p,affinityDialogOpen:g,setAffinityDialogOpen:f}=eb(),{canManageScope:b,viewScope:y,setViewScope:j}=ey(),v=(0,s.useMemo)(()=>[{title:"Task Logs",items:tV.map(e=>({title:tW[e].titleKey,url:`/usage-logs/${e}`}))}],[]),_=(0,h.K)(v),N=(0,s.useMemo)(()=>(_[0]?.items??[]).map(e=>"url"in e&&"string"==typeof e.url?e.url.split("/").pop()??null:null).filter(e=>!!(e&&(0,tB.Dk)(e))),[_]),k=(0,s.useCallback)(e=>{a({to:"/usage-logs/$section",params:{section:e}})},[a]),w=(0,s.useCallback)(e=>{("all"===e||"self"===e)&&j(e)},[j]),C="common"===n?tW.common:tW.task,S="common"!==n&&N.length>1;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(o.Ni,{fixedContent:!0,children:[(0,l.jsx)(o.Ni.Title,{children:e(C.titleKey)}),b&&(0,l.jsx)(o.Ni.Actions,{children:(0,l.jsx)(c.tU,{value:y,onValueChange:w,children:(0,l.jsxs)(c.j7,{children:[(0,l.jsx)(c.Xi,{value:"all",children:e("All")}),(0,l.jsx)(c.Xi,{value:"self",children:e("Only Mine")})]})})}),(0,l.jsx)(o.Ni.Content,{children:(0,l.jsxs)("div",{className:"flex h-full min-h-0 flex-col gap-4",children:[S&&(0,l.jsx)(c.tU,{value:n,onValueChange:k,children:(0,l.jsx)(c.j7,{className:"max-w-full flex-wrap justify-start group-data-horizontal/tabs:h-auto",children:N.map(a=>(0,l.jsx)(c.Xi,{value:a,children:e(tW[a].titleKey)},a))})}),(0,l.jsx)("div",{className:"min-h-0 flex-1",children:(0,l.jsx)(tE,{logCategory:n})})]})})]}),(0,l.jsx)(ex,{userId:d,open:u,onOpenChange:m}),(0,l.jsx)(x,{open:g,onOpenChange:f,target:p?{rule_name:p.rule_name||"",using_group:p.using_group||p.selected_group||"",key_hint:p.key_hint||"",key_fp:p.key_fp||""}:null})]})}
2let tG=function(){return(0,l.jsx)(ef,{children:(0,l.jsx)(tH,{})})}},38288(e,a,t){let l=(0,t(9781).A)("calendar-days",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);t.d(a,{},{A:l})},10823(e,a,t){let l=(0,t(9781).A)("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]);t.d(a,{},{A:l})},59736(e,a,t){let l=(0,t(9781).A)("log-in",[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]);t.d(a,{},{A:l})},35285(e,a,t){let l=(0,t(9781).A)("route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);t.d(a,{},{A:l})},76336(e,a,t){let l=(0,t(9781).A)("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);t.d(a,{},{A:l})},73606(e,a,t){let l=(0,t(9781).A)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);t.d(a,{},{A:l})},94369(e,a,t){let l=(0,t(9781).A)("shuffle",[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]]);t.d(a,{},{A:l})},83940(e,a,t){let l=(0,t(9781).A)("user-round",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);t.d(a,{},{A:l})},30544(e,a,t){let l=(0,t(9781).A)("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);t.d(a,{},{A:l})}}]);
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.