PageSourceSearch

https://axonhubb88tk-ahub.hf.space/assets/route-Bx0qtJPN.js

js axonhubb88tk-ahub.hf.space collected 2026-10-03 16:42:25 UTC 66,818 bytes, 28 lines download raw bytes

1import{a as ze,b as P,h as ne,r as h,z as ye,t as $,aa as ae,A as Z,cj as Le,j as e,c as y,B as A,S as ie,g as Fe,aB as Qe,F as T,ck as Be,cl as He,b_ as Ue,Y as je,ab as Ve,bR as We,Z as Ke,aw as V,b3 as Ge,cm as Ye,cn as Ze,u as ve,co as Xe,ap as we,at as _e,au as Ne,av as qe,aq as ke,cp as Je,cq as et,cr as tt,a1 as st,a0 as at,i as rt,cs as nt,V as W}from"./index-8qrbfbuT.js";import{u as it,Z as ot}from"./use-mobile-CfMrB7Kn.js";import{S as lt,a as dt,b as ct,c as ut,d as mt}from"./sheet-xHprpzKv.js";import{T as pt,a as xt,b as ht,c as ft}from"./tooltip-Cd9UbCx8.js";import{P as gt}from"./panel-left-BzMbSoCp.js";import{L as Se}from"./language-switch-BJmmmXlm.js";import{D as X,a as J,b as ee,c as I,d as H,h as bt,i as yt,j as jt,f as oe,k as vt,l as wt}from"./dropdown-menu-DdiFcb-s.js";import{I as K}from"./IconCheck-Cl4S4UCM.js";import{B as Q}from"./badge-47rywyLe.js";import{P as _t,a as Nt,b as qt}from"./popover-B2QaOU7u.js";import{L as Ce}from"./loader-circle-xWraoUeg.js";import{R as kt}from"./refresh-cw-CmBXfLJJ.js";import{f as ue}from"./format-Cr--RMFj.js";import{P as St}from"./permission-guard-BJIAcMhj.js";import{u as Ct}from"./projects-CRJHRc8y.js";import{C as Me}from"./chevrons-up-down-C5WUu3r4.js";import{C as Mt,a as Dt,b as Tt}from"./collapsible-BKr6uYX0.js";import{C as De}from"./chevron-right-CLCaVSxY.js";import{A as me,a as pe,b as xe}from"./avatar-B8eDYxIc.js";import{A as Te}from"./driver-B4w0q6_T.js";import"./index-BeCzrEAu.js";import"./index-BhK8MCBt.js";import"./index-DHVgRi40.js";import"./index-CzWS5cpN.js";import"./index-DqAhwG2J.js";import"./check-plHkF2p1.js";import"./usePermissions-BGVthzjQ.js";import"./pagination-BLt2ioEv.js";import"./schemas-C3rUNQQu.js";import"./coerce-DO7ZTTNs.js";import"./index-CdCnyGD5.js";const Rt=[["path",{d:"M12 21a9 9 0 0 1 0 -18c4.97 0 9 3.582 9 8c0 1.06 -.474 2.078 -1.318 2.828c-.844 .75 -1.989 1.172 -3.182 1.172h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25",key:"svg-0"}],["path",{d:"M7.5 10.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M11.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}],["path",{d:"M15.5 10.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-3"}]],Et=ze("outline","palette","Palette",Rt);const It=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],$t=P("badge-check",It);const At=[["path",{d:"M22 14v-4",key:"14q9d5"}],["path",{d:"M6 14v-4",key:"14a6bd"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]],Pt=P("battery-low",At);const Ot=[["path",{d:"M10 10v4",key:"1mb2ec"}],["path",{d:"M14 10v4",key:"1nt88p"}],["path",{d:"M22 14v-4",key:"14q9d5"}],["path",{d:"M6 10v4",key:"1n77qd"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]],zt=P("battery-full",Ot);const Lt=[["path",{d:"M10 14v-4",key:"suye4c"}],["path",{d:"M22 14v-4",key:"14q9d5"}],["path",{d:"M6 14v-4",key:"14a6bd"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]],Ft=P("battery-medium",Lt);const Qt=[["path",{d:"M10 17h.01",key:"nbq80n"}],["path",{d:"M10 7v6",key:"nne03l"}],["path",{d:"M14 6h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2",key:"1m83kb"}],["path",{d:"M22 14v-4",key:"14q9d5"}],["path",{d:"M6 18H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"h8lgfh"}]],Bt=P("battery-warning",Qt);const Ht=[["path",{d:"M 22 14 L 22 10",key:"nqc4tb"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]],Ut=P("battery",Ht);const Vt=[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]],Wt=P("folder-kanban",Vt);const Kt=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Gt=P("log-out",Kt);function G(t){for(var s=1;s<arguments.length;s++){var a=arguments[s];for(var n in a)n!=="__proto__"&&(t[n]=a[n])}return t}var Yt={read:function(t){return t[0]==='"'&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decode
1URIComponent)}};function re(t,s){function a(i,l,o){if(!(typeof document>"u")){o=G({},s,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var d="";for(var c in o)o[c]&&(d+="; "+c,o[c]!==!0&&(d+="="+o[c].split(";")[0]));return document.cookie=i+"="+t.write(l,i)+d}}function n(i){if(!(typeof document>"u"||arguments.length&&!i)){for(var l=document.cookie?document.cookie.split("; "):[],o={},d=0;d<l.length;d++){var c=l[d].split("="),p=c.slice(1).join("=");try{var g=decodeURIComponent(c[0]);if(g in o||(o[g]=t.read(p,g)),i===g)break}catch{}}return i?o[i]:o}}return Object.create({set:a,get:n,remove:function(i,l){a(i,"",G({},l,{expires:-1}))},withAttributes:function(i){return re(this.converter,G({},this.attributes,i))},withConverter:function(i){return re(G({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(s)},converter:{value:Object.freeze(t)}})}var Zt=re(Yt,{path:"/"});const he="axonhub_dismissed_version",fe="axonhub_version_check_timestamp",Xt=600*1e3;function Jt(){const s=ne(l=>l.auth.user)?.isOwner??!1,a=h.useCallback(()=>{if(!s)return!1;const l=localStorage.getItem(fe);return l?Date.now()-parseInt(l,10)>=Xt:!0},[s]),{data:n}=ye({queryKey:["versionCheck"],queryFn:async()=>(await Z(Le)).checkForUpdate,onSuccess:()=>{localStorage.setItem(fe,Date.now().toString())},enabled:a(),retry:!1,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1}),i=h.useCallback((l,o)=>{$.info(ae.t("system.about.updateCheck.newVersionAvailable"),{description:`${ae.t("system.about.updateCheck.latestVersion")}: ${l}`,duration:1e4,action:{label:ae.t("system.about.updateCheck.viewRelease"),onClick:()=>{window.open(o,"_blank","noopener,noreferrer")}}})},[]);h.useEffect(()=>{!s||!n||!n.hasUpdate||localStorage.getItem(he)===n.latestVersion||(i(n.latestVersion,n.releaseUrl),localStorage.setItem(he,n.latestVersion))},[s,n,i])}const es="sidebar_state",ts=3600*24*7,ss="14rem",as="16rem",rs="3rem",ns="b",Re=h.createContext(null);function D(){const t=h.useContext(Re);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function is({defaultOpen:t=!0,open:s,onOpenChange:a,className:n,style:i,children:l,...o}){const d=it(),[c,p]=h.useState(!1),[g,z]=h.useState(t),R=s??g,L=h.useCallback(j=>{const q=typeof j=="function"?j(R):j;a?a(q):z(q),document.cookie=`${es}=${q}; path=/; max-age=${ts}`},[a,R]),O=h.useCallback(()=>d?p(j=>!j):L(j=>!j),[d,L,p]);h.useEffect(()=>{const j=q=>{q.key===ns&&(q.metaKey||q.ctrlKey)&&(q.preventDefault(),O())};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[O]);const C=R?"expanded":"collapsed",E=h.useMemo(()=>({state:C,open:R,setOpen:L,isMobile:d,openMobile:c,setOpenMobile:p,toggleSidebar:O}),[C,R,L,d,c,p,O]);return e.jsx(Re.Provider,{value:E,children:e.jsx(pt,{delayDuration:0,children:e.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":ss,"--sidebar-width-icon":rs,...i},className:y("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",n),...o,children:l})})})}function os({side:t="left",variant:s="sidebar",collapsible:a="offcanvas",className:n,children:i,...l}){const{isMobile:o,state:d,openMobile:c,setOpenMobile:p}=D();return a==="none"?e.jsx("div",{"data-slot":"sidebar",className:y("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",n),...l,children:i}):o?e.jsx(lt,{open:c,onOpenChange:p,...l,children:e.jsxs(dt,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":as},side:t,children:[e.jsxs(ct,{className:"sr-only",children:[e.jsx(ut,{children:"Sidebar"}),e.jsx(mt,{children:"Displays the mobile sidebar."})]}),e.jsx("div",{className:"flex h-full w-full flex-col",children:i})]})}):e.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":d,"data-collapsible":d==="collapsed"?a:"","data-variant":s,"data-side":t,"data-slot":"sidebar",children:[e.jsx("div",{"data-slot":"sidebar-gap",className:y("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",s==="floating"||s==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),e.jsx("div",{"data-slot":"sidebar-container",className:y("fixed top-14 bottom-0 z-10 hidden h-[calc(100vh-3.5rem)] w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",s==="floating"||s==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)",n),...l,children:e.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm",children:i})})]})}function ls({className:t,onClick:s,...a}){const{toggleSidebar:n}=D();return e.jsxs(A,{"data-sidebar":"trigger","data-slot":"sidebar-tr
1igger",variant:"ghost",size:"icon",className:y("size-7",t),onClick:i=>{s?.(i),n()},...a,children:[e.jsx(gt,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function ds({className:t,...s}){const{toggleSidebar:a}=D();return e.jsx("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:a,title:"Toggle Sidebar",className:y("hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",t),...s})}function cs({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:y("flex flex-col gap-2 p-2",t),...s})}function us({className:t,...s}){const a=h.useRef(null),[n,i]=h.useState(!1),l=h.useCallback(()=>{const o=a.current;if(!o)return;const d=o.scrollHeight>o.clientHeight,c=o.scrollTop+o.clientHeight>=o.scrollHeight-10;i(d&&!c)},[]);return h.useEffect(()=>{const o=a.current;if(!o)return;l();const d=new ResizeObserver(l);return d.observe(o),o.addEventListener("scroll",l),()=>{d.disconnect(),o.removeEventListener("scroll",l)}},[l]),e.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[e.jsx("div",{ref:a,"data-slot":"sidebar-content","data-sidebar":"content",className:y("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...s}),e.jsx("div",{className:y("absolute bottom-0 left-0 right-0 h-8 pointer-events-none transition-opacity duration-300 bg-gradient-to-t from-sidebar to-transparent",n?"opacity-100":"opacity-0")})]})}function ms({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:y("relative flex w-full min-w-0 flex-col p-2",t),...s})}function ps({className:t,asChild:s=!1,...a}){const n=s?ie:"div";return e.jsx(n,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:y("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...a})}function Ee({className:t,...s}){return e.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:y("flex w-full min-w-0 flex-col gap-1",t),...s})}function te({className:t,...s}){return e.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:y("group/menu-item relative",t),...s})}const xs=Fe("flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-primary data-[active=true]:font-medium data-[active=true]:text-primary-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function se({asChild:t=!1,isActive:s=!1,variant:a="default",size:n="default",tooltip:i,className:l,...o}){const d=t?ie:"button",{isMobile:c,state:p}=D(),g=e.jsx(d,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":n,"data-active":s,className:y(xs({variant:a,size:n}),l),...o});return i?(typeof i=="string"&&(i={children:i}),e.jsxs(xt,{children:[e.jsx(ht,{asChild:!0,children:g}),e.jsx(ft,{side:"right",align:"center",hidden:p!=="collapsed"||c,...i})]})):g}function hs({className:t,...s}){return e.jsx("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:y("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...s})}function fs({className:t,...s}){return e.jsx("li",{"data-slot":"sidebar-menu-sub-item","data-sidebar":"menu-sub-item",className:y("group/menu-sub-item relative",t),...s})}function gs({asChild:t=!1,size:s="md",isActive:a=!1,className:n,...i}){const l=t?ie:"a";return e.jsx(l,{"data-slot":"sidebar-menu-sub-button","data-sidebar":"menu-sub-button","data-size":s,"data-active":a,className:y("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focu
1s-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0","data-[active=true]:bg-primary data-[active=true]:text-primary-foreground",s==="sm"&&"text-xs",s==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",n),...i})}function Ie(){const{theme:t,setTheme:s,colorScheme:a,setColorScheme:n}=Qe(),{t:i}=T(),l=[{name:"blue",label:i("theme.colors.blue"),color:"bg-blue-500"},{name:"green",label:i("theme.colors.green"),color:"bg-green-500"},{name:"purple",label:i("theme.colors.purple"),color:"bg-purple-500"},{name:"orange",label:i("theme.colors.orange"),color:"bg-orange-500"},{name:"red",label:i("theme.colors.red"),color:"bg-red-500"},{name:"black",label:i("theme.colors.black"),color:"bg-black"},{name:"cream",label:i("theme.colors.cream"),color:"bg-amber-100"},{name:"claude",label:i("theme.colors.claude"),color:"bg-amber-600"},{name:"starry",label:i("theme.colors.starry"),color:"bg-blue-600"}];return h.useEffect(()=>{const o=t==="dark"?"#020817":"#fff",d=document.querySelector("meta[name='theme-color']");d&&d.setAttribute("content",o)},[t]),e.jsxs(X,{modal:!1,children:[e.jsx(J,{asChild:!0,children:e.jsxs(A,{variant:"ghost",size:"icon",className:"scale-95 rounded-full",children:[e.jsx(Be,{className:"size-[1.2rem] scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90"}),e.jsx(He,{className:"absolute size-[1.2rem] scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0"}),e.jsx("span",{className:"sr-only",children:i("theme.toggle")})]})}),e.jsxs(ee,{align:"end",children:[e.jsxs(I,{onClick:()=>s("light"),children:[i("theme.light")," ",e.jsx(K,{size:14,className:y("ml-auto",t!=="light"&&"hidden")})]}),e.jsxs(I,{onClick:()=>s("dark"),children:[i("theme.dark"),e.jsx(K,{size:14,className:y("ml-auto",t!=="dark"&&"hidden")})]}),e.jsxs(I,{onClick:()=>s("system"),children:[i("theme.system"),e.jsx(K,{size:14,className:y("ml-auto",t!=="system"&&"hidden")})]}),e.jsx(H,{}),e.jsxs(bt,{children:[e.jsxs(yt,{children:[e.jsx(Et,{size:14,className:"mr-2"}),i("theme.colorScheme"),e.jsx("div",{className:y("ml-auto h-3 w-3 rounded-full",l.find(o=>o.name===a)?.color||"bg-blue-500")})]}),e.jsx(jt,{children:l.map(o=>e.jsxs(I,{onClick:()=>n(o.name),className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:y("mr-2 h-3 w-3 rounded-full",o.color)}),o.label]}),e.jsx(K,{size:14,className:y("ml-auto",a!==o.name&&"hidden")})]},o.name))})]})]})]})}const bs=`
2  mutation CheckProviderQuotas {
3    checkProviderQuotas
4  }
5`,ys=`
6  mutation ResetChannelQuotaNow($channelID: ID!) {
7    resetChannelQuotaNow(channelID: $channelID)
8  }
9`,js=`
10  query ProviderQuotaStatuses($input: QueryChannelInput!) {
11    queryChannels(input: $input) {
12      edges {
13        node {
14          id
15          name
16          type
17          providerQuotaStatus {
18            status
19            nextResetAt
20            ready
21            quotaData
22            providerType
23          }
24        }
25      }
26    }
27  }
28`;async function $e(){return Z(bs)}async function vs(t){return Z(ys,{channelID:t})}function ws(t){const s=t.providerQuotaStatus,a=s?.providerType,n={id:t.id,name:t.name,quotaStatus:{status:s.status,nextResetAt:s.nextResetAt,ready:s.ready}};if(t.type==="claudecode")return{...n,type:"claudecode",quotaStatus:{...n.quotaStatus,quotaData:t.providerQuotaStatus.quotaData}};if(t.type==="codex")return{...n,type:"codex",quotaStatus:{...n.quotaStatus,quotaData:t.providerQuotaStatus.quotaData}};if(t.type==="github_copilot")return{...n,type:"github_copilot",quotaStatus:{...n.quotaStatus,quotaData:t.providerQuotaStatus.quotaData}};if(t.type==="nanogpt")return{...n,type:"nanogpt",quotaStatus:{...n.quotaStatus,quotaData:t.providerQuotaStatus.quotaData}};if(t.type==="nanogpt_responses")return{...n,type:"nanogpt_responses",quotaStatus:{...n.quotaStatus,quotaData:t.providerQuotaStatus.quotaData}};if(t.type==="openai"||t.type==="openai_responses"){const i=t.type;return a==="wafer"?{...n,type:i,providerType:"wafer",quotaStatus:{...n.quotaStatus,quotaData:t.providerQuotaStatus.quotaData}}:a==="synthetic"?{...n,type:i,providerType:"synthetic",quotaStatus:{...n.quotaStatus,quotaData:t.providerQuotaStatus.quotaData}}:a==="neuralwatt"?{...n,type:i,providerType:"neuralwatt",quotaStatus:{...n.quotaStatus,quotaData:t.providerQuotaStatus.quotaData}}:a==="apertis"?{...n,type:i,providerType:"apertis",quotaStatus:{...n.quotaStatus,quotaData:t.providerQuotaStatus.quotaData}}:{...n,type:i,providerType:void 0,quotaStatus:{...n.quotaStatus,quotaData:t.providerQuotaStatus.quotaData}}}return{...n,type:t.type,quotaStatus:{...n.quotaStatus,quotaData:t.providerQuotaStatus.quotaData}}}function _s(){const{data:t}=ye({queryKey:["provider-quotas"],queryFn:async()=>Z(js,{input:{where:{statusIn:["enabled"]}}}
28),refetchInterval:6e4,refetchIntervalInBackground:!0});return(t?.queryChannels?.edges?.map(n=>n.node)||[]).filter(n=>n.providerQuotaStatus==null?!1:n.providerQuotaStatus.quotaData?.error!=="channel has no credentials").map(ws)}const Ns=.02,ge={green:"bg-green-500/10 text-green-500 border-green-500/20 hover:bg-green-500/20",red:"bg-red-500/10 text-red-500 border-red-500/20 hover:bg-red-500/20",amber:"bg-amber-500/10 text-amber-500 border-amber-500/20 hover:bg-amber-500/20"},qs={available:"quota.status.available",warning:"quota.status.warning",exhausted:"quota.status.exhausted",unknown:"quota.status.unknown"};function Ae(t){switch(t){case"full":return zt;case"medium":return Ft;case"low":return Pt;case"warning":return Bt;default:return Ut}}function Pe(t,s){if(s==="exhausted")return"warning";const a=100-t;return a<5?"empty":a<20?"low":a<80?"medium":"full"}function M(t){return t==="openai"||t==="openai_responses"}function Oe(t){let s=0;if(!t.quotaStatus)return 0;if(t.type==="claudecode"){const a=t.quotaStatus.quotaData,n=a.windows?.["5h"]?.utilization||0,i=a.windows?.["7d"]?.utilization||0;s=Math.max(n,i)*100}else if(t.type==="codex")s=t.quotaStatus.quotaData.rate_limit?.primary_window?.used_percent||0;else if(t.type==="github_copilot"){const a=t.quotaStatus.quotaData;let n=100;const i=a.limited_user_quotas,l=a.total_quotas;i&&Object.entries(i).forEach(([o,d])=>{if(typeof d=="number"){const c=l?.[o]??d;c>0&&(n=Math.min(n,d/c*100))}}),a.quota_snapshots&&Object.values(a.quota_snapshots).forEach(o=>{o&&!o.unlimited&&typeof o.percent_remaining=="number"&&(n=Math.min(n,o.percent_remaining))}),s=100-n}else if(t.type==="nanogpt"||t.type==="nanogpt_responses"){const a=t.quotaStatus?.quotaData;if(!a)return 0;let n=0;a.windows?.weeklyInputTokens&&(n=Math.max(n,(a.windows.weeklyInputTokens.percentUsed??0)*100)),a.windows?.dailyInputTokens&&(n=Math.max(n,(a.windows.dailyInputTokens.percentUsed??0)*100)),a.windows?.dailyImages&&(n=Math.max(n,(a.windows.dailyImages.percentUsed??0)*100)),s=n}else if(M(t.type)&&t.providerType==="wafer")s=t.quotaStatus?.quotaData?.current_period_used_percent??0;else if(M(t.type)&&t.providerType==="synthetic")s=100-(t.quotaStatus?.quotaData?.weeklyTokenLimit?.percentRemaining??100);else if(M(t.type)&&t.providerType==="neuralwatt"){const a=t.quotaStatus?.quotaData,n=a?.subscription?.kwh_included??0,i=a?.subscription?.kwh_used??0;n>0&&(s=i/n*100)}else M(t.type)&&t.providerType==="apertis"&&(s=ks(t.quotaStatus?.quotaData));return s}function ks(t){return t?t.is_subscriber&&t.subscription?.cycle_quota_limit?t.subscription.cycle_quota_used/t.subscription.cycle_quota_limit*100:t.payg&&!t.payg.token_is_unlimited&&typeof t.payg.token_total=="number"&&typeof t.payg.token_used=="number"?t.payg.token_used/t.payg.token_total*100:0:0}function _({percentage:t,type:s="usage",durationPercentage:a}){const n=Math.min(Math.max(t||0,0),100);let i={};if(s==="duration")i={backgroundColor:"#71717a"};else{const l=n/100;let o=l;if(a!==void 0&&a>0){const g=Math.max(a/100,.01);o=l*(l/g)}o=Math.min(1,Math.max(0,o));let d,c,p;if(o<.5){const g=o*2;d=142-g*97,c=71+g*22,p=45+g*2}else{const g=(o-.5)*2;d=45-g*45,c=93-g*9,p=47+g*13}i={backgroundColor:`hsl(${Math.round(d)}, ${Math.round(c)}%, ${Math.round(p)}%)`}}return e.jsx("div",{className:"bg-muted/60 h-1.5 w-full overflow-hidden rounded-full",children:e.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${n}%`,...i}})})}function be(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:`${t}`}function Ss({channel:t,enforcementMode:s}){const{t:a}=T(),n=t.quotaStatus;if(!n)return null;const i=n.status,l=a(qs[i]),o=s&&(i==="exhausted"||i==="warning"&&s==="DE_PRIORITIZE")?s==="EXHAUSTED_ONLY"?"blocked":"deprioritized":null,d=Oe(t),c=Pe(d,i),p=Ae(c),g=je(),[z,R]=h.useState(!1),L=async()=>{if(t.type==="codex"){R(!0);try{await vs(t.id),$.success(a("quota.codex.resetSuccess")),await $e(),await g.invalidateQueries({queryKey:["provider-quotas"]})}catch(r){$.error(a("quota.codex.resetError"),{description:r instanceof Error?r.message:String(r)})}finally{R(!1)}}},O=r=>{if(!r)return"";const u=Math.floor(r/3600),f=u>=24?Math.floor(u/24):0;return f>0?`${f}${a(f>1?"quota.label.days":"quota.label.day")}`:u>0?`${u}${a(u>1?"quota.label.hours":"quota.label.hour")}`:`${Math.floor(r/60)}${a("quota.label.mins")}`},C=(r,u)=>{if(!r||u===void 0)return 0;const f=r-u;return Math.max(0,Math.min(100,f/r*100))},E=(r,u)=>{if(!u)return;let f=0;if(r==="5h")f=5*3600;else if(r==="7d")f=168*3600;else return;const b=Date.now()/1e3,m=u-b;return C(f,m)},j=(r,u,f)=>
28{if(!r)return"";let b;if(typeof r=="number"?b=Date.now()+r*1e3:b=new Date(r).getTime(),u===0)return a("quota.label.no_usage_yet");const m=Date.now(),x=b-m,v=f!=null&&f!==!1,k=typeof f=="number"?Math.round(f*100):null;if(x<0)return a(v?"quota.label.regenerating_now":"quota.label.reset_now");const N=Math.floor(x/6e4),w=Math.floor(N/60),S=Math.floor(w/24),B=a("quota.label.d"),de=a("quota.label.h"),ce=a("quota.label.m");let F;return S>0?F=`${S}${B} ${w%24}${de}`:w>0?F=`${w}${de} ${N%60}${ce}`:F=`${N}${ce}`,v&&k!=null?a("quota.label.regenerates_pct_in_time",{percent:k,time:F}):v?a("quota.label.regenerates_in_time",{time:F}):a("quota.label.resets_in_time",{time:F})},q=r=>{if(!r)return"";const u=new Date(r*1e3),f=new Date;return u.toDateString()===f.toDateString()?`${a("quota.label.today")}, ${u.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}`:u.getFullYear()===f.getFullYear()?ue(u,"MM-dd HH:mm"):ue(u,"yyyy-MM-dd HH:mm")},le=n.quotaData;return e.jsxs("div",{className:"space-y-3 border-b py-3 first:pt-1 last:border-0 last:pb-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{className:`h-4 w-4 ${i==="exhausted"?"text-red-500":i==="warning"?"text-yellow-500":"text-muted-foreground"}`}),e.jsx("span",{className:"text-foreground font-medium",children:t.name})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Q,{variant:i==="available"?"outline":i==="warning"?"secondary":i==="exhausted"?"destructive":"outline",className:i==="available"?ge.green:"",children:l}),o&&e.jsx(Q,{variant:"outline",className:ge[o==="blocked"?"red":"amber"],children:a(`quota.status.${o}`)})]})]}),le.error&&e.jsxs("div",{className:"ml-6 rounded bg-red-500/10 p-2 text-xs break-words text-red-500",children:[e.jsxs("span",{className:"font-medium",children:[a("quota.label.error"),":"]})," ",le.error]}),t.type==="claudecode"&&e.jsx("div",{className:"mt-4 space-y-4",children:(()=>{const r=t.quotaStatus?.quotaData;return r?e.jsxs(e.Fragment,{children:[r.windows?.["5h"]&&e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground font-medium",children:a("quota.window.5h")}),e.jsxs("span",{className:"text-foreground font-medium",children:[Math.round((r.windows["5h"].utilization||0)*100),"%"]})]}),e.jsx(_,{percentage:(r.windows["5h"].utilization||0)*100,durationPercentage:E("5h",r.windows["5h"].reset)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground font-medium",children:a("quota.label.5h_duration")}),e.jsxs("span",{className:"text-foreground font-medium",children:[Math.round(E("5h",r.windows["5h"].reset)||0),"%"]})]}),e.jsx(_,{type:"duration",percentage:E("5h",r.windows["5h"].reset)||0})]})]}),r.windows?.["7d"]&&e.jsxs("div",{className:"border-border/60 space-y-2.5 border-t border-dashed pt-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground font-medium",children:a("quota.window.7d")}),e.jsxs("span",{className:"text-foreground font-medium",children:[Math.round((r.windows["7d"].utilization||0)*100),"%"]})]}),e.jsx(_,{percentage:(r.windows["7d"].utilization||0)*100,durationPercentage:E("7d",r.windows["7d"].reset)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground font-medium",children:a("quota.label.7d_duration")}),e.jsxs("span",{className:"text-foreground font-medium",children:[Math.round(E("7d",r.windows["7d"].reset)||0),"%"]})]}),e.jsx(_,{type:"duration",percentage:E("7d",r.windows["7d"].reset)||0})]})]}),r.windows?.overage&&e.jsx("div",{className:"border-border/60 space-y-2.5 border-t border-dashed pt-3",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground font-medium",children:a("quota.label.overage_window")}),e.jsxs("span",{className:"text-foreground font-medium",children:[Math.round((r.windows.overage.utilization||0)*100),"%"]})]}),e.jsx(_,{percentage:(r.windows.overage.utilization||0)*100})]})}),(n.nextResetAt||r.representative_claim)&&e.jsxs("div",{className:"text-muted-foreground flex items-center justify-between pt-1 text-[11px]",children:[e.jsx("span",{children:r.representative_claim==="five_hour"?a("quota.label.5h_limiting"):r.representative_claim==="seven_day"?a("quota.label.7d_limiting"):""}),n.nextResetAt&&e.jsxs("span",{children:[j(n.nextResetAt)," (",q(new Date(n.nextResetAt).getTime()/1e3),")"]})]})]}):null})()}),t.type==="github_copilot"&&e.jsxs("div",{className:"mt-3 space-y-3",children:[(()=>{const r=t.quotaStatus?.quotaData;if(!r)return null;const u=[],f=r.limited_user_quotas,b=r.total_quotas;return f&&Object.entries(f).forEach(([m,x])=>{if(typeof x=="number"){const v=b?.[m]??x,k=x/10,N=v/10,w=v>0?(1-x/v)*100:0,S=m==="completions"?"quota.label.inline_suggestions":m==="chat"?"quota.label.chat_messages":"",B=S?a(S):m.replace(/_/g," ");u.push(e.jsx("div",{className:"border-border/60 space-y-2.5 border-t border-dashed pt-3 first:border-0 first:pt-0",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"text-muted-foreground font-medium",children:[B," ",e.jsxs("span",{className:"font-normal opacity-70",children:["(",Math.round(k),"/",Math.round(N),")"]})]}),e.jsx("span",{className:"text-foreground font-medium",children:a("quota.label.percent_used",{percent:Math.round(w)})})]}),e.jsx(_,{percentage:w})]})},m))}}
28),r.quota_snapshots&&Object.entries(r.quota_snapshots).forEach(([m,x])=>{if(x){const v=x.unlimited?0:100-(x.percent_remaining||0),k=m==="premium_interactions"?"quota.label.premium_interactions":m==="premium_models"?"quota.label.premium_models":m==="completions"?"quota.label.inline_suggestions":m==="chat"?"quota.label.chat_messages":"",N=k?a(k):m.replace(/_/g," "),w=x.quota_remaining||x.remaining||0,S=x.entitlement||0;u.push(e.jsx("div",{className:"border-border/60 space-y-2.5 border-t border-dashed pt-3 first:border-0 first:pt-0",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"text-muted-foreground font-medium",children:[N," ",!x.unlimited&&e.jsxs("span",{className:"font-normal opacity-70",children:["(",Math.round(w),"/",Math.round(S),")"]})]}),e.jsx("span",{className:"text-foreground font-medium",children:x.unlimited?a("quota.label.unlimited"):a("quota.label.percent_used",{percent:Math.round(v)})})]}),!x.unlimited&&e.jsx(_,{percentage:v})]})},m))}}),u})(),n.nextResetAt&&e.jsxs("div",{className:"text-muted-foreground pt-1 text-right text-[11px]",children:[j(n.nextResetAt)," (",q(new Date(n.nextResetAt).getTime()/1e3),")"]})]}),t.type==="codex"&&e.jsx("div",{className:"mt-4 space-y-4",children:(()=>{const r=t.quotaStatus?.quotaData;return r?e.jsxs(e.Fragment,{children:[r.rate_limit?.primary_window&&e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground font-medium",children:a("quota.label.primary_window")}),e.jsxs("span",{className:"text-foreground font-medium",children:[Math.round(r.rate_limit.primary_window.used_percent||0),"%"]})]}),e.jsx(_,{percentage:r.rate_limit.primary_window.used_percent||0,durationPercentage:r.rate_limit.primary_window.limit_window_seconds?C(r.rate_limit.primary_window.limit_window_seconds,r.rate_limit.primary_window.reset_after_seconds):void 0})]}),r.rate_limit.primary_window.limit_window_seconds?e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"text-muted-foreground font-medium",children:[a("quota.label.primary_duration")," (",O(r.rate_limit.primary_window.limit_window_seconds),")"]}),e.jsxs("span",{className:"text-foreground font-medium",children:[Math.round(C(r.rate_limit.primary_window.limit_window_seconds,r.rate_limit.primary_window.reset_after_seconds)),"%"]})]}),e.jsx(_,{type:"duration",percentage:C(r.rate_limit.primary_window.limit_window_seconds,r.rate_limit.primary_window.reset_after_seconds)})]}):null,r.rate_limit.primary_window.reset_at&&e.jsxs("div",{className:"text-muted-foreground pt-0.5 text-right text-[11px]",children:[j(r.rate_limit.primary_window.reset_after_seconds)," (",q(r.rate_limit.primary_window.reset_at),")"]})]}),r.rate_limit?.secondary_window?.used_percent!==void 0&&e.jsxs("div",{className:"border-border/60 mt-3 space-y-2.5 border-t border-dashed pt-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground font-medium",children:a("quota.label.secondary_window")}),e.jsxs("span",{className:"text-foreground font-medium",children:[Math.round(r.rate_limit.secondary_window.used_percent),"%"]})]}),e.jsx(_,{percentage:r.rate_limit.secondary_window.used_percent,durationPercentage:r.rate_limit.secondary_window.limit_window_seconds?C(r.rate_limit.secondary_window.limit_window_seconds,r.rate_limit.secondary_window.reset_after_seconds):void 0})]}),r.rate_limit.secondary_window.limit_window_seconds?e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"text-muted-foreground font-medium",children:[a("quota.label.secondary_duration")," (",O(r.rate_limit.secondary_window.limit_window_seconds),")"]}),e.jsxs("span",{className:"text-foreground font-medium",children:[Math.round(C(r.rate_limit.secondary_window.limit_window_seconds,r.rate_limit.secondary_window.reset_after_seconds)),"%"]})]}),e.jsx(_,{type:"duration",percentage:C(r.rate_limit.secondary_window.limit_window_seconds,r.rate_limit.secondary_window.reset_after_seconds)})]}):null,r.rate_limit.secondary_window.reset_at&&e.jsxs("div",{className:"text-muted-foreground pt-0.5 text-right text-[11px]",children:[j(r.rate_limit.secondary_window.reset_after_seconds)," (",q(r.rate_limit.secondary_window.reset_at),")"]})]}),(i==="exhausted"||i==="warning")&&e.jsx("div",{className:"border-border/60 flex items-center justify-end gap-2 border-t border-dashed pt-3",children:e.jsxs(A,{size:"sm",variant:"outline",className:"h-7 text-xs",disabled:z,onClick:L,children:[z?e.jsx(Ce,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):e.jsx(ot,{className:"mr-1.5 h-3.5 w-3.5"}),a("quota.codex.resetNow")]})})]}):null})()}),(t.type==="nanogpt"||t.type==="nanogpt_responses")&&e.jsx("div",{className:"mt-3 space-y-3",children:(()=>{const r=t.quotaStatus?.quotaData;if(!r)return null;const u=[];
28if([["weekly_input_tokens",r.windows?.weeklyInputTokens,!0],["daily_images",r.windows?.dailyImages,!1],["daily_input_tokens",r.windows?.dailyInputTokens,!0]].forEach(([b,m,x],v)=>{if(!m)return;const k=a(`quota.window.${b}`),N=(m.percentUsed??0)*100,w=x?be(m.used??0):`${m.used??0}`,S=(m.used??0)+(m.remaining??0),B=x?be(S):`${S}`;u.push(e.jsxs("div",{className:v>0?"border-border/60 space-y-2.5 border-t border-dashed pt-3":"space-y-2.5",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"text-muted-foreground font-medium",children:[k," ",e.jsxs("span",{className:"font-normal opacity-70",children:["(",w,"/",B,")"]})]}),e.jsxs("span",{className:"text-foreground font-medium",children:[Math.round(N),"%"]})]}),e.jsx(_,{percentage:N})]}),m.resetAt?e.jsx("div",{className:"text-muted-foreground pt-0.5 text-right text-[11px]",children:j(new Date(m.resetAt).toISOString())}):null]},b))}),r.state&&r.state!=="active"){const b=`quota.label.state_${r.state}`;u.push(e.jsx("div",{className:"flex items-center gap-1.5 pt-1",children:e.jsx(Q,{variant:"outline",className:"h-4 border-yellow-500/30 px-1.5 py-0 text-[10px] font-semibold tracking-wider text-yellow-500 uppercase",children:a(b)})},"state"))}return u})()}),M(t.type)&&t.providerType==="wafer"&&e.jsx("div",{className:"mt-3 space-y-3",children:(()=>{const r=t.quotaStatus?.quotaData;if(!r)return null;const u=[],f=r.current_period_used_percent??0,b=(r.included_request_limit??0)-(r.remaining_included_requests??0),m=r.included_request_limit??0;return u.push(e.jsx("div",{className:"space-y-2.5",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"text-muted-foreground font-medium",children:[a("quota.label.requests")," ",e.jsxs("span",{className:"font-normal opacity-70",children:["(",b,"/",m,")"]})]}),e.jsx("span",{className:"text-foreground font-medium",children:a("quota.label.percent_used",{percent:Math.round(f)})})]}),e.jsx(_,{percentage:f})]})},"usage")),r.window_end&&u.push(e.jsx("div",{className:"text-muted-foreground pt-1 text-right text-[11px]",children:j(r.window_end,f)},"reset")),u})()}),M(t.type)&&t.providerType==="synthetic"&&e.jsx("div",{className:"mt-3 space-y-3",children:(()=>{const r=t.quotaStatus?.quotaData;if(!r)return null;const u=[];if(r.weeklyTokenLimit){const b=100-(r.weeklyTokenLimit.percentRemaining??100),m=r.weeklyTokenLimit.remainingCredits,x=r.weeklyTokenLimit.maxCredits,v=m!=null&&x!=null?`$${(parseFloat(x.replace("$",""))-parseFloat(m.replace("$",""))).toFixed(2)}`:null;u.push(e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"text-muted-foreground font-medium",children:[a("quota.label.weekly_token_limit"),v!=null&&x!=null&&e.jsxs("span",{className:"font-normal opacity-70",children:[" ","(",v,"/",x,")"]})]}),e.jsx("span",{className:"text-foreground font-medium",children:a("quota.label.percent_used",{percent:Math.round(b)})})]}),e.jsx(_,{percentage:b})]}),r.weeklyTokenLimit.nextRegenAt&&e.jsx("div",{className:"text-muted-foreground pt-0.5 text-right text-[11px]",children:j(r.weeklyTokenLimit.nextRegenAt,b,Ns)})]},"weekly"))}if(r.rollingFiveHourLimit){const f=r.rollingFiveHourLimit.remaining??0,b=r.rollingFiveHourLimit.max??0,m=b-f,x=b>0?m/b*100:0;u.push(e.jsxs("div",{className:"border-border/60 space-y-2.5 border-t border-dashed pt-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"text-muted-foreground font-medium",children:[a("quota.label.rolling_5h_limit")," ",e.jsxs("span",{className:"font-normal opacity-70",children:["(",Math.round(m),"/",Math.round(b),")"]})]}),e.jsx("span",{className:"text-foreground font-medium",children:a("quota.label.percent_used",{percent:Math.round(x)})})]}),e.jsx(_,{percentage:x})]}),r.rollingFiveHourLimit.limited&&e.jsx(Q,{variant:"outline",className:"h-4 border-yellow-500/30 px-1.5 py-0 text-[10px] font-semibold tracking-wider text-yellow-500 uppercase",children:a("quota.status.limited")}),r.rollingFiveHourLimit.nextTickAt&&e.jsx("div",{className:"text-muted-foreground pt-0.5 text-right text-[11px]",children:j(r.rollingFiveHourLimit.nextTickAt,x,r.rollingFiveHourLimit.tickPercent??.05)})]},"5h"))}return u})()}),M(t.type)&&t.providerType==="neuralwatt"&&e.jsx("div",{className:"mt-3 space-y-3",children:(()=>{const r=t.quotaStatus?.quotaData;if(!r)return null;const u=[];
28if(r.subscription){const f=r.subscription.kwh_included??0,b=r.subscription.kwh_used??0,m=f>0?b/f*100:0;u.push(e.jsx("div",{className:"space-y-2.5",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"text-muted-foreground font-medium",children:[a("quota.label.kwh_remaining"),e.jsxs("span",{className:"font-normal opacity-70",children:[" ","(",b,"/",f,")"]})]}),e.jsx("span",{className:"text-foreground font-medium",children:a("quota.label.percent_used",{percent:Math.round(m)})})]}),e.jsx(_,{percentage:m})]})},"kwh")),r.subscription.in_overage&&u.push(e.jsx("div",{className:"flex items-center gap-1.5 pt-1",children:e.jsx(Q,{variant:"destructive",className:"h-4 px-1.5 py-0 text-[10px] font-semibold tracking-wider uppercase",children:a("quota.label.in_overage")})},"overage"))}return r.balance&&u.push(e.jsx("div",{className:"border-border/60 space-y-2.5 border-t border-dashed pt-3",children:e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground font-medium",children:a("quota.label.credits_remaining")}),e.jsx("span",{className:"text-foreground font-medium",children:r.balance.credits_remaining_usd!=null?`$${r.balance.credits_remaining_usd.toFixed(2)}`:"$0.00"})]})},"credits")),n.nextResetAt&&u.push(e.jsx("div",{className:"text-muted-foreground pt-1 text-right text-[11px]",children:j(n.nextResetAt)},"reset")),u})()}),M(t.type)&&t.providerType==="apertis"&&e.jsx("div",{className:"mt-3 space-y-3",children:(()=>{const r=t.quotaStatus?.quotaData;if(!r)return null;const u=[];if(r.is_subscriber&&r.subscription&&r.subscription.cycle_quota_limit>0){const m=r.subscription.cycle_quota_used,x=r.subscription.cycle_quota_limit,v=m/x*100,k=r.subscription.plan_type?`${r.subscription.plan_type.charAt(0).toUpperCase()+r.subscription.plan_type.slice(1)}
28 Plan`:a("quota.label.subscription");if(u.push(e.jsx("div",{className:"space-y-2.5",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"text-muted-foreground font-medium",children:[k,e.jsxs("span",{className:"font-normal opacity-70",children:[" ","(",m,"/",x,")"]})]}),e.jsx("span",{className:"text-foreground font-medium",children:a("quota.label.percent_used",{percent:Math.round(v)})})]}),e.jsx(_,{percentage:v})]})},"subscription")),r.subscription.payg_fallback_enabled){const N=r.subscription.payg_spent_usd,w=r.subscription.payg_limit_usd,S=N!=null&&w!=null&&w>0?N/w*100:0;u.push(e.jsx("div",{className:"border-border/60 space-y-2.5 border-t border-dashed pt-3",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"text-muted-foreground font-medium",children:[a("quota.label.payg_fallback"),N!=null&&w!=null&&e.jsxs("span",{className:"font-normal opacity-70",children:[" ","($",N.toFixed(2),"/$",w.toFixed(2),")"]})]}),e.jsx("span",{className:"text-foreground font-medium",children:N!=null&&w!=null?a("quota.label.percent_used",{percent:Math.round(S)}):""})]}),N!=null&&w!=null&&w>0&&e.jsx(_,{percentage:S})]})},"fallback"))}}const f=r.payg&&(r.payg.account_credits>0||typeof r.payg.token_used=="number"&&r.payg.token_used>0),b=!r.is_subscriber||r.subscription?.status!=="active"||r.subscription?.payg_fallback_enabled||f;if(b&&r.payg&&!r.payg.token_is_unlimited&&typeof r.payg.token_total=="number"&&typeof r.payg.token_used=="number"&&r.payg.token_total>0){const m=r.payg.token_used,x=r.payg.token_total,v=m/x*100,k=u.length>0;u.push(e.jsx("div",{className:k?"border-border/60 space-y-2.5 border-t border-dashed pt-3":"space-y-2.5",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"text-muted-foreground font-medium",children:[a("quota.label.token_usage"),e.jsxs("span",{className:"font-normal opacity-70",children:[" ","($",m.toFixed(2),"/$",x.toFixed(2),")"]})]}),e.jsx("span",{className:"text-foreground font-medium",children:a("quota.label.percent_used",{percent:Math.round(v)})})]}),e.jsx(_,{percentage:v})]})},"payg"))}if(b&&r.payg&&r.payg.account_credits!==void 0){const m=u.length>0;u.push(e.jsx("div",{className:m?"border-border/60 space-y-2.5 border-t border-dashed pt-3":"space-y-2.5",children:e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground font-medium",children:a("quota.label.account_balance")}),e.jsx("span",{className:"text-foreground font-medium",children:r.payg.token_is_unlimited?`${a("quota.label.unlimited")} · $${r.payg.account_credits.toFixed(2)}`:`$${r.payg.account_credits.toFixed(2)}`})]})},"balance"))}if(b&&r.payg?.token_monthly_limit_usd!=null&&r.payg.token_monthly_used_usd!=null){const m=r.payg.token_monthly_limit_usd>0?r.payg.token_monthly_used_usd/r.payg.token_monthly_limit_usd*100:0;u.push(e.jsx("div",{className:"border-border/60 space-y-2.5 border-t border-dashed pt-3",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"text-muted-foreground font-medium",children:[a("quota.label.monthly_limit"),e.jsxs("span",{className:"font-normal opacity-70",children:[" ","($",r.payg.token_monthly_used_usd.toFixed(2),"/$",r.payg.token_monthly_limit_usd.toFixed(2),")"]})]}),e.jsx("span",{className:"text-foreground font-medium",children:a("quota.label.percent_used",{percent:Math.round(m)})})]}),e.jsx(_,{percentage:m})]})},"monthly"))}return n.nextResetAt&&u.push(e.jsx("div",{className:"text-muted-foreground pt-1 text-right text-[11px]",children:j(n.nextResetAt)},"reset")),u})()})]})}function Cs({channels:t}){const s=Math.max(...t.map(c=>c.quotaStatus?Oe(c):0)),a=t.some(c=>c.quotaStatus?.status==="exhausted"),n=t.some(c=>
28c.quotaStatus?.status==="warning");let i="full";a?i="warning":n?i="low":i=Pe(s,"available");const l=Ae(i),d=i==="warning"?"text-red-500":i==="low"?"text-yellow-500":"text-muted-foreground";return e.jsx(l,{className:`h-5 w-5 ${d} transition-colors`})}function Ms({isRefreshing:t,onRefresh:s}){const{t:a}=T(),n=_s(),{data:i}=Ue(),l=i?.enabled?i.mode:null;if(n.length===0)return null;const o=n.reduce((d,c)=>(c.type==="nanogpt_responses"?d.find(g=>g.type==="nanogpt")||d.push(c):M(c.type)&&c.providerType&&d.find(g=>M(g.type)&&g.providerType===c.providerType)||d.push(c),d),[]);return e.jsxs(_t,{children:[e.jsx(Nt,{asChild:!0,children:e.jsx("button",{type:"button",className:"hover:bg-muted relative rounded-md p-2 transition-colors",children:e.jsx(Cs,{channels:o})})}),e.jsx(qt,{className:o.length>4?"w-full sm:w-[640px]":"w-full sm:w-80",align:"end",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("div",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:a("system.providerQuota.title")}),e.jsx("button",{onClick:s,disabled:t,className:"text-muted-foreground hover:text-foreground transition-colors","aria-label":a("system.providerQuota.refresh.label"),children:t?e.jsx(Ce,{className:"h-4 w-4 animate-spin"}):e.jsx(kt,{className:"h-4 w-4"})})]}),e.jsx("div",{className:`max-h-[60vh] overflow-y-auto pr-1 pl-1 ${o.length>4?"grid grid-cols-1 gap-x-4 sm:grid-cols-2":""}`,children:o.map(d=>e.jsx(Ss,{channel:d,enforcementMode:l},d.id))})]})})]})}function Ds(){const{data:t,isLoading:s}=Ct(),{t:a}=T(),{selectedProjectId:n,setSelectedProjectId:i}=Ve();h.useEffect(()=>{if(!t)return;if(t.length===0){n&&i(null);return}if(n&&t.some(z=>z.id===n))return;const p=t[0];i(p.id)},[t,n,i]);const l=p=>{i(p)},o=h.useMemo(()=>t?.find(p=>p.id===n),[t,n]);if(!(!s&&t&&t.length>0))return null;const c=o?.name||a("sidebar.projectSwitcher.selectProject");return e.jsxs(X,{children:[e.jsx(J,{asChild:!0,children:e.jsxs("button",{className:"hover:bg-accent/50 inline-flex items-center gap-1 rounded-md px-2 py-1 text-sm leading-none transition-colors",children:[e.jsx("span",{className:"text-sm leading-none font-medium",children:c}),e.jsx(Me,{className:"text-muted-foreground size-3"})]})}),e.jsxs(ee,{className:"min-w-56 rounded-lg",align:"start",sideOffset:4,children:[e.jsx(oe,{className:"text-muted-foreground text-xs",children:a("sidebar.projectSwitcher.projects")}),t.map(p=>e.jsxs(I,{onClick:()=>l(p.id),className:"gap-2 p-2",children:[e.jsx("div",{className:"flex size-6 items-center justify-center rounded-sm border",children:e.jsx(Wt,{className:"size-4 shrink-0"})}),e.jsx("div",{className:"flex flex-col",children:e.jsx("span",{className:"text-sm font-medium",children:p.name})}),n===p.id&&e.jsx(vt,{children:"✓"})]},p.id))]})]})}function Ts(){const{data:t}=We(),{t:s}=T(),[a,n]=h.useState(!1),i=je(),{isMobile:l}=D(),o=t?.brandName||"AxonHub",d=Ke({mutationFn:async()=>$e(),onSuccess:()=>{i.refetchQueries({queryKey:["provider-quotas"]}),$.success(s("system.providerQuota.refresh.success"))},onError:p=>{$.error(p.message||s("system.providerQuota.refresh.failure"))}}),c=h.useCallback(()=>{n(!0),d.mutate(void 0,{onSettled:()=>n(!1)})},[d]);return e.jsx("header",{className:"bg-background/95 supports-[backdrop-filter]:bg-background/60 fixed top-0 z-50 w-full backdrop-blur",children:e.jsxs("div",{className:"flex h-14 items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 pl-6",children:[e.jsx(ls,{className:"-ml-4 size-8"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center overflow-hidden rounded",children:t?.brandLogo?e.jsx("img",{src:t.brandLogo,alt:"Brand Logo",width:24,height:24,className:"size-8 object-cover",onError:p=>{p.currentTarget.src="/logo.jpg"}}):e.jsx("img",{src:"/logo.jpg",alt:"Default Logo",width:24,height:24,className:"size-8 object-cover"})}),e.jsx("span",{className:"text-sm leading-none font-semibold",children:o})]}),e.jsx("div",{className:"bg-border mx-0.5 h-3.5 w-px"}),e.jsx(Ds,{})]}),e.jsxs("div",{className:"flex items-center gap-2 pr-6",children:[e.jsx(Ms,{onRefresh:c,isRefreshing:a}),!l&&e.jsxs(e.Fragment,{children:[e.jsx(St,{requiredSystemScope:"read_system",children:e.jsx(V,{to:"/system",children:e.jsx(A,{variant:"ghost",size:"icon",className:"size-8",children:e.jsx(Ge,{className:"h-4 w-4"})})})}),e.jsx(Se,{}),e.jsx(Ie,{})]})]})]})})}function Rs({title:t,items:s}){const{state:a,isMobile:n}=D(),i=Ye({select:o=>o.href}),l=s.filter(o=>o.items?o.items.some(c=>!c.isDisabled)&&!o.isDisabled:!(o.isDisabled||o.mobileOnly&&!n));return l.length===0?null:e.jsxs(ms,{children:[e.jsx(ps,{children:t}),e.jsx(Ee,{children:l.map(o=>{const d=`${o.title}-${o.url}`;return o.items?a==="collapsed"&&!n?e.jsx($s,{item:o,href:i},d):e.jsx(Is,{item:o,href:i},d):e.jsx(Es,{item:o,href:i},d)})})]})}const Y=({children:t})=>e.jsx(Q,{className:"rounded-full px-1 py-0 text-xs",children:t}),Es=({item:t,href:s})=>{const{setOpenMobile:a}=D();return e.jsx(te,{children:e.jsx(se,{asChild:!0,isActive:U(s,t),tooltip:t.t
28itle,className:"h-12 rounded-2xl transition-all",children:e.jsxs(V,{to:t.url,onClick:()=>a(!1),children:[t.icon&&e.jsx(t.icon,{className:"text-xl"}),e.jsx("span",{children:t.title}),t.badge&&e.jsx(Y,{children:t.badge})]})})})},Is=({item:t,href:s})=>{const{setOpenMobile:a}=D(),n=t.items.filter(i=>!i.isDisabled);return e.jsx(Mt,{asChild:!0,defaultOpen:U(s,t,!0),className:"group/collapsible",children:e.jsxs(te,{children:[e.jsx(Dt,{asChild:!0,children:e.jsxs(se,{tooltip:t.title,className:"h-12 rounded-2xl transition-all",children:[t.icon&&e.jsx(t.icon,{className:"text-xl"}),e.jsx("span",{children:t.title}),t.badge&&e.jsx(Y,{children:t.badge}),e.jsx(De,{className:"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"})]})}),e.jsx(Tt,{className:"CollapsibleContent",children:e.jsx(hs,{children:n.map(i=>e.jsx(fs,{children:e.jsx(gs,{asChild:!0,isActive:U(s,i),children:e.jsxs(V,{to:i.url,onClick:()=>a(!1),children:[i.icon&&e.jsx(i.icon,{}),e.jsx("span",{children:i.title}),i.badge&&e.jsx(Y,{children:i.badge})]})})},i.title))})})]})})},$s=({item:t,href:s})=>{const a=t.items.filter(n=>!n.isDisabled);return e.jsx(te,{children:e.jsxs(X,{children:[e.jsx(J,{asChild:!0,children:e.jsxs(se,{tooltip:t.title,isActive:U(s,t),className:"h-12 rounded-2xl transition-all",children:[t.icon&&e.jsx(t.icon,{className:"text-xl"}),e.jsx("span",{children:t.title}),t.badge&&e.jsx(Y,{children:t.badge}),e.jsx(De,{className:"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"})]})}),e.jsxs(ee,{side:"right",align:"start",sideOffset:4,children:[e.jsxs(oe,{children:[t.title," ",t.badge?`(${t.badge})`:""]}),e.jsx(H,{}),a.map(n=>e.jsx(I,{asChild:!0,children:e.jsxs(V,{to:n.url,className:`${U(s,n)?"bg-secondary":""}`,children:[n.icon&&e.jsx(n.icon,{}),e.jsx("span",{className:"max-w-52 text-wrap",children:n.title}),n.badge&&e.jsx("span",{className:"ml-auto text-xs",children:n.badge})]})},`${n.title}-${n.url}`))]})]})})};function U(t,s,a=!1){return t===s.url||t.split("?")[0]===s.url||!!s?.items?.filter(n=>n.url===t).length||a&&t.split("/")[1]!==""&&t.split("/")[1]===s?.url?.split("/")[1]}function As({user:t}){const{isMobile:s}=D(),a=Ze(),{t:n}=T(),i=t.avatar.startsWith("http")||t.avatar.startsWith("/")||t.avatar.startsWith("data:"),l=i?t.name.charAt(0).toUpperCase():t.avatar;return e.jsx(Ee,{children:e.jsx(te,{children:e.jsxs(X,{children:[e.jsx(J,{asChild:!0,children:e.jsxs(se,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[e.jsxs(me,{className:"h-8 w-8 rounded-lg",children:[i&&e.jsx(pe,{src:t.avatar,alt:t.name}),e.jsx(xe,{className:"rounded-lg",children:l})]}),e.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[e.jsx("span",{className:"truncate font-semibold",children:t.name}),e.jsx("span",{className:"truncate text-xs",children:t.email})]}),e.jsx(Me,{className:"ml-auto size-4"})]})}),e.jsxs(ee,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:s?"bottom":"right",align:"end",sideOffset:4,children:[e.jsx(oe,{className:"p-0 font-normal",children:e.jsxs("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:[e.jsxs(me,{className:"h-8 w-8 rounded-lg",children:[i&&e.jsx(pe,{src:t.avatar,alt:t.name}),e.jsx(xe,{className:"rounded-lg",children:l})]}),e.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[e.jsx("span",{className:"truncate font-semibold",children:t.name}),e.jsx("span",{className:"truncate text-xs",children:t.email})]})]})}),e.jsx(H,{}),e.jsx(H,{}),e.jsx(wt,{children:e.jsx(I,{asChild:!0,children:e.jsxs(V,{to:"/settings/profile",children:[e.jsx($t,{}),n("sidebar.userMenu.account")]})})}),e.jsx(H,{}),e.jsxs(I,{onClick:a,children:[e.jsx(Gt,{}),n("sidebar.userMenu.logOut")]})]})]})})})}function Ps(){const{t}=T();return e.jsxs("div",{role:"toolbar","aria-label":t("sidebar.settingsControls"),className:"flex flex-row items-center justify-end gap-2","data-testid":"mobile-header-controls",children:[e.jsx("div",{"data-testid":"mobile-language-switch",children:e.jsx(Se,{})}),e.jsx("div",{"data-testid":"mobile-theme-switch",children:e.jsx(Ie,{})})]})}function Os({sidebarData:t,...s}){const{isMobile:a}=D();return e.jsxs(os,{collapsible:"icon",variant:"floating",...s,children:[e.jsx(us,{children:t.navGroups.map(n=>e.jsx(Rs,{...n},n.title))}),e.jsxs(cs,{children:[a&&e.jsx(Ps,{}),e.jsx(As,{user:t.user})]}),e.jsx(ds,{})]})}const zs=()=>e.jsx("a",{className:"bg-primary text-primary-foreground hover:bg-primary/90 focus-visible:ring-ring fixed left-44 z-999 -translate-y-52 px-4 py-2 text-sm font-medium whitespace-nowrap opacity-95 shadow-sm transition focus:translate-y-3 focus:transform focus-visible:ring-1",href:"#content",children:"Skip to Main"});function Ls({onComplete:t}){const{t:s}=T(),a=ve(),n=Xe(),[i,l]=h.useState(!0),o=h.useRef(!1);h.useEffect(()=>(i?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[i]);const d=h.useCallback(()=>{o.current||n.isPending||(o.current=!0,n.mutate(void 0,{onSuccess:()=>{t?.()},onError:()=>{o.current=!1,$.error(s("common.errors.onboardingFailed"))}}))},[n,t,s]),c=h.useCallback(()=>
28{l(!1),a({to:"/system",search:{tab:"retry"}}).then(()=>{setTimeout(()=>{const g=Te({showProgress:!0,steps:[{popover:{title:s("system.onboarding.steps.autoDisableIntro.title"),description:s("system.onboarding.steps.autoDisableIntro.description")}},{element:"#auto-disable-channel",popover:{title:s("system.onboarding.steps.autoDisableToggle.title"),description:s("system.onboarding.steps.autoDisableToggle.description"),side:"right",align:"start"}},{popover:{title:s("system.onboarding.steps.autoDisableComplete.title"),description:s("system.onboarding.steps.autoDisableComplete.description")}}],onDestroyStarted:()=>{d(),g.destroy()},onDestroyed:()=>{d()}});g.drive()},500)})},[a,s,d]),p=h.useCallback(()=>{l(!1),d()},[d]);return i===!1?null:e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center overflow-hidden bg-black/50",children:[e.jsx("div",{className:"absolute inset-0",onClick:()=>{}}),e.jsxs(we,{className:"relative z-10 mx-4 w-full max-w-md",children:[e.jsxs(_e,{className:"text-center",children:[e.jsx(Ne,{className:"text-2xl",children:s("system.onboarding.autoDisableChannel.title")}),e.jsx(qe,{className:"text-lg",children:s("system.onboarding.autoDisableChannel.description")})]}),e.jsx(ke,{className:"space-y-4",children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(A,{onClick:c,className:"w-full",size:"lg","data-testid":"auto-disable-onboarding-start-tour",children:s("system.onboarding.autoDisableChannel.startTour")}),e.jsx(A,{variant:"outline",onClick:p,className:"w-full",size:"lg","data-testid":"auto-disable-onboarding-skip-tour",children:s("system.onboarding.autoDisableChannel.skipTour")})]})})]})]})}function Fs({onComplete:t}){const{t:s}=T(),a=ve(),n=Je(),[i,l]=h.useState(!0);h.useEffect(()=>(i?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[i]);const o=h.useCallback(()=>{l(!1),a({to:"/system"}).then(()=>{setTimeout(()=>{const c=Te({showProgress:!0,steps:[{element:"#system-title",popover:{title:s("system.onboarding.steps.welcome.title"),description:s("system.onboarding.steps.welcome.description"),side:"bottom",align:"start"}},{element:"#brand-name",popover:{title:s("system.onboarding.steps.brandName.title"),description:s("system.onboarding.steps.brandName.description"),side:"bottom",align:"start"}},{element:"#brand-logo-upload",popover:{title:s("system.onboarding.steps.brandLogo.title"),description:s("system.onboarding.steps.brandLogo.description"),side:"bottom",align:"start"}},{element:'[data-value="retry"]',popover:{title:s("system.onboarding.steps.retryPolicy.title"),description:s("system.onboarding.steps.retryPolicy.description"),side:"bottom",align:"center"},onHighlighted:()=>{setTimeout(()=>{a({to:"/system",search:{tab:"retry"}})},300)}},{element:"#retry-enabled-switch",popover:{title:s("system.onboarding.steps.retryEnabled.title"),description:s("system.onboarding.steps.retryEnabled.description"),side:"right",align:"start"}},{element:"#retry-max-retries",popover:{title:s("system.onboarding.steps.retryMaxRetries.title"),description:s("system.onboarding.steps.retryMaxRetries.description"),side:"right",align:"start"}},{element:"#max-single-channel-retries",popover:{title:s("system.onboarding.steps.retrySingleChannel.title"),description:s("system.onboarding.steps.retrySingleChannel.description"),side:"right",align:"start"}},{element:"#retry-delay",popover:{title:s("system.onboarding.steps.retryDelay.title"),description:s("system.onboarding.steps.retryDelay.description"),side:"right",align:"start"}},{popover:{title:s("system.onboarding.steps.autoDisableIntro.title"),description:s("system.onboarding.steps.autoDisableIntro.description")}},{element:"#auto-disable-channel",popover:{title:s("system.onboarding.steps.autoDisableToggle.title"),description:s("system.onboarding.steps.autoDisableToggle.description"),side:"right",align:"start"}},{popover:{title:s("system.onboarding.steps.autoDisableComplete.title"),description:s("system.onboarding.steps.autoDisableComplete.description")}},{element:'[data-value="storage"]',popover:{title:s("system.onboarding.steps.dataStorage.title"),description:s("system.onboarding.steps.dataStorage.description"),side:"bottom",align:"center"},onHighlighted:()=>{setTimeout(()=>{a({to:"/system",search:{tab:"storage"}})},300)}},{element:"#default-data-storage",popover:{title:s("system.onboarding.steps.dataStorageSelection.title"),description:s("system.onboarding.steps.dataStorageSelection.description"),side:"right",align:"start"}},{element:"#storage-policy-store-chunks",popover:{title:s("system.onboarding.steps.storageChunks.title"),description:s("system.onboarding.steps.storageChunks.description"),side:"right",align:"start"}},{element:"#storage-policy-store-request-body",popover:{title:s("system.onboarding.steps.storageRequestBody.title"),description:s("system.onboarding.steps.storageRequestBody.description"),side:"right",align:"start"}},{element:"#storage-policy-store-response-body",popover:{title:s("system.onboarding.steps.storageResponseBody.title"),description:s("system.onboarding.steps.storageResponseBody.description"),side:"right",align:"start"}},{element:"#storage-cleanup-option-requests",popover:{title:s("system.onboarding.steps.storageCleanupRequests.title"),description:s("system.onboarding.steps.storageCleanupRequests.description"),side:"right",align:"start"}},{element:"#storage-cleanup-option-usage_logs",popover:{title:s("system.onboarding.steps.storageCleanupUsageLogs.title"),description:s("system.onboarding.steps.storageCleanupUsageLogs.description"),side:"right",align:"start"}},{element:"#data-storages-link",popover:{title:s("system.onboarding.steps.complete.title"),description:s("system.onboarding.steps.complete.de
28scription"),side:"bottom",align:"start"},onHighlighted:()=>{n.mutate(void 0,{onSuccess:()=>{$.success(s("system.onboarding.completeTour")),t?.(),a({to:"/data-storages"})}})}}],onDestroyStarted:()=>{n.mutate(void 0,{onSuccess:()=>{$.success(s("system.onboarding.completeTour")),t?.()}}),c.destroy()}});c.drive()},500)})},[n,a,s]),d=h.useCallback(()=>{l(!1),n.mutate(void 0,{onSuccess:()=>{t?.()}})},[n,t]);return i===!1?null:e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center overflow-hidden bg-black/50",children:[e.jsx("div",{className:"absolute inset-0",onClick:()=>{}}),e.jsxs(we,{className:"relative z-10 mx-4 w-full max-w-md",children:[e.jsxs(_e,{className:"text-center",children:[e.jsx(Ne,{className:"text-2xl",children:s("system.onboarding.title")}),e.jsx(qe,{className:"text-lg",children:s("system.onboarding.description")})]}),e.jsx(ke,{className:"space-y-4",children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(A,{onClick:o,className:"w-full",size:"lg","data-testid":"onboarding-start-tour",children:s("system.onboarding.startTour")}),e.jsx(A,{variant:"outline",onClick:d,className:"w-full",size:"lg","data-testid":"onboarding-skip-tour",children:s("system.onboarding.skipTour")})]})})]})]})}function Qs({children:t,showOnboarding:s=!0,onComplete:a}){const{data:n,isLoading:i}=et(),[l,o]=h.useState("none"),c=ne(g=>g.auth.user)?.isOwner??!1;h.useEffect(()=>{!i&&s&&c&&(!n||!n.onboarded?o("main"):n.autoDisableChannel?.onboarded?o("none"):o("autoDisableChannel"))},[n,i,s,c]);const p=()=>{o("none"),a?.()};return e.jsxs(e.Fragment,{children:[t,l==="main"&&e.jsx(Fs,{onComplete:p}),l==="autoDisableChannel"&&e.jsx(Ls,{onComplete:p})]})}function Bs({children:t}){const s=Zt.get("sidebar_state")!=="false",a=tt();return Jt(),e.jsxs(is,{defaultOpen:s,className:"h-screen flex-col overflow-hidden",children:[e.jsx(Ts,{}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsx(zs,{}),e.jsx(Os,{sidebarData:a}),e.jsx("div",{id:"content",className:y("ml-auto w-full max-w-full","peer-data-[state=collapsed]:w-[calc(100%-var(--sidebar-width-icon)-1rem)]","peer-data-[state=expanded]:w-[calc(100%-var(--sidebar-width))]","sm:transition-[width] sm:duration-200 sm:ease-linear","flex min-h-0 min-w-0 flex-1 flex-col overflow-auto pt-14 has-[main.fixed-main]:overflow-hidden","group-data-[scroll-locked=1]/body:h-full","has-[main.fixed-main]:group-data-[scroll-locked=1]/body:h-svh"),children:e.jsx(Qs,{children:t||e.jsx(st,{})})})]})]})}function Hs({children:t}){const s=at(),{accessToken:a}=ne(l=>l.auth),{isLoading:n,error:i}=rt();if(h.useEffect(()=>{if(!a){const l=window.location.pathname;!l.startsWith("/sign-in")&&!l.startsWith("/sign-up")&&!l.startsWith("/initialization")&&!l.startsWith("/forgot-password")&&!l.startsWith("/otp")&&s.navigate({to:"/sign-in"})}},[a,s]),h.useEffect(()=>{i&&a&&nt(i)&&s.navigate({to:"/sign-in"})},[i,a,s]),!a){const l=window.location.pathname;return l.startsWith("/sign-in")||l.startsWith("/sign-up")||l.startsWith("/initialization")||l.startsWith("/forgot-password")||l.startsWith("/otp")?e.jsx(e.Fragment,{children:t}):e.jsx("div",{className:"flex h-screen items-center justify-center",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(W,{className:"h-8 w-48"}),e.jsx(W,{className:"h-4 w-32"})]})})}return a&&n?e.jsx("div",{className:"flex h-screen items-center justify-center",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(W,{className:"h-8 w-48"}),e.jsx(W,{className:"h-4 w-32"})]})}):e.jsx(e.Fragment,{children:t})}const wa=()=>e.jsx(Hs,{children:e.jsx(Bs,{})});export{wa as component};

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.