@p4code/cli 0.1.43 → 0.1.44

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