omnigateway 0.1.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +27 -33
  2. package/bin/omni.js +607 -78
  3. package/gateway.js +2877 -150
  4. package/package.json +1 -1
  5. package/public/assets/{Chip-CM9ZMdr9.js → Chip-BB_5C1Zp.js} +1 -1
  6. package/public/assets/Confirm-B6aAiVbT.js +4 -0
  7. package/public/assets/{CopyValue-WrOTcHwq.js → CopyValue-CRQDLo7k.js} +1 -1
  8. package/public/assets/{Field-Br6jKPz8.js → Field-uHZxl4fI.js} +1 -1
  9. package/public/assets/Lamp-B-5SjXbG.js +25 -0
  10. package/public/assets/{Meter-BzMaum0C.js → Meter-DI_BRUKt.js} +1 -1
  11. package/public/assets/Modal-CI6jk2D4.js +82 -0
  12. package/public/assets/{Rack-BFWC50ex.js → Rack-D1WJswv3.js} +8 -4
  13. package/public/assets/{Readout-DMJs4gYD.js → Readout-BocZ2HXP.js} +1 -1
  14. package/public/assets/{States-BNeCLhZn.js → States-Bbiu5cHE.js} +1 -1
  15. package/public/assets/{Table-nOg_lgEJ.js → Table-CdPWxYaz.js} +1 -1
  16. package/public/assets/Toggle-CiLC67Dw.js +39 -0
  17. package/public/assets/TokenBreakdown-B96iPBm9.js +28 -0
  18. package/public/assets/_app-BBOF6A0T.js +1 -0
  19. package/public/assets/{_app.accounts-BTb5vHI_.js → _app.accounts-BNkhpvaB.js} +8 -5
  20. package/public/assets/_app.console-Daz4aKhf.js +44 -0
  21. package/public/assets/_app.index-LO6d38oe.js +62 -0
  22. package/public/assets/{_app.keys-B-cy-2DS.js → _app.keys-kBqLqoFf.js} +3 -3
  23. package/public/assets/_app.logs-_wYNS47N.js +32 -0
  24. package/public/assets/{_app.models-BAmXHlf2.js → _app.models-Cjng8ohC.js} +5 -5
  25. package/public/assets/_app.settings-a0FKyQAi.js +38 -0
  26. package/public/assets/{_app.usage-BLrQ2hB8.js → _app.usage-D3KtgLrC.js} +9 -6
  27. package/public/assets/dist-C-IbPRiV.js +1 -0
  28. package/public/assets/index-PW6EvVh5.js +170 -0
  29. package/public/assets/{login-BpUl6C5b.js → login-CTvH_KAd.js} +1 -1
  30. package/public/assets/queries-D2o-X8Pj.js +144 -0
  31. package/public/assets/{trash-2-DjWP2u19.js → trash-2-BcZb-sCT.js} +1 -1
  32. package/public/index.html +2 -2
  33. package/public/assets/Lamp-DO-sRDg2.js +0 -25
  34. package/public/assets/Modal-lhjr949H.js +0 -82
  35. package/public/assets/Toggle-DYoCVD37.js +0 -42
  36. package/public/assets/_app-lXr06Xli.js +0 -1
  37. package/public/assets/_app.console-DHUClMsI.js +0 -25
  38. package/public/assets/_app.index-DZ--9mKU.js +0 -61
  39. package/public/assets/_app.logs-BQjAIT2P.js +0 -33
  40. package/public/assets/_app.settings-CG8bv_rm.js +0 -34
  41. package/public/assets/index-UAZ0O5y0.js +0 -170
  42. package/public/assets/queries-D_-Jj9vt.js +0 -144
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnigateway",
3
- "version": "0.1.8",
3
+ "version": "0.2.0",
4
4
  "description": "Self-hosted AI gateway with Anthropic- and OpenAI-compatible APIs, an admin console, and a CLI",
5
5
  "license": "MIT",
6
6
  "author": "Harismawan <mail@harismawan.com>",
@@ -1,4 +1,4 @@
1
- import{G as e,Mt as t}from"./queries-D_-Jj9vt.js";var n=t(),r={neutral:{fg:`var(--ink-dim)`,bg:`transparent`},ok:{fg:`var(--ok)`,bg:`var(--ok-wash)`},warn:{fg:`var(--warn)`,bg:`var(--warn-wash)`},down:{fg:`var(--down)`,bg:`var(--down-wash)`},accent:{fg:`var(--accent)`,bg:`var(--accent-wash)`}},i=e.span`
1
+ import{G as e,Mt as t}from"./queries-D2o-X8Pj.js";var n=t(),r={neutral:{fg:`var(--ink-dim)`,bg:`transparent`},ok:{fg:`var(--ok)`,bg:`var(--ok-wash)`},warn:{fg:`var(--warn)`,bg:`var(--warn-wash)`},down:{fg:`var(--down)`,bg:`var(--down-wash)`},accent:{fg:`var(--accent)`,bg:`var(--accent-wash)`}},i=e.span`
2
2
  display: inline-flex;
3
3
  align-items: center;
4
4
  gap: 4px;
@@ -0,0 +1,4 @@
1
+ import{B as e,G as t,Mt as n}from"./queries-D2o-X8Pj.js";import{h as r}from"./Rack-D1WJswv3.js";import{t as i}from"./Modal-CI6jk2D4.js";var a=r(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),o=n(),s=t.p`
2
+ font-size: 13px;
3
+ color: ${({theme:e})=>e.color.inkDim};
4
+ `;function c({open:t,onOpenChange:n,title:r,body:a,confirmLabel:c,busy:l,onConfirm:u}){return(0,o.jsx)(i,{open:t,onOpenChange:n,title:r,width:`420px`,footer:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e,{type:`button`,onClick:()=>n(!1),children:`Cancel`}),(0,o.jsx)(e,{type:`button`,$variant:`danger`,disabled:l===!0,onClick:u,children:c})]}),children:(0,o.jsx)(s,{children:a})})}export{a as n,c as t};
@@ -1,4 +1,4 @@
1
- import{G as e,L as t,Mt as n,Nt as r,V as i,Zt as a}from"./queries-D_-Jj9vt.js";import{m as o}from"./Rack-BFWC50ex.js";var s=o(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),c=o(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),l=a(r(),1);function u(e){if(e===null||typeof getSelection!=`function`)return!1;let t=getSelection();if(t===null)return!1;try{let n=document.createRange();return n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n),!0}catch{return!1}}async function d(e,t){if(typeof navigator<`u`&&navigator.clipboard!==void 0)try{return await navigator.clipboard.writeText(e),`copied`}catch{}let n=u(t??null);if(n&&typeof document.execCommand==`function`)try{if(document.execCommand(`copy`))return`copied`}catch{}return n?`selected`:`failed`}var f=n(),p=e.div`
1
+ import{G as e,L as t,Mt as n,Nt as r,V as i,Zt as a}from"./queries-D2o-X8Pj.js";import{h as o}from"./Rack-D1WJswv3.js";var s=o(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),c=o(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),l=a(r(),1);function u(e){if(e===null||typeof getSelection!=`function`)return!1;let t=getSelection();if(t===null)return!1;try{let n=document.createRange();return n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n),!0}catch{return!1}}async function d(e,t){if(typeof navigator<`u`&&navigator.clipboard!==void 0)try{return await navigator.clipboard.writeText(e),`copied`}catch{}let n=u(t??null);if(n&&typeof document.execCommand==`function`)try{if(document.execCommand(`copy`))return`copied`}catch{}return n?`selected`:`failed`}var f=n(),p=e.div`
2
2
  display: flex;
3
3
  align-items: stretch;
4
4
  gap: 0;
@@ -1,4 +1,4 @@
1
- import{G as e,Mt as t,Nt as n,Zt as r,j as i}from"./queries-D_-Jj9vt.js";var a=r(n(),1),o=t(),s=`
1
+ import{G as e,Mt as t,Nt as n,Zt as r,j as i}from"./queries-D2o-X8Pj.js";var a=r(n(),1),o=t(),s=`
2
2
  width: 100%;
3
3
  border-radius: 3px;
4
4
  transition: border-color 120ms ease;
@@ -0,0 +1,25 @@
1
+ import{G as e,H as t,Mt as n,W as r}from"./queries-D2o-X8Pj.js";function i(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>e-t);return n[Math.min(n.length-1,Math.max(0,Math.ceil(t*n.length)-1))]??null}function a(e){return e.state===`pending`}function o(e){return e.filter(e=>!a(e))}function s(e){return a(e)?!1:e.status>=400||e.errorCode!==null}var c={ok:`●`,warn:`◐`,down:`○`,idle:`·`,live:`●`};function l(e){return a(e)?`live`:s(e)?`down`:`ok`}function u(e){return a(e)?`in flight`:s(e)?`failed with ${e.status}`:`succeeded`}function d(e,t){let n=o(e),r=[],a=0,c=0,l=0,u=0,d=0,f=0;for(let e of n)s(e)&&(a+=1),e.ttftMs!==null&&Number.isFinite(e.ttftMs)&&r.push(e.ttftMs),c+=e.costUsd,l+=e.inputTokens,u+=e.outputTokens,d+=e.cacheReadTokens,f+=e.cacheWriteTokens;let p=t/6e4;return{requests:n.length,errors:a,errorRate:n.length===0?0:a/n.length,ratePerMin:p<=0?0:n.length/p,ttftP50:i(r,.5),ttftP95:i(r,.95),costUsd:c,inputTokens:l,outputTokens:u,cacheReadTokens:d,cacheWriteTokens:f}}function f(e,t){let n=o(e),{now:r,spanMs:a,count:c}=t,l=a/c,u=r-a,d=Array.from({length:c},(e,t)=>({at:u+t*l,total:0,errors:0,costUsd:0,tokens:0,ttftMs:null})),f=Array.from({length:c},()=>[]);for(let e of n){if(e.at<u||e.at>r)continue;let t=Math.min(c-1,Math.floor((e.at-u)/l)),n=d[t];n!==void 0&&(n.total+=1,n.costUsd+=e.costUsd,n.tokens+=e.inputTokens+e.outputTokens+e.cacheReadTokens+e.cacheWriteTokens,s(e)&&(n.errors+=1),e.ttftMs!==null&&Number.isFinite(e.ttftMs)&&f[t]?.push(e.ttftMs))}for(let[e,t]of d.entries())t.ttftMs=i(f[e]??[],.5);return d}var p={tokenRejected:`reconnect needed — provider rejected the refresh token`,expiredNoRefresh:`reconnect needed — token expired with nothing to refresh from`};function m(e,t,n,r=null){if(!n){let e=r===`tokenRejected`||r===`expiredNoRefresh`;return{state:e?`down`:`idle`,note:e?p[r]:`disabled`,ttftMs:null,lastUsedAt:null,consecutiveFailures:0}}if(e.length===0)return{state:`idle`,note:`unused`,ttftMs:null,lastUsedAt:null,consecutiveFailures:0};let i=`ok`,a=``,o=null,s=null,c=0;for(let n of e){if(n.ewmaTtftMs!==null&&(o=o===null?n.ewmaTtftMs:Math.max(o,n.ewmaTtftMs)),n.lastUsedAt!==null&&(s=s===null?n.lastUsedAt:Math.max(s,n.lastUsedAt)),c=Math.max(c,n.consecutiveFailures),n.breakerState===`open`){i=`down`,a=`breaker open`;continue}if(n.rateLimitedUntil!==null&&n.rateLimitedUntil>t&&i!==`down`){i=`warn`,a=`rate limited`;continue}n.breakerState===`halfOpen`&&i===`ok`&&(i=`warn`,a=`probing`)}return{state:i,note:a,ttftMs:o,lastUsedAt:s,consecutiveFailures:c}}var h={fiveHour:`5h`,daily:`24h`,weekly:`7d`};function g(e){return Math.max(e,6e4)*3}function _(e,t,n){return e.observedAt<=0||t-e.observedAt>g(n)}function v(e,t,n,r){let i=h[e.windowType];return e.observedAt<=0?`${i} · never observed`:_(e,t,n)?`${i} · stale, read ${r(e.observedAt,t)}`:e.resetsAt===null?i:`${i} · resets ${r(e.resetsAt,t)}`}var y={fiveHour:0,daily:1,weekly:2};function b(e){return e.filter(e=>e.limit!==null&&e.limit>0).map(e=>({window:e,fraction:Math.min(1,e.used/e.limit)})).sort((e,t)=>y[e.window.windowType]-y[t.window.windowType])}function x(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e);i===void 0?n.set(e,[r]):i.push(r)}return n}var S=n(),C=t`
2
+ 0%, 100% { opacity: 1; }
3
+ 50% { opacity: 0.28; }
4
+ `,w=r`
5
+ color: ${({theme:e})=>e.color.ok};
6
+ animation: ${C} 1.2s ease-in-out infinite;
7
+
8
+ @media (prefers-reduced-motion: reduce) {
9
+ animation: none;
10
+ }
11
+ `,T={ok:r`
12
+ color: ${({theme:e})=>e.color.ok};
13
+ `,warn:r`
14
+ color: ${({theme:e})=>e.color.warn};
15
+ `,down:r`
16
+ color: ${({theme:e})=>e.color.down};
17
+ `,idle:r`
18
+ color: ${({theme:e})=>e.color.inkFaint};
19
+ `,live:w},E=e.span`
20
+ font-family: ${({theme:e})=>e.font.mono};
21
+ font-size: 12px;
22
+ line-height: 1;
23
+ flex: none;
24
+ ${({$state:e})=>T[e]}
25
+ `;function D({state:e,label:t,className:n}){return(0,S.jsx)(E,{$state:e,className:n,role:`img`,"aria-label":t,title:t,children:c[e]})}export{x as a,u as c,b as d,d as f,m as i,l,h as n,s as o,f as r,a as s,D as t,v as u};
@@ -1,4 +1,4 @@
1
- import{G as e,Mt as t}from"./queries-D_-Jj9vt.js";var n=t(),r=e.div`
1
+ import{G as e,Mt as t}from"./queries-D2o-X8Pj.js";var n=t(),r=e.div`
2
2
  position: relative;
