@hoknie/aip 0.3.0 → 0.3.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/feature/runs/services/progress.js +24 -18
- package/dist/feature/runs/services/progress.js.map +1 -1
- package/dist/feature/swarm-edit/services/editor-settings.js +5 -0
- package/dist/feature/swarm-edit/services/editor-settings.js.map +1 -1
- package/dist/feature/swarm-edit/services/plan-settings.js +18 -8
- 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/feature/swarm-edit/types/setting-fields.js +7 -0
- package/dist/feature/swarm-edit/types/setting-fields.js.map +1 -1
- package/dist/presentation/ipc/contract/config.js +2 -2
- package/dist/presentation/ipc/contract/config.js.map +1 -1
- package/dist/presentation/web/routes/settings.js +2 -2
- package/dist/presentation/web/routes/settings.js.map +1 -1
- package/dist/web/assets/{SharedPipelinesGroup-CDmnXmIK.js → SharedPipelinesGroup-CgUJ-sUc.js} +1 -1
- package/dist/web/assets/{deliveryModes-BCAw5jcd.js → deliveryModes-BGIYJzWQ.js} +1 -1
- package/dist/web/assets/index-Cg7gL5P8.css +2 -0
- package/dist/web/assets/index-LD1g1Vkm.js +43 -0
- package/dist/web/assets/locales-D85Vnmev.js +1 -0
- package/dist/web/assets/{pipelines-Bs3be_lB.js → pipelines-Cej37cah.js} +3 -3
- package/dist/web/assets/{settingFields-CjOFaEa6.js → settingFields-gm9TlqxP.js} +1 -1
- package/dist/web/assets/settings-CDiTeiYL.js +6 -0
- package/dist/web/assets/specialists-BGKB5BLI.js +4 -0
- package/dist/web/assets/{stats-CzMDDzr9.js → stats-BM-bGkGX.js} +1 -1
- package/dist/web/assets/{topology-5cpl0v2g.js → topology-BE6orrOL.js} +1 -1
- package/dist/web/index.html +4 -4
- package/integrations/claude-code/.claude-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-BAeOzr94.js +0 -43
- package/dist/web/assets/index-D3ty-b_t.css +0 -2
- package/dist/web/assets/locales-9kiK4pzD.js +0 -1
- package/dist/web/assets/settings-CeKVFMz7.js +0 -6
- package/dist/web/assets/specialists-BPyAYlk1.js +0 -4
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/specialists-BGKB5BLI.js","assets/rolldown-runtime-XKyaHtl9.js","assets/card-4euJkmfJ.js","assets/vendor-react-C1iE8mnY.js","assets/empty-OZRGgwa5.js","assets/FilterColumn-z60UZhkk.js","assets/trash-xUZ90-AG.js","assets/pipelines-Cej37cah.js","assets/settingFields-gm9TlqxP.js","assets/pipelines-DLioOiRN.css","assets/stats-BM-bGkGX.js","assets/settings-CDiTeiYL.js","assets/deliveryModes-BGIYJzWQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t}from"./rolldown-runtime-XKyaHtl9.js";import{i as n,n as r,r as i,t as a}from"./vendor-react-C1iE8mnY.js";import{c as o,d as s,f as c,h as l,i as u,l as d,m as f,o as p,p as m,r as h,s as g,t as _,u as v}from"./deliveryModes-BGIYJzWQ.js";import{$ as y,A as b,B as x,F as S,G as C,H as w,I as T,K as E,L as ee,N as D,O as te,P as O,Q as k,R as ne,U as re,V as ie,W as ae,X as oe,Y as A,Z as j,_ as M,a as N,at as se,c as ce,ct as le,d as ue,et as P,f as F,gt as de,h as fe,i as pe,it as I,j as L,k as R,l as me,lt as z,m as he,mt as ge,n as _e,nt as ve,o as ye,ot as be,p as xe,q as Se,r as Ce,rt as we,st as Te,t as Ee,tt as De,u as Oe,ut as B,v as ke,wt as Ae,y as je,z as Me}from"./card-4euJkmfJ.js";import{a as Ne,c as Pe,d as Fe,f as Ie,l as Le,n as Re,o as ze,p as Be,r as Ve,s as He,t as Ue,u as We}from"./FilterColumn-z60UZhkk.js";import{_ as Ge,a as Ke,c as qe,d as Je,f as Ye,g as Xe,h as Ze,i as Qe,l as $e,m as et,n as tt,o as nt,p as rt,r as V,s as it,t as at,u as ot,v as st,y as ct}from"./empty-OZRGgwa5.js";import{i as lt,n as ut,r as dt,t as ft}from"./locales-D85Vnmev.js";import{n as pt,t as mt}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 H=t(n(),1),ht=r(),gt=class extends Error{status;code;constructor(e,t,n){super(t),this.status=e,this.code=n}};async function U(e,t){let n=await fetch(e,{credentials:`same-origin`,...t}),r=await n.json().catch(()=>({}));if(!n.ok)throw new gt(n.status,r.error??n.statusText,r.code);return r}function W(e,t={}){return U(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})}var _t=(e,t)=>({method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),G=encodeURIComponent,vt=e=>e?`&level=${e}`:``;async function yt(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 gt(n.status,String(r.error??n.statusText))}function bt(e,t){return t===null?e:`${e}${e.includes(`?`)?`&`:`?`}repository=${G(t)}`}function xt(){return{uploadAttachment:(e,t)=>new Promise((n,r)=>{let i=new XMLHttpRequest;i.open(`POST`,`/api/uploads`),i.withCredentials=!0,i.setRequestHeader(`X-File-Name`,G(e.name)),i.upload.onprogress=e=>{e.lengthComputable&&e.total>0&&t?.(Math.round(e.loaded/e.total*100))},i.onerror=()=>r(new gt(0,`network error`)),i.onload=()=>{let e={};try{e=JSON.parse(i.responseText)}catch{}i.status>=200&&i.status<300&&e.upload?n(e):r(new gt(i.status,e.error??i.statusText))},i.send(e)}),attachmentUrl:(e,t,n=!1)=>`/api/runs/${G(e)}/attachments/${G(t)}${n?`?inline=1`:``}`}}function St(e){return{writeMcpServer:(t,n,r,i)=>yt(e(`/api/config/mcp-servers/${G(t)}`),_t(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),deleteMcpServer:(t,n,r)=>yt(e(`/api/config/mcp-servers/${G(t)}?revision=${G(n)}${vt(r)}`),{method:`DELETE`})}}function Ct(e){let t=t=>bt(t,e);return{pipelines:t=>U(bt(`/api/pipelines`,t??e)),config:()=>U(t(`/api/config`)),catalog:()=>U(t(`/api/config/catalog`)),models:e=>U(t(`/api/config/models${e?`?refresh=1`:``}`)),writeSpecialist:(e,n,r,i)=>yt(t(`/api/config/specialists/${G(e)}`),_t(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),deleteSpecialist:(e,n,r)=>yt(t(`/api/config/specialists/${G(e)}?revision=${G(n)}${vt(r)}`),{method:`DELETE`}),sharedSpecialists:()=>U(`/api/shared-specialists`),specialistTags:()=>U(`/api/specialist-tags`),importSpecialists:async(e,n)=>await yt(t(`/api/config/specialists/import`),_t(`POST`,{source:e,slugs:n})),sharedPipelines:()=>U(`/api/shared-pipelines`),importPipelines:async(e,n)=>await yt(t(`/api/config/pipelines/import`),_t(`POST`,{source:e,ids:n})),writeSetting:(e,n,r,i)=>yt(t(`/api/config/settings/${G(e)}`),_t(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),writeSettings:(e,n,r)=>yt(t(`/api/config/settings`),_t(`PUT`,{values:e,revision:n,...r?{level:r}:{}})),...St(t),writePipeline:(e,n,r,i)=>yt(t(`/api/config/pipelines/${G(e)}`),_t(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),deletePipeline:(e,n,r)=>yt(t(`/api/config/pipelines/${G(e)}?revision=${G(n)}${vt(r)}`),{method:`DELETE`}),previewPipeline:(e,n,r)=>W(t(`/api/config/pipelines/${G(e)}/preview`),{value:n,...r?{level:r}:{}}),writeAction:(e,n,r,i)=>yt(t(`/api/config/actions/${G(e)}`),_t(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),deleteAction:(e,n,r)=>yt(t(`/api/config/actions/${G(e)}?revision=${G(n)}${vt(r)}`),{method:`DELETE`}),writeChain:(e,n,r,i)=>yt(t(`/api/config/chains/${G(e)}`),_t(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),deleteChain:(e,n,r)=>yt(t(`/api/config/chains/${G(e)}?revision=${G(n)}${vt(r)}`),{method:`DELETE`}),systemStages:()=>U(t(`/api/system-stages`))}}function wt(e){return{tags:()=>U(e(`/api/tags`)),addTag:(t,n)=>W(e(`/api/tags`),n?{name:t,color:n}:{name:t}),editTag:(t,n)=>W(e(`/api/tags/edit`),{tag:t,...n}),removeTag:t=>W(e(`/api/tags/remove`),{tag:t}),queue:()=>U(e(`/api/queue`)),queueAdd:t=>W(e(`/api/queue/items`),t),queueAddProjects:t=>W(e(`/api/queue/projects`),t),queueEdit:(t,n)=>W(e(`/api/queue/items/${G(t)}`),n),taskLink:(t,n,r)=>W(e(`/api/tasks/link`),{source:t,kind:n,target:r}),taskUnlink:(t,n,r)=>W(e(`/api/tasks/unlink`),{source:t,kind:n,target:r}),queueRemove:t=>W(e(`/api/queue/items/${G(t)}/remove`)),queueRunNow:t=>W(e(`/api/queue/items/${G(t)}/run`)),queueStart:t=>W(e(`/api/queue/start`),t===void 0?{}:{parallel:t}),queuePause:()=>W(e(`/api/queue/pause`)),queueSettings:t=>W(e(`/api/queue/settings`),t),queueReturn:(e,t)=>W(bt(`/api/queue/return`,t),{run:e}),queueDismiss:(e,t)=>W(bt(`/api/queue/dismiss`,t),{run:e})}}function Tt(){return{answer:(e,t,n)=>W(`/api/runs/${G(e)}/groups/${G(t)}/answer`,{answer:n}),message:(e,t,n,r)=>W(`/api/runs/${G(e)}/groups/${G(t)}/message`,{seq:n,text:r}),retry:(e,t,n)=>W(`/api/runs/${G(e)}/groups/${G(t)}/retry`,n?.refreshConfig?{refreshConfig:!0}:{}),skipStep:(e,t,n)=>W(`/api/runs/${G(e)}/skip`,{step:t,skip:n}),setRunVariant:(e,t)=>W(`/api/runs/${G(e)}/variant`,{variant:t}),cancel:(e,t)=>W(t?`/api/runs/${G(e)}/groups/${G(t)}/cancel`:`/api/runs/${G(e)}/cancel`),apply:(e,t)=>W(`/api/runs/${G(e)}/apply`,t?{force:!0}:{}),markDelivered:(e,t)=>W(`/api/runs/${G(e)}/delivered`,t?{groups:t}:{}),setRunTitle:(e,t)=>W(`/api/runs/${G(e)}/title`,{title:t}),cancelAutoDelivery:e=>W(`/api/runs/${G(e)}/auto-delivery/cancel`,{}),setRunTags:(e,t)=>W(`/api/runs/${G(e)}/tags`,t),pauseRun:(e,t)=>W(bt(`/api/runs/${G(e)}/pause`,t))}}var Et=50;function Dt(){let e={runs:()=>U(`/api/runs`),finishedRuns:(e,t)=>U(`/api/finished-runs?limit=${Et}${e?`&before=${G(e)}`:``}${t?`&repository=${G(t)}`:``}`),run:e=>U(`/api/runs/${G(e)}`),group:(e,t)=>U(`/api/runs/${G(e)}/groups/${G(t)}?tail=200`),groupSpec:(e,t)=>U(`/api/runs/${G(e)}/groups/${G(t)}/spec`),transcript:(e,t,n,r)=>U(`/api/runs/${G(e)}/groups/${G(t)}/transcript?seq=${n}&after=${r}`),fileDiff:(e,t,n)=>U(`/api/runs/${G(e)}/groups/${G(t)}/diff?path=${G(n)}`),groupArtifacts:async(e,t)=>(await U(`/api/runs/${G(e)}/groups/${G(t)}/artifacts`)).artifacts,artifactUrl:(e,t,n,r=!1)=>`/api/runs/${G(e)}/groups/${G(t)}/artifacts/${G(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 gt(i.status,e.error??i.statusText)}return i.text()},runPatch:async e=>{let t=await fetch(`/api/runs/${G(e)}/patch`,{credentials:`same-origin`});if(!t.ok){let e=await t.json().catch(()=>({}));throw new gt(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 Ot(){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),e.bucket&&t.set(`bucket`,e.bucket);let n=t.toString();return U(`/api/stats${n?`?${n}`:``}`)},statsClear:e=>U(`/api/stats?repository=${encodeURIComponent(e)}`,{method:`DELETE`})}}function kt(e){let t=f(e);if(t===null)throw new gt(502,`Malformed answer of /api/observers`);return t}async function At(e){let t=await fetch(`/api/observers`,{credentials:`same-origin`,..._t(`PUT`,e)}),n=await t.json().catch(()=>({}));if(t.status===200)return{ok:!0,view:kt(n)};if(t.status===422)return{ok:!1,errors:n.errors??[]};throw new gt(t.status,String(n.error??t.statusText))}function jt(){return{repositories:()=>U(`/api/repositories`),addRepository:(e,t={})=>W(`/api/repositories`,{path:e,...t}),updateRepository:(e,t)=>U(`/api/repositories?repository=${G(e)}`,_t(`PATCH`,t)),moveRepository:(e,t)=>W(`/api/repositories/move?repository=${G(e)}`,{to:t}),removeRepository:e=>U(`/api/repositories?repository=${G(e)}`,{method:`DELETE`}),directories:e=>U(e===void 0?`/api/directories`:`/api/directories?path=${G(e)}`),processes:()=>U(`/api/processes`),killProcess:e=>W(`/api/processes/${e}/kill`),system:()=>U(`/api/system`),restartWeb:async()=>void await W(`/api/system/web/restart`),restartDaemon:async e=>void await W(`/api/system/daemon/restart`,e?{force:!0}:{}),stopDaemon:async e=>void await W(`/api/system/daemon/stop`,e?{force:!0}:{}),startDaemon:async()=>void await W(`/api/system/daemon/start`),observers:async()=>kt(await U(`/api/observers`)),setObservers:At,setRunObserver:(e,t,n)=>W(bt(`/api/runs/${G(e)}/observer`,t),{enabled:n})}}var Mt=[`claude`,`opencode`,`agy`,`command`],Nt=[`running`,`finished`,`failed`,`cancelled`],Pt=[`done`,`rejected`,`needs_human`],Ft=e=>Number.isSafeInteger(e)&&e>=0&&Number.isFinite(new Date(e).getTime());function It(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)&&Ft(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)&&Mt.includes(t.runtime)&&r(t.model)&&Ft(t.startedAt)&&(t.finishedAt===null||Ft(t.finishedAt))&&Nt.includes(t.status)&&(t.verdict===null||Pt.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)})}async function Lt(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 U(`/api/observers/history${t.size?`?${t}`:``}`);if(!It(n))throw new gt(502,`Malformed answer of /api/observers/history`);return n}function Rt(e){let t={forRepository:n=>n===e?t:Rt(n),...Dt(),...Tt(),...wt(t=>bt(t,e)),...jt(),...Ct(e),...Ot(),...xt(),observerHistory:Lt};return t}var zt=Rt(null),Bt={type:`3rdParty`,init(e){de(e.options.react),ge(e)}},K=a();function Vt(e){return(0,K.jsx)(ct,{closeButton:!0,position:`bottom-right`,...e})}var Ht=Object.defineProperty,Ut=(e,t)=>Ht(e,`name`,{value:t,configurable:!0}),Wt=`Collapsible`,[Gt,Kt]=we(Wt),[qt,Jt]=Gt(Wt),Yt=H.forwardRef(Ut(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=y({prop:r,defaultProp:i??!1,onChange:o,caller:Wt});return(0,K.jsx)(qt,{scope:n,disabled:a,contentId:j(),open:c,onOpenToggle:H.useCallback(()=>l(e=>!e),[l]),children:(0,K.jsx)(I.div,{"data-state":tn(c),"data-disabled":a?``:void 0,...s,ref:t})})},`Collapsible`)),Xt=`CollapsibleTrigger`,Zt=H.forwardRef(Ut(function(e,t){let{__scopeCollapsible:n,...r}=e,i=Jt(Xt,n);return(0,K.jsx)(I.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":tn(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:P(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),Qt=`CollapsibleContent`,$t=H.forwardRef(Ut(function(e,t){let{forceMount:n,...r}=e,i=Jt(Qt,e.__scopeCollapsible);return(0,K.jsx)(k,{present:n||i.open,children:({present:e})=>(0,K.jsx)(en,{...r,ref:t,present:e})})},`CollapsibleContent`)),en=H.forwardRef(Ut(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=Jt(Qt,n),[s,c]=H.useState(r),l=H.useRef(null),u=z(t,l),d=H.useRef(0),f=d.current,p=H.useRef(0),m=p.current,h=o.open||s,g=H.useRef(h),_=H.useRef(void 0);return H.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),ve(()=>{let e=l.current;if(e){_.current=_.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,p.current=t.width,g.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),c(r)}},[o.open,r]),(0,K.jsx)(I.div,{"data-state":tn(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})},`CollapsibleContentImpl`));function tn(e){return e?`open`:`closed`}Ut(tn,`getState`);var nn=Object.defineProperty,rn=(e,t)=>nn(e,`name`,{value:t,configurable:!0}),an=`Checkbox`,[on,sn]=we(an),[cn,ln]=on(an);function un(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=y({prop:n,defaultProp:i??!1,onChange:c,caller:an}),[m,h]=H.useState(null),[g,_]=H.useState(null),[v,b]=H.useState(null),x=!m||!!o||!!m.closest(`form`),S={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,userClick:v,onUserClick:b,required:l,defaultChecked:!yn(i)&&i,isFormControl:x,bubbleInput:g,setBubbleInput:_};return(0,K.jsx)(cn,{scope:t,...S,children:vn(d)?d(S):r})}rn(un,`CheckboxProvider`);var dn=`CheckboxTrigger`,fn=H.forwardRef(rn(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:f,isFormControl:p,bubbleInput:m}=ln(dn,e),h=z(i,u),g=H.useRef(c);return H.useEffect(()=>{let e=a?.form;if(e){let t=rn(()=>d(g.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,K.jsx)(I.button,{type:`button`,role:`checkbox`,"aria-checked":yn(c)?`mixed`:c,"aria-required":l,"data-state":bn(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:P(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:P(n,e=>{let t=e.isPropagationStopped();f({requestedChecked:yn(c)?!0:!c,hasConsumerStoppedPropagation:t}),d(e=>yn(e)?!0:!e),m&&p&&(t||e.stopPropagation())})})},`CheckboxTrigger`)),pn=H.forwardRef(rn(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,K.jsx)(un,{__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,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(fn,{...d,ref:t,__scopeCheckbox:n}),e&&(0,K.jsx)(_n,{__scopeCheckbox:n})]})})},`Checkbox`)),mn=`CheckboxIndicator`,hn=H.forwardRef(rn(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=ln(mn,n);return(0,K.jsx)(k,{present:r||yn(a.checked)||a.checked===!0,children:(0,K.jsx)(I.span,{"data-state":bn(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),gn=`CheckboxBubbleInput`,_n=H.forwardRef(rn(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:f,bubbleInput:p,setBubbleInput:m}=ln(gn,e),h=z(r,m),g=We(i),_=H.useRef(!1),v=H.useRef(o),y=H.useRef(a),b=H.useRef(null);H.useEffect(()=>{let e=p;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=v.current!==o;v.current=o;let i=a!==null&&a!==y.current;if(y.current=a,i)b.current=r?null:a,r&&(e.indeterminate=yn(o),n.call(e,!yn(o)&&o)),e.dispatchEvent(new Event(`click`,{bubbles:!a.hasConsumerStoppedPropagation}));else if(r){let t=b.current;b.current=null;let r=t?.requestedChecked===o;_.current=!0,e.indeterminate=yn(o),n.call(e,!yn(o)&&o),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),_.current=!1}},[p,o,a]);let x=H.useRef(!yn(o)&&o);return(0,K.jsx)(I.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??x.current,required:c,disabled:l,name:u,value:d,form:f,...n,tabIndex:-1,ref:h,onClick:P(t,e=>{_.current&&e.stopPropagation()}),style:{...n.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function vn(e){return typeof e==`function`}rn(vn,`isFunction`);function yn(e){return e===`indeterminate`}rn(yn,`isIndeterminate`);function bn(e){return yn(e)?`indeterminate`:e?`checked`:`unchecked`}rn(bn,`getState`);var xn=Object.defineProperty,q=(e,t)=>xn(e,`name`,{value:t,configurable:!0}),Sn=[`Enter`,` `],Cn=[`ArrowDown`,`PageUp`,`Home`],wn=[`ArrowUp`,`PageDown`,`End`],Tn=[...Cn,...wn];[...Sn],[...Sn];var En=`Menu`,[Dn,On,kn]=De(En),[An,jn]=we(En,[kn,Le,ie]),Mn=Le(),Nn=ie(),[Pn,Fn]=An(En),[In,Ln]=An(En),Rn=q(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Mn(t),[c,l]=H.useState(null),u=H.useRef(!1),d=A(a),f=oe(i);return H.useEffect(()=>{let e=q(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=q(()=>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})}},[]),H.useEffect(()=>{if(!n)return;let e=q(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,K.jsx)(ze,{...s,children:(0,K.jsx)(Pn,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,K.jsx)(In,{scope:t,onClose:H.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),zn=H.forwardRef(q(function(e,t){let{__scopeMenu:n,...r}=e,i=Mn(n);return(0,K.jsx)(He,{...i,...r,ref:t})},`MenuAnchor`)),Bn=`MenuPortal`,[Vn,Hn]=An(Bn,{forceMount:void 0}),Un=q(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Fn(Bn,t);return(0,K.jsx)(Vn,{scope:t,forceMount:n,children:(0,K.jsx)(k,{present:n||a.open,children:(0,K.jsx)(w,{asChild:!0,container:i,children:r})})})},`MenuPortal`),Wn=`MenuContent`,[Gn,Kn]=An(Wn),qn=H.forwardRef(q(function(e,t){let n=Hn(Wn,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Fn(Wn,e.__scopeMenu),o=Ln(Wn,e.__scopeMenu);return(0,K.jsx)(Dn.Provider,{scope:e.__scopeMenu,children:(0,K.jsx)(k,{present:r||a.open,children:(0,K.jsx)(Dn.Slot,{scope:e.__scopeMenu,children:o.modal?(0,K.jsx)(Jn,{...i,ref:t}):(0,K.jsx)(Yn,{...i,ref:t})})})})},`MenuContent`)),Jn=H.forwardRef(q(function(e,t){let n=Fn(Wn,e.__scopeMenu),r=H.useRef(null),i=z(t,r);return H.useEffect(()=>{let e=r.current;if(e)return Xe(e)},[]),(0,K.jsx)(Zn,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:P(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Yn=H.forwardRef(q(function(e,t){let n=Fn(Wn,e.__scopeMenu);return(0,K.jsx)(Zn,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Xn=be(`MenuContent.ScrollLock`),Zn=H.forwardRef(q(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Fn(Wn,n),_=Ln(Wn,n),v=Mn(n),y=Nn(n),b=On(n),[x,S]=H.useState(null),w=H.useRef(null),[T,ee]=H.useState(null);C(T);let{nodes:D,registry:te}=E(),O=!!(i||m),k=z(t,w,g.onContentChange,ee),ne=H.useRef(0),ie=H.useRef(``),oe=H.useRef(0),A=H.useRef(null),j=H.useRef(`right`),M=H.useRef(0),N=H.useMemo(()=>m?[w,...D.map(e=>({current:e}))]:[],[w,D,m]),se=m?Ge:H.Fragment,ce=m?{as:Xn,allowPinchZoom:!0,shards:N}:void 0,le=q(e=>{let t=ie.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=br(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;function s(e){ie.current=e,window.clearTimeout(ne.current),e!==``&&(ne.current=window.setTimeout(()=>s(``),1e3))}q(s,`updateSearch`),s(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);H.useEffect(()=>()=>window.clearTimeout(ne.current),[]),st();let ue=H.useCallback(e=>j.current===A.current?.side&&Sr(e,A.current?.area),[]);return(0,K.jsx)(Gn,{scope:n,searchRef:ie,onItemEnter:H.useCallback(e=>{ue(e)&&e.preventDefault()},[ue]),onItemLeave:H.useCallback(e=>{ue(e)||(w.current?.focus(),S(null))},[ue]),onTriggerLeave:H.useCallback(e=>{ue(e)&&e.preventDefault()},[ue]),pointerGraceTimerRef:oe,onPointerGraceIntentChange:H.useCallback(e=>{A.current=e},[]),children:(0,K.jsx)(ae,{registry:O?te:null,children:(0,K.jsx)(se,{...ce,children:(0,K.jsx)(re,{asChild:!0,trapped:i,branches:D,onMountAutoFocus:P(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,K.jsx)(Se,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,K.jsx)(Me,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:P(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,K.jsx)(Pe,{role:`menu`,"aria-orientation":`vertical`,"data-state":hr(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:k,style:{outline:`none`,...h.style},onKeyDown:P(h.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&&le(e.key));let i=w.current;if(e.target!==i||!Tn.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);wn.includes(e.key)&&a.reverse(),vr(a)}),onBlur:P(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(ne.current),ie.current=``)}),onPointerMove:P(e.onPointerMove,Cr(e=>{let t=e.target,n=M.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>M.current?`right`:`left`;j.current=t,M.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),Qn=H.forwardRef(q(function(e,t){let{__scopeMenu:n,...r}=e;return(0,K.jsx)(I.div,{role:`group`,...r,ref:t})},`MenuGroup`)),$n=`MenuItem`,er=`menu.itemSelect`,tr=H.forwardRef(q(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=H.useRef(null),o=Ln($n,e.__scopeMenu),s=Kn($n,e.__scopeMenu),c=z(t,a),l=H.useRef(!1),u=q(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(er,{bubbles:!0,cancelable:!0});e.addEventListener(er,e=>r?.(e),{once:!0}),se(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,K.jsx)(nr,{...i,ref:c,disabled:n,onClick:P(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:P(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:P(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&Sn.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),nr=H.forwardRef(q(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Kn($n,n),s=Nn(n),c=H.useRef(null),l=z(t,c),[u,d]=H.useState(!1),[f,p]=H.useState(``);return H.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,K.jsx)(Dn.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,K.jsx)(x,{asChild:!0,...s,focusable:!r,children:(0,K.jsx)(I.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:P(e.onPointerMove,Cr(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:P(e.onPointerLeave,Cr(e=>o.onItemLeave(e))),onFocus:P(e.onFocus,()=>d(!0)),onBlur:P(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[rr,ir]=An(`MenuRadioGroup`,{value:void 0,onValueChange:q(()=>{},`onValueChange`)}),ar=H.forwardRef(q(function(e,t){let{value:n,onValueChange:r,...i}=e,a=A(r);return(0,K.jsx)(rr,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,K.jsx)(Qn,{...i,ref:t})})},`MenuRadioGroup`)),or=`MenuRadioItem`,sr=H.forwardRef(q(function(e,t){let{value:n,...r}=e,i=ir(or,e.__scopeMenu),a=n===i.value;return(0,K.jsx)(lr,{scope:e.__scopeMenu,checked:a,children:(0,K.jsx)(tr,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":_r(a),onSelect:P(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})},`MenuRadioItem`)),cr=`MenuItemIndicator`,[lr,ur]=An(cr,{checked:!1}),dr=H.forwardRef(q(function(e,t){let{__scopeMenu:n,forceMount:r,...i}=e,a=ur(cr,n);return(0,K.jsx)(k,{present:r||gr(a.checked)||a.checked===!0,children:(0,K.jsx)(I.span,{...i,ref:t,"data-state":_r(a.checked)})})},`MenuItemIndicator`)),fr=H.forwardRef(q(function(e,t){let{__scopeMenu:n,...r}=e;return(0,K.jsx)(I.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[pr,mr]=An(`MenuSub`);function hr(e){return e?`open`:`closed`}q(hr,`getOpenState`);function gr(e){return e===`indeterminate`}q(gr,`isIndeterminate`);function _r(e){return gr(e)?`indeterminate`:e?`checked`:`unchecked`}q(_r,`getCheckedState`);function vr(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}q(vr,`focusFirst`);function yr(e,t){return e.map((n,r)=>e[(t+r)%e.length])}q(yr,`wrapArray`);function br(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=yr(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}q(br,`getNextMatch`);function xr(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}q(xr,`isPointInPolygon`);function Sr(e,t){return t?xr({x:e.clientX,y:e.clientY},t):!1}q(Sr,`isPointerInGraceArea`);function Cr(e){return t=>t.pointerType===`mouse`?e(t):void 0}q(Cr,`whenMouse`);var wr=Object.defineProperty,Tr=(e,t)=>wr(e,`name`,{value:t,configurable:!0}),Er=`DropdownMenu`,[Dr,Or]=we(Er,[jn]),kr=jn(),[Ar,jr]=Dr(Er),Mr=Tr(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=kr(t),l=H.useRef(null),[u,d]=y({prop:i,defaultProp:a??!1,onChange:o,caller:Er});return(0,K.jsx)(Ar,{scope:t,triggerId:j(),triggerRef:l,contentId:j(),open:u,onOpenChange:d,onOpenToggle:H.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,K.jsx)(Rn,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),Nr=`DropdownMenuTrigger`,Pr=H.forwardRef(Tr(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=jr(Nr,n),o=kr(n),s=z(t,a.triggerRef);return(0,K.jsx)(zn,{asChild:!0,...o,children:(0,K.jsx)(I.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:P(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:P(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),Fr=Tr(e=>{let{__scopeDropdownMenu:t,...n}=e,r=kr(t);return(0,K.jsx)(Un,{...r,...n})},`DropdownMenuPortal`),Ir=`DropdownMenuContent`,Lr=H.forwardRef(Tr(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=jr(Ir,n),a=kr(n),o=H.useRef(!1);return(0,K.jsx)(qn,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:P(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:P(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`)),Rr=H.forwardRef(Tr(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=kr(n);return(0,K.jsx)(tr,{...i,...r,ref:t})},`DropdownMenuItem`)),zr=H.forwardRef(Tr(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=kr(n);return(0,K.jsx)(ar,{...i,...r,ref:t})},`DropdownMenuRadioGroup`)),Br=H.forwardRef(Tr(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=kr(n);return(0,K.jsx)(sr,{...i,...r,ref:t})},`DropdownMenuRadioItem`)),Vr=H.forwardRef(Tr(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=kr(n);return(0,K.jsx)(dr,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),Hr=H.forwardRef(Tr(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=kr(n);return(0,K.jsx)(fr,{...i,...r,ref:t})},`DropdownMenuSeparator`)),Ur=Object.defineProperty,Wr=H.forwardRef(((e,t)=>Ur(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,K.jsx)(I.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),Gr=Object.defineProperty,Kr=(e,t)=>Gr(e,`name`,{value:t,configurable:!0});function qr(e,[t,n]){return Math.min(n,Math.max(t,e))}Kr(qr,`clamp`);var Jr=Object.defineProperty,Yr=(e,t)=>Jr(e,`name`,{value:t,configurable:!0}),Xr=`Popover`,[Zr,Qr]=we(Xr,[Le]),$r=Le(),[ei,ti]=Zr(Xr),ni=Yr(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=$r(t),c=H.useRef(null),[l,u]=H.useState(!1),[d,f]=H.useState(0),[p,m]=H.useState(0),[h,g]=y({prop:r,defaultProp:i??!1,onChange:a,caller:Xr});return(0,K.jsx)(ze,{...s,children:(0,K.jsx)(ei,{scope:t,contentId:j(),titleId:j(),descriptionId:j(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,triggerRef:c,open:h,onOpenChange:g,onOpenToggle:H.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:l,onCustomAnchorAdd:H.useCallback(()=>u(!0),[]),onCustomAnchorRemove:H.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),ri=`PopoverTrigger`,ii=H.forwardRef(Yr(function(e,t){let{__scopePopover:n,...r}=e,i=ti(ri,n),a=$r(n),o=z(t,i.triggerRef),s=(0,K.jsx)(I.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":hi(i.open),...r,ref:o,onClick:P(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,K.jsx)(He,{asChild:!0,...a,children:s})},`PopoverTrigger`)),ai=`PopoverPortal`,[oi,si]=Zr(ai,{forceMount:void 0}),ci=Yr(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=ti(ai,t);return(0,K.jsx)(oi,{scope:t,forceMount:n,children:(0,K.jsx)(k,{present:n||a.open,children:(0,K.jsx)(w,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),li=`PopoverContent`,ui=H.forwardRef(Yr(function(e,t){let n=si(li,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=ti(li,e.__scopePopover);return(0,K.jsx)(k,{present:r||a.open,children:a.modal?(0,K.jsx)(fi,{...i,ref:t}):(0,K.jsx)(pi,{...i,ref:t})})},`PopoverContent`)),di=be(`PopoverContent.RemoveScroll`),fi=H.forwardRef(Yr(function(e,t){let n=ti(li,e.__scopePopover),r=H.useRef(null),i=z(t,r),a=H.useRef(!1),{nodes:o,registry:s}=E();return H.useEffect(()=>{let e=r.current;if(e)return Xe(e)},[]),(0,K.jsx)(Ge,{as:di,allowPinchZoom:!0,shards:H.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,K.jsx)(mi,{...e,ref:i,branchNodes:o,branchRegistry:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:P(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:P(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:P(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),pi=H.forwardRef(Yr(function(e,t){let n=ti(li,e.__scopePopover),r=H.useRef(!1),i=H.useRef(!1);return(0,K.jsx)(mi,{...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`)),mi=H.forwardRef(Yr(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,"aria-describedby":d,branchNodes:f,branchRegistry:p,...m}=e,h=ti(li,n),g=$r(n),[_,v]=H.useState(null),y=z(t,v);return C(_),st(),(0,K.jsx)(ae,{registry:p,children:(0,K.jsx)(re,{asChild:!0,loop:!0,trapped:r,branches:f,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,K.jsx)(Se,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>h.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,K.jsx)(Pe,{"data-state":hi(h.open),role:`dialog`,id:h.contentId,"aria-labelledby":h.titlePresent?h.titleId:void 0,"aria-describedby":h.descriptionPresent?gi(d,h.descriptionId):d,...g,...m,ref:y,style:{...m.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 hi(e){return e?`open`:`closed`}Yr(hi,`getState`);function gi(...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}Yr(gi,`concatAriaDescribedby`);var _i=t(i(),1),vi=Object.defineProperty,J=(e,t)=>vi(e,`name`,{value:t,configurable:!0}),yi={ItemAligned:`item-aligned`,Popper:`popper`},bi={LTR:`ltr`,RTL:`rtl`},xi=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Si=[` `,`Enter`],Ci=`Select`,[wi,Ti,Ei]=De(Ci),[Di,Oi]=we(Ci,[Ei,Le]),ki=Le(),[Ai,ji]=Di(Ci),[Mi,Ni]=Di(Ci);function Pi(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=ki(t),[_,v]=H.useState(null),[b,x]=H.useState(null),[S,C]=H.useState(!1),w=oe(l),[T,E]=y({prop:r,defaultProp:i??!1,onChange:a,caller:Ci}),[ee,D]=y({prop:o,defaultProp:s,onChange:c,caller:Ci}),te=H.useRef(null),O=H.useRef(!1),[k,ne]=H.useState(null),re=J(e=>{ne({value:e,hasConsumerStoppedPropagation:O.current}),D(e)},`handleUserSelect`),ie=H.useRef(ee);H.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=J(()=>D(ie.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,D]);let ae=!_||!!m||!!_.closest(`form`),[A,M]=H.useState(new Set),N=j(),se=Array.from(A).map(e=>e.props.value).join(`;`),ce=H.useCallback(e=>{M(t=>new Set(t).add(e))},[]),le=H.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),ue={required:p,trigger:_,onTriggerChange:v,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:N,value:ee,onValueChange:D,hasConsumerStoppedPropagationRef:O,userSelection:k,onUserSelect:re,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:te,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:A,nativeSelectKey:se,isFormControl:ae};return(0,K.jsx)(ze,{...g,children:(0,K.jsx)(Ai,{scope:t,...ue,children:(0,K.jsx)(wi.Provider,{scope:t,children:(0,K.jsx)(Mi,{scope:t,onNativeOptionAdd:ce,onNativeOptionRemove:le,children:ga(h)?h(ue):n})})})})}J(Pi,`SelectProvider`);var Fi=J(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,K.jsx)(Pi,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,K.jsxs)(K.Fragment,{children:[n,e?(0,K.jsx)(ha,{__scopeSelect:t}):null]})})},`Select`),Ii=`SelectTrigger`,Li=H.forwardRef(J(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=ki(n),o=ji(Ii,n),s=o.disabled||r,c=z(t,o.onTriggerChange),l=Ti(n),u=H.useRef(`touch`),[d,f,p]=va(e=>{let t=l().filter(e=>!e.disabled),n=ya(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onUserSelect(n.value)}),m=J(e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,K.jsx)(He,{asChild:!0,...a,children:(0,K.jsx)(I.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":_a(o.value)?``:void 0,...i,ref:c,onClick:P(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:P(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:P(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&(o.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),f(e.key)),t&&e.key===` `||xi.includes(e.key)&&(m(),e.preventDefault())})})})},`SelectTrigger`)),Ri=`SelectValue`,zi=H.forwardRef(J(function(e,t){let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=ji(Ri,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=z(t,c.onValueNodeChange);ve(()=>{l(u)},[l,u]);let f=_a(c.value);return(0,K.jsx)(I.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,K.jsx)(H.Fragment,{children:f?o:a},f?`placeholder`:`value`)})},`SelectValue`)),Bi=H.forwardRef(J(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,K.jsx)(I.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[Vi,Hi]=Di(`SelectPortal`,{forceMount:void 0}),Ui=J(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,K.jsx)(Vi,{scope:e.__scopeSelect,forceMount:n,children:(0,K.jsx)(w,{asChild:!0,...r})})},`SelectPortal`),Wi=`SelectContent`,Gi=H.forwardRef(J(function(e,t){let n=Hi(Wi,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=ji(Wi,e.__scopeSelect),[o,s]=H.useState();return ve(()=>{s(new DocumentFragment)},[]),(0,K.jsx)(k,{present:r||a.open,children:({present:e})=>e?(0,K.jsx)(Zi,{...i,ref:t}):(0,K.jsx)(Ki,{...i,fragment:o})})},`SelectContent`)),Ki=H.forwardRef(J(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?_i.createPortal((0,K.jsx)(Ji,{scope:n,children:(0,K.jsx)(wi.Slot,{scope:n,children:(0,K.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),qi=10,[Ji,Yi]=Di(Wi),Xi=be(`SelectContent.RemoveScroll`),Zi=H.forwardRef(J(function(e,t){let{__scopeSelect:n}=e,{position:r=yi.ItemAligned,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=ji(Wi,n),[y,b]=H.useState(null),[x,S]=H.useState(null),C=z(t,b),[w,T]=H.useState(null),[E,ee]=H.useState(null),D=Ti(n),[te,O]=H.useState(!1),k=H.useRef(!1),ne=H.useRef(!1),ie=H.useRef(!1);H.useEffect(()=>{if(y)return Xe(y)},[y]),st();let ae=H.useCallback(e=>{let[t,...n]=D().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[D,x]),oe=H.useCallback(()=>ae([w,y]),[ae,w,y]);H.useEffect(()=>{te&&oe()},[te,oe]);let{onOpenChange:A,triggerPointerDownPosRef:j}=v;H.useEffect(()=>{if(y){let e={x:0,y:0},t=J(t=>{e={x:Math.abs(Math.round(t.pageX)-(j.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(j.current?.y??0))}},`handlePointerMove`),n=J(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||A(!1),document.removeEventListener(`pointermove`,t),j.current=null},`handlePointerUp`);return j.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,A,j]),H.useEffect(()=>{let e=J(()=>A(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[A]);let[M,N]=va(e=>{let t=D().filter(e=>!e.disabled),n=ya(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),se=H.useCallback((e,t,n)=>{let r=!ne.current;r&&(ne.current=!0);let i=!k.current&&!n;v.value!==void 0&&v.value===t||i?(T(e),i&&(k.current=!0)):r&&T(e)},[v.value]),ce=H.useCallback(()=>y?.focus(),[y]),le=H.useCallback((e,t,n)=>{if(!e)return;let r=!ie.current;r&&(ie.current=!0);let i=!k.current&&!n;(v.value!==void 0&&v.value===t||i||r)&&ee(e)},[v.value]),ue=r===yi.Popper?$i:Qi,F=ue===$i?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,K.jsx)(Ji,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:se,selectedItem:w,onItemLeave:ce,itemTextRefCallback:le,focusSelectedItem:oe,selectedItemText:E,position:r,isPositioned:te,searchRef:M,children:(0,K.jsx)(Ge,{as:Xi,allowPinchZoom:!0,children:(0,K.jsx)(re,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:P(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,K.jsx)(Se,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,K.jsx)(ue,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...F,onPlaced:()=>O(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:P(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&N(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=D().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>ae(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),Qi=H.forwardRef(J(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,a=ji(Wi,n),o=Yi(Wi,n),[s,c]=H.useState(null),[l,u]=H.useState(null),d=z(t,u),f=Ti(n),p=H.useRef(!1),m=H.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=H.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==bi.RTL){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-qi,d=qr(a,[qi,Math.max(qi,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-qi,d=qr(a,[qi,Math.max(qi,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-qi*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-qi,ee=c-E,D=g.offsetHeight/2,te=g.offsetTop+D,O=m+v+te,k=x-O;if(O<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=O+Math.max(ee,D+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+D)+k;s.style.height=t+`px`,h.scrollTop=O-E+h.offsetTop}s.style.margin=`${qi}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);ve(()=>y(),[y]);let[b,x]=H.useState();ve(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]);let S=H.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]);return(0,K.jsx)(ea,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:S,children:(0,K.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,K.jsx)(I.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),$i=H.forwardRef(J(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=qi,...a}=e,o=ki(n);return(0,K.jsx)(Pe,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[ea,ta]=Di(Wi,{}),na=`SelectViewport`,ra=H.forwardRef(J(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=Yi(na,n),o=ta(na,n),s=z(t,a.onViewportChange),c=H.useRef(0);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,K.jsx)(wi.Slot,{scope:n,children:(0,K.jsx)(I.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:P(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-qi*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})},`SelectViewport`)),[ia,aa]=Di(`SelectGroup`),oa=`SelectItem`,[sa,ca]=Di(oa),la=H.forwardRef(J(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=ji(oa,n),c=Yi(oa,n),l=s.value===r,[u,d]=H.useState(a??``),[f,p]=H.useState(!1),m=A(e=>c.itemRefCallback?.(e,r,i)),h=z(t,m),g=j(),_=H.useRef(`touch`);function v(e){s.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),s.onUserSelect(r),s.onOpenChange(!1)}return J(v,`handleSelect`),(0,K.jsx)(sa,{scope:n,value:r,disabled:i,textId:g,isSelected:l,onItemTextChange:H.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,K.jsx)(wi.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,K.jsx)(I.div,{role:`option`,"aria-labelledby":g,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:h,onFocus:P(o.onFocus,()=>p(!0)),onBlur:P(o.onBlur,()=>p(!1)),onClick:P(o.onClick,e=>{i||_.current!==`mouse`&&v(e)}),onPointerUp:P(o.onPointerUp,e=>{i||_.current===`mouse`&&v(e)}),onPointerDown:P(o.onPointerDown,e=>{_.current=e.pointerType}),onPointerMove:P(o.onPointerMove,e=>{_.current=e.pointerType,i?c.onItemLeave?.():_.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:P(o.onKeyDown,e=>{i||e.target!==e.currentTarget||(c.searchRef?.current===``||e.key!==` `)&&(Si.includes(e.key)&&v(e),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),ua=`SelectItemText`,da=H.forwardRef(J(function(e,t){let{__scopeSelect:n,className:r,style:i,...a}=e,o=ji(ua,n),s=Yi(ua,n),c=ca(ua,n),l=Ni(ua,n),[u,d]=H.useState(null),f=A(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=z(t,d,c.onItemTextChange,f),m=u?.textContent,h=H.useMemo(()=>(0,K.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return ve(()=>(g(h),()=>_(h)),[g,_,h]),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(I.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!_a(o.value)?_i.createPortal(a.children,o.valueNode):null]})},`SelectItemText`)),fa=`SelectItemIndicator`,pa=H.forwardRef(J(function(e,t){let{__scopeSelect:n,...r}=e;return ca(fa,n).isSelected?(0,K.jsx)(I.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),ma=`SelectBubbleInput`,ha=H.forwardRef(J(function({__scopeSelect:e,...t},n){let r=ji(ma,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u,userSelection:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,m=H.useRef(null),h=z(n,m),g=i??``,_=H.useRef(g),v=H.useRef(d),y=H.useRef(!1),b=Array.from(f).some(e=>(e.props.value??``)===``);return H.useEffect(()=>{let e=m.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set,r=d!==null&&d!==v.current;v.current=d;let i=_.current!==g;_.current=g;let a=r&&i;if(r&&!i&&d.value!==g&&!d.hasConsumerStoppedPropagation&&n){y.current=!0;try{n.call(e,d.value),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}finally{y.current=!1,n.call(e,g)}return}let o=a&&!d.hasConsumerStoppedPropagation;if(i&&n){let t=new Event(`change`,{bubbles:o});n.call(e,g),e.dispatchEvent(t)}},[g,d]),(0,K.jsxs)(I.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>{y.current||a(e.target.value)},...t,style:{...Fe,...t.style},ref:h,defaultValue:g,children:[_a(i)&&!b?(0,K.jsx)(`option`,{value:``}):null,Array.from(f)]},p)},`SelectBubbleInput`));function ga(e){return typeof e==`function`}J(ga,`isFunction`);function _a(e){return e===``||e===void 0}J(_a,`shouldShowPlaceholder`);function va(e){let t=A(e),n=H.useRef(``),r=H.useRef(0),i=H.useCallback(e=>{let i=n.current+e;t(i);function a(e){n.current=e,window.clearTimeout(r.current),e!==``&&(r.current=window.setTimeout(()=>a(``),1e3))}J(a,`updateSearch`),a(i)},[t]),a=H.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return H.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}J(va,`useTypeaheadSearch`);function ya(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=ba(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}J(ya,`findNextItem`);function ba(e,t){return e.map((n,r)=>e[(t+r)%e.length])}J(ba,`wrapArray`);var xa=Object.defineProperty,Sa=(e,t)=>xa(e,`name`,{value:t,configurable:!0}),Ca={Horizontal:`horizontal`,Vertical:`vertical`},wa=Ca.Horizontal,Ta=Object.values(Ca),Ea=H.forwardRef(Sa(function(e,t){let{decorative:n,orientation:r=wa,...i}=e,a=Da(r)?r:wa,o=a===Ca.Vertical?a:void 0,s=n?{role:`none`}:{"aria-orientation":o,role:`separator`};return(0,K.jsx)(I.div,{"data-orientation":a,...s,...i,ref:t})},`Separator`));function Da(e){return Ta.includes(e)}Sa(Da,`isValidOrientation`);var Oa=Object.defineProperty,ka=(e,t)=>Oa(e,`name`,{value:t,configurable:!0}),Aa=`Switch`,[ja,Ma]=we(Aa),[Na,Pa]=ja(Aa);function Fa(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=y({prop:n,defaultProp:i??!1,onChange:c,caller:Aa}),[m,h]=H.useState(null),[g,_]=H.useState(null),[v,b]=H.useState(null),x={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,userClick:v,onUserClick:b,required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,K.jsx)(Na,{scope:t,...x,children:Ua(d)?d(x):r})}ka(Fa,`SwitchProvider`);var Ia=`SwitchTrigger`,La=H.forwardRef(ka(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:f,isFormControl:p,bubbleInput:m}=Pa(Ia,e),h=z(r,u),g=H.useRef(c);return H.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=ka(()=>d(g.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,K.jsx)(I.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":Wa(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:h,onClick:P(t,e=>{let t=e.isPropagationStopped();f({requestedChecked:!c,hasConsumerStoppedPropagation:t}),d(e=>!e),m&&p&&(t||e.stopPropagation())})})},`SwitchTrigger`)),Ra=H.forwardRef(ka(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,K.jsx)(Fa,{__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,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(La,{...d,ref:t,__scopeSwitch:n}),e&&(0,K.jsx)(Ha,{__scopeSwitch:n})]})})},`Switch`)),za=`SwitchThumb`,Ba=H.forwardRef(ka(function(e,t){let{__scopeSwitch:n,...r}=e,i=Pa(za,n);return(0,K.jsx)(I.span,{"data-state":Wa(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),Va=`SwitchBubbleInput`,Ha=H.forwardRef(ka(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:f,bubbleInput:p,setBubbleInput:m}=Pa(Va,e),h=z(r,m),g=We(i),_=H.useRef(!1),v=H.useRef(o),y=H.useRef(a),b=H.useRef(null);H.useEffect(()=>{let e=p;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=v.current!==o;v.current=o;let i=a!==null&&a!==y.current;if(y.current=a,i)b.current=r?null:a,r&&n.call(e,o),e.dispatchEvent(new Event(`click`,{bubbles:!a.hasConsumerStoppedPropagation}));else if(r){let t=b.current;b.current=null;let r=t?.requestedChecked===o;_.current=!0,n.call(e,o),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),_.current=!1}},[p,o,a]);let x=H.useRef(o);return(0,K.jsx)(I.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??x.current,required:c,disabled:l,name:u,value:d,form:f,...n,tabIndex:-1,ref:h,onClick:P(t,e=>{_.current&&e.stopPropagation()}),style:{...n.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function Ua(e){return typeof e==`function`}ka(Ua,`isFunction`);function Wa(e){return e?`checked`:`unchecked`}ka(Wa,`getState`);var Ga=Object.defineProperty,Ka=(e,t)=>Ga(e,`name`,{value:t,configurable:!0}),qa={Automatic:`automatic`,Manual:`manual`},Ja=`Tabs`,[Ya,Xa]=we(Ja,[ie]),Za=ie(),[Qa,$a]=Ya(Ja),eo=H.forwardRef(Ka(function(e,t){let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=qa.Automatic,...l}=e,u=oe(s),[d,f]=y({prop:r,onChange:i,defaultProp:a??``,caller:Ja});return(0,K.jsx)(Qa,{scope:n,baseId:j(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,K.jsx)(I.div,{dir:u,"data-orientation":o,...l,ref:t})})},`Tabs`)),to=`TabsList`,no=H.forwardRef(Ka(function(e,t){let{__scopeTabs:n,loop:r=!0,...i}=e,a=$a(to,n),o=Za(n);return(0,K.jsx)(Me,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,K.jsx)(I.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})},`TabsList`)),ro=`TabsTrigger`,io=H.forwardRef(Ka(function(e,t){let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=$a(ro,n),s=Za(n),c=so(o.baseId,r),l=co(o.baseId,r),u=r===o.value;return(0,K.jsx)(x,{asChild:!0,...s,focusable:!i,active:u,children:(0,K.jsx)(I.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:P(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?(e.currentTarget.focus(),o.onValueChange(r)):e.preventDefault()}),onKeyDown:P(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:P(e.onFocus,()=>{let e=o.activationMode!==qa.Manual;!u&&!i&&e&&o.onValueChange(r)})})})},`TabsTrigger`)),ao=`TabsContent`,oo=H.forwardRef(Ka(function(e,t){let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=$a(ao,n),c=so(s.baseId,r),l=co(s.baseId,r),u=r===s.value,d=H.useRef(u);return H.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,K.jsx)(k,{present:i||u,children:({present:n})=>(0,K.jsx)(I.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 so(e,t){return`${e}-trigger-${t}`}Ka(so,`makeTriggerId`);function co(e,t){return`${e}-content-${t}`}Ka(co,`makeContentId`);var lo=Object.defineProperty,uo=(e,t)=>lo(e,`name`,{value:t,configurable:!0}),fo=`Toolbar`,[po,mo]=we(fo,[ie,ne]),ho=ie(),go=ne(),[_o,vo]=po(fo),yo=H.forwardRef(uo(function(e,t){let{__scopeToolbar:n,orientation:r=`horizontal`,dir:i,loop:a=!0,...o}=e,s=ho(n),c=oe(i);return(0,K.jsx)(_o,{scope:n,orientation:r,dir:c,children:(0,K.jsx)(Me,{asChild:!0,...s,orientation:r,dir:c,loop:a,children:(0,K.jsx)(I.div,{role:`toolbar`,"aria-orientation":r,dir:c,...o,ref:t})})})},`Toolbar`)),bo=`ToolbarSeparator`,xo=H.forwardRef(uo(function(e,t){let{__scopeToolbar:n,...r}=e,i=vo(bo,n);return(0,K.jsx)(Ea,{orientation:i.orientation===`horizontal`?`vertical`:`horizontal`,...r,ref:t})},`ToolbarSeparator`)),So=H.forwardRef(uo(function(e,t){let{__scopeToolbar:n,...r}=e,i=ho(n);return(0,K.jsx)(x,{asChild:!0,...i,focusable:!e.disabled,children:(0,K.jsx)(I.button,{type:`button`,...r,ref:t})})},`ToolbarButton`)),Co=`ToolbarToggleGroup`,wo=H.forwardRef(uo(function(e,t){let{__scopeToolbar:n,...r}=e,i=vo(Co,n),a=go(n);return(0,K.jsx)(T,{"data-orientation":i.orientation,dir:i.dir,...a,...r,ref:t,rovingFocus:!1})},`ToolbarToggleGroup`)),To=H.forwardRef(uo(function(e,t){let{__scopeToolbar:n,...r}=e,i=go(n),a={__scopeToolbar:e.__scopeToolbar};return(0,K.jsx)(So,{asChild:!0,...a,children:(0,K.jsx)(ee,{...i,...r,ref:t})})},`ToolbarToggleItem`)),Eo=Object.defineProperty,Y=(e,t)=>Eo(e,`name`,{value:t,configurable:!0}),[Do,Oo]=we(`Tooltip`,[Le]),ko=Le(),Ao=`TooltipProvider`,jo=700,Mo=`tooltip.open`,[No,Po]=Do(Ao),Fo=Y(e=>{let{__scopeTooltip:t,delayDuration:n=jo,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=H.useRef(!0),s=H.useRef(!1),c=H.useRef(0);return H.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,K.jsx)(No,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:H.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:H.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:H.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),Io=`Tooltip`,[Lo,Ro]=Do(Io),zo=Y(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Po(Io,e.__scopeTooltip),l=ko(t),[u,d]=H.useState(null),[f,p]=H.useState(void 0),m=j(),h=H.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,v=H.useRef(!1),[b,x]=y({prop:r,defaultProp:i??!1,onChange:Y(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Mo))):c.onClose(),a?.(e)},`onChange`),caller:Io}),S=H.useMemo(()=>b?v.current?`delayed-open`:`instant-open`:`closed`,[b]),C=H.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,x(!0)},[x]),w=H.useCallback(()=>{window.clearTimeout(h.current),h.current=0,x(!1)},[x]),T=H.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,x(!0),h.current=0},_)},[_,x]);H.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]);let E=f??m;return(0,K.jsx)(ze,{...l,children:(0,K.jsx)(Lo,{scope:t,contentId:E,setContentId:p,open:b,stateAttribute:S,trigger:u,onTriggerChange:d,onTriggerEnter:H.useCallback(()=>{c.isOpenDelayedRef.current?T():C()},[c.isOpenDelayedRef,T,C]),onTriggerLeave:H.useCallback(()=>{g?w():(window.clearTimeout(h.current),h.current=0)},[w,g]),onOpen:C,onClose:w,disableHoverableContent:g,children:n})})},`Tooltip`),Bo=`TooltipTrigger`,Vo=H.forwardRef(Y(function(e,t){let{__scopeTooltip:n,"aria-describedby":r,...i}=e,a=Ro(Bo,n),o=Po(Bo,n),s=ko(n),c=H.useRef(null),l=z(t,c,a.onTriggerChange),u=H.useRef(!1),d=H.useRef(!1),f=H.useCallback(()=>u.current=!1,[]);return H.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,K.jsx)(He,{asChild:!0,...s,children:(0,K.jsx)(I.button,{"aria-describedby":a.open?rs(r,a.contentId):r,"data-state":a.stateAttribute,...i,ref:l,onPointerMove:P(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),d.current=!0)}),onPointerLeave:P(e.onPointerLeave,()=>{a.onTriggerLeave(),d.current=!1}),onPointerDown:P(e.onPointerDown,()=>{a.open&&a.onClose(),u.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:P(e.onFocus,()=>{u.current||a.onOpen()}),onBlur:P(e.onBlur,a.onClose),onClick:P(e.onClick,a.onClose)})})},`TooltipTrigger`)),Ho=`TooltipPortal`,[Uo,Wo]=Do(Ho,{forceMount:void 0}),Go=Y(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Ro(Ho,t);return(0,K.jsx)(Uo,{scope:t,forceMount:n,children:(0,K.jsx)(k,{present:n||a.open,children:(0,K.jsx)(w,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),Ko=`TooltipContent`,qo=H.forwardRef(Y(function(e,t){let n=Wo(Ko,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Ro(Ko,e.__scopeTooltip);return(0,K.jsx)(k,{present:r||o.open,children:o.disableHoverableContent?(0,K.jsx)(Xo,{side:i,...a,ref:t}):(0,K.jsx)(Jo,{side:i,...a,ref:t})})},`TooltipContent`)),Jo=H.forwardRef(Y(function(e,t){let n=Ro(Ko,e.__scopeTooltip),r=Po(Ko,e.__scopeTooltip),i=H.useRef(null),a=z(t,i),[o,s]=H.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=H.useCallback(()=>{s(null),d(!1)},[d]),p=H.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Qo(r,Zo(r,n.getBoundingClientRect())),a=$o(t.getBoundingClientRect()),o=ts([...i,...a]);s(o),d(!0)},[d]);return H.useEffect(()=>()=>f(),[f]),H.useEffect(()=>{if(c&&u){let e=Y(e=>p(e,u),`handleTriggerLeave`),t=Y(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]),H.useEffect(()=>{if(o){let e=Y(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!es(n,o);r?f():i&&(f(),l())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,K.jsx)(Xo,{...e,ref:a})},`TooltipContentHoverable`)),Yo=Te(`TooltipContent`),Xo=H.forwardRef(Y(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=Ro(Ko,n),u=ko(n),{onClose:d}=l,[f,p]=H.useState(null),m=z(t,p);C(f),H.useEffect(()=>(document.addEventListener(Mo,d),()=>document.removeEventListener(Mo,d)),[d]),H.useEffect(()=>{if(l.trigger){let e=Y(e=>{e.target instanceof Node&&e.target.contains(l.trigger)&&d()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]);let{setContentId:h}=l;return ve(()=>(h(a),()=>{h(void 0)}),[a,h]),(0,K.jsx)(Se,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,K.jsxs)(Pe,{"data-state":l.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:l.contentId,...u,...c,ref:m,style:{...c.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,K.jsx)(Yo,{children:r}),i?(0,K.jsx)(Ie,{id:l.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`));function Zo(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`)}}Y(Zo,`getExitSideFromRect`);function Qo(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}Y(Qo,`getPaddedExitPoints`);function $o(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}]}Y($o,`getPointsFromRect`);function es(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}Y(es,`isPointInPolygon`);function ts(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)),ns(t)}Y(ts,`getHull`);function ns(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)}Y(ns,`getHullPresorted`);function rs(...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}Y(rs,`concatAriaDescribedby`);function is({delayDuration:e=300,...t}){return(0,K.jsx)(Fo,{delayDuration:e,...t})}var as=zo,os=Vo;function ss({className:e,sideOffset:t=4,children:n,...r}){return(0,K.jsx)(Go,{children:(0,K.jsx)(qo,{sideOffset:t,className:S(`z-50 max-w-xs rounded-md bg-foreground px-2 py-1 text-xs text-background`,e),...r,children:n})})}var cs={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`}]]};cs.node;var ls=O(cs),us={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};us.node;var ds=O(us),fs={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};fs.node;var ps=O(fs),ms={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};ms.node;var hs=O(ms),gs={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`}]]};gs.node;var _s=O(gs),vs={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`}]]};vs.node;var ys=O(vs),bs={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`]};bs.node;var xs=O(bs),Ss={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Ss.node;var Cs=O(Ss),ws={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};ws.node;var Ts=O(ws),Es={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};Es.node;var Ds=O(Es),Os={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};Os.node;var ks=O(Os),As={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`]};As.node;var js=O(As),Ms={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`}]]};Ms.node;var Ns=O(Ms),Ps={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`]};Ps.node;var Fs=O(Ps),Is={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`]};Is.node;var Ls=O(Is),Rs={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`]};Rs.node;var zs=O(Rs),Bs={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};Bs.node;var Vs=O(Bs),Hs={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};Hs.node;var Us=O(Hs),Ws={name:`code-xml`,size:24,node:[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]],aliases:[`code-2`]};Ws.node;var Gs=O(Ws),Ks={name:`code`,size:24,node:[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]};Ks.node;var qs=O(Ks),Js={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`}]]};Js.node;var Ys=O(Js),Xs={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`}]]};Xs.node;var Zs=O(Xs),Qs={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`]};Qs.node;var $s=O(Qs),ec={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`}]]};ec.node;var tc=O(ec),nc={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`}]]};nc.node;var rc=O(nc),ic={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`}]]};ic.node;var ac=O(ic),oc={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`}]]};oc.node;var sc=O(oc),cc={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`}]]};cc.node;var lc=O(cc),uc={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`}]]};uc.node;var dc=O(uc),fc={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`}]]};fc.node;var pc=O(fc),mc={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};mc.node;var hc=O(mc),gc={name:`heading-2`,size:24,node:[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1`,key:`9jr5yi`}]]};gc.node;var _c=O(gc),vc={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`}]]};vc.node;var yc=O(vc),bc={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`]};bc.node;var xc=O(bc),Sc={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`}]]};Sc.node;var Cc=O(Sc),wc={name:`italic`,size:24,node:[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]};wc.node;var Tc=O(wc),Ec={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`}]]};Ec.node;var Dc=O(Ec),Oc={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};Oc.node;var kc=O(Oc),Ac={name:`letter-b`,size:24,node:[[`path`,{d:`M6 12h9a4 4 0 010 8H7a1 1 0 01-1-1V5a1 1 0 011-1h7a4 4 0 010 8`,key:`n8tvfh`}]],aliases:[`bold`]};Ac.node;var jc=O(Ac),Mc={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};Mc.node;var Nc=O(Mc),Pc={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};Pc.node;var Fc=O(Pc),Ic={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};Ic.node;var Lc=O(Ic),Rc={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`}]]};Rc.node;var zc=O(Rc),Bc={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};Bc.node;var Vc=O(Bc),Hc={name:`maximize-2`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]};Hc.node;var Uc=O(Hc),Wc={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};Wc.node;var Gc=O(Wc),Kc={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`]};Kc.node;var qc=O(Kc),Jc={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`}]]};Jc.node;var Yc=O(Jc),Xc={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};Xc.node;var Zc=O(Xc),Qc={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`}]]};Qc.node;var $c=O(Qc),el={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`}]]};el.node;var tl=O(el),nl={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`}]]};nl.node;var rl=O(nl),il={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`}]]};il.node;var al=O(il),ol={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`}]]};ol.node;var sl=O(ol),cl={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`}]]};cl.node;var ll=O(cl),ul={name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]};ul.node;var dl=O(ul),fl={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`}]]};fl.node;var pl=O(fl),ml={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};ml.node;var hl=O(ml),gl={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};gl.node;var _l=O(gl),vl={name:`quote`,size:24,node:[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]};vl.node;var yl=O(vl),bl={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`}]]};bl.node;var xl=O(bl),Sl={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Sl.node;var Cl=O(Sl),wl={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`}]]};wl.node;var Tl=O(wl),El={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`}]]};El.node;var Dl=O(El),Ol={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`}]]};Ol.node;var kl=O(Ol),Al={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`}]]};Al.node;var jl=O(Al),Ml={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`}]]};Ml.node;var Nl=O(Ml),Pl={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`]};Pl.node;var Fl=O(Pl),Il={name:`strikethrough`,size:24,node:[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]};Il.node;var Ll=O(Il),Rl={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`}]]};Rl.node;var zl=O(Rl),Bl={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`]};Bl.node;var Vl=O(Bl),Hl={name:`truck`,size:24,node:[[`path`,{d:`M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2`,key:`wrbu53`}],[`path`,{d:`M15 18H9`,key:`1lyqi6`}],[`path`,{d:`M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14`,key:`lysw3i`}],[`circle`,{cx:`17`,cy:`18`,r:`2`,key:`332jqn`}],[`circle`,{cx:`7`,cy:`18`,r:`2`,key:`19iecd`}]]};Hl.node;var Ul=O(Hl),Wl={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]};Wl.node;var Gl=O(Wl),Kl={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`}]]};Kl.node;var ql=O(Kl),Jl={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`}]]};Jl.node;var Yl=O(Jl),Xl={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};Xl.node;var Zl=O(Xl),Ql=[{view:`runs`,labelKey:`runs`,icon:ls,key:`r`},{view:`queue`,labelKey:`queue`,icon:d,key:`q`},{view:`specialists`,labelKey:`specialists`,icon:ql,key:`s`},{view:`pipelines`,labelKey:`pipelines`,icon:dc,key:`b`},{view:`stats`,labelKey:`stats`,icon:xs,key:`t`},{view:`settings`,labelKey:`settings`,icon:kl,key:`c`}];function $l(e,t){let n=Ql.find(t=>t.view===e);return n?t(`nav.${n.labelKey}`):e}var eu=qe,tu=Ze;function nu({className:e,side:t=`left`,children:n,...r}){return(0,K.jsxs)(rt,{children:[(0,K.jsx)(Ye,{className:`fixed inset-0 z-50 bg-black/50`}),(0,K.jsx)(ot,{className:S(`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 ru({className:e,...t}){return(0,K.jsx)(et,{className:S(`text-sm font-semibold`,e),...t})}function iu({className:e,...t}){return(0,K.jsx)(Je,{className:S(`sr-only`,e),...t})}var au=`[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]`,ou=`input, textarea, select, [role="combobox"], [contenteditable=""], [contenteditable="true"]`;function su(){return typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)}function cu(){return su()?`⌘`:`Ctrl`}var lu=/^[a-z]$/;function uu(e,t){return lu.test(e)?t.code?t.code===`Key${e.toUpperCase()}`:t.key.toLowerCase()===e:t.key===e}function du(e,t){if(e.startsWith(`mod+`))return(su()?t.metaKey:t.ctrlKey)&&!t.altKey&&uu(e.slice(4),t);if(e.startsWith(`ctrl+`)){let n=e.slice(5);return t.ctrlKey&&!t.metaKey&&!t.altKey&&!(lu.test(n)&&t.shiftKey)&&uu(n,t)}return t.metaKey||t.ctrlKey||t.altKey||lu.test(e)&&t.shiftKey?!1:uu(e,t)}function fu(e){if(e.startsWith(`mod+`))return[cu(),e.slice(4).toUpperCase()];if(e.startsWith(`ctrl+`))return[`Ctrl`,e.slice(5).toUpperCase()];let t={Escape:`Esc`,ArrowUp:`↑`,ArrowDown:`↓`};return e.split(/ |\+/).map(e=>t[e]??e)}function pu(e){return!!((e.target instanceof Element?e.target:null)?.closest(ou)||document.querySelector(au))}function mu(e,t,n={}){let r=(0,H.useRef)(t);r.current=t;let i=n.allowInInputs??e.startsWith(`mod+`);(0,H.useEffect)(()=>{let t=t=>{du(e,t)&&(i||!pu(t))&&r.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,i])}var hu=null,gu=new Set;function _u(e){hu=e;for(let t of gu)t(e)}function vu(e,t){let n=n=>{n===e&&(hu=null,t())};return hu===e&&(hu=null,t()),gu.add(n),()=>gu.delete(n)}function yu({className:e,...t}){return(0,K.jsx)(`kbd`,{className:S(`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 bu=Mr,xu=Pr,Su=zr;function Cu({className:e,sideOffset:t=4,...n}){return(0,K.jsx)(Fr,{children:(0,K.jsx)(Lr,{sideOffset:t,className:S(`z-50 min-w-40 rounded-md border bg-card p-1 text-card-foreground shadow-md`,e),...n})})}function wu({className:e,...t}){return(0,K.jsx)(Rr,{className:S(`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 Tu({className:e,children:t,...n}){return(0,K.jsxs)(Br,{className:S(`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,K.jsx)(`span`,{className:`absolute left-2 flex size-4 items-center justify-center`,children:(0,K.jsx)(Vr,{children:(0,K.jsx)(Cs,{className:`size-4`})})}),t]})}function Eu({className:e,...t}){return(0,K.jsx)(Hr,{className:S(`-mx-1 my-1 h-px bg-border`,e),...t})}function Du({className:e,type:t=`text`,...n}){return(0,K.jsx)(`input`,{type:t,className:S(`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 Ou=1,ku=.9,Au=.8,ju=.17,Mu=.1,Nu=.999,Pu=.9999,Fu=.99,Iu=/[\\\/_+.#"@\[\(\{&]/,Lu=/[\\\/_+.#"@\[\(\{&]/g,Ru=/[\s-]/,zu=/[\s-]/g;function Bu(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Ou:Fu;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=Bu(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Ou:Iu.test(e.charAt(l-1))?(d*=Au,p=e.slice(i,l-1).match(Lu),p&&i>0&&(d*=Nu**+p.length)):Ru.test(e.charAt(l-1))?(d*=ku,m=e.slice(i,l-1).match(zu),m&&i>0&&(d*=Nu**+m.length)):(d*=ju,i>0&&(d*=Nu**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Pu)),(d<Mu&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Bu(e,t,n,r,l+1,a+2,o),f*Mu>d&&(d=f*Mu)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Vu(e){return e.toLowerCase().replace(zu,` `)}function Hu(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Bu(e,t,Vu(e),Vu(t),0,0,{})}var Uu=`[cmdk-group=""]`,Wu=`[cmdk-group-items=""]`,Gu=`[cmdk-group-heading=""]`,Ku=`[cmdk-item=""]`,qu=`${Ku}:not([aria-disabled="true"])`,Ju=`cmdk-item-select`,Yu=`data-value`,Xu=(e,t,n)=>Hu(e,t,n),Zu=H.createContext(void 0),Qu=()=>H.useContext(Zu),$u=H.createContext(void 0),ed=()=>H.useContext($u),td=H.createContext(void 0),nd=H.forwardRef((e,t)=>{let n=gd(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=gd(()=>new Set),i=gd(()=>new Map),a=gd(()=>new Map),o=gd(()=>new Set),s=md(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=j(),y=j(),b=j(),x=H.useRef(null),S=yd();hd(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),hd(()=>{S(6,te)},[]);let C=H.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.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`)D(),E(),S(1,ee);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=O()?.id,C.emit()}),r||S(5,te),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=H.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.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]))),S(3,()=>{D(),E(),n.current.value||ee(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=O();S(4,()=>{D(),t?.getAttribute(`id`)===e&&ee(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??Xu;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.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=x.current;k().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(Wu);t?t.appendChild(e.parentElement===t?e:e.closest(`${Wu} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Wu} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${Uu}[${Yu}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function ee(){let e=k().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Yu);C.setState(`value`,e||void 0)}function D(){if(!n.current.search||s.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=T(a.current.get(t)?.value??``,a.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 te(){var e;let t=O();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Uu)?.querySelector(Gu))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function O(){return x.current?.querySelector(`${Ku}[aria-selected="true"]`)}function k(){return Array.from(x.current?.querySelectorAll(qu)||[])}function ne(e){let t=k()[e];t&&C.setState(`value`,t.getAttribute(Yu))}function re(e){var t;let n=O(),r=k(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(Yu))}function ie(e){let t=O()?.closest(Uu),n;for(;t&&!n;)t=e>0?fd(t,Uu):pd(t,Uu),n=t?.querySelector(qu);n?C.setState(`value`,n.getAttribute(Yu)):re(e)}let ae=()=>ne(k().length-1),oe=e=>{e.preventDefault(),e.metaKey?ae():e.altKey?ie(1):re(1)},A=e=>{e.preventDefault(),e.metaKey?ne(0):e.altKey?ie(-1):re(-1)};return H.createElement(I.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&oe(e);break;case`ArrowDown`:oe(e);break;case`p`:case`k`:g&&e.ctrlKey&&A(e);break;case`ArrowUp`:A(e);break;case`Home`:e.preventDefault(),ne(0);break;case`End`:e.preventDefault(),ae();break;case`Enter`:{e.preventDefault();let t=O();if(t){let e=new Event(Ju);t.dispatchEvent(e)}}}}},H.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:Sd},c),xd(e,e=>H.createElement($u.Provider,{value:C},H.createElement(Zu.Provider,{value:w},e))))}),rd=H.forwardRef((e,t)=>{let n=j(),r=H.useRef(null),i=H.useContext(td),a=Qu(),o=md(e),s=o.current?.forceMount??i?.forceMount;hd(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=vd(n,r,[e.value,e.children,r],e.keywords),l=ed(),u=_d(e=>e.value&&e.value===c.current),d=_d(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);H.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(Ju,f),()=>t.removeEventListener(Ju,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return H.createElement(I.div,{ref:le(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),id=H.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=j(),s=H.useRef(null),c=H.useRef(null),l=j(),u=Qu(),d=_d(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));hd(()=>u.group(o),[]),vd(o,s,[e.value,e.heading,c]);let f=H.useMemo(()=>({id:o,forceMount:i}),[i]);return H.createElement(I.div,{ref:le(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&H.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),xd(e,e=>H.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},H.createElement(td.Provider,{value:f},e))))}),ad=H.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=H.useRef(null),a=_d(e=>!e.search);return!n&&!a?null:H.createElement(I.div,{ref:le(i,t),...r,"cmdk-separator":``,role:`separator`})}),od=H.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=ed(),o=_d(e=>e.search),s=_d(e=>e.selectedItemId),c=Qu();return H.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),H.createElement(I.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)}})}),sd=H.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=H.useRef(null),o=H.useRef(null),s=_d(e=>e.selectedItemId),c=Qu();return H.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)}}},[]),H.createElement(I.div,{ref:le(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},xd(e,e=>H.createElement(`div`,{ref:le(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),cd=H.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return H.createElement(qe,{open:n,onOpenChange:r},H.createElement(rt,{container:o},H.createElement(Ye,{"cmdk-overlay":``,className:i}),H.createElement(ot,{"aria-label":e.label,"cmdk-dialog":``,className:a},H.createElement(nd,{ref:t,...s}))))}),ld=H.forwardRef((e,t)=>_d(e=>e.filtered.count===0)?H.createElement(I.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ud=H.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return H.createElement(I.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},xd(e,e=>H.createElement(`div`,{"aria-hidden":!0},e)))}),dd=Object.assign(nd,{List:sd,Item:rd,Input:od,Group:id,Separator:ad,Dialog:cd,Empty:ld,Loading:ud});function fd(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function pd(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function md(e){let t=H.useRef(e);return hd(()=>{t.current=e}),t}var hd=typeof window>`u`?H.useEffect:H.useLayoutEffect;function gd(e){let t=H.useRef();return t.current===void 0&&(t.current=e()),t}function _d(e){let t=ed(),n=()=>e(t.snapshot());return H.useSyncExternalStore(t.subscribe,n,n)}function vd(e,t,n,r=[]){let i=H.useRef(),a=Qu();return hd(()=>{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(Yu,s),i.current=s}),i}var yd=()=>{let[e,t]=H.useState(),n=gd(()=>new Map);return hd(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function bd(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function xd({asChild:e,children:t},n){return e&&H.isValidElement(t)?H.cloneElement(bd(t),{ref:t.ref},n(t.props.children)):n(t)}var Sd={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},Cd=qe;function wd({className:e,children:t,...n}){let{t:r}=B();return(0,K.jsxs)(rt,{children:[(0,K.jsx)(Ye,{className:`fixed inset-0 z-50 bg-black/50`}),(0,K.jsxs)(ot,{className:S(`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,K.jsx)($e,{"aria-label":r(`common.close`),className:`absolute top-3 right-3 rounded-sm text-muted-foreground hover:text-foreground`,children:(0,K.jsx)(Zl,{className:`size-4`})})]})]})}function Td({className:e,...t}){return(0,K.jsx)(`div`,{className:S(`flex flex-col gap-1.5`,e),...t})}function Ed({className:e,...t}){return(0,K.jsx)(`div`,{className:S(`flex justify-end gap-2`,e),...t})}function Dd({className:e,...t}){return(0,K.jsx)(et,{className:S(`text-base font-semibold`,e),...t})}function Od({className:e,...t}){return(0,K.jsx)(Je,{className:S(`text-sm text-muted-foreground`,e),...t})}function kd({className:e,...t}){return(0,K.jsx)(dd,{className:S(`flex size-full flex-col overflow-hidden rounded-md bg-card`,e),...t})}function Ad({open:e,onOpenChange:t,title:n,children:r}){return(0,K.jsx)(Cd,{open:e,onOpenChange:t,children:(0,K.jsxs)(wd,{className:`top-[20%] translate-y-0 gap-0 overflow-hidden p-0 max-w-xl`,children:[(0,K.jsx)(Dd,{className:`sr-only`,children:n}),(0,K.jsx)(Od,{className:`sr-only`,children:n}),(0,K.jsx)(kd,{children:r})]})})}function jd({className:e,...t}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-3`,children:[(0,K.jsx)(Cl,{className:`size-4 shrink-0 opacity-60`}),(0,K.jsx)(dd.Input,{className:S(`h-10 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground`,e),...t})]})}function Md({className:e,...t}){return(0,K.jsx)(dd.List,{className:S(`max-h-80 overflow-y-auto p-1`,e),...t})}function Nd(e){return(0,K.jsx)(dd.Empty,{className:`py-6 text-center text-sm text-muted-foreground`,...e})}function X({className:e,...t}){return(0,K.jsx)(dd.Group,{className:S(`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function Z({className:e,...t}){return(0,K.jsx)(dd.Item,{className:S(`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 Pd=ni,Fd=ii;function Id({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,K.jsx)(ci,{children:(0,K.jsx)(ui,{align:t,sideOffset:n,className:S(`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 Ld(e,t){return e.filter(e=>he(e,e,t))}function Rd({id:e,label:t,value:n,open:r,listId:i,count:a,placeholder:o}){let{t:s}=B(),c=n===``&&o!==void 0;return(0,K.jsx)(Fd,{asChild:!0,children:(0,K.jsxs)(L,{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,K.jsx)(ac,{"aria-hidden":!0}),c?null:(0,K.jsx)(it,{path:n}),(0,K.jsx)(`span`,{className:S(`flex-1 truncate text-left`,c&&`text-muted-foreground`),children:c?o:F(n)}),a>0&&!c?(0,K.jsx)(R,{variant:`warn`,"aria-label":s(`nav.repositoryWaiting`,{count:a}),children:a}):null]})})}function zd({path:e,chosen:t,waits:n,onSelect:r}){let{t:i}=B();return(0,K.jsxs)(Z,{value:e,title:e,onSelect:r,children:[(0,K.jsx)(Cs,{className:t?`opacity-100`:`opacity-0`}),(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate`,children:[(0,K.jsx)(it,{path:e}),(0,K.jsx)(`span`,{className:`truncate`,children:F(e)})]}),(0,K.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e})]}),n>0?(0,K.jsx)(R,{variant:`warn`,"aria-label":i(`nav.repositoryWaiting`,{count:n}),children:n}):null]})}function Bd({id:e,label:t,repositories:n,value:r,waiting:i,placeholder:a,onChange:o}){let{t:s}=B(),c=(0,H.useId)(),[l,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(``),p=Ld(n,d),m=i.get(r)??0;return(0,K.jsxs)(Pd,{open:l,onOpenChange:e=>{u(e),e||f(``)},children:[(0,K.jsx)(Rd,{id:e,label:t,value:r,open:l,listId:c,count:m,placeholder:a}),(0,K.jsx)(Id,{align:`start`,className:`w-(--radix-popover-trigger-width) min-w-64 p-0`,children:(0,K.jsxs)(kd,{shouldFilter:!1,label:s(`picker.search`,{label:t}),children:[(0,K.jsx)(jd,{value:d,onValueChange:f,placeholder:s(`queue.form.repositorySearch`)}),(0,K.jsxs)(Md,{id:c,children:[p.length===0?(0,K.jsx)(Nd,{children:s(`picker.nothing`)}):null,(0,K.jsx)(X,{children:p.map(e=>(0,K.jsx)(zd,{path:e,chosen:e===r,waits:i.get(e)??0,onSelect:()=>{o(e),u(!1),f(``)}},e))})]})]})})]})}function Vd(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 Hd(e,t,n){let[r,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(null),[l,u]=(0,H.useState)(!1),d=e=>{i(e),o(Vd(e.path,e.home)),c(null)},f=(0,H.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,H.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 Ud({browser:e}){let{t}=B(),{listing:n,typed:r,setTyped:i,busy:a,go:o}=e,s=e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),o(r.trim()))},c=n?.parent??null;return(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(L,{type:`button`,variant:`outline`,size:`icon`,"aria-label":t(`pathPicker.up`),title:t(`pathPicker.up`),disabled:a||c===null,onClick:()=>c!==null&&void o(c),children:(0,K.jsx)(hs,{"aria-hidden":!0})}),(0,K.jsx)(L,{type:`button`,variant:`outline`,size:`icon`,"aria-label":t(`pathPicker.home`),title:t(`pathPicker.home`),disabled:a,onClick:()=>void o(),children:(0,K.jsx)(xc,{"aria-hidden":!0})}),(0,K.jsx)(Du,{"aria-label":t(`pathPicker.path`),value:r,className:`min-w-0 flex-1`,onChange:e=>i(e.target.value),onKeyDown:s}),(0,K.jsx)(L,{type:`button`,variant:`outline`,disabled:a||r.trim()===``,onClick:()=>void o(r.trim()),children:t(`pathPicker.go`)})]})}function Wd({browser:e}){let{t}=B(),{listing:n,busy:r,go:i}=e,a=e=>(0,K.jsx)(`li`,{className:`px-2 py-3 text-sm text-muted-foreground`,children:e});return(0,K.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,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,"data-directory":e.path,disabled:r,className:S(`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,K.jsx)(ac,{"aria-hidden":!0,className:`size-4 shrink-0 text-primary`}):(0,K.jsx)(lc,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted-foreground`}),(0,K.jsx)(`span`,{className:`truncate`,children:e.name}),e.git?(0,K.jsx)(R,{variant:`outline`,className:`ml-auto`,children:`git`}):null]})},e.path)),n?.truncated?(0,K.jsx)(`li`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:t(`pathPicker.truncated`,{count:n.entries.length})}):null]})}function Gd({open:e,start:t,browse:n,onOpenChange:r,onChoose:i}){let{t:a}=B(),o=Hd(e,t,n),{listing:s,error:c,busy:l}=o;return(0,K.jsx)(Cd,{open:e,onOpenChange:r,children:(0,K.jsxs)(wd,{className:`sm:max-w-xl`,"data-directory-dialog":!0,children:[(0,K.jsxs)(Td,{children:[(0,K.jsx)(Dd,{children:a(`pathPicker.title`)}),(0,K.jsx)(Od,{children:a(`pathPicker.description`)})]}),(0,K.jsx)(Ud,{browser:o}),c?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:c}):null,(0,K.jsx)(Wd,{browser:o}),(0,K.jsxs)(Ed,{children:[(0,K.jsx)(L,{type:`button`,variant:`outline`,onClick:()=>r(!1),children:a(`common.cancel`)}),(0,K.jsxs)(L,{type:`button`,disabled:l||s===null,onClick:()=>{s!==null&&(i(Vd(s.path,s.home)),r(!1))},children:[s?.git?(0,K.jsx)(ac,{"aria-hidden":!0}):(0,K.jsx)(sc,{"aria-hidden":!0}),a(`pathPicker.choose`)]})]})]})})}function Kd({id:e,value:t,onChange:n,browse:r,placeholder:i,invalid:a=!1,describedBy:o,autoFocus:s=!1,required:c=!1}){let{t:l}=B(),[u,d]=(0,H.useState)(!1);return(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(Du,{id:e,value:t,required:c,placeholder:i,autoFocus:s,className:`min-w-0 flex-1`,"aria-invalid":a,"aria-describedby":o,onChange:e=>n(e.target.value)}),(0,K.jsxs)(L,{type:`button`,variant:`outline`,onClick:()=>d(!0),"data-path-browse":!0,children:[(0,K.jsx)(sc,{"aria-hidden":!0}),l(`pathPicker.browse`)]}),(0,K.jsx)(Gd,{open:u,start:t,browse:r,onOpenChange:d,onChoose:n})]})}function qd({open:e,onOpenChange:t,repositories:n,initial:r,onChoose:i}){let{t:a}=B(),[o,s]=(0,H.useState)(null),c=o??r??n[0]??``;return(0,K.jsx)(Cd,{open:e,onOpenChange:t,children:(0,K.jsxs)(wd,{children:[(0,K.jsxs)(Td,{children:[(0,K.jsx)(Dd,{children:a(`projectChoice.title`)}),(0,K.jsx)(Od,{children:a(`projectChoice.description`)})]}),(0,K.jsx)(Bd,{label:a(`projectChoice.label`),repositories:n,value:c,waiting:new Map,onChange:s}),(0,K.jsxs)(Ed,{children:[(0,K.jsx)(L,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:a(`common.cancel`)}),(0,K.jsx)(L,{type:`button`,disabled:c===``,onClick:()=>{i(c),t(!1),s(null)},children:a(`projectChoice.choose`)})]})]})})}var Jd=`*shared`;function Yd(e){return{path:e.path,slug:e.slug,label:e.label,color:e.color}}function Xd(e){return e.filter(e=>e.enabled).map(Yd).sort((e,t)=>{let n=e.label.toLowerCase().localeCompare(t.label.toLowerCase());return n===0?e.path<t.path?-1:+(e.path>t.path):n})}var Zd=(e,t)=>e?`${e}/${t}`:t;function Qd(e){let t=e.indexOf(`/`);return t===-1?{project:null,id:e}:{project:e.slice(0,t),id:e.slice(t+1)}}function $d(e,t){let n=new Set,r=[],i=[];for(let{project:a,entries:o}of e)for(let e of o??[])if(e.level===`global`){if(n.has(t(e)))continue;n.add(t(e)),r.push({...e,project:null,from:a})}else i.push({...e,project:a,from:a});return[...r,...i]}var ef=e=>e.project;function tf(e){if(e.every(e=>ef(e)===void 0))return[];let t=[];e.some(e=>ef(e)===null)&&t.push({value:Jd,label:null});let n=new Map;for(let t of e){let e=ef(t);e&&n.set(e.slug,e)}return[...t,...[...n.values()].sort((e,t)=>e.label.toLowerCase().localeCompare(t.label.toLowerCase())).map(e=>({value:e.slug,label:e.label}))]}function nf(e,t){let n=ef(e);return t.length===0||n===void 0||t.includes(n===null?Jd:n.slug)}function rf(e){let t=new Map;for(let n of e){let e=ef(n);if(e===void 0)continue;let r=e===null?Jd:e.slug;t.set(r,(t.get(r)??0)+1)}return t}function af(e,t){let[n,r]=(0,H.useState)(!1),i=(0,H.useMemo)(()=>Xd(e?.registry??[]),[e?.registry]);return{ask:()=>e?r(!0):t(null),dialog:e?(0,K.jsx)(qd,{open:n,onOpenChange:r,repositories:i.map(e=>e.path),initial:e.last,onChoose:e=>t(i.find(t=>t.path===e)?.slug??null)}):null}}function Q({className:e,...t}){return(0,K.jsx)(Wr,{className:S(`text-sm leading-none font-medium select-none`,e),...t})}function of(){return S(`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 sf({open:e,onOpenChange:t,onAdd:n,browse:r}){let{t:i}=B(),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(null),[l,u]=(0,H.useState)(!1),d=async e=>{if(e.preventDefault(),!(l||a.trim()===``)){u(!0),c(null);try{await n(a.trim()),o(``),t(!1)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}};return(0,K.jsx)(Cd,{open:e,onOpenChange:e=>{e||c(null),t(e)},children:(0,K.jsx)(wd,{children:(0,K.jsxs)(`form`,{onSubmit:e=>void d(e),className:`grid gap-3`,children:[(0,K.jsxs)(Td,{children:[(0,K.jsx)(Dd,{children:i(`nav.repositoryAddTitle`)}),(0,K.jsx)(Od,{children:i(`nav.repositoryAddDescription`)})]}),(0,K.jsx)(Q,{htmlFor:`repository-path`,children:i(`nav.repositoryPath`)}),(0,K.jsx)(Kd,{id:`repository-path`,value:a,onChange:o,browse:r,placeholder:`~/projects/app`,autoFocus:!0,invalid:s!==null,describedBy:s?`repository-path-error`:void 0}),s?(0,K.jsx)(`p`,{id:`repository-path-error`,role:`alert`,className:`text-sm text-destructive`,children:s}):null,(0,K.jsxs)(Ed,{children:[(0,K.jsx)(L,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:i(`common.cancel`)}),(0,K.jsx)(L,{type:`submit`,disabled:l||a.trim()===``,children:i(`nav.repositoryAddSubmit`)})]})]})})})}function cf({name:e,label:t,title:n,others:r,compact:i,all:a=!1}){let{t:o}=B();return(0,K.jsx)(xu,{asChild:!0,children:(0,K.jsxs)(L,{variant:`outline`,"data-nav-row":!0,"data-repository-trigger":!0,className:S(of(),`relative`,i&&`w-auto max-w-48`),"aria-label":t,title:n,children:[a?(0,K.jsx)(kc,{"aria-hidden":!0}):(0,K.jsx)(ac,{"aria-hidden":!0}),a?null:(0,K.jsx)(it,{path:n}),(0,K.jsx)(`span`,{className:`flex-1 truncate text-left`,children:e}),r>0?(0,K.jsx)(R,{variant:`warn`,"aria-label":o(`nav.repositoryWaiting`,{count:r}),children:r}):null]})})}function lf({path:e,shown:t,count:n}){let{t:r}=B();return(0,K.jsxs)(Tu,{value:e,title:e,className:`min-h-[3.25rem]`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate`,children:[(0,K.jsx)(it,{path:e}),(0,K.jsx)(`span`,{className:`truncate`,children:F(e)})]}),(0,K.jsx)(`span`,{className:`text-xs break-all whitespace-normal text-muted-foreground`,children:t})]}),n>0?(0,K.jsx)(R,{variant:`warn`,className:`ml-3`,"aria-label":r(`nav.repositoryWaiting`,{count:n}),children:n}):null]})}function uf({ref:e,query:t,onQuery:n}){let{t:r}=B();return(0,K.jsx)(Du,{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()}})}var df=`*`;function ff(e){let{t}=B(),{matching:n,waiting:r}=e;return(0,K.jsxs)(Su,{value:e.selected??df,onValueChange:t=>t===df?e.onAll?.():e.onSelect(t),children:[e.onAll?(0,K.jsxs)(Tu,{value:df,"data-all-projects":!0,children:[(0,K.jsx)(kc,{"aria-hidden":!0,className:`size-4`}),t(`nav.repositoryAll`)]}):null,(0,K.jsxs)(`div`,{"data-repository-list":!0,className:`max-h-[calc(3.25rem*5.5)] overflow-y-auto`,children:[n.map(t=>(0,K.jsx)(lf,{path:t,shown:e.shownPath(t),count:r.get(t)??0},t)),n.length===0?(0,K.jsx)(`p`,{className:`px-2 py-3 text-center text-sm text-muted-foreground`,children:t(`nav.repositoryNone`)}):null]})]})}function pf({compact:e,onAdd:t,browse:n}){let{t:r}=B(),[i,a]=(0,H.useState)(!1);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(L,{variant:`outline`,"data-repository-add-empty":!0,className:S(of(),e&&`w-auto max-w-48`),"aria-label":r(`nav.repositoryAdd`),title:r(`nav.repositoryAdd`),onClick:()=>a(!0),children:[(0,K.jsx)(_l,{"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`flex-1 truncate text-left`,children:r(`nav.repositoryAdd`)})]}),(0,K.jsx)(sf,{open:i,onOpenChange:a,onAdd:t,browse:n})]})}var mf=M({view:`settings`,run:`projects`,group:`global`,step:null,tab:null});function hf(e,t){let[n,r]=(0,H.useState)(!1);return mu(`ctrl+p`,t=>{e&&(t.preventDefault(),r(!0))}),(0,H.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>t.current?.focus(),0);return()=>clearTimeout(e)},[n,t]),[n,r]}function gf({choice:e,compact:t=!1}){let{t:n}=B(),{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,H.useRef)(null),[u,d]=(0,H.useState)(``),[f,p]=(0,H.useState)(!1),[m,h]=hf(i!==null,l);if(i===null)return(0,K.jsx)(pf,{compact:t,...s});let g=e.allProjects===!0,_=g?n(`nav.repositoryAll`):F(i),v=r.filter(e=>g||e!==i).reduce((e,t)=>e+(a.get(t)??0),0),y=r.filter(e=>he(e,c(e),u)),b=(0,K.jsx)(cf,{name:_,label:n(`nav.repositoryCurrent`,{name:_}),title:g?_:i,all:g,others:v,compact:t});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(bu,{open:m,onOpenChange:e=>{h(e),e||d(``)},children:[b,(0,K.jsxs)(Cu,{align:`start`,"aria-label":n(`nav.repository`),className:`w-80 max-w-[calc(100vw-1rem)]`,children:[(0,K.jsx)(uf,{ref:l,query:u,onQuery:d}),(0,K.jsx)(ff,{matching:y,selected:g?null:i,onAll:r.length>0?e.onAllProjects:void 0,shownPath:c,waiting:a,onSelect:o}),(0,K.jsx)(Eu,{}),(0,K.jsxs)(wu,{onSelect:()=>p(!0),children:[(0,K.jsx)(_l,{"aria-hidden":!0}),n(`nav.repositoryAdd`)]}),(0,K.jsx)(wu,{asChild:!0,children:(0,K.jsxs)(`a`,{href:mf,"data-projects-link":!0,children:[(0,K.jsx)(Dl,{"aria-hidden":!0}),n(`nav.repositoryManage`)]})})]})]}),(0,K.jsx)(sf,{open:f,onOpenChange:p,...s})]})}function _f({target:e,count:t,waiting:n,corner:r=!1,className:i}){let{t:a}=B();return(0,K.jsx)(R,{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:S(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 vf(e){return`#${e}`}function yf(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 bf(e){return e==null?`—`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function xf(e){return!e||e.inputTokens===0&&e.outputTokens===0?``:`${bf(e.inputTokens)}/${bf(e.outputTokens)}`}function Sf(e,t){return t(`format.files`,{count:e})}function Cf(e,t){return e?`${Sf(e.files,t)} +${e.added} −${e.removed}`:``}function wf(e){return e.title||e.groups.map(e=>e.title).join(`, `)||e.id}function Tf(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 Ef(e){return e.total<=0?0:Math.min(100,Math.max(0,Math.round(e.done/e.total*100)))}function Df(e,t){return e.finished&&e.finishedAt!==null?e.finishedAt:e.clockStoppedAt??t}function Of(e,t,n){let r=Df(e,t);return{created:Tf(e.createdAt,t,n),duration:yf(r-e.createdAt)}}function kf(e,t){return e.map((e,n)=>`Q${n+1}: ${e.text}\nA${n+1}: ${(t[n]??``).trim()}`).join(`
|
|
3
|
+
|
|
4
|
+
`)}function Af(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 jf(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function Mf(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 Nf(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 Pf(e,t){return`${new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(e)} %`}function Ff(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 If(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 Lf(e){let t=new Date(e);return[t.getHours(),t.getMinutes(),t.getSeconds()].map(e=>String(e).padStart(2,`0`)).join(`:`)}function Rf(e,t){return new Date(e).toLocaleString(t)}var zf={queued:{labelKey:`queued`,tone:`mute`,icon:Ns,spin:!1},not_merged:{labelKey:`not_merged`,tone:`mute`,icon:Ns,spin:!1},waiting:{labelKey:`waiting`,tone:`mute`,icon:yc,spin:!1},running:{labelKey:`running`,tone:`run`,icon:D,spin:!0},merging:{labelKey:`merging`,tone:`run`,icon:pc,spin:!1},repair:{labelKey:`repair`,tone:`run`,icon:Yl,spin:!1},active:{labelKey:`active`,tone:`run`,icon:D,spin:!0},needs_human:{labelKey:`needs_human`,tone:`warn`,icon:qc,spin:!1},conflict:{labelKey:`conflict`,tone:`warn`,icon:Vl,spin:!1},apply_failed:{labelKey:`apply_failed`,tone:`warn`,icon:ll,spin:!1},undelivered:{labelKey:`undelivered`,tone:`warn`,icon:sl,spin:!1},rejected:{labelKey:`rejected`,tone:`warn`,icon:Vl,spin:!1},failed:{labelKey:`failed`,tone:`err`,icon:zs,spin:!1},merged:{labelKey:`merged`,tone:`ok`,icon:pc,spin:!1},applied:{labelKey:`applied`,tone:`ok`,icon:al,spin:!1},done:{labelKey:`done`,tone:`ok`,icon:js,spin:!1},finished:{labelKey:`finished`,tone:`ok`,icon:js,spin:!1},cancelled:{labelKey:`cancelled`,tone:`mute`,icon:_s,spin:!1},pending:{labelKey:`pending`,tone:`mute`,icon:Vs,spin:!1},paused:{labelKey:`paused`,tone:`warn`,icon:Fs,spin:!1},frozen:{labelKey:`frozen`,tone:`warn`,icon:Nl,spin:!1},stopped:{labelKey:`stopped`,tone:`mute`,icon:Fs,spin:!1},warnings:{labelKey:`warnings`,tone:`warn`,icon:Vl,spin:!1}};function Bf(e,t){let n=zf[e];return n?{label:t(`status.${n.labelKey}`),tone:n.tone,icon:n.icon,spin:n.spin}:{label:e,tone:`mute`,icon:Vs,spin:!1}}function Vf(e,t){switch(e.reason){case`specialist`:return t(`wait.specialist`,{specialist:e.name??e.specialist,max:e.max});case`pool`:return t(`wait.pool`,{pool:e.pool,max:e.max});case`capacity`:return e.scope===`machine`?t(`wait.capacityMachine`,{max:e.max}):t(`wait.capacityRepository`,{max:e.max});case`limit`:return t(`wait.limit`,{runtime:e.runtime,time:jf(e.until)});case`network`:return e.until===null?t(`wait.network`,{problem:e.problem}):t(`wait.networkUntil`,{time:jf(e.until)})}}function Hf(e){return zf[e]?.tone??`mute`}function Uf(e,t){let{label:n}=Bf(e.state,t);return e.state===`needs_human`&&e.waiting>=2?`${n} ×${e.waiting}`:n}function Wf(e,t){return t(`connection.${e}`)}function Gf(e,t){return t(`queueState.${e}`)}function Kf({compact:e,label:t,unread:n,tone:r}){let{t:i}=B(),a=(0,K.jsxs)(`span`,{className:`relative flex size-4 items-center justify-center`,children:[(0,K.jsx)(ys,{"aria-hidden":!0}),n>0?(0,K.jsx)(R,{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,K.jsxs)(as,{children:[(0,K.jsx)(os,{asChild:!0,children:(0,K.jsx)(Fd,{asChild:!0,children:(0,K.jsx)(L,{variant:`ghost`,size:`icon`,className:`size-8 shrink-0`,"aria-label":t,children:a})})}),(0,K.jsx)(ss,{side:`bottom`,children:t})]}):(0,K.jsx)(Fd,{asChild:!0,children:(0,K.jsxs)(L,{variant:`ghost`,"data-nav-row":!0,className:of(),"aria-label":t,children:[a,(0,K.jsx)(`span`,{children:i(`nav.notifications`)})]})})}function qf({item:e,state:t,showRepository:n,onSelect:r}){let{t:i}=B(),a=Bf(e.kind,i);return(0,K.jsxs)(`li`,{className:`flex items-start gap-1 border-b last:border-b-0 hover:bg-accent/50`,children:[(0,K.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,K.jsxs)(`span`,{className:`flex max-w-full items-center gap-2`,children:[(0,K.jsx)(R,{variant:a.tone,children:a.label}),e.humanOnly?(0,K.jsx)(R,{variant:`warn`,children:i(`runs.humanOnly.${e.humanOnly}`)}):null,(0,K.jsx)(`span`,{className:S(`truncate`,t.isRead(e)?`font-normal`:`font-semibold`),children:e.groupTitle})]}),(0,K.jsxs)(`span`,{className:`max-w-full truncate text-xs text-muted-foreground`,children:[e.runTitle,n?` · ${F(e.repository)}`:``]}),e.detail?(0,K.jsx)(`span`,{className:`max-w-full truncate text-xs`,children:e.detail}):null]}),(0,K.jsx)(L,{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 Jf({state:e,compact:t=!1,showRepository:n}){let{t:r}=B(),[i,a]=(0,H.useState)(!1),{items:o,unread:s,unreadTone:c,permission:l}=e,u=s>0?r(`notifications.unread`,{count:s}):r(`nav.notifications`),d=e.open;return(0,H.useEffect)(()=>{i&&s>0&&d()},[i,s,d]),(0,K.jsxs)(Pd,{open:i,onOpenChange:t=>{a(t),t&&e.open()},children:[(0,K.jsx)(Kf,{compact:t,label:u,unread:s,tone:c}),(0,K.jsxs)(Id,{align:`end`,className:`w-96 p-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-3 py-2`,children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold`,children:r(`notifications.title`)}),o.length>0?(0,K.jsx)(L,{variant:`ghost`,size:`sm`,onClick:e.hideAll,children:r(`notifications.hideAll`)}):null]}),o.length===0?(0,K.jsx)(`p`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:r(`notifications.empty`)}):(0,K.jsx)(`ul`,{className:`max-h-80 overflow-y-auto`,children:o.map(t=>(0,K.jsx)(qf,{item:t,state:e,showRepository:n,onSelect:()=>{a(!1),e.select(t)}},t.key))}),(0,K.jsxs)(`div`,{className:`flex flex-col items-start gap-2 border-t px-3 py-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(`p`,{role:`status`,children:r(`notifications.${l}`)}),l==="default"?(0,K.jsx)(L,{variant:`outline`,size:`sm`,onClick:e.enable,children:r(`notifications.enable`)}):null]})]})]})}var Yf=[{code:`en`,name:`English`,locale:`en`},{code:`es`,name:`Español`,locale:`es`},{code:`ru`,name:`Русский`,locale:`ru`},{code:`zh`,name:`中文`,locale:`zh-CN`}],Xf=Yf.map(e=>e.code),Zf=`aip.web.language`;function Qf(e){return typeof e==`string`&&Xf.includes(e)}function $f(e){return Yf.find(t=>t.code===e)?.locale??`en`}function ep(e){for(let t of e){let e=t.toLowerCase().split(`-`)[0];if(Qf(e))return e}return`en`}Ae.use(Bt).init({resources:{en:{translation:lt},es:{translation:dt},ru:{translation:ut},zh:{translation:ft}},lng:`en`,fallbackLng:`en`,initAsync:!1,returnNull:!1,interpolation:{escapeValue:!1}});var tp=`system`,np=new Set;function rp(){try{let e=window.localStorage.getItem(Zf);if(e===null)return`system`;let t=JSON.parse(e);return Qf(t)?t:`system`}catch{return tp}}function ip(){let{languages:e,language:t}=window.navigator;return e&&e.length>0?e:t?[t]:[]}function ap(e){let t=e===`system`?ep(ip()):e;return Ae.language!==t&&Ae.changeLanguage(t),document.documentElement.lang=$f(t),t}function op(){ap(rp())}function sp(e){tp=e;try{window.localStorage.setItem(Zf,JSON.stringify(e))}catch{}ap(e);for(let e of np)e()}function cp(e){return np.add(e),()=>np.delete(e)}function lp(){let e=(0,H.useSyncExternalStore)(cp,rp,rp);return(0,H.useEffect)(()=>{if(ap(e),e!==`system`)return;let t=()=>{ap(`system`);for(let e of np)e()};return window.addEventListener(`languagechange`,t),()=>window.removeEventListener(`languagechange`,t)},[e]),{choice:e,language:e===`system`?ep(ip()):e,setChoice:sp}}function up(){let{i18n:e}=B();return $f(Qf(e.language)?e.language:`en`)}function dp({compact:e=!1}){let{t}=B(),{choice:n,setChoice:r}=lp(),i=t(`language.label`,{language:n===`system`?t(`language.system`):Yf.find(e=>e.code===n)?.name??n}),a=(0,K.jsx)(xu,{asChild:!0,children:(0,K.jsxs)(L,{variant:`ghost`,"data-nav-row":!0,className:S(of(),e&&`w-8 justify-center px-0`),"aria-label":i,children:[(0,K.jsx)(Dc,{}),e?null:(0,K.jsx)(`span`,{className:`truncate`,children:i})]})});return(0,K.jsxs)(bu,{children:[e?(0,K.jsxs)(as,{children:[(0,K.jsx)(os,{asChild:!0,children:a}),(0,K.jsx)(ss,{side:`bottom`,children:i})]}):a,(0,K.jsx)(Cu,{align:e?`end`:`start`,side:e?`bottom`:`top`,children:(0,K.jsxs)(Su,{value:n,onValueChange:e=>r(e),children:[(0,K.jsx)(Tu,{value:`system`,children:t(`language.system`)}),Yf.map(e=>(0,K.jsx)(Tu,{value:e.code,lang:e.locale,children:e.name},e.code))]})})]})}var fp=`aip.web.theme`;function pp(){try{let e=JSON.parse(window.localStorage.getItem(fp)??`null`);return e===`light`||e===`dark`?e:`system`}catch{return`system`}}var mp=()=>window.matchMedia(`(prefers-color-scheme: dark)`);function hp(e){return e===`system`?mp().matches?`dark`:`light`:e}function gp(e){let t=hp(e);return document.documentElement.classList.toggle(`dark`,t===`dark`),t}function _p(){gp(pp())}function vp(){let[e,t]=Ne(`theme`,`system`),[n,r]=(0,H.useState)(()=>hp(e));return(0,H.useEffect)(()=>{if(r(gp(e)),e!==`system`)return;let t=mp(),n=()=>r(gp(`system`));return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),{theme:e,resolved:n,setTheme:t}}var yp=[`system`,`light`,`dark`];function bp({compact:e=!1}){let{t}=B(),{theme:n,resolved:r,setTheme:i}=vp(),a=t(`theme.label`,{theme:t(`theme.${n}`)}),o=n===`system`?$c:r===`dark`?tl:zl,s=(0,K.jsx)(xu,{asChild:!0,children:(0,K.jsxs)(L,{variant:`ghost`,"data-nav-row":!0,className:S(of(),e&&`w-8 justify-center px-0`),"aria-label":a,children:[(0,K.jsx)(o,{}),e?null:(0,K.jsx)(`span`,{children:a})]})});return(0,K.jsxs)(bu,{children:[e?(0,K.jsxs)(as,{children:[(0,K.jsx)(os,{asChild:!0,children:s}),(0,K.jsx)(ss,{side:`bottom`,children:a})]}):s,(0,K.jsx)(Cu,{align:e?`end`:`start`,side:e?`bottom`:`top`,children:(0,K.jsx)(Su,{value:n,onValueChange:e=>i(e),children:yp.map(e=>(0,K.jsx)(Tu,{value:e,children:t(`theme.${e}`)},e))})})]})}function xp(e){let{t}=B(),{target:n,active:r,count:i,waiting:a,icon:o}=e;return(0,K.jsxs)(`a`,{href:e.href,"data-nav-row":!0,"aria-current":r?`page`:void 0,className:S(of(),`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,K.jsx)(`span`,{"data-nav-icon":!0,className:`relative flex size-4 items-center justify-center`,children:(0,K.jsx)(o,{"aria-hidden":!0})}),(0,K.jsx)(`span`,{className:`flex-1`,children:e.label}),i>0?(0,K.jsx)(_f,{target:n,count:i,waiting:a}):null,n===`runs`&&a>0?(0,K.jsx)(R,{variant:`warn`,"aria-label":t(`nav.waiting`,{count:a}),children:a}):null]})}function Sp({view:e,hrefFor:t,onNavigate:n,working:r,waiting:i,queued:a,onPalette:o,notifications:s,repository:c}){let{t:l}=B(),u=e=>e===`runs`?r:e===`queue`?a:0;return(0,K.jsxs)(`div`,{className:`flex h-full flex-col gap-2 p-2`,children:[(0,K.jsxs)(`a`,{href:`#runs`,"data-nav-row":!0,className:S(of(),`font-semibold`),onClick:e=>{e.preventDefault(),n(`runs`)},children:[(0,K.jsx)(`span`,{className:`rounded bg-primary px-1.5 py-0.5 text-xs text-primary-foreground`,children:`aip`}),(0,K.jsx)(`span`,{children:`web`})]}),(0,K.jsx)(gf,{choice:c}),(0,K.jsxs)(L,{variant:`outline`,"data-nav-row":!0,className:S(of(),`text-muted-foreground`),onClick:o,"aria-label":l(`nav.palette`),children:[(0,K.jsx)(Cl,{}),(0,K.jsx)(`span`,{className:`flex-1 text-left`,children:l(`nav.search`)}),(0,K.jsxs)(yu,{children:[cu(),`K`]})]}),(0,K.jsx)(`nav`,{"aria-label":l(`nav.sections`),className:`flex flex-col gap-0.5`,children:Ql.map(({view:r,labelKey:a,icon:o})=>(0,K.jsx)(xp,{target:r,label:l(`nav.${a}`),icon:o,count:u(r),active:r===e,waiting:i,href:t(r),onNavigate:n},r))}),(0,K.jsxs)(`div`,{className:`mt-auto flex flex-col gap-1`,children:[(0,K.jsx)(Jf,{state:s,showRepository:c.repositories.length>1}),(0,K.jsx)(bp,{}),(0,K.jsx)(dp,{})]})]})}function Cp(e){let{t}=B(),[n,r]=(0,H.useState)(!1);return(0,K.jsxs)(`header`,{className:`flex h-11 shrink-0 items-center gap-2 border-b bg-card px-2`,children:[(0,K.jsxs)(eu,{open:n,onOpenChange:r,children:[(0,K.jsx)(tu,{asChild:!0,children:(0,K.jsx)(L,{variant:`ghost`,size:`icon`,"aria-label":t(`nav.menu`),children:(0,K.jsx)(Gc,{})})}),(0,K.jsxs)(nu,{children:[(0,K.jsx)(ru,{className:`sr-only`,children:t(`nav.sectionsTitle`)}),(0,K.jsx)(iu,{children:t(`nav.sectionsDescription`)}),(0,K.jsx)(Sp,{...e,onNavigate:t=>{r(!1),e.onNavigate(t)},onPalette:()=>{r(!1),e.onPalette()}})]})]}),(0,K.jsx)(`span`,{className:`text-sm font-semibold`,children:$l(e.view,t)}),(0,K.jsx)(L,{variant:`outline`,size:`icon`,className:`ml-auto`,onClick:e.onNewTask,disabled:!e.onNewTask,"aria-label":t(`nav.newTask`),children:(0,K.jsx)(_l,{})})]})}function wp({label:e,children:t}){return(0,K.jsxs)(as,{children:[(0,K.jsx)(os,{asChild:!0,children:t}),(0,K.jsx)(ss,{side:`bottom`,children:e})]})}function Tp(e){let{t}=B(),{target:n,label:r,count:i,active:a,waiting:o,onNavigate:s,icon:c}=e;return(0,K.jsx)(wp,{label:r,children:(0,K.jsxs)(`a`,{href:e.href,"aria-current":a?`page`:void 0,className:S(`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,K.jsxs)(`span`,{"data-nav-icon":!0,className:`relative flex size-4 items-center justify-center`,children:[(0,K.jsx)(c,{"aria-hidden":!0}),i>0?(0,K.jsx)(_f,{target:n,count:i,waiting:o,corner:!0,className:`lg:hidden`}):null]}),(0,K.jsx)(`span`,{className:`sr-only lg:not-sr-only`,children:r}),i>0?(0,K.jsx)(_f,{target:n,count:i,waiting:o,className:`hidden lg:inline-flex`}):null,n===`runs`&&o>0?(0,K.jsx)(R,{variant:`warn`,className:`hidden lg:inline-flex`,"aria-label":t(`nav.waiting`,{count:o}),children:o}):null]})},n)}function Ep({onNewTask:e,onPalette:t,notifications:n,showRepository:r}){let{t:i}=B();return(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-1`,children:[(0,K.jsx)(wp,{label:i(`nav.newTask`),children:(0,K.jsx)(L,{variant:`outline`,size:`icon`,className:`size-7 shrink-0 text-muted-foreground`,onClick:e,disabled:!e,"aria-label":i(`nav.newTask`),children:(0,K.jsx)(_l,{})})}),(0,K.jsx)(wp,{label:i(`nav.search`),children:(0,K.jsxs)(L,{variant:`outline`,size:`sm`,className:`shrink-0 text-muted-foreground [&_svg]:size-4`,onClick:t,"aria-label":i(`nav.palette`),children:[(0,K.jsx)(Cl,{}),(0,K.jsx)(`span`,{className:`hidden lg:inline`,children:i(`nav.search`)}),(0,K.jsxs)(yu,{className:`hidden lg:inline-flex`,children:[cu(),`K`]})]})}),(0,K.jsx)(Jf,{state:n,compact:!0,showRepository:r}),(0,K.jsx)(dp,{compact:!0}),(0,K.jsx)(bp,{compact:!0})]})}function Dp({view:e,hrefFor:t,onNavigate:n,working:r,waiting:i,queued:a,onPalette:o,onNewTask:s,notifications:c,repository:l}){let{t:u}=B(),d=e=>e===`runs`?r:e===`queue`?a:0;return(0,K.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center justify-between gap-3 border-b bg-card px-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.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,K.jsx)(`span`,{className:`rounded bg-primary px-1.5 py-0.5 text-xs text-primary-foreground`,children:`aip`}),(0,K.jsx)(`span`,{children:`web`})]}),(0,K.jsx)(gf,{choice:l,compact:!0})]}),(0,K.jsx)(`nav`,{"aria-label":u(`nav.sections`),className:`flex shrink-0 items-center gap-1`,children:Ql.map(({view:r,labelKey:a,icon:o})=>(0,K.jsx)(Tp,{target:r,label:u(`nav.${a}`),icon:o,count:d(r),active:r===e,waiting:i,href:t(r),onNavigate:n},r))}),(0,K.jsx)(Ep,{onNewTask:s,onPalette:o,notifications:c,showRepository:l.repositories.length>1})]})}function Op({nav:e,footer:t,children:n}){let r=Be(`(min-width: 768px)`);return(0,K.jsxs)(is,{children:[(0,K.jsxs)(`div`,{className:`relative flex h-dvh flex-col overflow-hidden`,children:[r?(0,K.jsx)(Dp,{...e}):(0,K.jsx)(Cp,{...e}),(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,K.jsx)(`div`,{className:`relative flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,children:n}),t]})]}),(0,K.jsx)(Vt,{})]})}function kp({daemon:e}){let{t}=B();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,K.jsxs)(N,{variant:`warn`,className:`m-3 mb-0 flex w-auto flex-col gap-1`,children:[(0,K.jsxs)(`span`,{children:[i,e.outdated===`daemon`&&e.pid!==null?(0,K.jsxs)(K.Fragment,{children:[` `,(0,K.jsxs)(`code`,{children:[`kill `,e.pid]})]}):null]}),(0,K.jsx)(`span`,{className:`text-xs opacity-80`,children:t(`daemon.builds`,{daemon:r(e.daemon),panel:r(e.client)})})]})}var Ap=3e3;function jp(e,t=null,n=`reconnecting`){let[r,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(null),s=(0,H.useRef)(!0),c=(0,H.useRef)(!1),l=(0,H.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,H.useEffect)(()=>{t&&(t.processes?(i(t.processes),o(null)):t.error&&o(t.error))},[t]);let u=n!==`live`||t===null;return(0,H.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(),Ap))},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 Mp(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 Np=.8;function Pp(e){return Math.floor(e*Np)}function Fp(e,t,n){return t>=Pp(n)&&e>t?e:t}function Ip(e,t){let n=Pp(t);return Math.max(Math.min(e,n),Math.min(160,n))}function Lp(){let[e,t]=(0,H.useState)(()=>window.innerHeight);return(0,H.useEffect)(()=>{let e=()=>t(window.innerHeight);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function Rp(){let[e,t]=Ne(`statusBar.height`,256),n=Lp(),r=Number.isFinite(e)?e:256;return{height:Ip(r,n),chosen:r,viewportHeight:n,setChosen:t}}function zp(e){return e===`ArrowUp`?16:e===`ArrowDown`?-16:0}function Bp(e,t,n,r){return Fp(e,Ip(t+n,r),r)}var Vp=Yt,Hp=Zt,Up=$t;function Wp({className:e,...t}){return(0,K.jsx)(eo,{className:S(`flex flex-col gap-3`,e),...t})}function Gp({className:e,...t}){return(0,K.jsx)(no,{className:S(`inline-flex w-fit items-center gap-1 border-b`,e),...t})}function Kp({className:e,...t}){return(0,K.jsx)(io,{className:S(`-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 qp({className:e,...t}){return(0,K.jsx)(oo,{className:S(`min-w-0`,e),...t})}var Jp=`border-b group-last/row:border-0`,Yp=`${Jp} px-2 py-1.5 text-right align-middle whitespace-nowrap tabular-nums`;function Xp({task:e,onOpenGroup:t}){let{t:n}=B(),{owner:r}=e,i=e.processes[e.processes.length-1];return(0,K.jsx)(`tr`,{className:`bg-muted/40`,children:(0,K.jsx)(`th`,{scope:`rowgroup`,colSpan:6,className:`border-b px-2 py-1.5 text-left font-medium`,children:r.group===null?(0,K.jsx)(`span`,{className:`block truncate text-xs`,children:r.runTitle}):(0,K.jsx)(L,{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,K.jsx)(`span`,{className:`truncate`,children:n(`statusBar.owner`,{group:r.groupTitle??r.group,run:r.runTitle})})})})})}function Zp({command:e,onCopy:t}){let{t:n}=B();return(0,K.jsx)(`td`,{className:`${Jp} min-w-0 px-2 py-1.5 align-middle`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,K.jsxs)(as,{children:[(0,K.jsx)(os,{asChild:!0,children:(0,K.jsx)(`code`,{tabIndex:0,className:`${Re} block min-w-0 truncate`,children:e})}),(0,K.jsx)(ss,{className:`max-w-[min(40rem,90vw)] font-mono break-all`,children:e})]}),(0,K.jsxs)(as,{children:[(0,K.jsx)(os,{asChild:!0,children:(0,K.jsx)(L,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,"aria-label":n(`statusBar.copyCommand`),onClick:()=>t(e),children:(0,K.jsx)(Ys,{className:`size-3.5`})})}),(0,K.jsx)(ss,{children:n(`statusBar.copyCommand`)})]})]})})}function Qp({process:e,killing:t,onKill:n,onCopy:r}){let{t:i,i18n:a}=B(),o=e.command===``?e.name:e.command;return(0,K.jsxs)(`tr`,{className:`group/row hover:bg-muted/50`,children:[(0,K.jsx)(`td`,{className:Yp,children:e.pid}),(0,K.jsx)(Zp,{command:o,onCopy:r}),(0,K.jsx)(`td`,{className:Yp,children:Nf(e.uptimeSeconds,i)}),(0,K.jsx)(`td`,{className:Yp,children:Pf(e.cpuPercent,a.language)}),(0,K.jsx)(`td`,{className:Yp,children:Ff(e.memoryBytes,i,a.language)}),(0,K.jsx)(`td`,{className:`${Jp} px-2 py-1.5 text-right align-middle`,children:(0,K.jsxs)(as,{children:[(0,K.jsx)(os,{asChild:!0,children:(0,K.jsx)(L,{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,K.jsx)(Ls,{className:`size-4`})})}),(0,K.jsx)(ss,{children:i(`statusBar.kill`)})]})})]})}function $p(e,t){let{t:n}=B(),r=Ke(),[i,a]=(0,H.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){tt(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),V(n(`statusBar.copied`))}catch{tt(n(`statusBar.copyFailed`))}}}}function em({api:e,polled:t,onOpenGroup:n}){let{t:r}=B(),i=t.processes??[],{killing:a,kill:o,copy:s}=$p(e,t);if(t.error!==null&&t.processes===null)return(0,K.jsx)(`p`,{className:`text-destructive`,children:t.error});if(i.length===0)return(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:r(`statusBar.noProcesses`)});let c=Mp(i),l=`sticky top-0 z-10 border-b bg-card px-2 py-1.5 font-medium text-muted-foreground`;return(0,K.jsxs)(`table`,{className:`w-full table-fixed border-separate border-spacing-0 text-left`,children:[(0,K.jsxs)(`colgroup`,{children:[(0,K.jsx)(`col`,{className:`w-16`}),(0,K.jsx)(`col`,{}),(0,K.jsx)(`col`,{className:`w-24`}),(0,K.jsx)(`col`,{className:`w-20`}),(0,K.jsx)(`col`,{className:`w-24`}),(0,K.jsx)(`col`,{className:`w-20`})]}),(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{className:`${l} text-right`,children:r(`statusBar.pid`)}),(0,K.jsx)(`th`,{className:l,children:r(`statusBar.command`)}),(0,K.jsx)(`th`,{className:`${l} text-right`,children:r(`statusBar.uptime`)}),(0,K.jsx)(`th`,{className:`${l} text-right`,children:r(`statusBar.cpu`)}),(0,K.jsx)(`th`,{className:`${l} text-right`,children:r(`statusBar.memory`)}),(0,K.jsx)(`th`,{className:l,children:(0,K.jsx)(`span`,{className:`sr-only`,children:r(`statusBar.kill`)})})]})}),c.map(e=>(0,K.jsxs)(`tbody`,{children:[(0,K.jsx)(Xp,{task:e,onOpenGroup:n}),e.processes.map(e=>(0,K.jsx)(Qp,{process:e,killing:a.has(e.pid),onKill:()=>void o(e),onCopy:e=>void s(e)},e.pid))]},e.key))]})}var tm={live:`bg-status-ok`,reconnecting:`bg-status-warn motion-safe:animate-pulse`,polling:`bg-status-run`};function nm({connection:e,compact:t=!1}){let{t:n}=B(),r=Wf(e,n);return(0,K.jsxs)(as,{children:[(0,K.jsx)(os,{asChild:!0,children:(0,K.jsxs)(`div`,{role:`status`,tabIndex:0,"aria-label":n(`connection.label`,{state:r}),"data-nav-row":!0,className:S(of(),`text-xs text-muted-foreground`,t&&`w-8 justify-center px-0`),children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4 items-center justify-center`,children:(0,K.jsx)(`span`,{className:S(`size-2 shrink-0 rounded-full`,tm[e])})}),t?null:(0,K.jsx)(`span`,{children:r})]})}),(0,K.jsx)(ss,{side:t?`bottom`:`top`,children:t?`${r} (${e})`:e})]})}function rm({open:e,summary:t,connection:n}){let{t:r}=B();return(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(Hp,{asChild:!0,children:(0,K.jsxs)(L,{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,K.jsx)(Ts,{className:`size-4`}):(0,K.jsx)(Ds,{className:`size-4`}),(0,K.jsx)(`span`,{className:`truncate text-muted-foreground`,children:t})]})}),(0,K.jsx)(`div`,{className:`shrink-0 pr-2`,children:(0,K.jsx)(nm,{connection:n})})]})}function im(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 am(e,t){return e<t?-1:+(e>t)}function om(e,t){return t?(e,t)=>am(F(e).toLowerCase(),F(t).toLowerCase())||am(e,t):(t,n)=>Number(n===e)-Number(t===e)||am(t,n)}function sm(e,t,n=!1){let r=om(t,n),i=[],a=new Map,o=0,s=0;for(let t of[...e.values()].sort((e,t)=>am(e.specialist,t.specialist))){if(t.running.length===0&&t.waiting.length===0)continue;o+=t.running.length,s+=t.waiting.length;let e=new Map,n=new Map,c=t=>{let r=t.level===`global`?e:n,i=r.get(t.repository);i||(i={repository:t.repository,running:[],waiting:[]},r.set(t.repository,i)),(t.status===`running`?i.running:i.waiting).push(t)};if(t.running.forEach(c),t.waiting.forEach(c),e.size>0){let n=[...e.values()].sort((e,t)=>r(e.repository,t.repository));i.push({specialist:t.specialist,name:t.name,max:t.max,running:t.running.length,waiting:t.waiting.length,repositories:n})}for(let[e,r]of n){let n=a.get(e);n||(n={repository:e,running:0,waiting:0,specialists:[]},a.set(e,n)),n.running+=r.running.length,n.waiting+=r.waiting.length,n.specialists.push({specialist:t.specialist,name:t.name,max:t.max,totalRunning:t.running.length,running:r.running,waiting:r.waiting})}}return{global:i,project:[...a.values()].sort((e,t)=>r(e.repository,t.repository)),running:o,waiting:s}}function $({status:e,label:t,title:n,wait:r,tip:i,onClick:a}){let{t:o}=B(),s=Bf(e,o),c=s.icon,l=t??s.label;return(0,K.jsxs)(as,{children:[(0,K.jsx)(os,{asChild:!0,children:(0,K.jsxs)(R,{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,K.jsx)(c,{"aria-hidden":!0,className:S(s.spin&&`motion-safe:animate-spin`)}),(0,K.jsx)(`span`,{className:`min-w-0 truncate`,title:n,children:l})]})}),(0,K.jsx)(ss,{children:r?`${Vf(r,o)} (${e})`:i?`${e} · ${i}`:e})]})}function cm(e,t,n){return(0,H.useMemo)(()=>sm(im(e),t,n),[e,t,n])}function lm({entries:e,onOpen:t}){return(0,K.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:e.map(e=>(0,K.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2`,children:[(0,K.jsx)(L,{variant:`link`,size:`sm`,className:`h-auto min-w-0 p-0 text-left whitespace-normal`,onClick:()=>t(e),children:e.title}),(0,K.jsx)($,{status:e.status}),(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.stepName,` · `,e.runTitle]})]},`${e.runId}/${e.group}/${e.status}`))})}function um({running:e,waiting:t}){let{t:n}=B();return(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:[...e>0?[n(`specialistLoad.running`,{n:e})]:[],...t>0?[n(`specialistLoad.waiting`,{n:t})]:[]].join(` · `)})}function dm({use:e,onOpen:t}){return(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5 pl-3`,children:[(0,K.jsxs)(`div`,{className:`flex gap-2`,title:e.repository,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:F(e.repository)}),(0,K.jsx)(um,{running:e.running.length,waiting:e.waiting.length})]}),(0,K.jsx)(`div`,{className:`pl-3`,children:(0,K.jsx)(lm,{entries:[...e.running,...e.waiting],onOpen:t})})]})}function fm({runs:e,selected:t,allProjects:n=!1,onOpenGroup:r}){let{t:i}=B(),a=cm(e,t,n),o=a.running===0&&a.waiting===0,s=e=>e===null?``:` ${i(`specialistLoad.limit`,{max:e})}`;return(0,K.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[o?(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:i(`specialistLoad.none`)}):null,a.global.length>0?(0,K.jsxs)(`section`,{"aria-label":i(`specialistLoad.global`),className:`flex flex-col gap-2`,children:[(0,K.jsx)(`h3`,{className:`font-semibold`,children:i(`specialistLoad.global`)}),a.global.map(e=>(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(`span`,{className:`font-medium`,title:e.specialist,children:e.name}),(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.max===null?i(`topology.busyUnlimited`,{n:e.running}):i(`topology.busy`,{n:e.running,max:e.max}),e.waiting>0?` · ${i(`specialistLoad.waiting`,{n:e.waiting})}`:``]})]}),e.repositories.map(e=>(0,K.jsx)(dm,{use:e,onOpen:r},e.repository))]},e.specialist))]}):null,a.project.length>0?(0,K.jsxs)(`section`,{"aria-label":i(`specialistLoad.project`),className:`flex flex-col gap-2`,children:[(0,K.jsx)(`h3`,{className:`font-semibold`,children:i(`specialistLoad.project`)}),a.project.map(e=>(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsxs)(`div`,{className:`flex gap-2`,title:e.repository,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:F(e.repository)}),(0,K.jsx)(um,{running:e.running,waiting:e.waiting})]}),e.specialists.map(e=>(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5 pl-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsxs)(`span`,{className:`font-medium`,title:e.specialist,children:[e.name,s(e.max)]}),(0,K.jsx)(um,{running:e.running.length,waiting:e.waiting.length}),e.totalRunning>e.running.length?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:i(`specialistLoad.machine`,{n:e.totalRunning})}):null]}),(0,K.jsx)(`div`,{className:`pl-3`,children:(0,K.jsx)(lm,{entries:[...e.running,...e.waiting],onOpen:r})})]},e.specialist))]},e.repository))]}):null]})}function pm(e){document.body.classList.remove(`select-none`),e(null)}function mm({height:e,chosen:t,viewportHeight:n,onPreview:r,onCommit:i}){let{t:a}=B(),o=(0,H.useRef)(null),[s,c]=(0,H.useState)(!1),l=Pp(n),u=(0,H.useRef)(r);u.current=r,(0,H.useEffect)(()=>()=>{o.current!==null&&(o.current=null,pm(u.current))},[]);let d=()=>{let e=o.current;e!==null&&(o.current=null,c(!1),pm(r),i(Fp(t,e.last,n)))};return(0,K.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=Ip(t.startHeight+(t.startY-e.clientY),n),r(t.last))},onPointerUp:d,onPointerCancel:d,onKeyDown:r=>{let a=zp(r.key);a!==0&&(r.preventDefault(),i(Bp(t,e,a,n)))}})}function hm({runs:e,selected:t,allProjects:n=!1,connection:r,streamedProcesses:i=null,api:a,onOpenGroup:o}){let{t:s}=B(),[c,l]=Ne(`specialistLoad.open`,!1),[u,d]=Ne(`statusBar.tab`,`specialists`),f=Rp(),[p,m]=(0,H.useState)(null),h=jp(a,i,r),g=cm(e,t,n),_=h.processes===null?`—`:String(h.processes.length);return(0,K.jsxs)(Vp,{open:c,onOpenChange:l,className:`sticky bottom-0 shrink-0 border-t bg-card text-xs`,"data-testid":`status-bar`,children:[c?(0,K.jsx)(mm,{height:p??f.height,chosen:f.chosen,viewportHeight:f.viewportHeight,onPreview:m,onCommit:f.setChosen}):null,(0,K.jsx)(rm,{open:c,summary:s(`statusBar.summary`,{running:g.running,waiting:g.waiting,processes:_}),connection:r}),(0,K.jsx)(Up,{className:`flex flex-col px-4 pb-3`,style:{height:p??f.height},"data-testid":`status-bar-content`,children:(0,K.jsxs)(Wp,{value:u,onValueChange:e=>d(e),className:`flex min-h-0 flex-1 flex-col gap-0`,children:[(0,K.jsxs)(Gp,{className:`shrink-0`,children:[(0,K.jsx)(Kp,{value:`specialists`,children:s(`statusBar.tabSpecialists`)}),(0,K.jsx)(Kp,{value:`processes`,children:s(`statusBar.tabProcesses`)})]}),(0,K.jsx)(qp,{value:`specialists`,className:`min-h-0 flex-1 overflow-y-auto pt-3`,children:(0,K.jsx)(fm,{runs:e,selected:t,allProjects:n,onOpenGroup:o})}),(0,K.jsx)(qp,{value:`processes`,className:`min-h-0 flex-1 overflow-y-auto`,children:(0,K.jsx)(em,{api:a,polled:h,onOpenGroup:o})})]})})]})}var gm=e=>new EventSource(e),_m=new Set([`snapshot`,`daemon`,`repositories`,`tags`,`run`,`queue`,`globalQueue`,`processes`,`network`]);function vm(e){return _m.has(e.event)}function ym(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t==`object`&&t?t:null}var bm=3e3,xm=4e3;function Sm(e,t,n){let r=null,i=null;return{start:()=>{r||i||(i=setTimeout(()=>{i=null,n()||(t(),e(),r=setInterval(()=>void e(),bm))},xm))},stop:()=>{r&&clearInterval(r),i&&clearTimeout(i),r=null,i=null}}}function Cm(e,t,n){e.onopen=()=>{t.stop(),n.live()},e.onmessage=e=>{let r=ym(e.data);r!==null&&(t.stop(),n.live(),n.event(r))},e.onerror=()=>{n.broken(),t.start()}}function wm(e){return e.effective?.name?.trim()||(typeof e.raw.name==`string`?e.raw.name.trim():``)||e.slug}function Tm(e){return new Map(e.map(e=>[e.slug,wm(e)]))}function Em(e,t){return e.get(t)||t}function Dm(e,t){let n=Em(e,t);return n===t?t:`${n} (${t})`}var Om=[`needs_human`,`conflict`],km=[`needs_human`,`conflict`,`failed`];function Am(e){return`kind`in e&&e.kind===`repair`||e.slug===`_repair`}function jm(e){return e.status===`running`||e.status===`merging`}function Mm(e){return Am(e)&&!jm(e)?!1:km.includes(e.status)}function Nm(e){return[...e].sort((e,t)=>Number(Mm(t))-Number(Mm(e)))}function Pm(e){return[...Nm(e.groups),...Nm(e.system??[])]}function Fm(e){let t=e.system??[],n=!e.finished&&e.state!==`finished`,r=t=>Am(t)&&n&&(jm(t)||m(e)),i=t.filter(e=>!Am(e)||r(e)),a=t=>n&&(jm(t)||Am(t)&&m(e)),o=e=>Om.includes(e.status),s=e=>e.status===`failed`;return e.groups.find(o)??i.find(o)??e.groups.find(a)??i.find(a)??e.groups.find(s)??i.find(s)??e.groups[0]??t.find(e=>e.kind===`split`)??i[0]??t[0]??null}function Im({id:e,name:t,focusable:n=!0}){let{t:r}=B(),i=t===e?r(`pipelineBadge.labelSame`,{id:e}):r(`pipelineBadge.label`,{name:t,id:e});return(0,K.jsxs)(as,{children:[(0,K.jsx)(os,{asChild:!0,children:(0,K.jsxs)(R,{variant:`outline`,className:`max-w-40 rounded-md`,"aria-label":i,tabIndex:n?0:void 0,children:[(0,K.jsx)(dc,{"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]})}),(0,K.jsx)(ss,{children:i})]})}function Lm({id:e,name:t,focusable:n=!0}){let{t:r}=B();if(e==="default")return null;let i=t===e?r(`variantBadge.labelSame`,{id:e}):r(`variantBadge.label`,{name:t,id:e});return(0,K.jsxs)(as,{children:[(0,K.jsx)(os,{asChild:!0,children:(0,K.jsxs)(R,{variant:`outline`,className:`max-w-32 rounded-md`,"aria-label":i,tabIndex:n?0:void 0,children:[(0,K.jsx)(kc,{"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]})}),(0,K.jsx)(ss,{children:i})]})}function Rm(e){return typeof e.name==`string`&&e.name.trim()!==``?e.name.trim():null}function zm({go:e,to:t}){let{t:n}=B();return(0,K.jsx)(X,{heading:n(`palette.sections`),children:Ql.map(({view:r,labelKey:i,icon:a})=>{let o=n(`nav.${i}`);return(0,K.jsxs)(Z,{value:`${n(`palette.section`)} ${o}`,onSelect:()=>e(t(r)),children:[(0,K.jsx)(a,{}),o]},r)})})}function Bm({go:e,runs:t}){let{t:n}=B();return(0,K.jsx)(X,{heading:n(`palette.runs`),children:t.map(t=>(0,K.jsxs)(Z,{value:`${n(`palette.run`)} ${vf(t.number)} ${wf(t)} ${t.id} ${t.pipelineName} ${t.pipeline}`,onSelect:()=>e({view:`runs`,run:t.id,group:null,step:null,tab:null}),children:[(0,K.jsxs)(`span`,{className:`truncate`,children:[(0,K.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:vf(t.number)}),` `,wf(t)]}),(0,K.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[(0,K.jsx)(Im,{id:t.pipeline,name:t.pipelineName,focusable:!1}),(0,K.jsx)(Lm,{id:t.variant,name:t.variantName,focusable:!1}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Uf(t,n)})]})]},t.id))})}function Vm({go:e,run:t}){let{t:n}=B();return(0,K.jsx)(X,{heading:n(`palette.groups`),children:Nm(t.groups).map(r=>(0,K.jsx)(Z,{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 Hm({go:e,to:t,entries:n}){let{t:r}=B();return(0,K.jsxs)(K.Fragment,{children:[n.pipelines.length>0?(0,K.jsx)(X,{heading:r(`palette.pipelines`),children:n.pipelines.map(n=>{let i=Rm(n.raw)??n.id;return(0,K.jsx)(Z,{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,K.jsx)(X,{heading:r(`palette.specialists`),children:n.specialists.map(n=>{let i=wm(n);return(0,K.jsx)(Z,{value:`${r(`palette.specialist`)} ${i} ${n.slug}`,onSelect:()=>e(t(`specialists`,n.slug)),children:i},n.slug)})}):null]})}function Um({onNewTask:e,onNewTaskPage:t,onShortcuts:n}){let{t:r}=B();return(0,K.jsxs)(X,{heading:r(`palette.actions`),children:[(0,K.jsx)(Z,{value:`${r(`palette.action`)} ${r(`palette.newTask`)}`,onSelect:e,children:r(`palette.newTask`)}),(0,K.jsx)(Z,{value:`${r(`palette.action`)} ${r(`palette.newTaskPage`)}`,onSelect:t,children:r(`palette.newTaskPage`)}),(0,K.jsx)(Z,{value:`${r(`palette.action`)} ${r(`palette.shortcuts`)}`,onSelect:n,children:r(`palette.shortcuts`)})]})}function Wm({onChosen:e}){let{t}=B(),{setChoice:n}=lp(),r=[`system`,...Yf.map(e=>e.code)];return(0,K.jsx)(X,{heading:t(`palette.language`),children:r.map(r=>{let i=r===`system`?t(`language.system`):Yf.find(e=>e.code===r)?.name??r;return(0,K.jsx)(Z,{value:`${t(`palette.language`)} ${i} ${r}`,onSelect:()=>{e(),n(r)},children:i},r)})})}function Gm({open:e,onOpenChange:t,api:n,runs:r,route:i,onRoute:a,onShortcuts:o}){let{t:s}=B(),[c,l]=(0,H.useState)(null);(0,H.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,K.jsxs)(Ad,{open:e,onOpenChange:t,title:s(`palette.title`),children:[(0,K.jsx)(jd,{placeholder:s(`palette.placeholder`)}),(0,K.jsxs)(Md,{children:[(0,K.jsx)(Nd,{children:s(`palette.empty`)}),(0,K.jsx)(zm,{go:u,to:d}),(0,K.jsx)(Bm,{go:u,runs:p}),f&&f.groups.length>1?(0,K.jsx)(Vm,{go:u,run:f}):null,c?(0,K.jsx)(Hm,{go:u,to:d,entries:c}):null,(0,K.jsx)(Um,{onNewTask:()=>{u(d(`queue`)),_u(`queue-task`)},onNewTaskPage:()=>{u({view:`queue`,run:`new`,group:null,step:null,tab:null}),_u(`new-task-page`)},onShortcuts:()=>{t(!1),o()}}),(0,K.jsx)(Wm,{onChosen:()=>t(!1)})]})]})}var Km=[`general`,`navigation`,`runs`,`queue`],qm=[{combo:`mod+k`,label:`shortcuts.palette`,group:`general`},{combo:`?`,label:`shortcuts.help`,group:`general`},{combo:`Escape`,label:`shortcuts.close`,group:`general`},{combo:`ctrl+n`,label:`shortcuts.newTask`,group:`general`},{combo:`ctrl+p`,label:`shortcuts.project`,group:`general`},...Ql.map(e=>({combo:`ctrl+${e.key}`,label:`nav.${e.labelKey}`,group:`navigation`})),{combo:`j`,label:`shortcuts.nextRun`,group:`runs`},{combo:`k`,label:`shortcuts.previousRun`,group:`runs`},{combo:`Alt+ArrowUp`,label:`shortcuts.moveItem`,group:`queue`},{combo:`Alt+ArrowDown`,label:`shortcuts.moveItem`,group:`queue`}];function Jm({open:e,onOpenChange:t}){let{t:n}=B();return(0,K.jsx)(Cd,{open:e,onOpenChange:t,children:(0,K.jsxs)(wd,{children:[(0,K.jsxs)(Td,{children:[(0,K.jsx)(Dd,{children:n(`shortcuts.title`)}),(0,K.jsx)(Od,{children:n(`shortcuts.description`)})]}),Km.map(e=>(0,K.jsxs)(`section`,{"aria-label":n(`shortcuts.groups.${e}`),children:[(0,K.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase text-muted-foreground`,children:n(`shortcuts.groups.${e}`)}),(0,K.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] items-center gap-x-4 gap-y-2 text-sm`,children:qm.filter(t=>t.group===e).map(e=>(0,K.jsxs)(`div`,{className:`contents`,children:[(0,K.jsx)(`dt`,{className:`flex items-center gap-1`,children:fu(e.combo).map(e=>(0,K.jsx)(yu,{children:e},e))}),(0,K.jsx)(`dd`,{children:n(e.label)})]},e.combo))})]},e))]})})}var Ym=[`needs_human`,`active`,`repair`,`queued`,`paused`,`frozen`,`finished`,`failed`,`cancelled`],Xm={states:[],pipelines:[],variants:[],specialists:[],tagIds:[],repositories:[]},Zm=[`states`,`pipelines`,`variants`,`specialists`,`tagIds`,`repositories`];function Qm(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 $m(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 eh(e,t){let n=(e.tags??[]).flatMap(e=>t.get(e.id)?.name??[]);return[wf(e),e.name,e.pipeline,e.pipelineName,e.variant,e.variantName,e.id,vf(e.number),...e.groups.map(e=>e.title),...n,...Qm(e)].filter(e=>!!e).join(`
|
|
5
|
+
`).toLowerCase()}function th(e,t){return t===null?e:e.filter(e=>e.repository===t)}function nh(e,t,n){let r=t.trim().toLowerCase();if(r===``)return!0;let i=/^#(\d+)$/.exec(r);return i?e.number===Number(i[1]):eh(e,n).includes(r)}function rh(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`variants`:return n.variants.length===0||n.variants.includes(e.variant);case`specialists`:return n.specialists.length===0||Qm(e).some(e=>n.specialists.includes(e));case`tagIds`:return $m(e,n.tagIds,i);case`repositories`:return r!==`all`||n.repositories.length===0||n.repositories.includes(e.repository)}}function ih(e,t,n,r,i=null,a=new Map){return th(e,r===`repository`?i:null).filter(e=>nh(e,t,a)&&Zm.every(t=>rh(e,t,n,r,a)))}function ah(e,t,n,r,i,a,o){return th(e,r===`repository`?i:null).filter(e=>nh(e,t,a)&&Zm.every(t=>t===o||rh(e,t,n,r,a)))}function oh(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 ah(e,t,n,r,i,a,o))switch(o){case`states`:c(s.state);break;case`pipelines`:c(s.pipeline);break;case`variants`:c(s.variant);break;case`specialists`:Qm(s).forEach(c);break;case`repositories`:c(s.repository);break;case`tagIds`:for(let e of a.keys())(s.tags??[]).length>0&&$m(s,[e],a)&&c(e)}return s}function sh(e){let t=e.filter(e=>e.state===`needs_human`).length;return{working:e.filter(e=>e.state===`active`||m(e)).length+t,waiting:t}}function ch(e,t,n){return(e.trim()===``?0:1)+Zm.reduce((e,r)=>e+(r===`repositories`&&n!==`all`?0:t[r].length),0)}function lh({onBack:e,children:t}){let{t:n}=B();return(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,K.jsxs)(L,{variant:`ghost`,size:`sm`,className:`m-2 w-fit`,onClick:e,children:[(0,K.jsx)(ps,{}),n(`runs.page.back`)]}),t]})}function uh({label:e,countLabel:t,wide:n,children:r}){let i=(0,K.jsxs)(L,{variant:`outline`,size:`sm`,className:`w-full justify-start`,children:[(0,K.jsx)(Lc,{}),t??e]});return n?(0,K.jsxs)(Pd,{children:[(0,K.jsx)(Fd,{asChild:!0,children:i}),(0,K.jsx)(Id,{className:`w-80 p-3`,children:r})]}):(0,K.jsxs)(eu,{children:[(0,K.jsx)(tu,{asChild:!0,children:i}),(0,K.jsxs)(nu,{children:[(0,K.jsx)(ru,{children:e}),(0,K.jsx)(iu,{className:`sr-only`,children:e}),(0,K.jsx)(`div`,{className:`p-3`,children:r})]})]})}var dh=[`builtin`,`project`,`global`,`other`],fh=`__create`;function ph({text:e,icon:t,hint:n,note:r,disabled:i,onRemove:a}){let{t:o}=B();return(0,K.jsxs)(R,{variant:`outline`,className:`min-w-0 max-w-full gap-1.5 pr-1`,children:[t,(0,K.jsx)(`span`,{className:`min-w-0 truncate`,title:n??e,children:e}),r?(0,K.jsx)(`span`,{className:`font-normal text-status-warn`,children:r}):null,(0,K.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,K.jsx)(Zl,{})})]})}function mh({source:e,heading:t,options:n,values:r,mark:i,display:a,look:o,onAdd:s}){let{t:c}=B();return n.length===0?null:(0,K.jsx)(X,{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,K.jsxs)(Z,{value:`${e}:${t.name}`,className:`items-start`,onSelect:()=>s(t.name),children:[(0,K.jsx)(Cs,{className:`mt-0.5 shrink-0 ${r.includes(t.name)?`opacity-100`:`opacity-0`}`}),o.icon?(0,K.jsx)(`span`,{className:`flex h-5 shrink-0 items-center`,children:o.icon(t.name)}):null,(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,K.jsxs)(`span`,{className:`line-clamp-3 whitespace-normal break-words`,title:o.hint?.(t.name)??c,children:[c,n?(0,K.jsx)(`span`,{className:`ml-2 text-xs text-status-warn`,children:n}):null]}),t.description&&!a?(0,K.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:t.description}):null]})]},`${e}:${t.name}`)})})}function hh(e,t){let n=t.toLowerCase();return e.filter(e=>n===``||e.name.toLowerCase().includes(n)||(e.description??``).toLowerCase().includes(n))}function gh({inherited:e,values:t,display:n,look:r,mark:i,disabled:a,onRemove:o}){let{t:s}=B();return(0,K.jsxs)(K.Fragment,{children:[e.map(e=>(0,K.jsxs)(R,{variant:`mute`,"data-inherited":!0,children:[e,(0,K.jsx)(`span`,{className:`font-normal`,children:s(`picker.fromDefaults`)})]},`inherited:${e}`)),t.map(e=>(0,K.jsx)(ph,{text:n?.(e)??e,icon:r?.icon?.(e),hint:r?.hint?.(e),note:i?.(e)??null,disabled:a,onRemove:()=>o(e)},e))]})}function _h({id:e,label:t,open:n,listId:r,disabled:i}){let{t:a}=B();return(0,K.jsx)(Fd,{asChild:!0,children:(0,K.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,K.jsx)(_l,{className:`size-3`}),a(`picker.add`)]})})}function vh({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}=B();return(0,K.jsxs)(Md,{id:e,children:[n.length===0&&!i?(0,K.jsx)(Nd,{children:t.length===0?d(`picker.typeValue`):d(`picker.nothing`)}):null,dh.map(e=>(0,K.jsx)(mh,{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,K.jsx)(X,{children:(0,K.jsxs)(Z,{value:`${fh}:${r}`,onSelect:()=>u([r]),children:[(0,K.jsx)(_l,{}),d(`picker.create`,{value:r})]})}):null]})}function yh(e,t){let n=[...e];for(let e of t){let t=e.trim();t!==``&&!n.includes(t)&&n.push(t)}return n}function bh(e,t,n){let r=n.trim().toLowerCase();return e.filter(e=>r===``||e.label.toLowerCase().includes(r)||(e.hint??``).toLowerCase().includes(r)||(e.keywords??``).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 xh({option:e,checked:t,onToggle:n}){return(0,K.jsxs)(Z,{value:`option:${e.value}`,onSelect:n,children:[(0,K.jsx)(Cs,{className:S(t?`opacity-100`:`opacity-0`)}),(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[e.render??(0,K.jsx)(`span`,{className:`truncate`,children:e.label}),e.hint?(0,K.jsx)(`span`,{className:`text-xs break-all text-muted-foreground`,children:e.hint}):null]}),e.count===void 0?null:(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:e.count})]})}function Sh(e){let t=new Map;for(let n of e)t.set(n.group,[...t.get(n.group)??[],n]);return[...t]}function Ch({label:e,listId:t,options:n,selected:r,query:i,onQuery:a,onChange:o,clearLabel:s}){let{t:c}=B(),l=bh(n,r,i),u=e=>o(r.includes(e)?r.filter(t=>t!==e):[...r,e]);return(0,K.jsxs)(kd,{shouldFilter:!1,label:c(`picker.search`,{label:e}),children:[(0,K.jsx)(jd,{value:i,onValueChange:a,placeholder:c(`picker.searchOnly`)}),(0,K.jsxs)(Md,{id:t,children:[(0,K.jsx)(Nd,{children:c(`picker.nothing`)}),Sh(l).map(([e,t])=>(0,K.jsx)(X,{heading:e||void 0,children:t.map(e=>(0,K.jsx)(xh,{option:e,checked:r.includes(e.value),onToggle:()=>u(e.value)},e.value))},e??``)),r.length>0?(0,K.jsx)(X,{className:`border-t`,children:(0,K.jsx)(Z,{value:`clear`,onSelect:()=>o([]),children:s})}):null]})]})}function wh({id:e,label:t,options:n,selected:r,onChange:i,clearLabel:a,look:o,disabled:s=!1}){let c=(0,H.useId)(),[l,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(``);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t}),(0,K.jsxs)(Pd,{open:l,onOpenChange:e=>{u(e),e||f(``)},children:[(0,K.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,K.jsx)(gh,{inherited:[],values:r,display:e=>n.find(t=>t.value===e)?.label??e,look:o,mark:void 0,disabled:s,onRemove:e=>i(r.filter(t=>t!==e))}),(0,K.jsx)(_h,{id:e,label:t,open:l,listId:c,disabled:s})]}),(0,K.jsx)(Id,{className:`p-0`,children:(0,K.jsx)(Ch,{label:t,listId:c,options:n,selected:r,query:d,onQuery:f,onChange:i,clearLabel:a})})]})]})}function Th(e){let{runs:t,query:n,filters:r,scope:i,repository:a,repositoryPaths:o}=e,{t:s}=B(),{byId:c,of:l}=g(),d=e=>oh(t,n,r,i,a,c,e),f=th(t,i===`repository`?a:null),p=d(`states`),m=Ym.map(e=>({value:e,label:Bf(e,s).label,count:p.get(e)??0})),h=d(`pipelines`),_=new Map;for(let e of f)_.set(e.pipeline,e.pipelineName||e.pipeline);for(let e of r.pipelines)_.has(e)||_.set(e,e);let v=[..._].map(([e,t])=>({value:e,label:t,count:h.get(e)??0})).sort((e,t)=>e.label.localeCompare(t.label,`en`)),y=d(`variants`),b=new Map;for(let e of f)b.set(e.variant,e.variantName||e.variant);for(let e of r.variants)b.has(e)||b.set(e,e);let x=[...b].map(([e,t])=>({value:e,label:t,count:y.get(e)??0})).sort((e,t)=>e.label.localeCompare(t.label,`en`)),S=d(`specialists`),C=new Set(r.specialists);for(let e of f)Qm(e).forEach(e=>C.add(e));let w=new Map;for(let e of f)for(let t of e.topology?.stages??[])t.performer.type===`specialist`&&t.performer.name&&w.set(t.performer.slug,t.performer.name);let T=[...C].map(e=>({value:e,label:Em(w,e),count:S.get(e)??0})).sort((e,t)=>e.label.localeCompare(t.label,`en`)),E=d(`tagIds`),ee=l(a).map(e=>({value:e.id,label:e.name,count:E.get(e.id)??0,render:(0,K.jsx)(u,{tag:e})})),D=d(`repositories`);return{states:m,pipelines:v,variants:x,specialists:T,tags:ee,repositories:[...new Set([...r.repositories,...t.map(e=>e.repository)])].map(e=>({value:e,label:F(e),hint:o?.get(e)??e,render:(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(it,{path:e}),F(e)]}),count:D.get(e)??0})).sort((e,t)=>e.label.localeCompare(t.label,`en`)||e.hint.localeCompare(t.hint,`en`))}}function Eh({runs:e,query:t,onQuery:n,filters:r,onFilters:i,scope:a,repository:o,repositoryPaths:s}){let{t:c}=B(),l=Th({runs:e,query:t,filters:r,scope:a,repository:o,repositoryPaths:s}),u=e=>t=>i({...r,[e]:t}),d=c(`runs.list.clear`),f=[[c(`runs.list.state`),`states`,l.states],[c(`runs.list.pipeline`),`pipelines`,l.pipelines],[c(`runs.list.variant`),`variants`,l.variants],[c(`runs.list.specialists`),`specialists`,l.specialists],[c(`runs.list.tags`),`tagIds`,l.tags]];return a===`all`&&f.push([c(`runs.list.repositories`),`repositories`,l.repositories]),(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(Du,{type:`search`,"aria-label":c(`runs.list.search`),placeholder:c(`runs.list.search`),value:t,onChange:e=>n(e.target.value)}),f.map(([e,t,n])=>(0,K.jsx)(wh,{label:e,options:n,selected:r[t],onChange:u(t),clearLabel:d},t))]})}function Dh({filterProps:e,count:t,wide:n}){let{t:r}=B();return(0,K.jsx)(uh,{label:r(`runs.list.filters`),countLabel:t>0?r(`runs.list.filtersCount`,{count:t}):null,wide:n,children:(0,K.jsx)(Eh,{...e})})}function Oh(e){let{t}=B();return(0,K.jsx)(Ue,{label:t(`runs.list.filters`),count:e.count,countLabel:t(`runs.list.filtersCount`,{count:e.count}),collapsed:e.collapsed,onCollapsed:e.onCollapsed,children:(0,K.jsx)(Eh,{...e.filterProps})})}function kh({onRoute:e}){let{t}=B();return(0,K.jsxs)(at,{icon:(0,K.jsx)(Cc,{}),title:t(`runs.page.noRuns`),className:`m-auto`,children:[(0,K.jsxs)(`p`,{children:[t(`runs.page.startWith`),` `,(0,K.jsx)(`code`,{className:`font-mono`,children:`aip run start feature --task "…"`}),`.`]}),(0,K.jsx)(L,{variant:`outline`,size:`sm`,asChild:!0,children:(0,K.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 Ah(e){let[t,n]=(0,H.useState)(!1);return(0,H.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 jh(e){let[t,n]=(0,H.useState)(0);return(0,H.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 Mh=6;function Nh({reason:e}){let{t}=B(),[n,r]=(0,H.useState)(!1);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`pre`,{className:`font-mono text-xs break-words whitespace-pre-wrap`,children:n?e:e.split(`
|
|
6
|
+
`).slice(0,Mh).join(`
|
|
7
|
+
`)}),e.split(`
|
|
8
|
+
`).length>Mh?(0,K.jsx)(`button`,{type:`button`,className:`self-start text-xs underline`,onClick:()=>r(!n),children:t(n?`runs.system.showLess`:`runs.system.showAll`)}):null]})}function Ph({ctx:e}){let{t}=B(),{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,K.jsxs)(N,{variant:`destructive`,className:`flex flex-col gap-2`,children:[(0,K.jsx)(`b`,{children:t(`runs.system.deliveryFailed`)}),i?.delivery.finishedAt==null?null:(0,K.jsx)(`span`,{className:`text-xs`,children:t(`runs.system.lastAttempt`,{time:jf(i.delivery.finishedAt)})}),u?(0,K.jsx)(Nh,{reason:u}):null,(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsxs)(L,{variant:`outline`,size:`sm`,loading:a||c,disabled:!l||c,onClick:()=>void s(()=>e.onDeliver?e.onDeliver():Promise.resolve()),children:[(0,K.jsx)(o,{}),t(`runs.system.retryDelivery`)]}),(0,K.jsx)(L,{variant:`outline`,size:`sm`,disabled:!l||c||!r,onClick:()=>e.setForcing(!0),children:t(`runs.system.forceDeliver`)}),(0,K.jsx)(L,{variant:`outline`,size:`sm`,disabled:!l||c||!r,onClick:()=>void e.markDelivered(),children:t(`runs.system.markDelivered`)})]})]})}function Fh({run:e,api:t,onConfirm:n,onClose:r}){let{t:i}=B(),[a,o]=(0,H.useState)(null);return(0,H.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(o,()=>o([]))},[t,e]),(0,K.jsx)(Cd,{open:!0,onOpenChange:e=>!e&&r(),children:(0,K.jsxs)(wd,{children:[(0,K.jsxs)(Td,{children:[(0,K.jsx)(Dd,{children:i(`runs.apply.title`)}),(0,K.jsx)(Od,{children:i(`runs.apply.description`)})]}),a===null?(0,K.jsx)(pe,{className:`h-12`}):null,a?.map(e=>(0,K.jsxs)(`section`,{className:`text-sm`,children:[(0,K.jsx)(`b`,{children:e.title}),e.delivery.reason?(0,K.jsx)(`p`,{className:`text-status-warn`,children:e.delivery.reason}):null,(0,K.jsx)(`ul`,{className:`mt-1 list-disc pl-5`,children:e.delivery.files.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsx)(Ve,{path:e})},e))})]},e.slug)),(0,K.jsxs)(Ed,{children:[(0,K.jsx)(L,{variant:`outline`,onClick:r,children:i(`common.cancel`)}),(0,K.jsx)(L,{variant:`destructive`,onClick:n,children:i(`runs.apply.confirm`)})]})]})})}function Ih({className:e,...t}){return(0,K.jsx)(`textarea`,{className:S(`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 Lh({onSend:e,onClose:t}){let{t:n}=B(),[r,i]=(0,H.useState)(``),[a,o]=(0,H.useState)(!1),s=r.trim()===``,c=async()=>{if(!(s||a)){o(!0);try{await e(r),t()}catch{}finally{o(!1)}}};return(0,K.jsx)(Cd,{open:!0,onOpenChange:e=>!e&&t(),children:(0,K.jsxs)(wd,{children:[(0,K.jsxs)(Td,{children:[(0,K.jsx)(Dd,{children:n(`runs.message.title`)}),(0,K.jsx)(Od,{children:n(`runs.message.desc`)})]}),(0,K.jsx)(`p`,{className:`text-sm text-status-warn`,children:n(`runs.message.warn`)}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(Q,{htmlFor:`agent-message`,children:n(`runs.message.label`)}),(0,K.jsx)(Ih,{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(),c())}}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`runs.message.hint`)})]}),(0,K.jsxs)(Ed,{children:[(0,K.jsx)(L,{variant:`outline`,onClick:t,children:n(`common.cancel`)}),(0,K.jsx)(L,{loading:a,disabled:s,onClick:()=>void c(),children:n(`runs.message.send`)})]})]})})}function Rh({ctx:e}){let{t}=B(),{api:n,runId:r,row:i,run:a,messaging:o,onError:s}=e;return(0,K.jsxs)(K.Fragment,{children:[o===null?null:(0,K.jsx)(Lh,{onSend:async e=>{try{await n.message(r,i.slug,o,e)}catch(e){throw s(e.message),e}V(t(`runs.message.sent`))},onClose:()=>e.setMessaging(null)}),e.forcing&&a?(0,K.jsx)(Fh,{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 zh({className:e,...t}){return(0,K.jsx)(Ra,{className:S(`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,K.jsx)(Ba,{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 Bh(e){return e.delivery.merged>e.delivery.applied&&!e.delivery.inProgress}function Vh(e){return e.autoDeliver&&!e.finished}function Hh(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 Uh=new Set([`finished`,`failed`,`cancelled`]);function Wh(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}:Uh.has(e.state)&&e.groups.some(e=>e.status===`merged`&&e.delivery===`pending`&&e.diff?.files!==0)?{status:`undelivered`,reason:null,...n}:null}function Gh(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 Kh(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 qh(e,t){return e.status===`running`&&e.hold===`paused`?(0,K.jsx)($,{status:`running`,label:t(`status.pausing`),tip:t(`runs.header.pausingTip`)}):e.status===`running`&&e.hold!=null?(0,K.jsx)($,{status:`running`,label:t(`status.finishing`),tip:t(`runs.header.finishingTip`,{hold:t(`status.${e.hold}`)})}):(0,K.jsx)($,{status:e.status,wait:e.wait})}function Jh(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,K.jsx)($,{status:`not_merged`}):r<n?(0,K.jsx)($,{status:`merged`,label:t(`status.mergedOf`,{merged:r,total:n})}):(0,K.jsx)($,{status:`merged`})}function Yh(e,t,n,r,i){let{delivery:a}=e,o=Hh(e);if(!o)return null;let s=e.resolver,c=[];return o&&c.push((0,K.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,K.jsx)($,{status:t},`group`)),{key:`delivery`,label:r(`runs.header.parts.delivery`),badges:c}}function Xh(e,t,n,r){let{delivery:i}=e,a=Hh(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,K.jsx)($,{status:e.state,label:Uf(e,n)},`run`)]}];if(t){let r=`kind`in t,i=[(0,K.jsx)(`span`,{children:qh(t,n)},`entry`)],a=r?null:Jh(e,n),o=e.groups.length>0&&e.groups.every(e=>e.status===`merged`);a&&!(t.status===`merged`&&o)&&i.push((0,K.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:Jh(e,n);u&&l.push({key:`merge`,label:n(`runs.header.parts.merge`),badges:[(0,K.jsx)(`span`,{children:u},`merge`)]});let d=Yh(e,c,s,n,r);return d&&l.push(d),l}function Zh({run:e,entry:t,onSelect:n,layout:r=`rows`}){let{t:i}=B(),a=Xh(e,t,i,n);return r===`inline`?(0,K.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:a.map(e=>(0,K.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1.5`,children:[(0,K.jsxs)(`span`,{"data-part":e.key,className:`text-xs text-muted-foreground`,children:[e.label,`:`]}),e.badges]},e.key))}):(0,K.jsx)(`div`,{className:`grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-3 gap-y-1`,children:a.map(e=>(0,K.jsxs)(`div`,{className:`contents`,children:[(0,K.jsx)(`span`,{"data-part":e.key,className:`text-xs text-muted-foreground`,children:e.label}),(0,K.jsx)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:e.badges})]},e.key))})}function Qh({ctx:e}){let{t}=B();return e.tabs.tab!==`log`||e.watch.following||!e.caps.cancel?null:(0,K.jsxs)(L,{variant:`outline`,size:`sm`,title:t(`runs.group.watchTitle`),onClick:e.watch.follow,children:[(0,K.jsx)(tc,{}),t(`runs.group.watch`)]})}function $h({ctx:e}){let{run:t,title:n,showUsage:r}=e;return(0,K.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-base font-semibold`,title:t?void 0:n,children:t?(0,K.jsxs)(`span`,{"aria-hidden":!r||void 0,title:`${wf(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,K.jsx)(`span`,{className:`font-mono font-normal text-muted-foreground`,children:vf(t.number)}),` `,wf(t)]}):n})}function eg({ctx:e}){let{t}=B(),{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),()=>V(t(`runs.header.retryStarted`)));return(0,K.jsxs)(bu,{children:[(0,K.jsx)(xu,{asChild:!0,children:(0,K.jsx)(L,{variant:`outline`,size:`sm`,loading:a,"aria-label":t(`runs.group.more`,{title:c}),title:t(`runs.group.more`,{title:c}),children:(0,K.jsx)($s,{})})}),(0,K.jsxs)(Cu,{align:`end`,children:[(0,K.jsxs)(wu,{disabled:a,onSelect:()=>l(),children:[(0,K.jsx)(o,{}),t(`runs.group.retry`)]}),i.status===`conflict`?null:(0,K.jsxs)(wu,{disabled:a,onSelect:()=>l({refreshConfig:!0}),children:[(0,K.jsx)(xl,{}),t(`runs.group.retryRefreshConfig`)]})]})]})}function tg({ctx:e}){let{t}=B(),{row:n,run:r,busy:i,act:a,caps:s,delivering:c,skip:l}=e;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Qh,{ctx:e}),e.onOnlyReplies?(0,K.jsxs)(`div`,{className:`flex items-center gap-2 whitespace-nowrap`,children:[(0,K.jsx)(zh,{id:`only-replies`,checked:e.onlyReplies,onCheckedChange:e.onOnlyReplies}),(0,K.jsx)(Q,{htmlFor:`only-replies`,children:t(`runs.group.onlyReplies`)})]}):null,`kind`in n?(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`runs.system.badge`)}):null,r?null:qh(n,t),s.retryDelivery?(0,K.jsxs)(L,{variant:`outline`,size:`sm`,loading:i||c,disabled:c,onClick:()=>void a(()=>e.onDeliver?e.onDeliver():Promise.resolve()),children:[(0,K.jsx)(o,{}),t(`runs.system.retryDelivery`)]}):null,l.canSkip&&r&&l.skippable?(0,K.jsxs)(L,{variant:`outline`,size:`sm`,loading:l.skipper.pending!==null,onClick:()=>void l.skipper.toggle(l.skippable,!0,{allGroups:r.groups.length>1}),children:[(0,K.jsx)(jl,{}),t(`runs.group.skipStep`)]}):null,s.cancel?(0,K.jsx)(L,{variant:`destructive`,size:`sm`,loading:i,onClick:()=>void e.cancelGroup(),children:t(`runs.group.cancel`)}):null,s.retry?(0,K.jsx)(eg,{ctx:e}):null]})}function ng({ctx:e}){let{t}=B(),n=e.run?.deliveryStage??null,r=e.run?.delivery.finishedAt??null;return n?(0,K.jsx)(`span`,{role:`status`,"aria-label":t(`runs.system.delivery`),className:`flex flex-wrap items-center gap-x-2`,children:n.status===`delivering`?(0,K.jsx)($,{status:`running`,label:t(`runs.system.delivering`)}):n.status===`applied`||n.status===`apply_failed`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)($,{status:n.status}),r===null?null:(0,K.jsx)(`span`,{children:t(`runs.system.lastAttempt`,{time:jf(r)})})]}):null}):null}function rg({ctx:e}){let{t}=B(),{row:n,showUsage:r}=e;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground`,title:n.step??void 0,children:n.stepName??n.step??`—`}),n.round===null?null:(0,K.jsx)(`span`,{children:t(`runs.group.round`,{round:n.round})}),n.limitUntil===null?null:(0,K.jsx)(`span`,{className:`text-status-warn`,children:t(`runs.group.limitUntil`,{time:jf(n.limitUntil)})}),`kind`in n&&n.kind!==`split`&&n.kind!==`action`&&!c(n)?(0,K.jsx)(ng,{ctx:e}):null,r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{children:yf(n.durationMs)}),xf(n.usage)?(0,K.jsx)(`span`,{children:xf(n.usage)}):null]}):null]})}function ig({ctx:e,run:t}){let{row:n,showUsage:r}=e;return(0,K.jsxs)(K.Fragment,{children:[(0,K.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,K.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,K.jsxs)(`div`,{"data-slot":`group-header-title-row`,className:`flex items-center gap-3 pb-2 [&>h2]:min-w-32`,children:[(0,K.jsx)($h,{ctx:e}),(0,K.jsx)(`div`,{"data-slot":`group-header-statuses`,className:`flex min-w-0 justify-end`,children:e.statusesMounted?(0,K.jsx)(Zh,{run:t,entry:n,onSelect:e.onSelectEntry,layout:`inline`}):null})]})})}),(0,K.jsxs)(`div`,{"data-slot":`group-header-row`,className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,K.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,K.jsx)(rg,{ctx:e})}),(0,K.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:(0,K.jsx)(tg,{ctx:e})})]})]})}function ag({ctx:e,onHeight:t}){let{run:n}=e;return(0,K.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,K.jsx)(ig,{ctx:e,run:n}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{"data-slot":`group-header-row`,className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)($h,{ctx:e}),(0,K.jsx)(tg,{ctx:e})]}),(0,K.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,K.jsx)(rg,{ctx:e})})]})})}var og=5;function sg({attempt:e,onDismiss:t}){let{t:n}=B(),r=e.outsideChanges??[];return r.length===0?null:(0,K.jsxs)(Vp,{defaultOpen:r.length<=og,className:`rounded-lg border border-status-warn/30 bg-status-warn-bg text-sm text-status-warn`,children:[(0,K.jsxs)(`div`,{className:`flex items-center`,children:[(0,K.jsxs)(Hp,{className:`group flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left`,children:[(0,K.jsx)(v,{className:`size-4 transition-transform group-data-[state=open]:rotate-90`}),(0,K.jsx)(Vl,{className:`size-4`,"aria-hidden":!0}),n(`runs.outside.title`,{step:e.stepName??e.stepId,seq:e.seq,count:r.length})]}),t?(0,K.jsx)(L,{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,K.jsx)(Zl,{})}):null]}),(0,K.jsxs)(Up,{children:[(0,K.jsx)(`p`,{className:`px-8 pb-1 text-xs`,children:n(`runs.outside.hint`)}),(0,K.jsx)(`ul`,{className:`px-8 pb-2`,children:r.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsx)(Ve,{path:e})},e))})]})]})}function cg({text:e}){return(0,K.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,K.jsx)(pt,{remarkPlugins:[mt],skipHtml:!1,children:e})})}function lg({title:e,question:t,draft:n,busy:r,onDraft:i,onSubmit:a}){let{t:o}=B();return(0,K.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(``),V(o(`runs.questions.answerSent`))})},children:[(0,K.jsx)(`div`,{className:`text-status-warn [&_*]:font-medium`,children:(0,K.jsx)(cg,{text:t??``})}),(0,K.jsx)(Ih,{"aria-label":o(`runs.questions.answerFor`,{title:e}),value:n,onChange:e=>i(e.target.value),rows:3}),(0,K.jsx)(`div`,{children:(0,K.jsx)(L,{type:`submit`,loading:r,disabled:!n.trim(),children:o(`runs.questions.answer`)})})]})}function ug({question:e,index:t,total:n,value:r,onChange:i}){let{t:a}=B(),o=e.options??[],s=e.recommendation??null;return(0,K.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-2 border-0 p-0`,children:[(0,K.jsx)(`legend`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:a(`runs.questions.question`,{index:t+1,total:n})}),(0,K.jsx)(cg,{text:e.text}),o.length>0?(0,K.jsx)(`div`,{className:`flex min-w-0 max-w-full flex-wrap gap-2`,children:o.map(e=>(0,K.jsxs)(L,{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,K.jsx)(`span`,{className:`min-w-0 max-w-full [overflow-wrap:anywhere]`,children:e}),e===s?(0,K.jsxs)(R,{variant:`warn`,children:[(0,K.jsx)(Fl,{"aria-hidden":`true`}),a(`runs.questions.recommended`)]}):null]},e))}):s?(0,K.jsxs)(`p`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,K.jsx)(Fl,{"aria-hidden":`true`,className:`size-3`}),a(`runs.questions.recommendation`,{text:s})]}):null,(0,K.jsx)(Ih,{"aria-label":a(`runs.questions.answerTo`,{index:t+1}),value:r,onChange:e=>i(e.target.value),rows:2})]})}function dg({questions:e,draftKey:t,drafts:n,busy:r,onDraft:i,onClearDrafts:a,onSubmit:o}){let{t:s}=B(),c=e.map((e,n)=>Af(t,n,e.text)),l=e.map((e,t)=>n[c[t]]??e.recommendation??``),u=l.filter(e=>e.trim()===``).length;return(0,K.jsxs)(`form`,{"aria-label":s(`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(),u>0||o(kf(e,l),()=>{a(t),V(s(`runs.questions.answerSent`))})},children:[(0,K.jsx)(`h3`,{className:`text-sm font-semibold text-status-warn`,children:s(`runs.questions.heading`,{n:e.length})}),e.map((t,n)=>(0,K.jsx)(ug,{question:t,index:n,total:e.length,value:l[n],onChange:e=>i(c[n],e)},c[n])),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,K.jsx)(L,{type:`submit`,loading:r,disabled:u>0,children:s(`runs.questions.answer`)}),u>0?(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s(`runs.questions.unanswered`,{n:u})}):null]})]})}function fg(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 pg(e,t){let n=e.at(-1)??null;return n!==null&&n.key!==t?n:null}function mg(e,t){let[n,r]=Ne(`dismissedNotices`,{}),i=`${e}/${t}`,a=(0,H.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 hg({ctx:e}){let{t}=B(),{api:n,runId:r,row:i,busy:a,act:o}=e;return i.status!==`needs_human`||!i.humanOnly?null:(0,K.jsxs)(`section`,{"aria-label":t(`runs.humanOnly.${i.humanOnly}`),className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(R,{variant:`warn`,children:t(`runs.humanOnly.${i.humanOnly}`)}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`runs.humanOnly.hint`)}),i.humanOnly===`review`?(0,K.jsx)(L,{size:`sm`,loading:a,onClick:()=>void o(()=>n.answer(r,i.slug,`Принято`),()=>V(t(`runs.questions.answerSent`))),children:t(`runs.humanOnly.accept`)}):null]})}function gg({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,K.jsx)(dg,{questions:r.questions,draftKey:s,drafts:o,busy:i,onDraft:c,onClearDrafts:e.onClearDrafts,onSubmit:l}):(0,K.jsx)(lg,{title:e.title,question:r.question,draft:o[s]??``,busy:i,onDraft:e=>c(s,e),onSubmit:l})}function _g({ctx:e}){let{t}=B(),[n,r]=mg(e.runId,e.row.slug),i=pg(fg(e.view,e.row),n);if(!i)return null;if(i.kind===`outside`)return(0,K.jsx)(sg,{attempt:i.attempt,onDismiss:()=>r(i.key)});let a=(0,K.jsx)(L,{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,K.jsx)(Zl,{})});return i.kind===`hints`?(0,K.jsx)(`section`,{"aria-label":t(`runs.group.hintsLabel`),children:(0,K.jsxs)(N,{variant:`warn`,className:`relative pr-10`,children:[a,(0,K.jsx)(`div`,{className:`mb-1 text-xs font-medium uppercase`,children:t(`runs.group.hintsTitle`)}),(0,K.jsxs)(`p`,{children:[t(`runs.group.hintsAdd`),` `,(0,K.jsx)(`code`,{children:`allow_commands`}),`:`,` `,i.patterns.map((e,t)=>(0,K.jsxs)(`span`,{children:[t>0?`, `:``,(0,K.jsx)(`code`,{children:e})]},e)),t(`runs.group.hintsAfter`),` `,(0,K.jsx)(Ve,{path:`aip/specialists/`}),`.`]})]})}):(0,K.jsxs)(N,{variant:i.kind===`reason`?`destructive`:`warn`,className:`relative pr-10`,children:[a,i.kind===`reason`?Mf(i.text,t):i.text]})}function vg({ctx:e}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(hg,{ctx:e}),(0,K.jsx)(gg,{ctx:e}),(0,K.jsx)(_g,{ctx:e})]})}var yg=1048576,bg=`px-2 py-1.5 font-medium`;function xg({api:e,runId:t,group:n,artifact:r}){let{t:i,i18n:a}=B(),o=r.size>yg,[s,c]=(0,H.useState)(null);return(0,H.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,K.jsxs)(`div`,{className:`flex flex-col items-start gap-2`,children:[(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`runs.group.artifactTooLarge`,{limit:If(yg,i,a.language)})}),(0,K.jsx)(Sg,{api:e,runId:t,group:n,artifact:r})]}):s===null||s.id!==r.id?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`runs.group.artifactLoading`)}):`error`in s?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:i(`runs.group.artifactFailed`,{message:s.error})}):r.preview===`markdown`?(0,K.jsx)(cg,{text:s.text}):(0,K.jsx)(`pre`,{className:`overflow-x-auto font-mono text-xs whitespace-pre-wrap`,children:s.text})}function Sg({api:e,runId:t,group:n,artifact:r}){let{t:i}=B();return(0,K.jsx)(L,{variant:`outline`,size:`sm`,asChild:!0,children:(0,K.jsxs)(`a`,{href:e.artifactUrl(t,n,r.id),download:r.fileName,"aria-label":`${i(`runs.group.artifactDownload`)} ${r.fileName}`,children:[(0,K.jsx)(Zs,{}),i(`runs.group.artifactDownload`)]})})}function Cg({onClose:e,...t}){let{t:n}=B();return(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h3`,{className:`truncate text-sm font-medium`,children:t.artifact.title}),(0,K.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:t.artifact.fileName})]}),(0,K.jsxs)(`div`,{className:`flex gap-1`,children:[(0,K.jsx)(Sg,{...t}),(0,K.jsx)(L,{variant:`ghost`,size:`sm`,onClick:e,children:n(`runs.group.artifactClose`)})]})]})}function wg(){let{t:e}=B();return(0,K.jsx)(`thead`,{className:`border-b text-muted-foreground`,children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{className:bg,children:e(`runs.group.artifactStep`)}),(0,K.jsx)(`th`,{className:bg,children:e(`runs.group.artifactTitle`)}),(0,K.jsx)(`th`,{className:bg,children:e(`runs.group.artifactFile`)}),(0,K.jsx)(`th`,{className:bg,children:e(`runs.group.artifactCreated`)}),(0,K.jsx)(`th`,{className:`${bg} text-right`,children:e(`runs.group.artifactSize`)}),(0,K.jsx)(`th`,{className:bg,children:(0,K.jsx)(`span`,{className:`sr-only`,children:e(`runs.group.artifactOpen`)})})]})})}function Tg(e){let{api:t,runId:n,group:r,artifact:i,now:a,opened:o,onOpen:s}=e,{t:c,i18n:l}=B();return(0,K.jsxs)(`tr`,{className:`border-b last:border-0 hover:bg-muted/50`,children:[(0,K.jsxs)(`td`,{className:`px-2 py-1.5`,title:`${i.step} · ${i.specialist}`,children:[i.stepName,` · #`,i.seq]}),(0,K.jsx)(`td`,{className:`px-2 py-1.5`,children:i.title}),(0,K.jsx)(`td`,{className:`px-2 py-1.5`,children:(0,K.jsx)(`code`,{className:`rounded bg-muted px-1 font-mono text-xs`,children:i.fileName})}),(0,K.jsx)(`td`,{className:`px-2 py-1.5 whitespace-nowrap`,children:(0,K.jsx)(`time`,{dateTime:new Date(i.createdAt).toISOString(),title:Rf(i.createdAt,l.language),children:Tf(i.createdAt,a,l.language)})}),(0,K.jsx)(`td`,{className:`px-2 py-1.5 text-right whitespace-nowrap tabular-nums`,children:If(i.size,c,l.language)}),(0,K.jsx)(`td`,{className:`px-2 py-1.5`,children:(0,K.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[i.preview===null?null:(0,K.jsxs)(L,{variant:`ghost`,size:`sm`,"aria-label":`${c(`runs.group.artifactOpen`)} ${i.fileName}`,onClick:()=>s(i.id===o?null:i.id),children:[(0,K.jsx)(tc,{}),c(`runs.group.artifactOpen`)]}),(0,K.jsx)(L,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,K.jsxs)(`a`,{href:t.artifactUrl(n,r,i.id),download:i.fileName,"aria-label":`${c(`runs.group.artifactDownload`)} ${i.fileName}`,children:[(0,K.jsx)(Zs,{}),c(`runs.group.artifactDownload`)]})})]})})]})}function Eg(e){let{api:t,runId:n,group:r,count:i,revision:a,onError:o}=e,[s,c]=(0,H.useState)(null);return(0,H.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 Dg({api:e,runId:t,group:n,count:r,revision:i,onError:a}){let{t:o,i18n:s}=B(),c=Be(`(min-width: 768px)`),l=Eg({api:e,runId:t,group:n,count:r,revision:i,onError:a}),[u,d]=(0,H.useState)(null);if(l===null)return(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`runs.group.artifactLoading`)});if(l.length===0)return(0,K.jsx)(at,{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,K.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,K.jsx)(Cg,{api:e,runId:t,group:n,artifact:p,onClose:()=>d(null)}),(0,K.jsx)(xg,{api:e,runId:t,group:n,artifact:p})]}):null;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`table`,{"aria-label":o(`runs.group.artifactsList`),className:`w-full text-left text-sm`,children:[(0,K.jsx)(wg,{}),(0,K.jsx)(`tbody`,{children:l.map(r=>(0,K.jsx)(Tg,{api:e,runId:t,group:n,artifact:r,now:f,opened:u,onOpen:d},r.id))})]}),c?m:p?(0,K.jsx)(Cd,{open:!0,onOpenChange:e=>!e&&d(null),children:(0,K.jsxs)(wd,{className:`max-w-2xl`,children:[(0,K.jsxs)(Td,{children:[(0,K.jsx)(Dd,{children:p.title}),(0,K.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:p.fileName})]}),(0,K.jsx)(`div`,{className:`flex`,children:(0,K.jsx)(Sg,{api:e,runId:t,group:n,artifact:p})}),(0,K.jsx)(xg,{api:e,runId:t,group:n,artifact:p})]})}):null]})}var Og=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),kg=e=>/\.(md|txt|log)$/i.test(e.fileName);function Ag({api:e,runId:t,file:n}){let{t:r}=B(),[i,a]=(0,H.useState)(null);return(0,H.useEffect)(()=>{let r=!1;return fetch(e.attachmentUrl(t,n.id,!0),{credentials:`same-origin`}).then(async e=>{if(!e.ok)throw Error(e.statusText);return e.text()}).then(e=>!r&&a({text:e}),e=>!r&&a({error:e.message})),()=>{r=!0}},[e,t,n.id]),i===null?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`attachments.loading`)}):`error`in i?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:r(`attachments.previewFailed`,{message:i.error})}):(0,K.jsx)(`pre`,{className:`max-h-64 overflow-auto rounded border bg-muted p-2 font-mono text-xs whitespace-pre-wrap`,children:i.text})}function jg({api:e,runId:t,file:n}){let{t:r}=B();if(Og.has(n.mediaType)){let i=e.attachmentUrl(t,n.id,!0);return(0,K.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,title:r(`attachments.open`,{name:n.fileName}),children:(0,K.jsx)(`img`,{src:i,alt:r(`attachments.preview`,{name:n.fileName}),loading:`lazy`,className:`max-h-48 max-w-full rounded border object-contain`})})}return kg(n)&&n.size<=1048576?(0,K.jsx)(Ag,{api:e,runId:t,file:n}):null}function Mg({api:e,runId:t,attachments:n}){let{t:r,i18n:i}=B();return(0,K.jsx)(`ul`,{"aria-label":r(`attachments.listOfRun`),className:`flex flex-col gap-3`,children:n.map(n=>(0,K.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-md border bg-card p-3`,"data-attachment":n.fileName,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,K.jsx)(dl,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`font-medium break-all`,children:n.fileName}),(0,K.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[If(n.size,r,i.language),` · `,n.mediaType]}),(0,K.jsx)(L,{variant:`outline`,size:`sm`,className:`ml-auto`,asChild:!0,children:(0,K.jsxs)(`a`,{href:e.attachmentUrl(t,n.id),download:n.fileName,"aria-label":`${r(`attachments.download`)} ${n.fileName}`,children:[(0,K.jsx)(Zs,{}),r(`attachments.download`)]})})]}),(0,K.jsx)(jg,{api:e,runId:t,file:n})]},n.id))})}function Ng({diff:e}){let{t}=B();return(0,K.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,K.jsx)(`strong`,{className:`font-semibold text-foreground`,children:Sf(e.files,t)}),` `,(0,K.jsxs)(`span`,{className:`text-status-ok`,children:[`+`,e.added]}),` `,(0,K.jsxs)(`span`,{className:`text-status-err`,children:[`−`,e.removed]})]})}var Pg=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function Fg(e){let t=[],n=null,r=0,i=0;for(let a of e){let e=Pg.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 Ig={ctx:``,add:`bg-status-ok/10`,del:`bg-status-err/10`,note:`text-muted-foreground italic`},Lg={ctx:` `,add:`+`,del:`−`,note:``};function Rg({result:e,reserve:t}){let{t:n}=B();if(e.state===`loading`)return(0,K.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,K.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,K.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:n(`runs.files.diffBinary`)});let i=Fg(r.lines);return i.length===0?(0,K.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:n(`runs.files.diffEmpty`)}):(0,K.jsxs)(`div`,{className:`overflow-x-auto border-t bg-background font-mono text-xs`,children:[i.map((e,t)=>(0,K.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,K.jsx)(`caption`,{className:`bg-muted px-3 py-0.5 text-left text-muted-foreground`,children:e.header}),(0,K.jsx)(`tbody`,{children:e.rows.map((e,t)=>(0,K.jsxs)(`tr`,{"data-kind":e.kind,className:S(Ig[e.kind]),children:[(0,K.jsx)(`td`,{className:`w-10 select-none px-2 text-right text-muted-foreground`,children:e.old??``}),(0,K.jsx)(`td`,{className:`w-10 select-none px-2 text-right text-muted-foreground`,children:e.new??``}),(0,K.jsx)(`td`,{className:`w-4 select-none text-center`,children:Lg[e.kind]}),(0,K.jsx)(`td`,{className:`whitespace-pre pr-3`,children:e.text})]},t))})]},t)),r.truncated?(0,K.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 zg(e,t,n){return{name:e,path:t,kind:n,added:0,removed:0,binary:!1,children:new Map}}function Bg(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(Bg).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 Vg(e){let t=zg(``,``,`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=zg(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(Bg).sort((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name,`en`):e.kind===`dir`?-1:1)}function Hg(e){return e.binary?1:Math.min(40,Math.max(3,e.added+e.removed+11))}function Ug({node:e}){let{t}=B();return e.binary?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:t(`runs.files.binary`)}):(0,K.jsxs)(`span`,{className:`font-mono text-xs`,children:[(0,K.jsxs)(`span`,{className:`text-status-ok`,children:[`+`,e.added]}),` `,(0,K.jsxs)(`span`,{className:`text-status-err`,children:[`−`,e.removed]})]})}function Wg({node:e,expansion:t}){let{t:n}=B(),r=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[t?(0,K.jsx)(v,{className:S(`size-4 shrink-0 transition-transform`,t.open.has(e.path)&&`rotate-90`),"aria-hidden":!0}):null,(0,K.jsx)(rc,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,K.jsx)(`code`,{className:`truncate font-mono text-xs`,title:e.path,children:e.name}),t?.previous.has(e.path)?(0,K.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:n(`runs.files.renamedFrom`,{path:t.previous.get(e.path)??``})}):null]}),(0,K.jsx)(Ug,{node:e})]});if(!t)return(0,K.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,K.jsxs)(`li`,{children:[(0,K.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,K.jsx)(`div`,{className:`my-1 ml-2 overflow-hidden rounded border`,children:(0,K.jsx)(Rg,{result:a??{state:`loading`},reserve:Hg(e)})}):null]})}function Gg({node:e,expansion:t}){return e.kind===`file`?(0,K.jsx)(Wg,{node:e,expansion:t}):(0,K.jsx)(`li`,{children:(0,K.jsxs)(Vp,{defaultOpen:!0,children:[(0,K.jsxs)(Hp,{className:`group flex w-full items-center justify-between gap-3 rounded px-2 py-1 text-sm hover:bg-accent`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,K.jsx)(v,{className:S(`size-4 shrink-0 transition-transform group-data-[state=open]:rotate-90`),"aria-hidden":!0}),(0,K.jsx)(lc,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,K.jsx)(`code`,{className:`truncate font-mono text-xs`,children:e.name})]}),(0,K.jsx)(Ug,{node:e})]}),(0,K.jsx)(Up,{children:(0,K.jsx)(`ul`,{className:`ml-4 border-l pl-1`,children:e.children.map(e=>(0,K.jsx)(Gg,{node:e,expansion:t},e.path))})})]})})}function Kg({files:e,diff:t}){let{t:n}=B(),r=Vg(e),[i,a]=(0,H.useState)(new Set),[o,s]=(0,H.useState)({}),c=(0,H.useRef)(new Set),l=(0,H.useRef)(!0),u=(0,H.useRef)(void 0);(0,H.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,H.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,K.jsx)(`ul`,{"aria-label":n(`runs.files.label`),className:`rounded-lg border bg-card p-1`,children:r.map(e=>(0,K.jsx)(Gg,{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,K.jsx)(`ul`,{"aria-label":n(`runs.files.label`),className:`rounded-lg border bg-card p-1`,children:r.map(e=>(0,K.jsx)(Gg,{node:e,expansion:g},e.path))})}var qg=Fi,Jg=zi;function Yg({className:e,children:t,...n}){return(0,K.jsxs)(Li,{className:S(`flex h-9.5 w-full min-w-0 items-center justify-between gap-2 rounded-md border border-input bg-card px-2.5 text-sm disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive data-[placeholder]:text-muted-foreground`,e),...n,children:[t,(0,K.jsx)(Bi,{asChild:!0,children:(0,K.jsx)(Ts,{className:`size-4 shrink-0 opacity-60`})})]})}function Xg({className:e,children:t,...n}){return(0,K.jsx)(Ui,{children:(0,K.jsx)(Gi,{position:`popper`,sideOffset:4,className:S(`z-50 max-h-72 min-w-[var(--radix-select-trigger-width)] overflow-hidden rounded-md border bg-card text-card-foreground shadow-md`,e),...n,children:(0,K.jsx)(ra,{className:`p-1`,children:t})})})}function Zg({className:e,children:t,...n}){return(0,K.jsxs)(la,{className:S(`relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-7 text-sm outline-none select-none data-[disabled]:opacity-50 data-[highlighted]:bg-accent`,e),...n,children:[(0,K.jsx)(`span`,{className:`absolute left-2 flex size-4 items-center justify-center`,children:(0,K.jsx)(pa,{children:(0,K.jsx)(Cs,{className:`size-4`})})}),(0,K.jsx)(da,{children:t})]})}var Qg=[`blocked_by`,`parent`,`related`,`duplicates`],$g=[`blocked_by`,`parent`,`duplicates`];function e_(e){let t=e.number===null?e.title:`${vf(e.number)} ${e.title}`;return e.project?`${e.project} · ${t}`:t}function t_({groups:e,value:t,pick:n}){let{t:r}=B();return e.map(e=>(0,K.jsx)(X,{heading:r(`links.sections.${e.section}`),children:e.options.map(e=>(0,K.jsxs)(Z,{value:e.id,title:e_(e),onSelect:()=>n(e.id),children:[(0,K.jsx)(Cs,{className:e.id===t?`shrink-0 opacity-100`:`shrink-0 opacity-0`}),(0,K.jsx)(`span`,{className:`line-clamp-3 min-w-0 [overflow-wrap:anywhere]`,children:e_(e)})]},e.id))},e.section))}function n_({value:e,groups:t,onChange:n,disabled:r}){let{t:i}=B(),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(``),l=i(`links.target`),u=t.flatMap(e=>e.options).find(t=>t.id===e),d=u?e_(u):e,f=s.trim().toLocaleLowerCase(),p=t.map(e=>({...e,options:e.options.filter(e=>e_(e).toLocaleLowerCase().includes(f))})).filter(e=>e.options.length>0);return(0,K.jsxs)(Pd,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,K.jsx)(Fd,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,role:`combobox`,"aria-label":l,"aria-expanded":a,"aria-haspopup":`dialog`,disabled:r,title:d||void 0,className:`flex h-9.5 w-full min-w-0 items-center justify-between gap-2 rounded-md border border-input bg-card px-2.5 text-left text-sm disabled:opacity-50`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:d||l}),(0,K.jsx)(ks,{className:`size-4 shrink-0 opacity-50`})]})}),(0,K.jsx)(Id,{className:`min-w-[min(20rem,90vw)] max-w-[min(32rem,90vw)] p-0`,children:(0,K.jsxs)(kd,{shouldFilter:!1,label:i(`picker.search`,{label:l}),children:[(0,K.jsx)(jd,{"aria-label":i(`picker.search`,{label:l}),value:s,onValueChange:c,placeholder:i(`picker.searchOnly`)}),(0,K.jsxs)(Md,{children:[(0,K.jsx)(Nd,{children:i(`picker.nothing`)}),(0,K.jsx)(t_,{groups:p,value:e,pick:e=>{n(e),o(!1),c(``)}})]})]})})]})}function r_({row:e,index:t,locked:n,hasParent:r,choices:i,editableKinds:a,update:o,remove:s}){let{t:c}=B();return(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,K.jsxs)(qg,{value:e.kind,disabled:n,onValueChange:n=>{let r=n;o(t,{kind:r,target:i(r).some(t=>t.options.some(t=>t.id===e.target))?e.target:``})},children:[(0,K.jsx)(Yg,{"aria-label":c(`links.kindLabel`),className:`w-44 max-w-[40%] shrink-0`,children:(0,K.jsx)(Jg,{})}),(0,K.jsx)(Xg,{children:Qg.filter(t=>a.includes(t)||t===e.kind).map(t=>(0,K.jsx)(Zg,{value:t,disabled:t===`parent`&&e.kind!==`parent`&&r,children:c(`links.kind.${t}`)},t))})]}),(0,K.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,K.jsx)(n_,{value:e.target,groups:i(e.kind),disabled:n,onChange:n=>o(t,{...e,target:n})})}),(0,K.jsx)(`button`,{type:`button`,"aria-label":c(`links.remove`),title:c(`links.remove`),disabled:n,className:`flex size-9.5 shrink-0 items-center justify-center rounded-md hover:bg-accent disabled:opacity-50`,onClick:()=>s(t),children:(0,K.jsx)(Zl,{className:`size-4`})})]})}function i_({value:e,onChange:t,choices:n,editableKinds:r=Qg,disabled:i=!1,addButton:a=!0}){let{t:o}=B(),s=e.some(e=>e.kind===`parent`),c=r.filter(e=>e!==`parent`||!s),l=(n,r)=>t(e.map((e,t)=>t===n?r:e));return(0,K.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-3 border-0 p-0`,disabled:i,children:[(0,K.jsx)(`legend`,{className:`mb-1 text-sm font-medium`,children:o(`links.title`)}),e.map((a,o)=>(0,K.jsx)(r_,{row:a,index:o,choices:n,editableKinds:r,update:l,hasParent:s,locked:i||!r.includes(a.kind),remove:n=>t(e.filter((e,t)=>t!==n))},o)),a?(0,K.jsxs)(L,{variant:`outline`,disabled:i||c.length===0,className:`mt-1 self-start`,onClick:()=>{let n=c[0];n&&t([...e,{kind:n,target:``}])},children:[(0,K.jsx)(_l,{"aria-hidden":!0}),o(`links.add`)]}):null]})}var a_=[`parent`,`related`,`duplicates`],o_=e=>e.links.map(e=>({kind:e.kind,target:e.id})),s_=(e,t)=>e.kind===t.kind&&e.target===t.target;function c_({run:e,api:t,choices:n}){let{t:r}=B(),i=o_(e),a=JSON.stringify(i),[o,s]=(0,H.useState)({from:a,rows:i}),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(!1),f=o.from===a?o.rows:i,p=f.length!==i.length||f.some((e,t)=>!s_(e,i[t])),m=f.every(e=>e.target!==``),h=async()=>{if(!u&&p&&m){d(!0),l(null);try{for(let n of i)f.some(e=>s_(e,n))||await t.taskUnlink(e.id,n.kind,n.target);for(let n of f)i.some(e=>s_(n,e))||await t.taskLink(e.id,n.kind,n.target)}catch(e){s({from:a,rows:f}),l(e.message)}finally{d(!1)}}};return(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,"data-links-edit":``,children:[(0,K.jsx)(i_,{value:f,onChange:e=>s({from:a,rows:e}),choices:n,editableKinds:a_,disabled:u}),c?(0,K.jsx)(N,{variant:`destructive`,children:c}):null,(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(L,{disabled:u||!p||!m,onClick:()=>void h(),children:r(`links.save`)}),(0,K.jsx)(L,{variant:`ghost`,disabled:u||!p,onClick:()=>s({from:a,rows:i}),children:r(`links.reset`)})]})]})}function l_(e){return typeof e==`object`&&!!e}function u_(e){return l_(e)&&Object.keys(e).length>0}function d_(e){let t=e.trim();if(t.startsWith(`{`)||t.startsWith(`[`))try{let e=JSON.parse(t);return l_(e)?e:void 0}catch{return}}function f_(e){return typeof e==`string`?e:Array.isArray(e)?`[]`:l_(e)?`{}`:JSON.stringify(e)??String(e)}function p_(e){return e.map(e=>` ${e}`)}function m_(e){if(Array.isArray(e))return e.length===0?[`[]`]:e.flatMap(e=>{if(u_(e)){let[t=``,...n]=m_(e);return[`- ${t}`,...p_(n)]}let t=f_(e);return t.includes(`
|
|
9
|
+
`)?[`-`,...p_(t.split(`
|
|
10
|
+
`))]:[`- ${t}`]});if(l_(e)){let t=Object.entries(e);return t.length===0?[`{}`]:t.flatMap(([e,t])=>{if(u_(t))return[`${e}:`,...p_(m_(t))];let n=f_(t);return n.includes(`
|
|
11
|
+
`)?[`${e}:`,...p_(n.split(`
|
|
12
|
+
`))]:[`${e}: ${n}`]})}return f_(e).split(`
|
|
13
|
+
`)}function h_(e){return m_(e).join(`
|
|
14
|
+
`)}function g_(e){return Array.isArray(e)?e.length===0?`[]`:`[${e.length}]`:l_(e)?Object.keys(e).length===0?`{}`:`{…}`:f_(e).replace(/\s*\n\s*/g,` `)}function __(e,t=120){let n=(Array.isArray(e)?e.map(g_):l_(e)?Object.entries(e).map(([e,t])=>`${e}: ${g_(t)}`):[g_(e)]).join(` · `);return n.length>t?`${n.slice(0,t-1)}…`:n}function v_(e,t){let n=d_(t);if(n===void 0)return!1;let r=JSON.stringify(n);return e===r||r.length>120&&e===`${r.slice(0,119)}…`}function y_(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 b_({at:e}){let{i18n:t}=B();return e==null?null:(0,K.jsx)(`time`,{dateTime:new Date(e).toISOString(),title:Rf(e,t.language),className:`shrink-0 text-xs text-muted-foreground tabular-nums`,children:Lf(e)})}function x_(e){let t=e.split(`
|
|
15
|
+
`).find(e=>e.trim()!==``)??``;return t.length>140?`${t.slice(0,139)}…`:t}function S_({failed:e=!1,head:t,at:n,children:r}){return(0,K.jsxs)(Vp,{className:S(`rounded-md border text-sm`,e&&`border-status-err/30 bg-status-err-bg`),children:[(0,K.jsxs)(Hp,{className:`group flex w-full items-center gap-2 px-2 py-1 text-left`,children:[(0,K.jsx)(v,{className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),t,(0,K.jsx)(`span`,{className:`ml-auto`}),(0,K.jsx)(b_,{at:n})]}),(0,K.jsx)(Up,{children:(0,K.jsx)(`pre`,{className:`max-h-96 overflow-auto px-3 pb-2 font-mono text-xs whitespace-pre-wrap`,children:r})})]})}function C_({result:e,showJson:t}){let{t:n}=B(),r=t?void 0:d_(e.text),i=r===void 0?e.text:h_(r);return e.error?(0,K.jsx)(S_,{failed:!0,head:(0,K.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,K.jsx)(`span`,{className:`font-medium text-status-err`,children:n(`runs.transcript.error`)}),` `,x_(i)]}),at:e.at,children:i}):(0,K.jsx)(S_,{head:(0,K.jsxs)(`span`,{className:`truncate`,children:[n(`runs.transcript.result`),` · `,x_(i)||n(`runs.transcript.emptyResult`)]}),at:e.at,children:i})}function w_({call:e,results:t,showJson:n}){let r=n?void 0:d_(e.input),i=r!==void 0&&v_(e.summary,e.input)?__(r):e.summary;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(S_,{head:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,K.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:h_(r)}),t.map((e,t)=>(0,K.jsx)(`div`,{className:`ml-4`,children:(0,K.jsx)(C_,{result:e,showJson:n})},t))]})}function T_({entry:e,showJson:t}){let{t:n}=B();switch(e.kind){case`text`:return(0,K.jsxs)(`section`,{"aria-label":n(`runs.transcript.textLabel`),className:`rounded-lg border bg-card p-3`,children:[(0,K.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2 text-xs font-medium text-muted-foreground uppercase`,children:[(0,K.jsx)(`span`,{children:n(`runs.transcript.specialist`)}),(0,K.jsx)(b_,{at:e.at})]}),(0,K.jsx)(cg,{text:e.text})]});case`tool_call`:return(0,K.jsx)(w_,{call:e,results:[],showJson:t});case`tool_result`:return(0,K.jsx)(C_,{result:e,showJson:t});case`result`:return(0,K.jsxs)(`div`,{className:S(`flex items-center gap-2 text-xs text-muted-foreground`,e.error&&`text-status-err`),children:[e.verdict?(0,K.jsx)($,{status:e.verdict===`done`?`done`:`needs_human`}):null,(0,K.jsx)(`span`,{children:n(`runs.transcript.usage`,{input:bf(e.inputTokens),output:bf(e.outputTokens)})}),(0,K.jsx)(b_,{at:e.at})]});case`raw`:return!t&&d_(e.text)!==void 0?null:(0,K.jsx)(`pre`,{className:`font-mono text-xs whitespace-pre-wrap`,children:e.text})}}function E_({entries:e,onlyText:t=!1,showJson:n=!0}){let{t:r}=B();if(e.length===0)return(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`runs.transcript.empty`)});let i=y_(e),a=t?i.filter(e=>e.kind===`entry`&&e.entry.kind===`text`):i;return a.length===0?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`runs.transcript.noReplies`)}):(0,K.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map((e,t)=>e.kind===`call`?(0,K.jsx)(w_,{call:e.call,results:e.results,showJson:n},t):(0,K.jsx)(T_,{entry:e.entry,showJson:n},t))})}function D_(e){let{t}=B();return(0,K.jsxs)(K.Fragment,{children:[e.attempt.interrupting?(0,K.jsx)(`span`,{className:`text-xs text-status-warn`,children:t(`runs.attempt.interrupting`)}):null,e.onMessage?(0,K.jsxs)(L,{variant:`outline`,size:`sm`,onClick:e.onMessage,children:[(0,K.jsx)(Yc,{}),t(`runs.message.button`)]}):null,e.onRetry?(0,K.jsxs)(L,{variant:`outline`,size:`sm`,onClick:e.onRetry,children:[(0,K.jsx)(o,{}),t(`runs.attempt.retryStep`)]}):null]})}function O_({attempt:e,verdict:t}){let{t:n}=B(),r=e.denials??[],i=e.outsideChanges??[];return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(v,{className:`size-4 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),(0,K.jsxs)(`span`,{className:`font-medium`,children:[`#`,e.seq,` `,e.stepName??e.stepId,e.round>1?` · ${n(`runs.attempt.round`,{round:e.round})}`:``]}),(0,K.jsx)(`span`,{className:`truncate text-muted-foreground`,title:`${e.specialist} · ${e.runtime} ${e.model??``}`.trim(),children:e.model??e.runtime}),(0,K.jsx)($,{status:t}),(0,K.jsxs)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:[yf(e.durationMs),` · `,bf(e.usage?.inputTokens),`/`,bf(e.usage?.outputTokens)]}),r.length>0?(0,K.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,K.jsx)(`span`,{className:`text-xs text-status-warn`,title:n(`runs.attempt.outsideTitle`),children:n(`runs.attempt.outside`,{n:i.length})}):null]})}function k_({denials:e}){let{t}=B();return e.length===0?null:(0,K.jsx)(`section`,{"aria-label":t(`runs.attempt.denialsLabel`),children:(0,K.jsxs)(N,{variant:`warn`,children:[(0,K.jsx)(`div`,{className:`mb-1 text-xs font-medium uppercase`,children:t(`runs.attempt.denialsHeading`)}),(0,K.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,n)=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`code`,{className:`font-mono text-xs`,children:e.command===null?e.tool:`${e.tool} ${e.command}`}),e.suggestions.map((e,n)=>(0,K.jsx)(`div`,{className:`text-xs`,children:e.pattern===null?(0,K.jsx)(`span`,{children:t(`runs.attempt.noPattern`)}):(0,K.jsxs)(K.Fragment,{children:[t(`runs.attempt.pattern`),` `,(0,K.jsx)(`code`,{children:e.pattern})]})},n))]},n))})]})})}function A_({attempt:e,rawLog:t,transcript:n,onlyReplies:r,showJson:i,raw:a,onRaw:o}){let{t:s,i18n:c}=B(),l=e.denials??[];return(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 border-t p-3`,children:[e.reason?(0,K.jsx)(N,{variant:`destructive`,children:e.reason}):null,(0,K.jsx)(k_,{denials:l}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,K.jsx)(`time`,{dateTime:new Date(e.startedAt).toISOString(),title:Rf(e.startedAt,c.language),className:`tabular-nums`,children:s(`runs.attempt.started`,{time:Lf(e.startedAt)})})}),(0,K.jsx)(j_,{attempt:e}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`h4`,{className:`text-sm font-semibold`,children:s(`runs.attempt.log`)}),t?(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(zh,{id:`raw-${e.seq}`,checked:a,onCheckedChange:o}),(0,K.jsx)(Q,{htmlFor:`raw-${e.seq}`,className:`text-xs`,children:s(`runs.attempt.raw`)})]}):null]}),a&&t?(0,K.jsx)(`pre`,{className:`max-h-[60vh] overflow-auto rounded-md bg-muted p-2 font-mono text-xs`,children:t.join(`
|
|
16
|
+
`)}):n?(0,K.jsx)(E_,{entries:n.entries,onlyText:r,showJson:i}):(0,K.jsx)(pe,{role:`status`,"aria-label":s(`runs.attempt.loadingLog`),className:`h-16`}),(0,K.jsx)(M_,{attempt:e})]})}function j_({attempt:e}){let{t}=B();return(0,K.jsx)(K.Fragment,{children:e.message?(0,K.jsxs)(`section`,{"aria-label":t(`runs.attempt.humanMessage`),className:`rounded-lg border border-status-warn/30 bg-status-warn-bg p-3`,children:[(0,K.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2 text-xs font-medium text-status-warn uppercase`,children:[(0,K.jsx)(`span`,{children:t(`runs.attempt.humanMessage`)}),(0,K.jsx)(b_,{at:e.message.at})]}),(0,K.jsx)(cg,{text:e.message.text})]}):null})}function M_({attempt:e}){let{t}=B();return(0,K.jsxs)(K.Fragment,{children:[e.summary?(0,K.jsxs)(`section`,{"aria-label":t(`runs.attempt.summaryLabel`),className:`rounded-lg border p-3`,children:[(0,K.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground uppercase`,children:t(`runs.attempt.summary`)}),(0,K.jsx)(cg,{text:e.summary})]}):null,e.feedback||e.decision?(0,K.jsxs)(`section`,{"aria-label":t(`runs.attempt.feedbackLabel`),className:`rounded-lg border border-status-warn/30 bg-status-warn-bg p-3`,children:[(0,K.jsx)(`div`,{className:`mb-1 text-xs font-medium text-status-warn uppercase`,children:t(`runs.attempt.feedback`)}),e.feedback?(0,K.jsx)(cg,{text:e.feedback}):null,e.decision?(0,K.jsxs)(`p`,{className:`mt-2 text-sm`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:t(`runs.attempt.answer`,{by:t(`runs.decisions.${s(e.decision.by)}`)})}),` `,e.decision.answer]}):null]}):null]})}var N_=1500;function P_(e,t,n,r,i){let[a,o]=(0,H.useState)(null),s=(0,H.useRef)(null);return(0,H.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(),N_))}catch{a||(c=setTimeout(()=>void l(),N_*2))}};return(!s.current||s.current.running)&&l(),()=>{a=!0,c&&clearTimeout(c)}},[e,t,n,r,i]),a}var F_={run:`bg-status-run`,warn:`bg-status-warn`,err:`bg-status-err`,ok:`bg-status-ok`,mute:`bg-status-mute`};function I_({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}=B(),[d,f]=(0,H.useState)(i),[p,m]=(0,H.useState)(!1),h=P_(e,t,n,r.seq,d),g=r.verdict??r.status;return(0,K.jsxs)(`li`,{className:`relative pl-6`,children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:S(`absolute top-3.5 left-0 size-3 -translate-x-1/2 rounded-full ring-4 ring-background`,F_[Hf(g)])}),(0,K.jsxs)(Vp,{open:d,onOpenChange:f,className:`rounded-lg border bg-card`,children:[(0,K.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,K.jsx)(Hp,{"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,K.jsx)(O_,{attempt:r,verdict:g})}),(0,K.jsx)(D_,{attempt:r,onMessage:l,onRetry:c})]}),(0,K.jsx)(Up,{children:d?(0,K.jsx)(A_,{attempt:r,rawLog:a,transcript:h,onlyReplies:o,showJson:s,raw:p,onRaw:m}):null})]})]})}function L_({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}=B();return r.length===0?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f(`runs.attempt.none`)}):(0,K.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,K.jsx)(I_,{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 R_({ctx:e}){let{t}=B(),{row:n,view:r,caps:i}=e,{spec:a,progress:o}=e.tabs,s=e.run?.attachments??[];return(0,K.jsxs)(Gp,{"aria-label":t(`runs.group.tabs`),children:[(0,K.jsx)(Kp,{value:`log`,children:t(`runs.group.log`)}),i.changes?(0,K.jsxs)(Kp,{value:`changes`,children:[t(`runs.group.changes`),r?.diff?` · ${r.diff.files.length}`:``]}):null,(0,K.jsx)(Kp,{value:`task`,children:t(`runs.group.task`)}),a?.design==null?null:(0,K.jsx)(Kp,{value:`design`,children:t(`runs.group.design`)}),a?.tasks==null?null:(0,K.jsxs)(Kp,{value:`tasks`,children:[t(`runs.group.tasks`),o?` · ${o.done}/${o.total}`:``]}),(0,K.jsxs)(Kp,{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}`:``]}),s.length>0?(0,K.jsxs)(Kp,{value:`attachments`,children:[t(`attachments.tab`),` · `,s.length]}):null,e.run&&e.linkChoices?(0,K.jsxs)(Kp,{value:`links`,children:[t(`links.title`),e.run.links.length+e.run.linkedBy.length>0?` · ${e.run.links.length+e.run.linkedBy.length}`:``]}):null]})}function z_({ctx:e}){let{t}=B(),{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,K.jsx)(qp,{value:`log`,className:`flex flex-col gap-3`,children:(0,K.jsx)(L_,{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),()=>V(t(`runs.header.retryStarted`)))})})}function B_({ctx:e}){let{t}=B(),{api:n,runId:r,row:i,view:a}=e;return a?(0,K.jsx)(qp,{value:`changes`,children:a.diff&&a.diff.files.length>0?(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:(0,K.jsx)(Ng,{diff:{files:a.diff.files.length,added:a.diff.added,removed:a.diff.removed}})}),(0,K.jsx)(Kg,{files:a.diff.files,diff:{api:n,runId:r,group:i.slug,revision:a.diff.revision}})]}):(0,K.jsx)(at,{title:t(`runs.group.noChanges`),children:t(`runs.group.noChangesText`)})}):null}function V_({value:e,label:t,change:n,text:r}){let{t:i}=B();return(0,K.jsx)(qp,{value:e,children:(0,K.jsxs)(`section`,{"aria-label":t,className:`rounded-md border bg-card p-4 text-card-foreground`,children:[n===void 0?null:(0,K.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:i(`runs.group.specChange`,{name:n})}),(0,K.jsx)(cg,{text:r})]})})}function H_({ctx:e}){let{t}=B(),{api:n,runId:r,row:i,view:a,caps:o}=e,{spec:s}=e.tabs;return a===null?(0,K.jsxs)(`div`,{role:`status`,"aria-label":t(`runs.group.loading`),className:`flex flex-col gap-2`,children:[(0,K.jsx)(pe,{className:`h-8 w-64`}),(0,K.jsx)(pe,{className:`h-24`})]}):(0,K.jsxs)(Wp,{value:e.tabs.tab,onValueChange:e.tabs.setTab,children:[(0,K.jsx)(R_,{ctx:e}),(0,K.jsx)(z_,{ctx:e}),o.changes?(0,K.jsx)(B_,{ctx:e}):null,(0,K.jsx)(V_,{value:`task`,label:t(`runs.group.task`),text:a.task}),s?.design==null?null:(0,K.jsx)(V_,{value:`design`,label:t(`runs.group.design`),change:s.change,text:s.design}),s?.tasks==null?null:(0,K.jsx)(V_,{value:`tasks`,label:t(`runs.group.tasks`),change:s.change,text:s.tasks}),i.artifacts>0?(0,K.jsx)(qp,{value:`artifacts`,children:(0,K.jsx)(Dg,{api:n,runId:r,group:i.slug,count:i.artifacts,revision:i.artifactsRevision,onError:e.onError})}):null,(e.run?.attachments.length??0)>0?(0,K.jsx)(qp,{value:`attachments`,children:(0,K.jsx)(Mg,{api:n,runId:r,attachments:e.run?.attachments??[]})}):null,e.run&&e.linkChoices?(0,K.jsx)(qp,{value:`links`,children:(0,K.jsx)(c_,{run:e.run,api:n,choices:e.linkChoices})}):null]})}function U_(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 W_(e,t,n=null){let r=(0,H.useRef)(t);r.current=t,(0,H.useEffect)(()=>{if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e[e.length-1]?.isIntersecting&&r.current()},{root:U_(e),rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},[e,n])}function G_(e){return e?U_(e)??document.scrollingElement??document.documentElement:null}function K_(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}function q_(e){let[t,n]=(0,H.useState)(!1),r=(0,H.useRef)(e);r.current=e;let i=(0,H.useCallback)(()=>{let e=G_(r.current);e?.scrollTo({top:e.scrollHeight,behavior:K_()})},[]),a=(0,H.useCallback)(()=>{n(!0),i()},[i]),o=(0,H.useCallback)(()=>n(!1),[]);return(0,H.useEffect)(()=>{if(!t||!e)return;let r=G_(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 J_(e,t,n){let r=`kind`in e,i=r&&e.kind!==`split`&&e.kind!==`action`&&!c(e),a=r&&c(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 Y_(e,t){return e.topology.steps.find(e=>e.groups.some(e=>e.slug===t))?.id??null}function X_(e,t){return e.topology.steps.find(e=>e.id===t)?.groups.some(e=>e.status===`running`||e.status===`needs_human`)??!1}function Z_(e,t,n){let{t:r}=B(),i=Ke(),[a,o]=(0,H.useState)(null);return{pending:a,toggle:async(a,s,c={})=>{if(!e)return;let l=X_(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),V(r(s?`runs.steps.doneSkip`:`runs.steps.doneUnskip`))}catch(e){n(e.message)}finally{o(null)}}}}function Q_(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 $_=5e3,ev=(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 tv(e,t,n,r,i,a,o=!0){let[s,c]=(0,H.useState)(void 0);return(0,H.useEffect)(()=>{if(!o)return;let r=!1,s=i=>e.groupSpec(t,n).then(e=>{r||c(t=>t!==void 0&&ev(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),$_):null;return()=>{r=!0,l!==null&&clearInterval(l)}},[e,t,n,r,i,o,a]),s}function nv(e,t,n,r,i){let[a,o]=(0,H.useState)(null);return(0,H.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 rv(e){let[t,n]=(0,H.useState)(!1);return{busy:t,act:async(t,r)=>{n(!0);try{await t(),r?.()}catch(t){e(t.message)}finally{n(!1)}}}}function iv(e){let[t,n]=(0,H.useState)(e);return(0,H.useEffect)(()=>{if(e){n(!0);return}let t=setTimeout(()=>n(!1),250);return()=>clearTimeout(t)},[e]),t}function av(e){let{api:t,runId:n,row:r,version:i,view:a,caps:o,hasAttachments:s,hasLinks:c}=e,{addressTab:l,onAddressTab:u,onError:d}=e,[f,p]=(0,H.useState)(null),m=u?l:f,h=u??p,g=![`merged`,`done`,`failed`,`cancelled`].includes(r.status),_=`kind`in r,v=tv(t,n,r.slug,i,g&&(m===`design`||m===`tasks`),d,!_),y=new Set([`log`,`task`]);o.changes&&y.add(`changes`),v?.design!=null&&y.add(`design`),v?.tasks!=null&&y.add(`tasks`),r.artifacts>0&&y.add(`artifacts`),s&&y.add(`attachments`),c&&y.add(`links`);let b=a!==null&&(_||v!==void 0),x=y.has(m??`log`)?m??`log`:`log`;return(0,H.useEffect)(()=>{b&&m!==null&&!y.has(m)&&h(`log`)}),{tab:x,setTab:e=>h(e),spec:v,progress:v?.tasks==null?null:Q_(v.tasks)}}function ov(e,t,n,r){let i=Z_(e,t,r),a=e&&!(`kind`in n)?Y_(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 sv(e){let{api:t,runId:n,row:r,run:i,title:a,act:o}=e,{t:s}=B(),c=Ke();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),()=>V(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]),()=>V(s(`runs.header.markedDelivered`)))}}}function cv(e,t=null){let{api:n,runId:r,row:i,run:a,onError:o}=e,{showUsage:s=!1,deliverable:c=!1}=e,{t:l}=B(),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=J_(i,c,d),p=nv(n,r,i.slug,u,o),{busy:m,act:h}=rv(o),g=av({api:n,runId:r,row:i,version:u,view:p,caps:f,hasAttachments:(a?.attachments.length??0)>0,hasLinks:!!a&&!!e.linkChoices,addressTab:e.tab??null,onAddressTab:e.onTab,onError:o}),_=`kind`in i&&i.kind!==`action`?l(`runs.system.${i.kind}`):i.title,v=sv({api:n,runId:r,row:i,run:a,title:_,act:h}),y=q_(t),b=y.stop;(0,H.useEffect)(()=>{g.tab!==`log`&&b()},[g.tab,b]);let[x,S]=(0,H.useState)(!1),[C,w]=(0,H.useState)(null);return{...e,showUsage:s,deliverable:c,onlyReplies:e.onlyReplies??!1,view:p,busy:m,act:h,caps:f,delivering:d,title:_,tabs:g,watch:y,...v,skip:ov(a,n,i,o),statusesMounted:iv(s),forcing:x,setForcing:S,messaging:C,setMessaging:w}}function lv(e){let{t}=B(),[n,r]=(0,H.useState)(null),i=cv(e,n),[a,o]=(0,H.useState)(null),s=jh(a);return(0,K.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,K.jsx)(ag,{ctx:i,onHeight:o}),(0,K.jsx)(Ph,{ctx:i}),(0,K.jsx)(Rh,{ctx:i}),(0,K.jsx)(vg,{ctx:i}),(0,K.jsx)(H_,{ctx:i})]})}var uv=`__create`;function dv({tags:e,hideLinked:t,disabled:n,onRemove:r}){let{t:i}=B();return e.map(e=>(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,K.jsx)(u,{tag:e}),t&&e.task?null:(0,K.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,K.jsx)(Zl,{className:`size-3`})})]},e.id))}function fv({listId:e,visible:t,hasTags:n,selected:r,createName:i,onToggle:a,onCreate:o}){let{t:s}=B();return(0,K.jsxs)(Md,{id:e,children:[t.length===0&&i===null?(0,K.jsx)(Nd,{children:s(n?`picker.nothing`:`tags.none`)}):null,t.length>0?(0,K.jsx)(X,{children:t.map(e=>(0,K.jsxs)(Z,{value:`tag:${e.id}`,onSelect:()=>a(e.id),children:[(0,K.jsx)(Cs,{className:r.includes(e.id)?`opacity-100`:`opacity-0`}),(0,K.jsx)(u,{tag:e})]},e.id))}):null,i===null?null:(0,K.jsx)(X,{children:(0,K.jsxs)(Z,{value:`${uv}:${i}`,onSelect:o,children:[(0,K.jsx)(_l,{}),s(`tags.create`,{name:i})]})})]})}function pv(e,t,n){let r=n.toLowerCase();return t!==null&&n!==``&&!e.some(e=>e.name.toLowerCase()===r)}function mv({api:e,repository:t,name:n,selected:r,onChange:i,onDone:a}){let o=g(),[s,c]=(0,H.useState)(!1),[l,u]=(0,H.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 hv({id:e,label:t,open:n,listId:r,disabled:i}){let{t:a}=B();return(0,K.jsx)(Fd,{asChild:!0,children:(0,K.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,K.jsx)(_l,{className:`size-3`}),a(`picker.add`)]})})}function gv(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}=B(),f=g(),p=f.of(a),m=(0,H.useId)(),[h,_]=(0,H.useState)(!1),[v,y]=(0,H.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&&pv(p,a,b),{error:T,setError:E,create:ee}=mv({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,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsxs)(Pd,{open:h,onOpenChange:e=>{_(e),e||y(``)},children:[(0,K.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,K.jsx)(dv,{tags:te,hideLinked:u,disabled:c,onRemove:D}):null,(0,K.jsx)(hv,{id:t,label:n,open:h,listId:m,disabled:c})]}),(0,K.jsx)(Id,{className:`p-0`,children:(0,K.jsxs)(kd,{shouldFilter:!1,label:d(`picker.search`,{label:n}),children:[(0,K.jsx)(jd,{value:v,onValueChange:y,placeholder:d(s?`tags.searchOrCreate`:`picker.searchOnly`)}),(0,K.jsx)(fv,{listId:m,visible:C,hasTags:S.length>0,selected:r,createName:w?b:null,onToggle:D,onCreate:()=>void ee()})]})})]}),T?(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:T}):null]})}var _v=60;function vv(e,t){let[n,r]=(0,H.useState)(null),[i,a]=(0,H.useState)(null),o=(0,H.useRef)(!1),s=(0,H.useRef)(!1),c=(0,H.useRef)(``),l=(0,H.useRef)(null),u=(0,H.useRef)(null),d=(0,H.useRef)(!1),f=wf(e);(0,H.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 yv({run:e,api:t}){let{t:n}=B(),{draft:r,setDraft:i,error:a,text:o,heading:s,current:c,open:l,close:u,save:d}=vv(e,t);return r===null?(0,K.jsxs)(`h1`,{ref:s,className:`group flex min-w-0 flex-1 items-start gap-1 text-lg font-semibold break-words [overflow-wrap:anywhere]`,children:[(0,K.jsxs)(`span`,{className:`min-w-0`,children:[(0,K.jsx)(`span`,{className:`font-mono text-base font-normal text-muted-foreground`,children:vf(e.number)}),` `,(0,K.jsx)(`span`,{title:`${c}\n${e.id}`,children:c})]}),(0,K.jsx)(L,{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:l,children:(0,K.jsx)(pl,{})})]}):(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`font-mono text-base text-muted-foreground`,children:vf(e.number)}),(0,K.jsx)(Du,{autoFocus:!0,value:r,maxLength:_v,"aria-label":n(`runs.header.titleLabel`),"aria-invalid":a!==null,onFocus:e=>e.currentTarget.select(),onChange:e=>{o.current=e.target.value,i(e.target.value)},onBlur:()=>void d(!0),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),d()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),u(!0))}})]}),a?(0,K.jsx)(N,{variant:`destructive`,children:a}):null]})}function bv({className:e,...t}){return(0,K.jsx)(pn,{className:S(`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,K.jsx)(hn,{className:`flex items-center justify-center`,children:(0,K.jsx)(Cs,{className:`size-3`})})})}function xv({run:e,api:t,onError:n}){let{t:r}=B(),{pending:i,toggle:a}=Z_(e,t,n),[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(!1),u=async(e,t)=>{l(!0);try{await a(e,t)}finally{l(!1)}};if(e.finished||!e.steps||e.steps.length===0)return null;let d=e.steps.filter(e=>!e.skipped),f=d.length===1?d[0]:void 0;return(0,K.jsxs)(Pd,{open:o,onOpenChange:e=>s(e||c||i!==null),children:[(0,K.jsx)(Fd,{asChild:!0,children:(0,K.jsxs)(L,{variant:`outline`,children:[r(`runs.steps.button`,{active:d.length,total:e.steps.length}),(0,K.jsx)(Ts,{})]})}),(0,K.jsx)(Id,{className:`w-auto p-2`,children:(0,K.jsx)(`ul`,{"aria-label":r(`runs.steps.title`),className:`flex flex-col gap-1 text-sm`,children:e.steps.map(e=>(0,K.jsxs)(`li`,{className:`flex list-none items-center gap-2 px-1 py-0.5`,children:[(0,K.jsx)(bv,{id:`run-step-${e.id}`,checked:!e.skipped,disabled:i!==null||e.state===`done`||f?.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 u(e.id,t!==!0)}),(0,K.jsx)(`span`,{className:e.skipped?`line-through`:void 0,children:e.name}),e.name.endsWith(` (${e.id})`)?null:(0,K.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:e.id}),(0,K.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 Sv(e,t,n){let[r,i]=(0,H.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 Cv({run:e,now:t,entry:n=null,onSelect:r,api:i,onError:a}){let{t:o}=B(),{downloading:s,download:c}=Sv(e,i,a),l=xf(e.usage),u=[{key:`status`,label:o(`runs.header.summary.status`),value:(0,K.jsx)(Zh,{run:e,entry:n,onSelect:r,layout:`rows`})},{key:`changes`,label:o(`runs.header.summary.changes`),value:(0,K.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-3 gap-y-1`,children:[e.diff?(0,K.jsx)(Ng,{diff:e.diff}):(0,K.jsx)(`span`,{children:`—`}),(0,K.jsxs)(L,{variant:`outline`,size:`sm`,loading:s,disabled:e.delivery.merged===0||!i,onClick:()=>void c(),children:[(0,K.jsx)(Zs,{"aria-hidden":!0}),o(`runs.header.summary.download`)]})]})},{key:`path`,label:o(`runs.header.summary.path`),value:(0,K.jsx)(Ve,{path:e.repository,variant:`line`})},{key:`time`,label:o(`runs.header.summary.time`),value:yf(Df(e,t)-e.createdAt)},...l?[{key:`tokens`,label:o(`runs.header.summary.tokens`),value:l}]:[]];return(0,K.jsx)(`aside`,{"aria-label":o(`runs.header.summary.label`),className:`shrink-0 border-l pl-4 @3xl:w-[28rem]`,children:(0,K.jsx)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-4 gap-y-1.5 text-sm`,children:u.map(e=>(0,K.jsxs)(`div`,{className:`contents`,children:[(0,K.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e.label}),(0,K.jsx)(`dd`,{className:`min-w-0 text-foreground tabular-nums`,children:e.value})]},e.key))})})}function wv({run:e,repair:t}){let{t:n}=B();return(0,K.jsxs)(K.Fragment,{children:[e.dirtyWarning?(0,K.jsx)(N,{variant:`warn`,children:n(`runs.header.dirty`)}):null,t&&!t.allowed?(0,K.jsx)(N,{variant:`warn`,"data-testid":`observer-forbidden`,children:n(`runs.header.observerForbidden`)}):null,t?.cancelReason?(0,K.jsx)(N,{variant:`warn`,"data-testid":`observer-cancel-reason`,children:n(`runs.header.observerCancelReason`,{reason:t.cancelReason})}):null]})}function Tv({run:e,repair:t,observer:n,hold:r,delivery:i}){let{t:a}=B(),{observing:o,setObserver:s,observerError:c}=n,{continueItem:l}=r;return(0,K.jsxs)(K.Fragment,{children:[t?.active?(0,K.jsx)(L,{variant:`outline`,loading:o,onClick:()=>void s(!1),children:a(`runs.header.observerCancel`)}):null,t&&!t.allowed?(0,K.jsx)(L,{variant:`outline`,loading:o,onClick:()=>void s(!0),children:a(`runs.header.observerGiveBack`)}):null,c?(0,K.jsx)(`span`,{role:`alert`,className:`text-sm text-destructive`,children:c}):null,l===null?null:(0,K.jsx)(L,{variant:`outline`,loading:r.continuing,onClick:()=>void r.resume(l),children:a(`runs.header.continue`)}),r.pausable?(0,K.jsx)(L,{variant:`outline`,loading:r.pausing,onClick:()=>void r.pause(),children:a(`runs.header.pause`)}):null,e.returnable?(0,K.jsx)(L,{variant:`outline`,loading:r.returning,onClick:()=>void r.putBack(),children:a(`runs.header.returnRun`)}):null,i.autoCancellable?(0,K.jsx)(L,{variant:`outline`,loading:i.cancellingAuto,onClick:()=>void i.cancelAuto(),children:a(`runs.header.cancelAutoDelivery`)}):e.finished&&!i.deliverable?null:(0,K.jsx)(L,{loading:i.applying,disabled:!i.deliverable,onClick:()=>void i.apply(!1),children:a(`runs.header.deliver`)})]})}function Ev({retry:e}){let{t}=B(),{failed:n,retrying:r,hasCancelled:i}=e;return n.length===0?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(wu,{disabled:r!==null,onSelect:()=>void e.retryFailed(!1),children:[(0,K.jsx)(o,{className:r===`plain`?`motion-safe:animate-spin`:void 0}),t(i?`runs.header.retryFailedCancelled`:`runs.header.retryFailed`),` (`,n.length,`)`]}),(0,K.jsxs)(wu,{disabled:r!==null,onSelect:()=>void e.retryFailed(!0),children:[(0,K.jsx)(xl,{className:r===`refresh`?`motion-safe:animate-spin`:void 0}),t(`runs.header.retryRefreshConfig`),` (`,n.length,`)`]}),(0,K.jsx)(Eu,{})]})}function Dv({run:e,retry:t,delivery:n,onSubtask:r,onAddLink:i,onChangeVariant:a}){let{t:o}=B();return(0,K.jsxs)(bu,{children:[(0,K.jsx)(xu,{asChild:!0,children:(0,K.jsxs)(L,{variant:`outline`,"aria-label":o(`runs.header.more`),children:[(0,K.jsx)($s,{}),o(`runs.header.more`)]})}),(0,K.jsxs)(Cu,{align:`start`,children:[(0,K.jsx)(Ev,{retry:t}),(0,K.jsxs)(wu,{disabled:!i,onSelect:i,children:[o(`links.add`),`…`]}),a?(0,K.jsx)(wu,{onSelect:a,children:o(`runs.header.changeVariant`)}):null,r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(wu,{onSelect:()=>r(e),children:[(0,K.jsx)(zc,{}),o(`runs.header.subtask`)]}),(0,K.jsx)(Eu,{})]}):null,(0,K.jsx)(wu,{disabled:!n.deliverable,onSelect:()=>n.setForcing(!0),children:o(`runs.header.forceDeliver`)}),(0,K.jsx)(wu,{disabled:!n.deliverable,onSelect:()=>void n.markDelivered(),children:o(`runs.header.markDelivered`)}),(0,K.jsx)(wu,{onSelect:()=>{navigator.clipboard?.writeText(e.id),V(o(`runs.header.copied`))},children:o(`runs.header.copyId`)})]})]})}function Ov(e,t,n){let{t:r}=B(),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(null);(0,H.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),V(r(`runs.header.returned`))}),pause:()=>f(s,async()=>{let n=await t.pauseRun(e.id,e.repository);d(n.item),V(r(`runs.header.paused`))}),resume:n=>f(l,async()=>{await t.forRepository(e.repository).queueRunNow(n),d(null),V(r(`runs.header.continued`))}),continueItem:(e.hold===null?null:e.queueItem)??u,pausable:!e.finished&&e.hold===null&&e.queueItem===null&&u===null}}function kv(e,t){let[n,r]=(0,H.useState)(!1),[i,a]=(0,H.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 Av(e,t){let[n,r]=(0,H.useState)(!1),[i,a]=(0,H.useState)(null),{byId:o}=g(),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 jv=e=>e===`failed`||e===`cancelled`;function Mv(e,t,n){let{t:r}=B(),[i,a]=(0,H.useState)(null),o=e.groups.filter(e=>jv(e.status));return e.split&&jv(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(`; `)})):V(r(`runs.header.retryStarted`))}}}function Nv(e,t,n,r){let{t:i}=B(),a=Ke(),[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.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),V(i(`runs.header.markedDelivered`))}catch(e){n(e.message)}},deliverable:Bh(e),cancellingAuto:u,cancelAuto:async()=>{d(!0);try{await t.cancelAutoDelivery(e.id),V(i(`runs.header.autoDeliveryCancelled`))}catch(e){n(e.message)}finally{d(!1)}},autoCancellable:Vh(e)}}function Pv({run:e,api:t,variants:n,onClose:r}){let{t:i}=B(),[a,o]=(0,H.useState)(e.variant),[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(null),d=async()=>{c(!0),u(null);try{await t.setRunVariant(e.id,a),V(i(`runs.header.variantChanged`)),r()}catch(e){u(e.message),c(!1)}};return(0,K.jsx)(Cd,{open:!0,onOpenChange:e=>!e&&r(),children:(0,K.jsxs)(wd,{children:[(0,K.jsxs)(Td,{children:[(0,K.jsx)(Dd,{children:i(`runs.header.changeVariantTitle`)}),(0,K.jsx)(Od,{children:i(`runs.header.changeVariantDescription`)})]}),(0,K.jsx)(`div`,{role:`radiogroup`,className:`flex flex-col gap-2`,children:n.map(e=>(0,K.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,K.jsx)(`input`,{type:`radio`,name:`run-variant`,value:e.id,checked:a===e.id,disabled:s,onChange:()=>o(e.id)}),e.name,e.name===e.id?null:(0,K.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.id})]},e.id))}),l?(0,K.jsx)(N,{variant:`destructive`,children:l}):null,(0,K.jsxs)(Ed,{children:[(0,K.jsx)(L,{variant:`outline`,disabled:s,onClick:r,children:i(`runs.header.changeVariantKeep`)}),(0,K.jsx)(L,{loading:s,disabled:a===e.variant,onClick:()=>void d(),children:i(`runs.header.changeVariantConfirm`)})]})]})})}function Fv(e,t){let[n,r]=(0,H.useState)([]),{repository:i,pipeline:a}=e;return(0,H.useEffect)(()=>{let e=!0;return r([]),t.forRepository(i).pipelines().then(t=>{let n=t.pipelines.find(e=>e.id===a);e&&r(n?.variants.map(({id:e,name:t})=>({id:e,name:t}))??[])},()=>void 0),()=>{e=!1}},[t,i,a]),n}function Iv(e,t){let[n,r]=(0,H.useState)(!1),i=Fv(e,t),a=e.groups.some(e=>e.status===`failed`||e.status===`cancelled`)||e.split!==null&&e.split!==void 0&&(e.split.status===`failed`||e.split.status===`cancelled`);return{open:(!e.finished||a)&&i.length>1?()=>r(!0):void 0,dialog:n?(0,K.jsx)(Pv,{run:e,api:t,variants:i,onClose:()=>r(!1)}):null}}var Lv={done:js,waiting:Us,blocked:_s},Rv={done:`ok`,waiting:`warn`,blocked:`err`};function zv({link:e,repository:t,onProject:n,blocking:r,linkItems:i}){let{t:a}=B(),o=r?e.state:void 0,s=o?Lv[o]:null,c=o?Rv[o]:`mute`,l=e.repository!==null&&e.repository!==t,u=l&&e.repository?F(e.repository):null,d=`${e.number===null?``:`${vf(e.number)} `}${e.title||e.id}`,f=[o?a(`queue.dependency.${o}`):null,u,d].filter(Boolean).join(`: `),p=(0,K.jsxs)(K.Fragment,{children:[s?(0,K.jsx)(s,{"aria-hidden":!0}):null,u?(0,K.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 font-semibold`,"data-project":``,children:[(0,K.jsx)(it,{path:e.repository}),u]}):null,(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:d}),o?(0,K.jsx)(`span`,{className:`sr-only`,children:a(`queue.dependency.${o}`)}):null]}),m=S(b({variant:c}),`max-w-full sm:max-w-[16rem]`);return e.ref===`run`?(0,K.jsx)(`a`,{className:S(m,`underline`),title:f,"data-state":o,href:M({view:`runs`,run:e.id,group:null,step:null,tab:null}),children:p}):l&&e.ref===`item`&&n&&e.repository?(0,K.jsx)(`button`,{type:`button`,className:S(m,`underline`),title:a(`queue.list.openProjectQueue`,{project:u??``}),"data-state":o,onClick:()=>n(e.repository),children:p}):i&&e.ref===`item`?(0,K.jsx)(`a`,{href:`#queue`,className:S(m,`underline`),title:f,children:p}):(0,K.jsx)(R,{variant:c,className:`max-w-full sm:max-w-[16rem]`,title:f,"data-state":o,children:p})}function Bv({links:e,linkedBy:t,repository:n,onProject:r,onRemove:i,linkItems:a}){let{t:o}=B(),s=(s,c)=>{let l=(c?t:e).filter(e=>e.kind===s);if(!l.length)return null;let u=c&&s===`parent`?l.slice(0,3):l,d=o(c&&s!==`related`?`links.inverse.${s}`:`links.kind.${s}`);return(0,K.jsxs)(`span`,{className:`inline-flex min-w-0 flex-wrap items-center gap-1`,children:[(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[d,`:`]}),u.map(e=>(0,K.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,K.jsx)(zv,{link:e,repository:n,onProject:r,linkItems:a,blocking:!c&&s===`blocked_by`}),!c&&i?(0,K.jsx)(`button`,{type:`button`,"aria-label":`${o(`links.remove`)}: ${e.title||e.id}`,title:o(`links.remove`),onClick:()=>i(e),children:`×`}):null]},e.id)),u.length<l.length?(0,K.jsx)(`span`,{title:l.map(e=>`${e.number===null?``:`${vf(e.number)} `}${e.title||e.id}`).join(`
|
|
18
|
+
`),children:o(`links.more`,{count:l.length-u.length})}):null]},`${c}-${s}`)};return(0,K.jsxs)(K.Fragment,{children:[Qg.map(e=>s(e,!1)),$g.map(e=>s(e,!0))]})}function Vv({run:e,api:t,choices:n,open:r,onOpenChange:i}){let{t:a}=B(),[o,s]=(0,H.useState)({kind:`related`,target:``}),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(!1);(0,H.useEffect)(()=>{r&&(s({kind:`related`,target:``}),l(null))},[r,e.id]);let f=async()=>{if(o.target&&!u){d(!0),l(null);try{await t.taskLink(e.id,o.kind,o.target),i(!1)}catch(e){l(e.message)}finally{d(!1)}}};return(0,K.jsx)(Cd,{open:r,onOpenChange:i,children:(0,K.jsxs)(wd,{"aria-describedby":void 0,children:[(0,K.jsx)(Dd,{children:a(`links.add`)}),(0,K.jsx)(i_,{value:[o],onChange:e=>s(e[0]??{kind:`related`,target:``}),choices:n??(()=>[]),addButton:!1,editableKinds:e.links.some(e=>e.kind===`parent`)?[`related`,`duplicates`]:[`parent`,`related`,`duplicates`]}),c?(0,K.jsx)(N,{variant:`destructive`,children:c}):null,(0,K.jsx)(L,{disabled:u||!o.target||!n,onClick:()=>void f(),children:a(`links.add`)})]})})}function Hv({run:e,onProject:t,onRemove:n}){let{t:r}=B(),i=[{key:`outgoing`,links:e.links,linkedBy:[]},{key:`incoming`,links:[],linkedBy:e.linkedBy}];return(0,K.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:i.map(i=>(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 rounded-md border p-3`,children:[(0,K.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`links.${i.key}`)}),i.links.length||i.linkedBy.length?(0,K.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2 text-xs`,children:(0,K.jsx)(Bv,{links:i.links,linkedBy:i.linkedBy,repository:e.repository,onProject:t,linkItems:!0,onRemove:n})}):(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`links.none`)})]},i.key))})}function Uv({run:e,onProject:t,onRemove:n}){let{t:r}=B(),[i,a]=(0,H.useState)(!0),o=e.links.length+e.linkedBy.length;return o===0?null:(0,K.jsx)(`section`,{"aria-label":r(`links.title`),className:`mt-3 border-t pt-3`,children:(0,K.jsxs)(Vp,{open:i,onOpenChange:a,children:[(0,K.jsxs)(Hp,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,K.jsx)(v,{"aria-hidden":!0,className:S(`size-4 transition-transform`,i&&`rotate-90`)}),r(`links.title`),(0,K.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:o})]}),(0,K.jsx)(Up,{className:`pt-3`,children:(0,K.jsx)(Hv,{run:e,onProject:t,onRemove:n})})]})})}function Wv({run:e,api:t,choices:n,open:r,onOpenChange:i,onProject:a}){let{t:o}=B(),s=async n=>{try{await t.taskUnlink(e.id,n.kind,n.id)}catch(e){tt(e)}};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Uv,{run:e,onProject:a,onRemove:e=>void s(e)}),(0,K.jsx)(Vv,{run:e,api:t,choices:n,open:r,onOpenChange:i})]})}function Gv({run:e,api:t,tags:n}){let{t:r}=B();return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:(0,K.jsx)(yv,{run:e,api:t})}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(Im,{id:e.pipeline,name:e.pipelineName}),(0,K.jsx)(Lm,{id:e.variant,name:e.variantName})]}),e.name?(0,K.jsx)(`div`,{className:`font-mono text-xs text-muted-foreground`,children:e.name}):null,(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(gv,{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,K.jsx)(N,{variant:`destructive`,children:n.tagError}):null]})]})}function Kv({run:e,api:t,now:n,onError:r,onSelect:i,onDeliver:a,onSubtask:o,headerRef:s,entry:c=null,linkChoices:u,onOpenProject:d}){let{t:f}=B(),p=l(e),m=Ov(e,t,r),h=kv(e,t),g=Av(e,t),_=Mv(e,t,r),v=Nv(e,t,r,a),[y,b]=(0,H.useState)(!1),x=Iv(e,t);return(0,K.jsxs)(`header`,{ref:s,"aria-label":f(`runs.header.label`),className:`@container border-b p-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-4 @3xl:flex-row @3xl:items-start`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,K.jsx)(Gv,{run:e,api:t,tags:g}),(0,K.jsx)(wv,{run:e,repair:p}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(Tv,{run:e,repair:p,observer:h,hold:m,delivery:v}),(0,K.jsx)(xv,{run:e,api:t,onError:r}),(0,K.jsx)(Dv,{run:e,retry:_,delivery:v,onSubtask:o,onAddLink:u?()=>b(!0):void 0,onChangeVariant:x.open})]})]}),(0,K.jsx)(Cv,{run:e,now:n,entry:c,onSelect:i,api:t,onError:r})]}),(0,K.jsx)(Wv,{run:e,api:t,choices:u,open:y,onOpenChange:b,onProject:d}),x.dialog,v.forcing?(0,K.jsx)(Fh,{run:e,api:t,onConfirm:()=>void v.apply(!0),onClose:()=>v.setForcing(!1)}):null]})}var qv=200;function Jv(e){let t=(e??``).split(`
|
|
19
|
+
`)[0]?.trim()??``;return t.length>qv?`${t.slice(0,qv)}…`:t}function Yv(e,t,n){t.kind===`applied`?V(e(`runs.system.delivered`)):t.kind===`failed`&&tt(e(n?`runs.system.deliveryFailedAgain`:`runs.system.deliveryFailedWith`,{reason:Jv(t.reason)}))}function Xv(e,t){let{t:n}=B(),[r,i]=(0,H.useState)({});return(0,H.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=Kh(r,o);s===null?r.delivery.inProgress&&!o.busy&&a.push(i):(e.push(i),s.kind!==`cancelled`&&s.kind!==`pending`&&Yv(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,H.useCallback)(async(t,r)=>{let a={since:t.delivery.finishedAt,failedBefore:t.delivery.failed>0,busy:!1},o=Gh(await e.apply(t.id,r));o.kind===`pending`?(V(n(`runs.system.deliveryStarted`)),i(e=>({...e,[t.id]:a}))):Yv(n,o,a.failedBefore)},[e,n])}function Zv({props:e}){let{t}=B(),{openedState:n=null,route:r,loaded:i}=e;return n===`loading`?(0,K.jsxs)(`div`,{role:`status`,"aria-label":t(`runs.page.connecting`),className:`flex flex-col gap-2 p-4`,children:[(0,K.jsx)(pe,{className:`h-16`}),(0,K.jsx)(pe,{className:`h-40`})]}):n===`missing`?(0,K.jsx)(at,{icon:(0,K.jsx)(Cc,{}),title:t(`runs.page.notFound`),className:`m-auto`,children:(0,K.jsx)(`p`,{className:`font-mono`,children:r.run})}):i?(0,K.jsx)(at,{icon:(0,K.jsx)(rl,{}),title:t(`runs.page.choose`),className:`m-auto`,children:(0,K.jsxs)(`p`,{children:[t(`runs.page.chooseHint`),` `,(0,K.jsxs)(yu,{children:[cu(),`K`]})]})}):null}function Qv(e){let{t}=B(),{api:n,runs:r,run:i,route:a,now:o,onSelect:s,onRoute:c}=e,[l,u]=(0,H.useState)(null),d=Ah(l),f=Xv(n,r);if(!i)return(0,K.jsx)(Zv,{props:e});let p=Pm(i).find(e=>e.slug===a.group)??Fm(i);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Kv,{run:i,api:n,now:o,onError:e.onError,onDeliver:e=>f(i,e),onSubtask:e.onSubtask,linkChoices:e.linkChoices?.(i),onOpenProject:e.onOpenProject,onSelect:e=>s(i.id,e),headerRef:u,entry:p}),p?(0,K.jsx)(lv,{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:Bh(i),onDeliver:()=>f(i,!1),run:i,linkChoices:e.linkChoices?.(i),onForceDeliver:()=>f(i,!0),showUsage:d,onSelectEntry:e=>s(i.id,e)},`${i.id}/${p.slug}/${a.step??``}`):(0,K.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:t(`runs.page.noGroups`)})]})}function $v({more:e,onMore:t,setMarker:n}){let{t:r}=B();return e===`done`?null:e===`error`?(0,K.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 text-sm text-destructive`,children:[r(`runs.list.moreFailed`),(0,K.jsx)(L,{variant:`outline`,size:`sm`,onClick:t,children:r(`runs.list.retry`)})]}):(0,K.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,K.jsx)(pe,{className:`h-16`}):(0,K.jsx)(`div`,{className:`h-4`})})}var ey=[`human`,`autopilot`,`observer`];function ty({run:e}){let{t}=B(),n=e.decisions??[];if(n.length===0)return null;let r=e=>e.split(`
|
|
20
|
+
`)[0]??``,i=ey.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(`
|
|
21
|
+
`);return(0,K.jsxs)(`span`,{className:`text-xs text-muted-foreground`,title:a,children:[t(`runs.list.answers`),`: `,i.join(` · `)]})}function ny({done:e,total:t}){let{t:n}=B(),r=Ef({done:e,total:t});return(0,K.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,K.jsx)(`span`,{className:`h-1 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,K.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,K.jsxs)(`span`,{className:`w-[4ch] shrink-0 text-right text-xs tabular-nums`,children:[r,`%`]})]})}function ry({run:e}){let{t}=B();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,K.jsx)($,{status:`warnings`,label:t(`status.warnings`,{n})})}var iy=[`active`,`needs_human`,`repair`,`paused`,`frozen`],ay=[`merging`,`merged`,`conflict`,`failed`,`cancelled`,`done`];function oy(e,t){return e===`needs_human`&&t===`needs_human`?0:e===`running`?1:2}function sy(e,t){if(!iy.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=>!ay.includes(e.status)&&e.name).map((e,t)=>({entry:e,index:t})).sort((t,n)=>oy(t.entry.status,e.state)-oy(n.entry.status,e.state)||t.index-n.index);return[...new Set(i.map(({entry:e})=>e.name))]}function cy(e,t){let n=sy(e,t),[r]=n;return r===void 0?null:{first:r,rest:n.length-1,all:n}}function ly({run:e}){let{t}=B(),n=Wh(e);return n?(0,K.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 uy({run:e,selectedGroup:t,onSelect:n}){let{t:r}=B(),i=Pm(e);return(0,K.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,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,"aria-current":i.slug===t,className:S(`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,K.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,K.jsx)(`span`,{className:`ml-1.5 text-xs font-normal text-muted-foreground`,children:r(`runs.system.badge`)}):null]}),qh(i,r)]})},i.slug))})}function dy(e){let{run:t,open:n,now:r,scope:i,onSelect:a}=e,{t:o}=B(),s=Of(t,r,up()),c=Wh(t),l=cy(t,e=>o(`runs.system.${e}`)),u=Uf(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,K.jsxs)(`li`,{"data-run":t.id,children:[(0,K.jsxs)(`button`,{type:`button`,className:S(`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:`${wf(t)}\n${t.id}`,onClick:()=>a(t.id,null),children:[(0,K.jsxs)(`span`,{className:`block min-w-0 text-sm font-medium break-words [overflow-wrap:anywhere]`,children:[(0,K.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:vf(t.number)}),` `,wf(t)]}),(0,K.jsx)(`span`,{className:`truncate font-mono text-xs text-muted-foreground`,children:t.name??`—`}),(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[i===`all`?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-medium`,title:t.repository,children:[(0,K.jsx)(it,{path:t.repository}),F(t.repository)]}):null,(0,K.jsx)(Im,{id:t.pipeline,name:t.pipelineName,focusable:!1}),(0,K.jsx)(Lm,{id:t.variant,name:t.variantName,focusable:!1}),(0,K.jsx)(h,{tags:t.tags??[],nested:!0})]}),(0,K.jsxs)(`span`,{className:`grid grid-cols-2 items-center gap-2 text-xs text-muted-foreground`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,K.jsx)($,{status:t.state,label:d,tip:l?.all.join(`, `)}),(0,K.jsx)(ry,{run:t}),(0,K.jsx)(ly,{run:t})]}),t.state===`finished`?null:(0,K.jsx)(ny,{done:t.progress.done,total:t.progress.total})]}),(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,K.jsx)(`span`,{children:s.created}),(0,K.jsx)(`span`,{children:s.duration}),xf(t.usage)?(0,K.jsx)(`span`,{children:xf(t.usage)}):null,t.attachments.length>0?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,title:o(`attachments.count`,{count:t.attachments.length}),"data-attachments":t.attachments.length,children:[(0,K.jsx)(dl,{className:`size-3`,"aria-hidden":!0}),t.attachments.length]}):null]}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.liveDiff?Cf(t.liveDiff,o):`—`}),(0,K.jsx)(ty,{run:t})]}),n&&Pm(t).length>1?(0,K.jsx)(uy,{...e}):null]})}function fy({done:e,filtered:t,onReset:n}){let{t:r}=B();return(0,K.jsxs)(K.Fragment,{children:[e?(0,K.jsx)(at,{icon:(0,K.jsx)(Tl,{}),title:r(`runs.list.empty`)}):null,t?(0,K.jsx)(L,{variant:`outline`,size:`sm`,onClick:n,children:r(`runs.list.reset`)}):null]})}function py({runs:e,selectedRun:t,selectedGroup:n,now:r,query:i,onQuery:a,filters:o,onFilters:s,onSelect:c,scope:l,repository:u,repositoryPaths:d,showFilters:f=!0,more:p=`done`,onMore:m=()=>void 0}){let{t:h}=B(),{byId:_}=g(),v=ih(e,i,o,l,u,_),y=ch(i,o,l)>0,[b,x]=(0,H.useState)(null),S=`${l}|${u}|${e.length}`;return W_(p===`idle`?b:null,m,S),(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[f?(0,K.jsx)(Eh,{runs:e,query:i,onQuery:a,scope:l,repository:u,repositoryPaths:d,filters:o,onFilters:s}):null,v.length===0?(0,K.jsx)(fy,{done:p===`done`,filtered:y,onReset:()=>{a(``),s(Xm)}}):(0,K.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:v.map(e=>(0,K.jsx)(dy,{run:e,open:e.id===t,selectedGroup:n,now:r,scope:l,onSelect:c},e.id))}),(0,K.jsx)($v,{more:p,onMore:m,setMarker:x})]})}function my(e){return!e||e.done?`done`:e.error===null?e.loading?`loading`:`idle`:`error`}function hy(e){let{t}=B(),{runs:n,loaded:r,run:i,group:a,history:o,...s}=e;return r?n.length===0?null:(0,K.jsx)(py,{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,repository:s.repository,repositoryPaths:s.repositoryPaths,more:my(o),onMore:o?.loadMore}):(0,K.jsxs)(`div`,{role:`status`,"aria-label":t(`runs.page.connecting`),className:`flex flex-col gap-2`,children:[(0,K.jsx)(pe,{className:`h-16`}),(0,K.jsx)(pe,{className:`h-16`}),(0,K.jsx)(pe,{className:`h-16`})]})}function gy(){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 _y(e){let{byId:t}=g(),[n]=(0,H.useState)(gy),[r,i]=Ne(`runFilters`,{...Xm,tagIds:n}),[a,o]=Ne(`runFiltersCollapsed`,!1);return{filters:{...Xm,...r,tagIds:(r.tagIds??[]).filter(n=>t.get(n)?.repository===e)},setStored:i,collapsed:a,setCollapsed:o,byId:t}}function vy(e){let{route:t,onRoute:n,wide:r,shown:i,run:a}=e,[o,s]=(0,H.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`}))};mu(`j`,()=>l(1)),mu(`k`,()=>l(-1));let u=(0,H.useRef)({run:t.run,group:t.group,step:t.step});return(0,H.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,H.useEffect)(()=>{r&&s(`list`)},[r]),{screen:o,setScreen:s,select:c}}var yy=464;function by(e){let{runs:t,loaded:n,openedState:r=null,route:i,repository:a,scope:o}=e,s=Be(`(min-width: 768px)`),c=Be(`(min-width: 1280px)`),[l,u]=(0,H.useState)(``),{filters:d,setStored:f,collapsed:p,setCollapsed:m,byId:h}=_y(a),g=t.find(e=>e.id===i.run)??null,_=ih(t,l,d,o,a,h),{screen:v,setScreen:y,select:b}=vy({route:i,onRoute:e.onRoute,wide:s,shown:_,run:g}),x={runs:t,query:l,onQuery:u,filters:d,onFilters:f,scope:o,repository:a,repositoryPaths:e.repositoryPaths},S=ch(l,d,o);if(n&&t.length===0)return(0,K.jsx)(kh,{onRoute:e.onRoute});let C=g?Pm(g).find(e=>e.slug===i.group)??Fm(g):null,w=(0,K.jsx)(Qv,{...e,run:g,onSelect:b}),T=n?(0,K.jsx)(Dh,{filterProps:x,count:S,wide:s}):null,E=(0,K.jsx)(hy,{...x,loaded:n,run:g,group:C?.slug??null,now:e.now,onSelect:b,history:e.history});return s?(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[c&&n?(0,K.jsx)(Oh,{filterProps:x,count:S,collapsed:p,onCollapsed:m}):null,(0,K.jsxs)(`aside`,{"data-runs-list":!0,style:{width:c&&p?yy:320},className:`flex shrink-0 flex-col gap-2 overflow-y-auto border-r p-3`,children:[c?null:T,E]}),(0,K.jsx)(`main`,{className:`flex min-w-0 flex-1 flex-col overflow-y-auto`,children:w})]}):v===`detail`&&(g||r===`loading`||r===`missing`)?(0,K.jsx)(lh,{onBack:()=>y(`list`),children:w}):(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 p-3`,children:[T,E]})}var xy={active:0,planned:1,finished:2};function Sy(e,t){let n=e.filter(e=>e.repository===t).map(e=>{let t=e.state===`queued`&&e.queueItem!==null||!e.finished&&e.startedAt===null?`planned`:e.finished?`finished`:`active`;return{run:e,section:t,key:t===`finished`?e.finishedAt??e.createdAt:t===`active`?e.startedAt??e.createdAt:e.createdAt}});return n.sort((e,t)=>xy[e.section]-xy[t.section]||t.key-e.key||t.run.createdAt-e.run.createdAt||e.run.id.localeCompare(t.run.id,`en`)),n.map(({run:e,section:t})=>({id:e.id,number:e.number,title:e.title,section:t}))}function Cy(e,t){return{id:e.id,number:e.title?e.number:null,title:e.title||e.id,...e.repository&&e.repository!==t?{project:F(e.repository)}:{}}}function wy(e,t,n,r,i,a=[]){let o=new Set(i?[i.id]:[]),s=[],c=(e,t)=>{let n=t.filter(e=>!o.has(e.id)&&(o.add(e.id),!0));n.length&&s.push({section:e,options:n})},l=(t,i)=>{let a=i?F(t.repository):void 0,o=e=>a?{...e,project:a}:e,s=[{section:`items`,options:t.items.map(e=>o({id:e.id,number:e.number,title:r(e)}))}];if(e===`blocked_by`){let e=new Map(n.map(e=>[e.id,e])),r=[...t.runs].sort((t,n)=>(e.get(n.id)?.startedAt??n.createdAt)-(e.get(t.id)?.startedAt??t.createdAt)||n.createdAt-t.createdAt||t.id.localeCompare(n.id,`en`));s.push({section:`queueRuns`,options:r.map(e=>o({id:e.id,number:e.number,title:e.title}))})}else{let e=Sy(n,t.repository);for(let t of[`active`,`planned`,`finished`])s.push({section:t,options:e.filter(e=>e.section===t).map(e=>o({id:e.id,number:e.number,title:e.title}))})}return s};for(let e of l(t,!1))c(e.section,e.options);return c(`other`,[...a].filter(e=>e.repository!==t.repository).sort((e,t)=>F(e.repository).localeCompare(F(t.repository),`en`)||e.repository.localeCompare(t.repository,`en`)).flatMap(e=>l(e,!0).flatMap(e=>e.options))),c(`current`,(i?.links??[]).filter(t=>t.kind===e).map(e=>Cy(e,t.repository))),s}function Ty(e,t){return t.filter(t=>e.includes(t))}function Ey({idPrefix:e,steps:t,skip:n,variantSkip:r=[],disabled:i=!1,onChange:a}){let{t:o}=B(),s=t.map(e=>e.id),c=Ty(r,s),l=Ty([...n,...c],s);return(0,K.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,K.jsx)(`legend`,{className:`mb-1.5 text-sm leading-none font-medium`,children:o(`queue.form.skip`)}),t.length===0?(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(`queue.form.skipNoSteps`)}):(0,K.jsx)(_e,{type:`multiple`,className:`h-auto flex-wrap`,value:l,onValueChange:e=>a(Ty(e.filter(e=>!c.includes(e)),s)),children:t.map(n=>(0,K.jsx)(Ce,{id:`${e}-skip-${n.id}`,value:n.id,title:c.includes(n.id)?o(`queue.form.skipByVariant`,{id:n.id}):n.id,disabled:i||c.includes(n.id)||!l.includes(n.id)&&l.length===t.length-1,className:`data-[state=on]:line-through`,children:n.name},n.id))})]})}function Dy(e){return e?.steps.map(e=>({id:e.id,name:e.name??e.id}))??[]}function Oy(e=``){return{pipeline:e,variant:`default`,mode:`task`,task:``,groups:[{title:``,task:``}],title:``,autoDeliver:null,deliveryMode:null,tags:[],links:[],skip:[],linksTouched:!1}}function ky(e){return{...e,task:``,groups:[{title:``,task:``}],title:``,links:e.links.filter(e=>e.kind===`parent`),linksTouched:!1}}function Ay(e){return{pipeline:e.pipeline,variant:e.variant??`default`,mode:e.groups?`groups`:`task`,task:e.task??``,groups:e.groups?e.groups.map(e=>({...e})):[{title:``,task:``}],title:e.title??``,autoDeliver:e.autoDeliver,deliveryMode:e.deliveryMode??null,tags:(e.tags??[]).map(e=>e.id),links:(e.links??[]).map(e=>({kind:e.kind,target:e.id})),skip:[...e.skip??[]],linksTouched:!1,...e.attachments&&e.attachments.length>0?{existing:e.attachments.map(e=>({...e}))}:{}}}function jy(e,t,n,r=()=>[]){let i=t.includes(e.pipeline)?e.pipeline:t[0]??e.pipeline,a=r(i);return{...e,pipeline:i,variant:a.includes(e.variant)?e.variant:`default`,links:[],linksTouched:!1,skip:Ty(e.skip,n(i))}}function My(e){return e.pipeline===``||Fy(e)||[...e.title.trim()].length>60?!1:e.mode===`task`?e.task.trim()!==``||e.title.trim()!==``:e.groups.length>0&&e.groups.every(e=>e.title.trim()!==``||e.task.trim()!==``)}function Ny(e){let t=e.split(/\r\n|\r|\n/).find(e=>e.trim()!==``)?.trim()??``;return Array.from(t).slice(0,60).join(``)}function Py(e){return(e.attachments??[]).flatMap(e=>e.upload===null?[]:e.upload)}function Fy(e){return(e.attachments??[]).some(e=>e.upload===null&&e.error===null)}function Iy(e,t=()=>void 0,n=!1,r=!1){let i=e.title.trim(),a=e.tags.flatMap(e=>t(e)??[]),o=Py(e),s=e.detached??[],c=e.links.filter(e=>e.target!==``);return{pipeline:e.pipeline,...n||e.variant!=="default"?{variant:e.variant}:{},...e.mode===`task`?{task:e.task.trim()||i}:{groups:e.groups.map(e=>({title:e.title.trim()||Ny(e.task),task:e.task.trim()||e.title.trim()}))},...i===``?{}:{title:i},...e.postponed?{postponed:!0}:{},...e.autoDeliver===null?{}:{autoDeliver:e.autoDeliver},...e.deliveryMode===null?{}:{deliveryMode:e.deliveryMode},...n||a.length>0?{tags:a}:{},...n||e.skip.length>0?{skip:e.skip}:{},...r?e.linksTouched?{after:c.filter(e=>e.kind===`blocked_by`).map(e=>e.target)}:{}:(n?e.linksTouched:c.length>0)?{links:c}:{},...o.length>0?{uploads:o}:{},...s.length>0?{detach:s}:{}}}var Ly=20971520;function Ry(e,t,n){let{t:r,i18n:i}=B(),[a,o]=(0,H.useState)(null),s=(0,H.useRef)(t.entries);s.current=t.entries;let c=(0,H.useRef)(n);c.current=n;let l=(0,H.useRef)(0),u=e=>{s.current=e,c.current({attachments:e})},d=(e,t)=>u(s.current.map(n=>n.key===e?{...n,...t}:n)),f=t.existing.filter(e=>!t.detached.includes(e.fileName)),p=e=>f.some(t=>t.fileName===e)||s.current.some(t=>t.error===null&&t.fileName===e),m=(t,n)=>{e.uploadAttachment(t,e=>d(n,{progress:e})).then(e=>d(n,{upload:e.upload,progress:100}),e=>d(n,{error:e.message}))};return{problem:a,add:e=>{let t=[],n=null;for(let a of e){let e=f.length+s.current.filter(e=>e.error===null).length+t.length;a.size>20971520?n=r(`attachments.tooLarge`,{name:a.name,limit:If(Ly,r,i.language)}):e>=10?n=r(`attachments.tooMany`,{count:10}):p(a.name)||t.some(e=>e.file.name===a.name)?n=r(`attachments.duplicate`,{name:a.name}):(l.current+=1,t.push({file:a,entry:{key:`${a.name}#${l.current}`,fileName:a.name,size:a.size,progress:0,upload:null,error:null}}))}if(o(n),t.length!==0){u([...s.current,...t.map(e=>e.entry)]);for(let{file:e,entry:n}of t)m(e,n.key)}},remove:e=>u(s.current.filter(t=>t.key!==e)),detach:e=>c.current({detached:[...t.detached,e]}),restore:e=>c.current({detached:t.detached.filter(t=>t!==e)}),kept:f}}function zy({entry:e,onRemove:t}){let{t:n,i18n:r}=B(),i=e.upload===null&&e.error===null;return(0,K.jsxs)(`li`,{className:`flex items-center gap-2 text-sm`,"data-attachment":e.fileName,children:[(0,K.jsx)(dl,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:e.fileName}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:If(e.size,n,r.language)}),i?(0,K.jsx)(`progress`,{className:`h-1.5 w-20`,max:100,value:e.progress,"aria-label":n(`attachments.uploading`,{name:e.fileName})}):null,e.error===null?null:(0,K.jsx)(`span`,{role:`alert`,className:`text-xs text-destructive`,children:n(`attachments.failed`,{error:e.error})}),(0,K.jsx)(L,{variant:`ghost`,size:`sm`,className:`ml-auto`,"aria-label":`${n(`attachments.remove`)} ${e.fileName}`,onClick:t,children:(0,K.jsx)(Zl,{})})]})}function By({file:e,removed:t,locked:n,onToggle:r}){let{t:i,i18n:a}=B(),o=i(t?`attachments.restore`:`attachments.remove`);return(0,K.jsxs)(`li`,{className:`flex items-center gap-2 text-sm`,"data-attachment":e.fileName,"data-removed":t||void 0,children:[(0,K.jsx)(dl,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:t?`truncate line-through`:`truncate`,children:e.fileName}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:If(e.size,i,a.language)}),n?null:(0,K.jsx)(L,{variant:`ghost`,size:`sm`,className:`ml-auto`,"aria-label":`${o} ${e.fileName}`,onClick:()=>r(t),children:t?o:(0,K.jsx)(Zl,{})})]})}function Vy({state:e,api:t}){let{t:n}=B(),{idPrefix:r,effective:i,change:a,locked:o}=e,s=(0,H.useRef)(null),[c,l]=(0,H.useState)(!1),u=Ry(t,{entries:i.attachments??[],existing:i.existing??[],detached:i.detached??[]},a),d=i.attachments??[],f=i.existing??[];return o&&f.length===0?null:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,K.jsx)(Q,{htmlFor:`${r}-attachments`,children:n(`attachments.label`)}),o?null:(0,K.jsxs)(`div`,{"data-dropzone":``,"data-over":c||void 0,className:`flex flex-wrap items-center gap-2 rounded-md border border-dashed p-2 data-[over]:bg-muted`,onDragOver:e=>{e.preventDefault(),l(!0)},onDragLeave:()=>l(!1),onDrop:e=>{e.preventDefault(),l(!1),u.add([...e.dataTransfer.files])},children:[(0,K.jsxs)(L,{variant:`outline`,size:`sm`,onClick:()=>s.current?.click(),children:[(0,K.jsx)(dl,{}),n(`attachments.attach`)]}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`attachments.drop`)}),(0,K.jsx)(`input`,{ref:s,id:`${r}-attachments`,type:`file`,multiple:!0,hidden:!0,"data-testid":`${r}-attachments-input`,onChange:e=>{u.add([...e.target.files??[]]),e.target.value=``}})]}),u.problem?(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:u.problem}):null,(0,K.jsxs)(`ul`,{className:`flex flex-col gap-1`,"aria-label":n(`attachments.list`),children:[f.map(e=>(0,K.jsx)(By,{file:e,removed:(i.detached??[]).includes(e.fileName),locked:o,onToggle:t=>t?u.restore(e.fileName):u.detach(e.fileName)},e.id)),d.map(e=>(0,K.jsx)(zy,{entry:e,onRemove:()=>u.remove(e.key)},e.key))]})]})}function Hy(e){let t=e===`task`?`#new-task`:`#new-group-0-title`;document.querySelector(t)?.focus()}function Uy({state:e,fallback:t}){let{t:n}=B(),{idPrefix:r,effective:i,change:a}=e;return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(zh,{id:`${r}-auto-deliver`,checked:i.autoDeliver??t??!0,onCheckedChange:e=>a({autoDeliver:e})}),(0,K.jsx)(Q,{htmlFor:`${r}-auto-deliver`,children:n(`queue.form.autoDeliver`)}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i.autoDeliver===null?n(`queue.form.autoDeliverBySetting`):n(`queue.form.autoDeliverForTask`)}),i.autoDeliver===null?null:(0,K.jsx)(L,{variant:`ghost`,size:`sm`,onClick:()=>a({autoDeliver:null}),children:n(`queue.form.autoDeliverReset`)})]})}function Wy({state:e,fallback:t}){let{t:n}=B(),{idPrefix:r,effective:i,change:a}=e;return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(Q,{htmlFor:`${r}-delivery-mode`,children:n(`queue.form.deliveryMode`)}),(0,K.jsxs)(qg,{value:i.deliveryMode??t??`worktree`,onValueChange:e=>a({deliveryMode:e}),children:[(0,K.jsx)(Yg,{id:`${r}-delivery-mode`,className:`w-48`,children:(0,K.jsx)(Jg,{})}),(0,K.jsx)(Xg,{children:_.map(e=>(0,K.jsx)(Zg,{value:e,children:n(`deliveryMode.${e}`)},e))})]}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i.deliveryMode===null?n(`queue.form.deliveryModeBySetting`):n(`queue.form.deliveryModeForTask`)}),i.deliveryMode===null?null:(0,K.jsx)(L,{variant:`ghost`,size:`sm`,onClick:()=>a({deliveryMode:null}),children:n(`queue.form.deliveryModeReset`)})]})}function Gy(e){let{t}=B(),{state:n}=e,{idPrefix:r,effective:i,change:a,locked:o}=n;return(0,K.jsxs)(`fieldset`,{disabled:o,className:`contents`,children:[r===`new`?(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(zh,{id:`${r}-postponed`,checked:i.postponed===!0,onCheckedChange:e=>a({postponed:e})}),(0,K.jsx)(Q,{htmlFor:`${r}-postponed`,children:t(`queue.form.postpone`)}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`queue.list.activeHint`)})]}):null,(0,K.jsx)(Uy,{state:n,fallback:e.autoDeliverDefault}),(0,K.jsx)(Wy,{state:n,fallback:e.deliveryModeDefault}),(0,K.jsx)(Ey,{idPrefix:r,steps:Dy(e.pipelines?.pipelines.find(e=>e.id===i.pipeline)),skip:i.skip,variantSkip:e.pipelines?.pipelines.find(e=>e.id===i.pipeline)?.variants.find(e=>e.id===i.variant)?.skip??[],onChange:e=>a({skip:e})})]})}function Ky(e,t){return t!==``&&!e.includes(t)?[...e,t]:e}function qy({state:e,repository:t,api:n}){let{t:r}=B(),{idPrefix:i,effective:a,change:o,locked:s}=e;return(0,K.jsxs)(`fieldset`,{disabled:s,className:`flex min-w-0 flex-col gap-1.5 border-0 p-0`,children:[(0,K.jsx)(Q,{htmlFor:`${i}-tags`,children:r(`queue.form.tags`)}),(0,K.jsx)(gv,{id:`${i}-tags`,label:r(`queue.form.tags`),selected:a.tags,onChange:e=>o({tags:e}),repository:t,api:n,allowCreate:n!==void 0,hideLinked:!0})]})}var Jy=``,Yy=`h1,h2,h3,h4,h5,h6,ul,ol,li,em,i,s,del,strike,a[href],code,pre,blockquote,table,hr,img`,Xy=/^H([1-6])$/,Zy=new Set([`P`,`DIV`,`SECTION`,`ARTICLE`,`HEADER`,`FOOTER`,`MAIN`,`ASIDE`,`NAV`,`FIGURE`,`FIGCAPTION`,`DETAILS`,`SUMMARY`,`ADDRESS`,`DL`,`DT`,`DD`,`FORM`,`FIELDSET`,`CENTER`]),Qy=new Set([`SCRIPT`,`STYLE`,`TEMPLATE`,`HEAD`,`NOSCRIPT`,`TITLE`,`META`,`LINK`]);function $y(e){return(e.getAttribute(`style`)??``).toLowerCase()}function eb(e){let t=$y(e),n=/font-weight\s*:\s*(bold|bolder|\d+|normal)/.exec(t)?.[1];return e.nodeName===`B`||e.nodeName===`STRONG`?n!==`normal`&&n!==`400`&&n!==`300`:n===void 0?!1:n===`bold`||n===`bolder`||Number(n)>=600}function tb(e){return e.nodeName===`EM`||e.nodeName===`I`||/font-style\s*:\s*italic/.test($y(e))}function nb(e){return[`S`,`DEL`,`STRIKE`].includes(e.nodeName)||/text-decoration[^;]*line-through/.test($y(e))}function rb(e){if(e.body.querySelector(Yy)!==null)return!0;for(let t of Array.from(e.body.querySelectorAll(`*`)))if([`B`,`STRONG`,`SPAN`].includes(t.nodeName)&&eb(t)||t.nodeName===`SPAN`&&(tb(t)||nb(t)))return!0;return!1}function ib(e){return`${Jy}${e}${Jy}`}function ab(e,t){return e.replace(/[ \t\n]*\u0001[\u0001 \t\n]*/g,t?`
|
|
22
|
+
`:`
|
|
23
|
+
|
|
24
|
+
`).replace(/^\n+|\n+$/g,``).replace(/^[ \t]+|[ \t]+$/g,``)}function ob(e){return e.replace(/([\\`*_[\]])/g,`\\$1`)}function sb(e,t){let n=t;for(let t of e.match(/`+/g)??[])n=Math.max(n,t.length+1);return"`".repeat(n)}function cb(e){for(let t of[e,...Array.from(e.querySelectorAll(`code`))]){let e=/(?:^|\s)(?:language|lang)-([\w+#.-]+)/.exec(t.getAttribute(`class`)??``);if(e)return e[1]}return``}function lb(e){let t=e.replace(/[\u0000- ]/g,``);return t===``||/^(javascript|vbscript|data|file):/i.test(t)?null:e.trim().replace(/ /g,`%20`).replace(/\(/g,`%28`).replace(/\)/g,`%29`)}function ub(e){let t=e.trim();return/^(https?:\/\/|data:image\/)/i.test(t)?t.replace(/ /g,`%20`).replace(/\(/g,`%28`).replace(/\)/g,`%29`):null}function db(e,t){if(t.trim()===``)return t;let n=/^\s*/.exec(t)[0],r=/\s*$/.exec(t)[0];return`${n}${e}${t.trim()}${e}${r}`}function fb(e){let t=``;for(let n of Array.from(e.childNodes))t+=bb(n);return t}function pb(e){let t=(e.nodeValue??``).replace(/[ \t\r\n\f\u00a0]+/g,` `),n=e.nextSibling,r=mb(e);r&&(t=t.replace(/^ /,``)),n?.nodeName===`BR`&&(t=t.replace(/ $/,``));let i=ob(t);return r&&(i=i.replace(/^([#>+-])(?= |$)/,`\\$1`).replace(/^(\d+)([.)])(?= |$)/,`$1\\$2`)),i}function mb(e){let t=e;for(;;){let e=t.previousSibling;if(e!==null){if(e.nodeType===3&&(e.nodeValue??``).trim()===``){t=e;continue}return e.nodeName===`BR`||e.nodeType===1&&hb(e)}let n=t.parentNode;if(n===null||n.nodeType!==1)return!0;let r=n;if(r.nodeName===`BODY`||hb(r))return!0;t=r}}function hb(e){return Zy.has(e.nodeName)||Xy.test(e.nodeName)||[`UL`,`OL`,`LI`,`PRE`,`BLOCKQUOTE`,`TABLE`,`HR`].includes(e.nodeName)}function gb(e){let t=e.nodeName===`OL`,n=Number.parseInt(e.getAttribute(`start`)??`1`,10);Number.isFinite(n)||(n=1);let r=[];for(let i of Array.from(e.children)){if(i.nodeName!==`LI`){let e=ab(bb(i),!0);e!==``&&r.push(e);continue}let e=``,a=Array.from(i.children).find(e=>e.nodeName===`INPUT`&&e.getAttribute(`type`)===`checkbox`);a&&(e=a.hasAttribute(`checked`)?`[x] `:`[ ] `);let o=t?`${n}. `:`- `;n+=1;let s=ab(fb(i),!0),c=` `.repeat(o.length),l=`${e}${s}`.split(`
|
|
25
|
+
`).join(`\n${c}`);r.push(`${o}${l}`.replace(/\s+$/,``))}return ib(r.join(`
|
|
26
|
+
`))}function _b(e){return ab(fb(e),!0).replace(/\s*\n\s*/g,` `).replace(/\|/g,`\\|`)}function vb(e){let t=Array.from(e.querySelectorAll(`tr`)).map(e=>Array.from(e.children).filter(e=>e.nodeName===`TD`||e.nodeName===`TH`).map(_b)),n=Math.max(0,...t.map(e=>e.length));if(n===0)return``;let r=e=>`| ${Array.from({length:n},(t,n)=>e[n]??``).join(` | `)} |`,[i,...a]=t,o=[r(i),`| ${Array.from({length:n},()=>`---`).join(` | `)} |`];for(let e of a)o.push(r(e));return ib(o.join(`
|
|
27
|
+
`))}function yb(e){let t=e.nodeName;if(Qy.has(t))return``;let n=Xy.exec(t);if(n){let t=ab(fb(e),!0).replace(/\s*\n\s*/g,` `);return t===``?``:ib(`${`#`.repeat(Number(n[1]))} ${t}`)}switch(t){case`BR`:return`
|
|
28
|
+
`;case`HR`:return ib(`---`);case`UL`:case`OL`:return gb(e);case`TABLE`:return vb(e);case`BLOCKQUOTE`:{let t=ab(fb(e),!1);return t===``?``:ib(t.split(`
|
|
29
|
+
`).map(e=>e===``?`>`:`> ${e}`).join(`
|
|
30
|
+
`))}case`PRE`:{let t=(e.textContent??``).replace(/^\n/,``).replace(/\n$/,``),n=sb(t,3);return ib(`${n}${cb(e)}\n${t}\n${n}`)}case`CODE`:{let t=(e.textContent??``).replace(/\s+/g,` `);if(t.trim()===``)return t;let n=sb(t,1),r=t.startsWith("`")||t.endsWith("`")?` `:``;return`${n}${r}${t}${r}${n}`}case`IMG`:{let t=(e.getAttribute(`alt`)??``).replace(/[[\]]/g,``),n=ub(e.getAttribute(`src`)??``);return n===null?ob(t):``}case`A`:{let t=fb(e),n=lb(e.getAttribute(`href`)??``);return n===null?t:t.trim()===``||t.trim()===n?`<${n}>`:`[${t.trim()}](${n})`}}let r=fb(e);return nb(e)&&(r=db(`~~`,r)),tb(e)&&(r=db(`*`,r)),eb(e)&&(r=db(`**`,r)),hb(e)?ib(r):r}function bb(e){return e.nodeType===3?pb(e):e.nodeType===1?yb(e):``}function xb(e){if(e.trim()===``)return null;let t=new DOMParser().parseFromString(e,`text/html`);if(!rb(t))return null;let n=ab(fb(t.body),!1);return n===``?null:n}var Sb={bold:`**`,italic:`_`,strike:`~~`,code:"`"},Cb=`## `;function wb(e,t,n,r){let i=Math.max(0,Math.min(t,n,e.length)),a=Math.min(e.length,Math.max(t,n));switch(r){case`bold`:case`italic`:case`strike`:case`code`:return Tb(e,i,a,Sb[r]);case`link`:return Db(e,i,a);case`codeBlock`:return Lb(e,i,a);default:return Ib(e,i,a,r)}}function Tb(e,t,n,r){let i=t,a=n;for(;i<a&&/\s/.test(e[i]);)i++;for(;a>i&&/\s/.test(e[a-1]);)a--;i===a&&(i=a=t);let o=e.slice(i,a),s=r.length,c=r==="`";if(c){let t=Eb(e,i,a,o);if(t!==null)return t}if(!c&&i>=s&&e.startsWith(r,i-s)&&e.startsWith(r,a))return{from:i-s,to:a+s,text:o,selectionStart:i-s,selectionEnd:i-s+o.length};if(o.length>2*s&&o.startsWith(r)&&o.endsWith(r)&&(!c||o[s]!=="`"&&o[o.length-s-1]!=="`")){let e=o.slice(s,o.length-s);return{from:i,to:a,text:e,selectionStart:i,selectionEnd:i+e.length}}let l=c?sb(o,1):r,u=c&&(o.startsWith("`")||o.endsWith("`"))?` `:``,d=`${l}${u}${o}${u}${l}`,f=i+l.length+u.length;return{from:i,to:a,text:d,selectionStart:f,selectionEnd:f+o.length}}function Eb(e,t,n,r){for(let i of[0,1]){let a=t-i,o=n+i;if(a<0||i===1&&(e[a]!==` `||e[n]!==` `))continue;let s=0;for(;a-s-1>=0&&e[a-s-1]==="`";)s++;if(s===0)continue;let c="`".repeat(s);if(e.startsWith(c,o)&&e[o+s]!=="`")return{from:a-s,to:o+s,text:r,selectionStart:a-s,selectionEnd:a-s+r.length}}return null}function Db(e,t,n){let r=e.slice(t,n);if(r===``)return{from:t,to:n,text:`[](url)`,selectionStart:t+1,selectionEnd:t+1};let i=t+r.length+3;return{from:t,to:n,text:`[${r}](url)`,selectionStart:i,selectionEnd:i+3}}function Ob(e,t,n){let r=t===0?0:e.lastIndexOf(`
|
|
31
|
+
`,t-1)+1,i=n>t&&e[n-1]===`
|
|
32
|
+
`?n-1:n,a=e.indexOf(`
|
|
33
|
+
`,i);return{from:r,to:a===-1?e.length:a}}var kb=/^(?:([-*+])[ \t]+(\[[ xX]\][ \t]+)?|(\d+[.)])[ \t]+)/,Ab=/^>[ \t]?/,jb=/^#{1,6}[ \t]+/;function Mb(e){let t=kb.exec(e);return t===null?null:{kind:t[3]===void 0?t[2]===void 0?`bullet`:`task`:`numbered`,length:t[0].length}}function Nb(e,t){return t===`heading`?jb.exec(e)?.[0].length??0:t===`quote`?Ab.exec(e)?.[0].length??0:Mb(e)?.length??0}function Pb(e,t){switch(t){case`heading`:return e.startsWith(Cb)&&!e.startsWith(`###`);case`quote`:return Ab.test(e);case`bulletList`:return Mb(e)?.kind===`bullet`;case`taskList`:return Mb(e)?.kind===`task`;default:return Mb(e)?.kind===`numbered`}}function Fb(e,t){switch(e){case`heading`:return Cb;case`quote`:return`> `;case`bulletList`:return`- `;case`taskList`:return`- [ ] `;default:return`${t}. `}}function Ib(e,t,n,r){let i=Ob(e,t,n),a=e.slice(i.from,i.to).split(`
|
|
34
|
+
`),o=a.map(e=>{let t=/^[ \t]*/.exec(e)[0].length;return{indent:t,rest:e.slice(t),blank:e.trim()===``}}),s=o.filter(e=>!e.blank),c=s.length>0?s:o,l=s.length>0&&s.every(e=>Pb(e.rest,r)),u=[],d=[],f=i.from,p=i.from,m=1;o.forEach((e,t)=>{let n=a[t],i=0,o=0,s=n;if(c.includes(e)){i=Nb(e.rest,r);let t=l?``:Fb(r,m++);o=t.length,s=n.slice(0,e.indent)+t+e.rest.slice(i)}u.push({oldStart:f,newStart:p,indent:e.indent,oldPrefix:i,newPrefix:o,oldLength:n.length}),d.push(s),f+=n.length+1,p+=s.length+1});let h=t===n,g=(e,t)=>{let n=u.find(t=>e<=t.oldStart+t.oldLength)??u[u.length-1],r=e-n.oldStart;return r===n.indent&&t?n.newStart+n.indent+n.newPrefix:r<=n.indent?n.newStart+Math.max(r,0):r<n.indent+n.oldPrefix?n.newStart+n.indent+n.newPrefix:n.newStart+r+n.newPrefix-n.oldPrefix};return{from:i.from,to:i.to,text:d.join(`
|
|
35
|
+
`),selectionStart:g(t,h),selectionEnd:g(n,h)}}function Lb(e,t,n){let r=Ob(e,t,n),i=e.slice(r.from,r.to);if(i.trim()===``){let e=r.from+3+1;return{from:r.from,to:r.to,text:"```\n\n```",selectionStart:e,selectionEnd:e}}let a=sb(i,3),o=r.from+a.length+1;return{from:r.from,to:r.to,text:`${a}\n${i}\n${a}`,selectionStart:o,selectionEnd:o+i.length}}function Rb({className:e,...t}){return(0,K.jsx)(yo,{className:S(`flex flex-wrap items-center gap-1`,e),...t})}function zb({className:e,...t}){return(0,K.jsx)(So,{className:S(`inline-flex size-7 shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-md text-xs font-medium text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent [&_svg]:size-4 [&_svg]:shrink-0`,e),...t})}function Bb({className:e,...t}){return(0,K.jsx)(wo,{className:S(`inline-flex w-fit items-center rounded-md border bg-muted p-0.5`,e),...t})}function Vb({className:e,...t}){return(0,K.jsx)(To,{className:S(`inline-flex h-6 items-center gap-1 rounded-[5px] px-2 text-xs font-medium text-muted-foreground data-[state=on]:bg-card data-[state=on]:text-foreground data-[state=on]:shadow-xs`,e),...t})}function Hb({className:e,...t}){return(0,K.jsx)(xo,{className:S(`mx-1 h-5 w-px bg-border`,e),...t})}var Ub=[{action:`heading`,icon:_c},{action:`bold`,icon:jc},{action:`italic`,icon:Tc},{action:`strike`,icon:Ll},{action:`bulletList`,icon:Vc,separated:!0},{action:`numberedList`,icon:d},{action:`taskList`,icon:Fc},{action:`quote`,icon:yl},{action:`code`,icon:qs,separated:!0},{action:`codeBlock`,icon:Gs},{action:`link`,icon:Nc}];function Wb({mode:e,onMode:t,editing:n,preview:r,onPreview:i,onMark:a}){let{t:o}=B(),s=e===`markdown`,c=e=>o(`queue.form.markup.${e}`);return(0,K.jsxs)(Rb,{"aria-label":o(`queue.form.markupToolbar`),children:[(0,K.jsxs)(Bb,{type:`single`,"aria-label":o(`queue.form.markupMode`),value:e,onValueChange:t,children:[(0,K.jsx)(Vb,{value:`plain`,children:o(`queue.form.modePlain`)}),(0,K.jsx)(Vb,{value:`markdown`,children:o(`queue.form.modeMarkdown`)})]}),(0,K.jsx)(Hb,{}),Ub.map(({action:e,icon:t,separated:r})=>(0,K.jsxs)(`span`,{className:`contents`,children:[r?(0,K.jsx)(Hb,{}):null,(0,K.jsx)(zb,{"aria-label":c(e),title:s?c(e):o(`queue.form.markupNeedsMd`,{label:c(e)}),disabled:!n,onClick:()=>a(e),children:(0,K.jsx)(t,{"aria-hidden":!0})})]},e)),(0,K.jsxs)(zb,{className:S(`ml-auto w-auto px-2`,r&&`bg-accent text-foreground`),"aria-pressed":r,title:s?o(`queue.form.preview`):o(`queue.form.markupNeedsMd`,{label:o(`queue.form.preview`)}),disabled:!s,onClick:i,children:[(0,K.jsx)(tc,{"aria-hidden":!0}),o(`queue.form.preview`)]})]})}function Gb(e,t,n,r,i){e.focus(),e.setSelectionRange(t,n),typeof document.execCommand==`function`&&(r===``?document.execCommand(`delete`):document.execCommand(`insertText`,!1,r))||(e.setRangeText(r,t,n,`end`),i(e.value))}function Kb({id:e,"aria-label":t,value:n,onChange:r,rows:i=4,placeholder:a,disabled:o,grow:s=!1}){let[c,l]=(0,H.useState)(`plain`),[u,d]=(0,H.useState)(!1),f=(0,H.useRef)(null),{t:p}=B(),m=c===`markdown`;function h(e){(e===`plain`||e===`markdown`)&&(l(e),e===`plain`&&d(!1))}function g(e){let t=e.clipboardData?.getData(`text/html`)??``;if(t===``)return;let n=xb(t);if(n===null)return;e.preventDefault();let i=e.currentTarget,a=i.selectionStart;Gb(i,a,i.selectionEnd,n,r),i.setSelectionRange(a+n.length,a+n.length)}function _(e){let t=f.current;if(t===null)return;let n=wb(t.value,t.selectionStart,t.selectionEnd,e);Gb(t,n.from,n.to,n.text,r),t.setSelectionRange(n.selectionStart,n.selectionEnd)}let v=`${Math.max(i,2)*1.25+.75}rem`,y=m&&!u&&!o;return(0,K.jsxs)(`div`,{className:S(`flex min-w-0 flex-col gap-2`,s&&`flex-1`),children:[(0,K.jsx)(Wb,{mode:c,onMode:h,editing:y,preview:u,onPreview:()=>d(!u),onMark:_}),(0,K.jsx)(Ih,{ref:f,id:e,"aria-label":t,rows:i,className:s?`flex-1`:void 0,style:s?{minHeight:v}:void 0,value:n,placeholder:a,disabled:o,hidden:u,onPaste:g,onChange:e=>r(e.target.value)}),u?(0,K.jsx)(`div`,{className:`overflow-auto rounded-md border bg-card px-2.5 py-1.5`,style:{minHeight:v},children:n.trim()===``?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:p(`queue.form.previewEmpty`)}):(0,K.jsx)(cg,{text:n})}):null]})}function qb({idPrefix:e,effective:t,change:n,locked:r}){let{t:i}=B(),a=(e,r)=>n({groups:t.groups.map((t,n)=>n===e?{...t,...r}:t)});return(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[t.groups.map((o,s)=>(0,K.jsxs)(`fieldset`,{className:`flex flex-col gap-2 rounded-md border p-2`,children:[(0,K.jsx)(`legend`,{className:`px-1 text-xs text-muted-foreground`,children:i(`queue.form.group`,{n:s+1})}),(0,K.jsx)(Du,{id:`${e}-group-${s}-title`,disabled:r,"aria-label":i(`queue.form.groupTitle`,{n:s+1}),value:o.title,placeholder:i(`queue.form.titlePlaceholder`),onChange:e=>a(s,{title:e.target.value})}),(0,K.jsx)(Kb,{"aria-label":i(`queue.form.groupText`,{n:s+1}),rows:2,value:o.task,placeholder:i(`queue.form.groupTaskPlaceholder`),disabled:r,onChange:e=>a(s,{task:e})}),(0,K.jsx)(L,{variant:`ghost`,size:`sm`,className:`w-fit`,disabled:r||t.groups.length<=1,onClick:()=>n({groups:t.groups.filter((e,t)=>t!==s)}),children:i(`queue.form.removeGroup`,{n:s+1})})]},s)),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`queue.form.groupAlternativeHint`)}),(0,K.jsx)(L,{variant:`outline`,size:`sm`,className:`w-fit`,disabled:r,onClick:()=>n({groups:[...t.groups,{title:``,task:``}]}),children:i(`queue.form.addGroup`)})]})}function Jb({state:e,pipelines:t,options:n}){let{t:r}=B(),{idPrefix:i,effective:a,change:o}=e;return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(Q,{htmlFor:`${i}-pipeline`,children:r(`queue.form.pipeline`)}),(0,K.jsxs)(qg,{value:a.pipeline,onValueChange:e=>o({pipeline:e,variant:`default`,skip:Ty(a.skip,Dy(t?.pipelines.find(t=>t.id===e)).map(e=>e.id))}),disabled:n.length===0,children:[(0,K.jsx)(Yg,{id:`${i}-pipeline`,className:`w-48`,children:(0,K.jsx)(Jg,{placeholder:r(`queue.form.noPipeline`)})}),(0,K.jsx)(Xg,{children:n.map(e=>(0,K.jsx)(Zg,{value:e,children:t?.pipelines.find(t=>t.id===e)?.name??e},e))})]}),e.several?null:(0,K.jsxs)(_e,{type:`single`,"aria-label":r(`queue.form.kind`),value:a.mode,onValueChange:e=>e&&o({mode:e}),children:[(0,K.jsx)(Ce,{value:`task`,children:r(`queue.form.task`)}),(0,K.jsx)(Ce,{value:`groups`,children:r(`queue.form.groups`)})]})]})}function Yb({state:e,pipelines:t}){let{t:n}=B(),{idPrefix:r,effective:i,change:a}=e,o=t?.pipelines.find(e=>e.id===i.pipeline)?.variants??[];return o.length<=1?null:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(Q,{htmlFor:`${r}-variant`,children:n(`queue.form.variant`)}),(0,K.jsxs)(qg,{value:i.variant,onValueChange:e=>a({variant:e}),children:[(0,K.jsx)(Yg,{id:`${r}-variant`,className:`w-48`,children:(0,K.jsx)(Jg,{})}),(0,K.jsx)(Xg,{children:o.map(e=>(0,K.jsx)(Zg,{value:e.id,children:e.name},e.id))})]})]})}function Xb(e){let{t}=B(),{state:n}=e,{idPrefix:r,effective:i,change:a,locked:o}=n;return(0,K.jsxs)(`div`,{className:S(`flex min-w-0 flex-col gap-3`,e.fill&&`flex-1`),children:[(0,K.jsxs)(`fieldset`,{disabled:o,className:`flex min-w-0 flex-col gap-3 border-0 p-0`,children:[e.repositoryField?(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,K.jsx)(Q,{htmlFor:`${r}-repository`,children:t(`queue.form.repository`)}),e.repositoryField]}):null,(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,K.jsx)(Q,{htmlFor:`${r}-title`,children:t(`queue.form.name`)}),(0,K.jsx)(Du,{id:`${r}-title`,value:i.title,maxLength:60,placeholder:t(`queue.form.namePlaceholder`),onChange:e=>a({title:e.target.value})})]}),(0,K.jsx)(Jb,{state:n,pipelines:e.pipelines,options:e.options})]}),(0,K.jsx)(Yb,{state:n,pipelines:e.pipelines}),i.mode===`task`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`queue.form.alternativeHint`)}),(0,K.jsx)(Kb,{id:`${r}-task`,"aria-label":t(`queue.form.taskText`),rows:9,grow:e.fill,value:i.task,placeholder:t(`queue.form.taskPlaceholder`),disabled:o,onChange:e=>a({task:e})})]}):(0,K.jsx)(qb,{...n}),e.extras]})}function Zb({disabled:e,hint:t,label:n,onContinue:r,onCancel:i}){let{t:a}=B();return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(L,{type:`submit`,disabled:e,title:t,children:n}),r?(0,K.jsx)(L,{type:`button`,variant:`outline`,disabled:e,onClick:r,children:a(`queue.addAndContinue`)}):null,i?(0,K.jsx)(L,{variant:`ghost`,onClick:i,children:a(`queue.form.cancel`)}):null,t?(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t}):null]})}function Qb(e,t,n,r,i,a,o){let[s,c]=(0,H.useState)(null),[l,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(0),p=g();(0,H.useEffect)(()=>{if(d===0)return;if(n===`new`){Hy(e.mode);return}let t=e.mode===`groups`?`group-0-title`:`task`;document.getElementById(`${n}-${t}`)?.focus()},[d]);let m=async s=>{if(My(e)&&!l){u(!0),c(null);try{let c=Iy(e,e=>{let n=p.byId.get(e);return n&&n.repository===t&&!n.task?n.name:void 0},n!==`new`,o);s&&i?(await i(c),a(ky(e)),f(e=>e+1)):await r(c)}catch(e){c(e.message)}finally{u(!1)}}};return{submit:()=>m(!1),submitAndContinue:i?()=>m(!0):void 0,busy:l,error:s}}function $b(e){let{state:t,pipelines:n,repository:r,api:i}=e,{t:a}=B();return(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[t.several?e.projectsPanel:null,(0,K.jsx)(i_,{value:t.effective.links,choices:e.linkChoices,editableKinds:t.locked||t.several?[`blocked_by`]:void 0,onChange:e=>t.change({links:e,linksTouched:!0})}),e.returnedRun&&t.effective.links.some(e=>e.kind!==`blocked_by`)?(0,K.jsx)(`a`,{className:`text-sm text-primary underline`,href:M({view:`runs`,run:e.returnedRun,group:null,step:null,tab:null}),children:a(`links.editRun`)}):null,t.several?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(qy,{state:t,repository:r,api:i}),i?(0,K.jsx)(Vy,{state:t,api:i}):null]}),(0,K.jsx)(Gy,{state:t,pipelines:n,autoDeliverDefault:e.autoDeliverDefault,deliveryModeDefault:e.deliveryModeDefault})]})}function ex({valid:e,blocked:t,blockedHint:n,sent:r,submitLabel:i,onCancel:a}){return(0,K.jsx)(Zb,{disabled:!e||r.busy||t,hint:n,label:i,onContinue:r.submitAndContinue?()=>void(!t&&r.submitAndContinue?.()):void 0,onCancel:a})}function tx({idPrefix:e,draft:t,pipelines:n,repository:r,api:i,autoDeliverDefault:a=null,deliveryModeDefault:o=null,linkChoices:s=()=>[],locked:c=!1,returnedRun:l=null,repositoryField:u,several:d=!1,extras:f,projectsPanel:p,blockedHint:m,pending:h=!1,submitLabel:g,onDraft:_,onSubmit:v,onSubmitAndContinue:y,onCancel:b,fill:x=!1}){let{t:C}=B(),w=n?.pipelines.map(e=>e.id)??[],T=t.pipeline===``&&w[0]?{...t,pipeline:w[0]}:t,E=e=>_({...T,...e}),ee=My(T),D={idPrefix:e,effective:T,change:E,locked:c,several:d},te=Qb(T,r,e,v,y,_,c),O=Ky(w,T.pipeline),k=h||m!==void 0;return(0,K.jsxs)(`form`,{className:S(`@container flex flex-col gap-3 rounded-lg border bg-card p-3`,x&&`flex-1`),onSubmit:e=>{e.preventDefault(),!k&&te.submit()},children:[(0,K.jsxs)(`div`,{className:S(`grid gap-4 @3xl:grid-cols-2`,x&&`flex-1`),children:[(0,K.jsx)(Xb,{state:D,pipelines:n,options:O,repositoryField:u,extras:f,fill:x}),(0,K.jsx)($b,{state:D,pipelines:n,repository:r,api:i,linkChoices:s,returnedRun:l,autoDeliverDefault:a,deliveryModeDefault:o,projectsPanel:p})]}),(0,K.jsx)(ex,{valid:ee,blocked:k,blockedHint:m,sent:te,submitLabel:g,onCancel:b}),te.error?(0,K.jsx)(N,{variant:`destructive`,children:te.error}):null]})}function nx(e,t,n,r,i){let a=(0,H.useRef)(!1),o=(0,H.useRef)({selected:t,preset:n,reset:i});o.current={selected:t,preset:n,reset:i},(0,H.useEffect)(()=>{e&&!a.current&&(r(o.current.preset?.repository??o.current.selected),o.current.reset()),a.current=e},[e,r])}function rx(e){let{open:t,preset:n,target:r,draft:i,draftTarget:a,pipelines:o,onDraft:s,onPresetApplied:c}=e;(0,H.useEffect)(()=>{if(!t||!n||r!==n.repository||i&&a!==r||!o)return;let e=i??Oy(o.pipelines[0]?.id);s(n.parent===null?{...e,repository:r}:{...e,repository:r,links:[...e.links.filter(e=>e.kind!==`parent`),{kind:`parent`,target:n.parent}],linksTouched:!0}),c()},[t,n,r,i,a,o,s,c])}function ix(e){let{max:t,filter:n,...r}=e;return{...r,scope:`project`,repository:``,autoDeliver:null,deliveryMode:null,filter:{pipelines:n.pipelines,tags:n.tags},filterTags:[]}}function ax(e,t){return{...ix(e),repository:t,items:e.items.filter(e=>e.repository===t),runs:e.runs.filter(e=>e.repository===t),skipped:e.skipped.filter(e=>e.repository===t)}}function ox(e,t){return[...e.items,...e.runs,...e.skipped].find(e=>e.id===t)?.repository??``}function sx(e,t,n,r){let i=e=>ox(t,e.id);return{apiOf:t=>e.forRepository(i(t)),queueOf:e=>ax(t,i(e)),pipelinesOf:e=>n.get(i(e))??null,runs:r,projectOf:i}}function cx(e,t,n){return(0,H.useMemo)(()=>t===null?e:new Map(n.map(e=>[e,ax(t,e)])),[e,t,n])}function lx(e,t,n){(0,H.useEffect)(()=>{if(t)return;let r=!1;return e.queue().then(e=>{r||n(e)}).catch(()=>void 0),()=>{r=!0}},[e,t,n])}var ux=30;function dx(e){let t=e.replace(/\s+/g,` `).trim(),n=[...t];if(n.length<=ux)return t;let r=n.slice(0,ux).join(``);if(n[ux]===` `)return r.trimEnd();let i=r.lastIndexOf(` `);return(i>0?r.slice(0,i):r).trimEnd()}function fx(e){let t=e.filter(e=>e!==void 0),[n]=t;if(n===void 0||t.length<e.length)return null;let r=n.pipelines.flatMap(e=>{let n=t.slice(1).map(t=>t.pipelines.find(t=>t.id===e.id));if(n.some(e=>e===void 0))return[];let r=n.flatMap(e=>e??[]),i=(e,t)=>e.filter(e=>r.every(n=>t(n).some(t=>t.id===e.id)));return[{...e,variants:i(e.variants,e=>e.variants),steps:i(e.steps,e=>e.steps)}]});return{...n,pipelines:r}}function px(e,t){let n=Object.fromEntries(t.projects.flatMap(e=>{let n=(t.notes[e]??``).trim();return n===``?[]:[[e,n]]})),r=t.tag.trim();return{repositories:t.projects,pipeline:e.pipeline,task:e.task??``,...e.variant===void 0?{}:{variant:e.variant},...e.title===void 0?{}:{title:e.title},...e.postponed?{postponed:!0}:{},...e.autoDeliver===void 0?{}:{autoDeliver:e.autoDeliver},...e.deliveryMode===void 0?{}:{deliveryMode:e.deliveryMode},...e.skip!==void 0&&e.skip.length>0?{skip:e.skip}:{},...(e.links??[]).some(e=>e.kind===`blocked_by`)?{after:(e.links??[]).filter(e=>e.kind===`blocked_by`).map(e=>String(e.target))}:{},...Object.keys(n).length>0?{notes:n}:{},...r===``?{}:{tag:r},...t.chain?{chain:!0}:{}}}function mx(e){return e?.steps.map(e=>e.id)??[]}function hx(e,t){let[n,r]=(0,H.useState)(new Map),i=(0,H.useRef)(new Set),a=t.join(`
|
|
36
|
+
`);return(0,H.useEffect)(()=>{for(let n of t)i.current.has(n)||(i.current.add(n),e.pipelines(n).then(e=>r(t=>new Map(t).set(n,e))).catch(()=>i.current.delete(n)))},[e,a]),n}function gx(e){let{open:t,draft:n,draftTarget:r,target:i,pipelines:a,clearTags:o,onDraft:s}=e;(0,H.useEffect)(()=>{if(!t||!n||!a||r===i)return;let e=e=>a.pipelines.find(t=>t.id===e);s({...jy(n,a.pipelines.map(e=>e.id),t=>mx(e(t)),t=>e(t)?.variants.map(e=>e.id)??[]),...o?{tags:[]}:{},repository:i})},[t,n,a,r,i,o,s])}function _x(e){let{target:t,setTarget:n,mode:r,onMode:i}=e,[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)([]),[l,u]=(0,H.useState)({}),[d,f]=(0,H.useState)(null),[p,m]=(0,H.useState)(!1);return{on:a,projects:s,notes:l,tag:d,chain:p,choose:e=>{c(e),e[0]!==void 0&&e[0]!==t&&n(e[0])},toggle:e=>{o(e),e?(c([t]),r===`groups`&&i()):c([])},setNote:(e,t)=>u(n=>({...n,[e]:t})),setTag:f,setChain:m,reset:()=>{o(!1),c([]),u({}),f(null),m(!1)},clearText:()=>{u({}),f(null)}}}function vx(e){let{draft:t,common:n,onDraft:r}=e;(0,H.useEffect)(()=>{if(!t||!n||t.pipeline===``)return;let e=n.pipelines.find(e=>e.id===t.pipeline);if(e===void 0){r({...t,pipeline:n.pipelines[0]?.id??``,variant:`default`,skip:[]});return}let i=e.steps.map(e=>e.id),a=e.variants.some(e=>e.id===t.variant)?t.variant:`default`,o=t.skip.filter(e=>i.includes(e));(a!==t.variant||o.length!==t.skip.length)&&r({...t,variant:a,skip:o})},[t,n,r])}function yx(e){let{t}=B(),{api:n,scoped:r,multi:i,sharedTag:a,target:o,onQueue:s}=e,c=async e=>{if(i.on){let r=await n.queueAddProjects(px(e,{projects:i.projects,notes:i.notes,tag:a,chain:i.chain}));V(t(`queue.multi.created`,{count:r.length}));return}let o=await r.queueAdd(e);s(o);let c=o.items.find(e=>e.id===o.item)?.number;V(c===void 0?t(`queue.createdNoNumber`):t(`queue.created`,{number:vf(c)}))};return{submit:async t=>{await c(t),e.onDraft({...Oy(t.pipeline),repository:o}),i.reset(),e.onOpenChange(!1)},submitAndContinue:async e=>{await c(e),i.clearText()}}}function bx(e){let{api:t,selected:n,open:r,draft:i,onDraft:a,onQueue:o}=e,{preset:s=null,onPresetApplied:c=()=>void 0,globalQueue:l=null}=e,u=cx(e.queues,l,e.repositories),[d,f]=(0,H.useState)(s?.repository??n),p=(0,H.useMemo)(()=>t.forRepository(d),[t,d]),m=i??Oy(),h=_x({target:d,setTarget:f,mode:m.mode,onMode:()=>a({...m,mode:`task`,repository:m.repository??d})}),g=hx(t,h.on?h.projects:[d]),_=g.get(d)??null,v=h.on?fx(h.projects.map(e=>g.get(e))):null,y=h.on?v:_;vx({draft:h.on?i:void 0,common:v,onDraft:a});let b=u.get(d),x=(0,H.useRef)(`task`);x.current=m.mode,nx(r,n,s,f,h.reset),lx(p,b!==void 0||l!==null,o);let S=i?i.repository??n:null;gx({open:r,draft:i,draftTarget:S,target:d,pipelines:_,onDraft:a,clearTags:s?.parent!=null&&s.repository===d}),rx({open:r,preset:s,target:d,draft:i,draftTarget:S,pipelines:_,onDraft:a,onPresetApplied:c});let C=h.tag??dx(m.title),{submit:w,submitAndContinue:T}=yx({api:t,scoped:p,multi:h,sharedTag:C,target:d,onQueue:o,onDraft:a,onOpenChange:e.onOpenChange});return{submit:w,submitAndContinue:T,target:d,setTarget:f,scoped:p,pipelines:y,queue:b,queues:u,current:m,mode:x,draftTarget:S,multi:{...h,sharedTag:C,noCommon:h.on&&v!==null&&v.pipelines.length===0}}}function xx(e,t,n){if(n<0||n>=e.length||t===n)return[...e];let r=[...e],[i]=r.splice(t,1);return r.splice(n,0,i),r}function Sx({index:e,label:t,multi:n}){let{t:r}=B(),{projects:i,choose:a}=n;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(L,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":r(`queue.multi.moveUp`,{project:t}),disabled:e===0,onClick:()=>a(xx(i,e,e-1)),children:(0,K.jsx)(hs,{})}),(0,K.jsx)(L,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":r(`queue.multi.moveDown`,{project:t}),disabled:e===i.length-1,onClick:()=>a(xx(i,e,e+1)),children:(0,K.jsx)(ds,{})}),(0,K.jsx)(L,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":r(`queue.multi.remove`,{project:t}),disabled:i.length<=1,onClick:()=>a(i.filter((t,n)=>n!==e)),children:(0,K.jsx)(Zl,{})})]})}function Cx({idPrefix:e,index:t,multi:n,waitsFor:r,onDragStart:i,onDrop:a}){let{t:o}=B(),{projects:s}=n,c=s[t],l=F(c);return(0,K.jsxs)(`li`,{className:`flex min-w-0 list-none flex-col gap-1`,onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),a()},children:[r?(0,K.jsx)(`p`,{className:`px-2 text-xs text-muted-foreground`,children:r}):null,(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 rounded-md border bg-card p-2 text-sm`,children:[(0,K.jsxs)(`div`,{draggable:!0,title:o(`queue.multi.drag`,{project:l}),className:`flex items-center gap-2`,onDragStart:i,children:[(0,K.jsx)(hc,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,K.jsx)(`span`,{className:`w-4 text-right tabular-nums text-muted-foreground`,children:t+1}),(0,K.jsx)(it,{path:c}),(0,K.jsx)(`span`,{className:`flex-1 truncate`,title:c,children:l}),(0,K.jsx)(Sx,{index:t,label:l,multi:n})]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,K.jsx)(Q,{htmlFor:`${e}-note-${t}`,children:o(`queue.multi.note`,{project:l})}),(0,K.jsx)(Du,{id:`${e}-note-${t}`,value:n.notes[c]??``,placeholder:o(`queue.multi.notePlaceholder`),onChange:e=>n.setNote(c,e.target.value)})]})]})]})}function wx({idPrefix:e,multi:t}){let{t:n}=B(),[r,i]=(0,H.useState)(null),{projects:a,choose:o,chain:s}=t;return(0,K.jsx)(`ol`,{"aria-label":n(`queue.multi.order`),className:`flex flex-col gap-1`,children:a.map((c,l)=>(0,K.jsx)(Cx,{idPrefix:e,index:l,multi:t,waitsFor:s&&l>0?n(`queue.multi.waitsFor`,{next:F(c),previous:F(a[l-1])}):void 0,onDragStart:()=>i(l),onDrop:()=>{r!==null&&o(xx(a,r,l)),i(null)}},c))})}function Tx({idPrefix:e,repositories:t,waiting:n,multi:r}){let{t:i}=B(),a=t.filter(e=>!r.projects.includes(e));return(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:r.projects.length<2?i(`queue.multi.needMore`):i(`queue.multi.summary`,{count:r.projects.length})}),r.noCommon?(0,K.jsx)(N,{variant:`destructive`,children:i(`queue.multi.noCommon`)}):null,(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(zh,{id:`${e}-chain`,checked:r.chain,onCheckedChange:r.setChain}),(0,K.jsx)(Q,{htmlFor:`${e}-chain`,children:i(`queue.multi.chain`)}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i(`queue.multi.chainHint`)})]}),(0,K.jsx)(wx,{idPrefix:e,multi:r}),a.length>0?(0,K.jsx)(Bd,{id:`${e}-add-project`,label:i(`queue.multi.add`),placeholder:i(`queue.multi.addPlaceholder`),repositories:a,value:``,waiting:n,onChange:e=>r.choose([...r.projects,e])}):null]})}function Ex({multi:e}){let{t}=B();return(0,K.jsxs)(L,{type:`button`,variant:e.on?`secondary`:`outline`,size:`sm`,"aria-pressed":e.on,onClick:()=>e.toggle(!e.on),children:[(0,K.jsx)(kc,{"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`max-sm:sr-only`,children:t(`queue.multi.toggle`)})]})}function Dx({idPrefix:e,multi:t}){let{t:n}=B();return(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,K.jsx)(Q,{htmlFor:`${e}-shared-tag`,children:n(`queue.multi.tag`)}),(0,K.jsx)(Du,{id:`${e}-shared-tag`,value:t.sharedTag,maxLength:30,onChange:e=>t.setTag(e.target.value)}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`queue.multi.tagHint`)})]})}function Ox(e){let{multi:t}=e;return{repositoryField:t.on?void 0:(0,K.jsx)(Bd,{id:`new-repository`,label:e.repositoryLabel,repositories:e.repositories,value:e.target,waiting:e.waiting,onChange:e.onTarget}),several:t.on,extras:t.on?(0,K.jsx)(Dx,{idPrefix:`new`,multi:t}):void 0,projectsPanel:t.on?(0,K.jsx)(Tx,{idPrefix:`new`,repositories:e.repositories,waiting:e.waiting,multi:t}):void 0,blockedHint:t.on&&t.projects.length<2?e.needMore:void 0}}function kx(e,t){return t(`queue.list.groups`,{count:e})}function Ax(e,t){return e.title?e.title:e.groups?kx(e.groups.length,t):(e.task??``).split(`
|
|
37
|
+
`).find(e=>e.trim()!==``)?.trim()??``}function jx(e,t,n){if(e.runs.length<e.parallel)return;let r=e.freezeCandidate?e.runs.find(t=>t.id===e.freezeCandidate):void 0;return r&&t.hold!==`frozen`?n(`queue.list.runNowFreeze`,{number:vf(r.number)}):n(`queue.list.runNowOverflow`,{taken:e.runs.length+1,count:e.parallel})}var Mx=(0,H.createContext)({others:[]}),Nx=()=>(0,H.useContext)(Mx);function Px(e,t){let n=e.items.find(e=>e.id===t),r=new Set(n?.linkedBy.filter(e=>e.kind===`blocked_by`).map(e=>e.id)??[]);return e.items.filter(e=>r.has(e.id))}function Fx(e,t){let n=new Set([t]),r=new Map,i=(e,t)=>{r.has(e)||r.set(e,new Set),r.has(t)||r.set(t,new Set),r.get(e).add(t),r.get(t).add(e)};for(let t of e.items){for(let e of t.after)i(t.id,e.id);for(let e of[...t.links,...t.linkedBy])(e.kind===`blocked_by`||e.kind===`parent`)&&i(t.id,e.id)}let a=[t];for(;a.length>0;)for(let e of r.get(a.pop())??[])n.has(e)||(n.add(e),a.push(e));return n}function Ix(e,t){let n=new Map(e.items.map(e=>[e.id,e])),r=(e,t)=>{let i=n.get(e);if(!i||t.has(e))return 0;let a=new Set(t).add(e),o=0;for(let e of i.after)e.kind===`item`&&n.has(e.id)&&(o=Math.max(o,1+r(e.id,a)));return Math.min(o,3)};return r(t,new Set)}function Lx(e){return e.after.filter(e=>e.state!==`done`)}function Rx(e,t,n){return t.filter(e=>e!==n).flatMap(t=>e.get(t)??[])}function zx({multi:e,onExpand:t,target:n}){let{t:r}=B();return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(Dd,{className:`min-w-0`,children:r(e.on?`queue.multi.title`:`queue.newTask`)}),(0,K.jsxs)(`div`,{className:`mr-8 flex items-center gap-2`,children:[(0,K.jsx)(Ex,{multi:e}),t?(0,K.jsxs)(as,{children:[(0,K.jsx)(os,{asChild:!0,children:(0,K.jsx)(L,{variant:`ghost`,size:`icon`,"aria-label":r(`queue.page.expand`),onClick:()=>t?.(n),children:(0,K.jsx)(Uc,{})})}),(0,K.jsx)(ss,{children:r(`queue.page.expand`)})]}):null]})]})}function Bx(e){let{t}=B(),{open:n,onOpenChange:r,repositories:i,waiting:a,draft:o,onDraft:s}=e,c=bx(e),{target:l,setTarget:u,scoped:d,pipelines:f,queue:p,current:m,mode:h,draftTarget:g}=c;return(0,K.jsx)(Cd,{open:n,onOpenChange:r,children:(0,K.jsxs)(wd,{className:`max-h-[calc(100dvh-2rem)] max-w-none content-start md:max-h-[90vh] md:w-[75vw]`,"aria-describedby":void 0,onOpenAutoFocus:e=>{e.preventDefault(),Hy(h.current)},children:[(0,K.jsx)(zx,{multi:c.multi,onExpand:e.onExpand,target:l}),(0,K.jsx)(tx,{idPrefix:`new`,draft:m,pipelines:f,repository:l,api:d,autoDeliverDefault:p?.autoDeliver??null,deliveryModeDefault:p?.deliveryMode??null,linkChoices:n=>p?wy(n,p,e.runs??[],e=>Ax(e,t),void 0,Rx(c.queues,e.repositories,l)):[],pending:f===null||p===void 0||o!==void 0&&g!==l,...Ox({multi:c.multi,repositories:i,waiting:a,target:l,onTarget:u,needMore:t(`queue.multi.needMore`),repositoryLabel:t(`queue.form.repository`)}),submitLabel:t(`queue.add`),onDraft:e=>s({...e,repository:e.repository??l}),onSubmit:c.submit,onSubmitAndContinue:c.submitAndContinue})]})})}function Vx(e,t,n,r){return{apiOf:()=>e,queueOf:()=>t,pipelinesOf:()=>n,runs:r}}function Hx({repository:e}){let t=ue(e);return(0,K.jsxs)(`span`,{"data-project":e,title:e,className:`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-xs`,children:[t?(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 rounded-full`,style:{backgroundColor:t}}):null,F(e)]})}var Ux={done:js,waiting:Us,blocked:_s},Wx={done:`ok`,waiting:`warn`,blocked:`err`};function Gx({item:e,pipelines:t}){let{t:n}=B();if(!e.skip||e.skip.length===0)return null;let r=t?.pipelines.find(t=>t.id===e.pipeline)?.steps,i=e.skip.map(e=>({id:e,name:r?.find(t=>t.id===e)?.name??e})),a=i.map(e=>e.name);return(0,K.jsxs)(as,{children:[(0,K.jsx)(os,{asChild:!0,children:(0,K.jsx)(`span`,{className:`inline-flex cursor-help rounded-sm text-status-warn focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,tabIndex:0,role:`img`,"aria-label":n(`queue.list.skips`,{steps:a.join(`, `)}),children:(0,K.jsx)(Vl,{className:`size-4`,"aria-hidden":!0})})}),(0,K.jsxs)(ss,{className:`px-3 py-2`,children:[(0,K.jsx)(`p`,{className:`font-medium`,children:n(`queue.list.skipsTitle`)}),(0,K.jsx)(`ul`,{className:`mt-1 list-disc pl-4`,children:i.map(({id:e,name:t})=>(0,K.jsx)(`li`,{children:t},e))})]})]})}function Kx(e){let t=e===`ready`?`done`:e;return{Icon:Ux[t],tone:Wx[t]}}function qx({label:e,hint:t,pressed:n,className:r,onClick:i,children:a}){return(0,K.jsxs)(as,{children:[(0,K.jsx)(os,{asChild:!0,children:(0,K.jsx)(L,{variant:`ghost`,size:`icon`,className:r,"aria-label":e,"aria-description":t,"aria-pressed":n,onClick:i,children:a})}),(0,K.jsxs)(ss,{children:[(0,K.jsx)(`p`,{children:e}),t?(0,K.jsx)(`p`,{className:`opacity-80`,children:t}):null]})]})}function Jx({item:e}){let{t}=B(),{Icon:n,tone:r}=Kx(e.readiness),i=t(`queue.readiness.${e.readiness}`),a=Lx(e).map(e=>e.title||e.id).join(`, `),o=a===``?e.readiness===`ready`?`${i} (${e.readiness}): ${t(`queue.list.readyHint`)}`:`${i} (${e.readiness})`:`${i} (${e.readiness}): ${a}`;return(0,K.jsxs)(R,{variant:r,title:o,"aria-label":o,"data-readiness":e.readiness,children:[(0,K.jsx)(n,{"aria-hidden":!0}),i]})}function Yx({item:e,queue:t,editing:n,postponed:r,actions:i,onDraft:a}){let{t:o}=B();return(0,K.jsxs)(`span`,{className:`ml-auto flex shrink-0 gap-1`,"data-actions":``,children:[(0,K.jsx)(qx,{label:o(n?`queue.list.cancel`:`queue.list.edit`),onClick:()=>a(`edit:${e.id}`,n?null:Ay(e)),children:n?(0,K.jsx)(Gl,{}):(0,K.jsx)(tc,{})}),(0,K.jsx)(qx,{label:o(`queue.list.postpone`),hint:o(`queue.list.activeHint`),pressed:r,className:S(`text-status-run hover:text-status-run`,r&&`bg-status-run-bg`),onClick:()=>void i.setPostponed(e,!r),children:(0,K.jsx)(Fs,{})}),(0,K.jsx)(qx,{label:e.hold===null?o(`queue.list.runNow`):o(`queue.list.continue`),hint:jx(t,e,o),className:`text-status-ok hover:text-status-ok`,onClick:()=>void i.runNow(e),children:(0,K.jsx)(hl,{})}),(0,K.jsx)(qx,{label:o(`queue.list.remove`),className:`text-status-err hover:text-status-err`,onClick:()=>void i.remove(e),children:(0,K.jsx)(Zl,{})})]})}function Xx({item:e,postponed:t,linked:n}){let{t:r}=B();return(0,K.jsxs)(K.Fragment,{children:[e.hold===null?null:(0,K.jsx)(R,{variant:`warn`,children:e.hold===`paused`?r(`queue.list.paused`):r(`queue.list.frozen`)}),e.run===null?null:(0,K.jsx)(`a`,{className:`rounded bg-muted px-1.5 py-0.5 text-xs text-primary underline`,title:r(`queue.returnOf`,{run:e.run}),href:M({view:`runs`,run:e.run,group:null,step:null,tab:null}),children:e.hold===`paused`?r(`queue.onPause`):r(`queue.returning`)}),t?(0,K.jsx)(R,{variant:`warn`,title:r(`queue.list.activeHint`),children:r(`queue.list.postponed`)}):null,e.filtered?(0,K.jsx)(R,{variant:`mute`,title:r(`queue.filter.filteredHint`),children:r(`queue.filter.filtered`)}):null,(0,K.jsx)(Jx,{item:e}),n?(0,K.jsx)(`span`,{className:`sr-only`,children:r(`queue.list.linked`)}):null]})}function Zx({item:e,pipelines:t,now:n}){let{t:r}=B(),i=up();return(0,K.jsxs)(K.Fragment,{children:[e.autoDeliver===null?null:(0,K.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground`,children:e.autoDeliver?r(`queue.list.autoDelivery`):r(`queue.list.manualDelivery`)}),e.deliveryMode===null||e.deliveryMode===void 0?null:(0,K.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground`,children:r(`queue.list.deliveryMode`,{mode:r(`deliveryMode.${e.deliveryMode}`)})}),e.attachments.length>0?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground`,title:r(`attachments.count`,{count:e.attachments.length}),"data-attachments":e.attachments.length,children:[(0,K.jsx)(dl,{className:`size-3`,"aria-hidden":!0}),e.attachments.length]}):null,(0,K.jsx)(Gx,{item:e,pipelines:t}),e.title&&e.groups?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:kx(e.groups.length,r)}):null,(0,K.jsx)(`time`,{className:`text-xs text-muted-foreground tabular-nums`,dateTime:new Date(e.createdAt).toISOString(),title:r(`queue.list.addedAt`,{when:new Date(e.createdAt).toLocaleString(i,{dateStyle:`medium`,timeStyle:`short`})}),children:Tf(e.createdAt,n,i)})]})}function Qx({scope:e,item:t,editing:n,actions:r,onDraft:i}){let{t:a}=B(),{others:o}=Nx(),[s]=(0,H.useState)(()=>({...t,links:t.links.map(e=>({...e}))})),c=e.queueOf(t);return(0,K.jsx)(tx,{idPrefix:`edit-${t.id}`,draft:n,pipelines:e.pipelinesOf(t),repository:c.repository,api:e.apiOf(t),autoDeliverDefault:c.autoDeliver,deliveryModeDefault:c.deliveryMode,linkChoices:t=>wy(t,c,e.runs,e=>Ax(e,a),s,o.filter(e=>e.repository!==c.repository)),locked:t.run!==null,returnedRun:t.run,submitLabel:a(`queue.list.save`),onDraft:e=>i(`edit:${t.id}`,e),onCancel:()=>i(`edit:${t.id}`,null),onSubmit:e=>r.edit(t,e)})}function $x({scope:e,item:t,editing:n,actions:r,onDraft:i}){let{t:a}=B(),{started:o}=r,{openProject:s}=Nx(),c=e.queueOf(t);return(0,K.jsxs)(K.Fragment,{children:[t.links.length>0||t.linkedBy.length>0?(0,K.jsx)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-1.5 pl-[3.25rem] text-xs`,"data-dependencies":``,children:(0,K.jsx)(Bv,{links:t.links,linkedBy:t.linkedBy,repository:c.repository,onProject:s})}):null,t.error?(0,K.jsx)(N,{variant:`destructive`,className:`mt-2`,children:a(`queue.list.startFailed`,{error:t.error})}):null,o?.item===t.id?(0,K.jsxs)(`p`,{className:`mt-2 text-sm`,children:[a(`queue.list.startedRun`),` `,(0,K.jsx)(`a`,{className:`text-primary underline`,href:M({view:`runs`,run:o.runId,group:null,step:null,tab:null}),children:a(`queue.list.run`,{id:o.runId})})]}):null,n?(0,K.jsx)(Qx,{scope:e,item:t,editing:n,actions:r,onDraft:i}):null]})}function eS(e){let{t}=B(),{item:n,index:r,queue:i,scope:a,drag:o,editing:s,onHighlight:c}=e,l=Ix(i,n.id),u=e.actions.pending[n.id]??n.postponed===!0,d=o.dragging===null&&e.highlighted;return(0,K.jsxs)(`li`,{className:S(`rounded-lg border bg-card p-2.5`,l>0&&`border-l-4 border-l-primary/50`,n.readiness===`blocked`&&`border-destructive`,d&&`ring-2 ring-primary`,o.dragging===n.id&&`opacity-50`,(u||n.filtered)&&`opacity-60`,o.drop?.index===r&&(o.drop.after?`border-b-2 border-b-primary`:`border-t-2 border-t-primary`)),"data-id":n.id,"data-depth":l,"data-highlighted":d?``:void 0,style:l>0?{marginLeft:`${l*1.25}rem`}:void 0,tabIndex:0,onMouseEnter:()=>o.dragging===null&&c(n.id),onMouseLeave:()=>c(null),onFocus:()=>o.dragging===null&&c(n.id),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||c(null)},draggable:!s,"aria-label":`${r+1}. ${Ax(n,t)}`,onDragStart:e=>{e.dataTransfer.setData(`text/plain`,n.id),e.dataTransfer.effectAllowed=`move`,c(null),o.setDragging(n.id)},onDragOver:e=>o.onDragOver(e,r),onDrop:e=>o.onDrop(e,r),onDragEnd:o.onDragEnd,onKeyDown:e=>o.onKeyDown(e,n,r),children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,K.jsx)(hc,{className:`size-4 cursor-grab text-muted-foreground`,"aria-hidden":`true`,children:(0,K.jsx)(`title`,{children:t(`queue.list.drag`)})}),(0,K.jsx)(`span`,{className:`w-5 text-muted-foreground tabular-nums`,children:r+1}),a.projectOf?(0,K.jsx)(Hx,{repository:a.projectOf(n)}):null,(0,K.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:vf(n.number)}),(0,K.jsx)(Im,{id:n.pipeline,name:n.pipelineName}),(0,K.jsx)(Lm,{id:n.variant,name:n.variantName}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:Ax(n,t),children:Ax(n,t)}),(0,K.jsx)(h,{tags:n.tags??[]}),(0,K.jsx)(Xx,{item:n,postponed:u,linked:d}),(0,K.jsx)(Zx,{item:n,pipelines:a.pipelinesOf(n),now:e.now}),(0,K.jsx)(Yx,{item:n,queue:a.queueOf(n),editing:s,postponed:u,actions:e.actions,onDraft:e.onDraft})]}),(0,K.jsx)($x,{scope:a,item:n,editing:s,actions:e.actions,onDraft:e.onDraft})]})}function tS(e,t){let n=t.after===void 0?{}:{after:t.after};return e.run===null?{pipeline:t.pipeline,...t.variant===void 0?{}:{variant:t.variant},...t.task===void 0?{}:{task:t.task},...t.groups===void 0?{}:{groups:t.groups},title:t.title??null,autoDeliver:t.autoDeliver??null,deliveryMode:t.deliveryMode??null,tags:t.tags??[],skip:t.skip??[],...n,...t.links===void 0?{}:{links:t.links},...t.uploads===void 0?{}:{uploads:t.uploads},...t.detach===void 0?{}:{detach:t.detach}}:{...n,...t.variant!==void 0&&t.variant!==e.variant?{variant:t.variant}:{}}}async function nS(e,t,n){return n.readiness===`ready`||n.hold!==null||e({title:t(`queue.list.unmetTitle`),description:t(`queue.list.unmetText`,{items:Lx(n).map(e=>e.title||e.id).join(`, `)}),confirmLabel:t(`queue.list.runNow`),cancelLabel:t(`queue.list.keep`)})}function rS(e,t,n,r){let{t:i}=B(),a=Ke(),{setMessage:o,refresh:s}=r,[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)({}),f=e=>{o(e.message),s()};return{started:c,pending:u,remove:async r=>{let s=Px(e.queueOf(r),r.id);if(await a({title:i(`queue.list.removeTitle`,{item:Ax(r,i)}),...s.length>0?{description:i(`queue.list.removeDependents`,{items:s.map(e=>Ax(e,i)).join(`, `)})}:{},confirmLabel:i(`queue.list.remove`),cancelLabel:i(`queue.list.keep`),destructive:!0})){o(null);try{t(await e.apiOf(r).queueRemove(r.id)),n(`edit:${r.id}`,null),V(i(`queue.list.removed`))}catch(e){f(e)}}},runNow:async t=>{if(await nS(a,i,t)){o(null);try{let r=await e.apiOf(t).queueRunNow(t.id);l({item:t.id,runId:r.runId}),V(i(`queue.list.runStarted`)),n(`edit:${t.id}`,null),await s()}catch(e){f(e)}}},setPostponed:async(n,r)=>{d(e=>({...e,[n.id]:r})),o(null);try{t(await e.apiOf(n).queueEdit(n.id,{postponed:r}))}catch(e){f(e)}finally{d(e=>{let{[n.id]:t,...r}=e;return r})}},edit:async(r,i)=>{try{t(await e.apiOf(r).queueEdit(r.id,tS(r,i))),n(`edit:${r.id}`,null)}catch(e){throw/unknown queue item/.test(e.message)&&f(e),e}}}}function iS(e,t){return e.filter(e=>t>e).length}function aS(e,t){let n=t>e?t-1:t;return n===e?null:n+1}function oS(e,t,n){let r=[...e],[i]=r.splice(t,1);return i!==void 0&&r.splice(n-1,0,i),r}function sS(e,t){let[n,r]=(0,H.useState)(null),[i,a]=(0,H.useState)(null);return{dragging:n,setDragging:r,drop:i,onDragOver:(e,t)=>{if(n===null)return;e.preventDefault();let r=e.currentTarget.getBoundingClientRect(),i=e.clientY>r.top+r.height/2;a(e=>e?.index===t&&e.after===i?e:{index:t,after:i})},onDrop:(i,o)=>{i.preventDefault();let s=n;if(s===null){a(null);return}let c=i.currentTarget.getBoundingClientRect(),l=iS([c.top+c.height/2],i.clientY)+o,u=e.indexOf(s);if(r(null),a(null),u===-1)return;let d=aS(u,l);d!==null&&t(s,d)},onKeyDown:(e,n,r)=>{e.altKey&&e.target===e.currentTarget&&(e.key===`ArrowUp`?(e.preventDefault(),t(n,r)):e.key===`ArrowDown`&&(e.preventDefault(),t(n,r+2)))},onDragEnd:()=>{r(null),a(null)}}}function cS(e,t){let n=sS(e.map(e=>e.id),t);return{...n,onKeyDown:(e,t,r)=>n.onKeyDown(e,t.id,r)}}function lS(e,t,n,r){let{t:i}=B(),[a,o]=(0,H.useState)(null),s=(0,H.useRef)(!1);(0,H.useEffect)(()=>{s.current||o(null)},[t.items]);let c=new Map(t.items.map(e=>[e.id,e])),l=(a??t.items.map(e=>e.id)).map(e=>c.get(e)).filter(e=>e!==void 0);for(let e of t.items)l.includes(e)||l.push(e);return{shown:l,move:async(t,a)=>{let u=l.map(e=>e.id),d=u.indexOf(t);if(!(d===-1||a<1||a>u.length||a-1===d)){o(oS(u,d,a)),r.setMessage(null),s.current=!0;try{n(await e.apiOf(c.get(t)).queueEdit(t,{position:a}))}catch(e){r.setMessage(i(`queue.list.moveFailed`,{error:e.message})),r.refresh()}finally{s.current=!1,o(null)}}}}}function uS({api:e,queue:t,runs:n=[],pipelines:r,now:i,drafts:a,onDraft:o,onQueue:s,highlight:c=null,onHighlight:l=()=>void 0,scope:u}){let{t:f}=B(),p=(0,H.useMemo)(()=>Vx(e,t,r,n),[e,t,r,n]),m=u??p,[h,g]=(0,H.useState)(null),_={message:h,setMessage:g,refresh:async()=>{try{s(await e.queue())}catch{}}},{shown:v,move:y}=lS(m,t,s,_),b=rS(m,s,o,_),x=cS(v,y),S=h?(0,K.jsx)(N,{variant:`destructive`,children:h}):null;return v.length===0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(at,{icon:(0,K.jsx)(d,{}),title:f(`queue.list.empty`),children:f(`queue.list.emptyHint`)}),S]}):(0,K.jsxs)(K.Fragment,{children:[S,(0,K.jsx)(`ol`,{className:`flex flex-col gap-2`,"aria-label":f(`queue.list.items`),children:v.map((e,n)=>(0,K.jsx)(eS,{scope:m,queue:t,item:e,index:n,now:i,editing:a[`edit:${e.id}`],highlighted:c?.has(e.id)===!0,onHighlight:l,drag:x,actions:b,onDraft:o},e.id))})]})}var dS=[`needs_human`,`failed`,`conflict`,`cancelled`,`apply_failed`,`usage_limit`];function fS(e,t){let n=dS.find(t=>t===e);return n?t(`queue.reasons.${n}`):e}function pS(e,t){let n=e.startsWith(`_action-`)?`action`:/^_(split|message|resolve|repair)$/.exec(e)?.[1];return n?(0,K.jsx)(`span`,{children:t(`runs.system.${n}`)}):(0,K.jsx)(`code`,{children:e})}function mS({run:e}){let{t}=B();return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)($,{status:e.state}),(0,K.jsx)(Im,{id:e.pipeline,name:e.pipelineName}),(0,K.jsx)(Lm,{id:e.variant,name:e.variantName}),(0,K.jsx)(h,{tags:e.tags??[]}),e.priority?(0,K.jsx)(R,{variant:`run`,title:t(`queue.priorityHint`),children:t(`queue.priority`)}):null,e.delivering?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,K.jsx)(Ul,{"aria-hidden":!0,className:`size-4`}),t(`queue.delivering`)]}):null]})}function hS({run:e}){let{t}=B();return e.system.length===0&&!e.delivery?null:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"aria-label":t(`runs.system.stages`),children:[e.system.map((e,n)=>(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[e.kind===`action`?e.title??t(`runs.system.action`):t(`runs.system.${e.kind}`),(0,K.jsx)($,{status:e.status})]},`${e.kind}-${n}`)),e.delivery?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[t(`runs.system.delivery`),(0,K.jsx)($,{status:e.delivery===`delivering`?`running`:e.delivery})]}):null]})}function gS({run:e,now:t}){let{t:n}=B();return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 text-muted-foreground`,children:[(0,K.jsx)(`span`,{children:n(`format.running`,{duration:yf(t-e.createdAt)})}),xf(e.usage)?(0,K.jsx)(`span`,{children:xf(e.usage)}):null,e.limitUntil===null?null:(0,K.jsx)(`span`,{className:`text-status-warn`,children:n(`runs.group.limitUntil`,{time:jf(e.limitUntil)})})]})}function _S({run:e}){let{t}=B(),{total:n}=e.groups,{steps:r}=e;if(n===0)return(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:t(`queue.splitting`)});let i=n>1?t(`queue.groupsSteps`,{done:e.groups.done,count:n,steps:r.done,total:r.total}):r.current?t(`queue.stepOf`,{number:r.current.number,count:r.total,step:r.current.name??r.current.step}):t(`queue.stepsAll`,{count:r.total});return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`div`,{role:`progressbar`,"aria-label":t(`queue.progress`),"aria-valuemin":0,"aria-valuenow":r.done,"aria-valuemax":r.total,className:`h-1.5 w-full overflow-hidden rounded bg-muted`,children:(0,K.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${r.total===0?0:r.done/r.total*100}%`}})}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:i})]})}function vS({run:e}){let{t}=B();return(0,K.jsxs)(K.Fragment,{children:[e.active.length>0?(0,K.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:e.active.map(e=>(0,K.jsxs)(`li`,{children:[pS(e.group,t),e.stepName??e.step?(0,K.jsxs)(K.Fragment,{children:[` · `,e.stepName??e.step]}):null]},e.group))}):null,e.waiting.length>0?(0,K.jsx)(`ul`,{className:`flex flex-col gap-0.5 text-muted-foreground`,children:e.waiting.map(e=>(0,K.jsxs)(`li`,{className:`flex flex-wrap items-center gap-1`,children:[pS(e.group,t),e.stepName??e.step?(0,K.jsxs)(K.Fragment,{children:[` · `,e.stepName??e.step]}):null,(0,K.jsx)($,{status:`waiting`,wait:e.wait}),(0,K.jsx)(`span`,{children:Vf(e.wait,t)})]},e.group))}):null]})}function yS({run:e}){let{t}=B(),{problem:n}=e;return n?(0,K.jsxs)(`div`,{className:`text-destructive`,children:[(0,K.jsx)(`code`,{children:n.reason}),` — `,fS(n.reason,t),`.`,` `,(0,K.jsx)(`a`,{className:`underline`,href:M({view:`runs`,run:e.id,group:n.group,step:null,tab:null}),children:n.group?t(`queue.openGroup`,{group:n.group}):t(`queue.openRun`)})]}):null}function bS({run:e,now:t,linked:n,action:r=null}){return(0,K.jsxs)(Ee,{role:`group`,"aria-label":e.title,"data-highlighted":n?``:void 0,className:S(`flex min-w-0 flex-col gap-2 p-3 text-sm`,n&&`ring-2 ring-primary`),children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:vf(e.number)}),(0,K.jsx)(`a`,{className:`min-w-0 truncate font-medium text-primary underline`,title:e.title,href:M({view:`runs`,run:e.id,group:null,step:null,tab:null}),children:e.title})]}),(0,K.jsx)(mS,{run:e}),(0,K.jsx)(hS,{run:e}),(0,K.jsx)(gS,{run:e,now:t}),(0,K.jsx)(_S,{run:e}),(0,K.jsx)(vS,{run:e}),(0,K.jsx)(yS,{run:e}),r?(0,K.jsx)(`div`,{children:r}):null]})}function xS(e,t,n,r){let{t:i}=B(),a=Ke(),[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)(null);return{returning:o,dismissing:c,putBack:async a=>{s(a.id);try{n(await t.queueReturn(a.id,e(a))),V(i(`queue.returned`))}catch(e){r(e.message)}finally{s(null)}},dismiss:async o=>{if(await a({title:i(`queue.dismissTitle`,{run:o.title}),description:i(`queue.dismissDescription`),confirmLabel:i(`queue.dismissRun`),cancelLabel:i(`queue.list.keep`),destructive:!0})){l(o.id);try{n(await t.queueDismiss(o.id,e(o))),V(i(`queue.dismissed`))}catch(e){r(e.message)}finally{l(null)}}}}}function SS({queue:e,now:t,api:n,onQueue:r,onError:i,repositoryOf:a=()=>e.repository,projectOf:o}){let{t:s}=B(),{returning:c,dismissing:l,putBack:u,dismiss:d}=xS(a,n,r,i),f=c!==null||l!==null;return(0,K.jsxs)(`section`,{"aria-label":s(`queue.skippedLabel`),children:[(0,K.jsx)(`h3`,{className:`mb-2 font-semibold`,children:s(`queue.skipped`,{count:e.skipped.length})}),(0,K.jsx)(`ul`,{className:`grid gap-2 sm:grid-cols-2`,children:e.skipped.map(e=>(0,K.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-1`,children:[o?.(e)===void 0?null:(0,K.jsx)(Hx,{repository:o(e)}),(0,K.jsx)(bS,{run:e,now:t,linked:!1,action:(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.returnable?(0,K.jsx)(L,{size:`sm`,variant:`outline`,loading:c===e.id,disabled:f,onClick:()=>void u(e),children:s(`queue.returnRun`)}):null,(0,K.jsx)(L,{size:`sm`,variant:`outline`,loading:l===e.id,disabled:f,onClick:()=>void d(e),children:s(`queue.dismissRun`)})]})})]},e.id))})]})}function CS(e,t,n,r){let{t:i}=B(),[a,o]=(0,H.useState)(null);return{pausing:a,pause:async a=>{o(a.id);try{n(await t.pauseRun(a.id,e(a))),V(i(`queue.runPaused`))}catch(e){r(e.message)}finally{o(null)}}}}function wS({count:e}){let{t}=B();return Array.from({length:e},(e,n)=>(0,K.jsx)(`li`,{className:`flex items-center justify-center rounded-xl border border-dashed p-3 text-sm text-muted-foreground`,children:t(`queue.freeSlot`)},`free-${n}`))}function TS({queue:e,now:t,api:n,onQueue:r,onError:i,highlight:a=null,repositoryOf:o=()=>e.repository,projectOf:s}){let{t:c}=B(),l=e.status===`running`,{pausing:u,pause:d}=CS(o,n,r,i),f=e.skipped.length>0?(0,K.jsx)(SS,{queue:e,now:t,api:n,onQueue:r,onError:i,repositoryOf:o,...s?{projectOf:s}:{}}):null;if(e.runs.length===0&&!l)return f;let p=l?Math.max(0,e.parallel-e.runs.length):0;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{"aria-label":c(`queue.runningLabel`),children:[(0,K.jsxs)(`h3`,{className:`mb-2 font-semibold`,children:[c(`queue.running`),` ·`,` `,c(`queue.runsPlaces`,{taken:e.runs.length,count:e.parallel})]}),e.runs.length>e.parallel?(0,K.jsx)(`p`,{className:`mb-2 text-sm text-muted-foreground`,children:c(`queue.runsOverflow`)}):null,(0,K.jsxs)(`ul`,{className:`grid grid-cols-1 gap-2 md:grid-cols-2 2xl:grid-cols-3`,children:[e.runs.map(e=>(0,K.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-1`,children:[s?.(e)===void 0?null:(0,K.jsx)(Hx,{repository:s(e)}),(0,K.jsx)(bS,{run:e,now:t,linked:a?.has(e.id)===!0,action:e.delivering||e.state===`finished`||e.state===`cancelled`?null:(0,K.jsx)(L,{size:`sm`,variant:`outline`,loading:u===e.id,disabled:u!==null,onClick:()=>void d(e),children:c(`queue.pauseRun`)})})]},e.id)),(0,K.jsx)(wS,{count:p})]})]}),f]})}function ES(e){if(!/^\d+$/.test(e.trim()))return null;let t=Number(e);return t>=1&&t<=20?t:null}function DS(e,t,n,r){let[i,a]=(0,H.useState)(null),o=(0,H.useRef)(!1),s=(0,H.useRef)(t.parallel),c=(0,H.useRef)(t.parallel);c.current=t.parallel;let l=i??t.parallel,u=async()=>{if(!o.current){o.current=!0;try{let t,r;do t=s.current,r=await e.queueSettings({parallel:t});while(s.current!==t);n(r),a(null)}catch(e){s.current=c.current,a(null),r(e.message)}finally{o.current=!1}}};return{shown:l,change:e=>{(e!==l||i!==null)&&(s.current=e,a(e),u())}}}function OS({api:e,queue:t,text:n,onText:r,onQueue:i,onError:a,id:o=`queue-parallel`}){let{t:s}=B(),{shown:c,change:l}=DS(e,t,i,a),u=n??String(c),d=ES(u)===null,f=()=>{let e=ES(u);e!==null&&(r(null),e!==c&&l(e))};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(Q,{htmlFor:o,children:s(`queue.parallel`)}),(0,K.jsx)(L,{type:`button`,variant:`outline`,size:`icon`,"aria-label":s(`queue.parallelDecrease`),disabled:c<=1,onClick:()=>l(c-1),children:(0,K.jsx)(Zc,{"aria-hidden":!0})}),(0,K.jsx)(Du,{id:o,type:`text`,inputMode:`numeric`,className:`w-16 text-center`,value:u,"aria-invalid":d,onChange:e=>r(e.target.value),onBlur:f,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,K.jsx)(L,{type:`button`,variant:`outline`,size:`icon`,"aria-label":s(`queue.parallelIncrease`),disabled:c>=20,onClick:()=>l(c+1),children:(0,K.jsx)(_l,{"aria-hidden":!0})})]}),d?(0,K.jsx)(`span`,{className:`text-sm text-destructive`,children:s(`queue.parallelRange`,{max:20})}):null]})}function kS({api:e,queue:t,parsed:n,onQueue:r,onError:i,onDone:a}){let{t:o}=B(),s=t.status===`running`||t.stop?.kind===`limit`&&t.stop.autoResume,c=t.status===`stopped`&&(t.items.length>0||t.runs.length>0),l=async(e,t)=>{try{r(await e()),a(),V(t)}catch(e){i(e.message)}};return(0,K.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(L,{variant:`secondary`,disabled:!c||n===null,onClick:()=>void l(()=>e.queueStart(n===t.parallel?void 0:n??void 0),o(`queue.started`)),children:o(`queue.start`)}),(0,K.jsx)(L,{variant:`outline`,disabled:!s,onClick:()=>void l(()=>e.queuePause(),o(`queue.paused`)),children:o(`queue.pause`)})]})}function AS({api:e,queue:t,parallel:n,onParallel:r,onQueue:i,onError:a,onDone:o,onNewTask:s}){let{t:c}=B(),l=ES(n??String(t.parallel));return(0,K.jsxs)(`section`,{"aria-label":c(`queue.controls.label`),className:`flex flex-col gap-3 rounded-xl border bg-card p-3`,children:[(0,K.jsx)(`h3`,{className:`font-semibold`,children:c(`queue.controls.title`)}),(0,K.jsx)(`div`,{children:(0,K.jsx)($,{status:t.status===`running`?`running`:`stopped`,label:Gf(t.status,c)})}),(0,K.jsx)(OS,{api:e,queue:t,text:n,onText:r,onQueue:i,onError:a}),(0,K.jsx)(`div`,{children:(0,K.jsxs)(L,{onClick:s,children:[(0,K.jsx)(_l,{className:`size-4`,"aria-hidden":`true`}),c(`queue.newTask`)]})}),(0,K.jsx)(kS,{api:e,queue:t,parsed:l,onQueue:i,onError:a,onDone:o}),(0,K.jsx)(`a`,{className:`text-sm underline`,href:M({view:`settings`,run:`queue`,group:`project`,step:null,tab:null}),children:c(`queue.controls.settings`)})]})}function jS({count:e,running:t,locked:n,onReset:r,children:i}){let{t:a}=B(),[o,s]=(0,H.useState)(null),c=o??e>0;return(0,K.jsxs)(Vp,{open:c,onOpenChange:s,"aria-label":a(`queue.filter.label`),className:`rounded-xl border bg-card p-3`,children:[(0,K.jsxs)(Hp,{className:`flex w-full items-center justify-between gap-2 font-semibold`,children:[(0,K.jsxs)(`span`,{children:[a(`queue.filter.title`),e>0?(0,K.jsx)(`span`,{className:`ml-2 text-sm text-muted-foreground`,children:e}):null]}),(0,K.jsx)(Ts,{className:`size-4 transition-transform ${c?`rotate-180`:``}`,"aria-hidden":`true`})]}),(0,K.jsxs)(Up,{className:`mt-3 flex flex-col gap-3`,children:[(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`queue.filter.help`)}),i,t?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`queue.filter.locked`)}):null,(0,K.jsx)(`div`,{children:(0,K.jsx)(L,{variant:`outline`,disabled:n||e===0,onClick:r,children:a(`queue.filter.reset`)})})]})]})}function MS(e,t,n,r){let[i,a]=(0,H.useState)(null);return{shown:{pipelines:i?.pipelines??t.filter.pipelines,tags:i?.tags??t.filter.tags},change:async(t,i)=>{a(t);let o=t.tags&&i?{...t,tags:i(t.tags)}:t;try{n(await e.queueSettings({filter:o}))}catch(e){r(e.message)}finally{a(null)}},saving:i!==null}}function NS(e,t,n,r){let i=new Map((e?.pipelines??[]).map(e=>[e.id,e.name]));return{pipelineOptions:[...[...i].map(([e,t])=>({value:e,label:t})),...t.pipelines.filter(e=>!i.has(e)).map(e=>({value:e,label:`${e} (${r(`queue.filter.unknown`)})`}))],tagOptions:n.map(e=>({value:e.id,label:e.name}))}}function PS({api:e,queue:t,pipelines:n,onQueue:r,onError:i}){let{t:a}=B(),o=g(),{shown:s,change:c,saving:l}=MS(e,t,r,i),u=s.pipelines.length+s.tags.length,d=t.status===`running`||l,f=o.of(t.repository),{pipelineOptions:p,tagOptions:m}=NS(n,s,f,a),h=e=>e.flatMap(e=>f.find(t=>t.id===e)?.name??[]);return(0,K.jsxs)(jS,{count:u,running:t.status===`running`,locked:d,onReset:()=>void c({pipelines:[],tags:[]}),children:[(0,K.jsx)(wh,{label:a(`queue.filter.pipelines`),options:p,selected:s.pipelines,onChange:e=>void c({pipelines:e}),clearLabel:a(`queue.filter.clear`),disabled:d}),(0,K.jsx)(wh,{label:a(`queue.filter.tags`),options:m,selected:s.tags,onChange:e=>void c({tags:e},h),clearLabel:a(`queue.filter.clear`),disabled:d})]})}function FS({api:e,queue:t,pipelines:n,parallel:r,onParallel:i,onQueue:a,onError:o,onNewTask:s}){return(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,K.jsx)(PS,{api:e,queue:t,pipelines:n,onQueue:a,onError:o}),(0,K.jsx)(AS,{api:e,queue:t,parallel:r,onParallel:i,onQueue:a,onError:o,onDone:()=>i(null),onNewTask:s})]})}function IS({queue:e}){let{t}=B(),n=e.stop;if(!n)return null;if(n.kind===`item`)return(0,K.jsx)(N,{variant:`warn`,role:`status`,children:t(`queue.stopItem`,{item:n.item,error:n.error})});let r=M({view:`runs`,run:n.run,group:n.group,step:null,tab:null});return n.kind===`limit`?(0,K.jsxs)(N,{variant:`warn`,role:`status`,children:[t(`queue.stopped`),` `,t(`queue.limitStop`,{runtime:n.runtime}),`,`,` `,t(`queue.limitResets`,{time:jf(n.resetsAt)}),`.`,` `,n.autoResume?`${t(`queue.limitResumes`,{time:jf(n.resetsAt)})} `:null,(0,K.jsx)(`a`,{className:`underline`,href:r,children:t(`queue.openGroup`,{group:n.group})})]}):(0,K.jsxs)(N,{variant:`warn`,role:`status`,children:[t(`queue.stopped`),` `,(0,K.jsx)(`code`,{children:n.reason}),` — `,fS(n.reason,t),`.`,` `,(0,K.jsx)(`a`,{className:`underline`,href:r,children:n.group?t(`queue.openGroup`,{group:n.group}):t(`queue.openRun`)})]})}function LS(e){let[t,n]=(0,H.useState)(null);return(0,H.useEffect)(()=>{let t=!1;return e.pipelines().then(e=>{t||n(e)}).catch(()=>void 0),()=>{t=!0}},[e]),t}function RS({api:e,queue:t,now:n,drafts:r,onDraft:i,onQueue:a,onError:o,onNewTask:s,runs:c=[]}){let{t:l}=B(),u=LS(e),[d,f]=(0,H.useState)(null),[p,m]=(0,H.useState)(null);if((0,H.useEffect)(()=>vu(`queue-task`,s),[s]),!t)return(0,K.jsx)(`div`,{role:`status`,"aria-label":l(`queue.loading`),className:`p-4`,children:(0,K.jsx)(pe,{className:`h-24`})});let h=d===null?null:Fx(t,d),g=h!==null&&h.size>1?h:null;return(0,K.jsx)(`div`,{className:`flex w-full flex-col gap-4 p-4`,children:(0,K.jsxs)(`div`,{className:`grid w-full gap-4 lg:grid-cols-[18rem_minmax(0,1fr)] lg:items-start`,children:[(0,K.jsx)(FS,{api:e,queue:t,pipelines:u,parallel:p,onParallel:m,onQueue:a,onError:o,onNewTask:s}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,K.jsx)(IS,{queue:t}),(0,K.jsx)(TS,{queue:t,now:n,api:e,onQueue:a,onError:o,highlight:g}),(0,K.jsxs)(`section`,{"aria-label":l(`queue.waitingLabel`),children:[(0,K.jsx)(`h3`,{className:`mb-2 font-semibold`,children:l(`queue.waiting`)}),(0,K.jsx)(uS,{api:e,queue:t,runs:c,pipelines:u,now:n,drafts:r,onDraft:i,onQueue:a,highlight:g,onHighlight:f})]})]})]})})}function zS({others:e=[],onOpenProject:t,...n}){return(0,K.jsx)(Mx.Provider,{value:{others:e,openProject:t},children:(0,K.jsx)(RS,{...n})})}function BS(e,t,n,r){let i=new Map;for(let n of t)for(let t of e.get(n.path)?.pipelines??[])i.has(t.id)||i.set(t.id,t.name);return[...[...i].map(([e,t])=>({value:e,label:t})),...n.filter(e=>!i.has(e)).map(e=>({value:e,label:`${e} (${r})`}))]}var VS=e=>e.toLocaleLowerCase(`und`);function HS(e,t){let n=new Map;for(let r of e)for(let e of t.filter(e=>e.repository===r.path)){let t=VS(e.name);n.set(t,[...n.get(t)??[],{project:r.label,color:r.color??null,tag:e}])}return n}function US(e){return e.map(({project:e,color:t},n)=>(0,K.jsx)(`span`,{title:e,"aria-label":e,"data-project-color":t??`gray`,className:`inline-block size-3 rounded-full ${nt[t??`gray`]??nt.gray}`},`${e}:${n}`))}function WS(e){return e.map(({project:e,color:t},n)=>(0,K.jsxs)(`span`,{title:e,className:`inline-flex items-center gap-1 rounded border px-1 text-xs`,children:[(0,K.jsx)(it,{color:t??`gray`}),e]},`${e}:${n}`))}function GS(e,t,n){let r=[...e].map(([e,n])=>{let r=t.find(t=>VS(t)===e)??n[0].tag.name;return{value:r,label:r,keywords:[...new Set(n.map(e=>e.project))].join(` · `),render:(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{className:`truncate`,children:r}),(0,K.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:WS(n)})]})}});for(let i of t)e.has(VS(i))||r.push({value:i,label:`${i} (${n})`});return r}function KS(e,t){return{icon:t=>US(e.get(VS(t))??[]),hint:n=>e.get(VS(n))?.map(({project:e})=>e).join(` · `)??t}}function qS({api:e,queue:t,projects:n,pipelines:r,onQueue:i,onError:a}){let{t:o}=B(),{tags:s}=g(),[c,l]=(0,H.useState)(null),u={pipelines:c?.pipelines??t.filter.pipelines,projects:c?.projects??t.filter.projects,tags:c?.tags??t.filter.tags},d=async t=>{l(t);try{i(await e.queueSettings({filter:t}))}catch(e){a(e.message)}finally{l(null)}},f=t.status===`running`,p=f||c!==null,m=n.filter(e=>!u.projects.length||u.projects.includes(e.path)),h=HS(m,s),_=o(`queue.filter.unknown`),v=GS(h,u.tags,_);return(0,K.jsxs)(jS,{count:u.pipelines.length+u.projects.length+u.tags.length,running:f,locked:p,onReset:()=>void d({pipelines:[],projects:[],tags:[]}),children:[(0,K.jsx)(wh,{label:o(`queue.filter.pipelines`),options:BS(r,m,u.pipelines,_),selected:u.pipelines,onChange:e=>void d({pipelines:e}),clearLabel:o(`queue.filter.clear`),disabled:p}),(0,K.jsx)(wh,{label:o(`queue.global.projects`),options:n.map(e=>({value:e.path,label:e.label})),selected:u.projects,onChange:e=>void d({projects:e}),clearLabel:o(`queue.filter.clear`),disabled:p}),(0,K.jsx)(wh,{label:o(`queue.filter.tags`),options:v,look:KS(h,_),selected:u.tags,onChange:e=>void d({tags:e}),clearLabel:o(`queue.filter.clear`),disabled:p})]})}function JS(e,t){let[n,r]=(0,H.useState)(new Map),i=t.join(`
|
|
38
|
+
`);return(0,H.useEffect)(()=>{let t=!0;for(let n of i===``?[]:i.split(`
|
|
39
|
+
`))e.forRepository(n).pipelines().then(e=>{t&&r(t=>new Map(t).set(n,e))}).catch(()=>void 0);return()=>{t=!1}},[e,i]),n}function YS(e,t){let n=g(),r=(0,H.useRef)(new Set),i=t.join(`
|
|
40
|
+
`);(0,H.useEffect)(()=>{for(let t of i===``?[]:i.split(`
|
|
41
|
+
`))r.current.has(t)||n.of(t).length>0||(r.current.add(t),e.forRepository(t).tags().then(e=>n.update(t,e)).catch(()=>r.current.delete(t)))},[e,i,n])}function XS({max:e}){let{t}=B();return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,K.jsx)(`span`,{className:`rounded-full border border-primary px-2.5 py-0.5 text-sm font-medium`,children:t(`queue.global.badge`)}),(0,K.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t(`queue.global.max`,{count:e})})]})}function ZS(e){let[t,n]=(0,H.useState)(null),r=t===null?null:Fx(e,t);return{linked:r!==null&&r.size>1?r:null,setHighlight:n}}function QS({api:e,queue:t,projects:n,pipelines:r,onQueue:i,onError:a,onNewTask:o}){let[s,c]=(0,H.useState)(null);return(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,K.jsx)(qS,{api:e,queue:t,projects:n,pipelines:r,onQueue:i,onError:a}),(0,K.jsx)(AS,{api:e,queue:ix(t),parallel:s,onParallel:c,onQueue:i,onError:a,onDone:()=>c(null),onNewTask:o})]})}function $S({api:e,queue:t,projects:n,runs:r=[],now:i,drafts:a={},onDraft:o=()=>void 0,onQueue:s,onNewTask:c,onError:l}){let{t:u}=B(),d=(0,H.useMemo)(()=>ix(t),[t]),{linked:f,setHighlight:p}=ZS(d),m=(0,H.useMemo)(()=>n.map(e=>e.path),[n]),h=JS(e,m);YS(e,m);let g=(0,H.useMemo)(()=>m.map(e=>ax(t,e)),[m,t]),_=sx(e,t,h,r),v=e=>ox(t,e.id);return(0,K.jsxs)(`div`,{className:`flex w-full flex-col gap-4 p-4`,children:[(0,K.jsx)(XS,{max:t.max}),(0,K.jsxs)(`div`,{className:`grid w-full gap-4 lg:grid-cols-[18rem_minmax(0,1fr)] lg:items-start`,children:[(0,K.jsx)(QS,{api:e,queue:t,projects:n,pipelines:h,onQueue:s,onError:l,onNewTask:c}),(0,K.jsx)(Mx,{value:{others:g},children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,K.jsx)(IS,{queue:d}),(0,K.jsx)(TS,{queue:d,now:i,api:e,onQueue:s,onError:l,highlight:f,repositoryOf:v,projectOf:v}),(0,K.jsxs)(`section`,{"aria-label":u(`queue.waitingLabel`),children:[(0,K.jsx)(`h3`,{className:`mb-2 font-semibold`,children:u(`queue.waiting`)}),(0,K.jsx)(uS,{api:e,queue:d,runs:r,pipelines:null,now:i,drafts:a,onDraft:o,onQueue:s,scope:_,highlight:f,onHighlight:p})]})]})})]})]})}function eC(e){let{t}=B(),{onLeave:n,repositories:r,waiting:i,draft:a,onDraft:o}=e,s=bx({...e,open:!0,onOpenChange:()=>n()}),{target:c,setTarget:l,scoped:u,pipelines:d,queue:f,current:p,mode:m,draftTarget:h}=s;return(0,H.useEffect)(()=>{let e=()=>Hy(m.current);return e(),vu(`new-task-page`,e)},[m,f===void 0]),(0,K.jsxs)(`div`,{className:`flex min-h-full flex-col gap-3 p-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,K.jsx)(L,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,K.jsx)(`a`,{href:`#queue`,children:t(`queue.page.back`)})}),(0,K.jsx)(`h1`,{className:`text-lg font-semibold`,children:t(s.multi.on?`queue.multi.title`:`queue.page.title`)}),(0,K.jsx)(Ex,{multi:s.multi})]}),f===void 0?(0,K.jsx)(`div`,{role:`status`,"aria-label":t(`queue.loading`),children:(0,K.jsx)(pe,{className:`h-24`})}):(0,K.jsx)(tx,{fill:!0,idPrefix:`new`,draft:p,pipelines:d,repository:c,api:u,autoDeliverDefault:f.autoDeliver??null,deliveryModeDefault:f.deliveryMode??null,linkChoices:n=>wy(n,f,e.runs??[],e=>Ax(e,t),void 0,Rx(s.queues,r,c)),pending:d===null||a!==void 0&&h!==c,...Ox({multi:s.multi,repositories:r,waiting:i,target:c,onTarget:l,needMore:t(`queue.multi.needMore`),repositoryLabel:t(`queue.form.repository`)}),submitLabel:t(`queue.add`),onDraft:e=>o({...e,repository:e.repository??c}),onSubmit:s.submit,onSubmitAndContinue:s.submitAndContinue,onCancel:n})]})}function tC(e){return e.stop?.kind===`limit`&&e.stop.autoResume}function nC(e,t,n){let r=new Set(t.filter(e=>e.enabled).map(e=>e.path));return[...e].filter(e=>r.has(e.repository)?n===`pause`?e.status===`running`||tC(e):e.status===`stopped`&&!tC(e)&&e.items.some(e=>!e.postponed):!1)}function rC(e,t,n,r,i){let{t:a}=B(),[o,s]=(0,H.useState)(!1),c=new Map(t.map(e=>[e.path,e.label])),l=e=>nC(n.values(),t,e);return{busy:o,run:async t=>{let n=l(t);s(!0);let o=await Promise.allSettled(n.map(n=>{let r=e.forRepository(n.repository);return t===`start`?r.queueStart():r.queuePause()}));s(!1);let u=[];o.forEach((e,t)=>{if(e.status===`fulfilled`)r(e.value);else{let r=n[t].repository;u.push(a(`queue.all.failed`,{project:c.get(r)??r,error:e.reason.message}))}}),u.length>0?i(u.join(`
|
|
42
|
+
`)):V(a(t===`start`?`queue.all.startedAll`:`queue.all.pausedAll`))},can:e=>l(e).length>0}}function iC({api:e,registry:t,queues:n,onQueue:r,onError:i,onNewTask:a}){let{t:o}=B(),s=rC(e,t,n,r,i);return(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsxs)(L,{onClick:a,children:[(0,K.jsx)(_l,{className:`size-4`,"aria-hidden":`true`}),o(`queue.newTask`)]}),(0,K.jsx)(L,{variant:`secondary`,disabled:s.busy||!s.can(`start`),onClick:()=>void s.run(`start`),children:o(`queue.all.startAll`)}),(0,K.jsx)(L,{variant:`outline`,disabled:s.busy||!s.can(`pause`),onClick:()=>void s.run(`pause`),children:o(`queue.all.pauseAll`)})]})}function aC({projects:e,onOpen:t}){let{t:n}=B();return e.length===0?null:(0,K.jsxs)(`p`,{className:`text-sm text-muted-foreground`,"data-empty-queues":!0,children:[n(`queue.all.empty`),` `,e.map((e,r)=>(0,K.jsxs)(`span`,{children:[r>0?`, `:null,(0,K.jsx)(`button`,{type:`button`,className:`underline`,"aria-label":n(`queue.all.showEmpty`,{project:e.label}),onClick:()=>t(e.path),children:e.label})]},e.path))]})}function oC({api:e,project:t,queue:n,onQueue:r,onError:i,onOpen:a}){let{t:o}=B(),s=(0,H.useId)(),[c,l]=(0,H.useState)(null);return(0,K.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,K.jsxs)(`h3`,{className:`flex items-center gap-1.5 font-semibold`,children:[(0,K.jsx)(it,{color:t.color}),t.label]}),(0,K.jsx)($,{status:n.status===`running`?`running`:`stopped`,label:Gf(n.status,o)}),(0,K.jsx)(OS,{id:s,api:e,queue:n,text:c,onText:l,onQueue:r,onError:i}),(0,K.jsx)(kS,{api:e,queue:n,parsed:ES(c??String(n.parallel)),onQueue:r,onError:i,onDone:()=>l(null)}),(0,K.jsx)(L,{variant:`link`,className:`ml-auto`,onClick:()=>a(t.path),children:o(`queue.all.openProject`)})]})}function sC({api:e,project:t,queue:n,runs:r,now:i,drafts:a,onDraft:o,onQueue:s,onError:c,onOpen:l}){let{t:u}=B(),d=LS(e),[f,p]=(0,H.useState)(null),m=f===null?null:Fx(n,f),h=m!==null&&m.size>1?m:null;return(0,K.jsxs)(`section`,{"aria-label":u(`queue.all.blockLabel`,{project:t.label}),"data-project-queue":t.path,className:`flex min-w-0 flex-col gap-3 rounded-xl border bg-card p-3`,children:[(0,K.jsx)(oC,{api:e,project:t,queue:n,onQueue:s,onError:c,onOpen:l}),(0,K.jsx)(IS,{queue:n}),(0,K.jsx)(TS,{queue:n,now:i,api:e,onQueue:s,onError:c,highlight:h}),(0,K.jsxs)(`section`,{"aria-label":u(`queue.waitingLabel`),children:[(0,K.jsx)(`h4`,{className:`mb-2 font-semibold`,children:u(`queue.waiting`)}),(0,K.jsx)(uS,{api:e,queue:n,runs:r,pipelines:d,now:i,drafts:a,onDraft:o,onQueue:s,highlight:h,onHighlight:p})]})]})}function cC(e){return e.filter(e=>e.enabled).sort((e,t)=>{let n=e.label.toLowerCase().localeCompare(t.label.toLowerCase());return n===0?e.path<t.path?-1:+(e.path>t.path):n})}function lC(e){return e===void 0||e.items.length===0&&e.runs.length===0&&e.skipped.length===0&&e.stop===null&&e.status===`stopped`}function uC({api:e,registry:t,queues:n,runs:r,now:i,drafts:a,onDraft:o,onQueue:s,onError:c,onNewTask:l,onOpenProject:u}){let{t:d}=B(),f=cC(t),[p,m]=(0,H.useState)(new Set),h=async t=>{m(e=>new Set(e).add(t));try{s(await e.forRepository(t).queue())}catch(e){c(e.message)}};if(f.length===0)return(0,K.jsx)(`div`,{className:`p-4`,children:(0,K.jsx)(at,{title:d(`queue.all.nothing`)})});let g=f.filter(e=>p.has(e.path)||!lC(n.get(e.path))),_=f.filter(e=>!g.includes(e));return(0,K.jsxs)(`div`,{className:`flex w-full flex-col gap-4 p-4`,children:[(0,K.jsx)(iC,{api:e,registry:t,queues:n,onQueue:s,onError:c,onNewTask:l}),g.map(t=>{let l=n.get(t.path);return l?(0,K.jsx)(sC,{api:e.forRepository(t.path),project:t,queue:l,runs:r,now:i,drafts:a,onDraft:o,onQueue:s,onError:c,onOpen:u},t.path):null}),(0,K.jsx)(aC,{projects:_,onOpen:e=>void h(e)})]})}var dC=e({AllQueuesPage:()=>uC,GlobalQueuePage:()=>$S,NewTaskDialog:()=>Bx,NewTaskPage:()=>eC,QueuePage:()=>zS});function fC({what:e}){let{t}=B();return(0,K.jsxs)(`div`,{role:`status`,"aria-label":t(`app.loading`,{what:e}),className:`flex flex-col gap-2 p-4`,children:[(0,K.jsx)(pe,{className:`h-8 w-64`}),(0,K.jsx)(pe,{className:`h-40`})]})}var pC=`modulepreload`,mC=function(e){return`/`+e},hC={},gC=function(e){return e.pathname.endsWith(`.css`)},_C=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},vC=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=mC(t,n);let r=s(t),i=gC(r);return _C(hC,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`:pC,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)})},yC=(0,H.lazy)(()=>vC(()=>Promise.resolve().then(()=>dC).then(e=>({default:e.AllQueuesPage})),void 0)),bC=(0,H.lazy)(()=>vC(()=>Promise.resolve().then(()=>dC).then(e=>({default:e.GlobalQueuePage})),void 0));function xC(e){let{t}=B(),{common:n,allProjects:r}=e;return(0,K.jsx)(H.Suspense,{fallback:(0,K.jsx)(fC,{what:t(`app.loadingQueue`)}),children:(0,K.jsx)(yC,{api:n.api,registry:r.registry,queues:r.queues,runs:n.runs,now:e.now,drafts:e.drafts,onDraft:e.onDraft,onQueue:e.onQueue,onError:e.onError,onNewTask:e.onNewTask,onOpenProject:r.onOpenProject})})}function SC(e){let{t}=B();return(0,K.jsx)(H.Suspense,{fallback:(0,K.jsx)(fC,{what:t(`app.loadingQueue`)}),children:(0,K.jsx)(bC,{api:e.common.api,queue:e.globalQueue,projects:e.registry.filter(e=>e.enabled!==!1),runs:e.common.runs,now:e.now,drafts:e.drafts,onDraft:e.onDraft,onQueue:e.onQueue,onNewTask:e.onNewTask,onError:e.onError})})}var CC=(0,H.lazy)(()=>vC(()=>Promise.resolve().then(()=>dC).then(e=>({default:e.NewTaskDialog})),void 0)),wC=(0,H.lazy)(()=>vC(()=>Promise.resolve().then(()=>dC).then(e=>({default:e.NewTaskPage})),void 0)),TC=(0,H.lazy)(()=>vC(()=>Promise.resolve().then(()=>dC).then(e=>({default:e.QueuePage})),void 0)),EC=(0,H.lazy)(()=>vC(()=>import(`./specialists-BGKB5BLI.js`).then(e=>e.t).then(e=>({default:e.SpecialistsPage})),__vite__mapDeps([0,1,2,3,4,5,6]))),DC=(0,H.lazy)(()=>vC(()=>import(`./pipelines-Cej37cah.js`).then(e=>e.t).then(e=>({default:e.PipelinesPage})),__vite__mapDeps([7,1,3,2,8,0,4,5,6,9]))),OC=(0,H.lazy)(()=>vC(()=>import(`./stats-BM-bGkGX.js`).then(e=>({default:e.StatsPage})),__vite__mapDeps([10,1,2,3,4,6]))),kC=(0,H.lazy)(()=>vC(()=>import(`./settings-CDiTeiYL.js`).then(e=>({default:e.SettingsPage})),__vite__mapDeps([11,1,0,2,3,4,5,6,8,12]))),AC=(e,t,n=null)=>({view:e,run:t,group:n,step:null,tab:null});function jC(e){let{t}=B(),{common:n}=e,r=e.newTaskPage;return n.route.run===`new`&&r.selected!==null?(0,K.jsx)(H.Suspense,{fallback:(0,K.jsx)(fC,{what:t(`app.loadingQueue`)}),children:(0,K.jsx)(wC,{api:r.api,selected:r.selected,repositories:r.repositories,waiting:r.waiting,queues:r.queues,globalQueue:r.globalQueue,runs:n.runs,preset:r.preset,onPresetApplied:r.onPresetApplied,draft:e.drafts.new,onDraft:t=>e.onDraft(`new`,t),onQueue:e.onQueue,onLeave:()=>n.onRoute(AC(`queue`,null))},n.pageKey)}):e.globalQueue?(0,K.jsx)(SC,{...e,globalQueue:e.globalQueue}):e.allProjects?(0,K.jsx)(xC,{...e,allProjects:e.allProjects}):(0,K.jsx)(H.Suspense,{fallback:(0,K.jsx)(fC,{what:t(`app.loadingQueue`)}),children:(0,K.jsx)(TC,{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,others:Rx(r.queues,r.repositories,e.queue?.repository??null),onOpenProject:e.onOpenProject},n.pageKey)})}function MC({common:e,registry:t}){let{t:n}=B(),{route:r,onRoute:i}=e;return(0,K.jsx)(H.Suspense,{fallback:(0,K.jsx)(fC,{what:n(`app.loadingStats`)}),children:(0,K.jsx)(OC,{api:e.api,registry:t,runs:e.runs,period:je(r.group),project:r.run,onFilter:(e,t)=>i({view:`stats`,run:t,group:e,step:null,tab:null})})})}function NC(e){let{t}=B(),{common:n,...r}=e,i=te(n.route.group,n.route.run),a=e=>t=>n.onRoute({...AC(`settings`,e,`global`),step:t});return(0,K.jsx)(H.Suspense,{fallback:(0,K.jsx)(fC,{what:t(`app.loadingSettings`)}),children:(0,K.jsx)(kC,{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 PC({common:e,allProjects:t}){let{t:n}=B(),{route:r,onRoute:i}=e;return r.view===`pipelines`?(0,K.jsx)(H.Suspense,{fallback:(0,K.jsx)(fC,{what:`pipeline`}),children:(0,K.jsx)(DC,{dirty:e.dirty,api:e.api,runs:e.runs,selected:r.run,section:r.group,variant:r.step,projects:t?{registry:t.registry,project:r.project??null,last:t.last}:void 0,onSelect:(e,t=null,n=null,r=null)=>i({...AC(`pipelines`,e,t),step:n,project:r}),onOpenGroup:(e,t)=>i({...AC(`runs`,e.runId,e.slug),step:t})},e.pageKey)}):(0,K.jsx)(H.Suspense,{fallback:(0,K.jsx)(fC,{what:n(`app.loadingSpecialists`)}),children:(0,K.jsx)(EC,{dirty:e.dirty,api:e.api,selected:r.run,section:r.group,projects:t?{registry:t.registry,project:r.project??null,last:t.last}:void 0,onSelect:(t,n=null,r=null)=>e.onRoute({...AC(`specialists`,t),group:n,project:r})},e.pageKey)})}function FC(e){let{pageKey:t,...n}=e;return(0,K.jsx)(H.Suspense,{fallback:null,children:(0,K.jsx)(CC,{...n},t)})}function IC({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,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Gm,{open:l.palette,onOpenChange:l.onPalette,api:i,runs:c,route:r,onRoute:l.onRoute,onShortcuts:()=>l.onShortcuts(!0)}),(o!==null||t.globalQueue!==null)&&s!==null&&a.opened?(0,K.jsx)(FC,{api:l.api,pageKey:s,selected:s,repositories:t.repositories,waiting:l.waiting,queues:t.queues,globalQueue:t.globalQueue,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,onExpand:t=>{a.expand(t),e.setRoute({view:`queue`,run:`new`,group:null,step:null,tab:null})}}):null,(0,K.jsx)(Jm,{open:l.shortcuts,onOpenChange:l.onShortcuts})]})}function LC(e){let{state:t,chrome:n}=e;return{api:e.api,selected:t.selected,repositories:t.repositories,waiting:e.waitingRepositories,queues:t.queues,globalQueue:t.globalQueue,preset:n.newTask.pagePreset,onPresetApplied:()=>n.newTask.setPagePreset(null)}}function RC(e){if(e.allProjects)return{registry:e.state.registry,last:e.state.selected}}function zC(e,t){if(e.allProjects)return{registry:e.state.registry,queues:e.state.queues,onOpenProject:e=>void t.openProject(e,`queue`)}}function BC(e){return{api:e.scopedApi,runs:e.state.runs,route:e.route,onRoute:e.setRoute,pageKey:e.state.selected??``,dirty:e.chrome.dirty}}function VC(e,t){return{onSubtask:e.state.queue||e.state.globalQueue?e.chrome.newTask.openSubtask:void 0,linkChoices:n=>{let r=e.state.queues.get(n.repository)??{repository:n.repository,items:[],runs:[]};return i=>wy(i,r,e.state.runs,e=>Ax(e,t),n,Rx(e.state.queues,e.state.repositories,n.repository))}}}function HC({panel:e,actions:t}){let{t:n}=B(),{state:r,chrome:i,route:a}=e,o=BC(e),{queueDrafts:s,onQueueDraft:c}=i.drafts;switch(a.view){case`queue`:return(0,K.jsx)(jC,{common:o,queue:r.queue,globalQueue:r.globalQueue,registry:r.registry,now:i.now,drafts:s,onDraft:c,onQueue:r.setQueue,onError:tt,onNewTask:i.newTask.openNewTask,onOpenProject:e=>void t.openProject(e,`queue`),allProjects:zC(e,t),newTaskPage:LC(e)});case`settings`:return(0,K.jsx)(NC,{common:o,streamedObservers:r.streamedObservers,streamedNetwork:r.streamedNetwork,repository:r.selected,repositories:r.repositories,onSelectRepository:e=>void t.switchProject(e),registry:r.registry,onRegistry:r.setRegistry,onProjectMoved:t.projectMoved,onRemoveProject:t.removeRepository,onOpenProject:(e,n)=>void t.openProject(e,n),queue:r.queue,onQueue:r.setQueue,onError:tt});case`stats`:return(0,K.jsx)(MC,{common:o,registry:r.registry});case`pipelines`:case`specialists`:return(0,K.jsx)(PC,{common:o,allProjects:RC(e)});default:return(0,K.jsx)(by,{api:e.api,runs:r.runs,loaded:r.loaded,openedState:r.openedState,route:a,now:i.now,drafts:i.drafts.drafts,onDraft:i.drafts.onDraft,onClearDrafts:i.drafts.onClearDrafts,onError:tt,onlyReplies:e.onlyReplies,onOnlyReplies:e.setOnlyReplies,onRoute:e.setRoute,repository:r.selected,repositoryPaths:e.repositoryPaths,scope:e.allProjects?`all`:`repository`,...VC(e,n),onOpenProject:e=>void t.openProject(e,`queue`),history:r.history})}}function UC(e,t){return e!==null&&JSON.stringify(e)===JSON.stringify(t)?e:t}function WC(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 GC(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 KC(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 qC(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 JC(e,t){return JSON.stringify(e)===JSON.stringify(t)?e:t}function YC(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`)),JC(e,r)}function XC(e,t){return JSON.stringify(e)===JSON.stringify(t)?e:t}function ZC(e,t,n){t.setDaemon(e.daemon??null),t.setLoaded(!0);let r=e.runs;t.setRuns(e=>GC(e,r)),n(r);let i=e.tags;i&&t.setTags(e=>JC(e,i));let a=e.repositories;a&&t.setRegistry(e=>XC(e,a)),t.setGlobalQueue(e.globalQueue??null);let o=e.queues??[];o.length>0&&t.setQueues(e=>o.reduce((e,t)=>qC(e,t),e))}function QC(e,t){t.setRuns(t=>KC(t,e)),t.setExtra(t=>t.has(e.id)?KC(t,e):t),t.setHistory(t=>t.has(e.id)?KC(t,e):t)}function $C(e,t,n){switch(e.event){case`daemon`:t.setDaemon(e.daemon);return;case`snapshot`:ZC(e,t,n);return;case`tags`:{let n=e.tags;t.setTags(e=>JC(e,n));return}case`repositories`:{let n=e.repositories;t.setRegistry(e=>XC(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=>qC(e,n));return}case`globalQueue`:{let n=e.globalQueue;t.setGlobalQueue(e=>JSON.stringify(e)===JSON.stringify(n)?e:n);return}case`run`:QC(e.run,t)}}function ew(e,t,n){if(e.event===`observers`){let n=f(e.observers??e);n&&t.setStreamedObservers(e=>UC(e,n))}else vm(e)&&$C(e,t,n)}function tw({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=>KC(t,e))}).catch(()=>{})}async function nw({api:e,set:t,closed:n}){try{let r=await e.queue();if(n())return;if(r.scope===`global`){t.setGlobalQueue(r);return}t.setHome(r.repository),t.setQueues(e=>qC(e,r))}catch{}}async function rw({api:e,set:t,refs:n,closed:r}){let i=await e.tags();if(r())return;t.setTags(e=>YC(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=>YC(e,n,a))}}async function iw(e){let{api:t,set:n,closed:r}=e;try{let i=await t.runs();if(r())return;n.setRuns(e=>GC(e,i)),n.setLoaded(!0),tw(e,i);let a=await t.repositories();if(r())return;n.setRegistry(e=>XC(e,a)),await rw(e)}catch{}await nw(e)}function aw(e,t,n,r){let i=!1,a={api:e,set:n,refs:r,closed:()=>i};nw(a);let o=Sm(()=>iw(a),()=>n.setConnection(`polling`),a.closed),s=t(`/api/events`);return Cm(s,o,{live:()=>n.setConnection(`live`),event:e=>ew(e,n,e=>tw(a,e)),broken:()=>n.setConnection(e=>e===`polling`?e:`reconnecting`)}),()=>{i=!0,o.stop(),s.close()}}var ow={cursor:void 0,loading:!1,error:null};function sw(e,t,n){let[r,i]=(0,H.useState)(new Map),a=(0,H.useRef)(r),o=n??``,s=(0,H.useCallback)((e,t)=>{let n=new Map(a.current);n.set(e,{...n.get(e)??ow,...t}),a.current=n,i(n)},[]),c=(0,H.useCallback)(()=>{if(n===void 0)return;let r=a.current.get(o)??ow;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)=>KC(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)??ow;return(0,H.useMemo)(()=>({loading:l.loading||n===void 0,error:l.error,done:l.cursor===null,loadMore:c}),[l,c,n])}function cw(e,{runs:t,extra:n,history:r,loaded:i},a,o,s){let[c,l]=(0,H.useState)(new Set),u=(0,H.useRef)(new Set),d=(0,H.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,H.useEffect)(()=>{!i||o===null||p||m||u.current.has(o)||(u.current.add(o),e.run(o).then(e=>a(t=>KC(t,e))).catch(e=>{e instanceof gt&&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 lw(e,t){let[n,r]=(0,H.useState)(null),[i,a]=(0,H.useState)(null),[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)(new Map),[u,d]=(0,H.useState)(new Map),[f,p]=(0,H.useState)(null),[m,h]=(0,H.useState)([]),[g,_]=(0,H.useState)(null),[v,y]=(0,H.useState)(`reconnecting`),[b,x]=(0,H.useState)(!1),[S,C]=(0,H.useState)(null),[w,T]=(0,H.useState)([]),[E,ee]=(0,H.useState)(new Map),[D,te]=(0,H.useState)(new Map),O={opened:(0,H.useRef)(e),extra:(0,H.useRef)(E),home:(0,H.useRef)(g),wanted:(0,H.useRef)(t)};return O.opened.current=e,O.extra.current=E,O.home.current=g,O.wanted.current=t,{state:{runs:c,queues:u,globalQueue:f,registry:m,home:g,connection:v,loaded:b,daemon:S,tags:w,extra:E,history:D,streamedObservers:n,streamedProcesses:i,streamedNetwork:o},set:{setRuns:l,setQueues:d,setGlobalQueue:p,setRegistry:h,setHome:_,setLoaded:x,setDaemon:C,setTags:T,setExtra:ee,setHistory:te,setStreamedObservers:r,setStreamedProcesses:a,setStreamedNetwork:s,setConnection:y},refs:O}}function uw(e,{home:t,registry:n,queues:r,globalQueue:i},a,o){let s=(0,H.useMemo)(()=>(Oe(n),xe(t,n)),[t,n]),c=t===null?i===null?null:me(n):s.includes(t)?t:me(n)??t,l=o!==null&&s.includes(o)?o:c,u=l?r.get(l)??null:null,d=l!==null&&l!==t&&u===null&&i===null;return(0,H.useEffect)(()=>{if(!d||l===null)return;let t=!1;return e.forRepository(l).queue().then(e=>{!t&&e.scope!==`global`&&a(t=>qC(t,e))}).catch(()=>{}),()=>{t=!0}},[e,d,l,a]),{repositories:s,selected:l,queue:u}}function dw(e,t=gm,n=null,r=null,i=()=>void 0,a=!1){let{state:o,set:s,refs:c}=lw(r,n);(0,H.useEffect)(()=>aw(e,t,s,c),[e,t]);let l=cw(e,o,s.setExtra,r,i),u=uw(e,o,s.setQueues,n),d=sw(e,s.setHistory,a?u.selected??void 0:null),{runs:f,extra:p,history:m}=o,h=(0,H.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 WC(e.values())},[f,p,m]),g=(0,H.useMemo)(()=>new Set(f.keys()),[f]),_=(0,H.useCallback)(e=>{e.scope===`global`?s.setGlobalQueue(e):s.setQueues(t=>qC(t,e))},[]),v=(0,H.useCallback)((e,t)=>{s.setTags(n=>YC(n,t,e))},[]),y=(0,H.useCallback)(e=>{s.setRegistry(t=>XC(t,e))},[]);return{...u,...o,runs:h,listedRuns:g,openedState:l,history:d,setRegistry:y,setQueue:_,setTags:v}}var fw=[`needs_human`,`failed`,`conflict`,`apply_failed`];function pw(e){return(e??``).split(`
|
|
43
|
+
`).find(e=>e.trim()!==``)?.trim()??``}function mw(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 hw(e){let t=[];for(let n of e)m(n)||n.groups.forEach((e,r)=>{for(let i of mw(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:pw(a),humanOnly:i===`needs_human`?e.humanOnly??null:null,createdAt:n.createdAt},order:fw.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 gw(e){let t=new Set;for(let n of e)for(let e of n.groups)for(let r of mw(e))t.add(`${n.id}/${e.slug}/${r}`);return t}function _w(e,t){let n=new Set(t.map(e=>e.id)),r=gw(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 vw(){if(typeof Notification>`u`||typeof window<`u`&&window.isSecureContext===!1)return`unsupported`;let e=Notification.permission;return e===`granted`||e===`denied`?e:`default`}function yw(e,t,n,r,i){let a=(0,H.useRef)(null),o=(0,H.useRef)(i);o.current=i;let s=(0,H.useRef)(r);s.current=r;let c=(0,H.useRef)(n);c.current=n,(0,H.useEffect)(()=>{if(!t)return;let n=a.current;if(a.current=new Set(e.map(e=>e.key)),n!==null&&vw()===`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=Bf(t.kind,Ae.t).label,r=t.humanOnly?`${e} · ${Ae.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 bw(e,t,n=!0,r=null){let[i,a]=Ne(`notificationsRead`,[],{shared:!0}),[o,s]=Ne(`notificationsHidden`,[],{shared:!0}),[c,l]=(0,H.useState)(vw),u=(0,H.useMemo)(()=>hw(e),[e]),d=(0,H.useMemo)(()=>new Set(o),[o]),f=(0,H.useMemo)(()=>new Set(i),[i]),p=(0,H.useMemo)(()=>u.filter(e=>!d.has(e.key)),[u,d]),m=p.filter(e=>!f.has(e.key));(0,H.useEffect)(()=>{if(!n)return;let t=_w(i,e);t.length!==i.length&&a(t);let r=_w(o,e);r.length!==o.length&&s(r)},[n,e,i,o,a,s]),yw(u,n,d,r,t);let h=(0,H.useCallback)(()=>{l(vw());let e=[...new Set([...i,...p.map(e=>e.key)])];e.length!==i.length&&a(e)},[i,p,a]),g=(0,H.useCallback)(()=>{typeof Notification<`u`&&Notification.requestPermission().then(()=>l(vw()),()=>l(vw()))},[]),_=(0,H.useCallback)(e=>s([...new Set([...o,e])]),[o,s]),v=(0,H.useCallback)(()=>s([...new Set([...o,...p.map(e=>e.key)])]),[o,p,s]),y=(0,H.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 xw(){let[e,t]=(0,H.useState)({}),[n,r]=(0,H.useState)({});return{drafts:e,queueDrafts:n,onDraft:(0,H.useCallback)((e,n)=>{t(t=>({...t,[e]:n}))},[]),onClearDrafts:(0,H.useCallback)(e=>{t(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e&&!t.startsWith(`${e}/`))))},[]),onQueueDraft:(0,H.useCallback)((e,t)=>{r(n=>{if(t!==null)return{...n,[e]:t};let{[e]:r,...i}=n;return i})},[])}}function Sw(){let[e,t]=(0,H.useState)(!1),[n,r]=(0,H.useState)(!1),[i,a]=(0,H.useState)(null),o=(0,H.useCallback)(e=>{a(e),r(!0),t(!0)},[]),[s,c]=(0,H.useState)(null),l=(0,H.useCallback)(e=>{t(!1),c({repository:e,parent:null})},[]);return{open:e,setOpen:t,opened:n,preset:i,setPreset:a,openNewTask:(0,H.useCallback)(()=>o(null),[o]),openSubtask:(0,H.useCallback)(e=>o({repository:e.repository,parent:e.id}),[o]),pagePreset:s,setPagePreset:c,expand:l}}function Cw(){return ke(window.location.hash)}function ww(e){let t=M(e);window.location.hash!==t&&window.history.replaceState(null,``,`${window.location.pathname}${t}`)}function Tw(){let[e,t]=(0,H.useState)(Cw),n=(0,H.useRef)(null);return(0,H.useEffect)(()=>{let e=()=>t(Cw());return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),(0,H.useEffect)(()=>ww(e),[e]),(0,H.useEffect)(()=>{e.view===`runs`&&e.run&&(n.current=e.run)},[e]),{route:e,setRoute:t,lastRun:n}}function Ew(){let[e,t]=(0,H.useState)(()=>Date.now());return(0,H.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),1e3);return()=>clearInterval(e)},[]),e}function Dw(e){let t=(0,H.useRef)(!1);(0,H.useEffect)(()=>{t.current=!1},[e]);let[n,r]=(0,H.useState)(!1),[i,a]=(0,H.useState)(!1);return mu(`mod+k`,e=>{e.preventDefault(),r(e=>!e)}),mu(`?`,()=>a(!0)),{dirty:t,palette:n,setPalette:r,shortcuts:i,setShortcuts:a,newTask:Sw(),drafts:xw(),now:Ew()}}function Ow(e,t,n,r,i){let{allProjects:a,setChosen:o,registry:s,disabled:c}=i,l=t.find(e=>a||e.repository===n);(0,H.useEffect)(()=>{e.view===`runs`&&e.run===null&&l&&r(e=>({...e,run:l.id}))},[e.view,e.run,l,r]);let u=e.view===`runs`&&e.run?t.find(t=>t.id===e.run)?.repository??null:null,d=e.project!==void 0&&e.project!==null?s.find(t=>t.slug===e.project)?.path??null:null,f=u??d,p=f!==null&&!c(f)?f:null;(0,H.useEffect)(()=>{!a&&p!==null&&p!==n&&o(p)},[a,p,n,o])}function kw(e,t){let[n,r]=Ne(`repository`,null),[i,a]=Ne(`projects.all`,!1),[o,s]=Ne(`onlyReplies`,!1),{route:c,setRoute:l,lastRun:u}=Tw(),d=dw(e,t,n,c.view===`runs`?c.run:null,tt,!i),{runs:f,selected:p,registry:m}=d,h=Dw(c.view),g=i&&m.some(e=>e.enabled),_=(0,H.useCallback)(e=>{r(e),a(!1)},[r,a]);Ow(c,f,p,l,{allProjects:g,setChosen:_,registry:m,disabled:(0,H.useMemo)(()=>{let e=new Set(m.filter(e=>!e.enabled).map(e=>e.path));return t=>e.has(t)},[m])});let v=bw(f,e=>l({view:`runs`,run:e.runId,group:e.slug,step:null,tab:null}),d.loaded,d.listedRuns);return{api:e,scopedApi:(0,H.useMemo)(()=>e.forRepository(p),[e,p]),chosen:n,setChosen:_,rememberProject:r,allProjects:g,setAllProjects:a,onlyReplies:o,setOnlyReplies:s,route:c,setRoute:l,lastRun:u,state:d,chrome:h,notifications:v,waitingRepositories:(0,H.useMemo)(()=>fe(m),[m]),repositoryPaths:(0,H.useMemo)(()=>ce(m),[m])}}function Aw(){let e=window.getSelection();return e!==null&&!e.isCollapsed}function jw(e){mu(`ctrl+n`,t=>{e.onNewTask&&(t.preventDefault(),e.onNewTask())});for(let t of Ql)mu(`ctrl+${t.key}`,n=>{t.key===`c`&&Aw()||(n.preventDefault(),e.onNavigate(t.view))})}function Mw(e,t,n){let r=(t,n=null)=>({view:e,run:t,group:n,step:null,tab:null});return e===t.view?e===`queue`&&t.run===`new`?r(null):t:e===`settings`?r(`general`,`global`):r(e===`runs`?n:null)}function Nw(e,t){let{route:n,setRoute:r,allProjects:i,chrome:a}=e,{runs:o,selected:s,queue:c}=e.state,{working:l,waiting:u}=sh(th(o,i?null:s));return{view:n.view,hrefFor:t=>M(Mw(t,n,e.lastRun.current)),onNavigate:t=>{r(Mw(t,n,e.lastRun.current))},repository:{repositories:e.state.repositories,paths:e.repositoryPaths,selected:s,allProjects:i,onAllProjects:()=>void t.selectAllProjects(),waiting:e.waitingRepositories,onSelect:e=>void t.selectRepository(e),onAdd:t.addRepository,browse:e.api.directories},working:l,waiting:u,queued:e.state.globalQueue?.items.length??(i?Pw(e):c?.items.length??0),onPalette:()=>a.setPalette(!0),onNewTask:c||e.state.globalQueue?n.view===`queue`&&n.run===`new`?()=>_u(`new-task-page`):a.newTask.openNewTask:void 0,notifications:e.notifications}}function Pw(e){let t=new Set(e.state.repositories),n=0;for(let[r,i]of e.state.queues)t.has(r)&&(n+=i.items.length);return n}var Fw={view:`runs`,run:null,group:null,step:null,tab:null};function Iw(e,t){let{route:n,setRoute:r,setChosen:i}=e,{selected:a}=e.state,{dirty:o}=e.chrome,{t:s}=B(),c=Ke(),l=async()=>!o.current||await c({title:s(`settings.editor.leaveTitle`),description:s(`settings.editor.leaveDescription`),confirmLabel:s(`settings.editor.leave`),cancelLabel:s(`settings.editor.stay`),destructive:!0}),u=async()=>e.allProjects?!0:await l()?(t(),e.setAllProjects(!0),!0):!1,d=async(o,s)=>o===a&&(s||!e.allProjects)?!0:await l()?(t(),s?(e.rememberProject(o),!0):(i(o),n.view===`runs`&&r(Fw),!0)):!1;return{selectAllProjects:u,selectRepository:e=>d(e,!1),switchProject:e=>d(e,!0)}}var Lw={view:`runs`,run:null,group:null,step:null,tab:null};function Rw(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}=B(),f=Ke(),p=(0,H.useRef)({chosen:i,selected:s});p.current={chosen:i,selected:s};let m=()=>{u.current=!1,o.current=null},{selectAllProjects:h,selectRepository:g,switchProject:_}=Iw(e,m);return{selectAllProjects:h,switchProject:_,selectRepository:g,addRepository:async e=>{let n=await t.addRepository(e);l(n);let r=ye(e,c,n)?.path;r&&await g(r)},removeRepository:async i=>{let o=F(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 tt(e),!1}return l(s),(i===p.current.selected||i===p.current.chosen)&&(m(),a(e.state.home===null?me(s):null),n.view===`runs`&&r(Lw)),!0},projectMoved:(t,n)=>{(p.current.chosen===t||p.current.selected===t)&&e.rememberProject(n)},openProject:async(e,t)=>{await g(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 zw(e){return(0,K.jsx)(Qe,{children:(0,K.jsx)(Bw,{...e})})}function Bw({api:e,openStream:t=gm}){let{t:n}=B(),r=kw(e,t),{state:i,route:a,setRoute:o}=r,s=Rw(r),c=Nw(r,s);return jw(c),(0,K.jsx)(p,{tags:i.tags,onTags:i.setTags,children:(0,K.jsxs)(Op,{footer:(0,K.jsx)(hm,{runs:i.runs,selected:i.selected,allProjects:r.allProjects,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,K.jsx)(IC,{panel:r}),(0,K.jsx)(kp,{daemon:i.daemon}),(0,K.jsx)(`h1`,{className:`sr-only`,children:$l(a.view,n)}),(0,K.jsx)(HC,{panel:r,actions:s})]})})}var Vw=new URL(window.location.href);Vw.searchParams.has(`token`)&&(Vw.searchParams.delete(`token`),window.history.replaceState(null,``,`${Vw.pathname}${Vw.search}${Vw.hash}`)),_p(),op();var Hw=document.getElementById(`root`);Hw&&(0,ht.createRoot)(Hw).render((0,K.jsx)(H.StrictMode,{children:(0,K.jsx)(zw,{api:zt})}));export{jd as $,Kp as A,$d as B,Tm as C,hs as Ct,Wp as D,im as E,Tf as F,Kd as G,tf as H,Q as I,Id as J,Bd as K,af as L,jf as M,bf as N,qp as O,xf as P,X as Q,Xd as R,wm as S,xs as St,$ as T,gt as Tt,Zd as U,rf as V,Qd as W,kd as X,Fd as Y,Nd as Z,hh as _,Zs as _t,bv as a,Ed as at,Rm as b,Ts as bt,Zg as c,Du as ct,zh as d,Cl as dt,Z as et,Ih as f,xl as ft,vh as g,dc as gt,gh as h,hc as ht,Ey as i,Od as it,vp as j,Gp as k,Yg as l,ql as lt,_h as m,kc as mt,sS as n,Cd as nt,qg as o,Td as ot,wh as p,_l as pt,Pd as q,oS as r,wd as rt,Xg as s,Dd as st,vC as t,Md as tt,Jg as u,Dl as ut,yh as v,ks as vt,Dm as w,ds as wt,Em as x,Cs as xt,uh as y,Ds as yt,nf as z};
|