omnigateway 0.13.7 → 0.14.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnigateway",
3
- "version": "0.13.7",
3
+ "version": "0.14.1",
4
4
  "description": "Self-hosted AI gateway with Anthropic- and OpenAI-compatible APIs, an admin console, and a CLI",
5
5
  "license": "MIT",
6
6
  "author": "Harismawan <mail@harismawan.com>",
@@ -24,21 +24,20 @@ import{y as e}from"./Panel-CsovmtxF.js";import{useId as t}from"react";import{jsx
24
24
  &:disabled {
25
25
  opacity: 0.5;
26
26
  }
27
- `;i.textarea`
28
- ${a}
29
- min-height: 72px;
30
- padding: 6px 8px;
31
- background: ${({theme:e})=>e.color.panelSunk};
32
- border: 1px solid ${({theme:e})=>e.color.ruleStrong};
33
- color: ${({theme:e})=>e.color.ink};
34
- font-family: ${({theme:e})=>e.font.mono};
35
- font-size: 12px;
36
- resize: vertical;
37
- `;var s=i.select`
27
+ `,s=i.select`
38
28
  ${a}
29
+ appearance: none;
39
30
  height: 30px;
40
- padding: 0 6px;
41
- background: ${({theme:e})=>e.color.panelSunk};
31
+ padding: 0 26px 0 8px;
32
+ background-color: ${({theme:e})=>e.color.panelSunk};
33
+ background-image:
34
+ linear-gradient(45deg, transparent 50%, ${({theme:e})=>e.color.inkDim} 50%),
35
+ linear-gradient(135deg, ${({theme:e})=>e.color.inkDim} 50%, transparent 50%);
36
+ background-position:
37
+ calc(100% - 15px) 50%,
38
+ calc(100% - 10px) 50%;
39
+ background-size: 5px 5px;
40
+ background-repeat: no-repeat;
42
41
  border: 1px solid ${({theme:e})=>e.color.ruleStrong};
43
42
  color: ${({theme:e})=>e.color.ink};
44
43
  font-family: ${({theme:e})=>e.font.mono};
@@ -1,4 +1,4 @@
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)`
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-D9V9N-vb.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
2
  display: flex;
3
3
  align-items: center;
4
4
  gap: ${({theme:e})=>e.space(2)};
@@ -1,4 +1,4 @@
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 ne,n as y,o as b,pt as x,s as re,st as ie,t as S,ut as ae,v as oe,y as C}from"./Lamp-Dk9XrTCg.js";import{A as w,C as T,S as E,T as D,a as se,b as O,c as k,k as A,o as j,r as M,s as N,y as P}from"./Panel-CsovmtxF.js";import{A as F,D as I,i as ce,r as L,t as R,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 Se,t as Ce}from"./WindowChart-Bqbl-KFO.js";import{Fragment as we,useCallback as G,useEffect as K,useState as q}from"react";import{Fragment as Te,jsx as J,jsxs as Y}from"react/jsx-runtime";import X from"styled-components";var Ee={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`}]]};Ee.node;var De=F(Ee),Z={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};Z.node;var Oe=F(Z),Q={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`}]]};Q.node;var ke=F(Q);function Ae(e){return e?.authTypes??[]}function je(e){return Ae(e).includes(`oauth`)?`oauth`:`apiKey`}function Me(e){return e[0]?.id??`anthropic`}var $={oauth:`Authorize in the browser`,apiKey:`Paste an API key`};function Ne(e){let t=e?.callback;return t===void 0?`code#state`:`${t.uri}?code=…`}var Pe=X.ol`
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 ne,n as y,o as b,pt as x,s as re,st as ie,t as S,ut as ae,v as oe,y as C}from"./Lamp-Dk9XrTCg.js";import{A as w,C as T,S as E,T as D,a as se,b as O,c as k,k as A,o as j,r as M,s as N,y as P}from"./Panel-CsovmtxF.js";import{A as F,D as I,i as ce,r as L,t as R,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-D9V9N-vb.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 Se,t as Ce}from"./WindowChart-Bqbl-KFO.js";import{Fragment as we,useCallback as G,useEffect as K,useState as q}from"react";import{Fragment as Te,jsx as J,jsxs as Y}from"react/jsx-runtime";import X from"styled-components";var Ee={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`}]]};Ee.node;var De=F(Ee),Z={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};Z.node;var Oe=F(Z),Q={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`}]]};Q.node;var ke=F(Q);function Ae(e){return e?.authTypes??[]}function je(e){return Ae(e).includes(`oauth`)?`oauth`:`apiKey`}function Me(e){return e[0]?.id??`anthropic`}var $={oauth:`Authorize in the browser`,apiKey:`Paste an API key`};function Ne(e){let t=e?.callback;return t===void 0?`code#state`:`${t.uri}?code=…`}var Pe=X.ol`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: ${({theme:e})=>e.space(3)};
@@ -1,4 +1,4 @@
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-BYDVTknB.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)`
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-Rh35FNqC.js";import{i as g}from"./Field-D9V9N-vb.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
2
  gap: ${({theme:e})=>e.space(2)};
3
3
  flex-wrap: wrap;
4
4
  `,k=C(g)`