3
3
  width: 100%;
4
4
  height: ${({$height:e})=>e}px;
@@ -0,0 +1,82 @@
1
+ import{G as e,I as t,J as n,Mt as r,Nt as i,V as a,Zt as o,j as s}from"./queries-D2o-X8Pj.js";import{h as c}from"./Rack-D1WJswv3.js";import{a as l,c as u,i as d,n as f,o as p,r as m,s as h,t as g}from"./dist-C-IbPRiV.js";var _=c(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),v=r(),ee=o(n(),1),y=o(i(),1),b=Object.defineProperty,x=(e,t)=>b(e,`name`,{value:t,configurable:!0});function S(e,t){return y.useReducer((e,n)=>t[e][n]??e,e)}x(S,`useStateMachine`);var C=x(e=>{let{present:t,children:n}=e,r=te(t),i=typeof n==`function`?n({present:r.isPresent}):y.Children.only(n),a=T(r.ref,D(i));return typeof n==`function`||r.isPresent?y.cloneElement(i,{ref:a}):null},`Presence`);function te(e){let[t,n]=y.useState(),r=y.useRef(null),i=y.useRef(e),a=y.useRef(`none`),o=y.useRef(void 0),[s,c]=S(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return y.useEffect(()=>{s===`mounted`?(a.current=o.current??E(r.current),o.current=void 0):a.current=`none`},[s]),f(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=E(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),f(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=x(a=>{let o=E(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=x(e=>{e.target===t&&(a.current=E(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:y.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=E(t)}else r.current=null;n(e)},[])}}x(te,`usePresence`);function w(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}x(w,`setRef`);function T(...e){let t=y.useRef(e);return t.current=e,y.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=w(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():w(n[e],null)}}},[])}x(T,`useStableComposedRefs`);function E(e){return e?.animationName||`none`}x(E,`getAnimationName`);function D(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}x(D,`getElementRef`);var ne=Object.defineProperty,O=(e,t)=>ne(e,`name`,{value:t,configurable:!0}),re=y.useId||(()=>void 0),ie=0;function k(e){let[t,n]=y.useState(re());return f(()=>{e||n(e=>e??String(ie++))},[e]),e||(t?`radix-${t}`:``)}O(k,`useId`);var ae=Object.defineProperty,oe=(e,t)=>ae(e,`name`,{value:t,configurable:!0});function A(e){let t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>((...e)=>t.current?.(...e)),[])}oe(A,`useCallbackRef`);var se=Object.defineProperty,j=(e,t)=>se(e,`name`,{value:t,configurable:!0}),ce=`dismissableLayer.update`,le=`dismissableLayer.pointerDownOutside`,ue=`dismissableLayer.focusOutside`,de,fe=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),pe=y.forwardRef(j(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...d}=e,f=y.useContext(fe),[p,h]=y.useState(null),g=p?.ownerDocument??globalThis?.document,[,_]=y.useState({}),ee=u(t,h),b=Array.from(f.layers),[x]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),S=x?b.indexOf(x):-1,C=p?b.indexOf(p):-1,te=f.layersWithOutsidePointerEventsDisabled.size>0,w=C>=S,T=y.useRef(!1),E=ge(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:g,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:y.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...f.branches].some(t=>t.contains(e));return w&&!t},[f.branches,w])}),D=_e(e=>{if(r&&T.current)return;let t=e.target;[...f.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},g),ne=p?C===b.length-1:!1,O=A(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return y.useEffect(()=>{if(ne)return g.addEventListener(`keydown`,O,{capture:!0}),()=>g.removeEventListener(`keydown`,O,{capture:!0})},[g,ne,O]),y.useEffect(()=>{if(p)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(de=g.body.style.pointerEvents,g.body.style.pointerEvents=`none`),f.layersWithOutsidePointerEventsDisabled.add(p)),f.layers.add(p),ve(),()=>{n&&(f.layersWithOutsidePointerEventsDisabled.delete(p),f.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=de))}},[p,g,n,f]),y.useEffect(()=>()=>{p&&(f.layers.delete(p),f.layersWithOutsidePointerEventsDisabled.delete(p),ve())},[p,f]),y.useEffect(()=>{let e=j(()=>_({}),`handleUpdate`);return document.addEventListener(ce,e),()=>document.removeEventListener(ce,e)},[]),(0,v.jsx)(l.div,{...d,ref:ee,style:{pointerEvents:te?w?`auto`:`none`:void 0,...e.style},onFocusCapture:m(e.onFocusCapture,D.onFocusCapture),onBlurCapture:m(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:m(e.onPointerDownCapture,E.onPointerDownCapture)})},`DismissableLayer`));function me(){let e=y.useContext(fe),[t,n]=y.useState(null);return y.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}j(me,`useDismissableLayerSurface`);var he=j(()=>!0,`IS_TRUE`);function ge(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=he}=t,s=A(e),c=y.useRef(!1),l=y.useRef(!1),u=y.useRef(new Map),d=y.useRef(()=>{});return y.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}j(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}j(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}j(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}j(p,`handleInteractionBubble`);let m=j(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||ye(le,s,p,{discrete:!0})};if(j(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:j(()=>c.current=!0,`onPointerDownCapture`)}}j(ge,`usePointerDownOutside`);function _e(e,t=globalThis?.document){let n=A(e),r=y.useRef(!1);return y.useEffect(()=>{let e=j(e=>{e.target&&!r.current&&ye(ue,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:j(()=>r.current=!0,`onFocusCapture`),onBlurCapture:j(()=>r.current=!1,`onBlurCapture`)}}j(_e,`useFocusOutside`);function ve(){let e=new CustomEvent(ce);document.dispatchEvent(e)}j(ve,`dispatchUpdate`);function ye(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?p(i,a):i.dispatchEvent(a)}j(ye,`handleAndDispatchCustomEvent`);var be=Object.defineProperty,M=(e,t)=>be(e,`name`,{value:t,configurable:!0}),xe=`focusScope.autoFocusOnMount`,Se=`focusScope.autoFocusOnUnmount`,Ce={bubbles:!1,cancelable:!0},we=y.forwardRef(M(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=y.useState(null),d=A(i),f=A(a),p=y.useRef(null),m=u(t,c),h=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let e=function(e){if(h.paused||!s)return;let t=e.target;s.contains(t)?p.current=t:N(p.current,{select:!0})},t=function(e){if(h.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||N(p.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&N(s)};M(e,`handleFocusIn`),M(t,`handleFocusOut`),M(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,h.paused]),y.useEffect(()=>{if(s){je.add(h);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(xe,Ce);s.addEventListener(xe,d),s.dispatchEvent(t),t.defaultPrevented||(Te(Ne(De(s)),{select:!0}),document.activeElement===e&&N(s))}return()=>{s.removeEventListener(xe,d),setTimeout(()=>{let t=new CustomEvent(Se,Ce);s.addEventListener(Se,f),s.dispatchEvent(t),t.defaultPrevented||N(e??document.body,{select:!0}),s.removeEventListener(Se,f),je.remove(h)},0)}}},[s,d,f,h]);let g=y.useCallback(e=>{if(!n&&!r||h.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Ee(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&N(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&N(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,h.paused]);return(0,v.jsx)(l.div,{tabIndex:-1,...o,ref:m,onKeyDown:g})},`FocusScope`));function Te(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(N(r,{select:t}),document.activeElement!==n)return}M(Te,`focusFirst`);function Ee(e){let t=De(e);return[Oe(t,e),Oe(t.reverse(),e)]}M(Ee,`getTabbableEdges`);function De(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:M(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}M(De,`getTabbableCandidates`);function Oe(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):ke(r,{upTo:t})))return r}M(Oe,`findVisible`);function ke(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}M(ke,`isHidden`);function Ae(e){return e instanceof HTMLInputElement&&`select`in e}M(Ae,`isSelectableInput`);function N(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ae(e)&&t&&e.select()}}M(N,`focus`);var je=Me();function Me(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=P(e,t),e.unshift(t)},remove(t){e=P(e,t),e[0]?.resume()}}}M(Me,`createFocusScopesStack`);function P(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}M(P,`arrayRemove`);function Ne(e){return e.filter(e=>e.tagName!==`A`)}M(Ne,`removeLinks`);var Pe=Object.defineProperty,Fe=y.forwardRef(((e,t)=>Pe(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=y.useState(!1);f(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?ee.createPortal((0,v.jsx)(l.div,{...r,ref:t}),o):null},`Portal`)),Ie=Object.defineProperty,Le=(e,t)=>Ie(e,`name`,{value:t,configurable:!0}),F=0,I=null;function Re(e){return ze(),e.children}Le(Re,`FocusGuards`);function ze(){y.useEffect(()=>{I||={start:Be(),end:Be()};let{start:e,end:t}=I;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),F++,()=>{F===1&&(I?.start.remove(),I?.end.remove(),I=null),F=Math.max(0,F-1)}},[])}Le(ze,`useFocusGuards`);function Be(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}Le(Be,`createFocusGuard`);var L=function(){return L=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},L.apply(this,arguments)};function Ve(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function He(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var R=`right-scroll-bar-position`,z=`width-before-scroll-bar`,Ue=`with-scroll-bars-hidden`,We=`--removed-body-scroll-bar-size`;function B(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Ge(e,t){var n=(0,y.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Ke=typeof window<`u`?y.useLayoutEffect:y.useEffect,qe=new WeakMap;function Je(e,t){var n=Ge(t||null,function(t){return e.forEach(function(e){return B(e,t)})});return Ke(function(){var t=qe.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||B(e,null)}),i.forEach(function(e){r.has(e)||B(e,a)})}qe.set(n,e)},[e]),n}function Ye(e){return e}function Xe(e,t){t===void 0&&(t=Ye);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Ze(e){e===void 0&&(e={});var t=Xe(null);return t.options=L({async:!0,ssr:!1},e),t}var Qe=function(e){var t=e.sideCar,n=Ve(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return y.createElement(r,L({},n))};Qe.isSideCarExport=!0;function $e(e,t){return e.useMedium(t),Qe}var et=Ze(),tt=function(){},V=y.forwardRef(function(e,t){var n=y.useRef(null),r=y.useState({onScrollCapture:tt,onWheelCapture:tt,onTouchMoveCapture:tt}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,ee=e.gapMode,b=Ve(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Je([n,t]),C=L(L({},b),i);return y.createElement(y.Fragment,null,u&&y.createElement(x,{sideCar:et,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:ee}),o?y.cloneElement(y.Children.only(s),L(L({},C),{ref:S})):y.createElement(v,L({},C,{className:c,ref:S}),s))});V.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},V.classNames={fullWidth:z,zeroRight:R};var nt,rt=function(){if(nt)return nt;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function it(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=rt();return t&&e.setAttribute(`nonce`,t),e}function at(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ot(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var st=function(){var e=0,t=null;return{add:function(n){e==0&&(t=it())&&(at(t,n),ot(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ct=function(){var e=st();return function(t,n){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},lt=function(){var e=ct();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},ut={left:0,top:0,right:0,gap:0},dt=function(e){return parseInt(e||``,10)||0},ft=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[dt(n),dt(r),dt(i)]},pt=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return ut;var t=ft(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},mt=lt(),H=`data-scroll-locked`,ht=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
2
+ .${Ue} {
3
+ overflow: hidden ${r};
4
+ padding-right: ${s}px ${r};
5
+ }
6
+ body[${H}] {
7
+ overflow: hidden ${r};
8
+ overscroll-behavior: contain;
9
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
10
+ padding-left: ${i}px;
11
+ padding-top: ${a}px;
12
+ padding-right: ${o}px;
13
+ margin-left:0;
14
+ margin-top:0;
15
+ margin-right: ${s}px ${r};
16
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
17
+ }
18
+
19
+ .${R} {
20
+ right: ${s}px ${r};
21
+ }
22
+
23
+ .${z} {
24
+ margin-right: ${s}px ${r};
25
+ }
26
+
27
+ .${R} .${R} {
28
+ right: 0 ${r};
29
+ }
30
+
31
+ .${z} .${z} {
32
+ margin-right: 0 ${r};
33
+ }
34
+
35
+ body[${H}] {
36
+ ${We}: ${s}px;
37
+ }
38
+ `},gt=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},_t=function(){y.useEffect(function(){return document.body.setAttribute(H,(gt()+1).toString()),function(){var e=gt()-1;e<=0?document.body.removeAttribute(H):document.body.setAttribute(H,e.toString())}},[])},vt=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;_t();var a=y.useMemo(function(){return pt(i)},[i]);return y.createElement(mt,{styles:ht(a,!t,i,n?``:`!important`)})},yt=!1;if(typeof window<`u`)try{var U=Object.defineProperty({},"passive",{get:function(){return yt=!0,!0}});window.addEventListener(`test`,U,U),window.removeEventListener(`test`,U,U)}catch{yt=!1}var W=yt?{passive:!1}:!1,bt=function(e){return e.tagName===`TEXTAREA`},xt=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!bt(e)&&n[t]===`visible`)},St=function(e){return xt(e,`overflowY`)},Ct=function(e){return xt(e,`overflowX`)},wt=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Dt(e,r)){var i=Ot(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Tt=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Et=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Dt=function(e,t){return e===`v`?St(t):Ct(t)},Ot=function(e,t){return e===`v`?Tt(t):Et(t)},kt=function(e,t){return e===`h`&&t===`rtl`?-1:1},At=function(e,t,n,r,i){var a=kt(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Ot(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Dt(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},G=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},jt=function(e){return[e.deltaX,e.deltaY]},Mt=function(e){return e&&`current`in e?e.current:e},Nt=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Pt=function(e){return`
39
+ .block-interactivity-${e} {pointer-events: none;}
40
+ .allow-interactivity-${e} {pointer-events: all;}
41
+ `},Ft=0,K=[];function It(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),i=y.useState(Ft++)[0],a=y.useState(lt)[0],o=y.useRef(e);y.useEffect(function(){o.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=He([e.lockRef.current],(e.shards||[]).map(Mt),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=y.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=G(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=wt(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=wt(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return At(h,t,e,h===`h`?s:c,!0)},[]),c=y.useCallback(function(e){var n=e;if(!(!K.length||K[K.length-1]!==a)){var r=`deltaY`in n?jt(n):G(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Nt(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Mt).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=y.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Lt(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=y.useCallback(function(e){n.current=G(e),r.current=void 0},[]),d=y.useCallback(function(t){l(t.type,jt(t),t.target,s(t,e.lockRef.current))},[]),f=y.useCallback(function(t){l(t.type,G(t),t.target,s(t,e.lockRef.current))},[]);y.useEffect(function(){return K.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,W),document.addEventListener(`touchmove`,c,W),document.addEventListener(`touchstart`,u,W),function(){K=K.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,W),document.removeEventListener(`touchmove`,c,W),document.removeEventListener(`touchstart`,u,W)}},[]);var p=e.removeScrollBar,m=e.inert;return y.createElement(y.Fragment,null,m?y.createElement(a,{styles:Pt(i)}):null,p?y.createElement(vt,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Lt(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Rt=$e(et,It),zt=y.forwardRef(function(e,t){return y.createElement(V,L({},e,{ref:t,sideCar:Rt}))});zt.classNames=V.classNames;var Bt=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},q=new WeakMap,J=new WeakMap,Y={},Vt=0,Ht=function(e){return e&&(e.host||Ht(e.parentNode))},Ut=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Ht(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Wt=function(e,t,n,r){var i=Ut(t,Array.isArray(e)?e:[e]);Y[n]||(Y[n]=new WeakMap);var a=Y[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(q.get(e)||0)+1,l=(a.get(e)||0)+1;q.set(e,c),a.set(e,l),o.push(e),c===1&&i&&J.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Vt++,function(){o.forEach(function(e){var t=q.get(e)-1,i=a.get(e)-1;q.set(e,t),a.set(e,i),t||(J.has(e)||e.removeAttribute(r),J.delete(e)),i||e.removeAttribute(n)}),Vt--,Vt||(q=new WeakMap,q=new WeakMap,J=new WeakMap,Y={})}},Gt=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Bt(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Wt(r,i,n,`aria-hidden`)):function(){return null}},Kt=Object.defineProperty,X=(e,t)=>Kt(e,`name`,{value:t,configurable:!0}),qt=`Dialog`,[Jt,Yt]=d(qt),[Xt,Z]=Jt(qt),Zt=X(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=y.useRef(null),c=y.useRef(null),[l,u]=g({prop:r,defaultProp:i??!1,onChange:a,caller:qt}),[d,f]=y.useState(0),[p,m]=y.useState(0);return(0,v.jsx)(Xt,{scope:t,triggerRef:s,contentRef:c,contentId:k(),titleId:k(),descriptionId:k(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:y.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Qt=`DialogPortal`,[$t,en]=Jt(Qt,{forceMount:void 0}),tn=X(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Z(Qt,t);return(0,v.jsx)($t,{scope:t,forceMount:n,children:y.Children.map(r,e=>(0,v.jsx)(C,{present:n||a.open,children:(0,v.jsx)(Fe,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),nn=`DialogOverlay`,rn=y.forwardRef(X(function(e,t){let n=en(nn,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Z(nn,e.__scopeDialog);return a.modal?(0,v.jsx)(C,{present:r||a.open,children:(0,v.jsx)(on,{...i,ref:t})}):null},`DialogOverlay`)),an=h(`DialogOverlay.RemoveScroll`),on=y.forwardRef(X(function(e,t){let{__scopeDialog:n,...r}=e,i=Z(nn,n),a=me(),o=u(t,a);return(0,v.jsx)(zt,{as:an,allowPinchZoom:!0,shards:[i.contentRef],children:(0,v.jsx)(l.div,{"data-state":$(i.open),...r,ref:o,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Q=`DialogContent`,sn=y.forwardRef(X(function(e,t){let n=en(Q,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Z(Q,e.__scopeDialog);return(0,v.jsx)(C,{present:r||a.open,children:a.modal?(0,v.jsx)(cn,{...i,ref:t}):(0,v.jsx)(ln,{...i,ref:t})})},`DialogContent`)),cn=y.forwardRef(X(function(e,t){let n=Z(Q,e.__scopeDialog),r=y.useRef(null),i=u(t,n.contentRef,r);return y.useEffect(()=>{let e=r.current;if(e)return Gt(e)},[]),(0,v.jsx)(un,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:m(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:m(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:m(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),ln=y.forwardRef(X(function(e,t){let n=Z(Q,e.__scopeDialog),r=y.useRef(!1),i=y.useRef(!1);return(0,v.jsx)(un,{...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()}})},`DialogContentNonModal`)),un=y.forwardRef(X(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Z(Q,n);return ze(),(0,v.jsx)(v.Fragment,{children:(0,v.jsx)(we,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,v.jsx)(pe,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":$(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),dn=`DialogTitle`,fn=y.forwardRef(X(function(e,t){let{__scopeDialog:n,...r}=e,i=Z(dn,n),{setTitleCount:a}=i;return f(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,v.jsx)(l.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),pn=`DialogDescription`,mn=y.forwardRef(X(function(e,t){let{__scopeDialog:n,...r}=e,i=Z(pn,n),{setDescriptionCount:a}=i;return f(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,v.jsx)(l.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),hn=`DialogClose`,gn=y.forwardRef(X(function(e,t){let{__scopeDialog:n,...r}=e,i=Z(hn,n);return(0,v.jsx)(l.button,{type:`button`,...r,ref:t,onClick:m(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function $(e){return e?`open`:`closed`}X($,`getState`);var _n=e(rn)`
42
+ position: fixed;
43
+ inset: 0;
44
+ z-index: ${({theme:e})=>e.z.overlay};
45
+ background: oklch(0 0 0 / 0.5);
46
+ backdrop-filter: blur(2px);
47
+ `,vn=e(sn)`
48
+ position: fixed;
49
+ z-index: ${({theme:e})=>e.z.dialog};
50
+ top: 50%;
51
+ left: 50%;
52
+ transform: translate(-50%, -50%);
53
+ width: min(${({$width:e})=>e}, calc(100vw - 32px));
54
+ max-height: calc(100vh - 64px);
55
+ display: flex;
56
+ flex-direction: column;
57
+ background: ${({theme:e})=>e.color.panel};
58
+ border: 1px solid ${({theme:e})=>e.color.ruleStrong};
59
+ border-radius: ${({theme:e})=>e.radius.panel};
60
+ box-shadow: 0 12px 40px oklch(0 0 0 / 0.35);
61
+ `,yn=e.div`
62
+ display: flex;
63
+ align-items: center;
64
+ gap: ${({theme:e})=>e.space(2)};
65
+ padding: ${({theme:e})=>`${e.space(2)} ${e.space(2)} ${e.space(2)} ${e.space(3)}`};
66
+ border-bottom: 1px solid ${({theme:e})=>e.color.rule};
67
+ background: ${({theme:e})=>e.color.panelSunk};
68
+ `,bn=e.div`
69
+ padding: ${({theme:e})=>e.space(3)};
70
+ overflow-y: auto;
71
+ `,xn=e.div`
72
+ display: flex;
73
+ justify-content: flex-end;
74
+ gap: ${({theme:e})=>e.space(2)};
75
+ padding: ${({theme:e})=>`${e.space(2)} ${e.space(3)}`};
76
+ border-top: 1px solid ${({theme:e})=>e.color.rule};
77
+ background: ${({theme:e})=>e.color.panelSunk};
78
+ `,Sn=e(mn)`
79
+ margin: 0 0 ${({theme:e})=>e.space(3)};
80
+ font-size: 12px;
81
+ color: ${({theme:e})=>e.color.inkDim};
82
+ `;function Cn({open:e,onOpenChange:n,title:r,description:i,footer:o,width:c=`560px`,children:l}){return(0,v.jsx)(Zt,{open:e,onOpenChange:n,children:(0,v.jsxs)(tn,{children:[(0,v.jsx)(_n,{}),(0,v.jsxs)(vn,{$width:c,children:[(0,v.jsxs)(yn,{children:[(0,v.jsx)(fn,{asChild:!0,children:(0,v.jsx)(s,{as:`h2`,children:r})}),(0,v.jsx)(t,{}),(0,v.jsx)(gn,{asChild:!0,children:(0,v.jsx)(a,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Close`,children:(0,v.jsx)(_,{})})})]}),(0,v.jsxs)(bn,{children:[i===void 0?null:(0,v.jsx)(Sn,{children:i}),l]}),o===void 0?null:(0,v.jsx)(xn,{children:o})]})]})})}export{Cn as t};
@@ -1,4 +1,4 @@
1
- import{B as e,G as t,I as n,M as r,Mt as i,Nt as a,P as o,V as s,Y as c,Zt as l,_ as u,j as d,q as f,v as p,z as m}from"./queries-D_-Jj9vt.js";import{t as h}from"./index-UAZ0O5y0.js";import{f as g,r as _,t as v}from"./Lamp-DO-sRDg2.js";var y=l(a(),1),b=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),x=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),S=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),C=e=>{let t=S(e);return t.charAt(0).toUpperCase()+t.slice(1)},w={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},T=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},E=(0,y.createContext)({}),D=()=>(0,y.useContext)(E),O=(0,y.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=D()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,y.createElement)(`svg`,{ref:c,...w,width:t??l??w.width,height:t??l??w.height,stroke:e??f,strokeWidth:m,className:b(`lucide`,p,i),...!a&&!T(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,y.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),k=(e,t)=>{let n=(0,y.forwardRef)(({className:n,...r},i)=>(0,y.createElement)(O,{ref:i,iconNode:t,className:b(`lucide-${x(C(e))}`,`lucide-${e}`,n),...r}));return n.displayName=C(e),n},A=k(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),ee=k(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),te=k(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),ne=k(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),re=k(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),ie=k(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),ae=k(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),oe=k(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),se=k(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),ce=k(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),le=k(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),j=k(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),M=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:1}),N=new Intl.NumberFormat(`en-US`);function P(e){return Number.isFinite(e)?e<1e4?N.format(Math.round(e)):M.format(e).toLowerCase():`—`}function F(e){return Number.isFinite(e)?e===0?`$0`:e<.01?`$${e.toFixed(4)}`:e<100?`$${e.toFixed(2)}`:`$${M.format(e).toLowerCase()}`:`—`}function I(e){return e==null||!Number.isFinite(e)?`—`:e<1e3?`${Math.round(e)}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.round(e/6e4)}m`}function L(e,t=1){return Number.isFinite(e)?`${(e*100).toFixed(t)}%`:`—`}var R=[[6e4,1e3,`s`],[36e5,6e4,`m`],[864e5,36e5,`h`],[1/0,864e5,`d`]];function z(e){let t=Math.abs(e);if(t<1e3)return`0s`;let n=R.find(([e])=>t<e);return n===void 0?`—`:`${Math.floor(t/n[1])}${n[2]}`}function B(e,t=Date.now()){if(e==null||!Number.isFinite(e))return`—`;let n=e-t;return Math.abs(n)<5e3?`just now`:n<0?`${z(n)} ago`:`in ${z(n)}`}function V(e){return new Date(e).toLocaleTimeString(`en-GB`,{hour12:!1})}function H(e){return e==null||!Number.isFinite(e)?`—`:new Date(e).toLocaleString(`en-GB`,{year:`numeric`,month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1})}function U(e,t=8){return e.length<=t?e:`${e.slice(0,t)}…`}var W=i(),G=(0,y.createContext)(null);function ue({children:e}){let[t,n]=(0,y.useState)(!0),r=(0,y.useCallback)(()=>n(e=>!e),[]),i=(0,y.useMemo)(()=>({live:t,toggle:r,cadence:e=>t?e:!1}),[t,r]);return(0,W.jsx)(G,{value:i,children:e})}function K(){return(0,y.use)(G)??{live:!1,toggle:()=>{},cadence:()=>!1}}var de=t.svg`
1
+ import{B as e,G as t,I as n,M as r,Mt as i,Nt as a,P as o,V as s,Y as c,Zt as l,_ as u,j as d,q as f,v as p,z as m}from"./queries-D2o-X8Pj.js";import{t as h}from"./index-PW6EvVh5.js";import{f as g,r as _,t as v}from"./Lamp-B-5SjXbG.js";var y=l(a(),1),b=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),x=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),S=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),C=e=>{let t=S(e);return t.charAt(0).toUpperCase()+t.slice(1)},w={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},T=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},E=(0,y.createContext)({}),D=()=>(0,y.useContext)(E),O=(0,y.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=D()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,y.createElement)(`svg`,{ref:c,...w,width:t??l??w.width,height:t??l??w.height,stroke:e??f,strokeWidth:m,className:b(`lucide`,p,i),...!a&&!T(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,y.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),k=(e,t)=>{let n=(0,y.forwardRef)(({className:n,...r},i)=>(0,y.createElement)(O,{ref:i,iconNode:t,className:b(`lucide-${x(C(e))}`,`lucide-${e}`,n),...r}));return n.displayName=C(e),n},A=k(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),ee=k(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),te=k(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),ne=k(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),re=k(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),ie=k(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),ae=k(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),oe=k(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),se=k(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),ce=k(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),le=k(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),j=k(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),M=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:1}),N=new Intl.NumberFormat(`en-US`);function P(e){return Number.isFinite(e)?e<1e4?N.format(Math.round(e)):M.format(e).toLowerCase():`—`}function F(e){return Number.isFinite(e)?e===0?`$0`:e<.01?`$${e.toFixed(4)}`:e<100?`$${e.toFixed(2)}`:`$${M.format(e).toLowerCase()}`:`—`}function I(e){return e==null||!Number.isFinite(e)?`—`:e<1e3?`${Math.round(e)}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.round(e/6e4)}m`}function L(e,t=1){return Number.isFinite(e)?`${(e*100).toFixed(t)}%`:`—`}var R=[[6e4,1e3,`s`],[36e5,6e4,`m`],[864e5,36e5,`h`],[1/0,864e5,`d`]];function z(e){let t=Math.abs(e);if(t<1e3)return`0s`;let n=R.find(([e])=>t<e);return n===void 0?`—`:`${Math.floor(t/n[1])}${n[2]}`}function B(e,t=Date.now()){if(e==null||!Number.isFinite(e))return`—`;let n=e-t;return Math.abs(n)<5e3?`just now`:n<0?`${z(n)} ago`:`in ${z(n)}`}function V(e){return new Date(e).toLocaleTimeString(`en-GB`,{hour12:!1})}function H(e){return e==null||!Number.isFinite(e)?`—`:new Date(e).toLocaleString(`en-GB`,{year:`numeric`,month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1})}function U(e,t=8){return e.length<=t?e:`${e.slice(0,t)}…`}var W=i(),G=(0,y.createContext)(null);function ue({children:e}){let[t,n]=(0,y.useState)(!0),r=(0,y.useCallback)(()=>n(e=>!e),[]),i=(0,y.useMemo)(()=>({live:t,toggle:r,cadence:e=>t?e:!1}),[t,r]);return(0,W.jsx)(G,{value:i,children:e})}function K(){return(0,y.use)(G)??{live:!1,toggle:()=>{},cadence:()=>!1}}var de=t.svg`
2
2
  display: block;
