@hoknie/aip 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/application.js +7 -1
- package/dist/app/application.js.map +1 -1
- package/dist/feature/agents/clients/agy/guard.js +26 -8
- package/dist/feature/agents/clients/agy/guard.js.map +1 -1
- package/dist/feature/agents/clients/agy/permissions.js +9 -1
- package/dist/feature/agents/clients/agy/permissions.js.map +1 -1
- package/dist/feature/agents/clients/agy/runtime.js +7 -1
- package/dist/feature/agents/clients/agy/runtime.js.map +1 -1
- package/dist/feature/agents/clients/opencode/runtime.js +12 -1
- package/dist/feature/agents/clients/opencode/runtime.js.map +1 -1
- package/dist/feature/agents/types/index.js +1 -0
- package/dist/feature/agents/types/index.js.map +1 -1
- package/dist/feature/agents/types/mcp/env.js +54 -0
- package/dist/feature/agents/types/mcp/env.js.map +1 -0
- package/dist/feature/observers/services/observers.js +21 -3
- package/dist/feature/observers/services/observers.js.map +1 -1
- package/dist/feature/observers/types/plan-repairs.js +36 -11
- package/dist/feature/observers/types/plan-repairs.js.map +1 -1
- package/dist/feature/queue/repositories/queues.js +28 -4
- package/dist/feature/queue/repositories/queues.js.map +1 -1
- package/dist/feature/queue/services/control.js +23 -1
- package/dist/feature/queue/services/control.js.map +1 -1
- package/dist/feature/queue/services/store.js +4 -0
- package/dist/feature/queue/services/store.js.map +1 -1
- package/dist/feature/queue/services/task-tags.js +4 -1
- package/dist/feature/queue/services/task-tags.js.map +1 -1
- package/dist/feature/queue/types/advance.js +3 -1
- package/dist/feature/queue/types/advance.js.map +1 -1
- package/dist/feature/queue/types/filter.js +36 -0
- package/dist/feature/queue/types/filter.js.map +1 -0
- package/dist/feature/queue/types/index.js +1 -0
- package/dist/feature/queue/types/index.js.map +1 -1
- package/dist/feature/queue/types/items.js +1 -0
- package/dist/feature/queue/types/items.js.map +1 -1
- package/dist/feature/queue/types/settings.js +14 -3
- package/dist/feature/queue/types/settings.js.map +1 -1
- package/dist/feature/runs/machine/repair.js +5 -1
- package/dist/feature/runs/machine/repair.js.map +1 -1
- package/dist/feature/runs/machine/steps.js +4 -4
- package/dist/feature/runs/machine/steps.js.map +1 -1
- package/dist/feature/runs/machine/transition.js +11 -1
- package/dist/feature/runs/machine/transition.js.map +1 -1
- package/dist/feature/runs/repositories/write.js +1 -1
- package/dist/feature/runs/repositories/write.js.map +1 -1
- package/dist/feature/runs/services/effects/attempts.js +21 -13
- package/dist/feature/runs/services/effects/attempts.js.map +1 -1
- package/dist/feature/runs/services/effects/effects.js +5 -0
- package/dist/feature/runs/services/effects/effects.js.map +1 -1
- package/dist/feature/runs/services/effects/runtime-check.js +20 -0
- package/dist/feature/runs/services/effects/runtime-check.js.map +1 -0
- package/dist/feature/runs/services/requests.js +7 -1
- package/dist/feature/runs/services/requests.js.map +1 -1
- package/dist/feature/runs/types/attempt.js +4 -0
- package/dist/feature/runs/types/attempt.js.map +1 -1
- package/dist/feature/swarm-config/services/index.js +1 -0
- package/dist/feature/swarm-config/services/index.js.map +1 -1
- package/dist/feature/swarm-config/services/sections/mcp-servers.js +128 -0
- package/dist/feature/swarm-config/services/sections/mcp-servers.js.map +1 -0
- package/dist/feature/swarm-config/services/validate-runtimes.js +0 -50
- package/dist/feature/swarm-config/services/validate-runtimes.js.map +1 -1
- package/dist/feature/swarm-config/services/validate-specialists.js +5 -4
- package/dist/feature/swarm-config/services/validate-specialists.js.map +1 -1
- package/dist/feature/swarm-config/services/validate.js +7 -6
- package/dist/feature/swarm-config/services/validate.js.map +1 -1
- package/dist/feature/swarm-config/types/index.js +1 -0
- package/dist/feature/swarm-config/types/index.js.map +1 -1
- package/dist/feature/swarm-config/types/mcp/reference.js +40 -0
- package/dist/feature/swarm-config/types/mcp/reference.js.map +1 -0
- package/dist/feature/swarm-config/types/merge.js +1 -0
- package/dist/feature/swarm-config/types/merge.js.map +1 -1
- package/dist/feature/swarm-config/types/settings.js +2 -0
- package/dist/feature/swarm-config/types/settings.js.map +1 -1
- package/dist/feature/swarm-config/types/specialist.js.map +1 -1
- package/dist/feature/swarm-edit/services/config-edits.js +12 -0
- package/dist/feature/swarm-edit/services/config-edits.js.map +1 -1
- package/dist/feature/swarm-edit/services/editor-view.js +2 -0
- package/dist/feature/swarm-edit/services/editor-view.js.map +1 -1
- package/dist/feature/swarm-edit/services/index.js +1 -0
- package/dist/feature/swarm-edit/services/index.js.map +1 -1
- package/dist/feature/swarm-edit/services/mcp/editor-mcp.js +51 -0
- package/dist/feature/swarm-edit/services/mcp/editor-mcp.js.map +1 -0
- package/dist/feature/swarm-edit/services/mcp/plan-mcp-server.js +93 -0
- package/dist/feature/swarm-edit/services/mcp/plan-mcp-server.js.map +1 -0
- package/dist/feature/swarm-edit/services/plan-settings.js.map +1 -1
- package/dist/feature/swarm-edit/types/editor.js.map +1 -1
- package/dist/platform/sqlite/migrations.js +1 -0
- package/dist/platform/sqlite/migrations.js.map +1 -1
- package/dist/presentation/cli/commands/queue-edit.js +23 -1
- package/dist/presentation/cli/commands/queue-edit.js.map +1 -1
- package/dist/presentation/format/queue.js +14 -1
- package/dist/presentation/format/queue.js.map +1 -1
- package/dist/presentation/ipc/contract/config.js +22 -0
- package/dist/presentation/ipc/contract/config.js.map +1 -1
- package/dist/presentation/ipc/contract/queue.js +11 -1
- package/dist/presentation/ipc/contract/queue.js.map +1 -1
- package/dist/presentation/ipc/contract/runs.js +4 -0
- package/dist/presentation/ipc/contract/runs.js.map +1 -1
- package/dist/presentation/ipc/handlers/config.js +6 -0
- package/dist/presentation/ipc/handlers/config.js.map +1 -1
- package/dist/presentation/ipc/handlers/runs.js +1 -0
- package/dist/presentation/ipc/handlers/runs.js.map +1 -1
- package/dist/presentation/ipc/snapshots.js +2 -2
- package/dist/presentation/ipc/snapshots.js.map +1 -1
- package/dist/presentation/ipc/views/observers.js +2 -2
- package/dist/presentation/ipc/views/observers.js.map +1 -1
- package/dist/presentation/ipc/views/queue.js +4 -1
- package/dist/presentation/ipc/views/queue.js.map +1 -1
- package/dist/presentation/ipc/views/runs.js +3 -4
- package/dist/presentation/ipc/views/runs.js.map +1 -1
- package/dist/presentation/mcp/host-queue-control.js +11 -2
- package/dist/presentation/mcp/host-queue-control.js.map +1 -1
- package/dist/presentation/web/routes/catalog/mcp-servers.js +50 -0
- package/dist/presentation/web/routes/catalog/mcp-servers.js.map +1 -0
- package/dist/presentation/web/routes/runs.js +5 -0
- package/dist/presentation/web/routes/runs.js.map +1 -1
- package/dist/presentation/web/server.js +2 -0
- package/dist/presentation/web/server.js.map +1 -1
- package/dist/web/assets/{FilterColumn-BCMp-JO4.js → FilterColumn-BrQWIM5F.js} +1 -1
- package/dist/web/assets/{SharedPipelinesGroup-DJRGFtzx.js → SharedPipelinesGroup-WFngQrqI.js} +1 -1
- package/dist/web/assets/{badge-C_7kALlW.js → badge-B_khFsd6.js} +1 -1
- package/dist/web/assets/{card-C9eXOVuF.js → card-COXjnc-y.js} +1 -1
- package/dist/web/assets/empty-Eb-EZDPX.js +41 -0
- package/dist/web/assets/index-DEXoIe2a.js +21 -0
- package/dist/web/assets/index-DMlIe0VD.css +2 -0
- package/dist/web/assets/locales-BlBJo1PR.js +1 -0
- package/dist/web/assets/{pipelines-DQglwIkL.js → pipelines-B3cdeex_.js} +5 -5
- package/dist/web/assets/queue-HMUImu0E.js +16 -0
- package/dist/web/assets/{select-BSqaxwh1.js → select-MHus_Unr.js} +1 -1
- package/dist/web/assets/settings-CpeEsUXX.js +6 -0
- package/dist/web/assets/skeleton-CWY1nRvW.js +1 -0
- package/dist/web/assets/specialists-BkLXuqUd.js +1 -0
- package/dist/web/assets/stats-DRg_5vll.js +1 -0
- package/dist/web/assets/topology-DGTNdDHf.js +1 -0
- package/dist/web/assets/{trash-ChYI9ms1.js → trash-CFJeuRuc.js} +1 -1
- package/dist/web/assets/{useListDrag-0GPS1X83.js → useListDrag-B7Wlt2u9.js} +1 -1
- package/dist/web/index.html +7 -7
- package/integrations/claude-code/.claude-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/dist/web/assets/empty-ACC2KkXk.js +0 -41
- package/dist/web/assets/index-CsVQUXJH.js +0 -21
- package/dist/web/assets/index-Ds1nt_qm.css +0 -2
- package/dist/web/assets/locales-fB1w2oER.js +0 -1
- package/dist/web/assets/queue-CAuAo--6.js +0 -16
- package/dist/web/assets/settings-6eHKYbS7.js +0 -2
- package/dist/web/assets/skeleton-CfLYGtNX.js +0 -1
- package/dist/web/assets/specialists-Durm0DgK.js +0 -1
- package/dist/web/assets/stats-67akPa3A.js +0 -1
- package/dist/web/assets/topology-DQu3su19.js +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/queue-HMUImu0E.js","assets/rolldown-runtime-XKyaHtl9.js","assets/skeleton-CWY1nRvW.js","assets/vendor-react-C1iE8mnY.js","assets/empty-Eb-EZDPX.js","assets/select-MHus_Unr.js","assets/badge-B_khFsd6.js","assets/deliveryModes-funlvXVC.js","assets/useListDrag-B7Wlt2u9.js","assets/card-COXjnc-y.js","assets/specialists-BkLXuqUd.js","assets/FilterColumn-BrQWIM5F.js","assets/trash-CFJeuRuc.js","assets/pipelines-B3cdeex_.js","assets/settingFields-DVg9TQK2.js","assets/pipelines-DLioOiRN.css","assets/stats-DRg_5vll.js","assets/settings-CpeEsUXX.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,n,t as r}from"./vendor-react-C1iE8mnY.js";import{A as i,B as a,E as o,F as s,G as c,H as l,I as u,J as d,K as f,L as p,M as m,N as h,P as g,Q as _,T as v,U as y,V as b,W as x,X as S,Y as C,Z as w,a as T,d as E,f as ee,ft as D,g as te,h as O,it as ne,j as k,k as re,l as A,m as ie,n as j,nt as ae,o as oe,q as se,r as ce,s as le,t as M,u as ue,z as de}from"./skeleton-CWY1nRvW.js";import{a as N,n as fe,o as P,r as pe,t as me}from"./FilterColumn-BrQWIM5F.js";import{C as he,D as ge,E as _e,O as ve,S as ye,T as be,_ as xe,a as F,b as Se,g as Ce,h as we,i as Te,k as Ee,l as De,m as Oe,n as ke,o as Ae,p as je,r as Me,s as Ne,t as Pe,v as Fe,w as Ie,x as Le,y as Re}from"./empty-Eb-EZDPX.js";import{a as ze,i as Be,l as Ve,o as He,r as Ue,s as We,t as I}from"./badge-B_khFsd6.js";import{i as Ge,n as Ke,r as qe,t as Je}from"./locales-BlBJo1PR.js";import{n as Ye,t as Xe}from"./vendor-markdown-DwXfjc7L.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var L=e(t(),1),Ze=n(),Qe=class extends Error{status;code;constructor(e,t,n){super(t),this.status=e,this.code=n}};async function R(e,t){let n=await fetch(e,{credentials:`same-origin`,...t}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Qe(n.status,r.error??n.statusText,r.code);return r}function z(e,t={}){return R(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})}var B=(e,t)=>({method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),V=encodeURIComponent,$e=e=>e?`&level=${e}`:``;async function H(e,t){let n=await fetch(e,{credentials:`same-origin`,...t}),r=await n.json().catch(()=>({}));if(n.status===200)return r;if(n.status===422)return{ok:!1,reason:`invalid`,errors:r.errors??[],references:r.references??[]};if(n.status===409)return{ok:!1,reason:`conflict`,message:String(r.error??`conflict`)};throw new Qe(n.status,String(r.error??n.statusText))}function et(e,t){return t===null?e:`${e}${e.includes(`?`)?`&`:`?`}repository=${V(t)}`}function tt(e){return{writeMcpServer:(t,n,r,i)=>H(e(`/api/config/mcp-servers/${V(t)}`),B(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),deleteMcpServer:(t,n,r)=>H(e(`/api/config/mcp-servers/${V(t)}?revision=${V(n)}${$e(r)}`),{method:`DELETE`})}}function nt(e){let t=t=>et(t,e);return{pipelines:t=>R(et(`/api/pipelines`,t??e)),config:()=>R(t(`/api/config`)),catalog:()=>R(t(`/api/config/catalog`)),models:e=>R(t(`/api/config/models${e?`?refresh=1`:``}`)),writeSpecialist:(e,n,r,i)=>H(t(`/api/config/specialists/${V(e)}`),B(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),deleteSpecialist:(e,n,r)=>H(t(`/api/config/specialists/${V(e)}?revision=${V(n)}${$e(r)}`),{method:`DELETE`}),sharedSpecialists:()=>R(`/api/shared-specialists`),specialistTags:()=>R(`/api/specialist-tags`),importSpecialists:async(e,n)=>await H(t(`/api/config/specialists/import`),B(`POST`,{source:e,slugs:n})),sharedPipelines:()=>R(`/api/shared-pipelines`),importPipelines:async(e,n)=>await H(t(`/api/config/pipelines/import`),B(`POST`,{source:e,ids:n})),writeSetting:(e,n,r,i)=>H(t(`/api/config/settings/${V(e)}`),B(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),writeSettings:(e,n,r)=>H(t(`/api/config/settings`),B(`PUT`,{values:e,revision:n,...r?{level:r}:{}})),...tt(t),writePipeline:(e,n,r,i)=>H(t(`/api/config/pipelines/${V(e)}`),B(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),deletePipeline:(e,n,r)=>H(t(`/api/config/pipelines/${V(e)}?revision=${V(n)}${$e(r)}`),{method:`DELETE`}),previewPipeline:(e,n,r)=>z(t(`/api/config/pipelines/${V(e)}/preview`),{value:n,...r?{level:r}:{}}),writeAction:(e,n,r,i)=>H(t(`/api/config/actions/${V(e)}`),B(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),deleteAction:(e,n,r)=>H(t(`/api/config/actions/${V(e)}?revision=${V(n)}${$e(r)}`),{method:`DELETE`}),writeChain:(e,n,r,i)=>H(t(`/api/config/chains/${V(e)}`),B(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),deleteChain:(e,n,r)=>H(t(`/api/config/chains/${V(e)}?revision=${V(n)}${$e(r)}`),{method:`DELETE`}),systemStages:()=>R(t(`/api/system-stages`))}}function rt(e){return{tags:()=>R(e(`/api/tags`)),addTag:(t,n)=>z(e(`/api/tags`),n?{name:t,color:n}:{name:t}),editTag:(t,n)=>z(e(`/api/tags/edit`),{tag:t,...n}),removeTag:t=>z(e(`/api/tags/remove`),{tag:t}),queue:()=>R(e(`/api/queue`)),queueAdd:t=>z(e(`/api/queue/items`),t),queueEdit:(t,n)=>z(e(`/api/queue/items/${V(t)}`),n),queueRemove:t=>z(e(`/api/queue/items/${V(t)}/remove`)),queueRunNow:t=>z(e(`/api/queue/items/${V(t)}/run`)),queueStart:t=>z(e(`/api/queue/start`),t===void 0?{}:{parallel:t}),queuePause:()=>z(e(`/api/queue/pause`)),queueSettings:t=>z(e(`/api/queue/settings`),t),queueReturn:(e,t)=>z(et(`/api/queue/return`,t),{run:e}),queueDismiss:(e,t)=>z(et(`/api/queue/dismiss`,t),{run:e})}}function it(){return{answer:(e,t,n)=>z(`/api/runs/${V(e)}/groups/${V(t)}/answer`,{answer:n}),message:(e,t,n,r)=>z(`/api/runs/${V(e)}/groups/${V(t)}/message`,{seq:n,text:r}),retry:(e,t,n)=>z(`/api/runs/${V(e)}/groups/${V(t)}/retry`,n?.refreshConfig?{refreshConfig:!0}:{}),skipStep:(e,t,n)=>z(`/api/runs/${V(e)}/skip`,{step:t,skip:n}),cancel:(e,t)=>z(t?`/api/runs/${V(e)}/groups/${V(t)}/cancel`:`/api/runs/${V(e)}/cancel`),apply:(e,t)=>z(`/api/runs/${V(e)}/apply`,t?{force:!0}:{}),markDelivered:(e,t)=>z(`/api/runs/${V(e)}/delivered`,t?{groups:t}:{}),setRunTitle:(e,t)=>z(`/api/runs/${V(e)}/title`,{title:t}),cancelAutoDelivery:e=>z(`/api/runs/${V(e)}/auto-delivery/cancel`,{}),setRunTags:(e,t)=>z(`/api/runs/${V(e)}/tags`,t),pauseRun:(e,t)=>z(et(`/api/runs/${V(e)}/pause`,t))}}var at=50;function ot(){let e={runs:()=>R(`/api/runs`),finishedRuns:(e,t)=>R(`/api/finished-runs?limit=${at}${e?`&before=${V(e)}`:``}${t?`&repository=${V(t)}`:``}`),run:e=>R(`/api/runs/${V(e)}`),group:(e,t)=>R(`/api/runs/${V(e)}/groups/${V(t)}?tail=200`),groupSpec:(e,t)=>R(`/api/runs/${V(e)}/groups/${V(t)}/spec`),transcript:(e,t,n,r)=>R(`/api/runs/${V(e)}/groups/${V(t)}/transcript?seq=${n}&after=${r}`),fileDiff:(e,t,n)=>R(`/api/runs/${V(e)}/groups/${V(t)}/diff?path=${V(n)}`),groupArtifacts:async(e,t)=>(await R(`/api/runs/${V(e)}/groups/${V(t)}/artifacts`)).artifacts,artifactUrl:(e,t,n,r=!1)=>`/api/runs/${V(e)}/groups/${V(t)}/artifacts/${V(n)}${r?`?inline=1`:``}`,artifactText:async(t,n,r)=>{let i=await fetch(e.artifactUrl(t,n,r,!0),{credentials:`same-origin`});if(!i.ok){let e=await i.json().catch(()=>({}));throw new Qe(i.status,e.error??i.statusText)}return i.text()},runPatch:async e=>{let t=await fetch(`/api/runs/${V(e)}/patch`,{credentials:`same-origin`});if(!t.ok){let e=await t.json().catch(()=>({}));throw new Qe(t.status,e.error??t.statusText)}let n=/filename="([^"]+)"/.exec(t.headers.get(`content-disposition`)??``);return{blob:await t.blob(),fileName:n?.[1]??`${e}.patch`}}};return e}function st(){return{statsReport:(e={})=>{let t=new URLSearchParams;e.since!==void 0&&t.set(`since`,String(e.since)),e.until!==void 0&&t.set(`until`,String(e.until)),e.repository&&t.set(`repository`,e.repository);let n=t.toString();return R(`/api/stats${n?`?${n}`:``}`)},statsClear:e=>R(`/api/stats?repository=${encodeURIComponent(e)}`,{method:`DELETE`})}}function ct(e){return e.repair??null}var lt=e=>ct(e)?.active===!0,ut=e=>e.kind,dt=e=>ut(e)===`repair`,ft=e=>e===`autopilot`||e===`observer`?e:`human`;function pt(e){if(typeof e!=`object`||!e)return null;let{settings:t,workers:n}=e;return typeof t!=`object`||!t||typeof n!=`object`||!n?null:{settings:{enabled:t.enabled===!0,workers:Number(t.workers??1),maxRepairs:Number(t.maxRepairs??1),projects:Array.isArray(t.projects)?t.projects:[],specialist:typeof t.specialist==`object`&&t.specialist!==null?t.specialist:{}},workers:{running:Array.isArray(n.running)?n.running:[],waiting:Number(n.waiting??0)}}}function mt(e){let t=pt(e);if(t===null)throw new Qe(502,`Malformed answer of /api/observers`);return t}async function ht(e){let t=await fetch(`/api/observers`,{credentials:`same-origin`,...B(`PUT`,e)}),n=await t.json().catch(()=>({}));if(t.status===200)return{ok:!0,view:mt(n)};if(t.status===422)return{ok:!1,errors:n.errors??[]};throw new Qe(t.status,String(n.error??t.statusText))}function gt(){return{repositories:()=>R(`/api/repositories`),addRepository:(e,t={})=>z(`/api/repositories`,{path:e,...t}),updateRepository:(e,t)=>R(`/api/repositories?repository=${V(e)}`,B(`PATCH`,t)),moveRepository:(e,t)=>z(`/api/repositories/move?repository=${V(e)}`,{to:t}),removeRepository:e=>R(`/api/repositories?repository=${V(e)}`,{method:`DELETE`}),directories:e=>R(e===void 0?`/api/directories`:`/api/directories?path=${V(e)}`),processes:()=>R(`/api/processes`),killProcess:e=>z(`/api/processes/${e}/kill`),system:()=>R(`/api/system`),restartWeb:async()=>void await z(`/api/system/web/restart`),restartDaemon:async e=>void await z(`/api/system/daemon/restart`,e?{force:!0}:{}),stopDaemon:async e=>void await z(`/api/system/daemon/stop`,e?{force:!0}:{}),startDaemon:async()=>void await z(`/api/system/daemon/start`),observers:async()=>mt(await R(`/api/observers`)),setObservers:ht,setRunObserver:(e,t,n)=>z(et(`/api/runs/${V(e)}/observer`,t),{enabled:n})}}var _t=[`claude`,`opencode`,`agy`,`command`],vt=[`running`,`finished`,`failed`,`cancelled`],yt=[`done`,`rejected`,`needs_human`],bt=e=>Number.isSafeInteger(e)&&e>=0&&Number.isFinite(new Date(e).getTime());function xt(e){if(!e||typeof e!=`object`)return!1;let t=e,n=[`running`,`done`,`rejected`,`needs_human`,`failed`,`cancelled`,`unknown`],r=e=>e===null||typeof e==`string`;return Array.isArray(t.items)&&Array.isArray(t.projects)&&t.projects.every(e=>typeof e==`string`)&&(t.nextCursor===null||typeof t.nextCursor==`string`)&&[20,50,100].includes(t.limit??0)&&bt(t.asOf)&&t.items.every(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&typeof t.runId==`string`&&Number.isSafeInteger(t.runNumber)&&typeof t.runTitle==`string`&&typeof t.repository==`string`&&Number.isSafeInteger(t.attemptSeq)&&_t.includes(t.runtime)&&r(t.model)&&bt(t.startedAt)&&(t.finishedAt===null||bt(t.finishedAt))&&vt.includes(t.status)&&(t.verdict===null||yt.includes(t.verdict))&&n.includes(t.result??``)&&r(t.failureKind)&&(t.usage===null||!!t.usage&&typeof t.usage==`object`&&Number.isSafeInteger(t.usage.inputTokens)&&t.usage.inputTokens>=0&&Number.isSafeInteger(t.usage.outputTokens)&&t.usage.outputTokens>=0&&(t.usage.costUsd===null||typeof t.usage.costUsd==`number`&&Number.isFinite(t.usage.costUsd)&&t.usage.costUsd>=0))})}async function St(e={}){let t=new URLSearchParams;for(let n of[`repository`,`runtime`,`model`,`result`,`from`,`to`,`limit`,`cursor`]){let r=e[n];r!==void 0&&r!==``&&t.set(n,String(r))}let n=await R(`/api/observers/history${t.size?`?${t}`:``}`);if(!xt(n))throw new Qe(502,`Malformed answer of /api/observers/history`);return n}function Ct(e){let t={forRepository:n=>n===e?t:Ct(n),...ot(),...it(),...rt(t=>et(t,e)),...gt(),...nt(e),...st(),observerHistory:St};return t}var wt=Ct(null),Tt={type:`3rdParty`,init(e){ne(e.options.react),ae(e)}},U=r();function Et(e){return(0,U.jsx)(Ee,{closeButton:!0,position:`bottom-right`,...e})}var Dt=Object.defineProperty,Ot=(e,t)=>Dt(e,`name`,{value:t,configurable:!0}),kt=`Collapsible`,[At,jt]=c(kt),[Mt,Nt]=At(kt),Pt=L.forwardRef(Ot(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:o,onOpenChange:s,...c}=e,[u,d]=l({prop:r,defaultProp:i??!1,onChange:s,caller:kt});return(0,U.jsx)(Mt,{scope:n,disabled:o,contentId:a(),open:u,onOpenToggle:L.useCallback(()=>d(e=>!e),[d]),children:(0,U.jsx)(f.div,{"data-state":Bt(u),"data-disabled":o?``:void 0,...c,ref:t})})},`Collapsible`)),Ft=`CollapsibleTrigger`,It=L.forwardRef(Ot(function(e,t){let{__scopeCollapsible:n,...r}=e,i=Nt(Ft,n);return(0,U.jsx)(f.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":Bt(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:y(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),Lt=`CollapsibleContent`,Rt=L.forwardRef(Ot(function(e,t){let{forceMount:n,...r}=e,i=Nt(Lt,e.__scopeCollapsible);return(0,U.jsx)(b,{present:n||i.open,children:({present:e})=>(0,U.jsx)(zt,{...r,ref:t,present:e})})},`CollapsibleContent`)),zt=L.forwardRef(Ot(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=Nt(Lt,n),[s,c]=L.useState(r),l=L.useRef(null),u=w(t,l),d=L.useRef(0),p=d.current,m=L.useRef(0),h=m.current,g=o.open||s,_=L.useRef(g),v=L.useRef(void 0);return L.useEffect(()=>{let e=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(e)},[]),x(()=>{let e=l.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,m.current=t.width,_.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),c(r)}},[o.open,r]),(0,U.jsx)(f.div,{"data-state":Bt(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!g,...a,ref:u,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...e.style},children:g&&i})},`CollapsibleContentImpl`));function Bt(e){return e?`open`:`closed`}Ot(Bt,`getState`);var Vt=Object.defineProperty,Ht=(e,t)=>Vt(e,`name`,{value:t,configurable:!0}),Ut=`Checkbox`,[Wt,Gt]=c(Ut),[Kt,qt]=Wt(Ut);function Jt(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[p,m]=l({prop:n,defaultProp:i??!1,onChange:c,caller:Ut}),[h,g]=L.useState(null),[_,v]=L.useState(null),[y,b]=L.useState(null),x=!h||!!o||!!h.closest(`form`),S={checked:p,disabled:a,setChecked:m,control:h,setControl:g,name:s,form:o,value:d,userClick:y,onUserClick:b,required:u,defaultChecked:!W(i)&&i,isFormControl:x,bubbleInput:_,setBubbleInput:v};return(0,U.jsx)(Kt,{scope:t,...S,children:nn(f)?f(S):r})}Ht(Jt,`CheckboxProvider`);var Yt=`CheckboxTrigger`,Xt=L.forwardRef(Ht(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,onUserClick:p,isFormControl:m,bubbleInput:h}=qt(Yt,e),g=w(i,u),_=L.useRef(c);return L.useEffect(()=>{let e=a?.form;if(e){let t=Ht(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,U.jsx)(f.button,{type:`button`,role:`checkbox`,"aria-checked":W(c)?`mixed`:c,"aria-required":l,"data-state":rn(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:y(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:y(n,e=>{let t=e.isPropagationStopped();p({requestedChecked:W(c)?!0:!c,hasConsumerStoppedPropagation:t}),d(e=>W(e)?!0:!e),h&&m&&(t||e.stopPropagation())})})},`CheckboxTrigger`)),Zt=L.forwardRef(Ht(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,U.jsx)(Jt,{__scopeCheckbox: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,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Xt,{...d,ref:t,__scopeCheckbox:n}),e&&(0,U.jsx)(tn,{__scopeCheckbox:n})]})})},`Checkbox`)),Qt=`CheckboxIndicator`,$t=L.forwardRef(Ht(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=qt(Qt,n);return(0,U.jsx)(b,{present:r||W(a.checked)||a.checked===!0,children:(0,U.jsx)(f.span,{"data-state":rn(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),en=`CheckboxBubbleInput`,tn=L.forwardRef(Ht(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,userClick:a,checked:o,defaultChecked:s,required:c,disabled:l,name:u,value:d,form:p,bubbleInput:m,setBubbleInput:h}=qt(en,e),g=w(r,h),_=We(i),v=L.useRef(!1),b=L.useRef(o),x=L.useRef(a),S=L.useRef(null);L.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=b.current!==o;b.current=o;let i=a!==null&&a!==x.current;if(x.current=a,i)S.current=r?null:a,r&&(e.indeterminate=W(o),n.call(e,!W(o)&&o)),e.dispatchEvent(new Event(`click`,{bubbles:!a.hasConsumerStoppedPropagation}));else if(r){let t=S.current;S.current=null;let r=t?.requestedChecked===o;v.current=!0,e.indeterminate=W(o),n.call(e,!W(o)&&o),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),v.current=!1}},[m,o,a]);let C=L.useRef(!W(o)&&o);return(0,U.jsx)(f.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??C.current,required:c,disabled:l,name:u,value:d,form:p,...n,tabIndex:-1,ref:g,onClick:y(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function nn(e){return typeof e==`function`}Ht(nn,`isFunction`);function W(e){return e===`indeterminate`}Ht(W,`isIndeterminate`);function rn(e){return W(e)?`indeterminate`:e?`checked`:`unchecked`}Ht(rn,`getState`);var an=Object.defineProperty,G=(e,t)=>an(e,`name`,{value:t,configurable:!0}),on=[`Enter`,` `],sn=[`ArrowDown`,`PageUp`,`Home`],cn=[`ArrowUp`,`PageDown`,`End`],ln=[...sn,...cn];[...on],[...on];var un=`Menu`,[dn,fn,pn]=ve(un),[mn,hn]=c(un,[pn,He,we]),gn=He(),_n=we(),[vn,yn]=mn(un),[bn,xn]=mn(un),Sn=G(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=gn(t),[c,l]=L.useState(null),u=L.useRef(!1),d=de(a),f=ge(i);return L.useEffect(()=>{let e=G(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=G(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),L.useEffect(()=>{if(!n)return;let e=G(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,U.jsx)(Ue,{...s,children:(0,U.jsx)(vn,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,U.jsx)(bn,{scope:t,onClose:L.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),Cn=L.forwardRef(G(function(e,t){let{__scopeMenu:n,...r}=e,i=gn(n);return(0,U.jsx)(Be,{...i,...r,ref:t})},`MenuAnchor`)),wn=`MenuPortal`,[Tn,En]=mn(wn,{forceMount:void 0}),Dn=G(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=yn(wn,t);return(0,U.jsx)(Tn,{scope:t,forceMount:n,children:(0,U.jsx)(b,{present:n||a.open,children:(0,U.jsx)(m,{asChild:!0,container:i,children:r})})})},`MenuPortal`),On=`MenuContent`,[kn,An]=mn(On),jn=L.forwardRef(G(function(e,t){let n=En(On,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=yn(On,e.__scopeMenu),o=xn(On,e.__scopeMenu);return(0,U.jsx)(dn.Provider,{scope:e.__scopeMenu,children:(0,U.jsx)(b,{present:r||a.open,children:(0,U.jsx)(dn.Slot,{scope:e.__scopeMenu,children:o.modal?(0,U.jsx)(Mn,{...i,ref:t}):(0,U.jsx)(Nn,{...i,ref:t})})})})},`MenuContent`)),Mn=L.forwardRef(G(function(e,t){let n=yn(On,e.__scopeMenu),r=L.useRef(null),i=w(t,r);return L.useEffect(()=>{let e=r.current;if(e)return Ie(e)},[]),(0,U.jsx)(Fn,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:y(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Nn=L.forwardRef(G(function(e,t){let n=yn(On,e.__scopeMenu);return(0,U.jsx)(Fn,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Pn=d(`MenuContent.ScrollLock`),Fn=L.forwardRef(G(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:_,onDismiss:v,disableOutsideScroll:b,...x}=e,S=yn(On,n),C=xn(On,n),T=gn(n),E=_n(n),ee=fn(n),[D,te]=L.useState(null),O=L.useRef(null),[ne,k]=L.useState(null);s(ne);let{nodes:re,registry:A}=u(),ie=!!(i||b),j=w(t,O,S.onContentChange,k),ae=L.useRef(0),oe=L.useRef(``),se=L.useRef(0),ce=L.useRef(null),le=L.useRef(`right`),M=L.useRef(0),ue=L.useMemo(()=>b?[O,...re.map(e=>({current:e}))]:[],[O,re,b]),de=b?be:L.Fragment,N=b?{as:Pn,allowPinchZoom:!0,shards:ue}:void 0,fe=G(e=>{let t=oe.current+e,n=ee().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=ir(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;function s(e){oe.current=e,window.clearTimeout(ae.current),e!==``&&(ae.current=window.setTimeout(()=>s(``),1e3))}G(s,`updateSearch`),s(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);L.useEffect(()=>()=>window.clearTimeout(ae.current),[]),_e();let P=L.useCallback(e=>le.current===ce.current?.side&&or(e,ce.current?.area),[]);return(0,U.jsx)(kn,{scope:n,searchRef:oe,onItemEnter:L.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:L.useCallback(e=>{P(e)||(O.current?.focus(),te(null))},[P]),onTriggerLeave:L.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:se,onPointerGraceIntentChange:L.useCallback(e=>{ce.current=e},[]),children:(0,U.jsx)(g,{registry:ie?A:null,children:(0,U.jsx)(de,{...N,children:(0,U.jsx)(h,{asChild:!0,trapped:i,branches:re,onMountAutoFocus:y(a,e=>{e.preventDefault(),O.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,U.jsx)(p,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:_,onDismiss:v,children:(0,U.jsx)(je,{asChild:!0,...E,dir:C.dir,orientation:`vertical`,loop:r,currentTabStopId:D,onCurrentTabStopIdChange:te,onEntryFocus:y(l,e=>{C.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,U.jsx)(ze,{role:`menu`,"aria-orientation":`vertical`,"data-state":$n(S.open),"data-radix-menu-content":``,dir:C.dir,...T,...x,ref:j,style:{outline:`none`,...x.style},onKeyDown:y(x.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&fe(e.key));let i=O.current;if(e.target!==i||!ln.includes(e.key))return;e.preventDefault();let a=ee().filter(e=>!e.disabled).map(e=>e.ref.current);cn.includes(e.key)&&a.reverse(),nr(a)}),onBlur:y(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(ae.current),oe.current=``)}),onPointerMove:y(e.onPointerMove,sr(e=>{let t=e.target,n=M.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>M.current?`right`:`left`;le.current=t,M.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),In=L.forwardRef(G(function(e,t){let{__scopeMenu:n,...r}=e;return(0,U.jsx)(f.div,{role:`group`,...r,ref:t})},`MenuGroup`)),Ln=`MenuItem`,Rn=`menu.itemSelect`,zn=L.forwardRef(G(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=L.useRef(null),o=xn(Ln,e.__scopeMenu),s=An(Ln,e.__scopeMenu),c=w(t,a),l=L.useRef(!1),u=G(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Rn,{bubbles:!0,cancelable:!0});e.addEventListener(Rn,e=>r?.(e),{once:!0}),se(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,U.jsx)(Bn,{...i,ref:c,disabled:n,onClick:y(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:y(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:y(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&on.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Bn=L.forwardRef(G(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=An(Ln,n),s=_n(n),c=L.useRef(null),l=w(t,c),[u,d]=L.useState(!1),[p,m]=L.useState(``);return L.useEffect(()=>{let e=c.current;e&&m((e.textContent??``).trim())},[a.children]),(0,U.jsx)(dn.ItemSlot,{scope:n,disabled:r,textValue:i??p,children:(0,U.jsx)(Oe,{asChild:!0,...s,focusable:!r,children:(0,U.jsx)(f.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:y(e.onPointerMove,sr(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:y(e.onPointerLeave,sr(e=>o.onItemLeave(e))),onFocus:y(e.onFocus,()=>d(!0)),onBlur:y(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[Vn,Hn]=mn(`MenuRadioGroup`,{value:void 0,onValueChange:G(()=>{},`onValueChange`)}),Un=L.forwardRef(G(function(e,t){let{value:n,onValueChange:r,...i}=e,a=de(r);return(0,U.jsx)(Vn,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,U.jsx)(In,{...i,ref:t})})},`MenuRadioGroup`)),Wn=`MenuRadioItem`,Gn=L.forwardRef(G(function(e,t){let{value:n,...r}=e,i=Hn(Wn,e.__scopeMenu),a=n===i.value;return(0,U.jsx)(qn,{scope:e.__scopeMenu,checked:a,children:(0,U.jsx)(zn,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":tr(a),onSelect:y(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})},`MenuRadioItem`)),Kn=`MenuItemIndicator`,[qn,Jn]=mn(Kn,{checked:!1}),Yn=L.forwardRef(G(function(e,t){let{__scopeMenu:n,forceMount:r,...i}=e,a=Jn(Kn,n);return(0,U.jsx)(b,{present:r||er(a.checked)||a.checked===!0,children:(0,U.jsx)(f.span,{...i,ref:t,"data-state":tr(a.checked)})})},`MenuItemIndicator`)),Xn=L.forwardRef(G(function(e,t){let{__scopeMenu:n,...r}=e;return(0,U.jsx)(f.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[Zn,Qn]=mn(`MenuSub`);function $n(e){return e?`open`:`closed`}G($n,`getOpenState`);function er(e){return e===`indeterminate`}G(er,`isIndeterminate`);function tr(e){return er(e)?`indeterminate`:e?`checked`:`unchecked`}G(tr,`getCheckedState`);function nr(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}G(nr,`focusFirst`);function rr(e,t){return e.map((n,r)=>e[(t+r)%e.length])}G(rr,`wrapArray`);function ir(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=rr(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}G(ir,`getNextMatch`);function ar(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}G(ar,`isPointInPolygon`);function or(e,t){return t?ar({x:e.clientX,y:e.clientY},t):!1}G(or,`isPointerInGraceArea`);function sr(e){return t=>t.pointerType===`mouse`?e(t):void 0}G(sr,`whenMouse`);var cr=Object.defineProperty,lr=(e,t)=>cr(e,`name`,{value:t,configurable:!0}),ur=`DropdownMenu`,[dr,fr]=c(ur,[hn]),pr=hn(),[mr,hr]=dr(ur),gr=lr(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:c=!0}=e,u=pr(t),d=L.useRef(null),[f,p]=l({prop:i,defaultProp:o??!1,onChange:s,caller:ur});return(0,U.jsx)(mr,{scope:t,triggerId:a(),triggerRef:d,contentId:a(),open:f,onOpenChange:p,onOpenToggle:L.useCallback(()=>p(e=>!e),[p]),modal:c,children:(0,U.jsx)(Sn,{...u,open:f,onOpenChange:p,dir:r,modal:c,children:n})})},`DropdownMenu`),_r=`DropdownMenuTrigger`,vr=L.forwardRef(lr(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=hr(_r,n),o=pr(n),s=w(t,a.triggerRef);return(0,U.jsx)(Cn,{asChild:!0,...o,children:(0,U.jsx)(f.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:y(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:y(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),yr=lr(e=>{let{__scopeDropdownMenu:t,...n}=e,r=pr(t);return(0,U.jsx)(Dn,{...r,...n})},`DropdownMenuPortal`),br=`DropdownMenuContent`,xr=L.forwardRef(lr(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=hr(br,n),a=pr(n),o=L.useRef(!1);return(0,U.jsx)(jn,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:y(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:y(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),Sr=L.forwardRef(lr(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=pr(n);return(0,U.jsx)(zn,{...i,...r,ref:t})},`DropdownMenuItem`)),Cr=L.forwardRef(lr(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=pr(n);return(0,U.jsx)(Un,{...i,...r,ref:t})},`DropdownMenuRadioGroup`)),wr=L.forwardRef(lr(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=pr(n);return(0,U.jsx)(Gn,{...i,...r,ref:t})},`DropdownMenuRadioItem`)),Tr=L.forwardRef(lr(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=pr(n);return(0,U.jsx)(Yn,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),Er=L.forwardRef(lr(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=pr(n);return(0,U.jsx)(Xn,{...i,...r,ref:t})},`DropdownMenuSeparator`)),Dr=Object.defineProperty,Or=L.forwardRef(((e,t)=>Dr(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,U.jsx)(f.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),kr=Object.defineProperty,Ar=(e,t)=>kr(e,`name`,{value:t,configurable:!0}),jr=`Popover`,[Mr,Nr]=c(jr,[He]),Pr=He(),[Fr,Ir]=Mr(jr),Lr=Ar(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!1}=e,c=Pr(t),u=L.useRef(null),[d,f]=L.useState(!1),[p,m]=L.useState(0),[h,g]=L.useState(0),[_,v]=l({prop:r,defaultProp:i??!1,onChange:o,caller:jr});return(0,U.jsx)(Ue,{...c,children:(0,U.jsx)(Fr,{scope:t,contentId:a(),titleId:a(),descriptionId:a(),titlePresent:p>0,descriptionPresent:h>0,setTitleCount:m,setDescriptionCount:g,triggerRef:u,open:_,onOpenChange:v,onOpenToggle:L.useCallback(()=>v(e=>!e),[v]),hasCustomAnchor:d,onCustomAnchorAdd:L.useCallback(()=>f(!0),[]),onCustomAnchorRemove:L.useCallback(()=>f(!1),[]),modal:s,children:n})})},`Popover`),Rr=`PopoverTrigger`,zr=L.forwardRef(Ar(function(e,t){let{__scopePopover:n,...r}=e,i=Ir(Rr,n),a=Pr(n),o=w(t,i.triggerRef),s=(0,U.jsx)(f.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Xr(i.open),...r,ref:o,onClick:y(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,U.jsx)(Be,{asChild:!0,...a,children:s})},`PopoverTrigger`)),Br=`PopoverPortal`,[Vr,Hr]=Mr(Br,{forceMount:void 0}),Ur=Ar(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Ir(Br,t);return(0,U.jsx)(Vr,{scope:t,forceMount:n,children:(0,U.jsx)(b,{present:n||a.open,children:(0,U.jsx)(m,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),Wr=`PopoverContent`,Gr=L.forwardRef(Ar(function(e,t){let n=Hr(Wr,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Ir(Wr,e.__scopePopover);return(0,U.jsx)(b,{present:r||a.open,children:a.modal?(0,U.jsx)(qr,{...i,ref:t}):(0,U.jsx)(Jr,{...i,ref:t})})},`PopoverContent`)),Kr=d(`PopoverContent.RemoveScroll`),qr=L.forwardRef(Ar(function(e,t){let n=Ir(Wr,e.__scopePopover),r=L.useRef(null),i=w(t,r),a=L.useRef(!1),{nodes:o,registry:s}=u();return L.useEffect(()=>{let e=r.current;if(e)return Ie(e)},[]),(0,U.jsx)(be,{as:Kr,allowPinchZoom:!0,shards:L.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,U.jsx)(Yr,{...e,ref:i,branchNodes:o,branchRegistry:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:y(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:y(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:y(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),Jr=L.forwardRef(Ar(function(e,t){let n=Ir(Wr,e.__scopePopover),r=L.useRef(!1),i=L.useRef(!1);return(0,U.jsx)(Yr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),Yr=L.forwardRef(Ar(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,"aria-describedby":f,branchNodes:m,branchRegistry:_,...v}=e,y=Ir(Wr,n),b=Pr(n),[x,S]=L.useState(null),C=w(t,S);return s(x),_e(),(0,U.jsx)(g,{registry:_,children:(0,U.jsx)(h,{asChild:!0,loop:!0,trapped:r,branches:m,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,U.jsx)(p,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>y.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,U.jsx)(ze,{"data-state":Xr(y.open),role:`dialog`,id:y.contentId,"aria-labelledby":y.titlePresent?y.titleId:void 0,"aria-describedby":y.descriptionPresent?Zr(f,y.descriptionId):f,...b,...v,ref:C,style:{...v.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`));function Xr(e){return e?`open`:`closed`}Ar(Xr,`getState`);function Zr(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}Ar(Zr,`concatAriaDescribedby`);var Qr=Object.defineProperty,$r=(e,t)=>Qr(e,`name`,{value:t,configurable:!0}),ei=`Switch`,[ti,ni]=c(ei),[ri,ii]=ti(ei);function ai(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[p,m]=l({prop:n,defaultProp:i??!1,onChange:c,caller:ei}),[h,g]=L.useState(null),[_,v]=L.useState(null),[y,b]=L.useState(null),x={checked:p,setChecked:m,disabled:a,control:h,setControl:g,name:s,form:o,value:d,userClick:y,onUserClick:b,required:u,defaultChecked:i,isFormControl:!h||!!o||!!h.closest(`form`),bubbleInput:_,setBubbleInput:v};return(0,U.jsx)(ri,{scope:t,...x,children:pi(f)?f(x):r})}$r(ai,`SwitchProvider`);var oi=`SwitchTrigger`,si=L.forwardRef($r(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,onUserClick:p,isFormControl:m,bubbleInput:h}=ii(oi,e),g=w(r,u),_=L.useRef(c);return L.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=$r(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,U.jsx)(f.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":mi(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:g,onClick:y(t,e=>{let t=e.isPropagationStopped();p({requestedChecked:!c,hasConsumerStoppedPropagation:t}),d(e=>!e),h&&m&&(t||e.stopPropagation())})})},`SwitchTrigger`)),ci=L.forwardRef($r(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,U.jsx)(ai,{__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,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(si,{...d,ref:t,__scopeSwitch:n}),e&&(0,U.jsx)(fi,{__scopeSwitch:n})]})})},`Switch`)),li=`SwitchThumb`,ui=L.forwardRef($r(function(e,t){let{__scopeSwitch:n,...r}=e,i=ii(li,n);return(0,U.jsx)(f.span,{"data-state":mi(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),di=`SwitchBubbleInput`,fi=L.forwardRef($r(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,userClick:a,checked:o,defaultChecked:s,required:c,disabled:l,name:u,value:d,form:p,bubbleInput:m,setBubbleInput:h}=ii(di,e),g=w(r,h),_=We(i),v=L.useRef(!1),b=L.useRef(o),x=L.useRef(a),S=L.useRef(null);L.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=b.current!==o;b.current=o;let i=a!==null&&a!==x.current;if(x.current=a,i)S.current=r?null:a,r&&n.call(e,o),e.dispatchEvent(new Event(`click`,{bubbles:!a.hasConsumerStoppedPropagation}));else if(r){let t=S.current;S.current=null;let r=t?.requestedChecked===o;v.current=!0,n.call(e,o),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),v.current=!1}},[m,o,a]);let C=L.useRef(o);return(0,U.jsx)(f.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??C.current,required:c,disabled:l,name:u,value:d,form:p,...n,tabIndex:-1,ref:g,onClick:y(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function pi(e){return typeof e==`function`}$r(pi,`isFunction`);function mi(e){return e?`checked`:`unchecked`}$r(mi,`getState`);var hi=Object.defineProperty,gi=(e,t)=>hi(e,`name`,{value:t,configurable:!0}),_i={Automatic:`automatic`,Manual:`manual`},vi=`Tabs`,[yi,bi]=c(vi,[we]),xi=we(),[Si,Ci]=yi(vi),wi=L.forwardRef(gi(function(e,t){let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s=`horizontal`,dir:c,activationMode:u=_i.Automatic,...d}=e,p=ge(c),[m,h]=l({prop:r,onChange:i,defaultProp:o??``,caller:vi});return(0,U.jsx)(Si,{scope:n,baseId:a(),value:m,onValueChange:h,orientation:s,dir:p,activationMode:u,children:(0,U.jsx)(f.div,{dir:p,"data-orientation":s,...d,ref:t})})},`Tabs`)),Ti=`TabsList`,Ei=L.forwardRef(gi(function(e,t){let{__scopeTabs:n,loop:r=!0,...i}=e,a=Ci(Ti,n),o=xi(n);return(0,U.jsx)(je,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,U.jsx)(f.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})},`TabsList`)),Di=`TabsTrigger`,Oi=L.forwardRef(gi(function(e,t){let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Ci(Di,n),s=xi(n),c=ji(o.baseId,r),l=Mi(o.baseId,r),u=r===o.value;return(0,U.jsx)(Oe,{asChild:!0,...s,focusable:!i,active:u,children:(0,U.jsx)(f.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:y(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?(e.currentTarget.focus(),o.onValueChange(r)):e.preventDefault()}),onKeyDown:y(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:y(e.onFocus,()=>{let e=o.activationMode!==_i.Manual;!u&&!i&&e&&o.onValueChange(r)})})})},`TabsTrigger`)),ki=`TabsContent`,Ai=L.forwardRef(gi(function(e,t){let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Ci(ki,n),c=ji(s.baseId,r),l=Mi(s.baseId,r),u=r===s.value,d=L.useRef(u);return L.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,U.jsx)(b,{present:i||u,children:({present:n})=>(0,U.jsx)(f.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})},`TabsContent`));function ji(e,t){return`${e}-trigger-${t}`}gi(ji,`makeTriggerId`);function Mi(e,t){return`${e}-content-${t}`}gi(Mi,`makeContentId`);var Ni=Object.defineProperty,K=(e,t)=>Ni(e,`name`,{value:t,configurable:!0}),[Pi,Fi]=c(`Tooltip`,[He]),Ii=He(),Li=`TooltipProvider`,Ri=700,zi=`tooltip.open`,[Bi,Vi]=Pi(Li),Hi=K(e=>{let{__scopeTooltip:t,delayDuration:n=Ri,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=L.useRef(!0),s=L.useRef(!1),c=L.useRef(0);return L.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,U.jsx)(Bi,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:L.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:L.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:L.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),Ui=`Tooltip`,[Wi,Gi]=Pi(Ui),Ki=K(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:o,disableHoverableContent:s,delayDuration:c}=e,u=Vi(Ui,e.__scopeTooltip),d=Ii(t),[f,p]=L.useState(null),[m,h]=L.useState(void 0),g=a(),_=L.useRef(0),v=s??u.disableHoverableContent,y=c??u.delayDuration,b=L.useRef(!1),[x,S]=l({prop:r,defaultProp:i??!1,onChange:K(e=>{e?(u.onOpen(),document.dispatchEvent(new CustomEvent(zi))):u.onClose(),o?.(e)},`onChange`),caller:Ui}),C=L.useMemo(()=>x?b.current?`delayed-open`:`instant-open`:`closed`,[x]),w=L.useCallback(()=>{window.clearTimeout(_.current),_.current=0,b.current=!1,S(!0)},[S]),T=L.useCallback(()=>{window.clearTimeout(_.current),_.current=0,S(!1)},[S]),E=L.useCallback(()=>{window.clearTimeout(_.current),_.current=window.setTimeout(()=>{b.current=!0,S(!0),_.current=0},y)},[y,S]);L.useEffect(()=>()=>{_.current&&=(window.clearTimeout(_.current),0)},[]);let ee=m??g;return(0,U.jsx)(Ue,{...d,children:(0,U.jsx)(Wi,{scope:t,contentId:ee,setContentId:h,open:x,stateAttribute:C,trigger:f,onTriggerChange:p,onTriggerEnter:L.useCallback(()=>{u.isOpenDelayedRef.current?E():w()},[u.isOpenDelayedRef,E,w]),onTriggerLeave:L.useCallback(()=>{v?T():(window.clearTimeout(_.current),_.current=0)},[T,v]),onOpen:w,onClose:T,disableHoverableContent:v,children:n})})},`Tooltip`),qi=`TooltipTrigger`,Ji=L.forwardRef(K(function(e,t){let{__scopeTooltip:n,"aria-describedby":r,...i}=e,a=Gi(qi,n),o=Vi(qi,n),s=Ii(n),c=L.useRef(null),l=w(t,c,a.onTriggerChange),u=L.useRef(!1),d=L.useRef(!1),p=L.useCallback(()=>u.current=!1,[]);return L.useEffect(()=>()=>document.removeEventListener(`pointerup`,p),[p]),(0,U.jsx)(Be,{asChild:!0,...s,children:(0,U.jsx)(f.button,{"aria-describedby":a.open?ua(r,a.contentId):r,"data-state":a.stateAttribute,...i,ref:l,onPointerMove:y(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),d.current=!0)}),onPointerLeave:y(e.onPointerLeave,()=>{a.onTriggerLeave(),d.current=!1}),onPointerDown:y(e.onPointerDown,()=>{a.open&&a.onClose(),u.current=!0,document.addEventListener(`pointerup`,p,{once:!0})}),onFocus:y(e.onFocus,()=>{u.current||a.onOpen()}),onBlur:y(e.onBlur,a.onClose),onClick:y(e.onClick,a.onClose)})})},`TooltipTrigger`)),Yi=`TooltipPortal`,[Xi,Zi]=Pi(Yi,{forceMount:void 0}),Qi=K(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Gi(Yi,t);return(0,U.jsx)(Xi,{scope:t,forceMount:n,children:(0,U.jsx)(b,{present:n||a.open,children:(0,U.jsx)(m,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),$i=`TooltipContent`,ea=L.forwardRef(K(function(e,t){let n=Zi($i,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Gi($i,e.__scopeTooltip);return(0,U.jsx)(b,{present:r||o.open,children:o.disableHoverableContent?(0,U.jsx)(ra,{side:i,...a,ref:t}):(0,U.jsx)(ta,{side:i,...a,ref:t})})},`TooltipContent`)),ta=L.forwardRef(K(function(e,t){let n=Gi($i,e.__scopeTooltip),r=Vi($i,e.__scopeTooltip),i=L.useRef(null),a=w(t,i),[o,s]=L.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=L.useCallback(()=>{s(null),d(!1)},[d]),p=L.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=aa(r,ia(r,n.getBoundingClientRect())),a=oa(t.getBoundingClientRect()),o=ca([...i,...a]);s(o),d(!0)},[d]);return L.useEffect(()=>()=>f(),[f]),L.useEffect(()=>{if(c&&u){let e=K(e=>p(e,u),`handleTriggerLeave`),t=K(e=>p(e,c),`handleContentLeave`);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),L.useEffect(()=>{if(o){let e=K(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!sa(n,o);r?f():i&&(f(),l())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,U.jsx)(ra,{...e,ref:a})},`TooltipContentHoverable`)),na=C(`TooltipContent`),ra=L.forwardRef(K(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:c,...l}=e,u=Gi($i,n),d=Ii(n),{onClose:f}=u,[m,h]=L.useState(null),g=w(t,h);s(m),L.useEffect(()=>(document.addEventListener(zi,f),()=>document.removeEventListener(zi,f)),[f]),L.useEffect(()=>{if(u.trigger){let e=K(e=>{e.target instanceof Node&&e.target.contains(u.trigger)&&f()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[u.trigger,f]);let{setContentId:_}=u;return x(()=>(_(a),()=>{_(void 0)}),[a,_]),(0,U.jsx)(p,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:f,children:(0,U.jsxs)(ze,{"data-state":u.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:u.contentId,...d,...l,ref:g,style:{...l.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,U.jsx)(na,{children:r}),i?(0,U.jsx)(Ve,{id:u.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`));function ia(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}K(ia,`getExitSideFromRect`);function aa(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}K(aa,`getPaddedExitPoints`);function oa(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}K(oa,`getPointsFromRect`);function sa(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}K(sa,`isPointInPolygon`);function ca(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),la(t)}K(ca,`getHull`);function la(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}K(la,`getHullPresorted`);function ua(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}K(ua,`concatAriaDescribedby`);function da({delayDuration:e=300,...t}){return(0,U.jsx)(Hi,{delayDuration:e,...t})}var q=Ki,J=Ji;function Y({className:e,sideOffset:t=4,children:n,...r}){return(0,U.jsx)(Qi,{children:(0,U.jsx)(ea,{sideOffset:t,className:k(`z-50 max-w-xs rounded-md bg-foreground px-2 py-1 text-xs text-background`,e),...r,children:n})})}var fa={name:`activity`,size:24,node:[[`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`}]]};fa.node;var pa=i(fa),ma={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};ma.node;var ha=i(ma),ga={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};ga.node;var _a=i(ga),va={name:`ban`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]};va.node;var ya=i(va),ba={name:`bell`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]};ba.node;var xa=i(ba),Sa={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};Sa.node;var Ca=i(Sa),wa={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};wa.node;var Ta=i(wa),Ea={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};Ea.node;var Da=i(Ea),Oa={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Oa.node;var ka=i(Oa),Aa={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};Aa.node;var ja=i(Aa),Ma={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};Ma.node;var Na=i(Ma),Pa={name:`circle-dashed`,size:24,node:[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]};Pa.node;var Fa=i(Pa),Ia={name:`circle-pause`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]],aliases:[`pause-circle`]};Ia.node;var La=i(Ia),Ra={name:`circle-stop`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]],aliases:[`stop-circle`]};Ra.node;var za=i(Ra),Ba={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-circle`]};Ba.node;var Va=i(Ba),Ha={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};Ha.node;var Ua=i(Ha),Wa={name:`copy`,size:24,node:[[`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`}]]};Wa.node;var Ga=i(Wa),Ka={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};Ka.node;var qa=i(Ka),Ja={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};Ja.node;var Ya=i(Ja),Xa={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Xa.node;var Za=i(Xa),Qa={name:`file`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]};Qa.node;var $a=i(Qa),eo={name:`folder-git-2`,size:24,node:[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]};eo.node;var to=i(eo),no={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};no.node;var ro=i(no),io={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};io.node;var ao=i(io),oo={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};oo.node;var so=i(oo),co={name:`git-merge`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]};co.node;var lo=i(co),uo={name:`hourglass`,size:24,node:[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]};uo.node;var fo=i(uo),po={name:`house`,size:24,node:[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]],aliases:[`home`]};po.node;var mo=i(po),ho={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};ho.node;var go=i(ho),_o={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};_o.node;var vo=i(_o),yo={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};yo.node;var bo=i(yo),xo={name:`list-ordered`,size:24,node:[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]};xo.node;var So=i(xo),Co={name:`list-plus`,size:24,node:[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]};Co.node;var wo=i(Co),To={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};To.node;var Eo=i(To),Do={name:`message-circle-question-mark`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`message-circle-question`]};Do.node;var Oo=i(Do),ko={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};ko.node;var Ao=i(ko),jo={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};jo.node;var Mo=i(jo),No={name:`moon`,size:24,node:[[`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`}]]};No.node;var Po=i(No),Fo={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};Fo.node;var Io=i(Fo),Lo={name:`package-check`,size:24,node:[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]};Lo.node;var Ro=i(Lo),zo={name:`package-open`,size:24,node:[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]};zo.node;var Bo=i(zo),Vo={name:`package-x`,size:24,node:[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16.5 14.5 5 5`,key:`ozpm51`}],[`path`,{d:`m16.5 19.5 5-5`,key:`syf6b9`}],[`path`,{d:`M21 10.5V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l.13-.074`,key:`isw6gs`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]};Vo.node;var Ho=i(Vo),Uo={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};Uo.node;var Wo=i(Uo),Go={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Go.node;var Ko=i(Go),qo={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};qo.node;var Jo=i(qo),Yo={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};Yo.node;var Xo=i(Yo),Zo={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Zo.node;var Qo=i(Zo),$o={name:`search-x`,size:24,node:[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]};$o.node;var es=i($o),ts={name:`settings-2`,size:24,node:[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]};ts.node;var ns=i(ts),rs={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};rs.node;var is=i(rs),as={name:`skip-forward`,size:24,node:[[`path`,{d:`M21 4v16`,key:`7j8fe9`}],[`path`,{d:`M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`zs4d6`}]]};as.node;var os=i(as),ss={name:`snowflake`,size:24,node:[[`path`,{d:`m10 20-1.25-2.5L6 18`,key:`18frcb`}],[`path`,{d:`M10 4 8.75 6.5 6 6`,key:`7mghy3`}],[`path`,{d:`m14 20 1.25-2.5L18 18`,key:`1chtki`}],[`path`,{d:`m14 4 1.25 2.5L18 6`,key:`1b4wsy`}],[`path`,{d:`m17 21-3-6h-4`,key:`15hhxa`}],[`path`,{d:`m17 3-3 6 1.5 3`,key:`11697g`}],[`path`,{d:`M2 12h6.5L10 9`,key:`kv9z4n`}],[`path`,{d:`m20 10-1.5 2 1.5 2`,key:`1swlpi`}],[`path`,{d:`M22 12h-6.5L14 15`,key:`1mxi28`}],[`path`,{d:`m4 10 1.5 2L4 14`,key:`k9enpj`}],[`path`,{d:`m7 21 3-6-1.5-3`,key:`j8hb9u`}],[`path`,{d:`m7 3 3 6h4`,key:`1otusx`}]]};ss.node;var cs=i(ss),ls={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};ls.node;var us=i(ls),ds={name:`sun`,size:24,node:[[`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`}]]};ds.node;var fs=i(ds),ps={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};ps.node;var ms=i(ps),hs={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};hs.node;var gs=i(hs),_s={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};_s.node;var vs=i(_s),ys={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};ys.node;var bs=i(ys),xs=[{view:`runs`,labelKey:`runs`,icon:pa},{view:`queue`,labelKey:`queue`,icon:So},{view:`specialists`,labelKey:`specialists`,icon:gs},{view:`pipelines`,labelKey:`pipelines`,icon:so},{view:`stats`,labelKey:`stats`,icon:Ca},{view:`settings`,labelKey:`settings`,icon:is}];function Ss(e,t){let n=xs.find(t=>t.view===e);return n?t(`nav.${n.labelKey}`):e}var Cs=Ce,ws=he;function Ts({className:e,side:t=`left`,children:n,...r}){return(0,U.jsxs)(Le,{children:[(0,U.jsx)(Se,{className:`fixed inset-0 z-50 bg-black/50`}),(0,U.jsx)(Fe,{className:k(`fixed inset-y-0 z-50 flex w-72 max-w-[85vw] flex-col gap-2 border bg-card p-3 shadow-lg`,t===`left`?`left-0 border-l-0`:`right-0 border-r-0`,e),...r,children:n})]})}function Es({className:e,...t}){return(0,U.jsx)(ye,{className:k(`text-sm font-semibold`,e),...t})}function Ds({className:e,...t}){return(0,U.jsx)(Re,{className:k(`sr-only`,e),...t})}var Os=`[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]`,ks=`input, textarea, select, [role="combobox"], [contenteditable=""], [contenteditable="true"]`;function As(){return typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)}function js(){return As()?`⌘`:`Ctrl`}function Ms(e,t){return e.startsWith(`mod+`)?(As()?t.metaKey:t.ctrlKey)&&!t.altKey&&t.key.toLowerCase()===e.slice(4):!t.metaKey&&!t.ctrlKey&&!t.altKey&&t.key===e}function Ns(e,t,n={}){let r=(0,L.useRef)(t);r.current=t;let i=n.allowInInputs??e.startsWith(`mod+`);(0,L.useEffect)(()=>{let t=t=>{if(!Ms(e,t))return;let n=t.target instanceof Element?t.target:null;(i||!n?.closest(ks)&&!document.querySelector(Os))&&r.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,i])}var Ps=null,Fs=new Set;function Is(e){Ps=e;for(let t of Fs)t(e)}function Ls(e,t){let n=n=>{n===e&&(Ps=null,t())};return Ps===e&&(Ps=null,t()),Fs.add(n),()=>Fs.delete(n)}function Rs({className:e,...t}){return(0,U.jsx)(`kbd`,{className:k(`inline-flex h-5 min-w-5 items-center justify-center rounded border bg-muted px-1 font-mono text-[11px] text-muted-foreground`,e),...t})}var zs=gr,Bs=vr,Vs=Cr;function Hs({className:e,sideOffset:t=4,...n}){return(0,U.jsx)(yr,{children:(0,U.jsx)(xr,{sideOffset:t,className:k(`z-50 min-w-40 rounded-md border bg-card p-1 text-card-foreground shadow-md`,e),...n})})}function X({className:e,...t}){return(0,U.jsx)(Sr,{className:k(`flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled]:opacity-50 data-[highlighted]:bg-accent [&_svg]:size-4`,e),...t})}function Us({className:e,children:t,...n}){return(0,U.jsxs)(wr,{className:k(`relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-7 text-sm outline-none select-none data-[highlighted]:bg-accent`,e),...n,children:[(0,U.jsx)(`span`,{className:`absolute left-2 flex size-4 items-center justify-center`,children:(0,U.jsx)(Tr,{children:(0,U.jsx)(Ta,{className:`size-4`})})}),t]})}function Ws({className:e,...t}){return(0,U.jsx)(Er,{className:k(`-mx-1 my-1 h-px bg-border`,e),...t})}function Gs({className:e,type:t=`text`,...n}){return(0,U.jsx)(`input`,{type:t,className:k(`h-9.5 w-full min-w-0 rounded-md border border-input bg-card px-2.5 text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive`,e),...n})}var Ks=1,qs=.9,Js=.8,Ys=.17,Xs=.1,Zs=.999,Qs=.9999,$s=.99,ec=/[\\\/_+.#"@\[\(\{&]/,tc=/[\\\/_+.#"@\[\(\{&]/g,nc=/[\s-]/,rc=/[\s-]/g;function ic(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Ks:$s;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=ic(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Ks:ec.test(e.charAt(l-1))?(d*=Js,p=e.slice(i,l-1).match(tc),p&&i>0&&(d*=Zs**+p.length)):nc.test(e.charAt(l-1))?(d*=qs,m=e.slice(i,l-1).match(rc),m&&i>0&&(d*=Zs**+m.length)):(d*=Ys,i>0&&(d*=Zs**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Qs)),(d<Xs&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=ic(e,t,n,r,l+1,a+2,o),f*Xs>d&&(d=f*Xs)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function ac(e){return e.toLowerCase().replace(rc,` `)}function oc(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,ic(e,t,ac(e),ac(t),0,0,{})}var sc=`[cmdk-group=""]`,cc=`[cmdk-group-items=""]`,lc=`[cmdk-group-heading=""]`,uc=`[cmdk-item=""]`,dc=`${uc}:not([aria-disabled="true"])`,fc=`cmdk-item-select`,pc=`data-value`,mc=(e,t,n)=>oc(e,t,n),hc=L.createContext(void 0),gc=()=>L.useContext(hc),_c=L.createContext(void 0),vc=()=>L.useContext(_c),yc=L.createContext(void 0),bc=L.forwardRef((e,t)=>{let n=Pc(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=Pc(()=>new Set),i=Pc(()=>new Map),o=Pc(()=>new Map),s=Pc(()=>new Set),c=Mc(e),{label:l,children:u,value:d,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=a(),x=a(),S=a(),C=L.useRef(null),w=Lc();Nc(()=>{if(d!==void 0){let e=d.trim();n.current.value=e,T.emit()}},[d]),Nc(()=>{w(6,ne)},[]);let T=L.useMemo(()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),D(),w(1,te);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(w(7,()=>{n.current.selectedItemId=k()?.id,T.emit()}),r||w(5,ne),c.current?.value!==void 0){let e=t??``;(o=(a=c.current).onValueChange)==null||o.call(a,e);return}}T.emit()}},emit:()=>{s.current.forEach(e=>e())}}),[]),E=L.useMemo(()=>({value:(e,t,r)=>{t!==o.current.get(e)?.value&&(o.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,ee(t,r)),w(2,()=>{D(),T.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),w(3,()=>{O(),D(),n.current.value||te(),T.emit()}),()=>{o.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=k();w(4,()=>{O(),t?.getAttribute(`id`)===e&&te(),T.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{o.current.delete(e),i.current.delete(e)}),filter:()=>c.current.shouldFilter,label:l||e[`aria-label`],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:b,inputId:S,labelId:x,listInnerRef:C}),[]);function ee(e,t){let r=c.current?.filter??mc;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||c.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=C.current;re().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(cc);t?t.appendChild(e.parentElement===t?e:e.closest(`${cc} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${cc} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${sc}[${pc}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function te(){let e=re().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(pc);T.setState(`value`,e||void 0)}function O(){if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=ee(o.current.get(t)?.value??``,o.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function ne(){var e;let t=k();t&&(t.parentElement?.firstChild===t&&((e=t.closest(sc)?.querySelector(lc))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function k(){return C.current?.querySelector(`${uc}[aria-selected="true"]`)}function re(){return Array.from(C.current?.querySelectorAll(dc)||[])}function A(e){let t=re()[e];t&&T.setState(`value`,t.getAttribute(pc))}function ie(e){var t;let n=k(),r=re(),i=r.findIndex(e=>e===n),a=r[i+e];(t=c.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&T.setState(`value`,a.getAttribute(pc))}function j(e){let t=k()?.closest(sc),n;for(;t&&!n;)t=e>0?Ac(t,sc):jc(t,sc),n=t?.querySelector(dc);n?T.setState(`value`,n.getAttribute(pc)):ie(e)}let ae=()=>A(re().length-1),oe=e=>{e.preventDefault(),e.metaKey?ae():e.altKey?j(1):ie(1)},se=e=>{e.preventDefault(),e.metaKey?A(0):e.altKey?j(-1):ie(-1)};return L.createElement(f.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&oe(e);break;case`ArrowDown`:oe(e);break;case`p`:case`k`:v&&e.ctrlKey&&se(e);break;case`ArrowUp`:se(e);break;case`Home`:e.preventDefault(),A(0);break;case`End`:e.preventDefault(),ae();break;case`Enter`:{e.preventDefault();let t=k();if(t){let e=new Event(fc);t.dispatchEvent(e)}}}}},L.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:Bc},l),zc(e,e=>L.createElement(_c.Provider,{value:T},L.createElement(hc.Provider,{value:E},e))))}),xc=L.forwardRef((e,t)=>{let n=a(),r=L.useRef(null),i=L.useContext(yc),o=gc(),s=Mc(e),c=s.current?.forceMount??i?.forceMount;Nc(()=>{if(!c)return o.item(n,i?.id)},[c]);let l=Ic(n,r,[e.value,e.children,r],e.keywords),u=vc(),d=Fc(e=>e.value&&e.value===l.current),p=Fc(e=>c||o.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);L.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(fc,m),()=>t.removeEventListener(fc,m)},[p,e.onSelect,e.disabled]);function m(){var e,t;h(),(t=(e=s.current).onSelect)==null||t.call(e,l.current)}function h(){u.setState(`value`,l.current,!0)}if(!p)return null;let{disabled:g,value:_,onSelect:v,forceMount:y,keywords:b,...x}=e;return L.createElement(f.div,{ref:S(r,t),...x,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!g,"aria-selected":!!d,"data-disabled":!!g,"data-selected":!!d,onPointerMove:g||o.getDisablePointerSelection()?void 0:h,onClick:g?void 0:m},e.children)}),Sc=L.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...o}=e,s=a(),c=L.useRef(null),l=L.useRef(null),u=a(),d=gc(),p=Fc(e=>i||d.filter()===!1?!0:!e.search||e.filtered.groups.has(s));Nc(()=>d.group(s),[]),Ic(s,c,[e.value,e.heading,l]);let m=L.useMemo(()=>({id:s,forceMount:i}),[i]);return L.createElement(f.div,{ref:S(c,t),...o,"cmdk-group":``,role:`presentation`,hidden:!p||void 0},n&&L.createElement(`div`,{ref:l,"cmdk-group-heading":``,"aria-hidden":!0,id:u},n),zc(e,e=>L.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?u:void 0},L.createElement(yc.Provider,{value:m},e))))}),Cc=L.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=L.useRef(null),a=Fc(e=>!e.search);return!n&&!a?null:L.createElement(f.div,{ref:S(i,t),...r,"cmdk-separator":``,role:`separator`})}),wc=L.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=vc(),o=Fc(e=>e.search),s=Fc(e=>e.selectedItemId),c=gc();return L.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),L.createElement(f.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Tc=L.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=L.useRef(null),o=L.useRef(null),s=Fc(e=>e.selectedItemId),c=gc();return L.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),L.createElement(f.div,{ref:S(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},zc(e,e=>L.createElement(`div`,{ref:S(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Ec=L.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return L.createElement(Ce,{open:n,onOpenChange:r},L.createElement(Le,{container:o},L.createElement(Se,{"cmdk-overlay":``,className:i}),L.createElement(Fe,{"aria-label":e.label,"cmdk-dialog":``,className:a},L.createElement(bc,{ref:t,...s}))))}),Dc=L.forwardRef((e,t)=>Fc(e=>e.filtered.count===0)?L.createElement(f.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Oc=L.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return L.createElement(f.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},zc(e,e=>L.createElement(`div`,{"aria-hidden":!0},e)))}),kc=Object.assign(bc,{List:Tc,Item:xc,Input:wc,Group:Sc,Separator:Cc,Dialog:Ec,Empty:Dc,Loading:Oc});function Ac(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function jc(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Mc(e){let t=L.useRef(e);return Nc(()=>{t.current=e}),t}var Nc=typeof window>`u`?L.useEffect:L.useLayoutEffect;function Pc(e){let t=L.useRef();return t.current===void 0&&(t.current=e()),t}function Fc(e){let t=vc(),n=()=>e(t.snapshot());return L.useSyncExternalStore(t.subscribe,n,n)}function Ic(e,t,n,r=[]){let i=L.useRef(),a=gc();return Nc(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(pc,s),i.current=s}),i}var Lc=()=>{let[e,t]=L.useState(),n=Pc(()=>new Map);return Nc(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Rc(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function zc({asChild:e,children:t},n){return e&&L.isValidElement(t)?L.cloneElement(Rc(t),{ref:t.ref},n(t.props.children)):n(t)}var Bc={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},Vc=Ce;function Hc({className:e,children:t,...n}){let{t:r}=_();return(0,U.jsxs)(Le,{children:[(0,U.jsx)(Se,{className:`fixed inset-0 z-50 bg-black/50`}),(0,U.jsxs)(Fe,{className:k(`fixed top-1/2 left-1/2 z-50 grid max-h-[85vh] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-3 overflow-y-auto rounded-lg border bg-card p-5 shadow-lg`,e),...n,children:[t,(0,U.jsx)(xe,{"aria-label":r(`common.close`),className:`absolute top-3 right-3 rounded-sm text-muted-foreground hover:text-foreground`,children:(0,U.jsx)(bs,{className:`size-4`})})]})]})}function Uc({className:e,...t}){return(0,U.jsx)(`div`,{className:k(`flex flex-col gap-1.5`,e),...t})}function Wc({className:e,...t}){return(0,U.jsx)(`div`,{className:k(`flex justify-end gap-2`,e),...t})}function Gc({className:e,...t}){return(0,U.jsx)(ye,{className:k(`text-base font-semibold`,e),...t})}function Kc({className:e,...t}){return(0,U.jsx)(Re,{className:k(`text-sm text-muted-foreground`,e),...t})}function qc({className:e,...t}){return(0,U.jsx)(kc,{className:k(`flex size-full flex-col overflow-hidden rounded-md bg-card`,e),...t})}function Jc({open:e,onOpenChange:t,title:n,children:r}){return(0,U.jsx)(Vc,{open:e,onOpenChange:t,children:(0,U.jsxs)(Hc,{className:`top-[20%] translate-y-0 gap-0 overflow-hidden p-0 max-w-xl`,children:[(0,U.jsx)(Gc,{className:`sr-only`,children:n}),(0,U.jsx)(Kc,{className:`sr-only`,children:n}),(0,U.jsx)(qc,{children:r})]})})}function Yc({className:e,...t}){return(0,U.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-3`,children:[(0,U.jsx)(Qo,{className:`size-4 shrink-0 opacity-60`}),(0,U.jsx)(kc.Input,{className:k(`h-10 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground`,e),...t})]})}function Xc({className:e,...t}){return(0,U.jsx)(kc.List,{className:k(`max-h-80 overflow-y-auto p-1`,e),...t})}function Zc(e){return(0,U.jsx)(kc.Empty,{className:`py-6 text-center text-sm text-muted-foreground`,...e})}function Z({className:e,...t}){return(0,U.jsx)(kc.Group,{className:k(`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function Q({className:e,...t}){return(0,U.jsx)(kc.Item,{className:k(`flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[selected=true]:bg-accent [&_svg]:size-4`,e),...t})}var Qc=Lr,$c=zr;function el({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,U.jsx)(Ur,{children:(0,U.jsx)(Gr,{align:t,sideOffset:n,className:k(`z-50 w-[var(--radix-popover-trigger-width)] min-w-72 max-w-[min(32rem,90vw)] rounded-md border bg-card text-card-foreground shadow-md outline-none`,e),...r})})}function tl(e,t){return e.filter(e=>E(e,e,t))}function nl({id:e,label:t,value:n,open:r,listId:i,count:a}){let{t:s}=_();return(0,U.jsx)($c,{asChild:!0,children:(0,U.jsxs)(o,{id:e,type:`button`,variant:`outline`,role:`combobox`,"aria-label":t,"aria-expanded":r,"aria-haspopup":`listbox`,"aria-controls":r?i:void 0,title:n,className:`h-9.5 w-full justify-start px-2.5`,children:[(0,U.jsx)(to,{"aria-hidden":!0}),(0,U.jsx)(De,{path:n}),(0,U.jsx)(`span`,{className:`flex-1 truncate text-left`,children:A(n)}),a>0?(0,U.jsx)(I,{variant:`warn`,"aria-label":s(`nav.repositoryWaiting`,{count:a}),children:a}):null]})})}function rl({path:e,chosen:t,waits:n,onSelect:r}){let{t:i}=_();return(0,U.jsxs)(Q,{value:e,title:e,onSelect:r,children:[(0,U.jsx)(Ta,{className:t?`opacity-100`:`opacity-0`}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate`,children:[(0,U.jsx)(De,{path:e}),(0,U.jsx)(`span`,{className:`truncate`,children:A(e)})]}),(0,U.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e})]}),n>0?(0,U.jsx)(I,{variant:`warn`,"aria-label":i(`nav.repositoryWaiting`,{count:n}),children:n}):null]})}function il({id:e,label:t,repositories:n,value:r,waiting:i,onChange:a}){let{t:o}=_(),s=(0,L.useId)(),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(``),f=tl(n,u),p=i.get(r)??0;return(0,U.jsxs)(Qc,{open:c,onOpenChange:e=>{l(e),e||d(``)},children:[(0,U.jsx)(nl,{id:e,label:t,value:r,open:c,listId:s,count:p}),(0,U.jsx)(el,{align:`start`,className:`w-(--radix-popover-trigger-width) min-w-64 p-0`,children:(0,U.jsxs)(qc,{shouldFilter:!1,label:o(`picker.search`,{label:t}),children:[(0,U.jsx)(Yc,{value:u,onValueChange:d,placeholder:o(`queue.form.repositorySearch`)}),(0,U.jsxs)(Xc,{id:s,children:[f.length===0?(0,U.jsx)(Zc,{children:o(`picker.nothing`)}):null,(0,U.jsx)(Z,{children:f.map(e=>(0,U.jsx)(rl,{path:e,chosen:e===r,waits:i.get(e)??0,onSelect:()=>{a(e),l(!1),d(``)}},e))})]})]})})]})}function al(e,t){let n=t.endsWith(`/`)&&t.length>1?t.slice(0,-1):t;return e===n?`~`:e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}function ol(e,t,n){let[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(!1),d=e=>{i(e),o(al(e.path,e.home)),c(null)},f=(0,L.useCallback)(async e=>{u(!0);try{d(await n(e===``?void 0:e))}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}},[n]);return(0,L.useEffect)(()=>{if(!e)return;let r=t.trim();n(r===``?void 0:r).then(d,()=>f())},[e,t,n,f]),{listing:r,typed:a,setTyped:o,error:s,busy:l,go:f}}function sl({browser:e}){let{t}=_(),{listing:n,typed:r,setTyped:i,busy:a,go:s}=e,c=e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),s(r.trim()))},l=n?.parent??null;return(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(o,{type:`button`,variant:`outline`,size:`icon`,"aria-label":t(`pathPicker.up`),title:t(`pathPicker.up`),disabled:a||l===null,onClick:()=>l!==null&&void s(l),children:(0,U.jsx)(_a,{"aria-hidden":!0})}),(0,U.jsx)(o,{type:`button`,variant:`outline`,size:`icon`,"aria-label":t(`pathPicker.home`),title:t(`pathPicker.home`),disabled:a,onClick:()=>void s(),children:(0,U.jsx)(mo,{"aria-hidden":!0})}),(0,U.jsx)(Gs,{"aria-label":t(`pathPicker.path`),value:r,className:`min-w-0 flex-1`,onChange:e=>i(e.target.value),onKeyDown:c}),(0,U.jsx)(o,{type:`button`,variant:`outline`,disabled:a||r.trim()===``,onClick:()=>void s(r.trim()),children:t(`pathPicker.go`)})]})}function cl({browser:e}){let{t}=_(),{listing:n,busy:r,go:i}=e,a=e=>(0,U.jsx)(`li`,{className:`px-2 py-3 text-sm text-muted-foreground`,children:e});return(0,U.jsxs)(`ul`,{"aria-label":t(`pathPicker.title`),"aria-busy":r,className:`h-72 overflow-y-auto rounded-md border p-1`,children:[n===null?a(t(`pathPicker.loading`)):n.entries.length===0?a(t(`pathPicker.empty`)):n.entries.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,"data-directory":e.path,disabled:r,className:k(`flex w-full min-w-0 items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm`,`hover:bg-accent focus-visible:bg-accent focus-visible:outline-none`),onClick:()=>void i(e.path),children:[e.git?(0,U.jsx)(to,{"aria-hidden":!0,className:`size-4 shrink-0 text-primary`}):(0,U.jsx)(ao,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.name}),e.git?(0,U.jsx)(I,{variant:`outline`,className:`ml-auto`,children:`git`}):null]})},e.path)),n?.truncated?(0,U.jsx)(`li`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:t(`pathPicker.truncated`,{count:n.entries.length})}):null]})}function ll({open:e,start:t,browse:n,onOpenChange:r,onChoose:i}){let{t:a}=_(),s=ol(e,t,n),{listing:c,error:l,busy:u}=s;return(0,U.jsx)(Vc,{open:e,onOpenChange:r,children:(0,U.jsxs)(Hc,{className:`sm:max-w-xl`,"data-directory-dialog":!0,children:[(0,U.jsxs)(Uc,{children:[(0,U.jsx)(Gc,{children:a(`pathPicker.title`)}),(0,U.jsx)(Kc,{children:a(`pathPicker.description`)})]}),(0,U.jsx)(sl,{browser:s}),l?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:l}):null,(0,U.jsx)(cl,{browser:s}),(0,U.jsxs)(Wc,{children:[(0,U.jsx)(o,{type:`button`,variant:`outline`,onClick:()=>r(!1),children:a(`common.cancel`)}),(0,U.jsxs)(o,{type:`button`,disabled:u||c===null,onClick:()=>{c!==null&&(i(al(c.path,c.home)),r(!1))},children:[c?.git?(0,U.jsx)(to,{"aria-hidden":!0}):(0,U.jsx)(ro,{"aria-hidden":!0}),a(`pathPicker.choose`)]})]})]})})}function ul({id:e,value:t,onChange:n,browse:r,placeholder:i,invalid:a=!1,describedBy:s,autoFocus:c=!1,required:l=!1}){let{t:u}=_(),[d,f]=(0,L.useState)(!1);return(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(Gs,{id:e,value:t,required:l,placeholder:i,autoFocus:c,className:`min-w-0 flex-1`,"aria-invalid":a,"aria-describedby":s,onChange:e=>n(e.target.value)}),(0,U.jsxs)(o,{type:`button`,variant:`outline`,onClick:()=>f(!0),"data-path-browse":!0,children:[(0,U.jsx)(ro,{"aria-hidden":!0}),u(`pathPicker.browse`)]}),(0,U.jsx)(ll,{open:d,start:t,browse:r,onOpenChange:f,onChoose:n})]})}function dl({className:e,...t}){return(0,U.jsx)(Or,{className:k(`text-sm leading-none font-medium select-none`,e),...t})}function fl(){return k(`flex h-8 w-full shrink-0 items-center gap-2 justify-start rounded-md px-2 text-sm [&_svg]:size-4 [&_svg]:shrink-0`)}function pl({open:e,onOpenChange:t,onAdd:n,browse:r}){let{t:i}=_(),[a,s]=(0,L.useState)(``),[c,l]=(0,L.useState)(null),[u,d]=(0,L.useState)(!1),f=async e=>{if(e.preventDefault(),!(u||a.trim()===``)){d(!0),l(null);try{await n(a.trim()),s(``),t(!1)}catch(e){l(e instanceof Error?e.message:String(e))}finally{d(!1)}}};return(0,U.jsx)(Vc,{open:e,onOpenChange:e=>{e||l(null),t(e)},children:(0,U.jsx)(Hc,{children:(0,U.jsxs)(`form`,{onSubmit:e=>void f(e),className:`grid gap-3`,children:[(0,U.jsxs)(Uc,{children:[(0,U.jsx)(Gc,{children:i(`nav.repositoryAddTitle`)}),(0,U.jsx)(Kc,{children:i(`nav.repositoryAddDescription`)})]}),(0,U.jsx)(dl,{htmlFor:`repository-path`,children:i(`nav.repositoryPath`)}),(0,U.jsx)(ul,{id:`repository-path`,value:a,onChange:s,browse:r,placeholder:`~/projects/app`,autoFocus:!0,invalid:c!==null,describedBy:c?`repository-path-error`:void 0}),c?(0,U.jsx)(`p`,{id:`repository-path-error`,role:`alert`,className:`text-sm text-destructive`,children:c}):null,(0,U.jsxs)(Wc,{children:[(0,U.jsx)(o,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:i(`common.cancel`)}),(0,U.jsx)(o,{type:`submit`,disabled:u||a.trim()===``,children:i(`nav.repositoryAddSubmit`)})]})]})})})}function ml({name:e,label:t,title:n,others:r,compact:i}){let{t:a}=_();return(0,U.jsx)(Bs,{asChild:!0,children:(0,U.jsxs)(o,{variant:`outline`,"data-nav-row":!0,"data-repository-trigger":!0,className:k(fl(),`relative`,i&&`w-auto max-w-48`),"aria-label":t,title:n,children:[(0,U.jsx)(to,{"aria-hidden":!0}),(0,U.jsx)(De,{path:n}),(0,U.jsx)(`span`,{className:`flex-1 truncate text-left`,children:e}),r>0?(0,U.jsx)(I,{variant:`warn`,"aria-label":a(`nav.repositoryWaiting`,{count:r}),children:r}):null]})})}function hl({path:e,shown:t,count:n}){let{t:r}=_();return(0,U.jsxs)(Us,{value:e,title:e,className:`min-h-[3.25rem]`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate`,children:[(0,U.jsx)(De,{path:e}),(0,U.jsx)(`span`,{className:`truncate`,children:A(e)})]}),(0,U.jsx)(`span`,{className:`text-xs break-all whitespace-normal text-muted-foreground`,children:t})]}),n>0?(0,U.jsx)(I,{variant:`warn`,className:`ml-3`,"aria-label":r(`nav.repositoryWaiting`,{count:n}),children:n}):null]})}function gl({ref:e,query:t,onQuery:n}){let{t:r}=_();return(0,U.jsx)(Gs,{ref:e,type:`search`,value:t,placeholder:r(`nav.repositorySearch`),"aria-label":r(`nav.repositorySearch`),className:`mb-1 h-8`,onChange:e=>n(e.target.value),onKeyDown:e=>{[`ArrowDown`,`ArrowUp`,`Escape`,`Tab`].includes(e.key)||e.stopPropagation()}})}function _l(e){let{t}=_(),{matching:n,waiting:r}=e;return(0,U.jsxs)(`div`,{"data-repository-list":!0,className:`max-h-[calc(3.25rem*5.5)] overflow-y-auto`,children:[(0,U.jsx)(Vs,{value:e.selected,onValueChange:e.onSelect,children:n.map(t=>(0,U.jsx)(hl,{path:t,shown:e.shownPath(t),count:r.get(t)??0},t))}),n.length===0?(0,U.jsx)(`p`,{className:`px-2 py-3 text-center text-sm text-muted-foreground`,children:t(`nav.repositoryNone`)}):null]})}function vl({compact:e,onAdd:t,browse:n}){let{t:r}=_(),[i,a]=(0,L.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(o,{variant:`outline`,"data-repository-add-empty":!0,className:k(fl(),e&&`w-auto max-w-48`),"aria-label":r(`nav.repositoryAdd`),title:r(`nav.repositoryAdd`),onClick:()=>a(!0),children:[(0,U.jsx)(Ko,{"aria-hidden":!0}),(0,U.jsx)(`span`,{className:`flex-1 truncate text-left`,children:r(`nav.repositoryAdd`)})]}),(0,U.jsx)(pl,{open:i,onOpenChange:a,onAdd:t,browse:n})]})}var yl=ie({view:`settings`,run:`projects`,group:`global`,step:null,tab:null});function bl({choice:e,compact:t=!1}){let{t:n}=_(),{repositories:r,selected:i,waiting:a,onSelect:o}=e,s={onAdd:e.onAdd,browse:e.browse},c=t=>e.paths?.get(t)??t,l=(0,L.useRef)(null),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(!1),[m,h]=(0,L.useState)(!1);if((0,L.useEffect)(()=>{if(!m)return;let e=setTimeout(()=>l.current?.focus(),0);return()=>clearTimeout(e)},[m]),i===null)return(0,U.jsx)(vl,{compact:t,...s});let g=A(i),v=r.filter(e=>e!==i).reduce((e,t)=>e+(a.get(t)??0),0),y=r.filter(e=>E(e,c(e),u)),b=(0,U.jsx)(ml,{name:g,label:n(`nav.repositoryCurrent`,{name:g}),title:i,others:v,compact:t});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(zs,{open:m,onOpenChange:e=>{h(e),e||d(``)},children:[b,(0,U.jsxs)(Hs,{align:`start`,"aria-label":n(`nav.repository`),className:`w-80 max-w-[calc(100vw-1rem)]`,children:[(0,U.jsx)(gl,{ref:l,query:u,onQuery:d}),(0,U.jsx)(_l,{matching:y,selected:i,shownPath:c,waiting:a,onSelect:o}),(0,U.jsx)(Ws,{}),(0,U.jsxs)(X,{onSelect:()=>p(!0),children:[(0,U.jsx)(Ko,{"aria-hidden":!0}),n(`nav.repositoryAdd`)]}),(0,U.jsx)(X,{asChild:!0,children:(0,U.jsxs)(`a`,{href:yl,"data-projects-link":!0,children:[(0,U.jsx)(ns,{"aria-hidden":!0}),n(`nav.repositoryManage`)]})})]})]}),(0,U.jsx)(pl,{open:f,onOpenChange:p,...s})]})}function xl({target:e,count:t,waiting:n,corner:r=!1,className:i}){let{t:a}=_();return(0,U.jsx)(I,{variant:e===`runs`?n>0?`warn`:`run`:`mute`,"aria-label":e===`runs`?n>0?a(`nav.workingWaiting`,{count:t,waiting:n}):a(`nav.working`,{count:t}):a(`nav.queued`,{count:t}),className:k(r&&`absolute -right-2 -top-2 min-w-4 justify-center px-1 py-0 text-[10px] leading-4`,i),children:r&&t>99?`99+`:t})}function Sl(e){return`#${e}`}function Cl(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m${String(t%60).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}function wl(e){return!e||e.costUsd===null||e.costUsd===0?``:`$${e.costUsd.toFixed(2)}`}function Tl(e){return e==null?`—`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function El(e){return!e||e.inputTokens===0&&e.outputTokens===0?``:`${Tl(e.inputTokens)}/${Tl(e.outputTokens)}`}function Dl(e,t){return t(`format.files`,{count:e})}function Ol(e,t){return e?`${Dl(e.files,t)} +${e.added} −${e.removed}`:``}function kl(e){return e.title||e.groups.map(e=>e.title).join(`, `)||e.id}function Al(e,t,n){let r=new Date(e),i=r.toLocaleTimeString(n,{hour:`2-digit`,minute:`2-digit`});return new Date(t).toDateString()===r.toDateString()?i:`${r.toLocaleDateString(n,{day:`2-digit`,month:`2-digit`})} ${i}`}function jl(e){return e.total<=0?0:Math.min(100,Math.max(0,Math.round(e.done/e.total*100)))}function Ml(e,t){return e.finished&&e.finishedAt!==null?e.finishedAt:e.clockStoppedAt??t}function Nl(e,t,n){let r=Ml(e,t);return{created:Al(e.createdAt,t,n),duration:Cl(r-e.createdAt)}}function Pl(e,t){return e.map((e,n)=>`Q${n+1}: ${e.text}\nA${n+1}: ${(t[n]??``).trim()}`).join(`
|
|
3
|
+
|
|
4
|
+
`)}function Fl(e,t,n){let r=2166136261;for(let e of n)r^=e.codePointAt(0),r=Math.imul(r,16777619)>>>0;return`${e}/q${t}/${r.toString(16).padStart(8,`0`)}`}function Il(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function Ll(e,t){if(e===`step skipped`)return t(`runs.group.skippedReason`);let n=/^network: (.*)$/s.exec(e);if(n)return t(`runs.group.networkReason`,{problem:n[1]??``});let r=/^usage limit(?:, resets (\d\d:\d\d))?$/.exec(e);return r?r[1]?t(`runs.group.limitReasonAt`,{time:r[1]}):t(`runs.group.limitReason`):e}function Rl(e,t){let n=Math.max(0,Math.floor(e)),r=t(`format.unitSec`),i=t(`format.unitMin`);return n<60?`${n} ${r}`:n<3600?`${Math.floor(n/60)} ${i} ${n%60} ${r}`:`${Math.floor(n/3600)} ${t(`format.unitHour`)} ${Math.floor(n%3600/60)} ${i}`}function zl(e,t){return`${new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(e)} %`}function Bl(e,t,n){let r=(e,t)=>new Intl.NumberFormat(n,{maximumFractionDigits:t}).format(e);return e>=1024**3?`${r(e/1024**3,1)} ${t(`format.unitGb`)}`:e>=1024**2?`${r(e/1024**2,0)} ${t(`format.unitMb`)}`:`${r(e/1024,0)} ${t(`format.unitKb`)}`}function Vl(e,t,n){let r=e=>new Intl.NumberFormat(n,{maximumFractionDigits:1}).format(e);return e>=1024**2?`${r(e/1024**2)} ${t(`format.unitMb`)}`:e>=1024?`${r(e/1024)} ${t(`format.unitKb`)}`:`${e} ${t(`format.unitB`)}`}function Hl(e){let t=new Date(e);return[t.getHours(),t.getMinutes(),t.getSeconds()].map(e=>String(e).padStart(2,`0`)).join(`:`)}function Ul(e,t){return new Date(e).toLocaleString(t)}var Wl={queued:{labelKey:`queued`,tone:`mute`,icon:Fa,spin:!1},not_merged:{labelKey:`not_merged`,tone:`mute`,icon:Fa,spin:!1},waiting:{labelKey:`waiting`,tone:`mute`,icon:fo,spin:!1},running:{labelKey:`running`,tone:`run`,icon:re,spin:!0},merging:{labelKey:`merging`,tone:`run`,icon:lo,spin:!1},repair:{labelKey:`repair`,tone:`run`,icon:vs,spin:!1},active:{labelKey:`active`,tone:`run`,icon:re,spin:!0},needs_human:{labelKey:`needs_human`,tone:`warn`,icon:Oo,spin:!1},conflict:{labelKey:`conflict`,tone:`warn`,icon:ms,spin:!1},apply_failed:{labelKey:`apply_failed`,tone:`warn`,icon:Ho,spin:!1},undelivered:{labelKey:`undelivered`,tone:`warn`,icon:Bo,spin:!1},rejected:{labelKey:`rejected`,tone:`warn`,icon:ms,spin:!1},failed:{labelKey:`failed`,tone:`err`,icon:Va,spin:!1},merged:{labelKey:`merged`,tone:`ok`,icon:lo,spin:!1},applied:{labelKey:`applied`,tone:`ok`,icon:Ro,spin:!1},done:{labelKey:`done`,tone:`ok`,icon:Na,spin:!1},finished:{labelKey:`finished`,tone:`ok`,icon:Na,spin:!1},cancelled:{labelKey:`cancelled`,tone:`mute`,icon:ya,spin:!1},pending:{labelKey:`pending`,tone:`mute`,icon:Ua,spin:!1},paused:{labelKey:`paused`,tone:`warn`,icon:La,spin:!1},frozen:{labelKey:`frozen`,tone:`warn`,icon:cs,spin:!1},stopped:{labelKey:`stopped`,tone:`mute`,icon:La,spin:!1},warnings:{labelKey:`warnings`,tone:`warn`,icon:ms,spin:!1}};function Gl(e,t){let n=Wl[e];return n?{label:t(`status.${n.labelKey}`),tone:n.tone,icon:n.icon,spin:n.spin}:{label:e,tone:`mute`,icon:Ua,spin:!1}}function Kl(e,t){switch(e.reason){case`specialist`:return t(`wait.specialist`,{specialist:e.name??e.specialist,max:e.max});case`capacity`:return t(`wait.capacity`,{max:e.max});case`limit`:return t(`wait.limit`,{runtime:e.runtime,time:Il(e.until)});case`network`:return e.until===null?t(`wait.network`,{problem:e.problem}):t(`wait.networkUntil`,{time:Il(e.until)})}}function ql(e){return Wl[e]?.tone??`mute`}function Jl(e,t){let{label:n}=Gl(e.state,t);return e.state===`needs_human`&&e.waiting>=2?`${n} ×${e.waiting}`:n}function Yl(e,t){return t(`connection.${e}`)}function Xl(e,t){return t(`queueState.${e}`)}function Zl({compact:e,label:t,unread:n,tone:r}){let{t:i}=_(),a=(0,U.jsxs)(`span`,{className:`relative flex size-4 items-center justify-center`,children:[(0,U.jsx)(xa,{"aria-hidden":!0}),n>0?(0,U.jsx)(I,{variant:r,"aria-hidden":!0,"data-notification-count":!0,className:`absolute -right-2 -top-2 min-w-4 justify-center px-1 py-0 text-[10px] leading-4`,children:n>99?`99+`:n}):null]});return e?(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:(0,U.jsx)($c,{asChild:!0,children:(0,U.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-8 shrink-0`,"aria-label":t,children:a})})}),(0,U.jsx)(Y,{side:`bottom`,children:t})]}):(0,U.jsx)($c,{asChild:!0,children:(0,U.jsxs)(o,{variant:`ghost`,"data-nav-row":!0,className:fl(),"aria-label":t,children:[a,(0,U.jsx)(`span`,{children:i(`nav.notifications`)})]})})}function Ql({item:e,state:t,showRepository:n,onSelect:r}){let{t:i}=_(),a=Gl(e.kind,i);return(0,U.jsxs)(`li`,{className:`flex items-start gap-1 border-b last:border-b-0 hover:bg-accent/50`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 flex-col items-start gap-1 px-3 py-2 text-left text-sm`,onClick:r,children:[(0,U.jsxs)(`span`,{className:`flex max-w-full items-center gap-2`,children:[(0,U.jsx)(I,{variant:a.tone,children:a.label}),e.humanOnly?(0,U.jsx)(I,{variant:`warn`,children:i(`runs.humanOnly.${e.humanOnly}`)}):null,(0,U.jsx)(`span`,{className:k(`truncate`,t.isRead(e)?`font-normal`:`font-semibold`),children:e.groupTitle})]}),(0,U.jsxs)(`span`,{className:`max-w-full truncate text-xs text-muted-foreground`,children:[e.runTitle,n?` · ${A(e.repository)}`:``]}),e.detail?(0,U.jsx)(`span`,{className:`max-w-full truncate text-xs`,children:e.detail}):null]}),(0,U.jsx)(o,{variant:`ghost`,size:`sm`,className:`mt-1 shrink-0`,"aria-label":i(`notifications.hideGroup`,{group:e.groupTitle}),onClick:()=>t.hide(e.key),children:i(`notifications.hide`)})]},e.key)}function $l({state:e,compact:t=!1,showRepository:n}){let{t:r}=_(),[i,a]=(0,L.useState)(!1),{items:s,unread:c,unreadTone:l,permission:u}=e,d=c>0?r(`notifications.unread`,{count:c}):r(`nav.notifications`),f=e.open;return(0,L.useEffect)(()=>{i&&c>0&&f()},[i,c,f]),(0,U.jsxs)(Qc,{open:i,onOpenChange:t=>{a(t),t&&e.open()},children:[(0,U.jsx)(Zl,{compact:t,label:d,unread:c,tone:l}),(0,U.jsxs)(el,{align:`end`,className:`w-96 p-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-3 py-2`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold`,children:r(`notifications.title`)}),s.length>0?(0,U.jsx)(o,{variant:`ghost`,size:`sm`,onClick:e.hideAll,children:r(`notifications.hideAll`)}):null]}),s.length===0?(0,U.jsx)(`p`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:r(`notifications.empty`)}):(0,U.jsx)(`ul`,{className:`max-h-80 overflow-y-auto`,children:s.map(t=>(0,U.jsx)(Ql,{item:t,state:e,showRepository:n,onSelect:()=>{a(!1),e.select(t)}},t.key))}),(0,U.jsxs)(`div`,{className:`flex flex-col items-start gap-2 border-t px-3 py-2 text-xs text-muted-foreground`,children:[(0,U.jsx)(`p`,{role:`status`,children:r(`notifications.${u}`)}),u==="default"?(0,U.jsx)(o,{variant:`outline`,size:`sm`,onClick:e.enable,children:r(`notifications.enable`)}):null]})]})]})}var eu=[{code:`en`,name:`English`,locale:`en`},{code:`es`,name:`Español`,locale:`es`},{code:`ru`,name:`Русский`,locale:`ru`},{code:`zh`,name:`中文`,locale:`zh-CN`}],tu=eu.map(e=>e.code),nu=`aip.web.language`;function ru(e){return typeof e==`string`&&tu.includes(e)}function iu(e){return eu.find(t=>t.code===e)?.locale??`en`}function au(e){for(let t of e){let e=t.toLowerCase().split(`-`)[0];if(ru(e))return e}return`en`}D.use(Tt).init({resources:{en:{translation:Ge},es:{translation:qe},ru:{translation:Ke},zh:{translation:Je}},lng:`en`,fallbackLng:`en`,initAsync:!1,returnNull:!1,interpolation:{escapeValue:!1}});var ou=`system`,su=new Set;function cu(){try{let e=window.localStorage.getItem(nu);if(e===null)return`system`;let t=JSON.parse(e);return ru(t)?t:`system`}catch{return ou}}function lu(){let{languages:e,language:t}=window.navigator;return e&&e.length>0?e:t?[t]:[]}function uu(e){let t=e===`system`?au(lu()):e;return D.language!==t&&D.changeLanguage(t),document.documentElement.lang=iu(t),t}function du(){uu(cu())}function fu(e){ou=e;try{window.localStorage.setItem(nu,JSON.stringify(e))}catch{}uu(e);for(let e of su)e()}function pu(e){return su.add(e),()=>su.delete(e)}function mu(){let e=(0,L.useSyncExternalStore)(pu,cu,cu);return(0,L.useEffect)(()=>{if(uu(e),e!==`system`)return;let t=()=>{uu(`system`);for(let e of su)e()};return window.addEventListener(`languagechange`,t),()=>window.removeEventListener(`languagechange`,t)},[e]),{choice:e,language:e===`system`?au(lu()):e,setChoice:fu}}function hu(){let{i18n:e}=_();return iu(ru(e.language)?e.language:`en`)}function gu({compact:e=!1}){let{t}=_(),{choice:n,setChoice:r}=mu(),i=t(`language.label`,{language:n===`system`?t(`language.system`):eu.find(e=>e.code===n)?.name??n}),a=(0,U.jsx)(Bs,{asChild:!0,children:(0,U.jsxs)(o,{variant:`ghost`,"data-nav-row":!0,className:k(fl(),e&&`w-8 justify-center px-0`),"aria-label":i,children:[(0,U.jsx)(vo,{}),e?null:(0,U.jsx)(`span`,{className:`truncate`,children:i})]})});return(0,U.jsxs)(zs,{children:[e?(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:a}),(0,U.jsx)(Y,{side:`bottom`,children:i})]}):a,(0,U.jsx)(Hs,{align:e?`end`:`start`,side:e?`bottom`:`top`,children:(0,U.jsxs)(Vs,{value:n,onValueChange:e=>r(e),children:[(0,U.jsx)(Us,{value:`system`,children:t(`language.system`)}),eu.map(e=>(0,U.jsx)(Us,{value:e.code,lang:e.locale,children:e.name},e.code))]})})]})}var _u=`aip.web.theme`;function vu(){try{let e=JSON.parse(window.localStorage.getItem(_u)??`null`);return e===`light`||e===`dark`?e:`system`}catch{return`system`}}var yu=()=>window.matchMedia(`(prefers-color-scheme: dark)`);function bu(e){return e===`system`?yu().matches?`dark`:`light`:e}function xu(e){let t=bu(e);return document.documentElement.classList.toggle(`dark`,t===`dark`),t}function Su(){xu(vu())}function Cu(){let[e,t]=N(`theme`,`system`),[n,r]=(0,L.useState)(()=>bu(e));return(0,L.useEffect)(()=>{if(r(xu(e)),e!==`system`)return;let t=yu(),n=()=>r(xu(`system`));return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),{theme:e,resolved:n,setTheme:t}}var wu=[`system`,`light`,`dark`];function Tu({compact:e=!1}){let{t}=_(),{theme:n,resolved:r,setTheme:i}=Cu(),a=t(`theme.label`,{theme:t(`theme.${n}`)}),s=n===`system`?Mo:r===`dark`?Po:fs,c=(0,U.jsx)(Bs,{asChild:!0,children:(0,U.jsxs)(o,{variant:`ghost`,"data-nav-row":!0,className:k(fl(),e&&`w-8 justify-center px-0`),"aria-label":a,children:[(0,U.jsx)(s,{}),e?null:(0,U.jsx)(`span`,{children:a})]})});return(0,U.jsxs)(zs,{children:[e?(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:c}),(0,U.jsx)(Y,{side:`bottom`,children:a})]}):c,(0,U.jsx)(Hs,{align:e?`end`:`start`,side:e?`bottom`:`top`,children:(0,U.jsx)(Vs,{value:n,onValueChange:e=>i(e),children:wu.map(e=>(0,U.jsx)(Us,{value:e,children:t(`theme.${e}`)},e))})})]})}function Eu(e){let{t}=_(),{target:n,active:r,count:i,waiting:a,icon:o}=e;return(0,U.jsxs)(`a`,{href:e.href,"data-nav-row":!0,"aria-current":r?`page`:void 0,className:k(fl(),`relative font-medium text-muted-foreground hover:bg-accent hover:text-accent-foreground`,r&&`bg-accent text-accent-foreground`),onClick:t=>{t.preventDefault(),e.onNavigate(n)},children:[(0,U.jsx)(`span`,{"data-nav-icon":!0,className:`relative flex size-4 items-center justify-center`,children:(0,U.jsx)(o,{"aria-hidden":!0})}),(0,U.jsx)(`span`,{className:`flex-1`,children:e.label}),i>0?(0,U.jsx)(xl,{target:n,count:i,waiting:a}):null,n===`runs`&&a>0?(0,U.jsx)(I,{variant:`warn`,"aria-label":t(`nav.waiting`,{count:a}),children:a}):null]})}function Du({view:e,hrefFor:t,onNavigate:n,working:r,waiting:i,queued:a,onPalette:s,notifications:c,repository:l}){let{t:u}=_(),d=e=>e===`runs`?r:e===`queue`?a:0;return(0,U.jsxs)(`div`,{className:`flex h-full flex-col gap-2 p-2`,children:[(0,U.jsxs)(`a`,{href:`#runs`,"data-nav-row":!0,className:k(fl(),`font-semibold`),onClick:e=>{e.preventDefault(),n(`runs`)},children:[(0,U.jsx)(`span`,{className:`rounded bg-primary px-1.5 py-0.5 text-xs text-primary-foreground`,children:`aip`}),(0,U.jsx)(`span`,{children:`web`})]}),(0,U.jsx)(bl,{choice:l}),(0,U.jsxs)(o,{variant:`outline`,"data-nav-row":!0,className:k(fl(),`text-muted-foreground`),onClick:s,"aria-label":u(`nav.palette`),children:[(0,U.jsx)(Qo,{}),(0,U.jsx)(`span`,{className:`flex-1 text-left`,children:u(`nav.search`)}),(0,U.jsxs)(Rs,{children:[js(),`K`]})]}),(0,U.jsx)(`nav`,{"aria-label":u(`nav.sections`),className:`flex flex-col gap-0.5`,children:xs.map(({view:r,labelKey:a,icon:o})=>(0,U.jsx)(Eu,{target:r,label:u(`nav.${a}`),icon:o,count:d(r),active:r===e,waiting:i,href:t(r),onNavigate:n},r))}),(0,U.jsxs)(`div`,{className:`mt-auto flex flex-col gap-1`,children:[(0,U.jsx)($l,{state:c,showRepository:l.repositories.length>1}),(0,U.jsx)(Tu,{}),(0,U.jsx)(gu,{})]})]})}function Ou(e){let{t}=_(),[n,r]=(0,L.useState)(!1);return(0,U.jsxs)(`header`,{className:`flex h-11 shrink-0 items-center gap-2 border-b bg-card px-2`,children:[(0,U.jsxs)(Cs,{open:n,onOpenChange:r,children:[(0,U.jsx)(ws,{asChild:!0,children:(0,U.jsx)(o,{variant:`ghost`,size:`icon`,"aria-label":t(`nav.menu`),children:(0,U.jsx)(Eo,{})})}),(0,U.jsxs)(Ts,{children:[(0,U.jsx)(Es,{className:`sr-only`,children:t(`nav.sectionsTitle`)}),(0,U.jsx)(Ds,{children:t(`nav.sectionsDescription`)}),(0,U.jsx)(Du,{...e,onNavigate:t=>{r(!1),e.onNavigate(t)},onPalette:()=>{r(!1),e.onPalette()}})]})]}),(0,U.jsx)(`span`,{className:`text-sm font-semibold`,children:Ss(e.view,t)}),(0,U.jsx)(o,{variant:`outline`,size:`icon`,className:`ml-auto`,onClick:e.onNewTask,disabled:!e.onNewTask,"aria-label":t(`nav.newTask`),children:(0,U.jsx)(Ko,{})})]})}function ku({label:e,children:t}){return(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:t}),(0,U.jsx)(Y,{side:`bottom`,children:e})]})}function Au(e){let{t}=_(),{target:n,label:r,count:i,active:a,waiting:o,onNavigate:s,icon:c}=e;return(0,U.jsx)(ku,{label:r,children:(0,U.jsxs)(`a`,{href:e.href,"aria-current":a?`page`:void 0,className:k(`flex h-8 shrink-0 items-center gap-2 rounded-md px-2.5 text-sm font-medium whitespace-nowrap text-muted-foreground hover:bg-accent hover:text-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0`,a&&`bg-accent text-accent-foreground`),onClick:e=>{e.preventDefault(),s(n)},children:[(0,U.jsxs)(`span`,{"data-nav-icon":!0,className:`relative flex size-4 items-center justify-center`,children:[(0,U.jsx)(c,{"aria-hidden":!0}),i>0?(0,U.jsx)(xl,{target:n,count:i,waiting:o,corner:!0,className:`lg:hidden`}):null]}),(0,U.jsx)(`span`,{className:`sr-only lg:not-sr-only`,children:r}),i>0?(0,U.jsx)(xl,{target:n,count:i,waiting:o,className:`hidden lg:inline-flex`}):null,n===`runs`&&o>0?(0,U.jsx)(I,{variant:`warn`,className:`hidden lg:inline-flex`,"aria-label":t(`nav.waiting`,{count:o}),children:o}):null]})},n)}function ju({onNewTask:e,onPalette:t,notifications:n,showRepository:r}){let{t:i}=_();return(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-1`,children:[(0,U.jsx)(ku,{label:i(`nav.newTask`),children:(0,U.jsx)(o,{variant:`outline`,size:`icon`,className:`size-7 shrink-0 text-muted-foreground`,onClick:e,disabled:!e,"aria-label":i(`nav.newTask`),children:(0,U.jsx)(Ko,{})})}),(0,U.jsx)(ku,{label:i(`nav.search`),children:(0,U.jsxs)(o,{variant:`outline`,size:`sm`,className:`shrink-0 text-muted-foreground [&_svg]:size-4`,onClick:t,"aria-label":i(`nav.palette`),children:[(0,U.jsx)(Qo,{}),(0,U.jsx)(`span`,{className:`hidden lg:inline`,children:i(`nav.search`)}),(0,U.jsxs)(Rs,{className:`hidden lg:inline-flex`,children:[js(),`K`]})]})}),(0,U.jsx)($l,{state:n,compact:!0,showRepository:r}),(0,U.jsx)(gu,{compact:!0}),(0,U.jsx)(Tu,{compact:!0})]})}function Mu({view:e,hrefFor:t,onNavigate:n,working:r,waiting:i,queued:a,onPalette:o,onNewTask:s,notifications:c,repository:l}){let{t:u}=_(),d=e=>e===`runs`?r:e===`queue`?a:0;return(0,U.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center justify-between gap-3 border-b bg-card px-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsxs)(`a`,{href:`#runs`,className:`flex shrink-0 items-center gap-1.5 text-sm font-semibold`,onClick:e=>{e.preventDefault(),n(`runs`)},children:[(0,U.jsx)(`span`,{className:`rounded bg-primary px-1.5 py-0.5 text-xs text-primary-foreground`,children:`aip`}),(0,U.jsx)(`span`,{children:`web`})]}),(0,U.jsx)(bl,{choice:l,compact:!0})]}),(0,U.jsx)(`nav`,{"aria-label":u(`nav.sections`),className:`flex shrink-0 items-center gap-1`,children:xs.map(({view:r,labelKey:a,icon:o})=>(0,U.jsx)(Au,{target:r,label:u(`nav.${a}`),icon:o,count:d(r),active:r===e,waiting:i,href:t(r),onNavigate:n},r))}),(0,U.jsx)(ju,{onNewTask:s,onPalette:o,notifications:c,showRepository:l.repositories.length>1})]})}function Nu({nav:e,footer:t,children:n}){let r=P(`(min-width: 768px)`);return(0,U.jsxs)(da,{children:[(0,U.jsxs)(`div`,{className:`relative flex h-dvh flex-col overflow-hidden`,children:[r?(0,U.jsx)(Mu,{...e}):(0,U.jsx)(Ou,{...e}),(0,U.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,U.jsx)(`div`,{className:`relative flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,children:n}),t]})]}),(0,U.jsx)(Et,{})]})}function Pu({daemon:e}){let{t}=_();if(!e)return null;let n=e.pid===null?``:` (pid ${e.pid})`,r=e=>e?`${e.version} ${e.fingerprint}`:t(`daemon.unknownBuild`),i=e.outdated===`client`?t(`daemon.newer`):t(e.daemon?`daemon.olderBusy`:`daemon.olderUnknown`,{pid:n});return(0,U.jsxs)(j,{variant:`warn`,className:`m-3 mb-0 flex w-auto flex-col gap-1`,children:[(0,U.jsxs)(`span`,{children:[i,e.outdated===`daemon`&&e.pid!==null?(0,U.jsxs)(U.Fragment,{children:[` `,(0,U.jsxs)(`code`,{children:[`kill `,e.pid]})]}):null]}),(0,U.jsx)(`span`,{className:`text-xs opacity-80`,children:t(`daemon.builds`,{daemon:r(e.daemon),panel:r(e.client)})})]})}var Fu=3e3;function Iu(e,t=null,n=`reconnecting`){let[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(null),s=(0,L.useRef)(!0),c=(0,L.useRef)(!1),l=(0,L.useCallback)(async()=>{try{let t=await e.processes();if(!s.current)return;i(t.processes),o(null)}catch(e){if(!s.current)return;o(e instanceof Error?e.message:String(e))}},[e]);(0,L.useEffect)(()=>{t&&(t.processes?(i(t.processes),o(null)):t.error&&o(t.error))},[t]);let u=n!==`live`||t===null;return(0,L.useEffect)(()=>{s.current=!0;let e=null,t=()=>{e!==null&&clearInterval(e),e=null},n=()=>{t(),c.current?u&&l():(c.current=!0,l()),u&&(e=setInterval(()=>void l(),Fu))},r=()=>{document.visibilityState===`visible`?n():t()};return document.visibilityState===`visible`&&n(),document.addEventListener(`visibilitychange`,r),()=>{s.current=!1,t(),document.removeEventListener(`visibilitychange`,r)}},[l,u]),{processes:r,error:a,refresh:l}}function Lu(e){let t=new Map;for(let n of e){let e=JSON.stringify([n.owner.runId,n.owner.group]),r=t.get(e);r?r.processes.push(n):t.set(e,{key:e,owner:n.owner,processes:[n]})}return[...t.values()]}var Ru=.8;function zu(e){return Math.floor(e*Ru)}function Bu(e,t,n){return t>=zu(n)&&e>t?e:t}function Vu(e,t){let n=zu(t);return Math.max(Math.min(e,n),Math.min(160,n))}function Hu(){let[e,t]=(0,L.useState)(()=>window.innerHeight);return(0,L.useEffect)(()=>{let e=()=>t(window.innerHeight);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function Uu(){let[e,t]=N(`statusBar.height`,256),n=Hu(),r=Number.isFinite(e)?e:256;return{height:Vu(r,n),chosen:r,viewportHeight:n,setChosen:t}}function Wu(e){return e===`ArrowUp`?16:e===`ArrowDown`?-16:0}function Gu(e,t,n,r){return Bu(e,Vu(t+n,r),r)}function Ku(e){let t=new Map;for(let n of e)if(!n.finished)for(let e of n.specialists??[]){let r=t.get(e.specialist);r||(r={specialist:e.specialist,name:e.name??e.specialist,max:null,running:[],waiting:[]},t.set(e.specialist,r)),e.max!==null&&e.max>0&&(r.max===null||e.max<r.max)&&(r.max=e.max);let i={runId:n.id,runTitle:n.title,repository:n.repository,pipeline:n.pipeline,level:e.level};for(let t of e.running)r.running.push({...i,group:t.slug,title:t.title,step:t.step,stepName:t.stepName??t.step,status:`running`});for(let t of e.waiting)r.waiting.push({...i,group:t.slug,title:t.title,step:t.step,stepName:t.stepName??t.step,status:`queued`})}return t}function qu(e,t){return e<t?-1:+(e>t)}function Ju(e){return(t,n)=>Number(n===e)-Number(t===e)||qu(t,n)}function Yu(e,t){let n=Ju(t),r=[],i=new Map,a=0,o=0;for(let t of[...e.values()].sort((e,t)=>qu(e.specialist,t.specialist))){if(t.running.length===0&&t.waiting.length===0)continue;a+=t.running.length,o+=t.waiting.length;let e=new Map,s=new Map,c=t=>{let n=t.level===`global`?e:s,r=n.get(t.repository);r||(r={repository:t.repository,running:[],waiting:[]},n.set(t.repository,r)),(t.status===`running`?r.running:r.waiting).push(t)};if(t.running.forEach(c),t.waiting.forEach(c),e.size>0){let i=[...e.values()].sort((e,t)=>n(e.repository,t.repository));r.push({specialist:t.specialist,name:t.name,max:t.max,running:t.running.length,waiting:t.waiting.length,repositories:i})}for(let[e,n]of s){let r=i.get(e);r||(r={repository:e,running:0,waiting:0,specialists:[]},i.set(e,r)),r.running+=n.running.length,r.waiting+=n.waiting.length,r.specialists.push({specialist:t.specialist,name:t.name,max:t.max,totalRunning:t.running.length,running:n.running,waiting:n.waiting})}}return{global:r,project:[...i.values()].sort((e,t)=>n(e.repository,t.repository)),running:a,waiting:o}}var Xu=Pt,Zu=It,Qu=Rt;function $u({className:e,...t}){return(0,U.jsx)(wi,{className:k(`flex flex-col gap-3`,e),...t})}function ed({className:e,...t}){return(0,U.jsx)(Ei,{className:k(`inline-flex w-fit items-center gap-1 border-b`,e),...t})}function td({className:e,...t}){return(0,U.jsx)(Oi,{className:k(`-mb-px inline-flex items-center gap-1.5 border-b-2 border-transparent px-3 py-1.5 text-sm font-medium text-muted-foreground hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:text-muted-foreground data-[state=active]:border-primary data-[state=active]:text-foreground`,e),...t})}function nd({className:e,...t}){return(0,U.jsx)(Ai,{className:k(`min-w-0`,e),...t})}var rd=`border-b group-last/row:border-0`,id=`${rd} px-2 py-1.5 text-right align-middle whitespace-nowrap tabular-nums`;function ad({task:e,onOpenGroup:t}){let{t:n}=_(),{owner:r}=e,i=e.processes[e.processes.length-1];return(0,U.jsx)(`tr`,{className:`bg-muted/40`,children:(0,U.jsx)(`th`,{scope:`rowgroup`,colSpan:6,className:`border-b px-2 py-1.5 text-left font-medium`,children:r.group===null?(0,U.jsx)(`span`,{className:`block truncate text-xs`,children:r.runTitle}):(0,U.jsx)(o,{variant:`link`,size:`sm`,className:`h-auto max-w-full justify-start p-0 text-xs font-medium`,onClick:()=>t({runId:r.runId,group:r.group,step:i.owner.step}),children:(0,U.jsx)(`span`,{className:`truncate`,children:n(`statusBar.owner`,{group:r.groupTitle??r.group,run:r.runTitle})})})})})}function od({command:e,onCopy:t}){let{t:n}=_();return(0,U.jsx)(`td`,{className:`${rd} min-w-0 px-2 py-1.5 align-middle`,children:(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:(0,U.jsx)(`code`,{tabIndex:0,className:`${fe} block min-w-0 truncate`,children:e})}),(0,U.jsx)(Y,{className:`max-w-[min(40rem,90vw)] font-mono break-all`,children:e})]}),(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:(0,U.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,"aria-label":n(`statusBar.copyCommand`),onClick:()=>t(e),children:(0,U.jsx)(Ga,{className:`size-3.5`})})}),(0,U.jsx)(Y,{children:n(`statusBar.copyCommand`)})]})]})})}function sd({process:e,killing:t,onKill:n,onCopy:r}){let{t:i,i18n:a}=_(),s=e.command===``?e.name:e.command;return(0,U.jsxs)(`tr`,{className:`group/row hover:bg-muted/50`,children:[(0,U.jsx)(`td`,{className:id,children:e.pid}),(0,U.jsx)(od,{command:s,onCopy:r}),(0,U.jsx)(`td`,{className:id,children:Rl(e.uptimeSeconds,i)}),(0,U.jsx)(`td`,{className:id,children:zl(e.cpuPercent,a.language)}),(0,U.jsx)(`td`,{className:id,children:Bl(e.memoryBytes,i,a.language)}),(0,U.jsx)(`td`,{className:`${rd} px-2 py-1.5 text-right align-middle`,children:(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:(0,U.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 text-destructive hover:text-destructive`,disabled:t,"aria-label":i(`statusBar.killLabel`,{name:e.name,pid:e.pid}),onClick:n,children:(0,U.jsx)(za,{className:`size-4`})})}),(0,U.jsx)(Y,{children:i(`statusBar.kill`)})]})})]})}function cd(e,t){let{t:n}=_(),r=Ne(),[i,a]=(0,L.useState)(new Set);return{killing:i,kill:async i=>{if(await r({title:n(`statusBar.killTitle`,{name:i.name,pid:i.pid}),description:n(`statusBar.killDescription`),confirmLabel:n(`statusBar.kill`),destructive:!0})){a(e=>new Set(e).add(i.pid));try{await e.killProcess(i.pid),await t.refresh()}catch(e){Te(e)}finally{a(e=>{let t=new Set(e);return t.delete(i.pid),t})}}},copy:async e=>{try{if(!navigator.clipboard)throw Error(n(`statusBar.copyFailed`));await navigator.clipboard.writeText(e),F(n(`statusBar.copied`))}catch{Te(n(`statusBar.copyFailed`))}}}}function ld({api:e,polled:t,onOpenGroup:n}){let{t:r}=_(),i=t.processes??[],{killing:a,kill:o,copy:s}=cd(e,t);if(t.error!==null&&t.processes===null)return(0,U.jsx)(`p`,{className:`text-destructive`,children:t.error});if(i.length===0)return(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:r(`statusBar.noProcesses`)});let c=Lu(i),l=`sticky top-0 z-10 border-b bg-card px-2 py-1.5 font-medium text-muted-foreground`;return(0,U.jsxs)(`table`,{className:`w-full table-fixed border-separate border-spacing-0 text-left`,children:[(0,U.jsxs)(`colgroup`,{children:[(0,U.jsx)(`col`,{className:`w-16`}),(0,U.jsx)(`col`,{}),(0,U.jsx)(`col`,{className:`w-24`}),(0,U.jsx)(`col`,{className:`w-20`}),(0,U.jsx)(`col`,{className:`w-24`}),(0,U.jsx)(`col`,{className:`w-20`})]}),(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{className:`${l} text-right`,children:r(`statusBar.pid`)}),(0,U.jsx)(`th`,{className:l,children:r(`statusBar.command`)}),(0,U.jsx)(`th`,{className:`${l} text-right`,children:r(`statusBar.uptime`)}),(0,U.jsx)(`th`,{className:`${l} text-right`,children:r(`statusBar.cpu`)}),(0,U.jsx)(`th`,{className:`${l} text-right`,children:r(`statusBar.memory`)}),(0,U.jsx)(`th`,{className:l,children:(0,U.jsx)(`span`,{className:`sr-only`,children:r(`statusBar.kill`)})})]})}),c.map(e=>(0,U.jsxs)(`tbody`,{children:[(0,U.jsx)(ad,{task:e,onOpenGroup:n}),e.processes.map(e=>(0,U.jsx)(sd,{process:e,killing:a.has(e.pid),onKill:()=>void o(e),onCopy:e=>void s(e)},e.pid))]},e.key))]})}var ud={live:`bg-status-ok`,reconnecting:`bg-status-warn motion-safe:animate-pulse`,polling:`bg-status-run`};function dd({connection:e,compact:t=!1}){let{t:n}=_(),r=Yl(e,n);return(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:(0,U.jsxs)(`div`,{role:`status`,tabIndex:0,"aria-label":n(`connection.label`,{state:r}),"data-nav-row":!0,className:k(fl(),`text-xs text-muted-foreground`,t&&`w-8 justify-center px-0`),children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4 items-center justify-center`,children:(0,U.jsx)(`span`,{className:k(`size-2 shrink-0 rounded-full`,ud[e])})}),t?null:(0,U.jsx)(`span`,{children:r})]})}),(0,U.jsx)(Y,{side:t?`bottom`:`top`,children:t?`${r} (${e})`:e})]})}function fd({open:e,summary:t,connection:n}){let{t:r}=_();return(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Zu,{asChild:!0,children:(0,U.jsxs)(o,{variant:`ghost`,size:`sm`,className:`flex h-8 min-w-0 flex-1 justify-start gap-2 rounded-none px-4`,"aria-label":r(`statusBar.title`),children:[e?(0,U.jsx)(Da,{className:`size-4`}):(0,U.jsx)(ja,{className:`size-4`}),(0,U.jsx)(`span`,{className:`truncate text-muted-foreground`,children:t})]})}),(0,U.jsx)(`div`,{className:`shrink-0 pr-2`,children:(0,U.jsx)(dd,{connection:n})})]})}function $({status:e,label:t,title:n,wait:r,tip:i,onClick:a}){let{t:o}=_(),s=Gl(e,o),c=s.icon,l=t??s.label;return(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:(0,U.jsxs)(I,{variant:s.tone,"aria-label":`${l} (${e})`,tabIndex:0,...a?{role:`button`,className:`cursor-pointer`,onClick:a,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a())}}:{},children:[(0,U.jsx)(c,{"aria-hidden":!0,className:k(s.spin&&`motion-safe:animate-spin`)}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,title:n,children:l})]})}),(0,U.jsx)(Y,{children:r?`${Kl(r,o)} (${e})`:i?`${e} · ${i}`:e})]})}function pd({entries:e,onOpen:t}){return(0,U.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:e.map(e=>(0,U.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2`,children:[(0,U.jsx)(o,{variant:`link`,size:`sm`,className:`h-auto min-w-0 p-0 text-left whitespace-normal`,onClick:()=>t(e),children:e.title}),(0,U.jsx)($,{status:e.status}),(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.stepName,` · `,e.runTitle]})]},`${e.runId}/${e.group}/${e.status}`))})}function md({running:e,waiting:t}){let{t:n}=_();return(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:[...e>0?[n(`specialistLoad.running`,{n:e})]:[],...t>0?[n(`specialistLoad.waiting`,{n:t})]:[]].join(` · `)})}function hd({use:e,onOpen:t}){return(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5 pl-3`,children:[(0,U.jsxs)(`div`,{className:`flex gap-2`,title:e.repository,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:A(e.repository)}),(0,U.jsx)(md,{running:e.running.length,waiting:e.waiting.length})]}),(0,U.jsx)(`div`,{className:`pl-3`,children:(0,U.jsx)(pd,{entries:[...e.running,...e.waiting],onOpen:t})})]})}function gd({runs:e,selected:t,onOpenGroup:n}){let{t:r}=_(),i=(0,L.useMemo)(()=>Yu(Ku(e),t),[e,t]),a=i.running===0&&i.waiting===0,o=e=>e===null?``:` ${r(`specialistLoad.limit`,{max:e})}`;return(0,U.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[a?(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:r(`specialistLoad.none`)}):null,i.global.length>0?(0,U.jsxs)(`section`,{"aria-label":r(`specialistLoad.global`),className:`flex flex-col gap-2`,children:[(0,U.jsx)(`h3`,{className:`font-semibold`,children:r(`specialistLoad.global`)}),i.global.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(`span`,{className:`font-medium`,title:e.specialist,children:e.name}),(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.max===null?r(`topology.busyUnlimited`,{n:e.running}):r(`topology.busy`,{n:e.running,max:e.max}),e.waiting>0?` · ${r(`specialistLoad.waiting`,{n:e.waiting})}`:``]})]}),e.repositories.map(e=>(0,U.jsx)(hd,{use:e,onOpen:n},e.repository))]},e.specialist))]}):null,i.project.length>0?(0,U.jsxs)(`section`,{"aria-label":r(`specialistLoad.project`),className:`flex flex-col gap-2`,children:[(0,U.jsx)(`h3`,{className:`font-semibold`,children:r(`specialistLoad.project`)}),i.project.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex gap-2`,title:e.repository,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:A(e.repository)}),(0,U.jsx)(md,{running:e.running,waiting:e.waiting})]}),e.specialists.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5 pl-3`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsxs)(`span`,{className:`font-medium`,title:e.specialist,children:[e.name,o(e.max)]}),(0,U.jsx)(md,{running:e.running.length,waiting:e.waiting.length}),e.totalRunning>e.running.length?(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:r(`specialistLoad.machine`,{n:e.totalRunning})}):null]}),(0,U.jsx)(`div`,{className:`pl-3`,children:(0,U.jsx)(pd,{entries:[...e.running,...e.waiting],onOpen:n})})]},e.specialist))]},e.repository))]}):null]})}function _d(e){document.body.classList.remove(`select-none`),e(null)}function vd({height:e,chosen:t,viewportHeight:n,onPreview:r,onCommit:i}){let{t:a}=_(),o=(0,L.useRef)(null),[s,c]=(0,L.useState)(!1),l=zu(n),u=(0,L.useRef)(r);u.current=r,(0,L.useEffect)(()=>()=>{o.current!==null&&(o.current=null,_d(u.current))},[]);let d=()=>{let e=o.current;e!==null&&(o.current=null,c(!1),_d(r),i(Bu(t,e.last,n)))};return(0,U.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":a(`statusBar.resize`),"aria-valuenow":e,"aria-valuemin":Math.min(160,l),"aria-valuemax":l,tabIndex:0,"data-dragging":s||void 0,className:`absolute inset-x-0 -top-1 z-20 h-2 cursor-row-resize touch-none transition-colors hover:bg-primary/30 focus-visible:bg-primary/40 focus-visible:outline-none data-[dragging]:bg-primary/40`,onPointerDown:t=>{o.current={startY:t.clientY,startHeight:e,last:e},c(!0),document.body.classList.add(`select-none`),t.currentTarget.setPointerCapture?.(t.pointerId)},onPointerMove:e=>{let t=o.current;t!==null&&(t.last=Vu(t.startHeight+(t.startY-e.clientY),n),r(t.last))},onPointerUp:d,onPointerCancel:d,onKeyDown:r=>{let a=Wu(r.key);a!==0&&(r.preventDefault(),i(Gu(t,e,a,n)))}})}function yd({runs:e,selected:t,connection:n,streamedProcesses:r=null,api:i,onOpenGroup:a}){let{t:o}=_(),[s,c]=N(`specialistLoad.open`,!1),[l,u]=N(`statusBar.tab`,`specialists`),d=Uu(),[f,p]=(0,L.useState)(null),m=Iu(i,r,n),h=(0,L.useMemo)(()=>Yu(Ku(e),t),[e,t]),g=m.processes===null?`—`:String(m.processes.length);return(0,U.jsxs)(Xu,{open:s,onOpenChange:c,className:`sticky bottom-0 shrink-0 border-t bg-card text-xs`,"data-testid":`status-bar`,children:[s?(0,U.jsx)(vd,{height:f??d.height,chosen:d.chosen,viewportHeight:d.viewportHeight,onPreview:p,onCommit:d.setChosen}):null,(0,U.jsx)(fd,{open:s,summary:o(`statusBar.summary`,{running:h.running,waiting:h.waiting,processes:g}),connection:n}),(0,U.jsx)(Qu,{className:`flex flex-col px-4 pb-3`,style:{height:f??d.height},"data-testid":`status-bar-content`,children:(0,U.jsxs)($u,{value:l,onValueChange:e=>u(e),className:`flex min-h-0 flex-1 flex-col gap-0`,children:[(0,U.jsxs)(ed,{className:`shrink-0`,children:[(0,U.jsx)(td,{value:`specialists`,children:o(`statusBar.tabSpecialists`)}),(0,U.jsx)(td,{value:`processes`,children:o(`statusBar.tabProcesses`)})]}),(0,U.jsx)(nd,{value:`specialists`,className:`min-h-0 flex-1 overflow-y-auto pt-3`,children:(0,U.jsx)(gd,{runs:e,selected:t,onOpenGroup:a})}),(0,U.jsx)(nd,{value:`processes`,className:`min-h-0 flex-1 overflow-y-auto`,children:(0,U.jsx)(ld,{api:i,polled:m,onOpenGroup:a})})]})})]})}var bd=e=>new EventSource(e),xd=new Set([`snapshot`,`daemon`,`repositories`,`tags`,`run`,`queue`,`processes`,`network`]);function Sd(e){return xd.has(e.event)}function Cd(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t==`object`&&t?t:null}var wd=3e3,Td=4e3;function Ed(e,t,n){let r=null,i=null;return{start:()=>{r||i||(i=setTimeout(()=>{i=null,n()||(t(),e(),r=setInterval(()=>void e(),wd))},Td))},stop:()=>{r&&clearInterval(r),i&&clearTimeout(i),r=null,i=null}}}function Dd(e,t,n){e.onopen=()=>{t.stop(),n.live()},e.onmessage=e=>{let r=Cd(e.data);r!==null&&(t.stop(),n.live(),n.event(r))},e.onerror=()=>{n.broken(),t.start()}}function Od(e,t=()=>{}){return{tags:e,byId:new Map(e.map(e=>[e.id,e])),of:t=>t===null?[]:e.filter(e=>e.repository===t),update:t}}var kd=Od([]),Ad=(0,L.createContext)(kd);function jd({tags:e,onTags:t,children:n}){let r=(0,L.useMemo)(()=>Od(e,t),[e,t]);return(0,U.jsx)(Ad,{value:r,children:n})}function Md(){return(0,L.useContext)(Ad)}function Nd(e){return e.effective?.name?.trim()||(typeof e.raw.name==`string`?e.raw.name.trim():``)||e.slug}function Pd(e){return new Map(e.map(e=>[e.slug,Nd(e)]))}function Fd(e,t){return e.get(t)||t}function Id(e,t){let n=Fd(e,t);return n===t?t:`${n} (${t})`}var Ld=[`needs_human`,`conflict`,`failed`];function Rd(e){return Ld.includes(e.status)}function zd(e){return[...e].sort((e,t)=>Number(Rd(t))-Number(Rd(e)))}function Bd(e){return[...zd(e.groups),...zd(e.system??[])]}function Vd(e){let t=e.system??[];return e.groups.find(Rd)??t.find(Rd)??e.groups[0]??t.find(e=>e.kind===`split`)??t[0]??null}function Hd({id:e,name:t,focusable:n=!0}){let{t:r}=_(),i=t===e?r(`pipelineBadge.labelSame`,{id:e}):r(`pipelineBadge.label`,{name:t,id:e});return(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:(0,U.jsxs)(I,{variant:`outline`,className:`max-w-40 rounded-md`,"aria-label":i,tabIndex:n?0:void 0,children:[(0,U.jsx)(so,{"aria-hidden":!0}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]})}),(0,U.jsx)(Y,{children:i})]})}function Ud(e){return typeof e.name==`string`&&e.name.trim()!==``?e.name.trim():null}function Wd({go:e,to:t}){let{t:n}=_();return(0,U.jsx)(Z,{heading:n(`palette.sections`),children:xs.map(({view:r,labelKey:i,icon:a})=>{let o=n(`nav.${i}`);return(0,U.jsxs)(Q,{value:`${n(`palette.section`)} ${o}`,onSelect:()=>e(t(r)),children:[(0,U.jsx)(a,{}),o]},r)})})}function Gd({go:e,runs:t}){let{t:n}=_();return(0,U.jsx)(Z,{heading:n(`palette.runs`),children:t.map(t=>(0,U.jsxs)(Q,{value:`${n(`palette.run`)} ${Sl(t.number)} ${kl(t)} ${t.id} ${t.pipelineName} ${t.pipeline}`,onSelect:()=>e({view:`runs`,run:t.id,group:null,step:null,tab:null}),children:[(0,U.jsxs)(`span`,{className:`truncate`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:Sl(t.number)}),` `,kl(t)]}),(0,U.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[(0,U.jsx)(Hd,{id:t.pipeline,name:t.pipelineName,focusable:!1}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Jl(t,n)})]})]},t.id))})}function Kd({go:e,run:t}){let{t:n}=_();return(0,U.jsx)(Z,{heading:n(`palette.groups`),children:zd(t.groups).map(r=>(0,U.jsx)(Q,{value:`${n(`palette.group`)} ${r.title} ${r.slug}`,onSelect:()=>e({view:`runs`,run:t.id,group:r.slug,step:null,tab:null}),children:r.title},r.slug))})}function qd({go:e,to:t,entries:n}){let{t:r}=_();return(0,U.jsxs)(U.Fragment,{children:[n.pipelines.length>0?(0,U.jsx)(Z,{heading:r(`palette.pipelines`),children:n.pipelines.map(n=>{let i=Ud(n.raw)??n.id;return(0,U.jsx)(Q,{value:`${r(`palette.pipelines`)} ${i} ${n.id}`,title:n.id,onSelect:()=>e(t(`pipelines`,n.id)),children:i},n.id)})}):null,n.specialists.length>0?(0,U.jsx)(Z,{heading:r(`palette.specialists`),children:n.specialists.map(n=>{let i=Nd(n);return(0,U.jsx)(Q,{value:`${r(`palette.specialist`)} ${i} ${n.slug}`,onSelect:()=>e(t(`specialists`,n.slug)),children:i},n.slug)})}):null]})}function Jd({onNewTask:e,onShortcuts:t}){let{t:n}=_();return(0,U.jsxs)(Z,{heading:n(`palette.actions`),children:[(0,U.jsx)(Q,{value:`${n(`palette.action`)} ${n(`palette.newTask`)}`,onSelect:e,children:n(`palette.newTask`)}),(0,U.jsx)(Q,{value:`${n(`palette.action`)} ${n(`palette.shortcuts`)}`,onSelect:t,children:n(`palette.shortcuts`)})]})}function Yd({onChosen:e}){let{t}=_(),{setChoice:n}=mu(),r=[`system`,...eu.map(e=>e.code)];return(0,U.jsx)(Z,{heading:t(`palette.language`),children:r.map(r=>{let i=r===`system`?t(`language.system`):eu.find(e=>e.code===r)?.name??r;return(0,U.jsx)(Q,{value:`${t(`palette.language`)} ${i} ${r}`,onSelect:()=>{e(),n(r)},children:i},r)})})}function Xd({open:e,onOpenChange:t,api:n,runs:r,route:i,onRoute:a,onShortcuts:o}){let{t:s}=_(),[c,l]=(0,L.useState)(null);(0,L.useEffect)(()=>{e&&!c&&n.config().then(e=>l({pipelines:e.pipelines,specialists:e.specialists}),()=>l({pipelines:[],specialists:[]}))},[e,c,n]);let u=e=>{t(!1),a(e)},d=(e,t=null)=>({view:e,run:t,group:null,step:null,tab:null}),f=r.find(e=>e.id===i.run)??null,p=[...r].sort((e,t)=>Number(t.state===`needs_human`)-Number(e.state===`needs_human`));return(0,U.jsxs)(Jc,{open:e,onOpenChange:t,title:s(`palette.title`),children:[(0,U.jsx)(Yc,{placeholder:s(`palette.placeholder`)}),(0,U.jsxs)(Xc,{children:[(0,U.jsx)(Zc,{children:s(`palette.empty`)}),(0,U.jsx)(Wd,{go:u,to:d}),(0,U.jsx)(Gd,{go:u,runs:p}),f&&f.groups.length>1?(0,U.jsx)(Kd,{go:u,run:f}):null,c?(0,U.jsx)(qd,{go:u,to:d,entries:c}):null,(0,U.jsx)(Jd,{onNewTask:()=>{u(d(`queue`)),Is(`queue-task`)},onShortcuts:()=>{t(!1),o()}}),(0,U.jsx)(Yd,{onChosen:()=>t(!1)})]})]})}function Zd({open:e,onOpenChange:t}){let{t:n}=_(),r=[[`${js()}+K`,n(`shortcuts.palette`)],[`j`,n(`shortcuts.nextRun`)],[`k`,n(`shortcuts.previousRun`)],[`?`,n(`shortcuts.help`)],[`Esc`,n(`shortcuts.close`)]];return(0,U.jsx)(Vc,{open:e,onOpenChange:t,children:(0,U.jsxs)(Hc,{children:[(0,U.jsxs)(Uc,{children:[(0,U.jsx)(Gc,{children:n(`shortcuts.title`)}),(0,U.jsx)(Kc,{children:n(`shortcuts.description`)})]}),(0,U.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] items-center gap-x-4 gap-y-2 text-sm`,children:r.map(([e,t])=>(0,U.jsxs)(`div`,{className:`contents`,children:[(0,U.jsx)(`dt`,{children:(0,U.jsx)(Rs,{children:e})}),(0,U.jsx)(`dd`,{children:t})]},e))})]})})}var Qd=`modulepreload`,$d=function(e){return`/`+e},ef={},tf=function(e){return e.pathname.endsWith(`.css`)},nf=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},rf=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=$d(t,n);let r=s(t),i=tf(r);return nf(ef,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Qd,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},af=(0,L.lazy)(()=>rf(()=>import(`./queue-HMUImu0E.js`).then(e=>({default:e.NewTaskDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),of=(0,L.lazy)(()=>rf(()=>import(`./queue-HMUImu0E.js`).then(e=>({default:e.QueuePage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),sf=(0,L.lazy)(()=>rf(()=>import(`./specialists-BkLXuqUd.js`).then(e=>e.t).then(e=>({default:e.SpecialistsPage})),__vite__mapDeps([10,1,2,3,9,5,4,6,11,12]))),cf=(0,L.lazy)(()=>rf(()=>import(`./pipelines-B3cdeex_.js`).then(e=>e.t).then(e=>({default:e.PipelinesPage})),__vite__mapDeps([13,1,3,2,6,4,14,5,10,9,11,12,8,15]))),lf=(0,L.lazy)(()=>rf(()=>import(`./stats-DRg_5vll.js`).then(e=>({default:e.StatsPage})),__vite__mapDeps([16,1,2,3,4,9,12]))),uf=(0,L.lazy)(()=>rf(()=>import(`./settings-CpeEsUXX.js`).then(e=>({default:e.SettingsPage})),__vite__mapDeps([17,1,10,2,3,9,5,4,6,11,12,14,7])));function df({what:e}){let{t}=_();return(0,U.jsxs)(`div`,{role:`status`,"aria-label":t(`app.loading`,{what:e}),className:`flex flex-col gap-2 p-4`,children:[(0,U.jsx)(M,{className:`h-8 w-64`}),(0,U.jsx)(M,{className:`h-40`})]})}var ff=(e,t,n=null)=>({view:e,run:t,group:n,step:null,tab:null});function pf(e){let{t}=_(),{common:n}=e;return(0,U.jsx)(L.Suspense,{fallback:(0,U.jsx)(df,{what:t(`app.loadingQueue`)}),children:(0,U.jsx)(of,{api:n.api,queue:e.queue,now:e.now,drafts:e.drafts,onDraft:e.onDraft,onQueue:e.onQueue,onError:e.onError,onNewTask:e.onNewTask,runs:n.runs},n.pageKey)})}function mf({common:e,registry:t}){let{t:n}=_(),{route:r,onRoute:i}=e;return(0,U.jsx)(L.Suspense,{fallback:(0,U.jsx)(df,{what:n(`app.loadingStats`)}),children:(0,U.jsx)(lf,{api:e.api,registry:t,runs:e.runs,period:te(r.group),project:r.run,onFilter:(e,t)=>i({view:`stats`,run:t,group:e,step:null,tab:null})})})}function hf(e){let{t}=_(),{common:n,...r}=e,i=v(n.route.group,n.route.run),a=e=>t=>n.onRoute({...ff(`settings`,e,`global`),step:t});return(0,U.jsx)(L.Suspense,{fallback:(0,U.jsx)(df,{what:t(`app.loadingSettings`)}),children:(0,U.jsx)(uf,{api:n.api,scope:i.scope,group:i.group,specialist:n.route.step,onSelectSpecialist:a(`specialists`),pipeline:n.route.step,onSelectPipeline:a(`pipelines`),chain:n.route.step,onSelectChain:a(`chains`),project:n.route.step,onSelectProject:a(`projects`),agentTab:n.route.step,observerTab:n.route.step,onSelectObserverTab:a(`observers`),dirty:n.dirty,...r},n.pageKey)})}function gf({common:e}){let{t}=_(),{route:n,onRoute:r}=e;return n.view===`pipelines`?(0,U.jsx)(L.Suspense,{fallback:(0,U.jsx)(df,{what:`pipeline`}),children:(0,U.jsx)(cf,{dirty:e.dirty,api:e.api,runs:e.runs,selected:n.run,section:n.group,onSelect:(e,t=null)=>r(ff(`pipelines`,e,t)),onOpenGroup:(e,t)=>r({...ff(`runs`,e.runId,e.slug),step:t})},e.pageKey)}):(0,U.jsx)(L.Suspense,{fallback:(0,U.jsx)(df,{what:t(`app.loadingSpecialists`)}),children:(0,U.jsx)(sf,{dirty:e.dirty,api:e.api,selected:n.run,section:n.group,onSelect:(t,n=null)=>e.onRoute({...ff(`specialists`,t),group:n})},e.pageKey)})}function _f(e){let{pageKey:t,...n}=e;return(0,U.jsx)(L.Suspense,{fallback:null,children:(0,U.jsx)(af,{...n},t)})}function vf({panel:e}){let{state:t,chrome:n,route:r,scopedApi:i}=e,{newTask:a}=n,{queue:o,selected:s,runs:c}=t,l={...n,api:e.api,waiting:e.waitingRepositories,onRoute:e.setRoute,queueDrafts:n.drafts.queueDrafts,onQueueDraft:n.drafts.onQueueDraft,palette:n.palette,onPalette:n.setPalette,shortcuts:n.shortcuts,onShortcuts:n.setShortcuts};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Xd,{open:l.palette,onOpenChange:l.onPalette,api:i,runs:c,route:r,onRoute:l.onRoute,onShortcuts:()=>l.onShortcuts(!0)}),o!==null&&s!==null&&a.opened?(0,U.jsx)(_f,{api:l.api,pageKey:s,selected:s,repositories:t.repositories,waiting:l.waiting,queues:t.queues,runs:c,preset:a.preset,onPresetApplied:()=>a.setPreset(null),open:a.open,onOpenChange:a.setOpen,draft:l.queueDrafts.new,onDraft:e=>l.onQueueDraft(`new`,e),onQueue:t.setQueue}):null,(0,U.jsx)(Zd,{open:l.shortcuts,onOpenChange:l.onShortcuts})]})}var yf=[`needs_human`,`active`,`repair`,`queued`,`paused`,`frozen`,`finished`,`failed`,`cancelled`],bf={states:[],pipelines:[],specialists:[],tagIds:[],repositories:[]},xf=[`states`,`pipelines`,`specialists`,`tagIds`,`repositories`];function Sf(e){let t=(e.steps??[]).filter(e=>!e.skipped).map(e=>e.specialist),n=e.topology?.split?.specialist;return[...new Set(n?[...t,n]:t)]}function Cf(e,t,n=new Map){if(t.length===0)return!0;let r=t.flatMap(e=>n.get(e)?.name.toLowerCase()??[]);return(e.tags??[]).some(e=>t.includes(e.id)||r.includes(e.name.toLowerCase()))}function wf(e,t){let n=(e.tags??[]).flatMap(e=>t.get(e.id)?.name??[]);return[kl(e),e.name,e.pipeline,e.pipelineName,e.id,Sl(e.number),...e.groups.map(e=>e.title),...n,...Sf(e)].filter(e=>!!e).join(`
|
|
5
|
+
`).toLowerCase()}function Tf(e,t){return t===null?e:e.filter(e=>e.repository===t)}function Ef(e,t,n){let r=t.trim().toLowerCase();if(r===``)return!0;let i=/^#(\d+)$/.exec(r);return i?e.number===Number(i[1]):wf(e,n).includes(r)}function Df(e,t,n,r,i){switch(t){case`states`:return n.states.length===0||n.states.includes(e.state);case`pipelines`:return n.pipelines.length===0||n.pipelines.includes(e.pipeline);case`specialists`:return n.specialists.length===0||Sf(e).some(e=>n.specialists.includes(e));case`tagIds`:return Cf(e,n.tagIds,i);case`repositories`:return r!==`all`||n.repositories.length===0||n.repositories.includes(e.repository)}}function Of(e,t,n,r,i=null,a=new Map){return Tf(e,r===`repository`?i:null).filter(e=>Ef(e,t,a)&&xf.every(t=>Df(e,t,n,r,a)))}function kf(e,t,n,r,i,a,o){return Tf(e,r===`repository`?i:null).filter(e=>Ef(e,t,a)&&xf.every(t=>t===o||Df(e,t,n,r,a)))}function Af(e,t,n,r,i,a,o){let s=new Map,c=e=>s.set(e,(s.get(e)??0)+1);for(let s of kf(e,t,n,r,i,a,o))switch(o){case`states`:c(s.state);break;case`pipelines`:c(s.pipeline);break;case`specialists`:Sf(s).forEach(c);break;case`repositories`:c(s.repository);break;case`tagIds`:for(let e of a.keys())(s.tags??[]).length>0&&Cf(s,[e],a)&&c(e)}return s}function jf(e){let t=e.filter(e=>e.state===`needs_human`).length;return{working:e.filter(e=>e.state===`active`||lt(e)).length+t,waiting:t}}function Mf(e,t,n){return(e.trim()===``?0:1)+xf.reduce((e,r)=>e+(r===`repositories`&&n!==`all`?0:t[r].length),0)}function Nf({onBack:e,children:t}){let{t:n}=_();return(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,U.jsxs)(o,{variant:`ghost`,size:`sm`,className:`m-2 w-fit`,onClick:e,children:[(0,U.jsx)(ha,{}),n(`runs.page.back`)]}),t]})}function Pf({label:e,countLabel:t,wide:n,children:r}){let i=(0,U.jsxs)(o,{variant:`outline`,size:`sm`,className:`w-full justify-start`,children:[(0,U.jsx)(bo,{}),t??e]});return n?(0,U.jsxs)(Qc,{children:[(0,U.jsx)($c,{asChild:!0,children:i}),(0,U.jsx)(el,{className:`w-80 p-3`,children:r})]}):(0,U.jsxs)(Cs,{children:[(0,U.jsx)(ws,{asChild:!0,children:i}),(0,U.jsxs)(Ts,{children:[(0,U.jsx)(Es,{children:e}),(0,U.jsx)(Ds,{className:`sr-only`,children:e}),(0,U.jsx)(`div`,{className:`p-3`,children:r})]})]})}var Ff=[`builtin`,`project`,`global`],If=`__create`;function Lf({text:e,icon:t,hint:n,note:r,disabled:i,onRemove:a}){let{t:o}=_();return(0,U.jsxs)(I,{variant:`outline`,className:`min-w-0 max-w-full gap-1.5 pr-1`,children:[t,(0,U.jsx)(`span`,{className:`min-w-0 truncate`,title:n??e,children:e}),r?(0,U.jsx)(`span`,{className:`font-normal text-status-warn`,children:r}):null,(0,U.jsx)(`button`,{type:`button`,"aria-label":o(`picker.remove`,{value:e}),disabled:i,className:`shrink-0 rounded-full p-0.5 hover:bg-accent disabled:opacity-50`,onClick:a,children:(0,U.jsx)(bs,{})})]})}function Rf({source:e,heading:t,options:n,values:r,mark:i,display:a,look:o,onAdd:s}){let{t:c}=_();return n.length===0?null:(0,U.jsx)(Z,{heading:(t??c(`picker.groups.${e}`))||void 0,children:n.map(t=>{let n=i?.(t.name)??null,c=a?.(t.name)??t.name;return(0,U.jsxs)(Q,{value:`${e}:${t.name}`,className:`items-start`,onSelect:()=>s(t.name),children:[(0,U.jsx)(Ta,{className:`mt-0.5 shrink-0 ${r.includes(t.name)?`opacity-100`:`opacity-0`}`}),o.icon?(0,U.jsx)(`span`,{className:`flex h-5 shrink-0 items-center`,children:o.icon(t.name)}):null,(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,U.jsxs)(`span`,{className:`line-clamp-3 whitespace-normal break-words`,title:o.hint?.(t.name)??c,children:[c,n?(0,U.jsx)(`span`,{className:`ml-2 text-xs text-status-warn`,children:n}):null]}),t.description&&!a?(0,U.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:t.description}):null]})]},`${e}:${t.name}`)})})}function zf(e,t){let n=t.toLowerCase();return e.filter(e=>n===``||e.name.toLowerCase().includes(n)||(e.description??``).toLowerCase().includes(n))}function Bf({inherited:e,values:t,display:n,look:r,mark:i,disabled:a,onRemove:o}){let{t:s}=_();return(0,U.jsxs)(U.Fragment,{children:[e.map(e=>(0,U.jsxs)(I,{variant:`mute`,"data-inherited":!0,children:[e,(0,U.jsx)(`span`,{className:`font-normal`,children:s(`picker.fromDefaults`)})]},`inherited:${e}`)),t.map(e=>(0,U.jsx)(Lf,{text:n?.(e)??e,icon:r?.icon?.(e),hint:r?.hint?.(e),note:i?.(e)??null,disabled:a,onRemove:()=>o(e)},e))]})}function Vf({id:e,label:t,open:n,listId:r,disabled:i}){let{t:a}=_();return(0,U.jsx)($c,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,id:e,role:`combobox`,"aria-label":t,"aria-expanded":n,"aria-haspopup":`listbox`,"aria-controls":n?r:void 0,disabled:i,className:`inline-flex h-6 items-center gap-1 rounded-full px-2 text-xs text-muted-foreground hover:bg-accent disabled:opacity-50`,children:[(0,U.jsx)(Ko,{className:`size-3`}),a(`picker.add`)]})})}function Hf({listId:e,options:t,visible:n,typed:r,canCreate:i,values:a,headings:o,mark:s,display:c,look:l,onAdd:u}){let{t:d}=_();return(0,U.jsxs)(Xc,{id:e,children:[n.length===0&&!i?(0,U.jsx)(Zc,{children:t.length===0?d(`picker.typeValue`):d(`picker.nothing`)}):null,Ff.map(e=>(0,U.jsx)(Rf,{source:e,heading:o?.[e],options:n.filter(t=>t.source===e),values:a,mark:s,display:c,look:l,onAdd:e=>u([e])},e)),i?(0,U.jsx)(Z,{children:(0,U.jsxs)(Q,{value:`${If}:${r}`,onSelect:()=>u([r]),children:[(0,U.jsx)(Ko,{}),d(`picker.create`,{value:r})]})}):null]})}function Uf(e,t){let n=[...e];for(let e of t){let t=e.trim();t!==``&&!n.includes(t)&&n.push(t)}return n}function Wf(e,t,n){let r=n.trim().toLowerCase();return e.filter(e=>r===``||e.label.toLowerCase().includes(r)||(e.hint??``).toLowerCase().includes(r)).map((e,t)=>({option:e,index:t})).sort((e,n)=>Number(t.includes(n.option.value))-Number(t.includes(e.option.value))||e.index-n.index).map(({option:e})=>e)}function Gf({option:e,checked:t,onToggle:n}){return(0,U.jsxs)(Q,{value:`option:${e.value}`,onSelect:n,children:[(0,U.jsx)(Ta,{className:k(t?`opacity-100`:`opacity-0`)}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[e.render??(0,U.jsx)(`span`,{className:`truncate`,children:e.label}),e.hint?(0,U.jsx)(`span`,{className:`text-xs break-all text-muted-foreground`,children:e.hint}):null]}),e.count===void 0?null:(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:e.count})]})}function Kf(e){let t=new Map;for(let n of e)t.set(n.group,[...t.get(n.group)??[],n]);return[...t]}function qf({label:e,listId:t,options:n,selected:r,query:i,onQuery:a,onChange:o,clearLabel:s}){let{t:c}=_(),l=Wf(n,r,i),u=e=>o(r.includes(e)?r.filter(t=>t!==e):[...r,e]);return(0,U.jsxs)(qc,{shouldFilter:!1,label:c(`picker.search`,{label:e}),children:[(0,U.jsx)(Yc,{value:i,onValueChange:a,placeholder:c(`picker.searchOnly`)}),(0,U.jsxs)(Xc,{id:t,children:[(0,U.jsx)(Zc,{children:c(`picker.nothing`)}),Kf(l).map(([e,t])=>(0,U.jsx)(Z,{heading:e||void 0,children:t.map(e=>(0,U.jsx)(Gf,{option:e,checked:r.includes(e.value),onToggle:()=>u(e.value)},e.value))},e??``)),r.length>0?(0,U.jsx)(Z,{className:`border-t`,children:(0,U.jsx)(Q,{value:`clear`,onSelect:()=>o([]),children:s})}):null]})]})}function Jf({id:e,label:t,options:n,selected:r,onChange:i,clearLabel:a,disabled:o=!1}){let s=(0,L.useId)(),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(``);return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t}),(0,U.jsxs)(Qc,{open:c,onOpenChange:e=>{l(e),e||d(``)},children:[(0,U.jsxs)(`div`,{className:`flex min-h-9.5 min-w-0 max-w-full flex-wrap items-center gap-1.5 rounded-md border border-input bg-card p-1.5`,children:[(0,U.jsx)(Bf,{inherited:[],values:r,display:e=>n.find(t=>t.value===e)?.label??e,mark:void 0,disabled:o,onRemove:e=>i(r.filter(t=>t!==e))}),(0,U.jsx)(Vf,{id:e,label:t,open:c,listId:s,disabled:o})]}),(0,U.jsx)(el,{className:`p-0`,children:(0,U.jsx)(qf,{label:t,listId:s,options:n,selected:r,query:u,onQuery:d,onChange:i,clearLabel:a})})]})]})}var Yf={indigo:`bg-[#e0e7ff] text-[#312e81] dark:bg-[#312e81] dark:text-[#e0e7ff]`,gray:`bg-[#f3f4f6] text-[#111827] dark:bg-[#111827] dark:text-[#f3f4f6]`,red:`bg-[#fee2e2] text-[#7f1d1d] dark:bg-[#7f1d1d] dark:text-[#fee2e2]`,orange:`bg-[#ffedd5] text-[#7c2d12] dark:bg-[#7c2d12] dark:text-[#ffedd5]`,yellow:`bg-[#fef9c3] text-[#713f12] dark:bg-[#713f12] dark:text-[#fef9c3]`,green:`bg-[#dcfce7] text-[#14532d] dark:bg-[#14532d] dark:text-[#dcfce7]`,teal:`bg-[#ccfbf1] text-[#134e4a] dark:bg-[#134e4a] dark:text-[#ccfbf1]`,blue:`bg-[#dbeafe] text-[#1e3a8a] dark:bg-[#1e3a8a] dark:text-[#dbeafe]`,violet:`bg-[#ede9fe] text-[#4c1d95] dark:bg-[#4c1d95] dark:text-[#ede9fe]`,pink:`bg-[#fce7f3] text-[#831843] dark:bg-[#831843] dark:text-[#fce7f3]`,brown:`bg-[#fef3c7] text-[#78350f] dark:bg-[#78350f] dark:text-[#fef3c7]`},Xf=`indigo`,Zf=Object.keys(Yf).filter(e=>e!==Xf);function Qf(e){return e.task?`#${e.task.number}: ${e.name}`:e.name}var $f=`inline-flex max-w-40 items-center truncate rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap`;function ep({tag:e,className:t,nested:n=!1}){let r=k($f,Yf[e.color]??Yf.gray,t),i=Qf(e);if(!e.task)return(0,U.jsx)(`span`,{"data-tag":e.id,className:r,title:i,children:(0,U.jsx)(`span`,{className:`truncate`,children:i})});let a=`#runs/${encodeURIComponent(e.task.run)}`;if(n){let t=e=>{e.stopPropagation(),window.location.hash=a};return(0,U.jsx)(`span`,{"data-tag":e.id,role:`link`,tabIndex:0,className:k(r,`cursor-pointer hover:underline`),title:i,onClick:t,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),t(e))},children:(0,U.jsx)(`span`,{className:`truncate`,children:i})})}return(0,U.jsx)(`a`,{"data-tag":e.id,href:a,className:k(r,`hover:underline`),title:i,onClick:e=>e.stopPropagation(),children:(0,U.jsx)(`span`,{className:`truncate`,children:i})})}function tp({id:e,className:t,nested:n=!1}){let r=Md().byId.get(e);return r?(0,U.jsx)(ep,{tag:r,className:t,nested:n}):null}function np({tags:e,className:t,nested:n=!1}){let{byId:r}=Md(),i=e.filter(e=>r.has(e.id));return i.length===0?null:(0,U.jsx)(`span`,{className:k(`inline-flex flex-wrap items-center gap-1`,t),"data-tags":!0,children:i.map(e=>(0,U.jsx)(tp,{id:e.id,nested:n},e.id))})}function rp(e){let{runs:t,query:n,filters:r,scope:i,repository:a,repositoryPaths:o}=e,{t:s}=_(),{byId:c,of:l}=Md(),u=e=>Af(t,n,r,i,a,c,e),d=Tf(t,i===`repository`?a:null),f=u(`states`),p=yf.map(e=>({value:e,label:Gl(e,s).label,count:f.get(e)??0})),m=u(`pipelines`),h=new Map;for(let e of d)h.set(e.pipeline,e.pipelineName||e.pipeline);for(let e of r.pipelines)h.has(e)||h.set(e,e);let g=[...h].map(([e,t])=>({value:e,label:t,count:m.get(e)??0})).sort((e,t)=>e.label.localeCompare(t.label,`en`)),v=u(`specialists`),y=new Set(r.specialists);for(let e of d)Sf(e).forEach(e=>y.add(e));let b=new Map;for(let e of d)for(let t of e.topology?.stages??[])t.performer.type===`specialist`&&t.performer.name&&b.set(t.performer.slug,t.performer.name);let x=[...y].map(e=>({value:e,label:Fd(b,e),count:v.get(e)??0})).sort((e,t)=>e.label.localeCompare(t.label,`en`)),S=u(`tagIds`),C=l(a).map(e=>({value:e.id,label:e.name,count:S.get(e.id)??0,render:(0,U.jsx)(ep,{tag:e})})),w=u(`repositories`);return{states:p,pipelines:g,specialists:x,tags:C,repositories:[...new Set([...r.repositories,...t.map(e=>e.repository)])].map(e=>({value:e,label:A(e),hint:o?.get(e)??e,render:(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsx)(De,{path:e}),A(e)]}),count:w.get(e)??0})).sort((e,t)=>e.label.localeCompare(t.label,`en`)||e.hint.localeCompare(t.hint,`en`))}}function ip({runs:e,query:t,onQuery:n,filters:r,onFilters:i,scope:a,onScope:o,repository:s,repositoryPaths:c}){let{t:l}=_(),u=rp({runs:e,query:t,filters:r,scope:a,repository:s,repositoryPaths:c}),d=e=>t=>i({...r,[e]:t}),f=l(`runs.list.clear`),p=[[l(`runs.list.state`),`states`,u.states],[l(`runs.list.pipeline`),`pipelines`,u.pipelines],[l(`runs.list.specialists`),`specialists`,u.specialists],[l(`runs.list.tags`),`tagIds`,u.tags]];return a===`all`&&p.push([l(`runs.list.repositories`),`repositories`,u.repositories]),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(Gs,{type:`search`,"aria-label":l(`runs.list.search`),placeholder:l(`runs.list.search`),value:t,onChange:e=>n(e.target.value)}),(0,U.jsxs)(ke,{type:`single`,"aria-label":l(`runs.list.scope`),value:a,className:`flex-wrap`,onValueChange:e=>e&&o(e),children:[(0,U.jsx)(Me,{value:`repository`,children:l(`runs.list.scopeRepository`)}),(0,U.jsx)(Me,{value:`all`,children:l(`runs.list.scopeAll`)})]}),p.map(([e,t,n])=>(0,U.jsx)(Jf,{label:e,options:n,selected:r[t],onChange:d(t),clearLabel:f},t))]})}function ap({filterProps:e,count:t,wide:n}){let{t:r}=_();return(0,U.jsx)(Pf,{label:r(`runs.list.filters`),countLabel:t>0?r(`runs.list.filtersCount`,{count:t}):null,wide:n,children:(0,U.jsx)(ip,{...e})})}function op(e){let{t}=_();return(0,U.jsx)(me,{label:t(`runs.list.filters`),count:e.count,countLabel:t(`runs.list.filtersCount`,{count:e.count}),collapsed:e.collapsed,onCollapsed:e.onCollapsed,children:(0,U.jsx)(ip,{...e.filterProps})})}function sp({onRoute:e}){let{t}=_();return(0,U.jsxs)(Pe,{icon:(0,U.jsx)(go,{}),title:t(`runs.page.noRuns`),className:`m-auto`,children:[(0,U.jsxs)(`p`,{children:[t(`runs.page.startWith`),` `,(0,U.jsx)(`code`,{className:`font-mono`,children:`aip run start feature --task "…"`}),`.`]}),(0,U.jsx)(o,{variant:`outline`,size:`sm`,asChild:!0,children:(0,U.jsx)(`a`,{href:`#queue`,onClick:t=>{t.preventDefault(),e({view:`queue`,run:null,group:null,step:null,tab:null})},children:t(`runs.page.openQueue`)})})]})}function cp(e){let[t,n]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{if(!e||typeof IntersectionObserver>`u`){n(!1);return}let t=new IntersectionObserver(e=>{let t=e[e.length-1];t&&n(!t.isIntersecting)},{threshold:0,root:null});return t.observe(e),()=>{t.disconnect(),n(!1)}},[e]),t}function lp(e){let[t,n]=(0,L.useState)(0);return(0,L.useEffect)(()=>{if(!e||typeof ResizeObserver>`u`){n(0);return}let t=()=>n(Math.floor(e.getBoundingClientRect().height));t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[e]),t}var up=6;function dp({reason:e}){let{t}=_(),[n,r]=(0,L.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`pre`,{className:`font-mono text-xs break-words whitespace-pre-wrap`,children:n?e:e.split(`
|
|
6
|
+
`).slice(0,up).join(`
|
|
7
|
+
`)}),e.split(`
|
|
8
|
+
`).length>up?(0,U.jsx)(`button`,{type:`button`,className:`self-start text-xs underline`,onClick:()=>r(!n),children:t(n?`runs.system.showLess`:`runs.system.showAll`)}):null]})}function fp({ctx:e}){let{t}=_(),{row:n,run:r,view:i,busy:a,act:s,delivering:c,deliverable:l}=e;if(`kind`in n||n.status!==`merged`||n.delivery!==`apply_failed`)return null;let u=i?.delivery.reason??null;return(0,U.jsxs)(j,{variant:`destructive`,className:`flex flex-col gap-2`,children:[(0,U.jsx)(`b`,{children:t(`runs.system.deliveryFailed`)}),i?.delivery.finishedAt==null?null:(0,U.jsx)(`span`,{className:`text-xs`,children:t(`runs.system.lastAttempt`,{time:Il(i.delivery.finishedAt)})}),u?(0,U.jsx)(dp,{reason:u}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsxs)(o,{variant:`outline`,size:`sm`,loading:a||c,disabled:!l||c,onClick:()=>void s(()=>e.onDeliver?e.onDeliver():Promise.resolve()),children:[(0,U.jsx)(Xo,{}),t(`runs.system.retryDelivery`)]}),(0,U.jsx)(o,{variant:`outline`,size:`sm`,disabled:!l||c||!r,onClick:()=>e.setForcing(!0),children:t(`runs.system.forceDeliver`)}),(0,U.jsx)(o,{variant:`outline`,size:`sm`,disabled:!l||c||!r,onClick:()=>void e.markDelivered(),children:t(`runs.system.markDelivered`)})]})]})}function pp({run:e,api:t,onConfirm:n,onClose:r}){let{t:i}=_(),[a,s]=(0,L.useState)(null);return(0,L.useEffect)(()=>{let n=e.groups.filter(e=>e.status===`merged`&&e.delivery!==`applied`);Promise.all(n.map(n=>t.group(e.id,n.slug))).then(s,()=>s([]))},[t,e]),(0,U.jsx)(Vc,{open:!0,onOpenChange:e=>!e&&r(),children:(0,U.jsxs)(Hc,{children:[(0,U.jsxs)(Uc,{children:[(0,U.jsx)(Gc,{children:i(`runs.apply.title`)}),(0,U.jsx)(Kc,{children:i(`runs.apply.description`)})]}),a===null?(0,U.jsx)(M,{className:`h-12`}):null,a?.map(e=>(0,U.jsxs)(`section`,{className:`text-sm`,children:[(0,U.jsx)(`b`,{children:e.title}),e.delivery.reason?(0,U.jsx)(`p`,{className:`text-status-warn`,children:e.delivery.reason}):null,(0,U.jsx)(`ul`,{className:`mt-1 list-disc pl-5`,children:e.delivery.files.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsx)(pe,{path:e})},e))})]},e.slug)),(0,U.jsxs)(Wc,{children:[(0,U.jsx)(o,{variant:`outline`,onClick:r,children:i(`common.cancel`)}),(0,U.jsx)(o,{variant:`destructive`,onClick:n,children:i(`runs.apply.confirm`)})]})]})})}function mp({className:e,...t}){return(0,U.jsx)(`textarea`,{className:k(`min-h-16 w-full rounded-md border border-input bg-card px-2.5 py-1.5 text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive`,e),...t})}function hp({onSend:e,onClose:t}){let{t:n}=_(),[r,i]=(0,L.useState)(``),[a,s]=(0,L.useState)(!1),c=r.trim()===``,l=async()=>{if(!(c||a)){s(!0);try{await e(r),t()}catch{}finally{s(!1)}}};return(0,U.jsx)(Vc,{open:!0,onOpenChange:e=>!e&&t(),children:(0,U.jsxs)(Hc,{children:[(0,U.jsxs)(Uc,{children:[(0,U.jsx)(Gc,{children:n(`runs.message.title`)}),(0,U.jsx)(Kc,{children:n(`runs.message.desc`)})]}),(0,U.jsx)(`p`,{className:`text-sm text-status-warn`,children:n(`runs.message.warn`)}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(dl,{htmlFor:`agent-message`,children:n(`runs.message.label`)}),(0,U.jsx)(mp,{id:`agent-message`,autoFocus:!0,rows:6,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),l())}}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`runs.message.hint`)})]}),(0,U.jsxs)(Wc,{children:[(0,U.jsx)(o,{variant:`outline`,onClick:t,children:n(`common.cancel`)}),(0,U.jsx)(o,{loading:a,disabled:c,onClick:()=>void l(),children:n(`runs.message.send`)})]})]})})}function gp({ctx:e}){let{t}=_(),{api:n,runId:r,row:i,run:a,messaging:o,onError:s}=e;return(0,U.jsxs)(U.Fragment,{children:[o===null?null:(0,U.jsx)(hp,{onSend:async e=>{try{await n.message(r,i.slug,o,e)}catch(e){throw s(e.message),e}F(t(`runs.message.sent`))},onClose:()=>e.setMessaging(null)}),e.forcing&&a?(0,U.jsx)(pp,{run:a,api:n,onConfirm:()=>{e.setForcing(!1),e.act(()=>e.onForceDeliver?e.onForceDeliver():n.apply(a.id,!0))},onClose:()=>e.setForcing(!1)}):null]})}function _p({className:e,...t}){return(0,U.jsx)(ci,{className:k(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full p-0.5 bg-input transition-colors data-[state=checked]:bg-primary disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,U.jsx)(ui,{className:`pointer-events-none block size-4 rounded-full bg-card shadow transition-transform data-[state=unchecked]:translate-x-0 data-[state=checked]:translate-x-full`})})}function vp(e){return e.delivery.merged>e.delivery.applied&&!e.delivery.inProgress}function yp(e){return e.autoDeliver&&!e.finished}function bp(e){let{delivery:t}=e;return t.inProgress?{status:`running`,label:`delivering`,reason:null}:t.failed>0?{status:`apply_failed`,label:`deliveryFailed`,reason:e.deliveryStage?.status===`apply_failed`?e.deliveryStage.reason??null:null}:t.merged>t.applied?{status:`pending`,label:`delivery`,reason:null}:t.merged>0?{status:`applied`,label:e.deliveryStage?.status===`applied`&&e.deliveryStage.manual?`deliveredManually`:null,reason:null}:null}var xp=new Set([`finished`,`failed`,`cancelled`]);function Sp(e){let{delivery:t}=e;if(t.inProgress)return null;let n={delivered:t.applied,merged:t.merged};return t.failed>0?{status:`apply_failed`,reason:e.deliveryStage?.status===`apply_failed`?e.deliveryStage.reason??null:null,...n}:xp.has(e.state)&&e.groups.some(e=>e.status===`merged`&&e.delivery===`pending`&&e.diff?.files!==0)?{status:`undelivered`,reason:null,...n}:null}function Cp(e){if(e.pending)return{kind:`pending`};let t=e.groups.find(e=>e.delivery.state===`apply_failed`);return t?{kind:`failed`,reason:t.delivery.reason}:e.groups.some(e=>e.delivery.state===`applied`)?{kind:`applied`}:{kind:`pending`}}function wp(e,t){return e.delivery.inProgress?null:e.delivery.finishedAt===t.since?t.busy?{kind:`cancelled`}:null:e.deliveryStage?.status===`applied`?{kind:`applied`}:e.deliveryStage?.status===`apply_failed`?{kind:`failed`,reason:e.deliveryStage.reason??null}:{kind:`cancelled`}}function Tp(e,t){return e.status===`running`&&e.hold===`paused`?(0,U.jsx)($,{status:`running`,label:t(`status.pausing`),tip:t(`runs.header.pausingTip`)}):e.status===`running`&&e.hold!=null?(0,U.jsx)($,{status:`running`,label:t(`status.finishing`),tip:t(`runs.header.finishingTip`,{hold:t(`status.${e.hold}`)})}):(0,U.jsx)($,{status:e.status,wait:e.wait})}function Ep(e,t){let n=e.groups.length;if(n===0)return null;let r=e.groups.filter(e=>e.status===`merged`).length;return r===0?(0,U.jsx)($,{status:`not_merged`}):r<n?(0,U.jsx)($,{status:`merged`,label:t(`status.mergedOf`,{merged:r,total:n})}):(0,U.jsx)($,{status:`merged`})}function Dp(e,t,n,r,i){let{delivery:a}=e,o=bp(e);if(!o)return null;let s=e.resolver,c=[];return o&&c.push((0,U.jsx)($,{status:o.status,title:o.reason??void 0,tip:n,onClick:s?()=>i?.(`_resolve`):void 0,label:o.label===`delivering`?r(`runs.header.delivering`):o.label===`deliveryFailed`?r(`runs.header.deliveryFailed`,{n:a.failed}):o.label===`deliveredManually`?r(`runs.header.deliveredManually`):o.label===`delivery`?r(`runs.header.delivery`,{applied:a.applied,merged:a.merged}):void 0},`delivery`)),t&&c.push((0,U.jsx)($,{status:t},`group`)),{key:`delivery`,label:r(`runs.header.parts.delivery`),badges:c}}function Op(e,t,n,r){let{delivery:i}=e,a=bp(e),o=e.resolver,s=o?[n(`runs.header.resolver`),n(`status.${o.status}`,{defaultValue:o.status}),n(`runs.header.round`,{round:o.round,rounds:o.rounds}),o.conflicts.length>0?n(`runs.header.conflicts`,{list:o.conflicts.join(`, `)}):null,a?.reason].filter(Boolean).join(` · `):void 0,c=t&&!(`kind`in t)&&t.status===`merged`&&i.merged>=2?i.inProgress?null:t.delivery:null,l=[{key:`run`,label:n(`runs.header.parts.run`),badges:[(0,U.jsx)($,{status:e.state,label:Jl(e,n)},`run`)]}];if(t){let r=`kind`in t,i=[(0,U.jsx)(`span`,{children:Tp(t,n)},`entry`)],a=r?null:Ep(e,n),o=e.groups.length>0&&e.groups.every(e=>e.status===`merged`);a&&!(t.status===`merged`&&o)&&i.push((0,U.jsx)(`span`,{children:a},`merge`)),l.push({key:`entry`,label:n(r?`runs.header.parts.step`:`runs.header.parts.group`),badges:i})}let u=t&&!(`kind`in t)?null:Ep(e,n);u&&l.push({key:`merge`,label:n(`runs.header.parts.merge`),badges:[(0,U.jsx)(`span`,{children:u},`merge`)]});let d=Dp(e,c,s,n,r);return d&&l.push(d),l}function kp({run:e,entry:t,onSelect:n,layout:r=`rows`}){let{t:i}=_(),a=Op(e,t,i,n);return r===`inline`?(0,U.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:a.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1.5`,children:[(0,U.jsxs)(`span`,{"data-part":e.key,className:`text-xs text-muted-foreground`,children:[e.label,`:`]}),e.badges]},e.key))}):(0,U.jsx)(`div`,{className:`grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-3 gap-y-1`,children:a.map(e=>(0,U.jsxs)(`div`,{className:`contents`,children:[(0,U.jsx)(`span`,{"data-part":e.key,className:`text-xs text-muted-foreground`,children:e.label}),(0,U.jsx)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:e.badges})]},e.key))})}function Ap({ctx:e}){let{t}=_();return e.tabs.tab!==`log`||e.watch.following||!e.caps.cancel?null:(0,U.jsxs)(o,{variant:`outline`,size:`sm`,title:t(`runs.group.watchTitle`),onClick:e.watch.follow,children:[(0,U.jsx)(Za,{}),t(`runs.group.watch`)]})}function jp({ctx:e}){let{run:t,title:n,showUsage:r}=e;return(0,U.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-base font-semibold`,title:t?void 0:n,children:t?(0,U.jsxs)(`span`,{"aria-hidden":!r||void 0,title:`${kl(t)}\n${t.id}`,className:`block truncate transition-[opacity,transform,visibility] duration-200 ease-out motion-reduce:transition-none ${r?`translate-y-0 opacity-100`:`invisible translate-y-1 opacity-0`}`,children:[(0,U.jsx)(`span`,{className:`font-mono font-normal text-muted-foreground`,children:Sl(t.number)}),` `,kl(t)]}):n})}function Mp({ctx:e}){let{t}=_(),{api:n,runId:r,row:i,busy:a,act:s,title:c}=e,l=e=>void s(()=>e?n.retry(r,i.slug,e):n.retry(r,i.slug),()=>F(t(`runs.header.retryStarted`)));return(0,U.jsxs)(zs,{children:[(0,U.jsx)(Bs,{asChild:!0,children:(0,U.jsx)(o,{variant:`outline`,size:`sm`,loading:a,"aria-label":t(`runs.group.more`,{title:c}),title:t(`runs.group.more`,{title:c}),children:(0,U.jsx)(Ya,{})})}),(0,U.jsxs)(Hs,{align:`end`,children:[(0,U.jsxs)(X,{disabled:a,onSelect:()=>l(),children:[(0,U.jsx)(Xo,{}),t(`runs.group.retry`)]}),i.status===`conflict`?null:(0,U.jsxs)(X,{disabled:a,onSelect:()=>l({refreshConfig:!0}),children:[(0,U.jsx)(Jo,{}),t(`runs.group.retryRefreshConfig`)]})]})]})}function Np({ctx:e}){let{t}=_(),{row:n,run:r,busy:i,act:a,caps:s,delivering:c,skip:l}=e;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Ap,{ctx:e}),e.onOnlyReplies?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 whitespace-nowrap`,children:[(0,U.jsx)(_p,{id:`only-replies`,checked:e.onlyReplies,onCheckedChange:e.onOnlyReplies}),(0,U.jsx)(dl,{htmlFor:`only-replies`,children:t(`runs.group.onlyReplies`)})]}):null,`kind`in n?(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`runs.system.badge`)}):null,r?null:Tp(n,t),s.retryDelivery?(0,U.jsxs)(o,{variant:`outline`,size:`sm`,loading:i||c,disabled:c,onClick:()=>void a(()=>e.onDeliver?e.onDeliver():Promise.resolve()),children:[(0,U.jsx)(Xo,{}),t(`runs.system.retryDelivery`)]}):null,l.canSkip&&r&&l.skippable?(0,U.jsxs)(o,{variant:`outline`,size:`sm`,loading:l.skipper.pending!==null,onClick:()=>void l.skipper.toggle(l.skippable,!0,{allGroups:r.groups.length>1}),children:[(0,U.jsx)(os,{}),t(`runs.group.skipStep`)]}):null,s.cancel?(0,U.jsx)(o,{variant:`destructive`,size:`sm`,loading:i,onClick:()=>void e.cancelGroup(),children:t(`runs.group.cancel`)}):null,s.retry?(0,U.jsx)(Mp,{ctx:e}):null]})}function Pp({ctx:e}){let{t}=_(),n=e.run?.deliveryStage??null,r=e.run?.delivery.finishedAt??null;return n?(0,U.jsx)(`span`,{role:`status`,"aria-label":t(`runs.system.delivery`),className:`flex flex-wrap items-center gap-x-2`,children:n.status===`delivering`?(0,U.jsx)($,{status:`running`,label:t(`runs.system.delivering`)}):n.status===`applied`||n.status===`apply_failed`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)($,{status:n.status}),r===null?null:(0,U.jsx)(`span`,{children:t(`runs.system.lastAttempt`,{time:Il(r)})})]}):null}):null}function Fp({ctx:e}){let{t}=_(),{row:n,showUsage:r}=e;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`font-medium text-foreground`,title:n.step??void 0,children:n.stepName??n.step??`—`}),n.round===null?null:(0,U.jsx)(`span`,{children:t(`runs.group.round`,{round:n.round})}),n.limitUntil===null?null:(0,U.jsx)(`span`,{className:`text-status-warn`,children:t(`runs.group.limitUntil`,{time:Il(n.limitUntil)})}),`kind`in n&&n.kind!==`split`&&n.kind!==`action`&&!dt(n)?(0,U.jsx)(Pp,{ctx:e}):null,r?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:Cl(n.durationMs)}),El(n.usage)?(0,U.jsx)(`span`,{children:El(n.usage)}):null,wl(n.usage)?(0,U.jsx)(`span`,{children:wl(n.usage)}):null]}):null]})}function Ip({ctx:e,run:t}){let{row:n,showUsage:r}=e;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{"data-slot":`group-header-collapse`,"aria-hidden":!r||void 0,className:`grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none ${r?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`}`,children:(0,U.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,U.jsxs)(`div`,{"data-slot":`group-header-title-row`,className:`flex items-center gap-3 pb-2 [&>h2]:min-w-32`,children:[(0,U.jsx)(jp,{ctx:e}),(0,U.jsx)(`div`,{"data-slot":`group-header-statuses`,className:`flex min-w-0 justify-end`,children:e.statusesMounted?(0,U.jsx)(kp,{run:t,entry:n,onSelect:e.onSelectEntry,layout:`inline`}):null})]})})}),(0,U.jsxs)(`div`,{"data-slot":`group-header-row`,className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,U.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted-foreground`,children:(0,U.jsx)(Fp,{ctx:e})}),(0,U.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:(0,U.jsx)(Np,{ctx:e})})]})]})}function Lp({ctx:e,onHeight:t}){let{run:n}=e;return(0,U.jsx)(`header`,{ref:t,className:`sticky top-0 z-10 -mx-4 -mt-4 flex flex-col border-b bg-background/95 px-4 py-3 backdrop-blur ${n?``:`gap-2`}`,children:n?(0,U.jsx)(Ip,{ctx:e,run:n}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{"data-slot":`group-header-row`,className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(jp,{ctx:e}),(0,U.jsx)(Np,{ctx:e})]}),(0,U.jsx)(`div`,{"data-slot":`group-header-row`,className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted-foreground`,children:(0,U.jsx)(Fp,{ctx:e})})]})})}var Rp=5;function zp({attempt:e,onDismiss:t}){let{t:n}=_(),r=e.outsideChanges??[];return r.length===0?null:(0,U.jsxs)(Xu,{defaultOpen:r.length<=Rp,className:`rounded-lg border border-status-warn/30 bg-status-warn-bg text-sm text-status-warn`,children:[(0,U.jsxs)(`div`,{className:`flex items-center`,children:[(0,U.jsxs)(Zu,{className:`group flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left`,children:[(0,U.jsx)(ka,{className:`size-4 transition-transform group-data-[state=open]:rotate-90`}),(0,U.jsx)(ms,{className:`size-4`,"aria-hidden":!0}),n(`runs.outside.title`,{step:e.stepName??e.stepId,seq:e.seq,count:r.length})]}),t?(0,U.jsx)(o,{variant:`ghost`,size:`icon`,className:`mr-1 size-7 shrink-0`,"aria-label":n(`runs.group.dismissNotice`),title:n(`runs.group.dismissNotice`),onClick:t,children:(0,U.jsx)(bs,{})}):null]}),(0,U.jsxs)(Qu,{children:[(0,U.jsx)(`p`,{className:`px-8 pb-1 text-xs`,children:n(`runs.outside.hint`)}),(0,U.jsx)(`ul`,{className:`px-8 pb-2`,children:r.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsx)(pe,{path:e})},e))})]})]})}function Bp({text:e}){return(0,U.jsx)(`div`,{className:`text-sm leading-relaxed break-words [&_a]:text-primary [&_a]:underline [&_blockquote]:border-l-2 [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground [&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:font-mono [&_code]:text-xs [&_h1]:text-base [&_h1]:font-semibold [&_h2]:font-semibold [&_h3]:font-semibold [&_li]:my-0.5 [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:my-2 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-2 [&_table]:border-collapse [&_td]:border [&_td]:px-2 [&_th]:border [&_th]:px-2 [&_ul]:list-disc [&_ul]:pl-5`,children:(0,U.jsx)(Ye,{remarkPlugins:[Xe],skipHtml:!1,children:e})})}function Vp({title:e,question:t,draft:n,busy:r,onDraft:i,onSubmit:a}){let{t:s}=_();return(0,U.jsxs)(`form`,{className:`flex flex-col gap-2 rounded-lg border border-status-warn/40 bg-status-warn-bg p-3`,onSubmit:e=>{e.preventDefault(),n.trim()&&a(n,()=>{i(``),F(s(`runs.questions.answerSent`))})},children:[(0,U.jsx)(`div`,{className:`text-status-warn [&_*]:font-medium`,children:(0,U.jsx)(Bp,{text:t??``})}),(0,U.jsx)(mp,{"aria-label":s(`runs.questions.answerFor`,{title:e}),value:n,onChange:e=>i(e.target.value),rows:3}),(0,U.jsx)(`div`,{children:(0,U.jsx)(o,{type:`submit`,loading:r,disabled:!n.trim(),children:s(`runs.questions.answer`)})})]})}function Hp({question:e,index:t,total:n,value:r,onChange:i}){let{t:a}=_(),s=e.options??[],c=e.recommendation??null;return(0,U.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-2 border-0 p-0`,children:[(0,U.jsx)(`legend`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:a(`runs.questions.question`,{index:t+1,total:n})}),(0,U.jsx)(Bp,{text:e.text}),s.length>0?(0,U.jsx)(`div`,{className:`flex min-w-0 max-w-full flex-wrap gap-2`,children:s.map(e=>(0,U.jsxs)(o,{variant:`outline`,size:`sm`,className:`h-auto min-h-7 min-w-0 max-w-full shrink whitespace-normal flex-wrap justify-start text-left`,"aria-pressed":r===e,onClick:()=>i(e),children:[(0,U.jsx)(`span`,{className:`min-w-0 max-w-full [overflow-wrap:anywhere]`,children:e}),e===c?(0,U.jsxs)(I,{variant:`warn`,children:[(0,U.jsx)(us,{"aria-hidden":`true`}),a(`runs.questions.recommended`)]}):null]},e))}):c?(0,U.jsxs)(`p`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,U.jsx)(us,{"aria-hidden":`true`,className:`size-3`}),a(`runs.questions.recommendation`,{text:c})]}):null,(0,U.jsx)(mp,{"aria-label":a(`runs.questions.answerTo`,{index:t+1}),value:r,onChange:e=>i(e.target.value),rows:2})]})}function Up({questions:e,draftKey:t,drafts:n,busy:r,onDraft:i,onClearDrafts:a,onSubmit:s}){let{t:c}=_(),l=e.map((e,n)=>Fl(t,n,e.text)),u=e.map((e,t)=>n[l[t]]??e.recommendation??``),d=u.filter(e=>e.trim()===``).length;return(0,U.jsxs)(`form`,{"aria-label":c(`runs.questions.label`),className:`flex min-w-0 max-w-full flex-col gap-3 rounded-lg border border-status-warn/40 bg-status-warn-bg p-3`,onSubmit:n=>{n.preventDefault(),d>0||s(Pl(e,u),()=>{a(t),F(c(`runs.questions.answerSent`))})},children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-status-warn`,children:c(`runs.questions.heading`,{n:e.length})}),e.map((t,n)=>(0,U.jsx)(Hp,{question:t,index:n,total:e.length,value:u[n],onChange:e=>i(l[n],e)},l[n])),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,U.jsx)(o,{type:`submit`,loading:r,disabled:d>0,children:c(`runs.questions.answer`)}),d>0?(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:c(`runs.questions.unanswered`,{n:d})}):null]})]})}function Wp(e,t){let n=[];(e?.warnings??[]).forEach((e,t)=>n.push({kind:`warning`,key:`warning:${t}:${e}`,text:e}));let r=[...e?.attempts??[]].sort((e,t)=>e.seq-t.seq);for(let e of r)(e.outsideChanges??[]).length>0&&n.push({kind:`outside`,key:`outside:${e.seq}`,attempt:e});let i=e?.permissionHints??[];return i.length>0&&n.push({kind:`hints`,key:`hints:${i.join(`,`)}`,patterns:i}),t.reason&&t.status!==`needs_human`&&n.push({kind:`reason`,key:`reason:${t.reason}`,text:t.reason}),n}function Gp(e,t){let n=e.at(-1)??null;return n!==null&&n.key!==t?n:null}function Kp(e,t){let[n,r]=N(`dismissedNotices`,{}),i=`${e}/${t}`,a=(0,L.useCallback)(e=>{let{[i]:t,...a}=n,o=Object.entries({...a,[i]:e});r(Object.fromEntries(o.slice(-200)))},[n,i,r]);return[n[i]??null,a]}function qp({ctx:e}){let{t}=_(),{api:n,runId:r,row:i,busy:a,act:s}=e;return i.status!==`needs_human`||!i.humanOnly?null:(0,U.jsxs)(`section`,{"aria-label":t(`runs.humanOnly.${i.humanOnly}`),className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(I,{variant:`warn`,children:t(`runs.humanOnly.${i.humanOnly}`)}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`runs.humanOnly.hint`)}),i.humanOnly===`review`?(0,U.jsx)(o,{size:`sm`,loading:a,onClick:()=>void s(()=>n.answer(r,i.slug,`Принято`),()=>F(t(`runs.questions.answerSent`))),children:t(`runs.humanOnly.accept`)}):null]})}function Jp({ctx:e}){let{api:t,runId:n,row:r,busy:i,act:a,drafts:o,draftKey:s,onDraft:c}=e;if(r.status!==`needs_human`)return null;let l=(e,i)=>void a(()=>t.answer(n,r.slug,e),i);return r.questions&&r.questions.length>0?(0,U.jsx)(Up,{questions:r.questions,draftKey:s,drafts:o,busy:i,onDraft:c,onClearDrafts:e.onClearDrafts,onSubmit:l}):(0,U.jsx)(Vp,{title:e.title,question:r.question,draft:o[s]??``,busy:i,onDraft:e=>c(s,e),onSubmit:l})}function Yp({ctx:e}){let{t}=_(),[n,r]=Kp(e.runId,e.row.slug),i=Gp(Wp(e.view,e.row),n);if(!i)return null;if(i.kind===`outside`)return(0,U.jsx)(zp,{attempt:i.attempt,onDismiss:()=>r(i.key)});let a=(0,U.jsx)(o,{variant:`ghost`,size:`icon`,className:`absolute top-1 right-1 size-7`,"aria-label":t(`runs.group.dismissNotice`),title:t(`runs.group.dismissNotice`),onClick:()=>r(i.key),children:(0,U.jsx)(bs,{})});return i.kind===`hints`?(0,U.jsx)(`section`,{"aria-label":t(`runs.group.hintsLabel`),children:(0,U.jsxs)(j,{variant:`warn`,className:`relative pr-10`,children:[a,(0,U.jsx)(`div`,{className:`mb-1 text-xs font-medium uppercase`,children:t(`runs.group.hintsTitle`)}),(0,U.jsxs)(`p`,{children:[t(`runs.group.hintsAdd`),` `,(0,U.jsx)(`code`,{children:`allow_commands`}),`:`,` `,i.patterns.map((e,t)=>(0,U.jsxs)(`span`,{children:[t>0?`, `:``,(0,U.jsx)(`code`,{children:e})]},e)),t(`runs.group.hintsAfter`),` `,(0,U.jsx)(pe,{path:`aip/specialists/`}),`.`]})]})}):(0,U.jsxs)(j,{variant:i.kind===`reason`?`destructive`:`warn`,className:`relative pr-10`,children:[a,i.kind===`reason`?Ll(i.text,t):i.text]})}function Xp({ctx:e}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(qp,{ctx:e}),(0,U.jsx)(Jp,{ctx:e}),(0,U.jsx)(Yp,{ctx:e})]})}var Zp=1048576,Qp=`px-2 py-1.5 font-medium`;function $p({api:e,runId:t,group:n,artifact:r}){let{t:i,i18n:a}=_(),o=r.size>Zp,[s,c]=(0,L.useState)(null);return(0,L.useEffect)(()=>{if(o)return;let i=!1;return e.artifactText(t,n,r.id).then(e=>!i&&c({id:r.id,text:e}),e=>!i&&c({id:r.id,error:e.message})),()=>{i=!0}},[e,t,n,r.id,r.createdAt,r.size,o]),o?(0,U.jsxs)(`div`,{className:`flex flex-col items-start gap-2`,children:[(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`runs.group.artifactTooLarge`,{limit:Vl(Zp,i,a.language)})}),(0,U.jsx)(em,{api:e,runId:t,group:n,artifact:r})]}):s===null||s.id!==r.id?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`runs.group.artifactLoading`)}):`error`in s?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:i(`runs.group.artifactFailed`,{message:s.error})}):r.preview===`markdown`?(0,U.jsx)(Bp,{text:s.text}):(0,U.jsx)(`pre`,{className:`overflow-x-auto font-mono text-xs whitespace-pre-wrap`,children:s.text})}function em({api:e,runId:t,group:n,artifact:r}){let{t:i}=_();return(0,U.jsx)(o,{variant:`outline`,size:`sm`,asChild:!0,children:(0,U.jsxs)(`a`,{href:e.artifactUrl(t,n,r.id),download:r.fileName,"aria-label":`${i(`runs.group.artifactDownload`)} ${r.fileName}`,children:[(0,U.jsx)(qa,{}),i(`runs.group.artifactDownload`)]})})}function tm({onClose:e,...t}){let{t:n}=_();return(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h3`,{className:`truncate text-sm font-medium`,children:t.artifact.title}),(0,U.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:t.artifact.fileName})]}),(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsx)(em,{...t}),(0,U.jsx)(o,{variant:`ghost`,size:`sm`,onClick:e,children:n(`runs.group.artifactClose`)})]})]})}function nm(){let{t:e}=_();return(0,U.jsx)(`thead`,{className:`border-b text-muted-foreground`,children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{className:Qp,children:e(`runs.group.artifactStep`)}),(0,U.jsx)(`th`,{className:Qp,children:e(`runs.group.artifactTitle`)}),(0,U.jsx)(`th`,{className:Qp,children:e(`runs.group.artifactFile`)}),(0,U.jsx)(`th`,{className:Qp,children:e(`runs.group.artifactCreated`)}),(0,U.jsx)(`th`,{className:`${Qp} text-right`,children:e(`runs.group.artifactSize`)}),(0,U.jsx)(`th`,{className:Qp,children:(0,U.jsx)(`span`,{className:`sr-only`,children:e(`runs.group.artifactOpen`)})})]})})}function rm(e){let{api:t,runId:n,group:r,artifact:i,now:a,opened:s,onOpen:c}=e,{t:l,i18n:u}=_();return(0,U.jsxs)(`tr`,{className:`border-b last:border-0 hover:bg-muted/50`,children:[(0,U.jsxs)(`td`,{className:`px-2 py-1.5`,title:`${i.step} · ${i.specialist}`,children:[i.stepName,` · #`,i.seq]}),(0,U.jsx)(`td`,{className:`px-2 py-1.5`,children:i.title}),(0,U.jsx)(`td`,{className:`px-2 py-1.5`,children:(0,U.jsx)(`code`,{className:`rounded bg-muted px-1 font-mono text-xs`,children:i.fileName})}),(0,U.jsx)(`td`,{className:`px-2 py-1.5 whitespace-nowrap`,children:(0,U.jsx)(`time`,{dateTime:new Date(i.createdAt).toISOString(),title:Ul(i.createdAt,u.language),children:Al(i.createdAt,a,u.language)})}),(0,U.jsx)(`td`,{className:`px-2 py-1.5 text-right whitespace-nowrap tabular-nums`,children:Vl(i.size,l,u.language)}),(0,U.jsx)(`td`,{className:`px-2 py-1.5`,children:(0,U.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[i.preview===null?null:(0,U.jsxs)(o,{variant:`ghost`,size:`sm`,"aria-label":`${l(`runs.group.artifactOpen`)} ${i.fileName}`,onClick:()=>c(i.id===s?null:i.id),children:[(0,U.jsx)(Za,{}),l(`runs.group.artifactOpen`)]}),(0,U.jsx)(o,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,U.jsxs)(`a`,{href:t.artifactUrl(n,r,i.id),download:i.fileName,"aria-label":`${l(`runs.group.artifactDownload`)} ${i.fileName}`,children:[(0,U.jsx)(qa,{}),l(`runs.group.artifactDownload`)]})})]})})]})}function im(e){let{api:t,runId:n,group:r,count:i,revision:a,onError:o}=e,[s,c]=(0,L.useState)(null);return(0,L.useEffect)(()=>{let e=!1;return t.groupArtifacts(n,r).then(t=>!e&&c(t),t=>!e&&o(t.message)),()=>{e=!0}},[t,n,r,i,a,o]),s}function am({api:e,runId:t,group:n,count:r,revision:i,onError:a}){let{t:o,i18n:s}=_(),c=P(`(min-width: 768px)`),l=im({api:e,runId:t,group:n,count:r,revision:i,onError:a}),[u,d]=(0,L.useState)(null);if(l===null)return(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`runs.group.artifactLoading`)});if(l.length===0)return(0,U.jsx)(Pe,{title:o(`runs.group.artifacts`),children:o(`runs.group.artifactsEmpty`)});let f=Date.now(),p=l.find(e=>e.id===u)??null,m=p?(0,U.jsxs)(`section`,{"aria-label":o(`runs.group.artifactPreview`,{file:p.fileName}),className:`flex flex-col gap-3 rounded-md border bg-card p-4 text-card-foreground`,children:[(0,U.jsx)(tm,{api:e,runId:t,group:n,artifact:p,onClose:()=>d(null)}),(0,U.jsx)($p,{api:e,runId:t,group:n,artifact:p})]}):null;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsxs)(`table`,{"aria-label":o(`runs.group.artifactsList`),className:`w-full text-left text-sm`,children:[(0,U.jsx)(nm,{}),(0,U.jsx)(`tbody`,{children:l.map(r=>(0,U.jsx)(rm,{api:e,runId:t,group:n,artifact:r,now:f,opened:u,onOpen:d},r.id))})]}),c?m:p?(0,U.jsx)(Vc,{open:!0,onOpenChange:e=>!e&&d(null),children:(0,U.jsxs)(Hc,{className:`max-w-2xl`,children:[(0,U.jsxs)(Uc,{children:[(0,U.jsx)(Gc,{children:p.title}),(0,U.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:p.fileName})]}),(0,U.jsx)(`div`,{className:`flex`,children:(0,U.jsx)(em,{api:e,runId:t,group:n,artifact:p})}),(0,U.jsx)($p,{api:e,runId:t,group:n,artifact:p})]})}):null]})}function om({diff:e}){let{t}=_();return(0,U.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,U.jsx)(`strong`,{className:`font-semibold text-foreground`,children:Dl(e.files,t)}),` `,(0,U.jsxs)(`span`,{className:`text-status-ok`,children:[`+`,e.added]}),` `,(0,U.jsxs)(`span`,{className:`text-status-err`,children:[`−`,e.removed]})]})}var sm=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function cm(e){let t=[],n=null,r=0,i=0;for(let a of e){let e=sm.exec(a);if(e){n={header:a,rows:[]},t.push(n),r=Number(e[1]),i=Number(e[2]);continue}if(!n)continue;let o=a.slice(1);a.startsWith(`+`)?n.rows.push({kind:`add`,old:null,new:i++,text:o}):a.startsWith(`-`)?n.rows.push({kind:`del`,old:r++,new:null,text:o}):a.startsWith(`\\`)?n.rows.push({kind:`note`,old:null,new:null,text:a}):n.rows.push({kind:`ctx`,old:r++,new:i++,text:o})}return t}var lm={ctx:``,add:`bg-status-ok/10`,del:`bg-status-err/10`,note:`text-muted-foreground italic`},um={ctx:` `,add:`+`,del:`−`,note:``};function dm({result:e,reserve:t}){let{t:n}=_();if(e.state===`loading`)return(0,U.jsx)(`p`,{role:`status`,className:`px-3 py-2 text-xs text-muted-foreground`,style:t?{minHeight:`${t*1}rem`}:void 0,children:n(`runs.files.diffLoading`)});if(e.state===`error`)return(0,U.jsxs)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-status-err`,children:[n(`runs.files.diffUnavailable`),`: `,e.message]});let{diff:r}=e;if(r.binary)return(0,U.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:n(`runs.files.diffBinary`)});let i=cm(r.lines);return i.length===0?(0,U.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:n(`runs.files.diffEmpty`)}):(0,U.jsxs)(`div`,{className:`overflow-x-auto border-t bg-background font-mono text-xs`,children:[i.map((e,t)=>(0,U.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,U.jsx)(`caption`,{className:`bg-muted px-3 py-0.5 text-left text-muted-foreground`,children:e.header}),(0,U.jsx)(`tbody`,{children:e.rows.map((e,t)=>(0,U.jsxs)(`tr`,{"data-kind":e.kind,className:k(lm[e.kind]),children:[(0,U.jsx)(`td`,{className:`w-10 select-none px-2 text-right text-muted-foreground`,children:e.old??``}),(0,U.jsx)(`td`,{className:`w-10 select-none px-2 text-right text-muted-foreground`,children:e.new??``}),(0,U.jsx)(`td`,{className:`w-4 select-none text-center`,children:um[e.kind]}),(0,U.jsx)(`td`,{className:`whitespace-pre pr-3`,children:e.text})]},t))})]},t)),r.truncated?(0,U.jsx)(`p`,{className:`border-t px-3 py-1 text-muted-foreground`,children:n(`runs.files.diffTruncated`,{shown:r.lines.length,total:r.totalLines})}):null]})}function fm(e,t,n){return{name:e,path:t,kind:n,added:0,removed:0,binary:!1,children:new Map}}function pm(e){let t=e;for(;t.kind===`dir`&&t.children.size===1;){let[e]=t.children.values();if(!e||e.kind!==`dir`)break;t={...e,name:`${t.name}/${e.name}`}}let n=[...t.children.values()].map(pm).sort((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name,`en`):e.kind===`dir`?-1:1);return{name:t.name,path:t.path,kind:t.kind,added:t.added,removed:t.removed,binary:t.binary,children:n}}function mm(e){let t=fm(``,``,`dir`);for(let n of e){let e=n.path.split(`/`).filter(Boolean),r=n.added??0,i=n.removed??0,a=t;e.forEach((t,o)=>{let s=o===e.length-1,c=e.slice(0,o+1).join(`/`),l=a.children.get(t);l||(l=fm(t,c,s?`file`:`dir`),a.children.set(t,l)),l.added+=r,l.removed+=i,s&&(l.binary=n.added===null),a=l})}return[...t.children.values()].map(pm).sort((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name,`en`):e.kind===`dir`?-1:1)}function hm(e){return e.binary?1:Math.min(40,Math.max(3,e.added+e.removed+11))}function gm({node:e}){let{t}=_();return e.binary?(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:t(`runs.files.binary`)}):(0,U.jsxs)(`span`,{className:`font-mono text-xs`,children:[(0,U.jsxs)(`span`,{className:`text-status-ok`,children:[`+`,e.added]}),` `,(0,U.jsxs)(`span`,{className:`text-status-err`,children:[`−`,e.removed]})]})}function _m({node:e,expansion:t}){let{t:n}=_(),r=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[t?(0,U.jsx)(ka,{className:k(`size-4 shrink-0 transition-transform`,t.open.has(e.path)&&`rotate-90`),"aria-hidden":!0}):null,(0,U.jsx)($a,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,U.jsx)(`code`,{className:`truncate font-mono text-xs`,title:e.path,children:e.name}),t?.previous.has(e.path)?(0,U.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:n(`runs.files.renamedFrom`,{path:t.previous.get(e.path)??``})}):null]}),(0,U.jsx)(gm,{node:e})]});if(!t)return(0,U.jsx)(`li`,{className:`flex items-center justify-between gap-3 px-2 py-1 text-sm`,children:r});let i=t.open.has(e.path),a=t.results[e.path];return(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`button`,{type:`button`,"aria-expanded":i,"aria-label":e.path,onClick:()=>t.toggle(e.path),className:`flex w-full items-center justify-between gap-3 rounded px-2 py-1 text-left text-sm hover:bg-accent`,children:r}),i?(0,U.jsx)(`div`,{className:`my-1 ml-2 overflow-hidden rounded border`,children:(0,U.jsx)(dm,{result:a??{state:`loading`},reserve:hm(e)})}):null]})}function vm({node:e,expansion:t}){return e.kind===`file`?(0,U.jsx)(_m,{node:e,expansion:t}):(0,U.jsx)(`li`,{children:(0,U.jsxs)(Xu,{defaultOpen:!0,children:[(0,U.jsxs)(Zu,{className:`group flex w-full items-center justify-between gap-3 rounded px-2 py-1 text-sm hover:bg-accent`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,U.jsx)(ka,{className:k(`size-4 shrink-0 transition-transform group-data-[state=open]:rotate-90`),"aria-hidden":!0}),(0,U.jsx)(ao,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,U.jsx)(`code`,{className:`truncate font-mono text-xs`,children:e.name})]}),(0,U.jsx)(gm,{node:e})]}),(0,U.jsx)(Qu,{children:(0,U.jsx)(`ul`,{className:`ml-4 border-l pl-1`,children:e.children.map(e=>(0,U.jsx)(vm,{node:e,expansion:t},e.path))})})]})})}function ym({files:e,diff:t}){let{t:n}=_(),r=mm(e),[i,a]=(0,L.useState)(new Set),[o,s]=(0,L.useState)({}),c=(0,L.useRef)(new Set),l=(0,L.useRef)(!0),u=(0,L.useRef)(void 0);(0,L.useEffect)(()=>(l.current=!0,()=>{l.current=!1}),[]);let d=t?.api,f=t?.runId,p=t?.group,m=t?.revision;u.current=m;let h=e.map(e=>e.path).join(`\0`);if((0,L.useEffect)(()=>{if(!d||f===void 0||p===void 0||m===void 0)return;let e=new Set(h.split(`\0`));for(let t of i){if(!e.has(t))continue;let n=`${m}\u0000${t}`;if(c.current.has(n))continue;c.current.add(n);let r=e=>{l.current&&u.current===m&&s(n=>({...n,[t]:e}))};d.fileDiff(f,p,t).then(e=>r({state:`ready`,diff:e}),e=>{c.current.delete(n),r({state:`error`,message:e.message})})}},[i,d,f,p,m,h]),!t)return(0,U.jsx)(`ul`,{"aria-label":n(`runs.files.label`),className:`rounded-lg border bg-card p-1`,children:r.map(e=>(0,U.jsx)(vm,{node:e,expansion:null},e.path))});let g={open:i,results:Object.fromEntries([...i].map(e=>[e,o[e]??{state:`loading`}])),previous:new Map(e.flatMap(e=>e.previousPath?[[e.path,e.previousPath]]:[])),toggle:e=>a(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})};return(0,U.jsx)(`ul`,{"aria-label":n(`runs.files.label`),className:`rounded-lg border bg-card p-1`,children:r.map(e=>(0,U.jsx)(vm,{node:e,expansion:g},e.path))})}function bm(e){return typeof e==`object`&&!!e}function xm(e){return bm(e)&&Object.keys(e).length>0}function Sm(e){let t=e.trim();if(t.startsWith(`{`)||t.startsWith(`[`))try{let e=JSON.parse(t);return bm(e)?e:void 0}catch{return}}function Cm(e){return typeof e==`string`?e:Array.isArray(e)?`[]`:bm(e)?`{}`:JSON.stringify(e)??String(e)}function wm(e){return e.map(e=>` ${e}`)}function Tm(e){if(Array.isArray(e))return e.length===0?[`[]`]:e.flatMap(e=>{if(xm(e)){let[t=``,...n]=Tm(e);return[`- ${t}`,...wm(n)]}let t=Cm(e);return t.includes(`
|
|
9
|
+
`)?[`-`,...wm(t.split(`
|
|
10
|
+
`))]:[`- ${t}`]});if(bm(e)){let t=Object.entries(e);return t.length===0?[`{}`]:t.flatMap(([e,t])=>{if(xm(t))return[`${e}:`,...wm(Tm(t))];let n=Cm(t);return n.includes(`
|
|
11
|
+
`)?[`${e}:`,...wm(n.split(`
|
|
12
|
+
`))]:[`${e}: ${n}`]})}return Cm(e).split(`
|
|
13
|
+
`)}function Em(e){return Tm(e).join(`
|
|
14
|
+
`)}function Dm(e){return Array.isArray(e)?e.length===0?`[]`:`[${e.length}]`:bm(e)?Object.keys(e).length===0?`{}`:`{…}`:Cm(e).replace(/\s*\n\s*/g,` `)}function Om(e,t=120){let n=(Array.isArray(e)?e.map(Dm):bm(e)?Object.entries(e).map(([e,t])=>`${e}: ${Dm(t)}`):[Dm(e)]).join(` · `);return n.length>t?`${n.slice(0,t-1)}…`:n}function km(e,t){let n=Sm(t);if(n===void 0)return!1;let r=JSON.stringify(n);return e===r||r.length>120&&e===`${r.slice(0,119)}…`}function Am(e){let t=[],n=new Map,r,i=[],a=()=>{if(i.length===1)t.push({kind:`entry`,entry:i[0]});else if(i.length>1){let e=i[0];t.push({kind:`entry`,entry:{...e,text:i.map(e=>e.text).join(``)}})}i=[],r=void 0};for(let o of e)if(o.kind===`text`&&o.streamId)r!==o.streamId&&a(),r=o.streamId,i.push(o);else if(a(),o.kind===`tool_call`){let e={kind:`call`,call:o,results:[]};o.id&&n.set(o.id,e),t.push(e)}else o.kind===`tool_result`&&o.id&&n.has(o.id)?n.get(o.id)?.results.push(o):t.push({kind:`entry`,entry:o});return a(),t}function jm({at:e}){let{i18n:t}=_();return e==null?null:(0,U.jsx)(`time`,{dateTime:new Date(e).toISOString(),title:Ul(e,t.language),className:`shrink-0 text-xs text-muted-foreground tabular-nums`,children:Hl(e)})}function Mm(e){let t=e.split(`
|
|
15
|
+
`).find(e=>e.trim()!==``)??``;return t.length>140?`${t.slice(0,139)}…`:t}function Nm({failed:e=!1,head:t,at:n,children:r}){return(0,U.jsxs)(Xu,{className:k(`rounded-md border text-sm`,e&&`border-status-err/30 bg-status-err-bg`),children:[(0,U.jsxs)(Zu,{className:`group flex w-full items-center gap-2 px-2 py-1 text-left`,children:[(0,U.jsx)(ka,{className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),t,(0,U.jsx)(`span`,{className:`ml-auto`}),(0,U.jsx)(jm,{at:n})]}),(0,U.jsx)(Qu,{children:(0,U.jsx)(`pre`,{className:`max-h-96 overflow-auto px-3 pb-2 font-mono text-xs whitespace-pre-wrap`,children:r})})]})}function Pm({result:e,showJson:t}){let{t:n}=_(),r=t?void 0:Sm(e.text),i=r===void 0?e.text:Em(r);return e.error?(0,U.jsx)(Nm,{failed:!0,head:(0,U.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,U.jsx)(`span`,{className:`font-medium text-status-err`,children:n(`runs.transcript.error`)}),` `,Mm(i)]}),at:e.at,children:i}):(0,U.jsx)(Nm,{head:(0,U.jsxs)(`span`,{className:`truncate`,children:[n(`runs.transcript.result`),` · `,Mm(i)||n(`runs.transcript.emptyResult`)]}),at:e.at,children:i})}function Fm({call:e,results:t,showJson:n}){let r=n?void 0:Sm(e.input),i=r!==void 0&&km(e.summary,e.input)?Om(r):e.summary;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(Nm,{head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,U.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:i})]}),at:e.at,children:r===void 0?e.input:Em(r)}),t.map((e,t)=>(0,U.jsx)(`div`,{className:`ml-4`,children:(0,U.jsx)(Pm,{result:e,showJson:n})},t))]})}function Im({entry:e,showJson:t}){let{t:n}=_();switch(e.kind){case`text`:return(0,U.jsxs)(`section`,{"aria-label":n(`runs.transcript.textLabel`),className:`rounded-lg border bg-card p-3`,children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2 text-xs font-medium text-muted-foreground uppercase`,children:[(0,U.jsx)(`span`,{children:n(`runs.transcript.specialist`)}),(0,U.jsx)(jm,{at:e.at})]}),(0,U.jsx)(Bp,{text:e.text})]});case`tool_call`:return(0,U.jsx)(Fm,{call:e,results:[],showJson:t});case`tool_result`:return(0,U.jsx)(Pm,{result:e,showJson:t});case`result`:return(0,U.jsxs)(`div`,{className:k(`flex items-center gap-2 text-xs text-muted-foreground`,e.error&&`text-status-err`),children:[e.verdict?(0,U.jsx)($,{status:e.verdict===`done`?`done`:`needs_human`}):null,(0,U.jsxs)(`span`,{children:[n(`runs.transcript.usage`,{input:Tl(e.inputTokens),output:Tl(e.outputTokens)}),` `,wl(e)]}),(0,U.jsx)(jm,{at:e.at})]});case`raw`:return!t&&Sm(e.text)!==void 0?null:(0,U.jsx)(`pre`,{className:`font-mono text-xs whitespace-pre-wrap`,children:e.text})}}function Lm({entries:e,onlyText:t=!1,showJson:n=!0}){let{t:r}=_();if(e.length===0)return(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`runs.transcript.empty`)});let i=Am(e),a=t?i.filter(e=>e.kind===`entry`&&e.entry.kind===`text`):i;return a.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`runs.transcript.noReplies`)}):(0,U.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map((e,t)=>e.kind===`call`?(0,U.jsx)(Fm,{call:e.call,results:e.results,showJson:n},t):(0,U.jsx)(Im,{entry:e.entry,showJson:n},t))})}function Rm(e){let{t}=_();return(0,U.jsxs)(U.Fragment,{children:[e.attempt.interrupting?(0,U.jsx)(`span`,{className:`text-xs text-status-warn`,children:t(`runs.attempt.interrupting`)}):null,e.onMessage?(0,U.jsxs)(o,{variant:`outline`,size:`sm`,onClick:e.onMessage,children:[(0,U.jsx)(Ao,{}),t(`runs.message.button`)]}):null,e.onRetry?(0,U.jsxs)(o,{variant:`outline`,size:`sm`,onClick:e.onRetry,children:[(0,U.jsx)(Xo,{}),t(`runs.attempt.retryStep`)]}):null]})}function zm({attempt:e,verdict:t}){let{t:n}=_(),r=e.denials??[],i=e.outsideChanges??[];return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ka,{className:`size-4 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),(0,U.jsxs)(`span`,{className:`font-medium`,children:[`#`,e.seq,` `,e.stepName??e.stepId,e.round>1?` · ${n(`runs.attempt.round`,{round:e.round})}`:``]}),(0,U.jsx)(`span`,{className:`truncate text-muted-foreground`,title:`${e.specialist} · ${e.runtime} ${e.model??``}`.trim(),children:e.model??e.runtime}),(0,U.jsx)($,{status:t}),(0,U.jsxs)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:[Cl(e.durationMs),` · `,Tl(e.usage?.inputTokens),`/`,Tl(e.usage?.outputTokens),` · `,wl(e.usage)||`—`]}),r.length>0?(0,U.jsx)(`span`,{className:`text-xs text-status-warn`,title:n(`runs.attempt.denialsTitle`),children:n(`runs.attempt.denials`,{n:r.length})}):null,i.length>0?(0,U.jsx)(`span`,{className:`text-xs text-status-warn`,title:n(`runs.attempt.outsideTitle`),children:n(`runs.attempt.outside`,{n:i.length})}):null]})}function Bm({denials:e}){let{t}=_();return e.length===0?null:(0,U.jsx)(`section`,{"aria-label":t(`runs.attempt.denialsLabel`),children:(0,U.jsxs)(j,{variant:`warn`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-xs font-medium uppercase`,children:t(`runs.attempt.denialsHeading`)}),(0,U.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,n)=>(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:e.command===null?e.tool:`${e.tool} ${e.command}`}),e.suggestions.map((e,n)=>(0,U.jsx)(`div`,{className:`text-xs`,children:e.pattern===null?(0,U.jsx)(`span`,{children:t(`runs.attempt.noPattern`)}):(0,U.jsxs)(U.Fragment,{children:[t(`runs.attempt.pattern`),` `,(0,U.jsx)(`code`,{children:e.pattern})]})},n))]},n))})]})})}function Vm({attempt:e,rawLog:t,transcript:n,onlyReplies:r,showJson:i,raw:a,onRaw:o}){let{t:s,i18n:c}=_(),l=e.denials??[];return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 border-t p-3`,children:[e.reason?(0,U.jsx)(j,{variant:`destructive`,children:e.reason}):null,(0,U.jsx)(Bm,{denials:l}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,U.jsx)(`time`,{dateTime:new Date(e.startedAt).toISOString(),title:Ul(e.startedAt,c.language),className:`tabular-nums`,children:s(`runs.attempt.started`,{time:Hl(e.startedAt)})})}),(0,U.jsx)(Hm,{attempt:e}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold`,children:s(`runs.attempt.log`)}),t?(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(_p,{id:`raw-${e.seq}`,checked:a,onCheckedChange:o}),(0,U.jsx)(dl,{htmlFor:`raw-${e.seq}`,className:`text-xs`,children:s(`runs.attempt.raw`)})]}):null]}),a&&t?(0,U.jsx)(`pre`,{className:`max-h-[60vh] overflow-auto rounded-md bg-muted p-2 font-mono text-xs`,children:t.join(`
|
|
16
|
+
`)}):n?(0,U.jsx)(Lm,{entries:n.entries,onlyText:r,showJson:i}):(0,U.jsx)(M,{role:`status`,"aria-label":s(`runs.attempt.loadingLog`),className:`h-16`}),(0,U.jsx)(Um,{attempt:e})]})}function Hm({attempt:e}){let{t}=_();return(0,U.jsx)(U.Fragment,{children:e.message?(0,U.jsxs)(`section`,{"aria-label":t(`runs.attempt.humanMessage`),className:`rounded-lg border border-status-warn/30 bg-status-warn-bg p-3`,children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2 text-xs font-medium text-status-warn uppercase`,children:[(0,U.jsx)(`span`,{children:t(`runs.attempt.humanMessage`)}),(0,U.jsx)(jm,{at:e.message.at})]}),(0,U.jsx)(Bp,{text:e.message.text})]}):null})}function Um({attempt:e}){let{t}=_();return(0,U.jsxs)(U.Fragment,{children:[e.summary?(0,U.jsxs)(`section`,{"aria-label":t(`runs.attempt.summaryLabel`),className:`rounded-lg border p-3`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground uppercase`,children:t(`runs.attempt.summary`)}),(0,U.jsx)(Bp,{text:e.summary})]}):null,e.feedback||e.decision?(0,U.jsxs)(`section`,{"aria-label":t(`runs.attempt.feedbackLabel`),className:`rounded-lg border border-status-warn/30 bg-status-warn-bg p-3`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-xs font-medium text-status-warn uppercase`,children:t(`runs.attempt.feedback`)}),e.feedback?(0,U.jsx)(Bp,{text:e.feedback}):null,e.decision?(0,U.jsxs)(`p`,{className:`mt-2 text-sm`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:t(`runs.attempt.answer`,{by:t(`runs.decisions.${ft(e.decision.by)}`)})}),` `,e.decision.answer]}):null]}):null]})}var Wm=1500;function Gm(e,t,n,r,i){let[a,o]=(0,L.useState)(null),s=(0,L.useRef)(null);return(0,L.useEffect)(()=>{if(!i)return;let a=!1,c=null,l=async()=>{let i=s.current;try{let u=await e.transcript(t,n,r,i?.cursor??0);if(a)return;let d={cursor:u.cursor,running:u.running,entries:[...i?.entries??[],...u.entries]};s.current=d,o(d),u.running&&(c=setTimeout(()=>void l(),Wm))}catch{a||(c=setTimeout(()=>void l(),Wm*2))}};return(!s.current||s.current.running)&&l(),()=>{a=!0,c&&clearTimeout(c)}},[e,t,n,r,i]),a}var Km={run:`bg-status-run`,warn:`bg-status-warn`,err:`bg-status-err`,ok:`bg-status-ok`,mute:`bg-status-mute`};function qm({api:e,runId:t,group:n,attempt:r,initiallyOpen:i,rawLog:a,onlyReplies:o=!1,showJson:s=!1,onRetry:c,onMessage:l}){let{t:u}=_(),[d,f]=(0,L.useState)(i),[p,m]=(0,L.useState)(!1),h=Gm(e,t,n,r.seq,d),g=r.verdict??r.status;return(0,U.jsxs)(`li`,{className:`relative pl-6`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:k(`absolute top-3.5 left-0 size-3 -translate-x-1/2 rounded-full ring-4 ring-background`,Km[ql(g)])}),(0,U.jsxs)(Xu,{open:d,onOpenChange:f,className:`rounded-lg border bg-card`,children:[(0,U.jsxs)(`div`,{className:`sticky top-[var(--group-header-height,0px)] z-[5] flex items-center gap-2 rounded-t-lg bg-card pr-2`,children:[(0,U.jsx)(Zu,{"aria-label":u(`runs.attempt.label`,{seq:r.seq,step:r.stepName??r.stepId}),className:`group flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2 text-left text-sm`,children:(0,U.jsx)(zm,{attempt:r,verdict:g})}),(0,U.jsx)(Rm,{attempt:r,onMessage:l,onRetry:c})]}),(0,U.jsx)(Qu,{children:d?(0,U.jsx)(Vm,{attempt:r,rawLog:a,transcript:h,onlyReplies:o,showJson:s,raw:p,onRaw:m}):null})]})]})}function Jm({api:e,runId:t,group:n,attempts:r,openSeq:i,lastSeq:a,rawLog:o,onlyReplies:s,showJson:c,retryable:l,onRetry:u,onMessage:d}){let{t:f}=_();return r.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f(`runs.attempt.none`)}):(0,U.jsx)(`ol`,{"aria-label":f(`runs.attempt.list`),className:`ml-1.5 flex flex-col gap-2 border-l pb-1`,children:r.map(r=>(0,U.jsx)(qm,{api:e,runId:t,group:n,attempt:r,initiallyOpen:r.seq===i,rawLog:r.seq===a?o:null,onlyReplies:s,showJson:c,...r.seq===a&&l?{onRetry:u}:{},...r.seq===a&&d&&r.status===`running`&&r.verdict===null&&!r.interrupting?{onMessage:d}:{}},r.seq))})}function Ym({ctx:e}){let{t}=_(),{row:n,view:r,caps:i}=e,{spec:a,progress:o}=e.tabs;return(0,U.jsxs)(ed,{"aria-label":t(`runs.group.tabs`),children:[(0,U.jsx)(td,{value:`log`,children:t(`runs.group.log`)}),i.changes?(0,U.jsxs)(td,{value:`changes`,children:[t(`runs.group.changes`),r?.diff?` · ${r.diff.files.length}`:``]}):null,(0,U.jsx)(td,{value:`task`,children:t(`runs.group.task`)}),a?.design==null?null:(0,U.jsx)(td,{value:`design`,children:t(`runs.group.design`)}),a?.tasks==null?null:(0,U.jsxs)(td,{value:`tasks`,children:[t(`runs.group.tasks`),o?` · ${o.done}/${o.total}`:``]}),(0,U.jsxs)(td,{value:`artifacts`,disabled:n.artifacts===0,title:n.artifacts===0?t(`runs.group.artifactsEmpty`):void 0,children:[t(`runs.group.artifacts`),n.artifacts>0?` · ${n.artifacts}`:``]})]})}function Xm({ctx:e}){let{t}=_(),{api:n,runId:r,row:i,view:a,caps:o}=e;if(!a)return null;let s=a.attempts.at(-1)?.seq??null,c=(e.openStep?a.attempts.findLast(t=>t.stepId===e.openStep)?.seq:null)??s;return(0,U.jsx)(nd,{value:`log`,className:`flex flex-col gap-3`,children:(0,U.jsx)(Jm,{api:n,runId:r,group:i.slug,attempts:a.attempts,openSeq:c,lastSeq:s,rawLog:a.log?a.log.lines:null,onlyReplies:e.onlyReplies,showJson:!1,onMessage:()=>e.setMessaging(s),retryable:o.retry&&(i.status===`failed`||i.status===`cancelled`),onRetry:()=>void e.act(()=>n.retry(r,i.slug),()=>F(t(`runs.header.retryStarted`)))})})}function Zm({ctx:e}){let{t}=_(),{api:n,runId:r,row:i,view:a}=e;return a?(0,U.jsx)(nd,{value:`changes`,children:a.diff&&a.diff.files.length>0?(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:(0,U.jsx)(om,{diff:{files:a.diff.files.length,added:a.diff.added,removed:a.diff.removed}})}),(0,U.jsx)(ym,{files:a.diff.files,diff:{api:n,runId:r,group:i.slug,revision:a.diff.revision}})]}):(0,U.jsx)(Pe,{title:t(`runs.group.noChanges`),children:t(`runs.group.noChangesText`)})}):null}function Qm({value:e,label:t,change:n,text:r}){let{t:i}=_();return(0,U.jsx)(nd,{value:e,children:(0,U.jsxs)(`section`,{"aria-label":t,className:`rounded-md border bg-card p-4 text-card-foreground`,children:[n===void 0?null:(0,U.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:i(`runs.group.specChange`,{name:n})}),(0,U.jsx)(Bp,{text:r})]})})}function $m({ctx:e}){let{t}=_(),{api:n,runId:r,row:i,view:a,caps:o}=e,{spec:s}=e.tabs;return a===null?(0,U.jsxs)(`div`,{role:`status`,"aria-label":t(`runs.group.loading`),className:`flex flex-col gap-2`,children:[(0,U.jsx)(M,{className:`h-8 w-64`}),(0,U.jsx)(M,{className:`h-24`})]}):(0,U.jsxs)($u,{value:e.tabs.tab,onValueChange:e.tabs.setTab,children:[(0,U.jsx)(Ym,{ctx:e}),(0,U.jsx)(Xm,{ctx:e}),o.changes?(0,U.jsx)(Zm,{ctx:e}):null,(0,U.jsx)(Qm,{value:`task`,label:t(`runs.group.task`),text:a.task}),s?.design==null?null:(0,U.jsx)(Qm,{value:`design`,label:t(`runs.group.design`),change:s.change,text:s.design}),s?.tasks==null?null:(0,U.jsx)(Qm,{value:`tasks`,label:t(`runs.group.tasks`),change:s.change,text:s.tasks}),i.artifacts>0?(0,U.jsx)(nd,{value:`artifacts`,children:(0,U.jsx)(am,{api:n,runId:r,group:i.slug,count:i.artifacts,revision:i.artifactsRevision,onError:e.onError})}):null]})}function eh(e){for(let t=e.parentElement;t;t=t.parentElement){let e=getComputedStyle(t).overflowY;if(e===`auto`||e===`scroll`)return t}return null}function th(e,t,n=null){let r=(0,L.useRef)(t);r.current=t,(0,L.useEffect)(()=>{if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e[e.length-1]?.isIntersecting&&r.current()},{root:eh(e),rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},[e,n])}function nh(e){return e?eh(e)??document.scrollingElement??document.documentElement:null}function rh(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}function ih(e){let[t,n]=(0,L.useState)(!1),r=(0,L.useRef)(e);r.current=e;let i=(0,L.useCallback)(()=>{let e=nh(r.current);e?.scrollTo({top:e.scrollHeight,behavior:rh()})},[]),a=(0,L.useCallback)(()=>{n(!0),i()},[i]),o=(0,L.useCallback)(()=>n(!1),[]);return(0,L.useEffect)(()=>{if(!t||!e)return;let r=nh(e);if(!r)return;let a=r===document.scrollingElement||r===document.documentElement?window:r,o=r.scrollTop,s=()=>n(!1),c=e=>{e.deltaY<0&&s()},l=e=>{let t=e;(t.key===`ArrowUp`||t.key===`PageUp`||t.key===`Home`||t.key===` `&&t.shiftKey)&&s()},u=null,d=[[`wheel`,c],[`keydown`,l],[`touchstart`,e=>{u=e.touches[0]?.clientY??null}],[`touchmove`,e=>{let t=e.touches[0]?.clientY;t!==void 0&&u!==null&&t>u&&s(),t!==void 0&&(u=t)}],[`scroll`,()=>{let e=r.scrollTop;e<o-1&&s(),o=e}]];for(let[e,t]of d)a.addEventListener(e,t,{passive:!0});let f=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>i());return f?.observe(e),()=>{for(let[e,t]of d)a.removeEventListener(e,t);f?.disconnect()}},[t,e,i]),{following:t,follow:a,stop:o}}function ah(e,t,n){let r=`kind`in e,i=r&&e.kind!==`split`&&e.kind!==`action`&&!dt(e),a=r&&dt(e),o=e.status===`failed`||e.status===`cancelled`;return{retry:!i&&!a&&[`failed`,`cancelled`,`conflict`].includes(e.status),retryDelivery:i&&o&&(t||n),cancel:![`merged`,`done`,`failed`,`cancelled`].includes(e.status),changes:!r}}function oh(e,t){return e.topology.steps.find(e=>e.groups.some(e=>e.slug===t))?.id??null}function sh(e,t){return e.topology.steps.find(e=>e.id===t)?.groups.some(e=>e.status===`running`||e.status===`needs_human`)??!1}function ch(e,t,n){let{t:r}=_(),i=Ne(),[a,o]=(0,L.useState)(null);return{pending:a,toggle:async(a,s,c={})=>{if(!e)return;let l=sh(e,a);if(s&&(l||c.allGroups)){let t=[l?r(`runs.steps.confirmDescription`):null,c.allGroups?r(`runs.steps.confirmAllGroups`):null].filter(Boolean).join(` `);if(!await i({title:r(`runs.steps.confirmTitle`,{step:e.steps.find(e=>e.id===a)?.name??a}),description:t,confirmLabel:r(`runs.steps.confirmLabel`),cancelLabel:r(`runs.steps.keep`),destructive:!0}))return}o(a);try{await t.skipStep(e.id,a,s),F(r(s?`runs.steps.doneSkip`:`runs.steps.doneUnskip`))}catch(e){n(e.message)}finally{o(null)}}}}function lh(e){let t=0,n=0;for(let r of e.split(`
|
|
17
|
+
`)){let e=/^\s*[-*+]\s+\[( |x|X)\]\s/.exec(r);e&&(n+=1,e[1]!==` `&&(t+=1))}return n===0?null:{done:t,total:n}}var uh=5e3,dh=(e,t)=>e===t||e!==null&&t!==null&&e.change===t.change&&e.path===t.path&&e.design===t.design&&e.tasks===t.tasks;function fh(e,t,n,r,i,a,o=!0){let[s,c]=(0,L.useState)(void 0);return(0,L.useEffect)(()=>{if(!o)return;let r=!1,s=i=>e.groupSpec(t,n).then(e=>{r||c(t=>t!==void 0&&dh(t,e)?t:e)},e=>{r||i||(c(e=>e===void 0?null:e),a(e.message))});s(!1);let l=i?setInterval(()=>void s(!0),uh):null;return()=>{r=!0,l!==null&&clearInterval(l)}},[e,t,n,r,i,o,a]),s}function ph(e,t,n,r,i){let[a,o]=(0,L.useState)(null);return(0,L.useEffect)(()=>{let r=!1;return e.group(t,n).then(e=>!r&&o(e),e=>!r&&i(e.message)),()=>{r=!0}},[e,t,n,r,i]),a}function mh(e){let[t,n]=(0,L.useState)(!1);return{busy:t,act:async(t,r)=>{n(!0);try{await t(),r?.()}catch(t){e(t.message)}finally{n(!1)}}}}function hh(e){let[t,n]=(0,L.useState)(e);return(0,L.useEffect)(()=>{if(e){n(!0);return}let t=setTimeout(()=>n(!1),250);return()=>clearTimeout(t)},[e]),t}function gh(e){let{api:t,runId:n,row:r,version:i,view:a,caps:o,addressTab:s,onAddressTab:c,onError:l}=e,[u,d]=(0,L.useState)(null),f=c?s:u,p=c??d,m=![`merged`,`done`,`failed`,`cancelled`].includes(r.status),h=`kind`in r,g=fh(t,n,r.slug,i,m&&(f===`design`||f===`tasks`),l,!h),_=new Set([`log`,`task`]);o.changes&&_.add(`changes`),g?.design!=null&&_.add(`design`),g?.tasks!=null&&_.add(`tasks`),r.artifacts>0&&_.add(`artifacts`);let v=a!==null&&(h||g!==void 0),y=_.has(f??`log`)?f??`log`:`log`;return(0,L.useEffect)(()=>{v&&f!==null&&!_.has(f)&&p(`log`)}),{tab:y,setTab:e=>p(e),spec:g,progress:g?.tasks==null?null:lh(g.tasks)}}function _h(e,t,n,r){let i=ch(e,t,r),a=e&&!(`kind`in n)?oh(e,n.slug):null,o=a?e?.steps?.find(e=>e.id===a):void 0;return{skipper:i,skippable:a,canSkip:!!e&&!!o&&o.state!==`done`&&!o.skipped}}function vh(e){let{api:t,runId:n,row:r,run:i,title:a,act:o}=e,{t:s}=_(),c=Ne();return{cancelGroup:async()=>{await c({title:s(`runs.group.cancelTitle`,{title:a}),description:s(`runs.group.cancelDescription`),confirmLabel:s(`runs.group.cancelGroup`),cancelLabel:s(`runs.header.keep`),destructive:!0})&&await o(()=>t.cancel(n,r.slug),()=>F(s(`runs.group.cancelled`)))},markDelivered:async()=>{i&&await c({title:s(`runs.system.markDeliveredTitle`,{title:a}),description:s(`runs.header.markDeliveredConfirm`),confirmLabel:s(`runs.header.markDeliveredAction`),cancelLabel:s(`runs.header.markDeliveredKeep`)})&&await o(()=>t.markDelivered(i.id,[r.slug]),()=>F(s(`runs.header.markedDelivered`)))}}}function yh(e,t=null){let{api:n,runId:r,row:i,run:a,onError:o}=e,{showUsage:s=!1,deliverable:c=!1}=e,{t:l}=_(),u=`${i.status}/${i.step}/${i.round}/${i.diff?.added??``}/${i.diffRevision??``}/${i.delivery}/${i.usage?.inputTokens??``}/${i.usage?.outputTokens??``}/${a?.delivery.inProgress??``}/${a?.delivery.finishedAt??``}/${i.artifacts}/${i.artifactsRevision}`,d=a?.delivery.inProgress??!1,f=ah(i,c,d),p=ph(n,r,i.slug,u,o),{busy:m,act:h}=mh(o),g=gh({api:n,runId:r,row:i,version:u,view:p,caps:f,addressTab:e.tab??null,onAddressTab:e.onTab,onError:o}),v=`kind`in i&&i.kind!==`action`?l(`runs.system.${i.kind}`):i.title,y=vh({api:n,runId:r,row:i,run:a,title:v,act:h}),b=ih(t),x=b.stop;(0,L.useEffect)(()=>{g.tab!==`log`&&x()},[g.tab,x]);let[S,C]=(0,L.useState)(!1),[w,T]=(0,L.useState)(null);return{...e,showUsage:s,deliverable:c,onlyReplies:e.onlyReplies??!1,view:p,busy:m,act:h,caps:f,delivering:d,title:v,tabs:g,watch:b,...y,skip:_h(a,n,i,o),statusesMounted:hh(s),forcing:S,setForcing:C,messaging:w,setMessaging:T}}function bh(e){let{t}=_(),[n,r]=(0,L.useState)(null),i=yh(e,n),[a,o]=(0,L.useState)(null),s=lp(a);return(0,U.jsxs)(`section`,{ref:r,"aria-label":t(`runs.group.label`,{title:i.title}),className:`flex flex-col gap-3 p-4`,style:{"--group-header-height":`${s}px`},children:[(0,U.jsx)(Lp,{ctx:i,onHeight:o}),(0,U.jsx)(fp,{ctx:i}),(0,U.jsx)(gp,{ctx:i}),(0,U.jsx)(Xp,{ctx:i}),(0,U.jsx)($m,{ctx:i})]})}var xh=`__create`;function Sh({tags:e,hideLinked:t,disabled:n,onRemove:r}){let{t:i}=_();return e.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,U.jsx)(ep,{tag:e}),t&&e.task?null:(0,U.jsx)(`button`,{type:`button`,"aria-label":i(`tags.remove`,{name:e.name}),disabled:n,className:`rounded-full p-0.5 hover:bg-accent disabled:opacity-50`,onClick:()=>r(e.id),children:(0,U.jsx)(bs,{className:`size-3`})})]},e.id))}function Ch({listId:e,visible:t,hasTags:n,selected:r,createName:i,onToggle:a,onCreate:o}){let{t:s}=_();return(0,U.jsxs)(Xc,{id:e,children:[t.length===0&&i===null?(0,U.jsx)(Zc,{children:s(n?`picker.nothing`:`tags.none`)}):null,t.length>0?(0,U.jsx)(Z,{children:t.map(e=>(0,U.jsxs)(Q,{value:`tag:${e.id}`,onSelect:()=>a(e.id),children:[(0,U.jsx)(Ta,{className:r.includes(e.id)?`opacity-100`:`opacity-0`}),(0,U.jsx)(ep,{tag:e})]},e.id))}):null,i===null?null:(0,U.jsx)(Z,{children:(0,U.jsxs)(Q,{value:`${xh}:${i}`,onSelect:o,children:[(0,U.jsx)(Ko,{}),s(`tags.create`,{name:i})]})})]})}function wh(e,t,n){let r=n.toLowerCase();return t!==null&&n!==``&&!e.some(e=>e.name.toLowerCase()===r)}function Th({api:e,repository:t,name:n,selected:r,onChange:i,onDone:a}){let o=Md(),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(null);return{error:l,setError:u,create:async()=>{if(e&&t!==null&&!s){c(!0),u(null);try{let s=await e.forRepository(t).addTag(n);o.update(t,s);let c=s.find(e=>e.name.toLowerCase()===n.toLowerCase());c&&!r.includes(c.id)&&i([...r,c.id],s),a()}catch(e){u(e.message)}finally{c(!1)}}}}}function Eh({id:e,label:t,open:n,listId:r,disabled:i}){let{t:a}=_();return(0,U.jsx)($c,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,id:e,role:`combobox`,"aria-label":t,"aria-expanded":n,"aria-haspopup":`listbox`,"aria-controls":n?r:void 0,disabled:i,className:`inline-flex h-6 items-center gap-1 rounded-full px-2 text-xs text-muted-foreground hover:bg-accent disabled:opacity-50`,children:[(0,U.jsx)(Ko,{className:`size-3`}),a(`picker.add`)]})})}function Dh(e){let{id:t,label:n,selected:r,onChange:i,repository:a,api:o}=e,{allowCreate:s=!1,disabled:c=!1,chips:l=!0,hideLinked:u=!1}=e,{t:d}=_(),f=Md(),p=f.of(a),m=(0,L.useId)(),[h,g]=(0,L.useState)(!1),[v,y]=(0,L.useState)(``),b=v.trim(),x=b.toLowerCase(),S=p.filter(e=>!(u&&e.task)),C=S.filter(e=>x===``||e.name.toLowerCase().includes(x)),w=s&&o!==void 0&&wh(p,a,b),{error:T,setError:E,create:ee}=Th({api:o,repository:a,name:b,selected:r,onChange:i,onDone:()=>y(``)}),D=e=>{E(null),i(r.includes(e)?r.filter(t=>t!==e):[...r,e]),y(``)},te=r.flatMap(e=>f.byId.get(e)??[]);return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(Qc,{open:h,onOpenChange:e=>{g(e),e||y(``)},children:[(0,U.jsxs)(`div`,{className:`flex min-h-9.5 w-fit max-w-full flex-wrap items-center gap-1.5 rounded-md border border-input bg-card p-1.5`,children:[l?(0,U.jsx)(Sh,{tags:te,hideLinked:u,disabled:c,onRemove:D}):null,(0,U.jsx)(Eh,{id:t,label:n,open:h,listId:m,disabled:c})]}),(0,U.jsx)(el,{className:`p-0`,children:(0,U.jsxs)(qc,{shouldFilter:!1,label:d(`picker.search`,{label:n}),children:[(0,U.jsx)(Yc,{value:v,onValueChange:y,placeholder:d(s?`tags.searchOrCreate`:`picker.searchOnly`)}),(0,U.jsx)(Ch,{listId:m,visible:C,hasTags:S.length>0,selected:r,createName:w?b:null,onToggle:D,onCreate:()=>void ee()})]})})]}),T?(0,U.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:T}):null]})}var Oh=60;function kh(e,t){let[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(null),o=(0,L.useRef)(!1),s=(0,L.useRef)(!1),c=(0,L.useRef)(``),l=(0,L.useRef)(null),u=(0,L.useRef)(null),d=(0,L.useRef)(!1),f=kl(e);(0,L.useEffect)(()=>{n===null&&d.current&&(d.current=!1,u.current?.querySelector(`button`)?.focus())},[n]);let p=()=>{s.current=!0,c.current=f,l.current=null,r(f)},m=e=>{s.current=!1,o.current=!1,l.current=null,d.current=e,r(null),a(null)};return{draft:n,setDraft:r,error:i,text:c,heading:u,current:f,open:p,close:m,save:async(n=!1)=>{if(!s.current||o.current)return;let r=c.current.trim();if(!(n&&r===l.current)){if(r===``||r===f)m(!n);else{o.current=!0,a(null);try{await t.setRunTitle(e.id,r),m(!n)}catch(e){o.current=!1,l.current=r,a(e.message)}}}}}}function Ah({run:e,api:t}){let{t:n}=_(),{draft:r,setDraft:i,error:a,text:s,heading:c,current:l,open:u,close:d,save:f}=kh(e,t);return r===null?(0,U.jsxs)(`h1`,{ref:c,className:`group flex min-w-0 flex-1 items-start gap-1 text-lg font-semibold break-words [overflow-wrap:anywhere]`,children:[(0,U.jsxs)(`span`,{className:`min-w-0`,children:[(0,U.jsx)(`span`,{className:`font-mono text-base font-normal text-muted-foreground`,children:Sl(e.number)}),` `,(0,U.jsx)(`span`,{title:`${l}\n${e.id}`,children:l})]}),(0,U.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,"aria-label":n(`runs.header.editTitle`),title:n(`runs.header.editTitle`),onClick:u,children:(0,U.jsx)(Wo,{})})]}):(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`font-mono text-base text-muted-foreground`,children:Sl(e.number)}),(0,U.jsx)(Gs,{autoFocus:!0,value:r,maxLength:Oh,"aria-label":n(`runs.header.titleLabel`),"aria-invalid":a!==null,onFocus:e=>e.currentTarget.select(),onChange:e=>{s.current=e.target.value,i(e.target.value)},onBlur:()=>void f(!0),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),d(!0))}})]}),a?(0,U.jsx)(j,{variant:`destructive`,children:a}):null]})}function jh({className:e,...t}){return(0,U.jsx)(Zt,{className:k(`peer size-4 shrink-0 rounded-[4px] border border-input bg-card data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground disabled:opacity-50`,e),...t,children:(0,U.jsx)($t,{className:`flex items-center justify-center`,children:(0,U.jsx)(Ta,{className:`size-3`})})})}function Mh({run:e,api:t,onError:n}){let{t:r}=_(),{pending:i,toggle:a}=ch(e,t,n),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(!1),d=async(e,t)=>{u(!0);try{await a(e,t)}finally{u(!1)}};if(e.finished||!e.steps||e.steps.length===0)return null;let f=e.steps.filter(e=>!e.skipped),p=f.length===1?f[0]:void 0;return(0,U.jsxs)(Qc,{open:s,onOpenChange:e=>c(e||l||i!==null),children:[(0,U.jsx)($c,{asChild:!0,children:(0,U.jsxs)(o,{variant:`outline`,children:[r(`runs.steps.button`,{active:f.length,total:e.steps.length}),(0,U.jsx)(Da,{})]})}),(0,U.jsx)(el,{className:`w-auto p-2`,children:(0,U.jsx)(`ul`,{"aria-label":r(`runs.steps.title`),className:`flex flex-col gap-1 text-sm`,children:e.steps.map(e=>(0,U.jsxs)(`li`,{className:`flex list-none items-center gap-2 px-1 py-0.5`,children:[(0,U.jsx)(jh,{id:`run-step-${e.id}`,checked:!e.skipped,disabled:i!==null||e.state===`done`||p?.id===e.id,"aria-label":r(`runs.steps.checkboxLabel`,{name:e.name.endsWith(` (${e.id})`)?e.name.slice(0,-` (${e.id})`.length):e.name,step:e.id}),onCheckedChange:t=>void d(e.id,t!==!0)}),(0,U.jsx)(`span`,{className:e.skipped?`line-through`:void 0,children:e.name}),e.name.endsWith(` (${e.id})`)?null:(0,U.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:e.id}),(0,U.jsx)(`span`,{className:`ml-auto pl-3 text-xs text-muted-foreground`,children:e.skipped?r(`runs.steps.skipped`):r(`runs.steps.${e.state}`)})]},e.id))})})]})}function Nh(e,t,n){let[r,i]=(0,L.useState)(!1);return{downloading:r,download:async()=>{if(t){i(!0);try{let{blob:n,fileName:r}=await t.runPatch(e.id),i=URL.createObjectURL(n),a=document.createElement(`a`);a.href=i,a.download=r,document.body.append(a),a.click(),a.remove(),URL.revokeObjectURL(i)}catch(e){n?.(e.message)}finally{i(!1)}}}}}function Ph({run:e,now:t,entry:n=null,onSelect:r,api:i,onError:a}){let{t:s}=_(),{downloading:c,download:l}=Nh(e,i,a),u=El(e.usage),d=wl(e.usage),f=[{key:`status`,label:s(`runs.header.summary.status`),value:(0,U.jsx)(kp,{run:e,entry:n,onSelect:r,layout:`rows`})},{key:`changes`,label:s(`runs.header.summary.changes`),value:(0,U.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-3 gap-y-1`,children:[e.diff?(0,U.jsx)(om,{diff:e.diff}):(0,U.jsx)(`span`,{children:`—`}),(0,U.jsxs)(o,{variant:`outline`,size:`sm`,loading:c,disabled:e.delivery.merged===0||!i,onClick:()=>void l(),children:[(0,U.jsx)(qa,{"aria-hidden":!0}),s(`runs.header.summary.download`)]})]})},{key:`path`,label:s(`runs.header.summary.path`),value:(0,U.jsx)(pe,{path:e.repository,variant:`line`})},{key:`time`,label:s(`runs.header.summary.time`),value:Cl(Ml(e,t)-e.createdAt)},...u?[{key:`tokens`,label:s(`runs.header.summary.tokens`),value:u}]:[],...d?[{key:`cost`,label:s(`runs.header.summary.cost`),value:d}]:[]];return(0,U.jsx)(`aside`,{"aria-label":s(`runs.header.summary.label`),className:`shrink-0 border-l pl-4 @3xl:w-[28rem]`,children:(0,U.jsx)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-4 gap-y-1.5 text-sm`,children:f.map(e=>(0,U.jsxs)(`div`,{className:`contents`,children:[(0,U.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e.label}),(0,U.jsx)(`dd`,{className:`min-w-0 text-foreground tabular-nums`,children:e.value})]},e.key))})})}function Fh({run:e,repair:t}){let{t:n}=_();return(0,U.jsxs)(U.Fragment,{children:[e.dirtyWarning?(0,U.jsx)(j,{variant:`warn`,children:n(`runs.header.dirty`)}):null,t&&!t.allowed?(0,U.jsx)(j,{variant:`warn`,"data-testid":`observer-forbidden`,children:n(`runs.header.observerForbidden`)}):null,t?.cancelReason?(0,U.jsx)(j,{variant:`warn`,"data-testid":`observer-cancel-reason`,children:n(`runs.header.observerCancelReason`,{reason:t.cancelReason})}):null]})}function Ih({run:e,repair:t,observer:n,hold:r,delivery:i}){let{t:a}=_(),{observing:s,setObserver:c,observerError:l}=n,{continueItem:u}=r;return(0,U.jsxs)(U.Fragment,{children:[t?.active?(0,U.jsx)(o,{variant:`outline`,loading:s,onClick:()=>void c(!1),children:a(`runs.header.observerCancel`)}):null,t&&!t.allowed?(0,U.jsx)(o,{variant:`outline`,loading:s,onClick:()=>void c(!0),children:a(`runs.header.observerGiveBack`)}):null,l?(0,U.jsx)(`span`,{role:`alert`,className:`text-sm text-destructive`,children:l}):null,u===null?null:(0,U.jsx)(o,{variant:`outline`,loading:r.continuing,onClick:()=>void r.resume(u),children:a(`runs.header.continue`)}),r.pausable?(0,U.jsx)(o,{variant:`outline`,loading:r.pausing,onClick:()=>void r.pause(),children:a(`runs.header.pause`)}):null,e.returnable?(0,U.jsx)(o,{variant:`outline`,loading:r.returning,onClick:()=>void r.putBack(),children:a(`runs.header.returnRun`)}):null,i.autoCancellable?(0,U.jsx)(o,{variant:`outline`,loading:i.cancellingAuto,onClick:()=>void i.cancelAuto(),children:a(`runs.header.cancelAutoDelivery`)}):e.finished&&!i.deliverable?null:(0,U.jsx)(o,{loading:i.applying,disabled:!i.deliverable,onClick:()=>void i.apply(!1),children:a(`runs.header.deliver`)})]})}function Lh({retry:e}){let{t}=_(),{failed:n,retrying:r,hasCancelled:i}=e;return n.length===0?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(X,{disabled:r!==null,onSelect:()=>void e.retryFailed(!1),children:[(0,U.jsx)(Xo,{className:r===`plain`?`motion-safe:animate-spin`:void 0}),t(i?`runs.header.retryFailedCancelled`:`runs.header.retryFailed`),` (`,n.length,`)`]}),(0,U.jsxs)(X,{disabled:r!==null,onSelect:()=>void e.retryFailed(!0),children:[(0,U.jsx)(Jo,{className:r===`refresh`?`motion-safe:animate-spin`:void 0}),t(`runs.header.retryRefreshConfig`),` (`,n.length,`)`]}),(0,U.jsx)(Ws,{})]})}function Rh({run:e,retry:t,delivery:n,onSubtask:r}){let{t:i}=_();return(0,U.jsxs)(zs,{children:[(0,U.jsx)(Bs,{asChild:!0,children:(0,U.jsxs)(o,{variant:`outline`,"aria-label":i(`runs.header.more`),children:[(0,U.jsx)(Ya,{}),i(`runs.header.more`)]})}),(0,U.jsxs)(Hs,{align:`start`,children:[(0,U.jsx)(Lh,{retry:t}),r?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(X,{onSelect:()=>r(e),children:[(0,U.jsx)(wo,{}),i(`runs.header.subtask`)]}),(0,U.jsx)(Ws,{})]}):null,(0,U.jsx)(X,{disabled:!n.deliverable,onSelect:()=>n.setForcing(!0),children:i(`runs.header.forceDeliver`)}),(0,U.jsx)(X,{disabled:!n.deliverable,onSelect:()=>void n.markDelivered(),children:i(`runs.header.markDelivered`)}),(0,U.jsx)(X,{onSelect:()=>{navigator.clipboard?.writeText(e.id),F(i(`runs.header.copied`))},children:i(`runs.header.copyId`)})]})]})}function zh(e,t,n){let{t:r}=_(),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(null);(0,L.useEffect)(()=>d(null),[e.hold,e.queueItem]);let f=async(e,t)=>{e(!0);try{await t()}catch(e){n(e.message)}finally{e(!1)}};return{returning:i,pausing:o,continuing:c,putBack:()=>f(a,async()=>{await t.queueReturn(e.id,e.repository),F(r(`runs.header.returned`))}),pause:()=>f(s,async()=>{let n=await t.pauseRun(e.id,e.repository);d(n.item),F(r(`runs.header.paused`))}),resume:n=>f(l,async()=>{await t.forRepository(e.repository).queueRunNow(n),d(null),F(r(`runs.header.continued`))}),continueItem:(e.hold===null?null:e.queueItem)??u,pausable:!e.finished&&e.hold===null&&e.queueItem===null&&u===null}}function Bh(e,t){let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(null);return{observing:n,observerError:i,setObserver:async n=>{r(!0),a(null);try{await t.setRunObserver(e.id,e.repository,n)}catch(e){a(e.message)}finally{r(!1)}}}}function Vh(e,t){let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(null),{byId:o}=Md(),s=(e.tags??[]).map(e=>e.id);return{tagging:n,tagError:i,runTagIds:s,changeTags:async(n,i)=>{let c=i?new Map(i.map(e=>[e.id,e])):o,l=e=>e.flatMap(e=>{let t=c.get(e);return t&&!t.task?t.name:[]}),u=l(n.filter(e=>!s.includes(e))),d=l(s.filter(e=>!n.includes(e)));if(u.length!==0||d.length!==0){r(!0),a(null);try{await t.setRunTags(e.id,{...u.length>0?{add:u}:{},...d.length>0?{remove:d}:{}})}catch(e){a(e.message)}finally{r(!1)}}}}}var Hh=e=>e===`failed`||e===`cancelled`;function Uh(e,t,n){let{t:r}=_(),[i,a]=(0,L.useState)(null),o=e.groups.filter(e=>Hh(e.status));return e.split&&Hh(e.split.status)&&o.unshift({slug:`_split`,title:r(`runs.header.split`),status:e.split.status}),{failed:o,hasCancelled:o.some(e=>e.status===`cancelled`),retrying:i,retryFailed:async i=>{a(i?`refresh`:`plain`);let s=[];for(let n of o)try{i?await t.retry(e.id,n.slug,{refreshConfig:!0}):await t.retry(e.id,n.slug)}catch(e){s.push(`${n.title}: ${e.message}`)}a(null),s.length>0?n(r(`runs.header.retryRefused`,{list:s.join(`; `)})):F(r(`runs.header.retryStarted`))}}}function Wh(e,t,n,r){let{t:i}=_(),a=Ne(),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(!1);return{forcing:o,setForcing:s,applying:c,apply:async i=>{s(!1),l(!0);try{await(r?r(i):t.apply(e.id,i))}catch(e){n(e.message)}finally{l(!1)}},markDelivered:async()=>{if(await a({title:i(`runs.header.markDeliveredTitle`),description:i(`runs.header.markDeliveredConfirm`),confirmLabel:i(`runs.header.markDeliveredAction`),cancelLabel:i(`runs.header.markDeliveredKeep`)}))try{await t.markDelivered(e.id),F(i(`runs.header.markedDelivered`))}catch(e){n(e.message)}},deliverable:vp(e),cancellingAuto:u,cancelAuto:async()=>{d(!0);try{await t.cancelAutoDelivery(e.id),F(i(`runs.header.autoDeliveryCancelled`))}catch(e){n(e.message)}finally{d(!1)}},autoCancellable:yp(e)}}function Gh({run:e,api:t,tags:n}){let{t:r}=_();return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:(0,U.jsx)(Ah,{run:e,api:t})}),(0,U.jsx)(`div`,{children:(0,U.jsx)(Hd,{id:e.pipeline,name:e.pipelineName})}),e.name?(0,U.jsx)(`div`,{className:`font-mono text-xs text-muted-foreground`,children:e.name}):null,(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(Dh,{label:r(`runs.header.tags`),selected:n.runTagIds,repository:e.repository,onChange:(e,t)=>void n.changeTags(e,t),api:t,allowCreate:!0,disabled:n.tagging,hideLinked:!0}),n.tagError?(0,U.jsx)(j,{variant:`destructive`,children:n.tagError}):null]})]})}function Kh({run:e,api:t,now:n,onError:r,onSelect:i,onDeliver:a,onSubtask:o,headerRef:s,entry:c=null}){let{t:l}=_(),u=ct(e),d=zh(e,t,r),f=Bh(e,t),p=Vh(e,t),m=Uh(e,t,r),h=Wh(e,t,r,a);return(0,U.jsxs)(`header`,{ref:s,"aria-label":l(`runs.header.label`),className:`@container border-b p-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-4 @3xl:flex-row @3xl:items-start`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,U.jsx)(Gh,{run:e,api:t,tags:p}),(0,U.jsx)(Fh,{run:e,repair:u}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(Ih,{run:e,repair:u,observer:f,hold:d,delivery:h}),(0,U.jsx)(Mh,{run:e,api:t,onError:r}),(0,U.jsx)(Rh,{run:e,retry:m,delivery:h,onSubtask:o})]})]}),(0,U.jsx)(Ph,{run:e,now:n,entry:c,onSelect:i,api:t,onError:r})]}),h.forcing?(0,U.jsx)(pp,{run:e,api:t,onConfirm:()=>void h.apply(!0),onClose:()=>h.setForcing(!1)}):null]})}var qh=200;function Jh(e){let t=(e??``).split(`
|
|
18
|
+
`)[0]?.trim()??``;return t.length>qh?`${t.slice(0,qh)}…`:t}function Yh(e,t,n){t.kind===`applied`?F(e(`runs.system.delivered`)):t.kind===`failed`&&Te(e(n?`runs.system.deliveryFailedAgain`:`runs.system.deliveryFailedWith`,{reason:Jh(t.reason)}))}function Xh(e,t){let{t:n}=_(),[r,i]=(0,L.useState)({});return(0,L.useEffect)(()=>{let e=[],a=[];for(let[i,o]of Object.entries(r)){let r=t.find(e=>e.id===i);if(!r)continue;let s=wp(r,o);s===null?r.delivery.inProgress&&!o.busy&&a.push(i):(e.push(i),s.kind!==`cancelled`&&s.kind!==`pending`&&Yh(n,s,o.failedBefore))}a.length>0&&i(e=>{let t={...e};for(let e of a){let n=t[e];n&&(t[e]={...n,busy:!0})}return t}),e.length>0&&i(t=>{let n={...t};for(let t of e)delete n[t];return n})},[t,r,n]),(0,L.useCallback)(async(t,r)=>{let a={since:t.delivery.finishedAt,failedBefore:t.delivery.failed>0,busy:!1},o=Cp(await e.apply(t.id,r));o.kind===`pending`?(F(n(`runs.system.deliveryStarted`)),i(e=>({...e,[t.id]:a}))):Yh(n,o,a.failedBefore)},[e,n])}function Zh({props:e}){let{t}=_(),{openedState:n=null,route:r,loaded:i}=e;return n===`loading`?(0,U.jsxs)(`div`,{role:`status`,"aria-label":t(`runs.page.connecting`),className:`flex flex-col gap-2 p-4`,children:[(0,U.jsx)(M,{className:`h-16`}),(0,U.jsx)(M,{className:`h-40`})]}):n===`missing`?(0,U.jsx)(Pe,{icon:(0,U.jsx)(go,{}),title:t(`runs.page.notFound`),className:`m-auto`,children:(0,U.jsx)(`p`,{className:`font-mono`,children:r.run})}):i?(0,U.jsx)(Pe,{icon:(0,U.jsx)(Io,{}),title:t(`runs.page.choose`),className:`m-auto`,children:(0,U.jsxs)(`p`,{children:[t(`runs.page.chooseHint`),` `,(0,U.jsxs)(Rs,{children:[js(),`K`]})]})}):null}function Qh(e){let{t}=_(),{api:n,runs:r,run:i,route:a,now:o,onSelect:s,onRoute:c}=e,[l,u]=(0,L.useState)(null),d=cp(l),f=Xh(n,r);if(!i)return(0,U.jsx)(Zh,{props:e});let p=Bd(i).find(e=>e.slug===a.group)??Vd(i);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Kh,{run:i,api:n,now:o,onError:e.onError,onDeliver:e=>f(i,e),onSubtask:e.onSubtask,onSelect:e=>s(i.id,e),headerRef:u,entry:p}),p?(0,U.jsx)(bh,{api:n,runId:i.id,row:p,openStep:a.group===p.slug?a.step:null,tab:a.group===null||a.group===p.slug?a.tab:null,onTab:e=>c({...a,group:p.slug,tab:e===`log`?null:e}),draftKey:`${i.id}/${p.slug}`,drafts:e.drafts,onDraft:e.onDraft,onClearDrafts:e.onClearDrafts,onError:e.onError,onlyReplies:e.onlyReplies,onOnlyReplies:e.onOnlyReplies,deliverable:vp(i),onDeliver:()=>f(i,!1),run:i,onForceDeliver:()=>f(i,!0),showUsage:d,onSelectEntry:e=>s(i.id,e)},`${i.id}/${p.slug}/${a.step??``}`):(0,U.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:t(`runs.page.noGroups`)})]})}function $h({more:e,onMore:t,setMarker:n}){let{t:r}=_();return e===`done`?null:e===`error`?(0,U.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 text-sm text-destructive`,children:[r(`runs.list.moreFailed`),(0,U.jsx)(o,{variant:`outline`,size:`sm`,onClick:t,children:r(`runs.list.retry`)})]}):(0,U.jsx)(`div`,{ref:n,role:e===`loading`?`status`:void 0,"aria-label":e===`loading`?r(`runs.list.loadingMore`):void 0,"data-run-list-end":``,className:`flex flex-col gap-2`,children:e===`loading`?(0,U.jsx)(M,{className:`h-16`}):(0,U.jsx)(`div`,{className:`h-4`})})}var eg=[`human`,`autopilot`,`observer`];function tg({run:e}){let{t}=_(),n=e.decisions??[];if(n.length===0)return null;let r=e=>e.split(`
|
|
19
|
+
`)[0]??``,i=eg.map(e=>({by:e,n:n.filter(t=>t.by===e).length})).filter(({n:e})=>e>0).map(({by:e,n})=>t(`runs.list.answersCount`,{who:t(`runs.decisions.${e}`),n})),a=n.map(e=>`${e.group} · ${e.stepId} (${t(`runs.decisions.${e.by}`)}): ${r(e.question)} → ${r(e.answer)}`).join(`
|
|
20
|
+
`);return(0,U.jsxs)(`span`,{className:`text-xs text-muted-foreground`,title:a,children:[t(`runs.list.answers`),`: `,i.join(` · `)]})}function ng({done:e,total:t}){let{t:n}=_(),r=jl({done:e,total:t});return(0,U.jsxs)(`span`,{role:`progressbar`,"aria-label":n(`runs.list.progress`),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r,className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`h-1 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,U.jsx)(`span`,{"data-fill":!0,className:`block h-full rounded-full`,style:{width:`${r}%`,backgroundColor:`color-mix(in oklch, var(--color-status-ok) ${r}%, var(--color-status-warn))`}})}),(0,U.jsxs)(`span`,{className:`w-[4ch] shrink-0 text-right text-xs tabular-nums`,children:[r,`%`]})]})}function rg({run:e}){let{t}=_();if(e.state!==`finished`&&e.state!==`failed`)return null;let n=e.groups.reduce((e,t)=>e+t.warnings,0);return n===0?null:(0,U.jsx)($,{status:`warnings`,label:t(`status.warnings`,{n})})}var ig=[`active`,`needs_human`,`repair`,`paused`,`frozen`],ag=[`merging`,`merged`,`conflict`,`failed`,`cancelled`,`done`];function og(e,t){return e===`needs_human`&&t===`needs_human`?0:e===`running`?1:2}function sg(e,t){if(!ig.includes(e.state))return[];let n=e.system??[],r=e=>({status:e.status,name:e.kind===`action`?e.title:t(e.kind)}),i=[...n.filter(e=>e.kind===`split`).map(r),...e.groups.map(e=>({status:e.status,name:e.stepName??e.step})),...n.filter(e=>e.kind!==`split`).map(r)].filter(e=>!ag.includes(e.status)&&e.name).map((e,t)=>({entry:e,index:t})).sort((t,n)=>og(t.entry.status,e.state)-og(n.entry.status,e.state)||t.index-n.index);return[...new Set(i.map(({entry:e})=>e.name))]}function cg(e,t){let n=sg(e,t),[r]=n;return r===void 0?null:{first:r,rest:n.length-1,all:n}}function lg({run:e}){let{t}=_(),n=Sp(e);return n?(0,U.jsx)($,{status:n.status,label:n.status===`apply_failed`?t(`runs.header.deliveryFailed`,{n:e.delivery.failed}):void 0,tip:n.status===`apply_failed`?n.reason??void 0:t(`runs.list.undeliveredTip`,{applied:n.delivered,merged:n.merged})}):null}function ug({run:e,selectedGroup:t,onSelect:n}){let{t:r}=_(),i=Bd(e);return(0,U.jsx)(`ul`,{"aria-label":r(`runs.list.groups`),className:`mt-1 ml-3 flex flex-col gap-0.5 border-l pl-2`,children:i.map(i=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,"aria-current":i.slug===t,className:k(`flex w-full items-center justify-between gap-2 rounded-md px-2 py-1 text-left text-sm hover:bg-accent`,i.slug===t&&`bg-accent font-medium`),onClick:()=>n(e.id,i.slug),children:[(0,U.jsxs)(`span`,{className:`truncate`,title:i.title,children:[`kind`in i&&i.kind!==`action`?r(`runs.system.${i.kind}`):i.title,`kind`in i?(0,U.jsx)(`span`,{className:`ml-1.5 text-xs font-normal text-muted-foreground`,children:r(`runs.system.badge`)}):null]}),Tp(i,r)]})},i.slug))})}function dg(e){let{run:t,open:n,now:r,scope:i,onSelect:a}=e,{t:o}=_(),s=Nl(t,r,hu()),c=Sp(t),l=cg(t,e=>o(`runs.system.${e}`)),u=Jl(t,o),d=l?o(`runs.list.stageLabel`,{status:u,stage:l.first,more:l.rest>0?o(`runs.list.stageMore`,{n:l.rest}):``}):u;return(0,U.jsxs)(`li`,{"data-run":t.id,children:[(0,U.jsxs)(`button`,{type:`button`,className:k(`flex w-full flex-col gap-1 rounded-lg border bg-card p-2.5 text-left hover:bg-accent`,c&&`border-status-warn/40 bg-status-warn-bg/40`,n&&`border-primary bg-accent`),"data-undelivered":c?``:void 0,"aria-expanded":n,title:`${kl(t)}\n${t.id}`,onClick:()=>a(t.id,null),children:[(0,U.jsxs)(`span`,{className:`block min-w-0 text-sm font-medium break-words [overflow-wrap:anywhere]`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:Sl(t.number)}),` `,kl(t)]}),(0,U.jsx)(`span`,{className:`truncate font-mono text-xs text-muted-foreground`,children:t.name??`—`}),(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[i===`all`?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-medium`,title:t.repository,children:[(0,U.jsx)(De,{path:t.repository}),A(t.repository)]}):null,(0,U.jsx)(Hd,{id:t.pipeline,name:t.pipelineName,focusable:!1}),(0,U.jsx)(np,{tags:t.tags??[],nested:!0})]}),(0,U.jsxs)(`span`,{className:`grid grid-cols-2 items-center gap-2 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,U.jsx)($,{status:t.state,label:d,tip:l?.all.join(`, `)}),(0,U.jsx)(rg,{run:t}),(0,U.jsx)(lg,{run:t})]}),t.state===`finished`?null:(0,U.jsx)(ng,{done:t.progress.done,total:t.progress.total})]}),(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:s.created}),(0,U.jsx)(`span`,{children:s.duration}),El(t.usage)?(0,U.jsx)(`span`,{children:El(t.usage)}):null,wl(t.usage)?(0,U.jsx)(`span`,{children:wl(t.usage)}):null]}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.liveDiff?Ol(t.liveDiff,o):`—`}),(0,U.jsx)(tg,{run:t})]}),n&&Bd(t).length>1?(0,U.jsx)(ug,{...e}):null]})}function fg({done:e,filtered:t,onReset:n}){let{t:r}=_();return(0,U.jsxs)(U.Fragment,{children:[e?(0,U.jsx)(Pe,{icon:(0,U.jsx)(es,{}),title:r(`runs.list.empty`)}):null,t?(0,U.jsx)(o,{variant:`outline`,size:`sm`,onClick:n,children:r(`runs.list.reset`)}):null]})}function pg({runs:e,selectedRun:t,selectedGroup:n,now:r,query:i,onQuery:a,filters:o,onFilters:s,onSelect:c,scope:l,onScope:u,repository:d,repositoryPaths:f,showFilters:p=!0,more:m=`done`,onMore:h=()=>void 0}){let{t:g}=_(),{byId:v}=Md(),y=Of(e,i,o,l,d,v),b=Mf(i,o,l)>0,[x,S]=(0,L.useState)(null),C=`${l}|${d}|${e.length}`;return th(m===`idle`?x:null,h,C),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[p?(0,U.jsx)(ip,{runs:e,query:i,onQuery:a,scope:l,onScope:u,repository:d,repositoryPaths:f,filters:o,onFilters:s}):null,y.length===0?(0,U.jsx)(fg,{done:m===`done`,filtered:b,onReset:()=>{a(``),s(bf)}}):(0,U.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:y.map(e=>(0,U.jsx)(dg,{run:e,open:e.id===t,selectedGroup:n,now:r,scope:l,onSelect:c},e.id))}),(0,U.jsx)($h,{more:m,onMore:h,setMarker:S})]})}function mg(e){return!e||e.done?`done`:e.error===null?e.loading?`loading`:`idle`:`error`}function hg(e){let{t}=_(),{runs:n,loaded:r,run:i,group:a,history:o,...s}=e;return r?n.length===0?null:(0,U.jsx)(pg,{showFilters:!1,runs:n,selectedRun:i?.id??null,selectedGroup:a,now:s.now,query:s.query,onQuery:s.onQuery,filters:s.filters,onFilters:s.onFilters,onSelect:s.onSelect,scope:s.scope,onScope:s.onScope,repository:s.repository,repositoryPaths:s.repositoryPaths,more:mg(o),onMore:o?.loadMore}):(0,U.jsxs)(`div`,{role:`status`,"aria-label":t(`runs.page.connecting`),className:`flex flex-col gap-2`,children:[(0,U.jsx)(M,{className:`h-16`}),(0,U.jsx)(M,{className:`h-16`}),(0,U.jsx)(M,{className:`h-16`})]})}function gg(){try{let e=window.localStorage.getItem(`aip.web.runTags`),t=e===null?[]:JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function _g(e){let{byId:t}=Md(),[n]=(0,L.useState)(gg),[r,i]=N(`runFilters`,{...bf,tagIds:n}),[a,o]=N(`runFiltersCollapsed`,!1);return{filters:{...bf,...r,tagIds:(r.tagIds??[]).filter(n=>t.get(n)?.repository===e)},setStored:i,collapsed:a,setCollapsed:o,byId:t}}function vg(e){let{route:t,onRoute:n,wide:r,shown:i,run:a}=e,[o,s]=(0,L.useState)(t.group?`detail`:`list`),c=(e,t)=>{s(`detail`),n({view:`runs`,run:e,group:t,step:null,tab:null})},l=e=>{if(i.length===0)return;let t=i.findIndex(e=>e.id===a?.id),n=i[Math.min(i.length-1,Math.max(0,t+e))];n&&(c(n.id,null),document.querySelector(`[data-run="${CSS.escape(n.id)}"]`)?.scrollIntoView({block:`nearest`}))};Ns(`j`,()=>l(1)),Ns(`k`,()=>l(-1));let u=(0,L.useRef)({run:t.run,group:t.group,step:t.step});return(0,L.useEffect)(()=>{let e=u.current;u.current={run:t.run,group:t.group,step:t.step},(e.run!==null&&t.run!==e.run||t.group!==null&&(t.group!==e.group||t.step!==e.step))&&t.run&&s(`detail`)},[t.run,t.group,t.step]),(0,L.useEffect)(()=>{r&&s(`list`)},[r]),{screen:o,setScreen:s,select:c}}var yg=464;function bg(e){let{runs:t,loaded:n,openedState:r=null,route:i,repository:a,scope:o}=e,s=P(`(min-width: 768px)`),c=P(`(min-width: 1280px)`),[l,u]=(0,L.useState)(``),{filters:d,setStored:f,collapsed:p,setCollapsed:m,byId:h}=_g(a),g=t.find(e=>e.id===i.run)??null,_=Of(t,l,d,o,a,h),{screen:v,setScreen:y,select:b}=vg({route:i,onRoute:e.onRoute,wide:s,shown:_,run:g}),x={runs:t,query:l,onQuery:u,filters:d,onFilters:f,scope:o,onScope:e.onScope,repository:a,repositoryPaths:e.repositoryPaths},S=Mf(l,d,o);if(n&&t.length===0)return(0,U.jsx)(sp,{onRoute:e.onRoute});let C=g?Bd(g).find(e=>e.slug===i.group)??Vd(g):null,w=(0,U.jsx)(Qh,{...e,run:g,onSelect:b}),T=n?(0,U.jsx)(ap,{filterProps:x,count:S,wide:s}):null,E=(0,U.jsx)(hg,{...x,loaded:n,run:g,group:C?.slug??null,now:e.now,onSelect:b,history:e.history});return s?(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[c&&n?(0,U.jsx)(op,{filterProps:x,count:S,collapsed:p,onCollapsed:m}):null,(0,U.jsxs)(`aside`,{"data-runs-list":!0,style:{width:c&&p?yg:320},className:`flex shrink-0 flex-col gap-2 overflow-y-auto border-r p-3`,children:[c?null:T,E]}),(0,U.jsx)(`main`,{className:`flex min-w-0 flex-1 flex-col overflow-y-auto`,children:w})]}):v===`detail`&&(g||r===`loading`||r===`missing`)?(0,U.jsx)(Nf,{onBack:()=>y(`list`),children:w}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 p-3`,children:[T,E]})}function xg({panel:e,actions:t}){let{state:n,chrome:r,route:i,scopedApi:a}=e,{runs:o,queue:s,selected:c}=n,l={api:a,runs:o,route:i,onRoute:e.setRoute,pageKey:c??``,dirty:r.dirty},{queueDrafts:u,onQueueDraft:d}=r.drafts;switch(i.view){case`queue`:return(0,U.jsx)(pf,{common:l,queue:s,now:r.now,drafts:u,onDraft:d,onQueue:n.setQueue,onError:Te,onNewTask:r.newTask.openNewTask});case`settings`:return(0,U.jsx)(hf,{common:l,streamedObservers:n.streamedObservers,streamedNetwork:n.streamedNetwork,repository:c,repositories:n.repositories,onSelectRepository:e=>void t.selectRepository(e),registry:n.registry,onRegistry:n.setRegistry,onProjectMoved:t.projectMoved,onRemoveProject:t.removeRepository,onOpenProject:(e,n)=>void t.openProject(e,n),queue:s,onQueue:n.setQueue,onError:Te});case`stats`:return(0,U.jsx)(mf,{common:l,registry:n.registry});case`pipelines`:case`specialists`:return(0,U.jsx)(gf,{common:l});default:return(0,U.jsx)(bg,{api:e.api,runs:o,loaded:n.loaded,openedState:n.openedState,route:i,now:r.now,drafts:r.drafts.drafts,onDraft:r.drafts.onDraft,onClearDrafts:r.drafts.onClearDrafts,onError:Te,onlyReplies:e.onlyReplies,onOnlyReplies:e.setOnlyReplies,onRoute:e.setRoute,repository:c,repositoryPaths:e.repositoryPaths,scope:e.scope,onScope:e.setScope,onSubtask:s?r.newTask.openSubtask:void 0,history:n.history})}}function Sg(e,t){return e!==null&&JSON.stringify(e)===JSON.stringify(t)?e:t}function Cg(e){let t=e=>e.state===`queued`?e.finishedAt===null?3:2:!e.finished&&e.hold!==null?1:e.finished?e.finishedAt===null?3:2:0,n=(e,t)=>e.id<t.id?-1:+(e.id>t.id);return[...e].sort((e,r)=>{let i=t(e);if(i!==t(r))return i-t(r);if(i===0){let t=e=>e.state===`needs_human`?0:1;if(t(e)!==t(r))return t(e)-t(r);let i=e=>e.startedAt===null;if(i(e)!==i(r))return i(e)?-1:1;let a=e=>i(e)?e.createdAt:e.startedAt??e.createdAt;return a(r)-a(e)||r.createdAt-e.createdAt||n(e,r)}return i===2?(r.finishedAt??0)-(e.finishedAt??0)||r.createdAt-e.createdAt||n(e,r):r.createdAt-e.createdAt||n(e,r)})}function wg(e,t){let n=new Map,r=t.length!==e.size;for(let i of t){let t=e.get(i.id);t&&JSON.stringify(t)===JSON.stringify(i)?n.set(i.id,t):(n.set(i.id,i),r=!0)}return r?n:e}function Tg(e,t){let n=e.get(t.id);return n&&JSON.stringify(n)===JSON.stringify(t)?e:new Map(e).set(t.id,t)}function Eg(e,t){let n=e.get(t.repository);return n&&JSON.stringify(n)===JSON.stringify(t)?e:new Map(e).set(t.repository,t)}function Dg(e,t){return JSON.stringify(e)===JSON.stringify(t)?e:t}function Og(e,t,n){if(n===null)return e;let r=[...e.filter(e=>e.repository!==n),...t.filter(e=>e.repository===n)];return r.sort((e,t)=>e.repository.localeCompare(t.repository,`en`)),Dg(e,r)}function kg(e,t){return JSON.stringify(e)===JSON.stringify(t)?e:t}function Ag(e,t,n){t.setDaemon(e.daemon??null),t.setLoaded(!0);let r=e.runs;t.setRuns(e=>wg(e,r)),n(r);let i=e.tags;i&&t.setTags(e=>Dg(e,i));let a=e.repositories;a&&t.setRegistry(e=>kg(e,a));let o=e.queues??[];o.length>0&&t.setQueues(e=>o.reduce((e,t)=>Eg(e,t),e))}function jg(e,t){t.setRuns(t=>Tg(t,e)),t.setExtra(t=>t.has(e.id)?Tg(t,e):t),t.setHistory(t=>t.has(e.id)?Tg(t,e):t)}function Mg(e,t,n){switch(e.event){case`daemon`:t.setDaemon(e.daemon);return;case`snapshot`:Ag(e,t,n);return;case`tags`:{let n=e.tags;t.setTags(e=>Dg(e,n));return}case`repositories`:{let n=e.repositories;t.setRegistry(e=>kg(e,n));return}case`processes`:{let n=e.processes??null;t.setStreamedProcesses({processes:n,error:e.error??null});return}case`network`:t.setStreamedNetwork(e.network);return;case`queue`:{let n=e.queue;t.setQueues(e=>Eg(e,n));return}case`run`:jg(e.run,t)}}function Ng(e,t,n){if(e.event===`observers`){let n=pt(e.observers??e);n&&t.setStreamedObservers(e=>Sg(e,n))}else Sd(e)&&Mg(e,t,n)}function Pg({api:e,set:t,refs:n,closed:r},i){let a=n.opened.current;a!==null&&n.extra.current.has(a)&&!i.some(e=>e.id===a)&&e.run(a).then(e=>{r()||t.setExtra(t=>Tg(t,e))}).catch(()=>{})}async function Fg({api:e,set:t,closed:n}){try{let r=await e.queue();if(n())return;t.setHome(r.repository),t.setQueues(e=>Eg(e,r))}catch{}}async function Ig({api:e,set:t,refs:n,closed:r}){let i=await e.tags();if(r())return;t.setTags(e=>Og(e,i,n.home.current));let a=n.wanted.current;if(a!==null&&a!==n.home.current){let n=await e.forRepository(a).tags();if(r())return;t.setTags(e=>Og(e,n,a))}}async function Lg(e){let{api:t,set:n,closed:r}=e;try{let i=await t.runs();if(r())return;n.setRuns(e=>wg(e,i)),n.setLoaded(!0),Pg(e,i);let a=await t.repositories();if(r())return;n.setRegistry(e=>kg(e,a)),await Ig(e)}catch{}await Fg(e)}function Rg(e,t,n,r){let i=!1,a={api:e,set:n,refs:r,closed:()=>i};Fg(a);let o=Ed(()=>Lg(a),()=>n.setConnection(`polling`),a.closed),s=t(`/api/events`);return Dd(s,o,{live:()=>n.setConnection(`live`),event:e=>Ng(e,n,e=>Pg(a,e)),broken:()=>n.setConnection(e=>e===`polling`?e:`reconnecting`)}),()=>{i=!0,o.stop(),s.close()}}var zg={cursor:void 0,loading:!1,error:null};function Bg(e,t,n){let[r,i]=(0,L.useState)(new Map),a=(0,L.useRef)(r),o=n??``,s=(0,L.useCallback)((e,t)=>{let n=new Map(a.current);n.set(e,{...n.get(e)??zg,...t}),a.current=n,i(n)},[]),c=(0,L.useCallback)(()=>{if(n===void 0)return;let r=a.current.get(o)??zg;r.loading||r.cursor===null||(s(o,{loading:!0,error:null}),e.finishedRuns(r.cursor,n??void 0).then(e=>{t(t=>e.runs.reduce((e,t)=>Tg(e,t),t)),s(o,{cursor:e.next,loading:!1})}).catch(e=>{s(o,{loading:!1,error:e instanceof Error?e.message:String(e)})}))},[e,t,n,o,s]),l=r.get(o)??zg;return(0,L.useMemo)(()=>({loading:l.loading||n===void 0,error:l.error,done:l.cursor===null,loadMore:c}),[l,c,n])}function Vg(e,{runs:t,extra:n,history:r,loaded:i},a,o,s){let[c,l]=(0,L.useState)(new Set),u=(0,L.useRef)(new Set),d=(0,L.useRef)(s);d.current=s;let f=o!==null&&t.has(o),p=o!==null&&(f||n.has(o)||r.has(o)),m=o!==null&&c.has(o);return(0,L.useEffect)(()=>{!i||o===null||p||m||u.current.has(o)||(u.current.add(o),e.run(o).then(e=>a(t=>Tg(t,e))).catch(e=>{e instanceof Qe&&e.status===404?l(e=>new Set(e).add(o)):d.current(e instanceof Error?e.message:String(e))}).finally(()=>u.current.delete(o)))},[e,i,o,p,m,a]),o===null?null:p?`listed`:m?`missing`:i?`loading`:null}function Hg(e,t){let[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(new Map),[u,d]=(0,L.useState)(new Map),[f,p]=(0,L.useState)([]),[m,h]=(0,L.useState)(null),[g,_]=(0,L.useState)(`reconnecting`),[v,y]=(0,L.useState)(!1),[b,x]=(0,L.useState)(null),[S,C]=(0,L.useState)([]),[w,T]=(0,L.useState)(new Map),[E,ee]=(0,L.useState)(new Map),D={opened:(0,L.useRef)(e),extra:(0,L.useRef)(w),home:(0,L.useRef)(m),wanted:(0,L.useRef)(t)};return D.opened.current=e,D.extra.current=w,D.home.current=m,D.wanted.current=t,{state:{runs:c,queues:u,registry:f,home:m,connection:g,loaded:v,daemon:b,tags:S,extra:w,history:E,streamedObservers:n,streamedProcesses:i,streamedNetwork:o},set:{setRuns:l,setQueues:d,setRegistry:p,setHome:h,setLoaded:y,setDaemon:x,setTags:C,setExtra:T,setHistory:ee,setStreamedObservers:r,setStreamedProcesses:a,setStreamedNetwork:s,setConnection:_},refs:D}}function Ug(e,{home:t,registry:n,queues:r},i,a){let o=(0,L.useMemo)(()=>(le(n),ue(t,n)),[t,n]),s=t===null||o.includes(t)?t:oe(n)??t,c=a!==null&&o.includes(a)?a:s,l=c?r.get(c)??null:null,u=c!==null&&c!==t&&l===null;return(0,L.useEffect)(()=>{if(!u||c===null)return;let t=!1;return e.forRepository(c).queue().then(e=>{t||i(t=>Eg(t,e))}).catch(()=>{}),()=>{t=!0}},[e,u,c,i]),{repositories:o,selected:c,queue:l}}function Wg(e,t=bd,n=null,r=null,i=()=>void 0,a=!1){let{state:o,set:s,refs:c}=Hg(r,n);(0,L.useEffect)(()=>Rg(e,t,s,c),[e,t]);let l=Vg(e,o,s.setExtra,r,i),u=Ug(e,o,s.setQueues,n),d=Bg(e,s.setHistory,a?u.selected??void 0:null),{runs:f,extra:p,history:m}=o,h=(0,L.useMemo)(()=>{let e=new Map(p);for(let[t,n]of m)e.set(t,n);for(let[t,n]of f)e.set(t,n);return Cg(e.values())},[f,p,m]),g=(0,L.useMemo)(()=>new Set(f.keys()),[f]),_=(0,L.useCallback)(e=>{s.setQueues(t=>Eg(t,e))},[]),v=(0,L.useCallback)((e,t)=>{s.setTags(n=>Og(n,t,e))},[]),y=(0,L.useCallback)(e=>{s.setRegistry(t=>kg(t,e))},[]);return{...u,...o,runs:h,listedRuns:g,openedState:l,history:d,setRegistry:y,setQueue:_,setTags:v}}var Gg=[`needs_human`,`failed`,`conflict`,`apply_failed`];function Kg(e){return(e??``).split(`
|
|
21
|
+
`).find(e=>e.trim()!==``)?.trim()??``}function qg(e){let t=[];return(e.status===`needs_human`||e.status===`failed`||e.status===`conflict`)&&t.push(e.status),e.delivery===`apply_failed`&&t.push(`apply_failed`),t}function Jg(e){let t=[];for(let n of e)lt(n)||n.groups.forEach((e,r)=>{for(let i of qg(e)){let a=i===`needs_human`?e.question:e.reason;t.push({item:{key:`${n.id}/${e.slug}/${i}`,kind:i,runId:n.id,runTitle:n.title||n.name||n.id,repository:n.repository,slug:e.slug,groupTitle:e.title,detail:Kg(a),humanOnly:i===`needs_human`?e.humanOnly??null:null,createdAt:n.createdAt},order:Gg.indexOf(i),position:r})}});return t.sort((e,t)=>e.order-t.order||t.item.createdAt-e.item.createdAt||e.position-t.position).map(({item:e})=>e)}function Yg(e){let t=new Set;for(let n of e)for(let e of n.groups)for(let r of qg(e))t.add(`${n.id}/${e.slug}/${r}`);return t}function Xg(e,t){let n=new Set(t.map(e=>e.id)),r=Yg(t),i=e.filter(e=>{let t=e.slice(0,Math.max(e.indexOf(`/`),0));return!n.has(t)||r.has(e)});return i.length>1e3?i.slice(-1e3):i}function Zg(){if(typeof Notification>`u`||typeof window<`u`&&window.isSecureContext===!1)return`unsupported`;let e=Notification.permission;return e===`granted`||e===`denied`?e:`default`}function Qg(e,t,n,r,i){let a=(0,L.useRef)(null),o=(0,L.useRef)(i);o.current=i;let s=(0,L.useRef)(r);s.current=r;let c=(0,L.useRef)(n);c.current=n,(0,L.useEffect)(()=>{if(!t)return;let n=a.current;if(a.current=new Set(e.map(e=>e.key)),n!==null&&Zg()===`granted`)for(let t of e){if(n.has(t.key)||c.current.has(t.key)||s.current!==null&&!s.current.has(t.runId))continue;let e=Gl(t.kind,D.t).label,r=t.humanOnly?`${e} · ${D.t(`runs.humanOnly.${t.humanOnly}`)}`:e,i=new Notification(`aip: ${t.groupTitle}`,{body:t.detail?`${r} · ${t.detail}`:r,tag:t.key});i.onclick=()=>{window.focus(),o.current(t),i.close()}}},[t,e])}function $g(e,t,n=!0,r=null){let[i,a]=N(`notificationsRead`,[],{shared:!0}),[o,s]=N(`notificationsHidden`,[],{shared:!0}),[c,l]=(0,L.useState)(Zg),u=(0,L.useMemo)(()=>Jg(e),[e]),d=(0,L.useMemo)(()=>new Set(o),[o]),f=(0,L.useMemo)(()=>new Set(i),[i]),p=(0,L.useMemo)(()=>u.filter(e=>!d.has(e.key)),[u,d]),m=p.filter(e=>!f.has(e.key));(0,L.useEffect)(()=>{if(!n)return;let t=Xg(i,e);t.length!==i.length&&a(t);let r=Xg(o,e);r.length!==o.length&&s(r)},[n,e,i,o,a,s]),Qg(u,n,d,r,t);let h=(0,L.useCallback)(()=>{l(Zg());let e=[...new Set([...i,...p.map(e=>e.key)])];e.length!==i.length&&a(e)},[i,p,a]),g=(0,L.useCallback)(()=>{typeof Notification<`u`&&Notification.requestPermission().then(()=>l(Zg()),()=>l(Zg()))},[]),_=(0,L.useCallback)(e=>s([...new Set([...o,e])]),[o,s]),v=(0,L.useCallback)(()=>s([...new Set([...o,...p.map(e=>e.key)])]),[o,p,s]),y=(0,L.useCallback)(e=>f.has(e.key),[f]);return{items:p,unread:m.length,unreadTone:m.some(e=>e.kind===`needs_human`)?`warn`:`err`,isRead:y,permission:c,open:h,enable:g,hide:_,hideAll:v,select:t}}function e_(){let[e,t]=(0,L.useState)({}),[n,r]=(0,L.useState)({});return{drafts:e,queueDrafts:n,onDraft:(0,L.useCallback)((e,n)=>{t(t=>({...t,[e]:n}))},[]),onClearDrafts:(0,L.useCallback)(e=>{t(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e&&!t.startsWith(`${e}/`))))},[]),onQueueDraft:(0,L.useCallback)((e,t)=>{r(n=>{if(t!==null)return{...n,[e]:t};let{[e]:r,...i}=n;return i})},[])}}function t_(){let[e,t]=(0,L.useState)(!1),[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(null),o=(0,L.useCallback)(e=>{a(e),r(!0),t(!0)},[]);return{open:e,setOpen:t,opened:n,preset:i,setPreset:a,openNewTask:(0,L.useCallback)(()=>o(null),[o]),openSubtask:(0,L.useCallback)(e=>o({repository:e.repository,parent:e.id}),[o])}}function n_(){return O(window.location.hash)}function r_(e){let t=ie(e);window.location.hash!==t&&window.history.replaceState(null,``,`${window.location.pathname}${t}`)}function i_(){let[e,t]=(0,L.useState)(n_),n=(0,L.useRef)(null);return(0,L.useEffect)(()=>{let e=()=>t(n_());return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),(0,L.useEffect)(()=>r_(e),[e]),(0,L.useEffect)(()=>{e.view===`runs`&&e.run&&(n.current=e.run)},[e]),{route:e,setRoute:t,lastRun:n}}function a_(){let[e,t]=(0,L.useState)(()=>Date.now());return(0,L.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),1e3);return()=>clearInterval(e)},[]),e}function o_(e){let t=(0,L.useRef)(!1);(0,L.useEffect)(()=>{t.current=!1},[e]);let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(!1);return Ns(`mod+k`,e=>{e.preventDefault(),r(e=>!e)}),Ns(`?`,()=>a(!0)),{dirty:t,palette:n,setPalette:r,shortcuts:i,setShortcuts:a,newTask:t_(),drafts:e_(),now:a_()}}function s_(e,t,n,r,i,a){let o=t.find(e=>e.repository===n);(0,L.useEffect)(()=>{e.view===`runs`&&e.run===null&&o&&r(e=>({...e,run:o.id}))},[e.view,e.run,o,r]);let s=e.view===`runs`&&e.run?t.find(t=>t.id===e.run)?.repository??null:null,c=s!==null&&!a(s)?s:null;(0,L.useEffect)(()=>{c!==null&&c!==n&&i(c)},[c,n,i])}function c_(e,t){let[n,r]=N(`repository`,null),[i,a]=N(`runs.scope`,`repository`),[o,s]=N(`onlyReplies`,!1),{route:c,setRoute:l,lastRun:u}=i_(),d=Wg(e,t,n,c.view===`runs`?c.run:null,Te,i===`repository`),{runs:f,selected:p,registry:m}=d,h=o_(c.view);s_(c,f,p,l,r,(0,L.useMemo)(()=>{let e=new Set(m.filter(e=>!e.enabled).map(e=>e.path));return t=>e.has(t)},[m]));let g=$g(f,e=>l({view:`runs`,run:e.runId,group:e.slug,step:null,tab:null}),d.loaded,d.listedRuns);return{api:e,scopedApi:(0,L.useMemo)(()=>e.forRepository(p),[e,p]),chosen:n,setChosen:r,scope:i,setScope:a,onlyReplies:o,setOnlyReplies:s,route:c,setRoute:l,lastRun:u,state:d,chrome:h,notifications:g,waitingRepositories:(0,L.useMemo)(()=>ee(m),[m]),repositoryPaths:(0,L.useMemo)(()=>T(m),[m])}}function l_(e,t,n){if(e===t.view)return t;let r=(t,n=null)=>({view:e,run:t,group:n,step:null,tab:null});return e===`settings`?r(`general`,`global`):r(e===`runs`?n:null)}function u_(e,t){let{route:n,setRoute:r,scope:i,chrome:a}=e,{runs:o,selected:s,queue:c}=e.state,{working:l,waiting:u}=jf(Tf(o,i===`repository`?s:null));return{view:n.view,hrefFor:t=>ie(l_(t,n,e.lastRun.current)),onNavigate:t=>{r(l_(t,n,e.lastRun.current))},repository:{repositories:e.state.repositories,paths:e.repositoryPaths,selected:s,waiting:e.waitingRepositories,onSelect:e=>void t.selectRepository(e),onAdd:t.addRepository,browse:e.api.directories},working:l,waiting:u,queued:c?.items.length??0,onPalette:()=>a.setPalette(!0),onNewTask:c?a.newTask.openNewTask:void 0,notifications:e.notifications}}var d_={view:`runs`,run:null,group:null,step:null,tab:null};function f_(e){let{api:t,route:n,setRoute:r,chosen:i,setChosen:a,lastRun:o}=e,{selected:s,registry:c,setRegistry:l}=e.state,{dirty:u}=e.chrome,{t:d}=_(),f=Ne(),p=(0,L.useRef)({chosen:i,selected:s});p.current={chosen:i,selected:s};let m=()=>{u.current=!1,o.current=null},h=async e=>e===s?!0:u.current&&!await f({title:d(`settings.editor.leaveTitle`),description:d(`settings.editor.leaveDescription`),confirmLabel:d(`settings.editor.leave`),cancelLabel:d(`settings.editor.stay`),destructive:!0})?!1:(m(),a(e),n.view===`runs`&&r(d_),!0);return{selectRepository:h,addRepository:async e=>{let n=await t.addRepository(e);l(n);let r=ce(e,c,n)?.path;r&&await h(r)},removeRepository:async i=>{let o=A(i);if(!await f({title:d(`nav.repositoryRemoveTitle`,{name:o}),description:d(`nav.repositoryRemoveDescription`),confirmLabel:d(`nav.repositoryRemove`),destructive:!0}))return!1;let s;try{s=await t.removeRepository(i)}catch(e){return Te(e),!1}return l(s),(i===p.current.selected||i===p.current.chosen)&&(m(),a(e.state.home===null?oe(s):null),n.view===`runs`&&r(d_)),!0},projectMoved:(e,t)=>{(p.current.chosen===e||p.current.selected===e)&&a(t)},openProject:async(e,t)=>{await h(e)&&r(t===`queue`?{view:`queue`,run:null,group:null,step:null,tab:null}:{view:`settings`,run:`general`,group:`project`,step:null,tab:null})}}}function p_(e){return(0,U.jsx)(Ae,{children:(0,U.jsx)(m_,{...e})})}function m_({api:e,openStream:t=bd}){let{t:n}=_(),r=c_(e,t),{state:i,route:a,setRoute:o}=r,s=f_(r),c=u_(r,s);return(0,U.jsx)(jd,{tags:i.tags,onTags:i.setTags,children:(0,U.jsxs)(Nu,{footer:(0,U.jsx)(yd,{runs:i.runs,selected:i.selected,connection:i.connection,streamedProcesses:i.streamedProcesses,api:e,onOpenGroup:e=>o({view:`runs`,run:e.runId,group:e.group,step:e.step,tab:null})}),nav:c,children:[(0,U.jsx)(vf,{panel:r}),(0,U.jsx)(Pu,{daemon:i.daemon}),(0,U.jsx)(`h1`,{className:`sr-only`,children:Ss(a.view,n)}),(0,U.jsx)(xg,{panel:r,actions:s})]})})}var h_=new URL(window.location.href);h_.searchParams.has(`token`)&&(h_.searchParams.delete(`token`),window.history.replaceState(null,``,`${h_.pathname}${h_.search}${h_.hash}`)),Su(),du();var g_=document.getElementById(`root`);g_&&(0,Ze.createRoot)(g_).render((0,U.jsx)(L.StrictMode,{children:(0,U.jsx)(p_,{api:wt})}));export{Yc as $,Qu as A,_a as At,Sl as B,Md as C,Na as Ct,ed as D,Ta as Dt,nd as E,Da as Et,Xl as F,ul as G,El as H,Kl as I,el as J,il as K,Il as L,Ku as M,Y as Mt,Cu as N,J as Nt,td as O,Ca as Ot,hu as P,Qe as Pt,Z as Q,wl as R,Id as S,La as St,$u as T,ka as Tt,Al as U,Tl as V,dl as W,qc as X,$c as Y,Zc as Z,Ud as _,Ko as _t,mp as a,Wc as at,Nd as b,Za as bt,Zf as c,Gs as ct,Bf as d,gs as dt,Q as et,Hf as f,ms as ft,rf as g,Jo as gt,Pf as h,Xo as ht,_p as i,Kc as it,Zu as j,q as jt,Xu as k,ya as kt,Jf as l,Ls as lt,Uf as m,Qo as mt,Dh as n,Vc as nt,np as o,Uc as ot,zf as p,ns as pt,Qc as q,Bp as r,Hc as rt,ep as s,Gc as st,jh as t,Xc as tt,Vf as u,bs as ut,Hd as v,So as vt,$ as w,ja as wt,Pd as x,qa as xt,Fd as y,so as yt,Cl as z};
|