@@ -1,4 +1,4 @@
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`
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-D9V9N-vb.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
2
  font-size: 12px;
3
3
  color: ${({theme:e})=>e.color.down};
4
4
  `,ne=K.p`
@@ -0,0 +1,107 @@
1
+ import{Bt as e,Ct as t,Gt as n,Kt as r,M as i,Wt as a,dt as o,kt as s,w as c}from"./Lamp-Dk9XrTCg.js";import{A as l,E as u,S as d,T as f,a as p,b as m,c as h,k as g,n as _,o as v,s as y,t as b,y as x}from"./Panel-CsovmtxF.js";import{A as S,O as C,i as w,r as T,t as E}from"./Rack-CDUOJkS2.js";import{t as D}from"./CopyValue-DAlmkISB.js";import{t as ee}from"./chevron-down-Bb5ZGvwk.js";import{t as O}from"./chevron-right-hwF5mD6-.js";import{t as k}from"./plus-BgcHxxIr.js";import{t as A}from"./Toggle-CdMD58sy.js";import{t as j}from"./Chip-D0XSbQUr.js";import{n as M,r as N,t as P}from"./Field-D9V9N-vb.js";import{t as F}from"./Meter-stpt3vQu.js";import{i as I,n as L,r as R,t as te}from"./Table-CVDZ69Zx.js";import{a as z,c as ne,d as re,f as ie,i as B,l as ae,n as oe,o as V,r as H,s as U,t as se,u as ce}from"./limits-iRyDMg04.js";import{Fragment as W,useId as le,useState as G}from"react";import{Fragment as K,jsx as q,jsxs as J}from"react/jsx-runtime";import Y from"styled-components";var X={name:`calendar-clock`,size:24,node:[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338`,key:`7hb8p4`}],[`path`,{d:`M3 9h5.859`,key:`numkqi`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]};X.node;var ue=S(X),Z={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};Z.node;var de=S(Z);function Q(e,t){return e.revokedAt===null?c(e,t)?`active`:`expired`:`revoked`}function fe(e){if(e===null)return``;let t=new Date(e-new Date(e).getTimezoneOffset()*6e4);return Number.isNaN(t.getTime())?``:t.toISOString().slice(0,16)}function pe(e){let t=e.trim();if(t.length===0)return{at:null};let n=new Date(t).getTime();return Number.isFinite(n)?{at:n}:{problem:`"${e}" is not a date`}}var me=Y.p`
2
+ font-size: 12px;
3
+ color: ${({theme:e})=>e.color.down};
4
+ `,he=Y.p`
5
+ font-size: 12px;
6
+ color: ${({theme:e})=>e.color.warn};
7
+ `;function ge({apiKey:e,onOpenChange:t}){let n=a(),[r,i]=G(()=>fe(e?.expiresAt??null)),[o,s]=G(null),c=()=>{if(e===null)return;let i=pe(r);if(`problem`in i){s(i.problem);return}s(null),n.mutate({id:e.id,expiresAt:i.at},{onSuccess:()=>t(!1),onError:e=>s(h(e))})},l=e!==null&&Q(e,Date.now())===`expired`;return q(w,{open:e!==null,onOpenChange:t,title:`Edit expiry`,description:e===null?void 0:`When "${e.label}" stops being accepted. Leave it blank for never.`,width:`480px`,footer:J(K,{children:[q(g,{type:`button`,onClick:()=>t(!1),children:`Cancel`}),q(g,{type:`button`,$variant:`primary`,disabled:n.isPending,onClick:c,children:n.isPending?`Saving…`:`Save expiry`})]}),children:J(f,{$gap:3,children:[l?q(he,{role:`status`,children:`This key has expired and the gateway is refusing it. Moving the date forward, or clearing it, brings it back.`}):null,q(P,{label:`Expires`,hint:`Your local time. Blank means the key never expires; a date already past expires it now.`,children:e=>q(M,{...e,type:`datetime-local`,value:r,disabled:n.isPending,onChange:e=>i(e.target.value)})}),o===null?null:q(me,{role:`alert`,children:o})]})})}var _e=Y.div`
8
+ display: grid;
9
+ grid-template-columns: repeat(3, minmax(0, 1fr));
10
+ gap: ${({theme:e})=>e.space(2)};
11
+ `,ve=Y.p`
12
+ font-size: 11px;
13
+ color: ${({theme:e})=>e.color.inkDim};
14
+ `;function $({draft:e,onChange:t,disabled:n=!1}){return J(f,{$gap:2,children:[q(_e,{children:se.map(r=>{let i=ie(r);return q(P,{label:H(r),children:a=>q(N,{...a,min:r.dimension===`spend`?void 0:1,step:r.dimension===`spend`?`any`:1,disabled:n,value:e[i]??``,placeholder:`none`,onChange:n=>t({...e,[i]:n.target.value})})},i)})}),q(ve,{children:`Blank means no limit. Token and spend ceilings are debited after a response completes, so a key at its ceiling is refused on its next request rather than its current one. Concurrency counts requests in flight right now and resets when the gateway restarts.`})]})}var ye=Y.p`
15
+ font-size: 12px;
16
+ color: ${({theme:e})=>e.color.down};
17
+ `,be=Y.p`
18
+ font-size: 12px;
19
+ color: ${({theme:e})=>e.color.warn};
20
+ `,xe=Y.h3`
21
+ font-size: 12px;
22
+ font-weight: 600;
23
+ color: ${({theme:e})=>e.color.ink};
24
+ `,Se=Y(f)`
25
+ padding-top: ${({theme:e})=>e.space(2)};
26
+ border-top: 1px solid ${({theme:e})=>e.color.rule};
27
+ `,Ce=Y.p`
28
+ font-size: 11px;
29
+ color: ${({theme:e})=>e.color.inkDim};
30
+ `;function we({apiKey:e,onOpenChange:t}){let r=n(),i=s(),[a,o]=G(()=>B(e?.limits??{})),[c,l]=G(()=>ce(e?.limits??{})),[u,p]=G(0),[m,_]=G(null),v=le(),y=(i.data??[]).map(e=>e.id),b=(e,t)=>{l(n=>n.map(n=>n.id===e?{...n,...t}:n))};return q(w,{open:e!==null,onOpenChange:t,title:`Edit limits`,description:e===null?void 0:`What "${e.label}" may do per minute, per five hours, and per week. Every field is a ceiling; blank is no limit.`,width:`640px`,footer:J(K,{children:[q(g,{type:`button`,onClick:()=>t(!1),children:`Cancel`}),q(g,{type:`button`,$variant:`primary`,disabled:r.isPending,onClick:()=>{if(e===null)return;let n=z(a);if(`problem`in n){_(n.problem);return}let i=re(c);if(`problem`in i){_(i.problem);return}let o=Object.keys(i.models).length===0?n.limits:{...n.limits,models:i.models};_(null),r.mutate({id:e.id,limits:o},{onSuccess:()=>t(!1),onError:e=>_(h(e))})},children:r.isPending?`Saving…`:`Save limits`})]}),children:J(f,{$gap:3,children:[e?.limits===null?q(be,{role:`status`,children:`The stored limits for this key cannot be read, so the gateway refuses it. Saving here replaces them.`}):null,q($,{draft:a,onChange:o,disabled:r.isPending}),J(f,{$gap:2,children:[q(xe,{children:`Per-model overrides`}),q(x,{children:`A stricter ceiling for one model, matched exactly against the model a request names. It stacks with the limits above: a request for that model must pass both.`}),c.map(t=>{let n=t.model,i=n.trim().length===0?`a new model`:n,a=n.trim().length>0&&e?.modelAllowlist!==null&&e?.modelAllowlist!==void 0&&!e.modelAllowlist.includes(n);return J(Se,{$gap:2,role:`group`,"aria-label":`Override for ${i}`,children:[J(d,{$gap:2,$align:`flex-end`,children:[q(P,{label:`Model`,children:e=>q(M,{...e,list:v,disabled:r.isPending,value:t.model,placeholder:`model name`,onChange:e=>b(t.id,{model:e.target.value})})}),q(g,{type:`button`,$variant:`ghost`,disabled:r.isPending,"aria-label":`Remove override for ${i}`,onClick:()=>l(e=>e.filter(e=>e.id!==t.id)),children:`Remove`})]}),a?J(Ce,{children:[n,` is not in this key's allowed models, so this override applies to no request until it is.`]}):null,q($,{draft:t.slots,onChange:e=>b(t.id,{slots:e}),disabled:r.isPending})]},t.id)}),q(`div`,{children:q(g,{type:`button`,disabled:r.isPending,onClick:()=>{l(e=>[...e,{id:`added-${u}`,model:``,stored:null,slots:B({})}]),p(e=>e+1)},children:`Add model override`})}),q(`datalist`,{id:v,children:y.map(e=>q(`option`,{value:e},e))})]}),m===null?null:q(ye,{role:`alert`,children:m})]})})}var Te=Y.div`
31
+ display: flex;
32
+ flex-direction: column;
33
+ gap: 2px;
34
+ max-height: 190px;
35
+ overflow-y: auto;
36
+ padding: ${({theme:e})=>e.space(1)};
37
+ border: 1px solid ${({theme:e})=>e.color.ruleStrong};
38
+ border-radius: ${({theme:e})=>e.radius.control};
39
+ background: ${({theme:e})=>e.color.panelSunk};
40
+ `,Ee=Y.label`
41
+ display: flex;
42
+ align-items: center;
43
+ gap: ${({theme:e})=>e.space(2)};
44
+ padding: 4px 6px;
45
+ border-radius: 2px;
46
+ cursor: pointer;
47
+ font-family: ${({theme:e})=>e.font.mono};
48
+ font-size: 12px;
49
+
50
+ &:hover {
51
+ background: ${({theme:e})=>e.color.panelRaised};
52
+ }
53
+ `,De=Y.p`
54
+ font-size: 11px;
55
+ color: ${({theme:e})=>e.color.inkDim};
56
+ `;function Oe({configured:e,checked:t,onChange:n,disabled:r}){let i=[...new Set([...e,...t])].sort(),a=(e,r)=>{n(r?[...t,e]:t.filter(t=>t!==e))},o=t.filter(t=>!e.includes(t));return J(`div`,{children:[q(Te,{children:i.map(e=>J(Ee,{children:[q(`input`,{type:`checkbox`,disabled:r,"aria-label":e,checked:t.includes(e),onChange:t=>a(e,t.target.checked)}),e]},e))}),o.length>0?q(De,{children:`Some listed models are no longer configured. They stay until you clear them.`}):null,t.length===0?q(x,{children:`With nothing selected this key is allowed no model.`}):null]})}var ke=Y.p`
57
+ font-size: 12px;
58
+ color: ${({theme:e})=>e.color.down};
59
+ `;function Ae({apiKey:e,onOpenChange:t}){let n=r(),i=s(),[a,o]=G(e?.modelAllowlist===null),[c,l]=G(()=>e?.modelAllowlist===null?[]:e?.modelAllowlist??[]),[u,p]=G(null),m=(i.data??[]).map(e=>e.id);return q(w,{open:e!==null,onOpenChange:t,title:`Edit models`,description:e===null?void 0:`Which models "${e.label}" may ask the gateway for. Sent whole on save.`,width:`640px`,footer:J(K,{children:[q(g,{type:`button`,onClick:()=>t(!1),children:`Cancel`}),q(g,{type:`button`,$variant:`primary`,disabled:n.isPending,onClick:()=>{e!==null&&(p(null),n.mutate({id:e.id,modelAllowlist:a?null:c},{onSuccess:()=>t(!1),onError:e=>p(h(e))}))},children:n.isPending?`Saving…`:`Save models`})]}),children:J(f,{$gap:3,children:[J(f,{$gap:2,children:[J(d,{$gap:2,children:[q(A,{checked:a,label:`Allow every model`,onCheckedChange:e=>{o(e),e&&l([])}}),q(x,{as:`span`,children:`Allow every model`})]}),a?null:q(Oe,{configured:m,checked:c,onChange:l,disabled:n.isPending})]}),u===null?null:q(ke,{role:`alert`,children:u})]})})}var je=Y.div`
60
+ display: grid;
61
+ grid-template-columns: minmax(0, 11rem) minmax(0, 12rem) minmax(0, 1fr) minmax(0, 3.5rem);
62
+ align-items: center;
63
+ gap: ${({theme:e})=>e.space(2)} ${({theme:e})=>e.space(4)};
64
+ `,Me=Y.span`
65
+ font-size: 11.5px;
66
+ color: ${({theme:e})=>e.color.inkDim};
67
+ `,Ne=Y.h4`
68
+ font-family: ${({theme:e})=>e.font.mono};
69
+ font-size: 12px;
70
+ font-weight: 600;
71
+ color: ${({theme:e})=>e.color.ink};
72
+ `,Pe=Y.p`
73
+ font-size: 11px;
74
+ color: ${({theme:e})=>e.color.inkDim};
75
+ `;function Fe({label:e,readings:t}){let n=ne(t),r=n.some(e=>e.model!==null);return J(f,{$gap:3,children:[n.map(t=>{let n=t.model??`Every model`,i=q(Ie,{label:e,model:t.model,readings:t.readings},n);return r?J(f,{$gap:2,role:`group`,"aria-label":n,children:[q(Ne,{children:n}),i]},n):i}),q(Pe,{children:`Usage counts completed requests still inside each window. Requests in flight are added by the gateway itself and are not shown here. A model's override stacks with the key-wide limits: a request for it must pass both.`})]})}function Ie({label:e,model:t,readings:n}){let r=t===null?e:`${e}, ${t}`;return q(je,{children:n.map(e=>{let t=H({dimension:e.dimension,window:e.window}),n=U(e),i=V(e.dimension,e.limit);return J(W,{children:[q(x,{as:`span`,children:t}),q(m,{children:e.used===null?i:`${V(e.dimension,e.used)} of ${i}`}),n===null?q(Me,{children:`in flight now, counted in the gateway process`}):q(F,{fraction:Math.min(1,n),label:`${r}, ${t}, ${Math.round(n*100)}% used`}),q(m,{children:n===null?`—`:`${Math.round(n*100)}%`})]},t)})})}var Le=Y.p`
76
+ font-size: 12px;
77
+ color: ${({theme:e})=>e.color.warn};
78
+ `,Re=Y.p`
79
+ font-size: 11px;
80
+ color: ${({theme:e})=>e.color.inkDim};
81
+ `,ze=Y.p`
82
+ font-size: 12px;
83
+ color: ${({theme:e})=>e.color.down};
84
+ `,Be=Y.p`
85
+ font-size: 12px;
86
+ color: ${({theme:e})=>e.color.inkDim};
87
+ `,Ve=Y(g)`
88
+ gap: 4px;
89
+ `;function He({open:e,onOpenChange:t}){let n=s(),r=o(),[i,a]=G(``),[c,l]=G(!0),[u,p]=G([]),[_,v]=G(()=>B({})),[y,b]=G(!1),[S,C]=G(``),[T,E]=G(!1),[k,j]=G(null),[N,F]=G(null),I=()=>{a(``),l(!0),p([]),v(B({})),b(!1),C(``),E(!1),j(null),F(null),r.reset()},L=e=>{e||I(),t(e)},R=Object.values(_).filter(e=>e.trim().length>0).length;return q(w,{open:e,onOpenChange:L,title:k===null?`Create an API key`:`Key created`,description:k===null?`Clients send this key as a bearer token or as x-api-key on every /v1 request.`:void 0,footer:k===null?J(K,{children:[q(g,{type:`button`,onClick:()=>L(!1),children:`Cancel`}),q(g,{type:`button`,$variant:`primary`,disabled:r.isPending,onClick:()=>{let e=z(_);if(`problem`in e){b(!0),F(e.problem);return}let t=pe(S);if(`problem`in t){F(t.problem);return}F(null),r.mutate({label:i.trim().length===0?`api key`:i.trim(),modelAllowlist:c?null:u,limits:e.limits,bodyLoggingOptOut:T,expiresAt:t.at},{onSuccess:e=>j(e),onError:e=>F(h(e))})},children:r.isPending?`Creating…`:`Create key`})]}):q(g,{type:`button`,$variant:`primary`,onClick:()=>L(!1),children:`I have copied the key`}),children:k===null?J(f,{$gap:3,children:[q(P,{label:`Label`,hint:`Names the client this key belongs to, e.g. laptop or CI.`,children:e=>q(M,{...e,value:i,placeholder:`api key`,onChange:e=>a(e.target.value)})}),J(f,{$gap:2,children:[J(d,{$gap:2,children:[q(A,{checked:c,label:`Allow every model`,onCheckedChange:l}),q(x,{as:`span`,children:`Allow every model`})]}),c?null:J(K,{children:[q(Oe,{configured:(n.data??[]).map(e=>e.id),checked:u,onChange:p}),u.length===0?q(Le,{children:`With no model selected this key is allowed nothing and every request it makes will be refused.`}):null]})]}),J(f,{$gap:2,children:[J(d,{$gap:2,children:[J(Ve,{type:`button`,$size:`sm`,"aria-expanded":y,onClick:()=>b(e=>!e),children:[q(y?ee:O,{}),`Limits`]}),q(x,{as:`span`,children:R===0?`no limits; this key is unbounded`:`${R} limit${R===1?``:`s`} set`})]}),y?q($,{draft:_,onChange:v}):null]}),q(P,{label:`Expires`,hint:`Optional. Your local time; blank means the key never expires.`,children:e=>q(M,{...e,type:`datetime-local`,value:S,onChange:e=>C(e.target.value)})}),J(f,{$gap:2,children:[J(d,{$gap:2,children:[q(A,{checked:T,label:`Never record this key's bodies`,onCheckedChange:E}),q(x,{as:`span`,children:`Never record this key's bodies`})]}),q(Re,{children:`Suppresses body capture for this key whatever the gateway setting says. Choose it for a client whose payloads must not be retained. It cannot be changed after the key is created — issue a new key instead.`})]}),N===null?null:q(ze,{role:`alert`,children:N})]}):J(f,{$gap:3,children:[q(Be,{children:`This is the only time the key is shown. The gateway keeps a hash, so a lost key has to be replaced rather than recovered.`}),q(D,{value:k.key,label:`Copy API key`}),J(d,{$gap:2,children:[q(x,{children:`Label`}),q(m,{children:k.label}),q(x,{children:`Prefix`}),q(m,{children:k.prefix})]})]})})}var Ue=Y(d)`
90
+ gap: 4px;
91
+ flex-wrap: wrap;
92
+ max-width: 34ch;
93
+ `,We=Y.span`
94
+ color: ${({theme:e})=>e.color.inkFaint};
95
+ `,Ge=Y.span`
96
+ display: block;
97
+ font-size: 11px;
98
+ color: ${({theme:e})=>e.color.inkDim};
99
+ `,Ke=Y.span`
100
+ font-size: 11px;
101
+ color: ${({theme:e})=>e.color.inkDim};
102
+ `,qe=Y.div`
103
+ display: flex;
104
+ flex-direction: column;
105
+ align-items: flex-end;
106
+ gap: 2px;
107
+ `;function Je(e){if(e===null)return`usage not counted here`;let t=U(e);return`${oe(e)} ${V(e.dimension,e.limit)}, ${t===null?`—`:Math.round(t*100)}% used`}function Ye(){let n=t(),r=e(),[a,o]=G(!1),[s,c]=G(null),[f,m]=G(null),[h,S]=G(null),[w,D]=G(null),[A,M]=G(null),N=Date.now(),P=n.data??[],F=P.filter(e=>Q(e,N)===`active`),z=n.isLoading?`Reading issued keys…`:P.length===0?`No keys exist, so nothing can call this gateway yet.`:`${F.length} active key${F.length===1?``:`s`} of ${P.length} ever issued.`;return J(K,{children:[q(E,{legend:`Keys`,title:`Gateway API keys`,summary:z,actions:J(g,{type:`button`,$variant:`primary`,onClick:()=>o(!0),children:[q(k,{}),`Create a key`]})}),q(b,{legend:`Issued keys`,meta:`${P.length}`,flush:!0,children:n.isError?q(v,{error:n.error,onRetry:()=>void n.refetch()}):n.isLoading?q(`div`,{style:{padding:12},children:q(y,{rows:4})}):P.length===0?q(p,{legend:`No keys`,message:`Create a key and give it to a client. The key is shown once, at creation.`,action:q(g,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>o(!0),children:`Create a key`})}):q(_,{children:J(te,{children:[q(`thead`,{children:J(`tr`,{children:[q(R,{children:`Label`}),q(R,{children:`Prefix`}),q(R,{children:`Allowed models`}),q(R,{$align:`right`,children:`Limits`}),q(R,{$align:`right`,children:`Created`}),q(R,{children:`Body capture`}),q(R,{children:`Status`}),q(R,{})]})}),q(`tbody`,{children:P.map(e=>{let t=w===e.id,n=ae(e.limitUsage),r=Q(e,N);return J(W,{children:[J(I,{children:[q(L,{children:q(u,{style:{maxWidth:`24ch`,display:`block`},children:e.label})}),J(L,{$mono:!0,children:[e.prefix,`…`]}),q(L,{children:e.modelAllowlist===null?q(x,{children:`every model`}):e.modelAllowlist.length===0?q(j,{$tone:`down`,children:`no models`}):q(Ue,{children:e.modelAllowlist.map(e=>q(j,{children:e},e))})}),q(L,{$align:`right`,children:e.limits===null?q(j,{$tone:`down`,children:`unreadable`}):e.limitUsage.length===0?q(x,{children:`no limits`}):J(qe,{children:[J(`span`,{children:[e.limitUsage.length,` limit`,e.limitUsage.length===1?``:`s`]}),q(Ke,{children:Je(n)})]})}),q(L,{$align:`right`,$mono:!0,children:i(e.createdAt)}),q(L,{children:e.bodyLoggingOptOut?q(j,{children:`no bodies`}):q(x,{children:`—`})}),J(L,{children:[r===`revoked`?q(We,{title:i(e.revokedAt??0),children:q(j,{children:`revoked`})}):r===`expired`?q(j,{$tone:`down`,children:`expired`}):q(j,{$tone:`ok`,children:`active`}),e.expiresAt===null?null:J(Ge,{children:[r===`expired`?`expired`:`expires`,` `,i(e.expiresAt)]})]}),q(L,{$align:`right`,children:J(d,{$gap:1,$justify:`flex-end`,children:[e.limitUsage.length===0?null:q(l,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} limits for ${e.label}`,title:`${t?`Hide`:`Show`} limits for ${e.label}`,onClick:()=>D(t?null:e.id),children:q(t?ee:O,{})}),e.revokedAt===null?J(K,{children:[q(l,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Edit models for ${e.label}`,title:`Edit models for ${e.label}`,onClick:()=>m(e),children:q(de,{})}),q(l,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Edit limits for ${e.label}`,title:`Edit limits for ${e.label}`,onClick:()=>c(e),children:q(C,{})}),q(l,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Edit expiry for ${e.label}`,title:`Edit expiry for ${e.label}`,onClick:()=>S(e),children:q(ue,{})}),q(g,{type:`button`,$variant:`danger`,$size:`sm`,onClick:()=>M(e),children:`Revoke`})]}):null]})})]}),t?q(I,{children:q(L,{colSpan:8,children:q(Fe,{label:e.label,readings:e.limitUsage})})}):null]},e.id)})})]})})}),q(He,{open:a,onOpenChange:o}),q(we,{apiKey:s,onOpenChange:e=>{e||c(null)}},s?.id??`none`),q(Ae,{apiKey:f,onOpenChange:e=>{e||m(null)}},f?.id??`none`),q(ge,{apiKey:h,onOpenChange:e=>{e||S(null)}},h?.id??`none`),q(T,{open:A!==null,onOpenChange:e=>{e||M(null)},title:`Revoke key`,body:A===null?``:`Revoking "${A.label}" refuses its next request. The key stays listed so past usage keeps its attribution, and it cannot be un-revoked.`,confirmLabel:`Revoke key`,busy:r.isPending,onConfirm:()=>{A!==null&&r.mutate(A.id,{onSettled:()=>M(null)})}})]})}var Xe=Ye;export{Xe as component};
@@ -1,4 +1,4 @@
1
- import{$t as e,Ct as t,It as n,K as r,Tt as i,V as a,W as o,Y as s,j as c,l as ee,mt as l,u}from"./Lamp-Dk9XrTCg.js";import{S as d,T as f,a as p,k as m,n as h,o as g,r as _,s as v,t as y,x as b,y as x}from"./Panel-CsovmtxF.js";import{D as S,i as te,t as C}from"./Rack-CDUOJkS2.js";import{a as w,i as T,n as E,r as D,t as O}from"./RequestTable-i3TtCB9m.js";import{t as k}from"./Chip-D0XSbQUr.js";import{i as A}from"./Field-DG1317zr.js";import{useMemo as j,useRef as M,useState as N}from"react";import{Fragment as P,jsx as F,jsxs as I}from"react/jsx-runtime";import L from"styled-components";var R={none:{legend:`Not captured`,message:`Body capture was not running for this request. It needs OMNI_BODY_LOGGING_ALLOWED in the environment and the body logging setting turned on, and the calling key must not have opted out.`},missing:{legend:`Captured, then lost`,message:`This request was captured, but its artifact is no longer on disk. Retention or the row cap has since pruned it, or something removed the file underneath the gateway.`},corrupt:{legend:`Captured, but unreadable`,message:`This request was captured and the artifact is still on disk, but it failed its checksum or would not decrypt. Changing OMNI_ENCRYPTION_KEY invalidates every artifact written under the old one.`}},z=new Intl.NumberFormat(`en-US`),B=L.p`
1
+ import{$t as e,Ct as t,It as n,K as r,Tt as i,V as a,W as o,Y as s,j as c,l as ee,mt as l,u}from"./Lamp-Dk9XrTCg.js";import{S as d,T as f,a as p,k as m,n as h,o as g,r as _,s as v,t as y,x as b,y as x}from"./Panel-CsovmtxF.js";import{D as S,i as te,t as C}from"./Rack-CDUOJkS2.js";import{a as w,i as T,n as E,r as D,t as O}from"./RequestTable-BF5-R27W.js";import{t as k}from"./Chip-D0XSbQUr.js";import{i as A}from"./Field-D9V9N-vb.js";import{useMemo as j,useRef as M,useState as N}from"react";import{Fragment as P,jsx as F,jsxs as I}from"react/jsx-runtime";import L from"styled-components";var R={none:{legend:`Not captured`,message:`Body capture was not running for this request. It needs OMNI_BODY_LOGGING_ALLOWED in the environment and the body logging setting turned on, and the calling key must not have opted out.`},missing:{legend:`Captured, then lost`,message:`This request was captured, but its artifact is no longer on disk. Retention or the row cap has since pruned it, or something removed the file underneath the gateway.`},corrupt:{legend:`Captured, but unreadable`,message:`This request was captured and the artifact is still on disk, but it failed its checksum or would not decrypt. Changing OMNI_ENCRYPTION_KEY invalidates every artifact written under the old one.`}},z=new Intl.NumberFormat(`en-US`),B=L.p`
2
2
  font-size: 12px;