3
3
  width: 100%;
4
4
  height: 100%;
@@ -104,7 +104,9 @@ import{B as e,G as t,I as n,M as r,Mt as i,Nt as a,P as o,V as s,Y as c,Zt as l,
104
104
  "rail main";
105
105
  grid-template-columns: 168px minmax(0, 1fr);
106
106
  grid-template-rows: auto minmax(0, 1fr);
107
- min-height: 100%;
107
+ height: 100vh;
108
+ min-height: 0;
109
+ overflow: hidden;
108
110
 
109
111
  @media (max-width: 720px) {
110
112
  grid-template-areas:
@@ -121,11 +123,13 @@ import{B as e,G as t,I as n,M as r,Mt as i,Nt as a,P as o,V as s,Y as c,Zt as l,
121
123
  flex-direction: column;
122
124
  gap: ${({theme:e})=>e.space(4)};
123
125
  min-width: 0;
126
+ min-height: 0;
127
+ overflow-y: auto;
124
128
 
125
129
  @media (max-width: 720px) {
126
130
  padding: ${({theme:e})=>e.space(3)};
127
131
  }
128
- `;function we({children:e}){return(0,W.jsxs)(Ce,{children:[(0,W.jsx)(ve,{}),(0,W.jsx)(Se,{}),(0,W.jsx)($,{children:e})]})}var Te=t.div`
132
+ `;function we({children:e}){return(0,W.jsxs)(Ce,{"data-testid":`rack-shell`,children:[(0,W.jsx)(ve,{}),(0,W.jsx)(Se,{}),(0,W.jsx)($,{children:e})]})}var Te=t.div`
129
133
  display: flex;
130
134
  align-items: flex-end;
131
135
  gap: ${({theme:e})=>e.space(3)};
@@ -144,4 +148,4 @@ import{B as e,G as t,I as n,M as r,Mt as i,Nt as a,P as o,V as s,Y as c,Zt as l,
144
148
  flex-direction: column;
145
149
  gap: 6px;
146
150
  min-width: 0;
147
- `;function ke({legend:e,title:t,summary:r,actions:i}){return(0,W.jsxs)(Te,{children:[(0,W.jsxs)(Oe,{children:[(0,W.jsx)(d,{children:e}),(0,W.jsx)(Ee,{children:t}),(0,W.jsx)(De,{children:r})]}),(0,W.jsx)(n,{}),i]})}export{K as a,H as c,B as d,F as f,ue as i,I as l,k as m,we as n,V as o,U as p,J as r,P as s,ke as t,L as u};
151
+ `;function ke({legend:e,title:t,summary:r,actions:i}){return(0,W.jsxs)(Te,{children:[(0,W.jsxs)(Oe,{children:[(0,W.jsx)(d,{children:e}),(0,W.jsx)(Ee,{children:t}),(0,W.jsx)(De,{children:r})]}),(0,W.jsx)(n,{}),i]})}export{K as a,H as c,L as d,B as f,k as h,ue as i,z as l,U as m,we as n,V as o,F as p,J as r,P as s,ke as t,I as u};
@@ -1,4 +1,4 @@
1
- import{G as e,Mt as t,j as n}from"./queries-D_-Jj9vt.js";var r=t(),i=e.div`
1
+ import{G as e,Mt as t,j as n}from"./queries-D2o-X8Pj.js";var r=t(),i=e.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 6px;
@@ -1,4 +1,4 @@
1
- import{B as e,G as t,H as n,I as r,Mt as i,O as a,P as o,j as s}from"./queries-D_-Jj9vt.js";var c=i(),l=t.section`
1
+ import{B as e,G as t,H as n,I as r,Mt as i,O as a,P as o,j as s}from"./queries-D2o-X8Pj.js";var c=i(),l=t.section`
2
2
  background: ${({theme:e})=>e.color.panel};
3
3
  border: 1px solid ${({theme:e})=>e.color.rule};
4
4
  border-radius: ${({theme:e})=>e.radius.panel};
@@ -1,4 +1,4 @@
1
- import{G as e}from"./queries-D_-Jj9vt.js";var t=e.table`
1
+ import{G as e}from"./queries-D2o-X8Pj.js";var t=e.table`
2
2
  width: 100%;
3
3
  border-collapse: collapse;
4
4
  font-size: 12.5px;
@@ -0,0 +1,39 @@
1
+ import{G as e,Mt as t,Nt as n,Zt as r}from"./queries-D2o-X8Pj.js";import{a as i,c as a,i as o,n as s,r as c,t as l}from"./dist-C-IbPRiV.js";var u=r(n(),1),d=Object.defineProperty,f=(e,t)=>d(e,`name`,{value:t,configurable:!0});function p(e){let[t,n]=u.useState(void 0);return s(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}f(p,`useSize`);var m=t(),h=Object.defineProperty,g=(e,t)=>h(e,`name`,{value:t,configurable:!0}),_=`Switch`,[v,y]=o(_),[b,x]=v(_);function S(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:d,value:f=`on`,internal_do_not_use_render:p}=e,[h,g]=l({prop:n,defaultProp:i??!1,onChange:c,caller:_}),[v,y]=u.useState(null),[x,S]=u.useState(null),C=u.useRef(!1),[w,T]=u.useReducer(e=>e+1,0),E={checked:h,setChecked:g,disabled:a,control:v,setControl:y,name:s,form:o,value:f,hasConsumerStoppedPropagationRef:C,userInteractionCount:w,onUserInteraction:T,required:d,defaultChecked:i,isFormControl:!v||!!o||!!v.closest(`form`),bubbleInput:x,setBubbleInput:S};return(0,m.jsx)(b,{scope:t,...E,children:A(p)?p(E):r})}g(S,`SwitchProvider`);var C=`SwitchTrigger`,w=u.forwardRef(g(function({__scopeSwitch:e,onClick:t,...n},r){let{control:o,form:s,value:l,disabled:d,checked:f,required:p,setControl:h,setChecked:_,hasConsumerStoppedPropagationRef:v,onUserInteraction:y,isFormControl:b,bubbleInput:S}=x(C,e),w=a(r,h),T=u.useRef(f);return u.useEffect(()=>{let e=s?o?.ownerDocument.getElementById(s):o?.form;if(e instanceof HTMLFormElement){let t=g(()=>_(T.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[o,s,_]),(0,m.jsx)(i.button,{type:`button`,role:`switch`,"aria-checked":f,"aria-required":p,"data-state":j(f),"data-disabled":d?``:void 0,disabled:d,value:l,...n,ref:w,onClick:c(t,e=>{y(),_(e=>!e),S&&b&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})})},`SwitchTrigger`)),T=u.forwardRef(g(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,m.jsx)(S,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(w,{...d,ref:t,__scopeSwitch:n}),e&&(0,m.jsx)(k,{__scopeSwitch:n})]})})},`Switch`)),E=`SwitchThumb`,D=u.forwardRef(g(function(e,t){let{__scopeSwitch:n,...r}=e,a=x(E,n);return(0,m.jsx)(i.span,{"data-state":j(a.checked),"data-disabled":a.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),O=`SwitchBubbleInput`,k=u.forwardRef(g(function({__scopeSwitch:e,onClick:t,...n},r){let{control:o,hasConsumerStoppedPropagationRef:s,userInteractionCount:l,checked:d,defaultChecked:f,required:h,disabled:g,name:_,value:v,form:y,bubbleInput:b,setBubbleInput:S}=x(O,e),C=a(r,S),w=p(o),T=u.useRef(!1),E=u.useRef(d),D=u.useRef(l);u.useEffect(()=>{let e=b;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=l!==D.current;D.current=l;let i=E.current!==d;E.current=d;let a=!(r&&s.current);if(i&&n){T.current=!r;let t=new Event(`click`,{bubbles:a});n.call(e,d),e.dispatchEvent(t),T.current=!1}},[b,d,s,l]);let k=u.useRef(d);return(0,m.jsx)(i.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:f??k.current,required:h,disabled:g,name:_,value:v,form:y,...n,tabIndex:-1,ref:C,onClick:c(t,e=>{T.current&&e.stopPropagation()}),style:{...n.style,...w,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function A(e){return typeof e==`function`}g(A,`isFunction`);function j(e){return e?`checked`:`unchecked`}g(j,`getState`);var M=e(T)`
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
+ `,N=e(D)`
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 P({checked:e,onCheckedChange:t,label:n,disabled:r,id:i}){return(0,m.jsx)(M,{checked:e,onCheckedChange:t,"aria-label":n,...r===void 0?{}:{disabled:r},...i===void 0?{}:{id:i},children:(0,m.jsx)(N,{})})}export{P as t};
@@ -0,0 +1,28 @@
1
+ import{G as e,H as t,Mt as n}from"./queries-D2o-X8Pj.js";import{h as r,s as i}from"./Rack-D1WJswv3.js";var a=r(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),o=r(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),s=r(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),c=n(),l=new Intl.NumberFormat(`en-US`);function u(e){return`${l.format(e.inputTokens)} input, ${l.format(e.outputTokens)} output, ${l.format(e.cacheReadTokens)} cache read, ${l.format(e.cacheWriteTokens)} cache write tokens`}var d=e.span`
2
+ display: inline-flex;
3
+ align-items: center;
4
+ gap: 6px;
5
+ white-space: nowrap;
6
+ `,f=e.span`
7
+ display: inline-flex;
8
+ align-items: center;
9
+ gap: 2px;
10
+
11
+ svg {
12
+ width: 12px;
13
+ height: 12px;
14
+ stroke-width: 1.75;
15
+ }
16
+ `,p=t`
17
+ from { clip-path: inset(0 2ch 0 0); }
18
+ to { clip-path: inset(0 0 0 0); }
19
+ `,m=e.span`
20
+ display: inline-block;
21
+ width: 3ch;
22
+ vertical-align: bottom;
23
+ animation: ${p} 1.5s steps(2, end) infinite;
24
+
25
+ @media (prefers-reduced-motion: reduce) {
26
+ animation: none;
27
+ }
28
+ `;function h(){return(0,c.jsxs)(`span`,{"aria-hidden":`true`,children:[`processing`,(0,c.jsx)(m,{children:`...`})]})}function g({tokens:e}){let t=u(e);return(0,c.jsxs)(d,{role:`img`,"aria-label":t,title:t,children:[(0,c.jsxs)(f,{"aria-hidden":`true`,children:[(0,c.jsx)(a,{}),i(e.inputTokens)]}),(0,c.jsxs)(f,{"aria-hidden":`true`,children:[(0,c.jsx)(o,{}),i(e.outputTokens)]}),(0,c.jsxs)(f,{"aria-hidden":`true`,children:[(0,c.jsx)(s,{}),(0,c.jsx)(a,{}),i(e.cacheReadTokens)]}),(0,c.jsxs)(f,{"aria-hidden":`true`,children:[(0,c.jsx)(s,{}),(0,c.jsx)(o,{}),i(e.cacheWriteTokens)]})]})}export{g as n,u as r,h as t};
@@ -0,0 +1 @@
1
+ import{Mt as e}from"./queries-D2o-X8Pj.js";import{o as t}from"./index-PW6EvVh5.js";import{i as n,n as r}from"./Rack-D1WJswv3.js";var i=e(),a=()=>(0,i.jsx)(n,{children:(0,i.jsx)(r,{children:(0,i.jsx)(t,{})})});export{a as component};
@@ -1,4 +1,4 @@
1
- import{B as e,C as t,E as n,F as r,G as i,L as a,Mt as o,Nt as s,P as c,V as l,Zt as u,d,f,j as p,o as m,r as h,s as g,u as _}from"./queries-D_-Jj9vt.js";import{a as v,d as y,l as b,m as x,t as S}from"./Rack-BFWC50ex.js";import{t as C}from"./CopyValue-WrOTcHwq.js";import{n as w,r as T,t as ee}from"./Toggle-DYoCVD37.js";import{t as E}from"./trash-2-DjWP2u19.js";import{t as D}from"./Modal-lhjr949H.js";import{a as O,d as te,i as ne,n as re,t as k,u as A}from"./Lamp-DO-sRDg2.js";import{t as j}from"./Chip-CM9ZMdr9.js";import{i as M,n as N,r as P,t as F}from"./Field-Br6jKPz8.js";import{t as ie}from"./Meter-BzMaum0C.js";import{a as I,i as L,n as R,r as z,t as B}from"./States-BNeCLhZn.js";import{i as V,n as H,r as U,t as W}from"./Table-nOg_lgEJ.js";import{t as G}from"./catalog-C_OQ0icG.js";var K=x(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),q=u(s(),1),J=o(),ae=Object.keys(G),Y={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`},X={anthropic:`Authorize in the browser, then paste the code Anthropic shows you.`,openai:`Authorize in the browser. When it redirects to localhost, paste the whole URL.`,kimi:`Enter the code on Kimi's device page. This dialog finishes on its own.`},oe=i.ol`
1
+ import{B as e,C as t,E as n,F as r,G as i,L as a,Mt as o,Nt as s,P as c,V as l,Zt as u,d,f,j as p,o as m,r as h,s as g,u as _}from"./queries-D2o-X8Pj.js";import{a as v,f as y,h as b,t as x,u as S}from"./Rack-D1WJswv3.js";import{t as C}from"./CopyValue-CRQDLo7k.js";import{n as w,t as T}from"./Confirm-B6aAiVbT.js";import{t as ee}from"./trash-2-BcZb-sCT.js";import{t as E}from"./Modal-CI6jk2D4.js";import{t as D}from"./Toggle-CiLC67Dw.js";import{a as O,d as te,i as ne,n as re,t as k,u as A}from"./Lamp-B-5SjXbG.js";import{t as j}from"./Chip-BB_5C1Zp.js";import{i as M,n as N,r as P,t as F}from"./Field-uHZxl4fI.js";import{t as ie}from"./Meter-DI_BRUKt.js";import{a as I,i as L,n as R,r as z,t as B}from"./States-Bbiu5cHE.js";import{i as V,n as H,r as U,t as W}from"./Table-CdPWxYaz.js";import{t as G}from"./catalog-C_OQ0icG.js";var K=b(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),q=u(s(),1),J=o(),ae=Object.keys(G),Y={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`},X={anthropic:`Authorize in the browser, then paste the code Anthropic shows you.`,openai:`Authorize in the browser. When it redirects to localhost, paste the whole URL.`,kimi:`Enter the code on Kimi's device page. This dialog finishes on its own.`},oe=i.ol`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: ${({theme:e})=>e.space(3)};
@@ -17,7 +17,7 @@ import{B as e,C as t,E as n,F as r,G as i,L as a,Mt as o,Nt as s,P as c,V as l,Z
17
17
  `,le=i.p`
18
18
  font-size: 12px;
19
19
  color: ${({theme:e})=>e.color.inkDim};
20
- `;function ue({open:t,onOpenChange:n,onConnected:r}){let[i,o]=(0,q.useState)(`anthropic`),[s,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(null),[f,_]=(0,q.useState)(``),[v,y]=(0,q.useState)(null),b=g(),x=m(),S=(0,q.useCallback)(()=>{d(null),_(``),y(null),l(``),b.reset(),x.reset()},[b,x]),w=(0,q.useCallback)(e=>{e||S(),n(e)},[n,S]);return(0,q.useEffect)(()=>{if(u===null||u.kind!==`device`)return;let e=!1,t=async()=>{try{let t=await h(u.flowId);if(e)return;if(t.status===`complete`){S(),n(!1),r();return}}catch(t){if(e)return;y(L(t)),d(null);return}e||(i=setTimeout(()=>void t(),u.pollIntervalMs))},i=setTimeout(()=>void t(),u.pollIntervalMs);return()=>{e=!0,clearTimeout(i)}},[u,r,n,S]),(0,J.jsx)(D,{open:t,onOpenChange:w,title:`Connect an account`,description:`The gateway stores the resulting token encrypted. It is never shown again after this dialog.`,footer:u===null?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(e,{type:`button`,onClick:()=>w(!1),children:`Cancel`}),(0,J.jsx)(e,{type:`button`,$variant:`primary`,disabled:b.isPending,onClick:()=>{y(null),b.mutate({provider:i,label:s.trim().length===0?Y[i]:s.trim()},{onSuccess:e=>d(e),onError:e=>y(L(e))})},children:b.isPending?`Starting…`:`Start authorization`})]}):u.kind===`device`?(0,J.jsx)(e,{type:`button`,onClick:()=>w(!1),children:`Cancel`}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(e,{type:`button`,onClick:()=>w(!1),children:`Cancel`}),(0,J.jsx)(e,{type:`button`,$variant:`primary`,disabled:x.isPending||f.trim().length===0,onClick:()=>{u!==null&&(y(null),x.mutate({flowId:u.flowId,code:f.trim()},{onSuccess:()=>{S(),n(!1),r()},onError:e=>y(L(e))}))},children:x.isPending?`Finishing…`:`Finish connecting`})]}),children:(0,J.jsxs)(oe,{children:[u===null?(0,J.jsxs)(a,{$gap:3,children:[(0,J.jsx)(F,{label:`Provider`,children:e=>(0,J.jsx)(M,{...e,value:i,onChange:e=>o(e.target.value),children:ae.map(e=>(0,J.jsx)(`option`,{value:e,children:Y[e]},e))})}),(0,J.jsx)(F,{label:`Label`,hint:`How this account is named in the rack. Defaults to the provider.`,children:e=>(0,J.jsx)(N,{...e,value:s,placeholder:Y[i],onChange:e=>l(e.target.value)})})]}):(0,J.jsxs)(a,{$gap:3,children:[(0,J.jsxs)(a,{$gap:1,children:[(0,J.jsx)(p,{children:`Step 1 — authorize`}),(0,J.jsx)(c,{$gap:2,children:(0,J.jsxs)(e,{as:`a`,href:u.authorizeUrl,target:`_blank`,rel:`noreferrer noopener`,$variant:`primary`,$size:`sm`,children:[(0,J.jsx)(K,{}),`Open `,Y[i]]})}),(0,J.jsx)(C,{value:u.authorizeUrl,label:`Copy authorization link`})]}),u.userCode===null?null:(0,J.jsxs)(a,{$gap:1,children:[(0,J.jsx)(p,{children:`Step 2 — enter this code`}),(0,J.jsx)(se,{children:u.userCode})]}),u.kind===`device`?(0,J.jsxs)(le,{children:[X[i],` Waiting for authorization…`]}):(0,J.jsx)(F,{label:`Authorization code`,hint:X[i],...v===null?{}:{problem:v},children:e=>(0,J.jsx)(N,{...e,value:f,autoFocus:!0,placeholder:i===`openai`?`http://localhost:1455/auth/callback?code=…`:`code#state`,onChange:e=>_(e.target.value)})})]}),v===null||u?.kind===`pkce`?null:(0,J.jsx)(ce,{children:v})]})})}var de=[`anthropic`,`openai`,`kimi`],Z={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`},fe=i(I)`
20
+ `;function ue({open:t,onOpenChange:n,onConnected:r}){let[i,o]=(0,q.useState)(`anthropic`),[s,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(null),[f,_]=(0,q.useState)(``),[v,y]=(0,q.useState)(null),b=g(),x=m(),S=(0,q.useCallback)(()=>{d(null),_(``),y(null),l(``),b.reset(),x.reset()},[b,x]),w=(0,q.useCallback)(e=>{e||S(),n(e)},[n,S]);return(0,q.useEffect)(()=>{if(u===null||u.kind!==`device`)return;let e=!1,t=async()=>{try{let t=await h(u.flowId);if(e)return;if(t.status===`complete`){S(),n(!1),r();return}}catch(t){if(e)return;y(L(t)),d(null);return}e||(i=setTimeout(()=>void t(),u.pollIntervalMs))},i=setTimeout(()=>void t(),u.pollIntervalMs);return()=>{e=!0,clearTimeout(i)}},[u,r,n,S]),(0,J.jsx)(E,{open:t,onOpenChange:w,title:`Connect an account`,description:`The gateway stores the resulting token encrypted. It is never shown again after this dialog.`,footer:u===null?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(e,{type:`button`,onClick:()=>w(!1),children:`Cancel`}),(0,J.jsx)(e,{type:`button`,$variant:`primary`,disabled:b.isPending,onClick:()=>{y(null),b.mutate({provider:i,label:s.trim().length===0?Y[i]:s.trim()},{onSuccess:e=>d(e),onError:e=>y(L(e))})},children:b.isPending?`Starting…`:`Start authorization`})]}):u.kind===`device`?(0,J.jsx)(e,{type:`button`,onClick:()=>w(!1),children:`Cancel`}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(e,{type:`button`,onClick:()=>w(!1),children:`Cancel`}),(0,J.jsx)(e,{type:`button`,$variant:`primary`,disabled:x.isPending||f.trim().length===0,onClick:()=>{u!==null&&(y(null),x.mutate({flowId:u.flowId,code:f.trim()},{onSuccess:()=>{S(),n(!1),r()},onError:e=>y(L(e))}))},children:x.isPending?`Finishing…`:`Finish connecting`})]}),children:(0,J.jsxs)(oe,{children:[u===null?(0,J.jsxs)(a,{$gap:3,children:[(0,J.jsx)(F,{label:`Provider`,children:e=>(0,J.jsx)(M,{...e,value:i,onChange:e=>o(e.target.value),children:ae.map(e=>(0,J.jsx)(`option`,{value:e,children:Y[e]},e))})}),(0,J.jsx)(F,{label:`Label`,hint:`How this account is named in the rack. Defaults to the provider.`,children:e=>(0,J.jsx)(N,{...e,value:s,placeholder:Y[i],onChange:e=>l(e.target.value)})})]}):(0,J.jsxs)(a,{$gap:3,children:[(0,J.jsxs)(a,{$gap:1,children:[(0,J.jsx)(p,{children:`Step 1 — authorize`}),(0,J.jsx)(c,{$gap:2,children:(0,J.jsxs)(e,{as:`a`,href:u.authorizeUrl,target:`_blank`,rel:`noreferrer noopener`,$variant:`primary`,$size:`sm`,children:[(0,J.jsx)(K,{}),`Open `,Y[i]]})}),(0,J.jsx)(C,{value:u.authorizeUrl,label:`Copy authorization link`})]}),u.userCode===null?null:(0,J.jsxs)(a,{$gap:1,children:[(0,J.jsx)(p,{children:`Step 2 — enter this code`}),(0,J.jsx)(se,{children:u.userCode})]}),u.kind===`device`?(0,J.jsxs)(le,{children:[X[i],` Waiting for authorization…`]}):(0,J.jsx)(F,{label:`Authorization code`,hint:X[i],...v===null?{}:{problem:v},children:e=>(0,J.jsx)(N,{...e,value:f,autoFocus:!0,placeholder:i===`openai`?`http://localhost:1455/auth/callback?code=…`:`code#state`,onChange:e=>_(e.target.value)})})]}),v===null||u?.kind===`pkce`?null:(0,J.jsx)(ce,{children:v})]})})}var de=[`anthropic`,`openai`,`kimi`],Z={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`},fe=i(I)`
21
21
  border-left: 3px solid ${({theme:e,$provider:t})=>e.provider[t]};
22
22
  `,pe=i(N)`
23
23
  width: 100%;
@@ -41,11 +41,14 @@ import{B as e,C as t,E as n,F as r,G as i,L as a,Mt as o,Nt as s,P as c,V as l,Z
41
41
  padding-left: 9px;
42
42
  font-size: 11px;
43
43
  color: ${({theme:e})=>e.color.inkDim};
44
- `,he=i(c)`
45
- min-width: 130px;
44
+ `,he=i.div`
45
+ display: grid;
46
+ grid-template-columns: 96px 1fr;
47
+ align-items: center;
48
+ min-width: 208px;
46
49
  gap: 6px;
47
50
  `,ge=i.div`
48
51
  display: flex;
49
52
  flex-direction: column;
50
53
  gap: 4px;
51
- `;function $(){let e=n();return{pending:e.isPending,commit:(t,n)=>{e.mutate({id:t,patch:n})}}}function _e(){let{cadence:n}=v(),i=d(),o=_(n(1e4)),s=t(),u=f(),{commit:m}=$(),[h,g]=(0,q.useState)(!1),[x,C]=(0,q.useState)(null),D=Date.now(),M=i.data??[],N=O(o.data?.health??[],e=>e.credentialId),P=O(o.data?.quota??[],e=>e.credentialId),F=s.data?.quotaPollIntervalMs??3e5,L=M.filter(e=>e.enabled).length,G=i.isLoading?`Reading connected accounts…`:M.length===0?`No provider credentials are connected, so every request fails at the router.`:`${L} of ${M.length} accounts are enabled and eligible for routing.`;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(S,{legend:`Accounts`,title:`Provider accounts`,summary:G,actions:(0,J.jsxs)(e,{type:`button`,$variant:`primary`,onClick:()=>g(!0),children:[(0,J.jsx)(T,{}),`Connect an account`]})}),i.isError?(0,J.jsx)(I,{legend:`Accounts`,children:(0,J.jsx)(R,{error:i.error,onRetry:()=>void i.refetch()})}):i.isLoading?(0,J.jsx)(I,{legend:`Accounts`,children:(0,J.jsx)(z,{rows:5})}):M.length===0?(0,J.jsx)(I,{legend:`Accounts`,children:(0,J.jsx)(B,{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:(0,J.jsx)(e,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>g(!0),children:`Connect an account`})})}):(0,J.jsx)(a,{$gap:4,children:de.filter(e=>M.some(t=>t.provider===e)).map(e=>{let t=M.filter(t=>t.provider===e);return(0,J.jsx)(fe,{$provider:e,legend:Z[e],meta:`${t.length} account${t.length===1?``:`s`}`,flush:!0,children:(0,J.jsx)(r,{children:(0,J.jsxs)(W,{children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(U,{$width:`24%`,children:`Account`}),(0,J.jsx)(U,{$width:`20%`,children:`Sign-in`}),(0,J.jsx)(U,{$align:`right`,$width:`86px`,children:`Tier`}),(0,J.jsx)(U,{$align:`right`,$width:`94px`,children:`Weight`}),(0,J.jsx)(U,{$align:`center`,$width:`86px`,children:`Enabled`}),(0,J.jsx)(U,{$width:`160px`,children:`Quota`}),(0,J.jsx)(U,{$align:`right`,$width:`88px`,children:`TTFT`}),(0,J.jsx)(U,{$align:`right`,$width:`130px`,children:`Token expires`}),(0,J.jsx)(U,{$width:`48px`})]})}),(0,J.jsx)(`tbody`,{children:t.map(e=>{let t=ne(N.get(e.id)??[],D,e.enabled,e.disabledReason),n=te(P.get(e.id)??[]);return(0,J.jsxs)(V,{children:[(0,J.jsxs)(H,{children:[(0,J.jsxs)(c,{$gap:2,children:[(0,J.jsx)(k,{state:t.state,label:t.note===``?`healthy`:t.note}),(0,J.jsx)(pe,{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}m(e.id,{label:n})}})]}),t.note===``?null:(0,J.jsx)(me,{children:t.note})]}),(0,J.jsx)(H,{children:(0,J.jsxs)(c,{$gap:1,children:[(0,J.jsx)(j,{children:e.authType===`oauth`?`oauth`:`api key`}),e.accountEmail===null?null:(0,J.jsx)(p,{children:e.accountEmail})]})}),(0,J.jsx)(H,{$align:`right`,children:(0,J.jsx)(Q,{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}m(e.id,{tier:n})}})}),(0,J.jsx)(H,{$align:`right`,children:(0,J.jsx)(Q,{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}m(e.id,{weight:n})}})}),(0,J.jsx)(H,{$align:`center`,children:(0,J.jsx)(ee,{checked:e.enabled,label:`Route to ${e.label}`,onCheckedChange:t=>m(e.id,{enabled:t})})}),(0,J.jsx)(H,{children:n.length===0?(0,J.jsx)(p,{children:`unknown`}):(0,J.jsx)(ge,{children:n.map(({window:e,fraction:t})=>(0,J.jsxs)(he,{children:[(0,J.jsx)(ie,{fraction:t,label:`${re[e.windowType]} window, ${Math.round(t*100)}% used`}),(0,J.jsx)(p,{children:A(e,D,F,y)})]},e.windowType))})}),(0,J.jsx)(H,{$align:`right`,$mono:!0,children:b(t.ttftMs)}),(0,J.jsx)(H,{$align:`right`,$mono:!0,children:e.expiresAt===null?`never`:y(e.expiresAt,D)}),(0,J.jsx)(H,{$align:`right`,children:(0,J.jsx)(l,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Remove ${e.label}`,title:`Remove ${e.label}`,onClick:()=>C(e),children:(0,J.jsx)(E,{})})})]},e.id)})})]})})},e)})}),(0,J.jsx)(ue,{open:h,onOpenChange:g,onConnected:()=>void i.refetch()}),(0,J.jsx)(w,{open:x!==null,onOpenChange:e=>{e||C(null)},title:`Remove account`,body:x===null?``:`Removing "${x.label}" deletes its stored token. Any model target pointing at ${Z[x.provider]} loses this account, and reconnecting means authorizing again.`,confirmLabel:`Remove account`,busy:u.isPending,onConfirm:()=>{x!==null&&u.mutate(x.id,{onSettled:()=>C(null)})}})]})}var ve=_e;export{ve as component};
54
+ `;function $(){let e=n();return{pending:e.isPending,commit:(t,n)=>{e.mutate({id:t,patch:n})}}}function _e(){let{cadence:n}=v(),i=d(),o=_(n(1e4)),s=t(),u=f(),{commit:m}=$(),[h,g]=(0,q.useState)(!1),[b,C]=(0,q.useState)(null),E=Date.now(),M=i.data??[],N=O(o.data?.health??[],e=>e.credentialId),P=O(o.data?.quota??[],e=>e.credentialId),F=s.data?.quotaPollIntervalMs??3e5,L=M.filter(e=>e.enabled).length,G=i.isLoading?`Reading connected accounts…`:M.length===0?`No provider credentials are connected, so every request fails at the router.`:`${L} of ${M.length} accounts are enabled and eligible for routing.`;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(x,{legend:`Accounts`,title:`Provider accounts`,summary:G,actions:(0,J.jsxs)(e,{type:`button`,$variant:`primary`,onClick:()=>g(!0),children:[(0,J.jsx)(w,{}),`Connect an account`]})}),i.isError?(0,J.jsx)(I,{legend:`Accounts`,children:(0,J.jsx)(R,{error:i.error,onRetry:()=>void i.refetch()})}):i.isLoading?(0,J.jsx)(I,{legend:`Accounts`,children:(0,J.jsx)(z,{rows:5})}):M.length===0?(0,J.jsx)(I,{legend:`Accounts`,children:(0,J.jsx)(B,{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:(0,J.jsx)(e,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>g(!0),children:`Connect an account`})})}):(0,J.jsx)(a,{$gap:4,children:de.filter(e=>M.some(t=>t.provider===e)).map(e=>{let t=M.filter(t=>t.provider===e);return(0,J.jsx)(fe,{$provider:e,legend:Z[e],meta:`${t.length} account${t.length===1?``:`s`}`,flush:!0,children:(0,J.jsx)(r,{children:(0,J.jsxs)(W,{children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(U,{$width:`24%`,children:`Account`}),(0,J.jsx)(U,{$width:`20%`,children:`Sign-in`}),(0,J.jsx)(U,{$align:`right`,$width:`86px`,children:`Tier`}),(0,J.jsx)(U,{$align:`right`,$width:`94px`,children:`Weight`}),(0,J.jsx)(U,{$align:`center`,$width:`86px`,children:`Enabled`}),(0,J.jsx)(U,{$width:`240px`,children:`Quota`}),(0,J.jsx)(U,{$align:`right`,$width:`88px`,children:`TTFT`}),(0,J.jsx)(U,{$align:`right`,$width:`130px`,children:`Token expires`}),(0,J.jsx)(U,{$width:`48px`})]})}),(0,J.jsx)(`tbody`,{children:t.map(e=>{let t=ne(N.get(e.id)??[],E,e.enabled,e.disabledReason),n=te(P.get(e.id)??[]);return(0,J.jsxs)(V,{children:[(0,J.jsxs)(H,{children:[(0,J.jsxs)(c,{$gap:2,children:[(0,J.jsx)(k,{state:t.state,label:t.note===``?`healthy`:t.note}),(0,J.jsx)(pe,{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}m(e.id,{label:n})}})]}),t.note===``?null:(0,J.jsx)(me,{children:t.note})]}),(0,J.jsx)(H,{children:(0,J.jsxs)(c,{$gap:1,children:[(0,J.jsx)(j,{children:e.authType===`oauth`?`oauth`:`api key`}),e.accountEmail===null?null:(0,J.jsx)(p,{children:e.accountEmail})]})}),(0,J.jsx)(H,{$align:`right`,children:(0,J.jsx)(Q,{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}m(e.id,{tier:n})}})}),(0,J.jsx)(H,{$align:`right`,children:(0,J.jsx)(Q,{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}m(e.id,{weight:n})}})}),(0,J.jsx)(H,{$align:`center`,children:(0,J.jsx)(D,{checked:e.enabled,label:`Route to ${e.label}`,onCheckedChange:t=>m(e.id,{enabled:t})})}),(0,J.jsx)(H,{children:n.length===0?(0,J.jsx)(p,{children:`unknown`}):(0,J.jsx)(ge,{children:n.map(({window:e,fraction:t})=>(0,J.jsxs)(he,{children:[(0,J.jsx)(ie,{fraction:t,label:`${re[e.windowType]} window, ${Math.round(t*100)}% used`}),(0,J.jsx)(p,{children:A(e,E,F,y)})]},e.windowType))})}),(0,J.jsx)(H,{$align:`right`,$mono:!0,children:S(t.ttftMs)}),(0,J.jsx)(H,{$align:`right`,$mono:!0,children:e.expiresAt===null?`never`:y(e.expiresAt,E)}),(0,J.jsx)(H,{$align:`right`,children:(0,J.jsx)(l,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Remove ${e.label}`,title:`Remove ${e.label}`,onClick:()=>C(e),children:(0,J.jsx)(ee,{})})})]},e.id)})})]})})},e)})}),(0,J.jsx)(ue,{open:h,onOpenChange:g,onConnected:()=>void i.refetch()}),(0,J.jsx)(T,{open:b!==null,onOpenChange:e=>{e||C(null)},title:`Remove account`,body:b===null?``:`Removing "${b.label}" deletes its stored token. Any model target pointing at ${Z[b.provider]} loses this account, and reconnecting means authorizing again.`,confirmLabel:`Remove account`,busy:u.isPending,onConfirm:()=>{b!==null&&u.mutate(b.id,{onSettled:()=>C(null)})}})]})}var ve=_e;export{ve as component};
@@ -0,0 +1,44 @@
1
+ import{G as e,Mt as t,N as n,Nt as r,P as i,Zt as a,c as o,t as s}from"./queries-D2o-X8Pj.js";import{a as c,s as l,t as u}from"./Rack-D1WJswv3.js";import{i as d}from"./Field-uHZxl4fI.js";import{a as f,n as p,r as m,t as h}from"./States-Bbiu5cHE.js";var g=a(r(),1),_=t(),v=[100,200,500],y=[{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`}],b=e(i)`
2
+ gap: ${({theme:e})=>e.space(2)};
3
+ flex-wrap: wrap;
4
+ `,x=e(d)`
5
+ width: auto;
6
+ `,S=e.div`
7
+ display: grid;
8
+ grid-template-rows: auto minmax(0, 1fr);
9
+ gap: ${({theme:e})=>e.space(4)};
10
+ min-height: 0;
11
+ flex: 1;
12
+ `,C=e(f)`
13
+ min-height: 0;
14
+
15
+ > div {
16
+ display: flex;
17
+ flex: 1;
18
+ flex-direction: column;
19
+ min-height: 0;
20
+ }
21
+ `,w=e.div`
22
+ flex: 1;
23
+ min-height: 0;
24
+ overflow-x: auto;
25
+ overflow-y: auto;
26
+ `,T=e.pre`
27
+ margin: 0;
28
+ padding: ${({theme:e})=>e.space(3)};
29
+ font-family: ${({theme:e})=>e.font.mono};
30
+ font-size: 12px;
31
+ line-height: 1.65;
32
+ white-space: pre;
33
+ `,E=e.div`
34
+ color: ${({theme:e,$level:t})=>t===`error`?e.color.down:t===`warn`?e.color.warn:t===`debug`?e.color.inkFaint:e.color.ink};
35
+ `,D=e.p`
36
+ margin: 0;
37
+ padding: ${({theme:e})=>`${e.space(2)} ${e.space(3)}`};
38
+ border-top: 1px solid ${({theme:e})=>e.color.rule};
39
+ color: ${({theme:e})=>e.color.inkDim};
40
+ font-size: 12px;
41
+ `,O=e.code`
42
+ font-family: ${({theme:e})=>e.font.mono};
43
+ word-break: break-all;
44
+ `;function k({read:e}){return e.source===`file`?(0,_.jsxs)(D,{children:[`Reading `,(0,_.jsx)(O,{children:e.path}),`, named by `,(0,_.jsx)(O,{children:`OMNI_LOG_FILE`}),`. That variable says where the gateway's output is being captured; it does not redirect it.`]}):e.source===`journal`?(0,_.jsxs)(D,{children:[`Reading the systemd journal for `,(0,_.jsx)(O,{children:`omnigateway.service`}),`. To read a file instead, redirect the gateway's output to one and point `,(0,_.jsx)(O,{children:`OMNI_LOG_FILE`}),` at the same path.`]}):null}function A(){let{cadence:e}=c(),[t,r]=(0,g.useState)(200),[i,a]=(0,g.useState)(``),d=o(t,i,e(s)),f=d.data,D=f?.lines??[],O=(0,g.useRef)(null),A=(0,g.useRef)(!0);return(0,g.useLayoutEffect)(()=>{let e=O.current;e!==null&&A.current&&f!==void 0&&(e.scrollTop=e.scrollHeight)},[f]),(0,_.jsxs)(S,{children:[(0,_.jsx)(u,{legend:`Console`,title:`Gateway output`,summary:d.isLoading?`Reading the gateway's own output…`:`${l(D.length)} lines of what this process is doing. Requests are in Logs; prompt bodies, tokens and keys are never written here.`,actions:(0,_.jsxs)(b,{children:[(0,_.jsx)(x,{value:i,"aria-label":`Which levels to show`,onChange:e=>a(e.target.value),children:y.map(e=>(0,_.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,_.jsx)(x,{value:t,"aria-label":`How many lines to fetch`,onChange:e=>r(Number(e.target.value)),children:v.map(e=>(0,_.jsxs)(`option`,{value:e,children:[`last `,e]},e))})]})}),(0,_.jsxs)(C,{legend:`Process output`,meta:f===void 0?void 0:(0,_.jsx)(n,{children:j(f)}),flush:!0,children:[f===void 0?null:(0,_.jsx)(k,{read:f}),(0,_.jsx)(w,{ref:O,"data-testid":`console-terminal`,onScroll:e=>{let t=e.currentTarget;A.current=t.scrollHeight-t.scrollTop-t.clientHeight<=8},children:d.isError?(0,_.jsx)(p,{error:d.error,onRetry:()=>void d.refetch()}):d.isLoading?(0,_.jsx)(`div`,{style:{padding:12},children:(0,_.jsx)(m,{rows:10})}):f!==void 0&&f.source===`none`?(0,_.jsx)(h,{legend:`Nothing is capturing this gateway`,message:"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."}):D.length===0?(0,_.jsx)(h,{legend:`Nothing to show`,message:i===``?`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.`}):(0,_.jsx)(T,{children:D.map((e,t)=>(0,_.jsx)(E,{$level:e.level,children:e.raw},`${e.at??0}-${t}`))})})]})]})}function j(e){return e.source===`file`?`log file`:e.source===`journal`?`systemd journal`:`not captured`}var M=A;export{M as component};
@@ -0,0 +1,62 @@
1
+ import{A as e,B as t,C as n,D as r,F as i,G as a,I as o,L as s,M as c,Mt as l,P as u,R as d,d as f,j as p,q as m,u as h,v as g,y as _}from"./queries-D2o-X8Pj.js";import{a as v,d as y,f as b,o as x,p as S,r as C,s as w,t as T,u as E}from"./Rack-D1WJswv3.js";import{n as D,t as O}from"./TokenBreakdown-B96iPBm9.js";import{a as k,c as A,d as j,f as M,i as N,l as ee,n as te,r as ne,s as P,t as F,u as I}from"./Lamp-B-5SjXbG.js";import{n as L,t as R}from"./Chip-BB_5C1Zp.js";import{t as z}from"./Meter-DI_BRUKt.js";import{a as B,n as V,t as H}from"./States-Bbiu5cHE.js";import{i as U,n as W,r as G,t as K}from"./Table-CdPWxYaz.js";import{t as q}from"./Readout-BocZ2HXP.js";var J=l(),Y=a(d)`
2
+ font-weight: 500;
3
+ display: block;
4
+ max-width: 24ch;
5
+ `,X=a.span`
6
+ font-size: 11px;
7
+ color: ${({theme:e})=>e.color.inkDim};
8
+ `,Z=a.div`
9
+ display: grid;
10
+ grid-template-columns: 72px 1fr;
11
+ align-items: center;
12
+ gap: 6px;
13
+ min-width: 172px;
14
+ `,re=a.div`
15
+ display: flex;
16
+ flex-direction: column;
17
+ gap: 4px;
18
+ `;function ie({credentials:e,health:n,quota:r,usage:a,quotaPollIntervalMs:o,now:s}){let c=k(n,e=>e.credentialId),l=k(r,e=>e.credentialId),d=new Map(a.map(e=>[e.key,e])),f={down:0,warn:1,ok:2,idle:3,live:3},h=e.map(e=>({credential:e,status:N(c.get(e.id)??[],s,e.enabled,e.disabledReason),quota:j(l.get(e.id)??[]),usage:d.get(e.id)})).sort((e,t)=>f[e.status.state]-f[t.status.state]||e.credential.tier-t.credential.tier);return(0,J.jsx)(B,{legend:`Accounts`,meta:`${e.length} connected`,flush:!0,actions:(0,J.jsx)(t,{as:m,to:`/accounts`,$size:`sm`,children:`Manage accounts`}),children:e.length===0?(0,J.jsx)(H,{legend:`No accounts`,message:`The gateway has no provider credentials, so every request will fail. Connect one to start routing.`,action:(0,J.jsx)(t,{as:m,to:`/accounts`,$variant:`primary`,$size:`sm`,children:`Connect an account`})}):(0,J.jsx)(i,{children:(0,J.jsxs)(K,{children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(G,{children:`Account`}),(0,J.jsx)(G,{children:`Provider`}),(0,J.jsx)(G,{$align:`right`,children:`Tier`}),(0,J.jsx)(G,{children:`Quota`}),(0,J.jsx)(G,{$align:`right`,children:`TTFT`}),(0,J.jsx)(G,{$align:`right`,children:`Requests`}),(0,J.jsx)(G,{$align:`right`,children:`Last used`})]})}),(0,J.jsx)(`tbody`,{children:h.map(({credential:e,status:t,quota:n,usage:r})=>(0,J.jsxs)(U,{children:[(0,J.jsx)(W,{children:(0,J.jsxs)(u,{$gap:2,children:[(0,J.jsx)(F,{state:t.state,label:t.note===``?`healthy`:t.note}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(Y,{children:e.label}),t.note===``?null:(0,J.jsx)(X,{children:t.note})]})]})}),(0,J.jsx)(W,{children:(0,J.jsx)(L,{provider:e.provider})}),(0,J.jsx)(W,{$align:`right`,$mono:!0,children:e.tier}),(0,J.jsx)(W,{children:n.length===0?(0,J.jsx)(X,{children:`unknown`}):(0,J.jsx)(re,{children:n.map(({window:e,fraction:t})=>(0,J.jsxs)(Z,{children:[(0,J.jsx)(z,{fraction:t,label:`${te[e.windowType]} window, ${Math.round(t*100)}% used`}),(0,J.jsx)(p,{children:I(e,s,o,b)})]},e.windowType))})}),(0,J.jsx)(W,{$align:`right`,$mono:!0,children:E(t.ttftMs)}),(0,J.jsx)(W,{$align:`right`,$mono:!0,children:r===void 0?`—`:w(r.requests)}),(0,J.jsx)(W,{$align:`right`,$mono:!0,children:b(t.lastUsedAt,s)})]},e.id))})]})})})}var ae=a.ul`
19
+ display: flex;
20
+ flex-direction: column;
21
+ `,oe=a.li`
22
+ display: flex;
23
+ align-items: center;
24
+ gap: ${({theme:e})=>e.space(2)};
25
+ padding: 6px ${({theme:e})=>e.space(3)};
26
+ border-bottom: 1px solid ${({theme:e})=>e.color.rule};
27
+
28
+ &:last-child {
29
+ border-bottom: 0;
30
+ }
31
+ `,se=a(d)`
32
+ font-family: ${({theme:e})=>e.font.mono};
33
+ font-size: 12px;
34
+ max-width: 30ch;
35
+ `,ce=a(c)`
36
+ color: ${({theme:e})=>e.color.down};
37
+ font-size: 11px;
38
+ `;function le({logs:e}){let n=e.slice(0,12);return(0,J.jsx)(B,{legend:`Activity`,meta:`most recent first`,flush:!0,actions:(0,J.jsx)(t,{as:m,to:`/logs`,$size:`sm`,children:`Open logs`}),children:n.length===0?(0,J.jsx)(H,{legend:`No traffic yet`,message:`Point a client at this gateway with an API key and the requests will appear here.`}):(0,J.jsx)(ae,{children:n.map(e=>(0,J.jsxs)(oe,{children:[(0,J.jsx)(F,{state:ee(e),label:A(e)}),(0,J.jsx)(c,{$dim:!0,children:x(e.at)}),(0,J.jsx)(se,{title:e.requestedModel,children:e.requestedModel||`—`}),e.resolvedProvider===null?null:(0,J.jsx)(c,{$dim:!0,style:{color:`var(--p-${e.resolvedProvider})`},children:e.resolvedProvider}),(0,J.jsx)(o,{}),P(e)?(0,J.jsx)(c,{$dim:!0,"aria-label":`processing`,children:(0,J.jsx)(O,{})}):(0,J.jsxs)(J.Fragment,{children:[e.errorCode===null?null:(0,J.jsx)(ce,{children:e.errorCode}),e.attempts>1?(0,J.jsxs)(c,{$dim:!0,children:[e.attempts,`×`]}):null,(0,J.jsx)(c,{$dim:!0,children:(0,J.jsx)(D,{tokens:e})}),(0,J.jsx)(c,{$dim:!0,children:E(e.durationMs)}),(0,J.jsx)(c,{$dim:!0,children:S(e.costUsd)})]})]},e.id))})})}var ue=a.ul`
39
+ display: flex;
40
+ flex-direction: column;
41
+ gap: ${({theme:e})=>e.space(3)};
42
+ `,de=a(d)`
43
+ font-family: ${({theme:e})=>e.font.mono};
44
+ font-size: 12.5px;
45
+ `,fe=a.div`
46
+ display: flex;
47
+ height: 5px;
48
+ border-radius: 2px;
49
+ overflow: hidden;
50
+ background: ${({theme:e})=>e.color.panelSunk};
51
+ border: 1px solid ${({theme:e})=>e.color.rule};
52
+ `,pe=a.div`
53
+ flex: ${({$grow:e})=>e} 0 0;
54
+ background: ${({$color:e})=>e};
55
+ opacity: 0.8;
56
+ `,me=a.div`
57
+ flex: ${({$grow:e})=>e} 0 0;
58
+ `;function Q({models:e,logs:n}){let r=new Map;for(let e of n){let t=r.get(e.requestedModel)??{requests:0,costUsd:0};t.requests+=1,t.costUsd+=e.costUsd,r.set(e.requestedModel,t)}let i=Math.max(1,...[...r.values()].map(e=>e.requests)),a=[...e].map(e=>({model:e,used:r.get(e.id)})).sort((e,t)=>(t.used?.requests??0)-(e.used?.requests??0)).slice(0,8);return(0,J.jsx)(B,{legend:`Models`,meta:`${e.length} configured`,actions:(0,J.jsx)(t,{as:m,to:`/models`,$size:`sm`,children:`Edit routing`}),children:e.length===0?(0,J.jsx)(H,{legend:`No models`,message:`Nothing is routable yet. Create a virtual model and point it at one or more provider targets.`,action:(0,J.jsx)(t,{as:m,to:`/models`,$variant:`primary`,$size:`sm`,children:`Create a model`})}):(0,J.jsx)(ue,{children:a.map(({model:e,used:t})=>{let n=(t?.requests??0)/i,r=[...new Set(e.targets.map(e=>e.provider))];return(0,J.jsxs)(`li`,{children:[(0,J.jsxs)(u,{$gap:2,children:[(0,J.jsx)(de,{title:e.id,children:e.id}),e.isAlias?(0,J.jsx)(R,{children:`alias`}):null,(0,J.jsx)(R,{$tone:`accent`,children:e.strategy}),(0,J.jsx)(o,{}),(0,J.jsx)(c,{$dim:!0,children:w(t?.requests??0)}),(0,J.jsx)(p,{children:`req`}),(0,J.jsx)(c,{$dim:!0,children:S(t?.costUsd??0)})]}),(0,J.jsxs)(fe,{style:{marginTop:6},title:`${Math.round(n*100)}% of the busiest model`,children:[r.map(e=>(0,J.jsx)(pe,{$color:`var(--p-${e})`,$grow:n/r.length},e)),(0,J.jsx)(me,{$grow:Math.max(0,1-n)})]})]},e.id)})})})}var he=a.div`
59
+ display: grid;
60
+ grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
61
+ gap: ${({theme:e})=>e.space(3)};
62
+ `;function ge({logs:e,windowMs:t,now:n}){let r=e.filter(e=>n-e.at<=t),i=M(r,t),a=ne(r,{now:n,spanMs:t,count:32}),o=i.errorRate>=.25?`down`:i.errorRate>=.05?`warn`:`ok`,s=i.inputTokens+i.outputTokens+i.cacheReadTokens+i.cacheWriteTokens;return(0,J.jsxs)(he,{children:[(0,J.jsx)(q,{legend:`Requests`,value:w(i.requests),unit:`${i.ratePerMin.toFixed(1)}/min`,trace:(0,J.jsx)(C,{values:a.map(e=>e.total),overlay:a.map(e=>e.errors),label:`${i.requests} requests, ${i.errors} of them failed`})}),(0,J.jsx)(q,{legend:`Error rate`,value:y(i.errorRate),unit:`${w(i.errors)} failed`,tone:i.requests===0?`ink`:o,trace:(0,J.jsx)(C,{values:a.map(e=>e.errors),scaleTo:Math.max(...a.map(e=>e.total)),color:`var(--down)`,label:`${i.errors} failed requests against ${i.requests} total`})}),(0,J.jsx)(q,{legend:`Total tokens`,value:w(s),unit:(0,J.jsx)(D,{tokens:i}),trace:(0,J.jsx)(C,{values:a.map(e=>e.tokens),label:`token volume over the window, ${s.toLocaleString(`en-US`)} total`})}),(0,J.jsx)(q,{legend:`Time to first token`,value:E(i.ttftP50),unit:`p95 ${E(i.ttftP95)}`,trace:(0,J.jsx)(C,{values:a.map(e=>e.ttftMs??0),color:`var(--ok)`,label:`median first-token latency, currently ${E(i.ttftP50)}`})}),(0,J.jsx)(q,{legend:`Spend`,value:S(i.costUsd),unit:`${w(i.inputTokens+i.outputTokens)} tokens`,trace:(0,J.jsx)(C,{values:a.map(e=>e.costUsd),color:`var(--warn)`,label:`spend over the window, ${S(i.costUsd)} total`})})]})}var $=36e5;function _e(){let{cadence:t}=v(),i=f(),a=h(t(1e4)),o=_(),c=g(500,t(1e4)),l=n(),u=Date.now(),d=Math.floor((u-$)/6e4)*6e4,p=r({groupBy:`credential`,since:d},t(6e4)),m=i.data??[],y=k(a.data?.health??[],e=>e.credentialId),b=m.filter(e=>N(y.get(e.id)??[],u,e.enabled,e.disabledReason).state===`down`),x=i.isLoading||c.isLoading?`Reading the gateway…`:m.length===0?`No accounts are connected, so every request fails at the router.`:b.length>0?`${b.length} account${b.length===1?` is`:`s are`} out of rotation.`:`All ${m.length} accounts are answering. Nothing needs attention.`;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(T,{legend:`Rack`,title:`Gateway`,summary:x}),c.isError?(0,J.jsx)(B,{legend:`Traffic`,children:(0,J.jsx)(V,{legend:`The gateway did not answer`,error:c.error,onRetry:()=>void c.refetch()})}):(0,J.jsxs)(s,{$gap:4,children:[(0,J.jsx)(ge,{logs:c.data??[],windowMs:$,now:u}),(0,J.jsx)(ie,{credentials:m,health:a.data?.health??[],quota:a.data?.quota??[],usage:p.data??[],quotaPollIntervalMs:l.data?.quotaPollIntervalMs??3e5,now:u}),(0,J.jsxs)(e,{$min:`340px`,$gap:4,children:[(0,J.jsx)(Q,{models:o.data??[],logs:c.data??[]}),(0,J.jsx)(le,{logs:c.data??[]})]})]})]})}var ve=_e;export{ve as component};