@p4code/cli 0.6.33 → 0.6.35

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.
@@ -1,98 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{$a as i,$r as a,Hr as o,Ia as s,Ot as c,Qa as l,Sl as u,Ua as d,Wa as ee,Wl as te,Xa as f,Ya as p,Za as m,Zu as h,_t as g,b as ne,bl as _,bt as v,h as y,lt as b,pu as x,qr as re,su as S,vt as C,vu as ie,wn as w,wu as ae,xl as oe,yl as T,yn as E,za as se}from"./previewAssetResource-DnRvGKTL.js";import{a as D,c as ce,i as O,n as k,o as A,r as j,s as le,t as M}from"./toggle-group-zEelaZr5.js";import{F as N,Lr as ue,M as de,N as fe,P as pe,Q as me,Rr as he,Sr as ge,Ur as _e,Vr as ve,Wr as ye,Z as be,ar as xe,b as Se,cr as Ce,dr as we,dt as Te,fi as Ee,fr as De,ft as Oe,gr as ke,ht as P,lr as Ae,lt as je,mr as Me,mt as Ne,or as Pe,pi as Fe,pt as Ie,sr as Le,ur as Re,ut as ze,v as Be,zr as Ve}from"./index-BZY4XTKM.js";import{a as He,n as Ue}from"./fileCommentAnnotations-C54rjFmJ.js";var We=u(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),F=e(n(),1);function Ge({threadRef:e,filePath:t,activeCwd:n,openInEditor:r,openFileSurface:i}){if(e){if(i){i(t);return}b.getState().openFile(e,t);return}r(n?y(t,n):t)}var I=r();function Ke(e,t){let n=(0,I.c)(4),r=Me(e,t),i;return n[0]!==r.data||n[1]!==r.error||n[2]!==r.isPending?(i={data:r.data,error:r.error,isPending:r.isPending},n[0]=r.data,n[1]=r.error,n[2]=r.isPending,n[3]=i):i=n[3],i}var L=t(),qe=[];function Je(e){return(e.endSide??e.side)===`deletions`?`deletions`:`additions`}function R(e,t,n){let r=Je(t),i=e.findIndex(e=>e.side===r&&e.lineNumber===t.end);return i<0?[...e,{side:r,lineNumber:t.end,metadata:{entries:[n]}}]:e.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,n]}}:e)}function Ye(e){let t=(0,I.c)(50),{files:n,sectionId:r,sectionTitle:i,composerDraftTarget:s,options:c,viewerRef:l,className:u,renderHeaderPrefix:d}=e,ee=o(Qe),te=o(B),f;t[0]===s?f=t[1]:(f=e=>e.getComposerDraft(s)?.reviewComments??qe,t[0]=s,t[1]=f);let p=o(f),[m,h]=(0,F.useState)(null),[g,ne]=(0,F.useState)(null),_;t[2]===n?_=t[3]:(_=new Map(n.map(Ze)),t[2]=n,t[3]=_);let v=_,y;if(t[4]!==g||t[5]!==n||t[6]!==p||t[7]!==r){let e;t[9]!==g||t[10]!==p||t[11]!==r?(e=e=>{let{fileDiff:t,filePath:n,fileKey:i,collapsed:o}=e,s=p.filter(e=>e.sectionId===r&&e.filePath===n&&(e.fenceLanguage??`diff`)===`diff`).reduce((e,n)=>{let r=a(t,n);return r?R(e,r,{id:n.id,kind:`comment`,range:r,rangeLabel:n.rangeLabel,text:n.text}):e},[]),c=g?.fileKey===i?[...s,g.annotation]:s;return{id:i,type:`diff`,fileDiff:t,annotations:c,collapsed:o,version:ze(`${o?`1`:`0`}:${c.flatMap(z).join(`:`)}`)}},t[9]=g,t[10]=p,t[11]=r,t[12]=e):e=t[12],y=n.map(e),t[4]=g,t[5]=n,t[6]=p,t[7]=r,t[8]=y}else y=t[8];let b=y,x;t[13]!==s||t[14]!==g?.annotation||t[15]!==te?(x=e=>{h(null),g?.annotation.metadata.entries.some(t=>t.id===e)?ne(null):te(s,e)},t[13]=s,t[14]=g?.annotation,t[15]=te,t[16]=x):x=t[16];let S=x,C;t[17]!==ee||t[18]!==s||t[19]!==g||t[20]!==v||t[21]!==r||t[22]!==i?(C=(e,t)=>{let n=g?.annotation.metadata.entries.find(t=>t.id===e),a=g?v.get(g.fileKey):void 0;if(!n||!a)return;let o=re({id:n.id,sectionId:r,sectionTitle:i,filePath:a.filePath,fileDiff:a.fileDiff,range:n.range,text:t});o&&ee(s,o),h(null),ne(null)},t[17]=ee,t[18]=s,t[19]=g,t[20]=v,t[21]=r,t[22]=i,t[23]=C):C=t[23];let ie=C,w;t[24]!==v||t[25]!==r||t[26]!==i?(w=(e,t)=>{if(!e)return;let n=t.item;if(n.type!==`diff`)return;let a=v.get(n.id);if(!a)return;let o=Ue(),s=re({id:o,sectionId:r,sectionTitle:i,filePath:a.filePath,fileDiff:a.fileDiff,range:e,text:``});s&&ne({fileKey:n.id,annotation:{side:Je(e),lineNumber:e.end,metadata:{entries:[{id:o,kind:`draft`,range:e,rangeLabel:s.rangeLabel,text:``}]}}})},t[24]=v,t[25]=r,t[26]=i,t[27]=w):w=t[27];let ae=w,oe=g!==null,T;t[28]===l?T=t[29]:(T=l?{ref:l}:{},t[28]=l,t[29]=T);let E;t[30]===u?E=t[31]:(E=u?{className:u}:{},t[30]=u,t[31]=E);let se=!oe,ce=!oe,O;t[32]!==ae||t[33]!==c||t[34]!==ce||t[35]!==se?(O={...c,enableGutterUtility:se,enableLineSelection:ce,onLineSelectionEnd:ae},t[32]=ae,t[33]=c,t[34]=ce,t[35]=se,t[36]=O):O=t[36];let k;t[37]===d?k=t[38]:(k=e=>e.type===`diff`?d(e.fileDiff,e.id,e.collapsed===!0):null,t[37]=d,t[38]=k);let A;t[39]!==S||t[40]!==ie?(A=e=>(0,L.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,L.jsx)(He,{kind:e.kind,rangeLabel:e.rangeLabel,text:e.text,onCancel:()=>S(e.id),onComment:t=>ie(e.id,t),onDelete:()=>S(e.id)},e.id))}),t[39]=S,t[40]=ie,t[41]=A):A=t[41];let j;return t[42]!==b||t[43]!==m||t[44]!==O||t[45]!==k||t[46]!==A||t[47]!==T||t[48]!==E?(j=(0,L.jsx)(D,{...T,...E,items:b,selectedLines:m,onSelectedLinesChange:h,options:O,renderHeaderPrefix:k,renderAnnotation:A}),t[42]=b,t[43]=m,t[44]=O,t[45]=k,t[46]=A,t[47]=T,t[48]=E,t[49]=j):j=t[49],j}function z(e){return e.metadata.entries.map(Xe)}function Xe(e){return`${e.id}:${e.rangeLabel}:${e.text}`}function Ze(e){return[e.fileKey,e]}function B(e){return e.removeReviewComment}function Qe(e){return e.addReviewComment}function $e(e){return{diffPreview:S(e,{label:`environment-data:review:diff-preview`,tag:h.reviewGetDiffPreview,staleTimeMs:5e3})}}var et=$e(w);function V(e){return e.remoteName&&e.name.startsWith(`${e.remoteName}/`)?e.name.slice(e.remoteName.length+1):e.name}function tt(e,t){let n=new Set(t),r=e.map(e=>{let r=t.filter(t=>n.has(t)&&V(t)===e.name),i=r.find(e=>e.remoteName===`origin`)??r[0]??null;return i&&n.delete(i),{id:`local:${e.name}`,label:e.name,local:e,remote:i}}),i=t.filter(e=>n.has(e)).map(e=>({id:`remote:${e.name}`,label:e.name,local:null,remote:e}));return[...r,...i]}function nt(e,t){let n=t.trim().toLocaleLowerCase();return n.length===0?e:e.filter(e=>e.label.toLocaleLowerCase().includes(n)||e.local?.name.toLocaleLowerCase().includes(n)===!0||e.remote?.name.toLocaleLowerCase().includes(n)===!0)}var H=`__automatic_base_ref__`,rt=new Set,it=`
2
- [data-diffs-header],
3
- [data-diff],
4
- [data-file],
5
- [data-error-wrapper],
6
- [data-virtualizer-buffer] {
7
- --diffs-header-font-family: var(--font-sans) !important;
8
- --diffs-font-family: var(--font-mono) !important;
9
- --diffs-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
10
- --diffs-light-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
11
- --diffs-dark-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
12
- --diffs-token-light-bg: transparent;
13
- --diffs-token-dark-bg: transparent;
14
-
15
- --diffs-bg-context-override: color-mix(in srgb, var(--background) 97%, var(--foreground));
16
- --diffs-bg-hover-override: color-mix(in srgb, var(--background) 94%, var(--foreground));
17
- --diffs-bg-separator-override: color-mix(in srgb, var(--background) 95%, var(--foreground));
18
- --diffs-bg-buffer-override: color-mix(in srgb, var(--background) 90%, var(--foreground));
19
-
20
- --diffs-bg-addition-override: color-mix(in srgb, var(--background) 92%, var(--success));
21
- --diffs-bg-addition-number-override: color-mix(in srgb, var(--background) 88%, var(--success));
22
- --diffs-bg-addition-hover-override: color-mix(in srgb, var(--background) 85%, var(--success));
23
- --diffs-bg-addition-emphasis-override: color-mix(in srgb, var(--background) 80%, var(--success));
24
-
25
- --diffs-bg-deletion-override: color-mix(in srgb, var(--background) 92%, var(--destructive));
26
- --diffs-bg-deletion-number-override: color-mix(in srgb, var(--background) 88%, var(--destructive));
27
- --diffs-bg-deletion-hover-override: color-mix(in srgb, var(--background) 85%, var(--destructive));
28
- --diffs-bg-deletion-emphasis-override: color-mix(
29
- in srgb,
30
- var(--background) 80%,
31
- var(--destructive)
32
- );
33
-
34
- background-color: var(--diffs-bg) !important;
35
- }
36
-
37
- [data-file-info] {
38
- background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;
39
- border-block-color: var(--border) !important;
40
- color: var(--foreground) !important;
41
- }
42
-
43
- [data-diffs-header] {
44
- position: sticky !important;
45
- top: 0;
46
- z-index: 4;
47
- background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;
48
- border-bottom: 1px solid var(--border) !important;
49
- align-items: center !important;
50
- font-family: var(--font-sans) !important;
51
- font-size: 12px !important;
52
- line-height: 1 !important;
53
- min-height: 32px !important;
54
- padding-block: 6px !important;
55
- }
56
-
57
- [data-diffs-header] [data-header-content] {
58
- align-items: center !important;
59
- line-height: 1 !important;
60
- }
61
-
62
- [data-diffs-header] [data-metadata] {
63
- align-items: center !important;
64
- line-height: 1 !important;
65
- font-variant-numeric: tabular-nums;
66
- }
67
-
68
- [data-diffs-header] [data-additions-count],
69
- [data-diffs-header] [data-deletions-count] {
70
- font-family: var(--font-mono) !important;
71
- font-size: 11px !important;
72
- font-variant-numeric: tabular-nums;
73
- line-height: 1 !important;
74
- }
75
-
76
- [data-diffs-header] [data-change-icon],
77
- [data-diffs-header] [data-rename-icon] {
78
- display: block;
79
- flex-shrink: 0;
80
- }
81
-
82
- [data-title] {
83
- cursor: pointer;
84
- transition:
85
- color 120ms ease,
86
- text-decoration-color 120ms ease;
87
- text-decoration: underline;
88
- text-decoration-color: transparent;
89
- text-underline-offset: 2px;
90
- font-family: var(--font-sans) !important;
91
- }
92
-
93
- [data-title]:hover {
94
- color: color-mix(in srgb, var(--foreground) 84%, var(--primary)) !important;
95
- text-decoration-color: currentColor;
96
- }
97
- `;function U({mode:e=`inline`,composerDraftTarget:t,initialGitScope:n,threadRef:r}){let{resolvedTheme:a}=ne(),o=ve(),[u]=(0,F.useState)(n),[h,y]=(0,F.useState)(`stacked`),[b,re]=(0,F.useState)(o.wordWrap),[S,w]=(0,F.useState)(o.diffIgnoreWhitespace),[D,Se]=(0,F.useState)(``),[Me,ze]=(0,F.useState)(()=>({scopeKey:null,fileKeys:rt})),He=(0,F.useRef)(null),Ue=r.threadId,I=Ve(r),qe=I?.projectId??null,Je=he(I&&qe?{environmentId:I.environmentId,projectId:qe}:null),R=I?.worktreePath??Je?.workspaceRoot,z=te(E.configValueAtom(I?.environmentId??null)),Xe=ke(I?.environmentId??null,z?.availableEditors??[]),Ze=c(I!=null&&R!=null?ue.status({environmentId:I.environmentId,input:{cwd:R}}):null),B=N(e=>pe(e.byThreadKey,r,u===`unstaged`)),Qe=Ze.data?.isRepo??!0,{turnDiffSummaries:$e,inferredCheckpointTurnCountByTurnId:V}=fe(I),U=(0,F.useMemo)(()=>[...$e].toSorted((e,t)=>{let n=e.checkpointTurnCount??V[e.turnId]??0,r=t.checkpointTurnCount??V[t.turnId]??0;return n===r?t.completedAt.localeCompare(e.completedAt):r-n}),[V,$e]);(0,F.useEffect)(()=>{B.kind===`turn`&&N.getState().reconcileTurnSelection(r,U.map(e=>e.turnId))},[B,U,r]);let W=B.kind===`turn`?B.turnId:null,G=B.kind===`unstaged`?`unstaged`:`branch`,K=B.kind===`branch`?B.baseRef:null,at=B.kind===`turn`?B.filePath:null,ot=B.kind===`turn`?B.revealRequestId:0,q=W===null?void 0:U.find(e=>e.turnId===W)??U[0],J=q&&(q.checkpointTurnCount??V[q.turnId]),st=U[0],ct=W===null?G===`unstaged`?`Working tree`:`Branch changes`:q?.turnId===st?.turnId?`Latest turn`:`Turn ${J??`?`}`,lt=q?`turn:${q.turnId}`:G,Y=`${r.environmentId}:${r.threadId}:${lt}`,ut=Me.scopeKey===Y?Me.fileKeys:rt,dt=q?`Turn ${J??`?`}`:G===`unstaged`?`Working tree`:`Branch changes`,ft=(0,F.useMemo)(()=>typeof J==`number`?{fromTurnCount:Math.max(0,J-1),toTurnCount:J}:null,[J]),pt=Ke({environmentId:I?.environmentId??null,threadId:Ue,fromTurnCount:ft?.fromTurnCount??null,toTurnCount:ft?.toTurnCount??null,ignoreWhitespace:S,cacheScope:q?`turn:${q.turnId}`:null},{enabled:Qe&&q!==void 0}),mt=c(W===null&&I&&R?et.diffPreview({environmentId:I.environmentId,input:{cwd:R,...K?{baseRef:K}:{},ignoreWhitespace:S}}):null),ht=W===null&&mt.error?.includes(`configured workspace root`)===!0&&z?.cwd!==void 0&&z.cwd!==R,gt=c(ht&&I&&z?et.diffPreview({environmentId:I.environmentId,input:{cwd:z.cwd,...K?{baseRef:K}:{},ignoreWhitespace:S}}):null),X=ht?gt:mt,Z=X.data?.sources.find(e=>e.kind===(G===`unstaged`?`working-tree`:`branch-range`)),_t=c(W===null&&G===`branch`&&I&&X.data?.cwd?ue.listRefs({environmentId:I.environmentId,input:{cwd:X.data.cwd,includeMatchingRemoteRefs:!0,refKind:`local`,...D.trim().length>0?{query:D.trim()}:{},limit:100}}):null),vt=c(W===null&&G===`branch`&&I&&X.data?.cwd?ue.listRefs({environmentId:I.environmentId,input:{cwd:X.data.cwd,includeMatchingRemoteRefs:!0,refKind:`remote`,...D.trim().length>0?{query:D.trim()}:{},limit:100}}):null),yt=tt(_t.data?.refs.filter(e=>e.name!==Z?.headRef)??[],vt.data?.refs??[]),bt=nt(yt,D),xt=e=>K&&K===e.remote?.name?K:e.local?.name??e.remote?.name??e.id,St=[H,...yt.map(xt)],Ct=[...D.trim().length===0?[H]:[],...bt.map(xt)],wt=Z?.diff,Tt=q?pt.data?.diff:wt,Et=!q&&Z?.truncated===!0,Dt=q?pt.isPending:X.isPending,Ot=q?pt.error:X.error,kt=typeof Tt==`string`&&Tt.trim().length===0,Q=(0,F.useMemo)(()=>Ie(Tt,`diff-panel:${a}`,{compactPartialHunkOffsets:W===null}),[a,Tt,W]),At=(0,F.useMemo)(()=>!Q||Q.kind!==`files`?[]:Q.files.toSorted((e,t)=>P(e).localeCompare(P(t),void 0,{numeric:!0,sensitivity:`base`})),[Q]),$=(0,F.useMemo)(()=>At.map(e=>{let t=je(e);return{fileDiff:e,filePath:P(e),fileKey:t,collapsed:ut.has(t)}}),[ut,At]),jt=(0,F.useMemo)(()=>$.map(e=>e.fileKey),[$]),Mt=j(jt,ut),Nt=(0,F.useMemo)(()=>Oe(At),[At]);(0,F.useEffect)(()=>{if(!at)return;let e=$.find(e=>e.filePath===at);e&&He.current?.scrollTo({type:`item`,id:e.fileKey,align:`start`})},[$,at,ot]);let Pt=de({threadRef:r,workspaceRoot:R??null}),Ft=(0,F.useCallback)(e=>{Ge({threadRef:r,filePath:e,activeCwd:R,openFileSurface:Pt,openInEditor:e=>{(async()=>{let t=await Xe(e);t._tag===`Failure`&&!x(t)&&console.warn(`Failed to open diff file in editor.`,{operation:`open-diff-file`,environmentId:r.environmentId,threadId:r.threadId,...ae(ie(t))})})()}})},[R,Pt,Xe,r]),It=(0,F.useCallback)(e=>{ze(t=>{let n=new Set(t.scopeKey===Y?t.fileKeys:[]);return n.has(e)?n.delete(e):n.add(e),{scopeKey:Y,fileKeys:n}})},[Y]),Lt=(0,F.useCallback)(()=>{ze(e=>{let t=e.scopeKey===Y?e.fileKeys:rt;return{scopeKey:Y,fileKeys:O(jt,t)}})},[Y,jt]),Rt=e=>{N.getState().selectTurn(r,e)},zt=e=>{N.getState().selectGitScope(r,e)},Bt=e=>{N.getState().selectBranchBaseRef(r,e)};return(0,L.jsx)(me,{mode:e,header:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3 [-webkit-app-region:no-drag]`,children:[(0,L.jsxs)(se,{children:[(0,L.jsxs)(l,{className:`inline-flex h-6 max-w-full items-center gap-1 rounded-md bg-muted/70 px-2 text-xs font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Diff scope: ${ct}`,children:[(0,L.jsx)(`span`,{className:`truncate`,children:ct}),(0,L.jsx)(_,{className:`size-3.5 shrink-0 text-muted-foreground`})]}),(0,L.jsxs)(ee,{align:`start`,className:`w-60`,children:[(0,L.jsx)(d,{className:W===null&&G===`unstaged`?`bg-foreground/[0.08]`:void 0,onClick:()=>zt(`unstaged`),children:(0,L.jsx)(`span`,{children:`Working tree`})}),(0,L.jsx)(d,{className:W===null&&G===`branch`?`bg-foreground/[0.08]`:void 0,onClick:()=>zt(`branch`),children:(0,L.jsx)(`span`,{children:`Branch changes`})}),(0,L.jsx)(d,{className:W!==null&&q?.turnId===st?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>{st&&Rt(st.turnId)},children:(0,L.jsx)(`span`,{children:`Latest turn`})}),(0,L.jsxs)(p,{children:[(0,L.jsx)(m,{children:`Turn`}),(0,L.jsx)(f,{className:`w-64`,children:U.map(e=>{let t=e.checkpointTurnCount??V[e.turnId]??`?`;return(0,L.jsxs)(d,{className:e.turnId===q?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>Rt(e.turnId),children:[(0,L.jsxs)(`span`,{children:[`Turn `,t]}),(0,L.jsx)(`span`,{className:`ml-auto text-xs tabular-nums text-muted-foreground`,children:ge(e.completedAt,o.timestampFormat)})]},e.turnId)})})]})]})]}),W===null&&G===`branch`&&Z?.baseRef&&(0,L.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-center gap-2 overflow-hidden text-xs text-muted-foreground`,title:`${Z.headRef??`HEAD`} → ${Z.baseRef}`,"aria-label":`Comparing ${Z.headRef??`HEAD`} against ${Z.baseRef}`,children:[(0,L.jsx)(`span`,{className:`min-w-0 max-w-48 truncate`,children:Z.headRef??`HEAD`}),(0,L.jsx)(Fe,{className:`size-3.5 shrink-0 opacity-70`}),(0,L.jsxs)(xe,{items:St,filteredItems:Ct,value:K??H,onOpenChange:e=>{e||Se(``)},onValueChange:e=>{e&&Bt(e===H?null:e)},children:[(0,L.jsxs)(we,{className:`inline-flex min-w-0 max-w-48 items-center gap-1 overflow-hidden rounded-md px-1.5 py-1 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Change comparison target. Currently ${Z.baseRef}`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:Z.baseRef}),(0,L.jsx)(_,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,L.jsxs)(Re,{align:`start`,className:`w-72 min-w-0 max-w-[calc(100vw-1rem)] overflow-hidden [&>[data-slot=combobox-popup]]:min-w-0 [&>[data-slot=combobox-popup]]:overflow-hidden`,children:[(0,L.jsx)(`div`,{className:`min-w-0 shrink-0 px-3 pt-2.5`,children:(0,L.jsxs)(`div`,{className:`relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring`,children:[(0,L.jsx)(ye,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55`}),(0,L.jsx)(Le,{className:`[&_input]:h-6.5 [&_input]:ps-5 [&_input]:font-sans [&_input]:leading-6.5`,inputClassName:`rounded-none bg-transparent text-sm`,placeholder:`Search refs...`,showTrigger:!1,size:`sm`,unstyled:!0,value:D,onChange:e=>Se(e.target.value)})]})}),(0,L.jsxs)(`div`,{className:`grid shrink-0 grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 border-b border-border/70 ps-3 pe-6.5 pt-2 pb-1.5 font-medium text-[10px] text-muted-foreground uppercase tracking-wide`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`}),(0,L.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center`,children:[(0,L.jsx)(`span`,{children:`Branch`}),(0,L.jsx)(`span`,{className:`text-right`,children:`Remote`})]})]}),(0,L.jsx)(Pe,{children:`No matching refs.`}),(0,L.jsxs)(Ae,{className:`max-h-64 min-w-0 overflow-x-hidden`,children:[(0,L.jsx)(Ce,{className:`h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0`,contentClassName:`w-full min-w-0 overflow-hidden`,value:H,children:(0,L.jsx)(`span`,{className:`block min-w-0 truncate`,children:`Automatic`})}),yt.map(e=>{let t=xt(e),n=e.local!==null&&e.remote!==null,r=e.remote?.name===t;return(0,L.jsx)(Ce,{className:`h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0`,contentClassName:`w-full min-w-0 overflow-hidden`,value:t,children:(0,L.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center overflow-hidden`,children:[(0,L.jsx)(`span`,{className:`block min-w-0 truncate pe-2`,children:e.label}),n?(0,L.jsx)(`div`,{className:`flex justify-end`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,L.jsx)(De,{"aria-label":`Use remote version of ${e.label}`,checked:r,className:`[--thumb-size:--spacing(3)]`,onCheckedChange:t=>{let n=t?e.remote?.name:e.local?.name;n&&Bt(n)}})}):e.remote?(0,L.jsx)(`span`,{className:`flex justify-end text-muted-foreground`,title:`Remote only`,children:(0,L.jsx)(oe,{"aria-hidden":`true`,className:`size-3`})}):null]})},e.id)})]})]})]})]})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[$.length>0&&(0,L.jsx)(Be,{additions:Nt.additions,deletions:Nt.deletions,className:`mr-1 text-[11px]`,layout:`inline`}),$.length>0&&(0,L.jsxs)(g,{children:[(0,L.jsx)(v,{render:(0,L.jsx)(s,{type:`button`,size:`icon-xs`,variant:`outline`,"aria-label":Mt?`Expand all files`:`Collapse all files`,onClick:Lt}),children:Mt?(0,L.jsx)(Ee,{className:`size-3`}):(0,L.jsx)(ce,{className:`size-3`})}),(0,L.jsx)(C,{side:`top`,children:Mt?`Expand all files`:`Collapse all files`})]}),(0,L.jsxs)(k,{className:`shrink-0`,variant:`outline`,size:`xs`,value:[h],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&y(t)},children:[(0,L.jsx)(M,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,L.jsx)(A,{className:`size-3`})}),(0,L.jsx)(M,{"aria-label":`Split diff view`,value:`split`,children:(0,L.jsx)(le,{className:`size-3`})})]}),(0,L.jsxs)(g,{children:[(0,L.jsx)(v,{render:(0,L.jsx)(M,{"aria-label":b?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`outline`,size:`xs`,pressed:b,onPressedChange:e=>{re(!!e)}}),children:(0,L.jsx)(_e,{className:`size-3`})}),(0,L.jsx)(C,{side:`top`,children:b?`Disable line wrapping`:`Enable line wrapping`})]}),(0,L.jsxs)(g,{children:[(0,L.jsx)(v,{render:(0,L.jsx)(M,{"aria-label":S?`Show whitespace changes`:`Hide whitespace changes`,variant:`outline`,size:`xs`,pressed:S,onPressedChange:e=>{w(!!e)}}),children:(0,L.jsx)(We,{className:`size-3`})}),(0,L.jsx)(C,{side:`top`,children:S?`Show whitespace changes`:`Hide whitespace changes`})]})]})]}),children:I?Qe?W!==null&&U.length===0?(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`No completed turns yet.`}):(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,{className:`diff-panel-viewport flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[Et&&(0,L.jsx)(`p`,{className:`shrink-0 border-b border-border/70 bg-muted/40 px-3 py-1.5 text-[11px] text-muted-foreground`,children:`This diff was truncated because it exceeded the preview limit. The changes shown are incomplete.`}),Ot&&!Q&&(0,L.jsx)(`div`,{className:`px-3`,children:(0,L.jsx)(`p`,{className:`mb-2 text-[11px] text-red-500/80`,children:Ot})}),Q?Q.kind===`files`?(0,L.jsx)(`div`,{className:`min-h-0 flex-1`,onClickCapture:e=>{let t=(e.nativeEvent.composedPath?.()??[]).find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-title`))?.textContent?.trim();t&&Ft(t)},children:(0,L.jsx)(Ye,{viewerRef:He,className:`diff-render-surface h-full min-h-0 overflow-auto`,files:$,sectionId:lt,sectionTitle:dt,composerDraftTarget:t,renderHeaderPrefix:(e,t,n)=>{let r=P(e);return(0,L.jsxs)(g,{children:[(0,L.jsx)(v,{render:(0,L.jsx)(`button`,{type:`button`,className:i(`inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm border-0 bg-transparent p-0 transition-colors hover:bg-foreground/10 focus-visible:outline-hidden`,Te(e)),"aria-label":n?`Expand ${r}`:`Collapse ${r}`,"aria-expanded":!n,onClick:e=>{e.stopPropagation(),It(t)}}),children:n?(0,L.jsx)(T,{className:`size-4`}):(0,L.jsx)(_,{className:`size-4`})}),(0,L.jsx)(C,{side:`top`,children:n?`Expand diff`:`Collapse diff`})]})},options:{diffStyle:h===`split`?`split`:`unified`,lineDiffType:`none`,overflow:b?`wrap`:`scroll`,theme:Ne(a),themeType:a,unsafeCSS:it,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:33},layout:{paddingTop:0,paddingBottom:8,gap:8}}},Y??lt)}):(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`p`,{className:`text-[11px] text-muted-foreground/75`,children:Q.reason}),(0,L.jsx)(`pre`,{className:i(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,b?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:Q.text})]})}):Dt?(0,L.jsx)(be,{label:q?`Loading checkpoint diff...`:G===`unstaged`?`Loading working tree diff...`:`Loading branch diff...`}):(0,L.jsx)(`div`,{className:`flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70`,children:(0,L.jsx)(`p`,{children:kt?`No net changes in this selection.`:`No patch available for this selection.`})})]})}):(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Turn diffs are unavailable because this project is not a git repository.`}):(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Select a thread to inspect turn diffs.`})})}export{Se as DiffWorkerPoolProvider,U as default};
98
- //# sourceMappingURL=DiffPanel-C0rpq9HB.js.map
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{$a as i,Ct as a,Fu as o,G as s,Ga as c,Hr as l,Ia as u,J as d,K as f,Ka as p,Ku as m,Lu as h,Mu as g,Pu as _,Q as v,Qa as y,Sd as b,Sl as x,St as S,U as C,Ua as w,Uu as T,W as E,Wa as D,Wl as O,X as ee,Xa as k,Xu as te,Ya as A,Z as j,Za as M,_t as N,b as ne,bt as re,em as ie,jt as P,lt as ae,mt as F,nm as oe,pt as I,qa as L,r as se,vt as R,vu as z,xt as B,z as V,za as ce}from"./previewAssetResource-DnRvGKTL.js";import{$n as le,$r as ue,Ar as H,B as de,Cr as fe,Dr as U,Er as pe,Gr as W,H as G,I as K,Jr as me,Kr as he,L as ge,Mr as _e,Nr as ve,Or as q,Pr as J,Qn as Y,Qr as X,R as ye,Tr as be,V as xe,Xn as Se,Yn as Ce,Yr as we,Zn as Te,Zr as Ee,a as De,ai as Oe,c as ke,ci as Ae,d as je,et as Me,i as Ne,j as Pe,jr as Fe,kr as Ie,l as Le,mi as Re,n as ze,nt as Be,o as Ve,pi as He,r as Ue,s as We,t as Ge,tt as Ke,u as qe,wr as Je,y as Ye,z as Xe}from"./index-BZY4XTKM.js";var Ze=x(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),Qe=x(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),$e=x(`radio-tower`,[[`path`,{d:`M4.9 16.1C1 12.2 1 5.8 4.9 1.9`,key:`s0qx1y`}],[`path`,{d:`M7.8 4.7a6.14 6.14 0 0 0-.8 7.5`,key:`1idnkw`}],[`circle`,{cx:`12`,cy:`9`,r:`2`,key:`1092wv`}],[`path`,{d:`M16.2 4.8c2 2 2.26 5.11.8 7.47`,key:`ojru2q`}],[`path`,{d:`M19.1 1.9a9.96 9.96 0 0 1 0 14.1`,key:`rhi7fg`}],[`path`,{d:`M9.5 18h5`,key:`mfy3pd`}],[`path`,{d:`m8 22 4-11 4 11`,key:`25yftu`}]]),Z=r(),Q=e(n(),1),$=t(),et=()=>{};function tt(e){let t=(0,Z.c)(116),{url:n,displayUrl:r,loading:a,loadProgress:o,canGoBack:s,canGoForward:c,refreshDisabled:l,inputDisabled:d,focusUrlNonce:f,onBack:p,onForward:m,onRefresh:h,onSubmit:g,onOpenInBrowser:_,onCapture:v,captureDisabled:y,recording:b,onPictureInPicture:x,pictureInPicture:S,pictureInPictureDisabled:C,onPickElement:w,pickActive:T,pickDisabled:E,pickDisabledReason:D,trailingActions:O}=e,ee=(0,Q.useRef)(null),[k,te]=(0,Q.useState)(n),[A,j]=(0,Q.useState)(!1),M;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(M=[],t[0]=M):M=t[0];let[ne,ie]=(0,Q.useState)(M),[P,ae]=(0,Q.useState)(-1),F=(0,Q.useId)(),oe;t[1]!==k||t[2]!==ne||t[3]!==A||t[4]!==n?(oe=A&&k!==n?qe(ne,k):[],t[1]=k,t[2]=ne,t[3]=A,t[4]=n,t[5]=oe):oe=t[5];let I=oe,L,se;t[6]===f?(L=t[7],se=t[8]):(L=()=>{if(f==null)return;let e=ee.current;e&&e.focus()},se=[f],t[6]=f,t[7]=L,t[8]=se),(0,Q.useEffect)(L,se);let z;t[9]!==P||t[10]!==k||t[11]!==g||t[12]!==I?(z=e=>{e?.preventDefault();let t=I[P]?.url??k.trim();t.length!==0&&(g(t),ee.current?.blur())},t[9]=P,t[10]=k,t[11]=g,t[12]=I,t[13]=z):z=t[13];let B=z,V=s?p:et,ce=!s,le;t[14]!==V||t[15]!==ce?(le=(0,$.jsx)(u,{variant:`ghost`,size:`icon-xs`,onClick:V,disabled:ce,"aria-label":`Back`,type:`button`}),t[14]=V,t[15]=ce,t[16]=le):le=t[16];let ue;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,$.jsx)(Re,{}),t[17]=ue):ue=t[17];let H;t[18]===le?H=t[19]:(H=(0,$.jsx)(re,{render:le,children:ue}),t[18]=le,t[19]=H);let de;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(R,{children:`Back`}),t[20]=de):de=t[20];let fe;t[21]===H?fe=t[22]:(fe=(0,$.jsxs)(N,{children:[H,de]}),t[21]=H,t[22]=fe);let U=c?m:et,pe=!c,G;t[23]!==U||t[24]!==pe?(G=(0,$.jsx)(u,{variant:`ghost`,size:`icon-xs`,onClick:U,disabled:pe,"aria-label":`Forward`,type:`button`}),t[23]=U,t[24]=pe,t[25]=G):G=t[25];let K;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(He,{}),t[26]=K):K=t[26];let me;t[27]===G?me=t[28]:(me=(0,$.jsx)(re,{render:G,children:K}),t[27]=G,t[28]=me);let he;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,$.jsx)(R,{children:`Forward`}),t[29]=he):he=t[29];let ge;t[30]===me?ge=t[31]:(ge=(0,$.jsxs)(N,{children:[me,he]}),t[30]=me,t[31]=ge);let _e=l?et:h,ve=a?`Stop`:`Refresh`,q;t[32]!==l||t[33]!==_e||t[34]!==ve?(q=(0,$.jsx)(u,{variant:`ghost`,size:`icon-xs`,onClick:_e,disabled:l,"aria-label":ve,type:`button`}),t[32]=l,t[33]=_e,t[34]=ve,t[35]=q):q=t[35];let J=a&&`animate-spin`,Y;t[36]===J?Y=t[37]:(Y=i(J),t[36]=J,t[37]=Y);let X;t[38]===Y?X=t[39]:(X=(0,$.jsx)(W,{className:Y}),t[38]=Y,t[39]=X);let ye;t[40]!==q||t[41]!==X?(ye=(0,$.jsx)(re,{render:q,children:X}),t[40]=q,t[41]=X,t[42]=ye):ye=t[42];let be=a?`Loading…`:`Refresh`,xe;t[43]===be?xe=t[44]:(xe=(0,$.jsx)(R,{children:be}),t[43]=be,t[44]=xe);let Se;t[45]!==ye||t[46]!==xe?(Se=(0,$.jsxs)(N,{children:[ye,xe]}),t[45]=ye,t[46]=xe,t[47]=Se):Se=t[47];let Ce;t[48]!==fe||t[49]!==ge||t[50]!==Se?(Ce=(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`Navigation`,children:[fe,ge,Se]}),t[48]=fe,t[49]=ge,t[50]=Se,t[51]=Ce):Ce=t[51];let Te=A?k:r??n,De=_&&!A&&`group-hover/address:pe-7 transition-[padding]`,Oe;t[52]===De?Oe=t[53]:(Oe=i(De),t[52]=De,t[53]=Oe);let ke;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ke=e=>{te(e.target.value),ae(-1)},t[54]=ke):ke=t[54];let je;t[55]===n?je=t[56]:(je=()=>{te(n),ie(Le()),ae(-1),j(!0),queueMicrotask(()=>ee.current?.select())},t[55]=n,t[56]=je);let Ne;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=()=>{j(!1)},t[57]=Ne):Ne=t[57];let Pe;t[58]!==B||t[59]!==I.length||t[60]!==n?(Pe=e=>{if(e.key===`Enter`&&B(e),(e.key===`ArrowDown`||e.key===`ArrowUp`)&&I.length>0){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;ae(e=>{let n=e+t;return n>=I.length?-1:n<-1?I.length-1:n})}e.key===`Escape`&&(e.preventDefault(),te(n),ee.current?.blur())},t[58]=B,t[59]=I.length,t[60]=n,t[61]=Pe):Pe=t[61];let Fe=I.length>0,Ie=P>=0?`${F}-${P}`:void 0,ze;t[62]!==d||t[63]!==F||t[64]!==Te||t[65]!==Oe||t[66]!==je||t[67]!==Pe||t[68]!==Fe||t[69]!==Ie?(ze=(0,$.jsx)(re,{render:(0,$.jsx)(Be,{ref:ee,value:Te,className:Oe,onChange:ke,onFocus:je,onBlur:Ne,onKeyDown:Pe,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":Fe,"aria-controls":F,"aria-activedescendant":Ie,placeholder:`Search or enter URL`,spellCheck:!1,disabled:d,"data-preview-url-input":!0,size:`sm`})}),t[62]=d,t[63]=F,t[64]=Te,t[65]=Oe,t[66]=je,t[67]=Pe,t[68]=Fe,t[69]=Ie,t[70]=ze):ze=t[70];let Ve;t[71]!==r||t[72]!==A||t[73]!==n?(Ve=!A&&r?(0,$.jsx)(R,{children:n}):null,t[71]=r,t[72]=A,t[73]=n,t[74]=Ve):Ve=t[74];let Ue;t[75]!==ze||t[76]!==Ve?(Ue=(0,$.jsxs)(N,{children:[ze,Ve]}),t[75]=ze,t[76]=Ve,t[77]=Ue):Ue=t[77];let We;t[78]!==A||t[79]!==_?(We=_&&!A?(0,$.jsx)(Ke,{align:`inline-end`,className:`pointer-events-none absolute inset-y-0 right-0 opacity-0 transition-opacity group-hover/address:pointer-events-auto group-hover/address:opacity-100`,children:(0,$.jsxs)(N,{children:[(0,$.jsx)(re,{render:(0,$.jsx)(u,{variant:`ghost`,size:`icon-xs`,onClick:_,"aria-label":`Open in system browser`,type:`button`}),children:(0,$.jsx)(Ae,{})}),(0,$.jsx)(R,{children:`Open in system browser`})]})}):null,t[78]=A,t[79]=_,t[80]=We):We=t[80];let Ge;t[81]!==Ue||t[82]!==We?(Ge=(0,$.jsxs)(Me,{className:`group/address h-7 flex-1 rounded-md border-transparent bg-transparent shadow-none before:shadow-none hover:bg-muted/40 focus-within:bg-background`,children:[Ue,We]}),t[81]=Ue,t[82]=We,t[83]=Ge):Ge=t[83];let Je;t[84]!==w||t[85]!==T||t[86]!==E||t[87]!==D?(Je=w?(0,$.jsxs)(N,{children:[(0,$.jsx)(re,{render:(0,$.jsx)(u,{variant:T?`secondary`:`ghost`,size:`icon-xs`,onClick:w,disabled:E,"aria-label":T?`Cancel annotation`:`Annotate preview`,"aria-pressed":T?`true`:`false`,type:`button`}),children:(0,$.jsx)(Ee,{className:i(T&&`text-primary`)})}),(0,$.jsx)(R,{children:E&&D?D:T?`Cancel annotation (Esc)`:`Annotate elements, regions, and drawings`})]}):null,t[84]=w,t[85]=T,t[86]=E,t[87]=D,t[88]=Je):Je=t[88];let Ye;t[89]!==y||t[90]!==v||t[91]!==b?(Ye=v?(0,$.jsxs)(N,{children:[(0,$.jsxs)(re,{render:(0,$.jsx)(u,{variant:b?`secondary`:`ghost`,size:`icon-xs`,onClick:e=>v(e.shiftKey),"aria-label":b?`Stop recording`:`Capture screenshot`,type:`button`,className:`relative`,disabled:y}),children:[(0,$.jsx)(Ze,{className:i(b&&`text-destructive`)}),b?(0,$.jsx)(`span`,{className:`absolute right-0.5 top-0.5 size-1.5 animate-status-pulse rounded-full bg-destructive`}):null]}),(0,$.jsx)(R,{children:b?`Stop recording`:`Screenshot · Shift-click to record`})]}):null,t[89]=y,t[90]=v,t[91]=b,t[92]=Ye):Ye=t[92];let Xe;t[93]!==x||t[94]!==S||t[95]!==C?(Xe=x?(0,$.jsxs)(N,{children:[(0,$.jsx)(re,{render:(0,$.jsx)(u,{variant:S?`secondary`:`ghost`,size:`icon-xs`,onClick:x,"aria-label":S?`Close floating preview`:`Float preview over chat`,"aria-pressed":S?`true`:`false`,type:`button`,disabled:C}),children:(0,$.jsx)(we,{className:i(S&&`text-primary`)})}),(0,$.jsx)(R,{children:S?`Close floating preview`:`Float preview over chat`})]}):null,t[93]=x,t[94]=S,t[95]=C,t[96]=Xe):Xe=t[96];let Qe;t[97]!==B||t[98]!==Ce||t[99]!==Ge||t[100]!==Je||t[101]!==Ye||t[102]!==Xe||t[103]!==O?(Qe=(0,$.jsxs)(`form`,{onSubmit:B,className:`surface-subheader gap-1 px-2`,"data-surface-subheader":!0,children:[Ce,Ge,Je,Ye,Xe,O]}),t[97]=B,t[98]=Ce,t[99]=Ge,t[100]=Je,t[101]=Ye,t[102]=Xe,t[103]=O,t[104]=Qe):Qe=t[104];let $e;t[105]!==P||t[106]!==g||t[107]!==I||t[108]!==F?($e=I.length>0?(0,$.jsx)(`ul`,{id:F,role:`listbox`,"aria-label":`History suggestions`,className:`absolute inset-x-2 top-full z-50 mt-1 overflow-hidden rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-lg`,children:I.map((e,t)=>(0,$.jsxs)(`li`,{id:`${F}-${t}`,role:`option`,"aria-selected":t===P,onMouseDown:nt,onClick:()=>{g(e.url),ee.current?.blur()},onMouseEnter:()=>ae(t),className:`flex cursor-default flex-col rounded-md px-2 py-1 text-sm aria-selected:bg-accent aria-selected:text-accent-foreground`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:e.title||e.url}),e.title?(0,$.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.url}):null]},e.url))}):null,t[105]=P,t[106]=g,t[107]=I,t[108]=F,t[109]=$e):$e=t[109];let tt;t[110]===o?tt=t[111]:(tt=o>0?(0,$.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute bottom-0 left-0 z-10 h-0.5 rounded-r-full bg-primary transition-all duration-150 ease-out`,style:{width:`${o}%`,boxShadow:`0 0 6px 1px var(--color-ring)`}}):null,t[110]=o,t[111]=tt);let rt;return t[112]!==Qe||t[113]!==$e||t[114]!==tt?(rt=(0,$.jsxs)(`div`,{className:`relative`,children:[Qe,$e,tt]}),t[112]=Qe,t[113]=$e,t[114]=tt,t[115]=rt):rt=t[115],rt}function nt(e){return e.preventDefault()}function rt(e){try{let t=new URL(e.url),n=new URL(e.environmentHttpBaseUrl);if(t.origin===n.origin&&t.pathname.startsWith(`/api/assets/`)){let n=t.pathname.split(`/`).at(-1);if(!n)return null;let r=decodeURIComponent(n);return!r||r===`.`||r===`..`?null:`${e.environmentLabel} · ${r}`}return t.protocol===`http:`||t.protocol===`https:`?t.host:null}catch{return null}}function it(e){let t=(0,Z.c)(6),{className:n}=e,r;t[0]===n?r=t[1]:(r=i(`relative flex flex-col gap-0.5 overflow-hidden rounded-[5px] border border-border/60 bg-card p-1 shadow-xs/5`,n),t[0]=n,t[1]=r);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsxs)(`div`,{className:`flex gap-[2px]`,children:[(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-destructive/80`}),(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-warning/80`}),(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-success/80`})]}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsxs)(`div`,{className:`mt-[1px] flex flex-1 flex-col gap-[2px]`,children:[(0,$.jsx)(`span`,{className:`h-[2px] w-full rounded-full bg-muted-foreground/30`}),(0,$.jsx)(`span`,{className:`h-[2px] w-3/5 rounded-full bg-muted-foreground/20`})]}),t[3]=o):o=t[3];let s;return t[4]===r?s=t[5]:(s=(0,$.jsxs)(`div`,{"aria-hidden":!0,className:r,children:[a,o]}),t[4]=r,t[5]=s),s}function at(e){let t=(0,Z.c)(17),{server:n,onOpen:r}=e,i;t[0]===n?i=t[1]:(i=ot(n),t[0]=n,t[1]=i);let a=i,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(it,{className:`size-7 shrink-0`}),t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:a}),t[3]=a,t[4]=s);let c;t[5]!==n.host||t[6]!==n.port?(c=(0,$.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[n.host,`:`,n.port]}),t[5]=n.host,t[6]=n.port,t[7]=c):c=t[7];let l;t[8]!==s||t[9]!==c?(l=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[s,c]}),t[8]=s,t[9]=c,t[10]=l):l=t[10];let u;t[11]===n.listening?u=t[12]:(u=n.listening?(0,$.jsx)(st,{}):(0,$.jsx)(ct,{}),t[11]=n.listening,t[12]=u);let d;return t[13]!==r||t[14]!==l||t[15]!==u?(d=(0,$.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex w-full items-center gap-3 px-3 py-3 text-left hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:[o,l,u]}),t[13]=r,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function ot(e){return e.processName?e.processName:e.listening?`Listening`:e.source===`configured`?`Configured`:`Recently seen`}function st(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`span`,{"aria-label":`Listening`,className:`relative inline-flex size-2 shrink-0`,children:[(0,$.jsx)(`span`,{className:`absolute inset-0 animate-status-ping rounded-full bg-success opacity-60`}),(0,$.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-success`})]}),e[0]=t):t=e[0],t}function ct(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`span`,{"aria-label":`Not currently listening`,className:`size-2 shrink-0 rounded-full bg-muted-foreground/40`}),e[0]=t):t=e[0],t}function lt(e){let t=(0,Z.c)(7),n=U(e.environmentId),r;if(t[0]!==e.configuredUrls||t[1]!==e.environmentId||t[2]!==e.recentlySeenUrls||t[3]!==n){let i;t[5]===e.environmentId?i=t[6]:(i=t=>({...t,url:Je(e.environmentId,t.url)}),t[5]=e.environmentId,t[6]=i),r=ut({scanner:n.map(i),configuredUrls:e.configuredUrls??[],recentlySeenUrls:e.recentlySeenUrls??[]}),t[0]=e.configuredUrls,t[1]=e.environmentId,t[2]=e.recentlySeenUrls,t[3]=n,t[4]=r}else r=t[4];return r}function ut(e){let t=new Map;for(let n of e.configuredUrls){let e=ft(n);if(!e)continue;let r=dt(e.host,e.port);t.has(r)||t.set(r,{host:e.host,port:e.port,url:e.url,processName:null,pid:null,terminal:null,source:`configured`,listening:!1})}for(let n of e.scanner){let e=dt(n.host,n.port),r=t.get(e);if(r){t.set(e,{...r,processName:n.processName??r.processName,pid:n.pid??r.pid,terminal:n.terminal??r.terminal,listening:!0});continue}t.set(e,{...n,source:`scanner`,listening:!0})}for(let n of e.recentlySeenUrls){let e=ft(n);if(!e)continue;let r=dt(e.host,e.port);t.has(r)||t.set(r,{host:e.host,port:e.port,url:e.url,processName:null,pid:null,terminal:null,source:`recent`,listening:!1})}return Array.from(t.values()).toSorted((e,t)=>{let n={configured:0,scanner:1,recent:2};return n[e.source]===n[t.source]?e.port-t.port:n[e.source]-n[t.source]})}function dt(e,t){return`${e.toLowerCase()}:${t}`}function ft(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`||!be(t.hostname))return null;let n=t.port?Number.parseInt(t.port,10):t.protocol===`http:`?80:443;return!Number.isFinite(n)||n<=0?null:{host:t.hostname,port:n,url:t.href}}catch{return null}}function pt(e){let t=(0,Z.c)(16),{environmentId:n,configuredUrls:r,recentlySeenUrls:i,onOpenUrl:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o={environmentId:n,configuredUrls:r,recentlySeenUrls:i},t[0]=r,t[1]=n,t[2]=i,t[3]=o):o=t[3];let s=lt(o);if(s.length===0){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(Ce,{children:[(0,$.jsx)(Te,{variant:`icon`,children:(0,$.jsx)(Oe,{className:`size-4.5 text-muted-foreground`})}),(0,$.jsx)(Y,{children:`No preview yet`}),(0,$.jsx)(Se,{children:`Type a URL above, or run a dev script. Listening localhost ports will show up here automatically.`})]}),t[4]=e):e=t[4],e}let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)($e,{className:`size-4 shrink-0`}),(0,$.jsx)(`h2`,{className:`font-medium`,children:`Local servers`})]}),t[5]=c):c=t[5];let l;if(t[6]!==a||t[7]!==s){let e;t[9]===a?e=t[10]:(e=e=>(0,$.jsx)(at,{server:e,onOpen:()=>a(e.url)},`${e.host}:${e.port}`),t[9]=a,t[10]=e),l=s.map(e),t[6]=a,t[7]=s,t[8]=l}else l=t[8];let u;t[11]===l?u=t[12]:(u=(0,$.jsx)(`div`,{className:`flex flex-col divide-y divide-border/60 overflow-hidden rounded-xl border border-border/70 bg-background`,children:l}),t[11]=l,t[12]=u);let d;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:`Select a listening port to open it in this browser tab.`}),t[13]=d):d=t[13];let f;return t[14]===u?f=t[15]:(f=(0,$.jsx)(`div`,{className:`flex h-full min-h-0 overflow-y-auto px-5 py-8`,children:(0,$.jsxs)(`div`,{className:`m-auto flex w-full max-w-xl flex-col gap-3`,children:[c,u,d]})}),t[14]=u,t[15]=f),f}var mt=e=>(e instanceof Error?e.message:``).replace(/^Error invoking remote method '[^']+':\s*/u,``).replace(/^[A-Za-z]+Error:\s*/u,``).trim()||`Chrome import failed.`;function ht(e){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(!e.open||!K)return;let t=!1;return n(null),c(null),K.listChromeProfiles().then(e=>{t||(n(e),i(e[0]?.id??null))},e=>{t||(n([]),i(null),c(mt(e)))}),()=>{t=!0}},[e.open]);let l=async()=>{if(!(!K||!r)){o(!0);try{let t=await K.importFromChrome({profileId:r});ke(t.history),I.add({type:`success`,title:`Imported from Chrome`,description:`${t.importedCookies} cookies and ${t.history.length} history entries.${t.failedCookies>0?` ${t.failedCookies} cookies could not be imported.`:``}`}),e.onOpenChange(!1)}catch(e){I.add({type:`error`,title:`Could not import from Chrome`,description:mt(e)})}finally{o(!1)}}};return(0,$.jsx)(q,{open:e.open,onOpenChange:e.onOpenChange,children:(0,$.jsxs)(ve,{className:`max-w-md`,children:[(0,$.jsxs)(Fe,{children:[(0,$.jsx)(J,{children:`Import from Chrome`}),(0,$.jsx)(Ie,{children:`Copies all cookies and recent history from a Chrome profile into the built-in browser. Agents that use this browser can act with these signed-in sessions. macOS asks for Keychain access to decrypt the cookies.`})]}),(0,$.jsx)(_e,{children:s?(0,$.jsx)(`p`,{className:`text-sm text-destructive-foreground`,children:s}):t===null?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Looking for Chrome profiles…`}):t.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Chrome profiles found. Importing is available on macOS with Google Chrome installed.`}):(0,$.jsx)(`div`,{role:`radiogroup`,"aria-label":`Chrome profile`,className:`space-y-1`,children:t.map(e=>(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 rounded-md px-2 py-1.5 text-sm hover:bg-accent`,children:[(0,$.jsx)(`input`,{type:`radio`,name:`chrome-profile`,value:e.id,checked:r===e.id,onChange:()=>i(e.id)}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.name===e.id?null:(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.id})]},e.id))})}),(0,$.jsxs)(H,{children:[(0,$.jsx)(u,{variant:`outline`,onClick:()=>e.onOpenChange(!1),children:`Cancel`}),(0,$.jsx)(u,{disabled:!r||a,onClick:()=>void l(),children:a?`Importing…`:`Import`})]})]})})}var gt=[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}];function _t(e){let t=(0,Z.c)(81),{tabId:n,hasWebContents:r,zoomFactor:i,colorScheme:a,deviceToolbarVisible:o,onToggleDeviceToolbar:s,nativePictureInPicture:l,onNativePictureInPicture:d}=e,[f,p]=(0,Q.useState)(!1);if(!K)return null;let m=!n||!r,h;t[0]===n?h=t[1]:(h=e=>()=>{n&&e(n).catch(Tt)},t[0]=n,t[1]=h);let g=h,_;t[2]===i?_=t[3]:(_=Math.round(i*100),t[2]=i,t[3]=_);let v=`${_}%`,b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsxs)(N,{children:[(0,$.jsx)(re,{render:(0,$.jsx)(y,{render:(0,$.jsx)(u,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":`Preview menu`})}),children:(0,$.jsx)(Qe,{})}),(0,$.jsx)(R,{children:`More`})]}),t[4]=b):b=t[4];let x;t[5]===g?x=t[6]:(x=g(K.hardReload),t[5]=g,t[6]=x);let S;t[7]!==x||t[8]!==m?(S=(0,$.jsx)(w,{onClick:x,disabled:m,children:`Hard reload`}),t[7]=x,t[8]=m,t[9]=S):S=t[9];let C;t[10]===g?C=t[11]:(C=g(K.openDevTools),t[10]=g,t[11]=C);let T;t[12]!==C||t[13]!==m?(T=(0,$.jsx)(w,{onClick:C,disabled:m,children:`Open DevTools`}),t[12]=C,t[13]=m,t[14]=T):T=t[14];let E=l?`Close separate preview window`:`Open separate preview window`,O;t[15]!==d||t[16]!==E||t[17]!==m?(O=(0,$.jsx)(w,{onClick:d,disabled:m,children:E}),t[15]=d,t[16]=E,t[17]=m,t[18]=O):O=t[18];let ee=o?`Hide device toolbar`:`Show device toolbar`,te;t[19]!==s||t[20]!==ee||t[21]!==m?(te=(0,$.jsx)(w,{onClick:s,disabled:m,children:ee}),t[19]=s,t[20]=ee,t[21]=m,t[22]=te):te=t[22];let j;t[23]===m?j=t[24]:(j=(0,$.jsx)(M,{disabled:m,children:`Appearance`}),t[23]=m,t[24]=j);let ne;t[25]===n?ne=t[26]:(ne=e=>{n&&K.setColorScheme(n,e).catch(wt)},t[25]=n,t[26]=ne);let ie;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ie=gt.map(Ct),t[27]=ie):ie=t[27];let P;t[28]!==a||t[29]!==ne?(P=(0,$.jsx)(k,{className:`min-w-32`,children:(0,$.jsx)(c,{value:a,onValueChange:ne,children:ie})}),t[28]=a,t[29]=ne,t[30]=P):P=t[30];let ae;t[31]!==j||t[32]!==P?(ae=(0,$.jsxs)(A,{children:[j,P]}),t[31]=j,t[32]=P,t[33]=ae):ae=t[33];let F;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(L,{}),t[34]=F):F=t[34];let oe;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(`span`,{children:`Zoom`}),t[35]=oe):oe=t[35];let I;t[36]===g?I=t[37]:(I=g(K.zoomOut),t[36]=g,t[37]=I);let se;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(ue,{}),t[38]=se):se=t[38];let z;t[39]!==I||t[40]!==m?(z=(0,$.jsx)(u,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:I,"aria-label":`Zoom out`,disabled:m,children:se}),t[39]=I,t[40]=m,t[41]=z):z=t[41];let B;t[42]===v?B=t[43]:(B=(0,$.jsx)(`span`,{className:`min-w-12 text-center text-xs tabular-nums text-muted-foreground`,children:v}),t[42]=v,t[43]=B);let V;t[44]===g?V=t[45]:(V=g(K.zoomIn),t[44]=g,t[45]=V);let le;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(me,{}),t[46]=le):le=t[46];let H;t[47]!==V||t[48]!==m?(H=(0,$.jsx)(u,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:V,"aria-label":`Zoom in`,disabled:m,children:le}),t[47]=V,t[48]=m,t[49]=H):H=t[49];let de;t[50]===g?de=t[51]:(de=g(K.resetZoom),t[50]=g,t[51]=de);let fe;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,$.jsx)(he,{}),t[52]=fe):fe=t[52];let U;t[53]!==de||t[54]!==m?(U=(0,$.jsx)(u,{variant:`ghost`,size:`icon-xs`,type:`button`,onClick:de,"aria-label":`Reset zoom`,disabled:m,children:fe}),t[53]=de,t[54]=m,t[55]=U):U=t[55];let pe;t[56]!==z||t[57]!==B||t[58]!==H||t[59]!==U?(pe=(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[z,B,H,U]}),t[56]=z,t[57]=B,t[58]=H,t[59]=U,t[60]=pe):pe=t[60];let W;t[61]!==pe||t[62]!==m?(W=(0,$.jsxs)(w,{closeOnClick:!1,onClick:St,className:`justify-between`,disabled:m,children:[oe,pe]}),t[61]=pe,t[62]=m,t[63]=W):W=t[63];let G,ge,_e,ve;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(L,{}),ge=(0,$.jsx)(w,{onClick:bt,children:`Clear cookies`}),_e=(0,$.jsx)(w,{onClick:vt,children:`Clear cache`}),ve=(0,$.jsx)(L,{}),t[64]=G,t[65]=ge,t[66]=_e,t[67]=ve):(G=t[64],ge=t[65],_e=t[66],ve=t[67]);let q;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(w,{onClick:()=>p(!0),children:`Import from Chrome…`}),t[68]=q):q=t[68];let J;t[69]!==te||t[70]!==ae||t[71]!==W||t[72]!==S||t[73]!==T||t[74]!==O?(J=(0,$.jsxs)(ce,{children:[b,(0,$.jsxs)(D,{align:`end`,sideOffset:6,className:`min-w-56`,children:[S,T,O,te,ae,F,W,G,ge,_e,ve,q]})]}),t[69]=te,t[70]=ae,t[71]=W,t[72]=S,t[73]=T,t[74]=O,t[75]=J):J=t[75];let Y;t[76]===f?Y=t[77]:(Y=(0,$.jsx)(ht,{open:f,onOpenChange:p}),t[76]=f,t[77]=Y);let X;return t[78]!==J||t[79]!==Y?(X=(0,$.jsxs)($.Fragment,{children:[J,Y]}),t[78]=J,t[79]=Y,t[80]=X):X=t[80],X}function vt(){K.clearCache().catch(yt)}function yt(){}function bt(){K.clearCookies().catch(xt)}function xt(){}function St(e){return e.preventDefault()}function Ct(e){return(0,$.jsx)(p,{value:e.value,children:e.label},e.value)}function wt(){}function Tt(){}function Et(e){return j[e]||(e.length>0?e:`Network error`)}function Dt(e){let t=(0,Z.c)(32),{url:n,code:r,description:i,onReload:a}=e,[o,s]=(0,Q.useState)(!1),c;t[0]===n?c=t[1]:(c=At(n)??n,t[0]=n,t[1]=c);let l=c,d;t[2]===i?d=t[3]:(d=Et(i),t[2]=i,t[3]=d);let f=d,p;t[4]!==r||t[5]!==i?(p=i.length>0?i:`ERR_${Math.abs(r)||`FAILED`}`,t[4]=r,t[5]=i,t[6]=p):p=t[6];let m=p,h,g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(kt,{className:`mb-6 size-12 text-muted-foreground/70`}),g=(0,$.jsx)(`h1`,{className:`mb-3 text-2xl font-semibold leading-tight text-foreground`,children:`This site can’t be reached`}),t[7]=h,t[8]=g):(h=t[7],g=t[8]);let _;t[9]===l?_=t[10]:(_=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:l}),t[9]=l,t[10]=_);let v;t[11]!==f||t[12]!==_?(v=(0,$.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[_,`: `,f,`.`]}),t[11]=f,t[12]=_,t[13]=v):v=t[13];let y;t[14]===o?y=t[15]:(y=o?(0,$.jsxs)(`div`,{className:`mt-6 rounded-lg border border-border bg-muted/40 p-4 text-sm`,children:[(0,$.jsx)(`p`,{className:`mb-2 font-medium text-foreground`,children:`Try:`}),(0,$.jsxs)(`ul`,{className:`list-disc space-y-1 pl-5 text-muted-foreground`,children:[(0,$.jsx)(`li`,{children:`Checking your connection`}),(0,$.jsx)(`li`,{children:`Confirming the dev server is running`}),(0,$.jsx)(`li`,{children:`Checking the proxy and the firewall`})]})]}):null,t[14]=o,t[15]=y);let b;t[16]===m?b=t[17]:(b=(0,$.jsx)(`div`,{className:`mt-8 text-xs uppercase tracking-wide text-muted-foreground/70`,children:m}),t[16]=m,t[17]=b);let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>s(Ot),t[18]=x):x=t[18];let S=o?`Hide details`:`Details`,C;t[19]===S?C=t[20]:(C=(0,$.jsx)(u,{type:`button`,variant:`outline`,size:`sm`,onClick:x,children:S}),t[19]=S,t[20]=C);let w;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(`div`,{className:`flex-1`}),t[21]=w):w=t[21];let T;t[22]===a?T=t[23]:(T=(0,$.jsx)(u,{type:`button`,size:`sm`,onClick:a,children:`Reload`}),t[22]=a,t[23]=T);let E;t[24]!==C||t[25]!==T?(E=(0,$.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 pt-8`,children:[C,w,T]}),t[24]=C,t[25]=T,t[26]=E):E=t[26];let D;return t[27]!==E||t[28]!==v||t[29]!==y||t[30]!==b?(D=(0,$.jsx)(`div`,{className:`relative flex h-full min-h-0 w-full overflow-y-auto bg-background`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-1 flex-col px-8 py-12 sm:py-16`,children:[h,g,v,y,b,E]})}),t[27]=E,t[28]=v,t[29]=y,t[30]=b,t[31]=D):D=t[31],D}function Ot(e){return!e}function kt(e){let t=(0,Z.c)(5),{className:n}=e,r,i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`path`,{d:`M16 12 L48 12 L48 52 L16 52 Z`}),i=(0,$.jsx)(`path`,{d:`M22 22 L42 22 M22 30 L36 30 M22 38 L40 38`,strokeLinecap:`round`}),a=(0,$.jsx)(`path`,{d:`M52 8 L12 56`,strokeLinecap:`round`}),t[0]=r,t[1]=i,t[2]=a):(r=t[0],i=t[1],a=t[2]);let o;return t[3]===n?o=t[4]:(o=(0,$.jsxs)(`svg`,{viewBox:`0 0 64 64`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,className:n,children:[r,i,a]}),t[3]=n,t[4]=o),o}function At(e){try{return new URL(e).host}catch{return null}}function jt(e){let t=e.toLowerCase();return t.includes(`mac`)?`Reveal in Finder`:t.includes(`win`)?`Reveal in File Explorer`:`Reveal in Files`}var Mt=120,Nt=220,Pt=4,Ft=90,It=.08,Lt=.5;function Rt(e){let[t,n]=(0,Q.useState)(0),r=(0,Q.useRef)(0);return r.current=t,(0,Q.useEffect)(()=>{if(!e){if(r.current===0)return;n(100);let e=window.setTimeout(()=>n(0),Nt);return()=>window.clearTimeout(e)}n(e=>e>0&&e<95?e:Pt);let t=window.setInterval(()=>{let e=r.current;if(e>=Ft)return;let t=Ft-e,i=Math.max(Lt,t*It);n(Math.min(Ft,e+i))},Mt);return()=>window.clearInterval(t)},[e]),t}var zt=class extends oe()(`PreviewSessionThreadKeyParseError`,{threadKey:ie}){get message(){return`Invalid scoped preview thread key: ${this.threadKey}`}},Bt=g(e=>{let t=m(e);if(t===null)throw new zt({threadKey:e});let n=v.list({environmentId:t.environmentId,input:{threadId:t.threadId}}),r=v.events({environmentId:t.environmentId,input:{}});return _(e=>{let i=!1,a=0,o=e=>{T(e)&&s(t,e.value)},c=r=>{if(!T(r)||r.value.threadId!==t.threadId)return;let i=E(t).serverEpoch;if(i!==null&&i!==r.value.serverEpoch){e.refresh(n);return}V(t,r.value)};e.addFinalizer(()=>{i=!0});let l=e.once(r);e.subscribe(n,e=>{o(e)}),e.subscribe(r,e=>{a+=1,c(e)}),queueMicrotask(()=>{i||(e.refresh(n),a===0&&c(l))})}).pipe(o(1e3),h(`preview:session-sync:${e}`))});function Vt(e){let t=(0,Z.c)(2),n;t[0]===e?n=t[1]:(n=Bt(te(e)),t[0]=e,t[1]=n),O(n)}var Ht=1500,Ut=.001;function Wt(e){let t=(0,Z.c)(11),{zoomFactor:n}=e,[r,a]=(0,Q.useState)(!1),o=(0,Q.useRef)(n),s=(0,Q.useRef)(null),c,l;t[0]===n?(c=t[1],l=t[2]):(c=()=>{if(!(Math.abs(o.current-n)<Ut))return o.current=n,a(!0),s.current!==null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{a(!1),s.current=null},Ht),()=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null)}},l=[n],t[0]=n,t[1]=c,t[2]=l),(0,Q.useEffect)(c,l);let u;t[3]===n?u=t[4]:(u=Math.round(n*100),t[3]=n,t[4]=u);let d=`${u}%`,f=!r,p=r?`opacity-100 translate-y-0`:`opacity-0 -translate-y-1`,m;t[5]===p?m=t[6]:(m=i(`pointer-events-none absolute top-3 right-3 z-20 select-none rounded-full border border-border/70 bg-popover/95 px-2.5 py-1 text-xs font-medium text-foreground shadow-md/10 backdrop-blur transition-all duration-200 ease-out`,p),t[5]=p,t[6]=m);let h;return t[7]!==d||t[8]!==f||t[9]!==m?(h=(0,$.jsx)(`div`,{"aria-hidden":f,className:m,children:d}),t[7]=d,t[8]=f,t[9]=m,t[10]=h):h=t[10],h}function Gt(e,t){return e?1:t===`human`?.18:.35}var Kt=700;function qt(e){let t=(0,Z.c)(9),{tabId:n,zoomFactor:r,controller:i}=e,a;t[0]===n?a=t[1]:(a=e=>e.byTabId[n]??null,t[0]=n,t[1]=a);let o=je(a),s;t[2]===n?s=t[3]:(s=e=>e.byTabId[n]?.content??null,t[2]=n,t[3]=s);let c=xe(s);if(!o)return null;let l;return t[4]!==c||t[5]!==i||t[6]!==o||t[7]!==r?(l=(0,$.jsx)(Jt,{event:o,content:c,zoomFactor:r,controller:i},o.sequence),t[4]=c,t[5]=i,t[6]=o,t[7]=r,t[8]=l):l=t[8],l}function Jt(e){let t=(0,Z.c)(15),{event:n,content:r,zoomFactor:i,controller:a}=e,[o,s]=(0,Q.useState)(!0),c,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=window.setTimeout(()=>s(!1),Kt);return()=>window.clearTimeout(e)},l=[],t[0]=c,t[1]=l):(c=t[0],l=t[1]),(0,Q.useEffect)(c,l);let u;t[2]!==o||t[3]!==a?(u=Gt(o,a),t[2]=o,t[3]=a,t[4]=u):u=t[4];let d=`translate3d(${n.x*i*(r?.scale??1)+(r?.x??0)-(r?.scrollLeft??0)}px, ${n.y*i*(r?.scale??1)+(r?.y??0)-(r?.scrollTop??0)}px, 0)`,f;t[5]!==u||t[6]!==d?(f={opacity:u,transform:d},t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;t[8]!==n.phase||t[9]!==n.sequence?(p=n.phase===`click`?(0,$.jsx)(`span`,{className:`absolute left-0.5 top-0.5 size-4 animate-status-ping rounded-full bg-primary/25 motion-reduce:animate-none`},n.sequence):null,t[8]=n.phase,t[9]=n.sequence,t[10]=p):p=t[10];let m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(X,{className:`relative size-5 -translate-x-0.5 -translate-y-0.5 fill-background text-primary drop-shadow-sm`,strokeWidth:2}),t[11]=m):m=t[11];let h;return t[12]!==f||t[13]!==p?(h=(0,$.jsxs)(`div`,{className:`pointer-events-none absolute left-0 top-0 z-40 transition-[transform,opacity] duration-150 ease-out motion-reduce:transition-none`,style:f,"aria-hidden":`true`,"data-agent-browser-cursor":!0,children:[p,m]}),t[12]=f,t[13]=p,t[14]=h):h=t[14],h}var Yt=typeof window>`u`?null:P();function Xt({threadRef:e,tabId:t,configuredUrls:n,visible:r}){let[i,o]=(0,Q.useState)(void 0),[s,c]=(0,Q.useState)(!1),u=Ve(),p=(0,Q.useRef)(!1),m=(0,Q.useRef)(!0),h=ee(e),g=ye(t=>ge(t.byThreadKey,e)),_=l(e=>e.addPreviewAnnotation),y=l(e=>e.addImage),x=S(e.environmentId),C=a(e.environmentId),w=B(v.open),T=B(v.resize,`preview viewport resize`),{resolvedTheme:E}=ne();Vt(e),(0,Q.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let D=t??h.activeTabId,O=D?Xe(e,h.serverEpoch,D):null,k=D&&O?u.has(O)?O:Ue(e,D):null,A=D?h.sessions[D]??null:null,j=D?h.desktopByTabId[D]??null:null;(0,Q.useEffect)(()=>{let e=K;if(!(!e||!O||!j?.pictureInPicture))return e.pictureInPicture.setVisible(O,r),()=>{e.pictureInPicture.setVisible(O,!1)}},[j?.pictureInPicture,O,r]);let M=A?.navStatus??{_tag:`Idle`},N=M._tag===`Idle`?``:M.url,re=j?.loading??M._tag===`Loading`,ie=j?.canGoBack??A?.canGoBack??!1,P=j?.canGoForward??A?.canGoForward??!1,oe=M._tag===`Idle`,L=M._tag===`LoadFailed`,R=Pe(A),V=j?.controller??`none`,ce=Rt(re),ue=N&&x&&C?rt({url:N,environmentLabel:x.label,environmentHttpBaseUrl:C})??void 0:void 0,H=A?.viewport??b,U=xe(e=>O?e.byTabId[O]?.rect??null:null),W=(0,Q.useCallback)(async t=>{O&&K?(await K.navigate(O,t),f(e,t)):await fe({openPreview:w,threadRef:e,url:t})},[w,O,e]),G=(0,Q.useCallback)(async e=>{try{await W(pe(e))}catch{}},[W]),me=(0,Q.useCallback)(async t=>{try{await W(Je(e.environmentId,t))}catch{}},[W,e.environmentId]),he=(0,Q.useCallback)(()=>{K&&O&&K.refresh(O)},[O]),_e=(0,Q.useCallback)(()=>{K&&O&&K.zoomIn(O)},[O]),ve=(0,Q.useCallback)(()=>{K&&O&&K.zoomOut(O)},[O]),q=(0,Q.useCallback)(()=>{K&&O&&K.resetZoom(O)},[O]),J=(0,Q.useCallback)(async t=>{if(!D)return;let n=await T({environmentId:e.environmentId,input:{threadId:e.threadId,tabId:D,viewport:t}});if(n._tag===`Failure`){let e=z(n);throw I.add({type:`error`,title:`Unable to resize browser viewport`,description:e instanceof Error?e.message:`An error occurred.`}),e}d(e,n.value)},[T,D,e]),Y=()=>{if(!O)return;if(H._tag!==`fill`){Ge(O,b).catch(()=>void 0);return}let e=U?We(U,j?.zoomFactor):{width:1024,height:768};Ge(O,{_tag:`freeform`,...e}).catch(()=>void 0)};(0,Q.useEffect)(()=>{if(O)return ze(O,J)},[J,O]);let X=(0,Q.useCallback)(()=>{K&&O&&K.goBack(O)},[O]),be=(0,Q.useCallback)(()=>{K&&O&&K.goForward(O)},[O]),Se=(0,Q.useCallback)(()=>{!Yt||!N||Yt.shell.openExternal(N).catch(()=>void 0)},[N]),Ce=(0,Q.useCallback)(()=>{if(D){if(g?.tabId===D){ye.getState().close(e);return}ye.getState().open(e,D),ae.getState().close(e)}},[g?.tabId,D,e]),we=(0,Q.useCallback)(()=>{!K||!O||(j?.pictureInPicture?K.pictureInPicture.close:K.pictureInPicture.open)(O).catch(e=>{I.add({type:`error`,title:`Unable to update popped-out preview`,description:e instanceof Error?e.message:`An error occurred.`})})},[j?.pictureInPicture,O]),Te=(0,Q.useCallback)(t=>{if(!K||!O||!D)return;let n=K;if(k){De(k).then(e=>{if(!e)return;let t=!1,r,i=()=>{if(!navigator.clipboard?.writeText){I.update(r,F({type:`error`,title:`Unable to copy recording path`,description:`Clipboard API unavailable.`,actionProps:a}));return}navigator.clipboard.writeText(e.path).then(()=>{t=!0,o(),window.setTimeout(()=>{t=!1,o()},2e3)},e=>{I.update(r,F({type:`error`,title:`Unable to copy recording path`,description:e instanceof Error?e.message:`An error occurred.`,actionProps:a}))})},a={children:jt(navigator.platform),onClick:()=>void n.revealArtifact(e.path)},o=()=>{I.update(r,F({type:`success`,title:`Recording saved`,actionProps:a,data:{secondaryActionProps:{children:t?`Copied!`:`Copy path`,disabled:t,onClick:i},secondaryActionVariant:`outline`}}))};r=I.add(F({type:`success`,title:`Recording saved`,actionProps:a,data:{secondaryActionProps:{children:`Copy path`,onClick:i},secondaryActionVariant:`outline`}}))},e=>{I.add({type:`error`,title:`Unable to stop recording`,description:e instanceof Error?e.message:`An error occurred.`})});return}if(t){Ne(O,e,D).catch(e=>{I.add({type:`error`,title:`Unable to start recording`,description:e instanceof Error?e.message:`An error occurred.`})});return}n.captureScreenshot(O).then(e=>{let t={children:jt(navigator.platform),onClick:()=>void n.revealArtifact(e.path)},r=!1,i=!1,a,o=(e=`success`,n=`Screenshot saved`,o)=>{I.update(a,F({type:e,title:n,description:o,actionProps:{children:i?`Copied!`:`Copy image`,disabled:i,onClick:c},data:{additionalActions:[{id:`copy-path`,props:{children:r?`Copied!`:`Copy path`,disabled:r,onClick:s}}],secondaryActionProps:{...t},secondaryActionVariant:`outline`}}))},s=()=>{if(!navigator.clipboard?.writeText){o(`error`,`Unable to copy screenshot path`,`Clipboard API unavailable.`);return}navigator.clipboard.writeText(e.path).then(()=>{r=!0,o(),window.setTimeout(()=>{r=!1,o()},2e3)},e=>{o(`error`,`Unable to copy screenshot path`,e instanceof Error?e.message:`An error occurred.`)})},c=()=>{n.copyArtifactToClipboard(e.path).then(()=>{i=!0,o(),window.setTimeout(()=>{i=!1,o()},2e3)},e=>{o(`error`,`Unable to copy screenshot`,e instanceof Error?e.message:`An error occurred.`)})};a=I.add(F({type:`success`,title:`Screenshot saved`,actionProps:{children:`Copy image`,onClick:c},data:{additionalActions:[{id:`copy-path`,props:{children:`Copy path`,onClick:s}}],secondaryActionProps:{...t},secondaryActionVariant:`outline`}}))},e=>{I.add({type:`error`,title:`Unable to capture screenshot`,description:e instanceof Error?e.message:`An error occurred.`})})},[k,O,D,e]),Ee=(0,Q.useCallback)(()=>{if(!K||!O)return;if(p.current){K.cancelPickElement(O).catch(()=>void 0);return}let t=typeof document<`u`?document.activeElement:null;p.current=!0,c(!0),(async()=>{try{let t=await K.pickElement(O);if(!t)return;_(e,t);let n=await Ye(t);n&&t.screenshot&&y(e,{type:`image`,id:t.id,name:n.name,mimeType:n.type,sizeBytes:n.size,previewUrl:t.screenshot.dataUrl,file:n})}catch{}finally{if(p.current=!1,m.current&&c(!1),t&&t.isConnected&&typeof t.focus==`function`)try{t.focus({preventScroll:!0})}catch{}}})()},[y,_,O,e]);return(0,Q.useEffect)(()=>{let e=se(N,E);e&&W(e).catch(()=>void 0)},[W,E,N]),(0,Q.useEffect)(()=>()=>{p.current&&(p.current=!1,K&&O&&K.cancelPickElement(O).catch(()=>void 0),m.current&&c(!1))},[O]),(0,Q.useEffect)(()=>{if(r)return le(e=>{switch(e){case`refresh`:he();return;case`focus-url`:o(e=>(e??0)+1);return;case`zoom-in`:_e();return;case`zoom-out`:ve();return;case`reset-zoom`:q();return;case`toggle-panel`:return}})},[he,q,_e,ve,r]),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,"data-thread-key":te(e),children:[(0,$.jsx)(tt,{url:N,displayUrl:ue,loading:re,loadProgress:ce,canGoBack:ie,canGoForward:P,refreshDisabled:oe,focusUrlNonce:i,onBack:X,onForward:be,onRefresh:he,onSubmit:e=>void G(e),onOpenInBrowser:D?Se:void 0,onCapture:K&&D?Te:void 0,captureDisabled:!j||L,recording:k!==null,onPictureInPicture:K&&D?Ce:void 0,pictureInPicture:g?.tabId===D,pictureInPictureDisabled:!j?.hasWebContents||L,onPickElement:K&&D?Ee:void 0,pickActive:s,pickDisabled:!D||L,pickDisabledReason:L?`Page didn't load — pick unavailable until the page renders`:void 0,trailingActions:K?(0,$.jsx)(_t,{tabId:O,hasWebContents:j?.hasWebContents??!1,zoomFactor:j?.zoomFactor??1,colorScheme:j?.colorScheme??`system`,deviceToolbarVisible:H._tag!==`fill`,onToggleDeviceToolbar:Y,nativePictureInPicture:j?.pictureInPicture??!1,onNativePictureInPicture:we}):null}),(0,$.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[O&&A&&!R?(0,$.jsx)(de,{tabId:O,visible:r&&!L,className:`absolute inset-0 h-full w-full`},O):null,R?(0,$.jsx)(pt,{environmentId:e.environmentId,configuredUrls:n,recentlySeenUrls:h.recentlySeenUrls,onOpenUrl:e=>void me(e)}):null,A&&j?(0,$.jsx)(Wt,{zoomFactor:j.zoomFactor}):null,O&&j&&!R&&!L?(0,$.jsx)(qt,{tabId:O,zoomFactor:j.zoomFactor,controller:V}):null,V===`none`?null:(0,$.jsx)(`div`,{className:`pointer-events-none absolute left-3 top-3 z-40 rounded-full border border-border/70 bg-background/90 px-2.5 py-1 text-[11px] font-medium shadow-sm backdrop-blur`,children:V===`agent`?`Agent controlling browser`:`Human control`}),M._tag===`LoadFailed`?(0,$.jsx)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:(0,$.jsx)(Dt,{url:M.url,code:M.code,description:M.description,onReload:he})}):null]})]})}function Zt(e){let t=(0,Z.c)(13),{mode:n,threadRef:r,tabId:i,configuredUrls:a,visible:o}=e;if(!C()){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:(0,$.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:`Preview is only available in the P4 Code desktop app.`})}),t[0]=e):e=t[0];let r;return t[1]===n?r=t[2]:(r=(0,$.jsx)(G,{mode:n,children:e}),t[1]=n,t[2]=r),r}let s;t[3]===i?s=t[4]:(s=i===void 0?{}:{tabId:i},t[3]=i,t[4]=s);let c;t[5]!==a||t[6]!==s||t[7]!==r||t[8]!==o?(c=(0,$.jsx)(Xt,{threadRef:r,...s,configuredUrls:a,visible:o}),t[5]=a,t[6]=s,t[7]=r,t[8]=o,t[9]=c):c=t[9];let l;return t[10]!==n||t[11]!==c?(l=(0,$.jsx)(G,{mode:n,children:c}),t[10]=n,t[11]=c,t[12]=l):l=t[12],l}export{Zt as PreviewPanel};
2
- //# sourceMappingURL=PreviewPanel-k_pvCFq_.js.map
@@ -1,251 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{$ as i,$a as a,Hl as o,Ia as s,Ot as c,Qa as l,Sl as u,Ua as d,Wa as f,_t as p,b as m,bl as h,bt as g,dl as _,fl as ee,gl as v,pt as y,qr as b,tu as x,vt as S,vu as C,xl as w,xt as T,yl as E,za as D}from"./previewAssetResource-DnRvGKTL.js";import{a as O,c as k,n as A,o as j,r as M,s as te,t as ne}from"./toggle-group-zEelaZr5.js";import{$ as N,G as P,Hr as re,J as ie,K as ae,U as oe,Ur as se,Vr as ce,W as le,X as ue,Xr as de,Y as fe,Z as pe,_r as me,b as he,ct as ge,di as _e,fi as ve,ft as ye,gt as be,ht as F,ii as xe,lt as Se,mt as Ce,ni as we,pt as Te,q as Ee,ti as De,ut as Oe,vr as ke,xr as Ae,yr as je}from"./index-BZY4XTKM.js";var Me=u(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ne=u(`message-square-off`,[[`path`,{d:`M19 19H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.7.7 0 0 1 2 21.286V5a2 2 0 0 1 1.184-1.826`,key:`1wyg69`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.656 3H20a2 2 0 0 1 2 2v11.344`,key:`mhl4k6`}]]),I=e(n(),1),Pe=new Set([`pnpm-lock.yaml`,`yarn.lock`,`package-lock.json`,`bun.lockb`,`Cargo.lock`,`go.sum`,`composer.lock`,`Gemfile.lock`]),Fe=new Set([`__snapshots__`,`__generated__`,`dist`,`build`,`vendor`]),L=new Set([`__tests__`,`tests`,`test`]),R=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.cjs`];function Ie(e){let t=e.split(`/`),n=t.at(-1)??``;return Pe.has(n)||n.endsWith(`.snap`)||n.endsWith(`.min.js`)||n.endsWith(`.min.css`)||/\.generated\./.test(n)||t.slice(0,-1).some(e=>Fe.has(e))?`generated`:/\.(?:test|spec)\./.test(n)||t.slice(0,-1).some(e=>L.has(e))?`test`:`source`}function Le(e){let t=e.lastIndexOf(`.`);return t>e.lastIndexOf(`/`)?e.slice(0,t):e}function Re(e){return Le(e.split(`/`).at(-1)??``)}function ze(e,t){let n=e.split(`/`).slice(0,-1);for(let e of t.split(`/`))e===`.`||e===``||(e===`..`?n.pop():n.push(e));return n.join(`/`)}var Be=/(?:\bfrom|\bimport|\brequire\s*\()\s*\(?\s*["']([^"']+)["']/g;function Ve(e,t,n,r){let i=new Set;for(let a of t){Be.lastIndex=0;let t=Be.exec(a);for(;t!==null;){let o=t[1]??``,s=o.startsWith(`.`)?ze(e,o):o,c=R.find(e=>s.endsWith(e)),l=c===void 0?s:s.slice(0,-c.length),u=n.get(l)??n.get(`${l}/index`)??r.get(Re(l));u!==void 0&&u!==e&&i.add(u),t=Be.exec(a)}}return i}function He(e,t){let n=new Set(e),r=[],i=[...e].sort((e,t)=>e.localeCompare(t));for(;n.size>0;){let e=i.filter(e=>n.has(e)),a=e.find(e=>[...t.get(e)??[]].every(e=>!n.has(e)))??e[0];n.delete(a),r.push(a)}return r}function z(e){return(e.split(`/`).at(-1)??``).replace(/\.(?:test|spec)\..*$/,``).replace(/\.[^.]+$/,``)}function Ue(e){let t=new Map;for(let n of e)t.set(F(n),n);let n=new Map;for(let e of t.keys())n.set(e,Ie(e));let r=[...t.keys()].filter(e=>n.get(e)===`source`),i=new Map,a=new Set,o=new Map;for(let e of r){i.set(Le(e),e);let t=Re(e);o.has(t)&&a.add(t),o.set(t,e)}for(let e of a)o.delete(e);let s=new Map;for(let e of r){let n=t.get(e);s.set(e,Ve(e,[...n.additionLines,...n.deletionLines],i,o))}let c=He(r,s),l=new Map;c.forEach((e,t)=>{let n=Re(e);l.has(n)||l.set(n,t)});let u=[...t.keys()].filter(e=>n.get(e)===`test`).sort((e,t)=>(l.get(z(e))??2**53-1)-(l.get(z(t))??2**53-1)||e.localeCompare(t)),d=[...t.keys()].filter(e=>n.get(e)===`generated`).sort((e,t)=>e.localeCompare(t));return[...c,...u,...d].map(e=>t.get(e))}function We(e,t){return async n=>{let r=F(n),i=n.prevName?F({...n,name:n.prevName}):r,a=await e({changeType:n.type,oldPath:i,newPath:r}),o={name:r,contents:a.newContents,cacheKey:`${t}:new:${r}`};return n.type===`rename-pure`?{oldFile:null,newFile:o}:{oldFile:{name:i,contents:a.oldContents,cacheKey:`${t}:old:${i}`},newFile:o}}}function Ge(e,t){return We(async({changeType:n,oldPath:r,newPath:i})=>{let a=await e({environmentId:t.environmentId,input:{...t.reference,...t.commit===null?{}:{commit:t.commit},changeType:n,oldPath:r,newPath:i}});if(a._tag!==`Success`)throw C(a);return a.value},t.cacheKey)}var B=r();function V(e,t,n){return!n&&(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&t.trim().length>0}var H=t();function Ke(e){let t=(0,B.c)(43),{kind:n,rangeLabel:r,text:a,onTextChange:o,onCancel:c,onComment:l,onDelete:u,placeholder:d,submitLabel:f,pending:p,secondaryAction:m}=e,h=d===void 0?`Add a comment…`:d,g=f===void 0?`Comment`:f,_=p===void 0?!1:p,[ee,v]=(0,I.useState)(``),y=n===`draft`&&!o?ee:a,b;t[0]===y?b=t[1]:(b=y.trim(),t[0]=y,t[1]=b);let x=b;if(n===`comment`){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(we,{className:`mt-0.5 size-3.5 shrink-0 text-primary/70`,"aria-hidden":`true`}),t[2]=e):e=t[2];let n;t[3]===y?n=t[4]:(n=(0,H.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap text-[13px] leading-5`,children:y}),t[3]=y,t[4]=n);let r;t[5]===u?r=t[6]:(r=u?(0,H.jsx)(s,{className:`-my-1 -mr-1 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/comment:opacity-100 focus-visible:opacity-100 max-sm:opacity-100`,variant:`ghost`,size:`icon-xs`,"aria-label":`Delete comment`,onClick:u,children:(0,H.jsx)(re,{className:`size-3`})}):null,t[5]=u,t[6]=r);let i;return t[7]!==n||t[8]!==r?(i=(0,H.jsxs)(`div`,{"data-diff-comment-annotation":!0,className:`group/comment flex min-w-0 items-start gap-2.5 border-s-2 border-primary/55 bg-primary/[0.045] px-3 py-2.5 font-sans text-foreground`,contentEditable:!1,onPointerDown:G,children:[e,n,r]}),t[7]=n,t[8]=r,t[9]=i):i=t[9],i}let S=`Comment on lines ${r}`,C;t[10]===o?C=t[11]:(C=e=>(o??v)(e.target.value),t[10]=o,t[11]=C);let w;t[12]!==c||t[13]!==l||t[14]!==_||t[15]!==x?(w=e=>{e.key===`Escape`&&(e.preventDefault(),c()),V(e,x,_)&&(e.preventDefault(),l(x))},t[12]=c,t[13]=l,t[14]=_,t[15]=x,t[16]=w):w=t[16];let T;t[17]!==y||t[18]!==h||t[19]!==S||t[20]!==C||t[21]!==w?(T=(0,H.jsx)(i,{autoFocus:!0,unstyled:!0,className:`relative inline-flex w-full rounded-md border border-border/50 bg-background/20 font-sans text-foreground transition-colors focus-within:border-border/70 [&_[data-slot=textarea]]:min-h-12 [&_[data-slot=textarea]]:cursor-text [&_[data-slot=textarea]]:px-2.5 [&_[data-slot=textarea]]:py-1.5 [&_[data-slot=textarea]]:font-sans [&_[data-slot=textarea]]:text-xs [&_[data-slot=textarea]]:leading-5 max-sm:[&_[data-slot=textarea]]:min-h-12`,size:`sm`,value:y,placeholder:h,"aria-label":S,onChange:C,onFocus:U,onKeyDown:w}),t[17]=y,t[18]=h,t[19]=S,t[20]=C,t[21]=w,t[22]=T):T=t[22];let E;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,H.jsx)(`span`,{className:`mr-auto text-[10px] text-muted-foreground/70`,children:`⌘/Ctrl Enter to send`}),t[23]=E):E=t[23];let D;t[24]===c?D=t[25]:(D=(0,H.jsx)(s,{className:`text-muted-foreground hover:text-foreground`,variant:`ghost`,size:`xs`,onClick:c,children:`Cancel`}),t[24]=c,t[25]=D);let O;t[26]!==m||t[27]!==x?(O=m?(0,H.jsxs)(s,{size:`xs`,variant:`outline`,disabled:!m.allowEmpty&&!x,onClick:()=>m.onAction(x),children:[m.icon,m.label]}):null,t[26]=m,t[27]=x,t[28]=O):O=t[28];let k=_||!x,A;t[29]!==l||t[30]!==x?(A=()=>l(x),t[29]=l,t[30]=x,t[31]=A):A=t[31];let j;t[32]!==g||t[33]!==k||t[34]!==A?(j=(0,H.jsx)(s,{size:`xs`,disabled:k,onClick:A,children:g}),t[32]=g,t[33]=k,t[34]=A,t[35]=j):j=t[35];let M;t[36]!==D||t[37]!==O||t[38]!==j?(M=(0,H.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1`,children:[E,D,O,j]}),t[36]=D,t[37]=O,t[38]=j,t[39]=M):M=t[39];let te;return t[40]!==M||t[41]!==T?(te=(0,H.jsxs)(`div`,{"data-diff-comment-annotation":!0,className:`px-3 py-2 font-sans text-foreground`,contentEditable:!1,onPointerDown:W,children:[T,M]}),t[40]=M,t[41]=T,t[42]=te):te=t[42],te}function U(e){let t=e.currentTarget.value.length;e.currentTarget.setSelectionRange(t,t)}function W(e){return e.stopPropagation()}function G(e){return e.stopPropagation()}var K=`${ge}
2
- :is(
3
- [data-line],
4
- [data-line-annotation],
5
- [data-merge-conflict],
6
- [data-merge-conflict-actions],
7
- [data-no-newline]
8
- )[data-selected-line] {
9
- --diffs-line-bg: light-dark(
10
- color-mix(
11
- in lab,
12
- var(--code-background) 88%,
13
- color-mix(in srgb, var(--code-background) 50%, var(--diffs-modified-base))
14
- ),
15
- color-mix(
16
- in lab,
17
- var(--code-background) 80%,
18
- color-mix(in srgb, var(--code-background) 70%, var(--diffs-modified-base))
19
- )
20
- ) !important;
21
- }
22
-
23
- :is([data-gutter-buffer], [data-column-number])[data-selected-line] {
24
- --diffs-line-bg: light-dark(
25
- color-mix(
26
- in lab,
27
- var(--code-background) 91%,
28
- color-mix(in srgb, var(--code-background) 35%, var(--diffs-modified-base))
29
- ),
30
- color-mix(
31
- in lab,
32
- var(--code-background) 85%,
33
- color-mix(in srgb, var(--code-background) 60%, var(--diffs-modified-base))
34
- )
35
- ) !important;
36
- }
37
-
38
- [data-indicators="bars"]
39
- :is([data-column-number], [data-gutter-buffer="annotation"])[data-selected-line] {
40
- position: relative;
41
- }
42
-
43
- [data-indicators="bars"]
44
- :is([data-column-number], [data-gutter-buffer="annotation"])[data-selected-line]::before {
45
- position: absolute !important;
46
- inset-block: 0 !important;
47
- inset-inline-start: 0 !important;
48
- display: block !important;
49
- width: 4px !important;
50
- min-width: 4px !important;
51
- max-width: 4px !important;
52
- height: auto !important;
53
- padding: 0 !important;
54
- content: "" !important;
55
- background-color: var(--diffs-modified-base) !important;
56
- background-image: none !important;
57
- }
58
-
59
- [data-file-info] {
60
- background-color: var(--code-background) !important;
61
- border-block-color: transparent !important;
62
- color: var(--code-foreground) !important;
63
- }
64
-
65
- [data-diffs-header] {
66
- position: sticky !important;
67
- top: 0;
68
- z-index: 4;
69
- background-color: var(--code-background) !important;
70
- border-bottom-color: transparent !important;
71
- align-items: center !important;
72
- font-family: var(--font-sans) !important;
73
- font-size: 12px !important;
74
- line-height: 1 !important;
75
- min-height: 32px !important;
76
- padding-block: 6px !important;
77
- padding-inline: 8px 12px !important;
78
- }
79
-
80
- [data-diffs-header]:hover {
81
- /* A native scrollbar gutter cannot be painted by descendants. Use an inset edge cue instead
82
- of a full-width band that would look accidentally clipped at the gutter. */
83
- background-color: var(--code-background) !important;
84
- box-shadow: inset 3px 0 color-mix(in srgb, var(--code-foreground) 24%, transparent);
85
- }
86
-
87
- :is([data-separator="line-info"], [data-separator="line-info-basic"]) {
88
- height: 24px !important;
89
- margin-block: 0 !important;
90
- background-color: var(--code-background) !important;
91
- }
92
-
93
- :is([data-separator="line-info"], [data-separator="line-info-basic"])
94
- [data-separator-wrapper] {
95
- padding-inline: 8px 12px !important;
96
- background-color: transparent !important;
97
- }
98
-
99
- :is([data-separator="line-info"], [data-separator="line-info-basic"])
100
- [data-separator-content] {
101
- gap: 8px;
102
- padding-inline: 0 !important;
103
- background-color: transparent !important;
104
- color: color-mix(in srgb, var(--code-foreground) 52%, var(--code-background)) !important;
105
- font-family: var(--font-sans) !important;
106
- font-size: 11px !important;
107
- text-decoration: none !important;
108
- }
109
-
110
- :is([data-separator="line-info"], [data-separator="line-info-basic"])
111
- [data-unmodified-lines] {
112
- display: flex !important;
113
- min-width: 0;
114
- flex: 1 1 auto;
115
- align-items: center;
116
- gap: 8px;
117
- }
118
-
119
- :is([data-separator="line-info"], [data-separator="line-info-basic"])[data-expand-index]
120
- [data-unmodified-lines] {
121
- cursor: pointer;
122
- }
123
-
124
- :is([data-separator="line-info"], [data-separator="line-info-basic"])
125
- [data-unmodified-lines]::before,
126
- :is([data-separator="line-info"], [data-separator="line-info-basic"])
127
- [data-unmodified-lines]::after {
128
- width: auto;
129
- height: 1px;
130
- flex: 1 1 auto;
131
- content: "";
132
- background-color: color-mix(in srgb, var(--code-background) 92%, var(--code-foreground));
133
- }
134
-
135
- :is([data-separator="line-info"], [data-separator="line-info-basic"])[data-expand-index]
136
- [data-separator-wrapper] {
137
- grid-template-columns: 0 minmax(0, 1fr) !important;
138
- }
139
-
140
- :is([data-separator="line-info"], [data-separator="line-info-basic"])[data-expand-index]
141
- [data-separator-content] {
142
- grid-column: 2 !important;
143
- }
144
-
145
- /* Visually hidden rather than display: none so the expand action stays keyboard-reachable. */
146
- :is([data-separator="line-info"], [data-separator="line-info-basic"])
147
- [data-expand-button] {
148
- position: absolute !important;
149
- width: 1px !important;
150
- height: 1px !important;
151
- margin: -1px !important;
152
- padding: 0 !important;
153
- overflow: hidden !important;
154
- clip-path: inset(50%) !important;
155
- border: 0 !important;
156
- white-space: nowrap !important;
157
- }
158
-
159
- :is([data-separator="line-info"], [data-separator="line-info-basic"]):has(
160
- [data-expand-button]
161
- )
162
- [data-separator-content] {
163
- cursor: pointer;
164
- }
165
-
166
- :is([data-separator="line-info"], [data-separator="line-info-basic"]):has(
167
- [data-expand-button]
168
- ):is(:hover, :focus-within)
169
- [data-separator-content] {
170
- color: color-mix(in srgb, var(--code-foreground) 76%, var(--code-background)) !important;
171
- }
172
-
173
- :is([data-separator="line-info"], [data-separator="line-info-basic"]):has(
174
- [data-expand-button]
175
- ):is(:hover, :focus-within)
176
- [data-unmodified-lines]::before,
177
- :is([data-separator="line-info"], [data-separator="line-info-basic"]):has(
178
- [data-expand-button]
179
- ):is(:hover, :focus-within)
180
- [data-unmodified-lines]::after {
181
- background-color: color-mix(in srgb, var(--code-background) 84%, var(--code-foreground));
182
- }
183
-
184
- [data-diffs-header] [data-header-content] {
185
- align-items: center !important;
186
- line-height: 1 !important;
187
- }
188
-
189
- [data-diffs-header] [data-metadata] {
190
- align-items: center !important;
191
- line-height: 1 !important;
192
- font-variant-numeric: tabular-nums;
193
- }
194
-
195
- [data-diffs-header] [data-additions-count],
196
- [data-diffs-header] [data-deletions-count] {
197
- font-family: var(--font-mono) !important;
198
- font-size: 11px !important;
199
- font-variant-numeric: tabular-nums;
200
- line-height: 1 !important;
201
- }
202
-
203
- [data-diffs-header] [data-change-icon],
204
- [data-diffs-header] [data-rename-icon] {
205
- display: block;
206
- flex-shrink: 0;
207
- }
208
-
209
- [data-title] {
210
- cursor: pointer;
211
- transition:
212
- color 120ms ease,
213
- text-decoration-color 120ms ease;
214
- text-decoration: underline;
215
- text-decoration-color: transparent;
216
- text-underline-offset: 2px;
217
- font-family: var(--font-sans) !important;
218
- }
219
-
220
- [data-title]:hover {
221
- color: color-mix(in srgb, var(--code-foreground) 84%, var(--primary)) !important;
222
- text-decoration-color: currentColor;
223
- }
224
-
225
- /* Expanding a file mounts its body all at once; easing it in matches the 200ms the app's
226
- collapsibles take. Appearance only — the viewer owns geometry, so height cannot animate.
227
- Departing content cuts, the same one-way rule the pull request chrome fold follows. */
228
- [data-diff],
229
- [data-file] {
230
- transition: opacity 200ms ease-out;
231
- }
232
-
233
- @starting-style {
234
- [data-diff],
235
- [data-file] {
236
- opacity: 0;
237
- }
238
- }
239
-
240
- @media (prefers-reduced-motion: reduce) {
241
- [data-diff],
242
- [data-file] {
243
- transition: none;
244
- }
245
- }
246
- `;function qe(e){let t=(0,B.c)(18),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({options:r,viewerRef:o,className:n,unsafeCSSExtra:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===o?s=t[7]:(s=o?{ref:o}:{},t[6]=o,t[7]=s);let c=n?`diff-render-surface outline-none ${n}`:`diff-render-surface outline-none`,l=a?`${K}\n${a}`:K,u,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u={diffHeaderHeight:32,hunkSeparatorHeight:24,spacing:0,paddingTop:0,paddingBottom:0},d={paddingTop:0,paddingBottom:0,gap:0},t[8]=u,t[9]=d):(u=t[8],d=t[9]);let f;t[10]!==r||t[11]!==l?(f={...r,unsafeCSS:l,itemMetrics:u,layout:d},t[10]=r,t[11]=l,t[12]=f):f=t[12];let p;return t[13]!==i||t[14]!==s||t[15]!==c||t[16]!==f?(p=(0,H.jsx)(O,{...i,...s,className:c,options:f}),t[13]=i,t[14]=s,t[15]=c,t[16]=f,t[17]=p):p=t[17],p}var Je=`mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 text-sm shadow-sm`;function Ye(e){return t=>{t.key===`Escape`&&e.onCancel&&(t.preventDefault(),e.onCancel()),V(t,e.value,e.pending)&&(t.preventDefault(),e.onSubmit())}}function Xe(e){let t=(0,B.c)(11),{comment:n,onRemove:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=a(Je,`border-dashed`),t[0]=i):i=t[0];let o,c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,H.jsx)(De,{className:`size-3.5`}),c=(0,H.jsx)(`span`,{children:`Pending — sent when you submit the review`}),t[1]=o,t[2]=c):(o=t[1],c=t[2]);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,H.jsx)(re,{className:`size-3.5`}),t[3]=l):l=t[3];let u;t[4]===r?u=t[5]:(u=(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[o,c,(0,H.jsx)(s,{size:`icon-xs`,variant:`ghost`,className:`ml-auto`,"aria-label":`Discard this comment`,onClick:r,children:l})]}),t[4]=r,t[5]=u);let d;t[6]===n.body?d=t[7]:(d=(0,H.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap leading-relaxed`,children:n.body}),t[6]=n.body,t[7]=d);let f;return t[8]!==u||t[9]!==d?(f=(0,H.jsxs)(`div`,{className:i,contentEditable:!1,onPointerDown:Ze,children:[u,d]}),t[8]=u,t[9]=d,t[10]=f):f=t[10],f}function Ze(e){return e.stopPropagation()}function Qe({thread:e,workspaceRoot:t,canReply:n,canResolve:r,canReact:a,environmentId:o,reference:c,pending:l,fixPending:u,fixLabel:d=`Fix in a thread`,onFix:f,onReply:p,canEditComment:m,onEditComment:h,onToggleResolved:g,onReacted:_}){let[ee,y]=(0,I.useState)(!e.isResolved),[b,x]=(0,I.useState)(!1),[S,C]=(0,I.useState)(``),[w,T]=(0,I.useState)(null),[E,D]=(0,I.useState)(!1),O=(0,I.useRef)(!1),k=async(e,t)=>{if(E)return;D(!0);let n=await h(e,t);D(!1),n&&T(null)},A=async()=>{let e=S.trim();if(!(e.length===0||l||O.current)){O.current=!0;try{await p(e)&&(C(``),x(!1))}finally{O.current=!1}}};return(0,H.jsxs)(`div`,{className:Je,contentEditable:!1,onPointerDown:e=>e.stopPropagation(),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e.isResolved?(0,H.jsx)(v,{className:`size-3.5 text-emerald-600 dark:text-emerald-500`}):(0,H.jsx)(Me,{className:`size-3.5`}),(0,H.jsxs)(`button`,{type:`button`,className:`hover:text-foreground`,"aria-expanded":ee,onClick:()=>y(e=>!e),children:[e.isResolved?`Resolved`:`Open`,` · `,e.comments.length,` `,e.comments.length===1?`comment`:`comments`]}),e.isOutdated?(0,H.jsx)(`span`,{children:`outdated`}):null,f?(0,H.jsxs)(s,{size:`xs`,variant:`ghost`,className:`ml-auto`,disabled:l||u,onClick:f,children:[(0,H.jsx)(xe,{className:`size-3`}),u?`Preparing...`:d]}):null,r?(0,H.jsx)(s,{size:`xs`,variant:`ghost`,className:f?void 0:`ml-auto`,disabled:l,onClick:g,children:e.isResolved?`Unresolve`:`Resolve`}):null]}),ee?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`mt-2 space-y-3`,children:e.comments.map(e=>(0,H.jsxs)(`article`,{className:`group min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(ie,{actor:e.author,className:`text-foreground`}),(0,H.jsx)(`span`,{children:Ae(e.createdAt)})]}),w===e.id?(0,H.jsx)(le,{className:`mt-1`,value:e.body,cwd:t,label:`Edit comment`,saving:E,onSave:t=>void k(e.id,t),onCancel:()=>T(null)}):(0,H.jsxs)(`div`,{className:`mt-1 flex items-start gap-1`,children:[(0,H.jsx)(P,{className:`min-w-0 flex-1 text-sm`,text:e.body,cwd:t}),m(e)?(0,H.jsx)(s,{size:`icon-xs`,variant:`ghost`,className:`shrink-0 text-muted-foreground opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100`,"aria-label":`Edit comment`,onClick:()=>T(e.id),children:(0,H.jsx)(de,{className:`size-3`})}):null]}),(0,H.jsx)(oe,{className:`mt-1.5`,reactions:e.reactions??[],canReact:a,subjectId:e.id,environmentId:o,reference:c,onRefresh:_})]},e.id))}),n?b?(0,H.jsxs)(`div`,{className:`mt-2`,children:[(0,H.jsx)(i,{autoFocus:!0,size:`sm`,value:S,placeholder:`Reply`,"aria-label":`Reply to this conversation`,onChange:e=>C(e.target.value),onKeyDown:Ye({value:S,pending:l,onSubmit:()=>void A(),onCancel:()=>x(!1)})}),(0,H.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,H.jsx)(s,{size:`xs`,variant:`ghost`,onClick:()=>x(!1),children:`Cancel`}),(0,H.jsx)(s,{size:`xs`,disabled:l||S.trim().length===0,onClick:()=>void A(),children:`Reply`})]})]}):(0,H.jsx)(s,{size:`xs`,variant:`ghost`,className:`mt-2 px-1`,onClick:()=>x(!0),children:`Reply`}):null]}):null]})}var q=0;function $e(){return q+=1,`pending-review-comment-${q}`}function et(e){return`${e.projectId}/${e.repository}#${e.number}`}var J=[],Y=x()(e=>({drafts:{},summaries:{},addComment:(t,n)=>e(e=>({drafts:{...e.drafts,[t]:[...e.drafts[t]??J,n]}})),removeComment:(t,n)=>e(e=>{let r=(e.drafts[t]??J).filter(e=>e.id!==n);if(r.length>0)return{drafts:{...e.drafts,[t]:r}};let{[t]:i,...a}=e.drafts;return{drafts:a}}),removeComments:(t,n)=>e(e=>{let r=new Set(n),i=(e.drafts[t]??J).filter(e=>!r.has(e.id));if(i.length>0)return{drafts:{...e.drafts,[t]:i}};let{[t]:a,...o}=e.drafts;return{drafts:o}}),clear:t=>e(e=>{let{[t]:n,...r}=e.drafts;return{drafts:r}}),setSummary:(t,n)=>e(e=>({summaries:{...e.summaries,[t]:n}})),clearSummary:(t,n)=>e(e=>{if(e.summaries[t]!==n)return e;let{[t]:r,...i}=e.summaries;return{summaries:i}})}));function tt(e){let t=(0,B.c)(2),n;return t[0]===e?n=t[1]:(n=t=>t.drafts[et(e)]??J,t[0]=e,t[1]=n),Y(n)}var nt=[{value:`comment`,label:`Comment`,sent:`Review submitted`,icon:(0,H.jsx)(De,{className:`size-3`})},{value:`approve`,label:`Approve`,sent:`Pull request approved`,icon:(0,H.jsx)(w,{className:`size-3`})},{value:`request-changes`,label:`Request changes`,sent:`Changes requested`,icon:(0,H.jsx)(_e,{className:`size-3`})}];function rt(e){let t=(0,B.c)(13),{environmentId:n,reference:r,verdicts:a,onSubmitted:o}=e,[c,l]=(0,I.useState)(!1),u=tt(r),d=et(r),f=Y(e=>e.summaries[d]??``),p=Y(ct),m=Y(st),h=Y(ot),g=Y(at),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_={reportFailure:!1},t[0]=_):_=t[0];let ee=T(N.submitReview,_),v;t[1]===a?v=t[2]:(v=e=>a.includes(e.value),t[1]=a,t[2]=v);let b=nt.filter(v);if(b.length===0)return null;let x=async e=>{if(c)return;let t=f,i=u;l(!0);let a=await ee({environmentId:n,input:{...r,verdict:e.value,body:t,comments:i}});if(l(!1),a._tag===`Failure`){y.add({type:`error`,title:`The review could not be submitted`});return}m(d,i.map(it)),g(d,t),y.add({type:`success`,title:e.sent}),o()},S;t[3]!==f||t[4]!==u.length?(S=e=>e===`approve`||f.trim().length>0||u.length>0,t[3]=f,t[4]=u.length,t[5]=S):S=t[5];let C=S,w=u.length===0?`No line comments yet`:`${u.length} ${u.length===1?`comment`:`comments`} pending`,E;t[6]===w?E=t[7]:(E=(0,H.jsx)(`span`,{children:w}),t[6]=w,t[7]=E);let D=u.length>0?(0,H.jsx)(s,{size:`xs`,variant:`ghost`,disabled:c,onClick:()=>p(d),children:`Discard`}):null,O;t[8]!==E||t[9]!==D?(O=(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[E,D]}),t[8]=E,t[9]=D,t[10]=O):O=t[10];let k=b.map(e=>(0,H.jsx)(s,{size:`xs`,variant:e.value===`comment`?`outline`:`default`,disabled:c||!C(e.value),onClick:()=>void x(e),children:(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.icon,e.label]})},e.value)),A;return t[11]===k?A=t[12]:(A=(0,H.jsx)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-2`,children:k}),t[11]=k,t[12]=A),(0,H.jsxs)(`div`,{className:`px-4 py-3`,children:[O,(0,H.jsx)(i,{size:`sm`,className:`mt-2`,value:f,placeholder:`Summarize your review (optional)`,"aria-label":`Review summary`,onChange:e=>h(d,e.target.value)}),A]})}function it(e){return e.id}function at(e){return e.clearSummary}function ot(e){return e.setSummary}function st(e){return e.removeComments}function ct(e){return e.clear}function lt(e,t,n){return e.hunks.some(e=>t===`left`?n>=e.deletionStart&&n<e.deletionStart+e.deletionCount:n>=e.additionStart&&n<e.additionStart+e.additionCount)}function ut(e,t,n){let r=t!==`expanded`;return n.has(e)?!r:r}var dt=10,ft=`
247
- [data-diffs-header] [data-additions-count],
248
- [data-diffs-header] [data-deletions-count] {
249
- display: none !important;
250
- }`,pt=[];function mt(e){return e===`left`?`deletions`:`additions`}function ht(e){return e===`deletions`?`left`:`right`}function X({environmentId:e,reference:t,detail:n,selectedCommitOid:r,onSelectedCommitChange:i,pendingFinding:u,fixFindingLabel:v=`Fix in a thread`,onFixFinding:x,onAddToAgentSelection:C,onRefresh:w,refreshToken:O=0}){let{resolvedTheme:P}=m(),re=ce(),[ie,oe]=(0,I.useState)(()=>new Set),[le,de]=(0,I.useState)(dt),[ge,_e]=(0,I.useState)(null),[xe,we]=(0,I.useState)(`stacked`),[Ae,Me]=(0,I.useState)(re.wordWrap),[Pe,Fe]=(0,I.useState)(null),[L,R]=(0,I.useState)(null),[Ie,Le]=(0,I.useState)(!1),[Re,ze]=(0,I.useState)(!1),[Be,Ve]=(0,I.useState)(!1),[He,z]=(0,I.useState)({key:``,cursor:null,slices:pt}),We=(0,I.useRef)(new Map),B=et(t),V=r,U=V===null?B:`${B}@${V}`;(0,I.useEffect)(()=>{R(null),Fe(null),oe(new Set),_e(null),de(dt),ze(!1),z({key:U,cursor:null,slices:pt}),We.current.clear()},[U]);let W=He.key===U?He.slices:pt,G=He.key===U?He.cursor:null,K=c(N.diff({environmentId:e,input:{...t,...G===null?{}:{cursor:G},...V===null?{}:{commit:V}}}));(0,I.useEffect)(()=>{let e=K.data;e!==null&&z(t=>{let n=t.key===U?t.slices:pt,r={cursor:G,patch:e.patch,truncated:e.truncated,nextCursor:e.nextCursor,omittedFileStats:e.omittedFileStats??[]},i=n.findIndex(e=>e.cursor===G);if(i===-1)return{key:U,cursor:G,slices:[...n,r]};let a=n[i];return a!==void 0&&a.patch===r.patch&&a.truncated===r.truncated&&a.nextCursor===r.nextCursor&&a.omittedFileStats.length===r.omittedFileStats.length&&a.omittedFileStats.every((e,t)=>{let n=r.omittedFileStats[t];return n!==void 0&&n.path===e.path&&n.additions===e.additions&&n.deletions===e.deletions})?t:{key:U,cursor:G,slices:[...n.slice(0,i),r]}})},[G,K.data,U]);let Je=o(N.diff({environmentId:e,input:{...t,...V===null?{}:{commit:V}}})),Ye=(0,I.useRef)(O);(0,I.useEffect)(()=>{Ye.current!==O&&(Ye.current=O,z({key:U,cursor:null,slices:pt}),Je())},[O,U,Je]);let Ze=B,q=tt(t),J=Y(e=>e.addComment),nt=Y(e=>e.removeComment),it=T(N.replyToThread,{reportFailure:!1}),at=T(N.setThreadResolution,{reportFailure:!1}),ot=T(N.updateComment,{reportFailure:!1}),st=T(N.diffFileContents),ct=(0,I.useMemo)(()=>Ge(st,{environmentId:e,reference:t,commit:V,cacheKey:`pull-request:${B}:${n.updatedAt}:${V??`all`}`}),[V,n.updatedAt,e,st,t,B]),X=(0,I.useMemo)(()=>{let e=n.capabilities.review,t=n.viewerPermissions;return{inlineComment:e.inlineComment&&t.comment,reply:e.reply&&t.comment,resolve:e.resolve&&t.resolve,verdicts:e.verdicts.filter(e=>t.verdicts.includes(e))}},[n.capabilities.review,n.viewerPermissions]),gt=X.inlineComment&&V===null,_t=(0,I.useMemo)(()=>W.map(e=>{let t=`pull-request:${U}:${P}:${e.cursor??`first`}:${Oe(e.patch)}`,n=We.current.get(t);if(n)return n;let r=Te(e.patch,t,{compactPartialHunkOffsets:!0});return r&&We.current.set(t,r),r}),[W,P,U]),Z=(0,I.useMemo)(()=>_t.flatMap(e=>e?.kind===`files`?Ue(e.files):[]),[_t]),Q=W.at(-1)?.nextCursor??null,vt=W.some(e=>e.truncated)||_t.some(e=>e?.kind===`raw`),yt=(0,I.useMemo)(()=>{let e=new Set;if(V!==null)return e;for(let t of Z){let r=F(t);for(let i of n.reviewThreads)i.path===r&&i.line!==null&&lt(t,i.side,i.line)&&e.add(i.id)}return e},[V,n.reviewThreads,Z]),$=(0,I.useMemo)(()=>Z.map(e=>{let t=Se(e),r=F(e),i=new Map,a=(e,t)=>{let n=`${e}:${t}`,r=i.get(n);if(r)return r;let a={side:e,line:t,threads:[],pending:[],draft:!1};return i.set(n,a),a};for(let e of n.reviewThreads)e.path!==r||e.line===null||yt.has(e.id)&&a(e.side,e.line).threads.push(e);if(V===null)for(let e of q)e.path===r&&a(e.side,e.line).pending.push(e);L?.fileKey===t&&(a(L.side,L.line).draft=!0);let o=ut(t,ge,ie),s=[...i.values()].map(e=>({side:mt(e.side),lineNumber:e.line,metadata:{threads:e.threads,pending:e.pending,draft:e.draft}}));return{id:t,type:`diff`,fileDiff:e,annotations:s,collapsed:o,version:Oe(`${o?`1`:`0`}:${s.map(({side:e,lineNumber:t,metadata:n})=>`${e}:${t}:${n.draft?`d`:``}:${n.pending.map(e=>`${e.id}:${e.body}`).join(`,`)}:${n.threads.map(e=>`${e.id}:${e.isResolved?`r`:``}:${e.isOutdated?`o`:``}:${e.comments.map(e=>`${e.id}:${e.author?.login??``}:${e.createdAt}:${e.body}:${(e.reactions??[]).map(e=>`${e.content}:${e.count}:${e.viewerHasReacted?`v`:``}`).join(`,`)}`).join(`;`)}`).join(`,`)}`).join(`|`)}`)}}),[V,n.reviewThreads,L,Z,ge,q,yt,ie]),bt=(0,I.useMemo)(()=>ye(Z),[Z]),xt=(0,I.useMemo)(()=>new Map(W.flatMap(e=>e.omittedFileStats.map(e=>[e.path,e]))),[W]),St=(0,I.useMemo)(()=>$.map(e=>e.id),[$]),Ct=(0,I.useMemo)(()=>new Set($.filter(e=>e.collapsed===!0).map(e=>e.id)),[$]),wt=M(St,Ct),[Tt,Et]=(0,I.useState)(null);(0,I.useEffect)(()=>{if(Tt===null||Q===null||Q===G||K.isPending||K.error!==null)return;let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&z(e=>({...e,cursor:Q}))},{rootMargin:`240px`});return e.observe(Tt),()=>e.disconnect()},[G,K.error,K.isPending,Q,Tt]);let Dt=(0,I.useCallback)(e=>oe(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[]),Ot=()=>{_e(M(St,Ct)?`expanded`:`folded`),oe(new Set)},kt=(0,I.useMemo)(()=>n.commits.toSorted((e,t)=>Date.parse(t.committedDate)-Date.parse(e.committedDate)),[n.commits]),At=(0,I.useCallback)((e,t)=>{if(!e||!gt)return;let n=t.item;if(n.type!==`diff`)return;let r=Z.find(e=>Se(e)===n.id);if(!r)return;let i=F(r),a=be(r);R({fileKey:n.id,path:i,oldPath:a===i?null:a,line:e.end,side:ht(e.endSide??e.side),range:e})},[gt,Z]),jt=(0,I.useCallback)((e,t,r)=>{let i=Z.find(t=>Se(t)===e.fileKey),a=i===void 0?null:b({id:`pull-request-selection:${e.fileKey}:${e.range.start}:${e.range.end}`,sectionId:`pull-request:${n.number}`,sectionTitle:`PR #${n.number} review`,filePath:e.path,fileDiff:i,range:e.range,text:t});R(null),Fe(null),a!==null&&r(a)},[n.number,Z]),Mt=(0,I.useCallback)(()=>Q===null?null:(0,H.jsx)(`div`,{ref:Et,className:`flex items-center justify-center gap-2 py-2 text-xs text-muted-foreground`,children:K.error===null?K.isPending?`Loading more files...`:null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:`The rest of this diff could not be loaded.`}),(0,H.jsx)(s,{size:`xs`,variant:`outline`,onClick:()=>K.refresh(),children:`Retry`})]})}),[Q,K.error,K.isPending,K.refresh]),Nt=(0,I.useCallback)(e=>{let t=e.collapsed===!0;return(0,H.jsx)(`button`,{type:`button`,"aria-expanded":!t,"aria-label":t?`Expand diff`:`Collapse diff`,className:a(`mr-1 inline-flex size-5 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground`),onClick:t=>{t.stopPropagation(),Dt(e.id)},children:t?(0,H.jsx)(E,{className:`size-4`}):(0,H.jsx)(h,{className:`size-4`})})},[Dt]),Pt=(0,I.useCallback)(e=>{if(e.type!==`diff`)return null;let t=0,n=0;for(let r of e.fileDiff.hunks)t+=r.additionLines,n+=r.deletionLines;if(t===0&&n===0){let r=xt.get(F(e.fileDiff));r&&({additions:t,deletions:n}=r)}return(0,H.jsx)(fe,{additions:t,deletions:n,className:`font-mono text-[11px]`})},[xt]),Ft=(0,I.useMemo)(()=>({diffStyle:xe===`split`?`split`:`unified`,lineDiffType:`none`,overflow:Ae?`wrap`:`scroll`,theme:Ce(P),themeType:P,stickyHeaders:!0,loadDiffFiles:ct,enableGutterUtility:gt&&L===null,enableLineSelection:gt&&L===null,onGutterUtilityClick:At,onLineSelectionEnd:At}),[xe,Ae,P,ct,gt,L,At]),It=(0,I.useCallback)(async(e,t)=>{if(Ie)return!1;Le(!0);let n=await t();return Le(!1),n._tag===`Failure`?(y.add({type:`error`,title:e}),!1):(w(),!0)},[w,Ie]),Lt=(0,I.useCallback)(r=>(0,H.jsx)(Qe,{thread:r,workspaceRoot:n.workspaceRoot,canReply:X.reply,canResolve:X.resolve,canReact:n.capabilities.reactions===!0,environmentId:e,reference:t,pending:Ie,fixPending:u===Ee({kind:`thread`,thread:r}),fixLabel:v,...x?{onFix:()=>x({kind:`thread`,thread:r})}:{},onReply:n=>It(`Reply could not be posted`,()=>it({environmentId:e,input:{...t,threadId:r.id,body:n}})),canEditComment:e=>ae(n,{author:e.author,kind:`review-comment`}),onEditComment:(n,r)=>It(`The comment could not be saved`,()=>ot({environmentId:e,input:{...t,commentId:n,kind:`review-comment`,body:r}})),onToggleResolved:()=>void It(`The conversation could not be updated`,()=>at({environmentId:e,input:{...t,threadId:r.id,resolved:!r.isResolved}})),onReacted:w},`${t.projectId}#${t.number}:${r.id}`),[n,e,v,w,x,u,t,it,X.reply,X.resolve,It,at,Ie,ot]),Rt=(0,I.useCallback)(e=>(0,H.jsxs)(`div`,{className:`py-1 font-sans text-foreground`,children:[e.metadata.threads.map(Lt),e.metadata.pending.map(e=>(0,H.jsx)(Xe,{comment:e,onRemove:()=>nt(Ze,e.id)},e.id)),e.metadata.draft&&L?(0,H.jsx)(Ke,{kind:`draft`,rangeLabel:`${L.path}:${L.line}`,text:``,submitLabel:`Add to review`,...C?{secondaryAction:{label:`Add to agent`,onAction:e=>jt(L,e,t=>C({comment:t,request:e}))}}:{},onCancel:()=>{R(null),Fe(null)},onComment:e=>{J(Ze,{id:$e(),path:L.path,...L.oldPath===null?{}:{oldPath:L.oldPath},line:L.line,side:L.side,body:e}),R(null),Fe(null)}}):null]}),[J,jt,L,C,nt,Lt,Ze]),zt=X.verdicts.length===0?null:(0,H.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-10`,children:Be?(0,H.jsxs)(`div`,{className:`chat-composer-glass pointer-events-auto absolute inset-x-3 bottom-3 rounded-xl border border-border/60 shadow-lg`,children:[(0,H.jsx)(s,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":`Close review`,className:`absolute right-2 top-2`,onClick:()=>Ve(!1),children:(0,H.jsx)(_,{className:`size-3.5`})}),(0,H.jsx)(rt,{environmentId:e,reference:t,verdicts:X.verdicts,onSubmitted:()=>{w(),Ve(!1)}})]}):(0,H.jsxs)(`button`,{type:`button`,className:`chat-composer-glass pointer-events-auto absolute bottom-3 right-4 flex items-center gap-1.5 rounded-full border border-border/60 px-3 py-1.5 text-xs font-medium shadow-lg`,onClick:()=>Ve(!0),children:[(0,H.jsx)(De,{className:`size-3.5`}),`Review`,q.length>0?(0,H.jsx)(`span`,{className:`flex size-4 items-center justify-center rounded-full bg-accent text-[10px] tabular-nums text-accent-foreground`,children:q.length}):null]})}),Bt=kt.find(e=>e.oid===V);(0,I.useEffect)(()=>{V!==null&&Bt===void 0&&i(null)},[V,i,Bt]);let Vt=Bt?Bt.messageHeadline:`All commits`,Ht=(0,H.jsxs)(`div`,{className:`surface-subheader justify-between gap-2 px-4 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[kt.length>0?(0,H.jsxs)(D,{children:[(0,H.jsxs)(l,{className:`inline-flex h-6 max-w-64 items-center gap-1 rounded-md bg-accent px-2 text-xs font-medium text-accent-foreground outline-none transition-colors hover:bg-accent/80 focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Diff scope: ${Vt}`,children:[(0,H.jsx)(`span`,{className:`truncate`,children:Vt}),(0,H.jsx)(h,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,H.jsxs)(f,{align:`start`,className:`w-80`,children:[(0,H.jsx)(d,{className:V===null?`bg-foreground/[0.08]`:void 0,onClick:()=>i(null),children:(0,H.jsx)(`span`,{children:`All commits`})}),kt.slice(0,le).map(e=>(0,H.jsxs)(d,{className:e.oid===V?`bg-foreground/[0.08]`:void 0,onClick:()=>i(e.oid),children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate`,title:e.messageHeadline,children:e.messageHeadline}),(0,H.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-xs text-muted-foreground`,children:e.oid.slice(0,7)})]},e.oid)),kt.length>le?(0,H.jsx)(d,{closeOnClick:!1,onClick:()=>de(e=>e+dt),children:(0,H.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Show more (`,kt.length-le,` left)`]})}):null]})]}):null,(0,H.jsxs)(ue,{children:[(0,H.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[Z.length,` `,Z.length===1?`file`:`files`,Q===null?``:`+`]}),vt?(0,H.jsxs)(p,{children:[(0,H.jsx)(g,{render:(0,H.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,H.jsx)(ee,{"aria-label":`Some of this diff was not shown`,className:`size-3.5 text-amber-600 dark:text-amber-500`})}),(0,H.jsx)(S,{side:`bottom`,children:`The host withheld part of this diff — a binary file, or a change too large to inline.`})]}):null,V!==null&&X.inlineComment?(0,H.jsxs)(p,{children:[(0,H.jsx)(g,{render:(0,H.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,H.jsx)(Ne,{"aria-label":`Line comments are written from the whole change`,className:`size-3.5`})}),(0,H.jsx)(S,{side:`bottom`,children:`A comment is anchored to the whole change, so switch to All commits to write one.`})]}):null]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,H.jsx)(fe,{additions:bt.additions,deletions:bt.deletions,className:`mr-1`}),St.length>0?(0,H.jsxs)(p,{children:[(0,H.jsx)(g,{render:(0,H.jsx)(s,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":wt?`Expand all files`:`Collapse all files`,onClick:Ot}),children:wt?(0,H.jsx)(ve,{className:`size-3.5`}):(0,H.jsx)(k,{className:`size-3.5`})}),(0,H.jsx)(S,{side:`top`,children:wt?`Expand all files`:`Collapse all files`})]}):null,(0,H.jsxs)(A,{className:`shrink-0 gap-1`,size:`sm`,value:[xe],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&we(t)},children:[(0,H.jsx)(ne,{"aria-label":`Stacked diff view`,value:`stacked`,variant:`ghost`,children:(0,H.jsx)(j,{className:`size-3.5`})}),(0,H.jsx)(ne,{"aria-label":`Split diff view`,value:`split`,variant:`ghost`,children:(0,H.jsx)(te,{className:`size-3.5`})})]}),(0,H.jsxs)(p,{children:[(0,H.jsx)(g,{render:(0,H.jsx)(ne,{"aria-label":Ae?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`ghost`,size:`sm`,pressed:Ae,onPressedChange:e=>{Me(!!e)}}),children:(0,H.jsx)(se,{className:`size-3.5`})}),(0,H.jsx)(S,{side:`top`,children:Ae?`Disable line wrapping`:`Enable line wrapping`})]})]})]}),Ut=e=>(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Ht,(0,H.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`h-full overflow-auto`,children:e}),zt]})]});if(K.isPending&&W.length===0)return Ut((0,H.jsx)(pe,{label:`Loading pull request diff...`}));if(K.error&&W.length===0)return Ut((0,H.jsx)(`p`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:K.error}));let Wt=Q===null?_t.flatMap(e=>e?.kind===`raw`?[e]:[]):[];if(Z.length===0&&Wt.length>0)return Ut((0,H.jsx)(`div`,{className:`space-y-4 px-4 py-5`,children:Wt.map(e=>(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.reason}),(0,H.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs`,children:e.text})]},`${e.reason}:${e.text.slice(0,64)}`))}));if($.length===0&&Q===null)return Ut((0,H.jsx)(`p`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:V===null?`This pull request has no file changes.`:`This commit has no file changes.`}));let Gt=n.reviewThreads.filter(e=>!yt.has(e.id)),Kt=new Map;for(let e of Gt){let t=Kt.get(e.path);t?t.push(e):Kt.set(e.path,[e])}let qt=Wt.length===0?null:(0,H.jsx)(`div`,{className:`space-y-4 border-t border-border/60 px-4 py-5`,children:Wt.map(e=>(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.reason}),(0,H.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs`,children:e.text})]},`${e.reason}:${e.text.slice(0,64)}`))});return(0,H.jsx)(he,{children:(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Ht,Kt.size>0?(0,H.jsxs)(me,{className:`shrink-0 border-b border-border/60`,open:Re,onOpenChange:ze,children:[(0,H.jsx)(`h2`,{children:(0,H.jsxs)(je,{className:`flex w-full items-center gap-1.5 px-4 py-2 text-left text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:Q===null?`Conversations not on the current diff`:`Conversations not on the diff loaded so far`}),(0,H.jsx)(E,{"aria-hidden":!0,className:a(`size-3.5 transition-transform`,Re&&`rotate-90`)}),(0,H.jsx)(`span`,{"aria-hidden":!0,className:`tabular-nums`,children:Gt.length}),(0,H.jsx)(`span`,{className:`sr-only`,children:Gt.length===1?`1 conversation`:`${Gt.length} conversations`})]})}),(0,H.jsx)(ke,{children:(0,H.jsx)(`div`,{className:`max-h-64 space-y-3 overflow-auto px-4 pb-3`,children:[...Kt].map(([e,t])=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`truncate px-3 text-xs text-muted-foreground`,title:e,children:e}),(0,H.jsx)(`div`,{className:`mt-1 space-y-2`,children:t.map(e=>(0,H.jsxs)(`div`,{children:[e.line===null?null:(0,H.jsxs)(`p`,{className:`px-3 text-xs text-muted-foreground`,children:[`Line `,e.line]}),Lt(e)]},e.id))})]},e))})})]}):null,(0,H.jsxs)(`div`,{className:`relative min-h-0 flex-1`,onClickCapture:e=>{let t=e.nativeEvent.composedPath?.()??[];for(let e of t)if(e instanceof HTMLElement){if(e instanceof HTMLButtonElement||e instanceof HTMLAnchorElement)return;if(e.hasAttribute(`data-diffs-header`)){let t=e.querySelector(`[data-title]`)?.textContent?.trim();if(t===void 0||t===``)return;let n=$.find(e=>F(e.fileDiff)===t);n!==void 0&&Dt(n.id);return}}},children:[(0,H.jsx)(qe,{className:`h-full overflow-auto [scrollbar-gutter:stable]`,items:$,selectedLines:Pe,onSelectedLinesChange:Fe,options:Ft,renderCodeViewFooter:Mt,renderHeaderPrefix:Nt,renderHeaderMetadata:Pt,renderAnnotation:Rt,unsafeCSSExtra:ft}),zt]}),qt]})})}export{X as PullRequestCodeTab,X as default};
251
- //# sourceMappingURL=PullRequestCodeTab-ITHQrzSf.js.map