diff --git a/changelog/unreleased/checkin-skipped-feedback.md b/changelog/unreleased/checkin-skipped-feedback.md new file mode 100644 index 00000000..43204633 --- /dev/null +++ b/changelog/unreleased/checkin-skipped-feedback.md @@ -0,0 +1,7 @@ +### English + +- A check-in that the upstream marks as skipped (the activity is closed, not started, or already ended) now shows "Activity unavailable" on the account card instead of a green success. A one-click "check in all" run counts those accounts as failed in the summary. + +### 中文 + +- 上游返回跳过的签到(活动未开放、未开始或已结束)现在在账号卡片上显示「活动未开放」,不再显示绿色成功。一键签到的汇总也会把这些账号计入失败。 diff --git a/frontend/src/components/account/AccountCard.tsx b/frontend/src/components/account/AccountCard.tsx index 5080bcf0..b24391fb 100644 --- a/frontend/src/components/account/AccountCard.tsx +++ b/frontend/src/components/account/AccountCard.tsx @@ -40,7 +40,7 @@ type Translate = (key: string, vars?: Record) => string // `kind` selects the glyph/colour; `message` is the raw upstream error text // (only present for failures) and may be truncated in the UI with a copy button. export type CheckinFeedback = { - kind: 'success' | 'already' | 'error' + kind: 'success' | 'already' | 'skipped' | 'error' message?: string } @@ -321,16 +321,18 @@ export function AccountCard({
{feedback.kind === 'success' ? ( - ) : feedback.kind === 'already' ? ( - - ) : ( + ) : feedback.kind === 'error' ? ( + ) : ( + )}
{feedback.kind === 'success' ? ( {t('checkinRecordSuccess')} ) : feedback.kind === 'already' ? ( {t('checkinRecordAlready')} + ) : feedback.kind === 'skipped' ? ( + {t('checkinRecordSkipped')} ) : ( {t('checkinRecordFailed')} )} diff --git a/frontend/src/pages/AccountsPage.tsx b/frontend/src/pages/AccountsPage.tsx index 578cd339..0282a2ed 100644 --- a/frontend/src/pages/AccountsPage.tsx +++ b/frontend/src/pages/AccountsPage.tsx @@ -492,10 +492,11 @@ export function AccountsPage() { } try { const result = await checkinAccount(pending[index].id) - summary.checked += 1 const status = result?.last_checkin_status const message = result?.last_checkin_msg - const kind = status === 'already' ? 'already' : status === 'error' ? 'error' : 'success' + const kind = status === 'already' ? 'already' : status === 'skipped' ? 'skipped' : status === 'error' ? 'error' : 'success' + if (kind === 'error' || kind === 'skipped') summary.failed += 1 + else summary.checked += 1 setCheckinFeedbackById((current) => ({ ...current, [pending[index].id]: { kind, message: kind === 'error' ? message || t('checkinRecordFailed') : message }, @@ -543,7 +544,7 @@ export function AccountsPage() { } const status = result?.last_checkin_status const message = result?.last_checkin_msg - const kind = status === 'already' ? 'already' : status === 'error' ? 'error' : 'success' + const kind = status === 'already' ? 'already' : status === 'skipped' ? 'skipped' : status === 'error' ? 'error' : 'success' setCheckinFeedbackById((current) => ({ ...current, [id]: { kind, message: kind === 'error' ? message || t('checkinRecordFailed') : message }, diff --git a/internal/webui/static/assets/CartesianGrid-1HegCBTm.js b/internal/webui/static/assets/CartesianGrid-Cw-8i_Ey.js similarity index 99% rename from internal/webui/static/assets/CartesianGrid-1HegCBTm.js rename to internal/webui/static/assets/CartesianGrid-Cw-8i_Ey.js index 1c0001d0..87261816 100644 --- a/internal/webui/static/assets/CartesianGrid-1HegCBTm.js +++ b/internal/webui/static/assets/CartesianGrid-Cw-8i_Ey.js @@ -1,4 +1,4 @@ -import{$t as e,A as t,At as n,Bt as r,Cn as i,Ct as a,Dt as o,E as s,Et as c,F as l,Ft as u,Gt as d,H as f,Ht as p,I as m,It as h,J as g,Jt as _,K as v,Kt as y,L as b,Lt as x,M as S,Mt as C,N as w,Nt as T,O as E,Ot as D,P as O,Pt as k,R as ee,Rt as te,Sn as A,St as j,Tn as M,Tt as ne,Ut as re,Vt as ie,W as N,Wt as ae,X as oe,Xt as se,Y as P,Yt as ce,Z as le,Zt as ue,an as F,bt as de,cn as fe,ct as I,dn as pe,dt as me,en as L,et as he,fn as ge,gt as _e,ht as ve,it as ye,j as be,jt as xe,k as Se,kt as Ce,l as we,ln as Te,nn as Ee,nt as De,on as Oe,ot as ke,pn as Ae,q as R,qt as je,rt as Me,sn as Ne,st as Pe,tn as z,tt as Fe,u as Ie,ut as Le,vt as Re,wn as ze,wt as Be,xt as Ve,yt as B,z as He,zt as Ue}from"./index-BTLD14uK.js";function We(e,t){let n=new Map;for(let r=0;rvoid 0)}function et(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return tt(e,t,n,r,i);case`function`:return Object.keys(t).length>0?et(e,{...t},n,r,i):j(e,t);default:return Ve(e)&&i?typeof t!=`string`||t===``:j(e,t)}}function tt(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return rt(e,t,n,r);if(t instanceof Map)return nt(e,t,n,r);if(t instanceof Set)return it(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)Je(e)&&(e=Object(e));else{let t=y(e);if(t!==`[object Object]`&&t!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;ivoid 0)}function ot(e){return e=Qe(e),t=>at(t,e)}function st(e,t){return Xe(e,(n,i,a,s)=>{let c=t?.(n,i,a,s);if(c!==void 0)return c;if(typeof e==`object`){if(y(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return s.set(e,t),H(t,e,a,s),t}switch(Object.prototype.toString.call(e)){case h:case r:case o:{let t=new e.constructor(e?.valueOf());return H(t,e),t}case Be:{let t={};return H(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function ct(e){return st(e)}function lt(e){return typeof e==`object`&&!!e&&y(e)===`[object Arguments]`}function ut(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&Te(t)&&!(t in Object(e))?Ne(t):[t],n.length===0)return!1;let r=e;for(let e=0;evoid 0)}function et(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return tt(e,t,n,r,i);case`function`:return Object.keys(t).length>0?et(e,{...t},n,r,i):j(e,t);default:return Ve(e)&&i?typeof t!=`string`||t===``:j(e,t)}}function tt(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return rt(e,t,n,r);if(t instanceof Map)return nt(e,t,n,r);if(t instanceof Set)return it(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)Je(e)&&(e=Object(e));else{let t=y(e);if(t!==`[object Object]`&&t!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;ivoid 0)}function ot(e){return e=Qe(e),t=>at(t,e)}function st(e,t){return Xe(e,(n,i,a,s)=>{let c=t?.(n,i,a,s);if(c!==void 0)return c;if(typeof e==`object`){if(y(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return s.set(e,t),H(t,e,a,s),t}switch(Object.prototype.toString.call(e)){case h:case r:case o:{let t=new e.constructor(e?.valueOf());return H(t,e),t}case Be:{let t={};return H(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function ct(e){return st(e)}function lt(e){return typeof e==`object`&&!!e&&y(e)===`[object Arguments]`}function ut(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&Te(t)&&!(t in Object(e))?Ne(t):[t],n.length===0)return!1;let r=e;for(let e=0;ee.length)&&(t=e.length);for(var n=0,r=Array(t);nW||Math.abs(e.left-t.left)>W||Math.abs(e.top-t.top)>W||Math.abs(e.width-t.width)>W}function wt(e){var t=e.getBoundingClientRect();return{height:t.height,left:t.left,top:t.top,width:t.width}}function Tt(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=_t((0,U.useState)({height:0,left:0,top:0,width:0}),2),n=t[0],r=t[1],i=(0,U.useRef)(null),a=(0,U.useRef)(n);a.current=n;var o=(0,U.useCallback)(e=>{if(i.current!=null&&(i.current.disconnect(),i.current=null),e!=null){var t=wt(e);if(Ct(t,a.current)&&r(t),typeof ResizeObserver<`u`){var n=new ResizeObserver(()=>{var t=wt(e);Ct(t,a.current)&&r(t)});n.observe(e),i.current=n}}},[...e]);return(0,U.useEffect)(()=>()=>{var e;(e=i.current)==null||e.disconnect()},[]),[n,o]}function Et(){return Et=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{var n=t.separator,r=n===void 0?K.separator:n,i=t.contentStyle,a=t.itemStyle,o=t.labelStyle,s=o===void 0?K.labelStyle:o,c=t.payload,l=t.formatter,u=t.itemSorter,d=t.wrapperClassName,f=t.labelClassName,p=t.label,m=t.labelFormatter,h=t.accessibilityLayer,g=h===void 0?K.accessibilityLayer:h,_=()=>{if(c&&c.length){var e={padding:0,margin:0},t=Rt(c,u).map((e,t)=>{if(!e||e.type===`none`)return null;var n=e.formatter||l||Lt,i=e.value,o=e.name,s=i,u=o;if(n){var d=n(i,o,e,t,c);if(Array.isArray(d)){var f=jt(d,2);s=f[0],u=f[1]}else if(d!=null)s=d;else return null}var p=G(G({},K.itemStyle),{},{color:e.color||K.itemStyle.color},a);return U.createElement(`li`,{className:`recharts-tooltip-item`,key:`tooltip-item-${t}`,style:p},L(u)?U.createElement(`span`,{className:`recharts-tooltip-item-name`},u):null,L(u)?U.createElement(`span`,{className:`recharts-tooltip-item-separator`},r):null,U.createElement(`span`,{className:`recharts-tooltip-item-value`},s),U.createElement(`span`,{className:`recharts-tooltip-item-unit`},e.unit||``))});return U.createElement(`ul`,{className:`recharts-tooltip-item-list`,style:e},t)}return null},v=G(G({},K.contentStyle),i),y=G({margin:0},s),b=!e(p),x=b?p:``,S=A(`recharts-default-tooltip`,d),C=A(`recharts-tooltip-label`,f);b&&m&&c!=null&&(x=m(p,c));var w=g?{role:`status`,"aria-live":`assertive`}:{};return U.createElement(`div`,Et({className:S,style:v},w),U.createElement(`p`,{className:C,style:y},U.isValidElement(x)?x:`${x}`),_())},q=`recharts-tooltip-wrapper`,Bt={visibility:`hidden`};function Vt(e){var t=e.coordinate,n=e.translateX,r=e.translateY;return A(q,{[`${q}-right`]:z(n)&&t&&z(t.x)&&n>=t.x,[`${q}-left`]:z(n)&&t&&z(t.x)&&n=t.y,[`${q}-top`]:z(r)&&t&&z(t.y)&&r0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var f=c[r];return f==null?0:o[r]?Math.max(uf+l?Math.max(u,f):Math.max(d,f)}function Ut(e){var t=e.translateX,n=e.translateY;return{transform:e.useTranslate3d?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function Wt(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTop,i=e.offsetLeft,a=e.position,o=e.reverseDirection,s=e.tooltipBox,c=e.useTranslate3d,l=e.viewBox,u,d,f;return s&&s.height>0&&s.width>0&&n?(d=Ht({allowEscapeViewBox:t,coordinate:n,key:`x`,offset:i,position:a,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=Ht({allowEscapeViewBox:t,coordinate:n,key:`y`,offset:r,position:a,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=Ut({translateX:d,translateY:f,useTranslate3d:c})):u=Bt,{cssProperties:u,cssClasses:Vt({translateX:d,translateY:f,coordinate:n})}}function Gt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),2),r=n[0],i=n[1];U.useEffect(()=>{var t=t=>{t.key===`Escape`&&i({dismissed:!0,dismissedAtCoordinate:{x:e.coordinate?.x??0,y:e.coordinate?.y??0}})};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e.coordinate?.x,e.coordinate?.y]),r.dismissed&&((e.coordinate?.x??0)!==r.dismissedAtCoordinate.x||(e.coordinate?.y??0)!==r.dismissedAtCoordinate.y)&&i(J(J({},r),{},{dismissed:!1}));var a=Wt({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset==`number`?e.offset:e.offset.x,offsetTop:typeof e.offset==`number`?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:e.lastBoundingBox,useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),o=a.cssClasses,s=a.cssProperties,c=J(J({},e.hasPortalFromProps?{}:J(J({transition:tn({prefersReducedMotion:t,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},s),{},{pointerEvents:`none`,position:`absolute`,top:0,left:0})),{},{visibility:!r.dismissed&&e.active&&e.hasPayload?`visible`:`hidden`},e.wrapperStyle);return U.createElement(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,tabIndex:-1,className:o,style:c,ref:e.innerRef},e.children)}var rn=U.memo(nn),an=[`x`,`y`,`top`,`left`,`width`,`height`,`className`];function on(){return on=Object.assign?Object.assign.bind():function(e){for(var t=1;t`M${e},${i}v${r}M${a},${t}h${n}`,hn=e=>{var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.top,o=a===void 0?0:a,s=e.left,c=s===void 0?0:s,l=e.width,u=l===void 0?0:l,d=e.height,f=d===void 0?0:d,p=e.className,m=fn(e,an),h=cn({x:n,y:i,top:o,left:c,width:u,height:f},m);return!z(n)||!z(i)||!z(u)||!z(f)||!z(o)||!z(c)?null:U.createElement(`path`,on({},pe(h),{className:A(`recharts-cross`,p),d:mn(n,i,u,f,o,c)}))};function gn(e,t,n,r){var i=r/2;return{stroke:`none`,fill:`#ccc`,x:e===`horizontal`?t.x-i:n.left+.5,y:e===`horizontal`?n.top+.5:t.y-i,width:e===`horizontal`?r:n.width-1,height:e===`horizontal`?n.height-1:r}}function _n(e){var t=e.cx,n=e.cy,r=e.radius,i=e.startAngle,a=e.endAngle;return{points:[R(t,n,r,i),R(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}var vn,yn,bn,xn,Sn,Cn,wn;function Tn(){return Tn=Object.assign?Object.assign.bind():function(e){for(var t=1;tEe(t-e)*Math.min(Math.abs(t-e),359.999),X=e=>{var t=e.cx,n=e.cy,r=e.radius,i=e.angle,a=e.sign,o=e.isExternal,s=e.cornerRadius,c=e.cornerIsExternal,l=s*(o?1:-1)+r,u=Math.asin(s/l)/v,d=c?i:i+a*u,f=R(t,n,l,d),p=R(t,n,r,d),m=c?i-a*u:i;return{center:f,circleTangency:p,lineTangency:R(t,n,l*Math.cos(u*v),m),theta:u}},Dn=e=>{var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.startAngle,o=e.endAngle,s=En(a,o),c=a+s,l=R(t,n,i,a),u=R(t,n,i,c),d=F(vn||=Y([`M `,`,`,` diff --git a/internal/webui/static/assets/CostChart-Dpyzl54f.js b/internal/webui/static/assets/CostChart-Dvs5WgLu.js similarity index 96% rename from internal/webui/static/assets/CostChart-Dpyzl54f.js rename to internal/webui/static/assets/CostChart-Dvs5WgLu.js index dc6ddd96..01db83dc 100644 --- a/internal/webui/static/assets/CostChart-Dpyzl54f.js +++ b/internal/webui/static/assets/CostChart-Dvs5WgLu.js @@ -1 +1 @@ -import{n as e,t}from"./CartesianGrid-1HegCBTm.js";import{Tn as n,_n as r,a as i,at as a,gn as o,i as s,r as c,t as l,vn as u,wn as d,xn as f}from"./index-BTLD14uK.js";var p=n(d(),1),m=f(),h=[`var(--accent)`,`var(--muted)`,`var(--success)`,`var(--warning)`];function g(e,t,n){let r=new Date(e);return Number.isFinite(r.getTime())?new Intl.DateTimeFormat(n===`zh`?`zh-CN`:`en-US`,t?{month:`short`,day:`numeric`}:{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):``}function _(e,t){return t===`credits`?e.per_model_credits??{}:t===`tokens`?e.per_model_tokens??{}:e.per_model??{}}function v(e,t){return t===`cost`?o(e):t===`tokens`?r(e):u(e)}function y(e,t){return t===`cost`?`¥${e>=10?Math.round(e):Number(e.toFixed(1))}`:t===`tokens`?r(e):u(e)}function b({active:e,payload:t,label:n,daily:r,lang:i,models:a,totalLabel:o,metric:s}){if(!e||!t?.length)return null;let c=new Map(a.map(e=>[e.id,e.label])),l=t.filter(e=>(e.value??0)>0).sort((e,t)=>t.value-e.value),u=t.reduce((e,t)=>e+(t.value??0),0);return(0,m.jsxs)(`div`,{className:`rounded-xl bg-overlay px-3 py-2 text-caption text-overlay-foreground shadow-overlay`,children:[(0,m.jsx)(`div`,{className:`mono text-muted`,children:g(String(n),r,i)}),(0,m.jsxs)(`div`,{className:`mt-1.5 grid gap-1`,children:[l.map(e=>(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:h[a.findIndex(t=>t.id===e.dataKey)%h.length]}}),c.get(e.dataKey)||e.dataKey]}),(0,m.jsx)(`span`,{className:`mono font-medium`,children:v(e.value,s)})]},e.dataKey)),(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-6 border-t border-separator pt-1`,children:[(0,m.jsx)(`span`,{className:`text-muted`,children:o}),(0,m.jsx)(`span`,{className:`mono font-medium`,children:v(u,s)})]})]})]})}function x({series:n,models:r,lang:o,emptyLabel:u,totalLabel:d,metric:f=`credits`}){let v=(0,p.useMemo)(()=>r.map(e=>e.id),[r]),x=(0,p.useMemo)(()=>n.map(e=>{let t=_(e,f),n={at:e.at};for(let e of v){let r=Number(t[e]??0);n[e]=f===`tokens`?r:Number(r.toFixed(4))}return n}),[n,v,f]),S=Math.max(0,...x.map(e=>v.reduce((t,n)=>t+Number(e[n]??0),0)))>0,C=(x.length>1?Date.parse(x[x.length-1].at)-Date.parse(x[0].at):0)>1728e5;return!n.length||!S?(0,m.jsx)(`div`,{className:`grid min-h-56 place-items-center px-6 py-12 text-center text-sm text-muted`,children:u}):(0,m.jsxs)(`div`,{className:`min-w-0`,children:[(0,m.jsx)(`div`,{className:`h-72 w-full`,children:(0,m.jsx)(a,{width:`100%`,height:`100%`,children:(0,m.jsxs)(l,{data:x,margin:{top:8,right:8,bottom:0,left:0},children:[(0,m.jsx)(`defs`,{children:v.map((e,t)=>(0,m.jsxs)(`linearGradient`,{id:`cost-${f}-${e}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,m.jsx)(`stop`,{offset:`0%`,stopColor:h[t%h.length],stopOpacity:.32}),(0,m.jsx)(`stop`,{offset:`100%`,stopColor:h[t%h.length],stopOpacity:.04})]},e))}),(0,m.jsx)(t,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,m.jsx)(s,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>g(e,C,o)}),(0,m.jsx)(c,{width:52,tickLine:!1,axisLine:!1,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>y(e,f)}),(0,m.jsx)(e,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,m.jsx)(b,{daily:C,lang:o,models:r,totalLabel:d,metric:f})}),v.map((e,t)=>(0,m.jsx)(i,{type:`monotone`,dataKey:e,stackId:`usage`,stroke:h[t%h.length],strokeWidth:1.5,fill:`url(#cost-${f}-${e})`,isAnimationActive:!1,dot:!1,activeDot:{r:3,strokeWidth:1.2}},e))]})})}),(0,m.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-muted`,children:r.map((e,t)=>(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:h[t%h.length]}}),e.label]},e.id))})]})}export{x as CostChart}; \ No newline at end of file +import{n as e,t}from"./CartesianGrid-Cw-8i_Ey.js";import{Tn as n,_n as r,a as i,at as a,gn as o,i as s,r as c,t as l,vn as u,wn as d,xn as f}from"./index-BaFCWWtK.js";var p=n(d(),1),m=f(),h=[`var(--accent)`,`var(--muted)`,`var(--success)`,`var(--warning)`];function g(e,t,n){let r=new Date(e);return Number.isFinite(r.getTime())?new Intl.DateTimeFormat(n===`zh`?`zh-CN`:`en-US`,t?{month:`short`,day:`numeric`}:{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):``}function _(e,t){return t===`credits`?e.per_model_credits??{}:t===`tokens`?e.per_model_tokens??{}:e.per_model??{}}function v(e,t){return t===`cost`?o(e):t===`tokens`?r(e):u(e)}function y(e,t){return t===`cost`?`¥${e>=10?Math.round(e):Number(e.toFixed(1))}`:t===`tokens`?r(e):u(e)}function b({active:e,payload:t,label:n,daily:r,lang:i,models:a,totalLabel:o,metric:s}){if(!e||!t?.length)return null;let c=new Map(a.map(e=>[e.id,e.label])),l=t.filter(e=>(e.value??0)>0).sort((e,t)=>t.value-e.value),u=t.reduce((e,t)=>e+(t.value??0),0);return(0,m.jsxs)(`div`,{className:`rounded-xl bg-overlay px-3 py-2 text-caption text-overlay-foreground shadow-overlay`,children:[(0,m.jsx)(`div`,{className:`mono text-muted`,children:g(String(n),r,i)}),(0,m.jsxs)(`div`,{className:`mt-1.5 grid gap-1`,children:[l.map(e=>(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:h[a.findIndex(t=>t.id===e.dataKey)%h.length]}}),c.get(e.dataKey)||e.dataKey]}),(0,m.jsx)(`span`,{className:`mono font-medium`,children:v(e.value,s)})]},e.dataKey)),(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-6 border-t border-separator pt-1`,children:[(0,m.jsx)(`span`,{className:`text-muted`,children:o}),(0,m.jsx)(`span`,{className:`mono font-medium`,children:v(u,s)})]})]})]})}function x({series:n,models:r,lang:o,emptyLabel:u,totalLabel:d,metric:f=`credits`}){let v=(0,p.useMemo)(()=>r.map(e=>e.id),[r]),x=(0,p.useMemo)(()=>n.map(e=>{let t=_(e,f),n={at:e.at};for(let e of v){let r=Number(t[e]??0);n[e]=f===`tokens`?r:Number(r.toFixed(4))}return n}),[n,v,f]),S=Math.max(0,...x.map(e=>v.reduce((t,n)=>t+Number(e[n]??0),0)))>0,C=(x.length>1?Date.parse(x[x.length-1].at)-Date.parse(x[0].at):0)>1728e5;return!n.length||!S?(0,m.jsx)(`div`,{className:`grid min-h-56 place-items-center px-6 py-12 text-center text-sm text-muted`,children:u}):(0,m.jsxs)(`div`,{className:`min-w-0`,children:[(0,m.jsx)(`div`,{className:`h-72 w-full`,children:(0,m.jsx)(a,{width:`100%`,height:`100%`,children:(0,m.jsxs)(l,{data:x,margin:{top:8,right:8,bottom:0,left:0},children:[(0,m.jsx)(`defs`,{children:v.map((e,t)=>(0,m.jsxs)(`linearGradient`,{id:`cost-${f}-${e}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,m.jsx)(`stop`,{offset:`0%`,stopColor:h[t%h.length],stopOpacity:.32}),(0,m.jsx)(`stop`,{offset:`100%`,stopColor:h[t%h.length],stopOpacity:.04})]},e))}),(0,m.jsx)(t,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,m.jsx)(s,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>g(e,C,o)}),(0,m.jsx)(c,{width:52,tickLine:!1,axisLine:!1,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>y(e,f)}),(0,m.jsx)(e,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,m.jsx)(b,{daily:C,lang:o,models:r,totalLabel:d,metric:f})}),v.map((e,t)=>(0,m.jsx)(i,{type:`monotone`,dataKey:e,stackId:`usage`,stroke:h[t%h.length],strokeWidth:1.5,fill:`url(#cost-${f}-${e})`,isAnimationActive:!1,dot:!1,activeDot:{r:3,strokeWidth:1.2}},e))]})})}),(0,m.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-muted`,children:r.map((e,t)=>(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:h[t%h.length]}}),e.label]},e.id))})]})}export{x as CostChart}; \ No newline at end of file diff --git a/internal/webui/static/assets/LiveSparkline-DXsyY9T8.js b/internal/webui/static/assets/LiveSparkline-D_Jmu8Yl.js similarity index 90% rename from internal/webui/static/assets/LiveSparkline-DXsyY9T8.js rename to internal/webui/static/assets/LiveSparkline-D_Jmu8Yl.js index 42ab59a5..b6ddc162 100644 --- a/internal/webui/static/assets/LiveSparkline-DXsyY9T8.js +++ b/internal/webui/static/assets/LiveSparkline-D_Jmu8Yl.js @@ -1 +1 @@ -import{a as e,at as t,r as n,t as r,xn as i}from"./index-BTLD14uK.js";var a=i();function o({samples:i,capacity:o,label:s}){let c=i.length?i:[{at:0,value:0}],l=Math.max(1,o,...c.map(e=>e.value));return(0,a.jsx)(`div`,{className:`h-6 w-[120px] shrink-0`,role:`img`,"aria-label":s,children:(0,a.jsx)(t,{width:`100%`,height:`100%`,children:(0,a.jsxs)(r,{data:c,margin:{top:1,right:0,bottom:1,left:0},children:[(0,a.jsx)(n,{hide:!0,domain:[0,l]}),(0,a.jsx)(e,{type:`monotone`,dataKey:`value`,stroke:`var(--foreground)`,strokeOpacity:.7,strokeWidth:1.25,fill:`var(--foreground)`,fillOpacity:.08,isAnimationActive:!1,dot:!1})]})})})}export{o as LiveSparkline}; \ No newline at end of file +import{a as e,at as t,r as n,t as r,xn as i}from"./index-BaFCWWtK.js";var a=i();function o({samples:i,capacity:o,label:s}){let c=i.length?i:[{at:0,value:0}],l=Math.max(1,o,...c.map(e=>e.value));return(0,a.jsx)(`div`,{className:`h-6 w-[120px] shrink-0`,role:`img`,"aria-label":s,children:(0,a.jsx)(t,{width:`100%`,height:`100%`,children:(0,a.jsxs)(r,{data:c,margin:{top:1,right:0,bottom:1,left:0},children:[(0,a.jsx)(n,{hide:!0,domain:[0,l]}),(0,a.jsx)(e,{type:`monotone`,dataKey:`value`,stroke:`var(--foreground)`,strokeOpacity:.7,strokeWidth:1.25,fill:`var(--foreground)`,fillOpacity:.08,isAnimationActive:!1,dot:!1})]})})})}export{o as LiveSparkline}; \ No newline at end of file diff --git a/internal/webui/static/assets/TrafficChart-BMjlJkKA.js b/internal/webui/static/assets/TrafficChart-oYRXFvFw.js similarity index 99% rename from internal/webui/static/assets/TrafficChart-BMjlJkKA.js rename to internal/webui/static/assets/TrafficChart-oYRXFvFw.js index 689081c3..d6102baa 100644 --- a/internal/webui/static/assets/TrafficChart-BMjlJkKA.js +++ b/internal/webui/static/assets/TrafficChart-oYRXFvFw.js @@ -1 +1 @@ -import{n as e,t}from"./CartesianGrid-1HegCBTm.js";import{$ as n,$t as r,B as i,C as a,D as o,G as s,Q as c,Qt as l,S as u,Sn as d,T as f,Tn as p,U as m,V as h,W as g,Y as _,Yt as v,_ as y,_n as b,_t as x,a as S,at as C,b as w,bn as T,c as E,ct as D,d as ee,dn as O,f as k,fn as A,ft as j,g as M,h as te,hn as ne,i as re,in as N,k as P,lt as F,m as I,mn as ie,mt as L,n as ae,o as oe,p as se,pt as R,r as ce,rn as le,s as ue,st as z,tt as de,un as fe,v as pe,w as me,wn as he,x as ge,xn as _e,y as ve,yn as B,yt as ye}from"./index-BTLD14uK.js";var V=p(he()),be=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`visibleLength`,`strokeDasharray`,`connectNulls`];function H(){return H=Object.assign?Object.assign.bind():function(e){for(var t=1;te+t,0);if(!i)return U(t,e);for(var a=Math.floor(e/i),o=e%i,s=[],c=0,l=0;co){s=[...r.slice(0,c),o-l];break}}var f=s.length%2==0?[0,t]:[t];return[...Te(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function De(e,t,n){return e?Ee(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):U(t,n)}function Oe(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=xe(e,be),a=r??!1,o;if(t!=null){var s=i.pathRef;o=De(n,Ce(s?.current??null),t)}else n!=null&&(o=String(n));return V.createElement(_,H({},i,{connectNulls:a,strokeDasharray:o}))}function ke(e){var t=(0,V.useRef)(0),n=(0,V.useRef)(0),r=(0,V.useRef)(!1),i=(0,V.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,V.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(N(t.current+e*i),i);return e>0&&i>0&&(n.current=Math.max(n.current,a),a>=i)?(r.current=!0,null):a},[])}var Ae=[`children`];function je(e,t){if(e==null)return{};var n,r,i=Me(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function Pe(e){var t=e.children,n=je(e,Ae);return V.createElement(Ne.Provider,{value:n},t)}var W=(e,t,n,r)=>i(e,`xAxis`,t,r),G=(e,t,n,r)=>h(e,`xAxis`,t,r),K=(e,t,n,r)=>i(e,`yAxis`,n,r),q=(e,t,n,r)=>h(e,`yAxis`,n,r),Fe=x([n,W,K,G,q],(e,t,n,r,i)=>L(e,`xAxis`)?D(t,r,!1):D(n,i,!1)),Ie=(e,t,n,r,i)=>i;function Le(e){return e.type===`line`}var Re=x([m,Ie],(e,t)=>e.filter(Le).find(e=>e.id===t)),ze=x([n,W,K,G,q,Re,Fe,s],(e,t,n,r,i,a,o,s)=>{var c=s.chartData,l=s.dataStartIndex,u=s.dataEndIndex;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var d=a.dataKey,f=a.data,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return at({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}}),Be=[`id`],Ve=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],He=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?t/n:0}var Q={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationInterpolateFn:(e,t)=>{if(e==null)return[];if(t===1)return e.flatMap(e=>e.status===`removed`?[]:[e.next]);var n=Je(e),r=[];for(var i of e)if(i.status===`matched`)r.push(Z(Z({},i.next),{},{x:l(i.prev.x,i.next.x,t),y:l(i.prev.y,i.next.y,t)}));else if(i.status===`added`){if(i.next.x!=null){var a=i.next.x-n;r.push(Z(Z({},i.next),{},{x:l(a,i.next.x,t),y:i.next.y}))}else r.push(i.next)}else if(i.status===`removed`&&i.prev.x!=null){var o=i.prev.x+n;r.push(Z(Z({},i.prev),{},{x:l(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:ve,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:Oe,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:g.line,type:`linear`},Ye=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.legendType;return[{inactive:e.hide,dataKey:t,type:i,color:r,value:j(n,t),payload:e}]},Xe=V.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,f={dataDefinedOnItem:n,getPosition:le,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:j(o,t),hide:s,type:u,color:r,unit:c,formatter:l,graphicalItemId:d}};return V.createElement(ge,{tooltipEntrySettings:f})});function Ze(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.dot,a=r.dataKey,o=r.needClip;r.id;var s=Y(r,Be),c=A(s);return V.createElement(I,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function Qe(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,V.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Z(Z({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return V.createElement(me,{value:t?i:void 0},n)}function $e(e){var t=e.clipPathId,n=e.pathRef,r=e.points,i=e.props,a=e.animationElapsedTime,o=e.isAnimating,s=e.isEntrance,c=e.visibleLength,l=i.type,d=i.layout,f=i.connectNulls,p=i.needClip,m=i.shape,h=i.strokeDasharray,g=Y(i,Ve),_=Z(Z({},O(g)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:p?`url(#clipPath-${t})`:void 0,points:r,type:l,layout:d,connectNulls:f,strokeDasharray:h??i.strokeDasharray,pathRef:n,animationElapsedTime:a,isAnimating:o,isEntrance:i.animateNewValues?s:!1,visibleLength:c});return V.createElement(V.Fragment,null,r?.length>1&&V.createElement(u,{option:m,DefaultShape:Q.shape,shapeProps:_}),V.createElement(Ze,{points:r,clipPathId:t,props:i}))}function et(e){var t=e.clipPathId,n=e.props,r=e.pathRef,i=e.previousPointsRef,a=n.points,o=n.isAnimationActive,s=n.animationBegin,c=n.animationDuration,l=n.animationEasing,u=n.animationMatchBy,d=n.animationInterpolateFn,p=n.layout,m=qe(r.current),h=pe(n.onAnimationStart,n.onAnimationEnd),g=h.isAnimating,_=h.handleAnimationStart,v=h.handleAnimationEnd,b=!g,x=ke(a),S=(0,V.useCallback)(e=>e>0&&m>0,[m]);return V.createElement(Qe,{points:a,showLabels:b},n.children,V.createElement(y,{animationInput:a,animationIdPrefix:`recharts-line-`,items:a,previousItemsRef:i,isAnimationActive:o,animationBegin:s,animationDuration:c,animationEasing:l,onAnimationStart:_,onAnimationEnd:v,animationInterpolateFn:d,animationMatchBy:u,shouldUpdatePreviousRef:S,layout:p},(e,i,a)=>{var o=g||i<1,s=o?x(i,m):null;return V.createElement($e,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),V.createElement(f,{label:n.label}))}function tt(e){var t=e.clipPathId,n=e.props,r=(0,V.useRef)(null),i=(0,V.useRef)(null);return V.createElement(et,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var nt=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:R(e.payload,t)}),rt=class extends V.Component{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,o=e.xAxisId,s=e.yAxisId,c=e.top,l=e.left,u=e.width,f=e.height,p=e.id,m=e.needClip,h=e.zIndex;if(t)return null;var g=d(`recharts-line`,i),_=p,v=oe(n),y=v.r,b=v.strokeWidth,x=a(n),S=y*2+b,C=m?`url(#clipPath-${x?``:`dots-`}${_})`:void 0;return V.createElement(P,{zIndex:h},V.createElement(fe,{className:g},m&&V.createElement(`defs`,null,V.createElement(ue,{clipPathId:_,xAxisId:o,yAxisId:s}),!x&&V.createElement(`clipPath`,{id:`clipPath-dots-${_}`},V.createElement(`rect`,{x:l-S/2,y:c-S/2,width:u+S,height:f+S}))),V.createElement(Pe,{xAxisId:o,yAxisId:s,data:r,dataPointFormatter:nt,errorBarOffset:0},V.createElement(tt,{props:this.props,clipPathId:_}))),V.createElement(k,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:C}))}};function it(e){var t=v(e,Q),n=t.activeDot,r=t.animateNewValues,i=t.animationBegin,a=t.animationDuration,o=t.animationEasing,s=t.connectNulls,c=t.dot,l=t.hide,u=t.isAnimationActive,d=t.label,f=t.legendType,p=t.xAxisId,m=t.yAxisId,h=t.id,g=Y(t,He),_=E(p,m).needClip,y=se(),b=de(),x=z(),S=ye(e=>ze(e,p,m,x,h));if(b!==`horizontal`&&b!==`vertical`||S==null||y==null)return null;var C=y.height,w=y.width,T=y.x,D=y.y;return V.createElement(rt,J({},g,{id:h,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:S,layout:b,height:C,width:w,left:T,top:D,needClip:_}))}function at(e){var t=e.layout,n=e.xAxis,i=e.yAxis,a=e.xAxisTicks,o=e.yAxisTicks,s=e.dataKey,c=e.bandSize;return e.displayedData.map((e,l)=>{var u=R(e,s);if(t===`horizontal`)return{x:F({axis:n,ticks:a,bandSize:c,entry:e,index:l}),y:(r(u)?null:i.scale.map(u))??null,value:u,payload:e};var d=r(u)?null:n.scale.map(u),f=F({axis:i,ticks:o,bandSize:c,entry:e,index:l});return d==null||f==null?null:{x:d,y:f,value:u,payload:e}}).filter(Boolean)}function ot(e){var t=v(e,Q),n=z();return V.createElement(M,{id:t.id,type:`line`},e=>V.createElement(V.Fragment,null,V.createElement(w,{legendPayload:Ye(t)}),V.createElement(Xe,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),V.createElement(te,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),V.createElement(it,J({},t,{id:e}))))}var st=V.memo(ot,c);st.displayName=`Line`;var ct=[`axis`],lt=(0,V.forwardRef)((e,t)=>V.createElement(ae,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:ct,tooltipPayloadSearcher:o,categoricalChartProps:e,ref:t})),ut={metric:24,title:18,section:15,body:13,xs:12,caption:12},$=_e();function dt(e,t,n){let r=new Date(e);return Number.isFinite(r.getTime())?new Intl.DateTimeFormat(n===`zh`?`zh-CN`:`en-US`,t?{month:`short`,day:`numeric`}:{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):``}function ft(e){if(e<=1)return 1;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}function pt(e){let t=Math.max(0,e.ok??e.requests-e.error),n=Math.min(Math.max(0,e.requests-t),Math.max(0,e.requests));return{...e,okCount:t,errorCount:n,inputTokens:e.prompt_tokens??0,outputTokens:e.completion_tokens??0,cacheTokens:e.cache_read_tokens??0,p50:e.latency_p50_ms??null,p95:e.latency_p95_ms??null}}function mt({active:e,payload:t,daily:n,lang:r,specs:i,format:a,totalLabel:o,total:s}){if(!e||!t?.[0])return null;let c=t[0].payload;return(0,$.jsxs)(`div`,{className:`rounded-xl bg-overlay px-3 py-2 text-caption text-overlay-foreground shadow-overlay`,children:[(0,$.jsx)(`div`,{className:`mono text-muted`,children:dt(c.at,n,r)}),(0,$.jsxs)(`div`,{className:`mt-1.5 grid gap-1`,children:[i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:e.color}}),e.label]}),(0,$.jsx)(`span`,{className:`mono font-medium`,children:a(c[e.key])})]},String(e.key))),s&&o?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6 pt-1`,children:[(0,$.jsx)(`span`,{className:`text-muted`,children:o}),(0,$.jsx)(`span`,{className:`mono font-medium`,children:a(s(c))})]}):null]})]})}function ht({series:n,lang:r,emptyLabel:i,okLabel:a,errorLabel:o,onSelectRange:s,selectHint:c,labels:l,initialMetric:u=`requests`}){let[d,f]=(0,V.useState)(u),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),_=(0,V.useRef)(!1),v=(0,V.useRef)(null),y=(0,V.useMemo)(()=>n.map(pt),[n]),x=y[0],w=y[y.length-1],E=(x&&w?Date.parse(w.at)-Date.parse(x.at):0)>1728e5,D=l??{requests:`Requests`,tokens:`Tokens`,latency:`p95 latency`,input:`input`,output:`output`,cacheRead:`cache read`,p50:`p50`,p95:`p95`,total:`total`},O=d===`tokens`?[{key:`inputTokens`,label:D.input,color:`var(--foreground)`,area:!0,width:1.5,opacity:.75},{key:`outputTokens`,label:D.output,color:`var(--success)`,area:!0,width:1.5},{key:`cacheTokens`,label:D.cacheRead,color:`var(--muted)`,width:1.25,opacity:.8}]:d===`latency`?[{key:`p95`,label:D.p95,color:`var(--warning)`,area:!0,width:1.75},{key:`p50`,label:D.p50,color:`var(--muted)`,width:1.25,opacity:.85}]:[{key:`okCount`,label:a,color:`var(--success)`,area:!0,width:1.75},{key:`errorCount`,label:o,color:`var(--danger)`,area:!0,width:1.25,opacity:.7}],k=e=>e==null?`—`:d===`latency`?B(e):b(e),A=d===`requests`?e=>e.requests:d===`tokens`?e=>e.inputTokens+e.outputTokens:void 0,j=y.flatMap(e=>O.map(t=>Number(e[t.key]??0))),M=d===`requests`?Math.max(0,...y.map(e=>e.requests)):Math.max(0,...j),te=ft(M),N=y.some(e=>e.requests>0),P=y.map(e=>`${e.at}:${e.requests}:${e.error}`).join(`|`);(0,V.useLayoutEffect)(()=>{let e=v.current;if(!e||!N||_.current)return;let t=!1,n=null,r=T.context(()=>{let r=T.matchMedia(),i=()=>{let t=T.utils.toArray(`.recharts-area-area`,e),n=T.utils.toArray(`.recharts-line-curve`,e);return!t.length&&!n.length?!1:(r.add(`(prefers-reduced-motion: reduce)`,()=>{T.set(n,{clearProps:`strokeDashoffset,strokeDasharray`}),T.set(t,{clearProps:`autoAlpha`})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{T.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:.45,ease:`power2.out`,stagger:.05}),n.forEach((e,t)=>{let n=e.getTotalLength();T.fromTo(e,{strokeDasharray:n,strokeDashoffset:n},{strokeDashoffset:0,duration:.7,delay:t*.05,ease:`power2.out`})})}),!0)};if(i()){t=!0,_.current=!0;return}n=new MutationObserver(()=>{t||i()&&(t=!0,_.current=!0,n?.disconnect())}),n.observe(e,{childList:!0,subtree:!0})},e);return()=>{n?.disconnect(),r.revert()}},[N,P]);let F=y.length>1?Date.parse(y[1].at)-Date.parse(y[0].at):36e5,I=()=>{if(p&&h&&s){let e=Date.parse(p),t=Date.parse(h);if(Number.isFinite(e)&&Number.isFinite(t)){let n=Math.min(e,t),r=Math.max(e,t)+F;s(new Date(n).toISOString(),new Date(r).toISOString())}}m(null),g(null)},L=e=>{let t=e?.activeLabel;return t==null?null:String(t)};return!n.length||!N?(0,$.jsx)(ne,{emptyLabel:i}):(0,$.jsxs)(`div`,{ref:v,className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex justify-end`,children:(0,$.jsx)(ie,{value:d,onChange:e=>f(e),ariaLabel:D.requests,options:[{id:`requests`,label:D.requests},{id:`tokens`,label:D.tokens},{id:`latency`,label:D.latency}]})}),(0,$.jsx)(`div`,{className:`h-56 w-full`,children:(0,$.jsx)(C,{width:`100%`,height:`100%`,children:(0,$.jsxs)(lt,{data:y,margin:{top:8,right:8,bottom:0,left:0},style:s?{cursor:`crosshair`,userSelect:`none`}:void 0,onMouseDown:s?e=>{let t=L(e);t&&(m(t),g(t))}:void 0,onMouseMove:s?e=>{if(!p)return;let t=L(e);t&&g(t)}:void 0,onMouseUp:s?I:void 0,onMouseLeave:s?()=>{m(null),g(null)}:void 0,children:[(0,$.jsx)(`defs`,{children:O.filter(e=>e.area).map(e=>(0,$.jsxs)(`linearGradient`,{id:`traffic-fill-${String(e.key)}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,$.jsx)(`stop`,{offset:`0%`,stopColor:e.color,stopOpacity:.22}),(0,$.jsx)(`stop`,{offset:`100%`,stopColor:e.color,stopOpacity:.02})]},String(e.key)))}),(0,$.jsx)(t,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,$.jsx)(re,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:ut.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>dt(e,E,r)}),(0,$.jsx)(ce,{width:d===`latency`?44:36,domain:[0,te],tickLine:!1,axisLine:!1,allowDecimals:!1,tick:{fill:`var(--muted)`,fontSize:ut.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>d===`latency`?B(e):b(e)}),(0,$.jsx)(e,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,$.jsx)(mt,{daily:E,lang:r,specs:O,format:k,totalLabel:D.total,total:A})}),O.filter(e=>e.area).map(e=>(0,$.jsx)(S,{type:`monotone`,dataKey:e.key,stroke:`none`,fill:`url(#traffic-fill-${String(e.key)})`,isAnimationActive:!1,activeDot:!1,dot:!1,connectNulls:!0},`area-${String(e.key)}`)),O.map(e=>(0,$.jsx)(st,{type:`monotone`,dataKey:e.key,stroke:e.color,strokeWidth:e.width??1.5,strokeOpacity:e.opacity??1,dot:!1,isAnimationActive:!1,connectNulls:!0,activeDot:{r:4,fill:`var(--surface)`,stroke:e.color,strokeWidth:1.5}},`line-${String(e.key)}`)),p&&h?(0,$.jsx)(ee,{x1:p,x2:h,fill:`var(--foreground)`,fillOpacity:.06,stroke:`none`,ifOverflow:`visible`}):null]})})}),(0,$.jsxs)(`div`,{className:`mt-2 flex min-h-5 items-center justify-between gap-3 text-caption text-muted`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-3`,children:O.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:e.color}}),e.label]},String(e.key)))}),(0,$.jsxs)(`span`,{className:`flex items-center gap-3`,children:[s&&c?(0,$.jsx)(`span`,{children:c}):null,(0,$.jsxs)(`span`,{className:`mono`,children:[k(M),` peak`]})]})]})]})}export{ht as TrafficChart}; \ No newline at end of file +import{n as e,t}from"./CartesianGrid-Cw-8i_Ey.js";import{$ as n,$t as r,B as i,C as a,D as o,G as s,Q as c,Qt as l,S as u,Sn as d,T as f,Tn as p,U as m,V as h,W as g,Y as _,Yt as v,_ as y,_n as b,_t as x,a as S,at as C,b as w,bn as T,c as E,ct as D,d as ee,dn as O,f as k,fn as A,ft as j,g as M,h as te,hn as ne,i as re,in as N,k as P,lt as F,m as I,mn as ie,mt as L,n as ae,o as oe,p as se,pt as R,r as ce,rn as le,s as ue,st as z,tt as de,un as fe,v as pe,w as me,wn as he,x as ge,xn as _e,y as ve,yn as B,yt as ye}from"./index-BaFCWWtK.js";var V=p(he()),be=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`visibleLength`,`strokeDasharray`,`connectNulls`];function H(){return H=Object.assign?Object.assign.bind():function(e){for(var t=1;te+t,0);if(!i)return U(t,e);for(var a=Math.floor(e/i),o=e%i,s=[],c=0,l=0;co){s=[...r.slice(0,c),o-l];break}}var f=s.length%2==0?[0,t]:[t];return[...Te(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function De(e,t,n){return e?Ee(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):U(t,n)}function Oe(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=xe(e,be),a=r??!1,o;if(t!=null){var s=i.pathRef;o=De(n,Ce(s?.current??null),t)}else n!=null&&(o=String(n));return V.createElement(_,H({},i,{connectNulls:a,strokeDasharray:o}))}function ke(e){var t=(0,V.useRef)(0),n=(0,V.useRef)(0),r=(0,V.useRef)(!1),i=(0,V.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,V.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(N(t.current+e*i),i);return e>0&&i>0&&(n.current=Math.max(n.current,a),a>=i)?(r.current=!0,null):a},[])}var Ae=[`children`];function je(e,t){if(e==null)return{};var n,r,i=Me(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function Pe(e){var t=e.children,n=je(e,Ae);return V.createElement(Ne.Provider,{value:n},t)}var W=(e,t,n,r)=>i(e,`xAxis`,t,r),G=(e,t,n,r)=>h(e,`xAxis`,t,r),K=(e,t,n,r)=>i(e,`yAxis`,n,r),q=(e,t,n,r)=>h(e,`yAxis`,n,r),Fe=x([n,W,K,G,q],(e,t,n,r,i)=>L(e,`xAxis`)?D(t,r,!1):D(n,i,!1)),Ie=(e,t,n,r,i)=>i;function Le(e){return e.type===`line`}var Re=x([m,Ie],(e,t)=>e.filter(Le).find(e=>e.id===t)),ze=x([n,W,K,G,q,Re,Fe,s],(e,t,n,r,i,a,o,s)=>{var c=s.chartData,l=s.dataStartIndex,u=s.dataEndIndex;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var d=a.dataKey,f=a.data,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return at({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}}),Be=[`id`],Ve=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],He=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?t/n:0}var Q={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationInterpolateFn:(e,t)=>{if(e==null)return[];if(t===1)return e.flatMap(e=>e.status===`removed`?[]:[e.next]);var n=Je(e),r=[];for(var i of e)if(i.status===`matched`)r.push(Z(Z({},i.next),{},{x:l(i.prev.x,i.next.x,t),y:l(i.prev.y,i.next.y,t)}));else if(i.status===`added`){if(i.next.x!=null){var a=i.next.x-n;r.push(Z(Z({},i.next),{},{x:l(a,i.next.x,t),y:i.next.y}))}else r.push(i.next)}else if(i.status===`removed`&&i.prev.x!=null){var o=i.prev.x+n;r.push(Z(Z({},i.prev),{},{x:l(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:ve,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:Oe,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:g.line,type:`linear`},Ye=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.legendType;return[{inactive:e.hide,dataKey:t,type:i,color:r,value:j(n,t),payload:e}]},Xe=V.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,f={dataDefinedOnItem:n,getPosition:le,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:j(o,t),hide:s,type:u,color:r,unit:c,formatter:l,graphicalItemId:d}};return V.createElement(ge,{tooltipEntrySettings:f})});function Ze(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.dot,a=r.dataKey,o=r.needClip;r.id;var s=Y(r,Be),c=A(s);return V.createElement(I,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function Qe(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,V.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Z(Z({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return V.createElement(me,{value:t?i:void 0},n)}function $e(e){var t=e.clipPathId,n=e.pathRef,r=e.points,i=e.props,a=e.animationElapsedTime,o=e.isAnimating,s=e.isEntrance,c=e.visibleLength,l=i.type,d=i.layout,f=i.connectNulls,p=i.needClip,m=i.shape,h=i.strokeDasharray,g=Y(i,Ve),_=Z(Z({},O(g)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:p?`url(#clipPath-${t})`:void 0,points:r,type:l,layout:d,connectNulls:f,strokeDasharray:h??i.strokeDasharray,pathRef:n,animationElapsedTime:a,isAnimating:o,isEntrance:i.animateNewValues?s:!1,visibleLength:c});return V.createElement(V.Fragment,null,r?.length>1&&V.createElement(u,{option:m,DefaultShape:Q.shape,shapeProps:_}),V.createElement(Ze,{points:r,clipPathId:t,props:i}))}function et(e){var t=e.clipPathId,n=e.props,r=e.pathRef,i=e.previousPointsRef,a=n.points,o=n.isAnimationActive,s=n.animationBegin,c=n.animationDuration,l=n.animationEasing,u=n.animationMatchBy,d=n.animationInterpolateFn,p=n.layout,m=qe(r.current),h=pe(n.onAnimationStart,n.onAnimationEnd),g=h.isAnimating,_=h.handleAnimationStart,v=h.handleAnimationEnd,b=!g,x=ke(a),S=(0,V.useCallback)(e=>e>0&&m>0,[m]);return V.createElement(Qe,{points:a,showLabels:b},n.children,V.createElement(y,{animationInput:a,animationIdPrefix:`recharts-line-`,items:a,previousItemsRef:i,isAnimationActive:o,animationBegin:s,animationDuration:c,animationEasing:l,onAnimationStart:_,onAnimationEnd:v,animationInterpolateFn:d,animationMatchBy:u,shouldUpdatePreviousRef:S,layout:p},(e,i,a)=>{var o=g||i<1,s=o?x(i,m):null;return V.createElement($e,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),V.createElement(f,{label:n.label}))}function tt(e){var t=e.clipPathId,n=e.props,r=(0,V.useRef)(null),i=(0,V.useRef)(null);return V.createElement(et,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var nt=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:R(e.payload,t)}),rt=class extends V.Component{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,o=e.xAxisId,s=e.yAxisId,c=e.top,l=e.left,u=e.width,f=e.height,p=e.id,m=e.needClip,h=e.zIndex;if(t)return null;var g=d(`recharts-line`,i),_=p,v=oe(n),y=v.r,b=v.strokeWidth,x=a(n),S=y*2+b,C=m?`url(#clipPath-${x?``:`dots-`}${_})`:void 0;return V.createElement(P,{zIndex:h},V.createElement(fe,{className:g},m&&V.createElement(`defs`,null,V.createElement(ue,{clipPathId:_,xAxisId:o,yAxisId:s}),!x&&V.createElement(`clipPath`,{id:`clipPath-dots-${_}`},V.createElement(`rect`,{x:l-S/2,y:c-S/2,width:u+S,height:f+S}))),V.createElement(Pe,{xAxisId:o,yAxisId:s,data:r,dataPointFormatter:nt,errorBarOffset:0},V.createElement(tt,{props:this.props,clipPathId:_}))),V.createElement(k,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:C}))}};function it(e){var t=v(e,Q),n=t.activeDot,r=t.animateNewValues,i=t.animationBegin,a=t.animationDuration,o=t.animationEasing,s=t.connectNulls,c=t.dot,l=t.hide,u=t.isAnimationActive,d=t.label,f=t.legendType,p=t.xAxisId,m=t.yAxisId,h=t.id,g=Y(t,He),_=E(p,m).needClip,y=se(),b=de(),x=z(),S=ye(e=>ze(e,p,m,x,h));if(b!==`horizontal`&&b!==`vertical`||S==null||y==null)return null;var C=y.height,w=y.width,T=y.x,D=y.y;return V.createElement(rt,J({},g,{id:h,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:S,layout:b,height:C,width:w,left:T,top:D,needClip:_}))}function at(e){var t=e.layout,n=e.xAxis,i=e.yAxis,a=e.xAxisTicks,o=e.yAxisTicks,s=e.dataKey,c=e.bandSize;return e.displayedData.map((e,l)=>{var u=R(e,s);if(t===`horizontal`)return{x:F({axis:n,ticks:a,bandSize:c,entry:e,index:l}),y:(r(u)?null:i.scale.map(u))??null,value:u,payload:e};var d=r(u)?null:n.scale.map(u),f=F({axis:i,ticks:o,bandSize:c,entry:e,index:l});return d==null||f==null?null:{x:d,y:f,value:u,payload:e}}).filter(Boolean)}function ot(e){var t=v(e,Q),n=z();return V.createElement(M,{id:t.id,type:`line`},e=>V.createElement(V.Fragment,null,V.createElement(w,{legendPayload:Ye(t)}),V.createElement(Xe,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),V.createElement(te,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),V.createElement(it,J({},t,{id:e}))))}var st=V.memo(ot,c);st.displayName=`Line`;var ct=[`axis`],lt=(0,V.forwardRef)((e,t)=>V.createElement(ae,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:ct,tooltipPayloadSearcher:o,categoricalChartProps:e,ref:t})),ut={metric:24,title:18,section:15,body:13,xs:12,caption:12},$=_e();function dt(e,t,n){let r=new Date(e);return Number.isFinite(r.getTime())?new Intl.DateTimeFormat(n===`zh`?`zh-CN`:`en-US`,t?{month:`short`,day:`numeric`}:{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):``}function ft(e){if(e<=1)return 1;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}function pt(e){let t=Math.max(0,e.ok??e.requests-e.error),n=Math.min(Math.max(0,e.requests-t),Math.max(0,e.requests));return{...e,okCount:t,errorCount:n,inputTokens:e.prompt_tokens??0,outputTokens:e.completion_tokens??0,cacheTokens:e.cache_read_tokens??0,p50:e.latency_p50_ms??null,p95:e.latency_p95_ms??null}}function mt({active:e,payload:t,daily:n,lang:r,specs:i,format:a,totalLabel:o,total:s}){if(!e||!t?.[0])return null;let c=t[0].payload;return(0,$.jsxs)(`div`,{className:`rounded-xl bg-overlay px-3 py-2 text-caption text-overlay-foreground shadow-overlay`,children:[(0,$.jsx)(`div`,{className:`mono text-muted`,children:dt(c.at,n,r)}),(0,$.jsxs)(`div`,{className:`mt-1.5 grid gap-1`,children:[i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:e.color}}),e.label]}),(0,$.jsx)(`span`,{className:`mono font-medium`,children:a(c[e.key])})]},String(e.key))),s&&o?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6 pt-1`,children:[(0,$.jsx)(`span`,{className:`text-muted`,children:o}),(0,$.jsx)(`span`,{className:`mono font-medium`,children:a(s(c))})]}):null]})]})}function ht({series:n,lang:r,emptyLabel:i,okLabel:a,errorLabel:o,onSelectRange:s,selectHint:c,labels:l,initialMetric:u=`requests`}){let[d,f]=(0,V.useState)(u),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),_=(0,V.useRef)(!1),v=(0,V.useRef)(null),y=(0,V.useMemo)(()=>n.map(pt),[n]),x=y[0],w=y[y.length-1],E=(x&&w?Date.parse(w.at)-Date.parse(x.at):0)>1728e5,D=l??{requests:`Requests`,tokens:`Tokens`,latency:`p95 latency`,input:`input`,output:`output`,cacheRead:`cache read`,p50:`p50`,p95:`p95`,total:`total`},O=d===`tokens`?[{key:`inputTokens`,label:D.input,color:`var(--foreground)`,area:!0,width:1.5,opacity:.75},{key:`outputTokens`,label:D.output,color:`var(--success)`,area:!0,width:1.5},{key:`cacheTokens`,label:D.cacheRead,color:`var(--muted)`,width:1.25,opacity:.8}]:d===`latency`?[{key:`p95`,label:D.p95,color:`var(--warning)`,area:!0,width:1.75},{key:`p50`,label:D.p50,color:`var(--muted)`,width:1.25,opacity:.85}]:[{key:`okCount`,label:a,color:`var(--success)`,area:!0,width:1.75},{key:`errorCount`,label:o,color:`var(--danger)`,area:!0,width:1.25,opacity:.7}],k=e=>e==null?`—`:d===`latency`?B(e):b(e),A=d===`requests`?e=>e.requests:d===`tokens`?e=>e.inputTokens+e.outputTokens:void 0,j=y.flatMap(e=>O.map(t=>Number(e[t.key]??0))),M=d===`requests`?Math.max(0,...y.map(e=>e.requests)):Math.max(0,...j),te=ft(M),N=y.some(e=>e.requests>0),P=y.map(e=>`${e.at}:${e.requests}:${e.error}`).join(`|`);(0,V.useLayoutEffect)(()=>{let e=v.current;if(!e||!N||_.current)return;let t=!1,n=null,r=T.context(()=>{let r=T.matchMedia(),i=()=>{let t=T.utils.toArray(`.recharts-area-area`,e),n=T.utils.toArray(`.recharts-line-curve`,e);return!t.length&&!n.length?!1:(r.add(`(prefers-reduced-motion: reduce)`,()=>{T.set(n,{clearProps:`strokeDashoffset,strokeDasharray`}),T.set(t,{clearProps:`autoAlpha`})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{T.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:.45,ease:`power2.out`,stagger:.05}),n.forEach((e,t)=>{let n=e.getTotalLength();T.fromTo(e,{strokeDasharray:n,strokeDashoffset:n},{strokeDashoffset:0,duration:.7,delay:t*.05,ease:`power2.out`})})}),!0)};if(i()){t=!0,_.current=!0;return}n=new MutationObserver(()=>{t||i()&&(t=!0,_.current=!0,n?.disconnect())}),n.observe(e,{childList:!0,subtree:!0})},e);return()=>{n?.disconnect(),r.revert()}},[N,P]);let F=y.length>1?Date.parse(y[1].at)-Date.parse(y[0].at):36e5,I=()=>{if(p&&h&&s){let e=Date.parse(p),t=Date.parse(h);if(Number.isFinite(e)&&Number.isFinite(t)){let n=Math.min(e,t),r=Math.max(e,t)+F;s(new Date(n).toISOString(),new Date(r).toISOString())}}m(null),g(null)},L=e=>{let t=e?.activeLabel;return t==null?null:String(t)};return!n.length||!N?(0,$.jsx)(ne,{emptyLabel:i}):(0,$.jsxs)(`div`,{ref:v,className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex justify-end`,children:(0,$.jsx)(ie,{value:d,onChange:e=>f(e),ariaLabel:D.requests,options:[{id:`requests`,label:D.requests},{id:`tokens`,label:D.tokens},{id:`latency`,label:D.latency}]})}),(0,$.jsx)(`div`,{className:`h-56 w-full`,children:(0,$.jsx)(C,{width:`100%`,height:`100%`,children:(0,$.jsxs)(lt,{data:y,margin:{top:8,right:8,bottom:0,left:0},style:s?{cursor:`crosshair`,userSelect:`none`}:void 0,onMouseDown:s?e=>{let t=L(e);t&&(m(t),g(t))}:void 0,onMouseMove:s?e=>{if(!p)return;let t=L(e);t&&g(t)}:void 0,onMouseUp:s?I:void 0,onMouseLeave:s?()=>{m(null),g(null)}:void 0,children:[(0,$.jsx)(`defs`,{children:O.filter(e=>e.area).map(e=>(0,$.jsxs)(`linearGradient`,{id:`traffic-fill-${String(e.key)}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,$.jsx)(`stop`,{offset:`0%`,stopColor:e.color,stopOpacity:.22}),(0,$.jsx)(`stop`,{offset:`100%`,stopColor:e.color,stopOpacity:.02})]},String(e.key)))}),(0,$.jsx)(t,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,$.jsx)(re,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:ut.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>dt(e,E,r)}),(0,$.jsx)(ce,{width:d===`latency`?44:36,domain:[0,te],tickLine:!1,axisLine:!1,allowDecimals:!1,tick:{fill:`var(--muted)`,fontSize:ut.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>d===`latency`?B(e):b(e)}),(0,$.jsx)(e,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,$.jsx)(mt,{daily:E,lang:r,specs:O,format:k,totalLabel:D.total,total:A})}),O.filter(e=>e.area).map(e=>(0,$.jsx)(S,{type:`monotone`,dataKey:e.key,stroke:`none`,fill:`url(#traffic-fill-${String(e.key)})`,isAnimationActive:!1,activeDot:!1,dot:!1,connectNulls:!0},`area-${String(e.key)}`)),O.map(e=>(0,$.jsx)(st,{type:`monotone`,dataKey:e.key,stroke:e.color,strokeWidth:e.width??1.5,strokeOpacity:e.opacity??1,dot:!1,isAnimationActive:!1,connectNulls:!0,activeDot:{r:4,fill:`var(--surface)`,stroke:e.color,strokeWidth:1.5}},`line-${String(e.key)}`)),p&&h?(0,$.jsx)(ee,{x1:p,x2:h,fill:`var(--foreground)`,fillOpacity:.06,stroke:`none`,ifOverflow:`visible`}):null]})})}),(0,$.jsxs)(`div`,{className:`mt-2 flex min-h-5 items-center justify-between gap-3 text-caption text-muted`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-3`,children:O.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:e.color}}),e.label]},String(e.key)))}),(0,$.jsxs)(`span`,{className:`flex items-center gap-3`,children:[s&&c?(0,$.jsx)(`span`,{children:c}):null,(0,$.jsxs)(`span`,{className:`mono`,children:[k(M),` peak`]})]})]})]})}export{ht as TrafficChart}; \ No newline at end of file diff --git a/internal/webui/static/assets/index-BTLD14uK.js b/internal/webui/static/assets/index-BaFCWWtK.js similarity index 96% rename from internal/webui/static/assets/index-BTLD14uK.js rename to internal/webui/static/assets/index-BaFCWWtK.js index 5d0cde8e..691bc4ae 100644 --- a/internal/webui/static/assets/index-BTLD14uK.js +++ b/internal/webui/static/assets/index-BaFCWWtK.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TrafficChart-BMjlJkKA.js","assets/CartesianGrid-1HegCBTm.js","assets/CostChart-Dpyzl54f.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TrafficChart-oYRXFvFw.js","assets/CartesianGrid-Cw-8i_Ey.js","assets/CostChart-Dvs5WgLu.js"])))=>i.map(i=>d[i]); var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1z||(e.current=R[z],R[z]=null,z--)}function H(e,t){z++,R[z]=e.current,e.current=t}var te=B(null),ne=B(null),re=B(null),ie=B(null);function ae(e,t){switch(H(re,t),H(ne,e),H(te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Yd(t),e=Xd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}V(te),H(te,e)}function oe(){V(te),V(ne),V(re)}function se(e){e.memoizedState!==null&&H(ie,e);var t=te.current,n=Xd(t,e.type);t!==n&&(H(ne,e),H(te,n))}function ce(e){ne.current===e&&(V(te),V(ne)),ie.current===e&&(V(ie),op._currentValue=ee)}var le,ue;function de(e){if(le===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);le=t&&t[1]||``,ue=-1)`:-1 to {let e=a.current,t=o.current;if(!e||!t)return;let n=n=>{let r=e.querySelector(`[data-selected="true"]`);if(!r){Z.set(t,{autoAlpha:0});return}let i=e.getBoundingClientRect(),a=r.getBoundingClientRect();Z.to(t,{x:a.left-i.left,y:a.top-i.top,width:a.width,height:a.height,autoAlpha:1,duration:n?JB(WB.base):0,ease:GB.out,overwrite:!0})};n(s.current),s.current=!0;let r=new ResizeObserver(()=>n(!1));return r.observe(e),()=>{r.disconnect(),Z.killTweensOf(t)}},[e,n]),(0,G.jsxs)(`div`,{ref:a,className:`filter-toggle relative inline-flex ${i??``}`,children:[(0,G.jsx)(`span`,{ref:o,"aria-hidden":!0,className:`filter-toggle__pill pointer-events-none absolute left-0 top-0 opacity-0`}),(0,G.jsx)(hj,{"aria-label":r,size:`sm`,selectionMode:`single`,disallowEmptySelection:!0,selectedKeys:new Set([e]),onSelectionChange:n=>{let r=[...n][0];typeof r==`string`&&r!==e&&t(r)},children:n.map(e=>(0,G.jsxs)(sA,{id:e.id,className:`relative z-[1]`,style:dle,children:[e.icon,e.label]},e.id))})]})}function jV(e,t=!1){if(!e)return;let n=e.toDate(jw());if(Number.isFinite(n.getTime()))return t&&n.setSeconds(59,999),n.toISOString()}function MV(e){if(!e)return null;let t=Date.parse(e);if(!Number.isFinite(t))return null;try{return Zw(Dre(new Date(t).toISOString()))}catch{return null}}function NV({value:e,onChange:t,ariaLabel:n,fromLabel:r,toLabel:i,className:a}){return(0,G.jsx)(Ik,{className:a,granularity:`minute`,hourCycle:24,shouldForceLeadingZeros:!0,value:e,onChange:e=>t(e),"aria-label":n,children:({state:e})=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(bO.Group,{className:`w-full min-w-0`,variant:`secondary`,children:[(0,G.jsx)(bO.Input,{className:`min-w-0`,slot:`start`,"aria-label":r,children:e=>(0,G.jsx)(bO.Segment,{segment:e})}),(0,G.jsx)(Ik.RangeSeparator,{}),(0,G.jsx)(bO.Input,{className:`min-w-0`,slot:`end`,"aria-label":i,children:e=>(0,G.jsx)(bO.Segment,{segment:e})}),(0,G.jsx)(bO.Suffix,{children:(0,G.jsx)(Ik.Trigger,{children:(0,G.jsx)(Ik.TriggerIndicator,{})})})]}),(0,G.jsxs)(Ik.Popover,{className:`flex w-[20.5rem] max-w-[calc(100vw-2rem)] flex-col gap-3 p-3`,children:[(0,G.jsxs)(GF,{"aria-label":n,children:[(0,G.jsxs)(GF.Header,{children:[(0,G.jsxs)(GF.YearPickerTrigger,{children:[(0,G.jsx)(GF.YearPickerTriggerHeading,{}),(0,G.jsx)(GF.YearPickerTriggerIndicator,{})]}),(0,G.jsx)(GF.NavButton,{slot:`previous`}),(0,G.jsx)(GF.NavButton,{slot:`next`})]}),(0,G.jsxs)(GF.Grid,{children:[(0,G.jsx)(GF.GridHeader,{children:e=>(0,G.jsx)(GF.HeaderCell,{children:e})}),(0,G.jsx)(GF.GridBody,{children:e=>(0,G.jsx)(GF.Cell,{date:e})})]}),(0,G.jsx)(GF.YearPickerGrid,{children:(0,G.jsx)(GF.YearPickerGridBody,{children:({year:e})=>(0,G.jsx)(GF.YearPickerCell,{year:e})})})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(jM,{className:`text-xs`,children:r}),(0,G.jsx)(Zk,{"aria-label":r,granularity:`minute`,hourCycle:24,value:e.timeRange?.start??null,onChange:t=>e.setTimeRange({start:t,end:e.timeRange?.end}),children:(0,G.jsx)(Zk.Group,{className:`w-[7.5rem]`,variant:`secondary`,children:(0,G.jsx)(Zk.Input,{children:e=>(0,G.jsx)(Zk.Segment,{segment:e})})})})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(jM,{className:`text-xs`,children:i}),(0,G.jsx)(Zk,{"aria-label":i,granularity:`minute`,hourCycle:24,value:e.timeRange?.end??null,onChange:t=>e.setTimeRange({start:e.timeRange?.start,end:t}),children:(0,G.jsx)(Zk.Group,{className:`w-[7.5rem]`,variant:`secondary`,children:(0,G.jsx)(Zk.Input,{children:e=>(0,G.jsx)(Zk.Segment,{segment:e})})})})]})]})]})]})})}var PV={today:`statsWindowToday`,1:`statsWindow1h`,24:`statsWindow24h`,168:`statsWindow7d`,720:`statsWindow30d`,custom:`statsWindowCustom`};function FV(e,t){if(e===`today`){let e=new Date;return e.setHours(0,0,0,0),{from:e.toISOString()}}if(e===`custom`){let e=jV(t?.start),n=jV(t?.end,!0);return e&&n?{from:e,to:n}:null}if(e===`720`){let e=new Date;return{from:new Date(e.getTime()-2592e6).toISOString(),to:e.toISOString()}}return{hours:Number(e)}}function IV({value:e,onChange:t,custom:n,onCustomChange:r,onBusy:i,t:a}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(AV,{value:e,onChange:r=>{let a=r;e!==a&&((a!==`custom`||n)&&i?.(),t(a))},ariaLabel:a(`statsTraffic`),options:Object.keys(PV).map(e=>({id:e,label:a(PV[e])}))}),e===`custom`?(0,G.jsx)(NV,{className:`w-[min(100%,24rem)]`,value:n,onChange:e=>{e&&i?.(),r(e)},ariaLabel:a(`statsWindowCustom`),fromLabel:a(`logsTimeFrom`),toLabel:a(`logsTimeTo`)}):null]})}function LV(e,t,n){let r=new URLSearchParams;for(let[t,n]of Object.entries(e))n&&r.set(t,n);let i=Date.parse(t),a=Date.parse(n);return Number.isFinite(i)&&Number.isFinite(a)&&(r.set(`from`,new Date(Math.floor(i/6e4)*6e4).toISOString()),r.set(`to`,new Date(Math.ceil(a/6e4)*6e4-6e4).toISOString())),`/logs?${r}`}function RV(e){let t=String(e||``).toLowerCase();return!t||t===`qoder`||t===`qoder-global`||t===`qoder-cn`}function zV(e){return String(e||``).toLowerCase()===`workbuddy`}function BV(e){return String(e||``).toLowerCase()===`trae`}function VV(e){return String(e||``).toLowerCase()===`devin`}function HV(e){return String(e||``).toLowerCase()===`command`}function UV(e){return String(e||``).toLowerCase()===`zhipu`}function WV(e){return String(e||``).toLowerCase()===`qwenwork`}function GV(e){return String(e||``).toLowerCase()===`kimi`}function KV(e){return String(e||``).toLowerCase()===`codearts`}function qV(e){let t=String(e||``).toLowerCase();return t===`meta`||t===`muse`}function JV(e,t){let n=String(e||``).toLowerCase();return zV(n)?`WorkBuddy`:BV(n)?`Trae`:VV(n)?`Devin`:HV(n)?`Command Code`:UV(n)?`Zhipu GLM`:WV(n)?`QwenWork`:GV(n)?`Kimi Code`:KV(n)?`CodeArts`:qV(n)?`Muse (Meta)`:RV(n)?`Qoder`:e||t(`account`)}function YV(e,t,n){let r=String(e||``).toLowerCase(),i=String(t||``).toLowerCase();return zV(r)?n(i===`global`?`accountTypeWorkBuddyGlobal`:`accountTypeWorkBuddyCN`):BV(r)?n(`accountTypeTraeCN`):VV(r)?n(`accountTypeDevinGlobal`):HV(r)?n(`accountTypeCommandGlobal`):UV(r)?n(`accountTypeZhipuCN`):WV(r)?n(i===`cn`?`accountTypeQwenworkCN`:`accountTypeQwenworkGlobal`):GV(r)?n(`accountTypeKimiCN`):KV(r)?n(`accountTypeCodeArtsCN`):qV(r)?n(`accountTypeMetaGlobal`):RV(r)?n(i===`cn`?`accountTypeQoderCN`:`accountTypeQoderGlobal`):e||n(`account`)}function fle(e,t){let n=t??!!e.max_mode,r=e.catalog_context_length||e.default_context_length||e.context_length||0,i=e.catalog_context_length_max||0;return n&&i>0?{context_length:i,prompt_max_tokens:e.prompt_max_tokens_max||e.prompt_max_tokens,max_output_tokens:e.max_output_tokens_max||e.max_output_tokens}:{context_length:r,prompt_max_tokens:e.prompt_max_tokens,max_output_tokens:e.max_output_tokens}}function ple({size:e=16,className:t=``}){return(0,G.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-[22%] bg-[#0a84ff] text-white ${t}`.trim(),style:{width:e,height:e,fontSize:Math.max(9,Math.round(e*.55)),fontWeight:650,lineHeight:1},"aria-hidden":`true`,children:`C`})}function mle({size:e=16,className:t=``}){return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`block shrink-0 text-foreground ${t}`.trim(),"aria-hidden":`true`,children:(0,G.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M8.086.457a6.1 6.1 0 0 1 3.046-.415q2 .23 3.564 1.7a.12.12 0 0 0 .107.029q2.112-.519 4.061.366l.063.03l.154.076q2.036 1.055 2.918 3.198a5.6 5.6 0 0 1 .421 2.126 5.7 5.7 0 0 1-.18 1.631.17.17 0 0 0 .04.155 6 6 0 0 1 1.578 2.891q.577 2.852-1.183 5.14l-.182.22a6.06 6.06 0 0 1-2.934 1.851.16.16 0 0 0-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451q-2.374-.012-4.21-1.736a.14.14 0 0 0-.14-.032 5.9 5.9 0 0 1-1.604-.185 5.9 5.9 0 0 1-2.595-.622 6.06 6.06 0 0 1-2.146-1.781c-.203-.269-.404-.522-.551-.821a8 8 0 0 1-.495-1.283 6.1 6.1 0 0 1-.017-3.064.2.2 0 0 0 .008-.074.1.1 0 0 0-.037-.064 6 6 0 0 1-1.38-2.202 5.2 5.2 0 0 1-.333-1.589 6.9 6.9 0 0 1 .188-2.132q.675-2.226 2.577-3.493.424-.282.802-.438.429-.179.861-.304a.13.13 0 0 0 .087-.087A6 6 0 0 1 5.635 2.31Q6.655 1.04 8.086.457m-.804 7.85a.848.848 0 0 0-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 0 0 1.46.864l1.94-3.272a.85.85 0 0 0 .007-.854zm5.446 6.24a.849.849 0 0 0 0 1.695h4.848a.849.849 0 0 0 0-1.696z`})})}function hle({size:e=16,className:t=``}){return(0,G.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-[22%] bg-[#1a1a1a] text-white ${t}`.trim(),style:{width:e,height:e,fontSize:Math.max(9,Math.round(e*.55)),fontWeight:650,lineHeight:1},"aria-hidden":`true`,children:`D`})}function gle({size:e=16,className:t=``}){return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`block shrink-0 text-foreground ${t}`.trim(),"aria-hidden":`true`,children:(0,G.jsx)(`path`,{fill:`currentColor`,d:`M21 12.79A9 9 0 1 1 11.21 3a7 7 0 0 0 9.79 9.79Z`})})}function _le({size:e=16,className:t=``}){return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`block shrink-0 text-foreground ${t}`.trim(),"aria-hidden":`true`,children:(0,G.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M8 6a4 4 0 0 0 0 8c.9 0 1.7-.3 2.4-.8L14 16.8A4 4 0 1 0 16 8a3.9 3.9 0 0 0-2.4.8L10 5.2A4 4 0 0 0 8 6Zm0 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4Zm8 4a2 2 0 1 1 0 4 2 2 0 0 1 0-4Z`,clipRule:`evenodd`})})}var vle=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAYAAAA9zQYyAAAJ5ElEQVR42u2dXUxUZxrH/wKDDDCM4CJBZJZNxMpGDMGYXsAWeikapF6Jqc02kUhWTWsTIQHjNk22yWCyN5INrk22rbsc71ZNpXfb0sJ+Gcxmma2mNpt1XMsaLd2ZoY7D5164btfiBx8zzDnv+f1uiWeG9/x8eN7neT9WFRaunROAIWQwBIDQAAgNgNAACA0IDYDQAAgNgNAACA0IDYDQAAgNgNAACA0IDYDQAAgNgNAACA0IDYDQAAgNgNAACA0IDYDQAAgNgNAA35LFEDyZ6uotKi8PqL6+ToFAuQoK/PL7/fL7CyRJ4fBNRaMRhcM3FQ6HFQqFNDoaUiQSYfDSxCqO031U4Lq6OjU1Nam6eov8fv+inxGJRDQ6GtLAwIAs6xxyI/TK0tTUpJ07d6iurk6BQCCpz45EIurrO62+vtOIjdCpIxAIqLPzWEokRmyEXjHq6+vU0dGh+vq6tHw+YiN00iJyb++ptImM2Aid1NSitbXVlt8vEomoq+u4LMvCRIR+Oq2trersPLYiOfJyCYfD6u4+rkuXBjASoZ0VlZ/G0NCwenp6NDQ0jJkI/aCOfPbs+46IyogtWt9Po739oAYHP3a8zNKDaszFixd08eIF20xkidArSGdnhzo7O4x9SZZlKRg8qXA4jLGmC/322z9Te/tBV7ysvr7TCgZ7KPWZKnRv7ynt29fqqhdGDdtQod0oM2IbKrSb0gzEXhyZXm/um06bAL7++muY/F9ycnJUX1+nPXteUiQSVSgUIkI75cvu29eq3t5TWKyndx0PHz7i2hq2Y4QOBAIaHPxoSYvu3YhbmzOOENrv92tw8CMjmiaILTqFnZ0dyKzldx2rq7cQoe3yQkB0HZ0uNKlG6ggGe4ws9dlaaOrNSyM2e0+3pu4oOntPX07dnffzzasDKvMUazY2ZVwN27ZCV1dv0eDgx9i5AK4lbuhy/Joux6/q1vRdXUvcWNC/K8sq1nbvZpXeX6N/9X+m3/zyrOPFtq3QLJ18egT+c/yqfjcx8j+Jk8GmyfWaOPOFRt4bRGgmgqnnfPRTnY99osvxayn9nJmxuKI/v6r7g7cRmuicXG5N3dEvxn+b1Ei8UCZHxvXvt/6qmbE4QhOdkyPy+dinaf0ec7Fpxd65rm+sf4jDGpdAR0eH3L4Ww7LO6Z2KQWVvK0p/xPNlqeBolTLyPYqduS46hVpc3dnNqYZlWWpublEw2GO775bftlFrTmwlQmuRG13dGpWDwZO2P3DGu6tMM2NxW0dqhE4zo6Mh7d//imNa0fltGyXJtlJn2Gky6LalocFgjxoaGh23riK/baMt8ntbC93U1OQqmbu6um2ZKy+UNSe2KsPnQWg98Sy6vXLLHsD9+19RX99pR/8emaVe5R/YiNB6wm4UN6QbkUhEzc27jTmUMa+1QpmlXoSen27scI3Mo6NmbWL1tVUitB6zss50TJRZelDKs1OUtoXQdXVmN1MOHz5ipMwPyWksQWj9X3fQ5B0pwWCP+vvNPqE/b28FQn87ISw39kX391uOLs1pERUPz6YChJak8vKAse3s7u7jcgvZtUUIbWqEflhrdtNZczkNJQj9MIc2MW82eRL4OEg5DBV6aGjY8V1ALXHddOZ6L0L7/QUyrUTnVrJKcxHatFTDzfeg2KHBgtBJPng8aS/GhivZENpl0TmZVY1VviwGFaGVtpqzGyeCRGiZe91a0l9MvoeBRej05M6WdS65L8XnIeVA6PRF52R3BO22aB6hSTdkQtcNoeW++0tSsV4ja5OPwUVopeGko3MyeV0EQrtsMjgwkJrNrp5KhEboFWZ4ODXpRva2IiocCJ2e/DkVrK5dy+Ai9MozMPBhSp5r1yO2EFpmt7pTsaouw+exzVYmhHYRoVDI+N3TCE3+LFP25SG061KOmynJnWmoILQxKYfdzohDaLmrqaIkL0ZiMojQxghNdDZI6Egk6riSXbKjs3dXGSaaI3TE1S9gzU+3YiFCm0H2tiJyZ9OETkUJzEkX74BhQkej7ozQvrZKtlqZKLTbDjWUHizgf3iBJRiYQ7tJ6gyfR/4T1Zhnch06FBp1zYDnt21ki5XpQg8N/d4Vg+3dVcaKOjcIPTw8LDfkzf6jP8Q4NwgdDodTtuFUNjnzrfBkLXsF3bSW49KlD42VeW3f85To3Ca0ZVnGHRaOzC5fbRcMnkRmMEdoU6I0MiO0MVEamRF6XpS2LGfejZ3XWqHiX9cjM0LPj9JOSz0K3qhSwdEqSnMIrcfWpZubWxyxVjqz1Kt1FxrpACL0QqTebWupfW2VWnehkRQDobXgpaXd3cdtJ3Xurg1ad6GRJaAIvXj6+y01N++2TU6dWeqV/0Q1URmhlxepm5tbUnYEFyB02nLqrq5u1+8UB4MOmunrO62amtqkX0UMCK10btsKBnvSInZBZh7WIHRqxW5oeHHFuou+jFysQejU59eHDh1RTU3tikwcN6/+PuYg9MpNHJubd6dU7LKs72EOQmtFT9hPpdjPrQ5gDkKbI/Z2bxXmIHT6xT506EhSOo5V5NAILZusta6pqV12c8aXkavt3s3Yg9AypjnT4nsBexBaxjRniNAI7QixF0qZp1gtvh9hEELbX+yFdh1/UvQSA4fQckTXsaGh8ZmlPqI0QjuGB2uwn13DJkojtExqzpR5ipEaoZ0t9nebM4eK9rC+Q9LMWByhnSh2TU3tvK7jr8q6XC+1HYTO9Hpz30RTLekCe8s6p0QioerqLSrOLdJ2b5U+nPijJuembP3d52LTWrU6I+nPjAT/prnJWYR2KolEQsPDw3r33feUSCT0Yk29NuSV6HL8qm2ljn9wS18f/4vuf3JbWaW5ylyfnN3r37z/dyX+cCftv9+qwsK1c6iZHPx+v9rbD6rx1R16baJXsdl7tkoHIm+NKjHylb57m63vQKWytxUt69l3Xx7WbGwKoU0V++U3XtVnLfd1LXEj7SJPnPlC9z745zPPG8ndtUF5eysWdT7fzFhcXx+7oqnPo7YYe4ROIYUb1ir/QKWmmwpX/LMnR8YVv3TrmSI/7h7FvL0VCxJ7Ziyur9r/ZIvJIEKvID94/jlFf7xmWX/WFxotJ0fGFTtzfdmSZfg88u4sU05DiTybCh6Re6n/WRDaMLK3FSmnoUS5Ozck7djdyZFx3R+8rckr4yn9s/9w8jjzZdzWY4zQSs/1yFmbfMppKFHOCyULrjTMxaY19XlUU9ejmhwZ1+SVcVtMxBAa5gmeWepVZqlXGT7PIz+bjU1pbmJa02P3bB8dERqA1jcAQgNCAyA0AEIDIDQAQgNCAyA0AEIDIDQAQgNCAyA0AEIDIDQAQgNCAyA0AEIDIDQgNABCAyA0AEIDIDQgNABCAyA0AEIDLIj/ABWOKFxbGBRBAAAAAElFTkSuQmCC`;function yle({size:e=16,className:t=``}){return(0,G.jsx)(`img`,{src:vle,alt:``,width:e,height:e,className:`block shrink-0 rounded-[22%] ${t}`.trim(),draggable:!1})}function ble({size:e=16,className:t=``}){let n=Math.max(2,Math.round(e*.14));return(0,G.jsxs)(`span`,{className:`inline-flex shrink-0 items-baseline justify-center rounded-[22%] bg-[#18181B] text-white ${t}`.trim(),style:{width:e,height:e,fontSize:Math.max(9,Math.round(e*.5)),fontWeight:650,lineHeight:1},"aria-hidden":`true`,children:[(0,G.jsx)(`span`,{style:{alignSelf:`center`},children:`Q`}),(0,G.jsx)(`span`,{style:{alignSelf:`center`,width:n,height:n,marginLeft:Math.max(0,Math.round(e*.03)),borderRadius:`50%`,background:`#22D3EE`}})]})}function xle({size:e=16,className:t=``}){return(0,G.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-[22%] bg-[#1a1a1a] text-white ${t}`.trim(),style:{width:e,height:e,fontSize:Math.max(9,Math.round(e*.55)),fontWeight:650,lineHeight:1},"aria-hidden":`true`,children:`T`})}var Sle=`/assets/workbuddy-mark-D1Gu2IKl.svg`;function Cle({size:e=16,className:t=``}){return(0,G.jsx)(`img`,{src:Sle,alt:``,width:e,height:e,className:`block shrink-0 ${t}`.trim(),draggable:!1})}function wle({size:e=16,className:t=``}){return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`block shrink-0 text-foreground ${t}`.trim(),"aria-hidden":`true`,children:(0,G.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M11.991 23.503a.24.24 0 0 0-.244.248a.24.24 0 0 0 .244.249a.24.24 0 0 0 .245-.249a.24.24 0 0 0-.22-.247zM9.671 5.365a1.697 1.697 0 0 1 1.099 2.132l-.071.172l-.016.04l-.018.054c-.07.16-.104.32-.104.498c-.035.71.47 1.279 1.186 1.314h.366c1.309.053 2.338 1.173 2.286 2.523c-.052 1.332-1.152 2.38-2.478 2.327h-.174c-.715.018-1.274.64-1.239 1.368c0 .124.018.23.053.337c.209.373.54.658.96.8c.75.23 1.517-.125 1.9-.782l.018-.035c.402-.64 1.17-.96 1.92-.711c.854.284 1.378 1.226 1.099 2.167a1.66 1.66 0 0 1-2.077 1.102a1.7 1.7 0 0 1-.907-.711l-.017-.035c-.2-.323-.463-.58-.851-.711l-.056-.018a1.646 1.646 0 0 0-1.954.746a1.66 1.66 0 0 1-1.065.764a1.677 1.677 0 0 1-1.989-1.279c-.209-.906.332-1.83 1.257-2.043a1.5 1.5 0 0 1 .296-.035h.018c.68-.071 1.151-.622 1.116-1.333a1.3 1.3 0 0 0-.227-.693a2.5 2.5 0 0 1-.366-1.403a2.4 2.4 0 0 1 .366-1.208c.14-.195.21-.444.227-.693c.018-.71-.506-1.261-1.186-1.332l-.07-.018a1.4 1.4 0 0 1-.299-.07l-.05-.019a1.7 1.7 0 0 1-1.047-2.114a1.68 1.68 0 0 1 2.094-1.101m-5.575 10.11c.26-.264.639-.367.994-.27s.633.379.728.74c.095.362-.007.748-.267 1.013c-.402.41-1.053.41-1.455 0a1.06 1.06 0 0 1 0-1.482zm14.845-.294c.359-.09.738.024.992.297c.254.274.344.665.237 1.025s-.396.634-.756.718c-.551.128-1.1-.22-1.23-.781a1.05 1.05 0 0 1 .757-1.26zm-.064-4.39c.314.32.49.753.49 1.206s-.176.886-.49 1.206c-.315.32-.74.5-1.185.5c-.444 0-.87-.18-1.184-.5a1.727 1.727 0 0 1 0-2.412a1.654 1.654 0 0 1 2.369 0m-11.243.163c.364.484.447 1.128.218 1.691a1.665 1.665 0 0 1-2.188.923c-.855-.36-1.26-1.358-.907-2.228a1.68 1.68 0 0 1 1.33-1.038a1.66 1.66 0 0 1 1.547.652m11.545-4.221c.368 0 .708.2.892.524s.184.724 0 1.048a1.03 1.03 0 0 1-.892.524a1.04 1.04 0 0 1-1.03-1.048a1.04 1.04 0 0 1 1.03-1.048m-14.358 0c.368 0 .707.2.891.524s.184.724 0 1.048a1.03 1.03 0 0 1-.891.524a1.04 1.04 0 0 1-1.03-1.048c0-.579.461-1.048 1.03-1.048m10.031-1.475c.925 0 1.675.764 1.675 1.706s-.75 1.705-1.675 1.705s-1.674-.763-1.674-1.705s.75-1.706 1.674-1.706m-2.626-.684c.362-.082.653-.356.761-.718a1.06 1.06 0 0 0-.238-1.028a1.02 1.02 0 0 0-.996-.294c-.547.14-.881.7-.752 1.257c.13.558.675.907 1.225.783m0 16.876c.359-.087.644-.36.75-.72a1.06 1.06 0 0 0-.237-1.019a1.02 1.02 0 0 0-.985-.301a1.04 1.04 0 0 0-.762.717c-.108.361-.017.754.239 1.028c.245.263.606.377.953.305zM17.19 3.5a.63.63 0 0 0 .628-.64a.63.63 0 0 0-.628-.64a.63.63 0 0 0-.628.64c0 .355.28.64.628.64m-10.38 0a.63.63 0 0 0 .628-.64c0-.355-.28-.64-.628-.64a.63.63 0 0 0-.628.64c0 .355.279.64.628.64m-5.182 7.852a.63.63 0 0 0-.628.64c0 .354.28.639.628.639a.63.63 0 0 0 .627-.606l.001-.034a.62.62 0 0 0-.628-.64zm5.182 9.13a.63.63 0 0 0-.628.64c0 .355.279.64.628.64a.63.63 0 0 0 .628-.64c0-.355-.28-.64-.628-.64m10.38.018a.63.63 0 0 0-.628.64c0 .355.28.64.628.64a.63.63 0 0 0 .628-.64a.63.63 0 0 0-.628-.64m5.182-9.148a.63.63 0 0 0-.628.64c0 .354.279.639.628.639a.63.63 0 0 0 .628-.64c0-.355-.28-.64-.628-.64zm-.384-4.992a.24.24 0 0 0 .244-.249a.24.24 0 0 0-.244-.249a.24.24 0 0 0-.244.249c0 .142.122.249.244.249M11.991.497a.24.24 0 0 0 .245-.248A.24.24 0 0 0 11.99 0a.24.24 0 0 0-.244.249c0 .133.108.236.223.247zM2.011 6.36a.24.24 0 0 0 .245-.249a.24.24 0 0 0-.244-.249a.24.24 0 0 0-.244.249a.24.24 0 0 0 .244.249zm0 11.263a.24.24 0 0 0-.243.248a.24.24 0 0 0 .244.249a.24.24 0 0 0 .244-.249a.25.25 0 0 0-.244-.248zm19.995-.018a.24.24 0 0 0-.245.248a.24.24 0 0 0 .245.25a.24.24 0 0 0 .244-.25a.25.25 0 0 0-.244-.248z`})})}function XV({provider:e,size:t=16,className:n=``}){let r=String(e||``).toLowerCase();return r===`workbuddy`?(0,G.jsx)(Cle,{size:t,className:n}):r===`trae`?(0,G.jsx)(xle,{size:t,className:n}):r===`devin`?(0,G.jsx)(hle,{size:t,className:n}):r===`command`?(0,G.jsx)(ple,{size:t,className:n}):r===`codex`?(0,G.jsx)(mle,{size:t,className:n}):r===`zhipu`?(0,G.jsx)(wle,{size:t,className:n}):r===`qwenwork`?(0,G.jsx)(ble,{size:t,className:n}):r===`kimi`?(0,G.jsx)(gle,{size:t,className:n}):r===`meta`||r===`muse`?(0,G.jsx)(_le,{size:t,className:n}):(0,G.jsx)(yle,{size:t,className:n})}var Tle=(0,v.lazy)(()=>C(()=>import(`./LiveSparkline-DXsyY9T8.js`).then(e=>({default:e.LiveSparkline})),[]));function Ele({live:e,samples:t,t:n,onConcurrencyClick:r}){let i=e?.in_flight??null,a=e?.capacity??0,o=i!=null&&a>0?i/a:0,s=a>0&&i!=null&&i>=a,c=(0,G.jsxs)(G.Fragment,{children:[n(`liveConcurrency`),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`mono tabular text-body font-semibold ${s?`text-warning`:`text-foreground`}`,children:[i??`—`,(0,G.jsxs)(`span`,{className:`font-normal text-muted`,children:[`/`,e?a:`—`]})]}),(0,G.jsx)(`span`,{className:`inline-block h-[3px] w-12 overflow-hidden rounded-[2px] bg-separator`,children:(0,G.jsx)(`span`,{className:`block h-full ${s?`bg-warning`:`bg-foreground/60`}`,style:{width:`${Math.min(100,o*100)}%`}})})]})]});return(0,G.jsxs)(`div`,{"data-testid":`live-strip`,className:`flex min-h-11 flex-wrap items-center gap-x-5 gap-y-2 overflow-hidden rounded-lg bg-surface-secondary px-4 py-2.5 text-caption text-muted sm:h-11 sm:gap-x-6 sm:gap-y-1 sm:py-0`,children:[(0,G.jsx)(`span`,{className:`inline-flex items-center`,children:(0,G.jsx)(`span`,{className:`status-dot`,"data-state":i==null?``:s?`warn`:i>0?`ok`:``})}),r?(0,G.jsx)(`button`,{type:`button`,"data-testid":`live-strip-concurrency`,onClick:r,className:`inline-flex flex-col gap-1 rounded-md text-left outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-focus sm:flex-row sm:items-center sm:gap-2`,"aria-label":n(`inflightExpandFromConcurrency`),children:c}):(0,G.jsx)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:c}),(0,G.jsxs)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[n(`liveRpm`),(0,G.jsx)(`span`,{className:`mono tabular text-body font-semibold text-foreground`,children:e?.rpm??`—`})]}),(0,G.jsxs)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[n(`liveTrace`),(0,G.jsx)(v.Suspense,{fallback:(0,G.jsx)(`span`,{className:`inline-block h-6 w-[120px]`}),children:(0,G.jsx)(Tle,{samples:t,capacity:a,label:n(`liveTrace`)})})]})]})}var Dle=/[achlmqstvz]|(-?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,Ole=/(?:(-)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,kle=/[\+\-]?\d*\.?\d+e[\+\-]?\d+/gi,Ale=/(^[#\.][a-z]|[a-y][a-z])/i,jle=Math.PI/180,Mle=180/Math.PI,ZV=Math.sin,QV=Math.cos,$V=Math.abs,eH=Math.sqrt,Nle=Math.atan2,tH=1e8,nH=function(e){return typeof e==`string`},rH=function(e){return typeof e==`number`},Ple=function(e){return e===void 0},Fle={},Ile={},iH=1e5,aH=function(e){return Math.round((e+tH)%1*iH)/iH||(e<0?0:1)},oH=function(e){return Math.round(e*iH)/iH||0},sH=function(e){return Math.round(e*1e10)/1e10||0},cH=function(e){return e.closed=Math.abs(e[0]-e[e.length-2])<.001&&Math.abs(e[1]-e[e.length-1])<.001},lH=function(e,t,n,r){var i=e[t],a=r===1?6:gH(i,n,r);if((a||!r)&&a+n+2t){for(;--i&&e[i]>t;);i<0&&(i=0)}else for(;e[++i] element or an SVG path data string`)}function zle(e){for(var t=[],n=0;n-1;)a=r[i].nodeName.toLowerCase(),t.indexOf(`,`+a+`,`)<0&&n.setAttributeNS(null,a,r[i].nodeValue);return n},Hle={rect:`rx,ry,x,y,width,height`,circle:`r,cx,cy`,ellipse:`rx,ry,cx,cy`,line:`x1,x2,y1,y2`},Ule=function(e,t){for(var n=t?t.split(`,`):[],r={},i=n.length;--i>-1;)r[n[i]]=+e.getAttribute(n[i])||0;return r};function Wle(e,t){var n=e.tagName.toLowerCase(),r=.552284749831,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T;return n===`path`||!e.getBBox?e:(l=Vle(e,`x,y,width,height,cx,cy,rx,ry,r,x1,x2,y1,y2,points`),T=Ule(e,Hle[n]),n===`rect`?(s=T.rx,c=T.ry||s,a=T.x,o=T.y,p=T.width-s*2,m=T.height-c*2,s||c?(h=a+s*(1-r),g=a+s,_=g+p,v=_+s*r,y=_+s,b=o+c*(1-r),x=o+c,S=x+m,C=S+c*r,w=S+c,i=`M`+y+`,`+x+` V`+S+` C`+[y,C,v,w,_,w,_-(_-g)/3,w,g+(_-g)/3,w,g,w,h,w,a,C,a,S,a,S-(S-x)/3,a,x+(S-x)/3,a,x,a,b,h,o,g,o,g+(_-g)/3,o,_-(_-g)/3,o,_,o,v,o,y,b,y,x].join(`,`)+`z`):i=`M`+(a+p)+`,`+o+` v`+m+` h`+-p+` v`+-m+` h`+p+`z`):n===`circle`||n===`ellipse`?(n===`circle`?(s=c=T.r,d=s*r):(s=T.rx,c=T.ry,d=c*r),a=T.cx,o=T.cy,u=s*r,i=`M`+(a+s)+`,`+o+` C`+[a+s,o+d,a+u,o+c,a,o+c,a-u,o+c,a-s,o+d,a-s,o,a-s,o-d,a-u,o-c,a,o-c,a+u,o-c,a+s,o-d,a+s,o].join(`,`)+`z`):n===`line`?i=`M`+T.x1+`,`+T.y1+` L`+T.x2+`,`+T.y2:(n===`polyline`||n===`polygon`)&&(f=(e.getAttribute(`points`)+``).match(Ole)||[],a=f.shift(),o=f.shift(),i=`M`+a+`,`+o+` L`+f.join(`,`),n===`polygon`&&(i+=`,`+a+`,`+o+`z`)),l.setAttribute(`d`,SH(l._gsRawPath=bH(i))),t&&e.parentNode&&(e.parentNode.insertBefore(l,e),e.parentNode.removeChild(e)),l)}function pH(e,t,n){var r=e[t],i=e[t+2],a=e[t+4],o;return r+=(i-r)*n,i+=(a-i)*n,r+=(i-r)*n,o=i+(a+(e[t+6]-a)*n-i)*n-r,r=e[t+1],i=e[t+3],a=e[t+5],r+=(i-r)*n,i+=(a-i)*n,r+=(i-r)*n,oH(Nle(i+(a+(e[t+7]-a)*n-i)*n-r,o)*Mle)}function mH(e,t,n){n=Ple(n)?1:sH(n)||0,t=sH(t)||0;var r=Math.max(0,~~($V(n-t)-1e-8)),i=zle(e);if(t>n&&(t=1-t,n=1-n,Lle(i),i.totalLength=0),t<0||n<0){var a=Math.abs(~~Math.min(t,n))+1;t+=a,n+=a}i.totalLength||hH(i);var o=n>1,s=_H(i,t,Fle,!0),c=_H(i,n,Ile),l=c.segment,u=s.segment,d=c.segIndex,f=s.segIndex,p=c.i,m=s.i,h=f===d,g=p===m&&h,_,v,y,b,x,S,C,w;if(o||r){for(_=dd)&&i.splice(b,1);else l.angle=pH(l,p+y,0),p+=y,s=l[p],c=l[p+1],l.length=l.totalLength=0,l.totalPoints=i.totalPoints=8,l.push(s,c,s,c,s,c,s,c);return i.totalLength=0,i}function Gle(e,t,n){t||=0,e.samples||(e.samples=[],e.lookup=[]);var r=~~e.resolution||12,i=1/r,a=n?t+n*6+1:e.length,o=e[t],s=e[t+1],c=t?t/6*r:0,l=e.samples,u=e.lookup,d=(t?e.minLength:tH)||tH,f=l[c+n*r-1],p=t?l[c-1]:0,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A;for(l.length=u.length=0,h=t+2;h8&&(e.splice(h,6),h-=6,a-=6);else for(m=1;m<=r;m++)D=i*m,E=1-D,y=b-(b=(D*D*g+3*E*(D*_+E*v))*D),w=T-(T=(D*D*x+3*E*(D*S+E*C))*D),k=eH(w*w+y*y),k=1)return 0;var r=e[t],i=e[t+1],a=e[t+2],o=e[t+3],s=e[t+4],c=e[t+5],l=e[t+6],u=e[t+7],d=r+(a-r)*n,f=a+(s-a)*n,p=i+(o-i)*n,m=o+(c-o)*n,h=d+(f-d)*n,g=p+(m-p)*n,_=s+(l-s)*n,v=c+(u-c)*n;return f+=(_-f)*n,m+=(v-m)*n,e.splice(t+2,4,oH(d),oH(p),oH(h),oH(g),oH(h+(f-h)*n),oH(g+(m-g)*n),oH(f),oH(m),oH(_),oH(v)),e.samples&&e.samples.splice(t/6*e.resolution|0,0,0,0,0,0,0,0),6}function _H(e,t,n,r){n||={},e.totalLength||hH(e),(t<0||t>1)&&(t=aH(t));var i=0,a=e[0],o,s,c,l,u,d,f;if(!t)f=d=i=0,a=e[0];else if(t===1)f=1,i=e.length-1,a=e[i],d=a.length-8;else{if(e.length>1){for(c=e.totalLength*t,u=d=0;(u+=e[d++].totalLength)1)&&(t=aH(t)),i.lookup||hH(e),e.length>1){for(c=e.totalLength*t,u=d=0;(u+=e[d++].totalLength)=1?1-1e-9:f||1e-9):i.angle||0),a}function yH(e,t,n,r,i,a,o){for(var s=e.length,c,l,u,d,f;--s>-1;)for(c=e[s],l=c.length,u=0;u1&&(n=eH(b)*n,r=eH(b)*r);var x=n*n,S=r*r,C=(x*S-x*y-S*v)/(x*y+S*v);C<0&&(C=0);var w=(a===o?-1:1)*eH(C),T=w*(n*_/r),E=w*-(r*g/n),D=(e+s)/2,O=(t+c)/2,k=D+(u*T-d*E),A=O+(d*T+u*E),j=(g-T)/n,M=(_-E)/r,N=(-g-T)/n,P=(-_-E)/r,F=j*j+M*M,I=(M<0?-1:1)*Math.acos(j/eH(F)),L=(j*P-M*N<0?-1:1)*Math.acos((j*N+M*P)/eH(F*(N*N+P*P)));isNaN(L)&&(L=f),!o&&L>0?L-=p:o&&L<0&&(L+=p),I%=p,L%=p;var ee=Math.ceil($V(L)/(p/4)),R=[],z=L/ee,B=4/3*ZV(z/2)/(1+QV(z/2)),V=u*n,H=d*n,te=d*-r,ne=u*r,re;for(re=0;re-1e-4?0:t}).match(Dle)||[],n=[],r=0,i=0,a=2/3,o=t.length,s=0,c=`ERROR: malformed path: `+e,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w=function(e,t,n,r){v=(n-e)/3,y=(r-t)/3,h.push(e+v,t+y,n-v,r-y,n,r)};if(!e||!isNaN(t[0])||isNaN(t[1]))return console.log(c),n;for(l=0;l.5||$V(i-f)>.5)&&(w(r,i,d,f),p===`L`&&(l+=2)),r=d,i=f;else if(p===`A`){if(S=t[l+4],C=t[l+5],v=t[l+6],y=t[l+7],u=7,S.length>1&&(S.length<3?(y=v,v=C,u--):(y=C,v=S.substr(2),u-=2),C=S.charAt(1),S=S.charAt(0)),b=Kle(r,i,+t[l+1],+t[l+2],+t[l+3],+S,+C,(m?r:0)+v*1,(m?i:0)+y*1),l+=u,b)for(u=0;ul*(w*w+T*T)&&(O=u.length,e(t,n,f,p,v,y,S,C,l,u,d),e(S,C,b,x,g,_,s,c,l,u,d+1+(u.length-O))),u},OH=function(){function e(e,t,n){wH||EH(),this.id=e,Yle&&this.setData(t,n)}var t=e.prototype;return t.setData=function(e,t){t||={},e||=`0,0,1,1`;var n=e.match(Xle),r=1,i=[],a=[],o=t.precision||1,s=o<=1,c,l,u,d,f,p,m,h,g;if(this.data=e,(Zle.test(e)||~e.indexOf(`M`)&&e.indexOf(`C`)<0)&&(n=bH(e)[0]),c=n.length,c===4)n.unshift(0,0),n.push(1,1),c=8;else if((c-2)%6)throw`Invalid CustomEase`;for((+n[0]!=0||+n[c-2]!=1)&&$le(n,t.height,t.originY),this.segment=n,d=2;dh.x||h.y!==m.y&&h.x===m.x||m===h)&&m.x<=1?(h.cx=m.x-h.x,h.cy=m.y-h.y,h.n=m,h.nx=m.x,s&&d>1&&Math.abs(h.cy/h.cx-i[d-2].cy/i[d-2].cx)>2&&(s=0),h.cxh||u===m-1)&&(c.push(g,_),l=(p-_)/(f-g)),g=f,_=p;c=`M`+c.join(`,`)}return s&&s.setAttribute(`d`,c),c},e}();OH.version=`3.15.0`,OH.headless=!0,TH()&&CH.registerPlugin(OH);var kH,AH,jH,MH,NH,PH,FH,IH,LH=`transform`,RH=LH+`Origin`,zH,BH=function(e){var t=e.ownerDocument||e;for(!(LH in e.style)&&(`msTransform`in e.style)&&(LH=`msTransform`,RH=LH+`Origin`);t.parentNode&&(t=t.parentNode););if(AH=window,FH=new KH,t){kH=t,jH=t.documentElement,MH=t.body,IH=kH.createElementNS(`http://www.w3.org/2000/svg`,`g`),IH.style.transform=`none`;var n=t.createElement(`div`),r=t.createElement(`div`),i=t&&(t.body||t.firstElementChild);i&&i.appendChild&&(i.appendChild(n),n.appendChild(r),n.style.position=`static`,n.style.transform=`translate3d(0,0,1px)`,zH=r.offsetParent!==n,i.removeChild(n))}return t},tue=function(e){for(var t,n;e&&e!==MH;)n=e._gsap,n&&n.uncache&&n.get(e,`x`),n&&!n.scaleX&&!n.scaleY&&n.renderTransform&&(n.scaleX=n.scaleY=1e-4,n.renderTransform(1,n),t?t.push(n):t=[n]),e=e.parentNode;return t},VH=[],HH=[],nue=function(){return AH.pageYOffset||kH.scrollTop||jH.scrollTop||MH.scrollTop||0},rue=function(){return AH.pageXOffset||kH.scrollLeft||jH.scrollLeft||MH.scrollLeft||0},UH=function(e){return e.ownerSVGElement||((e.tagName+``).toLowerCase()===`svg`?e:null)},iue=function e(t){if(AH.getComputedStyle(t).position===`fixed`)return!0;if(t=t.parentNode,t&&t.nodeType===1)return e(t)},WH=function e(t,n){if(t.parentNode&&(kH||BH(t))){var r=UH(t),i=r?r.getAttribute(`xmlns`)||`http://www.w3.org/2000/svg`:`http://www.w3.org/1999/xhtml`,a=r?n?`rect`:`g`:`div`,o=n===2?100:0,s=n===3?100:0,c={position:`absolute`,display:`block`,pointerEvents:`none`,margin:`0`,padding:`0`},l=kH.createElementNS?kH.createElementNS(i.replace(/^https/,`http`),a):kH.createElement(a);return n&&(r?(PH||=e(t),l.setAttribute(`width`,.01),l.setAttribute(`height`,.01),l.setAttribute(`transform`,`translate(`+o+`,`+s+`)`),l.setAttribute(`fill`,`transparent`),PH.appendChild(l)):(NH||(NH=e(t),Object.assign(NH.style,c)),Object.assign(l.style,c,{width:`0.1px`,height:`0.1px`,top:s+`px`,left:o+`px`}),NH.appendChild(l))),l}throw`Need document and parent.`},aue=function(e){for(var t=new KH,n=0;n1?aue(c):c.getItem(0).matrix:FH,u=c.a*l.x+c.c*l.y,d=c.b*l.x+c.d*l.y):(c=new KH,u=d=0),t&&e.tagName.toLowerCase()===`g`&&(u=d=0),(r||!e.getBoundingClientRect().width?n:a).appendChild(s),s.setAttribute(`transform`,`matrix(`+c.a+`,`+c.b+`,`+c.c+`,`+c.d+`,`+(c.e+u)+`,`+(c.f+d)+`)`);else{if(u=d=0,zH)for(c=e.offsetParent,l=e;(l&&=l.parentNode)&&l!==c&&l.parentNode;)(AH.getComputedStyle(l)[LH]+``).length>4&&(u=l.offsetLeft,d=l.offsetTop,l=0);if(f=AH.getComputedStyle(e),f.position!==`absolute`&&f.position!==`fixed`)for(c=e.offsetParent;a&&a!==c;)u+=a.scrollLeft||0,d+=a.scrollTop||0,a=a.parentNode;l=s.style,l.top=e.offsetTop-d+`px`,l.left=e.offsetLeft-u+`px`,l[LH]=f[LH],l[RH]=f[RH],l.position=f.position===`fixed`?`fixed`:`absolute`,o.appendChild(s)}return s},GH=function(e,t,n,r,i,a,o){return e.a=t,e.b=n,e.c=r,e.d=i,e.e=a,e.f=o,e},KH=function(){function e(e,t,n,r,i,a){e===void 0&&(e=1),t===void 0&&(t=0),n===void 0&&(n=0),r===void 0&&(r=1),i===void 0&&(i=0),a===void 0&&(a=0),GH(this,e,t,n,r,i,a)}var t=e.prototype;return t.inverse=function(){var e=this.a,t=this.b,n=this.c,r=this.d,i=this.e,a=this.f,o=e*r-t*n||1e-10;return GH(this,r/o,-t/o,-n/o,e/o,(n*a-r*i)/o,-(e*a-t*i)/o)},t.multiply=function(e){var t=this.a,n=this.b,r=this.c,i=this.d,a=this.e,o=this.f,s=e.a,c=e.c,l=e.b,u=e.d,d=e.e,f=e.f;return GH(this,s*t+l*r,s*n+l*i,c*t+u*r,c*n+u*i,a+d*t+f*r,o+d*n+f*i)},t.clone=function(){return new e(this.a,this.b,this.c,this.d,this.e,this.f)},t.equals=function(e){var t=this.a,n=this.b,r=this.c,i=this.d,a=this.e,o=this.f;return t===e.a&&n===e.b&&r===e.c&&i===e.d&&a===e.e&&o===e.f},t.apply=function(e,t){t===void 0&&(t={});var n=e.x,r=e.y,i=this.a,a=this.b,o=this.c,s=this.d,c=this.e,l=this.f;return t.x=n*i+r*o+c||0,t.y=n*a+r*s+l||0,t},e}();function qH(e,t,n,r){if(!e||!e.parentNode||(kH||BH(e)).documentElement===e)return new KH;var i=tue(e),a=UH(e)?VH:HH,o=sue(e,n),s=a[0].getBoundingClientRect(),c=a[1].getBoundingClientRect(),l=a[2].getBoundingClientRect(),u=o.parentNode,d=!r&&iue(e),f=new KH((c.left-s.left)/100,(c.top-s.top)/100,(l.left-s.left)/100,(l.top-s.top)/100,s.left+(d?0:rue()),s.top+(d?0:nue()));if(u.removeChild(o),i)for(s=i.length;s--;)c=i[s],c.scaleX=c.scaleY=0,c.renderTransform(1,c);return t?f.inverse():f}var cue=`x,translateX,left,marginLeft,xPercent`.split(`,`),lue=`y,translateY,top,marginTop,yPercent`.split(`,`),uue=Math.PI/180,JH,YH,XH,ZH,QH,$H,due=function(){return JH||typeof window<`u`&&(JH=window.gsap)&&JH.registerPlugin&&JH},eU=function(e,t,n,r){for(var i=t.length,a=r===2?0:r,o=0;o1?e=1:e<0&&(e=0);r--;)vH(n[r],e,!r&&t.rotate,n[r]);for(;i;)i.set(i.t,i.p,i.path[i.pp]+i.u,i.d,e),i=i._next;t.rotate&&t.rSet(t.target,t.rProp,n[0].angle*(t.radians?uue:1)+t.rOffset+t.ru,t,e)}else t.styles.revert()},getLength:function(e){return hH(fH(e)).totalLength},sliceRawPath:mH,getRawPath:fH,pointsToSegment:xH,stringToRawPath:bH,rawPathToString:SH,transformRawPath:yH,getGlobalMatrix:qH,getPositionOnPath:vH,cacheRawPathMeasurements:hH,convertToPath:function(e,t){return ZH(e).map(function(e){return Wle(e,t!==!1)})},convertCoordinates:function(e,t,n){var r=qH(t,!0,!0).multiply(qH(e));return n?r.apply(n):r},getAlignMatrix:aU,getRelativePosition:function(e,t,n,r){var i=aU(e,t,n,r);return{x:i.e,y:i.f}},arrayToRawPath:function(e,t){t||={};var n=eU(eU([],e,t.x||`x`,0),e,t.y||`y`,1);return t.relative&&nU(n),[t.type===`cubic`?n:xH(n,t.curviness)]}};due()&&JH.registerPlugin(cU);var hue=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function lU(e){return typeof e==`string`&&hue.includes(e)}var gue=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function uU(e){return typeof e==`string`&&gue.has(e)}function dU(e){return typeof e==`string`&&e.startsWith(`data-`)}function fU(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(uU(n)||dU(n))&&(t[n]=e[n]);return t}function pU(e){if(e==null)return null;if((0,v.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return fU(t)}return typeof e==`object`&&!Array.isArray(e)?fU(e):null}function mU(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(uU(n)||dU(n)||lU(n))&&(t[n]=e[n]);return t}function _ue(e){return e==null?null:(0,v.isValidElement)(e)?mU(e.props):typeof e==`object`&&!Array.isArray(e)?mU(e):null}var vue=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function hU(){return hU=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=yue(e,vue),d=a||{width:r,height:i,x:0,y:0},f=Is(`recharts-surface`,o);return v.createElement(`svg`,hU({},mU(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),v.createElement(`title`,null,c),v.createElement(`desc`,null,l),n)}),xue=[`children`,`className`];function _U(){return _U=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.className,i=Sue(e,xue),a=Is(`recharts-layer`,r);return v.createElement(`g`,_U({className:a},mU(i),{ref:t}),n)});function yU(e){return e===`__proto__`}var wue=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function bU(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:wue.test(e);default:return!1}}function xU(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function SU(e){return typeof e==`symbol`||e instanceof Symbol}function Tue(e){return e==null?``:CU(e)}function CU(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(CU).join(`,`);if(SU(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function wU(e){if(Array.isArray(e))return e.map(xU);if(typeof e==`symbol`)return[e];e=Tue(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r1&&arguments[1]!==void 0?arguments[1]:Due),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function DU(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+EU(i)+n},``)}var OU=e=>e===0?0:e>0?1:-1,kU=e=>typeof e==`number`&&e!=+e,AU=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,jU=e=>(typeof e==`number`||e instanceof Number)&&!kU(e),MU=e=>jU(e)||typeof e==`string`,Oue=0,NU=e=>{var t=++Oue;return`${e||``}${t}`},PU=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!jU(e)&&typeof e!=`string`)return n;var i;if(AU(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return kU(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},FU=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&(typeof t==`function`?t(e):TU(e,t))===n)}var RU=e=>e==null,zU=e=>RU(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function BU(e){return e!=null}function VU(){}function HU(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function UU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function WU(e){for(var t=1;t{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=HU(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?WU({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?WU({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?WU({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?WU({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?WU({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?WU({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?WU({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?WU({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(jU(n.x)||AU(n.x))&&(jU(n.y)||AU(n.y))?WU({x:c+PU(n.x,g),y:l+PU(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):WU({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},Nue=[`top`,`left`,`right`,`bottom`];function Pue(e){return e==null?!1:typeof e==`object`||Nue.includes(e)}var Fue=(0,v.createContext)(null);function GU(e){return function(){return e}}var KU=Math.PI,qU=2*KU,JU=1e-6,Iue=qU-JU;function YU(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return YU;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tJU){if(!(Math.abs(u*s-c*l)>JU)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((KU-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>JU&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>JU||Math.abs(this._y1-l)>JU)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%qU+qU),d>Iue?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>JU&&this._append`A${n},${n},0,${+(d>=KU)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};XU.prototype;function ZU(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new XU(t)}Array.prototype.slice;function QU(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function $U(e){this._context=e}$U.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function eW(e){return new $U(e)}function tW(e){return e[0]}function nW(e){return e[1]}function rW(e,t){var n=GU(!0),r=null,i=eW,a=null,o=ZU(s);e=typeof e==`function`?e:e===void 0?tW:GU(e),t=typeof t==`function`?t:t===void 0?nW:GU(t);function s(s){var c,l=(s=QU(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return rW().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:GU(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:GU(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:GU(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:GU(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:GU(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:GU(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:GU(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var aW=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function Rue(e){return new aW(e,!0)}function zue(e){return new aW(e,!1)}function oW(){}function sW(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function cW(e){this._context=e}cW.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:sW(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:sW(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Bue(e){return new cW(e)}function lW(e){this._context=e}lW.prototype={areaStart:oW,areaEnd:oW,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:sW(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Vue(e){return new lW(e)}function uW(e){this._context=e}uW.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:sW(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Hue(e){return new uW(e)}function dW(e){this._context=e}dW.prototype={areaStart:oW,areaEnd:oW,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Uue(e){return new dW(e)}function fW(e){return e<0?-1:1}function pW(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(fW(a)+fW(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function mW(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function hW(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function gW(e){this._context=e}gW.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:hW(this,this._t0,mW(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,hW(this,mW(this,n=pW(this,e,t)),n);break;default:hW(this,this._t0,n=pW(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function _W(e){this._context=new vW(e)}(_W.prototype=Object.create(gW.prototype)).point=function(e,t){gW.prototype.point.call(this,t,e)};function vW(e){this._context=e}vW.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function Wue(e){return new gW(e)}function Gue(e){return new _W(e)}function yW(e){this._context=e}yW.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=bW(e),i=bW(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function que(e){return new xW(e,.5)}function Jue(e){return new xW(e,0)}function Yue(e){return new xW(e,1)}function SW(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function Xue(e,t){return e[t]}function Zue(e){let t=[];return t.key=e,t}function Que(){var e=GU([]),t=CW,n=SW,r=Xue;function i(i){var a=Array.from(e.apply(this,arguments),Zue),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r`radius`in e&&`startAngle`in e&&`endAngle`in e,wW=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,v.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{lU(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},rde=(e,t,n)=>r=>(e(t,n,r),null),ide=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];lU(i)&&typeof a==`function`&&(r||={},r[i]=rde(a,t,n))}),r};function TW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ade(e){for(var t=1;t(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function lde(e){return Number.isSafeInteger(e)&&e>=0}function DW(e){return e!=null&&typeof e!=`function`&&lde(e.length)}function OW(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function kW(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var AW=`[object RegExp]`,jW=`[object String]`,MW=`[object Number]`,NW=`[object Boolean]`,ude=`[object Arguments]`,PW=`[object Symbol]`,FW=`[object Date]`,IW=`[object Map]`,LW=`[object Set]`,RW=`[object Array]`,dde=`[object Function]`,zW=`[object ArrayBuffer]`,BW=`[object Object]`,fde=`[object Error]`,VW=`[object DataView]`,HW=`[object Uint8Array]`,UW=`[object Uint8ClampedArray]`,WW=`[object Uint16Array]`,GW=`[object Uint32Array]`,pde=`[object BigUint64Array]`,KW=`[object Int8Array]`,qW=`[object Int16Array]`,JW=`[object Int32Array]`,mde=`[object BigInt64Array]`,YW=`[object Float32Array]`,XW=`[object Float64Array]`,ZW=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function QW(e){return ZW.Buffer!==void 0&&ZW.Buffer.isBuffer(e)}function $W(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function eG(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}var hde=/^(?:0|[1-9]\d*)$/;function tG(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e{var t=d(),n=P_();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),_de=o(((e,t)=>{t.exports=gde()})),nG=(0,v.createContext)(null),vde=_de(),yde=e=>e,rG=()=>{var e=(0,v.useContext)(nG);return e?e.store.dispatch:yde},iG=()=>{},bde=()=>iG,xde=(e,t)=>e===t;function aG(e){var t=(0,v.useContext)(nG),n=(0,v.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:iG,[t,e]);return(0,vde.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:bde,t?t.store.getState:iG,t?t.store.getState:iG,n,xde)}function Sde(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function Cde(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var oG=e=>Array.isArray(e)?e:[e];function wde(e){let t=Array.isArray(e[0])?e[0]:e;return Cde(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Tde(e,t){let n=[],{length:r}=e;for(let i=0;i`u`?Ede:WeakRef,Dde=0,cG=1;function lG(){return{s:Dde,v:void 0,o:null,p:null}}function Ode(e){return e instanceof sG?e.deref():e}function uG(e,t={}){let n=lG(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e{n=lG(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function kde(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),Sde(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=uG,argsMemoizeOptions:u=[]}={...n,...a},d=oG(c),f=oG(u),p=wde(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=Tde(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var $=kde(uG);function Ade(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a{if(e!==t){let r=fG(e),i=fG(t);if(r===i&&r===0){if(et)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},Mde=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Nde=/^\w*$/;function Pde(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||SU(e)?!0:typeof e==`string`&&(Nde.test(e)||!Mde.test(e))||t!=null&&Object.hasOwn(t,e)}function Fde(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=DW(e)?Array.from(e):Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||Pde(e)?e:{key:e,path:wU(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;re.original)}function pG(e,...t){let n=t.length;return n>1&&dG(e,t[0],t[1])?t=[]:n>2&&dG(t[0],t[1],t[2])&&(t=[t[0]]),Fde(e,Ade(t),[`asc`])}var mG=e=>e.legend.settings,Ide=e=>e.legend.size;$([e=>e.legend.payload,mG],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?pG(r,n):r});function hG(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var gG=typeof Symbol==`function`&&Symbol.observable||`@@observable`,_G=()=>Math.random().toString(36).substring(7).split(``).join(`.`),vG={INIT:`@@redux/INIT${_G()}`,REPLACE:`@@redux/REPLACE${_G()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${_G()}`};function yG(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function bG(e,t,n){if(typeof e!=`function`)throw Error(hG(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(hG(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(hG(1));return n(bG)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(hG(3));return i}function d(e){if(typeof e!=`function`)throw Error(hG(4));if(c)throw Error(hG(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(hG(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!yG(e))throw Error(hG(7));if(e.type===void 0)throw Error(hG(8));if(typeof e.type!=`string`)throw Error(hG(17));if(c)throw Error(hG(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(hG(10));r=e,f({type:vG.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(hG(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[gG](){return this}}}return f({type:vG.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[gG]:m}}function Lde(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:vG.INIT})===void 0)throw Error(hG(12));if(n(void 0,{type:vG.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(hG(13))})}function xG(e){let t=Object.keys(e),n={};for(let r=0;re:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function Rde(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(hG(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=SG(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function CG(e){return yG(e)&&`type`in e&&typeof e.type==`string`}var wG=Symbol.for(`immer-nothing`),TG=Symbol.for(`immer-draftable`),EG=Symbol.for(`immer-state`);function DG(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var OG=Object,kG=OG.getPrototypeOf,AG=`constructor`,jG=`prototype`,MG=`configurable`,NG=`enumerable`,PG=`writable`,FG=`value`,IG=e=>!!e&&!!e[EG];function LG(e){return e?zG(e)||GG(e)||!!e[TG]||!!e[AG]?.[TG]||KG(e)||qG(e):!1}var zde=OG[jG][AG].toString(),RG=new WeakMap;function zG(e){if(!e||!JG(e))return!1;let t=kG(e);if(t===null||t===OG[jG])return!0;let n=OG.hasOwnProperty.call(t,AG)&&t[AG];if(n===Object)return!0;if(!YG(n))return!1;let r=RG.get(n);return r===void 0&&(r=Function.toString.call(n),RG.set(n,r)),r===zde}function BG(e,t,n=!0){VG(e)===0?(n?Reflect.ownKeys(e):OG.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function VG(e){let t=e[EG];return t?t.type_:GG(e)?1:KG(e)?2:qG(e)?3:0}var HG=(e,t,n=VG(e))=>n===2?e.has(t):OG[jG].hasOwnProperty.call(e,t),UG=(e,t,n=VG(e))=>n===2?e.get(t):e[t],WG=(e,t,n,r=VG(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function Bde(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var GG=Array.isArray,KG=e=>e instanceof Map,qG=e=>e instanceof Set,JG=e=>typeof e==`object`,YG=e=>typeof e==`function`,XG=e=>typeof e==`boolean`;function Vde(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var ZG=e=>e.copy_||e.base_,QG=e=>e.modified_?e.copy_:e.base_;function $G(e,t){if(KG(e))return new Map(e);if(qG(e))return new Set(e);if(GG(e))return Array[jG].slice.call(e);let n=zG(e);if(t===!0||t===`class_only`&&!n){let t=OG.getOwnPropertyDescriptors(e);delete t[EG];let n=Reflect.ownKeys(t);for(let r=0;r1&&OG.defineProperties(e,{set:tK,add:tK,clear:tK,delete:tK}),OG.freeze(e),t&&BG(e,(e,t)=>{eK(t,!0)},!1),e)}function Hde(){DG(2)}var tK={[FG]:Hde};function nK(e){return e===null||!JG(e)||OG.isFrozen(e)}var rK=`MapSet`,iK=`Patches`,aK=`ArrayMethods`,oK={};function sK(e){let t=oK[e];return t||DG(0,e),t}var cK=e=>!!oK[e],lK,uK=()=>lK,Ude=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:cK(rK)?sK(rK):void 0,arrayMethodsPlugin_:cK(aK)?sK(aK):void 0});function dK(e,t){t&&(e.patchPlugin_=sK(iK),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fK(e){pK(e),e.drafts_.forEach(Wde),e.drafts_=null}function pK(e){e===lK&&(lK=e.parent_)}var mK=e=>lK=Ude(lK,e);function Wde(e){let t=e[EG];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function hK(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[EG].modified_&&(fK(t),DG(4)),LG(e)&&(e=gK(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[EG].base_,e,t)}else e=gK(t,n);return Gde(t,e,!0),fK(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===wG?void 0:e}function gK(e,t){if(nK(t))return t;let n=t[EG];if(!n)return xK(t,e.handledSet_,e);if(!vK(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);bK(n,e)}return n.copy_}function Gde(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&eK(t,n)}function _K(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var vK=(e,t)=>e.scope_===t,Kde=[];function yK(e,t,n,r){let i=ZG(e),a=e.type_;if(r!==void 0&&UG(i,r,a)===t){WG(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;BG(i,(e,n)=>{if(IG(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??Kde;for(let e of o)WG(i,e,n,a)}function qde(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!vK(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=QG(i);yK(e,i.draft_??i,a,n),bK(i,r)})}function bK(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}_K(e)}}function Jde(e,t,n){let{scope_:r}=e;if(IG(n)){let i=n[EG];vK(i,r)&&i.callbacks_.push(function(){DK(e),yK(e,n,QG(i),t)})}else LG(n)&&e.callbacks_.push(function(){let i=ZG(e);e.type_===3?i.has(n)&&xK(n,r.handledSet_,r):UG(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&xK(UG(e.copy_,t,e.type_),r.handledSet_,r)})}function xK(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||IG(e)||t.has(e)||!LG(e)||nK(e)?e:(t.add(e),BG(e,(r,i)=>{if(IG(i)){let t=i[EG];vK(t,n)&&(WG(e,r,QG(t),e.type_),_K(t))}else LG(i)&&xK(i,t,n)}),e)}function Yde(e,t){let n=GG(e),r={type_:+!!n,scope_:t?t.scope_:uK(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=SK;n&&(i=[r],a=CK);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var SK={get(e,t){if(t===EG)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=ZG(e);if(!HG(i,t,e.type_))return Zde(e,i,t);let a=i[t];if(e.finalized_||!LG(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&Vde(t))return a;if(a===wK(e.base_,t)||Xde(e,t,a)){DK(e);let n=e.type_===1?+t:t,r=OK(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in ZG(e)},ownKeys(e){return Reflect.ownKeys(ZG(e))},set(e,t,n){let r=TK(ZG(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=wK(ZG(e),t),i=r?.[EG];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(Bde(n,r)&&(n!==void 0||HG(e.base_,t,e.type_)))return!0;DK(e),EK(e)}return e.copy_[t]===n&&(n!==void 0||HG(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),Jde(e,t,n),!0)},deleteProperty(e,t){return DK(e),wK(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),EK(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=ZG(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[PG]:!0,[MG]:e.type_!==1||t!==`length`,[NG]:r[NG],[FG]:n[t]}},defineProperty(){DG(11)},getPrototypeOf(e){return kG(e.base_)},setPrototypeOf(){DG(12)}},CK={};for(let e in SK){let t=SK[e];CK[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}CK.deleteProperty=function(e,t){return CK.set.call(this,e,t,void 0)},CK.set=function(e,t,n){return SK.set.call(this,e[0],t,n,e[0])};function wK(e,t){let n=e[EG];return(n?ZG(n):e)[t]}function Xde(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!LG(n)||n[EG]?!1:e.baseRefs_.has(n)}function Zde(e,t,n){let r=TK(t,n);return r?FG in r?r[FG]:r.get?.call(e.draft_):void 0}function TK(e,t){if(!(t in e))return;let n=kG(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=kG(n)}}function EK(e){e.modified_||(e.modified_=!0,e.parent_&&EK(e.parent_))}function DK(e){e.copy_||=(e.assigned_=new Map,$G(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Qde=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(YG(e)&&!YG(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}YG(t)||DG(6),n!==void 0&&!YG(n)&&DG(7);let r;if(LG(e)){let i=mK(this),a=OK(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?fK(i):pK(i)}return dK(i,n),hK(r,i)}if(!e||!JG(e)){if(r=t(e),r===void 0&&(r=e),r===wG&&(r=void 0),this.autoFreeze_&&eK(r,!0),n){let t=[],i=[];sK(iK).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}DG(1,e)},this.produceWithPatches=(e,t)=>{if(YG(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},XG(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),XG(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),XG(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){LG(e)||DG(8),IG(e)&&(e=kK(e));let t=mK(this),n=OK(t,e,void 0);return n[EG].isManual_=!0,pK(t),n}finishDraft(e,t){let n=e&&e[EG];(!n||!n.isManual_)&&DG(9);let{scope_:r}=n;return dK(r,t),hK(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=sK(iK).applyPatches_;return IG(e)?r(e,t):this.produce(e,e=>r(e,t))}};function OK(e,t,n,r){let[i,a]=KG(t)?sK(rK).proxyMap_(t,n):qG(t)?sK(rK).proxySet_(t,n):Yde(t,n);return(n?.scope_??uK()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?qde(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function kK(e){return IG(e)||DG(10,e),AK(e)}function AK(e){if(!LG(e)||nK(e))return e;let t=e[EG],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=$G(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=$G(e,!0);return BG(n,(e,t)=>{WG(n,e,AK(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var jK=new Qde().produce,MK=e=>e;function NK(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var $de=NK(),efe=NK,tfe=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?SG:SG.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function PK(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(_q(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>CG(t)&&t.type===e,n}var FK=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function IK(e){return LG(e)?jK(e,()=>{}):e}function LK(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function nfe(e){return typeof e==`boolean`}var rfe=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new FK;return t&&(nfe(t)?a.push($de):a.push(efe(t.extraArgument))),a},RK=`RTK_autoBatch`,zK=()=>e=>({payload:e,meta:{[RK]:!0}}),BK=e=>t=>{setTimeout(t,e)},ife=(e,t)=>n=>{let r=!1,i=()=>{r||(r=!0,cancelAnimationFrame(a),clearTimeout(o),n())},a=e(i),o=setTimeout(i,t)},VK=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?ife(window.requestAnimationFrame,100):BK(10):e.type===`callback`?e.queueNotification:BK(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[RK],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},afe=e=>function(t){let{autoBatch:n=!0}=t??{},r=new FK(e);return n&&r.push(VK(typeof n==`object`?n:void 0)),r};function ofe(e){let t=rfe(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(yG(n))c=xG(n);else throw Error(_q(1));let l;l=typeof r==`function`?r(t):t();let u=SG;i&&(u=tfe({trace:!1,...typeof i==`object`&&i}));let d=afe(Rde(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return bG(c,o,p)}function HK(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(_q(28));if(r in t)throw Error(_q(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function sfe(e){return typeof e==`function`}function cfe(e,t){let[n,r,i]=HK(t),a;if(sfe(e))a=()=>IK(e());else{let t=IK(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n){if(IG(e)){let r=n(e,t);return r===void 0?e:r}if(LG(e))return jK(e,e=>n(e,t));{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}}return e},e)}return o.getInitialState=a,o}var lfe=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,ufe=(e=21)=>{let t=``,n=e;for(;n--;)t+=lfe[Math.random()*64|0];return t},dfe=Symbol.for(`rtk-slice-createasyncthunk`);function ffe(e,t){return`${e}/${t}`}function pfe({creators:e}={}){let t=e?.asyncThunk?.[dfe];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(_q(11));let i=(typeof e.reducers==`function`?e.reducers(hfe()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(_q(12));if(n in o.sliceCaseReducersByType)throw Error(_q(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:ffe(n,r),createNotation:typeof e.reducers==`function`};_fe(a)?yfe(o,a,s,t):gfe(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?HK(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return cfe(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=LK(d,r,m)),i}function i(t=l){return LK(LK(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=mfe(a,t,()=>LK(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function mfe(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var UK=pfe();function hfe(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function gfe({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!vfe(r))throw Error(_q(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?PK(e,o):PK(e))}function _fe(e){return e._reducerDefinitionType===`asyncThunk`}function vfe(e){return e._reducerDefinitionType===`reducerWithPrepare`}function yfe({type:e,reducerName:t},n,r,i){if(!i)throw Error(_q(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||WK,pending:s||WK,rejected:c||WK,settled:l||WK})}function WK(){}var bfe=`task`,GK=`listener`,KK=`completed`,qK=`cancelled`,xfe=`task-${qK}`,Sfe=`task-${KK}`,JK=`${GK}-${qK}`,Cfe=`${GK}-${KK}`,YK=class{constructor(e){this.code=e,this.message=`${bfe} ${qK} (reason: ${e})`}code;name=`TaskAbortError`;message},XK=(e,t)=>{if(typeof e!=`function`)throw TypeError(_q(32))},ZK=()=>{},QK=(e,t=ZK)=>(e.catch(t),e),$K=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),eq=e=>{if(e.aborted)throw new YK(e.reason)};function tq(e,t){let n=ZK;return new Promise((r,i)=>{let a=()=>i(new YK(e.reason));if(e.aborted){a();return}n=$K(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=ZK})}var wfe=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof YK?`cancelled`:`rejected`,error:e}}finally{t?.()}},nq=e=>t=>QK(tq(e,t).then(t=>(eq(e),t))),rq=e=>{let t=nq(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:iq}=Object,aq={},oq=`listenerMiddleware`,Tfe=(e,t)=>{let n=t=>$K(e,()=>t.abort(e.reason));return(r,i)=>{XK(r,`taskExecutor`);let a=new AbortController;n(a);let o=wfe(async()=>{eq(e),eq(a.signal);let t=await r({pause:nq(a.signal),delay:rq(a.signal),signal:a.signal});return eq(a.signal),t},()=>a.abort(Sfe));return i?.autoJoin&&t.push(o.catch(ZK)),{result:nq(e)(o),cancel(){a.abort(xfe)}}}},Efe=(e,t)=>{let n=async(n,r)=>{eq(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await tq(t,Promise.race(a));return eq(t),e}finally{i()}};return((e,t)=>QK(n(e,t)))},sq=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=PK(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(_q(21));return XK(a,`options.listener`),{predicate:i,type:t,effect:a}},cq=iq(e=>{let{type:t,predicate:n,effect:r}=sq(e);return{id:ufe(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(_q(22))}}},{withTypes:()=>cq}),lq=(e,t)=>{let{type:n,effect:r,predicate:i}=sq(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},uq=e=>{e.pending.forEach(e=>{e.abort(JK)})},Dfe=(e,t)=>()=>{for(let e of t.keys())uq(e);e.clear()},dq=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},fq=iq(PK(`${oq}/add`),{withTypes:()=>fq}),pq=PK(`${oq}/removeAll`),mq=iq(PK(`${oq}/remove`),{withTypes:()=>mq}),hq=(...e)=>{console.error(`${oq}/error`,...e)},gq=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=hq}=e;XK(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&uq(e)}),c=(e=>{let n=lq(t,e)??cq(e);return s(n)});iq(c,{withTypes:()=>c});let l=e=>{let n=lq(t,e);return n&&(n.unsubscribe(),e.cancelActive&&uq(n)),!!n};iq(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=Efe(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,iq({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:rq(u.signal),pause:nq(u.signal),extra:a,signal:u.signal,fork:Tfe(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(JK),n.delete(e))})},cancel:()=>{u.abort(JK),e.pending.delete(u)},throwIfCancelled:()=>{eq(u.signal)}})))}catch(e){e instanceof YK||dq(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(Cfe),i(e),e.pending.delete(u)}},d=Dfe(t,n);return{middleware:e=>n=>r=>{if(!CG(r))return n(r);if(fq.match(r))return c(r.payload);if(pq.match(r)){d();return}if(mq.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===aq)throw Error(_q(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,dq(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=aq}return s},startListening:c,stopListening:l,clearListeners:d}};function _q(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var vq=UK({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),yq=vq.actions,bq=yq.setMargin,xq=yq.setLayout,Sq=yq.setChartSize,Cq=yq.setScale,wq=vq.reducer;function Tq(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function Eq(e){return Number.isFinite(e)}function Dq(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function Oq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function kq(e){for(var t=1;t{if(t&&n){var r=n.width,i=n.height,a=t.align,o=t.verticalAlign,s=t.layout,c=t.position,l=t.offset,u=l===void 0?0:l;if(c!=null){if(Pue(c)){if(c===`top`&&jU(e.top))return kq(kq({},e),{},{top:e.top+(i||0)+u});if(c===`bottom`&&jU(e.bottom))return kq(kq({},e),{},{bottom:e.bottom+(i||0)+u});if(c===`left`&&jU(e.left))return kq(kq({},e),{},{left:e.left+(r||0)+u});if(c===`right`&&jU(e.right))return kq(kq({},e),{},{right:e.right+(r||0)+u})}return e}if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&jU(e[a]))return kq(kq({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&jU(e[o]))return kq(kq({},e),{},{[o]:e[o]+(i||0)})}return e},Fq=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,Iq=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},Lq=(e,t,n)=>{if(!e)return null;var r=e.duplicateDomain,i=e.type,a=e.range,o=e.scale,s=e.realScaleType,c=e.isCategorical,l=e.categoricalDomain,u=e.tickCount,d=e.ticks,f=e.niceTicks,p=e.axisType;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?OU(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return Eq(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(BU):c&&l?l.map((e,t)=>{var n=o.map(e);return Eq(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(BU):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return Eq(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(BU):o.domain().map((e,t)=>{var n=o.map(e);return Eq(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(BU)},Rq={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:$ue,none:SW,silhouette:ede,wiggle:tde,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},zq=(e,t,n)=>{var r=Rq[n]??SW,i=Que().keys(t).value((e,t)=>Number(Nq(e,t,0))).order(CW).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=Nq(e[i],t[r],0);Array.isArray(a)&&a.length===2&&jU(a[0])&&jU(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function Bq(e){return e==null?void 0:String(e)}function Vq(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!RU(i[t.dataKey])){var s=LU(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=Nq(i,RU(o)?t.dataKey:o),l=t.scale.map(c);return jU(l)?l:null}var Hq=e=>{var t=e.flat(2).filter(jU);return[Math.min(...t),Math.max(...t)]},Uq=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],Wq=(e,t,n)=>{if(e!=null&&Object.keys(e).length!==0)return Uq(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var o=a.stackedData.reduce((e,r)=>{var i=Hq(Tq(r,t,n));return!Eq(i[0])||!Eq(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(o[0],r[0]),Math.max(o[1],r[1])]},[1/0,-1/0]))},Gq=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Kq=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,qq=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=pG(t,e=>e.coordinate),a=[],o=0,s=1,c=i.length;su&&(d=Math.min(f,d));return d===1/0?0:d}return n?void 0:0};function Jq(e){var t=e.tooltipEntrySettings,n=e.dataKey,r=e.payload,i=e.value,a=e.name;return kq(kq({},t),{},{dataKey:n,payload:r,value:i,name:a})}function Yq(e,t){if(e!=null)return String(e);if(typeof t==`string`)return t}var Xq=(e,t)=>{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},Zq=(e,t)=>t===`centric`?e.angle:e.radius,Qq=e=>e.layout.width,$q=e=>e.layout.height,eJ=e=>e.layout.scale,tJ=e=>e.layout.margin,nJ=$(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),rJ=$(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),iJ=`data-recharts-item-index`;function aJ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function oJ(e){for(var t=1;te.brush.height;function dJ(e){return rJ(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function fJ(e){return rJ(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function pJ(e){return nJ(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}function mJ(e){return nJ(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}var hJ=$([Qq,$q,tJ,uJ,dJ,fJ,pJ,mJ,mG,Ide],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=oJ(oJ({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=Pq(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return oJ(oJ({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),gJ=$(hJ,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),_J=$(Qq,$q,(e,t)=>({x:0,y:0,width:e,height:t})),vJ=(0,v.createContext)(null),yJ=()=>(0,v.useContext)(vJ)!=null,bJ=e=>e.brush,xJ=$([bJ,hJ,tJ],(e,t,n)=>({height:e.height,x:jU(e.x)?e.x:t.left,y:jU(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:jU(e.width)?e.width:t.width}));function SJ(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function CJ(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=SJ(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?((r||i)&&(s=e.apply(this,t)),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function wJ(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return CJ(e,t,{leading:r,maxWait:t,trailing:i})}var TJ=function(e,t){var n=[...arguments].slice(2);if(typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e)){if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}}},EJ={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},DJ=(e,t,n)=>{var r=n.width,i=r===void 0?EJ.width:r,a=n.height,o=a===void 0?EJ.height:a,s=n.aspect,c=n.maxHeight,l=AU(i)?e:Number(i),u=AU(o)?t:Number(o);return s&&s>0&&(l?u=l/s:u&&(l=u*s),c&&u!=null&&u>c&&(u=c)),{calculatedWidth:l,calculatedHeight:u}},OJ={width:0,height:0,overflow:`visible`},kJ={width:0,overflowX:`visible`},AJ={height:0,overflowY:`visible`},jJ={},MJ=e=>{var t=e.width,n=e.height,r=AU(t),i=AU(n);return r&&i?OJ:r?kJ:i?AJ:jJ};function NJ(e){var t=e.width,n=e.height,r=e.aspect,i=t,a=n;return i===void 0&&a===void 0?(i=EJ.width,a=EJ.height):i===void 0?i=r&&r>0?void 0:EJ.width:a===void 0&&(a=r&&r>0?void 0:EJ.height),{width:i,height:a}}var PJ=[`aspect`,`initialDimension`,`width`,`height`,`minWidth`,`minHeight`,`maxHeight`,`children`,`debounce`,`id`,`className`,`onResize`,`style`];function FJ(){return FJ=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let e=a.current,t=o.current;if(!e||!t)return;let n=n=>{let r=e.querySelector(`[data-selected="true"]`);if(!r){Z.set(t,{autoAlpha:0});return}let i=e.getBoundingClientRect(),a=r.getBoundingClientRect();Z.to(t,{x:a.left-i.left,y:a.top-i.top,width:a.width,height:a.height,autoAlpha:1,duration:n?JB(WB.base):0,ease:GB.out,overwrite:!0})};n(s.current),s.current=!0;let r=new ResizeObserver(()=>n(!1));return r.observe(e),()=>{r.disconnect(),Z.killTweensOf(t)}},[e,n]),(0,G.jsxs)(`div`,{ref:a,className:`filter-toggle relative inline-flex ${i??``}`,children:[(0,G.jsx)(`span`,{ref:o,"aria-hidden":!0,className:`filter-toggle__pill pointer-events-none absolute left-0 top-0 opacity-0`}),(0,G.jsx)(hj,{"aria-label":r,size:`sm`,selectionMode:`single`,disallowEmptySelection:!0,selectedKeys:new Set([e]),onSelectionChange:n=>{let r=[...n][0];typeof r==`string`&&r!==e&&t(r)},children:n.map(e=>(0,G.jsxs)(sA,{id:e.id,className:`relative z-[1]`,style:dle,children:[e.icon,e.label]},e.id))})]})}function jV(e,t=!1){if(!e)return;let n=e.toDate(jw());if(Number.isFinite(n.getTime()))return t&&n.setSeconds(59,999),n.toISOString()}function MV(e){if(!e)return null;let t=Date.parse(e);if(!Number.isFinite(t))return null;try{return Zw(Dre(new Date(t).toISOString()))}catch{return null}}function NV({value:e,onChange:t,ariaLabel:n,fromLabel:r,toLabel:i,className:a}){return(0,G.jsx)(Ik,{className:a,granularity:`minute`,hourCycle:24,shouldForceLeadingZeros:!0,value:e,onChange:e=>t(e),"aria-label":n,children:({state:e})=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(bO.Group,{className:`w-full min-w-0`,variant:`secondary`,children:[(0,G.jsx)(bO.Input,{className:`min-w-0`,slot:`start`,"aria-label":r,children:e=>(0,G.jsx)(bO.Segment,{segment:e})}),(0,G.jsx)(Ik.RangeSeparator,{}),(0,G.jsx)(bO.Input,{className:`min-w-0`,slot:`end`,"aria-label":i,children:e=>(0,G.jsx)(bO.Segment,{segment:e})}),(0,G.jsx)(bO.Suffix,{children:(0,G.jsx)(Ik.Trigger,{children:(0,G.jsx)(Ik.TriggerIndicator,{})})})]}),(0,G.jsxs)(Ik.Popover,{className:`flex w-[20.5rem] max-w-[calc(100vw-2rem)] flex-col gap-3 p-3`,children:[(0,G.jsxs)(GF,{"aria-label":n,children:[(0,G.jsxs)(GF.Header,{children:[(0,G.jsxs)(GF.YearPickerTrigger,{children:[(0,G.jsx)(GF.YearPickerTriggerHeading,{}),(0,G.jsx)(GF.YearPickerTriggerIndicator,{})]}),(0,G.jsx)(GF.NavButton,{slot:`previous`}),(0,G.jsx)(GF.NavButton,{slot:`next`})]}),(0,G.jsxs)(GF.Grid,{children:[(0,G.jsx)(GF.GridHeader,{children:e=>(0,G.jsx)(GF.HeaderCell,{children:e})}),(0,G.jsx)(GF.GridBody,{children:e=>(0,G.jsx)(GF.Cell,{date:e})})]}),(0,G.jsx)(GF.YearPickerGrid,{children:(0,G.jsx)(GF.YearPickerGridBody,{children:({year:e})=>(0,G.jsx)(GF.YearPickerCell,{year:e})})})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(jM,{className:`text-xs`,children:r}),(0,G.jsx)(Zk,{"aria-label":r,granularity:`minute`,hourCycle:24,value:e.timeRange?.start??null,onChange:t=>e.setTimeRange({start:t,end:e.timeRange?.end}),children:(0,G.jsx)(Zk.Group,{className:`w-[7.5rem]`,variant:`secondary`,children:(0,G.jsx)(Zk.Input,{children:e=>(0,G.jsx)(Zk.Segment,{segment:e})})})})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(jM,{className:`text-xs`,children:i}),(0,G.jsx)(Zk,{"aria-label":i,granularity:`minute`,hourCycle:24,value:e.timeRange?.end??null,onChange:t=>e.setTimeRange({start:e.timeRange?.start,end:t}),children:(0,G.jsx)(Zk.Group,{className:`w-[7.5rem]`,variant:`secondary`,children:(0,G.jsx)(Zk.Input,{children:e=>(0,G.jsx)(Zk.Segment,{segment:e})})})})]})]})]})]})})}var PV={today:`statsWindowToday`,1:`statsWindow1h`,24:`statsWindow24h`,168:`statsWindow7d`,720:`statsWindow30d`,custom:`statsWindowCustom`};function FV(e,t){if(e===`today`){let e=new Date;return e.setHours(0,0,0,0),{from:e.toISOString()}}if(e===`custom`){let e=jV(t?.start),n=jV(t?.end,!0);return e&&n?{from:e,to:n}:null}if(e===`720`){let e=new Date;return{from:new Date(e.getTime()-2592e6).toISOString(),to:e.toISOString()}}return{hours:Number(e)}}function IV({value:e,onChange:t,custom:n,onCustomChange:r,onBusy:i,t:a}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(AV,{value:e,onChange:r=>{let a=r;e!==a&&((a!==`custom`||n)&&i?.(),t(a))},ariaLabel:a(`statsTraffic`),options:Object.keys(PV).map(e=>({id:e,label:a(PV[e])}))}),e===`custom`?(0,G.jsx)(NV,{className:`w-[min(100%,24rem)]`,value:n,onChange:e=>{e&&i?.(),r(e)},ariaLabel:a(`statsWindowCustom`),fromLabel:a(`logsTimeFrom`),toLabel:a(`logsTimeTo`)}):null]})}function LV(e,t,n){let r=new URLSearchParams;for(let[t,n]of Object.entries(e))n&&r.set(t,n);let i=Date.parse(t),a=Date.parse(n);return Number.isFinite(i)&&Number.isFinite(a)&&(r.set(`from`,new Date(Math.floor(i/6e4)*6e4).toISOString()),r.set(`to`,new Date(Math.ceil(a/6e4)*6e4-6e4).toISOString())),`/logs?${r}`}function RV(e){let t=String(e||``).toLowerCase();return!t||t===`qoder`||t===`qoder-global`||t===`qoder-cn`}function zV(e){return String(e||``).toLowerCase()===`workbuddy`}function BV(e){return String(e||``).toLowerCase()===`trae`}function VV(e){return String(e||``).toLowerCase()===`devin`}function HV(e){return String(e||``).toLowerCase()===`command`}function UV(e){return String(e||``).toLowerCase()===`zhipu`}function WV(e){return String(e||``).toLowerCase()===`qwenwork`}function GV(e){return String(e||``).toLowerCase()===`kimi`}function KV(e){return String(e||``).toLowerCase()===`codearts`}function qV(e){let t=String(e||``).toLowerCase();return t===`meta`||t===`muse`}function JV(e,t){let n=String(e||``).toLowerCase();return zV(n)?`WorkBuddy`:BV(n)?`Trae`:VV(n)?`Devin`:HV(n)?`Command Code`:UV(n)?`Zhipu GLM`:WV(n)?`QwenWork`:GV(n)?`Kimi Code`:KV(n)?`CodeArts`:qV(n)?`Muse (Meta)`:RV(n)?`Qoder`:e||t(`account`)}function YV(e,t,n){let r=String(e||``).toLowerCase(),i=String(t||``).toLowerCase();return zV(r)?n(i===`global`?`accountTypeWorkBuddyGlobal`:`accountTypeWorkBuddyCN`):BV(r)?n(`accountTypeTraeCN`):VV(r)?n(`accountTypeDevinGlobal`):HV(r)?n(`accountTypeCommandGlobal`):UV(r)?n(`accountTypeZhipuCN`):WV(r)?n(i===`cn`?`accountTypeQwenworkCN`:`accountTypeQwenworkGlobal`):GV(r)?n(`accountTypeKimiCN`):KV(r)?n(`accountTypeCodeArtsCN`):qV(r)?n(`accountTypeMetaGlobal`):RV(r)?n(i===`cn`?`accountTypeQoderCN`:`accountTypeQoderGlobal`):e||n(`account`)}function fle(e,t){let n=t??!!e.max_mode,r=e.catalog_context_length||e.default_context_length||e.context_length||0,i=e.catalog_context_length_max||0;return n&&i>0?{context_length:i,prompt_max_tokens:e.prompt_max_tokens_max||e.prompt_max_tokens,max_output_tokens:e.max_output_tokens_max||e.max_output_tokens}:{context_length:r,prompt_max_tokens:e.prompt_max_tokens,max_output_tokens:e.max_output_tokens}}function ple({size:e=16,className:t=``}){return(0,G.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-[22%] bg-[#0a84ff] text-white ${t}`.trim(),style:{width:e,height:e,fontSize:Math.max(9,Math.round(e*.55)),fontWeight:650,lineHeight:1},"aria-hidden":`true`,children:`C`})}function mle({size:e=16,className:t=``}){return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`block shrink-0 text-foreground ${t}`.trim(),"aria-hidden":`true`,children:(0,G.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M8.086.457a6.1 6.1 0 0 1 3.046-.415q2 .23 3.564 1.7a.12.12 0 0 0 .107.029q2.112-.519 4.061.366l.063.03l.154.076q2.036 1.055 2.918 3.198a5.6 5.6 0 0 1 .421 2.126 5.7 5.7 0 0 1-.18 1.631.17.17 0 0 0 .04.155 6 6 0 0 1 1.578 2.891q.577 2.852-1.183 5.14l-.182.22a6.06 6.06 0 0 1-2.934 1.851.16.16 0 0 0-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451q-2.374-.012-4.21-1.736a.14.14 0 0 0-.14-.032 5.9 5.9 0 0 1-1.604-.185 5.9 5.9 0 0 1-2.595-.622 6.06 6.06 0 0 1-2.146-1.781c-.203-.269-.404-.522-.551-.821a8 8 0 0 1-.495-1.283 6.1 6.1 0 0 1-.017-3.064.2.2 0 0 0 .008-.074.1.1 0 0 0-.037-.064 6 6 0 0 1-1.38-2.202 5.2 5.2 0 0 1-.333-1.589 6.9 6.9 0 0 1 .188-2.132q.675-2.226 2.577-3.493.424-.282.802-.438.429-.179.861-.304a.13.13 0 0 0 .087-.087A6 6 0 0 1 5.635 2.31Q6.655 1.04 8.086.457m-.804 7.85a.848.848 0 0 0-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 0 0 1.46.864l1.94-3.272a.85.85 0 0 0 .007-.854zm5.446 6.24a.849.849 0 0 0 0 1.695h4.848a.849.849 0 0 0 0-1.696z`})})}function hle({size:e=16,className:t=``}){return(0,G.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-[22%] bg-[#1a1a1a] text-white ${t}`.trim(),style:{width:e,height:e,fontSize:Math.max(9,Math.round(e*.55)),fontWeight:650,lineHeight:1},"aria-hidden":`true`,children:`D`})}function gle({size:e=16,className:t=``}){return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`block shrink-0 text-foreground ${t}`.trim(),"aria-hidden":`true`,children:(0,G.jsx)(`path`,{fill:`currentColor`,d:`M21 12.79A9 9 0 1 1 11.21 3a7 7 0 0 0 9.79 9.79Z`})})}function _le({size:e=16,className:t=``}){return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`block shrink-0 text-foreground ${t}`.trim(),"aria-hidden":`true`,children:(0,G.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M8 6a4 4 0 0 0 0 8c.9 0 1.7-.3 2.4-.8L14 16.8A4 4 0 1 0 16 8a3.9 3.9 0 0 0-2.4.8L10 5.2A4 4 0 0 0 8 6Zm0 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4Zm8 4a2 2 0 1 1 0 4 2 2 0 0 1 0-4Z`,clipRule:`evenodd`})})}var vle=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAYAAAA9zQYyAAAJ5ElEQVR42u2dXUxUZxrH/wKDDDCM4CJBZJZNxMpGDMGYXsAWeikapF6Jqc02kUhWTWsTIQHjNk22yWCyN5INrk22rbsc71ZNpXfb0sJ+Gcxmma2mNpt1XMsaLd2ZoY7D5164btfiBx8zzDnv+f1uiWeG9/x8eN7neT9WFRaunROAIWQwBIDQAAgNgNAACA0IDYDQAAgNgNAACA0IDYDQAAgNgNAACA0IDYDQAAgNgNAACA0IDYDQAAgNgNAACA0IDYDQAAgNgNAA35LFEDyZ6uotKi8PqL6+ToFAuQoK/PL7/fL7CyRJ4fBNRaMRhcM3FQ6HFQqFNDoaUiQSYfDSxCqO031U4Lq6OjU1Nam6eov8fv+inxGJRDQ6GtLAwIAs6xxyI/TK0tTUpJ07d6iurk6BQCCpz45EIurrO62+vtOIjdCpIxAIqLPzWEokRmyEXjHq6+vU0dGh+vq6tHw+YiN00iJyb++ptImM2Aid1NSitbXVlt8vEomoq+u4LMvCRIR+Oq2trersPLYiOfJyCYfD6u4+rkuXBjASoZ0VlZ/G0NCwenp6NDQ0jJkI/aCOfPbs+46IyogtWt9Po739oAYHP3a8zNKDaszFixd08eIF20xkidArSGdnhzo7O4x9SZZlKRg8qXA4jLGmC/322z9Te/tBV7ysvr7TCgZ7KPWZKnRv7ynt29fqqhdGDdtQod0oM2IbKrSb0gzEXhyZXm/um06bAL7++muY/F9ycnJUX1+nPXteUiQSVSgUIkI75cvu29eq3t5TWKyndx0PHz7i2hq2Y4QOBAIaHPxoSYvu3YhbmzOOENrv92tw8CMjmiaILTqFnZ0dyKzldx2rq7cQoe3yQkB0HZ0uNKlG6ggGe4ws9dlaaOrNSyM2e0+3pu4oOntPX07dnffzzasDKvMUazY2ZVwN27ZCV1dv0eDgx9i5AK4lbuhy/Joux6/q1vRdXUvcWNC/K8sq1nbvZpXeX6N/9X+m3/zyrOPFtq3QLJ18egT+c/yqfjcx8j+Jk8GmyfWaOPOFRt4bRGgmgqnnfPRTnY99osvxayn9nJmxuKI/v6r7g7cRmuicXG5N3dEvxn+b1Ei8UCZHxvXvt/6qmbE4QhOdkyPy+dinaf0ec7Fpxd65rm+sf4jDGpdAR0eH3L4Ww7LO6Z2KQWVvK0p/xPNlqeBolTLyPYqduS46hVpc3dnNqYZlWWpublEw2GO775bftlFrTmwlQmuRG13dGpWDwZO2P3DGu6tMM2NxW0dqhE4zo6Mh7d//imNa0fltGyXJtlJn2Gky6LalocFgjxoaGh23riK/baMt8ntbC93U1OQqmbu6um2ZKy+UNSe2KsPnQWg98Sy6vXLLHsD9+19RX99pR/8emaVe5R/YiNB6wm4UN6QbkUhEzc27jTmUMa+1QpmlXoSen27scI3Mo6NmbWL1tVUitB6zss50TJRZelDKs1OUtoXQdXVmN1MOHz5ipMwPyWksQWj9X3fQ5B0pwWCP+vvNPqE/b28FQn87ISw39kX391uOLs1pERUPz6YChJak8vKAse3s7u7jcgvZtUUIbWqEflhrdtNZczkNJQj9MIc2MW82eRL4OEg5DBV6aGjY8V1ALXHddOZ6L0L7/QUyrUTnVrJKcxHatFTDzfeg2KHBgtBJPng8aS/GhivZENpl0TmZVY1VviwGFaGVtpqzGyeCRGiZe91a0l9MvoeBRej05M6WdS65L8XnIeVA6PRF52R3BO22aB6hSTdkQtcNoeW++0tSsV4ja5OPwUVopeGko3MyeV0EQrtsMjgwkJrNrp5KhEboFWZ4ODXpRva2IiocCJ2e/DkVrK5dy+Ai9MozMPBhSp5r1yO2EFpmt7pTsaouw+exzVYmhHYRoVDI+N3TCE3+LFP25SG061KOmynJnWmoILQxKYfdzohDaLmrqaIkL0ZiMojQxghNdDZI6Egk6riSXbKjs3dXGSaaI3TE1S9gzU+3YiFCm0H2tiJyZ9OETkUJzEkX74BhQkej7ozQvrZKtlqZKLTbDjWUHizgf3iBJRiYQ7tJ6gyfR/4T1Zhnch06FBp1zYDnt21ki5XpQg8N/d4Vg+3dVcaKOjcIPTw8LDfkzf6jP8Q4NwgdDodTtuFUNjnzrfBkLXsF3bSW49KlD42VeW3f85To3Ca0ZVnGHRaOzC5fbRcMnkRmMEdoU6I0MiO0MVEamRF6XpS2LGfejZ3XWqHiX9cjM0LPj9JOSz0K3qhSwdEqSnMIrcfWpZubWxyxVjqz1Kt1FxrpACL0QqTebWupfW2VWnehkRQDobXgpaXd3cdtJ3Xurg1ad6GRJaAIvXj6+y01N++2TU6dWeqV/0Q1URmhlxepm5tbUnYEFyB02nLqrq5u1+8UB4MOmunrO62amtqkX0UMCK10btsKBnvSInZBZh7WIHRqxW5oeHHFuou+jFysQejU59eHDh1RTU3tikwcN6/+PuYg9MpNHJubd6dU7LKs72EOQmtFT9hPpdjPrQ5gDkKbI/Z2bxXmIHT6xT506EhSOo5V5NAILZusta6pqV12c8aXkavt3s3Yg9AypjnT4nsBexBaxjRniNAI7QixF0qZp1gtvh9hEELbX+yFdh1/UvQSA4fQckTXsaGh8ZmlPqI0QjuGB2uwn13DJkojtExqzpR5ipEaoZ0t9nebM4eK9rC+Q9LMWByhnSh2TU3tvK7jr8q6XC+1HYTO9Hpz30RTLekCe8s6p0QioerqLSrOLdJ2b5U+nPijJuembP3d52LTWrU6I+nPjAT/prnJWYR2KolEQsPDw3r33feUSCT0Yk29NuSV6HL8qm2ljn9wS18f/4vuf3JbWaW5ylyfnN3r37z/dyX+cCftv9+qwsK1c6iZHPx+v9rbD6rx1R16baJXsdl7tkoHIm+NKjHylb57m63vQKWytxUt69l3Xx7WbGwKoU0V++U3XtVnLfd1LXEj7SJPnPlC9z745zPPG8ndtUF5eysWdT7fzFhcXx+7oqnPo7YYe4ROIYUb1ir/QKWmmwpX/LMnR8YVv3TrmSI/7h7FvL0VCxJ7Ziyur9r/ZIvJIEKvID94/jlFf7xmWX/WFxotJ0fGFTtzfdmSZfg88u4sU05DiTybCh6Re6n/WRDaMLK3FSmnoUS5Ozck7djdyZFx3R+8rckr4yn9s/9w8jjzZdzWY4zQSs/1yFmbfMppKFHOCyULrjTMxaY19XlUU9ejmhwZ1+SVcVtMxBAa5gmeWepVZqlXGT7PIz+bjU1pbmJa02P3bB8dERqA1jcAQgNCAyA0AEIDIDQAQgNCAyA0AEIDIDQAQgNCAyA0AEIDIDQAQgNCAyA0AEIDIDQgNABCAyA0AEIDIDQgNABCAyA0AEIDLIj/ABWOKFxbGBRBAAAAAElFTkSuQmCC`;function yle({size:e=16,className:t=``}){return(0,G.jsx)(`img`,{src:vle,alt:``,width:e,height:e,className:`block shrink-0 rounded-[22%] ${t}`.trim(),draggable:!1})}function ble({size:e=16,className:t=``}){let n=Math.max(2,Math.round(e*.14));return(0,G.jsxs)(`span`,{className:`inline-flex shrink-0 items-baseline justify-center rounded-[22%] bg-[#18181B] text-white ${t}`.trim(),style:{width:e,height:e,fontSize:Math.max(9,Math.round(e*.5)),fontWeight:650,lineHeight:1},"aria-hidden":`true`,children:[(0,G.jsx)(`span`,{style:{alignSelf:`center`},children:`Q`}),(0,G.jsx)(`span`,{style:{alignSelf:`center`,width:n,height:n,marginLeft:Math.max(0,Math.round(e*.03)),borderRadius:`50%`,background:`#22D3EE`}})]})}function xle({size:e=16,className:t=``}){return(0,G.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-[22%] bg-[#1a1a1a] text-white ${t}`.trim(),style:{width:e,height:e,fontSize:Math.max(9,Math.round(e*.55)),fontWeight:650,lineHeight:1},"aria-hidden":`true`,children:`T`})}var Sle=`/assets/workbuddy-mark-D1Gu2IKl.svg`;function Cle({size:e=16,className:t=``}){return(0,G.jsx)(`img`,{src:Sle,alt:``,width:e,height:e,className:`block shrink-0 ${t}`.trim(),draggable:!1})}function wle({size:e=16,className:t=``}){return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`block shrink-0 text-foreground ${t}`.trim(),"aria-hidden":`true`,children:(0,G.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M11.991 23.503a.24.24 0 0 0-.244.248a.24.24 0 0 0 .244.249a.24.24 0 0 0 .245-.249a.24.24 0 0 0-.22-.247zM9.671 5.365a1.697 1.697 0 0 1 1.099 2.132l-.071.172l-.016.04l-.018.054c-.07.16-.104.32-.104.498c-.035.71.47 1.279 1.186 1.314h.366c1.309.053 2.338 1.173 2.286 2.523c-.052 1.332-1.152 2.38-2.478 2.327h-.174c-.715.018-1.274.64-1.239 1.368c0 .124.018.23.053.337c.209.373.54.658.96.8c.75.23 1.517-.125 1.9-.782l.018-.035c.402-.64 1.17-.96 1.92-.711c.854.284 1.378 1.226 1.099 2.167a1.66 1.66 0 0 1-2.077 1.102a1.7 1.7 0 0 1-.907-.711l-.017-.035c-.2-.323-.463-.58-.851-.711l-.056-.018a1.646 1.646 0 0 0-1.954.746a1.66 1.66 0 0 1-1.065.764a1.677 1.677 0 0 1-1.989-1.279c-.209-.906.332-1.83 1.257-2.043a1.5 1.5 0 0 1 .296-.035h.018c.68-.071 1.151-.622 1.116-1.333a1.3 1.3 0 0 0-.227-.693a2.5 2.5 0 0 1-.366-1.403a2.4 2.4 0 0 1 .366-1.208c.14-.195.21-.444.227-.693c.018-.71-.506-1.261-1.186-1.332l-.07-.018a1.4 1.4 0 0 1-.299-.07l-.05-.019a1.7 1.7 0 0 1-1.047-2.114a1.68 1.68 0 0 1 2.094-1.101m-5.575 10.11c.26-.264.639-.367.994-.27s.633.379.728.74c.095.362-.007.748-.267 1.013c-.402.41-1.053.41-1.455 0a1.06 1.06 0 0 1 0-1.482zm14.845-.294c.359-.09.738.024.992.297c.254.274.344.665.237 1.025s-.396.634-.756.718c-.551.128-1.1-.22-1.23-.781a1.05 1.05 0 0 1 .757-1.26zm-.064-4.39c.314.32.49.753.49 1.206s-.176.886-.49 1.206c-.315.32-.74.5-1.185.5c-.444 0-.87-.18-1.184-.5a1.727 1.727 0 0 1 0-2.412a1.654 1.654 0 0 1 2.369 0m-11.243.163c.364.484.447 1.128.218 1.691a1.665 1.665 0 0 1-2.188.923c-.855-.36-1.26-1.358-.907-2.228a1.68 1.68 0 0 1 1.33-1.038a1.66 1.66 0 0 1 1.547.652m11.545-4.221c.368 0 .708.2.892.524s.184.724 0 1.048a1.03 1.03 0 0 1-.892.524a1.04 1.04 0 0 1-1.03-1.048a1.04 1.04 0 0 1 1.03-1.048m-14.358 0c.368 0 .707.2.891.524s.184.724 0 1.048a1.03 1.03 0 0 1-.891.524a1.04 1.04 0 0 1-1.03-1.048c0-.579.461-1.048 1.03-1.048m10.031-1.475c.925 0 1.675.764 1.675 1.706s-.75 1.705-1.675 1.705s-1.674-.763-1.674-1.705s.75-1.706 1.674-1.706m-2.626-.684c.362-.082.653-.356.761-.718a1.06 1.06 0 0 0-.238-1.028a1.02 1.02 0 0 0-.996-.294c-.547.14-.881.7-.752 1.257c.13.558.675.907 1.225.783m0 16.876c.359-.087.644-.36.75-.72a1.06 1.06 0 0 0-.237-1.019a1.02 1.02 0 0 0-.985-.301a1.04 1.04 0 0 0-.762.717c-.108.361-.017.754.239 1.028c.245.263.606.377.953.305zM17.19 3.5a.63.63 0 0 0 .628-.64a.63.63 0 0 0-.628-.64a.63.63 0 0 0-.628.64c0 .355.28.64.628.64m-10.38 0a.63.63 0 0 0 .628-.64c0-.355-.28-.64-.628-.64a.63.63 0 0 0-.628.64c0 .355.279.64.628.64m-5.182 7.852a.63.63 0 0 0-.628.64c0 .354.28.639.628.639a.63.63 0 0 0 .627-.606l.001-.034a.62.62 0 0 0-.628-.64zm5.182 9.13a.63.63 0 0 0-.628.64c0 .355.279.64.628.64a.63.63 0 0 0 .628-.64c0-.355-.28-.64-.628-.64m10.38.018a.63.63 0 0 0-.628.64c0 .355.28.64.628.64a.63.63 0 0 0 .628-.64a.63.63 0 0 0-.628-.64m5.182-9.148a.63.63 0 0 0-.628.64c0 .354.279.639.628.639a.63.63 0 0 0 .628-.64c0-.355-.28-.64-.628-.64zm-.384-4.992a.24.24 0 0 0 .244-.249a.24.24 0 0 0-.244-.249a.24.24 0 0 0-.244.249c0 .142.122.249.244.249M11.991.497a.24.24 0 0 0 .245-.248A.24.24 0 0 0 11.99 0a.24.24 0 0 0-.244.249c0 .133.108.236.223.247zM2.011 6.36a.24.24 0 0 0 .245-.249a.24.24 0 0 0-.244-.249a.24.24 0 0 0-.244.249a.24.24 0 0 0 .244.249zm0 11.263a.24.24 0 0 0-.243.248a.24.24 0 0 0 .244.249a.24.24 0 0 0 .244-.249a.25.25 0 0 0-.244-.248zm19.995-.018a.24.24 0 0 0-.245.248a.24.24 0 0 0 .245.25a.24.24 0 0 0 .244-.25a.25.25 0 0 0-.244-.248z`})})}function XV({provider:e,size:t=16,className:n=``}){let r=String(e||``).toLowerCase();return r===`workbuddy`?(0,G.jsx)(Cle,{size:t,className:n}):r===`trae`?(0,G.jsx)(xle,{size:t,className:n}):r===`devin`?(0,G.jsx)(hle,{size:t,className:n}):r===`command`?(0,G.jsx)(ple,{size:t,className:n}):r===`codex`?(0,G.jsx)(mle,{size:t,className:n}):r===`zhipu`?(0,G.jsx)(wle,{size:t,className:n}):r===`qwenwork`?(0,G.jsx)(ble,{size:t,className:n}):r===`kimi`?(0,G.jsx)(gle,{size:t,className:n}):r===`meta`||r===`muse`?(0,G.jsx)(_le,{size:t,className:n}):(0,G.jsx)(yle,{size:t,className:n})}var Tle=(0,v.lazy)(()=>C(()=>import(`./LiveSparkline-D_Jmu8Yl.js`).then(e=>({default:e.LiveSparkline})),[]));function Ele({live:e,samples:t,t:n,onConcurrencyClick:r}){let i=e?.in_flight??null,a=e?.capacity??0,o=i!=null&&a>0?i/a:0,s=a>0&&i!=null&&i>=a,c=(0,G.jsxs)(G.Fragment,{children:[n(`liveConcurrency`),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`mono tabular text-body font-semibold ${s?`text-warning`:`text-foreground`}`,children:[i??`—`,(0,G.jsxs)(`span`,{className:`font-normal text-muted`,children:[`/`,e?a:`—`]})]}),(0,G.jsx)(`span`,{className:`inline-block h-[3px] w-12 overflow-hidden rounded-[2px] bg-separator`,children:(0,G.jsx)(`span`,{className:`block h-full ${s?`bg-warning`:`bg-foreground/60`}`,style:{width:`${Math.min(100,o*100)}%`}})})]})]});return(0,G.jsxs)(`div`,{"data-testid":`live-strip`,className:`flex min-h-11 flex-wrap items-center gap-x-5 gap-y-2 overflow-hidden rounded-lg bg-surface-secondary px-4 py-2.5 text-caption text-muted sm:h-11 sm:gap-x-6 sm:gap-y-1 sm:py-0`,children:[(0,G.jsx)(`span`,{className:`inline-flex items-center`,children:(0,G.jsx)(`span`,{className:`status-dot`,"data-state":i==null?``:s?`warn`:i>0?`ok`:``})}),r?(0,G.jsx)(`button`,{type:`button`,"data-testid":`live-strip-concurrency`,onClick:r,className:`inline-flex flex-col gap-1 rounded-md text-left outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-focus sm:flex-row sm:items-center sm:gap-2`,"aria-label":n(`inflightExpandFromConcurrency`),children:c}):(0,G.jsx)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:c}),(0,G.jsxs)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[n(`liveRpm`),(0,G.jsx)(`span`,{className:`mono tabular text-body font-semibold text-foreground`,children:e?.rpm??`—`})]}),(0,G.jsxs)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[n(`liveTrace`),(0,G.jsx)(v.Suspense,{fallback:(0,G.jsx)(`span`,{className:`inline-block h-6 w-[120px]`}),children:(0,G.jsx)(Tle,{samples:t,capacity:a,label:n(`liveTrace`)})})]})]})}var Dle=/[achlmqstvz]|(-?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,Ole=/(?:(-)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,kle=/[\+\-]?\d*\.?\d+e[\+\-]?\d+/gi,Ale=/(^[#\.][a-z]|[a-y][a-z])/i,jle=Math.PI/180,Mle=180/Math.PI,ZV=Math.sin,QV=Math.cos,$V=Math.abs,eH=Math.sqrt,Nle=Math.atan2,tH=1e8,nH=function(e){return typeof e==`string`},rH=function(e){return typeof e==`number`},Ple=function(e){return e===void 0},Fle={},Ile={},iH=1e5,aH=function(e){return Math.round((e+tH)%1*iH)/iH||(e<0?0:1)},oH=function(e){return Math.round(e*iH)/iH||0},sH=function(e){return Math.round(e*1e10)/1e10||0},cH=function(e){return e.closed=Math.abs(e[0]-e[e.length-2])<.001&&Math.abs(e[1]-e[e.length-1])<.001},lH=function(e,t,n,r){var i=e[t],a=r===1?6:gH(i,n,r);if((a||!r)&&a+n+2t){for(;--i&&e[i]>t;);i<0&&(i=0)}else for(;e[++i] element or an SVG path data string`)}function zle(e){for(var t=[],n=0;n-1;)a=r[i].nodeName.toLowerCase(),t.indexOf(`,`+a+`,`)<0&&n.setAttributeNS(null,a,r[i].nodeValue);return n},Hle={rect:`rx,ry,x,y,width,height`,circle:`r,cx,cy`,ellipse:`rx,ry,cx,cy`,line:`x1,x2,y1,y2`},Ule=function(e,t){for(var n=t?t.split(`,`):[],r={},i=n.length;--i>-1;)r[n[i]]=+e.getAttribute(n[i])||0;return r};function Wle(e,t){var n=e.tagName.toLowerCase(),r=.552284749831,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T;return n===`path`||!e.getBBox?e:(l=Vle(e,`x,y,width,height,cx,cy,rx,ry,r,x1,x2,y1,y2,points`),T=Ule(e,Hle[n]),n===`rect`?(s=T.rx,c=T.ry||s,a=T.x,o=T.y,p=T.width-s*2,m=T.height-c*2,s||c?(h=a+s*(1-r),g=a+s,_=g+p,v=_+s*r,y=_+s,b=o+c*(1-r),x=o+c,S=x+m,C=S+c*r,w=S+c,i=`M`+y+`,`+x+` V`+S+` C`+[y,C,v,w,_,w,_-(_-g)/3,w,g+(_-g)/3,w,g,w,h,w,a,C,a,S,a,S-(S-x)/3,a,x+(S-x)/3,a,x,a,b,h,o,g,o,g+(_-g)/3,o,_-(_-g)/3,o,_,o,v,o,y,b,y,x].join(`,`)+`z`):i=`M`+(a+p)+`,`+o+` v`+m+` h`+-p+` v`+-m+` h`+p+`z`):n===`circle`||n===`ellipse`?(n===`circle`?(s=c=T.r,d=s*r):(s=T.rx,c=T.ry,d=c*r),a=T.cx,o=T.cy,u=s*r,i=`M`+(a+s)+`,`+o+` C`+[a+s,o+d,a+u,o+c,a,o+c,a-u,o+c,a-s,o+d,a-s,o,a-s,o-d,a-u,o-c,a,o-c,a+u,o-c,a+s,o-d,a+s,o].join(`,`)+`z`):n===`line`?i=`M`+T.x1+`,`+T.y1+` L`+T.x2+`,`+T.y2:(n===`polyline`||n===`polygon`)&&(f=(e.getAttribute(`points`)+``).match(Ole)||[],a=f.shift(),o=f.shift(),i=`M`+a+`,`+o+` L`+f.join(`,`),n===`polygon`&&(i+=`,`+a+`,`+o+`z`)),l.setAttribute(`d`,SH(l._gsRawPath=bH(i))),t&&e.parentNode&&(e.parentNode.insertBefore(l,e),e.parentNode.removeChild(e)),l)}function pH(e,t,n){var r=e[t],i=e[t+2],a=e[t+4],o;return r+=(i-r)*n,i+=(a-i)*n,r+=(i-r)*n,o=i+(a+(e[t+6]-a)*n-i)*n-r,r=e[t+1],i=e[t+3],a=e[t+5],r+=(i-r)*n,i+=(a-i)*n,r+=(i-r)*n,oH(Nle(i+(a+(e[t+7]-a)*n-i)*n-r,o)*Mle)}function mH(e,t,n){n=Ple(n)?1:sH(n)||0,t=sH(t)||0;var r=Math.max(0,~~($V(n-t)-1e-8)),i=zle(e);if(t>n&&(t=1-t,n=1-n,Lle(i),i.totalLength=0),t<0||n<0){var a=Math.abs(~~Math.min(t,n))+1;t+=a,n+=a}i.totalLength||hH(i);var o=n>1,s=_H(i,t,Fle,!0),c=_H(i,n,Ile),l=c.segment,u=s.segment,d=c.segIndex,f=s.segIndex,p=c.i,m=s.i,h=f===d,g=p===m&&h,_,v,y,b,x,S,C,w;if(o||r){for(_=dd)&&i.splice(b,1);else l.angle=pH(l,p+y,0),p+=y,s=l[p],c=l[p+1],l.length=l.totalLength=0,l.totalPoints=i.totalPoints=8,l.push(s,c,s,c,s,c,s,c);return i.totalLength=0,i}function Gle(e,t,n){t||=0,e.samples||(e.samples=[],e.lookup=[]);var r=~~e.resolution||12,i=1/r,a=n?t+n*6+1:e.length,o=e[t],s=e[t+1],c=t?t/6*r:0,l=e.samples,u=e.lookup,d=(t?e.minLength:tH)||tH,f=l[c+n*r-1],p=t?l[c-1]:0,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A;for(l.length=u.length=0,h=t+2;h8&&(e.splice(h,6),h-=6,a-=6);else for(m=1;m<=r;m++)D=i*m,E=1-D,y=b-(b=(D*D*g+3*E*(D*_+E*v))*D),w=T-(T=(D*D*x+3*E*(D*S+E*C))*D),k=eH(w*w+y*y),k=1)return 0;var r=e[t],i=e[t+1],a=e[t+2],o=e[t+3],s=e[t+4],c=e[t+5],l=e[t+6],u=e[t+7],d=r+(a-r)*n,f=a+(s-a)*n,p=i+(o-i)*n,m=o+(c-o)*n,h=d+(f-d)*n,g=p+(m-p)*n,_=s+(l-s)*n,v=c+(u-c)*n;return f+=(_-f)*n,m+=(v-m)*n,e.splice(t+2,4,oH(d),oH(p),oH(h),oH(g),oH(h+(f-h)*n),oH(g+(m-g)*n),oH(f),oH(m),oH(_),oH(v)),e.samples&&e.samples.splice(t/6*e.resolution|0,0,0,0,0,0,0,0),6}function _H(e,t,n,r){n||={},e.totalLength||hH(e),(t<0||t>1)&&(t=aH(t));var i=0,a=e[0],o,s,c,l,u,d,f;if(!t)f=d=i=0,a=e[0];else if(t===1)f=1,i=e.length-1,a=e[i],d=a.length-8;else{if(e.length>1){for(c=e.totalLength*t,u=d=0;(u+=e[d++].totalLength)1)&&(t=aH(t)),i.lookup||hH(e),e.length>1){for(c=e.totalLength*t,u=d=0;(u+=e[d++].totalLength)=1?1-1e-9:f||1e-9):i.angle||0),a}function yH(e,t,n,r,i,a,o){for(var s=e.length,c,l,u,d,f;--s>-1;)for(c=e[s],l=c.length,u=0;u1&&(n=eH(b)*n,r=eH(b)*r);var x=n*n,S=r*r,C=(x*S-x*y-S*v)/(x*y+S*v);C<0&&(C=0);var w=(a===o?-1:1)*eH(C),T=w*(n*_/r),E=w*-(r*g/n),D=(e+s)/2,O=(t+c)/2,k=D+(u*T-d*E),A=O+(d*T+u*E),j=(g-T)/n,M=(_-E)/r,N=(-g-T)/n,P=(-_-E)/r,F=j*j+M*M,I=(M<0?-1:1)*Math.acos(j/eH(F)),L=(j*P-M*N<0?-1:1)*Math.acos((j*N+M*P)/eH(F*(N*N+P*P)));isNaN(L)&&(L=f),!o&&L>0?L-=p:o&&L<0&&(L+=p),I%=p,L%=p;var ee=Math.ceil($V(L)/(p/4)),R=[],z=L/ee,B=4/3*ZV(z/2)/(1+QV(z/2)),V=u*n,H=d*n,te=d*-r,ne=u*r,re;for(re=0;re-1e-4?0:t}).match(Dle)||[],n=[],r=0,i=0,a=2/3,o=t.length,s=0,c=`ERROR: malformed path: `+e,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w=function(e,t,n,r){v=(n-e)/3,y=(r-t)/3,h.push(e+v,t+y,n-v,r-y,n,r)};if(!e||!isNaN(t[0])||isNaN(t[1]))return console.log(c),n;for(l=0;l.5||$V(i-f)>.5)&&(w(r,i,d,f),p===`L`&&(l+=2)),r=d,i=f;else if(p===`A`){if(S=t[l+4],C=t[l+5],v=t[l+6],y=t[l+7],u=7,S.length>1&&(S.length<3?(y=v,v=C,u--):(y=C,v=S.substr(2),u-=2),C=S.charAt(1),S=S.charAt(0)),b=Kle(r,i,+t[l+1],+t[l+2],+t[l+3],+S,+C,(m?r:0)+v*1,(m?i:0)+y*1),l+=u,b)for(u=0;ul*(w*w+T*T)&&(O=u.length,e(t,n,f,p,v,y,S,C,l,u,d),e(S,C,b,x,g,_,s,c,l,u,d+1+(u.length-O))),u},OH=function(){function e(e,t,n){wH||EH(),this.id=e,Yle&&this.setData(t,n)}var t=e.prototype;return t.setData=function(e,t){t||={},e||=`0,0,1,1`;var n=e.match(Xle),r=1,i=[],a=[],o=t.precision||1,s=o<=1,c,l,u,d,f,p,m,h,g;if(this.data=e,(Zle.test(e)||~e.indexOf(`M`)&&e.indexOf(`C`)<0)&&(n=bH(e)[0]),c=n.length,c===4)n.unshift(0,0),n.push(1,1),c=8;else if((c-2)%6)throw`Invalid CustomEase`;for((+n[0]!=0||+n[c-2]!=1)&&$le(n,t.height,t.originY),this.segment=n,d=2;dh.x||h.y!==m.y&&h.x===m.x||m===h)&&m.x<=1?(h.cx=m.x-h.x,h.cy=m.y-h.y,h.n=m,h.nx=m.x,s&&d>1&&Math.abs(h.cy/h.cx-i[d-2].cy/i[d-2].cx)>2&&(s=0),h.cxh||u===m-1)&&(c.push(g,_),l=(p-_)/(f-g)),g=f,_=p;c=`M`+c.join(`,`)}return s&&s.setAttribute(`d`,c),c},e}();OH.version=`3.15.0`,OH.headless=!0,TH()&&CH.registerPlugin(OH);var kH,AH,jH,MH,NH,PH,FH,IH,LH=`transform`,RH=LH+`Origin`,zH,BH=function(e){var t=e.ownerDocument||e;for(!(LH in e.style)&&(`msTransform`in e.style)&&(LH=`msTransform`,RH=LH+`Origin`);t.parentNode&&(t=t.parentNode););if(AH=window,FH=new KH,t){kH=t,jH=t.documentElement,MH=t.body,IH=kH.createElementNS(`http://www.w3.org/2000/svg`,`g`),IH.style.transform=`none`;var n=t.createElement(`div`),r=t.createElement(`div`),i=t&&(t.body||t.firstElementChild);i&&i.appendChild&&(i.appendChild(n),n.appendChild(r),n.style.position=`static`,n.style.transform=`translate3d(0,0,1px)`,zH=r.offsetParent!==n,i.removeChild(n))}return t},tue=function(e){for(var t,n;e&&e!==MH;)n=e._gsap,n&&n.uncache&&n.get(e,`x`),n&&!n.scaleX&&!n.scaleY&&n.renderTransform&&(n.scaleX=n.scaleY=1e-4,n.renderTransform(1,n),t?t.push(n):t=[n]),e=e.parentNode;return t},VH=[],HH=[],nue=function(){return AH.pageYOffset||kH.scrollTop||jH.scrollTop||MH.scrollTop||0},rue=function(){return AH.pageXOffset||kH.scrollLeft||jH.scrollLeft||MH.scrollLeft||0},UH=function(e){return e.ownerSVGElement||((e.tagName+``).toLowerCase()===`svg`?e:null)},iue=function e(t){if(AH.getComputedStyle(t).position===`fixed`)return!0;if(t=t.parentNode,t&&t.nodeType===1)return e(t)},WH=function e(t,n){if(t.parentNode&&(kH||BH(t))){var r=UH(t),i=r?r.getAttribute(`xmlns`)||`http://www.w3.org/2000/svg`:`http://www.w3.org/1999/xhtml`,a=r?n?`rect`:`g`:`div`,o=n===2?100:0,s=n===3?100:0,c={position:`absolute`,display:`block`,pointerEvents:`none`,margin:`0`,padding:`0`},l=kH.createElementNS?kH.createElementNS(i.replace(/^https/,`http`),a):kH.createElement(a);return n&&(r?(PH||=e(t),l.setAttribute(`width`,.01),l.setAttribute(`height`,.01),l.setAttribute(`transform`,`translate(`+o+`,`+s+`)`),l.setAttribute(`fill`,`transparent`),PH.appendChild(l)):(NH||(NH=e(t),Object.assign(NH.style,c)),Object.assign(l.style,c,{width:`0.1px`,height:`0.1px`,top:s+`px`,left:o+`px`}),NH.appendChild(l))),l}throw`Need document and parent.`},aue=function(e){for(var t=new KH,n=0;n1?aue(c):c.getItem(0).matrix:FH,u=c.a*l.x+c.c*l.y,d=c.b*l.x+c.d*l.y):(c=new KH,u=d=0),t&&e.tagName.toLowerCase()===`g`&&(u=d=0),(r||!e.getBoundingClientRect().width?n:a).appendChild(s),s.setAttribute(`transform`,`matrix(`+c.a+`,`+c.b+`,`+c.c+`,`+c.d+`,`+(c.e+u)+`,`+(c.f+d)+`)`);else{if(u=d=0,zH)for(c=e.offsetParent,l=e;(l&&=l.parentNode)&&l!==c&&l.parentNode;)(AH.getComputedStyle(l)[LH]+``).length>4&&(u=l.offsetLeft,d=l.offsetTop,l=0);if(f=AH.getComputedStyle(e),f.position!==`absolute`&&f.position!==`fixed`)for(c=e.offsetParent;a&&a!==c;)u+=a.scrollLeft||0,d+=a.scrollTop||0,a=a.parentNode;l=s.style,l.top=e.offsetTop-d+`px`,l.left=e.offsetLeft-u+`px`,l[LH]=f[LH],l[RH]=f[RH],l.position=f.position===`fixed`?`fixed`:`absolute`,o.appendChild(s)}return s},GH=function(e,t,n,r,i,a,o){return e.a=t,e.b=n,e.c=r,e.d=i,e.e=a,e.f=o,e},KH=function(){function e(e,t,n,r,i,a){e===void 0&&(e=1),t===void 0&&(t=0),n===void 0&&(n=0),r===void 0&&(r=1),i===void 0&&(i=0),a===void 0&&(a=0),GH(this,e,t,n,r,i,a)}var t=e.prototype;return t.inverse=function(){var e=this.a,t=this.b,n=this.c,r=this.d,i=this.e,a=this.f,o=e*r-t*n||1e-10;return GH(this,r/o,-t/o,-n/o,e/o,(n*a-r*i)/o,-(e*a-t*i)/o)},t.multiply=function(e){var t=this.a,n=this.b,r=this.c,i=this.d,a=this.e,o=this.f,s=e.a,c=e.c,l=e.b,u=e.d,d=e.e,f=e.f;return GH(this,s*t+l*r,s*n+l*i,c*t+u*r,c*n+u*i,a+d*t+f*r,o+d*n+f*i)},t.clone=function(){return new e(this.a,this.b,this.c,this.d,this.e,this.f)},t.equals=function(e){var t=this.a,n=this.b,r=this.c,i=this.d,a=this.e,o=this.f;return t===e.a&&n===e.b&&r===e.c&&i===e.d&&a===e.e&&o===e.f},t.apply=function(e,t){t===void 0&&(t={});var n=e.x,r=e.y,i=this.a,a=this.b,o=this.c,s=this.d,c=this.e,l=this.f;return t.x=n*i+r*o+c||0,t.y=n*a+r*s+l||0,t},e}();function qH(e,t,n,r){if(!e||!e.parentNode||(kH||BH(e)).documentElement===e)return new KH;var i=tue(e),a=UH(e)?VH:HH,o=sue(e,n),s=a[0].getBoundingClientRect(),c=a[1].getBoundingClientRect(),l=a[2].getBoundingClientRect(),u=o.parentNode,d=!r&&iue(e),f=new KH((c.left-s.left)/100,(c.top-s.top)/100,(l.left-s.left)/100,(l.top-s.top)/100,s.left+(d?0:rue()),s.top+(d?0:nue()));if(u.removeChild(o),i)for(s=i.length;s--;)c=i[s],c.scaleX=c.scaleY=0,c.renderTransform(1,c);return t?f.inverse():f}var cue=`x,translateX,left,marginLeft,xPercent`.split(`,`),lue=`y,translateY,top,marginTop,yPercent`.split(`,`),uue=Math.PI/180,JH,YH,XH,ZH,QH,$H,due=function(){return JH||typeof window<`u`&&(JH=window.gsap)&&JH.registerPlugin&&JH},eU=function(e,t,n,r){for(var i=t.length,a=r===2?0:r,o=0;o1?e=1:e<0&&(e=0);r--;)vH(n[r],e,!r&&t.rotate,n[r]);for(;i;)i.set(i.t,i.p,i.path[i.pp]+i.u,i.d,e),i=i._next;t.rotate&&t.rSet(t.target,t.rProp,n[0].angle*(t.radians?uue:1)+t.rOffset+t.ru,t,e)}else t.styles.revert()},getLength:function(e){return hH(fH(e)).totalLength},sliceRawPath:mH,getRawPath:fH,pointsToSegment:xH,stringToRawPath:bH,rawPathToString:SH,transformRawPath:yH,getGlobalMatrix:qH,getPositionOnPath:vH,cacheRawPathMeasurements:hH,convertToPath:function(e,t){return ZH(e).map(function(e){return Wle(e,t!==!1)})},convertCoordinates:function(e,t,n){var r=qH(t,!0,!0).multiply(qH(e));return n?r.apply(n):r},getAlignMatrix:aU,getRelativePosition:function(e,t,n,r){var i=aU(e,t,n,r);return{x:i.e,y:i.f}},arrayToRawPath:function(e,t){t||={};var n=eU(eU([],e,t.x||`x`,0),e,t.y||`y`,1);return t.relative&&nU(n),[t.type===`cubic`?n:xH(n,t.curviness)]}};due()&&JH.registerPlugin(cU);var hue=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function lU(e){return typeof e==`string`&&hue.includes(e)}var gue=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function uU(e){return typeof e==`string`&&gue.has(e)}function dU(e){return typeof e==`string`&&e.startsWith(`data-`)}function fU(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(uU(n)||dU(n))&&(t[n]=e[n]);return t}function pU(e){if(e==null)return null;if((0,v.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return fU(t)}return typeof e==`object`&&!Array.isArray(e)?fU(e):null}function mU(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(uU(n)||dU(n)||lU(n))&&(t[n]=e[n]);return t}function _ue(e){return e==null?null:(0,v.isValidElement)(e)?mU(e.props):typeof e==`object`&&!Array.isArray(e)?mU(e):null}var vue=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function hU(){return hU=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=yue(e,vue),d=a||{width:r,height:i,x:0,y:0},f=Is(`recharts-surface`,o);return v.createElement(`svg`,hU({},mU(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),v.createElement(`title`,null,c),v.createElement(`desc`,null,l),n)}),xue=[`children`,`className`];function _U(){return _U=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.className,i=Sue(e,xue),a=Is(`recharts-layer`,r);return v.createElement(`g`,_U({className:a},mU(i),{ref:t}),n)});function yU(e){return e===`__proto__`}var wue=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function bU(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:wue.test(e);default:return!1}}function xU(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function SU(e){return typeof e==`symbol`||e instanceof Symbol}function Tue(e){return e==null?``:CU(e)}function CU(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(CU).join(`,`);if(SU(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function wU(e){if(Array.isArray(e))return e.map(xU);if(typeof e==`symbol`)return[e];e=Tue(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r1&&arguments[1]!==void 0?arguments[1]:Due),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function DU(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+EU(i)+n},``)}var OU=e=>e===0?0:e>0?1:-1,kU=e=>typeof e==`number`&&e!=+e,AU=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,jU=e=>(typeof e==`number`||e instanceof Number)&&!kU(e),MU=e=>jU(e)||typeof e==`string`,Oue=0,NU=e=>{var t=++Oue;return`${e||``}${t}`},PU=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!jU(e)&&typeof e!=`string`)return n;var i;if(AU(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return kU(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},FU=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&(typeof t==`function`?t(e):TU(e,t))===n)}var RU=e=>e==null,zU=e=>RU(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function BU(e){return e!=null}function VU(){}function HU(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function UU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function WU(e){for(var t=1;t{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=HU(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?WU({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?WU({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?WU({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?WU({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?WU({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?WU({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?WU({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?WU({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(jU(n.x)||AU(n.x))&&(jU(n.y)||AU(n.y))?WU({x:c+PU(n.x,g),y:l+PU(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):WU({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},Nue=[`top`,`left`,`right`,`bottom`];function Pue(e){return e==null?!1:typeof e==`object`||Nue.includes(e)}var Fue=(0,v.createContext)(null);function GU(e){return function(){return e}}var KU=Math.PI,qU=2*KU,JU=1e-6,Iue=qU-JU;function YU(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return YU;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tJU){if(!(Math.abs(u*s-c*l)>JU)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((KU-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>JU&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>JU||Math.abs(this._y1-l)>JU)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%qU+qU),d>Iue?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>JU&&this._append`A${n},${n},0,${+(d>=KU)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};XU.prototype;function ZU(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new XU(t)}Array.prototype.slice;function QU(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function $U(e){this._context=e}$U.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function eW(e){return new $U(e)}function tW(e){return e[0]}function nW(e){return e[1]}function rW(e,t){var n=GU(!0),r=null,i=eW,a=null,o=ZU(s);e=typeof e==`function`?e:e===void 0?tW:GU(e),t=typeof t==`function`?t:t===void 0?nW:GU(t);function s(s){var c,l=(s=QU(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return rW().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:GU(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:GU(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:GU(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:GU(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:GU(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:GU(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:GU(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var aW=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function Rue(e){return new aW(e,!0)}function zue(e){return new aW(e,!1)}function oW(){}function sW(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function cW(e){this._context=e}cW.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:sW(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:sW(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Bue(e){return new cW(e)}function lW(e){this._context=e}lW.prototype={areaStart:oW,areaEnd:oW,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:sW(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Vue(e){return new lW(e)}function uW(e){this._context=e}uW.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:sW(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Hue(e){return new uW(e)}function dW(e){this._context=e}dW.prototype={areaStart:oW,areaEnd:oW,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Uue(e){return new dW(e)}function fW(e){return e<0?-1:1}function pW(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(fW(a)+fW(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function mW(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function hW(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function gW(e){this._context=e}gW.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:hW(this,this._t0,mW(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,hW(this,mW(this,n=pW(this,e,t)),n);break;default:hW(this,this._t0,n=pW(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function _W(e){this._context=new vW(e)}(_W.prototype=Object.create(gW.prototype)).point=function(e,t){gW.prototype.point.call(this,t,e)};function vW(e){this._context=e}vW.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function Wue(e){return new gW(e)}function Gue(e){return new _W(e)}function yW(e){this._context=e}yW.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=bW(e),i=bW(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function que(e){return new xW(e,.5)}function Jue(e){return new xW(e,0)}function Yue(e){return new xW(e,1)}function SW(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function Xue(e,t){return e[t]}function Zue(e){let t=[];return t.key=e,t}function Que(){var e=GU([]),t=CW,n=SW,r=Xue;function i(i){var a=Array.from(e.apply(this,arguments),Zue),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r`radius`in e&&`startAngle`in e&&`endAngle`in e,wW=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,v.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{lU(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},rde=(e,t,n)=>r=>(e(t,n,r),null),ide=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];lU(i)&&typeof a==`function`&&(r||={},r[i]=rde(a,t,n))}),r};function TW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ade(e){for(var t=1;t(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function lde(e){return Number.isSafeInteger(e)&&e>=0}function DW(e){return e!=null&&typeof e!=`function`&&lde(e.length)}function OW(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function kW(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var AW=`[object RegExp]`,jW=`[object String]`,MW=`[object Number]`,NW=`[object Boolean]`,ude=`[object Arguments]`,PW=`[object Symbol]`,FW=`[object Date]`,IW=`[object Map]`,LW=`[object Set]`,RW=`[object Array]`,dde=`[object Function]`,zW=`[object ArrayBuffer]`,BW=`[object Object]`,fde=`[object Error]`,VW=`[object DataView]`,HW=`[object Uint8Array]`,UW=`[object Uint8ClampedArray]`,WW=`[object Uint16Array]`,GW=`[object Uint32Array]`,pde=`[object BigUint64Array]`,KW=`[object Int8Array]`,qW=`[object Int16Array]`,JW=`[object Int32Array]`,mde=`[object BigInt64Array]`,YW=`[object Float32Array]`,XW=`[object Float64Array]`,ZW=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function QW(e){return ZW.Buffer!==void 0&&ZW.Buffer.isBuffer(e)}function $W(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function eG(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}var hde=/^(?:0|[1-9]\d*)$/;function tG(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e{var t=d(),n=P_();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),_de=o(((e,t)=>{t.exports=gde()})),nG=(0,v.createContext)(null),vde=_de(),yde=e=>e,rG=()=>{var e=(0,v.useContext)(nG);return e?e.store.dispatch:yde},iG=()=>{},bde=()=>iG,xde=(e,t)=>e===t;function aG(e){var t=(0,v.useContext)(nG),n=(0,v.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:iG,[t,e]);return(0,vde.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:bde,t?t.store.getState:iG,t?t.store.getState:iG,n,xde)}function Sde(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function Cde(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var oG=e=>Array.isArray(e)?e:[e];function wde(e){let t=Array.isArray(e[0])?e[0]:e;return Cde(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Tde(e,t){let n=[],{length:r}=e;for(let i=0;i`u`?Ede:WeakRef,Dde=0,cG=1;function lG(){return{s:Dde,v:void 0,o:null,p:null}}function Ode(e){return e instanceof sG?e.deref():e}function uG(e,t={}){let n=lG(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e{n=lG(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function kde(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),Sde(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=uG,argsMemoizeOptions:u=[]}={...n,...a},d=oG(c),f=oG(u),p=wde(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=Tde(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var $=kde(uG);function Ade(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a{if(e!==t){let r=fG(e),i=fG(t);if(r===i&&r===0){if(et)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},Mde=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Nde=/^\w*$/;function Pde(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||SU(e)?!0:typeof e==`string`&&(Nde.test(e)||!Mde.test(e))||t!=null&&Object.hasOwn(t,e)}function Fde(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=DW(e)?Array.from(e):Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||Pde(e)?e:{key:e,path:wU(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;re.original)}function pG(e,...t){let n=t.length;return n>1&&dG(e,t[0],t[1])?t=[]:n>2&&dG(t[0],t[1],t[2])&&(t=[t[0]]),Fde(e,Ade(t),[`asc`])}var mG=e=>e.legend.settings,Ide=e=>e.legend.size;$([e=>e.legend.payload,mG],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?pG(r,n):r});function hG(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var gG=typeof Symbol==`function`&&Symbol.observable||`@@observable`,_G=()=>Math.random().toString(36).substring(7).split(``).join(`.`),vG={INIT:`@@redux/INIT${_G()}`,REPLACE:`@@redux/REPLACE${_G()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${_G()}`};function yG(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function bG(e,t,n){if(typeof e!=`function`)throw Error(hG(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(hG(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(hG(1));return n(bG)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(hG(3));return i}function d(e){if(typeof e!=`function`)throw Error(hG(4));if(c)throw Error(hG(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(hG(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!yG(e))throw Error(hG(7));if(e.type===void 0)throw Error(hG(8));if(typeof e.type!=`string`)throw Error(hG(17));if(c)throw Error(hG(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(hG(10));r=e,f({type:vG.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(hG(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[gG](){return this}}}return f({type:vG.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[gG]:m}}function Lde(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:vG.INIT})===void 0)throw Error(hG(12));if(n(void 0,{type:vG.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(hG(13))})}function xG(e){let t=Object.keys(e),n={};for(let r=0;re:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function Rde(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(hG(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=SG(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function CG(e){return yG(e)&&`type`in e&&typeof e.type==`string`}var wG=Symbol.for(`immer-nothing`),TG=Symbol.for(`immer-draftable`),EG=Symbol.for(`immer-state`);function DG(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var OG=Object,kG=OG.getPrototypeOf,AG=`constructor`,jG=`prototype`,MG=`configurable`,NG=`enumerable`,PG=`writable`,FG=`value`,IG=e=>!!e&&!!e[EG];function LG(e){return e?zG(e)||GG(e)||!!e[TG]||!!e[AG]?.[TG]||KG(e)||qG(e):!1}var zde=OG[jG][AG].toString(),RG=new WeakMap;function zG(e){if(!e||!JG(e))return!1;let t=kG(e);if(t===null||t===OG[jG])return!0;let n=OG.hasOwnProperty.call(t,AG)&&t[AG];if(n===Object)return!0;if(!YG(n))return!1;let r=RG.get(n);return r===void 0&&(r=Function.toString.call(n),RG.set(n,r)),r===zde}function BG(e,t,n=!0){VG(e)===0?(n?Reflect.ownKeys(e):OG.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function VG(e){let t=e[EG];return t?t.type_:GG(e)?1:KG(e)?2:qG(e)?3:0}var HG=(e,t,n=VG(e))=>n===2?e.has(t):OG[jG].hasOwnProperty.call(e,t),UG=(e,t,n=VG(e))=>n===2?e.get(t):e[t],WG=(e,t,n,r=VG(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function Bde(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var GG=Array.isArray,KG=e=>e instanceof Map,qG=e=>e instanceof Set,JG=e=>typeof e==`object`,YG=e=>typeof e==`function`,XG=e=>typeof e==`boolean`;function Vde(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var ZG=e=>e.copy_||e.base_,QG=e=>e.modified_?e.copy_:e.base_;function $G(e,t){if(KG(e))return new Map(e);if(qG(e))return new Set(e);if(GG(e))return Array[jG].slice.call(e);let n=zG(e);if(t===!0||t===`class_only`&&!n){let t=OG.getOwnPropertyDescriptors(e);delete t[EG];let n=Reflect.ownKeys(t);for(let r=0;r1&&OG.defineProperties(e,{set:tK,add:tK,clear:tK,delete:tK}),OG.freeze(e),t&&BG(e,(e,t)=>{eK(t,!0)},!1),e)}function Hde(){DG(2)}var tK={[FG]:Hde};function nK(e){return e===null||!JG(e)||OG.isFrozen(e)}var rK=`MapSet`,iK=`Patches`,aK=`ArrayMethods`,oK={};function sK(e){let t=oK[e];return t||DG(0,e),t}var cK=e=>!!oK[e],lK,uK=()=>lK,Ude=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:cK(rK)?sK(rK):void 0,arrayMethodsPlugin_:cK(aK)?sK(aK):void 0});function dK(e,t){t&&(e.patchPlugin_=sK(iK),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fK(e){pK(e),e.drafts_.forEach(Wde),e.drafts_=null}function pK(e){e===lK&&(lK=e.parent_)}var mK=e=>lK=Ude(lK,e);function Wde(e){let t=e[EG];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function hK(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[EG].modified_&&(fK(t),DG(4)),LG(e)&&(e=gK(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[EG].base_,e,t)}else e=gK(t,n);return Gde(t,e,!0),fK(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===wG?void 0:e}function gK(e,t){if(nK(t))return t;let n=t[EG];if(!n)return xK(t,e.handledSet_,e);if(!vK(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);bK(n,e)}return n.copy_}function Gde(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&eK(t,n)}function _K(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var vK=(e,t)=>e.scope_===t,Kde=[];function yK(e,t,n,r){let i=ZG(e),a=e.type_;if(r!==void 0&&UG(i,r,a)===t){WG(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;BG(i,(e,n)=>{if(IG(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??Kde;for(let e of o)WG(i,e,n,a)}function qde(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!vK(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=QG(i);yK(e,i.draft_??i,a,n),bK(i,r)})}function bK(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}_K(e)}}function Jde(e,t,n){let{scope_:r}=e;if(IG(n)){let i=n[EG];vK(i,r)&&i.callbacks_.push(function(){DK(e),yK(e,n,QG(i),t)})}else LG(n)&&e.callbacks_.push(function(){let i=ZG(e);e.type_===3?i.has(n)&&xK(n,r.handledSet_,r):UG(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&xK(UG(e.copy_,t,e.type_),r.handledSet_,r)})}function xK(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||IG(e)||t.has(e)||!LG(e)||nK(e)?e:(t.add(e),BG(e,(r,i)=>{if(IG(i)){let t=i[EG];vK(t,n)&&(WG(e,r,QG(t),e.type_),_K(t))}else LG(i)&&xK(i,t,n)}),e)}function Yde(e,t){let n=GG(e),r={type_:+!!n,scope_:t?t.scope_:uK(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=SK;n&&(i=[r],a=CK);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var SK={get(e,t){if(t===EG)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=ZG(e);if(!HG(i,t,e.type_))return Zde(e,i,t);let a=i[t];if(e.finalized_||!LG(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&Vde(t))return a;if(a===wK(e.base_,t)||Xde(e,t,a)){DK(e);let n=e.type_===1?+t:t,r=OK(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in ZG(e)},ownKeys(e){return Reflect.ownKeys(ZG(e))},set(e,t,n){let r=TK(ZG(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=wK(ZG(e),t),i=r?.[EG];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(Bde(n,r)&&(n!==void 0||HG(e.base_,t,e.type_)))return!0;DK(e),EK(e)}return e.copy_[t]===n&&(n!==void 0||HG(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),Jde(e,t,n),!0)},deleteProperty(e,t){return DK(e),wK(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),EK(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=ZG(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[PG]:!0,[MG]:e.type_!==1||t!==`length`,[NG]:r[NG],[FG]:n[t]}},defineProperty(){DG(11)},getPrototypeOf(e){return kG(e.base_)},setPrototypeOf(){DG(12)}},CK={};for(let e in SK){let t=SK[e];CK[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}CK.deleteProperty=function(e,t){return CK.set.call(this,e,t,void 0)},CK.set=function(e,t,n){return SK.set.call(this,e[0],t,n,e[0])};function wK(e,t){let n=e[EG];return(n?ZG(n):e)[t]}function Xde(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!LG(n)||n[EG]?!1:e.baseRefs_.has(n)}function Zde(e,t,n){let r=TK(t,n);return r?FG in r?r[FG]:r.get?.call(e.draft_):void 0}function TK(e,t){if(!(t in e))return;let n=kG(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=kG(n)}}function EK(e){e.modified_||(e.modified_=!0,e.parent_&&EK(e.parent_))}function DK(e){e.copy_||=(e.assigned_=new Map,$G(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Qde=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(YG(e)&&!YG(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}YG(t)||DG(6),n!==void 0&&!YG(n)&&DG(7);let r;if(LG(e)){let i=mK(this),a=OK(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?fK(i):pK(i)}return dK(i,n),hK(r,i)}if(!e||!JG(e)){if(r=t(e),r===void 0&&(r=e),r===wG&&(r=void 0),this.autoFreeze_&&eK(r,!0),n){let t=[],i=[];sK(iK).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}DG(1,e)},this.produceWithPatches=(e,t)=>{if(YG(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},XG(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),XG(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),XG(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){LG(e)||DG(8),IG(e)&&(e=kK(e));let t=mK(this),n=OK(t,e,void 0);return n[EG].isManual_=!0,pK(t),n}finishDraft(e,t){let n=e&&e[EG];(!n||!n.isManual_)&&DG(9);let{scope_:r}=n;return dK(r,t),hK(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=sK(iK).applyPatches_;return IG(e)?r(e,t):this.produce(e,e=>r(e,t))}};function OK(e,t,n,r){let[i,a]=KG(t)?sK(rK).proxyMap_(t,n):qG(t)?sK(rK).proxySet_(t,n):Yde(t,n);return(n?.scope_??uK()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?qde(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function kK(e){return IG(e)||DG(10,e),AK(e)}function AK(e){if(!LG(e)||nK(e))return e;let t=e[EG],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=$G(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=$G(e,!0);return BG(n,(e,t)=>{WG(n,e,AK(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var jK=new Qde().produce,MK=e=>e;function NK(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var $de=NK(),efe=NK,tfe=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?SG:SG.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function PK(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(_q(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>CG(t)&&t.type===e,n}var FK=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function IK(e){return LG(e)?jK(e,()=>{}):e}function LK(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function nfe(e){return typeof e==`boolean`}var rfe=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new FK;return t&&(nfe(t)?a.push($de):a.push(efe(t.extraArgument))),a},RK=`RTK_autoBatch`,zK=()=>e=>({payload:e,meta:{[RK]:!0}}),BK=e=>t=>{setTimeout(t,e)},ife=(e,t)=>n=>{let r=!1,i=()=>{r||(r=!0,cancelAnimationFrame(a),clearTimeout(o),n())},a=e(i),o=setTimeout(i,t)},VK=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?ife(window.requestAnimationFrame,100):BK(10):e.type===`callback`?e.queueNotification:BK(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[RK],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},afe=e=>function(t){let{autoBatch:n=!0}=t??{},r=new FK(e);return n&&r.push(VK(typeof n==`object`?n:void 0)),r};function ofe(e){let t=rfe(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(yG(n))c=xG(n);else throw Error(_q(1));let l;l=typeof r==`function`?r(t):t();let u=SG;i&&(u=tfe({trace:!1,...typeof i==`object`&&i}));let d=afe(Rde(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return bG(c,o,p)}function HK(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(_q(28));if(r in t)throw Error(_q(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function sfe(e){return typeof e==`function`}function cfe(e,t){let[n,r,i]=HK(t),a;if(sfe(e))a=()=>IK(e());else{let t=IK(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n){if(IG(e)){let r=n(e,t);return r===void 0?e:r}if(LG(e))return jK(e,e=>n(e,t));{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}}return e},e)}return o.getInitialState=a,o}var lfe=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,ufe=(e=21)=>{let t=``,n=e;for(;n--;)t+=lfe[Math.random()*64|0];return t},dfe=Symbol.for(`rtk-slice-createasyncthunk`);function ffe(e,t){return`${e}/${t}`}function pfe({creators:e}={}){let t=e?.asyncThunk?.[dfe];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(_q(11));let i=(typeof e.reducers==`function`?e.reducers(hfe()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(_q(12));if(n in o.sliceCaseReducersByType)throw Error(_q(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:ffe(n,r),createNotation:typeof e.reducers==`function`};_fe(a)?yfe(o,a,s,t):gfe(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?HK(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return cfe(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=LK(d,r,m)),i}function i(t=l){return LK(LK(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=mfe(a,t,()=>LK(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function mfe(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var UK=pfe();function hfe(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function gfe({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!vfe(r))throw Error(_q(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?PK(e,o):PK(e))}function _fe(e){return e._reducerDefinitionType===`asyncThunk`}function vfe(e){return e._reducerDefinitionType===`reducerWithPrepare`}function yfe({type:e,reducerName:t},n,r,i){if(!i)throw Error(_q(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||WK,pending:s||WK,rejected:c||WK,settled:l||WK})}function WK(){}var bfe=`task`,GK=`listener`,KK=`completed`,qK=`cancelled`,xfe=`task-${qK}`,Sfe=`task-${KK}`,JK=`${GK}-${qK}`,Cfe=`${GK}-${KK}`,YK=class{constructor(e){this.code=e,this.message=`${bfe} ${qK} (reason: ${e})`}code;name=`TaskAbortError`;message},XK=(e,t)=>{if(typeof e!=`function`)throw TypeError(_q(32))},ZK=()=>{},QK=(e,t=ZK)=>(e.catch(t),e),$K=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),eq=e=>{if(e.aborted)throw new YK(e.reason)};function tq(e,t){let n=ZK;return new Promise((r,i)=>{let a=()=>i(new YK(e.reason));if(e.aborted){a();return}n=$K(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=ZK})}var wfe=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof YK?`cancelled`:`rejected`,error:e}}finally{t?.()}},nq=e=>t=>QK(tq(e,t).then(t=>(eq(e),t))),rq=e=>{let t=nq(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:iq}=Object,aq={},oq=`listenerMiddleware`,Tfe=(e,t)=>{let n=t=>$K(e,()=>t.abort(e.reason));return(r,i)=>{XK(r,`taskExecutor`);let a=new AbortController;n(a);let o=wfe(async()=>{eq(e),eq(a.signal);let t=await r({pause:nq(a.signal),delay:rq(a.signal),signal:a.signal});return eq(a.signal),t},()=>a.abort(Sfe));return i?.autoJoin&&t.push(o.catch(ZK)),{result:nq(e)(o),cancel(){a.abort(xfe)}}}},Efe=(e,t)=>{let n=async(n,r)=>{eq(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await tq(t,Promise.race(a));return eq(t),e}finally{i()}};return((e,t)=>QK(n(e,t)))},sq=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=PK(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(_q(21));return XK(a,`options.listener`),{predicate:i,type:t,effect:a}},cq=iq(e=>{let{type:t,predicate:n,effect:r}=sq(e);return{id:ufe(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(_q(22))}}},{withTypes:()=>cq}),lq=(e,t)=>{let{type:n,effect:r,predicate:i}=sq(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},uq=e=>{e.pending.forEach(e=>{e.abort(JK)})},Dfe=(e,t)=>()=>{for(let e of t.keys())uq(e);e.clear()},dq=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},fq=iq(PK(`${oq}/add`),{withTypes:()=>fq}),pq=PK(`${oq}/removeAll`),mq=iq(PK(`${oq}/remove`),{withTypes:()=>mq}),hq=(...e)=>{console.error(`${oq}/error`,...e)},gq=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=hq}=e;XK(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&uq(e)}),c=(e=>{let n=lq(t,e)??cq(e);return s(n)});iq(c,{withTypes:()=>c});let l=e=>{let n=lq(t,e);return n&&(n.unsubscribe(),e.cancelActive&&uq(n)),!!n};iq(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=Efe(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,iq({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:rq(u.signal),pause:nq(u.signal),extra:a,signal:u.signal,fork:Tfe(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(JK),n.delete(e))})},cancel:()=>{u.abort(JK),e.pending.delete(u)},throwIfCancelled:()=>{eq(u.signal)}})))}catch(e){e instanceof YK||dq(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(Cfe),i(e),e.pending.delete(u)}},d=Dfe(t,n);return{middleware:e=>n=>r=>{if(!CG(r))return n(r);if(fq.match(r))return c(r.payload);if(pq.match(r)){d();return}if(mq.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===aq)throw Error(_q(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,dq(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=aq}return s},startListening:c,stopListening:l,clearListeners:d}};function _q(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var vq=UK({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),yq=vq.actions,bq=yq.setMargin,xq=yq.setLayout,Sq=yq.setChartSize,Cq=yq.setScale,wq=vq.reducer;function Tq(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function Eq(e){return Number.isFinite(e)}function Dq(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function Oq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function kq(e){for(var t=1;t{if(t&&n){var r=n.width,i=n.height,a=t.align,o=t.verticalAlign,s=t.layout,c=t.position,l=t.offset,u=l===void 0?0:l;if(c!=null){if(Pue(c)){if(c===`top`&&jU(e.top))return kq(kq({},e),{},{top:e.top+(i||0)+u});if(c===`bottom`&&jU(e.bottom))return kq(kq({},e),{},{bottom:e.bottom+(i||0)+u});if(c===`left`&&jU(e.left))return kq(kq({},e),{},{left:e.left+(r||0)+u});if(c===`right`&&jU(e.right))return kq(kq({},e),{},{right:e.right+(r||0)+u})}return e}if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&jU(e[a]))return kq(kq({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&jU(e[o]))return kq(kq({},e),{},{[o]:e[o]+(i||0)})}return e},Fq=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,Iq=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},Lq=(e,t,n)=>{if(!e)return null;var r=e.duplicateDomain,i=e.type,a=e.range,o=e.scale,s=e.realScaleType,c=e.isCategorical,l=e.categoricalDomain,u=e.tickCount,d=e.ticks,f=e.niceTicks,p=e.axisType;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?OU(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return Eq(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(BU):c&&l?l.map((e,t)=>{var n=o.map(e);return Eq(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(BU):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return Eq(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(BU):o.domain().map((e,t)=>{var n=o.map(e);return Eq(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(BU)},Rq={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:$ue,none:SW,silhouette:ede,wiggle:tde,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},zq=(e,t,n)=>{var r=Rq[n]??SW,i=Que().keys(t).value((e,t)=>Number(Nq(e,t,0))).order(CW).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=Nq(e[i],t[r],0);Array.isArray(a)&&a.length===2&&jU(a[0])&&jU(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function Bq(e){return e==null?void 0:String(e)}function Vq(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!RU(i[t.dataKey])){var s=LU(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=Nq(i,RU(o)?t.dataKey:o),l=t.scale.map(c);return jU(l)?l:null}var Hq=e=>{var t=e.flat(2).filter(jU);return[Math.min(...t),Math.max(...t)]},Uq=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],Wq=(e,t,n)=>{if(e!=null&&Object.keys(e).length!==0)return Uq(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var o=a.stackedData.reduce((e,r)=>{var i=Hq(Tq(r,t,n));return!Eq(i[0])||!Eq(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(o[0],r[0]),Math.max(o[1],r[1])]},[1/0,-1/0]))},Gq=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Kq=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,qq=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=pG(t,e=>e.coordinate),a=[],o=0,s=1,c=i.length;su&&(d=Math.min(f,d));return d===1/0?0:d}return n?void 0:0};function Jq(e){var t=e.tooltipEntrySettings,n=e.dataKey,r=e.payload,i=e.value,a=e.name;return kq(kq({},t),{},{dataKey:n,payload:r,value:i,name:a})}function Yq(e,t){if(e!=null)return String(e);if(typeof t==`string`)return t}var Xq=(e,t)=>{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},Zq=(e,t)=>t===`centric`?e.angle:e.radius,Qq=e=>e.layout.width,$q=e=>e.layout.height,eJ=e=>e.layout.scale,tJ=e=>e.layout.margin,nJ=$(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),rJ=$(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),iJ=`data-recharts-item-index`;function aJ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function oJ(e){for(var t=1;te.brush.height;function dJ(e){return rJ(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function fJ(e){return rJ(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function pJ(e){return nJ(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}function mJ(e){return nJ(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}var hJ=$([Qq,$q,tJ,uJ,dJ,fJ,pJ,mJ,mG,Ide],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=oJ(oJ({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=Pq(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return oJ(oJ({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),gJ=$(hJ,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),_J=$(Qq,$q,(e,t)=>({x:0,y:0,width:e,height:t})),vJ=(0,v.createContext)(null),yJ=()=>(0,v.useContext)(vJ)!=null,bJ=e=>e.brush,xJ=$([bJ,hJ,tJ],(e,t,n)=>({height:e.height,x:jU(e.x)?e.x:t.left,y:jU(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:jU(e.width)?e.width:t.width}));function SJ(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function CJ(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=SJ(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?((r||i)&&(s=e.apply(this,t)),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function wJ(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return CJ(e,t,{leading:r,maxWait:t,trailing:i})}var TJ=function(e,t){var n=[...arguments].slice(2);if(typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e)){if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}}},EJ={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},DJ=(e,t,n)=>{var r=n.width,i=r===void 0?EJ.width:r,a=n.height,o=a===void 0?EJ.height:a,s=n.aspect,c=n.maxHeight,l=AU(i)?e:Number(i),u=AU(o)?t:Number(o);return s&&s>0&&(l?u=l/s:u&&(l=u*s),c&&u!=null&&u>c&&(u=c)),{calculatedWidth:l,calculatedHeight:u}},OJ={width:0,height:0,overflow:`visible`},kJ={width:0,overflowX:`visible`},AJ={height:0,overflowY:`visible`},jJ={},MJ=e=>{var t=e.width,n=e.height,r=AU(t),i=AU(n);return r&&i?OJ:r?kJ:i?AJ:jJ};function NJ(e){var t=e.width,n=e.height,r=e.aspect,i=t,a=n;return i===void 0&&a===void 0?(i=EJ.width,a=EJ.height):i===void 0?i=r&&r>0?void 0:EJ.width:a===void 0&&(a=r&&r>0?void 0:EJ.height),{width:i,height:a}}var PJ=[`aspect`,`initialDimension`,`width`,`height`,`minWidth`,`minHeight`,`maxHeight`,`children`,`debounce`,`id`,`className`,`onResize`,`style`];function FJ(){return FJ=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n({width:n,height:r}),[n,r]);return XJ(i)?v.createElement(YJ.Provider,{value:i},t):null}var QJ=()=>(0,v.useContext)(YJ),$J=(0,v.forwardRef)((e,t)=>{var n=e.aspect,r=e.initialDimension,i=r===void 0?EJ.initialDimension:r,a=e.width,o=e.height,s=e.minWidth,c=s===void 0?EJ.minWidth:s,l=e.minHeight,u=e.maxHeight,d=e.children,f=e.debounce,p=f===void 0?EJ.debounce:f,m=e.id,h=e.className,g=e.onResize,_=e.style,y=_===void 0?{}:_,b=qJ(e,PJ),x=(0,v.useRef)(null),S=(0,v.useRef)();S.current=g,(0,v.useImperativeHandle)(t,()=>x.current);var C=VJ((0,v.useState)({containerWidth:i.width,containerHeight:i.height}),2),w=C[0],T=C[1],E=(0,v.useCallback)((e,t)=>{T(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,v.useEffect)(()=>{if(x.current==null||typeof ResizeObserver>`u`)return VU;var e=e=>{var t,n=e[0];if(n!=null){var r=n.contentRect,i=r.width,a=r.height;E(i,a),(t=S.current)==null||t.call(S,i,a)}};p>0&&(e=wJ(e,p,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=x.current.getBoundingClientRect(),r=n.width,i=n.height;return E(r,i),t.observe(x.current),()=>{t.disconnect()}},[E,p]);var D=w.containerWidth,O=w.containerHeight;TJ(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var k=DJ(D,O,{width:a,height:o,aspect:n,maxHeight:u}),A=k.calculatedWidth,j=k.calculatedHeight;return TJ(D<0||O<0||A!=null&&A>0||j!=null&&j>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the @@ -156,7 +156,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho [class*="animate-[inflight-queue-shimmer_"], [class*="animate-[inflight-glow_"]{animation:none!important} } - `}),c?null:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 px-4 py-3`,children:[(0,G.jsxs)(`button`,{type:`button`,"data-testid":`inflight-live-toggle`,"aria-expanded":f,"aria-controls":`inflight-live-body`,onClick:()=>p(!f),className:`flex min-w-0 flex-1 items-start gap-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2 focus-visible:ring-offset-background`,children:[(0,G.jsx)(gi,{size:14,"aria-hidden":!0,className:`mt-1 shrink-0 text-muted transition-transform duration-200 ${f?`rotate-90`:``}`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`inflightTitle`)}),(0,G.jsxs)(`span`,{className:`mono inline-flex items-center gap-1 rounded-[3px] px-1.5 py-0.5 text-caption text-muted`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":ne?`ok`:``}),e(ne?`inflightLiveBadge`:re?`inflightMockBadge`:`inflightIdleBadge`)]}),f&&ie>0?(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:e(`inflightStickyBindings`,{n:ie})}):null]}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:e(`inflightHint`)})]})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[f?(0,G.jsxs)(Sn,{to:`/live`,className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,"aria-label":e(`inflightCardAria`),onClick:e=>e.stopPropagation(),children:[e(`inflightOpen`),(0,G.jsx)(ii,{size:14,"aria-hidden":!0})]}):(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted transition-colors hover:text-foreground`,onClick:()=>p(!0),children:[e(`inflightExpand`),(0,G.jsx)(gi,{size:14,"aria-hidden":!0})]}),f&&!l?(0,G.jsx)(`div`,{className:`flex items-center gap-1.5`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:(0,G.jsx)(h7,{size:`sm`,isSelected:m,ariaLabel:e(`inflightMockToggleAria`),label:e(`inflightMockToggle`),onChange:g})}):null]})]}),f?(0,G.jsxs)(`div`,{id:`inflight-live-body`,ref:N,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 px-4 pb-1 pt-0 sm:grid-cols-4`,children:[(0,G.jsx)(T7,{label:e(`inflightWaiting`),value:M.waiting,warn:V}),(0,G.jsx)(T7,{label:e(`inflightRunning`),value:M.occupiedSlots,suffix:`/${M.workerSlots}`}),(0,G.jsx)(T7,{label:e(`inflightThroughput`),value:j.throughputPerMin,suffix:`/min`}),(0,G.jsx)(T7,{label:e(`inflightWaitP95`),value:j.waitP95Ms,kind:`ms`})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 px-4 py-3 lg:grid-cols-[minmax(11rem,0.7fr)_minmax(0,2.1fr)_auto]`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,"data-queue-col":!0,children:[(0,G.jsxs)(`div`,{className:`mb-1.5 flex items-baseline justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightQueue`)}),(0,G.jsx)(`span`,{className:`mono text-[10px] tabular ${V?`text-[var(--il-warn-fg)]`:`text-muted`}`,children:M.waiting})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[R.map(t=>(0,G.jsxs)(`div`,{"data-wait-pill":!0,"data-wait-id":t.id,"data-priority":t.priority??`normal`,className:`relative flex items-center justify-between gap-2 overflow-hidden rounded-xl px-2.5 py-2 ${zCe(t.kind)}`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 w-2/5 bg-gradient-to-r from-transparent via-[color-mix(in_oklab,var(--foreground)_8%,transparent)] to-transparent motion-safe:animate-[inflight-queue-shimmer_2.8s_linear_infinite]`}),(0,G.jsxs)(`span`,{className:`relative z-[1] flex min-w-0 items-center gap-2.5 truncate text-caption font-medium text-foreground/78`,children:[RCe(t.kind),(0,G.jsxs)(`span`,{className:`truncate`,children:[t.name,t.priority===`high`?(0,G.jsx)(`span`,{className:`mono ml-1 text-[10px] text-muted`,children:`↑`}):null,t.sticky?(0,G.jsx)(`span`,{className:`mono ml-1 text-[10px] text-muted`,children:e(`inflightSticky`)}):null]})]}),(0,G.jsx)(`span`,{className:`relative z-[1] mono shrink-0 text-caption text-muted`,children:S7(LCe(t,w))})]},t.id)),z.length?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 pt-1`,"data-queue-overflow":!0,children:[z.map(e=>(0,G.jsx)(`span`,{"data-wait-token":!0,"data-wait-id":e.id,"data-priority":e.priority??`normal`,className:`size-2 rounded-[2px] ${C7(e.kind)} ${e.priority===`high`?`ring-1 ring-foreground/20`:``}`,title:e.name},e.id)),(0,G.jsxs)(`span`,{className:`mono text-[10px] text-muted`,children:[`+`,z.length]})]}):R.length===0?(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e(`inflightQueueEmpty`)}):null]})]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`mb-1.5 flex items-baseline justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightSlots`)}),(0,G.jsxs)(`span`,{className:`mono text-[10px] tabular text-muted`,children:[M.occupiedSlots,`/`,M.workerSlots]})]}),(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,"data-worker-rail":!0,children:B.map(t=>(0,G.jsx)(VCe,{slot:t,jobById:L,clockMs:w,idleLabel:e(`inflightSlotIdle`),landedCellIds:E},t.id))})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 sm:gap-2.5 lg:w-[6.75rem] lg:flex-col lg:gap-2.5`,children:[(0,G.jsx)(E7,{label:e(`inflightDone`),value:j.totals.done,tone:`ok`,icon:(0,G.jsx)(Ei,{size:22,"aria-hidden":!0})}),(0,G.jsx)(E7,{label:e(`inflightFailed`),value:j.totals.failed,tone:`danger`,icon:(0,G.jsx)(yo,{size:22,"aria-hidden":!0})})]})]}),(0,G.jsxs)(`div`,{"data-depth":!0,className:`px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightDepth`)}),(0,G.jsx)(`span`,{className:`mono text-caption tabular text-muted`,children:te})]}),(0,G.jsx)(`div`,{className:`rounded-lg bg-[var(--il-item-bg)] px-1.5 pt-1.5 pb-1`,children:(0,G.jsx)(BCe,{series:j.depthSeries,bands:[],backpressure:j.backpressure,label:te})})]})]}):null]})}function T7({label:e,value:t,suffix:n,kind:r=`int`,warn:i}){return(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-caption uppercase tracking-wide text-muted`,children:e}),(0,G.jsxs)(`div`,{className:`mono mt-1 flex items-baseline gap-0.5 text-section font-semibold tabular ${i?`text-[var(--il-warn-fg)]`:`text-foreground`}`,children:[(0,G.jsx)(OV,{value:t,kind:r,duration:560}),n?(0,G.jsx)(`span`,{className:`text-[0.92em] opacity-80`,children:n}):null]})]})}function E7({label:e,value:t,tone:n,icon:r}){let i=n===`ok`;return(0,G.jsxs)(`div`,{"data-outcome":n,role:`group`,"aria-label":`${e}: ${t}`,title:`${e}: ${t}`,className:`flex min-h-28 min-w-[3.6rem] flex-1 flex-col items-center justify-center gap-2 rounded-2xl border px-3 py-4 ${i?`border-[color-mix(in_oklab,var(--success)_14%,transparent)] bg-[var(--il-ok-bg)]`:`border-[color-mix(in_oklab,var(--danger)_12%,transparent)] bg-[var(--il-err-bg)]`}`,children:[(0,G.jsx)(`span`,{className:`inline-flex size-12 items-center justify-center rounded-2xl ${i?`bg-[color-mix(in_oklab,var(--success)_14%,var(--surface))] text-[var(--il-ok-fg)]`:`bg-[color-mix(in_oklab,var(--danger)_12%,var(--surface))] text-[var(--il-err-fg)]`}`,"aria-hidden":!0,children:r}),(0,G.jsx)(`div`,{className:`mono text-[1.7rem] font-semibold tabular leading-none tracking-tight ${i?`text-[var(--il-ok-fg)]`:`text-[var(--il-err-fg)]`}`,children:(0,G.jsx)(OV,{value:t,kind:`int`,duration:560})}),(0,G.jsx)(`span`,{className:`text-caption font-medium ${i?`text-[color-mix(in_oklab,var(--success)_55%,var(--muted))]`:`text-[color-mix(in_oklab,var(--danger)_55%,var(--muted))]`}`,children:e})]})}function HCe(){return tI(`/api/live`)}var D7=2500,UCe=Math.round(6e4/D7);function WCe(e){let t=e?.intervalMs??2500,[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)([]);return(0,v.useEffect)(()=>{let e=!1,n=null,i=()=>{document.hidden||HCe().then(n=>{if(e)return;r(n);let i=Math.max(UCe,Math.round(6e4/t));a(e=>[...e,{at:Date.now(),value:n.in_flight}].slice(-i))}).catch(()=>{})},o=()=>{n||document.hidden||(i(),n=setInterval(i,t))},s=()=>{n&&clearInterval(n),n=null},c=()=>document.hidden?s():o();return o(),document.addEventListener(`visibilitychange`,c),()=>{e=!0,s(),document.removeEventListener(`visibilitychange`,c)}},[t]),{live:n,samples:i}}var GCe=(0,v.lazy)(()=>C(()=>import(`./TrafficChart-BMjlJkKA.js`).then(e=>({default:e.TrafficChart})),__vite__mapDeps([0,1]))),O7=3e4,KCe={window:{from:``,to:``,hours:24},totals:{requests:0,ok:0,incomplete:0,error:0,canceled:0,streaming:0,success_rate:0},latency:{},tokens:{prompt:0,completion:0,cache_read:0,total:0},status:[],errors:[],models:[],accounts:[],providers:[],series:[]};function qCe(e,t){return!e||e===`(unknown)`?t(`statsUnknown`):JV(e,t)}function JCe(e,t,n){return!t||t===`(unassigned)`?n:e.find(e=>e.id===t)?.name||t}var YCe=new Set([`quota`,`rate_limit`,`auth`,`not_ready`,`unavailable`,`invalid_request`,`model_not_available`]);function k7(e,t){let n={quota:`logsKindQuota`,rate_limit:`logsKindRateLimit`,auth:`logsKindAuth`,not_ready:`logsKindNotReady`,unavailable:`logsKindUnavailable`,invalid_request:`logsKindInvalidRequest`,model_not_available:`logsKindModelNotAvailable`};return n[e]?t(n[e]):e}var XCe=[`ok`,`incomplete`,`error`,`canceled`],A7={ok:`bg-success`,incomplete:`bg-warning`,error:`bg-danger`,canceled:`bg-muted`},j7={ok:`logsFilterOk`,incomplete:`logsFilterIncomplete`,error:`logsFilterError`,canceled:`logsFilterCanceled`};function M7(e,t){return t>0?e/t:null}function ZCe(e,t){if(!e)return null;let n=Date.parse(e);if(!Number.isFinite(n))return null;let r=Math.max(0,Math.round((n-t)/1e3));if(r<=0)return null;let i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60;return i?`${i}h ${a}m`:a?`${a}m ${String(o).padStart(2,`0`)}s`:`${o}s`}function QCe(e,t){let n=[e.down_until,e.cooldown_until].filter(e=>!!e).filter(e=>Date.parse(e)>t);return n.length?n.reduce((e,t)=>Date.parse(e)>=Date.parse(t)?e:t):null}function $Ce(e,t){return t?`danger`:(e??0)>=80?`warning`:`ok`}function ewe(){let{lang:e,t}=JF(),{overview:n,loading:r,error:i}=gI(),[a,o]=(0,v.useState)(`today`),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(!1),d=at(),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(!0),[y,b]=(0,v.useState)([]),[x,S]=(0,v.useState)(!0),[C,w]=(0,v.useState)(0),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(()=>Date.now()),[k,A]=(0,v.useState)(!1),[j,M]=(0,v.useState)(!1),{live:N,samples:P}=WCe({intervalMs:k?400:D7}),F=new Map((N?.accounts??[]).map(e=>[e.id,e])),I=!!n?.proxy?.ok,L=!!n?.worker?.ok,ee=n?.worker?.ready_count??0,R=n?.worker?.hot_count??0,z=N?.in_flight??n?.worker?.in_flight??0,B=f??KCe,V=n?.routing?.session_affinity,H=(V?.hits??0)+(V?.misses??0),te=M7(V?.hits??0,H),ne=y.map(e=>({account:e,until:QCe(e,D)})).filter(e=>e.until!=null),re=ne.length>0,ie=new Set(ne.map(e=>e.account.id)),ae=[...y.filter(e=>e.ready&&!ie.has(e.id)),...y.filter(e=>!e.ready&&!ie.has(e.id))].slice(0,6);(0,v.useEffect)(()=>{if(!re)return;let e=setInterval(()=>O(Date.now()),1e3);return()=>clearInterval(e)},[re]),(0,v.useEffect)(()=>{let e=!1;return Promise.allSettled([nI(!1),lI()]).then(([t,n])=>{e||(t.status===`fulfilled`&&b(t.value.data||[]),n.status===`fulfilled`&&w((n.value.data||[]).length))}).finally(()=>{e||S(!1)}),()=>{e=!0}},[]);let oe=s?.start?.toString()??``,se=s?.end?.toString()??``,ce=(0,v.useRef)(0),le=(0,v.useCallback)(e=>{let t=FV(a,s);if(!t){_(!1);return}let n=++ce.current;mV(t).then(e=>{n===ce.current&&(p(e),h(``))}).catch(t=>{n!==ce.current||e||(p(null),h(t instanceof Error?t.message:String(t)))}).finally(()=>{n===ce.current&&_(!1)})},[a,oe,se]);(0,v.useEffect)(()=>(le(!1),()=>{ce.current++}),[le]),(0,v.useEffect)(()=>{if(l)return;let e=Date.now(),t=()=>{document.hidden||(e=Date.now(),le(!0))},n=setInterval(t,O7),r=()=>{!document.hidden&&Date.now()-e>=O7&&t()};return document.addEventListener(`visibilitychange`,r),()=>{clearInterval(n),document.removeEventListener(`visibilitychange`,r)}},[l,le]),(0,v.useEffect)(()=>{let e=!1,t=()=>{Sse().then(t=>{e||E(t)}).catch(()=>{})};t();let n=setInterval(t,5e3);return()=>{e=!0,clearInterval(n)}},[]);let ue=Math.floor(B.series.length/2),de=(e,t)=>e.reduce((e,n)=>e+n[t],0),fe=B.series.slice(0,ue),pe=B.series.slice(ue),me=((e,t)=>e>0?(t-e)/e:null)(de(fe,`requests`),de(pe,`requests`)),he=de(fe,`requests`)?de(fe,`ok`)/de(fe,`requests`):null,ge=de(pe,`requests`)?de(pe,`ok`)/de(pe,`requests`):null,_e=he!=null&&ge!=null?ge-he:null,ve=[{label:t(`metricRequests`),value:B.totals.requests,kind:`compact`,detail:t(`statsWindowHint`,{window:t(PV[a])}),ok:B.totals.requests>0,trend:me},{label:t(`metricSuccess`),value:B.totals.success_rate,kind:`percent`,detail:`${B.totals.ok} ${t(`logsFilterOk`)} · ${B.totals.incomplete} ${t(`logsFilterIncomplete`)} · ${B.totals.error} ${t(`logsFilterError`)}`,ok:B.totals.requests===0||B.totals.success_rate>=.9,trend:_e},{label:t(`metricLatency`),value:B.latency.p95_ms??B.latency.avg_ms,kind:`ms`,detail:`p50 ${_V(B.latency.p50_ms)} · avg ${_V(B.latency.avg_ms)}`,ok:B.latency.p95_ms==null||B.latency.p95_ms<8e3,trend:null},{label:t(`metricTokens`),value:B.tokens.total,kind:`compact`,detail:`${gV(B.tokens.prompt)} / ${gV(B.tokens.completion)}`,ok:!0,trend:null}],ye=M7(B.tokens.cache_read,B.tokens.prompt),be=M7(B.totals.streaming,B.totals.requests),xe=[{label:t(`metricCacheHit`),value:ye,kind:`percent`,detail:t(`metricCacheHitDetail`,{read:gV(B.tokens.cache_read),prompt:gV(B.tokens.prompt)})},{label:t(`metricStreaming`),value:be,kind:`percent`,detail:t(`metricStreamingDetail`,{count:B.totals.streaming,total:B.totals.requests})},{label:t(`metricCanceled`),value:B.totals.canceled,kind:`int`,detail:t(`metricCanceledDetail`,{rate:yV(M7(B.totals.canceled,B.totals.requests)??0)})}],Se=XCe.map(e=>({key:e,count:B.status.find(t=>t.key===e)?.count??B.totals[e]??0})),Ce=e=>LV(e,B.window.from,B.window.to);return r&&!n?(0,G.jsx)(kce,{}):(0,G.jsxs)(`div`,{className:`space-y-5 sm:space-y-4`,children:[(0,G.jsxs)(`section`,{className:`grid gap-3 pb-1 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:t(`homeDisplay`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:t(`homeLead`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(IV,{value:a,onChange:o,custom:s,onCustomChange:c,onBusy:()=>_(!0),t}),(0,G.jsxs)(Mj,{delay:300,children:[(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(l?`statsRefreshResume`:`statsRefreshPause`),"aria-pressed":l,onPress:()=>u(e=>!e),children:l?(0,G.jsx)(Aa,{size:14}):(0,G.jsx)(Ea,{size:14})}),(0,G.jsx)(Mj.Content,{children:t(l?`statsRefreshPaused`:`statsRefreshAuto`)})]}),(0,G.jsxs)(`div`,{className:`text-left sm:text-right`,children:[(0,G.jsx)(`div`,{className:`mono text-caption text-muted`,children:n?.time||`—`}),(0,G.jsxs)(`div`,{className:`mt-1 inline-flex items-center gap-2 text-body font-medium`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":I&&L?`ok`:`danger`}),t(I&&L?`running`:`degraded`)]})]})]})]}),i?(0,G.jsx)(xI,{title:t(`failedOverview`,{msg:i})}):null,(0,G.jsx)(Ele,{live:N,samples:P,t,onConcurrencyClick:()=>A(!0)}),(0,G.jsx)(w7,{t,expanded:k,onExpandedChange:A,live:k?N:null}),(0,G.jsx)(`section`,{"data-gsap-reveal":!0,className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:ve.map(e=>(0,G.jsxs)(CS,{className:`gap-0 p-3.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,G.jsx)(`span`,{className:`status-dot`,"data-state":e.ok?`ok`:`danger`})]}),(0,G.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`tabular text-metric font-medium leading-none`,children:g?(0,G.jsx)(Q,{className:`h-7 w-24`}):e.value==null?`—`:(0,G.jsx)(OV,{value:e.value,kind:e.kind})}),!g&&e.trend!=null?(0,G.jsx)(nwe,{value:e.trend,hint:t(`trendHalfHint`)}):null]}),(0,G.jsx)(`div`,{className:`mono mt-2 truncate text-caption text-muted`,children:g?(0,G.jsx)(Q,{className:`h-3 w-28`}):e.detail})]},e.label))}),(0,G.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-3`,children:xe.map(e=>(0,G.jsx)(CS,{className:`gap-0 p-3.5`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,G.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:g?(0,G.jsx)(Q,{className:`h-3 w-28`}):e.detail})]}),(0,G.jsx)(`div`,{className:`tabular text-section font-semibold sm:shrink-0`,children:g?(0,G.jsx)(Q,{className:`h-5 w-12`}):e.value==null?`—`:(0,G.jsx)(OV,{value:e.value,kind:e.kind})})]})},e.label))}),(0,G.jsx)(`section`,{className:`grid gap-3`,children:(0,G.jsxs)(CS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTraffic`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsTrafficHint`)})]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:B.totals.error?`warning`:`success`,children:yV(B.totals.success_rate)})]}),(0,G.jsxs)(`div`,{className:`space-y-4 p-4`,children:[m?(0,G.jsx)(`div`,{className:`text-body text-danger`,children:t(`failedStats`,{msg:m})}):g?(0,G.jsx)(eV,{}):B.series.some(e=>e.requests>0)?(0,G.jsx)(v.Suspense,{fallback:(0,G.jsx)(eV,{}),children:(0,G.jsx)(GCe,{series:B.series,lang:e,emptyLabel:t(`statsEmptyTraffic`),okLabel:t(`logsFilterOk`),errorLabel:t(`logsFilterError`),selectHint:t(`statsDragHint`),labels:{requests:t(`chartMetricRequests`),tokens:t(`chartMetricTokens`),latency:t(`chartMetricLatency`),input:t(`chartInput`),output:t(`chartOutput`),cacheRead:t(`chartCacheRead`),p50:t(`statsLatencyP50`),p95:t(`statsLatencyP95`),total:t(`chartTotal`)},onSelectRange:(e,t)=>d(LV({},e,t))})}):(0,G.jsx)(kV,{emptyLabel:t(`statsEmptyTraffic`)}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-4 pt-3 sm:grid-cols-4 sm:gap-3`,children:[[t(`statsLatencyP50`),_V(B.latency.p50_ms)],[t(`statsLatencyP95`),_V(B.latency.p95_ms)],[t(`statsLatencyAvg`),_V(B.latency.avg_ms)],[t(`statsTTFB`),_V(B.latency.ttfb_avg_ms)]].map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e}),(0,G.jsx)(`div`,{className:`mono mt-1 text-body font-medium`,children:g?(0,G.jsx)(Q,{className:`h-4 w-16`}):t})]},String(e)))})]})]})}),(0,G.jsxs)(`section`,{className:`grid gap-3 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,.85fr)]`,children:[(0,G.jsxs)(CS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsPool`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsPoolHint`)})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[!x&&ne.length?(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-2xl bg-surface-secondary px-2 py-0.5 text-caption text-muted transition-colors hover:text-foreground`,"aria-expanded":j,"aria-label":t(`statsCoolingChip`,{count:ne.length}),onClick:()=>M(e=>!e),children:[(0,G.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":`warn`}),(0,G.jsx)(`span`,{className:`mono tabular`,children:t(`statsCoolingChip`,{count:ne.length})}),(0,G.jsx)(gi,{size:10,className:`transition-transform duration-200 ${j?`rotate-90`:``}`,"aria-hidden":!0})]}):null,(0,G.jsxs)(Sn,{to:`/accounts`,className:`inline-flex items-center gap-1 text-caption font-medium text-muted hover:text-foreground`,children:[t(`navAccounts`),(0,G.jsx)(ii,{size:12})]})]})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-y-1 border-b border-separator sm:grid-cols-4 sm:gap-y-0`,children:[[t(`ready`),ee,`ok`],[t(`hot`),R,R?`ok`:``],[t(`inFlight`),z,z?`ok`:``],[t(`statsAffinityHit`),te==null?`—`:yV(te),``,V?t(`statsAffinityHint`,{hits:V.hits??0,misses:V.misses??0,bindings:V.bindings??0}):``]].map(([e,t,n,r])=>(0,G.jsxs)(`div`,{className:`px-4 py-3 sm:py-2.5`,title:r?String(r):void 0,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e}),(0,G.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 sm:mt-1`,children:[(0,G.jsx)(`span`,{className:`mono text-section font-semibold`,children:t}),n?(0,G.jsx)(`span`,{className:`status-dot`,"data-state":n}):null]})]},String(e)))}),j&&ne.length?(0,G.jsxs)(`div`,{className:`border-b border-separator bg-surface-secondary/50 px-4 py-2`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`statsCoolingDetails`)}),(0,G.jsx)(`div`,{className:`mt-1.5 space-y-1`,children:ne.map(({account:e,until:n})=>(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-caption`,children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground/80`,children:e.name||e.id}),(0,G.jsx)(`span`,{className:`mono shrink-0 text-muted`,children:e.last_error_kind?k7(e.last_error_kind,t):t(`statsUnknown`)}),(0,G.jsx)(`span`,{className:`mono shrink-0 tabular text-muted sm:w-16 sm:text-right`,children:ZCe(n,D)??`—`}),(0,G.jsx)(`span`,{className:`mono hidden shrink-0 text-muted sm:inline sm:w-10 sm:text-right`,title:t(`statsBackoffLevel`),children:e.restart_backoff_level?`L${e.restart_backoff_level}`:`—`})]},e.id))})]}):null,(0,G.jsx)(`div`,{className:`divide-y divide-separator`,children:x?(0,G.jsx)($B,{}):y.length===0?(0,G.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t(`noAccounts`)}):ae.length===0?(0,G.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t(`statsPoolReadyEmpty`)}):ae.map(e=>{let n=e.quota,r=$Ce(n?.percentage,n?.exceeded),i=F.get(e.id),a=i?.in_flight??e.in_flight??e.inFlight??0,o=i?.max_inflight||e.max_inflight||4,s=a>=o;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2.5 px-4 py-3 sm:flex-row sm:items-center sm:gap-3 sm:py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3 sm:items-center`,children:[(0,G.jsx)(`span`,{className:`status-dot mt-1.5 shrink-0 sm:mt-0`,"data-state":e.ready?`ok`:`danger`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(XV,{provider:e.provider,size:14}),(0,G.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.name||e.id})]}),(0,G.jsxs)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:[YV(e.provider,e.region,t),` · `,e.hot?t(`hot`):e.ready?t(`ready`):t(`degraded`)]})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 pl-6 sm:shrink-0 sm:pl-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:t(s?`liveSaturated`:`inFlight`),"data-testid":`account-inflight`,children:[(0,G.jsx)(`span`,{className:`text-caption text-muted sm:hidden`,children:t(`inFlight`)}),(0,G.jsxs)(`span`,{className:`mono text-caption tabular ${s?`text-warning`:`text-muted`}`,children:[a,`/`,o]}),(0,G.jsx)(`span`,{className:`inline-block h-[2px] w-10 overflow-hidden rounded-[1px] bg-separator`,children:(0,G.jsx)(`span`,{className:`block h-full ${s?`bg-warning`:`bg-foreground/50`}`,style:{width:`${Math.min(100,a/o*100)}%`}})})]}),n?(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:t(`quota`),children:[(0,G.jsx)(`span`,{className:`text-caption text-muted sm:hidden`,children:t(`quota`)}),(0,G.jsxs)(`span`,{className:`mono text-caption tabular text-muted`,children:[Math.round(n.percentage??0),`%`]}),(0,G.jsx)(`span`,{className:`inline-block h-[2px] w-10 overflow-hidden rounded-[1px] bg-separator`,children:(0,G.jsx)(`span`,{className:`block h-full ${r===`danger`?`bg-danger`:r===`warning`?`bg-warning`:`bg-success`}`,style:{width:`${Math.min(100,Math.max(0,n.percentage??0))}%`}})})]}):null]})]},e.id)})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-t border-separator px-4 py-2.5 text-caption text-muted`,children:[(0,G.jsxs)(`span`,{children:[t(`metricModels`),` `,C]}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center justify-end gap-x-2 gap-y-1`,children:[[`qoder`,`workbuddy`,`trae`].map(e=>{let t=y.filter(t=>String(t.provider||`qoder`).toLowerCase()===e).length;return t?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,G.jsx)(XV,{provider:e,size:11}),t]},e):null}),(0,G.jsxs)(`span`,{children:[y.length,` `,t(`accountCount`)]})]})]})]}),(0,G.jsx)(twe,{resources:T,t})]}),(0,G.jsxs)(`section`,{className:`grid gap-3 xl:grid-cols-2 2xl:grid-cols-3`,children:[(0,G.jsxs)(CS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTopProviders`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsTopProvidersHint`)})]})}),g?(0,G.jsx)($B,{}):(0,G.jsx)(P7,{empty:t(`statsNoProviders`),items:(B.providers||[]).map(e=>({key:e.key,label:qCe(e.key,t),count:e.count,meta:`${e.ok}/${e.count}`,mark:e.key===`(unknown)`?void 0:e.key,href:e.key===`(unknown)`?void 0:Ce({provider:e.key})}))})]}),(0,G.jsxs)(CS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTopModels`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`providerCatalog`)})]})}),g?(0,G.jsx)($B,{rows:4}):(0,G.jsx)(P7,{empty:t(`statsNoModels`),items:B.models.map(e=>({key:e.key,label:e.key===`(unknown)`?t(`statsUnknown`):e.key,count:e.count,href:e.key===`(unknown)`?void 0:Ce({model:e.key}),meta:e.latency_avg_ms==null?`${e.ok}/${e.count}`:_V(e.latency_avg_ms)}))})]}),(0,G.jsxs)(CS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsStatusMix`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsStatusMixHint`)})]})}),g?(0,G.jsx)($B,{rows:4}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(rwe,{items:Se,t}),(0,G.jsx)(`div`,{className:`border-t border-separator px-4 pt-2.5 text-caption font-medium text-muted`,children:t(`statsErrorMix`)}),(0,G.jsx)(P7,{empty:t(`statsNoErrors`),danger:!0,items:B.errors.map(e=>({key:e.key,label:k7(e.key,t),count:e.count,href:YCe.has(e.key)?Ce({error_kind:e.key}):void 0}))}),(0,G.jsx)(`div`,{className:`border-t border-separator px-4 pt-2.5 text-caption font-medium text-muted`,children:t(`statsTopAccounts`)}),(0,G.jsx)(P7,{empty:t(`statsNoAccounts`),items:B.accounts.slice(0,5).map(e=>({key:e.key,label:JCe(y,e.key,t(`statsUnassigned`)),count:e.count,href:!e.key||e.key===`(unassigned)`?void 0:Ce({account:e.key}),meta:`${e.ok}/${e.count}`}))})]})]})]})]})}function N7(e,t){return e>=2147483648||t>=200?`danger`:e>=1073741824||t>=100?`warning`:`ok`}function twe({resources:e,t}){let n=[...e?.workers??[]].sort((e,t)=>t.rss_bytes-e.rss_bytes),r=e?.server;return(0,G.jsxs)(CS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`resTitle`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`resHint`)})]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:e?`success`:`default`,children:e?vV(e.total_rss_bytes):`—`})]}),(0,G.jsx)(`div`,{className:`divide-y divide-separator`,children:e?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":N7(r?.rss_bytes??0,r?.cpu_percent??0)}),(0,G.jsx)(`div`,{className:`truncate text-body font-medium`,children:t(`resServer`)}),(0,G.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`pid `,r?.pid]})]}),(0,G.jsxs)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:[vV(r?.rss_bytes),` · `,(r?.cpu_percent??0).toFixed(1),`%`]})]})}),n.length===0?(0,G.jsx)(`div`,{className:`px-4 py-3 text-body text-muted`,children:t(`resEmpty`)}):n.map(e=>(0,G.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":N7(e.rss_bytes,e.cpu_percent)}),(0,G.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.label||e.account_id}),(0,G.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`pid `,e.pid]})]}),(0,G.jsxs)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:[vV(e.rss_bytes),` · `,e.cpu_percent.toFixed(1),`%`]})]})},e.pid))]}):(0,G.jsx)($B,{rows:3})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-t border-separator px-4 py-2.5 text-caption text-muted`,children:[(0,G.jsxs)(`span`,{className:`mono`,children:[r?.goroutines??0,` `,t(`resGoroutines`)]}),(0,G.jsx)(`span`,{className:`mono`,children:e?.sampled_at?new Date(e.sampled_at).toLocaleTimeString():`—`})]})]})}function P7({items:e,empty:t,danger:n}){let r=(0,v.useRef)(null),i=Math.max(1,...e.map(e=>e.count)),a=e.map(e=>`${e.key}:${e.count}`).join(`|`);return(0,v.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=Z.context(()=>{let e=Z.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(`[data-rank-fill]`,{clearProps:`transform`})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=Z.utils.toArray(`[data-rank-fill]`);e.length&&Z.fromTo(e,{scaleX:0},{scaleX:1,duration:.38,ease:`power2.out`,stagger:.05,transformOrigin:`0% 50%`})})},e);return()=>t.revert()},[a]),e.length?(0,G.jsx)(`div`,{ref:r,className:`divide-y divide-separator`,children:e.map(e=>{let t=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.mark?(0,G.jsx)(XV,{provider:e.mark,size:14}):null,(0,G.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.label})]}),(0,G.jsx)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:e.meta?`${e.count} · ${e.meta}`:e.count})]}),(0,G.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded-[2px] bg-separator`,children:(0,G.jsx)(`div`,{"data-rank-fill":!0,className:`h-full origin-left rounded-[2px] ${n?`bg-danger`:`bg-success`}`,style:{width:`${Math.max(6,e.count/i*100)}%`}})})]});return e.href?(0,G.jsx)(Sn,{to:e.href,className:`rank-row block px-4 py-2.5`,title:e.label,children:t},e.key):(0,G.jsx)(`div`,{className:`px-4 py-2.5`,children:t},e.key)})}):(0,G.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t})}function nwe({value:e,hint:t}){let n=Math.abs(e)<.005?`flat`:e>0?`up`:`down`;return(0,G.jsxs)(`span`,{className:`trend-chip`,"data-tone":n,title:t,children:[(0,G.jsx)(n===`down`?oo:n===`up`?co:bi,{size:12,weight:`bold`}),e>0?`+`:``,(e*100).toFixed(1),`%`]})}function rwe({items:e,t}){let n=e.reduce((e,t)=>e+t.count,0);return n?(0,G.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,G.jsx)(`div`,{className:`flex h-2 gap-px overflow-hidden rounded-[3px] bg-separator`,role:`img`,"aria-label":e.map(e=>`${t(j7[e.key])} ${e.count}`).join(`, `),children:e.filter(e=>e.count>0).map(e=>(0,G.jsx)(`div`,{className:A7[e.key],style:{width:`${e.count/n*100}%`,minWidth:2}},e.key))}),(0,G.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-x-4 gap-y-1.5`,children:e.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-caption`,children:[(0,G.jsx)(`span`,{className:`inline-block size-2 shrink-0 rounded-[2px] ${A7[e.key]}`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted`,children:t(j7[e.key])}),(0,G.jsx)(`span`,{className:`mono tabular`,children:e.count}),(0,G.jsx)(`span`,{className:`mono w-10 text-right tabular text-muted`,children:yV(e.count/n)})]},e.key))})]}):(0,G.jsx)(`div`,{className:`px-4 py-3 text-body text-muted`,children:t(`statsEmptyTraffic`)})}function F7(e){return e?e>=1e6?`${(e/1e6).toString().replace(/\.0$/,``)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e):`—`}function iwe({model:e,t,onClose:n}){if(!e)return null;let r=e.reasoning_options||[],i=e.catalog_context_length||e.default_context_length||e.context_length,a=e.catalog_context_length_max,o=bV(e),s=xV(e),c=String(e.provider||e.owned_by||`qoder`).trim().toLowerCase(),l=YV(c,String(e.region||e.regions?.[0]||``).trim().toLowerCase()||void 0,t),u=c===`trae`?fle(e):void 0;return(0,G.jsx)(Y.Root,{isOpen:!0,onOpenChange:e=>{e||n()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`md`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`text-section`,children:e.display_name||e.id}),s?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null]}),(0,G.jsx)(`div`,{className:`mono mt-1 text-caption text-muted`,children:e.id}),(0,G.jsxs)(`div`,{className:`mt-1 text-caption text-muted`,children:[l,o?` · ${o}`:``]})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(yo,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`space-y-4 px-5 pb-5`,children:[(0,G.jsxs)(`section`,{children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:t(`contextWindowCol`)}),(0,G.jsxs)(`div`,{className:`mt-1 text-body`,children:[F7(i),a&&a!==i?` → ${F7(a)}`:``]}),e.supports_max_mode?(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(c===`qoder`?`qoderMaxModeHint`:`maxModeHint`)}):null,!e.supports_max_mode&&a&&a!==i?(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`workbuddyContextHint`)}):null,u?u.prompt_max_tokens?(0,G.jsxs)(`div`,{className:`mt-1 text-caption text-muted`,children:[t(`promptMaxTokens`),`: `,F7(u.prompt_max_tokens)]}):null:e.prompt_max_tokens?(0,G.jsxs)(`div`,{className:`mt-1 text-caption text-muted`,children:[t(`promptMaxTokens`),`: `,F7(e.prompt_max_tokens)]}):null,u?u.max_output_tokens?(0,G.jsxs)(`div`,{className:`text-caption text-muted`,children:[t(`maxOutputTokens`),`: `,F7(u.max_output_tokens)]}):null:e.max_output_tokens?(0,G.jsxs)(`div`,{className:`text-caption text-muted`,children:[t(`maxOutputTokens`),`: `,F7(e.max_output_tokens)]}):null]}),(0,G.jsxs)(`section`,{children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:t(`reasoningLevels`)}),r.length?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`reasoningHint`)}),(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:r.map(n=>{let r=`reasoningLevel_${n}`,i=t(r);return(0,G.jsxs)(BS,{size:`sm`,variant:`soft`,color:n===(e.reasoning_effort||e.reasoning_default)?`success`:`default`,children:[i===r?n:i,n===e.reasoning_default?` · ${t(`defaultValue`)}`:``,n===e.reasoning_effort&&n!==e.reasoning_default?` · ${t(`custom`)}`:``]},n)})})]}):(0,G.jsx)(`div`,{className:`mt-1 text-body text-muted`,children:e.reasoning_type?t(`reasoningFixed`,{type:e.reasoning_type}):t(`noReasoningLevels`)})]})]})]})})})})}function I7({title:e,hint:t,action:n,icon:r,className:i}){return(0,G.jsx)(`div`,{className:`grid min-h-56 place-items-center px-6 py-12 text-center ${i||``}`,children:(0,G.jsxs)(`div`,{className:`max-w-sm`,children:[r?(0,G.jsx)(`div`,{className:`mb-3 flex justify-center text-muted`,children:r}):null,(0,G.jsx)(FM,{className:`p-0 text-body font-medium text-foreground`,children:e}),t?(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t}):null,n?(0,G.jsx)(`div`,{className:`mt-5 flex justify-center`,children:n}):null]})})}var L7=`__all__`;function R7({value:e,onChange:t,ariaLabel:n,options:r,className:i}){let a=r.map(e=>({id:e.id||L7,label:e.label})),o=e||L7,s=a.find(e=>e.id===o);return(0,G.jsxs)(KP,{className:i??`w-fit min-w-36`,"aria-label":n,value:o,onChange:e=>{typeof e==`string`&&t(e===L7?``:e)},children:[(0,G.jsxs)(KP.Trigger,{className:`min-w-0 w-full items-center`,children:[(0,G.jsx)(KP.Value,{className:`min-w-0 truncate`,children:({defaultChildren:e,isPlaceholder:t})=>t||!s?e:(0,G.jsx)(`span`,{className:`truncate`,children:s.label})}),(0,G.jsx)(KP.Indicator,{})]}),(0,G.jsx)(KP.Popover,{className:`max-h-72 min-w-36`,children:(0,G.jsx)(SP,{children:a.map(e=>(0,G.jsxs)(SP.Item,{id:e.id,textValue:e.label,children:[(0,G.jsx)(jM,{className:`block truncate`,children:e.label}),(0,G.jsx)(SP.ItemIndicator,{})]},e.id))})})]})}var awe=[20,50,100],owe=[20,50,100];function swe(e,t){if(t<=7)return Array.from({length:t},(e,t)=>t+1);let n=[1];e>3&&n.push(`gap`);let r=Math.max(2,e-1),i=Math.min(t-1,e+1);for(let e=r;e<=i;e++)n.push(e);return e{let t=Number([...e][0]);d.includes(t)&&u(t)},"aria-label":a,children:d.map(e=>(0,G.jsx)(sA,{id:String(e),children:e},e))})]}),(0,G.jsxs)(UP,{size:`sm`,className:`w-fit`,children:[(0,G.jsx)(UP.Summary,{className:`mono text-caption`,children:o}),(0,G.jsxs)(UP.Content,{children:[(0,G.jsx)(UP.Item,{children:(0,G.jsx)(UP.Previous,{isDisabled:i||t<=1,onPress:()=>l(Math.max(1,t-1)),"aria-label":s,children:(0,G.jsx)(UP.PreviousIcon,{})})}),f.map((e,n)=>e===`gap`?(0,G.jsx)(UP.Item,{children:(0,G.jsx)(UP.Ellipsis,{})},`gap-${n}`):(0,G.jsx)(UP.Item,{children:(0,G.jsx)(UP.Link,{isActive:e===t,isDisabled:i,onPress:()=>l(e),children:e})},e)),(0,G.jsx)(UP.Item,{children:(0,G.jsx)(UP.Next,{isDisabled:i||t>=n,onPress:()=>l(Math.min(n,t+1)),"aria-label":c,children:(0,G.jsx)(UP.NextIcon,{})})})]})]})]})}function B7({value:e,onChange:t,placeholder:n,ariaLabel:r,className:i}){return(0,G.jsx)(kM,{"aria-label":r,value:e,onChange:t,className:i,children:(0,G.jsxs)(kM.Group,{children:[(0,G.jsx)(kM.SearchIcon,{}),(0,G.jsx)(kM.Input,{placeholder:n}),(0,G.jsx)(kM.ClearButton,{})]})})}function cwe(e){let t=[];for(let n of e)for(let e of n.regions||[])e?.id&&t.push({value:`${n.id}:${e.id}`,provider:n.id,region:e.id});return t}function V7(e){return e.settings_key||e.id}function H7(e){return String(e.provider||e.owned_by||`qoder`).trim().toLowerCase()}function U7(e){let t=String(e.region||``).trim().toLowerCase();if(t)return t;let n=e.regions||[];return String(n[0]||``).trim().toLowerCase()}function W7(e){return`${H7(e)}:${U7(e)||`any`}:${e.settings_key||e.id}:${e.native_model||e.mapped_key||``}`}function G7(e){let t=e.route_display_name||``;return t&&t!==(e.display_name||e.id)?t:``}function K7(e,t){let n=`reasoningLevel_${t}`,r=e(n);return r===n?t:r}function q7({label:e,hint:t}){return(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(`span`,{className:`cursor-help text-caption text-muted`,children:e})}),(0,G.jsx)(Mj.Content,{children:(0,G.jsx)(`p`,{className:`max-w-xs text-caption leading-5`,children:t})})]})}function J7({model:e,saving:t,t:n,variant:r=`table`,onToggleTraeMax:i,onReasoningChange:a}){let o=H7(e),s=r===`card`,c=s?`w-full min-w-0`:`w-full max-w-[7.5rem] min-w-0`;return(0,G.jsxs)(`div`,{className:s?`flex min-w-0 flex-col gap-3`:`flex min-w-0 flex-col gap-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[F7(e.catalog_context_length||e.context_length),e.catalog_context_length_max&&e.catalog_context_length_max!==(e.catalog_context_length||e.context_length)?` → ${F7(e.catalog_context_length_max)}`:``]}),o===`workbuddy`&&e.catalog_context_length_max&&e.catalog_context_length_max!==(e.catalog_context_length||e.context_length)?(0,G.jsx)(q7,{label:n(`catalogWindow`),hint:n(`workbuddyContextHint`)}):null]}),(o===`trae`||o===`qoder`)&&e.supports_max_mode?(0,G.jsxs)(`div`,{className:s?`flex flex-col gap-1.5`:`flex items-center gap-2`,children:[s?(0,G.jsx)(q7,{label:`${n(`maxMode`)}${e.catalog_context_length_max?` ${F7(e.catalog_context_length_max)}`:``}`,hint:n(o===`qoder`?`qoderMaxModeHint`:`maxModeHint`)}):null,(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(h7,{isSelected:!!e.max_mode,isDisabled:t,ariaLabel:`${e.id} ${n(`maxMode`)}`,onChange:t=>i(e,t)}),s?null:(0,G.jsx)(q7,{label:`${n(`maxMode`)}${e.catalog_context_length_max?` ${F7(e.catalog_context_length_max)}`:``}`,hint:n(o===`qoder`?`qoderMaxModeHint`:`maxModeHint`)})]})]}):null,(e.reasoning_options||[]).length>1?(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,G.jsx)(q7,{label:n(`reasoningLevels`),hint:n(`reasoningHint`)}),(0,G.jsx)(R7,{className:c,ariaLabel:`${e.id} ${n(`reasoningLevels`)}`,value:e.reasoning_effort||e.reasoning_default||e.reasoning_options?.[0]||``,onChange:t=>{t&&a(e,t)},options:(e.reasoning_options||[]).map(e=>({id:e,label:K7(n,e)}))})]}):(e.reasoning_options||[]).length===1?(0,G.jsx)(q7,{label:`${n(`reasoningLevels`)} ${K7(n,e.reasoning_options[0])}`,hint:n(`reasoningHint`)}):e.reasoning_type?(0,G.jsx)(`span`,{className:`text-caption text-muted`,children:n(`reasoningFixed`,{type:e.reasoning_type})}):o===`trae`&&!e.supports_max_mode?(0,G.jsx)(q7,{label:n(`catalogWindow`),hint:n(`catalogWindowHint`)}):null]})}function Y7({model:e,t,onDetails:n}){return(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>n(e),children:[(0,G.jsx)(ca,{size:14}),t(`modelDetails`)]})}function lwe(){let{t:e}=JF(),{overview:t,loading:n}=gI(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(1),[d,f]=(0,v.useState)(50),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)([]),[E,D]=(0,v.useState)(!0);(0,v.useEffect)(()=>{let e=!1;return $oe(void 0,`regional`).then(t=>{e||T(t.data||[])}).catch(()=>void 0).finally(()=>{e||D(!1)}),dI().then(t=>{e||c(cwe(t.data||[]))}).catch(()=>void 0),()=>{e=!0}},[]);let O=(0,v.useMemo)(()=>{let t=r.trim().toLowerCase(),[n,i]=a.includes(`:`)?a.split(`:`,2):[a,``];return w.filter(r=>{let a=H7(r),o=U7(r);if(n&&a!==n||i&&o!==i)return!1;if(!t)return!0;let s=YV(a,o||void 0,e);return`${r.display_name||``} ${r.id} ${r.mapped_key||``} ${a} ${s} ${r.owned_by||``} ${o} ${r.credits||``} ${r.free?`free`:``}`.toLowerCase().includes(t)})},[r,w,a,e]),k=[r,a,d].join(`\0`),[A,j]=(0,v.useState)(k);A!==k&&(j(k),u(1));let M=Math.max(1,Math.ceil(O.length/d)),N=Math.min(A===k?Math.max(1,l):1,M);l!==N&&u(N);let P=(0,v.useMemo)(()=>{let e=(N-1)*d;return O.slice(e,e+d)},[N,O,d]),F=O.length===0?0:(N-1)*d+1,I=Math.min(O.length,N*d),L=O.length?e(`logsShownTotal`,{shown:`${F}–${I}`,total:O.length}):e(`shownTotal`,{shown:0,total:w.length});if(n&&!t||E)return(0,G.jsx)(Nce,{});function ee(e,t){let n=V7(e),r=H7(e),i=w.map(e=>{if(V7(e)!==n||H7(e)!==r)return e;let i=e.reasoning_effort||e.reasoning_default||``,a=e.catalog_context_length||e.default_context_length||e.context_length||0,o=e.catalog_context_length_max||0;return{...e,max_mode:t,context_length:t&&o?o:a,default_context_length:a,context_custom:r===`qoder`?t:t||!!(i&&i!==e.reasoning_default)}});T(i)}function R(e,t){let n=V7(e),r=H7(e),i=w.map(e=>V7(e)!==n||H7(e)!==r?e:{...e,reasoning_effort:t,context_custom:!!e.max_mode||!!(t&&t!==e.reasoning_default)});T(i)}async function z(){m(!0),y(``),x(!1);try{let e=await uI(void 0,`regional`);T(e.data||[])}catch(e){x(!0),y(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function B(t,n){let r=H7(t);if(r!==`trae`&&r!==`workbuddy`&&r!==`kimi`&&r!==`codearts`)return;let i=V7(t);g(i),y(``),x(!1);try{await tse(r,i,n),R(t,n),y(e(`reasoningSaved`,{model:t.id,level:K7(e,n)}))}catch(e){x(!0),y(e instanceof Error?e.message:String(e))}finally{g(``)}}async function V(t,n){if(!t.supports_max_mode){x(!0),y(e(`contextMaxUnavailable`));return}let r=V7(t),i=H7(t);g(r),y(``),x(!1);try{await ese(i,r,n,t.catalog_context_length_max),ee(t,n),y(e(n?`contextMaxOn`:`contextMaxOff`,{model:t.id}))}catch(e){x(!0),y(e instanceof Error?e.message:String(e))}finally{g(``)}}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`grid gap-5 pb-6 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end`,children:[(0,G.jsxs)(`div`,{"data-gsap-reveal":!0,children:[(0,G.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`availableModels`)}),(0,G.jsx)(`p`,{className:`mt-1 text-body text-muted`,children:w.length?L:e(`noModelsYet`)})]}),(0,G.jsxs)(`div`,{"data-gsap-reveal":!0,className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center`,children:[(0,G.jsx)(B7,{className:`w-full min-w-0 sm:w-72`,value:r,onChange:i,placeholder:e(`filterPh`),ariaLabel:e(`filter`)}),(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(R7,{ariaLabel:e(`providerCol`),value:a,onChange:o,options:[{id:``,label:e(`providerFilterAll`)},...s.map(t=>({id:t.value,label:YV(t.provider,t.region,e)}))]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:p,onPress:()=>void z(),children:[(0,G.jsx)(Qr,{size:14}),e(p?`refreshing`:`refresh`)]})]})]})]}),_?(0,G.jsx)(xI,{status:b?`danger`:`success`,title:_}):null,(0,G.jsxs)(CS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-separator px-4 py-4 sm:items-center sm:px-5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-secondary text-muted`,children:(0,G.jsx)(Bi,{size:16})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-body font-semibold`,children:e(`providerCatalog`)}),(0,G.jsx)(`div`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:e(`contextConfigHint`)})]})]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,className:`shrink-0`,children:O.length})]}),p||n?(0,G.jsx)(tV,{}):O.length===0?(0,G.jsx)(I7,{icon:(0,G.jsx)(va,{size:22}),title:w.length?e(`noModelsMatch`):e(`noProviders`),hint:w.length?r||a||e(`noModelsMatch`):e(`noModelsYet`)}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`divide-y divide-separator lg:hidden`,children:P.map(t=>{let n=V7(t),r=h===n,i=H7(t),a=YV(i,U7(t)||void 0,e),o=bV(t),s=xV(t);return(0,G.jsxs)(`article`,{className:`space-y-3 px-4 py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`status-dot mt-1.5`,"data-state":t.stale?void 0:`ok`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`truncate font-medium`,children:t.display_name||t.id}),s?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`success`,children:e(`modelFree`)}):null,o?(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:o}):null]}),(0,G.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:t.id}),G7(t)?(0,G.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:e(`routedTo`,{model:G7(t)})}):null]})]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:t.context_custom||t.stale?`warning`:`success`,children:t.context_custom?e(`custom`):e(`defaultValue`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-caption`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(XV,{provider:i,size:14}),(0,G.jsx)(`span`,{className:`font-medium`,children:a})]}),(0,G.jsx)(`span`,{className:`mono break-all text-muted`,children:t.mapped_key||t.native_model||t.id})]}),(0,G.jsx)(J7,{model:t,saving:r,t:e,variant:`card`,onToggleTraeMax:(e,t)=>void V(e,t),onReasoningChange:(e,t)=>void B(e,t)}),(0,G.jsx)(Y7,{model:t,t:e,onDetails:C})]},W7(t))})}),(0,G.jsx)(X,{className:`hidden min-w-0 lg:block`,children:(0,G.jsx)(X.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,G.jsxs)(X.Content,{"aria-label":e(`availableModels`),className:`min-w-[68rem]`,children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:e(`modelCol`)}),(0,G.jsx)(X.Column,{children:e(`requestIdCol`)}),(0,G.jsx)(X.Column,{children:e(`providerCol`)}),(0,G.jsx)(X.Column,{children:e(`qoderKeyCol`)}),(0,G.jsx)(X.Column,{children:e(`modelDefaultsCol`)}),(0,G.jsx)(X.Column,{children:e(`stateCol`)}),(0,G.jsx)(X.Column,{children:e(`actions`)})]}),(0,G.jsx)(X.Body,{children:P.map(t=>{let n=V7(t),r=h===n,i=H7(t),a=YV(i,U7(t)||void 0,e),o=bV(t),s=xV(t);return(0,G.jsxs)(X.Row,{children:[(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":t.stale?void 0:`ok`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:t.display_name||t.id}),s?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`success`,children:e(`modelFree`)}):null,o?(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:o}):null]}),G7(t)?(0,G.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:e(`routedTo`,{model:G7(t)})}):null]})]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-caption font-medium`,children:t.id})}),(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(XV,{provider:i,size:14}),(0,G.jsx)(`span`,{className:`text-caption font-medium`,children:a})]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:t.mapped_key||t.native_model||t.id})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(J7,{model:t,saving:r,t:e,variant:`table`,onToggleTraeMax:(e,t)=>void V(e,t),onReasoningChange:(e,t)=>void B(e,t)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:t.context_custom||t.stale?`warning`:`success`,children:t.context_custom?e(`custom`):e(`defaultValue`)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(Y7,{model:t,t:e,onDetails:C})})]},W7(t))})})]})})})]})]}),(0,G.jsx)(iwe,{model:S?w.find(e=>V7(e)===V7(S))||S:null,t:e,onClose:()=>C(null)}),(0,G.jsx)(z7,{total:O.length,page:N,pageCount:M,pageSize:d,loading:p,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:N,pages:M}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:u,onPageSize:f})]})}function X7({copied:e,size:t=14,className:n}){let r=(0,v.useRef)(null),i=(0,v.useRef)(null),a=(0,v.useRef)(!0);return(0,v.useLayoutEffect)(()=>{let t=e?i.current:r.current,n=e?r.current:i.current;if(!t||!n)return;let o={autoAlpha:1,scale:1,filter:`blur(0px)`},s={autoAlpha:0,scale:.5,filter:`blur(4px)`};if(a.current||qB()){a.current=!1,Z.set(t,o),Z.set(n,s);return}Z.to(n,{...s,duration:WB.fast,ease:GB.out,overwrite:!0}),Z.fromTo(t,s,{...o,duration:WB.base,ease:GB.soft,delay:WB.instant/2,overwrite:!0})},[e]),(0,G.jsxs)(`span`,{className:`relative inline-grid place-items-center ${n??``}`,style:{width:t,height:t},children:[(0,G.jsx)(`span`,{ref:r,className:`col-start-1 row-start-1 inline-flex`,children:(0,G.jsx)(Ii,{size:t})}),(0,G.jsx)(`span`,{ref:i,className:`col-start-1 row-start-1 inline-flex text-success`,children:(0,G.jsx)(Ei,{size:t})})]})}async function Z7(e){if(!e)return!1;try{if(typeof navigator<`u`&&navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-1000px`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}function Q7(){return`${location.protocol}//${location.host}`}function $7(e){return e?/^https?:\/\//i.test(e)?e:e.startsWith(`/`)?`${Q7()}${e}`:`${Q7()}/${e}`:Q7()}function uwe({access:e}){let{t}=JF(),[n,r]=(0,v.useState)(``),i=$7(e?.openai_base_url||`/v1`),a=(0,v.useMemo)(()=>[{name:t(`endpointOpenAI`),url:i,method:`BASE`,hint:t(`endpointBaseHint`),icon:(0,G.jsx)(ui,{size:15})},{name:t(`endpointChat`),url:$7(e?.chat_completions||`${i}/chat/completions`),method:`POST`,hint:t(`endpointChatHint`),icon:(0,G.jsx)(wa,{size:15})},{name:t(`endpointMessages`),url:$7(e?.messages||`${i}/messages`),method:`POST`,hint:t(`endpointMessagesHint`),icon:(0,G.jsx)(wa,{size:15})},{name:t(`endpointResponses`),url:$7(e?.responses||`${i}/responses`),method:`POST`,hint:t(`endpointResponsesHint`),icon:(0,G.jsx)(wa,{size:15})},{name:t(`endpointModels`),url:$7(e?.models||`${i}/models`),method:`GET`,hint:t(`endpointModelsHint`),icon:(0,G.jsx)(ga,{size:15})},{name:t(`endpointHealth`),url:$7(e?.health||`/health`),method:`GET`,hint:t(`endpointHealthHint`),icon:(0,G.jsx)(oa,{size:15})}],[e,i,t]);return(0,G.jsxs)(`section`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:[(0,G.jsx)(`div`,{className:`flex items-start justify-between gap-4 px-5 py-4 sm:px-6`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`endpoints`)}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,children:t(`endpointCount`,{count:a.length-1})})]}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`routesHint`)})]})}),(0,G.jsx)(`div`,{className:`grid gap-2 px-3 pb-3 sm:grid-cols-2 sm:px-4 sm:pb-4 lg:grid-cols-3`,children:a.map(e=>(0,G.jsxs)(`div`,{className:`group min-w-0 rounded-xl bg-surface-secondary/40 p-3 transition-colors hover:bg-surface-secondary/70`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,G.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface text-muted`,children:e.icon}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`truncate text-body font-semibold`,children:e.name}),(0,G.jsx)(`code`,{className:`mono mt-0.5 block truncate text-caption text-muted`,children:e.url})]})]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,children:e.method})]}),(0,G.jsx)(`p`,{className:`mt-2 text-caption leading-5 text-muted`,children:e.hint}),(0,G.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:e.method===`BASE`?t(`endpointBaseLabel`):t(`endpointAuthLabel`)}),(0,G.jsxs)(`div`,{className:`flex gap-1`,children:[(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(`copy`),onPress:()=>{Z7(e.url),r(e.name),window.setTimeout(()=>r(``),1100)},children:(0,G.jsx)(X7,{copied:n===e.name})}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(`open`),onPress:()=>window.open(e.url,`_blank`,`noopener,noreferrer`),children:(0,G.jsx)(ni,{size:14})})]})]})]},e.name))})]})}var dwe=`https://caiaiu.com`;function e9({className:e=``}){let{t}=JF();return(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted ${e}`.trim(),children:(0,G.jsx)(`a`,{href:dwe,target:`_blank`,rel:`noopener noreferrer`,className:`underline-offset-2 transition-colors hover:text-foreground hover:underline`,children:t(`caiaiSoftLink`)})})}var fwe=new Set(`txt.md.markdown.json.csv.tsv.yml.yaml.toml.xml.html.htm.css.scss.js.jsx.ts.tsx.mjs.cjs.py.go.rs.java.kt.swift.c.h.cpp.hpp.sh.bash.zsh.sql.graphql.env.ini.conf.log.rst.tex`.split(`.`)),pwe=new Set([`image/png`,`image/jpeg`,`image/jpg`,`image/gif`,`image/webp`]);function mwe(e){let t=e.lastIndexOf(`.`);return t>=0?e.slice(t+1).toLowerCase():``}function hwe(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}async function gwe(e){let t=mwe(e.name),n=e.type||`application/octet-stream`,r=`${e.name}-${e.size}-${e.lastModified}-${Math.random().toString(36).slice(2,8)}`;if(pwe.has(n)||[`png`,`jpg`,`jpeg`,`gif`,`webp`].includes(t)){let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(r.error||Error(`read failed`)),r.readAsDataURL(e)});return{id:r,name:e.name,mime:n,kind:`image`,dataUrl:t,size:e.size}}if(fwe.has(t)||n.startsWith(`text/`)||n===`application/json`){let t=await e.text();return{id:r,name:e.name,mime:n,kind:`text`,text:t,size:e.size}}return null}function t9({ariaLabel:e,value:t,onChange:n,placeholder:r,isDisabled:i,options:a,className:o,tone:s=`default`}){let c=a.find(e=>e.id===t),l=s===`muted`?`text-muted hover:text-foreground`:`text-foreground`;return(0,G.jsxs)(KP,{className:o??`w-auto max-w-[11rem] min-w-0`,"aria-label":e,value:t||null,placeholder:r,isDisabled:i,onChange:e=>{typeof e==`string`&&e&&n(e)},children:[(0,G.jsxs)(KP.Trigger,{className:`h-8 min-h-8 gap-1 rounded-[10px] border-0 bg-transparent px-2.5 shadow-none items-center hover:bg-surface-secondary/80 data-[focus-visible=true]:bg-surface-secondary/80 ${l}`,children:[(0,G.jsx)(KP.Value,{className:`min-w-0 truncate text-caption font-medium`,children:({defaultChildren:e,isPlaceholder:t})=>t||!c?e:(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[c.icon?(0,G.jsx)(`span`,{className:`grid size-3.5 shrink-0 place-items-center opacity-80`,children:c.icon}):null,(0,G.jsx)(`span`,{className:`truncate`,children:c.label})]})}),(0,G.jsx)(KP.Indicator,{className:`size-2.5 opacity-50`})]}),(0,G.jsx)(KP.Popover,{placement:`top end`,className:`max-h-72 min-w-48`,children:(0,G.jsx)(SP,{children:a.map(e=>(0,G.jsxs)(SP.Item,{id:e.id,textValue:e.textValue,className:`gap-2`,children:[e.icon?(0,G.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center`,children:e.icon}):null,(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(jM,{className:`block truncate text-caption`,children:e.label}),e.hint?(0,G.jsx)(`span`,{className:`block truncate text-caption text-muted`,children:e.hint}):null]}),(0,G.jsx)(SP.ItemIndicator,{})]},e.id))})})]})}function _we({value:e,onChange:t,attachments:n,onAttachmentsChange:r,disabled:i,streaming:a,canSend:o,onSend:s,onStop:c,accountValue:l,onAccountChange:u,accountOptions:d,modelValue:f,onModelChange:p,modelOptions:m,modelsLoading:h}){let{t:g}=JF(),_=(0,v.useRef)(null);async function y(e){if(!e?.length)return;let t=[],i=[];for(let n of Array.from(e))try{let e=await gwe(n);e?t.push(e):i.push(n.name)}catch{i.push(n.name)}t.length&&r([...n,...t]),i.length&&window.alert(g(`chatAttachUnsupported`,{names:i.join(`, `)})),_.current&&(_.current.value=``)}function b(e){e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),!a&&o&&s())}return(0,G.jsxs)(`div`,{className:`access-composer px-3 pb-3 pt-2.5 sm:px-4 sm:pb-3.5 sm:pt-3`,children:[(0,G.jsxs)(`div`,{className:`access-composer-well overflow-hidden rounded-2xl`,children:[n.length?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2 px-3 pt-3`,children:n.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex max-w-[14rem] items-center gap-2 rounded-xl bg-surface/80 px-1.5 py-1.5 text-caption text-foreground`,children:[e.kind===`image`&&e.dataUrl?(0,G.jsx)(`img`,{src:e.dataUrl,alt:``,className:`size-8 shrink-0 rounded-lg object-cover`}):(0,G.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-muted`,children:(0,G.jsx)(Qi,{size:14})}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate font-medium`,children:e.name}),(0,G.jsx)(`span`,{className:`mono text-muted`,children:hwe(e.size)})]}),(0,G.jsx)(`button`,{type:`button`,className:`grid size-6 shrink-0 place-items-center rounded-md text-muted hover:bg-surface-secondary hover:text-foreground`,"aria-label":g(`chatAttachRemove`),onClick:()=>r(n.filter(t=>t.id!==e.id)),children:(0,G.jsx)(yo,{size:12})})]},e.id))}):null,(0,G.jsx)(Uj,{fullWidth:!0,rows:3,className:`min-h-20 resize-none border-0 bg-transparent px-3.5 py-3 text-body leading-[1.65] shadow-none focus-visible:ring-0`,value:e,onChange:e=>t(e.target.value),onKeyDown:b,placeholder:g(`promptPlaceholder`),"aria-label":g(`prompt`),disabled:i||a}),(0,G.jsxs)(`div`,{className:`flex items-center gap-0.5 px-2 pb-2 pt-0.5`,children:[(0,G.jsx)(`input`,{ref:_,type:`file`,className:`hidden`,multiple:!0,accept:`.txt,.md,.json,.csv,.yml,.yaml,.toml,.xml,.html,.css,.js,.jsx,.ts,.tsx,.py,.go,.rs,.sh,.sql,.png,.jpg,.jpeg,.gif,.webp,text/*,image/png,image/jpeg,image/gif,image/webp,application/json`,onChange:e=>void y(e.target.files)}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 shrink-0 rounded-[10px]`,"aria-label":g(`chatAttach`),isDisabled:i||a,onPress:()=>_.current?.click(),children:(0,G.jsx)(Ma,{size:15})}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,G.jsx)(t9,{ariaLabel:g(`account`),value:l,onChange:u,options:d,isDisabled:i||a,tone:`muted`,className:`w-auto max-w-[8.5rem] min-w-0`}),(0,G.jsx)(t9,{ariaLabel:g(`model`),value:f,onChange:p,placeholder:g(h?`requesting`:`model`),options:m,isDisabled:i||a||h||!m.length,className:`w-auto max-w-[10.5rem] min-w-0`}),(0,G.jsxs)(`div`,{className:`relative size-8 shrink-0`,children:[(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`secondary`,className:`absolute inset-0 size-8 rounded-[10px] transition-opacity duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] ${a?`opacity-100`:`pointer-events-none opacity-0`}`,"aria-label":g(`chatTryStop`),onPress:c,children:(0,G.jsx)(Xa,{size:14,weight:`fill`})}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,className:`absolute inset-0 size-8 rounded-[10px] transition-opacity duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] ${a?`pointer-events-none opacity-0`:`opacity-100`}`,"aria-label":g(`chatTrySend`),isDisabled:!o||i||a,onPress:s,children:(0,G.jsx)(wa,{size:14,weight:`fill`})})]})]})]}),(0,G.jsx)(`p`,{className:`mt-1 px-1 text-caption leading-4 text-muted/65`,children:g(`chatTryHelper`)})]})}function vwe({collapsed:e,onCollapsedChange:t,items:n,activeId:r,onSelect:i,onNew:a}){let{t:o}=JF(),s=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let t=s.current;!t||qB()||e||Z.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:WB.fast,ease:`power2.out`})},[e]),e?(0,G.jsxs)(`div`,{className:`access-hist-rail flex w-9 shrink-0 flex-col items-center gap-1 border-r py-2`,children:[(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":o(`chatHistoryExpand`),onPress:()=>t(!1),children:(0,G.jsx)(Ra,{size:15})}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":o(`chatHistoryNew`),onPress:a,children:(0,G.jsx)(Ma,{size:14})})]}):(0,G.jsxs)(`aside`,{ref:s,className:`access-hist-rail flex w-[13rem] shrink-0 flex-col border-r`,"aria-label":o(`chatHistoryTitle`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-2`,children:[(0,G.jsx)(`div`,{className:`min-w-0 flex-1 truncate px-1.5 text-caption font-medium text-muted`,children:o(`chatHistoryTitle`)}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":o(`chatHistoryCollapse`),onPress:()=>t(!0),children:(0,G.jsx)(mi,{size:14})})]}),(0,G.jsx)(`div`,{className:`px-2 pb-1.5`,children:(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,className:`h-8 w-full justify-start gap-1.5 rounded-[10px] px-2.5 text-caption font-medium text-muted hover:bg-[var(--sidebar-hover)] hover:text-foreground`,onPress:a,children:[(0,G.jsx)(Ma,{size:13}),o(`chatHistoryNew`)]})}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 space-y-0.5 overflow-y-auto px-1.5 pb-2.5`,children:n.length?n.map(e=>{let t=e.id===r;return(0,G.jsx)(`button`,{type:`button`,"data-active":t?`true`:void 0,className:`access-hist-item flex h-8 w-full items-center rounded-[10px] px-2.5 text-left text-caption leading-5 ${t?`font-medium text-foreground`:`font-normal text-muted`}`,onClick:()=>i(e.id),children:(0,G.jsx)(`span`,{className:`line-clamp-1 tracking-tight`,children:e.title||o(`chatHistoryUntitled`)})},e.id)}):(0,G.jsx)(`p`,{className:`px-2.5 py-6 text-center text-caption leading-5 text-muted/70`,children:o(`chatHistoryEmpty`)})})]})}function n9({latencyMs:e,ttfbMs:t,completionTokens:n,stream:r,labels:i,className:a=``,variant:o=`block`}){let s=sle(ole({completionTokens:n,latencyMs:e,ttfbMs:t,stream:r})),c=_V(t),l=_V(e);if(o===`inline`)return(0,G.jsxs)(`div`,{className:`mono text-caption leading-4 text-muted ${a}`.trim(),children:[(0,G.jsxs)(`span`,{children:[i.ttft,` `,c]}),(0,G.jsx)(`span`,{className:`mx-1.5 text-separator`,children:`·`}),(0,G.jsxs)(`span`,{children:[i.total,` `,l]}),(0,G.jsx)(`span`,{className:`mx-1.5 text-separator`,children:`·`}),(0,G.jsx)(`span`,{children:s})]});let u=[[i.ttft,c],[i.total,l],[i.tps,s]];return(0,G.jsxs)(`div`,{className:a,children:[i.heading?(0,G.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:i.heading}):null,(0,G.jsx)(`div`,{className:`border-l border-separator pl-2 leading-4`,children:u.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2 py-px`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-caption text-muted`,children:e}),(0,G.jsx)(`span`,{className:`mono text-xs text-foreground`,children:t})]},e))})]})}function ywe({text:e,streaming:t,defaultOpen:n}){let{t:r}=JF(),[i,a]=(0,v.useState)(!!n),[o,s]=(0,v.useState)(0),c=(0,v.useRef)(0),l=(0,v.useRef)(null),u=(0,v.useRef)(null);if((0,v.useEffect)(()=>{t?a(!1):n!=null&&a(!!n)},[t,n]),(0,v.useEffect)(()=>{if(!t)return;let e=Date.now();s(0);let n=window.setInterval(()=>{let t=Math.floor((Date.now()-e)/1e3);s(t),c.current=t},250);return()=>window.clearInterval(n)},[t]),(0,v.useEffect)(()=>{!t&&o===0&&c.current>0&&s(c.current)},[t,o]),(0,v.useEffect)(()=>{let t=l.current,n=u.current;if(!t)return;let r=qB();if(!i||!e){if(r){t.style.height=`0px`,t.style.opacity=`0`;return}Z.to(t,{height:0,opacity:0,duration:WB.fast,ease:GB.inOut,overwrite:!0});return}let a=n?.scrollHeight??0;if(r){t.style.height=`auto`,t.style.opacity=`1`;return}Z.fromTo(t,{height:0,opacity:0},{height:a,opacity:1,duration:WB.base,ease:GB.out,overwrite:!0,onComplete:()=>{t.style.height=`auto`}})},[i,e]),!e&&!t)return null;let d=qB(),f=t?o:o||c.current;return(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-xl`,children:[(0,G.jsx)(`button`,{type:`button`,className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-surface-secondary px-2.5 py-1 text-left text-caption text-muted`,"aria-expanded":i,onClick:()=>a(e=>!e),children:t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Mi,{size:12,className:`shrink-0 text-muted ${d?``:`animate-spin`}`}),(0,G.jsx)(`span`,{className:d?``:`access-thinking-shimmer`,children:r(`thinkingWorking`)}),(0,G.jsxs)(`span`,{className:`mono text-muted/80`,children:[o,`s`]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(gi,{size:11,className:`shrink-0 transition-transform duration-200 ease-out ${i?`rotate-90`:``}`}),(0,G.jsx)(`span`,{children:r(`thinkingDone`)}),f>0?(0,G.jsx)(`span`,{className:`mono text-muted/80`,children:r(`thinkingElapsed`,{n:f})}):null,!f&&e?(0,G.jsx)(`span`,{className:`mono text-muted/80`,children:r(`thinkingChars`,{count:e.length})}):null]})}),(0,G.jsx)(`div`,{ref:l,className:`overflow-hidden`,style:{height:0,opacity:0},children:e?(0,G.jsx)(`pre`,{ref:u,className:`mt-1.5 max-h-52 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-surface-secondary/80 px-3 py-2 text-caption leading-5 text-muted`,children:e}):null})]})}function bwe(e,t){return t(e===`running`?`toolCallRunning`:e===`error`?`toolCallError`:`toolCallSuccess`)}function xwe({status:e}){return e===`running`?(0,G.jsx)(Wa,{size:12,className:`animate-spin text-muted`}):e===`error`?(0,G.jsx)(ho,{size:12,weight:`fill`,className:`text-danger`}):(0,G.jsx)(Oi,{size:12,weight:`fill`,className:`text-success`})}function Swe(e){if(!e.trim())return``;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function r9({call:e,forceOpen:t}){let{t:n}=JF(),[r,i]=(0,v.useState)(e.status===`error`||!!t),[a,o]=(0,v.useState)(!1),s=(0,v.useMemo)(()=>Swe(e.arguments||``),[e.arguments]);(0,v.useEffect)(()=>{e.status===`error`&&i(!0)},[e.status]),(0,v.useEffect)(()=>{t&&i(!0)},[t]);async function c(){s&&(await Z7(s),o(!0),window.setTimeout(()=>o(!1),1200))}return(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-lg`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2 py-1.5 text-left`,"aria-expanded":r,onClick:()=>i(e=>!e),children:[(0,G.jsx)(gi,{size:11,className:`shrink-0 text-muted transition-transform ${r?`rotate-90`:``}`}),(0,G.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-caption font-medium text-foreground`,children:e.name||n(`toolCallUntitled`)}),(0,G.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted`,children:[(0,G.jsx)(xwe,{status:e.status}),bwe(e.status,n)]})]}),r?(0,G.jsxs)(`div`,{className:`space-y-1.5 px-2 pb-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:n(`toolCallArgs`)}),(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-caption text-muted hover:bg-surface-secondary hover:text-foreground`,onClick:e=>{e.stopPropagation(),c()},children:[(0,G.jsx)(Ri,{size:12}),n(a?`copied`:`copy`)]})]}),(0,G.jsx)(`pre`,{className:`mono max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-secondary/80 px-2.5 py-2 text-caption leading-5 text-muted`,children:s||n(`toolCallArgsEmpty`)})]}):null]})}function Cwe({calls:e}){let{t}=JF(),n=e.some(e=>e.status===`error`),r=e.some(e=>e.status===`running`),[i,a]=(0,v.useState)(n||r||e.length===1);return(0,v.useEffect)(()=>{(n||r)&&a(!0)},[n,r]),e.length?e.length===1?(0,G.jsx)(`div`,{className:`rounded-xl bg-surface-secondary/70`,children:(0,G.jsx)(r9,{call:e[0],forceOpen:e[0].status===`error`})}):(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-secondary/70`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-caption text-muted`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[(0,G.jsx)(gi,{size:11,className:`shrink-0 transition-transform ${i?`rotate-90`:``}`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground`,children:t(`toolCallGroup`,{n:e.length})}),r?(0,G.jsx)(Wa,{size:12,className:`animate-spin`}):null]}),i?(0,G.jsx)(`div`,{className:`space-y-0.5 border-t border-separator/40 px-0.5 py-1`,children:e.map(e=>(0,G.jsx)(r9,{call:e},`${e.index}-${e.id||e.name}`))}):null]}):null}function wwe({message:e}){return e.attachments?.length?(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.attachments.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex max-w-[12rem] items-center gap-1.5 rounded-xl bg-surface/70 px-1.5 py-1 text-caption text-muted`,children:[e.kind===`image`&&e.dataUrl?(0,G.jsx)(`img`,{src:e.dataUrl,alt:``,className:`size-7 shrink-0 rounded-lg object-cover`}):(0,G.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface`,children:(0,G.jsx)(Qi,{size:12})}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))}):null}function Twe({message:e}){let{t}=JF(),n=e.usage;if(!n||n.credits==null)return null;let r=n.prompt_tokens,i=n.completion_tokens,a=typeof r==`number`||typeof i==`number`?t(`chatTryUsageTokens`,{prompt:gV(r??0),completion:gV(i??0)}):``;return(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:a?t(`chatTryUsageFoot`,{tokens:a,amount:TV(n.credits)}):t(`chatTryCreditsUsed`,{amount:TV(n.credits)})})}function Ewe({text:e,streaming:t}){let n=e.split(/(\n{2,})/),r=-1;for(let e=n.length-1;e>=0;--e)if(n[e]&&!/^\n{2,}$/.test(n[e])){r=e;break}return(0,G.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body leading-[1.65] text-foreground ${t?`access-streaming`:``}`,children:n.map((e,n)=>e?/^\n{2,}$/.test(e)?(0,G.jsx)(`span`,{children:e},`s-${n}`):(0,G.jsx)(`span`,{className:t&&n===r?`access-stream-seg`:void 0,children:e},`p-${n}`):null)})}function Dwe(){let e=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let t=e.current;!t||qB()||Z.from(t,{autoAlpha:0,duration:WB.fast,ease:`power2.out`})},[]),e}function Owe({message:e}){let{t}=JF(),[n,r]=(0,v.useState)(!1),i=e.role===`user`,a=Dwe();if(i)return(0,G.jsx)(`div`,{ref:a,className:`ml-auto max-w-[92%] sm:max-w-[78%]`,children:(0,G.jsxs)(`div`,{className:`access-bubble access-bubble--user rounded-2xl rounded-br-md px-3.5 py-2.5`,children:[e.content?(0,G.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body leading-[1.65] text-foreground`,children:e.content}):null,(0,G.jsx)(wwe,{message:e})]})});let o=e.status===`streaming`&&!e.content&&!e.reasoning&&!e.toolCalls?.length,s=!!e.content&&e.status===`done`,c=e.status===`streaming`,l=!!(e.usage&&e.usage.credits!=null),u=e.status===`done`&&(e.latency_ms!=null||e.ttfb_ms!=null||typeof e.usage?.completion_tokens==`number`);async function d(){e.content&&(await Z7(e.content),r(!0),window.setTimeout(()=>r(!1),1200))}return(0,G.jsxs)(`div`,{className:`group/access-msg max-w-[96%] space-y-1.5 sm:max-w-[88%]`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-1.5 px-0.5`,children:(0,G.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center rounded-lg border border-border bg-surface-secondary`,children:(0,G.jsx)(XV,{provider:e.provider,size:13})})}),e.reasoning||c?(0,G.jsx)(ywe,{text:e.reasoning||``,streaming:c&&(!e.content||!!e.reasoning),defaultOpen:e.reasoningOpen}):null,e.toolCalls?.length?(0,G.jsx)(Cwe,{calls:e.toolCalls}):null,e.status===`error`?(0,G.jsx)(xI,{status:`danger`,title:t(`requestFailed`),description:e.error||``}):o?(0,G.jsxs)(`div`,{className:`space-y-2 pt-0.5`,children:[(0,G.jsx)(rA,{className:`h-3 w-28 rounded-md`}),(0,G.jsx)(rA,{className:`h-3 w-full rounded-md`}),(0,G.jsx)(rA,{className:`h-3 w-[86%] rounded-md`}),(0,G.jsx)(rA,{className:`h-3 w-[68%] rounded-md`})]}):e.content?(0,G.jsx)(`div`,{className:`access-bubble access-bubble--assistant px-0.5 py-0`,children:(0,G.jsx)(Ewe,{text:e.content,streaming:c})}):null,s||l||u?(0,G.jsxs)(`div`,{className:`access-msg-foot space-y-1 px-0.5 pt-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[s?(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,className:`h-5 min-h-5 gap-1 px-1.5 text-caption text-muted/80`,onPress:()=>void d(),children:[(0,G.jsx)(X7,{copied:n,size:12}),t(n?`copied`:`copy`)]}):null,(0,G.jsx)(Twe,{message:e})]}),u?(0,G.jsx)(n9,{variant:`inline`,latencyMs:e.latency_ms,ttfbMs:e.ttfb_ms,completionTokens:e.usage?.completion_tokens,stream:!0,className:`access-latency-inline max-h-0 overflow-hidden opacity-0 transition-[opacity,max-height] duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] group-hover/access-msg:max-h-5 group-hover/access-msg:opacity-100 focus-within:max-h-5 focus-within:opacity-100`,labels:{ttft:t(`logsColTTFT`),total:t(`logsLatencyTotal`),tps:t(`logsOutputTPS`)}}):null]}):null]})}function kwe({messages:e,busy:t,onLoadDemo:n}){let{t:r}=JF(),i=(0,v.useRef)(null);(0,v.useEffect)(()=>{i.current?.scrollIntoView({block:`end`})},[e,t]);let a=!e.length;return(0,G.jsxs)(`div`,{className:`access-thread min-h-0 flex-1 overflow-y-auto px-4 sm:px-6 ${a?`py-5 sm:py-6`:`pb-2 pt-4 sm:pb-2.5 sm:pt-5`}`,"aria-live":`polite`,"aria-busy":t,children:[a?(0,G.jsx)(I7,{className:`min-h-56`,icon:(0,G.jsx)(wi,{size:22}),title:r(`chatTryEmptyTitle`),hint:r(`chatTryEmptyHint`),action:n?(0,G.jsx)(`button`,{type:`button`,className:`inline-flex h-8 items-center rounded-[10px] px-2.5 text-caption font-medium text-muted transition-colors hover:bg-[var(--sidebar-hover)] hover:text-foreground`,onClick:n,children:r(`chatDemoLoad`)}):void 0}):(0,G.jsx)(`div`,{className:`space-y-4`,children:e.map(e=>(0,G.jsx)(Owe,{message:e},e.id))}),(0,G.jsx)(`div`,{ref:i})]})}function Awe({format:e,onFormatChange:t,requestPath:n,prompt:r,onPromptChange:i,onTest:a,requestState:o,elapsedMs:s,output:c,responseStatus:l,curl:u,copiedCurl:d,onCopyCurl:f,canSend:p,accountValue:m,onAccountChange:h,accountOptions:g,modelValue:_,onModelChange:v,modelOptions:y,modelsLoading:b,disabled:x}){let{t:S}=JF();return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`px-1 text-caption leading-5 text-muted`,children:S(`rawFormatHint`)}),(0,G.jsx)(`div`,{className:`access-raw-panel overflow-hidden rounded-2xl`,children:(0,G.jsxs)(`div`,{className:`grid xl:grid-cols-[minmax(420px,.92fr)_minmax(0,1.08fr)]`,children:[(0,G.jsxs)(`div`,{className:`xl:border-r xl:border-[color-mix(in_oklab,var(--foreground)_6%,transparent)]`,children:[(0,G.jsxs)(`div`,{className:`px-4 py-3.5 sm:px-5`,children:[(0,G.jsx)(`h3`,{className:`text-body font-semibold`,children:S(`requestBuilder`)}),(0,G.jsxs)(`p`,{className:`mt-0.5 text-caption text-muted`,children:[`POST `,n]})]}),(0,G.jsxs)(`div`,{className:`space-y-4 px-4 pb-4 sm:px-5 sm:pb-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:S(`rawFormatLabel`)}),(0,G.jsx)(AV,{className:`access-format-chips`,ariaLabel:S(`rawFormatLabel`),value:e,onChange:e=>t(e),options:[{id:`chat`,label:S(`rawFormatChat`)},{id:`messages`,label:S(`rawFormatMessages`)},{id:`responses`,label:S(`rawFormatResponses`)}]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,G.jsx)(t9,{ariaLabel:S(`account`),value:m,onChange:h,options:g,isDisabled:x||o===`loading`,tone:`muted`,className:`w-auto max-w-[8.5rem] min-w-0`}),(0,G.jsx)(t9,{ariaLabel:S(`model`),value:_,onChange:v,placeholder:S(b?`requesting`:`model`),options:y,isDisabled:x||o===`loading`||b||!y.length,className:`w-auto max-w-[10.5rem] min-w-0`})]}),(0,G.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:S(`prompt`)}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:r.length})]}),(0,G.jsx)(Uj,{fullWidth:!0,rows:9,className:`min-h-52 resize-y rounded-xl border-0 bg-[var(--field-background)] px-3.5 py-3 text-body leading-[1.65] shadow-[inset_0_0_0_1px_color-mix(in_oklab,var(--field-border)_78%,var(--foreground))] focus-visible:ring-0`,value:r,onChange:e=>i(e.target.value),placeholder:S(`promptPlaceholder`),"aria-label":S(`prompt`),disabled:x||o===`loading`}),(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted/70`,children:S(`promptHelper`)})]}),(0,G.jsxs)(J,{fullWidth:!0,isPending:o===`loading`,isDisabled:!p||x,onPress:a,children:[(0,G.jsx)(wa,{size:15}),S(o===`loading`?`requesting`:`sendRequest`)]})]})]}),(0,G.jsxs)(`div`,{className:`access-raw-panel__inspector flex min-h-[440px] min-w-0 flex-col`,"aria-live":`polite`,"aria-busy":o===`loading`,children:[(0,G.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-4 px-4 py-3 sm:px-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-body font-semibold`,children:S(`responseInspector`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:S(`responseInspectorHint`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s===null?null:(0,G.jsxs)(`span`,{className:`mono flex items-center gap-1.5 text-caption text-muted`,children:[(0,G.jsx)(Pi,{size:12}),s,` ms`]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:o===`success`?`success`:o===`error`?`danger`:void 0,children:l})]})]}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 px-4 pb-4 sm:px-5 sm:pb-5`,children:o===`idle`?(0,G.jsx)(I7,{className:`min-h-64`,title:S(`responseEmptyTitle`),hint:S(`responseEmptyHint`)}):o===`loading`?(0,G.jsxs)(`div`,{className:`space-y-3 pt-1`,children:[(0,G.jsx)(rA,{className:`h-3 w-32 rounded-lg`}),(0,G.jsx)(rA,{className:`h-3 w-full rounded-lg`}),(0,G.jsx)(rA,{className:`h-3 w-[88%] rounded-lg`}),(0,G.jsx)(rA,{className:`h-3 w-[72%] rounded-lg`}),(0,G.jsx)(rA,{className:`mt-7 h-3 w-[92%] rounded-lg`}),(0,G.jsx)(rA,{className:`h-3 w-[64%] rounded-lg`})]}):o===`error`?(0,G.jsx)(`div`,{className:`space-y-3`,children:(0,G.jsx)(xI,{status:`danger`,title:S(`requestFailed`),description:c})}):(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-caption font-medium text-success`,children:[(0,G.jsx)(Oi,{size:14,weight:`fill`}),S(`responseReceived`)]}),(0,G.jsx)(`pre`,{className:`mono overflow-x-auto whitespace-pre-wrap break-words text-caption leading-6 text-muted`,children:c})]})})]})]})}),(0,G.jsxs)(`section`,{className:`access-raw-panel overflow-hidden rounded-2xl`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-4 py-3 sm:px-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-body font-semibold`,children:S(`curlExample`)}),(0,G.jsx)(`div`,{className:`mt-0.5 truncate text-caption text-muted`,children:S(`curlGeneratedHint`)})]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:f,children:[(0,G.jsx)(X7,{copied:d}),S(d?`copied`:`copy`)]})]}),(0,G.jsx)(`pre`,{className:`mono max-h-72 overflow-auto whitespace-pre-wrap px-4 pb-4 text-caption leading-6 text-muted sm:px-5 sm:pb-5`,children:u})]})]})}function i9(e,t){let n=t.filter(e=>e.kind===`text`),r=t.filter(e=>e.kind===`image`&&e.dataUrl),i=e.trim();for(let e of n){let t=e.text??``;i=`${i}${i?` + `}),c?null:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 px-4 py-3`,children:[(0,G.jsxs)(`button`,{type:`button`,"data-testid":`inflight-live-toggle`,"aria-expanded":f,"aria-controls":`inflight-live-body`,onClick:()=>p(!f),className:`flex min-w-0 flex-1 items-start gap-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2 focus-visible:ring-offset-background`,children:[(0,G.jsx)(gi,{size:14,"aria-hidden":!0,className:`mt-1 shrink-0 text-muted transition-transform duration-200 ${f?`rotate-90`:``}`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`inflightTitle`)}),(0,G.jsxs)(`span`,{className:`mono inline-flex items-center gap-1 rounded-[3px] px-1.5 py-0.5 text-caption text-muted`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":ne?`ok`:``}),e(ne?`inflightLiveBadge`:re?`inflightMockBadge`:`inflightIdleBadge`)]}),f&&ie>0?(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:e(`inflightStickyBindings`,{n:ie})}):null]}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:e(`inflightHint`)})]})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[f?(0,G.jsxs)(Sn,{to:`/live`,className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,"aria-label":e(`inflightCardAria`),onClick:e=>e.stopPropagation(),children:[e(`inflightOpen`),(0,G.jsx)(ii,{size:14,"aria-hidden":!0})]}):(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted transition-colors hover:text-foreground`,onClick:()=>p(!0),children:[e(`inflightExpand`),(0,G.jsx)(gi,{size:14,"aria-hidden":!0})]}),f&&!l?(0,G.jsx)(`div`,{className:`flex items-center gap-1.5`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:(0,G.jsx)(h7,{size:`sm`,isSelected:m,ariaLabel:e(`inflightMockToggleAria`),label:e(`inflightMockToggle`),onChange:g})}):null]})]}),f?(0,G.jsxs)(`div`,{id:`inflight-live-body`,ref:N,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 px-4 pb-1 pt-0 sm:grid-cols-4`,children:[(0,G.jsx)(T7,{label:e(`inflightWaiting`),value:M.waiting,warn:V}),(0,G.jsx)(T7,{label:e(`inflightRunning`),value:M.occupiedSlots,suffix:`/${M.workerSlots}`}),(0,G.jsx)(T7,{label:e(`inflightThroughput`),value:j.throughputPerMin,suffix:`/min`}),(0,G.jsx)(T7,{label:e(`inflightWaitP95`),value:j.waitP95Ms,kind:`ms`})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 px-4 py-3 lg:grid-cols-[minmax(11rem,0.7fr)_minmax(0,2.1fr)_auto]`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,"data-queue-col":!0,children:[(0,G.jsxs)(`div`,{className:`mb-1.5 flex items-baseline justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightQueue`)}),(0,G.jsx)(`span`,{className:`mono text-[10px] tabular ${V?`text-[var(--il-warn-fg)]`:`text-muted`}`,children:M.waiting})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[R.map(t=>(0,G.jsxs)(`div`,{"data-wait-pill":!0,"data-wait-id":t.id,"data-priority":t.priority??`normal`,className:`relative flex items-center justify-between gap-2 overflow-hidden rounded-xl px-2.5 py-2 ${zCe(t.kind)}`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 w-2/5 bg-gradient-to-r from-transparent via-[color-mix(in_oklab,var(--foreground)_8%,transparent)] to-transparent motion-safe:animate-[inflight-queue-shimmer_2.8s_linear_infinite]`}),(0,G.jsxs)(`span`,{className:`relative z-[1] flex min-w-0 items-center gap-2.5 truncate text-caption font-medium text-foreground/78`,children:[RCe(t.kind),(0,G.jsxs)(`span`,{className:`truncate`,children:[t.name,t.priority===`high`?(0,G.jsx)(`span`,{className:`mono ml-1 text-[10px] text-muted`,children:`↑`}):null,t.sticky?(0,G.jsx)(`span`,{className:`mono ml-1 text-[10px] text-muted`,children:e(`inflightSticky`)}):null]})]}),(0,G.jsx)(`span`,{className:`relative z-[1] mono shrink-0 text-caption text-muted`,children:S7(LCe(t,w))})]},t.id)),z.length?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 pt-1`,"data-queue-overflow":!0,children:[z.map(e=>(0,G.jsx)(`span`,{"data-wait-token":!0,"data-wait-id":e.id,"data-priority":e.priority??`normal`,className:`size-2 rounded-[2px] ${C7(e.kind)} ${e.priority===`high`?`ring-1 ring-foreground/20`:``}`,title:e.name},e.id)),(0,G.jsxs)(`span`,{className:`mono text-[10px] text-muted`,children:[`+`,z.length]})]}):R.length===0?(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e(`inflightQueueEmpty`)}):null]})]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`mb-1.5 flex items-baseline justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightSlots`)}),(0,G.jsxs)(`span`,{className:`mono text-[10px] tabular text-muted`,children:[M.occupiedSlots,`/`,M.workerSlots]})]}),(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,"data-worker-rail":!0,children:B.map(t=>(0,G.jsx)(VCe,{slot:t,jobById:L,clockMs:w,idleLabel:e(`inflightSlotIdle`),landedCellIds:E},t.id))})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 sm:gap-2.5 lg:w-[6.75rem] lg:flex-col lg:gap-2.5`,children:[(0,G.jsx)(E7,{label:e(`inflightDone`),value:j.totals.done,tone:`ok`,icon:(0,G.jsx)(Ei,{size:22,"aria-hidden":!0})}),(0,G.jsx)(E7,{label:e(`inflightFailed`),value:j.totals.failed,tone:`danger`,icon:(0,G.jsx)(yo,{size:22,"aria-hidden":!0})})]})]}),(0,G.jsxs)(`div`,{"data-depth":!0,className:`px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightDepth`)}),(0,G.jsx)(`span`,{className:`mono text-caption tabular text-muted`,children:te})]}),(0,G.jsx)(`div`,{className:`rounded-lg bg-[var(--il-item-bg)] px-1.5 pt-1.5 pb-1`,children:(0,G.jsx)(BCe,{series:j.depthSeries,bands:[],backpressure:j.backpressure,label:te})})]})]}):null]})}function T7({label:e,value:t,suffix:n,kind:r=`int`,warn:i}){return(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-caption uppercase tracking-wide text-muted`,children:e}),(0,G.jsxs)(`div`,{className:`mono mt-1 flex items-baseline gap-0.5 text-section font-semibold tabular ${i?`text-[var(--il-warn-fg)]`:`text-foreground`}`,children:[(0,G.jsx)(OV,{value:t,kind:r,duration:560}),n?(0,G.jsx)(`span`,{className:`text-[0.92em] opacity-80`,children:n}):null]})]})}function E7({label:e,value:t,tone:n,icon:r}){let i=n===`ok`;return(0,G.jsxs)(`div`,{"data-outcome":n,role:`group`,"aria-label":`${e}: ${t}`,title:`${e}: ${t}`,className:`flex min-h-28 min-w-[3.6rem] flex-1 flex-col items-center justify-center gap-2 rounded-2xl border px-3 py-4 ${i?`border-[color-mix(in_oklab,var(--success)_14%,transparent)] bg-[var(--il-ok-bg)]`:`border-[color-mix(in_oklab,var(--danger)_12%,transparent)] bg-[var(--il-err-bg)]`}`,children:[(0,G.jsx)(`span`,{className:`inline-flex size-12 items-center justify-center rounded-2xl ${i?`bg-[color-mix(in_oklab,var(--success)_14%,var(--surface))] text-[var(--il-ok-fg)]`:`bg-[color-mix(in_oklab,var(--danger)_12%,var(--surface))] text-[var(--il-err-fg)]`}`,"aria-hidden":!0,children:r}),(0,G.jsx)(`div`,{className:`mono text-[1.7rem] font-semibold tabular leading-none tracking-tight ${i?`text-[var(--il-ok-fg)]`:`text-[var(--il-err-fg)]`}`,children:(0,G.jsx)(OV,{value:t,kind:`int`,duration:560})}),(0,G.jsx)(`span`,{className:`text-caption font-medium ${i?`text-[color-mix(in_oklab,var(--success)_55%,var(--muted))]`:`text-[color-mix(in_oklab,var(--danger)_55%,var(--muted))]`}`,children:e})]})}function HCe(){return tI(`/api/live`)}var D7=2500,UCe=Math.round(6e4/D7);function WCe(e){let t=e?.intervalMs??2500,[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)([]);return(0,v.useEffect)(()=>{let e=!1,n=null,i=()=>{document.hidden||HCe().then(n=>{if(e)return;r(n);let i=Math.max(UCe,Math.round(6e4/t));a(e=>[...e,{at:Date.now(),value:n.in_flight}].slice(-i))}).catch(()=>{})},o=()=>{n||document.hidden||(i(),n=setInterval(i,t))},s=()=>{n&&clearInterval(n),n=null},c=()=>document.hidden?s():o();return o(),document.addEventListener(`visibilitychange`,c),()=>{e=!0,s(),document.removeEventListener(`visibilitychange`,c)}},[t]),{live:n,samples:i}}var GCe=(0,v.lazy)(()=>C(()=>import(`./TrafficChart-oYRXFvFw.js`).then(e=>({default:e.TrafficChart})),__vite__mapDeps([0,1]))),O7=3e4,KCe={window:{from:``,to:``,hours:24},totals:{requests:0,ok:0,incomplete:0,error:0,canceled:0,streaming:0,success_rate:0},latency:{},tokens:{prompt:0,completion:0,cache_read:0,total:0},status:[],errors:[],models:[],accounts:[],providers:[],series:[]};function qCe(e,t){return!e||e===`(unknown)`?t(`statsUnknown`):JV(e,t)}function JCe(e,t,n){return!t||t===`(unassigned)`?n:e.find(e=>e.id===t)?.name||t}var YCe=new Set([`quota`,`rate_limit`,`auth`,`not_ready`,`unavailable`,`invalid_request`,`model_not_available`]);function k7(e,t){let n={quota:`logsKindQuota`,rate_limit:`logsKindRateLimit`,auth:`logsKindAuth`,not_ready:`logsKindNotReady`,unavailable:`logsKindUnavailable`,invalid_request:`logsKindInvalidRequest`,model_not_available:`logsKindModelNotAvailable`};return n[e]?t(n[e]):e}var XCe=[`ok`,`incomplete`,`error`,`canceled`],A7={ok:`bg-success`,incomplete:`bg-warning`,error:`bg-danger`,canceled:`bg-muted`},j7={ok:`logsFilterOk`,incomplete:`logsFilterIncomplete`,error:`logsFilterError`,canceled:`logsFilterCanceled`};function M7(e,t){return t>0?e/t:null}function ZCe(e,t){if(!e)return null;let n=Date.parse(e);if(!Number.isFinite(n))return null;let r=Math.max(0,Math.round((n-t)/1e3));if(r<=0)return null;let i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60;return i?`${i}h ${a}m`:a?`${a}m ${String(o).padStart(2,`0`)}s`:`${o}s`}function QCe(e,t){let n=[e.down_until,e.cooldown_until].filter(e=>!!e).filter(e=>Date.parse(e)>t);return n.length?n.reduce((e,t)=>Date.parse(e)>=Date.parse(t)?e:t):null}function $Ce(e,t){return t?`danger`:(e??0)>=80?`warning`:`ok`}function ewe(){let{lang:e,t}=JF(),{overview:n,loading:r,error:i}=gI(),[a,o]=(0,v.useState)(`today`),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(!1),d=at(),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(!0),[y,b]=(0,v.useState)([]),[x,S]=(0,v.useState)(!0),[C,w]=(0,v.useState)(0),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(()=>Date.now()),[k,A]=(0,v.useState)(!1),[j,M]=(0,v.useState)(!1),{live:N,samples:P}=WCe({intervalMs:k?400:D7}),F=new Map((N?.accounts??[]).map(e=>[e.id,e])),I=!!n?.proxy?.ok,L=!!n?.worker?.ok,ee=n?.worker?.ready_count??0,R=n?.worker?.hot_count??0,z=N?.in_flight??n?.worker?.in_flight??0,B=f??KCe,V=n?.routing?.session_affinity,H=(V?.hits??0)+(V?.misses??0),te=M7(V?.hits??0,H),ne=y.map(e=>({account:e,until:QCe(e,D)})).filter(e=>e.until!=null),re=ne.length>0,ie=new Set(ne.map(e=>e.account.id)),ae=[...y.filter(e=>e.ready&&!ie.has(e.id)),...y.filter(e=>!e.ready&&!ie.has(e.id))].slice(0,6);(0,v.useEffect)(()=>{if(!re)return;let e=setInterval(()=>O(Date.now()),1e3);return()=>clearInterval(e)},[re]),(0,v.useEffect)(()=>{let e=!1;return Promise.allSettled([nI(!1),lI()]).then(([t,n])=>{e||(t.status===`fulfilled`&&b(t.value.data||[]),n.status===`fulfilled`&&w((n.value.data||[]).length))}).finally(()=>{e||S(!1)}),()=>{e=!0}},[]);let oe=s?.start?.toString()??``,se=s?.end?.toString()??``,ce=(0,v.useRef)(0),le=(0,v.useCallback)(e=>{let t=FV(a,s);if(!t){_(!1);return}let n=++ce.current;mV(t).then(e=>{n===ce.current&&(p(e),h(``))}).catch(t=>{n!==ce.current||e||(p(null),h(t instanceof Error?t.message:String(t)))}).finally(()=>{n===ce.current&&_(!1)})},[a,oe,se]);(0,v.useEffect)(()=>(le(!1),()=>{ce.current++}),[le]),(0,v.useEffect)(()=>{if(l)return;let e=Date.now(),t=()=>{document.hidden||(e=Date.now(),le(!0))},n=setInterval(t,O7),r=()=>{!document.hidden&&Date.now()-e>=O7&&t()};return document.addEventListener(`visibilitychange`,r),()=>{clearInterval(n),document.removeEventListener(`visibilitychange`,r)}},[l,le]),(0,v.useEffect)(()=>{let e=!1,t=()=>{Sse().then(t=>{e||E(t)}).catch(()=>{})};t();let n=setInterval(t,5e3);return()=>{e=!0,clearInterval(n)}},[]);let ue=Math.floor(B.series.length/2),de=(e,t)=>e.reduce((e,n)=>e+n[t],0),fe=B.series.slice(0,ue),pe=B.series.slice(ue),me=((e,t)=>e>0?(t-e)/e:null)(de(fe,`requests`),de(pe,`requests`)),he=de(fe,`requests`)?de(fe,`ok`)/de(fe,`requests`):null,ge=de(pe,`requests`)?de(pe,`ok`)/de(pe,`requests`):null,_e=he!=null&&ge!=null?ge-he:null,ve=[{label:t(`metricRequests`),value:B.totals.requests,kind:`compact`,detail:t(`statsWindowHint`,{window:t(PV[a])}),ok:B.totals.requests>0,trend:me},{label:t(`metricSuccess`),value:B.totals.success_rate,kind:`percent`,detail:`${B.totals.ok} ${t(`logsFilterOk`)} · ${B.totals.incomplete} ${t(`logsFilterIncomplete`)} · ${B.totals.error} ${t(`logsFilterError`)}`,ok:B.totals.requests===0||B.totals.success_rate>=.9,trend:_e},{label:t(`metricLatency`),value:B.latency.p95_ms??B.latency.avg_ms,kind:`ms`,detail:`p50 ${_V(B.latency.p50_ms)} · avg ${_V(B.latency.avg_ms)}`,ok:B.latency.p95_ms==null||B.latency.p95_ms<8e3,trend:null},{label:t(`metricTokens`),value:B.tokens.total,kind:`compact`,detail:`${gV(B.tokens.prompt)} / ${gV(B.tokens.completion)}`,ok:!0,trend:null}],ye=M7(B.tokens.cache_read,B.tokens.prompt),be=M7(B.totals.streaming,B.totals.requests),xe=[{label:t(`metricCacheHit`),value:ye,kind:`percent`,detail:t(`metricCacheHitDetail`,{read:gV(B.tokens.cache_read),prompt:gV(B.tokens.prompt)})},{label:t(`metricStreaming`),value:be,kind:`percent`,detail:t(`metricStreamingDetail`,{count:B.totals.streaming,total:B.totals.requests})},{label:t(`metricCanceled`),value:B.totals.canceled,kind:`int`,detail:t(`metricCanceledDetail`,{rate:yV(M7(B.totals.canceled,B.totals.requests)??0)})}],Se=XCe.map(e=>({key:e,count:B.status.find(t=>t.key===e)?.count??B.totals[e]??0})),Ce=e=>LV(e,B.window.from,B.window.to);return r&&!n?(0,G.jsx)(kce,{}):(0,G.jsxs)(`div`,{className:`space-y-5 sm:space-y-4`,children:[(0,G.jsxs)(`section`,{className:`grid gap-3 pb-1 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:t(`homeDisplay`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:t(`homeLead`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(IV,{value:a,onChange:o,custom:s,onCustomChange:c,onBusy:()=>_(!0),t}),(0,G.jsxs)(Mj,{delay:300,children:[(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(l?`statsRefreshResume`:`statsRefreshPause`),"aria-pressed":l,onPress:()=>u(e=>!e),children:l?(0,G.jsx)(Aa,{size:14}):(0,G.jsx)(Ea,{size:14})}),(0,G.jsx)(Mj.Content,{children:t(l?`statsRefreshPaused`:`statsRefreshAuto`)})]}),(0,G.jsxs)(`div`,{className:`text-left sm:text-right`,children:[(0,G.jsx)(`div`,{className:`mono text-caption text-muted`,children:n?.time||`—`}),(0,G.jsxs)(`div`,{className:`mt-1 inline-flex items-center gap-2 text-body font-medium`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":I&&L?`ok`:`danger`}),t(I&&L?`running`:`degraded`)]})]})]})]}),i?(0,G.jsx)(xI,{title:t(`failedOverview`,{msg:i})}):null,(0,G.jsx)(Ele,{live:N,samples:P,t,onConcurrencyClick:()=>A(!0)}),(0,G.jsx)(w7,{t,expanded:k,onExpandedChange:A,live:k?N:null}),(0,G.jsx)(`section`,{"data-gsap-reveal":!0,className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:ve.map(e=>(0,G.jsxs)(CS,{className:`gap-0 p-3.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,G.jsx)(`span`,{className:`status-dot`,"data-state":e.ok?`ok`:`danger`})]}),(0,G.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`tabular text-metric font-medium leading-none`,children:g?(0,G.jsx)(Q,{className:`h-7 w-24`}):e.value==null?`—`:(0,G.jsx)(OV,{value:e.value,kind:e.kind})}),!g&&e.trend!=null?(0,G.jsx)(nwe,{value:e.trend,hint:t(`trendHalfHint`)}):null]}),(0,G.jsx)(`div`,{className:`mono mt-2 truncate text-caption text-muted`,children:g?(0,G.jsx)(Q,{className:`h-3 w-28`}):e.detail})]},e.label))}),(0,G.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-3`,children:xe.map(e=>(0,G.jsx)(CS,{className:`gap-0 p-3.5`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,G.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:g?(0,G.jsx)(Q,{className:`h-3 w-28`}):e.detail})]}),(0,G.jsx)(`div`,{className:`tabular text-section font-semibold sm:shrink-0`,children:g?(0,G.jsx)(Q,{className:`h-5 w-12`}):e.value==null?`—`:(0,G.jsx)(OV,{value:e.value,kind:e.kind})})]})},e.label))}),(0,G.jsx)(`section`,{className:`grid gap-3`,children:(0,G.jsxs)(CS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTraffic`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsTrafficHint`)})]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:B.totals.error?`warning`:`success`,children:yV(B.totals.success_rate)})]}),(0,G.jsxs)(`div`,{className:`space-y-4 p-4`,children:[m?(0,G.jsx)(`div`,{className:`text-body text-danger`,children:t(`failedStats`,{msg:m})}):g?(0,G.jsx)(eV,{}):B.series.some(e=>e.requests>0)?(0,G.jsx)(v.Suspense,{fallback:(0,G.jsx)(eV,{}),children:(0,G.jsx)(GCe,{series:B.series,lang:e,emptyLabel:t(`statsEmptyTraffic`),okLabel:t(`logsFilterOk`),errorLabel:t(`logsFilterError`),selectHint:t(`statsDragHint`),labels:{requests:t(`chartMetricRequests`),tokens:t(`chartMetricTokens`),latency:t(`chartMetricLatency`),input:t(`chartInput`),output:t(`chartOutput`),cacheRead:t(`chartCacheRead`),p50:t(`statsLatencyP50`),p95:t(`statsLatencyP95`),total:t(`chartTotal`)},onSelectRange:(e,t)=>d(LV({},e,t))})}):(0,G.jsx)(kV,{emptyLabel:t(`statsEmptyTraffic`)}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-4 pt-3 sm:grid-cols-4 sm:gap-3`,children:[[t(`statsLatencyP50`),_V(B.latency.p50_ms)],[t(`statsLatencyP95`),_V(B.latency.p95_ms)],[t(`statsLatencyAvg`),_V(B.latency.avg_ms)],[t(`statsTTFB`),_V(B.latency.ttfb_avg_ms)]].map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e}),(0,G.jsx)(`div`,{className:`mono mt-1 text-body font-medium`,children:g?(0,G.jsx)(Q,{className:`h-4 w-16`}):t})]},String(e)))})]})]})}),(0,G.jsxs)(`section`,{className:`grid gap-3 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,.85fr)]`,children:[(0,G.jsxs)(CS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsPool`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsPoolHint`)})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[!x&&ne.length?(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-2xl bg-surface-secondary px-2 py-0.5 text-caption text-muted transition-colors hover:text-foreground`,"aria-expanded":j,"aria-label":t(`statsCoolingChip`,{count:ne.length}),onClick:()=>M(e=>!e),children:[(0,G.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":`warn`}),(0,G.jsx)(`span`,{className:`mono tabular`,children:t(`statsCoolingChip`,{count:ne.length})}),(0,G.jsx)(gi,{size:10,className:`transition-transform duration-200 ${j?`rotate-90`:``}`,"aria-hidden":!0})]}):null,(0,G.jsxs)(Sn,{to:`/accounts`,className:`inline-flex items-center gap-1 text-caption font-medium text-muted hover:text-foreground`,children:[t(`navAccounts`),(0,G.jsx)(ii,{size:12})]})]})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-y-1 border-b border-separator sm:grid-cols-4 sm:gap-y-0`,children:[[t(`ready`),ee,`ok`],[t(`hot`),R,R?`ok`:``],[t(`inFlight`),z,z?`ok`:``],[t(`statsAffinityHit`),te==null?`—`:yV(te),``,V?t(`statsAffinityHint`,{hits:V.hits??0,misses:V.misses??0,bindings:V.bindings??0}):``]].map(([e,t,n,r])=>(0,G.jsxs)(`div`,{className:`px-4 py-3 sm:py-2.5`,title:r?String(r):void 0,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e}),(0,G.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 sm:mt-1`,children:[(0,G.jsx)(`span`,{className:`mono text-section font-semibold`,children:t}),n?(0,G.jsx)(`span`,{className:`status-dot`,"data-state":n}):null]})]},String(e)))}),j&&ne.length?(0,G.jsxs)(`div`,{className:`border-b border-separator bg-surface-secondary/50 px-4 py-2`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`statsCoolingDetails`)}),(0,G.jsx)(`div`,{className:`mt-1.5 space-y-1`,children:ne.map(({account:e,until:n})=>(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-caption`,children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground/80`,children:e.name||e.id}),(0,G.jsx)(`span`,{className:`mono shrink-0 text-muted`,children:e.last_error_kind?k7(e.last_error_kind,t):t(`statsUnknown`)}),(0,G.jsx)(`span`,{className:`mono shrink-0 tabular text-muted sm:w-16 sm:text-right`,children:ZCe(n,D)??`—`}),(0,G.jsx)(`span`,{className:`mono hidden shrink-0 text-muted sm:inline sm:w-10 sm:text-right`,title:t(`statsBackoffLevel`),children:e.restart_backoff_level?`L${e.restart_backoff_level}`:`—`})]},e.id))})]}):null,(0,G.jsx)(`div`,{className:`divide-y divide-separator`,children:x?(0,G.jsx)($B,{}):y.length===0?(0,G.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t(`noAccounts`)}):ae.length===0?(0,G.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t(`statsPoolReadyEmpty`)}):ae.map(e=>{let n=e.quota,r=$Ce(n?.percentage,n?.exceeded),i=F.get(e.id),a=i?.in_flight??e.in_flight??e.inFlight??0,o=i?.max_inflight||e.max_inflight||4,s=a>=o;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2.5 px-4 py-3 sm:flex-row sm:items-center sm:gap-3 sm:py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3 sm:items-center`,children:[(0,G.jsx)(`span`,{className:`status-dot mt-1.5 shrink-0 sm:mt-0`,"data-state":e.ready?`ok`:`danger`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(XV,{provider:e.provider,size:14}),(0,G.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.name||e.id})]}),(0,G.jsxs)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:[YV(e.provider,e.region,t),` · `,e.hot?t(`hot`):e.ready?t(`ready`):t(`degraded`)]})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 pl-6 sm:shrink-0 sm:pl-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:t(s?`liveSaturated`:`inFlight`),"data-testid":`account-inflight`,children:[(0,G.jsx)(`span`,{className:`text-caption text-muted sm:hidden`,children:t(`inFlight`)}),(0,G.jsxs)(`span`,{className:`mono text-caption tabular ${s?`text-warning`:`text-muted`}`,children:[a,`/`,o]}),(0,G.jsx)(`span`,{className:`inline-block h-[2px] w-10 overflow-hidden rounded-[1px] bg-separator`,children:(0,G.jsx)(`span`,{className:`block h-full ${s?`bg-warning`:`bg-foreground/50`}`,style:{width:`${Math.min(100,a/o*100)}%`}})})]}),n?(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:t(`quota`),children:[(0,G.jsx)(`span`,{className:`text-caption text-muted sm:hidden`,children:t(`quota`)}),(0,G.jsxs)(`span`,{className:`mono text-caption tabular text-muted`,children:[Math.round(n.percentage??0),`%`]}),(0,G.jsx)(`span`,{className:`inline-block h-[2px] w-10 overflow-hidden rounded-[1px] bg-separator`,children:(0,G.jsx)(`span`,{className:`block h-full ${r===`danger`?`bg-danger`:r===`warning`?`bg-warning`:`bg-success`}`,style:{width:`${Math.min(100,Math.max(0,n.percentage??0))}%`}})})]}):null]})]},e.id)})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-t border-separator px-4 py-2.5 text-caption text-muted`,children:[(0,G.jsxs)(`span`,{children:[t(`metricModels`),` `,C]}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center justify-end gap-x-2 gap-y-1`,children:[[`qoder`,`workbuddy`,`trae`].map(e=>{let t=y.filter(t=>String(t.provider||`qoder`).toLowerCase()===e).length;return t?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,G.jsx)(XV,{provider:e,size:11}),t]},e):null}),(0,G.jsxs)(`span`,{children:[y.length,` `,t(`accountCount`)]})]})]})]}),(0,G.jsx)(twe,{resources:T,t})]}),(0,G.jsxs)(`section`,{className:`grid gap-3 xl:grid-cols-2 2xl:grid-cols-3`,children:[(0,G.jsxs)(CS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTopProviders`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsTopProvidersHint`)})]})}),g?(0,G.jsx)($B,{}):(0,G.jsx)(P7,{empty:t(`statsNoProviders`),items:(B.providers||[]).map(e=>({key:e.key,label:qCe(e.key,t),count:e.count,meta:`${e.ok}/${e.count}`,mark:e.key===`(unknown)`?void 0:e.key,href:e.key===`(unknown)`?void 0:Ce({provider:e.key})}))})]}),(0,G.jsxs)(CS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTopModels`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`providerCatalog`)})]})}),g?(0,G.jsx)($B,{rows:4}):(0,G.jsx)(P7,{empty:t(`statsNoModels`),items:B.models.map(e=>({key:e.key,label:e.key===`(unknown)`?t(`statsUnknown`):e.key,count:e.count,href:e.key===`(unknown)`?void 0:Ce({model:e.key}),meta:e.latency_avg_ms==null?`${e.ok}/${e.count}`:_V(e.latency_avg_ms)}))})]}),(0,G.jsxs)(CS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsStatusMix`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsStatusMixHint`)})]})}),g?(0,G.jsx)($B,{rows:4}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(rwe,{items:Se,t}),(0,G.jsx)(`div`,{className:`border-t border-separator px-4 pt-2.5 text-caption font-medium text-muted`,children:t(`statsErrorMix`)}),(0,G.jsx)(P7,{empty:t(`statsNoErrors`),danger:!0,items:B.errors.map(e=>({key:e.key,label:k7(e.key,t),count:e.count,href:YCe.has(e.key)?Ce({error_kind:e.key}):void 0}))}),(0,G.jsx)(`div`,{className:`border-t border-separator px-4 pt-2.5 text-caption font-medium text-muted`,children:t(`statsTopAccounts`)}),(0,G.jsx)(P7,{empty:t(`statsNoAccounts`),items:B.accounts.slice(0,5).map(e=>({key:e.key,label:JCe(y,e.key,t(`statsUnassigned`)),count:e.count,href:!e.key||e.key===`(unassigned)`?void 0:Ce({account:e.key}),meta:`${e.ok}/${e.count}`}))})]})]})]})]})}function N7(e,t){return e>=2147483648||t>=200?`danger`:e>=1073741824||t>=100?`warning`:`ok`}function twe({resources:e,t}){let n=[...e?.workers??[]].sort((e,t)=>t.rss_bytes-e.rss_bytes),r=e?.server;return(0,G.jsxs)(CS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`resTitle`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`resHint`)})]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:e?`success`:`default`,children:e?vV(e.total_rss_bytes):`—`})]}),(0,G.jsx)(`div`,{className:`divide-y divide-separator`,children:e?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":N7(r?.rss_bytes??0,r?.cpu_percent??0)}),(0,G.jsx)(`div`,{className:`truncate text-body font-medium`,children:t(`resServer`)}),(0,G.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`pid `,r?.pid]})]}),(0,G.jsxs)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:[vV(r?.rss_bytes),` · `,(r?.cpu_percent??0).toFixed(1),`%`]})]})}),n.length===0?(0,G.jsx)(`div`,{className:`px-4 py-3 text-body text-muted`,children:t(`resEmpty`)}):n.map(e=>(0,G.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":N7(e.rss_bytes,e.cpu_percent)}),(0,G.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.label||e.account_id}),(0,G.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`pid `,e.pid]})]}),(0,G.jsxs)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:[vV(e.rss_bytes),` · `,e.cpu_percent.toFixed(1),`%`]})]})},e.pid))]}):(0,G.jsx)($B,{rows:3})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-t border-separator px-4 py-2.5 text-caption text-muted`,children:[(0,G.jsxs)(`span`,{className:`mono`,children:[r?.goroutines??0,` `,t(`resGoroutines`)]}),(0,G.jsx)(`span`,{className:`mono`,children:e?.sampled_at?new Date(e.sampled_at).toLocaleTimeString():`—`})]})]})}function P7({items:e,empty:t,danger:n}){let r=(0,v.useRef)(null),i=Math.max(1,...e.map(e=>e.count)),a=e.map(e=>`${e.key}:${e.count}`).join(`|`);return(0,v.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=Z.context(()=>{let e=Z.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(`[data-rank-fill]`,{clearProps:`transform`})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=Z.utils.toArray(`[data-rank-fill]`);e.length&&Z.fromTo(e,{scaleX:0},{scaleX:1,duration:.38,ease:`power2.out`,stagger:.05,transformOrigin:`0% 50%`})})},e);return()=>t.revert()},[a]),e.length?(0,G.jsx)(`div`,{ref:r,className:`divide-y divide-separator`,children:e.map(e=>{let t=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.mark?(0,G.jsx)(XV,{provider:e.mark,size:14}):null,(0,G.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.label})]}),(0,G.jsx)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:e.meta?`${e.count} · ${e.meta}`:e.count})]}),(0,G.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded-[2px] bg-separator`,children:(0,G.jsx)(`div`,{"data-rank-fill":!0,className:`h-full origin-left rounded-[2px] ${n?`bg-danger`:`bg-success`}`,style:{width:`${Math.max(6,e.count/i*100)}%`}})})]});return e.href?(0,G.jsx)(Sn,{to:e.href,className:`rank-row block px-4 py-2.5`,title:e.label,children:t},e.key):(0,G.jsx)(`div`,{className:`px-4 py-2.5`,children:t},e.key)})}):(0,G.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t})}function nwe({value:e,hint:t}){let n=Math.abs(e)<.005?`flat`:e>0?`up`:`down`;return(0,G.jsxs)(`span`,{className:`trend-chip`,"data-tone":n,title:t,children:[(0,G.jsx)(n===`down`?oo:n===`up`?co:bi,{size:12,weight:`bold`}),e>0?`+`:``,(e*100).toFixed(1),`%`]})}function rwe({items:e,t}){let n=e.reduce((e,t)=>e+t.count,0);return n?(0,G.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,G.jsx)(`div`,{className:`flex h-2 gap-px overflow-hidden rounded-[3px] bg-separator`,role:`img`,"aria-label":e.map(e=>`${t(j7[e.key])} ${e.count}`).join(`, `),children:e.filter(e=>e.count>0).map(e=>(0,G.jsx)(`div`,{className:A7[e.key],style:{width:`${e.count/n*100}%`,minWidth:2}},e.key))}),(0,G.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-x-4 gap-y-1.5`,children:e.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-caption`,children:[(0,G.jsx)(`span`,{className:`inline-block size-2 shrink-0 rounded-[2px] ${A7[e.key]}`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted`,children:t(j7[e.key])}),(0,G.jsx)(`span`,{className:`mono tabular`,children:e.count}),(0,G.jsx)(`span`,{className:`mono w-10 text-right tabular text-muted`,children:yV(e.count/n)})]},e.key))})]}):(0,G.jsx)(`div`,{className:`px-4 py-3 text-body text-muted`,children:t(`statsEmptyTraffic`)})}function F7(e){return e?e>=1e6?`${(e/1e6).toString().replace(/\.0$/,``)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e):`—`}function iwe({model:e,t,onClose:n}){if(!e)return null;let r=e.reasoning_options||[],i=e.catalog_context_length||e.default_context_length||e.context_length,a=e.catalog_context_length_max,o=bV(e),s=xV(e),c=String(e.provider||e.owned_by||`qoder`).trim().toLowerCase(),l=YV(c,String(e.region||e.regions?.[0]||``).trim().toLowerCase()||void 0,t),u=c===`trae`?fle(e):void 0;return(0,G.jsx)(Y.Root,{isOpen:!0,onOpenChange:e=>{e||n()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`md`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`text-section`,children:e.display_name||e.id}),s?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null]}),(0,G.jsx)(`div`,{className:`mono mt-1 text-caption text-muted`,children:e.id}),(0,G.jsxs)(`div`,{className:`mt-1 text-caption text-muted`,children:[l,o?` · ${o}`:``]})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(yo,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`space-y-4 px-5 pb-5`,children:[(0,G.jsxs)(`section`,{children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:t(`contextWindowCol`)}),(0,G.jsxs)(`div`,{className:`mt-1 text-body`,children:[F7(i),a&&a!==i?` → ${F7(a)}`:``]}),e.supports_max_mode?(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(c===`qoder`?`qoderMaxModeHint`:`maxModeHint`)}):null,!e.supports_max_mode&&a&&a!==i?(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`workbuddyContextHint`)}):null,u?u.prompt_max_tokens?(0,G.jsxs)(`div`,{className:`mt-1 text-caption text-muted`,children:[t(`promptMaxTokens`),`: `,F7(u.prompt_max_tokens)]}):null:e.prompt_max_tokens?(0,G.jsxs)(`div`,{className:`mt-1 text-caption text-muted`,children:[t(`promptMaxTokens`),`: `,F7(e.prompt_max_tokens)]}):null,u?u.max_output_tokens?(0,G.jsxs)(`div`,{className:`text-caption text-muted`,children:[t(`maxOutputTokens`),`: `,F7(u.max_output_tokens)]}):null:e.max_output_tokens?(0,G.jsxs)(`div`,{className:`text-caption text-muted`,children:[t(`maxOutputTokens`),`: `,F7(e.max_output_tokens)]}):null]}),(0,G.jsxs)(`section`,{children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:t(`reasoningLevels`)}),r.length?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`reasoningHint`)}),(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:r.map(n=>{let r=`reasoningLevel_${n}`,i=t(r);return(0,G.jsxs)(BS,{size:`sm`,variant:`soft`,color:n===(e.reasoning_effort||e.reasoning_default)?`success`:`default`,children:[i===r?n:i,n===e.reasoning_default?` · ${t(`defaultValue`)}`:``,n===e.reasoning_effort&&n!==e.reasoning_default?` · ${t(`custom`)}`:``]},n)})})]}):(0,G.jsx)(`div`,{className:`mt-1 text-body text-muted`,children:e.reasoning_type?t(`reasoningFixed`,{type:e.reasoning_type}):t(`noReasoningLevels`)})]})]})]})})})})}function I7({title:e,hint:t,action:n,icon:r,className:i}){return(0,G.jsx)(`div`,{className:`grid min-h-56 place-items-center px-6 py-12 text-center ${i||``}`,children:(0,G.jsxs)(`div`,{className:`max-w-sm`,children:[r?(0,G.jsx)(`div`,{className:`mb-3 flex justify-center text-muted`,children:r}):null,(0,G.jsx)(FM,{className:`p-0 text-body font-medium text-foreground`,children:e}),t?(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t}):null,n?(0,G.jsx)(`div`,{className:`mt-5 flex justify-center`,children:n}):null]})})}var L7=`__all__`;function R7({value:e,onChange:t,ariaLabel:n,options:r,className:i}){let a=r.map(e=>({id:e.id||L7,label:e.label})),o=e||L7,s=a.find(e=>e.id===o);return(0,G.jsxs)(KP,{className:i??`w-fit min-w-36`,"aria-label":n,value:o,onChange:e=>{typeof e==`string`&&t(e===L7?``:e)},children:[(0,G.jsxs)(KP.Trigger,{className:`min-w-0 w-full items-center`,children:[(0,G.jsx)(KP.Value,{className:`min-w-0 truncate`,children:({defaultChildren:e,isPlaceholder:t})=>t||!s?e:(0,G.jsx)(`span`,{className:`truncate`,children:s.label})}),(0,G.jsx)(KP.Indicator,{})]}),(0,G.jsx)(KP.Popover,{className:`max-h-72 min-w-36`,children:(0,G.jsx)(SP,{children:a.map(e=>(0,G.jsxs)(SP.Item,{id:e.id,textValue:e.label,children:[(0,G.jsx)(jM,{className:`block truncate`,children:e.label}),(0,G.jsx)(SP.ItemIndicator,{})]},e.id))})})]})}var awe=[20,50,100],owe=[20,50,100];function swe(e,t){if(t<=7)return Array.from({length:t},(e,t)=>t+1);let n=[1];e>3&&n.push(`gap`);let r=Math.max(2,e-1),i=Math.min(t-1,e+1);for(let e=r;e<=i;e++)n.push(e);return e{let t=Number([...e][0]);d.includes(t)&&u(t)},"aria-label":a,children:d.map(e=>(0,G.jsx)(sA,{id:String(e),children:e},e))})]}),(0,G.jsxs)(UP,{size:`sm`,className:`w-fit`,children:[(0,G.jsx)(UP.Summary,{className:`mono text-caption`,children:o}),(0,G.jsxs)(UP.Content,{children:[(0,G.jsx)(UP.Item,{children:(0,G.jsx)(UP.Previous,{isDisabled:i||t<=1,onPress:()=>l(Math.max(1,t-1)),"aria-label":s,children:(0,G.jsx)(UP.PreviousIcon,{})})}),f.map((e,n)=>e===`gap`?(0,G.jsx)(UP.Item,{children:(0,G.jsx)(UP.Ellipsis,{})},`gap-${n}`):(0,G.jsx)(UP.Item,{children:(0,G.jsx)(UP.Link,{isActive:e===t,isDisabled:i,onPress:()=>l(e),children:e})},e)),(0,G.jsx)(UP.Item,{children:(0,G.jsx)(UP.Next,{isDisabled:i||t>=n,onPress:()=>l(Math.min(n,t+1)),"aria-label":c,children:(0,G.jsx)(UP.NextIcon,{})})})]})]})]})}function B7({value:e,onChange:t,placeholder:n,ariaLabel:r,className:i}){return(0,G.jsx)(kM,{"aria-label":r,value:e,onChange:t,className:i,children:(0,G.jsxs)(kM.Group,{children:[(0,G.jsx)(kM.SearchIcon,{}),(0,G.jsx)(kM.Input,{placeholder:n}),(0,G.jsx)(kM.ClearButton,{})]})})}function cwe(e){let t=[];for(let n of e)for(let e of n.regions||[])e?.id&&t.push({value:`${n.id}:${e.id}`,provider:n.id,region:e.id});return t}function V7(e){return e.settings_key||e.id}function H7(e){return String(e.provider||e.owned_by||`qoder`).trim().toLowerCase()}function U7(e){let t=String(e.region||``).trim().toLowerCase();if(t)return t;let n=e.regions||[];return String(n[0]||``).trim().toLowerCase()}function W7(e){return`${H7(e)}:${U7(e)||`any`}:${e.settings_key||e.id}:${e.native_model||e.mapped_key||``}`}function G7(e){let t=e.route_display_name||``;return t&&t!==(e.display_name||e.id)?t:``}function K7(e,t){let n=`reasoningLevel_${t}`,r=e(n);return r===n?t:r}function q7({label:e,hint:t}){return(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(`span`,{className:`cursor-help text-caption text-muted`,children:e})}),(0,G.jsx)(Mj.Content,{children:(0,G.jsx)(`p`,{className:`max-w-xs text-caption leading-5`,children:t})})]})}function J7({model:e,saving:t,t:n,variant:r=`table`,onToggleTraeMax:i,onReasoningChange:a}){let o=H7(e),s=r===`card`,c=s?`w-full min-w-0`:`w-full max-w-[7.5rem] min-w-0`;return(0,G.jsxs)(`div`,{className:s?`flex min-w-0 flex-col gap-3`:`flex min-w-0 flex-col gap-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[F7(e.catalog_context_length||e.context_length),e.catalog_context_length_max&&e.catalog_context_length_max!==(e.catalog_context_length||e.context_length)?` → ${F7(e.catalog_context_length_max)}`:``]}),o===`workbuddy`&&e.catalog_context_length_max&&e.catalog_context_length_max!==(e.catalog_context_length||e.context_length)?(0,G.jsx)(q7,{label:n(`catalogWindow`),hint:n(`workbuddyContextHint`)}):null]}),(o===`trae`||o===`qoder`)&&e.supports_max_mode?(0,G.jsxs)(`div`,{className:s?`flex flex-col gap-1.5`:`flex items-center gap-2`,children:[s?(0,G.jsx)(q7,{label:`${n(`maxMode`)}${e.catalog_context_length_max?` ${F7(e.catalog_context_length_max)}`:``}`,hint:n(o===`qoder`?`qoderMaxModeHint`:`maxModeHint`)}):null,(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(h7,{isSelected:!!e.max_mode,isDisabled:t,ariaLabel:`${e.id} ${n(`maxMode`)}`,onChange:t=>i(e,t)}),s?null:(0,G.jsx)(q7,{label:`${n(`maxMode`)}${e.catalog_context_length_max?` ${F7(e.catalog_context_length_max)}`:``}`,hint:n(o===`qoder`?`qoderMaxModeHint`:`maxModeHint`)})]})]}):null,(e.reasoning_options||[]).length>1?(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,G.jsx)(q7,{label:n(`reasoningLevels`),hint:n(`reasoningHint`)}),(0,G.jsx)(R7,{className:c,ariaLabel:`${e.id} ${n(`reasoningLevels`)}`,value:e.reasoning_effort||e.reasoning_default||e.reasoning_options?.[0]||``,onChange:t=>{t&&a(e,t)},options:(e.reasoning_options||[]).map(e=>({id:e,label:K7(n,e)}))})]}):(e.reasoning_options||[]).length===1?(0,G.jsx)(q7,{label:`${n(`reasoningLevels`)} ${K7(n,e.reasoning_options[0])}`,hint:n(`reasoningHint`)}):e.reasoning_type?(0,G.jsx)(`span`,{className:`text-caption text-muted`,children:n(`reasoningFixed`,{type:e.reasoning_type})}):o===`trae`&&!e.supports_max_mode?(0,G.jsx)(q7,{label:n(`catalogWindow`),hint:n(`catalogWindowHint`)}):null]})}function Y7({model:e,t,onDetails:n}){return(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>n(e),children:[(0,G.jsx)(ca,{size:14}),t(`modelDetails`)]})}function lwe(){let{t:e}=JF(),{overview:t,loading:n}=gI(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(1),[d,f]=(0,v.useState)(50),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)([]),[E,D]=(0,v.useState)(!0);(0,v.useEffect)(()=>{let e=!1;return $oe(void 0,`regional`).then(t=>{e||T(t.data||[])}).catch(()=>void 0).finally(()=>{e||D(!1)}),dI().then(t=>{e||c(cwe(t.data||[]))}).catch(()=>void 0),()=>{e=!0}},[]);let O=(0,v.useMemo)(()=>{let t=r.trim().toLowerCase(),[n,i]=a.includes(`:`)?a.split(`:`,2):[a,``];return w.filter(r=>{let a=H7(r),o=U7(r);if(n&&a!==n||i&&o!==i)return!1;if(!t)return!0;let s=YV(a,o||void 0,e);return`${r.display_name||``} ${r.id} ${r.mapped_key||``} ${a} ${s} ${r.owned_by||``} ${o} ${r.credits||``} ${r.free?`free`:``}`.toLowerCase().includes(t)})},[r,w,a,e]),k=[r,a,d].join(`\0`),[A,j]=(0,v.useState)(k);A!==k&&(j(k),u(1));let M=Math.max(1,Math.ceil(O.length/d)),N=Math.min(A===k?Math.max(1,l):1,M);l!==N&&u(N);let P=(0,v.useMemo)(()=>{let e=(N-1)*d;return O.slice(e,e+d)},[N,O,d]),F=O.length===0?0:(N-1)*d+1,I=Math.min(O.length,N*d),L=O.length?e(`logsShownTotal`,{shown:`${F}–${I}`,total:O.length}):e(`shownTotal`,{shown:0,total:w.length});if(n&&!t||E)return(0,G.jsx)(Nce,{});function ee(e,t){let n=V7(e),r=H7(e),i=w.map(e=>{if(V7(e)!==n||H7(e)!==r)return e;let i=e.reasoning_effort||e.reasoning_default||``,a=e.catalog_context_length||e.default_context_length||e.context_length||0,o=e.catalog_context_length_max||0;return{...e,max_mode:t,context_length:t&&o?o:a,default_context_length:a,context_custom:r===`qoder`?t:t||!!(i&&i!==e.reasoning_default)}});T(i)}function R(e,t){let n=V7(e),r=H7(e),i=w.map(e=>V7(e)!==n||H7(e)!==r?e:{...e,reasoning_effort:t,context_custom:!!e.max_mode||!!(t&&t!==e.reasoning_default)});T(i)}async function z(){m(!0),y(``),x(!1);try{let e=await uI(void 0,`regional`);T(e.data||[])}catch(e){x(!0),y(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function B(t,n){let r=H7(t);if(r!==`trae`&&r!==`workbuddy`&&r!==`kimi`&&r!==`codearts`)return;let i=V7(t);g(i),y(``),x(!1);try{await tse(r,i,n),R(t,n),y(e(`reasoningSaved`,{model:t.id,level:K7(e,n)}))}catch(e){x(!0),y(e instanceof Error?e.message:String(e))}finally{g(``)}}async function V(t,n){if(!t.supports_max_mode){x(!0),y(e(`contextMaxUnavailable`));return}let r=V7(t),i=H7(t);g(r),y(``),x(!1);try{await ese(i,r,n,t.catalog_context_length_max),ee(t,n),y(e(n?`contextMaxOn`:`contextMaxOff`,{model:t.id}))}catch(e){x(!0),y(e instanceof Error?e.message:String(e))}finally{g(``)}}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`grid gap-5 pb-6 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end`,children:[(0,G.jsxs)(`div`,{"data-gsap-reveal":!0,children:[(0,G.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`availableModels`)}),(0,G.jsx)(`p`,{className:`mt-1 text-body text-muted`,children:w.length?L:e(`noModelsYet`)})]}),(0,G.jsxs)(`div`,{"data-gsap-reveal":!0,className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center`,children:[(0,G.jsx)(B7,{className:`w-full min-w-0 sm:w-72`,value:r,onChange:i,placeholder:e(`filterPh`),ariaLabel:e(`filter`)}),(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(R7,{ariaLabel:e(`providerCol`),value:a,onChange:o,options:[{id:``,label:e(`providerFilterAll`)},...s.map(t=>({id:t.value,label:YV(t.provider,t.region,e)}))]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:p,onPress:()=>void z(),children:[(0,G.jsx)(Qr,{size:14}),e(p?`refreshing`:`refresh`)]})]})]})]}),_?(0,G.jsx)(xI,{status:b?`danger`:`success`,title:_}):null,(0,G.jsxs)(CS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-separator px-4 py-4 sm:items-center sm:px-5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-secondary text-muted`,children:(0,G.jsx)(Bi,{size:16})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-body font-semibold`,children:e(`providerCatalog`)}),(0,G.jsx)(`div`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:e(`contextConfigHint`)})]})]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,className:`shrink-0`,children:O.length})]}),p||n?(0,G.jsx)(tV,{}):O.length===0?(0,G.jsx)(I7,{icon:(0,G.jsx)(va,{size:22}),title:w.length?e(`noModelsMatch`):e(`noProviders`),hint:w.length?r||a||e(`noModelsMatch`):e(`noModelsYet`)}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`divide-y divide-separator lg:hidden`,children:P.map(t=>{let n=V7(t),r=h===n,i=H7(t),a=YV(i,U7(t)||void 0,e),o=bV(t),s=xV(t);return(0,G.jsxs)(`article`,{className:`space-y-3 px-4 py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`status-dot mt-1.5`,"data-state":t.stale?void 0:`ok`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`truncate font-medium`,children:t.display_name||t.id}),s?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`success`,children:e(`modelFree`)}):null,o?(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:o}):null]}),(0,G.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:t.id}),G7(t)?(0,G.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:e(`routedTo`,{model:G7(t)})}):null]})]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:t.context_custom||t.stale?`warning`:`success`,children:t.context_custom?e(`custom`):e(`defaultValue`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-caption`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(XV,{provider:i,size:14}),(0,G.jsx)(`span`,{className:`font-medium`,children:a})]}),(0,G.jsx)(`span`,{className:`mono break-all text-muted`,children:t.mapped_key||t.native_model||t.id})]}),(0,G.jsx)(J7,{model:t,saving:r,t:e,variant:`card`,onToggleTraeMax:(e,t)=>void V(e,t),onReasoningChange:(e,t)=>void B(e,t)}),(0,G.jsx)(Y7,{model:t,t:e,onDetails:C})]},W7(t))})}),(0,G.jsx)(X,{className:`hidden min-w-0 lg:block`,children:(0,G.jsx)(X.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,G.jsxs)(X.Content,{"aria-label":e(`availableModels`),className:`min-w-[68rem]`,children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:e(`modelCol`)}),(0,G.jsx)(X.Column,{children:e(`requestIdCol`)}),(0,G.jsx)(X.Column,{children:e(`providerCol`)}),(0,G.jsx)(X.Column,{children:e(`qoderKeyCol`)}),(0,G.jsx)(X.Column,{children:e(`modelDefaultsCol`)}),(0,G.jsx)(X.Column,{children:e(`stateCol`)}),(0,G.jsx)(X.Column,{children:e(`actions`)})]}),(0,G.jsx)(X.Body,{children:P.map(t=>{let n=V7(t),r=h===n,i=H7(t),a=YV(i,U7(t)||void 0,e),o=bV(t),s=xV(t);return(0,G.jsxs)(X.Row,{children:[(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":t.stale?void 0:`ok`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:t.display_name||t.id}),s?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`success`,children:e(`modelFree`)}):null,o?(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:o}):null]}),G7(t)?(0,G.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:e(`routedTo`,{model:G7(t)})}):null]})]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-caption font-medium`,children:t.id})}),(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(XV,{provider:i,size:14}),(0,G.jsx)(`span`,{className:`text-caption font-medium`,children:a})]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:t.mapped_key||t.native_model||t.id})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(J7,{model:t,saving:r,t:e,variant:`table`,onToggleTraeMax:(e,t)=>void V(e,t),onReasoningChange:(e,t)=>void B(e,t)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:t.context_custom||t.stale?`warning`:`success`,children:t.context_custom?e(`custom`):e(`defaultValue`)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(Y7,{model:t,t:e,onDetails:C})})]},W7(t))})})]})})})]})]}),(0,G.jsx)(iwe,{model:S?w.find(e=>V7(e)===V7(S))||S:null,t:e,onClose:()=>C(null)}),(0,G.jsx)(z7,{total:O.length,page:N,pageCount:M,pageSize:d,loading:p,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:N,pages:M}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:u,onPageSize:f})]})}function X7({copied:e,size:t=14,className:n}){let r=(0,v.useRef)(null),i=(0,v.useRef)(null),a=(0,v.useRef)(!0);return(0,v.useLayoutEffect)(()=>{let t=e?i.current:r.current,n=e?r.current:i.current;if(!t||!n)return;let o={autoAlpha:1,scale:1,filter:`blur(0px)`},s={autoAlpha:0,scale:.5,filter:`blur(4px)`};if(a.current||qB()){a.current=!1,Z.set(t,o),Z.set(n,s);return}Z.to(n,{...s,duration:WB.fast,ease:GB.out,overwrite:!0}),Z.fromTo(t,s,{...o,duration:WB.base,ease:GB.soft,delay:WB.instant/2,overwrite:!0})},[e]),(0,G.jsxs)(`span`,{className:`relative inline-grid place-items-center ${n??``}`,style:{width:t,height:t},children:[(0,G.jsx)(`span`,{ref:r,className:`col-start-1 row-start-1 inline-flex`,children:(0,G.jsx)(Ii,{size:t})}),(0,G.jsx)(`span`,{ref:i,className:`col-start-1 row-start-1 inline-flex text-success`,children:(0,G.jsx)(Ei,{size:t})})]})}async function Z7(e){if(!e)return!1;try{if(typeof navigator<`u`&&navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-1000px`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}function Q7(){return`${location.protocol}//${location.host}`}function $7(e){return e?/^https?:\/\//i.test(e)?e:e.startsWith(`/`)?`${Q7()}${e}`:`${Q7()}/${e}`:Q7()}function uwe({access:e}){let{t}=JF(),[n,r]=(0,v.useState)(``),i=$7(e?.openai_base_url||`/v1`),a=(0,v.useMemo)(()=>[{name:t(`endpointOpenAI`),url:i,method:`BASE`,hint:t(`endpointBaseHint`),icon:(0,G.jsx)(ui,{size:15})},{name:t(`endpointChat`),url:$7(e?.chat_completions||`${i}/chat/completions`),method:`POST`,hint:t(`endpointChatHint`),icon:(0,G.jsx)(wa,{size:15})},{name:t(`endpointMessages`),url:$7(e?.messages||`${i}/messages`),method:`POST`,hint:t(`endpointMessagesHint`),icon:(0,G.jsx)(wa,{size:15})},{name:t(`endpointResponses`),url:$7(e?.responses||`${i}/responses`),method:`POST`,hint:t(`endpointResponsesHint`),icon:(0,G.jsx)(wa,{size:15})},{name:t(`endpointModels`),url:$7(e?.models||`${i}/models`),method:`GET`,hint:t(`endpointModelsHint`),icon:(0,G.jsx)(ga,{size:15})},{name:t(`endpointHealth`),url:$7(e?.health||`/health`),method:`GET`,hint:t(`endpointHealthHint`),icon:(0,G.jsx)(oa,{size:15})}],[e,i,t]);return(0,G.jsxs)(`section`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:[(0,G.jsx)(`div`,{className:`flex items-start justify-between gap-4 px-5 py-4 sm:px-6`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`endpoints`)}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,children:t(`endpointCount`,{count:a.length-1})})]}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`routesHint`)})]})}),(0,G.jsx)(`div`,{className:`grid gap-2 px-3 pb-3 sm:grid-cols-2 sm:px-4 sm:pb-4 lg:grid-cols-3`,children:a.map(e=>(0,G.jsxs)(`div`,{className:`group min-w-0 rounded-xl bg-surface-secondary/40 p-3 transition-colors hover:bg-surface-secondary/70`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,G.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface text-muted`,children:e.icon}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`truncate text-body font-semibold`,children:e.name}),(0,G.jsx)(`code`,{className:`mono mt-0.5 block truncate text-caption text-muted`,children:e.url})]})]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,children:e.method})]}),(0,G.jsx)(`p`,{className:`mt-2 text-caption leading-5 text-muted`,children:e.hint}),(0,G.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:e.method===`BASE`?t(`endpointBaseLabel`):t(`endpointAuthLabel`)}),(0,G.jsxs)(`div`,{className:`flex gap-1`,children:[(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(`copy`),onPress:()=>{Z7(e.url),r(e.name),window.setTimeout(()=>r(``),1100)},children:(0,G.jsx)(X7,{copied:n===e.name})}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(`open`),onPress:()=>window.open(e.url,`_blank`,`noopener,noreferrer`),children:(0,G.jsx)(ni,{size:14})})]})]})]},e.name))})]})}var dwe=`https://caiaiu.com`;function e9({className:e=``}){let{t}=JF();return(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted ${e}`.trim(),children:(0,G.jsx)(`a`,{href:dwe,target:`_blank`,rel:`noopener noreferrer`,className:`underline-offset-2 transition-colors hover:text-foreground hover:underline`,children:t(`caiaiSoftLink`)})})}var fwe=new Set(`txt.md.markdown.json.csv.tsv.yml.yaml.toml.xml.html.htm.css.scss.js.jsx.ts.tsx.mjs.cjs.py.go.rs.java.kt.swift.c.h.cpp.hpp.sh.bash.zsh.sql.graphql.env.ini.conf.log.rst.tex`.split(`.`)),pwe=new Set([`image/png`,`image/jpeg`,`image/jpg`,`image/gif`,`image/webp`]);function mwe(e){let t=e.lastIndexOf(`.`);return t>=0?e.slice(t+1).toLowerCase():``}function hwe(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}async function gwe(e){let t=mwe(e.name),n=e.type||`application/octet-stream`,r=`${e.name}-${e.size}-${e.lastModified}-${Math.random().toString(36).slice(2,8)}`;if(pwe.has(n)||[`png`,`jpg`,`jpeg`,`gif`,`webp`].includes(t)){let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(r.error||Error(`read failed`)),r.readAsDataURL(e)});return{id:r,name:e.name,mime:n,kind:`image`,dataUrl:t,size:e.size}}if(fwe.has(t)||n.startsWith(`text/`)||n===`application/json`){let t=await e.text();return{id:r,name:e.name,mime:n,kind:`text`,text:t,size:e.size}}return null}function t9({ariaLabel:e,value:t,onChange:n,placeholder:r,isDisabled:i,options:a,className:o,tone:s=`default`}){let c=a.find(e=>e.id===t),l=s===`muted`?`text-muted hover:text-foreground`:`text-foreground`;return(0,G.jsxs)(KP,{className:o??`w-auto max-w-[11rem] min-w-0`,"aria-label":e,value:t||null,placeholder:r,isDisabled:i,onChange:e=>{typeof e==`string`&&e&&n(e)},children:[(0,G.jsxs)(KP.Trigger,{className:`h-8 min-h-8 gap-1 rounded-[10px] border-0 bg-transparent px-2.5 shadow-none items-center hover:bg-surface-secondary/80 data-[focus-visible=true]:bg-surface-secondary/80 ${l}`,children:[(0,G.jsx)(KP.Value,{className:`min-w-0 truncate text-caption font-medium`,children:({defaultChildren:e,isPlaceholder:t})=>t||!c?e:(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[c.icon?(0,G.jsx)(`span`,{className:`grid size-3.5 shrink-0 place-items-center opacity-80`,children:c.icon}):null,(0,G.jsx)(`span`,{className:`truncate`,children:c.label})]})}),(0,G.jsx)(KP.Indicator,{className:`size-2.5 opacity-50`})]}),(0,G.jsx)(KP.Popover,{placement:`top end`,className:`max-h-72 min-w-48`,children:(0,G.jsx)(SP,{children:a.map(e=>(0,G.jsxs)(SP.Item,{id:e.id,textValue:e.textValue,className:`gap-2`,children:[e.icon?(0,G.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center`,children:e.icon}):null,(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(jM,{className:`block truncate text-caption`,children:e.label}),e.hint?(0,G.jsx)(`span`,{className:`block truncate text-caption text-muted`,children:e.hint}):null]}),(0,G.jsx)(SP.ItemIndicator,{})]},e.id))})})]})}function _we({value:e,onChange:t,attachments:n,onAttachmentsChange:r,disabled:i,streaming:a,canSend:o,onSend:s,onStop:c,accountValue:l,onAccountChange:u,accountOptions:d,modelValue:f,onModelChange:p,modelOptions:m,modelsLoading:h}){let{t:g}=JF(),_=(0,v.useRef)(null);async function y(e){if(!e?.length)return;let t=[],i=[];for(let n of Array.from(e))try{let e=await gwe(n);e?t.push(e):i.push(n.name)}catch{i.push(n.name)}t.length&&r([...n,...t]),i.length&&window.alert(g(`chatAttachUnsupported`,{names:i.join(`, `)})),_.current&&(_.current.value=``)}function b(e){e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),!a&&o&&s())}return(0,G.jsxs)(`div`,{className:`access-composer px-3 pb-3 pt-2.5 sm:px-4 sm:pb-3.5 sm:pt-3`,children:[(0,G.jsxs)(`div`,{className:`access-composer-well overflow-hidden rounded-2xl`,children:[n.length?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2 px-3 pt-3`,children:n.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex max-w-[14rem] items-center gap-2 rounded-xl bg-surface/80 px-1.5 py-1.5 text-caption text-foreground`,children:[e.kind===`image`&&e.dataUrl?(0,G.jsx)(`img`,{src:e.dataUrl,alt:``,className:`size-8 shrink-0 rounded-lg object-cover`}):(0,G.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-muted`,children:(0,G.jsx)(Qi,{size:14})}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate font-medium`,children:e.name}),(0,G.jsx)(`span`,{className:`mono text-muted`,children:hwe(e.size)})]}),(0,G.jsx)(`button`,{type:`button`,className:`grid size-6 shrink-0 place-items-center rounded-md text-muted hover:bg-surface-secondary hover:text-foreground`,"aria-label":g(`chatAttachRemove`),onClick:()=>r(n.filter(t=>t.id!==e.id)),children:(0,G.jsx)(yo,{size:12})})]},e.id))}):null,(0,G.jsx)(Uj,{fullWidth:!0,rows:3,className:`min-h-20 resize-none border-0 bg-transparent px-3.5 py-3 text-body leading-[1.65] shadow-none focus-visible:ring-0`,value:e,onChange:e=>t(e.target.value),onKeyDown:b,placeholder:g(`promptPlaceholder`),"aria-label":g(`prompt`),disabled:i||a}),(0,G.jsxs)(`div`,{className:`flex items-center gap-0.5 px-2 pb-2 pt-0.5`,children:[(0,G.jsx)(`input`,{ref:_,type:`file`,className:`hidden`,multiple:!0,accept:`.txt,.md,.json,.csv,.yml,.yaml,.toml,.xml,.html,.css,.js,.jsx,.ts,.tsx,.py,.go,.rs,.sh,.sql,.png,.jpg,.jpeg,.gif,.webp,text/*,image/png,image/jpeg,image/gif,image/webp,application/json`,onChange:e=>void y(e.target.files)}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 shrink-0 rounded-[10px]`,"aria-label":g(`chatAttach`),isDisabled:i||a,onPress:()=>_.current?.click(),children:(0,G.jsx)(Ma,{size:15})}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,G.jsx)(t9,{ariaLabel:g(`account`),value:l,onChange:u,options:d,isDisabled:i||a,tone:`muted`,className:`w-auto max-w-[8.5rem] min-w-0`}),(0,G.jsx)(t9,{ariaLabel:g(`model`),value:f,onChange:p,placeholder:g(h?`requesting`:`model`),options:m,isDisabled:i||a||h||!m.length,className:`w-auto max-w-[10.5rem] min-w-0`}),(0,G.jsxs)(`div`,{className:`relative size-8 shrink-0`,children:[(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`secondary`,className:`absolute inset-0 size-8 rounded-[10px] transition-opacity duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] ${a?`opacity-100`:`pointer-events-none opacity-0`}`,"aria-label":g(`chatTryStop`),onPress:c,children:(0,G.jsx)(Xa,{size:14,weight:`fill`})}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,className:`absolute inset-0 size-8 rounded-[10px] transition-opacity duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] ${a?`pointer-events-none opacity-0`:`opacity-100`}`,"aria-label":g(`chatTrySend`),isDisabled:!o||i||a,onPress:s,children:(0,G.jsx)(wa,{size:14,weight:`fill`})})]})]})]}),(0,G.jsx)(`p`,{className:`mt-1 px-1 text-caption leading-4 text-muted/65`,children:g(`chatTryHelper`)})]})}function vwe({collapsed:e,onCollapsedChange:t,items:n,activeId:r,onSelect:i,onNew:a}){let{t:o}=JF(),s=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let t=s.current;!t||qB()||e||Z.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:WB.fast,ease:`power2.out`})},[e]),e?(0,G.jsxs)(`div`,{className:`access-hist-rail flex w-9 shrink-0 flex-col items-center gap-1 border-r py-2`,children:[(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":o(`chatHistoryExpand`),onPress:()=>t(!1),children:(0,G.jsx)(Ra,{size:15})}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":o(`chatHistoryNew`),onPress:a,children:(0,G.jsx)(Ma,{size:14})})]}):(0,G.jsxs)(`aside`,{ref:s,className:`access-hist-rail flex w-[13rem] shrink-0 flex-col border-r`,"aria-label":o(`chatHistoryTitle`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-2`,children:[(0,G.jsx)(`div`,{className:`min-w-0 flex-1 truncate px-1.5 text-caption font-medium text-muted`,children:o(`chatHistoryTitle`)}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":o(`chatHistoryCollapse`),onPress:()=>t(!0),children:(0,G.jsx)(mi,{size:14})})]}),(0,G.jsx)(`div`,{className:`px-2 pb-1.5`,children:(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,className:`h-8 w-full justify-start gap-1.5 rounded-[10px] px-2.5 text-caption font-medium text-muted hover:bg-[var(--sidebar-hover)] hover:text-foreground`,onPress:a,children:[(0,G.jsx)(Ma,{size:13}),o(`chatHistoryNew`)]})}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 space-y-0.5 overflow-y-auto px-1.5 pb-2.5`,children:n.length?n.map(e=>{let t=e.id===r;return(0,G.jsx)(`button`,{type:`button`,"data-active":t?`true`:void 0,className:`access-hist-item flex h-8 w-full items-center rounded-[10px] px-2.5 text-left text-caption leading-5 ${t?`font-medium text-foreground`:`font-normal text-muted`}`,onClick:()=>i(e.id),children:(0,G.jsx)(`span`,{className:`line-clamp-1 tracking-tight`,children:e.title||o(`chatHistoryUntitled`)})},e.id)}):(0,G.jsx)(`p`,{className:`px-2.5 py-6 text-center text-caption leading-5 text-muted/70`,children:o(`chatHistoryEmpty`)})})]})}function n9({latencyMs:e,ttfbMs:t,completionTokens:n,stream:r,labels:i,className:a=``,variant:o=`block`}){let s=sle(ole({completionTokens:n,latencyMs:e,ttfbMs:t,stream:r})),c=_V(t),l=_V(e);if(o===`inline`)return(0,G.jsxs)(`div`,{className:`mono text-caption leading-4 text-muted ${a}`.trim(),children:[(0,G.jsxs)(`span`,{children:[i.ttft,` `,c]}),(0,G.jsx)(`span`,{className:`mx-1.5 text-separator`,children:`·`}),(0,G.jsxs)(`span`,{children:[i.total,` `,l]}),(0,G.jsx)(`span`,{className:`mx-1.5 text-separator`,children:`·`}),(0,G.jsx)(`span`,{children:s})]});let u=[[i.ttft,c],[i.total,l],[i.tps,s]];return(0,G.jsxs)(`div`,{className:a,children:[i.heading?(0,G.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:i.heading}):null,(0,G.jsx)(`div`,{className:`border-l border-separator pl-2 leading-4`,children:u.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2 py-px`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-caption text-muted`,children:e}),(0,G.jsx)(`span`,{className:`mono text-xs text-foreground`,children:t})]},e))})]})}function ywe({text:e,streaming:t,defaultOpen:n}){let{t:r}=JF(),[i,a]=(0,v.useState)(!!n),[o,s]=(0,v.useState)(0),c=(0,v.useRef)(0),l=(0,v.useRef)(null),u=(0,v.useRef)(null);if((0,v.useEffect)(()=>{t?a(!1):n!=null&&a(!!n)},[t,n]),(0,v.useEffect)(()=>{if(!t)return;let e=Date.now();s(0);let n=window.setInterval(()=>{let t=Math.floor((Date.now()-e)/1e3);s(t),c.current=t},250);return()=>window.clearInterval(n)},[t]),(0,v.useEffect)(()=>{!t&&o===0&&c.current>0&&s(c.current)},[t,o]),(0,v.useEffect)(()=>{let t=l.current,n=u.current;if(!t)return;let r=qB();if(!i||!e){if(r){t.style.height=`0px`,t.style.opacity=`0`;return}Z.to(t,{height:0,opacity:0,duration:WB.fast,ease:GB.inOut,overwrite:!0});return}let a=n?.scrollHeight??0;if(r){t.style.height=`auto`,t.style.opacity=`1`;return}Z.fromTo(t,{height:0,opacity:0},{height:a,opacity:1,duration:WB.base,ease:GB.out,overwrite:!0,onComplete:()=>{t.style.height=`auto`}})},[i,e]),!e&&!t)return null;let d=qB(),f=t?o:o||c.current;return(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-xl`,children:[(0,G.jsx)(`button`,{type:`button`,className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-surface-secondary px-2.5 py-1 text-left text-caption text-muted`,"aria-expanded":i,onClick:()=>a(e=>!e),children:t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Mi,{size:12,className:`shrink-0 text-muted ${d?``:`animate-spin`}`}),(0,G.jsx)(`span`,{className:d?``:`access-thinking-shimmer`,children:r(`thinkingWorking`)}),(0,G.jsxs)(`span`,{className:`mono text-muted/80`,children:[o,`s`]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(gi,{size:11,className:`shrink-0 transition-transform duration-200 ease-out ${i?`rotate-90`:``}`}),(0,G.jsx)(`span`,{children:r(`thinkingDone`)}),f>0?(0,G.jsx)(`span`,{className:`mono text-muted/80`,children:r(`thinkingElapsed`,{n:f})}):null,!f&&e?(0,G.jsx)(`span`,{className:`mono text-muted/80`,children:r(`thinkingChars`,{count:e.length})}):null]})}),(0,G.jsx)(`div`,{ref:l,className:`overflow-hidden`,style:{height:0,opacity:0},children:e?(0,G.jsx)(`pre`,{ref:u,className:`mt-1.5 max-h-52 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-surface-secondary/80 px-3 py-2 text-caption leading-5 text-muted`,children:e}):null})]})}function bwe(e,t){return t(e===`running`?`toolCallRunning`:e===`error`?`toolCallError`:`toolCallSuccess`)}function xwe({status:e}){return e===`running`?(0,G.jsx)(Wa,{size:12,className:`animate-spin text-muted`}):e===`error`?(0,G.jsx)(ho,{size:12,weight:`fill`,className:`text-danger`}):(0,G.jsx)(Oi,{size:12,weight:`fill`,className:`text-success`})}function Swe(e){if(!e.trim())return``;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function r9({call:e,forceOpen:t}){let{t:n}=JF(),[r,i]=(0,v.useState)(e.status===`error`||!!t),[a,o]=(0,v.useState)(!1),s=(0,v.useMemo)(()=>Swe(e.arguments||``),[e.arguments]);(0,v.useEffect)(()=>{e.status===`error`&&i(!0)},[e.status]),(0,v.useEffect)(()=>{t&&i(!0)},[t]);async function c(){s&&(await Z7(s),o(!0),window.setTimeout(()=>o(!1),1200))}return(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-lg`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2 py-1.5 text-left`,"aria-expanded":r,onClick:()=>i(e=>!e),children:[(0,G.jsx)(gi,{size:11,className:`shrink-0 text-muted transition-transform ${r?`rotate-90`:``}`}),(0,G.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-caption font-medium text-foreground`,children:e.name||n(`toolCallUntitled`)}),(0,G.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted`,children:[(0,G.jsx)(xwe,{status:e.status}),bwe(e.status,n)]})]}),r?(0,G.jsxs)(`div`,{className:`space-y-1.5 px-2 pb-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:n(`toolCallArgs`)}),(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-caption text-muted hover:bg-surface-secondary hover:text-foreground`,onClick:e=>{e.stopPropagation(),c()},children:[(0,G.jsx)(Ri,{size:12}),n(a?`copied`:`copy`)]})]}),(0,G.jsx)(`pre`,{className:`mono max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-secondary/80 px-2.5 py-2 text-caption leading-5 text-muted`,children:s||n(`toolCallArgsEmpty`)})]}):null]})}function Cwe({calls:e}){let{t}=JF(),n=e.some(e=>e.status===`error`),r=e.some(e=>e.status===`running`),[i,a]=(0,v.useState)(n||r||e.length===1);return(0,v.useEffect)(()=>{(n||r)&&a(!0)},[n,r]),e.length?e.length===1?(0,G.jsx)(`div`,{className:`rounded-xl bg-surface-secondary/70`,children:(0,G.jsx)(r9,{call:e[0],forceOpen:e[0].status===`error`})}):(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-secondary/70`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-caption text-muted`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[(0,G.jsx)(gi,{size:11,className:`shrink-0 transition-transform ${i?`rotate-90`:``}`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground`,children:t(`toolCallGroup`,{n:e.length})}),r?(0,G.jsx)(Wa,{size:12,className:`animate-spin`}):null]}),i?(0,G.jsx)(`div`,{className:`space-y-0.5 border-t border-separator/40 px-0.5 py-1`,children:e.map(e=>(0,G.jsx)(r9,{call:e},`${e.index}-${e.id||e.name}`))}):null]}):null}function wwe({message:e}){return e.attachments?.length?(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.attachments.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex max-w-[12rem] items-center gap-1.5 rounded-xl bg-surface/70 px-1.5 py-1 text-caption text-muted`,children:[e.kind===`image`&&e.dataUrl?(0,G.jsx)(`img`,{src:e.dataUrl,alt:``,className:`size-7 shrink-0 rounded-lg object-cover`}):(0,G.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface`,children:(0,G.jsx)(Qi,{size:12})}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))}):null}function Twe({message:e}){let{t}=JF(),n=e.usage;if(!n||n.credits==null)return null;let r=n.prompt_tokens,i=n.completion_tokens,a=typeof r==`number`||typeof i==`number`?t(`chatTryUsageTokens`,{prompt:gV(r??0),completion:gV(i??0)}):``;return(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:a?t(`chatTryUsageFoot`,{tokens:a,amount:TV(n.credits)}):t(`chatTryCreditsUsed`,{amount:TV(n.credits)})})}function Ewe({text:e,streaming:t}){let n=e.split(/(\n{2,})/),r=-1;for(let e=n.length-1;e>=0;--e)if(n[e]&&!/^\n{2,}$/.test(n[e])){r=e;break}return(0,G.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body leading-[1.65] text-foreground ${t?`access-streaming`:``}`,children:n.map((e,n)=>e?/^\n{2,}$/.test(e)?(0,G.jsx)(`span`,{children:e},`s-${n}`):(0,G.jsx)(`span`,{className:t&&n===r?`access-stream-seg`:void 0,children:e},`p-${n}`):null)})}function Dwe(){let e=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let t=e.current;!t||qB()||Z.from(t,{autoAlpha:0,duration:WB.fast,ease:`power2.out`})},[]),e}function Owe({message:e}){let{t}=JF(),[n,r]=(0,v.useState)(!1),i=e.role===`user`,a=Dwe();if(i)return(0,G.jsx)(`div`,{ref:a,className:`ml-auto max-w-[92%] sm:max-w-[78%]`,children:(0,G.jsxs)(`div`,{className:`access-bubble access-bubble--user rounded-2xl rounded-br-md px-3.5 py-2.5`,children:[e.content?(0,G.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body leading-[1.65] text-foreground`,children:e.content}):null,(0,G.jsx)(wwe,{message:e})]})});let o=e.status===`streaming`&&!e.content&&!e.reasoning&&!e.toolCalls?.length,s=!!e.content&&e.status===`done`,c=e.status===`streaming`,l=!!(e.usage&&e.usage.credits!=null),u=e.status===`done`&&(e.latency_ms!=null||e.ttfb_ms!=null||typeof e.usage?.completion_tokens==`number`);async function d(){e.content&&(await Z7(e.content),r(!0),window.setTimeout(()=>r(!1),1200))}return(0,G.jsxs)(`div`,{className:`group/access-msg max-w-[96%] space-y-1.5 sm:max-w-[88%]`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-1.5 px-0.5`,children:(0,G.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center rounded-lg border border-border bg-surface-secondary`,children:(0,G.jsx)(XV,{provider:e.provider,size:13})})}),e.reasoning||c?(0,G.jsx)(ywe,{text:e.reasoning||``,streaming:c&&(!e.content||!!e.reasoning),defaultOpen:e.reasoningOpen}):null,e.toolCalls?.length?(0,G.jsx)(Cwe,{calls:e.toolCalls}):null,e.status===`error`?(0,G.jsx)(xI,{status:`danger`,title:t(`requestFailed`),description:e.error||``}):o?(0,G.jsxs)(`div`,{className:`space-y-2 pt-0.5`,children:[(0,G.jsx)(rA,{className:`h-3 w-28 rounded-md`}),(0,G.jsx)(rA,{className:`h-3 w-full rounded-md`}),(0,G.jsx)(rA,{className:`h-3 w-[86%] rounded-md`}),(0,G.jsx)(rA,{className:`h-3 w-[68%] rounded-md`})]}):e.content?(0,G.jsx)(`div`,{className:`access-bubble access-bubble--assistant px-0.5 py-0`,children:(0,G.jsx)(Ewe,{text:e.content,streaming:c})}):null,s||l||u?(0,G.jsxs)(`div`,{className:`access-msg-foot space-y-1 px-0.5 pt-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[s?(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,className:`h-5 min-h-5 gap-1 px-1.5 text-caption text-muted/80`,onPress:()=>void d(),children:[(0,G.jsx)(X7,{copied:n,size:12}),t(n?`copied`:`copy`)]}):null,(0,G.jsx)(Twe,{message:e})]}),u?(0,G.jsx)(n9,{variant:`inline`,latencyMs:e.latency_ms,ttfbMs:e.ttfb_ms,completionTokens:e.usage?.completion_tokens,stream:!0,className:`access-latency-inline max-h-0 overflow-hidden opacity-0 transition-[opacity,max-height] duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] group-hover/access-msg:max-h-5 group-hover/access-msg:opacity-100 focus-within:max-h-5 focus-within:opacity-100`,labels:{ttft:t(`logsColTTFT`),total:t(`logsLatencyTotal`),tps:t(`logsOutputTPS`)}}):null]}):null]})}function kwe({messages:e,busy:t,onLoadDemo:n}){let{t:r}=JF(),i=(0,v.useRef)(null);(0,v.useEffect)(()=>{i.current?.scrollIntoView({block:`end`})},[e,t]);let a=!e.length;return(0,G.jsxs)(`div`,{className:`access-thread min-h-0 flex-1 overflow-y-auto px-4 sm:px-6 ${a?`py-5 sm:py-6`:`pb-2 pt-4 sm:pb-2.5 sm:pt-5`}`,"aria-live":`polite`,"aria-busy":t,children:[a?(0,G.jsx)(I7,{className:`min-h-56`,icon:(0,G.jsx)(wi,{size:22}),title:r(`chatTryEmptyTitle`),hint:r(`chatTryEmptyHint`),action:n?(0,G.jsx)(`button`,{type:`button`,className:`inline-flex h-8 items-center rounded-[10px] px-2.5 text-caption font-medium text-muted transition-colors hover:bg-[var(--sidebar-hover)] hover:text-foreground`,onClick:n,children:r(`chatDemoLoad`)}):void 0}):(0,G.jsx)(`div`,{className:`space-y-4`,children:e.map(e=>(0,G.jsx)(Owe,{message:e},e.id))}),(0,G.jsx)(`div`,{ref:i})]})}function Awe({format:e,onFormatChange:t,requestPath:n,prompt:r,onPromptChange:i,onTest:a,requestState:o,elapsedMs:s,output:c,responseStatus:l,curl:u,copiedCurl:d,onCopyCurl:f,canSend:p,accountValue:m,onAccountChange:h,accountOptions:g,modelValue:_,onModelChange:v,modelOptions:y,modelsLoading:b,disabled:x}){let{t:S}=JF();return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`px-1 text-caption leading-5 text-muted`,children:S(`rawFormatHint`)}),(0,G.jsx)(`div`,{className:`access-raw-panel overflow-hidden rounded-2xl`,children:(0,G.jsxs)(`div`,{className:`grid xl:grid-cols-[minmax(420px,.92fr)_minmax(0,1.08fr)]`,children:[(0,G.jsxs)(`div`,{className:`xl:border-r xl:border-[color-mix(in_oklab,var(--foreground)_6%,transparent)]`,children:[(0,G.jsxs)(`div`,{className:`px-4 py-3.5 sm:px-5`,children:[(0,G.jsx)(`h3`,{className:`text-body font-semibold`,children:S(`requestBuilder`)}),(0,G.jsxs)(`p`,{className:`mt-0.5 text-caption text-muted`,children:[`POST `,n]})]}),(0,G.jsxs)(`div`,{className:`space-y-4 px-4 pb-4 sm:px-5 sm:pb-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:S(`rawFormatLabel`)}),(0,G.jsx)(AV,{className:`access-format-chips`,ariaLabel:S(`rawFormatLabel`),value:e,onChange:e=>t(e),options:[{id:`chat`,label:S(`rawFormatChat`)},{id:`messages`,label:S(`rawFormatMessages`)},{id:`responses`,label:S(`rawFormatResponses`)}]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,G.jsx)(t9,{ariaLabel:S(`account`),value:m,onChange:h,options:g,isDisabled:x||o===`loading`,tone:`muted`,className:`w-auto max-w-[8.5rem] min-w-0`}),(0,G.jsx)(t9,{ariaLabel:S(`model`),value:_,onChange:v,placeholder:S(b?`requesting`:`model`),options:y,isDisabled:x||o===`loading`||b||!y.length,className:`w-auto max-w-[10.5rem] min-w-0`})]}),(0,G.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:S(`prompt`)}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:r.length})]}),(0,G.jsx)(Uj,{fullWidth:!0,rows:9,className:`min-h-52 resize-y rounded-xl border-0 bg-[var(--field-background)] px-3.5 py-3 text-body leading-[1.65] shadow-[inset_0_0_0_1px_color-mix(in_oklab,var(--field-border)_78%,var(--foreground))] focus-visible:ring-0`,value:r,onChange:e=>i(e.target.value),placeholder:S(`promptPlaceholder`),"aria-label":S(`prompt`),disabled:x||o===`loading`}),(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted/70`,children:S(`promptHelper`)})]}),(0,G.jsxs)(J,{fullWidth:!0,isPending:o===`loading`,isDisabled:!p||x,onPress:a,children:[(0,G.jsx)(wa,{size:15}),S(o===`loading`?`requesting`:`sendRequest`)]})]})]}),(0,G.jsxs)(`div`,{className:`access-raw-panel__inspector flex min-h-[440px] min-w-0 flex-col`,"aria-live":`polite`,"aria-busy":o===`loading`,children:[(0,G.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-4 px-4 py-3 sm:px-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-body font-semibold`,children:S(`responseInspector`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:S(`responseInspectorHint`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s===null?null:(0,G.jsxs)(`span`,{className:`mono flex items-center gap-1.5 text-caption text-muted`,children:[(0,G.jsx)(Pi,{size:12}),s,` ms`]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:o===`success`?`success`:o===`error`?`danger`:void 0,children:l})]})]}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 px-4 pb-4 sm:px-5 sm:pb-5`,children:o===`idle`?(0,G.jsx)(I7,{className:`min-h-64`,title:S(`responseEmptyTitle`),hint:S(`responseEmptyHint`)}):o===`loading`?(0,G.jsxs)(`div`,{className:`space-y-3 pt-1`,children:[(0,G.jsx)(rA,{className:`h-3 w-32 rounded-lg`}),(0,G.jsx)(rA,{className:`h-3 w-full rounded-lg`}),(0,G.jsx)(rA,{className:`h-3 w-[88%] rounded-lg`}),(0,G.jsx)(rA,{className:`h-3 w-[72%] rounded-lg`}),(0,G.jsx)(rA,{className:`mt-7 h-3 w-[92%] rounded-lg`}),(0,G.jsx)(rA,{className:`h-3 w-[64%] rounded-lg`})]}):o===`error`?(0,G.jsx)(`div`,{className:`space-y-3`,children:(0,G.jsx)(xI,{status:`danger`,title:S(`requestFailed`),description:c})}):(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-caption font-medium text-success`,children:[(0,G.jsx)(Oi,{size:14,weight:`fill`}),S(`responseReceived`)]}),(0,G.jsx)(`pre`,{className:`mono overflow-x-auto whitespace-pre-wrap break-words text-caption leading-6 text-muted`,children:c})]})})]})]})}),(0,G.jsxs)(`section`,{className:`access-raw-panel overflow-hidden rounded-2xl`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-4 py-3 sm:px-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-body font-semibold`,children:S(`curlExample`)}),(0,G.jsx)(`div`,{className:`mt-0.5 truncate text-caption text-muted`,children:S(`curlGeneratedHint`)})]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:f,children:[(0,G.jsx)(X7,{copied:d}),S(d?`copied`:`copy`)]})]}),(0,G.jsx)(`pre`,{className:`mono max-h-72 overflow-auto whitespace-pre-wrap px-4 pb-4 text-caption leading-6 text-muted sm:px-5 sm:pb-5`,children:u})]})]})}function i9(e,t){let n=t.filter(e=>e.kind===`text`),r=t.filter(e=>e.kind===`image`&&e.dataUrl),i=e.trim();for(let e of n){let t=e.text??``;i=`${i}${i?` `:``}--- file: ${e.name} ---\n${t}`}if(!r.length)return i;let a=[];i&&a.push({type:`text`,text:i});for(let e of r)a.push({type:`image_url`,image_url:{url:e.dataUrl}});return a}function jwe(e,t){let n=[];for(let t of e)if(!(t.status===`error`&&t.role===`assistant`&&!t.content)){if(t.role===`user`){n.push({role:`user`,content:i9(t.content,t.attachments||[])});continue}t.content&&n.push({role:`assistant`,content:t.content})}return[...n,t]}var Mwe=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNkYPhfz0AEYBxVSF+FABJADveWkH6aAAAAAElFTkSuQmCC`;function a9(){return[{id:`demo-user-1`,role:`user`,content:`Summarize the attached screenshot and look up the endpoint.`,attachments:[{id:`demo-img-1`,name:`screenshot.png`,mime:`image/png`,kind:`image`,dataUrl:Mwe,size:2048},{id:`demo-txt-1`,name:`notes.md`,mime:`text/markdown`,kind:`text`,text:`# notes placeholder`,size:128}],status:`done`},{id:`demo-assistant-1`,role:`assistant`,provider:`workbuddy`,content:`The screenshot shows the Access playground. I looked up the chat completions route and drafted a short summary below.`,reasoning:`User attached a UI screenshot and a notes file. @@ -165,4 +165,4 @@ Keep the reply short and ops-console toned.`,toolCalls:[{index:0,id:`call_demo_l -H "Authorization: Bearer $CLI2API_API_KEY" \\ -H ${o9(`Content-Type: application/json`)}${oe?` \\ -H ${o9(`X-Qoder-Account: ${oe}`)}`:``} \\ - -d ${o9(JSON.stringify(me))}`,[me,T,oe]);if(n&&!t)return(0,G.jsx)(Fce,{});async function ge(e,t){await Z7(e),ae(t),window.setTimeout(()=>ae(``),1100)}async function _e(){let e=performance.now();te(`loading`),re(null),V(``);try{let e=await ise(w,me,oe||void 0);V(JSON.stringify(e,null,2)),te(`success`)}catch(e){V(e instanceof Error?e.message:String(e)),te(`error`)}finally{re(Math.round(performance.now()-e))}}function ve(){z.current?.abort(),z.current=null}function ye(e){let t=p;u(n=>n.map(n=>{if(n.id!==t)return n;let r=typeof e==`function`?e(n.messages):e;return{...n,messages:r,title:l9(r)||n.title,updatedAt:Date.now()}}))}function be(e,t){ye(n=>n.map(n=>{if(n.id!==e)return n;let r=typeof t==`function`?t(n):t;return{...n,...r}}))}async function xe(){let e=P.trim();if(!e&&!I.length||!fe||le||ee===`loading`)return;ve();let t=new AbortController;z.current=t;let n=I,r={id:s9(`user`),role:`user`,content:e,attachments:n,status:`done`},i=s9(`assistant`),a={id:i,role:`assistant`,provider:_.find(e=>e.id===oe)?.provider||ce.find(e=>e.id===fe)?.provider||``,content:``,status:`streaming`},o=m;ye([...o,r,a]),F(``),L([]),R(`loading`);let s=jwe(o,{role:`user`,content:i9(e,n)}),c=performance.now(),l=null,u=()=>{l??=performance.now()},d=()=>{let e=performance.now();return{latency_ms:Math.max(0,Math.round(e-c)),ttfb_ms:l==null?void 0:Math.max(0,Math.round(l-c))}};try{await sse(fe,s,oe||void 0,{signal:t.signal,onContent:(e,t)=>{e&&u(),be(i,{content:t})},onReasoning:(e,t)=>{e&&u(),be(i,{reasoning:t})},onToolCalls:e=>{u(),be(i,{toolCalls:Pwe(e,!0)})},onUsage:e=>be(i,{usage:e})}),be(i,e=>({status:`done`,...d(),toolCalls:e.toolCalls?.map(e=>({...e,status:`success`}))})),R(`success`)}catch(e){if(t.signal.aborted){be(i,e=>({status:`done`,...d(),toolCalls:e.toolCalls?.map(e=>({...e,status:`success`}))})),R(`success`);return}be(i,{status:`error`,error:e instanceof Error?e.message:String(e),...d()}),R(`error`)}finally{z.current===t&&(z.current=null)}}let Se=e(H===`success`?`requestComplete`:H===`error`?`requestFailed`:H===`loading`?`requesting`:`requestIdle`),Ce=c9()!=null,we=[{id:`auto`,textValue:e(`autoAccount`),label:e(`autoAccount`),icon:(0,G.jsx)(oi,{size:14,className:`text-muted`})},..._.map(t=>({id:t.id,textValue:`${t.name||t.id} ${YV(t.provider,t.region,e)}`,label:t.name||t.id,hint:YV(t.provider,t.region,e),icon:(0,G.jsx)(XV,{provider:t.provider,size:14})}))],Te=_.length||!Ce?we:[{id:`auto`,textValue:e(`autoAccount`),label:e(`autoAccount`),icon:(0,G.jsx)(oi,{size:14,className:`text-muted`})},{id:`demo-wb`,textValue:`wb-demo WorkBuddy`,label:`wb-demo`,hint:`WorkBuddy`}],Ee=ce.map(t=>{let n=bV(t),r=xV(t),i=t.display_name||t.id,a=r?e(`modelFree`):n,o=t.provider||t.owned_by||``;return{id:t.id,textValue:`${i} ${t.id} ${o} ${n} ${r?`free`:``}`,label:a?`${i} ${a}`:i,hint:[t.id,o,a].filter(Boolean).join(` · `)}}),De=Ee.length||!Ce?Ee:d9.map(t=>{let n=bV(t),r=xV(t),i=t.display_name||t.id,a=r?e(`modelFree`):n;return{id:t.id,textValue:`${i} ${t.id} ${t.provider} ${n} ${r?`free`:``}`,label:a?`${i} ${a}`:i,hint:[t.id,t.provider,a].filter(Boolean).join(` · `)}}),Oe=!!((P.trim()||I.length)&&fe&&!le&&(_.length||Ce));function ke(){ye(a9()),R(`idle`)}function Ae(){ve(),R(`idle`),F(``),L([]);let e=u9([]);u(t=>[e,...t]),f(e.id)}function je(e){e!==p&&(ve(),R(`idle`),F(``),L([]),f(e))}let Me=l.slice().sort((e,t)=>t.updatedAt-e.updatedAt).map(t=>({id:t.id,title:t.title||e(`chatHistoryUntitled`),updatedAt:t.updatedAt}));return(0,G.jsxs)(`div`,{className:`access-page space-y-4`,children:[(0,G.jsxs)(`section`,{className:`access-info-row flex flex-wrap items-center gap-x-3 gap-y-2 px-0.5 py-0.5`,title:e(`apiPlaygroundHint`),children:[(0,G.jsx)(`h2`,{className:`shrink-0 text-body font-semibold text-foreground`,children:e(`apiPlayground`)}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5 text-caption text-muted`,children:[(0,G.jsx)(`span`,{className:`shrink-0`,children:e(`baseUrl`)}),(0,G.jsx)(`code`,{className:`mono min-w-0 truncate font-medium text-foreground`,children:b}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-6 min-w-6 shrink-0`,"aria-label":e(`copyBaseUrl`),onPress:()=>void ge(b,`base`),children:(0,G.jsx)(X7,{copied:ie===`base`,size:13})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-caption text-muted`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":pe.length?`ok`:void 0}),(0,G.jsx)(`span`,{children:e(`readyAccounts`,{ready:pe.length,total:_.length})}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:pe.length?`success`:`warning`,children:pe.length?e(`endpointReady`):e(`degraded`)})]})]}),_.length?null:(0,G.jsxs)(`div`,{className:`space-y-1 px-1`,children:[(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:e(`noAccountsForTest`)}),(0,G.jsx)(e9,{})]}),ue?(0,G.jsx)(`p`,{className:`px-1 text-caption text-danger`,children:ue}):null,(0,G.jsxs)(OA,{selectedKey:r,onSelectionChange:e=>i(String(e)),children:[(0,G.jsx)(OA.ListContainer,{className:`w-fit`,children:(0,G.jsxs)(OA.List,{"aria-label":e(`accessTabsLabel`),children:[(0,G.jsxs)(DA,{id:`chat`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),e(`accessTabChat`)]}),(0,G.jsxs)(DA,{id:`raw`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),e(`accessTabApi`)]})]})}),(0,G.jsx)(OA.Panel,{id:`chat`,className:`pt-4`,children:(0,G.jsxs)(`div`,{className:`flex min-h-[640px] md:min-h-[72vh]`,children:[(0,G.jsx)(vwe,{collapsed:s,onCollapsedChange:c,items:Me,activeId:p,onSelect:je,onNew:Ae}),(0,G.jsxs)(`div`,{className:`access-chat-stage flex min-w-0 flex-1 flex-col`,children:[(0,G.jsx)(kwe,{messages:m,busy:ee===`loading`,onLoadDemo:ke}),(0,G.jsx)(_we,{value:P,onChange:F,attachments:I,onAttachmentsChange:L,disabled:!_.length&&c9()==null,streaming:ee===`loading`,canSend:Oe,onSend:()=>void xe(),onStop:ve,accountValue:oe||`auto`,onAccountChange:e=>k(e===`auto`?``:e),accountOptions:Te,modelValue:fe,onModelChange:D,modelOptions:De,modelsLoading:le})]})]})}),(0,G.jsxs)(OA.Panel,{id:`raw`,className:`space-y-4 pt-4`,children:[(0,G.jsx)(Awe,{format:a,onFormatChange:o,requestPath:w,prompt:M,onPromptChange:N,onTest:()=>void _e(),requestState:H,elapsedMs:ne,output:B,responseStatus:Se,curl:he,copiedCurl:ie===`curl`,onCopyCurl:()=>void ge(he,`curl`),canSend:!!(M.trim()&&fe&&!le),accountValue:oe||`auto`,onAccountChange:e=>k(e===`auto`?``:e),accountOptions:Te,modelValue:fe,onModelChange:D,modelOptions:De,modelsLoading:le,disabled:!_.length&&c9()==null}),(0,G.jsx)(uwe,{access:t?.access})]})]})]})}function Lwe(e){(0,v.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=Z.context(()=>{Z.matchMedia().add(`(prefers-reduced-motion: no-preference)`,()=>{let e=Z.utils.toArray(`.meter__fill`);e.length&&Z.from(e,{scaleX:0,transformOrigin:`left center`,duration:WB.calm,ease:GB.emphasized,stagger:KB.base,clearProps:`transform,transformOrigin`})})},t);return()=>n.revert()},[e])}function f9(e){if(!e)return``;let t=Date.parse(e)-Date.now();if(!Number.isFinite(t)||t<=0)return``;let n=Math.ceil(t/1e3);return n<60?`${n}s`:`${Math.ceil(n/60)}m`}function Rwe(e){return Object.entries(e.model_cooldowns??{}).filter(([,e])=>!!f9(e)).sort(([e],[t])=>e.localeCompare(t))}function p9(e){return e.enabled?e.status===`quota_exhausted`||e.quota?.exceeded?`quota_exhausted`:e.status===`cooling`||f9(e.down_until||e.cooldown_until)?`cooling`:e.status===`dead`||e.runtime_state===`dead`?`dead`:e.status===`auth_failed`||e.runtime_state===`auth_failed`?`auth_failed`:e.status===`login_required`?`login`:(e.status===`starting`||e.runtime_state===`starting`)&&!e.hot&&!e.ready?e.quota?`starting`:`loading`:e.status===`ready`?e.hot?`hot`:`ready`:e.hot?`hot`:e.ready?`ready`:(e.status===`error`||e.status,`unavailable`):`disabled`}function zwe(e){return e===`hot`?12:e===`ready`?9:e===`cooling`?5:e===`login`?3:e===`loading`||e===`starting`?6:e===`unavailable`?2:e===`auth_failed`?3:e===`dead`?2:1}function Bwe(e){return e===`hot`||e===`ready`?`ok`:e===`cooling`||e===`quota_exhausted`||e===`loading`||e===`starting`?`warn`:e===`auth_failed`||e===`unavailable`||e===`dead`||e===`login`?`danger`:`muted`}function m9(e){return e==null||!Number.isFinite(e)?`—`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(Math.round(e*100)/100)}function h9(e){let t=e.percentage??0;return Number.isFinite(t)?Math.min(1,Math.max(0,t/100)):0}function g9(e){let t=e.percentage??0;return e.exceeded?`danger`:t>=80?`warn`:`ok`}function Vwe(e){return(e.windows??[]).filter(e=>!!e.id)}var Hwe={free:`Free`,go:`Go`,plus:`Plus`,pro:`Pro`,prolite:`Pro Lite`,promax:`Pro Max`,team:`Team`,business:`Business`,enterprise:`Enterprise`,edu:`Edu`,edu_plus:`Edu Plus`,edu_pro:`Edu Pro`,education:`Education`};function Uwe(e){let t=e?.trim().toLowerCase()??``;return!t||t===`unknown`||t===`guest`?``:Hwe[t]??t.replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Wwe(e,t){return e.id===`daily`?t(`quotaDaily`):e.id===`weekly`?t(`quotaWeekly`):e.id===`monthly`?t(`quotaMonthly`):e.id===`fiveHour`?t(`quotaFiveHour`):e.id===`weeklyLimit`?t(`quotaWeeklyLimit`):e.id===`monthlyLimit`?t(`quotaMonthlyLimit`):e.label||t(`quota`)}function Gwe(e,t){if(!e)return``;let n=Date.parse(e)-Date.now();if(!Number.isFinite(n)||n<=0)return t(`quotaResetsSoon`);let r=Math.max(1,Math.ceil(n/6e4));return r<60?t(`quotaResetsInMinutes`,{n:r}):t(`quotaResetsInHours`,{n:Math.round(r/60)})}function Kwe(e,t){if(!e.expires_at||e.expires_at<=0||!Number.isFinite(e.expires_at))return``;let n=new Date(e.expires_at*1e3);if(Number.isNaN(n.getTime()))return``;let r=`${n.getFullYear()}/${n.getMonth()+1}/${n.getDate()}`;return t(`quotaExpiresOn`,{amount:e.expiring_remain&&e.expiring_remain>0?`${m9(e.expiring_remain)} `:``,unit:e.unit||`credits`,date:r})}function qwe(e,t,n,r,i,a){return[e.has_add_on&&e.add_on_available!==!1?`${n} ${m9(e.add_on_used)} / ${m9(e.add_on_total)} ${e.add_on_unit||`credits`}`:``,e.has_resource_package&&e.resource_package_available!==!1?`${r} ${t} ${m9(e.resource_package_remaining)} ${e.resource_package_unit||`credits`}`:``,a===`workbuddy`?Kwe(e,i):``].filter(Boolean)}function Jwe({window:e,t,extra:n}){let r=Math.round(e.percentage??0),i=Wwe(e,t),a=t(`quotaUsedPercent`,{n:r}),o=Gwe(e.reset_at,t),s=`${i} · ${a}${o?` · ${o}`:``}`,c=h9(e),l=g9(e),u=l===`danger`?`danger`:l===`warn`?`warning`:`success`;return(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{className:`block w-full min-w-0`,children:(0,G.jsxs)(`div`,{className:`w-full min-w-0 cursor-help`,children:[(0,G.jsxs)(QP,{className:`account-meter account-meter--window w-full`,color:u,size:`md`,minValue:0,maxValue:100,value:Math.round(c*100),"aria-label":i,valueLabel:s,children:[(0,G.jsxs)(QP.Output,{className:`flex w-full items-baseline justify-between gap-3 text-caption`,children:[(0,G.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:i}),(0,G.jsx)(`span`,{className:`mono shrink-0 text-foreground/70`,children:a})]}),(0,G.jsx)(QP.Track,{children:(0,G.jsx)(QP.Fill,{})})]}),o?(0,G.jsx)(`div`,{className:`mt-1 text-caption leading-4 text-muted`,children:o}):null]})}),(0,G.jsx)(Mj.Content,{children:(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsx)(`div`,{children:s}),n?.map(e=>(0,G.jsx)(`div`,{children:e},e))]})})]})}function Ywe({quota:e,t,label:n,usedLabel:r,remainingLabel:i,addOnLabel:a,resourcePackageLabel:o,exceededLabel:s,provider:c}){let l=e.unit||`credits`,u=`${m9(e.used)} / ${m9(e.total)}`,d=`${m9(e.remaining)}`,f=qwe(e,i,a,o,t,c),p=Vwe(e),m=c===`codex`?Uwe(e.plan):``,h=h9(e),g=g9(e),_=g===`danger`?`danger`:g===`warn`?`warning`:`success`,y=(0,v.useRef)(null);Lwe(y);let b=`${r} ${u} ${l} · ${i} ${d} ${l}${f.length?` · ${f.join(` · `)}`:``}`;return p.length>0?(0,G.jsxs)(`div`,{ref:y,className:`account-quota-windows flex w-full min-w-0 flex-col gap-3`,children:[m?(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-caption`,children:[(0,G.jsx)(`span`,{className:`text-muted`,children:t(`quotaPlan`)}),(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:m})]}):null,p.map((e,n)=>(0,G.jsx)(`div`,{className:`w-full min-w-0`,children:(0,G.jsx)(Jwe,{window:e,t,extra:n===0?f:void 0})},e.id||String(n)))]}):(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(`div`,{ref:y,className:`w-full cursor-help`,children:(0,G.jsxs)(QP,{className:`account-meter w-full`,color:_,size:`md`,minValue:0,maxValue:100,value:Math.round(h*100),"aria-label":n,valueLabel:b,children:[(0,G.jsxs)(QP.Output,{className:`flex w-full items-baseline justify-between text-caption`,children:[(0,G.jsxs)(`span`,{className:`text-body font-semibold leading-5 text-foreground tabular-nums`,children:[e.exceeded?(0,G.jsx)(`span`,{className:`mr-1.5 text-danger`,children:s}):null,d,(0,G.jsx)(`span`,{className:`ml-1 text-caption font-normal text-foreground/60`,children:l})]}),(0,G.jsxs)(`span`,{className:`mono text-foreground/55`,children:[r,` `,u]})]}),(0,G.jsx)(QP.Track,{children:(0,G.jsx)(QP.Fill,{})})]})})}),(0,G.jsx)(Mj.Content,{children:(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsxs)(`div`,{children:[r,` `,u,` `,l]}),(0,G.jsxs)(`div`,{children:[i,` `,d,` `,l]}),f.map(e=>(0,G.jsx)(`div`,{children:e},e))]})})]})}function Xwe({state:e,stateCopy:t,t:n}){let r=(0,v.useRef)(null),i=zwe(e),a=Bwe(e);return(0,v.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=Z.context(()=>{let e=Z.utils.toArray(`[data-runtime-seg]`),t=e.filter((e,t)=>tt>=i),r=Z.matchMedia();r.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(t,{scaleY:1,autoAlpha:1}),Z.set(n,{scaleY:.32,autoAlpha:.45})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{Z.set(e,{transformOrigin:`center bottom`}),Z.to(n,{scaleY:.32,autoAlpha:.45,duration:WB.fast,ease:GB.out,overwrite:!0}),Z.to(t,{scaleY:1,autoAlpha:1,duration:WB.base,ease:GB.out,stagger:{amount:.08,from:`start`},overwrite:!0})})},e);return()=>t.revert()},[i,e]),(0,G.jsxs)(`div`,{ref:r,className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-caption font-medium text-foreground/75`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":a===`muted`?void 0:a===`warn`?`warn`:a}),(0,G.jsx)(`span`,{children:n(`runtimeState`)})]}),(0,G.jsx)(`div`,{className:`runtime-meter min-w-[80px] flex-1`,role:`meter`,"aria-label":n(`runtimeState`),"aria-valuemin":0,"aria-valuemax":12,"aria-valuenow":i,"aria-valuetext":t,children:Array.from({length:12},(e,t)=>(0,G.jsx)(`span`,{"data-runtime-seg":!0,"data-on":t{if(!F&&!I&&L.length===0)return;let e=window.setInterval(()=>N(e=>e+1),1e3);return()=>window.clearInterval(e)},[F,I,L.length]);let[ee,R]=(0,v.useState)(null),[z,B]=(0,v.useState)(null),V=(0,v.useRef)(null),H=S&&S!==ee?S:null,te=!!H&&z===H;(0,v.useEffect)(()=>{if(S)return V.current&&window.clearTimeout(V.current),V.current=window.setTimeout(()=>R(S),3e3),()=>{V.current&&window.clearTimeout(V.current)}},[S]);let ne=Zwe(P,P===`dead`?I:F,o),re=P===`hot`||P===`ready`?`success`:P===`cooling`?`warning`:P===`quota_exhausted`||P===`login`||P===`unavailable`||P===`dead`||P===`auth_failed`?`danger`:void 0,ie=e.last_error||e.lastError,ae=e.last_error_kind||e.kind,oe=YV(e.provider,e.region,o),se=e.last_checkin_status,ce=se===`success`?`checkinRecordSuccess`:se===`already`?`checkinRecordAlready`:se===`skipped`?`checkinRecordSkipped`:se===`error`?`checkinRecordFailed`:`lastCheckinNone`;return(0,v.useLayoutEffect)(()=>{let e=E.current;if(!e)return;let t=M.current;if(M.current=P,!t||t===P)return;let n=Z.context(()=>{let t=Z.matchMedia();t.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(e,{scale:1,autoAlpha:1})}),t.add(`(prefers-reduced-motion: no-preference)`,()=>{Z.fromTo(e,{scale:.94,autoAlpha:.65},{scale:1,autoAlpha:1,duration:.2,ease:`power2.out`,overwrite:!0})})},e);return()=>n.revert()},[P]),(0,v.useLayoutEffect)(()=>{let e=D.current;if(!e||!n)return;let t=Z.context(()=>{let t=Z.matchMedia();t.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(e,{autoAlpha:1,y:0})}),t.add(`(prefers-reduced-motion: no-preference)`,()=>{Z.fromTo(e,{autoAlpha:0,y:-6},{autoAlpha:1,y:0,duration:.2,ease:`power3.out`,overwrite:!0})})},e);return()=>t.revert()},[n]),(0,G.jsxs)(CS,{"data-gsap-reveal":!0,"data-state":P,className:`account-card overflow-hidden p-0`,children:[(0,G.jsxs)(CS.Header,{className:`flex-row items-start justify-between gap-2.5 px-4 pt-3.5 pb-2`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,G.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-tertiary`,children:(0,G.jsx)(XV,{provider:e.provider,size:20})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(CS.Title,{className:`truncate text-body leading-5`,children:e.name||e.id}),(0,G.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-secondary px-1.5 py-px text-caption text-muted`,children:oe})]}),(0,G.jsx)(CS.Description,{className:`mono truncate text-caption leading-4 text-foreground/60`,title:`${e.id}${e.remote_uid?` · UID ${e.remote_uid}`:``}`,children:e.remote_uid?`UID ${e.remote_uid}`:e.id})]})]}),(0,G.jsxs)(`div`,{className:`flex max-w-[48%] shrink-0 flex-wrap justify-end gap-1.5`,children:[(0,G.jsx)(`span`,{ref:E,children:L.length&&P===`cooling`?(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(`span`,{className:`inline-flex cursor-help`,children:(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:re,children:ne})})}),(0,G.jsx)(Mj.Content,{children:(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:o(`partialCooling`)}),L.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-caption`,children:[(0,G.jsx)(`span`,{children:e}),(0,G.jsx)(`span`,{className:`mono text-foreground/65`,children:f9(t)})]},e))]})})]}):(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:re,children:ne})}),L.length&&P!==`cooling`?(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(`span`,{className:`inline-flex cursor-help`,children:(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`warning`,children:o(`partialCooling`)})})}),(0,G.jsx)(Mj.Content,{children:(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:o(`partialCooling`)}),L.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-caption`,children:[(0,G.jsx)(`span`,{children:e}),(0,G.jsx)(`span`,{className:`mono text-foreground/65`,children:f9(t)})]},e))]})})]}):null]})]}),(0,G.jsxs)(CS.Content,{className:`gap-1.5 px-4 pb-3`,children:[(0,G.jsx)(Xwe,{state:P,stateCopy:ne,t:o}),e.quota?(0,G.jsx)(Ywe,{quota:e.quota,t:o,label:o(`quota`),usedLabel:o(`quotaUsed`),remainingLabel:o(`quotaRemaining`),addOnLabel:o(`quotaAddOn`),resourcePackageLabel:o(`quotaResourcePackage`),exceededLabel:o(`quotaExceeded`),provider:e.provider}):(0,G.jsx)(`span`,{className:`text-caption text-foreground/65`,children:o(P===`hot`||P===`ready`||P===`loading`||P===`starting`?`quotaLoading`:`quotaUnavailable`)}),ie?(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsxs)(`div`,{className:`flex w-full cursor-help gap-2 rounded-lg bg-surface-secondary p-2 text-left text-caption leading-5 text-foreground`,children:[(0,G.jsx)(ho,{size:14,className:`mt-0.5 shrink-0 text-danger`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[ae?(0,G.jsx)(`div`,{className:`mono mb-0.5 truncate text-caption opacity-75`,children:ae}):null,(0,G.jsx)(`p`,{className:`break-words line-clamp-3`,children:ie})]})]})}),(0,G.jsx)(Mj.Content,{children:(0,G.jsxs)(`div`,{className:`max-w-md whitespace-pre-wrap break-words`,children:[ae?(0,G.jsx)(`div`,{className:`mono mb-1 text-caption opacity-75`,children:ae}):null,ie]})})]}):null,H?(0,G.jsxs)(`div`,{className:`flex w-full items-start gap-2 rounded-lg bg-surface-secondary p-2 text-caption leading-5`,children:[H.kind===`success`?(0,G.jsx)(Oi,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-success`}):H.kind===`already`?(0,G.jsx)(ho,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-warning`}):(0,G.jsx)(xo,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-danger`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[H.kind===`success`?(0,G.jsx)(`span`,{className:`font-medium text-success`,children:o(`checkinRecordSuccess`)}):H.kind===`already`?(0,G.jsx)(`span`,{className:`font-medium text-warning`,children:o(`checkinRecordAlready`)}):(0,G.jsx)(`span`,{className:`font-medium text-danger`,children:o(`checkinRecordFailed`)}),H.message?(0,G.jsxs)(`div`,{className:`mt-0.5`,children:[(0,G.jsx)(`p`,{className:`break-words line-clamp-2 text-foreground/80`,children:H.message}),(0,G.jsxs)(`div`,{className:`mt-1 flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption text-muted`,children:o(`checkinTruncated`)}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,className:`h-6 min-w-0 gap-1 px-1.5 text-caption`,onPress:()=>{Z7(H.message||``).then(e=>{!e||!H||(B(H),window.setTimeout(()=>B(null),1100))})},children:[(0,G.jsx)(X7,{copied:te,size:13}),o(te?`copied`:`checkinCopyError`)]})]})]}):null]})]}):null]}),n&&e.enabled?(0,G.jsxs)(`section`,{ref:D,className:`grid gap-3 bg-surface-secondary/55 px-3 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:o(`oauthDeviceFlow`)}),(0,G.jsx)(`p`,{className:`mt-1.5 text-caption leading-5 text-muted`,children:e.provider===`codex`?o(`wizardCodexBrowserLead`):o(`qoderLoginHint`)}),(0,G.jsx)(`div`,{className:`mt-2.5 flex flex-wrap gap-2`,children:e.provider===`codex`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(J,{size:`sm`,isPending:t===`device`,onPress:()=>c(`cli`),children:[(0,G.jsx)(Ia,{size:14}),o(`startCodexCliLogin`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>c(`chatgpt`),children:[(0,G.jsx)(Ia,{size:14}),o(`startCodexChatGPTLogin`)]})]}):(0,G.jsxs)(J,{size:`sm`,isPending:t===`device`,onPress:()=>c(),children:[(0,G.jsx)(Ia,{size:14}),o(`startBrowserLogin`)]})}),(e.provider===`trae`||e.provider===`codex`||e.provider===`devin`)&&f&&d?(0,G.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-caption leading-4 text-muted`,children:o(`wizardCallbackLead`)}),(0,G.jsx)(Uj,{className:`h-24 w-full resize-none font-mono text-caption leading-5`,value:u||``,onChange:e=>d(e.target.value),placeholder:o(`wizardCallbackPh`),"aria-label":o(`wizardCallbackPh`)}),(0,G.jsx)(J,{size:`sm`,variant:`secondary`,isPending:t===`callback`,onPress:f,children:o(`wizardSubmitCallback`)})]}):null]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:o(`patFallback`)}),(0,G.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row`,children:[(0,G.jsxs)(Wj,{className:`flex-1`,type:`password`,value:a,onChange:s,children:[(0,G.jsx)(jM,{className:`sr-only`,children:o(`pat`)}),(0,G.jsx)(Rj,{placeholder:o(`pasteToken`),"aria-label":o(`pat`)})]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:t===`pat`,onPress:l,children:[(0,G.jsx)(ua,{size:14}),o(`usePat`)]})]})]}),r||i?(0,G.jsxs)(`div`,{className:`text-caption`,children:[r?(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:o(`authUrl`)}),(0,G.jsx)(`code`,{className:`mono block break-all text-foreground`,children:r}),(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,onPress:()=>window.open(r,`_blank`,`noopener,noreferrer`),children:[(0,G.jsx)(ni,{size:14}),o(`openAuthUrl`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>{Z7(r).then(e=>{e&&(k(!0),window.setTimeout(()=>k(!1),1100))})},children:[(0,G.jsx)(X7,{copied:O}),o(O?`copied`:`copy`)]})]})]}):null,i?(0,G.jsx)(`p`,{className:`mt-1 text-muted`,children:i}):null]}):null]}):null,b?(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-separator px-4 py-2 text-caption text-muted`,children:[(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsxs)(`span`,{className:`flex cursor-help items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:o(`lastCheckin`)}),(0,G.jsx)(`span`,{className:se===`error`?`text-danger`:``,children:o(ce)})]})}),(0,G.jsxs)(Mj.Content,{children:[e.last_checkin_at?new Date(e.last_checkin_at).toLocaleString():o(`lastCheckinNone`),e.last_checkin_msg?` · ${e.last_checkin_msg}`:``]})]}),(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsxs)(`span`,{className:`flex cursor-help items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:o(`autoCheckin`)}),(0,G.jsx)(`span`,{className:`mono text-caption text-foreground/55`,children:e.checkin_time||_}),(0,G.jsx)(h7,{isSelected:!!e.auto_checkin,isDisabled:!!t,ariaLabel:o(`autoCheckin`),onChange:e=>y?.(e)})]})}),(0,G.jsx)(Mj.Content,{children:e.checkin_time?o(`checkinCustom`):o(`checkinInherit`)})]})]}):null,(0,G.jsxs)(CS.Footer,{className:`flex flex-wrap items-center gap-1.5 bg-surface-secondary px-4 py-2`,children:[m?(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`secondary`,isPending:t===`refresh`,onPress:m,"aria-label":o(`refreshAccount`),children:(0,G.jsx)(Qr,{size:15})})}),(0,G.jsx)(Mj.Content,{children:o(`refreshAccount`)})]}):null,(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:n?`secondary`:`ghost`,isDisabled:!e.enabled,onPress:w,"aria-label":o(`authentication`),children:(0,G.jsx)(ua,{size:15})})}),(0,G.jsx)(Mj.Content,{children:o(`authentication`)})]}),(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:T,"aria-label":o(`accountModels`),children:(0,G.jsx)(Bi,{size:15})})}),(0,G.jsx)(Mj.Content,{children:o(`accountModels`)})]}),(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:C,"aria-label":o(`editAccount`),children:(0,G.jsx)(Oa,{size:15})})}),(0,G.jsx)(Mj.Content,{children:o(`editAccount`)})]}),b?(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,isDisabled:!e.enabled||!!t,isPending:t===`checkin`,onPress:b,"aria-label":o(`checkinNow`),children:(0,G.jsx)(fi,{size:15})})}),(0,G.jsx)(Mj.Content,{children:o(`checkinNow`)})]}):null,(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:A?`secondary`:`ghost`,onPress:()=>j(e=>!e),"aria-label":o(`modelCooldowns`),children:(0,G.jsx)(no,{size:15,className:L.length?`text-warning`:void 0})})}),(0,G.jsxs)(Mj.Content,{children:[o(`modelCooldowns`),L.length?` · ${L.length}`:``]})]}),(0,G.jsxs)(EP,{children:[(0,G.jsx)(EP.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`secondary`,"aria-label":o(`more`),children:(0,G.jsx)(Wi,{size:16})})}),(0,G.jsx)(EP.Popover,{placement:`bottom end`,children:(0,G.jsxs)(EP.Menu,{"aria-label":o(`more`),onAction:e=>{e===`export`&&p(),e===`checkin-records`&&x?.(),e===`delete`&&h()},children:[e.auth_type===`none`?null:(0,G.jsxs)(EP.Item,{id:`export`,textValue:o(`export`),children:[(0,G.jsx)(Ii,{size:15}),o(`export`)]}),x?(0,G.jsxs)(EP.Item,{id:`checkin-records`,textValue:o(`checkinRecords`),children:[(0,G.jsx)(ga,{size:15}),o(`checkinRecords`)]}):null,(0,G.jsxs)(EP.Item,{id:`delete`,textValue:o(`delete`),className:`text-danger`,children:[(0,G.jsx)(io,{size:15}),o(`delete`)]})]})})]}),(0,G.jsx)(`div`,{className:`ml-auto flex shrink-0 flex-nowrap items-center gap-3 whitespace-nowrap`,children:(0,G.jsx)(h7,{isSelected:!!e.enabled,isDisabled:t===`toggle`,ariaLabel:e.enabled?o(`disable`):o(`enable`),label:e.enabled?o(`enabledState`):o(`disabled`),onChange:g})})]}),A?(0,G.jsxs)(`section`,{className:`border-t border-separator bg-surface-secondary/55 px-4 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:o(`modelCooldownsTitle`)}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:L.length})]}),L.length?(0,G.jsx)(`div`,{className:`space-y-1`,children:L.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-surface px-2 py-1.5 text-caption`,children:[(0,G.jsx)(`span`,{className:`mono min-w-0 truncate`,title:e,children:e}),(0,G.jsx)(`span`,{className:`mono shrink-0 text-warning`,children:f9(t)})]},e))}):(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:o(`modelCooldownsEmpty`)})]}):null]})}function $we(e,t){return e.status===`success`?{label:t(`checkinRecordSuccess`),color:`success`}:e.status===`already`?{label:t(`checkinRecordAlready`),color:`warning`}:e.status===`skipped`?{label:t(`checkinRecordSkipped`),color:`default`}:{label:t(`checkinRecordFailed`),color:`danger`}}function eTe(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function tTe({account:e,t,onClose:n}){let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!!e?.id),[s,c]=(0,v.useState)(``),l=e?.id||``,u=t(`checkinRecordsTitle`,{name:e?.name||e?.id||``});async function d(){if(l){o(!0),c(``);try{let e=await lse(l);i(e.data||[])}catch(e){i([]),c(e instanceof Error?e.message:String(e))}finally{o(!1)}}}return(0,v.useEffect)(()=>{l&&d()},[l]),(0,G.jsx)(Y.Root,{isOpen:!!e,onOpenChange:e=>{e||n()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:u}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`checkinRecordsHint`)})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(yo,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`px-5 pb-2`,children:[s?(0,G.jsx)(`div`,{className:`mb-3`,children:(0,G.jsx)(xI,{title:s})}):null,a?(0,G.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,G.jsx)(Q,{className:`h-16 w-full`}),(0,G.jsx)(Q,{className:`h-16 w-full`}),(0,G.jsx)(Q,{className:`h-16 w-full`})]}):r.length?(0,G.jsx)(`div`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:r.map(e=>{let n=$we(e,t);return(0,G.jsxs)(`div`,{className:`flex items-start gap-3 px-3 py-3`,children:[(0,G.jsx)(`span`,{className:`status-dot mt-1.5 shrink-0`,"data-state":e.status===`error`?`warn`:`ok`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:n.color,children:n.label}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:eTe(e.created_at)})]}),(0,G.jsx)(`p`,{className:`mt-1 break-words text-caption leading-5 text-foreground/75`,children:e.message||`—`})]})]},e.id)})}):(0,G.jsx)(I7,{className:`min-h-44 rounded-3xl bg-surface-secondary`,title:t(`checkinRecordsEmpty`),hint:t(`checkinRecordsHint`)})]}),(0,G.jsxs)(Y.Footer,{className:`justify-between px-5 pb-5`,children:[(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:t(`checkinRecordsCount`,{count:r.length})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:n,children:t(`close`)}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:a,onPress:()=>void d(),children:[(0,G.jsx)(Qr,{size:14}),t(`refresh`)]})]})]})]})})})})}function nTe(e){let t=e.route_display_name||``;return t&&t!==(e.display_name||e.id)?t:``}function rTe({account:e,t,onClose:n}){let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!!e?.id),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(``),d=e?.id||``,f=t(`accountModelsTitle`,{name:e?.name||e?.id||``}),p=e?YV(e.provider,e.region,t):``;async function m(e=!1){if(d){e?c(!0):(o(!0),i([])),u(``);try{let t=await(e?uI(d):lI(d));i(t.data||[])}catch(e){i([]),u(e instanceof Error?e.message:String(e))}finally{o(!1),c(!1)}}}return(0,v.useEffect)(()=>{if(!d)return;let e=!1;return lI(d).then(t=>{e||(i(t.data||[]),u(``),o(!1))}).catch(t=>{e||(i([]),u(t instanceof Error?t.message:String(t)),o(!1))}),()=>{e=!0}},[d]),(0,G.jsx)(Y.Root,{isOpen:!!e,onOpenChange:e=>{e||n()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:f}),(0,G.jsx)(`p`,{className:`mt-1 text-caption font-normal leading-5 text-muted`,children:t(`accountModelsHint`)}),e?(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-caption text-muted`,children:[(0,G.jsx)(XV,{provider:e.provider,size:14}),(0,G.jsx)(`span`,{children:p}),(0,G.jsx)(`span`,{className:`text-border`,children:`·`}),(0,G.jsx)(`span`,{className:`mono`,children:e.id})]}):null]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(yo,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`px-5 pb-2`,children:[l?(0,G.jsx)(`div`,{className:`mb-3`,children:(0,G.jsx)(xI,{title:t(`accountModelsError`,{msg:l})})}):null,a||s?(0,G.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,G.jsx)(Q,{className:`h-14 w-full`}),(0,G.jsx)(Q,{className:`h-14 w-full`}),(0,G.jsx)(Q,{className:`h-14 w-full`})]}):r.length?(0,G.jsx)(`ul`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:r.map(n=>{let r=n.provider||n.owned_by||e?.provider||`qoder`,i=nTe(n),a=bV(n),o=xV(n);return(0,G.jsxs)(`li`,{className:`flex items-start gap-3 px-3 py-2.5`,children:[(0,G.jsx)(`span`,{className:`status-dot mt-1.5`,"data-state":n.stale?void 0:`ok`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-body font-medium`,children:n.display_name||n.id}),o?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null,a?(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:a}):null,n.stale?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`warning`,children:t(`fallback`)}):null]}),(0,G.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:n.id}),i?(0,G.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:t(`routedTo`,{model:i})}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 pt-0.5 text-caption text-muted`,children:[(0,G.jsx)(XV,{provider:r,size:12}),(0,G.jsx)(`span`,{children:r})]})]},n.id)})}):(0,G.jsx)(I7,{className:`min-h-48 rounded-3xl bg-surface-secondary`,icon:(0,G.jsx)(Bi,{size:22}),title:t(`accountModelsEmpty`),hint:t(`noModelsYet`)})]}),(0,G.jsxs)(Y.Footer,{className:`justify-between px-5 pb-5`,children:[(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:a?t(`refreshing`):t(`shownTotal`,{shown:r.length,total:r.length})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:n,children:t(`close`)}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:s,onPress:()=>void m(!0),children:[(0,G.jsx)(Qr,{size:14}),t(s?`refreshing`:`refresh`)]})]})]})]})})})})}var iTe=`w-28`;function _9({label:e,hint:t,labelWidthClass:n=iTe,htmlFor:r,align:i=`center`,children:a}){return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex gap-3 ${i===`start`?`items-start`:`items-center`}`,children:[(0,G.jsx)(jM,{htmlFor:r,className:`${n} shrink-0 ${i===`start`?`pt-2`:``} text-body font-medium text-foreground`,children:e}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1 [&_[data-slot=input]]:w-full [&_[data-slot=textarea]]:w-full`,children:a})]}),t?(0,G.jsx)(`p`,{className:`mt-1.5 pl-[7.75rem] text-caption leading-5 text-muted`,children:t}):null]})}function aTe({catalog:e,selected:t,onChange:n,isDisabled:r,t:i}){let[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(t),l=(0,v.useMemo)(()=>new Set(t),[t]),u=(0,v.useMemo)(()=>{let t=new Set(s),n=a.trim().toLowerCase(),r=(e||[]).filter(e=>!n||e.toLowerCase().includes(n));return[...r.filter(e=>t.has(e)),...r.filter(e=>!t.has(e))]},[e,a,s]),d=(0,v.useMemo)(()=>{if(!e)return[];let n=new Set(e);return t.filter(e=>!n.has(e))},[e,t]),f=e?.length??0,p=t.filter(e=>!d.includes(e)).length;function m(e){o(e),c(t)}function h(e,r){n(r?[...t,e]:t.filter(t=>t!==e))}function g(){let e=new Set(t);u.forEach(t=>e.add(t)),n([...e])}function _(){let e=new Set(u);n(t.filter(t=>!e.has(t)))}return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(kM,{"aria-label":i(`modelPickerSearch`),value:a,onChange:m,isDisabled:r,className:`min-w-0 flex-1 basis-48`,children:(0,G.jsxs)(kM.Group,{children:[(0,G.jsx)(kM.SearchIcon,{}),(0,G.jsx)(kM.Input,{placeholder:i(`modelPickerSearch`)}),(0,G.jsx)(kM.ClearButton,{})]})}),(0,G.jsx)(`span`,{className:`mono shrink-0 text-caption text-muted`,children:i(`modelPickerCount`,{selected:p,total:f})}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,isDisabled:r||u.length===0,onPress:g,children:[(0,G.jsx)(Ai,{size:14}),i(`modelPickerSelectAll`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,isDisabled:r||t.length===0,onPress:_,children:[(0,G.jsx)(Ka,{size:14}),i(`modelPickerClear`)]})]})]}),(0,G.jsxs)(`div`,{className:`max-h-[300px] overflow-y-auto overscroll-contain rounded-lg bg-surface-secondary p-1`,children:[e===null?(0,G.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:i(`refreshing`)}):null,d.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-md px-2.5 py-1.5`,children:[(0,G.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-body text-muted line-through`,children:e}),(0,G.jsx)(`span`,{className:`shrink-0 text-caption text-warning`,children:i(`modelPickerOffline`)}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,isDisabled:r,"aria-label":i(`modelPickerRemove`,{model:e}),onPress:()=>h(e,!1),children:(0,G.jsx)(yo,{size:14})})]},`offline-${e}`)),u.map(e=>(0,G.jsx)(IS,{isSelected:l.has(e),isDisabled:r,onChange:t=>h(e,t),className:`flex w-full cursor-pointer rounded-md px-2.5 py-1.5 transition-colors hover:bg-default`,children:(0,G.jsxs)(IS.Content,{className:`flex min-w-0 flex-1 items-center gap-2.5`,children:[(0,G.jsx)(IS.Control,{children:(0,G.jsx)(IS.Indicator,{})}),(0,G.jsx)(`span`,{className:`mono min-w-0 truncate text-body text-foreground`,children:e})]})},e)),e!==null&&u.length===0?(0,G.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:i(f===0?`noAccountModels`:`modelPickerNoMatch`)}):null]})]})}function oTe(e){let[t,n]=(0,v.useState)(e);e&&!t&&n(!0);let r=(0,v.useRef)(null),i=(0,v.useRef)(null),a=(0,v.useRef)(e);return(0,v.useLayoutEffect)(()=>{let t=r.current,o=i.current;if(!t||!o)return;if(a.current){a.current=!1;return}Z.killTweensOf([t,o]);let s=t.getBoundingClientRect().height;if(e){Z.set(t,{overflow:`hidden`});let e=t.scrollHeight;Z.fromTo(t,{height:s===e?0:s},{height:e,duration:JB(WB.base),ease:GB.out,onComplete:()=>Z.set(t,{clearProps:`height,overflow`})}),Z.fromTo(o,{autoAlpha:0,y:-6},{autoAlpha:1,y:0,duration:JB(WB.base),ease:GB.out})}else Z.set(t,{overflow:`hidden`,height:s}),Z.to(o,{autoAlpha:0,y:-4,duration:JB(WB.fast),ease:GB.inOut}),Z.to(t,{height:0,duration:JB(WB.fast+.04),ease:GB.inOut,onComplete:()=>n(!1)});return()=>{Z.killTweensOf([t,o])}},[e,t]),{mounted:t,outerRef:r,innerRef:i}}function sTe({account:e,checkinDefaultTime:t,checkinTimezone:n,busy:r,t:i,onClose:a,onSave:o}){let[s,c]=(0,v.useState)(e?.name||``),[l,u]=(0,v.useState)(e?.max_inflight??4),[d,f]=(0,v.useState)(e?.priority??50),[p,m]=(0,v.useState)(e?.proxy_url||``),[h,g]=(0,v.useState)(!!e?.drop_system_prompt),[_,y]=(0,v.useState)(Object.entries(e?.model_aliases||{}).map(([e,t])=>({alias:e,model:t}))),[b,x]=(0,v.useState)({alias:``,model:``}),[S,C]=(0,v.useState)(!!e?.models_restricted),[w,T]=(0,v.useState)(e?.enabled_models||[]),{mounted:E,outerRef:D,innerRef:O}=oTe(S),[k,A]=(0,v.useState)(null),[j,M]=(0,v.useState)(!e?.checkin_time),[N,P]=(0,v.useState)(e?.checkin_time||null),[F,I]=(0,v.useState)(``);(0,v.useEffect)(()=>{if(!e?.id)return;let t=!1;return lI(e.id).then(e=>{t||A(e.data||[])}).catch(()=>{t||A([])}),()=>{t=!0}},[e?.id]);let L=i(`editAccountTitle`,{name:e?.name||e?.id||``}),ee=e?YV(e.provider,e.region,i):``;async function R(n){n?.preventDefault();let r=s.trim();if(!r){I(i(`accountNameRequired`));return}if(!Number.isInteger(l)||l<1||l>32){I(i(`maxInflightInvalid`));return}if(!Number.isInteger(d)||d<1||d>100){I(i(`priorityInvalid`));return}if(t!==void 0&&!j&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(N??t)){I(i(`checkinTimeInvalid`));return}I(``);try{await o({name:r,max_inflight:l,priority:d,proxy_url:p.trim(),checkin_time:t===void 0?void 0:j?``:N??t,drop_system_prompt:e?.provider===`workbuddy`||e?.provider===`trae`?h:void 0,model_aliases:Object.fromEntries(_.filter(e=>e.alias.trim()&&e.model.trim()).map(e=>[e.alias.trim(),e.model.trim()])),enabled_models:S?w:[],set_model_routing:!0}),a()}catch(e){I(e instanceof Error?e.message:String(e))}}return(0,G.jsx)(Y.Root,{isOpen:!!e,onOpenChange:e=>{!e&&!r&&a()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{className:`w-full sm:w-[42rem] sm:max-w-[calc(100vw-2rem)]`,children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:L}),(0,G.jsx)(`p`,{className:`mt-1.5 text-body font-normal leading-6 text-muted`,children:i(`editAccountHint`)}),e?(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(BS,{size:`sm`,variant:`soft`,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(XV,{provider:e.provider,size:14}),(0,G.jsx)(`span`,{children:ee})]})}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:e.id})]}):null]}),(0,G.jsx)(Y.CloseTrigger,{isDisabled:r,"aria-label":i(`close`),className:`grid size-9 shrink-0 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(yo,{size:18})})]}),(0,G.jsxs)(Y.Body,{className:`px-6 pb-2 pt-1`,children:[F?(0,G.jsxs)(_P,{status:`danger`,className:`mb-4`,children:[(0,G.jsx)(_P.Indicator,{}),(0,G.jsx)(_P.Content,{children:(0,G.jsx)(_P.Title,{children:F})})]}):null,(0,G.jsxs)(mP,{className:`space-y-4`,onSubmit:e=>void R(e),children:[(0,G.jsx)(_9,{label:i(`accountName`),children:(0,G.jsx)(Rj,{value:s,onChange:e=>c(e.target.value),placeholder:i(`wizardNamePh`),"aria-label":i(`accountName`),disabled:r,autoFocus:!0})}),(0,G.jsx)(_9,{label:i(`maxInflight`),hint:i(`maxInflightHint`),children:(0,G.jsx)(jP,{value:l,onChange:e=>u(e??4),minValue:1,maxValue:32,isDisabled:r,isRequired:!0,children:(0,G.jsxs)(jP.Group,{children:[(0,G.jsx)(jP.DecrementButton,{}),(0,G.jsx)(jP.Input,{"aria-label":i(`maxInflight`)}),(0,G.jsx)(jP.IncrementButton,{})]})})}),(0,G.jsx)(_9,{label:i(`priority`),hint:i(`priorityHint`),children:(0,G.jsx)(jP,{value:d,onChange:e=>f(e??50),minValue:1,maxValue:100,isDisabled:r,isRequired:!0,children:(0,G.jsxs)(jP.Group,{children:[(0,G.jsx)(jP.DecrementButton,{}),(0,G.jsx)(jP.Input,{"aria-label":i(`priority`)}),(0,G.jsx)(jP.IncrementButton,{})]})})}),(0,G.jsx)(_9,{label:i(`proxyUrl`),hint:i(`proxyUrlHint`),children:(0,G.jsx)(Rj,{value:p,onChange:e=>m(e.target.value),placeholder:i(`proxyUrlPlaceholder`),"aria-label":i(`proxyUrl`),disabled:r})}),e?.provider===`workbuddy`||e?.provider===`trae`?(0,G.jsx)(_9,{label:i(`dropSystemPrompt`),hint:i(e?.provider===`trae`?`dropSystemPromptTraeHint`:`dropSystemPromptHint`),children:(0,G.jsx)(h7,{isSelected:h,isDisabled:r,ariaLabel:i(`dropSystemPrompt`),onChange:g})}):null,(0,G.jsx)(_9,{align:`start`,label:i(`accountModelAliases`),hint:i(`accountModelAliasesHint`),children:(0,G.jsxs)(`div`,{className:`space-y-2`,children:[_.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`span`,{className:`mono min-w-0 truncate text-body`,children:[e.alias,` → `,e.model]}),(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isDisabled:r,onPress:()=>y(t=>t.filter(t=>t.alias!==e.alias)),children:i(`modelAliasRemove`)})]},e.alias)),(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_1fr_auto]`,children:[(0,G.jsx)(Rj,{"aria-label":i(`modelAliasName`),value:b.alias,onChange:e=>x(t=>({...t,alias:e.target.value})),placeholder:i(`modelAliasPlaceholder`),disabled:r}),(0,G.jsx)(Rj,{"aria-label":i(`modelAliasTarget`),value:b.model,onChange:e=>x(t=>({...t,model:e.target.value})),placeholder:i(`accountModelAliasTargetPlaceholder`),disabled:r}),(0,G.jsx)(J,{size:`sm`,variant:`secondary`,isDisabled:r||!b.alias.trim()||!b.model.trim(),onPress:()=>{y(e=>[...e.filter(e=>e.alias!==b.alias.trim()),{alias:b.alias.trim(),model:b.model.trim()}]),x({alias:``,model:``})},children:i(`modelAliasAdd`)})]})]})}),(0,G.jsxs)(`section`,{className:`space-y-3 pt-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-body font-medium text-foreground`,children:i(`enabledModels`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:i(`enabledModelsHint`)})]}),(0,G.jsx)(h7,{isSelected:S,isDisabled:r,ariaLabel:i(`restrictModels`),label:i(S?`restrictModels`:`allModels`),onChange:C})]}),E?(0,G.jsx)(`div`,{ref:D,children:(0,G.jsx)(`div`,{ref:O,children:(0,G.jsx)(aTe,{catalog:k?k.map(e=>e.id):null,selected:w,onChange:T,isDisabled:r,t:i})})}):null]}),t===void 0?null:(0,G.jsx)(_9,{label:i(`autoCheckinTime`),hint:i(`checkinScheduleHint`),children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(h7,{isSelected:j,isDisabled:r,onChange:M,ariaLabel:i(`checkinInherit`),label:i(`checkinInherit`)}),(0,G.jsxs)(`p`,{className:`text-caption text-muted`,children:[i(`checkinDefaultValue`,{time:t}),` · `,(0,G.jsx)(`span`,{className:`mono`,children:n})]}),j?null:(0,G.jsx)(Rj,{type:`time`,value:N??t,onChange:e=>P(e.target.value),"aria-label":i(`autoCheckinTime`),disabled:r,required:!0})]})})]})]}),(0,G.jsxs)(Y.Footer,{className:`justify-end gap-2 px-6 pb-6`,children:[(0,G.jsx)(J,{variant:`ghost`,isDisabled:r,onPress:a,children:i(`cancel`)}),(0,G.jsx)(J,{isPending:r,onPress:()=>void R(),children:i(`save`)})]})]})})})})}var cTe={1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-3`};function v9({options:e,value:t,onChange:n,ariaLabel:r,columns:i=2,className:a=``}){let o=(0,v.useRef)(null);return(0,v.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=Z.context(()=>{let e=Z.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(`[data-option-tile]`,{autoAlpha:1,y:0})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{Z.fromTo(`[data-option-tile]`,{autoAlpha:0,y:8},{autoAlpha:1,y:0,duration:.32,stagger:.035,ease:`power3.out`,overwrite:!0})})},e);return()=>t.revert()},[e.length]),(0,G.jsx)(`div`,{ref:o,role:`radiogroup`,"aria-label":r,className:`grid gap-3 ${cTe[i]} ${a}`.trim(),children:e.map(e=>{let r=e.value===t;return(0,G.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,"data-option-tile":``,"data-selected":r||void 0,disabled:e.disabled,title:e.hint,onClick:()=>n(e.value),className:`flex h-16 min-w-0 items-center gap-3 rounded-xl bg-surface shadow-surface px-4 text-left transition-colors hover:bg-surface-secondary disabled:cursor-not-allowed disabled:opacity-50 data-selected:border-accent data-selected:bg-accent-soft`,children:[e.icon?(0,G.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground [&_svg]:size-[18px]`,children:e.icon}):null,(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body font-medium leading-5 text-foreground`,children:e.label})]},e.value)})})}var y9=new Set([`qoder-global`,`qoder-cn`,`workbuddy-global`,`workbuddy-cn`,`trae-cn`]),lTe=[`qoder-global`,`qoder-cn`,`workbuddy-global`,`workbuddy-cn`,`trae-cn`];function uTe(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>{let r=n.get(e.id)??2**53-1,i=n.get(t.id)??2**53-1;return r===i?e.label.localeCompare(t.label):r-i})}function b9(e,t){return!t||`${e.label} ${e.subtitle||``} ${e.hint||``} ${e.provider} ${e.id}`.toLowerCase().includes(t)}function dTe({ariaLabel:e}){return(0,G.jsx)(`div`,{className:`space-y-8`,"aria-busy":`true`,"aria-label":e,children:Array.from({length:2},(e,t)=>(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(rA,{className:`h-3 w-24 rounded-lg`}),(0,G.jsx)(rA,{className:`h-3 w-40 rounded-lg`})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:Array.from({length:t===0?5:6},(e,t)=>(0,G.jsxs)(`div`,{className:`card flex flex-row items-center gap-3.5 rounded-xl bg-surface px-4 py-3.5`,children:[(0,G.jsx)(rA,{className:`size-10 shrink-0 rounded-lg`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,G.jsx)(rA,{className:`h-3.5 w-28 rounded-lg`}),(0,G.jsx)(rA,{className:`h-3 w-36 rounded-lg`})]})]},t))})]},t))})}function fTe({tile:e,disabled:t,onSelect:n}){return(0,G.jsxs)(`button`,{type:`button`,disabled:t,title:e.hint||e.subtitle||e.label,onClick:()=>n(e.id),className:`card flex min-w-0 flex-row items-center gap-3 rounded-xl bg-surface px-3.5 py-3 text-left transition-[transform,opacity,background-color] duration-200 ease-out hover:bg-surface-secondary active:translate-y-px active:scale-[0.98] motion-reduce:transition-none motion-reduce:active:translate-y-0 motion-reduce:active:scale-100 disabled:cursor-not-allowed disabled:opacity-50 disabled:active:translate-y-0 disabled:active:scale-100`,children:[(0,G.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg text-foreground [&_svg]:size-[18px]`,children:(0,G.jsx)(XV,{provider:e.provider,size:18})}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate text-body font-medium leading-5 text-foreground`,children:e.label}),e.subtitle?(0,G.jsx)(`span`,{className:`mt-0.5 block truncate text-caption leading-4 text-muted`,children:e.subtitle}):null]})]})}function pTe({title:e,subtitle:t,tiles:n,disabled:r,onSelect:i}){return n.length?(0,G.jsxs)(`section`,{className:`space-y-3.5`,children:[(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsx)(`h3`,{className:`text-[10px] font-semibold tracking-[0.12em] uppercase text-muted`,children:e}),t?(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:t}):null]}),(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:n.map(e=>(0,G.jsx)(fTe,{tile:e,disabled:r,onSelect:i},e.id))})]}):null}function mTe({options:e,onSelect:t,disabled:n,empty:r,ariaLabel:i}){let{t:a}=JF(),[o,s]=(0,v.useState)(``),c=o.trim().toLowerCase(),l=(0,v.useMemo)(()=>{let t=uTe(e.filter(e=>y9.has(e.id)),lTe),n=e.filter(e=>!y9.has(e.id)).sort((e,t)=>e.label.localeCompare(t.label));return[{id:`subscriptions`,titleKey:`providerGroupSubscriptions`,subtitleKey:`providerGroupSubscriptionsHint`,tiles:t.filter(e=>b9(e,c))},{id:`experimental`,titleKey:`providerGroupExperimental`,subtitleKey:`providerGroupExperimentalHint`,tiles:n.filter(e=>b9(e,c))}]},[c,e]),u=l.reduce((e,t)=>e+t.tiles.length,0);return(0,G.jsxs)(`div`,{className:`space-y-8`,role:`listbox`,"aria-label":i,children:[(0,G.jsx)(B7,{value:o,onChange:s,placeholder:a(`providerFindPlaceholder`),ariaLabel:a(`providerFindPlaceholder`),className:`max-w-sm`}),u===0?r||(0,G.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:a(`providerFindEmpty`)}):l.map(e=>(0,G.jsx)(pTe,{title:a(e.titleKey),subtitle:a(e.subtitleKey),tiles:e.tiles,disabled:n,onSelect:t},e.id))]})}function x9(e,t){let n={...e},r=n.format===`workbuddy-accounts`||Array.isArray(n.accounts);return n.format?r&&(n.format=`workbuddy-accounts`):n.format=r?`workbuddy-accounts`:`workbuddy-oauth-v1`,{...n,name:t.name?.trim()||n.name,enabled:t.enabled??!0,provider:`workbuddy`,region:t.region,max_inflight:t.max_inflight??4,priority:t.priority??50,drop_system_prompt:t.drop_system_prompt??!0,...t.proxy_url!=null&&t.proxy_url!==``?{proxy_url:t.proxy_url}:{}}}function S9(e,t){let n=typeof e?.succeeded==`number`?e.succeeded:e?.id||e?1:0,r=typeof e?.failed==`number`?e.failed:0,i=(e?.errors||[]).slice(0,3).map(e=>e.message||`index ${e.index}`).filter(Boolean).join(`; `),a;return a=r>0?t(`accountImportPartial`).replace(`{ok}`,String(n)).replace(`{fail}`,String(r))+(i?` — ${i}`:``):n>1?t(`accountImportBatch`).replace(`{n}`,String(n)):t(`accountImported`),{succeeded:n,failed:r,message:a}}async function hTe(e,t){return mI(x9(e,t))}var C9={global:`Global`,cn:`CN`},gTe={"qoder-global":`accountTypeQoderGlobal`,"qoder-cn":`accountTypeQoderCN`,"workbuddy-cn":`accountTypeWorkBuddyCN`,"workbuddy-global":`accountTypeWorkBuddyGlobal`,"trae-cn":`accountTypeTraeCN`,"devin-global":`accountTypeDevinGlobal`,"command-global":`accountTypeCommandGlobal`,"codex-global":`accountTypeCodexGlobal`,"zhipu-cn":`accountTypeZhipuCN`,"qwenwork-global":`accountTypeQwenworkGlobal`,"qwenwork-cn":`accountTypeQwenworkCN`,"kimi-cn":`accountTypeKimiCN`,"codearts-cn-north-4":`accountTypeCodeArtsCN`,"meta-global":`accountTypeMetaGlobal`},_Te={"qoder-global":`accountTypeQoderGlobalHint`,"qoder-cn":`accountTypeQoderCNHint`,"workbuddy-cn":`accountTypeWorkBuddyCNHint`,"workbuddy-global":`accountTypeWorkBuddyGlobalHint`,"trae-cn":`accountTypeTraeCNHint`,"devin-global":`accountTypeDevinGlobalHint`,"command-global":`accountTypeCommandGlobalHint`,"codex-global":`accountTypeCodexGlobalHint`,"zhipu-cn":`accountTypeZhipuCNHint`,"qwenwork-global":`accountTypeQwenworkGlobalHint`,"qwenwork-cn":`accountTypeQwenworkCNHint`,"kimi-cn":`accountTypeKimiCNHint`,"codearts-cn-north-4":`accountTypeCodeArtsCNHint`,"meta-global":`accountTypeMetaGlobalHint`};async function vTe(){let e=(await dI().catch(()=>null))?.data||[],t=[];for(let n of e)for(let e of n.regions)t.push({id:`${n.id}-${e.id}`,provider:n.id,region:e.id,descriptor:n});return t}function w9(e,t){let n=gTe[e.id];if(n){let e=t(n);if(e!==n)return e}let r=e.descriptor.regions.find(t=>t.id===e.region)?.label||C9[e.region]||``,i=e.descriptor.regions.length>1&&r?` ${r}`:``;return`${e.descriptor.label}${i}`.trim()}function T9(e,t){if(!e)return``;let n=_Te[e.id];if(!n)return``;let r=t(n);return r===n?``:r}function yTe({phase:e,busy:t,tab:n,forTab:r}){return e===`done`?(0,G.jsx)(Oi,{size:16,className:`text-success`}):t&&n===r?(0,G.jsx)(QB,{size:16,loading:!0}):null}var bTe=90,xTe=2e3;function STe({isOpen:e,onClose:t,onAdded:n}){let{t:r}=JF(),[i,a]=(0,v.useState)(`method`),[o,s]=(0,v.useState)(`browser`),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(4),[x,S]=(0,v.useState)(50),[C,w]=(0,v.useState)(!0),[T,E]=(0,v.useState)(``),[D,O]=(0,v.useState)(``),[k,A]=(0,v.useState)(``),[j,M]=(0,v.useState)(`payg`),[N,P]=(0,v.useState)(``),[F,I]=(0,v.useState)(``),[L,ee]=(0,v.useState)(``),[R,z]=(0,v.useState)(`idle`),[B,V]=(0,v.useState)(``),[H,te]=(0,v.useState)(``),[ne,re]=(0,v.useState)(!1),[ie,ae]=(0,v.useState)(``),[oe,se]=(0,v.useState)(`cli`),ce=(0,v.useRef)(null),le=(0,v.useRef)(null),ue=(0,v.useRef)(null),de=(0,v.useRef)(``),fe=(0,v.useRef)(null),pe=(0,v.useRef)(null);function me(){fe.current!==null&&(window.clearTimeout(fe.current),fe.current=null)}(0,v.useEffect)(()=>()=>me(),[]),(0,v.useEffect)(()=>{if(!e)return;let t=!1;return p(!0),d([]),l(``),vTe().then(e=>{t||(d(e),l(``),s(`browser`))}).finally(()=>{t||p(!1)}),()=>{t=!0}},[e]);let he=u.find(e=>e.id===c),ge=!f&&u.length>0,_e=he?.descriptor.capabilities?.pat_login!==!1,ve=he?.descriptor.capabilities?.import_export!==!1,ye=he?.descriptor.capabilities?.browser_login!==!1,be=he?.provider===`workbuddy`||he?.provider===`trae`,xe=he?.provider===`trae`||he?.provider===`devin`||he?.provider===`codex`||he?.provider===`codearts`,Se=R===`busy`||R===`polling`,Ce=!!de.current||Se,we=R===`done`,Te=T9(he,r);(0,v.useEffect)(()=>{o===`pat`&&!_e&&s(`browser`),o===`import`&&!ve&&s(`browser`)},[ve,_e,o]),(0,v.useEffect)(()=>{ye||(_e?s(`pat`):ve&&s(`import`))},[ye,ve,_e]);function Ee(){return!Number.isInteger(y)||y<1||y>32?4:y}function De(){return!Number.isInteger(x)||x<1||x>100?50:x}function Oe(){return{max_inflight:Ee(),priority:De(),drop_system_prompt:be?C:he?.provider!==`kimi`&&he?.provider!==`codearts`,proxy_url:T.trim()}}function ke(){me(),a(`method`),s(`browser`),l(``),d([]),p(!1),_(``),b(4),S(50),w(!0),E(``),O(``),A(``),M(`payg`),P(``),I(``),ee(``),h(!1),z(`idle`),V(``),te(``),re(!1),ae(``),se(`cli`),de.current=``}function Ae(){Se||(ke(),t())}function je(){ke(),t()}(0,v.useLayoutEffect)(()=>{let t=ce.current;if(e||(ue.current=null),!t||!e)return;let n=Z.context(()=>{let e=Z.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(t,{autoAlpha:1,x:0,y:0})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=ue.current,n=e&&e!==i?i===`login`?1:-1:0;Z.fromTo(t,{autoAlpha:0,x:20*n,y:n?0:12},{autoAlpha:1,x:0,y:0,duration:WB.slow,ease:GB.out,overwrite:!0}),n&&le.current&&Z.fromTo(le.current,{autoAlpha:0,y:6},{autoAlpha:1,y:0,duration:WB.base,ease:GB.out,overwrite:!0})})},t);return ue.current=i,()=>n.revert()},[e,i]);function Me(e){if(Se||!ge)return;let t=u.find(t=>t.id===e);l(e),s(t?.provider===`zhipu`?`pat`:`browser`),w(t?.provider!==`trae`&&t?.provider!==`kimi`&&t?.provider!==`codearts`),V(``),a(`login`)}async function Ne(){if(de.current)return de.current;if(!he)throw Error(r(`accountTypeHint`));let e=Oe(),t=await cse(g.trim()||r(`account`),he.provider,he.region,e),n=t?.id||t?.data?.id;if(!n)throw Error(`create account returned no id`);return de.current=n,n}async function Pe(){V(``),te(``);try{z(`busy`);let e=await Ne();V(r(`wizardStartingSession`)),z(`polling`);let t=await rI(e,he?.provider===`codex`?oe:void 0);t.authUrl&&te(t.authUrl),V(r(`wizardWaitingBrowser`));for(let t=0;t{fe.current=window.setTimeout(e,xTe)});let n=(await iI(e)).login||{};if(n.message&&V(n.message),n.status===`ok`)break;if(n.status===`error`)throw Error(n.message||`login failed`);if(t===89)throw Error(r(`wizardLoginTimeout`))}z(`done`),V(r(`wizardAccountReady`)),n(),window.setTimeout(je,900)}catch(e){z(`idle`),V(e instanceof Error?e.message:String(e))}}async function Fe(){let e=ie.trim();if(!e){V(r(`wizardCallbackPh`));return}try{z(`busy`);let t=await Ne();me(),await aI(t,e),z(`done`),V(r(`wizardAccountReady`)),n(),window.setTimeout(je,900)}catch(e){z(`polling`),V(e instanceof Error?e.message:String(e))}}async function Ie(){let e=N.trim();if(!e){V(r(`zhipuKeyRequired`));return}if(!he){V(r(`accountTypeHint`));return}V(``);try{z(`busy`);let t=Oe();await mI({format:`zhipu-key-v1`,api_key:e,mode:j,organization:j===`coding`?F.trim():``,project:j===`coding`?L.trim():``,name:g.trim()||r(`accountTypeZhipuCN`),enabled:!0,provider:he.provider,region:he.region,max_inflight:t.max_inflight,priority:t.priority,drop_system_prompt:t.drop_system_prompt,proxy_url:t.proxy_url}),z(`done`),V(r(`wizardAccountReady`)),n(),window.setTimeout(je,700)}catch(e){z(`idle`),V(e instanceof Error?e.message:String(e))}}async function Le(){let e=D.trim();if(!e){V(r(`pastePatFirst`));return}V(``);try{z(`busy`);let t=await Ne();V(r(`wizardStartingSession`)),await oI(e,t),z(`done`),V(r(`patDone`)),n(),window.setTimeout(je,700)}catch(e){z(`idle`),V(e instanceof Error?e.message:String(e))}}async function Re(){V(``);let e;try{e=JSON.parse(k)}catch{V(r(`wizardBadJson`));return}if(!e||typeof e!=`object`){V(r(`wizardBadJson`));return}if(!he){V(r(`accountTypeHint`));return}if(he.provider===`qoder`&&(typeof e.user_blob!=`string`||typeof e.machine_id!=`string`)){V(r(`wizardBadJson`));return}let t=Oe(),i;he.provider===`workbuddy`?i=x9(e,{region:he.region===`global`?`global`:`cn`,name:g.trim()||void 0,enabled:!0,max_inflight:t.max_inflight,priority:t.priority,drop_system_prompt:t.drop_system_prompt,proxy_url:t.proxy_url}):(e.format||(he.descriptor.id===`trae`?e.format=`trae-oauth-v1`:he.descriptor.id===`devin`?e.format=`devin-session-v1`:he.descriptor.id===`command`?e.format=`command-key-v1`:he.descriptor.id===`qwenwork`?e.format=`qwenwork-oauth-v1`:e.format=`qoder-native-v1`),i={...e,name:g.trim()||e.name,enabled:!0,provider:he.provider,region:he.region,max_inflight:t.max_inflight,priority:t.priority,drop_system_prompt:t.drop_system_prompt});try{z(`busy`);let{failed:e,message:t}=S9(await mI(i),r);z(`done`),V(t),n(),window.setTimeout(je,e>0?1600:700)}catch(e){z(`idle`),V(e instanceof Error?e.message:String(e))}}function ze(){pe.current?.click()}function Be(e){let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>A(String(n.result||``)),n.readAsText(t),e.target.value=``}let Ve=e=>Se&&o===e,He=he?.provider===`zhipu`,Ue=[he?.descriptor.capabilities?.browser_login===!1?null:{value:`browser`,label:r(`tabBrowser`)},_e?{value:`pat`,label:r(`tabPat`)}:null,ve?{value:`import`,label:r(`tabImport`)}:null].filter(Boolean),We=r(o===`browser`?he?.provider===`codex`?`wizardCodexBrowserLead`:`wizardBrowserLead`:o===`pat`?he?.provider===`command`?`wizardPatLeadCommand`:he?.region===`cn`&&he?.provider===`qoder`?`wizardPatLeadCN`:`wizardPatLead`:`wizardImportLead`);return(0,G.jsx)(Y.Root,{isOpen:e,onOpenChange:e=>{e||Ae()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,isDismissable:!Se,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{className:`w-full sm:w-[36rem] sm:max-w-[calc(100vw-2rem)] sm:min-h-[36rem]`,children:[(0,G.jsxs)(Y.Header,{className:`relative items-center justify-center px-12 pt-5 text-center`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:r(`addAccountTitle`)}),(0,G.jsx)(`p`,{ref:le,className:`mt-1 text-caption font-normal leading-5 text-muted`,children:i===`method`?r(`addAccountDesc`):Te||r(`addAccountDesc`)})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":r(`close`),className:`absolute right-4 top-4 grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(yo,{size:16})})]}),(0,G.jsx)(Y.Body,{className:i===`method`?`px-8 pb-5 sm:px-10`:`px-6 pb-2`,children:(0,G.jsx)(`div`,{ref:ce,children:i===`method`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`section`,{className:`space-y-2.5`,children:f?(0,G.jsx)(dTe,{ariaLabel:r(`accountType`)}):ge?(0,G.jsx)(mTe,{ariaLabel:r(`accountType`),options:u.map(e=>{let t=e.descriptor.regions.find(t=>t.id===e.region)?.label||C9[e.region]||``;return{id:e.id,provider:e.provider,label:w9(e,r),subtitle:t,hint:T9(e,r)}}),onSelect:Me,disabled:Ce}):(0,G.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:r(`accountTypeHint`)})}),(0,G.jsx)(`div`,{className:`mt-4 text-center`,children:(0,G.jsx)(e9,{className:`text-xs`})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`card flex flex-row items-center gap-3 rounded-xl bg-surface px-3 py-2.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0`,children:(0,G.jsx)(XV,{provider:he?.provider,size:18})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate text-body font-medium text-foreground`,children:he?w9(he,r):r(`accountType`)}),(0,G.jsx)(`div`,{className:`truncate text-caption text-muted`,children:Te})]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>a(`method`),isDisabled:Se||!!de.current,children:[(0,G.jsx)(mi,{size:12}),r(`wizardBack`)]})]}),(0,G.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(jM,{className:`text-body font-medium text-muted`,children:r(`accountName`)}),(0,G.jsx)(Rj,{fullWidth:!0,value:g,onChange:e=>_(e.target.value),"aria-label":r(`accountName`),disabled:Ce,autoFocus:!0})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>h(e=>!e),"aria-expanded":m,className:`inline-flex items-center gap-1 text-caption font-medium text-muted transition-colors hover:text-foreground`,children:[(0,G.jsx)(gi,{size:12,className:`transition-transform duration-200 ${m?`rotate-90`:``}`}),r(`wizardAdvanced`)]}),m?(0,G.jsxs)(`div`,{className:`card gap-3 rounded-xl bg-surface px-3.5 py-3.5`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(jM,{className:`text-body font-medium text-muted`,children:r(`maxInflight`)}),(0,G.jsx)(jP,{value:y,onChange:e=>b(e??4),minValue:1,maxValue:32,isDisabled:Ce,isRequired:!0,children:(0,G.jsxs)(jP.Group,{className:`w-full`,children:[(0,G.jsx)(jP.DecrementButton,{}),(0,G.jsx)(jP.Input,{"aria-label":r(`maxInflight`)}),(0,G.jsx)(jP.IncrementButton,{})]})}),(0,G.jsx)(NM,{className:`text-caption leading-5 text-muted`,children:r(`maxInflightHint`)})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(jM,{className:`text-body font-medium text-muted`,children:r(`priority`)}),(0,G.jsx)(jP,{value:x,onChange:e=>S(e??50),minValue:1,maxValue:100,isDisabled:Ce,isRequired:!0,children:(0,G.jsxs)(jP.Group,{className:`w-full`,children:[(0,G.jsx)(jP.DecrementButton,{}),(0,G.jsx)(jP.Input,{"aria-label":r(`priority`)}),(0,G.jsx)(jP.IncrementButton,{})]})}),(0,G.jsx)(NM,{className:`text-caption leading-5 text-muted`,children:r(`priorityHint`)})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(jM,{className:`text-body font-medium text-muted`,children:r(`proxyUrl`)}),(0,G.jsx)(Rj,{fullWidth:!0,value:T,onChange:e=>E(e.target.value),placeholder:r(`proxyUrlPlaceholder`),"aria-label":r(`proxyUrl`),disabled:Ce}),(0,G.jsx)(NM,{className:`text-caption leading-5 text-muted`,children:r(`proxyUrlHint`)})]}),be?(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(jM,{className:`text-body font-medium text-muted`,children:r(`dropSystemPrompt`)}),(0,G.jsx)(NM,{className:`text-caption leading-5 text-muted`,children:r(he?.provider===`trae`?`dropSystemPromptTraeHint`:`dropSystemPromptCreateHint`)}),(0,G.jsx)(h7,{isSelected:C,isDisabled:Ce,ariaLabel:r(`dropSystemPrompt`),onChange:w})]}):null]}):null]}),He?(0,G.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`text-body font-medium text-muted`,children:r(`zhipuAccountMode`)}),(0,G.jsx)(v9,{ariaLabel:r(`zhipuAccountMode`),columns:2,value:j,onChange:e=>{Se||M(e)},options:[{value:`payg`,label:r(`zhipuModePayg`),hint:r(`zhipuModePaygHint`),disabled:Se},{value:`coding`,label:r(`zhipuModeCoding`),hint:r(`zhipuModeCodingHint`),disabled:Se}]})]}),(0,G.jsx)(_9,{label:r(`zhipuApiKey`),children:(0,G.jsx)(Rj,{type:`password`,value:N,onChange:e=>P(e.target.value),placeholder:r(`zhipuApiKeyPh`),"aria-label":r(`zhipuApiKey`),disabled:Se})}),j===`coding`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_9,{label:r(`zhipuOrganization`),children:(0,G.jsx)(Rj,{value:F,onChange:e=>I(e.target.value),placeholder:r(`zhipuOrganizationPh`),"aria-label":r(`zhipuOrganization`),disabled:Se})}),(0,G.jsx)(_9,{label:r(`zhipuProject`),children:(0,G.jsx)(Rj,{value:L,onChange:e=>ee(e.target.value),placeholder:r(`zhipuProjectPh`),"aria-label":r(`zhipuProject`),disabled:Se})})]}):null,B?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[we?(0,G.jsx)(Oi,{size:14,className:`shrink-0 text-success`}):null,(0,G.jsx)(`span`,{className:we?`font-medium text-foreground`:`text-muted`,children:B})]}):null]}):null,He?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(AV,{className:`mt-3`,value:o,onChange:e=>{!Se&&e!==o&&(s(e),V(``),te(``),re(!1))},ariaLabel:r(`authentication`),options:Ue.map(e=>({id:e.value,label:e.label}))}),(0,G.jsx)(`p`,{className:`mt-2 min-h-5 text-caption leading-5 text-muted`,children:We}),(0,G.jsx)(`div`,{className:`mt-3 flex flex-col gap-4`,children:o===`browser`?(0,G.jsxs)(G.Fragment,{children:[he?.provider===`codex`?(0,G.jsx)(v9,{ariaLabel:r(`codexLoginMethod`),columns:2,value:oe,onChange:e=>{Se||se(e)},options:[{value:`cli`,label:r(`codexLoginCli`),hint:r(`codexLoginCliHint`),disabled:Se||!!de.current},{value:`chatgpt`,label:r(`codexLoginChatGPT`),hint:r(`codexLoginChatGPTHint`),disabled:Se||!!de.current}]}):null,H?(0,G.jsxs)(`div`,{className:`card rounded-xl bg-surface px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-caption`,children:[(0,G.jsx)(yTe,{phase:R,busy:Se,tab:o,forTab:`browser`}),(0,G.jsx)(`span`,{className:`text-muted`,children:B||r(`loginOpenMsg`)})]}),(0,G.jsx)(`code`,{className:`mono mt-2 block break-all text-caption leading-5 text-foreground`,children:H}),(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,onPress:()=>window.open(H,`_blank`,`noopener,noreferrer`),children:[(0,G.jsx)(ni,{size:14}),r(`openAuthUrl`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>{Z7(H).then(e=>{e&&(re(!0),window.setTimeout(()=>re(!1),1100))})},children:[(0,G.jsx)(X7,{copied:ne}),r(ne?`copied`:`copy`)]})]})]}):null,B&&!H?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[we?(0,G.jsx)(Oi,{size:14,className:`shrink-0 text-success`}):null,(0,G.jsx)(`span`,{className:we?`font-medium text-foreground`:`text-muted`,children:B})]}):null,xe?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-caption leading-4 text-muted`,children:r(`wizardCallbackLead`)}),(0,G.jsx)(Uj,{className:`h-28 w-full resize-none font-mono text-caption leading-5`,value:ie,onChange:e=>ae(e.target.value),placeholder:r(`wizardCallbackPh`),"aria-label":r(`wizardCallbackPh`),disabled:we}),(0,G.jsx)(J,{size:`sm`,variant:`secondary`,isPending:R===`busy`&&!!ie.trim(),onPress:()=>void Fe(),isDisabled:we,children:r(`wizardSubmitCallback`)})]}):null]}):o===`pat`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_9,{label:r(`tabPat`),children:(0,G.jsx)(Rj,{type:`password`,value:D,onChange:e=>O(e.target.value),placeholder:r(`wizardPatPh`),"aria-label":r(`wizardPatPh`),disabled:Se})}),B?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[we?(0,G.jsx)(Oi,{size:14,className:`shrink-0 text-success`}):null,(0,G.jsx)(`span`,{className:we?`font-medium text-foreground`:`text-muted`,children:B})]}):null]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:`JSON`}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,onPress:ze,isDisabled:Se,children:[(0,G.jsx)(Xi,{size:13}),r(`wizardChooseFile`)]}),(0,G.jsx)(`input`,{ref:pe,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:Be})]}),(0,G.jsx)(Uj,{className:`min-h-32 font-mono text-caption`,value:k,onChange:e=>A(e.target.value),placeholder:r(`wizardImportPh`),"aria-label":r(`tabImport`),disabled:Se}),B?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[we?(0,G.jsx)(Oi,{size:14,className:`shrink-0 text-success`}):null,(0,G.jsx)(`span`,{className:we?`font-medium text-foreground`:`text-muted`,children:B})]}):null]})})]})]})})}),(0,G.jsxs)(Y.Footer,{className:`justify-end gap-2 px-5 pb-5`,children:[(0,G.jsx)(J,{variant:`ghost`,onPress:Ae,isDisabled:Se,children:r(`cancel`)}),i===`login`&&He?(0,G.jsx)(J,{isPending:R===`busy`,onPress:()=>void Ie(),isDisabled:we,children:we?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Oi,{size:15}),r(`wizardAccountReady`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ua,{size:15}),r(`zhipuCreate`)]})}):null,i===`login`&&!He&&o===`browser`?(0,G.jsx)(J,{isPending:Ve(`browser`),onPress:()=>void Pe(),isDisabled:we,children:we?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Oi,{size:15}),r(`wizardAccountReady`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ia,{size:15}),r(`wizardStartBrowser`)]})}):null,i===`login`&&!He&&o===`pat`?(0,G.jsx)(J,{isPending:Ve(`pat`),onPress:()=>void Le(),isDisabled:we,children:we?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Oi,{size:15}),r(`patDone`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ua,{size:15}),r(`wizardCreateAndLogin`)]})}):null,i===`login`&&!He&&o===`import`?(0,G.jsx)(J,{isPending:Ve(`import`),onPress:()=>void Re(),isDisabled:we,children:we?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Oi,{size:15}),r(`accountImported`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Xi,{size:15}),r(`importCredential`)]})}):null]})]})})})})}function E9({isOpen:e,title:t,description:n,confirmLabel:r,cancelLabel:i,closeLabel:a,isPending:o,status:s=`danger`,confirmVariant:c=`danger`,onClose:l,onConfirm:u}){return(0,G.jsx)(qb.Root,{isOpen:e,onOpenChange:e=>{!e&&!o&&l()},children:(0,G.jsx)(qb.Backdrop,{variant:`blur`,isDismissable:!o,children:(0,G.jsx)(qb.Container,{placement:`center`,size:`sm`,children:(0,G.jsxs)(qb.Dialog,{children:[(0,G.jsxs)(qb.Header,{className:`items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(qb.Icon,{status:s}),(0,G.jsx)(`div`,{children:(0,G.jsx)(qb.Heading,{children:t})})]}),(0,G.jsx)(qb.CloseTrigger,{isDisabled:o,"aria-label":a})]}),(0,G.jsx)(qb.Body,{children:(0,G.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:n})}),(0,G.jsxs)(qb.Footer,{children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isDisabled:o,onPress:l,children:i}),(0,G.jsx)(J,{size:`sm`,variant:c,isPending:o,onPress:u,children:r})]})]})})})})}function CTe(e,t){return e===`region_mixed`?t(`batchImportRegionMixed`):e===`region_unknown`?t(`batchImportRegionUnknown`):e===`unknown_format`?t(`batchImportUnknownFormat`):``}function wTe({isOpen:e,detection:t,fileName:n,isPending:r,t:i,onClose:a,onConfirm:o}){let[s,c]=(0,v.useState)(`cn`);(0,v.useEffect)(()=>{t&&(t.region===`cn`||t.region===`global`?c(t.region):c(`cn`))},[t]);let l=!!t?.batchImportSupported,u=t?.provider,d=t?.format||i(`batchImportFormatUnknown`),f=u?JV(u,i):i(`batchImportProviderUnknown`),p=(t?.warnings||[]).map(e=>CTe(e,i)).filter(Boolean);return(0,G.jsx)(Y.Root,{isOpen:e,onOpenChange:e=>{!e&&!r&&a()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,isDismissable:!r,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`md`,scroll:`inside`,className:`mx-3 w-full max-w-[min(100%,32rem)] sm:mx-0`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:i(`batchImportConfirmTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 break-all text-caption leading-5 text-muted`,children:n?i(`batchImportConfirmHint`,{file:n}):i(`batchImportConfirmHintNoFile`)})]}),(0,G.jsx)(Y.CloseTrigger,{isDisabled:r,"aria-label":i(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(yo,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`space-y-4 px-6 pb-2`,children:[(0,G.jsx)(`div`,{className:`rounded-xl bg-surface-secondary px-3.5 py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[u?(0,G.jsx)(XV,{provider:u,size:18}):null,(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-body font-medium text-foreground`,children:f}),(0,G.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:d})]})]})}),l?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-body font-medium text-muted`,children:i(`batchImportRegion`)}),(0,G.jsx)(AV,{value:s,onChange:e=>{(e===`cn`||e===`global`)&&c(e)},ariaLabel:i(`batchImportRegion`),options:[{id:`cn`,label:i(`accountTypeWorkBuddyCN`)},{id:`global`,label:i(`accountTypeWorkBuddyGlobal`)}]}),t?.regionAmbiguous?(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:i(`batchImportRegionPickHint`)}):null]}):(0,G.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:i(`batchImportProviderUnsupported`)}),p.length?(0,G.jsx)(`ul`,{className:`space-y-1 text-caption leading-5 text-muted`,children:p.map(e=>(0,G.jsx)(`li`,{children:e},e))}):null]}),(0,G.jsxs)(Y.Footer,{className:`flex-col-reverse gap-2 px-6 pb-6 sm:flex-row sm:justify-end`,children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,className:`w-full sm:w-auto`,isDisabled:r,onPress:a,children:i(l?`cancel`:`close`)}),l?(0,G.jsx)(J,{size:`sm`,className:`w-full sm:w-auto`,isPending:r,onPress:()=>o(s),children:i(`batchImportConfirmAction`)}):null]})]})})})})}var D9={"workbuddy-accounts":`workbuddy`,"workbuddy-oauth-v1":`workbuddy`,"qoder-native-v1":`qoder`,"trae-oauth-v1":`trae`,"devin-session-v1":`devin`,"command-key-v1":`command`,"codex-oauth-v1":`codex`,"zhipu-key-v1":`zhipu`,"qwenwork-oauth-v1":`qwenwork`,"meta-oauth-v1":`meta`,"meta-key-v1":`meta`},TTe=[`codebuddy.cn`,`workbuddy.cn`],ETe=[`workbuddy.ai`,`workbuddy.com`];function O9(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function k9(e){let t=e.trim();if(!t)return``;let n=t.toLowerCase();return n===`workbuddy-accounts`?`workbuddy-accounts`:n}function DTe(e){return typeof e.format==`string`&&e.format.trim()?k9(e.format):typeof e.exportType==`string`&&e.exportType.trim()?k9(e.exportType):``}function OTe(e){let t=[],n=e=>{typeof e==`string`&&e.trim()&&t.push(e.trim().toLowerCase())};if(n(e.domain),O9(e.account)&&n(e.account.domain),O9(e.auth)&&n(e.auth.domain),Array.isArray(e.accounts))for(let t of e.accounts)O9(t)&&(n(t.domain),O9(t.account)&&n(t.account.domain),O9(t.auth)&&n(t.auth.domain));return t}function kTe(e){return TTe.some(t=>e.includes(t))}function ATe(e){return ETe.some(t=>e.includes(t))}function A9(e){return typeof e.accessToken==`string`||typeof e.access_token==`string`||typeof e.refreshToken==`string`||typeof e.refresh_token==`string`}function jTe(e){if(!O9(e))return!1;if(A9(e)||typeof e.domain==`string`||typeof e.uid==`string`)return!0;if(O9(e.account)||O9(e.auth)){let t=O9(e.account)?e.account:null,n=O9(e.auth)?e.auth:null;if(n&&(A9(n)||typeof n.domain==`string`)||t&&(typeof t.uid==`string`||typeof t.domain==`string`))return!0}return!1}function MTe(e){let t=OTe(e);if(t.length===0)return{region:`cn`,ambiguous:!0,warning:`region_unknown`};let n=t.some(kTe),r=t.some(ATe);return n&&r?{region:null,ambiguous:!0,warning:`region_mixed`}:n?{region:`cn`,ambiguous:!1}:r?{region:`global`,ambiguous:!1}:{region:`cn`,ambiguous:!0,warning:`region_unknown`}}function NTe(e){return Array.isArray(e.accounts)&&e.accounts.some(jTe)?{format:`workbuddy-accounts`,provider:`workbuddy`,confidence:`medium`}:(typeof e.user_blob==`string`||typeof e.userBlob==`string`)&&(typeof e.machine_id==`string`||typeof e.machineId==`string`)?{format:`qoder-native-v1`,provider:`qoder`,confidence:`medium`}:typeof e.session_token==`string`||typeof e.sessionToken==`string`?{format:`devin-session-v1`,provider:`devin`,confidence:`low`}:A9(e)||O9(e.account)&&A9(e.account)||O9(e.auth)?{format:`workbuddy-oauth-v1`,provider:`workbuddy`,confidence:`low`}:typeof e.dca_token==`string`||typeof e.dcaToken==`string`||typeof e.access_token==`string`&&String(e.access_token).startsWith(`dca:`)||typeof e.accessToken==`string`&&String(e.accessToken).startsWith(`dca:`)?{format:`meta-oauth-v1`,provider:`meta`,confidence:`medium`}:typeof e.api_key==`string`||typeof e.apiKey==`string`?typeof e.organization==`string`||typeof e.project==`string`?{format:`zhipu-key-v1`,provider:`zhipu`,confidence:`low`}:typeof e.base_url==`string`&&String(e.base_url).includes(`meta.ai`)||typeof e.baseUrl==`string`&&String(e.baseUrl).includes(`meta.ai`)||typeof e.email==`string`?{format:`meta-key-v1`,provider:`meta`,confidence:`low`}:{format:`command-key-v1`,provider:`command`,confidence:`low`}:{format:null,provider:null,confidence:`low`}}function PTe(e){if(!O9(e))return{format:null,provider:null,region:null,regionAmbiguous:!0,confidence:`low`,warnings:[`not_object`],batchImportSupported:!1};let t=[],n=DTe(e),r=typeof e.format==`string`?e.format.trim():``,i=typeof e.exportType==`string`?e.exportType.trim():``,a=r||i,o=n||null,s=o?D9[o]??null:null,c=o&&s?`high`:`low`;if(!s){let r=NTe(e);o||=r.format,s=r.provider,c=n&&!D9[n]?`low`:r.confidence,a&&!D9[n]&&t.push(`unknown_format`)}s===`workbuddy`&&Array.isArray(e.accounts)&&(o=`workbuddy-accounts`);let l=null,u=!1;if(s===`workbuddy`){let n=MTe(e);l=n.region,u=n.ambiguous,n.warning&&t.push(n.warning)}return{format:o,provider:s,region:l,regionAmbiguous:u,confidence:c,warnings:t,batchImportSupported:s===`workbuddy`}}function FTe(e){let t;try{t=JSON.parse(e)}catch{throw Error(`bad_json`)}if(!O9(t))throw Error(`bad_json`);return t}var j9=`__all__`,ITe=[],M9=2;function LTe(){let{t:e}=JF(),[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(!0),d=s,f=d.length>0,[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(null),[O,k]=(0,v.useState)({}),[A,j]=(0,v.useState)({}),[M,N]=(0,v.useState)({}),[P,F]=(0,v.useState)({}),[I,L]=(0,v.useState)({}),[ee,R]=(0,v.useState)(null),[z,B]=(0,v.useState)(null),[V,H]=(0,v.useState)(null),[te,ne]=(0,v.useState)(null),[re,ie]=(0,v.useState)(null),[ae,oe]=(0,v.useState)(``),[se,ce]=(0,v.useState)(`all`),[le,ue]=(0,v.useState)(``),[de,fe]=(0,v.useState)(1),[pe,me]=(0,v.useState)(20),[he,ge]=(0,v.useState)({}),[_e,ve]=(0,v.useState)({}),[ye,be]=(0,v.useState)({}),[xe,Se]=(0,v.useState)({}),[Ce,we]=(0,v.useState)(!1),[Te,Ee]=(0,v.useState)(!1),De=(0,v.useCallback)(async(e=!1)=>{try{let t=(await nI(e)).data||ITe;return c(t),t}finally{u(!1)}},[]),Oe=(0,v.useCallback)(async(e,t=!0)=>{let n=[...new Set(e)];if(n.length)for(let e=0;e{try{let n=await nse(e,{quota:t});c(t=>t.map(t=>t.id===e?n:t))}catch(t){N(n=>({...n,[e]:t instanceof Error?t.message:String(t)}))}}))}},[]);(0,v.useEffect)(()=>{De(!1).catch(()=>void 0)},[De]),(0,v.useEffect)(()=>{let e=!0;return Promise.all([dI(),SI()]).then(([t,r])=>{e&&(n(t.data||[]),i(r))}).catch(t=>{e&&o(t instanceof Error?t.message:String(t))}),()=>{e=!1}},[]),(0,v.useEffect)(()=>{let e=!0;return De(!1).then(t=>{if(e)return Oe((t||[]).map(e=>e.id))}).catch(()=>void 0),()=>{e=!1}},[De,Oe]);function ke(e){return t.find(t=>t.id===e.provider)?.regions.find(t=>t.id===e.region)?.checkin}function Ae(e){let t=ke(e)?.timezone,n=t===`Local`?r?.timezone:t;if(!(!n||n===`Local`))try{return Intl.DateTimeFormat(`en-CA`,{timeZone:n}),n}catch{return}}let je=(0,v.useMemo)(()=>d.map(e=>{let t=he[e.id],n=_e[e.id],r=ye[e.id],i=xe[e.id],a=e;return t!==void 0&&(a={...a,enabled:t}),n!==void 0&&(a={...a,name:n}),r!==void 0&&(a={...a,max_inflight:r}),i!==void 0&&(a={...a,priority:i}),a}),[he,ye,_e,xe,d]),Me=(0,v.useMemo)(()=>{let e={all:je.length,available:0,attention:0,disabled:0};for(let t of je){let n=p9(t);n===`hot`||n===`ready`?e.available+=1:n===`disabled`&&(e.disabled+=1),t.enabled&&n!==`hot`&&n!==`ready`&&(e.attention+=1)}return e},[je]),Ne=(0,v.useMemo)(()=>{let e=new Map;for(let t of je){let n=String(t.provider||`qoder`).toLowerCase();e.set(n,(e.get(n)||0)+1)}return[...e.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))},[je]),Pe=je.find(e=>e.id===ee),Fe=je.find(e=>e.id===z)||null,Ie=je.find(e=>e.id===V)||null,Le=je.find(e=>e.id===te)||null,Re=(0,v.useMemo)(()=>{let e=ae.trim().toLowerCase();return je.filter(t=>{let n=p9(t);return!(se===`all`||se===`available`&&(n===`hot`||n===`ready`)||se===`attention`&&t.enabled&&n!==`hot`&&n!==`ready`||se===`disabled`&&n===`disabled`)||le&&String(t.provider||`qoder`).toLowerCase()!==le?!1:!e||[t.name,t.id,t.remote_uid,t.provider,t.auth_type].some(t=>String(t||``).toLowerCase().includes(e))})},[je,se,le,ae]),ze=[ae,se,le,pe].join(`\0`),[Be,Ve]=(0,v.useState)(ze);Be!==ze&&(Ve(ze),fe(1));let He=Math.max(1,Math.ceil(Re.length/pe)),Ue=Math.min(Be===ze?Math.max(1,de):1,He);de!==Ue&&fe(Ue);let We=(0,v.useMemo)(()=>{let e=(Ue-1)*pe;return Re.slice(e,e+pe)},[Ue,Re,pe]);if(l&&!f)return(0,G.jsx)(Mce,{});async function Ge(e,t,n){D({id:e,kind:t}),N(t=>({...t,[e]:``}));try{return await n(),!0}catch(t){return N(n=>({...n,[e]:t instanceof Error?t.message:String(t)})),!1}finally{D(null)}}async function Ke(t,n){ie(t),await Ge(t,`device`,async()=>{N(n=>({...n,[t]:e(`wizardStartingSession`)}));let r=await rI(t,n);r.authUrl&&L(e=>({...e,[t]:r.authUrl||``}));for(let n=0;n<60;n++){await new Promise(e=>window.setTimeout(e,2e3));let n=(await iI(t)).login||{};if(N(r=>({...r,[t]:n.message||e(`waitingQoderLogin`)})),n.status===`ok`||n.status===`error`)break}await De(!1),await Oe([t])})}async function qe(t){let n=(A[t]||``).trim();if(!n){N(n=>({...n,[t]:e(`wizardCallbackPh`)}));return}await Ge(t,`callback`,async()=>{N(n=>({...n,[t]:e(`wizardStartingSession`)})),await aI(t,n),j(e=>({...e,[t]:``})),await De(!1),await Oe([t])})&&(ie(e=>e===t?null:e),N(e=>({...e,[t]:``})))}async function Je(t){let n=(O[t]||``).trim();if(!n){N(n=>({...n,[t]:e(`pastePatFirst`)}));return}await Ge(t,`pat`,async()=>{N(n=>({...n,[t]:e(`wizardStartingSession`)})),await oI(n,t),k(e=>({...e,[t]:``})),await De(!1),await Oe([t])})}async function Ye(t){await Ge(t,`export`,async()=>{let n=await dse(t);await Z7(JSON.stringify(n,null,2)),N(n=>({...n,[t]:e(`credentialCopied`)}))})}async function Xe(e,t){ge(n=>({...n,[e]:t})),await Ge(e,`toggle`,async()=>{await pI(e,{enabled:t}),await De(!1)}),ge(t=>{let n={...t};return delete n[e],n})}async function Ze(t){pV({id:`refresh-${t}`,type:`loading`,title:e(`toastRefreshingAccount`)}),D({id:t,kind:`refresh`}),N(e=>{let n={...e};return delete n[t],n});try{await Oe([t]),pV({id:`refresh-${t}`,type:`success`,title:e(`toastAccountRefreshed`)})}catch(n){throw pV({id:`refresh-${t}`,type:`error`,title:e(`toastFailed`),description:n instanceof Error?n.message:String(n)}),n}finally{D(null)}}async function Qe(){we(!0),pV({id:`refresh-credits`,type:`loading`,title:e(`toastRefreshingCredits`)});try{await Oe(s.map(e=>e.id)),pV({id:`refresh-credits`,type:`success`,title:e(`toastCreditsRefreshed`)})}catch(t){throw pV({id:`refresh-credits`,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)}),t}finally{we(!1)}}function $e(){h||(y(!1),x(null),C(null),T(``))}async function et(t){let n=t.target.files?.[0];if(t.target.value=``,n)try{let t=FTe(await n.text()),r=PTe(t);if(!r.provider){pV({type:`error`,title:e(`batchImportUnrecognized`)});return}C(t),x(r),T(n.name),y(!0)}catch(t){let n=t instanceof Error?t.message:String(t);pV({type:`error`,title:e(n===`bad_json`?`wizardBadJson`:`batchImportUnrecognized`),description:n===`bad_json`?void 0:n})}}async function tt(t){if(!S||!b?.batchImportSupported||h)return;g(!0);let n=`batch-import-accounts`;pV({id:n,type:`loading`,title:e(`batchImportLoading`)});try{let{succeeded:r,failed:i,message:a}=S9(await hTe(S,{region:t}),e);pV({id:n,type:i>0&&r===0?`error`:i>0?`info`:`success`,title:a}),y(!1),x(null),C(null),T(``),r>0&&await De(!1)}catch(t){pV({id:n,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)})}finally{g(!1)}}async function nt(e,t){await Ge(e,`toggle`,async()=>{await pI(e,{auto_checkin:t}),await De(!1)})}function rt(e){let t=e.last_checkin_status;if(t!==`success`&&t!==`already`||!e.last_checkin_at)return!1;let n=new Date(e.last_checkin_at);if(Number.isNaN(n.getTime()))return!1;let r=Ae(e),i=e=>new Intl.DateTimeFormat(`en-CA`,{timeZone:r||void 0,year:`numeric`,month:`2-digit`,day:`2-digit`}).format(e);return i(n)===i(new Date)}async function it(){let t,n;try{t=je.filter(e=>e.enabled&&ke(e)),n=t.filter(e=>!rt(e))}catch(t){pV({id:`checkin-all`,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)});return}if(t.length===0){pV({id:`checkin-all`,type:`info`,title:e(`checkinAllEmpty`)});return}if(n.length===0){pV({id:`checkin-all`,type:`success`,title:e(`checkinAllDone`,{count:t.length})});return}pV({id:`checkin-all`,type:`loading`,title:e(`toastCheckingInAll`,{done:0,total:n.length})}),Ee(!0);let r={checked:0,skipped:t.length-n.length,failed:0};try{for(let t=0;t0&&await new Promise(e=>setTimeout(e,4e3));try{let i=await fI(n[t].id);r.checked+=1;let a=i?.last_checkin_status,o=i?.last_checkin_msg,s=a===`already`?`already`:a===`error`?`error`:`success`;F(r=>({...r,[n[t].id]:{kind:s,message:s===`error`?o||e(`checkinRecordFailed`):o}}))}catch(e){r.failed+=1,F(r=>({...r,[n[t].id]:{kind:`error`,message:e instanceof Error?e.message:String(e)}}))}tvoid 0)}}async function at(t){await Ge(t,`checkin`,async()=>{let n;try{n=await fI(t)}catch(e){F(n=>({...n,[t]:{kind:`error`,message:e instanceof Error?e.message:String(e)}})),await De(!1).catch(()=>void 0),await Oe([t]).catch(()=>void 0);return}let r=n?.last_checkin_status,i=n?.last_checkin_msg,a=r===`already`?`already`:r===`error`?`error`:`success`;F(n=>({...n,[t]:{kind:a,message:a===`error`?i||e(`checkinRecordFailed`):i}})),await De(!1).catch(()=>void 0),await Oe([t]).catch(()=>void 0)})}async function ot(t,n){if(!t)throw Error(e(`accountNameRequired`));ve(e=>({...e,[t]:n.name})),be(e=>({...e,[t]:n.max_inflight})),Se(e=>({...e,[t]:n.priority})),D({id:t,kind:`settings`});try{await pI(t,n),await De(!1)}catch(e){throw e instanceof Error?e:Error(String(e))}finally{D(null),ve(e=>{let n={...e};return delete n[t],n}),be(e=>{let n={...e};return delete n[t],n}),Se(e=>{let n={...e};return delete n[t],n})}}return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[a?(0,G.jsx)(xI,{title:a}):null,(0,G.jsxs)(`section`,{"data-gsap-reveal":!0,className:`flex flex-wrap items-center gap-2`,children:[d.length?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(AV,{value:se,onChange:e=>ce(e),ariaLabel:e(`accountStatusFilter`),options:[{id:`all`,label:(0,G.jsxs)(G.Fragment,{children:[e(`filterAll`),(0,G.jsx)(`span`,{className:`mono text-muted`,children:Me.all})]})},{id:`available`,label:(0,G.jsxs)(G.Fragment,{children:[e(`availableAccounts`),(0,G.jsx)(`span`,{className:`mono text-muted`,children:Me.available})]})},{id:`attention`,label:(0,G.jsxs)(G.Fragment,{children:[e(`needsAttention`),(0,G.jsx)(`span`,{className:`mono ${Me.attention?`text-danger`:`text-muted`}`,children:Me.attention})]})},{id:`disabled`,label:(0,G.jsxs)(G.Fragment,{children:[e(`disabled`),(0,G.jsx)(`span`,{className:`mono text-muted`,children:Me.disabled})]})}]}),(0,G.jsxs)(KP,{className:`w-48`,"aria-label":e(`providerFilterAll`),value:le||j9,onChange:e=>{typeof e==`string`&&ue(e===j9?``:e)},children:[(0,G.jsxs)(KP.Trigger,{className:`items-center`,children:[(0,G.jsx)(KP.Value,{className:`min-w-0 truncate`}),(0,G.jsx)(KP.Indicator,{})]}),(0,G.jsx)(KP.Popover,{children:(0,G.jsxs)(SP,{children:[(0,G.jsxs)(SP.Item,{id:j9,textValue:e(`providerFilterAll`),children:[(0,G.jsxs)(jM,{className:`flex items-center gap-2`,children:[e(`providerFilterAll`),(0,G.jsx)(`span`,{className:`mono text-muted`,children:d.length})]}),(0,G.jsx)(SP.ItemIndicator,{})]}),Ne.map(([t,n])=>(0,G.jsxs)(SP.Item,{id:t,textValue:JV(t,e),children:[(0,G.jsxs)(jM,{className:`flex items-center gap-2`,children:[(0,G.jsx)(XV,{provider:t,size:13}),JV(t,e),(0,G.jsx)(`span`,{className:`mono text-muted`,children:n})]}),(0,G.jsx)(SP.ItemIndicator,{})]},t))]})})]}),(0,G.jsx)(B7,{className:`w-full sm:w-60`,value:ae,onChange:oe,placeholder:e(`searchAccounts`),ariaLabel:e(`searchAccounts`)})]}):null,(0,G.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-end gap-2 sm:ml-auto sm:w-auto`,children:[(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:Te,isDisabled:Ce,onPress:()=>void it(),children:[(0,G.jsx)(fi,{size:14}),e(`checkinAll`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:Ce,isDisabled:Te,onPress:()=>void Qe(),children:[(0,G.jsx)(oi,{size:14}),e(`refreshCredits`)]}),(0,G.jsxs)(`label`,{htmlFor:`accounts-batch-import-file`,className:`button button--sm button--secondary inline-flex items-center gap-1.5 ${h||_?`pointer-events-none opacity-60`:`cursor-pointer`}`,children:[h?(0,G.jsx)(QB,{size:14,loading:!0}):(0,G.jsx)(uo,{size:14}),e(`batchImport`)]}),(0,G.jsx)(`input`,{id:`accounts-batch-import-file`,type:`file`,accept:`.json,application/json,text/json`,disabled:h||_,className:`sr-only`,onChange:e=>void et(e)}),(0,G.jsxs)(J,{size:`sm`,onPress:()=>m(!0),children:[(0,G.jsx)(Ma,{size:14}),e(`addAccount`)]})]})]}),(0,G.jsx)(STe,{isOpen:p,onClose:()=>m(!1),onAdded:()=>{pV({type:`success`,title:e(`toastAccountAdded`)}),De(!1)}}),(0,G.jsx)(wTe,{isOpen:_,detection:b,fileName:w,isPending:h,t:e,onClose:$e,onConfirm:e=>{tt(e)}}),(0,G.jsx)(rTe,{account:Fe,t:e,onClose:()=>B(null)},z??`closed`),(0,G.jsx)(tTe,{account:Ie,t:e,onClose:()=>H(null)},V??`closed`),(0,G.jsx)(sTe,{account:Le,checkinDefaultTime:Le&&ke(Le)?r?.checkin_times[Le.provider||``]:void 0,checkinTimezone:Le?Ae(Le):void 0,busy:!!(E&&E.id===te&&E.kind===`settings`),t:e,onClose:()=>ne(null),onSave:e=>ot(te||``,e)},te??`closed`),(0,G.jsx)(E9,{isOpen:!!Pe,title:e(`delete`),description:e(`deleteAccountConfirm`,{name:Pe?.name||Pe?.id||``}),confirmLabel:e(`delete`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:E?.id===ee&&E.kind===`delete`,onClose:()=>R(null),onConfirm:()=>{if(!Pe)return;let t=Pe.id;R(null),Ge(t,`delete`,async()=>{await use(t),await De(!1)}).then(t=>{t&&pV({type:`success`,title:e(`toastAccountDeleted`)})})}}),f?null:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(I7,{className:`rounded-3xl bg-surface-secondary`,icon:(0,G.jsx)(QB,{size:28}),title:e(`noAccounts`),hint:e(`accountEmptyHint`),action:(0,G.jsxs)(J,{size:`sm`,onPress:()=>m(!0),children:[(0,G.jsx)(Ma,{size:14}),e(`addAccount`)]})}),(0,G.jsx)(`div`,{className:`text-center`,children:(0,G.jsx)(e9,{})})]}),f&&!Re.length?(0,G.jsx)(I7,{className:`rounded-3xl bg-surface-secondary`,icon:(0,G.jsx)(va,{size:22}),title:e(`noAccountsMatch`),action:(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:()=>{oe(``),ce(`all`),ue(``)},children:e(`clearFilters`)})}):null,(0,G.jsx)(`section`,{className:`grid auto-rows-[minmax(280px,auto)] gap-2.5 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4`,children:We.map(t=>(0,G.jsx)(Qwe,{account:t,busyKind:E?.id===t.id?E.kind:``,authPanelOpen:re===t.id,authUrl:I[t.id],note:M[t.id],pat:O[t.id]||``,t:e,onPatChange:e=>k(n=>({...n,[t.id]:e})),callbackUrl:A[t.id]||``,onCallbackChange:e=>j(n=>({...n,[t.id]:e})),onSubmitCallback:()=>void qe(t.id),onDeviceLogin:e=>void Ke(t.id,e),onPatLogin:()=>void Je(t.id),onExport:()=>void Ye(t.id),onRefresh:()=>void Ze(t.id),onDelete:()=>R(t.id),onToggle:e=>void Xe(t.id,e),checkinDefaultTime:r?.checkin_times[t.provider||``],onToggleAutoCheckin:ke(t)?e=>void nt(t.id,e):void 0,onCheckin:ke(t)?()=>void at(t.id):void 0,checkinFeedback:P[t.id]??null,onViewCheckins:ke(t)?()=>H(t.id):void 0,onEdit:()=>ne(t.id),onToggleAuthPanel:()=>ie(e=>e===t.id?null:t.id),onViewModels:()=>B(t.id)},t.id))}),Re.length?(0,G.jsx)(z7,{total:Re.length,page:Ue,pageCount:He,pageSize:pe,pageSizes:owe,loading:!1,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:Ue,pages:He}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:fe,onPageSize:me}):null]})}function RTe(){let{t:e,lang:t,setLang:n}=JF(),{setApiKey:r}=ZF(),{overview:i,refresh:a}=gI(),{theme:o,toggleTheme:s}=yI(),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(``),g=at(),_=nt().state?.from||`/`,y=(0,v.useRef)(null);if(Bce(y,`login`),i)return(0,G.jsx)(At,{to:_===`/login`?`/`:_,replace:!0});async function b(t){t.preventDefault();let n=c.trim();if(!n){h(e(`loginNeedKey`));return}p(!0),h(``);try{r(n),await a(n),g(_===`/login`?`/`:_,{replace:!0})}catch(t){h(eI(t)?e(`loginBadKey`):t instanceof Error?t.message:String(t))}finally{p(!1)}}return(0,G.jsxs)(`div`,{className:`relative min-h-dvh overflow-hidden bg-background text-foreground`,children:[(0,G.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-border`}),(0,G.jsxs)(`main`,{ref:y,className:`relative z-10 mx-auto grid min-h-dvh w-full max-w-[1480px] lg:grid-cols-[minmax(0,1fr)_minmax(380px,30rem)]`,children:[(0,G.jsxs)(`section`,{className:`flex min-h-[52vh] flex-col px-5 py-6 sm:px-8 sm:py-8 lg:min-h-dvh lg:px-8 lg:py-10 xl:px-10`,children:[(0,G.jsxs)(`header`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(QB,{size:36}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-semibold`,children:`CLI2API`}),(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e(`controlPlane`)})]})]}),(0,G.jsxs)(yj,{isAttached:!0,children:[(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:()=>n(t===`zh`?`en`:`zh`),"aria-label":t===`zh`?`English`:`中文`,children:(0,G.jsx)(ia,{size:15})})}),(0,G.jsx)(Mj.Content,{children:t===`zh`?`English`:`中文`})]}),(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:s,"aria-label":o===`dark`?`Light mode`:`Dark mode`,children:o===`dark`?(0,G.jsx)(Qa,{size:15}):(0,G.jsx)(ba,{size:15})})}),(0,G.jsx)(Mj.Content,{children:o===`dark`?`Light mode`:`Dark mode`})]})]})]}),(0,G.jsx)(`div`,{className:`my-auto w-full py-8 lg:py-10`,children:(0,G.jsx)(w7,{t:e,defaultExpanded:!0,forceMockDemo:!0,bare:!0,live:null,mockPace:.45})}),(0,G.jsxs)(`footer`,{className:`hidden items-center justify-between text-caption text-muted lg:flex`,children:[(0,G.jsx)(`span`,{children:e(`loginHint`)}),(0,G.jsx)(`span`,{children:e(`routesHint`)})]})]}),(0,G.jsx)(`section`,{className:`flex items-center px-5 py-10 sm:px-8 lg:px-8 xl:px-10`,children:(0,G.jsx)(CS,{"data-gsap-reveal":!0,variant:`transparent`,className:`w-full bg-transparent p-0 shadow-none`,children:(0,G.jsxs)(`form`,{onSubmit:e=>void b(e),children:[(0,G.jsx)(CS.Header,{className:`px-2 py-6 sm:px-4`,children:(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,G.jsx)(QB,{size:28,loading:f}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(CS.Title,{className:`text-title`,children:e(`loginFormTitle`)}),(0,G.jsx)(CS.Description,{className:`mt-1`,children:e(`loginDesc`)})]})]})}),(0,G.jsxs)(CS.Content,{className:`space-y-5 px-6 py-7 sm:px-8 sm:py-8`,children:[(0,G.jsxs)(Wj,{name:`console-password`,className:`w-full`,isInvalid:!!m,children:[(0,G.jsx)(jM,{children:e(`loginPassword`)}),(0,G.jsxs)(Vj,{children:[(0,G.jsx)(Vj.Input,{id:`console-password`,type:u?`text`:`password`,value:c,onChange:e=>l(e.target.value),placeholder:e(`loginPasswordPh`),autoComplete:`current-password`,autoFocus:!0,"aria-label":e(`loginPassword`),spellCheck:!1}),(0,G.jsx)(Vj.Suffix,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,type:`button`,"aria-label":e(u?`hidePassword`:`showPassword`),onPress:()=>d(e=>!e),children:u?(0,G.jsx)(Ji,{size:16}):(0,G.jsx)(Ki,{size:16})})})]})]}),m?(0,G.jsx)(xI,{title:m}):(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:e(`loginHint`)}),(0,G.jsxs)(J,{type:`submit`,fullWidth:!0,size:`lg`,isPending:f,children:[e(f?`loggingInConsole`:`loginSubmit`),f?null:(0,G.jsx)(ei,{size:17})]})]})]})})})]})]})}function N9(){return tI(`/api/keys`)}function zTe(e){return tI(`/api/keys`,{method:`POST`,body:JSON.stringify(e)})}function P9(e,t){return tI(`/api/keys/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)})}function BTe(e){return tI(`/api/keys/${encodeURIComponent(e)}`,{method:`DELETE`})}function VTe(){return tI(`/api/system/console-key`)}function HTe(){return tI(`/api/system/console-key`,{method:`POST`,body:JSON.stringify({rotate:!0})})}function UTe({settings:e,onSaved:t}){let{t:n}=JF(),r=at(),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)({}),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``);(0,v.useEffect)(()=>{let e=!0;return dI().then(t=>{e&&a((t.data||[]).filter(e=>e.regions.some(e=>e.checkin)))}).catch(t=>{e&&d(String(t))}),()=>{e=!1}},[]);async function f(n,r){if(!(!e||r===e.checkin_times[n])){l(!0),d(``);try{t(await CI({checkin_times:{[n]:r}}))}catch(e){d(e instanceof Error?e.message:String(e))}finally{s(e=>{let t={...e};return delete t[n],t}),l(!1)}}}return(0,G.jsxs)(CS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(CS.Header,{children:[(0,G.jsx)(CS.Title,{children:n(`checkinDefaultsTitle`)}),(0,G.jsx)(CS.Description,{children:n(`checkinDefaultsHint`)})]}),(0,G.jsxs)(CS.Content,{className:`space-y-4`,children:[u?(0,G.jsx)(xI,{title:u}):null,!e||!i?(0,G.jsx)(Q,{className:`h-24 w-full`}):i.map(t=>(0,G.jsx)(_9,{label:t.label,hint:t.regions.filter(e=>e.checkin).map(t=>`${t.label} · ${t.checkin?.timezone===`Local`?e.timezone:t.checkin?.timezone}`).join(` / `),children:(0,G.jsx)(Rj,{type:`time`,value:o[t.id]??e.checkin_times[t.id]??``,disabled:c,"aria-label":`${t.label} ${n(`autoCheckinTime`)}`,onChange:e=>s(n=>({...n,[t.id]:e.target.value})),onBlur:e=>void f(t.id,e.target.value)})},t.id))]}),(0,G.jsx)(CS.Footer,{children:(0,G.jsx)(J,{variant:`secondary`,onPress:()=>r(`/accounts`),children:n(`navAccounts`)})})]})}function WTe(e,t){if(!e)return``;let n=new Date(e);return Number.isNaN(n.getTime())?``:n.toLocaleDateString(t===`zh`?`zh-CN`:`en-US`,{year:`numeric`,month:`short`,day:`numeric`})}function GTe({releases:e,currentVersion:t,nextVersion:n,rollbackTags:r,canRollback:i,submitting:a,onRestore:o}){let{t:s,lang:c}=JF();if(!e.length)return null;let l=n&&n!==t?n:t,u=e.some(e=>e.tag_name===l)?l:e[0]?.tag_name,d=new Set(r);return(0,G.jsxs)(`div`,{className:`mt-5`,children:[(0,G.jsx)(`div`,{className:`mb-2`,children:(0,G.jsx)(`p`,{className:`text-caption font-medium text-foreground`,children:s(`versionHistory`)})}),(0,G.jsx)(yh,{className:`rounded-lg bg-surface-secondary`,hideSeparator:!0,defaultExpandedKeys:u?[u]:[],children:e.map(e=>{let r=e.tag_name,l=r===t,u=!!(n&&r===n&&n!==t),f=i&&d.has(r)&&!l,p=WTe(e.published_at,c);return(0,G.jsxs)(yh.Item,{id:r,children:[(0,G.jsx)(yh.Heading,{children:(0,G.jsxs)(yh.Trigger,{className:`items-center gap-3 px-3 py-2.5 text-left`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`mono text-body font-semibold`,children:r}),l?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`success`,children:s(`versionCurrentBadge`)}):null,u?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`warning`,children:s(`versionLatestBadge`)}):null,p?(0,G.jsx)(`span`,{className:`truncate text-caption text-muted`,children:p}):null]}),(0,G.jsx)(yh.Indicator,{})]})}),(0,G.jsx)(yh.Panel,{children:(0,G.jsxs)(yh.Body,{className:`px-3 pb-3`,children:[(0,G.jsx)(`div`,{className:`release-notes-box release-notes-box--compact`,children:(0,G.jsx)(OI,{markdown:EI(e.body,c),emptyLabel:s(`updateNoNotes`)})}),f?(0,G.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isDisabled:a,onPress:()=>o(r),children:s(`restoreThisVersion`)})}):null]})})]},r)})})]})}function F9(e){let t=new Set,n=[];for(let r of e){let e=r.tag_name?.trim();!e||t.has(e)||(t.add(e),n.push({...r,tag_name:e}))}return n}function KTe(e,t,n,r,i){return r?.length?F9(r):F9([...n?[n]:t?[{tag_name:t}]:[],...e?[{tag_name:e}]:[],...i||[]])}var qTe=[`general`,`routing`,`security`,`updates`];function JTe(){let{t:e}=JF(),[t,n]=On(),r=t.get(`tab`),i=r&&qTe.includes(r)?r:`general`,a=e=>n(e===`general`?{}:{tab:e},{replace:!0}),{setApiKey:o}=ZF(),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(``),E=TI(),{info:D,loading:O,checking:k,submitting:A,error:j,setError:M,load:N,canRollback:P,rollbackTo:F}=E,I=(0,v.useMemo)(()=>KTe(D?.current_version||``,D?.next_version,D?.release,D?.recent_releases,D?.rollback_versions),[D?.current_version,D?.next_version,D?.release,D?.recent_releases,D?.rollback_versions]),L=(0,v.useMemo)(()=>(D?.rollback_versions||[]).map(e=>e.tag_name),[D?.rollback_versions]);(0,v.useEffect)(()=>{let e=window.setTimeout(()=>{VTe().then(c).catch(()=>void 0),SI().then(e=>{u(e),f(e.proxy_url||``)}).catch(e=>M(e instanceof Error?e.message:String(e)))},0);return()=>window.clearTimeout(e)},[M]);async function ee(e){let t=l?.cross_provider_model_pool??!0;u(t=>t&&{...t,cross_provider_model_pool:e}),m(!0),M(``);try{u(await CI({cross_provider_model_pool:e}))}catch(e){u(e=>e&&{...e,cross_provider_model_pool:t}),M(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function R(e){let t=l?.checkin_disabled_accounts??!1;u(t=>t&&{...t,checkin_disabled_accounts:e}),m(!0),M(``);try{u(await CI({checkin_disabled_accounts:e}))}catch(e){u(e=>e&&{...e,checkin_disabled_accounts:t}),M(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function z(e){let t=l?.proxy_url||``;if(e===t){f(t);return}let n=d;f(e),u(t=>t&&{...t,proxy_url:e}),m(!0),M(``);try{let t=await CI({proxy_url:e});u(t),f(t.proxy_url||``)}catch(e){f(n),u(e=>e&&{...e,proxy_url:t}),M(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function B(e){let t=l?.routing_strategy||`round-robin`;u(t=>t&&{...t,routing_strategy:e}),m(!0),M(``);try{u(await CI({routing_strategy:e}))}catch(e){u(e=>e&&{...e,routing_strategy:t}),M(e instanceof Error?e.message:String(e))}finally{m(!1)}}return O&&!D?(0,G.jsx)(zce,{}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:e(`systemSettingsTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`systemSettingsLead`)})]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:k,onPress:()=>void N(!0),children:[(0,G.jsx)(Qr,{size:15}),e(`checkUpdates`)]})]}),j?(0,G.jsx)(xI,{title:j}):null,(0,G.jsxs)(OA,{selectedKey:i,onSelectionChange:e=>a(String(e)),children:[(0,G.jsx)(OA.ListContainer,{className:`w-fit max-w-full overflow-x-auto`,children:(0,G.jsxs)(OA.List,{"aria-label":e(`systemSettingsTitle`),children:[(0,G.jsxs)(DA,{id:`general`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{}),(0,G.jsx)(na,{size:13}),e(`settingsTabGeneral`)]}),(0,G.jsxs)(DA,{id:`routing`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{}),(0,G.jsx)(ci,{size:13}),e(`settingsTabRouting`)]}),(0,G.jsxs)(DA,{id:`security`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{}),(0,G.jsx)(Ia,{size:13}),e(`settingsTabSecurity`)]}),(0,G.jsxs)(DA,{id:`updates`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{}),(0,G.jsx)(Xr,{size:13}),e(`settingsTabUpdates`)]})]})}),(0,G.jsx)(OA.Panel,{id:`general`,className:`pt-5`,children:(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,G.jsxs)(CS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Ha,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`proxySettingsTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`proxySettingsHint`)})]})]}),(0,G.jsxs)(`div`,{className:`mt-4 space-y-1.5`,children:[(0,G.jsx)(jM,{className:`text-body font-medium text-muted`,children:e(`proxyUrl`)}),(0,G.jsx)(Rj,{value:d,onChange:e=>f(e.target.value),onBlur:e=>void z(e.target.value.trim()),placeholder:e(`proxyUrlPlaceholder`),disabled:p||!l}),(0,G.jsx)(NM,{className:`text-caption leading-5 text-muted`,children:e(`proxyUrlHint`)})]})]}),(0,G.jsxs)(CS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Oi,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`checkinDisabledAccountsTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`checkinDisabledAccountsHint`)})]})]}),(0,G.jsx)(h7,{isSelected:l?.checkin_disabled_accounts??!1,isDisabled:p||!l,ariaLabel:e(`checkinDisabledAccountsAriaLabel`),onChange:e=>void R(e)})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between pt-3 text-caption text-muted`,children:[(0,G.jsx)(`span`,{children:e(`checkinDisabledAccountsStatus`)}),(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:l?.checkin_disabled_accounts?e(`enabled`):e(`disabled`)})]})]}),(0,G.jsx)(UTe,{settings:l,onSaved:u})]})}),(0,G.jsx)(OA.Panel,{id:`routing`,className:`pt-5`,children:(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,G.jsxs)(CS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Ha,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`routingStrategyTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`routingStrategyHint`)})]})]}),(0,G.jsx)(`div`,{className:`mt-4 pt-4`,children:(0,G.jsx)(_9,{label:e(`routingStrategy`),children:(0,G.jsxs)(KP,{fullWidth:!0,"aria-label":e(`routingStrategy`),value:l?.routing_strategy||`round-robin`,isDisabled:p||!l,onChange:e=>{typeof e==`string`&&e&&B(e)},children:[(0,G.jsxs)(KP.Trigger,{className:`items-center`,children:[(0,G.jsx)(KP.Value,{className:`min-w-0 truncate`}),(0,G.jsx)(KP.Indicator,{})]}),(0,G.jsx)(KP.Popover,{children:(0,G.jsxs)(SP,{children:[(0,G.jsxs)(SP.Item,{id:`round-robin`,textValue:`round-robin`,children:[(0,G.jsx)(jM,{children:e(`routingRoundRobin`)}),(0,G.jsx)(SP.ItemIndicator,{})]}),(0,G.jsxs)(SP.Item,{id:`weighted-round-robin`,textValue:`weighted-round-robin`,children:[(0,G.jsx)(jM,{children:e(`routingWeightedRoundRobin`)}),(0,G.jsx)(SP.ItemIndicator,{})]}),(0,G.jsxs)(SP.Item,{id:`fill-first`,textValue:`fill-first`,children:[(0,G.jsx)(jM,{children:e(`routingFillFirst`)}),(0,G.jsx)(SP.ItemIndicator,{})]}),(0,G.jsxs)(SP.Item,{id:`fefo`,textValue:`fefo`,children:[(0,G.jsx)(jM,{children:e(`routingFEFO`)}),(0,G.jsx)(SP.ItemIndicator,{})]})]})})]})})}),(0,G.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2 pt-3 text-caption text-muted sm:grid-cols-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:l?.session_affinity?.ttl_seconds?`${Math.round(l.session_affinity.ttl_seconds/60)}m`:`—`}),e(`sessionAffinityTTL`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:l?.session_affinity?.hits??0}),e(`sessionAffinityHits`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:l?.session_affinity?.misses??0}),e(`sessionAffinityMisses`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:l?.session_affinity?.escapes??0}),e(`sessionAffinityEscapes`)]})]}),l?.session_affinity?.last_escape_reason?(0,G.jsxs)(NM,{className:`mt-3 text-caption`,children:[e(`lastSessionEscape`),`: `,l.session_affinity.last_escape_reason]}):null,l?.session_affinity?.last_miss_reason?(0,G.jsxs)(NM,{className:`mt-1 text-caption`,children:[e(`lastSessionMiss`),`: `,l.session_affinity.last_miss_reason]}):null]}),(0,G.jsxs)(CS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Ha,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`crossProviderModelPoolTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`crossProviderModelPoolHint`)})]})]}),(0,G.jsx)(h7,{isSelected:l?.cross_provider_model_pool??!0,isDisabled:p||!l,ariaLabel:e(`crossProviderModelPoolAriaLabel`),onChange:e=>void ee(e)})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between pt-3 text-caption text-muted`,children:[(0,G.jsx)(`span`,{children:e(`crossProviderModelPoolStatus`)}),(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:l?.cross_provider_model_pool?e(`enabled`):e(`disabled`)})]})]})]})}),(0,G.jsx)(OA.Panel,{id:`security`,className:`pt-5`,children:(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,G.jsxs)(CS,{"data-gsap-reveal":!0,children:[(0,G.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(ua,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`consoleKeyTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`consoleKeyHint`)})]})]})}),(0,G.jsx)(`code`,{className:`mono mt-4 block rounded-lg bg-surface-secondary px-3 py-2 text-caption text-muted`,children:s?.prefix||`—`}),(0,G.jsx)(`p`,{className:`mt-3 text-caption leading-5 text-muted`,children:e(`consoleKeyLead`)}),(0,G.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isPending:h,onPress:()=>y(!0),children:e(`consoleKeyRotate`)})})]}),(0,G.jsxs)(CS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Hi,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`sqliteProtection`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`sqliteProtectionHint`)})]})]}),(0,G.jsx)(Ia,{size:18,className:`text-success`})]}),(0,G.jsx)(`div`,{className:`mono mt-4 rounded-lg bg-surface-secondary px-3 py-2 text-caption text-muted`,children:`/data`}),(0,G.jsxs)(`div`,{className:`mt-3 grid gap-2 text-caption text-muted`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Oi,{size:14,className:`text-muted`}),e(`sqliteBackupBeforeUpdate`)]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Oi,{size:14,className:`text-muted`}),e(`sqliteKeepFive`)]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Oi,{size:14,className:`text-muted`}),e(`sqliteRollbackTogether`)]})]})]})]})}),(0,G.jsx)(OA.Panel,{id:`updates`,className:`pt-5`,children:(0,G.jsx)(`div`,{className:`grid gap-5`,children:(0,G.jsxs)(CS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`versionUpdate`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:e(`latestVersionHint`)})]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:D?.has_update?`warning`:`success`,children:D?.has_update?e(`updateAvailable`):e(`upToDate`)})]}),(0,G.jsxs)(`div`,{className:`px-5 py-5`,children:[(0,G.jsx)(bI,{update:E}),(0,G.jsx)(GTe,{releases:I,currentVersion:D?.current_version||``,nextVersion:D?.next_version,rollbackTags:L,canRollback:P,submitting:A,onRestore:T})]})]})})})]}),(0,G.jsx)(E9,{isOpen:!!w,title:e(`restoreVersionTitle`,{version:w}),description:e(`restoreVersionHint`),confirmLabel:e(`restoreThisVersion`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:A,status:`warning`,confirmVariant:`primary`,onClose:()=>{A||T(``)},onConfirm:()=>{let e=w;T(``),F(e)}}),(0,G.jsx)(Y.Root,{isOpen:_,onOpenChange:e=>{!e&&!h&&y(!1)},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,isDismissable:!h,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`sm`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`consoleKeyRotate`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`consoleKeyRotateHint`)})]}),(0,G.jsx)(Y.CloseTrigger,{isDisabled:h,"aria-label":e(`close`),className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(yo,{size:16})})]}),(0,G.jsxs)(Y.Footer,{className:`justify-end`,children:[(0,G.jsx)(J,{variant:`ghost`,isDisabled:h,onPress:()=>y(!1),children:e(`cancel`)}),(0,G.jsx)(J,{variant:`danger`,isPending:h,onPress:()=>{g(!0),HTe().then(e=>{c(e),x(e.secret||``),e.secret&&o(e.secret),y(!1)}).catch(e=>{M(e instanceof Error?e.message:String(e))}).finally(()=>g(!1))},children:e(`consoleKeyRotateNow`)})]})]})})})}),(0,G.jsx)(Y.Root,{isOpen:!!b,onOpenChange:e=>{e||x(``)},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`lg`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`consoleKeySecretTitle`)}),(0,G.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:e(`consoleKeySecretHint`)})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":e(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(yo,{size:18})})]}),(0,G.jsx)(Y.Body,{className:`px-6 pb-2`,children:(0,G.jsx)(`code`,{className:`mono block break-all rounded-lg bg-surface-secondary px-3 py-3 text-body`,children:b})}),(0,G.jsxs)(Y.Footer,{className:`justify-end`,children:[(0,G.jsx)(J,{variant:`ghost`,onPress:()=>x(``),children:e(`close`)}),(0,G.jsxs)(J,{onPress:()=>{Z7(b),C(!0),window.setTimeout(()=>C(!1),1200)},children:[(0,G.jsx)(Ii,{size:14}),e(S?`copied`:`copy`)]})]})]})})})})]})}var I9=`__all__`;function YTe(e,t){let n=t.trim().toLowerCase();return!n||e.label.toLowerCase().includes(n)||e.id.toLowerCase().includes(n)}function L9({value:e,onChange:t,ariaLabel:n,options:r,allLabel:i,searchPlaceholder:a,emptyLabel:o,loadOptions:s,className:c}){let[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)([]),[p,m]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(!s)return;let e=!1,t=window.setTimeout(()=>{m(!0),s(l.trim()).then(t=>{e||f(t)}).catch(()=>{e||f([])}).finally(()=>{e||m(!1)})},l.trim()?280:0);return()=>{e=!0,window.clearTimeout(t)}},[s,l]);let h=e||I9,g=(0,v.useMemo)(()=>{let t=s?d:r.filter(e=>YTe(e,l)),n=new Map;l.trim()||n.set(I9,{id:I9,label:i});for(let e of t)!e.id||e.id===I9||n.set(e.id,e);if(e){let t=r.find(t=>t.id===e)||d.find(t=>t.id===e)||{id:e,label:e};n.set(e,t)}return[...n.values()]},[i,s,r,l,d,e]),_=g.find(e=>e.id===h)||(e?{id:e,label:e}:{id:I9,label:i});return(0,G.jsxs)(mS,{className:[`w-fit`,c].filter(Boolean).join(` `),"aria-label":n,value:h,onChange:e=>{typeof e==`string`&&(t(e===I9?``:e),u(``))},onClear:()=>{t(``),u(``)},children:[(0,G.jsxs)(mS.Trigger,{className:`min-w-44 items-center`,children:[(0,G.jsx)(mS.Value,{className:`min-w-0 truncate`,children:({defaultChildren:e,isPlaceholder:t})=>t?e:(0,G.jsx)(`span`,{className:`truncate`,children:_.label})}),e?(0,G.jsx)(mS.ClearButton,{}):null,(0,G.jsx)(mS.Indicator,{})]}),(0,G.jsx)(mS.Popover,{className:`min-w-56`,children:(0,G.jsxs)(mS.Filter,{inputValue:l,onInputChange:u,filter:()=>!0,children:[(0,G.jsx)(kM,{"aria-label":a,className:`px-2 pt-2`,autoFocus:!0,children:(0,G.jsxs)(kM.Group,{children:[(0,G.jsx)(kM.SearchIcon,{}),(0,G.jsx)(kM.Input,{placeholder:a}),(0,G.jsx)(kM.ClearButton,{})]})}),(0,G.jsx)(SP,{children:g.length===0?(0,G.jsx)(SP.Item,{id:`__empty__`,textValue:o,isDisabled:!0,children:(0,G.jsx)(jM,{className:`block truncate text-muted`,children:p?a:o})}):g.map(e=>(0,G.jsxs)(SP.Item,{id:e.id,textValue:e.label,children:[(0,G.jsx)(jM,{className:`block truncate`,children:e.label}),e.id!==I9&&e.id!==e.label?(0,G.jsx)(`span`,{className:`mono mt-0.5 block truncate text-caption text-muted`,children:e.id}):null,(0,G.jsx)(SP.ItemIndicator,{})]},e.id))})]})})]})}function R9(){let[e,t]=(0,v.useState)([]);return(0,v.useEffect)(()=>{let e=!1;return N9().then(n=>{e||t(n.data||[])}).catch(()=>{}),()=>{e=!0}},[]),{keys:e,nameById:(0,v.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.id,n.name||n.id);return t},[e]),options:(0,v.useMemo)(()=>e.map(e=>({id:e.id,label:e.name||e.id})),[e])}}function z9(e){return e===`ok`?`success`:e===`streaming`||e===`started`||e===`incomplete`?`warning`:e===`error`||e===`canceled`?`danger`:`default`}function XTe(e){if(e===`error`)return`danger`;if(e!==`warn`)return`ok`}function ZTe(e){return e===`error`?`danger`:e===`warn`?`warning`:e===`info`?`success`:`default`}function B9(e,t=`zh`){if(!e)return`—`;let n=new Date(e);return Number.isFinite(n.getTime())?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).format(n):e}function V9(e){let t=e.requested_reasoning?.trim()||``,n=e.resolved_reasoning?.trim()||``;return!t&&!n?``:t&&n&&t!==n?`${t} → ${n}`:n||t}function H9({log:e,inLabel:t,outLabel:n,pointsLabel:r}){let i=e.prompt_tokens,a=e.completion_tokens,o=e.credits??e.usage_detail?.credit,s=o!=null&&Number.isFinite(o)?U9(o):null;return i==null&&a==null&&s==null?(0,G.jsx)(`span`,{className:`mono text-xs text-muted`,children:`—`}):(0,G.jsxs)(`div`,{className:`leading-4`,children:[i!=null||a!=null?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`mono text-xs`,children:[i??0,` / `,a??0]}),(0,G.jsxs)(`div`,{className:`mt-0.5 text-caption text-muted`,children:[t,` / `,n]})]}):null,s==null?null:(0,G.jsx)(`div`,{className:`mono text-caption text-success ${i!=null||a!=null?`mt-0.5`:``}`,children:r?r(s):s})]})}function QTe(){return(0,G.jsxs)(`div`,{className:`space-y-5`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,G.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:Array.from({length:8},(e,t)=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(Q,{className:`h-3 w-20`}),(0,G.jsx)(Q,{className:`h-5 w-36 max-w-full`})]},t))}),(0,G.jsxs)(`div`,{className:`space-y-3 rounded-lg bg-surface-secondary px-3 py-3`,children:[(0,G.jsx)(Q,{className:`h-3 w-24`}),(0,G.jsx)(Q,{className:`h-4 w-full`}),(0,G.jsx)(Q,{className:`h-4 w-4/5`})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(Q,{className:`h-3 w-20`}),(0,G.jsx)(Q,{className:`h-16 w-full`})]})]})}function U9(e){return e==null||!Number.isFinite(e)?`—`:String(Math.round(e*1e4)/1e4)}var $Te=[`all`,`ok`,`incomplete`,`error`,`canceled`],eEe=[`all`,`quota`,`rate_limit`,`auth`,`not_ready`,`unavailable`,`invalid_request`,`model_not_available`],tEe=[`all`,`1h`,`24h`,`7d`,`custom`];function W9(e){let t=(e,t,n)=>t.includes(e??``)?e:n,n=MV(e.get(`from`)),r=MV(e.get(`to`)),i=n&&r?{start:n,end:r}:null,a=e.get(`stream`);return{requestFilter:t(e.get(`status`),$Te,`all`),requestId:e.get(`id`)??``,accountFilter:e.get(`account`)??``,apiKeyFilter:e.get(`api_key`)??``,modelFilter:e.get(`model`)??``,providerFilter:e.get(`provider`)??``,streamFilter:a===`stream`||a===`true`?`stream`:a===`sync`||a===`false`?`sync`:`all`,errorKind:t(e.get(`error_kind`),eEe,`all`),timeRange:i?`custom`:t(e.get(`range`),tEe,`1h`),customRange:i}}function nEe(e){let t=new URLSearchParams;e.requestFilter!==`all`&&t.set(`status`,e.requestFilter),e.requestId&&t.set(`id`,e.requestId),e.accountFilter&&t.set(`account`,e.accountFilter),e.apiKeyFilter&&t.set(`api_key`,e.apiKeyFilter),e.modelFilter&&t.set(`model`,e.modelFilter),e.providerFilter&&t.set(`provider`,e.providerFilter),e.streamFilter!==`all`&&t.set(`stream`,e.streamFilter),e.errorKind!==`all`&&t.set(`error_kind`,e.errorKind);let n=e.timeRange===`custom`?jV(e.customRange?.start):void 0,r=e.timeRange===`custom`?jV(e.customRange?.end,!0):void 0;return n&&r?(t.set(`from`,n),t.set(`to`,r)):e.timeRange!==`1h`&&t.set(`range`,e.timeRange),t.toString()}function rEe(e){if(e===`all`||e===`custom`)return{from:void 0,to:void 0};let t=new Date,n=new Date(t);return e===`1h`&&n.setHours(n.getHours()-1),e===`24h`&&n.setHours(n.getHours()-24),e===`7d`&&n.setDate(n.getDate()-7),{from:n.toISOString(),to:t.toISOString()}}function iEe(){let{t:e,lang:t}=JF(),[n,r]=On(),[i]=(0,v.useState)(()=>W9(new URLSearchParams(window.location.search))),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(`requests`),[d,f]=(0,v.useState)(!0),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(i.requestFilter),[b,x]=(0,v.useState)(`all`),[S,C]=(0,v.useState)(i.requestId),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(i.accountFilter),[O,k]=(0,v.useState)(i.apiKeyFilter),[A,j]=(0,v.useState)(``),[M,N]=(0,v.useState)(i.modelFilter),[P,F]=(0,v.useState)(i.providerFilter),[I,L]=(0,v.useState)(i.streamFilter),[ee,R]=(0,v.useState)(i.errorKind),[z,B]=(0,v.useState)(i.timeRange),[V,H]=(0,v.useState)(i.customRange),[te,ne]=(0,v.useState)(1),[re,ie]=(0,v.useState)(50),[ae,oe]=(0,v.useState)(1),[se,ce]=(0,v.useState)(50),[le,ue]=(0,v.useState)([]),[de,fe]=(0,v.useState)(0),[pe,me]=(0,v.useState)([]),[he,ge]=(0,v.useState)(0),[_e,ve]=(0,v.useState)(null),[ye,be]=(0,v.useState)(!1),[xe,Se]=(0,v.useState)(null),[Ce,we]=(0,v.useState)(!1),[Te,Ee]=(0,v.useState)(!1),[De,Oe]=(0,v.useState)(``),ke=(0,v.useRef)(0),[Ae,je]=(0,v.useState)(!1),[Me,Ne]=(0,v.useState)(!1),Pe=n.toString(),Fe=nEe({requestFilter:_,requestId:S,accountFilter:E,apiKeyFilter:O,modelFilter:M,providerFilter:P,streamFilter:I,errorKind:ee,timeRange:z,customRange:V}),Ie=(0,v.useRef)(Pe);(0,v.useEffect)(()=>{if(Pe===Ie.current)return;Ie.current=Pe;let e=W9(new URLSearchParams(Pe));y(e.requestFilter),C(e.requestId),D(e.accountFilter),k(e.apiKeyFilter),N(e.modelFilter),F(e.providerFilter),L(e.streamFilter),R(e.errorKind),B(e.timeRange),H(e.customRange)},[Pe]),(0,v.useEffect)(()=>{Fe!==Ie.current&&(Ie.current=Fe,r(Fe,{replace:!0}))},[Fe,r]),(0,v.useEffect)(()=>{let e=!1;return Promise.allSettled([nI(!1),lI()]).then(([t,n])=>{e||(t.status===`fulfilled`&&o(t.value.data||[]),n.status===`fulfilled`&&c(n.value.data||[]))}),()=>{e=!0}},[]);let Le=(0,v.useMemo)(()=>{let e=new Map;for(let t of a||[])e.set(t.id,t.name||t.id);return e},[a]),Re=(0,v.useMemo)(()=>{let e=new Map;for(let t of a||[])e.set(t.id,{provider:t.provider,region:t.region});return e},[a]);function ze(t){let n=t.account_id?Re.get(t.account_id):void 0,r=t.provider||n?.provider;return r?YV(r,n?.region,e):`—`}function Be(t){switch(t){case`pin`:return e(`logsRouting_pin`);case`sticky`:return e(`logsRouting_sticky`);case`sticky_escape`:return e(`logsRouting_sticky_escape`);default:return e(`logsRouting_pool`)}}let Ve=(0,v.useMemo)(()=>(a||[]).map(e=>({id:e.id,label:e.name||e.id})),[a]),{nameById:He,options:Ue}=R9();function We(e){let t=e.api_key_id?.trim();return t?He.get(t)||t:`—`}let Ge=(0,v.useMemo)(()=>{let t=new Set;for(let e of a||[])e.provider&&t.add(e.provider);return P&&t.add(P),[{id:``,label:e(`logsFilterProviderAll`)},...[...t].sort().map(t=>({id:t,label:JV(t,e)}))]},[a,P,e]),Ke=(0,v.useMemo)(()=>{let e=new Map;for(let t of s||[])e.has(t.id)||e.set(t.id,{id:t.id,label:t.display_name||t.id});return[...e.values()]},[s]),qe=(0,v.useCallback)(async e=>((await hV({q:e||void 0,limit:20,offset:0})).items||[]).map(e=>({id:e.id,label:e.id})),[]),Je=!!(S||_!==`all`||E||O||M||P||I!==`all`||ee!==`all`||z!==`1h`),Ye=[_,S,E,O,M,P,I,ee,z,V?.start?.toString()??``,V?.end?.toString()??``,re].join(`\0`),Xe=[b,w,A,se].join(`\0`),[Ze,Qe]=(0,v.useState)(Ye),[$e,et]=(0,v.useState)(Xe);Ze!==Ye&&(Qe(Ye),ne(1)),$e!==Xe&&(et(Xe),oe(1));let tt=Math.max(1,Math.ceil(de/re)),nt=Math.min(Ze===Ye?Math.max(1,te):1,tt);te!==nt&&ne(nt);let rt=Math.max(1,Math.ceil(he/se)),it=Math.min($e===Xe?Math.max(1,ae):1,rt);ae!==it&&oe(it);let at=(0,v.useCallback)(async(e=!1)=>{e||f(!0);try{let e=S?{from:void 0,to:void 0}:z===`custom`?{from:jV(V?.start),to:jV(V?.end,!0)}:rEe(z),t=await hV({status:_===`all`?void 0:_,id:S||void 0,account:E||void 0,api_key:O||void 0,model:M||void 0,provider:P||void 0,stream:I===`all`?void 0:I===`stream`,error_kind:ee===`all`?void 0:ee,from:e.from,to:e.to,limit:re,offset:(nt-1)*re});ue(t.items||[]),fe(t.total||0),g(``)}catch(t){e||g(t instanceof Error?t.message:String(t))}finally{e||(f(!1),m(!0))}},[_,S,E,O,M,P,I,ee,z,V,nt,re]),ot=(0,v.useCallback)(async(e=!1)=>{e||f(!0);try{let e=await ile({level:b===`all`?void 0:b,q:w.trim()||void 0,account:A||void 0,limit:se,offset:(it-1)*se});me(e.items||[]),ge(e.total??0),g(``)}catch(t){e||g(t instanceof Error?t.message:String(t))}finally{e||(f(!1),m(!0))}},[b,w,A,it,se]),st=(0,v.useCallback)(async(e=!1)=>{l===`requests`?await at(e):await ot(e)},[l,at,ot]);(0,v.useEffect)(()=>{f(!0);let e=l===`runtime`&&w.trim()?280:0,t=window.setTimeout(()=>void st(!1),e);return()=>window.clearTimeout(t)},[st,l,w]),(0,v.useEffect)(()=>{if(l!==`runtime`||it!==1)return;let e=window.setInterval(()=>void ot(!0),3e3);return()=>window.clearInterval(e)},[l,it,ot]);let ct=de===0?0:(nt-1)*re+1,lt=Math.min(de,nt*re),ut=he===0?0:(it-1)*se+1,dt=Math.min(he,it*se),ft=(0,v.useMemo)(()=>l===`requests`?e(`logsShownTotal`,{shown:le.length?`${ct}–${lt}`:0,total:de}):e(`logsShownTotal`,{shown:pe.length?`${ut}–${dt}`:0,total:he}),[l,le.length,pe.length,ct,lt,de,ut,dt,he,e]);function pt(){C(``),y(`all`),D(``),k(``),N(``),F(``),L(`all`),R(`all`),B(`1h`),H(null),ne(1)}async function mt(e){let t=++ke.current;Se(e),Oe(``),Ee(!0),we(!0);try{let n=await nle(e.id);if(ke.current!==t)return;Se(n)}catch(e){if(ke.current!==t)return;Oe(e instanceof Error?e.message:String(e))}finally{ke.current===t&&Ee(!1)}}function ht(e){ve(e),be(!0)}async function gt(){Ne(!0),pV({id:`logs-clear`,type:`loading`,title:e(`toastClearingLogs`)});try{await rle(),je(!1),await at(!1),pV({id:`logs-clear`,type:`success`,title:e(`toastLogsCleared`)})}catch(t){g(t instanceof Error?t.message:String(t)),pV({id:`logs-clear`,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)})}finally{Ne(!1)}}let _t=d&&(l===`requests`?le.length===0:pe.length===0);return d&&!p?(0,G.jsx)(Lce,{}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`navLogs`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`logsLead`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l===`requests`?(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>je(!0),isDisabled:Me||de===0,children:[(0,G.jsx)(io,{size:14}),e(`logsClear`)]}):null,(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:d,onPress:()=>void st(!1),children:[(0,G.jsx)(Qr,{size:15}),e(`refresh`)]})]})]}),h?(0,G.jsx)(xI,{title:e(`failedLogs`,{msg:h})}):null,(0,G.jsxs)(OA,{selectedKey:l,onSelectionChange:e=>u(String(e)),children:[(0,G.jsx)(OA.ListContainer,{className:`w-fit`,children:(0,G.jsxs)(OA.List,{children:[(0,G.jsxs)(DA,{id:`requests`,className:`gap-1.5`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),(0,G.jsx)(Pa,{size:13}),e(`logsRequests`)]}),(0,G.jsxs)(DA,{id:`runtime`,className:`gap-1.5`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),(0,G.jsx)(eo,{size:13}),e(`logsRuntime`)]})]})}),(0,G.jsxs)(OA.Panel,{id:`requests`,"data-tab-panel":`requests`,className:`space-y-4 pt-5`,children:[(0,G.jsxs)(`div`,{className:`data-toolbar flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsx)(AV,{value:_,onChange:e=>y(e),ariaLabel:e(`logsFilterAll`),options:[{id:`all`,label:e(`logsFilterAll`)},{id:`ok`,label:e(`logsFilterOk`)},{id:`incomplete`,label:e(`logsFilterIncomplete`)},{id:`error`,label:e(`logsFilterError`)},{id:`canceled`,label:e(`logsFilterCanceled`)}]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Je?(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:pt,children:e(`clearFilters`)}):null,(0,G.jsx)(`div`,{className:`mono text-caption text-muted`,children:ft})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(L9,{ariaLabel:e(`logsColAccount`),value:E,onChange:D,options:Ve,allLabel:e(`logsFilterAccountAll`),searchPlaceholder:e(`logsSearchAccount`),emptyLabel:e(`logsNoFilterOptions`)}),(0,G.jsx)(L9,{ariaLabel:e(`logsColApiKey`),value:O,onChange:k,options:Ue,allLabel:e(`logsFilterApiKeyAll`),searchPlaceholder:e(`logsSearchApiKey`),emptyLabel:e(`logsNoFilterOptions`)}),(0,G.jsx)(L9,{ariaLabel:e(`logsColModel`),value:M,onChange:N,options:Ke,allLabel:e(`logsFilterModelAll`),searchPlaceholder:e(`logsSearchModel`),emptyLabel:e(`logsNoFilterOptions`)}),(0,G.jsx)(R7,{ariaLabel:e(`logsColProvider`),value:P,onChange:F,options:Ge}),(0,G.jsx)(L9,{ariaLabel:e(`logsSearchRequestId`),value:S,onChange:C,options:S?[{id:S,label:S}]:[],allLabel:e(`logsFilterIdAll`),searchPlaceholder:e(`logsSearchRequestId`),emptyLabel:e(`logsNoFilterOptions`),loadOptions:qe,className:`min-w-56`}),(0,G.jsx)(AV,{value:I,onChange:e=>L(e),ariaLabel:e(`logsFilterStreamAll`),options:[{id:`all`,label:e(`logsFilterStreamAll`)},{id:`stream`,label:e(`logsStreamYes`)},{id:`sync`,label:e(`logsStreamNo`)}]}),(0,G.jsx)(R7,{ariaLabel:e(`errorKind`),value:ee===`all`?``:ee,onChange:e=>R(e||`all`),options:[{id:``,label:e(`logsFilterKindAll`)},{id:`quota`,label:e(`logsKindQuota`)},{id:`rate_limit`,label:e(`logsKindRateLimit`)},{id:`auth`,label:e(`logsKindAuth`)},{id:`not_ready`,label:e(`logsKindNotReady`)},{id:`unavailable`,label:e(`logsKindUnavailable`)},{id:`invalid_request`,label:e(`logsKindInvalidRequest`)},{id:`model_not_available`,label:e(`logsKindModelNotAvailable`)}]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:e(`logsTimeRange`)}),(0,G.jsx)(AV,{value:z,onChange:e=>B(e),ariaLabel:e(`logsTimeRange`),options:[{id:`all`,label:e(`logsTimeAll`)},{id:`1h`,label:e(`logsTime1h`)},{id:`24h`,label:e(`logsTime24h`)},{id:`7d`,label:e(`logsTime7d`)},{id:`custom`,label:e(`logsTimeCustom`)}]}),z===`custom`?(0,G.jsx)(NV,{className:`w-[min(100%,42rem)]`,value:V,onChange:H,ariaLabel:e(`logsTimeRange`),fromLabel:e(`logsTimeFrom`),toLabel:e(`logsTimeTo`)}):null]})]}),(0,G.jsx)(CS,{className:`overflow-hidden p-0`,"aria-busy":d,children:_t?(0,G.jsx)(nV,{}):le.length===0?(0,G.jsx)(I7,{icon:(0,G.jsx)(va,{size:22}),title:e(Je?`logsNoMatch`:`logsEmptyRequests`),action:Je?(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:pt,children:e(`clearFilters`)}):null}):(0,G.jsx)(X,{children:(0,G.jsx)(X.ScrollContainer,{children:(0,G.jsxs)(X.Content,{"aria-label":e(`logsRequests`),children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:e(`logsColTime`)}),(0,G.jsx)(X.Column,{children:e(`logsColModel`)}),(0,G.jsx)(X.Column,{children:e(`logsColReasoning`)}),(0,G.jsx)(X.Column,{children:e(`logsColProvider`)}),(0,G.jsx)(X.Column,{children:e(`logsColAccount`)}),(0,G.jsx)(X.Column,{children:e(`logsColApiKey`)}),(0,G.jsx)(X.Column,{children:e(`logsColStatus`)}),(0,G.jsx)(X.Column,{children:e(`logsColStream`)}),(0,G.jsx)(X.Column,{children:e(`logsColLatency`)}),(0,G.jsx)(X.Column,{children:e(`logsColTokens`)})]}),(0,G.jsx)(X.Body,{children:le.map(n=>(0,G.jsxs)(X.Row,{className:`cursor-pointer`,onAction:()=>void mt(n),children:[(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`div`,{className:`py-1`,children:[(0,G.jsx)(`div`,{className:`mono text-xs`,children:B9(n.created_at,t)}),(0,G.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.id})]})}),(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(`div`,{className:`text-body font-medium`,children:n.requested_model||`—`}),n.mapped_model&&n.mapped_model!==n.requested_model?(0,G.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.mapped_model}):null]}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:V9(n)||`—`})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-xs`,children:ze(n)})}),(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(`span`,{className:`text-xs`,children:n.account_id?Le.get(n.account_id)||n.account_id:`—`}),n.account_id&&Le.get(n.account_id)&&Le.get(n.account_id)!==n.account_id?(0,G.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.account_id}):null]}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-xs`,children:We(n)})}),(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:z9(n.status),children:n.status}),n.error_kind?(0,G.jsx)(`div`,{className:`mono mt-1 text-caption text-muted`,children:n.error_kind}):null]}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-xs text-muted`,children:n.stream?e(`logsStreamYes`):e(`logsStreamNo`)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(n9,{latencyMs:n.latency_ms,ttfbMs:n.ttfb_ms,completionTokens:n.completion_tokens,stream:n.stream,labels:{ttft:e(`logsColTTFT`),total:e(`logsLatencyTotal`),tps:e(`logsOutputTPS`)}})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(H9,{log:n,inLabel:e(`logsTokensIn`),outLabel:e(`logsTokensOut`),pointsLabel:t=>e(`logsTokensPoints`,{value:t})})})]},n.id))})]})})})}),(0,G.jsx)(z7,{total:de,page:nt,pageCount:tt,pageSize:re,loading:d,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:nt,pages:tt}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:ne,onPageSize:ie})]}),(0,G.jsxs)(OA.Panel,{id:`runtime`,"data-tab-panel":`runtime`,className:`space-y-4 pt-5`,children:[(0,G.jsxs)(`div`,{className:`data-toolbar flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(B7,{className:`sm:w-72`,value:w,onChange:T,placeholder:e(`logsSearchRuntime`),ariaLabel:e(`logsSearchRuntime`)}),(0,G.jsx)(L9,{ariaLabel:e(`logsColAccount`),value:A,onChange:j,options:Ve,allLabel:e(`logsFilterAccountAll`),searchPlaceholder:e(`logsSearchAccount`),emptyLabel:e(`logsNoFilterOptions`)}),(0,G.jsx)(AV,{value:b,onChange:e=>x(e),ariaLabel:e(`logsLevelAll`),options:[{id:`all`,label:e(`logsLevelAll`)},{id:`info`,label:e(`logsLevelInfo`)},{id:`warn`,label:e(`logsLevelWarn`)},{id:`error`,label:e(`logsLevelError`)}]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted`,children:[it===1?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":`ok`}),e(`logsAutoRefresh`)]}):null,(0,G.jsx)(`span`,{className:`mono`,children:ft})]})]}),(0,G.jsx)(CS,{className:`overflow-hidden p-0`,"aria-busy":d,children:_t?(0,G.jsx)(Ice,{}):pe.length===0?(0,G.jsx)(I7,{icon:(0,G.jsx)(eo,{size:22}),title:e(`logsEmptyRuntime`)}):(0,G.jsx)(`div`,{className:`divide-y divide-separator`,children:pe.map(e=>(0,G.jsxs)(`div`,{className:`grid cursor-pointer gap-2 px-5 py-3 transition-colors hover:bg-surface-secondary/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:grid-cols-[150px_72px_minmax(0,1fr)] sm:items-start`,role:`button`,tabIndex:0,onClick:()=>ht(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),ht(e))},children:[(0,G.jsx)(`div`,{className:`mono text-caption text-muted`,children:B9(e.time,t)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":XTe(e.level)}),(0,G.jsx)(`span`,{className:`font-medium text-muted`,children:e.level})]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[e.account_id?(0,G.jsx)(`div`,{className:`mono mb-1 text-caption text-muted`,children:e.account_id}):null,(0,G.jsx)(`div`,{className:`mono break-all text-xs leading-5 text-foreground`,children:e.message})]})]},e.id))})}),(0,G.jsx)(z7,{total:he,page:it,pageCount:rt,pageSize:se,loading:d,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:it,pages:rt}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:oe,onPageSize:ce})]})]}),(0,G.jsx)(Y.Root,{isOpen:ye,onOpenChange:e=>{be(e),e||ve(null)},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{className:`w-full max-w-4xl`,children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`logsRuntimeDetailTitle`)}),(0,G.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:_e?`#${_e.id}`:`—`})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":e(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(yo,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`space-y-5 px-5 pb-5`,children:[(0,G.jsx)(`dl`,{className:`grid gap-3 sm:grid-cols-2`,children:[[e(`logsColTime`),_e?B9(_e.time,t):`—`],[e(`logsRuntimeLevel`),_e?.level||`—`],[e(`logsRuntimeSource`),_e?.source||`—`],[e(`logsColAccount`),_e?.account_id||`—`]].map(([t,n])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:t}),(0,G.jsx)(`dd`,{className:`mt-1 break-all text-body font-medium`,children:t===e(`logsRuntimeLevel`)&&_e?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:ZTe(_e.level),children:_e.level}):n})]},String(t)))}),(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:e(`logsRuntimeMessage`)}),(0,G.jsx)(`pre`,{className:`mono max-h-[min(38rem,60vh)] overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-secondary px-4 py-3 text-xs leading-6 text-foreground`,children:_e?.message||`—`})]})]})]})})})}),(0,G.jsx)(Y.Root,{isOpen:Ce,onOpenChange:e=>{we(e),e||(ke.current+=1,Ee(!1),Oe(``),Se(null))},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{className:`w-full max-w-4xl`,children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`logsDetailTitle`)}),(0,G.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:xe?.id})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":e(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(yo,{size:16})})]}),(0,G.jsx)(Y.Body,{className:`space-y-4 px-5 pb-5`,children:Te?(0,G.jsx)(QTe,{}):De?(0,G.jsx)(xI,{title:e(`requestFailed`),description:De}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`dl`,{className:`grid gap-3 sm:grid-cols-2`,children:[[[e(`logsColStatus`),xe?.status||`—`],[e(`logsColModel`),xe?.requested_model||`—`],[e(`logsColReasoning`),xe&&V9(xe)||`—`],[e(`logsColProvider`),xe?ze(xe):`—`],[e(`logsColAccount`),xe?.account_id?Le.get(xe.account_id)||xe.account_id:`—`],[e(`logsColApiKey`),xe?We(xe):`—`],[e(`logsColStream`),xe?.stream?e(`logsStreamYes`):e(`logsStreamNo`)],[e(`logsRouting`),xe?Be(xe.routing):`—`]].map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e}),(0,G.jsx)(`dd`,{className:`mt-1 break-all text-body font-medium`,children:t})]},String(e))),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e(`logsColTokens`)}),(0,G.jsx)(`dd`,{className:`mt-1`,children:xe?(0,G.jsx)(H9,{log:xe,inLabel:e(`logsTokensIn`),outLabel:e(`logsTokensOut`),pointsLabel:t=>e(`logsTokensPoints`,{value:t})}):`—`})]}),(0,G.jsx)(`div`,{className:`sm:col-span-2`,children:(0,G.jsx)(n9,{latencyMs:xe?.latency_ms,ttfbMs:xe?.ttfb_ms,completionTokens:xe?.completion_tokens,stream:xe?.stream,labels:{heading:e(`logsColLatency`),ttft:e(`logsColTTFT`),total:e(`logsLatencyTotal`),tps:e(`logsOutputTPS`)}})})]}),xe&&xe.message_count?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-3 py-3 text-xs`,children:[(0,G.jsx)(`div`,{className:`font-medium text-muted`,children:e(`logsMessageShape`)}),(0,G.jsxs)(`dl`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e(`logsMessageCount`)}),(0,G.jsx)(`dd`,{className:`mono mt-0.5`,children:xe.message_count})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e(`logsEmptyMessageIndexes`)}),(0,G.jsx)(`dd`,{className:`mono mt-0.5 break-all`,children:xe.empty_message_indexes?.length?xe.empty_message_indexes.join(`, `):`—`})]}),(0,G.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e(`logsMessageRoles`)}),(0,G.jsx)(`dd`,{className:`mono mt-0.5 break-all`,children:xe.message_roles?.join(` → `)||`—`})]})]})]}):null,xe?.error_message?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-3 py-2 text-xs leading-5 text-muted`,children:[xe.error_kind?(0,G.jsx)(`span`,{className:`mono mr-2 text-muted`,children:xe.error_kind}):null,xe.error_message]}):null,xe?.stream_diagnostic?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-3 py-3 text-xs`,children:[(0,G.jsx)(`div`,{className:`font-medium text-muted`,children:e(`logsStreamDiagnostics`)}),(0,G.jsx)(`dl`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[[e(`logsCancellationSource`),xe.stream_diagnostic.cancellation_source||`—`],[e(`logsUpstreamStatus`),xe.stream_diagnostic.upstream_status??`—`],[e(`logsSSEEvents`),xe.stream_diagnostic.sse_event_count],[e(`logsBytesRead`),xe.stream_diagnostic.bytes_read],[e(`logsLastEvent`),xe.stream_diagnostic.last_event||`—`],[e(`logsStreamComplete`),xe.stream_diagnostic.saw_done?`yes`:`no`]].map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e}),(0,G.jsx)(`dd`,{className:`mono mt-0.5 break-all`,children:t})]},String(e)))}),xe.stream_diagnostic.context_err||xe.stream_diagnostic.relay_error?(0,G.jsxs)(`div`,{className:`mt-2 space-y-1 break-all text-muted`,children:[xe.stream_diagnostic.context_err?(0,G.jsxs)(`div`,{children:[`context: `,xe.stream_diagnostic.context_err]}):null,xe.stream_diagnostic.relay_error?(0,G.jsxs)(`div`,{children:[`relay: `,xe.stream_diagnostic.relay_error]}):null]}):null]}):null,xe?.usage_detail?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-3 py-3 text-xs`,children:[(0,G.jsx)(`div`,{className:`font-medium text-muted`,children:e(`logsUsageDetail`)}),(0,G.jsx)(`dl`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[[e(`logsCreditConsumed`),`${U9(xe.usage_detail.credit)} ${xe.usage_detail.unit||`credits`}`],[e(`logsColProvider`),xe.usage_detail.provider||`—`]].map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e}),(0,G.jsx)(`dd`,{className:`mono mt-0.5 break-all`,children:t})]},String(e)))})]}):null,(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:e(`logsAttempts`)}),xe?.attempts?.length?(0,G.jsx)(`div`,{className:`mt-2 divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:xe.attempts.map(e=>(0,G.jsxs)(`div`,{className:`grid gap-1 px-3 py-2.5 text-xs sm:grid-cols-[48px_minmax(0,1fr)_auto]`,children:[(0,G.jsxs)(`div`,{className:`mono text-muted`,children:[`#`,e.attempt_index]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-medium`,children:e.account_id||`—`}),(0,G.jsx)(`div`,{className:`mt-0.5 text-muted`,children:e.error_message||e.status})]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:z9(e.status===`failover`?`canceled`:e.status),children:e.status})]},e.id))}):(0,G.jsx)(`p`,{className:`mt-2 text-xs text-muted`,children:e(`logsNoAttempts`)})]})]})})]})})})}),(0,G.jsx)(E9,{isOpen:Ae,title:e(`logsClear`),description:e(`logsClearConfirm`),confirmLabel:e(`logsClear`),cancelLabel:e(`close`),closeLabel:e(`close`),isPending:Me,onClose:()=>je(!1),onConfirm:()=>void gt()})]})}var G9=864e5,aEe=8;function K9(e){return`var(--chart-${e%aEe+1})`}function q9(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function J9(e){return e<10?`0${e}`:String(e)}function Y9(e){let t=new Date(e);return`${t.getFullYear()}-${J9(t.getMonth()+1)}-${J9(t.getDate())}`}function oEe({accounts:e,t}){let[n,r]=(0,v.useState)(!1),{buckets:i,rows:a,todayStart:o,maxTotal:s}=(0,v.useMemo)(()=>{let t=q9(new Date),n=new Map;e.forEach((e,t)=>n.set(e.id,K9(t)));let r=new Map,i=[];for(let a of e){let e=a.quota?.packages??[],o=n.get(a.id)||K9(0),s=a.name||a.id,c=e.filter(e=>(e.remain??0)>0&&(e.ends_at??0)>0),l=0,u=0,d=0,f=0;for(let e of c){let n=e.ends_at*1e3,i=e.remain??0;d+=i;let c=q9(new Date(n)),u=c{let e=new Date(c);return{day:p,label:`${e.getMonth()+1}/${e.getDate()}`,ts:c,segments:[],total:0}})(),r.set(p,m));let h=m.segments.find(e=>e.id===a.id);h?h.remain+=i:m.segments.push({id:a.id,name:s,color:o,remain:i}),m.total+=i}if(l){let e=Y9(q9(new Date(l)));for(let t of c)Y9(q9(new Date(t.ends_at*1e3)))===e&&(u+=t.remain??0)}let p=l?Math.max(0,Math.round((q9(new Date(l))-t)/G9)):-1;i.push({id:a.id,name:s,color:o,remain:d,expiredRemain:f,soonest:l?Math.floor(l/1e3):0,soonestRemain:u,daysLeft:p,dailyBurn:l?u/Math.max(p,1):0,packs:c.length})}i.sort((e,t)=>e.soonest&&t.soonest?e.soonest-t.soonest:e.soonest?-1:t.soonest?1:t.remain-e.remain);let a=[...r.values()].sort((e,t)=>e.ts-t.ts);return{buckets:a,rows:i,todayStart:t,maxTotal:a.reduce((e,t)=>Math.max(e,t.total),0)}},[e]);if(!a.some(e=>e.packs>0))return null;let c=n?i:i.slice(0,8);return(0,G.jsxs)(CS,{className:`overflow-hidden p-0`,"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-separator px-4 py-4 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:px-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`expiryDistTitle`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`expiryDistHint`)})]}),i.length>8?(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:()=>r(e=>!e),children:n?t(`expiryDistCollapse`):t(`expiryDistExpand`,{n:i.length})}):null]}),(0,G.jsxs)(`div`,{className:`space-y-4 p-4 sm:space-y-3 sm:p-5`,children:[(0,G.jsx)(`div`,{className:`space-y-2.5 sm:space-y-1.5`,children:c.map(e=>{let n=e.ts===o,r=s>0?e.total/s*100:0;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:grid sm:grid-cols-[52px_minmax(0,1fr)_auto] sm:items-center sm:gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 sm:contents`,children:[(0,G.jsx)(`span`,{className:`mono text-caption ${e.day===`__expired__`?`font-semibold text-danger`:n?`font-semibold text-foreground`:`text-muted`}`,children:e.day===`__expired__`?t(`expiryDistExpired`):e.label}),(0,G.jsx)(`span`,{className:`mono text-caption text-foreground sm:hidden`,children:m9(e.total)})]}),(0,G.jsx)(`div`,{className:`h-2.5 w-full rounded-full bg-surface-tertiary`,role:`img`,"aria-label":`${e.day} ${t(`expiryDistDayTotal`,{n:m9(e.total)})}`,title:e.day,children:(0,G.jsx)(`div`,{className:`flex h-full items-stretch overflow-hidden rounded-full`,style:{width:`${r}%`},children:e.segments.map(t=>(0,G.jsx)(`span`,{style:{width:`${t.remain/e.total*100}%`,backgroundColor:t.color},title:`${t.name} · ${m9(t.remain)}`},t.id))})}),(0,G.jsx)(`span`,{className:`mono hidden text-caption text-foreground sm:inline`,children:m9(e.total)})]},e.day)})}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1.5 pt-1`,children:a.filter(e=>e.remain>0).map(e=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-caption text-muted`,children:[(0,G.jsx)(`i`,{className:`size-2 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,G.jsx)(`span`,{className:`max-w-[120px] truncate`,children:e.name})]},e.id))}),(0,G.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,children:a.filter(e=>e.packs>0).map(e=>{let n=e.daysLeft>=0&&e.daysLeft<=2,r=e.daysLeft>=0&&e.daysLeft<=7,i=e.soonest?new Date(e.soonest*1e3):null,a=e.expiredRemain>0&&e.daysLeft<0||n?`font-semibold text-danger`:r?`text-warning`:`text-muted`,o=e.daysLeft>=0?t(`expiryDistDays`,{n:e.daysLeft}):e.expiredRemain>0?t(`expiryDistExpired`):`—`;return(0,G.jsxs)(`article`,{className:`space-y-3 py-3.5`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(`i`,{className:`size-2 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,G.jsx)(`span`,{className:`truncate text-body font-medium text-foreground`,children:e.name})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColSoonest`)}),(0,G.jsx)(`div`,{className:`mono text-body text-muted`,children:i?`${i.getMonth()+1}/${i.getDate()}`:`—`})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColDaysLeft`)}),(0,G.jsx)(`div`,{className:`mono text-body ${a}`,children:o})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColBatch`)}),(0,G.jsx)(`div`,{className:`mono text-body text-foreground`,children:m9(e.soonestRemain)})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColDaily`)}),(0,G.jsx)(`div`,{className:`mono text-body text-foreground`,children:e.soonest?m9(e.dailyBurn):`—`})]})]})]},e.id)})}),(0,G.jsx)(X,{"aria-label":t(`expiryDistTitle`),className:`hidden md:block`,children:(0,G.jsx)(X.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,G.jsxs)(X.Content,{className:`min-w-[32rem]`,children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:t(`expiryDistColAccount`)}),(0,G.jsx)(X.Column,{children:(0,G.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColSoonest`)})}),(0,G.jsx)(X.Column,{children:(0,G.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColDaysLeft`)})}),(0,G.jsx)(X.Column,{children:(0,G.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColBatch`)})}),(0,G.jsx)(X.Column,{children:(0,G.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColDaily`)})})]}),(0,G.jsx)(X.Body,{children:a.filter(e=>e.packs>0).map(e=>{let n=e.daysLeft>=0&&e.daysLeft<=2,r=e.daysLeft>=0&&e.daysLeft<=7,i=e.soonest?new Date(e.soonest*1e3):null;return(0,G.jsxs)(X.Row,{children:[(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(`i`,{className:`size-2 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,G.jsx)(`span`,{className:`max-w-[150px] truncate text-foreground`,children:e.name})]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`div`,{className:`mono text-center text-muted`,children:i?`${i.getMonth()+1}/${i.getDate()}`:`—`})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`div`,{className:`mono text-center ${e.expiredRemain>0&&e.daysLeft<0||n?`font-semibold text-danger`:r?`text-warning`:`text-muted`}`,children:e.daysLeft>=0?t(`expiryDistDays`,{n:e.daysLeft}):e.expiredRemain>0?t(`expiryDistExpired`):`—`})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`div`,{className:`mono text-center text-foreground`,children:m9(e.soonestRemain)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`div`,{className:`mono text-center text-foreground`,children:e.soonest?m9(e.dailyBurn):`—`})})]},e.id)})})]})})}),(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:t(`expiryDistFoot`)})]})]})}function sEe(){return tI(`/api/usage/pricing`)}function cEe(e={}){let t=new URLSearchParams;return e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.api_key&&t.set(`api_key`,e.api_key),tI(`/api/usage/cost${t.toString()?`?${t}`:``}`)}var X9=(0,v.lazy)(()=>C(()=>import(`./CostChart-Dpyzl54f.js`).then(e=>({default:e.CostChart})),__vite__mapDeps([2,1])));function lEe(){let e=new Date;return e.setHours(0,0,0,0),e.toISOString()}var uEe={window:{from:``,to:``,hours:24},currency:`CNY`,models:[],totals:{id:`total`,label:``,vendor:``,currency:`CNY`,requests:0,cache_hit:0,cache_miss:0,output:0,total_tokens:0,cost:0,cost_off_peak:0,cost_peak:0,peak_requests:0,credits:0,priced:!1},series:[]};function dEe(e,t){if(!t)return`0%`;let n=e/t*100;return`${n>=10?n.toFixed(0):n.toFixed(1)}%`}function fEe({apiKeyFilter:e=``}){let{t,lang:n}=JF(),[r,i]=(0,v.useState)(`today`),[a,o]=(0,v.useState)(`credits`),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(!0),[p,m]=(0,v.useState)(``);(0,v.useEffect)(()=>{let e=!1;return sEe().then(t=>{e||u(t)}).catch(()=>{}),()=>{e=!0}},[]);let h=(0,v.useCallback)(async()=>{f(!0);try{let t=await cEe({...r===`all`?{}:r===`today`?{from:lEe()}:{from:new Date(Date.now()-Number(r)*3600*1e3).toISOString(),to:new Date().toISOString()},api_key:e||void 0});c(t),m(``)}catch(e){c(null),m(e instanceof Error?e.message:String(e))}finally{f(!1)}},[r,e]);(0,v.useEffect)(()=>{h()},[h]);let g=s??uEe,_=g.totals,y=_.requests>0&&g.models.length>0,b=g.models.filter(e=>e.priced),x=_.cost>0,S=[{label:t(`usageCredits`),value:TV(_.credits),detail:t(`usageCreditsHint`)},{label:t(`usageTotalTokens`),value:gV(_.total_tokens),detail:`${gV(_.cache_hit)} / ${gV(_.cache_miss)} / ${gV(_.output)} ${t(`usageTokenSplitNote`)}`},{label:t(`usageRequests`),value:String(_.requests),detail:t(`usageModelCount`,{count:g.models.length})},{label:t(`usageCacheHitRate`),value:dEe(_.cache_hit,_.cache_hit+_.cache_miss),detail:gV(_.cache_hit)}],C=a===`credits`?TV(_.credits):a===`tokens`?gV(_.total_tokens):CV(_.cost);return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-2`,children:[(0,G.jsx)(AV,{value:r,onChange:e=>i(e),ariaLabel:t(`usageWindow`),options:[{id:`today`,label:t(`statsWindowToday`)},{id:`24`,label:t(`usageWindow24h`)},{id:`168`,label:t(`usageWindow7d`)},{id:`all`,label:t(`usageWindowTotal`)}]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,onPress:()=>void h(),isDisabled:d,children:[(0,G.jsx)(Qr,{size:14}),t(`refresh`)]})]}),p?(0,G.jsx)(xI,{title:t(`failedStats`,{msg:p})}):null,(0,G.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-4`,children:S.map(e=>(0,G.jsxs)(CS,{className:`gap-0 p-4`,children:[(0,G.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,G.jsx)(`div`,{className:`tabular mt-1.5 text-section font-semibold`,children:d?(0,G.jsx)(Q,{className:`h-5 w-16`}):e.value}),(0,G.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:d?(0,G.jsx)(Q,{className:`h-3 w-24`}):e.detail||`\xA0`})]},e.label))}),(0,G.jsxs)(CS,{className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold tracking-[-0.015em]`,children:t(`usageChartTitle`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`usageChartHint`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(AV,{value:a,onChange:e=>o(e),ariaLabel:t(`usageChartMetric`),options:[{id:`credits`,label:t(`usageColCredits`)},{id:`tokens`,label:t(`usageColTokens`)}]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`default`,children:C})]})]}),(0,G.jsx)(`div`,{className:`p-5`,children:d?(0,G.jsx)(`div`,{className:`grid h-72 place-items-center`,children:(0,G.jsx)(Q,{className:`h-56 w-full`})}):y?(0,G.jsx)(v.Suspense,{fallback:(0,G.jsx)(`div`,{className:`grid h-72 place-items-center`,children:(0,G.jsx)(Q,{className:`h-56 w-full`})}),children:(0,G.jsx)(X9,{series:g.series,models:g.models,lang:n,emptyLabel:t(`usageChartEmpty`),totalLabel:t(`usageTotals`),metric:a})}):(0,G.jsx)(I7,{title:t(`usageEmpty`),hint:t(`usageRetentionHint`)})})]}),(0,G.jsxs)(CS,{className:`overflow-hidden p-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold tracking-[-0.015em]`,children:t(`usageBreakdownTitle`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`usageBreakdownHint`)})]})}),d?(0,G.jsx)(`div`,{className:`space-y-3 p-5`,children:[0,1,2].map(e=>(0,G.jsx)(Q,{className:`h-9 w-full`},e))}):y?(0,G.jsx)(X,{children:(0,G.jsx)(X.ScrollContainer,{children:(0,G.jsxs)(X.Content,{"aria-label":t(`usageBreakdownTitle`),children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:t(`usageColModel`)}),(0,G.jsx)(X.Column,{children:t(`usageColRequests`)}),(0,G.jsx)(X.Column,{children:t(`usageColInputHit`)}),(0,G.jsx)(X.Column,{children:t(`usageColInputMiss`)}),(0,G.jsx)(X.Column,{children:t(`usageColOutput`)}),(0,G.jsx)(X.Column,{children:t(`usageColTokens`)}),(0,G.jsx)(X.Column,{children:t(`usageColCredits`)})]}),(0,G.jsxs)(X.Body,{children:[g.models.map(e=>(0,G.jsxs)(X.Row,{children:[(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,G.jsx)(`div`,{className:`mono mt-0.5 text-[10px] text-muted`,children:e.id})]}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:e.requests})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:gV(e.cache_hit)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:gV(e.cache_miss)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:gV(e.output)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:gV(e.total_tokens)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:TV(e.credits)})})]},e.id)),(0,G.jsxs)(X.Row,{children:[(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-sm font-semibold`,children:t(`usageTotals`)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:_.requests})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:gV(_.cache_hit)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:gV(_.cache_miss)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:gV(_.output)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:gV(_.total_tokens)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:TV(_.credits)})})]})]})]})})}):(0,G.jsx)(I7,{title:t(`usageEmpty`),hint:t(`usageRetentionHint`)})]}),(0,G.jsx)(yh,{className:`rounded-xl bg-surface-secondary`,hideSeparator:!0,defaultExpandedKeys:[],children:(0,G.jsxs)(yh.Item,{id:`deepseek-estimate`,children:[(0,G.jsx)(yh.Heading,{children:(0,G.jsxs)(yh.Trigger,{className:`items-center gap-3 px-5 py-4 text-left`,children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block font-semibold tracking-[-0.015em]`,children:t(`usageEstimateTitle`)}),(0,G.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted`,children:t(`usageEstimateHint`)})]}),x?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`default`,children:CV(_.cost)}):null,(0,G.jsx)(yh.Indicator,{})]})}),(0,G.jsx)(yh.Panel,{children:(0,G.jsxs)(yh.Body,{className:`space-y-5 px-5 pb-5`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-6 text-muted`,children:t(`usageRenderNote`)}),x?(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium`,children:t(`usageEstimateChartTitle`)}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`default`,children:CV(_.cost)})]}),(0,G.jsx)(v.Suspense,{fallback:(0,G.jsx)(Q,{className:`h-56 w-full`}),children:(0,G.jsx)(X9,{series:g.series,models:b.length?b:g.models,lang:n,emptyLabel:t(`usageEstimateChartEmpty`),totalLabel:t(`usageTotals`),metric:`cost`})})]}):null,b.length?(0,G.jsx)(X,{children:(0,G.jsx)(X.ScrollContainer,{children:(0,G.jsxs)(X.Content,{"aria-label":t(`usageEstimateTitle`),children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:t(`usageColModel`)}),(0,G.jsx)(X.Column,{children:t(`usageColSplit`)}),(0,G.jsx)(X.Column,{children:t(`usageColCost`)})]}),(0,G.jsxs)(X.Body,{children:[b.map(e=>(0,G.jsxs)(X.Row,{children:[(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,G.jsx)(`div`,{className:`mono mt-0.5 text-[10px] text-muted`,children:e.id})]}),(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`span`,{className:`mono text-xs text-muted`,children:[CV(e.cost_peak),` / `,CV(e.cost_off_peak)]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-sm font-semibold`,children:CV(e.cost)})})]},e.id)),(0,G.jsxs)(X.Row,{children:[(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-sm font-semibold`,children:t(`usageTotals`)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`span`,{className:`mono text-xs text-muted`,children:[CV(_.cost_peak),` / `,CV(_.cost_off_peak)]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-sm font-semibold`,children:CV(_.cost)})})]})]})]})})}):(0,G.jsx)(`p`,{className:`text-xs text-muted`,children:t(`usageEstimateChartEmpty`)}),(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`mb-2 text-sm font-medium`,children:t(`usagePriceTitle`)}),(0,G.jsx)(`p`,{className:`mb-3 text-xs text-muted`,children:t(`usagePeakNote`)}),(0,G.jsxs)(`div`,{className:`divide-y divide-separator rounded-lg bg-background`,children:[(l?.models??[]).map(e=>(0,G.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,G.jsx)(`span`,{className:`mono text-[10px] text-muted`,children:e.currency})]}),(0,G.jsx)(`div`,{className:`mono mt-1 text-[10px] text-muted`,children:e.id}),(0,G.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 text-[11px]`,children:[(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:t(`usagePriceBandOff`)}),(0,G.jsxs)(`div`,{className:`mono mt-0.5`,children:[wV(e.off_peak.cache_hit),` · `,wV(e.off_peak.cache_miss),` · `,wV(e.off_peak.output)]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[9px] text-muted`,children:[t(`usagePriceHit`),` · `,t(`usagePriceMiss`),` · `,t(`usagePriceOutput`)]})]}),(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:t(`usagePriceBandPeak`)}),(0,G.jsxs)(`div`,{className:`mono mt-0.5`,children:[wV(e.peak.cache_hit),` · `,wV(e.peak.cache_miss),` · `,wV(e.peak.output)]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[9px] text-muted`,children:[t(`usagePriceHit`),` · `,t(`usagePriceMiss`),` · `,t(`usagePriceOutput`)]})]})]})]},e.id)),l?.models?.length?null:(0,G.jsx)(`div`,{className:`px-4 py-6 text-sm text-muted`,children:t(`usageEmpty`)})]})]}),(0,G.jsxs)(`div`,{className:`space-y-3 text-xs leading-6 text-muted`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:t(`usageNoteTitle`)}),(0,G.jsx)(`p`,{children:t(`usageRetentionHint`)}),(0,G.jsx)(`p`,{children:t(`usagePeakNote`)}),g.unpriced?.length?(0,G.jsx)(`p`,{children:t(`usageUnpricedHint`,{models:g.unpriced.join(`, `)})}):null,l?.note?(0,G.jsx)(`p`,{className:`mono text-[10px]`,children:l.note}):null]})]})]})})]})})]})}var pEe=500,mEe={model:`model`,account:`account`,provider:`provider`};function hEe(e,t,n){let r=e.prompt_tokens??0,i=e.completion_tokens??0,a=e.key===`(unknown)`||e.key===`(unassigned)`||!e.key;return{key:e.key,label:n,count:e.count,success:e.count?e.ok/e.count:0,p95:e.latency_p95_ms??null,tokens:r+i,prompt:r,completion:i,credits:e.credits??0,cache_write:e.cache_write_tokens??0,cache_read:e.cache_read_tokens??0,filter:a?void 0:{[mEe[t]]:e.key}}}function gEe(e,t,n){let r=n===`ascending`?1:-1;return[...e].sort((e,n)=>{if(t===`label`)return r*e.label.localeCompare(n.label);let i=e[t],a=n[t];return i==null&&a==null?0:i==null?1:a==null?-1:r*(i-a)||e.label.localeCompare(n.label)})}function Z9(e){return e?e>=1e3?gV(e):String(Math.round(e*100)/100):`0`}function _Ee(){let{t:e}=JF(),t=at(),[n,r]=On(),[i,a]=(0,v.useState)(`stats`),[o,s]=(0,v.useState)(`model`),[c,l]=(0,v.useState)(`today`),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(!0),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)([]),[x,S]=(0,v.useState)(`count`),[C,w]=(0,v.useState)(`descending`),[T,E]=(0,v.useState)(()=>new URLSearchParams(window.location.search).get(`api_key`)??``),{options:D}=R9(),O=(0,v.useRef)(0),k=n.toString(),A=(0,v.useRef)(k);(0,v.useEffect)(()=>{k!==A.current&&(A.current=k,E(new URLSearchParams(k).get(`api_key`)??``))},[k]);let j=T?`api_key=${encodeURIComponent(T)}`:``;(0,v.useEffect)(()=>{j!==A.current&&(A.current=j,r(j,{replace:!0}))},[j,r]),(0,v.useEffect)(()=>{let e=!1;return nI(!1).then(t=>{e||b(t.data||[])}).catch(()=>{}),()=>{e=!0}},[]);let M=u?.start?.toString()??``,N=u?.end?.toString()??``;(0,v.useEffect)(()=>{let e=FV(c,u);if(!e){h(!1);return}let t=++O.current;mV({...e,dim:[o],limit:pEe,api_key:T||void 0}).then(e=>{t===O.current&&(p(e),_(``))}).catch(e=>{t===O.current&&(p(null),_(e instanceof Error?e.message:String(e)))}).finally(()=>{t===O.current&&h(!1)})},[o,c,M,N,T]);let P=(0,v.useMemo)(()=>{let t=new Map(y.map(e=>[e.id,e.name||e.id]));return gEe(((o===`model`?f?.models:o===`account`?f?.accounts:f?.providers)??[]).map(n=>{let r=n.key===`(unknown)`?e(`statsUnknown`):n.key===`(unassigned)`?e(`statsUnassigned`):o===`account`?t.get(n.key)||n.key:o===`provider`?JV(n.key,e):n.key;return hEe(n,o,r)}),x,C)},[f,o,y,x,C,e]),F=f?.totals,I=f?.tokens;function L(e){if(!f||!e.filter)return;let n={...e.filter,api_key:T||void 0};t(LV(n,f.window.from,f.window.to))}let ee=[{id:`label`,label:e(o===`model`?`logsColModel`:o===`account`?`logsColAccount`:`logsColProvider`)},{id:`count`,label:e(`usageColRequests`),numeric:!0},{id:`success`,label:e(`usageColSuccess`),numeric:!0},{id:`p95`,label:e(`statsLatencyP95`),numeric:!0},{id:`tokens`,label:e(`usageColTokens`),numeric:!0},{id:`cache_write`,label:e(`usageColCacheWrite`),numeric:!0},{id:`credits`,label:e(`usageColCredits`),numeric:!0}],R=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-1`,children:(0,G.jsx)(IV,{value:c,onChange:l,custom:u,onCustomChange:d,onBusy:()=>h(!0),t:e})}),g?(0,G.jsx)(xI,{title:e(`failedStats`,{msg:g})}):null,(0,G.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-5`,children:[[e(`usageColRequests`),F?gV(F.requests):`—`,e(`statsWindowHint`,{window:e(PV[c])})],[e(`usageColSuccess`),F?yV(F.success_rate):`—`,F?`${F.ok} / ${F.requests}`:``],[e(`usageColTokens`),I?gV(I.total):`—`,I?`${gV(I.prompt)} / ${gV(I.completion)}`:``],[e(`usageColCacheWrite`),I?gV(I.cache_write??0):`—`,I?`${e(`chartCacheRead`)} ${gV(I.cache_read)}`:``],[e(`usageColCredits`),F?Z9(F.credits??0):`—`,``]].map(([e,t,n])=>(0,G.jsxs)(CS,{className:`gap-0 p-4`,children:[(0,G.jsx)(`div`,{className:`text-body text-muted`,children:e}),(0,G.jsx)(`div`,{className:`tabular mt-1.5 text-section font-semibold`,children:m?(0,G.jsx)(Q,{className:`h-5 w-16`}):t}),(0,G.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:m?(0,G.jsx)(Q,{className:`h-3 w-24`}):n||`\xA0`})]},e))}),(0,G.jsxs)(CS,{className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-separator px-5 py-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between`,children:[(0,G.jsx)(OA,{selectedKey:o,onSelectionChange:e=>{h(!0),s(String(e))},children:(0,G.jsx)(OA.ListContainer,{className:`w-fit`,children:(0,G.jsxs)(OA.List,{"aria-label":e(`usageTitle`),children:[(0,G.jsxs)(DA,{id:`model`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),(0,G.jsx)(Bi,{size:14}),e(`usageByModel`)]}),(0,G.jsxs)(DA,{id:`account`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),(0,G.jsx)(po,{size:14}),e(`usageByAccount`)]}),(0,G.jsxs)(DA,{id:`provider`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),(0,G.jsx)(Ja,{size:14}),e(`usageByProvider`)]})]})})}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:m?``:e(`usageRowCount`,{count:P.length})})]}),m?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,"aria-busy":`true`,children:Array.from({length:4},(e,t)=>(0,G.jsxs)(`div`,{className:`space-y-3 px-5 py-4`,children:[(0,G.jsx)(Q,{className:`h-4 w-40`}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:Array.from({length:4},(e,t)=>(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(Q,{className:`h-3 w-12`}),(0,G.jsx)(Q,{className:`h-4 w-16`})]},t))})]},t))}),(0,G.jsx)(`div`,{className:`hidden divide-y divide-separator md:block`,"aria-busy":`true`,children:Array.from({length:6},(e,t)=>(0,G.jsxs)(`div`,{className:`flex items-center gap-6 px-5 py-3.5`,children:[(0,G.jsx)(Q,{className:`h-4 w-40`}),(0,G.jsx)(`div`,{className:`flex-1`}),Array.from({length:6},(e,t)=>(0,G.jsx)(Q,{className:`h-4 w-14`},t))]},t))})]}):P.length===0?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-10 text-body text-muted`,children:[(0,G.jsx)(vi,{size:16}),e(`usageEmpty`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,children:P.map(t=>{let n=!!(t.filter&&f),r=[{label:e(`usageColRequests`),value:String(t.count)},{label:e(`usageColSuccess`),value:yV(t.success),tone:t.success<.9?`text-warning`:void 0},{label:e(`statsLatencyP95`),value:_V(t.p95)},{label:e(`usageColTokens`),value:gV(t.tokens),sub:`${gV(t.prompt)} / ${gV(t.completion)}`},{label:e(`usageColCacheWrite`),value:gV(t.cache_write)},{label:e(`usageColCredits`),value:Z9(t.credits)}];return(0,G.jsxs)(`article`,{className:`space-y-3 px-5 py-4 ${n?`cursor-pointer`:``}`,onClick:n?()=>L(t):void 0,onKeyDown:n?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),L(t))}:void 0,role:n?`button`:void 0,tabIndex:n?0:void 0,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[o===`provider`&&t.filter?(0,G.jsx)(XV,{provider:t.key,size:14}):null,(0,G.jsx)(`span`,{className:`truncate text-body font-medium`,children:t.label})]}),o===`account`&&t.label!==t.key?(0,G.jsx)(`div`,{className:`mono truncate text-caption text-muted`,children:t.key}):null,(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:r.map(e=>(0,G.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e.label}),(0,G.jsx)(`div`,{className:`mono text-body ${e.tone??`text-foreground`}`,children:e.value}),`sub`in e&&e.sub?(0,G.jsx)(`div`,{className:`mono text-caption text-muted`,children:e.sub}):null]},e.label))})]},t.key)})}),(0,G.jsx)(X,{className:`usage-table hidden md:block`,children:(0,G.jsx)(X.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,G.jsxs)(X.Content,{"aria-label":e(`usageTitle`),className:`min-w-[48rem]`,sortDescriptor:{column:x,direction:C},onSortChange:e=>{S(String(e.column)),w(e.direction)},children:[(0,G.jsx)(X.Header,{children:ee.map(e=>(0,G.jsx)(X.Column,{id:e.id,allowsSorting:!0,isRowHeader:e.id===`label`,className:e.numeric?`text-right`:void 0,children:({sortDirection:t})=>(0,G.jsx)(X.SortableColumnHeader,{sortDirection:t,className:e.numeric?`justify-end`:void 0,children:e.label})},e.id))}),(0,G.jsx)(X.Body,{children:P.map(e=>(0,G.jsxs)(X.Row,{id:e.key,className:e.filter&&f?`cursor-pointer`:void 0,onAction:e.filter&&f?()=>L(e):void 0,children:[(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[o===`provider`&&e.filter?(0,G.jsx)(XV,{provider:e.key,size:14}):null,(0,G.jsx)(`span`,{className:`truncate text-body font-medium`,children:e.label}),o===`account`&&e.label!==e.key?(0,G.jsx)(`span`,{className:`mono truncate text-caption text-muted`,children:e.key}):null]})}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:e.count}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:(0,G.jsx)(`span`,{className:e.success<.9?`text-warning`:void 0,children:yV(e.success)})}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:_V(e.p95)}),(0,G.jsxs)(X.Cell,{className:`text-right`,children:[(0,G.jsx)(`div`,{className:`mono text-body`,children:gV(e.tokens)}),(0,G.jsxs)(`div`,{className:`mono text-caption text-muted`,children:[gV(e.prompt),` / `,gV(e.completion)]})]}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:gV(e.cache_write)}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:Z9(e.credits)})]},e.key))})]})})})]})]}),(0,G.jsx)(oEe,{accounts:y,t:e})]});return(0,G.jsxs)(`div`,{className:`space-y-6 sm:space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-3 pb-1`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`usageTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(i===`cost`?`usageCostLead`:`usageLead`)})]}),(0,G.jsx)(L9,{ariaLabel:e(`logsColApiKey`),value:T,onChange:e=>{h(!0),E(e)},options:D,allLabel:e(`logsFilterApiKeyAll`),searchPlaceholder:e(`logsSearchApiKey`),emptyLabel:e(`logsNoFilterOptions`)})]}),(0,G.jsxs)(OA,{selectedKey:i,onSelectionChange:e=>a(String(e)),children:[(0,G.jsx)(OA.ListContainer,{className:`w-fit`,children:(0,G.jsxs)(OA.List,{"aria-label":e(`usageTitle`),children:[(0,G.jsxs)(DA,{id:`stats`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),e(`usageStatsTab`)]}),(0,G.jsxs)(DA,{id:`cost`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),e(`usageCostTab`)]})]})}),(0,G.jsx)(OA.Panel,{id:`stats`,className:`space-y-6 pt-5`,children:R}),(0,G.jsx)(OA.Panel,{id:`cost`,className:`pt-5`,children:(0,G.jsx)(fEe,{apiKeyFilter:T})})]})]})}var vEe=1.1;function yEe({label:e,onConfirm:t,isPending:n,children:r}){let i=(0,v.useRef)(null),a=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>{a.current?.kill()},[]),(0,G.jsxs)(Mj,{delay:300,children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsxs)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":e,isPending:n,className:`relative overflow-hidden`,onPressStart:()=>{let e=i.current;!e||n||(a.current?.kill(),a.current=Z.to(e,{scaleX:1,duration:vEe*(1-Number(Z.getProperty(e,`scaleX`))),ease:GB.linear,onComplete:()=>{a.current=null,Z.to(e,{scaleX:0,duration:qB()?0:WB.base,ease:GB.out,delay:WB.fast}),t()}}))},onPressEnd:()=>{let e=i.current;!e||!a.current||(a.current.kill(),a.current=null,Z.to(e,{scaleX:0,duration:qB()?0:WB.base,ease:GB.soft}))},children:[(0,G.jsx)(`span`,{ref:i,"aria-hidden":!0,className:`pointer-events-none absolute inset-0 origin-left scale-x-0 bg-danger/20`}),(0,G.jsx)(`span`,{className:`relative inline-flex`,children:r})]})}),(0,G.jsx)(Mj.Content,{children:e})]})}function bEe(e){let t=[];for(let n of e)for(let e of n.regions||[])e?.id&&t.push({value:`${n.id}:${e.id}`,provider:n.id,region:e.id});return t}function Q9(e,t){let n=e.indexOf(`:`),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n+1);return i?YV(r,i,t):JV(r,t)}function xEe(e){let t=e.indexOf(`:`);return t===-1?e:e.slice(0,t)}function SEe(e,t){let n=[],r=new Set(e.filter(e=>!e.includes(`:`)).map(e=>e.toLowerCase()));for(let t of e)t.includes(`:`)&&n.push(t);for(let e of t)r.has(e.provider)&&!n.includes(e.value)&&n.push(e.value);return n}function CEe(e,t){return e.length?e.map(e=>Q9(e,t)).join(` · `):t(`keysAllProviders`)}function wEe(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function TEe(){let{t:e}=JF(),[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(!0),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(!1);(0,v.useEffect)(()=>{dI().then(e=>{let t=bEe(e.data||[]);n(t),i(t.length>0),o(``)}).catch(e=>{o(e instanceof Error?e.message:String(e))})},[]);async function w(){u(!0);try{let e=await N9();c(e.data||[]),m(``)}catch(e){m(e instanceof Error?e.message:String(e))}finally{u(!1)}}(0,v.useEffect)(()=>{let e=window.setTimeout(()=>void w(),0);return()=>window.clearTimeout(e)},[]);async function T(e){await Z7(e),C(!0),window.setTimeout(()=>C(!1),1200)}async function E(e,t){f(e.id),c(n=>n.map(n=>n.id===e.id?{...n,enabled:t}:n));try{let n=await P9(e.id,{enabled:t});c(t=>t.map(t=>t.id===e.id?{...t,...n,secret:void 0}:t))}catch(e){m(e instanceof Error?e.message:String(e)),await w()}finally{f(``)}}async function D(t){f(t.id);try{await BTe(t.id),c(e=>e.filter(e=>e.id!==t.id)),pV({type:`success`,title:e(`toastKeyDeleted`)})}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(``)}}return l&&!s.length?(0,G.jsx)(Pce,{}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:e(`navKeys`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`keysLead`)})]}),(0,G.jsxs)(J,{size:`sm`,isDisabled:!r,onPress:()=>g(!0),children:[(0,G.jsx)(Ma,{size:14}),e(`keysCreate`)]})]}),p?(0,G.jsx)(xI,{title:p}):null,a?(0,G.jsx)(xI,{title:e(`keysProvidersLoadFailed`,{message:a})}):null,l?(0,G.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:Math.max(3,s.length)},(e,t)=>(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-3`,children:[(0,G.jsx)(Q,{className:`h-4 w-28`}),(0,G.jsx)(Q,{className:`mt-2 h-3 w-40`}),(0,G.jsx)(Q,{className:`mt-4 h-6 w-24`}),(0,G.jsx)(Q,{className:`mt-6 h-8 w-full`})]},t))}):s.length?(0,G.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,children:s.map(t=>(0,G.jsxs)(CS,{className:`overflow-hidden p-0`,children:[(0,G.jsxs)(CS.Header,{className:`flex-row items-start justify-between gap-3 px-3 pt-3 pb-2.5`,children:[(0,G.jsx)(`div`,{className:`min-w-0`,children:(0,G.jsx)(CS.Title,{className:`truncate text-body`,children:t.name})}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:t.enabled?`success`:`default`,children:t.enabled?e(`enabled`):e(`disabled`)})]}),(0,G.jsxs)(CS.Content,{className:`space-y-2.5 px-3 pb-2.5`,children:[(0,G.jsx)(`div`,{className:`mono w-full rounded-lg bg-surface-secondary px-3 py-2 text-body text-foreground`,title:t.prefix,children:t.prefix}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:(t.providers.length?t.providers:[`all`]).map(t=>(0,G.jsx)(BS,{size:`sm`,variant:`soft`,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[t===`all`?(0,G.jsx)(ua,{size:12}):(0,G.jsx)(XV,{provider:xEe(t),size:12}),(0,G.jsx)(`span`,{children:t===`all`?e(`keysAllProviders`):Q9(t,e)})]})},t))}),(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:t.last_used_at?e(`keysLastUsed`,{time:wEe(t.last_used_at)}):e(`keysNeverUsed`)})]}),(0,G.jsxs)(CS.Footer,{className:`gap-1.5 bg-surface-secondary px-3 py-2`,children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isDisabled:!r,onPress:()=>y(t),children:e(`edit`)}),(0,G.jsx)(yEe,{label:e(`holdToDelete`),isPending:d===t.id,onConfirm:()=>void D(t),children:(0,G.jsx)(io,{size:14})}),(0,G.jsx)(`div`,{className:`ml-auto`,children:(0,G.jsx)(h7,{isSelected:t.enabled,isDisabled:d===t.id,ariaLabel:e(`enable`),onChange:e=>void E(t,e)})})]})]},t.id))}):(0,G.jsx)(I7,{className:`rounded-3xl bg-surface-secondary`,icon:(0,G.jsx)(QB,{size:28}),title:e(`keysEmpty`),hint:e(`keysEmptyHint`),action:(0,G.jsxs)(J,{size:`sm`,isDisabled:!r,onPress:()=>g(!0),children:[(0,G.jsx)(Ma,{size:14}),e(`keysCreate`)]})}),(0,G.jsx)($9,{isOpen:h,title:e(`keysCreateTitle`),hint:e(`keysCreateHint`),options:t,t:e,onClose:()=>g(!1),onSave:async e=>{let t=await zTe(e);c(e=>[t,...e.map(e=>({...e,secret:void 0}))]),g(!1),x(t)}}),(0,G.jsx)($9,{isOpen:!!_,title:e(`keysEditTitle`),hint:e(`keysEditHint`),initial:_,options:t,t:e,onClose:()=>y(null),onSave:async e=>{if(!_)return;let t=await P9(_.id,e);c(e=>e.map(e=>e.id===_.id?{...e,...t,secret:void 0}:e)),y(null)}}),(0,G.jsx)(Y.Root,{isOpen:!!b?.secret,onOpenChange:e=>{e||x(null)},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`lg`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`keysSecretTitle`)}),(0,G.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:e(`keysSecretHint`)})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":e(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(yo,{size:18})})]}),(0,G.jsxs)(Y.Body,{className:`px-6 pb-2`,children:[(0,G.jsxs)(_P,{status:`warning`,className:`mb-4`,children:[(0,G.jsx)(_P.Indicator,{}),(0,G.jsx)(_P.Content,{children:(0,G.jsx)(_P.Title,{children:e(`keysSecretOnce`)})})]}),(0,G.jsx)(`code`,{className:`mono block break-all rounded-lg bg-surface-secondary px-3 py-3 text-body`,children:b?.secret})]}),(0,G.jsxs)(Y.Footer,{className:`justify-end`,children:[(0,G.jsx)(J,{variant:`ghost`,onPress:()=>x(null),children:e(`close`)}),(0,G.jsxs)(J,{onPress:()=>{b?.secret&&T(b.secret)},children:[(0,G.jsx)(Ii,{size:14}),e(S?`copied`:`copy`)]})]})]})})})})]})}function $9({isOpen:e,title:t,hint:n,initial:r,options:i,t:a,onClose:o,onSave:s}){let[c,l]=(0,v.useState)(r?.name||``),[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)(new Set),[m,h]=(0,v.useState)(!0),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(!e)return;l(r?.name||``),d(SEe(r?.providers||[],i));let t=new Set((r?.providers||[]).filter(e=>!e.includes(`:`)).map(e=>e.toLowerCase()));p(t),h(!0),_(``)},[r,e,i]);function x(e){let t=i.find(t=>t.value===e);h(!1),d(n=>n.includes(e)?(t&&p(e=>{let n=new Set(e);return n.delete(t.provider),n}),n.filter(t=>t!==e)):[...n,e])}async function S(e){e?.preventDefault();let t=c.trim();if(!t){_(a(`keysNameRequired`));return}if(!i.length){_(a(`keysProvidersNotLoaded`));return}b(!0),_(``);try{await s({name:t,providers:m?r?.providers||[]:u})}catch(e){_(e instanceof Error?e.message:String(e))}finally{b(!1)}}return(0,G.jsx)(Y.Root,{isOpen:e,onOpenChange:e=>{!e&&!y&&o()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,G.jsx)(Y.Dialog,{className:`sm:min-w-[32rem]`,children:(0,G.jsxs)(mP,{onSubmit:S,children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:t}),(0,G.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:n})]}),(0,G.jsx)(Y.CloseTrigger,{isDisabled:y,"aria-label":a(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(yo,{size:18})})]}),(0,G.jsxs)(Y.Body,{className:`space-y-5 px-6 pb-2 pt-1`,children:[g?(0,G.jsxs)(_P,{status:`danger`,children:[(0,G.jsx)(_P.Indicator,{}),(0,G.jsx)(_P.Content,{children:(0,G.jsx)(_P.Title,{children:g})})]}):null,(0,G.jsx)(_9,{label:a(`keysName`),children:(0,G.jsx)(Rj,{value:c,onChange:e=>l(e.target.value),placeholder:a(`keysNamePh`),"aria-label":a(`keysName`)})}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(jM,{className:`text-body font-medium text-muted`,children:a(`keysProviders`)}),(0,G.jsx)(NM,{className:`text-caption leading-5 text-muted`,children:a(`keysProvidersHint`)}),i.length?(0,G.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:i.map(e=>{let t=u.includes(e.value),n=f.has(e.provider);return(0,G.jsx)(IS,{isSelected:t,onChange:()=>x(e.value),className:`rounded-xl bg-surface-secondary px-3 py-2.5 data-selected:border-accent data-selected:bg-accent-soft`,children:(0,G.jsxs)(IS.Content,{className:`flex items-center gap-2.5`,children:[(0,G.jsx)(IS.Control,{children:(0,G.jsx)(IS.Indicator,{})}),(0,G.jsx)(XV,{provider:e.provider,size:16}),(0,G.jsx)(`span`,{className:`text-body font-medium`,children:YV(e.provider,e.region,a)}),n?(0,G.jsx)(`span`,{className:`rounded-md bg-surface-secondary px-1.5 py-0.5 text-caption font-medium text-muted`,children:a(`keysAllRegions`)}):null]})},e.value)})}):(0,G.jsx)(`p`,{className:`rounded-lg bg-surface-secondary px-3 py-2.5 text-caption leading-5 text-muted`,children:a(`keysProvidersNotLoaded`)}),(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:CEe(u,a)})]})]}),(0,G.jsxs)(Y.Footer,{className:`justify-end`,children:[(0,G.jsx)(J,{variant:`ghost`,isDisabled:y,onPress:o,children:a(`cancel`)}),(0,G.jsx)(J,{type:`submit`,isPending:y,isDisabled:!i.length,children:a(r?`save`:`create`)})]})]})})})})})}function EEe(){return(0,G.jsx)(mse,{children:(0,G.jsx)(Yoe,{children:(0,G.jsx)(Xoe,{children:(0,G.jsx)(fse,{children:(0,G.jsx)(xn,{children:(0,G.jsxs)(Pt,{children:[(0,G.jsx)(Mt,{path:`/login`,element:(0,G.jsx)(RTe,{})}),(0,G.jsx)(Mt,{element:(0,G.jsx)(tle,{}),children:(0,G.jsxs)(Mt,{element:(0,G.jsx)(ele,{}),children:[(0,G.jsx)(Mt,{path:`/`,element:(0,G.jsx)(ewe,{})}),(0,G.jsx)(Mt,{path:`/auth`,element:(0,G.jsx)(At,{to:`/accounts`,replace:!0})}),(0,G.jsx)(Mt,{path:`/providers`,element:(0,G.jsx)(lwe,{})}),(0,G.jsx)(Mt,{path:`/access`,element:(0,G.jsx)(Iwe,{})}),(0,G.jsx)(Mt,{path:`/accounts`,element:(0,G.jsx)(LTe,{})}),(0,G.jsx)(Mt,{path:`/checkins`,element:(0,G.jsx)(At,{to:`/accounts`,replace:!0})}),(0,G.jsx)(Mt,{path:`/usage`,element:(0,G.jsx)(_Ee,{})}),(0,G.jsx)(Mt,{path:`/logs`,element:(0,G.jsx)(iEe,{})}),(0,G.jsx)(Mt,{path:`/keys`,element:(0,G.jsx)(TEe,{})}),(0,G.jsx)(Mt,{path:`/system`,element:(0,G.jsx)(JTe,{})}),(0,G.jsx)(Mt,{path:`*`,element:(0,G.jsx)(At,{to:`/`,replace:!0})})]})})]})})})})})})}(0,y.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(v.StrictMode,{children:(0,G.jsx)(EEe,{})}));export{oY as $,RU as $t,S_e as A,YW as At,i4 as B,jW as Bt,b6 as C,h as Cn,QW as Ct,g3 as D,NW as Dt,nve as E,RW as Et,z4 as F,IW as Ft,jZ as G,UW as Gt,g2 as H,WW as Ht,B4 as I,MW as It,vZ as J,DW as Jt,wZ as K,kW as Kt,Fge as L,BW as Lt,w_e as M,qW as Mt,C_e as N,JW as Nt,B_e as O,VW as Ot,Z4 as P,KW as Pt,IY as Q,IU as Qt,Age as R,AW as Rt,w6 as S,Is as Sn,$W as St,h6 as T,l as Tn,zW as Tt,t2 as U,GW as Ut,r4 as V,PW as Vt,eQ as W,HW as Wt,GY as X,nde as Xt,oX as Y,EW as Yt,WY as Z,PU as Zt,P6 as _,gV as _n,$ as _t,t5 as a,DU as an,eY as at,E6 as b,Z as bn,tG as bt,F8 as c,xU as cn,qq as ct,h8 as d,mU as dn,Lq as dt,MU as en,aY as et,Q6 as f,fU as fn,Yq as ft,L6 as g,CV as gn,pG as gt,B6 as h,kV as hn,Dq as ht,l5 as i,EU as in,tY as it,a3 as j,XW as jt,d3 as k,FW as kt,j8 as l,bU as ln,Vq as lt,W6 as m,AV as mn,Fq as mt,o7 as n,OU as nn,iY as nt,L8 as o,TU as on,TJ as ot,Y6 as p,pU as pn,Nq as pt,EZ as q,OW as qt,m5 as r,VU as rn,rY as rt,I8 as s,wU as sn,yJ as st,s7 as t,jU as tn,sY as tt,C8 as u,vU as un,Iq as ut,N6 as v,TV as vn,rG as vt,f6 as w,d as wn,ude as wt,T6 as x,qc as xn,eG as xt,O6 as y,_V as yn,aG as yt,Oge as z,LW as zt}; \ No newline at end of file + -d ${o9(JSON.stringify(me))}`,[me,T,oe]);if(n&&!t)return(0,G.jsx)(Fce,{});async function ge(e,t){await Z7(e),ae(t),window.setTimeout(()=>ae(``),1100)}async function _e(){let e=performance.now();te(`loading`),re(null),V(``);try{let e=await ise(w,me,oe||void 0);V(JSON.stringify(e,null,2)),te(`success`)}catch(e){V(e instanceof Error?e.message:String(e)),te(`error`)}finally{re(Math.round(performance.now()-e))}}function ve(){z.current?.abort(),z.current=null}function ye(e){let t=p;u(n=>n.map(n=>{if(n.id!==t)return n;let r=typeof e==`function`?e(n.messages):e;return{...n,messages:r,title:l9(r)||n.title,updatedAt:Date.now()}}))}function be(e,t){ye(n=>n.map(n=>{if(n.id!==e)return n;let r=typeof t==`function`?t(n):t;return{...n,...r}}))}async function xe(){let e=P.trim();if(!e&&!I.length||!fe||le||ee===`loading`)return;ve();let t=new AbortController;z.current=t;let n=I,r={id:s9(`user`),role:`user`,content:e,attachments:n,status:`done`},i=s9(`assistant`),a={id:i,role:`assistant`,provider:_.find(e=>e.id===oe)?.provider||ce.find(e=>e.id===fe)?.provider||``,content:``,status:`streaming`},o=m;ye([...o,r,a]),F(``),L([]),R(`loading`);let s=jwe(o,{role:`user`,content:i9(e,n)}),c=performance.now(),l=null,u=()=>{l??=performance.now()},d=()=>{let e=performance.now();return{latency_ms:Math.max(0,Math.round(e-c)),ttfb_ms:l==null?void 0:Math.max(0,Math.round(l-c))}};try{await sse(fe,s,oe||void 0,{signal:t.signal,onContent:(e,t)=>{e&&u(),be(i,{content:t})},onReasoning:(e,t)=>{e&&u(),be(i,{reasoning:t})},onToolCalls:e=>{u(),be(i,{toolCalls:Pwe(e,!0)})},onUsage:e=>be(i,{usage:e})}),be(i,e=>({status:`done`,...d(),toolCalls:e.toolCalls?.map(e=>({...e,status:`success`}))})),R(`success`)}catch(e){if(t.signal.aborted){be(i,e=>({status:`done`,...d(),toolCalls:e.toolCalls?.map(e=>({...e,status:`success`}))})),R(`success`);return}be(i,{status:`error`,error:e instanceof Error?e.message:String(e),...d()}),R(`error`)}finally{z.current===t&&(z.current=null)}}let Se=e(H===`success`?`requestComplete`:H===`error`?`requestFailed`:H===`loading`?`requesting`:`requestIdle`),Ce=c9()!=null,we=[{id:`auto`,textValue:e(`autoAccount`),label:e(`autoAccount`),icon:(0,G.jsx)(oi,{size:14,className:`text-muted`})},..._.map(t=>({id:t.id,textValue:`${t.name||t.id} ${YV(t.provider,t.region,e)}`,label:t.name||t.id,hint:YV(t.provider,t.region,e),icon:(0,G.jsx)(XV,{provider:t.provider,size:14})}))],Te=_.length||!Ce?we:[{id:`auto`,textValue:e(`autoAccount`),label:e(`autoAccount`),icon:(0,G.jsx)(oi,{size:14,className:`text-muted`})},{id:`demo-wb`,textValue:`wb-demo WorkBuddy`,label:`wb-demo`,hint:`WorkBuddy`}],Ee=ce.map(t=>{let n=bV(t),r=xV(t),i=t.display_name||t.id,a=r?e(`modelFree`):n,o=t.provider||t.owned_by||``;return{id:t.id,textValue:`${i} ${t.id} ${o} ${n} ${r?`free`:``}`,label:a?`${i} ${a}`:i,hint:[t.id,o,a].filter(Boolean).join(` · `)}}),De=Ee.length||!Ce?Ee:d9.map(t=>{let n=bV(t),r=xV(t),i=t.display_name||t.id,a=r?e(`modelFree`):n;return{id:t.id,textValue:`${i} ${t.id} ${t.provider} ${n} ${r?`free`:``}`,label:a?`${i} ${a}`:i,hint:[t.id,t.provider,a].filter(Boolean).join(` · `)}}),Oe=!!((P.trim()||I.length)&&fe&&!le&&(_.length||Ce));function ke(){ye(a9()),R(`idle`)}function Ae(){ve(),R(`idle`),F(``),L([]);let e=u9([]);u(t=>[e,...t]),f(e.id)}function je(e){e!==p&&(ve(),R(`idle`),F(``),L([]),f(e))}let Me=l.slice().sort((e,t)=>t.updatedAt-e.updatedAt).map(t=>({id:t.id,title:t.title||e(`chatHistoryUntitled`),updatedAt:t.updatedAt}));return(0,G.jsxs)(`div`,{className:`access-page space-y-4`,children:[(0,G.jsxs)(`section`,{className:`access-info-row flex flex-wrap items-center gap-x-3 gap-y-2 px-0.5 py-0.5`,title:e(`apiPlaygroundHint`),children:[(0,G.jsx)(`h2`,{className:`shrink-0 text-body font-semibold text-foreground`,children:e(`apiPlayground`)}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5 text-caption text-muted`,children:[(0,G.jsx)(`span`,{className:`shrink-0`,children:e(`baseUrl`)}),(0,G.jsx)(`code`,{className:`mono min-w-0 truncate font-medium text-foreground`,children:b}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-6 min-w-6 shrink-0`,"aria-label":e(`copyBaseUrl`),onPress:()=>void ge(b,`base`),children:(0,G.jsx)(X7,{copied:ie===`base`,size:13})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-caption text-muted`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":pe.length?`ok`:void 0}),(0,G.jsx)(`span`,{children:e(`readyAccounts`,{ready:pe.length,total:_.length})}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:pe.length?`success`:`warning`,children:pe.length?e(`endpointReady`):e(`degraded`)})]})]}),_.length?null:(0,G.jsxs)(`div`,{className:`space-y-1 px-1`,children:[(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:e(`noAccountsForTest`)}),(0,G.jsx)(e9,{})]}),ue?(0,G.jsx)(`p`,{className:`px-1 text-caption text-danger`,children:ue}):null,(0,G.jsxs)(OA,{selectedKey:r,onSelectionChange:e=>i(String(e)),children:[(0,G.jsx)(OA.ListContainer,{className:`w-fit`,children:(0,G.jsxs)(OA.List,{"aria-label":e(`accessTabsLabel`),children:[(0,G.jsxs)(DA,{id:`chat`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),e(`accessTabChat`)]}),(0,G.jsxs)(DA,{id:`raw`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),e(`accessTabApi`)]})]})}),(0,G.jsx)(OA.Panel,{id:`chat`,className:`pt-4`,children:(0,G.jsxs)(`div`,{className:`flex min-h-[640px] md:min-h-[72vh]`,children:[(0,G.jsx)(vwe,{collapsed:s,onCollapsedChange:c,items:Me,activeId:p,onSelect:je,onNew:Ae}),(0,G.jsxs)(`div`,{className:`access-chat-stage flex min-w-0 flex-1 flex-col`,children:[(0,G.jsx)(kwe,{messages:m,busy:ee===`loading`,onLoadDemo:ke}),(0,G.jsx)(_we,{value:P,onChange:F,attachments:I,onAttachmentsChange:L,disabled:!_.length&&c9()==null,streaming:ee===`loading`,canSend:Oe,onSend:()=>void xe(),onStop:ve,accountValue:oe||`auto`,onAccountChange:e=>k(e===`auto`?``:e),accountOptions:Te,modelValue:fe,onModelChange:D,modelOptions:De,modelsLoading:le})]})]})}),(0,G.jsxs)(OA.Panel,{id:`raw`,className:`space-y-4 pt-4`,children:[(0,G.jsx)(Awe,{format:a,onFormatChange:o,requestPath:w,prompt:M,onPromptChange:N,onTest:()=>void _e(),requestState:H,elapsedMs:ne,output:B,responseStatus:Se,curl:he,copiedCurl:ie===`curl`,onCopyCurl:()=>void ge(he,`curl`),canSend:!!(M.trim()&&fe&&!le),accountValue:oe||`auto`,onAccountChange:e=>k(e===`auto`?``:e),accountOptions:Te,modelValue:fe,onModelChange:D,modelOptions:De,modelsLoading:le,disabled:!_.length&&c9()==null}),(0,G.jsx)(uwe,{access:t?.access})]})]})]})}function Lwe(e){(0,v.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=Z.context(()=>{Z.matchMedia().add(`(prefers-reduced-motion: no-preference)`,()=>{let e=Z.utils.toArray(`.meter__fill`);e.length&&Z.from(e,{scaleX:0,transformOrigin:`left center`,duration:WB.calm,ease:GB.emphasized,stagger:KB.base,clearProps:`transform,transformOrigin`})})},t);return()=>n.revert()},[e])}function f9(e){if(!e)return``;let t=Date.parse(e)-Date.now();if(!Number.isFinite(t)||t<=0)return``;let n=Math.ceil(t/1e3);return n<60?`${n}s`:`${Math.ceil(n/60)}m`}function Rwe(e){return Object.entries(e.model_cooldowns??{}).filter(([,e])=>!!f9(e)).sort(([e],[t])=>e.localeCompare(t))}function p9(e){return e.enabled?e.status===`quota_exhausted`||e.quota?.exceeded?`quota_exhausted`:e.status===`cooling`||f9(e.down_until||e.cooldown_until)?`cooling`:e.status===`dead`||e.runtime_state===`dead`?`dead`:e.status===`auth_failed`||e.runtime_state===`auth_failed`?`auth_failed`:e.status===`login_required`?`login`:(e.status===`starting`||e.runtime_state===`starting`)&&!e.hot&&!e.ready?e.quota?`starting`:`loading`:e.status===`ready`?e.hot?`hot`:`ready`:e.hot?`hot`:e.ready?`ready`:(e.status===`error`||e.status,`unavailable`):`disabled`}function zwe(e){return e===`hot`?12:e===`ready`?9:e===`cooling`?5:e===`login`?3:e===`loading`||e===`starting`?6:e===`unavailable`?2:e===`auth_failed`?3:e===`dead`?2:1}function Bwe(e){return e===`hot`||e===`ready`?`ok`:e===`cooling`||e===`quota_exhausted`||e===`loading`||e===`starting`?`warn`:e===`auth_failed`||e===`unavailable`||e===`dead`||e===`login`?`danger`:`muted`}function m9(e){return e==null||!Number.isFinite(e)?`—`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(Math.round(e*100)/100)}function h9(e){let t=e.percentage??0;return Number.isFinite(t)?Math.min(1,Math.max(0,t/100)):0}function g9(e){let t=e.percentage??0;return e.exceeded?`danger`:t>=80?`warn`:`ok`}function Vwe(e){return(e.windows??[]).filter(e=>!!e.id)}var Hwe={free:`Free`,go:`Go`,plus:`Plus`,pro:`Pro`,prolite:`Pro Lite`,promax:`Pro Max`,team:`Team`,business:`Business`,enterprise:`Enterprise`,edu:`Edu`,edu_plus:`Edu Plus`,edu_pro:`Edu Pro`,education:`Education`};function Uwe(e){let t=e?.trim().toLowerCase()??``;return!t||t===`unknown`||t===`guest`?``:Hwe[t]??t.replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Wwe(e,t){return e.id===`daily`?t(`quotaDaily`):e.id===`weekly`?t(`quotaWeekly`):e.id===`monthly`?t(`quotaMonthly`):e.id===`fiveHour`?t(`quotaFiveHour`):e.id===`weeklyLimit`?t(`quotaWeeklyLimit`):e.id===`monthlyLimit`?t(`quotaMonthlyLimit`):e.label||t(`quota`)}function Gwe(e,t){if(!e)return``;let n=Date.parse(e)-Date.now();if(!Number.isFinite(n)||n<=0)return t(`quotaResetsSoon`);let r=Math.max(1,Math.ceil(n/6e4));return r<60?t(`quotaResetsInMinutes`,{n:r}):t(`quotaResetsInHours`,{n:Math.round(r/60)})}function Kwe(e,t){if(!e.expires_at||e.expires_at<=0||!Number.isFinite(e.expires_at))return``;let n=new Date(e.expires_at*1e3);if(Number.isNaN(n.getTime()))return``;let r=`${n.getFullYear()}/${n.getMonth()+1}/${n.getDate()}`;return t(`quotaExpiresOn`,{amount:e.expiring_remain&&e.expiring_remain>0?`${m9(e.expiring_remain)} `:``,unit:e.unit||`credits`,date:r})}function qwe(e,t,n,r,i,a){return[e.has_add_on&&e.add_on_available!==!1?`${n} ${m9(e.add_on_used)} / ${m9(e.add_on_total)} ${e.add_on_unit||`credits`}`:``,e.has_resource_package&&e.resource_package_available!==!1?`${r} ${t} ${m9(e.resource_package_remaining)} ${e.resource_package_unit||`credits`}`:``,a===`workbuddy`?Kwe(e,i):``].filter(Boolean)}function Jwe({window:e,t,extra:n}){let r=Math.round(e.percentage??0),i=Wwe(e,t),a=t(`quotaUsedPercent`,{n:r}),o=Gwe(e.reset_at,t),s=`${i} · ${a}${o?` · ${o}`:``}`,c=h9(e),l=g9(e),u=l===`danger`?`danger`:l===`warn`?`warning`:`success`;return(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{className:`block w-full min-w-0`,children:(0,G.jsxs)(`div`,{className:`w-full min-w-0 cursor-help`,children:[(0,G.jsxs)(QP,{className:`account-meter account-meter--window w-full`,color:u,size:`md`,minValue:0,maxValue:100,value:Math.round(c*100),"aria-label":i,valueLabel:s,children:[(0,G.jsxs)(QP.Output,{className:`flex w-full items-baseline justify-between gap-3 text-caption`,children:[(0,G.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:i}),(0,G.jsx)(`span`,{className:`mono shrink-0 text-foreground/70`,children:a})]}),(0,G.jsx)(QP.Track,{children:(0,G.jsx)(QP.Fill,{})})]}),o?(0,G.jsx)(`div`,{className:`mt-1 text-caption leading-4 text-muted`,children:o}):null]})}),(0,G.jsx)(Mj.Content,{children:(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsx)(`div`,{children:s}),n?.map(e=>(0,G.jsx)(`div`,{children:e},e))]})})]})}function Ywe({quota:e,t,label:n,usedLabel:r,remainingLabel:i,addOnLabel:a,resourcePackageLabel:o,exceededLabel:s,provider:c}){let l=e.unit||`credits`,u=`${m9(e.used)} / ${m9(e.total)}`,d=`${m9(e.remaining)}`,f=qwe(e,i,a,o,t,c),p=Vwe(e),m=c===`codex`?Uwe(e.plan):``,h=h9(e),g=g9(e),_=g===`danger`?`danger`:g===`warn`?`warning`:`success`,y=(0,v.useRef)(null);Lwe(y);let b=`${r} ${u} ${l} · ${i} ${d} ${l}${f.length?` · ${f.join(` · `)}`:``}`;return p.length>0?(0,G.jsxs)(`div`,{ref:y,className:`account-quota-windows flex w-full min-w-0 flex-col gap-3`,children:[m?(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-caption`,children:[(0,G.jsx)(`span`,{className:`text-muted`,children:t(`quotaPlan`)}),(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:m})]}):null,p.map((e,n)=>(0,G.jsx)(`div`,{className:`w-full min-w-0`,children:(0,G.jsx)(Jwe,{window:e,t,extra:n===0?f:void 0})},e.id||String(n)))]}):(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(`div`,{ref:y,className:`w-full cursor-help`,children:(0,G.jsxs)(QP,{className:`account-meter w-full`,color:_,size:`md`,minValue:0,maxValue:100,value:Math.round(h*100),"aria-label":n,valueLabel:b,children:[(0,G.jsxs)(QP.Output,{className:`flex w-full items-baseline justify-between text-caption`,children:[(0,G.jsxs)(`span`,{className:`text-body font-semibold leading-5 text-foreground tabular-nums`,children:[e.exceeded?(0,G.jsx)(`span`,{className:`mr-1.5 text-danger`,children:s}):null,d,(0,G.jsx)(`span`,{className:`ml-1 text-caption font-normal text-foreground/60`,children:l})]}),(0,G.jsxs)(`span`,{className:`mono text-foreground/55`,children:[r,` `,u]})]}),(0,G.jsx)(QP.Track,{children:(0,G.jsx)(QP.Fill,{})})]})})}),(0,G.jsx)(Mj.Content,{children:(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsxs)(`div`,{children:[r,` `,u,` `,l]}),(0,G.jsxs)(`div`,{children:[i,` `,d,` `,l]}),f.map(e=>(0,G.jsx)(`div`,{children:e},e))]})})]})}function Xwe({state:e,stateCopy:t,t:n}){let r=(0,v.useRef)(null),i=zwe(e),a=Bwe(e);return(0,v.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=Z.context(()=>{let e=Z.utils.toArray(`[data-runtime-seg]`),t=e.filter((e,t)=>tt>=i),r=Z.matchMedia();r.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(t,{scaleY:1,autoAlpha:1}),Z.set(n,{scaleY:.32,autoAlpha:.45})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{Z.set(e,{transformOrigin:`center bottom`}),Z.to(n,{scaleY:.32,autoAlpha:.45,duration:WB.fast,ease:GB.out,overwrite:!0}),Z.to(t,{scaleY:1,autoAlpha:1,duration:WB.base,ease:GB.out,stagger:{amount:.08,from:`start`},overwrite:!0})})},e);return()=>t.revert()},[i,e]),(0,G.jsxs)(`div`,{ref:r,className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-caption font-medium text-foreground/75`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":a===`muted`?void 0:a===`warn`?`warn`:a}),(0,G.jsx)(`span`,{children:n(`runtimeState`)})]}),(0,G.jsx)(`div`,{className:`runtime-meter min-w-[80px] flex-1`,role:`meter`,"aria-label":n(`runtimeState`),"aria-valuemin":0,"aria-valuemax":12,"aria-valuenow":i,"aria-valuetext":t,children:Array.from({length:12},(e,t)=>(0,G.jsx)(`span`,{"data-runtime-seg":!0,"data-on":t{if(!F&&!I&&L.length===0)return;let e=window.setInterval(()=>N(e=>e+1),1e3);return()=>window.clearInterval(e)},[F,I,L.length]);let[ee,R]=(0,v.useState)(null),[z,B]=(0,v.useState)(null),V=(0,v.useRef)(null),H=S&&S!==ee?S:null,te=!!H&&z===H;(0,v.useEffect)(()=>{if(S)return V.current&&window.clearTimeout(V.current),V.current=window.setTimeout(()=>R(S),3e3),()=>{V.current&&window.clearTimeout(V.current)}},[S]);let ne=Zwe(P,P===`dead`?I:F,o),re=P===`hot`||P===`ready`?`success`:P===`cooling`?`warning`:P===`quota_exhausted`||P===`login`||P===`unavailable`||P===`dead`||P===`auth_failed`?`danger`:void 0,ie=e.last_error||e.lastError,ae=e.last_error_kind||e.kind,oe=YV(e.provider,e.region,o),se=e.last_checkin_status,ce=se===`success`?`checkinRecordSuccess`:se===`already`?`checkinRecordAlready`:se===`skipped`?`checkinRecordSkipped`:se===`error`?`checkinRecordFailed`:`lastCheckinNone`;return(0,v.useLayoutEffect)(()=>{let e=E.current;if(!e)return;let t=M.current;if(M.current=P,!t||t===P)return;let n=Z.context(()=>{let t=Z.matchMedia();t.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(e,{scale:1,autoAlpha:1})}),t.add(`(prefers-reduced-motion: no-preference)`,()=>{Z.fromTo(e,{scale:.94,autoAlpha:.65},{scale:1,autoAlpha:1,duration:.2,ease:`power2.out`,overwrite:!0})})},e);return()=>n.revert()},[P]),(0,v.useLayoutEffect)(()=>{let e=D.current;if(!e||!n)return;let t=Z.context(()=>{let t=Z.matchMedia();t.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(e,{autoAlpha:1,y:0})}),t.add(`(prefers-reduced-motion: no-preference)`,()=>{Z.fromTo(e,{autoAlpha:0,y:-6},{autoAlpha:1,y:0,duration:.2,ease:`power3.out`,overwrite:!0})})},e);return()=>t.revert()},[n]),(0,G.jsxs)(CS,{"data-gsap-reveal":!0,"data-state":P,className:`account-card overflow-hidden p-0`,children:[(0,G.jsxs)(CS.Header,{className:`flex-row items-start justify-between gap-2.5 px-4 pt-3.5 pb-2`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,G.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-tertiary`,children:(0,G.jsx)(XV,{provider:e.provider,size:20})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(CS.Title,{className:`truncate text-body leading-5`,children:e.name||e.id}),(0,G.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-secondary px-1.5 py-px text-caption text-muted`,children:oe})]}),(0,G.jsx)(CS.Description,{className:`mono truncate text-caption leading-4 text-foreground/60`,title:`${e.id}${e.remote_uid?` · UID ${e.remote_uid}`:``}`,children:e.remote_uid?`UID ${e.remote_uid}`:e.id})]})]}),(0,G.jsxs)(`div`,{className:`flex max-w-[48%] shrink-0 flex-wrap justify-end gap-1.5`,children:[(0,G.jsx)(`span`,{ref:E,children:L.length&&P===`cooling`?(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(`span`,{className:`inline-flex cursor-help`,children:(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:re,children:ne})})}),(0,G.jsx)(Mj.Content,{children:(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:o(`partialCooling`)}),L.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-caption`,children:[(0,G.jsx)(`span`,{children:e}),(0,G.jsx)(`span`,{className:`mono text-foreground/65`,children:f9(t)})]},e))]})})]}):(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:re,children:ne})}),L.length&&P!==`cooling`?(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(`span`,{className:`inline-flex cursor-help`,children:(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`warning`,children:o(`partialCooling`)})})}),(0,G.jsx)(Mj.Content,{children:(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:o(`partialCooling`)}),L.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-caption`,children:[(0,G.jsx)(`span`,{children:e}),(0,G.jsx)(`span`,{className:`mono text-foreground/65`,children:f9(t)})]},e))]})})]}):null]})]}),(0,G.jsxs)(CS.Content,{className:`gap-1.5 px-4 pb-3`,children:[(0,G.jsx)(Xwe,{state:P,stateCopy:ne,t:o}),e.quota?(0,G.jsx)(Ywe,{quota:e.quota,t:o,label:o(`quota`),usedLabel:o(`quotaUsed`),remainingLabel:o(`quotaRemaining`),addOnLabel:o(`quotaAddOn`),resourcePackageLabel:o(`quotaResourcePackage`),exceededLabel:o(`quotaExceeded`),provider:e.provider}):(0,G.jsx)(`span`,{className:`text-caption text-foreground/65`,children:o(P===`hot`||P===`ready`||P===`loading`||P===`starting`?`quotaLoading`:`quotaUnavailable`)}),ie?(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsxs)(`div`,{className:`flex w-full cursor-help gap-2 rounded-lg bg-surface-secondary p-2 text-left text-caption leading-5 text-foreground`,children:[(0,G.jsx)(ho,{size:14,className:`mt-0.5 shrink-0 text-danger`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[ae?(0,G.jsx)(`div`,{className:`mono mb-0.5 truncate text-caption opacity-75`,children:ae}):null,(0,G.jsx)(`p`,{className:`break-words line-clamp-3`,children:ie})]})]})}),(0,G.jsx)(Mj.Content,{children:(0,G.jsxs)(`div`,{className:`max-w-md whitespace-pre-wrap break-words`,children:[ae?(0,G.jsx)(`div`,{className:`mono mb-1 text-caption opacity-75`,children:ae}):null,ie]})})]}):null,H?(0,G.jsxs)(`div`,{className:`flex w-full items-start gap-2 rounded-lg bg-surface-secondary p-2 text-caption leading-5`,children:[H.kind===`success`?(0,G.jsx)(Oi,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-success`}):H.kind===`error`?(0,G.jsx)(xo,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-danger`}):(0,G.jsx)(ho,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-warning`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[H.kind===`success`?(0,G.jsx)(`span`,{className:`font-medium text-success`,children:o(`checkinRecordSuccess`)}):H.kind===`already`?(0,G.jsx)(`span`,{className:`font-medium text-warning`,children:o(`checkinRecordAlready`)}):H.kind===`skipped`?(0,G.jsx)(`span`,{className:`font-medium text-warning`,children:o(`checkinRecordSkipped`)}):(0,G.jsx)(`span`,{className:`font-medium text-danger`,children:o(`checkinRecordFailed`)}),H.message?(0,G.jsxs)(`div`,{className:`mt-0.5`,children:[(0,G.jsx)(`p`,{className:`break-words line-clamp-2 text-foreground/80`,children:H.message}),(0,G.jsxs)(`div`,{className:`mt-1 flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption text-muted`,children:o(`checkinTruncated`)}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,className:`h-6 min-w-0 gap-1 px-1.5 text-caption`,onPress:()=>{Z7(H.message||``).then(e=>{!e||!H||(B(H),window.setTimeout(()=>B(null),1100))})},children:[(0,G.jsx)(X7,{copied:te,size:13}),o(te?`copied`:`checkinCopyError`)]})]})]}):null]})]}):null]}),n&&e.enabled?(0,G.jsxs)(`section`,{ref:D,className:`grid gap-3 bg-surface-secondary/55 px-3 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:o(`oauthDeviceFlow`)}),(0,G.jsx)(`p`,{className:`mt-1.5 text-caption leading-5 text-muted`,children:e.provider===`codex`?o(`wizardCodexBrowserLead`):o(`qoderLoginHint`)}),(0,G.jsx)(`div`,{className:`mt-2.5 flex flex-wrap gap-2`,children:e.provider===`codex`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(J,{size:`sm`,isPending:t===`device`,onPress:()=>c(`cli`),children:[(0,G.jsx)(Ia,{size:14}),o(`startCodexCliLogin`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>c(`chatgpt`),children:[(0,G.jsx)(Ia,{size:14}),o(`startCodexChatGPTLogin`)]})]}):(0,G.jsxs)(J,{size:`sm`,isPending:t===`device`,onPress:()=>c(),children:[(0,G.jsx)(Ia,{size:14}),o(`startBrowserLogin`)]})}),(e.provider===`trae`||e.provider===`codex`||e.provider===`devin`)&&f&&d?(0,G.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-caption leading-4 text-muted`,children:o(`wizardCallbackLead`)}),(0,G.jsx)(Uj,{className:`h-24 w-full resize-none font-mono text-caption leading-5`,value:u||``,onChange:e=>d(e.target.value),placeholder:o(`wizardCallbackPh`),"aria-label":o(`wizardCallbackPh`)}),(0,G.jsx)(J,{size:`sm`,variant:`secondary`,isPending:t===`callback`,onPress:f,children:o(`wizardSubmitCallback`)})]}):null]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:o(`patFallback`)}),(0,G.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row`,children:[(0,G.jsxs)(Wj,{className:`flex-1`,type:`password`,value:a,onChange:s,children:[(0,G.jsx)(jM,{className:`sr-only`,children:o(`pat`)}),(0,G.jsx)(Rj,{placeholder:o(`pasteToken`),"aria-label":o(`pat`)})]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:t===`pat`,onPress:l,children:[(0,G.jsx)(ua,{size:14}),o(`usePat`)]})]})]}),r||i?(0,G.jsxs)(`div`,{className:`text-caption`,children:[r?(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:o(`authUrl`)}),(0,G.jsx)(`code`,{className:`mono block break-all text-foreground`,children:r}),(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,onPress:()=>window.open(r,`_blank`,`noopener,noreferrer`),children:[(0,G.jsx)(ni,{size:14}),o(`openAuthUrl`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>{Z7(r).then(e=>{e&&(k(!0),window.setTimeout(()=>k(!1),1100))})},children:[(0,G.jsx)(X7,{copied:O}),o(O?`copied`:`copy`)]})]})]}):null,i?(0,G.jsx)(`p`,{className:`mt-1 text-muted`,children:i}):null]}):null]}):null,b?(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-separator px-4 py-2 text-caption text-muted`,children:[(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsxs)(`span`,{className:`flex cursor-help items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:o(`lastCheckin`)}),(0,G.jsx)(`span`,{className:se===`error`?`text-danger`:``,children:o(ce)})]})}),(0,G.jsxs)(Mj.Content,{children:[e.last_checkin_at?new Date(e.last_checkin_at).toLocaleString():o(`lastCheckinNone`),e.last_checkin_msg?` · ${e.last_checkin_msg}`:``]})]}),(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsxs)(`span`,{className:`flex cursor-help items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:o(`autoCheckin`)}),(0,G.jsx)(`span`,{className:`mono text-caption text-foreground/55`,children:e.checkin_time||_}),(0,G.jsx)(h7,{isSelected:!!e.auto_checkin,isDisabled:!!t,ariaLabel:o(`autoCheckin`),onChange:e=>y?.(e)})]})}),(0,G.jsx)(Mj.Content,{children:e.checkin_time?o(`checkinCustom`):o(`checkinInherit`)})]})]}):null,(0,G.jsxs)(CS.Footer,{className:`flex flex-wrap items-center gap-1.5 bg-surface-secondary px-4 py-2`,children:[m?(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`secondary`,isPending:t===`refresh`,onPress:m,"aria-label":o(`refreshAccount`),children:(0,G.jsx)(Qr,{size:15})})}),(0,G.jsx)(Mj.Content,{children:o(`refreshAccount`)})]}):null,(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:n?`secondary`:`ghost`,isDisabled:!e.enabled,onPress:w,"aria-label":o(`authentication`),children:(0,G.jsx)(ua,{size:15})})}),(0,G.jsx)(Mj.Content,{children:o(`authentication`)})]}),(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:T,"aria-label":o(`accountModels`),children:(0,G.jsx)(Bi,{size:15})})}),(0,G.jsx)(Mj.Content,{children:o(`accountModels`)})]}),(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:C,"aria-label":o(`editAccount`),children:(0,G.jsx)(Oa,{size:15})})}),(0,G.jsx)(Mj.Content,{children:o(`editAccount`)})]}),b?(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,isDisabled:!e.enabled||!!t,isPending:t===`checkin`,onPress:b,"aria-label":o(`checkinNow`),children:(0,G.jsx)(fi,{size:15})})}),(0,G.jsx)(Mj.Content,{children:o(`checkinNow`)})]}):null,(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:A?`secondary`:`ghost`,onPress:()=>j(e=>!e),"aria-label":o(`modelCooldowns`),children:(0,G.jsx)(no,{size:15,className:L.length?`text-warning`:void 0})})}),(0,G.jsxs)(Mj.Content,{children:[o(`modelCooldowns`),L.length?` · ${L.length}`:``]})]}),(0,G.jsxs)(EP,{children:[(0,G.jsx)(EP.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`secondary`,"aria-label":o(`more`),children:(0,G.jsx)(Wi,{size:16})})}),(0,G.jsx)(EP.Popover,{placement:`bottom end`,children:(0,G.jsxs)(EP.Menu,{"aria-label":o(`more`),onAction:e=>{e===`export`&&p(),e===`checkin-records`&&x?.(),e===`delete`&&h()},children:[e.auth_type===`none`?null:(0,G.jsxs)(EP.Item,{id:`export`,textValue:o(`export`),children:[(0,G.jsx)(Ii,{size:15}),o(`export`)]}),x?(0,G.jsxs)(EP.Item,{id:`checkin-records`,textValue:o(`checkinRecords`),children:[(0,G.jsx)(ga,{size:15}),o(`checkinRecords`)]}):null,(0,G.jsxs)(EP.Item,{id:`delete`,textValue:o(`delete`),className:`text-danger`,children:[(0,G.jsx)(io,{size:15}),o(`delete`)]})]})})]}),(0,G.jsx)(`div`,{className:`ml-auto flex shrink-0 flex-nowrap items-center gap-3 whitespace-nowrap`,children:(0,G.jsx)(h7,{isSelected:!!e.enabled,isDisabled:t===`toggle`,ariaLabel:e.enabled?o(`disable`):o(`enable`),label:e.enabled?o(`enabledState`):o(`disabled`),onChange:g})})]}),A?(0,G.jsxs)(`section`,{className:`border-t border-separator bg-surface-secondary/55 px-4 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:o(`modelCooldownsTitle`)}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:L.length})]}),L.length?(0,G.jsx)(`div`,{className:`space-y-1`,children:L.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-surface px-2 py-1.5 text-caption`,children:[(0,G.jsx)(`span`,{className:`mono min-w-0 truncate`,title:e,children:e}),(0,G.jsx)(`span`,{className:`mono shrink-0 text-warning`,children:f9(t)})]},e))}):(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:o(`modelCooldownsEmpty`)})]}):null]})}function $we(e,t){return e.status===`success`?{label:t(`checkinRecordSuccess`),color:`success`}:e.status===`already`?{label:t(`checkinRecordAlready`),color:`warning`}:e.status===`skipped`?{label:t(`checkinRecordSkipped`),color:`default`}:{label:t(`checkinRecordFailed`),color:`danger`}}function eTe(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function tTe({account:e,t,onClose:n}){let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!!e?.id),[s,c]=(0,v.useState)(``),l=e?.id||``,u=t(`checkinRecordsTitle`,{name:e?.name||e?.id||``});async function d(){if(l){o(!0),c(``);try{let e=await lse(l);i(e.data||[])}catch(e){i([]),c(e instanceof Error?e.message:String(e))}finally{o(!1)}}}return(0,v.useEffect)(()=>{l&&d()},[l]),(0,G.jsx)(Y.Root,{isOpen:!!e,onOpenChange:e=>{e||n()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:u}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`checkinRecordsHint`)})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(yo,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`px-5 pb-2`,children:[s?(0,G.jsx)(`div`,{className:`mb-3`,children:(0,G.jsx)(xI,{title:s})}):null,a?(0,G.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,G.jsx)(Q,{className:`h-16 w-full`}),(0,G.jsx)(Q,{className:`h-16 w-full`}),(0,G.jsx)(Q,{className:`h-16 w-full`})]}):r.length?(0,G.jsx)(`div`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:r.map(e=>{let n=$we(e,t);return(0,G.jsxs)(`div`,{className:`flex items-start gap-3 px-3 py-3`,children:[(0,G.jsx)(`span`,{className:`status-dot mt-1.5 shrink-0`,"data-state":e.status===`error`?`warn`:`ok`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:n.color,children:n.label}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:eTe(e.created_at)})]}),(0,G.jsx)(`p`,{className:`mt-1 break-words text-caption leading-5 text-foreground/75`,children:e.message||`—`})]})]},e.id)})}):(0,G.jsx)(I7,{className:`min-h-44 rounded-3xl bg-surface-secondary`,title:t(`checkinRecordsEmpty`),hint:t(`checkinRecordsHint`)})]}),(0,G.jsxs)(Y.Footer,{className:`justify-between px-5 pb-5`,children:[(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:t(`checkinRecordsCount`,{count:r.length})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:n,children:t(`close`)}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:a,onPress:()=>void d(),children:[(0,G.jsx)(Qr,{size:14}),t(`refresh`)]})]})]})]})})})})}function nTe(e){let t=e.route_display_name||``;return t&&t!==(e.display_name||e.id)?t:``}function rTe({account:e,t,onClose:n}){let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!!e?.id),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(``),d=e?.id||``,f=t(`accountModelsTitle`,{name:e?.name||e?.id||``}),p=e?YV(e.provider,e.region,t):``;async function m(e=!1){if(d){e?c(!0):(o(!0),i([])),u(``);try{let t=await(e?uI(d):lI(d));i(t.data||[])}catch(e){i([]),u(e instanceof Error?e.message:String(e))}finally{o(!1),c(!1)}}}return(0,v.useEffect)(()=>{if(!d)return;let e=!1;return lI(d).then(t=>{e||(i(t.data||[]),u(``),o(!1))}).catch(t=>{e||(i([]),u(t instanceof Error?t.message:String(t)),o(!1))}),()=>{e=!0}},[d]),(0,G.jsx)(Y.Root,{isOpen:!!e,onOpenChange:e=>{e||n()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:f}),(0,G.jsx)(`p`,{className:`mt-1 text-caption font-normal leading-5 text-muted`,children:t(`accountModelsHint`)}),e?(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-caption text-muted`,children:[(0,G.jsx)(XV,{provider:e.provider,size:14}),(0,G.jsx)(`span`,{children:p}),(0,G.jsx)(`span`,{className:`text-border`,children:`·`}),(0,G.jsx)(`span`,{className:`mono`,children:e.id})]}):null]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(yo,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`px-5 pb-2`,children:[l?(0,G.jsx)(`div`,{className:`mb-3`,children:(0,G.jsx)(xI,{title:t(`accountModelsError`,{msg:l})})}):null,a||s?(0,G.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,G.jsx)(Q,{className:`h-14 w-full`}),(0,G.jsx)(Q,{className:`h-14 w-full`}),(0,G.jsx)(Q,{className:`h-14 w-full`})]}):r.length?(0,G.jsx)(`ul`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:r.map(n=>{let r=n.provider||n.owned_by||e?.provider||`qoder`,i=nTe(n),a=bV(n),o=xV(n);return(0,G.jsxs)(`li`,{className:`flex items-start gap-3 px-3 py-2.5`,children:[(0,G.jsx)(`span`,{className:`status-dot mt-1.5`,"data-state":n.stale?void 0:`ok`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-body font-medium`,children:n.display_name||n.id}),o?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null,a?(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:a}):null,n.stale?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`warning`,children:t(`fallback`)}):null]}),(0,G.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:n.id}),i?(0,G.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:t(`routedTo`,{model:i})}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 pt-0.5 text-caption text-muted`,children:[(0,G.jsx)(XV,{provider:r,size:12}),(0,G.jsx)(`span`,{children:r})]})]},n.id)})}):(0,G.jsx)(I7,{className:`min-h-48 rounded-3xl bg-surface-secondary`,icon:(0,G.jsx)(Bi,{size:22}),title:t(`accountModelsEmpty`),hint:t(`noModelsYet`)})]}),(0,G.jsxs)(Y.Footer,{className:`justify-between px-5 pb-5`,children:[(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:a?t(`refreshing`):t(`shownTotal`,{shown:r.length,total:r.length})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:n,children:t(`close`)}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:s,onPress:()=>void m(!0),children:[(0,G.jsx)(Qr,{size:14}),t(s?`refreshing`:`refresh`)]})]})]})]})})})})}var iTe=`w-28`;function _9({label:e,hint:t,labelWidthClass:n=iTe,htmlFor:r,align:i=`center`,children:a}){return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex gap-3 ${i===`start`?`items-start`:`items-center`}`,children:[(0,G.jsx)(jM,{htmlFor:r,className:`${n} shrink-0 ${i===`start`?`pt-2`:``} text-body font-medium text-foreground`,children:e}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1 [&_[data-slot=input]]:w-full [&_[data-slot=textarea]]:w-full`,children:a})]}),t?(0,G.jsx)(`p`,{className:`mt-1.5 pl-[7.75rem] text-caption leading-5 text-muted`,children:t}):null]})}function aTe({catalog:e,selected:t,onChange:n,isDisabled:r,t:i}){let[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(t),l=(0,v.useMemo)(()=>new Set(t),[t]),u=(0,v.useMemo)(()=>{let t=new Set(s),n=a.trim().toLowerCase(),r=(e||[]).filter(e=>!n||e.toLowerCase().includes(n));return[...r.filter(e=>t.has(e)),...r.filter(e=>!t.has(e))]},[e,a,s]),d=(0,v.useMemo)(()=>{if(!e)return[];let n=new Set(e);return t.filter(e=>!n.has(e))},[e,t]),f=e?.length??0,p=t.filter(e=>!d.includes(e)).length;function m(e){o(e),c(t)}function h(e,r){n(r?[...t,e]:t.filter(t=>t!==e))}function g(){let e=new Set(t);u.forEach(t=>e.add(t)),n([...e])}function _(){let e=new Set(u);n(t.filter(t=>!e.has(t)))}return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(kM,{"aria-label":i(`modelPickerSearch`),value:a,onChange:m,isDisabled:r,className:`min-w-0 flex-1 basis-48`,children:(0,G.jsxs)(kM.Group,{children:[(0,G.jsx)(kM.SearchIcon,{}),(0,G.jsx)(kM.Input,{placeholder:i(`modelPickerSearch`)}),(0,G.jsx)(kM.ClearButton,{})]})}),(0,G.jsx)(`span`,{className:`mono shrink-0 text-caption text-muted`,children:i(`modelPickerCount`,{selected:p,total:f})}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,isDisabled:r||u.length===0,onPress:g,children:[(0,G.jsx)(Ai,{size:14}),i(`modelPickerSelectAll`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,isDisabled:r||t.length===0,onPress:_,children:[(0,G.jsx)(Ka,{size:14}),i(`modelPickerClear`)]})]})]}),(0,G.jsxs)(`div`,{className:`max-h-[300px] overflow-y-auto overscroll-contain rounded-lg bg-surface-secondary p-1`,children:[e===null?(0,G.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:i(`refreshing`)}):null,d.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-md px-2.5 py-1.5`,children:[(0,G.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-body text-muted line-through`,children:e}),(0,G.jsx)(`span`,{className:`shrink-0 text-caption text-warning`,children:i(`modelPickerOffline`)}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,isDisabled:r,"aria-label":i(`modelPickerRemove`,{model:e}),onPress:()=>h(e,!1),children:(0,G.jsx)(yo,{size:14})})]},`offline-${e}`)),u.map(e=>(0,G.jsx)(IS,{isSelected:l.has(e),isDisabled:r,onChange:t=>h(e,t),className:`flex w-full cursor-pointer rounded-md px-2.5 py-1.5 transition-colors hover:bg-default`,children:(0,G.jsxs)(IS.Content,{className:`flex min-w-0 flex-1 items-center gap-2.5`,children:[(0,G.jsx)(IS.Control,{children:(0,G.jsx)(IS.Indicator,{})}),(0,G.jsx)(`span`,{className:`mono min-w-0 truncate text-body text-foreground`,children:e})]})},e)),e!==null&&u.length===0?(0,G.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:i(f===0?`noAccountModels`:`modelPickerNoMatch`)}):null]})]})}function oTe(e){let[t,n]=(0,v.useState)(e);e&&!t&&n(!0);let r=(0,v.useRef)(null),i=(0,v.useRef)(null),a=(0,v.useRef)(e);return(0,v.useLayoutEffect)(()=>{let t=r.current,o=i.current;if(!t||!o)return;if(a.current){a.current=!1;return}Z.killTweensOf([t,o]);let s=t.getBoundingClientRect().height;if(e){Z.set(t,{overflow:`hidden`});let e=t.scrollHeight;Z.fromTo(t,{height:s===e?0:s},{height:e,duration:JB(WB.base),ease:GB.out,onComplete:()=>Z.set(t,{clearProps:`height,overflow`})}),Z.fromTo(o,{autoAlpha:0,y:-6},{autoAlpha:1,y:0,duration:JB(WB.base),ease:GB.out})}else Z.set(t,{overflow:`hidden`,height:s}),Z.to(o,{autoAlpha:0,y:-4,duration:JB(WB.fast),ease:GB.inOut}),Z.to(t,{height:0,duration:JB(WB.fast+.04),ease:GB.inOut,onComplete:()=>n(!1)});return()=>{Z.killTweensOf([t,o])}},[e,t]),{mounted:t,outerRef:r,innerRef:i}}function sTe({account:e,checkinDefaultTime:t,checkinTimezone:n,busy:r,t:i,onClose:a,onSave:o}){let[s,c]=(0,v.useState)(e?.name||``),[l,u]=(0,v.useState)(e?.max_inflight??4),[d,f]=(0,v.useState)(e?.priority??50),[p,m]=(0,v.useState)(e?.proxy_url||``),[h,g]=(0,v.useState)(!!e?.drop_system_prompt),[_,y]=(0,v.useState)(Object.entries(e?.model_aliases||{}).map(([e,t])=>({alias:e,model:t}))),[b,x]=(0,v.useState)({alias:``,model:``}),[S,C]=(0,v.useState)(!!e?.models_restricted),[w,T]=(0,v.useState)(e?.enabled_models||[]),{mounted:E,outerRef:D,innerRef:O}=oTe(S),[k,A]=(0,v.useState)(null),[j,M]=(0,v.useState)(!e?.checkin_time),[N,P]=(0,v.useState)(e?.checkin_time||null),[F,I]=(0,v.useState)(``);(0,v.useEffect)(()=>{if(!e?.id)return;let t=!1;return lI(e.id).then(e=>{t||A(e.data||[])}).catch(()=>{t||A([])}),()=>{t=!0}},[e?.id]);let L=i(`editAccountTitle`,{name:e?.name||e?.id||``}),ee=e?YV(e.provider,e.region,i):``;async function R(n){n?.preventDefault();let r=s.trim();if(!r){I(i(`accountNameRequired`));return}if(!Number.isInteger(l)||l<1||l>32){I(i(`maxInflightInvalid`));return}if(!Number.isInteger(d)||d<1||d>100){I(i(`priorityInvalid`));return}if(t!==void 0&&!j&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(N??t)){I(i(`checkinTimeInvalid`));return}I(``);try{await o({name:r,max_inflight:l,priority:d,proxy_url:p.trim(),checkin_time:t===void 0?void 0:j?``:N??t,drop_system_prompt:e?.provider===`workbuddy`||e?.provider===`trae`?h:void 0,model_aliases:Object.fromEntries(_.filter(e=>e.alias.trim()&&e.model.trim()).map(e=>[e.alias.trim(),e.model.trim()])),enabled_models:S?w:[],set_model_routing:!0}),a()}catch(e){I(e instanceof Error?e.message:String(e))}}return(0,G.jsx)(Y.Root,{isOpen:!!e,onOpenChange:e=>{!e&&!r&&a()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{className:`w-full sm:w-[42rem] sm:max-w-[calc(100vw-2rem)]`,children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:L}),(0,G.jsx)(`p`,{className:`mt-1.5 text-body font-normal leading-6 text-muted`,children:i(`editAccountHint`)}),e?(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(BS,{size:`sm`,variant:`soft`,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(XV,{provider:e.provider,size:14}),(0,G.jsx)(`span`,{children:ee})]})}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:e.id})]}):null]}),(0,G.jsx)(Y.CloseTrigger,{isDisabled:r,"aria-label":i(`close`),className:`grid size-9 shrink-0 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(yo,{size:18})})]}),(0,G.jsxs)(Y.Body,{className:`px-6 pb-2 pt-1`,children:[F?(0,G.jsxs)(_P,{status:`danger`,className:`mb-4`,children:[(0,G.jsx)(_P.Indicator,{}),(0,G.jsx)(_P.Content,{children:(0,G.jsx)(_P.Title,{children:F})})]}):null,(0,G.jsxs)(mP,{className:`space-y-4`,onSubmit:e=>void R(e),children:[(0,G.jsx)(_9,{label:i(`accountName`),children:(0,G.jsx)(Rj,{value:s,onChange:e=>c(e.target.value),placeholder:i(`wizardNamePh`),"aria-label":i(`accountName`),disabled:r,autoFocus:!0})}),(0,G.jsx)(_9,{label:i(`maxInflight`),hint:i(`maxInflightHint`),children:(0,G.jsx)(jP,{value:l,onChange:e=>u(e??4),minValue:1,maxValue:32,isDisabled:r,isRequired:!0,children:(0,G.jsxs)(jP.Group,{children:[(0,G.jsx)(jP.DecrementButton,{}),(0,G.jsx)(jP.Input,{"aria-label":i(`maxInflight`)}),(0,G.jsx)(jP.IncrementButton,{})]})})}),(0,G.jsx)(_9,{label:i(`priority`),hint:i(`priorityHint`),children:(0,G.jsx)(jP,{value:d,onChange:e=>f(e??50),minValue:1,maxValue:100,isDisabled:r,isRequired:!0,children:(0,G.jsxs)(jP.Group,{children:[(0,G.jsx)(jP.DecrementButton,{}),(0,G.jsx)(jP.Input,{"aria-label":i(`priority`)}),(0,G.jsx)(jP.IncrementButton,{})]})})}),(0,G.jsx)(_9,{label:i(`proxyUrl`),hint:i(`proxyUrlHint`),children:(0,G.jsx)(Rj,{value:p,onChange:e=>m(e.target.value),placeholder:i(`proxyUrlPlaceholder`),"aria-label":i(`proxyUrl`),disabled:r})}),e?.provider===`workbuddy`||e?.provider===`trae`?(0,G.jsx)(_9,{label:i(`dropSystemPrompt`),hint:i(e?.provider===`trae`?`dropSystemPromptTraeHint`:`dropSystemPromptHint`),children:(0,G.jsx)(h7,{isSelected:h,isDisabled:r,ariaLabel:i(`dropSystemPrompt`),onChange:g})}):null,(0,G.jsx)(_9,{align:`start`,label:i(`accountModelAliases`),hint:i(`accountModelAliasesHint`),children:(0,G.jsxs)(`div`,{className:`space-y-2`,children:[_.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`span`,{className:`mono min-w-0 truncate text-body`,children:[e.alias,` → `,e.model]}),(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isDisabled:r,onPress:()=>y(t=>t.filter(t=>t.alias!==e.alias)),children:i(`modelAliasRemove`)})]},e.alias)),(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_1fr_auto]`,children:[(0,G.jsx)(Rj,{"aria-label":i(`modelAliasName`),value:b.alias,onChange:e=>x(t=>({...t,alias:e.target.value})),placeholder:i(`modelAliasPlaceholder`),disabled:r}),(0,G.jsx)(Rj,{"aria-label":i(`modelAliasTarget`),value:b.model,onChange:e=>x(t=>({...t,model:e.target.value})),placeholder:i(`accountModelAliasTargetPlaceholder`),disabled:r}),(0,G.jsx)(J,{size:`sm`,variant:`secondary`,isDisabled:r||!b.alias.trim()||!b.model.trim(),onPress:()=>{y(e=>[...e.filter(e=>e.alias!==b.alias.trim()),{alias:b.alias.trim(),model:b.model.trim()}]),x({alias:``,model:``})},children:i(`modelAliasAdd`)})]})]})}),(0,G.jsxs)(`section`,{className:`space-y-3 pt-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-body font-medium text-foreground`,children:i(`enabledModels`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:i(`enabledModelsHint`)})]}),(0,G.jsx)(h7,{isSelected:S,isDisabled:r,ariaLabel:i(`restrictModels`),label:i(S?`restrictModels`:`allModels`),onChange:C})]}),E?(0,G.jsx)(`div`,{ref:D,children:(0,G.jsx)(`div`,{ref:O,children:(0,G.jsx)(aTe,{catalog:k?k.map(e=>e.id):null,selected:w,onChange:T,isDisabled:r,t:i})})}):null]}),t===void 0?null:(0,G.jsx)(_9,{label:i(`autoCheckinTime`),hint:i(`checkinScheduleHint`),children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(h7,{isSelected:j,isDisabled:r,onChange:M,ariaLabel:i(`checkinInherit`),label:i(`checkinInherit`)}),(0,G.jsxs)(`p`,{className:`text-caption text-muted`,children:[i(`checkinDefaultValue`,{time:t}),` · `,(0,G.jsx)(`span`,{className:`mono`,children:n})]}),j?null:(0,G.jsx)(Rj,{type:`time`,value:N??t,onChange:e=>P(e.target.value),"aria-label":i(`autoCheckinTime`),disabled:r,required:!0})]})})]})]}),(0,G.jsxs)(Y.Footer,{className:`justify-end gap-2 px-6 pb-6`,children:[(0,G.jsx)(J,{variant:`ghost`,isDisabled:r,onPress:a,children:i(`cancel`)}),(0,G.jsx)(J,{isPending:r,onPress:()=>void R(),children:i(`save`)})]})]})})})})}var cTe={1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-3`};function v9({options:e,value:t,onChange:n,ariaLabel:r,columns:i=2,className:a=``}){let o=(0,v.useRef)(null);return(0,v.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=Z.context(()=>{let e=Z.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(`[data-option-tile]`,{autoAlpha:1,y:0})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{Z.fromTo(`[data-option-tile]`,{autoAlpha:0,y:8},{autoAlpha:1,y:0,duration:.32,stagger:.035,ease:`power3.out`,overwrite:!0})})},e);return()=>t.revert()},[e.length]),(0,G.jsx)(`div`,{ref:o,role:`radiogroup`,"aria-label":r,className:`grid gap-3 ${cTe[i]} ${a}`.trim(),children:e.map(e=>{let r=e.value===t;return(0,G.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,"data-option-tile":``,"data-selected":r||void 0,disabled:e.disabled,title:e.hint,onClick:()=>n(e.value),className:`flex h-16 min-w-0 items-center gap-3 rounded-xl bg-surface shadow-surface px-4 text-left transition-colors hover:bg-surface-secondary disabled:cursor-not-allowed disabled:opacity-50 data-selected:border-accent data-selected:bg-accent-soft`,children:[e.icon?(0,G.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground [&_svg]:size-[18px]`,children:e.icon}):null,(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body font-medium leading-5 text-foreground`,children:e.label})]},e.value)})})}var y9=new Set([`qoder-global`,`qoder-cn`,`workbuddy-global`,`workbuddy-cn`,`trae-cn`]),lTe=[`qoder-global`,`qoder-cn`,`workbuddy-global`,`workbuddy-cn`,`trae-cn`];function uTe(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>{let r=n.get(e.id)??2**53-1,i=n.get(t.id)??2**53-1;return r===i?e.label.localeCompare(t.label):r-i})}function b9(e,t){return!t||`${e.label} ${e.subtitle||``} ${e.hint||``} ${e.provider} ${e.id}`.toLowerCase().includes(t)}function dTe({ariaLabel:e}){return(0,G.jsx)(`div`,{className:`space-y-8`,"aria-busy":`true`,"aria-label":e,children:Array.from({length:2},(e,t)=>(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(rA,{className:`h-3 w-24 rounded-lg`}),(0,G.jsx)(rA,{className:`h-3 w-40 rounded-lg`})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:Array.from({length:t===0?5:6},(e,t)=>(0,G.jsxs)(`div`,{className:`card flex flex-row items-center gap-3.5 rounded-xl bg-surface px-4 py-3.5`,children:[(0,G.jsx)(rA,{className:`size-10 shrink-0 rounded-lg`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,G.jsx)(rA,{className:`h-3.5 w-28 rounded-lg`}),(0,G.jsx)(rA,{className:`h-3 w-36 rounded-lg`})]})]},t))})]},t))})}function fTe({tile:e,disabled:t,onSelect:n}){return(0,G.jsxs)(`button`,{type:`button`,disabled:t,title:e.hint||e.subtitle||e.label,onClick:()=>n(e.id),className:`card flex min-w-0 flex-row items-center gap-3 rounded-xl bg-surface px-3.5 py-3 text-left transition-[transform,opacity,background-color] duration-200 ease-out hover:bg-surface-secondary active:translate-y-px active:scale-[0.98] motion-reduce:transition-none motion-reduce:active:translate-y-0 motion-reduce:active:scale-100 disabled:cursor-not-allowed disabled:opacity-50 disabled:active:translate-y-0 disabled:active:scale-100`,children:[(0,G.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg text-foreground [&_svg]:size-[18px]`,children:(0,G.jsx)(XV,{provider:e.provider,size:18})}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate text-body font-medium leading-5 text-foreground`,children:e.label}),e.subtitle?(0,G.jsx)(`span`,{className:`mt-0.5 block truncate text-caption leading-4 text-muted`,children:e.subtitle}):null]})]})}function pTe({title:e,subtitle:t,tiles:n,disabled:r,onSelect:i}){return n.length?(0,G.jsxs)(`section`,{className:`space-y-3.5`,children:[(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsx)(`h3`,{className:`text-[10px] font-semibold tracking-[0.12em] uppercase text-muted`,children:e}),t?(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:t}):null]}),(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:n.map(e=>(0,G.jsx)(fTe,{tile:e,disabled:r,onSelect:i},e.id))})]}):null}function mTe({options:e,onSelect:t,disabled:n,empty:r,ariaLabel:i}){let{t:a}=JF(),[o,s]=(0,v.useState)(``),c=o.trim().toLowerCase(),l=(0,v.useMemo)(()=>{let t=uTe(e.filter(e=>y9.has(e.id)),lTe),n=e.filter(e=>!y9.has(e.id)).sort((e,t)=>e.label.localeCompare(t.label));return[{id:`subscriptions`,titleKey:`providerGroupSubscriptions`,subtitleKey:`providerGroupSubscriptionsHint`,tiles:t.filter(e=>b9(e,c))},{id:`experimental`,titleKey:`providerGroupExperimental`,subtitleKey:`providerGroupExperimentalHint`,tiles:n.filter(e=>b9(e,c))}]},[c,e]),u=l.reduce((e,t)=>e+t.tiles.length,0);return(0,G.jsxs)(`div`,{className:`space-y-8`,role:`listbox`,"aria-label":i,children:[(0,G.jsx)(B7,{value:o,onChange:s,placeholder:a(`providerFindPlaceholder`),ariaLabel:a(`providerFindPlaceholder`),className:`max-w-sm`}),u===0?r||(0,G.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:a(`providerFindEmpty`)}):l.map(e=>(0,G.jsx)(pTe,{title:a(e.titleKey),subtitle:a(e.subtitleKey),tiles:e.tiles,disabled:n,onSelect:t},e.id))]})}function x9(e,t){let n={...e},r=n.format===`workbuddy-accounts`||Array.isArray(n.accounts);return n.format?r&&(n.format=`workbuddy-accounts`):n.format=r?`workbuddy-accounts`:`workbuddy-oauth-v1`,{...n,name:t.name?.trim()||n.name,enabled:t.enabled??!0,provider:`workbuddy`,region:t.region,max_inflight:t.max_inflight??4,priority:t.priority??50,drop_system_prompt:t.drop_system_prompt??!0,...t.proxy_url!=null&&t.proxy_url!==``?{proxy_url:t.proxy_url}:{}}}function S9(e,t){let n=typeof e?.succeeded==`number`?e.succeeded:e?.id||e?1:0,r=typeof e?.failed==`number`?e.failed:0,i=(e?.errors||[]).slice(0,3).map(e=>e.message||`index ${e.index}`).filter(Boolean).join(`; `),a;return a=r>0?t(`accountImportPartial`).replace(`{ok}`,String(n)).replace(`{fail}`,String(r))+(i?` — ${i}`:``):n>1?t(`accountImportBatch`).replace(`{n}`,String(n)):t(`accountImported`),{succeeded:n,failed:r,message:a}}async function hTe(e,t){return mI(x9(e,t))}var C9={global:`Global`,cn:`CN`},gTe={"qoder-global":`accountTypeQoderGlobal`,"qoder-cn":`accountTypeQoderCN`,"workbuddy-cn":`accountTypeWorkBuddyCN`,"workbuddy-global":`accountTypeWorkBuddyGlobal`,"trae-cn":`accountTypeTraeCN`,"devin-global":`accountTypeDevinGlobal`,"command-global":`accountTypeCommandGlobal`,"codex-global":`accountTypeCodexGlobal`,"zhipu-cn":`accountTypeZhipuCN`,"qwenwork-global":`accountTypeQwenworkGlobal`,"qwenwork-cn":`accountTypeQwenworkCN`,"kimi-cn":`accountTypeKimiCN`,"codearts-cn-north-4":`accountTypeCodeArtsCN`,"meta-global":`accountTypeMetaGlobal`},_Te={"qoder-global":`accountTypeQoderGlobalHint`,"qoder-cn":`accountTypeQoderCNHint`,"workbuddy-cn":`accountTypeWorkBuddyCNHint`,"workbuddy-global":`accountTypeWorkBuddyGlobalHint`,"trae-cn":`accountTypeTraeCNHint`,"devin-global":`accountTypeDevinGlobalHint`,"command-global":`accountTypeCommandGlobalHint`,"codex-global":`accountTypeCodexGlobalHint`,"zhipu-cn":`accountTypeZhipuCNHint`,"qwenwork-global":`accountTypeQwenworkGlobalHint`,"qwenwork-cn":`accountTypeQwenworkCNHint`,"kimi-cn":`accountTypeKimiCNHint`,"codearts-cn-north-4":`accountTypeCodeArtsCNHint`,"meta-global":`accountTypeMetaGlobalHint`};async function vTe(){let e=(await dI().catch(()=>null))?.data||[],t=[];for(let n of e)for(let e of n.regions)t.push({id:`${n.id}-${e.id}`,provider:n.id,region:e.id,descriptor:n});return t}function w9(e,t){let n=gTe[e.id];if(n){let e=t(n);if(e!==n)return e}let r=e.descriptor.regions.find(t=>t.id===e.region)?.label||C9[e.region]||``,i=e.descriptor.regions.length>1&&r?` ${r}`:``;return`${e.descriptor.label}${i}`.trim()}function T9(e,t){if(!e)return``;let n=_Te[e.id];if(!n)return``;let r=t(n);return r===n?``:r}function yTe({phase:e,busy:t,tab:n,forTab:r}){return e===`done`?(0,G.jsx)(Oi,{size:16,className:`text-success`}):t&&n===r?(0,G.jsx)(QB,{size:16,loading:!0}):null}var bTe=90,xTe=2e3;function STe({isOpen:e,onClose:t,onAdded:n}){let{t:r}=JF(),[i,a]=(0,v.useState)(`method`),[o,s]=(0,v.useState)(`browser`),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(4),[x,S]=(0,v.useState)(50),[C,w]=(0,v.useState)(!0),[T,E]=(0,v.useState)(``),[D,O]=(0,v.useState)(``),[k,A]=(0,v.useState)(``),[j,M]=(0,v.useState)(`payg`),[N,P]=(0,v.useState)(``),[F,I]=(0,v.useState)(``),[L,ee]=(0,v.useState)(``),[R,z]=(0,v.useState)(`idle`),[B,V]=(0,v.useState)(``),[H,te]=(0,v.useState)(``),[ne,re]=(0,v.useState)(!1),[ie,ae]=(0,v.useState)(``),[oe,se]=(0,v.useState)(`cli`),ce=(0,v.useRef)(null),le=(0,v.useRef)(null),ue=(0,v.useRef)(null),de=(0,v.useRef)(``),fe=(0,v.useRef)(null),pe=(0,v.useRef)(null);function me(){fe.current!==null&&(window.clearTimeout(fe.current),fe.current=null)}(0,v.useEffect)(()=>()=>me(),[]),(0,v.useEffect)(()=>{if(!e)return;let t=!1;return p(!0),d([]),l(``),vTe().then(e=>{t||(d(e),l(``),s(`browser`))}).finally(()=>{t||p(!1)}),()=>{t=!0}},[e]);let he=u.find(e=>e.id===c),ge=!f&&u.length>0,_e=he?.descriptor.capabilities?.pat_login!==!1,ve=he?.descriptor.capabilities?.import_export!==!1,ye=he?.descriptor.capabilities?.browser_login!==!1,be=he?.provider===`workbuddy`||he?.provider===`trae`,xe=he?.provider===`trae`||he?.provider===`devin`||he?.provider===`codex`||he?.provider===`codearts`,Se=R===`busy`||R===`polling`,Ce=!!de.current||Se,we=R===`done`,Te=T9(he,r);(0,v.useEffect)(()=>{o===`pat`&&!_e&&s(`browser`),o===`import`&&!ve&&s(`browser`)},[ve,_e,o]),(0,v.useEffect)(()=>{ye||(_e?s(`pat`):ve&&s(`import`))},[ye,ve,_e]);function Ee(){return!Number.isInteger(y)||y<1||y>32?4:y}function De(){return!Number.isInteger(x)||x<1||x>100?50:x}function Oe(){return{max_inflight:Ee(),priority:De(),drop_system_prompt:be?C:he?.provider!==`kimi`&&he?.provider!==`codearts`,proxy_url:T.trim()}}function ke(){me(),a(`method`),s(`browser`),l(``),d([]),p(!1),_(``),b(4),S(50),w(!0),E(``),O(``),A(``),M(`payg`),P(``),I(``),ee(``),h(!1),z(`idle`),V(``),te(``),re(!1),ae(``),se(`cli`),de.current=``}function Ae(){Se||(ke(),t())}function je(){ke(),t()}(0,v.useLayoutEffect)(()=>{let t=ce.current;if(e||(ue.current=null),!t||!e)return;let n=Z.context(()=>{let e=Z.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(t,{autoAlpha:1,x:0,y:0})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=ue.current,n=e&&e!==i?i===`login`?1:-1:0;Z.fromTo(t,{autoAlpha:0,x:20*n,y:n?0:12},{autoAlpha:1,x:0,y:0,duration:WB.slow,ease:GB.out,overwrite:!0}),n&&le.current&&Z.fromTo(le.current,{autoAlpha:0,y:6},{autoAlpha:1,y:0,duration:WB.base,ease:GB.out,overwrite:!0})})},t);return ue.current=i,()=>n.revert()},[e,i]);function Me(e){if(Se||!ge)return;let t=u.find(t=>t.id===e);l(e),s(t?.provider===`zhipu`?`pat`:`browser`),w(t?.provider!==`trae`&&t?.provider!==`kimi`&&t?.provider!==`codearts`),V(``),a(`login`)}async function Ne(){if(de.current)return de.current;if(!he)throw Error(r(`accountTypeHint`));let e=Oe(),t=await cse(g.trim()||r(`account`),he.provider,he.region,e),n=t?.id||t?.data?.id;if(!n)throw Error(`create account returned no id`);return de.current=n,n}async function Pe(){V(``),te(``);try{z(`busy`);let e=await Ne();V(r(`wizardStartingSession`)),z(`polling`);let t=await rI(e,he?.provider===`codex`?oe:void 0);t.authUrl&&te(t.authUrl),V(r(`wizardWaitingBrowser`));for(let t=0;t{fe.current=window.setTimeout(e,xTe)});let n=(await iI(e)).login||{};if(n.message&&V(n.message),n.status===`ok`)break;if(n.status===`error`)throw Error(n.message||`login failed`);if(t===89)throw Error(r(`wizardLoginTimeout`))}z(`done`),V(r(`wizardAccountReady`)),n(),window.setTimeout(je,900)}catch(e){z(`idle`),V(e instanceof Error?e.message:String(e))}}async function Fe(){let e=ie.trim();if(!e){V(r(`wizardCallbackPh`));return}try{z(`busy`);let t=await Ne();me(),await aI(t,e),z(`done`),V(r(`wizardAccountReady`)),n(),window.setTimeout(je,900)}catch(e){z(`polling`),V(e instanceof Error?e.message:String(e))}}async function Ie(){let e=N.trim();if(!e){V(r(`zhipuKeyRequired`));return}if(!he){V(r(`accountTypeHint`));return}V(``);try{z(`busy`);let t=Oe();await mI({format:`zhipu-key-v1`,api_key:e,mode:j,organization:j===`coding`?F.trim():``,project:j===`coding`?L.trim():``,name:g.trim()||r(`accountTypeZhipuCN`),enabled:!0,provider:he.provider,region:he.region,max_inflight:t.max_inflight,priority:t.priority,drop_system_prompt:t.drop_system_prompt,proxy_url:t.proxy_url}),z(`done`),V(r(`wizardAccountReady`)),n(),window.setTimeout(je,700)}catch(e){z(`idle`),V(e instanceof Error?e.message:String(e))}}async function Le(){let e=D.trim();if(!e){V(r(`pastePatFirst`));return}V(``);try{z(`busy`);let t=await Ne();V(r(`wizardStartingSession`)),await oI(e,t),z(`done`),V(r(`patDone`)),n(),window.setTimeout(je,700)}catch(e){z(`idle`),V(e instanceof Error?e.message:String(e))}}async function Re(){V(``);let e;try{e=JSON.parse(k)}catch{V(r(`wizardBadJson`));return}if(!e||typeof e!=`object`){V(r(`wizardBadJson`));return}if(!he){V(r(`accountTypeHint`));return}if(he.provider===`qoder`&&(typeof e.user_blob!=`string`||typeof e.machine_id!=`string`)){V(r(`wizardBadJson`));return}let t=Oe(),i;he.provider===`workbuddy`?i=x9(e,{region:he.region===`global`?`global`:`cn`,name:g.trim()||void 0,enabled:!0,max_inflight:t.max_inflight,priority:t.priority,drop_system_prompt:t.drop_system_prompt,proxy_url:t.proxy_url}):(e.format||(he.descriptor.id===`trae`?e.format=`trae-oauth-v1`:he.descriptor.id===`devin`?e.format=`devin-session-v1`:he.descriptor.id===`command`?e.format=`command-key-v1`:he.descriptor.id===`qwenwork`?e.format=`qwenwork-oauth-v1`:e.format=`qoder-native-v1`),i={...e,name:g.trim()||e.name,enabled:!0,provider:he.provider,region:he.region,max_inflight:t.max_inflight,priority:t.priority,drop_system_prompt:t.drop_system_prompt});try{z(`busy`);let{failed:e,message:t}=S9(await mI(i),r);z(`done`),V(t),n(),window.setTimeout(je,e>0?1600:700)}catch(e){z(`idle`),V(e instanceof Error?e.message:String(e))}}function ze(){pe.current?.click()}function Be(e){let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>A(String(n.result||``)),n.readAsText(t),e.target.value=``}let Ve=e=>Se&&o===e,He=he?.provider===`zhipu`,Ue=[he?.descriptor.capabilities?.browser_login===!1?null:{value:`browser`,label:r(`tabBrowser`)},_e?{value:`pat`,label:r(`tabPat`)}:null,ve?{value:`import`,label:r(`tabImport`)}:null].filter(Boolean),We=r(o===`browser`?he?.provider===`codex`?`wizardCodexBrowserLead`:`wizardBrowserLead`:o===`pat`?he?.provider===`command`?`wizardPatLeadCommand`:he?.region===`cn`&&he?.provider===`qoder`?`wizardPatLeadCN`:`wizardPatLead`:`wizardImportLead`);return(0,G.jsx)(Y.Root,{isOpen:e,onOpenChange:e=>{e||Ae()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,isDismissable:!Se,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{className:`w-full sm:w-[36rem] sm:max-w-[calc(100vw-2rem)] sm:min-h-[36rem]`,children:[(0,G.jsxs)(Y.Header,{className:`relative items-center justify-center px-12 pt-5 text-center`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:r(`addAccountTitle`)}),(0,G.jsx)(`p`,{ref:le,className:`mt-1 text-caption font-normal leading-5 text-muted`,children:i===`method`?r(`addAccountDesc`):Te||r(`addAccountDesc`)})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":r(`close`),className:`absolute right-4 top-4 grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(yo,{size:16})})]}),(0,G.jsx)(Y.Body,{className:i===`method`?`px-8 pb-5 sm:px-10`:`px-6 pb-2`,children:(0,G.jsx)(`div`,{ref:ce,children:i===`method`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`section`,{className:`space-y-2.5`,children:f?(0,G.jsx)(dTe,{ariaLabel:r(`accountType`)}):ge?(0,G.jsx)(mTe,{ariaLabel:r(`accountType`),options:u.map(e=>{let t=e.descriptor.regions.find(t=>t.id===e.region)?.label||C9[e.region]||``;return{id:e.id,provider:e.provider,label:w9(e,r),subtitle:t,hint:T9(e,r)}}),onSelect:Me,disabled:Ce}):(0,G.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:r(`accountTypeHint`)})}),(0,G.jsx)(`div`,{className:`mt-4 text-center`,children:(0,G.jsx)(e9,{className:`text-xs`})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`card flex flex-row items-center gap-3 rounded-xl bg-surface px-3 py-2.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0`,children:(0,G.jsx)(XV,{provider:he?.provider,size:18})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate text-body font-medium text-foreground`,children:he?w9(he,r):r(`accountType`)}),(0,G.jsx)(`div`,{className:`truncate text-caption text-muted`,children:Te})]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>a(`method`),isDisabled:Se||!!de.current,children:[(0,G.jsx)(mi,{size:12}),r(`wizardBack`)]})]}),(0,G.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(jM,{className:`text-body font-medium text-muted`,children:r(`accountName`)}),(0,G.jsx)(Rj,{fullWidth:!0,value:g,onChange:e=>_(e.target.value),"aria-label":r(`accountName`),disabled:Ce,autoFocus:!0})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>h(e=>!e),"aria-expanded":m,className:`inline-flex items-center gap-1 text-caption font-medium text-muted transition-colors hover:text-foreground`,children:[(0,G.jsx)(gi,{size:12,className:`transition-transform duration-200 ${m?`rotate-90`:``}`}),r(`wizardAdvanced`)]}),m?(0,G.jsxs)(`div`,{className:`card gap-3 rounded-xl bg-surface px-3.5 py-3.5`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(jM,{className:`text-body font-medium text-muted`,children:r(`maxInflight`)}),(0,G.jsx)(jP,{value:y,onChange:e=>b(e??4),minValue:1,maxValue:32,isDisabled:Ce,isRequired:!0,children:(0,G.jsxs)(jP.Group,{className:`w-full`,children:[(0,G.jsx)(jP.DecrementButton,{}),(0,G.jsx)(jP.Input,{"aria-label":r(`maxInflight`)}),(0,G.jsx)(jP.IncrementButton,{})]})}),(0,G.jsx)(NM,{className:`text-caption leading-5 text-muted`,children:r(`maxInflightHint`)})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(jM,{className:`text-body font-medium text-muted`,children:r(`priority`)}),(0,G.jsx)(jP,{value:x,onChange:e=>S(e??50),minValue:1,maxValue:100,isDisabled:Ce,isRequired:!0,children:(0,G.jsxs)(jP.Group,{className:`w-full`,children:[(0,G.jsx)(jP.DecrementButton,{}),(0,G.jsx)(jP.Input,{"aria-label":r(`priority`)}),(0,G.jsx)(jP.IncrementButton,{})]})}),(0,G.jsx)(NM,{className:`text-caption leading-5 text-muted`,children:r(`priorityHint`)})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(jM,{className:`text-body font-medium text-muted`,children:r(`proxyUrl`)}),(0,G.jsx)(Rj,{fullWidth:!0,value:T,onChange:e=>E(e.target.value),placeholder:r(`proxyUrlPlaceholder`),"aria-label":r(`proxyUrl`),disabled:Ce}),(0,G.jsx)(NM,{className:`text-caption leading-5 text-muted`,children:r(`proxyUrlHint`)})]}),be?(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(jM,{className:`text-body font-medium text-muted`,children:r(`dropSystemPrompt`)}),(0,G.jsx)(NM,{className:`text-caption leading-5 text-muted`,children:r(he?.provider===`trae`?`dropSystemPromptTraeHint`:`dropSystemPromptCreateHint`)}),(0,G.jsx)(h7,{isSelected:C,isDisabled:Ce,ariaLabel:r(`dropSystemPrompt`),onChange:w})]}):null]}):null]}),He?(0,G.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`text-body font-medium text-muted`,children:r(`zhipuAccountMode`)}),(0,G.jsx)(v9,{ariaLabel:r(`zhipuAccountMode`),columns:2,value:j,onChange:e=>{Se||M(e)},options:[{value:`payg`,label:r(`zhipuModePayg`),hint:r(`zhipuModePaygHint`),disabled:Se},{value:`coding`,label:r(`zhipuModeCoding`),hint:r(`zhipuModeCodingHint`),disabled:Se}]})]}),(0,G.jsx)(_9,{label:r(`zhipuApiKey`),children:(0,G.jsx)(Rj,{type:`password`,value:N,onChange:e=>P(e.target.value),placeholder:r(`zhipuApiKeyPh`),"aria-label":r(`zhipuApiKey`),disabled:Se})}),j===`coding`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_9,{label:r(`zhipuOrganization`),children:(0,G.jsx)(Rj,{value:F,onChange:e=>I(e.target.value),placeholder:r(`zhipuOrganizationPh`),"aria-label":r(`zhipuOrganization`),disabled:Se})}),(0,G.jsx)(_9,{label:r(`zhipuProject`),children:(0,G.jsx)(Rj,{value:L,onChange:e=>ee(e.target.value),placeholder:r(`zhipuProjectPh`),"aria-label":r(`zhipuProject`),disabled:Se})})]}):null,B?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[we?(0,G.jsx)(Oi,{size:14,className:`shrink-0 text-success`}):null,(0,G.jsx)(`span`,{className:we?`font-medium text-foreground`:`text-muted`,children:B})]}):null]}):null,He?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(AV,{className:`mt-3`,value:o,onChange:e=>{!Se&&e!==o&&(s(e),V(``),te(``),re(!1))},ariaLabel:r(`authentication`),options:Ue.map(e=>({id:e.value,label:e.label}))}),(0,G.jsx)(`p`,{className:`mt-2 min-h-5 text-caption leading-5 text-muted`,children:We}),(0,G.jsx)(`div`,{className:`mt-3 flex flex-col gap-4`,children:o===`browser`?(0,G.jsxs)(G.Fragment,{children:[he?.provider===`codex`?(0,G.jsx)(v9,{ariaLabel:r(`codexLoginMethod`),columns:2,value:oe,onChange:e=>{Se||se(e)},options:[{value:`cli`,label:r(`codexLoginCli`),hint:r(`codexLoginCliHint`),disabled:Se||!!de.current},{value:`chatgpt`,label:r(`codexLoginChatGPT`),hint:r(`codexLoginChatGPTHint`),disabled:Se||!!de.current}]}):null,H?(0,G.jsxs)(`div`,{className:`card rounded-xl bg-surface px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-caption`,children:[(0,G.jsx)(yTe,{phase:R,busy:Se,tab:o,forTab:`browser`}),(0,G.jsx)(`span`,{className:`text-muted`,children:B||r(`loginOpenMsg`)})]}),(0,G.jsx)(`code`,{className:`mono mt-2 block break-all text-caption leading-5 text-foreground`,children:H}),(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,onPress:()=>window.open(H,`_blank`,`noopener,noreferrer`),children:[(0,G.jsx)(ni,{size:14}),r(`openAuthUrl`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>{Z7(H).then(e=>{e&&(re(!0),window.setTimeout(()=>re(!1),1100))})},children:[(0,G.jsx)(X7,{copied:ne}),r(ne?`copied`:`copy`)]})]})]}):null,B&&!H?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[we?(0,G.jsx)(Oi,{size:14,className:`shrink-0 text-success`}):null,(0,G.jsx)(`span`,{className:we?`font-medium text-foreground`:`text-muted`,children:B})]}):null,xe?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-caption leading-4 text-muted`,children:r(`wizardCallbackLead`)}),(0,G.jsx)(Uj,{className:`h-28 w-full resize-none font-mono text-caption leading-5`,value:ie,onChange:e=>ae(e.target.value),placeholder:r(`wizardCallbackPh`),"aria-label":r(`wizardCallbackPh`),disabled:we}),(0,G.jsx)(J,{size:`sm`,variant:`secondary`,isPending:R===`busy`&&!!ie.trim(),onPress:()=>void Fe(),isDisabled:we,children:r(`wizardSubmitCallback`)})]}):null]}):o===`pat`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_9,{label:r(`tabPat`),children:(0,G.jsx)(Rj,{type:`password`,value:D,onChange:e=>O(e.target.value),placeholder:r(`wizardPatPh`),"aria-label":r(`wizardPatPh`),disabled:Se})}),B?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[we?(0,G.jsx)(Oi,{size:14,className:`shrink-0 text-success`}):null,(0,G.jsx)(`span`,{className:we?`font-medium text-foreground`:`text-muted`,children:B})]}):null]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:`JSON`}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,onPress:ze,isDisabled:Se,children:[(0,G.jsx)(Xi,{size:13}),r(`wizardChooseFile`)]}),(0,G.jsx)(`input`,{ref:pe,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:Be})]}),(0,G.jsx)(Uj,{className:`min-h-32 font-mono text-caption`,value:k,onChange:e=>A(e.target.value),placeholder:r(`wizardImportPh`),"aria-label":r(`tabImport`),disabled:Se}),B?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[we?(0,G.jsx)(Oi,{size:14,className:`shrink-0 text-success`}):null,(0,G.jsx)(`span`,{className:we?`font-medium text-foreground`:`text-muted`,children:B})]}):null]})})]})]})})}),(0,G.jsxs)(Y.Footer,{className:`justify-end gap-2 px-5 pb-5`,children:[(0,G.jsx)(J,{variant:`ghost`,onPress:Ae,isDisabled:Se,children:r(`cancel`)}),i===`login`&&He?(0,G.jsx)(J,{isPending:R===`busy`,onPress:()=>void Ie(),isDisabled:we,children:we?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Oi,{size:15}),r(`wizardAccountReady`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ua,{size:15}),r(`zhipuCreate`)]})}):null,i===`login`&&!He&&o===`browser`?(0,G.jsx)(J,{isPending:Ve(`browser`),onPress:()=>void Pe(),isDisabled:we,children:we?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Oi,{size:15}),r(`wizardAccountReady`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ia,{size:15}),r(`wizardStartBrowser`)]})}):null,i===`login`&&!He&&o===`pat`?(0,G.jsx)(J,{isPending:Ve(`pat`),onPress:()=>void Le(),isDisabled:we,children:we?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Oi,{size:15}),r(`patDone`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ua,{size:15}),r(`wizardCreateAndLogin`)]})}):null,i===`login`&&!He&&o===`import`?(0,G.jsx)(J,{isPending:Ve(`import`),onPress:()=>void Re(),isDisabled:we,children:we?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Oi,{size:15}),r(`accountImported`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Xi,{size:15}),r(`importCredential`)]})}):null]})]})})})})}function E9({isOpen:e,title:t,description:n,confirmLabel:r,cancelLabel:i,closeLabel:a,isPending:o,status:s=`danger`,confirmVariant:c=`danger`,onClose:l,onConfirm:u}){return(0,G.jsx)(qb.Root,{isOpen:e,onOpenChange:e=>{!e&&!o&&l()},children:(0,G.jsx)(qb.Backdrop,{variant:`blur`,isDismissable:!o,children:(0,G.jsx)(qb.Container,{placement:`center`,size:`sm`,children:(0,G.jsxs)(qb.Dialog,{children:[(0,G.jsxs)(qb.Header,{className:`items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(qb.Icon,{status:s}),(0,G.jsx)(`div`,{children:(0,G.jsx)(qb.Heading,{children:t})})]}),(0,G.jsx)(qb.CloseTrigger,{isDisabled:o,"aria-label":a})]}),(0,G.jsx)(qb.Body,{children:(0,G.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:n})}),(0,G.jsxs)(qb.Footer,{children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isDisabled:o,onPress:l,children:i}),(0,G.jsx)(J,{size:`sm`,variant:c,isPending:o,onPress:u,children:r})]})]})})})})}function CTe(e,t){return e===`region_mixed`?t(`batchImportRegionMixed`):e===`region_unknown`?t(`batchImportRegionUnknown`):e===`unknown_format`?t(`batchImportUnknownFormat`):``}function wTe({isOpen:e,detection:t,fileName:n,isPending:r,t:i,onClose:a,onConfirm:o}){let[s,c]=(0,v.useState)(`cn`);(0,v.useEffect)(()=>{t&&(t.region===`cn`||t.region===`global`?c(t.region):c(`cn`))},[t]);let l=!!t?.batchImportSupported,u=t?.provider,d=t?.format||i(`batchImportFormatUnknown`),f=u?JV(u,i):i(`batchImportProviderUnknown`),p=(t?.warnings||[]).map(e=>CTe(e,i)).filter(Boolean);return(0,G.jsx)(Y.Root,{isOpen:e,onOpenChange:e=>{!e&&!r&&a()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,isDismissable:!r,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`md`,scroll:`inside`,className:`mx-3 w-full max-w-[min(100%,32rem)] sm:mx-0`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:i(`batchImportConfirmTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 break-all text-caption leading-5 text-muted`,children:n?i(`batchImportConfirmHint`,{file:n}):i(`batchImportConfirmHintNoFile`)})]}),(0,G.jsx)(Y.CloseTrigger,{isDisabled:r,"aria-label":i(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(yo,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`space-y-4 px-6 pb-2`,children:[(0,G.jsx)(`div`,{className:`rounded-xl bg-surface-secondary px-3.5 py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[u?(0,G.jsx)(XV,{provider:u,size:18}):null,(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-body font-medium text-foreground`,children:f}),(0,G.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:d})]})]})}),l?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-body font-medium text-muted`,children:i(`batchImportRegion`)}),(0,G.jsx)(AV,{value:s,onChange:e=>{(e===`cn`||e===`global`)&&c(e)},ariaLabel:i(`batchImportRegion`),options:[{id:`cn`,label:i(`accountTypeWorkBuddyCN`)},{id:`global`,label:i(`accountTypeWorkBuddyGlobal`)}]}),t?.regionAmbiguous?(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:i(`batchImportRegionPickHint`)}):null]}):(0,G.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:i(`batchImportProviderUnsupported`)}),p.length?(0,G.jsx)(`ul`,{className:`space-y-1 text-caption leading-5 text-muted`,children:p.map(e=>(0,G.jsx)(`li`,{children:e},e))}):null]}),(0,G.jsxs)(Y.Footer,{className:`flex-col-reverse gap-2 px-6 pb-6 sm:flex-row sm:justify-end`,children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,className:`w-full sm:w-auto`,isDisabled:r,onPress:a,children:i(l?`cancel`:`close`)}),l?(0,G.jsx)(J,{size:`sm`,className:`w-full sm:w-auto`,isPending:r,onPress:()=>o(s),children:i(`batchImportConfirmAction`)}):null]})]})})})})}var D9={"workbuddy-accounts":`workbuddy`,"workbuddy-oauth-v1":`workbuddy`,"qoder-native-v1":`qoder`,"trae-oauth-v1":`trae`,"devin-session-v1":`devin`,"command-key-v1":`command`,"codex-oauth-v1":`codex`,"zhipu-key-v1":`zhipu`,"qwenwork-oauth-v1":`qwenwork`,"meta-oauth-v1":`meta`,"meta-key-v1":`meta`},TTe=[`codebuddy.cn`,`workbuddy.cn`],ETe=[`workbuddy.ai`,`workbuddy.com`];function O9(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function k9(e){let t=e.trim();if(!t)return``;let n=t.toLowerCase();return n===`workbuddy-accounts`?`workbuddy-accounts`:n}function DTe(e){return typeof e.format==`string`&&e.format.trim()?k9(e.format):typeof e.exportType==`string`&&e.exportType.trim()?k9(e.exportType):``}function OTe(e){let t=[],n=e=>{typeof e==`string`&&e.trim()&&t.push(e.trim().toLowerCase())};if(n(e.domain),O9(e.account)&&n(e.account.domain),O9(e.auth)&&n(e.auth.domain),Array.isArray(e.accounts))for(let t of e.accounts)O9(t)&&(n(t.domain),O9(t.account)&&n(t.account.domain),O9(t.auth)&&n(t.auth.domain));return t}function kTe(e){return TTe.some(t=>e.includes(t))}function ATe(e){return ETe.some(t=>e.includes(t))}function A9(e){return typeof e.accessToken==`string`||typeof e.access_token==`string`||typeof e.refreshToken==`string`||typeof e.refresh_token==`string`}function jTe(e){if(!O9(e))return!1;if(A9(e)||typeof e.domain==`string`||typeof e.uid==`string`)return!0;if(O9(e.account)||O9(e.auth)){let t=O9(e.account)?e.account:null,n=O9(e.auth)?e.auth:null;if(n&&(A9(n)||typeof n.domain==`string`)||t&&(typeof t.uid==`string`||typeof t.domain==`string`))return!0}return!1}function MTe(e){let t=OTe(e);if(t.length===0)return{region:`cn`,ambiguous:!0,warning:`region_unknown`};let n=t.some(kTe),r=t.some(ATe);return n&&r?{region:null,ambiguous:!0,warning:`region_mixed`}:n?{region:`cn`,ambiguous:!1}:r?{region:`global`,ambiguous:!1}:{region:`cn`,ambiguous:!0,warning:`region_unknown`}}function NTe(e){return Array.isArray(e.accounts)&&e.accounts.some(jTe)?{format:`workbuddy-accounts`,provider:`workbuddy`,confidence:`medium`}:(typeof e.user_blob==`string`||typeof e.userBlob==`string`)&&(typeof e.machine_id==`string`||typeof e.machineId==`string`)?{format:`qoder-native-v1`,provider:`qoder`,confidence:`medium`}:typeof e.session_token==`string`||typeof e.sessionToken==`string`?{format:`devin-session-v1`,provider:`devin`,confidence:`low`}:A9(e)||O9(e.account)&&A9(e.account)||O9(e.auth)?{format:`workbuddy-oauth-v1`,provider:`workbuddy`,confidence:`low`}:typeof e.dca_token==`string`||typeof e.dcaToken==`string`||typeof e.access_token==`string`&&String(e.access_token).startsWith(`dca:`)||typeof e.accessToken==`string`&&String(e.accessToken).startsWith(`dca:`)?{format:`meta-oauth-v1`,provider:`meta`,confidence:`medium`}:typeof e.api_key==`string`||typeof e.apiKey==`string`?typeof e.organization==`string`||typeof e.project==`string`?{format:`zhipu-key-v1`,provider:`zhipu`,confidence:`low`}:typeof e.base_url==`string`&&String(e.base_url).includes(`meta.ai`)||typeof e.baseUrl==`string`&&String(e.baseUrl).includes(`meta.ai`)||typeof e.email==`string`?{format:`meta-key-v1`,provider:`meta`,confidence:`low`}:{format:`command-key-v1`,provider:`command`,confidence:`low`}:{format:null,provider:null,confidence:`low`}}function PTe(e){if(!O9(e))return{format:null,provider:null,region:null,regionAmbiguous:!0,confidence:`low`,warnings:[`not_object`],batchImportSupported:!1};let t=[],n=DTe(e),r=typeof e.format==`string`?e.format.trim():``,i=typeof e.exportType==`string`?e.exportType.trim():``,a=r||i,o=n||null,s=o?D9[o]??null:null,c=o&&s?`high`:`low`;if(!s){let r=NTe(e);o||=r.format,s=r.provider,c=n&&!D9[n]?`low`:r.confidence,a&&!D9[n]&&t.push(`unknown_format`)}s===`workbuddy`&&Array.isArray(e.accounts)&&(o=`workbuddy-accounts`);let l=null,u=!1;if(s===`workbuddy`){let n=MTe(e);l=n.region,u=n.ambiguous,n.warning&&t.push(n.warning)}return{format:o,provider:s,region:l,regionAmbiguous:u,confidence:c,warnings:t,batchImportSupported:s===`workbuddy`}}function FTe(e){let t;try{t=JSON.parse(e)}catch{throw Error(`bad_json`)}if(!O9(t))throw Error(`bad_json`);return t}var j9=`__all__`,ITe=[],M9=2;function LTe(){let{t:e}=JF(),[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(!0),d=s,f=d.length>0,[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(null),[O,k]=(0,v.useState)({}),[A,j]=(0,v.useState)({}),[M,N]=(0,v.useState)({}),[P,F]=(0,v.useState)({}),[I,L]=(0,v.useState)({}),[ee,R]=(0,v.useState)(null),[z,B]=(0,v.useState)(null),[V,H]=(0,v.useState)(null),[te,ne]=(0,v.useState)(null),[re,ie]=(0,v.useState)(null),[ae,oe]=(0,v.useState)(``),[se,ce]=(0,v.useState)(`all`),[le,ue]=(0,v.useState)(``),[de,fe]=(0,v.useState)(1),[pe,me]=(0,v.useState)(20),[he,ge]=(0,v.useState)({}),[_e,ve]=(0,v.useState)({}),[ye,be]=(0,v.useState)({}),[xe,Se]=(0,v.useState)({}),[Ce,we]=(0,v.useState)(!1),[Te,Ee]=(0,v.useState)(!1),De=(0,v.useCallback)(async(e=!1)=>{try{let t=(await nI(e)).data||ITe;return c(t),t}finally{u(!1)}},[]),Oe=(0,v.useCallback)(async(e,t=!0)=>{let n=[...new Set(e)];if(n.length)for(let e=0;e{try{let n=await nse(e,{quota:t});c(t=>t.map(t=>t.id===e?n:t))}catch(t){N(n=>({...n,[e]:t instanceof Error?t.message:String(t)}))}}))}},[]);(0,v.useEffect)(()=>{De(!1).catch(()=>void 0)},[De]),(0,v.useEffect)(()=>{let e=!0;return Promise.all([dI(),SI()]).then(([t,r])=>{e&&(n(t.data||[]),i(r))}).catch(t=>{e&&o(t instanceof Error?t.message:String(t))}),()=>{e=!1}},[]),(0,v.useEffect)(()=>{let e=!0;return De(!1).then(t=>{if(e)return Oe((t||[]).map(e=>e.id))}).catch(()=>void 0),()=>{e=!1}},[De,Oe]);function ke(e){return t.find(t=>t.id===e.provider)?.regions.find(t=>t.id===e.region)?.checkin}function Ae(e){let t=ke(e)?.timezone,n=t===`Local`?r?.timezone:t;if(!(!n||n===`Local`))try{return Intl.DateTimeFormat(`en-CA`,{timeZone:n}),n}catch{return}}let je=(0,v.useMemo)(()=>d.map(e=>{let t=he[e.id],n=_e[e.id],r=ye[e.id],i=xe[e.id],a=e;return t!==void 0&&(a={...a,enabled:t}),n!==void 0&&(a={...a,name:n}),r!==void 0&&(a={...a,max_inflight:r}),i!==void 0&&(a={...a,priority:i}),a}),[he,ye,_e,xe,d]),Me=(0,v.useMemo)(()=>{let e={all:je.length,available:0,attention:0,disabled:0};for(let t of je){let n=p9(t);n===`hot`||n===`ready`?e.available+=1:n===`disabled`&&(e.disabled+=1),t.enabled&&n!==`hot`&&n!==`ready`&&(e.attention+=1)}return e},[je]),Ne=(0,v.useMemo)(()=>{let e=new Map;for(let t of je){let n=String(t.provider||`qoder`).toLowerCase();e.set(n,(e.get(n)||0)+1)}return[...e.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))},[je]),Pe=je.find(e=>e.id===ee),Fe=je.find(e=>e.id===z)||null,Ie=je.find(e=>e.id===V)||null,Le=je.find(e=>e.id===te)||null,Re=(0,v.useMemo)(()=>{let e=ae.trim().toLowerCase();return je.filter(t=>{let n=p9(t);return!(se===`all`||se===`available`&&(n===`hot`||n===`ready`)||se===`attention`&&t.enabled&&n!==`hot`&&n!==`ready`||se===`disabled`&&n===`disabled`)||le&&String(t.provider||`qoder`).toLowerCase()!==le?!1:!e||[t.name,t.id,t.remote_uid,t.provider,t.auth_type].some(t=>String(t||``).toLowerCase().includes(e))})},[je,se,le,ae]),ze=[ae,se,le,pe].join(`\0`),[Be,Ve]=(0,v.useState)(ze);Be!==ze&&(Ve(ze),fe(1));let He=Math.max(1,Math.ceil(Re.length/pe)),Ue=Math.min(Be===ze?Math.max(1,de):1,He);de!==Ue&&fe(Ue);let We=(0,v.useMemo)(()=>{let e=(Ue-1)*pe;return Re.slice(e,e+pe)},[Ue,Re,pe]);if(l&&!f)return(0,G.jsx)(Mce,{});async function Ge(e,t,n){D({id:e,kind:t}),N(t=>({...t,[e]:``}));try{return await n(),!0}catch(t){return N(n=>({...n,[e]:t instanceof Error?t.message:String(t)})),!1}finally{D(null)}}async function Ke(t,n){ie(t),await Ge(t,`device`,async()=>{N(n=>({...n,[t]:e(`wizardStartingSession`)}));let r=await rI(t,n);r.authUrl&&L(e=>({...e,[t]:r.authUrl||``}));for(let n=0;n<60;n++){await new Promise(e=>window.setTimeout(e,2e3));let n=(await iI(t)).login||{};if(N(r=>({...r,[t]:n.message||e(`waitingQoderLogin`)})),n.status===`ok`||n.status===`error`)break}await De(!1),await Oe([t])})}async function qe(t){let n=(A[t]||``).trim();if(!n){N(n=>({...n,[t]:e(`wizardCallbackPh`)}));return}await Ge(t,`callback`,async()=>{N(n=>({...n,[t]:e(`wizardStartingSession`)})),await aI(t,n),j(e=>({...e,[t]:``})),await De(!1),await Oe([t])})&&(ie(e=>e===t?null:e),N(e=>({...e,[t]:``})))}async function Je(t){let n=(O[t]||``).trim();if(!n){N(n=>({...n,[t]:e(`pastePatFirst`)}));return}await Ge(t,`pat`,async()=>{N(n=>({...n,[t]:e(`wizardStartingSession`)})),await oI(n,t),k(e=>({...e,[t]:``})),await De(!1),await Oe([t])})}async function Ye(t){await Ge(t,`export`,async()=>{let n=await dse(t);await Z7(JSON.stringify(n,null,2)),N(n=>({...n,[t]:e(`credentialCopied`)}))})}async function Xe(e,t){ge(n=>({...n,[e]:t})),await Ge(e,`toggle`,async()=>{await pI(e,{enabled:t}),await De(!1)}),ge(t=>{let n={...t};return delete n[e],n})}async function Ze(t){pV({id:`refresh-${t}`,type:`loading`,title:e(`toastRefreshingAccount`)}),D({id:t,kind:`refresh`}),N(e=>{let n={...e};return delete n[t],n});try{await Oe([t]),pV({id:`refresh-${t}`,type:`success`,title:e(`toastAccountRefreshed`)})}catch(n){throw pV({id:`refresh-${t}`,type:`error`,title:e(`toastFailed`),description:n instanceof Error?n.message:String(n)}),n}finally{D(null)}}async function Qe(){we(!0),pV({id:`refresh-credits`,type:`loading`,title:e(`toastRefreshingCredits`)});try{await Oe(s.map(e=>e.id)),pV({id:`refresh-credits`,type:`success`,title:e(`toastCreditsRefreshed`)})}catch(t){throw pV({id:`refresh-credits`,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)}),t}finally{we(!1)}}function $e(){h||(y(!1),x(null),C(null),T(``))}async function et(t){let n=t.target.files?.[0];if(t.target.value=``,n)try{let t=FTe(await n.text()),r=PTe(t);if(!r.provider){pV({type:`error`,title:e(`batchImportUnrecognized`)});return}C(t),x(r),T(n.name),y(!0)}catch(t){let n=t instanceof Error?t.message:String(t);pV({type:`error`,title:e(n===`bad_json`?`wizardBadJson`:`batchImportUnrecognized`),description:n===`bad_json`?void 0:n})}}async function tt(t){if(!S||!b?.batchImportSupported||h)return;g(!0);let n=`batch-import-accounts`;pV({id:n,type:`loading`,title:e(`batchImportLoading`)});try{let{succeeded:r,failed:i,message:a}=S9(await hTe(S,{region:t}),e);pV({id:n,type:i>0&&r===0?`error`:i>0?`info`:`success`,title:a}),y(!1),x(null),C(null),T(``),r>0&&await De(!1)}catch(t){pV({id:n,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)})}finally{g(!1)}}async function nt(e,t){await Ge(e,`toggle`,async()=>{await pI(e,{auto_checkin:t}),await De(!1)})}function rt(e){let t=e.last_checkin_status;if(t!==`success`&&t!==`already`||!e.last_checkin_at)return!1;let n=new Date(e.last_checkin_at);if(Number.isNaN(n.getTime()))return!1;let r=Ae(e),i=e=>new Intl.DateTimeFormat(`en-CA`,{timeZone:r||void 0,year:`numeric`,month:`2-digit`,day:`2-digit`}).format(e);return i(n)===i(new Date)}async function it(){let t,n;try{t=je.filter(e=>e.enabled&&ke(e)),n=t.filter(e=>!rt(e))}catch(t){pV({id:`checkin-all`,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)});return}if(t.length===0){pV({id:`checkin-all`,type:`info`,title:e(`checkinAllEmpty`)});return}if(n.length===0){pV({id:`checkin-all`,type:`success`,title:e(`checkinAllDone`,{count:t.length})});return}pV({id:`checkin-all`,type:`loading`,title:e(`toastCheckingInAll`,{done:0,total:n.length})}),Ee(!0);let r={checked:0,skipped:t.length-n.length,failed:0};try{for(let t=0;t0&&await new Promise(e=>setTimeout(e,4e3));try{let i=await fI(n[t].id),a=i?.last_checkin_status,o=i?.last_checkin_msg,s=a===`already`?`already`:a===`skipped`?`skipped`:a===`error`?`error`:`success`;s===`error`||s===`skipped`?r.failed+=1:r.checked+=1,F(r=>({...r,[n[t].id]:{kind:s,message:s===`error`?o||e(`checkinRecordFailed`):o}}))}catch(e){r.failed+=1,F(r=>({...r,[n[t].id]:{kind:`error`,message:e instanceof Error?e.message:String(e)}}))}tvoid 0)}}async function at(t){await Ge(t,`checkin`,async()=>{let n;try{n=await fI(t)}catch(e){F(n=>({...n,[t]:{kind:`error`,message:e instanceof Error?e.message:String(e)}})),await De(!1).catch(()=>void 0),await Oe([t]).catch(()=>void 0);return}let r=n?.last_checkin_status,i=n?.last_checkin_msg,a=r===`already`?`already`:r===`skipped`?`skipped`:r===`error`?`error`:`success`;F(n=>({...n,[t]:{kind:a,message:a===`error`?i||e(`checkinRecordFailed`):i}})),await De(!1).catch(()=>void 0),await Oe([t]).catch(()=>void 0)})}async function ot(t,n){if(!t)throw Error(e(`accountNameRequired`));ve(e=>({...e,[t]:n.name})),be(e=>({...e,[t]:n.max_inflight})),Se(e=>({...e,[t]:n.priority})),D({id:t,kind:`settings`});try{await pI(t,n),await De(!1)}catch(e){throw e instanceof Error?e:Error(String(e))}finally{D(null),ve(e=>{let n={...e};return delete n[t],n}),be(e=>{let n={...e};return delete n[t],n}),Se(e=>{let n={...e};return delete n[t],n})}}return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[a?(0,G.jsx)(xI,{title:a}):null,(0,G.jsxs)(`section`,{"data-gsap-reveal":!0,className:`flex flex-wrap items-center gap-2`,children:[d.length?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(AV,{value:se,onChange:e=>ce(e),ariaLabel:e(`accountStatusFilter`),options:[{id:`all`,label:(0,G.jsxs)(G.Fragment,{children:[e(`filterAll`),(0,G.jsx)(`span`,{className:`mono text-muted`,children:Me.all})]})},{id:`available`,label:(0,G.jsxs)(G.Fragment,{children:[e(`availableAccounts`),(0,G.jsx)(`span`,{className:`mono text-muted`,children:Me.available})]})},{id:`attention`,label:(0,G.jsxs)(G.Fragment,{children:[e(`needsAttention`),(0,G.jsx)(`span`,{className:`mono ${Me.attention?`text-danger`:`text-muted`}`,children:Me.attention})]})},{id:`disabled`,label:(0,G.jsxs)(G.Fragment,{children:[e(`disabled`),(0,G.jsx)(`span`,{className:`mono text-muted`,children:Me.disabled})]})}]}),(0,G.jsxs)(KP,{className:`w-48`,"aria-label":e(`providerFilterAll`),value:le||j9,onChange:e=>{typeof e==`string`&&ue(e===j9?``:e)},children:[(0,G.jsxs)(KP.Trigger,{className:`items-center`,children:[(0,G.jsx)(KP.Value,{className:`min-w-0 truncate`}),(0,G.jsx)(KP.Indicator,{})]}),(0,G.jsx)(KP.Popover,{children:(0,G.jsxs)(SP,{children:[(0,G.jsxs)(SP.Item,{id:j9,textValue:e(`providerFilterAll`),children:[(0,G.jsxs)(jM,{className:`flex items-center gap-2`,children:[e(`providerFilterAll`),(0,G.jsx)(`span`,{className:`mono text-muted`,children:d.length})]}),(0,G.jsx)(SP.ItemIndicator,{})]}),Ne.map(([t,n])=>(0,G.jsxs)(SP.Item,{id:t,textValue:JV(t,e),children:[(0,G.jsxs)(jM,{className:`flex items-center gap-2`,children:[(0,G.jsx)(XV,{provider:t,size:13}),JV(t,e),(0,G.jsx)(`span`,{className:`mono text-muted`,children:n})]}),(0,G.jsx)(SP.ItemIndicator,{})]},t))]})})]}),(0,G.jsx)(B7,{className:`w-full sm:w-60`,value:ae,onChange:oe,placeholder:e(`searchAccounts`),ariaLabel:e(`searchAccounts`)})]}):null,(0,G.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-end gap-2 sm:ml-auto sm:w-auto`,children:[(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:Te,isDisabled:Ce,onPress:()=>void it(),children:[(0,G.jsx)(fi,{size:14}),e(`checkinAll`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:Ce,isDisabled:Te,onPress:()=>void Qe(),children:[(0,G.jsx)(oi,{size:14}),e(`refreshCredits`)]}),(0,G.jsxs)(`label`,{htmlFor:`accounts-batch-import-file`,className:`button button--sm button--secondary inline-flex items-center gap-1.5 ${h||_?`pointer-events-none opacity-60`:`cursor-pointer`}`,children:[h?(0,G.jsx)(QB,{size:14,loading:!0}):(0,G.jsx)(uo,{size:14}),e(`batchImport`)]}),(0,G.jsx)(`input`,{id:`accounts-batch-import-file`,type:`file`,accept:`.json,application/json,text/json`,disabled:h||_,className:`sr-only`,onChange:e=>void et(e)}),(0,G.jsxs)(J,{size:`sm`,onPress:()=>m(!0),children:[(0,G.jsx)(Ma,{size:14}),e(`addAccount`)]})]})]}),(0,G.jsx)(STe,{isOpen:p,onClose:()=>m(!1),onAdded:()=>{pV({type:`success`,title:e(`toastAccountAdded`)}),De(!1)}}),(0,G.jsx)(wTe,{isOpen:_,detection:b,fileName:w,isPending:h,t:e,onClose:$e,onConfirm:e=>{tt(e)}}),(0,G.jsx)(rTe,{account:Fe,t:e,onClose:()=>B(null)},z??`closed`),(0,G.jsx)(tTe,{account:Ie,t:e,onClose:()=>H(null)},V??`closed`),(0,G.jsx)(sTe,{account:Le,checkinDefaultTime:Le&&ke(Le)?r?.checkin_times[Le.provider||``]:void 0,checkinTimezone:Le?Ae(Le):void 0,busy:!!(E&&E.id===te&&E.kind===`settings`),t:e,onClose:()=>ne(null),onSave:e=>ot(te||``,e)},te??`closed`),(0,G.jsx)(E9,{isOpen:!!Pe,title:e(`delete`),description:e(`deleteAccountConfirm`,{name:Pe?.name||Pe?.id||``}),confirmLabel:e(`delete`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:E?.id===ee&&E.kind===`delete`,onClose:()=>R(null),onConfirm:()=>{if(!Pe)return;let t=Pe.id;R(null),Ge(t,`delete`,async()=>{await use(t),await De(!1)}).then(t=>{t&&pV({type:`success`,title:e(`toastAccountDeleted`)})})}}),f?null:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(I7,{className:`rounded-3xl bg-surface-secondary`,icon:(0,G.jsx)(QB,{size:28}),title:e(`noAccounts`),hint:e(`accountEmptyHint`),action:(0,G.jsxs)(J,{size:`sm`,onPress:()=>m(!0),children:[(0,G.jsx)(Ma,{size:14}),e(`addAccount`)]})}),(0,G.jsx)(`div`,{className:`text-center`,children:(0,G.jsx)(e9,{})})]}),f&&!Re.length?(0,G.jsx)(I7,{className:`rounded-3xl bg-surface-secondary`,icon:(0,G.jsx)(va,{size:22}),title:e(`noAccountsMatch`),action:(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:()=>{oe(``),ce(`all`),ue(``)},children:e(`clearFilters`)})}):null,(0,G.jsx)(`section`,{className:`grid auto-rows-[minmax(280px,auto)] gap-2.5 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4`,children:We.map(t=>(0,G.jsx)(Qwe,{account:t,busyKind:E?.id===t.id?E.kind:``,authPanelOpen:re===t.id,authUrl:I[t.id],note:M[t.id],pat:O[t.id]||``,t:e,onPatChange:e=>k(n=>({...n,[t.id]:e})),callbackUrl:A[t.id]||``,onCallbackChange:e=>j(n=>({...n,[t.id]:e})),onSubmitCallback:()=>void qe(t.id),onDeviceLogin:e=>void Ke(t.id,e),onPatLogin:()=>void Je(t.id),onExport:()=>void Ye(t.id),onRefresh:()=>void Ze(t.id),onDelete:()=>R(t.id),onToggle:e=>void Xe(t.id,e),checkinDefaultTime:r?.checkin_times[t.provider||``],onToggleAutoCheckin:ke(t)?e=>void nt(t.id,e):void 0,onCheckin:ke(t)?()=>void at(t.id):void 0,checkinFeedback:P[t.id]??null,onViewCheckins:ke(t)?()=>H(t.id):void 0,onEdit:()=>ne(t.id),onToggleAuthPanel:()=>ie(e=>e===t.id?null:t.id),onViewModels:()=>B(t.id)},t.id))}),Re.length?(0,G.jsx)(z7,{total:Re.length,page:Ue,pageCount:He,pageSize:pe,pageSizes:owe,loading:!1,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:Ue,pages:He}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:fe,onPageSize:me}):null]})}function RTe(){let{t:e,lang:t,setLang:n}=JF(),{setApiKey:r}=ZF(),{overview:i,refresh:a}=gI(),{theme:o,toggleTheme:s}=yI(),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(``),g=at(),_=nt().state?.from||`/`,y=(0,v.useRef)(null);if(Bce(y,`login`),i)return(0,G.jsx)(At,{to:_===`/login`?`/`:_,replace:!0});async function b(t){t.preventDefault();let n=c.trim();if(!n){h(e(`loginNeedKey`));return}p(!0),h(``);try{r(n),await a(n),g(_===`/login`?`/`:_,{replace:!0})}catch(t){h(eI(t)?e(`loginBadKey`):t instanceof Error?t.message:String(t))}finally{p(!1)}}return(0,G.jsxs)(`div`,{className:`relative min-h-dvh overflow-hidden bg-background text-foreground`,children:[(0,G.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-border`}),(0,G.jsxs)(`main`,{ref:y,className:`relative z-10 mx-auto grid min-h-dvh w-full max-w-[1480px] lg:grid-cols-[minmax(0,1fr)_minmax(380px,30rem)]`,children:[(0,G.jsxs)(`section`,{className:`flex min-h-[52vh] flex-col px-5 py-6 sm:px-8 sm:py-8 lg:min-h-dvh lg:px-8 lg:py-10 xl:px-10`,children:[(0,G.jsxs)(`header`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(QB,{size:36}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-semibold`,children:`CLI2API`}),(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e(`controlPlane`)})]})]}),(0,G.jsxs)(yj,{isAttached:!0,children:[(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:()=>n(t===`zh`?`en`:`zh`),"aria-label":t===`zh`?`English`:`中文`,children:(0,G.jsx)(ia,{size:15})})}),(0,G.jsx)(Mj.Content,{children:t===`zh`?`English`:`中文`})]}),(0,G.jsxs)(Mj,{children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:s,"aria-label":o===`dark`?`Light mode`:`Dark mode`,children:o===`dark`?(0,G.jsx)(Qa,{size:15}):(0,G.jsx)(ba,{size:15})})}),(0,G.jsx)(Mj.Content,{children:o===`dark`?`Light mode`:`Dark mode`})]})]})]}),(0,G.jsx)(`div`,{className:`my-auto w-full py-8 lg:py-10`,children:(0,G.jsx)(w7,{t:e,defaultExpanded:!0,forceMockDemo:!0,bare:!0,live:null,mockPace:.45})}),(0,G.jsxs)(`footer`,{className:`hidden items-center justify-between text-caption text-muted lg:flex`,children:[(0,G.jsx)(`span`,{children:e(`loginHint`)}),(0,G.jsx)(`span`,{children:e(`routesHint`)})]})]}),(0,G.jsx)(`section`,{className:`flex items-center px-5 py-10 sm:px-8 lg:px-8 xl:px-10`,children:(0,G.jsx)(CS,{"data-gsap-reveal":!0,variant:`transparent`,className:`w-full bg-transparent p-0 shadow-none`,children:(0,G.jsxs)(`form`,{onSubmit:e=>void b(e),children:[(0,G.jsx)(CS.Header,{className:`px-2 py-6 sm:px-4`,children:(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,G.jsx)(QB,{size:28,loading:f}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(CS.Title,{className:`text-title`,children:e(`loginFormTitle`)}),(0,G.jsx)(CS.Description,{className:`mt-1`,children:e(`loginDesc`)})]})]})}),(0,G.jsxs)(CS.Content,{className:`space-y-5 px-6 py-7 sm:px-8 sm:py-8`,children:[(0,G.jsxs)(Wj,{name:`console-password`,className:`w-full`,isInvalid:!!m,children:[(0,G.jsx)(jM,{children:e(`loginPassword`)}),(0,G.jsxs)(Vj,{children:[(0,G.jsx)(Vj.Input,{id:`console-password`,type:u?`text`:`password`,value:c,onChange:e=>l(e.target.value),placeholder:e(`loginPasswordPh`),autoComplete:`current-password`,autoFocus:!0,"aria-label":e(`loginPassword`),spellCheck:!1}),(0,G.jsx)(Vj.Suffix,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,type:`button`,"aria-label":e(u?`hidePassword`:`showPassword`),onPress:()=>d(e=>!e),children:u?(0,G.jsx)(Ji,{size:16}):(0,G.jsx)(Ki,{size:16})})})]})]}),m?(0,G.jsx)(xI,{title:m}):(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:e(`loginHint`)}),(0,G.jsxs)(J,{type:`submit`,fullWidth:!0,size:`lg`,isPending:f,children:[e(f?`loggingInConsole`:`loginSubmit`),f?null:(0,G.jsx)(ei,{size:17})]})]})]})})})]})]})}function N9(){return tI(`/api/keys`)}function zTe(e){return tI(`/api/keys`,{method:`POST`,body:JSON.stringify(e)})}function P9(e,t){return tI(`/api/keys/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)})}function BTe(e){return tI(`/api/keys/${encodeURIComponent(e)}`,{method:`DELETE`})}function VTe(){return tI(`/api/system/console-key`)}function HTe(){return tI(`/api/system/console-key`,{method:`POST`,body:JSON.stringify({rotate:!0})})}function UTe({settings:e,onSaved:t}){let{t:n}=JF(),r=at(),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)({}),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``);(0,v.useEffect)(()=>{let e=!0;return dI().then(t=>{e&&a((t.data||[]).filter(e=>e.regions.some(e=>e.checkin)))}).catch(t=>{e&&d(String(t))}),()=>{e=!1}},[]);async function f(n,r){if(!(!e||r===e.checkin_times[n])){l(!0),d(``);try{t(await CI({checkin_times:{[n]:r}}))}catch(e){d(e instanceof Error?e.message:String(e))}finally{s(e=>{let t={...e};return delete t[n],t}),l(!1)}}}return(0,G.jsxs)(CS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(CS.Header,{children:[(0,G.jsx)(CS.Title,{children:n(`checkinDefaultsTitle`)}),(0,G.jsx)(CS.Description,{children:n(`checkinDefaultsHint`)})]}),(0,G.jsxs)(CS.Content,{className:`space-y-4`,children:[u?(0,G.jsx)(xI,{title:u}):null,!e||!i?(0,G.jsx)(Q,{className:`h-24 w-full`}):i.map(t=>(0,G.jsx)(_9,{label:t.label,hint:t.regions.filter(e=>e.checkin).map(t=>`${t.label} · ${t.checkin?.timezone===`Local`?e.timezone:t.checkin?.timezone}`).join(` / `),children:(0,G.jsx)(Rj,{type:`time`,value:o[t.id]??e.checkin_times[t.id]??``,disabled:c,"aria-label":`${t.label} ${n(`autoCheckinTime`)}`,onChange:e=>s(n=>({...n,[t.id]:e.target.value})),onBlur:e=>void f(t.id,e.target.value)})},t.id))]}),(0,G.jsx)(CS.Footer,{children:(0,G.jsx)(J,{variant:`secondary`,onPress:()=>r(`/accounts`),children:n(`navAccounts`)})})]})}function WTe(e,t){if(!e)return``;let n=new Date(e);return Number.isNaN(n.getTime())?``:n.toLocaleDateString(t===`zh`?`zh-CN`:`en-US`,{year:`numeric`,month:`short`,day:`numeric`})}function GTe({releases:e,currentVersion:t,nextVersion:n,rollbackTags:r,canRollback:i,submitting:a,onRestore:o}){let{t:s,lang:c}=JF();if(!e.length)return null;let l=n&&n!==t?n:t,u=e.some(e=>e.tag_name===l)?l:e[0]?.tag_name,d=new Set(r);return(0,G.jsxs)(`div`,{className:`mt-5`,children:[(0,G.jsx)(`div`,{className:`mb-2`,children:(0,G.jsx)(`p`,{className:`text-caption font-medium text-foreground`,children:s(`versionHistory`)})}),(0,G.jsx)(yh,{className:`rounded-lg bg-surface-secondary`,hideSeparator:!0,defaultExpandedKeys:u?[u]:[],children:e.map(e=>{let r=e.tag_name,l=r===t,u=!!(n&&r===n&&n!==t),f=i&&d.has(r)&&!l,p=WTe(e.published_at,c);return(0,G.jsxs)(yh.Item,{id:r,children:[(0,G.jsx)(yh.Heading,{children:(0,G.jsxs)(yh.Trigger,{className:`items-center gap-3 px-3 py-2.5 text-left`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`mono text-body font-semibold`,children:r}),l?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`success`,children:s(`versionCurrentBadge`)}):null,u?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`warning`,children:s(`versionLatestBadge`)}):null,p?(0,G.jsx)(`span`,{className:`truncate text-caption text-muted`,children:p}):null]}),(0,G.jsx)(yh.Indicator,{})]})}),(0,G.jsx)(yh.Panel,{children:(0,G.jsxs)(yh.Body,{className:`px-3 pb-3`,children:[(0,G.jsx)(`div`,{className:`release-notes-box release-notes-box--compact`,children:(0,G.jsx)(OI,{markdown:EI(e.body,c),emptyLabel:s(`updateNoNotes`)})}),f?(0,G.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isDisabled:a,onPress:()=>o(r),children:s(`restoreThisVersion`)})}):null]})})]},r)})})]})}function F9(e){let t=new Set,n=[];for(let r of e){let e=r.tag_name?.trim();!e||t.has(e)||(t.add(e),n.push({...r,tag_name:e}))}return n}function KTe(e,t,n,r,i){return r?.length?F9(r):F9([...n?[n]:t?[{tag_name:t}]:[],...e?[{tag_name:e}]:[],...i||[]])}var qTe=[`general`,`routing`,`security`,`updates`];function JTe(){let{t:e}=JF(),[t,n]=On(),r=t.get(`tab`),i=r&&qTe.includes(r)?r:`general`,a=e=>n(e===`general`?{}:{tab:e},{replace:!0}),{setApiKey:o}=ZF(),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(``),E=TI(),{info:D,loading:O,checking:k,submitting:A,error:j,setError:M,load:N,canRollback:P,rollbackTo:F}=E,I=(0,v.useMemo)(()=>KTe(D?.current_version||``,D?.next_version,D?.release,D?.recent_releases,D?.rollback_versions),[D?.current_version,D?.next_version,D?.release,D?.recent_releases,D?.rollback_versions]),L=(0,v.useMemo)(()=>(D?.rollback_versions||[]).map(e=>e.tag_name),[D?.rollback_versions]);(0,v.useEffect)(()=>{let e=window.setTimeout(()=>{VTe().then(c).catch(()=>void 0),SI().then(e=>{u(e),f(e.proxy_url||``)}).catch(e=>M(e instanceof Error?e.message:String(e)))},0);return()=>window.clearTimeout(e)},[M]);async function ee(e){let t=l?.cross_provider_model_pool??!0;u(t=>t&&{...t,cross_provider_model_pool:e}),m(!0),M(``);try{u(await CI({cross_provider_model_pool:e}))}catch(e){u(e=>e&&{...e,cross_provider_model_pool:t}),M(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function R(e){let t=l?.checkin_disabled_accounts??!1;u(t=>t&&{...t,checkin_disabled_accounts:e}),m(!0),M(``);try{u(await CI({checkin_disabled_accounts:e}))}catch(e){u(e=>e&&{...e,checkin_disabled_accounts:t}),M(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function z(e){let t=l?.proxy_url||``;if(e===t){f(t);return}let n=d;f(e),u(t=>t&&{...t,proxy_url:e}),m(!0),M(``);try{let t=await CI({proxy_url:e});u(t),f(t.proxy_url||``)}catch(e){f(n),u(e=>e&&{...e,proxy_url:t}),M(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function B(e){let t=l?.routing_strategy||`round-robin`;u(t=>t&&{...t,routing_strategy:e}),m(!0),M(``);try{u(await CI({routing_strategy:e}))}catch(e){u(e=>e&&{...e,routing_strategy:t}),M(e instanceof Error?e.message:String(e))}finally{m(!1)}}return O&&!D?(0,G.jsx)(zce,{}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:e(`systemSettingsTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`systemSettingsLead`)})]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:k,onPress:()=>void N(!0),children:[(0,G.jsx)(Qr,{size:15}),e(`checkUpdates`)]})]}),j?(0,G.jsx)(xI,{title:j}):null,(0,G.jsxs)(OA,{selectedKey:i,onSelectionChange:e=>a(String(e)),children:[(0,G.jsx)(OA.ListContainer,{className:`w-fit max-w-full overflow-x-auto`,children:(0,G.jsxs)(OA.List,{"aria-label":e(`systemSettingsTitle`),children:[(0,G.jsxs)(DA,{id:`general`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{}),(0,G.jsx)(na,{size:13}),e(`settingsTabGeneral`)]}),(0,G.jsxs)(DA,{id:`routing`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{}),(0,G.jsx)(ci,{size:13}),e(`settingsTabRouting`)]}),(0,G.jsxs)(DA,{id:`security`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{}),(0,G.jsx)(Ia,{size:13}),e(`settingsTabSecurity`)]}),(0,G.jsxs)(DA,{id:`updates`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{}),(0,G.jsx)(Xr,{size:13}),e(`settingsTabUpdates`)]})]})}),(0,G.jsx)(OA.Panel,{id:`general`,className:`pt-5`,children:(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,G.jsxs)(CS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Ha,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`proxySettingsTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`proxySettingsHint`)})]})]}),(0,G.jsxs)(`div`,{className:`mt-4 space-y-1.5`,children:[(0,G.jsx)(jM,{className:`text-body font-medium text-muted`,children:e(`proxyUrl`)}),(0,G.jsx)(Rj,{value:d,onChange:e=>f(e.target.value),onBlur:e=>void z(e.target.value.trim()),placeholder:e(`proxyUrlPlaceholder`),disabled:p||!l}),(0,G.jsx)(NM,{className:`text-caption leading-5 text-muted`,children:e(`proxyUrlHint`)})]})]}),(0,G.jsxs)(CS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Oi,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`checkinDisabledAccountsTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`checkinDisabledAccountsHint`)})]})]}),(0,G.jsx)(h7,{isSelected:l?.checkin_disabled_accounts??!1,isDisabled:p||!l,ariaLabel:e(`checkinDisabledAccountsAriaLabel`),onChange:e=>void R(e)})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between pt-3 text-caption text-muted`,children:[(0,G.jsx)(`span`,{children:e(`checkinDisabledAccountsStatus`)}),(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:l?.checkin_disabled_accounts?e(`enabled`):e(`disabled`)})]})]}),(0,G.jsx)(UTe,{settings:l,onSaved:u})]})}),(0,G.jsx)(OA.Panel,{id:`routing`,className:`pt-5`,children:(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,G.jsxs)(CS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Ha,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`routingStrategyTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`routingStrategyHint`)})]})]}),(0,G.jsx)(`div`,{className:`mt-4 pt-4`,children:(0,G.jsx)(_9,{label:e(`routingStrategy`),children:(0,G.jsxs)(KP,{fullWidth:!0,"aria-label":e(`routingStrategy`),value:l?.routing_strategy||`round-robin`,isDisabled:p||!l,onChange:e=>{typeof e==`string`&&e&&B(e)},children:[(0,G.jsxs)(KP.Trigger,{className:`items-center`,children:[(0,G.jsx)(KP.Value,{className:`min-w-0 truncate`}),(0,G.jsx)(KP.Indicator,{})]}),(0,G.jsx)(KP.Popover,{children:(0,G.jsxs)(SP,{children:[(0,G.jsxs)(SP.Item,{id:`round-robin`,textValue:`round-robin`,children:[(0,G.jsx)(jM,{children:e(`routingRoundRobin`)}),(0,G.jsx)(SP.ItemIndicator,{})]}),(0,G.jsxs)(SP.Item,{id:`weighted-round-robin`,textValue:`weighted-round-robin`,children:[(0,G.jsx)(jM,{children:e(`routingWeightedRoundRobin`)}),(0,G.jsx)(SP.ItemIndicator,{})]}),(0,G.jsxs)(SP.Item,{id:`fill-first`,textValue:`fill-first`,children:[(0,G.jsx)(jM,{children:e(`routingFillFirst`)}),(0,G.jsx)(SP.ItemIndicator,{})]}),(0,G.jsxs)(SP.Item,{id:`fefo`,textValue:`fefo`,children:[(0,G.jsx)(jM,{children:e(`routingFEFO`)}),(0,G.jsx)(SP.ItemIndicator,{})]})]})})]})})}),(0,G.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2 pt-3 text-caption text-muted sm:grid-cols-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:l?.session_affinity?.ttl_seconds?`${Math.round(l.session_affinity.ttl_seconds/60)}m`:`—`}),e(`sessionAffinityTTL`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:l?.session_affinity?.hits??0}),e(`sessionAffinityHits`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:l?.session_affinity?.misses??0}),e(`sessionAffinityMisses`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:l?.session_affinity?.escapes??0}),e(`sessionAffinityEscapes`)]})]}),l?.session_affinity?.last_escape_reason?(0,G.jsxs)(NM,{className:`mt-3 text-caption`,children:[e(`lastSessionEscape`),`: `,l.session_affinity.last_escape_reason]}):null,l?.session_affinity?.last_miss_reason?(0,G.jsxs)(NM,{className:`mt-1 text-caption`,children:[e(`lastSessionMiss`),`: `,l.session_affinity.last_miss_reason]}):null]}),(0,G.jsxs)(CS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Ha,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`crossProviderModelPoolTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`crossProviderModelPoolHint`)})]})]}),(0,G.jsx)(h7,{isSelected:l?.cross_provider_model_pool??!0,isDisabled:p||!l,ariaLabel:e(`crossProviderModelPoolAriaLabel`),onChange:e=>void ee(e)})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between pt-3 text-caption text-muted`,children:[(0,G.jsx)(`span`,{children:e(`crossProviderModelPoolStatus`)}),(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:l?.cross_provider_model_pool?e(`enabled`):e(`disabled`)})]})]})]})}),(0,G.jsx)(OA.Panel,{id:`security`,className:`pt-5`,children:(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,G.jsxs)(CS,{"data-gsap-reveal":!0,children:[(0,G.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(ua,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`consoleKeyTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`consoleKeyHint`)})]})]})}),(0,G.jsx)(`code`,{className:`mono mt-4 block rounded-lg bg-surface-secondary px-3 py-2 text-caption text-muted`,children:s?.prefix||`—`}),(0,G.jsx)(`p`,{className:`mt-3 text-caption leading-5 text-muted`,children:e(`consoleKeyLead`)}),(0,G.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isPending:h,onPress:()=>y(!0),children:e(`consoleKeyRotate`)})})]}),(0,G.jsxs)(CS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Hi,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`sqliteProtection`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`sqliteProtectionHint`)})]})]}),(0,G.jsx)(Ia,{size:18,className:`text-success`})]}),(0,G.jsx)(`div`,{className:`mono mt-4 rounded-lg bg-surface-secondary px-3 py-2 text-caption text-muted`,children:`/data`}),(0,G.jsxs)(`div`,{className:`mt-3 grid gap-2 text-caption text-muted`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Oi,{size:14,className:`text-muted`}),e(`sqliteBackupBeforeUpdate`)]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Oi,{size:14,className:`text-muted`}),e(`sqliteKeepFive`)]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Oi,{size:14,className:`text-muted`}),e(`sqliteRollbackTogether`)]})]})]})]})}),(0,G.jsx)(OA.Panel,{id:`updates`,className:`pt-5`,children:(0,G.jsx)(`div`,{className:`grid gap-5`,children:(0,G.jsxs)(CS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`versionUpdate`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:e(`latestVersionHint`)})]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:D?.has_update?`warning`:`success`,children:D?.has_update?e(`updateAvailable`):e(`upToDate`)})]}),(0,G.jsxs)(`div`,{className:`px-5 py-5`,children:[(0,G.jsx)(bI,{update:E}),(0,G.jsx)(GTe,{releases:I,currentVersion:D?.current_version||``,nextVersion:D?.next_version,rollbackTags:L,canRollback:P,submitting:A,onRestore:T})]})]})})})]}),(0,G.jsx)(E9,{isOpen:!!w,title:e(`restoreVersionTitle`,{version:w}),description:e(`restoreVersionHint`),confirmLabel:e(`restoreThisVersion`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:A,status:`warning`,confirmVariant:`primary`,onClose:()=>{A||T(``)},onConfirm:()=>{let e=w;T(``),F(e)}}),(0,G.jsx)(Y.Root,{isOpen:_,onOpenChange:e=>{!e&&!h&&y(!1)},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,isDismissable:!h,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`sm`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`consoleKeyRotate`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`consoleKeyRotateHint`)})]}),(0,G.jsx)(Y.CloseTrigger,{isDisabled:h,"aria-label":e(`close`),className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(yo,{size:16})})]}),(0,G.jsxs)(Y.Footer,{className:`justify-end`,children:[(0,G.jsx)(J,{variant:`ghost`,isDisabled:h,onPress:()=>y(!1),children:e(`cancel`)}),(0,G.jsx)(J,{variant:`danger`,isPending:h,onPress:()=>{g(!0),HTe().then(e=>{c(e),x(e.secret||``),e.secret&&o(e.secret),y(!1)}).catch(e=>{M(e instanceof Error?e.message:String(e))}).finally(()=>g(!1))},children:e(`consoleKeyRotateNow`)})]})]})})})}),(0,G.jsx)(Y.Root,{isOpen:!!b,onOpenChange:e=>{e||x(``)},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`lg`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`consoleKeySecretTitle`)}),(0,G.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:e(`consoleKeySecretHint`)})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":e(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(yo,{size:18})})]}),(0,G.jsx)(Y.Body,{className:`px-6 pb-2`,children:(0,G.jsx)(`code`,{className:`mono block break-all rounded-lg bg-surface-secondary px-3 py-3 text-body`,children:b})}),(0,G.jsxs)(Y.Footer,{className:`justify-end`,children:[(0,G.jsx)(J,{variant:`ghost`,onPress:()=>x(``),children:e(`close`)}),(0,G.jsxs)(J,{onPress:()=>{Z7(b),C(!0),window.setTimeout(()=>C(!1),1200)},children:[(0,G.jsx)(Ii,{size:14}),e(S?`copied`:`copy`)]})]})]})})})})]})}var I9=`__all__`;function YTe(e,t){let n=t.trim().toLowerCase();return!n||e.label.toLowerCase().includes(n)||e.id.toLowerCase().includes(n)}function L9({value:e,onChange:t,ariaLabel:n,options:r,allLabel:i,searchPlaceholder:a,emptyLabel:o,loadOptions:s,className:c}){let[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)([]),[p,m]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(!s)return;let e=!1,t=window.setTimeout(()=>{m(!0),s(l.trim()).then(t=>{e||f(t)}).catch(()=>{e||f([])}).finally(()=>{e||m(!1)})},l.trim()?280:0);return()=>{e=!0,window.clearTimeout(t)}},[s,l]);let h=e||I9,g=(0,v.useMemo)(()=>{let t=s?d:r.filter(e=>YTe(e,l)),n=new Map;l.trim()||n.set(I9,{id:I9,label:i});for(let e of t)!e.id||e.id===I9||n.set(e.id,e);if(e){let t=r.find(t=>t.id===e)||d.find(t=>t.id===e)||{id:e,label:e};n.set(e,t)}return[...n.values()]},[i,s,r,l,d,e]),_=g.find(e=>e.id===h)||(e?{id:e,label:e}:{id:I9,label:i});return(0,G.jsxs)(mS,{className:[`w-fit`,c].filter(Boolean).join(` `),"aria-label":n,value:h,onChange:e=>{typeof e==`string`&&(t(e===I9?``:e),u(``))},onClear:()=>{t(``),u(``)},children:[(0,G.jsxs)(mS.Trigger,{className:`min-w-44 items-center`,children:[(0,G.jsx)(mS.Value,{className:`min-w-0 truncate`,children:({defaultChildren:e,isPlaceholder:t})=>t?e:(0,G.jsx)(`span`,{className:`truncate`,children:_.label})}),e?(0,G.jsx)(mS.ClearButton,{}):null,(0,G.jsx)(mS.Indicator,{})]}),(0,G.jsx)(mS.Popover,{className:`min-w-56`,children:(0,G.jsxs)(mS.Filter,{inputValue:l,onInputChange:u,filter:()=>!0,children:[(0,G.jsx)(kM,{"aria-label":a,className:`px-2 pt-2`,autoFocus:!0,children:(0,G.jsxs)(kM.Group,{children:[(0,G.jsx)(kM.SearchIcon,{}),(0,G.jsx)(kM.Input,{placeholder:a}),(0,G.jsx)(kM.ClearButton,{})]})}),(0,G.jsx)(SP,{children:g.length===0?(0,G.jsx)(SP.Item,{id:`__empty__`,textValue:o,isDisabled:!0,children:(0,G.jsx)(jM,{className:`block truncate text-muted`,children:p?a:o})}):g.map(e=>(0,G.jsxs)(SP.Item,{id:e.id,textValue:e.label,children:[(0,G.jsx)(jM,{className:`block truncate`,children:e.label}),e.id!==I9&&e.id!==e.label?(0,G.jsx)(`span`,{className:`mono mt-0.5 block truncate text-caption text-muted`,children:e.id}):null,(0,G.jsx)(SP.ItemIndicator,{})]},e.id))})]})})]})}function R9(){let[e,t]=(0,v.useState)([]);return(0,v.useEffect)(()=>{let e=!1;return N9().then(n=>{e||t(n.data||[])}).catch(()=>{}),()=>{e=!0}},[]),{keys:e,nameById:(0,v.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.id,n.name||n.id);return t},[e]),options:(0,v.useMemo)(()=>e.map(e=>({id:e.id,label:e.name||e.id})),[e])}}function z9(e){return e===`ok`?`success`:e===`streaming`||e===`started`||e===`incomplete`?`warning`:e===`error`||e===`canceled`?`danger`:`default`}function XTe(e){if(e===`error`)return`danger`;if(e!==`warn`)return`ok`}function ZTe(e){return e===`error`?`danger`:e===`warn`?`warning`:e===`info`?`success`:`default`}function B9(e,t=`zh`){if(!e)return`—`;let n=new Date(e);return Number.isFinite(n.getTime())?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).format(n):e}function V9(e){let t=e.requested_reasoning?.trim()||``,n=e.resolved_reasoning?.trim()||``;return!t&&!n?``:t&&n&&t!==n?`${t} → ${n}`:n||t}function H9({log:e,inLabel:t,outLabel:n,pointsLabel:r}){let i=e.prompt_tokens,a=e.completion_tokens,o=e.credits??e.usage_detail?.credit,s=o!=null&&Number.isFinite(o)?U9(o):null;return i==null&&a==null&&s==null?(0,G.jsx)(`span`,{className:`mono text-xs text-muted`,children:`—`}):(0,G.jsxs)(`div`,{className:`leading-4`,children:[i!=null||a!=null?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`mono text-xs`,children:[i??0,` / `,a??0]}),(0,G.jsxs)(`div`,{className:`mt-0.5 text-caption text-muted`,children:[t,` / `,n]})]}):null,s==null?null:(0,G.jsx)(`div`,{className:`mono text-caption text-success ${i!=null||a!=null?`mt-0.5`:``}`,children:r?r(s):s})]})}function QTe(){return(0,G.jsxs)(`div`,{className:`space-y-5`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,G.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:Array.from({length:8},(e,t)=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(Q,{className:`h-3 w-20`}),(0,G.jsx)(Q,{className:`h-5 w-36 max-w-full`})]},t))}),(0,G.jsxs)(`div`,{className:`space-y-3 rounded-lg bg-surface-secondary px-3 py-3`,children:[(0,G.jsx)(Q,{className:`h-3 w-24`}),(0,G.jsx)(Q,{className:`h-4 w-full`}),(0,G.jsx)(Q,{className:`h-4 w-4/5`})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(Q,{className:`h-3 w-20`}),(0,G.jsx)(Q,{className:`h-16 w-full`})]})]})}function U9(e){return e==null||!Number.isFinite(e)?`—`:String(Math.round(e*1e4)/1e4)}var $Te=[`all`,`ok`,`incomplete`,`error`,`canceled`],eEe=[`all`,`quota`,`rate_limit`,`auth`,`not_ready`,`unavailable`,`invalid_request`,`model_not_available`],tEe=[`all`,`1h`,`24h`,`7d`,`custom`];function W9(e){let t=(e,t,n)=>t.includes(e??``)?e:n,n=MV(e.get(`from`)),r=MV(e.get(`to`)),i=n&&r?{start:n,end:r}:null,a=e.get(`stream`);return{requestFilter:t(e.get(`status`),$Te,`all`),requestId:e.get(`id`)??``,accountFilter:e.get(`account`)??``,apiKeyFilter:e.get(`api_key`)??``,modelFilter:e.get(`model`)??``,providerFilter:e.get(`provider`)??``,streamFilter:a===`stream`||a===`true`?`stream`:a===`sync`||a===`false`?`sync`:`all`,errorKind:t(e.get(`error_kind`),eEe,`all`),timeRange:i?`custom`:t(e.get(`range`),tEe,`1h`),customRange:i}}function nEe(e){let t=new URLSearchParams;e.requestFilter!==`all`&&t.set(`status`,e.requestFilter),e.requestId&&t.set(`id`,e.requestId),e.accountFilter&&t.set(`account`,e.accountFilter),e.apiKeyFilter&&t.set(`api_key`,e.apiKeyFilter),e.modelFilter&&t.set(`model`,e.modelFilter),e.providerFilter&&t.set(`provider`,e.providerFilter),e.streamFilter!==`all`&&t.set(`stream`,e.streamFilter),e.errorKind!==`all`&&t.set(`error_kind`,e.errorKind);let n=e.timeRange===`custom`?jV(e.customRange?.start):void 0,r=e.timeRange===`custom`?jV(e.customRange?.end,!0):void 0;return n&&r?(t.set(`from`,n),t.set(`to`,r)):e.timeRange!==`1h`&&t.set(`range`,e.timeRange),t.toString()}function rEe(e){if(e===`all`||e===`custom`)return{from:void 0,to:void 0};let t=new Date,n=new Date(t);return e===`1h`&&n.setHours(n.getHours()-1),e===`24h`&&n.setHours(n.getHours()-24),e===`7d`&&n.setDate(n.getDate()-7),{from:n.toISOString(),to:t.toISOString()}}function iEe(){let{t:e,lang:t}=JF(),[n,r]=On(),[i]=(0,v.useState)(()=>W9(new URLSearchParams(window.location.search))),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(`requests`),[d,f]=(0,v.useState)(!0),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(i.requestFilter),[b,x]=(0,v.useState)(`all`),[S,C]=(0,v.useState)(i.requestId),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(i.accountFilter),[O,k]=(0,v.useState)(i.apiKeyFilter),[A,j]=(0,v.useState)(``),[M,N]=(0,v.useState)(i.modelFilter),[P,F]=(0,v.useState)(i.providerFilter),[I,L]=(0,v.useState)(i.streamFilter),[ee,R]=(0,v.useState)(i.errorKind),[z,B]=(0,v.useState)(i.timeRange),[V,H]=(0,v.useState)(i.customRange),[te,ne]=(0,v.useState)(1),[re,ie]=(0,v.useState)(50),[ae,oe]=(0,v.useState)(1),[se,ce]=(0,v.useState)(50),[le,ue]=(0,v.useState)([]),[de,fe]=(0,v.useState)(0),[pe,me]=(0,v.useState)([]),[he,ge]=(0,v.useState)(0),[_e,ve]=(0,v.useState)(null),[ye,be]=(0,v.useState)(!1),[xe,Se]=(0,v.useState)(null),[Ce,we]=(0,v.useState)(!1),[Te,Ee]=(0,v.useState)(!1),[De,Oe]=(0,v.useState)(``),ke=(0,v.useRef)(0),[Ae,je]=(0,v.useState)(!1),[Me,Ne]=(0,v.useState)(!1),Pe=n.toString(),Fe=nEe({requestFilter:_,requestId:S,accountFilter:E,apiKeyFilter:O,modelFilter:M,providerFilter:P,streamFilter:I,errorKind:ee,timeRange:z,customRange:V}),Ie=(0,v.useRef)(Pe);(0,v.useEffect)(()=>{if(Pe===Ie.current)return;Ie.current=Pe;let e=W9(new URLSearchParams(Pe));y(e.requestFilter),C(e.requestId),D(e.accountFilter),k(e.apiKeyFilter),N(e.modelFilter),F(e.providerFilter),L(e.streamFilter),R(e.errorKind),B(e.timeRange),H(e.customRange)},[Pe]),(0,v.useEffect)(()=>{Fe!==Ie.current&&(Ie.current=Fe,r(Fe,{replace:!0}))},[Fe,r]),(0,v.useEffect)(()=>{let e=!1;return Promise.allSettled([nI(!1),lI()]).then(([t,n])=>{e||(t.status===`fulfilled`&&o(t.value.data||[]),n.status===`fulfilled`&&c(n.value.data||[]))}),()=>{e=!0}},[]);let Le=(0,v.useMemo)(()=>{let e=new Map;for(let t of a||[])e.set(t.id,t.name||t.id);return e},[a]),Re=(0,v.useMemo)(()=>{let e=new Map;for(let t of a||[])e.set(t.id,{provider:t.provider,region:t.region});return e},[a]);function ze(t){let n=t.account_id?Re.get(t.account_id):void 0,r=t.provider||n?.provider;return r?YV(r,n?.region,e):`—`}function Be(t){switch(t){case`pin`:return e(`logsRouting_pin`);case`sticky`:return e(`logsRouting_sticky`);case`sticky_escape`:return e(`logsRouting_sticky_escape`);default:return e(`logsRouting_pool`)}}let Ve=(0,v.useMemo)(()=>(a||[]).map(e=>({id:e.id,label:e.name||e.id})),[a]),{nameById:He,options:Ue}=R9();function We(e){let t=e.api_key_id?.trim();return t?He.get(t)||t:`—`}let Ge=(0,v.useMemo)(()=>{let t=new Set;for(let e of a||[])e.provider&&t.add(e.provider);return P&&t.add(P),[{id:``,label:e(`logsFilterProviderAll`)},...[...t].sort().map(t=>({id:t,label:JV(t,e)}))]},[a,P,e]),Ke=(0,v.useMemo)(()=>{let e=new Map;for(let t of s||[])e.has(t.id)||e.set(t.id,{id:t.id,label:t.display_name||t.id});return[...e.values()]},[s]),qe=(0,v.useCallback)(async e=>((await hV({q:e||void 0,limit:20,offset:0})).items||[]).map(e=>({id:e.id,label:e.id})),[]),Je=!!(S||_!==`all`||E||O||M||P||I!==`all`||ee!==`all`||z!==`1h`),Ye=[_,S,E,O,M,P,I,ee,z,V?.start?.toString()??``,V?.end?.toString()??``,re].join(`\0`),Xe=[b,w,A,se].join(`\0`),[Ze,Qe]=(0,v.useState)(Ye),[$e,et]=(0,v.useState)(Xe);Ze!==Ye&&(Qe(Ye),ne(1)),$e!==Xe&&(et(Xe),oe(1));let tt=Math.max(1,Math.ceil(de/re)),nt=Math.min(Ze===Ye?Math.max(1,te):1,tt);te!==nt&&ne(nt);let rt=Math.max(1,Math.ceil(he/se)),it=Math.min($e===Xe?Math.max(1,ae):1,rt);ae!==it&&oe(it);let at=(0,v.useCallback)(async(e=!1)=>{e||f(!0);try{let e=S?{from:void 0,to:void 0}:z===`custom`?{from:jV(V?.start),to:jV(V?.end,!0)}:rEe(z),t=await hV({status:_===`all`?void 0:_,id:S||void 0,account:E||void 0,api_key:O||void 0,model:M||void 0,provider:P||void 0,stream:I===`all`?void 0:I===`stream`,error_kind:ee===`all`?void 0:ee,from:e.from,to:e.to,limit:re,offset:(nt-1)*re});ue(t.items||[]),fe(t.total||0),g(``)}catch(t){e||g(t instanceof Error?t.message:String(t))}finally{e||(f(!1),m(!0))}},[_,S,E,O,M,P,I,ee,z,V,nt,re]),ot=(0,v.useCallback)(async(e=!1)=>{e||f(!0);try{let e=await ile({level:b===`all`?void 0:b,q:w.trim()||void 0,account:A||void 0,limit:se,offset:(it-1)*se});me(e.items||[]),ge(e.total??0),g(``)}catch(t){e||g(t instanceof Error?t.message:String(t))}finally{e||(f(!1),m(!0))}},[b,w,A,it,se]),st=(0,v.useCallback)(async(e=!1)=>{l===`requests`?await at(e):await ot(e)},[l,at,ot]);(0,v.useEffect)(()=>{f(!0);let e=l===`runtime`&&w.trim()?280:0,t=window.setTimeout(()=>void st(!1),e);return()=>window.clearTimeout(t)},[st,l,w]),(0,v.useEffect)(()=>{if(l!==`runtime`||it!==1)return;let e=window.setInterval(()=>void ot(!0),3e3);return()=>window.clearInterval(e)},[l,it,ot]);let ct=de===0?0:(nt-1)*re+1,lt=Math.min(de,nt*re),ut=he===0?0:(it-1)*se+1,dt=Math.min(he,it*se),ft=(0,v.useMemo)(()=>l===`requests`?e(`logsShownTotal`,{shown:le.length?`${ct}–${lt}`:0,total:de}):e(`logsShownTotal`,{shown:pe.length?`${ut}–${dt}`:0,total:he}),[l,le.length,pe.length,ct,lt,de,ut,dt,he,e]);function pt(){C(``),y(`all`),D(``),k(``),N(``),F(``),L(`all`),R(`all`),B(`1h`),H(null),ne(1)}async function mt(e){let t=++ke.current;Se(e),Oe(``),Ee(!0),we(!0);try{let n=await nle(e.id);if(ke.current!==t)return;Se(n)}catch(e){if(ke.current!==t)return;Oe(e instanceof Error?e.message:String(e))}finally{ke.current===t&&Ee(!1)}}function ht(e){ve(e),be(!0)}async function gt(){Ne(!0),pV({id:`logs-clear`,type:`loading`,title:e(`toastClearingLogs`)});try{await rle(),je(!1),await at(!1),pV({id:`logs-clear`,type:`success`,title:e(`toastLogsCleared`)})}catch(t){g(t instanceof Error?t.message:String(t)),pV({id:`logs-clear`,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)})}finally{Ne(!1)}}let _t=d&&(l===`requests`?le.length===0:pe.length===0);return d&&!p?(0,G.jsx)(Lce,{}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`navLogs`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`logsLead`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l===`requests`?(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>je(!0),isDisabled:Me||de===0,children:[(0,G.jsx)(io,{size:14}),e(`logsClear`)]}):null,(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:d,onPress:()=>void st(!1),children:[(0,G.jsx)(Qr,{size:15}),e(`refresh`)]})]})]}),h?(0,G.jsx)(xI,{title:e(`failedLogs`,{msg:h})}):null,(0,G.jsxs)(OA,{selectedKey:l,onSelectionChange:e=>u(String(e)),children:[(0,G.jsx)(OA.ListContainer,{className:`w-fit`,children:(0,G.jsxs)(OA.List,{children:[(0,G.jsxs)(DA,{id:`requests`,className:`gap-1.5`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),(0,G.jsx)(Pa,{size:13}),e(`logsRequests`)]}),(0,G.jsxs)(DA,{id:`runtime`,className:`gap-1.5`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),(0,G.jsx)(eo,{size:13}),e(`logsRuntime`)]})]})}),(0,G.jsxs)(OA.Panel,{id:`requests`,"data-tab-panel":`requests`,className:`space-y-4 pt-5`,children:[(0,G.jsxs)(`div`,{className:`data-toolbar flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsx)(AV,{value:_,onChange:e=>y(e),ariaLabel:e(`logsFilterAll`),options:[{id:`all`,label:e(`logsFilterAll`)},{id:`ok`,label:e(`logsFilterOk`)},{id:`incomplete`,label:e(`logsFilterIncomplete`)},{id:`error`,label:e(`logsFilterError`)},{id:`canceled`,label:e(`logsFilterCanceled`)}]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Je?(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:pt,children:e(`clearFilters`)}):null,(0,G.jsx)(`div`,{className:`mono text-caption text-muted`,children:ft})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(L9,{ariaLabel:e(`logsColAccount`),value:E,onChange:D,options:Ve,allLabel:e(`logsFilterAccountAll`),searchPlaceholder:e(`logsSearchAccount`),emptyLabel:e(`logsNoFilterOptions`)}),(0,G.jsx)(L9,{ariaLabel:e(`logsColApiKey`),value:O,onChange:k,options:Ue,allLabel:e(`logsFilterApiKeyAll`),searchPlaceholder:e(`logsSearchApiKey`),emptyLabel:e(`logsNoFilterOptions`)}),(0,G.jsx)(L9,{ariaLabel:e(`logsColModel`),value:M,onChange:N,options:Ke,allLabel:e(`logsFilterModelAll`),searchPlaceholder:e(`logsSearchModel`),emptyLabel:e(`logsNoFilterOptions`)}),(0,G.jsx)(R7,{ariaLabel:e(`logsColProvider`),value:P,onChange:F,options:Ge}),(0,G.jsx)(L9,{ariaLabel:e(`logsSearchRequestId`),value:S,onChange:C,options:S?[{id:S,label:S}]:[],allLabel:e(`logsFilterIdAll`),searchPlaceholder:e(`logsSearchRequestId`),emptyLabel:e(`logsNoFilterOptions`),loadOptions:qe,className:`min-w-56`}),(0,G.jsx)(AV,{value:I,onChange:e=>L(e),ariaLabel:e(`logsFilterStreamAll`),options:[{id:`all`,label:e(`logsFilterStreamAll`)},{id:`stream`,label:e(`logsStreamYes`)},{id:`sync`,label:e(`logsStreamNo`)}]}),(0,G.jsx)(R7,{ariaLabel:e(`errorKind`),value:ee===`all`?``:ee,onChange:e=>R(e||`all`),options:[{id:``,label:e(`logsFilterKindAll`)},{id:`quota`,label:e(`logsKindQuota`)},{id:`rate_limit`,label:e(`logsKindRateLimit`)},{id:`auth`,label:e(`logsKindAuth`)},{id:`not_ready`,label:e(`logsKindNotReady`)},{id:`unavailable`,label:e(`logsKindUnavailable`)},{id:`invalid_request`,label:e(`logsKindInvalidRequest`)},{id:`model_not_available`,label:e(`logsKindModelNotAvailable`)}]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:e(`logsTimeRange`)}),(0,G.jsx)(AV,{value:z,onChange:e=>B(e),ariaLabel:e(`logsTimeRange`),options:[{id:`all`,label:e(`logsTimeAll`)},{id:`1h`,label:e(`logsTime1h`)},{id:`24h`,label:e(`logsTime24h`)},{id:`7d`,label:e(`logsTime7d`)},{id:`custom`,label:e(`logsTimeCustom`)}]}),z===`custom`?(0,G.jsx)(NV,{className:`w-[min(100%,42rem)]`,value:V,onChange:H,ariaLabel:e(`logsTimeRange`),fromLabel:e(`logsTimeFrom`),toLabel:e(`logsTimeTo`)}):null]})]}),(0,G.jsx)(CS,{className:`overflow-hidden p-0`,"aria-busy":d,children:_t?(0,G.jsx)(nV,{}):le.length===0?(0,G.jsx)(I7,{icon:(0,G.jsx)(va,{size:22}),title:e(Je?`logsNoMatch`:`logsEmptyRequests`),action:Je?(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:pt,children:e(`clearFilters`)}):null}):(0,G.jsx)(X,{children:(0,G.jsx)(X.ScrollContainer,{children:(0,G.jsxs)(X.Content,{"aria-label":e(`logsRequests`),children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:e(`logsColTime`)}),(0,G.jsx)(X.Column,{children:e(`logsColModel`)}),(0,G.jsx)(X.Column,{children:e(`logsColReasoning`)}),(0,G.jsx)(X.Column,{children:e(`logsColProvider`)}),(0,G.jsx)(X.Column,{children:e(`logsColAccount`)}),(0,G.jsx)(X.Column,{children:e(`logsColApiKey`)}),(0,G.jsx)(X.Column,{children:e(`logsColStatus`)}),(0,G.jsx)(X.Column,{children:e(`logsColStream`)}),(0,G.jsx)(X.Column,{children:e(`logsColLatency`)}),(0,G.jsx)(X.Column,{children:e(`logsColTokens`)})]}),(0,G.jsx)(X.Body,{children:le.map(n=>(0,G.jsxs)(X.Row,{className:`cursor-pointer`,onAction:()=>void mt(n),children:[(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`div`,{className:`py-1`,children:[(0,G.jsx)(`div`,{className:`mono text-xs`,children:B9(n.created_at,t)}),(0,G.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.id})]})}),(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(`div`,{className:`text-body font-medium`,children:n.requested_model||`—`}),n.mapped_model&&n.mapped_model!==n.requested_model?(0,G.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.mapped_model}):null]}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:V9(n)||`—`})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-xs`,children:ze(n)})}),(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(`span`,{className:`text-xs`,children:n.account_id?Le.get(n.account_id)||n.account_id:`—`}),n.account_id&&Le.get(n.account_id)&&Le.get(n.account_id)!==n.account_id?(0,G.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.account_id}):null]}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-xs`,children:We(n)})}),(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:z9(n.status),children:n.status}),n.error_kind?(0,G.jsx)(`div`,{className:`mono mt-1 text-caption text-muted`,children:n.error_kind}):null]}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-xs text-muted`,children:n.stream?e(`logsStreamYes`):e(`logsStreamNo`)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(n9,{latencyMs:n.latency_ms,ttfbMs:n.ttfb_ms,completionTokens:n.completion_tokens,stream:n.stream,labels:{ttft:e(`logsColTTFT`),total:e(`logsLatencyTotal`),tps:e(`logsOutputTPS`)}})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(H9,{log:n,inLabel:e(`logsTokensIn`),outLabel:e(`logsTokensOut`),pointsLabel:t=>e(`logsTokensPoints`,{value:t})})})]},n.id))})]})})})}),(0,G.jsx)(z7,{total:de,page:nt,pageCount:tt,pageSize:re,loading:d,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:nt,pages:tt}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:ne,onPageSize:ie})]}),(0,G.jsxs)(OA.Panel,{id:`runtime`,"data-tab-panel":`runtime`,className:`space-y-4 pt-5`,children:[(0,G.jsxs)(`div`,{className:`data-toolbar flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(B7,{className:`sm:w-72`,value:w,onChange:T,placeholder:e(`logsSearchRuntime`),ariaLabel:e(`logsSearchRuntime`)}),(0,G.jsx)(L9,{ariaLabel:e(`logsColAccount`),value:A,onChange:j,options:Ve,allLabel:e(`logsFilterAccountAll`),searchPlaceholder:e(`logsSearchAccount`),emptyLabel:e(`logsNoFilterOptions`)}),(0,G.jsx)(AV,{value:b,onChange:e=>x(e),ariaLabel:e(`logsLevelAll`),options:[{id:`all`,label:e(`logsLevelAll`)},{id:`info`,label:e(`logsLevelInfo`)},{id:`warn`,label:e(`logsLevelWarn`)},{id:`error`,label:e(`logsLevelError`)}]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted`,children:[it===1?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":`ok`}),e(`logsAutoRefresh`)]}):null,(0,G.jsx)(`span`,{className:`mono`,children:ft})]})]}),(0,G.jsx)(CS,{className:`overflow-hidden p-0`,"aria-busy":d,children:_t?(0,G.jsx)(Ice,{}):pe.length===0?(0,G.jsx)(I7,{icon:(0,G.jsx)(eo,{size:22}),title:e(`logsEmptyRuntime`)}):(0,G.jsx)(`div`,{className:`divide-y divide-separator`,children:pe.map(e=>(0,G.jsxs)(`div`,{className:`grid cursor-pointer gap-2 px-5 py-3 transition-colors hover:bg-surface-secondary/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:grid-cols-[150px_72px_minmax(0,1fr)] sm:items-start`,role:`button`,tabIndex:0,onClick:()=>ht(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),ht(e))},children:[(0,G.jsx)(`div`,{className:`mono text-caption text-muted`,children:B9(e.time,t)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":XTe(e.level)}),(0,G.jsx)(`span`,{className:`font-medium text-muted`,children:e.level})]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[e.account_id?(0,G.jsx)(`div`,{className:`mono mb-1 text-caption text-muted`,children:e.account_id}):null,(0,G.jsx)(`div`,{className:`mono break-all text-xs leading-5 text-foreground`,children:e.message})]})]},e.id))})}),(0,G.jsx)(z7,{total:he,page:it,pageCount:rt,pageSize:se,loading:d,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:it,pages:rt}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:oe,onPageSize:ce})]})]}),(0,G.jsx)(Y.Root,{isOpen:ye,onOpenChange:e=>{be(e),e||ve(null)},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{className:`w-full max-w-4xl`,children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`logsRuntimeDetailTitle`)}),(0,G.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:_e?`#${_e.id}`:`—`})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":e(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(yo,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`space-y-5 px-5 pb-5`,children:[(0,G.jsx)(`dl`,{className:`grid gap-3 sm:grid-cols-2`,children:[[e(`logsColTime`),_e?B9(_e.time,t):`—`],[e(`logsRuntimeLevel`),_e?.level||`—`],[e(`logsRuntimeSource`),_e?.source||`—`],[e(`logsColAccount`),_e?.account_id||`—`]].map(([t,n])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:t}),(0,G.jsx)(`dd`,{className:`mt-1 break-all text-body font-medium`,children:t===e(`logsRuntimeLevel`)&&_e?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:ZTe(_e.level),children:_e.level}):n})]},String(t)))}),(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:e(`logsRuntimeMessage`)}),(0,G.jsx)(`pre`,{className:`mono max-h-[min(38rem,60vh)] overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-secondary px-4 py-3 text-xs leading-6 text-foreground`,children:_e?.message||`—`})]})]})]})})})}),(0,G.jsx)(Y.Root,{isOpen:Ce,onOpenChange:e=>{we(e),e||(ke.current+=1,Ee(!1),Oe(``),Se(null))},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{className:`w-full max-w-4xl`,children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`logsDetailTitle`)}),(0,G.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:xe?.id})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":e(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(yo,{size:16})})]}),(0,G.jsx)(Y.Body,{className:`space-y-4 px-5 pb-5`,children:Te?(0,G.jsx)(QTe,{}):De?(0,G.jsx)(xI,{title:e(`requestFailed`),description:De}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`dl`,{className:`grid gap-3 sm:grid-cols-2`,children:[[[e(`logsColStatus`),xe?.status||`—`],[e(`logsColModel`),xe?.requested_model||`—`],[e(`logsColReasoning`),xe&&V9(xe)||`—`],[e(`logsColProvider`),xe?ze(xe):`—`],[e(`logsColAccount`),xe?.account_id?Le.get(xe.account_id)||xe.account_id:`—`],[e(`logsColApiKey`),xe?We(xe):`—`],[e(`logsColStream`),xe?.stream?e(`logsStreamYes`):e(`logsStreamNo`)],[e(`logsRouting`),xe?Be(xe.routing):`—`]].map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e}),(0,G.jsx)(`dd`,{className:`mt-1 break-all text-body font-medium`,children:t})]},String(e))),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e(`logsColTokens`)}),(0,G.jsx)(`dd`,{className:`mt-1`,children:xe?(0,G.jsx)(H9,{log:xe,inLabel:e(`logsTokensIn`),outLabel:e(`logsTokensOut`),pointsLabel:t=>e(`logsTokensPoints`,{value:t})}):`—`})]}),(0,G.jsx)(`div`,{className:`sm:col-span-2`,children:(0,G.jsx)(n9,{latencyMs:xe?.latency_ms,ttfbMs:xe?.ttfb_ms,completionTokens:xe?.completion_tokens,stream:xe?.stream,labels:{heading:e(`logsColLatency`),ttft:e(`logsColTTFT`),total:e(`logsLatencyTotal`),tps:e(`logsOutputTPS`)}})})]}),xe&&xe.message_count?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-3 py-3 text-xs`,children:[(0,G.jsx)(`div`,{className:`font-medium text-muted`,children:e(`logsMessageShape`)}),(0,G.jsxs)(`dl`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e(`logsMessageCount`)}),(0,G.jsx)(`dd`,{className:`mono mt-0.5`,children:xe.message_count})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e(`logsEmptyMessageIndexes`)}),(0,G.jsx)(`dd`,{className:`mono mt-0.5 break-all`,children:xe.empty_message_indexes?.length?xe.empty_message_indexes.join(`, `):`—`})]}),(0,G.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e(`logsMessageRoles`)}),(0,G.jsx)(`dd`,{className:`mono mt-0.5 break-all`,children:xe.message_roles?.join(` → `)||`—`})]})]})]}):null,xe?.error_message?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-3 py-2 text-xs leading-5 text-muted`,children:[xe.error_kind?(0,G.jsx)(`span`,{className:`mono mr-2 text-muted`,children:xe.error_kind}):null,xe.error_message]}):null,xe?.stream_diagnostic?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-3 py-3 text-xs`,children:[(0,G.jsx)(`div`,{className:`font-medium text-muted`,children:e(`logsStreamDiagnostics`)}),(0,G.jsx)(`dl`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[[e(`logsCancellationSource`),xe.stream_diagnostic.cancellation_source||`—`],[e(`logsUpstreamStatus`),xe.stream_diagnostic.upstream_status??`—`],[e(`logsSSEEvents`),xe.stream_diagnostic.sse_event_count],[e(`logsBytesRead`),xe.stream_diagnostic.bytes_read],[e(`logsLastEvent`),xe.stream_diagnostic.last_event||`—`],[e(`logsStreamComplete`),xe.stream_diagnostic.saw_done?`yes`:`no`]].map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e}),(0,G.jsx)(`dd`,{className:`mono mt-0.5 break-all`,children:t})]},String(e)))}),xe.stream_diagnostic.context_err||xe.stream_diagnostic.relay_error?(0,G.jsxs)(`div`,{className:`mt-2 space-y-1 break-all text-muted`,children:[xe.stream_diagnostic.context_err?(0,G.jsxs)(`div`,{children:[`context: `,xe.stream_diagnostic.context_err]}):null,xe.stream_diagnostic.relay_error?(0,G.jsxs)(`div`,{children:[`relay: `,xe.stream_diagnostic.relay_error]}):null]}):null]}):null,xe?.usage_detail?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-3 py-3 text-xs`,children:[(0,G.jsx)(`div`,{className:`font-medium text-muted`,children:e(`logsUsageDetail`)}),(0,G.jsx)(`dl`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[[e(`logsCreditConsumed`),`${U9(xe.usage_detail.credit)} ${xe.usage_detail.unit||`credits`}`],[e(`logsColProvider`),xe.usage_detail.provider||`—`]].map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e}),(0,G.jsx)(`dd`,{className:`mono mt-0.5 break-all`,children:t})]},String(e)))})]}):null,(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:e(`logsAttempts`)}),xe?.attempts?.length?(0,G.jsx)(`div`,{className:`mt-2 divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:xe.attempts.map(e=>(0,G.jsxs)(`div`,{className:`grid gap-1 px-3 py-2.5 text-xs sm:grid-cols-[48px_minmax(0,1fr)_auto]`,children:[(0,G.jsxs)(`div`,{className:`mono text-muted`,children:[`#`,e.attempt_index]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-medium`,children:e.account_id||`—`}),(0,G.jsx)(`div`,{className:`mt-0.5 text-muted`,children:e.error_message||e.status})]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:z9(e.status===`failover`?`canceled`:e.status),children:e.status})]},e.id))}):(0,G.jsx)(`p`,{className:`mt-2 text-xs text-muted`,children:e(`logsNoAttempts`)})]})]})})]})})})}),(0,G.jsx)(E9,{isOpen:Ae,title:e(`logsClear`),description:e(`logsClearConfirm`),confirmLabel:e(`logsClear`),cancelLabel:e(`close`),closeLabel:e(`close`),isPending:Me,onClose:()=>je(!1),onConfirm:()=>void gt()})]})}var G9=864e5,aEe=8;function K9(e){return`var(--chart-${e%aEe+1})`}function q9(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function J9(e){return e<10?`0${e}`:String(e)}function Y9(e){let t=new Date(e);return`${t.getFullYear()}-${J9(t.getMonth()+1)}-${J9(t.getDate())}`}function oEe({accounts:e,t}){let[n,r]=(0,v.useState)(!1),{buckets:i,rows:a,todayStart:o,maxTotal:s}=(0,v.useMemo)(()=>{let t=q9(new Date),n=new Map;e.forEach((e,t)=>n.set(e.id,K9(t)));let r=new Map,i=[];for(let a of e){let e=a.quota?.packages??[],o=n.get(a.id)||K9(0),s=a.name||a.id,c=e.filter(e=>(e.remain??0)>0&&(e.ends_at??0)>0),l=0,u=0,d=0,f=0;for(let e of c){let n=e.ends_at*1e3,i=e.remain??0;d+=i;let c=q9(new Date(n)),u=c{let e=new Date(c);return{day:p,label:`${e.getMonth()+1}/${e.getDate()}`,ts:c,segments:[],total:0}})(),r.set(p,m));let h=m.segments.find(e=>e.id===a.id);h?h.remain+=i:m.segments.push({id:a.id,name:s,color:o,remain:i}),m.total+=i}if(l){let e=Y9(q9(new Date(l)));for(let t of c)Y9(q9(new Date(t.ends_at*1e3)))===e&&(u+=t.remain??0)}let p=l?Math.max(0,Math.round((q9(new Date(l))-t)/G9)):-1;i.push({id:a.id,name:s,color:o,remain:d,expiredRemain:f,soonest:l?Math.floor(l/1e3):0,soonestRemain:u,daysLeft:p,dailyBurn:l?u/Math.max(p,1):0,packs:c.length})}i.sort((e,t)=>e.soonest&&t.soonest?e.soonest-t.soonest:e.soonest?-1:t.soonest?1:t.remain-e.remain);let a=[...r.values()].sort((e,t)=>e.ts-t.ts);return{buckets:a,rows:i,todayStart:t,maxTotal:a.reduce((e,t)=>Math.max(e,t.total),0)}},[e]);if(!a.some(e=>e.packs>0))return null;let c=n?i:i.slice(0,8);return(0,G.jsxs)(CS,{className:`overflow-hidden p-0`,"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-separator px-4 py-4 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:px-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`expiryDistTitle`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`expiryDistHint`)})]}),i.length>8?(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:()=>r(e=>!e),children:n?t(`expiryDistCollapse`):t(`expiryDistExpand`,{n:i.length})}):null]}),(0,G.jsxs)(`div`,{className:`space-y-4 p-4 sm:space-y-3 sm:p-5`,children:[(0,G.jsx)(`div`,{className:`space-y-2.5 sm:space-y-1.5`,children:c.map(e=>{let n=e.ts===o,r=s>0?e.total/s*100:0;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:grid sm:grid-cols-[52px_minmax(0,1fr)_auto] sm:items-center sm:gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 sm:contents`,children:[(0,G.jsx)(`span`,{className:`mono text-caption ${e.day===`__expired__`?`font-semibold text-danger`:n?`font-semibold text-foreground`:`text-muted`}`,children:e.day===`__expired__`?t(`expiryDistExpired`):e.label}),(0,G.jsx)(`span`,{className:`mono text-caption text-foreground sm:hidden`,children:m9(e.total)})]}),(0,G.jsx)(`div`,{className:`h-2.5 w-full rounded-full bg-surface-tertiary`,role:`img`,"aria-label":`${e.day} ${t(`expiryDistDayTotal`,{n:m9(e.total)})}`,title:e.day,children:(0,G.jsx)(`div`,{className:`flex h-full items-stretch overflow-hidden rounded-full`,style:{width:`${r}%`},children:e.segments.map(t=>(0,G.jsx)(`span`,{style:{width:`${t.remain/e.total*100}%`,backgroundColor:t.color},title:`${t.name} · ${m9(t.remain)}`},t.id))})}),(0,G.jsx)(`span`,{className:`mono hidden text-caption text-foreground sm:inline`,children:m9(e.total)})]},e.day)})}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1.5 pt-1`,children:a.filter(e=>e.remain>0).map(e=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-caption text-muted`,children:[(0,G.jsx)(`i`,{className:`size-2 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,G.jsx)(`span`,{className:`max-w-[120px] truncate`,children:e.name})]},e.id))}),(0,G.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,children:a.filter(e=>e.packs>0).map(e=>{let n=e.daysLeft>=0&&e.daysLeft<=2,r=e.daysLeft>=0&&e.daysLeft<=7,i=e.soonest?new Date(e.soonest*1e3):null,a=e.expiredRemain>0&&e.daysLeft<0||n?`font-semibold text-danger`:r?`text-warning`:`text-muted`,o=e.daysLeft>=0?t(`expiryDistDays`,{n:e.daysLeft}):e.expiredRemain>0?t(`expiryDistExpired`):`—`;return(0,G.jsxs)(`article`,{className:`space-y-3 py-3.5`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(`i`,{className:`size-2 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,G.jsx)(`span`,{className:`truncate text-body font-medium text-foreground`,children:e.name})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColSoonest`)}),(0,G.jsx)(`div`,{className:`mono text-body text-muted`,children:i?`${i.getMonth()+1}/${i.getDate()}`:`—`})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColDaysLeft`)}),(0,G.jsx)(`div`,{className:`mono text-body ${a}`,children:o})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColBatch`)}),(0,G.jsx)(`div`,{className:`mono text-body text-foreground`,children:m9(e.soonestRemain)})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColDaily`)}),(0,G.jsx)(`div`,{className:`mono text-body text-foreground`,children:e.soonest?m9(e.dailyBurn):`—`})]})]})]},e.id)})}),(0,G.jsx)(X,{"aria-label":t(`expiryDistTitle`),className:`hidden md:block`,children:(0,G.jsx)(X.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,G.jsxs)(X.Content,{className:`min-w-[32rem]`,children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:t(`expiryDistColAccount`)}),(0,G.jsx)(X.Column,{children:(0,G.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColSoonest`)})}),(0,G.jsx)(X.Column,{children:(0,G.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColDaysLeft`)})}),(0,G.jsx)(X.Column,{children:(0,G.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColBatch`)})}),(0,G.jsx)(X.Column,{children:(0,G.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColDaily`)})})]}),(0,G.jsx)(X.Body,{children:a.filter(e=>e.packs>0).map(e=>{let n=e.daysLeft>=0&&e.daysLeft<=2,r=e.daysLeft>=0&&e.daysLeft<=7,i=e.soonest?new Date(e.soonest*1e3):null;return(0,G.jsxs)(X.Row,{children:[(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(`i`,{className:`size-2 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,G.jsx)(`span`,{className:`max-w-[150px] truncate text-foreground`,children:e.name})]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`div`,{className:`mono text-center text-muted`,children:i?`${i.getMonth()+1}/${i.getDate()}`:`—`})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`div`,{className:`mono text-center ${e.expiredRemain>0&&e.daysLeft<0||n?`font-semibold text-danger`:r?`text-warning`:`text-muted`}`,children:e.daysLeft>=0?t(`expiryDistDays`,{n:e.daysLeft}):e.expiredRemain>0?t(`expiryDistExpired`):`—`})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`div`,{className:`mono text-center text-foreground`,children:m9(e.soonestRemain)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`div`,{className:`mono text-center text-foreground`,children:e.soonest?m9(e.dailyBurn):`—`})})]},e.id)})})]})})}),(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:t(`expiryDistFoot`)})]})]})}function sEe(){return tI(`/api/usage/pricing`)}function cEe(e={}){let t=new URLSearchParams;return e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.api_key&&t.set(`api_key`,e.api_key),tI(`/api/usage/cost${t.toString()?`?${t}`:``}`)}var X9=(0,v.lazy)(()=>C(()=>import(`./CostChart-Dvs5WgLu.js`).then(e=>({default:e.CostChart})),__vite__mapDeps([2,1])));function lEe(){let e=new Date;return e.setHours(0,0,0,0),e.toISOString()}var uEe={window:{from:``,to:``,hours:24},currency:`CNY`,models:[],totals:{id:`total`,label:``,vendor:``,currency:`CNY`,requests:0,cache_hit:0,cache_miss:0,output:0,total_tokens:0,cost:0,cost_off_peak:0,cost_peak:0,peak_requests:0,credits:0,priced:!1},series:[]};function dEe(e,t){if(!t)return`0%`;let n=e/t*100;return`${n>=10?n.toFixed(0):n.toFixed(1)}%`}function fEe({apiKeyFilter:e=``}){let{t,lang:n}=JF(),[r,i]=(0,v.useState)(`today`),[a,o]=(0,v.useState)(`credits`),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(!0),[p,m]=(0,v.useState)(``);(0,v.useEffect)(()=>{let e=!1;return sEe().then(t=>{e||u(t)}).catch(()=>{}),()=>{e=!0}},[]);let h=(0,v.useCallback)(async()=>{f(!0);try{let t=await cEe({...r===`all`?{}:r===`today`?{from:lEe()}:{from:new Date(Date.now()-Number(r)*3600*1e3).toISOString(),to:new Date().toISOString()},api_key:e||void 0});c(t),m(``)}catch(e){c(null),m(e instanceof Error?e.message:String(e))}finally{f(!1)}},[r,e]);(0,v.useEffect)(()=>{h()},[h]);let g=s??uEe,_=g.totals,y=_.requests>0&&g.models.length>0,b=g.models.filter(e=>e.priced),x=_.cost>0,S=[{label:t(`usageCredits`),value:TV(_.credits),detail:t(`usageCreditsHint`)},{label:t(`usageTotalTokens`),value:gV(_.total_tokens),detail:`${gV(_.cache_hit)} / ${gV(_.cache_miss)} / ${gV(_.output)} ${t(`usageTokenSplitNote`)}`},{label:t(`usageRequests`),value:String(_.requests),detail:t(`usageModelCount`,{count:g.models.length})},{label:t(`usageCacheHitRate`),value:dEe(_.cache_hit,_.cache_hit+_.cache_miss),detail:gV(_.cache_hit)}],C=a===`credits`?TV(_.credits):a===`tokens`?gV(_.total_tokens):CV(_.cost);return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-2`,children:[(0,G.jsx)(AV,{value:r,onChange:e=>i(e),ariaLabel:t(`usageWindow`),options:[{id:`today`,label:t(`statsWindowToday`)},{id:`24`,label:t(`usageWindow24h`)},{id:`168`,label:t(`usageWindow7d`)},{id:`all`,label:t(`usageWindowTotal`)}]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,onPress:()=>void h(),isDisabled:d,children:[(0,G.jsx)(Qr,{size:14}),t(`refresh`)]})]}),p?(0,G.jsx)(xI,{title:t(`failedStats`,{msg:p})}):null,(0,G.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-4`,children:S.map(e=>(0,G.jsxs)(CS,{className:`gap-0 p-4`,children:[(0,G.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,G.jsx)(`div`,{className:`tabular mt-1.5 text-section font-semibold`,children:d?(0,G.jsx)(Q,{className:`h-5 w-16`}):e.value}),(0,G.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:d?(0,G.jsx)(Q,{className:`h-3 w-24`}):e.detail||`\xA0`})]},e.label))}),(0,G.jsxs)(CS,{className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold tracking-[-0.015em]`,children:t(`usageChartTitle`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`usageChartHint`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(AV,{value:a,onChange:e=>o(e),ariaLabel:t(`usageChartMetric`),options:[{id:`credits`,label:t(`usageColCredits`)},{id:`tokens`,label:t(`usageColTokens`)}]}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`default`,children:C})]})]}),(0,G.jsx)(`div`,{className:`p-5`,children:d?(0,G.jsx)(`div`,{className:`grid h-72 place-items-center`,children:(0,G.jsx)(Q,{className:`h-56 w-full`})}):y?(0,G.jsx)(v.Suspense,{fallback:(0,G.jsx)(`div`,{className:`grid h-72 place-items-center`,children:(0,G.jsx)(Q,{className:`h-56 w-full`})}),children:(0,G.jsx)(X9,{series:g.series,models:g.models,lang:n,emptyLabel:t(`usageChartEmpty`),totalLabel:t(`usageTotals`),metric:a})}):(0,G.jsx)(I7,{title:t(`usageEmpty`),hint:t(`usageRetentionHint`)})})]}),(0,G.jsxs)(CS,{className:`overflow-hidden p-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold tracking-[-0.015em]`,children:t(`usageBreakdownTitle`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`usageBreakdownHint`)})]})}),d?(0,G.jsx)(`div`,{className:`space-y-3 p-5`,children:[0,1,2].map(e=>(0,G.jsx)(Q,{className:`h-9 w-full`},e))}):y?(0,G.jsx)(X,{children:(0,G.jsx)(X.ScrollContainer,{children:(0,G.jsxs)(X.Content,{"aria-label":t(`usageBreakdownTitle`),children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:t(`usageColModel`)}),(0,G.jsx)(X.Column,{children:t(`usageColRequests`)}),(0,G.jsx)(X.Column,{children:t(`usageColInputHit`)}),(0,G.jsx)(X.Column,{children:t(`usageColInputMiss`)}),(0,G.jsx)(X.Column,{children:t(`usageColOutput`)}),(0,G.jsx)(X.Column,{children:t(`usageColTokens`)}),(0,G.jsx)(X.Column,{children:t(`usageColCredits`)})]}),(0,G.jsxs)(X.Body,{children:[g.models.map(e=>(0,G.jsxs)(X.Row,{children:[(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,G.jsx)(`div`,{className:`mono mt-0.5 text-[10px] text-muted`,children:e.id})]}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:e.requests})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:gV(e.cache_hit)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:gV(e.cache_miss)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:gV(e.output)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:gV(e.total_tokens)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:TV(e.credits)})})]},e.id)),(0,G.jsxs)(X.Row,{children:[(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-sm font-semibold`,children:t(`usageTotals`)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:_.requests})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:gV(_.cache_hit)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:gV(_.cache_miss)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:gV(_.output)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:gV(_.total_tokens)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:TV(_.credits)})})]})]})]})})}):(0,G.jsx)(I7,{title:t(`usageEmpty`),hint:t(`usageRetentionHint`)})]}),(0,G.jsx)(yh,{className:`rounded-xl bg-surface-secondary`,hideSeparator:!0,defaultExpandedKeys:[],children:(0,G.jsxs)(yh.Item,{id:`deepseek-estimate`,children:[(0,G.jsx)(yh.Heading,{children:(0,G.jsxs)(yh.Trigger,{className:`items-center gap-3 px-5 py-4 text-left`,children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block font-semibold tracking-[-0.015em]`,children:t(`usageEstimateTitle`)}),(0,G.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted`,children:t(`usageEstimateHint`)})]}),x?(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`default`,children:CV(_.cost)}):null,(0,G.jsx)(yh.Indicator,{})]})}),(0,G.jsx)(yh.Panel,{children:(0,G.jsxs)(yh.Body,{className:`space-y-5 px-5 pb-5`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-6 text-muted`,children:t(`usageRenderNote`)}),x?(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium`,children:t(`usageEstimateChartTitle`)}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:`default`,children:CV(_.cost)})]}),(0,G.jsx)(v.Suspense,{fallback:(0,G.jsx)(Q,{className:`h-56 w-full`}),children:(0,G.jsx)(X9,{series:g.series,models:b.length?b:g.models,lang:n,emptyLabel:t(`usageEstimateChartEmpty`),totalLabel:t(`usageTotals`),metric:`cost`})})]}):null,b.length?(0,G.jsx)(X,{children:(0,G.jsx)(X.ScrollContainer,{children:(0,G.jsxs)(X.Content,{"aria-label":t(`usageEstimateTitle`),children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:t(`usageColModel`)}),(0,G.jsx)(X.Column,{children:t(`usageColSplit`)}),(0,G.jsx)(X.Column,{children:t(`usageColCost`)})]}),(0,G.jsxs)(X.Body,{children:[b.map(e=>(0,G.jsxs)(X.Row,{children:[(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,G.jsx)(`div`,{className:`mono mt-0.5 text-[10px] text-muted`,children:e.id})]}),(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`span`,{className:`mono text-xs text-muted`,children:[CV(e.cost_peak),` / `,CV(e.cost_off_peak)]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-sm font-semibold`,children:CV(e.cost)})})]},e.id)),(0,G.jsxs)(X.Row,{children:[(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-sm font-semibold`,children:t(`usageTotals`)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`span`,{className:`mono text-xs text-muted`,children:[CV(_.cost_peak),` / `,CV(_.cost_off_peak)]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-sm font-semibold`,children:CV(_.cost)})})]})]})]})})}):(0,G.jsx)(`p`,{className:`text-xs text-muted`,children:t(`usageEstimateChartEmpty`)}),(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`mb-2 text-sm font-medium`,children:t(`usagePriceTitle`)}),(0,G.jsx)(`p`,{className:`mb-3 text-xs text-muted`,children:t(`usagePeakNote`)}),(0,G.jsxs)(`div`,{className:`divide-y divide-separator rounded-lg bg-background`,children:[(l?.models??[]).map(e=>(0,G.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,G.jsx)(`span`,{className:`mono text-[10px] text-muted`,children:e.currency})]}),(0,G.jsx)(`div`,{className:`mono mt-1 text-[10px] text-muted`,children:e.id}),(0,G.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 text-[11px]`,children:[(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:t(`usagePriceBandOff`)}),(0,G.jsxs)(`div`,{className:`mono mt-0.5`,children:[wV(e.off_peak.cache_hit),` · `,wV(e.off_peak.cache_miss),` · `,wV(e.off_peak.output)]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[9px] text-muted`,children:[t(`usagePriceHit`),` · `,t(`usagePriceMiss`),` · `,t(`usagePriceOutput`)]})]}),(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:t(`usagePriceBandPeak`)}),(0,G.jsxs)(`div`,{className:`mono mt-0.5`,children:[wV(e.peak.cache_hit),` · `,wV(e.peak.cache_miss),` · `,wV(e.peak.output)]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[9px] text-muted`,children:[t(`usagePriceHit`),` · `,t(`usagePriceMiss`),` · `,t(`usagePriceOutput`)]})]})]})]},e.id)),l?.models?.length?null:(0,G.jsx)(`div`,{className:`px-4 py-6 text-sm text-muted`,children:t(`usageEmpty`)})]})]}),(0,G.jsxs)(`div`,{className:`space-y-3 text-xs leading-6 text-muted`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:t(`usageNoteTitle`)}),(0,G.jsx)(`p`,{children:t(`usageRetentionHint`)}),(0,G.jsx)(`p`,{children:t(`usagePeakNote`)}),g.unpriced?.length?(0,G.jsx)(`p`,{children:t(`usageUnpricedHint`,{models:g.unpriced.join(`, `)})}):null,l?.note?(0,G.jsx)(`p`,{className:`mono text-[10px]`,children:l.note}):null]})]})]})})]})})]})}var pEe=500,mEe={model:`model`,account:`account`,provider:`provider`};function hEe(e,t,n){let r=e.prompt_tokens??0,i=e.completion_tokens??0,a=e.key===`(unknown)`||e.key===`(unassigned)`||!e.key;return{key:e.key,label:n,count:e.count,success:e.count?e.ok/e.count:0,p95:e.latency_p95_ms??null,tokens:r+i,prompt:r,completion:i,credits:e.credits??0,cache_write:e.cache_write_tokens??0,cache_read:e.cache_read_tokens??0,filter:a?void 0:{[mEe[t]]:e.key}}}function gEe(e,t,n){let r=n===`ascending`?1:-1;return[...e].sort((e,n)=>{if(t===`label`)return r*e.label.localeCompare(n.label);let i=e[t],a=n[t];return i==null&&a==null?0:i==null?1:a==null?-1:r*(i-a)||e.label.localeCompare(n.label)})}function Z9(e){return e?e>=1e3?gV(e):String(Math.round(e*100)/100):`0`}function _Ee(){let{t:e}=JF(),t=at(),[n,r]=On(),[i,a]=(0,v.useState)(`stats`),[o,s]=(0,v.useState)(`model`),[c,l]=(0,v.useState)(`today`),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(!0),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)([]),[x,S]=(0,v.useState)(`count`),[C,w]=(0,v.useState)(`descending`),[T,E]=(0,v.useState)(()=>new URLSearchParams(window.location.search).get(`api_key`)??``),{options:D}=R9(),O=(0,v.useRef)(0),k=n.toString(),A=(0,v.useRef)(k);(0,v.useEffect)(()=>{k!==A.current&&(A.current=k,E(new URLSearchParams(k).get(`api_key`)??``))},[k]);let j=T?`api_key=${encodeURIComponent(T)}`:``;(0,v.useEffect)(()=>{j!==A.current&&(A.current=j,r(j,{replace:!0}))},[j,r]),(0,v.useEffect)(()=>{let e=!1;return nI(!1).then(t=>{e||b(t.data||[])}).catch(()=>{}),()=>{e=!0}},[]);let M=u?.start?.toString()??``,N=u?.end?.toString()??``;(0,v.useEffect)(()=>{let e=FV(c,u);if(!e){h(!1);return}let t=++O.current;mV({...e,dim:[o],limit:pEe,api_key:T||void 0}).then(e=>{t===O.current&&(p(e),_(``))}).catch(e=>{t===O.current&&(p(null),_(e instanceof Error?e.message:String(e)))}).finally(()=>{t===O.current&&h(!1)})},[o,c,M,N,T]);let P=(0,v.useMemo)(()=>{let t=new Map(y.map(e=>[e.id,e.name||e.id]));return gEe(((o===`model`?f?.models:o===`account`?f?.accounts:f?.providers)??[]).map(n=>{let r=n.key===`(unknown)`?e(`statsUnknown`):n.key===`(unassigned)`?e(`statsUnassigned`):o===`account`?t.get(n.key)||n.key:o===`provider`?JV(n.key,e):n.key;return hEe(n,o,r)}),x,C)},[f,o,y,x,C,e]),F=f?.totals,I=f?.tokens;function L(e){if(!f||!e.filter)return;let n={...e.filter,api_key:T||void 0};t(LV(n,f.window.from,f.window.to))}let ee=[{id:`label`,label:e(o===`model`?`logsColModel`:o===`account`?`logsColAccount`:`logsColProvider`)},{id:`count`,label:e(`usageColRequests`),numeric:!0},{id:`success`,label:e(`usageColSuccess`),numeric:!0},{id:`p95`,label:e(`statsLatencyP95`),numeric:!0},{id:`tokens`,label:e(`usageColTokens`),numeric:!0},{id:`cache_write`,label:e(`usageColCacheWrite`),numeric:!0},{id:`credits`,label:e(`usageColCredits`),numeric:!0}],R=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-1`,children:(0,G.jsx)(IV,{value:c,onChange:l,custom:u,onCustomChange:d,onBusy:()=>h(!0),t:e})}),g?(0,G.jsx)(xI,{title:e(`failedStats`,{msg:g})}):null,(0,G.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-5`,children:[[e(`usageColRequests`),F?gV(F.requests):`—`,e(`statsWindowHint`,{window:e(PV[c])})],[e(`usageColSuccess`),F?yV(F.success_rate):`—`,F?`${F.ok} / ${F.requests}`:``],[e(`usageColTokens`),I?gV(I.total):`—`,I?`${gV(I.prompt)} / ${gV(I.completion)}`:``],[e(`usageColCacheWrite`),I?gV(I.cache_write??0):`—`,I?`${e(`chartCacheRead`)} ${gV(I.cache_read)}`:``],[e(`usageColCredits`),F?Z9(F.credits??0):`—`,``]].map(([e,t,n])=>(0,G.jsxs)(CS,{className:`gap-0 p-4`,children:[(0,G.jsx)(`div`,{className:`text-body text-muted`,children:e}),(0,G.jsx)(`div`,{className:`tabular mt-1.5 text-section font-semibold`,children:m?(0,G.jsx)(Q,{className:`h-5 w-16`}):t}),(0,G.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:m?(0,G.jsx)(Q,{className:`h-3 w-24`}):n||`\xA0`})]},e))}),(0,G.jsxs)(CS,{className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-separator px-5 py-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between`,children:[(0,G.jsx)(OA,{selectedKey:o,onSelectionChange:e=>{h(!0),s(String(e))},children:(0,G.jsx)(OA.ListContainer,{className:`w-fit`,children:(0,G.jsxs)(OA.List,{"aria-label":e(`usageTitle`),children:[(0,G.jsxs)(DA,{id:`model`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),(0,G.jsx)(Bi,{size:14}),e(`usageByModel`)]}),(0,G.jsxs)(DA,{id:`account`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),(0,G.jsx)(po,{size:14}),e(`usageByAccount`)]}),(0,G.jsxs)(DA,{id:`provider`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),(0,G.jsx)(Ja,{size:14}),e(`usageByProvider`)]})]})})}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:m?``:e(`usageRowCount`,{count:P.length})})]}),m?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,"aria-busy":`true`,children:Array.from({length:4},(e,t)=>(0,G.jsxs)(`div`,{className:`space-y-3 px-5 py-4`,children:[(0,G.jsx)(Q,{className:`h-4 w-40`}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:Array.from({length:4},(e,t)=>(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(Q,{className:`h-3 w-12`}),(0,G.jsx)(Q,{className:`h-4 w-16`})]},t))})]},t))}),(0,G.jsx)(`div`,{className:`hidden divide-y divide-separator md:block`,"aria-busy":`true`,children:Array.from({length:6},(e,t)=>(0,G.jsxs)(`div`,{className:`flex items-center gap-6 px-5 py-3.5`,children:[(0,G.jsx)(Q,{className:`h-4 w-40`}),(0,G.jsx)(`div`,{className:`flex-1`}),Array.from({length:6},(e,t)=>(0,G.jsx)(Q,{className:`h-4 w-14`},t))]},t))})]}):P.length===0?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-10 text-body text-muted`,children:[(0,G.jsx)(vi,{size:16}),e(`usageEmpty`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,children:P.map(t=>{let n=!!(t.filter&&f),r=[{label:e(`usageColRequests`),value:String(t.count)},{label:e(`usageColSuccess`),value:yV(t.success),tone:t.success<.9?`text-warning`:void 0},{label:e(`statsLatencyP95`),value:_V(t.p95)},{label:e(`usageColTokens`),value:gV(t.tokens),sub:`${gV(t.prompt)} / ${gV(t.completion)}`},{label:e(`usageColCacheWrite`),value:gV(t.cache_write)},{label:e(`usageColCredits`),value:Z9(t.credits)}];return(0,G.jsxs)(`article`,{className:`space-y-3 px-5 py-4 ${n?`cursor-pointer`:``}`,onClick:n?()=>L(t):void 0,onKeyDown:n?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),L(t))}:void 0,role:n?`button`:void 0,tabIndex:n?0:void 0,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[o===`provider`&&t.filter?(0,G.jsx)(XV,{provider:t.key,size:14}):null,(0,G.jsx)(`span`,{className:`truncate text-body font-medium`,children:t.label})]}),o===`account`&&t.label!==t.key?(0,G.jsx)(`div`,{className:`mono truncate text-caption text-muted`,children:t.key}):null,(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:r.map(e=>(0,G.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e.label}),(0,G.jsx)(`div`,{className:`mono text-body ${e.tone??`text-foreground`}`,children:e.value}),`sub`in e&&e.sub?(0,G.jsx)(`div`,{className:`mono text-caption text-muted`,children:e.sub}):null]},e.label))})]},t.key)})}),(0,G.jsx)(X,{className:`usage-table hidden md:block`,children:(0,G.jsx)(X.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,G.jsxs)(X.Content,{"aria-label":e(`usageTitle`),className:`min-w-[48rem]`,sortDescriptor:{column:x,direction:C},onSortChange:e=>{S(String(e.column)),w(e.direction)},children:[(0,G.jsx)(X.Header,{children:ee.map(e=>(0,G.jsx)(X.Column,{id:e.id,allowsSorting:!0,isRowHeader:e.id===`label`,className:e.numeric?`text-right`:void 0,children:({sortDirection:t})=>(0,G.jsx)(X.SortableColumnHeader,{sortDirection:t,className:e.numeric?`justify-end`:void 0,children:e.label})},e.id))}),(0,G.jsx)(X.Body,{children:P.map(e=>(0,G.jsxs)(X.Row,{id:e.key,className:e.filter&&f?`cursor-pointer`:void 0,onAction:e.filter&&f?()=>L(e):void 0,children:[(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[o===`provider`&&e.filter?(0,G.jsx)(XV,{provider:e.key,size:14}):null,(0,G.jsx)(`span`,{className:`truncate text-body font-medium`,children:e.label}),o===`account`&&e.label!==e.key?(0,G.jsx)(`span`,{className:`mono truncate text-caption text-muted`,children:e.key}):null]})}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:e.count}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:(0,G.jsx)(`span`,{className:e.success<.9?`text-warning`:void 0,children:yV(e.success)})}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:_V(e.p95)}),(0,G.jsxs)(X.Cell,{className:`text-right`,children:[(0,G.jsx)(`div`,{className:`mono text-body`,children:gV(e.tokens)}),(0,G.jsxs)(`div`,{className:`mono text-caption text-muted`,children:[gV(e.prompt),` / `,gV(e.completion)]})]}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:gV(e.cache_write)}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:Z9(e.credits)})]},e.key))})]})})})]})]}),(0,G.jsx)(oEe,{accounts:y,t:e})]});return(0,G.jsxs)(`div`,{className:`space-y-6 sm:space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-3 pb-1`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`usageTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(i===`cost`?`usageCostLead`:`usageLead`)})]}),(0,G.jsx)(L9,{ariaLabel:e(`logsColApiKey`),value:T,onChange:e=>{h(!0),E(e)},options:D,allLabel:e(`logsFilterApiKeyAll`),searchPlaceholder:e(`logsSearchApiKey`),emptyLabel:e(`logsNoFilterOptions`)})]}),(0,G.jsxs)(OA,{selectedKey:i,onSelectionChange:e=>a(String(e)),children:[(0,G.jsx)(OA.ListContainer,{className:`w-fit`,children:(0,G.jsxs)(OA.List,{"aria-label":e(`usageTitle`),children:[(0,G.jsxs)(DA,{id:`stats`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),e(`usageStatsTab`)]}),(0,G.jsxs)(DA,{id:`cost`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(OA.Indicator,{className:`transition-none`}),e(`usageCostTab`)]})]})}),(0,G.jsx)(OA.Panel,{id:`stats`,className:`space-y-6 pt-5`,children:R}),(0,G.jsx)(OA.Panel,{id:`cost`,className:`pt-5`,children:(0,G.jsx)(fEe,{apiKeyFilter:T})})]})]})}var vEe=1.1;function yEe({label:e,onConfirm:t,isPending:n,children:r}){let i=(0,v.useRef)(null),a=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>{a.current?.kill()},[]),(0,G.jsxs)(Mj,{delay:300,children:[(0,G.jsx)(Mj.Trigger,{children:(0,G.jsxs)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":e,isPending:n,className:`relative overflow-hidden`,onPressStart:()=>{let e=i.current;!e||n||(a.current?.kill(),a.current=Z.to(e,{scaleX:1,duration:vEe*(1-Number(Z.getProperty(e,`scaleX`))),ease:GB.linear,onComplete:()=>{a.current=null,Z.to(e,{scaleX:0,duration:qB()?0:WB.base,ease:GB.out,delay:WB.fast}),t()}}))},onPressEnd:()=>{let e=i.current;!e||!a.current||(a.current.kill(),a.current=null,Z.to(e,{scaleX:0,duration:qB()?0:WB.base,ease:GB.soft}))},children:[(0,G.jsx)(`span`,{ref:i,"aria-hidden":!0,className:`pointer-events-none absolute inset-0 origin-left scale-x-0 bg-danger/20`}),(0,G.jsx)(`span`,{className:`relative inline-flex`,children:r})]})}),(0,G.jsx)(Mj.Content,{children:e})]})}function bEe(e){let t=[];for(let n of e)for(let e of n.regions||[])e?.id&&t.push({value:`${n.id}:${e.id}`,provider:n.id,region:e.id});return t}function Q9(e,t){let n=e.indexOf(`:`),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n+1);return i?YV(r,i,t):JV(r,t)}function xEe(e){let t=e.indexOf(`:`);return t===-1?e:e.slice(0,t)}function SEe(e,t){let n=[],r=new Set(e.filter(e=>!e.includes(`:`)).map(e=>e.toLowerCase()));for(let t of e)t.includes(`:`)&&n.push(t);for(let e of t)r.has(e.provider)&&!n.includes(e.value)&&n.push(e.value);return n}function CEe(e,t){return e.length?e.map(e=>Q9(e,t)).join(` · `):t(`keysAllProviders`)}function wEe(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function TEe(){let{t:e}=JF(),[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(!0),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(!1);(0,v.useEffect)(()=>{dI().then(e=>{let t=bEe(e.data||[]);n(t),i(t.length>0),o(``)}).catch(e=>{o(e instanceof Error?e.message:String(e))})},[]);async function w(){u(!0);try{let e=await N9();c(e.data||[]),m(``)}catch(e){m(e instanceof Error?e.message:String(e))}finally{u(!1)}}(0,v.useEffect)(()=>{let e=window.setTimeout(()=>void w(),0);return()=>window.clearTimeout(e)},[]);async function T(e){await Z7(e),C(!0),window.setTimeout(()=>C(!1),1200)}async function E(e,t){f(e.id),c(n=>n.map(n=>n.id===e.id?{...n,enabled:t}:n));try{let n=await P9(e.id,{enabled:t});c(t=>t.map(t=>t.id===e.id?{...t,...n,secret:void 0}:t))}catch(e){m(e instanceof Error?e.message:String(e)),await w()}finally{f(``)}}async function D(t){f(t.id);try{await BTe(t.id),c(e=>e.filter(e=>e.id!==t.id)),pV({type:`success`,title:e(`toastKeyDeleted`)})}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(``)}}return l&&!s.length?(0,G.jsx)(Pce,{}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:e(`navKeys`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`keysLead`)})]}),(0,G.jsxs)(J,{size:`sm`,isDisabled:!r,onPress:()=>g(!0),children:[(0,G.jsx)(Ma,{size:14}),e(`keysCreate`)]})]}),p?(0,G.jsx)(xI,{title:p}):null,a?(0,G.jsx)(xI,{title:e(`keysProvidersLoadFailed`,{message:a})}):null,l?(0,G.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:Math.max(3,s.length)},(e,t)=>(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-3`,children:[(0,G.jsx)(Q,{className:`h-4 w-28`}),(0,G.jsx)(Q,{className:`mt-2 h-3 w-40`}),(0,G.jsx)(Q,{className:`mt-4 h-6 w-24`}),(0,G.jsx)(Q,{className:`mt-6 h-8 w-full`})]},t))}):s.length?(0,G.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,children:s.map(t=>(0,G.jsxs)(CS,{className:`overflow-hidden p-0`,children:[(0,G.jsxs)(CS.Header,{className:`flex-row items-start justify-between gap-3 px-3 pt-3 pb-2.5`,children:[(0,G.jsx)(`div`,{className:`min-w-0`,children:(0,G.jsx)(CS.Title,{className:`truncate text-body`,children:t.name})}),(0,G.jsx)(BS,{size:`sm`,variant:`soft`,color:t.enabled?`success`:`default`,children:t.enabled?e(`enabled`):e(`disabled`)})]}),(0,G.jsxs)(CS.Content,{className:`space-y-2.5 px-3 pb-2.5`,children:[(0,G.jsx)(`div`,{className:`mono w-full rounded-lg bg-surface-secondary px-3 py-2 text-body text-foreground`,title:t.prefix,children:t.prefix}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:(t.providers.length?t.providers:[`all`]).map(t=>(0,G.jsx)(BS,{size:`sm`,variant:`soft`,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[t===`all`?(0,G.jsx)(ua,{size:12}):(0,G.jsx)(XV,{provider:xEe(t),size:12}),(0,G.jsx)(`span`,{children:t===`all`?e(`keysAllProviders`):Q9(t,e)})]})},t))}),(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:t.last_used_at?e(`keysLastUsed`,{time:wEe(t.last_used_at)}):e(`keysNeverUsed`)})]}),(0,G.jsxs)(CS.Footer,{className:`gap-1.5 bg-surface-secondary px-3 py-2`,children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isDisabled:!r,onPress:()=>y(t),children:e(`edit`)}),(0,G.jsx)(yEe,{label:e(`holdToDelete`),isPending:d===t.id,onConfirm:()=>void D(t),children:(0,G.jsx)(io,{size:14})}),(0,G.jsx)(`div`,{className:`ml-auto`,children:(0,G.jsx)(h7,{isSelected:t.enabled,isDisabled:d===t.id,ariaLabel:e(`enable`),onChange:e=>void E(t,e)})})]})]},t.id))}):(0,G.jsx)(I7,{className:`rounded-3xl bg-surface-secondary`,icon:(0,G.jsx)(QB,{size:28}),title:e(`keysEmpty`),hint:e(`keysEmptyHint`),action:(0,G.jsxs)(J,{size:`sm`,isDisabled:!r,onPress:()=>g(!0),children:[(0,G.jsx)(Ma,{size:14}),e(`keysCreate`)]})}),(0,G.jsx)($9,{isOpen:h,title:e(`keysCreateTitle`),hint:e(`keysCreateHint`),options:t,t:e,onClose:()=>g(!1),onSave:async e=>{let t=await zTe(e);c(e=>[t,...e.map(e=>({...e,secret:void 0}))]),g(!1),x(t)}}),(0,G.jsx)($9,{isOpen:!!_,title:e(`keysEditTitle`),hint:e(`keysEditHint`),initial:_,options:t,t:e,onClose:()=>y(null),onSave:async e=>{if(!_)return;let t=await P9(_.id,e);c(e=>e.map(e=>e.id===_.id?{...e,...t,secret:void 0}:e)),y(null)}}),(0,G.jsx)(Y.Root,{isOpen:!!b?.secret,onOpenChange:e=>{e||x(null)},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`lg`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`keysSecretTitle`)}),(0,G.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:e(`keysSecretHint`)})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":e(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(yo,{size:18})})]}),(0,G.jsxs)(Y.Body,{className:`px-6 pb-2`,children:[(0,G.jsxs)(_P,{status:`warning`,className:`mb-4`,children:[(0,G.jsx)(_P.Indicator,{}),(0,G.jsx)(_P.Content,{children:(0,G.jsx)(_P.Title,{children:e(`keysSecretOnce`)})})]}),(0,G.jsx)(`code`,{className:`mono block break-all rounded-lg bg-surface-secondary px-3 py-3 text-body`,children:b?.secret})]}),(0,G.jsxs)(Y.Footer,{className:`justify-end`,children:[(0,G.jsx)(J,{variant:`ghost`,onPress:()=>x(null),children:e(`close`)}),(0,G.jsxs)(J,{onPress:()=>{b?.secret&&T(b.secret)},children:[(0,G.jsx)(Ii,{size:14}),e(S?`copied`:`copy`)]})]})]})})})})]})}function $9({isOpen:e,title:t,hint:n,initial:r,options:i,t:a,onClose:o,onSave:s}){let[c,l]=(0,v.useState)(r?.name||``),[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)(new Set),[m,h]=(0,v.useState)(!0),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(!e)return;l(r?.name||``),d(SEe(r?.providers||[],i));let t=new Set((r?.providers||[]).filter(e=>!e.includes(`:`)).map(e=>e.toLowerCase()));p(t),h(!0),_(``)},[r,e,i]);function x(e){let t=i.find(t=>t.value===e);h(!1),d(n=>n.includes(e)?(t&&p(e=>{let n=new Set(e);return n.delete(t.provider),n}),n.filter(t=>t!==e)):[...n,e])}async function S(e){e?.preventDefault();let t=c.trim();if(!t){_(a(`keysNameRequired`));return}if(!i.length){_(a(`keysProvidersNotLoaded`));return}b(!0),_(``);try{await s({name:t,providers:m?r?.providers||[]:u})}catch(e){_(e instanceof Error?e.message:String(e))}finally{b(!1)}}return(0,G.jsx)(Y.Root,{isOpen:e,onOpenChange:e=>{!e&&!y&&o()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,G.jsx)(Y.Dialog,{className:`sm:min-w-[32rem]`,children:(0,G.jsxs)(mP,{onSubmit:S,children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:t}),(0,G.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:n})]}),(0,G.jsx)(Y.CloseTrigger,{isDisabled:y,"aria-label":a(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(yo,{size:18})})]}),(0,G.jsxs)(Y.Body,{className:`space-y-5 px-6 pb-2 pt-1`,children:[g?(0,G.jsxs)(_P,{status:`danger`,children:[(0,G.jsx)(_P.Indicator,{}),(0,G.jsx)(_P.Content,{children:(0,G.jsx)(_P.Title,{children:g})})]}):null,(0,G.jsx)(_9,{label:a(`keysName`),children:(0,G.jsx)(Rj,{value:c,onChange:e=>l(e.target.value),placeholder:a(`keysNamePh`),"aria-label":a(`keysName`)})}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(jM,{className:`text-body font-medium text-muted`,children:a(`keysProviders`)}),(0,G.jsx)(NM,{className:`text-caption leading-5 text-muted`,children:a(`keysProvidersHint`)}),i.length?(0,G.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:i.map(e=>{let t=u.includes(e.value),n=f.has(e.provider);return(0,G.jsx)(IS,{isSelected:t,onChange:()=>x(e.value),className:`rounded-xl bg-surface-secondary px-3 py-2.5 data-selected:border-accent data-selected:bg-accent-soft`,children:(0,G.jsxs)(IS.Content,{className:`flex items-center gap-2.5`,children:[(0,G.jsx)(IS.Control,{children:(0,G.jsx)(IS.Indicator,{})}),(0,G.jsx)(XV,{provider:e.provider,size:16}),(0,G.jsx)(`span`,{className:`text-body font-medium`,children:YV(e.provider,e.region,a)}),n?(0,G.jsx)(`span`,{className:`rounded-md bg-surface-secondary px-1.5 py-0.5 text-caption font-medium text-muted`,children:a(`keysAllRegions`)}):null]})},e.value)})}):(0,G.jsx)(`p`,{className:`rounded-lg bg-surface-secondary px-3 py-2.5 text-caption leading-5 text-muted`,children:a(`keysProvidersNotLoaded`)}),(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:CEe(u,a)})]})]}),(0,G.jsxs)(Y.Footer,{className:`justify-end`,children:[(0,G.jsx)(J,{variant:`ghost`,isDisabled:y,onPress:o,children:a(`cancel`)}),(0,G.jsx)(J,{type:`submit`,isPending:y,isDisabled:!i.length,children:a(r?`save`:`create`)})]})]})})})})})}function EEe(){return(0,G.jsx)(mse,{children:(0,G.jsx)(Yoe,{children:(0,G.jsx)(Xoe,{children:(0,G.jsx)(fse,{children:(0,G.jsx)(xn,{children:(0,G.jsxs)(Pt,{children:[(0,G.jsx)(Mt,{path:`/login`,element:(0,G.jsx)(RTe,{})}),(0,G.jsx)(Mt,{element:(0,G.jsx)(tle,{}),children:(0,G.jsxs)(Mt,{element:(0,G.jsx)(ele,{}),children:[(0,G.jsx)(Mt,{path:`/`,element:(0,G.jsx)(ewe,{})}),(0,G.jsx)(Mt,{path:`/auth`,element:(0,G.jsx)(At,{to:`/accounts`,replace:!0})}),(0,G.jsx)(Mt,{path:`/providers`,element:(0,G.jsx)(lwe,{})}),(0,G.jsx)(Mt,{path:`/access`,element:(0,G.jsx)(Iwe,{})}),(0,G.jsx)(Mt,{path:`/accounts`,element:(0,G.jsx)(LTe,{})}),(0,G.jsx)(Mt,{path:`/checkins`,element:(0,G.jsx)(At,{to:`/accounts`,replace:!0})}),(0,G.jsx)(Mt,{path:`/usage`,element:(0,G.jsx)(_Ee,{})}),(0,G.jsx)(Mt,{path:`/logs`,element:(0,G.jsx)(iEe,{})}),(0,G.jsx)(Mt,{path:`/keys`,element:(0,G.jsx)(TEe,{})}),(0,G.jsx)(Mt,{path:`/system`,element:(0,G.jsx)(JTe,{})}),(0,G.jsx)(Mt,{path:`*`,element:(0,G.jsx)(At,{to:`/`,replace:!0})})]})})]})})})})})})}(0,y.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(v.StrictMode,{children:(0,G.jsx)(EEe,{})}));export{oY as $,RU as $t,S_e as A,YW as At,i4 as B,jW as Bt,b6 as C,h as Cn,QW as Ct,g3 as D,NW as Dt,nve as E,RW as Et,z4 as F,IW as Ft,jZ as G,UW as Gt,g2 as H,WW as Ht,B4 as I,MW as It,vZ as J,DW as Jt,wZ as K,kW as Kt,Fge as L,BW as Lt,w_e as M,qW as Mt,C_e as N,JW as Nt,B_e as O,VW as Ot,Z4 as P,KW as Pt,IY as Q,IU as Qt,Age as R,AW as Rt,w6 as S,Is as Sn,$W as St,h6 as T,l as Tn,zW as Tt,t2 as U,GW as Ut,r4 as V,PW as Vt,eQ as W,HW as Wt,GY as X,nde as Xt,oX as Y,EW as Yt,WY as Z,PU as Zt,P6 as _,gV as _n,$ as _t,t5 as a,DU as an,eY as at,E6 as b,Z as bn,tG as bt,F8 as c,xU as cn,qq as ct,h8 as d,mU as dn,Lq as dt,MU as en,aY as et,Q6 as f,fU as fn,Yq as ft,L6 as g,CV as gn,pG as gt,B6 as h,kV as hn,Dq as ht,l5 as i,EU as in,tY as it,a3 as j,XW as jt,d3 as k,FW as kt,j8 as l,bU as ln,Vq as lt,W6 as m,AV as mn,Fq as mt,o7 as n,OU as nn,iY as nt,L8 as o,TU as on,TJ as ot,Y6 as p,pU as pn,Nq as pt,EZ as q,OW as qt,m5 as r,VU as rn,rY as rt,I8 as s,wU as sn,yJ as st,s7 as t,jU as tn,sY as tt,C8 as u,vU as un,Iq as ut,N6 as v,TV as vn,rG as vt,f6 as w,d as wn,ude as wt,T6 as x,qc as xn,eG as xt,O6 as y,_V as yn,aG as yt,Oge as z,LW as zt}; \ No newline at end of file diff --git a/internal/webui/static/index.html b/internal/webui/static/index.html index e244b7ff..4d4cd119 100644 --- a/internal/webui/static/index.html +++ b/internal/webui/static/index.html @@ -19,7 +19,7 @@ - +