@open-mercato/cezar 0.20.0-pr2192.5251 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/agent-setup-routes.d.ts +14 -14
- package/dist/server/dashboard.d.ts +54 -54
- package/dist/server/server.d.ts +68 -68
- package/dist/server/worktree-lifecycle.d.ts +90 -90
- package/dist/telemetry-service.json +1 -0
- package/dist/workflows/run-env-keys.d.ts +8 -0
- package/dist/workflows/run-env-keys.js +14 -0
- package/dist/workflows/run-env-keys.js.map +1 -0
- package/package.json +5 -5
- package/web/dist/assets/{active-forge-KyXM3uG9.js → active-forge-CkAcQPDz.js} +1 -1
- package/web/dist/assets/{agent-task-pickers-UkVtTCna.js → agent-task-pickers-BXCIulS3.js} +1 -1
- package/web/dist/assets/{alert-dialog-DT465VL4.js → alert-dialog-B2Vi6MQZ.js} +1 -1
- package/web/dist/assets/{ask-card-DVv8mY_R.js → ask-card-DPIjQSs8.js} +1 -1
- package/web/dist/assets/{assets-view-D22vr-oN.js → assets-view-CsFjfV2n.js} +1 -1
- package/web/dist/assets/{automation-format-KxcnBz7L.js → automation-format-CMG-6CYi.js} +1 -1
- package/web/dist/assets/{automations-route-3gfbxDq2.js → automations-route-Dd7F6b4F.js} +1 -1
- package/web/dist/assets/{button-CEskWahs.js → button-CJXK1JqU.js} +1 -1
- package/web/dist/assets/{centered-state-Cpzaj75Y.js → centered-state-DE6sgEMs.js} +1 -1
- package/web/dist/assets/{chip-CEZRGBV7.js → chip-DTCkrr8F.js} +1 -1
- package/web/dist/assets/{collapsible-ZLdkcdMa.js → collapsible-DHALizq-.js} +1 -1
- package/web/dist/assets/{command-CcbuBum7.js → command-CwP_dLx3.js} +1 -1
- package/web/dist/assets/{commit-list-BSjLQA6p.js → commit-list-BJeaIEp4.js} +1 -1
- package/web/dist/assets/{compare-variants-C9soYpuE.js → compare-variants-CYv97XSw.js} +1 -1
- package/web/dist/assets/{composer-Bz8ZfbHr.js → composer-C-aBJhY0.js} +1 -1
- package/web/dist/assets/{composer-attachments-BD2enHFJ.js → composer-attachments-ChelZhq4.js} +1 -1
- package/web/dist/assets/{dashboard-Bl6qWW8i.js → dashboard-Dh65_Yi7.js} +1 -1
- package/web/dist/assets/{dialog-nn9sCNvn.js → dialog-DVZE8yAO.js} +1 -1
- package/web/dist/assets/{diff-FrEDv09S.js → diff-aKT-mpn8.js} +2 -2
- package/web/dist/assets/{diff-stat-zisAayZW.js → diff-stat-DPetRUXO.js} +1 -1
- package/web/dist/assets/{diff-view-BeoeZVcx.js → diff-view-m4TvXu0y.js} +1 -1
- package/web/dist/assets/{dist-B_KqW6o6.js → dist-Bsi6zLdE.js} +1 -1
- package/web/dist/assets/{dropdown-menu-ayNafd3n.js → dropdown-menu-BKvUsb5Y.js} +1 -1
- package/web/dist/assets/{file-preview-Dzc3RFUx.js → file-preview-C2EkjhOh.js} +1 -1
- package/web/dist/assets/{follow-up-engine-Dul_3U9s.js → follow-up-engine-BnRCTyQ4.js} +1 -1
- package/web/dist/assets/{git-tab-loading-DG4p-eF4.js → git-tab-loading-DpG2D8Vl.js} +1 -1
- package/web/dist/assets/{github-DvZE0hDJ.js → github-CWRtsamJ.js} +1 -1
- package/web/dist/assets/{host-usage-GTjB03IM.js → host-usage-B8ohHYHR.js} +1 -1
- package/web/dist/assets/{icon-tooltip-DRhwcic2.js → icon-tooltip-DYk5cjLx.js} +1 -1
- package/web/dist/assets/{impact-control-CTdtyfcn.js → impact-control-ClslFBBA.js} +1 -1
- package/web/dist/assets/{impact-model-CpNcUgTV.js → impact-model-DCDyRxcf.js} +1 -1
- package/web/dist/assets/{index-BMA7ZpLG.js → index-BfbbA0lF.js} +4 -4
- package/web/dist/assets/{input-BtDLUR9Q.js → input-DofKzJZl.js} +1 -1
- package/web/dist/assets/{loading-state-BTvZxCb2.js → loading-state-NiNQtJ5H.js} +1 -1
- package/web/dist/assets/{manager-avatar-Ct1uVuvZ.js → manager-avatar-CKfqcoJQ.js} +1 -1
- package/web/dist/assets/{manager-chat-BfxPyXv3.js → manager-chat-BdigDKYZ.js} +1 -1
- package/web/dist/assets/{manager-index-CeMdRtKd.js → manager-index-D0TOmxr6.js} +1 -1
- package/web/dist/assets/{manager-new-Bs8_CMUR.js → manager-new-CCet_7u8.js} +1 -1
- package/web/dist/assets/{manager-settings-Bv2EqZvs.js → manager-settings-I1AeATjr.js} +1 -1
- package/web/dist/assets/{managers-DDPXJoKR.js → managers-Dr63u21Y.js} +1 -1
- package/web/dist/assets/{markdown-3rt1rOmI.js → markdown-CXJIKz2i.js} +1 -1
- package/web/dist/assets/{markdown-LlPZylt7.js → markdown-YSf01kqC.js} +1 -1
- package/web/dist/assets/{mascot-picker-BuGxdrpW.js → mascot-picker-C4s7n9Fc.js} +1 -1
- package/web/dist/assets/{new-task-form-BoiK41PS.js → new-task-form-2p4cXcVQ.js} +1 -1
- package/web/dist/assets/{picker-pill-CzANlEqt.js → picker-pill-Dv9H0dRF.js} +1 -1
- package/web/dist/assets/{pill-C2wRS9lg.js → pill-CoDPUIcJ.js} +1 -1
- package/web/dist/assets/{popover-DPba6FvD.js → popover-DUg9gBOn.js} +1 -1
- package/web/dist/assets/{project-router-CnMbTz-a.js → project-router-B1Q3upIJ.js} +1 -1
- package/web/dist/assets/{project-terminal-sfYncenW.js → project-terminal-DbIohh5G.js} +2 -2
- package/web/dist/assets/{provider-auth-alert-DbNH_-XT.js → provider-auth-alert-GxIEkIvw.js} +1 -1
- package/web/dist/assets/{queries-DVZ1lYAo.js → queries-BQUz3Wnb.js} +1 -1
- package/web/dist/assets/{reasoning-effort-pill-al6bbPpw.js → reasoning-effort-pill-BOV3C0If.js} +1 -1
- package/web/dist/assets/{reference-chip-DdxKs2_A.js → reference-chip-BpbybBvl.js} +1 -1
- package/web/dist/assets/{reference-conflict-action-Ci4LDmIm.js → reference-conflict-action-ByDYwT-Y.js} +1 -1
- package/web/dist/assets/{repo-git-BcEGYBrc.js → repo-git-ikURCYEK.js} +1 -1
- package/web/dist/assets/{run-actions-CDKK-8MP.js → run-actions-ChUnbFA7.js} +1 -1
- package/web/dist/assets/{run-diff-JJOUeclX.js → run-diff-B08Fk7dR.js} +1 -1
- package/web/dist/assets/{scroll-within-CfS_Ia4E.js → scroll-within-DMA4ZbQV.js} +1 -1
- package/web/dist/assets/{segmented-Chb1Y4ie.js → segmented-DI7abdqX.js} +1 -1
- package/web/dist/assets/{select-DG3hFvx2.js → select-DL5E3ZAD.js} +1 -1
- package/web/dist/assets/{sheet-DirfZrZD.js → sheet-DPwaj6sk.js} +1 -1
- package/web/dist/assets/{skills-CxWFZgjH.js → skills-BNiKFlUw.js} +1 -1
- package/web/dist/assets/{spinner-CwKcijCN.js → spinner-hSpq0sPM.js} +1 -1
- package/web/dist/assets/{status-dot-CZAbXsOs.js → status-dot-AP_4obOJ.js} +1 -1
- package/web/dist/assets/{tabs-r4PCzkHp.js → tabs-DrhZb97I.js} +1 -1
- package/web/dist/assets/{task-commits-CHnonzuD.js → task-commits-Di0Mc8MX.js} +1 -1
- package/web/dist/assets/{task-graph-DZAjkdmH.js → task-graph-Bpi3lEER.js} +1 -1
- package/web/dist/assets/{task-notes-CHs_WZf5.js → task-notes-DCHLinAF.js} +1 -1
- package/web/dist/assets/{task-workspace-DWGBLHlR.js → task-workspace-DHl5akxu.js} +3 -3
- package/web/dist/assets/{telemetry-onLa6CTl.js → telemetry-3DhVDxf8.js} +1 -1
- package/web/dist/assets/{terminal-drawer-DV7kUP0D.js → terminal-drawer-CEktqC3z.js} +1 -1
- package/web/dist/assets/{terminal-pane-DQAHtCtb.js → terminal-pane-CmmTwiTX.js} +1 -1
- package/web/dist/assets/{terminal-scope-CEQdw5Tz.js → terminal-scope-okFE6qRP.js} +1 -1
- package/web/dist/assets/{textarea-BqeSvPOp.js → textarea-DDyYxCcO.js} +1 -1
- package/web/dist/assets/{thread-items-CNxMLcOo.js → thread-items-C-4IW5zi.js} +1 -1
- package/web/dist/assets/{toaster-4t61QM_C.js → toaster-BoJZiTRl.js} +1 -1
- package/web/dist/assets/{tracker-B7u8exjG.js → tracker-bQUG9SkJ.js} +1 -1
- package/web/dist/assets/{tree-pane-resize-XHzIJDtc.js → tree-pane-resize-xgVK7J9r.js} +1 -1
- package/web/dist/assets/utils-Dp6vCdiU.js +55 -0
- package/web/dist/assets/{workflow-graph-BaZd6m6v.js → workflow-graph-CGMeFErv.js} +1 -1
- package/web/dist/assets/{worktree-lifecycle-YFVatYLd.js → worktree-lifecycle-C18dBDW4.js} +1 -1
- package/web/dist/assets/{worktree-lifecycle-operation-CYHhFvQF.js → worktree-lifecycle-operation-_xqKBVKB.js} +1 -1
- package/web/dist/assets/{zoomable-image-D4B6jvp-.js → zoomable-image-BiM5LfTG.js} +1 -1
- package/web/dist/index.html +46 -46
- package/web/dist/assets/utils-DWwoYTjU.js +0 -60
package/web/dist/assets/{reasoning-effort-pill-al6bbPpw.js → reasoning-effort-pill-BOV3C0If.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{Lt as t}from"./utils-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{Lt as t}from"./utils-Dp6vCdiU.js";import{i as n}from"./new-task-form-2p4cXcVQ.js";import{t as r}from"./picker-pill-Dv9H0dRF.js";var i=e();function a(e,n,r){return t(e)&&n!==``&&r.length>0}function o({runner:e,model:t,value:o,options:s,onPick:c,disabled:l=!1,modelsLocked:u=!1,bare:d=!1,className:f}){if(!a(e,t,s))return null;let p=n(e),m=u?``:o,h=s.find(e=>e.id===m);return(0,i.jsx)(r,{slot:`effort-pill`,ariaLabel:`Effort`,label:m===``?d?`default`:`Effort: default`:h?.id??m,value:m,disabled:l,readOnly:u,className:f,hint:`How much reasoning the selected ${p} model uses for this task.`,disabledHint:u?`Reasoning effort is locked to native ${p} settings.`:`How much reasoning the selected ${p} model uses for this task.`,onPick:c,options:[{value:``,label:`${p} default`,desc:`Use the selected model’s native reasoning setting`},...s.map(e=>({value:e.id,label:e.id,desc:e.description}))]})}export{a as n,o 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{ar as r,at as i,or as a}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{ar as r,at as i,or as a}from"./queries-BQUz3Wnb.js";import{n as o,t as s}from"./utils-Dp6vCdiU.js";import{t as c}from"./createLucideIcon-BHp8sXmF.js";import{t as l}from"./circle-check-BpDFgE5h.js";import{n as u,t as d}from"./git-pull-request-DUnpdU6m.js";import{t as f}from"./git-pull-request-draft-BdwbaFQ3.js";import{t as p}from"./triangle-alert-CIzim6ZN.js";import{n as m,r as h,t as g}from"./popover-DUg9gBOn.js";import{t as _}from"./status-dot-AP_4obOJ.js";var v=c(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),y=c(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),b=c(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),x=c(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),S=c(`git-pull-request-closed`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`m21 3-6 6`,key:`16nqsk`}],[`path`,{d:`m21 9-6-6`,key:`9j17rh`}],[`path`,{d:`M18 11.5V15`,key:`65xf6f`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),C=c(`message-square-warning`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 15h.01`,key:`q59x07`}],[`path`,{d:`M12 7v4`,key:`xawao1`}]]),w=e(t(),1),T=n(),E=(0,w.createContext)(null);function D({children:e}){let[t,n]=(0,w.useState)(()=>new Map),r=(0,w.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),a=(0,w.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),o=i((0,w.useMemo)(()=>[...t.values()].flat(),[t])),s=(0,w.useMemo)(()=>({publish:r,retract:a,lookup:o}),[r,a,o]);return(0,T.jsx)(E.Provider,{value:s,children:e})}var O=(0,w.createContext)(null);function k({projectId:e,requests:t,children:n}){let r=(0,w.useContext)(E),a=(0,w.useId)(),o=t.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`),s=r?.publish,c=r?.retract;(0,w.useEffect)(()=>{if(!(!s||!c))return s(a,t),()=>c(a)},[s,c,a,o]);let l=i(r?A:t),u=r?.lookup??l,d=(0,w.useMemo)(()=>({lookup:u,projectId:e}),[u,e]);return(0,T.jsx)(O.Provider,{value:d,children:n})}var A=[];function j(e,t,n){let r=(0,w.useContext)(O),i=n??r?.projectId;return!r||!i||t===void 0?N:r.lookup({projectId:i,kind:e,number:t})}function M(){let e=(0,w.useContext)(O);return{lookup:e?.lookup??(()=>N),projectId:e?.projectId}}var N=Object.freeze({state:`idle`}),P={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,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`},F={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},I={draft:f,"review-required":d,"changes-requested":C,"checks-pending":null,"checks-failing":x,ready:l,merged:u,closed:S,open:y,completed:l,"not-planned":b};function L({reference:e,taskTitle:t,status:n,conflicting:i,conflictAction:c,projectId:l,className:u,compact:d=!1}){let{kind:f,number:m,url:h}=e,g=j(f,m,l),_=n??g.status,y=a(_),b=f===`PR`&&(i??g.conflicting)===!0,x=b?r:y,S=s(`inline-flex h-5 items-center gap-1 rounded-full border px-2 font-mono text-ui font-medium`,P[x?.tone??`neutral`],u),C=U(g,x,b?y:void 0),w=m?`${!d&&f===`Issue`?`Issue `:``}#${m}`:f,E=f===`PR`?`pull request`:`issue`,D=`Open the ${E} for ${t}${x?` — ${x.label}`:``}`,O=(0,T.jsxs)(T.Fragment,{children:[b?(0,T.jsx)(p,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,T.jsx)(G,{status:x?_:void 0}),w]}),k=!h||!o(h)?(0,T.jsx)(`span`,{"data-slot":f===`PR`?`pr-chip`:`issue-chip`,"data-status":_,...b?{"data-conflicting":`true`}:{},"aria-label":x?`${E} ${w} — ${x.label}`:void 0,className:S,children:O}):(0,T.jsxs)(`a`,{"data-slot":f===`PR`?`pr-chip`:`issue-chip`,"data-status":_,...b?{"data-conflicting":`true`}:{},href:h,target:`_blank`,rel:`noopener noreferrer`,title:C?void 0:h,"aria-label":D,className:s(S,F[x?.tone??`neutral`]),children:[O,(0,T.jsx)(v,{className:`size-2.5`,"aria-hidden":`true`})]});if(!C)return k;let A=(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`span`,{className:`block font-medium`,children:[f===`PR`?`Pull request`:`Issue`,m?` #${m}`:``,` · `,C.headline]}),(0,T.jsx)(`span`,{className:`block`,children:C.detail}),C.also?(0,T.jsx)(`span`,{className:`block opacity-70`,children:C.also}):null,h&&o(h)?(0,T.jsx)(`span`,{className:`block opacity-70`,children:h.replace(/^https?:\/\//,``)}):null]});return(0,T.jsx)(H,{chip:k,action:b?c:void 0,state:g.state,children:A})}var R=(0,w.createContext)(()=>{});function z(){return(0,w.useContext)(R)}var B=150,V=120;function H({chip:e,action:t,state:n,children:r}){let[i,a]=(0,w.useState)(!1),o=(0,w.useRef)(null),s=(0,w.useRef)(null),c=(0,w.useRef)(void 0),l=(0,w.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,w.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,w.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,T.jsxs)(g,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,T.jsx)(m,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,B)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,V)},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,T.jsxs)(h,{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,V)},children:[(0,T.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,T.jsx)(R.Provider,{value:u,children:t}):null]})]})}function U(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${W(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 W(e){return e.charAt(0).toLowerCase()+e.slice(1)}function G({status:e}){if(!e)return null;if(e===`checks-pending`)return(0,T.jsx)(_,{tone:`pending`,pulse:!0,className:`size-[6px]`,"aria-hidden":`true`});let t=I[e];return t?(0,T.jsx)(t,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null}export{j as a,b as c,D as i,y as l,z as n,M as o,k as r,x as s,L as t,v as u};
|
|
@@ -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{En as r,Nn as i,Un as a,Wt as o,X as s,b as c,et as l,mr as u}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{En as r,Nn as i,Un as a,Wt as o,X as s,b as c,et as l,mr as u}from"./queries-BQUz3Wnb.js";import{n as d,o as f,t as p}from"./reference-chip-BpbybBvl.js";import{O as m,g as h,k as g,m as _,u as v,y}from"./run-actions-ChUnbFA7.js";import{t as b}from"./button-CJXK1JqU.js";import{i as x,r as S,t as C}from"./popover-DUg9gBOn.js";import{t as w}from"./spinner-hSpq0sPM.js";import{r as T}from"./toaster-BoJZiTRl.js";import{m as E}from"./telemetry-3DhVDxf8.js";var D=e(t(),1),O=n(),k=220;function A({references:e,taskTitle:t,hidden:n,projectId:r,conflictActionFor:i}){let[a,o]=D.useState(!1),s=D.useRef(!1),c=D.useRef(void 0);D.useEffect(()=>()=>clearTimeout(c.current),[]);let l=e=>e.pointerType!==`touch`,u=()=>clearTimeout(c.current),d=e=>{l(e)&&(u(),s.current=!0,o(!0))},f=e=>{l(e)&&(u(),c.current=setTimeout(()=>o(!1),k))};return(0,O.jsxs)(C,{open:a,onOpenChange:o,children:[(0,O.jsx)(x,{asChild:!0,children:(0,O.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:d,onPointerLeave:f,onPointerDown:()=>{s.current=!1},onClick:()=>{s.current=!1},className:`shrink-0 rounded-full px-1 text-meta font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[`+`,n]})}),(0,O.jsxs)(S,{align:`start`,className:`w-auto min-w-40 p-1.5`,"data-slot":`reference-overflow-list`,onPointerEnter:d,onPointerLeave:f,onOpenAutoFocus:e=>{s.current&&e.preventDefault()},onCloseAutoFocus:e=>{s.current&&e.preventDefault()},children:[(0,O.jsx)(`p`,{className:`px-1 pb-1.5 text-micro text-soft-foreground`,children:`References`}),(0,O.jsx)(`span`,{className:`flex flex-col items-start gap-1`,children:e.map(e=>(0,O.jsx)(p,{reference:e,taskTitle:t,projectId:r,conflictAction:i?.(e)},`${e.kind}#${e.number??``}#${e.url??``}`))})]})]})}var j=[50,100,200,400,800,1e3,1e3,1e3,1e3],M=e=>new Promise(t=>setTimeout(t,e));function N(e){return e instanceof u&&e.status===409&&e.message===`run is still active`}async function P(e,t=M){for(let n=0;;n+=1)try{return await e()}catch(e){let r=j[n];if(!N(e)||r===void 0)throw e;await t(r)}}function F(e){return y(e.status)?`live`:h(e).continueRun?`resume`:`unavailable`}function I(e,t,n=`ask_answer`){let r=o(e.id,t),i=c(e.id,t),a=m(e),s=g(e),d=l(),[f,p]=(0,D.useState)(void 0),[h,_]=(0,D.useState)(!1),y=(0,D.useRef)(!1),b=F(e),x=b===`resume`?!s.usable:b===`live`&&!a.usable,S=b===`unavailable`?`no-session`:x?`provider`:void 0,C=S===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:S===`provider`?b===`resume`?s.reason:a.reason:void 0,w=e=>s.usable?i.mutateAsync({text:e}).then(e=>(E(n),e)):Promise.reject(Error(s.reason??`The run provider is unavailable.`));return{mode:b,providerPending:b===`resume`&&d.isPending,blockedBy:S,reason:C,isPending:h||r.isPending||i.isPending,error:f,send:async t=>{if(S||y.current)return C;y.current=!0,_(!0),p(void 0);try{if(b===`resume`){await P(()=>w(t));return}try{await r.mutateAsync({text:t}),E(n)}catch(n){if(n instanceof u&&n.status===409&&v(e)!==void 0){await P(()=>w(t));return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return p(t),t}finally{y.current=!1,_(!1)}}}}function L({run:e,projectId:t,prNumber:n}){let r=I(e,t),i=d(),[a,o]=(0,D.useState)(!1),s=a||r.isPending,c=!!r.blockedBy,l=async()=>{if(s||c)return;let e=r.mode===`resume`;o(!0);try{let t=await r.send(_(n));t?T(t,{tone:`danger`}):(T(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{o(!1)}};return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(b,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:c||s,onClick:()=>void l(),className:`h-7 w-full text-xs`,children:s?`Sending…`:`Resolve conflicts`}),c&&r.reason?(0,O.jsx)(`span`,{className:`block opacity-70`,children:r.reason}):null]})}function R({projectId:e,runId:t,prNumber:n}){let r=s(e,t);return r.data?(0,O.jsx)(L,{run:r.data,projectId:e,prNumber:n}):(0,O.jsx)(b,{type:`button`,size:`sm`,disabled:!0,"aria-busy":!r.isError||void 0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(w,{className:`size-3.5 text-current`}),`Resolve conflicts`]})})}function z({run:e,reference:t,className:n,compact:o=!1,projectId:s}){let c=f(),{lookup:l}=c,u=s??c.projectId,d=t.kind===`PR`?i(e).filter(e=>e.kind===`PR`&&(e.number!==t.number||!!e.url&&!!t.url&&e.url!==t.url)):[],m=t.number===void 0?[t,...d]:r([{...t,number:t.number},...d],e=>u?l({projectId:u,kind:e.kind,number:e.number}).status:void 0),h=e=>e.kind===`PR`&&e.number!==void 0&&!!u&&l({projectId:u,kind:`PR`,number:e.number}).conflicting===!0,g=[...m.filter(h),...m.filter(e=>!h(e))],[_]=g;if(!_)return null;let v=t=>s===void 0?(0,O.jsx)(L,{run:e,prNumber:t.number}):(0,O.jsx)(R,{projectId:s,runId:e.id,prNumber:t.number}),y=(0,O.jsx)(p,{reference:_,taskTitle:a(e),projectId:s,conflictAction:v(_),className:n,compact:o});return g.length===1?y:(0,O.jsxs)(`span`,{"data-slot":`task-reference-chips`,className:`flex shrink-0 flex-nowrap items-center gap-1`,children:[y,(0,O.jsx)(A,{references:g,taskTitle:a(e),hidden:g.length-1,projectId:s,conflictActionFor:v})]})}export{I as a,P as i,R as n,A as o,z as r,L 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{E as r,Ir as i,bt as a,ht as o,mr as s,mt as c,pt as l,r as u,ra as d,vo as f,vt as p,xo as m,yt as h}from"./queries-DVZ1lYAo.js";import{n as g,t as _}from"./utils-DWwoYTjU.js";import{S as v,l as y,t as b}from"./project-router-CnMbTz-a.js";import{t as x}from"./use-desktop-BNN3U2y9.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{t as C}from"./arrow-down-NfQPLFhe.js";import{t as w}from"./arrow-left-BfRd_mrv.js";import{t as ee}from"./arrow-up-CssRwnnv.js";import{H as te,V as ne,t as T}from"./button-CEskWahs.js";import{i as E,n as re,o as ie,s as D,t as ae}from"./select-DG3hFvx2.js";import{a as oe,f as se,g as O,m as k,p as A,s as ce}from"./impact-model-CpNcUgTV.js";import{i as le,n as ue}from"./file-preview-Dzc3RFUx.js";import{t as de}from"./file--aqoYe_k.js";import{d as j,i as fe,n as pe,o as me,r as he,s as ge,t as _e,u as ve}from"./tree-pane-resize-XHzIJDtc.js";import{t as ye}from"./folder-o-AvL3y3.js";import{r as M,t as be}from"./active-forge-KyXM3uG9.js";import{n as N}from"./upload-BE8GV7hh.js";import{t as xe}from"./git-pull-request-DUnpdU6m.js";import{t as Se}from"./plus-CxRU2X8C.js";import{t as P}from"./refresh-cw-BIgmYimN.js";import{t as Ce}from"./search-x-I9Q8pgUa.js";import{t as F}from"./triangle-alert-CIzim6ZN.js";import{t as I}from"./icon-tooltip-DRhwcic2.js";import{t as L}from"./input-BtDLUR9Q.js";import{r as R}from"./toaster-4t61QM_C.js";import{t as we}from"./diff-stat-zisAayZW.js";import{t as z}from"./centered-state-Cpzaj75Y.js";import{o as Te}from"./index-BMA7ZpLG.js";import{t as Ee}from"./markdown-3rt1rOmI.js";import{t as B}from"./diff-FrEDv09S.js";import{t as De}from"./impact-control-CTdtyfcn.js";import{t as V}from"./commit-list-BSjLQA6p.js";var Oe=S(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),H=e(t(),1),U=n();function ke(){let e=p(),t=h();if(!e.data)return null;let n=e.data,r=e=>t.mutate(e,{onSuccess:e=>R(e.message),onError:e=>R(e.message,{tone:`danger`,expected:e instanceof s&&e.status===409})}),i=t.isPending,a=t.variables;return(0,U.jsxs)(`div`,{"data-slot":`repo-sync`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-meta`,children:[n.upstream?(0,U.jsx)(I,{label:`Upstream`,children:(0,U.jsxs)(`span`,{"data-slot":`repo-upstream`,className:`truncate font-mono text-soft-foreground`,children:[`→ `,n.upstream]})}):n.branch?(0,U.jsx)(`span`,{"data-slot":`repo-upstream`,className:`text-soft-foreground`,children:`not published`}):(0,U.jsx)(`span`,{"data-slot":`repo-upstream`,className:`text-soft-foreground`,children:`detached HEAD`}),n.upstream?(0,U.jsx)(G,{ahead:n.ahead,behind:n.behind}):n.outgoing.length>0?(0,U.jsx)(G,{ahead:n.outgoing.length,behind:null}):null,(0,U.jsx)(`span`,{"data-slot":`repo-fetched`,className:`hidden text-soft-foreground sm:inline`,children:n.lastFetchedAt?`fetched ${je(n.lastFetchedAt)}`:`never fetched`}),(0,U.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,U.jsx)(W,{which:`fetch`,label:`Fetch`,busy:i,pending:a,onClick:r,disabled:!n.pushRemote,children:(0,U.jsx)(P,{"aria-hidden":`true`,className:_(i&&a===`fetch`&&`animate-spin`)})}),n.upstream?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(W,{which:`pull`,label:`Pull`,busy:i,pending:a,onClick:r,disabled:!n.behind,children:(0,U.jsx)(C,{"aria-hidden":`true`})}),(0,U.jsx)(W,{which:`push`,label:`Push`,busy:i,pending:a,onClick:r,disabled:!n.ahead,children:(0,U.jsx)(ee,{"aria-hidden":`true`})}),(0,U.jsx)(W,{which:`sync`,label:`Sync`,busy:i,pending:a,onClick:r,disabled:!n.ahead&&!n.behind,variant:`outline`,children:(0,U.jsx)(P,{"aria-hidden":`true`,className:_(i&&a===`sync`&&`animate-spin`)})})]}):n.branch&&n.pushRemote?(0,U.jsx)(W,{which:`push`,label:`Publish branch`,busy:i,pending:a,onClick:r,variant:`outline`,children:(0,U.jsx)(Oe,{"aria-hidden":`true`})}):null]})]})}function W({which:e,label:t,busy:n,pending:r,onClick:i,disabled:a,variant:o=`ghost`,children:s}){return(0,U.jsxs)(T,{variant:o,size:`sm`,"data-action":`repo-${e}`,"aria-busy":n&&r===e,disabled:n||a,onClick:()=>i(e),children:[s,t]})}function G({ahead:e,behind:t}){return e===null&&t===null?null:!e&&!t?(0,U.jsx)(`span`,{"data-slot":`sync-counts`,className:`text-soft-foreground`,children:`in sync`}):(0,U.jsxs)(`span`,{"data-slot":`sync-counts`,className:`flex items-center gap-1 font-mono`,children:[e?(0,U.jsx)(I,{label:`${e} to push`,children:(0,U.jsxs)(`span`,{"data-sync":`ahead`,className:`text-violet`,children:[`↑`,e]})}):null,t?(0,U.jsx)(I,{label:`${t} to pull`,children:(0,U.jsxs)(`span`,{"data-sync":`behind`,className:`text-pending-strong`,children:[`↓`,t]})}):null]})}function Ae({name:e,sync:t}){if(!t)return null;let n=t.branches.find(t=>t.name===e),r=n?n.gone?`upstream gone`:n.upstream?null:`local only`:`remote only`;return(0,U.jsx)(`span`,{"data-slot":`branch-tracking`,className:`flex shrink-0 items-center gap-1 text-meta`,children:r?(0,U.jsx)(`span`,{className:`text-soft-foreground`,children:r}):(0,U.jsx)(G,{ahead:n.ahead,behind:n.behind})})}function je(e){let t=Math.max(0,Math.round((Date.now()-Date.parse(e))/1e3));if(t<60)return`just now`;let n=Math.round(t/60);if(n<60)return`${n} min ago`;let r=Math.round(n/60);return r<24?`${r} h ago`:`${Math.round(r/24)} d ago`}var K=`__follow__`;function Me({repo:e,info:t}){let n=be(),r=p(),a=m(),o=e=>R(e.message,{tone:`danger`}),s=f({mutationFn:e=>i({name:e}),onSuccess:async e=>{R(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([a.invalidateQueries({queryKey:u.repo}),a.invalidateQueries({queryKey:u.health})]),a.setQueryData(u.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),a.setQueryData(u.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:o}),c=f({mutationFn:e=>d({baseBranch:e}),onSuccess:e=>{R(e.baseBranch?`Agents now branch from ${e.baseBranch}`:`Agents now fork from the checked-out branch`),a.invalidateQueries({queryKey:u.repo})},onError:o}),[l,h]=(0,H.useState)(``),[g,v]=(0,H.useState)(``),y=g.trim().toLowerCase(),b=y?e.branches.filter(e=>e.toLowerCase().includes(y)):e.branches;return(0,U.jsxs)(`section`,{"data-slot":`repo-branches`,className:`flex flex-col gap-6 px-4 py-4 md:px-6`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{className:`eyebrow text-soft-foreground`,children:`Branches`}),(0,U.jsx)(L,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:g,onChange:e=>v(e.target.value),className:`mt-2 max-w-xl`}),(0,U.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-2 flex max-w-xl flex-col divide-y divide-border`,children:[b.map(n=>{let i=n===t.branch,a=e.checkedOutElsewhere?.[n];return(0,U.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":n,className:`flex min-h-9 items-center gap-2 py-1`,children:[(0,U.jsx)(M,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:_(`min-w-0 truncate font-mono text-xs`,i&&`font-semibold`),children:n}),(0,U.jsx)(Ae,{name:n,sync:r.data}),i?(0,U.jsxs)(`span`,{"data-slot":`branch-current`,className:`flex shrink-0 items-center gap-1 rounded-sm bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:[(0,U.jsx)(te,{"aria-hidden":`true`,className:`size-3`}),`current`]}):a?(0,U.jsx)(I,{label:`Checked out in ${a}`,children:(0,U.jsx)(`span`,{"data-slot":`branch-elsewhere`,"data-held-at":a,tabIndex:0,className:`ml-auto shrink-0 rounded-sm text-label text-muted-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`in another worktree`})}):(0,U.jsx)(T,{variant:`ghost`,size:`sm`,"data-action":`switch-branch`,className:`ml-auto`,disabled:s.isPending,onClick:()=>s.mutate(n),children:`Switch`})]},n)}),b.length===0?(0,U.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-label text-muted-foreground`,children:[`No branches match “`,g.trim(),`”.`]}):null]}),(0,U.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-3 flex max-w-md items-center gap-2`,onSubmit:e=>{e.preventDefault();let t=l.trim();t&&s.mutate(t,{onSuccess:()=>h(``)})},children:[(0,U.jsx)(L,{"aria-label":`New branch name`,placeholder:`new-branch-name`,value:l,onChange:e=>h(e.target.value)}),(0,U.jsxs)(T,{type:`submit`,variant:`outline`,size:`sm`,"data-action":`create-branch`,disabled:!l.trim()||s.isPending,children:[(0,U.jsx)(Se,{"aria-hidden":`true`}),`Create`]})]})]}),(0,U.jsxs)(`div`,{className:`max-w-md`,children:[(0,U.jsx)(`label`,{htmlFor:`base-branch-picker`,className:`eyebrow text-soft-foreground`,children:`Agents’ base branch`}),(0,U.jsxs)(ae,{value:e.baseBranch??K,disabled:c.isPending,onValueChange:e=>c.mutate(e===K?null:e),children:[(0,U.jsx)(ie,{id:`base-branch-picker`,"data-slot":`base-branch-picker`,size:`sm`,className:`mt-1.5 w-full`,children:(0,U.jsx)(D,{placeholder:`follow checked-out branch (default)`})}),(0,U.jsxs)(re,{children:[(0,U.jsx)(E,{value:K,children:`follow checked-out branch (default)`}),e.branches.map(e=>(0,U.jsx)(E,{value:e,className:`font-mono text-ui`,children:e},e))]})]}),(0,U.jsx)(`p`,{className:`mt-1 text-label text-muted-foreground`,children:`New task worktrees branch from this.`})]}),n?.available?(0,U.jsx)(Ne,{}):null]})}function Ne(){let e=r({limit:20});return(0,U.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,U.jsx)(`h2`,{className:`eyebrow text-soft-foreground`,children:`Open pull requests`}),e.isPending?(0,U.jsx)(`p`,{className:`mt-2 text-label text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,U.jsx)(`p`,{className:`mt-2 text-label text-muted-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,U.jsx)(`p`,{className:`mt-2 text-label text-muted-foreground`,children:`No open pull requests.`}):(0,U.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,U.jsx)(Pe,{pr:e},e.number))}):(0,U.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-label text-muted-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function Pe({pr:e}){let t=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(xe,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`span`,{className:`shrink-0 font-mono text-meta text-muted-foreground`,children:[`#`,e.number]}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ui`,children:e.title}),e.checks?(0,U.jsx)(Fe,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,U.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:g(e.url)?(0,U.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:_(n,`hover:bg-muted`),children:t}):(0,U.jsx)(`span`,{className:n,children:t})})}function Fe({checks:e}){return(0,U.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:_(`shrink-0 text-label font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}function Ie(){let e=c(),t=x(),[n,r]=(0,H.useState)(`unified`),[i,a]=(0,H.useState)(!1),[o,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(null),f=(0,H.useRef)(null),p=(0,H.useRef)(null),[m,h]=he(),g=pe(m),v=e.isError&&e.error instanceof s&&e.error.status===409,y=e.data?.files??[],b=(0,H.useMemo)(()=>me(y),[y]),S=(0,H.useMemo)(()=>y.some(Ee),[y]),C=t?n:`unified`,w=!t||i;return(0,U.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Uncommitted changes`}),e.data?(0,U.jsx)(ce,{stat:e.data.stat}):null,(0,U.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,U.jsx)(A,{mode:n,wrap:i,preview:o,onModeChange:r,onWrapChange:a,onPreviewChange:S?l:void 0})})]}),e.isPending?(0,U.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-label text-soft-foreground md:px-6`,children:`Loading changes…`}):e.isError?(0,U.jsx)(z,{icon:v?(0,U.jsx)(O,{}):(0,U.jsx)(F,{}),tone:v?`neutral`:`danger`,heading:`h2`,title:v?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):y.length===0?(0,U.jsx)(z,{icon:(0,U.jsx)(O,{}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-5 px-4 py-4 max-md:[--diff-sticky-top:7rem] md:px-6 md:py-0`,children:[(0,U.jsx)(`aside`,{ref:p,"data-slot":`changes-tree-pane`,style:g.style,className:_(`hidden w-60 max-w-[60%] shrink-0 overflow-y-auto overscroll-contain py-4 md:block lg:w-72`,g.className),children:(0,U.jsx)(fe,{root:b,selected:u,onSelect:e=>{d(e),f.current?.scrollToPath(e)}})}),(0,U.jsx)(_e,{paneRef:p,width:m,onWidthChange:h,className:`hidden md:block`}),(0,U.jsx)(`div`,{"data-slot":`diff-pane`,"data-diff-scroller":t?``:void 0,className:`min-w-0 flex-1 md:overflow-y-auto md:overscroll-contain`,children:(0,U.jsx)(B,{files:y,viewRef:f,mode:C,wrap:w,preview:t&&S&&o,className:`min-w-0 md:py-4`})})]})]})}function Le({log:e}){let{sha:t}=v(),n=p().data;if(t)return(0,U.jsx)(Re,{sha:t});let r=new Set(n?.outgoing??[]),i=n?.incoming??[],a=(e,t)=>({sha:e.hash,shaLabel:e.hash,subject:e.subject,author:e.author,when:e.when,href:`/git/commits/${e.hash}`,...t?{sync:t}:{}}),o=i.length>0?(0,U.jsxs)(`section`,{"data-slot":`repo-incoming`,className:`border-b border-border`,children:[(0,U.jsxs)(`h2`,{className:`px-4 pt-3 text-meta font-medium text-muted-foreground md:px-6`,children:[`Incoming from `,n?.upstream,` · `,i.length]}),(0,U.jsx)(V,{slot:`repo-incoming-commits`,commits:i.map(e=>a(e,`incoming`))})]}):null;return e.length===0?(0,U.jsx)(z,{icon:(0,U.jsx)(N,{}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`}):(0,U.jsxs)(U.Fragment,{children:[o,(0,U.jsx)(V,{slot:`repo-commits`,commits:e.map(e=>a(e,r.has(e.hash)?`outgoing`:void 0))})]})}function Re({sha:e}){let t=o(e),n=x(),[r,i]=(0,H.useState)(`unified`),[a,c]=(0,H.useState)(!1),l=t.isError&&t.error instanceof s&&t.error.status===409,u=n?r:`unified`,d=!n||a;return(0,U.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,U.jsx)(T,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,U.jsxs)(b,{to:`/git/commits`,children:[(0,U.jsx)(w,{"aria-hidden":`true`}),`All commits`]})}),t.data?(0,U.jsx)(we,{stat:t.data.stat}):null,(0,U.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,U.jsx)(A,{mode:r,wrap:a,onModeChange:i,onWrapChange:c})})]}),t.isPending?(0,U.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-label text-soft-foreground md:px-6`,children:`Loading commit…`}):t.isError?(0,U.jsx)(z,{icon:l?(0,U.jsx)(Ce,{}):(0,U.jsx)(F,{}),tone:l?`neutral`:`danger`,heading:`h2`,title:l?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,U.jsxs)(`p`,{className:`mt-0.5 text-meta text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,U.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,U.jsx)(z,{icon:(0,U.jsx)(N,{}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,U.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:7rem] md:px-6`,children:(0,U.jsx)(B,{files:t.data.files,mode:u,wrap:d,className:`min-w-0`})})]})]})}function q(e,t){let n=0;for(let r of t){if(n=e.indexOf(r,n),n===-1)return!1;n+=r.length}return!0}function ze(e,t,n){let r=t.trim().toLowerCase();if(r===``)return{results:[...e],total:e.length};let i=[];for(let t of e){let e=t.toLowerCase();if(!q(e,r))continue;let n=e.slice(e.lastIndexOf(`/`)+1);i.push({path:t,basenameMatch:q(n,r)})}return i.sort((e,t)=>e.basenameMatch===t.basenameMatch?e.path.length===t.path.length?e.path.localeCompare(t.path):e.path.length-t.path.length:e.basenameMatch?-1:1),{results:i.slice(0,n).map(e=>e.path),total:i.length}}var J=200;function Be({selected:e,onSelect:t}){let n=a(),r=n.isError&&n.error instanceof s&&n.error.status===409,i=n.data?.paths??[];return n.isPending?(0,U.jsx)(Y,{children:(0,U.jsx)(`p`,{"data-slot":`repo-files-loading`,className:`px-4 py-6 text-center text-label text-soft-foreground md:px-6`,children:`Loading files…`})}):n.isError?(0,U.jsx)(Y,{children:(0,U.jsx)(z,{icon:r?(0,U.jsx)(j,{}):(0,U.jsx)(F,{}),tone:r?`neutral`:`danger`,heading:`h2`,title:r?`No files to browse`:`Could not load the files`,subtitle:n.error.message})}):i.length===0?(0,U.jsx)(Y,{children:(0,U.jsx)(z,{icon:(0,U.jsx)(j,{}),tone:`neutral`,heading:`h2`,title:`No files yet`,subtitle:`Nothing is tracked in this repository. Files show up here once git knows about them.`})}):(0,U.jsxs)(Y,{children:[n.data.truncated?(0,U.jsxs)(`p`,{"data-slot":`repo-files-truncated`,role:`status`,className:`border-b border-border bg-muted/40 px-4 py-2 text-xs text-muted-foreground md:px-6`,children:[`Showing the first `,i.length.toLocaleString(),` files; this repository has more. The tree and the filter cover only what is loaded.`]}):null,(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 px-4 py-4 [--diff-sticky-top:7rem] md:flex-row md:items-start md:px-6`,children:[(0,U.jsx)(`aside`,{"data-slot":`repo-files-tree-pane`,className:_(`w-full shrink-0 md:sticky md:top-[var(--diff-sticky-top)] md:block md:max-h-[calc(100dvh_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,e!==null&&`hidden`),children:(0,U.jsx)(Ve,{paths:i,selected:e,onSelect:t})}),(0,U.jsxs)(`div`,{className:_(`min-w-0 flex-1`,e===null&&`hidden md:block`),children:[e===null?null:(0,U.jsxs)(`button`,{type:`button`,"data-slot":`repo-files-back`,onClick:()=>t(null),className:`mb-2 flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground md:hidden`,children:[(0,U.jsx)(w,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the file tree`]}),(0,U.jsx)(ue,{source:{kind:`repo`},path:e,headerActions:oe(e)?(0,U.jsx)(De,{subject:{kind:`spec`,path:e}}):void 0})]})]})]})}function Y({children:e}){return(0,U.jsx)(`section`,{"data-slot":`repo-files`,className:`flex min-h-0 flex-1 flex-col`,children:e})}function X(e){if(e===null)return[];let t=e.split(`/`);return t.slice(0,-1).map((e,n)=>t.slice(0,n+1).join(`/`))}function Z(e,t,n){let r=[];for(let i of e.dirs){let e=t.has(i.path);r.push({kind:`dir`,path:i.path,name:i.name,level:n,open:e}),e&&r.push(...Z(i,t,n+1))}for(let t of e.files)r.push({kind:`file`,path:t.path,name:t.name,level:n,label:t.name});return r}function Ve({paths:e,selected:t,onSelect:n}){let[r,i]=(0,H.useState)(``),[a,o]=(0,H.useState)(()=>new Set(X(t))),[s,c]=(0,H.useState)(t),l=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=X(t);e.length!==0&&o(t=>{if(e.every(e=>t.has(e)))return t;let n=new Set(t);for(let t of e)n.add(t);return n})},[t]);let u=r.trim()!==``,d=(0,H.useMemo)(()=>ze(e,r,J),[e,r]),f=(0,H.useMemo)(()=>ge(e,(e,t)=>({kind:`file`,name:t,path:e})),[e]),p=(0,H.useMemo)(()=>u?d.results.map(e=>({kind:`file`,path:e,name:e.slice(e.lastIndexOf(`/`)+1),level:0,label:e})):Z(f,a,0),[u,d.results,f,a]),m=p.find(e=>e.path===s)??p[0],h=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,U.jsxs)(`div`,{"data-slot":`repo-files-browser`,className:`flex min-w-0 flex-col gap-2`,onKeyDown:e=>{e.key!==`/`||e.target===l.current||(e.preventDefault(),l.current?.focus())},children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`label`,{htmlFor:`repo-files-filter`,className:`sr-only`,children:`Filter repository files`}),(0,U.jsx)(`input`,{id:`repo-files-filter`,ref:l,"data-slot":`repo-files-filter`,type:`search`,value:r,placeholder:`Filter files… (/)`,"aria-controls":`repo-files-tree`,autoComplete:`off`,spellCheck:!1,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),i(``))},className:`w-full rounded-sm border border-border bg-background px-2 py-1 text-xs placeholder:text-soft-foreground focus:border-foreground focus:outline-none`}),(0,U.jsx)(`p`,{"data-slot":`repo-files-count`,role:`status`,"aria-live":`polite`,className:`sr-only`,children:u?`${d.total} files match ${r.trim()}`:`${e.length} files`})]}),u&&d.total===0?(0,U.jsxs)(`p`,{"data-slot":`repo-files-no-match`,className:`px-1.5 py-1 text-label text-muted-foreground`,children:[`No file matches `,(0,U.jsx)(`span`,{className:`font-mono`,children:r.trim()}),`.`]}):(0,U.jsx)(`div`,{id:`repo-files-tree`,"data-slot":`repo-files-tree`,"data-filtering":u?`true`:void 0,role:`tree`,"aria-label":`Repository files`,"aria-activedescendant":m?Q(m.path):void 0,onKeyDown:e=>{let t=p.findIndex(e=>e.path===m?.path),r=e=>{let t=p[Math.max(0,Math.min(p.length-1,e))];t&&c(t.path)},i=p[t];if(e.key===`ArrowDown`)e.preventDefault(),r(t+1);else if(e.key===`ArrowUp`)e.preventDefault(),r(t-1);else if(e.key===`ArrowRight`&&i?.kind===`dir`)e.preventDefault(),i.open?r(t+1):h(i.path);else if(e.key===`ArrowLeft`&&i!==void 0)if(e.preventDefault(),i.kind===`dir`&&i.open)h(i.path);else for(let e=t-1;e>=0;--e){let t=p[e];if(t.level<i.level){c(t.path);break}}else(e.key===`Enter`||e.key===` `)&&i!==void 0&&(e.preventDefault(),i.kind===`file`?n(i.path):h(i.path))},className:`min-w-0 text-ui`,children:p.map(e=>e.kind===`dir`?(0,U.jsx)(He,{row:e,focused:e.path===m?.path,onFocus:()=>c(e.path),onToggle:()=>{c(e.path),h(e.path)}},e.path):(0,U.jsx)(Ue,{row:e,active:e.path===t,focused:e.path===m?.path,onFocus:()=>c(e.path),onSelect:()=>{c(e.path),n(e.path)}},e.path))}),u&&d.total>d.results.length?(0,U.jsxs)(`p`,{"data-slot":`repo-files-more`,className:`px-1.5 py-1 text-label text-muted-foreground`,children:[(d.total-d.results.length).toLocaleString(),` more — refine the filter.`]}):null]})}var Q=e=>`repo-file-row-${e}`,$=(e,t)=>({paddingLeft:`${t+e*14}px`});function He({row:e,focused:t,onFocus:n,onToggle:r}){return(0,U.jsxs)(`div`,{id:Q(e.path),role:`treeitem`,"aria-expanded":e.open,"aria-level":e.level+1,"data-slot":`repo-files-dir`,"data-path":e.path,"data-state":e.open?`open`:`closed`,tabIndex:t?0:-1,onFocus:n,onClick:r,className:`flex w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground focus:bg-muted focus:outline-none`,style:$(e.level,6),children:[(0,U.jsx)(ne,{"aria-hidden":`true`,className:_(`size-3.5 shrink-0 transition-transform`,e.open&&`rotate-90`)}),(0,U.jsx)(ye,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name})]})}function Ue({row:e,active:t,focused:n,onFocus:r,onSelect:i}){let a=le(e.path)?ve:de;return(0,U.jsxs)(`div`,{id:Q(e.path),role:`treeitem`,"aria-level":e.level+1,"aria-selected":t,"aria-current":t?`true`:void 0,"data-slot":`repo-files-file`,"data-path":e.path,tabIndex:n?0:-1,onFocus:r,onClick:i,className:_(`flex w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted focus:outline-none`,t?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:$(e.level,24),children:[(0,U.jsx)(a,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,title:e.label,children:e.label})]})}function We({tab:e}){let t=l();if(t.isPending)return(0,U.jsx)(Te,{});if(t.isError)return(0,U.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,U.jsx)(z,{icon:(0,U.jsx)(F,{}),tone:`danger`,title:`Could not load the repository`,subtitle:t.error.message})});let n=t.data.info;return n?(0,U.jsx)(Ge,{repo:t.data,info:n,tab:e}):(0,U.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,U.jsx)(z,{icon:(0,U.jsx)(M,{}),tone:`neutral`,title:`Not a git repository`,subtitle:`The cockpit is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function Ge({repo:e,info:t,tab:n}){return(0,U.jsxs)(`div`,{"data-route":`repo-git`,className:_(`flex min-h-full flex-col`,n===`changes`&&`md:h-full`),children:[(0,U.jsxs)(`header`,{"data-slot":`repo-header`,className:`sticky top-0 z-20 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur md:px-6`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,U.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Git`}),(0,U.jsx)(se,{branch:t.branch}),t.remote?(0,U.jsx)(`span`,{"data-slot":`repo-remote`,className:`hidden min-w-0 truncate text-meta text-soft-foreground md:inline`,children:t.remote}):null]}),(0,U.jsx)(`div`,{className:`mt-1.5`,children:(0,U.jsx)(ke,{})}),(0,U.jsxs)(`div`,{"data-slot":`repo-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,U.jsx)(k,{to:`/git`,active:n===`changes`,children:`Changes`}),(0,U.jsx)(k,{to:`/git/commits`,active:n===`commits`,children:`Commits`}),(0,U.jsx)(k,{to:`/git/branches`,active:n===`branches`,children:`Branches`}),(0,U.jsx)(k,{to:`/git/files`,active:n===`files`,children:`Files`})]})]}),n===`changes`?(0,U.jsx)(Ie,{}):n===`commits`?(0,U.jsx)(Le,{log:e.log}):n===`files`?(0,U.jsx)(Ke,{}):(0,U.jsx)(Me,{repo:e,info:t})]})}function Ke(){let e=v(),t=y();return(0,U.jsx)(Be,{selected:e[`*`]!==void 0&&e[`*`]!==``?e[`*`]:null,onSelect:e=>t(e===null?`/git/files`:`/git/files/${qe(e)}`,{replace:!0})})}function qe(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}export{We as RepoGitRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{E as r,Ir as i,bt as a,ht as o,mr as s,mt as c,pt as l,r as u,ra as d,vo as f,vt as p,xo as m,yt as h}from"./queries-BQUz3Wnb.js";import{n as g,t as _}from"./utils-Dp6vCdiU.js";import{S as v,l as y,t as b}from"./project-router-B1Q3upIJ.js";import{t as x}from"./use-desktop-BNN3U2y9.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{t as C}from"./arrow-down-NfQPLFhe.js";import{t as w}from"./arrow-left-BfRd_mrv.js";import{t as ee}from"./arrow-up-CssRwnnv.js";import{H as te,V as ne,t as T}from"./button-CJXK1JqU.js";import{i as E,n as re,o as ie,s as D,t as ae}from"./select-DL5E3ZAD.js";import{a as oe,f as se,g as O,m as k,p as A,s as ce}from"./impact-model-DCDyRxcf.js";import{i as le,n as ue}from"./file-preview-C2EkjhOh.js";import{t as de}from"./file--aqoYe_k.js";import{d as j,i as fe,n as pe,o as me,r as he,s as ge,t as _e,u as ve}from"./tree-pane-resize-xgVK7J9r.js";import{t as ye}from"./folder-o-AvL3y3.js";import{r as M,t as be}from"./active-forge-CkAcQPDz.js";import{n as N}from"./upload-BE8GV7hh.js";import{t as xe}from"./git-pull-request-DUnpdU6m.js";import{t as Se}from"./plus-CxRU2X8C.js";import{t as P}from"./refresh-cw-BIgmYimN.js";import{t as Ce}from"./search-x-I9Q8pgUa.js";import{t as F}from"./triangle-alert-CIzim6ZN.js";import{t as I}from"./icon-tooltip-DYk5cjLx.js";import{t as L}from"./input-DofKzJZl.js";import{r as R}from"./toaster-BoJZiTRl.js";import{t as we}from"./diff-stat-DPetRUXO.js";import{t as z}from"./centered-state-DE6sgEMs.js";import{o as Te}from"./index-BfbbA0lF.js";import{t as Ee}from"./markdown-CXJIKz2i.js";import{t as B}from"./diff-aKT-mpn8.js";import{t as De}from"./impact-control-ClslFBBA.js";import{t as V}from"./commit-list-BJeaIEp4.js";var Oe=S(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),H=e(t(),1),U=n();function ke(){let e=p(),t=h();if(!e.data)return null;let n=e.data,r=e=>t.mutate(e,{onSuccess:e=>R(e.message),onError:e=>R(e.message,{tone:`danger`,expected:e instanceof s&&e.status===409})}),i=t.isPending,a=t.variables;return(0,U.jsxs)(`div`,{"data-slot":`repo-sync`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-meta`,children:[n.upstream?(0,U.jsx)(I,{label:`Upstream`,children:(0,U.jsxs)(`span`,{"data-slot":`repo-upstream`,className:`truncate font-mono text-soft-foreground`,children:[`→ `,n.upstream]})}):n.branch?(0,U.jsx)(`span`,{"data-slot":`repo-upstream`,className:`text-soft-foreground`,children:`not published`}):(0,U.jsx)(`span`,{"data-slot":`repo-upstream`,className:`text-soft-foreground`,children:`detached HEAD`}),n.upstream?(0,U.jsx)(G,{ahead:n.ahead,behind:n.behind}):n.outgoing.length>0?(0,U.jsx)(G,{ahead:n.outgoing.length,behind:null}):null,(0,U.jsx)(`span`,{"data-slot":`repo-fetched`,className:`hidden text-soft-foreground sm:inline`,children:n.lastFetchedAt?`fetched ${je(n.lastFetchedAt)}`:`never fetched`}),(0,U.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,U.jsx)(W,{which:`fetch`,label:`Fetch`,busy:i,pending:a,onClick:r,disabled:!n.pushRemote,children:(0,U.jsx)(P,{"aria-hidden":`true`,className:_(i&&a===`fetch`&&`animate-spin`)})}),n.upstream?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(W,{which:`pull`,label:`Pull`,busy:i,pending:a,onClick:r,disabled:!n.behind,children:(0,U.jsx)(C,{"aria-hidden":`true`})}),(0,U.jsx)(W,{which:`push`,label:`Push`,busy:i,pending:a,onClick:r,disabled:!n.ahead,children:(0,U.jsx)(ee,{"aria-hidden":`true`})}),(0,U.jsx)(W,{which:`sync`,label:`Sync`,busy:i,pending:a,onClick:r,disabled:!n.ahead&&!n.behind,variant:`outline`,children:(0,U.jsx)(P,{"aria-hidden":`true`,className:_(i&&a===`sync`&&`animate-spin`)})})]}):n.branch&&n.pushRemote?(0,U.jsx)(W,{which:`push`,label:`Publish branch`,busy:i,pending:a,onClick:r,variant:`outline`,children:(0,U.jsx)(Oe,{"aria-hidden":`true`})}):null]})]})}function W({which:e,label:t,busy:n,pending:r,onClick:i,disabled:a,variant:o=`ghost`,children:s}){return(0,U.jsxs)(T,{variant:o,size:`sm`,"data-action":`repo-${e}`,"aria-busy":n&&r===e,disabled:n||a,onClick:()=>i(e),children:[s,t]})}function G({ahead:e,behind:t}){return e===null&&t===null?null:!e&&!t?(0,U.jsx)(`span`,{"data-slot":`sync-counts`,className:`text-soft-foreground`,children:`in sync`}):(0,U.jsxs)(`span`,{"data-slot":`sync-counts`,className:`flex items-center gap-1 font-mono`,children:[e?(0,U.jsx)(I,{label:`${e} to push`,children:(0,U.jsxs)(`span`,{"data-sync":`ahead`,className:`text-violet`,children:[`↑`,e]})}):null,t?(0,U.jsx)(I,{label:`${t} to pull`,children:(0,U.jsxs)(`span`,{"data-sync":`behind`,className:`text-pending-strong`,children:[`↓`,t]})}):null]})}function Ae({name:e,sync:t}){if(!t)return null;let n=t.branches.find(t=>t.name===e),r=n?n.gone?`upstream gone`:n.upstream?null:`local only`:`remote only`;return(0,U.jsx)(`span`,{"data-slot":`branch-tracking`,className:`flex shrink-0 items-center gap-1 text-meta`,children:r?(0,U.jsx)(`span`,{className:`text-soft-foreground`,children:r}):(0,U.jsx)(G,{ahead:n.ahead,behind:n.behind})})}function je(e){let t=Math.max(0,Math.round((Date.now()-Date.parse(e))/1e3));if(t<60)return`just now`;let n=Math.round(t/60);if(n<60)return`${n} min ago`;let r=Math.round(n/60);return r<24?`${r} h ago`:`${Math.round(r/24)} d ago`}var K=`__follow__`;function Me({repo:e,info:t}){let n=be(),r=p(),a=m(),o=e=>R(e.message,{tone:`danger`}),s=f({mutationFn:e=>i({name:e}),onSuccess:async e=>{R(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([a.invalidateQueries({queryKey:u.repo}),a.invalidateQueries({queryKey:u.health})]),a.setQueryData(u.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),a.setQueryData(u.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:o}),c=f({mutationFn:e=>d({baseBranch:e}),onSuccess:e=>{R(e.baseBranch?`Agents now branch from ${e.baseBranch}`:`Agents now fork from the checked-out branch`),a.invalidateQueries({queryKey:u.repo})},onError:o}),[l,h]=(0,H.useState)(``),[g,v]=(0,H.useState)(``),y=g.trim().toLowerCase(),b=y?e.branches.filter(e=>e.toLowerCase().includes(y)):e.branches;return(0,U.jsxs)(`section`,{"data-slot":`repo-branches`,className:`flex flex-col gap-6 px-4 py-4 md:px-6`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{className:`eyebrow text-soft-foreground`,children:`Branches`}),(0,U.jsx)(L,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:g,onChange:e=>v(e.target.value),className:`mt-2 max-w-xl`}),(0,U.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-2 flex max-w-xl flex-col divide-y divide-border`,children:[b.map(n=>{let i=n===t.branch,a=e.checkedOutElsewhere?.[n];return(0,U.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":n,className:`flex min-h-9 items-center gap-2 py-1`,children:[(0,U.jsx)(M,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:_(`min-w-0 truncate font-mono text-xs`,i&&`font-semibold`),children:n}),(0,U.jsx)(Ae,{name:n,sync:r.data}),i?(0,U.jsxs)(`span`,{"data-slot":`branch-current`,className:`flex shrink-0 items-center gap-1 rounded-sm bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:[(0,U.jsx)(te,{"aria-hidden":`true`,className:`size-3`}),`current`]}):a?(0,U.jsx)(I,{label:`Checked out in ${a}`,children:(0,U.jsx)(`span`,{"data-slot":`branch-elsewhere`,"data-held-at":a,tabIndex:0,className:`ml-auto shrink-0 rounded-sm text-label text-muted-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`in another worktree`})}):(0,U.jsx)(T,{variant:`ghost`,size:`sm`,"data-action":`switch-branch`,className:`ml-auto`,disabled:s.isPending,onClick:()=>s.mutate(n),children:`Switch`})]},n)}),b.length===0?(0,U.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-label text-muted-foreground`,children:[`No branches match “`,g.trim(),`”.`]}):null]}),(0,U.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-3 flex max-w-md items-center gap-2`,onSubmit:e=>{e.preventDefault();let t=l.trim();t&&s.mutate(t,{onSuccess:()=>h(``)})},children:[(0,U.jsx)(L,{"aria-label":`New branch name`,placeholder:`new-branch-name`,value:l,onChange:e=>h(e.target.value)}),(0,U.jsxs)(T,{type:`submit`,variant:`outline`,size:`sm`,"data-action":`create-branch`,disabled:!l.trim()||s.isPending,children:[(0,U.jsx)(Se,{"aria-hidden":`true`}),`Create`]})]})]}),(0,U.jsxs)(`div`,{className:`max-w-md`,children:[(0,U.jsx)(`label`,{htmlFor:`base-branch-picker`,className:`eyebrow text-soft-foreground`,children:`Agents’ base branch`}),(0,U.jsxs)(ae,{value:e.baseBranch??K,disabled:c.isPending,onValueChange:e=>c.mutate(e===K?null:e),children:[(0,U.jsx)(ie,{id:`base-branch-picker`,"data-slot":`base-branch-picker`,size:`sm`,className:`mt-1.5 w-full`,children:(0,U.jsx)(D,{placeholder:`follow checked-out branch (default)`})}),(0,U.jsxs)(re,{children:[(0,U.jsx)(E,{value:K,children:`follow checked-out branch (default)`}),e.branches.map(e=>(0,U.jsx)(E,{value:e,className:`font-mono text-ui`,children:e},e))]})]}),(0,U.jsx)(`p`,{className:`mt-1 text-label text-muted-foreground`,children:`New task worktrees branch from this.`})]}),n?.available?(0,U.jsx)(Ne,{}):null]})}function Ne(){let e=r({limit:20});return(0,U.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,U.jsx)(`h2`,{className:`eyebrow text-soft-foreground`,children:`Open pull requests`}),e.isPending?(0,U.jsx)(`p`,{className:`mt-2 text-label text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,U.jsx)(`p`,{className:`mt-2 text-label text-muted-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,U.jsx)(`p`,{className:`mt-2 text-label text-muted-foreground`,children:`No open pull requests.`}):(0,U.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,U.jsx)(Pe,{pr:e},e.number))}):(0,U.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-label text-muted-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function Pe({pr:e}){let t=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(xe,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`span`,{className:`shrink-0 font-mono text-meta text-muted-foreground`,children:[`#`,e.number]}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ui`,children:e.title}),e.checks?(0,U.jsx)(Fe,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,U.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:g(e.url)?(0,U.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:_(n,`hover:bg-muted`),children:t}):(0,U.jsx)(`span`,{className:n,children:t})})}function Fe({checks:e}){return(0,U.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:_(`shrink-0 text-label font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}function Ie(){let e=c(),t=x(),[n,r]=(0,H.useState)(`unified`),[i,a]=(0,H.useState)(!1),[o,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(null),f=(0,H.useRef)(null),p=(0,H.useRef)(null),[m,h]=he(),g=pe(m),v=e.isError&&e.error instanceof s&&e.error.status===409,y=e.data?.files??[],b=(0,H.useMemo)(()=>me(y),[y]),S=(0,H.useMemo)(()=>y.some(Ee),[y]),C=t?n:`unified`,w=!t||i;return(0,U.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Uncommitted changes`}),e.data?(0,U.jsx)(ce,{stat:e.data.stat}):null,(0,U.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,U.jsx)(A,{mode:n,wrap:i,preview:o,onModeChange:r,onWrapChange:a,onPreviewChange:S?l:void 0})})]}),e.isPending?(0,U.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-label text-soft-foreground md:px-6`,children:`Loading changes…`}):e.isError?(0,U.jsx)(z,{icon:v?(0,U.jsx)(O,{}):(0,U.jsx)(F,{}),tone:v?`neutral`:`danger`,heading:`h2`,title:v?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):y.length===0?(0,U.jsx)(z,{icon:(0,U.jsx)(O,{}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-5 px-4 py-4 max-md:[--diff-sticky-top:7rem] md:px-6 md:py-0`,children:[(0,U.jsx)(`aside`,{ref:p,"data-slot":`changes-tree-pane`,style:g.style,className:_(`hidden w-60 max-w-[60%] shrink-0 overflow-y-auto overscroll-contain py-4 md:block lg:w-72`,g.className),children:(0,U.jsx)(fe,{root:b,selected:u,onSelect:e=>{d(e),f.current?.scrollToPath(e)}})}),(0,U.jsx)(_e,{paneRef:p,width:m,onWidthChange:h,className:`hidden md:block`}),(0,U.jsx)(`div`,{"data-slot":`diff-pane`,"data-diff-scroller":t?``:void 0,className:`min-w-0 flex-1 md:overflow-y-auto md:overscroll-contain`,children:(0,U.jsx)(B,{files:y,viewRef:f,mode:C,wrap:w,preview:t&&S&&o,className:`min-w-0 md:py-4`})})]})]})}function Le({log:e}){let{sha:t}=v(),n=p().data;if(t)return(0,U.jsx)(Re,{sha:t});let r=new Set(n?.outgoing??[]),i=n?.incoming??[],a=(e,t)=>({sha:e.hash,shaLabel:e.hash,subject:e.subject,author:e.author,when:e.when,href:`/git/commits/${e.hash}`,...t?{sync:t}:{}}),o=i.length>0?(0,U.jsxs)(`section`,{"data-slot":`repo-incoming`,className:`border-b border-border`,children:[(0,U.jsxs)(`h2`,{className:`px-4 pt-3 text-meta font-medium text-muted-foreground md:px-6`,children:[`Incoming from `,n?.upstream,` · `,i.length]}),(0,U.jsx)(V,{slot:`repo-incoming-commits`,commits:i.map(e=>a(e,`incoming`))})]}):null;return e.length===0?(0,U.jsx)(z,{icon:(0,U.jsx)(N,{}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`}):(0,U.jsxs)(U.Fragment,{children:[o,(0,U.jsx)(V,{slot:`repo-commits`,commits:e.map(e=>a(e,r.has(e.hash)?`outgoing`:void 0))})]})}function Re({sha:e}){let t=o(e),n=x(),[r,i]=(0,H.useState)(`unified`),[a,c]=(0,H.useState)(!1),l=t.isError&&t.error instanceof s&&t.error.status===409,u=n?r:`unified`,d=!n||a;return(0,U.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,U.jsx)(T,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,U.jsxs)(b,{to:`/git/commits`,children:[(0,U.jsx)(w,{"aria-hidden":`true`}),`All commits`]})}),t.data?(0,U.jsx)(we,{stat:t.data.stat}):null,(0,U.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,U.jsx)(A,{mode:r,wrap:a,onModeChange:i,onWrapChange:c})})]}),t.isPending?(0,U.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-label text-soft-foreground md:px-6`,children:`Loading commit…`}):t.isError?(0,U.jsx)(z,{icon:l?(0,U.jsx)(Ce,{}):(0,U.jsx)(F,{}),tone:l?`neutral`:`danger`,heading:`h2`,title:l?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,U.jsxs)(`p`,{className:`mt-0.5 text-meta text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,U.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,U.jsx)(z,{icon:(0,U.jsx)(N,{}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,U.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:7rem] md:px-6`,children:(0,U.jsx)(B,{files:t.data.files,mode:u,wrap:d,className:`min-w-0`})})]})]})}function q(e,t){let n=0;for(let r of t){if(n=e.indexOf(r,n),n===-1)return!1;n+=r.length}return!0}function ze(e,t,n){let r=t.trim().toLowerCase();if(r===``)return{results:[...e],total:e.length};let i=[];for(let t of e){let e=t.toLowerCase();if(!q(e,r))continue;let n=e.slice(e.lastIndexOf(`/`)+1);i.push({path:t,basenameMatch:q(n,r)})}return i.sort((e,t)=>e.basenameMatch===t.basenameMatch?e.path.length===t.path.length?e.path.localeCompare(t.path):e.path.length-t.path.length:e.basenameMatch?-1:1),{results:i.slice(0,n).map(e=>e.path),total:i.length}}var J=200;function Be({selected:e,onSelect:t}){let n=a(),r=n.isError&&n.error instanceof s&&n.error.status===409,i=n.data?.paths??[];return n.isPending?(0,U.jsx)(Y,{children:(0,U.jsx)(`p`,{"data-slot":`repo-files-loading`,className:`px-4 py-6 text-center text-label text-soft-foreground md:px-6`,children:`Loading files…`})}):n.isError?(0,U.jsx)(Y,{children:(0,U.jsx)(z,{icon:r?(0,U.jsx)(j,{}):(0,U.jsx)(F,{}),tone:r?`neutral`:`danger`,heading:`h2`,title:r?`No files to browse`:`Could not load the files`,subtitle:n.error.message})}):i.length===0?(0,U.jsx)(Y,{children:(0,U.jsx)(z,{icon:(0,U.jsx)(j,{}),tone:`neutral`,heading:`h2`,title:`No files yet`,subtitle:`Nothing is tracked in this repository. Files show up here once git knows about them.`})}):(0,U.jsxs)(Y,{children:[n.data.truncated?(0,U.jsxs)(`p`,{"data-slot":`repo-files-truncated`,role:`status`,className:`border-b border-border bg-muted/40 px-4 py-2 text-xs text-muted-foreground md:px-6`,children:[`Showing the first `,i.length.toLocaleString(),` files; this repository has more. The tree and the filter cover only what is loaded.`]}):null,(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 px-4 py-4 [--diff-sticky-top:7rem] md:flex-row md:items-start md:px-6`,children:[(0,U.jsx)(`aside`,{"data-slot":`repo-files-tree-pane`,className:_(`w-full shrink-0 md:sticky md:top-[var(--diff-sticky-top)] md:block md:max-h-[calc(100dvh_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,e!==null&&`hidden`),children:(0,U.jsx)(Ve,{paths:i,selected:e,onSelect:t})}),(0,U.jsxs)(`div`,{className:_(`min-w-0 flex-1`,e===null&&`hidden md:block`),children:[e===null?null:(0,U.jsxs)(`button`,{type:`button`,"data-slot":`repo-files-back`,onClick:()=>t(null),className:`mb-2 flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground md:hidden`,children:[(0,U.jsx)(w,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the file tree`]}),(0,U.jsx)(ue,{source:{kind:`repo`},path:e,headerActions:oe(e)?(0,U.jsx)(De,{subject:{kind:`spec`,path:e}}):void 0})]})]})]})}function Y({children:e}){return(0,U.jsx)(`section`,{"data-slot":`repo-files`,className:`flex min-h-0 flex-1 flex-col`,children:e})}function X(e){if(e===null)return[];let t=e.split(`/`);return t.slice(0,-1).map((e,n)=>t.slice(0,n+1).join(`/`))}function Z(e,t,n){let r=[];for(let i of e.dirs){let e=t.has(i.path);r.push({kind:`dir`,path:i.path,name:i.name,level:n,open:e}),e&&r.push(...Z(i,t,n+1))}for(let t of e.files)r.push({kind:`file`,path:t.path,name:t.name,level:n,label:t.name});return r}function Ve({paths:e,selected:t,onSelect:n}){let[r,i]=(0,H.useState)(``),[a,o]=(0,H.useState)(()=>new Set(X(t))),[s,c]=(0,H.useState)(t),l=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=X(t);e.length!==0&&o(t=>{if(e.every(e=>t.has(e)))return t;let n=new Set(t);for(let t of e)n.add(t);return n})},[t]);let u=r.trim()!==``,d=(0,H.useMemo)(()=>ze(e,r,J),[e,r]),f=(0,H.useMemo)(()=>ge(e,(e,t)=>({kind:`file`,name:t,path:e})),[e]),p=(0,H.useMemo)(()=>u?d.results.map(e=>({kind:`file`,path:e,name:e.slice(e.lastIndexOf(`/`)+1),level:0,label:e})):Z(f,a,0),[u,d.results,f,a]),m=p.find(e=>e.path===s)??p[0],h=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,U.jsxs)(`div`,{"data-slot":`repo-files-browser`,className:`flex min-w-0 flex-col gap-2`,onKeyDown:e=>{e.key!==`/`||e.target===l.current||(e.preventDefault(),l.current?.focus())},children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`label`,{htmlFor:`repo-files-filter`,className:`sr-only`,children:`Filter repository files`}),(0,U.jsx)(`input`,{id:`repo-files-filter`,ref:l,"data-slot":`repo-files-filter`,type:`search`,value:r,placeholder:`Filter files… (/)`,"aria-controls":`repo-files-tree`,autoComplete:`off`,spellCheck:!1,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),i(``))},className:`w-full rounded-sm border border-border bg-background px-2 py-1 text-xs placeholder:text-soft-foreground focus:border-foreground focus:outline-none`}),(0,U.jsx)(`p`,{"data-slot":`repo-files-count`,role:`status`,"aria-live":`polite`,className:`sr-only`,children:u?`${d.total} files match ${r.trim()}`:`${e.length} files`})]}),u&&d.total===0?(0,U.jsxs)(`p`,{"data-slot":`repo-files-no-match`,className:`px-1.5 py-1 text-label text-muted-foreground`,children:[`No file matches `,(0,U.jsx)(`span`,{className:`font-mono`,children:r.trim()}),`.`]}):(0,U.jsx)(`div`,{id:`repo-files-tree`,"data-slot":`repo-files-tree`,"data-filtering":u?`true`:void 0,role:`tree`,"aria-label":`Repository files`,"aria-activedescendant":m?Q(m.path):void 0,onKeyDown:e=>{let t=p.findIndex(e=>e.path===m?.path),r=e=>{let t=p[Math.max(0,Math.min(p.length-1,e))];t&&c(t.path)},i=p[t];if(e.key===`ArrowDown`)e.preventDefault(),r(t+1);else if(e.key===`ArrowUp`)e.preventDefault(),r(t-1);else if(e.key===`ArrowRight`&&i?.kind===`dir`)e.preventDefault(),i.open?r(t+1):h(i.path);else if(e.key===`ArrowLeft`&&i!==void 0)if(e.preventDefault(),i.kind===`dir`&&i.open)h(i.path);else for(let e=t-1;e>=0;--e){let t=p[e];if(t.level<i.level){c(t.path);break}}else(e.key===`Enter`||e.key===` `)&&i!==void 0&&(e.preventDefault(),i.kind===`file`?n(i.path):h(i.path))},className:`min-w-0 text-ui`,children:p.map(e=>e.kind===`dir`?(0,U.jsx)(He,{row:e,focused:e.path===m?.path,onFocus:()=>c(e.path),onToggle:()=>{c(e.path),h(e.path)}},e.path):(0,U.jsx)(Ue,{row:e,active:e.path===t,focused:e.path===m?.path,onFocus:()=>c(e.path),onSelect:()=>{c(e.path),n(e.path)}},e.path))}),u&&d.total>d.results.length?(0,U.jsxs)(`p`,{"data-slot":`repo-files-more`,className:`px-1.5 py-1 text-label text-muted-foreground`,children:[(d.total-d.results.length).toLocaleString(),` more — refine the filter.`]}):null]})}var Q=e=>`repo-file-row-${e}`,$=(e,t)=>({paddingLeft:`${t+e*14}px`});function He({row:e,focused:t,onFocus:n,onToggle:r}){return(0,U.jsxs)(`div`,{id:Q(e.path),role:`treeitem`,"aria-expanded":e.open,"aria-level":e.level+1,"data-slot":`repo-files-dir`,"data-path":e.path,"data-state":e.open?`open`:`closed`,tabIndex:t?0:-1,onFocus:n,onClick:r,className:`flex w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground focus:bg-muted focus:outline-none`,style:$(e.level,6),children:[(0,U.jsx)(ne,{"aria-hidden":`true`,className:_(`size-3.5 shrink-0 transition-transform`,e.open&&`rotate-90`)}),(0,U.jsx)(ye,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name})]})}function Ue({row:e,active:t,focused:n,onFocus:r,onSelect:i}){let a=le(e.path)?ve:de;return(0,U.jsxs)(`div`,{id:Q(e.path),role:`treeitem`,"aria-level":e.level+1,"aria-selected":t,"aria-current":t?`true`:void 0,"data-slot":`repo-files-file`,"data-path":e.path,tabIndex:n?0:-1,onFocus:r,onClick:i,className:_(`flex w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted focus:outline-none`,t?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:$(e.level,24),children:[(0,U.jsx)(a,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,title:e.label,children:e.label})]})}function We({tab:e}){let t=l();if(t.isPending)return(0,U.jsx)(Te,{});if(t.isError)return(0,U.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,U.jsx)(z,{icon:(0,U.jsx)(F,{}),tone:`danger`,title:`Could not load the repository`,subtitle:t.error.message})});let n=t.data.info;return n?(0,U.jsx)(Ge,{repo:t.data,info:n,tab:e}):(0,U.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,U.jsx)(z,{icon:(0,U.jsx)(M,{}),tone:`neutral`,title:`Not a git repository`,subtitle:`The cockpit is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function Ge({repo:e,info:t,tab:n}){return(0,U.jsxs)(`div`,{"data-route":`repo-git`,className:_(`flex min-h-full flex-col`,n===`changes`&&`md:h-full`),children:[(0,U.jsxs)(`header`,{"data-slot":`repo-header`,className:`sticky top-0 z-20 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur md:px-6`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,U.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Git`}),(0,U.jsx)(se,{branch:t.branch}),t.remote?(0,U.jsx)(`span`,{"data-slot":`repo-remote`,className:`hidden min-w-0 truncate text-meta text-soft-foreground md:inline`,children:t.remote}):null]}),(0,U.jsx)(`div`,{className:`mt-1.5`,children:(0,U.jsx)(ke,{})}),(0,U.jsxs)(`div`,{"data-slot":`repo-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,U.jsx)(k,{to:`/git`,active:n===`changes`,children:`Changes`}),(0,U.jsx)(k,{to:`/git/commits`,active:n===`commits`,children:`Commits`}),(0,U.jsx)(k,{to:`/git/branches`,active:n===`branches`,children:`Branches`}),(0,U.jsx)(k,{to:`/git/files`,active:n===`files`,children:`Files`})]})]}),n===`changes`?(0,U.jsx)(Ie,{}):n===`commits`?(0,U.jsx)(Le,{log:e.log}):n===`files`?(0,U.jsx)(Ke,{}):(0,U.jsx)(Me,{repo:e,info:t})]})}function Ke(){let e=v(),t=y();return(0,U.jsx)(Be,{selected:e[`*`]!==void 0&&e[`*`]!==``?e[`*`]:null,onSelect:e=>t(e===null?`/git/files`:`/git/files/${qe(e)}`,{replace:!0})})}function qe(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}export{We as RepoGitRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{Vn as t,do as n,er as r,et as i,fo as a,tr as o}from"./queries-DVZ1lYAo.js";import{zt as s}from"./utils-DWwoYTjU.js";import{t as c}from"./createLucideIcon-BHp8sXmF.js";import{t as l}from"./bot-TkDIw4y-.js";import{t as u}from"./button-CEskWahs.js";import{c as ee,i as te,p as ne,r as re,t as ie}from"./dropdown-menu-ayNafd3n.js";import{t as d}from"./external-link-BE6y205O.js";import{t as ae}from"./folder-o-AvL3y3.js";import{t as f}from"./zap-2VEI5zT4.js";var p=c(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),m=c(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),h=c(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),g=c(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),_=c(`diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),v=c(`feather`,[[`path`,{d:`M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z`,key:`18jl4k`}],[`path`,{d:`M16 8 2 22`,key:`vp34q`}],[`path`,{d:`M17.5 15H9`,key:`1oz8nu`}]]),y=c(`gem`,[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),b=c(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),x=c(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),S=c(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),C=c(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),w=c(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),oe=c(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),se=c(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),ce=c(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),T=c(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),E=c(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),D=c(`waves-horizontal`,[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]]),O={claude:`Claude Code`,codex:`Codex`,junie:`Junie`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,copilot:`GitHub Copilot CLI`,omp:`OMP`,antigravity:`Antigravity`,gemini:`Gemini CLI`,kimi:`Kimi Code`};function k(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function A(e){return e.runner??`claude`}function j(e,t){let r=a(t,e);return r?.enabled===!1?{provider:e,usable:!1,reason:`${O[e]} is disabled. Enable it in Settings → Agents → Providers.`}:!r||!n(r)?{provider:e,usable:!1,reason:`${O[e]} credentials are unavailable. Authorize it in Settings → Agents → Providers.`}:{provider:e,usable:!0}}function M(e,t){return j(k(e),t)}function N(e,t){return j(A(e),t)}function P(e){let t=i(),n=k(e);return t.isSuccess&&t.data?M(e,t.data):{provider:n,usable:!0}}function F(e){let t=i(),n=A(e);return t.isSuccess&&t.data?N(e,t.data):t.isError?{provider:n,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:n,usable:!0}}var I=e(),L={folder:ae,terminal:E,vscode:h,cursor:w,zed:f,windsurf:D,sublime:v,idea:_,pycharm:S,webstorm:b,goland:se,rubymine:y,phpstorm:m,clion:g,rider:p,"android-studio":ce,xcode:x,warp:oe,claude:l,codex:T,junie:l,opencode:l,pi:l,copilot:l,omp:l,antigravity:l,gemini:l,kimi:l};function R(e){return e.icon&&L[e.icon]||d}var z=RegExp(`^cli:(${s.options.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})$`);function B(e){let t=z.exec(e);return t?t[1]:void 0}function V({choices:e,onPick:t,label:n=`Open in…`,title:r,triggerVariant:i=`ghost`,disabled:a=!1,leading:o,trailing:s,slot:c}){return(0,I.jsxs)(ie,{children:[(0,I.jsx)(ne,{asChild:!0,children:(0,I.jsxs)(u,{variant:i,size:`sm`,title:r,disabled:a,"data-slot":c,children:[(0,I.jsx)(d,{"aria-hidden":`true`}),n]})}),(0,I.jsxs)(re,{align:`end`,children:[o,o&&e.length>0?(0,I.jsx)(ee,{}):null,e.map(({target:e,suffix:n,title:r})=>{let i=R(e);return(0,I.jsxs)(te,{"data-target":e.id,title:r,onSelect:()=>t(e.id),children:[(0,I.jsx)(i,{"aria-hidden":`true`}),e.label,n??``]},e.id)}),s]})]})}var H=[`done`,`failed`,`cancelled`],U=[`done`,`failed`];function W(e){return e.status===`failed`&&e.autoResumeAt!==void 0}function G(e){return e.status===`failed`&&e.awaitingAnswerSince!==void 0}function K(e){return H.includes(e)}function q(e){return e.archived||W(e)||G(e)||!U.includes(e.status)?!1:e.finishedAt!==void 0}function J(e){let t=e.finishedAt;return t===void 0||!q(e)?!1:e.seenAt===void 0||e.seenAt<t}function le(e){return W(e)||G(e)?!1:K(e.status)&&!J(e)}function ue(e){return e.reduce((e,t)=>J(t)?e+1:e,0)}function Y(e){return e===`running`||e===`queued`||e===`waiting`}function de(e){return!Y(e.status)&&e.worktree!==!1&&!!e.worktreePath&&!e.worktreeReclaimedAt&&!e.worktreeLifecycle?.activeOperationId}function X(e){return[...e.steps].reverse().find(e=>e.sessionId)?.sessionId}var fe=/^[A-Za-z0-9._][A-Za-z0-9._-]{0,199}$/,Z={claude:`claude --resume`,codex:`codex resume`,opencode:`opencode --session`,cursor:`agent --resume`,junie:`junie --resume`,pi:`pi --session`,copilot:`copilot --resume`,omp:`omp --resume`,antigravity:`agy --conversation`,gemini:`gemini --resume`,kimi:`kimi --session`};function pe(e,t){if(fe.test(t))return e===`junie`?`${Z.junie} --session-id=${t}`:`${Z[e??`claude`]} ${t}`}function me(e){if(Y(e.status)||e.worktreeLifecycle?.activeOperationId)return;let t=X(e);if(t===void 0)return;let n=pe(e.runner,t);if(n!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${n}`:n}function he(e,t){let n=B(t);return!n||Y(e.status)||e.worktreeLifecycle?.activeOperationId?!1:n===(e.runner??`claude`)&&X(e)!==void 0}function Q(e){let t=Y(e.status),n=X(e)!==void 0,r=!!e.worktreeLifecycle?.activeOperationId;return{finish:!r&&(e.status===`waiting`||e.status===`review`),continueRun:!r&&!t&&n,terminal:!r&&!t&&n,notes:!0,archive:!t,pin:!e.archived,markUnread:q(e)&&!J(e),markRead:q(e)&&J(e),promote:e.status===`queued`&&!e.archived,cancel:!r&&t,deleteRun:!r&&!t}}function ge(e){return e?`Resolve conflicts in PR ${e}`:`Resolve conflicts`}function _e(e){return e?`Fix failing checks in PR ${e}`:`Fix failing checks`}function ve(e){return e?`Commit and push`:`Commit`}function ye(){return`Push`}function $(e){let t=e?.replace(/^origin\//,``);return t&&!/^[0-9a-f]{7,40}$/i.test(t)?t:void 0}function be(e,t){let n=$(t);return`${e?`Create draft PR`:`Create PR`}${n?` against ${n}`:``}`}function xe(e){let t=$(e);return t?`Update branch from ${t}`:`Update branch`}function Se(e,t){return`${e?`Create draft PR`:`Create PR`} against ${t} instead of landing: move these changes to a new branch, commit and push it, open the PR, then switch the checkout back to ${t}`}function Ce(e){return`Update branch: pull the latest ${e} into the checkout (rebase, keeping these uncommitted changes)`}function we(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function Te(e,n){return t(e).get(n)}var Ee={answer:`Answer`,review:`Review changes`,"open-pr":`Open PR`,stop:`Stop`,retry:`Retry`};function De(e,{git:t,prUrl:n,changesShowing:i}){let a=Q(e);return e.worktreeLifecycle?.activeOperationId?null:e.status===`waiting`||r(e)?{kind:`answer`}:e.status===`review`&&!i?{kind:`review`}:t?{kind:`git`,action:t}:n&&/^https?:\/\//.test(n)?{kind:`open-pr`,url:n}:a.cancel?{kind:`stop`}:e.status===`failed`&&!o(e)&&a.continueRun?{kind:`retry`}:null}function Oe(e,t,n=null){let r=Q(e);return e.worktreeLifecycle?.activeOperationId?null:n&&t?.kind!==`git`?{kind:`git`,action:n}:r.cancel&&t?.kind!==`stop`?{kind:`stop`}:r.continueRun&&t?.kind!==`retry`&&t?.kind!==`answer`?{kind:`continue`}:null}export{E as A,J as C,R as D,B as E,C as M,b as N,P as O,g as P,le as S,V as T,Oe as _,be as a,q as b,Se as c,De as d,ye as f,Q as g,me as h,ve as i,T as j,F as k,Ce as l,ge as m,de as n,we as o,Te as p,he as r,_e as s,Ee as t,X as u,xe as v,ue as w,K as x,Y as y};
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{Vn as t,do as n,er as r,et as i,fo as a,tr as o}from"./queries-BQUz3Wnb.js";import{zt as s}from"./utils-Dp6vCdiU.js";import{t as c}from"./createLucideIcon-BHp8sXmF.js";import{t as l}from"./bot-TkDIw4y-.js";import{t as u}from"./button-CJXK1JqU.js";import{c as ee,i as te,p as ne,r as re,t as ie}from"./dropdown-menu-BKvUsb5Y.js";import{t as d}from"./external-link-BE6y205O.js";import{t as ae}from"./folder-o-AvL3y3.js";import{t as f}from"./zap-2VEI5zT4.js";var p=c(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),m=c(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),h=c(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),g=c(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),_=c(`diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),v=c(`feather`,[[`path`,{d:`M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z`,key:`18jl4k`}],[`path`,{d:`M16 8 2 22`,key:`vp34q`}],[`path`,{d:`M17.5 15H9`,key:`1oz8nu`}]]),y=c(`gem`,[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),b=c(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),x=c(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),S=c(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),C=c(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),w=c(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),oe=c(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),se=c(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),ce=c(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),T=c(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),E=c(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),D=c(`waves-horizontal`,[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]]),O={claude:`Claude Code`,codex:`Codex`,junie:`Junie`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,copilot:`GitHub Copilot CLI`,omp:`OMP`,antigravity:`Antigravity`,gemini:`Gemini CLI`,kimi:`Kimi Code`};function k(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function A(e){return e.runner??`claude`}function j(e,t){let r=a(t,e);return r?.enabled===!1?{provider:e,usable:!1,reason:`${O[e]} is disabled. Enable it in Settings → Agents → Providers.`}:!r||!n(r)?{provider:e,usable:!1,reason:`${O[e]} credentials are unavailable. Authorize it in Settings → Agents → Providers.`}:{provider:e,usable:!0}}function M(e,t){return j(k(e),t)}function N(e,t){return j(A(e),t)}function P(e){let t=i(),n=k(e);return t.isSuccess&&t.data?M(e,t.data):{provider:n,usable:!0}}function F(e){let t=i(),n=A(e);return t.isSuccess&&t.data?N(e,t.data):t.isError?{provider:n,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:n,usable:!0}}var I=e(),L={folder:ae,terminal:E,vscode:h,cursor:w,zed:f,windsurf:D,sublime:v,idea:_,pycharm:S,webstorm:b,goland:se,rubymine:y,phpstorm:m,clion:g,rider:p,"android-studio":ce,xcode:x,warp:oe,claude:l,codex:T,junie:l,opencode:l,pi:l,copilot:l,omp:l,antigravity:l,gemini:l,kimi:l};function R(e){return e.icon&&L[e.icon]||d}var z=RegExp(`^cli:(${s.options.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})$`);function B(e){let t=z.exec(e);return t?t[1]:void 0}function V({choices:e,onPick:t,label:n=`Open in…`,title:r,triggerVariant:i=`ghost`,disabled:a=!1,leading:o,trailing:s,slot:c}){return(0,I.jsxs)(ie,{children:[(0,I.jsx)(ne,{asChild:!0,children:(0,I.jsxs)(u,{variant:i,size:`sm`,title:r,disabled:a,"data-slot":c,children:[(0,I.jsx)(d,{"aria-hidden":`true`}),n]})}),(0,I.jsxs)(re,{align:`end`,children:[o,o&&e.length>0?(0,I.jsx)(ee,{}):null,e.map(({target:e,suffix:n,title:r})=>{let i=R(e);return(0,I.jsxs)(te,{"data-target":e.id,title:r,onSelect:()=>t(e.id),children:[(0,I.jsx)(i,{"aria-hidden":`true`}),e.label,n??``]},e.id)}),s]})]})}var H=[`done`,`failed`,`cancelled`],U=[`done`,`failed`];function W(e){return e.status===`failed`&&e.autoResumeAt!==void 0}function G(e){return e.status===`failed`&&e.awaitingAnswerSince!==void 0}function K(e){return H.includes(e)}function q(e){return e.archived||W(e)||G(e)||!U.includes(e.status)?!1:e.finishedAt!==void 0}function J(e){let t=e.finishedAt;return t===void 0||!q(e)?!1:e.seenAt===void 0||e.seenAt<t}function le(e){return W(e)||G(e)?!1:K(e.status)&&!J(e)}function ue(e){return e.reduce((e,t)=>J(t)?e+1:e,0)}function Y(e){return e===`running`||e===`queued`||e===`waiting`}function de(e){return!Y(e.status)&&e.worktree!==!1&&!!e.worktreePath&&!e.worktreeReclaimedAt&&!e.worktreeLifecycle?.activeOperationId}function X(e){return[...e.steps].reverse().find(e=>e.sessionId)?.sessionId}var fe=/^[A-Za-z0-9._][A-Za-z0-9._-]{0,199}$/,Z={claude:`claude --resume`,codex:`codex resume`,opencode:`opencode --session`,cursor:`agent --resume`,junie:`junie --resume`,pi:`pi --session`,copilot:`copilot --resume`,omp:`omp --resume`,antigravity:`agy --conversation`,gemini:`gemini --resume`,kimi:`kimi --session`};function pe(e,t){if(fe.test(t))return e===`junie`?`${Z.junie} --session-id=${t}`:`${Z[e??`claude`]} ${t}`}function me(e){if(Y(e.status)||e.worktreeLifecycle?.activeOperationId)return;let t=X(e);if(t===void 0)return;let n=pe(e.runner,t);if(n!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${n}`:n}function he(e,t){let n=B(t);return!n||Y(e.status)||e.worktreeLifecycle?.activeOperationId?!1:n===(e.runner??`claude`)&&X(e)!==void 0}function Q(e){let t=Y(e.status),n=X(e)!==void 0,r=!!e.worktreeLifecycle?.activeOperationId;return{finish:!r&&(e.status===`waiting`||e.status===`review`),continueRun:!r&&!t&&n,terminal:!r&&!t&&n,notes:!0,archive:!t,pin:!e.archived,markUnread:q(e)&&!J(e),markRead:q(e)&&J(e),promote:e.status===`queued`&&!e.archived,cancel:!r&&t,deleteRun:!r&&!t}}function ge(e){return e?`Resolve conflicts in PR ${e}`:`Resolve conflicts`}function _e(e){return e?`Fix failing checks in PR ${e}`:`Fix failing checks`}function ve(e){return e?`Commit and push`:`Commit`}function ye(){return`Push`}function $(e){let t=e?.replace(/^origin\//,``);return t&&!/^[0-9a-f]{7,40}$/i.test(t)?t:void 0}function be(e,t){let n=$(t);return`${e?`Create draft PR`:`Create PR`}${n?` against ${n}`:``}`}function xe(e){let t=$(e);return t?`Update branch from ${t}`:`Update branch`}function Se(e,t){return`${e?`Create draft PR`:`Create PR`} against ${t} instead of landing: move these changes to a new branch, commit and push it, open the PR, then switch the checkout back to ${t}`}function Ce(e){return`Update branch: pull the latest ${e} into the checkout (rebase, keeping these uncommitted changes)`}function we(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function Te(e,n){return t(e).get(n)}var Ee={answer:`Answer`,review:`Review changes`,"open-pr":`Open PR`,stop:`Stop`,retry:`Retry`};function De(e,{git:t,prUrl:n,changesShowing:i}){let a=Q(e);return e.worktreeLifecycle?.activeOperationId?null:e.status===`waiting`||r(e)?{kind:`answer`}:e.status===`review`&&!i?{kind:`review`}:t?{kind:`git`,action:t}:n&&/^https?:\/\//.test(n)?{kind:`open-pr`,url:n}:a.cancel?{kind:`stop`}:e.status===`failed`&&!o(e)&&a.continueRun?{kind:`retry`}:null}function Oe(e,t,n=null){let r=Q(e);return e.worktreeLifecycle?.activeOperationId?null:n&&t?.kind!==`git`?{kind:`git`,action:n}:r.cancel&&t?.kind!==`stop`?{kind:`stop`}:r.continueRun&&t?.kind!==`retry`&&t?.kind!==`answer`?{kind:`continue`}:null}export{E as A,J as C,R as D,B as E,C as M,b as N,P as O,g as P,le as S,V as T,Oe as _,be as a,q as b,Se as c,De as d,ye as f,Q as g,me as h,ve as i,T as j,F as k,Ce as l,ge as m,de as n,we as o,Te as p,he as r,_e as s,Ee as t,X as u,xe as v,ue as w,K as x,Y as y};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ot as r,r as i,xo as a}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{Ot as r,r as i,xo as a}from"./queries-BQUz3Wnb.js";import{t as o}from"./utils-Dp6vCdiU.js";import{V as s,t as c}from"./button-CJXK1JqU.js";import{n as l,r as u,t as d}from"./collapsible-DHALizq-.js";import{t as f}from"./diff-stat-DPetRUXO.js";import{a as p,o as m}from"./markdown-YSf01kqC.js";var h=e(t(),1),g=/^diff --git /;function _(e){let t=e.replace(g,``),n=t.lastIndexOf(` b/`);return v(n>=0?t.slice(n+3):t)}function v(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1).replace(/\\(.)/g,`$1`):t}function y(e){let t=v(e.slice(4));if(t!==`/dev/null`)return t.replace(/^[ab]\//,``)}function b(e){let t=[],n=null,r=!1;for(let i of e.split(`
|
|
2
2
|
`)){if(g.test(i)){n={path:_(i),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]},t.push(n),r=!1;continue}if(n){if(!r){if(i.startsWith(`@@`))r=!0,n.lines.push(i);else if(i.startsWith(`rename from `))n.status=`renamed`,n.oldPath=v(i.slice(12));else if(i.startsWith(`rename to `))n.status=`renamed`,n.path=v(i.slice(10));else if(i.startsWith(`new file mode`))n.status=`added`;else if(i.startsWith(`deleted file mode`))n.status=`deleted`;else if(i.startsWith(`Binary files `)||i===`GIT binary patch`)n.binary=!0;else if(i.startsWith(`+++ `)){let e=y(i);e!==void 0&&(n.path=e)}else if(i.startsWith(`--- `)){let e=y(i);e!==void 0&&n.status===`deleted`&&(n.path=e)}continue}n.lines.push(i),i.startsWith(`+`)?n.additions+=1:i.startsWith(`-`)&&(n.deletions+=1)}}let i=t.at(-1);return i&&i.lines.at(-1)===``&&i.lines.pop(),t}function x(e){return{files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}}var S=n(),C=20,w=300;function T({runId:e}){let t=a(),n=r(e);(0,h.useEffect)(()=>{t.invalidateQueries({queryKey:i.runs.diff(e)})},[t,e]);let o=(0,h.useMemo)(()=>b(n.data??``),[n.data]),[s,l]=(0,h.useState)(!1);if(n.isPending)return(0,S.jsx)(`p`,{className:`px-1 text-label text-soft-foreground`,children:`Loading diff…`});if(n.isError)return(0,S.jsx)(`p`,{className:`px-1 text-label text-danger`,children:n.error.message});if(o.length===0)return(0,S.jsx)(`p`,{"data-slot":`run-diff-empty`,className:`px-1 font-mono text-label text-muted-foreground`,children:n.data.trim()||`(no changes)`});let u=x(o),d=s?o:o.slice(0,C);return(0,S.jsxs)(`div`,{"data-slot":`run-diff`,className:`flex min-w-0 flex-col gap-2`,children:[(0,S.jsxs)(`p`,{className:`flex items-center gap-2 px-1 text-label text-muted-foreground`,children:[(0,S.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,S.jsx)(f,{stat:{adds:u.additions,dels:u.deletions,files:u.files}})]}),d.map(e=>(0,S.jsx)(D,{file:e},`${e.oldPath??``}→${e.path}`)),o.length>d.length?(0,S.jsxs)(c,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>l(!0),children:[`Show `,o.length-d.length,` more files`]}):null]})}var E={added:`added`,deleted:`deleted`,renamed:`renamed`};function D({file:e}){let[t,n]=(0,h.useState)(!0),r=E[e.status];return(0,S.jsxs)(d,{open:t,onOpenChange:n,"data-slot":`diff-file`,className:`min-w-0 overflow-hidden rounded-md border border-border bg-card`,children:[(0,S.jsxs)(u,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,S.jsx)(s,{className:o(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,S.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),r?(0,S.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:r}):null,e.binary?(0,S.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:`binary`}):null,(0,S.jsx)(f,{stat:{adds:e.additions,dels:e.deletions,files:1},className:`ml-auto shrink-0 text-meta`})]}),(0,S.jsx)(l,{children:(0,S.jsx)(`div`,{className:`border-t border-border/50`,children:e.binary?(0,S.jsx)(`p`,{className:`px-4 py-2.5 text-label text-muted-foreground`,children:`Binary file — no text diff.`}):e.lines.length===0?(0,S.jsx)(`p`,{className:`px-4 py-2.5 text-label text-muted-foreground`,children:`No content changes (metadata only).`}):(0,S.jsx)(O,{lines:e.lines})})})]})}function O({lines:e}){let[t,n]=(0,h.useState)(!1),r=t?e:e.slice(0,w),i=r.join(`
|
|
3
3
|
`),[a,s]=(0,h.useState)(null);(0,h.useEffect)(()=>{let e=!1;return p(i,`diff`).then(t=>{e||s({text:i,tokens:t.tokens})}),()=>{e=!0}},[i]);let c=a?.text===i?a.tokens:m(i,`diff`)?.tokens??null;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`pre`,{"data-slot":`diff-file-body`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:r.map((e,t)=>(0,S.jsxs)(`span`,{className:o(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[c?.[t]===void 0?e:c[t].map((e,t)=>(0,S.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>w?(0,S.jsx)(`button`,{type:`button`,"data-slot":`diff-file-toggle`,onClick:()=>n(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-meta font-medium text-soft-foreground hover:text-foreground`,children:t?`Show less`:`Show all ${e.length} lines`}):null]})}export{T 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"./zoomable-image-
|
|
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"./zoomable-image-BiM5LfTG.js";var i=e(t(),1),a=n();function o(e){return e.image===!0&&(e.binary===!0||e.patch===``)}function s({file:e,imageSrc:t,oldImageSrc:n,onOpenInApp:r}){let i=e.oldPath??e.path;return e.status===`deleted`?n?(0,a.jsx)(`div`,{"data-slot":`diff-image-preview`,className:`flex flex-col items-center gap-2 p-4`,children:(0,a.jsx)(c,{src:n(i),alt:i,side:`old`})}):(0,a.jsx)(l,{children:`Image deleted — only the new side can be previewed.`}):t?(0,a.jsxs)(`div`,{"data-slot":`diff-image-preview`,className:`flex flex-col items-center gap-2 p-4`,children:[n!==void 0&&e.status!==`added`?(0,a.jsxs)(`div`,{className:`grid w-full grid-cols-1 items-start gap-4 sm:grid-cols-2`,children:[(0,a.jsx)(c,{label:`Before`,src:n(i),alt:i,side:`old`}),(0,a.jsx)(c,{label:`After`,src:t(e.path),alt:e.path,side:`new`})]}):(0,a.jsx)(c,{src:t(e.path),alt:e.path,side:`new`}),r?(0,a.jsx)(`button`,{type:`button`,"data-slot":`diff-image-open`,onClick:()=>r(e.path),className:`text-meta font-medium text-soft-foreground hover:text-foreground hover:underline`,children:`Open in default app`}):null]}):(0,a.jsx)(l,{children:`Binary file — no text diff.`})}function c({label:e,src:t,alt:n,side:o}){let[s,c]=(0,i.useState)(null);return(0,a.jsxs)(`figure`,{"data-slot":`diff-image-side`,"data-side":o,className:`flex min-w-0 flex-col items-center gap-1.5`,children:[e?(0,a.jsx)(`figcaption`,{className:`text-meta font-medium text-soft-foreground`,children:e}):null,s===t?(0,a.jsx)(l,{children:`Image can’t be previewed (too large or unavailable).`}):(0,a.jsx)(r,{src:t,alt:n,onError:()=>c(t),className:`max-h-[60vh] max-w-full rounded-sm`})]})}function l({children:e}){return(0,a.jsx)(`p`,{className:`px-4 py-2.5 text-label text-muted-foreground`,children:e})}function u(e){return e.closest(`[data-diff-scroller], [data-slot="main"]`)}function d(e,t,n){let r=t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop-n;e.scrollTop=Math.max(0,r)}export{o as i,d as n,s as r,u 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{$n as r,I as i,co as a,cr as o,dr as s,fi as c,fr as l,ir as u,lo as d,lr as f,mr as p,pn as m,pr as ee,r as h,sr as te,ur as g,xo as _}from"./queries-DVZ1lYAo.js";import{Et as ne,N as re,Ot as ie,a as v,c as y,jt as ae,s as b,t as x}from"./utils-DWwoYTjU.js";import{t as S}from"./worktree-lifecycle-YFVatYLd.js";import{f as C,l as w,r as oe,t as se}from"./managers-DDPXJoKR.js";import{c as T}from"./sheet-DirfZrZD.js";import{t as E}from"./createLucideIcon-BHp8sXmF.js";var D=e(t(),1),O=new Map,k=e=>({status:e.status,archived:e.archived,awaitingAnswerSince:e.awaitingAnswerSince,idleClosedAt:e.idleClosedAt}),A=new Map,j=new Set,M=0;function N(e,t){t?A.set(e,M+1):A.delete(e),M++,j.forEach(e=>e())}function ce(e,t){let n=`${e}:${typeof t==`string`?t:t.id}`;O.delete(n),O.set(n,{value:typeof t==`string`?null:k(t),revision:M+1}),O.size>2e3&&O.delete(O.keys().next().value),M++,j.forEach(e=>e())}function P(e){return(0,D.useSyncExternalStore)(e=>(j.add(e),()=>{j.delete(e)}),()=>M),I(e.projectId,e.id)}var F=()=>M,I=(e,t)=>A.has(e)?null:O.get(`${e}:${t}`)?.value;function L(e,t=[]){let n=new Map(t.map(e=>[`${e.projectId}:${e.id}`,e])),r=!1;for(let n of t){let t=A.get(n.projectId);t!==void 0&&t<=e&&(A.delete(n.projectId),r=!0)}for(let[t,i]of O){let a=n.get(t);i.revision>e||!a||(a.status!==void 0&&a.archived!==void 0?(O.set(t,{value:k({status:a.status,archived:a.archived,awaitingAnswerSince:a.awaitingAnswerSince,idleClosedAt:a.idleClosedAt}),revision:M+1}),r=!0):i.value===null&&(O.delete(t),r=!0))}r&&(M++,j.forEach(e=>e()))}function R(e=()=>performance.now()){let t=new Map,n=new Set,r=new Set,i,a={connected:!1,samples:[]},o=()=>{a={...a,samples:[...t.values()].map(e=>e.sample)},n.forEach(e=>e())},s=()=>{let n=!1;for(let[r,i]of t)i.deadline<=e()&&(t.delete(r),n=!0);n&&o()};return{getSnapshot:()=>a,subscribe(e){return n.add(e),i||=setInterval(s,1e3),s(),()=>{n.delete(e),n.size||(clearInterval(i),i=void 0)}},expire:s,connected(e){a.connected!==e&&(a={...a,connected:e},o(),r.forEach(e=>e()))},isConnected:()=>a.connected,subscribeConnected(e){return r.add(e),()=>{r.delete(e)}},replace(n,r,i){for(let[e,r]of t)r.sample.projectId===n&&t.delete(e);let a=i?Date.parse(i):NaN;for(let i of r){let r=Math.max(0,a-Date.parse(i.sampledAt));Number.isFinite(r)&&r<1e4&&i.projectId===n&&t.set(`${n}:${i.runId}`,{sample:i,deadline:e()+1e4-r})}o()},seed(n,r){for(let[e,n]of t)Date.parse(n.sample.sampledAt)<=Date.parse(r)&&t.delete(e);for(let i of n){let n=Math.max(0,Date.parse(r)-Date.parse(i.sampledAt));Number.isFinite(n)&&n<1e4&&!t.has(`${i.projectId}:${i.runId}`)&&t.set(`${i.projectId}:${i.runId}`,{sample:i,deadline:e()+1e4-n})}o()},remove(e,n){for(let[r,i]of t)i.sample.projectId===e&&(!n||i.sample.runId===n)&&t.delete(r);o()}}}var z=R(),le=()=>(0,D.useSyncExternalStore)(z.subscribe,z.getSnapshot);function B(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function V(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function H(e,t){let n=new Map,r=[];for(let i of t??[]){n.set(i.id,i.status);let t=e.get(i.id);t===void 0||t===i.status||u(i)&&r.push(i)}return{entering:r,statuses:n}}function U(e){return e.enabled&&e.hidden&&e.permission===`granted`}function W(e){let t=r(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`,path:`/p/default/tasks/${encodeURIComponent(e.id)}`}}var G=e=>e.pendingActions+e.pendingQuestions+e.important;function K(e,t){let n=new Map(t.map(e=>[e.id,G(e)]));return{entering:e===null?[]:t.filter(t=>t.notify!==!1&&G(t)>(e.get(t.id)??0)),counts:n}}function q(e){return{title:e.name,body:e.pendingActions>0?`Needs your approval`:e.pendingQuestions>0?`Has a question for you`:e.headline??e.preview??`New message`,tag:`cezar-manager-${e.id}`,path:`/manager/${encodeURIComponent(e.id)}`}}function ue(e){return V()===`granted`&&J(e)?!0:B(e.getQueryData(m.uiState)?.notifications).enabled&&V()===`granted`}function J(e){return V()===`granted`&&e.getQueryData(m.uiState)===void 0}var Y=n(),de=`${v(`/workspace/events`)}?slim=1`,X=2,fe=3e3,pe=[`run`,`run-deleted`,`todos`,`usage`,`ping`],me=[`project-added`,`project-removed`,`checkout-progress`,`automation-change`,`tracker-changed`],Z=new Set;function he(e){return Z.add(e),()=>{Z.delete(e)}}var ge=400,_e=15e3;function ve(e){let t;return{onEvent(n){n.type!==`run`&&n.type!==`run-deleted`||t===void 0&&(t=setTimeout(()=>{t=void 0,e.invalidateQueries({queryKey:m.runsIndex})},ge))},cancel(){clearTimeout(t),t=void 0}}}var ye=[500,1500];function be(e){let t=new Set,n=new Map,r=new Set,i=!1,a=e=>{t.delete(e),n.delete(e)},s=(t,r,i)=>{let s=n.get(t);if(a(t),s?.kind===`deleted`){e.setQueryData(r,e=>o(e,i.id));return}e.setQueryData(r,e=>{let t=e!==void 0&&e.some(e=>e.id===i.id)?e:f(e,i);return s?.kind===`run`?f(t,s.frame):t})},l=(t,n,o,u,d)=>{c(o,u).then(e=>{i||s(t,n,e)}).catch(s=>{if(i)return;let c=ye[d],f=s instanceof p&&s.status>=400&&s.status<500;if(c===void 0||f){a(t),c===void 0&&e.invalidateQueries({queryKey:n,refetchType:`active`});return}let m=setTimeout(()=>{r.delete(m),i||l(t,n,o,u,d+1)},c);r.add(m)})};return{run(e,r){if(i)return;let a=y(),o=`${a}\0${e}`;if(t.has(o)){n.set(o,{kind:`run`,frame:r});return}t.add(o),l(o,[a,`runs`,`list`],a,e,0)},deleted(e){if(i)return;let r=`${y()}\0${e}`;t.has(r)&&n.set(r,{kind:`deleted`})},cancel(){i=!0;for(let e of r)clearTimeout(e);r.clear(),t.clear(),n.clear()}}}function xe(e,t){let n;for(let t of e.getQueryCache().getAll()){if(t.queryKey[1]!==`health`)continue;let e=t.state.data?.bootProject;if(typeof e==`string`){n=e;break}}let r=new Set([t]);return n===t&&r.add(`default`),[...r]}function Se(e){return[[`run-history`,e],[`run-history-context`,e],[`run-history-tail`,e]]}function Ce(e){return[[e,`runs`],[e,`todos`],[e,`worktrees`],...Se(e)]}function we(e){if(e[0]!==`workspace`)return e[0]===`run-history`||e[0]===`run-history-context`||e[0]===`run-history-tail`?typeof e[1]==`string`?e[1]:void 0:typeof e[0]==`string`?e[0]:void 0}function Te(e){return[...new Set(e.getQueryCache().getAll().map(({queryKey:e})=>we(e)).filter(e=>e!==void 0))]}function Ee(e){let t,n=new Set;return{onEvent(r){if(!(t!==void 0&&n.has(r))){for(let t of xe(e,r))n.add(t);t===void 0&&(t=setTimeout(()=>{t=void 0;let r=n;n=new Set;let i=y();for(let t of r)for(let n of Ce(t))e.invalidateQueries({queryKey:n,refetchType:t===i?`active`:`none`})},ge))}},cancel(){clearTimeout(t),t=void 0,n.clear()}}}function De(e,t,n,r){let i=new Map,a,o=0,s=()=>{if(clearTimeout(a),a=void 0,o>0)return;let s=Q(e),c=i;i=new Map;for(let i of c.values())i.project===s?ke(e,t,i.event,r):n(i.project)},c=()=>{a===void 0&&(a=setTimeout(s,50))};return{onEvent(e,t){let n=e.type===`run`?e.run.id:e.id;i.set(`${t}:${n}`,{event:e,project:t}),c()},beginReconcile(){s(),o+=1},endReconcile(){o!==0&&(--o,o===0&&s())},cancel(){clearTimeout(a),a=void 0,i.clear(),o=0}}}async function Oe(e){let t=y(),n=[h.runs.all,m.runsIndex,m.dashboard,h.todos,h.health,h.worktrees,S.all(),m.providerStatus,m.hostUsage,m.skillsUpdateAll,w.list,[`run-history`,t],[`run-history-context`,t]],r=Promise.allSettled([Promise.all([e.cancelQueries({queryKey:[`tracker`],predicate:e=>e.queryKey[2]!==`items`||e.getObserversCount()===0}),e.cancelQueries({queryKey:m.projects})]).then(()=>Promise.all([e.invalidateQueries({queryKey:[`tracker`],predicate:e=>e.queryKey[2]!==`items`||e.getObserversCount()===0}),e.invalidateQueries({queryKey:m.projects})])),e.invalidateQueries({queryKey:[`worktree-lifecycle`],refetchType:`none`}),C(e),...Te(e).filter(e=>e!==t).flatMap(t=>Ce(t).map(t=>e.invalidateQueries({queryKey:t,refetchType:`none`}))),...n.map(t=>e.invalidateQueries({queryKey:t}))]),i=!1,a;try{await Promise.race([r.then(()=>{i=!0}),new Promise(e=>{a=setTimeout(e,_e)})])}finally{clearTimeout(a)}i||await Promise.allSettled(n.map(t=>e.cancelQueries({queryKey:t})))}function Q(e){return b()??e.getQueryData(h.health)?.bootProject}function ke(e,t,n,r){switch(n.type){case`run`:{let t=h.runs.list(),i=e.getQueryData(t);i&&!s(n.run)&&!i.some(e=>e.id===n.run.id)?r.run(n.run.id,n.run):e.setQueryData(t,e=>f(e,n.run));let a=h.runs.detail(n.run.id);e.getQueryData(a)!==void 0&&e.setQueryData(a,e=>e===void 0?e:l(e,n.run));let o=h.runs.changes(n.run.id);e.getQueryData(o)!==void 0&&e.invalidateQueries({queryKey:o}),e.invalidateQueries({queryKey:h.worktrees});return}case`run-deleted`:r.deleted(n.id),e.setQueryData(h.runs.list(),e=>o(e,n.id)),e.removeQueries({queryKey:h.runs.detail(n.id)}),e.removeQueries({queryKey:h.runs.diff(n.id)}),e.invalidateQueries({queryKey:h.worktrees});return;case`todos`:e.setQueryData(h.todos,n.items);return;case`usage`:t.set(n.usage);return;case`ping`:return}}function Ae(e,t=de){let n=_();(0,D.useEffect)(()=>{let r=globalThis.EventSource;if(typeof r!=`function`)return;let i=null,o,s,c=new Set,l=()=>{clearTimeout(o),clearTimeout(s),o=void 0,s=void 0;let e=Q(n);for(let t of c){let r=t===e?y():t;n.invalidateQueries({queryKey:S.all(r),refetchType:t===e?`active`:`none`}),t===e&&n.invalidateQueries({queryKey:h.worktrees})}c.clear()},u,f,p=()=>{clearTimeout(u),clearTimeout(f),u=void 0,f=void 0,n.invalidateQueries({queryKey:m.dashboard,refetchType:document.visibilityState===`hidden`?`none`:`active`,predicate:e=>e.queryKey[2]!==`telemetry`&&e.queryKey[2]!==`automations`&&!(e.queryKey[2]===`feed`&&e.queryKey[3]===`github`)})},te=()=>{clearTimeout(u),u=setTimeout(p,250),f??=setTimeout(p,1e3)},g=ve(n),_=be(n),v=Ee(n),b=De(n,e,v.onEvent,_),x,C=!1,w=!1,E,D=!1,O=Date.now(),k,A=!1,j=!1,M=0,P=new Set,F=[],I=()=>{A=!0,j=!1;let e=m.providerStatus;n.cancelQueries({queryKey:e,exact:!0}).then(()=>n.invalidateQueries({queryKey:e,exact:!0,refetchType:`active`})).finally(()=>{if(D||!j){A=!1;return}I()})},L=e=>{let t=m.providerStatus,r=a(n.getQueryData(t),e);if(r!==void 0){n.setQueryData(t,r);return}if(A){j=!0;return}I()},R=()=>{M+=1,b.beginReconcile(),Oe(n).finally(()=>{--M,M===0&&(D?(P.clear(),F=[]):le()),b.endReconcile()})},le=()=>{let e=P,t=F;P=new Set,F=[];let r=Q(n);for(let t of e)t===r?n.invalidateQueries({queryKey:h.todos}):v.onEvent(t);for(let e of t)L(e)},B=()=>{D||x!==void 0||(x=setTimeout(()=>{x=void 0,D||V()},fe))},V=()=>{z.connected(!1),i?.close(),O=Date.now();let a=new r(t,{withCredentials:!0});i=a,a.addEventListener(`open`,()=>{D||i!==a||(O=Date.now(),clearTimeout(E),E=void 0,(C||w)&&R(),z.connected(!0),C=!0,w=!1)});for(let t of pe)a.addEventListener(t,r=>{if(D||i!==a)return;O=Date.now();let o=ee(t,r.data);if(o){if(g.onEvent(o.event),(o.event.type===`run`||o.event.type===`run-deleted`)&&(te(),o.project&&ce(o.project,o.event.type===`run-deleted`?o.event.id:o.event.run),o.project&&(o.event.type===`run-deleted`||o.event.run.status!==`running`)&&z.remove(o.project,o.event.type===`run-deleted`?o.event.id:o.event.run.id)),t===`usage`)try{let e=re.safeParse(JSON.parse(r.data));e.success&&z.replace(e.data.project,e.data.samples??[],e.data.sentAt)}catch{}if(o.project!==null&&o.project!==Q(n)){v.onEvent(o.project);return}o.event.type===`run`||o.event.type===`run-deleted`?o.project!==null&&b.onEvent(o.event,o.project):o.event.type===`todos`&&M>0?o.project!==null&&P.add(o.project):ke(n,e,o.event,_)}});a.addEventListener(`worktree-lifecycle`,e=>{if(D||i!==a)return;O=Date.now();let t;try{t=JSON.parse(e.data)}catch{return}let n=ie.safeParse(t);n.success&&(c.add(n.data.projectId),clearTimeout(o),o=setTimeout(l,100),s??=setTimeout(l,1e3))}),a.addEventListener(`artifacts`,e=>{if(D||i!==a)return;O=Date.now();let t;try{t=JSON.parse(e.data)}catch{return}let r=ne.safeParse(t);if(!r.success)return;let{project:o,runId:s,artifacts:c,truncated:l,versions:u}=r.data;if(o!==void 0&&o!==Q(n)){v.onEvent(o);return}let d={artifacts:c,truncated:l,...u?{versions:u}:{}},f=h.runs.artifacts(s);n.getQueryData(f)!==void 0&&n.setQueryData(f,d),n.setQueriesData({queryKey:h.runs.impactSubjects},e=>e?.run?.id===s?Fe(e,d):e),n.invalidateQueries({queryKey:h.runs.projectAssets})});for(let e of me)a.addEventListener(e,t=>{if(D||i!==a)return;O=Date.now();let r;try{r=JSON.parse(t.data)}catch{return}if(e===`tracker-changed`){if(!ae.safeParse(r).success)return;Promise.all([n.cancelQueries({queryKey:[`tracker`]}),n.cancelQueries({queryKey:m.projects})]).then(()=>Promise.all([n.invalidateQueries({queryKey:[`tracker`]}),n.invalidateQueries({queryKey:m.projects})]))}e!==`checkout-progress`&&e!==`automation-change`&&e!==`tracker-changed`&&(r&&typeof r==`object`&&(e===`project-removed`&&`id`in r&&typeof r.id==`string`?(N(r.id,!0),z.remove(r.id)):e===`project-added`&&`project`in r&&r.project&&typeof r.project==`object`&&`id`in r.project&&typeof r.project.id==`string`&&N(r.project.id,!1)),n.invalidateQueries({queryKey:m.projects}),n.invalidateQueries({queryKey:m.dashboard,refetchType:document.visibilityState===`hidden`?`none`:`active`}));for(let t of[...Z])t(e,r)});for(let e of se)a.addEventListener(e,t=>{D||i!==a||(O=Date.now(),oe(n,e,t.data))});a.addEventListener(`provider-status`,e=>{if(D||i!==a)return;O=Date.now();let t;try{t=JSON.parse(e.data)}catch{return}let n=d(t);if(n){if(M>0){F.push(n);return}L(n)}}),a.addEventListener(`error`,()=>{D||i!==a||(z.connected(!1),a.readyState===X&&B())})},H=()=>{w=!0,clearTimeout(E),E=setTimeout(()=>{E=void 0,!(D||!w)&&(w=!1,R())},_e)},U,W=()=>{if(U=void 0,D||document.visibilityState!==`hidden`)return;if(ue(n)){J(n)&&(U=setTimeout(W,T));return}clearTimeout(x),x=void 0;let e=i;i=null,z.connected(!1),e?.close()},G=()=>{document.visibilityState===`hidden`&&(U??=setTimeout(W,T))},K=()=>{if(document.visibilityState===`hidden`){G();return}if(clearTimeout(U),U=void 0,!i||i.readyState===X){clearTimeout(x),x=void 0,H(),V();return}R()},q=()=>{clearTimeout(x),x=void 0;let e=i;i=null,z.connected(!1),e?.close()},Y=e=>{e.persisted&&(H(),V(),G())};return k=setInterval(()=>{D||document.visibilityState!==`visible`||Date.now()-O<=4e4||(clearTimeout(x),x=void 0,V())},1e4),document.addEventListener(`visibilitychange`,K),window.addEventListener(`pagehide`,q),window.addEventListener(`pageshow`,Y),V(),G(),()=>{D=!0,clearTimeout(x),clearTimeout(E),clearInterval(k),clearTimeout(U),z.connected(!1),clearTimeout(u),clearTimeout(f),clearTimeout(o),clearTimeout(s),c.clear(),g.cancel(),_.cancel(),v.cancel(),b.cancel(),P.clear(),F=[],document.removeEventListener(`visibilitychange`,K),window.removeEventListener(`pagehide`,q),window.removeEventListener(`pageshow`,Y);let e=i;i=null,z.connected(!1),e?.close()}},[n,e,t])}var $=(0,D.createContext)(null);function je({children:e}){let[t]=(0,D.useState)(g);return Ae(t),i(),(0,Y.jsx)($.Provider,{value:t,children:e})}function Me(e){let t=(0,D.useContext)($),n=t?t.get:Pe;return(0,D.useSyncExternalStore)(t?t.subscribe:Ne,()=>e?n()[e]:void 0,()=>void 0)}var Ne=()=>()=>void 0,Pe=()=>te;function Fe(e,t){if(e.run===null)return e;let{versions:n,...r}=e;return{...r,artifacts:t.artifacts,truncated:t.truncated,...t.versions?{versions:t.versions}:{}}}var Ie=E(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Le=E(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]);function Re({slot:e,label:t,value:n,options:r,onChange:i,full:a=!1,allowRelease:o=!1,className:s}){return(0,Y.jsx)(`div`,{"data-slot":e,"data-full":a?`true`:void 0,role:`group`,"aria-label":t,className:x(`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,a&&`flex w-full`,s),children:r.map(e=>{let t=e.value===n;return(0,Y.jsxs)(`button`,{type:`button`,"data-value":e.value,"aria-pressed":t,onClick:()=>{t&&!o||i(e.value)},className:x(`flex h-7 items-center justify-center gap-1.5 rounded-[7px] px-3 text-ui font-medium whitespace-nowrap text-muted-foreground transition-colors hover:text-foreground`,a&&`flex-1`,t&&`bg-card font-semibold text-foreground shadow-xs`),children:[e.label,e.count===void 0?null:(0,Y.jsx)(`small`,{className:`font-mono text-meta font-normal tabular-nums`,children:e.count})]},e.value)})})}export{L as _,he as a,W as c,B as d,V as f,F as g,le as h,je as i,K as l,z as m,Le as n,Me as o,U as p,Ie as r,q as s,Re as t,H as u,P as v};
|
|
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,I as i,co as a,cr as o,dr as s,fi as c,fr as l,ir as u,lo as d,lr as f,mr as p,pn as m,pr as ee,r as h,sr as te,ur as g,xo as _}from"./queries-BQUz3Wnb.js";import{Et as ne,N as re,Ot as ie,a as v,c as y,jt as ae,s as b,t as x}from"./utils-Dp6vCdiU.js";import{t as S}from"./worktree-lifecycle-C18dBDW4.js";import{f as C,l as w,r as oe,t as se}from"./managers-Dr63u21Y.js";import{c as T}from"./sheet-DPwaj6sk.js";import{t as E}from"./createLucideIcon-BHp8sXmF.js";var D=e(t(),1),O=new Map,k=e=>({status:e.status,archived:e.archived,awaitingAnswerSince:e.awaitingAnswerSince,idleClosedAt:e.idleClosedAt}),A=new Map,j=new Set,M=0;function N(e,t){t?A.set(e,M+1):A.delete(e),M++,j.forEach(e=>e())}function ce(e,t){let n=`${e}:${typeof t==`string`?t:t.id}`;O.delete(n),O.set(n,{value:typeof t==`string`?null:k(t),revision:M+1}),O.size>2e3&&O.delete(O.keys().next().value),M++,j.forEach(e=>e())}function P(e){return(0,D.useSyncExternalStore)(e=>(j.add(e),()=>{j.delete(e)}),()=>M),I(e.projectId,e.id)}var F=()=>M,I=(e,t)=>A.has(e)?null:O.get(`${e}:${t}`)?.value;function L(e,t=[]){let n=new Map(t.map(e=>[`${e.projectId}:${e.id}`,e])),r=!1;for(let n of t){let t=A.get(n.projectId);t!==void 0&&t<=e&&(A.delete(n.projectId),r=!0)}for(let[t,i]of O){let a=n.get(t);i.revision>e||!a||(a.status!==void 0&&a.archived!==void 0?(O.set(t,{value:k({status:a.status,archived:a.archived,awaitingAnswerSince:a.awaitingAnswerSince,idleClosedAt:a.idleClosedAt}),revision:M+1}),r=!0):i.value===null&&(O.delete(t),r=!0))}r&&(M++,j.forEach(e=>e()))}function R(e=()=>performance.now()){let t=new Map,n=new Set,r=new Set,i,a={connected:!1,samples:[]},o=()=>{a={...a,samples:[...t.values()].map(e=>e.sample)},n.forEach(e=>e())},s=()=>{let n=!1;for(let[r,i]of t)i.deadline<=e()&&(t.delete(r),n=!0);n&&o()};return{getSnapshot:()=>a,subscribe(e){return n.add(e),i||=setInterval(s,1e3),s(),()=>{n.delete(e),n.size||(clearInterval(i),i=void 0)}},expire:s,connected(e){a.connected!==e&&(a={...a,connected:e},o(),r.forEach(e=>e()))},isConnected:()=>a.connected,subscribeConnected(e){return r.add(e),()=>{r.delete(e)}},replace(n,r,i){for(let[e,r]of t)r.sample.projectId===n&&t.delete(e);let a=i?Date.parse(i):NaN;for(let i of r){let r=Math.max(0,a-Date.parse(i.sampledAt));Number.isFinite(r)&&r<1e4&&i.projectId===n&&t.set(`${n}:${i.runId}`,{sample:i,deadline:e()+1e4-r})}o()},seed(n,r){for(let[e,n]of t)Date.parse(n.sample.sampledAt)<=Date.parse(r)&&t.delete(e);for(let i of n){let n=Math.max(0,Date.parse(r)-Date.parse(i.sampledAt));Number.isFinite(n)&&n<1e4&&!t.has(`${i.projectId}:${i.runId}`)&&t.set(`${i.projectId}:${i.runId}`,{sample:i,deadline:e()+1e4-n})}o()},remove(e,n){for(let[r,i]of t)i.sample.projectId===e&&(!n||i.sample.runId===n)&&t.delete(r);o()}}}var z=R(),le=()=>(0,D.useSyncExternalStore)(z.subscribe,z.getSnapshot);function B(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function V(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function H(e,t){let n=new Map,r=[];for(let i of t??[]){n.set(i.id,i.status);let t=e.get(i.id);t===void 0||t===i.status||u(i)&&r.push(i)}return{entering:r,statuses:n}}function U(e){return e.enabled&&e.hidden&&e.permission===`granted`}function W(e){let t=r(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`,path:`/p/default/tasks/${encodeURIComponent(e.id)}`}}var G=e=>e.pendingActions+e.pendingQuestions+e.important;function K(e,t){let n=new Map(t.map(e=>[e.id,G(e)]));return{entering:e===null?[]:t.filter(t=>t.notify!==!1&&G(t)>(e.get(t.id)??0)),counts:n}}function q(e){return{title:e.name,body:e.pendingActions>0?`Needs your approval`:e.pendingQuestions>0?`Has a question for you`:e.headline??e.preview??`New message`,tag:`cezar-manager-${e.id}`,path:`/manager/${encodeURIComponent(e.id)}`}}function ue(e){return V()===`granted`&&J(e)?!0:B(e.getQueryData(m.uiState)?.notifications).enabled&&V()===`granted`}function J(e){return V()===`granted`&&e.getQueryData(m.uiState)===void 0}var Y=n(),de=`${v(`/workspace/events`)}?slim=1`,X=2,fe=3e3,pe=[`run`,`run-deleted`,`todos`,`usage`,`ping`],me=[`project-added`,`project-removed`,`checkout-progress`,`automation-change`,`tracker-changed`],Z=new Set;function he(e){return Z.add(e),()=>{Z.delete(e)}}var ge=400,_e=15e3;function ve(e){let t;return{onEvent(n){n.type!==`run`&&n.type!==`run-deleted`||t===void 0&&(t=setTimeout(()=>{t=void 0,e.invalidateQueries({queryKey:m.runsIndex})},ge))},cancel(){clearTimeout(t),t=void 0}}}var ye=[500,1500];function be(e){let t=new Set,n=new Map,r=new Set,i=!1,a=e=>{t.delete(e),n.delete(e)},s=(t,r,i)=>{let s=n.get(t);if(a(t),s?.kind===`deleted`){e.setQueryData(r,e=>o(e,i.id));return}e.setQueryData(r,e=>{let t=e!==void 0&&e.some(e=>e.id===i.id)?e:f(e,i);return s?.kind===`run`?f(t,s.frame):t})},l=(t,n,o,u,d)=>{c(o,u).then(e=>{i||s(t,n,e)}).catch(s=>{if(i)return;let c=ye[d],f=s instanceof p&&s.status>=400&&s.status<500;if(c===void 0||f){a(t),c===void 0&&e.invalidateQueries({queryKey:n,refetchType:`active`});return}let m=setTimeout(()=>{r.delete(m),i||l(t,n,o,u,d+1)},c);r.add(m)})};return{run(e,r){if(i)return;let a=y(),o=`${a}\0${e}`;if(t.has(o)){n.set(o,{kind:`run`,frame:r});return}t.add(o),l(o,[a,`runs`,`list`],a,e,0)},deleted(e){if(i)return;let r=`${y()}\0${e}`;t.has(r)&&n.set(r,{kind:`deleted`})},cancel(){i=!0;for(let e of r)clearTimeout(e);r.clear(),t.clear(),n.clear()}}}function xe(e,t){let n;for(let t of e.getQueryCache().getAll()){if(t.queryKey[1]!==`health`)continue;let e=t.state.data?.bootProject;if(typeof e==`string`){n=e;break}}let r=new Set([t]);return n===t&&r.add(`default`),[...r]}function Se(e){return[[`run-history`,e],[`run-history-context`,e],[`run-history-tail`,e]]}function Ce(e){return[[e,`runs`],[e,`todos`],[e,`worktrees`],...Se(e)]}function we(e){if(e[0]!==`workspace`)return e[0]===`run-history`||e[0]===`run-history-context`||e[0]===`run-history-tail`?typeof e[1]==`string`?e[1]:void 0:typeof e[0]==`string`?e[0]:void 0}function Te(e){return[...new Set(e.getQueryCache().getAll().map(({queryKey:e})=>we(e)).filter(e=>e!==void 0))]}function Ee(e){let t,n=new Set;return{onEvent(r){if(!(t!==void 0&&n.has(r))){for(let t of xe(e,r))n.add(t);t===void 0&&(t=setTimeout(()=>{t=void 0;let r=n;n=new Set;let i=y();for(let t of r)for(let n of Ce(t))e.invalidateQueries({queryKey:n,refetchType:t===i?`active`:`none`})},ge))}},cancel(){clearTimeout(t),t=void 0,n.clear()}}}function De(e,t,n,r){let i=new Map,a,o=0,s=()=>{if(clearTimeout(a),a=void 0,o>0)return;let s=Q(e),c=i;i=new Map;for(let i of c.values())i.project===s?ke(e,t,i.event,r):n(i.project)},c=()=>{a===void 0&&(a=setTimeout(s,50))};return{onEvent(e,t){let n=e.type===`run`?e.run.id:e.id;i.set(`${t}:${n}`,{event:e,project:t}),c()},beginReconcile(){s(),o+=1},endReconcile(){o!==0&&(--o,o===0&&s())},cancel(){clearTimeout(a),a=void 0,i.clear(),o=0}}}async function Oe(e){let t=y(),n=[h.runs.all,m.runsIndex,m.dashboard,h.todos,h.health,h.worktrees,S.all(),m.providerStatus,m.hostUsage,m.skillsUpdateAll,w.list,[`run-history`,t],[`run-history-context`,t]],r=Promise.allSettled([Promise.all([e.cancelQueries({queryKey:[`tracker`],predicate:e=>e.queryKey[2]!==`items`||e.getObserversCount()===0}),e.cancelQueries({queryKey:m.projects})]).then(()=>Promise.all([e.invalidateQueries({queryKey:[`tracker`],predicate:e=>e.queryKey[2]!==`items`||e.getObserversCount()===0}),e.invalidateQueries({queryKey:m.projects})])),e.invalidateQueries({queryKey:[`worktree-lifecycle`],refetchType:`none`}),C(e),...Te(e).filter(e=>e!==t).flatMap(t=>Ce(t).map(t=>e.invalidateQueries({queryKey:t,refetchType:`none`}))),...n.map(t=>e.invalidateQueries({queryKey:t}))]),i=!1,a;try{await Promise.race([r.then(()=>{i=!0}),new Promise(e=>{a=setTimeout(e,_e)})])}finally{clearTimeout(a)}i||await Promise.allSettled(n.map(t=>e.cancelQueries({queryKey:t})))}function Q(e){return b()??e.getQueryData(h.health)?.bootProject}function ke(e,t,n,r){switch(n.type){case`run`:{let t=h.runs.list(),i=e.getQueryData(t);i&&!s(n.run)&&!i.some(e=>e.id===n.run.id)?r.run(n.run.id,n.run):e.setQueryData(t,e=>f(e,n.run));let a=h.runs.detail(n.run.id);e.getQueryData(a)!==void 0&&e.setQueryData(a,e=>e===void 0?e:l(e,n.run));let o=h.runs.changes(n.run.id);e.getQueryData(o)!==void 0&&e.invalidateQueries({queryKey:o}),e.invalidateQueries({queryKey:h.worktrees});return}case`run-deleted`:r.deleted(n.id),e.setQueryData(h.runs.list(),e=>o(e,n.id)),e.removeQueries({queryKey:h.runs.detail(n.id)}),e.removeQueries({queryKey:h.runs.diff(n.id)}),e.invalidateQueries({queryKey:h.worktrees});return;case`todos`:e.setQueryData(h.todos,n.items);return;case`usage`:t.set(n.usage);return;case`ping`:return}}function Ae(e,t=de){let n=_();(0,D.useEffect)(()=>{let r=globalThis.EventSource;if(typeof r!=`function`)return;let i=null,o,s,c=new Set,l=()=>{clearTimeout(o),clearTimeout(s),o=void 0,s=void 0;let e=Q(n);for(let t of c){let r=t===e?y():t;n.invalidateQueries({queryKey:S.all(r),refetchType:t===e?`active`:`none`}),t===e&&n.invalidateQueries({queryKey:h.worktrees})}c.clear()},u,f,p=()=>{clearTimeout(u),clearTimeout(f),u=void 0,f=void 0,n.invalidateQueries({queryKey:m.dashboard,refetchType:document.visibilityState===`hidden`?`none`:`active`,predicate:e=>e.queryKey[2]!==`telemetry`&&e.queryKey[2]!==`automations`&&!(e.queryKey[2]===`feed`&&e.queryKey[3]===`github`)})},te=()=>{clearTimeout(u),u=setTimeout(p,250),f??=setTimeout(p,1e3)},g=ve(n),_=be(n),v=Ee(n),b=De(n,e,v.onEvent,_),x,C=!1,w=!1,E,D=!1,O=Date.now(),k,A=!1,j=!1,M=0,P=new Set,F=[],I=()=>{A=!0,j=!1;let e=m.providerStatus;n.cancelQueries({queryKey:e,exact:!0}).then(()=>n.invalidateQueries({queryKey:e,exact:!0,refetchType:`active`})).finally(()=>{if(D||!j){A=!1;return}I()})},L=e=>{let t=m.providerStatus,r=a(n.getQueryData(t),e);if(r!==void 0){n.setQueryData(t,r);return}if(A){j=!0;return}I()},R=()=>{M+=1,b.beginReconcile(),Oe(n).finally(()=>{--M,M===0&&(D?(P.clear(),F=[]):le()),b.endReconcile()})},le=()=>{let e=P,t=F;P=new Set,F=[];let r=Q(n);for(let t of e)t===r?n.invalidateQueries({queryKey:h.todos}):v.onEvent(t);for(let e of t)L(e)},B=()=>{D||x!==void 0||(x=setTimeout(()=>{x=void 0,D||V()},fe))},V=()=>{z.connected(!1),i?.close(),O=Date.now();let a=new r(t,{withCredentials:!0});i=a,a.addEventListener(`open`,()=>{D||i!==a||(O=Date.now(),clearTimeout(E),E=void 0,(C||w)&&R(),z.connected(!0),C=!0,w=!1)});for(let t of pe)a.addEventListener(t,r=>{if(D||i!==a)return;O=Date.now();let o=ee(t,r.data);if(o){if(g.onEvent(o.event),(o.event.type===`run`||o.event.type===`run-deleted`)&&(te(),o.project&&ce(o.project,o.event.type===`run-deleted`?o.event.id:o.event.run),o.project&&(o.event.type===`run-deleted`||o.event.run.status!==`running`)&&z.remove(o.project,o.event.type===`run-deleted`?o.event.id:o.event.run.id)),t===`usage`)try{let e=re.safeParse(JSON.parse(r.data));e.success&&z.replace(e.data.project,e.data.samples??[],e.data.sentAt)}catch{}if(o.project!==null&&o.project!==Q(n)){v.onEvent(o.project);return}o.event.type===`run`||o.event.type===`run-deleted`?o.project!==null&&b.onEvent(o.event,o.project):o.event.type===`todos`&&M>0?o.project!==null&&P.add(o.project):ke(n,e,o.event,_)}});a.addEventListener(`worktree-lifecycle`,e=>{if(D||i!==a)return;O=Date.now();let t;try{t=JSON.parse(e.data)}catch{return}let n=ie.safeParse(t);n.success&&(c.add(n.data.projectId),clearTimeout(o),o=setTimeout(l,100),s??=setTimeout(l,1e3))}),a.addEventListener(`artifacts`,e=>{if(D||i!==a)return;O=Date.now();let t;try{t=JSON.parse(e.data)}catch{return}let r=ne.safeParse(t);if(!r.success)return;let{project:o,runId:s,artifacts:c,truncated:l,versions:u}=r.data;if(o!==void 0&&o!==Q(n)){v.onEvent(o);return}let d={artifacts:c,truncated:l,...u?{versions:u}:{}},f=h.runs.artifacts(s);n.getQueryData(f)!==void 0&&n.setQueryData(f,d),n.setQueriesData({queryKey:h.runs.impactSubjects},e=>e?.run?.id===s?Fe(e,d):e),n.invalidateQueries({queryKey:h.runs.projectAssets})});for(let e of me)a.addEventListener(e,t=>{if(D||i!==a)return;O=Date.now();let r;try{r=JSON.parse(t.data)}catch{return}if(e===`tracker-changed`){if(!ae.safeParse(r).success)return;Promise.all([n.cancelQueries({queryKey:[`tracker`]}),n.cancelQueries({queryKey:m.projects})]).then(()=>Promise.all([n.invalidateQueries({queryKey:[`tracker`]}),n.invalidateQueries({queryKey:m.projects})]))}e!==`checkout-progress`&&e!==`automation-change`&&e!==`tracker-changed`&&(r&&typeof r==`object`&&(e===`project-removed`&&`id`in r&&typeof r.id==`string`?(N(r.id,!0),z.remove(r.id)):e===`project-added`&&`project`in r&&r.project&&typeof r.project==`object`&&`id`in r.project&&typeof r.project.id==`string`&&N(r.project.id,!1)),n.invalidateQueries({queryKey:m.projects}),n.invalidateQueries({queryKey:m.dashboard,refetchType:document.visibilityState===`hidden`?`none`:`active`}));for(let t of[...Z])t(e,r)});for(let e of se)a.addEventListener(e,t=>{D||i!==a||(O=Date.now(),oe(n,e,t.data))});a.addEventListener(`provider-status`,e=>{if(D||i!==a)return;O=Date.now();let t;try{t=JSON.parse(e.data)}catch{return}let n=d(t);if(n){if(M>0){F.push(n);return}L(n)}}),a.addEventListener(`error`,()=>{D||i!==a||(z.connected(!1),a.readyState===X&&B())})},H=()=>{w=!0,clearTimeout(E),E=setTimeout(()=>{E=void 0,!(D||!w)&&(w=!1,R())},_e)},U,W=()=>{if(U=void 0,D||document.visibilityState!==`hidden`)return;if(ue(n)){J(n)&&(U=setTimeout(W,T));return}clearTimeout(x),x=void 0;let e=i;i=null,z.connected(!1),e?.close()},G=()=>{document.visibilityState===`hidden`&&(U??=setTimeout(W,T))},K=()=>{if(document.visibilityState===`hidden`){G();return}if(clearTimeout(U),U=void 0,!i||i.readyState===X){clearTimeout(x),x=void 0,H(),V();return}R()},q=()=>{clearTimeout(x),x=void 0;let e=i;i=null,z.connected(!1),e?.close()},Y=e=>{e.persisted&&(H(),V(),G())};return k=setInterval(()=>{D||document.visibilityState!==`visible`||Date.now()-O<=4e4||(clearTimeout(x),x=void 0,V())},1e4),document.addEventListener(`visibilitychange`,K),window.addEventListener(`pagehide`,q),window.addEventListener(`pageshow`,Y),V(),G(),()=>{D=!0,clearTimeout(x),clearTimeout(E),clearInterval(k),clearTimeout(U),z.connected(!1),clearTimeout(u),clearTimeout(f),clearTimeout(o),clearTimeout(s),c.clear(),g.cancel(),_.cancel(),v.cancel(),b.cancel(),P.clear(),F=[],document.removeEventListener(`visibilitychange`,K),window.removeEventListener(`pagehide`,q),window.removeEventListener(`pageshow`,Y);let e=i;i=null,z.connected(!1),e?.close()}},[n,e,t])}var $=(0,D.createContext)(null);function je({children:e}){let[t]=(0,D.useState)(g);return Ae(t),i(),(0,Y.jsx)($.Provider,{value:t,children:e})}function Me(e){let t=(0,D.useContext)($),n=t?t.get:Pe;return(0,D.useSyncExternalStore)(t?t.subscribe:Ne,()=>e?n()[e]:void 0,()=>void 0)}var Ne=()=>()=>void 0,Pe=()=>te;function Fe(e,t){if(e.run===null)return e;let{versions:n,...r}=e;return{...r,artifacts:t.artifacts,truncated:t.truncated,...t.versions?{versions:t.versions}:{}}}var Ie=E(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Le=E(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]);function Re({slot:e,label:t,value:n,options:r,onChange:i,full:a=!1,allowRelease:o=!1,className:s}){return(0,Y.jsx)(`div`,{"data-slot":e,"data-full":a?`true`:void 0,role:`group`,"aria-label":t,className:x(`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,a&&`flex w-full`,s),children:r.map(e=>{let t=e.value===n;return(0,Y.jsxs)(`button`,{type:`button`,"data-value":e.value,"aria-pressed":t,onClick:()=>{t&&!o||i(e.value)},className:x(`flex h-7 items-center justify-center gap-1.5 rounded-[7px] px-3 text-ui font-medium whitespace-nowrap text-muted-foreground transition-colors hover:text-foreground`,a&&`flex-1`,t&&`bg-card font-semibold text-foreground shadow-xs`),children:[e.label,e.count===void 0?null:(0,Y.jsx)(`small`,{className:`font-mono text-meta font-normal tabular-nums`,children:e.count})]},e.value)})})}export{L as _,he as a,W as c,B as d,V as f,F as g,le as h,je as i,K as l,z as m,Le as n,Me as o,U as p,Ie as r,q as s,Re as t,H as u,P as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./utils-DWwoYTjU.js";import{t as a}from"./createLucideIcon-BHp8sXmF.js";import{A as o,C as s,D as c,E as l,H as u,I as d,M as f,N as p,O as m,S as h,T as g,a as _,b as v,i as y,k as b,o as x,r as S,s as C,v as w,w as T,x as E,y as ee,z as D}from"./button-CEskWahs.js";import{n as O,r as k,t as A}from"./dist-B_KqW6o6.js";var te=a(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),j=e(n(),1),M=e(t(),1);function N(e){let t=M.useRef({value:e,previous:e});return M.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function P(e,[t,n]){return Math.min(n,Math.max(t,e))}var F=r(),I=[` `,`Enter`,`ArrowUp`,`ArrowDown`],L=[` `,`Enter`],R=`Select`,[z,B,V]=O(R),[H,U]=o(R,[V,C]),W=C(),[ne,G]=H(R),[re,ie]=H(R),ae=`SelectProvider`;function K(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:p,required:m,form:h,internal_do_not_use_render:_}=e,v=W(t),[y,b]=M.useState(null),[S,C]=M.useState(null),[w,T]=M.useState(!1),E=A(u),[ee,D]=c({prop:r,defaultProp:i??!1,onChange:a,caller:R}),[O,k]=c({prop:o,defaultProp:s,onChange:l,caller:R}),te=M.useRef(null),j=M.useRef(O);M.useEffect(()=>{let e=h?y?.ownerDocument.getElementById(h):y?.form;if(e instanceof HTMLFormElement){let t=()=>k(j.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,y,k]);let N=!y||!!h||!!y.closest(`form`),[P,I]=M.useState(new Set),L=g(),B=Array.from(P).map(e=>e.props.value).join(`;`),V=M.useCallback(e=>{I(t=>new Set(t).add(e))},[]),H=M.useCallback(e=>{I(t=>{let n=new Set(t);return n.delete(e),n})},[]),U={required:m,trigger:y,onTriggerChange:b,valueNode:S,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:L,value:O,onValueChange:k,open:ee,onOpenChange:D,dir:E,triggerPointerDownPosRef:te,disabled:p,name:d,autoComplete:f,form:h,nativeOptions:P,nativeSelectKey:B,isFormControl:N};return(0,F.jsx)(x,{...v,children:(0,F.jsx)(ne,{scope:t,...U,children:(0,F.jsx)(z.Provider,{scope:t,children:(0,F.jsx)(re,{scope:t,onNativeOptionAdd:V,onNativeOptionRemove:H,children:$e(_)?_(U):n})})})})}K.displayName=ae;var q=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,F.jsx)(K,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[n,e?(0,F.jsx)(Qe,{__scopeSelect:t}):null]})})};q.displayName=R;var oe=`SelectTrigger`,se=M.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=W(n),o=G(oe,n),s=o.disabled||r,c=D(t,o.onTriggerChange),l=B(n),u=M.useRef(`touch`),[d,f,m]=et(e=>{let t=l().filter(e=>!e.disabled),n=tt(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),h=e=>{s||(o.onOpenChange(!0),m()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,F.jsx)(S,{asChild:!0,...a,children:(0,F.jsx)(p.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":$(o.value)?``:void 0,...i,ref:c,onClick:b(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&h(e)}),onPointerDown:b(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(h(e),e.preventDefault())}),onKeyDown:b(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&I.includes(e.key)&&(h(),e.preventDefault())})})})});se.displayName=oe;var ce=`SelectValue`,le=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=G(ce,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=D(t,c.onValueNodeChange);m(()=>{l(u)},[l,u]);let f=$(c.value);return(0,F.jsx)(p.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,F.jsx)(M.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});le.displayName=ce;var ue=`SelectIcon`,de=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,F.jsx)(p.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});de.displayName=ue;var fe=`SelectPortal`,[pe,me]=H(fe,{forceMount:void 0}),he=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,F.jsx)(pe,{scope:e.__scopeSelect,forceMount:n,children:(0,F.jsx)(E,{asChild:!0,...r})})};he.displayName=fe;var J=`SelectContent`,ge=M.forwardRef((e,t)=>{let n=me(J,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=G(J,e.__scopeSelect),[o,s]=M.useState();return m(()=>{s(new DocumentFragment)},[]),(0,F.jsx)(l,{present:r||a.open,children:({present:e})=>e?(0,F.jsx)(xe,{...i,ref:t}):(0,F.jsx)(_e,{...i,fragment:o})})});ge.displayName=J;var _e=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?j.createPortal((0,F.jsx)(ve,{scope:n,children:(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(`div`,{ref:t,children:r})})}),i):null});_e.displayName=`SelectContentFragment`;var Y=10,[ve,X]=H(J),ye=`SelectContentImpl`,be=d(`SelectContent.RemoveScroll`),xe=M.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:g,hideWhenDetached:_,avoidCollisions:y,...x}=e,S=G(J,n),[C,T]=M.useState(null),[E,O]=M.useState(null),k=D(t,T),[A,te]=M.useState(null),[j,N]=M.useState(null),P=B(n),[I,L]=M.useState(!1),R=M.useRef(!1);M.useEffect(()=>{if(C)return w(C)},[C]),v();let z=M.useCallback(e=>{let[t,...n]=P().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&E&&(E.scrollTop=0),n===r&&E&&(E.scrollTop=E.scrollHeight),n?.focus(),document.activeElement!==i))return},[P,E]),V=M.useCallback(()=>z([A,C]),[z,A,C]);M.useEffect(()=>{I&&V()},[I,V]);let{onOpenChange:H,triggerPointerDownPosRef:U}=S;M.useEffect(()=>{if(C){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(U.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(U.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(C)||H(!1),document.removeEventListener(`pointermove`,t),U.current=null};return U.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[C,H,U]),M.useEffect(()=>{let e=()=>H(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[H]);let[W,ne]=et(e=>{let t=P().filter(e=>!e.disabled),n=tt(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=M.useCallback((e,t,n)=>{let r=!R.current&&!n;(S.value!==void 0&&S.value===t||r)&&(te(e),r&&(R.current=!0))},[S.value]),ie=M.useCallback(()=>C?.focus(),[C]),ae=M.useCallback((e,t,n)=>{let r=!R.current&&!n;(S.value!==void 0&&S.value===t||r)&&N(e)},[S.value]),K=r===`popper`?Te:Ce,q=K===Te?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:g,hideWhenDetached:_,avoidCollisions:y}:{};return(0,F.jsx)(ve,{scope:n,content:C,viewport:E,onViewportChange:O,itemRefCallback:re,selectedItem:A,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:V,selectedItemText:j,position:r,isPositioned:I,searchRef:W,children:(0,F.jsx)(ee,{as:be,allowPinchZoom:!0,children:(0,F.jsx)(h,{asChild:!0,trapped:S.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:b(i,e=>{S.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,F.jsx)(s,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>S.onOpenChange(!1),children:(0,F.jsx)(K,{role:`listbox`,id:S.contentId,"data-state":S.open?`open`:`closed`,dir:S.dir,onContextMenu:e=>e.preventDefault(),...x,...q,onPlaced:()=>L(!0),ref:k,style:{display:`flex`,flexDirection:`column`,outline:`none`,...x.style},onKeyDown:b(x.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=P().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>z(t)),e.preventDefault()}})})})})})})});xe.displayName=ye;var Se=`SelectItemAlignedPosition`,Ce=M.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=G(J,n),o=X(J,n),[s,c]=M.useState(null),[l,u]=M.useState(null),d=D(t,u),f=B(n),h=M.useRef(!1),g=M.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=o,x=M.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&_&&v&&y){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Y*2,u=_.scrollHeight,d=window.getComputedStyle(l),p=parseInt(d.borderTopWidth,10),m=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=p+m+u+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Y,ee=c-E,D=v.offsetHeight/2,O=v.offsetTop+D,k=p+m+O,A=x-k;if(k<=E){let e=o.length>0&&v===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-_.offsetTop-_.offsetHeight,n=k+Math.max(ee,D+(e?T:0)+t+g);s.style.height=n+`px`}else{let e=o.length>0&&v===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,p+_.offsetTop+(e?w:0)+D)+A;s.style.height=t+`px`,_.scrollTop=k-E+_.offsetTop}s.style.margin=`${Y}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>h.current=!0)}},[f,a.trigger,a.valueNode,s,l,_,v,y,a.dir,r]);m(()=>x(),[x]);let[S,C]=M.useState();return m(()=>{l&&C(window.getComputedStyle(l).zIndex)},[l]),(0,F.jsx)(Ee,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:h,onScrollButtonChange:M.useCallback(e=>{e&&g.current===!0&&(x(),b?.(),g.current=!1)},[x,b]),children:(0,F.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,F.jsx)(p.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Ce.displayName=Se;var we=`SelectPopperPosition`,Te=M.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=W(n);return(0,F.jsx)(_,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Te.displayName=we;var[Ee,De]=H(J,{}),Oe=`SelectViewport`,ke=M.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=X(Oe,n),o=De(Oe,n),s=D(t,a.onViewportChange),c=M.useRef(0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(p.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:b(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Y*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});ke.displayName=Oe;var Ae=`SelectGroup`,[je,Me]=H(Ae),Ne=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=g();return(0,F.jsx)(je,{scope:n,id:i,children:(0,F.jsx)(p.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Ne.displayName=Ae;var Pe=`SelectLabel`,Fe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Me(Pe,n);return(0,F.jsx)(p.div,{id:i.id,...r,ref:t})});Fe.displayName=Pe;var Z=`SelectItem`,[Ie,Le]=H(Z),Re=M.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=G(Z,n),c=X(Z,n),l=s.value===r,[u,d]=M.useState(a??``),[f,m]=M.useState(!1),h=D(t,T(e=>c.itemRefCallback?.(e,r,i))),_=g(),v=M.useRef(`touch`),y=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,F.jsx)(Ie,{scope:n,value:r,disabled:i,textId:_,isSelected:l,onItemTextChange:M.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,F.jsx)(z.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,F.jsx)(p.div,{role:`option`,"aria-labelledby":_,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:h,onFocus:b(o.onFocus,()=>m(!0)),onBlur:b(o.onBlur,()=>m(!1)),onClick:b(o.onClick,()=>{v.current!==`mouse`&&y()}),onPointerUp:b(o.onPointerUp,()=>{v.current===`mouse`&&y()}),onPointerDown:b(o.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:b(o.onPointerMove,e=>{v.current=e.pointerType,i?c.onItemLeave?.():v.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:b(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:b(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(L.includes(e.key)&&y(),e.key===` `&&e.preventDefault())})})})})});Re.displayName=Z;var Q=`SelectItemText`,ze=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=G(Q,n),s=X(Q,n),c=Le(Q,n),l=ie(Q,n),[u,d]=M.useState(null),f=T(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),h=D(t,d,c.onItemTextChange,f),g=u?.textContent,_=M.useMemo(()=>(0,F.jsx)(`option`,{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=l;return m(()=>(v(_),()=>y(_)),[v,y,_]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(p.span,{id:c.textId,...a,ref:h}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!$(o.value)?j.createPortal(a.children,o.valueNode):null]})});ze.displayName=Q;var Be=`SelectItemIndicator`,Ve=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Le(Be,n).isSelected?(0,F.jsx)(p.span,{"aria-hidden":!0,...r,ref:t}):null});Ve.displayName=Be;var He=`SelectScrollUpButton`,Ue=M.forwardRef((e,t)=>{let n=X(He,e.__scopeSelect),r=De(He,e.__scopeSelect),[i,a]=M.useState(!1),o=D(t,r.onScrollButtonChange);return m(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ke,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Ue.displayName=He;var We=`SelectScrollDownButton`,Ge=M.forwardRef((e,t)=>{let n=X(We,e.__scopeSelect),r=De(We,e.__scopeSelect),[i,a]=M.useState(!1),o=D(t,r.onScrollButtonChange);return m(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ke,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Ge.displayName=We;var Ke=M.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=X(`SelectScrollButton`,n),o=M.useRef(null),s=B(n),c=M.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return M.useEffect(()=>()=>c(),[c]),m(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,F.jsx)(p.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:b(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:b(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:b(i.onPointerLeave,()=>{c()})})}),qe=`SelectSeparator`,Je=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,F.jsx)(p.div,{"aria-hidden":!0,...r,ref:t})});Je.displayName=qe;var Ye=`SelectArrow`,Xe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=W(n);return X(Ye,n).position===`popper`?(0,F.jsx)(y,{...i,...r,ref:t}):null});Xe.displayName=Ye;var Ze=`SelectBubbleInput`,Qe=M.forwardRef(({__scopeSelect:e,...t},n)=>{let r=G(Ze,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:m}=r,h=M.useRef(null),g=D(n,h),_=i??``,v=N(_),y=Array.from(d).some(e=>(e.props.value??``)===``);return M.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,F.jsxs)(p.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...f,...t.style},ref:g,defaultValue:_,children:[$(i)&&!y?(0,F.jsx)(`option`,{value:``}):null,Array.from(d)]},m)});Qe.displayName=Ze;function $e(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function et(e){let t=T(e),n=M.useRef(``),r=M.useRef(0),i=M.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=M.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function tt(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=nt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function nt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function rt({...e}){return(0,F.jsx)(q,{"data-slot":`select`,...e})}function it({...e}){return(0,F.jsx)(Ne,{"data-slot":`select-group`,...e})}function at({...e}){return(0,F.jsx)(le,{"data-slot":`select-value`,...e})}function ot({className:e,size:t=`default`,children:n,...r}){return(0,F.jsxs)(se,{"data-slot":`select-trigger`,"data-size":t,className:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-card px-3 py-1 text-ui whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-7 data-[size=sm]:rounded-sm data-[size=sm]:px-2.5 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,F.jsx)(de,{asChild:!0,children:(0,F.jsx)(k,{"data-slot":`select-chevron`,className:`size-3 text-soft-foreground`})})]})}function st({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,F.jsx)(he,{children:(0,F.jsxs)(ge,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,F.jsx)(ut,{}),(0,F.jsx)(ke,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,F.jsx)(dt,{})]})})}function ct({className:e,...t}){return(0,F.jsx)(Fe,{"data-slot":`select-label`,className:i(`px-2 py-1.5 text-label text-muted-foreground`,e),...t})}function lt({className:e,children:t,...n}){return(0,F.jsxs)(Re,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-ui outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,F.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,F.jsx)(Ve,{children:(0,F.jsx)(u,{className:`size-4`})})}),(0,F.jsx)(ze,{children:t})]})}function ut({className:e,...t}){return(0,F.jsx)(Ue,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-pointer items-center justify-center py-1`,e),...t,children:(0,F.jsx)(te,{className:`size-4`})})}function dt({className:e,...t}){return(0,F.jsx)(Ge,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-pointer items-center justify-center py-1`,e),...t,children:(0,F.jsx)(k,{className:`size-4`})})}export{ct as a,N as c,lt as i,st as n,ot as o,it as r,at as s,rt as t};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./utils-Dp6vCdiU.js";import{t as a}from"./createLucideIcon-BHp8sXmF.js";import{A as o,C as s,D as c,E as l,H as u,I as d,M as f,N as p,O as m,S as h,T as g,a as _,b as v,i as y,k as b,o as x,r as S,s as C,v as w,w as T,x as E,y as ee,z as D}from"./button-CJXK1JqU.js";import{n as O,r as k,t as A}from"./dist-Bsi6zLdE.js";var te=a(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),j=e(n(),1),M=e(t(),1);function N(e){let t=M.useRef({value:e,previous:e});return M.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function P(e,[t,n]){return Math.min(n,Math.max(t,e))}var F=r(),I=[` `,`Enter`,`ArrowUp`,`ArrowDown`],L=[` `,`Enter`],R=`Select`,[z,B,V]=O(R),[H,U]=o(R,[V,C]),W=C(),[ne,G]=H(R),[re,ie]=H(R),ae=`SelectProvider`;function K(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:p,required:m,form:h,internal_do_not_use_render:_}=e,v=W(t),[y,b]=M.useState(null),[S,C]=M.useState(null),[w,T]=M.useState(!1),E=A(u),[ee,D]=c({prop:r,defaultProp:i??!1,onChange:a,caller:R}),[O,k]=c({prop:o,defaultProp:s,onChange:l,caller:R}),te=M.useRef(null),j=M.useRef(O);M.useEffect(()=>{let e=h?y?.ownerDocument.getElementById(h):y?.form;if(e instanceof HTMLFormElement){let t=()=>k(j.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,y,k]);let N=!y||!!h||!!y.closest(`form`),[P,I]=M.useState(new Set),L=g(),B=Array.from(P).map(e=>e.props.value).join(`;`),V=M.useCallback(e=>{I(t=>new Set(t).add(e))},[]),H=M.useCallback(e=>{I(t=>{let n=new Set(t);return n.delete(e),n})},[]),U={required:m,trigger:y,onTriggerChange:b,valueNode:S,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:L,value:O,onValueChange:k,open:ee,onOpenChange:D,dir:E,triggerPointerDownPosRef:te,disabled:p,name:d,autoComplete:f,form:h,nativeOptions:P,nativeSelectKey:B,isFormControl:N};return(0,F.jsx)(x,{...v,children:(0,F.jsx)(ne,{scope:t,...U,children:(0,F.jsx)(z.Provider,{scope:t,children:(0,F.jsx)(re,{scope:t,onNativeOptionAdd:V,onNativeOptionRemove:H,children:$e(_)?_(U):n})})})})}K.displayName=ae;var q=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,F.jsx)(K,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[n,e?(0,F.jsx)(Qe,{__scopeSelect:t}):null]})})};q.displayName=R;var oe=`SelectTrigger`,se=M.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=W(n),o=G(oe,n),s=o.disabled||r,c=D(t,o.onTriggerChange),l=B(n),u=M.useRef(`touch`),[d,f,m]=et(e=>{let t=l().filter(e=>!e.disabled),n=tt(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),h=e=>{s||(o.onOpenChange(!0),m()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,F.jsx)(S,{asChild:!0,...a,children:(0,F.jsx)(p.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":$(o.value)?``:void 0,...i,ref:c,onClick:b(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&h(e)}),onPointerDown:b(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(h(e),e.preventDefault())}),onKeyDown:b(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&I.includes(e.key)&&(h(),e.preventDefault())})})})});se.displayName=oe;var ce=`SelectValue`,le=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=G(ce,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=D(t,c.onValueNodeChange);m(()=>{l(u)},[l,u]);let f=$(c.value);return(0,F.jsx)(p.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,F.jsx)(M.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});le.displayName=ce;var ue=`SelectIcon`,de=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,F.jsx)(p.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});de.displayName=ue;var fe=`SelectPortal`,[pe,me]=H(fe,{forceMount:void 0}),he=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,F.jsx)(pe,{scope:e.__scopeSelect,forceMount:n,children:(0,F.jsx)(E,{asChild:!0,...r})})};he.displayName=fe;var J=`SelectContent`,ge=M.forwardRef((e,t)=>{let n=me(J,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=G(J,e.__scopeSelect),[o,s]=M.useState();return m(()=>{s(new DocumentFragment)},[]),(0,F.jsx)(l,{present:r||a.open,children:({present:e})=>e?(0,F.jsx)(xe,{...i,ref:t}):(0,F.jsx)(_e,{...i,fragment:o})})});ge.displayName=J;var _e=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?j.createPortal((0,F.jsx)(ve,{scope:n,children:(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(`div`,{ref:t,children:r})})}),i):null});_e.displayName=`SelectContentFragment`;var Y=10,[ve,X]=H(J),ye=`SelectContentImpl`,be=d(`SelectContent.RemoveScroll`),xe=M.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:g,hideWhenDetached:_,avoidCollisions:y,...x}=e,S=G(J,n),[C,T]=M.useState(null),[E,O]=M.useState(null),k=D(t,T),[A,te]=M.useState(null),[j,N]=M.useState(null),P=B(n),[I,L]=M.useState(!1),R=M.useRef(!1);M.useEffect(()=>{if(C)return w(C)},[C]),v();let z=M.useCallback(e=>{let[t,...n]=P().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&E&&(E.scrollTop=0),n===r&&E&&(E.scrollTop=E.scrollHeight),n?.focus(),document.activeElement!==i))return},[P,E]),V=M.useCallback(()=>z([A,C]),[z,A,C]);M.useEffect(()=>{I&&V()},[I,V]);let{onOpenChange:H,triggerPointerDownPosRef:U}=S;M.useEffect(()=>{if(C){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(U.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(U.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(C)||H(!1),document.removeEventListener(`pointermove`,t),U.current=null};return U.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[C,H,U]),M.useEffect(()=>{let e=()=>H(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[H]);let[W,ne]=et(e=>{let t=P().filter(e=>!e.disabled),n=tt(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=M.useCallback((e,t,n)=>{let r=!R.current&&!n;(S.value!==void 0&&S.value===t||r)&&(te(e),r&&(R.current=!0))},[S.value]),ie=M.useCallback(()=>C?.focus(),[C]),ae=M.useCallback((e,t,n)=>{let r=!R.current&&!n;(S.value!==void 0&&S.value===t||r)&&N(e)},[S.value]),K=r===`popper`?Te:Ce,q=K===Te?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:g,hideWhenDetached:_,avoidCollisions:y}:{};return(0,F.jsx)(ve,{scope:n,content:C,viewport:E,onViewportChange:O,itemRefCallback:re,selectedItem:A,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:V,selectedItemText:j,position:r,isPositioned:I,searchRef:W,children:(0,F.jsx)(ee,{as:be,allowPinchZoom:!0,children:(0,F.jsx)(h,{asChild:!0,trapped:S.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:b(i,e=>{S.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,F.jsx)(s,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>S.onOpenChange(!1),children:(0,F.jsx)(K,{role:`listbox`,id:S.contentId,"data-state":S.open?`open`:`closed`,dir:S.dir,onContextMenu:e=>e.preventDefault(),...x,...q,onPlaced:()=>L(!0),ref:k,style:{display:`flex`,flexDirection:`column`,outline:`none`,...x.style},onKeyDown:b(x.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=P().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>z(t)),e.preventDefault()}})})})})})})});xe.displayName=ye;var Se=`SelectItemAlignedPosition`,Ce=M.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=G(J,n),o=X(J,n),[s,c]=M.useState(null),[l,u]=M.useState(null),d=D(t,u),f=B(n),h=M.useRef(!1),g=M.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=o,x=M.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&_&&v&&y){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Y*2,u=_.scrollHeight,d=window.getComputedStyle(l),p=parseInt(d.borderTopWidth,10),m=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=p+m+u+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Y,ee=c-E,D=v.offsetHeight/2,O=v.offsetTop+D,k=p+m+O,A=x-k;if(k<=E){let e=o.length>0&&v===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-_.offsetTop-_.offsetHeight,n=k+Math.max(ee,D+(e?T:0)+t+g);s.style.height=n+`px`}else{let e=o.length>0&&v===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,p+_.offsetTop+(e?w:0)+D)+A;s.style.height=t+`px`,_.scrollTop=k-E+_.offsetTop}s.style.margin=`${Y}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>h.current=!0)}},[f,a.trigger,a.valueNode,s,l,_,v,y,a.dir,r]);m(()=>x(),[x]);let[S,C]=M.useState();return m(()=>{l&&C(window.getComputedStyle(l).zIndex)},[l]),(0,F.jsx)(Ee,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:h,onScrollButtonChange:M.useCallback(e=>{e&&g.current===!0&&(x(),b?.(),g.current=!1)},[x,b]),children:(0,F.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,F.jsx)(p.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Ce.displayName=Se;var we=`SelectPopperPosition`,Te=M.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=W(n);return(0,F.jsx)(_,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Te.displayName=we;var[Ee,De]=H(J,{}),Oe=`SelectViewport`,ke=M.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=X(Oe,n),o=De(Oe,n),s=D(t,a.onViewportChange),c=M.useRef(0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(p.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:b(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Y*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});ke.displayName=Oe;var Ae=`SelectGroup`,[je,Me]=H(Ae),Ne=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=g();return(0,F.jsx)(je,{scope:n,id:i,children:(0,F.jsx)(p.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Ne.displayName=Ae;var Pe=`SelectLabel`,Fe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Me(Pe,n);return(0,F.jsx)(p.div,{id:i.id,...r,ref:t})});Fe.displayName=Pe;var Z=`SelectItem`,[Ie,Le]=H(Z),Re=M.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=G(Z,n),c=X(Z,n),l=s.value===r,[u,d]=M.useState(a??``),[f,m]=M.useState(!1),h=D(t,T(e=>c.itemRefCallback?.(e,r,i))),_=g(),v=M.useRef(`touch`),y=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,F.jsx)(Ie,{scope:n,value:r,disabled:i,textId:_,isSelected:l,onItemTextChange:M.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,F.jsx)(z.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,F.jsx)(p.div,{role:`option`,"aria-labelledby":_,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:h,onFocus:b(o.onFocus,()=>m(!0)),onBlur:b(o.onBlur,()=>m(!1)),onClick:b(o.onClick,()=>{v.current!==`mouse`&&y()}),onPointerUp:b(o.onPointerUp,()=>{v.current===`mouse`&&y()}),onPointerDown:b(o.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:b(o.onPointerMove,e=>{v.current=e.pointerType,i?c.onItemLeave?.():v.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:b(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:b(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(L.includes(e.key)&&y(),e.key===` `&&e.preventDefault())})})})})});Re.displayName=Z;var Q=`SelectItemText`,ze=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=G(Q,n),s=X(Q,n),c=Le(Q,n),l=ie(Q,n),[u,d]=M.useState(null),f=T(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),h=D(t,d,c.onItemTextChange,f),g=u?.textContent,_=M.useMemo(()=>(0,F.jsx)(`option`,{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=l;return m(()=>(v(_),()=>y(_)),[v,y,_]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(p.span,{id:c.textId,...a,ref:h}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!$(o.value)?j.createPortal(a.children,o.valueNode):null]})});ze.displayName=Q;var Be=`SelectItemIndicator`,Ve=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Le(Be,n).isSelected?(0,F.jsx)(p.span,{"aria-hidden":!0,...r,ref:t}):null});Ve.displayName=Be;var He=`SelectScrollUpButton`,Ue=M.forwardRef((e,t)=>{let n=X(He,e.__scopeSelect),r=De(He,e.__scopeSelect),[i,a]=M.useState(!1),o=D(t,r.onScrollButtonChange);return m(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ke,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Ue.displayName=He;var We=`SelectScrollDownButton`,Ge=M.forwardRef((e,t)=>{let n=X(We,e.__scopeSelect),r=De(We,e.__scopeSelect),[i,a]=M.useState(!1),o=D(t,r.onScrollButtonChange);return m(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ke,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Ge.displayName=We;var Ke=M.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=X(`SelectScrollButton`,n),o=M.useRef(null),s=B(n),c=M.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return M.useEffect(()=>()=>c(),[c]),m(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,F.jsx)(p.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:b(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:b(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:b(i.onPointerLeave,()=>{c()})})}),qe=`SelectSeparator`,Je=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,F.jsx)(p.div,{"aria-hidden":!0,...r,ref:t})});Je.displayName=qe;var Ye=`SelectArrow`,Xe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=W(n);return X(Ye,n).position===`popper`?(0,F.jsx)(y,{...i,...r,ref:t}):null});Xe.displayName=Ye;var Ze=`SelectBubbleInput`,Qe=M.forwardRef(({__scopeSelect:e,...t},n)=>{let r=G(Ze,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:m}=r,h=M.useRef(null),g=D(n,h),_=i??``,v=N(_),y=Array.from(d).some(e=>(e.props.value??``)===``);return M.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,F.jsxs)(p.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...f,...t.style},ref:g,defaultValue:_,children:[$(i)&&!y?(0,F.jsx)(`option`,{value:``}):null,Array.from(d)]},m)});Qe.displayName=Ze;function $e(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function et(e){let t=T(e),n=M.useRef(``),r=M.useRef(0),i=M.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=M.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function tt(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=nt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function nt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function rt({...e}){return(0,F.jsx)(q,{"data-slot":`select`,...e})}function it({...e}){return(0,F.jsx)(Ne,{"data-slot":`select-group`,...e})}function at({...e}){return(0,F.jsx)(le,{"data-slot":`select-value`,...e})}function ot({className:e,size:t=`default`,children:n,...r}){return(0,F.jsxs)(se,{"data-slot":`select-trigger`,"data-size":t,className:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-card px-3 py-1 text-ui whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-7 data-[size=sm]:rounded-sm data-[size=sm]:px-2.5 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,F.jsx)(de,{asChild:!0,children:(0,F.jsx)(k,{"data-slot":`select-chevron`,className:`size-3 text-soft-foreground`})})]})}function st({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,F.jsx)(he,{children:(0,F.jsxs)(ge,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,F.jsx)(ut,{}),(0,F.jsx)(ke,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,F.jsx)(dt,{})]})})}function ct({className:e,...t}){return(0,F.jsx)(Fe,{"data-slot":`select-label`,className:i(`px-2 py-1.5 text-label text-muted-foreground`,e),...t})}function lt({className:e,children:t,...n}){return(0,F.jsxs)(Re,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-ui outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,F.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,F.jsx)(Ve,{children:(0,F.jsx)(u,{className:`size-4`})})}),(0,F.jsx)(ze,{children:t})]})}function ut({className:e,...t}){return(0,F.jsx)(Ue,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-pointer items-center justify-center py-1`,e),...t,children:(0,F.jsx)(te,{className:`size-4`})})}function dt({className:e,...t}){return(0,F.jsx)(Ge,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-pointer items-center justify-center py-1`,e),...t,children:(0,F.jsx)(k,{className:`size-4`})})}export{ct as a,N as c,lt as i,st as n,ot as o,it as r,at as s,rt 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{Bt as r,a as i,s as a,t as o}from"./utils-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Bt as r,a as i,s as a,t as o}from"./utils-Dp6vCdiU.js";import{d as s,f as c,g as l,h as u,l as d,m as f,p,u as m}from"./button-CJXK1JqU.js";import{t as h}from"./x-BqECUykl.js";var g=e(t(),1),_=[`run-event`,`ui-event`],v=1e3,y=6e4,b=1e4;function x(e,t){if(e.add(t),e.size<=b)return;let n=e.values().next().value;typeof n==`number`&&e.delete(n)}function S(e,t){return typeof e==`string`?`${e}:${t}`:t}function C(e){let t=e.type===`item.delta`?e.itemId:typeof e.item==`object`&&e.item!==null&&!Array.isArray(e.item)?e.item.id:void 0;return typeof t==`string`&&t!==``?S(e.stepId,t):void 0}function w(e){let t=[],n=new Map;for(let r of e){let e=C(r);if(e!==void 0&&r.type!==`item.delta`)for(let t of[`text`,`reasoning`,`output`])n.delete(`${e}:${t}`);if(r.type===`item.delta`&&e!==void 0&&(r.field===`text`||r.field===`reasoning`||r.field===`output`)&&typeof r.delta==`string`){let i=`${e}:${r.field}`,a=n.get(i);if(a!==void 0){let e=t[a],o={...e,seq:r.seq,ts:r.ts,delta:`${e.delta}${r.delta}`};if(a===t.length-1)t[a]=o;else{t.splice(a,1);for(let[e,t]of n)t>a&&n.set(e,t-1);n.set(i,t.length),t.push(o)}continue}n.set(i,t.length)}t.push(r)}return t}function T(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let{id:n,steps:r}=t;return typeof n==`string`&&n!==``&&Array.isArray(r)?t:null}var E=3e4;function D(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let{seq:n,type:r}=t;return typeof n!=`number`||typeof r!=`string`||r===``?null:t}function O(e,t={}){let[n,o]=(0,g.useState)([]),s=a(),c=(0,g.useRef)(t);c.current=t;let l=(0,g.useRef)(0),u=(0,g.useRef)(0),d=(0,g.useRef)(0),f=(0,g.useRef)(!1),p=(0,g.useRef)(new Set),m=(0,g.useRef)(void 0);(0,g.useEffect)(()=>{let{afterSeq:t=0}=c.current;if(l.current=0,u.current=t,d.current=t,f.current=!1,p.current.clear(),o([]),!e)return;let n=globalThis.EventSource;if(typeof n!=`function`)return;let a=null,s=0,h,g=!1,b=0,S=0,C=0,O=[],k,A,j=Date.now(),M,N=()=>{b=Math.min(b+1,6),S=Date.now()+Math.min(y,v*2**(b-1))},P=e=>{let t=c.current;if(t.onCompact===void 0||(t.compactAt===void 0||C<t.compactAt)&&(t.compactWhenOver===void 0||e.length<=t.compactWhenOver)||Date.now()<S)return;let n=C;Promise.resolve().then(()=>{if(!g)return c.current.onCompact?.(e)}).then(e=>{if(g)return;if(!Array.isArray(e)||e.length===0){N();return}b=0,S=0,C=Math.max(0,C-n);let t=new Set(e);t.size!==0&&o(e=>e.filter(({seq:e})=>!t.has(e)))},()=>{g||N()})},F=()=>{if(A=void 0,k!==void 0){let e=k;k=void 0,g||c.current.onRun?.(e)}if(O.length===0)return;let e=O;O=[],o(t=>{let n=c.current;return n.compactAt!==void 0||n.onCompact!==void 0?w([...t,...e]):[...t,...e]})},I=()=>{A===void 0&&(A=setTimeout(F,50))},L=()=>{s+=1;let e=a;e&&(e.close(),a=null)},R=(e,t)=>{if(g||t!==s)return;j=Date.now();let n=D(e.data);!n||p.current.has(n.seq)||n.seq<=l.current&&(!f.current||n.seq<=d.current)||(x(p.current,n.seq),l.current=Math.max(l.current,n.seq),C+=1,O.push(n),I())},z=e=>{g||e!==s||(j=Date.now())},B=()=>{g||h!==void 0||(h=setTimeout(()=>{h=void 0,g||V()},1500))},V=()=>{L();let t=s,{cursor:o,afterSeq:d=0}=c.current;j=Date.now(),u.current=Math.max(u.current,d);let f=new URLSearchParams;o!==void 0&&f.set(`cursor`,o);let p=Math.max(u.current,l.current);(o!==void 0||p>0)&&f.set(`afterSeq`,String(p));let m=f.size>0?`?${f.toString()}`:``,h=new n(i(`/runs/${encodeURIComponent(e)}/events${m}`),{withCredentials:!0});a=h;let v=e=>R(e,t);for(let e of _)h.addEventListener(e,v);h.addEventListener(`ping`,()=>z(t)),h.addEventListener(`run`,e=>{if(g||t!==s)return;j=Date.now();let n=T(e.data);n&&(k=n,I())}),h.addEventListener(`history-truncated`,e=>{if(g||t!==s)return;j=Date.now();let n;try{n=JSON.parse(e.data)}catch{return}let i=r.safeParse(n);i.success&&c.current.onTruncated?.(i.data)}),h.addEventListener(`error`,()=>{g||t!==s||h.readyState===2&&B()})},H,U=()=>{document.visibilityState===`hidden`&&(H??=setTimeout(()=>{H=void 0,!(g||document.visibilityState!==`hidden`)&&(clearTimeout(h),h=void 0,L())},E))},W=()=>{if(document.visibilityState===`hidden`){U();return}clearTimeout(H),H=void 0,(!a||a.readyState===2)&&(clearTimeout(h),h=void 0,V())},G=()=>{clearTimeout(h),h=void 0,L()},K=e=>{e.persisted&&(V(),U())};return M=setInterval(()=>{g||document.visibilityState!==`visible`||Date.now()-j<=4e4||(clearTimeout(h),h=void 0,V())},1e4),document.addEventListener(`visibilitychange`,W),window.addEventListener(`pagehide`,G),window.addEventListener(`pageshow`,K),m.current=P,V(),U(),()=>{g=!0,clearTimeout(h),clearTimeout(A),A=void 0,O=[],k=void 0,clearInterval(M),clearTimeout(H),document.removeEventListener(`visibilitychange`,W),window.removeEventListener(`pagehide`,G),window.removeEventListener(`pageshow`,K),m.current===P&&(m.current=void 0),L()}},[e,s]),(0,g.useEffect)(()=>{n.length!==0&&m.current?.(n)},[n]);let h=t.afterSeq??0;return(0,g.useEffect)(()=>{e&&(h>u.current&&(f.current=!0),u.current=Math.max(u.current,h))},[h,e]),n}var k=n();function A({...e}){return(0,k.jsx)(d,{"data-slot":`sheet`,...e})}function j({...e}){return(0,k.jsx)(l,{"data-slot":`sheet-trigger`,...e})}function M({...e}){return(0,k.jsx)(m,{"data-slot":`sheet-close`,...e})}function N({...e}){return(0,k.jsx)(f,{"data-slot":`sheet-portal`,...e})}function P({className:e,...t}){return(0,k.jsx)(p,{"data-slot":`sheet-overlay`,className:o(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function F({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,k.jsxs)(N,{children:[(0,k.jsx)(P,{}),(0,k.jsxs)(s,{"data-slot":`sheet-content`,className:o(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,r&&`[&_[data-slot=sheet-header]]:pr-16`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...i,children:[t,r&&(0,k.jsxs)(m,{className:`absolute top-4 right-4 grid size-11 place-items-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,k.jsx)(h,{className:`size-4`}),(0,k.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function I({className:e,...t}){return(0,k.jsx)(`div`,{"data-slot":`sheet-header`,className:o(`flex flex-col gap-1.5 p-4`,e),...t})}function L({className:e,...t}){return(0,k.jsx)(u,{"data-slot":`sheet-title`,className:o(`font-semibold text-foreground`,e),...t})}function R({className:e,...t}){return(0,k.jsx)(c,{"data-slot":`sheet-description`,className:o(`text-sm text-muted-foreground`,e),...t})}export{I as a,E as c,O as d,R as i,C as l,M as n,L as o,F as r,j as s,A as t,S as u};
|