cezarion 0.18.0-dev.8338 → 0.18.0-dev.8347
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/web/dist/assets/accounts-section-D3rKSj1e.js +1 -0
- package/web/dist/assets/{activity-motion-wGHBuD_L.js → activity-motion-CFgok4CI.js} +1 -1
- package/web/dist/assets/{activity-route-BhT-npje.js → activity-route-HvdWBepL.js} +1 -1
- package/web/dist/assets/{agent-config-section-BIkW506A.js → agent-config-section-DbmhTCJA.js} +2 -2
- package/web/dist/assets/agent-defaults-section-5fBA2FMV.js +1 -0
- package/web/dist/assets/{appearance-CipbKN5k.js → appearance-ZpysBpxH.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-Dx8afb0D.js → archive-on-merge-field-BlGo3o7a.js} +1 -1
- package/web/dist/assets/attention-CvHM4cjG.js +1 -0
- package/web/dist/assets/{automations-route-DKKwkBjL.js → automations-route-aINxoEQX.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-OqVigspU.js → commit-diff-panel-BzAqXG0p.js} +1 -1
- package/web/dist/assets/{diff-CpkjO5Q-.js → diff-lVUk7FAR.js} +2 -2
- package/web/dist/assets/{diff-view-D6QC4z_i.js → diff-view-B5RGiepv.js} +1 -1
- package/web/dist/assets/{file-preview-C-oYrG0r.js → file-preview-Bn5u5k1W.js} +1 -1
- package/web/dist/assets/{folder-browser-DJd_sQFq.js → folder-browser-CffyHz8w.js} +1 -1
- package/web/dist/assets/{git-toolbar-BiWUXSvy.js → git-toolbar-xLFz5nnr.js} +1 -1
- package/web/dist/assets/{github-DSZtAYK0.js → github-DxiILmDg.js} +1 -1
- package/web/dist/assets/{global-activity-route-ylV7sfQb.js → global-activity-route-BmqMaZug.js} +1 -1
- package/web/dist/assets/index-DndX-kC-.js +21 -0
- package/web/dist/assets/{label-HRVFTN4V.js → label-6PgIe3Ny.js} +1 -1
- package/web/dist/assets/{live-reads-Djkq38NT.js → live-reads-BxjlQXfN.js} +1 -1
- package/web/dist/assets/{markdown-Drj1MCd_.js → markdown-DHYxiDex.js} +1 -1
- package/web/dist/assets/{notifications-section-BNncS89W.js → notifications-section-xHvjaRxV.js} +1 -1
- package/web/dist/assets/{open-in-menu-BeAj_aq3.js → open-in-menu-AZMtej8C.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-C9bYs_nr.js → preview-pane-connected-C5Lsjf2P.js} +2 -2
- package/web/dist/assets/{project-location-DJEH4PmN.js → project-location-DzOgHfcA.js} +1 -1
- package/web/dist/assets/{project-router-C6zhlnwO.js → project-router-CDPfL2Jz.js} +1 -1
- package/web/dist/assets/{project-scope-context-d3J3hWPR.js → project-scope-context-D9axDY18.js} +2 -2
- package/web/dist/assets/{projects-section-DAyPYxaB.js → projects-section-0ov7IK9p.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-BUTjHN-R.js → prompt-templates-section-DgLWN4ZB.js} +1 -1
- package/web/dist/assets/{queries-dnpdX9VT.js → queries-DzwCG927.js} +1 -1
- package/web/dist/assets/{reference-chip-DHWnJcWz.js → reference-chip-BnIoiMgY.js} +1 -1
- package/web/dist/assets/remote-settings-notice-kmlL_JEi.js +1 -0
- package/web/dist/assets/{repo-git-CahuM1Bi.js → repo-git-D-L0KYwh.js} +1 -1
- package/web/dist/assets/{report-reader-BMw7TyID.js → report-reader-Fb02sGC6.js} +1 -1
- package/web/dist/assets/{reports-BqhgWSM-.js → reports--yxm1Dbp.js} +1 -1
- package/web/dist/assets/{resources-section-CPdErsDL.js → resources-section-CZu7afz7.js} +1 -1
- package/web/dist/assets/run-header-Bajufo9w.js +2 -0
- package/web/dist/assets/settings-agent-picker-XdHS0cXP.js +1 -0
- package/web/dist/assets/{settings-shell-Cg1j_HUU.js → settings-shell-63smMna1.js} +1 -1
- package/web/dist/assets/{sidebar-section-C7mKySo9.js → sidebar-section-Dgf9Tda6.js} +1 -1
- package/web/dist/assets/{skills-DL6gTurZ.js → skills-CVoGqJeT.js} +1 -1
- package/web/dist/assets/{tab-link-Cq8g7cFx.js → tab-link-BaKE6KnE.js} +1 -1
- package/web/dist/assets/{task-changes-BYdPYqmr.js → task-changes-Cd30VNwk.js} +1 -1
- package/web/dist/assets/{task-commits-CZs64PxA.js → task-commits-33kwaiVP.js} +1 -1
- package/web/dist/assets/{task-files-CHDvZdch.js → task-files-W2NkAX0s.js} +1 -1
- package/web/dist/assets/{task-github-item-BaAS8tc7.js → task-github-item-C7dEQxMN.js} +1 -1
- package/web/dist/assets/{task-groups-BF7_ZZTh.js → task-groups-DoiPFEfM.js} +1 -1
- package/web/dist/assets/{task-thread-DKTYTRYk.js → task-thread-Bi5cKYmZ.js} +6 -6
- package/web/dist/assets/{tasks-table-CzLkD-kr.js → tasks-table-CmESFng9.js} +1 -1
- package/web/dist/assets/{thread-state-Cnu6irf1.js → thread-state-DI7JLoTx.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-C0HmC08K.js → use-hand-to-agent-state-B869bBKO.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-qJcgwcf9.js → useInfiniteQuery-GZp9laKm.js} +1 -1
- package/web/dist/assets/useQuery-CzVHT8UE.js +1 -0
- package/web/dist/assets/{workflows-BxrHkrIx.js → workflows-CeRdeF9n.js} +3 -3
- package/web/dist/assets/{workspace-tools-DK0GgizV.js → workspace-tools-YqTAoyv7.js} +1 -1
- package/web/dist/assets/{worktrees-section-CBWXq2mc.js → worktrees-section-9fwC5DGp.js} +1 -1
- package/web/dist/index.html +14 -14
- package/web/dist/assets/accounts-section-qnA3YX9G.js +0 -1
- package/web/dist/assets/agent-defaults-section-D9oxRh7t.js +0 -1
- package/web/dist/assets/attention-VcsXbAZz.js +0 -1
- package/web/dist/assets/index-CS5yyNbo.js +0 -21
- package/web/dist/assets/remote-settings-notice-BTtluTx2.js +0 -1
- package/web/dist/assets/run-header-BpdSJ6lc.js +0 -2
- package/web/dist/assets/settings-agent-picker-By-EZVYH.js +0 -1
- package/web/dist/assets/useQuery-CkUPLiaa.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./utils-DSMR_WLb.js";import{ci as a,nn as o}from"./project-scope-context-d3J3hWPR.js";import{At as s,Ft as c,Mt as l,Pt as u,Rt as d,in as f,vt as p,wt as m}from"./queries-dnpdX9VT.js";import{n as h}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as g}from"./toaster-Bo5vCbz-.js";import{O as _,ft as v}from"./design-icons-CzEoMH9c.js";import{t as y}from"./button-BQ2y4XRB.js";import{n as b,r as x,t as S}from"./popover-BPgUYFyu.js";import{t as C}from"./centered-state-V15AR_qo.js";import{Gn as w,Gt as T,Ht as E,Jt as D,Kt as O,Ut as k,Vt as A,Wt as j,qt as M}from"./index-CS5yyNbo.js";import{t as N}from"./settings-field-Bl6WuvGX.js";var P=t(n(),1),F=r();function I(){let e=m();return{isPending:e.isPending,confirm:(t,n)=>e.mutate(t.id,{onSuccess:()=>{g(`${t.name} removed from the workspace — its files are untouched`),n?.()},onError:e=>g(e.message,{tone:`danger`})})}}function L({project:e,onOpenChange:t,onConfirm:n}){return(0,F.jsx)(A,{open:e!==null,onOpenChange:t,children:(0,F.jsxs)(j,{children:[(0,F.jsxs)(M,{children:[(0,F.jsxs)(D,{children:[`Remove `,e?.name,` from the workspace?`]}),(0,F.jsxs)(T,{children:[`This only unregisters the project — `,(0,F.jsx)(`strong`,{children:`nothing on disk is deleted`}),`. The folder, its git history and its task history all stay exactly where they are, and opening it again re-registers it with everything intact.`,(0,F.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[11px] text-foreground`,title:e?.root,children:e?.root})]})]}),(0,F.jsxs)(O,{children:[(0,F.jsx)(k,{children:`Keep it`}),(0,F.jsx)(E,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:n,children:`Remove from list`})]})]})})}var R=e({MaxParallelSelect:()=>J,ProjectTagsEditor:()=>q,ProjectsSection:()=>H,STATUS_LABEL:()=>B}),z=1,B={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function V(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function H(){let e=l(),t=p();return e.isPending||t.isPending?(0,F.jsx)(`p`,{"data-slot":`projects-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading projects…`}):e.isError||t.isError?(0,F.jsx)(C,{icon:(0,F.jsx)(_,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,F.jsx)(U,{config:e.data,registry:t.data})}function U({config:e,registry:t}){let[n,r]=(0,P.useState)(!1);return(0,F.jsxs)(`div`,{"data-slot":`projects-section`,className:`mx-auto flex w-full max-w-4xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,F.jsx)(W,{configKey:`browseRoot`,value:e.browseRoot,title:`Default browse folder`,hint:`Where “Open local folder…” starts. The picker cannot navigate above this folder.`,placeholder:`~/`,slot:`browse`,savedLabel:`Browse folder`,footer:`Only affects folder browsing; GitHub checkouts use the separate checkout folder.`}),(0,F.jsx)(W,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” puts new projects: <folder>/<project name>.`,placeholder:`~/cezar/projects`,slot:`checkout`,savedLabel:`Checkout folder`,footer:`Only affects new checkouts; projects already registered keep their location.`,refreshProjects:!0}),(0,F.jsx)(G,{registry:t,workspaceMax:e.resources.maxParallel}),(0,F.jsx)(y,{className:`self-start`,onClick:()=>r(!0),children:`Add project`}),n?(0,F.jsx)(w,{open:!0,onOpenChange:r}):null]})}function W({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:s,savedLabel:c,footer:l,refreshProjects:u=!1}){let p=a(),m=f({mutationFn:t=>o(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{p.setQueryData(d.config,t),e===`browseRoot`?p.invalidateQueries({queryKey:d.fsBrowseRoot}):u&&p.invalidateQueries({queryKey:d.projects})}}),[h,_]=(0,P.useState)(t),v=h.trim(),b=v===t,x=m.isError?m.error.message:null;return(0,F.jsxs)(N,{title:n,hint:`${r} ${e===`browseRoot`?`Choose an existing folder; it is verified writable before saving.`:`The folder is created recursively if needed, then verified writable before saving.`}`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`input`,{type:`text`,spellCheck:!1,"aria-label":n,"aria-invalid":x!==null,"data-slot":`projects-${s}-root`,value:h,disabled:m.isPending,placeholder:i,onChange:e=>{_(e.target.value),m.isError&&m.reset()},className:`block w-full max-w-sm rounded-md border border-input bg-card px-3 py-1.5 font-mono text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-danger disabled:opacity-50`}),(0,F.jsx)(y,{type:`button`,variant:`outline`,size:`sm`,"data-action":`projects-save-${s}-root`,disabled:b||v===``||m.isPending,onClick:()=>m.mutate(v,{onSuccess:()=>g(`${c} set to ${v}`)}),children:`Save`})]}),x===null?(0,F.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:l}):(0,F.jsxs)(`p`,{"data-slot":`projects-${s}-root-error`,role:`alert`,className:`text-[11px] text-danger`,children:[x,` — setting unchanged`]})]})}function G({registry:e,workspaceMax:t}){let[n,r]=(0,P.useState)(null),i=I(),a=(0,P.useMemo)(()=>u(e.projects),[e.projects]);return(0,F.jsxs)(N,{title:`Registered projects`,hint:`Connected repositories. Removing a project only unregisters it — no files on disk are deleted.`,children:[e.projects.length===0?(0,F.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}):(0,F.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,F.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,F.jsx)(`caption`,{className:`sr-only`,children:`Projects registered in this workspace`}),(0,F.jsxs)(`colgroup`,{children:[(0,F.jsx)(`col`,{}),(0,F.jsx)(`col`,{style:{width:`104px`}}),(0,F.jsx)(`col`,{style:{width:`260px`}}),(0,F.jsx)(`col`,{style:{width:`150px`}}),(0,F.jsx)(`col`,{style:{width:`72px`}}),(0,F.jsx)(`col`,{style:{width:`92px`}})]}),(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,F.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Tags`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,F.jsx)(`tbody`,{children:e.projects.map(n=>(0,F.jsx)(K,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,vocabulary:a,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,F.jsx)(L,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{if(!n)return;let e=n;r(null),i.confirm(e)}})]})}function K({project:e,isBoot:t,workspaceMax:n,vocabulary:r,disabled:i,onRemove:a}){return(0,F.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,F.jsxs)(`th`,{scope:`row`,className:`max-w-0 px-3 py-2 text-left font-normal`,children:[(0,F.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,F.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,title:e.root,children:e.root})]}),(0,F.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,F.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-[12px] text-danger`:`text-[12px] text-soft-foreground`,children:B[e.status]}),e.status===`missing`?null:(0,F.jsxs)(`span`,{className:`ml-1 text-[11px] text-soft-foreground`,children:[`· `,e.source]})]}),(0,F.jsx)(`td`,{className:`px-3 py-2`,children:(0,F.jsx)(q,{project:e,vocabulary:r})}),(0,F.jsx)(`td`,{className:`px-3 py-2`,children:(0,F.jsx)(J,{project:e,workspaceMax:n})}),(0,F.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:V(e.addedAt)}),(0,F.jsxs)(`td`,{className:`px-3 py-2 text-right`,children:[e.status===`missing`?null:(0,F.jsx)(y,{asChild:!0,variant:`outline`,className:`mr-2`,children:(0,F.jsx)(h,{to:`/p/${encodeURIComponent(e.id)}`,children:`Open`})}),(0,F.jsx)(y,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:t?`Squawk is serving this project — it re-registers itself at every start`:void 0,disabled:i||t,onClick:a,children:`Remove`})]})]})}function q({project:e,vocabulary:t}){let n=s(),[r,a]=(0,P.useState)(``),[o,l]=(0,P.useState)(!1),[u,d]=(0,P.useState)(-1),f=(0,P.useRef)(null),p=e.tags??[],m=c(t,p,r),h=o&&m.length>0,_=(t,r)=>{n.mutate({id:e.id,tags:t},{onSuccess:()=>g(r),onError:e=>g(e.message,{tone:`danger`})})},y=t=>{let n=t.trim().slice(0,32);if(d(-1),n){if(p.some(e=>e.toLowerCase()===n.toLowerCase())){a(``);return}if(p.length>=20){g(`${e.name} already has the maximum of 20 tags`,{tone:`danger`});return}a(``),_([...p,n],`${e.name} tagged \u201c${n}\u201d`)}},C=t=>{_(p.filter(e=>e!==t),`\u201c${t}\u201d removed from ${e.name}`)},w=`project-tag-suggestions-${e.id}`;return(0,F.jsxs)(`div`,{"data-slot":`project-tags`,className:`flex flex-wrap items-center gap-1`,children:[p.map(t=>(0,F.jsxs)(`span`,{"data-slot":`project-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full bg-accent-strong/15 py-px pr-1 pl-2 text-[11px] font-medium whitespace-nowrap text-accent-text`,children:[t,(0,F.jsx)(`button`,{type:`button`,"data-action":`project-tag-remove`,"aria-label":`Remove tag ${t} from ${e.name}`,disabled:n.isPending,onClick:()=>C(t),className:`rounded-full p-0.5 hover:bg-accent-strong/25 disabled:opacity-50`,children:(0,F.jsx)(v,{className:`size-3`,"aria-hidden":`true`})})]},t)),(0,F.jsxs)(S,{open:h,onOpenChange:l,children:[(0,F.jsx)(b,{asChild:!0,children:(0,F.jsx)(`input`,{ref:f,type:`text`,"data-slot":`project-tag-input`,"aria-label":`Add a tag to ${e.name}`,role:`combobox`,"aria-expanded":h,"aria-controls":h?w:void 0,"aria-autocomplete":`list`,"aria-activedescendant":h&&u>=0?`${w}-${u}`:void 0,placeholder:p.length===0?`Add tag…`:`+`,value:r,maxLength:32,disabled:n.isPending,onFocus:()=>l(!0),onBlur:()=>l(!1),onChange:e=>{if(l(!0),d(-1),e.target.value.includes(`,`)){a(e.target.value.replace(/,/g,``));return}a(e.target.value)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(m.length===0)return;e.preventDefault(),l(!0);let t=e.key===`ArrowDown`?1:-1,n=u+t;d(n>=m.length?-1:n<-1?m.length-1:n);return}if(e.key===`Escape`&&h){e.preventDefault(),l(!1),d(-1);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),y(u>=0?m[u]??r:r);return}if(e.key===`Tab`){l(!1);return}if(e.key===`Backspace`&&r===``&&p.length>0){e.preventDefault();let t=p[p.length-1];t!==void 0&&C(t)}},className:`h-6 w-16 min-w-0 flex-1 rounded-md border border-input bg-card px-1.5 text-[12px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})}),(0,F.jsxs)(x,{align:`start`,sideOffset:4,id:w,role:`listbox`,"data-slot":`project-tag-suggestions`,className:`w-56 p-1`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,F.jsx)(`p`,{className:`px-2 pt-1 pb-1.5 text-[11px] text-soft-foreground`,children:`Tags used in this workspace`}),m.map((e,t)=>(0,F.jsx)(`button`,{type:`button`,id:`${w}-${t}`,role:`option`,"aria-selected":t===u,"data-slot":`project-tag-suggestion`,onMouseDown:e=>e.preventDefault(),onClick:()=>{y(e),f.current?.focus()},onMouseEnter:()=>d(t),className:i(`flex w-full items-center rounded-sm px-2 py-1 text-left text-[12px] font-medium text-accent-text`,t===u&&`bg-muted`),children:e},e))]})]})]})}function J({project:e,workspaceMax:t}){let n=s(),r=e.maxParallel===void 0?``:String(e.maxParallel);return(0,F.jsxs)(`select`,{"aria-label":`Max parallel tasks for ${e.name}`,"data-slot":`project-max-parallel`,value:r,disabled:n.isPending,onChange:r=>{let i=r.target.value,a=i===``?null:Number(i);n.mutate({id:e.id,maxParallel:a},{onSuccess:()=>g(a===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${a} task${a===1?``:`s`} at a time`),onError:e=>g(e.message,{tone:`danger`})})},className:`block w-44 rounded-md border border-input bg-card px-2 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,F.jsxs)(`option`,{value:``,children:[`Inherit workspace (`,t,`)`]}),Array.from({length:16},(e,t)=>t+z).map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))]})}export{I as a,L as i,B as n,R as r,J as t};
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./utils-DSMR_WLb.js";import{ci as a,nn as o}from"./project-scope-context-D9axDY18.js";import{At as s,Ft as c,Mt as l,Pt as u,Rt as d,in as f,vt as p,wt as m}from"./queries-DzwCG927.js";import{n as h}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as g}from"./toaster-Bo5vCbz-.js";import{O as _,ft as v}from"./design-icons-CzEoMH9c.js";import{t as y}from"./button-BQ2y4XRB.js";import{n as b,r as x,t as S}from"./popover-BPgUYFyu.js";import{t as C}from"./centered-state-V15AR_qo.js";import{Gt as w,Ht as T,Jt as E,Kn as D,Kt as O,Ut as k,Vt as A,Wt as j,qt as M}from"./index-DndX-kC-.js";import{t as N}from"./settings-field-Bl6WuvGX.js";var P=t(n(),1),F=r();function I(){let e=m();return{isPending:e.isPending,confirm:(t,n)=>e.mutate(t.id,{onSuccess:()=>{g(`${t.name} removed from the workspace — its files are untouched`),n?.()},onError:e=>g(e.message,{tone:`danger`})})}}function L({project:e,onOpenChange:t,onConfirm:n}){return(0,F.jsx)(A,{open:e!==null,onOpenChange:t,children:(0,F.jsxs)(j,{children:[(0,F.jsxs)(M,{children:[(0,F.jsxs)(E,{children:[`Remove `,e?.name,` from the workspace?`]}),(0,F.jsxs)(w,{children:[`This only unregisters the project — `,(0,F.jsx)(`strong`,{children:`nothing on disk is deleted`}),`. The folder, its git history and its task history all stay exactly where they are, and opening it again re-registers it with everything intact.`,(0,F.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[11px] text-foreground`,title:e?.root,children:e?.root})]})]}),(0,F.jsxs)(O,{children:[(0,F.jsx)(k,{children:`Keep it`}),(0,F.jsx)(T,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:n,children:`Remove from list`})]})]})})}var R=e({MaxParallelSelect:()=>J,ProjectTagsEditor:()=>q,ProjectsSection:()=>H,STATUS_LABEL:()=>B}),z=1,B={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function V(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function H(){let e=l(),t=p();return e.isPending||t.isPending?(0,F.jsx)(`p`,{"data-slot":`projects-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading projects…`}):e.isError||t.isError?(0,F.jsx)(C,{icon:(0,F.jsx)(_,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,F.jsx)(U,{config:e.data,registry:t.data})}function U({config:e,registry:t}){let[n,r]=(0,P.useState)(!1);return(0,F.jsxs)(`div`,{"data-slot":`projects-section`,className:`mx-auto flex w-full max-w-4xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,F.jsx)(W,{configKey:`browseRoot`,value:e.browseRoot,title:`Default browse folder`,hint:`Where “Open local folder…” starts. The picker cannot navigate above this folder.`,placeholder:`~/`,slot:`browse`,savedLabel:`Browse folder`,footer:`Only affects folder browsing; GitHub checkouts use the separate checkout folder.`}),(0,F.jsx)(W,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” puts new projects: <folder>/<project name>.`,placeholder:`~/cezar/projects`,slot:`checkout`,savedLabel:`Checkout folder`,footer:`Only affects new checkouts; projects already registered keep their location.`,refreshProjects:!0}),(0,F.jsx)(G,{registry:t,workspaceMax:e.resources.maxParallel}),(0,F.jsx)(y,{className:`self-start`,onClick:()=>r(!0),children:`Add project`}),n?(0,F.jsx)(D,{open:!0,onOpenChange:r}):null]})}function W({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:s,savedLabel:c,footer:l,refreshProjects:u=!1}){let p=a(),m=f({mutationFn:t=>o(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{p.setQueryData(d.config,t),e===`browseRoot`?p.invalidateQueries({queryKey:d.fsBrowseRoot}):u&&p.invalidateQueries({queryKey:d.projects})}}),[h,_]=(0,P.useState)(t),v=h.trim(),b=v===t,x=m.isError?m.error.message:null;return(0,F.jsxs)(N,{title:n,hint:`${r} ${e===`browseRoot`?`Choose an existing folder; it is verified writable before saving.`:`The folder is created recursively if needed, then verified writable before saving.`}`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`input`,{type:`text`,spellCheck:!1,"aria-label":n,"aria-invalid":x!==null,"data-slot":`projects-${s}-root`,value:h,disabled:m.isPending,placeholder:i,onChange:e=>{_(e.target.value),m.isError&&m.reset()},className:`block w-full max-w-sm rounded-md border border-input bg-card px-3 py-1.5 font-mono text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-danger disabled:opacity-50`}),(0,F.jsx)(y,{type:`button`,variant:`outline`,size:`sm`,"data-action":`projects-save-${s}-root`,disabled:b||v===``||m.isPending,onClick:()=>m.mutate(v,{onSuccess:()=>g(`${c} set to ${v}`)}),children:`Save`})]}),x===null?(0,F.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:l}):(0,F.jsxs)(`p`,{"data-slot":`projects-${s}-root-error`,role:`alert`,className:`text-[11px] text-danger`,children:[x,` — setting unchanged`]})]})}function G({registry:e,workspaceMax:t}){let[n,r]=(0,P.useState)(null),i=I(),a=(0,P.useMemo)(()=>u(e.projects),[e.projects]);return(0,F.jsxs)(N,{title:`Registered projects`,hint:`Connected repositories. Removing a project only unregisters it — no files on disk are deleted.`,children:[e.projects.length===0?(0,F.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}):(0,F.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,F.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,F.jsx)(`caption`,{className:`sr-only`,children:`Projects registered in this workspace`}),(0,F.jsxs)(`colgroup`,{children:[(0,F.jsx)(`col`,{}),(0,F.jsx)(`col`,{style:{width:`104px`}}),(0,F.jsx)(`col`,{style:{width:`260px`}}),(0,F.jsx)(`col`,{style:{width:`150px`}}),(0,F.jsx)(`col`,{style:{width:`72px`}}),(0,F.jsx)(`col`,{style:{width:`92px`}})]}),(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,F.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Tags`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,F.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,F.jsx)(`tbody`,{children:e.projects.map(n=>(0,F.jsx)(K,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,vocabulary:a,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,F.jsx)(L,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{if(!n)return;let e=n;r(null),i.confirm(e)}})]})}function K({project:e,isBoot:t,workspaceMax:n,vocabulary:r,disabled:i,onRemove:a}){return(0,F.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,F.jsxs)(`th`,{scope:`row`,className:`max-w-0 px-3 py-2 text-left font-normal`,children:[(0,F.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,F.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,title:e.root,children:e.root})]}),(0,F.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,F.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-[12px] text-danger`:`text-[12px] text-soft-foreground`,children:B[e.status]}),e.status===`missing`?null:(0,F.jsxs)(`span`,{className:`ml-1 text-[11px] text-soft-foreground`,children:[`· `,e.source]})]}),(0,F.jsx)(`td`,{className:`px-3 py-2`,children:(0,F.jsx)(q,{project:e,vocabulary:r})}),(0,F.jsx)(`td`,{className:`px-3 py-2`,children:(0,F.jsx)(J,{project:e,workspaceMax:n})}),(0,F.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:V(e.addedAt)}),(0,F.jsxs)(`td`,{className:`px-3 py-2 text-right`,children:[e.status===`missing`?null:(0,F.jsx)(y,{asChild:!0,variant:`outline`,className:`mr-2`,children:(0,F.jsx)(h,{to:`/p/${encodeURIComponent(e.id)}`,children:`Open`})}),(0,F.jsx)(y,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:t?`Squawk is serving this project — it re-registers itself at every start`:void 0,disabled:i||t,onClick:a,children:`Remove`})]})]})}function q({project:e,vocabulary:t}){let n=s(),[r,a]=(0,P.useState)(``),[o,l]=(0,P.useState)(!1),[u,d]=(0,P.useState)(-1),f=(0,P.useRef)(null),p=e.tags??[],m=c(t,p,r),h=o&&m.length>0,_=(t,r)=>{n.mutate({id:e.id,tags:t},{onSuccess:()=>g(r),onError:e=>g(e.message,{tone:`danger`})})},y=t=>{let n=t.trim().slice(0,32);if(d(-1),n){if(p.some(e=>e.toLowerCase()===n.toLowerCase())){a(``);return}if(p.length>=20){g(`${e.name} already has the maximum of 20 tags`,{tone:`danger`});return}a(``),_([...p,n],`${e.name} tagged \u201c${n}\u201d`)}},C=t=>{_(p.filter(e=>e!==t),`\u201c${t}\u201d removed from ${e.name}`)},w=`project-tag-suggestions-${e.id}`;return(0,F.jsxs)(`div`,{"data-slot":`project-tags`,className:`flex flex-wrap items-center gap-1`,children:[p.map(t=>(0,F.jsxs)(`span`,{"data-slot":`project-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full bg-accent-strong/15 py-px pr-1 pl-2 text-[11px] font-medium whitespace-nowrap text-accent-text`,children:[t,(0,F.jsx)(`button`,{type:`button`,"data-action":`project-tag-remove`,"aria-label":`Remove tag ${t} from ${e.name}`,disabled:n.isPending,onClick:()=>C(t),className:`rounded-full p-0.5 hover:bg-accent-strong/25 disabled:opacity-50`,children:(0,F.jsx)(v,{className:`size-3`,"aria-hidden":`true`})})]},t)),(0,F.jsxs)(S,{open:h,onOpenChange:l,children:[(0,F.jsx)(b,{asChild:!0,children:(0,F.jsx)(`input`,{ref:f,type:`text`,"data-slot":`project-tag-input`,"aria-label":`Add a tag to ${e.name}`,role:`combobox`,"aria-expanded":h,"aria-controls":h?w:void 0,"aria-autocomplete":`list`,"aria-activedescendant":h&&u>=0?`${w}-${u}`:void 0,placeholder:p.length===0?`Add tag…`:`+`,value:r,maxLength:32,disabled:n.isPending,onFocus:()=>l(!0),onBlur:()=>l(!1),onChange:e=>{if(l(!0),d(-1),e.target.value.includes(`,`)){a(e.target.value.replace(/,/g,``));return}a(e.target.value)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(m.length===0)return;e.preventDefault(),l(!0);let t=e.key===`ArrowDown`?1:-1,n=u+t;d(n>=m.length?-1:n<-1?m.length-1:n);return}if(e.key===`Escape`&&h){e.preventDefault(),l(!1),d(-1);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),y(u>=0?m[u]??r:r);return}if(e.key===`Tab`){l(!1);return}if(e.key===`Backspace`&&r===``&&p.length>0){e.preventDefault();let t=p[p.length-1];t!==void 0&&C(t)}},className:`h-6 w-16 min-w-0 flex-1 rounded-md border border-input bg-card px-1.5 text-[12px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})}),(0,F.jsxs)(x,{align:`start`,sideOffset:4,id:w,role:`listbox`,"data-slot":`project-tag-suggestions`,className:`w-56 p-1`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,F.jsx)(`p`,{className:`px-2 pt-1 pb-1.5 text-[11px] text-soft-foreground`,children:`Tags used in this workspace`}),m.map((e,t)=>(0,F.jsx)(`button`,{type:`button`,id:`${w}-${t}`,role:`option`,"aria-selected":t===u,"data-slot":`project-tag-suggestion`,onMouseDown:e=>e.preventDefault(),onClick:()=>{y(e),f.current?.focus()},onMouseEnter:()=>d(t),className:i(`flex w-full items-center rounded-sm px-2 py-1 text-left text-[12px] font-medium text-accent-text`,t===u&&`bg-muted`),children:e},e))]})]})]})}function J({project:e,workspaceMax:t}){let n=s(),r=e.maxParallel===void 0?``:String(e.maxParallel);return(0,F.jsxs)(`select`,{"aria-label":`Max parallel tasks for ${e.name}`,"data-slot":`project-max-parallel`,value:r,disabled:n.isPending,onChange:r=>{let i=r.target.value,a=i===``?null:Number(i);n.mutate({id:e.id,maxParallel:a},{onSuccess:()=>g(a===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${a} task${a===1?``:`s`} at a time`),onError:e=>g(e.message,{tone:`danger`})})},className:`block w-44 rounded-md border border-input bg-card px-2 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,F.jsxs)(`option`,{value:``,children:[`Inherit workspace (`,t,`)`]}),Array.from({length:16},(e,t)=>t+z).map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))]})}export{I as a,L as i,B as n,R as r,J as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{ci as i,j as a}from"./project-scope-context-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{ci as i,j as a}from"./project-scope-context-D9axDY18.js";import{E as o,Lt as s,Vt as c,in as l}from"./queries-DzwCG927.js";import{n as u}from"./toaster-Bo5vCbz-.js";import{J as d,W as f,c as p,ft as m,l as h,tt as g}from"./design-icons-CzEoMH9c.js";import{t as _}from"./button-BQ2y4XRB.js";import{i as v,r as y,t as b}from"./popover-BPgUYFyu.js";import{a as x,i as S,o as C,r as w,s as T,t as E}from"./command-CDt1BsZy.js";import{f as D,i as O,p as k,u as A}from"./skills-pM_PouEs.js";import{t as j}from"./centered-state-V15AR_qo.js";import{Gn as M,Q as N,_n as P,at as F,nt as I,tt as L}from"./index-DndX-kC-.js";import{t as R}from"./textarea-vJt9undk.js";import{n as z,t as B}from"./saved-draft-BwzBc-_Y.js";var V=e(t(),1),H=n();function U(){let e=o();return e.isPending?(0,H.jsx)(`p`,{"data-slot":`prompt-templates-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading prompt templates…`}):e.isError?(0,H.jsx)(j,{icon:(0,H.jsx)(f,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,H.jsx)(W,{initial:I(e.data.promptTemplates)})}function W({initial:e}){let t=i(),n=c(),r=o(),[f,p]=z(e,B),[h,g]=(0,V.useState)(``),[v,y]=(0,V.useState)(``),b=l({mutationFn:e=>a({promptTemplates:e}),onSuccess:(e,n)=>{t.setQueryData(s.uiState,e),p(t=>B(t,n)?I(e.promptTemplates):t),u(`Prompt templates saved`)},onError:e=>u(e.message,{tone:`danger`})}),x=JSON.stringify(f)!==JSON.stringify(e),S=h.trim()!==``||v.trim()!==``;P(x||S);let C=f.some(e=>e.label.trim()===``||e.text.trim()===``),w=(e,t)=>p(n=>n.map(n=>n.id===e?{...n,...t}:n)),T=(e,t)=>p(n=>n.map(n=>{if(n.id!==e)return n;let r=n.skills??[],i=r.includes(t)?r.filter(e=>e!==t):[...r,t],{skills:a,...o}=n;return i.length>0?{...o,skills:i}:o})),E=e=>p(t=>t.filter(t=>t.id!==e));return(0,H.jsx)(`div`,{"data-slot":`prompt-templates-section`,"data-reports-dirty":``,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,H.jsxs)(K,{title:`Reusable instructions`,hint:`Insert templates from task composers, or apply them automatically with selected skills when the prompt is empty.`,children:[(0,H.jsx)(`div`,{"data-slot":`prompt-template-list`,className:`flex flex-col gap-3`,children:f.length===0?(0,H.jsx)(`p`,{"data-slot":`prompt-templates-empty`,className:`text-[13px] text-soft-foreground`,children:`No templates. Add one below, or reset to the built-ins.`}):f.map(e=>(0,H.jsxs)(`div`,{"data-slot":`prompt-template-row`,"data-template":e.id,className:`flex flex-col gap-1.5 rounded-md border border-border bg-card p-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`label`,{htmlFor:`template-label-${e.id}`,className:`text-sm`,children:`Template label`}),(0,H.jsx)(M,{id:`template-label-${e.id}`,"aria-label":`Label for ${e.label||`this template`}`,"data-slot":`prompt-template-label-input`,value:e.label,maxLength:80,onChange:t=>w(e.id,{label:t.target.value}),className:`flex-1`})]}),(0,H.jsx)(`label`,{htmlFor:`template-text-${e.id}`,className:`text-sm`,children:`Instructions`}),(0,H.jsx)(R,{id:`template-text-${e.id}`,"aria-label":`Text for ${e.label||`this template`}`,"data-slot":`prompt-template-text-input`,value:e.text,maxLength:2e3,onChange:t=>w(e.id,{text:t.target.value}),className:`min-h-14 text-[13px]`}),(0,H.jsx)(`p`,{className:`mt-3 text-sm`,children:`Apply automatically with skills`}),(0,H.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,H.jsx)(G,{label:e.label,skills:n.data??[],skillUsage:r.data?.skillUsage,selected:e.skills??[],onToggle:t=>T(e.id,t)}),(e.skills??[]).map(t=>(0,H.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skill-chip`,"data-skill":t,title:`Stop applying “${e.label}” automatically with ${t}`,onClick:()=>T(e.id,t),className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[t,(0,H.jsx)(m,{"aria-hidden":`true`,className:`size-3`})]},t))]}),(0,H.jsx)(_,{type:`button`,className:`self-start`,variant:`outline`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>E(e.id),children:`Delete template`})]},e.id))}),(0,H.jsxs)(`div`,{"data-slot":`prompt-template-new`,className:`flex flex-col gap-1.5 rounded-md border border-dashed border-border p-3`,children:[(0,H.jsx)(`h3`,{className:`text-lg`,children:`New template`}),(0,H.jsx)(`label`,{htmlFor:`new-template-label`,className:`text-sm`,children:`Label`}),(0,H.jsx)(M,{id:`new-template-label`,"aria-label":`New template label`,"data-slot":`prompt-template-new-label`,placeholder:`e.g. Review security`,value:h,maxLength:80,onChange:e=>g(e.target.value)}),(0,H.jsx)(`label`,{htmlFor:`new-template-text`,className:`text-sm`,children:`Instructions to insert`}),(0,H.jsx)(R,{id:`new-template-text`,"aria-label":`New template text`,"data-slot":`prompt-template-new-text`,placeholder:`Enter reusable instructions…`,value:v,maxLength:2e3,onChange:e=>y(e.target.value),className:`min-h-14 text-[13px]`}),(0,H.jsxs)(_,{type:`button`,variant:`outline`,size:`sm`,"data-action":`prompt-template-add`,disabled:!h.trim()||!v.trim(),onClick:()=>{let e=h.trim(),t=v.trim();!e||!t||(p(n=>[...n,{id:L(),label:e,text:t}]),g(``),y(``))},className:`self-start`,children:[(0,H.jsx)(d,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(_,{type:`button`,variant:`primary`,size:`sm`,"data-action":`prompt-templates-save`,disabled:!x||C||b.isPending,onClick:()=>b.mutate(f),children:`Save`}),(0,H.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:b.isPending,onClick:()=>p(N.map(e=>({...e}))),children:`Reset to defaults`}),C?(0,H.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-[11px] text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function G({label:e,skills:t,skillUsage:n,selected:i,onToggle:a}){let[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(``),u=(0,V.useRef)(null),{mostUsed:d,project:f,global:m,ranked:_}=A(t,c,n),j=(e,t)=>{let n=i.includes(e.id);return(0,H.jsxs)(C,{value:D(e),keywords:k(e.name,e.description),"data-slot":`prompt-template-skill-option`,"data-skill":e.id,"data-selected":n?`true`:void 0,onSelect:()=>a(e.id),children:[(0,H.jsx)(F,{skill:e,emphasized:t}),n?(0,H.jsx)(p,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},D(e))};return(0,H.jsxs)(b,{open:o,onOpenChange:e=>{s(e),e||l(``)},children:[(0,H.jsx)(v,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skills-trigger`,"aria-label":`Apply ${e||`this template`} automatically with a skill`,title:`Pick the skills this template applies itself to`,className:r(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,i.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,H.jsx)(g,{"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`apply with…`,(0,H.jsx)(h,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,H.jsx)(y,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,H.jsxs)(E,{shouldFilter:!1,children:[(0,H.jsx)(x,{placeholder:`search skills…`,value:c,onValueChange:l,onInput:()=>u.current?.scrollTo(0,0)}),(0,H.jsxs)(T,{ref:u,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.trim()&&!t.some(e=>e.id===c.trim())?(0,H.jsx)(S,{children:(0,H.jsxs)(C,{value:`typed-skill`,onSelect:()=>a(c.trim()),children:[`Use skill id “`,c.trim(),`” (unchecked)`]})}):null,(_?_.length===0:d.length===0&&f.length===0&&m.length===0)?(0,H.jsx)(w,{children:`Nothing matches.`}):null,_?_.length>0?(0,H.jsx)(S,{children:_.map(e=>j(e,O(e)))}):null:(0,H.jsxs)(H.Fragment,{children:[d.length>0?(0,H.jsx)(S,{heading:`Most used`,children:d.map(e=>j(e,O(e)))}):null,f.length>0?(0,H.jsx)(S,{heading:`Project skills`,children:f.map(e=>j(e,!0))}):null,m.length>0?(0,H.jsx)(S,{heading:`Global`,children:m.map(e=>j(e,!1))}):null]})]})]})})]})}function K({title:e,hint:t,children:n}){return(0,H.jsxs)(`section`,{className:`settings-field flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,H.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}export{U as PromptTemplatesSection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{c as n,o as r}from"./utils-DSMR_WLb.js";import{n as i,t as a}from"./live-refetch-CZb2VOyu.js";import{$r as o,$t as s,Ai as c,An as l,B as u,Bt as d,C as f,Di as p,Ei as m,Et as h,Fn as g,Fr as _,G as v,Gt as ee,H as te,Ht as ne,In as re,Ir as ie,It as ae,Jt as oe,K as se,Kt as ce,Mn as le,Nn as ue,Nr as de,Nt as fe,Ot as pe,Pn as me,Pt as he,Qt as ge,R as _e,Rt as ve,S as ye,Si as be,T as xe,Tt as Se,U as Ce,Ut as we,V as Te,Vr as Ee,Vt as De,Wt as Oe,Xr as ke,Xt as Ae,Zt as je,_ as Me,_i as Ne,_r as Pe,_t as Fe,ai as Ie,an as Le,b as Re,bt as ze,ci as y,cn as Be,dn as Ve,dt as He,ei as Ue,en as We,f as Ge,fn as Ke,fr as qe,ft as Je,g as Ye,gt as Xe,ht as Ze,ii as Qe,in as $e,jn as et,k as tt,li as nt,ln as rt,lt as it,mi as at,mn as ot,mt as st,ni as ct,oi as lt,on as ut,ot as dt,p as ft,pi as pt,pn as mt,pt as ht,q as gt,qt as _t,r as vt,ri as yt,sn as bt,ti as xt,tn as St,tt as Ct,ut as wt,v as Tt,vt as Et,w as Dt,wi as Ot,wt as kt,x as At,xt as jt,y as Mt,yi as Nt,yt as Pt,z as Ft,zt as It}from"./project-scope-context-d3J3hWPR.js";import{A as Lt,B as b,F as x,H as S,I as C,N as w,P as T,W as E,Z as D,j as O,z as k}from"./live-protocol-DteqtbyN.js";import{t as Rt}from"./useInfiniteQuery-qJcgwcf9.js";import{t as A}from"./useQuery-CkUPLiaa.js";import{n as j,r as zt,t as Bt}from"./live-reads-Djkq38NT.js";import{n as Vt}from"./toaster-Bo5vCbz-.js";var Ht=class extends pt{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ut(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=at({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),D.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ut(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Wt=class extends c{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),m(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Ne(t.mutationKey)!==Ne(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Ut();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){D.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Gt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Kt(e,t,n){let r=e.slice(0);return r[t]=n,r}var qt=class extends c{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,D.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!m(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Gt(e,n).forEach(e=>{e.destroy()}),Gt(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=Ot(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new nt(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Kt(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&D.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},M=e(t(),1);function N({queries:e,...t},n){let r=y(n),i=lt(),a=Ie(),s=M.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);s.forEach(e=>{o(e);let t=r.getQueryCache().get(e.queryHash);ct(e,a,t)}),Qe(a);let[c]=M.useState(()=>new qt(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&t.subscribed!==!1;M.useSyncExternalStore(M.useCallback(e=>f?c.subscribe(D.batchCalls(e)):be,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),M.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>xt(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&xt(n,e)?Ue(n,new nt(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&yt({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m?.error)throw m.error;return u(d())}function P(e,t){let n=y(t),[r]=M.useState(()=>new Wt(n,e));M.useEffect(()=>{r.setOptions(e)},[r,e]);let i=M.useSyncExternalStore(M.useCallback(e=>r.subscribe(D.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=M.useCallback((e,t)=>{r.mutate(e,t).catch(be)},[r]);if(i.error&&p(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function F(e={}){let t=e.projectId??n();return{projectId:t,cacheScope:e.cacheScope??(e.boot?`default`:t)}}function I(e,t={}){return{...F(t),runId:e}}function Jt(e,t=!0,n=!1,r){return A({queryKey:[F({projectId:e,boot:n}).cacheScope,`runs`,`list`],queryFn:({signal:t})=>Se(F({projectId:e,boot:n}),{signal:t}),enabled:t,...r?{select:r}:{},placeholderData:(t,r)=>n&&r?.queryKey[0]===e?t:void 0})}function L(e,t,n=`active`){return e.invalidateQueries({queryKey:t===void 0?[`workspace`,`models`]:G.models(t),refetchType:n})}function Yt(e,t=!0,n){return A({...Xt(e,n),enabled:t})}var Xt=(e,t)=>({queryKey:G.models(e,t),queryFn:({signal:n})=>re(e,{signal:n},t),staleTime:300*1e3});function Zt(e,t=!0){let n=N({queries:e.map(e=>({...Xt(e),enabled:t}))});return Object.fromEntries(e.map((e,t)=>[e,n[t]]))}function Qt(e,t){return JSON.stringify([e,t])}function $t(e){return e.type===`run`?e.run.id:e.id}function R(e,t){return{...e,runs:t}}function en(e,t){let n=0;for(let r of e)r.projectId===t&&r.archived&&(n+=1);return n}var tn=class{runs;copied=!1;positions=new Map;constructor(e){this.runs=e,this.reindex()}reindex(){this.positions.clear(),this.runs.forEach((e,t)=>this.positions.set(Qt(e.projectId,e.id),t))}at(e,t){return this.positions.get(Qt(e,t))??-1}mutable(){return this.copied||=(this.runs=[...this.runs],!0),this.runs}replace(e,t){return this.mutable()[e]=t,this.runs}remove(e){return this.mutable().splice(e,1),this.reindex(),this.runs}insert(e){let t=this.runs.findIndex(t=>(t.createdAt??``).localeCompare(e.createdAt)<0);return this.mutable().splice(t<0?this.runs.length:t,0,e),this.reindex(),this.runs}};function nn(e,t,n){let r=new tn(e.runs),i=e,a=!1;for(let e of t)if(e.type===`usage`)i=ln(i,e.project,e.usage,r);else{let t=on(i,e.change,n,r);i=t.index,a||=t.reconcile}return{index:i,reconcile:a}}function rn(e,t,n){return n?n.has(t):e.runs.some(e=>e.projectId===t)}function an(e,t,n){return on(e,t,n,new tn(e.runs))}function on(e,t,n,r){let{project:i}=t,a=r.at(i,$t(t)),o=a>=0?e.runs[a]:void 0,s=e.truncated.includes(i);if(t.type===`deleted`)return o?{index:R(e,r.remove(a)),reconcile:s&&o.archived}:{index:e,reconcile:!1};let{run:c}=t;if(c.delegation?.role===`worker`)return o?{index:R(e,r.remove(a)),reconcile:!1}:{index:e,reconcile:!1};if(!o&&!rn(e,i,n))return{index:e,reconcile:!0};let l=Ot(o,{projectId:i,...c});if(o){if(l===o)return{index:e,reconcile:!1};let t=r.replace(a,l),n=o.archived!==l.archived&&(s||en(t,i)>e.perProjectLimit);return{index:R(e,t),reconcile:n}}if(s)return cn(e,l,r);let u=r.insert(l);return{index:R(e,u),reconcile:l.archived&&en(u,i)>e.perProjectLimit}}function sn(e,t){let n;for(let r of e)r.projectId===t&&r.archived&&(n===void 0||r.createdAt<n)&&(n=r.createdAt);return n}function cn(e,t,n){let r=sn(e.runs,t.projectId),i=r!==void 0&&t.createdAt>r;return t.archived&&!i?{index:e,reconcile:!1}:{index:R(e,n.insert(t)),reconcile:t.archived||r===void 0||t.createdAt<r}}function ln(e,t,n,r){let i=!1;return e.runs.forEach((e,a)=>{if(e.projectId!==t)return;let o=n[e.id];if(o){let t=Ot(e.usage,o);if(t===e.usage)return;r.replace(a,{...e,usage:t})}else{if(e.usage===void 0)return;let{usage:t,...n}=e;r.replace(a,n)}i=!0}),i?R(e,r.runs):e}function un(e,t){let n=e.runs.filter(e=>e.projectId!==t),r=e.truncated.filter(e=>e!==t),i=Object.prototype.hasOwnProperty.call(e.referenceStatuses,t);if(n.length===e.runs.length&&r.length===e.truncated.length&&!i)return e;let a={...e.referenceStatuses};return delete a[t],{...e,runs:n,truncated:r,referenceStatuses:a}}function dn(){return{stream:void 0,lastStream:void 0,mismatch:void 0,floor:void 0,changes:new Map}}function fn(e,t,n){if(e.lastStream===t)e.floor=Math.max(e.floor??n,n);else{for(let[n,r]of e.changes)r.generation!==t&&e.changes.delete(n);e.floor=n}e.stream=t,e.lastStream=t,e.mismatch=void 0}function pn(e){e.stream=void 0}function mn(e,t,n=!1){let r=e.stream;if(r===void 0)return!1;(e.floor===void 0||n)&&(e.floor=t.seq-1);let i=JSON.stringify([r,t.project,$t(t)]),a=e.changes.get(i);return(!a||a.seq<t.seq)&&e.changes.set(i,{...t,generation:r}),!0}function hn(e,t){for(let[n,r]of e.changes)r.project===t&&e.changes.delete(n)}function gn(e){return typeof e.generation==`string`&&typeof e.eventSeq==`number`}function _n(e,t,n){if(!gn(t))return{index:t,reconcile:!1};let{generation:r,eventSeq:i}=t;if(e.stream!==void 0&&e.stream!==r){let n=e.mismatch!==r;return e.mismatch=r,{index:t,reconcile:n}}let a=e.lastStream===r&&e.floor!==void 0,o=a&&i<e.floor,s=t,c=o,l=[...e.changes.entries()].filter(([,e])=>e.generation===r),u=l.map(([,e])=>e).filter(e=>e.seq>i).sort((e,t)=>e.seq-t.seq);for(let e of u){let t=an(s,e,n);s=t.index,c||=t.reconcile}for(let[t,n]of l)n.seq<=i&&e.changes.delete(t);return a&&!o&&(e.floor=i),{index:s,reconcile:c}}var z=[`workspace`,`runs-index`],vn=[`workspace`,`projects`],yn=6e4,bn=100,xn=new WeakMap;function Sn(e){let t=xn.get(e);return t||(t=Dn(e),xn.set(e,t)),t}function Cn(e,t){return typeof e!=`object`||!e||!Array.isArray(e.runs)?e:Sn(t).merge(e)}function wn(e){let t=e.getQueryData(vn)?.projects;return t?new Set(t.map(e=>e.id)):void 0}function Tn(e,t,n){if(!(!e||typeof e.eventSeq!=`number`||typeof t.eventSeq!=`number`))return e.generation===t.generation?t.eventSeq<e.eventSeq?e:void 0:n!==void 0&&e.generation===n&&t.generation!==n?e:void 0}function En(e,t){return t.type===`run-summary`?{type:`run`,project:e,seq:t.seq,run:t.summary}:{type:`deleted`,project:e,seq:t.seq,id:t.id}}function Dn(e){let t=dn(),n=[],r,i,a,o,s=!1,c=-1/0,l=new Set,u=!1,d,f=!1,p=()=>{if(!u){if(u=!0,d?.()){f=!0;return}_({hold:!0})}},m=t=>{c=Date.now(),e.setQueryData(z,t)},h=()=>e.getQueryData(z),g=()=>{clearTimeout(a),a=void 0;let t=e.getQueryCache().find({queryKey:z,exact:!0}),n=(t!==void 0&&t.state.data===void 0&&t.state.fetchStatus!==`idle`?e.cancelQueries({queryKey:z,exact:!0}).then(()=>e.invalidateQueries({queryKey:z})):e.invalidateQueries({queryKey:z})).catch(()=>void 0).finally(()=>{o===n&&(o=void 0,s&&(s=!1,g()))});return o=n,n},_=(e={})=>o?(s=!0,o):e.hold?(a??=setTimeout(()=>{g()},400),Promise.resolve()):g(),v=()=>{r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0;let t=n;n=[];let a=h();if(!a||t.length===0)return;let o=wn(e),{index:s,reconcile:c}=nn(a,t.filter(e=>e.generation===a.generation?e.type===`usage`?!l.has(e.project):!l.has(e.change.project)&&e.change.seq>a.eventSeq:!1),o);s!==a&&m(s),c&&_({hold:!0})},ee=()=>{if(i!==void 0)return;let e=c+250-Date.now();if(e>0){i=setTimeout(v,e);return}i=setTimeout(v,bn),typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(v))};return{ready(e,n){fn(t,e,n),u=!1,f&&(f=!1,_({hold:!0}))},detach(){pn(t)},run(e,r,i=!1){if(l.has(e))return;let a=En(e,r);if(!mn(t,a,i)){p();return}n.push({type:`change`,change:a,generation:t.stream}),ee()},usage(e,r){if(!l.has(e)){if(t.stream===void 0){p();return}n.push({type:`usage`,project:e,usage:r,generation:t.stream}),ee()}},dropProject(e){l.add(e),hn(t,e),n=n.filter(t=>(t.type===`change`?t.change.project:t.project)!==e);let r=h();if(!r)return;let i=un(r,e);i!==r&&m(i)},setUnknownGenerationHandler(e){d=e},restoreProject(e){l.delete(e)},merge(n){let r=h(),i=_n(t,n,wn(e));for(let e of l)i.index=un(i.index,e);return i.reconcile&&queueMicrotask(()=>{_({hold:!0})}),Tn(r,n,t.stream)??i.index},reconcile:_,flush:v,stop(){r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0,clearTimeout(a),a=void 0,n=[],s=!1}}}var On=O([`own`,`provider-spanning`]),kn=b({suggested:w(b({id:E(),label:E(),desc:E()})),retired:w(E())}),An=b({id:O([`settings`,`mcp`,`memory`]),label:E(),note:E().optional(),empty:E().optional(),showsUserMcp:C(!0).optional()}),jn=b({label:E(),note:E().optional(),groups:w(An)}),Mn=b({runners:w(b({id:ke,displayName:E(),modelListName:E(),modelIdScope:On,pickerLabel:E(),pickerDescription:E(),icon:E(),installHint:E(),loginCommand:E(),terminalLogin:T().optional(),browserLogin:T().optional(),managedInstall:C(!0).optional(),accountFolderExample:E().optional(),models:kn,agentConfig:jn}))}),Nn=[`workspace`,`runners`];async function Pn(e){return g(await et.api.v1.runners.$get({},le(e)),`/runners`,Mn)}var Fn={queryKey:Nn,queryFn:({signal:e})=>Pn({signal:e}),staleTime:1/0};function In(){return A(Fn)}function Ln(e){return e?.runners??[]}function Rn(e){return Ln(e).map(e=>e.id)}function zn(e,t){if(e!==void 0)return t.includes(e)?e:t[0]}function Bn(e){let t=In();return{runner:t.isSuccess?zn(e,Rn(t.data))??e:e,ready:!t.isPending}}function B(e,t){return e?.runners.find(e=>e.id===t)}function Vn(e,t){return B(e,t)?.displayName??t}function Hn(e,t){return B(e,t)?.pickerLabel??t}function Un(e,t){return B(e,t)?.modelListName}function Wn(e,t,r=!0){let i=ki(),a=q(),{runner:o,ready:s}=Bn(e??i.data?.defaultRunner??`claude`),c=a.data?.capabilities?.localHandoff===!1?null:t,l=n(),u=A({queryKey:W.runnerSkills(o,c),queryFn:({signal:e})=>ye(o,c,{signal:e,projectId:l}),enabled:r&&s&&(e!==void 0||!i.isPending)&&(!t||!a.isPending),retry:!1});return{...u,runner:o,account:c,data:u.data?.skills,list:u.data,unchecked:u.isError||!u.data||u.data.source===`unavailable`}}var Gn={draft:{label:`Draft`,hint:`the author has not marked it ready for review`,tone:`neutral`},"review-required":{label:`Waiting for review`,hint:`checks are fine, no one has reviewed it yet`,tone:`info`},"changes-requested":{label:`Changes requested`,hint:`a reviewer asked for edits before this can merge`,tone:`danger`},"checks-pending":{label:`Checks running`,hint:`CI has not finished on the latest commit`,tone:`pending`},"checks-failing":{label:`Checks failing`,hint:`CI is red on the latest commit`,tone:`danger`},ready:{label:`Ready to merge`,hint:`open, checks pass, nothing is waiting on a reviewer`,tone:`success`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`merged`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`success`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`accent`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},Kn={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function qn(e){return typeof e==`string`&&Object.hasOwn(Gn,e)}function Jn(e){return e!==void 0&&qn(e)?Gn[e]:void 0}var Yn=`cez.reference-statuses.v1`,Xn=`cez.reference-conflicts.v1`,V=new Map(er()),Zn=1e3;function Qn(e,t){if(V.get(e)!==t){for(V.delete(e),V.set(e,t);V.size>Zn;){let e=V.keys().next().value;if(e===void 0)break;V.delete(e)}rr()}}var H=new Set(tr());function $n(e,t){if(H.has(e)!==t){if(t)for(H.add(e);H.size>Zn;){let e=H.values().next().value;if(e===void 0)break;H.delete(e)}else H.delete(e);rr()}}function er(){try{let e=globalThis.sessionStorage?.getItem(Yn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&qn(e[1])):[]}catch{return[]}}function tr(){try{let e=globalThis.sessionStorage?.getItem(Xn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var nr;function rr(){nr===void 0&&(nr=setTimeout(()=>{nr=void 0;try{globalThis.sessionStorage?.setItem(Yn,JSON.stringify([...V])),globalThis.sessionStorage?.setItem(Xn,JSON.stringify([...H]))}catch{}},250))}var U=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function ir(e,t){return{...e?{status:e}:{},...t?{conflicting:!0}:{}}}function ar(e){return[...e.prs.map(t=>({projectId:e.projectId,kind:`PR`,number:t})),...e.issues.map(t=>({projectId:e.projectId,kind:`Issue`,number:t}))]}function or(e,t,n,r,i,a){let o=r.prs[n.number]??r.issues[n.number];if(!o){e.set(t,{state:`unknown`,...i?{status:i}:{}});return}let s=r.conflicts?r.conflicts.includes(n.number):void 0;Qn(t,o),s!==void 0&&$n(t,s),e.set(t,{state:`ready`,status:o,...s??a?{conflicting:!0}:{}})}function sr(e,t,n){let r=U(t),i=V.get(r),a=H.has(r)?!0:void 0,o=n.data;if(o?.available){or(e,r,t,o,i,a);return}if(o){e.set(r,{state:`unavailable`,reason:o.reason,...ir(i,a)});return}if(n.isError){e.set(r,{state:`unavailable`,reason:n.error instanceof Error?n.error.message:void 0,...ir(i,a)});return}e.set(r,{state:`loading`,...ir(i,a)})}function cr(e,t){let n=new Map;return t.forEach((t,r)=>{let i=e[r];if(i)for(let e of ar(i))sr(n,e,t)}),n}var W={get health(){return[n(),`health`]},runs:{get all(){return[n(),`runs`]},relationships:e=>[n(),`runs`,`relationships`,e],list:(e=n())=>[e,`runs`,`list`],archived:e=>[n(),`runs`,`archived`,e],detail:(e,t=n())=>[t,`runs`,`detail`,e],diff:e=>[n(),`runs`,`diff`,e],changes:e=>[n(),`runs`,`changes`,e],file:(e,t)=>[n(),`runs`,`files`,e,t],handoff:e=>[n(),`runs`,`handoff`,e],commits:e=>[n(),`runs`,`commits`,e],commit:(e,t)=>[n(),`runs`,`commit`,e,t]},get workflows(){return[n(),`workflows`]},runnerSkills:(e,t)=>[n(),`runner-skills`,e,t??null],get repo(){return[n(),`repo`]},get repoChanges(){return[n(),`repo`,`changes`]},repoCommit:e=>[n(),`repo`,`commit`,e],get repoBranches(){return[n(),`repo`,`branches`]},get uiState(){return[n(),`ui-state`]},get config(){return[n(),`config`]},get agentConfig(){return[n(),`agent-config`]},agentConfigFile:e=>[n(),`agent-config`,`file`,e],get worktrees(){return[n(),`worktrees`]},github:(e={})=>[n(),`github`,e.limit??null],githubPages:e=>[n(),`github`,`pages`,e],githubPagesHead:e=>[n(),`github`,`pages-head`,e],githubCommentCounts:(e,t)=>[n(),`github`,`comment-counts`,e,[...t].sort((e,t)=>e-t).join(`,`)],githubChecks:e=>[n(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[n(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[n(),`github`,`comments`,e,t],githubItem:(e,t)=>[n(),`github`,`item`,e,t],githubRefStatusOf:e=>[e,`github`,`ref-status`],githubPrChanges:e=>[n(),`github`,`pr-changes`,e],githubMergeState:e=>[n(),`github`,`merge-state`,e],get openTargets(){return[n(),`open-targets`]}},G={models:(e,t)=>t&&t!=="default"?[`workspace`,`models`,e,t]:[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],runsIndex:z,runsSearch:e=>[`workspace`,`runs-search`,e],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],agentProfiles:[`workspace`,`agent-profiles`],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...G.fsBrowseRoot,e,t]};function lr(e){if(!e)return;let t=e.trim().replace(/\/+$/,``),n=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(t),r=n?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(t),i=n??r;if(!i)return;let[,a,o]=i;if(!o||a?.toLowerCase()!==`github.com`)return;let s=o.replace(/\.git$/i,``).split(`/`).filter(Boolean),c=s[s.length-2],l=s[s.length-1];return c&&l?`https://github.com/${c}/${l}`:void 0}function ur(e){let t=new Map;for(let n of e)for(let e of n.tags??[]){let n=e.toLowerCase();t.has(n)||t.set(n,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function dr(e,t,n,r=8){let i=n.trim().toLowerCase(),a=new Set(t.map(e=>e.toLowerCase())),o=e.filter(e=>{let t=e.toLowerCase();return a.has(t)?!1:i===``||t.includes(i)&&t!==i});return i===``?o.slice(0,r):o.sort((e,t)=>Number(t.toLowerCase().startsWith(i))-Number(e.toLowerCase().startsWith(i))||e.localeCompare(t,void 0,{sensitivity:`base`})).slice(0,r)}function fr(e){let t=new Map;for(let n of e){let e=n.trim();if(!e)continue;let r=e.toLowerCase();t.has(r)||t.set(r,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function pr(){let e=y();return A({queryKey:G.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(G.providerStatus),r=await s(!1,{signal:t});return Pe(n,e.getQueryData(G.providerStatus),r)},staleTime:5*6e4,refetchInterval:a(!1),refetchOnWindowFocus:!0})}function mr(){let e=y();return P({mutationFn:()=>s(!0),onMutate:()=>e.getQueryData(G.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(G.providerStatus,e=>Pe(r,e,t)),L(e)}})}function hr(){let e=y();return P({mutationFn:({provider:e,authFailureId:t})=>Be(e,t),onMutate:()=>e.getQueryData(G.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(G.providerStatus,e=>Pe(r,e,t,n.authFailureId)),L(e,n.provider)}})}function gr(e={}){return A({queryKey:G.projects,queryFn:({signal:e})=>ge({signal:e}),...e})}function _r(e,t=!1){return A({queryKey:G.fsBrowse(e,t),queryFn:({signal:n})=>De(e??void 0,{signal:n,showHidden:t}),retry:!1})}function vr(){let e=y();return P({mutationFn:e=>$e(e),onSuccess:()=>e.invalidateQueries({queryKey:G.projects})})}function yr(){let e=y();return P({mutationFn:e=>ut(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:G.projects})}})}function br(){let e=y();return P({mutationFn:e=>{let{id:t,...n}=e;return mt(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:G.projects});let r=e.getQueryData(G.projects);return e.setQueryData(G.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?xr(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(G.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(G.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:G.projects})})}function xr(e,t){let{maxParallel:n,tags:r,...i}=e,a={...i},o=`maxParallel`in t?t.maxParallel:e.maxParallel;o!=null&&(a.maxParallel=o);let s=`tags`in t&&t.tags!==void 0?t.tags:e.tags,c=s==null?[]:fr(s);if(c.length>0&&(a.tags=c),`webhook`in t&&t.webhook!==void 0)if(t.webhook===null)delete a.webhook;else{let n=t.webhook.token===void 0?e.webhook?.tokenSet??!1:t.webhook.token!==``;a.webhook={url:t.webhook.url,tokenSet:n}}return a}function Sr(e){let t=y();return P({mutationFn:e,retry:!1,onSuccess:({project:e})=>{t.setQueryData(G.projects,t=>t===void 0?t:{...t,projects:t.projects.map(t=>t.id===e.id?e:t)})},onSettled:()=>t.invalidateQueries({queryKey:G.projects})})}function Cr(){return Sr(e=>{let{projectId:t,...n}=e;return ce(t,n)})}function wr(){return Sr(e=>{let{projectId:t,webhookId:n,...r}=e;return ot(t,n,r)})}function Tr(){return Sr(({projectId:e,webhookId:t})=>bt(e,t))}function Er(){return P({mutationFn:({projectId:e,webhookId:t})=>Ve(e,t),retry:!1})}function K(e){let t=y();return P({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:G.agentProfiles}),t.invalidateQueries({queryKey:G.projects}),t.invalidateQueries({predicate:({queryKey:e})=>e[1]===`runner-skills`}),L(t)])}})}function Dr(){return K(e=>Oe(e))}function Or(){return K(e=>{let{id:t,...n}=e;return Ke(t,n)})}function kr(){return K(e=>Le(e))}function Ar(){return K(e=>rt(e))}function jr(e,t){return A({queryKey:G.agentAccountStatus(e),queryFn:({signal:t})=>_t(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function Mr(){let e=y();return P({mutationFn:({provider:e,profileId:t})=>we(e,t),retry:!1,onSuccess:async(t,{provider:n})=>{await Promise.all([e.invalidateQueries({queryKey:G.agentProfiles}),e.invalidateQueries({queryKey:G.providerStatus}),L(e,n,`none`)])}})}function Nr(){let e=y();return P({mutationFn:e=>_t(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(G.agentAccountStatus(n),t),e.invalidateQueries({queryKey:G.agentProfiles}),L(e,t.status.provider)}})}function Pr(){let e=y();return P({mutationFn:e=>ne(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:G.projects})})}function Fr(){let e=y();return P({mutationFn:e=>ee(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:G.projects})})}function Ir({enabled:e}){return A({queryKey:G.githubOwners,queryFn:({signal:e})=>Ae({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function Lr(){let e=y();(0,M.useEffect)(()=>{let t,n=()=>{let n=e.getQueryData(W.health);n&&(_({bootProject:n.bootProject??`default`,apiBase:r()}),t??=zt(`health`,t=>{e.setQueryData(W.health,t)}))};n();let i=e.getQueryCache().subscribe(n);return()=>{i(),t?.(),Ee()}},[e])}function q(){return A({queryKey:W.health,queryFn:({signal:e})=>je({signal:e})})}function Rr(e,t){let n=q().data,r=gr(t).data?.projects,i=vt(),a=e??i.projectId,o=a??n?.bootProject,s=o===void 0?void 0:r?.find(e=>e.id===o);return s?.repoUrl?s.repoUrl:a===null||a===n?.bootProject?lr(n?.repo?.remote):void 0}function zr(){return A({queryKey:G.uiState,queryFn:({signal:e})=>St({signal:e})})}function Br(){return A({queryKey:G.config,queryFn:({signal:e})=>We({signal:e})})}function Vr(){return A({queryKey:G.agentProfiles,queryFn:({signal:e})=>oe({signal:e})})}var J=[`workspace`,`runs-index`],Y=e=>[e.cacheScope,`runs`,`list`],X=e=>[e.cacheScope,`runs`,`detail`,e.runId],Z=e=>typeof e==`function`?e():e;function Hr(e){let{seenAt:t,...n}=e;return n}function Ur(e,t){let n=Hr(e);return t.seenAt===void 0?n:{...n,seenAt:t.seenAt}}function Wr(e,t,n){return t?{...e,seenAt:n}:Hr(e)}function Gr(e){let t=()=>{e.invalidateQueries({queryKey:J})};function r(r,i){if(r===`index`)return t();let a=typeof i==`function`?i():i;if(r===`indexed`){t(),e.invalidateQueries({queryKey:[n(),`runs`]}),e.invalidateQueries({queryKey:[a.projectId,`runs`,`list`]});return}if(r===`runs`)return e.invalidateQueries({queryKey:[a.cacheScope,`runs`]});let o=ie(),s=[a.projectId,a.cacheScope],c=o!==void 0&&s.some(e=>e===o||e==="default")?[o,`default`]:[],l=new Set([...s,...c,n()]);return Promise.all([...l].map(t=>e.invalidateQueries({queryKey:[t,`runs`]}))).then(()=>void 0)}async function i(n,r){await e.cancelQueries({queryKey:Y(Z(n))}),await e.cancelQueries({queryKey:X(Z(n))});let i=e.getQueryData(Y(Z(n))),a=e.getQueryData(X(Z(n))),o=Z(n).runId,s=new Date().toISOString();return e.setQueryData(Y(Z(n)),e=>e?.map(e=>e.id===o?Wr(e,r,s):e)),e.setQueryData(X(Z(n)),e=>e&&Wr(e,r,s)),{id:o,prevList:i,prevDetail:a,rollback(){if(!r){i&&e.setQueryData(Y(Z(n)),i),a&&e.setQueryData(X(Z(n)),a);return}let t=i?.find(e=>e.id===o);t&&e.setQueryData(Y(Z(n)),e=>e?.map(e=>e.id===o?Ur(e,t):e)),a&&e.setQueryData(X(Z(n)),e=>e&&Ur(e,a))},settle(i){let a=e=>e.id===(r?o:i.id)?Wr(e,r,i.seenAt):e;e.setQueryData(Y(Z(n)),e=>e?.map(a));let s={...Z(n),runId:r?o:i.id};e.setQueryData(X(s),e=>e?a(e):i),t()}}}async function a(t,n){await e.cancelQueries({queryKey:J});let i=e.getQueryData(J),a=n();return e.setQueryData(J,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===t.projectId&&e.id===t.runId?a(e):e)}),{previous:i,rollback(){i&&e.setQueryData(J,i)},settle(){r(`indexed`,t)}}}return{patchRead:i,patchIndex:a,invalidateAfter:r}}function Q(){let e=y();return(0,M.useMemo)(()=>Gr(e),[e])}async function Kr(e,t=!1){return me(await et.api.v1.p[`:projectId`].runs[`:id`][`worker-destroy`].$post({param:{projectId:n(),id:encodeURIComponent(e)},query:{},json:t?{discardWork:!0}:{}}),ue(e,`/worker-destroy`))}function qr(){return A({queryKey:W.openTargets,queryFn:({signal:e})=>st({signal:e}),staleTime:5*6e4})}function Jr(){return A({queryKey:W.runs.list(),queryFn:({signal:e})=>Se(F(),{signal:e})})}function Yr(e,t){return Rt({queryKey:W.runs.archived(e),enabled:t,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>it({before:t,limit:200,q:e},{signal:n}),getNextPageParam:e=>e.nextCursor??void 0,placeholderData:(e,t)=>t?.queryKey[0]===n()?e:void 0})}function Xr(e){let t=e.trim();return A({queryKey:G.runsSearch(t),queryFn:({signal:e})=>ve(t,{signal:e}),enabled:t.length>=2,placeholderData:Nt,staleTime:1e4})}function Zr(e=!0,t=yn,n){let r=Sn(y());return j(`/api/v1/workspace/runs-index`,G.runsIndex,a(e?t:!1),Cn),A({queryKey:G.runsIndex,queryFn:({signal:e})=>h({signal:e}).then(r.merge),enabled:e,...n?{select:n}:{},staleTime:3e4,refetchInterval:!1})}function Qr(e){let t=y();return P({mutationFn:({workerId:e,discardWork:t=!1})=>Kr(e,t),onSettled:()=>t.invalidateQueries({queryKey:W.runs.relationships(e)})})}function $r(e,t={}){return A({queryKey:W.runs.relationships(e),queryFn:({signal:t})=>kt(e,{signal:t}),enabled:t.enabled??!0})}function ei(e){return A({queryKey:W.runs.detail(e??``),queryFn:({signal:t})=>Ze(I(e),{signal:t}),enabled:!!e})}function ti(e,t,n=!0){return A({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Ze(I(t,{projectId:e}),{signal:n}),enabled:n&&!!e&&!!t})}function ni(e){return A({queryKey:W.runs.diff(e??``),queryFn:({signal:t})=>Pt(e,{signal:t}),enabled:!!e})}function ri(e,t=!1){return j(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/changes`:void 0,W.runs.changes(e??``),a(t?4e3:!1)),A({queryKey:W.runs.changes(e??``),queryFn:({signal:t})=>Xe(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0})}function ii(e,t){return A({queryKey:W.runs.file(e??``,t??``),queryFn:({signal:n})=>ze(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function ai(e,t){return A({queryKey:[n(),`runs`,`file-link`,e,t],queryFn:({signal:n})=>ht(e,t,{signal:n}),enabled:t!==null,retry:!1})}function oi(e,t){return A({queryKey:[n(),`runs`,`artifact`,e,t],queryFn:({signal:n})=>wt(e,t,{signal:n}),enabled:t!==null,retry:!1})}function si(e,t){return A({queryKey:[n(),`runs`,`artifact-metadata`,e,t],queryFn:({signal:n})=>He(e,t,{signal:n}),enabled:t!==null,retry:!1})}function ci(e){return A({queryKey:[n(),`runs`,`artifacts`,e],queryFn:({signal:t})=>Je(e,{signal:t}),retry:!1,staleTime:0,refetchOnWindowFocus:!0})}function li(e,t=!1){return j(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/commits`:void 0,W.runs.commits(e??``),a(t?5e3:!1)),A({queryKey:W.runs.commits(e??``),queryFn:({signal:t})=>Et(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1})}function ui(e,t){return A({queryKey:W.runs.commit(e??``,t??``),queryFn:({signal:n})=>Fe(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function di(e,t=!0){return A({queryKey:W.runs.handoff(e??``),queryFn:({signal:t})=>jt(I(e),{signal:t}),enabled:!!e&&t})}function fi(e,t,n){return A({queryKey:e===void 0?W.runs.handoff(t):[e,`runs`,`handoff`,t],queryFn:({signal:n})=>jt(I(t,{projectId:e}),{signal:n}),enabled:n,staleTime:15e3})}function pi(e,t){let r=[...new Set(e)],i=N({queries:r.map(e=>({queryKey:[e??n(),`automations`,`names`],queryFn:({signal:t})=>Ye({signal:t,archived:`include`,...e===void 0?{}:{projectId:e}}),enabled:t,staleTime:6e4,retry:!1}))}),a=i.map(e=>e.data);return(0,M.useMemo)(()=>{let e=new Map;return a.forEach((t,n)=>{if(t?.available)for(let i of t.automations)e.set(JSON.stringify([r[n]??null,i.id]),i.name)}),(t,n)=>e.get(JSON.stringify([t??null,n]))},[JSON.stringify([r,i.map(e=>e.dataUpdatedAt)])])}function mi(e){let t=y();return P({mutationFn:t=>pe(e,t),retry:!1,onSuccess:()=>t.invalidateQueries({queryKey:W.runs.all})})}function hi(e){let t=y();return P({mutationFn:t=>fe(e,t),onSuccess:()=>t.invalidateQueries({queryKey:W.runs.all})})}function gi(e){let t=Q(),n=e?.projectId,r=e?.cacheScope,i=P({mutationFn:e=>d(e,!0),onMutate:e=>t.patchRead(e,!0),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)}),a=(0,M.useCallback)(e=>({...I(e,{projectId:n,cacheScope:r}),id:e}),[n,r]),o=(0,M.useCallback)(e=>({onSuccess:(t,n,r,i)=>e?.onSuccess?.(t,n.id,r,i),onError:(t,n,r,i)=>e?.onError?.(t,n.id,r,i),onSettled:(t,n,r,i,a)=>e?.onSettled?.(t,n,r.id,i,a)}),[]),{mutate:s,mutateAsync:c}=i,l=(0,M.useCallback)((e,t)=>s(a(e),o(t)),[s,a,o]),u=(0,M.useCallback)((e,t)=>c(a(e),o(t)),[c,a,o]);return{...i,variables:i.variables?.id,mutate:l,mutateAsync:u}}function _i(){let e=Q();return P({mutationFn:e=>d(I(e),!1),onMutate:t=>e.patchRead(()=>I(t),!1),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)})}function vi(e){let t=Q();return P({mutationFn:({id:t,pinned:n})=>he(I(t,e),n),onError:e=>Vt(`Could not update pin. ${e.message} Please retry.`,{tone:`danger`}),onMutate:()=>e??F(),onSuccess:(e,n,r)=>t.invalidateAfter(`runs`,r)})}function yi(e,t){let n=Q();return P({mutationFn:n=>It(I(e,{projectId:t}),n),onMutate:()=>F({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`send`,r),onError:(e,t,r)=>{e instanceof l&&e.status===409&&r&&n.invalidateAfter(`send`,r)}})}function bi(e,t){let n=Q();return P({mutationFn:(n={})=>Ct(I(e,{projectId:t}),n),onMutate:()=>F({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`continue`,r)})}function xi(e){let t=y();return P({mutationFn:({msgId:t,message:n})=>dt(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:W.runs.all})})}function Si(e){let t=y();return P({mutationFn:t=>ae(e,t),onSuccess:()=>t.invalidateQueries({queryKey:W.runs.all})})}function Ci(){return A({queryKey:W.workflows,queryFn:({signal:e})=>Dt({signal:e})})}function wi(){return A({queryKey:W.repo,queryFn:({signal:e})=>Tt({signal:e})})}function Ti(e){return A({queryKey:[e,`repo`],queryFn:({signal:t})=>Tt({signal:t},e)})}function Ei(){return A({queryKey:W.repoBranches,queryFn:({signal:e})=>Mt({signal:e})})}function Di(){return A({queryKey:W.repoChanges,queryFn:({signal:e})=>Re({signal:e}),retry:!1})}function Oi(e){return A({queryKey:W.repoCommit(e??``),queryFn:({signal:t})=>At(e,{signal:t}),enabled:!!e,retry:!1})}function ki(){return A({queryKey:W.config,queryFn:({signal:e})=>Me({signal:e})})}function Ai(){return A({queryKey:W.worktrees,queryFn:({signal:e})=>xe({signal:e})})}function ji(e){return A({queryKey:[e,`worktrees`],queryFn:({signal:t})=>xe({signal:t},e),staleTime:0})}function Mi(e,t=!0,n=!1){return A({queryKey:[F({projectId:e,boot:n}).cacheScope,`ui-state`],queryFn:({signal:t})=>f({signal:t},e),select:e=>e.sidebarLimits===void 0?e:{...e,sidebarLimits:de(e.sidebarLimits)},enabled:t})}function Ni(){return Mi(n())}function Pi(){return A({queryKey:W.agentConfig,queryFn:({signal:e})=>Ge({signal:e})})}function Fi(e){return A({queryKey:W.agentConfigFile(e??``),queryFn:({signal:t})=>ft(e,{signal:t}),enabled:e!==null})}function Ii(e){let t=y(),n=W.agentConfig,r=W.agentConfigFile(e);return P({mutationFn:t=>tt(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}var Li=O([`passing`,`failing`,`pending`]).nullable(),$=b({kind:O([`issue`,`pr`]),number:k(),title:E(),author:E(),createdAt:E(),labels:w(E()),body:E().optional(),url:E(),comments:k(),assignees:w(E()).optional(),projectIds:w(E()).optional(),isDraft:T().optional(),additions:k().optional(),deletions:k().optional(),checks:Li.optional()});x(`available`,[b({available:C(!0),item:$.nullable(),labelColors:S(E(),E()).optional()}),b({available:C(!1),reason:E()})]),b({kind:O([`issue`,`pr`]),number:Lt().int().positive().safe()});var Ri=b({id:E(),title:E(),url:E()});b({available:T(),reason:E().optional(),repo:E().optional(),syncedAt:E().optional(),issues:w($),prs:w($),labelColors:S(E(),E()).optional(),viewerLogin:E().optional(),projects:w(Ri).optional(),projectsReason:E().optional(),projectsState:O([`refreshing`,`ready`,`unavailable`]).optional(),projectsGeneration:E().optional(),issuesTotal:k().int().nonnegative().optional(),prsTotal:k().int().nonnegative().optional(),issuesNextCursor:E().nullable().optional(),prsNextCursor:E().nullable().optional(),commentsDeferred:C(!0).optional()});var zi=E().min(1).max(2e3).optional();b({limit:E().optional(),refresh:E().optional(),issuesCursor:zi,prsCursor:zi,issuesDone:C(`1`).optional(),prsDone:C(`1`).optional()}).superRefine((e,t)=>{e.issuesDone&&e.issuesCursor&&t.addIssue({code:`custom`,message:`issuesDone and issuesCursor are exclusive`}),e.prsDone&&e.prsCursor&&t.addIssue({code:`custom`,message:`prsDone and prsCursor are exclusive`}),e.issuesDone&&e.prsDone&&t.addIssue({code:`custom`,message:`both sides are done; there is no page to ask for`})}),b({kind:O([`issue`,`pr`]),numbers:E().regex(/^[1-9]\d{0,15}(,[1-9]\d{0,15})*$/).refine(e=>{let t=e.split(`,`);return t.length<=100&&t.every(e=>Number.isSafeInteger(Number(e)))},{message:`at most 100 safe positive integers`}),refresh:C(`1`).optional()}),x(`available`,[b({available:C(!0),counts:S(k(),k().int().nonnegative())}),b({available:C(!1),reason:E()})]),x(`available`,[b({available:C(!0),checks:S(k(),Li)}),b({available:C(!1),reason:E()})]),b({kind:O([`issue`,`pr`]),q:E().trim().min(1).max(256),limit:Lt().int().positive().max(50).optional()}),b({available:T(),projectsReason:E().optional(),reason:E().optional(),items:w($),truncated:T().optional(),labelColors:S(E(),E()).optional()});var Bi=k().nullable();x(`available`,[b({available:C(!0),prs:S(k(),qe),issues:S(k(),qe),conflicts:w(k()).optional(),recheckAfterMs:Bi}),b({available:C(!1),reason:E(),recheckAfterMs:Bi})]);var Vi=b({id:k(),author:E(),avatarUrl:E().optional(),createdAt:E(),body:E(),kind:O([`comment`,`review`]),reviewState:O([`approved`,`changes_requested`,`commented`,`dismissed`]).optional(),url:E()}),Hi=O([`committed`,`labeled`,`unlabeled`,`assigned`,`unassigned`,`merged`,`closed`,`reopened`,`head_ref_force_pushed`,`cross-referenced`,`renamed`]),Ui=b({id:E(),kind:Hi,actor:E(),avatarUrl:E().optional(),createdAt:E(),url:E().optional(),sha:E().optional(),message:E().optional(),checks:Li.optional(),label:b({name:E(),color:E().optional()}).optional(),subject:E().optional(),refNumber:k().optional(),refTitle:E().optional(),refIsPr:T().optional()});b({available:T(),reason:E().optional(),comments:w(Vi),truncated:T().optional(),events:w(Ui).optional(),detail:b({body:E(),additions:k().int().nonnegative().optional(),deletions:k().int().nonnegative().optional()}).optional()});var Wi=O([`merge`,`squash`,`rebase`]),Gi=b({name:E(),state:O([`passing`,`failing`,`pending`,`unknown`]),required:T().nullable(),url:E().optional()}),Ki=b({number:k(),title:E(),url:E(),state:O([`open`,`closed`,`merged`]),isDraft:T(),headRef:E(),baseRef:E(),headSha:E(),mergeable:O([`mergeable`,`conflicting`,`unknown`]),reviewDecision:O([`approved`,`changes-requested`,`review-required`,`not-required`,`unknown`]),checks:w(Gi),methods:w(Wi),defaultMethod:Wi.nullable(),eligibility:O([`ready`,`blocked`,`pending`,`unauthorized`,`terminal`,`unknown`]),blockers:w(b({code:E(),message:E()})),canMerge:T(),canOverride:T()});x(`available`,[b({available:C(!0),mergeState:Ki}),b({available:C(!1),reason:E()})]),b({merged:C(!0),number:k(),url:E(),method:Wi,mergeCommitSha:E().optional()});var qi=b({path:E(),previousPath:E().optional(),status:O([`added`,`modified`,`removed`,`renamed`,`copied`,`changed`]),additions:k(),deletions:k(),patch:E().optional(),patchUnavailableReason:O([`binary`,`too-large`,`not-provided`]).optional(),truncated:T().optional()});x(`available`,[b({available:C(!0),number:k(),headSha:E(),files:w(qi),additions:k(),deletions:k(),truncated:T(),reason:E().optional()}),b({available:C(!1),reason:E()})]),b({generation:E().uuid()}),x(`state`,[b({generation:E().uuid(),state:C(`ready`),projects:w(Ri),membership:S(E(),w(E()))}),b({generation:E().uuid(),state:C(`unavailable`),reason:E()})]);function Ji(e){if(!e.available)return;let t=e.issuesNextCursor,n=e.prsNextCursor;if(!(t===void 0&&n===void 0)&&!(!t&&!n))return{...t?{issuesCursor:t}:{issuesDone:!0},...n?{prsCursor:n}:{prsDone:!0}}}function Yi(e,t){return e?(t===`issues`?e.issuesNextCursor:e.prsNextCursor)==null:!1}function Xi(e,t,n){for(let r of e)t.has(r.number)||(t.add(r.number),n.push(r))}function Zi(e){let t=e[0];if(!t)return;let n=e[e.length-1],r=[],i=[],a=new Set,o=new Set,s={};for(let t of e){Xi(t.issues,a,r),Xi(t.prs,o,i);for(let[e,n]of Object.entries(t.labelColors??{}))s[e]??=n}let c=e.find(e=>e.projects)?.projects,l=e.map(e=>e.projectsState),u=e.find(e=>e.projectsState===`unavailable`),d=l.includes(`refreshing`)?`refreshing`:u?`unavailable`:l.some(e=>e===`ready`)?`ready`:void 0,{projectsGeneration:f,projectsReason:p,...m}=t;return{...m,issues:r,prs:i,...Object.keys(s).length>0?{labelColors:s}:{},...c?{projects:c}:{},...d?{projectsState:d}:{},...d===`unavailable`&&u?.projectsReason?{projectsReason:u.projectsReason}:{},...`issuesNextCursor`in n?{issuesNextCursor:n.issuesNextCursor}:{},...`prsNextCursor`in n?{prsNextCursor:n.prsNextCursor}:{}}}var Qi=e=>e.map(e=>e.number).join(`,`);function $i(e,t){let n=e[0];if(e.length>1&&n&&(Qi(n.issues)!==Qi(t.issues)||Qi(n.prs)!==Qi(t.prs)||n.issuesTotal!==t.issuesTotal||n.prsTotal!==t.prsTotal))return`refetch`;let r=t;if(n&&t.available&&t.projectsState===`refreshing`&&n.repo===t.repo){let e=new Map(n.issues.map(e=>[e.number,e.projectIds]));r={...t,issues:t.issues.map(t=>{let n=e.get(t.number);return t.projectIds===void 0&&n!==void 0?{...t,projectIds:n}:t})}}return[r,...e.slice(1)]}function ea(e={},t=!0){let r=y(),i=W.github(e);j(`/api/v1/p/${n()}/github${e.limit===void 0?``:`?limit=${e.limit}`}`,i,a(t?6e4:!1));let o=A({queryKey:W.github(e),queryFn:({signal:t})=>_e({limit:e.limit},{signal:t}),enabled:t,staleTime:6e4,refetchInterval:!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0}),s=o.data?.projectsGeneration,c=A({queryKey:[...i,`projects`,s],queryFn:({signal:e})=>v(s,{signal:e}),enabled:t&&o.data?.projectsState===`refreshing`&&!!s,staleTime:1/0,retry:!1});return(0,M.useEffect)(()=>{!s||!c.data&&!c.error||r.setQueryData(i,e=>{if(!e||e.projectsGeneration!==s||e.projectsState!==`refreshing`)return e;let t=c.data;return t?.generation&&t.generation!==s?e:t?.state===`ready`?{...e,projectsState:`ready`,projects:t.projects,issues:e.issues.map(e=>({...e,projectIds:t.membership?.[e.number]??[]}))}:{...e,projectsState:`unavailable`,projectsReason:t?.reason??`Project boards unavailable. Refresh to try again.`}})},[r,s,c.data,c.error,i]),o}var ta=class extends Error{};function na(e,t,n){return{queryKey:e,initialPageParam:{},queryFn:async({pageParam:e,signal:r})=>{let i=await _e({limit:t,...e,...n?{projectId:n}:{}},{signal:r});if(!i.available&&Object.keys(e).length>0)throw new ta(i.reason??`GitHub is unavailable.`);return i},getNextPageParam:e=>Ji(e),retry:(e,t)=>!(t instanceof ta)&&!(t instanceof l&&t.status>=400&&t.status<500)&&e<1,staleTime:6e4,refetchOnWindowFocus:!0}}function ra(e=50,t=!0){let r=y(),i=W.githubPages(e),o=W.githubPagesHead(e);j(`/api/v1/p/${n()}/github?limit=${e}`,o,a(t?6e4:!1));let s=Rt({...na(i,e),enabled:t,refetchInterval:!1,refetchIntervalInBackground:!1}),c=A({queryKey:o,queryFn:({signal:t})=>_e({limit:e},{signal:t}),enabled:!1,staleTime:1/0}),{refetch:l}=s;(0,M.useEffect)(()=>{if(!c.data)return;let e=r.getQueryData(i);if(!e||e.pages.length===0)return;let t=$i(e.pages,c.data);t===`refetch`?l():r.setQueryData(i,{...e,pages:t})},[r,c.dataUpdatedAt,l]);let u=(s.data?.pages??[]).flatMap(e=>e.projectsState===`refreshing`&&e.projectsGeneration?[e.projectsGeneration]:[]),d=N({queries:u.map(e=>({queryKey:[...i,`projects`,e],queryFn:({signal:t})=>v(e,{signal:t}),enabled:t,staleTime:1/0,retry:!1}))});return(0,M.useEffect)(()=>{d.forEach((e,t)=>{let n=u[t];!n||!e.data&&!e.error||r.setQueryData(i,t=>{if(!t)return t;let r=!1,i=t.pages.map(t=>{if(t.projectsGeneration!==n||t.projectsState!==`refreshing`)return t;let i=e.data;return i?.generation&&i.generation!==n?t:(r=!0,i?.state===`ready`?{...t,projectsState:`ready`,projects:i.projects,issues:t.issues.map(e=>({...e,projectIds:i.membership?.[e.number]??[]}))}:{...t,projectsState:`unavailable`,projectsReason:i?.reason??`Project boards unavailable. Refresh to try again.`})});return r?{...t,pages:i}:t})})},[r,d.map((e,t)=>e.data||e.error?u[t]:``).join(`,`)]),{pages:s,data:(0,M.useMemo)(()=>Zi(s.data?.pages??[]),[s.data])}}function ia(e,t=50,n=!0){let r=Rt({...na([e,`github`,`pages`,t],t,e),enabled:n});return{pages:r,data:(0,M.useMemo)(()=>Zi(r.data?.pages??[]),[r.data])}}function aa(e,t,n=!0){let r=N({queries:t.filter(e=>e.length>0).map(t=>({queryKey:W.githubCommentCounts(e,t),queryFn:({signal:n})=>u(e,t,{},{signal:n}),enabled:n,staleTime:6e4}))});return(0,M.useMemo)(()=>{let e={};for(let t of r)t.data?.available&&Object.assign(e,t.data.counts);return e},[r.map(e=>e.dataUpdatedAt).join(`,`)])}function oa(e,t,n,r=!0){return A({queryKey:[e,`github`,`search`,t,n],queryFn:({signal:r})=>gt(t,n,{projectId:e},{signal:r}),enabled:r&&n.trim()!==``,staleTime:6e4})}function sa(e,t=!0){return A({queryKey:W.githubChecks(e),queryFn:({signal:t})=>Ft(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function ca(e,t,n=!0){return A({queryKey:W.githubSearch(e,t),queryFn:({signal:n})=>gt(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var la=100;function ua(e){return[...e].sort((e,t)=>t-e).slice(0,la).sort((e,t)=>e-t)}function da(){let e=vt(),t=q();return e.projectId??t.data?.bootProject}function fa(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))Qn(U({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))Qn(U({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var pa=5*6e4;function ma(e){return e?e.recheckAfterMs:pa}function ha(e,t=!0){let n=(0,M.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:ua(t.prs),issues:ua(t.issues)}))},[e.map(U).sort().join(`|`)]),r=N({queries:n.map(e=>({queryKey:W.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>se(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>ma(e.state.data)??1/0,refetchInterval:!1,refetchOnWindowFocus:!0}))}),a=y(),o=JSON.stringify(n.map((e,t)=>({...e,interval:ma(r[t]?.data)??!1})));(0,M.useEffect)(()=>{if(!t||i())return;let e=!0,n=JSON.parse(o).filter(e=>e.interval!==!1).map(t=>{let n=new URLSearchParams;t.prs.length&&n.set(`prs`,t.prs.join(`,`)),t.issues.length&&n.set(`issues`,t.issues.join(`,`));let r=W.githubRefStatus(t.projectId,t.prs,t.issues);return Bt({path:`/api/v1/p/${t.projectId}/github/ref-status?${n}`,intervalMs:t.interval},(t,n)=>{n||a.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&a.setQueryData(r,t)})})});return()=>{e=!1;for(let e of n)e()}},[t,o,a]);let s=(0,M.useMemo)(()=>cr(n,r),[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,M.useCallback)(e=>{let t=U(e),n=s.get(t);if(n)return n;let r=V.get(t);return{state:`idle`,...r?{status:r}:{},...H.has(t)?{conflicting:!0}:{}}},[s])}function ga(e,t,n=!0){return A({queryKey:W.githubComments(e,t),queryFn:({signal:n})=>Te(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function _a(e,t,n=!0){return A({queryKey:W.githubItem(e,t),queryFn:({signal:n})=>te(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function va(e){return A({queryKey:W.githubPrChanges(e??0),queryFn:({signal:t})=>Ce(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{$r as $,Zt as $t,oi as A,br as At,mi as B,Jn as Bt,Ei as C,kr as Ct,Ci as D,Ar as Dt,Ni as E,hr as Et,Qr as F,dr as Ft,Si as G,B as Gt,hi as H,zn as Ht,xi as I,lr as It,ui as J,Hn as Jt,ei as K,Rn as Kt,ai as L,W as Lt,ci as M,Br as Mt,pi as N,zr as Nt,Ai as O,Er as Ot,bi as P,ur as Pt,di as Q,L as Qt,gi as R,G as Rt,wi as S,vr as St,Oi as T,Tr as Tt,vi as U,Vn as Ut,qr as V,Wn as Vt,ti as W,Ln as Wt,ni as X,In as Xt,li as Y,Bn as Yt,ii as Z,Sn as Zt,ki as _,Rr as _t,ga as a,N as an,Q as at,ji as b,Nr as bt,va as c,Pr as ct,oa as d,Fr as dt,Yt as en,Jr as et,da as f,Cr as ft,Fi as g,Lr as gt,Pi as h,q as ht,aa as i,P as in,fi as it,si as j,wr as jt,Yr as k,Or as kt,ca as l,Mr as lt,Yi as m,Ir as mt,ea as n,F as nn,Xr as nt,_a as o,Ht as on,jr as ot,ha as p,_r as pt,ri as q,Un as qt,sa as r,I as rn,yi as rt,ra as s,Vr as st,fa as t,Jt as tn,Zr as tt,ia as u,Dr as ut,Ti as v,gr as vt,Di as w,yr as wt,Ii as x,mr as xt,Mi as y,pr as yt,_i as z,Kn as zt};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{c as n,o as r}from"./utils-DSMR_WLb.js";import{n as i,t as a}from"./live-refetch-CZb2VOyu.js";import{$r as o,$t as s,Ai as c,An as l,B as u,Bt as d,C as f,Di as p,Ei as m,Et as h,Fn as g,Fr as _,G as v,Gt as ee,H as te,Ht as ne,In as re,Ir as ie,It as ae,Jt as oe,K as se,Kt as ce,Mn as le,Nn as ue,Nr as de,Nt as fe,Ot as pe,Pn as me,Pt as he,Qt as ge,R as _e,Rt as ve,S as ye,Si as be,T as xe,Tt as Se,U as Ce,Ut as we,V as Te,Vr as Ee,Vt as De,Wt as Oe,Xr as ke,Xt as Ae,Zt as je,_ as Me,_i as Ne,_r as Pe,_t as Fe,ai as Ie,an as Le,b as Re,bt as ze,ci as y,cn as Be,dn as Ve,dt as He,ei as Ue,en as We,f as Ge,fn as Ke,fr as qe,ft as Je,g as Ye,gt as Xe,ht as Ze,ii as Qe,in as $e,jn as et,k as tt,li as nt,ln as rt,lt as it,mi as at,mn as ot,mt as st,ni as ct,oi as lt,on as ut,ot as dt,p as ft,pi as pt,pn as mt,pt as ht,q as gt,qt as _t,r as vt,ri as yt,sn as bt,ti as xt,tn as St,tt as Ct,ut as wt,v as Tt,vt as Et,w as Dt,wi as Ot,wt as kt,x as At,xt as jt,y as Mt,yi as Nt,yt as Pt,z as Ft,zt as It}from"./project-scope-context-D9axDY18.js";import{A as Lt,B as b,F as x,H as S,I as C,N as w,P as T,W as E,Z as D,j as O,z as k}from"./live-protocol-DteqtbyN.js";import{t as Rt}from"./useInfiniteQuery-GZp9laKm.js";import{t as A}from"./useQuery-CzVHT8UE.js";import{n as j,r as zt,t as Bt}from"./live-reads-BxjlQXfN.js";import{n as Vt}from"./toaster-Bo5vCbz-.js";var Ht=class extends pt{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ut(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=at({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),D.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ut(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Wt=class extends c{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),m(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Ne(t.mutationKey)!==Ne(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Ut();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){D.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Gt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Kt(e,t,n){let r=e.slice(0);return r[t]=n,r}var qt=class extends c{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,D.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!m(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Gt(e,n).forEach(e=>{e.destroy()}),Gt(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=Ot(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new nt(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Kt(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&D.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},M=e(t(),1);function N({queries:e,...t},n){let r=y(n),i=lt(),a=Ie(),s=M.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);s.forEach(e=>{o(e);let t=r.getQueryCache().get(e.queryHash);ct(e,a,t)}),Qe(a);let[c]=M.useState(()=>new qt(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&t.subscribed!==!1;M.useSyncExternalStore(M.useCallback(e=>f?c.subscribe(D.batchCalls(e)):be,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),M.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>xt(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&xt(n,e)?Ue(n,new nt(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&yt({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m?.error)throw m.error;return u(d())}function P(e,t){let n=y(t),[r]=M.useState(()=>new Wt(n,e));M.useEffect(()=>{r.setOptions(e)},[r,e]);let i=M.useSyncExternalStore(M.useCallback(e=>r.subscribe(D.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=M.useCallback((e,t)=>{r.mutate(e,t).catch(be)},[r]);if(i.error&&p(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function F(e={}){let t=e.projectId??n();return{projectId:t,cacheScope:e.cacheScope??(e.boot?`default`:t)}}function I(e,t={}){return{...F(t),runId:e}}function Jt(e,t=!0,n=!1,r){return A({queryKey:[F({projectId:e,boot:n}).cacheScope,`runs`,`list`],queryFn:({signal:t})=>Se(F({projectId:e,boot:n}),{signal:t}),enabled:t,...r?{select:r}:{},placeholderData:(t,r)=>n&&r?.queryKey[0]===e?t:void 0})}function L(e,t,n=`active`){return e.invalidateQueries({queryKey:t===void 0?[`workspace`,`models`]:G.models(t),refetchType:n})}function Yt(e,t=!0,n){return A({...Xt(e,n),enabled:t})}var Xt=(e,t)=>({queryKey:G.models(e,t),queryFn:({signal:n})=>re(e,{signal:n},t),staleTime:300*1e3});function Zt(e,t=!0){let n=N({queries:e.map(e=>({...Xt(e),enabled:t}))});return Object.fromEntries(e.map((e,t)=>[e,n[t]]))}function Qt(e,t){return JSON.stringify([e,t])}function $t(e){return e.type===`run`?e.run.id:e.id}function R(e,t){return{...e,runs:t}}function en(e,t){let n=0;for(let r of e)r.projectId===t&&r.archived&&(n+=1);return n}var tn=class{runs;copied=!1;positions=new Map;constructor(e){this.runs=e,this.reindex()}reindex(){this.positions.clear(),this.runs.forEach((e,t)=>this.positions.set(Qt(e.projectId,e.id),t))}at(e,t){return this.positions.get(Qt(e,t))??-1}mutable(){return this.copied||=(this.runs=[...this.runs],!0),this.runs}replace(e,t){return this.mutable()[e]=t,this.runs}remove(e){return this.mutable().splice(e,1),this.reindex(),this.runs}insert(e){let t=this.runs.findIndex(t=>(t.createdAt??``).localeCompare(e.createdAt)<0);return this.mutable().splice(t<0?this.runs.length:t,0,e),this.reindex(),this.runs}};function nn(e,t,n){let r=new tn(e.runs),i=e,a=!1;for(let e of t)if(e.type===`usage`)i=ln(i,e.project,e.usage,r);else{let t=on(i,e.change,n,r);i=t.index,a||=t.reconcile}return{index:i,reconcile:a}}function rn(e,t,n){return n?n.has(t):e.runs.some(e=>e.projectId===t)}function an(e,t,n){return on(e,t,n,new tn(e.runs))}function on(e,t,n,r){let{project:i}=t,a=r.at(i,$t(t)),o=a>=0?e.runs[a]:void 0,s=e.truncated.includes(i);if(t.type===`deleted`)return o?{index:R(e,r.remove(a)),reconcile:s&&o.archived}:{index:e,reconcile:!1};let{run:c}=t;if(c.delegation?.role===`worker`)return o?{index:R(e,r.remove(a)),reconcile:!1}:{index:e,reconcile:!1};if(!o&&!rn(e,i,n))return{index:e,reconcile:!0};let l=Ot(o,{projectId:i,...c});if(o){if(l===o)return{index:e,reconcile:!1};let t=r.replace(a,l),n=o.archived!==l.archived&&(s||en(t,i)>e.perProjectLimit);return{index:R(e,t),reconcile:n}}if(s)return cn(e,l,r);let u=r.insert(l);return{index:R(e,u),reconcile:l.archived&&en(u,i)>e.perProjectLimit}}function sn(e,t){let n;for(let r of e)r.projectId===t&&r.archived&&(n===void 0||r.createdAt<n)&&(n=r.createdAt);return n}function cn(e,t,n){let r=sn(e.runs,t.projectId),i=r!==void 0&&t.createdAt>r;return t.archived&&!i?{index:e,reconcile:!1}:{index:R(e,n.insert(t)),reconcile:t.archived||r===void 0||t.createdAt<r}}function ln(e,t,n,r){let i=!1;return e.runs.forEach((e,a)=>{if(e.projectId!==t)return;let o=n[e.id];if(o){let t=Ot(e.usage,o);if(t===e.usage)return;r.replace(a,{...e,usage:t})}else{if(e.usage===void 0)return;let{usage:t,...n}=e;r.replace(a,n)}i=!0}),i?R(e,r.runs):e}function un(e,t){let n=e.runs.filter(e=>e.projectId!==t),r=e.truncated.filter(e=>e!==t),i=Object.prototype.hasOwnProperty.call(e.referenceStatuses,t);if(n.length===e.runs.length&&r.length===e.truncated.length&&!i)return e;let a={...e.referenceStatuses};return delete a[t],{...e,runs:n,truncated:r,referenceStatuses:a}}function dn(){return{stream:void 0,lastStream:void 0,mismatch:void 0,floor:void 0,changes:new Map}}function fn(e,t,n){if(e.lastStream===t)e.floor=Math.max(e.floor??n,n);else{for(let[n,r]of e.changes)r.generation!==t&&e.changes.delete(n);e.floor=n}e.stream=t,e.lastStream=t,e.mismatch=void 0}function pn(e){e.stream=void 0}function mn(e,t,n=!1){let r=e.stream;if(r===void 0)return!1;(e.floor===void 0||n)&&(e.floor=t.seq-1);let i=JSON.stringify([r,t.project,$t(t)]),a=e.changes.get(i);return(!a||a.seq<t.seq)&&e.changes.set(i,{...t,generation:r}),!0}function hn(e,t){for(let[n,r]of e.changes)r.project===t&&e.changes.delete(n)}function gn(e){return typeof e.generation==`string`&&typeof e.eventSeq==`number`}function _n(e,t,n){if(!gn(t))return{index:t,reconcile:!1};let{generation:r,eventSeq:i}=t;if(e.stream!==void 0&&e.stream!==r){let n=e.mismatch!==r;return e.mismatch=r,{index:t,reconcile:n}}let a=e.lastStream===r&&e.floor!==void 0,o=a&&i<e.floor,s=t,c=o,l=[...e.changes.entries()].filter(([,e])=>e.generation===r),u=l.map(([,e])=>e).filter(e=>e.seq>i).sort((e,t)=>e.seq-t.seq);for(let e of u){let t=an(s,e,n);s=t.index,c||=t.reconcile}for(let[t,n]of l)n.seq<=i&&e.changes.delete(t);return a&&!o&&(e.floor=i),{index:s,reconcile:c}}var z=[`workspace`,`runs-index`],vn=[`workspace`,`projects`],yn=6e4,bn=100,xn=new WeakMap;function Sn(e){let t=xn.get(e);return t||(t=Dn(e),xn.set(e,t)),t}function Cn(e,t){return typeof e!=`object`||!e||!Array.isArray(e.runs)?e:Sn(t).merge(e)}function wn(e){let t=e.getQueryData(vn)?.projects;return t?new Set(t.map(e=>e.id)):void 0}function Tn(e,t,n){if(!(!e||typeof e.eventSeq!=`number`||typeof t.eventSeq!=`number`))return e.generation===t.generation?t.eventSeq<e.eventSeq?e:void 0:n!==void 0&&e.generation===n&&t.generation!==n?e:void 0}function En(e,t){return t.type===`run-summary`?{type:`run`,project:e,seq:t.seq,run:t.summary}:{type:`deleted`,project:e,seq:t.seq,id:t.id}}function Dn(e){let t=dn(),n=[],r,i,a,o,s=!1,c=-1/0,l=new Set,u=!1,d,f=!1,p=()=>{if(!u){if(u=!0,d?.()){f=!0;return}_({hold:!0})}},m=t=>{c=Date.now(),e.setQueryData(z,t)},h=()=>e.getQueryData(z),g=()=>{clearTimeout(a),a=void 0;let t=e.getQueryCache().find({queryKey:z,exact:!0}),n=(t!==void 0&&t.state.data===void 0&&t.state.fetchStatus!==`idle`?e.cancelQueries({queryKey:z,exact:!0}).then(()=>e.invalidateQueries({queryKey:z})):e.invalidateQueries({queryKey:z})).catch(()=>void 0).finally(()=>{o===n&&(o=void 0,s&&(s=!1,g()))});return o=n,n},_=(e={})=>o?(s=!0,o):e.hold?(a??=setTimeout(()=>{g()},400),Promise.resolve()):g(),v=()=>{r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0;let t=n;n=[];let a=h();if(!a||t.length===0)return;let o=wn(e),{index:s,reconcile:c}=nn(a,t.filter(e=>e.generation===a.generation?e.type===`usage`?!l.has(e.project):!l.has(e.change.project)&&e.change.seq>a.eventSeq:!1),o);s!==a&&m(s),c&&_({hold:!0})},ee=()=>{if(i!==void 0)return;let e=c+250-Date.now();if(e>0){i=setTimeout(v,e);return}i=setTimeout(v,bn),typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(v))};return{ready(e,n){fn(t,e,n),u=!1,f&&(f=!1,_({hold:!0}))},detach(){pn(t)},run(e,r,i=!1){if(l.has(e))return;let a=En(e,r);if(!mn(t,a,i)){p();return}n.push({type:`change`,change:a,generation:t.stream}),ee()},usage(e,r){if(!l.has(e)){if(t.stream===void 0){p();return}n.push({type:`usage`,project:e,usage:r,generation:t.stream}),ee()}},dropProject(e){l.add(e),hn(t,e),n=n.filter(t=>(t.type===`change`?t.change.project:t.project)!==e);let r=h();if(!r)return;let i=un(r,e);i!==r&&m(i)},setUnknownGenerationHandler(e){d=e},restoreProject(e){l.delete(e)},merge(n){let r=h(),i=_n(t,n,wn(e));for(let e of l)i.index=un(i.index,e);return i.reconcile&&queueMicrotask(()=>{_({hold:!0})}),Tn(r,n,t.stream)??i.index},reconcile:_,flush:v,stop(){r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0,clearTimeout(a),a=void 0,n=[],s=!1}}}var On=O([`own`,`provider-spanning`]),kn=b({suggested:w(b({id:E(),label:E(),desc:E()})),retired:w(E())}),An=b({id:O([`settings`,`mcp`,`memory`]),label:E(),note:E().optional(),empty:E().optional(),showsUserMcp:C(!0).optional()}),jn=b({label:E(),note:E().optional(),groups:w(An)}),Mn=b({runners:w(b({id:ke,displayName:E(),modelListName:E(),modelIdScope:On,pickerLabel:E(),pickerDescription:E(),icon:E(),installHint:E(),loginCommand:E(),terminalLogin:T().optional(),browserLogin:T().optional(),managedInstall:C(!0).optional(),accountFolderExample:E().optional(),models:kn,agentConfig:jn}))}),Nn=[`workspace`,`runners`];async function Pn(e){return g(await et.api.v1.runners.$get({},le(e)),`/runners`,Mn)}var Fn={queryKey:Nn,queryFn:({signal:e})=>Pn({signal:e}),staleTime:1/0};function In(){return A(Fn)}function Ln(e){return e?.runners??[]}function Rn(e){return Ln(e).map(e=>e.id)}function zn(e,t){if(e!==void 0)return t.includes(e)?e:t[0]}function Bn(e){let t=In();return{runner:t.isSuccess?zn(e,Rn(t.data))??e:e,ready:!t.isPending}}function B(e,t){return e?.runners.find(e=>e.id===t)}function Vn(e,t){return B(e,t)?.displayName??t}function Hn(e,t){return B(e,t)?.pickerLabel??t}function Un(e,t){return B(e,t)?.modelListName}function Wn(e,t,r=!0){let i=ki(),a=q(),{runner:o,ready:s}=Bn(e??i.data?.defaultRunner??`claude`),c=a.data?.capabilities?.localHandoff===!1?null:t,l=n(),u=A({queryKey:W.runnerSkills(o,c),queryFn:({signal:e})=>ye(o,c,{signal:e,projectId:l}),enabled:r&&s&&(e!==void 0||!i.isPending)&&(!t||!a.isPending),retry:!1});return{...u,runner:o,account:c,data:u.data?.skills,list:u.data,unchecked:u.isError||!u.data||u.data.source===`unavailable`}}var Gn={draft:{label:`Draft`,hint:`the author has not marked it ready for review`,tone:`neutral`},"review-required":{label:`Waiting for review`,hint:`checks are fine, no one has reviewed it yet`,tone:`info`},"changes-requested":{label:`Changes requested`,hint:`a reviewer asked for edits before this can merge`,tone:`danger`},"checks-pending":{label:`Checks running`,hint:`CI has not finished on the latest commit`,tone:`pending`},"checks-failing":{label:`Checks failing`,hint:`CI is red on the latest commit`,tone:`danger`},ready:{label:`Ready to merge`,hint:`open, checks pass, nothing is waiting on a reviewer`,tone:`success`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`merged`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`success`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`accent`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},Kn={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function qn(e){return typeof e==`string`&&Object.hasOwn(Gn,e)}function Jn(e){return e!==void 0&&qn(e)?Gn[e]:void 0}var Yn=`cez.reference-statuses.v1`,Xn=`cez.reference-conflicts.v1`,V=new Map(er()),Zn=1e3;function Qn(e,t){if(V.get(e)!==t){for(V.delete(e),V.set(e,t);V.size>Zn;){let e=V.keys().next().value;if(e===void 0)break;V.delete(e)}rr()}}var H=new Set(tr());function $n(e,t){if(H.has(e)!==t){if(t)for(H.add(e);H.size>Zn;){let e=H.values().next().value;if(e===void 0)break;H.delete(e)}else H.delete(e);rr()}}function er(){try{let e=globalThis.sessionStorage?.getItem(Yn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&qn(e[1])):[]}catch{return[]}}function tr(){try{let e=globalThis.sessionStorage?.getItem(Xn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var nr;function rr(){nr===void 0&&(nr=setTimeout(()=>{nr=void 0;try{globalThis.sessionStorage?.setItem(Yn,JSON.stringify([...V])),globalThis.sessionStorage?.setItem(Xn,JSON.stringify([...H]))}catch{}},250))}var U=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function ir(e,t){return{...e?{status:e}:{},...t?{conflicting:!0}:{}}}function ar(e){return[...e.prs.map(t=>({projectId:e.projectId,kind:`PR`,number:t})),...e.issues.map(t=>({projectId:e.projectId,kind:`Issue`,number:t}))]}function or(e,t,n,r,i,a){let o=r.prs[n.number]??r.issues[n.number];if(!o){e.set(t,{state:`unknown`,...i?{status:i}:{}});return}let s=r.conflicts?r.conflicts.includes(n.number):void 0;Qn(t,o),s!==void 0&&$n(t,s),e.set(t,{state:`ready`,status:o,...s??a?{conflicting:!0}:{}})}function sr(e,t,n){let r=U(t),i=V.get(r),a=H.has(r)?!0:void 0,o=n.data;if(o?.available){or(e,r,t,o,i,a);return}if(o){e.set(r,{state:`unavailable`,reason:o.reason,...ir(i,a)});return}if(n.isError){e.set(r,{state:`unavailable`,reason:n.error instanceof Error?n.error.message:void 0,...ir(i,a)});return}e.set(r,{state:`loading`,...ir(i,a)})}function cr(e,t){let n=new Map;return t.forEach((t,r)=>{let i=e[r];if(i)for(let e of ar(i))sr(n,e,t)}),n}var W={get health(){return[n(),`health`]},runs:{get all(){return[n(),`runs`]},relationships:e=>[n(),`runs`,`relationships`,e],list:(e=n())=>[e,`runs`,`list`],archived:e=>[n(),`runs`,`archived`,e],detail:(e,t=n())=>[t,`runs`,`detail`,e],diff:e=>[n(),`runs`,`diff`,e],changes:e=>[n(),`runs`,`changes`,e],file:(e,t)=>[n(),`runs`,`files`,e,t],handoff:e=>[n(),`runs`,`handoff`,e],commits:e=>[n(),`runs`,`commits`,e],commit:(e,t)=>[n(),`runs`,`commit`,e,t]},get workflows(){return[n(),`workflows`]},runnerSkills:(e,t)=>[n(),`runner-skills`,e,t??null],get repo(){return[n(),`repo`]},get repoChanges(){return[n(),`repo`,`changes`]},repoCommit:e=>[n(),`repo`,`commit`,e],get repoBranches(){return[n(),`repo`,`branches`]},get uiState(){return[n(),`ui-state`]},get config(){return[n(),`config`]},get agentConfig(){return[n(),`agent-config`]},agentConfigFile:e=>[n(),`agent-config`,`file`,e],get worktrees(){return[n(),`worktrees`]},github:(e={})=>[n(),`github`,e.limit??null],githubPages:e=>[n(),`github`,`pages`,e],githubPagesHead:e=>[n(),`github`,`pages-head`,e],githubCommentCounts:(e,t)=>[n(),`github`,`comment-counts`,e,[...t].sort((e,t)=>e-t).join(`,`)],githubChecks:e=>[n(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[n(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[n(),`github`,`comments`,e,t],githubItem:(e,t)=>[n(),`github`,`item`,e,t],githubRefStatusOf:e=>[e,`github`,`ref-status`],githubPrChanges:e=>[n(),`github`,`pr-changes`,e],githubMergeState:e=>[n(),`github`,`merge-state`,e],get openTargets(){return[n(),`open-targets`]}},G={models:(e,t)=>t&&t!=="default"?[`workspace`,`models`,e,t]:[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],runsIndex:z,runsSearch:e=>[`workspace`,`runs-search`,e],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],agentProfiles:[`workspace`,`agent-profiles`],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...G.fsBrowseRoot,e,t]};function lr(e){if(!e)return;let t=e.trim().replace(/\/+$/,``),n=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(t),r=n?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(t),i=n??r;if(!i)return;let[,a,o]=i;if(!o||a?.toLowerCase()!==`github.com`)return;let s=o.replace(/\.git$/i,``).split(`/`).filter(Boolean),c=s[s.length-2],l=s[s.length-1];return c&&l?`https://github.com/${c}/${l}`:void 0}function ur(e){let t=new Map;for(let n of e)for(let e of n.tags??[]){let n=e.toLowerCase();t.has(n)||t.set(n,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function dr(e,t,n,r=8){let i=n.trim().toLowerCase(),a=new Set(t.map(e=>e.toLowerCase())),o=e.filter(e=>{let t=e.toLowerCase();return a.has(t)?!1:i===``||t.includes(i)&&t!==i});return i===``?o.slice(0,r):o.sort((e,t)=>Number(t.toLowerCase().startsWith(i))-Number(e.toLowerCase().startsWith(i))||e.localeCompare(t,void 0,{sensitivity:`base`})).slice(0,r)}function fr(e){let t=new Map;for(let n of e){let e=n.trim();if(!e)continue;let r=e.toLowerCase();t.has(r)||t.set(r,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function pr(){let e=y();return A({queryKey:G.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(G.providerStatus),r=await s(!1,{signal:t});return Pe(n,e.getQueryData(G.providerStatus),r)},staleTime:5*6e4,refetchInterval:a(!1),refetchOnWindowFocus:!0})}function mr(){let e=y();return P({mutationFn:()=>s(!0),onMutate:()=>e.getQueryData(G.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(G.providerStatus,e=>Pe(r,e,t)),L(e)}})}function hr(){let e=y();return P({mutationFn:({provider:e,authFailureId:t})=>Be(e,t),onMutate:()=>e.getQueryData(G.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(G.providerStatus,e=>Pe(r,e,t,n.authFailureId)),L(e,n.provider)}})}function gr(e={}){return A({queryKey:G.projects,queryFn:({signal:e})=>ge({signal:e}),...e})}function _r(e,t=!1){return A({queryKey:G.fsBrowse(e,t),queryFn:({signal:n})=>De(e??void 0,{signal:n,showHidden:t}),retry:!1})}function vr(){let e=y();return P({mutationFn:e=>$e(e),onSuccess:()=>e.invalidateQueries({queryKey:G.projects})})}function yr(){let e=y();return P({mutationFn:e=>ut(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:G.projects})}})}function br(){let e=y();return P({mutationFn:e=>{let{id:t,...n}=e;return mt(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:G.projects});let r=e.getQueryData(G.projects);return e.setQueryData(G.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?xr(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(G.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(G.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:G.projects})})}function xr(e,t){let{maxParallel:n,tags:r,...i}=e,a={...i},o=`maxParallel`in t?t.maxParallel:e.maxParallel;o!=null&&(a.maxParallel=o);let s=`tags`in t&&t.tags!==void 0?t.tags:e.tags,c=s==null?[]:fr(s);if(c.length>0&&(a.tags=c),`webhook`in t&&t.webhook!==void 0)if(t.webhook===null)delete a.webhook;else{let n=t.webhook.token===void 0?e.webhook?.tokenSet??!1:t.webhook.token!==``;a.webhook={url:t.webhook.url,tokenSet:n}}return a}function Sr(e){let t=y();return P({mutationFn:e,retry:!1,onSuccess:({project:e})=>{t.setQueryData(G.projects,t=>t===void 0?t:{...t,projects:t.projects.map(t=>t.id===e.id?e:t)})},onSettled:()=>t.invalidateQueries({queryKey:G.projects})})}function Cr(){return Sr(e=>{let{projectId:t,...n}=e;return ce(t,n)})}function wr(){return Sr(e=>{let{projectId:t,webhookId:n,...r}=e;return ot(t,n,r)})}function Tr(){return Sr(({projectId:e,webhookId:t})=>bt(e,t))}function Er(){return P({mutationFn:({projectId:e,webhookId:t})=>Ve(e,t),retry:!1})}function K(e){let t=y();return P({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:G.agentProfiles}),t.invalidateQueries({queryKey:G.projects}),t.invalidateQueries({predicate:({queryKey:e})=>e[1]===`runner-skills`}),L(t)])},onError:()=>{t.invalidateQueries({queryKey:W.health}),t.invalidateQueries({queryKey:G.agentProfiles,exact:!0})}})}function Dr(){return K(e=>Oe(e))}function Or(){return K(e=>{let{id:t,...n}=e;return Ke(t,n)})}function kr(){return K(e=>Le(e))}function Ar(){return K(e=>rt(e))}function jr(e,t){return A({queryKey:G.agentAccountStatus(e),queryFn:({signal:t})=>_t(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function Mr(){let e=y();return P({mutationFn:({provider:e,profileId:t})=>we(e,t),retry:!1,onSuccess:async(t,{provider:n})=>{await Promise.all([e.invalidateQueries({queryKey:G.agentProfiles}),e.invalidateQueries({queryKey:G.providerStatus}),L(e,n,`none`)])},onError:()=>{e.invalidateQueries({queryKey:W.health}),e.invalidateQueries({queryKey:G.agentProfiles,exact:!0})}})}function Nr(){let e=y();return P({mutationFn:e=>_t(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(G.agentAccountStatus(n),t),e.invalidateQueries({queryKey:G.agentProfiles}),L(e,t.status.provider)}})}function Pr(){let e=y();return P({mutationFn:e=>ne(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:G.projects})})}function Fr(){let e=y();return P({mutationFn:e=>ee(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:G.projects})})}function Ir({enabled:e}){return A({queryKey:G.githubOwners,queryFn:({signal:e})=>Ae({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function Lr(){let e=y();(0,M.useEffect)(()=>{let t,n=()=>{let n=e.getQueryData(W.health);n&&(_({bootProject:n.bootProject??`default`,apiBase:r()}),t??=zt(`health`,t=>{e.setQueryData(W.health,t)}))};n();let i=e.getQueryCache().subscribe(n);return()=>{i(),t?.(),Ee()}},[e])}function q(){return A({queryKey:W.health,queryFn:({signal:e})=>je({signal:e})})}function Rr(e,t){let n=q().data,r=gr(t).data?.projects,i=vt(),a=e??i.projectId,o=a??n?.bootProject,s=o===void 0?void 0:r?.find(e=>e.id===o);return s?.repoUrl?s.repoUrl:a===null||a===n?.bootProject?lr(n?.repo?.remote):void 0}function zr(){return A({queryKey:G.uiState,queryFn:({signal:e})=>St({signal:e})})}function Br(){return A({queryKey:G.config,queryFn:({signal:e})=>We({signal:e})})}function Vr(){return A({queryKey:G.agentProfiles,queryFn:({signal:e})=>oe({signal:e})})}var J=[`workspace`,`runs-index`],Y=e=>[e.cacheScope,`runs`,`list`],X=e=>[e.cacheScope,`runs`,`detail`,e.runId],Z=e=>typeof e==`function`?e():e;function Hr(e){let{seenAt:t,...n}=e;return n}function Ur(e,t){let n=Hr(e);return t.seenAt===void 0?n:{...n,seenAt:t.seenAt}}function Wr(e,t,n){return t?{...e,seenAt:n}:Hr(e)}function Gr(e){let t=()=>{e.invalidateQueries({queryKey:J})};function r(r,i){if(r===`index`)return t();let a=typeof i==`function`?i():i;if(r===`indexed`){t(),e.invalidateQueries({queryKey:[n(),`runs`]}),e.invalidateQueries({queryKey:[a.projectId,`runs`,`list`]});return}if(r===`runs`)return e.invalidateQueries({queryKey:[a.cacheScope,`runs`]});let o=ie(),s=[a.projectId,a.cacheScope],c=o!==void 0&&s.some(e=>e===o||e==="default")?[o,`default`]:[],l=new Set([...s,...c,n()]);return Promise.all([...l].map(t=>e.invalidateQueries({queryKey:[t,`runs`]}))).then(()=>void 0)}async function i(n,r){await e.cancelQueries({queryKey:Y(Z(n))}),await e.cancelQueries({queryKey:X(Z(n))});let i=e.getQueryData(Y(Z(n))),a=e.getQueryData(X(Z(n))),o=Z(n).runId,s=new Date().toISOString();return e.setQueryData(Y(Z(n)),e=>e?.map(e=>e.id===o?Wr(e,r,s):e)),e.setQueryData(X(Z(n)),e=>e&&Wr(e,r,s)),{id:o,prevList:i,prevDetail:a,rollback(){if(!r){i&&e.setQueryData(Y(Z(n)),i),a&&e.setQueryData(X(Z(n)),a);return}let t=i?.find(e=>e.id===o);t&&e.setQueryData(Y(Z(n)),e=>e?.map(e=>e.id===o?Ur(e,t):e)),a&&e.setQueryData(X(Z(n)),e=>e&&Ur(e,a))},settle(i){let a=e=>e.id===(r?o:i.id)?Wr(e,r,i.seenAt):e;e.setQueryData(Y(Z(n)),e=>e?.map(a));let s={...Z(n),runId:r?o:i.id};e.setQueryData(X(s),e=>e?a(e):i),t()}}}async function a(t,n){await e.cancelQueries({queryKey:J});let i=e.getQueryData(J),a=n();return e.setQueryData(J,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===t.projectId&&e.id===t.runId?a(e):e)}),{previous:i,rollback(){i&&e.setQueryData(J,i)},settle(){r(`indexed`,t)}}}return{patchRead:i,patchIndex:a,invalidateAfter:r}}function Q(){let e=y();return(0,M.useMemo)(()=>Gr(e),[e])}async function Kr(e,t=!1){return me(await et.api.v1.p[`:projectId`].runs[`:id`][`worker-destroy`].$post({param:{projectId:n(),id:encodeURIComponent(e)},query:{},json:t?{discardWork:!0}:{}}),ue(e,`/worker-destroy`))}function qr(){return A({queryKey:W.openTargets,queryFn:({signal:e})=>st({signal:e}),staleTime:5*6e4})}function Jr(){return A({queryKey:W.runs.list(),queryFn:({signal:e})=>Se(F(),{signal:e})})}function Yr(e,t){return Rt({queryKey:W.runs.archived(e),enabled:t,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>it({before:t,limit:200,q:e},{signal:n}),getNextPageParam:e=>e.nextCursor??void 0,placeholderData:(e,t)=>t?.queryKey[0]===n()?e:void 0})}function Xr(e){let t=e.trim();return A({queryKey:G.runsSearch(t),queryFn:({signal:e})=>ve(t,{signal:e}),enabled:t.length>=2,placeholderData:Nt,staleTime:1e4})}function Zr(e=!0,t=yn,n){let r=Sn(y());return j(`/api/v1/workspace/runs-index`,G.runsIndex,a(e?t:!1),Cn),A({queryKey:G.runsIndex,queryFn:({signal:e})=>h({signal:e}).then(r.merge),enabled:e,...n?{select:n}:{},staleTime:3e4,refetchInterval:!1})}function Qr(e){let t=y();return P({mutationFn:({workerId:e,discardWork:t=!1})=>Kr(e,t),onSettled:()=>t.invalidateQueries({queryKey:W.runs.relationships(e)})})}function $r(e,t={}){return A({queryKey:W.runs.relationships(e),queryFn:({signal:t})=>kt(e,{signal:t}),enabled:t.enabled??!0})}function ei(e){return A({queryKey:W.runs.detail(e??``),queryFn:({signal:t})=>Ze(I(e),{signal:t}),enabled:!!e})}function ti(e,t,n=!0){return A({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Ze(I(t,{projectId:e}),{signal:n}),enabled:n&&!!e&&!!t})}function ni(e){return A({queryKey:W.runs.diff(e??``),queryFn:({signal:t})=>Pt(e,{signal:t}),enabled:!!e})}function ri(e,t=!1){return j(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/changes`:void 0,W.runs.changes(e??``),a(t?4e3:!1)),A({queryKey:W.runs.changes(e??``),queryFn:({signal:t})=>Xe(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0})}function ii(e,t){return A({queryKey:W.runs.file(e??``,t??``),queryFn:({signal:n})=>ze(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function ai(e,t){return A({queryKey:[n(),`runs`,`file-link`,e,t],queryFn:({signal:n})=>ht(e,t,{signal:n}),enabled:t!==null,retry:!1})}function oi(e,t){return A({queryKey:[n(),`runs`,`artifact`,e,t],queryFn:({signal:n})=>wt(e,t,{signal:n}),enabled:t!==null,retry:!1})}function si(e,t){return A({queryKey:[n(),`runs`,`artifact-metadata`,e,t],queryFn:({signal:n})=>He(e,t,{signal:n}),enabled:t!==null,retry:!1})}function ci(e){return A({queryKey:[n(),`runs`,`artifacts`,e],queryFn:({signal:t})=>Je(e,{signal:t}),retry:!1,staleTime:0,refetchOnWindowFocus:!0})}function li(e,t=!1){return j(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/commits`:void 0,W.runs.commits(e??``),a(t?5e3:!1)),A({queryKey:W.runs.commits(e??``),queryFn:({signal:t})=>Et(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1})}function ui(e,t){return A({queryKey:W.runs.commit(e??``,t??``),queryFn:({signal:n})=>Fe(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function di(e,t=!0){return A({queryKey:W.runs.handoff(e??``),queryFn:({signal:t})=>jt(I(e),{signal:t}),enabled:!!e&&t})}function fi(e,t,n){return A({queryKey:e===void 0?W.runs.handoff(t):[e,`runs`,`handoff`,t],queryFn:({signal:n})=>jt(I(t,{projectId:e}),{signal:n}),enabled:n,staleTime:15e3})}function pi(e,t){let r=[...new Set(e)],i=N({queries:r.map(e=>({queryKey:[e??n(),`automations`,`names`],queryFn:({signal:t})=>Ye({signal:t,archived:`include`,...e===void 0?{}:{projectId:e}}),enabled:t,staleTime:6e4,retry:!1}))}),a=i.map(e=>e.data);return(0,M.useMemo)(()=>{let e=new Map;return a.forEach((t,n)=>{if(t?.available)for(let i of t.automations)e.set(JSON.stringify([r[n]??null,i.id]),i.name)}),(t,n)=>e.get(JSON.stringify([t??null,n]))},[JSON.stringify([r,i.map(e=>e.dataUpdatedAt)])])}function mi(e){let t=y();return P({mutationFn:t=>pe(e,t),retry:!1,onSuccess:()=>t.invalidateQueries({queryKey:W.runs.all})})}function hi(e){let t=y();return P({mutationFn:t=>fe(e,t),onSuccess:()=>t.invalidateQueries({queryKey:W.runs.all})})}function gi(e){let t=Q(),n=e?.projectId,r=e?.cacheScope,i=P({mutationFn:e=>d(e,!0),onMutate:e=>t.patchRead(e,!0),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)}),a=(0,M.useCallback)(e=>({...I(e,{projectId:n,cacheScope:r}),id:e}),[n,r]),o=(0,M.useCallback)(e=>({onSuccess:(t,n,r,i)=>e?.onSuccess?.(t,n.id,r,i),onError:(t,n,r,i)=>e?.onError?.(t,n.id,r,i),onSettled:(t,n,r,i,a)=>e?.onSettled?.(t,n,r.id,i,a)}),[]),{mutate:s,mutateAsync:c}=i,l=(0,M.useCallback)((e,t)=>s(a(e),o(t)),[s,a,o]),u=(0,M.useCallback)((e,t)=>c(a(e),o(t)),[c,a,o]);return{...i,variables:i.variables?.id,mutate:l,mutateAsync:u}}function _i(){let e=Q();return P({mutationFn:e=>d(I(e),!1),onMutate:t=>e.patchRead(()=>I(t),!1),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)})}function vi(e){let t=Q();return P({mutationFn:({id:t,pinned:n})=>he(I(t,e),n),onError:e=>Vt(`Could not update pin. ${e.message} Please retry.`,{tone:`danger`}),onMutate:()=>e??F(),onSuccess:(e,n,r)=>t.invalidateAfter(`runs`,r)})}function yi(e,t){let n=Q();return P({mutationFn:n=>It(I(e,{projectId:t}),n),onMutate:()=>F({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`send`,r),onError:(e,t,r)=>{e instanceof l&&e.status===409&&r&&n.invalidateAfter(`send`,r)}})}function bi(e,t){let n=Q();return P({mutationFn:(n={})=>Ct(I(e,{projectId:t}),n),onMutate:()=>F({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`continue`,r)})}function xi(e){let t=y();return P({mutationFn:({msgId:t,message:n})=>dt(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:W.runs.all})})}function Si(e){let t=y();return P({mutationFn:t=>ae(e,t),onSuccess:()=>t.invalidateQueries({queryKey:W.runs.all})})}function Ci(){return A({queryKey:W.workflows,queryFn:({signal:e})=>Dt({signal:e})})}function wi(){return A({queryKey:W.repo,queryFn:({signal:e})=>Tt({signal:e})})}function Ti(e){return A({queryKey:[e,`repo`],queryFn:({signal:t})=>Tt({signal:t},e)})}function Ei(){return A({queryKey:W.repoBranches,queryFn:({signal:e})=>Mt({signal:e})})}function Di(){return A({queryKey:W.repoChanges,queryFn:({signal:e})=>Re({signal:e}),retry:!1})}function Oi(e){return A({queryKey:W.repoCommit(e??``),queryFn:({signal:t})=>At(e,{signal:t}),enabled:!!e,retry:!1})}function ki(){return A({queryKey:W.config,queryFn:({signal:e})=>Me({signal:e})})}function Ai(){return A({queryKey:W.worktrees,queryFn:({signal:e})=>xe({signal:e})})}function ji(e){return A({queryKey:[e,`worktrees`],queryFn:({signal:t})=>xe({signal:t},e),staleTime:0})}function Mi(e,t=!0,n=!1){return A({queryKey:[F({projectId:e,boot:n}).cacheScope,`ui-state`],queryFn:({signal:t})=>f({signal:t},e),select:e=>e.sidebarLimits===void 0?e:{...e,sidebarLimits:de(e.sidebarLimits)},enabled:t})}function Ni(){return Mi(n())}function Pi(){return A({queryKey:W.agentConfig,queryFn:({signal:e})=>Ge({signal:e})})}function Fi(e){return A({queryKey:W.agentConfigFile(e??``),queryFn:({signal:t})=>ft(e,{signal:t}),enabled:e!==null})}function Ii(e){let t=y(),n=W.agentConfig,r=W.agentConfigFile(e);return P({mutationFn:t=>tt(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}var Li=O([`passing`,`failing`,`pending`]).nullable(),$=b({kind:O([`issue`,`pr`]),number:k(),title:E(),author:E(),createdAt:E(),labels:w(E()),body:E().optional(),url:E(),comments:k(),assignees:w(E()).optional(),projectIds:w(E()).optional(),isDraft:T().optional(),additions:k().optional(),deletions:k().optional(),checks:Li.optional()});x(`available`,[b({available:C(!0),item:$.nullable(),labelColors:S(E(),E()).optional()}),b({available:C(!1),reason:E()})]),b({kind:O([`issue`,`pr`]),number:Lt().int().positive().safe()});var Ri=b({id:E(),title:E(),url:E()});b({available:T(),reason:E().optional(),repo:E().optional(),syncedAt:E().optional(),issues:w($),prs:w($),labelColors:S(E(),E()).optional(),viewerLogin:E().optional(),projects:w(Ri).optional(),projectsReason:E().optional(),projectsState:O([`refreshing`,`ready`,`unavailable`]).optional(),projectsGeneration:E().optional(),issuesTotal:k().int().nonnegative().optional(),prsTotal:k().int().nonnegative().optional(),issuesNextCursor:E().nullable().optional(),prsNextCursor:E().nullable().optional(),commentsDeferred:C(!0).optional()});var zi=E().min(1).max(2e3).optional();b({limit:E().optional(),refresh:E().optional(),issuesCursor:zi,prsCursor:zi,issuesDone:C(`1`).optional(),prsDone:C(`1`).optional()}).superRefine((e,t)=>{e.issuesDone&&e.issuesCursor&&t.addIssue({code:`custom`,message:`issuesDone and issuesCursor are exclusive`}),e.prsDone&&e.prsCursor&&t.addIssue({code:`custom`,message:`prsDone and prsCursor are exclusive`}),e.issuesDone&&e.prsDone&&t.addIssue({code:`custom`,message:`both sides are done; there is no page to ask for`})}),b({kind:O([`issue`,`pr`]),numbers:E().regex(/^[1-9]\d{0,15}(,[1-9]\d{0,15})*$/).refine(e=>{let t=e.split(`,`);return t.length<=100&&t.every(e=>Number.isSafeInteger(Number(e)))},{message:`at most 100 safe positive integers`}),refresh:C(`1`).optional()}),x(`available`,[b({available:C(!0),counts:S(k(),k().int().nonnegative())}),b({available:C(!1),reason:E()})]),x(`available`,[b({available:C(!0),checks:S(k(),Li)}),b({available:C(!1),reason:E()})]),b({kind:O([`issue`,`pr`]),q:E().trim().min(1).max(256),limit:Lt().int().positive().max(50).optional()}),b({available:T(),projectsReason:E().optional(),reason:E().optional(),items:w($),truncated:T().optional(),labelColors:S(E(),E()).optional()});var Bi=k().nullable();x(`available`,[b({available:C(!0),prs:S(k(),qe),issues:S(k(),qe),conflicts:w(k()).optional(),recheckAfterMs:Bi}),b({available:C(!1),reason:E(),recheckAfterMs:Bi})]);var Vi=b({id:k(),author:E(),avatarUrl:E().optional(),createdAt:E(),body:E(),kind:O([`comment`,`review`]),reviewState:O([`approved`,`changes_requested`,`commented`,`dismissed`]).optional(),url:E()}),Hi=O([`committed`,`labeled`,`unlabeled`,`assigned`,`unassigned`,`merged`,`closed`,`reopened`,`head_ref_force_pushed`,`cross-referenced`,`renamed`]),Ui=b({id:E(),kind:Hi,actor:E(),avatarUrl:E().optional(),createdAt:E(),url:E().optional(),sha:E().optional(),message:E().optional(),checks:Li.optional(),label:b({name:E(),color:E().optional()}).optional(),subject:E().optional(),refNumber:k().optional(),refTitle:E().optional(),refIsPr:T().optional()});b({available:T(),reason:E().optional(),comments:w(Vi),truncated:T().optional(),events:w(Ui).optional(),detail:b({body:E(),additions:k().int().nonnegative().optional(),deletions:k().int().nonnegative().optional()}).optional()});var Wi=O([`merge`,`squash`,`rebase`]),Gi=b({name:E(),state:O([`passing`,`failing`,`pending`,`unknown`]),required:T().nullable(),url:E().optional()}),Ki=b({number:k(),title:E(),url:E(),state:O([`open`,`closed`,`merged`]),isDraft:T(),headRef:E(),baseRef:E(),headSha:E(),mergeable:O([`mergeable`,`conflicting`,`unknown`]),reviewDecision:O([`approved`,`changes-requested`,`review-required`,`not-required`,`unknown`]),checks:w(Gi),methods:w(Wi),defaultMethod:Wi.nullable(),eligibility:O([`ready`,`blocked`,`pending`,`unauthorized`,`terminal`,`unknown`]),blockers:w(b({code:E(),message:E()})),canMerge:T(),canOverride:T()});x(`available`,[b({available:C(!0),mergeState:Ki}),b({available:C(!1),reason:E()})]),b({merged:C(!0),number:k(),url:E(),method:Wi,mergeCommitSha:E().optional()});var qi=b({path:E(),previousPath:E().optional(),status:O([`added`,`modified`,`removed`,`renamed`,`copied`,`changed`]),additions:k(),deletions:k(),patch:E().optional(),patchUnavailableReason:O([`binary`,`too-large`,`not-provided`]).optional(),truncated:T().optional()});x(`available`,[b({available:C(!0),number:k(),headSha:E(),files:w(qi),additions:k(),deletions:k(),truncated:T(),reason:E().optional()}),b({available:C(!1),reason:E()})]),b({generation:E().uuid()}),x(`state`,[b({generation:E().uuid(),state:C(`ready`),projects:w(Ri),membership:S(E(),w(E()))}),b({generation:E().uuid(),state:C(`unavailable`),reason:E()})]);function Ji(e){if(!e.available)return;let t=e.issuesNextCursor,n=e.prsNextCursor;if(!(t===void 0&&n===void 0)&&!(!t&&!n))return{...t?{issuesCursor:t}:{issuesDone:!0},...n?{prsCursor:n}:{prsDone:!0}}}function Yi(e,t){return e?(t===`issues`?e.issuesNextCursor:e.prsNextCursor)==null:!1}function Xi(e,t,n){for(let r of e)t.has(r.number)||(t.add(r.number),n.push(r))}function Zi(e){let t=e[0];if(!t)return;let n=e[e.length-1],r=[],i=[],a=new Set,o=new Set,s={};for(let t of e){Xi(t.issues,a,r),Xi(t.prs,o,i);for(let[e,n]of Object.entries(t.labelColors??{}))s[e]??=n}let c=e.find(e=>e.projects)?.projects,l=e.map(e=>e.projectsState),u=e.find(e=>e.projectsState===`unavailable`),d=l.includes(`refreshing`)?`refreshing`:u?`unavailable`:l.some(e=>e===`ready`)?`ready`:void 0,{projectsGeneration:f,projectsReason:p,...m}=t;return{...m,issues:r,prs:i,...Object.keys(s).length>0?{labelColors:s}:{},...c?{projects:c}:{},...d?{projectsState:d}:{},...d===`unavailable`&&u?.projectsReason?{projectsReason:u.projectsReason}:{},...`issuesNextCursor`in n?{issuesNextCursor:n.issuesNextCursor}:{},...`prsNextCursor`in n?{prsNextCursor:n.prsNextCursor}:{}}}var Qi=e=>e.map(e=>e.number).join(`,`);function $i(e,t){let n=e[0];if(e.length>1&&n&&(Qi(n.issues)!==Qi(t.issues)||Qi(n.prs)!==Qi(t.prs)||n.issuesTotal!==t.issuesTotal||n.prsTotal!==t.prsTotal))return`refetch`;let r=t;if(n&&t.available&&t.projectsState===`refreshing`&&n.repo===t.repo){let e=new Map(n.issues.map(e=>[e.number,e.projectIds]));r={...t,issues:t.issues.map(t=>{let n=e.get(t.number);return t.projectIds===void 0&&n!==void 0?{...t,projectIds:n}:t})}}return[r,...e.slice(1)]}function ea(e={},t=!0){let r=y(),i=W.github(e);j(`/api/v1/p/${n()}/github${e.limit===void 0?``:`?limit=${e.limit}`}`,i,a(t?6e4:!1));let o=A({queryKey:W.github(e),queryFn:({signal:t})=>_e({limit:e.limit},{signal:t}),enabled:t,staleTime:6e4,refetchInterval:!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0}),s=o.data?.projectsGeneration,c=A({queryKey:[...i,`projects`,s],queryFn:({signal:e})=>v(s,{signal:e}),enabled:t&&o.data?.projectsState===`refreshing`&&!!s,staleTime:1/0,retry:!1});return(0,M.useEffect)(()=>{!s||!c.data&&!c.error||r.setQueryData(i,e=>{if(!e||e.projectsGeneration!==s||e.projectsState!==`refreshing`)return e;let t=c.data;return t?.generation&&t.generation!==s?e:t?.state===`ready`?{...e,projectsState:`ready`,projects:t.projects,issues:e.issues.map(e=>({...e,projectIds:t.membership?.[e.number]??[]}))}:{...e,projectsState:`unavailable`,projectsReason:t?.reason??`Project boards unavailable. Refresh to try again.`}})},[r,s,c.data,c.error,i]),o}var ta=class extends Error{};function na(e,t,n){return{queryKey:e,initialPageParam:{},queryFn:async({pageParam:e,signal:r})=>{let i=await _e({limit:t,...e,...n?{projectId:n}:{}},{signal:r});if(!i.available&&Object.keys(e).length>0)throw new ta(i.reason??`GitHub is unavailable.`);return i},getNextPageParam:e=>Ji(e),retry:(e,t)=>!(t instanceof ta)&&!(t instanceof l&&t.status>=400&&t.status<500)&&e<1,staleTime:6e4,refetchOnWindowFocus:!0}}function ra(e=50,t=!0){let r=y(),i=W.githubPages(e),o=W.githubPagesHead(e);j(`/api/v1/p/${n()}/github?limit=${e}`,o,a(t?6e4:!1));let s=Rt({...na(i,e),enabled:t,refetchInterval:!1,refetchIntervalInBackground:!1}),c=A({queryKey:o,queryFn:({signal:t})=>_e({limit:e},{signal:t}),enabled:!1,staleTime:1/0}),{refetch:l}=s;(0,M.useEffect)(()=>{if(!c.data)return;let e=r.getQueryData(i);if(!e||e.pages.length===0)return;let t=$i(e.pages,c.data);t===`refetch`?l():r.setQueryData(i,{...e,pages:t})},[r,c.dataUpdatedAt,l]);let u=(s.data?.pages??[]).flatMap(e=>e.projectsState===`refreshing`&&e.projectsGeneration?[e.projectsGeneration]:[]),d=N({queries:u.map(e=>({queryKey:[...i,`projects`,e],queryFn:({signal:t})=>v(e,{signal:t}),enabled:t,staleTime:1/0,retry:!1}))});return(0,M.useEffect)(()=>{d.forEach((e,t)=>{let n=u[t];!n||!e.data&&!e.error||r.setQueryData(i,t=>{if(!t)return t;let r=!1,i=t.pages.map(t=>{if(t.projectsGeneration!==n||t.projectsState!==`refreshing`)return t;let i=e.data;return i?.generation&&i.generation!==n?t:(r=!0,i?.state===`ready`?{...t,projectsState:`ready`,projects:i.projects,issues:t.issues.map(e=>({...e,projectIds:i.membership?.[e.number]??[]}))}:{...t,projectsState:`unavailable`,projectsReason:i?.reason??`Project boards unavailable. Refresh to try again.`})});return r?{...t,pages:i}:t})})},[r,d.map((e,t)=>e.data||e.error?u[t]:``).join(`,`)]),{pages:s,data:(0,M.useMemo)(()=>Zi(s.data?.pages??[]),[s.data])}}function ia(e,t=50,n=!0){let r=Rt({...na([e,`github`,`pages`,t],t,e),enabled:n});return{pages:r,data:(0,M.useMemo)(()=>Zi(r.data?.pages??[]),[r.data])}}function aa(e,t,n=!0){let r=N({queries:t.filter(e=>e.length>0).map(t=>({queryKey:W.githubCommentCounts(e,t),queryFn:({signal:n})=>u(e,t,{},{signal:n}),enabled:n,staleTime:6e4}))});return(0,M.useMemo)(()=>{let e={};for(let t of r)t.data?.available&&Object.assign(e,t.data.counts);return e},[r.map(e=>e.dataUpdatedAt).join(`,`)])}function oa(e,t,n,r=!0){return A({queryKey:[e,`github`,`search`,t,n],queryFn:({signal:r})=>gt(t,n,{projectId:e},{signal:r}),enabled:r&&n.trim()!==``,staleTime:6e4})}function sa(e,t=!0){return A({queryKey:W.githubChecks(e),queryFn:({signal:t})=>Ft(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function ca(e,t,n=!0){return A({queryKey:W.githubSearch(e,t),queryFn:({signal:n})=>gt(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var la=100;function ua(e){return[...e].sort((e,t)=>t-e).slice(0,la).sort((e,t)=>e-t)}function da(){let e=vt(),t=q();return e.projectId??t.data?.bootProject}function fa(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))Qn(U({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))Qn(U({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var pa=5*6e4;function ma(e){return e?e.recheckAfterMs:pa}function ha(e,t=!0){let n=(0,M.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:ua(t.prs),issues:ua(t.issues)}))},[e.map(U).sort().join(`|`)]),r=N({queries:n.map(e=>({queryKey:W.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>se(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>ma(e.state.data)??1/0,refetchInterval:!1,refetchOnWindowFocus:!0}))}),a=y(),o=JSON.stringify(n.map((e,t)=>({...e,interval:ma(r[t]?.data)??!1})));(0,M.useEffect)(()=>{if(!t||i())return;let e=!0,n=JSON.parse(o).filter(e=>e.interval!==!1).map(t=>{let n=new URLSearchParams;t.prs.length&&n.set(`prs`,t.prs.join(`,`)),t.issues.length&&n.set(`issues`,t.issues.join(`,`));let r=W.githubRefStatus(t.projectId,t.prs,t.issues);return Bt({path:`/api/v1/p/${t.projectId}/github/ref-status?${n}`,intervalMs:t.interval},(t,n)=>{n||a.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&a.setQueryData(r,t)})})});return()=>{e=!1;for(let e of n)e()}},[t,o,a]);let s=(0,M.useMemo)(()=>cr(n,r),[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,M.useCallback)(e=>{let t=U(e),n=s.get(t);if(n)return n;let r=V.get(t);return{state:`idle`,...r?{status:r}:{},...H.has(t)?{conflicting:!0}:{}}},[s])}function ga(e,t,n=!0){return A({queryKey:W.githubComments(e,t),queryFn:({signal:n})=>Te(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function _a(e,t,n=!0){return A({queryKey:W.githubItem(e,t),queryFn:({signal:n})=>te(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function va(e){return A({queryKey:W.githubPrChanges(e??0),queryFn:({signal:t})=>Ce(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{$r as $,Zt as $t,oi as A,br as At,mi as B,Jn as Bt,Ei as C,kr as Ct,Ci as D,Ar as Dt,Ni as E,hr as Et,Qr as F,dr as Ft,Si as G,B as Gt,hi as H,zn as Ht,xi as I,lr as It,ui as J,Hn as Jt,ei as K,Rn as Kt,ai as L,W as Lt,ci as M,Br as Mt,pi as N,zr as Nt,Ai as O,Er as Ot,bi as P,ur as Pt,di as Q,L as Qt,gi as R,G as Rt,wi as S,vr as St,Oi as T,Tr as Tt,vi as U,Vn as Ut,qr as V,Wn as Vt,ti as W,Ln as Wt,ni as X,In as Xt,li as Y,Bn as Yt,ii as Z,Sn as Zt,ki as _,Rr as _t,ga as a,N as an,Q as at,ji as b,Nr as bt,va as c,Pr as ct,oa as d,Fr as dt,Yt as en,Jr as et,da as f,Cr as ft,Fi as g,Lr as gt,Pi as h,q as ht,aa as i,P as in,fi as it,si as j,wr as jt,Yr as k,Or as kt,ca as l,Mr as lt,Yi as m,Ir as mt,ea as n,F as nn,Xr as nt,_a as o,Ht as on,jr as ot,ha as p,_r as pt,ri as q,Un as qt,sa as r,I as rn,yi as rt,ra as s,Vr as st,fa as t,Jt as tn,Zr as tt,ia as u,Dr as ut,Ti as v,gr as vt,Di as w,yr as wt,Ii as x,mr as xt,Mi as y,pr as yt,_i as z,Kn as zt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{Bt as a,p as o,zt as s}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{Bt as a,p as o,zt as s}from"./queries-DzwCG927.js";import{n as c}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{a as l}from"./tasks-table-CmESFng9.js";import{F as u,H as d,M as f,N as p,P as m,f as h,g,h as _,m as v,ot as y,p as b}from"./design-icons-CzEoMH9c.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{n as S,r as C,t as w}from"./popover-BPgUYFyu.js";var T=x(`search-x`,[[`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`}]]),E={general:[`Settings`,`General`],webhooks:[`Settings`,`General`,`Webhooks`],providers:[`Settings`,`Agent defaults`,`Providers`],projects:[`Settings`,`Projects`],worktrees:[`Settings`,`Worktrees`],sidebar:[`Settings`,`Sidebar`]};function D(e,t=` → `){return E[e].join(t)}var O=e(t(),1),k=n(),A=(0,O.createContext)(null);function j({children:e}){let[t,n]=(0,O.useState)(()=>new Map),r=(0,O.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,O.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=o((0,O.useMemo)(()=>[...t.values()].flat(),[t])),s=(0,O.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,k.jsx)(A.Provider,{value:s,children:e})}var M=(0,O.createContext)(null);function ee({projectId:e,repoBase:t,requests:n,children:r}){let i=(0,O.useContext)(A),a=(0,O.useContext)(M),s=(0,O.useId)();(0,O.useEffect)(()=>{if(i)return i.publish(s,n),()=>i.retract(s)},[i,s,n.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let c=o(i?N:n),l=i?.lookup??c,u=t??(a&&a.projectId===e?a.repoBase:void 0),d=(0,O.useMemo)(()=>({lookup:l,projectId:e,repoBase:u}),[l,e,u]);return(0,k.jsx)(M.Provider,{value:d,children:r})}var N=[];function P(e,t,n){let r=(0,O.useContext)(M),i=n??r?.projectId;return!r||!i||t===void 0?te:r.lookup({projectId:i,kind:e,number:t})}function F(e,t){let n=(0,O.useContext)(M),r=t??n?.projectId;return!n||!r?[]:e.filter(e=>n.lookup({projectId:r,kind:`PR`,number:e}).conflicting===!0)}function I(){let e=(0,O.useContext)(M);return{projectId:e?.projectId,repoBase:e?.repoBase}}var te=Object.freeze({state:`idle`}),ne={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,accent:`border-accent-strong/35 text-accent-text`,merged:`border-merged-strong/35 text-merged-text`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},L={success:`text-success`,danger:`text-danger`,accent:`text-merged-text`,merged:`text-merged-text`,info:`text-info`,neutral:`text-soft-foreground`,pending:`text-pending-strong`,conflict:`text-conflict`},re={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,accent:`hover:bg-accent-strong/10`,merged:`hover:bg-merged-strong/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},R={draft:m,"review-required":u,"changes-requested":d,"checks-pending":null,"checks-failing":g,ready:h,merged:f,closed:p,open:b,completed:h,"not-planned":_};function z(e){return e===`PR`?`pr-chip`:`issue-chip`}function B(e){return e?{"data-conflicting":`true`}:{}}function V(e,t,n,r){return!n||r!==void 0&&l({kind:e,number:t??0,url:n},r)}function H(e,t,n){return e===`PR`&&(t??n)===!0}function U({plain:e,inert:t,conflicting:n,className:r,tone:a}){return e?i(`inline-flex items-center gap-1 rounded-[2px] text-inherit`,n&&`text-conflict font-medium`,!t&&`group/reference focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground`,r):i(`inline-flex h-[22px] items-center gap-1 rounded-md border px-1.5 font-mono text-[12px] font-normal`,ne[a],r)}function W(e,t,n,r){return n&&!r?t?`${e===`PR`?`PR `:``}#${t}`:e:t?`${!r&&e===`Issue`?`Issue `:``}#${t}`:e}function G(e){return e===`PR`?`pull request`:`issue`}function K(e,t,n,r){return`Open the ${e}${t?` #${t}`:``} for ${n}${r?` — ${r.label}`:``}`}function q(e,t){return e&&t?L[t.tone]:void 0}function J(e,t){return!e&&(!t||!r(t))}function Y({conflicting:e,presentation:t,status:n,plain:r,compact:a,inert:o,kind:s,label:c,glyphClass:l}){return(0,k.jsxs)(k.Fragment,{children:[e?(0,k.jsx)(y,{className:i(`size-2.5 shrink-0`,l),"aria-hidden":`true`}):(0,k.jsx)($,{status:t?n:void 0,className:r?i(`size-2.5`,l):void 0}),r&&a?s===`PR`?(0,k.jsx)(u,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,k.jsx)(b,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null,r?(0,k.jsx)(`span`,{className:o?void 0:`underline-offset-2 group-hover/reference:underline group-focus-visible/reference:underline`,children:c}):c]})}function ie({kind:e,status:t,conflicting:n,chipClass:r,body:i}){return(0,k.jsx)(`span`,{"data-slot":z(e),"data-status":t,"data-inert":`true`,...B(n),className:r,children:i})}function ae({kind:e,number:t,tooltip:n,url:i}){return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`span`,{className:`block font-medium`,children:[e===`PR`?`Pull request`:`Issue`,t?` #${t}`:``,` · `,n.headline]}),(0,k.jsx)(`span`,{className:`block`,children:n.detail}),n.also?(0,k.jsx)(`span`,{className:`block opacity-70`,children:n.also}):null,i&&r(i)?(0,k.jsx)(`span`,{className:`block opacity-70`,children:i.replace(/^https?:\/\//,``)}):null]})}function oe({reference:e,taskTitle:t,status:n,conflicting:r,conflictAction:o,projectId:c,repoBase:l,to:u,className:d,compact:f=!1,plain:p=!1,inert:m=!1}){let{kind:h,number:g,url:_}=e,v=I(),y=P(h,V(h,g,_,l??v.repoBase)?g:void 0,c),b=n??y.status,x=a(b),S=H(h,r,y.conflicting),C=S?s:x,w=C?.tone??`accent`,T=U({plain:p,inert:m,conflicting:S,className:d,tone:w}),E=ue(y,C,S?x:void 0),D=W(h,g,p,f),O=G(h),A=K(O,g,t,C),j=(0,k.jsx)(Y,{conflicting:S,presentation:C,status:b,plain:p,compact:f,inert:m,kind:h,label:D,glyphClass:q(p,C)});if(m)return(0,k.jsx)(ie,{kind:h,status:b,conflicting:S,chipClass:T,body:j});let M=J(u,_)?(0,k.jsx)(`span`,{"data-slot":z(h),"data-status":b,...B(S),"aria-label":C?`${O} ${D} — ${C.label}`:void 0,className:T,children:j}):(0,k.jsx)(se,{to:u,url:_,"data-slot":z(h),"data-status":b,...B(S),title:E?void 0:_,"aria-label":A,className:p?T:i(T,re[w]),children:j});return E?(0,k.jsx)(le,{chip:M,action:S?o:void 0,state:y.state,children:(0,k.jsx)(ae,{kind:h,number:g,tooltip:E,url:_})}):M}function se({to:e,url:t,children:n,...r}){return e?(0,k.jsx)(c,{to:e,...r,children:n}):(0,k.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,...r,children:n})}var X=(0,O.createContext)(()=>{});function ce(){return(0,O.useContext)(X)}var Z=150,Q=120;function le({chip:e,action:t,state:n,children:r}){let[i,a]=(0,O.useState)(!1),o=(0,O.useRef)(null),s=(0,O.useRef)(null),c=(0,O.useRef)(void 0),l=(0,O.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,O.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,O.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,k.jsxs)(w,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,k.jsx)(S,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,Z)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Q)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,k.jsxs)(C,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Q)},children:[(0,k.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,k.jsx)(X.Provider,{value:u,children:t}):null]})]})}function ue(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${de(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function de(e){return e.charAt(0).toLowerCase()+e.slice(1)}function fe({kind:e,number:t,className:n}){let r=P(e,t),o=a(r.status),c=e===`PR`&&r.conflicting===!0,l=c?s:o;if(!l)return null;let u=i(`size-2.5`,L[l.tone]);return(0,k.jsx)(`span`,{"data-slot":`reference-status-glyph`,"data-status":r.status,...c?{"data-conflicting":`true`}:{},"aria-hidden":`true`,className:i(`inline-flex items-center`,n),children:c?(0,k.jsx)(y,{className:i(`shrink-0`,u),"aria-hidden":`true`}):(0,k.jsx)($,{status:r.status,className:u})})}function $({status:e,className:t}){if(!e)return null;if(e===`checks-pending`)return(0,k.jsx)(v,{"data-slot":`status-dot`,"data-tone":`pending`,className:i(`size-3 animate-pulse motion-reduce:animate-none`,t),"aria-hidden":`true`});let n=R[e];return n?(0,k.jsx)(n,{className:i(`size-2.5 shrink-0`,t),"aria-hidden":`true`}):null}export{j as a,P as c,ee as i,D as l,fe as n,F as o,ce as r,I as s,oe as t,T as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{ci as r}from"./project-scope-context-D9axDY18.js";import{Lt as i,Rt as a,ht as o}from"./queries-DzwCG927.js";import{vn as s}from"./index-DndX-kC-.js";var c=e(t(),1),l=n();function u(){let e=r(),t=(0,c.useCallback)(async()=>{await Promise.all([e.invalidateQueries({queryKey:i.health}),e.invalidateQueries({queryKey:i.agentConfig,exact:!0}),e.invalidateQueries({queryKey:a.agentProfiles,exact:!0})])},[e]);return(0,c.useEffect)(()=>{t()},[t]),t}var d=`${s()} remote-settings enable`;function f({risk:e}){return o().data?.capabilities?.remoteSettingsAdmin===!0?(0,l.jsxs)(`p`,{role:`note`,"data-slot":`remote-settings-notice`,className:`rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-[13px] text-foreground`,children:[`Remote settings administration is on. `,e,`, and anyone who can open this cockpit can change them. The host operator turns this off with`,` `,(0,l.jsxs)(`code`,{children:[s(),` remote-settings disable`]}),`.`]}):null}export{f as n,u as r,d as t};
|