3
3
  color: ${({theme:e})=>e.color.inkDim};
4
4
  max-width: 62ch;
@@ -1,4 +1,4 @@
1
- import{D as e,Jt as t,Mt as n,U as r,Vt as i,bt as a,kt as o,mt as s,vt as c}from"./Lamp-Dk9XrTCg.js";import{A as l,E as u,S as d,T as f,a as p,b as m,c as h,k as g,o as _,r as v,s as y,w as b,y as x}from"./Panel-CsovmtxF.js";import{A as S,r as C,t as w,w as T}from"./Rack-CDUOJkS2.js";import{t as ee}from"./plus-BgcHxxIr.js";import{t as E}from"./rotate-ccw-Do43Argv.js";import{t as D}from"./trash-00950_yY.js";import{t as O}from"./Toggle-CdMD58sy.js";import{n as k,t as A}from"./Chip-D0XSbQUr.js";import{i as j,n as te,r as M,t as N}from"./Field-DG1317zr.js";import{t as ne}from"./Meter-stpt3vQu.js";import{useEffect as re,useId as ie,useState as P}from"react";import{Fragment as F,jsx as I,jsxs as L}from"react/jsx-runtime";import R from"styled-components";var ae={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};ae.node;var oe=S(ae),se=[`tier`,`health`,`quota`,`cost`,`latency`,`load`],ce={tier:`How preferred this tier is`,health:`Consecutive failures and breaker state`,quota:`Headroom in the tightest window, against how much of it is left`,cost:`Price of this request against the other candidates`,latency:`Observed time to first token`,load:`Requests in flight on this pair right now`},le=R.li`
1
+ import{D as e,Jt as t,Mt as n,U as r,Vt as i,bt as a,kt as o,mt as s,vt as c}from"./Lamp-Dk9XrTCg.js";import{A as l,E as u,S as d,T as f,a as p,b as m,c as h,k as g,o as _,r as v,s as y,w as b,y as x}from"./Panel-CsovmtxF.js";import{A as S,r as C,t as w,w as T}from"./Rack-CDUOJkS2.js";import{t as ee}from"./plus-BgcHxxIr.js";import{t as E}from"./rotate-ccw-Do43Argv.js";import{t as D}from"./trash-00950_yY.js";import{t as O}from"./Toggle-CdMD58sy.js";import{n as k,t as A}from"./Chip-D0XSbQUr.js";import{i as j,n as te,r as M,t as N}from"./Field-D9V9N-vb.js";import{t as ne}from"./Meter-stpt3vQu.js";import{useEffect as re,useId as ie,useState as P}from"react";import{Fragment as F,jsx as I,jsxs as L}from"react/jsx-runtime";import R from"styled-components";var ae={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};ae.node;var oe=S(ae),se=[`tier`,`health`,`quota`,`cost`,`latency`,`load`],ce={tier:`How preferred this tier is`,health:`Consecutive failures and breaker state`,quota:`Headroom in the tightest window, against how much of it is left`,cost:`Price of this request against the other candidates`,latency:`Observed time to first token`,load:`Requests in flight on this pair right now`},le=R.li`
2
2
  padding: ${({theme:e})=>e.space(2)} 0;
