@p4code/cli 0.1.46 → 0.1.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +22 -8
- package/dist/client/assets/DiffPanel-CZ1s-Iug.js +98 -0
- package/dist/client/assets/{FilePreviewPanel-DFsoFXYz.js → FilePreviewPanel-3mponsnf.js} +4 -4
- package/dist/client/assets/PreviewPanel-CWZwRMlA.js +2 -0
- package/dist/client/assets/PullRequestCodeTab-C7nXySfj.js +251 -0
- package/dist/client/assets/arrow-right-ErO11CiL.js +2 -0
- package/dist/client/assets/{fileCommentAnnotations-Dy17abwC.js → fileCommentAnnotations-D1IJuyQs.js} +2 -2
- package/dist/client/assets/index-CEYXdFfh.js +1058 -0
- package/dist/client/assets/index-DY3A41T_.css +1 -0
- package/dist/client/assets/{renderFileChildren-uPwkTxXP.js → renderFileChildren-BgE2D-9e.js} +2 -2
- package/dist/client/assets/terminal-links-DFgxYsvC.js +46 -0
- package/dist/client/assets/{toggle-group-DSjkAIxH.js → toggle-group-D0YAb1xh.js} +2 -2
- package/dist/client/index.html +3 -3
- package/package.json +1 -1
- package/dist/client/assets/DiffPanel-CPaFbotP.js +0 -98
- package/dist/client/assets/PreviewPanel-DeS97XYl.js +0 -2
- package/dist/client/assets/PullRequestCodeTab-CgTgedYJ.js +0 -251
- package/dist/client/assets/arrow-right-04_CsPkt.js +0 -2
- package/dist/client/assets/index-C4Mhhj24.js +0 -1053
- package/dist/client/assets/index-Fl1HKL6P.css +0 -1
- package/dist/client/assets/terminal-links-FRGOm6CP.js +0 -46
|
@@ -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{$r as i,As as a,Ds as o,Ms as s,S as c,Yr as l,an as u,b as d,c as f,dc as p,fi as m,ii as ee,j as h,js as g,ks as _,pi as v,qs as y,ri as b,u as x,vn as S,w as C,y as w}from"./terminal-links-FRGOm6CP.js";import{a as T,n as E,o as D,r as O,s as k,t as A}from"./toggle-group-DSjkAIxH.js";import{Ar as j,B as M,Br as te,G as ne,H as re,Hr as ie,Jn as ae,K as oe,U as se,Ur as ce,V as le,Vr as ue,W as de,Xr as fe,Y as N,Yn as pe,_ as me,at as he,ct as ge,di as _e,dt as P,ei as ve,fi as ye,fr as be,ft as xe,ii as Se,it as Ce,lt as we,ot as Te,pi as Ee,q as De,qn as Oe,ti as ke,ui as Ae,ut as je,z as F,zr as Me}from"./index-C4Mhhj24.js";var Ne=s(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Pe=s(`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),Fe=new Set([`pnpm-lock.yaml`,`yarn.lock`,`package-lock.json`,`bun.lockb`,`Cargo.lock`,`go.sum`,`composer.lock`,`Gemfile.lock`]),L=new Set([`__snapshots__`,`__generated__`,`dist`,`build`,`vendor`]),R=new Set([`__tests__`,`tests`,`test`]),z=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.cjs`];function Ie(e){let t=e.split(`/`),n=t.at(-1)??``;return Fe.has(n)||n.endsWith(`.snap`)||n.endsWith(`.min.js`)||n.endsWith(`.min.css`)||/\.generated\./.test(n)||t.slice(0,-1).some(e=>L.has(e))?`generated`:/\.(?:test|spec)\./.test(n)||t.slice(0,-1).some(e=>R.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=z.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 B(e){return(e.split(`/`).at(-1)??``).replace(/\.(?:test|spec)\..*$/,``).replace(/\.[^.]+$/,``)}function Ue(e){let t=new Map;for(let n of e)t.set(P(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(B(e))??2**53-1)-(l.get(B(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=P(n),i=n.prevName?P({...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 p(a);return a.value},t.cacheKey)}var V=r();function H(e,t,n){return!n&&(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&t.trim().length>0}var U=t();function Ke(e){let t=(0,V.c)(43),{kind:n,rangeLabel:r,text:i,onTextChange:a,onCancel:o,onComment:s,onDelete:c,placeholder:u,submitLabel:d,pending:p,secondaryAction:m}=e,ee=u===void 0?`Add a comment…`:u,h=d===void 0?`Comment`:d,g=p===void 0?!1:p,[_,v]=(0,I.useState)(``),y=n===`draft`&&!a?_:i,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,U.jsx)(ke,{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,U.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]===c?r=t[6]:(r=c?(0,U.jsx)(l,{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:c,children:(0,U.jsx)(ue,{className:`size-3`})}):null,t[5]=c,t[6]=r);let i;return t[7]!==n||t[8]!==r?(i=(0,U.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:K,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]===a?C=t[11]:(C=e=>(a??v)(e.target.value),t[10]=a,t[11]=C);let w;t[12]!==o||t[13]!==s||t[14]!==g||t[15]!==x?(w=e=>{e.key===`Escape`&&(e.preventDefault(),o()),H(e,x,g)&&(e.preventDefault(),s(x))},t[12]=o,t[13]=s,t[14]=g,t[15]=x,t[16]=w):w=t[16];let T;t[17]!==y||t[18]!==ee||t[19]!==S||t[20]!==C||t[21]!==w?(T=(0,U.jsx)(f,{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:ee,"aria-label":S,onChange:C,onFocus:W,onKeyDown:w}),t[17]=y,t[18]=ee,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,U.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]===o?D=t[25]:(D=(0,U.jsx)(l,{className:`text-muted-foreground hover:text-foreground`,variant:`ghost`,size:`xs`,onClick:o,children:`Cancel`}),t[24]=o,t[25]=D);let O;t[26]!==m||t[27]!==x?(O=m?(0,U.jsxs)(l,{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=g||!x,A;t[29]!==s||t[30]!==x?(A=()=>s(x),t[29]=s,t[30]=x,t[31]=A):A=t[31];let j;t[32]!==h||t[33]!==k||t[34]!==A?(j=(0,U.jsx)(l,{size:`xs`,disabled:k,onClick:A,children:h}),t[32]=h,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,U.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,U.jsxs)(`div`,{"data-diff-comment-annotation":!0,className:`px-3 py-2 font-sans text-foreground`,contentEditable:!1,onPointerDown:G,children:[T,M]}),t[40]=M,t[41]=T,t[42]=te):te=t[42],te}function W(e){let t=e.currentTarget.value.length;e.currentTarget.setSelectionRange(t,t)}function G(e){return e.stopPropagation()}function K(e){return e.stopPropagation()}var q=`${Ce}
|
|
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,V.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?`${q}\n${a}`:q,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,U.jsx)(T,{...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()),H(t,e.value,e.pending)&&(t.preventDefault(),e.onSubmit())}}function Xe(e){let t=(0,V.c)(11),{comment:n,onRemove:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=v(Je,`border-dashed`),t[0]=i):i=t[0];let a,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,U.jsx)(ve,{className:`size-3.5`}),o=(0,U.jsx)(`span`,{children:`Pending — sent when you submit the review`}),t[1]=a,t[2]=o):(a=t[1],o=t[2]);let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,U.jsx)(ue,{className:`size-3.5`}),t[3]=s):s=t[3];let c;t[4]===r?c=t[5]:(c=(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[a,o,(0,U.jsx)(l,{size:`icon-xs`,variant:`ghost`,className:`ml-auto`,"aria-label":`Discard this comment`,onClick:r,children:s})]}),t[4]=r,t[5]=c);let u;t[6]===n.body?u=t[7]:(u=(0,U.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap leading-relaxed`,children:n.body}),t[6]=n.body,t[7]=u);let d;return t[8]!==c||t[9]!==u?(d=(0,U.jsxs)(`div`,{className:i,contentEditable:!1,onPointerDown:Ze,children:[c,u]}),t[8]=c,t[9]=u,t[10]=d):d=t[10],d}function Ze(e){return e.stopPropagation()}function Qe({thread:e,workspaceRoot:t,canReply:n,canResolve:r,canReact:i,environmentId:a,reference:o,pending:s,fixPending:c,fixLabel:u=`Fix in a thread`,onFix:d,onReply:p,canEditComment:m,onEditComment:ee,onToggleResolved:h,onReacted:g}){let[_,v]=(0,I.useState)(!e.isResolved),[y,b]=(0,I.useState)(!1),[x,S]=(0,I.useState)(``),[C,w]=(0,I.useState)(null),[T,E]=(0,I.useState)(!1),D=(0,I.useRef)(!1),O=async(e,t)=>{if(T)return;E(!0);let n=await ee(e,t);E(!1),n&&w(null)},k=async()=>{let e=x.trim();if(!(e.length===0||s||D.current)){D.current=!0;try{await p(e)&&(S(``),b(!1))}finally{D.current=!1}}};return(0,U.jsxs)(`div`,{className:Je,contentEditable:!1,onPointerDown:e=>e.stopPropagation(),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e.isResolved?(0,U.jsx)(_e,{className:`size-3.5 text-emerald-600 dark:text-emerald-500`}):(0,U.jsx)(Ne,{className:`size-3.5`}),(0,U.jsxs)(`button`,{type:`button`,className:`hover:text-foreground`,"aria-expanded":_,onClick:()=>v(e=>!e),children:[e.isResolved?`Resolved`:`Open`,` · `,e.comments.length,` `,e.comments.length===1?`comment`:`comments`]}),e.isOutdated?(0,U.jsx)(`span`,{children:`outdated`}):null,d?(0,U.jsxs)(l,{size:`xs`,variant:`ghost`,className:`ml-auto`,disabled:s||c,onClick:d,children:[(0,U.jsx)(Se,{className:`size-3`}),c?`Preparing...`:u]}):null,r?(0,U.jsx)(l,{size:`xs`,variant:`ghost`,className:d?void 0:`ml-auto`,disabled:s,onClick:h,children:e.isResolved?`Unresolve`:`Resolve`}):null]}),_?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`mt-2 space-y-3`,children:e.comments.map(e=>(0,U.jsxs)(`article`,{className:`group min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,U.jsx)(de,{actor:e.author,className:`text-foreground`}),(0,U.jsx)(`span`,{children:be(e.createdAt)})]}),C===e.id?(0,U.jsx)(M,{className:`mt-1`,value:e.body,cwd:t,label:`Edit comment`,saving:T,onSave:t=>void O(e.id,t),onCancel:()=>w(null)}):(0,U.jsxs)(`div`,{className:`mt-1 flex items-start gap-1`,children:[(0,U.jsx)(le,{className:`min-w-0 flex-1 text-sm`,text:e.body,cwd:t}),m(e)?(0,U.jsx)(l,{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:()=>w(e.id),children:(0,U.jsx)(fe,{className:`size-3`})}):null]}),(0,U.jsx)(F,{className:`mt-1.5`,reactions:e.reactions??[],canReact:i,subjectId:e.id,environmentId:a,reference:o,onRefresh:g})]},e.id))}),n?y?(0,U.jsxs)(`div`,{className:`mt-2`,children:[(0,U.jsx)(f,{autoFocus:!0,size:`sm`,value:x,placeholder:`Reply`,"aria-label":`Reply to this conversation`,onChange:e=>S(e.target.value),onKeyDown:Ye({value:x,pending:s,onSubmit:()=>void k(),onCancel:()=>b(!1)})}),(0,U.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,U.jsx)(l,{size:`xs`,variant:`ghost`,onClick:()=>b(!1),children:`Cancel`}),(0,U.jsx)(l,{size:`xs`,disabled:s||x.trim().length===0,onClick:()=>void k(),children:`Reply`})]})]}):(0,U.jsx)(l,{size:`xs`,variant:`ghost`,className:`mt-2 px-1`,onClick:()=>b(!0),children:`Reply`}):null]}):null]})}var J=0;function $e(){return J+=1,`pending-review-comment-${J}`}function et(e){return`${e.projectId}/${e.repository}#${e.number}`}var tt=[],Y=S()(e=>({drafts:{},summaries:{},addComment:(t,n)=>e(e=>({drafts:{...e.drafts,[t]:[...e.drafts[t]??tt,n]}})),removeComment:(t,n)=>e(e=>{let r=(e.drafts[t]??tt).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]??tt).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 nt(e){let t=(0,V.c)(2),n;return t[0]===e?n=t[1]:(n=t=>t.drafts[et(e)]??tt,t[0]=e,t[1]=n),Y(n)}var rt=[{value:`comment`,label:`Comment`,sent:`Review submitted`,icon:(0,U.jsx)(ve,{className:`size-3`})},{value:`approve`,label:`Approve`,sent:`Pull request approved`,icon:(0,U.jsx)(g,{className:`size-3`})},{value:`request-changes`,label:`Request changes`,sent:`Changes requested`,icon:(0,U.jsx)(Ae,{className:`size-3`})}];function it(e){let t=(0,V.c)(13),{environmentId:n,reference:r,verdicts:i,onSubmitted:a}=e,[o,s]=(0,I.useState)(!1),c=nt(r),u=et(r),d=Y(e=>e.summaries[u]??``),p=Y(lt),m=Y(ct),ee=Y(st),h=Y(ot),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g={reportFailure:!1},t[0]=g):g=t[0];let _=C(N.submitReview,g),v;t[1]===i?v=t[2]:(v=e=>i.includes(e.value),t[1]=i,t[2]=v);let y=rt.filter(v);if(y.length===0)return null;let b=async e=>{if(o)return;let t=d,i=c;s(!0);let l=await _({environmentId:n,input:{...r,verdict:e.value,body:t,comments:i}});if(s(!1),l._tag===`Failure`){j.add({type:`error`,title:`The review could not be submitted`});return}m(u,i.map(at)),h(u,t),j.add({type:`success`,title:e.sent}),a()},x;t[3]!==d||t[4]!==c.length?(x=e=>e===`approve`||d.trim().length>0||c.length>0,t[3]=d,t[4]=c.length,t[5]=x):x=t[5];let S=x,w=c.length===0?`No line comments yet`:`${c.length} ${c.length===1?`comment`:`comments`} pending`,T;t[6]===w?T=t[7]:(T=(0,U.jsx)(`span`,{children:w}),t[6]=w,t[7]=T);let E=c.length>0?(0,U.jsx)(l,{size:`xs`,variant:`ghost`,disabled:o,onClick:()=>p(u),children:`Discard`}):null,D;t[8]!==T||t[9]!==E?(D=(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[T,E]}),t[8]=T,t[9]=E,t[10]=D):D=t[10];let O=y.map(e=>(0,U.jsx)(l,{size:`xs`,variant:e.value===`comment`?`outline`:`default`,disabled:o||!S(e.value),onClick:()=>void b(e),children:(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.icon,e.label]})},e.value)),k;return t[11]===O?k=t[12]:(k=(0,U.jsx)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-2`,children:O}),t[11]=O,t[12]=k),(0,U.jsxs)(`div`,{className:`px-4 py-3`,children:[D,(0,U.jsx)(f,{size:`sm`,className:`mt-2`,value:d,placeholder:`Summarize your review (optional)`,"aria-label":`Review summary`,onChange:e=>ee(u,e.target.value)}),k]})}function at(e){return e.id}function ot(e){return e.clearSummary}function st(e){return e.setSummary}function ct(e){return e.removeComments}function lt(e){return e.clear}function ut(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 dt(e,t,n){let r=t!==`expanded`;return n.has(e)?!r:r}var ft=10,pt=`
|
|
247
|
-
[data-diffs-header] [data-additions-count],
|
|
248
|
-
[data-diffs-header] [data-deletions-count] {
|
|
249
|
-
display: none !important;
|
|
250
|
-
}`,mt=[];function ht(e){return e===`left`?`deletions`:`additions`}function gt(e){return e===`deletions`?`left`:`right`}function X({environmentId:e,reference:t,detail:n,selectedCommitOid:r,onSelectedCommitChange:s,pendingFinding:f,fixFindingLabel:p=`Fix in a thread`,onFixFinding:g,onAskAboutSelection:S,onRefresh:T,refreshToken:M=0}){let{resolvedTheme:le}=x(),ue=Me(),[de,fe]=(0,I.useState)(()=>new Set),[_e,be]=(0,I.useState)(ft),[Se,Ce]=(0,I.useState)(null),[ke,Ae]=(0,I.useState)(`stacked`),[F,Ne]=(0,I.useState)(ue.wordWrap),[Fe,L]=(0,I.useState)(null),[R,z]=(0,I.useState)(null),[Ie,Le]=(0,I.useState)(!1),[Re,ze]=(0,I.useState)(!1),[Be,Ve]=(0,I.useState)(!1),[He,B]=(0,I.useState)({key:``,cursor:null,slices:mt}),We=(0,I.useRef)(new Map),V=et(t),H=r,W=H===null?V:`${V}@${H}`;(0,I.useEffect)(()=>{z(null),L(null),fe(new Set),Ce(null),be(ft),ze(!1),B({key:W,cursor:null,slices:mt}),We.current.clear()},[W]);let G=He.key===W?He.slices:mt,K=He.key===W?He.cursor:null,q=h(N.diff({environmentId:e,input:{...t,...K===null?{}:{cursor:K},...H===null?{}:{commit:H}}}));(0,I.useEffect)(()=>{let e=q.data;e!==null&&B(t=>{let n=t.key===W?t.slices:mt,r={cursor:K,patch:e.patch,truncated:e.truncated,nextCursor:e.nextCursor,omittedFileStats:e.omittedFileStats??[]},i=n.findIndex(e=>e.cursor===K);if(i===-1)return{key:W,cursor:K,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:W,cursor:K,slices:[...n.slice(0,i),r]}})},[K,q.data,W]);let Je=y(N.diff({environmentId:e,input:{...t,...H===null?{}:{commit:H}}})),Ye=(0,I.useRef)(M);(0,I.useEffect)(()=>{Ye.current!==M&&(Ye.current=M,B({key:W,cursor:null,slices:mt}),Je())},[M,W,Je]);let Ze=V,J=nt(t),tt=Y(e=>e.addComment),rt=Y(e=>e.removeComment),at=C(N.replyToThread,{reportFailure:!1}),ot=C(N.setThreadResolution,{reportFailure:!1}),st=C(N.updateComment,{reportFailure:!1}),ct=C(N.diffFileContents),lt=(0,I.useMemo)(()=>Ge(ct,{environmentId:e,reference:t,commit:H,cacheKey:`pull-request:${V}:${n.updatedAt}:${H??`all`}`}),[H,n.updatedAt,e,ct,t,V]),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]),_t=X.inlineComment&&H===null,vt=(0,I.useMemo)(()=>G.map(e=>{let t=`pull-request:${W}:${le}:${e.cursor??`first`}:${Te(e.patch)}`,n=We.current.get(t);if(n)return n;let r=we(e.patch,t,{compactPartialHunkOffsets:!0});return r&&We.current.set(t,r),r}),[G,le,W]),Z=(0,I.useMemo)(()=>vt.flatMap(e=>e?.kind===`files`?Ue(e.files):[]),[vt]),Q=G.at(-1)?.nextCursor??null,yt=G.some(e=>e.truncated)||vt.some(e=>e?.kind===`raw`),bt=(0,I.useMemo)(()=>{let e=new Set;if(H!==null)return e;for(let t of Z){let r=P(t);for(let i of n.reviewThreads)i.path===r&&i.line!==null&&ut(t,i.side,i.line)&&e.add(i.id)}return e},[H,n.reviewThreads,Z]),$=(0,I.useMemo)(()=>Z.map(e=>{let t=he(e),r=P(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||bt.has(e.id)&&a(e.side,e.line).threads.push(e);if(H===null)for(let e of J)e.path===r&&a(e.side,e.line).pending.push(e);R?.fileKey===t&&(a(R.side,R.line).draft=!0);let o=dt(t,Se,de),s=[...i.values()].map(e=>({side:ht(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:Te(`${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(`|`)}`)}}),[H,n.reviewThreads,R,Z,Se,J,bt,de]),xt=(0,I.useMemo)(()=>ge(Z),[Z]),St=(0,I.useMemo)(()=>new Map(G.flatMap(e=>e.omittedFileStats.map(e=>[e.path,e]))),[G]),Ct=(0,I.useMemo)(()=>$.map(e=>e.id),[$]),wt=(0,I.useMemo)(()=>new Set($.filter(e=>e.collapsed===!0).map(e=>e.id)),[$]),Tt=O(Ct,wt),[Et,Dt]=(0,I.useState)(null);(0,I.useEffect)(()=>{if(Et===null||Q===null||Q===K||q.isPending||q.error!==null)return;let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&B(e=>({...e,cursor:Q}))},{rootMargin:`240px`});return e.observe(Et),()=>e.disconnect()},[K,q.error,q.isPending,Q,Et]);let Ot=(0,I.useCallback)(e=>fe(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[]),kt=()=>{Ce(O(Ct,wt)?`expanded`:`folded`),fe(new Set)},At=(0,I.useMemo)(()=>n.commits.toSorted((e,t)=>Date.parse(t.committedDate)-Date.parse(e.committedDate)),[n.commits]),jt=(0,I.useCallback)((e,t)=>{if(!e||!_t)return;let n=t.item;if(n.type!==`diff`)return;let r=Z.find(e=>he(e)===n.id);if(!r)return;let i=P(r),a=xe(r);z({fileKey:n.id,path:i,oldPath:a===i?null:a,line:e.end,side:gt(e.endSide??e.side),range:e})},[_t,Z]),Mt=(0,I.useCallback)((e,t)=>{let r=Z.find(t=>he(t)===e.fileKey),i=r===void 0?null:u({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:r,range:e.range,text:t});z(null),L(null),!(i===null||!S)&&S({comment:i,question:t})},[n.number,Z,S]),Nt=(0,I.useCallback)(()=>Q===null?null:(0,U.jsx)(`div`,{ref:Dt,className:`flex items-center justify-center gap-2 py-2 text-xs text-muted-foreground`,children:q.error===null?q.isPending?`Loading more files...`:null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:`The rest of this diff could not be loaded.`}),(0,U.jsx)(l,{size:`xs`,variant:`outline`,onClick:()=>q.refresh(),children:`Retry`})]})}),[Q,q.error,q.isPending,q.refresh]),Pt=(0,I.useCallback)(e=>{let t=e.collapsed===!0;return(0,U.jsx)(`button`,{type:`button`,"aria-expanded":!t,"aria-label":t?`Expand diff`:`Collapse diff`,className:v(`mr-1 inline-flex size-5 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground`),onClick:t=>{t.stopPropagation(),Ot(e.id)},children:t?(0,U.jsx)(_,{className:`size-4`}):(0,U.jsx)(a,{className:`size-4`})})},[Ot]),Ft=(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=St.get(P(e.fileDiff));r&&({additions:t,deletions:n}=r)}return(0,U.jsx)(ne,{additions:t,deletions:n,className:`font-mono text-[11px]`})},[St]),It=(0,I.useMemo)(()=>({diffStyle:ke===`split`?`split`:`unified`,lineDiffType:`none`,overflow:F?`wrap`:`scroll`,theme:je(le),themeType:le,stickyHeaders:!0,loadDiffFiles:lt,enableGutterUtility:_t&&R===null,enableLineSelection:_t&&R===null,onGutterUtilityClick:jt,onLineSelectionEnd:jt}),[ke,F,le,lt,_t,R,jt]),Lt=(0,I.useCallback)(async(e,t)=>{if(Ie)return!1;Le(!0);let n=await t();return Le(!1),n._tag===`Failure`?(j.add({type:`error`,title:e}),!1):(T(),!0)},[T,Ie]),Rt=(0,I.useCallback)(r=>(0,U.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:f===se({kind:`thread`,thread:r}),fixLabel:p,...g?{onFix:()=>g({kind:`thread`,thread:r})}:{},onReply:n=>Lt(`Reply could not be posted`,()=>at({environmentId:e,input:{...t,threadId:r.id,body:n}})),canEditComment:e=>re(n,{author:e.author,kind:`review-comment`}),onEditComment:(n,r)=>Lt(`The comment could not be saved`,()=>st({environmentId:e,input:{...t,commentId:n,kind:`review-comment`,body:r}})),onToggleResolved:()=>void Lt(`The conversation could not be updated`,()=>ot({environmentId:e,input:{...t,threadId:r.id,resolved:!r.isResolved}})),onReacted:T},`${t.projectId}#${t.number}:${r.id}`),[n,e,p,T,g,f,t,at,X.reply,X.resolve,Lt,ot,Ie,st]),zt=(0,I.useCallback)(e=>(0,U.jsxs)(`div`,{className:`py-1 font-sans text-foreground`,children:[e.metadata.threads.map(Rt),e.metadata.pending.map(e=>(0,U.jsx)(Xe,{comment:e,onRemove:()=>rt(Ze,e.id)},e.id)),e.metadata.draft&&R?(0,U.jsx)(Ke,{kind:`draft`,rangeLabel:`${R.path}:${R.line}`,text:``,submitLabel:`Add to review`,...S?{secondaryAction:{label:`Ask`,icon:(0,U.jsx)(ce,{className:`size-3`}),allowEmpty:!0,onAction:e=>Mt(R,e)}}:{},onCancel:()=>{z(null),L(null)},onComment:e=>{tt(Ze,{id:$e(),path:R.path,...R.oldPath===null?{}:{oldPath:R.oldPath},line:R.line,side:R.side,body:e}),z(null),L(null)}}):null]}),[tt,Mt,R,S,rt,Rt,Ze]),Bt=X.verdicts.length===0?null:(0,U.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-10`,children:Be?(0,U.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,U.jsx)(l,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":`Close review`,className:`absolute right-2 top-2`,onClick:()=>Ve(!1),children:(0,U.jsx)(o,{className:`size-3.5`})}),(0,U.jsx)(it,{environmentId:e,reference:t,verdicts:X.verdicts,onSubmitted:()=>{T(),Ve(!1)}})]}):(0,U.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,U.jsx)(ve,{className:`size-3.5`}),`Review`,J.length>0?(0,U.jsx)(`span`,{className:`flex size-4 items-center justify-center rounded-full bg-accent text-[10px] tabular-nums text-accent-foreground`,children:J.length}):null]})}),Vt=At.find(e=>e.oid===H);(0,I.useEffect)(()=>{H!==null&&Vt===void 0&&s(null)},[H,s,Vt]);let Ht=Vt?Vt.messageHeadline:`All commits`,Ut=(0,U.jsxs)(`div`,{className:`surface-subheader justify-between gap-2 px-4 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[At.length>0?(0,U.jsxs)(i,{children:[(0,U.jsxs)(m,{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: ${Ht}`,children:[(0,U.jsx)(`span`,{className:`truncate`,children:Ht}),(0,U.jsx)(a,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,U.jsxs)(ee,{align:`start`,className:`w-80`,children:[(0,U.jsx)(b,{className:H===null?`bg-foreground/[0.08]`:void 0,onClick:()=>s(null),children:(0,U.jsx)(`span`,{children:`All commits`})}),At.slice(0,_e).map(e=>(0,U.jsxs)(b,{className:e.oid===H?`bg-foreground/[0.08]`:void 0,onClick:()=>s(e.oid),children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,title:e.messageHeadline,children:e.messageHeadline}),(0,U.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-xs text-muted-foreground`,children:e.oid.slice(0,7)})]},e.oid)),At.length>_e?(0,U.jsx)(b,{closeOnClick:!1,onClick:()=>be(e=>e+ft),children:(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Show more (`,At.length-_e,` left)`]})}):null]})]}):null,(0,U.jsxs)(oe,{children:[(0,U.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[Z.length,` `,Z.length===1?`file`:`files`,Q===null?``:`+`]}),yt?(0,U.jsxs)(w,{children:[(0,U.jsx)(c,{render:(0,U.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,U.jsx)(te,{"aria-label":`Some of this diff was not shown`,className:`size-3.5 text-amber-600 dark:text-amber-500`})}),(0,U.jsx)(d,{side:`bottom`,children:`The host withheld part of this diff — a binary file, or a change too large to inline.`})]}):null,H!==null&&X.inlineComment?(0,U.jsxs)(w,{children:[(0,U.jsx)(c,{render:(0,U.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,U.jsx)(Pe,{"aria-label":`Line comments are written from the whole change`,className:`size-3.5`})}),(0,U.jsx)(d,{side:`bottom`,children:`A comment is anchored to the whole change, so switch to All commits to write one.`})]}):null]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(ne,{additions:xt.additions,deletions:xt.deletions,className:`mr-1`}),Ct.length>0?(0,U.jsxs)(w,{children:[(0,U.jsx)(c,{render:(0,U.jsx)(l,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":Tt?`Expand all files`:`Collapse all files`,onClick:kt}),children:Tt?(0,U.jsx)(ye,{className:`size-3.5`}):(0,U.jsx)(Ee,{className:`size-3.5`})}),(0,U.jsx)(d,{side:`top`,children:Tt?`Expand all files`:`Collapse all files`})]}):null,(0,U.jsxs)(E,{className:`shrink-0 gap-1`,size:`sm`,value:[ke],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&Ae(t)},children:[(0,U.jsx)(A,{"aria-label":`Stacked diff view`,value:`stacked`,variant:`ghost`,children:(0,U.jsx)(D,{className:`size-3.5`})}),(0,U.jsx)(A,{"aria-label":`Split diff view`,value:`split`,variant:`ghost`,children:(0,U.jsx)(k,{className:`size-3.5`})})]}),(0,U.jsxs)(w,{children:[(0,U.jsx)(c,{render:(0,U.jsx)(A,{"aria-label":F?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`ghost`,size:`sm`,pressed:F,onPressedChange:e=>{Ne(!!e)}}),children:(0,U.jsx)(ie,{className:`size-3.5`})}),(0,U.jsx)(d,{side:`top`,children:F?`Disable line wrapping`:`Enable line wrapping`})]})]})]}),Wt=e=>(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Ut,(0,U.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`h-full overflow-auto`,children:e}),Bt]})]});if(q.isPending&&G.length===0)return Wt((0,U.jsx)(De,{label:`Loading pull request diff...`}));if(q.error&&G.length===0)return Wt((0,U.jsx)(`p`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:q.error}));let Gt=Q===null?vt.flatMap(e=>e?.kind===`raw`?[e]:[]):[];if(Z.length===0&&Gt.length>0)return Wt((0,U.jsx)(`div`,{className:`space-y-4 px-4 py-5`,children:Gt.map(e=>(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.reason}),(0,U.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 Wt((0,U.jsx)(`p`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:H===null?`This pull request has no file changes.`:`This commit has no file changes.`}));let Kt=n.reviewThreads.filter(e=>!bt.has(e.id)),qt=new Map;for(let e of Kt){let t=qt.get(e.path);t?t.push(e):qt.set(e.path,[e])}let Jt=Gt.length===0?null:(0,U.jsx)(`div`,{className:`space-y-4 border-t border-border/60 px-4 py-5`,children:Gt.map(e=>(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.reason}),(0,U.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs`,children:e.text})]},`${e.reason}:${e.text.slice(0,64)}`))});return(0,U.jsx)(me,{children:(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Ut,qt.size>0?(0,U.jsxs)(Oe,{className:`shrink-0 border-b border-border/60`,open:Re,onOpenChange:ze,children:[(0,U.jsx)(`h2`,{children:(0,U.jsxs)(pe,{className:`flex w-full items-center gap-1.5 px-4 py-2 text-left text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:Q===null?`Conversations not on the current diff`:`Conversations not on the diff loaded so far`}),(0,U.jsx)(_,{"aria-hidden":!0,className:v(`size-3.5 transition-transform`,Re&&`rotate-90`)}),(0,U.jsx)(`span`,{"aria-hidden":!0,className:`tabular-nums`,children:Kt.length}),(0,U.jsx)(`span`,{className:`sr-only`,children:Kt.length===1?`1 conversation`:`${Kt.length} conversations`})]})}),(0,U.jsx)(ae,{children:(0,U.jsx)(`div`,{className:`max-h-64 space-y-3 overflow-auto px-4 pb-3`,children:[...qt].map(([e,t])=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`truncate px-3 text-xs text-muted-foreground`,title:e,children:e}),(0,U.jsx)(`div`,{className:`mt-1 space-y-2`,children:t.map(e=>(0,U.jsxs)(`div`,{children:[e.line===null?null:(0,U.jsxs)(`p`,{className:`px-3 text-xs text-muted-foreground`,children:[`Line `,e.line]}),Rt(e)]},e.id))})]},e))})})]}):null,(0,U.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=>P(e.fileDiff)===t);n!==void 0&&Ot(n.id);return}}},children:[(0,U.jsx)(qe,{className:`h-full overflow-auto [scrollbar-gutter:stable]`,items:$,selectedLines:Fe,onSelectedLinesChange:L,options:It,renderCodeViewFooter:Nt,renderHeaderPrefix:Pt,renderHeaderMetadata:Ft,renderAnnotation:zt,unsafeCSSExtra:pt}),Bt]}),Jt]})})}export{X as PullRequestCodeTab,X as default};
|
|
251
|
-
//# sourceMappingURL=PullRequestCodeTab-CgTgedYJ.js.map
|