omnigateway 0.15.2 → 0.15.3
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/bin/omni.js +1 -1
- package/gateway.js +1 -1
- package/package.json +1 -1
- package/public/assets/{Chip-C3dIFd8s.js → Chip-B2iXmJJC.js} +1 -1
- package/public/assets/CopyValue-CWSTp4v8.js +27 -0
- package/public/assets/{Field-EvdVyEqx.js → Field-CUEEy19T.js} +5 -28
- package/public/assets/{Rack-DMrfn4-H.js → Rack-1lijWt5h.js} +32 -32
- package/public/assets/RequestTable-uRTmuPwB.js +93 -0
- package/public/assets/Select-C0c13SKD.js +141 -0
- package/public/assets/{SummaryDeck-DHsYYpYO.js → SummaryDeck-DnQnRmQ8.js} +1 -1
- package/public/assets/Toggle-BvVa_jla.js +39 -0
- package/public/assets/{TokenBreakdown-Bf0zsKcd.js → TokenBreakdown-B8cSaOOr.js} +2 -2
- package/public/assets/_app.accounts-DmJhe6QV.js +70 -0
- package/public/assets/_app.console-DQlcBpSu.js +24 -0
- package/public/assets/{_app.database-BCwEMrEA.js → _app.database-DoDu8HOG.js} +1 -1
- package/public/assets/{_app.index-DW6wain4.js → _app.index-BEeD4XSS.js} +2 -2
- package/public/assets/_app.keys-MXvgkBUB.js +120 -0
- package/public/assets/{_app.logs-CRC5qDK3.js → _app.logs-CjUjeVHg.js} +3 -3
- package/public/assets/_app.models-mNIL-1oS.js +148 -0
- package/public/assets/{_app.plugins._pluginId-CD9KXknf.js → _app.plugins._pluginId-CsJXQg6X.js} +1 -1
- package/public/assets/_app.settings-CYMwWA8D.js +88 -0
- package/public/assets/{_app.usage-BR6a92zI.js → _app.usage-Dd33vB8x.js} +3 -3
- package/public/assets/chevron-right-ocqzquMZ.js +1 -0
- package/public/assets/client-KUNw8ZtZ.js +48 -0
- package/public/assets/{index-6rZSWe9j.js → index-B9izdV6t.js} +3 -3
- package/public/assets/{login-NuwPF5SS.js → login-DrbTJF6e.js} +1 -1
- package/public/assets/plus-D_lvSfDL.js +1 -0
- package/public/assets/{rotate-ccw-Dionx_MW.js → rotate-ccw-CwTftDdz.js} +1 -1
- package/public/assets/{trash-Bsi60qJc.js → trash-CmuxOGpN.js} +1 -1
- package/public/index.html +2 -2
- package/public/assets/CopyValue-DG88CWpN.js +0 -27
- package/public/assets/RequestTable-CtuuMOT2.js +0 -93
- package/public/assets/Toggle-BTie3NY8.js +0 -39
- package/public/assets/_app.accounts-xCJhRd32.js +0 -70
- package/public/assets/_app.console-DS37cfIu.js +0 -24
- package/public/assets/_app.keys-CCU2NB3-.js +0 -120
- package/public/assets/_app.models-B4brzRdK.js +0 -148
- package/public/assets/_app.settings-NJSb_L2B.js +0 -88
- package/public/assets/chevron-down-3tlYNJqZ.js +0 -1
- package/public/assets/chevron-right-kvaJRnfj.js +0 -1
- package/public/assets/client-B9t0CsmA.js +0 -46
- package/public/assets/dist-B8iuo_hI.js +0 -1
- package/public/assets/plus-CVqm87L-.js +0 -1
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import{F as e,I as t,M as n,N as r,P as i,Pt as a,Tt as o,V as s,f as c,gt as l,p as u,t as d,u as f,z as p}from"./Lamp-CL0i4yaa.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-DMrfn4-H.js";import{n as oe,r as se,t as ce}from"./TokenBreakdown-Bf0zsKcd.js";import{t as le}from"./chevron-right-kvaJRnfj.js";import{t as ue}from"./dist-B8iuo_hI.js";import{n as de,t as fe}from"./Chip-C3dIFd8s.js";import{i as pe,n as me}from"./Field-EvdVyEqx.js";import{i as he,n as M,r as N,t as ge}from"./Table-CVDZ69Zx.js";import*as P from"react";import{useEffect as _e,useLayoutEffect as ve,useRef as ye,useState as be}from"react";import{Fragment as xe,jsx as F,jsxs as I}from"react/jsx-runtime";import L from"styled-components";import*as Se from"react-dom";var Ce={name:`calendar-days`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 13h.01`,key:`1sbv64`}],[`path`,{d:`M12 13h.01`,key:`y0uutt`}],[`path`,{d:`M16 13h.01`,key:`wip0gl`}],[`path`,{d:`M8 17h.01`,key:`p3bg7i`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M16 17h.01`,key:`ql8jdd`}]]};Ce.node;var we=x(Ce),Te={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};Te.node;var Ee=x(Te),De=[`top`,`right`,`bottom`,`left`],R=Math.min,z=Math.max,Oe=Math.round,ke=Math.floor,B=e=>({x:e,y:e}),Ae={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function je(e,t,n){return z(e,R(t,n))}function V(e,t){return typeof e==`function`?e(t):e}function H(e){return e.split(`-`)[0]}function Me(e){return e.split(`-`)[1]}function Ne(e){return e===`x`?`y`:`x`}function Pe(e){return e===`y`?`height`:`width`}function U(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Fe(e){return Ne(U(e))}function Ie(e,t,n){n===void 0&&(n=!1);let r=Me(e),i=Fe(e),a=Pe(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ge(o)),[o,Ge(o)]}function Le(e){let t=Ge(e);return[Re(e),t,Re(t)]}function Re(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ze=[`left`,`right`],Be=[`right`,`left`],Ve=[`top`,`bottom`],He=[`bottom`,`top`];function Ue(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Be:ze:t?ze:Be;case`left`:case`right`:return t?Ve:He;default:return[]}}function We(e,t,n,r){let i=Me(e),a=Ue(H(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Re)))),a}function Ge(e){let t=H(e);return Ae[t]+e.slice(t.length)}function Ke(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function qe(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ke(e)}function Je(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ye(e,t,n){let{reference:r,floating:i}=e,a=U(t),o=Fe(t),s=Pe(o),c=H(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Me(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Xe(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=V(t,e),p=qe(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Je(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Je(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Ze=50,Qe=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Xe},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ye(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Ze&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Ye(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},$e=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=V(e,t)||{};if(l==null)return{};let d=qe(u),f={x:n,y:r},p=Fe(i),m=Pe(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=R(d[_],T),ee=R(d[v],T),D=C-h[m]-ee,O=C/2-h[m]/2+w,k=je(E,O,D),A=!c.arrow&&Me(i)!=null&&O!==k&&a.reference[m]/2-(O<E?E:ee)-h[m]/2<0,j=A?O<E?O-E:O-D:0;return{[p]:f[p]+j,data:{[p]:k,centerOffset:O-k-j,...A&&{alignmentOffset:j}},reset:A}}}),et=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=V(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=H(r),_=U(o),v=H(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ge(o)]:Le(o)),x=p!==`none`;!d&&x&&b.push(...We(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ie(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===U(t)||T.every(e=>U(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=U(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function tt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function nt(e){return De.some(t=>e[t]>=0)}var rt=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=V(e,t);switch(i){case`referenceHidden`:{let e=tt(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:nt(e)}}}case`escaped`:{let e=tt(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:nt(e)}}}default:return{}}}}},it=new Set([`left`,`top`]);async function at(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=H(n),s=Me(n),c=U(n)===`y`,l=it.has(o)?-1:1,u=a&&c?-1:1,d=V(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ot=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await at(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},st=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=V(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=U(i),p=Ne(f),m=u[p],h=u[f],g=(e,t)=>je(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},ct=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=V(e,t),u={x:n,y:r},d=U(i),f=Ne(d),p=u[f],m=u[d],h=V(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=it.has(H(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},lt=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=V(e,t),c=await i.detectOverflow(t,s),l=H(n),u=Me(n),d=U(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=R(p-c[m],g),y=R(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*z(c.left,c.right):S=p-2*z(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function ut(){return typeof window<`u`}function dt(e){return ft(e)?(e.nodeName||``).toLowerCase():`#document`}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function G(e){return((ft(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ft(e){return ut()?e instanceof Node||e instanceof W(e).Node:!1}function K(e){return ut()?e instanceof Element||e instanceof W(e).Element:!1}function q(e){return ut()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function pt(e){return!ut()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}function mt(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Y(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ht(e){return/^(table|td|th)$/.test(dt(e))}function gt(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var _t=/transform|translate|scale|rotate|perspective|filter/,vt=/paint|layout|strict|content/,J=e=>!!e&&e!==`none`,yt;function bt(e){let t=K(e)?Y(e):e;return J(t.transform)||J(t.translate)||J(t.scale)||J(t.rotate)||J(t.perspective)||!St()&&(J(t.backdropFilter)||J(t.filter))||_t.test(t.willChange||``)||vt.test(t.contain||``)}function xt(e){let t=Tt(e);for(;q(t)&&!Ct(t);){if(bt(t))return t;if(gt(t))return null;t=Tt(t)}return null}function St(){return yt??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),yt}function Ct(e){return/^(html|body|#document)$/.test(dt(e))}function Y(e){return W(e).getComputedStyle(e)}function wt(e){return K(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Tt(e){if(dt(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||pt(e)&&e.host||G(e);return pt(t)?t.host:t}function Et(e){let t=Tt(e);return Ct(t)?(e.ownerDocument||e).body:q(t)&&mt(t)?t:Et(t)}function Dt(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Et(e),i=r===e.ownerDocument?.body,a=W(r);if(i){let e=Ot(a);return t.concat(a,a.visualViewport||[],mt(r)?r:[],e&&n?Dt(e):[])}return t.concat(r,Dt(r,[],n))}function Ot(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function kt(e){let t=Y(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=q(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Oe(n)!==a||Oe(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function At(e){return K(e)?e:e.contextElement}function jt(e){let t=At(e);if(!q(t))return B(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=kt(t),o=(a?Oe(n.width):n.width)/r,s=(a?Oe(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Mt=B(0);function Nt(e){let t=W(e);return!St()||!t.visualViewport?Mt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Pt(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===W(e)}function Ft(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=At(e),o=B(1);t&&(r?K(r)&&(o=jt(r)):o=jt(e));let s=Pt(a,n,r)?Nt(a):B(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=W(a),t=K(r)?W(r):r,n=e,i=Ot(n);for(;i&&t!==n;){let e=jt(i),t=i.getBoundingClientRect(),r=Y(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=W(i),i=Ot(n)}}return Je({width:u,height:d,x:c,y:l})}function It(e,t){let n=wt(e).scrollLeft;return t?t.left+n:Ft(G(e)).left+n}function Lt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-It(e,n),y:n.top+t.scrollTop}}function Rt(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=G(r),s=t?gt(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=B(1),u=B(0),d=q(r);if((d||!a)&&((dt(r)!==`body`||mt(o))&&(c=wt(r)),d)){let e=Ft(r);l=jt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Lt(o,c):B(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function zt(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Bt(e){let t=wt(e),n=e.ownerDocument.body,r=z(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=z(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+It(e),o=-t.scrollTop;return Y(n).direction===`rtl`&&(a+=z(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Vt=25;function Ht(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=W(e),a=G(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!St()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(It(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Vt&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ut(e,t){let n=Ft(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=jt(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Wt(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Ht(e,n,t);else if(t===`document`)r=Bt(G(e));else if(K(t))r=Ut(t,n);else{let n=Nt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Je(r)}function Gt(e,t){let n=t.get(e);if(n)return n;let r=Dt(e,[],!1).filter(e=>K(e)&&dt(e)!==`body`),i=null,a=Y(e).position===`fixed`,o=a?Tt(e):e;for(;K(o)&&!Ct(o);){let e=Y(o),t=bt(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Tt(o)}return t.set(e,r),r}function Kt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?gt(t)?[]:Gt(t,this._c):[].concat(n),r],o=Wt(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Wt(t,a[e],i);s=z(n.top,s),c=R(n.right,c),l=R(n.bottom,l),u=z(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function qt(e){let{width:t,height:n}=kt(e);return{width:t,height:n}}function Jt(e,t,n){let r=q(t),i=G(t),a=n===`fixed`,o=Ft(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=B(0);if((r||!a)&&((dt(t)!==`body`||mt(i))&&(s=wt(t)),r)){let e=Ft(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=It(i));let l=i&&!r&&!a?Lt(i,s):B(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Yt(e){return Y(e).position===`static`}function Xt(e,t){if(!q(e)||Y(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return G(e)===n&&(n=n.ownerDocument.body),n}function Zt(e,t){let n=W(e);if(gt(e))return n;if(!q(e)){let t=Tt(e);for(;t&&!Ct(t);){if(K(t)&&!Yt(t))return t;t=Tt(t)}return n}let r=Xt(e,t);for(;r&&ht(r)&&Yt(r);)r=Xt(r,t);return r&&Ct(r)&&Yt(r)&&!bt(r)?n:r||xt(e)||n}var Qt=async function(e){let t=this.getOffsetParent||Zt,n=this.getDimensions,r=await n(e.floating);return{reference:Jt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $t(e){return Y(e).direction===`rtl`}var en={convertOffsetParentRelativeRectToViewportRelativeRect:Rt,getDocumentElement:G,getClippingRect:Kt,getOffsetParent:Zt,getElementRects:Qt,getClientRects:zt,getDimensions:qt,getScale:jt,isElement:K,isRTL:$t};function tn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nn(e,t,n){let r=null,i,a=G(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=ke(d),h=ke(a.clientWidth-(u+f)),g=ke(a.clientHeight-(d+p)),_=ke(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:z(0,R(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!tn(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=W(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function rn(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=At(e),u=i||a?[...l?Dt(l):[],...t?Dt(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?nn(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Ft(e):null;c&&g();function g(){let t=Ft(e);h&&!tn(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var an=ot,on=st,sn=et,cn=lt,ln=rt,un=$e,dn=ct,fn=(e,t,n)=>{let r=new Map,i=n??{},a={...en,...i.platform,_c:r};return Qe(e,t,{...i,platform:a})},pn=typeof document<`u`?ve:function(){};function mn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!mn(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!mn(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function hn(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gn(e,t){let n=hn(e);return Math.round(t*n)/n}function _n(e){let t=P.useRef(e);return pn(()=>{t.current=e}),t}function vn(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=P.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=P.useState(r);mn(f,r)||p(r);let[m,h]=P.useState(null),[g,_]=P.useState(null),v=P.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=P.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=P.useRef(null),C=P.useRef(null),w=P.useRef(u),T=c!=null,E=_n(c),ee=_n(i),D=_n(l),O=P.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};ee.current&&(e.platform=ee.current),fn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:D.current!==!1};k.current&&!mn(w.current,t)&&(w.current=t,Se.flushSync(()=>{d(t)}))})},[f,t,n,ee,D]);pn(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let k=P.useRef(!1);pn(()=>(k.current=!0,()=>{k.current=!1}),[]),pn(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,O);O()}},[b,x,O,E,T]);let A=P.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),j=P.useMemo(()=>({reference:b,floating:x}),[b,x]),te=P.useMemo(()=>{let e={position:n,left:0,top:0};if(!j.floating)return e;let t=gn(j.floating,u.x),r=gn(j.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...hn(j.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,j.floating,u.x,u.y]);return P.useMemo(()=>({...u,update:O,refs:A,elements:j,floatingStyles:te}),[u,O,A,j,te])}var yn=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:un({element:r.current,padding:i}).fn(n):r?un({element:r,padding:i}).fn(n):{}}}},bn=(e,t)=>{let n=an(e);return{name:n.name,fn:n.fn,options:[e,t]}},xn=(e,t)=>{let n=on(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sn=(e,t)=>({fn:dn(e).fn,options:[e,t]}),Cn=(e,t)=>{let n=sn(e);return{name:n.name,fn:n.fn,options:[e,t]}},wn=(e,t)=>{let n=cn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tn=(e,t)=>{let n=ln(e);return{name:n.name,fn:n.fn,options:[e,t]}},En=(e,t)=>{let n=yn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dn=Object.defineProperty,X=(e,t)=>Dn(e,`name`,{value:t,configurable:!0}),On=`Popper`,[kn,An]=S(On),[jn,Mn]=kn(On),Nn=X(e=>{let{__scopePopper:t,children:n}=e,[r,i]=P.useState(null),[a,o]=P.useState(void 0);return F(jn,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Pn=`PopperAnchor`,Fn=P.forwardRef(X(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Mn(Pn,n),o=P.useRef(null),s=a.onAnchorChange,c=P.useCallback(e=>{o.current=e,e&&s(e)},[s]),l=w(t,c),u=P.useRef(null);P.useEffect(()=>{if(!r)return;let e=u.current;u.current=r.current,e!==u.current&&s(u.current)});let d=a.placementState&&Hn(a.placementState),f=d?.[0],p=d?.[1];return r?null:F(ie.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...i,ref:l})},`PopperAnchor`)),In=`PopperContent`,[Ln,Rn]=kn(In),zn=P.forwardRef(X(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Mn(In,n),[_,v]=P.useState(null),y=w(t,v),[b,x]=P.useState(null),S=ue(b),C=S?.width??0,T=S?.height??0,ee=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],A=k.length>0,j={padding:D,boundary:k.filter(Bn),altBoundary:A},{refs:te,floatingStyles:ne,placement:re,isPositioned:ae,middlewareData:oe}=vn({strategy:`fixed`,placement:ee,whileElementsMounted:X((...e)=>rn(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[bn({mainAxis:i+T,alignmentAxis:o}),c&&xn({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Sn():void 0,...j}),c&&Cn({...j}),wn({...j,apply:X(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),b&&En({element:b,padding:s}),Vn({arrowWidth:C,arrowHeight:T}),f&&Tn({strategy:`referenceHidden`,...j,boundary:A?j.boundary:void 0})]}),se=g.setPlacementState;O(()=>(se(re),()=>{se(void 0)}),[re,se]);let[ce,le]=Hn(re),de=E(m);O(()=>{ae&&de?.()},[ae,de]);let fe=oe.arrow?.x,pe=oe.arrow?.y,me=oe.arrow?.centerOffset!==0,[he,M]=P.useState();return O(()=>{_&&M(window.getComputedStyle(_).zIndex)},[_]),F(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:ae?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:he,"--radix-popper-transform-origin":[oe.transformOrigin?.x,oe.transformOrigin?.y].join(` `),...oe.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:F(Ln,{scope:n,placedSide:ce,placedAlign:le,onArrowChange:x,arrowX:fe,arrowY:pe,shouldHideArrow:me,children:F(ie.div,{"data-side":ce,"data-align":le,...h,ref:y,style:{...h.style,animation:ae?h.style?.animation:`none`}})})})},`PopperContent`));function Bn(e){return e!==null}X(Bn,`isNotNull`);var Vn=X(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Hn(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Hn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}X(Hn,`getSideAndAlignFromPlacement`);var Un=Nn,Wn=Fn,Gn=zn,Kn=Object.defineProperty,Z=(e,t)=>Kn(e,`name`,{value:t,configurable:!0}),qn=`Popover`,[Jn,Yn]=S(qn,[An]),Xn=An(),[Zn,Qn]=Jn(qn),$n=Z(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Xn(t),c=P.useRef(null),[l,u]=P.useState(!1),[d,f]=A({prop:r,defaultProp:i??!1,onChange:a,caller:qn});return F(Un,{...s,children:F(Zn,{scope:t,contentId:ee(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:P.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:P.useCallback(()=>u(!0),[]),onCustomAnchorRemove:P.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),er=`PopoverTrigger`,tr=P.forwardRef(Z(function(e,t){let{__scopePopover:n,...r}=e,i=Qn(er,n),a=Xn(n),o=w(t,i.triggerRef),s=F(ie.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":fr(i.open),...r,ref:o,onClick:D(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:F(Wn,{asChild:!0,...a,children:s})},`PopoverTrigger`)),nr=`PopoverPortal`,[rr,ir]=Jn(nr,{forceMount:void 0}),ar=Z(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Qn(nr,t);return F(rr,{scope:t,forceMount:n,children:F(te,{present:n||a.open,children:F(T,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),or=`PopoverContent`,sr=P.forwardRef(Z(function(e,t){let n=ir(or,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Qn(or,e.__scopePopover);return F(te,{present:r||a.open,children:a.modal?F(lr,{...i,ref:t}):F(ur,{...i,ref:t})})},`PopoverContent`)),cr=ae(`PopoverContent.RemoveScroll`),lr=P.forwardRef(Z(function(e,t){let n=Qn(or,e.__scopePopover),r=P.useRef(null),i=w(t,r),a=P.useRef(!1);return P.useEffect(()=>{let e=r.current;if(e)return C(e)},[]),F(j,{as:cr,allowPinchZoom:!0,children:F(dr,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:D(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:D(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:D(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),ur=P.forwardRef(Z(function(e,t){let n=Qn(or,e.__scopePopover),r=P.useRef(!1),i=P.useRef(!1);return F(dr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),dr=P.forwardRef(Z(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Qn(or,n),p=Xn(n);return ne(),F(k,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:F(re,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:F(Gn,{"data-state":fr(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`));function fr(e){return e?`open`:`closed`}Z(fr,`getState`);var pr=$n,mr=tr,hr=ar,gr=sr,_r={},Q=e=>String(e).padStart(2,`0`),vr=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],yr=e=>{let t=new Date(e);return`${t.getFullYear()}-${Q(t.getMonth()+1)}-${Q(t.getDate())}`},br=(e,t,n)=>`${e}-${Q(t+1)}-${Q(n)}`,xr=e=>{let t=new Date(e);return`${Q(t.getHours())}:${Q(t.getMinutes())}`};function Sr(e,t,n){let r=Date.parse(`${e}T${t}`);if(!Number.isNaN(r))return n===`end`?r+59999:r}function Cr(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t+1,0).getDate();return{lead:n,days:Array.from({length:r},(e,t)=>t+1)}}function wr(e,t){return t<e?{from:t,to:e}:{from:e,to:t}}var Tr=(e,t,n)=>t!==void 0&&n!==void 0&&e>=t&&e<=n;function Er(e,t){let n=new Date(t);n.setDate(n.getDate()-(e-1)),n.setHours(0,0,0,0);let r=new Date(t);return r.setHours(23,59,59,999),{since:n.getTime(),until:r.getTime()}}var Dr=e=>{let t=new Date(e);return`${vr[t.getMonth()]??``} ${t.getDate()} ${Q(t.getHours())}:${Q(t.getMinutes())}`};function Or(e,t){return e!==void 0&&t!==void 0?`${Dr(e)} - ${Dr(t)}`:e===void 0?t===void 0?`Any time`:`Until ${Dr(t)}`:`From ${Dr(e)}`}var kr=L(mr)`
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
gap: ${({theme:e})=>e.space(2)};
|
|
5
|
-
height: 30px;
|
|
6
|
-
min-width: 230px;
|
|
7
|
-
padding: 0 8px;
|
|
8
|
-
border-radius: ${({theme:e})=>e.radius.control};
|
|
9
|
-
background: ${({theme:e})=>e.color.panelSunk};
|
|
10
|
-
border: 1px solid ${({theme:e})=>e.color.ruleStrong};
|
|
11
|
-
color: ${({theme:e})=>e.color.ink};
|
|
12
|
-
font-family: ${({theme:e})=>e.font.mono};
|
|
13
|
-
font-size: 12px;
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
transition: border-color 120ms ease;
|
|
16
|
-
|
|
17
|
-
&:hover,
|
|
18
|
-
&[data-state="open"] {
|
|
19
|
-
border-color: ${({theme:e})=>e.color.accent};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
svg {
|
|
23
|
-
width: 13px;
|
|
24
|
-
height: 13px;
|
|
25
|
-
flex: none;
|
|
26
|
-
color: ${({theme:e})=>e.color.inkFaint};
|
|
27
|
-
}
|
|
28
|
-
`,Ar=L(gr)`
|
|
29
|
-
z-index: ${({theme:e})=>e.z.dialog};
|
|
30
|
-
width: 252px;
|
|
31
|
-
padding: ${({theme:e})=>e.space(2)};
|
|
32
|
-
background: ${({theme:e})=>e.color.panel};
|
|
33
|
-
border: 1px solid ${({theme:e})=>e.color.ruleStrong};
|
|
34
|
-
border-radius: ${({theme:e})=>e.radius.panel};
|
|
35
|
-
box-shadow: 0 12px 40px oklch(0 0 0 / 0.35);
|
|
36
|
-
`,jr=L(g)`
|
|
37
|
-
justify-content: space-between;
|
|
38
|
-
margin-bottom: ${({theme:e})=>e.space(2)};
|
|
39
|
-
`,Mr=L.div`
|
|
40
|
-
display: grid;
|
|
41
|
-
grid-template-columns: repeat(7, 1fr);
|
|
42
|
-
gap: 1px;
|
|
43
|
-
`,Nr=L.span`
|
|
44
|
-
height: 20px;
|
|
45
|
-
display: grid;
|
|
46
|
-
place-items: center;
|
|
47
|
-
font-size: 10px;
|
|
48
|
-
color: ${({theme:e})=>e.color.inkFaint};
|
|
49
|
-
font-family: ${({theme:e})=>e.font.sans};
|
|
50
|
-
`,Pr=L.button`
|
|
51
|
-
height: 26px;
|
|
52
|
-
${({$start:e})=>e===void 0?``:`grid-column-start: ${e};`}
|
|
53
|
-
border: 0;
|
|
54
|
-
border-radius: ${({theme:e})=>e.radius.chip};
|
|
55
|
-
font-family: ${({theme:e})=>e.font.mono};
|
|
56
|
-
font-size: 11px;
|
|
57
|
-
cursor: pointer;
|
|
58
|
-
background: ${({theme:e,$in:t,$edge:n})=>n?e.color.accent:t?e.color.accentWash:`transparent`};
|
|
59
|
-
color: ${({theme:e,$edge:t})=>t?e.color.accentInk:e.color.ink};
|
|
60
|
-
|
|
61
|
-
&:hover {
|
|
62
|
-
background: ${({theme:e,$edge:t})=>t?e.color.accent:e.color.panelRaised};
|
|
63
|
-
}
|
|
64
|
-
`,Fr=L(g)`
|
|
65
|
-
gap: ${({theme:e})=>e.space(1)};
|
|
66
|
-
margin-top: ${({theme:e})=>e.space(2)};
|
|
67
|
-
padding-top: ${({theme:e})=>e.space(2)};
|
|
68
|
-
border-top: 1px solid ${({theme:e})=>e.color.rule};
|
|
69
|
-
`,Ir=L(me).attrs({type:`time`})`
|
|
70
|
-
width: auto;
|
|
71
|
-
flex: 1;
|
|
72
|
-
`,Lr=L(g)`
|
|
73
|
-
gap: ${({theme:e})=>e.space(1)};
|
|
74
|
-
margin-top: ${({theme:e})=>e.space(2)};
|
|
75
|
-
`,Rr=[`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`,`Su`],zr=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Br=[{label:`Today`,days:1},{label:`7d`,days:7},{label:`30d`,days:30}];function Vr({since:e,until:t,onChange:n}){let[r,i]=be(!1),[a,o]=be(()=>new Date(e??Date.now())),[s,c]=be(null),l=e===void 0?void 0:yr(e),u=t===void 0?void 0:yr(t),d=e===void 0?`00:00`:xr(e),f=t===void 0?`23:59`:xr(t),p=(e,t)=>n({since:Sr(e,d,`start`),until:Sr(t,f,`end`)}),h=e=>{if(s===null){c(e),p(e,e);return}let{from:t,to:n}=wr(s,e);c(null),p(t,n)},g=e=>o(t=>new Date(t.getFullYear(),t.getMonth()+e,1)),_=a.getFullYear(),v=a.getMonth(),{lead:x,days:S}=Cr(_,v);return I(pr,{open:r,onOpenChange:t=>{i(t),t&&(o(new Date(e??Date.now())),c(null))},children:[I(kr,{"aria-label":`Time range`,children:[F(we,{}),Or(e,t)]}),F(hr,{children:I(Ar,{align:`start`,sideOffset:4,children:[I(jr,{children:[F(m,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Previous month`,onClick:()=>g(-1),children:F(Ee,{})}),F(b,{children:`${zr[v]??``} ${_}`}),F(m,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Next month`,onClick:()=>g(1),children:F(le,{})})]}),I(Mr,{children:[Rr.map(e=>F(Nr,{children:e},e)),S.map((e,t)=>{let n=br(_,v,e);return F(Pr,{type:`button`,...t===0?{$start:x+1}:{},$in:Tr(n,l,u),$edge:n===l||n===u,onClick:()=>h(n),children:e},n)})]}),I(Fr,{children:[F(Ir,{"aria-label":`From time`,value:d,onChange:e=>n({since:Sr(l??yr(Date.now()),e.target.value,`start`),until:t})}),F(Ir,{"aria-label":`To time`,value:f,onChange:t=>n({since:e,until:Sr(u??yr(Date.now()),t.target.value,`end`)})})]}),F(Lr,{children:Br.map(e=>F(y,{type:`button`,$size:`sm`,onClick:()=>{c(null),n(Er(e.days,Date.now())),i(!1)},children:e.label},e.label))})]})})]})}var Hr=L(g)`
|
|
76
|
-
gap: ${({theme:e})=>e.space(2)};
|
|
77
|
-
flex-wrap: wrap;
|
|
78
|
-
`,Ur=L(pe)`
|
|
79
|
-
width: auto;
|
|
80
|
-
`,Wr=L(me)`
|
|
81
|
-
flex: 1;
|
|
82
|
-
min-width: 260px;
|
|
83
|
-
`,Gr=[{id:`all`,label:`All requests`,filters:{}},{id:`failed`,label:`Failed only`,filters:{failed:`true`}},{id:`pending`,label:`Still running`,filters:{state:`pending`}},{id:`done`,label:`Completed`,filters:{state:`done`}}],Kr=e=>e.failed===`true`?`failed`:e.state??`all`,qr=[{prefix:`model`,field:`model`},{prefix:`resolved`,field:`resolvedModel`},{prefix:`requested`,field:`requestedModel`},{prefix:`error`,field:`errorCode`}],Jr=[`model`,`resolvedModel`,`requestedModel`,`errorCode`];function Yr(e){let t={};for(let n of e.trim().split(/\s+/)){if(n===``)continue;let e=n.indexOf(`:`),r=e===-1?void 0:qr.find(t=>t.prefix===n.slice(0,e).toLowerCase());if(r===void 0){t.model=n;continue}let i=n.slice(e+1);i!==``&&(t[r.field]=i)}return t}function Xr(e){let t=[];return e.model!==void 0&&t.push(e.model),e.resolvedModel!==void 0&&t.push(`resolved:${e.resolvedModel}`),e.requestedModel!==void 0&&t.push(`requested:${e.requestedModel}`),e.errorCode!==void 0&&t.push(`error:${e.errorCode}`),t.join(` `)}var Zr=(e,t)=>Jr.every(n=>e[n]===t[n]),Qr=Object.fromEntries(Jr.map(e=>[e,void 0]));function $r({filters:e,patch:t}){let n=l(),r=o(),i=a();return I(xe,{children:[I(Ur,{"aria-label":`Provider`,value:e.provider??``,onChange:e=>t({provider:e.target.value||void 0}),children:[F(`option`,{value:``,children:`Any provider`}),(i.data??[]).map(e=>F(`option`,{value:e.id,children:e.label},e.id))]}),I(Ur,{"aria-label":`Account`,value:e.credentialId??``,onChange:e=>t({credentialId:e.target.value||void 0}),children:[F(`option`,{value:``,children:`Any account`}),(n.data??[]).map(e=>F(`option`,{value:e.id,children:e.label},e.id))]}),I(Ur,{"aria-label":`Gateway key`,value:e.apiKeyId??``,onChange:e=>t({apiKeyId:e.target.value||void 0}),children:[F(`option`,{value:``,children:`Any key`}),(r.data??[]).map(e=>F(`option`,{value:e.id,children:e.label},e.id))]})]})}function ei(e,t){let n={...e,...t};for(let e of Object.keys(n))n[e]===void 0&&delete n[e];return n}function ti({filters:e,onChange:t,operator:n=!1}){let r=n=>t(ei(e,n)),[i,a]=be(()=>Xr(e)),o=ye(null),s=ye(r);s.current=r;let c=()=>{o.current!==null&&clearTimeout(o.current),o.current=null};_e(()=>()=>clearTimeout(o.current??void 0),[]);let l=Xr(e);return o.current===null&&!Zr(Yr(i),e)&&i!==l&&a(l),I(Hr,{children:[F(Wr,{"aria-label":`Models and error codes`,placeholder:`Search anything`,value:i,onChange:e=>{let t=e.target.value;a(t),c(),o.current=setTimeout(()=>{o.current=null,s.current({...Qr,...Yr(t)})},500)}}),F(Vr,{since:e.since,until:e.until,onChange:e=>r(e)}),F(Ur,{"aria-label":`Show which requests`,value:Kr(e),onChange:e=>{let t=Gr.find(t=>t.id===e.target.value)??Gr[0];r({state:void 0,failed:void 0,...t.filters})},children:Gr.map(e=>F(`option`,{value:e.id,children:e.label},e.id))}),n?F($r,{filters:e,patch:r}):null,F(y,{type:`button`,onClick:()=>{c(),a(``),t({})},children:`Clear filters`})]})}function ni(e){let[t,n]=be(Date.now);return _e(()=>{if(!e)return;n(Date.now());let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),t}function ri({log:e}){return F(M,{$align:`right`,$mono:!0,...f(e)?{"aria-label":`processing`}:{title:se(e)},children:f(e)?F(ce,{}):F(oe,{tokens:e})})}function ii({rows:r,now:a,names:o,onOpen:l}){return I(ge,{children:[F(`thead`,{children:I(`tr`,{children:[F(N,{}),F(N,{$align:`right`,children:`Time`}),F(N,{children:`Requested`}),F(N,{children:`Routed to`}),o===void 0?null:I(xe,{children:[F(N,{children:`Account`}),F(N,{children:`Key`})]}),F(N,{$align:`right`,children:`Try`}),F(N,{$align:`right`,children:`TTFT`}),F(N,{$align:`right`,children:`Total`}),F(N,{$align:`right`,children:`Tokens`}),F(N,{$align:`right`,children:`Cost`}),F(N,{children:`Outcome`})]})}),F(`tbody`,{children:r.map(r=>I(he,{$selectable:!0,onClick:()=>l(r),children:[F(M,{children:F(d,{state:u(r),label:c(r)})}),F(M,{$align:`right`,$mono:!0,title:i(r.at),children:n(r.at)}),F(M,{$mono:!0,children:F(h,{style:{display:`block`,maxWidth:`20ch`},children:r.requestedModel||`—`})}),F(M,{children:r.resolvedProvider===null?F(b,{children:f(r)?`routing…`:`not routed`}):I(g,{$gap:1,children:[F(de,{provider:r.resolvedProvider}),F(v,{$dim:!0,children:r.resolvedModel??`—`})]})}),o===void 0?null:I(xe,{children:[F(M,{children:F(h,{style:{display:`block`,maxWidth:`18ch`},children:r.credentialId==null?`—`:o.accounts.get(r.credentialId)??s(r.credentialId)})}),F(M,{children:F(h,{style:{display:`block`,maxWidth:`16ch`},title:r.apiKeyId??void 0,children:r.apiKeyId==null?`—`:o.keys.get(r.apiKeyId)??s(r.apiKeyId)})})]}),F(M,{$align:`right`,$mono:!0,children:f(r)?`—`:r.attempts}),F(M,{$align:`right`,$mono:!0,children:f(r)?`—`:t(r.ttftMs)}),F(M,{$align:`right`,$mono:!0,children:f(r)?e(Math.max(0,a-r.at)):t(r.durationMs)}),F(ri,{log:r}),F(M,{$align:`right`,$mono:!0,children:f(r)?`—`:p(r.costUsd)}),F(M,{children:f(r)?F(fe,{$tone:`accent`,children:`live`}):r.errorCode===null?F(fe,{$tone:`ok`,children:r.status}):F(fe,{$tone:`down`,children:r.errorCode})})]},r.id))})]})}var ai=L.dl`
|
|
84
|
-
display: grid;
|
|
85
|
-
grid-template-columns: minmax(120px, auto) minmax(0, 1fr);
|
|
86
|
-
gap: 6px ${({theme:e})=>e.space(3)};
|
|
87
|
-
margin: 0;
|
|
88
|
-
font-size: 12.5px;
|
|
89
|
-
`,$=L.dd`
|
|
90
|
-
margin: 0;
|
|
91
|
-
font-family: ${({theme:e})=>e.font.mono};
|
|
92
|
-
word-break: break-all;
|
|
93
|
-
`;function oi({log:e,names:n,children:a}){return I(_,{$gap:3,children:[I(ai,{children:[F(b,{as:`dt`,children:`Request id`}),F($,{children:e.id}),F(b,{as:`dt`,children:`At`}),F($,{children:i(e.at)}),F(b,{as:`dt`,children:`Requested model`}),F($,{children:e.requestedModel||`—`}),F(b,{as:`dt`,children:`Routed to`}),F($,{children:f(e)?`—`:e.resolvedProvider===null?`not routed`:`${e.resolvedProvider} · ${e.resolvedModel??`—`}`}),n===void 0?null:I(xe,{children:[F(b,{as:`dt`,children:`Account`}),F($,{children:e.credentialId==null?`—`:n.accounts.get(e.credentialId)??e.credentialId}),F(b,{as:`dt`,children:`Key`}),F($,{children:e.apiKeyId==null?`—`:n.keys.get(e.apiKeyId)??e.apiKeyId})]}),F(b,{as:`dt`,children:`Attempts`}),F($,{children:f(e)?`—`:e.attempts}),F(b,{as:`dt`,children:`Status`}),F($,{children:f(e)?`in flight`:e.errorCode===null?e.status:`${e.status} ${e.errorCode}`}),F(b,{as:`dt`,children:`Timing`}),F($,{children:f(e)?`—`:`first token ${t(e.ttftMs)} · total ${t(e.durationMs)}`}),F(b,{as:`dt`,children:`Tokens`}),F($,{children:f(e)?`—`:I(xe,{children:[r(e.inputTokens),` in · `,r(e.outputTokens),` out ·`,` `,r(e.cacheReadTokens),` cache read · `,r(e.cacheWriteTokens),` `,`cache write`]})}),F(b,{as:`dt`,children:`Cost`}),F($,{children:f(e)?`—`:p(e.costUsd)}),F(b,{as:`dt`,children:`RTK compression`}),F($,{children:f(e)?`—`:e.rtkApplied?e.rtkFilterHits===void 0?`~${r(e.rtkEstimatedTokensSaved)} tokens saved`:`${r(e.rtkFilterHits)} hits · ${r(e.rtkOriginalCodeUnits??0)} → ${r(e.rtkCompressedCodeUnits??0)} code units · ~${r(e.rtkEstimatedTokensSaved)} tokens saved`:`not applied`}),e.rtkFilters===void 0?null:I(xe,{children:[F(b,{as:`dt`,children:`RTK filters`}),F($,{children:e.rtkFilters.length===0?`—`:e.rtkFilters.join(`, `)})]})]}),e.degradations.length===0?null:I(_,{$gap:1,children:[F(b,{children:`Capabilities dropped to fit the target`}),F(g,{$gap:1,$wrap:!0,children:e.degradations.map(e=>F(fe,{$tone:`warn`,children:e},e))})]}),a]})}export{_r as a,ti as i,ii as n,ni as r,oi as t};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,g as n,m as r,v as i}from"./Rack-DMrfn4-H.js";import{t as a}from"./dist-B8iuo_hI.js";import*as o from"react";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import u from"styled-components";var d=Object.defineProperty,f=(e,t)=>d(e,`name`,{value:t,configurable:!0}),p=`Switch`,[m,h]=e(p),[g,_]=m(p);function v(e){let{__scopeSwitch:t,checked:n,children:i,defaultChecked:a,disabled:s,form:l,name:u,onCheckedChange:d,required:f,value:m=`on`,internal_do_not_use_render:h}=e,[_,v]=r({prop:n,defaultProp:a??!1,onChange:d,caller:p}),[y,b]=o.useState(null),[x,S]=o.useState(null),C=o.useRef(!1),[w,T]=o.useReducer(e=>e+1,0),D={checked:_,setChecked:v,disabled:s,control:y,setControl:b,name:u,form:l,value:m,hasConsumerStoppedPropagationRef:C,userInteractionCount:w,onUserInteraction:T,required:f,defaultChecked:a,isFormControl:!y||!!l||!!y.closest(`form`),bubbleInput:x,setBubbleInput:S};return c(g,{scope:t,...D,children:E(h)?h(D):i})}f(v,`SwitchProvider`);var y=`SwitchTrigger`,b=o.forwardRef(f(function({__scopeSwitch:e,onClick:r,...a},s){let{control:l,form:u,value:d,disabled:p,checked:m,required:h,setControl:g,setChecked:v,hasConsumerStoppedPropagationRef:b,onUserInteraction:x,isFormControl:S,bubbleInput:C}=_(y,e),w=t(s,g),T=o.useRef(m);return o.useEffect(()=>{let e=u?l?.ownerDocument.getElementById(u):l?.form;if(e instanceof HTMLFormElement){let t=f(()=>v(T.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[l,u,v]),c(i.button,{type:`button`,role:`switch`,"aria-checked":m,"aria-required":h,"data-state":D(m),"data-disabled":p?``:void 0,disabled:p,value:d,...a,ref:w,onClick:n(r,e=>{x(),v(e=>!e),C&&S&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})})},`SwitchTrigger`)),x=o.forwardRef(f(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:u,value:d,onCheckedChange:f,form:p,...m}=e;return c(v,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:u,required:o,onCheckedChange:f,name:r,form:p,value:d,internal_do_not_use_render:({isFormControl:e})=>l(s,{children:[c(b,{...m,ref:t,__scopeSwitch:n}),e&&c(T,{__scopeSwitch:n})]})})},`Switch`)),S=`SwitchThumb`,C=o.forwardRef(f(function(e,t){let{__scopeSwitch:n,...r}=e,a=_(S,n);return c(i.span,{"data-state":D(a.checked),"data-disabled":a.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),w=`SwitchBubbleInput`,T=o.forwardRef(f(function({__scopeSwitch:e,onClick:r,...s},l){let{control:u,hasConsumerStoppedPropagationRef:d,userInteractionCount:f,checked:p,defaultChecked:m,required:h,disabled:g,name:v,value:y,form:b,bubbleInput:x,setBubbleInput:S}=_(w,e),C=t(l,S),T=a(u),E=o.useRef(!1),D=o.useRef(p),O=o.useRef(f);o.useEffect(()=>{let e=x;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=f!==O.current;O.current=f;let i=D.current!==p;D.current=p;let a=!(r&&d.current);if(i&&n){E.current=!r;let t=new Event(`click`,{bubbles:a});n.call(e,p),e.dispatchEvent(t),E.current=!1}},[x,p,d,f]);let k=o.useRef(p);return c(i.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:m??k.current,required:h,disabled:g,name:v,value:y,form:b,...s,tabIndex:-1,ref:C,onClick:n(r,e=>{E.current&&e.stopPropagation()}),style:{...s.style,...T,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function E(e){return typeof e==`function`}f(E,`isFunction`);function D(e){return e?`checked`:`unchecked`}f(D,`getState`);var O=u(x)`
|
|
2
|
-
all: unset;
|
|
3
|
-
width: 30px;
|
|
4
|
-
height: 16px;
|
|
5
|
-
padding: 2px;
|
|
6
|
-
border-radius: 9px;
|
|
7
|
-
background: ${({theme:e})=>e.color.ruleStrong};
|
|
8
|
-
border: 1px solid ${({theme:e})=>e.color.rule};
|
|
9
|
-
cursor: pointer;
|
|
10
|
-
transition: background 140ms ease;
|
|
11
|
-
flex: none;
|
|
12
|
-
|
|
13
|
-
&[data-state="checked"] {
|
|
14
|
-
background: ${({theme:e})=>e.color.ok};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
&:disabled {
|
|
18
|
-
opacity: 0.5;
|
|
19
|
-
cursor: not-allowed;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&:focus-visible {
|
|
23
|
-
outline: 2px solid ${({theme:e})=>e.color.accent};
|
|
24
|
-
outline-offset: 2px;
|
|
25
|
-
}
|
|
26
|
-
`,k=u(C)`
|
|
27
|
-
display: block;
|
|
28
|
-
width: 12px;
|
|
29
|
-
height: 12px;
|
|
30
|
-
border-radius: 50%;
|
|
31
|
-
background: ${({theme:e})=>e.color.panel};
|
|
32
|
-
transition: transform 140ms ease;
|
|
33
|
-
transform: translateX(0);
|
|
34
|
-
will-change: transform;
|
|
35
|
-
|
|
36
|
-
&[data-state="checked"] {
|
|
37
|
-
transform: translateX(14px);
|
|
38
|
-
}
|
|
39
|
-
`;function A({checked:e,onCheckedChange:t,label:n,disabled:r,id:i}){return c(O,{checked:e,onCheckedChange:t,"aria-label":n,...r===void 0?{}:{disabled:r},...i===void 0?{}:{id:i},children:c(k,{})})}export{A as t};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import{D as e,Ft as t,G as n,It as r,L as i,Lt as a,N as o,Pt as s,R as c,Zt as l,b as u,c as d,d as f,ft as p,gt as m,h,ht as g,jt as _,lt as ee,n as te,o as v,q as ne,rn as y,s as b,t as x,ut as re,v as ie,wt as ae,y as S,yt as oe,zt as C}from"./Lamp-CL0i4yaa.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-DMrfn4-H.js";import{t as le}from"./CopyValue-DG88CWpN.js";import{t as ue}from"./chevron-down-3tlYNJqZ.js";import{t as de}from"./chevron-right-kvaJRnfj.js";import{t as fe}from"./plus-CVqm87L-.js";import{t as pe}from"./rotate-ccw-Dionx_MW.js";import{t as me}from"./trash-Bsi60qJc.js";import{t as he}from"./Toggle-BTie3NY8.js";import{t as ge}from"./Chip-C3dIFd8s.js";import{i as B,n as V,r as _e,t as H}from"./Field-EvdVyEqx.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-CaPUJ4GJ.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
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
gap: ${({theme:e})=>e.space(3)};
|
|
5
|
-
`,Fe=X.div`
|
|
6
|
-
font-family: ${({theme:e})=>e.font.mono};
|
|
7
|
-
font-size: 26px;
|
|
8
|
-
letter-spacing: 0.22em;
|
|
9
|
-
text-align: center;
|
|
10
|
-
padding: ${({theme:e})=>e.space(3)};
|
|
11
|
-
background: ${({theme:e})=>e.color.panelSunk};
|
|
12
|
-
border: 1px solid ${({theme:e})=>e.color.ruleStrong};
|
|
13
|
-
border-radius: ${({theme:e})=>e.radius.control};
|
|
14
|
-
`,Ie=X.p`
|
|
15
|
-
font-size: 12px;
|
|
16
|
-
color: ${({theme:e})=>e.color.down};
|
|
17
|
-
`,Le=X.p`
|
|
18
|
-
font-size: 12px;
|
|
19
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
20
|
-
`;function Re({open:e,credentials:t,credential:r,onOpenChange:i,onConnected:a}){let o=s().data??[],[c,l]=q(()=>r?.provider??Me(o)),u=n(o,c),[d,f]=q(()=>r?.authType??je(n(o,r?.provider??Me(o)))),[m,h]=q(()=>r?.label??``);K(()=>{r&&(l(r.provider),f(r.authType),h(r.label))},[r]);let g=u?.label??c,[_,te]=q(null),[v,y]=q(``),[b,x]=q(``),ie=(t??[]).filter((e,t,n)=>e.provider===`custom`&&n.findIndex(t=>t.provider===`custom`&&t.providerData.endpointId===e.providerData.endpointId)===t),[ae,S]=q(``),[oe,C]=q(``),[w,T]=q(`chat_completions`),[se,O]=q(``),[j,M]=q(null),N=re(),F=ee(),I=p(),L=G(()=>{te(null),y(``),x(``),S(``),C(``),T(`chat_completions`),O(``),M(null),h(``),N.reset(),F.reset(),I.reset()},[N,F,I]),R=G(e=>{e||L(),i(e)},[i,L]);return K(()=>{if(_===null||_.kind!==`device`)return;let e=!1,t=async()=>{try{let t=await ne(_.flowId);if(e)return;if(t.status===`complete`){L(),i(!1),a();return}}catch(t){if(e)return;M(k(t)),te(null);return}e||(n=setTimeout(()=>void t(),_.pollIntervalMs))},n=setTimeout(()=>void t(),_.pollIntervalMs);return()=>{e=!0,clearTimeout(n)}},[_,a,i,L]),J(ce,{open:e,onOpenChange:R,title:r?`Reconnect ${r.label}`:`Connect an account`,description:`The gateway stores the resulting token encrypted. It is never shown again after this dialog.`,footer:_===null?Y(Te,{children:[J(A,{type:`button`,onClick:()=>R(!1),children:`Cancel`}),J(A,{type:`button`,$variant:`primary`,disabled:N.isPending||I.isPending,onClick:()=>{if(M(null),d===`apiKey`){I.mutate({provider:c,apiKey:se,label:m.trim()||void 0,...c===`custom`?{endpointId:b,endpointLabel:ae,origin:oe,protocol:w}:{}},{onSuccess:()=>{L(),i(!1),a()},onError:e=>M(k(e))});return}N.mutate({provider:c,label:m.trim().length===0?g:m.trim(),...r?{credentialId:r.id}:{}},{onSuccess:e=>te(e),onError:e=>M(k(e))})},children:d===`apiKey`?I.isPending?`Adding…`:`Add API key`:N.isPending?`Starting…`:`Start authorization`})]}):_.kind===`device`?J(A,{type:`button`,onClick:()=>R(!1),children:`Cancel`}):Y(Te,{children:[J(A,{type:`button`,onClick:()=>R(!1),children:`Cancel`}),J(A,{type:`button`,$variant:`primary`,disabled:F.isPending||v.trim().length===0,onClick:()=>{_!==null&&(M(null),F.mutate({flowId:_.flowId,code:v.trim()},{onSuccess:()=>{L(),i(!1),a()},onError:e=>M(k(e))}))},children:F.isPending?`Finishing…`:`Finish connecting`})]}),children:Y(Pe,{children:[_===null?Y(D,{$gap:3,children:[r?null:J(H,{label:`Provider`,children:e=>J(B,{...e,value:c,onChange:e=>{let t=e.target.value;l(t),f(je(n(o,t)))},children:o.map(e=>J(`option`,{value:e.id,children:e.label},e.id))})}),r?null:Ae(u).length>1?J(H,{label:`How to connect`,children:e=>J(B,{...e,value:d,onChange:e=>f(e.target.value),children:Ae(u).map(e=>J(`option`,{value:e,children:$[e]},e))})}):null,c===`custom`?Y(Te,{children:[ie.length===0?null:J(H,{label:`Existing endpoint`,children:e=>Y(B,{...e,value:b,onChange:e=>{let t=ie.find(t=>t.providerData.endpointId===e.target.value);if(t===void 0){x(``),S(``),C(``),T(`chat_completions`);return}x(String(t.providerData.endpointId)),S(String(t.providerData.endpointLabel)),C(String(t.providerData.origin)+String(t.providerData.basePath??``)),T(t.providerData.protocol===`responses`?`responses`:`chat_completions`)},children:[J(`option`,{value:``,children:`Create new endpoint`}),ie.map(e=>J(`option`,{value:String(e.providerData.endpointId),children:String(e.providerData.endpointLabel)},String(e.providerData.endpointId)))]})}),J(H,{label:`Endpoint ID`,children:e=>J(V,{...e,value:b,onChange:e=>x(e.target.value)})}),J(H,{label:`Endpoint label`,children:e=>J(V,{...e,value:ae,onChange:e=>S(e.target.value)})}),J(H,{label:`Server URL`,children:e=>J(V,{...e,value:oe,placeholder:`https://server.example/api`,onChange:e=>C(e.target.value)})}),oe.trim().toLowerCase().startsWith(`http://`)?J(Ie,{children:`Plaintext transport sends prompts and API keys without TLS.`}):null,J(H,{label:`Protocol`,children:e=>Y(B,{...e,value:w,onChange:e=>T(e.target.value),children:[J(`option`,{value:`chat_completions`,children:`Chat Completions (/v1/chat/completions)`}),J(`option`,{value:`responses`,children:`Responses (/v1/responses)`})]})})]}):null,d===`apiKey`?J(H,{label:`API key`,children:e=>J(V,{...e,type:`password`,value:se,autoComplete:`off`,onChange:e=>O(e.target.value)})}):null,J(H,{label:`Label`,hint:`How this account is named in the rack. Defaults to the provider.`,children:e=>J(V,{...e,value:m,placeholder:g,onChange:e=>h(e.target.value)})})]}):Y(D,{$gap:3,children:[Y(D,{$gap:1,children:[J(P,{children:`Step 1 — authorize`}),J(E,{$gap:2,children:Y(A,{as:`a`,href:_.authorizeUrl,target:`_blank`,rel:`noreferrer noopener`,$variant:`primary`,$size:`sm`,children:[J(De,{}),`Open `,g]})}),J(le,{value:_.authorizeUrl,label:`Copy authorization link`})]}),_.userCode===null?null:Y(D,{$gap:1,children:[J(P,{children:`Step 2 — enter this code`}),J(Fe,{children:_.userCode})]}),_.kind===`device`?Y(Le,{children:[u?.pasteHint??``,` Waiting for authorization…`]}):J(H,{label:`Authorization code`,hint:u?.pasteHint??``,...j===null?{}:{problem:j},children:e=>J(V,{...e,value:v,autoFocus:!0,placeholder:Ne(u),onChange:e=>y(e.target.value)})})]}),j===null||_?.kind===`pkce`?null:J(Ie,{children:j})]})})}function ze({credentialId:e,windows:n,burn:r,pollIntervalMs:i,now:a}){let o=n.map(e=>({window:e,estimate:v(r,e.windowType),since:Se(u(e))})),s=o.map(e=>e.since).filter(e=>e!==null),c=s.length===0?0:Math.min(...s),l=t({credentialId:e,since:c},s.length>0),d=l.data?.samples??[],f=l.data?.gatewayRates??[],p=l.data?.truncated===!0;return J(D,{$gap:4,children:o.map(e=>J(Be,{window:e.window,estimate:e.estimate,since:e.since,samples:d.filter(t=>t.windowType===e.window.windowType&&t.observedAt>=(e.since??0)),gatewayRate:f.find(t=>t.windowType===e.window.windowType),truncated:p,pollIntervalMs:i,now:a},e.window.windowType))})}function Be({window:t,estimate:n,since:r,samples:i,gatewayRate:a,truncated:s,pollIntervalMs:c,now:l}){let d=t.limit===null?`${o(t.used)} used`:`${o(t.used)} of ${o(t.limit)} used`,p=e(t,l),m=n===void 0||f(t,l,c)||n.stale&&!p;return J(xe,{live:u(t),samples:i.map(u),since:r,now:l,truncated:s&&r!==null&&i.length>0&&(i[0]?.observedAt??0)>r,ratePerHourRatio:S(t,n),exhaustsAt:n?.exhaustsAt??null,survives:n?.survives??null,stale:m,rolledOver:p,spent:d,rateText:n?.ratePerHour===void 0||n.ratePerHour===null?`unknown`:`${o(n.ratePerHour)}/h`,extraFact:J(Ce,{legend:`This gateway accounts for`,value:a?.gatewayRatePerHour===void 0||a.gatewayRatePerHour===null?`unknown`:`${o(a.gatewayRatePerHour)} tokens/h`})})}function Ve({credential:e,busy:t,onOpenChange:n,onConfirm:r}){let i=C(e?.id??null),a=Date.now(),o=(i.data?.credits??[]).filter(e=>e.status===`available`).sort((e,t)=>(e.expiresAt??1/0)-(t.expiresAt??1/0))[0],s=i.isError||i.isFetching?0:i.data?.available??0,l=e===null?``:i.isFetching?`Reading the reset credits this account holds…`:i.isError?`Could not read reset credits for "${e.label}".`:s===0?`"${e.label}" has no reset credits available.`:`Spend one of ${s} reset ${s===1?`credit`:`credits`} on "${e.label}"? Its usage windows go back to zero at the provider, and the credit cannot be returned.`+(o?.expiresAt==null?``:` The credit spent is the one expiring soonest (${c(o.expiresAt,a)}).`);return J(L,{open:e!==null,onOpenChange:n,title:`Reset quota`,body:l,confirmLabel:`Spend reset`,busy:t||o===void 0||s===0,onConfirm:()=>{e!==null&&o!==void 0&&s>0&&r(e,o.id)}})}var He=X(M)`
|
|
21
|
-
border-left: 3px solid ${({$provider:e})=>z(e)};
|
|
22
|
-
`,Ue=X(V)`
|
|
23
|
-
width: 100%;
|
|
24
|
-
min-width: 140px;
|
|
25
|
-
height: 26px;
|
|
26
|
-
font-family: ${({theme:e})=>e.font.sans};
|
|
27
|
-
font-size: 12.5px;
|
|
28
|
-
background: transparent;
|
|
29
|
-
border-color: transparent;
|
|
30
|
-
|
|
31
|
-
&:hover:not(:disabled),
|
|
32
|
-
&:focus {
|
|
33
|
-
background: ${({theme:e})=>e.color.panelSunk};
|
|
34
|
-
border-color: ${({theme:e})=>e.color.ruleStrong};
|
|
35
|
-
}
|
|
36
|
-
`,We=X(_e)`
|
|
37
|
-
width: 62px;
|
|
38
|
-
height: 26px;
|
|
39
|
-
`,Ge=X.span`
|
|
40
|
-
display: block;
|
|
41
|
-
padding-left: 9px;
|
|
42
|
-
font-size: 11px;
|
|
43
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
44
|
-
`,Ke=X.div`
|
|
45
|
-
margin: 0 0 10px;
|
|
46
|
-
min-height: 16px;
|
|
47
|
-
font-size: 12px;
|
|
48
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
49
|
-
`,qe=X.p`
|
|
50
|
-
margin: 0;
|
|
51
|
-
`,Je=X.ul`
|
|
52
|
-
margin: 4px 0 0;
|
|
53
|
-
padding-left: 16px;
|
|
54
|
-
list-style: disc;
|
|
55
|
-
`,Ye=X.div`
|
|
56
|
-
display: grid;
|
|
57
|
-
/* Bar, figure, legend. The figure has a column of its own so the legends stay
|
|
58
|
-
aligned down the stack whether a window reads 4% or 100%. */
|
|
59
|
-
grid-template-columns: 96px 34px 1fr;
|
|
60
|
-
align-items: center;
|
|
61
|
-
min-width: 208px;
|
|
62
|
-
gap: 6px;
|
|
63
|
-
`,Xe=X(O)`
|
|
64
|
-
font-size: 11px;
|
|
65
|
-
text-align: right;
|
|
66
|
-
`,Ze=X.div`
|
|
67
|
-
display: flex;
|
|
68
|
-
flex-direction: column;
|
|
69
|
-
gap: 4px;
|
|
70
|
-
`;function Qe(){let e=y();return{pending:e.isPending,commit:(t,n)=>{e.mutate({id:t,patch:n})}}}function $e(e,t){if(t===void 0)return` The list of models could not be read, so whether any target is pinned to this account is unknown.`;let n=t.filter(t=>t.targets.some(t=>t.credentialId===e.id)).map(e=>e.id);return n.length===0?``:` ${n.length===1?`The model`:`The models`} ${n.join(`, `)} ${n.length===1?`pins a target`:`pin targets`} to this account. Those targets will fail rather than fall back to another account.`}function et(){let{cadence:e}=I(),t=m(),o=g(e(1e4,`res:credentials`)),u=l(),f=_(),p=s(),ee=oe(),ne=a(),y=r(),[re,S]=q(null),C=ae(),{commit:O}=Qe(),[k,F]=q(!1),[ce,z]=q(null),[le,B]=q([]),[V,_e]=q(new Set),[H,xe]=q(!1),[Se,Ce]=q(null),[G,K]=q(null),[X,Ee]=q(new Set),De=e=>Ee(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),Z=t.data??[],Q=e=>Z.find(t=>t.id===e)?.label??e,Ae=e=>{let t=e[0];if(e.length===1&&t!==void 0){let e=Q(t.credentialId);return t.kind===`refreshed`||t.kind===`coalesced`?`Quota refreshed for ${e}.`:t.kind===`noData`?`No quota data reported for ${e}.`:t.kind===`cooldown`?`Quota refresh is cooling down for ${e}.`:t.kind===`unsupported`?`${e} does not report quota.`:t.kind===`disabled`?`${e} is disabled, so it was not probed.`:`Quota refresh failed for ${e}.`}let n=e.filter(e=>e.kind===`refreshed`||e.kind===`coalesced`).length,r=e.filter(e=>e.kind===`failed`).length,i=e.filter(e=>e.kind===`cooldown`).length,a=e.length-n-r-i;return[`Refreshed ${n} ${n===1?`account`:`accounts`}`,r===0?null:`${r} failed`,i===0?null:`${i} cooling down`,a===0?null:`${a} skipped`].filter(e=>e!==null).join(`; `).concat(`.`)},je=e=>e.filter(e=>e.kind===`failed`||e.kind===`cooldown`||e.kind===`noData`).map(e=>`${Q(e.credentialId)}: ${e.kind===`failed`?`failed`:e.kind===`cooldown`?`cooling down`:`no data reported`}`),Me=async e=>{z(null),B([]),e.kind===`all`?xe(!0):_e(t=>{let n=new Set(t);return n.add(e.credentialId),n});try{let t=await ne.mutateAsync(e);z(Ae(t.outcomes)),B(t.outcomes.length>1?je(t.outcomes):[])}catch{z(e.kind===`all`?`Quota refresh could not be started.`:`Quota refresh could not be started for ${Q(e.credentialId)}.`)}finally{xe(!1),e.kind===`one`&&_e(t=>{let n=new Set(t);return n.delete(e.credentialId),n})}},$=Date.now(),Ne=p.data??[],Pe=e=>n(Ne,e)?.order??1/0,Fe=[...new Set(Z.map(e=>e.provider))].sort((e,t)=>Pe(e)-Pe(t)),Ie=e=>n(Ne,e)?.label??e,Le=d(o.data?.health??[],e=>e.credentialId),Be=d(o.data?.quota??[],e=>e.credentialId),et=d(o.data?.burn??[],e=>e.credentialId),tt=u.data?.quotaPollIntervalMs??3e5,nt=Z.filter(e=>e.enabled).length,rt=t.isLoading?`Reading connected accounts…`:Z.length===0?`No provider credentials are connected, so every request fails at the router.`:`${nt} of ${Z.length} accounts are enabled and eligible for routing.`;return Y(Te,{children:[J(R,{legend:`Accounts`,title:`Provider accounts`,summary:rt,actions:Y(E,{$gap:1,children:[C?Y(A,{type:`button`,$variant:`ghost`,disabled:H||V.size>0,onClick:()=>void Me({kind:`all`}),children:[J(ke,{}),H?`Refreshing quota…`:`Refresh all quota`]}):null,Y(A,{type:`button`,$variant:`primary`,onClick:()=>F(!0),children:[J(fe,{}),`Connect an account`]})]})}),Y(Ke,{children:[J(qe,{role:`status`,"aria-live":`polite`,children:ce??``}),le.length===0?null:J(Je,{children:le.map(e=>J(`li`,{children:e},e))})]}),t.isError?J(M,{legend:`Accounts`,children:J(j,{error:t.error,onRetry:()=>void t.refetch()})}):t.isLoading?J(M,{legend:`Accounts`,children:J(N,{rows:5})}):Z.length===0?J(M,{legend:`Accounts`,children:J(se,{legend:`Nothing connected`,message:`Connect a provider account to give the router something to dispatch to. Tokens are encrypted at rest and never shown again.`,action:J(A,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>F(!0),children:`Connect an account`})})}):J(D,{$gap:4,children:Fe.map(e=>{let t=Z.filter(t=>t.provider===e);return J(He,{$provider:e,legend:Ie(e),meta:`${t.length} account${t.length===1?``:`s`}`,flush:!0,children:J(T,{children:Y(be,{children:[J(`thead`,{children:Y(`tr`,{children:[J(W,{$width:`24%`,children:`Account`}),J(W,{$width:`20%`,children:`Sign-in`}),J(W,{$align:`right`,$width:`86px`,children:`Tier`}),J(W,{$align:`right`,$width:`94px`,children:`Weight`}),J(W,{$align:`center`,$width:`86px`,children:`Enabled`}),J(W,{$width:`240px`,children:`Quota`}),J(W,{$align:`right`,$width:`130px`,children:`Token expires`}),J(W,{$width:`144px`})]})}),J(`tbody`,{children:t.map(e=>{let t=b(Le.get(e.id)??[],$,e.enabled,e.disabledReason),r=Be.get(e.id)??[],a=et.get(e.id)??[],o=ie(r),s=X.has(e.id);return Y(we,{children:[Y(ye,{children:[Y(U,{children:[Y(E,{$gap:2,children:[J(x,{state:t.state,label:t.note===``?`healthy`:t.note}),J(Ue,{defaultValue:e.label,"aria-label":`Label for ${e.label}`,onBlur:t=>{let n=t.target.value.trim();if(n.length===0||n===e.label){t.target.value=e.label;return}O(e.id,{label:n})}})]}),t.note===``?null:J(Ge,{children:t.note})]}),J(U,{children:Y(E,{$gap:1,children:[J(ge,{children:e.authType===`oauth`?`oauth`:`api key`}),e.accountEmail===null?null:J(P,{children:e.accountEmail})]})}),J(U,{$align:`right`,children:J(We,{min:1,step:1,defaultValue:e.tier,"aria-label":`Tier for ${e.label}`,onBlur:t=>{let n=Number(t.target.value);if(!Number.isInteger(n)||n<1||n===e.tier){t.target.value=String(e.tier);return}O(e.id,{tier:n})}})}),J(U,{$align:`right`,children:J(We,{min:.1,step:.1,defaultValue:e.weight,"aria-label":`Weight for ${e.label}`,onBlur:t=>{let n=Number(t.target.value);if(!Number.isFinite(n)||n<=0||n===e.weight){t.target.value=String(e.weight);return}O(e.id,{weight:n})}})}),J(U,{$align:`center`,children:J(he,{checked:e.enabled,label:`Route to ${e.label}`,onCheckedChange:t=>O(e.id,{enabled:t})})}),J(U,{children:o.length===0?J(P,{children:`unknown`}):J(Ze,{children:o.map(({window:e,fraction:t})=>Y(Ye,{children:[J(ve,{fraction:t,label:`${te[e.windowType]} window, ${Math.round(t*100)}% used`}),J(Xe,{children:i(t,0)}),J(P,{children:h(e,$,tt,c,v(a,e.windowType))})]},e.windowType))})}),J(U,{$align:`right`,$mono:!0,children:e.expiresAt===null?`never`:c(e.expiresAt,$)}),J(U,{$align:`right`,children:Y(E,{$gap:1,$justify:`flex-end`,children:[r.length===0?null:J(w,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-expanded":s,"aria-label":`${s?`Hide`:`Show`} quota history for ${e.label}`,title:`${s?`Hide`:`Show`} quota history for ${e.label}`,onClick:()=>De(e.id),children:J(s?ue:de,{})}),C&&e.authType===`oauth`&&n(Ne,e.provider)?.quotaResets===!0?J(w,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Reset quota for ${e.label}`,title:`Reset quota for ${e.label}`,onClick:()=>S(e),children:J(pe,{})}):null,C&&e.authType===`oauth`?J(w,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Reconnect ${e.label}`,title:`Reconnect ${e.label}`,onClick:()=>Ce(e),children:J(Oe,{})}):null,C?J(w,{type:`button`,$variant:`ghost`,$size:`sm`,disabled:H||V.has(e.id),"aria-label":V.has(e.id)?`Refreshing quota for ${e.label}`:`Refresh quota for ${e.label}`,title:`Refresh quota for ${e.label}`,onClick:()=>void Me({kind:`one`,credentialId:e.id}),children:J(ke,{})}):null,J(w,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Remove ${e.label}`,title:`Remove ${e.label}`,onClick:()=>K(e),children:J(me,{})})]})})]}),s?J(ye,{children:J(U,{colSpan:9,children:J(ze,{credentialId:e.id,windows:r,burn:a,pollIntervalMs:tt,now:$})})}):null]},e.id)})})]})})},e)})}),J(Re,{open:k||Se!==null,credentials:t.data??[],credential:Se,onOpenChange:e=>{e?F(!0):(F(!1),Ce(null))},onConnected:()=>void t.refetch()}),J(Ve,{credential:re,busy:y.isPending,onOpenChange:e=>{e||S(null)},onConfirm:(e,t)=>{z(null),B([]),y.mutate({credentialId:e.id,creditId:t},{onSuccess:t=>z(t.quotaRefreshed?`Quota reset for ${e.label}.`:`Quota reset for ${e.label}; the meter updates at the next poll.`),onError:()=>z(`Quota reset failed for ${e.label}.`),onSettled:()=>S(null)})}}),J(L,{open:G!==null,onOpenChange:e=>{e||K(null)},title:`Remove account`,body:G===null?``:`Removing "${G.label}" deletes its stored token. Any model target pointing at ${Ie(G.provider)} loses this account, and reconnecting means authorizing again.`+$e(G,f.data),confirmLabel:`Remove account`,busy:ee.isPending,onConfirm:()=>{G!==null&&ee.mutate(G.id,{onSettled:()=>K(null)})}})]})}var tt=et;export{tt as component};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import{H as e,Mt as t,N as n,dt as r}from"./Lamp-CL0i4yaa.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-DMrfn4-H.js";import{a as f,c as p,o as m,s as h}from"./index-6rZSWe9j.js";import{i as g}from"./Field-EvdVyEqx.js";import{useQueryClient as te}from"@tanstack/react-query";import{useLayoutEffect as ne,useMemo as _,useRef as v,useState as y}from"react";import{Fragment as b,jsx as x,jsxs as S}from"react/jsx-runtime";import C from"styled-components";var w={debug:10,info:20,warn:30,error:40};function T(e){return typeof e==`string`&&e in w}function E(e,t){return!T(t)||e.level===null||w[e.level]>=w[t]}function D(e){if(typeof e!=`object`||!e)return null;let{raw:t,at:n,level:r,msg:i}=e;return typeof t!=`string`||n!==null&&typeof n!=`number`||r!==null&&!T(r)||i!==null&&typeof i!=`string`?null:{raw:t,at:n,level:r,msg:i}}function re(e){if(typeof e!=`object`||!e)return null;let{lines:t}=e;if(!Array.isArray(t))return null;let n=[];for(let e of t){let t=D(e);if(t===null)return null;n.push(t)}return n}var O=[100,200,500],ie=[{value:``,label:`All levels`},{value:`debug`,label:`Debug and above`},{value:`info`,label:`Info and above`},{value:`warn`,label:`Warnings and errors`},{value:`error`,label:`Errors only`}],ae=C(i)`
|
|
2
|
-
gap: ${({theme:e})=>e.space(2)};
|
|
3
|
-
flex-wrap: wrap;
|
|
4
|
-
`,k=C(g)`
|
|
5
|
-
width: auto;
|
|
6
|
-
`,A=C.pre`
|
|
7
|
-
margin: 0;
|
|
8
|
-
padding: ${({theme:e})=>e.space(3)};
|
|
9
|
-
font-family: ${({theme:e})=>e.font.mono};
|
|
10
|
-
font-size: 12px;
|
|
11
|
-
line-height: 1.65;
|
|
12
|
-
white-space: pre;
|
|
13
|
-
`,j=C.div`
|
|
14
|
-
color: ${({theme:e,$level:t})=>t===`error`?e.color.down:t===`warn`?e.color.warn:t===`debug`?e.color.inkFaint:e.color.ink};
|
|
15
|
-
`,M=C.p`
|
|
16
|
-
margin: 0;
|
|
17
|
-
padding: ${({theme:e})=>`${e.space(2)} ${e.space(3)}`};
|
|
18
|
-
border-top: 1px solid ${({theme:e})=>e.color.rule};
|
|
19
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
20
|
-
font-size: 12px;
|
|
21
|
-
`,N=C.code`
|
|
22
|
-
font-family: ${({theme:e})=>e.font.mono};
|
|
23
|
-
word-break: break-all;
|
|
24
|
-
`;function P({read:e}){return e.source===`file`?S(M,{children:[`Reading `,x(N,{children:e.path}),`, named by `,x(N,{children:`OMNI_LOG_FILE`}),`. That variable says where the gateway's output is being captured; it does not redirect it.`]}):e.source===`journal`?S(M,{children:[`Reading the systemd journal for `,x(N,{children:`omnigateway.service`}),`. To read a file instead, redirect the gateway's output to one and point `,x(N,{children:`OMNI_LOG_FILE`}),` at the same path.`]}):e.unreachable!==void 0&&e.unreachable.length>0?S(M,{children:[e.unreachable.length===1?`One process`:`${e.unreachable.length} processes`,` did not answer in time and `,e.unreachable.length===1?`is`:`are`,` not shown:`,` `,e.unreachable.map(e=>e.slice(0,8)).join(`, `),`.`]}):null}var F={single:"Its output is going to a terminal, so there is nothing to read back. To capture it, run the gateway under systemd with `omni service install`, or start it with `omni start`, which redirects output to a file and points OMNI_LOG_FILE at it.",fleet:`No process in this fleet is capturing its own output, so there is nothing to read back. Each one can capture its own — tee its stdout to a file and point OMNI_LOG_FILE at the same path — and this screen will then merge them. For a fleet, ship stdout to a collector instead: Elasticsearch and Kibana, Loki and Grafana, or whatever already reads your containers. This screen shows one process's tail at a time, and a process that is gone takes its log with it.`,process:`This process is not capturing its own output, so there is nothing to read back from it. Tee its stdout to a file and point OMNI_LOG_FILE at the same path, or pick another process.`},I=[],L={read:void 0,lines:I};function R(){let{cadence:i}=u(),g=te(),[C,w]=y(200),[T,D]=y(``),[M,N]=y(``),R=t(),B=R.data?.nodes??[],V=B.length>1,H=M===``&&V?`all`:M,U=H===`all`?`fleet`:V?`process`:`single`,W=H===``||H===`all`?null:`${h}:${H}`,G=r(C,T,i(e,W??`stream:console`),H),K=G.data,[q,J]=y(L),Y=q.read===K?q.lines:I,X=_(()=>[...K?.lines??[],...Y].slice(-C),[K,Y,C]),Z=v(null),Q=v(!0),$=e=>{if(e.kind!==`frame`&&e.kind!==`gap`&&e.kind!==`closed`)return;let t=e.kind===`frame`?re(e.payload):null;if(t===null){J({read:K,lines:I}),e.kind===`frame`&&p(g,h);return}let n=t.filter(e=>E(e,T));n.length!==0&&J(e=>({read:K,lines:[...e.read===K?e.lines:[],...n].slice(-C)}))};return m(h,e=>{W===null&&$(e)}),f(W,$),ne(()=>{let e=Z.current;e!==null&&Q.current&&X.length>0&&(e.scrollTop=e.scrollHeight)},[X]),S(b,{children:[x(d,{legend:`Console`,title:`Gateway output`,summary:G.isLoading?`Reading the gateway's own output…`:`${n(X.length)} lines of what this process is doing. Requests are in Logs; prompt bodies, tokens and keys are never written here.`,actions:S(ae,{children:[V?S(k,{value:H,"aria-label":`Which process to show`,onChange:e=>N(e.target.value),children:[x(`option`,{value:`all`,children:`every process`}),B.map(e=>x(`option`,{value:e.id,children:e.self?`${e.id.slice(0,8)} (this one)`:e.id.slice(0,8)},e.id))]}):null,x(k,{value:T,"aria-label":`Which levels to show`,onChange:e=>D(e.target.value),children:ie.map(e=>x(`option`,{value:e.value,children:e.label},e.value))}),x(k,{value:C,"aria-label":`How many lines to fetch`,onChange:e=>w(Number(e.target.value)),children:O.map(e=>S(`option`,{value:e,children:[`last `,e]},e))})]})}),S(c,{legend:`Process output`,meta:K===void 0?void 0:x(l,{children:z(K)}),flush:!0,children:[K===void 0?null:x(P,{read:K}),x(o,{ref:Z,"data-testid":`console-terminal`,onScroll:e=>{let t=e.currentTarget;Q.current=t.scrollHeight-t.scrollTop-t.clientHeight<=8},children:G.isError?x(s,{error:G.error,onRetry:()=>void G.refetch()}):G.isLoading||R.isLoading?x(`div`,{style:{padding:12},children:x(ee,{rows:10})}):K!==void 0&&K.source===`none`?x(a,{legend:`Nothing is capturing this gateway`,message:F[U]}):X.length===0?x(a,{legend:`Nothing to show`,message:T===``?`This log is empty. The gateway writes here when it boots, refreshes a token, or polls a quota.`:`No line in this window is at that level. Widen the filter to see everything.`}):x(A,{children:X.map((e,t)=>x(j,{$level:e.level,children:e.nodeId===void 0?e.raw:`[${e.nodeId.slice(0,8)}] ${e.raw}`},`${e.at??0}-${t}`))})})]})]})}function z(e){return e.source===`file`?`log file`:e.source===`journal`?`systemd journal`:e.source===`fleet`?`every process, merged`:`not captured`}var B=R;export{B as component};
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import{C as e,E as t,Ht as n,Jt as r,Kt as i,P as a,Tt as o,Yt as s,Zt as c,jt as l,pt as u,qt as d}from"./Lamp-CL0i4yaa.js";import{A as f,E as p,S as m,T as h,a as g,b as _,c as v,k as y,n as b,o as x,s as S,t as C,w,y as T}from"./Panel-CsovmtxF.js";import{A as E,O as D,i as O,r as k,t as A}from"./Rack-DMrfn4-H.js";import{t as j}from"./CopyValue-DG88CWpN.js";import{t as ee}from"./chevron-down-3tlYNJqZ.js";import{t as M}from"./chevron-right-kvaJRnfj.js";import{t as te}from"./plus-CVqm87L-.js";import{t as N}from"./Toggle-BTie3NY8.js";import{t as P}from"./Chip-C3dIFd8s.js";import{a as F,n as I,r as L,t as R}from"./Field-EvdVyEqx.js";import{t as ne}from"./Meter-stpt3vQu.js";import{i as re,n as z,r as B,t as ie}from"./Table-CVDZ69Zx.js";import{a as ae,c as oe,d as se,f as ce,i as V,l as le,n as ue,o as H,r as U,s as W,t as de,u as fe}from"./limits-iRyDMg04.js";import{Fragment as G,useId as pe,useState as K}from"react";import{Fragment as q,jsx as J,jsxs as Y}from"react/jsx-runtime";import X from"styled-components";var Z={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`}]]};Z.node;var me=E(Z),he={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`}]]};he.node;var ge=E(he),_e={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};_e.node;var ve=E(_e);function Q(e,n){return e.revokedAt===null?t(e,n)?`active`:`expired`:`revoked`}function ye(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 be(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 xe=X.p`
|
|
2
|
-
font-size: 12px;
|
|
3
|
-
color: ${({theme:e})=>e.color.down};
|
|
4
|
-
`,Se=X.p`
|
|
5
|
-
font-size: 12px;
|
|
6
|
-
color: ${({theme:e})=>e.color.warn};
|
|
7
|
-
`;function Ce({apiKey:e,onOpenChange:t}){let n=i(),[r,a]=K(()=>ye(e?.expiresAt??null)),[o,s]=K(null),c=()=>{if(e===null)return;let i=be(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(v(e))})},l=e!==null&&Q(e,Date.now())===`expired`;return J(O,{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:Y(q,{children:[J(y,{type:`button`,onClick:()=>t(!1),children:`Cancel`}),J(y,{type:`button`,$variant:`primary`,disabled:n.isPending,onClick:c,children:n.isPending?`Saving…`:`Save expiry`})]}),children:Y(h,{$gap:3,children:[l?J(Se,{role:`status`,children:`This key has expired and the gateway is refusing it. Moving the date forward, or clearing it, brings it back.`}):null,J(R,{label:`Expires`,hint:`Your local time. Blank means the key never expires; a date already past expires it now.`,children:e=>J(I,{...e,type:`datetime-local`,value:r,disabled:n.isPending,onChange:e=>a(e.target.value)})}),o===null?null:J(xe,{role:`alert`,children:o})]})})}var we=X.p`
|
|
8
|
-
font-size: 12px;
|
|
9
|
-
color: ${({theme:e})=>e.color.down};
|
|
10
|
-
`,Te=X.p`
|
|
11
|
-
font-size: 12px;
|
|
12
|
-
color: ${({theme:e})=>e.color.warn};
|
|
13
|
-
`,Ee=X.p`
|
|
14
|
-
font-size: 11px;
|
|
15
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
16
|
-
`,De=X.span`
|
|
17
|
-
font-size: 11px;
|
|
18
|
-
font-family: ${({theme:e})=>e.font.mono};
|
|
19
|
-
color: ${({$over:e,theme:t})=>e?t.color.down:t.color.inkDim};
|
|
20
|
-
`;function Oe({apiKey:t,onOpenChange:n}){let r=d(),i=c(),[a,o]=K(()=>t?.guardrailPolicy??``),[s,l]=K(null),u=a.trim().length,f=u>e,p=e=>{t!==null&&(l(null),r.mutate({id:t.id,policy:e},{onSuccess:()=>n(!1),onError:e=>l(v(e))}))},g=()=>{if(u===0){l(`Write a policy, or use Remove policy to stop judging this key.`);return}if(f){l(`A policy is at most ${e} characters.`);return}p(a)},_=i.data!==void 0&&i.data.guardrailModel===null;return J(O,{open:t!==null,onOpenChange:n,title:`Edit usage policy`,description:t===null?void 0:`What "${t.label}" may be used for. Each request is judged against it by the classifier model before it is routed.`,width:`560px`,footer:Y(q,{children:[t?.guardrailPolicy===null||t===null?null:J(y,{type:`button`,$variant:`danger`,disabled:r.isPending,onClick:()=>p(null),children:`Remove policy`}),J(w,{}),J(y,{type:`button`,onClick:()=>n(!1),children:`Cancel`}),J(y,{type:`button`,$variant:`primary`,disabled:r.isPending,onClick:g,children:r.isPending?`Saving…`:`Save policy`})]}),children:Y(h,{$gap:3,children:[_?J(Te,{role:`status`,children:`No classifier model is set in Settings, so every request from a key with a policy is refused until one is.`}):null,J(R,{label:`Policy`,hint:`Plain language, e.g. Only software engineering and office documents. Refuse roleplay and personal content.`,children:e=>J(F,{...e,value:a,rows:6,disabled:r.isPending,onChange:e=>o(e.target.value)})}),Y(m,{children:[J(Ee,{children:`A guardrail against ordinary misuse, not a security boundary: a determined client can talk a classifier round.`}),J(w,{}),Y(De,{$over:f,children:[u,` / `,e]})]}),s===null?null:J(we,{role:`alert`,children:s})]})})}var ke=X.div`
|
|
21
|
-
display: grid;
|
|
22
|
-
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
23
|
-
gap: ${({theme:e})=>e.space(2)};
|
|
24
|
-
`,Ae=X.p`
|
|
25
|
-
font-size: 11px;
|
|
26
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
27
|
-
`;function $({draft:e,onChange:t,disabled:n=!1}){return Y(h,{$gap:2,children:[J(ke,{children:de.map(r=>{let i=ce(r);return J(R,{label:U(r),children:a=>J(L,{...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)})}),J(Ae,{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 je=X.p`
|
|
28
|
-
font-size: 12px;
|
|
29
|
-
color: ${({theme:e})=>e.color.down};
|
|
30
|
-
`,Me=X.p`
|
|
31
|
-
font-size: 12px;
|
|
32
|
-
color: ${({theme:e})=>e.color.warn};
|
|
33
|
-
`,Ne=X.h3`
|
|
34
|
-
font-size: 12px;
|
|
35
|
-
font-weight: 600;
|
|
36
|
-
color: ${({theme:e})=>e.color.ink};
|
|
37
|
-
`,Pe=X(h)`
|
|
38
|
-
padding-top: ${({theme:e})=>e.space(2)};
|
|
39
|
-
border-top: 1px solid ${({theme:e})=>e.color.rule};
|
|
40
|
-
`,Fe=X.p`
|
|
41
|
-
font-size: 11px;
|
|
42
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
43
|
-
`;function Ie({apiKey:e,onOpenChange:t}){let n=r(),i=l(),[a,o]=K(()=>V(e?.limits??{})),[s,c]=K(()=>fe(e?.limits??{})),[u,d]=K(0),[f,p]=K(null),g=pe(),_=(i.data??[]).map(e=>e.id),b=(e,t)=>{c(n=>n.map(n=>n.id===e?{...n,...t}:n))};return J(O,{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:Y(q,{children:[J(y,{type:`button`,onClick:()=>t(!1),children:`Cancel`}),J(y,{type:`button`,$variant:`primary`,disabled:n.isPending,onClick:()=>{if(e===null)return;let r=ae(a);if(`problem`in r){p(r.problem);return}let i=se(s);if(`problem`in i){p(i.problem);return}let o=Object.keys(i.models).length===0?r.limits:{...r.limits,models:i.models};p(null),n.mutate({id:e.id,limits:o},{onSuccess:()=>t(!1),onError:e=>p(v(e))})},children:n.isPending?`Saving…`:`Save limits`})]}),children:Y(h,{$gap:3,children:[e?.limits===null?J(Me,{role:`status`,children:`The stored limits for this key cannot be read, so the gateway refuses it. Saving here replaces them.`}):null,J($,{draft:a,onChange:o,disabled:n.isPending}),Y(h,{$gap:2,children:[J(Ne,{children:`Per-model overrides`}),J(T,{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.`}),s.map(t=>{let r=t.model,i=r.trim().length===0?`a new model`:r,a=r.trim().length>0&&e?.modelAllowlist!==null&&e?.modelAllowlist!==void 0&&!e.modelAllowlist.includes(r);return Y(Pe,{$gap:2,role:`group`,"aria-label":`Override for ${i}`,children:[Y(m,{$gap:2,$align:`flex-end`,children:[J(R,{label:`Model`,children:e=>J(I,{...e,list:g,disabled:n.isPending,value:t.model,placeholder:`model name`,onChange:e=>b(t.id,{model:e.target.value})})}),J(y,{type:`button`,$variant:`ghost`,disabled:n.isPending,"aria-label":`Remove override for ${i}`,onClick:()=>c(e=>e.filter(e=>e.id!==t.id)),children:`Remove`})]}),a?Y(Fe,{children:[r,` is not in this key's allowed models, so this override applies to no request until it is.`]}):null,J($,{draft:t.slots,onChange:e=>b(t.id,{slots:e}),disabled:n.isPending})]},t.id)}),J(`div`,{children:J(y,{type:`button`,disabled:n.isPending,onClick:()=>{c(e=>[...e,{id:`added-${u}`,model:``,stored:null,slots:V({})}]),d(e=>e+1)},children:`Add model override`})}),J(`datalist`,{id:g,children:_.map(e=>J(`option`,{value:e},e))})]}),f===null?null:J(je,{role:`alert`,children:f})]})})}var Le=X.div`
|
|
44
|
-
display: flex;
|
|
45
|
-
flex-direction: column;
|
|
46
|
-
gap: 2px;
|
|
47
|
-
max-height: 190px;
|
|
48
|
-
overflow-y: auto;
|
|
49
|
-
padding: ${({theme:e})=>e.space(1)};
|
|
50
|
-
border: 1px solid ${({theme:e})=>e.color.ruleStrong};
|
|
51
|
-
border-radius: ${({theme:e})=>e.radius.control};
|
|
52
|
-
background: ${({theme:e})=>e.color.panelSunk};
|
|
53
|
-
`,Re=X.label`
|
|
54
|
-
display: flex;
|
|
55
|
-
align-items: center;
|
|
56
|
-
gap: ${({theme:e})=>e.space(2)};
|
|
57
|
-
padding: 4px 6px;
|
|
58
|
-
border-radius: 2px;
|
|
59
|
-
cursor: pointer;
|
|
60
|
-
font-family: ${({theme:e})=>e.font.mono};
|
|
61
|
-
font-size: 12px;
|
|
62
|
-
|
|
63
|
-
&:hover {
|
|
64
|
-
background: ${({theme:e})=>e.color.panelRaised};
|
|
65
|
-
}
|
|
66
|
-
`,ze=X.p`
|
|
67
|
-
font-size: 11px;
|
|
68
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
69
|
-
`;function Be({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 Y(`div`,{children:[J(Le,{children:i.map(e=>Y(Re,{children:[J(`input`,{type:`checkbox`,disabled:r,"aria-label":e,checked:t.includes(e),onChange:t=>a(e,t.target.checked)}),e]},e))}),o.length>0?J(ze,{children:`Some listed models are no longer configured. They stay until you clear them.`}):null,t.length===0?J(T,{children:`With nothing selected this key is allowed no model.`}):null]})}var Ve=X.p`
|
|
70
|
-
font-size: 12px;
|
|
71
|
-
color: ${({theme:e})=>e.color.down};
|
|
72
|
-
`;function He({apiKey:e,onOpenChange:t}){let n=s(),r=l(),[i,a]=K(e?.modelAllowlist===null),[o,c]=K(()=>e?.modelAllowlist===null?[]:e?.modelAllowlist??[]),[u,d]=K(null),f=(r.data??[]).map(e=>e.id);return J(O,{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:Y(q,{children:[J(y,{type:`button`,onClick:()=>t(!1),children:`Cancel`}),J(y,{type:`button`,$variant:`primary`,disabled:n.isPending,onClick:()=>{e!==null&&(d(null),n.mutate({id:e.id,modelAllowlist:i?null:o},{onSuccess:()=>t(!1),onError:e=>d(v(e))}))},children:n.isPending?`Saving…`:`Save models`})]}),children:Y(h,{$gap:3,children:[Y(h,{$gap:2,children:[Y(m,{$gap:2,children:[J(N,{checked:i,label:`Allow every model`,onCheckedChange:e=>{a(e),e&&c([])}}),J(T,{as:`span`,children:`Allow every model`})]}),i?null:J(Be,{configured:f,checked:o,onChange:c,disabled:n.isPending})]}),u===null?null:J(Ve,{role:`alert`,children:u})]})})}var Ue=X.div`
|
|
73
|
-
display: grid;
|
|
74
|
-
grid-template-columns: minmax(0, 11rem) minmax(0, 12rem) minmax(0, 1fr) minmax(0, 3.5rem);
|
|
75
|
-
align-items: center;
|
|
76
|
-
gap: ${({theme:e})=>e.space(2)} ${({theme:e})=>e.space(4)};
|
|
77
|
-
`,We=X.span`
|
|
78
|
-
font-size: 11.5px;
|
|
79
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
80
|
-
`,Ge=X.h4`
|
|
81
|
-
font-family: ${({theme:e})=>e.font.mono};
|
|
82
|
-
font-size: 12px;
|
|
83
|
-
font-weight: 600;
|
|
84
|
-
color: ${({theme:e})=>e.color.ink};
|
|
85
|
-
`,Ke=X.p`
|
|
86
|
-
font-size: 11px;
|
|
87
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
88
|
-
`;function qe({label:e,readings:t}){let n=oe(t),r=n.some(e=>e.model!==null);return Y(h,{$gap:3,children:[n.map(t=>{let n=t.model??`Every model`,i=J(Je,{label:e,model:t.model,readings:t.readings},n);return r?Y(h,{$gap:2,role:`group`,"aria-label":n,children:[J(Ge,{children:n}),i]},n):i}),J(Ke,{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 Je({label:e,model:t,readings:n}){let r=t===null?e:`${e}, ${t}`;return J(Ue,{children:n.map(e=>{let t=U({dimension:e.dimension,window:e.window}),n=W(e),i=H(e.dimension,e.limit);return Y(G,{children:[J(T,{as:`span`,children:t}),J(_,{children:e.used===null?i:`${H(e.dimension,e.used)} of ${i}`}),n===null?J(We,{children:`in flight now, counted in the gateway process`}):J(ne,{fraction:Math.min(1,n),label:`${r}, ${t}, ${Math.round(n*100)}% used`}),J(_,{children:n===null?`—`:`${Math.round(n*100)}%`})]},t)})})}var Ye=X.p`
|
|
89
|
-
font-size: 12px;
|
|
90
|
-
color: ${({theme:e})=>e.color.warn};
|
|
91
|
-
`,Xe=X.p`
|
|
92
|
-
font-size: 11px;
|
|
93
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
94
|
-
`,Ze=X.p`
|
|
95
|
-
font-size: 12px;
|
|
96
|
-
color: ${({theme:e})=>e.color.down};
|
|
97
|
-
`,Qe=X.p`
|
|
98
|
-
font-size: 12px;
|
|
99
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
100
|
-
`,$e=X(y)`
|
|
101
|
-
gap: 4px;
|
|
102
|
-
`;function et({open:e,onOpenChange:t}){let n=l(),r=u(),[i,a]=K(``),[o,s]=K(!0),[c,d]=K([]),[f,p]=K(()=>V({})),[g,b]=K(!1),[x,S]=K(``),[C,w]=K(!1),[E,D]=K(null),[k,A]=K(null),te=()=>{a(``),s(!0),d([]),p(V({})),b(!1),S(``),w(!1),D(null),A(null),r.reset()},P=e=>{e||te(),t(e)},F=Object.values(f).filter(e=>e.trim().length>0).length;return J(O,{open:e,onOpenChange:P,title:E===null?`Create an API key`:`Key created`,description:E===null?`Clients send this key as a bearer token or as x-api-key on every /v1 request.`:void 0,footer:E===null?Y(q,{children:[J(y,{type:`button`,onClick:()=>P(!1),children:`Cancel`}),J(y,{type:`button`,$variant:`primary`,disabled:r.isPending,onClick:()=>{let e=ae(f);if(`problem`in e){b(!0),A(e.problem);return}let t=be(x);if(`problem`in t){A(t.problem);return}A(null),r.mutate({label:i.trim().length===0?`api key`:i.trim(),modelAllowlist:o?null:c,limits:e.limits,bodyLoggingOptOut:C,expiresAt:t.at},{onSuccess:e=>D(e),onError:e=>A(v(e))})},children:r.isPending?`Creating…`:`Create key`})]}):J(y,{type:`button`,$variant:`primary`,onClick:()=>P(!1),children:`I have copied the key`}),children:E===null?Y(h,{$gap:3,children:[J(R,{label:`Label`,hint:`Names the client this key belongs to, e.g. laptop or CI.`,children:e=>J(I,{...e,value:i,placeholder:`api key`,onChange:e=>a(e.target.value)})}),Y(h,{$gap:2,children:[Y(m,{$gap:2,children:[J(N,{checked:o,label:`Allow every model`,onCheckedChange:s}),J(T,{as:`span`,children:`Allow every model`})]}),o?null:Y(q,{children:[J(Be,{configured:(n.data??[]).map(e=>e.id),checked:c,onChange:d}),c.length===0?J(Ye,{children:`With no model selected this key is allowed nothing and every request it makes will be refused.`}):null]})]}),Y(h,{$gap:2,children:[Y(m,{$gap:2,children:[Y($e,{type:`button`,$size:`sm`,"aria-expanded":g,onClick:()=>b(e=>!e),children:[J(g?ee:M,{}),`Limits`]}),J(T,{as:`span`,children:F===0?`no limits; this key is unbounded`:`${F} limit${F===1?``:`s`} set`})]}),g?J($,{draft:f,onChange:p}):null]}),J(R,{label:`Expires`,hint:`Optional. Your local time; blank means the key never expires.`,children:e=>J(I,{...e,type:`datetime-local`,value:x,onChange:e=>S(e.target.value)})}),Y(h,{$gap:2,children:[Y(m,{$gap:2,children:[J(N,{checked:C,label:`Never record this key's bodies`,onCheckedChange:w}),J(T,{as:`span`,children:`Never record this key's bodies`})]}),J(Xe,{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.`})]}),k===null?null:J(Ze,{role:`alert`,children:k})]}):Y(h,{$gap:3,children:[J(Qe,{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.`}),J(j,{value:E.key,label:`Copy API key`}),Y(m,{$gap:2,children:[J(T,{children:`Label`}),J(_,{children:E.label}),J(T,{children:`Prefix`}),J(_,{children:E.prefix})]})]})})}var tt=X(m)`
|
|
103
|
-
gap: 4px;
|
|
104
|
-
flex-wrap: wrap;
|
|
105
|
-
max-width: 34ch;
|
|
106
|
-
`,nt=X.span`
|
|
107
|
-
color: ${({theme:e})=>e.color.inkFaint};
|
|
108
|
-
`,rt=X.span`
|
|
109
|
-
display: block;
|
|
110
|
-
font-size: 11px;
|
|
111
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
112
|
-
`,it=X.span`
|
|
113
|
-
font-size: 11px;
|
|
114
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
115
|
-
`,at=X.div`
|
|
116
|
-
display: flex;
|
|
117
|
-
flex-direction: column;
|
|
118
|
-
align-items: flex-end;
|
|
119
|
-
gap: 2px;
|
|
120
|
-
`;function ot(e){if(e===null)return`usage not counted here`;let t=W(e);return`${ue(e)} ${H(e.dimension,e.limit)}, ${t===null?`—`:Math.round(t*100)}% used`}function st(){let e=o(),t=n(),[r,i]=K(!1),[s,c]=K(null),[l,u]=K(null),[d,h]=K(null),[_,v]=K(null),[w,E]=K(null),[O,j]=K(null),N=Date.now(),F=e.data??[],I=F.filter(e=>Q(e,N)===`active`),L=e.isLoading?`Reading issued keys…`:F.length===0?`No keys exist, so nothing can call this gateway yet.`:`${I.length} active key${I.length===1?``:`s`} of ${F.length} ever issued.`;return Y(q,{children:[J(A,{legend:`Keys`,title:`Gateway API keys`,summary:L,actions:Y(y,{type:`button`,$variant:`primary`,onClick:()=>i(!0),children:[J(te,{}),`Create a key`]})}),J(C,{legend:`Issued keys`,meta:`${F.length}`,flush:!0,children:e.isError?J(x,{error:e.error,onRetry:()=>void e.refetch()}):e.isLoading?J(`div`,{style:{padding:12},children:J(S,{rows:4})}):F.length===0?J(g,{legend:`No keys`,message:`Create a key and give it to a client. The key is shown once, at creation.`,action:J(y,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>i(!0),children:`Create a key`})}):J(b,{children:Y(ie,{children:[J(`thead`,{children:Y(`tr`,{children:[J(B,{children:`Label`}),J(B,{children:`Prefix`}),J(B,{children:`Allowed models`}),J(B,{$align:`right`,children:`Limits`}),J(B,{$align:`right`,children:`Created`}),J(B,{children:`Body capture`}),J(B,{children:`Usage policy`}),J(B,{children:`Status`}),J(B,{})]})}),J(`tbody`,{children:F.map(e=>{let t=w===e.id,n=le(e.limitUsage),r=Q(e,N);return Y(G,{children:[Y(re,{children:[J(z,{children:J(p,{style:{maxWidth:`24ch`,display:`block`},children:e.label})}),Y(z,{$mono:!0,children:[e.prefix,`…`]}),J(z,{children:e.modelAllowlist===null?J(T,{children:`every model`}):e.modelAllowlist.length===0?J(P,{$tone:`down`,children:`no models`}):J(tt,{children:e.modelAllowlist.map(e=>J(P,{children:e},e))})}),J(z,{$align:`right`,children:e.limits===null?J(P,{$tone:`down`,children:`unreadable`}):e.limitUsage.length===0?J(T,{children:`no limits`}):Y(at,{children:[Y(`span`,{children:[e.limitUsage.length,` limit`,e.limitUsage.length===1?``:`s`]}),J(it,{children:ot(n)})]})}),J(z,{$align:`right`,$mono:!0,children:a(e.createdAt)}),J(z,{children:e.bodyLoggingOptOut?J(P,{children:`no bodies`}):J(T,{children:`—`})}),J(z,{children:e.guardrailPolicy===null?J(T,{children:`—`}):J(P,{title:e.guardrailPolicy,children:`judged`})}),Y(z,{children:[r===`revoked`?J(nt,{title:a(e.revokedAt??0),children:J(P,{children:`revoked`})}):r===`expired`?J(P,{$tone:`down`,children:`expired`}):J(P,{$tone:`ok`,children:`active`}),e.expiresAt===null?null:Y(rt,{children:[r===`expired`?`expired`:`expires`,` `,a(e.expiresAt)]})]}),J(z,{$align:`right`,children:Y(m,{$gap:1,$justify:`flex-end`,children:[e.limitUsage.length===0?null:J(f,{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:()=>E(t?null:e.id),children:J(t?ee:M,{})}),e.revokedAt===null?Y(q,{children:[J(f,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Edit models for ${e.label}`,title:`Edit models for ${e.label}`,onClick:()=>u(e),children:J(ge,{})}),J(f,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Edit limits for ${e.label}`,title:`Edit limits for ${e.label}`,onClick:()=>c(e),children:J(D,{})}),J(f,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Edit expiry for ${e.label}`,title:`Edit expiry for ${e.label}`,onClick:()=>h(e),children:J(me,{})}),J(f,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Edit usage policy for ${e.label}`,title:`Edit usage policy for ${e.label}`,onClick:()=>v(e),children:J(ve,{})}),J(y,{type:`button`,$variant:`danger`,$size:`sm`,onClick:()=>j(e),children:`Revoke`})]}):null]})})]}),t?J(re,{children:J(z,{colSpan:9,children:J(qe,{label:e.label,readings:e.limitUsage})})}):null]},e.id)})})]})})}),J(et,{open:r,onOpenChange:i}),J(Ie,{apiKey:s,onOpenChange:e=>{e||c(null)}},s?.id??`none`),J(He,{apiKey:l,onOpenChange:e=>{e||u(null)}},l?.id??`none`),J(Ce,{apiKey:d,onOpenChange:e=>{e||h(null)}},d?.id??`none`),J(Oe,{apiKey:_,onOpenChange:e=>{e||v(null)}},_?.id??`none`),J(k,{open:O!==null,onOpenChange:e=>{e||j(null)},title:`Revoke key`,body:O===null?``:`Revoking "${O.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:t.isPending,onConfirm:()=>{O!==null&&t.mutate(O.id,{onSettled:()=>j(null)})}})]})}var ct=st;export{ct as component};
|