3
3
  border-bottom: 1px solid ${({theme:e})=>e.color.rule};
4
4
 
@@ -1,4 +1,4 @@
1
- import{jt as e}from"./Lamp-Dk9XrTCg.js";import{t}from"./preload-helper-B7KDmXJ9.js";import{T as n,a as r,d as i,m as a,o,p as s,r as c,s as l,u}from"./Panel-CsovmtxF.js";import{t as d}from"./Rack-CDUOJkS2.js";import{t as f}from"./index-BYDVTknB.js";import{Component as p,Suspense as m,createContext as h,lazy as g,useContext as _,useMemo as v}from"react";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";import S from"styled-components";import{pluginApiPath as C}from"@omnigateway/dashboard-sdk";var w=new Map;function T(e){let t=w.get(e);if(t!==void 0)return t;let n={get:(t,n)=>i(C(e,t),n),post:(t,n)=>s(C(e,t),n),put:(t,n)=>a(C(e,t),n),del:t=>u(C(e,t))};return w.set(e,n),n}var E=h(e=>t(()=>import(e),[]));E.Provider;function D(){return _(E)}function O(e,t){let n=e?.default;if(n==null)throw Error(`plugin ${t} has no default export from definePluginUI`);if(typeof n.mount!=`function`)throw Error(`plugin ${t} exported a default without a mount function`);return n}function k(e,t,n){return g(async()=>{let r=O(await n(t),e);return{default:()=>r.mount({pluginId:e,api:T(e)})}})}var A=S.p`
1
+ import{jt as e}from"./Lamp-Dk9XrTCg.js";import{t}from"./preload-helper-B7KDmXJ9.js";import{T as n,a as r,d as i,m as a,o,p as s,r as c,s as l,u}from"./Panel-CsovmtxF.js";import{t as d}from"./Rack-CDUOJkS2.js";import{t as f}from"./index-Rh35FNqC.js";import{Component as p,Suspense as m,createContext as h,lazy as g,useContext as _,useMemo as v}from"react";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";import S from"styled-components";import{pluginApiPath as C}from"@omnigateway/dashboard-sdk";var w=new Map;function T(e){let t=w.get(e);if(t!==void 0)return t;let n={get:(t,n)=>i(C(e,t),n),post:(t,n)=>s(C(e,t),n),put:(t,n)=>a(C(e,t),n),del:t=>u(C(e,t))};return w.set(e,n),n}var E=h(e=>t(()=>import(e),[]));E.Provider;function D(){return _(E)}function O(e,t){let n=e?.default;if(n==null)throw Error(`plugin ${t} has no default export from definePluginUI`);if(typeof n.mount!=`function`)throw Error(`plugin ${t} exported a default without a mount function`);return n}function k(e,t,n){return g(async()=>{let r=O(await n(t),e);return{default:()=>r.mount({pluginId:e,api:T(e)})}})}var A=S.p`
2
2
  font-size: 13px;
