omnigateway 0.12.12 → 0.12.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +1 -0
  2. package/bin/omni.js +378 -21
  3. package/gateway.js +346 -13
  4. package/package.json +1 -1
  5. package/public/assets/{Chip-D4qvhu1D.js → Chip-D0XSbQUr.js} +1 -1
  6. package/public/assets/{CopyValue-SnsT2LML.js → CopyValue-DAlmkISB.js} +3 -3
  7. package/public/assets/{Field-BYBri2NV.js → Field-DG1317zr.js} +1 -1
  8. package/public/assets/Lamp-Dk9XrTCg.js +26 -0
  9. package/public/assets/{Panel-CWmOTDAP.js → Panel-CsovmtxF.js} +23 -4
  10. package/public/assets/Rack-CDUOJkS2.js +483 -0
  11. package/public/assets/{Readout-BTh732hP.js → Readout-DlT5oxGO.js} +1 -1
  12. package/public/assets/RequestTable-i3TtCB9m.js +93 -0
  13. package/public/assets/{SummaryDeck-7ivuca39.js → SummaryDeck-DrzTQQo5.js} +2 -2
  14. package/public/assets/{Toggle-t82IhqEt.js → Toggle-CdMD58sy.js} +1 -1
  15. package/public/assets/{TokenBreakdown-D1Wtza1y.js → TokenBreakdown-BC6nqo1v.js} +1 -1
  16. package/public/assets/{WindowChart-BeGPsccS.js → WindowChart-Bqbl-KFO.js} +2 -2
  17. package/public/assets/_app-CSru2YTE.js +1 -0
  18. package/public/assets/_app.accounts-B2lQkMb0.js +70 -0
  19. package/public/assets/_app.console-a2TJDoBC.js +24 -0
  20. package/public/assets/_app.database-CqSoTi2l.js +24 -0
  21. package/public/assets/_app.index-BV1kJJjA.js +67 -0
  22. package/public/assets/_app.keys-Dq5O0AG9.js +92 -0
  23. package/public/assets/_app.logs-PjRK5wqy.js +46 -0
  24. package/public/assets/_app.models-BfmeeB5e.js +148 -0
  25. package/public/assets/_app.plugins._pluginId-Owb05aFv.js +20 -0
  26. package/public/assets/{_app.settings-C3GzeJ4q.js → _app.settings-5i-vvT-H.js} +7 -7
  27. package/public/assets/_app.usage--5qFtU1W.js +76 -0
  28. package/public/assets/chevron-down-Bb5ZGvwk.js +1 -0
  29. package/public/assets/chevron-right-hwF5mD6-.js +1 -0
  30. package/public/assets/{client-k1tkFSNH.js → client-BcXc3lek.js} +4 -4
  31. package/public/assets/{dist-D03q-60i.js → dist-BBGxva0Y.js} +1 -1
  32. package/public/assets/index-D1RDaq3l.js +14 -0
  33. package/public/assets/{login-DW2Ipp21.js → login-GB0ZGUvA.js} +4 -4
  34. package/public/assets/plus-BgcHxxIr.js +1 -0
  35. package/public/assets/{preload-helper-BPaHpbO_.js → preload-helper-B7KDmXJ9.js} +1 -1
  36. package/public/assets/rotate-ccw-Do43Argv.js +1 -0
  37. package/public/assets/{shared-Dtkw6SE0.js → shared-DDpLUhCp.js} +2 -2
  38. package/public/assets/{trash-D4QWzEK_.js → trash-00950_yY.js} +1 -1
  39. package/public/index.html +5 -5
  40. package/public/assets/Lamp-DkvXKB-B.js +0 -26
  41. package/public/assets/Rack-CEuCdVXc.js +0 -483
  42. package/public/assets/RequestTable-D8L6iVJV.js +0 -93
  43. package/public/assets/_app-Drf03PWk.js +0 -1
  44. package/public/assets/_app.accounts-W1USUo2Q.js +0 -70
  45. package/public/assets/_app.console-Co9d2ZiD.js +0 -44
  46. package/public/assets/_app.database-CtFJLcfE.js +0 -24
  47. package/public/assets/_app.index-DigYfob3.js +0 -67
  48. package/public/assets/_app.keys-B1fRMyU-.js +0 -92
  49. package/public/assets/_app.logs-CFixPsUw.js +0 -60
  50. package/public/assets/_app.models-Dpl1O2RE.js +0 -148
  51. package/public/assets/_app.plugins._pluginId-BK0ADugW.js +0 -20
  52. package/public/assets/_app.usage-D2qlcEp4.js +0 -76
  53. package/public/assets/chevron-down-Bs0tSOyA.js +0 -1
  54. package/public/assets/chevron-right-DSaI1kFo.js +0 -1
  55. package/public/assets/index-Bk9sabex.js +0 -14
  56. package/public/assets/plus-BCfjC6nk.js +0 -1
