@knpkv/codecommit-web 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,T as y,U as b,V as x,W as S,X as C,Y as ee,Z as te,_ as ne,a as re,b as ie,c as ae,d as w,et as T,f as E,g as oe,h as se,i as D,it as ce,j as O,k as le,l as k,m as ue,n as de,nt as fe,o as A,p as pe,q as me,r as he,rt as ge,s as j,t as _e,tt as M,u as N,v as ve,w as ye,x as be,y as xe,z as P}from"./index-DQUoxciG.js";var Se=T(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),F=T(`file-pen-line`,[[`path`,{d:`M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z`,key:`ukzhwg`}],[`path`,{d:`M14.487 7.858A1 1 0 0 1 14 7V2`,key:`1klhew`}],[`path`,{d:`M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516`,key:`rxaxab`}],[`path`,{d:`M8 18h1`,key:`13wk12`}]]),Ce=T(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),we=T(`file-search`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]),Te=T(`file-symlink`,[[`path`,{d:`M4 11V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7`,key:`huwfnr`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m10 18 3-3-3-3`,key:`18f6ys`}]]),I=T(`file-x-corner`,[[`path`,{d:`M11 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5`,key:`1jo35a`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m15 17 5 5`,key:`36xl1x`}],[`path`,{d:`m20 17-5 5`,key:`vdz27y`}]]),Ee=T(`message-square-more`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 11h.01`,key:`z322tv`}],[`path`,{d:`M16 11h.01`,key:`xkw8gn`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}]]),L=e=>m.check(c(),n(),P(e),x(/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/u)),R=t([`review`,`security`,`tests`,`explain`]);g({id:L(128),name:m.check(c(),n(),P(200)),kind:R,provider:L(128),harness:L(128),model:m.check(c(),n(),P(200)),skillIds:le(L(256)).check(P(24),b())}),g({namespace:L(128),subjectId:m.check(c(),n(),P(1024)),revisionId:m.check(c(),n(),P(1024)),baseRevision:O(m.check(c(),n(),P(1024))),headRevision:m.check(c(),n(),P(1024))});var De=e=>JSON.stringify([e.namespace,e.subjectId,e.revisionId,e.baseRevision,e.headRevision]),Oe=(e,t)=>De(e)===De(t),ke=(e,t,n)=>{let r=t??n,i=e.find(({id:e})=>e===r);return i===void 0?t===null?{_tag:`Missing`}:{_tag:`Unknown`,profileId:r}:{_tag:`Resolved`,profile:i}},Ae=(e,t,n)=>t===null?{_tag:`Empty`}:Oe(e,t.identity)?n?{_tag:`Previous`,completed:t}:{_tag:`Current`,completed:t}:{_tag:`Stale`,completed:t},z=M(),je=({accessibleName:e,className:t,describeProfile:n=e=>`${e.provider} · ${e.model}`,disabled:r=!1,groupName:i=`review-profile`,label:a=`Profile`,onProfileChange:o,presentation:s=`select`,profiles:c,selectedProfileId:l})=>{let u=c.find(({id:e})=>e===l);return s===`radios`?(0,z.jsx)(`fieldset`,{"aria-label":e??a,className:t,disabled:r,children:c.map(e=>(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`input`,{checked:e.id===l,name:i,onChange:()=>o(e),type:`radio`,value:e.id}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.name}),(0,z.jsx)(`small`,{children:n(e)})]})]},e.id))}):(0,z.jsx)(A,{...t===void 0?{}:{className:t},...u===void 0?{}:{description:n(u)},label:a,size:`compact`,children:e=>(0,z.jsxs)(`select`,{...e,disabled:r||c.length===0,onChange:e=>{let t=c.find(({id:t})=>t===e.currentTarget.value);t!==void 0&&o(t)},value:u?.id??``,children:[u===void 0?(0,z.jsx)(`option`,{value:``,children:`Select a profile`}):null,c.map(e=>(0,z.jsx)(`option`,{value:e.id,children:e.name},e.id))]})})},Me=({presentation:e})=>{switch(e._tag){case`Empty`:return null;case`Current`:return(0,z.jsx)(k,{label:e.completed.profile.name,size:`compact`,tone:`progress`});case`Previous`:return(0,z.jsx)(k,{label:`Previous result`,size:`compact`,tone:`caution`});case`Stale`:return(0,z.jsx)(k,{label:`Earlier revision`,size:`compact`,tone:`caution`})}},B=ce(ge(),1),V=/(?=^diff --git)/gm,H=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Ne=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Pe=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Fe=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;Object.freeze({fromStart:0,fromEnd:0});function U(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var Ie=new TextEncoder,Le=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Re=/[\uD800-\uDFFF]/,W=1024,G=new Uint8Array(W);function ze(){G.length!==W&&(G=new Uint8Array(W))}function K(e){if(e.length===0)return e;if(Re.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;G.length<t&&(G=new Uint8Array(t));let{written:n}=Ie.encodeInto(e,G);return Le.decode(G.subarray(0,n))}function Be(e,t){return e-(t===0?0:1)}function Ve(e,t){return Be(e,t)+t}var He=4096,Ue=.5;function We(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=Ke(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}Ge(t,e)}}function Ge(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let r=n[e],i=n[e-1];if(r.type!==`change`||r.additions>0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;e<c;e++)if(o[s+e]!==l){u=!1;break}if(!u)continue;let d=0;for(;d<i.lines&&t.additionLines[i.additionLineIndex+i.lines-1-d]===l;)d++;if(d===0||e===1&&d===i.lines)continue;r.additionLineIndex-=d,r.deletionLineIndex-=d;let f=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,m=n[e+1];m?.type===`context`?(m.lines+=d,m.additionLineIndex=f,m.deletionLineIndex=p):n.splice(e+1,0,{type:`context`,lines:d,additionLineIndex:f,deletionLineIndex:p}),i.lines-=d,i.lines===0&&(n.splice(e-1,1),e--)}}function Ke(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>He)return null;let c=[];for(let t=0;t<n;t++)c.push(q(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(q(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=Je(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*Ue:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var qe=/\s+/g;function q(e){return e.replace(qe,``)}function Je(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}function Ye(e,t){try{return Xe(e,t)}finally{ze()}}function Xe(e,{cacheKey:t,isGitDiff:n=V.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=it(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=Qe(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=tt(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?Ze(i.contents):[],deletionLines:!l&&r!=null&&i!=null?Ze(r.contents):[],cacheKey:ot(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(Pe),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=K(r.trim()),n!==r&&(c.prevName=K(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?Ne:H):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=K(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=K(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=K(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=K(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=K(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=K(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(Fe)??[];t!=null&&(c.prevObjectId=K(t)),n!=null&&(c.newObjectId=K(n)),r!=null&&(c.mode=K(r))}e.startsWith(`rename from `)&&(c.prevName=K(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=K(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
2
+ `||s[s.length-1]===`\r`||s[s.length-1]===`\r
3
+ `||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:ot(p.hunkContext),hunkSpecs:K(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(a&&$e(t)&&!et(t))throw Error(`parsePatchContent: hunk has more lines than expected`);break}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=st(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=ct(t);(g==null||g.type!==`change`)&&(g=lt(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=ct(t);(g==null||g.type!==`change`)&&(g=lt(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=ct(t);(g==null||g.type!==`context`)&&(g=lt(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=U(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=U(c.deletionLines[e]))}}}if(a&&(x!==b.additionCount||S!==b.deletionCount))throw Error(`parsePatchContent: hunk line count mismatch`);b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(Be(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=Ve(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=Ve(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),We(c),c}}function Ze(e){let t=Qe(e);for(let e=0;e<t.length;e++)t[e]=K(t[e]);return t}function Qe(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
4
+ `,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function $e(e){let t=e[0];return t===`+`||t===`-`||t===` `}function et(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
5
+ `&&n!==`\r`)return!1}return!0}function tt(e){if(!e.startsWith(`@@ -`))return;let t=4,n=nt(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=nt(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=nt(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=nt(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=rt(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function nt(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function rt(e){return e.endsWith(`\r
6
+ `)?e.slice(0,-2):e.endsWith(`
7
+ `)?e.slice(0,-1):e}function it(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:at(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=at(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function at(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function ot(e){return e==null?e:K(e)}function st(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function ct(e){let t=e.slice(1);return K(t===``?`
8
+ `:t)}function lt(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var J=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends J{};function ut(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function dt(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function ft(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function pt(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function mt(e,t){return ft(e,t,``)}function ht(e,t){return pt(e,t,``)}function gt(e,t){return t.slice(0,_t(e,t))}function _t(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function vt(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function yt(e,t){if(t)return xt(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function bt(e,t){if(t)return xt(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function xt(e,t){if(!t)return[bt(e),yt(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=vt(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var St=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Ct=RegExp(`[${St}]+|\\s+|[^${St}]`,`ug`);new class extends J{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=vt(e,r)}else n=e.match(Ct)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&wt(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&wt(n,i,r,null,t.intlSegmenter),e}};function wt(e,t,n,r,i){if(t&&n){let[a,o]=xt(t.value,i),[s,c]=xt(n.value,i);if(e){let r=ut(a,s);e.value=pt(e.value,s,r),t.value=mt(t.value,r),n.value=mt(n.value,r)}if(r){let e=dt(o,c);r.value=ft(r.value,c,e),t.value=ht(t.value,e),n.value=ht(n.value,e)}}else if(n){if(e){let e=bt(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=bt(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=bt(r.value,i),[a,o]=xt(t.value,i),s=ut(n,a);t.value=mt(t.value,s);let c=dt(mt(n,s),o);t.value=ht(t.value,c),r.value=ft(r.value,n,c),e.value=pt(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=bt(r.value,i),n=gt(yt(t.value,i),e);t.value=ht(t.value,n)}else if(e){let n=gt(yt(e.value,i),bt(t.value,i));t.value=mt(t.value,n)}}new class extends J{tokenize(e){let t=RegExp(`(\\r?\\n)|[${St}]+|[^\\S\\n\\r]+|[^${St}]`,`ug`);return e.match(t)||[]}};var Tt=new class extends J{constructor(){super(...arguments),this.tokenize=Dt}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
9
+ `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
10
+ `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
11
+ `)&&(e=e.slice(0,-1)),t.endsWith(`
12
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Et(e,t,n){return Tt.diff(e,t,n)}function Dt(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
13
+ `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function Ot(e){return e==`.`||e==`!`||e==`?`}new class extends J{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(Ot(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends J{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends J{constructor(){super(...arguments),this.tokenize=Dt}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(kt(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function kt(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=kt(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=kt(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends J{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function At(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function Y(e){if(!At(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var jt={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Mt(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;Et(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(Et(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||Ft(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
14
+ `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function Nt(e,t){if(t||=jt,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>Nt(e,t)).join(`
15
+ `)}let n=[];if(e.isGit){if(t=jt,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+Y(r)+` `+Y(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+Y((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+Y((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+Y((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+Y((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+Y(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+Y(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
16
+ `)+`
17
+ `}function Pt(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Mt(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Nt(e,o.headerOptions):void 0)}}))}else{let s=Mt(e,t,n,r,i,a,o);return s?Nt(s,o?.headerOptions):void 0}}function Ft(e){let t=e.endsWith(`
18
+ `),n=e.split(`
19
+ `).map(e=>e+`
20
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var It=`/dev/null`;function Lt(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??Rt(),a=t??Rt(),o=Ye(Pt(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey??e?.name,r=t?.cacheKey??t?.name;return n!=null&&r!=null?n+`:`+r:n??r})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function Rt(){return{name:It,contents:``}}var zt=(e,t)=>{let n=e[t];if(n===void 0)throw Error(`Missing CSS Module class: ${t}`);return n},Bt=(e,t)=>{let n=e.shadowRoot;if(n===null)return null;let r=t.side===`additions`?`data-additions`:`data-deletions`,i=t.side===`additions`?`change-addition`:`change-deletion`,a=t.side===`additions`?`data-line`:`data-alt-line`;return n.querySelector(`[${r}] [data-line="${t.lineNumber}"]`)??n.querySelector(`[data-line="${t.lineNumber}"][data-line-type="${i}"]`)??n.querySelector(`[${a}="${t.lineNumber}"][data-line-type="context"]`)??n.querySelector(`[${a}="${t.lineNumber}"][data-line-type="context-expanded"]`)??n.querySelector(`[${r}] [data-alt-line="${t.lineNumber}"]`)??n.querySelector(`[${r}][data-line="${t.lineNumber}"]`)??n.querySelector(`[${r}][data-alt-line="${t.lineNumber}"]`)},Vt=(e,t)=>{let n=e.closest(`diffs-container`);return n===null?null:Bt(n,t)},Ht=(e,t)=>{let n=Vt(e,t);n!==null&&(n.tabIndex=-1,n.focus({preventScroll:!0}))},Ut=({annotation:e,className:t,returnFocus:n})=>{let r=(0,B.useRef)(null),i=()=>{if(n!==void 0){n();return}r.current!==null&&Ht(r.current,e.location)};return(0,B.createElement)(`div`,{ref:r,"aria-label":e.accessibilityLabel,className:t,"data-rly-diff-annotation":e.id,"data-rly-diff-annotation-item":e.location.itemId,"data-rly-diff-annotation-line":e.location.lineNumber,"data-rly-diff-annotation-side":e.location.side,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),i())},role:`group`,tabIndex:0},e.render({annotationId:e.id,location:e.location,returnFocus:i}))},Wt=e=>{let t=new Set;for(let n of e){if(n.id.trim().length===0||n.accessibilityLabel.trim().length===0)throw Error(`Diff annotation id and accessibility label must not be blank`);if(n.location.itemId.trim().length===0)throw Error(`Diff annotation ${n.id} location item id must not be blank`);if(!Number.isInteger(n.location.lineNumber)||n.location.lineNumber<1)throw Error(`Diff annotation ${n.id} line number must be a positive integer`);if(t.has(n.id))throw Error(`Diff annotation id ${n.id} must be unique`);t.add(n.id)}},X={root:`rly_BoundedDiffCodeView-module__root`,file:`rly_BoundedDiffCodeView-module__file`,noChanges:`rly_BoundedDiffCodeView-module__noChanges`,fileName:`rly_BoundedDiffCodeView-module__fileName`,scroller:`rly_BoundedDiffCodeView-module__scroller`,table:`rly_BoundedDiffCodeView-module__table`,hunk:`rly_BoundedDiffCodeView-module__hunk`,lineNumber:`rly_BoundedDiffCodeView-module__lineNumber`,marker:`rly_BoundedDiffCodeView-module__marker`,code:`rly_BoundedDiffCodeView-module__code`,wrappedCode:`rly_BoundedDiffCodeView-module__wrappedCode`,deletion:`rly_BoundedDiffCodeView-module__deletion`,change:`rly_BoundedDiffCodeView-module__change`,deletionCode:`rly_BoundedDiffCodeView-module__deletionCode`,addition:`rly_BoundedDiffCodeView-module__addition`,additionCode:`rly_BoundedDiffCodeView-module__additionCode`,context:`rly_BoundedDiffCodeView-module__context`,annotationRow:`rly_BoundedDiffCodeView-module__annotationRow`,annotationCell:`rly_BoundedDiffCodeView-module__annotationCell`,annotation:`rly_BoundedDiffCodeView-module__annotation`},Gt=(e,t)=>({lineNumber:e,side:t}),Z=(e,t)=>e[t]?.replace(/\r?\n$/,``)??``,Kt=e=>e.hunkSpecs?.trim()??`@@ -${e.deletionStart},${e.deletionCount} +${e.additionStart},${e.additionCount} @@`,qt=e=>{if(e.before.contents!==e.after.contents)return Lt({...e.before.cacheKey!==void 0&&{cacheKey:e.before.cacheKey},contents:e.before.contents,name:e.before.name},{...e.after.cacheKey!==void 0&&{cacheKey:e.after.cacheKey},contents:e.after.contents,name:e.after.name},void 0,!0)},Jt=(e,t)=>Array.from({length:t.lines},(n,r)=>({addition:{content:Z(e.additionLines,t.additionLineIndex+r),number:t.additionLineIndex+r+1},deletion:{content:Z(e.deletionLines,t.deletionLineIndex+r),number:t.deletionLineIndex+r+1},kind:`context`})),Yt=(e,t)=>Array.from({length:Math.max(t.deletions,t.additions)},(n,r)=>({...r<t.additions&&{addition:{content:Z(e.additionLines,t.additionLineIndex+r),number:t.additionLineIndex+r+1}},...r<t.deletions&&{deletion:{content:Z(e.deletionLines,t.deletionLineIndex+r),number:t.deletionLineIndex+r+1}},kind:`change`})),Xt=e=>e.hunks.flatMap(t=>[{kind:`hunk`,label:Kt(t)},...t.hunkContent.flatMap(t=>t.type===`context`?Jt(e,t):Yt(e,t))]),Zt=e=>e.hunks.flatMap(t=>[{kind:`hunk`,label:Kt(t)},...t.hunkContent.flatMap(t=>t.type===`context`?Array.from({length:t.lines},(n,r)=>({additionNumber:t.additionLineIndex+r+1,content:Z(e.additionLines,t.additionLineIndex+r),deletionNumber:t.deletionLineIndex+r+1,kind:`context`})):[...Array.from({length:t.deletions},(n,r)=>({content:Z(e.deletionLines,t.deletionLineIndex+r),deletionNumber:t.deletionLineIndex+r+1,kind:`deletion`})),...Array.from({length:t.additions},(n,r)=>({additionNumber:t.additionLineIndex+r+1,content:Z(e.additionLines,t.additionLineIndex+r),kind:`addition`}))])]),Qt=(e,t,n,r,i,a)=>(0,z.jsx)(`code`,{className:i?X.wrappedCode:X.code,"data-rly-diff-item":t,...a===void 0?{}:{"data-rly-diff-line-alternate":a.lineNumber,"data-rly-diff-line-side-alternate":a.side},"data-rly-diff-line":n,"data-rly-diff-line-side":r,tabIndex:-1,children:e.length===0?` `:e}),$t=(e,t,n,r)=>{let i=`[data-rly-diff-item="${CSS.escape(t)}"]`;(e?.querySelector(`${i}[data-rly-diff-line="${n}"][data-rly-diff-line-side="${r}"]`)??e?.querySelector(`${i}[data-rly-diff-line-alternate="${n}"][data-rly-diff-line-side-alternate="${r}"]`))?.focus({preventScroll:!0})},en=(e,t,n,r)=>n===void 0?[]:e.filter(e=>e.location.itemId===t&&e.location.lineNumber===n&&e.location.side===r),tn=(e,t,n,r)=>[...en(e,t,n.deletion?.number,`deletions`).map(e=>(0,z.jsxs)(`tr`,{className:X.annotationRow,children:[(0,z.jsx)(`td`,{className:X.annotationCell,colSpan:2,children:(0,z.jsx)(Ut,{annotation:e,className:zt(X,`annotation`),returnFocus:()=>$t(r(),t,e.location.lineNumber,e.location.side)})}),(0,z.jsx)(`td`,{colSpan:2})]},e.id)),...en(e,t,n.addition?.number,`additions`).map(e=>(0,z.jsxs)(`tr`,{className:X.annotationRow,children:[(0,z.jsx)(`td`,{colSpan:2}),(0,z.jsx)(`td`,{className:X.annotationCell,colSpan:2,children:(0,z.jsx)(Ut,{annotation:e,className:zt(X,`annotation`),returnFocus:()=>$t(r(),t,e.location.lineNumber,e.location.side)})})]},e.id))],nn=(e,t,n,r,i)=>(0,z.jsx)(`table`,{"aria-label":`Changes in ${e.name}`,className:X.table,children:(0,z.jsx)(`tbody`,{children:Xt(e).map((e,a)=>e.kind===`hunk`?(0,z.jsx)(`tr`,{className:X.hunk,children:(0,z.jsx)(`td`,{colSpan:4,children:e.label})},`${a}:${e.label}`):(0,z.jsxs)(B.Fragment,{children:[(0,z.jsxs)(`tr`,{className:X[e.kind],children:[(0,z.jsx)(`td`,{className:X.lineNumber,children:e.deletion?.number}),(0,z.jsx)(`td`,{className:X.deletionCode,children:e.deletion===void 0?null:Qt(e.deletion.content,t,e.deletion.number,`deletions`,i)}),(0,z.jsx)(`td`,{className:X.lineNumber,children:e.addition?.number}),(0,z.jsx)(`td`,{className:X.additionCode,children:e.addition===void 0?null:Qt(e.addition.content,t,e.addition.number,`additions`,i)})]}),tn(n,t,e,r)]},`${a}:${e.deletion?.number??``}:${e.addition?.number??``}`))})}),rn=(e,t,n,r)=>[...n.deletionNumber===void 0?[]:[Gt(n.deletionNumber,`deletions`)],...n.additionNumber===void 0?[]:[Gt(n.additionNumber,`additions`)]].flatMap(({lineNumber:n,side:i})=>en(e,t,n,i).map(e=>(0,z.jsx)(`tr`,{className:X.annotationRow,children:(0,z.jsx)(`td`,{className:X.annotationCell,colSpan:4,children:(0,z.jsx)(Ut,{annotation:e,className:zt(X,`annotation`),returnFocus:()=>$t(r(),t,n,i)})})},e.id))),an=(e,t,n,r,i)=>(0,z.jsx)(`table`,{"aria-label":`Changes in ${e.name}`,className:X.table,children:(0,z.jsx)(`tbody`,{children:Zt(e).map((e,a)=>e.kind===`hunk`?(0,z.jsx)(`tr`,{className:X.hunk,children:(0,z.jsx)(`td`,{colSpan:4,children:e.label})},`${a}:${e.label}`):(0,z.jsxs)(B.Fragment,{children:[(0,z.jsxs)(`tr`,{className:X[e.kind],children:[(0,z.jsx)(`td`,{className:X.lineNumber,children:e.deletionNumber}),(0,z.jsx)(`td`,{className:X.lineNumber,children:e.additionNumber}),(0,z.jsx)(`td`,{className:X.marker,children:e.kind===`addition`?`+`:e.kind===`deletion`?`−`:` `}),(0,z.jsx)(`td`,{children:Qt(e.content,t,e.kind===`deletion`?e.deletionNumber??0:e.additionNumber??0,e.kind===`deletion`?`deletions`:`additions`,i,e.kind===`context`&&e.deletionNumber!==void 0?{lineNumber:e.deletionNumber,side:`deletions`}:void 0)})]}),rn(n,t,e,r)]},`${a}:${e.deletionNumber??``}:${e.additionNumber??``}`))})}),on=({annotations:e=[],className:t,empty:n=`No renderable source changes.`,initialItems:r,mode:i=`split`,wrap:a=!1})=>{Wt(e);let o=(0,B.useRef)(null);return r.length===0?(0,z.jsx)(`p`,{className:t,children:n}):(0,z.jsx)(`div`,{ref:o,className:t===void 0?zt(X,`root`):`${zt(X,`root`)} ${t}`,"data-rly-diff-code-view":``,"data-rly-diff-mode":i,children:r.map(t=>{let n=qt(t);return n===void 0?(0,z.jsx)(`p`,{className:X.noChanges,children:`No textual changes in this file.`},t.id):(0,z.jsxs)(`section`,{className:X.file,children:[r.length>1?(0,z.jsx)(`h3`,{className:X.fileName,children:n.name}):null,(0,z.jsx)(`div`,{className:X.scroller,children:i===`split`?nn(n,t.id,e,()=>o.current,a):an(n,t.id,e,()=>o.current,a)})]},t.id)})})},sn={root:`rly_DiffFileTree-module__root`,header:`rly_DiffFileTree-module__header`,eyebrow:`rly_DiffFileTree-module__eyebrow`,notice:`rly_DiffFileTree-module__notice`,empty:`rly_DiffFileTree-module__empty`,error:`rly_DiffFileTree-module__error`,previousPath:`rly_DiffFileTree-module__previousPath`,count:`rly_DiffFileTree-module__count`,list:`rly_DiffFileTree-module__list`,directory:`rly_DiffFileTree-module__directory`,group:`rly_DiffFileTree-module__group`,directoryButton:`rly_DiffFileTree-module__directoryButton`,chevron:`rly_DiffFileTree-module__chevron`,directoryName:`rly_DiffFileTree-module__directoryName`,directoryCount:`rly_DiffFileTree-module__directoryCount`,file:`rly_DiffFileTree-module__file`,pathBlock:`rly_DiffFileTree-module__pathBlock`,path:`rly_DiffFileTree-module__path`,statusIcons:`rly_DiffFileTree-module__statusIcons`,statusIcon:`rly_DiffFileTree-module__statusIcon`,loadingIcon:`rly_DiffFileTree-module__loadingIcon`,"rly-diff-file-tree-spin":`rly_DiffFileTree-module__rly-diff-file-tree-spin`},Q=e=>pe(sn,e),cn=e=>e.state===`ready`?`Ready`:e.state===`loading`?E(e.label,`DiffFileTree loading label`):`${e.state}: ${E(e.reason,`DiffFileTree ${e.state} reason`)}`,ln=e=>e.split(`/`).map(e=>e!==e.trim()||/[\t\n\v\f\r]/u.test(e)?JSON.stringify(e):e).join(`/`),un=(e,t)=>{if(e.length===0)throw Error(`${t} must not be empty`);return e},dn={added:Ce,deleted:I,modified:F,renamed:Te},fn=e=>{let t=new Set;for(let n of e.files){let e=E(n.id,`DiffFileTree file id`);if(t.has(e))throw Error(`DiffFileTree file ids must be unique: ${e}`);t.add(e);let r=un(n.path,`DiffFileTree path for ${e}`);if(n.change===`renamed`&&un(n.previousPath,`DiffFileTree previousPath for ${e}`)===r)throw Error(`DiffFileTree renamed paths must differ: ${e}`);cn(n.content)}if(e.state===`loading`||e.state===`error`){if(!Number.isInteger(e.indexedCount)||!Number.isInteger(e.totalCount))throw Error(`DiffFileTree counts must be integers`);if(e.indexedCount!==e.files.length||e.totalCount<e.indexedCount)throw Error(`DiffFileTree indexedCount must match visible files and cannot exceed totalCount`);e.state===`loading`&&E(e.label,`DiffFileTree loading label`),e.state===`error`&&(E(e.title,`DiffFileTree error title`),E(e.description,`DiffFileTree error description`))}},pn=e=>{if(e.children.length!==1||e.children[0]?.kind!==`directory`)return e;let t=e.children[0];return pn({...t,name:`${e.name}/${t.name}`})},mn=(e,t=0)=>{let n=[],r=new Map;for(let i of e){let e=i.segments[t];if(e===void 0)continue;if(t===i.segments.length-1){n.push({file:i.file,kind:`file`,name:e});continue}let a=r.get(e)??[];a.push(i),r.set(e,a)}return[...Array.from(r,([e,n])=>pn({children:mn(n,t+1),fileCount:n.length,kind:`directory`,name:e,path:n[0].segments.slice(0,t+1).join(`/`)})),...n]},hn=e=>{let t=e.split(`/`);return new Set(t.slice(0,-1).map((e,n)=>t.slice(0,n+1).join(`/`)))},gn=({className:e,data:t,heading:n,onSelectedFileChange:r,selectedFileId:i,...a})=>{let o=E(n,`DiffFileTree heading`);if(fn(t),i!==void 0&&!t.files.some(e=>e.id===i))throw Error(`DiffFileTree selectedFileId is not in the visible inventory: ${i}`);let s=`rly-diff-file-tree-${(0,B.useId)()}`,c=t.state===`ready`?t.files.length:t.indexedCount,l=t.state===`ready`?t.files.length:t.totalCount,d=(0,B.useMemo)(()=>mn(t.files.map(e=>({file:e,segments:e.path.split(`/`)}))),[t.files]),[f,p]=(0,B.useState)(()=>new Set),m=t.files.find(({id:e})=>e===i)?.path;(0,B.useEffect)(()=>{if(m===void 0)return;let e=hn(m);p(t=>[...t].some(t=>e.has(t))?new Set([...t].filter(t=>!e.has(t))):t)},[m]);let h=e=>e.map(e=>{if(e.kind===`file`){let t=i===e.file.id,n=dn[e.file.change],a=e.file.content.state===`ready`?null:cn(e.file.content);return(0,z.jsx)(`li`,{"data-rly-diff-file-id":e.file.id,children:(0,z.jsxs)(`button`,{"aria-current":t?`true`:void 0,"aria-label":`${ln(e.file.path)}, ${e.file.change}, ${cn(e.file.content)}`,className:Q(`file`),"data-rly-diff-content-state":e.file.content.state,"data-rly-diff-file-change":e.file.change,onClick:()=>r(e.file.id),type:`button`,children:[(0,z.jsxs)(`span`,{className:Q(`pathBlock`),style:{paddingInlineStart:`var(--rly-space-20)`},children:[e.file.change===`renamed`?(0,z.jsx)(`span`,{className:Q(`previousPath`),children:ln(e.file.previousPath)}):null,(0,z.jsx)(`code`,{className:Q(`path`),children:ln(e.name)})]}),(0,z.jsxs)(`span`,{className:Q(`statusIcons`),children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:Q(`statusIcon`),title:e.file.change,children:(0,z.jsx)(n,{})}),a===null?null:(0,z.jsx)(`span`,{"aria-hidden":`true`,className:Q(`statusIcon`),title:a,children:e.file.content.state===`loading`?(0,z.jsx)(u,{className:Q(`loadingIcon`)}):(0,z.jsx)(te,{})})]})]})},e.file.id)}let t=!f.has(e.path);return(0,z.jsxs)(`li`,{className:Q(`directory`),"data-rly-diff-directory":e.path,children:[(0,z.jsxs)(`button`,{"aria-expanded":t,"aria-label":`${ln(e.name)}, directory, ${e.fileCount} changed ${e.fileCount===1?`file`:`files`}`,className:Q(`directoryButton`),onClick:()=>p(n=>{let r=new Set(n);return t?r.add(e.path):r.delete(e.path),r}),type:`button`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:Q(`chevron`)}),(0,z.jsx)(`code`,{className:Q(`directoryName`),children:ln(e.name)}),(0,z.jsx)(`span`,{className:Q(`directoryCount`),children:e.fileCount})]}),t?(0,z.jsx)(`ol`,{className:Q(`group`),style:{marginInlineStart:`var(--rly-space-16)`},children:h(e.children)}):null]},`directory:${e.path}`)});return(0,z.jsxs)(`nav`,{...a,"aria-busy":t.state===`loading`?`true`:void 0,"aria-labelledby":s,className:w(Q(`root`),e),"data-rly-diff-inventory-state":t.state,children:[(0,z.jsxs)(`header`,{className:Q(`header`),children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`span`,{className:Q(`eyebrow`),children:`Changed files`}),(0,z.jsx)(`h2`,{id:s,children:o})]}),(0,z.jsxs)(`strong`,{"aria-label":`${c} of ${l} files indexed`,className:Q(`count`),children:[c,`/`,l]})]}),t.state===`loading`?(0,z.jsx)(`p`,{className:Q(`notice`),role:`status`,children:t.label}):null,t.state===`error`?(0,z.jsxs)(`section`,{className:Q(`error`),role:`alert`,children:[(0,z.jsx)(`strong`,{children:t.title}),(0,z.jsx)(`span`,{children:t.description})]}):null,t.files.length===0?(0,z.jsx)(`p`,{className:Q(`empty`),children:`No changed files.`}):(0,z.jsx)(`ol`,{className:Q(`list`),children:h(d)})]})},_n=t([`pending`,`posting`,`posted`,`posted-stale`,`acknowledged`,`rejected`,`failed`]),vn=(e,t,n)=>{let r=e[t];return r===`posting`||r===`posted`||r===`posted-stale`?e:{...e,[t]:n}},yn=e=>Object.fromEntries(e.map(e=>[e.id,`pending`])),bn=e=>JSON.stringify(e),xn=(e,t,n,r)=>{let i=e.find(({id:e})=>e===t.id),a=i===void 0||bn(i)!==bn(t);return a&&r===`failed`&&i===void 0?{dispositions:n,stale:!1}:{dispositions:{...n,[t.id]:a&&r===`posted`?`posted-stale`:r},stale:a}},Sn=(e,t)=>{let n=[...e,t],r=[],i=new TextEncoder,a=2,o=0;for(let e=n.length-1;e>=0;){let t=n[e];if(t===void 0){--e;continue}let s;if(t.role===`assistant`){let r=n[e-1];if(r?.role!==`user`||r.findingId!==t.findingId){--e;continue}s=[r,t],e-=2}else s=[t],--e;let c=s.reduce((e,t,n)=>e+i.encode(JSON.stringify(t)).byteLength+(o===0&&n===0?0:1),0);if(o+s.length>40||a+c>32768)break;r.push(s),o+=s.length,a+=c}return r.reverse().flat()},Cn=(e,t,n)=>{let r=new Map(e.map(e=>[e.id,e]));return Object.fromEntries(t.map(e=>{let t=r.get(e.id),i=n[e.id]??`pending`;return t===void 0||bn(t)!==bn(e)?i===`posting`?[e.id,i]:[e.id,i===`posted`||i===`posted-stale`?`posted-stale`:`pending`]:[e.id,i]}))},wn=class extends S(`RelayReviewTransportError`){},Tn=l(f(be)),En=async(e,t,n,r)=>{let i=await oe;if(i._tag===`Failed`)throw new wn({message:i.message});let a=ne(),o={method:`POST`,credentials:`same-origin`,headers:a===null?{"content-type":`application/json`}:{"content-type":`application/json`,"x-csrf-token":a},body:JSON.stringify(t)};r!==void 0&&(o.signal=r);let s=await window.fetch(e,o);if(!s.ok){let e=(await s.text()).slice(0,2e3).trim();throw new wn({message:e.length===0?`Relay request failed with status ${s.status}`:e})}if(s.body===null)throw new wn({message:`Relay returned no progress stream`});let c=s.body.getReader(),l=new TextDecoder,u=``,f=!1,p=async e=>{if(e.trim().length!==0)try{let t=await Tn(e);if(f)throw new wn({message:`Relay returned frames after the terminal event`});f=t.type===`complete`||t.type===`error`,n(t)}catch(e){throw me(e,`RelayReviewTransportError`)?e:new wn({message:d(e)?e.message:`Relay returned malformed progress`})}};try{for(;;){let e=await c.read();u+=l.decode(e.value,{stream:!e.done});let t=u.split(`
21
+ `);u=t.pop()??``;for(let e of t)await p(e);if(e.done)break}if(await p(u),!f)throw new wn({message:`Relay progress stream ended before a terminal event`})}finally{await c.cancel().catch(()=>void 0),c.releaseLock()}},Dn=e=>({id:e.id,name:e.name,kind:e.kind,provider:e.provider,harness:e.harness,model:e.model,skillIds:e.skillIds}),On=(e,t,n)=>({namespace:`codecommit`,subjectId:`${e}/${t}`,revisionId:n.revisionId,baseRevision:n.baseCommit,headRevision:n.headCommit}),kn=(e,t,n)=>De(On(e,t,n)),An=g({identity:m,review:ve,turns:ie,dispositions:p(m,_n)}),jn=o(f(An)),Mn=e=>Object.entries(e).reduce((e,[t,n])=>({...e,[t]:n===`posting`?`failed`:n}),{}),Nn=(e,t)=>`codecommit:relay-review-session:${encodeURIComponent(e)}:${encodeURIComponent(t)}`,Pn=(e,t,n)=>{try{let r=e.getItem(t);if(r===null)return null;let i=jn(r);return s(i)||i.value.identity!==n?null:{...i.value,dispositions:Mn(i.value.dispositions)}}catch{return null}},Fn=(e,t,n)=>{try{e.setItem(t,JSON.stringify(n))}catch{}},$={workspace:`_workspace_1j5hk_1`,workspaceHeader:`_workspaceHeader_1j5hk_8`,focusChoices:`_focusChoices_1j5hk_9`,diffToolbar:`_diffToolbar_1j5hk_10`,agentPane:`_agentPane_1j5hk_12`,findingMeta:`_findingMeta_1j5hk_14`,relayControls:`_relayControls_1j5hk_33`,findingBody:`_findingBody_1j5hk_88`,findingActions:`_findingActions_1j5hk_89`,conversation:`_conversation_1j5hk_90`,reviewFailure:`_reviewFailure_1j5hk_95`,workbench:`_workbench_1j5hk_100`,fileTree:`_fileTree_1j5hk_108`,diffPane:`_diffPane_1j5hk_124`,diffViewport:`_diffViewport_1j5hk_168`,codeView:`_codeView_1j5hk_174`,lineFinding:`_lineFinding_1j5hk_179`,lineComment:`_lineComment_1j5hk_194`,lineCommentMeta:`_lineCommentMeta_1j5hk_210`,agentTitle:`_agentTitle_1j5hk_261`,agentEmpty:`_agentEmpty_1j5hk_285`,agentSpinner:`_agentSpinner_1j5hk_299`,"agent-spin":`_agent-spin_1j5hk_1`,findingDeck:`_findingDeck_1j5hk_315`,verdictCopy:`_verdictCopy_1j5hk_324`,findingCard:`_findingCard_1j5hk_343`,findingDetails:`_findingDetails_1j5hk_385`,profileChoice:`_profileChoice_1j5hk_422`,progressRail:`_progressRail_1j5hk_442`,staleReview:`_staleReview_1j5hk_486`,conversationTitle:`_conversationTitle_1j5hk_567`,conversationHistory:`_conversationHistory_1j5hk_604`,workspaceFooter:`_workspaceFooter_1j5hk_670`},In=5e3,Ln=4e6,Rn=524288,zn=new TextEncoder,Bn=e=>{if(e.length===0)return 0;let t=1;for(let n of e)n===`
22
+ `&&t++;return t},Vn=(e,t)=>{if(zn.encode(e).byteLength+zn.encode(t).byteLength>Rn)return!0;let n=Bn(e),r=Bn(t);return n+r>In||n*r>Ln},Hn=e=>e.beforeMode===null&&e.afterMode!==null?`new file mode ${e.afterMode}`:e.beforeMode!==null&&e.afterMode===null?`deleted file mode ${e.beforeMode}`:e.beforeMode!==null&&e.afterMode!==null&&e.beforeMode!==e.afterMode?`mode ${e.beforeMode} → ${e.afterMode}`:null,Un=e=>e===`P1`||e===`P2`?`critical`:e===`P3`?`caution`:`neutral`,Wn=e=>{switch(e.location.scope){case`general`:return`Whole pull request`;case`file`:return e.location.filePath;case`line`:return`${e.location.filePath}:${e.location.line} · ${e.location.side}`}},Gn=g({message:m}),Kn=v(Gn);function qn(e,t){return Kn(e)?e.message:t}var Jn=(e,t)=>{let n=t.location;if(n.scope!==`general`)return e.find(e=>n.scope===`file`?e.path===n.filePath||e.previousPath===n.filePath:n.side===`after`?e.status!==`deleted`&&e.path===n.filePath:e.status!==`added`&&(e.previousPath??e.path)===n.filePath)?.index},Yn=(e,t)=>e.status===`renamed`&&e.previousPath!==null?{id:String(e.index),path:e.path,previousPath:e.previousPath,change:`renamed`,content:t}:{id:String(e.index),path:e.path,change:e.status===`renamed`?`modified`:e.status,content:t},Xn=(e,t)=>e.flatMap(e=>{if(e.location.scope!==`line`)return[];let n=e.location.side===`before`?t.previousPath??t.path:t.path;return e.location.filePath===n?[{id:e.id,accessibilityLabel:`${e.priority} finding: ${e.title}`,location:{itemId:String(t.index),lineNumber:e.location.line,side:e.location.side===`after`?`additions`:`deletions`},render:()=>(0,z.jsxs)(`aside`,{className:$.lineFinding,children:[(0,z.jsxs)(`strong`,{children:[e.priority,` · `,e.title]}),(0,z.jsx)(`span`,{children:e.summary})]})}]:[]}),Zn=e=>{let t=e.replace(/\[([^\]]+)\]\([^)]*\)/gu,`$1`).replace(/(^|\s)#{1,6}\s+/gu,`$1`).replace(/[*`]/gu,``).replace(/\s+/gu,` `).trim();return t.length<=180?t:`${t.slice(0,177)}…`},Qn=({active:e,onNavigateToComment:t,target:n})=>{let r=(0,B.useRef)(null);return(0,B.useEffect)(()=>{!e||r.current===null||(r.current.scrollIntoView({behavior:`smooth`,block:`center`}),r.current.focus({preventScroll:!0}))},[e]),(0,z.jsxs)(`aside`,{className:$.lineComment,"data-active":e?`true`:void 0,ref:r,tabIndex:-1,children:[(0,z.jsxs)(`span`,{className:$.lineCommentMeta,children:[(0,z.jsx)(Ee,{"aria-hidden":`true`}),(0,z.jsx)(`strong`,{children:n.author}),(0,z.jsx)(`span`,{children:`CodeCommit comment`})]}),(0,z.jsx)(`span`,{children:Zn(n.content)}),(0,z.jsx)(`button`,{onClick:()=>t(n),type:`button`,children:`View in comments`})]})},$n=(e,t,n,r)=>e.flatMap(e=>{let i=e.side===`before`?t.previousPath??t.path:t.path;return e.filePath===i?[{id:`comment:${e.commentId}`,accessibilityLabel:`CodeCommit comment by ${e.author}`,location:{itemId:String(t.index),lineNumber:e.lineNumber,side:e.side===`after`?`additions`:`deletions`},render:()=>(0,z.jsx)(Qn,{active:n===e.commentId,onNavigateToComment:r,target:e})}]:[]}),er=({accountId:e,activeCommentId:t,baseCommit:n,comments:r,file:o,findings:s,headCommit:c,layout:l,onContentStateChange:u,onNavigateToComment:d,pullRequestId:f,revisionId:p,wrap:m})=>{let g=(0,B.useMemo)(()=>se.query(`prs`,`diffContent`,{params:{awsAccountId:e,prId:f,fileIndex:o.index},query:{revisionId:p,baseCommit:n,headCommit:c},timeToLive:`10 seconds`}),[e,n,o.index,c,f,p]),_=ye(g),v=y(_)?`error`:i(_)?_.value.state===`text`?_.value.before!==null&&_.value.after!==null&&Vn(_.value.before,_.value.after)?`complexity`:`ready`:_.value.state:null;if((0,B.useEffect)(()=>{switch(v){case`ready`:u(o.index,{state:`ready`});break;case`binary`:u(o.index,{state:`binary`,reason:`CodeCommit reports binary or non-UTF-8 content.`});break;case`oversized`:u(o.index,{state:`oversized`,reason:`Content exceeds the bounded CodeCommit blob limit.`});break;case`complexity`:u(o.index,{state:`oversized`,reason:`Browser diff complexity safety limit exceeded.`});break;case`error`:u(o.index,{state:`error`,reason:`The exact file content request failed.`})}},[o.index,v,u]),a(_)||h(_))return(0,z.jsx)(N,{announce:`polite`,description:`Reading both immutable sides of ${o.path}.`,title:`Loading file diff`,tone:`progress`});if(y(_))return(0,z.jsx)(N,{announce:`polite`,description:qn(_.cause,`Reload the pull request to retry this exact file.`),title:`File diff unavailable`,tone:`critical`});if(!i(_))return(0,z.jsx)(N,{description:`Reload the pull request to retry.`,title:`File diff unavailable`,tone:`critical`});if(_.value.state!==`text`||_.value.before===null||_.value.after===null)return(0,z.jsx)(N,{description:_.value.state===`binary`?`CodeCommit reports binary or non-UTF-8 content. The file remains in the complete inventory.`:`One side exceeds the bounded CodeCommit blob limit and cannot be rendered safely.`,title:_.value.state===`binary`?`Binary change`:`File too large`,tone:`neutral`});if(Vn(_.value.before,_.value.after))return(0,z.jsx)(N,{description:`This file exceeds the browser diff-complexity safety limit.`,title:`Diff too large to render`,tone:`neutral`});let b={id:String(o.index),before:{cacheKey:`${p}:${String(o.index)}:before`,contents:_.value.before,name:o.previousPath??o.path},after:{cacheKey:`${p}:${String(o.index)}:after`,contents:_.value.after,name:o.path}};return(0,z.jsx)(on,{annotations:[...Xn(s,o),...$n(r,o,t,d)],className:$.codeView??``,initialItems:[b],mode:l,wrap:m})},tr=({canPost:e,dispositions:t,isReviewing:n,onAcknowledge:r,onPost:i,onReject:a,onSelect:o,review:s,selectedFindingId:c})=>n?(0,z.jsxs)(`div`,{"aria-live":`polite`,className:$.agentEmpty,children:[(0,z.jsx)(u,{"aria-hidden":`true`,className:$.agentSpinner}),(0,z.jsx)(j,{as:`h3`,variant:`card-title`,children:`Relay is reviewing`}),(0,z.jsx)(j,{tone:`secondary`,children:`Live stages are updating above. Findings will appear here when the run completes.`})]}):s===null?(0,z.jsxs)(`div`,{className:$.agentEmpty,children:[(0,z.jsx)(Se,{"aria-hidden":`true`}),(0,z.jsx)(j,{as:`h3`,variant:`card-title`,children:`Relay is ready`}),(0,z.jsx)(j,{tone:`secondary`,children:`Choose a focus, then run a prompt-only review over this exact CodeCommit revision.`})]}):s.kind===`explain`&&s.result.explanation!==void 0?(0,z.jsxs)(`div`,{className:$.agentEmpty,children:[(0,z.jsx)(we,{"aria-hidden":`true`}),(0,z.jsx)(j,{as:`h3`,variant:`card-title`,children:`Change explanation`}),(0,z.jsx)(j,{children:s.result.explanation}),(0,z.jsx)(j,{tone:`secondary`,children:s.result.verdict})]}):s.result.findings.length===0?(0,z.jsxs)(`div`,{className:$.agentEmpty,children:[(0,z.jsx)(C,{"aria-hidden":`true`}),(0,z.jsx)(j,{as:`h3`,variant:`card-title`,children:`No actionable findings`}),(0,z.jsx)(j,{tone:`secondary`,children:s.result.verdict})]}):(0,z.jsxs)(`section`,{"aria-label":`Findings`,className:$.findingDeck,children:[(0,z.jsx)(j,{as:`p`,className:$.verdictCopy,children:s.result.verdict}),(0,z.jsx)(`ol`,{children:s.result.findings.map(n=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`article`,{className:$.findingCard,"data-selected":c===n.id?`true`:void 0,children:[(0,z.jsxs)(`button`,{className:$.findingBody,onClick:()=>o(n),type:`button`,children:[(0,z.jsxs)(`span`,{className:$.findingMeta,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(k,{label:n.priority,size:`compact`,tone:Un(n.priority)}),(0,z.jsx)(`code`,{children:Wn(n)})]}),(0,z.jsx)(k,{label:t[n.id]??`pending`,size:`compact`,tone:t[n.id]===`failed`||t[n.id]===`posted-stale`?`caution`:`neutral`})]}),(0,z.jsx)(`strong`,{children:n.title}),(0,z.jsx)(`span`,{children:n.summary})]}),(0,z.jsxs)(`details`,{className:$.findingDetails,children:[(0,z.jsx)(`summary`,{children:`Evidence & recommendation`}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{children:`Evidence`}),n.details]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{children:`Recommendation`}),n.recommendation]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{children:`Verification`}),n.verification]})]})]}),(0,z.jsxs)(`div`,{className:$.findingActions,children:[(0,z.jsx)(ae,{disabled:!e||t[n.id]===`posting`||t[n.id]===`posted`,loading:t[n.id]===`posting`,onClick:()=>i(n),size:`compact`,variant:`primary`,children:`Accept · post`}),(0,z.jsxs)(`button`,{disabled:t[n.id]===`posting`||t[n.id]===`posted`||t[n.id]===`posted-stale`,onClick:()=>r(n),type:`button`,children:[(0,z.jsx)(C,{}),` Ack`]}),(0,z.jsxs)(`button`,{disabled:t[n.id]===`posting`||t[n.id]===`posted`||t[n.id]===`posted-stale`,onClick:()=>a(n),type:`button`,children:[(0,z.jsx)(ee,{}),` Reject`]})]})]})},n.id))})]}),nr=({accountId:t,commentNavigation:n,comments:a,diff:o,diffFailure:s,onFindingPosted:c,onNavigateToComment:l,pullRequest:u})=>{let d=fe(),[f,p]=(0,B.useState)(o.files[0]?.index??null),[m,h]=(0,B.useState)(null),[g,b]=(0,B.useState)(`split`),[x,S]=(0,B.useState)(!1),C=ye(ue),[ee,te]=(0,B.useState)(null),ne=(0,B.useMemo)(()=>se.mutation(`prs`,`postRelayFinding`),[]),ie=r(ne,{mode:`promise`}),w=kn(t,u.id,o),[T,E]=(0,B.useState)(()=>({identity:w,values:new Map})),oe=Nn(t,u.id),[D,ce]=(0,B.useState)(null),O=(0,B.useRef)(D);O.current=D;let[le,A]=(0,B.useState)(null),[pe,me]=(0,B.useState)(!1),[he,ge]=(0,B.useState)(null),[M,ve]=(0,B.useState)(!1),[be,P]=(0,B.useState)([]),[F,Ce]=(0,B.useState)([]),[we,Te]=(0,B.useState)(``),[I,L]=(0,B.useState)({}),[R,De]=(0,B.useState)(!0),Oe=(0,B.useRef)(I);Oe.current=I;let V=(0,B.useRef)(null),H=D?.value??null,Ne=i(C)?C.value.review.profiles:[],Pe=Ne.map(Dn),Fe=!i(C)&&!y(C),U=i(C)?ke(Pe,ee,C.value.review.defaultProfileId):{_tag:`Missing`},Ie=U._tag===`Resolved`?U.profile:void 0,Le=Ie===void 0?void 0:Ne.find(({id:e})=>e===Ie.id),Re=Ae(On(t,u.id,o),H===null?null:{identity:On(t,u.id,H),profile:Dn(H.profile),result:H},pe),W=Re._tag===`Stale`,G=o.files.find(({index:e})=>e===f)??o.files[0],ze=G===void 0?null:Hn(G),K=T.identity===w?T.values:new Map,Be={files:o.files.map(e=>Yn(e,K.get(e.index)??{state:`ready`})),state:`ready`};(0,B.useEffect)(()=>{if(!i(C)||ee!==null)return;let e=ke(C.value.review.profiles.map(Dn),null,C.value.review.defaultProfileId);e._tag===`Resolved`&&te(e.profile.id)},[C,ee]),(0,B.useEffect)(()=>()=>V.current?.abort(),[]),(0,B.useEffect)(()=>{if(n?.destination!==`diff`)return;if(!de(n.target,o)){ge(`This comment belongs to an older CodeCommit revision and cannot be placed on the current diff.`);return}let e=_e(o.files,n.target);if(e===void 0){ge(`The comment's file is not present in the current changed-file inventory.`);return}ge(null),p(e),h(null)},[n,o]),(0,B.useEffect)(()=>{let e=Pn(window.sessionStorage,oe,w);if(e===null){if(O.current!==null)return;ce(null),Ce([]),L({}),h(null);return}let t={identity:e.identity,value:e.review};O.current=t,Oe.current=e.dispositions,ce(t),te(e.review.profile.id),me(!1),Ce(e.turns),L(e.dispositions),h(e.turns.at(-1)?.findingId??e.review.result.findings[0]?.id??null)},[w,oe]),(0,B.useEffect)(()=>{D!==null&&D.identity===w&&Fn(window.sessionStorage,oe,{identity:D.identity,review:D.value,turns:F,dispositions:I})},[D,I,w,oe,F]),(0,B.useEffect)(()=>{f!==null&&o.files.some(({index:e})=>e===f)||p(o.files[0]?.index??null)},[o.files,f]);let Ve=(0,B.useCallback)((e,t)=>{E(n=>{let r=n.identity===w?n.values:new Map,i=r.get(e);return n.identity===w&&i?.state===t.state?n:{identity:w,values:new Map(r).set(e,t)}})},[w]),He=(0,B.useCallback)(async(e,t)=>{V.current?.abort();let n=new AbortController;V.current=n,ve(!0),A(null),me(!1),P([]);let r=null,i={};try{if(await En(e,t,e=>{if(e.type===`progress`){P(t=>[...t,e].slice(-12));return}if(e.type===`error`){r=e.message,A({description:e.message,title:`Relay review failed`});return}i.event=e},n.signal),r!==null)return me(O.current!==null),A({description:r,title:`Relay review failed`}),{completed:!1};let a=i.event;if(a===void 0)return{completed:!1};let o=O.current?.value.result.findings??[],s=o.length===0?yn(a.review.result.findings):Cn(o,a.review.result.findings,Oe.current);Oe.current=s,L(s);let c={identity:w,value:a.review};return O.current=c,ce(c),h(e=>e??a.review.result.findings[0]?.id??null),a.reply===void 0?{completed:!0}:{completed:!0,reply:a.reply}}catch(e){return n.signal.aborted||(me(O.current!==null),A({description:qn(e,`Relay could not complete this review.`),title:`Relay review failed`})),{completed:!1}}finally{V.current===n&&(V.current=null,ve(!1))}},[w]),Ue=(0,B.useCallback)(async()=>{Le!==void 0&&(await He(`/api/prs/${encodeURIComponent(t)}/${encodeURIComponent(u.id)}/relay-review/stream`,{revisionId:o.revisionId,baseCommit:o.baseCommit,headCommit:o.headCommit,profile:Le})).completed&&(Ce([]),Te(``))},[t,o.baseCommit,o.headCommit,o.revisionId,u.id,He,Le]),We=(0,B.useCallback)(async(e,n)=>{if(H===null)return;let r={findingId:e,role:`user`,message:n};if(!v(xe)(r)){A({description:`Shorten the message so it can be retained in this review conversation.`,title:`Message is too large`});return}let i=Sn(F,r),a=await He(`/api/prs/${encodeURIComponent(t)}/${encodeURIComponent(u.id)}/relay-review/continue`,{revisionId:o.revisionId,baseCommit:o.baseCommit,headCommit:o.headCommit,profile:H.profile,currentReview:H.result,turns:F,findingId:e,message:n});a.completed&&(Ce(a.reply===void 0?i:Sn(i,{findingId:e,role:`assistant`,message:a.reply})),Te(``))},[t,o.baseCommit,o.headCommit,o.revisionId,u.id,H,He,F]),Ge=(0,B.useCallback)(async e=>{if(!(H===null||W)){A(null),L(t=>({...t,[e.id]:`posting`}));try{c((await ie({params:{awsAccountId:t,prId:u.id,findingId:e.id},payload:{revisionId:H.revisionId,baseCommit:H.baseCommit,headCommit:H.headCommit,finding:e}})).operationId),L(t=>{let n=xn(O.current?.value.result.findings??[],e,t,`posted`);return n.stale&&A({description:`CodeCommit received an older finding snapshot. Re-review before relying on it.`,title:`Finding post needs review`}),n.dispositions})}catch(t){L(t=>xn(O.current?.value.result.findings??[],e,t,`failed`).dispositions),A({description:qn(t,`CodeCommit did not accept this finding.`),title:`Finding post failed`})}}},[t,c,ie,u.id,H,W]),Ke=(0,B.useCallback)(e=>{h(e.id),De(!1);let t=Jn(o.files,e);t!==void 0&&p(t)},[o.files]),qe=H?.result.findings.find(({id:e})=>e===m)??null,q=qe?.id??(m!==null&&F.some(({findingId:e})=>e===m)?m:null),Je=q===null?[]:F.filter(({findingId:e})=>e===q),Ye=be.slice(-4);return(0,z.jsxs)(re,{as:`section`,className:$.workspace,padding:`none`,form:`grouped`,children:[(0,z.jsx)(`header`,{className:$.workspaceHeader,children:(0,z.jsxs)(`div`,{children:[(0,z.jsx)(j,{tone:`secondary`,variant:`label`,children:`Exact-revision review`}),(0,z.jsx)(j,{as:`h2`,variant:`section-title`,children:`Diff`}),(0,z.jsxs)(j,{tone:`secondary`,variant:`meta`,children:[o.files.length,` changed `,o.files.length===1?`file`:`files`,` · head`,` `,o.headCommit.slice(0,12)]})]})}),s===null?null:(0,z.jsx)(`div`,{className:$.reviewFailure,children:(0,z.jsx)(N,{announce:`polite`,description:`${s} Showing the last successfully loaded exact revision.`,title:`Latest diff unavailable`,tone:`caution`})}),(0,z.jsxs)(`div`,{className:$.workbench,children:[(0,z.jsx)(gn,{className:$.fileTree,data:Be,heading:`PR ${u.id}`,onSelectedFileChange:e=>{p(Number(e)),h(null)},...G===void 0?{}:{selectedFileId:String(G.index)}}),(0,z.jsxs)(`section`,{"aria-label":`Selected file diff`,className:$.diffPane,children:[(0,z.jsxs)(`header`,{className:$.diffToolbar,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`code`,{children:G?.path??`No changed file`}),ze===null?null:(0,z.jsx)(`small`,{children:ze})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`button`,{"aria-pressed":g===`split`,onClick:()=>b(`split`),type:`button`,children:`Split`}),(0,z.jsx)(`button`,{"aria-pressed":g===`stacked`,onClick:()=>b(`stacked`),type:`button`,children:`Stacked`}),(0,z.jsx)(`button`,{"aria-pressed":x,onClick:()=>S(e=>!e),type:`button`,children:`Wrap`})]})]}),(0,z.jsx)(`div`,{className:$.diffViewport,children:G===void 0?(0,z.jsx)(N,{description:`CodeCommit reports no changed files for this revision.`,title:`Empty diff`,tone:`neutral`}):(0,z.jsx)(er,{activeCommentId:n?.destination===`diff`?n.target.commentId:null,accountId:t,baseCommit:o.baseCommit,comments:a,file:G,findings:W?[]:H?.result.findings??[],headCommit:o.headCommit,layout:g,onContentStateChange:Ve,onNavigateToComment:l,pullRequestId:u.id,revisionId:o.revisionId,wrap:x},`${o.revisionId}:${o.baseCommit}:${o.headCommit}:${String(G.index)}:${g}:${String(x)}`)})]}),(0,z.jsxs)(`aside`,{"aria-label":`Relay findings`,className:$.agentPane,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`div`,{className:$.agentTitle,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(Se,{"aria-hidden":`true`}),(0,z.jsx)(j,{as:`h2`,variant:`section-title`,children:`Relay`})]}),(0,z.jsx)(`small`,{children:M?`Reviewing the exact revision`:H===null?`Review findings and discuss evidence`:`${String(H.result.findings.length)} actionable ${H.result.findings.length===1?`finding`:`findings`}`})]}),M?(0,z.jsx)(k,{label:`running`,size:`compact`,tone:`progress`}):(0,z.jsx)(Me,{presentation:Re})]}),(0,z.jsxs)(`section`,{"aria-label":`Relay controls`,className:$.relayControls,children:[(0,z.jsx)(je,{...$.profileChoice===void 0?{}:{className:$.profileChoice},disabled:M||!i(C),onProfileChange:e=>te(e.id),profiles:Pe,selectedProfileId:ee}),(0,z.jsx)(ae,{disabled:M||o.files.length===0||Le===void 0,loading:M,onClick:()=>void Ue(),size:`compact`,variant:`primary`,children:M?`Relay reviewing…`:H===null?`Run Relay`:`Run again`})]}),y(C)?(0,z.jsx)(`div`,{className:$.reviewFailure,children:(0,z.jsx)(N,{action:(0,z.jsx)(ae,{onClick:()=>void d(0),size:`compact`,variant:`secondary`,children:`Reload`}),announce:`assertive`,description:qn(C.cause,`Check the server connection, then reload this page to retry.`),title:`Relay profiles unavailable`,tone:`critical`})}):Fe?(0,z.jsx)(`div`,{className:$.reviewFailure,children:(0,z.jsx)(N,{announce:`polite`,description:`Loading the configured review methodology before Relay can run.`,title:`Loading Relay profiles`,tone:`progress`})}):U._tag===`Unknown`?(0,z.jsx)(`div`,{className:$.reviewFailure,children:(0,z.jsx)(N,{description:`The saved profile ${U.profileId} no longer exists. Select an available profile before running Relay.`,title:`Saved Relay profile unavailable`,tone:`caution`})}):U._tag===`Missing`?(0,z.jsx)(`div`,{className:$.reviewFailure,children:(0,z.jsx)(N,{description:`Configure a default Relay profile before running a review.`,title:`Relay profile required`,tone:`caution`})}):null,Ye.length===0?null:(0,z.jsx)(`ol`,{"aria-label":`Relay progress`,"aria-live":`polite`,className:$.progressRail,children:Ye.map((e,t)=>(0,z.jsxs)(`li`,{"aria-current":t===Ye.length-1?`step`:void 0,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`}),(0,z.jsx)(`small`,{children:e.phase}),(0,z.jsx)(`strong`,{children:e.message}),e.detail===void 0?null:(0,z.jsx)(`em`,{children:e.detail})]},`${e.phase}:${String(t)}`))}),W?(0,z.jsxs)(`div`,{className:$.staleReview,children:[(0,z.jsxs)(`span`,{children:[`This finding deck reviewed `,D?.value.headCommit.slice(0,12),`; current head is`,` `,o.headCommit.slice(0,12),`.`]}),(0,z.jsx)(ae,{disabled:M||H===null,onClick:()=>H===null?void 0:void We(qe?.id??H.result.findings[0]?.id??`F1`,`Re-review the complete finding deck against the latest exact revision. Reconcile resolved, changed, and new findings.`),size:`compact`,variant:`secondary`,children:`Re-review latest`})]}):null,pe&&H!==null?(0,z.jsx)(`div`,{className:$.staleReview,role:`status`,children:`Previous result retained. The latest rerun failed; this output is not the attempted rerun.`}):null,le===null?null:(0,z.jsx)(`div`,{className:$.reviewFailure,children:(0,z.jsx)(N,{announce:`polite`,description:le.description,title:le.title,tone:`critical`})}),he===null?null:(0,z.jsx)(`div`,{className:$.reviewFailure,children:(0,z.jsx)(N,{announce:`polite`,description:he,title:`Comment link unavailable`,tone:`caution`})}),(0,z.jsx)(tr,{canPost:!W,dispositions:I,isReviewing:M,onAcknowledge:e=>L(t=>vn(t,e.id,`acknowledged`)),onPost:e=>void Ge(e),onReject:e=>L(t=>vn(t,e.id,`rejected`)),onSelect:Ke,review:H,selectedFindingId:m}),q===null?null:(0,z.jsxs)(`section`,{"aria-label":`Conversation about ${q}`,className:$.conversation,"data-collapsed":R?`true`:void 0,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(Ee,{"aria-hidden":`true`}),(0,z.jsxs)(`span`,{className:$.conversationTitle,children:[(0,z.jsx)(`strong`,{children:qe===null?`Discuss withdrawn finding`:`Discuss finding`}),(0,z.jsx)(`small`,{children:qe===null?`${q} is no longer in the current deck`:qe.title})]})]}),(0,z.jsxs)(`button`,{"aria-expanded":!R,onClick:()=>De(e=>!e),type:`button`,children:[R?(0,z.jsx)(_,{"aria-hidden":`true`}):(0,z.jsx)(e,{"aria-hidden":`true`}),R?`Open`:`Collapse`]})]}),R?null:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{"aria-label":`Conversation history about ${q}`,"aria-live":`polite`,className:$.conversationHistory,role:`log`,children:Je.length===0?(0,z.jsx)(`small`,{children:`Ask Relay to verify, refine, or withdraw this finding.`}):(0,z.jsx)(`ol`,{children:Je.map((e,t)=>(0,z.jsxs)(`li`,{"data-role":e.role,children:[(0,z.jsx)(`b`,{children:e.role===`user`?`You`:`Relay`}),e.message]},`${e.role}:${String(t)}`))})}),(0,z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=we.trim();t.length>0&&!M&&We(q,t)},children:[(0,z.jsx)(`textarea`,{"aria-label":`Message Relay`,disabled:M,maxLength:8e3,onChange:e=>Te(e.target.value),placeholder:`Ask Relay about this finding…`,rows:2,value:we}),(0,z.jsx)(ae,{disabled:M||we.trim().length===0,size:`compact`,type:`submit`,variant:`secondary`,children:`Send`})]})]})]})]})]}),(0,z.jsx)(`footer`,{className:$.workspaceFooter,children:`Relay is advisory. Accept posts immediately; acknowledge and reject stay local to this review session.`})]})},rr=({accountId:e,commentNavigation:t,commentsRefreshGeneration:n,onFindingPosted:r,onNavigateToComment:o,pullRequest:s,refreshGeneration:c})=>{let l=D({pullRequestId:s.id,repositoryName:s.repositoryName,profile:s.account.profile,region:s.account.region,refreshGeneration:n}),u=i(l)?l.value.flatMap(e=>e.comments.flatMap(t=>{if(t.root.deleted)return[];let n=he(e,t.root);return n===null?[]:[n]})):[],d=(0,B.useMemo)(()=>se.query(`prs`,`diff`,{params:{awsAccountId:e,prId:s.id},serializationKey:`${e}:${s.id}:${s.lastModifiedDate.toISOString()}:${String(c)}`,timeToLive:`30 seconds`}),[e,s.id,s.lastModifiedDate,c]),f=ye(d),p=`${e}:${s.id}`,m=(0,B.useRef)(null);i(f)&&(m.current={identity:p,value:f.value});let g=m.current?.identity===p?m.current.value:null,_=i(f)?f.value:g;if((a(f)||h(f))&&_===null)return(0,z.jsx)(N,{announce:`polite`,description:`Indexing every changed file.`,title:`Loading exact diff`,tone:`progress`});let v=y(f)?qn(f.cause,`Refresh this pull request to retry the CodeCommit diff read.`):null;return y(f)&&_===null?(0,z.jsx)(N,{announce:`polite`,description:qn(f.cause,`Refresh this pull request to retry the CodeCommit diff read.`),title:`Exact diff unavailable`,tone:`critical`}):_===null?(0,z.jsx)(N,{description:`Refresh this pull request to retry.`,title:`Exact diff unavailable`,tone:`critical`}):(0,z.jsx)(nr,{accountId:e,commentNavigation:t,comments:u.filter(e=>de(e,_)),diff:_,diffFailure:v,onFindingPosted:r,onNavigateToComment:o,pullRequest:s},`${e}:${s.id}`)};export{rr as PullRequestReviewWorkspace};
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>codecommit</title>
7
- <script type="module" crossorigin src="/assets/index-DJ8wO4ny.js"></script>
8
- <link rel="stylesheet" crossorigin href="/assets/index-KjRfV-r_.css">
7
+ <script type="module" crossorigin src="/assets/index-DQUoxciG.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-NJaNHeOS.css">
9
9
  </head>
10
10
  <body>
11
11
  <div id="root"></div>