3
3
  color: ${({theme:e})=>e.color.down};
4
4
  `,j=S.p`
@@ -1,4 +1,4 @@
1
- import{J as e,Jt as t,Qt as n,Ut as r,X as i,Z as a,kt as o,qt as s}from"./Lamp-Dk9XrTCg.js";import{S as c,T as l,_ as u,b as d,c as f,k as p,o as m,r as h,s as g,v as _,w as v,y}from"./Panel-CsovmtxF.js";import{t as b}from"./Rack-CDUOJkS2.js";import{t as x}from"./Toggle-CdMD58sy.js";import{i as S,n as C,t as w}from"./Field-DG1317zr.js";import{t as T}from"./Meter-stpt3vQu.js";import{n as E}from"./reasons-Du1OBWAM.js";import{useEffect as ee,useId as D,useState as O}from"react";import{Fragment as te,jsx as k,jsxs as A}from"react/jsx-runtime";import j from"styled-components";var M=j.p`
1
+ import{J as e,Jt as t,Qt as n,Ut as r,X as i,Z as a,kt as o,qt as s}from"./Lamp-Dk9XrTCg.js";import{S as c,T as l,_ as u,b as d,c as f,k as p,o as m,r as h,s as g,v as _,w as v,y}from"./Panel-CsovmtxF.js";import{t as b}from"./Rack-CDUOJkS2.js";import{t as x}from"./Toggle-CdMD58sy.js";import{i as S,n as C,t as w}from"./Field-D9V9N-vb.js";import{t as T}from"./Meter-stpt3vQu.js";import{n as E}from"./reasons-Du1OBWAM.js";import{useEffect as ee,useId as D,useState as O}from"react";import{Fragment as te,jsx as k,jsxs as A}from"react/jsx-runtime";import j from"styled-components";var M=j.p`
2
2
  font-size: 12px;
