1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,822124,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(156132);function a(e){if(!e)return"?";let t=e.split(" ");return t.length>=2?`${t[0][0]}${t[1][0]}`.toUpperCase():e.substring(0,2).toUpperCase()}e.s(["default",0,function(e){let l,i,n,o,c,d=(0,r.c)(17),{src:u,alt:m,name:x,size:p,className:h}=e,b=void 0===m?"Avatar":m,f=void 0===p?"md":p;if(d[0]!==b||d[1]!==h||d[2]!==x||d[3]!==f||d[4]!==u){n=Symbol.for("react.early_return_sentinel");e:{let e={xs:"size-6 text-xs",sm:"size-8 text-sm",md:"size-10 text-base",lg:"size-12 text-lg",xl:"size-16 text-xl"};if(l=a,u){let r,a=`url(${u})`;d[8]!==a?(r={backgroundImage:a},d[8]=a,d[9]=r):r=d[9],n=(0,t.jsx)("div",{className:(0,s.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",e[f],h),style:r,role:"img","aria-label":b});break e}i=(0,s.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",e[f],function(e){if(!e)return"bg-primary";let t=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],r=e.charCodeAt(0)%t.length;return t[r]}(x),h)}d[0]=b,d[1]=h,d[2]=x,d[3]=f,d[4]=u,d[5]=l,d[6]=i,d[7]=n}else l=d[5],i=d[6],n=d[7];return n!==Symbol.for("react.early_return_sentinel")?n:(d[10]!==l||d[11]!==x?(o=l(x),d[10]=l,d[11]=x,d[12]=o):o=d[12],d[13]!==b||d[14]!==i||d[15]!==o?(c=(0,t.jsx)("div",{className:i,role:"img","aria-label":b,children:o}),d[13]=b,d[14]=i,d[15]=o,d[16]=c):c=d[16],c)}])},642440,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(618566),a=e.i(522016),l=e.i(948148);let i={dashboard:"dashboard",providers:"providers",combos:"combos",settings:"settings",general:"general",appearance:"appearance",ai:"ai",routing:"routing",resilience:"resilience",advanced:"advanced","access-tokens":"accessTokens","feature-flags":"featureFlags",logs:"logs","audit-log":"auditLog",console:"console",logger:"logger",translator:"translator",playground:"playground",add:"add",edit:"edit",keys:"apiKeys",models:"models","cli-code":"cliCode","cli-agents":"cliAgents","acp-agents":"acpAgents",endpoint:"endpoint","api-manager":"apiManager",context:"context",compression:"compression",services:"services",analytics:"analytics",costs:"costs",health:"health",runtime:"runtime",webhooks:"webhooks",home:"home",activity:"activity","agent-skills":"agentSkills","combo-health":"comboHealth",evals:"evals",search:"search",utilization:"utilization","api-endpoints":"apiEndpoints",audit:"audit",a2a:"a2a",mcp:"mcp",batch:"batch",files:"files",media:"media",cache:"cache",changelog:"changelog",chaos:"chaos","cloud-agents":"cloudAgents",live:"live",studio:"studio",aggressive:"aggressive",caveman:"caveman",ccr:"ccr",headroom:"headroom",lite:"lite",llmlingua:"llmlingua",omniglyph:"omniglyph",rtk:"rtk","session-dedup":"sessionDedup",ultra:"ultra",budget:"budget",pricing:"pricing","quota-share":"quotaShare",discovery:"discovery","free-provider-rankings":"freeProviderRankings",radar:"radar",setup:"setup","free-tiers":"freeTiers",gamification:"gamification",leaderboard:"leaderboard",limits:"limits",profile:"profile",plugins:"plugins","provider-stats":"providerStats",new:"new",quota:"quota",relay:"relay","search-tools":"searchTools",security:"security",sidebar:"sidebar",tokens:"tokens",tools:"tools","agent-bridge":"agentBridge","traffic-inspector":"trafficInspector",usage:"usage"};function n(e,r){return(0,t.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[r>0&&(0,t.jsx)("span",{style:{opacity:.4,fontSize:"11px"},"aria-hidden":"true",children:"âº"}),e.isLast?(0,t.jsx)("span",{"aria-current":"page",style:{color:"var(--text-primary, #e0e0e0)",fontWeight:500},children:e.label}):(0,t.jsx)(a.default,{href:e.href,style:{color:"var(--text-secondary, #888)",textDecoration:"none",transition:"color 0.15s"},onMouseEnter:c,onMouseLeave:o,children:e.label})]},e.href)}function o(e){return e.currentTarget.style.color="var(--text-secondary, #888)"}function c(e){return e.currentTarget.style.color="var(--accent, #818cf8)"}e.s(["default",0,function(){let e,a=(0,r.c)(6),o=(0,s.usePathname)(),c=(0,l.useTranslations)("breadcrumbs");if(!o||"/dashboard"===o)return null;
1if(a[0]!==o||a[1]!==c){let r,s,l=o.split("/").filter(Boolean),d=l.map((e,t)=>{let r,s;return{label:(r=i[e],s=e.charAt(0).toUpperCase()+e.slice(1),r&&"function"==typeof c.has&&c.has(r)?c(r):s),href:"/"+l.slice(0,t+1).join("/"),isLast:t===l.length-1}});a[3]!==c?(r=c("ariaLabel"),a[3]=c,a[4]=r):r=a[4],a[5]===Symbol.for("react.memo_cache_sentinel")?(s={display:"flex",alignItems:"center",gap:"6px",fontSize:"13px",color:"var(--text-secondary, #888)",padding:"8px 0",marginBottom:"8px"},a[5]=s):s=a[5],e=(0,t.jsx)("nav",{"aria-label":r,style:s,children:d.map(n)}),a[0]=o,a[1]=c,a[2]=e}else e=a[2];return e}])},542055,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(156132);e.s(["default",0,function(e){let a,l,i,n,o,c,d,u,m=(0,r.c)(17);m[0]!==e?({label:i,className:a,id:l,...n}=e,m[0]=e,m[1]=a,m[2]=l,m[3]=i,m[4]=n):(a=m[1],l=m[2],i=m[3],n=m[4]),m[5]!==a?(o=(0,s.cn)("h-4 w-4 shrink-0 cursor-pointer rounded-[4px] accent-[var(--color-accent)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30","disabled:cursor-not-allowed disabled:opacity-50",a),m[5]=a,m[6]=o):o=m[6],m[7]!==l||m[8]!==n||m[9]!==o?(c=(0,t.jsx)("input",{type:"checkbox",id:l,className:o,...n}),m[7]=l,m[8]=n,m[9]=o,m[10]=c):c=m[10];let x=c;return i?(m[11]!==i?(d=(0,t.jsx)("span",{children:i}),m[11]=i,m[12]=d):d=m[12],m[13]!==x||m[14]!==l||m[15]!==d?(u=(0,t.jsxs)("label",{htmlFor:l,className:"inline-flex items-center gap-2 cursor-pointer text-sm text-text-main",children:[x,d]}),m[13]=x,m[14]=l,m[15]=d,m[16]=u):u=m[16],u):x}])},51130,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(271645),a=e.i(156132);function l(e){return!e}e.s(["default",0,function(e){let i,n,o,c,d,u,m,x,p,h,b,f,g,y=(0,r.c)(37),{title:v,subtitle:j,icon:k,trailing:N,defaultOpen:w,variant:S,className:_,children:C}=e,T=void 0===S?"default":S,[E,I]=(0,s.useState)(void 0!==w&&w),D="default"===T?"rounded-lg border border-black/5 dark:border-white/5 bg-surface":"rounded-md border border-black/5 dark:border-white/5 bg-black/[0.02] dark:bg-white/[0.02]";y[0]!==_||y[1]!==D?(i=(0,a.cn)(D,_),y[0]=_,y[1]=D,y[2]=i):i=y[2];let L=i,A="default"===T?"p-4":"p-3",K=E&&"border-b border-black/5 dark:border-white/5";y[3]!==A||y[4]!==K?(n=(0,a.cn)("flex items-center gap-3",A,"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",K),y[3]=A,y[4]=K,y[5]=n):n=y[5];let R=n;y[6]===Symbol.for("react.memo_cache_sentinel")?(o=()=>I(l),y[6]=o):o=y[6];let F=E?"expand_more":"chevron_right";return y[7]!==F?(c=(0,t.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[20px] shrink-0","aria-hidden":"true",children:F}),y[7]=F,y[8]=c):c=y[8],y[9]!==k?(d=k&&(0,t.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px] shrink-0","aria-hidden":"true",children:k}),y[9]=k,y[10]=d):d=y[10],y[11]!==v?(u=(0,t.jsx)("div",{className:"text-sm font-medium text-text-main truncate",children:v}),y[11]=v,y[12]=u):u=y[12],y[13]!==j?(m=j&&(0,t.jsx)("div",{className:"text-xs text-text-muted truncate",children:j}),y[13]=j,y[14]=m):m=y[14],y[15]!==u||y[16]!==m?(x=(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[u,m]}),y[15]=u,y[16]=m,y[17]=x):x=y[17],y[18]!==E||y[19]!==c||y[20]!==d||y[21]!==x?(p=(0,t.jsxs)("button",{type:"button",onClick:o,"aria-expanded":E,className:"flex items-center gap-3 flex-1 min-w-0 text-left -m-1 p-1 rounded",children:[c,d,x]}),y[18]=E,y[19]=c,y[20]=d,y[21]=x,y[22]=p):p=y[22],y[23]!==N?(h=N&&(0,t.jsx)("div",{className:"flex items-center gap-2 shrink-0",children:N}),y[23]=N,y[24]=h):h=y[24],y[25]!==R||y[26]!==p||y[27]!==h?(b=(0,t.jsxs)("div",{className:R,children:[p,h]}),y[25]=R,y[26]=p,y[27]=h,y[28]=b):b=y[28],y[29]!==C||y[30]!==E||y[31]!==T?(f=E&&(0,t.jsx)("div",{className:"default"===T?"p-4":"p-3",children:C}),y[29]=C,y[30]=E,y[31]=T,y[32]=f):f=y[32],y[33]!==b||y[34]!==f||y[35]!==L?(g=(0,t.jsxs)("div",{className:L,children:[b,f]}),y[33]=b,y[34]=f,y[35]=L,y[36]=g):g=y[36],g}])},515272,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(271645),a=e.i(156132);function l(e){return!e}e.s(["default",0,function(e){let i,n,o,c,d,u,m,x,p,h,b,f,g,y=(0,r.c)(33),{title:v,description:j,count:k,defaultOpen:N,children:w,className:S}
1=e,[_,C]=(0,s.useState)(void 0===N||N);y[0]!==S?(i=(0,a.cn)("border border-black/5 dark:border-white/5 rounded-lg",S),y[0]=S,y[1]=i):i=y[1],y[2]===Symbol.for("react.memo_cache_sentinel")?(n=()=>C(l),y[2]=n):n=y[2];let T=!_&&"rounded-b-lg";y[3]!==T?(o=(0,a.cn)("flex items-center justify-between w-full px-4 py-3 text-left","hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors","rounded-t-lg",T),y[3]=T,y[4]=o):o=y[4],y[5]!==v?(c=(0,t.jsx)("span",{className:"text-sm font-semibold text-text-main truncate",children:v}),y[5]=v,y[6]=c):c=y[6],y[7]!==k?(d=null!=k&&(0,t.jsx)("span",{className:"px-2 py-0.5 text-[10px] font-semibold rounded-full bg-black/5 dark:bg-white/10 text-text-muted",children:k}),y[7]=k,y[8]=d):d=y[8],y[9]!==j?(u=j&&(0,t.jsx)("span",{className:"text-xs text-text-muted truncate hidden sm:inline",children:j}),y[9]=j,y[10]=u):u=y[10],y[11]!==c||y[12]!==d||y[13]!==u?(m=(0,t.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[c,d,u]}),y[11]=c,y[12]=d,y[13]=u,y[14]=m):m=y[14];let E=_?"rotate(0deg)":"rotate(-90deg)";y[15]!==E?(x=(0,t.jsx)("span",{className:"material-symbols-outlined text-[20px] text-text-muted transition-transform duration-200 shrink-0",style:{transform:E},children:"expand_more"}),y[15]=E,y[16]=x):x=y[16],y[17]!==_||y[18]!==x||y[19]!==o||y[20]!==m?(p=(0,t.jsxs)("button",{type:"button",onClick:n,className:o,"aria-expanded":_,children:[m,x]}),y[17]=_,y[18]=x,y[19]=o,y[20]=m,y[21]=p):p=y[21];let I=_?"max-h-[2000px]":"max-h-0";return y[22]!==I?(h=(0,a.cn)("overflow-hidden transition-[max-height] duration-200 ease-in-out",I),y[22]=I,y[23]=h):h=y[23],y[24]!==w?(b=(0,t.jsx)("div",{className:"px-4 pb-4 pt-1",children:w}),y[24]=w,y[25]=b):b=y[25],y[26]!==h||y[27]!==b?(f=(0,t.jsx)("div",{className:h,children:b}),y[26]=h,y[27]=b,y[28]=f):f=y[28],y[29]!==p||y[30]!==f||y[31]!==i?(g=(0,t.jsxs)("div",{className:i,children:[p,f]}),y[29]=p,y[30]=f,y[31]=i,y[32]=g):g=y[32],g}])},563201,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(271645),a=e.i(948148);e.s(["default",0,function(e){let l,i,n,o,c,d,u,m,x,p,h,b,f,g=(0,r.c)(28),{columns:y,visible:v,onToggle:j}=e;g[0]!==y?(l=void 0===y?[]:y,g[0]=y,g[1]=l):l=g[1];let k=l;g[2]!==v?(i=void 0===v?{}:v,g[2]=v,g[3]=i):i=g[3];let N=i,w=(0,a.useTranslations)("common"),[S,_]=(0,s.useState)(!1),C=(0,s.useRef)(null);return g[4]!==S?(n=()=>{if(!S)return;let e=e=>{C.current&&!C.current.contains(e.target)&&_(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},o=[S],g[4]=S,g[5]=n,g[6]=o):(n=g[5],o=g[6]),(0,s.useEffect)(n,o),g[7]===Symbol.for("react.memo_cache_sentinel")?(c={position:"relative"},g[7]=c):c=g[7],g[8]!==S?(d=()=>_(!S),g[8]=S,g[9]=d):d=g[9],g[10]!==w?(u=w("toggleColumns"),g[10]=w,g[11]=u):u=g[11],g[12]===Symbol.for("react.memo_cache_sentinel")?(m={padding:"6px 10px",borderRadius:"6px",border:"1px solid rgba(255,255,255,0.1)",background:"rgba(255,255,255,0.05)",color:"var(--text-secondary, #888)",fontSize:"13px",cursor:"pointer",display:"flex",alignItems:"center",gap:"4px"},x=(0,t.jsx)("span",{style:{fontSize:"14px"},children:"âï¸"}),g[12]=m,g[13]=x):(m=g[12],x=g[13]),g[14]!==w?(p=w("columns"),g[14]=w,g[15]=p):p=g[15],g[16]!==p||g[17]!==d||g[18]!==u?(h=(0,t.jsxs)("button",{onClick:d,title:u,style:m,children:[x,p]}),g[16]=p,g[17]=d,g[18]=u,g[19]=h):h=g[19],g[20]!==k||g[21]!==j||g[22]!==S||g[23]!==N?(b=S&&(0,t.jsx)("div",{style:{position:"absolute",top:"100%",right:0,marginTop:"4px",background:"rgba(20,20,30,0.95)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:"8px",padding:"8px",zIndex:50,minWidth:"160px",backdropFilter:"blur(12px)"},children:k.map(e=>(0,t.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"4px 8px",cursor:"pointer",fontSize:"12px",color:N[e.key]?"var(--text-primary, #e0e0e0)":"var(--text-secondary, #888)",borderRadius:"4px"},children:[(0,t.jsx)("input",{type:"checkbox",checked:N[e.key]??!0,onChange:()=>j(e.key),style:{accentColor:"#6366f1"}}),e.label]},e.key))}),g[20]=k,g[21]=j,g[22]=S,g[23]=N,g[24]=b):b=g[24],g[25]!==h||g[26]!==b?(f=(0,t.jsxs)("div",{ref:C,style:c,children:[h,b]}),g[25]=h,g[26]=b,g[27]=f):f=g[27],f}])},419947,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(948148),a=e.i(703166),l=e.i(342923),i=e.i(80173),n=e.i(866213);e.s(["default",0,function({isOpen:e,onSuccess:o,onClose:c,reauthConnection:d}){let u=(0,s.useTranslations)("cursorAuthModal"),[m,x]=(0,r.useState)("login"),[p,h]=(0,r.useState)(""),[b,f]=(0,r.useState)(""),[g,y]=(0,r.useState)(""),[v,j]=(0,r.useState)(null),[k,N]=(0,r.useState)(!1),[w,S]=(0,r.useState)(!1),[_,C]=(0,r.useState)(!1),[T,E]=(0,r.useState)(!1),[I,D]=(0,r.useState)(""),[L,A]=(0,r.useState)(""),[K,R]=(0,r.useState)(!1),[F,O]=(0,r.useState)(!1),M=(0,r.useRef)(!1);(0,r.useEffect)(()=>
1{if(!e){M.current=!0;return}M.current=!1,x("login"),j(null),D(""),A(""),O(!1),E(!1),(async()=>{S(!0),C(!1);try{let e=await fetch("/api/oauth/cursor/auto-import"),t=await e.json();t.found?(h(t.accessToken||""),f(t.refreshToken||""),y(t.machineId||""),C(!0)):"string"==typeof t.error&&/docker|config files found|not appear/i.test(t.error)&&E(!0)}catch{}finally{S(!1)}})()},[e]),(0,r.useEffect)(()=>()=>{M.current=!0},[]);let P=async()=>{R(!0),j(null),D(""),A("");try{let e=await fetch("/api/oauth/cursor/login/start",{method:"POST"}),t=await e.json();if(!e.ok)throw Error((0,n.errorMessageFromBody)(t,u("errorLoginStart")));D(t.loginUrl),A(t.sessionId),t.loginUrl&&window.open(t.loginUrl,"_blank","noopener,noreferrer"),$(t.sessionId)}catch(e){j(e instanceof Error?e.message:u("errorLoginStart"))}finally{R(!1)}},$=async e=>{O(!0),M.current=!1;let t=1e3;try{for(let r=0;r<150;r++){if(M.current||(await new Promise(e=>setTimeout(e,t)),M.current))return;let r=await fetch("/api/oauth/cursor/login/poll",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})}),s=await r.json();if("pending"===s.status){t=Math.min(1.2*t,1e4);continue}if("ok"===s.status||s.success){o?.(),c();return}throw Error((0,n.errorMessageFromBody)(s,u("errorLoginPoll")))}throw Error(u("errorLoginTimeout"))}catch(e){M.current||j(e instanceof Error?e.message:u("errorLoginPoll"))}finally{O(!1)}},B=async()=>{if(M.current=!0,L)try{await fetch("/api/oauth/cursor/login/cancel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:L})})}catch{}O(!1),D(""),A("")},z=async()=>{if(!p.trim())return void j(u("errorEnterToken"));N(!0),j(null);try{let e={accessToken:p.trim()};g.trim()&&(e.machineId=g.trim()),b.trim()&&(e.refreshToken=b.trim());let t=await fetch("/api/oauth/cursor/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await t.json();if(!t.ok)throw Error("string"==typeof r.error?r.error:r.error?.message||u("errorImportFailed"));o?.(),c()}catch(e){j(e instanceof Error?e.message:u("errorImportFailed"))}finally{N(!1)}},U=()=>{B(),c()};return(0,t.jsx)(a.default,{isOpen:e,title:u("title"),onClose:U,children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex gap-2 border-b border-border pb-2",children:[(0,t.jsx)(l.default,{variant:"login"===m?"primary":"ghost",onClick:()=>x("login"),disabled:F,children:u("tabLogin")}),(0,t.jsx)(l.default,{variant:"import"===m?"primary":"ghost",onClick:()=>x("import"),disabled:F,children:u("tabImport")})]}),"login"===m&&(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsx)("p",{className:"text-sm text-text-muted",children:u("loginDescription")}),F&&(0,t.jsxs)("div",{className:"text-center py-4",children:[(0,t.jsx)("div",{className:"size-12 mx-auto mb-3 rounded-full bg-primary/10 flex items-center justify-center",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary animate-spin",children:"progress_activity"})}),(0,t.jsx)("p",{className:"text-sm font-medium",children:u("waitingApproval")}),I&&(0,t.jsxs)("p",{className:"text-xs text-text-muted mt-2 break-all",children:[u("openUrlHint")," ",(0,t.jsx)("a",{href:I,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:u("openLoginLink")})]})]}),v&&(0,t.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,t.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:v})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[F?(0,t.jsx)(l.default,{onClick:B,variant:"ghost",fullWidth:!0,children:u("cancelLogin")}):(0,t.jsx)(l.default,{onClick:P,fullWidth:!0,disabled:K,children:K?u("startingLogin"):u("loginWithCursor")}),(0,t.jsx)(l.default,{onClick:U,variant:"ghost",fullWidth:!0,disabled:F,children:u("cancel")})]})]}),"import"===m&&(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[w&&(0,t.jsx)("div",{className:"text-center py-4",children:(0,t.jsx)("p",{className:"text-sm text-text-muted",children:u("autoDetecting")})}),!w&&_&&(0,t.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,t.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:u("tokensAutoDetected")})}),!w&&!_&&(0,t.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,t.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:T?u("dockerImportHint"):u("cursorNotDetected")})}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:[u("accessToken")," ",(0,t.jsx)("span",{className:"text-red-500",children:u("required")})]}),(0,t.jsx)("textarea",{value:p,onChange:e=>h(e.target.value),placeholder:u("accessTokenPlaceholder"),rows:3,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:[u("refreshToken")," ",(0,t.jsx)("span",{className:"text-text-muted text-xs",children:u("optional")})]}),(0,t.jsx)("textarea",{value:b,onChange:e=>f(e.target.value),placeholder:u("refreshTokenPlaceholder"),rows:2,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:[u("machineId")," ",(0,t.jsx)("span",{className:"text-text-muted text-xs",children:u("optional")})]}),(0,t.jsx)(i.default,{value:g,onChange:e=>y(e.target.value),placeholder:u("machineIdPlaceholder"),className:"font-mono text-sm"})]}),v&&(0,t.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,t.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:v})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(l.default,{onClick:z,fullWidth:!0,disabled:k||!p.trim(),children:k?u("importing"):u("importToken")}),(0,t.jsx)(l.default,{onClick:U,variant:"ghost",fullWidth:!0,children:u("cancel")})]})]})]})})}])},247854,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(271645),a=e.i(948148);
1e.s(["default",0,function(e){let l,i,n,o,c,d,u=(0,r.c)(19),{onDistribute:m,disabled:x,label:p,size:h}=e,b=void 0!==x&&x,f=void 0===p?"Distribute Proxies":p,[g,y]=(0,s.useState)("idle"),v=(0,a.useTranslations)("sharedComponents.distributeProxies"),j=(0,s.useRef)(null);u[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>()=>{j.current&&clearTimeout(j.current)},i=[],u[0]=l,u[1]=i):(l=u[0],i=u[1]),(0,s.useEffect)(l,i),u[2]!==b||u[3]!==m||u[4]!==g?(n=async()=>{if(!b&&"distributing"!==g){y("distributing");try{await m(),y("complete"),j.current=setTimeout(()=>y("idle"),1500)}catch{y("idle")}}},u[2]=b,u[3]=m,u[4]=g,u[5]=n):n=u[5];let k=n,N=b||"distributing"===g,w="distributing"===g?"bg-primary/20 border-primary/40 text-primary animate-pulse":"complete"===g?"bg-green-500/15 border-green-500/40 text-green-500":"bg-bg-subtle border-border text-text-muted hover:text-text-primary hover:border-primary/40",S="distributing"===g?"sync":"complete"===g?"check":"swap_horiz";u[6]!==f||u[7]!==g||u[8]!==v?(o="distributing"===g?v("distributing"):"complete"===g?v("complete"):f||v("defaultLabel"),u[6]=f,u[7]=g,u[8]=v,u[9]=o):o=u[9];let _=o,C=`flex items-center gap-1.5 rounded-lg font-medium border transition-colors ${"sm"===(void 0===h?"md":h)?"px-2 py-1 text-[11px]":"px-3 py-1.5 text-xs"} ${w}`,T=`material-symbols-outlined text-[14px] ${"distributing"===g?"animate-spin":""}`;return u[10]!==S||u[11]!==T?(c=(0,t.jsx)("span",{className:T,children:S}),u[10]=S,u[11]=T,u[12]=c):c=u[12],u[13]!==_||u[14]!==k||u[15]!==N||u[16]!==c||u[17]!==C?(d=(0,t.jsxs)("button",{onClick:k,disabled:N,className:C,title:_,"aria-label":_,children:[c,_]}),u[13]=_,u[14]=k,u[15]=N,u[16]=c,u[17]=C,u[18]=d):d=u[18],d}])},690777,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(271645),a=e.i(948148);function l(e){return e&&""!==e}e.s(["default",0,function(e){let i,n,o,c,d,u,m,x,p,h,b,f,g,y,v,j=(0,r.c)(46),{searchValue:k,onSearchChange:N,placeholder:w,filters:S,activeFilters:_,onFilterChange:C,children:T}=e,E=void 0===k?"":k;j[0]!==S?(i=void 0===S?[]:S,j[0]=S,j[1]=i):i=j[1];let I=i;j[2]!==_?(n=void 0===_?{}:_,j[2]=_,j[3]=n):n=j[3];let D=n,L=(0,a.useTranslations)("common"),[A,K]=(0,s.useState)(null);j[4]!==I||j[5]!==C||j[6]!==N?(o=()=>{N(""),I.forEach(e=>C(e.key,"")),K(null)},j[4]=I,j[5]=C,j[6]=N,j[7]=o):o=j[7];let R=o;j[8]!==D||j[9]!==E?(c=E||Object.values(D).some(l),j[8]=D,j[9]=E,j[10]=c):c=j[10];let F=c;if(j[11]===Symbol.for("react.memo_cache_sentinel")?(d={display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center",padding:"8px 0"},u={position:"relative",flex:"1 1 200px",minWidth:"200px"},j[11]=d,j[12]=u):(d=j[11],u=j[12]),j[13]!==N?(m=e=>N(e.target.value),j[13]=N,j[14]=m):m=j[14],j[15]!==w||j[16]!==L?(x=w||L("search"),j[15]=w,j[16]=L,j[17]=x):x=j[17],j[18]===Symbol.for("react.memo_cache_sentinel")?(p={width:"100%",padding:"8px 12px 8px 32px",borderRadius:"6px",border:"1px solid rgba(255,255,255,0.1)",background:"rgba(255,255,255,0.05)",color:"var(--text-primary, #e0e0e0)",fontSize:"13px",outline:"none"},j[18]=p):p=j[18],j[19]!==E||j[20]!==m||j[21]!==x?(h=(0,t.jsx)("input",{type:"text",value:E,onChange:m,placeholder:x,style:p}),j[19]=E,j[20]=m,j[21]=x,j[22]=h):h=j[22],j[23]===Symbol.for("react.memo_cache_sentinel")?(b=(0,t.jsx)("span",{style:{position:"absolute",left:"10px",top:"50%",transform:"translateY(-50%)",opacity:.4,fontSize:"14px",pointerEvents:"none"},children:"ð"}),j[23]=b):b=j[23],j[24]!==h?(f=(0,t.jsxs)("div",{style:u,children:[h,b]}),j[24]=h,j[25]=f):f=j[25],j[26]!==D||j[27]!==A||j[28]!==I||j[29]!==C||j[30]!==L){let e;j[32]!==D||j[33]!==A||j[34]!==C||j[35]!==L?(e=e=>(0,t.jsxs)("div",{style:{position:"relative"},children:[(0,t.jsxs)("button",{onClick:()=>K(A===e.key?null:e.key),style:{padding:"6px 12px",borderRadius:"6px",border:`1px solid ${D[e.key]?"rgba(99,102,241,0.5)":"rgba(255,255,255,0.1)"}`,background:D[e.key]?"rgba(99,102,241,0.15)":"rgba(255,255,255,0.05)",color:D[e.key]?"#818cf8":"var(--text-secondary, #888)",fontSize:"12px",cursor:"pointer",whiteSpace:"nowrap"},children:[e.label,D[e.key]?` \xb7 ${D[e.key]}`:""]}),A===e.key&&(0,t.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,marginTop:"4px",background:"rgba(20,20,30,0.95)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:"8px",padding:"4px",zIndex:50,minWidth:"120px",backdropFilter:"blur(12px)"},children:[(0,t.jsx)("button",{onClick:()=>{C(e.key,""),K(null)},style:{display:"block",width:"100%",padding:"6px 12px",textAlign:"left",background:"none",border:"none",color:"#888",fontSize:"12px",cursor:"pointer",borderRadius:"4px"},children:L("all")}),(e.options||[]).map(r=>(0,t.jsx)("button",{onClick:()=>{C(e.key,r),K(null)},style:{display:"block",width:"100%",padding:"6px 12px",textAlign:"left",background:D[e.key]===r?"rgba(99,102,241,0.2)":"none",border:"none",color:D[e.key]===r?"#818cf8":"var(--text-primary, #e0e0e0)",fontSize:"12px",cursor:"pointer",borderRadius:"4px"},children:r},r))]})]},e.key),j[32]=D,j[33]=A,j[34]=C,j[35]=L,j[36]=e):e=j[36],g=I.map(e),j[26]=D,j[27]=A,j[28]=I,j[29]=C,j[30]=L,j[31]=g}else g=j[31];return j[37]!==R||j[38]!==F||j[39]!==L?(y=F&&(0,t.jsx)("button",{onClick:R,style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid rgba(239,68,68,0.3)",background:"rgba(239,68,68,0.1)",color:"#ef4444",fontSize:"12px",cursor:"pointer"},children:L("clear")}),j[37]=R,j[38]=F,j[39]=L,j[40]=y):y=j[40],j[41]!==T||j[42]!==f||j[43]!==g||j[44]!==y?(v=(0,t.jsxs)("div",{style:d,children:[f,g,y,T]}),j[41]=T,j[42]=f,j[43]=g,j[44]=y,j[45]=v):v=j[45],v}])},982131,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(948148),a=e.i(522016),l=e.i(723790);let i=[{key:"featuresLink",href:"#features"},{key:"pricing",href:"#pricing"},{key:"changelog",href:"https://github.com/diegosouzapw/OmniRoute/releases",external:!0}],n=[{key:"documentation",href:"/docs"},{key:"apiReference",href:"/docs#api-reference"},{key:"helpCenter",href:"https://github.com/diegosouzapw/OmniRoute/discussions",external:!0}],o=[{key:"about",href:"https://github.com/diegosouzapw/OmniRoute",external:!0},{key:"blog",href:"https://github.com/diegosouzapw/OmniRoute/releases",external:!0},{key:"contact",href:"https://github.com/diegosouzapw/OmniRoute/issues/new/choose",external:!0},{key:"terms",href:"/terms"},{key:"privacy",href:"/privacy"}];e.s(["default",0,function(){let e,c,d,u,m,x,p,h,b,f,g,y,v,j,k,N,w,S,_,C,T,E,I,D,L,A,K,R,F,O,M,P,$,B,z,U,q,H,W,G=(0,r.c)(87),J=(0,s.useTranslations)("landing");G[0]!==J?(e=e=>e.external?(0,t.jsx)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"hover:text-primary transition-colors",children:J(e.key)}):(0,t.jsx)(a.default,{href:e.href,className:"hover:text-primary transition-colors",children:e.label}),G[0]=J,G[1]=e):e=G[1];let V=e;return G[2]===Symbol.for("react.memo_cache_sentinel")?(c=(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,t.jsx)("div",{className:"size-6 text-primary",children:(0,t.jsx)("svg",{className:"w-full h-full",fill:"
1currentColor",viewBox:"0 0 48 48",children:(0,t.jsx)("path",{clipRule:"evenodd",d:"M12.0799 24L4 19.2479L9.95537 8.75216L18.04 13.4961L18.0446 4H29.9554L29.96 13.4961L38.0446 8.75216L44 19.2479L35.92 24L44 28.7521L38.0446 39.2479L29.96 34.5039L29.9554 44H18.0446L18.04 34.5039L9.95537 39.2479L4 28.7521L12.0799 24Z",fillRule:"evenodd"})})}),(0,t.jsx)("span",{className:"text-xl font-bold text-text-main",children:l.APP_CONFIG.name})]}),G[2]=c):c=G[2],G[3]!==J?(d=J("footerDescription"),G[3]=J,G[4]=d):d=G[4],G[5]!==d?(u=(0,t.jsx)("p",{className:"text-text-muted mb-6 max-w-sm font-light",children:d}),G[5]=d,G[6]=u):u=G[6],G[7]!==J?(m=J("communityDiscussions"),G[7]=J,G[8]=m):m=G[8],G[9]===Symbol.for("react.memo_cache_sentinel")?(x=(0,t.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"})}),G[9]=x):x=G[9],G[10]!==m?(p=(0,t.jsx)("a",{href:"https://github.com/diegosouzapw/OmniRoute/discussions",target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-primary transition-colors","aria-label":m,children:x}),G[10]=m,G[11]=p):p=G[11],G[12]===Symbol.for("react.memo_cache_sentinel")?(h=(0,t.jsx)("a",{href:"https://github.com/diegosouzapw/OmniRoute",target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,t.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})})}),G[12]=h):h=G[12],G[13]!==p?(b=(0,t.jsxs)("div",{className:"flex gap-4",children:[p,h]}),G[13]=p,G[14]=b):b=G[14],G[15]!==u||G[16]!==b?(f=(0,t.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[c,u,b]}),G[15]=u,G[16]=b,G[17]=f):f=G[17],G[18]!==J?(g=J("product"),G[18]=J,G[19]=g):g=G[19],G[20]!==g?(y=(0,t.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:g}),G[20]=g,G[21]=y):y=G[21],G[22]!==V?(v=i.map(e=>(0,t.jsx)("li",{children:V(e)},e.key)),G[22]=V,G[23]=v):v=G[23],G[24]!==v?(j=(0,t.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:v}),G[24]=v,G[25]=j):j=G[25],G[26]!==y||G[27]!==j?(k=(0,t.jsxs)("div",{children:[y,j]}),G[26]=y,G[27]=j,G[28]=k):k=G[28],G[29]!==J?(N=J("resources"),G[29]=J,G[30]=N):N=G[30],G[31]!==N?(w=(0,t.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:N}),G[31]=N,G[32]=w):w=G[32],G[33]!==V?(S=n.map(e=>(0,t.jsx)("li",{children:V(e)},e.key)),G[33]=V,G[34]=S):S=G[34],G[35]!==S?(_=(0,t.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:S}),G[35]=S,G[36]=_):_=G[36],G[37]!==w||G[38]!==_?(C=(0,t.jsxs)("div",{children:[w,_]}),G[37]=w,G[38]=_,G[39]=C):C=G[39],G[40]!==J?(T=J("company"),G[40]=J,G[41]=T):T=G[41],G[42]!==T?(E=(0,t.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:T}),G[42]=T,G[43]=E):E=G[43],G[44]!==V?(I=o.map(e=>(0,t.jsx)("li",{children:V(e)},e.key)),G[44]=V,G[45]=I):I=G[45],G[46]!==I?(D=(0,t.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:I}),G[46]=I,G[47]=D):D=G[47],G[48]!==E||G[49]!==D?(L=(0,t.jsxs)("div",{children:[E,D]}),G[48]=E,G[49]=D,G[50]=L):L=G[50],G[51]!==k||G[52]!==C||G[53]!==L||G[54]!==f?(A=(0,t.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 ga
1p-10 mb-12",children:[f,k,C,L]}),G[51]=k,G[52]=C,G[53]=L,G[54]=f,G[55]=A):A=G[55],G[56]!==J?(K=J("copyright",{year:new Date().getFullYear()}),G[56]=J,G[57]=K):K=G[57],G[58]!==K?(R=(0,t.jsx)("p",{className:"text-sm text-text-muted",children:K}),G[58]=K,G[59]=R):R=G[59],G[60]!==J?(F=J("documentation"),G[60]=J,G[61]=F):F=G[61],G[62]!==F?(O=(0,t.jsx)(a.default,{href:"/docs",className:"hover:text-primary transition-colors",children:F}),G[62]=F,G[63]=O):O=G[63],G[64]!==J?(M=J("terms"),G[64]=J,G[65]=M):M=G[65],G[66]!==M?(P=(0,t.jsx)(a.default,{href:"/terms",className:"hover:text-primary transition-colors",children:M}),G[66]=M,G[67]=P):P=G[67],G[68]!==J?($=J("privacy"),G[68]=J,G[69]=$):$=G[69],G[70]!==$?(B=(0,t.jsx)(a.default,{href:"/privacy",className:"hover:text-primary transition-colors",children:$}),G[70]=$,G[71]=B):B=G[71],G[72]!==J?(z=J("license"),G[72]=J,G[73]=z):z=G[73],G[74]!==z?(U=(0,t.jsx)("a",{href:"https://github.com/diegosouzapw/OmniRoute/blob/main/LICENSE",target:"_blank",rel:"noopener noreferrer",className:"hover:text-primary transition-colors",children:z}),G[74]=z,G[75]=U):U=G[75],G[76]!==O||G[77]!==P||G[78]!==B||G[79]!==U?(q=(0,t.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[O,P,B,U]}),G[76]=O,G[77]=P,G[78]=B,G[79]=U,G[80]=q):q=G[80],G[81]!==R||G[82]!==q?(H=(0,t.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[R,q]}),G[81]=R,G[82]=q,G[83]=H):H=G[83],G[84]!==A||G[85]!==H?(W=(0,t.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,t.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[A,H]})}),G[84]=A,G[85]=H,G[86]=W):W=G[86],W}])},6998,e=>{"use strict";var t=e.i(247167),r=e.i(843476),s=e.i(500932),a=e.i(271645),l=e.i(618566),i=e.i(897844),n=e.i(932993),o=e.i(31954),c=e.i(156221),d=e.i(393162),u=e.i(948148),m=e.i(928491),x=e.i(228688),p=e.i(914147),h=e.i(537698),b=e.i(241937),f=e.i(513859),g=e.i(70552);let y=()=>()=>{},v=()=>{if("u"<typeof navigator)return!1;let e=navigator.platform||navigator.userAgent;return/Mac|iPhone|iPad|iPod/.test(e)},j=()=>!1,k="1"===t.default.env.NEXT_PUBLIC_OMNIROUTE_E2E_MODE,N={home:"homeDescription",endpoints:"endpointDescription","api-manager":"apiManagerDescription",providers:"providerDescription",combos:"comboDescription",batch:"batchDescription",costs:"costsDescription",analytics:"analyticsDescription",cache:"cacheDescription",quota:"limitsDescription",runtime:"runtimeDescription",media:"mediaDescription","cli-code":"cliToolsDescription","cli-agents":"agentsDescription","acp-agents":"agentsDescription","cloud-agents":"cloudAgentsDescription",memory:"memoryDescription",skills:"skillsDescription","agent-skills":"agentSkillsDescription","omni-skills":"omniSkillsDescription",settings:"settingsDescription","context-caveman":"contextCavemanDescription","context-rtk":"contextRtkDescription","context-combos":"contextCombosDescription",translator:"translatorDescription",playground:"playgroundDescription","search-tools":"searchToolsDescription",logs:"logsDescription",audit:"auditDescription",webhooks:"webhooksDescription",health:"healthDescription",proxy:"proxyDescription",changelog:"changelogDescription",mcp:"mcpDescription",a2a:"a2aDescription","api-endpoints":"apiEndpointsDescription","batch-files":"batchFilesDescription","analytics-evals":"analyticsEvalsDescription","analytics-search":"analyticsSearchDescription","analytics-utilization":"analyticsUtilizationDescription","analytics-combo-health":"analyticsComboHealthDescription","analytics-compression":"analyticsCompressionDescription","costs-budget":"costsBudgetDescription","costs-pricing":"costsPricingDescription","logs-proxy":"logsProxyDescription","logs-console":"logsConsoleDescription","logs-activity":"logsActivityDescription","audit-mcp":"auditMcpDescription","settings-general":"settingsGeneralDescription","settings-appearance":"settingsAppearanceDescription","settings-ai":"settingsAiDescription","settings-security":"settingsSecurityDescription","settings-routing":"settingsRoutingDescription","settings-resilience":"settingsResilienceDescription","settings-cache":"settingsCacheDescription","settings-advanced":"settingsAdvancedDescription","mitm-proxy":"mitmProxyDescription","1proxy":"oneProxyDescription"},w=new Map;for(let e of f.SIDEBAR_SECTIONS)for(let t of(0,b.getSectionItems)(e))t.external||w.set(t.href,t);e.s(["default",0,function(e){let t,b,f,S,_,C,T,E,I,D,L,A,K,R,F,O,M,P,$=(0,s.c)(43),{onMenuClick:B,onOpenCommandPalette:z,showMenuButton:U}=e,q=void 0===U||U,H=(0,a.useSyncExternalStore)(y,v,j),W=(0,l.usePathname)(),G=(0,l.useRouter)(),J=(0,g.useIsElectron)(),V=(0,u.useTranslations)("header"),{title:Y,description:X,icon:Q,providerId:Z}=function(e){let t,r,a,l=(0,s.c)(24),i=(0,u.useTranslations)("sidebar"),n=(0,u.useTranslations)("header");if(!e){let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e={title:"",description:""},l[0]=e):e=l[0],e}if(l[1]!==e||l[2]!==n){t=Symbol.for("react.early_return_sentinel");e:{let r=e.match(/\/providers\/([^/]+)$/);if(r){let e=r[1],s=x.OAUTH_PROVIDERS[e]||h.NOAUTH_PROVIDERS[e]||p.APIKEY_PROVIDERS[e];if(s){let e;l[4]!==s.id||l[5]!==s.name?(e={title:s.name,description:"",providerId:s.id},l[4]=s.id,l[5]=s.name,l[6]=e):e=l[6],t=e;break e}if(e.startsWith(m.CLAUDE_CODE_COMPATIBLE_PREFIX)){let e;l[7]===Symbol.for("react.memo_cache_sentinel")?(e={title:"CC Compatible",description:"",providerId:"claude"}
1,l[7]=e):e=l[7],t=e;break e}if(e.startsWith(m.OPENAI_COMPATIBLE_PREFIX)){let e,r;l[8]!==n?(e=n("openaiCompatible"),l[8]=n,l[9]=e):e=l[9],l[10]!==e?(r={title:e,description:"",providerId:"oai-cc"},l[10]=e,l[11]=r):r=l[11],t=r;break e}if(e.startsWith(m.ANTHROPIC_COMPATIBLE_PREFIX)){let e,r;l[12]!==n?(e=n("anthropicCompatible"),l[12]=n,l[13]=e):e=l[13],l[14]!==e?(r={title:e,description:"",providerId:"anthropic-m"},l[14]=e,l[15]=r):r=l[15],t=r;break e}}}l[1]=e,l[2]=n,l[3]=t}else t=l[3];if(t!==Symbol.for("react.early_return_sentinel"))return t;if(l[16]!==e||l[17]!==n||l[18]!==i){r=Symbol.for("react.early_return_sentinel");t:{let t=function(e){let t,r=w.get(e);if(r)return r;let s=0;for(let[r,a]of w)e.startsWith(r)&&r.length>s&&(t=a,s=r.length);return t}(e);if(t){let e,s=N[t.id];l[20]!==s||l[21]!==n?(e=s?n(s):"",l[20]=s,l[21]=n,l[22]=e):e=l[22],r={title:i(t.i18nKey),description:e,icon:t.icon};break t}}l[16]=e,l[17]=n,l[18]=i,l[19]=r}else r=l[19];return r!==Symbol.for("react.early_return_sentinel")?r:(l[23]===Symbol.for("react.memo_cache_sentinel")?(a={title:"",description:""},l[23]=a):a=l[23],a)}(W),ee=J&&window.electronAPI?.platform==="darwin";$[0]!==G?(t=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&(G.push("/login"),G.refresh())}catch(e){console.error("Failed to logout:",e)}},$[0]=G,$[1]=t):t=$[1];let et=t,er=ee?"calc(1rem + var(--desktop-safe-top))":"calc(1rem + var(--ios-safe-top, 0px))";return $[2]!==er?(b={paddingTop:er},$[2]=er,$[3]=b):b=$[3],$[4]!==B||$[5]!==q?(f=q&&(0,r.jsx)("button",{onClick:B,className:"text-text-main hover:text-primary transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"menu"})}),$[4]=B,$[5]=q,$[6]=f):f=$[6],$[7]!==f?(S=(0,r.jsx)("div",{className:"flex items-center gap-3 lg:hidden",children:f}),$[7]=f,$[8]=S):S=$[8],$[9]!==Q||$[10]!==Z?(_=(Q||Z)&&(0,r.jsx)("div",{className:"flex items-center justify-center size-9 rounded-lg bg-primary/10 shrink-0",children:Q?(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:Q}):Z&&(0,r.jsx)(d.default,{providerId:Z,size:22,type:"color"})}),$[9]=Q,$[10]=Z,$[11]=_):_=$[11],$[12]!==X||$[13]!==Y?(C=Y&&(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-text-main tracking-tight",children:Y}),X&&(0,r.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:X})]}),$[12]=X,$[13]=Y,$[14]=C):C=$[14],$[15]!==_||$[16]!==C?(T=(0,r.jsxs)("div",{className:"hidden lg:flex items-center gap-3",children:[_,C]}),$[15]=_,$[16]=C,$[17]=T):T=$[17],$[18]!==H||$[19]!==z||$[20]!==V?(E=z&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{type:"button",onClick:z,className:"hidden md:inline-flex items-center gap-2 px-2.5 py-1.5 rounded-lg border border-black/10 dark:border-white/10 bg-bg-subtle text-text-muted hover:text-text-main hover:bg-black/[0.04] dark:hover:bg-white/[0.04] transition-colors",title:V("quickNavigationTitle"),"aria-label":V("openQuickNavigation"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"search"}),(0,r.jsx)("span",{className:"text-xs",children:V("quickNavigation")}),(0,r.jsx)("kbd",{className:"hidden lg:inline-flex font-mono text-[10px] px-1 py-0.5 rounded bg-black/5 dark:bg-white/5 border border-black/10 dark:border-white/10",children:H?"âK":"Ctrl+K"})]}),(0,r.jsx)("button",{type:"button",onClick:z,className:"md:hidden p-2 rounded-lg text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":V("openQuickNavigation"),children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"search"})})]}),$[18]=H,$[19]=z,$[20]=V,$[21]=E):E=$[21],$[22]===Symbol.for("react.memo_cache_sentinel")?(I=(0,r.jsx)(c.default,{}),D=(0,r.jsx)(i.default,{}),L=!k&&(0,r.jsx)(o.default,{}),A=!k&&(0,r.jsx)(n.default,{}),$[22]=I,$[23]=D,$[24]=L,$[25]=A):(I=$[22],D=$[23],L=$[24],A=$[25]),$[26]!==V?(K=V("logout"),$[26]=V,$[27]=K):K=$[27],$[28]!==V?(R=V("logout"),$[28]=V,$[29]=R):R=$[29],$[30]===Symbol.for("react.memo_cache_sentinel")?(F=(0,r.jsx)("span",{className:"material-symbols-outlined",children:"logout"}),$[30]=F):F=$[30],$[31]!==et||$[32]!==K||$[33]!==R?(O=(0,r.jsx)("button",{onClick:et,className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-red-500 hover:bg-red-500/10 transition-all",title:K,"aria-label":R,children:F}),$[31]=et,$[32]=K,$[33]=R,$[34]=O):O=$[34],$[35]!==E||$[36]!==O?(M=(0,r.jsxs)("div",{className:"flex items-center gap-3 ml-auto",children:[E,I,D,L,A,O]}),$[35]=E,$[36]=O,$[37]=M):M=$[37],$[38]!==M||$[39]!==b||$[40]!==S||$[41]!==T?(P=(0,r.jsxs)("header",{className:"sticky top-0 z-10 flex items-center justify-between border-b border-black/5 bg-bg px-8 py-4 dark:border-white/5",style:b,children:[S,T,M]}),$[38]=M,$[39]=b,$[40]=S,$[41]=T,$[42]=P):P=$[42],P}])},840387,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(156132);e.s(["default",0,function(e){let a,l,i,n,o,c=(0,r.c)(11),{text:d,className:u}=e;return c[0]!==u?(a=(0,s.cn)("relative inline-flex group",u),c[0]=u,c[1]=a):a=c[1],c[2]!==d?(l=(0,t.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted cursor-help","aria-label":d,children:"info"}),c[2]=d,c[3]=l):l=c[3],c[4]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.cn)("absolute bottom-full left-1/2 -translate-x-1/2 mb-2","px-2.5 py-1.5 text-xs font-medium text-white bg-gray-900/95 rounded-md shadow-lg","whitespace-nowrap pointer-events-none","border border-white/10","opacity-0 group-hover:opacity-100 transition-opacity duration-150","z-50"),c[4]=i):i=c[4],c[5]!==d?(n=(0,t.jsx)("span",{role:"tooltip",className:i,children:d}),c[5]=d,c[6]=n):n=c[6],c[7]!==a||c[8]!==l||c[9]!==n?(o=(0,t.jsxs)("span",{className:a,children:[l,n]}),c[7]=a,c[8]=l,c[9]=n,c[10]=o):o=c[10],o}])},621745,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(948148),a=e.i(703166),l=e.i(342923),i=e.i(80173);e.s(["default",0,function({isOpen:e,providerId:n="kiro",providerLabel:o="Kiro",onMethodSelect:c,onClose:d}){let u=(0,s.useTranslations)("kiroAuthModal"),[m,x]=(0,r.useState)(null),[p,h]=(0,r.useState)(""),[b,f]=(0,r.useState)("us-east-1"),[g,y]=(0,r.useState)(""),[v,j]=(0,r.useState)(""),[k,N]=(0,r.useState)("us-east-1"),[w,S]=(0,r.useState)(null),[_,C]=(0,r.useState)(!1),[T,E]=(0,r.useState)(!1),[I,D]=(0,r.useState)(!1),[L,A]=(0,r.useState)(e);e!==L&&(A(e),e||(x(null),h(""),f("us-east-1"),y(""),j(""),N("us-east-1"),S(null))),(0,r.useEffect)(()=>{"import"===m&&e&&(async()=>{D(!0),S(null);try{let e=await fetch(`/api/oauth/kiro/auto-import?targetProvider=${encodeURIComponent(n)}`),t=await e.json();
1if(t.found){c("import"),d();return}S(t.error||u("errorAutoDetect"))}catch(e){S(u("errorAutoDetectFailed"))}finally{D(!1)}})()},[n,m,e,c,d,u]);let K=e=>{x(e),S(null)},R=()=>{x(null),S(null)},F=async()=>{if(!g.trim())return void S(u("errorRefreshTokenRequired"));C(!0),S(null);try{let e=await fetch(`/api/oauth/kiro/import?targetProvider=${encodeURIComponent(n)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:g.trim()})}),t=await e.json();if(!e.ok)throw Error(t.error||u("errorImportFailed"));c("import"),d()}catch(e){S(e instanceof Error?e.message:u("errorImportFailed"))}finally{C(!1)}},O=async()=>{if(!v.trim())return void S(u("errorApiKeyRequired"));E(!0),S(null);try{let e=await fetch(`/api/oauth/kiro/api-key?targetProvider=${encodeURIComponent(n)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:v.trim(),region:k.trim()||"us-east-1"})}),t=await e.json();if(!e.ok)throw Error(t.error?.message||t.error||u("errorApiKeyImportFailed"));c("api-key"),d()}catch(e){S(e instanceof Error?e.message:u("errorApiKeyImportFailed"))}finally{E(!1)}},M=e=>{c("social",{provider:e})};return(0,t.jsx)(a.default,{isOpen:e,title:u("title",{providerLabel:o}),onClose:d,size:"lg",children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[!m&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm text-text-muted mb-4",children:u("chooseMethod")}),(0,t.jsx)("button",{onClick:()=>c("builder-id"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"shield"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h3",{className:"font-semibold mb-1",children:u("builderId")}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:u("builderDescription",{providerLabel:o})})]})]})}),(0,t.jsx)("button",{onClick:()=>K("idc"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"business"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h3",{className:"font-semibold mb-1",children:u("organization")}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:u("organizationDescription",{url:"https://your-org.awsapps.com/start"})})]})]})}),(0,t.jsx)("button",{onClick:()=>M("google"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"account_circle"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h3",{className:"font-semibold mb-1",children:u("googleAccount")}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:u("googleDescription")})]})]})}),(0,t.jsx)("button",{onClick:()=>M("github"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"code"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h3",{className:"font-semibold mb-1",children:u("githubAccount")}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:u("githubDescription")})]})]})}),(0,t.jsx)("button",{onClick:()=>K("import"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"file_upload"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h3",{className:"font-semibold mb-1",children:u("importToken")}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:u("importDescription",{providerLabel:o})})]})]})}),(0,t.jsx)("button",{onClick:()=>K("api-key"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"key"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h3",{className:"font-semibold mb-1",children:u("apiKey")}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:u("apiKeyDescription",{providerLabel:o})})]})]})})]}),"idc"===m&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:[u("idcStartUrl")," ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)(i.default,{value:p,onChange:e=>h(e.target.value),placeholder:u("idcStartUrlPlaceholder"),className:"font-mono text-sm"}),(0,t.jsx)("p",{className:"text-xs text-text-muted mt-1",children:u("idcStartUrlDescription")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium mb-2",children:u("awsReg
1ion")}),(0,t.jsx)(i.default,{value:b,onChange:e=>f(e.target.value),placeholder:u("regionPlaceholder"),className:"font-mono text-sm"}),(0,t.jsx)("p",{className:"text-xs text-text-muted mt-1",children:u("idcRegionDescription")})]}),w&&(0,t.jsx)("p",{className:"text-sm text-red-600",children:w}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(l.default,{onClick:()=>{p.trim()?c("idc",{startUrl:p.trim(),region:b}):S(u("errorIdcStartUrlRequired"))},fullWidth:!0,children:u("continue")}),(0,t.jsx)(l.default,{onClick:R,variant:"ghost",fullWidth:!0,children:u("back")})]})]}),"import"===m&&(0,t.jsxs)("div",{className:"space-y-4",children:[I&&(0,t.jsxs)("div",{className:"text-center py-6",children:[(0,t.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,t.jsx)("h3",{className:"text-lg font-semibold mb-2",children:u("autoDetecting")}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:u("readingCredentials",{providerLabel:o})})]}),!I&&(0,t.jsxs)(t.Fragment,{children:[!w&&(0,t.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,t.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:u("tokenNotDetected",{providerLabel:o})})]})}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:[u("refreshToken")," ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)(i.default,{type:"password",value:g,onChange:e=>y(e.target.value),placeholder:u("tokenPlaceholder"),className:"font-mono text-sm"})]}),w&&(0,t.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,t.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:w})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(l.default,{onClick:F,fullWidth:!0,disabled:_||!g.trim(),children:_?u("importing"):u("importToken")}),(0,t.jsx)(l.default,{onClick:R,variant:"ghost",fullWidth:!0,children:u("back")})]})]})]}),"api-key"===m&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:[u("apiKey")," ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)(i.default,{type:"password",value:v,onChange:e=>j(e.target.value),placeholder:u("apiKeyPlaceholder",{providerLabel:o}),className:"font-mono text-sm"}),(0,t.jsx)("p",{className:"text-xs text-text-muted mt-1",children:u("apiKeyStoredDescription")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium mb-2",children:u("awsRegion")}),(0,t.jsx)(i.default,{value:k,onChange:e=>N(e.target.value),placeholder:u("regionPlaceholder"),className:"font-mono text-sm"}),(0,t.jsx)("p",{className:"text-xs text-text-muted mt-1",children:u("apiKeyRegionDescription")})]}),w&&(0,t.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,t.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:w})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(l.default,{onClick:O,fullWidth:!0,disabled:T||!v.trim(),children:T?u("validating"):u("validateAndSaveApiKey")}),(0,t.jsx)(l.default,{onClick:R,variant:"ghost",fullWidth:!0,children:u("back")})]})]})]})})}])},567955,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(271645),a=e.i(964039),l=e.i(621745),i=e.i(17517);e.s(["default",0,function(e){let n,o,c,d,u=(0,r.c)(26),{isOpen:m,providerInfo:x,onSuccess:p,onClose:h,reauthConnection:b}=e,[f,g]=(0,s.useState)(null),[y,v]=(0,s.useState)(null),[j,k]=(0,s.useState)(null);u[0]!==p?(n=(e,t)=>{"builder-id"===e?g("builder-id"):"idc"===e?(g("idc"),k(t)):"social"===e?(g
1("social"),v(t.provider)):"import"===e?p?.():"api-key"===e&&p?.()},u[0]=p,u[1]=n):n=u[1];let N=n;u[2]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{g(null),v(null),k(null)},u[2]=o):o=u[2];let w=o;u[3]!==p?(c=()=>{g(null),v(null),p?.()},u[3]=p,u[4]=c):c=u[4];let S=c;u[5]!==p?(d=()=>{g(null),k(null),p?.()},u[5]=p,u[6]=d):d=u[6];let _=d,C=x?.id||"kiro",T=x?.name||"Kiro";if(!f){let e;return u[7]!==N||u[8]!==m||u[9]!==C||u[10]!==h||u[11]!==T?(e=(0,t.jsx)(l.default,{isOpen:m,providerId:C,providerLabel:T,onMethodSelect:N,onClose:h}),u[7]=N,u[8]=m,u[9]=C,u[10]=h,u[11]=T,u[12]=e):e=u[12],e}if("builder-id"===f||"idc"===f){let e;return u[13]!==_||u[14]!==j||u[15]!==m||u[16]!==C||u[17]!==x||u[18]!==b?(e=(0,t.jsx)(a.default,{isOpen:m,provider:C,providerInfo:x,onSuccess:_,reauthConnection:b,onClose:w,idcConfig:j}),u[13]=_,u[14]=j,u[15]=m,u[16]=C,u[17]=x,u[18]=b,u[19]=e):e=u[19],e}if("social"===f&&y){let e;return u[20]!==S||u[21]!==m||u[22]!==C||u[23]!==T||u[24]!==y?(e=(0,t.jsx)(i.default,{isOpen:m,provider:y,targetProvider:C,providerLabel:T,onSuccess:S,onClose:w}),u[20]=S,u[21]=m,u[22]=C,u[23]=T,u[24]=y,u[25]=e):e=u[25],e}return null}])},17517,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(948148),a=e.i(703166),l=e.i(342923),i=e.i(950914),n=e.i(866213);e.s(["default",0,function({isOpen:e,provider:o,targetProvider:c,providerLabel:d="Kiro",onSuccess:u,onClose:m}){let x=(0,s.useTranslations)("kiroSocialOAuthModal"),[p,h]=(0,r.useState)("loading"),[b,f]=(0,r.useState)(null),[g,y]=(0,r.useState)(""),[v,j]=(0,r.useState)(""),k=(0,r.useRef)(null),N=(0,r.useRef)(u);(0,r.useEffect)(()=>{N.current=u},[u]),(0,r.useEffect)(()=>{if(!e||!o)return;let t=!1,r=()=>{k.current&&clearTimeout(k.current),k.current=null},s=e=>{r(),t||(f(e),h("error"))};return(async()=>{try{f(null),h("loading");let e=await fetch(`/api/oauth/kiro/social-authorize?provider=${o}`),a=await e.json();if(t)return;if(!e.ok)throw Error((0,n.errorMessageFromBody)(a,x("errorStartAuthorization")));y(a.userCode||""),j(a.authUrl||""),h("polling");let l=1e3*Math.max(1,Number(a.interval)||5),i=l,d=Date.now()+1e3*Math.max(1,Number(a.expiresIn)||300),u=e=>{t||(k.current=setTimeout(m,e))},m=async()=>{if(k.current=null,!t){if(Date.now()>=d)return void s(x("errorAuthorizationExpired"));try{var e,l;let d=await fetch("/api/oauth/kiro/social-exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:a.deviceCode,provider:o,targetProvider:c})}),m=await d.json();if(t)return;if(m.success){r(),h("success"),N.current?.();return}if(!m.pending)return void s((0,n.errorMessageFromBody)(m,x("errorAuthorizationFailed")));e=i,l=m.error,i="slow_down"===l?e+5e3:e,u(i)}catch{u(i)}}};u(l)}catch(e){s(e.message)}})(),()=>{t=!0,r()}},[e,o,c,x]);let w=()=>{k.current&&(clearTimeout(k.current),k.current=null),m()},S="google"===o?"Google":"GitHub";return(0,t.jsx)(a.default,{isOpen:e,title:x("title",{providerLabel:d,providerName:S}),onClose:w,size:"lg",children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:["loading"===p&&(0,t.jsxs)("div",{className:"text-center py-6",children:[(0,t.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,t.jsx)("h3",{className:"text-lg font-semibold mb-2",children:x("initializing")}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:x("settingUp",{providerName:S})})]}),"polling"===p&&(0,t.jsxs)("div",{className:"text-center py-6",children:[(0,t.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-pulse",children:"open_in_browser"})}),(0,t.jsx)("h3",{className:"text-lg font-semibold mb-2",children:x("openIncognito")}),(0,t.jsx)("p",{className:"text-sm text-text-muted mb-3",children:x("incognitoDescription")}),v&&(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,t.jsx)("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-mono text-primary underline break-all max-w-md inline-block",children:v.length>80?v.slice(0,80)+"...":v}),(0,t.jsx)("button",{onClick:()=>(0,i.copyToClipboard)(v),className:"shrink-0 p-1 rounded hover:bg-sidebar",title:x("copyLink"),children:(0,t.jsx)("span",{className:"material-symbols-outlined text-base",children:"content_copy"})})]})}),g&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("p",{className:"text-xs text-text-muted mb-1",children:x("verificationCode")}),(0,t.jsx)("p",{className:"font-mono text-2xl font-bold tracking-widest",children:g})]}),(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-base animate-spin",children:"progress_activity"}),x("waiting")]}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(l.default,{onClick:w,variant:"ghost",fullWidth:!0,children:x("cancel")})})]}),"success"===p&&(0,t.jsxs)("div",{className:"text-center py-6",children:[(0,t.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,t.jsx)("h3",{className:"text-lg font-semibold mb-2",children:x("successTitle")}),(0,t.jsx)("p",{className:"text-sm text-text-muted mb-4",children:x("successMessage",{providerLabel:d,providerName:S})}),(0,t.jsx)(l.default,{onClick:w,fullWidth:!0,children:x("done")})]}),"error"===p&&(0,t.jsxs)("div",{className:"text-center py-6",children:[(0,t.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,t.jsx)("h3",{className:"text-lg font-semibold mb-2",children:x("errorTitle")}),(0,t.jsx)("p",{className:"text-sm text-red-600 mb-4",children:b}),(0,t.jsx)("div",{className:"flex gap-2",children:(0,t.jsx)(l.default,{onClick:w,variant:"ghost",fullWidth:!0,children:x("close")})})]})]})})}],17517)},193464,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(271645),a=e.i(948148),l=e.i(703166),i=e.i(342923),n=e.i(556938);e.s(["default",0,function(e){let o,c,d,u,m,x,p=(0,r.c)(23),{isOpen:h,onClose:b,title:f,configs:g}=e;p[0]!==g?(o=void 0===g?[]:g,p[0]=g,p[1]=o):o=p[1];let y=o,v=(0,a.useTranslations)("common");p[2]!==v||p[3]!==f?(c=f??v("manualConfig"),p[2]=v,p[3]=f,p[4]=c):c=p[4];
1let j=c,[k,N]=(0,s.useState)(null),{copy:w}=(0,n.useCopyToClipboard)();p[5]!==w?(d=async(e,t)=>{await w(e,`manualconfig-${t}`)&&(N(t),setTimeout(()=>N(null),2e3))},p[5]=w,p[6]=d):d=p[6];let S=d;if(p[7]!==y||p[8]!==k||p[9]!==S||p[10]!==v){let e;p[12]!==k||p[13]!==S||p[14]!==v?(e=(e,r)=>(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-text-main",children:e.filename}),(0,t.jsxs)(i.default,{variant:"ghost",size:"sm",onClick:()=>S(e.content,r),children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:k===r?"check":"content_copy"}),k===r?v("copied"):v("copy")]})]}),(0,t.jsx)("pre",{className:"px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs overflow-x-auto whitespace-pre-wrap break-all max-h-60 overflow-y-auto border border-border",children:e.content})]},r),p[12]=k,p[13]=S,p[14]=v,p[15]=e):e=p[15],u=y.map(e),p[7]=y,p[8]=k,p[9]=S,p[10]=v,p[11]=u}else u=p[11];return p[16]!==u?(m=(0,t.jsx)("div",{className:"flex flex-col gap-4",children:u}),p[16]=u,p[17]=m):m=p[17],p[18]!==h||p[19]!==b||p[20]!==j||p[21]!==m?(x=(0,t.jsx)(l.default,{isOpen:h,onClose:b,title:j,size:"xl",children:m}),p[18]=h,p[19]=b,p[20]=j,p[21]=m,p[22]=x):x=p[22],x}])},524578,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(948148),a=e.i(393718),l=e.i(342923),i=e.i(247854),n=e.i(109290);let o=[{value:"http",label:"HTTP"},{value:"https",label:"HTTPS"},{value:"socks5",label:"SOCKS5"}];function c(e,t){return e.find(e=>e.fingerprint===t)??null}function d(e,t){if(!e)return null;if(e.proxyId){let r=t.find(t=>t.id===e.proxyId);return r&&r.host?{type:r.type||"socks5",host:r.host,port:Number(r.port)||0}:null}return e.proxy??null}let u=new Set(["inactive","error","disabled","dead","down"]);function m(e){return!u.has(String(e.status??"").toLowerCase())}let x={"inherited-proxy":"inheritedProxy","inherited-pool":"inheritedPool","pool-empty":"poolEmptyBlocked",direct:"directEgress",own:"ownProxy"};function p(e){return x[e]}function h(e,t,r){if(0===e.length)return null;let s=e.map(e=>{var t;let s;return t=e.proxyId,(s=r.filter(m).find(e=>e.id===t))&&s.host?{type:s.type||"socks5",host:s.host,port:Number(s.port)||0}:null}).filter(e=>null!==e);return 0===s.length?{kind:"pool-empty"}:1===s.length?{kind:"inherited-proxy",proxy:s[0],scope:t}:{kind:"inherited-pool",scope:t,count:s.length}}function b(e){return String(e.scope||"").toLowerCase()}function f(e,t,r){return void 0===r?[]:e.filter(e=>t.includes(b(e))&&(null===r||e.scopeId===r))}function g(e,t,r,s){return null===t?r?"title"===s?`Proxy: ${r.type}://${r.host}:${r.port}`:e("proxyConfigured",{host:r.host}):e("configureProxy"):"own"===t.kind&&t.proxy?"title"===s?`Proxy: ${t.proxy.type}://${t.proxy.host}:${t.proxy.port}`:e("proxyConfigured",{host:t.proxy.host}):"inherited-proxy"===t.kind&&t.proxy?e(p(t.kind),{host:t.proxy.host}):"inherited-pool"===t.kind?e(p(t.kind),{count:t.count??0}):e(p(t.kind))}function y(e,t,r,s){if(!1===t.proxyEnabled)return{kind:"direct"};if(null===s)return null;let a=f(s,["account","key"],t.connectionId),l=h(a,"account",r);if(l&&"pool-empty"!==l.kind)return l;let i=d(e,r);if(i)return{kind:"own",proxy:i};if(e?.proxyId||a.length>0)return{kind:"pool-empty"};let n=h(f(s,["provider"],t.provider),"provider",r);if(n)return n;let o=h(f(s,["global"],null),"global",r);return o||(s.some(e=>"combo"===b(e))?null:{kind:"direct"})}e.s(["default",0,function({providerId:e,providerName:u,generateAccountId:m,generateApiKey:x,dataKey:p="fingerprints",description:h,addLabel:b,enabled:f=!0,savingEnabled:v=!1,onEnabledChange:j,providerProxyControl:k,onManualApiKeyAdd:N}){let w=(0,s.useTranslations)("noAuthProvider"),S=h||w("accountDescription"),_=b||w("addAccount"),[C,T]=(0,r.useState)([]),[E,I]=(0,r.useState)(!0),[D,L]=(0,r.useState)(!1),[A,K]=(0,r.useState)(null),[R,F]=(0,r.useState)("saved"),[O,M]=(0,r.useState)([]),[P,$]=(0,r.useState)(""),[B,z]=(0,r.useState)("socks5"),[U,q]=(0,r.useState)(""),[H,W]=(0,r.useState)("1080"),[G,J]=(0,r.useState)(""),[V,Y]=(0,r.useState)(""),[X,Q]=(0,r.useState)(!1),[Z,ee]=(0,r.useState)(""),[et,er]=(0,r.useState)(!1),[es,ea]=(0,r.useState)(!1),[el,ei]=(0,r.useState)({}),en=(0,r.useRef)(new Set),[eo,ec]=(0,r.useState)(null),ed=(0,r.useRef)(null),eu=(0,r.useCallback)(async()=>{try{let t=await fetch("/api/providers");if(t.ok){let r=((await t.json()).connections||[]).filter(t=>t.provider===e);T(r)}}catch(e){console.error("Failed to fetch connections:",e)}finally{I(!1)}},[e]),em=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/settings/proxies");if(e.ok){let t=await e.json();M(Array.isArray(t?.items)?t.items:[])}}catch(e){console.error("Failed to fetch saved proxies:",e)}},[]),ex=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/settings/proxies/assignments");if(e.ok){let t=await e.json(),r=Array.isArray(t?.items)?t.items:t;ec((Array.isArray(r)?r:[]).map(e=>({scope:String(e?.scope??""),scopeId:"string"==typeof e?.scopeId?e.scopeId:null,proxyId:"string"==typeof e?.proxyId?e.proxyId:""})))}}catch(e){console.error("Failed to fetch proxy assignments:",e)}},[]);(0,r.useEffect)(()=>{let e=window.setTimeout(()=>{eu(),em(),ex()},0);return()=>window.clearTimeout(e)},[eu,em,ex]),(0,r.useEffect)(()=>{let e=e=>
1{ed.current&&!ed.current.contains(e.target)&&K(null)};if(A)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[A]);let ep=(0,r.useCallback)(async e=>{if(!(!e||en.current.has(e))){en.current.add(e);try{let t=await fetch(`/api/admin/proxy-pool-visibility?proxyId=${encodeURIComponent(e)}`),r=await t.json().catch(()=>({})),s=Array.isArray(r?.members)?r.members[0]:null;ei(t=>void 0!==t[e]?t:{...t,[e]:s?.setAside?s.setAside.endsAt??"":null})}catch{ei(t=>void 0!==t[e]?t:{...t,[e]:null})}finally{en.current.delete(e)}}},[]),eh=(0,r.useMemo)(()=>C.flatMap(e=>e.providerSpecificData?.[p]||[]),[C,p]),eb=C[0],ef=(0,r.useMemo)(()=>eb?.providerSpecificData?.accountProxies||[],[eb]),eg=(0,r.useMemo)(()=>{let e=new Set;for(let t of eh){let r=c(ef,t)?.proxyId??null;r&&e.add(r)}return[...e].sort().join(",")},[eh,ef]);(0,r.useEffect)(()=>{if(0===eg.length)return;let e=eg.split(","),t=window.setTimeout(()=>{for(let t of e)ep(t)},0);return()=>window.clearTimeout(t)},[eg,ep]);let ey=async()=>{L(!0);try{let t=m(),r=x?await x():void 0;if(0===C.length){let s=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,name:w("accountName",{provider:u,number:1}),...r?{apiKey:r}:{},providerSpecificData:{[p]:[t]}})});if(!s.ok){let e=await s.json().catch(()=>({}));throw Error(e?.error||w("createConnectionFailed"))}}else{let e=[...eh,t],r=await fetch(`/api/providers/${eb.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerSpecificData:{[p]:e}})});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e?.error||w("updateConnectionFailed"))}}await eu()}catch(e){console.error("Failed to add account:",e)}finally{L(!1)}},ev=async()=>{if(Z.trim()){er(!0);try{N&&await N(Z.trim()),ee(""),ea(!1),await eu()}catch(e){console.error("Failed to add manual API key:",e)}finally{er(!1)}}},ej=async e=>{if(!eb)return;let t=eh.filter(t=>t!==e),r=ef.filter(t=>t.fingerprint!==e);try{(await fetch(`/api/providers/${eb.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerSpecificData:{[p]:t,accountProxies:r}})})).ok&&await eu()}catch(e){console.error("Failed to remove account:",e)}},ek=async()=>{if(eb&&A){Q(!0);try{let e=ef.filter(e=>e.fingerprint!==A),t=null;if("saved"===R)t=P?{fingerprint:A,proxyId:P}:null;else{let e=U.trim();t=e?{fingerprint:A,proxy:{type:B,host:e,port:Number(H)||1080,...G.trim()?{username:G.trim()}:{},...V.trim()?{password:V.trim()}:{}}}:null}let r=t?[...e,t]:e;(await fetch(`/api/providers/${eb.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerSpecificData:{accountProxies:r}})})).ok&&(await eu(),K(null))}catch(e){console.error("Failed to save proxy:",e)}finally{Q(!1)}}},eN=async()=>{if(!eb||0===eh.length)return;let e=await fetch("/api/settings/proxies");if(!e.ok)throw Error(w("fetchProxiesFailed"));let t=await e.json(),r=(t?.items||[]).filter(e=>"active"===e.status);if(0===r.length)throw Error(w("noSavedProxiesError"));let s=eh.map((e,t)=>({fingerprint:e,proxyId:r[t%r.length].id})),a=await fetch(`/api/providers/${eb.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerSpecificData:{accountProxies:s}})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e?.error||w("updateConnectionFailed"))}await eu()};return(0,t.jsxs)(a.default,{children:[(0,t.jsxs)("div",{className:"mb-3 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,t.jsx)("div",{className:"inline-flex shrink-0 items-center justify-center w-10 h-10 rounded-full bg-green-500/10 text-green-500",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"lock_open"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:w("title")}),(0,t.jsx)("p",{className:"text-xs text-text-muted",children:S})]})]}),(0,t.jsxs)("div",{className:"flex w-full flex-wrap items-center justify-end gap-2 sm:w-auto
1sm:flex-nowrap",children:[k,(0,t.jsx)(n.default,{className:"w-full justify-end sm:w-auto",enabled:f,saving:v,onEnabledChange:j})]})]}),(0,t.jsxs)("div",{className:"border-t border-border pt-3 mt-3",children:[(0,t.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:w("accounts",{count:E?"...":eh.length})}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[!E&&eh.length>0&&(0,t.jsx)(i.default,{onDistribute:eN,disabled:D||!f,size:"sm"}),(0,t.jsx)(l.default,{size:"sm",icon:"add",onClick:ey,disabled:D||!f,children:D?w("adding"):_}),es&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("input",{type:"password",value:Z,onChange:e=>ee(e.target.value),placeholder:"Paste API key...",className:"rounded-md border border-black/10 bg-bg px-2 py-1 text-xs dark:border-white/10",disabled:et||!f}),(0,t.jsx)(l.default,{size:"sm",icon:"add",onClick:ev,disabled:et||!Z.trim()||!f,children:et?w("adding"):w("add")}),(0,t.jsx)("button",{type:"button",onClick:()=>{ea(!1),ee("")},className:"rounded p-1 text-text-muted hover:bg-black/5 dark:hover:bg-white/5",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}),!es&&N&&(0,t.jsx)("button",{type:"button",onClick:()=>ea(!0),className:"rounded-md px-2 py-1 text-xs text-text-muted transition-colors hover:bg-black/5 hover:text-text-main dark:hover:bg-white/5",children:w("manualApiKey")})]})]}),!E&&0===eh.length&&(0,t.jsx)("p",{className:"text-xs text-text-muted py-2",children:w("autoGeneratedAccount",{addLabel:_})}),!E&&eh.length>0&&(0,t.jsx)("div",{"data-testid":"noauth-account-grid",className:"grid max-h-72 grid-cols-1 gap-1.5 overflow-y-auto pr-1 sm:grid-cols-2 lg:grid-cols-3",children:eh.map((r,s)=>{let a=c(ef,r),l=y(a,{provider:e,proxyEnabled:eb?.proxyEnabled,connectionId:eb?.id},O,eo),i=a?.proxyId??null,n=i?el[i]:null,o=l?.kind==="own"||l?.kind==="inherited-proxy"?l.proxy??null:d(a,O),u=null===l?null!==o:"own"===l.kind||"inherited-proxy"===l.kind||"inherited-pool"===l.kind,m=`${g(w,l,o,"title")}${n?` â ${w("proxySetAside")}`:""}`,x=g(w,l,o,"aria");return(0,t.jsxs)("div",{"data-account-id":r,className:"group flex items-center gap-2 rounded-lg border border-border bg-bg/40 px-2.5 py-2 transition-colors hover:bg-black/[0.03] dark:hover:bg-white/[0.03]",children:[(0,t.jsx)("span",{className:"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-bg text-[10px] font-medium text-text-muted",children:s+1}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-text-muted",children:[r.slice(0,10),"â¦"]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let e;return e=c(ef,r),void(z("socks5"),q(""),W("1080"),J(""),Y(""),$(""),e?.proxyId?(F("saved"),$(e.proxyId)):e?.proxy?.host?(F("custom"),z(e.proxy.type),q(e.proxy.host),W(String(e.proxy.port)),J(e.proxy.username||""),Y(e.proxy.password||"")):F(O.length>0?"saved":"custom"),K(r))},className:`inline-flex h-6 w-6 shrink-0 items-center justify-center rounded transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${u?"text-blue-400":l?.kind==="pool-empty"?"text-red-400":"text-text-muted"}`,title:m,"aria-label":x,children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[16px]",style:u?{fontVariationSettings:"'FILL' 1"}:void 0,children:"shield"})}),(0,t.jsx)("button",{type:"button",onClick:()=>ej(r),className:"shrink-0 rounded p-1 text-text-muted opacity-0 transition-colors hover:bg-red-500/10 hover:text-red-500 group-hover:opacity-100","aria-label":w("removeAccount"),children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"delete"})})]},r)})}),A&&(0,t.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",children:(0,t.jsxs)("div",{ref:ed,className:"w-80 max-w-full rounded-lg border border-black/10 bg-surface p-4 shadow-lg dark:border-white/10",children:[(0,t.jsx)("p",{className:"mb-3 text-sm font-medium",children:w("proxyForAccount",{number:eh.indexOf(A)+1})}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex gap-1 rounded-lg border border-border bg-bg-subtle p-1",children:[(0,t.jsx)("button",{type:"button",onClick:()=>F("saved"),className:`flex-1 rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${"saved"===R?"bg-primary text-white":"text-text-muted hover:text-text-main"}`,children:w("saved")}),(0,t.jsx)("button",{type:"button",onClick:()=>F("custom"),className:`flex-1 rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${"custom"===R?"bg-primary text-white":"text-text-muted hover:text-text-main"}`,children:w("custom")})]}),"saved"===R?(0,t.jsxs)("select",{value:P,onChange:e=>$(e.target.value),className:"w-full rounded-md border border-black/10 bg-bg px-2.5 py-1.5 text-xs dar
1k:border-white/10",children:[(0,t.jsx)("option",{value:"",children:0===O.length?w("noSavedProxies"):w("inheritConnectionOption")}),O.map(e=>(0,t.jsxs)("option",{value:e.id,children:[(e.name||e.host)??e.id," (",e.type||"socks5","://",e.host,":",e.port,")"]},e.id))]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("select",{value:B,onChange:e=>z(e.target.value),className:"flex-shrink-0 rounded-md border border-black/10 bg-bg px-2.5 py-1.5 text-xs dark:border-white/10",children:o.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,t.jsx)("input",{type:"text",value:U,onChange:e=>q(e.target.value),placeholder:w("host"),className:"flex-1 rounded-md border border-black/10 bg-bg px-2.5 py-1.5 text-xs dark:border-white/10"}),(0,t.jsx)("input",{type:"text",value:H,onChange:e=>W(e.target.value),placeholder:w("port"),className:"w-16 rounded-md border border-black/10 bg-bg px-2.5 py-1.5 text-xs dark:border-white/10"})]}),(0,t.jsx)("input",{type:"text",value:G,onChange:e=>J(e.target.value),placeholder:w("usernameOptional"),className:"w-full rounded-md border border-black/10 bg-bg px-2.5 py-1.5 text-xs dark:border-white/10"}),(0,t.jsx)("input",{type:"password",value:V,onChange:e=>Y(e.target.value),placeholder:w("passwordOptional"),className:"w-full rounded-md border border-black/10 bg-bg px-2.5 py-1.5 text-xs dark:border-white/10"})]}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,t.jsx)("button",{type:"button",onClick:()=>K(null),className:"rounded-md px-3 py-1.5 text-xs text-text-muted transition-colors hover:bg-black/5 hover:text-text-main dark:hover:bg-white/5",children:w("cancel")}),(0,t.jsx)("button",{type:"button",onClick:ek,disabled:X,className:"rounded-md bg-primary/10 px-3 py-1.5 text-xs text-primary transition-colors hover:bg-primary/20 disabled:opacity-50",children:X?w("saving"):w("save")})]})]})]})})]})]})},"getEffectiveEgress",0,y,"getEgressLabelKey",0,p])},915139,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(948148),a=e.i(393718),l=e.i(109290);e.s(["default",0,function(e){let i,n,o,c,d,u,m,x,p,h=(0,r.c)(22),{enabled:b,saving:f,onEnabledChange:g,providerProxyControl:y}=e,v=void 0===b||b,j=void 0!==f&&f,k=(0,s.useTranslations)("noAuthProvider");return h[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)("div",{className:"inline-flex shrink-0 items-center justify-center w-10 h-10 rounded-full bg-green-500/10 text-green-500",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"lock_open"})}),h[0]=i):i=h[0],h[1]!==k?(n=k("title"),h[1]=k,h[2]=n):n=h[2],h[3]!==n?(o=(0,t.jsx)("p",{className:"text-sm font-medium",children:n}),h[3]=n,h[4]=o):o=h[4],h[5]!==k?(c=k("description"),h[5]=k,h[6]=c):c=h[6],h[7]!==c?(d=(0,t.jsx)("p",{className:"text-xs text-text-muted",children:c}),h[7]=c,h[8]=d):d=h[8],h[9]!==o||h[10]!==d?(u=(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[i,(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[o,d]})]}),h[9]=o,h[10]=d,h[11]=u):u=h[11],h[12]!==v||h[13]!==g||h[14]!==j?(m=(0,t.jsx)(l.default,{className:"w-full justify-end sm:w-auto",enabled:v,saving:j,onEnabledChange:g}),h[12]=v,h[13]=g,h[14]=j,h[15]=m):m=h[15],h[16]!==y||h[17]!==m?(x=(0,t.jsxs)("div",{className:"flex w-full flex-wrap items-center justify-end gap-2 sm:w-auto sm:flex-nowrap",children:[y,m]}),h[16]=y,h[17]=m,h[18]=x):x=h[18],h[19]!==x||h[20]!==u?(p=(0,t.jsx)(a.default,{children:(0,t.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[u,x]})}),h[19]=x,h[20]=u,h[21]=p):p=h[21],p}])},109290,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(156132),a=e.i(948148),l=e.i(635055);e.s(["default",0,function(e){let i,n,o,c,d,u,m,x=(0,r.c)(23),{enabled:p,saving:h,onEnabledChange:b,className:f}=e,g=void 0!==h&&h,y=(0,a.useTranslations)("common");return b?(x[0]!==f?(i=(0,s.cn)("inline-flex items-center gap-2 rounded-md px-1 py-1",f),x[0]=f,x[1]=i):i=x[1],x[2]!==p||x[3]!==g||x[4]!==y?(n=y(g?"saving":p?"enabled":"disabled"),x[2]=p,x[3]=g,x[4]=y,x[5]=n):n=x[5],x[6]!==n?(o=(0,t.jsx)("span",{className:"text-sm font-medium text-text-main",children:n}),x[6]=n,x[7]=o):o=x[7],x[8]!==y?(c=y("toggleNoAuthProvider"),x[8]=y,x[9]=c):c=x[9],x[10]!==p||x[11]!==y?(d=y(p?"disableProvider":"enableProvider"),x[10]=p,x[11]=y,x[12]=d):d=x[12],x[13]!==p||x[14]!==b||x[15]!==g||x[16]!==c||x[17]!==d?(u=(0,t.jsx)(l.default,{size:"lg",checked:p,disabled:g,onChange:b,ariaLabel:c,title:d}),x[13]=p,x[14]=b,x[15]=g,x[16]=c,x[17]=d,x[18]=u):u=x[18],x[19]!==i||x[20]!==o||x[21]!==u?(m=(0,t.jsxs)("div",{className:i,children:[o,u]}),x[19]=i,x[20]=o,x[21]=u,x[22]=m):m=x[22],m):null}])},816062,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(627949),a=e.i(271645),l=e.i(948148);let i={success:"â",error:"â",warning:"â ",info:"â¹"};function n(e){if("string"==typeof e)return e;if(null==e)return"";if("object"==typeof e){let t=e.message;if("string"==typeof t)return t;try{return JSON.stringify(e)}catch{}}return String(e)}let o="rgba(30, 30, 30, 0.95)",c={success:{bg:o,border:"rgba(16, 185, 129, 0.6)",icon:"#10b981"},error:{bg:o,border:"rgba(239, 68, 68, 0.6)",icon:"#ef4444"},warning:{bg:o,border:"rgba(245, 158, 11, 0.6)",icon:"#fbbf24"},info:{bg:o,border:"rgba(59, 130, 246, 0.6)",icon:"#3b82f6"}};function d(e){let s,o,d,x,p,h,b,f,g,y,v,j,k,N=(0,r.c)(35),{notification:w,onDismiss:S}=e,_=(0,l.useTranslations)("common"),[C,T]=(0,a.useState)(!1);N[0]!==w.id||N[1]!==S?(s=()=>{T(!0),setTimeout(()=>S(w.id),200)},N[0]=w.id,N[1]=S,N[2]=s):s=N[2];let E=s,I=c[w.type]||c.info;N[3]===Symbol.for("react.memo_cache_sentinel")?(o={title:"var(--text-primary, #fff)",message:"var(--text-secondary, #ccc)"},N[3]=o):o=N[3];let D=o,L=w.onClick,A=`1px solid ${I.border}`,K=w.onClick?"pointer":"default",R=C?"toastOut 0.2s ease-in forwards":"toastIn 0.3s ease-out forwards";
1N[4]!==I.bg||N[5]!==A||N[6]!==K||N[7]!==R?(d={display:"flex",alignItems:"flex-start",gap:"12px",padding:"14px 16px",borderRadius:"10px",backgroundColor:I.bg,border:A,backdropFilter:"blur(12px)",boxShadow:"0 8px 32px rgba(0,0,0,0.2)",minWidth:"320px",maxWidth:"420px",cursor:K,animation:R,transition:"all 0.2s ease"},N[4]=I.bg,N[5]=A,N[6]=K,N[7]=R,N[8]=d):d=N[8],N[9]!==I.icon?(x={fontSize:"18px",color:I.icon,fontWeight:"bold",lineHeight:1,marginTop:"2px"},N[9]=I.icon,N[10]=x):x=N[10];let F=i[w.type];return N[11]!==x||N[12]!==F?(p=(0,t.jsx)("span",{style:x,children:F}),N[11]=x,N[12]=F,N[13]=p):p=N[13],N[14]===Symbol.for("react.memo_cache_sentinel")?(h={flex:1,minWidth:0},N[14]=h):h=N[14],N[15]!==w.title?(b=w.title&&(0,t.jsx)("div",{style:{fontWeight:600,fontSize:"14px",color:D.title,marginBottom:"2px"},children:n(w.title)}),N[15]=w.title,N[16]=b):b=N[16],N[17]===Symbol.for("react.memo_cache_sentinel")?(f={fontSize:"13px",color:D.message,lineHeight:1.4},N[17]=f):f=N[17],N[18]!==w.message?(g=n(w.message),N[18]=w.message,N[19]=g):g=N[19],N[20]!==g?(y=(0,t.jsx)("div",{style:f,children:g}),N[20]=g,N[21]=y):y=N[21],N[22]!==b||N[23]!==y?(v=(0,t.jsxs)("div",{style:h,children:[b,y]}),N[22]=b,N[23]=y,N[24]=v):v=N[24],N[25]!==E||N[26]!==w.dismissible||N[27]!==_?(j=w.dismissible&&(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),E()},"aria-label":_("dismissNotification"),style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-secondary, #999)",fontSize:"16px",padding:"0 2px",lineHeight:1,opacity:.6,transition:"opacity 0.15s"},onMouseEnter:m,onMouseLeave:u,children:"Ã"}),N[25]=E,N[26]=w.dismissible,N[27]=_,N[28]=j):j=N[28],N[29]!==w.onClick||N[30]!==p||N[31]!==v||N[32]!==j||N[33]!==d?(k=(0,t.jsxs)("div",{role:"alert","aria-live":"polite",onClick:L,style:d,children:[p,v,j]}),N[29]=w.onClick,N[30]=p,N[31]=v,N[32]=j,N[33]=d,N[34]=k):k=N[34],k}function u(e){return e.currentTarget.style.opacity="0.6"}function m(e){return e.currentTarget.style.opacity="1"}e.s(["default",0,function(){let e,a,l,i,n=(0,r.c)(9),{notifications:o,removeNotification:c}=(0,s.useNotificationStore)();if(0===o.length)return null;if(n[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("style",{children:"\n @keyframes toastIn {\n from { opacity: 0; transform: translateX(100%) scale(0.95); }\n to { opacity: 1; transform: translateX(0) scale(1); }\n }\n @keyframes toastOut {\n from { opacity: 1; transform: translateX(0) scale(1); }\n to { opacity: 0; transform: translateX(100%) scale(0.95); }\n }\n "}),n[0]=e):e=n[0],n[1]===Symbol.for("react.memo_cache_sentinel")?(a={position:"fixed",top:"20px",right:"20px",zIndex:9999,display:"flex",flexDirection:"column",gap:"10px",pointerEvents:"none"},n[1]=a):a=n[1],n[2]!==o||n[3]!==c){let e;n[5]!==c?(e=e=>(0,t.jsx)("div",{style:{pointerEvents:"auto"},children:(0,t.jsx)(d,{notification:e,onDismiss:c})},e.id),n[5]=c,n[6]=e):e=n[6],l=o.map(e),n[2]=o,n[3]=c,n[4]=l}else l=n[4];return n[7]!==l?(i=(0,t.jsxs)(t.Fragment,{children:[e,(0,t.jsx)("div",{"aria-live":"polite","aria-atomic":"false",style:a,children:l})]}),n[7]=l,n[8]=i):i=n[8],i},"toToastText",0,n])},964039,954609,e=>{"use strict";var t=e.i(247167),r=e.i(843476),s=e.i(271645),a=e.i(948148),l=e.i(703166),i=e.i(342923),n=e.i(80173),o=e.i(500932),c=e.i(556938);function d(e){let t=Math.max(0,Math.floor(e)),r=Math.floor(t/60);return`${r}:${String(t%60).padStart(2,"0")}`}function u(e){let t,s,l,n,u,m,x,p,h,b,f,g,y,v,j,k,N,w,S,_,C=(0,o.c)(54),{deviceData:T,verificationUrl:E,secondsRemaining:I,polling:D}=e,L=(0,a.useTranslations)("oauthModal"),{copied:A,copy:K}=(0,c.useCopyToClipboard)();C[0]!==L?(t=L("deviceCodeVisitUrl"),C[0]=L,C[1]=t):t=C[1],C[2]!==t?(s=(0,r.jsx)("p",{className:"text-sm text-text-muted mb-4",children:t}),C[2]=t,C[3]=s):s=C[3],C[4]!==L?(l=L("deviceCodeVerificationUrl"),C[4]=L,C[5]=l):l=C[5],C[6]!==l?(n=(0,r.jsx)("p",{className:"text-xs text-text-muted mb-1",children:l}),C[6]=l,C[7]=n):n=C[7],C[8]!==E?(u=(0,r.jsx)("a",{href:E,target:"_blank",rel:"noreferrer",className:"flex-1 text-sm break-all text-primary hover:underline",children:E}),C[8]=E,C[9]=u):u=C[9];let R="verify_url"===A?"check":"content_copy";C[10]!==K||C[11]!==E?(m=()=>K(E,"verify_url"),C[10]=K,C[11]=E,C[12]=m):m=C[12],C[13]!==R||C[14]!==m?(x=(0,r.jsx)(i.default,{size:"sm",variant:"ghost",icon:R,onClick:m}),C[13]=R,C[14]=m,C[15]=x):x=C[15],C[16]!==u||C[17]!==x?(p=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[u,x]}),C[16]=u,C[17]=x,C[18]=p):p=C[18],C[19]!==n||C[20]!==p?(h=(0,r.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[n,p]}),C[19]=n,C[20]=p,C[21]=h):h=C[21],C[22]!==L?(b=L("deviceCodeYourCode"),C[22]=L,C[23]=b):b=C[23],C[24]!==b?(f=(0,r.jsx)("p",{className:"text-xs text-text-muted mb-1",children:b}),C[24]=b,C[25]=f):f=C[25],C[26]!==T.user_code?(g=(0,r.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:T.user_code}),C[26]=T.user_code,C[27]=g):g=C[27];let F="user_code"===A?"check":"content_copy";return C[28]!==K||C[29]!==T.user_code?(y=()=>K(T.user_code,"user_code"),C[28]=K,C[29]=T.user_code,C[30]=y):y=C[30],C[31]!==F||C[32]!==y?(v=(0,r.jsx)(i.default,{size:"sm",variant:"ghost",icon:F,onClick:y}
1),C[31]=F,C[32]=y,C[33]=v):v=C[33],C[34]!==g||C[35]!==v?(j=(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[g,v]}),C[34]=g,C[35]=v,C[36]=j):j=C[36],C[37]!==I||C[38]!==L?(k=null!==I&&(0,r.jsxs)("div",{className:"mt-3 flex items-center justify-center gap-1 text-xs text-text-muted","aria-label":L("deviceCodeWaiting"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:"schedule"}),(0,r.jsx)("span",{children:d(I)})]}),C[37]=I,C[38]=L,C[39]=k):k=C[39],C[40]!==f||C[41]!==j||C[42]!==k?(N=(0,r.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[f,j,k]}),C[40]=f,C[41]=j,C[42]=k,C[43]=N):N=C[43],C[44]!==h||C[45]!==N||C[46]!==s?(w=(0,r.jsxs)("div",{className:"text-center py-4",children:[s,h,N]}),C[44]=h,C[45]=N,C[46]=s,C[47]=w):w=C[47],C[48]!==D||C[49]!==L?(S=D&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),L("deviceCodeWaiting")]}),C[48]=D,C[49]=L,C[50]=S):S=C[50],C[51]!==w||C[52]!==S?(_=(0,r.jsxs)(r.Fragment,{children:[w,S]}),C[51]=w,C[52]=S,C[53]=_):_=C[53],_}function m(e){let t,s,l,d,u,m,p,h,b,f,g,y,v,j,k,N,w,S,_,C,T,E,I,D,L,A,K,R,F,O,M,P=(0,o.c)(83),{providerName:$,hint:B,onManualInput:z,onClose:U}=e,q=(0,a.useTranslations)("oauthModal"),{copied:H,copy:W}=(0,c.useCopyToClipboard)();P[0]!==q?(t=q("loopbackMismatchStep1"),P[0]=q,P[1]=t):t=P[1];let G=B.tunnelCommand;P[2]!==q?(s=q("loopbackMismatchStep1Note",{userPlaceholder:"<user>"}),P[2]=q,P[3]=s):s=P[3],P[4]!==B.tunnelCommand||P[5]!==t||P[6]!==s?(l={key:"cmd",body:t,value:G,copyId:"tunnel_cmd",note:s},P[4]=B.tunnelCommand,P[5]=t,P[6]=s,P[7]=l):l=P[7],P[8]!==q?(d=q("loopbackMismatchStep2"),P[8]=q,P[9]=d):d=P[9],P[10]!==B.localDashboardUrl||P[11]!==d?(u={key:"url",body:d,value:B.localDashboardUrl,copyId:"local_url",note:null},P[10]=B.localDashboardUrl,P[11]=d,P[12]=u):u=P[12],P[13]!==$||P[14]!==q?(m=q("loopbackMismatchStep3",{providerName:$}),P[13]=$,P[14]=q,P[15]=m):m=P[15],P[16]!==m?(p={key:"retry",body:m,value:null,copyId:null,note:null},P[16]=m,P[17]=p):p=P[17],P[18]!==l||P[19]!==u||P[20]!==p?(h=[l,u,p],P[18]=l,P[19]=u,P[20]=p,P[21]=h):h=P[21];let J=h;return P[22]===Symbol.for("react.memo_cache_sentinel")?(b=(0,r.jsx)("div",{className:"size-10 shrink-0 rounded-full bg-amber-500/15 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-xl text-amber-500",children:"lan"})}),P[22]=b):b=P[22],P[23]!==q?(f=q("loopbackMismatchTitle"),P[23]=q,P[24]=f):f=P[24],P[25]!==f?(g=(0,r.jsx)("h3",{className:"text-base font-semibold",children:f}),P[25]=f,P[26]=g):g=P[26],P[27]!==B.dashboardHost||P[28]!==B.dashboardPort?(y=(0,r.jsxs)("p",{className:"text-xs text-text-muted mt-0.5 font-mono",children:[B.dashboardHost,":",B.dashboardPort]}),P[27]=B.dashboardHost,P[28]=B.dashboardPort,P[29]=y):y=P[29],P[30]!==g||P[31]!==y?(v=(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[b,(0,r.jsxs)("div",{children:[g,y]})]}),P[30]=g,P[31]=y,P[32]=v):v=P[32],P[33]!==q?(j=q("loopbackMismatchWhatHappened"),P[33]=q,P[34]=j):j=P[34],P[35]!==j?(k=(0,r.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-amber-500 mb-1",children:j}),P[35]=j,P[36]=k):k=P[36],P[37]!==B.redirectUri||P[38]!==$||P[39]!==q?(N=q.rich("loopbackMismatchExplanation",{providerName:$,redirectUri:B.redirectUri,code:x}),P[37]=B.redirectUri,P[38]=$,P[39]=q,P[40]=N):N=P[40],P[41]!==N?(w=(0,r.jsx)("p",{className:"text-sm text-text-muted",children:N}),P[41]=N,P[42]=w):w=P[42],P[43]!==k||P[44]!==w?(S=(0,r.jsxs)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 p-3",children:[k,w]}),P[43]=k,P[44]=w,P[45]=S):S=P[45],P[46]!==q?(_=q("loopbackMismatchHowToFix"),P[46]=q,P[47]=_):_=P[47],P[48]!==_?(C=(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:_}),P[48]=_,P[49]=C):C=P[49],P[50]!==H||P[51]!==W||P[52]!==J||P[53]!==q?(T=(0,r.jsx)("ol",{className:"space-y-3",children:J.map((e,t)=>(0,r.jsxs)("li",{className:"flex gap-3",children:[(0,r.jsx)("span",{className:"size-5 shrink-0 mt-0.5 rounded-full bg-primary/15 text-primary text-xs font-semibold flex items-center justify-center",children:t+1}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-sm",children:e.body}),e.value&&(0,r.jsxs)("div",{className:"flex gap-2 mt-1.5",children:[(0,r.jsx)(n.default,{value:e.value,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,r.jsx)(i.default,{variant:"secondary",icon:H===e.copyId?"check":"content_copy",onClick:()=>W(e.value,e.copyId),children:q("copy")})]}),e.note&&(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:e.note})]})]},e.key))}),P[50]=H,P[51]=W,P[52]=J,P[53]=q,P[54]=T):T=P[54],P[55]!==C||P[56]!==T?(E=(0,r.jsxs)("div",{children:[C,T]}),P[55]=C,P[56]=T,P[57]=E):E=P[57],P[58]!==q?(I=q("loopbackMismatchAlternative"),P[58]=q,P[59]=I):I=P[59],P[60]!==I?(D=(0,r.jsx)("p",{className:"text-xs text-text-muted",children:I}),P[60]=I,P[61]=D):D=P[61],P[62]!==v||P[63]!==S||P[64]!==E||P[65]!==D?(L=(0,r.jsxs)("div",{className:"space-y-4",children:[v,S,E,D]}),P[62]=v,P[63]=S,P[64]=E,P[65]=D,P[66]=L):L=P[66],P[67]!==q?(A=q("popupBlocked"),P[67]=q,P[68]=A):A=P[68],P[69]!==z||P[70]!==A?(K=(0,r.jsx)(i.default,{onClick:z,fullWidth:!0,children:A}),P[69]=z,P[70]=A,P[71]=K):K=P[71],P[72]!==q?(R=q("cancel"),P[72]=q,P[73]=R):R=P[73],P[74]!==U||P[75]!==R?(F=(0,r.jsx)(i.default,{onClick:U,variant:"secondary",fullWidth:!0,children:R}),P[74]=U,P[75]=R,P[76]=F):F=P[76],P[77]!==K||P[78]!==F?(O=(0,r.jsxs)("div",{className:"flex gap-2",children:[K,F]}),P[77]=K,P[78]=F,P[79]=O):O=P[79],P[80]!==L||P[81]!==O?(M=(0,r.jsxs)(r.Fragment,{children:[L,O]}),P[80]=L,P[81]=O,P[82]=M):M=P[82],M}function x(e){return(0,r.jsx)("code",{className:"font-mono text-xs",children:e})}function p(e){let t,s,l,d,u,m,x,p,f,g,y,v,j,k,N,w,S,_=(0,o.c)(45),{hint:C}=e,T=(0,a.useTranslations)("oauthModal"),{copied:E,copy:I}=(0,c.useCopyToClipboard)();_[0]!==E||_[1]!==I?(t=(e,t)=>
1(0,r.jsxs)("div",{className:"flex gap-2 mt-1.5",children:[(0,r.jsx)(n.default,{value:e,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,r.jsx)(i.default,{size:"sm",variant:"secondary",icon:E===t?"check":"content_copy",onClick:()=>I(e,t)})]}),_[0]=E,_[1]=I,_[2]=t):t=_[2];let D=t;return _[3]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)("span",{className:"material-symbols-outlined text-sm align-middle mr-1",children:"warning"}),_[3]=s):s=_[3],_[4]!==T?(l=T("googleLoopbackTitle"),_[4]=T,_[5]=l):l=_[5],_[6]!==l?(d=(0,r.jsxs)("p",{className:"text-sm font-semibold text-amber-500",children:[s,l]}),_[6]=l,_[7]=d):d=_[7],_[8]!==C.redirectUri||_[9]!==T?(u=T.rich("googleLoopbackWhatHappens",{redirectUri:C.redirectUri,code:b}),_[8]=C.redirectUri,_[9]=T,_[10]=u):u=_[10],_[11]!==u?(m=(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:u}),_[11]=u,_[12]=m):m=_[12],_[13]!==d||_[14]!==m?(x=(0,r.jsxs)("div",{children:[d,m]}),_[13]=d,_[14]=m,_[15]=x):x=_[15],_[16]!==D||_[17]!==C.helperCommand||_[18]!==T?(p=C.helperCommand&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs font-medium",children:T("googleLoopbackRecommended")}),D(C.helperCommand,"google_helper"),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:T("googleLoopbackHelperNote")})]}),_[16]=D,_[17]=C.helperCommand,_[18]=T,_[19]=p):p=_[19],_[20]!==T?(f=T("googleLoopbackTunnelLabel"),_[20]=T,_[21]=f):f=_[21],_[22]!==f?(g=(0,r.jsx)("p",{className:"text-xs font-medium",children:f}),_[22]=f,_[23]=g):g=_[23],_[24]!==D||_[25]!==C.tunnelCommand?(y=D(C.tunnelCommand,"google_tunnel"),_[24]=D,_[25]=C.tunnelCommand,_[26]=y):y=_[26],_[27]!==C.localDashboardUrl||_[28]!==T?(v=T("googleLoopbackTunnelNote",{userPlaceholder:"<user>",localUrl:C.localDashboardUrl}),_[27]=C.localDashboardUrl,_[28]=T,_[29]=v):v=_[29],_[30]!==v?(j=(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:v}),_[30]=v,_[31]=j):j=_[31],_[32]!==g||_[33]!==y||_[34]!==j?(k=(0,r.jsxs)("div",{children:[g,y,j]}),_[32]=g,_[33]=y,_[34]=j,_[35]=k):k=_[35],_[36]!==T?(N=T.rich("googleLoopbackHeadlessAlt",{a:h}),_[36]=T,_[37]=N):N=_[37],_[38]!==N?(w=(0,r.jsx)("p",{className:"text-xs text-text-muted",children:N}),_[38]=N,_[39]=w):w=_[39],_[40]!==k||_[41]!==w||_[42]!==x||_[43]!==p?(S=(0,r.jsxs)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 space-y-3",children:[x,p,k,w]}),_[40]=k,_[41]=w,_[42]=x,_[43]=p,_[44]=S):S=_[44],S}function h(e){return(0,r.jsx)("a",{href:"https://github.com/diegosouzapw/OmniRoute#oauth-on-a-remote-server",target:"_blank",rel:"noreferrer",className:"underline",children:e})}function b(e){return(0,r.jsx)("code",{className:"font-mono",children:e})}function f(e){let t,s,l,i=(0,o.c)(7),{isGoogleOAuth:n,isTrueLocalhost:c,googleHint:d}=e,u=(0,a.useTranslations)("oauthModal");if(c)return null;if(n&&d){let e;return i[0]!==d?(e=(0,r.jsx)(p,{hint:d}),i[0]=d,i[1]=e):e=i[1],e}return i[2]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("span",{className:"material-symbols-outlined text-sm align-middle mr-1",children:"info"}),i[2]=t):t=i[2],i[3]!==u?(s=u("remoteAccessInfo"),i[3]=u,i[4]=s):s=i[4],i[5]!==s?(l=(0,r.jsxs)("div",{className:"rounded-lg border border-blue-500/30 bg-blue-500/10 p-3 text-xs text-blue-200",children:[t,s]}),i[5]=s,i[6]=l):l=i[6],l}function g(e){let t,s,l,d,u,m,x,p,h,b,g,v,j,k,N,w,S,_,C,T,E,I,D,L,A=(0,o.c)(67),{provider:K,isGoogleOAuth:R,isTrueLocalhost:F,googleHint:O,authUrl:M,callbackUrl:P,placeholderUrl:$,canSubmit:B,onCallbackUrlChange:z,onSubmit:U,onClose:q}=e,H=(0,a.useTranslations)("oauthModal"),{copied:W,copy:G}=(0,c.useCopyToClipboard)();A[0]!==O||A[1]!==R||A[2]!==F?(t=(0,r.jsx)(f,{isGoogleOAuth:R,isTrueLocalhost:F,googleHint:O}),A[0]=O,A[1]=R,A[2]=F,A[3]=t):t=A[3],A[4]!==H?(s=H("step1OpenUrl"),A[4]=H,A[5]=s):s=A[5],A[6]!==s?(l=(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:s}),A[6]=s,A[7]=l):l=A[7],A[8]!==M?(d=(0,r.jsx)(n.default,{value:M,readOnly:!0,className:"flex-1 font-mono text-xs"}),A[8]=M,A[9]=d):d=A[9];let J="auth_url"===W?"check":"content_copy";A[10]!==M||A[11]!==G?(u=()=>G(M,"auth_url"),A[10]=M,A[11]=G,A[12]=u):u=A[12],A[13]!==H?(m=H("copy"),A[13]=H,A[14]=m):m=A[14],A[15]!==J||A[16]!==u||A[17]!==m?(x=(0,r.jsx)(i.default,{variant:"secondary",icon:J,onClick:u,children:m}),A[15]=J,A[16]=u,A[17]=m,A[18]=x):x=A[18],A[19]!==d||A[20]!==x?(p=(0,r.jsxs)("div",{className:"flex gap-2",children:[d,x]}),A[19]=d,A[20]=x,A[21]=p):p=A[21],A[22]!==l||A[23]!==p?(h=(0,r.jsxs)("div",{children:[l,p]}),A[22]=l,A[23]=p,A[24]=h):h=A[24],A[25]!==H?(b=H("step2PasteCallback"),A[25]=H,A[26]=b):b=A[26],A[27]!==b?(g=(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:b}),A[27]=b,A[28]=g):g=A[28],A[29]!==H?(v=H.rich("step2Hint",{code:y}),A[29]=H,A[30]=v):v=A[30],A[31]!==v?(j=(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:v}
1),A[31]=v,A[32]=j):j=A[32],A[33]!==K?(k="zed-hosted"===K&&(0,r.jsxs)("p",{className:"text-xs text-amber-500 mb-2",children:["After signing in, Zed redirects to a local address like"," ",(0,r.jsx)("code",{className:"font-mono",children:"http://127.0.0.1:<port>/?user_id=..."})," which the browser may show as unreachable â that is expected. Copy the FULL URL from the browser address bar (the access token is inside it) and paste it above."]}),A[33]=K,A[34]=k):k=A[34],A[35]!==z?(N=e=>z(e.target.value),A[35]=z,A[36]=N):N=A[36];let V="claude"===K||"cline"===K?"code#state or /callback?code=...":"zed-hosted"===K?"http://127.0.0.1:<port>/?user_id=...&access_token=...":$;A[37]!==P||A[38]!==N||A[39]!==V?(w=(0,r.jsx)(n.default,{value:P,onChange:N,placeholder:V,className:"font-mono text-xs"}),A[37]=P,A[38]=N,A[39]=V,A[40]=w):w=A[40],A[41]!==g||A[42]!==j||A[43]!==k||A[44]!==w?(S=(0,r.jsxs)("div",{children:[g,j,k,w]}),A[41]=g,A[42]=j,A[43]=k,A[44]=w,A[45]=S):S=A[45],A[46]!==t||A[47]!==h||A[48]!==S?(_=(0,r.jsxs)("div",{className:"space-y-4",children:[t,h,S]}),A[46]=t,A[47]=h,A[48]=S,A[49]=_):_=A[49];let Y=!B;return A[50]!==H?(C=H("connect"),A[50]=H,A[51]=C):C=A[51],A[52]!==U||A[53]!==Y||A[54]!==C?(T=(0,r.jsx)(i.default,{onClick:U,fullWidth:!0,disabled:Y,children:C}),A[52]=U,A[53]=Y,A[54]=C,A[55]=T):T=A[55],A[56]!==H?(E=H("cancel"),A[56]=H,A[57]=E):E=A[57],A[58]!==q||A[59]!==E?(I=(0,r.jsx)(i.default,{onClick:q,variant:"ghost",fullWidth:!0,children:E}),A[58]=q,A[59]=E,A[60]=I):I=A[60],A[61]!==T||A[62]!==I?(D=(0,r.jsxs)("div",{className:"flex gap-2",children:[T,I]}),A[61]=T,A[62]=I,A[63]=D):D=A[63],A[64]!==_||A[65]!==D?(L=(0,r.jsxs)(r.Fragment,{children:[_,D]}),A[64]=_,A[65]=D,A[66]=L):L=A[66],L}function y(e){return(0,r.jsx)("code",{className:"font-mono",children:e})}e.s(["OAuthDeviceCodePanel",0,u,"OAuthLoopbackMismatchPanel",0,m,"OAuthManualInputPanel",0,g,"formatDeviceCodeRemaining",0,d],954609);async function v(e){let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}function j(e,t,r="Request failed"){if(e&&"object"==typeof e){let t=e.error;if("string"==typeof t&&t.trim())return t;if(t&&"object"==typeof t){let e=t.message;return"string"==typeof e&&e.trim()?e:JSON.stringify(t)}let r=e.message??e.detail;if("string"==typeof r&&r.trim())return r}return"string"==typeof e&&e.trim()?e.length>300?`${e.slice(0,300)}â¦`:e:null!=t?`${r} (HTTP ${t})`:r}var k=e.i(467034);function N(e){return"string"==typeof e&&e.trim().startsWith("omniroute-cred-v1.")}async function w(e,t,r,s,a){let l=await fetch(`/api/oauth/${e}/paste-credentials`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({blob:t.trim(),connectionId:r?.id})}),i=await v(l);if(!l.ok)throw Error(j(i,l.status,"Failed to import credentials"));s("success"),a?.()}function S(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function _(e){return"string"==typeof e&&e.trim()?e.trim():void 0}function C(e){let t,s,l,c,d,u,m,x,p,h,b,f,g=(0,o.c)(35),{gheUrl:y,setGheUrl:v,error:j,setError:k,startOAuthFlow:N}=e,w=(0,a.useTranslations)("oauthModal");g[0]!==w?(t=w.rich("gheDescription",{code:T}),g[0]=w,g[1]=t):t=g[1],g[2]!==t?(s=(0,r.jsx)("p",{className:"text-sm text-text-muted",children:t}),g[2]=t,g[3]=s):s=g[3],g[4]!==v?(l=e=>v(e.target.value),g[4]=v,g[5]=l):l=g[5],g[6]!==w?(c=w("gheUrlPlaceholder"),g[6]=w,g[7]=c):c=g[7],g[8]!==w?(d=w("gheUrlLabel"),g[8]=w,g[9]=d):d=g[9],g[10]!==y||g[11]!==l||g[12]!==c||g[13]!==d?(u=(0,r.jsx)(n.default,{value:y,onChange:l,placeholder:c,label:d,type:"url"}),g[10]=y,g[11]=l,g[12]=c,g[13]=d,g[14]=u):u=g[14],g[15]!==y||g[16]!==k||g[17]!==N||g[18]!==w?(m=()=>{y.trim()?N():k(w("gheUrlRequired"))},g[15]=y,g[16]=k,g[17]=N,g[18]=w,g[19]=m):m=g[19],g[20]!==y?(x=y.trim(),g[20]=y,g[21]=x):x=g[21];let S=!x;return g[22]!==w?(p=w("connect"),g[22]=w,g[23]=p):p=g[23],g[24]!==p||g[25]!==m||g[26]!==S?(h=(0,r.jsx)(i.default,{onClick:m,fullWidth:!0,disabled:S,children:p}),g[24]=p,g[25]=m,g[26]=S,g[27]=h):h=g[27],g[28]!==j?(b=j&&(0,r.jsx)("p",{className:"text-sm text-red-500",children:j}),g[28]=j,g[29]=b):b=g[29],g[30]!==h||g[31]!==b||g[32]!==s||g[33]!==u?(f=(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[s,u,h,b]}),g[30]=h,g[31]=b,g[32]=s,g[33]=u,g[34]=f):f=g[34],f}function T(e){return(0,r.jsx)("code",{className:"font-mono",children:e})}let E=/https?:\/\/[^\s"'<>)]+/g;function I(e){let t,s,a=(0,o.c)(4),{text:l}=e;return a[0]!==l?(t=(function(e){let t;if(!e)return[];let r=[],s=0;for(E.lastIndex=0;null!==(t=E.exec(e));){t.index>
1s&&r.push({text:e.slice(s,t.index)});let a=t[0],l="";for(;a.length>0&&/[.,;:!?]$/.test(a);)l=a.slice(-1)+l,a=a.slice(0,-1);let i=function(e){let t;try{t=new URL(e).protocol}catch{return}return"http:"===t||"https:"===t?e:void 0}(a);r.push(i?{text:a,href:i}:{text:a}),l&&r.push({text:l}),s=t.index+t[0].length}return s<e.length&&r.push({text:e.slice(s)}),r})(l||"").map(D),a[0]=l,a[1]=t):t=a[1],a[2]!==t?(s=(0,r.jsx)(r.Fragment,{children:t}),a[2]=t,a[3]=s):s=a[3],s}function D(e,t){return e.href?(0,r.jsx)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"underline break-all",children:e.text},t):(0,r.jsx)(s.Fragment,{children:e.text},t)}var L=e.i(282225);function A(e){let t,s,l,n,c,d,u,m,x,p,h,b,f,g=(0,o.c)(32),{onContinue:y,onClose:v}=e,j=(0,a.useTranslations)("oauthModal");return g[0]!==j?(t=j("gitlabDuoSetupTitle"),g[0]=j,g[1]=t):t=g[1],g[2]!==t?(s=(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:t}),g[2]=t,g[3]=s):s=g[3],g[4]!==j?(l=j("gitlabDuoSetupMessage",{applicationsUrl:L.GITLAB_DUO_OAUTH_APPLICATIONS_URL,redirectUri:L.GITLAB_DUO_OAUTH_DEFAULT_REDIRECT_URI,scopes:L.GITLAB_DUO_OAUTH_SCOPES,clientIdEnv:"GITLAB_DUO_OAUTH_CLIENT_ID",clientSecretEnv:"GITLAB_DUO_OAUTH_CLIENT_SECRET"}),g[4]=j,g[5]=l):l=g[5],g[6]!==l?(n=(0,r.jsx)("p",{className:"text-sm text-text-muted leading-relaxed",children:(0,r.jsx)(I,{text:l})}),g[6]=l,g[7]=n):n=g[7],g[8]!==s||g[9]!==n?(c=(0,r.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 px-3 py-3 text-left",children:[s,n]}),g[8]=s,g[9]=n,g[10]=c):c=g[10],g[11]!==j?(d=j("gitlabDuoSetupDescription"),g[11]=j,g[12]=d):d=g[12],g[13]!==d?(u=(0,r.jsx)("p",{className:"text-xs text-text-muted",children:d}),g[13]=d,g[14]=u):u=g[14],g[15]!==j?(m=j("continue"),g[15]=j,g[16]=m):m=g[16],g[17]!==y||g[18]!==m?(x=(0,r.jsx)(i.default,{onClick:y,fullWidth:!0,children:m}),g[17]=y,g[18]=m,g[19]=x):x=g[19],g[20]!==j?(p=j("cancel"),g[20]=j,g[21]=p):p=g[21],g[22]!==v||g[23]!==p?(h=(0,r.jsx)(i.default,{onClick:v,variant:"ghost",fullWidth:!0,children:p}),g[22]=v,g[23]=p,g[24]=h):h=g[24],g[25]!==h||g[26]!==x?(b=(0,r.jsxs)("div",{className:"flex gap-2",children:[x,h]}),g[25]=h,g[26]=x,g[27]=b):b=g[27],g[28]!==b||g[29]!==c||g[30]!==u?(f=(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[c,u,b]}),g[28]=b,g[29]=c,g[30]=u,g[31]=f):f=g[31],f}function K(e){let t,s,a,l,n,c,d,u,m=(0,o.c)(22),{error:x,errorTitle:p,tryAgainLabel:h,cancelLabel:b,returnToGitlabDuoSetup:f,onReturnToGitlabDuoSetup:g,onTryAgain:y,onClose:v}=e;return m[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),m[0]=t):t=m[0],m[1]!==p?(s=(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:p}),m[1]=p,m[2]=s):s=m[2],m[3]!==x?(a=(0,r.jsx)("p",{className:"text-sm text-red-600 mb-4",children:(0,r.jsx)(I,{text:x})}),m[3]=x,m[4]=a):a=m[4],m[5]!==g||m[6]!==y||m[7]!==f?(l=()=>{f?g():y()},m[5]=g,m[6]=y,m[7]=f,m[8]=l):l=m[8],m[9]!==l||m[10]!==h?(n=(0,r.jsx)(i.default,{onClick:l,variant:"secondary",fullWidth:!0,children:h}),m[9]=l,m[10]=h,m[11]=n):n=m[11],m[12]!==b||m[13]!==v?(c=(0,r.jsx)(i.default,{onClick:v,variant:"ghost",fullWidth:!0,children:b}),m[12]=b,m[13]=v,m[14]=c):c=m[14],m[15]!==n||m[16]!==c?(d=(0,r.jsxs)("div",{className:"flex gap-2",children:[n,c]}),m[15]=n,m[16]=c,m[17]=d):d=m[17],m[18]!==s||m[19]!==a||m[20]!==d?(u=(0,r.jsxs)("div",{className:"text-center py-6",children:[t,s,a,d]}),m[18]=s,m[19]=a,m[20]=d,m[21]=u):u=m[21],u}function R(e){let t,s,a,l,n,c,d=(0,o.c)(15),{waitingLabel:u,completeAuthLabel:m,popupClosedHint:x,popupBlockedLabel:p,onManualInput:h}=e;return d[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),d[0]=t):t=d[0],d[1]!==u?(s=(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:u}),d[1]=u,d[2]=s):s=d[2],d[3]!==m?(a=(0,r.jsx)("p",{className:"text-sm text-text-muted mb-2",children:m}),d[3]=m,d[4]=a):a=d[4],d[5]!==x?(l=(0,r.jsx)("p",{className:"text-xs text-text-muted mb-4 opacity-70",children:x}),d[5]=x,d[6]=l):l=d[6],d[7]!==h||d[8]!==p?(n=(0,r.jsx)(i.default,{variant:"ghost",onClick:h,children:p}),d[7]=h,d[8]=p,d[9]=n):n=d[9],d[10]!==s||d[11]!==a||d[12]!==l||d[13]!==n?(c=(0,r.jsxs)("div",{className:"text-center py-6",children:[t,s,a,l,n]}),d[10]=s,d[11]=a,d[12]=l,d[13]=n,d[14]=c):c=d[14],c}function F(e){return e.port?e.port:"https:"===e.protocol?"443":"80"}function O(e,t){let r=[...new Set(e)];return`ssh ${r.map(e=>`-L ${e}:127.0.0.1:${e}`).join(" ")} <user>@${t}`}let M=new Set(["antigravity"]);var P=e.i(866213);let $={codex:"http://localhost:1455/auth/callback","xai-oauth":"http://127.0.0.1:56121/callback","grok-cli":"http://127.0.0.1:56122/callback"},B={codex:1455,"xai-oauth":56121,"grok-cli":56122},z=new Set(["antigravity","agy"]),U=new Set(["codex","xai-oauth","grok-cli"]),q=new Set(["github","kiro","amazon-q","kimi-coding","kilocode","codebuddy-cn","ghe-copilot","grok-cli","muse-code"]),H=new Set(["devin-desktop","devin-cli","grok-cli"]),W=new Set(["devin-desktop","devin-cli"]);async function G(e,t,r,s,a){let l=await fetch("/api/oauth/codex/import-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:e,name:t})}),i=await v(l);if(!l.ok)throw Error(j(i,l.status,a));r("success"),s?.()}function J(e,t){return Math.max(1,Number(e)||t)}async function V(e,t,r){try{let s=await fetch(`/api/oauth/${e}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),a=await v(s);if(a.success)return{status:"success"};if("slow_down"===a.error)return{status:"slow_down"};if(a.error&&!a.pending)return{status:"error",message:String(a.errorDescription||(0,P.errorMessageFromBody)(a,r))};return{status:"pending"}}catch(e){return{status:"error",message:e instanceof Error?e.message:r}}}e.s(["default",0,function({isOpen:e,provider:o,providerInfo:c,onSuccess:d,onClose:x,idcConfig:p,reauthConnection:h}
1){let b,f=(0,a.useTranslations)("oauthModal"),[y,T]=(0,s.useState)("waiting"),[E,I]=(0,s.useState)(null),[D,L]=(0,s.useState)(""),[Y,X]=(0,s.useState)(null),[Q,Z]=(0,s.useState)(!1),[ee,et]=(0,s.useState)(null),[er,es]=(0,s.useState)(""),[ea,el]=(0,s.useState)(!1),[ei,en]=(0,s.useState)(null),[eo,ec]=(0,s.useState)(()=>Date.now()),[ed,eu]=(0,s.useState)(W.has(o)),[em,ex]=(0,s.useState)(""),[ep,eh]=(0,s.useState)(!1),[eb,ef]=(0,s.useState)(!1),[eg,ey]=(0,s.useState)(null),ev=H.has(o),ej=W.has(o),ek=(0,s.useRef)(null),eN=(0,s.useRef)(0),ew=ee?.verification_uri_complete||ee?.verification_uri||"",{isLocalhost:eS,isTrueLocalhost:e_,placeholderUrl:eC,loopbackLocation:eT}=(0,s.useMemo)(()=>{let e=window.location.hostname;return{isLocalhost:"localhost"===e||"127.0.0.1"===e||e.startsWith("192.168.")||e.startsWith("10.")||/^172\.(1[6-9]|2\d|3[01])\./.test(e),isTrueLocalhost:"localhost"===e||"127.0.0.1"===e,placeholderUrl:`${window.location.origin}/callback?code=...`,loopbackLocation:{hostname:e,port:window.location.port,protocol:window.location.protocol}}},[]),eE=(0,s.useRef)(!1),eI=(0,s.useRef)(!1),eD=(0,s.useCallback)(()=>{eN.current+=1,el(!1),en(null)},[]),eL=(0,s.useCallback)(async(e,t)=>{if(E)try{if(!E.redirectUri||!E.codeVerifier)throw Error(f("errorSessionIncomplete"));let r="string"==typeof t&&t.length>0?t:void 0,s=await fetch(`/api/oauth/${o}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,redirectUri:E.redirectUri,connectionId:h?.id,codeVerifier:E.codeVerifier,...r?{state:r}:{}})}),a=await v(s);if(!s.ok){let e="object"==typeof a.error&&null!==a.error?a.error:null,t=e?e.message||JSON.stringify(e):a.error||f("errorExchangeFailed"),r=Array.isArray(e?.details)?e.details.map(e=>e?.message?e.field?`${e.field}: ${e.message}`:e.message:null).filter(Boolean).join("; "):"";throw Error(r?`${t} (${r})`:t)}T("success"),d?.()}catch(e){e.message?.toLowerCase().includes("redirect_uri_mismatch")&&z.has(o)?X(f("errorGoogleRedirectMismatch")):X(e.message),T("error")}},[E,o,d,h,f]),eA=(0,s.useCallback)(async()=>{let e=em.trim();if(e&&o){eh(!0),X(null);try{let t=e;if("grok-cli"===o){let r=function(e){let t=e.trim();if(!t)return{ok:!1,error:"Paste the full contents of ~/.grok/auth.json"};if(t.startsWith("{"))try{let e=JSON.parse(t);if(!e||"object"!=typeof e||Array.isArray(e))return{ok:!1,error:"auth.json must be a JSON object from ~/.grok/auth.json"};let r=!1,s=!1;for(let t of Object.values(e))if(t&&"object"==typeof t&&("string"==typeof t.key&&t.key.startsWith("eyJ")&&(r=!0,"string"==typeof t.refresh_token&&t.refresh_token.length>0)||"string"==typeof t.access_token&&t.access_token.startsWith("eyJ")&&(r=!0,"string"==typeof t.refresh_token&&t.refresh_token.length>0))){s=!0;break}if(!r)return{ok:!1,error:'Could not find a Grok Build JWT ("key") in the pasted auth.json. Run `grok login` and paste the full file.'};if(!s)return{ok:!1,error:"auth.json is missing refresh_token. Re-run `grok login` and paste the full ~/.grok/auth.json so the connection can auto-refresh (#7610)."};return{ok:!0,token:e}}catch{return{ok:!1,error:"Could not parse auth.json. Paste the full JSON from ~/.grok/auth.json."}}return t.startsWith("eyJ")?{ok:!1,error:'Do not paste only the JWT "key" field. Paste the full ~/.grok/auth.json object so refresh_token is included (#7610).'}:{ok:!1,error:"Paste the full contents of ~/.grok/auth.json (JSON object)."}}(e);if(!1===r.ok)return void X(r.error);t=r.token}let r=await fetch(`/api/oauth/${o}/import-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,connectionId:h?.id})}),s=await v(r);if(!r.ok){let e=j(s,r.status,f("errorSaveFailed"));throw Error(e)}T("success"),d?.()}catch(e){X(e.message)}finally{eh(!1)}}},[em,o,d,h,f]),eK=(0,s.useCallback)(async(e,t,r,s,a)=>{let l=++eN.current,i=J(r,5),n=J(s,60*i),c=Date.now()+1e3*n,u=i;for(el(!0),en(c),ec(Date.now());Date.now()<c&&(await new Promise(e=>setTimeout(e,1e3*u)),!(l!==eN.current||Date.now()>=c));){let r=await V(o,{deviceCode:e,connectionId:h?.id,codeVerifier:t,extraData:a},f("errorAuthorizationFailed"));if(l!==eN.current)return;if("success"===r.status){T("success"),el(!1),en(null),d?.();return}if("slow_down"===r.status){u=Math.min(u+5,30);continue}if("error"===r.status){X(r.message),T("error"),el(!1),en(null);return}}l===eN.current&&(X(f("errorAuthorizationTimeout")),T("error"),el(!1),en(null))},[o,d,h,f]),eR=(0,s.useCallback)(async e=>{if(o)try{let r;X(null);let s="grok-cli"===o&&(e?.grokBrowser??eb);if(q.has(o)&&!s){if(eD(),Z(!0),et(null),T("waiting"),"ghe-copilot"===o&&!er.trim())return void T("ghe-config");let e=new URL(`/api/oauth/${o}/device-code`,window.location.origin);("kiro"===o||"amazon-q"===o)&&p&&"object"==typeof p&&("string"==typeof p.startUrl&&p.startUrl.trim()&&e.searchParams.set("startUrl",p.startUrl.trim()),"string"==typeof p.region&&p.region.trim()&&e.searchParams.set("region",p.region.trim())),"ghe-copilot"===o&&er.trim()&&e.searchParams.set("gheUrl",er.trim());let t=await fetch(e.toString()),r=await v(t);if(!t.ok){let e=j(r,t.status,f("errorRequestFailed"));throw Error(e)}et(r);let s=r.verification_uri_complete||r.verification_uri;"string"==typeof s&&s&&window.open(s,"oauth_verify");let a="kiro"===o||"amazon-q"===o?{_clientId:r._clientId,_clientSecret:r._clientSecret,_region:r._region,_authMethod:r._authMethod}:"ghe-copilot"===o&&er.trim()?{gheUrl:er.trim()}:null;eK(r.device_code,r.codeVerifier,r.interval||5,r.expires_in,a);return}let a=!1;if("claude"!==o&&"cline"!==o&&("zed-hosted"!==o||e_)||(a=!0),U.has(o)){if(e_)try{let e=await fetch(`/api/oauth/${o}/start-callback-server`),t=await v(e);if(!e.ok)throw Error(j(t,e.status,f("errorCallbackServerFailed")));I({...t,redirectUri:t.redirectUri}),T("waiting"),ek.current=window.open(t.authUrl,"oauth_auth"),ek.current||T("input"),el(!0);for(let e=0;e<150;e++){await new Promise(e=>setTimeout(e,2e3));let e=await fetch(`/api/oauth/${o}/poll-callback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:h?.id})}
1),t=await v(e);if(t.success){T("success"),el(!1),d?.();return}if(t.error&&!t.pending)throw Error(t.errorDescription||(0,P.errorMessageFromBody)(t,f("errorAuthorizationFailed")))}throw el(!1),Error(f("errorAuthorizationTimeout"))}catch(e){console.warn(`${o} callback server failed, falling back to manual flow`,e),el(!1),a=!0}else if(eS&&!e?.manualLoopback){let e,t,r;ey((e=F(eT),t=B[o]??null,r=[e],null!=t&&String(t)!==e&&r.push(String(t)),{provider:o,redirectUri:$[o]??"a fixed localhost callback URL",callbackPort:t,dashboardPort:e,dashboardHost:eT.hostname,tunnelCommand:O(r,eT.hostname),localDashboardUrl:`http://localhost:${e}`})),T("loopback-mismatch");return}}if("codex"===o||"openai"===o)r="http://localhost:1455/auth/callback";else if("xai-oauth"===o||"grok-cli"===o){let e="xai-oauth"===o?56121:56122;r=`http://127.0.0.1:${e}/callback`}else if("devin-desktop"===o||"devin-cli"===o){let e=window.location.port||"20128";r=`http://localhost:${e}/auth/callback`}else if(z.has(o)){let e=window.location.port||"20128";r=`http://127.0.0.1:${e}/callback`}else if(eS){let e=window.location.port||("https:"===window.location.protocol?"443":"80");r=`http://localhost:${e}/callback`}else{let e=t.default.env.NEXT_PUBLIC_BASE_URL,s=e&&"http://localhost:20128"!==e?e.replace(/\/$/,""):window.location.origin;r=`${s}/callback`}let l=await fetch(`/api/oauth/${o}/authorize?redirect_uri=${encodeURIComponent(r)}`),i=await v(l);if(!l.ok){let e=j(i,l.status,f("errorAuthorizationFailed"));throw Error(e)}if(!i.authUrl)throw Error((0,P.errorMessageFromBody)(i,f("errorBrowserUnavailable")));I({...i,redirectUri:i.redirectUri||r}),!e_||a?(T("input"),window.open(i.authUrl,"oauth_auth")):(T("waiting"),ek.current=window.open(i.authUrl,"oauth_popup","width=600,height=700"),ek.current||T("input"))}catch(e){X(e.message),T("error")}},[o,eS,e_,eT,eK,d,h,p,er,eD,eb,f]);(0,s.useEffect)(()=>{if(!ei)return;let e=window.setInterval(()=>ec(Date.now()),1e3);return()=>window.clearInterval(e)},[ei]);let eF=null==ei?null:Math.max(0,Math.ceil((ei-eo)/1e3)),[eO,eM]=(0,s.useState)(o);o!==eO&&(eM(o),el(!1),en(null),ef(!1)),(0,s.useEffect)(()=>{eN.current+=1,eI.current=!1},[o]);let[eP,e$]=(0,s.useState)(e);e!==eP&&(e$(e),e||(el(!1),en(null))),(0,s.useEffect)(()=>{e||(eN.current+=1,eI.current=!1)},[e]),(0,s.useEffect)(()=>()=>{eN.current+=1},[]);let[eB,ez]=(0,s.useState)(null),eU=e&&o?String(o):null;eU!==eB&&(ez(eU),eU&&(eu(W.has(o)),ef(!1),I(null),L(""),X(null),Z(!1),et(null),el(!1),"gitlab-duo"===o&&T("gitlab-duo-setup"))),(0,s.useEffect)(()=>{if(!e||!o||eI.current)return;let t=W.has(o);"gitlab-duo"===o||(eI.current=!0,(async()=>{t||eR()})())},[e,o,eR]),(0,s.useEffect)(()=>{let e;if(!E)return;eE.current=!1;let t=async e=>{if(eE.current)return;let{code:t,state:r,error:s,errorDescription:a}=e;if(E?.state&&r&&r!==E.state){eE.current=!0,X(f("errorStateMismatch")),T("error");return}if(s){eE.current=!0,X(a||s),T("error");return}t&&(eE.current=!0,await eL(t,r))},r=e=>{let r=window.location.port,s=!1,a=!1;try{let t=new URL(e.origin);a=(s=/^(localhost|127\.0\.0\.1|\[::1\]|::1)$/i.test(t.hostname))&&t.port===r}catch{}let l=e.data?.data,i=!!E?.state&&l?.state===E.state,n=z.has(o)&&s&&i;(e.origin===window.location.origin||a||n)&&e.data?.type==="oauth_callback"&&t(l)};window.addEventListener("message",r);try{(e=new BroadcastChannel("oauth_callback")).onmessage=e=>t(e.data)}catch(e){console.log("BroadcastChannel not supported")}let s=e=>{if("oauth_callback"===e.key&&e.newValue)try{let r=JSON.parse(e.newValue);t(r),localStorage.removeItem("oauth_callback")}catch(e){console.log("Failed to parse localStorage data")}};window.addEventListener("storage",s);try{let e=localStorage.getItem("oauth_callback");if(e){let r=JSON.parse(e);r.timestamp&&Date.now()-r.timestamp<3e4&&(t(r),localStorage.removeItem("oauth_callback"))}}catch{}return()=>{window.removeEventListener("message",r),window.removeEventListener("storage",s),e&&e.close()}},[E,eL,o,f]),(0,s.useEffect)(()=>{if("waiting"!==y||Q||!ek.current)return;let e=setInterval(()=>{if(eE.current)return void clearInterval(e);try{ek.current?.closed&&(clearInterval(e),"waiting"===y&&T("input"))}catch{}},1e3),t=setTimeout(()=>{eE.current||"waiting"!==y||(clearInterval(e),T("input"))},3e5);return()=>{clearInterval(e),clearTimeout(t)}},[y,Q]);let eq=async()=>{try{if(X(null),N(D))return void await w(o,D,h,T,d);if("codex"===o&&/^eyJ/.test(D.trim()))return void await G(D.trim(),void 0,T,d,f("errorImportAccessToken"));if("codex"===o&&function(e){let t="string"==typeof e?e.trim():"";if(!t.startsWith("{"))return!1;try{return null!==S(JSON.parse(t))}catch{return!1}}(D)){let e=function(e){let t=S(e);if(!t)return{ok:!1,error:"Pasted session data is not a JSON object"};let r=function(e){let t=_(e.accessToken)||_(e.access_token)||_(e.sessionToken)||_(e.session_token);if(t)return t;let r=S(e.tokens);if(r)return _(r.access_token)||_(r.accessToken)}(t);if(!r)return{ok:!1,error:"Could not find an access token field in the pasted session JSON (expected accessToken, access_token, sessionToken, or tokens.access_token)"};if(3!==r.split(".").length)return{ok:!1,error:"The access token field does not look like a valid JWT"};if(function(e,t){let r,s,a=_(e.expires);if(a){let e=Date.parse(a);if(Number.isFinite(e)&&e<=Date.now())return!0}let l=(s=(r=function(e){try{if(!e||"string"!=typeof e)return null;let t=e.split(".");if(3!==t.length)return null;let r=t[1].replace(/-/g,"+").replace(/_/g,"/"),s=(4-r.length%4)%4,a=r+"=".repeat(s);return JSON.parse(k.Buffer.from(a,"base64").toString("utf8"))}catch{return null}}(t))&&"number"==typeof r.exp?r.exp:null,null!==s&&Number.isFinite(s)?s:null);return null!==l&&1e3*l<=Date.now()}(t,r))return{ok:!1,error:"Session is expired â sign in to chatgpt.com again and re-copy the session JSON"};let s=S(t.user);return{ok:!0,session:{accessToken:r,email:s&&_(s.email)||void 0}}}(JSON.parse(D.trim()));if(!1===e.ok)return void X(e.error);await G(e.session.accessToken,e.session.email,T,d,f("errorImportAccessToken"));return}if(!E)throw Error(f("errorSessionNotInitialized"));let e=D.trim();if("zed-hosted"===o)return void await eL(e,E?.state||null);let t=null,r=E?.state||null,s=null,a=null;try{let l=new URL(e);t=l.searchParams.get("code"),r=l.searchParams.get("state")||l.hash.replace(/^#/,"")||r,s=l.searchParams.get("error"),a=l.searchParams.get("error_description")}catch{let[s,a]=e.split("#",2);t=s||null,r=a||r}if(s)throw Error(a||s);if(!t)throw Error(f("errorNoAuthorizationCode"));await eL(t,r)}catch(e){X(e.message),T("error")}},eH=(0,s.useCallback)(()=>{eD(),x()},[eD,x]),eW=(0,s.useCallback)(()=>{eD(),eu(!0)},[eD]),eG=(0,s.useCallback)(()=>{eu(!1),"grok-cli"===o&&ef(!0),eR("grok-cli"===o?{grokBrowser:!0}:void 0)},[eR,o]),eJ=(0,s.useCallback)(()=>{eu(!1),ef(!1),eR({grokBrowser:!1})},[eR]);return o&&c?(0,r.jsx)(l.default,{isOpen:e,title:f("title",{providerName:c.name}),onClose:eH,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[ev&&!ej&&"success"!==y&&(0,r.jsxs)("div",{className:"flex gap-2 border-b border-border pb-3",children:["grok-cli"===o&&(0,r.jsx)("button",{className:`text-sm px-3 py-1 rounded-t ${!ed&&!eb?"font-semibold border-b-2 border-primary text-primary":"text-text-muted"}`,onClick:eJ,children:f("tabDeviceCode")}),(0,r.jsx)("button",{className:`text-sm px-3 py-1 rounded-t ${!ed&&("grok-cli"!==o||eb)?"font-semibold border-b-2 border-primary text-primary":"text-text-muted"}`,onClick:eG,children:f("tabBrowserLogin")}),(0,r.jsx)("button",{className:`text-sm px-3 py-1 rounded-t ${ed?"font-semibold border-b-2 border-primary text-primary":"text-text-muted"}`,onClick:eW,children:"grok-cli"===o?f("tabImportAuthJson"):f("tabPasteApiKey")})]}),ev&&ed&&"success"!==y&&(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"devin-desktop"===o?f("devinDesktopPasteDescription"):"grok-cli"===o?f("grokAuthJsonDescription"):f("devinPasteDescription")}),"grok-cli"===o?(0,r.jsx)("textarea",{className:"w-full h-32 p-3 text-sm font-mono bg-input border border-border rounded-md resize-none focus:outline-none focus:ring-2 focus:ring-primary",value:em,onChange:e=>ex(e.target.value),placeholder:f("grokAuthJsonPlaceholder"),"aria-label":f("grokAuthJsonLabel")}):(0,r.jsx)(n.default,{value:em,onChange:e=>ex(e.target.value),placeholder:f("apiTokenPlaceholder"),type:"password",label:f("apiKeyTokenLabel")}),Y&&(0,r.jsx)("p",{className:"text-sm text-red-500",children:Y}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.default,{onClick:eA,fullWidth:!0,disabled:!em.trim()||ep,children:ep?f("saving"):f("saveConnection")}),(0,r.jsx)(i.default,{onClick:eH,variant:"ghost",fullWidth:!0,children:f("cancel")})]})]}),(!ev||!ed)&&(0,r.jsxs)(r.Fragment,{children:["ghe-copilot"===o&&"ghe-config"===y&&(0,r.jsx)(C,{gheUrl:er,setGheUrl:es,error:Y,setError:X,startOAuthFlow:eR}),"gitlab-duo"===o&&"gitlab-duo-setup"===y&&(0,r.jsx)(A,{onContinue:()=>void eR(),onClose:eH}
1),"waiting"===y&&!Q&&(0,r.jsx)(R,{waitingLabel:f("waiting"),completeAuthLabel:f("completeAuthInPopup"),popupClosedHint:f("popupClosedHint"),popupBlockedLabel:f("popupBlocked"),onManualInput:()=>T("input")}),"waiting"===y&&Q&&ee&&(0,r.jsx)(u,{deviceData:ee,verificationUrl:ew,secondsRemaining:eF,polling:ea}),"input"===y&&!Q&&(0,r.jsx)(g,{provider:o,isGoogleOAuth:z.has(o),isTrueLocalhost:e_,googleHint:z.has(o)?(b=F(eT),{provider:o,redirectUri:`http://127.0.0.1:${b}/callback`,dashboardHost:eT.hostname,dashboardPort:b,tunnelCommand:O([b],eT.hostname),localDashboardUrl:`http://localhost:${b}`,helperCommand:M.has(o)?`npx omniroute login ${o}`:null}):null,authUrl:"string"==typeof E?.authUrl?E.authUrl:"",callbackUrl:D,placeholderUrl:eC,canSubmit:!!(D&&(E||N(D))),onCallbackUrlChange:L,onSubmit:eq,onClose:eH})]}),"success"===y&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:f("success")}),(0,r.jsx)("p",{className:"text-sm text-text-muted mb-4",children:f("successMessage",{providerName:c.name})}),(0,r.jsx)(i.default,{onClick:eH,fullWidth:!0,children:f("done")})]}),"loopback-mismatch"===y&&eg&&!ed&&(0,r.jsx)(m,{providerName:c.name,hint:eg,onManualInput:()=>void eR({manualLoopback:!0}),onClose:eH}),"error"===y&&!ed&&(0,r.jsx)(K,{error:Y,errorTitle:f("error"),tryAgainLabel:f("tryAgain"),cancelLabel:f("cancel"),returnToGitlabDuoSetup:"gitlab-duo"===o,onReturnToGitlabDuoSetup:()=>{X(null),T("gitlab-duo-setup")},onTryAgain:()=>void eR(),onClose:eH})]})}):null}],964039)},110626,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(156132);e.s(["default",0,function(e){let a,l,i,n,o,c,d,u,m,x,p,h=(0,r.c)(35),{value:b,onChange:f,presets:g,min:y,max:v,step:j,className:k}=e,N=void 0===y?0:y,w=void 0===v?100:v,S=void 0===j?1:j;if(h[0]!==k?(a=(0,s.cn)("flex flex-col gap-3",k),h[0]=k,h[1]=a):a=h[1],h[2]!==f||h[3]!==g||h[4]!==b){let e;h[6]!==f||h[7]!==b?(e=e=>(0,t.jsx)("button",{type:"button",onClick:()=>f(e.value),className:(0,s.cn)("px-3 py-1.5 text-xs font-medium rounded-full transition-colors","border",b===e.value?"bg-primary text-white border-primary":"bg-transparent text-text-muted border-black/10 dark:border-white/10 hover:border-primary/30 hover:text-text-main"),children:e.label},e.value),h[6]=f,h[7]=b,h[8]=e):e=h[8],l=g.map(e),h[2]=f,h[3]=g,h[4]=b,h[5]=l}else l=h[5];return h[9]!==l?(i=(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:l}),h[9]=l,h[10]=i):i=h[10],h[11]!==f?(n=e=>f(Number(e.target.value)),h[11]=f,h[12]=n):n=h[12],h[13]===Symbol.for("react.memo_cache_sentinel")?(o=(0,s.cn)("w-full h-1.5 rounded-full appearance-none cursor-pointer","bg-black/10 dark:bg-white/10","accent-primary"),h[13]=o):o=h[13],h[14]!==w||h[15]!==N||h[16]!==S||h[17]!==n||h[18]!==b?(c=(0,t.jsx)("input",{type:"range",min:N,max:w,step:S,value:b,onChange:n,className:o}),h[14]=w,h[15]=N,h[16]=S,h[17]=n,h[18]=b,h[19]=c):c=h[19],h[20]!==N?(d=(0,t.jsx)("span",{children:N}),h[20]=N,h[21]=d):d=h[21],h[22]!==b?(u=(0,t.jsx)("span",{className:"font-medium text-text-main",children:b}),h[22]=b,h[23]=u):u=h[23],h[24]!==w?(m=(0,t.jsx)("span",{children:w}),h[24]=w,h[25]=m):m=h[25],h[26]!==d||h[27]!==u||h[28]!==m?(x=(0,t.jsxs)("div",{className:"flex justify-between text-[10px] text-text-muted",children:[d,u,m]}),h[26]=d,h[27]=u,h[28]=m,h[29]=x):x=h[29],h[30]!==x||h[31]!==a||h[32]!==i||h[33]!==c?(p=(0,t.jsxs)("div",{className:a,children:[i,c,x]}),h[30]=x,h[31]=a,h[32]=i,h[33]=c,h[34]=p):p=h[34],p}])},953789,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(618566),a=e.i(948148),l=e.i(393718),i=e.i(1203),n=e.i(950914),o=e.i(484124),c=e.i(243009),d=e.i(624982),u=e.i(449612),m=e.i(209991),x=e.i(902796);let p="loggerRefreshIntervalSec";function h(){return void 0===globalThis.window?null:window.localStorage}function b(e){return Number.isFinite(e)?Math.min(300,Math.max(1,Math.round(e))):10}var f=e.i(475394);let g={status:{desc:"status_desc",asc:"status_asc"},model:{desc:"model_desc",asc:"model_asc"},tokens:{desc:"tokens_desc",asc:"tokens_asc"},tps:{desc:"tps_desc",asc:"tps_asc"},duration:{desc:"duration_desc",asc:"duration_asc"},time:{desc:"newest",asc:"oldest"}};function y(e){return(e?.tokens?.in||0)+(e?.tokens?.out||0)}function v(e){return(0,u.computeLogTps)(e?.tokens?.out,e?.tokens?.reasoning,e?.duration,e?.ttft)}let j=(0,r.forwardRef)((e,j)=>{let{initialSelectedId:k,initialCorrelationId:N}=e,w=(0,a.useTranslations)("requestLogger"),S=(0,a.useTranslations)("cache"),{emailsVisible:_}=(0,m.default)(),C=(0,r.useMemo)(()=>[{key:"all",label:w("statusFilters.all"),icon:""},{key:"error",label:w("statusFilters.error"),icon:"error"},{key:"ok",label:w("statusFilters.success"),icon:"check_circle"},{key:"combo",label:w("statusFilters.combo"),icon:"hub"}],[w]),T=(0,r.useMemo)(()=>[{key:"status",label:w("columns.status")},{key:"cacheSource",label:w("columns.cacheSource")},{key:"model",label:w("columns.model")},{key:"requestedModel",label:w("columns.requested")},{key:"provider",label:w("columns.provider")},{key:"protocol",label:w("columns.protocol")},{key:"account",label:w("columns.account")},{key:"apiKey",label:w("columns.apiKey")},{key:"combo",label:w("columns.combo")},{key:"tokens",label:w("columns.tokens")},{key:"tps",label:w("columns.tps")},{key:"ttft",label:w("columns.ttft")},{key:"duration",label:w("columns.duration")},{key:"addedWait",label:w("columns.addedWait")},{key:"time",label:w("columns.time")},{key:"conversation",label:w("columns.conversation")}],[w]),[E,I]=(0,r.useState)([]),[D,L]=(0,r.useState)(!0),[A,K]=(0,r.useState)(!0),[R,F]=(0,r.useState)(""),[O,M]=(0,r.useState)("all"),[P,$]=(0,r.useState)(""),[B,z]=(0,r.useState)(""),[U,q]=(0,r.useState)(""),[H,W]=(0,r.useState)(""),[G,J]=(0,r.useState)("newest"),[V,Y]=(0,r.useState)(null),[X,Q]=(0,r.useState)(()=>N??""),[Z,ee]=(0,r.useState)(null),[et,er]=(0,r.useState)(!1),[es,ea]=(0,r.useState)(!1),el=(0,r.useCallback)(e=>{let t=g[e];t&&J(e=>e===t.desc?t.asc:t.desc)},[]),ei=(0,r.useCallback)(e=>{let t=g[e];return t?G===t.desc?" â":G===t.asc?" â":"":""},[G]),[en,eo]=(0,r.useState)(null),[ec,ed]=(0,r.useState)(!1),[eu,em]=(0,r.useState)(!1),[ex,ep]=(0,r.useState)(50),[eh,eb]=(0,r.useState)(!1),[ef,eg]=(0,r.useState)(10),ey=(0,r.useRef)(null),ev=(0,r.useRef)(10),ej=(0,r.useRef)(""),ek=(0,r.useRef)(!1),eN=(0,r.useRef)(""),ew=(0,r.useRef)(null),eS=(0,r.useRef)(null),e_=(0,r.useRef)(!1),[eC,eT]=(0,r.useState)([]),eE=(0,r.useRef)(!0),eI=(0,r.useRef)(null),[eD,eL]=(0,r.useState)(()=>{let e=Object.fromEntries(T.map(e=>[e.key,!0]));if(e.ttft=!1,void 0===globalThis.window)return e;try{let t=localStorage.getItem("loggerVisibleColumns");return t?{...e,...JSON.parse(t)}:e}catch{return e}}),eA=(0,r.useCallback)(e=>{eL(t=>{let r={...t,[e]:!t[e]};try{localStorage.setItem("loggerVisibleColumns",JSON.stringify(r))}catch{}return r})},[]);(0,r.useEffect)(()=>{let e=function(e=h()){if(!e)return 10;try{let t=e.getItem(p);if(!t)return 10;return b(Number.parseInt(t,10))}catch{return 10}}();ev.current=e,eg(e)},[]),(0,r.useEffect)(()=>{ev.current=ef},[ef]);let eK=(0,r.useCallback)(e=>{let t=ev.current,r=b("function"==typeof e?e(t):e);ev.current=r,function(e,t=h()){if(t)try{t.setItem(p,String(b(e)))}catch{return!1}}(r),eg(r)},[]),eR=(0,r.useCallback)(async(e=!1)=>{e&&L(!0);try{let e=new URLSearchParams;R&&e.set("search",R),"error"===O&&e.set("status","error"),"ok"===O&&e.set("status","ok"),"combo"===O&&e.set("combo","1"),P&&e.set("model",P),U&&e.set("provider",
1U),B&&e.set("account",B),H&&e.set("apiKey",H),X&&e.set("correlationId",X),e.set("limit",String(ex));let t=await fetch(`/api/usage/call-logs?${e}`);if(t.ok){let e=await t.json();eb(Array.isArray(e)&&e.length>=ex);let r=(Array.isArray(e)?e:[]).map(e=>e.id+":"+e.status+":"+e.duration+":"+(e.tokens?.out||0)).join("|");r!==eN.current&&(eN.current=r,I(e))}}catch(e){console.error("Failed to fetch call logs:",e)}finally{e&&L(!1)}},[R,O,P,B,U,H,X,ex]);(0,r.useEffect)(()=>{let e=!ek.current;ek.current=!0,eR(e)},[eR]),(0,r.useEffect)(()=>{fetch("/api/provider-nodes").then(e=>e.ok?e.json():{nodes:[]}).then(e=>eT(e.nodes||[])).catch(()=>{})},[]),(0,r.useEffect)(()=>{fetch("/api/logs/detail?limit=1").then(async e=>e.ok?await e.json():null).then(e=>{e&&ed(!0===e.enabled)}).catch(()=>{})},[]),(0,r.useEffect)(()=>{let e=()=>{let e="visible"===document.visibilityState;eE.current=e,e&&!V&&A&&ex<=50&&eR(!1)},t=()=>{eE.current=!0,!V&&A&&ex<=50&&eR(!1)};return document.addEventListener("visibilitychange",e),window.addEventListener("focus",t),()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener("focus",t)}},[A,ex,eR,V]),(0,r.useEffect)(()=>(ey.current&&clearInterval(ey.current),!V&&A&&ex<=50&&(ey.current=setInterval(()=>{(eE.current||"visible"===document.visibilityState)&&eR(!1)},1e3*ef)),()=>{ey.current&&clearInterval(ey.current)}),[A,eR,ex,ef,V]),(0,r.useEffect)(()=>{ep(50),e_.current=!1},[R,O,P,B,U,H,X]);let eF=(0,r.useCallback)(()=>{ep(e=>e+50)},[]);(0,r.useEffect)(()=>{let e=ew.current;if(!e)return;let t=()=>{e.scrollTop>0&&(e_.current=!0)};return e.addEventListener("scroll",t,{passive:!0}),()=>e.removeEventListener("scroll",t)},[]),(0,r.useEffect)(()=>{let e=eS.current,t=ew.current;if(!e||!eh)return;let r=new IntersectionObserver(e=>{var t;(t={isIntersecting:!!e[0]?.isIntersecting,hasMore:eh,loading:D,hasScrolled:e_.current}).isIntersecting&&t.hasMore&&!t.loading&&t.hasScrolled&&eF()},{root:t,rootMargin:"200px"});return r.observe(e),()=>r.disconnect()},[eh,D,eF]);let eO=(0,r.useMemo)(()=>{let e=E;return"error"===O?e=e.filter(e=>e.status>=400):"ok"===O?e=e.filter(e=>e.status>=200&&e.status<300):"combo"===O&&(e=e.filter(e=>e.comboName)),e},[E,O]),eM=(0,r.useMemo)(()=>{if(!et)return eO;let e=new Map,t=[];for(let r of eO){let s=r.correlationId;if(!s){t.push(r);continue}let a=e.get(s);(!a||new Date(r.timestamp).getTime()>new Date(a.timestamp).getTime())&&e.set(s,r)}return[...t,...e.values()]},[eO,et]),eP=(0,r.useMemo)(()=>{let e=[...eM];return e.sort((e,t)=>{switch(G){case"oldest":return new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime();case"tokens_desc":return y(t)-y(e);case"tokens_asc":return y(e)-y(t);case"duration_desc":return(t.duration||0)-(e.duration||0);case"duration_asc":return(e.duration||0)-(t.duration||0);case"tps_desc":return v(t)-v(e);case"tps_asc":return v(e)-v(t);case"status_desc":return(t.status||0)-(e.status||0);case"status_asc":return(e.status||0)-(t.status||0);case"model_asc":return(e.model||"").localeCompare(t.model||"");case"model_desc":return(t.model||"").localeCompare(e.model||"");default:return new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()}}),e},[eM,G]),e$=(0,r.useMemo)(()=>{let e=new Map;for(let t of eP){let r=t.correlationId;r&&(e.has(r)||e.set(r,[]),e.get(r).push(t))}return eP.map(t=>{let r=t.correlationId;if(!r)return{...t,isRetry:!1,groupSize:1,groupStatus:null};let s=e.get(r);if(!s||s.length<=1)return{...t,isRetry:!1,groupSize:1,groupStatus:null};let a=s[0].id===t.id,l=s.some(e=>e.status>=400||e.active),i=s.some(e=>e.status>=200&&e.status<300);return{...t,isRetry:!a,groupSize:s.length,groupStatus:l&&i?"healed":l?"failed":null}})},[eP]),eB=(0,s.useRouter)(),ez=(0,r.useCallback)(()=>{ej.current="",Y(null),eo(null);try{let e=new URL(globalThis.location.href);e.searchParams.delete("id"),eB.replace(e.pathname+e.search,{scroll:!1})}catch(e){}},[eB]),eU=(0,r.useCallback)(async e=>{if(!e?.id){try{ez()}catch{}return}let t=`${e.id}:${Date.now()}:${Math.random()}`;ej.current=t,Y(e);try{let t=new URL(globalThis.location.href);t.searchParams.set("id",e.id),eB.replace(t.pathname+t.search,{scroll:!1})}catch(e){}ea(!0),eo(null);try{let r=await fetch(`/api/logs/${e.id}`,{cache:"no-store"});if(r.ok){let e=await r.json();if(ej.current!==t)return;let s=e?.pipelinePayloads&&Object.keys(e.pipelinePayloads||{}).length>0;eo(t=>({...t,...e,pipelinePayloads:s?e.pipelinePayloads:t?.pipelinePayloads})),e&&"object"==typeof e&&Y(t=>({...t,...e,active:!0===e.active}))}else{if(ej.current!==t)return;if(404===r.status){if(e.pendingLookup||e.active){Y(t=>({...t,id:e.id,status:0,method:t?.method,path:t?.path||""})),eo({detailState:"pending"});return}try{console.warn("Log not found:",e.id)}catch{}try{ez()}catch{}return}try{let e=await r.text().catch(()=>null);if(ej.current!==t)return;eo({error:`Failed to fetch log (status ${r.status})`,body:e})}catch{}}}catch(e){console.error("Failed to fetch log detail:",e)}finally{ej.current===t&&ea(!1)}},[ez,eB]),eq=(0,r.useMemo)(()=>eP,[eP]);(0,r.useImperativeHandle)(j,()=>({openDetail:eU,getSortedLogs:()=>eq}),[eU,eq]);let eH=(0,r.useRef)(!1);(0,r.useEffect)(()=>{k&&!eH.current&&(eH.current=!0,eU({id:k,pendingLookup:!0}
1).then(e=>e).catch(e=>{console.error("Failed to open initial log id:",e)}))},[k,eU]),(0,r.useEffect)(()=>{let e=V?.active===!0;if(!V?.id||!e)return;let t=!1,r=0,s=setInterval(async()=>{if("visible"===document.visibilityState)try{let a=await fetch(`/api/logs/${V.id}`,{cache:"no-store"});if(t)return;if(404===a.status){if(e)return;clearInterval(s);return}if(a.ok){let e=await a.json(),t=!0===e.active;eo(t=>({...t,...e,pipelinePayloads:e?.pipelinePayloads||t?.pipelinePayloads})),Y(r=>({...r,...e,active:t})),!t&&++r>=3&&clearInterval(s)}}catch{}},1e3);return()=>{t=!0,clearInterval(s)}},[V?.id,en?.detailState,V?.active,eR]),(0,r.useEffect)(()=>{let e=V?.correlationId;if(!V?.id||!e)return;let t=!1,r=setInterval(async()=>{if("visible"===document.visibilityState)try{let r=await fetch(`/api/usage/call-logs?correlationId=${encodeURIComponent(e)}`,{cache:"no-store"});if(t||!r.ok)return;let s=await r.json();if(!Array.isArray(s)||0===s.length)return;I(e=>{s.map(e=>e.id);let t=!1,r=e.map(e=>{let r=s.find(t=>t.id===e.id);return r?(t=!0,{...e,...r}):e});for(let e of s)r.some(t=>t.id===e.id)||(r.push(e),t=!0);return t?r:e})}catch{}},3e3);return()=>{t=!0,clearInterval(r)}},[V?.id,V?.correlationId]);let eW=(0,r.useMemo)(()=>V?eq.findIndex(e=>e.id===V.id):-1,[V,eq]),eG=(0,r.useCallback)(()=>{let e=eW>0?eq[eW-1]:null;e?.id?eU(e).then(e=>e).catch(e=>{console.error("Failed to open previous log id:",e)}):(eI.current="prev",eR(!1))},[eW,eq,eR,eU]),eJ=(0,r.useCallback)(()=>{let e=eW>=0&&eW<eq.length-1?eq[eW+1]:null;e?.id?eU(e).then(e=>e).catch(e=>{console.error("Failed to open previous log id:",e)}):(eI.current="next",eR(!1))},[eW,eq,eR,eU]);(0,r.useEffect)(()=>{let e=eI.current;if(!e||!V)return;eI.current=null;let t=eq.findIndex(e=>e.id===V.id),r="prev"===e?t>0?eq[t-1]:null:t>=0&&t<eq.length-1?eq[t+1]:null;r?.id?eU(r).then(e=>e).catch(e=>{console.error("Failed to open adjacent log id:",e)}):ez()},[eq,V]);let eV=async()=>{em(!0);try{let e=!ec;if(!(await fetch("/api/logs/detail",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:e})})).ok)throw Error(w("updatePipelineFailed"));ed(e)}catch(e){console.error("Failed to toggle pipeline logging:",e)}finally{em(!1)}},eY=(0,r.useMemo)(()=>[...new Set(E.map(e=>e.account).filter(e=>e&&"-"!==e))],[E]),eX=(0,r.useMemo)(()=>[...new Set(E.flatMap(e=>[e.model,e.requestedModel]).filter(Boolean))].sort(),[E]),eQ=(0,r.useMemo)(()=>[...new Set(E.map(e=>e.provider).filter(e=>e&&"-"!==e))].sort(),[E]),eZ=(0,r.useMemo)(()=>[...new Set(E.map(e=>e.apiKeyId||e.apiKeyName).filter(Boolean))].sort(),[E]),{totalCount:e0,okCount:e1,errorCount:e2,comboCount:e3,apiKeyCount:e5,runningCount:e4}=(0,r.useMemo)(()=>({totalCount:eO.length,okCount:eO.filter(e=>e.status>=200&&e.status<300).length,errorCount:eO.filter(e=>e.status>=400).length,comboCount:E.filter(e=>e.comboName).length,apiKeyCount:eZ.length,runningCount:eO.filter(e=>!0===e.active).length}),[eO,E,eZ]);return(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,t.jsxs)("button",{onClick:()=>K(!A),className:`flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium border transition-colors ${A?"bg-red-500/10 border-red-500/30 text-red-700 dark:text-red-400":"bg-bg-subtle border-border text-text-muted"}`,children:[(0,t.jsx)("span",{className:`w-2 h-2 rounded-full ${A?"bg-red-500 animate-pulse":"bg-text-muted"}`}),A?w("recording"):w("paused")]}),(0,t.jsxs)("button",{onClick:eV,disabled:eu,className:`flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium border transition-colors disabled:opacity-60 ${ec?"bg-amber-500/10 border-amber-500/30 text-amber-700 dark:text-amber-300":"bg-bg-subtle border-border text-text-muted"}`,title:w("capturePipeline"),children:[(0,t.jsx)("span",{className:`w-2 h-2 rounded-full ${ec?"bg-amber-500":"bg-text-muted"}`}),eu?w("updatingPipelineLogs"):ec?w("pipelineLogsOn"):w("pipelineLogsOff")]}),(0,t.jsxs)("div",{className:"flex-1 min-w-[200px] relative",children:[(0,t.jsx)("span",{className:"material-symbols-outlined absolute left-3 top-1/2 -translate-y-1/2 text-text-muted text-[18px]",children:"search"}),(0,t.jsx)("input",{type:"text",placeholder:w("searchPlaceholder"),value:R,onChange:e=>F(e.target.value),className:"w-full pl-10 pr-4 py-2 rounded-lg bg-bg-subtle border border-border text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:border-primary"})]}),(0,t.jsxs)("div",{className:"min-w-[180px] relative",children:[(0,t.jsx)("span",{className:"material-symbols-outlined absolute left-3 top-1/2 -translate-y-1/2 text-text-muted text-[16px]",children:"tag"}),(0,t.jsx)("input",{type:"text",placeholder:w("correlationId"),value:X,onChange:e=>Q(e.target.value),className:"w-full pl-9 pr-3 py-2 rounded-lg bg-bg-subtle border border-border text-sm text-text-primary font-mono placeholder:text-text-muted focus:outline-none focus:border-primary"})]}),(0,t.jsxs)("button",{onClick:()=>er(e=>!e),className:`flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm font-medium border transition-colors ${et?"bg-violet-500/15 border-violet-500/30 text-violet-700 dark:text-violet-300":"bg-bg-subtle border-border text-text-muted hover:text-text-primary"}`,title:et?w("group.showAllRows"):w("group.showLatestPerCorrelation"),children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:et?"unfold_less":"unfold_more"}),et?w("group.grouped"):w("statusFilters.all")]}),(0,t.jsxs)("select",{value:U,onChange:e=>q(e.target.value),className:"px-3 py-2 rounded-lg bg-bg-subtle border border-border text-sm text-text-primary focus:outline-none focus:border-primary appearance-none cursor-pointer min-w-[140px]",children:[(0,t.jsx)("option",{value:"",children:w("allProviders")}),eQ.map(e=>
1{let r=(0,d.getProviderDisplayLabel)(e,eC),s=o.PROVIDER_COLORS[e];return(0,t.jsx)("option",{value:e,children:r||s?.label||e.toUpperCase()},e)})]}),(0,t.jsxs)("select",{value:P,onChange:e=>$(e.target.value),className:"px-3 py-2 rounded-lg bg-bg-subtle border border-border text-sm text-text-primary focus:outline-none focus:border-primary appearance-none cursor-pointer min-w-[180px]",children:[(0,t.jsx)("option",{value:"",children:w("allModels")}),eX.map(e=>(0,t.jsx)("option",{value:e,children:e},e))]}),(0,t.jsxs)("select",{value:B,onChange:e=>z(e.target.value),className:"px-3 py-2 rounded-lg bg-bg-subtle border border-border text-sm text-text-primary focus:outline-none focus:border-primary appearance-none cursor-pointer min-w-[140px]",children:[(0,t.jsx)("option",{value:"",children:w("allAccounts")}),eY.map(e=>(0,t.jsx)("option",{value:e,children:_?e:`${(0,c.maskAccount)(e,!1)} \xb7 #${(0,c.stableAccountSuffix)(e)}`},e))]}),(0,t.jsxs)("select",{value:H,onChange:e=>W(e.target.value),className:"px-3 py-2 rounded-lg bg-bg-subtle border border-border text-sm text-text-primary focus:outline-none focus:border-primary appearance-none cursor-pointer min-w-[160px]",children:[(0,t.jsx)("option",{value:"",children:w("allApiKeys")}),eZ.map(e=>{let r=E.find(t=>
1(t.apiKeyId||t.apiKeyName)===e),s=(0,c.formatApiKeyLabel)(r?.apiKeyName,r?.apiKeyId);return(0,t.jsx)("option",{value:e,children:s},e)})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[(0,t.jsxs)("span",{className:"px-2 py-1 rounded bg-bg-subtle border border-border font-mono",children:[e0," ",w("total")]}),e4>0&&(0,t.jsxs)("span",{className:"px-2 py-1 rounded bg-amber-500/10 text-amber-700 dark:text-amber-400 font-mono",children:[e4," ",w("running")]}),(0,t.jsxs)("span",{className:"px-2 py-1 rounded bg-emerald-500/10 text-emerald-700 dark:text-emerald-400 font-mono",children:[e1," ",w("ok")]}),e2>0&&(0,t.jsxs)("span",{className:"px-2 py-1 rounded bg-red-500/10 text-red-700 dark:text-red-400 font-mono",children:[e2," ",w("err")]}),e3>0&&(0,t.jsxs)("span",{className:"px-2 py-1 rounded bg-violet-500/10 text-violet-700 dark:text-violet-400 font-mono",children:[e3," ",w("combo")]}),e5>0&&(0,t.jsxs)("span",{className:"px-2 py-1 rounded bg-primary/10 text-primary font-mono",children:[e5," ",w("keys")]}),(0,t.jsxs)("span",{className:"px-2 py-1 rounded bg-bg-subtle border border-border font-mono",children:[eP.length," ",w("shown")]})]}),(0,t.jsxs)("select",{value:G,onChange:e=>J(e.target.value),className:"px-3 py-2 rounded-lg bg-bg-subtle border border-border text-sm text-text-primary focus:outline-none focus:border-primary appearance-none cursor-pointer min-w-[150px]",title:w("sortLogs"),children:[(0,t.jsx)("option",{value:"newest",children:w("sortNewest")}),(0,t.jsx)("option",{value:"oldest",children:w("sortOldest")}),(0,t.jsx)("option",{value:"tokens_desc",children:w("sortTokensDesc")}),(0,t.jsx)("option",{value:"tokens_asc",children:w("sortTokensAsc")}),(0,t.jsx)("option",{value:"duration_desc",children:w("sortDurationDesc")}),(0,t.jsx)("option",{value:"duration_asc",children:w("sortDurationAsc")}),(0,t.jsx)("option",{value:"status_desc",children:w("sortStatusDesc")}),(0,t.jsx)("option",{value:"status_asc",children:w("sortStatusAsc")}),(0,t.jsx)("option",{value:"model_asc",children:w("sortModelAsc")}),(0,t.jsx)("option",{value:"model_desc",children:w("sortModelDesc")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("button",{onClick:()=>eK(e=>e-1),className:"w-6 h-6 flex items-center justify-center rounded hover:bg-bg-subtle text-text-muted hover:text-text-primary transition-colors text-sm font-bold",title:w("interval.decrease"),children:"â"}),(0,t.jsx)("input",{type:"number",min:1,max:300,value:ef,onChange:e=>{let t=Number.parseInt(e.target.value,10);Number.isNaN(t)||eK(t)},className:"w-12 text-center text-[11px] bg-transparent border border-border rounded px-1 py-0.5 text-text-primary [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",title:w("interval.title")}),(0,t.jsx)("button",{onClick:()=>eK(e=>e+1),className:"w-6 h-6 flex items-center justify-center rounded hover:bg-bg-subtle text-text-muted hover:text-text-primary transition-colors text-sm font-bold",title:w("interval.increase"),children:"+"}),(0,t.jsx)("span",{className:"text-[10px] text-text-muted",children:"s"})]}),(0,t.jsx)("button",{onClick:()=>eR(!1),className:"p-2 rounded-lg hover:bg-bg-subtle text-text-muted hover:text-text-primary transition-colors",title:w("refresh"),children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"refresh"})})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[C.map(e=>(0,t.jsxs)("button",{onClick:()=>M(O===e.key?"all":e.key),className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium border transition-all ${O===e.key?"error"===e.key?"bg-red-500/20 text-red-700 dark:text-red-400 border-red-500/40":"ok"===e.key?"bg-emerald-500/20 text-emerald-700 dark:text-emerald-400 border-emerald-500/40":"combo"===e.key?"bg-violet-500/20 text-violet-700 dark:text-violet-300 border-violet-500/40":"bg-primary text-white border-primary":"bg-bg-subtle border-border text-text-muted hover:border-text-muted"}`,children:[e.icon&&(0,t.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:e.icon}),e.label]},e.key)),eQ.length>0&&(0,t.jsx)("span",{className:"w-px h-5 bg-border mx-1"}),eQ.map(e=>
1{let r=(0,d.getProviderDisplayLabel)(e,eC),s=o.PROVIDER_COLORS[e]||{bg:"#374151",text:"#fff",label:r||e.toUpperCase()},a=r||s.label,l=U===e;return(0,t.jsx)("button",{onClick:()=>q(l?"":e),className:`px-3 py-1 rounded-full text-xs font-bold uppercase border transition-all ${l?"border-white/40 ring-1 ring-white/20":"border-transparent opacity-70 hover:opacity-100"}`,style:{backgroundColor:l?s.bg:`${s.bg}33`,color:l?s.text:s.bg},children:a},e)})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,t.jsx)("span",{className:"text-[10px] text-text-muted uppercase tracking-wider mr-1",children:w("columnsLabel")}),T.map(e=>(0,t.jsx)("button",{onClick:()=>eA(e.key),className:`px-2 py-0.5 rounded text-[10px] font-medium border transition-all ${eD[e.key]?"bg-primary/15 text-primary border-primary/30":"bg-bg-subtle text-text-muted border-border opacity-50 hover:opacity-80"}`,children:e.label},e.key))]}),(0,t.jsx)(l.default,{padding:"none",className:"min-h-[460px] resize-y overflow-auto bg-surface",children:(0,t.jsxs)("div",{ref:ew,className:"p-0 overflow-x-auto overflow-y-auto h-full min-h-[460px]",children:[D&&0===E.length?(0,t.jsx)("div",{className:"p-8 text-center text-text-muted",children:w("loadingLogs")}):0===E.length?(0,t.jsxs)("div",{className:"p-8 text-center text-text-muted",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[48px] mb-2 block opacity-40",children:"receipt_long"}),w("noLogs")]}):0===eP.length?(0,t.jsx)("div",{className:"p-8 text-center text-text-muted",children:w("noMatchingLogs")}):(0,t.jsxs)("table",{className:f.LOG_TABLE_CLASS,children:[(0,t.jsx)("thead",{className:f.LOG_TABLE_HEAD_CLASS,style:f.LOG_TABLE_HEADER_BG_STYLE,children:(0,t.jsxs)("tr",{className:f.LOG_TABLE_ROW_CLASS,style:f.LOG_TABLE_HEADER_BG_STYLE,children:[eD.status&&(0,t.jsxs)("th",{className:`${f.LOG_TABLE_HEADER_CELL_CLASS} cursor-pointer select-none`,onClick:()=>el("status"),children:[w("columns.status"),ei("status")]}),eD.cacheSource&&(0,t.jsx)("th",{className:f.LOG_TABLE_HEADER_CELL_CLASS,children:w("columns.cacheSource")}),eD.model&&(0,t.jsx)("th",{className:f.LOG_TABLE_HEADER_CELL_CLASS,children:w("columns.model")}),eD.requestedModel&&(0,t.jsx)("th",{className:f.LOG_TABLE_HEADER_CELL_CLASS,children:w("columns.requested")}),eD.provider&&(0,t.jsx)("th",{className:f.LOG_TABLE_HEADER_CELL_CLASS,children:w("columns.provider")}),eD.protocol&&(0,t.jsx)("th",{className:f.LOG_TABLE_HEADER_CELL_CLASS,children:w("columns.protocol")}),eD.account&&(0,t.jsx)("th",{className:f.LOG_TABLE_HEADER_CELL_CLASS,children:w("columns.account")}),eD.apiKey&&(0,t.jsx)("th",{className:f.LOG_TABLE_HEADER_CELL_CLASS,children:w("columns.apiKey")}),eD.combo&&(0,t.jsx)("th",{className:f.LOG_TABLE_HEADER_CELL_CLASS,children:w("columns.combo")}),eD.tokens&&(0,t.jsxs)("th",{className:`${f.LOG_TABLE_HEADER_CELL_RIGHT_CLASS} cursor-pointer select-none`,onClick:()=>el("tokens"),children:[w("columns.tokens"),ei("tokens")]}),eD.tps&&(0,t.jsxs)("th",{className:`${f.LOG_TABLE_HEADER_CELL_RIGHT_CLASS} cursor-pointer select-none`,onClick:()=>el("tps"),children:[w("columns.tps"),ei("tps")]}),eD.ttft&&(0,t.jsx)("th",{className:f.LOG_TABLE_HEADER_CELL_RIGHT_CLASS,children:w("columns.ttft")}),eD.duration&&(0,t.jsxs)("th",{className:`${f.LOG_TABLE_HEADER_CELL_RIGHT_CLASS} cursor-pointer select-none`,onClick:()=>el("duration"),children:[w("columns.duration"),ei("duration")]}),eD.addedWait&&(0,t.jsx)("th",{className:f.LOG_TABLE_HEADER_CELL_RIGHT_CLASS,children:w("columns.addedWait")}),eD.time&&(0,t.jsxs)("th",{className:`${f.LOG_TABLE_HEADER_CELL_RIGHT_CLASS} cursor-pointer select-none`,onClick:()=>el("time"),children:[w("columns.time"),ei("time")]}),eD.conversation&&(0,t.jsx)("th",{className:f.LOG_TABLE_HEADER_CELL_CLASS,children:w("columns.conversation")})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border/30",children:e$.map(e=>{let r,s,a=!0===e.active,l=a?null:(0,o.getHttpStatusStyle)(e.status),i=a?null:e.sourceFormat||e.provider,n=i?(0,o.getProtocolColor)(i,e.provider):null,m=(0,d.getProviderDisplayLabel)(e.provider,eC),p=o.PROVIDER_COLORS[e.provider]||{bg:"#374151",text:"#fff",label:m||(e.provider||"-").toUpperCase()}
1,h=e.providerDisplay||m||p.label,b=!a&&e.status>=400,f="semantic"===e.cacheSource?{key:"semantic",className:"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300 border border-emerald-500/30"}:{key:"upstream",className:"bg-sky-500/15 text-sky-700 dark:text-sky-300 border border-sky-500/30"},g=f?.key==="semantic",y=(0,c.maskAccount)(e.account,_);return(0,t.jsxs)("tr",{onClick:()=>eU(e),"data-cid":e.correlationId||void 0,onMouseEnter:()=>e.correlationId&&ee(e.correlationId),onMouseLeave:()=>ee(null),className:`cursor-pointer transition-colors ${b?"bg-red-500/5 hover:bg-red-500/15 dark:hover:bg-red-400/15":"hover:bg-sky-500/10 dark:hover:bg-sky-400/10"} ${e.isRetry?"border-l-2 border-l-amber-500/50":""} ${Z&&e.correlationId===Z?"bg-violet-500/10 dark:bg-violet-400/10 ring-1 ring-violet-500/20":""}`,style:e.isRetry?{backgroundColor:Z&&e.correlationId===Z?void 0:"rgba(245,158,11,0.03)"}:void 0,children:[eD.status&&(0,t.jsx)("td",{className:"px-3 py-2",children:a?(0,t.jsx)("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-full bg-amber-500/15 border border-amber-500/25",title:w("status.inProgress"),children:(0,t.jsx)("span",{className:"inline-block h-3 w-3 rounded-full border-2 border-amber-500 border-t-transparent animate-spin"})}):(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)("span",{className:"inline-block px-2 py-0.5 rounded text-[10px] font-bold min-w-[36px] text-center",style:{backgroundColor:l.bg,color:l.text},children:e.status||"..."}),"healed"===e.groupStatus&&!e.isRetry&&e.status>=400&&(0,t.jsx)("span",{className:"text-emerald-500 text-[11px]",title:w("status.recoveredByRetry"),children:"â"}),e.isRetry&&(0,t.jsx)("button",{className:"inline-flex items-center text-amber-500 hover:text-amber-400 text-[11px] ml-0.5",title:w("status.goToParent"),onClick:t=>{t.stopPropagation();let r=e$.find(t=>t.correlationId===e.correlationId&&!t.isRetry);r&&eU(r)},children:"â³"})]})}),eD.cacheSource&&(0,t.jsx)("td",{className:"px-3 py-2",children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"â"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:`inline-block px-2 py-0.5 rounded text-[9px] font-bold uppercase ${f?.className||""}`,title:g?w("semanticCacheHit"):w("upstreamResponse"),children:g?w("semantic"):w("upstream")}),(0,x.getResilienceBadges)(e.resilienceActions,(e,t)=>w(`detail.${e}`,t)).map(e=>(0,t.jsxs)("span",{title:e.title,children:["[",e.label,"]"]},e.key))]})}),eD.model&&(0,t.jsxs)("td",{className:"px-3 py-2 font-medium text-primary font-mono text-[11px]",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{children:e.model}),"healed"===e.groupStatus&&!e.isRetry&&(0,t.jsx)("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded text-[8px] font-bold bg-emerald-500/15 text-emerald-600 dark:text-emerald-400 border border-emerald-500/25",title:w("status.healedTitle",{count:e.groupSize-1}),children:w("status.healed")}),"failed"===e.groupStatus&&!e.isRetry&&(0,t.jsx)("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded text-[8px] font-bold bg-red-500/15 text-red-600 dark:text-red-400 border border-red-500/25",title:w("status.failedTitle",{count:e.groupSize}),children:w("status.failed")}),e.modelPinned&&(0,t.jsx)("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded text-[8px] font-bold bg-violet-500/15 text-violet-600 dark:text-violet-400 border border-violet-500/25",title:w("status.pinnedTitle"),children:w("status.pinned")})]}),e.correlationId&&!e.isRetry&&e.groupSize>1&&(0,t.jsxs)("div",{className:"text-[9px] text-text-muted font-normal truncate max-w-[120px]",title:e.correlationId,children:[e.correlationId.slice(0,12),"⦠· ",e.groupSize," ",w("attempts")]}),e.correlationId&&!e.isRetry&&e.groupSize<=1&&(0,t.jsxs)("div",{className:"text-[9px] text-text-muted font-normal truncate max-w-[120px]",title:e.correlationId,children:[e.correlationId.slice(0,12),"â¦"]}),e.correlationId&&e.isRetry&&(0,t.jsxs)("div",{className:"text-[9px] text-amber-500/70 font-normal truncate max-w-[120px]",title:e.correlationId,children:[e.correlationId.slice(0,12),"â¦"]})]}),eD.requestedModel&&(0,t.jsx)("td",{className:"px-3 py-2 font-mono text-[11px]",children:e.requestedModel?(0,t.jsx)("span",{className:e.requestedModel!==e.model?"text-amber-600 dar
1k:text-amber-400":"text-text-muted",title:e.requestedModel!==e.model?w("requestedRoutedTitle",{requested:e.requestedModel,routed:e.model}):e.requestedModel,children:e.requestedModel}):(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"â"})}),eD.provider&&(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)("span",{className:"inline-block px-2 py-0.5 rounded text-[9px] font-bold uppercase",style:{backgroundColor:p.bg,color:p.text},children:h})}),eD.protocol&&(0,t.jsx)("td",{className:"px-3 py-2",children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"â"}):(0,t.jsx)("span",{className:"inline-block px-2 py-0.5 rounded text-[9px] font-bold uppercase",style:n?{backgroundColor:n.bg,color:n.text}:{},children:n?.label||"â"})}),eD.account&&(0,t.jsx)("td",{className:"px-3 py-2 text-text-muted truncate max-w-[120px]",title:y,children:y}),eD.apiKey&&(0,t.jsx)("td",{className:"px-3 py-2 text-text-muted truncate max-w-[140px]",title:e.apiKeyName||e.apiKeyId||w("noApiKey"),children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"â"}):(0,c.formatApiKeyLabel)(e.apiKeyName,e.apiKeyId)}),eD.combo&&(0,t.jsx)("td",{className:"px-3 py-2",children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"â"}):e.comboName?(0,t.jsx)("span",{className:"inline-block px-2 py-0.5 rounded-full text-[9px] font-bold bg-violet-500/20 text-violet-800 dark:text-violet-300 border border-violet-500/40",children:e.comboName}):(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"â"})}),eD.tokens&&(0,t.jsx)("td",{className:"px-3 py-2 text-right whitespace-nowrap",children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"â"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-text-muted",children:"TI:"})," ",(0,t.jsx)("span",{className:"text-primary",children:e.tokens?.in?.toLocaleString()||0}),(0,t.jsx)("span",{className:"mx-1 text-border",children:"|"}),(0,t.jsx)("span",{className:"text-text-muted",children:"TO:"})," ",(0,t.jsx)("span",{className:"text-emerald-700 dark:text-emerald-400",children:e.tokens?.out?.toLocaleString()||0}),e.tokens?.cacheRead!=null&&e.tokens.cacheRead>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"mx-1 text-border",children:"|"}),(0,t.jsx)("span",{className:"text-text-muted",children:"CR:"})," ",(0,t.jsxs)("span",{className:"text-sky-700 dark:text-sky-400",title:S("cachedTokensCol"),children:[e.tokens.cacheRead.toLocaleString()," (",(0,c.formatCachePercentage)(e.tokens.in,e.tokens.cacheRead),"%)"]})]}),e.tokens?.cacheWrite!=null&&e.tokens.cacheWrite>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"mx-1 text-border",children:"|"}),(0,t.jsx)("span",{className:"text-text-muted",children:"CW:"})," ",(0,t.jsx)("span",{className:"text-amber-700 dark:text-amber-400",title:S("cacheCreation"),children:e.tokens.cacheWrite.toLocaleString()})]}),e.tokens?.compressed!=null&&e.tokens.compressed>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"mx-1 text-border",children:"|"}),(0,t.jsxs)("span",{className:"text-purple-500 dark:text-purple-400 font-semibold",title:`${e.tokens.compressed.toLocaleString()} tokens compressed`,children:["â",e.tokens.compressed.toLocaleString()]})]})]})}),eD.tps&&(0,t.jsx)("td",{className:"px-3 py-2 text-right whitespace-nowrap font-mono",children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"â"}):(s=(r=v(e))<=0?"text-text-muted":r>=80?"text-emerald-600 dark:text-emerald-400":r>=30?"text-sky-600 dark:text-sky-400":"text-amber-600 dark:text-amber-400",(0,t.jsx)("span",{className:s,title:(0,u.buildLogTpsTitle)(e,r,c.formatDuration),children:r<=0?"â":r>=100?Math.round(r).toLocaleString():r.toFixed(1)}))}),eD.ttft&&(0,t.jsx)("td",{className:"px-3 py-2 text-right text-text-muted font-mono",children:(0,c.formatDuration)(e.ttft>0?e.ttft:null)}),eD.duration&&(0,t.jsx)("td",{className:"px-3 py-2 text-right text-text-muted font-mono",children:(0,c.formatDuration)(e.duration)}),eD.addedWait&&(0,t.jsx)("td",{className:"px-3 py-2 text-right text-text-muted font-mono",children:"number"==typeof e.addedWaitMs&&e.addedWaitMs>0?`${(0,c.formatDuration)(e.addedWaitMs)}${e.addedWaitCause?` (${e.addedWaitCause})`:""}`:"â"}),eD.time&&(0,t.jsx)("td",{className:"px-3 py-2 text-right text-text-muted",children:(0,c.formatTime)(e.timestamp)}),eD.conversation&&(0,t.jsx)("td",{className:"px-3 py-2 font-mono text-[10px] text-text-muted",children:e.sessionTag?(0,t.jsxs)("span",{title:e.sessionTag,children:[e.sessionTag.slice(0,12),"â¦"]}):(0,t.jsx)("span",{className:"text-text-muted",children:"â"})})]},e.id)})})]}),eh&&eP.length>0&&(0,t.jsx)("div",{ref:eS,className:"flex justify-center py-3 border-t border-border/30",children:(0,t.jsx)("button",{type:"button",onClick:eF,className:"px-4 py-1.5 text-xs rounded-md border border-border bg-bg-subtle hover:bg-bg-muted text-text-muted transition-colors",children:D?w("loadingMore"):w("loadMore")})})]})}),(0,t.jsx)("div",{className:"text-[10px] text-text-muted italic",children:w("callLogsInfo",{dataDir:"{DATA_DIR}/call_logs/",retentionDays:"CALL_LOG_RETENTION_DAYS",maxEntries:"CALL_LOG_MAX_ENTRIES"})}),V&&(0,t.jsx)(i.default,{log:V,detail:en,loading:es,debugEnabled:!!V.active||ec,emailsVisible:_,onClose:ez,onCopy:n.copyToClipboard,onPrevious:eG,onNext:eJ,relatedLogs:V.correlationId?e$.filter(e=>e.correlationId===V.correlationId):[],onSelectRelated:e=>{ez(),eU(e)}})]})});j.displayName="RequestLoggerV2",e.s(["default",0,j],953789)},323060,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(156132);e.s(["default",0,function(e){let a,l,i,n,o,c=(0,r.c)(17),{options:d,value:u,onChange:m,size:x,className:p,"aria-label":h}=e;if(c[0]!==h||c[1]!==p||c[2]!==m||c[3]!==d||c[4]!==x||c[5]!==u){let e=void 0===d?[]:d,r=void 0===x?"md":x,o={sm:"h-7 text-xs",md:"h-9 text-sm",lg:"h-11 text-base"};a="tablist",l=h,c[10]!==p?(i=(0,s.cn)("inline-flex items-center p-1 rounded-lg","bg-black/5 dark:bg-white/5",p),c[
110]=p,c[11]=i):i=c[11],n=e.map(e=>(0,t.jsxs)("button",{role:"tab","aria-selected":u===e.value,tabIndex:u===e.value?0:-1,onClick:()=>m(e.value),className:(0,s.cn)("px-4 rounded-md font-medium transition-all",o[r],u===e.value?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main",e.icon&&"flex items-center"),children:[e.icon&&(0,t.jsx)("span",{className:"material-symbols-outlined text-[16px] mr-1.5","aria-hidden":"true",children:e.icon}),e.label]},e.value)),c[0]=h,c[1]=p,c[2]=m,c[3]=d,c[4]=x,c[5]=u,c[6]=a,c[7]=l,c[8]=i,c[9]=n}else a=c[6],l=c[7],i=c[8],n=c[9];return c[12]!==a||c[13]!==l||c[14]!==i||c[15]!==n?(o=(0,t.jsx)("div",{role:a,"aria-label":l,className:i,children:n}),c[12]=a,c[13]=l,c[14]=i,c[15]=n,c[16]=o):o=c[16],o}])},647829,799012,e=>{"use strict";var t=e.i(247167),r=e.i(843476),s=e.i(500932),a=e.i(271645),l=e.i(522016),i=e.i(618566),n=e.i(156132),o=e.i(723790),c=e.i(462939),d=e.i(342923),u=e.i(80173),m=e.i(703166),x=e.i(948148);let p={connected:{icon:"cloud_done",color:"text-green-500",labelKey:"synced"},syncing:{icon:"cloud_sync",color:"text-blue-400 animate-pulse",labelKey:"syncing"},disconnected:{icon:"cloud_off",color:"text-amber-500",labelKey:"off"},error:{icon:"cloud_off",color:"text-red-400",labelKey:"error"},disabled:{icon:"cloud_off",color:"text-text-muted/50",labelKey:"disabled"}};function h(e){let t,l,n,o,c,d,u,m,h,b,f,g=(0,s.c)(29),{collapsed:y}=e,v=void 0!==y&&y,j=(0,x.useTranslations)("cloudSyncStatus"),[k,N]=(0,a.useState)("disabled"),[w,S]=(0,a.useState)(null),_=(0,a.useRef)(!0),C=(0,i.useRouter)();g[0]===Symbol.for("react.memo_cache_sentinel")?(t=async()=>{try{let e=await fetch("/api/sync/cloud");if(!_.current)return;if(!e.ok)return void N("disconnected");let t=await e.json();if(!_.current)return;t.enabled?t.syncing?N("syncing"):t.connected?(N("connected"),t.lastSync&&S(new Date(t.lastSync))):N("disconnected"):N("disabled")}catch{_.current&&N("disconnected")}},g[0]=t):t=g[0];let T=t;if(g[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{_.current=!0,queueMicrotask(T);let e=setInterval(T,3e4),t=()=>{setTimeout(T,500)};return globalThis.addEventListener("cloud-status-changed",t),()=>{_.current=!1,clearInterval(e),globalThis.removeEventListener("cloud-status-changed",t)}},n=[T],g[1]=l,g[2]=n):(l=g[1],n=g[2]),(0,a.useEffect)(l,n),"disabled"===k)return null;let E=p[k];g[3]!==E.labelKey||g[4]!==w||g[5]!==C||g[6]!==k||g[7]!==j?(o=j(E.labelKey),g[13]!==C?(c=()=>C.push("/dashboard/endpoint"),g[13]=C,g[14]=c):c=g[14],d="flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg hover:bg-white/5 transition-colors cursor-pointer w-full",u=w?j("lastSync",{status:j("connected"===k?"connected":"disconnected"),time:w.toLocaleTimeString()}):o,m=j("statusLabel",{status:o}),g[3]=E.labelKey,g[4]=w,g[5]=C,g[6]=k,g[7]=j,g[8]=o,g[9]=c,g[10]=d,g[11]=u,g[12]=m):(o=g[8],c=g[9],d=g[10],u=g[11],m=g[12]);let I=`material-symbols-outlined text-[16px] ${E.color}`;return g[15]!==E.icon||g[16]!==I?(h=(0,r.jsx)("span",{className:I,"aria-hidden":"true",children:E.icon}),g[15]=E.icon,g[16]=I,g[17]=h):h=g[17],g[18]!==v||g[19]!==o||g[20]!==k?(b=!v&&(0,r.jsx)("span",{className:`truncate ${"connected"===k?"text-green-500":"text-text-muted"}`,children:o}),g[18]=v,g[19]=o,g[20]=k,g[21]=b):b=g[21],g[22]!==h||g[23]!==b||g[24]!==c||g[25]!==d||g[26]!==u||g[27]!==m?(f=(0,r.jsxs)("button",{onClick:c,className:d,title:u,"aria-label":m,children:[h,b]}),g[22]=h,g[23]=b,g[24]=c,g[25]=d,g[26]=u,g[27]=m,g[28]=f):f=g[28],f}let b=["compression-context","tools","integrations","logs","audit","system","gamification","batch"],f="hiddenSidebarGroupLabels";function g(e){if(!Array.isArray(e))return[];let t=new Set;for(let r of e)"string"==typeof r&&b.includes(r)&&t.add(r);return b.filter(e=>t.has(e))}e.s(["HIDDEN_SIDEBAR_GROUP_LABELS_SETTING_KEY",0,f,"HIDEABLE_SIDEBAR_GROUP_IDS",0,b,"normalizeHiddenSidebarGroupLabels",0,g],799012);var y=e.i(241937),v=e.i(513859);let j="1"===t.default.env.NEXT_PUBLIC_OMNIROUTE_E2E_MODE,k="omni-proxy",N="sidebar-expanded-sections",w="sidebar-pinned-sections",S="sidebar-pinned-items";function _(e,t){try{if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return t}function C(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}let T=()=>()=>{},E=()=>null,I=()=>!0,D=()=>!1;function L(){try{return localStorage.getItem(N)}catch{return null}}function A(){try{return localStorage.getItem(w)}catch{return null}}function K(){try{return localStorage.getItem(S)}catch{return null}}function R(){return globalThis.location.reload()}function F(e){return"group"===e.type?e.items:[e]}function O(){return globalThis.location.reload()}function M(e){return!e}function P(e){return"group"===e.type?e.items:[e]}function $(e){return"home"===e.id}function B(e){return e.children.flatMap(z)}function z(e){return"group"===e.type?e.items:[e]}function U(e){return e.children.flatMap(q).length>0}function q(e){return"group"===e.type?e.items:[e]}function H(){}function W(e){return e.json()}function G(e){return e.id}function J(e){return e.defaultPinned}e.s(["default",0,function(e){let t,p,b,z,q,V,Y,X,Q,Z,ee,et,er,es,ea,el,ei,en,eo,ec,ed,eu,em,ex,ep,eh,eb,ef,eg,ey,ev,ej,ek,eN,ew,eS,e_,eC,eT,eE,eI,eD,eL,eA,eK,eR,eF,eO,eM,eP,e$,eB,ez,eU,eq,eH,eW,eG,eJ,eV,eY,eX,eQ,eZ,e0,e1,e2,e3,e5,e4,e6,e8,e7=(0,s.c)(179),{onClose:e9,collapsed:te,onToggleCollapse:tt,isMacElectron:tr}=e,ts=void 0!==te&&te,ta=void 0!==tr&&tr,tl=(0,i.usePathname)(),ti=(0,x.useTranslations)("sidebar"),tn=(0,x.useTranslations)("common"),to=(0,a.useRef)(null),[tc,td]=(0,a.useState)(!1),[tu,tm]=(0,a.useState)(!1),[tx,tp]=(0,a.useState)(!1),[th,tb]=(0,a.useState)(!1),[tf,tg]=(0,a.useState)(!1),[ty,tv]=(0,a.useState)(!1);e7[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e7[0]=t):t=e7[0];let[tj,tk]=(0,a.useState)(t);e7[1]===Symbol.for("react.memo_cache_sentinel")?(p=[],e7[1]=p):p=e7[1];let[tN,tw]=(0,a.useState)(p);e7[2]===Symbol.for("react.memo_cache_sentinel")?(b={},e7[2]=b):b=e7[2];let[tS,t_]=(0,a.useState)(b),[tC,tT]=(0,a.useState)(null);e7[3]===Symbol.for("react.memo_cache_sentinel")?(z=[],e7[3]=z):z=e7[3];let[tE,tI]=(0,a.useState)(z);e7[4]===Symbol.for("react.memo_cache_sentinel")?(q={},e7[4]=q):q=e7[4];let[tD,tL]=(0,a.useState)(q),[tA,tK]=(0,a.useState)(null),[tR,tF]=(0,a.useState)(null);e7[5]===Symbol.for("react.memo_cache_sentinel")?(V=new Set([k]),e7[5]=V):V=e7[5];let[tO,tM]=(0,a.useState)(V);e7[6]===Symbol.for("react.memo_cache_sentinel")?(Y=new Set,e7[6]=Y):Y=e7[6];let[tP,t$]=(0,a.useState)(Y);e7[7]===Symbol.for("react.memo_cache_sentinel")?(X=new Set,e7[7]=X):X=e7[7];let[tB,tz]=(0,a.useState)(X),[tU,tq]=(0,a.useState)(!1),[tH,tW]=(0,a.useState)(!1),[tG,tJ]=(0,a.useState)(!1),[tV,tY]=(0,a.useState)(null),[tX,tQ]=(0,a.useState)(""),tZ=(0,a.useSyncExternalStore)(T,I,D),t0=(0,a.useSyncExternalStore)(T,L,E),t1=(0,a.useSyncExternalStore)(T,A,E),t2=(0,a.useSyncExternalStore)(T,K,E);if(tZ&&!tH){let e=_(t0,[k]),t=null!==t1?_(t1,[]):v.SIDEBAR_SECTIONS.filter(J).map(G),r=_(t2,[]),s=new Set(t),a=new Set([...e,...s]);tJ(0===e.length),tM(a),t$(s),tz(new Set(r)),tW(!0)}e7[8]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>{fetch("/api/settings").then(W).then(e=>{tv(e?.debugMode===!0),tk((0,y.normalizeHiddenSidebarItems)(e?.[y.HIDDEN_SIDEBAR_ITEMS_SETTING_KEY])),tw(g(e?.[f])),tK(e?.instanceName||null),tF(e?.customLogoBase64||e?.customLogoUrl||null),"boolean"==typeof e?.radarEnabled&&t_(t=>({...t,RADAR_ENABLED:e.radarEnabled})),tT(e?.radarAdminUrl??null),Array.isArray(e?.[y.SIDEBAR_SECTION_ORDER_KEY])&&tI(e[y.SIDEBAR_SECTION_ORDER_KEY]),e?.[y.SIDEBAR_ITEM_ORDER_KEY]&&"object"==typeof e[y.SIDEBAR_ITEM_ORDER_KEY]&&tL(e[y.SIDEBAR_ITEM_ORDER_KEY])}).catch(H);let e=e=>{let t=e.detail||{};"debugMode"in t&&tv(!0===t.debugMode),y.HIDDEN_SIDEBAR_ITEMS_SETTING_KEY in t&&tk((0,y.normalizeHiddenSidebarItems)(t[y.HIDDEN_SIDEBAR_ITEMS_SETTING_KEY])),f in t&&tw(g(t[f])),y.SIDEBAR_SECTION_ORDER_KEY in t&&Array.isArray(t[y.SIDEBAR_SECTION_ORDER_KEY])&&tI(t[y.SIDEBAR_SECTION_ORDER_KEY]),y.SIDEBAR_ITEM_ORDER_KEY in t&&t[y.SIDEBAR_ITEM_ORDER_KEY]&&"object"==typeof t[y.SIDEBAR_ITEM_ORDER_KEY]&&tL(t[y.SIDEBAR_ITEM_ORDER_KEY]),"instanceName"in t&&tK(t.instanceName||null),"customLogoBase64"in t?tF(t.customLogoBase64||null):"customLogoUrl"in t&&tF(t.customLogoUrl||null)};return window.addEventListener(y.SIDEBAR_SETTINGS_UPDATED_EVENT,e),()=>window.removeEventListener(y.SIDEBAR_SETTINGS_UPDATED_EVENT,e)},Z=[],e7[8]=Q,e7[9]=Z):(Q=e7[8],Z=e7[9]),(0,a.useEffect)(Q,Z),e7[10]!==ti?(ee=(e,t)=>
1"function"==typeof ti.has&&ti.has(e)?ti(e):t,e7[10]=ti,e7[11]=ee):ee=e7[11];let t3=ee;e7[12]!==tS||e7[13]!==t3?(et=(e,t)=>{if(t.has(e.id)||!(0,y.isSidebarItemVisibleForFlags)(e,tS))return null;let r=e.subtitleKey?t3(e.subtitleKey,e.subtitleFallback??""):e.subtitleFallback;return{...e,label:t3(e.i18nKey,e.labelFallback??e.id),subtitle:r||void 0}},e7[12]=tS,e7[13]=t3,e7[14]=et):et=e7[14];let t5=et,t4=new Set(tj);e7[15]!==tN?(er=new Set(tN),e7[15]=tN,e7[16]=er):er=e7[16];let t6=er,t8=(0,y.resolveRuntimeSidebarSections)(v.SIDEBAR_SECTIONS,{radarAdminUrl:tC});e7[17]!==ty?(es=e=>"debug"!==e.visibility||ty,e7[17]=ty,e7[18]=es):es=e7[18];let t7=(0,y.applySectionOrder)(t8.filter(es),tE).map(e=>{let t=(0,y.applyItemOrder)(e.children,tD[e.id]??[]).map(e=>{if("type"in e&&"group"===e.type){let t=e.items.map(e=>t5(e,t4)).filter(Boolean);return 0===t.length?null:1===t.length?t[0]:{...e,title:t3(e.titleKey,e.titleFallback),separatorHidden:t6.has(e.id),items:t}}return t5(e,t4)}).filter(Boolean);return{...e,title:t3(e.titleKey,e.titleFallback),children:t}}).filter(U),t9=t7.flatMap(B),re=Array.from(tB).map(e=>t9.find(t=>t.id===e)).filter(Boolean),rt=t7.findIndex($),rr=rt>=0?rt+1:0,rs={id:"pinned",titleKey:"pinnedSection",titleFallback:"Pinned",title:t3("pinnedSection","Pinned"),children:re},ra=re.length>0?[...t7.slice(0,rr),rs,...t7.slice(rr)]:t7,rl=function(e,t){let r=null;for(let s of t)if(!s.external&&function(e,t,r=!1){return!!e&&(r?e===t:e===t||e.startsWith(`${t}/`))}(e,s.href,!0===s.exact)){if(!r||s.href.length>r.href.length){r=s;continue}s.href.length===r.href.length&&s.exact&&!r.exact&&(r=s)}return r?.href||null}(tl,t9);e7[19]!==tX?(ea=tX.trim(),e7[19]=tX,e7[20]=ea):ea=e7[20];let ri=ea.length>0,rn=ri?function(e,t){let r=t.trim().toLowerCase();if(!r)return[...e];let s=e=>e.label.toLowerCase().includes(r),a=[];for(let t of e){let e=[];for(let r of t.children)if("object"==typeof r&&null!==r&&"type"in r&&"group"===r.type){let t=r.items.filter(s);t.length>0&&e.push({...r,items:t})}else s(r)&&e.push(r);e.length>0&&a.push({...t,children:e})}return a}(ra,tX):ra,ro=`${ts}|${tH}|${rl??""}|${[...tP].sort().join(",")}`,[rc,rd]=(0,a.useState)(null);if(ro!==rc&&(rd(ro),!ts&&tH)){if(tG)tJ(!1);else for(let e of t7)if(e.children.flatMap(P).some(e=>!e.external&&e.href===rl)){tM(t=>{let r=new Set([...tP,e.id]);return[...r].every(e=>t.has(e))&&r.size===t.size?t:r});break}}e7[21]!==tO||e7[22]!==tH?(el=()=>{tH&&C(N,[...tO])},ei=[tO,tH],e7[21]=tO,e7[22]=tH,e7[23]=el,e7[24]=ei):(el=e7[23],ei=e7[24]),(0,a.useEffect)(el,ei),e7[25]!==tP?(en=e=>{"pinned"===e?tq(M):tM(t=>(function(e,t,r){if(e.has(r)){let t=new Set(e);return t.delete(r),t}return new Set([...t,r])})(t,tP,e))},e7[25]=tP,e7[26]=en):en=e7[26];let ru=en;e7[27]===Symbol.for("react.memo_cache_sentinel")?(eo=e=>{t$(t=>{let r=new Set(t);return r.has(e)?r.delete(e):(r.add(e),tM(t=>{if(t.has(e))return t;let r=new Set(t);return r.add(e),r})),C(w,[...r]),r})},e7[27]=eo):eo=e7[27];let rm=eo;e7[28]===Symbol.for("react.memo_cache_sentinel")?(ec=e=>{tz(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),C(S,[...r]),r})},e7[28]=ec):ec=e7[28];let rx=ec;e7[29]===Symbol.for("react.memo_cache_sentinel")?(ed=async()=>{tp(!0);try{await fetch("/api/shutdown",{method:"POST"})}catch(e){}tp(!1),td(!1),tg(!0)},e7[29]=ed):ed=e7[29];let rp=ed;e7[30]===Symbol.for("react.memo_cache_sentinel")?(eu=async()=>{tb(!0);try{await fetch("/api/restart",{method:"POST"})}catch(e){}tb(!1),tm(!1),tg(!0),setTimeout(O,3e3)},e7[30]=eu):eu=e7[30];let rh=eu;e7[31]!==ts?(em=(e,t,r)=>{if(!ts)return;let s=e.currentTarget.getBoundingClientRect(),a=to.current?.getBoundingClientRect();tY({id:t,label:r,x:(a?.right??64)+8,y:s.top+s.height/2})},e7[31]=ts,e7[32]=em):em=e7[32];let rb=em;e7[33]===Symbol.for("react.memo_cache_sentinel")?(ex=()=>tY(null),e7[33]=ex):ex=e7[33];let rf=ex,rg=(e,t)=>{var s;let a,i=!e.external&&rl===e.href,o=tB.has(e.id),c=t?`${t}-${e.href}`:e.href,d=(0,n.cn)("flex items-center gap-3 rounded-lg transition-all group",ts?"justify-center px-2 py-2.5":"px-3 py-1.5",i?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),u=(0,n.cn)("material-symbols-outlined text-[18px] shrink-0",i?"fill-1":"group-hover/nav-item:text-primary transition-colors"),m=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:u,style:(s=e.id,{"
1--sidebar-icon-accent":a=(0,y.getSidebarIconAccent)(s),color:a}),children:e.icon}),!ts&&(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,r.jsx)("span",{className:"truncate text-sm font-medium",children:e.label}),e.subtitle&&(0,r.jsx)("span",{className:"truncate text-[10px] text-text-muted/60",children:e.subtitle})]})]}),x={onMouseEnter:t=>rb(t,e.id,e.label),onMouseLeave:rf};if(ts)return e.external?(0,r.jsx)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",onClick:e9,className:d,...x,children:m},c):(0,r.jsx)(l.default,{href:e.href,prefetch:!1,onClick:e9,className:d,...x,children:m},c);let p="home"!==e.id&&(0,r.jsx)("button",{type:"button",onClick:t=>{t.preventDefault(),t.stopPropagation(),rx(e.id)},title:o?ti("unpinItem"):ti("pinItem"),"aria-label":o?ti("unpinItem"):ti("pinItem"),className:(0,n.cn)("mr-1.5 p-0.5 rounded transition-all shrink-0",o?"text-primary opacity-100 hover:text-primary/80":"text-text-muted/30 opacity-0 group-hover/nav-item:opacity-100 hover:text-text-muted/80"),children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[13px]",style:{fontSize:"13px",...o?{fontVariationSettings:"'FILL' 1"}:{}},children:"push_pin"})}),h=(0,n.cn)("group/nav-item flex items-center rounded-lg transition-all",i?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main");return e.external?(0,r.jsxs)("div",{className:h,children:[(0,r.jsx)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",onClick:e9,className:"flex min-w-0 flex-1 items-center gap-3 px-3 py-1.5",...x,children:m}),p]},c):(0,r.jsxs)("div",{className:h,children:[(0,r.jsx)(l.default,{href:e.href,prefetch:!1,onClick:e9,className:"flex min-w-0 flex-1 items-center gap-3 px-3 py-1.5",...x,children:m}),p]},c)},ry=ts?"w-16":"w-[220px]";e7[34]!==ry?(ep=(0,n.cn)("flex h-full min-h-0 flex-col border-r border-black/5 bg-sidebar transition-all duration-300 ease-in-out dark:border-white/5",ry),e7[34]=ry,e7[35]=ep):ep=e7[35];let rv=ta?"var(--desktop-safe-top)":void 0;e7[36]!==rv?(eh={paddingTop:rv},e7[36]=rv,e7[37]=eh):eh=e7[37],e7[38]!==ti?(eb=ti("skipToContent"),e7[38]=ti,e7[39]=eb):eb=e7[39],e7[40]!==eb?(ef=(0,r.jsx)("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:p-3 focus:bg-primary focus:text-white focus:rounded-md focus:m-2",children:eb}),e7[40]=eb,e7[41]=ef):ef=e7[41],e7[42]!==ts||e7[43]!==ta||e7[44]!==tt||e7[45]!==ti?(eg=(tt||!ta)&&(0,r.jsxs)("div",{className:(0,n.cn)("flex items-center gap-2 pb-2",ta?"pt-3":"pt-5",ts?"px-3 justify-center":"px-4"),"aria-hidden":"true",children:[!ta&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),!ts&&(0,r.jsx)("div",{className:"flex-1"}),tt&&(0,r.jsx)("button",{onClick:tt,title:ts?ti("expandSidebar"):ti("collapseSidebar"),"aria-expanded":!ts,"aria-label":ts?ti("expandSidebar"):ti("collapseSidebar"),className:(0,n.cn)("rounded-md p-1 text-text-muted/50 transition-colors hover:bg-black/5 hover:text-text-muted dark:hover:bg-white/5",ts&&!ta&&"mt-2",ta&&"ms-auto"),children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:ts?"chevron_right":"chevron_left"})})]}),e7[42]=ts,e7[43]=ta,e7[44]=tt,e7[45]=ti,e7[46]=eg):eg=e7[46];let rj=ts?"px-2":"px-4";e7[47]!==rj?(ey=(0,n.cn)("py-3",rj),e7[47]=rj,e7[48]=ey):ey=e7[48];let rk=ts?"justify-center":"gap-2.5";e7[49]!==rk?(ev=(0,n.cn)("flex items-center",rk),e7[49]=rk,e7[50]=ev):ev=e7[50],e7[51]!==tA||e7[52]!==tR?(ej=(0,r.jsx)("div",{className:"flex items-center justify-center size-8 rounded bg-linear-to-br from-[#E54D5E] to-[#C93D4E] shrink-0",children:tR?(0,r.jsx)("img",{src:tR,alt:tA||o.APP_CONFIG.name,className:"size-5 object-contain"}):(0,r.jsx)(c.default,{size:18,className:"text-white"})}),e7[51]=tA,e7[52]=tR,e7[53]=ej):ej=e7[53],e7[54]!==ts||e7[55]!==tA?(ek=!ts&&(0,r.jsxs)("div",{className:"flex flex-col min-w-0",children:[(0,r.jsx)("h1",{className:"text-sm font-semibold tracking-tight text-text-main truncate",children:tA||o.APP_CONFIG.name}),(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:["v",o.APP_CONFIG.version]})]}),e7[54]=ts,e7[55]=tA,e7[56]=ek):ek=e7[56],e7[57]!==ev||e7[58]!==ej||e7[59]!==ek?(eN=(0,r.jsxs)(l.default,{href:"/home",prefetch:!1,className:ev,children:[ej,ek]}),e7[57]=ev,e7[58]=ej,e7[59]=ek,e7[60]=eN):eN=e7[60],e7[61]!==ey||e7[62]!==eN?(ew=(0,r.jsx)("div",{className:ey,children:eN}),e7[61]=ey,e7[62]=eN,e7[63]=ew):ew=e7[63],e7[64]!==ts||e7[65]!==tX||e7[66]!==tn?(eS=!ts&&(0,r.jsx)("div",{className:"px-4 pb-2",children:(0,r.jsx)(u.default,{type:"search",value:tX,onChange:e=>tQ(e.target.value),placeholder:tn("search"),"aria-label":tn("search"),icon:"search",className:"gap-0",inputClassName:"py-1.5 text-xs"})}),e7[64]=ts,e7[65]=tX,e7[66]=tn,e7[67]=eS):eS=e7[67],e7[68]!==ti?(e_=ti("mainNavigation"),e7[68]=ti,e7[69]=e_):e_=e7[69];let rN=ts?"px-2 space-y-0.5":"px-3";e7[70]!==rN?(eC=(0,n.cn)("min-h-0 flex-1 overflow-y-auto py-1 custom-scrollbar",rN),e7[70]=rN,e7[71]=eC):eC=e7[71];let rw=ri&&0===rn.length&&(0,r.jsx)("p",{className:"px-2 py-3 text-xs text-text-muted/60",children:tn("noResults")});e7[72]!==ts||e7[73]!==tO||e7[74]!==ri||e7[75]!==tU||e7[76]!==tP||e7[77]!==rg||e7[78]!==ti||e7[79]!==ru?(eT=(e,t)=>
1{let s=e.id,a=ri||("pinned"===s?!tU:tO.has(s)),l=tP.has(s),i=0===t,o=e.children.flatMap(F);return ts?(0,r.jsxs)("div",{children:[!i&&(0,r.jsx)("div",{className:"border-t border-black/5 dark:border-white/5 my-1.5"}),o.map(t=>rg(t,"pinned"===e.id?"pinned":void 0))]},e.id):!1===e.showTitle?(0,r.jsx)("div",{className:(0,n.cn)("space-y-0.5",!i&&"mt-1"),children:o.map(t=>rg(t,"pinned"===e.id?"pinned":void 0))},e.id):(0,r.jsxs)("div",{className:i?"space-y-0.5":"mt-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-0.5 px-2 py-1 rounded-md hover:bg-surface/30 transition-colors cursor-pointer group/header",onClick:()=>ru(s),role:"button","aria-expanded":a,children:[(0,r.jsx)("span",{className:"flex-1 text-[10px] font-semibold text-text-muted/60 uppercase tracking-wider group-hover/header:text-text-muted/90 transition-colors",children:e.title}),"pinned"!==s&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),rm(s)},title:l?ti("unpinSection"):ti("pinSectionOpen"),className:(0,n.cn)("p-0.5 rounded transition-all shrink-0",l?"text-primary opacity-100":"text-text-muted/30 opacity-0 group-hover/header:opacity-100 hover:text-text-muted/70"),children:(0,r.jsx)("span",{className:"material-symbols-outlined",style:{fontSize:"10px",...l?{fontVariationSettings:"'FILL' 1"}:{}},children:"push_pin"})}),(0,r.jsx)("span",{className:(0,n.cn)("material-symbols-outlined text-[14px] text-text-muted/40 transition-all duration-200 group-hover/header:text-text-muted/70 shrink-0",a&&"rotate-180"),children:"expand_more"})]}),a&&(0,r.jsx)("div",{className:"mt-0.5 space-y-0.5",children:e.children.map(t=>{if("group"===t.type){if(0===t.items.length)return null;let s=!0===t.separatorHidden;return(0,r.jsxs)("div",{className:s?"mt-0.5":"mt-2",children:[!s&&(0,r.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-0.5 mb-0.5",children:[(0,r.jsx)("div",{className:"h-px flex-1 bg-black/8 dark:bg-white/8"}),(0,r.jsx)("span",{className:"text-[8px] font-semibold text-text-muted/40 uppercase tracking-widest",children:t.title})]}),t.items.map(t=>rg(t,"pinned"===e.id?"pinned":void 0))]},t.id)}return rg(t,"pinned"===e.id?"pinned":void 0)})})]},e.id)},e7[72]=ts,e7[73]=tO,e7[74]=ri,e7[75]=tU,e7[76]=tP,e7[77]=rg,e7[78]=ti,e7[79]=ru,e7[80]=eT):eT=e7[80];let rS=rn.map(eT);e7[81]!==e_||e7[82]!==eC||e7[83]!==rw||e7[84]!==rS?(eE=(0,r.jsxs)("nav",{"aria-label":e_,className:eC,children:[rw,rS]}),e7[81]=e_,e7[82]=eC,e7[83]=rw,e7[84]=rS,e7[85]=eE):eE=e7[85],e7[86]!==ts?(eI=!j&&(0,r.jsx)(h,{collapsed:ts}),e7[86]=ts,e7[87]=eI):eI=e7[87];let r_=ts?"p-2 flex flex-col gap-1":"p-2 flex gap-2";e7[88]!==r_?(eD=(0,n.cn)("shrink-0 border-t border-black/5 dark:border-white/5",r_),e7[88]=r_,e7[89]=eD):eD=e7[89];let rC=ta?"calc(0.5rem + var(--desktop-safe-bottom))":void 0;e7[90]!==rC?(eL={paddingBottom:rC},e7[90]=rC,e7[91]=eL):eL=e7[91],e7[92]===Symbol.for("react.memo_cache_sentinel")?(eA=()=>tm(!0),e7[92]=eA):eA=e7[92],e7[93]!==ti?(eK=ti("restart"),e7[93]=ti,e7[94]=eK):eK=e7[94];let rT=ts?"p-2":"flex-1 min-w-0 px-2 py-1.5 text-xs";e7[95]!==rT?(eR=(0,n.cn)("flex items-center justify-center gap-2 rounded-lg font-medium transition-all","text-amber-500 hover:bg-amber-500/10 border border-amber-500/20 hover:border-amber-500/40",rT),e7[95]=rT,e7[96]=eR):eR=e7[96],e7[97]===Symbol.for("react.memo_cache_sentinel")?(eF=(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"restart_alt"}),e7[97]=eF):eF=e7[97],e7[98]!==ts||e7[99]!==ti?(eO=!ts&&(0,r.jsx)("span",{className:"truncate",children:ti("restart")}),e7[98]=ts,e7[99]=ti,e7[100]=eO):eO=e7[100],e7[101]!==eK||e7[102]!==eR||e7[103]!==eO?(eM=(0,r.jsxs)("button",{onClick:eA,title:eK,className:eR,children:[eF,eO]}),e7[101]=eK,e7[102]=eR,e7[103]=eO,e7[104]=eM):eM=e7[104],e7[105]===Symbol.for("react.memo_cache_sentinel")?(eP=()=>td(!0),e7[105]=eP):eP=e7[105],e7[106]!==ti?(e$=ti("shutdown"),e7[106]=ti,e7[107]=e$):e$=e7[107];let rE=ts?"p-2":"flex-1 min-w-0 px-2 py-1.5 text-xs";return e7[108]!==rE?(eB=(0,n.cn)("flex items-center justify-center gap-2 rounded-lg font-medium transition-all","text-red-500 hover:bg-red-500/10 border border-red-500/20 hover:border-red-500/40",rE),e7[108]=rE,e7[109]=eB):eB=e7[109],e7[110]===Symbol.for("react.memo_cache_sentinel")?(ez=(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"power_settings_new"}),e7[110]=ez):ez=e7[110],e7[111]!==ts||e7[112]!==ti?(eU=!ts&&(0,r.jsx)("span",{className:"truncate",children:ti("shutdown")}),e7[111]=ts,e7[112]=ti,e7[113]=eU):eU=e7[113],e7[114]!==e$||e7[115]!==eB||e7[116]!==eU?(eq=(0,r.jsxs)("button",{onClick:eP,title:e$,className:eB,children:[ez,eU]}),e7[114]=e$,e7[115]=eB,e7[116]=eU,e7[117]=eq):eq=e7[117],e7[118]!==eD||e7[119]!==eL||e7[120]!==eM||e7[121]!==eq?(eH=(0,r.jsxs)("div",{className:eD,style:eL,children:[eM,eq]}),e7[118]=eD,e7[119]=eL,e7[120]=eM,e7[121]=eq,e7[122]=eH):eH=e7[122],e7[123]!==ep||e7[124]!==eh||e7[125]!==ef||e7[126]!==eg||e7[127]!==ew||e7[128]!==eS||e7[129]!==eE||e7[130]!==eI||e7[131]!==eH?(eW=(0,r.jsxs)("aside",{ref:to,className:ep,style:eh,children:[ef,eg,ew,eS,eE,eI,eH]}),e7[123]=ep,e7[124]=eh,e7[125]=ef,e7[126]=eg,e7[127]=ew,e7[128]=eS,e7[129]=eE,e7[130]=eI,e7[131]=eH,e7[132]=eW):eW=e7[132],e7[133]!==ts||e7[134]!==tV?(eG=ts&&tV&&(0,r.jsxs)("div",{className:"fixed z-[200] pointer-events-none flex items-center",style:{left:tV.x,top:tV.y,transform:"translateY(-50%)"},children:[(0,r.jsx)("div",{className:"w-0 h-0 border-t-[5px] border-b-[5px] border-r-[6px] border-t-transparent border-b-transparent border-r-sidebar dark:border-r-sidebar"}),(0,r.jsx)("div",{className:"px-2.5 py-1.5 bg-sidebar text-text-main text-xs font-medium rounded-md shadow-lg border border-black/10 dark:border-white/10 whitespace-nowrap",children:tV.label})]}),e7[133]=ts,e7[134]=tV,e7[135]=eG):eG=e7[135],e7[136]===Symbol.for("react.memo_cache_sentinel")?(eJ=()=>td(!1),e7[136]=eJ):eJ=e7[136],e7[137]!==ti?(eV=ti("shutdown"),e7[137]=ti,e7[138]=eV):eV=e7[138],e7[139]!==ti?(eY=ti("shutdownConfirm"),e7[139]=ti,e7[140]=eY):eY=e7[140],e7[141]!==ti?(eX=ti("shutdown"),e7[141]=ti,e7[142]=eX):eX=e7[142],e7[143]!==tn?(eQ=tn("cancel"),e7[143]=tn,e7[144]=eQ):eQ=e7[144],e7[145]!==rp||e7[146]!==tx||e7[147]!==tc||e7[148]!==eV||e7[149]!==eY||e7[150]!==eX||e7[151]!==eQ?(eZ=(0,r.jsx)(m.ConfirmModal,{isOpen:tc,onClose:eJ,onConfirm:rp,title:eV,message:eY,confirmText:eX,cancelText:eQ,variant:"danger",loading:tx}),e7[145]=rp,e7[146]=tx,e7[147]=tc,e7[148]=eV,e7[149]=eY,e7[150]=eX,e7[151]=eQ,e7[152]=eZ):eZ=e7[152],e7[153]===Symbol.for("react.memo_cache_sentinel")?(e0=()=>tm(!1),e7[153]=e0):e0=e7[153],e7[154]!==ti?(e1=ti("restart"),e7[154]=ti,e7[155]=e1):e1=e7[155],e7[156]!==ti?(e2=ti("restartConfirm"),e7[156]=ti,e7[157]=e2):e2=e7[157],e7[158]!==ti?(e3=ti("restart"),e7[158]=ti,e7[159]=e3):e3=e7[159],e7[160]!==tn?(e5=tn("cancel"),e7[160]=tn,e7[161]=e5):e5=e7[161],e7[162]!==rh||e7[163]!==th||e7[164]!==tu||e7[165]!==e1||e7[166]!==e2||e7[167]!==e3||e7[168]!==e5?(e4=(0,r.jsx)(m.ConfirmModal,{isOpen:tu,onClose:e0,onConfirm:rh,title:e1,message:e2,confirmText:e3,cancelText:e5,variant:"warning",loading:th}),e7[162]=rh,e7[163]=th,e7[164]=tu,e7[165]=e1,e7[166]=e2,e7[167]=e3,e7[168]=e5,e7[169]=e4):e4=e7[169],e7[170
1]!==tf||e7[171]!==ti?(e6=tf&&(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:(0,r.jsxs)("div",{className:"text-center p-8",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-16 rounded-full bg-red-500/20 text-red-500 mx-auto mb-4",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"power_off"})}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:ti("serverDisconnected")}),(0,r.jsx)("p",{className:"text-text-muted mb-6",children:ti("serverDisconnectedMsg")}),(0,r.jsx)(d.default,{variant:"secondary",onClick:R,children:ti("reloadPage")})]})}),e7[170]=tf,e7[171]=ti,e7[172]=e6):e6=e7[172],e7[173]!==eW||e7[174]!==eG||e7[175]!==eZ||e7[176]!==e4||e7[177]!==e6?(e8=(0,r.jsxs)(r.Fragment,{children:[eW,eG,eZ,e4,e6]}),e7[173]=eW,e7[174]=eG,e7[175]=eZ,e7[176]=e4,e7[177]=e6,e7[178]=e8):e8=e7[178],e8}],647829)},897844,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(948148),a=e.i(287531),l=e.i(156132);e.s(["default",0,function(e){let i,n,o,c,d,u,m=(0,r.c)(18),{className:x,variant:p}=e,h=void 0===p?"default":p,{toggleTheme:b,isDark:f}=(0,a.useTheme)(),g=(0,s.useTranslations)("header");m[0]!==f||m[1]!==g?(i=g(f?"switchToLightMode":"switchToDarkMode"),m[0]=f,m[1]=g,m[2]=i):i=m[2];let y=i;if(m[3]!==x||m[4]!==b||m[5]!==h){let e={default:(0,l.cn)("flex items-center justify-center size-10 rounded-full","text-text-muted","hover:bg-black/5","hover:text-text-main","transition-colors"),card:(0,l.cn)("flex items-center justify-center size-11 rounded-full","bg-surface/60","hover:bg-surface","border border-border","backdrop-blur-md shadow-sm hover:shadow-md","text-text-muted-light hover:text-primary","hover:text-primary","transition-all group")};n=b,o=(0,l.cn)(e[h],x),m[3]=x,m[4]=b,m[5]=h,m[6]=n,m[7]=o}else n=m[6],o=m[7];let v="card"===h&&"transition-transform duration-300 group-hover:rotate-12";m[8]!==v?(c=(0,l.cn)("material-symbols-outlined text-[22px]",v),m[8]=v,m[9]=c):c=m[9];let j=f?"light_mode":"dark_mode";return m[10]!==c||m[11]!==j?(d=(0,t.jsx)("span",{className:c,children:j}),m[10]=c,m[11]=j,m[12]=d):d=m[12],m[13]!==n||m[14]!==o||m[15]!==d||m[16]!==y?(u=(0,t.jsx)("button",{onClick:n,className:o,"aria-label":y,title:y,children:d}),m[13]=n,m[14]=o,m[15]=d,m[16]=y,m[17]=u):u=m[17],u}])},932993,31954,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(948148),a=e.i(271645);let l={healthy:{icon:"check_circle",color:"var(--orch-status-success)",tooltipKey:"allHealthy"},warning:{icon:"warning",color:"var(--orch-status-warning)",tooltipKey:"needsAttention"},error:{icon:"error",color:"var(--orch-status-error)",tooltipKey:"refreshFailures"},unknown:{icon:"help",color:"var(--orch-status-muted)",tooltipKey:"unknown"}};e.s(["default",0,function(){let e,i,n,o,c,d,u,m,x,p,h,b=(0,r.c)(30),f=(0,s.useTranslations)("stats"),[g,y]=(0,a.useState)(null),[v,j]=(0,a.useState)(!1);if(b[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{let e=async()=>{try{let e=await fetch("/api/token-health");if(e.ok){let t=await e.json();y(t)}}catch{}};e();let t=setInterval(e,6e4);return()=>clearInterval(t)},i=[],b[0]=e,b[1]=i):(e=b[0],i=b[1]),(0,a.useEffect)(e,i),!g||0===g.total)return null;let k=l[g.status]||l.unknown;b[2]===Symbol.for("react.memo_cache_sentinel")?(n=()=>j(!0),o=()=>j(!1),b[2]=n,b[3]=o):(n=b[2],o=b[3]);let N=`tokenHealthTooltips.${k.tooltipKey}`;return b[4]!==f||b[5]!==N?(c=f(N),b[4]=f,b[5]=N,b[6]=c):c=b[6],b[7]!==k.color?(d={color:k.color},b[7]=k.color,b[8]=d):d=b[8],b[9]!==k.icon||b[10]!==d?(u=(0,t.jsx)("span",{className:"material-symbols-outlined text-[18px]",style:d,children:k.icon}),b[9]=k.icon,b[10]=d,b[11]=u):u=b[11],b[12]!==g.errored||b[13]!==k.color?(m=g.errored>0&&(0,t.jsx)("span",{className:"text-xs font-medium",style:{color:k.color},children:g.errored}),b[12]=g.errored,b[13]=k.color,b[14]=m):m=b[14],b[15]!==c||b[16]!==u||b[17]!==m?(x=(0,t.jsxs)("button",{className:"flex items-center gap-1 px-2 py-1.5 rounded-lg hover:bg-surface/30 transition-colors",title:c,children:[u,m]}
1),b[15]=c,b[16]=u,b[17]=m,b[18]=x):x=b[18],b[19]!==g.errored||b[20]!==g.healthy||b[21]!==g.lastCheckAt||b[22]!==g.total||b[23]!==g.warning||b[24]!==v||b[25]!==f?(p=v&&(0,t.jsxs)("div",{className:"absolute top-full right-0 mt-1 z-50 min-w-[200px] p-3 rounded-lg shadow-lg",style:{background:"rgba(15, 15, 25, 0.95)",border:"1px solid rgba(255,255,255,0.1)",backdropFilter:"blur(12px)"},children:[(0,t.jsx)("p",{className:"text-xs font-medium text-text-main mb-2",children:f("tokenHealth")}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{className:"text-text-muted",children:f("totalOAuth")}),(0,t.jsx)("span",{className:"text-text-main",children:g.total})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{className:"text-emerald-400",children:f("healthy")}),(0,t.jsx)("span",{className:"text-text-main",children:g.healthy})]}),g.errored>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{className:"text-red-400",children:f("errored")}),(0,t.jsx)("span",{className:"text-text-main",children:g.errored})]}),g.warning>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{className:"text-amber-400",children:f("warning")}),(0,t.jsx)("span",{className:"text-text-main",children:g.warning})]}),g.lastCheckAt&&(0,t.jsxs)("div",{className:"flex justify-between mt-1 pt-1 border-t border-white/5",children:[(0,t.jsx)("span",{className:"text-text-muted",children:f("lastCheck")}),(0,t.jsx)("span",{className:"text-text-muted",children:new Date(g.lastCheckAt).toLocaleTimeString()})]})]})]}),b[19]=g.errored,b[20]=g.healthy,b[21]=g.lastCheckAt,b[22]=g.total,b[23]=g.warning,b[24]=v,b[25]=f,b[26]=p):p=b[26],b[27]!==p||b[28]!==x?(h=(0,t.jsxs)("div",{className:"relative",onMouseEnter:n,onMouseLeave:o,children:[x,p]}),b[27]=p,b[28]=x,b[29]=h):h=b[29],h}],932993);var i=e.i(522016);e.s(["default",0,function(){let e,l,n,o,c,d,u,m=(0,r.c)(12),[x,p]=(0,a.useState)(!1),h=(0,s.useTranslations)("common");return(m[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{let e=async()=>{try{let e=await fetch("/api/health/degradation?summary=true");if(e.ok){let t=await e.json();p(t.isDegraded)}}catch(e){}};e();let t=setInterval(e,6e4);return()=>clearInterval(t)},l=[],m[0]=e,m[1]=l):(e=m[0],l=m[1]),(0,a.useEffect)(e,l),x)?(m[2]!==h?(n=h("warning"),m[2]=h,m[3]=n):n=m[3],m[4]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"healing"}),m[4]=o):o=m[4],m[5]!==h?(c=h("degraded"),m[5]=h,m[6]=c):c=m[6],m[7]!==c?(d=(0,t.jsx)("span",{className:"text-xs font-semibold whitespace-nowrap",children:c}),m[7]=c,m[8]=d):d=m[8],m[9]!==n||m[10]!==d?(u=(0,t.jsxs)(i.default,{href:"/dashboard/health",className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-amber-500/10 text-amber-500 hover:bg-amber-500/20 transition-colors border border-amber-500/20",title:n,children:[o,d]}),m[9]=n,m[10]=d,m[11]=u):u=m[11],u):null}],31954)},698189,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(948148),a=e.i(703166),l=e.i(342923),i=e.i(80173);async function n(e=fetch){try{let t=await e("/api/oauth/trae/authorize-state",{method:"POST",signal:AbortSignal.timeout(15e3)}),r=await t.json().catch(()=>null);if(t.ok&&"string"==typeof r?.state)return{ok:!0,state:r.state};let s="string"==typeof r?.error?.message?r.error.message:"string"==typeof r?.error?r.error:null;return{ok:!1,message:s||`HTTP ${t.status}`}}catch{return{ok:!1,message:null}}}e.s(["default",0,function({isOpen:e,onSuccess:o,onClose:c,reauthConnection:d}){let u=(0,s.useTranslations)("traeAuthModal"),[m,x]=(0,r.useState)(""),[p,h]=(0,r.useState)(""),[b,f]=(0,r.useState)(""),[g,y]=(0,r.useState)(""),[v,j]=(0,r.useState)("marscode-us"),[k,N]=(0,r.useState)("marscode"),[w,S]=(0,r.useState)("US-East"),[_,C]=(0,r.useState)(null),[T,E]=(0,r.useState)(!1),[I,D]=(0,r.useState)(!1),L=(0,r.useRef)(null),A=(0,r.useRef)(null);(0,r.useEffect)(()=>{if(!e)return;let t=e=>{let t=e.data;if(!t||"trae-oauth-callback"!==t.type)return;let r=window.location,s="127.0.0.1"===r.hostname?"localhost":"localhost"===r.hostname?"127.0.0.1":null,a=new Set([r.origin]);s&&a.add(`${r.protocol}//${s}${r.port?`:${r.port}`:""}`),!a.has(e.origin)||A.current&&t.loginTraceId===A.current&&(D(!1),t.success?(o?.(),c()):C(t.error||u("errorAuthorizationFailed")))};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[e,o,c,u]);let K=async()=>{let e,t,r,s;C(null),D(!0);let a=window.open("","trae-oauth","width=520,height=720");if(!a){D(!1),C(u("errorPopupBlocked"));return}L.current=a;let l=await n();if(!1===l.ok){a.close(),D(!1),C(l.message||u("errorAuthorizationFailed"));return}let i=l.state;A.current=i;let o=window.location.port||("https:"===window.location.protocol?"443":"80"),c=`http://127.0.0.1:${o}
1/authorize`;a.location.href=(e=new Uint8Array(32),(globalThis.crypto||globalThis.crypto).getRandomValues(e),t=Array.from(e,e=>e.toString(16).padStart(2,"0")).join(""),s=new URLSearchParams({login_version:"1",auth_from:"solo",login_channel:"native_ide",plugin_version:"2.3.24254",auth_type:"local",client_id:"en1oxy7wnw8j9n",redirect:"0",login_trace_id:i,auth_callback_url:c,machine_id:t,device_id:r=function(){let e="";for(;e.length<19;)e+=Math.floor(1e10*Math.random()).toString();return e.slice(0,19)}(),x_device_id:r,x_machine_id:t,x_device_brand:"Mac14,7",x_device_type:"mac",x_os_version:"macOS 26.4.1",x_env:"",x_app_version:"0.1.7",x_app_type:"stable",hide_saas_login:"true"}),`https://www.trae.ai/authorization?${s.toString()}`);let d=setInterval(()=>{a.closed&&(clearInterval(d),D(e=>(e&&C(u("errorPopupClosed")),!1)))},700)},R=async()=>{if(!m.trim())return void C(u("errorAccessTokenRequired"));E(!0),C(null);try{let e={accessToken:m.trim()};p.trim()&&(e.webId=p.trim()),b.trim()&&(e.bizUserId=b.trim()),g.trim()&&(e.userUniqueId=g.trim()),v.trim()&&(e.scope=v.trim()),k.trim()&&(e.tenant=k.trim()),w.trim()&&(e.region=w.trim());let t=await fetch("/api/oauth/trae/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await t.json();if(!t.ok)throw Error("string"==typeof r.error?r.error:r.error?.message||u("errorImportFailed"));o?.(),c()}catch(e){C(e instanceof Error?e.message:String(e))}finally{E(!1)}};return(0,t.jsx)(a.default,{isOpen:e,title:u("title"),onClose:c,children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"bg-emerald-50 dark:bg-emerald-900/20 p-4 rounded-lg border border-emerald-200 dark:border-emerald-800",children:[(0,t.jsx)("p",{className:"text-sm text-emerald-900 dark:text-emerald-200 mb-2",children:u.rich("authorizeDescription",{code:e=>(0,t.jsx)("span",{className:"font-mono",children:e})})}),(0,t.jsx)("p",{className:"text-xs text-emerald-800 dark:text-emerald-300 mb-3",children:u.rich("authorizeImportant",{strong:e=>(0,t.jsx)("strong",{children:e}),code:e=>(0,t.jsx)("span",{className:"font-mono",children:e}),em:e=>(0,t.jsx)("em",{children:e})})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(l.default,{onClick:K,disabled:I,fullWidth:!0,children:I?u("waitingForAuthorization"):u("authorizeWithBrowser")}),(0,t.jsx)(l.default,{onClick:()=>window.open("https://solo.trae.ai/","_blank","noopener,noreferrer"),variant:"ghost",fullWidth:!0,children:u("openSoloTrae")})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 text-xs text-text-muted",children:[(0,t.jsx)("span",{className:"flex-1 border-t border-border"}),u("orPasteManually"),(0,t.jsx)("span",{className:"flex-1 border-t border-border"})]}),(0,t.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,t.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:u.rich("manualInstructions",{code:e=>(0,t.jsx)("span",{className:"font-mono",children:e}),tokenPlaceholder:"<token>"})})}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:[u("accessTokenLabel")," ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("textarea",{value:m,onChange:e=>x(e.target.value),placeholder:"eyJhbGciOiJSUzI1NiIs...",rows:3,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-1",children:[u("webId")," ",(0,t.jsx)("span",{className:"text-text-muted text-xs",children:u("optional")})]}),(0,t.jsx)(i.default,{value:p,onChange:e=>h(e.target.value),placeholder:"76428...",className:"font-mono text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-1",children:[u("bizUserId")," ",(0,t.jsx)("span",{className:"text-text-muted text-xs",children:u("optional")})]}),(0,t.jsx)(i.default,{value:b,onChange:e=>f(e.target.value),placeholder:"76428...",className:"font-mono text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-1",children:[u("userUniqueId")," ",(0,t.jsx)("span",{className:"text-text-muted text-xs",children:u("optional")})]}),(0,t.jsx)(i.default,{value:g,onChange:e=>y(e.target.value),placeholder:"76428...",className:"font-mono text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium mb-1",children:u("scope")}
1),(0,t.jsx)(i.default,{value:v,onChange:e=>j(e.target.value),className:"text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium mb-1",children:u("tenant")}),(0,t.jsx)(i.default,{value:k,onChange:e=>N(e.target.value),className:"text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium mb-1",children:u("region")}),(0,t.jsx)(i.default,{value:w,onChange:e=>S(e.target.value),className:"text-sm"})]})]}),_&&(0,t.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,t.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:_})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(l.default,{onClick:R,fullWidth:!0,disabled:T||!m.trim(),children:T?u("importing"):u("importToken")}),(0,t.jsx)(l.default,{onClick:c,variant:"ghost",fullWidth:!0,children:u("cancel")})]})]})})}],698189)},566770,439263,801646,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(861745),a=e.i(948148),l=e.i(393718),i=e.i(454149),n=e.i(243009),o=e.i(866213),c=e.i(500932),d=e.i(174080);function u(e){let s,a,l,i,n,o,u,m,x,p,h,b,f=(0,c.c)(35),{children:g,content:y,position:v,className:j,tooltipClassName:k,delayMs:N,usePortal:w,multiline:S}=e,_=void 0===v?"top":v,C=void 0===N?200:N,T=void 0===w||w,[E,I]=(0,r.useState)(!1),D=(0,r.useId)(),L=(0,r.useRef)(null),A=(0,r.useRef)(null),K=(0,r.useRef)(null);f[0]!==C?(s=()=>{clearTimeout(L.current),L.current=setTimeout(()=>I(!0),C)},f[0]=C,f[1]=s):s=f[1];let R=s;f[2]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{clearTimeout(L.current),I(!1)},f[2]=a):a=f[2];let F=a;f[3]===Symbol.for("react.memo_cache_sentinel")?(i=()=>()=>{clearTimeout(L.current)},l=[],f[3]=l,f[4]=i):(l=f[3],i=f[4]),(0,r.useEffect)(i,l),f[5]!==_||f[6]!==T||f[7]!==E?(n=()=>{let e,t;if(!E||!T)return;let r=A.current,s=K.current;if(!r||!s)return;let a=r.getBoundingClientRect(),l=s.getBoundingClientRect();switch(_){case"bottom":e=a.bottom+8,t=a.left+a.width/2-l.width/2;break;case"left":e=a.top+a.height/2-l.height/2,t=a.left-l.width-8;break;case"right":e=a.top+a.height/2-l.height/2,t=a.right+8;break;default:e=a.top-l.height-8,t=a.left+a.width/2-l.width/2}let i=window.innerWidth-l.width-8;t>i&&(t=i),t<8&&(t=8),s.style.transition="none",s.style.top=`${e}px`,s.style.left=`${t}px`,s.style.visibility="visible",s.style.opacity="1"},f[5]=_,f[6]=T,f[7]=E,f[8]=n):n=f[8],f[9]!==y||f[10]!==_||f[11]!==T||f[12]!==E?(o=[E,T,_,y],f[9]=y,f[10]=_,f[11]=T,f[12]=E,f[13]=o):o=f[13],(0,r.useLayoutEffect)(n,o),f[14]===Symbol.for("react.memo_cache_sentinel")?(u={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},f[14]=u):u=f[14];let O=u,M=y?D:void 0;if(f[15]!==g||f[16]!==M){let e;m=(0,r.isValidElement)(g)?(e=[g.props["aria-describedby"],M].filter(Boolean).join(" "),(0,r.cloneElement)(g,{"aria-describedby":e||void 0})):(0,t.jsx)("span",{tabIndex:0,"aria-describedby":M,children:g}),f[15]=g,f[16]=M,f[17]=m}else m=f[17];let P=m,$=void 0!==S&&S?"max-w-xs whitespace-normal break-words":"whitespace-nowrap",B=`z-50 px-3 py-2 text-xs font-medium text-white bg-[#10141e]/95 rounded-lg shadow-xl pointer-events-none transition-opacity duration-150 motion-reduce:transition-none border border-white/10 backdrop-blur-sm ${void 0===k?"":k}`,z=T&&!0;f[18]!==B||f[19]!==y||f[20]!==z||f[21]!==_||f[22]!==D||f[23]!==E||f[24]!==$?(x=E&&y?(0,t.jsx)("div",{ref:K,id:D,role:"tooltip",className:z?`fixed ${B} ${$}`:`absolute ${B} ${$} ${O[_]||O.top}`,style:z?{top:-9999,left:-9999,visibility:"hidden",opacity:0}:void 0,children:y}):null,f[18]=B,f[19]=y,f[20]=z,f[21]=_,f[22]=D,f[23]=E,f[24]=$,f[25]=x):x=f[25];let U=x,q=`relative inline-flex ${void 0===j?"":j}`;return f[26]===Symbol.for("react.memo_cache_sentinel")?(p=e=>{"Escape"===e.key&&F()},f[26]=p):p=f[26],f[27]!==z||f[28]!==U?(h=z&&U?(0,d.createPortal)(U,document.body):U,f[27]=z,f[28]=U,f[29]=h):h=f[29],f[30]!==R||f[31]!==q||f[32]!==h||f[33]!==P?(b=(0,t.jsxs)("span",{ref:A,className:q,onMouseEnter:R,onMouseLeave:F,onFocus:R,onBlur:F,onKeyDown:p,children:[P,h]}),f[30]=R,f[31]=q,f[32]=h,f[33]=P,f[34]=b):b=f[34],b}e.s(["default",0,u],439263);let m=["#f59e0b","#ef4444","#8b5cf6","#10b981","#06b6d4","#ec4899","#f97316","#6366f1","#14b8a6","#a855f7"],x={priority:"serviceTierFast",flex:"serviceTierFlex",standard:"serviceTierStandard"},p={priority:"Fast",flex:"Flex",standard:"Standard"};function h(e){let t="string"==typeof e?e.trim().toLowerCase():"";return"priority"===t||"fast"===t?"priority":"flex"===t?"flex":"standard"}function b(e,t,r){return"function"==typeof e.has&&e.has(t)?e(t):r}function f(e,t,r){let s=h(t),a="string"==typeof r?r.trim():"",l=a&&h(a)!==s?a:p[s];return b(e,x[s],l)}e.s(["getServiceTierDisplayLabel",0,f,"translateCostText",0,b],801646);var g=e.i(484124);let y=new Set(["model"]),v=[{field:"model",labelKey:"chartModel",align:"left"},{field:"requests",labelKey:"chartRequests",align:"right"},{field:"promptTokens",labelKey:"chartInput",align:"right"},{field:"completionTokens",labelKey:"chartOutput",align:"right"},{field:"totalTokens",labelKey:"chartTotal",align:"right"},{field:"cost",labelKey:"chartCost",align:"right"}];function j(e){let r,s=(0,c.c)(3),{active:a,sortOrder:l}=e;if(!a){let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px] opacity-0 group-hover:opacity-30",children:"unfold_more"}),s[0]=e):e=s[0],e}let i="asc"===l?"expand_less":"expand_more";return s[1]!==i?(r=(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px] text-primary",children:i}),s[1]=i,s[2]=r):r=s[2],r}function k(e){var s,i;
1let n,o,d,u,m,x,p,h,b,f,g,k,w,S,_=(0,c.c)(34),{byModel:C,summary:T}=e,E=(0,a.useTranslations)("analytics");_[0]===Symbol.for("react.memo_cache_sentinel")?(n={by:"totalTokens",order:"desc"},_[0]=n):n=_[0];let[I,D]=(0,r.useState)(n);_[1]===Symbol.for("react.memo_cache_sentinel")?(o=e=>{D(t=>{var r,s;let a=(r=t.by,s=t.order,r===e?{sortBy:e,sortOrder:"asc"===s?"desc":"asc"}:{sortBy:e,sortOrder:"desc"});return{by:a.sortBy,order:a.sortOrder}})},_[1]=o):o=_[1];let L=o;T?.totalTokens;let A=T?.totalTokens;if(_[2]!==C||_[3]!==A){let e;e=Number(A??0),d=(C||[]).map(t=>{if(void 0!==t.pct&&null!==t.pct&&""!==t.pct)return{...t};let r=Number(t.totalTokens??0),s=e>0?(r/e*100).toFixed(1):"0";return{...t,pct:s}}),_[2]=C,_[3]=A,_[4]=d}else d=_[4];let K=d;if(_[5]!==K||_[6]!==I.by||_[7]!==I.order){let e;s=I.by,i=I.order,(e=[...K||[]]).sort((e,t)=>{let r=e[s],a=t[s];if(y.has(s)||"string"==typeof r||"string"==typeof a){let e=String(r??""),t=String(a??""),s=e.localeCompare(t,void 0,{sensitivity:"base",numeric:!0});return"asc"===i?s:-s}let l=Number(r??0),n=Number(a??0),o=Number.isFinite(l)?l:0,c=Number.isFinite(n)?n:0;return"asc"===i?o-c:c-o}),u=e,_[5]=K,_[6]=I.by,_[7]=I.order,_[8]=u}else u=_[8];let R=u;return _[9]!==E?(m=E("chartModelBreakdown"),_[9]=E,_[10]=m):m=_[10],_[11]!==m?(x=(0,t.jsx)("div",{className:"p-4 border-b border-border",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-muted uppercase tracking-wider",children:m})}),_[11]=m,_[12]=x):x=_[12],_[13]!==I.by||_[14]!==I.order||_[15]!==E?(p=v.map(e=>(0,t.jsx)("th",{className:`px-4 py-2.5 ${"right"===e.align?"text-right":"text-left"}`,children:(0,t.jsxs)("button",{type:"button",className:`inline-flex items-center gap-1 cursor-pointer group hover:text-text-main ${"right"===e.align?"justify-end w-full":"justify-start"}`,onClick:()=>L(e.field),children:[(0,t.jsx)("span",{children:E(e.labelKey)}),(0,t.jsx)(j,{active:I.by===e.field,sortOrder:I.order})]})},e.field)),_[13]=I.by,_[14]=I.order,_[15]=E,_[16]=p):p=_[16],_[17]!==E?(h=E("chartShare"),_[17]=E,_[18]=h):h=_[18],_[19]!==h?(b=(0,t.jsx)("th",{className:"px-4 py-2.5 text-right w-36",children:h}),_[19]=h,_[20]=b):b=_[20],_[21]!==b||_[22]!==p?(f=(0,t.jsx)("thead",{className:"text-xs text-text-muted uppercase bg-black/[0.02] dark:bg-white/[0.02]",children:(0,t.jsxs)("tr",{children:[p,b]})}),_[21]=b,_[22]=p,_[23]=f):f=_[23],_[24]!==R?(g=R.map(N),_[24]=R,_[25]=g):g=_[25],_[26]!==g?(k=(0,t.jsx)("tbody",{className:"divide-y divide-border",children:g}),_[26]=g,_[27]=k):k=_[27],_[28]!==f||_[29]!==k?(w=(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm",children:[f,k]})}),_[28]=f,_[29]=k,_[30]=w):w=_[30],_[31]!==w||_[32]!==x?(S=(0,t.jsxs)(l.default,{className:"overflow-hidden",children:[x,w]}),_[31]=w,_[32]=x,_[33]=S):S=_[33],S}function N(e,r){return(0,t.jsxs)("tr",{className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,t.jsx)("td",{className:"px-4 py-2.5",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:(0,g.getModelColor)(r)}}),(0,t.jsx)("span",{className:"font-medium",children:e.model})]})}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono text-text-muted",children:(0,n.fmtFull)(e.requests)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono text-primary",title:(0,n.fmtFull)(e.promptTokens),children:(0,n.fmtCompact)(e.promptTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono text-emerald-500",title:(0,n.fmtFull)(e.completionTokens),children:(0,n.fmtCompact)(e.completionTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono font-semibold",title:(0,n.fmtFull)(e.totalTokens),children:(0,n.fmtCompact)(e.totalTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono text-amber-500",children:(0,n.fmtCost)(e.cost)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,t.jsx)("div",{className:"w-16 h-1.5 rounded-full bg-white/[0.06] overflow-hidden",children:(0,t.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${e.pct??0}%`,backgroundColor:(0,g.getModelColor)(r)}})}),(0,t.jsxs)("span",{className:"text-xs font-mono text-text-muted w-10 text-right",children:[e.pct??0,"%"]})]})})]},String(e.model??r))}function w(e,t){try{return new Intl.DateTimeFormat(e,t)}catch{return new Intl.DateTimeFormat(void 0,t)}}function S(e){let r,s=(0,c.c)(3),{active:a,sortOrder:l}=e;if(!a){let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px] opacity-0 group-hover:opacity-30",children:"unfold_more"}),s[0]=e):e=s[0],e}let i="asc"===l?"expand_less":"expand_more";return s[1]!==i?(r=(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px] text-primary",children:i}),s[1]=i,s[2]=r):r=s[2],r}
1function _(e){let r,s,a,i,n,o,d,m=(0,c.c)(23),{icon:x,label:p,value:h,subValue:b,tooltip:f,color:g}=e,y=void 0===g?"text-text-main":g,v=String(p).toLowerCase().includes("cost"),j=f?String(f).includes(":")?f:v?`cost : ${String(f).startsWith("$")?f:`$${f}`}`:`tokens : ${f} tokens`:null,k=`text-2xl font-bold ${y} truncate cursor-default`,N=f?void 0:String(h);m[0]!==k||m[1]!==N||m[2]!==f||m[3]!==h?(r=(0,t.jsx)("span",{className:k,"data-tooltip":f,title:N,children:h}),m[0]=k,m[1]=N,m[2]=f,m[3]=h,m[4]=r):r=m[4];let w=r;return m[5]!==x?(s=(0,t.jsx)("span",{className:"material-symbols-outlined text-[14px] shrink-0",children:x}),m[5]=x,m[6]=s):s=m[6],m[7]!==p?(a=(0,t.jsx)("span",{className:"truncate",children:p}),m[7]=p,m[8]=a):a=m[8],m[9]!==s||m[10]!==a?(i=(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-text-muted text-[11px] uppercase font-semibold tracking-wide min-w-0",children:[s,a]}),m[9]=s,m[10]=a,m[11]=i):i=m[11],m[12]!==y||m[13]!==p||m[14]!==j||m[15]!==w?(n=j?(0,t.jsx)(u,{content:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 text-left py-0.5 min-w-[140px]",children:[(0,t.jsx)("div",{className:"font-semibold text-white/95 text-xs",children:p}),(0,t.jsx)("div",{className:`font-mono text-xs ${y&&"text-text-main"!==y?y:"text-violet-400"} tracking-wide`,children:j})]}),className:"w-fit max-w-full",delayMs:150,children:w}):w,m[12]=y,m[13]=p,m[14]=j,m[15]=w,m[16]=n):n=m[16],m[17]!==b?(o=b&&(0,t.jsx)("span",{className:"text-xs text-text-muted truncate",children:b}),m[17]=b,m[18]=o):o=m[18],m[19]!==i||m[20]!==n||m[21]!==o?(d=(0,t.jsxs)(l.default,{className:"px-4 py-3 flex flex-col gap-1 min-w-0",children:[i,n,o]}),m[19]=i,m[20]=n,m[21]=o,m[22]=d):d=m[22],d}function C(e){let r,s,a=(0,c.c)(4),{sections:i}=e;return a[0]!==i?(r=i.map(T),a[0]=i,a[1]=r):r=a[1],a[2]!==r?(s=(0,t.jsx)(l.default,{className:"px-5 py-4",children:(0,t.jsx)("div",{className:"flex flex-col gap-3",children:r})}),a[2]=r,a[3]=s):s=a[3],s}function T(e,r){return(0,t.jsxs)("div",{children:[r>0&&(0,t.jsx)("div",{className:"border-t border-black/[0.06] dark:border-white/[0.06] mb-3"}),(0,t.jsx)("div",{className:"text-[10px] uppercase font-semibold tracking-widest text-text-muted/50 mb-2",children:e.title}),(0,t.jsx)("div",{className:e.wideValues?"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-x-5 gap-y-2":"grid grid-cols-2 md:grid-cols-4 gap-x-5 gap-y-2",children:e.items.map((r,s)=>{let a=(0,t.jsx)("span",{className:`text-sm font-bold text-right cursor-default ${e.wideValues?"truncate min-w-0":"shrink-0"} ${r.color||"text-text-main"}`,"data-tooltip":r.tooltip,title:r.tooltip?void 0:String(r.value),children:r.value});return(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 min-w-0 py-0.5",children:[(0,t.jsxs)("div",{className:`flex items-center gap-1.5 ${e.wideValues?"shrink-0":"min-w-0"}`,children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted shrink-0",children:r.icon}),(0,t.jsx)("span",{className:`text-[11px] uppercase font-semibold tracking-wide text-text-muted ${e.wideValues?"whitespace-nowrap":"truncate"}`,children:r.label})]}),r.tooltip?(0,t.jsx)(u,{content:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 text-left py-0.5 min-w-[120px]",children:[(0,t.jsx)("div",{className:"font-semibold text-white/95 text-xs",children:r.label}),(0,t.jsx)("div",{className:`font-mono text-xs ${r.color||"text-violet-400"} tracking-wide`,children:String(r.tooltip).includes(":")?r.tooltip:`${r.label.toLowerCase().includes("cost")?"cost":"tokens"} : ${r.tooltip}`})]}),className:e.wideValues?"truncate min-w-0":"shrink-0",delayMs:150,children:a}):a]},s)})})]},r)}function E(e){let i,o,d,u,m,x,p,h,b,f,g,y,v,j,k,N,S,_,C,T,E,A,K,R,F,O,M,P,$,B,z,U,q,H,W,G,J,V,Y,X,Q=(0,c.c)(81),{activityMap:Z}=e,ee=(0,a.useTranslations)("analytics"),et=(0,s.useLocale)(),er=(0,r.useRef)(null);Q[0]!==et?(i=w(et,{month:"short"}),Q[0]=et,Q[1]=i):i=Q[1];let es=i;Q[2]!==et?(o=w(et,{weekday:"short"}),Q[2]=et,Q[3]=o):o=Q[3];let ea=o;if(Q[4]!==Z){let e=new Date,t=[],r=0;for(let s=364;s>=0;s--){let a=new Date(e);a.setDate(a.getDate()-s);let l=`${a.getFullYear()}
1-${String(a.getMonth()+1).padStart(2,"0")}-${String(a.getDate()).padStart(2,"0")}`,i=Z?.[l]||0;i>r&&(r=i),t.push({date:l,value:i,dayOfWeek:a.getDay()})}d={days:t,maxVal:r},Q[4]=Z,Q[5]=d}else d=Q[5];let el=d;if(Q[6]!==el.days){u=[];let e=[],t=el.days[0]?.dayOfWeek||0;for(let r=0;r<t;r++)e.push(null);for(let t of el.days)e.push(t),7===e.length&&(u.push(e),e=[]);e.length>0&&u.push(e),Q[6]=el.days,Q[7]=u}else u=Q[7];let ei=u;if(Q[8]===Symbol.for("react.memo_cache_sentinel")?(m=()=>{er.current&&(er.current.scrollLeft=er.current.scrollWidth)},Q[8]=m):m=Q[8],Q[9]!==ei?(x=[ei],Q[9]=ei,Q[10]=x):x=Q[10],(0,r.useEffect)(m,x),Q[11]!==es||Q[12]!==ei){p=[];let e=-1;ei.forEach((t,r)=>{let s=t.find(L);if(s){let t=new Date(s.date).getMonth();t!==e&&(p.push({weekIdx:r,label:es.format(new Date(2024,t,1))}),e=t)}}),Q[11]=es,Q[12]=ei,Q[13]=p}else p=Q[13];let en=p;Q[14]===Symbol.for("react.memo_cache_sentinel")?(h=[1,3,5],Q[14]=h):h=Q[14],Q[15]!==ea?(b=h.map(e=>ea.format(new Date(2024,0,7+e))),Q[15]=ea,Q[16]=b):b=Q[16];let eo=b;Q[17]!==el?(f=function(e){if(!e||0===e)return"bg-white/[0.04]";let t=Math.min(e/(el.maxVal||1),1);return t<.25?"bg-primary/20":t<.5?"bg-primary/40":t<.75?"bg-primary/60":"bg-primary/90"},Q[17]=el,Q[18]=f):f=Q[18];let ec=f;return Q[19]!==ee?(g=ee("overview"),Q[19]=ee,Q[20]=g):g=Q[20],Q[21]!==g?(y=(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-muted uppercase tracking-wider",children:g}),Q[21]=g,Q[22]=y):y=Q[22],Q[23]!==Z?(v=Object.keys(Z||{}),Q[23]=Z,Q[24]=v):v=Q[24],Q[25]!==Z||Q[26]!==ee||Q[27]!==v.length?(j=ee("activitySummary",{active:v.length,tokens:(0,n.fmtCompact)(Object.values(Z||{}).reduce(D,0)),days:365}),Q[25]=Z,Q[26]=ee,Q[27]=v.length,Q[28]=j):j=Q[28],Q[29]!==j?(k=(0,t.jsx)("span",{className:"text-xs text-text-muted",children:j}),Q[29]=j,Q[30]=k):k=Q[30],Q[31]!==y||Q[32]!==k?(N=(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[y,k]}),Q[31]=y,Q[32]=k,Q[33]=N):N=Q[33],Q[34]===Symbol.for("react.memo_cache_sentinel")?(S={fontSize:"10px"},Q[34]=S):S=Q[34],Q[35]!==en?(_=(0,t.jsx)("div",{className:"flex gap-[3px] mb-1 ml-6",style:S,children:en.map(I)}),Q[35]=en,Q[36]=_):_=Q[36],Q[37]===Symbol.for("react.memo_cache_sentinel")?(C=(0,t.jsx)("span",{className:"h-[10px]"}),Q[37]=C):C=Q[37],Q[38]!==eo[0]?(T=(0,t.jsx)("span",{className:"h-[10px] leading-[10px]",children:eo[0]}),Q[38]=eo[0],Q[39]=T):T=Q[39],Q[40]===Symbol.for("react.memo_cache_sentinel")?(E=(0,t.jsx)("span",{className:"h-[10px]"}),Q[40]=E):E=Q[40],Q[41]!==eo[1]?(A=(0,t.jsx)("span",{className:"h-[10px] leading-[10px]",children:eo[1]}),Q[41]=eo[1],Q[42]=A):A=Q[42],Q[43]===Symbol.for("react.memo_cache_sentinel")?(K=(0,t.jsx)("span",{className:"h-[10px]"}),Q[43]=K):K=Q[43],Q[44]!==eo[2]?(R=(0,t.jsx)("span",{className:"h-[10px] leading-[10px]",children:eo[2]}),Q[44]=eo[2],Q[45]=R):R=Q[45],Q[46]===Symbol.for("react.memo_cache_sentinel")?(F=(0,t.jsx)("span",{className:"h-[10px]"}),Q[46]=F):F=Q[46],Q[47]!==T||Q[48]!==A||Q[49]!==R?(O=(0,t.jsxs)("div",{className:"flex flex-col gap-[3px] shrink-0 text-[10px] text-text-muted pr-1 sticky left-0 z-10 bg-surface",children:[C,T,E,A,K,R,F]}),Q[47]=T,Q[48]=A,Q[49]=R,Q[50]=O):O=Q[50],Q[51]!==ec||Q[52]!==ee||Q[53]!==ei?(M=ei.map((e,r)=>(0,t.jsx)("div",{className:"flex flex-col gap-[3px]",children:e.map((e,r)=>(0,t.jsx)("div",{title:e?ee("activityCellTitle",{date:e.date,tokens:(0,n.fmtFull)(e.value)}):"",className:`w-[10px] h-[10px] rounded-[2px] ${e?ec(e.value):"bg-transparent"}`},r))},r)),Q[51]=ec,Q[52]=ee,Q[53]=ei,Q[54]=M):M=Q[54],Q[55]!==O||Q[56]!==M?(P=(0,t.jsxs)("div",{className:"flex gap-[3px]",children:[O,M]}),Q[55]=O,Q[56]=M,Q[57]=P):P=Q[57],Q[58]!==_||Q[59]!==P?($=(0,t.jsx)("div",{ref:er,className:"overflow-x-auto",children:(0,t.jsxs)("div",{className:"w-max",children:[_,P]})}),Q[58]=_,Q[59]=P,Q[60]=$):$=Q[60],Q[61]!==ee?(B=ee("activityLess"),Q[61]=ee,Q[62]=B):B=Q[62],Q[63]!==B?(z=(0,t.jsx)("span",{children:B}),Q[63]=B,Q[64]=z):z=Q[64],Q[65]===Symbol.for("react.memo_cache_sentinel")?(U=(0,t.jsx)("div",{className:"w-[10px] h-[10px] rounded-[2px] bg-white/[0.04]"}),q=(0,t.jsx)("div",{className:"w-[10px] h-[10px] rounded-[2px] bg-primary/20"}),H=(0,t.jsx)("div",{className:"w-[10px] h-[10px] rounded-[2px] bg-primary/40"}),W=(0,t.jsx)("div",{className:"w-[10px] h-[10px] rounded-[2px] bg-primary/60"}),G=(0,t.jsx)("div",{className:"w-[10px] h-[10px] rounded-[2px] bg-primary/90"}),Q[65]=U,Q[66]=q,Q[67]=H,Q[68]=W,Q[69]=G):(U=Q[65],q=Q[66],H=Q[67],W=Q[68],G=Q[69]),Q[70]!==ee?(J=ee("activityMore"),Q[70]=ee,Q[71]=J):J=Q[71],Q[72]!==J?(V=(0,t.jsx)("span",{children:J}),Q[72]=J,Q[73]=V):V=Q[73],Q[74]!==z||Q[75]!==V?(Y=(0,t.jsxs)("div",{className:"flex items-center gap-1 mt-2 ml-6 text-[10px] text-text-muted",children:[z,U,q,H,W,G,V]}),Q[74]=z,Q[75]=V,Q[76]=Y):Y=Q[76],Q[77]!==N||Q[78]!==$||Q[79]!==Y?(X=(0,t.jsxs)(l.default,{className:"p-4 h-full min-w-0 overflow-hidden",children:[N,$,Y]}),Q[77]=N,Q[78]=$,Q[79]=Y,Q[80]=X):X=Q[80],X}function I(e,r){return(0,t.jsx)("span",{className:"text-text-muted",style:{position:"relative",left:`${13*e.weekIdx}px`,marginLeft:0===r?0:"-20px"},children:e.label},r)}function D(e,t){return e+t}function L(e){return null!==e}function A(e){let s,i,n,o,d,u,m,x,p,h,b,f,g,y,v,j,k,N,w,_,C,T,E,I,D,L,A,F,O,M,P,$,B,z,U,q,H,W,G,J,V=(0,c.c)(125),{byApiKey:Y}=e,X=(0,a.useTranslations)("analytics"),[Q,Z]=(0,r.useState)(""),[ee,et]=(0,r.useState)("totalTokens"),[er,es]=(0,r.useState)("desc");
1V[0]!==Y?(s=Y||[],V[0]=Y,V[1]=s):s=V[1];let ea=s;if(V[2]!==ea||V[3]!==Q){e:{let e=Q.trim().toLowerCase();if(!e){i=ea;break e}i=ea.filter(t=>(t.apiKeyName||"").toLowerCase().includes(e)||(t.apiKeyId||"").toLowerCase().includes(e))}V[2]=ea,V[3]=Q,V[4]=i}else i=V[4];let el=i;if(V[5]!==el||V[6]!==ee||V[7]!==er){let e;n=[...el],V[9]!==ee||V[10]!==er?(e=(e,t)=>{let r=e[ee]??0,s=t[ee]??0;return"string"==typeof r?"asc"===er?r.localeCompare(s):s.localeCompare(r):"asc"===er?r-s:s-r},V[9]=ee,V[10]=er,V[11]=e):e=V[11],n.sort(e),V[5]=el,V[6]=ee,V[7]=er,V[8]=n}else n=V[8];let ei=n;V[12]!==ee?(o=e=>{ee===e?es(R):(et(e),es("desc"))},V[12]=ee,V[13]=o):o=V[13];let en=o;if(!(ea.length>0)){let e,r,s,a,i;return V[14]!==X?(e=X("chartApiKeyBreakdown"),V[14]=X,V[15]=e):e=V[15],V[16]!==e?(r=(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-muted uppercase tracking-wider mb-3",children:e}),V[16]=e,V[17]=r):r=V[17],V[18]!==X?(s=X("chartNoData"),V[18]=X,V[19]=s):s=V[19],V[20]!==s?(a=(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:s}),V[20]=s,V[21]=a):a=V[21],V[22]!==r||V[23]!==a?(i=(0,t.jsxs)(l.default,{className:"p-4 flex-1",children:[r,a]}),V[22]=r,V[23]=a,V[24]=i):i=V[24],i}V[25]!==X?(d=X("chartApiKeyBreakdown"),V[25]=X,V[26]=d):d=V[26],V[27]!==d?(u=(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-muted uppercase tracking-wider",children:d}),V[27]=d,V[28]=u):u=V[28],V[29]===Symbol.for("react.memo_cache_sentinel")?(m=e=>Z(e.target.value),V[29]=m):m=V[29],V[30]!==X?(x=X("filterSearchKeys"),V[30]=X,V[31]=x):x=V[31],V[32]!==Q||V[33]!==x?(p=(0,t.jsx)("input",{type:"text",value:Q,onChange:m,placeholder:x,className:"w-full max-w-[220px] px-3 py-1.5 rounded-lg bg-bg-subtle border border-border text-xs text-text-primary placeholder:text-text-muted focus:outline-none focus:border-primary"}),V[32]=Q,V[33]=x,V[34]=p):p=V[34],V[35]!==u||V[36]!==p?(h=(0,t.jsxs)("div",{className:"p-4 border-b border-border flex items-center justify-between gap-3",children:[u,p]}),V[35]=u,V[36]=p,V[37]=h):h=V[37],V[38]!==en?(b=()=>en("apiKeyName"),V[38]=en,V[39]=b):b=V[39],V[40]!==X?(f=X("chartApiKey"),V[40]=X,V[41]=f):f=V[41];let eo="apiKeyName"===ee;V[42]!==er||V[43]!==eo?(g=(0,t.jsx)(S,{active:eo,sortOrder:er}),V[42]=er,V[43]=eo,V[44]=g):g=V[44],V[45]!==b||V[46]!==f||V[47]!==g?(y=(0,t.jsxs)("th",{className:"px-4 py-2.5 text-left cursor-pointer group",onClick:b,children:[f," ",g]}),V[45]=b,V[46]=f,V[47]=g,V[48]=y):y=V[48],V[49]!==en?(v=()=>en("requests"),V[49]=en,V[50]=v):v=V[50],V[51]!==X?(j=X("chartRequests"),V[51]=X,V[52]=j):j=V[52];let ec="requests"===ee;V[53]!==er||V[54]!==ec?(k=(0,t.jsx)(S,{active:ec,sortOrder:er}),V[53]=er,V[54]=ec,V[55]=k):k=V[55],V[56]!==v||V[57]!==j||V[58]!==k?(N=(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:v,children:[j," ",k]}),V[56]=v,V[57]=j,V[58]=k,V[59]=N):N=V[59],V[60]!==en?(w=()=>en("promptTokens"),V[60]=en,V[61]=w):w=V[61],V[62]!==X?(_=X("chartInput"),V[62]=X,V[63]=_):_=V[63];let ed="promptTokens"===ee;V[64]!==er||V[65]!==ed?(C=(0,t.jsx)(S,{active:ed,sortOrder:er}),V[64]=er,V[65]=ed,V[66]=C):C=V[66],V[67]!==w||V[68]!==_||V[69]!==C?(T=(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:w,children:[_," ",C]}),V[67]=w,V[68]=_,V[69]=C,V[70]=T):T=V[70],V[71]!==en?(E=()=>en("completionTokens"),V[71]=en,V[72]=E):E=V[72],V[73]!==X?(I=X("chartOutput"),V[73]=X,V[74]=I):I=V[74];let eu="completionTokens"===ee;V[75]!==er||V[76]!==eu?(D=(0,t.jsx)(S,{active:eu,sortOrder:er}),V[75]=er,V[76]=eu,V[77]=D):D=V[77],V[78]!==E||V[79]!==I||V[80]!==D?(L=(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:E,children:[I," ",D]}),V[78]=E,V[79]=I,V[80]=D,V[81]=L):L=V[81],V[82]!==en?(A=()=>en("totalTokens"),V[82]=en,V[83]=A):A=V[83],V[84]!==X?(F=X("chartTotal"),V[84]=X,V[85]=F):F=V[85];let em="totalTokens"===ee;V[86]!==er||V[87]!==em?(O=(0,t.jsx)(S,{active:em,sortOrder:er}),V[86]=er,V[87]=em,V[88]=O):O=V[88],V[89]!==A||V[90]!==F||V[91]!==O?(M=(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:A,children:[F," ",O]}
1),V[89]=A,V[90]=F,V[91]=O,V[92]=M):M=V[92],V[93]!==en?(P=()=>en("cost"),V[93]=en,V[94]=P):P=V[94],V[95]!==X?($=X("chartCost"),V[95]=X,V[96]=$):$=V[96];let ex="cost"===ee;return V[97]!==er||V[98]!==ex?(B=(0,t.jsx)(S,{active:ex,sortOrder:er}),V[97]=er,V[98]=ex,V[99]=B):B=V[99],V[100]!==P||V[101]!==$||V[102]!==B?(z=(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:P,children:[$," ",B]}),V[100]=P,V[101]=$,V[102]=B,V[103]=z):z=V[103],V[104]!==y||V[105]!==N||V[106]!==T||V[107]!==L||V[108]!==M||V[109]!==z?(U=(0,t.jsx)("thead",{className:"text-xs text-text-muted uppercase bg-black/[0.02] dark:bg-white/[0.02]",children:(0,t.jsxs)("tr",{children:[y,N,T,L,M,z]})}),V[104]=y,V[105]=N,V[106]=T,V[107]=L,V[108]=M,V[109]=z,V[110]=U):U=V[110],V[111]!==ei?(q=ei.map(K),V[111]=ei,V[112]=q):q=V[112],V[113]!==ei.length||V[114]!==X?(H=0===ei.length&&(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:6,className:"px-4 py-8 text-center text-text-muted",children:X("filterNoKeysMatch")})}),V[113]=ei.length,V[114]=X,V[115]=H):H=V[115],V[116]!==q||V[117]!==H?(W=(0,t.jsxs)("tbody",{className:"divide-y divide-border",children:[q,H]}),V[116]=q,V[117]=H,V[118]=W):W=V[118],V[119]!==U||V[120]!==W?(G=(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm",children:[U,W]})}),V[119]=U,V[120]=W,V[121]=G):G=V[121],V[122]!==G||V[123]!==h?(J=(0,t.jsxs)(l.default,{className:"overflow-hidden",children:[h,G]}),V[122]=G,V[123]=h,V[124]=J):J=V[124],J}function K(e,r){return(0,t.jsxs)("tr",{className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,t.jsx)("td",{className:"px-4 py-2.5",children:(0,t.jsx)("span",{className:"font-medium",title:e.apiKeyName||e.apiKeyId||"unknown",children:(0,n.formatApiKeyLabel)(e.apiKeyName,e.apiKeyId)})}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono text-text-muted",children:(0,n.fmtFull)(e.requests)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono text-primary",title:(0,n.fmtFull)(e.promptTokens),children:(0,n.fmtCompact)(e.promptTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono text-emerald-500",title:(0,n.fmtFull)(e.completionTokens),children:(0,n.fmtCompact)(e.completionTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono font-semibold",title:(0,n.fmtFull)(e.totalTokens),children:(0,n.fmtCompact)(e.totalTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono text-amber-500",children:(0,n.fmtCost)(e.cost)})]},`${e.apiKeyId||e.apiKeyName||"key"}-${r}`)}function R(e){return"asc"===e?"desc":"asc"}function F(e){let r,i,o,d,m,x,p,h,b,f=(0,c.c)(28),{activityMap:g}=e,y=(0,a.useTranslations)("analytics"),v=(0,s.useLocale)();f[0]!==v?(r=w(v,{weekday:"long"}),f[0]=v,f[1]=r):r=f[1];let j=r;f[2]!==v?(i=w(v,{month:"short",day:"numeric"}),f[2]=v,f[3]=i):i=f[3];let k=i;e:{let e,t,r,s,a;if(!g){o=null;break e}if(f[4]!==g){let r=new Date;e=null,t=0;for(let s=0;s<7;s++){let a=new Date(r);a.setDate(a.getDate()-s);let l=`${a.getFullYear()}-${String(a.getMonth()+1).padStart(2,"0")}-${String(a.getDate()).padStart(2,"0")}`,i=g[l]||0;i>t&&(t=i,e=l)}f[4]=g,f[5]=e,f[6]=t}else e=f[5],t=f[6];if(!e||0===t){o=null;break e}if(f[7]!==k||f[8]!==e||f[9]!==j){let t=new Date(e+"T12:00:00");r=j.format(t),s=k.format(t),f[7]=k,f[8]=e,f[9]=j,f[10]=r,f[11]=s}else r=f[10],s=f[11];f[12]!==t||f[13]!==r||f[14]!==s?(a={weekday:r,label:s,tokens:t},f[12]=t,f[13]=r,f[14]=s,f[15]=a):a=f[15],o=a}let N=o;return f[16]===Symbol.for("react.memo_cache_sentinel")?(d={flex:1,minHeight:0},f[16]=d):d=f[16],f[17]===Symbol.for("react.memo_cache_sentinel")?(m={color:"var(--color-text-muted)"},f[17]=m):m=f[17],f[18]!==y?(x=y("mostActiveDay"),f[18]=y,f[19]=x):x=f[19],f[20]!==x?(p=(0,t.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:m,children:x}),f[20]=x,f[21]=p):p=f[21],f[22]!==N||f[23]!==y?(h=N?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-xl font-bold capitalize",style:{lineHeight:1.2},children:N.weekday}),(0,t.jsx)(u,{content:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 text-left py-0.5 min-w-[140px]",children:[(0,t.jsx)("div",{className:"font-semibold text-white/95 text-xs",children:N.weekday}),(0,t.jsxs)("div",{className:"font-mono text-xs text-violet-400 tracking-wide",children:["tokens : ",(0,n.fmtFull)(N.tokens)," tokens"]})]}),className:"w-fit max-w-full",delayMs:150,children:(0,t.jsx)("span",{className:"text-xs mt-1 cursor-default",style:{color:"var(--color-text-muted)"},"data-tooltip":(0,n.fmtFull)(N.tokens),children:y("datedTokenCount",{date:N.label,tokens:(0,n.fmtCompact)(N.tokens)})})})]}):(0,t.jsx)("span",{className:"text-xs",style:{color:"var(--color-text-muted)"}
1,children:y("noDataLast7Days")}),f[22]=N,f[23]=y,f[24]=h):h=f[24],f[25]!==p||f[26]!==h?(b=(0,t.jsxs)(l.default,{className:"p-4 flex flex-col justify-center",style:d,children:[p,h]}),f[25]=p,f[26]=h,f[27]=b):b=f[27],b}function O(e){let r,i,o,d,u,m,x,p,h,b,f,g=(0,c.c)(23),{activityMap:y}=e,v=(0,a.useTranslations)("analytics"),j=(0,s.useLocale)();g[0]!==j?(r=w(j,{weekday:"short"}),g[0]=j,g[1]=r):r=g[1];let k=r;g[2]!==j?(i=w(j,{month:"short",day:"numeric"}),g[2]=j,g[3]=i):i=g[3];let N=i;e:{let e;if(!y){let e;g[4]===Symbol.for("react.memo_cache_sentinel")?(e=[],g[4]=e):e=g[4],o=e;break e}if(g[5]!==y||g[6]!==N||g[7]!==k){let t=new Date,r=[],s=0;for(let e=6;e>=0;e--){let a=new Date(t);a.setDate(a.getDate()-e);let l=`${a.getFullYear()}-${String(a.getMonth()+1).padStart(2,"0")}-${String(a.getDate()).padStart(2,"0")}`,i=y[l]||0;i>s&&(s=i),r.push({key:l,val:i,label:k.format(a),dateLabel:N.format(a)})}e=r.map(e=>({...e,intensity:s>0?e.val/s:0})),g[5]=y,g[6]=N,g[7]=k,g[8]=e}else e=g[8];o=e}let S=o;g[9]===Symbol.for("react.memo_cache_sentinel")?(d=function(e){return 0===e?{background:"rgba(255,255,255,0.04)"}:{background:`rgba(229, 77, 94, ${(.15+.75*e).toFixed(2)})`}},g[9]=d):d=g[9];let _=d;return g[10]===Symbol.for("react.memo_cache_sentinel")?(u={flex:1,minHeight:0},g[10]=u):u=g[10],g[11]===Symbol.for("react.memo_cache_sentinel")?(m={color:"var(--color-text-muted)"},g[11]=m):m=g[11],g[12]!==v?(x=v("chartWeekly"),g[12]=v,g[13]=x):x=g[13],g[14]!==x?(p=(0,t.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:m,children:x}),g[14]=x,g[15]=p):p=g[15],g[16]===Symbol.for("react.memo_cache_sentinel")?(h={display:"flex",alignItems:"flex-end",gap:6,justifyContent:"center"},g[16]=h):h=g[16],g[17]!==S||g[18]!==v?(b=(0,t.jsx)("div",{style:h,children:S.map(e=>(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:4},children:[(0,t.jsx)("div",{title:v("activityCellTitle",{date:e.dateLabel,tokens:(0,n.fmtFull)(e.val)}),style:{width:36,height:36,borderRadius:8,..._(e.intensity),transition:"all 0.2s",cursor:"default"}}),(0,t.jsx)("span",{style:{fontSize:9,fontWeight:600,color:"var(--color-text-muted)",letterSpacing:"0.03em"},children:e.label})]},e.key))}),g[17]=S,g[18]=v,g[19]=b):b=g[19],g[20]!==b||g[21]!==p?(f=(0,t.jsxs)(l.default,{className:"p-4 flex flex-col justify-center",style:u,children:[p,b]}),g[20]=b,g[21]=p,g[22]=f):f=g[22],f}function M(e){let r,s,i,o,d,u,m,x,p,h=(0,c.c)(29),{byServiceTier:g,summary:y}=e,v=(0,a.useTranslations)("costs"),j=(0,a.useTranslations)("analytics");h[0]!==g?(r=g||[],h[0]=g,h[1]=r):r=h[1];let k=r,N=Number(y?.totalRequests||0),w=Number(y?.totalCost||0);if(!k.length)return null;if(h[2]!==v?(s=b(v,"serviceTierBreakdownTitle","Service Tier"),h[2]=v,h[3]=s):s=h[3],h[4]!==s?(i=(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-muted uppercase tracking-wider",children:s}),h[4]=s,h[5]=i):i=h[5],h[6]!==v?(o=b(v,"serviceTierBreakdownSubtitle","Fast / Flex / Standard split"),h[6]=v,h[7]=o):o=h[7],h[8]!==o?(d=(0,t.jsx)("span",{className:"text-[11px] text-text-muted",children:o}),h[8]=o,h[9]=d):d=h[9],h[10]!==i||h[11]!==d?(u=(0,t.jsxs)("div",{className:"p-4 border-b border-border flex items-center justify-between gap-3",children:[i,d]}),h[10]=i,h[11]=d,h[12]=u):u=h[12],h[13]!==k||h[14]!==v||h[15]!==j||h[16]!==w||h[17]!==N){let e;h[19]!==v||h[20]!==j||h[21]!==w||h[22]!==N?(e=e=>{var r,s,a;let l="flex"===e.serviceTier,i=f(v,e.serviceTier,e.label),o=N>0?(Number(e.requests||0)/N*100).toFixed(1):"0",c=w>0?(Number(e.cost||0)/w*100).toFixed(1):"0",d=Number(e.usageSavingsTokens||0),u=Number(e.savings||0),m=l&&d>0?` \xb7 ${(0,n.fmtCompact)(d)} ${b(v,"serviceTierUsageSaved","usage saved")}`:"",x=l&&u>0?`${(0,n.fmtCost)(u)} ${b(v,"serviceTierCostSaved","saved")}`:`${c}% ${b(v,"serviceTierCostShareSuffix","of cost")}`;return(0,t.jsxs)("div",{className:"p-4 flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:`material-symbols-outlined text-[18px] ${"priority"===(r=e.serviceTier)?"text-sky-500":"flex"===r?"text-emerald-500":"text-text-muted"}`,children:"priority"===(s=e.serviceTier)?"bolt":"flex"===s?"savings":"speed"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-text-main",children:i}),(0,t.jsxs)("div",{className:"text-xs text-text-muted",children:[j("requestTokenSummary",{requests:(0,n.fmtFull)(e.requests),tokens:(0,n.fmtCompact)(e.totalTokens)}),m]})]})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:`font-mono text-sm font-semibold ${"flex"===e.serviceTier?"text-emerald-500":"text-amber-500"}`,children:(0,n.fmtCost)(e.cost)}),(0,t.jsx)("div",{className:"text-xs text-text-muted",children:x})]})]}),(0,t.jsx)("div",{className:"h-1.5 rounded-full bg-black/5 dark:bg-white/10 overflow-hidden",children:(0,t.jsx)("div",{className:`h-full rounded-full ${"priority"===(a=e.serviceTier)?"bg-sky-500":"flex"===a?"bg-emerald-500":"bg-text-muted/50"}`,style:{width:`${o}%`}})})]},e.serviceTier)},h[19]=v,h[20]=j,h[21]=w,h[22]=N,h[23]=e):e=h[23],m=k.map(e),h[13]=k,h[14]=v,h[15]=j,h[16]=w,h[17]=N,h[18]=m}else m=h[18];return h[24]!==m?(x=(0,t.jsx)("div",{className:"divide-y divide-border",children:m}),h[24]=m,h[25]=x):x=h[25],h[26]!==u||h[27]!==x?(p=(0,t.jsxs)(l.default,{className:"overflow-hidden",children:[u,x]}),h[26]=u,h[27]=x,h[28]=p):p=h[28],p}function P(e){let s,i,o,d,u,x,p,h,b,f,g,y,v,j,k,N,w,_,C,T,E,I,D,L,A,K,R,F,O,M,P,z,U,q,H,W=(0,c.c)(113),{byProvider:G}=e,J=(0,a.useTranslations)("analytics"),[V,Y]=(0,r.useState)("totalTokens"),[X,Q]=(0,r.useState)("desc");W[0]!==G?(s=G||[],W[0]=G,W[1]=s):s=W[1];let Z=s,ee=Z.reduce(B,0);W[2]!==V?(i=e=>{V===e?Q($):(Y(e),Q("desc"))},W[2]=V,W[3]=i):i=W[3];let et=i;if(W[4]!==Z||W[5]!==V||W[6]!==X){let e;o=[...Z],W[8]!==V||W[9]!==X?(e=(e,t)=>{let r=e[V]??0,s=t[V]??0;return"string"==typeof r?"asc"===X?r.localeCompare(s):s.localeCompare(r):"asc"===X?r-s:s-r},W[8]=V,W[9]=X,W[10]=e):e=W[10],o.sort(e),W[4]=Z,W[5]=V,W[6]=X,W[7]=o}else o=W[7];let er=o;if(!Z.length){let e,r,s,a,i;return W[11]!==J?(e=J("chartProviderBreakdown"),W[11]=J,W[12]=e):e=W[12],W[13]!==e?(r=(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-muted uppercase tracking-wider mb-3",children:e}),W[13]=e,W[14]=r):r=W[14],W[15]!==J?(s=J("chartNoData"),W[15]=J,W[16]=s):s=W[16],W[17]!==s?(a=(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:s}),W[17]=s,W[18]=a):a=W[18],W[19]!==r||W[20]!==a?(i=(0,t.jsxs)(l.default,{className:"p-4",children:[r,a]}),W[19]=r,W[20]=a,W[21]=i):i=W[21],i}W[22]!==J?(d=J("chartProviderBreakdown"),W[22]=J,W[23]=d):d=W[23],W[24]!==d?(u=(0,t.jsx)("div",{className:"p-4 border-b border-border",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-muted uppercase tracking-wider",children:d})}),W[24]=d,W[25]=u):u=W[25],W[26]!==et?(x=()=>et("provider"),W[26]=et,W[27]=x):x=W[27],W[28]!==J?(p=J("chartProvider"),W[28]=J,W[29]=p):p=W[29];let es="provider"===V;W[30]!==X||W[31]!==es?(h=(0,t.jsx)(S,{active:es,sortOrder:X}),W[30]=X,W[31]=es,W[32]=h):h=W[32],W[33]!==x||W[34]!==p||W[35]!==h?(b=(0,t.jsxs)("th",{className:"px-4 py-2.5 text-left cursor-pointer group",onClick:x,children:[p," ",h]}),W[33]=x,W[34]=p,W[35]=h,W[36]=b):b=W[36],W[37]!==et?(f=()=>et("requests"),W[37]=et,W[38]=f):f=W[38],W[39]!==J?(g=J("chartRequests"),W[39]=J,W[40]=g):g=W[40];let ea="requests"===V;W[41]!==X||W[42]!==ea?(y=(0,t.jsx)(S,{active:ea,sortOrder:X}),W[41]=X,W[42]=ea,W[43]=y):y=W[43],W[44]!==f||W[45]!==g||W[46]!==y?(v=(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:f,children:[g," ",y]}),W[44]=f,W[45]=g,W[46]=y,W[47]=v):v=W[47],W[48]!==et?(j=()=>et("promptTokens"),W[48]=et,W[49]=j):j=W[49],W[50]!==J?(k=J("chartInput"),W[50]=J,W[51]=k):k=W[51];let el="promptTokens"===V;W[52]!==X||W[53]!==el?(N=(0,t.jsx)(S,{active:el,sortOrder:X}),W[52]=X,W[53]=el,W[54]=N):N=W[54],W[55]!==j||W[56]!==k||W[57]!==N?(w=(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:j,children:[k," ",N]}),W[55]=j,W[56]=k,W[57]=N,W[58]=w):w=W[58],W[59]!==et?(_=()=>et("completionTokens"),W[59]=et,W[60]=_):_=W[60],W[61]!==J?(C=J("chartOutput"),W[61]=J,W[62]=C):C=W[62];let ei="completionTokens"===V;W[63]!==X||W[64]!==ei?(T=(0,t.jsx)(S,{active:ei,sortOrder:X}),W[63]=X,W[64]=ei,W[65]=T):T=W[65],W[66]!==_||W[67]!==C||W[68]!==T?(E=(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:_,children:[C," ",T]}),W[66]=_,W[67]=C,W[68]=T,W[69]=E):E=W[69],W[70]!==et?(I=()=>et("totalTokens"),W[70]=et,W[71]=I):I=W[71],W[72]!==J?(D=J("chartTotal"),W[72]=J,W[73]=D):D=W[73];let en="totalTokens"===V;W[74]!==X||W[75]!==en?(L=(0,t.jsx)(S,{active:en,sortOrder:X}),W[74]=X,W[75]=en,W[76]=L):L=W[76],W[77]!==I||W[78]!==D||W[79]!==L?(A=(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:I,children:[D," ",L]}),W[77]=I,W[78]=D,W[79]=L,W[80]=A):A=W[80],W[81]!==et?(K=()=>et("cost"),W[81]=et,W[82]=K):K=W[82],W[83]!==J?(R=J("chartCost"),W[83]=J,W[84]=R):R=W[84];let eo="cost"===V;return W[85]!==X||W[86]!==eo?(F=(0,t.jsx)(S,{active:eo,sortOrder:X}),W[85]=X,W[86]=eo,W[87]=F):F=W[87],W[88]!==K||W[89]!==R||W[90]!==F?(O=(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:K,children:[R," ",F]}),W[88]=K,W[89]=R,W[90]=F,W[91]=O):O=W[91],W[92]!==J?(M=J("chartShare"),W[92]=J,W[93]=M):M=W[93],W[94]!==M?(P=(0,t.jsx)("th",{className:"px-4 py-2.5 text-right w-36",children:M}),W[94]=M,W[95]=P):P=W[95],W[96]!==v||W[97]!==w||W[98]!==E||W[99]!==A||W[100]!==O||W[101]!==P||W[102]!==b?(z=(0,t.jsx)("thead",{className:"text-xs text-text-muted uppercase bg-black/[0.02] dark:bg-white/[0.02]",children:(0,t.jsxs)("tr",{children:[b,v,w,E,A,O,P]})}),W[96]=v,W[97]=w,W[98]=E,W[99]=A,W[100]=O,W[101]=P,W[102]=b,W[103]=z):z=W[103],W[104]!==er||W[105]!==ee?(U=(0,t.jsx)("tbody",{className:"divide-y divide-border",children:er.map((e,r)=>{let s=ee>0?(e.totalTokens/ee*100).toFixed(1):"0";return(0,t.jsxs)("tr",{className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,t.jsx)("td",{className:"px-4 py-2.5",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:m[r%m.length]}}),(0,t.jsx)("span",{className:"font-medium capitalize",children:e.provider})]})}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono text-text-muted",children:(0,n.fmtFull)(e.requests)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono text-primary",title:(0,n.fmtFull)(e.promptTokens),children:(0,n.fmtCompact)(e.promptTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono text-emerald-500",title:(0,n.fmtFull)(e.completionTokens),children:(0,n.fmtCompact)(e.completionTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono font-semibold",title:(0,n.fmtFull)(e.totalTokens),children:(0,n.fmtCompact)(e.totalTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono text-amber-500",children:(0,n.fmtCost)(e.cost)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,t.jsx)("div",{className:"w-16 h-1.5 rounded-full bg-white/[0.06] overflow-hidden",children:(0,t.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${s}%`,backgroundColor:m[r%m.length]}})}),(0,t.jsxs)("span",{className:"text-xs font-mono text-text-muted w-10 text-right",children:[s,"%"]})]})})]},`${e.provider}-${r}`)})}),W[104]=er,W[105]=ee,W[106]=U):U=W[106],W[107]!==z||W[108]!==U?(q=(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm",children:[z,U]})}),W[107]=z,W[108]=U,W[109]=q):q=W[109],W[110]!==q||W[111]!==u?(H=(0,t.jsxs)(l.default,{className:"overflow-hidden",children:[u,q]}),W[110]=q,W[111]=u,W[112]=H):H=W[112],H}function $(e){return"asc"===e?"desc":"asc"}function B(e,t){return e+t.totalTokens}let z=null,U=null;function q(){let t,s,a=(0,c.c)(3),[l,i]=(0,r.useState)(z);return a[0]!==l?(t=()=>{if(l)return;let t=!1;return(z?Promise.resolve(z):(!U&&(U=e.A(416494).then(e=>(z=e,e)).catch(e=>{throw U=null,e})),U)).then(e=>{t||i(e)}).catch(()=>{t||i(null)}),()=>{t=!0}},s=[l],a[0]=l,a[1]=t,a[2]=s):(t=a[1],s=a[2]),(0,r.useEffect)(t,s),l}function H(e){let r,s,a=(0,c.c)(3),{className:i}=e,n=void 0===i?"p-4 flex-1":i;return a[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)("div",{className:"py-8","aria-hidden":"true"}),a[0]=r):r=a[0],a[1]!==n?(s=(0,t.jsx)(l.default,{className:n,children:r}),a[1]=n,a[2]=s):s=a[2],s}
1function W(e){let r,s,a,l=(0,c.c)(10),{active:i,payload:n,label:o,formatter:d}=e;if(!i||!n?.length)return null;if(l[0]!==o?(r=o&&(0,t.jsx)("div",{className:"font-semibold text-text-main mb-1",children:o}),l[0]=o,l[1]=r):r=l[1],l[2]!==d||l[3]!==n){let e;l[5]!==d?(e=(e,r)=>(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-text-muted",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.color}}),(0,t.jsxs)("span",{children:[e.name,":"]}),(0,t.jsx)("span",{className:"font-mono font-medium text-text-main",children:d?d(e.value):e.value})]},r),l[5]=d,l[6]=e):e=l[6],s=n.map(e),l[2]=d,l[3]=n,l[4]=s}else s=l[4];return l[7]!==r||l[8]!==s?(a=(0,t.jsxs)("div",{className:"rounded-lg border border-white/10 bg-surface px-3 py-2 text-xs shadow-lg",children:[r,s]}),l[7]=r,l[8]=s,l[9]=a):a=l[9],a}function G(e){let r,s,a,i,n,o,d,u,m,x,p,h=(0,c.c)(45),{pieData:b,title:f,formatter:g,valueClassName:y,labelClassName:v,getLegendKey:j,getLegendTitle:k}=e,N=void 0===y?"text-text-muted":y,w=void 0===v?"":v,S=q();if(!S){let e;return h[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(H,{}),h[0]=e):e=h[0],e}let{Cell:_,PieChart:C,Pie:T,Tooltip:E,ResponsiveContainer:I}=S;if(h[1]!==f?(r=(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-muted uppercase tracking-wider mb-3",children:f}),h[1]=f,h[2]=r):r=h[2],h[3]!==_||h[4]!==b){let e;h[6]!==_?(e=(e,r)=>(0,t.jsx)(_,{fill:e.fill,stroke:"none"},r),h[6]=_,h[7]=e):e=h[7],s=b.map(e),h[3]=_,h[4]=b,h[5]=s}else s=h[5];if(h[8]!==T||h[9]!==b||h[10]!==s?(a=(0,t.jsx)(T,{data:b,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",innerRadius:28,outerRadius:55,paddingAngle:1,animationDuration:600,children:s}),h[8]=T,h[9]=b,h[10]=s,h[11]=a):a=h[11],h[12]!==g?(i=(0,t.jsx)(W,{formatter:g}),h[12]=g,h[13]=i):i=h[13],h[14]!==E||h[15]!==i?(n=(0,t.jsx)(E,{content:i}),h[14]=E,h[15]=i,h[16]=n):n=h[16],h[17]!==C||h[18]!==a||h[19]!==n?(o=(0,t.jsxs)(C,{children:[a,n]}),h[17]=C,h[18]=a,h[19]=n,h[20]=o):o=h[20],h[21]!==I||h[22]!==o?(d=(0,t.jsx)(I,{width:120,height:120,children:o}),h[21]=I,h[22]=o,h[23]=d):d=h[23],h[24]!==g||h[25]!==j||h[26]!==k||h[27]!==w||h[28]!==b||h[29]!==N){let e;h[31]!==g||h[32]!==j||h[33]!==k||h[34]!==w||h[35]!==N?(e=(e,r)=>(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.fill}}),(0,t.jsx)("span",{className:`truncate text-text-main ${w}`.trim(),title:k?.(e),children:e.name})]}),(0,t.jsx)("span",{className:`font-mono font-medium shrink-0 ${N}`,children:g(e.value)})]},j?j(e,r):r),h[31]=g,h[32]=j,h[33]=k,h[34]=w,h[35]=N,h[36]=e):e=h[36],u=b.map(e),h[24]=g,h[25]=j,h[26]=k,h[27]=w,h[28]=b,h[29]=N,h[30]=u}else u=h[30];return h[37]!==u?(m=(0,t.jsx)("div",{className:"flex flex-col gap-1 min-w-0 flex-1",children:u}),h[37]=u,h[38]=m):m=h[38],h[39]!==m||h[40]!==d?(x=(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[d,m]}),h[39]=m,h[40]=d,h[41]=x):x=h[41],h[42]!==x||h[43]!==r?(p=(0,t.jsxs)(l.default,{className:"p-4 flex-1",children:[r,x]}),h[42]=x,h[43]=r,h[44]=p):p=h[44],p}function J(e){let r,s,i,o,d=(0,c.c)(20),{byAccount:u}=e,m=(0,a.useTranslations)("analytics");d[0]!==u?(r=u||[],d[0]=u,d[1]=r):r=d[1];let x=r,p=x.length>0;d[2]!==x?(s=x.slice(0,8).map(V),d[2]=x,d[3]=s):s=d[3];let h=s;if(!p){let e,r,s,a,i;return d[4]!==m?(e=m("chartByAccount"),d[4]=m,d[5]=e):e=d[5],d[6]!==e?(r=(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-muted uppercase tracking-wider mb-3",children:e}),d[6]=e,d[7]=r):r=d[7],d[8]!==m?(s=m("chartNoData"),d[8]=m,d[9]=s):s=d[9],d[10]!==s?(a=(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:s}),d[10]=s,d[11]=a):a=d[11],d[12]!==r||d[13]!==a?(i=(0,t.jsxs)(l.default,{className:"p-4 flex-1",children:[r,a]}),d[12]=r,d[13]=a,d[14]=i):i=d[14],i}return d[15]!==m?(i=m("chartByAccount"),d[15]=m,d[16]=i):i=d[16],d[17]!==h||d[18]!==i?(o=(0,t.jsx)(G,{pieData:h,title:i,formatter:n.fmtCompact}),d[17]=h,d[18]=i,d[19]=o):o=d[19],o}function V(e,t){return{name:e.account,value:e.totalTokens,fill:(0,g.getModelColor)(t)}}function Y(e){let r,s,i,o,d=(0,c.c)(23),{byApiKey:u}=e,m=(0,a.useTranslations)("analytics");d[0]!==u?(r=u||[],d[0]=u,d[1]=r):r=d[1];let x=r,p=x.length>0;if(d[2]!==x||d[3]!==m){let e;d[5]!==m?(e=(e,t)=>({name:(0,n.formatApiKeyLabel)(e.apiKeyName,e.apiKeyId),fullName:e.apiKeyName||e.apiKeyId||m("unknownApiKey"),value:e.totalTokens,fill:(0,g.getModelColor)(t)}),d[5]=m,d[6]=e):e=d[6],s=x.slice(0,8).map(e),d[2]=x,d[3]=m,d[4]=s}else s=d[4];let h=s;if(!p){let e,r,s,a,i;return d[7]!==m?(e=m("chartByApiKey"),d[7]=m,d[8]=e):e=d[8],d[9]!==e?(r=(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-muted uppercase tracking-wider mb-3",children:e}),d[9]=e,d[10]=r):r=d[10],d[11]!==m?(s=m("chartNoData"),d[11]=m,d[12]=s):s=d[12],d[13]!==s?(a=(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:s}),d[13]=s,d[14]=a):a=d[14],d[15]!==r||d[16]!==a?(i=(0,t.jsxs)(l.default,{className:"p-4 flex-1",children:[r,a]}),d[15]=r,d[16]=a,d[17]=i):i=d[17],i}return d[18]!==m?(i=m("chartByApiKey"),d[18]=m,d[19]=i):i=d[19],d[20]!==h||d[21]!==i?(o=(0,t.jsx)(G,{pieData:h,title:i,formatter:n.fmtCompact,getLegendKey:Q,getLegendTitle:X}),d[20]=h,d[21]=i,d[22]=o):o=d[22],o}function X(e){return e.fullName}function Q(e,t){return`${e.fullName}-${t}`}function Z(e){let r,s,i,o,d=(0,c.c)(20),{byProvider:u}=e,m=(0,a.useTranslations)("analytics");d[0]!==u?(r=u||[],d[0]=u,d[1]=r):r=d[1];let x=r,p=x.length>0&&x.some(es);d[2]!==x?(s=x.filter(er).sort(et).slice(0,8).map(ee),d[2]=x,d[3]=s):s=d[3];let h=s;if(!p){let e,r,s,a,i;return d[4]!==m?(e=m("chartCostByProvider"),d[4]=m,d[5]=e):e=d[5],d[6]!==e?(r=(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-muted uppercase tracking-wider mb-3",children:e}),d[6]=e,d[7]=r):r=d[7],d[8]!==m?(s=m("chartNoCostData"),d[8]=m,d[9]=s):s=d[9],d[10]!==s?(a=(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:s}),d[10]=s,d[11]=a):a=d[11],d[12]!==r||d[13]!==a?(i=(0,t.jsxs)(l.default,{className:"p-4 flex-1",children:[r,a]}),d[12]=r,d[13]=a,d[14]=i):i=d[14],i}return d[15]!==m?(i=m("chartCostByProvider"),d[15]=m,d[16]=i):i=d[16],d[17]!==h||d[18]!==i?(o=(0,t.jsx)(G,{pieData:h,title:i,formatter:n.fmtCost,valueClassName:"text-amber-500",labelClassName:"capitalize"}),d[17]=h,d[18]=i,d[19]=o):o=d[19],o}function ee(e,t){return{name:e.provider,value:e.cost,fill:m[t%m.length]}}function et(e,t){return t.cost-e.cost}function er(e){return e.cost>0}function es(e){return e.cost>0}function ea({dailyTrend:e}){let s=(0,a.useTranslations)("analytics"),i=(0,r.useMemo)(()=>(e||[]).map(e=>({date:e.date.slice(5),[s("chartInput")]:e.promptTokens,[s("chartOutput")]:e.completionTokens,[s("chartCost")]:e.cost||0})),[e,s]),n=(0,r.useMemo)(()=>i.some(e=>e[s("chartCost")]>0),[i,s]);return i.length?(0,t.jsx)(el,{chartData:i,hasCost:n}):(0,t.jsxs)(l.default,{className:"p-4",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-muted uppercase tracking-wider mb-3",children:s("chartModelUsageOverTime")}),(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:s("chartNoData")})]})}function el(e){let r,s,i,n,o,d,u,m,x,p,h,b,f,g,y,v,j,k,N,w,S,_,C,T,E,I,D,L=(0,c.c)(68),{chartData:A,hasCost:K}=e,R=(0,a.useTranslations)("analytics"),F=q();if(!F){let e;return L[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(H,{}),L[0]=e):e=L[0],e}
1let{ComposedChart:O,Bar:M,Line:P,XAxis:$,YAxis:B,Tooltip:z,ResponsiveContainer:U}=F;L[1]!==R?(r=R("chartModelUsageOverTime"),L[1]=R,L[2]=r):r=L[2],L[3]!==r?(s=(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-muted uppercase tracking-wider mb-3",children:r}),L[3]=r,L[4]=s):s=L[4];let W=40*!!K;L[5]!==W?(i={top:0,right:W,left:0,bottom:0},L[5]=W,L[6]=i):i=L[6],L[7]===Symbol.for("react.memo_cache_sentinel")?(n={fontSize:9,fill:"var(--color-text-muted)"},L[7]=n):n=L[7];let G=Math.max(Math.floor(A.length/6),0);return L[8]!==$||L[9]!==G?(o=(0,t.jsx)($,{dataKey:"date",tick:n,axisLine:!1,tickLine:!1,interval:G}),L[8]=$,L[9]=G,L[10]=o):o=L[10],L[11]!==B||L[12]!==K?(d=K&&(0,t.jsx)(B,{yAxisId:"cost",orientation:"right",tick:{fontSize:8,fill:"#f59e0b"},axisLine:!1,tickLine:!1,tickFormatter:ei,width:36}),L[11]=B,L[12]=K,L[13]=d):d=L[13],L[14]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)(en,{}),u={fill:"rgba(255,255,255,0.04)"},L[14]=u,L[15]=m):(u=L[14],m=L[15]),L[16]!==z?(x=(0,t.jsx)(z,{content:m,cursor:u}),L[16]=z,L[17]=x):x=L[17],L[18]!==R?(p=R("chartInput"),L[18]=R,L[19]=p):p=L[19],L[20]===Symbol.for("react.memo_cache_sentinel")?(h=[0,0,0,0],L[20]=h):h=L[20],L[21]!==M||L[22]!==p?(b=(0,t.jsx)(M,{dataKey:p,stackId:"a",fill:"var(--color-primary)",opacity:.7,radius:h,animationDuration:600}),L[21]=M,L[22]=p,L[23]=b):b=L[23],L[24]!==R?(f=R("chartOutput"),L[24]=R,L[25]=f):f=L[25],L[26]===Symbol.for("react.memo_cache_sentinel")?(g=[3,3,0,0],L[26]=g):g=L[26],L[27]!==M||L[28]!==f?(y=(0,t.jsx)(M,{dataKey:f,stackId:"a",fill:"#10b981",opacity:.7,radius:g,animationDuration:600}),L[27]=M,L[28]=f,L[29]=y):y=L[29],L[30]!==P||L[31]!==K||L[32]!==R?(v=K&&(0,t.jsx)(P,{yAxisId:"cost",type:"monotone",dataKey:R("chartCost"),stroke:"#f59e0b",strokeWidth:2,dot:!1,animationDuration:600}),L[30]=P,L[31]=K,L[32]=R,L[33]=v):v=L[33],L[34]!==O||L[35]!==A||L[36]!==x||L[37]!==b||L[38]!==y||L[39]!==v||L[40]!==i||L[41]!==o||L[42]!==d?(j=(0,t.jsxs)(O,{data:A,margin:i,children:[o,d,x,b,y,v]}),L[34]=O,L[35]=A,L[36]=x,L[37]=b,L[38]=y,L[39]=v,L[40]=i,L[41]=o,L[42]=d,L[43]=j):j=L[43],L[44]!==U||L[45]!==j?(k=(0,t.jsx)(U,{width:"100%",height:140,children:j}),L[44]=U,L[45]=j,L[46]=k):k=L[46],L[47]===Symbol.for("react.memo_cache_sentinel")?(N=(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-primary/70"}),L[47]=N):N=L[47],L[48]!==R?(w=R("chartInput"),L[48]=R,L[49]=w):w=L[49],L[50]!==w?(S=(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[N," ",w]}),L[50]=w,L[51]=S):S=L[51],L[52]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500/70"}),L[52]=_):_=L[52],L[53]!==R?(C=R("chartOutput"),L[53]=R,L[54]=C):C=L[54],L[55]!==C?(T=(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[_," ",C]}),L[55]=C,L[56]=T):T=L[56],L[57]!==K||L[58]!==R?(E=K&&(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-amber-500/70"})," ",R("chartCost")," ($)"]}),L[57]=K,L[58]=R,L[59]=E):E=L[59],L[60]!==S||L[61]!==T||L[62]!==E?(I=(0,t.jsxs)("div",{className:"flex items-center gap-4 mt-2 text-[10px] text-text-muted",children:[S,T,E]}),L[60]=S,L[61]=T,L[62]=E,L[63]=I):I=L[63],L[64]!==s||L[65]!==k||L[66]!==I?(D=(0,t.jsxs)(l.default,{className:"p-4 flex-1",children:[s,k,I]}),L[64]=s,L[65]=k,L[66]=I,L[67]=D):D=L[67],D}function ei(e){return`$${e.toFixed(2)}`}function en(e){let r,s,l,i=(0,c.c)(10),{active:o,payload:d,label:u}=e,m=(0,a.useTranslations)("analytics");if(!o||!d?.length)return null;if(i[0]!==u?(r=u&&(0,t.jsx)("div",{className:"font-semibold text-text-main mb-1",children:u}),i[0]=u,i[1]=r):r=i[1],i[2]!==d||i[3]!==m){let e;i[5]!==m?(e=(e,r)=>(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-text-muted",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.color}}),(0,t.jsxs)("span",{children:[e.name,":"]}),(0,t.jsx)("span",{className:"font-mono font-medium text-text-main",children:e.name===m("chartCost")?(0,n.fmtCost)(e.value):(0,n.fmtCompact)(e.value)})]},r),i[5]=m,i[6]=e):e=i[6],s=d.map(e),i[2]=d,i[3]=m,i[4]=s}else s=i[4];return i[7]!==r||i[8]!==s?(l=(0,t.jsxs)("div",{className:"rounded-lg border border-white/10 bg-surface px-3 py-2 text-xs shadow-lg",children:[r,s]}),i[7]=r,i[8]=s,i[9]=l):l=i[9],l}function eo(e){let r,s,i,n,o=(0,c.c)(20),{dailyByModel:d,modelNames:u}=e,m=(0,a.useTranslations)("analytics");o[0]!==d?(r=d||[],o[0]=d,o[1]=r):r=o[1];let x=r;o[2]!==u?(s=u||[],o[2]=u,o[3]=s):s=o[3];let p=s;o[4]!==x?(i=x.map(ec),o[4]=x,o[5]=i):i=o[5];let h=i;if(!x.length||!p.length){let e,r,s,a,i;return o[6]!==m?(e=m("chartModelUsageOverTime"),o[6]=m,o[7]=e):e=o[7],o[8]!==e?(r=(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-muted uppercase tracking-wider mb-3",children:e}),o[8]=e,o[9]=r):r=o[9],o[10]!==m?(s=m("chartNoData"),o[10]=m,o[11]=s):s=o[11],o[12]!==s?(a=(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:s}),o[12]=s,o[13]=a):a=o[13],o[14]!==r||o[15]!==a?(i=(0,t.jsxs)(l.default,{className:"p-4",children:[r,a]}),o[14]=r,o[15]=a,o[16]=i):i=o[16],i}return o[17]!==h||o[18]!==p?(n=(0,t.jsx)(ed,{chartData:h,models:p}),o[17]=h,o[18]=p,o[19]=n):n=o[19],n}function ec(e){let t={...e};if(e.date){let r=e.date.split("-");t.dateLabel=`${r[1]}/${r[2]}`}return t}function ed(e){let r,s,i,o,d,u,m,x,p,h,b,f,y,v,j,k=(0,c.c)(38),{chartData:N,models:w}=e,S=(0,a.useTranslations)("analytics"),_=q();if(!_){let e;return k[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(H,{className:"p-4"}),k[0]=e):e=k[0],e}let{AreaChart:C,Area:T,XAxis:E,YAxis:I,Tooltip:D,ResponsiveContainer:L}=_;if(k[1]!==S?(r=S("chartModelUsageOverTime"),k[1]=S,k[2]=r):r=k[2],k[3]!==r?(s=(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-muted uppercase tracking-wider mb-3",children:r}),k[3]=r,k[4]=s):s=k[4],k[5]===Symbol.for("react.memo_cache_sentinel")?(i={top:4,right:4,left:0,bottom:0},k[5]=i):i=k[5],k[6]===Symbol.for("react.memo_cache_sentinel")?(o={fontSize:10,fill:"var(--color-text-muted)"},k[6]=o):o=k[6],k[7]!==E?(d=(0,t.jsx)(E,{dataKey:"dateLabel",tick:o,axisLine
1:!1,tickLine:!1,interval:"preserveStartEnd"}),k[7]=E,k[8]=d):d=k[8],k[9]===Symbol.for("react.memo_cache_sentinel")?(u={fontSize:10,fill:"var(--color-text-muted)"},k[9]=u):u=k[9],k[10]!==I?(m=(0,t.jsx)(I,{tick:u,tickFormatter:em,axisLine:!1,tickLine:!1,width:50}),k[10]=I,k[11]=m):m=k[11],k[12]===Symbol.for("react.memo_cache_sentinel")?(x=(0,t.jsx)(W,{formatter:n.fmtCompact}),k[12]=x):x=k[12],k[13]!==D?(p=(0,t.jsx)(D,{content:x}),k[13]=D,k[14]=p):p=k[14],k[15]!==T||k[16]!==w){let e;k[18]!==T?(e=(e,r)=>(0,t.jsx)(T,{type:"monotone",dataKey:e,stackId:"1",stroke:(0,g.getModelColor)(r),fill:(0,g.getModelColor)(r),fillOpacity:.4,strokeWidth:1.5,animationDuration:600},e),k[18]=T,k[19]=e):e=k[19],h=w.map(e),k[15]=T,k[16]=w,k[17]=h}else h=k[17];return k[20]!==C||k[21]!==N||k[22]!==h||k[23]!==d||k[24]!==m||k[25]!==p?(b=(0,t.jsxs)(C,{data:N,margin:i,children:[d,m,p,h]}),k[20]=C,k[21]=N,k[22]=h,k[23]=d,k[24]=m,k[25]=p,k[26]=b):b=k[26],k[27]!==L||k[28]!==b?(f=(0,t.jsx)(L,{width:"100%",height:240,children:b}),k[27]=L,k[28]=b,k[29]=f):f=k[29],k[30]!==w?(y=w.map(eu),k[30]=w,k[31]=y):y=k[31],k[32]!==y?(v=(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 mt-2 text-[10px] text-text-muted",children:y}),k[32]=y,k[33]=v):v=k[33],k[34]!==f||k[35]!==v||k[36]!==s?(j=(0,t.jsxs)(l.default,{className:"p-4",children:[s,f,v]}),k[34]=f,k[35]=v,k[36]=s,k[37]=j):j=k[37],j}function eu(e,r){return(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:(0,g.getModelColor)(r)}}),e]},e)}function em(e){return(0,n.fmtCompact)(e)}function ex(e){return!e||e.length<=8?e||"unknown":`${e.slice(0,6)}â¦${e.slice(-4)}`}function ep(e){let s,l,i,n,o,d,u,m,x,p,h,b,f,g,y=(0,c.c)(46),{available:v,selected:j,onChange:k}=e,N=(0,a.useTranslations)("analytics"),[w,S]=(0,r.useState)(!1),[_,C]=(0,r.useState)(""),T=(0,r.useRef)(null);if(y[0]!==w?(s=()=>{if(!w)return;let e=function(e){T.current&&!T.current.contains(e.target)&&S(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},l=[w],y[0]=w,y[1]=s,y[2]=l):(s=y[1],l=y[2]),(0,r.useEffect)(s,l),y[3]!==w?(i=()=>{if(!w)return;let e=function(e){"Escape"===e.key&&S(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},n=[w],y[3]=w,y[4]=i,y[5]=n):(i=y[4],n=y[5]),(0,r.useEffect)(i,n),y[6]!==v||y[7]!==_){e:{let e=_.trim().toLowerCase();if(!e){o=v;break e}o=v.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e))}y[6]=v,y[7]=_,y[8]=o}else o=y[8];let E=o,I=0===j.length;y[9]!==k||y[10]!==j?(d=e=>{j.includes(e)?k(j.filter(t=>t!==e)):k([...j,e])},y[9]=k,y[10]=j,y[11]=d):d=y[11];let D=d;y[12]!==k?(u=()=>{k([])},y[12]=k,y[13]=u):u=y[13];let L=u;t:{let e;if(I){let e;y[14]!==N?(e=N("filterAllKeys"),y[14]=N,y[15]=e):e=y[15],m=e;break t}if(1===j.length){let e;if(y[16]!==v||y[17]!==j[0]||y[18]!==N){let t;y[20]!==j[0]?(t=e=>e.id===j[0],y[20]=j[0],y[21]=t):t=y[21];let r=v.find(t);e=r?ex(r.name):N("filterOneKey"),y[16]=v,y[17]=j[0],y[18]=N,y[19]=e}else e=y[19];m=e;break t}y[22]!==j.length||y[23]!==N?(e=N("filterMultipleKeys",{count:j.length}),y[22]=j.length,y[23]=N,y[24]=e):e=y[24],m=e}let A=m;if(0===v.length)return null;y[25]===Symbol.for("react.memo_cache_sentinel")?(x=()=>S(eh),y[25]=x):x=y[25];let K=`flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-xs font-medium transition-all ${I?"border-border/50 bg-black/[0.03] text-text-muted hover:text-text-main dark:bg-white/[0.03]":"border-primary/40 bg-primary/10 text-primary"}`;y[26]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"vpn_key"}),y[26]=p):p=y[26];let R=`material-symbols-outlined text-[14px] transition-transform ${w?"rotate-180":""}`;return y[27]!==R?(h=(0,t.jsx)("span",{className:R,children:"expand_more"}),y[27]=R,y[28]=h):h=y[28],y[29]!==A||y[30]!==K||y[31]!==h?(b=(0,t.jsxs)("button",{type:"button",onClick:x,className:K,children:[p,A,h]}),y[29]=A,y[30]=K,y[31]=h,y[32]=b):b=y[32],y[33]!==v.length||y[34]!==E||y[35]!==I||y[36]!==w||y[37]!==_||y[38]!==L||y[39]!==j||y[40]!==N||y[41]!==D?(f=w&&(0,t.jsxs)("div",{className:"absolute left-0 top-full z-50 mt-1.5 w-[260px] rounded-xl border border-border/50 bg-surface shadow-xl",style:{backdropFilter:"blur(16px)"},children:[v.length>5&&(0,t.jsx)("div",{className:"border-b border-border/30 p-2",children:(0,t.jsx)("input",{type:"text",value:_,onCh
1ange:e=>C(e.target.value),placeholder:N("filterSearchKeys"),className:"w-full rounded-md border border-border/30 bg-black/[0.03] px-2.5 py-1.5 text-xs text-text-main placeholder:text-text-muted focus:outline-none focus:border-primary dark:bg-white/[0.03]",autoFocus:!0})}),(0,t.jsxs)("div",{className:"max-h-[280px] overflow-y-auto p-1.5",children:[(0,t.jsxs)("button",{type:"button",onClick:L,className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-xs transition-colors ${I?"bg-primary/10 text-primary font-semibold":"text-text-muted hover:bg-black/[0.04] hover:text-text-main dark:hover:bg-white/[0.04]"}`,children:[(0,t.jsx)("span",{className:`flex h-4 w-4 shrink-0 items-center justify-center rounded border text-[10px] ${I?"border-primary bg-primary text-white":"border-border/60 bg-transparent"}`,children:I&&(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"check"})}),N("filterAllKeys"),(0,t.jsx)("span",{className:"ml-auto text-[10px] text-text-muted font-normal",children:v.length})]}),(0,t.jsx)("div",{className:"my-1 h-px bg-border/20"}),E.map(e=>{let r=j.includes(e.id);return(0,t.jsxs)("button",{type:"button",onClick:()=>D(e.id),className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-xs transition-colors ${r?"bg-primary/[0.06] text-text-main":"text-text-muted hover:bg-black/[0.04] hover:text-text-main dark:hover:bg-white/[0.04]"}`,title:e.name||e.id,children:[(0,t.jsx)("span",{className:`flex h-4 w-4 shrink-0 items-center justify-center rounded border text-[10px] ${r?"border-primary bg-primary text-white":"border-border/60 bg-transparent"}`,children:r&&(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"check"})}),(0,t.jsx)("span",{className:"truncate",children:ex(e.name||e.id)})]},e.id)}),0===E.length&&(0,t.jsx)("p",{className:"px-2.5 py-3 text-center text-[11px] text-text-muted",children:N("filterNoKeysMatch")})]})]}),y[33]=v.length,y[34]=E,y[35]=I,y[36]=w,y[37]=_,y[38]=L,y[39]=j,y[40]=N,y[41]=D,y[42]=f):f=y[42],y[43]!==b||y[44]!==f?(g=(0,t.jsxs)("div",{className:"relative",ref:T,children:[b,f]}),y[43]=b,y[44]=f,y[45]=g):g=y[45],g}function eh(e){return!e}function eb(e){if(!e)return"";let t=new Date(e);if(isNaN(t.getTime()))return"";let r=e=>String(e).padStart(2,"0");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}T${r(t.getHours())}:${r(t.getMinutes())}`}function ef(e){return e?new Date(e).toISOString():""}function eg(e){let s,l,i,n,o,d,u,m,x,p,h,b,f,g,y,v,j,k,N,w,S,_,C,T,E,I,D,L,A,K,R,F,O,M,P,$,B,z,U,q,H,W,G,J,V,Y,X=(0,c.c)(107),{start:Q,end:Z,onApply:ee,onClose:et}=e,er=(0,a.useTranslations)("analytics");X[0]!==Q?(s=eb(Q)||"",X[0]=Q,X[1]=s):s=X[1];let[es,ea]=(0,r.useState)(s);X[2]!==Z?(l=eb(Z)||"",X[2]=Z,X[3]=l):l=X[3];let[el,ei]=(0,r.useState)(l),en=(0,r.useRef)(null);X[4]!==et?(i=()=>{let e=function(e){en.current&&!en.current.contains(e.target)&&et()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},n=[et],X[4]=et,X[5]=i,X[6]=n):(i=X[5],n=X[6]),(0,r.useEffect)(i,n),X[7]!==et?(o=()=>{let e=function(e){"Escape"===e.key&&et()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},d=[et],X[7]=et,X[8]=o,X[9]=d):(o=X[8],d=X[9]),(0,r.useEffect)(o,d),X[10]!==el||X[11]!==es||X[12]!==ee?(u=()=>{es&&el&&ee(ef(es),ef(el))},X[10]=el,X[11]=es,X[12]=ee,X[13]=u):u=X[13];let eo=u;X[14]===Symbol.for("react.memo_cache_sentinel")?(m=e=>{let{start:t,end:r}=function(e){let t=new Date,r=eb(t.toISOString()),s=new Date(t);switch(e){case"today":s.setHours(0,0,0,0);break;case"yesterday":{s.setDate(s.getDate()-1),s.setHours(0,0,0,0);let e=new Date(s);return e.setHours(23,59,59,999),{start:eb(s.toISOString()),end:eb(e.toISOString())}}case"thisWeek":s.setDate(s.getDate()-s.getDay()),s.setHours(0,0,0,0);break;case"thisMonth":s.setDate(1),s.setHours(0,0,0,0);break;case"last3d":s.setDate(s.getDate()-3);break;case"last14d":s.setDate(s.getDate()-14);break;default:s.setDate(s.getDate()-7)}return{start:eb(s.toISOString()),end:r}}(e);ea(t),ei(r)},X[14]=m):m=X[14];let ec=m;
1X[15]!==el||X[16]!==es?(x=es&&el&&new Date(es)<=new Date(el),X[15]=el,X[16]=es,X[17]=x):x=X[17];let ed=x;X[18]!==er?(p=er("rangeToday"),X[18]=er,X[19]=p):p=X[19],X[20]!==p?(h={key:"today",label:p},X[20]=p,X[21]=h):h=X[21],X[22]!==er?(b=er("rangeYesterday"),X[22]=er,X[23]=b):b=X[23],X[24]!==b?(f={key:"yesterday",label:b},X[24]=b,X[25]=f):f=X[25],X[26]!==er?(g=er("rangeLast3Days"),X[26]=er,X[27]=g):g=X[27],X[28]!==g?(y={key:"last3d",label:g},X[28]=g,X[29]=y):y=X[29],X[30]!==er?(v=er("rangeThisWeek"),X[30]=er,X[31]=v):v=X[31],X[32]!==v?(j={key:"thisWeek",label:v},X[32]=v,X[33]=j):j=X[33],X[34]!==er?(k=er("rangeLast14Days"),X[34]=er,X[35]=k):k=X[35],X[36]!==k?(N={key:"last14d",label:k},X[36]=k,X[37]=N):N=X[37],X[38]!==er?(w=er("rangeThisMonth"),X[38]=er,X[39]=w):w=X[39],X[40]!==w?(S={key:"thisMonth",label:w},X[40]=w,X[41]=S):S=X[41],X[42]!==h||X[43]!==f||X[44]!==y||X[45]!==j||X[46]!==N||X[47]!==S?(_=[h,f,y,j,N,S],X[42]=h,X[43]=f,X[44]=y,X[45]=j,X[46]=N,X[47]=S,X[48]=_):_=X[48];let eu=_;X[49]===Symbol.for("react.memo_cache_sentinel")?(C={backdropFilter:"blur(16px)"},X[49]=C):C=X[49],X[50]!==er?(T=er("rangeQuickSelect"),X[50]=er,X[51]=T):T=X[51],X[52]!==T?(E=(0,t.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-text-muted mb-1.5",children:T}),X[52]=T,X[53]=E):E=X[53],X[54]!==eu?(I=(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:eu.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>ec(e.key),className:"rounded-md border border-border/30 bg-black/[0.03] px-2.5 py-1 text-[11px] font-medium text-text-muted transition-colors hover:bg-primary/10 hover:text-primary hover:border-primary/30 dark:bg-white/[0.03]",children:e.label},e.key))}),X[54]=eu,X[55]=I):I=X[55],X[56]!==E||X[57]!==I?(D=(0,t.jsxs)("div",{className:"mb-3",children:[E,I]}),X[56]=E,X[57]=I,X[58]=D):D=X[58],X[59]===Symbol.for("react.memo_cache_sentinel")?(L=(0,t.jsx)("div",{className:"h-px bg-border/30 mb-3"}),X[59]=L):L=X[59],X[60]!==er?(A=er("rangeStart"),X[60]=er,X[61]=A):A=X[61],X[62]!==A?(K=(0,t.jsx)("label",{className:"text-[10px] font-semibold uppercase tracking-wider text-text-muted mb-1 block",children:A}),X[62]=A,X[63]=K):K=X[63],X[64]===Symbol.for("react.memo_cache_sentinel")?(R=e=>ea(e.target.value),X[64]=R):R=X[64],X[65]!==es?(F=(0,t.jsx)("input",{type:"datetime-local",value:es,onChange:R,className:"w-full rounded-lg border border-border/50 bg-black/[0.04] px-3 py-2 text-sm text-text-main focus:outline-none focus:border-primary dark:bg-white/[0.04]"}),X[65]=es,X[66]=F):F=X[66],X[67]!==K||X[68]!==F?(O=(0,t.jsxs)("div",{children:[K,F]}),X[67]=K,X[68]=F,X[69]=O):O=X[69],X[70]!==er?(M=er("rangeEnd"),X[70]=er,X[71]=M):M=X[71],X[72]!==M?(P=(0,t.jsx)("label",{className:"text-[10px] font-semibold uppercase tracking-wider text-text-muted mb-1 block",children:M}),X[72]=M,X[73]=P):P=X[73],X[74]===Symbol.for("react.memo_cache_sentinel")?($=e=>ei(e.target.value),X[74]=$):$=X[74],X[75]!==el?(B=(0,t.jsx)("input",{type:"datetime-local",value:el,onChange:$,className:"w-full rounded-lg border border-border/50 bg-black/[0.04] px-3 py-2 text-sm text-text-main focus:outline-none focus:border-primary dark:bg-white/[0.04]"}),X[75]=el,X[76]=B):B=X[76],X[77]!==P||X[78]!==B?(z=(0,t.jsxs)("div",{children:[P,B]}),X[77]=P,X[78]=B,X[79]=z):z=X[79],X[80]!==O||X[81]!==z?(U=(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[O,z]}),X[80]=O,X[81]=z,X[82]=U):U=X[82],X[83]!==ed||X[84]!==el||X[85]!==es||X[86]!==er?(q=es&&el&&!ed&&(0,t.jsx)("p",{className:"mt-1.5 text-[11px] text-error",children:er("rangeErrorInvalid")}),X[83]=ed,X[84]=el,X[85]=es,X[86]=er,X[87]=q):q=X[87],X[88]!==er?(H=er("rangeCancel"),X[88]=er,X[89]=H):H=X[89],X[90]!==et||X[91]!==H?(W=(0,t.jsx)("button",{type:"button",onClick:et,className:"rounded-lg px-3 py-1.5 text-xs font-medium text-text-muted hover:text-text-main transition-colors",children:H}),X[90]=et,X[91]=H,X[92]=W):W=X[92];let em=!ed;return X[93]!==er?(G=er("rangeApply"),X[93]=er,X[94]=G):G=X[94],X[95]!==eo||X[96]!==em||X[97]!==G?(J=(0,t.jsx)("button",{type:"button",disabled:em,onClick:eo,className:"rounded-lg bg-primary px-4 py-1.5 text-xs font-semibold text-white shadow-sm transition-colors hover:bg-primary-hover disabled:opacity-40 disabled:cursor-not-allowed",children:G}),X[95]=eo,X[96]=em,X[97]=G,X[98]=J):J=X[98],X[99]!==W||X[100]!==J?(V=(0,t.jsxs)("div",{className:"mt-3 flex items-center justify-end gap-2",children:[W,J]}),X[99]=W,X[100]=J,X[101]=V):V=X[101],X[102]!==D||X[103]!==U||X[104]!==q||X[105]!==V?(Y=(0,t.jsxs)("div",{ref:en,className:"absolute right-0 top-full z-50 mt-2 w-[340px] rounded-xl border border-border/50 bg-surface p-4 shadow-xl",style:C,children:[D,L,U,q,V]}
1),X[102]=D,X[103]=U,X[104]=q,X[105]=V,X[106]=Y):Y=X[106],Y}function ey(e){let r,s,a,l,i,n,o=(0,c.c)(17),{title:d,dateLabel:u,value:m,onChange:x}=e;return o[0]!==d?(r=(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-muted uppercase tracking-wider",children:d}),o[0]=d,o[1]=r):r=o[1],o[2]!==x?(s=e=>x(e.target.value),o[2]=x,o[3]=s):s=o[3],o[4]!==u||o[5]!==s||o[6]!==m?(a=(0,t.jsx)("input",{type:"date",value:m,onChange:s,"aria-label":u,className:"px-2 py-1 rounded-md text-xs bg-black/[0.03] dark:bg-white/[0.03] border border-black/5 dark:border-white/5"}),o[4]=u,o[5]=s,o[6]=m,o[7]=a):a=o[7],o[8]!==x||o[9]!==m?(l=m&&(0,t.jsx)("button",{onClick:()=>x(""),className:"text-xs text-text-muted hover:text-text-main",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})}),o[8]=x,o[9]=m,o[10]=l):l=o[10],o[11]!==a||o[12]!==l?(i=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[a,l]}),o[11]=a,o[12]=l,o[13]=i):i=o[13],o[14]!==r||o[15]!==i?(n=(0,t.jsxs)("div",{className:"p-4 border-b border-border flex items-center justify-between flex-wrap gap-2",children:[r,i]}),o[14]=r,o[15]=i,o[16]=n):n=o[16],n}function ev(e){let r,s,a,l,i,n,o,d,u,m,x,p,h,b,f,g,y=(0,c.c)(48),{rows:v,sortBy:j,sortOrder:k,onToggleSort:N,dateLabel:w,providerLabel:_,requestsLabel:C,totalLabel:T}=e;y[0]!==N?(r=()=>N("date"),y[0]=N,y[1]=r):r=y[1];let E="date"===j;y[2]!==k||y[3]!==E?(s=(0,t.jsx)(S,{active:E,sortOrder:k}),y[2]=k,y[3]=E,y[4]=s):s=y[4],y[5]!==w||y[6]!==r||y[7]!==s?(a=(0,t.jsxs)("th",{className:"px-4 py-2.5 text-left cursor-pointer group",onClick:r,children:[w," ",s]}),y[5]=w,y[6]=r,y[7]=s,y[8]=a):a=y[8],y[9]!==N?(l=()=>N("provider"),y[9]=N,y[10]=l):l=y[10];let I="provider"===j;y[11]!==k||y[12]!==I?(i=(0,t.jsx)(S,{active:I,sortOrder:k}),y[11]=k,y[12]=I,y[13]=i):i=y[13],y[14]!==_||y[15]!==l||y[16]!==i?(n=(0,t.jsxs)("th",{className:"px-4 py-2.5 text-left cursor-pointer group",onClick:l,children:[_," ",i]}),y[14]=_,y[15]=l,y[16]=i,y[17]=n):n=y[17],y[18]!==N?(o=()=>N("requests"),y[18]=N,y[19]=o):o=y[19];let D="requests"===j;y[20]!==k||y[21]!==D?(d=(0,t.jsx)(S,{active:D,sortOrder:k}),y[20]=k,y[21]=D,y[22]=d):d=y[22],y[23]!==C||y[24]!==d||y[25]!==o?(u=(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:o,children:[C," ",d]}),y[23]=C,y[24]=d,y[25]=o,y[26]=u):u=y[26],y[27]!==N?(m=()=>N("totalTokens"),y[27]=N,y[28]=m):m=y[28];let L="totalTokens"===j;return y[29]!==k||y[30]!==L?(x=(0,t.jsx)(S,{active:L,sortOrder:k}),y[29]=k,y[30]=L,y[31]=x):x=y[31],y[32]!==m||y[33]!==x||y[34]!==T?(p=(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:m,children:[T," ",x]}),y[32]=m,y[33]=x,y[34]=T,y[35]=p):p=y[35],y[36]!==u||y[37]!==p||y[38]!==a||y[39]!==n?(h=(0,t.jsx)("thead",{className:"text-xs text-text-muted uppercase bg-black/[0.02] dark:bg-white/[0.02]",children:(0,t.jsxs)("tr",{children:[a,n,u,p]})}),y[36]=u,y[37]=p,y[38]=a,y[39]=n,y[40]=h):h=y[40],y[41]!==v?(b=v.map(ej),y[41]=v,y[42]=b):b=y[42],y[43]!==b?(f=(0,t.jsx)("tbody",{className:"divide-y divide-border",children:b}),y[43]=b,y[44]=f):f=y[44],y[45]!==h||y[46]!==f?(g=(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm",children:[h,f]})}),y[45]=h,y[46]=f,y[47]=g):g=y[47],g}function ej(e,r){return(0,t.jsxs)("tr",{className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,t.jsx)("td",{className:"px-4 py-2.5 font-mono text-text-muted",children:e.date}),(0,t.jsx)("td",{className:"px-4 py-2.5",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:m[r%m.length]}}),(0,t.jsx)("span",{className:"font-medium capitalize",children:e.provider})]})}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono font-semibold",children:(0,n.fmtFull)(e.requests)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono text-text-muted",title:(0,n.fmtFull)(e.totalTokens),children:(0,n.fmtCompact)(e.totalTokens)})]},`${e.date}::${e.provider}`)}function ek(e){let s,i,n,d,u,m,x,p=(0,c.c)(27),{range:h}=e,b=(0,a.useTranslations)("analytics"),f=(0,a.useTranslations)("common"),[g,y]=(0,r.useState)(""),[v,j]=(0,r.useState)("date"),[k,N]=(0,r.useState)("desc"),{rows:w,loading:S,error:_}=function(e,t){let s=(0,a.useTranslations)("common"),[l,i]=(0,r.useState)([]),[n,c]=(0,r.useState)(!0),[d,u]=(0,r.useState)(null);return(0,r.useEffect)(()=>{let r=!1;return(async()=>{c(!0);try{let a=new URLSearchParams;t?a.set("date",t):a.set("range",e);let l=await fetch(`/api/usage/requests-by-provider-date?${a.toString()}`);if(!l.ok)throw Error(await (0,o.readFetchErrorMessage)(l,s("error")));let n=await l.json();if(r)return;i(Array.isArray(n.rows)?n.rows:[]),u(null)}catch(e){r||u(e.message)}finally{r||c(!1)}})(),()=>{r=!0}},[e,t,s]),{rows:l,loading:n,error:d}}(h,g);p[0]!==v?(s=e=>{v===e?N(eN):(j(e),N("desc"))},p[0]=v,p[1]=s):s=p[1];let C=s;if(p[2]!==w||p[3]!==v||p[4]!==k){let e;(e=[...w]).sort((e,t)=>
1{let r=e[v],s=t[v];return"string"==typeof r&&"string"==typeof s?"asc"===k?r.localeCompare(s):s.localeCompare(r):"asc"===k?Number(r)-Number(s):Number(s)-Number(r)}),i=e,p[2]=w,p[3]=v,p[4]=k,p[5]=i}else i=p[5];let T=i;return p[6]!==b?(n=b("chartRequestsByProviderDate"),p[6]=b,p[7]=n):n=p[7],p[8]!==b?(d=b("chartDate"),p[8]=b,p[9]=d):d=p[9],p[10]!==g||p[11]!==n||p[12]!==d?(u=(0,t.jsx)(ey,{title:n,dateLabel:d,value:g,onChange:y}),p[10]=g,p[11]=n,p[12]=d,p[13]=u):u=p[13],p[14]!==_||p[15]!==S||p[16]!==w||p[17]!==v||p[18]!==k||p[19]!==T||p[20]!==b||p[21]!==f||p[22]!==C?(m=S&&0===w.length?(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:f("loading")}):_?(0,t.jsxs)("div",{className:"text-center text-red-500 text-sm py-8",children:[f("errorShort"),": ",_]}):0===T.length?(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:b("chartNoData")}):(0,t.jsx)(ev,{rows:T,sortBy:v,sortOrder:k,onToggleSort:C,dateLabel:b("chartDate"),providerLabel:b("chartProvider"),requestsLabel:b("chartRequests"),totalLabel:b("chartTotal")}),p[14]=_,p[15]=S,p[16]=w,p[17]=v,p[18]=k,p[19]=T,p[20]=b,p[21]=f,p[22]=C,p[23]=m):m=p[23],p[24]!==u||p[25]!==m?(x=(0,t.jsxs)(l.default,{className:"overflow-hidden",children:[u,m]}),p[24]=u,p[25]=m,p[26]=x):x=p[26],x}function eN(e){return"asc"===e?"desc":"asc"}e.s(["default",0,function(){let e=(0,s.useLocale)(),c=(0,a.useTranslations)("analytics"),d=(0,a.useTranslations)("common"),[u,m]=(0,r.useState)("30d"),[x,p]=(0,r.useState)(null),[h,b]=(0,r.useState)(!0),[f,g]=(0,r.useState)(null),[y,v]=(0,r.useState)(""),[j,N]=(0,r.useState)(""),[w,S]=(0,r.useState)(!1),T=(0,r.useRef)(null),[I,D]=(0,r.useState)([]),[L,K]=(0,r.useState)([]),R=(0,r.useCallback)(async()=>{try{b(!0);let e=new URLSearchParams;e.set("range",u),e.set("includeFlatRateEstimates","true"),"custom"===u&&y&&j&&(e.set("startDate",y),e.set("endDate",j)),I.length>0&&e.set("apiKeyIds",I.join(","));let t=await fetch(`/api/usage/analytics?${e.toString()}`);if(!t.ok)throw Error(await (0,o.readFetchErrorMessage)(t,d("error")));let r=await t.json();if(p(r),g(null),0===I.length&&r.byApiKey?.length>0){let e=new Set,t=[];for(let s of r.byApiKey){let r=s.apiKeyId||s.apiKeyName||d("unknownProvider"),a=s.apiKeyName||s.apiKeyId||d("unknownProvider");e.has(r)||(e.add(r),t.push({id:r,name:a}))}K(t)}}catch(e){g(e.message)}finally{b(!1)}},[u,y,j,I,d]);(0,r.useEffect)(()=>{let e=window.setTimeout(()=>void R(),0);return()=>window.clearTimeout(e)},[R]);let $=(0,r.useCallback)(e=>{"custom"===e?S(!0):(m(e),S(!1))},[]),B=(0,r.useCallback)((e,t)=>{v(e),N(t),m("custom"),S(!1)},[]),z=(0,r.useMemo)(()=>{if("custom"!==u||!y||!j)return null;let t=t=>new Date(t).toLocaleDateString(e,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return`${t(y)} â ${t(j)}`},[u,y,j,e]),U=[{value:"1d",label:c("period1D")},{value:"7d",label:c("period7D")},{value:"30d",label:c("period30D")},{value:"90d",label:c("period90D")},{value:"ytd",label:c("periodYTD")},{value:"all",label:c("periodAll")}],q=(0,r.useMemo)(()=>{let e=x?.byModel||[];return e.length>0?e[0].model:"â"},[x]),H=(0,r.useMemo)(()=>{let e=x?.byProvider||[];return e.length>0?e[0].provider:"â"},[x]),W=(0,r.useMemo)(()=>{let t=x?.weeklyPattern||[];if(!t.length)return"â";let r=t.reduce((e,t)=>e.avgTokens>t.avgTokens?e:t,t[0]);if(r.avgTokens<=0)return"â";let s=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].indexOf(r.day);return s<0?r.day:new Intl.DateTimeFormat(e,{weekday:"short"}).format(new Date(2024,0,7+s))},[x,e]),G=(0,r.useMemo)(()=>(x?.byProvider||[]).length,[x]),V=(0,r.useMemo)(()=>{let e=x?.byProvider||[];if(e.length<=1)return 0;let t=0;for(let r of e)t+=r.totalRequests||r.apiCalls||0;if(0===t)return 0;let r=0;for(let s of e){let e=(s.totalRequests||s.apiCalls||0)/t;e>0&&(r-=e*Math.log2(e))}let s=Math.log2(e.length);return s>0?r/s*100:0},[x]);if(h&&!x)return(0,t.jsx)(i.CardSkeleton,{});if(f)return(0,t.jsxs)(l.default,{className:"p-6 text-center text-red-500",children:[d("errorShort"),": ",f]});let X=x?.summary||{},Q=X.totalRequests>0?Math.round(X.totalTokens/X.totalRequests):0,ee=X.totalRequests>0?X.totalCost/X.totalRequests:0,et=X.completionTokens>0?(X.promptTokens/X.completionTokens).toFixed(1):"â";return(0,t.jsxs)("div",{className:"flex flex-col gap-5 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[(0,t.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-primary text-[22px]",children:"analytics"}),c("usageAnalyticsTitle")]}),(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)(ep,{available:L,selected:I,onChange:D}),(0,t.jsxs)("div",{className:"relative flex items-center gap-1 bg-black/[0.03] dark:bg-white/[0.03] rounded-lg p-1 border border-black/5 dark:border-white/5",ref:T,children:[U.map(e=>(0,t.jsx)("button",{onClick:()=>$(e.value),className:`px-3 py-1 rounded-md text-xs font-semibold transition-all ${u===e.value?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5"}`,children:e.label},e.value)),(0,t.jsxs)("button",{onClick:()=>$("custom"),className:`px-3 py-1 rounded-md text-xs font-semibold transition-all flex items-center gap-1 ${"custom"===u?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5"}`,children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"date_range"}),z||c("customRange"),"custom"===u&&z&&(0,t.jsx)("span",{role:"button",onClick:e=>{e.stopPropagation(),m("30d"),v(""),N("")},className:"ml-0.5 opacity-70 hover:opacity-100",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"close"})})]}),w&&(0,t.jsx)(eg,{start:y,end:j,onApply:B,onClose:()=>S(!1)})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[(0,t.jsx)(_,{icon:"generating_tokens",label:c("totalTokens"),value:(0,n.fmtCompact)(X.totalTokens),tooltip:(0,n.fmtFull)(X.totalTokens),subValue:`${(0,n.fmtFull)(X.totalRequests)} ${c("chartRequests")}`}),(0,t.jsx)(_,{icon:"input",label:c("inputTokens"),value:(0,n.fmtCompact)(X.promptTokens),tooltip:(0,n.fmtFull)(X.promptTokens),color:"text-primary"}),(0,t.jsx)(_,{icon:"output",label:c("outputTokens"),value:(0,n.fmtCompact)(X.completionTokens),tooltip:(0,n.fmtFull)(X.completionTokens),color:"text-emerald-500"}),(0,t.jsx)(_,{icon:"payments",label:c("estCost"),value:(0,n.fmtCost)(X.totalCost),tooltip:void 0!==X.totalCost&&null!==X.totalCost?`$${Number(X.totalCost).toLocaleStr
1ing(void 0,{minimumFractionDigits:2,maximumFractionDigits:6})}`:void 0,color:"text-amber-500"})]}),(0,t.jsx)(C,{sections:[{title:c("infraTitle"),items:[{icon:"group",label:c("infraAccounts"),value:X.uniqueAccounts||0},{icon:"dns",label:c("infraProviders"),value:G,color:"text-indigo-500"},{icon:"vpn_key",label:c("infraApiKeys"),value:X.uniqueApiKeys||0},{icon:"model_training",label:c("infraModels"),value:X.uniqueModels||0}]},{title:c("perfTitle"),items:[{icon:"speed",label:c("perfAvgTokens"),value:(0,n.fmtCompact)(Q),tooltip:`tokens : ${(0,n.fmtFull)(Q)} tokens`,color:"text-cyan-500"},{icon:"request_quote",label:c("perfCostReq"),value:(0,n.fmtCost)(ee),tooltip:ee?`cost : $${Number(ee).toLocaleString(void 0,{minimumFractionDigits:4,maximumFractionDigits:6})}`:void 0,color:"text-orange-500"},{icon:"compare_arrows",label:c("perfIoRatio"),value:`${et}x`,color:"text-violet-500"},{icon:"bolt",label:c("perfFastReq"),value:(0,n.fmtCompact)(X.fastRequests||0),tooltip:`requests : ${(0,n.fmtFull)(X.fastRequests||0)} requests`,color:"text-sky-500"}]},{title:c("highlightsTitle"),wideValues:!0,items:[{icon:"star",label:c("highlightsTopModel"),value:q,color:"text-pink-500"},{icon:"cloud",label:c("highlightsTopProvider"),value:H,color:"text-teal-500"},{icon:"today",label:c("highlightsBusiestDay"),value:W,color:"text-rose-500"},{icon:"network_node",label:c("highlightsDiversity"),value:`${V.toFixed(1)}%`,color:"text-sky-500"},{icon:"swap_horiz",label:c("highlightsFallbackRate"),value:`${Number(X.fallbackRatePct||0).toFixed(1)}%`,color:"text-amber-500"}]}]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-[2fr_1fr] gap-4 items-stretch",children:[(0,t.jsx)(E,{activityMap:x?.activityMap}),(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsx)(F,{activityMap:x?.activityMap}),(0,t.jsx)(O,{activityMap:x?.activityMap})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsx)(ea,{dailyTrend:x?.dailyTrend}),(0,t.jsx)(Z,{byProvider:x?.byProvider})]}),(0,t.jsx)(M,{byServiceTier:x?.byServiceTier,summary:X}),(0,t.jsx)(eo,{dailyByModel:x?.dailyByModel,modelNames:x?.modelNames}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsx)(J,{byAccount:x?.byAccount}),(0,t.jsx)(Y,{byApiKey:x?.byApiKey})]}),(0,t.jsx)(P,{byProvider:x?.byProvider}),(0,t.jsx)(ek,{range:u}),(0,t.jsx)(A,{byApiKey:x?.byApiKey}),(0,t.jsx)(k,{byModel:x?.byModel,summary:X})]})}],566770)},548036,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(948148),a=e.i(271645),l=e.i(618566),i=e.i(393718),n=e.i(969353),o=e.i(454149),c=e.i(243009);function d(e){let s,a=(0,r.c)(3),{field:l,currentSort:i,currentOrder:n}=e;if(i!==l){let e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("span",{className:"ml-1 opacity-20",children:"â"}),a[0]=e):e=a[0],e}let o="asc"===n?"â":"â";return a[1]!==o?(s=(0,t.jsx)("span",{className:"ml-1",children:o}),a[1]=o,a[2]=s):s=a[2],s}function u(e){let s,a,l=(0,r.c)(9),{data:i,colorClass:n}=e,o=void 0===n?"bg-primary":n,c=Math.max(...i,1);if(l[0]!==o||l[1]!==i||l[2]!==c){let e;l[4]!==o||l[5]!==c?(e=(e,r)=>(0,t.jsx)("div",{className:`flex-1 rounded-t-sm transition-all duration-500 ${o}`,style:{height:`${Math.max(e/c*100,5)}%`},title:String(e)},`bar-${r}-${e}`),l[4]=o,l[5]=c,l[6]=e):e=l[6],s=i.slice(-9).map(e),l[0]=o,l[1]=i,l[2]=c,l[3]=s}else s=l[3];return l[7]!==s?(a=(0,t.jsx)("div",{className:"flex items-end gap-1 h-8 w-24",children:s}),l[7]=s,l[8]=a):a=l[8],a}e.s(["default",0,function(){let e=(0,s.useTranslations)("stats"),r=(0,l.useRouter)(),m=(0,l.useSearchParams)(),x=m.get("sortBy")||"rawModel",p=m.get("sortOrder")||"asc",[h,b]=(0,a.useState)(null),[f,g]=(0,a.useState)(!0),[y,v]=(0,a.useState)(!0),[j,k]=(0,a.useState)("tokens"),[N,w]=(0,a.useState)(5e3),S=(0,a.useRef)(0),_=e=>{let t=new URLSearchParams(m.toString());x===e?t.set("sortOrder","asc"===p?"desc":"asc"):(t.set("sortBy",e),t.set("sortOrder","asc")),r.replace(`?${t.toString()}`,{scroll:!1})},C=(0,a.useCallback)((e,t={})=>Object.entries(e||{}).map(([e,r])=>{let s=(r.promptTokens||0)+(r.completionTokens||0),a=r.cost||0,l=s>0?(r.promptTokens||0)*(a/s):0,i=s>0?(r.completionTokens||0)*(a/s):0;return{...r,key:e,totalTokens:s,totalCost:a,inputCost:l,outputCost:i,pending:t[e]||0}}).sort((e,t)=>
1{let r=e[x],s=t[x];return("string"==typeof r&&(r=r.toLowerCase()),"string"==typeof s&&(s=s.toLowerCase()),r<s)?"asc"===p?-1:1:r>s?"asc"===p?1:-1:0}),[x,p]),T=(0,a.useMemo)(()=>C(h?.byModel,h?.pending?.byModel),[h?.byModel,h?.pending?.byModel,C]),E=h?.byAccount,I=h?.pending?.byAccount,D=(0,a.useMemo)(()=>{let e={};return I&&Object.entries(E||{}).forEach(([t,r])=>{let s=I[r.connectionId];if(s){let a=r.provider?`${r.rawModel} (${r.provider})`:r.rawModel;e[t]=s[a]||0}}),C(E,e)},[E,I,C]),L=(0,a.useCallback)(async(e=!0)=>{try{let e=await fetch("/api/usage/history");if(e.ok){let t=await e.json();b(t);let r=t.totalRequests||0;r>S.current?w(5e3):w(e=>Math.min(2*e,6e4)),S.current=r}}catch(e){console.error("Failed to fetch usage stats:",e)}finally{e&&g(!1)}},[]);if((0,a.useEffect)(()=>{(async()=>{await L()})()},[L]),(0,a.useEffect)(()=>{let e,t=!0,r=()=>{(t=!document.hidden)&&y&&L(!1)};return document.addEventListener("visibilitychange",r),y&&(e&&clearInterval(e),e=setInterval(()=>{t&&L(!1)},N)),()=>{e&&clearInterval(e),document.removeEventListener("visibilitychange",r)}},[y,N,L]),f)return(0,t.jsx)(o.CardSkeleton,{});if(!h)return(0,t.jsx)("div",{className:"text-text-muted",children:e("failedToLoad")});let A=e=>(0,c.fmtFull)(e),K=t=>{if(!t)return e("never");let r=new Date(t),s=Math.floor((new Date().getTime()-r.getTime())/6e4);return s<1?e("justNow"):s<60?e("minutesAgo",{count:s}):s<1440?e("hoursAgo",{count:Math.floor(s/60)}):r.toLocaleDateString()};return(0,t.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("h2",{className:"text-xl font-semibold",children:e("usageOverview")}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1 bg-bg-subtle rounded-lg p-1 border border-border",children:[(0,t.jsx)("button",{onClick:()=>k("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===j?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:e("tokens")}),(0,t.jsx)("button",{onClick:()=>k("costs"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"costs"===j?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:e("costs")})]}),(0,t.jsxs)("div",{className:"text-sm font-medium text-text-muted flex items-center gap-2",children:[(0,t.jsx)("span",{children:e("autoRefresh",{seconds:N/1e3})}),(0,t.jsx)("button",{type:"button",onClick:()=>v(!y),role:"switch","aria-checked":y,"aria-label":e("toggleAutoRefresh"),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-primary/50 ${y?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,t.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${y?"translate-x-5":"translate-x-1"}`})})]})]})]}),(h.activeRequests||[]).length>0&&(0,t.jsx)(i.default,{className:"p-3 border-primary/20 bg-primary/5",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-primary font-semibold text-sm uppercase tracking-wider",children:[(0,t.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,t.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),e("activeRequests")]}),(0,t.jsx)("div",{className:"flex flex-wrap gap-3",children:h.activeRequests.map(e=>(0,t.jsxs)("div",{className:"px-3 py-1.5 rounded-md bg-bg-subtle border border-primary/20 text-xs font-mono shadow-sm",children:[(0,t.jsx)("span",{className:"text-primary font-bold",children:e.model}),(0,t.jsx)("span",{className:"mx-1 text-text-muted",children:"|"}),(0,t.jsx)("span",{className:"text-text",children:e.provider}),(0,t.jsx)("span",{className:"mx-1 text-text-muted",children:"|"}),(0,t.jsx)("span",{className:"text-text font-medium",children:e.account}),e.count>1&&(0,t.jsxs)("span",{className:"ml-2 px-1.5 py-0.5 rounded bg-primary text-white font-bold",children:["x",e.count]})]},`${e.model}-${e.provider}-${e.account}`))})]})}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,t.jsx)(i.default,{className:"px-4 py-3 flex flex-col gap-1",children:(0,t.jsxs)("div",{className:"flex justify-between items-start",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:e("totalRequests")}),(0,t.jsx)("span",{className:"text-2xl font-bold",children:A(h.totalRequests)})]}),(0,t.jsx)(u,{data:(h.last10Minutes||[]).map(e=>e.requests),colorClass:"bg-text-muted/30"})]})}),(0,t.jsx)(i.default,{className:"px-4 py-3 flex flex-col gap-1",children:(0,t.jsxs)("div",{className:"flex justify-between items-start",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:e("totalInputTokens")}),(0,t.jsx)("span",{className:"text-2xl font-bold text-primary",children:A(h.totalPromptTokens)})]}),(0,t.jsx)(u,{data:(h.last10Minutes||[]).map(e=>e.promptTokens),colorClass:"bg-primary/50"})]})}),(0,t.jsx)(i.default,{className:"px-4 py-2 flex flex-col gap-1",children:(0,t.jsxs)("div",{className:"flex justify-between items-start gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 flex-1",children:[(0,t.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:e("outputTokens")}),(0,t.jsx)("span",{className:"text-2xl font-bold text-success",children:A(h.totalCompletionTokens)})]}),(0,t.jsx)("div",{className:"w-px bg-border self-stretch mx-2"}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 flex-1",children:[(0,t.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:e("totalCost")}),(0,t.jsx)("span",{className:"text-2xl font-bold text-warning",children:(0,c.fmtCost)(h.totalCost)})]})]})})]}),(0,t.jsxs)(i.default,{className:"overflow-hidden",children:[(0,t.jsx)("div",{className:"p-4 border-b border-border bg-bg-subtle/50",children:(0,t.jsx)("h3",{className:"font-semibold",children:e("usageByModel")})}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,t.jsx)("thead",{className:"bg-bg-subtle/30 text-text-muted uppercase text-xs",children:(0,t.jsxs)("tr",{children:[(0,t.jsxs)("th",{className:"px-6 py-3 cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("rawModel"),children:[e("model")," ",(0,t.jsx)(d,{field:"rawModel",currentSort:x,currentOrder:p})]}),(0,t.jsxs)("th",{className:"px-6 py-3 cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("provider"),children:[e("provider")," ",(0,t.jsx)(d,{field:"provider",currentSort:x,currentOrder:p})]}),(0,t.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("requests"),children:[e("requests")," ",(0,t.jsx)(d,{field:"requests",currentSort:x,currentOrder:p})]}),(0,t.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("lastUsed"),children:[e("lastUsed")," ",(0,t.jsx)(d,{field:"lastUsed",currentSort:x,currentOrder:p})]}),"tokens"===j?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("promptTokens"),children:[e("inputTokens")," ",(0,t.jsx)(d,{field:"promptTokens",currentSort:x,currentOrder:p})]}),(0,t.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("completionTokens"),children:[e("outputTokens")," ",(0,t.jsx)(d,{field:"completionTokens",currentSort:x,currentOrder:p})]}),(0,t.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("totalTokens"),children:[e("totalTokens")," ",(0,t.jsx)(d,{field:"totalTokens",currentSort:x,currentOrder:p})]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("promptTokens"),children:[e("inputCost")," ",(0,t.jsx)(d,{field:"promptTokens",currentSort:x,currentOrder:p})]}),(0,t.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("completionTokens"),children:[e("outputCost")," ",(0,t.jsx)(d,{field:"completionTokens",currentSort:x,currentOrder:p})]}),(0,t.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("cost"),children:[e("totalCost")," ",(0,t.jsx)(d,{field:"cost",currentSort:x,currentOrder:p})]})]})]})}),(0,t.jsxs)("tbody",{className:"divide-y divide-border",children:[T.map(e=>(0,t.jsxs)("tr",{className:"hover:bg-bg-subtle/20",children:[(0,t.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${e.pending>0?"text-primary":""}`,children:e.rawModel}),(0,t.jsx)("td",{className:"px-6 py-3",children:(0,t.jsx)(n.default,{variant:e.pending>0?"primary":"default",size:"sm",children:e.provider})}),(0,t.jsx)("td",{className:"px-6 py-3 text-right",children:A(e.requests)}),(0,t.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:K(e.lastUsed)}),"tokens"===j?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:A(e.promptTokens)}),(0,t.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:A(e.completionTokens)}),(0,t.jsx)("td",{className:"px-6 py-3 text-right font-medium",children:A(e.totalTokens)})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:(0,c.fmtCost)(e.inputCost)}),(0,t.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:(0,c.fmtCost)(e.outputCost)}),(0,t.jsx)("td",{className:"px-6 py-3 text-right font-medium text-warning",children:(0,c.fmtCost)(e.totalCost)})]})]},e.key)),0===T.length&&(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:8,className:"px-6 py-8 text-center text-text-muted",children:e("noUsageData")})})]})]})})]}),(0,t.jsxs)(i.default,{className:"overflow-hidden",children:[(0,t.jsx)("div",{className:"p-4 border-b border-border bg-bg-subtle/50",children:(0,t.jsx)("h3",{className:"font-semibold",children:e("usageByAccount")}
1)}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,t.jsx)("thead",{className:"bg-bg-subtle/30 text-text-muted uppercase text-xs",children:(0,t.jsxs)("tr",{children:[(0,t.jsxs)("th",{className:"px-6 py-3 cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("rawModel"),children:[e("model")," ",(0,t.jsx)(d,{field:"rawModel",currentSort:x,currentOrder:p})]}),(0,t.jsxs)("th",{className:"px-6 py-3 cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("provider"),children:[e("provider")," ",(0,t.jsx)(d,{field:"provider",currentSort:x,currentOrder:p})]}),(0,t.jsxs)("th",{className:"px-6 py-3 cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("accountName"),children:[e("account")," ",(0,t.jsx)(d,{field:"accountName",currentSort:x,currentOrder:p})]}),(0,t.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("requests"),children:[e("requests")," ",(0,t.jsx)(d,{field:"requests",currentSort:x,currentOrder:p})]}),(0,t.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("lastUsed"),children:[e("lastUsed")," ",(0,t.jsx)(d,{field:"lastUsed",currentSort:x,currentOrder:p})]}),"tokens"===j?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("promptTokens"),children:[e("inputTokens")," ",(0,t.jsx)(d,{field:"promptTokens",currentSort:x,currentOrder:p})]}),(0,t.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("completionTokens"),children:[e("outputTokens")," ",(0,t.jsx)(d,{field:"completionTokens",currentSort:x,currentOrder:p})]}),(0,t.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("totalTokens"),children:[e("totalTokens")," ",(0,t.jsx)(d,{field:"totalTokens",currentSort:x,currentOrder:p})]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("promptTokens"),children:[e("inputCost")," ",(0,t.jsx)(d,{field:"promptTokens",currentSort:x,currentOrder:p})]}),(0,t.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("completionTokens"),children:[e("outputCost")," ",(0,t.jsx)(d,{field:"completionTokens",currentSort:x,currentOrder:p})]}),(0,t.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>_("cost"),children:[e("totalCost")," ",(0,t.jsx)(d,{field:"cost",currentSort:x,currentOrder:p})]})]})]})}),(0,t.jsxs)("tbody",{className:"divide-y divide-border",children:[D.map(r=>(0,t.jsxs)("tr",{className:"hover:bg-bg-subtle/20",children:[(0,t.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${r.pending>0?"text-primary":""}`,children:r.rawModel}),(0,t.jsx)("td",{className:"px-6 py-3",children:(0,t.jsx)(n.default,{variant:r.pending>0?"primary":"default",size:"sm",children:r.provider})}),(0,t.jsx)("td",{className:"px-6 py-3",children:(0,t.jsx)("span",{className:`font-medium transition-colors ${r.pending>0?"text-primary":""}`,children:r.accountName||e("accountLabel",{id:`${r.connectionId?.slice(0,8)}...`})})}),(0,t.jsx)("td",{className:"px-6 py-3 text-right",children:A(r.requests)}),(0,t.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:K(r.lastUsed)}),"tokens"===j?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:A(r.promptTokens)}),(0,t.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:A(r.completionTokens)}),(0,t.jsx)("td",{className:"px-6 py-3 text-right font-medium",children:A(r.totalTokens)})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:(0,c.fmtCost)(r.inputCost)}),(0,t.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:(0,c.fmtCost)(r.outputCost)}),(0,t.jsx)("td",{className:"px-6 py-3 text-right font-medium text-warning",children:(0,c.fmtCost)(r.totalCost)})]})]},r.key)),0===D.length&&(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:9,className:"px-6 py-8 text-center text-text-muted",children:e("noAccountUsage")})})]})]})})]})]})}])},359505,e=>{"use strict";var t=e.i(843476),r=e.i(500932),s=e.i(897844);
1e.s(["default",0,function(e){let a,l,i,n,o=(0,r.c)(5),{children:c}=e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 dark:bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0"}),l=(0,t.jsx)("div",{className:"fixed bottom-0 right-0 w-[600px] h-[600px] bg-orange-200/20 dark:bg-orange-900/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3"}),o[0]=a,o[1]=l):(a=o[0],l=o[1]),o[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,t.jsx)(s.default,{variant:"card"})}),o[2]=i):i=o[2],o[3]!==c?(n=(0,t.jsxs)("div",{className:"min-h-screen flex flex-col relative bg-bg transition-colors duration-500 overflow-x-hidden selection:bg-primary/20 selection:text-primary",children:[a,l,i,(0,t.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:c})]}),o[3]=c,o[4]=n):n=o[4],n}])},165149,e=>{"use strict";var t=e.i(247167),r=e.i(843476),s=e.i(500932),a=e.i(271645),l=e.i(647829),i=e.i(6998),n=e.i(816062),o=e.i(642440),c=e.i(948148);function d(){let[e,t]=(0,a.useState)(!1),[s,l]=(0,a.useState)(""),i=(0,a.useRef)(0),n=(0,a.useRef)(!1),o=(0,c.useTranslations)("common");return((0,a.useEffect)(()=>{let e=async()=>{let e=new AbortController,r=setTimeout(()=>e.abort("Health check timeout"),8e3);try{(await fetch("/api/health/ping",{signal:e.signal,cache:"no-store"})).ok?(i.current=0,n.current=!1,t(!1),l("")):(i.current+=1,i.current>=2&&!n.current&&(t(!0),l(o("maintenanceServerIssues"))))}catch{i.current+=1,i.current>=2&&!n.current&&(t(!0),l(o("maintenanceServerUnreachable")))}finally{clearTimeout(r)}};e();let r=setInterval(e,1e4);return()=>clearInterval(r)},[o]),e)?(0,r.jsxs)("div",{className:"bg-amber-500/10 border-b border-amber-500/20 px-4 py-2.5 flex items-center justify-between gap-3 animate-in slide-in-from-top",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-500 text-[18px] animate-pulse",children:"warning"}),(0,r.jsx)("span",{className:"text-sm text-amber-200",children:s})]}),(0,r.jsx)("button",{onClick:()=>{n.current=!0,t(!1)},className:"p-1 rounded hover:bg-white/5 text-text-muted hover:text-text-main transition-colors","aria-label":o("close"),children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}):null}var u=e.i(618566),m=e.i(241937),x=e.i(513859);function p(e){let t,a=(0,s.c)(2),{isOpen:l,onClose:i}=e;return l?(a[0]!==i?(t=(0,r.jsx)(h,{onClose:i}),a[0]=i,a[1]=t):t=a[1],t):null}function h({onClose:e}){let t=(0,u.useRouter)(),s=(0,c.useTranslations)("sidebar"),l=(0,a.useRef)(null),i=(0,a.useRef)(null),[n,o]=(0,a.useState)(""),[d,p]=(0,a.useState)(0),[b,f]=(0,a.useState)(new Set),[g,y]=(0,a.useState)(null),[v,j]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=new AbortController;return fetch("/api/settings",{signal:e.signal}).then(e=>e.json()).then(e=>{f(new Set((0,m.normalizeHiddenSidebarItems)(e?.[m.HIDDEN_SIDEBAR_ITEMS_SETTING_KEY]))),y("string"==typeof e?.[m.SIDEBAR_PRESET_KEY]?e[m.SIDEBAR_PRESET_KEY]:null),j(e?.radarAdminUrl??null)}).catch(()=>{}),()=>e.abort()},[]),(0,a.useEffect)(()=>{let e=setTimeout(()=>l.current?.focus(),30);return()=>clearTimeout(e)},[]);let k=(0,a.useCallback)((e,t)=>{try{if("function"==typeof s.has&&!s.has(e))return t;return s(e)}catch{return t}},[s]),N=(0,a.useMemo)(()=>(0,m.resolveRuntimeSidebarSections)(x.SIDEBAR_SECTIONS,{radarAdminUrl:v}).flatMap(e=>{let t=k(e.titleKey,e.titleFallback);return e.children.flatMap(r=>{if("type"in r&&"group"===r.type){let s=k(r.titleKey,r.titleFallback);return r.items.filter(e=>!b.has(e.id)||"essentials"===g&&m.ESSENTIALS_ADVANCED_TOOL_IDS.has(e.id)).map(a=>({id:a.id,href:a.href,icon:a.icon,label:k(a.i18nKey,a.labelFallback??a.id),subtitle:a.subtitleKey?k(a.subtitleKey,a.subtitleFallback??""):a.subtitleFallback,external:a.external??!1,sectionId:e.id,sectionLabel:t,subgroupId:r.id,subgroupLabel:s}))}return b.has(r.id)&&!("essentials"===g&&m.ESSENTIALS_ADVANCED_TOOL_IDS.has(r.id))?[]:[{id:r.id,href:r.href,icon:r.icon,label:k(r.i18nKey,r.labelFallback??r.id),subtitle:r.subtitleKey?k(r.subtitleKey,r.subtitleFallback??""):r.
1subtitleFallback,external:r.external??!1,sectionId:e.id,sectionLabel:t}]})}),[b,v,k,g]),w=(0,a.useMemo)(()=>{let e=n.trim().toLowerCase();return e?N.filter(t=>t.label.toLowerCase().includes(e)||t.subtitle?.toLowerCase().includes(e)||t.sectionLabel.toLowerCase().includes(e)||t.subgroupLabel?.toLowerCase().includes(e)):N},[N,n]),S=(0,a.useMemo)(()=>{let e=[],t=new Map;return w.forEach((r,s)=>{let a=t.get(r.sectionId);a||(a={sectionId:r.sectionId,sectionLabel:r.sectionLabel,subgroups:[]},t.set(r.sectionId,a),e.push(a));let l=r.subgroupId??null,i=a.subgroups.find(e=>e.subgroupId===l);i||(i={subgroupId:l,subgroupLabel:r.subgroupLabel??null,items:[]},a.subgroups.push(i)),i.items.push({item:r,flatIndex:s})}),e},[w]),_=(0,a.useCallback)((r,s)=>{e(),s?window.open(r,"_blank","noopener,noreferrer"):t.push(r)},[e,t]);return(0,a.useEffect)(()=>{let t=t=>{if("Escape"===t.key)return void e();if("ArrowDown"===t.key)t.preventDefault(),p(e=>(e+1)%Math.max(1,w.length));else if("ArrowUp"===t.key)t.preventDefault(),p(e=>(e-1+Math.max(1,w.length))%Math.max(1,w.length));else if("Enter"===t.key){t.preventDefault();let e=w[d];e&&_(e.href,e.external)}};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[w,d,e,_]),(0,a.useEffect)(()=>{let e=i.current;if(!e)return;let t=e.querySelector(`[data-flat-index="${d}"]`);t?.scrollIntoView({block:"nearest"})},[d]),(0,r.jsxs)("div",{className:"fixed inset-0 z-[60] flex items-start justify-center pt-[10vh] px-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm",onClick:e,"aria-hidden":"true"}),(0,r.jsxs)("div",{className:"relative w-full max-w-3xl bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl overflow-hidden animate-in fade-in zoom-in-95 duration-200",role:"dialog","aria-modal":"true","aria-label":s("commandPalette.title"),children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 px-6 py-4 border-b border-black/5 dark:border-white/5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px] text-text-muted shrink-0",children:"search"}),(0,r.jsx)("input",{ref:l,type:"text",className:"flex-1 bg-transparent text-text placeholder:text-text-muted outline-none text-base",placeholder:s("commandPalette.searchPlaceholder"),value:n,onChange:e=>{o(e.target.value),p(0)},autoComplete:"off",spellCheck:!1}),n&&(0,r.jsx)("button",{className:"text-text-muted hover:text-text transition-colors",onClick:()=>{o(""),p(0)},tabIndex:-1,"aria-label":s("commandPalette.clearSearch"),children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})}),(0,r.jsx)("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-mono bg-black/5 dark:bg-white/5 text-text-muted border border-black/10 dark:border-white/10 shrink-0",children:"Esc"})]}),S.length>0?(0,r.jsx)("ul",{ref:i,className:"py-2 max-h-[60vh] overflow-y-auto custom-scrollbar",role:"listbox",children:S.map(e=>(0,r.jsxs)("li",{role:"presentation",children:[(0,r.jsx)("div",{className:"sticky top-0 z-10 bg-surface/95 backdrop-blur-sm px-6 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-text-muted border-b border-black/5 dark:border-white/5",children:e.sectionLabel}),(0,r.jsx)("ul",{role:"group","aria-label":e.sectionLabel,children:e.subgroups.map(t=>(0,r.jsxs)("li",{role:"presentation",children:[t.subgroupLabel&&(0,r.jsx)("div",{className:"px-6 pt-2 pb-1 text-[10px] font-medium uppercase tracking-wide text-text-muted/70",children:t.subgroupLabel}),(0,r.jsx)("ul",{role:t.subgroupLabel?"group":"presentation","aria-label":t.subgroupLabel??void 0,children:t.items.map(({item:e,flatIndex:s})=>(0,r.jsx)("li",{role:"option","aria-selected":s===d,"data-flat-index":s,children:(0,r.jsxs)("button",{className:`w-full flex items-center gap-3 ${t.subgroupLabel?"pl-10 pr-6":"px-6"} py-2.5 text-left transition-colors ${s===d?"bg-accent/10 text-accent ring-1 ring-inset ring-accent/20":"text-text hover:bg-black/5 dark:hover:bg-white/5"}`,onClick:()=>_(e.href,e.external),onMouseEnter:()=>p(s),children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[18px] shrink-0 ${s===d?"text-accent":"text-text-muted"}`,children:e.icon}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-sm font-medium truncate",children:e.label}),e.subtitle&&(0,r.jsx)("p",{className:`text-xs truncate ${s===d?"text-accent/70":"text-text-muted"}
1`,children:e.subtitle})]}),e.external&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted shrink-0",children:"open_in_new"})]})},e.id))})]},`${e.sectionId}::${t.subgroupId??"_root"}`))})]},e.sectionId))}):(0,r.jsx)("div",{className:"py-10 text-center text-text-muted text-sm",children:s("noResults")}),(0,r.jsxs)("div",{className:"flex items-center gap-4 px-4 py-2 border-t border-black/5 dark:border-white/5 text-[11px] text-text-muted",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("kbd",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/5 border border-black/10 dark:border-white/10 font-mono",children:"ââ"}),s("commandPalette.navigate")]}),(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("kbd",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/5 border border-black/10 dark:border-white/10 font-mono",children:"âµ"}),s("commandPalette.open")]}),(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("kbd",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/5 border border-black/10 dark:border-white/10 font-mono",children:"Esc"}),s("commandPalette.close")]})]})]})]})}function b(){let e,t,l,i,n,o,c,d,m=(0,s.c)(14),x=(0,u.usePathname)(),p=(0,u.useSearchParams)(),[h,b]=(0,a.useState)(!1),[g,y]=(0,a.useState)(0);m[0]!==p?(e=p?.toString()??"",m[0]=p,m[1]=e):e=m[1];let v=(0,a.useRef)(`${x}?${e}`),j=(0,a.useRef)(null),k=(0,a.useRef)(null),N=(0,a.useRef)(null);if(m[2]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{let e=e=>{if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||0!==e.button)return;let t=e.target?.closest?.("a");if(!t||t.target&&""!==t.target&&"_self"!==t.target||t.hasAttribute("download"))return;let r=t.getAttribute("href");
1if(!(!r||r.startsWith("#"))&&!(r.startsWith("mailto:")||r.startsWith("tel:"))){try{let e=new URL(t.href,window.location.href);if(e.origin!==window.location.origin)return;let r=`${window.location.pathname}?${window.location.search}`,s=`${e.pathname}?${e.search}`;if(r===s)return}catch{return}queueMicrotask(()=>{b(!0),y(8)})}};return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)},l=[],m[2]=t,m[3]=l):(t=m[2],l=m[3]),(0,a.useEffect)(t,l),m[4]!==h?(i=()=>{if(h)return j.current=setInterval(()=>{y(f)},150),()=>{j.current&&(clearInterval(j.current),j.current=null)}},n=[h],m[4]=h,m[5]=i,m[6]=n):(i=m[5],n=m[6]),(0,a.useEffect)(i,n),m[7]!==x||m[8]!==p?(o=()=>{let e=`${x}?${p?.toString()??""}`;if(e!==v.current)return v.current=e,k.current&&clearTimeout(k.current),N.current&&clearTimeout(N.current),k.current=setTimeout(()=>{y(100),N.current=setTimeout(()=>{b(!1),y(0)},320)},220),()=>{k.current&&clearTimeout(k.current),N.current&&clearTimeout(N.current)}},c=[x,p],m[7]=x,m[8]=p,m[9]=o,m[10]=c):(o=m[9],c=m[10]),(0,a.useEffect)(o,c),!h&&0===g)return null;let w=`${g}%`,S=g>=100?0:1;return m[11]!==w||m[12]!==S?(d=(0,r.jsx)("div",{className:"pointer-events-none fixed inset-x-0 top-0 z-[9999] h-0.5","aria-hidden":"true",children:(0,r.jsx)("div",{className:"h-full origin-left bg-gradient-to-r from-primary via-accent to-primary transition-[width,opacity] duration-200 ease-out",style:{width:w,opacity:S,boxShadow:"0 0 10px rgba(99, 102, 241, 0.6), 0 0 4px rgba(229, 77, 94, 0.4)"}})}),m[11]=w,m[12]=S,m[13]=d):d=m[13],d}function f(e){return e>=88?e:Math.min(88,e+Math.min(12,Math.max(1,.18*(88-e))))}var g=e.i(70552);let y="x-omniroute-csrf",v=["/api/auth/oidc/","/api/v1/","/api/oauth/","/api/codex/connect/","/api/telegram/","/api/cursor-cli/"],j=new Set(["/api/auth/login","/api/auth/logout","/api/auth/status","/api/init","/api/sync/bundle","/api/cli/connect","/api/usage/om-usage","/api/skills/collect/chaos"]),k=["/api/health/ping","/api/monitoring/health","/api/settings/require-login"],N=new Set(["/api/health"]),w=new Set(["GET","HEAD","OPTIONS"]),S=[{path:"/api/cloud/auth",methods:new Set(["POST","OPTIONS"])},{path:"/api/cloud/model/resolve",methods:new Set(["POST","OPTIONS"])},{path:"/api/cloud/models/alias",methods:new Set(["GET","HEAD","OPTIONS"])}];function _(e,t){return e===t||e===`${t}/`}function C(e,t){for(let r of t)if(_(e,r))return!0;return!1}let T=["/api/oauth/cursor/auto-import","/api/oauth/kiro/auto-import"],E=null,I=null,D=null,L=0,A=["/chat/completions","/responses","/models","/codex"],K=["/a2a"];function R(e=Date.now()){return E&&E.expiresAtMs-e>3e4?E.token:null}async function F(e){try{let t=await fetch("/api/auth/csrf",{cache:"no-store",credentials:"same-origin"});if(!t.ok)return null;let r=await t.json().catch(()=>null);if("string"!=typeof r?.token||"string"!=typeof r.expiresAt)return E=null,null;let s=Date.parse(r.expiresAt);if(!Number.isFinite(s)||s<=e)return E=null,null;return(E={token:r.token,expiresAtMs:s}).token}catch{return null}}async function O(){let e=R();return e||(I||(I=F(Date.now()).finally(()=>{I=null})),I)}function M(e){return"u">typeof Request&&e instanceof Request?e:null}var P=e.i(554364);let $="sidebar-collapsed",B="1"===t.default.env.NEXT_PUBLIC_OMNIROUTE_E2E_MODE;function z(e){return!e}function U(){let e=(0,P.installBasePathFetch)(),t=function(){if("function"!=typeof globalThis.fetch)return()=>{};0===L&&(D=globalThis.fetch,globalThis.fetch=async(e,t)=>{if(!D||!function(e,t){var r,s,a;let l,i,n=(t?.method?t.method:M(e)?.method??"GET").toUpperCase();if(!["POST","PUT","PATCH","DELETE"].includes(n))return!1;let o=(i=M(e))?i.url:e instanceof URL?e.href:"string"==typeof e?e:null;if(!o)return!1;try{l=new URL(o,window.location.href)}catch{return!1}return l.origin===window.location.origin&&(r=l,s=n,!!K.some(e=>r.pathname===e||r.pathname.startsWith(e+"/"))||r.pathname.startsWith("/api/")&&"/api/auth/csrf"!==r.pathname&&!function(e,t="GET"){let r;return!T.some(t=>e===t||e.startsWith(`${t}/`))&&(r=String(t).toUpperCase(),!!(S.some(({path:t,methods:s})=>_(e,t)&&s.has(r))||C(e,j)||v.some(t=>e.startsWith(t)))||!!w.has(String(t).toUpperCase())&&(!!C(e,N)||function(e,t="GET"){return!!w.has(String(t).toUpperCase())&&C(e,k)}(e,t)))}(r.pathname,s)&&!("/api/v1"===(a=r.pathname)||a.startsWith("/api/v1/")||"/api/v1beta"===a||a.startsWith("/api/v1beta/")||"/v1"===a||a.startsWith("/v1/")||"/v1beta"===a||a.startsWith("/v1beta/")||"/v1/v1"===a||a.startsWith("/v1/v1/")||A.some(e=>a===e||a.startsWith(e+"/"))))}(e,t))return D?D(e,t):fetch(e,t);let r=new Headers(t?.headers??M(e)?.headers);if(r.has(y))return D(e,t);let s=R()??await O();return s?(r.set(y,s),D(e,{...t,headers:r})):D(e,t)}),L++;let e=!0;return()=>{e&&(e=!1,0===(L=Math.max(0,L-1))&&D&&(globalThis.fetch=D,D=null))}}();return O(),()=>{t(),e()}}function q(){document.body.classList.remove("electron-macos")}
1e.s(["default",0,function(e){let t,c,u,m,x,h,f,y,v,j,k,N,w,S,_,C,T,E,I,D,L,A,K,R=(0,s.c)(39),{children:F}=e,[O,M]=(0,a.useState)(!1),[P,H]=(0,a.useState)(!1),W=(0,g.useIsElectron)(),[G,J]=(0,a.useState)(!1);R[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{try{"true"===localStorage.getItem($)&&setTimeout(()=>J(!0),0)}catch{}},c=[],R[0]=t,R[1]=c):(t=R[0],c=R[1]),(0,a.useEffect)(t,c);let V=W&&void 0!==globalThis.window&&globalThis.electronAPI?.platform==="darwin";R[2]!==V?(u=()=>{if("u">typeof document)return document.body.classList.toggle("electron-macos",V),q},m=[V],R[2]=V,R[3]=u,R[4]=m):(u=R[3],m=R[4]),(0,a.useEffect)(u,m),R[5]===Symbol.for("react.memo_cache_sentinel")?(x=[],R[5]=x):x=R[5],(0,a.useInsertionEffect)(U,x),R[6]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),H(z))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},f=[],R[6]=h,R[7]=f):(h=R[6],f=R[7]),(0,a.useEffect)(h,f),R[8]!==G?(y=()=>{let e=!G;J(e),localStorage.setItem($,String(e))},R[8]=G,R[9]=y):y=R[9];let Y=y;R[10]===Symbol.for("react.memo_cache_sentinel")?(v=(0,r.jsx)(a.Suspense,{fallback:null,children:(0,r.jsx)(b,{})}),R[10]=v):v=R[10],R[11]!==O?(j=O&&(0,r.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 lg:hidden",onClick:()=>M(!1)}),R[11]=O,R[12]=j):j=R[12],R[13]!==G||R[14]!==Y||R[15]!==V?(k=(0,r.jsx)("div",{className:"dashboard-sidebar-desktop",children:(0,r.jsx)(l.default,{collapsed:G,onToggleCollapse:Y,isMacElectron:V})}),R[13]=G,R[14]=Y,R[15]=V,R[16]=k):k=R[16];let X=`fixed start-0 z-50 transform lg:hidden transition-transform duration-300 ease-in-out h-dvh overflow-y-auto ${O?"translate-x-0":"-translate-x-full"}`;return R[17]===Symbol.for("react.memo_cache_sentinel")?(N={top:"var(--ios-safe-top, 0px)",bottom:"var(--ios-safe-bottom, 0px)"},R[17]=N):N=R[17],R[18]===Symbol.for("react.memo_cache_sentinel")?(w=()=>M(!1),R[18]=w):w=R[18],R[19]!==V?(S=(0,r.jsx)(l.default,{onClose:w,isMacElectron:V}),R[19]=V,R[20]=S):S=R[20],R[21]!==X||R[22]!==S?(_=(0,r.jsx)("div",{className:X,style:N,children:S}),R[21]=X,R[22]=S,R[23]=_):_=R[23],R[24]===Symbol.for("react.memo_cache_sentinel")?(C=(0,r.jsx)(i.default,{onMenuClick:()=>M(!0),onOpenCommandPalette:()=>H(!0)}),T=!B&&(0,r.jsx)(d,{}),R[24]=C,R[25]=T):(C=R[24],T=R[25]),R[26]===Symbol.for("react.memo_cache_sentinel")?(E=(0,r.jsx)(o.default,{}),R[26]=E):E=R[26],R[27]!==F?(I=(0,r.jsxs)("main",{id:"main-content",className:"relative flex min-h-0 flex-1 min-w-0 flex-col transition-colors duration-300",children:[C,T,(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden custom-scrollbar p-4 sm:p-6 lg:p-10",children:(0,r.jsxs)("div",{className:"max-w-[3840px] mx-auto w-full h-full min-h-0 flex flex-col",children:[E,(0,r.jsx)("div",{className:"flex-1 min-h-0",children:F})]})})]}),R[27]=F,R[28]=I):I=R[28],R[29]===Symbol.for("react.memo_cache_sentinel")?(D=(0,r.jsx)(n.default,{}),R[29]=D):D=R[29],R[30]===Symbol.for("react.memo_cache_sentinel")?(L=()=>H(!1),R[30]=L):L=R[30],R[31]!==P?(A=(0,r.jsx)(p,{isOpen:P,onClose:L}),R[31]=P,R[32]=A):A=R[32],R[33]!==j||R[34]!==k||R[35]!==_||R[36]!==I||R[37]!==A?(K=(0,r.jsxs)("div",{className:"flex h-dvh min-h-0 w-full overflow-hidden",children:[v,j,k,_,I,D,A]}),R[33]=j,R[34]=k,R[35]=_,R[36]=I,R[37]=A,R[38]=K):K=R[38],K}],165149)},241937,974440,513859,e=>{"use strict";let t=["home","api-manager","endpoints","providers","model-catalog","embedded-services","combos","combos-live","quota","context-settings","context-combos","context-caveman","context-rtk","context-headroom","context-session-dedup","context-ccr","context-llmlingua","context-lite","context-aggressive","context-ultra","context-omniglyph","compression-studio","compression-exclusions","cli-code","cli-agents","acp-agents","cloud-agents","conductor","orchestration","agent-bridge","traffic-inspector","discovery","api-endpoints","webhooks","log-export","mitm-proxy","1proxy","analytics","analytics-combo-health","analytics-utilization","costs","cache","analytics-compression","analytics-search","analytics-evals","provider-stats","activity","logs","logs-proxy","logs-console","logs-timeline","conversations","logs-activity","health","runtime","resilience-connections","costs-pricing","costs-budget","costs-free-tiers","costs-quota-s
1hare","free-provider-rankings","radar","radar-admin","audit","audit-mcp","audit-a2a","translator","playground","search-tools","memory","skills","agent-skills","chaos-config","mcp","a2a","plugins","leaderboard","profile","tokens","gamification-admin","media","batch","batch-files","settings-general","settings-appearance","settings-ai","settings-modality-bridge","settings-routing","settings-resilience","settings-advanced","settings-security","settings-access-tokens","settings-feature-flags","settings-cache","settings-sidebar","docs","issues","changelog"];e.s(["HIDEABLE_SIDEBAR_ITEM_IDS",0,t],974440);var r=e.i(681307);let s=r.z.string().trim().min(1).max(2048).url().transform((e,t)=>{let s=new URL(e);return!("https:"===s.protocol||"http:"===s.protocol&&function(e){let t=e.toLowerCase();if("localhost"===t||"[::1]"===t)return!0;let r=t.split(".");return 4===r.length&&"127"===r[0]&&r.every(e=>/^\d{1,3}$/.test(e)&&255>=Number(e))}(s.hostname))||s.username||s.password?(t.addIssue({code:r.z.ZodIssueCode.custom,message:"Radar Admin URL must be HTTPS or HTTP loopback without credentials"}),r.z.NEVER):s.toString()}),a={home:"#60A5FA","api-manager":"#F59E0B",endpoints:"#38BDF8",providers:"#818CF8",combos:"#A855F7",quota:"#F472B6","context-caveman":"#F97316","context-rtk":"#2DD4BF","context-combos":"#C084FC","cli-code":"#FACC15","cli-agents":"#93C5FD","cloud-agents":"#7DD3FC","api-endpoints":"#14B8A6",webhooks:"#EC4899",proxy:"#A3E635","mitm-proxy":"#FB7185","1proxy":"#22D3EE",analytics:"#06B6D4","analytics-combo-health":"#34D399","analytics-utilization":"#FBBF24",costs:"#FB923C",cache:"#84CC16","analytics-compression":"#F97316","analytics-search":"#38BDF8","analytics-evals":"#A78BFA",logs:"#CBD5E1","logs-proxy":"#A3E635","logs-console":"#FACC15","logs-timeline":"#F472B6","logs-activity":"#60A5FA",health:"#EF4444",runtime:"#F59E0B","resilience-connections":"#22C55E","costs-pricing":"#FB923C","costs-budget":"#22C55E","costs-quota-share":"#06B6D4","radar-admin":"#F59E0B",audit:"#F43F5E","audit-mcp":"#818CF8","audit-a2a":"#A855F7",translator:"#3B82F6",playground:"#EAB308","search-tools":"#0891B2",memory:"#10B981",skills:"#F43F5E","agent-skills":"#D946EF",mcp:"#8B5CF6",a2a:"#06B6D4",leaderboard:"#FACC15",profile:"#60A5FA",tokens:"#A3E635","gamification-admin":"#F87171",media:"#D946EF",batch:"#14B8A6","batch-files":"#38BDF8","settings-general":"#64748B","settings-appearance":"#D946EF","settings-ai":"#A78BFA","settings-modality-bridge":"#8B5CF6","settings-routing":"#06B6D4","settings-resilience":"#22C55E","settings-advanced":"#F97316","settings-security":"#EF4444","settings-feature-flags":"#FACC15","settings-cache":"#84CC16","settings-sidebar":"#38BDF8",docs:"#2563EB",issues:"#DC2626",changelog:"#F59E0B"},l={},i={id:"radar-admin",href:"",i18nKey:"radarAdmin",labelFallback:"Radar Admin â",subtitleKey:"radarAdminSubtitle",subtitleFallback:"Private operations panel",icon:"admin_panel_settings",external:!0},n=new Set(["home","endpoints","api-manager","providers","health","settings-general","settings-sidebar"]),o=new Set(["playground","logs","batch","translator","combos","quota","analytics","costs","cache","runtime","resilience-connections","mcp","a2a","memory","skills"]),c=new Set(["home","endpoints","api-manager","providers","combos","analytics","costs","logs","health","settings-general","settings-sidebar","docs","changelog"]),d=new Set(["home","endpoints","api-manager","providers","combos","quota","context-caveman","context-rtk","context-combos","cli-code","cli-agents","acp-agents","api-endpoints","analytics","analytics-combo-health","costs","cache","logs","health","runtime","resilience-connections","translator","playground","memory","skills","mcp","a2a","settings-general","settings-modality-bridge","settings-routing","settings-resilience","settings-sidebar","docs","issues","changelog"]),u=new Set(["home","endpoints","api-manager","providers","combos","quota","analytics","analytics-combo-health","analytics-utilization","costs","costs-pricing","costs-budget","costs-quota-share","radar-admin","cache","logs","activity","health","runtime","audit","audit-mcp","audit-a2a","settings-general","settings-modality-bridge","settings-routing","settings-resilience","settings-security","settings-access-tokens","
1settings-feature-flags","settings-sidebar","docs","changelog"]);function m(e){return t.filter(t=>!e.has(t))}let x=[{id:"all",icon:"select_all",hiddenItems:[]},{id:"essentials",icon:"star",hiddenItems:m(n)},{id:"minimal",icon:"minimize",hiddenItems:m(c)},{id:"developer",icon:"code",hiddenItems:m(d)},{id:"admin",icon:"admin_panel_settings",hiddenItems:m(u)}];e.s(["ESSENTIALS_ADVANCED_TOOL_IDS",0,o,"HIDDEN_SIDEBAR_ITEMS_SETTING_KEY",0,"hiddenSidebarItems","SIDEBAR_ITEM_ORDER_KEY",0,"sidebarItemOrder","SIDEBAR_PRESETS",0,x,"SIDEBAR_PRESET_KEY",0,"sidebarActivePreset","SIDEBAR_SECTION_ORDER_KEY",0,"sidebarSectionOrder","SIDEBAR_SETTINGS_UPDATED_EVENT",0,"omniroute:settings-updated","applyItemOrder",0,function(e,t){if(0===t.length)return[...e];let r=e=>("type"in e&&e.type,e.id),s=new Set(e.map(r)),a=t.filter(e=>s.has(e)),l=new Map(a.map((e,t)=>[e,t]));return[...e].sort((t,s)=>{let i=r(t),n=r(s);return(l.get(i)??a.length+e.indexOf(t))-(l.get(n)??a.length+e.indexOf(s))})},"applySectionOrder",0,function(e,t){if(0===t.length)return[...e];let r=new Set(e.map(e=>e.id)),s=t.filter(e=>r.has(e)),a=new Map(s.map((e,t)=>[e,t]));return[...e].sort((t,r)=>(a.get(t.id)??s.length+e.indexOf(t))-(a.get(r.id)??s.length+e.indexOf(r)))},"getSectionItems",0,function(e){return e.children.flatMap(e=>"type"in e&&"group"===e.type?e.items:[e])},"getSidebarIconAccent",0,function(e){return a[e]||l[e]||function(e){let t=0;for(let r=0;r<e.length;r+=1)t=31*t+e.charCodeAt(r)>>>0;let r=.72*(1-Math.abs(.1200000000000001)),s=t%360/60,a=r*(1-Math.abs(s%2-1)),l=.56-r/2,[i,n,o]=s<1?[r,a,0]:s<2?[a,r,0]:s<3?[0,r,a]:s<4?[0,a,r]:s<5?[a,0,r]:[r,0,a];return[i,n,o].map(e=>Math.round((e+l)*255).toString(16).padStart(2,"0").toUpperCase()).join("").replace(/^/,"#")}(e)},"isSidebarItemVisibleForFlags",0,function(e,t){return!e.featureFlagKey||!1!==t[e.featureFlagKey]},"normalizeHiddenSidebarItems",0,function(e){if(!Array.isArray(e))return[];let r=new Set;for(let s of e)"string"==typeof s&&t.includes(s)&&r.add(s);return t.filter(e=>r.has(e))},"resolveRuntimeSidebarSections",0,function(e,t){var r;let a,l=(r=t.radarAdminUrl,(a=s.safeParse(r)).success?a.data:null);return l?e.map(e=>{if("costs"!==e.id)return e;let t=e.children.filter(e=>!("id"in e&&e.id===i.id)),r=t.findIndex(e=>!("type"in e)&&"radar"===e.id),s=r>=0?r+1:t.length,a=[...t];return a.splice(s,0,{...i,href:l}),{...e,children:a}}):[...e]}],241937);let p=[{id:"home",titleKey:"home",titleFallback:"Home",children:[{id:"home",href:"/home",i18nKey:"home",subtitleKey:"homeSubtitle",icon:"home",exact:!0}],showTitle:!1},{id:"omni-proxy",titleKey:"omniProxySection",titleFallback:"OmniProxy",children:[{id:"endpoints",href:"/dashboard/endpoint",i18nKey:"endpoints",subtitleKey:"endpointsSubtitle",icon:"api"},{id:"api-manager",href:"/dashboard/api-manager",i18nKey:"apiManager",subtitleKey:"apiManagerSubtitle",icon:"vpn_key"},{id:"providers",href:"/dashboard/providers",i18nKey:"providers",subtitleKey:"providersSubtitle",icon:"dns"},{id:"model-catalog",href:"/dashboard/models",i18nKey:"modelCatalog",labelFallback:"Model catalog",subtitleKey:"modelCatalogSubtitle",subtitleFallback:"Browse models across providers",icon:"view_list"},{id:"embedded-services",href:"/dashboard/providers/services",i18nKey:"embeddedServices",subtitleKey:"embeddedServicesSubtitle",icon:"deployed_code"},{id:"combos",href:"/dashboard/combos",i18nKey:"combos",subtitleKey:"combosSubtitle",icon:"layers"},{id:"combos-live",href:"/dashboard/combos/live",i18nKey:"combosLive",labelFallback:"Combo Studio",subtitleKey:"combosLiveSubtitle",subtitleFallback:"Live routing cascade",icon:"account_tree"},{id:"quota",href:"/dashboard/quota",i18nKey:"providerQuota",subtitleKey:"providerQuotaSubtitle",icon:"tune"},{id:"costs-quota-share",href:"/dashboard/costs/quota-share",i18nKey:"costsQuotaShare",subtitleKey:"costsQuotaShareSubtitle",icon:"pie_chart"},{type:"group",id:"compression-context",titleKey:"compressionContextGroup",titleFallback:"Compression Context",items:[{id:"context-settings",href:"/dashboard/context/settings",i18nKey:"contextSettings",labelFallback:"Compression Settings",subtitleKey:"contextSettingsSubtitle",subt
1itleFallback:"Global defaults",icon:"settings"},{id:"context-combos",href:"/dashboard/context/combos",i18nKey:"contextCombos",subtitleKey:"contextCombosSubtitle",icon:"hub"},{id:"context-caveman",href:"/dashboard/context/caveman",i18nKey:"contextCaveman",subtitleKey:"contextCavemanSubtitle",icon:"compress"},{id:"context-rtk",href:"/dashboard/context/rtk",i18nKey:"contextRtk",subtitleKey:"contextRtkSubtitle",icon:"filter_alt"},{id:"context-headroom",href:"/dashboard/context/headroom",i18nKey:"contextHeadroom",labelFallback:"Headroom",subtitleKey:"contextHeadroomSubtitle",subtitleFallback:"Tabular compaction",icon:"table_rows"},{id:"context-session-dedup",href:"/dashboard/context/session-dedup",i18nKey:"contextSessionDedup",labelFallback:"Session Dedup",subtitleKey:"contextSessionDedupSubtitle",subtitleFallback:"Cross-turn dedup",icon:"content_copy"},{id:"context-ccr",href:"/dashboard/context/ccr",i18nKey:"contextCcr",labelFallback:"CCR",subtitleKey:"contextCcrSubtitle",subtitleFallback:"Retrieve markers",icon:"archive"},{id:"context-llmlingua",href:"/dashboard/context/llmlingua",i18nKey:"contextLlmlingua",labelFallback:"LLMLingua",subtitleKey:"contextLlmlinguaSubtitle",subtitleFallback:"Semantic pruning",icon:"psychology"},{id:"context-lite",href:"/dashboard/context/lite",i18nKey:"contextLite",labelFallback:"Lite",subtitleKey:"contextLiteSubtitle",subtitleFallback:"Fast whitespace cleanup",icon:"compress"},{id:"context-aggressive",href:"/dashboard/context/aggressive",i18nKey:"contextAggressive",labelFallback:"Aggressive",subtitleKey:"contextAggressiveSubtitle",subtitleFallback:"Summary + aging",icon:"speed"},{id:"context-ultra",href:"/dashboard/context/ultra",i18nKey:"contextUltra",labelFallback:"Ultra",subtitleKey:"contextUltraSubtitle",subtitleFallback:"Heuristic pruning",icon:"bolt"},{id:"context-omniglyph",href:"/dashboard/context/omniglyph",i18nKey:"contextOmniglyph",labelFallback:"OmniGlyph",subtitleKey:"contextOmniglyphSubtitle",subtitleFallback:"Context-as-image",icon:"grain"},{id:"compression-studio",href:"/dashboard/compression/studio",i18nKey:"compressionStudio",labelFallback:"Compression Studio",subtitleKey:"compressionStudioSubtitle",subtitleFallback:"Live engine cascade",icon:"monitoring"},{id:"compression-exclusions",href:"/dashboard/compression/exclusions",i18nKey:"compressionExclusions",labelFallback:"Exclusions",subtitleKey:"compressionExclusionsSubtitle",subtitleFallback:"Per-model/endpoint bypass",icon:"block"}]},{type:"group",id:"tools",titleKey:"toolsGroup",titleFallback:"Tools",items:[{id:"cli-code",href:"/dashboard/cli-code",i18nKey:"cliCode",subtitleKey:"cliCodeSubtitle",icon:"terminal"},{id:"cli-agents",href:"/dashboard/cli-agents",i18nKey:"cliAgents",subtitleKey:"cliAgentsSubtitle",icon:"smart_toy"},{id:"acp-agents",href:"/dashboard/acp-agents",i18nKey:"acpAgents",subtitleKey:"acpAgentsSubtitle",icon:"device_hub"},{id:"cloud-agents",href:"/dashboard/cloud-agents",i18nKey:"cloudAgents",subtitleKey:"cloudAgentsSubtitle",icon:"cloud"},{id:"conductor",href:"/dashboard/conductor",i18nKey:"conductor",subtitleKey:"conductorSubtitle",icon:"account_tree",labelFallback:"Conductor",subtitleFallback:"CLI-agent fleet"},{id:"orchestration",href:"/dashboard/orchestration",i18nKey:"orchestration",subtitleKey:"orchestrationSubtitle",icon:"account_tree"},{id:"agent-bridge",href:"/dashboard/tools/agent-bridge",i18nKey:"agentBridge",subtitleKey:"agentBridgeSubtitle",icon:"link"},{id:"traffic-inspector",href:"/dashboard/tools/traffic-inspector",i18nKey:"trafficInspector",subtitleKey:"trafficInspectorSubtitle",icon:"network_check"},{id:"discovery",href:"/dashboard/discovery",i18nKey:"discovery",subtitleKey:"discoverySubtitle",icon:"travel_explore"}]},{type:"group",id:"integrations",titleKey:"integrationsGroup",titleFallback:"Integrations",items:[{id:"api-endpoints",href:"/dashboard/api-endpoints",i18nKey:"apiEndpoints",subtitleKey:"apiEndpointsSubtitle",icon:"api"},{id:"webhooks",href:"/dashboard/webhooks",i18nKey:"webhooks",subtitleKey:"webhooksSubtitle",icon:"webhook"},{id:"log-export",href:"/dashboard/log-export",i18nKey:"logExport",subtitleKey:"logExportSubtitle",icon:"cloud_upload",labelFallback:"Log export",subtitleFallback:"Ship call logs out"}]},{id:"proxy",href:"/dashboard/system/proxy",i18nKey:"proxy",subtitleKey:"proxySubtitle",icon:"dns"}]},{id:"analytics",titleKey:"analyticsSection",titleFallback:"Analytics",children:[{id:"analytics",href:"/dashboard/analytics",i18nKey:"usage",subt
1itleKey:"usageSubtitle",icon:"analytics"},{id:"analytics-combo-health",href:"/dashboard/analytics/combo-health",i18nKey:"analyticsComboHealth",subtitleKey:"analyticsComboHealthSubtitle",icon:"monitor_heart"},{id:"analytics-utilization",href:"/dashboard/analytics/utilization",i18nKey:"analyticsUtilization",subtitleKey:"analyticsUtilizationSubtitle",icon:"bar_chart"},{id:"cache",href:"/dashboard/cache",i18nKey:"cache",subtitleKey:"cacheSubtitle",icon:"cached"},{id:"analytics-compression",href:"/dashboard/analytics/compression",i18nKey:"analyticsCompression",subtitleKey:"analyticsCompressionSubtitle",icon:"compress"},{id:"analytics-search",href:"/dashboard/analytics/search",i18nKey:"analyticsSearch",subtitleKey:"analyticsSearchSubtitle",icon:"manage_search"},{id:"analytics-evals",href:"/dashboard/analytics/evals",i18nKey:"analyticsEvals",subtitleKey:"analyticsEvalsSubtitle",icon:"labs"},{id:"provider-stats",href:"/dashboard/provider-stats",i18nKey:"providerStats",subtitleKey:"providerStatsSubtitle",icon:"speed"}]},{id:"costs",titleKey:"costsSection",titleFallback:"Costs",children:[{id:"costs",href:"/dashboard/costs",i18nKey:"costsOverview",subtitleKey:"costsOverviewSubtitle",icon:"account_balance_wallet"},{id:"costs-pricing",href:"/dashboard/costs/pricing",i18nKey:"costsPricing",subtitleKey:"costsPricingSubtitle",icon:"price_change"},{id:"costs-budget",href:"/dashboard/costs/budget",i18nKey:"costsBudget",subtitleKey:"costsBudgetSubtitle",icon:"savings"},{id:"costs-free-tiers",href:"/dashboard/free-tiers",i18nKey:"costsFreeTiers",subtitleKey:"costsFreeTiersSubtitle",icon:"request_quote"},{id:"free-provider-rankings",href:"/dashboard/free-provider-rankings",i18nKey:"freeProviderRankings",subtitleKey:"freeProviderRankingsSubtitle",icon:"leaderboard"},{id:"radar",href:"/dashboard/radar",i18nKey:"radar",subtitleKey:"radarSubtitle",icon:"radar",featureFlagKey:"RADAR_ENABLED"}]},{id:"monitoring",titleKey:"monitoringSection",titleFallback:"Monitoring",children:[{id:"activity",href:"/dashboard/activity",i18nKey:"activity",subtitleKey:"activitySubtitle",icon:"timeline"},{type:"group",id:"logs",titleKey:"logsGroup",titleFallback:"Logs",items:[{id:"logs",href:"/dashboard/logs",i18nKey:"logs",subtitleKey:"logsSubtitle",icon:"description"},{id:"logs-proxy",href:"/dashboard/logs/proxy",i18nKey:"logsProxy",subtitleKey:"logsProxySubtitle",icon:"lan"},{id:"logs-console",href:"/dashboard/logs/console",i18nKey:"consoleLogs",subtitleKey:"consoleLogsSubtitle",icon:"terminal"},{id:"logs-timeline",href:"/dashboard/logs/timeline",i18nKey:"logsTimeline",subtitleKey:"logsTimelineSubtitle",icon:"view_timeline"},{id:"conversations",href:"/dashboard/conversations",i18nKey:"conversations",subtitleKey:"conversationsSubtitle",icon:"forum"}]},{type:"group",id:"audit",titleKey:"auditGroup",titleFallback:"Audit",items:[{id:"audit",href:"/dashboard/audit",i18nKey:"auditLog",subtitleKey:"auditLogSubtitle",icon:"policy"},{id:"audit-mcp",href:"/dashboard/audit/mcp",i18nKey:"auditMcp",subtitleKey:"auditMcpSubtitle",icon:"security"},{id:"audit-a2a",href:"/dashboard/audit/a2a",i18nKey:"auditA2a",subtitleKey:"auditA2aSubtitle",icon:"device_hub"}]},{type:"group",id:"system",titleKey:"systemGroup",titleFallback:"System",items:[{id:"health",href:"/dashboard/health",i18nKey:"health",subtitleKey:"healthSubtitle",icon:"health_and_safety"},{id:"runtime",href:"/dashboard/runtime",i18nKey:"runtime",subtitleKey:"runtimeSubtitle",icon:"bolt"},{id:"resilience-connections",href:"/dashboard/resilience/connections",i18nKey:"resilienceConnections",subtitleKey:"resilienceConnectionsSubtitle",icon:"shield"}]}]},{id:"devtools",titleKey:"devtoolsSection",titleFallback:"Dev Tools",children:[{id:"translator",href:"/dashboard/translator",i18nKey:"translator",subtitleKey:"translatorSubtitle",icon:"translate"},{id:"playground",href:"/dashboard/playground",i18nKey:"playground",subtitleKey:"playgroundSubtitle",icon:"science"},{id:"search-tools",href:"/dashboard/search-tools",i18nKey:"searchTools",subtitleKey:"searchToolsSubtitle",icon:"manage_search"}]},{id:"agentic-features",titleKey:"agenticFeaturesSection",titleFallback:"Agentic Features",children:[{id:"memory",href:"/dashboard/memory",i18nKey:"memory",subtitleKey:"memorySubtitle",icon:"psychology"},{id:"agent-skills",href:"/dashboard/agent-skills",i18nKey:"agentSkills",subtitleKey:"agentSkillsSubtitle",icon:"share"},{id:"chaos-config",href:"/dashboard/chaos",i18nKey:"chaosConfig",labelFallback:"Chaos Mode",subtitleKey:"chaosConfigSubtitle",subt
1itleFallback:"Multi-model parallel execution",icon:"blender"},{id:"skills",href:"/dashboard/omni-skills",i18nKey:"omniSkills",subtitleKey:"omniSkillsSubtitle",icon:"auto_fix_high"},{id:"mcp",href:"/dashboard/mcp",i18nKey:"mcp",subtitleKey:"mcpSubtitle",icon:"hub"},{id:"a2a",href:"/dashboard/a2a",i18nKey:"a2a",subtitleKey:"a2aSubtitle",icon:"device_hub"},{id:"plugins",href:"/dashboard/plugins",i18nKey:"plugins",subtitleKey:"pluginsSubtitle",icon:"extension"}]},{id:"other-features",titleKey:"otherFeaturesSection",titleFallback:"Other Features",children:[{type:"group",id:"gamification",titleKey:"gamificationGroup",titleFallback:"Gamification",items:[{id:"leaderboard",href:"/dashboard/leaderboard",i18nKey:"leaderboard",subtitleKey:"leaderboardSubtitle",icon:"emoji_events"},{id:"profile",href:"/dashboard/profile",i18nKey:"profile",subtitleKey:"profileSubtitle",icon:"person"},{id:"tokens",href:"/dashboard/tokens",i18nKey:"tokens",subtitleKey:"tokensSubtitle",icon:"toll"},{id:"gamification-admin",href:"/dashboard/gamification/admin",i18nKey:"gamificationAdmin",subtitleKey:"gamificationAdminSubtitle",icon:"admin_panel_settings"}]},{id:"media",href:"/dashboard/cache/media",i18nKey:"media",subtitleKey:"mediaSubtitle",icon:"perm_media"},{type:"group",id:"batch",titleKey:"batchGroup",titleFallback:"Batch",items:[{id:"batch",href:"/dashboard/batch",i18nKey:"batch",subtitleKey:"batchSubtitle",icon:"view_list"},{id:"batch-files",href:"/dashboard/batch/files",i18nKey:"batchFiles",subtitleKey:"batchFilesSubtitle",icon:"folder"}]}]},{id:"configuration",titleKey:"configurationSection",titleFallback:"Configuration",children:[{id:"settings-general",href:"/dashboard/settings/general",i18nKey:"settingsGeneral",subtitleKey:"settingsGeneralSubtitle",icon:"tune"},{id:"settings-appearance",href:"/dashboard/settings/appearance",i18nKey:"settingsAppearance",subtitleKey:"settingsAppearanceSubtitle",icon:"palette"},{id:"settings-ai",href:"/dashboard/settings/ai",i18nKey:"settingsAi",subtitleKey:"settingsAiSubtitle",icon:"auto_awesome"},{id:"settings-modality-bridge",href:"/dashboard/settings/modality-bridge",i18nKey:"settingsModalityBridge",subt
1itleKey:"settingsModalityBridgeSubtitle",icon:"image_search"},{id:"settings-routing",href:"/dashboard/settings/routing",i18nKey:"globalRouting",subtitleKey:"globalRoutingSubtitle",icon:"route"},{id:"settings-resilience",href:"/dashboard/settings/resilience",i18nKey:"settingsResilience",subtitleKey:"settingsResilienceSubtitle",icon:"health_and_safety"},{id:"settings-advanced",href:"/dashboard/settings/advanced",i18nKey:"settingsAdvanced",subtitleKey:"settingsAdvancedSubtitle",icon:"engineering"},{id:"settings-security",href:"/dashboard/settings/security",i18nKey:"settingsSecurity",subtitleKey:"settingsSecuritySubtitle",icon:"shield"},{id:"settings-access-tokens",href:"/dashboard/settings/access-tokens",i18nKey:"settingsAccessTokens",labelFallback:"Access Tokens",subtitleKey:"settingsAccessTokensSubtitle",icon:"key"},{id:"settings-feature-flags",href:"/dashboard/settings/feature-flags",i18nKey:"settingsFeatureFlags",subtitleKey:"settingsFeatureFlagsSubtitle",icon:"flag"},{id:"settings-cache",href:"/dashboard/settings/cache",i18nKey:"settingsCache",subtitleKey:"settingsCacheSubtitle",icon:"memory"},{id:"settings-sidebar",href:"/dashboard/settings/sidebar",i18nKey:"settingsSidebar",subtitleKey:"settingsSidebarSubtitle",icon:"view_sidebar"}]},{id:"help",titleKey:"helpSection",titleFallback:"Help",children:[{id:"docs",href:"/docs",i18nKey:"docs",subtitleKey:"docsSubtitle",icon:"menu_book",external:!0},{id:"issues",href:"https://github.com/diegosouzapw/OmniRoute/issues",i18nKey:"issues",subtitleKey:"issuesSubtitle",icon:"bug_report",external:!0},{id:"changelog",href:"/dashboard/changelog",i18nKey:"changelog",subtitleKey:"changelogSubtitle",icon:"campaign"}]}];e.s(["SIDEBAR_SECTIONS",0,p],513859)},70552,e=>{"use strict";var t=e.i(500932),r=e.i(271645);function s(){return window.electronAPI?.isElectron===!0}function a(){return!1}let l=()=>()=>{};function i(){return(0,r.useSyncExternalStore)(l,s,a)}e.s(["useIsElectron",0,i,"useOpenExternal",0,function(){let e,r,s=(0,t.c)(4),a=i();s[0]!==a?(e=async e=>{a&&window.electronAPI?await window.electronAPI.openExternal(e):window.open(e,"_blank","noopener,noreferrer")},s[0]=a,s[1]=e):e=s[1];let l=e;return s[2]!==l?(r={openExternal:l},s[2]=l,s[3]=r):r=s[3],r}])},866213,e=>{"use strict";async function t(e,t){try{let s=await e.json();return r(s,t)}catch{}return t}function r(e,t){let r=e?.error;if("string"==typeof r&&r.trim())return r.trim();if(r&&"object"==typeof r){let e=r.details,t=Array.isArray(e)?e[0]:null;if(t&&"object"==typeof t){let e=t.message,r=t.field;if("string"==typeof e&&e.trim())return"string"==typeof r&&r.trim()?`${r.trim()}: ${e.trim()}`:e.trim()}let s=r.message;if("string"==typeof s&&s.trim())return s.trim()}return t}e.s(["errorMessageFromBody",0,r,"readFetchErrorMessage",0,t])}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.