@@ -0,0 +1,93 @@
1
+ import{A as e,Ct as t,L as n,M as r,Mt as i,N as a,P as o,f as s,j as c,mt as l,p as u,t as d,u as f,z as p}from"./Lamp-Dk9XrTCg.js";import{A as m,E as h,S as g,T as _,b as v,k as y,y as b}from"./Panel-CsovmtxF.js";import{A as x,_ as S,a as C,b as w,c as T,d as E,f as ee,g as D,h as O,l as k,m as A,o as j,p as te,s as ne,u as re,v as ie,y as ae}from"./Rack-CDUOJkS2.js";import{n as oe,r as se,t as ce}from"./TokenBreakdown-BC6nqo1v.js";import{t as le}from"./chevron-right-hwF5mD6-.js";import{t as ue}from"./dist-BBGxva0Y.js";import{n as de,t as fe}from"./Chip-D0XSbQUr.js";import{i as pe,n as me}from"./Field-DG1317zr.js";import{i as he,n as M,r as N,t as ge}from"./Table-CVDZ69Zx.js";import*as P from"react";import{useEffect as _e,useLayoutEffect as ve,useRef as ye,useState as be}from"react";import{Fragment as xe,jsx as F,jsxs as I}from"react/jsx-runtime";import L from"styled-components";import*as Se from"react-dom";var Ce={name:`calendar-days`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 13h.01`,key:`1sbv64`}],[`path`,{d:`M12 13h.01`,key:`y0uutt`}],[`path`,{d:`M16 13h.01`,key:`wip0gl`}],[`path`,{d:`M8 17h.01`,key:`p3bg7i`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M16 17h.01`,key:`ql8jdd`}]]};Ce.node;var we=x(Ce),Te={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};Te.node;var Ee=x(Te),De=[`top`,`right`,`bottom`,`left`],R=Math.min,z=Math.max,Oe=Math.round,ke=Math.floor,B=e=>({x:e,y:e}),Ae={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function je(e,t,n){return z(e,R(t,n))}function V(e,t){return typeof e==`function`?e(t):e}function H(e){return e.split(`-`)[0]}function Me(e){return e.split(`-`)[1]}function Ne(e){return e===`x`?`y`:`x`}function Pe(e){return e===`y`?`height`:`width`}function U(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Fe(e){return Ne(U(e))}function Ie(e,t,n){n===void 0&&(n=!1);let r=Me(e),i=Fe(e),a=Pe(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ge(o)),[o,Ge(o)]}function Le(e){let t=Ge(e);return[Re(e),t,Re(t)]}function Re(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ze=[`left`,`right`],Be=[`right`,`left`],Ve=[`top`,`bottom`],He=[`bottom`,`top`];function Ue(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Be:ze:t?ze:Be;case`left`:case`right`:return t?Ve:He;default:return[]}}function We(e,t,n,r){let i=Me(e),a=Ue(H(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Re)))),a}function Ge(e){let t=H(e);return Ae[t]+e.slice(t.length)}function Ke(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function qe(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ke(e)}function Je(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ye(e,t,n){let{reference:r,floating:i}=e,a=U(t),o=Fe(t),s=Pe(o),c=H(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Me(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Xe(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=V(t,e),p=qe(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Je(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Je(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Ze=50,Qe=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Xe},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ye(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Ze&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Ye(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},$e=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=V(e,t)||{};if(l==null)return{};let d=qe(u),f={x:n,y:r},p=Fe(i),m=Pe(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=R(d[_],T),ee=R(d[v],T),D=C-h[m]-ee,O=C/2-h[m]/2+w,k=je(E,O,D),A=!c.arrow&&Me(i)!=null&&O!==k&&a.reference[m]/2-(O<E?E:ee)-h[m]/2<0,j=A?O<E?O-E:O-D:0;return{[p]:f[p]+j,data:{[p]:k,centerOffset:O-k-j,...A&&{alignmentOffset:j}},reset:A}}}),et=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=V(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=H(r),_=U(o),v=H(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ge(o)]:Le(o)),x=p!==`none`;!d&&x&&b.push(...We(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ie(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===U(t)||T.every(e=>U(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=U(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function tt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function nt(e){return De.some(t=>e[t]>=0)}var rt=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=V(e,t);switch(i){case`referenceHidden`:{let e=tt(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:nt(e)}}}case`escaped`:{let e=tt(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:nt(e)}}}default:return{}}}}},it=new Set([`left`,`top`]);async function at(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=H(n),s=Me(n),c=U(n)===`y`,l=it.has(o)?-1:1,u=a&&c?-1:1,d=V(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ot=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await at(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},st=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=V(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=U(i),p=Ne(f),m=u[p],h=u[f],g=(e,t)=>je(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},ct=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=V(e,t),u={x:n,y:r},d=U(i),f=Ne(d),p=u[f],m=u[d],h=V(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=it.has(H(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},lt=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=V(e,t),c=await i.detectOverflow(t,s),l=H(n),u=Me(n),d=U(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=R(p-c[m],g),y=R(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*z(c.left,c.right):S=p-2*z(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function ut(){return typeof window<`u`}function dt(e){return ft(e)?(e.nodeName||``).toLowerCase():`#document`}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function G(e){return((ft(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ft(e){return ut()?e instanceof Node||e instanceof W(e).Node:!1}function K(e){return ut()?e instanceof Element||e instanceof W(e).Element:!1}function q(e){return ut()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function pt(e){return!ut()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}function mt(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Y(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ht(e){return/^(table|td|th)$/.test(dt(e))}function gt(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var _t=/transform|translate|scale|rotate|perspective|filter/,vt=/paint|layout|strict|content/,J=e=>!!e&&e!==`none`,yt;function bt(e){let t=K(e)?Y(e):e;return J(t.transform)||J(t.translate)||J(t.scale)||J(t.rotate)||J(t.perspective)||!St()&&(J(t.backdropFilter)||J(t.filter))||_t.test(t.willChange||``)||vt.test(t.contain||``)}function xt(e){let t=Tt(e);for(;q(t)&&!Ct(t);){if(bt(t))return t;if(gt(t))return null;t=Tt(t)}return null}function St(){return yt??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),yt}function Ct(e){return/^(html|body|#document)$/.test(dt(e))}function Y(e){return W(e).getComputedStyle(e)}function wt(e){return K(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Tt(e){if(dt(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||pt(e)&&e.host||G(e);return pt(t)?t.host:t}function Et(e){let t=Tt(e);return Ct(t)?(e.ownerDocument||e).body:q(t)&&mt(t)?t:Et(t)}function Dt(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Et(e),i=r===e.ownerDocument?.body,a=W(r);if(i){let e=Ot(a);return t.concat(a,a.visualViewport||[],mt(r)?r:[],e&&n?Dt(e):[])}return t.concat(r,Dt(r,[],n))}function Ot(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function kt(e){let t=Y(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=q(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Oe(n)!==a||Oe(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function At(e){return K(e)?e:e.contextElement}function jt(e){let t=At(e);if(!q(t))return B(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=kt(t),o=(a?Oe(n.width):n.width)/r,s=(a?Oe(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Mt=B(0);function Nt(e){let t=W(e);return!St()||!t.visualViewport?Mt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Pt(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===W(e)}function Ft(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=At(e),o=B(1);t&&(r?K(r)&&(o=jt(r)):o=jt(e));let s=Pt(a,n,r)?Nt(a):B(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=W(a),t=K(r)?W(r):r,n=e,i=Ot(n);for(;i&&t!==n;){let e=jt(i),t=i.getBoundingClientRect(),r=Y(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=W(i),i=Ot(n)}}return Je({width:u,height:d,x:c,y:l})}function It(e,t){let n=wt(e).scrollLeft;return t?t.left+n:Ft(G(e)).left+n}function Lt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-It(e,n),y:n.top+t.scrollTop}}function Rt(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=G(r),s=t?gt(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=B(1),u=B(0),d=q(r);if((d||!a)&&((dt(r)!==`body`||mt(o))&&(c=wt(r)),d)){let e=Ft(r);l=jt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Lt(o,c):B(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function zt(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Bt(e){let t=wt(e),n=e.ownerDocument.body,r=z(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=z(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+It(e),o=-t.scrollTop;return Y(n).direction===`rtl`&&(a+=z(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Vt=25;function Ht(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=W(e),a=G(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!St()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(It(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Vt&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ut(e,t){let n=Ft(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=jt(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Wt(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Ht(e,n,t);else if(t===`document`)r=Bt(G(e));else if(K(t))r=Ut(t,n);else{let n=Nt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Je(r)}function Gt(e,t){let n=t.get(e);if(n)return n;let r=Dt(e,[],!1).filter(e=>K(e)&&dt(e)!==`body`),i=null,a=Y(e).position===`fixed`,o=a?Tt(e):e;for(;K(o)&&!Ct(o);){let e=Y(o),t=bt(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Tt(o)}return t.set(e,r),r}function Kt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?gt(t)?[]:Gt(t,this._c):[].concat(n),r],o=Wt(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Wt(t,a[e],i);s=z(n.top,s),c=R(n.right,c),l=R(n.bottom,l),u=z(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function qt(e){let{width:t,height:n}=kt(e);return{width:t,height:n}}function Jt(e,t,n){let r=q(t),i=G(t),a=n===`fixed`,o=Ft(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=B(0);if((r||!a)&&((dt(t)!==`body`||mt(i))&&(s=wt(t)),r)){let e=Ft(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=It(i));let l=i&&!r&&!a?Lt(i,s):B(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Yt(e){return Y(e).position===`static`}function Xt(e,t){if(!q(e)||Y(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return G(e)===n&&(n=n.ownerDocument.body),n}function Zt(e,t){let n=W(e);if(gt(e))return n;if(!q(e)){let t=Tt(e);for(;t&&!Ct(t);){if(K(t)&&!Yt(t))return t;t=Tt(t)}return n}let r=Xt(e,t);for(;r&&ht(r)&&Yt(r);)r=Xt(r,t);return r&&Ct(r)&&Yt(r)&&!bt(r)?n:r||xt(e)||n}var Qt=async function(e){let t=this.getOffsetParent||Zt,n=this.getDimensions,r=await n(e.floating);return{reference:Jt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $t(e){return Y(e).direction===`rtl`}var en={convertOffsetParentRelativeRectToViewportRelativeRect:Rt,getDocumentElement:G,getClippingRect:Kt,getOffsetParent:Zt,getElementRects:Qt,getClientRects:zt,getDimensions:qt,getScale:jt,isElement:K,isRTL:$t};function tn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nn(e,t,n){let r=null,i,a=G(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=ke(d),h=ke(a.clientWidth-(u+f)),g=ke(a.clientHeight-(d+p)),_=ke(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:z(0,R(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!tn(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=W(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function rn(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=At(e),u=i||a?[...l?Dt(l):[],...t?Dt(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?nn(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Ft(e):null;c&&g();function g(){let t=Ft(e);h&&!tn(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var an=ot,on=st,sn=et,cn=lt,ln=rt,un=$e,dn=ct,fn=(e,t,n)=>{let r=new Map,i=n??{},a={...en,...i.platform,_c:r};return Qe(e,t,{...i,platform:a})},pn=typeof document<`u`?ve:function(){};function mn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!mn(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!mn(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function hn(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gn(e,t){let n=hn(e);return Math.round(t*n)/n}function _n(e){let t=P.useRef(e);return pn(()=>{t.current=e}),t}function vn(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=P.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=P.useState(r);mn(f,r)||p(r);let[m,h]=P.useState(null),[g,_]=P.useState(null),v=P.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=P.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=P.useRef(null),C=P.useRef(null),w=P.useRef(u),T=c!=null,E=_n(c),ee=_n(i),D=_n(l),O=P.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};ee.current&&(e.platform=ee.current),fn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:D.current!==!1};k.current&&!mn(w.current,t)&&(w.current=t,Se.flushSync(()=>{d(t)}))})},[f,t,n,ee,D]);pn(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let k=P.useRef(!1);pn(()=>(k.current=!0,()=>{k.current=!1}),[]),pn(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,O);O()}},[b,x,O,E,T]);let A=P.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),j=P.useMemo(()=>({reference:b,floating:x}),[b,x]),te=P.useMemo(()=>{let e={position:n,left:0,top:0};if(!j.floating)return e;let t=gn(j.floating,u.x),r=gn(j.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...hn(j.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,j.floating,u.x,u.y]);return P.useMemo(()=>({...u,update:O,refs:A,elements:j,floatingStyles:te}),[u,O,A,j,te])}var yn=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:un({element:r.current,padding:i}).fn(n):r?un({element:r,padding:i}).fn(n):{}}}},bn=(e,t)=>{let n=an(e);return{name:n.name,fn:n.fn,options:[e,t]}},xn=(e,t)=>{let n=on(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sn=(e,t)=>({fn:dn(e).fn,options:[e,t]}),Cn=(e,t)=>{let n=sn(e);return{name:n.name,fn:n.fn,options:[e,t]}},wn=(e,t)=>{let n=cn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tn=(e,t)=>{let n=ln(e);return{name:n.name,fn:n.fn,options:[e,t]}},En=(e,t)=>{let n=yn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dn=Object.defineProperty,X=(e,t)=>Dn(e,`name`,{value:t,configurable:!0}),On=`Popper`,[kn,An]=S(On),[jn,Mn]=kn(On),Nn=X(e=>{let{__scopePopper:t,children:n}=e,[r,i]=P.useState(null),[a,o]=P.useState(void 0);return F(jn,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Pn=`PopperAnchor`,Fn=P.forwardRef(X(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Mn(Pn,n),o=P.useRef(null),s=a.onAnchorChange,c=P.useCallback(e=>{o.current=e,e&&s(e)},[s]),l=w(t,c),u=P.useRef(null);P.useEffect(()=>{if(!r)return;let e=u.current;u.current=r.current,e!==u.current&&s(u.current)});let d=a.placementState&&Hn(a.placementState),f=d?.[0],p=d?.[1];return r?null:F(ie.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...i,ref:l})},`PopperAnchor`)),In=`PopperContent`,[Ln,Rn]=kn(In),zn=P.forwardRef(X(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Mn(In,n),[_,v]=P.useState(null),y=w(t,v),[b,x]=P.useState(null),S=ue(b),C=S?.width??0,T=S?.height??0,ee=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],A=k.length>0,j={padding:D,boundary:k.filter(Bn),altBoundary:A},{refs:te,floatingStyles:ne,placement:re,isPositioned:ae,middlewareData:oe}=vn({strategy:`fixed`,placement:ee,whileElementsMounted:X((...e)=>rn(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[bn({mainAxis:i+T,alignmentAxis:o}),c&&xn({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Sn():void 0,...j}),c&&Cn({...j}),wn({...j,apply:X(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),b&&En({element:b,padding:s}),Vn({arrowWidth:C,arrowHeight:T}),f&&Tn({strategy:`referenceHidden`,...j,boundary:A?j.boundary:void 0})]}),se=g.setPlacementState;O(()=>(se(re),()=>{se(void 0)}),[re,se]);let[ce,le]=Hn(re),de=E(m);O(()=>{ae&&de?.()},[ae,de]);let fe=oe.arrow?.x,pe=oe.arrow?.y,me=oe.arrow?.centerOffset!==0,[he,M]=P.useState();return O(()=>{_&&M(window.getComputedStyle(_).zIndex)},[_]),F(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:ae?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:he,"--radix-popper-transform-origin":[oe.transformOrigin?.x,oe.transformOrigin?.y].join(` `),...oe.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:F(Ln,{scope:n,placedSide:ce,placedAlign:le,onArrowChange:x,arrowX:fe,arrowY:pe,shouldHideArrow:me,children:F(ie.div,{"data-side":ce,"data-align":le,...h,ref:y,style:{...h.style,animation:ae?h.style?.animation:`none`}})})})},`PopperContent`));function Bn(e){return e!==null}X(Bn,`isNotNull`);var Vn=X(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Hn(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Hn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}X(Hn,`getSideAndAlignFromPlacement`);var Un=Nn,Wn=Fn,Gn=zn,Kn=Object.defineProperty,Z=(e,t)=>Kn(e,`name`,{value:t,configurable:!0}),qn=`Popover`,[Jn,Yn]=S(qn,[An]),Xn=An(),[Zn,Qn]=Jn(qn),$n=Z(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Xn(t),c=P.useRef(null),[l,u]=P.useState(!1),[d,f]=A({prop:r,defaultProp:i??!1,onChange:a,caller:qn});return F(Un,{...s,children:F(Zn,{scope:t,contentId:ee(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:P.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:P.useCallback(()=>u(!0),[]),onCustomAnchorRemove:P.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),er=`PopoverTrigger`,tr=P.forwardRef(Z(function(e,t){let{__scopePopover:n,...r}=e,i=Qn(er,n),a=Xn(n),o=w(t,i.triggerRef),s=F(ie.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":fr(i.open),...r,ref:o,onClick:D(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:F(Wn,{asChild:!0,...a,children:s})},`PopoverTrigger`)),nr=`PopoverPortal`,[rr,ir]=Jn(nr,{forceMount:void 0}),ar=Z(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Qn(nr,t);return F(rr,{scope:t,forceMount:n,children:F(te,{present:n||a.open,children:F(T,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),or=`PopoverContent`,sr=P.forwardRef(Z(function(e,t){let n=ir(or,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Qn(or,e.__scopePopover);return F(te,{present:r||a.open,children:a.modal?F(lr,{...i,ref:t}):F(ur,{...i,ref:t})})},`PopoverContent`)),cr=ae(`PopoverContent.RemoveScroll`),lr=P.forwardRef(Z(function(e,t){let n=Qn(or,e.__scopePopover),r=P.useRef(null),i=w(t,r),a=P.useRef(!1);return P.useEffect(()=>{let e=r.current;if(e)return C(e)},[]),F(j,{as:cr,allowPinchZoom:!0,children:F(dr,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:D(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:D(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:D(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),ur=P.forwardRef(Z(function(e,t){let n=Qn(or,e.__scopePopover),r=P.useRef(!1),i=P.useRef(!1);return F(dr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),dr=P.forwardRef(Z(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Qn(or,n),p=Xn(n);return ne(),F(k,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:F(re,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:F(Gn,{"data-state":fr(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`));function fr(e){return e?`open`:`closed`}Z(fr,`getState`);var pr=$n,mr=tr,hr=ar,gr=sr,_r={},Q=e=>String(e).padStart(2,`0`),vr=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],yr=e=>{let t=new Date(e);return`${t.getFullYear()}-${Q(t.getMonth()+1)}-${Q(t.getDate())}`},br=(e,t,n)=>`${e}-${Q(t+1)}-${Q(n)}`,xr=e=>{let t=new Date(e);return`${Q(t.getHours())}:${Q(t.getMinutes())}`};function Sr(e,t,n){let r=Date.parse(`${e}T${t}`);if(!Number.isNaN(r))return n===`end`?r+59999:r}function Cr(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t+1,0).getDate();return{lead:n,days:Array.from({length:r},(e,t)=>t+1)}}function wr(e,t){return t<e?{from:t,to:e}:{from:e,to:t}}var Tr=(e,t,n)=>t!==void 0&&n!==void 0&&e>=t&&e<=n;function Er(e,t){let n=new Date(t);n.setDate(n.getDate()-(e-1)),n.setHours(0,0,0,0);let r=new Date(t);return r.setHours(23,59,59,999),{since:n.getTime(),until:r.getTime()}}var Dr=e=>{let t=new Date(e);return`${vr[t.getMonth()]??``} ${t.getDate()} ${Q(t.getHours())}:${Q(t.getMinutes())}`};function Or(e,t){return e!==void 0&&t!==void 0?`${Dr(e)} - ${Dr(t)}`:e===void 0?t===void 0?`Any time`:`Until ${Dr(t)}`:`From ${Dr(e)}`}var kr=L(mr)`
2
+ display: flex;
3
+ align-items: center;
4
+ gap: ${({theme:e})=>e.space(2)};
5
+ height: 30px;
6
+ min-width: 230px;
7
+ padding: 0 8px;
8
+ border-radius: ${({theme:e})=>e.radius.control};
9
+ background: ${({theme:e})=>e.color.panelSunk};
10
+ border: 1px solid ${({theme:e})=>e.color.ruleStrong};
11
+ color: ${({theme:e})=>e.color.ink};
12
+ font-family: ${({theme:e})=>e.font.mono};
13
+ font-size: 12px;
14
+ cursor: pointer;
15
+ transition: border-color 120ms ease;
16
+
17
+ &:hover,
18
+ &[data-state="open"] {
19
+ border-color: ${({theme:e})=>e.color.accent};
20
+ }
21
+
22
+ svg {
23
+ width: 13px;
24
+ height: 13px;
25
+ flex: none;
26
+ color: ${({theme:e})=>e.color.inkFaint};
27
+ }
28
+ `,Ar=L(gr)`
29
+ z-index: ${({theme:e})=>e.z.dialog};
30
+ width: 252px;
31
+ padding: ${({theme:e})=>e.space(2)};
32
+ background: ${({theme:e})=>e.color.panel};
33
+ border: 1px solid ${({theme:e})=>e.color.ruleStrong};
34
+ border-radius: ${({theme:e})=>e.radius.panel};
35
+ box-shadow: 0 12px 40px oklch(0 0 0 / 0.35);
36
+ `,jr=L(g)`
37
+ justify-content: space-between;
38
+ margin-bottom: ${({theme:e})=>e.space(2)};
39
+ `,Mr=L.div`
40
+ display: grid;
41
+ grid-template-columns: repeat(7, 1fr);
42
+ gap: 1px;
43
+ `,Nr=L.span`
44
+ height: 20px;
45
+ display: grid;
46
+ place-items: center;
47
+ font-size: 10px;
48
+ color: ${({theme:e})=>e.color.inkFaint};
49
+ font-family: ${({theme:e})=>e.font.sans};
50
+ `,Pr=L.button`
51
+ height: 26px;
52
+ ${({$start:e})=>e===void 0?``:`grid-column-start: ${e};`}
53
+ border: 0;
54
+ border-radius: ${({theme:e})=>e.radius.chip};
55
+ font-family: ${({theme:e})=>e.font.mono};
56
+ font-size: 11px;
57
+ cursor: pointer;
58
+ background: ${({theme:e,$in:t,$edge:n})=>n?e.color.accent:t?e.color.accentWash:`transparent`};
59
+ color: ${({theme:e,$edge:t})=>t?e.color.accentInk:e.color.ink};
60
+
61
+ &:hover {
62
+ background: ${({theme:e,$edge:t})=>t?e.color.accent:e.color.panelRaised};
63
+ }
64
+ `,Fr=L(g)`
65
+ gap: ${({theme:e})=>e.space(1)};
66
+ margin-top: ${({theme:e})=>e.space(2)};
67
+ padding-top: ${({theme:e})=>e.space(2)};
68
+ border-top: 1px solid ${({theme:e})=>e.color.rule};
69
+ `,Ir=L(me).attrs({type:`time`})`
70
+ width: auto;
71
+ flex: 1;
72
+ `,Lr=L(g)`
73
+ gap: ${({theme:e})=>e.space(1)};
74
+ margin-top: ${({theme:e})=>e.space(2)};
75
+ `,Rr=[`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`,`Su`],zr=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Br=[{label:`Today`,days:1},{label:`7d`,days:7},{label:`30d`,days:30}];function Vr({since:e,until:t,onChange:n}){let[r,i]=be(!1),[a,o]=be(()=>new Date(e??Date.now())),[s,c]=be(null),l=e===void 0?void 0:yr(e),u=t===void 0?void 0:yr(t),d=e===void 0?`00:00`:xr(e),f=t===void 0?`23:59`:xr(t),p=(e,t)=>n({since:Sr(e,d,`start`),until:Sr(t,f,`end`)}),h=e=>{if(s===null){c(e),p(e,e);return}let{from:t,to:n}=wr(s,e);c(null),p(t,n)},g=e=>o(t=>new Date(t.getFullYear(),t.getMonth()+e,1)),_=a.getFullYear(),v=a.getMonth(),{lead:x,days:S}=Cr(_,v);return I(pr,{open:r,onOpenChange:t=>{i(t),t&&(o(new Date(e??Date.now())),c(null))},children:[I(kr,{"aria-label":`Time range`,children:[F(we,{}),Or(e,t)]}),F(hr,{children:I(Ar,{align:`start`,sideOffset:4,children:[I(jr,{children:[F(m,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Previous month`,onClick:()=>g(-1),children:F(Ee,{})}),F(b,{children:`${zr[v]??``} ${_}`}),F(m,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Next month`,onClick:()=>g(1),children:F(le,{})})]}),I(Mr,{children:[Rr.map(e=>F(Nr,{children:e},e)),S.map((e,t)=>{let n=br(_,v,e);return F(Pr,{type:`button`,...t===0?{$start:x+1}:{},$in:Tr(n,l,u),$edge:n===l||n===u,onClick:()=>h(n),children:e},n)})]}),I(Fr,{children:[F(Ir,{"aria-label":`From time`,value:d,onChange:e=>n({since:Sr(l??yr(Date.now()),e.target.value,`start`),until:t})}),F(Ir,{"aria-label":`To time`,value:f,onChange:t=>n({since:e,until:Sr(u??yr(Date.now()),t.target.value,`end`)})})]}),F(Lr,{children:Br.map(e=>F(y,{type:`button`,$size:`sm`,onClick:()=>{c(null),n(Er(e.days,Date.now())),i(!1)},children:e.label},e.label))})]})})]})}var Hr=L(g)`
76
+ gap: ${({theme:e})=>e.space(2)};
77
+ flex-wrap: wrap;
78
+ `,Ur=L(pe)`
79
+ width: auto;
80
+ `,Wr=L(me)`
81
+ flex: 1;
82
+ min-width: 260px;
83
+ `,Gr=[{id:`all`,label:`All requests`,filters:{}},{id:`failed`,label:`Failed only`,filters:{failed:`true`}},{id:`pending`,label:`Still running`,filters:{state:`pending`}},{id:`done`,label:`Completed`,filters:{state:`done`}}],Kr=e=>e.failed===`true`?`failed`:e.state??`all`,qr=[{prefix:`model`,field:`model`},{prefix:`resolved`,field:`resolvedModel`},{prefix:`requested`,field:`requestedModel`},{prefix:`error`,field:`errorCode`}],Jr=[`model`,`resolvedModel`,`requestedModel`,`errorCode`];function Yr(e){let t={};for(let n of e.trim().split(/\s+/)){if(n===``)continue;let e=n.indexOf(`:`),r=e===-1?void 0:qr.find(t=>t.prefix===n.slice(0,e).toLowerCase());if(r===void 0){t.model=n;continue}let i=n.slice(e+1);i!==``&&(t[r.field]=i)}return t}function Xr(e){let t=[];return e.model!==void 0&&t.push(e.model),e.resolvedModel!==void 0&&t.push(`resolved:${e.resolvedModel}`),e.requestedModel!==void 0&&t.push(`requested:${e.requestedModel}`),e.errorCode!==void 0&&t.push(`error:${e.errorCode}`),t.join(` `)}var Zr=(e,t)=>Jr.every(n=>e[n]===t[n]),Qr=Object.fromEntries(Jr.map(e=>[e,void 0]));function $r({filters:e,patch:n}){let r=l(),a=t(),o=i();return I(xe,{children:[I(Ur,{"aria-label":`Provider`,value:e.provider??``,onChange:e=>n({provider:e.target.value||void 0}),children:[F(`option`,{value:``,children:`Any provider`}),(o.data??[]).map(e=>F(`option`,{value:e.id,children:e.label},e.id))]}),I(Ur,{"aria-label":`Account`,value:e.credentialId??``,onChange:e=>n({credentialId:e.target.value||void 0}),children:[F(`option`,{value:``,children:`Any account`}),(r.data??[]).map(e=>F(`option`,{value:e.id,children:e.label},e.id))]}),I(Ur,{"aria-label":`Gateway key`,value:e.apiKeyId??``,onChange:e=>n({apiKeyId:e.target.value||void 0}),children:[F(`option`,{value:``,children:`Any key`}),(a.data??[]).map(e=>F(`option`,{value:e.id,children:e.label},e.id))]})]})}function ei(e,t){let n={...e,...t};for(let e of Object.keys(n))n[e]===void 0&&delete n[e];return n}function ti({filters:e,onChange:t,operator:n=!1}){let r=n=>t(ei(e,n)),[i,a]=be(()=>Xr(e)),o=ye(null),s=ye(r);s.current=r;let c=()=>{o.current!==null&&clearTimeout(o.current),o.current=null};_e(()=>()=>clearTimeout(o.current??void 0),[]);let l=Xr(e);return o.current===null&&!Zr(Yr(i),e)&&i!==l&&a(l),I(Hr,{children:[F(Wr,{"aria-label":`Models and error codes`,placeholder:`Search anything`,value:i,onChange:e=>{let t=e.target.value;a(t),c(),o.current=setTimeout(()=>{o.current=null,s.current({...Qr,...Yr(t)})},500)}}),F(Vr,{since:e.since,until:e.until,onChange:e=>r(e)}),F(Ur,{"aria-label":`Show which requests`,value:Kr(e),onChange:e=>{let t=Gr.find(t=>t.id===e.target.value)??Gr[0];r({state:void 0,failed:void 0,...t.filters})},children:Gr.map(e=>F(`option`,{value:e.id,children:e.label},e.id))}),n?F($r,{filters:e,patch:r}):null,F(y,{type:`button`,onClick:()=>{c(),a(``),t({})},children:`Clear filters`})]})}function ni(e){let[t,n]=be(Date.now);return _e(()=>{if(!e)return;n(Date.now());let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),t}function ri({log:e}){return F(M,{$align:`right`,$mono:!0,...f(e)?{"aria-label":`processing`}:{title:se(e)},children:f(e)?F(ce,{}):F(oe,{tokens:e})})}function ii({rows:t,now:i,names:c,onOpen:l}){return I(ge,{children:[F(`thead`,{children:I(`tr`,{children:[F(N,{}),F(N,{$align:`right`,children:`Time`}),F(N,{children:`Requested`}),F(N,{children:`Routed to`}),c===void 0?null:I(xe,{children:[F(N,{children:`Account`}),F(N,{children:`Key`})]}),F(N,{$align:`right`,children:`Try`}),F(N,{$align:`right`,children:`TTFT`}),F(N,{$align:`right`,children:`Total`}),F(N,{$align:`right`,children:`Tokens`}),F(N,{$align:`right`,children:`Cost`}),F(N,{children:`Outcome`})]})}),F(`tbody`,{children:t.map(t=>I(he,{$selectable:!0,onClick:()=>l(t),children:[F(M,{children:F(d,{state:u(t),label:s(t)})}),F(M,{$align:`right`,$mono:!0,title:r(t.at),children:e(t.at)}),F(M,{$mono:!0,children:F(h,{style:{display:`block`,maxWidth:`20ch`},children:t.requestedModel||`—`})}),F(M,{children:t.resolvedProvider===null?F(b,{children:f(t)?`routing…`:`not routed`}):I(g,{$gap:1,children:[F(de,{provider:t.resolvedProvider}),F(v,{$dim:!0,children:t.resolvedModel??`—`})]})}),c===void 0?null:I(xe,{children:[F(M,{children:F(h,{style:{display:`block`,maxWidth:`18ch`},children:t.credentialId==null?`—`:c.accounts.get(t.credentialId)??p(t.credentialId)})}),F(M,{children:F(h,{style:{display:`block`,maxWidth:`16ch`},title:t.apiKeyId??void 0,children:t.apiKeyId==null?`—`:c.keys.get(t.apiKeyId)??p(t.apiKeyId)})})]}),F(M,{$align:`right`,$mono:!0,children:f(t)?`—`:t.attempts}),F(M,{$align:`right`,$mono:!0,children:f(t)?`—`:o(t.ttftMs)}),F(M,{$align:`right`,$mono:!0,children:f(t)?a(Math.max(0,i-t.at)):o(t.durationMs)}),F(ri,{log:t}),F(M,{$align:`right`,$mono:!0,children:f(t)?`—`:n(t.costUsd)}),F(M,{children:f(t)?F(fe,{$tone:`accent`,children:`live`}):t.errorCode===null?F(fe,{$tone:`ok`,children:t.status}):F(fe,{$tone:`down`,children:t.errorCode})})]},t.id))})]})}var ai=L.dl`
84
+ display: grid;
85
+ grid-template-columns: minmax(120px, auto) minmax(0, 1fr);
86
+ gap: 6px ${({theme:e})=>e.space(3)};
87
+ margin: 0;
88
+ font-size: 12.5px;
89
+ `,$=L.dd`
90
+ margin: 0;
91
+ font-family: ${({theme:e})=>e.font.mono};
92
+ word-break: break-all;
93
+ `;function oi({log:e,names:t,children:i}){return I(_,{$gap:3,children:[I(ai,{children:[F(b,{as:`dt`,children:`Request id`}),F($,{children:e.id}),F(b,{as:`dt`,children:`At`}),F($,{children:r(e.at)}),F(b,{as:`dt`,children:`Requested model`}),F($,{children:e.requestedModel||`—`}),F(b,{as:`dt`,children:`Routed to`}),F($,{children:f(e)?`—`:e.resolvedProvider===null?`not routed`:`${e.resolvedProvider} · ${e.resolvedModel??`—`}`}),t===void 0?null:I(xe,{children:[F(b,{as:`dt`,children:`Account`}),F($,{children:e.credentialId==null?`—`:t.accounts.get(e.credentialId)??e.credentialId}),F(b,{as:`dt`,children:`Key`}),F($,{children:e.apiKeyId==null?`—`:t.keys.get(e.apiKeyId)??e.apiKeyId})]}),F(b,{as:`dt`,children:`Attempts`}),F($,{children:f(e)?`—`:e.attempts}),F(b,{as:`dt`,children:`Status`}),F($,{children:f(e)?`in flight`:e.errorCode===null?e.status:`${e.status} ${e.errorCode}`}),F(b,{as:`dt`,children:`Timing`}),F($,{children:f(e)?`—`:`first token ${o(e.ttftMs)} · total ${o(e.durationMs)}`}),F(b,{as:`dt`,children:`Tokens`}),F($,{children:f(e)?`—`:I(xe,{children:[c(e.inputTokens),` in · `,c(e.outputTokens),` out ·`,` `,c(e.cacheReadTokens),` cache read · `,c(e.cacheWriteTokens),` `,`cache write`]})}),F(b,{as:`dt`,children:`Cost`}),F($,{children:f(e)?`—`:n(e.costUsd)}),F(b,{as:`dt`,children:`RTK compression`}),F($,{children:f(e)?`—`:e.rtkApplied?e.rtkFilterHits===void 0?`~${c(e.rtkEstimatedTokensSaved)} tokens saved`:`${c(e.rtkFilterHits)} hits · ${c(e.rtkOriginalCodeUnits??0)} → ${c(e.rtkCompressedCodeUnits??0)} code units · ~${c(e.rtkEstimatedTokensSaved)} tokens saved`:`not applied`}),e.rtkFilters===void 0?null:I(xe,{children:[F(b,{as:`dt`,children:`RTK filters`}),F($,{children:e.rtkFilters.length===0?`—`:e.rtkFilters.join(`, `)})]})]}),e.degradations.length===0?null:I(_,{$gap:1,children:[F(b,{children:`Capabilities dropped to fit the target`}),F(g,{$gap:1,$wrap:!0,children:e.degradations.map(e=>F(fe,{$tone:`warn`,children:e},e))})]}),i]})}export{_r as a,ti as i,ii as n,ni as r,oi as t};
@@ -1,8 +1,8 @@
1
- import{S as e,h as t,x as n}from"./shared-Dtkw6SE0.js";import{F as r,L as i,P as a,j as o}from"./Lamp-DkvXKB-B.js";import{D as s,a as c,b as l,i as u,r as d,t as f}from"./Panel-CWmOTDAP.js";import{S as p}from"./Rack-CEuCdVXc.js";import{t as m}from"./Readout-BTh732hP.js";import{jsx as h,jsxs as g}from"react/jsx-runtime";import _ from"styled-components";function v({legend:e,meta:t,actions:n,footer:r,query:i,failure:a,empty:o,isEmpty:s,children:l}){return h(f,{legend:e,...t===void 0?{}:{meta:t},...n===void 0?{}:{actions:n},...r===void 0?{}:{footer:r},children:i.isError?h(u,{...a===void 0?{}:{legend:a},error:i.error,onRetry:i.refetch}):i.isLoading?h(c,{rows:4}):s?h(d,{legend:o.legend,message:o.message}):l})}var y=_(s)`
1
+ import{S as e,h as t,x as n}from"./shared-DDpLUhCp.js";import{F as r,L as i,P as a,j as o}from"./Lamp-Dk9XrTCg.js";import{S as s,a as c,k as l,o as u,r as d,s as f}from"./Panel-CsovmtxF.js";import{S as p}from"./Rack-CDUOJkS2.js";import{t as m}from"./Readout-DlT5oxGO.js";import{jsx as h,jsxs as g}from"react/jsx-runtime";import _ from"styled-components";function v({legend:e,meta:t,actions:n,footer:r,query:i,failure:a,empty:o,isEmpty:s,children:l}){return h(d,{legend:e,...t===void 0?{}:{meta:t},...n===void 0?{}:{actions:n},...r===void 0?{}:{footer:r},children:i.isError?h(u,{...a===void 0?{}:{legend:a},error:i.error,onRetry:i.refetch}):i.isLoading?h(f,{rows:4}):s?h(c,{legend:o.legend,message:o.message}):l})}var y=_(l)`
2
2
  border-color: ${({theme:e,$on:t})=>t?e.color.accent:e.color.ruleStrong};
3
3
  color: ${({theme:e,$on:t})=>t?e.color.accent:e.color.inkDim};
4
4
  background: ${({theme:e,$on:t})=>t?e.color.accentWash:e.color.panelRaised};
5
- `,b=_(l)`
5
+ `,b=_(s)`
6
6
  gap: ${({theme:e})=>e.space(1)};
7
7
  flex-wrap: wrap;
8
8
  `,x=_.div`
@@ -1,4 +1,4 @@
1
- import{_ as e,b as t,g as n,m as r,v as i}from"./Rack-CEuCdVXc.js";import{t as a}from"./dist-D03q-60i.js";import*as o from"react";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import u from"styled-components";var d=Object.defineProperty,f=(e,t)=>d(e,`name`,{value:t,configurable:!0}),p=`Switch`,[m,h]=e(p),[g,_]=m(p);function v(e){let{__scopeSwitch:t,checked:n,children:i,defaultChecked:a,disabled:s,form:l,name:u,onCheckedChange:d,required:f,value:m=`on`,internal_do_not_use_render:h}=e,[_,v]=r({prop:n,defaultProp:a??!1,onChange:d,caller:p}),[y,b]=o.useState(null),[x,S]=o.useState(null),C=o.useRef(!1),[w,T]=o.useReducer(e=>e+1,0),D={checked:_,setChecked:v,disabled:s,control:y,setControl:b,name:u,form:l,value:m,hasConsumerStoppedPropagationRef:C,userInteractionCount:w,onUserInteraction:T,required:f,defaultChecked:a,isFormControl:!y||!!l||!!y.closest(`form`),bubbleInput:x,setBubbleInput:S};return c(g,{scope:t,...D,children:E(h)?h(D):i})}f(v,`SwitchProvider`);var y=`SwitchTrigger`,b=o.forwardRef(f(function({__scopeSwitch:e,onClick:r,...a},s){let{control:l,form:u,value:d,disabled:p,checked:m,required:h,setControl:g,setChecked:v,hasConsumerStoppedPropagationRef:b,onUserInteraction:x,isFormControl:S,bubbleInput:C}=_(y,e),w=t(s,g),T=o.useRef(m);return o.useEffect(()=>{let e=u?l?.ownerDocument.getElementById(u):l?.form;if(e instanceof HTMLFormElement){let t=f(()=>v(T.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[l,u,v]),c(i.button,{type:`button`,role:`switch`,"aria-checked":m,"aria-required":h,"data-state":D(m),"data-disabled":p?``:void 0,disabled:p,value:d,...a,ref:w,onClick:n(r,e=>{x(),v(e=>!e),C&&S&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})})},`SwitchTrigger`)),x=o.forwardRef(f(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:u,value:d,onCheckedChange:f,form:p,...m}=e;return c(v,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:u,required:o,onCheckedChange:f,name:r,form:p,value:d,internal_do_not_use_render:({isFormControl:e})=>l(s,{children:[c(b,{...m,ref:t,__scopeSwitch:n}),e&&c(T,{__scopeSwitch:n})]})})},`Switch`)),S=`SwitchThumb`,C=o.forwardRef(f(function(e,t){let{__scopeSwitch:n,...r}=e,a=_(S,n);return c(i.span,{"data-state":D(a.checked),"data-disabled":a.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),w=`SwitchBubbleInput`,T=o.forwardRef(f(function({__scopeSwitch:e,onClick:r,...s},l){let{control:u,hasConsumerStoppedPropagationRef:d,userInteractionCount:f,checked:p,defaultChecked:m,required:h,disabled:g,name:v,value:y,form:b,bubbleInput:x,setBubbleInput:S}=_(w,e),C=t(l,S),T=a(u),E=o.useRef(!1),D=o.useRef(p),O=o.useRef(f);o.useEffect(()=>{let e=x;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=f!==O.current;O.current=f;let i=D.current!==p;D.current=p;let a=!(r&&d.current);if(i&&n){E.current=!r;let t=new Event(`click`,{bubbles:a});n.call(e,p),e.dispatchEvent(t),E.current=!1}},[x,p,d,f]);let k=o.useRef(p);return c(i.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:m??k.current,required:h,disabled:g,name:v,value:y,form:b,...s,tabIndex:-1,ref:C,onClick:n(r,e=>{E.current&&e.stopPropagation()}),style:{...s.style,...T,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function E(e){return typeof e==`function`}f(E,`isFunction`);function D(e){return e?`checked`:`unchecked`}f(D,`getState`);var O=u(x)`
1
+ import{_ as e,b as t,g as n,m as r,v as i}from"./Rack-CDUOJkS2.js";import{t as a}from"./dist-BBGxva0Y.js";import*as o from"react";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import u from"styled-components";var d=Object.defineProperty,f=(e,t)=>d(e,`name`,{value:t,configurable:!0}),p=`Switch`,[m,h]=e(p),[g,_]=m(p);function v(e){let{__scopeSwitch:t,checked:n,children:i,defaultChecked:a,disabled:s,form:l,name:u,onCheckedChange:d,required:f,value:m=`on`,internal_do_not_use_render:h}=e,[_,v]=r({prop:n,defaultProp:a??!1,onChange:d,caller:p}),[y,b]=o.useState(null),[x,S]=o.useState(null),C=o.useRef(!1),[w,T]=o.useReducer(e=>e+1,0),D={checked:_,setChecked:v,disabled:s,control:y,setControl:b,name:u,form:l,value:m,hasConsumerStoppedPropagationRef:C,userInteractionCount:w,onUserInteraction:T,required:f,defaultChecked:a,isFormControl:!y||!!l||!!y.closest(`form`),bubbleInput:x,setBubbleInput:S};return c(g,{scope:t,...D,children:E(h)?h(D):i})}f(v,`SwitchProvider`);var y=`SwitchTrigger`,b=o.forwardRef(f(function({__scopeSwitch:e,onClick:r,...a},s){let{control:l,form:u,value:d,disabled:p,checked:m,required:h,setControl:g,setChecked:v,hasConsumerStoppedPropagationRef:b,onUserInteraction:x,isFormControl:S,bubbleInput:C}=_(y,e),w=t(s,g),T=o.useRef(m);return o.useEffect(()=>{let e=u?l?.ownerDocument.getElementById(u):l?.form;if(e instanceof HTMLFormElement){let t=f(()=>v(T.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[l,u,v]),c(i.button,{type:`button`,role:`switch`,"aria-checked":m,"aria-required":h,"data-state":D(m),"data-disabled":p?``:void 0,disabled:p,value:d,...a,ref:w,onClick:n(r,e=>{x(),v(e=>!e),C&&S&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})})},`SwitchTrigger`)),x=o.forwardRef(f(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:u,value:d,onCheckedChange:f,form:p,...m}=e;return c(v,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:u,required:o,onCheckedChange:f,name:r,form:p,value:d,internal_do_not_use_render:({isFormControl:e})=>l(s,{children:[c(b,{...m,ref:t,__scopeSwitch:n}),e&&c(T,{__scopeSwitch:n})]})})},`Switch`)),S=`SwitchThumb`,C=o.forwardRef(f(function(e,t){let{__scopeSwitch:n,...r}=e,a=_(S,n);return c(i.span,{"data-state":D(a.checked),"data-disabled":a.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),w=`SwitchBubbleInput`,T=o.forwardRef(f(function({__scopeSwitch:e,onClick:r,...s},l){let{control:u,hasConsumerStoppedPropagationRef:d,userInteractionCount:f,checked:p,defaultChecked:m,required:h,disabled:g,name:v,value:y,form:b,bubbleInput:x,setBubbleInput:S}=_(w,e),C=t(l,S),T=a(u),E=o.useRef(!1),D=o.useRef(p),O=o.useRef(f);o.useEffect(()=>{let e=x;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=f!==O.current;O.current=f;let i=D.current!==p;D.current=p;let a=!(r&&d.current);if(i&&n){E.current=!r;let t=new Event(`click`,{bubbles:a});n.call(e,p),e.dispatchEvent(t),E.current=!1}},[x,p,d,f]);let k=o.useRef(p);return c(i.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:m??k.current,required:h,disabled:g,name:v,value:y,form:b,...s,tabIndex:-1,ref:C,onClick:n(r,e=>{E.current&&e.stopPropagation()}),style:{...s.style,...T,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function E(e){return typeof e==`function`}f(E,`isFunction`);function D(e){return e?`checked`:`unchecked`}f(D,`getState`);var O=u(x)`
2
2
  all: unset;
3
3
  width: 30px;
4
4
  height: 16px;
@@ -1,4 +1,4 @@
1
- import{j as e}from"./Lamp-DkvXKB-B.js";import{A as t,k as n}from"./Rack-CEuCdVXc.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";import a,{keyframes as o}from"styled-components";var s={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};s.node;var c=t(s),l={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};l.node;var u=t(l),d=new Intl.NumberFormat(`en-US`);function f(e){return`${d.format(e.inputTokens)} input, ${d.format(e.outputTokens)} output, ${d.format(e.cacheReadTokens)} cache read, ${d.format(e.cacheWriteTokens)} cache write tokens`}var p=a.span`
1
+ import{j as e}from"./Lamp-Dk9XrTCg.js";import{A as t,k as n}from"./Rack-CDUOJkS2.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";import a,{keyframes as o}from"styled-components";var s={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};s.node;var c=t(s),l={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};l.node;var u=t(l),d=new Intl.NumberFormat(`en-US`);function f(e){return`${d.format(e.inputTokens)} input, ${d.format(e.outputTokens)} output, ${d.format(e.cacheReadTokens)} cache read, ${d.format(e.cacheWriteTokens)} cache write tokens`}var p=a.span`
2
2
  display: inline-flex;
3
3
  align-items: center;
4
4
  flex-wrap: wrap;
@@ -1,4 +1,4 @@
1
- import{A as e,C as t,E as n,J as r,T as i,Y as a,dt as o,o as s,t as c,w as l}from"./shared-Dtkw6SE0.js";import{C as u,E as d,M as f,N as p,R as m,S as h,_ as g,a as _,k as v,m as y,n as b}from"./Lamp-DkvXKB-B.js";import{C as x,_ as S,b as C,v as w}from"./Panel-CWmOTDAP.js";import*as T from"react";import{forwardRef as E}from"react";import{Fragment as D,jsx as O,jsxs as k}from"react/jsx-runtime";import A from"styled-components";var j=[`axis`],M=E((e,n)=>T.createElement(t,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:j,tooltipPayloadSearcher:a,categoricalChartProps:e,ref:n})),N=A(C)`
1
+ import{A as e,C as t,E as n,J as r,T as i,Y as a,dt as o,o as s,t as c,w as l}from"./shared-DDpLUhCp.js";import{C as u,E as d,M as f,N as p,R as m,S as h,_ as g,a as _,k as v,m as y,n as b}from"./Lamp-Dk9XrTCg.js";import{S as x,T as S,b as C,y as w}from"./Panel-CsovmtxF.js";import*as T from"react";import{forwardRef as E}from"react";import{Fragment as D,jsx as O,jsxs as k}from"react/jsx-runtime";import A from"styled-components";var j=[`axis`],M=E((e,n)=>T.createElement(t,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:j,tooltipPayloadSearcher:a,categoricalChartProps:e,ref:n})),N=A(x)`
2
2
  gap: ${({theme:e})=>e.space(5)};
3
3
  flex-wrap: wrap;
4
4
  `,P=A.div`
@@ -8,4 +8,4 @@ import{A as e,C as t,E as n,J as r,T as i,Y as a,dt as o,o as s,t as c,w as l}fr
8
8
  `,F=A.span`
9
9
  font-size: 11.5px;
10
10
  color: ${({theme:e})=>e.color.inkDim};
11
- `,I={budget:`1 4`,projection:`6 4`},L=`projected`;function R(e){let t=new Map;for(let{key:n,points:r}of e)for(let e of r){let r=t.get(e.at)??{at:e.at};r[n]=e.percent,t.set(e.at,r)}return[...t.values()].sort((e,t)=>e.at-t.at)}function z(e,t,n){return[Math.min(e,...n.map(e=>e.pace.from.at)),Math.max(t,...n.map(e=>e.pace.to.at))]}function B(e){if(e.resetsAt===null)return null;let t=e.resetsAt-u(e.windowType,e.windowMs);return t-(e.resetsAt-t)}function V(e,t){return t===null?`unknown`:e!==null&&t.to.at<e?`100% of limit before it resets`:`${Math.round(t.to.percent)}% of limit by reset`}function H(e,t){let n=d({observedAt:e.live.observedAt,limit:e.live.usedRatio===null?null:1},{ratePerHour:e.ratePerHourRatio,exhaustsAt:e.exhaustsAt,survives:e.survives,stale:e.stale||e.rolledOver});return n===`ok`?`lasts the window`:n!==`empty`||e.exhaustsAt===null?`unknown`:e.exhaustsAt<=t?`empty now`:`empty ~${p(e.exhaustsAt-t)} before it resets`}function U(t){let{live:a,samples:u,since:d,now:p,stale:T,rolledOver:E,spent:A,truncated:j=!1}=t,B=b[a.windowType];if(T)return k(x,{$gap:2,children:[k(C,{$gap:2,$wrap:!0,children:[k(S,{children:[B,` window`]}),O(F,{children:A})]}),O(F,{children:`reading is stale`})]});let U=h(g(u),a),W=U.flatMap(e=>{let t=_(e);return t===null?[]:[{key:`${e.key}-budget`,pace:t}]}),G=y(a,t.ratePerHourRatio),K=R([...U,...W.map(e=>({key:e.key,points:[e.pace.from,e.pace.to]})),...G===null?[]:[{key:L,points:[G.from,G.to]}]]),q=new Set(U.map(e=>e.key)),J=d===null||a.resetsAt===null?null:z(d,a.resetsAt,W);return k(x,{$gap:2,children:[k(C,{$gap:2,$wrap:!0,children:[k(S,{children:[B,` window`]}),O(F,{children:A}),E?O(F,{children:`· rolled over, waiting for the next reading`}):null]}),k(N,{children:[k(P,{children:[O(S,{children:`Window average`}),O(w,{children:t.rateText})]}),k(P,{children:[O(S,{children:`Estimate`}),O(w,{children:H(t,p)})]}),k(P,{children:[O(S,{children:`Projected`}),O(w,{children:V(a.resetsAt,G)})]}),t.extraFact]}),a.usedRatio===null?O(F,{children:`no ceiling reported`}):J===null?O(F,{children:`no reset reported`}):U.length===0?O(F,{children:`not yet observed`}):k(D,{children:[O(S,{children:[`Used, this window and the one before`,...j?[`earliest readings not shown`]:[],...W.length===0?[]:[`budget dotted`],...G===null?[]:[`projection dashed`]].join(` · `)}),O(c,{$height:160,children:O(o,{width:`100%`,height:`100%`,children:k(M,{data:K,margin:{top:4,right:8,bottom:4,left:4},children:[O(e,{stroke:`var(--rule)`,vertical:!1}),O(i,{dataKey:`at`,type:`number`,scale:`time`,domain:J,tickFormatter:e=>v(e,J[1]-J[0]),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,minTickGap:m(J[1]-J[0])?80:40}),O(l,{domain:[0,100],allowDataOverflow:!0,tickFormatter:e=>`${Math.round(e)}%`,tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:40}),O(r,{cursor:{stroke:`var(--rule-strong)`},content:({active:e,payload:t})=>{if(e!==!0||t===void 0||t.length===0)return null;let n=t.find(e=>q.has(String(e.dataKey)));if(n===void 0||typeof n.value!=`number`)return null;let r=n.payload.at;return k(s,{children:[O(`div`,{children:f(r)}),k(`div`,{children:[n.value.toFixed(1),`% used`]})]})}}),U.map(e=>O(n,{type:`monotone`,dataKey:e.key,stroke:`var(--accent)`,strokeWidth:2,dot:e.points.length===1&&{r:2.5,fill:`var(--accent)`,stroke:`var(--accent)`},connectNulls:!0,isAnimationActive:!1},e.key)),W.map(e=>O(n,{type:`linear`,dataKey:e.key,stroke:`var(--ink-faint)`,strokeWidth:1.5,strokeDasharray:I.budget,dot:!1,connectNulls:!0,isAnimationActive:!1},e.key)),G===null?null:O(n,{type:`linear`,dataKey:L,stroke:`var(--ink-dim)`,strokeWidth:1.5,strokeDasharray:I.projection,dot:!1,connectNulls:!0,isAnimationActive:!1})]})})})]})]})}function W({legend:e,value:t}){return k(P,{children:[O(S,{children:e}),O(w,{children:t})]})}export{U as n,B as r,W as t};
11
+ `,I={budget:`1 4`,projection:`6 4`},L=`projected`;function R(e){let t=new Map;for(let{key:n,points:r}of e)for(let e of r){let r=t.get(e.at)??{at:e.at};r[n]=e.percent,t.set(e.at,r)}return[...t.values()].sort((e,t)=>e.at-t.at)}function z(e,t,n){return[Math.min(e,...n.map(e=>e.pace.from.at)),Math.max(t,...n.map(e=>e.pace.to.at))]}function B(e){if(e.resetsAt===null)return null;let t=e.resetsAt-u(e.windowType,e.windowMs);return t-(e.resetsAt-t)}function V(e,t){return t===null?`unknown`:e!==null&&t.to.at<e?`100% of limit before it resets`:`${Math.round(t.to.percent)}% of limit by reset`}function H(e,t){let n=d({observedAt:e.live.observedAt,limit:e.live.usedRatio===null?null:1},{ratePerHour:e.ratePerHourRatio,exhaustsAt:e.exhaustsAt,survives:e.survives,stale:e.stale||e.rolledOver});return n===`ok`?`lasts the window`:n!==`empty`||e.exhaustsAt===null?`unknown`:e.exhaustsAt<=t?`empty now`:`empty ~${p(e.exhaustsAt-t)} before it resets`}function U(t){let{live:a,samples:u,since:d,now:p,stale:T,rolledOver:E,spent:A,truncated:j=!1}=t,B=b[a.windowType];if(T)return k(S,{$gap:2,children:[k(x,{$gap:2,$wrap:!0,children:[k(w,{children:[B,` window`]}),O(F,{children:A})]}),O(F,{children:`reading is stale`})]});let U=h(g(u),a),W=U.flatMap(e=>{let t=_(e);return t===null?[]:[{key:`${e.key}-budget`,pace:t}]}),G=y(a,t.ratePerHourRatio),K=R([...U,...W.map(e=>({key:e.key,points:[e.pace.from,e.pace.to]})),...G===null?[]:[{key:L,points:[G.from,G.to]}]]),q=new Set(U.map(e=>e.key)),J=d===null||a.resetsAt===null?null:z(d,a.resetsAt,W);return k(S,{$gap:2,children:[k(x,{$gap:2,$wrap:!0,children:[k(w,{children:[B,` window`]}),O(F,{children:A}),E?O(F,{children:`· rolled over, waiting for the next reading`}):null]}),k(N,{children:[k(P,{children:[O(w,{children:`Window average`}),O(C,{children:t.rateText})]}),k(P,{children:[O(w,{children:`Estimate`}),O(C,{children:H(t,p)})]}),k(P,{children:[O(w,{children:`Projected`}),O(C,{children:V(a.resetsAt,G)})]}),t.extraFact]}),a.usedRatio===null?O(F,{children:`no ceiling reported`}):J===null?O(F,{children:`no reset reported`}):U.length===0?O(F,{children:`not yet observed`}):k(D,{children:[O(w,{children:[`Used, this window and the one before`,...j?[`earliest readings not shown`]:[],...W.length===0?[]:[`budget dotted`],...G===null?[]:[`projection dashed`]].join(` · `)}),O(c,{$height:160,children:O(o,{width:`100%`,height:`100%`,children:k(M,{data:K,margin:{top:4,right:8,bottom:4,left:4},children:[O(e,{stroke:`var(--rule)`,vertical:!1}),O(i,{dataKey:`at`,type:`number`,scale:`time`,domain:J,tickFormatter:e=>v(e,J[1]-J[0]),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,minTickGap:m(J[1]-J[0])?80:40}),O(l,{domain:[0,100],allowDataOverflow:!0,tickFormatter:e=>`${Math.round(e)}%`,tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:40}),O(r,{cursor:{stroke:`var(--rule-strong)`},content:({active:e,payload:t})=>{if(e!==!0||t===void 0||t.length===0)return null;let n=t.find(e=>q.has(String(e.dataKey)));if(n===void 0||typeof n.value!=`number`)return null;let r=n.payload.at;return k(s,{children:[O(`div`,{children:f(r)}),k(`div`,{children:[n.value.toFixed(1),`% used`]})]})}}),U.map(e=>O(n,{type:`monotone`,dataKey:e.key,stroke:`var(--accent)`,strokeWidth:2,dot:e.points.length===1&&{r:2.5,fill:`var(--accent)`,stroke:`var(--accent)`},connectNulls:!0,isAnimationActive:!1},e.key)),W.map(e=>O(n,{type:`linear`,dataKey:e.key,stroke:`var(--ink-faint)`,strokeWidth:1.5,strokeDasharray:I.budget,dot:!1,connectNulls:!0,isAnimationActive:!1},e.key)),G===null?null:O(n,{type:`linear`,dataKey:L,stroke:`var(--ink-dim)`,strokeWidth:1.5,strokeDasharray:I.projection,dot:!1,connectNulls:!0,isAnimationActive:!1})]})})})]})]})}function W({legend:e,value:t}){return k(P,{children:[O(w,{children:e}),O(C,{children:t})]})}export{U as n,B as r,W as t};
@@ -0,0 +1 @@
1
+ import{j as e,o as t,r as n}from"./Panel-CsovmtxF.js";import{jsx as r}from"react/jsx-runtime";function i({error:i}){let a=e();return r(n,{legend:`Console unavailable`,children:r(t,{legend:`The gateway did not answer`,error:i,onRetry:()=>void a.invalidate()})})}export{i as errorComponent};
@@ -0,0 +1,70 @@
1
+ import{F as e,Ft as t,G as n,I as r,Jt as i,Lt as a,Mt as o,Nt as s,Pt as c,St as l,T as u,U as d,_t as f,b as p,c as m,ct as ee,d as h,en as g,h as _,j as v,kt as te,mt as y,n as b,o as x,pt as ne,s as S,st as re,t as ie,ut as C,v as w,y as T}from"./Lamp-Dk9XrTCg.js";import{A as E,C as ae,S as D,T as O,a as oe,b as k,c as A,k as j,o as M,r as N,s as P,y as F}from"./Panel-CsovmtxF.js";import{A as I,D as L,i as se,r as R,t as ce,w as z}from"./Rack-CDUOJkS2.js";import{t as le}from"./CopyValue-DAlmkISB.js";import{t as ue}from"./chevron-down-Bb5ZGvwk.js";import{t as de}from"./chevron-right-hwF5mD6-.js";import{t as fe}from"./plus-BgcHxxIr.js";import{t as pe}from"./rotate-ccw-Do43Argv.js";import{t as me}from"./trash-00950_yY.js";import{t as he}from"./Toggle-CdMD58sy.js";import{t as ge}from"./Chip-D0XSbQUr.js";import{i as B,n as V,r as _e,t as H}from"./Field-DG1317zr.js";import{t as ve}from"./Meter-stpt3vQu.js";import{i as ye,n as U,r as W,t as be}from"./Table-CVDZ69Zx.js";import{n as xe,r as G,t as K}from"./WindowChart-Bqbl-KFO.js";import{Fragment as Se,useCallback as Ce,useEffect as we,useState as q}from"react";import{Fragment as J,jsx as Y,jsxs as X}from"react/jsx-runtime";import Z from"styled-components";var Q={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};Q.node;var Te=I(Q),Ee={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};Ee.node;var De=I(Ee);function Oe(e){return e?.authTypes??[]}function ke(e){return Oe(e).includes(`oauth`)?`oauth`:`apiKey`}function $(e){return e[0]?.id??`anthropic`}var Ae={oauth:`Authorize in the browser`,apiKey:`Paste an API key`};function je(e){let t=e?.callback;return t===void 0?`code#state`:`${t.uri}?code=…`}var Me=Z.ol`
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: ${({theme:e})=>e.space(3)};
5
+ `,Ne=Z.div`
6
+ font-family: ${({theme:e})=>e.font.mono};
7
+ font-size: 26px;
8
+ letter-spacing: 0.22em;
9
+ text-align: center;
10
+ padding: ${({theme:e})=>e.space(3)};
11
+ background: ${({theme:e})=>e.color.panelSunk};
12
+ border: 1px solid ${({theme:e})=>e.color.ruleStrong};
13
+ border-radius: ${({theme:e})=>e.radius.control};
14
+ `,Pe=Z.p`
15
+ font-size: 12px;
16
+ color: ${({theme:e})=>e.color.down};
17
+ `,Fe=Z.p`
18
+ font-size: 12px;
19
+ color: ${({theme:e})=>e.color.inkDim};
20
+ `;function Ie({open:e,credentials:t,onOpenChange:r,onConnected:i}){let a=o().data??[],[s,c]=q(()=>$(a)),l=d(a,s),[u,f]=q(()=>ke(d(a,$(a)))),[p,m]=q(``),h=l?.label??s,[g,_]=q(null),[v,te]=q(``),[y,b]=q(``),x=(t??[]).filter((e,t,n)=>e.provider===`custom`&&n.findIndex(t=>t.provider===`custom`&&t.providerData.endpointId===e.providerData.endpointId)===t),[ne,S]=q(``),[ie,w]=q(``),[T,E]=q(`chat_completions`),[ae,oe]=q(``),[k,M]=q(null),N=ee(),P=re(),I=C(),L=Ce(()=>{_(null),te(``),b(``),S(``),w(``),E(`chat_completions`),oe(``),M(null),m(``),N.reset(),P.reset(),I.reset()},[N,P,I]),R=Ce(e=>{e||L(),r(e)},[r,L]);return we(()=>{if(g===null||g.kind!==`device`)return;let e=!1,t=async()=>{try{let t=await n(g.flowId);if(e)return;if(t.status===`complete`){L(),r(!1),i();return}}catch(t){if(e)return;M(A(t)),_(null);return}e||(a=setTimeout(()=>void t(),g.pollIntervalMs))},a=setTimeout(()=>void t(),g.pollIntervalMs);return()=>{e=!0,clearTimeout(a)}},[g,i,r,L]),Y(se,{open:e,onOpenChange:R,title:`Connect an account`,description:`The gateway stores the resulting token encrypted. It is never shown again after this dialog.`,footer:g===null?X(J,{children:[Y(j,{type:`button`,onClick:()=>R(!1),children:`Cancel`}),Y(j,{type:`button`,$variant:`primary`,disabled:N.isPending||I.isPending,onClick:()=>{if(M(null),u===`apiKey`){I.mutate({provider:s,apiKey:ae,label:p.trim()||void 0,...s===`custom`?{endpointId:y,endpointLabel:ne,origin:ie,protocol:T}:{}},{onSuccess:()=>{L(),r(!1),i()},onError:e=>M(A(e))});return}N.mutate({provider:s,label:p.trim().length===0?h:p.trim()},{onSuccess:e=>_(e),onError:e=>M(A(e))})},children:u===`apiKey`?I.isPending?`Adding…`:`Add API key`:N.isPending?`Starting…`:`Start authorization`})]}):g.kind===`device`?Y(j,{type:`button`,onClick:()=>R(!1),children:`Cancel`}):X(J,{children:[Y(j,{type:`button`,onClick:()=>R(!1),children:`Cancel`}),Y(j,{type:`button`,$variant:`primary`,disabled:P.isPending||v.trim().length===0,onClick:()=>{g!==null&&(M(null),P.mutate({flowId:g.flowId,code:v.trim()},{onSuccess:()=>{L(),r(!1),i()},onError:e=>M(A(e))}))},children:P.isPending?`Finishing…`:`Finish connecting`})]}),children:X(Me,{children:[g===null?X(O,{$gap:3,children:[Y(H,{label:`Provider`,children:e=>Y(B,{...e,value:s,onChange:e=>{let t=e.target.value;c(t),f(ke(d(a,t)))},children:a.map(e=>Y(`option`,{value:e.id,children:e.label},e.id))})}),Oe(l).length>1?Y(H,{label:`How to connect`,children:e=>Y(B,{...e,value:u,onChange:e=>f(e.target.value),children:Oe(l).map(e=>Y(`option`,{value:e,children:Ae[e]},e))})}):null,s===`custom`?X(J,{children:[x.length===0?null:Y(H,{label:`Existing endpoint`,children:e=>X(B,{...e,value:y,onChange:e=>{let t=x.find(t=>t.providerData.endpointId===e.target.value);if(t===void 0){b(``),S(``),w(``),E(`chat_completions`);return}b(String(t.providerData.endpointId)),S(String(t.providerData.endpointLabel)),w(String(t.providerData.origin)+String(t.providerData.basePath??``)),E(t.providerData.protocol===`responses`?`responses`:`chat_completions`)},children:[Y(`option`,{value:``,children:`Create new endpoint`}),x.map(e=>Y(`option`,{value:String(e.providerData.endpointId),children:String(e.providerData.endpointLabel)},String(e.providerData.endpointId)))]})}),Y(H,{label:`Endpoint ID`,children:e=>Y(V,{...e,value:y,onChange:e=>b(e.target.value)})}),Y(H,{label:`Endpoint label`,children:e=>Y(V,{...e,value:ne,onChange:e=>S(e.target.value)})}),Y(H,{label:`Server URL`,children:e=>Y(V,{...e,value:ie,placeholder:`https://server.example/api`,onChange:e=>w(e.target.value)})}),ie.trim().toLowerCase().startsWith(`http://`)?Y(Pe,{children:`Plaintext transport sends prompts and API keys without TLS.`}):null,Y(H,{label:`Protocol`,children:e=>X(B,{...e,value:T,onChange:e=>E(e.target.value),children:[Y(`option`,{value:`chat_completions`,children:`Chat Completions (/v1/chat/completions)`}),Y(`option`,{value:`responses`,children:`Responses (/v1/responses)`})]})})]}):null,u===`apiKey`?Y(H,{label:`API key`,children:e=>Y(V,{...e,type:`password`,value:ae,autoComplete:`off`,onChange:e=>oe(e.target.value)})}):null,Y(H,{label:`Label`,hint:`How this account is named in the rack. Defaults to the provider.`,children:e=>Y(V,{...e,value:p,placeholder:h,onChange:e=>m(e.target.value)})})]}):X(O,{$gap:3,children:[X(O,{$gap:1,children:[Y(F,{children:`Step 1 — authorize`}),Y(D,{$gap:2,children:X(j,{as:`a`,href:g.authorizeUrl,target:`_blank`,rel:`noreferrer noopener`,$variant:`primary`,$size:`sm`,children:[Y(Te,{}),`Open `,h]})}),Y(le,{value:g.authorizeUrl,label:`Copy authorization link`})]}),g.userCode===null?null:X(O,{$gap:1,children:[Y(F,{children:`Step 2 — enter this code`}),Y(Ne,{children:g.userCode})]}),g.kind===`device`?X(Fe,{children:[l?.pasteHint??``,` Waiting for authorization…`]}):Y(H,{label:`Authorization code`,hint:l?.pasteHint??``,...k===null?{}:{problem:k},children:e=>Y(V,{...e,value:v,autoFocus:!0,placeholder:je(l),onChange:e=>te(e.target.value)})})]}),k===null||g?.kind===`pkce`?null:Y(Pe,{children:k})]})})}function Le({credentialId:e,windows:t,burn:n,pollIntervalMs:r,now:i}){let a=t.map(e=>({window:e,estimate:x(n,e.windowType),since:G(p(e))})),o=a.map(e=>e.since).filter(e=>e!==null),c=o.length===0?0:Math.min(...o),l=s({credentialId:e,since:c},o.length>0),u=l.data?.samples??[],d=l.data?.gatewayRates??[],f=l.data?.truncated===!0;return Y(O,{$gap:4,children:a.map(e=>Y(Re,{window:e.window,estimate:e.estimate,since:e.since,samples:u.filter(t=>t.windowType===e.window.windowType&&t.observedAt>=(e.since??0)),gatewayRate:d.find(t=>t.windowType===e.window.windowType),truncated:f,pollIntervalMs:r,now:i},e.window.windowType))})}function Re({window:e,estimate:t,since:n,samples:r,gatewayRate:i,truncated:a,pollIntervalMs:o,now:s}){let c=e.limit===null?`${v(e.used)} used`:`${v(e.used)} of ${v(e.limit)} used`,l=u(e,s),d=t===void 0||h(e,s,o)||t.stale&&!l;return Y(xe,{live:p(e),samples:r.map(p),since:n,now:s,truncated:a&&n!==null&&r.length>0&&(r[0]?.observedAt??0)>n,ratePerHourRatio:T(e,t),exhaustsAt:t?.exhaustsAt??null,survives:t?.survives??null,stale:d,rolledOver:l,spent:c,rateText:t?.ratePerHour===void 0||t.ratePerHour===null?`unknown`:`${v(t.ratePerHour)}/h`,extraFact:Y(K,{legend:`This gateway accounts for`,value:i?.gatewayRatePerHour===void 0||i.gatewayRatePerHour===null?`unknown`:`${v(i.gatewayRatePerHour)} tokens/h`})})}function ze({credential:e,busy:t,onOpenChange:n,onConfirm:i}){let o=a(e?.id??null),s=Date.now(),c=(o.data?.credits??[]).filter(e=>e.status===`available`).sort((e,t)=>(e.expiresAt??1/0)-(t.expiresAt??1/0))[0],l=o.isError||o.isFetching?0:o.data?.available??0,u=e===null?``:o.isFetching?`Reading the reset credits this account holds…`:o.isError?`Could not read reset credits for "${e.label}".`:l===0?`"${e.label}" has no reset credits available.`:`Spend one of ${l} reset ${l===1?`credit`:`credits`} on "${e.label}"? Its usage windows go back to zero at the provider, and the credit cannot be returned.`+(c?.expiresAt==null?``:` The credit spent is the one expiring soonest (${r(c.expiresAt,s)}).`);return Y(R,{open:e!==null,onOpenChange:n,title:`Reset quota`,body:u,confirmLabel:`Spend reset`,busy:t||c===void 0||l===0,onConfirm:()=>{e!==null&&c!==void 0&&l>0&&i(e,c.id)}})}var Be=Z(N)`
21
+ border-left: 3px solid ${({$provider:e})=>z(e)};
22
+ `,Ve=Z(V)`
23
+ width: 100%;
24
+ min-width: 140px;
25
+ height: 26px;
26
+ font-family: ${({theme:e})=>e.font.sans};
27
+ font-size: 12.5px;
28
+ background: transparent;
29
+ border-color: transparent;
30
+
31
+ &:hover:not(:disabled),
32
+ &:focus {
33
+ background: ${({theme:e})=>e.color.panelSunk};
34
+ border-color: ${({theme:e})=>e.color.ruleStrong};
35
+ }
36
+ `,He=Z(_e)`
37
+ width: 62px;
38
+ height: 26px;
39
+ `,Ue=Z.span`
40
+ display: block;
41
+ padding-left: 9px;
42
+ font-size: 11px;
43
+ color: ${({theme:e})=>e.color.inkDim};
44
+ `,We=Z.div`
45
+ margin: 0 0 10px;
46
+ min-height: 16px;
47
+ font-size: 12px;
48
+ color: ${({theme:e})=>e.color.inkDim};
49
+ `,Ge=Z.p`
50
+ margin: 0;
51
+ `,Ke=Z.ul`
52
+ margin: 4px 0 0;
53
+ padding-left: 16px;
54
+ list-style: disc;
55
+ `,qe=Z.div`
56
+ display: grid;
57
+ /* Bar, figure, legend. The figure has a column of its own so the legends stay
58
+ aligned down the stack whether a window reads 4% or 100%. */
59
+ grid-template-columns: 96px 34px 1fr;
60
+ align-items: center;
61
+ min-width: 208px;
62
+ gap: 6px;
63
+ `,Je=Z(k)`
64
+ font-size: 11px;
65
+ text-align: right;
66
+ `,Ye=Z.div`
67
+ display: flex;
68
+ flex-direction: column;
69
+ gap: 4px;
70
+ `;function Xe(){let e=g();return{pending:e.isPending,commit:(t,n)=>{e.mutate({id:t,patch:n})}}}function Ze(e,t){if(t===void 0)return` The list of models could not be read, so whether any target is pinned to this account is unknown.`;let n=t.filter(t=>t.targets.some(t=>t.credentialId===e.id)).map(e=>e.id);return n.length===0?``:` ${n.length===1?`The model`:`The models`} ${n.join(`, `)} ${n.length===1?`pins a target`:`pin targets`} to this account. Those targets will fail rather than fall back to another account.`}function Qe(){let{cadence:n}=L(),a=y(),s=ne(n(1e4,`res:credentials`)),u=i(),p=te(),ee=o(),h=f(),g=t(),v=c(),[re,C]=q(null),T=l(),{commit:k}=Xe(),[A,I]=q(!1),[se,z]=q(null),[le,B]=q([]),[V,_e]=q(new Set),[H,xe]=q(!1),[G,K]=q(null),[Ce,we]=q(new Set),Z=e=>we(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),Q=a.data??[],Te=e=>Q.find(t=>t.id===e)?.label??e,Ee=e=>{let t=e[0];if(e.length===1&&t!==void 0){let e=Te(t.credentialId);return t.kind===`refreshed`||t.kind===`coalesced`?`Quota refreshed for ${e}.`:t.kind===`noData`?`No quota data reported for ${e}.`:t.kind===`cooldown`?`Quota refresh is cooling down for ${e}.`:t.kind===`unsupported`?`${e} does not report quota.`:t.kind===`disabled`?`${e} is disabled, so it was not probed.`:`Quota refresh failed for ${e}.`}let n=e.filter(e=>e.kind===`refreshed`||e.kind===`coalesced`).length,r=e.filter(e=>e.kind===`failed`).length,i=e.filter(e=>e.kind===`cooldown`).length,a=e.length-n-r-i;return[`Refreshed ${n} ${n===1?`account`:`accounts`}`,r===0?null:`${r} failed`,i===0?null:`${i} cooling down`,a===0?null:`${a} skipped`].filter(e=>e!==null).join(`; `).concat(`.`)},Oe=e=>e.filter(e=>e.kind===`failed`||e.kind===`cooldown`||e.kind===`noData`).map(e=>`${Te(e.credentialId)}: ${e.kind===`failed`?`failed`:e.kind===`cooldown`?`cooling down`:`no data reported`}`),ke=async e=>{z(null),B([]),e.kind===`all`?xe(!0):_e(t=>{let n=new Set(t);return n.add(e.credentialId),n});try{let t=await g.mutateAsync(e);z(Ee(t.outcomes)),B(t.outcomes.length>1?Oe(t.outcomes):[])}catch{z(e.kind===`all`?`Quota refresh could not be started.`:`Quota refresh could not be started for ${Te(e.credentialId)}.`)}finally{xe(!1),e.kind===`one`&&_e(t=>{let n=new Set(t);return n.delete(e.credentialId),n})}},$=Date.now(),Ae=ee.data??[],je=e=>d(Ae,e)?.order??1/0,Me=[...new Set(Q.map(e=>e.provider))].sort((e,t)=>je(e)-je(t)),Ne=e=>d(Ae,e)?.label??e,Pe=m(s.data?.health??[],e=>e.credentialId),Fe=m(s.data?.quota??[],e=>e.credentialId),Re=m(s.data?.burn??[],e=>e.credentialId),Qe=u.data?.quotaPollIntervalMs??3e5,$e=Q.filter(e=>e.enabled).length,et=a.isLoading?`Reading connected accounts…`:Q.length===0?`No provider credentials are connected, so every request fails at the router.`:`${$e} of ${Q.length} accounts are enabled and eligible for routing.`;return X(J,{children:[Y(ce,{legend:`Accounts`,title:`Provider accounts`,summary:et,actions:X(D,{$gap:1,children:[T?X(j,{type:`button`,$variant:`ghost`,disabled:H||V.size>0,onClick:()=>void ke({kind:`all`}),children:[Y(De,{}),H?`Refreshing quota…`:`Refresh all quota`]}):null,X(j,{type:`button`,$variant:`primary`,onClick:()=>I(!0),children:[Y(fe,{}),`Connect an account`]})]})}),X(We,{children:[Y(Ge,{role:`status`,"aria-live":`polite`,children:se??``}),le.length===0?null:Y(Ke,{children:le.map(e=>Y(`li`,{children:e},e))})]}),a.isError?Y(N,{legend:`Accounts`,children:Y(M,{error:a.error,onRetry:()=>void a.refetch()})}):a.isLoading?Y(N,{legend:`Accounts`,children:Y(P,{rows:5})}):Q.length===0?Y(N,{legend:`Accounts`,children:Y(oe,{legend:`Nothing connected`,message:`Connect a provider account to give the router something to dispatch to. Tokens are encrypted at rest and never shown again.`,action:Y(j,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>I(!0),children:`Connect an account`})})}):Y(O,{$gap:4,children:Me.map(t=>{let n=Q.filter(e=>e.provider===t);return Y(Be,{$provider:t,legend:Ne(t),meta:`${n.length} account${n.length===1?``:`s`}`,flush:!0,children:Y(ae,{children:X(be,{children:[Y(`thead`,{children:X(`tr`,{children:[Y(W,{$width:`24%`,children:`Account`}),Y(W,{$width:`20%`,children:`Sign-in`}),Y(W,{$align:`right`,$width:`86px`,children:`Tier`}),Y(W,{$align:`right`,$width:`94px`,children:`Weight`}),Y(W,{$align:`center`,$width:`86px`,children:`Enabled`}),Y(W,{$width:`240px`,children:`Quota`}),Y(W,{$align:`right`,$width:`130px`,children:`Token expires`}),Y(W,{$width:`144px`})]})}),Y(`tbody`,{children:n.map(t=>{let n=S(Pe.get(t.id)??[],$,t.enabled,t.disabledReason),i=Fe.get(t.id)??[],a=Re.get(t.id)??[],o=w(i),s=Ce.has(t.id);return X(Se,{children:[X(ye,{children:[X(U,{children:[X(D,{$gap:2,children:[Y(ie,{state:n.state,label:n.note===``?`healthy`:n.note}),Y(Ve,{defaultValue:t.label,"aria-label":`Label for ${t.label}`,onBlur:e=>{let n=e.target.value.trim();if(n.length===0||n===t.label){e.target.value=t.label;return}k(t.id,{label:n})}})]}),n.note===``?null:Y(Ue,{children:n.note})]}),Y(U,{children:X(D,{$gap:1,children:[Y(ge,{children:t.authType===`oauth`?`oauth`:`api key`}),t.accountEmail===null?null:Y(F,{children:t.accountEmail})]})}),Y(U,{$align:`right`,children:Y(He,{min:1,step:1,defaultValue:t.tier,"aria-label":`Tier for ${t.label}`,onBlur:e=>{let n=Number(e.target.value);if(!Number.isInteger(n)||n<1||n===t.tier){e.target.value=String(t.tier);return}k(t.id,{tier:n})}})}),Y(U,{$align:`right`,children:Y(He,{min:.1,step:.1,defaultValue:t.weight,"aria-label":`Weight for ${t.label}`,onBlur:e=>{let n=Number(e.target.value);if(!Number.isFinite(n)||n<=0||n===t.weight){e.target.value=String(t.weight);return}k(t.id,{weight:n})}})}),Y(U,{$align:`center`,children:Y(he,{checked:t.enabled,label:`Route to ${t.label}`,onCheckedChange:e=>k(t.id,{enabled:e})})}),Y(U,{children:o.length===0?Y(F,{children:`unknown`}):Y(Ye,{children:o.map(({window:t,fraction:n})=>X(qe,{children:[Y(ve,{fraction:n,label:`${b[t.windowType]} window, ${Math.round(n*100)}% used`}),Y(Je,{children:e(n,0)}),Y(F,{children:_(t,$,Qe,r,x(a,t.windowType))})]},t.windowType))})}),Y(U,{$align:`right`,$mono:!0,children:t.expiresAt===null?`never`:r(t.expiresAt,$)}),Y(U,{$align:`right`,children:X(D,{$gap:1,$justify:`flex-end`,children:[i.length===0?null:Y(E,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-expanded":s,"aria-label":`${s?`Hide`:`Show`} quota history for ${t.label}`,title:`${s?`Hide`:`Show`} quota history for ${t.label}`,onClick:()=>Z(t.id),children:Y(s?ue:de,{})}),T&&t.authType===`oauth`&&d(Ae,t.provider)?.quotaResets===!0?Y(E,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Reset quota for ${t.label}`,title:`Reset quota for ${t.label}`,onClick:()=>C(t),children:Y(pe,{})}):null,T?Y(E,{type:`button`,$variant:`ghost`,$size:`sm`,disabled:H||V.has(t.id),"aria-label":V.has(t.id)?`Refreshing quota for ${t.label}`:`Refresh quota for ${t.label}`,title:`Refresh quota for ${t.label}`,onClick:()=>void ke({kind:`one`,credentialId:t.id}),children:Y(De,{})}):null,Y(E,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Remove ${t.label}`,title:`Remove ${t.label}`,onClick:()=>K(t),children:Y(me,{})})]})})]}),s?Y(ye,{children:Y(U,{colSpan:9,children:Y(Le,{credentialId:t.id,windows:i,burn:a,pollIntervalMs:Qe,now:$})})}):null]},t.id)})})]})})},t)})}),Y(Ie,{open:A,credentials:a.data??[],onOpenChange:I,onConnected:()=>void a.refetch()}),Y(ze,{credential:re,busy:v.isPending,onOpenChange:e=>{e||C(null)},onConfirm:(e,t)=>{z(null),B([]),v.mutate({credentialId:e.id,creditId:t},{onSuccess:t=>z(t.quotaRefreshed?`Quota reset for ${e.label}.`:`Quota reset for ${e.label}; the meter updates at the next poll.`),onError:()=>z(`Quota reset failed for ${e.label}.`),onSettled:()=>C(null)})}}),Y(R,{open:G!==null,onOpenChange:e=>{e||K(null)},title:`Remove account`,body:G===null?``:`Removing "${G.label}" deletes its stored token. Any model target pointing at ${Ne(G.provider)} loses this account, and reconnecting means authorizing again.`+Ze(G,p.data),confirmLabel:`Remove account`,busy:h.isPending,onConfirm:()=>{G!==null&&h.mutate(G.id,{onSettled:()=>K(null)})}})]})}var $e=Qe;export{$e as component};
@@ -0,0 +1,24 @@
1
+ import{At as e,B as t,j as n,lt as r}from"./Lamp-Dk9XrTCg.js";import{S as i,a,n as o,o as s,s as ee,t as c,x as l}from"./Panel-CsovmtxF.js";import{D as u,t as d}from"./Rack-CDUOJkS2.js";import{a as f,c as p,o as m,s as h}from"./index-D1RDaq3l.js";import{i as g}from"./Field-DG1317zr.js";import{useQueryClient as te}from"@tanstack/react-query";import{useLayoutEffect as ne,useMemo as _,useRef as v,useState as y}from"react";import{Fragment as b,jsx as x,jsxs as S}from"react/jsx-runtime";import C from"styled-components";var w={debug:10,info:20,warn:30,error:40};function T(e){return typeof e==`string`&&e in w}function E(e,t){return!T(t)||e.level===null||w[e.level]>=w[t]}function D(e){if(typeof e!=`object`||!e)return null;let{raw:t,at:n,level:r,msg:i}=e;return typeof t!=`string`||n!==null&&typeof n!=`number`||r!==null&&!T(r)||i!==null&&typeof i!=`string`?null:{raw:t,at:n,level:r,msg:i}}function re(e){if(typeof e!=`object`||!e)return null;let{lines:t}=e;if(!Array.isArray(t))return null;let n=[];for(let e of t){let t=D(e);if(t===null)return null;n.push(t)}return n}var O=[100,200,500],ie=[{value:``,label:`All levels`},{value:`debug`,label:`Debug and above`},{value:`info`,label:`Info and above`},{value:`warn`,label:`Warnings and errors`},{value:`error`,label:`Errors only`}],ae=C(i)`
2
+ gap: ${({theme:e})=>e.space(2)};
3
+ flex-wrap: wrap;
4
+ `,k=C(g)`
5
+ width: auto;
6
+ `,A=C.pre`
7
+ margin: 0;
8
+ padding: ${({theme:e})=>e.space(3)};
9
+ font-family: ${({theme:e})=>e.font.mono};
10
+ font-size: 12px;
11
+ line-height: 1.65;
12
+ white-space: pre;
13
+ `,j=C.div`
14
+ color: ${({theme:e,$level:t})=>t===`error`?e.color.down:t===`warn`?e.color.warn:t===`debug`?e.color.inkFaint:e.color.ink};
15
+ `,M=C.p`
16
+ margin: 0;
17
+ padding: ${({theme:e})=>`${e.space(2)} ${e.space(3)}`};
18
+ border-top: 1px solid ${({theme:e})=>e.color.rule};
19
+ color: ${({theme:e})=>e.color.inkDim};
20
+ font-size: 12px;
21
+ `,N=C.code`
22
+ font-family: ${({theme:e})=>e.font.mono};
23
+ word-break: break-all;
24
+ `;function P({read:e}){return e.source===`file`?S(M,{children:[`Reading `,x(N,{children:e.path}),`, named by `,x(N,{children:`OMNI_LOG_FILE`}),`. That variable says where the gateway's output is being captured; it does not redirect it.`]}):e.source===`journal`?S(M,{children:[`Reading the systemd journal for `,x(N,{children:`omnigateway.service`}),`. To read a file instead, redirect the gateway's output to one and point `,x(N,{children:`OMNI_LOG_FILE`}),` at the same path.`]}):e.unreachable!==void 0&&e.unreachable.length>0?S(M,{children:[e.unreachable.length===1?`One process`:`${e.unreachable.length} processes`,` did not answer in time and `,e.unreachable.length===1?`is`:`are`,` not shown:`,` `,e.unreachable.map(e=>e.slice(0,8)).join(`, `),`.`]}):null}var F={single:"Its output is going to a terminal, so there is nothing to read back. To capture it, run the gateway under systemd with `omni service install`, or start it with `omni start`, which redirects output to a file and points OMNI_LOG_FILE at it.",fleet:`No process in this fleet is capturing its own output, so there is nothing to read back. Each one can capture its own — tee its stdout to a file and point OMNI_LOG_FILE at the same path — and this screen will then merge them. For a fleet, ship stdout to a collector instead: Elasticsearch and Kibana, Loki and Grafana, or whatever already reads your containers. This screen shows one process's tail at a time, and a process that is gone takes its log with it.`,process:`This process is not capturing its own output, so there is nothing to read back from it. Tee its stdout to a file and point OMNI_LOG_FILE at the same path, or pick another process.`},I=[],L={read:void 0,lines:I};function R(){let{cadence:i}=u(),g=te(),[C,w]=y(200),[T,D]=y(``),[M,N]=y(``),R=e(),B=R.data?.nodes??[],V=B.length>1,H=M===``&&V?`all`:M,U=H===`all`?`fleet`:V?`process`:`single`,W=H===``||H===`all`?null:`${h}:${H}`,G=r(C,T,i(t,W??`stream:console`),H),K=G.data,[q,J]=y(L),Y=q.read===K?q.lines:I,X=_(()=>[...K?.lines??[],...Y].slice(-C),[K,Y,C]),Z=v(null),Q=v(!0),$=e=>{if(e.kind!==`frame`&&e.kind!==`gap`&&e.kind!==`closed`)return;let t=e.kind===`frame`?re(e.payload):null;if(t===null){J({read:K,lines:I}),e.kind===`frame`&&p(g,h);return}let n=t.filter(e=>E(e,T));n.length!==0&&J(e=>({read:K,lines:[...e.read===K?e.lines:[],...n].slice(-C)}))};return m(h,e=>{W===null&&$(e)}),f(W,$),ne(()=>{let e=Z.current;e!==null&&Q.current&&X.length>0&&(e.scrollTop=e.scrollHeight)},[X]),S(b,{children:[x(d,{legend:`Console`,title:`Gateway output`,summary:G.isLoading?`Reading the gateway's own output…`:`${n(X.length)} lines of what this process is doing. Requests are in Logs; prompt bodies, tokens and keys are never written here.`,actions:S(ae,{children:[V?S(k,{value:H,"aria-label":`Which process to show`,onChange:e=>N(e.target.value),children:[x(`option`,{value:`all`,children:`every process`}),B.map(e=>x(`option`,{value:e.id,children:e.self?`${e.id.slice(0,8)} (this one)`:e.id.slice(0,8)},e.id))]}):null,x(k,{value:T,"aria-label":`Which levels to show`,onChange:e=>D(e.target.value),children:ie.map(e=>x(`option`,{value:e.value,children:e.label},e.value))}),x(k,{value:C,"aria-label":`How many lines to fetch`,onChange:e=>w(Number(e.target.value)),children:O.map(e=>S(`option`,{value:e,children:[`last `,e]},e))})]})}),S(c,{legend:`Process output`,meta:K===void 0?void 0:x(l,{children:z(K)}),flush:!0,children:[K===void 0?null:x(P,{read:K}),x(o,{ref:Z,"data-testid":`console-terminal`,onScroll:e=>{let t=e.currentTarget;Q.current=t.scrollHeight-t.scrollTop-t.clientHeight<=8},children:G.isError?x(s,{error:G.error,onRetry:()=>void G.refetch()}):G.isLoading||R.isLoading?x(`div`,{style:{padding:12},children:x(ee,{rows:10})}):K!==void 0&&K.source===`none`?x(a,{legend:`Nothing is capturing this gateway`,message:F[U]}):X.length===0?x(a,{legend:`Nothing to show`,message:T===``?`This log is empty. The gateway writes here when it boots, refreshes a token, or polls a quota.`:`No line in this window is at that level. Widen the filter to see everything.`}):x(A,{children:X.map((e,t)=>x(j,{$level:e.level,children:e.nodeId===void 0?e.raw:`[${e.nodeId.slice(0,8)}] ${e.raw}`},`${e.at??0}-${t}`))})})]})]})}function z(e){return e.source===`file`?`log file`:e.source===`journal`?`systemd journal`:e.source===`fleet`?`every process, merged`:`not captured`}var B=R;export{B as component};
@@ -0,0 +1,24 @@
1
+ import{F as e,Ht as t,M as n,O as r,P as i,Q as a,Zt as o,ft as s,ht as c,j as l,nn as u,q as d,xt as f,yt as p,zt as m}from"./Lamp-Dk9XrTCg.js";import{C as h,E as g,S as _,T as v,a as y,c as b,k as x,o as S,r as C,s as w,v as T,y as E}from"./Panel-CsovmtxF.js";import{A as D,r as O,t as k}from"./Rack-CDUOJkS2.js";import{t as A}from"./trash-00950_yY.js";import{r as j,t as M}from"./Field-DG1317zr.js";import{t as N}from"./Meter-stpt3vQu.js";import{i as P,n as F,r as I,t as L}from"./Table-CVDZ69Zx.js";import{t as R}from"./Readout-DlT5oxGO.js";import{n as z}from"./reasons-Du1OBWAM.js";import{useQueryClient as B}from"@tanstack/react-query";import{useCallback as V,useState as H}from"react";import{Fragment as U,jsx as W,jsxs as G}from"react/jsx-runtime";import K from"styled-components";var q={name:`camera`,size:24,node:[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]};q.node;var J=D(q),Y={name:`minimize-2`,size:24,node:[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]};Y.node;var ee=D(Y),X=[{id:`keepLatest`,label:`Snapshots kept`,hint:`How many survive regardless of age. The newest is always kept, whatever both numbers say.`,unit:`files`,max:100},{id:`maxAgeDays`,label:`Maximum age`,hint:`Older snapshots are pruned after every new one and on the hourly maintenance sweep.`,unit:`days`,max:3650}],te=K.p`
2
+ font-size: 12px;
3
+ color: ${({theme:e})=>e.color.down};
4
+ `,ne=K.p`
5
+ font-size: 12px;
6
+ color: ${({theme:e})=>e.color.ok};
7
+ `,re=K.div`
8
+ display: grid;
9
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
10
+ gap: ${({theme:e})=>e.space(3)};
11
+ `;function ie(e){let t={};for(let n of X){let r=e[n.id].trim(),i=Number(r);if(r.length===0||!Number.isInteger(i)||i<1)return{ok:!1,problem:`${n.label} must be a whole number of 1 or more.`};if(i>n.max)return{ok:!1,problem:`${n.label} cannot exceed ${n.max}.`};t[n.id]=i}return{ok:!0,policy:t}}function ae({retention:e}){let n=t(),[r,i]=H({}),[a,o]=H(null),[s,c]=H(!1),l={keepLatest:r.keepLatest??(e===void 0?``:String(e.keepLatest)),maxAgeDays:r.maxAgeDays??(e===void 0?``:String(e.maxAgeDays))};return W(C,{legend:`Retention`,actions:W(x,{type:`button`,$size:`sm`,disabled:n.isPending||e===void 0,onClick:()=>{c(!1);let e=ie(l);if(!e.ok){o(e.problem);return}o(null),n.mutate(e.policy,{onSuccess:()=>{c(!0),i({})},onError:e=>o(b(e))})},children:n.isPending?`Saving…`:`Save retention`}),children:G(v,{$gap:3,children:[W(re,{children:X.map(e=>W(M,{label:e.label,hint:e.hint,children:t=>G(_,{$gap:2,children:[W(j,{...t,min:1,max:e.max,step:1,value:l[e.id],onChange:t=>i({...r,[e.id]:t.target.value})}),W(E,{children:e.unit})]})},e.id))}),a===null?null:W(te,{role:`alert`,children:a}),s&&a===null?W(ne,{role:`status`,children:`Retention saved.`}):null]})})}function oe(){let e=B();return V(t=>{if(t.adminPasswordChanged){z(`admin-password-changed`);return}e.invalidateQueries()},[e])}var Z=K.p`
12
+ font-size: 12px;
13
+ color: ${({theme:e})=>e.color.down};
14
+ `,se=K.input`
15
+ font-size: 12px;
16
+ color: ${({theme:e})=>e.color.inkDim};
17
+ max-width: 40ch;
18
+ `;function ce(){let e=o(),t=s(),i=m(),a=oe(),c=p(),l=f(),[u,T]=H(null),[E,D]=H(null),[k,A]=H(null),[j,N]=H(!1),R=e.data??[],z=G(x,{type:`button`,$variant:`primary`,$size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(),children:[W(J,{}),t.isPending?`Copying…`:`Take a snapshot`]}),B=G(v,{$gap:2,children:[G(_,{$gap:2,$wrap:!0,children:[W(M,{label:`Database file to import`,hint:`A snapshot taken from this or another OmniGateway. It is checked for integrity and rejected if it is not one of ours.`,children:e=>W(se,{...e,type:`file`,accept:`.sqlite,.db,application/octet-stream`,onChange:e=>A(e.target.files?.[0]??null)})}),W(x,{type:`button`,$variant:`danger`,$size:`sm`,disabled:k===null||l.isPending,onClick:()=>N(!0),children:l.isPending?`Replacing…`:`Import`})]}),l.isError?W(Z,{role:`alert`,children:b(l.error)}):null,i.isError?W(Z,{role:`alert`,children:b(i.error)}):null,t.isError?W(Z,{role:`alert`,children:b(t.error)}):null]});return G(C,{legend:`Snapshots`,meta:`${R.length}`,actions:z,footer:B,flush:!0,children:[e.isError?W(S,{error:e.error,onRetry:()=>void e.refetch()}):e.isLoading?W(`div`,{style:{padding:12},children:W(w,{rows:3})}):R.length===0?W(y,{legend:`No snapshots`,message:`Nothing has been copied yet, so there is nothing to go back to. Take one before a migration or a settings change you are unsure of.`,action:W(x,{type:`button`,$variant:`primary`,$size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(),children:`Take the first snapshot`})}):W(h,{children:G(L,{children:[W(`thead`,{children:G(`tr`,{children:[W(I,{children:`File`}),W(I,{children:`Reason`}),W(I,{$align:`right`,children:`Size`}),W(I,{$align:`right`,children:`Taken`}),W(I,{})]})}),W(`tbody`,{children:R.map(e=>G(P,{children:[W(F,{$mono:!0,children:W(g,{style:{maxWidth:`38ch`,display:`block`},children:e.filename})}),W(F,{children:e.reason}),W(F,{$align:`right`,$mono:!0,children:r(e.sizeBytes)}),W(F,{$align:`right`,$mono:!0,children:n(e.createdAt)}),W(F,{$align:`right`,children:G(_,{$gap:1,$justify:`flex-end`,children:[W(x,{as:`a`,$size:`sm`,href:d(e.id),download:e.filename,children:`Download`}),W(x,{type:`button`,$variant:`danger`,$size:`sm`,onClick:()=>T(e),children:`Restore`}),W(x,{type:`button`,$variant:`danger`,$size:`sm`,onClick:()=>D(e),children:`Delete`})]})})]},e.id))})]})}),W(O,{open:u!==null,onOpenChange:e=>{e||T(null)},title:`Restore database`,body:u===null?``:`Replacing the live database with ${u.filename}. Client requests are refused while the file is swapped, and a copy of the current database is taken first so this can be undone. Captured request bodies are not part of a snapshot and are left where they are.`,confirmLabel:`Restore database`,busy:i.isPending,onConfirm:()=>{u!==null&&i.mutate(u.id,{onSuccess:a,onSettled:()=>T(null)})}}),W(O,{open:E!==null,onOpenChange:e=>{e||D(null)},title:`Delete snapshot`,body:E===null?``:`Deleting ${E.filename} from disk. Download it first if it is the copy you would go back to; there is no other one of it.`,confirmLabel:`Delete snapshot`,busy:c.isPending,onConfirm:()=>{E!==null&&c.mutate(E.id,{onSettled:()=>D(null)})}}),W(O,{open:j,onOpenChange:N,title:`Import database`,body:k===null?``:`Replacing the live database with ${k.name}. It is validated before anything is touched, and a copy of the current database is taken first. If the file carries a different admin password, every session ends and you will be asked to sign in again.`,confirmLabel:`Replace database`,busy:l.isPending,onConfirm:()=>{k!==null&&l.mutate(k,{onSuccess:a,onSettled:()=>N(!1)})}})]})}var Q=K.p`
19
+ font-size: 12px;
20
+ color: ${({theme:e})=>e.color.ok};
21
+ `,$=K.p`
22
+ font-size: 12px;
23
+ color: ${({theme:e})=>e.color.down};
24
+ `;function le(e){try{let{hostname:t,port:n}=new URL(e);return n===``?t:`${t}:${n}`}catch{return e}}function ue(e){try{return new URL(e).pathname.replace(/^\//,``)||`—`}catch{return`—`}}function de(){let t=c(),n=u(),[o,s]=H(!1),d=a(),[f,p]=H(!1),m=t.data,h=m?.engine===`postgres`,g=m===void 0||m.logicalBytes===0?0:m.freePageBytes/m.logicalBytes;return G(U,{children:[W(k,{legend:`Database`,title:`Storage, snapshots, and retention`,summary:t.isLoading?`Measuring the database…`:h?`The Postgres database every replica of this cluster runs from. Back it up with pg_dump; nothing here copies or replaces it.`:`The one SQLite file this gateway runs from, the copies taken of it, and how long they are kept.`}),W(C,{legend:`Size`,meta:m===void 0?void 0:`schema v${m.stats.schemaVersion}`,actions:G(U,{children:[G(x,{type:`button`,$size:`sm`,disabled:d.isPending||m===void 0||m.bodiesBytes===0,onClick:()=>p(!0),children:[W(A,{}),d.isPending?`Clearing…`:`Clear bodies`]}),h?null:G(x,{type:`button`,$size:`sm`,disabled:n.isPending||m===void 0,onClick:()=>s(!0),children:[W(ee,{}),n.isPending?`Compacting…`:`Compact`]})]}),footer:n.isError?W($,{role:`alert`,children:b(n.error)}):d.isError?W($,{role:`alert`,children:b(d.error)}):n.data===void 0?d.data===void 0?void 0:W(Q,{role:`status`,children:`Cleared ${l(d.data.removed)} captured bodies.`}):W(Q,{role:`status`,children:`Compacted, reclaiming ${r(n.data.reclaimedBytes)} in ${i(n.data.durationMs)}.`}),children:t.isError?W(S,{error:t.error,onRetry:()=>void t.refetch()}):m===void 0?W(w,{rows:3}):h?G(T,{$min:`180px`,$stretch:!0,children:[W(R,{legend:`Database`,value:r(m.logicalBytes),unit:`${m.stats.pageCount} blocks of ${r(m.stats.pageSize)}`}),W(R,{legend:`Server`,value:le(m.location),unit:`database ${ue(m.location)}`}),W(R,{legend:`Captured bodies`,value:r(m.bodiesBytes),unit:`the request_bodies table`})]}):G(T,{$min:`180px`,$stretch:!0,children:[W(R,{legend:`Database file`,value:r(m.fileBytes),unit:`${m.stats.pageCount} pages of ${r(m.stats.pageSize)}`,trace:W(N,{fraction:g,label:`${e(g,0)} of the file is reclaimable`})}),W(R,{legend:`Reclaimable`,value:r(m.freePageBytes),unit:`${m.stats.freelistCount} free pages`}),W(R,{legend:`Write-ahead log`,value:r(m.walBytes),unit:`folded into every snapshot`}),W(R,{legend:`Captured bodies`,value:r(m.bodiesBytes),unit:`never in a snapshot`}),W(R,{legend:`Snapshots`,value:r(m.snapshots.totalBytes),unit:`${m.snapshots.count} kept`}),W(R,{legend:`Free disk`,value:r(m.freeDiskBytes),unit:m.freeDiskBytes===null?`not readable here`:`on this filesystem`})]})}),W(C,{legend:`Tables`,meta:h?`row counts are the planner's estimates; dead rows await autovacuum`:`size includes each table's indexes`,children:m===void 0?W(w,{rows:4}):G(L,{children:[W(`thead`,{children:G(P,{children:[W(I,{children:`Table`}),W(I,{$align:`right`,children:`Size`}),W(I,{$align:`right`,children:`Rows`}),h?W(I,{$align:`right`,children:`Dead rows`}):null]})}),W(`tbody`,{children:m.tables.map(e=>G(P,{children:[W(F,{children:e.name}),W(F,{$align:`right`,children:r(e.bytes)}),W(F,{$align:`right`,children:l(e.rows)}),h?W(F,{$align:`right`,children:l(e.deadRows??0)}):null]},e.name))})]})}),h?null:G(U,{children:[W(ce,{}),W(ae,{retention:m?.retention})]}),W(O,{open:f,onOpenChange:p,title:`Clear every captured body?`,body:`Every stored prompt and completion is deleted. The requests themselves stay in the log, with their bodies marked pruned. There is no undo: bodies are never in a snapshot.`,confirmLabel:`Clear captured bodies`,busy:d.isPending,onConfirm:()=>d.mutate(void 0,{onSettled:()=>p(!1)})}),W(O,{open:o,onOpenChange:s,title:`Compact database`,body:`Running VACUUM rewrites the database to give back its free pages. It holds the write lock for as long as it takes, so requests in flight will wait, and it needs room on disk for a second copy while it runs.`,confirmLabel:`Compact database`,busy:n.isPending,onConfirm:()=>n.mutate(void 0,{onSettled:()=>s(!1)})})]})}var fe=de;export{fe as component};
@@ -0,0 +1,67 @@
1
+ import{A as e,Ct as t,F as n,I as r,Jt as i,L as a,Ot as o,P as s,c,f as l,h as u,i as d,j as f,kt as p,mt as m,n as h,o as g,p as _,pt as v,rn as y,s as b,t as x,tn as S,u as C,v as ee,x as te,z as w}from"./Lamp-Dk9XrTCg.js";import{C as ne,E as T,S as E,T as D,a as O,b as k,k as A,o as re,r as j,v as M,w as N,y as P}from"./Panel-CsovmtxF.js";import{D as F,S as I,t as ie,w as L}from"./Rack-CDUOJkS2.js";import{n as R,t as ae}from"./TokenBreakdown-BC6nqo1v.js";import{n as oe,t as z}from"./Chip-D0XSbQUr.js";import{t as B}from"./Meter-stpt3vQu.js";import{i as V,n as H,r as U,t as W}from"./Table-CVDZ69Zx.js";import{t as G}from"./Readout-DlT5oxGO.js";import{useMemo as K}from"react";import{Fragment as q,jsx as J,jsxs as Y}from"react/jsx-runtime";import X from"styled-components";var se=X(T)`
2
+ font-weight: 500;
3
+ display: block;
4
+ max-width: 24ch;
5
+ `,Z=X.span`
6
+ font-size: 11px;
7
+ color: ${({theme:e})=>e.color.inkDim};
8
+ `,ce=X.div`
9
+ display: grid;
10
+ grid-template-columns: 72px 1fr;
11
+ align-items: center;
12
+ gap: 6px;
13
+ min-width: 172px;
14
+ `,le=X.div`
15
+ display: flex;
16
+ flex-direction: column;
17
+ gap: 4px;
18
+ `;function ue(e){let t=null;for(let n of e)n.stale||n.survives!==!1||n.exhaustsAt===null||(t===null||n.exhaustsAt<t)&&(t=n.exhaustsAt);return t}function de(e,t){return e===null?t===null?0:1:t===null?-1:e-t}function fe({credentials:e,health:t,quota:n,burn:i,usage:a,lastUsed:o,quotaPollIntervalMs:s,now:l}){let d=c(t,e=>e.credentialId),p=c(n,e=>e.credentialId),m=c(i,e=>e.credentialId),_=new Map(a.map(e=>[e.key,e])),v={down:0,warn:1,ok:2,idle:3,live:3},S=e.map(e=>{let t=m.get(e.id)??[];return{credential:e,status:b(d.get(e.id)??[],l,e.enabled,e.disabledReason),quota:ee(p.get(e.id)??[]),burn:t,exhaustsAt:ue(t),usage:_.get(e.id)}}).sort((e,t)=>v[e.status.state]-v[t.status.state]||de(e.exhaustsAt,t.exhaustsAt)||e.credential.tier-t.credential.tier);return J(j,{legend:`Accounts`,meta:`${e.length} connected`,flush:!0,actions:J(A,{as:y,to:`/accounts`,$size:`sm`,children:`Manage accounts`}),children:e.length===0?J(O,{legend:`No accounts`,message:`The gateway has no provider credentials, so every request will fail. Connect one to start routing.`,action:J(A,{as:y,to:`/accounts`,$variant:`primary`,$size:`sm`,children:`Connect an account`})}):J(ne,{children:Y(W,{children:[J(`thead`,{children:Y(`tr`,{children:[J(U,{children:`Account`}),J(U,{children:`Provider`}),J(U,{$align:`right`,children:`Tier`}),J(U,{children:`Quota`}),J(U,{$align:`right`,children:`Requests`}),J(U,{$align:`right`,children:`Last used`})]})}),J(`tbody`,{children:S.map(({credential:e,status:t,quota:n,burn:i,usage:a})=>Y(V,{children:[J(H,{children:Y(E,{$gap:2,children:[J(x,{state:t.state,label:t.note===``?`healthy`:t.note}),Y(`div`,{children:[J(se,{children:e.label}),t.note===``?null:J(Z,{children:t.note})]})]})}),J(H,{children:J(oe,{provider:e.provider})}),J(H,{$align:`right`,$mono:!0,children:e.tier}),J(H,{children:n.length===0?J(Z,{children:`unknown`}):J(le,{children:n.map(({window:e,fraction:t})=>Y(ce,{children:[J(B,{fraction:t,label:`${h[e.windowType]} window, ${Math.round(t*100)}% used`}),J(P,{children:u(e,l,s,r,g(i,e.windowType))})]},e.windowType))})}),J(H,{$align:`right`,$mono:!0,children:a===void 0?`—`:f(a.requests)}),J(H,{$align:`right`,$mono:!0,children:r(o[e.id]??null,l)})]},e.id))})]})})})}var pe=X.ul`
19
+ display: flex;
20
+ flex-direction: column;
21
+ `,me=X.li`
22
+ display: flex;
23
+ align-items: center;
24
+ gap: ${({theme:e})=>e.space(2)};
25
+ padding: 6px ${({theme:e})=>e.space(3)};
26
+ border-bottom: 1px solid ${({theme:e})=>e.color.rule};
27
+
28
+ &:last-child {
29
+ border-bottom: 0;
30
+ }
31
+ `,he=X(T)`
32
+ font-family: ${({theme:e})=>e.font.mono};
33
+ font-size: 12px;
34
+ max-width: 30ch;
35
+ `,ge=X(T)`
36
+ font-family: ${({theme:e})=>e.font.mono};
37
+ font-size: 11px;
38
+ color: ${({theme:e})=>e.color.inkFaint};
39
+ max-width: 16ch;
40
+ `,_e=X(k)`
41
+ color: ${({theme:e})=>e.color.down};
42
+ font-size: 11px;
43
+ `;function ve({logs:t,keyNames:n}){let r=t.slice(0,12);return J(j,{legend:`Activity`,meta:`most recent first`,flush:!0,actions:J(A,{as:y,to:`/logs`,$size:`sm`,children:`Open logs`}),children:r.length===0?J(O,{legend:`No traffic yet`,message:`Point a client at this gateway with an API key and the requests will appear here.`}):J(pe,{children:r.map(t=>Y(me,{children:[J(x,{state:_(t),label:l(t)}),J(k,{$dim:!0,children:e(t.at)}),J(he,{title:t.requestedModel,children:t.requestedModel||`—`}),t.resolvedProvider===null?null:J(k,{$dim:!0,style:{color:L(t.resolvedProvider)},children:t.resolvedProvider}),t.apiKeyId===null?null:J(ge,{title:t.apiKeyId,children:n.get(t.apiKeyId)??w(t.apiKeyId)}),J(N,{}),C(t)?J(k,{$dim:!0,"aria-label":`processing`,children:J(ae,{})}):Y(q,{children:[t.errorCode===null?null:J(_e,{children:t.errorCode}),t.attempts>1?Y(k,{$dim:!0,children:[t.attempts,`×`]}):null,J(k,{$dim:!0,children:J(R,{tokens:t})}),J(k,{$dim:!0,children:s(t.durationMs)}),J(k,{$dim:!0,children:a(t.costUsd)})]})]},t.id))})})}var ye=X.ul`
44
+ display: flex;
45
+ flex-direction: column;
46
+ gap: ${({theme:e})=>e.space(3)};
47
+ `,be=X(T)`
48
+ font-family: ${({theme:e})=>e.font.mono};
49
+ font-size: 12.5px;
50
+ `,xe=X.div`
51
+ display: flex;
52
+ height: 5px;
53
+ border-radius: 2px;
54
+ overflow: hidden;
55
+ background: ${({theme:e})=>e.color.panelSunk};
56
+ border: 1px solid ${({theme:e})=>e.color.rule};
57
+ `,Q=X.div`
58
+ flex: ${({$grow:e})=>e} 0 0;
59
+ background: ${({$color:e})=>e};
60
+ opacity: 0.8;
61
+ `,Se=X.div`
62
+ flex: ${({$grow:e})=>e} 0 0;
63
+ `;function Ce({models:e,logs:t}){let n=new Map;for(let e of t){let t=n.get(e.requestedModel)??{requests:0,costUsd:0};t.requests+=1,t.costUsd+=e.costUsd,n.set(e.requestedModel,t)}let r=Math.max(1,...[...n.values()].map(e=>e.requests)),i=[...e].map(e=>({model:e,used:n.get(e.id)})).sort((e,t)=>(t.used?.requests??0)-(e.used?.requests??0)).slice(0,8);return J(j,{legend:`Models`,meta:`${e.length} configured`,actions:J(A,{as:y,to:`/models`,$size:`sm`,children:`Edit routing`}),children:e.length===0?J(O,{legend:`No models`,message:`Nothing is routable yet. Create a virtual model and point it at one or more provider targets.`,action:J(A,{as:y,to:`/models`,$variant:`primary`,$size:`sm`,children:`Create a model`})}):J(ye,{children:i.map(({model:e,used:t})=>{let n=(t?.requests??0)/r,i=[...new Set(e.targets.map(e=>e.provider))];return Y(`li`,{children:[Y(E,{$gap:2,children:[J(be,{title:e.id,children:e.id}),e.isAlias?J(z,{children:`alias`}):null,J(z,{$tone:`accent`,children:e.strategy}),J(N,{}),J(k,{$dim:!0,children:f(t?.requests??0)}),J(P,{children:`req`}),J(k,{$dim:!0,children:a(t?.costUsd??0)})]}),Y(xe,{style:{marginTop:6},title:`${Math.round(n*100)}% of the busiest model`,children:[i.map(e=>J(Q,{$color:L(e),$grow:n/i.length},e)),J(Se,{$grow:Math.max(0,1-n)})]})]},e.id)})})})}var we=X.div`
64
+ display: grid;
65
+ grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
66
+ gap: ${({theme:e})=>e.space(3)};
67
+ `;function Te({logs:e,windowMs:t,now:r}){let i=e.filter(e=>r-e.at<=t),o=te(i,t),c=d(i,{now:r,spanMs:t,count:32}),l=o.errorRate>=.25?`down`:o.errorRate>=.05?`warn`:`ok`,u=o.inputTokens+o.outputTokens+o.cacheReadTokens+o.cacheWriteTokens;return Y(we,{children:[J(G,{legend:`Requests`,value:f(o.requests),unit:`${o.ratePerMin.toFixed(1)}/min`,trace:J(I,{values:c.map(e=>e.total),overlay:c.map(e=>e.errors),label:`${o.requests} requests, ${o.errors} of them failed`})}),J(G,{legend:`Error rate`,value:n(o.errorRate),unit:`${f(o.errors)} failed`,tone:o.requests===0?`ink`:l,trace:J(I,{values:c.map(e=>e.errors),scaleTo:Math.max(...c.map(e=>e.total)),color:`var(--down)`,label:`${o.errors} failed requests against ${o.requests} total`})}),J(G,{legend:`Total tokens`,value:f(u),unit:J(R,{tokens:o}),trace:J(I,{values:c.map(e=>e.tokens),label:`token volume over the window, ${u.toLocaleString(`en-US`)} total`})}),J(G,{legend:`Time to first token`,value:s(o.ttftP50),unit:`p95 ${s(o.ttftP95)}`,trace:J(I,{values:c.map(e=>e.ttftMs??0),color:`var(--ok)`,label:`median first-token latency, currently ${s(o.ttftP50)}`})}),J(G,{legend:`Spend`,value:a(o.costUsd),unit:`${f(o.inputTokens+o.outputTokens)} tokens`,trace:J(I,{values:c.map(e=>e.costUsd),color:`var(--warn)`,label:`spend over the window, ${a(o.costUsd)} total`})})]})}var $=36e5;function Ee(){let{cadence:e}=F(),n=m(),r=v(e(1e4,`res:credentials`)),a=p(),s=o(500,e(1e4,`res:logs`)),l=t(),u=i(),d=K(()=>{let e=new Map;for(let t of l.data??[])e.set(t.id,t.label);return e},[l.data]),f=Date.now(),h=Math.floor((f-$)/6e4)*6e4,g=S({groupBy:`credential`,since:h},e(6e4,`res:usage`)),_=n.data??[],y=c(r.data?.health??[],e=>e.credentialId),x=_.filter(e=>b(y.get(e.id)??[],f,e.enabled,e.disabledReason).state===`down`),C=n.isLoading||s.isLoading?`Reading the gateway…`:_.length===0?`No accounts are connected, so every request fails at the router.`:x.length>0?`${x.length} account${x.length===1?` is`:`s are`} out of rotation.`:`All ${_.length} accounts are answering. Nothing needs attention.`;return Y(q,{children:[J(ie,{legend:`Rack`,title:`Gateway`,summary:C}),s.isError?J(j,{legend:`Traffic`,children:J(re,{legend:`The gateway did not answer`,error:s.error,onRetry:()=>void s.refetch()})}):Y(D,{$gap:4,children:[J(Te,{logs:s.data??[],windowMs:$,now:f}),J(fe,{credentials:_,health:r.data?.health??[],quota:r.data?.quota??[],burn:r.data?.burn??[],usage:g.data??[],lastUsed:r.data?.lastUsed??{},quotaPollIntervalMs:u.data?.quotaPollIntervalMs??3e5,now:f}),Y(M,{$min:`340px`,$gap:4,children:[J(Ce,{models:a.data??[],logs:s.data??[]}),J(ve,{logs:s.data??[],keyNames:d})]})]})]})}var De=Ee;export{De as component};