3
3
  color: ${({theme:e})=>e.color.inkDim};
4
4
  max-width: 62ch;
@@ -0,0 +1,39 @@
1
+ import{_ as e,i as t,y as n}from"./shared-DDpLUhCp.js";import{$ as r,$t as i,F as a,I as o,K as ee,L as s,V as te,W as ne,at as re,et as ie,g as c,it as ae,j as l,l as oe,nt as u,ot as d,r as f,rt as se,tt as p,u as ce}from"./Lamp-Dk9XrTCg.js";import{A as m,C as h,S as g,T as _,b as v,k as y,o as le,r as ue,s as de,x as b,y as x}from"./Panel-CsovmtxF.js";import{D as fe,i as pe,t as me,x as S}from"./Rack-CDUOJkS2.js";import{a as he,i as ge,n as _e,r as ve,t as ye}from"./RequestTable-BF5-R27W.js";import{t as C}from"./chevron-down-Bb5ZGvwk.js";import{t as w}from"./chevron-right-hwF5mD6-.js";import{i as T,r as E}from"./index-Rh35FNqC.js";import{i as be}from"./Field-D9V9N-vb.js";import{t as D}from"./Meter-stpt3vQu.js";import{i as O,n as k,r as A,t as j}from"./Table-CVDZ69Zx.js";import{n as xe,r as M}from"./WindowChart-Bqbl-KFO.js";import{c as Se}from"./limits-iRyDMg04.js";import{i as N,n as P,r as Ce,t as we}from"./SummaryDeck-DrzTQQo5.js";import{Fragment as F,useMemo as I,useState as L}from"react";import{Fragment as Te,jsx as R,jsxs as z}from"react/jsx-runtime";import B from"styled-components";var V=B.div`
2
+ display: grid;
3
+ grid-template-areas:
4
+ "chassis"
5
+ "main";
6
+ grid-template-columns: minmax(0, 1fr);
7
+ grid-template-rows: auto minmax(0, 1fr);
8
+ height: 100vh;
9
+ min-height: 0;
10
+ overflow: hidden;
11
+ `,H=B.main`
12
+ grid-area: main;
13
+ padding: ${({theme:e})=>e.space(4)};
14
+ display: flex;
15
+ flex-direction: column;
16
+ gap: ${({theme:e})=>e.space(4)};
17
+ min-width: 0;
18
+ min-height: 0;
19
+ overflow-y: auto;
20
+
21
+ @media (max-width: 720px) {
22
+ padding: ${({theme:e})=>e.space(3)};
23
+ }
24
+ `;function U({children:e}){let{cadence:t}=fe(),n=p(),r=u(200,t(1e4,`res:logs`));return z(V,{"data-testid":`client-shell`,children:[R(S,{logs:r.data??[],logsFailed:r.isError,signOut:{pending:n.isPending,run:()=>{n.mutate(void 0,{onSuccess:()=>window.location.assign(`/login`)})}}}),R(H,{children:e})]})}var Ee=[20,50,100,250],De={"1m":`per minute`,"5h":`per 5 hours`,"1w":`per week`};function Oe({reading:e}){let t=e.window===null?`concurrent requests`:`${e.dimension} ${De[e.window]??e.window}`,n=e.model===null?t:`${t} for ${e.model}`,r=e.dimension===`spend`?s:l,i=e.used===null?null:e.limit===0?1:e.used/e.limit;return z(O,{children:[R(k,{children:t}),R(k,{$align:`right`,$mono:!0,children:e.used===null?R(b,{children:`unknown`}):r(e.used)}),R(k,{$align:`right`,$mono:!0,children:r(e.limit)}),R(k,{children:i===null?null:R(D,{fraction:i,label:`${n}, ${Math.round(Math.min(1,i)*100)}% used`})})]})}function ke(e){return{observedAt:e.observedAt,windowType:e.windowType,windowMs:e.windowMs,resetsAt:e.resetsAt,usedRatio:e.usedRatio}}function W(e){return{stale:e.stale,rolledOver:e.rolledOver,estimateStale:e.stale||e.rolledOver,survives:e.survives,exhaustsAt:e.exhaustsAt}}var G=B.div`
25
+ display: flex;
26
+ flex-direction: column;
27
+ gap: 4px;
28
+ `,K=B.div`
29
+ display: grid;
30
+ /* Bar, figure, legend — the accounts page's own three columns, so the two
31
+ screens read the same way and the legends stay aligned down the stack. */
32
+ grid-template-columns: 96px 34px 1fr;
33
+ align-items: center;
34
+ min-width: 208px;
35
+ gap: 6px;
36
+ `,q=B(v)`
37
+ font-size: 11px;
38
+ text-align: right;
39
+ `;function Ae({windows:e,open:t,onToggle:n}){let r=e[0],i=e.filter(e=>e.usedRatio!==null);return z(O,{children:[R(k,{children:r.label}),R(k,{children:i.length===0?R(b,{children:`unknown`}):R(G,{children:i.map(e=>z(K,{children:[R(D,{fraction:e.usedRatio,label:`${e.label} ${e.windowType} window, ${Math.round(e.usedRatio*100)}% used`}),R(q,{children:a(e.usedRatio,0)}),R(x,{children:c(e,W(e),Date.now(),o)})]},e.windowType))})}),R(k,{$align:`right`,children:R(m,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} quota history for ${r.label}`,title:`${t?`Hide`:`Show`} quota history for ${r.label}`,onClick:n,children:R(t?C:w,{})})})]})}function J(){let{cadence:o,live:c}=fe(),[u,p]=L(`24h`),[m,S]=L(he),[C,w]=L(Ee[0]),[T,E]=L(null),[D,B]=L(null),V=e(u),H=r().data??null,U=I(()=>V.grain===`daily`?n(Date.now()-V.ms,H):Math.floor((Date.now()-V.ms)/6e4)*6e4,[V,H]),De=I(()=>U+V.ms,[U,V]),W=re(),G={since:U,grain:V.grain},K=d({...G,groupBy:V.by},o(6e4,`res:usage`)),q=d({...G,groupBy:`model`},o(6e4,`res:usage`)),J=ie(m,C,o(te,`res:logs`)),je=!ne(J.data),Me=i(ee.clientLogPages(m,C)),Y=se(6e4),X=Y.data??[],Ne=Se(W.data?.limitUsage??[]),Pe=Ne.some(e=>e.model!==null),Fe=I(()=>{let e=new Map;for(let t of X){let n=e.get(t.provider)??new Map,r=n.get(t.credentialId);r===void 0?n.set(t.credentialId,[t]):r.push(t),e.set(t.provider,n)}return[...e.entries()].map(([e,t])=>[e,[...t.entries()].map(([e,t])=>({credentialId:e,windows:[...t].sort((e,t)=>f[e.windowType]-f[t.windowType])}))])},[X]),Z=X.map(e=>M(ke(e))).filter(e=>e!==null),Ie=Z.length===0?0:Math.floor(Math.min(...Z)/6e4)*6e4,Le=ae({since:Ie},D!==null&&Z.length>0),Q=I(()=>(J.data?.pages??[]).flatMap(e=>e.logs),[J.data?.pages]),Re=ve(c&&Q.some(ce)),ze=Q.filter(oe).length,$=K.data??[],Be=$.reduce((e,t)=>e+t.requests,0),Ve=$.reduce((e,t)=>e+t.costUsd,0);return z(_,{$gap:4,children:[R(me,{legend:`Client`,title:`Your usage`,summary:K.isLoading?`Reading your usage…`:`${l(Be)} requests and ${s(Ve)} over the last ${V.label}.`,actions:R(P,{children:t.map(e=>R(Ce,{type:`button`,$size:`sm`,$on:e.id===u,"aria-pressed":e.id===u,onClick:()=>p(e.id),children:e.id},e.id))})}),R(ue,{legend:`Your key`,meta:W.data===void 0?void 0:z(v,{$dim:!0,children:[W.data.prefix,`…`]}),children:W.isPending?R(de,{rows:2}):W.isError?R(le,{legend:`Could not read your key`,error:W.error}):z(_,{$gap:2,children:[z(g,{$gap:2,$wrap:!0,children:[R(x,{children:W.data.label}),W.data.bodyLoggingOptOut?R(b,{children:`Request bodies are never stored for this key.`}):null]}),W.data.modelAllowlist===null?R(b,{children:`Every model this gateway serves.`}):W.data.modelAllowlist.length===0?R(b,{children:`No models. This key cannot serve a request.`}):R(g,{$gap:1,$wrap:!0,children:W.data.modelAllowlist.map(e=>R(v,{children:e},e))})]})}),R(we,{buckets:$,since:U,until:De,by:V.by,rangeLabel:V.label,dayOffsetMinutes:H}),R(N,{legend:`By model`,meta:V.label,query:{isLoading:q.isLoading,isError:q.isError,error:q.error,refetch:()=>void q.refetch()},failure:`Could not read usage`,empty:{legend:`No traffic`,message:`Nothing served in this window.`},isEmpty:(q.data??[]).length===0,children:R(h,{children:z(j,{children:[R(`thead`,{children:z(`tr`,{children:[R(A,{children:`Model`}),R(A,{$align:`right`,children:`Requests`}),R(A,{$align:`right`,children:`Tokens`}),R(A,{$align:`right`,children:`Spend`})]})}),R(`tbody`,{children:(q.data??[]).map(e=>z(O,{children:[R(k,{$mono:!0,children:e.key}),R(k,{$align:`right`,$mono:!0,children:l(e.requests)}),R(k,{$align:`right`,$mono:!0,children:l(e.inputTokens+e.outputTokens+e.cacheReadTokens+e.cacheWriteTokens)}),R(k,{$align:`right`,$mono:!0,children:s(e.costUsd)})]},e.key))})]})})}),R(N,{legend:`Your limits`,query:{isLoading:W.isLoading,isError:W.isError,error:W.error,refetch:()=>void W.refetch()},failure:`Could not read your limits`,empty:W.data?.limits===null?{legend:`Limits unreadable`,message:`This key's limits could not be read. Requests are refused until an operator repairs it.`}:{legend:`No limits`,message:`This key is not rate limited.`},isEmpty:W.data?.limits===null||(W.data?.limitUsage.length??0)===0,footer:R(b,{children:`Counted from completed requests, so a burst in flight right now may not be included yet.`}),children:R(h,{children:z(j,{children:[R(`thead`,{children:z(`tr`,{children:[R(A,{children:`Limit`}),R(A,{$align:`right`,children:`Used`}),R(A,{$align:`right`,children:`Ceiling`}),R(A,{$width:`30%`,children:`Consumption`})]})}),R(`tbody`,{children:Ne.map(e=>z(F,{children:[Pe?R(O,{children:R(A,{scope:`rowgroup`,colSpan:4,children:e.model??`Every model`})}):null,e.readings.map(e=>R(Oe,{reading:e},`${e.dimension}:${e.window??`gauge`}`))]},e.model??``))})]})})}),R(N,{legend:`Provider headroom`,query:{isLoading:Y.isLoading,isError:Y.isError,error:Y.error,refetch:()=>void Y.refetch()},failure:`Could not read provider headroom`,empty:{legend:`No data`,message:`No provider has reported a usage window.`},isEmpty:X.length===0,footer:R(b,{children:`What each account serving this gateway has left. A request is served by whichever account of a provider can take it.`}),children:R(_,{$gap:4,children:Fe.map(([e,t])=>z(_,{$gap:1,children:[R(x,{children:e}),R(h,{children:z(j,{children:[R(`thead`,{children:z(`tr`,{children:[R(A,{children:`Account`}),R(A,{$width:`60%`,children:`Quota`}),R(A,{})]})}),R(`tbody`,{children:t.map(({credentialId:e,windows:t})=>z(F,{children:[R(Ae,{windows:t,open:D===e,onToggle:()=>B(D===e?null:e)}),D===e?R(O,{children:R(k,{colSpan:3,children:R(_,{$gap:4,children:t.map(e=>{let t=ke(e),n=M(t),r=(Le.data?.samples??[]).filter(t=>t.credentialId===e.credentialId&&t.windowType===e.windowType&&t.observedAt>=(n??0));return R(xe,{live:t,samples:r.map(e=>({observedAt:e.observedAt,windowType:e.windowType,windowMs:e.windowMs,resetsAt:e.resetsAt,usedRatio:e.usedRatio})),since:n,now:Date.now(),truncated:Le.data?.truncated===!0&&n!==null&&r.length>0&&(r[0]?.observedAt??0)>n,ratePerHourRatio:e.ratePerHourRatio,exhaustsAt:e.exhaustsAt,survives:e.survives,stale:e.stale,rolledOver:e.rolledOver,spent:e.usedRatio===null?`no ceiling reported`:`${a(e.usedRatio,0)} used`,rateText:e.ratePerHourRatio===null?`unknown`:`${a(e.ratePerHourRatio,1)}/h`},e.windowType)})})})}):null]},e))})]})})]},e))})}),R(N,{legend:`Recent requests`,meta:`${Q.length} shown`,actions:z(P,{children:[R(ge,{filters:m,onChange:S}),R(be,{value:C,"aria-label":`How many requests per page`,style:{width:`auto`},onChange:e=>w(Number(e.target.value)),children:Ee.map(e=>z(`option`,{value:e,children:[e,` per page`]},e))})]}),query:{isLoading:J.isLoading,isError:J.isError,error:J.error,refetch:()=>void J.refetch()},failure:`Could not read your requests`,empty:{legend:`No requests`,message:Object.keys(m).length===0?`Nothing served through this key yet.`:`No request served through this key matches these filters.`},isEmpty:Q.length===0,footer:z(g,{$gap:2,$wrap:!0,children:[z(b,{children:[l(ze),` of the `,l(Q.length),` loaded failed.`]}),J.hasNextPage?R(y,{type:`button`,$size:`sm`,disabled:J.isFetchingNextPage,onClick:()=>void J.fetchNextPage(),children:J.isFetchingNextPage?`Loading…`:`Load older`}):null,je?z(Te,{children:[R(b,{children:`Live updates are paused while older pages are loaded.`}),R(y,{type:`button`,$size:`sm`,onClick:Me,children:`Back to live`})]}):null]}),children:R(h,{children:R(_e,{rows:Q,now:Re,onOpen:E})})}),R(pe,{open:T!==null,onOpenChange:e=>{e||E(null)},title:`Request detail`,width:`640px`,footer:R(y,{type:`button`,onClick:()=>E(null),children:`Close`}),children:T===null?null:R(ye,{log:T})})]})}var je=()=>R(E,{children:R(T,{children:R(U,{children:R(J,{})})})});export{je as component};