@diffohq/diffo 0.14.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{abnfDiagram-O67JEVCF-CVH8WE_F.js → abnfDiagram-O67JEVCF-CWLH81FZ.js} +1 -1
- package/dist/client/assets/{arc-B9YojSN0.js → arc-Boi3vJx1.js} +1 -1
- package/dist/client/assets/architecture-7GRP2DOG-6Io79Z_R.js +1 -0
- package/dist/client/assets/{architectureDiagram-NJMV4G6O-Bf5-1aP5.js → architectureDiagram-NJMV4G6O-Dv6FL33A.js} +1 -1
- package/dist/client/assets/{blockDiagram-BEXU5L5S-BjgpE7Dd.js → blockDiagram-BEXU5L5S-JL6NkjcT.js} +1 -1
- package/dist/client/assets/{c4Diagram-YGBWAQC7-CWx9Vgqs.js → c4Diagram-YGBWAQC7-BX8kio45.js} +1 -1
- package/dist/client/assets/channel-DYSvh7rY.js +1 -0
- package/dist/client/assets/{chunk-3FUC2YCW-DDkCtmAa.js → chunk-3FUC2YCW-CO9Amjtk.js} +1 -1
- package/dist/client/assets/{chunk-5DYCD2WN-Dz0Cy0TD.js → chunk-5DYCD2WN-2rOrgg5f.js} +1 -1
- package/dist/client/assets/{chunk-742MDFTN-DrqtNMzc.js → chunk-742MDFTN-I1URsrBZ.js} +1 -1
- package/dist/client/assets/{chunk-7INBJB4K-Dh7BrR7z.js → chunk-7INBJB4K-CUZj-C6g.js} +1 -1
- package/dist/client/assets/{chunk-7M6MHVWA-Boc8MHqL.js → chunk-7M6MHVWA-DPNR3NbA.js} +1 -1
- package/dist/client/assets/{chunk-7PRAP22T-cmKadjWw.js → chunk-7PRAP22T-C9q-YcpS.js} +1 -1
- package/dist/client/assets/{chunk-GTNCS2PH-Cxz5-QhI.js → chunk-GTNCS2PH-CzwPny5O.js} +1 -1
- package/dist/client/assets/{chunk-GWA4HPMP-C8MaPoW5.js → chunk-GWA4HPMP-CRfFZn0F.js} +1 -1
- package/dist/client/assets/{chunk-MBY4JIJT-BWkHqhBg.js → chunk-MBY4JIJT-BHlU7n-C.js} +1 -1
- package/dist/client/assets/{chunk-NETBCI7D-5XYJLafq.js → chunk-NETBCI7D-CEyXgnax.js} +1 -1
- package/dist/client/assets/{chunk-O7XYJQB3-4NIHlwbC.js → chunk-O7XYJQB3-DxdkNc8m.js} +1 -1
- package/dist/client/assets/{chunk-UA2S7LBM-C8V6OyRz.js → chunk-UA2S7LBM-CWz4tJRd.js} +1 -1
- package/dist/client/assets/{chunk-WEXAMYUT-BmG_ZoXb.js → chunk-WEXAMYUT-Dyj5_bjS.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-C8A-keEi.js → chunk-XXDRQBXY-D9nUo8qv.js} +1 -1
- package/dist/client/assets/{chunk-Z7XXMR3K-CmzJ-VFv.js → chunk-Z7XXMR3K-CKwjz3Sm.js} +1 -1
- package/dist/client/assets/{chunk-ZIGJFQKS-BBRj9o51.js → chunk-ZIGJFQKS-D9Hg0L-2.js} +1 -1
- package/dist/client/assets/{classDiagram-v2-NBCMYWYE-ywtl_aLK.js → classDiagram-v2-NBCMYWYE-Szi56-yb.js} +1 -1
- package/dist/client/assets/{core-Df-hGU6u.js → core-CmtFUBrQ.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-TGc2vY3y.js → cose-bilkent-JH36ORCC-BWNiEgAI.js} +1 -1
- package/dist/client/assets/{cynefin-OW5HDTMX-vl0jmJbf.js → cynefin-OW5HDTMX-BRwo_ga9.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-VND7K2PF-BUAaUuOC.js → cynefinDiagram-VND7K2PF-HwqbUUIy.js} +1 -1
- package/dist/client/assets/{dagre-6A5THRUB-CrSrGBN2.js → dagre-6A5THRUB-Vr9XVRxE.js} +1 -1
- package/dist/client/assets/{diagram-22UHCM2B-DC8LxnGD.js → diagram-22UHCM2B-D2AV1t0V.js} +1 -1
- package/dist/client/assets/{diagram-3UASUU5V-Bxygic4n.js → diagram-3UASUU5V-BebAfmaQ.js} +1 -1
- package/dist/client/assets/{diagram-ATOU4E4O-C6LRlKne.js → diagram-ATOU4E4O-DyOZr1ty.js} +1 -1
- package/dist/client/assets/{diagram-CDSNMT55-BhDhgpOc.js → diagram-CDSNMT55-CfUcq-A2.js} +1 -1
- package/dist/client/assets/{diagram-MLGK6HIB-CptdWPN1.js → diagram-MLGK6HIB-feBafK9Y.js} +1 -1
- package/dist/client/assets/{diagram-MPIPVDR6-BdeJWONi.js → diagram-MPIPVDR6-fuRWH1sG.js} +1 -1
- package/dist/client/assets/{dist-m1fhZ4RP.js → dist-BNObUdRB.js} +1 -1
- package/dist/client/assets/{dist-By-966m5.js → dist-D8Qb0Dmg.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-ZINNZB2B-BzjgspXj.js → ebnfDiagram-ZINNZB2B-BQOIIWkD.js} +1 -1
- package/dist/client/assets/{elk-276RUBZZ-DpzEVpPK.js → elk-276RUBZZ-BUXjENa5.js} +1 -1
- package/dist/client/assets/{engine-oniguruma-JCdnWHQL.js → engine-oniguruma-BjMH3wEI.js} +1 -1
- package/dist/client/assets/{erDiagram-OPXOYQCR-CH00EQH7.js → erDiagram-OPXOYQCR-CLVWgAj1.js} +1 -1
- package/dist/client/assets/eventmodeling-NTZA5JFV-BnOGyEbk.js +1 -0
- package/dist/client/assets/flowDiagram-KWPJA3E3-Dh4oiyMW.js +1 -0
- package/dist/client/assets/{ganttDiagram-FUAMR5RP-FjydKHiU.js → ganttDiagram-FUAMR5RP-zhdMVh3n.js} +1 -1
- package/dist/client/assets/{gitGraph-4MIJSDKK-CZaJEgDt.js → gitGraph-4MIJSDKK-BRDusxYN.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-X574FWY7-BOYve_u_.js → gitGraphDiagram-X574FWY7-hi2GrOpe.js} +1 -1
- package/dist/client/assets/{index-CsnzLzk-.css → index-BA230KUb.css} +1 -1
- package/dist/client/assets/{index-CL27xGK3.js → index-BBBJbJZo.js} +4 -4
- package/dist/client/assets/{info-A6RAGUB7-B1ZKVby8.js → info-A6RAGUB7-B8_M0GwD.js} +1 -1
- package/dist/client/assets/{infoDiagram-VRGFBTTK-DAut_YRI.js → infoDiagram-VRGFBTTK-D1SckQLr.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-OU5B5YK6-CDZp3We3.js → ishikawaDiagram-OU5B5YK6-BWGRW6iu.js} +1 -1
- package/dist/client/assets/{journeyDiagram-ZHPQQLJL-DTo5Gjov.js → journeyDiagram-ZHPQQLJL-BZMBlD-u.js} +1 -1
- package/dist/client/assets/{kanban-definition-PNTS6WVX-DlSJ32EM.js → kanban-definition-PNTS6WVX-BawAhHrc.js} +1 -1
- package/dist/client/assets/{line-DVQODRiw.js → line-Kb3oE4Aw.js} +1 -1
- package/dist/client/assets/{linear-C7oWAPRa.js → linear-CzZmB-YY.js} +1 -1
- package/dist/client/assets/{mermaid-parser.core-T2yOXQQd.js → mermaid-parser.core-30zdyqZr.js} +3 -3
- package/dist/client/assets/{mermaid.core-BH5lSEUI.js → mermaid.core-BZsTuSGk.js} +4 -4
- package/dist/client/assets/{mindmap-definition-NLK3R4M7-n3EvR1cJ.js → mindmap-definition-NLK3R4M7-Bm7FCTi7.js} +1 -1
- package/dist/client/assets/{packet-AYTQ26CC-3rKnMWOd.js → packet-AYTQ26CC-BwuhQpcj.js} +1 -1
- package/dist/client/assets/{pegDiagram-GJSIUBJH-B2duwehd.js → pegDiagram-GJSIUBJH-BbRs1Ryb.js} +1 -1
- package/dist/client/assets/{pie-WAS4IAKB-Bc5MR0wR.js → pie-WAS4IAKB-DtQofJX0.js} +1 -1
- package/dist/client/assets/{pieDiagram-5QR66LMP-0JrBYCP1.js → pieDiagram-5QR66LMP-Cdu1hQd1.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-O4NWA36T-BUbFNDXD.js → quadrantDiagram-O4NWA36T-Bshr17Y5.js} +1 -1
- package/dist/client/assets/{radar-RG4KPBEZ-BeqQz_At.js → radar-RG4KPBEZ-BuerLUtq.js} +1 -1
- package/dist/client/assets/{railroad-74A4TZTK-BCrRx3tN.js → railroad-74A4TZTK-BsE8b9hd.js} +1 -1
- package/dist/client/assets/railroad-abnf-HS5TGJTU-CADz2x_5.js +1 -0
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-CfWuG45A.js +1 -0
- package/dist/client/assets/railroad-peg-WCYAUIDC-9Ce0sj3N.js +1 -0
- package/dist/client/assets/{railroadDiagram-XR7U4H2S-ar75S4BD.js → railroadDiagram-XR7U4H2S-BqIA3pC6.js} +1 -1
- package/dist/client/assets/{requirementDiagram-PLB6GJNP-DhL4njRA.js → requirementDiagram-PLB6GJNP-Bm2AGotF.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-IPEJSGJF-Bra-2Kg9.js → sankeyDiagram-IPEJSGJF-99nr1xkQ.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-PO4LG4MO-DWtCNs1j.js → sequenceDiagram-PO4LG4MO-CApQASjN.js} +1 -1
- package/dist/client/assets/{src-B3kD43jI.js → src-BSYgMDEE.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-GCMORJYK-CVu5Tzzw.js → stateDiagram-v2-GCMORJYK-CrQnTrn1.js} +1 -1
- package/dist/client/assets/{swimlanes-2SLR337P-03qTyGpz.js → swimlanes-2SLR337P-Ce21f9vx.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-TC7HE7FX-8cvzmsNb.js +8 -0
- package/dist/client/assets/{timeline-definition-EJHVYXUP-CZp4QvTx.js → timeline-definition-EJHVYXUP-BoeRsX3e.js} +1 -1
- package/dist/client/assets/{treeView-Q6P3EWNA-BAtTAOZo.js → treeView-Q6P3EWNA-HKKOZRne.js} +1 -1
- package/dist/client/assets/{treemap-WGGIJYW6-BFu67HT2.js → treemap-WGGIJYW6-BG5rp2bZ.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-POWQR4AR-EuSDU41A.js → usecaseDiagram-POWQR4AR-sx5gD3FR.js} +1 -1
- package/dist/client/assets/{vennDiagram-UO4OBE2U-BiOvMbFR.js → vennDiagram-UO4OBE2U-ckr2KNS0.js} +1 -1
- package/dist/client/assets/{wardley-WFR3VGLG-DiKbCXBA.js → wardley-WFR3VGLG-C52x6tow.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-VNRHLVJA-DZ7cCA5C.js → wardleyDiagram-VNRHLVJA-C-4Ioqpr.js} +1 -1
- package/dist/client/assets/{xychartDiagram-PMCCYNJV-C14JVEbW.js → xychartDiagram-PMCCYNJV-C0feTPPk.js} +1 -1
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/dist/client/assets/architecture-7GRP2DOG-D1V4VKXd.js +0 -1
- package/dist/client/assets/channel-Cr5mC66X.js +0 -1
- package/dist/client/assets/eventmodeling-NTZA5JFV-m-OSCGRe.js +0 -1
- package/dist/client/assets/flowDiagram-KWPJA3E3-BmW4Yh_d.js +0 -1
- package/dist/client/assets/railroad-abnf-HS5TGJTU-DI-j3FX4.js +0 -1
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-DLclu3W6.js +0 -1
- package/dist/client/assets/railroad-peg-WCYAUIDC-DuUuJQWr.js +0 -1
- package/dist/client/assets/swimlanesDiagram-TC7HE7FX-D-Qm2hjA.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-BZsTuSGk.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-BSYgMDEE.js","assets/chunk-O7XYJQB3-DxdkNc8m.js","assets/chunk-ZIGJFQKS-D9Hg0L-2.js","assets/dist-D8Qb0Dmg.js","assets/chunk-742MDFTN-I1URsrBZ.js","assets/chunk-MBY4JIJT-BHlU7n-C.js","assets/chunk-DUW6YSOI-Dgx8z5s3.js","assets/chunk-7PRAP22T-C9q-YcpS.js","assets/chunk-7INBJB4K-CUZj-C6g.js","assets/chunk-J5ZVWO5B-oDCd-gWO.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-5DYCD2WN-2rOrgg5f.js","assets/chunk-Z7XXMR3K-CKwjz3Sm.js","assets/line-Kb3oE4Aw.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/chunk-UA2S7LBM-CWz4tJRd.js","assets/c-DWGmR78Y.js","assets/c-SSSlmE39.js","assets/cpp-CJIxL8VH.js","assets/cpp-Cts1PyIS.js","assets/css-CdtkT07m.js","assets/css-LbU1hoFO.js","assets/html-DDNsd9lV.js","assets/html-BcACZWSP.js","assets/javascript-BzbQS41l.js","assets/java-DxlWrXwe.js","assets/java-BtIQNnN0.js","assets/javascript-Yelw-5ZN.js","assets/json-CaljABEy.js","assets/json-B88Oqtu5.js","assets/jsx-hEbJ82HF.js","assets/jsx-D3KKoC5L.js","assets/php-CQT4wx5i.js","assets/xml-WY0zc4PG.js","assets/sql-CP0rg-5b.js","assets/ruby-D_UtGFHI.js","assets/typescript-j_1H8WHN.js","assets/tsx-BOvsFOI6.js","assets/shellscript-CqHdAlCp.js","assets/yaml-DijMHRDA.js","assets/scss-DHtrkMkT.js","assets/shellscript-BiGZg9Om.js","assets/sql-0Qcw9ht3.js","assets/svelte-BUVJxsYv.js","assets/tsx-5f3ulCja.js","assets/typescript-Utq2Cl8c.js","assets/vue-CSBlZ1UP.js","assets/xml-CoDIzWF0.js","assets/yaml-CxbubiML.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),u=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var d=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function A(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var j=/\/+/g;function M(e,t){return typeof e==`object`&&e&&e.key!=null?A(``+e.key):t.toString(36)}function ee(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+M(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(j,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(j,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+M(a,u),c+=N(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+M(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(ee(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var te=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function ne(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,te)}catch(e){te(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function re(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else ne(re.bind(null,e))}var I={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=I,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=re,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!E.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return D(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)E.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return D(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=k,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=ne,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.0`})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),m=o(((e,t)=>{t.exports=p()})),h=o((e=>{var t=f();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=u(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=u(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.0`})),g=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=o((e=>{var t=m(),n=f(),r=g();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function p(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&p(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function h(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function _(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function v(e){var t=[null,null],n=h(e);return n===null||y(t,e,n.child,{foundSelf:!1}),t}function y(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&y(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var x=null,S=null;function C(e,t,n){return e===n||e===t&&(x=e,!0)}function w(e,t,n){return e===n?(S=e,!1):e===t&&(S!==null&&(x=e),!0)}function T(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function E(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var D=Object.assign,O=Symbol.for(`react.element`),k=Symbol.for(`react.transitional.element`),A=Symbol.for(`react.portal`),j=Symbol.for(`react.fragment`),M=Symbol.for(`react.strict_mode`),ee=Symbol.for(`react.profiler`),N=Symbol.for(`react.consumer`),P=Symbol.for(`react.context`),F=Symbol.for(`react.forward_ref`),te=Symbol.for(`react.suspense`),ne=Symbol.for(`react.suspense_list`),re=Symbol.for(`react.memo`),I=Symbol.for(`react.lazy`),ie=Symbol.for(`react.activity`),ae=Symbol.for(`react.legacy_hidden`),oe=Symbol.for(`react.memo_cache_sentinel`),se=Symbol.for(`react.view_transition`),ce=Symbol.for(`react.recoverable`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var de=Symbol.for(`react.client.reference`);function fe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case j:return`Fragment`;case ee:return`Profiler`;case M:return`StrictMode`;case te:return`Suspense`;case ne:return`SuspenseList`;case ie:return`Activity`;case se:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case A:return`Portal`;case P:return e.displayName||`Context`;case N:return(e._context.displayName||`Context`)+`.Consumer`;case F:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case re:return t=e.displayName||null,t===null?fe(e.type)||`Memo`:t;case I:t=e._payload,e=e._init;try{return fe(e(t))}catch{}}return null}var L=Array.isArray,R=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pe={pending:!1,data:null,method:null,action:null},me=[],he=-1;function ge(e){return{current:e}}function _e(e){0>he||(e.current=me[he],me[he]=null,he--)}function ve(e,t){he++,me[he]=e.current,e.current=t}var ye=ge(null),be=ge(null),xe=ge(null),Se=ge(null);function Ce(e,t){switch(ve(xe,t),ve(be,e),ve(ye,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}_e(ye),ve(ye,e)}function we(){_e(ye),_e(be),_e(xe)}function Te(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,ve(Se,e)),t=ye.current;var n=dp(t,e.type);t!==n&&(ve(be,e),ve(ye,n))}function Ee(e){be.current===e&&(_e(ye),_e(be)),Se.current===e&&(_e(Se),sh._currentValue=pe)}var De,Oe;function B(e){if(De===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);De=t&&t[1]||``,Oe=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+De+e+Oe}var ke=!1;function Ae(e,t){if(!e||ke)return``;ke=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -78,16 +78,16 @@ ${e}</tr>
|
|
|
78
78
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Ri(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?Ri(n,!0):this.parser.parseInline(r),o=Bi(e);if(o===null)return a;e=Ri(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+Ri(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Bi(e);if(i===null)return Ri(n);e=i;let a=`<img src="${Ri(e)}" alt="${Ri(n)}"`;return t&&(a+=` title="${Ri(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Ri(e.text)}},K=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},$i=class e{options;renderer;textRenderer;constructor(e){this.options=e||hr,this.options.renderer=this.options.renderer||new Qi,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new K}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},ea=class{options;block;constructor(e){this.options=e||hr}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Zi.lex:Zi.lexInline}provideParser(e=this.block){return e?$i.parse:$i.parseInline}},ta=new class{defaults=mr();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=$i;Renderer=Qi;TextRenderer=K;Lexer=Zi;Tokenizer=Xi;Hooks=ea;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Qi(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Xi(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new ea;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=ea.passThroughHooks.has(n)?e=>{if(this.defaults.async&&ea.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Zi.lex(e,t??this.defaults)}parser(e,t){return $i.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?Zi.lex:Zi.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?$i.parse:$i.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?Zi.lex:Zi.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?$i.parse:$i.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
79
79
|
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Ri(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function q(e,t){return ta.parse(e,t)}q.options=q.setOptions=function(e){return ta.setOptions(e),q.defaults=ta.defaults,gr(q.defaults),q},q.getDefaults=mr,q.defaults=hr;function na(...e){return ta.use(...e),q.defaults=ta.defaults,gr(q.defaults),q}q.use=na,q.walkTokens=function(e,t){return ta.walkTokens(e,t)},q.parseInline=ta.parseInline,q.Parser=$i,q.parser=$i.parse,q.Renderer=Qi,q.TextRenderer=K,q.Lexer=Zi,q.lexer=Zi.lex,q.Tokenizer=Xi,q.Hooks=ea,q.parse=q,q.options,q.setOptions,q.walkTokens,q.parseInline,$i.parse,Zi.lex,q.setOptions({gfm:!0,breaks:!0});var ra=[`p`,`br`,`hr`,`strong`,`em`,`del`,`code`,`pre`,`blockquote`,`ul`,`ol`,`li`,`a`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`table`,`thead`,`tbody`,`tr`,`th`,`td`],ia=pr(),aa=!1;function oa(){aa||(aa=!0,ia.addHook(`afterSanitizeAttributes`,e=>{if(e instanceof Element&&(e.tagName===`A`&&e.hasAttribute(`href`)&&!(e.getAttribute(`href`)??``).startsWith(`#`)&&(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)),e.hasAttribute(`class`))){let t=/^language-[\w+-]+$/.exec(e.getAttribute(`class`)??``);e.tagName===`CODE`&&t?e.setAttribute(`class`,t[0]):e.removeAttribute(`class`)}}))}function sa(e){oa();let t=q.parse(e,{async:!1});return ia.sanitize(t,{ALLOWED_TAGS:ra,ALLOWED_ATTR:[`href`,`title`,`target`,`rel`,`class`],ALLOWED_URI_REGEXP:/^(?:https?:|mailto:|#)/i})}var ca=[...ra,`img`,`picture`,`source`,`div`,`span`,`details`,`summary`],la=pr(),ua=``;function da(e,t){let n=t.split(/[?#]/,1)[0]??``,r=n.startsWith(`/`)?n.slice(1):e?`${e}/${n}`:n,i=[];for(let e of r.split(`/`))e!==``&&e!==`.`&&(e===`..`?i.pop():i.push(e));return i.join(`/`)}function fa(e){return`/api/file?path=${encodeURIComponent(da(ua,e))}&side=head`}var pa=/^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i,ma=/^(?:https?:|mailto:|#)/i,ha=!1;function ga(){ha||(ha=!0,la.addHook(`uponSanitizeAttribute`,(e,t)=>{let{attrName:n,attrValue:r}=t;n===`src`||n===`href`?pa.test(r)?ma.test(r)||(t.keepAttr=!1):t.attrValue=fa(r):n===`srcset`&&(t.attrValue=r.split(`,`).map(e=>{let[t,...n]=e.trim().split(/\s+/);return t?pa.test(t)?ma.test(t)?[t,...n].join(` `):``:[fa(t),...n].join(` `):``}).filter(Boolean).join(`, `))}),la.addHook(`afterSanitizeAttributes`,e=>{if(e instanceof Element&&(e.tagName===`A`&&e.hasAttribute(`href`)&&(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)),e.hasAttribute(`class`))){let t=/^language-[\w+-]+$/.exec(e.getAttribute(`class`)??``);e.tagName===`CODE`&&t?e.setAttribute(`class`,t[0]):e.removeAttribute(`class`)}}))}function _a(e,t){ga();let n=t.lastIndexOf(`/`);ua=n===-1?``:t.slice(0,n);let r=q.parse(e,{async:!1});return la.sanitize(r,{ALLOWED_TAGS:ca,ALLOWED_ATTR:[`href`,`title`,`target`,`rel`,`class`,`src`,`srcset`,`alt`,`width`,`height`,`media`,`align`,`open`]})}function va(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);if(Number.isNaN(n))return e;let r=Math.round((t-n)/1e3);if(r<45)return`just now`;let i=Math.round(r/60);if(i<60)return`${i} minute${i===1?``:`s`} ago`;let a=Math.round(i/60);if(a<24)return`${a} hour${a===1?``:`s`} ago`;let o=Math.round(a/24);return o<7?`${o} day${o===1?``:`s`} ago`:new Date(n).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function ya(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);if(Number.isNaN(n))return``;let r=Math.max(0,Math.round((t-n)/1e3));if(r<60)return`${r}s`;let i=Math.round(r/60);if(i<60)return`${i}m`;let a=Math.round(i/60);if(a<24)return`${a}h`;let o=Math.round(a/24);return o<7?`${o}d`:new Date(n).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}var ba=30,xa=22,Sa=48,Ca=1100,wa=1500,Ta=1.1,Ea=3e3,Da=110,Oa=560,ka=64,Aa=90/24,ja=ba*3.5/24,Ma=540/24,Na={shut:`M7.8 10.4h2.4M13.8 10.4h2.4`,plus:`M7.8 10.2h2.4M9 9v2.4M13.8 10.2h2.4M15 9v2.4`,happy:`M7.8 11l1.2-1.4 1.2 1.4M13.8 11l1.2-1.4 1.2 1.4`},Pa=new Set([`stand`,`sit`]);function Fa(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Ia=(e,t)=>e+Math.random()*(t-e),La=e=>`translate(${e.x}px, ${e.y}px) scale(${e.s})`;function Ra({presence:e,reason:t,seat:n,onAway:r,summon:i=0}){let a=(0,x.useRef)(null),o=(0,x.useRef)(null),[s,c]=(0,x.useState)(!1),l=(0,x.useRef)(!1),u=(0,x.useRef)(r);u.current=r;let d=(0,x.useCallback)(e=>{l.current=e,c(e),u.current?.(e)},[]),[f,p]=(0,x.useState)(!1),m=(0,x.useRef)(null),h=(0,x.useRef)(0),g=(0,x.useRef)(!1),_=(0,x.useRef)(i),[v,y]=(0,x.useState)(0),[b,C]=(0,x.useState)(null),[w,T]=(0,x.useState)(null),[E,D]=(0,x.useState)(`stand`),[O,k]=(0,x.useState)(null),A=(0,x.useRef)(null);A.current=b;let[j,M]=(0,x.useState)(!1),ee=(0,x.useRef)(!1);ee.current=j;let[N,P]=(0,x.useState)(!1);(0,x.useEffect)(()=>{let e,t=t=>{ee.current||M(!0),t.type===`keydown`&&P(!0),clearTimeout(e),e=setTimeout(()=>{M(!1),P(!1)},Ea)},n={capture:!0,passive:!0},r=[`pointermove`,`wheel`,`scroll`,`keydown`];for(let e of r)addEventListener(e,t,n);return()=>{clearTimeout(e);for(let e of r)removeEventListener(e,t,n)}},[]),(0,x.useEffect)(()=>{let e=a.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(([e])=>e&&y(e.contentRect.width));return t.observe(e),()=>t.disconnect()},[]);let F=(0,x.useRef)(t);(0,x.useEffect)(()=>{t===`replied`&&F.current!==`replied`&&!Fa()&&k(`approve`),F.current=t},[t]);let te=Pa.has(E)&&!O;(0,x.useEffect)(()=>{let e=o.current,t=e?.querySelector(`.critter-look`);if(!e||!t)return;if(!te||Fa()){t.style.transform=``;return}let n=0,r=r=>{n||=requestAnimationFrame(()=>{n=0;let i=e.getBoundingClientRect(),a=r.clientX-(i.left+i.width/2),o=r.clientY-(i.top+i.height*.4),s=Math.hypot(a,o)||1;t.style.transform=`translate(${a/s*Ta}px, ${o/s*Ta*.8}px)`})};return addEventListener(`pointermove`,r),()=>{removeEventListener(`pointermove`,r),cancelAnimationFrame(n),t.style.transform=``}},[te]);let ne=Math.max(0,v-ba),re=(0,x.useRef)(ne);re.current=ne;let I=v>0,ie=e===`waiting`||ne<ka||Fa();(0,x.useEffect)(()=>()=>u.current?.(!1),[]),(0,x.useLayoutEffect)(()=>{!s&&m.current&&(m.current.anim.cancel(),m.current=null)},[s]),(0,x.useEffect)(()=>{if(!I)return;let t=()=>re.current,r,s=!0,c=()=>Math.min(A.current??t(),t()),u=(e,t)=>{r=setTimeout(()=>s&&t(),e)},f=(e,t,n)=>{D(e),u(t,n)},v=(e,t,n)=>{let r=c(),i=Math.abs(e-r)/t*1e3;if(i<150){n();return}D(`walk`),T({ms:i,dir:e<r?`left`:`right`}),C(e),u(i,()=>{T(null),n()})},y=()=>{let e=n?.current?n.current.getBoundingClientRect():void 0,t=a.current?.getBoundingClientRect(),r=o.current;if(!e?.width||!t||!r)return null;let i=e.width/Ma;return{x:e.left-t.left-Aa*i,y:e.top+e.height/30-t.top-r.offsetTop-ja*i,s:i}},b=(e,t,n,r)=>{let i=o.current;if(!i||typeof i.animate!=`function`){r();return}let a={x:(e.x+t.x)/2,y:Math.min(e.y,t.y)-16,s:(e.s+t.s)/2},s=i.animate([e,a,t].map(e=>({transform:La(e)})),{duration:Oa,easing:`cubic-bezier(0.3, 0.7, 0.4, 1)`,fill:`forwards`});m.current={anim:s,home:n},u(Oa,r)},x=()=>{p(!1),d(!1)},S=e=>{v(t(),Da,()=>{let t=y();if(!t){x(),e?.();return}D(`stand`),p(!0),b({x:c(),y:0,s:1},t,!0,()=>{x(),e?.()})})},w=e=>{let n=y();if(C(t()),D(`stand`),p(!0),d(!0),!n){p(!1),e();return}b(n,{x:t(),y:0,s:1},!1,()=>{m.current?.anim.cancel(),m.current=null,p(!1),e()})},E=()=>{if(e===`working`){let e=()=>c()>t()/2?Ia(0,t()*.4):Ia(t()*.6,t()),n=()=>Math.random()<.5?`inspect`:`write`,r=()=>ee.current?f(n(),Ia(2500,4e3),r):v(e(),Sa,()=>f(n(),Ia(2500,5e3),()=>Math.random()<.4?f(`think`,Ia(1500,2800),r):r()));f(n(),Ia(1500,3e3),r)}else{let e=()=>{let n=Math.random();ee.current?f(n<.5?`stand`:`read`,Ia(3e3,6e3),e):n<.3?f(`read`,Ia(4e3,8e3),e):n<.5?f(`stand`,Ia(3e3,6e3),e):n<.75?v(Ia(0,t()),xa,e):n<.9?f(`sit`,Ia(4e3,8e3),e):f(`think`,Ia(2e3,3500),e)};f(`read`,Ia(3e3,5e3),e)}},j=()=>u(Math.max(e===`working`?Ia(300,700):Ia(1e3,2500),h.current-Date.now()),()=>w(E)),M=i!==_.current;if(_.current=i,M&&!O&&!ie&&!l.current)w(()=>k(`poke`));else if(M&&!O&&l.current)k(`poke`);else if(O&&l.current)f(O,O===`poke`?Ca:wa,()=>{O===`approve`&&(g.current=!0),k(null)});else if(O)k(null);else if(ie)l.current&&!Fa()?S():l.current&&x(),D(e===`waiting`?`sleep`:`stand`);else if(l.current&&(N||g.current)){let e=g.current;g.current=!1,e&&(h.current=Date.now()+Ia(4e3,6e3)),S(N?void 0:j)}else l.current?E():(D(`stand`),N||j());return()=>{if(s=!1,clearTimeout(r),m.current){let{anim:e,home:t}=m.current;e.cancel(),m.current=null,p(!1),t&&d(!1),T(null);return}let e=o.current;if(e)try{C(new DOMMatrixReadOnly(getComputedStyle(e).transform).m41)}catch{}T(null)}},[e,I,O,N,ie,n,d,i]);let ae=()=>{!O&&!Fa()&&k(`poke`)},oe={transform:La({x:Math.min(b??ne,ne),y:0,s:1}),transition:w?`transform ${w.ms}ms linear`:`none`,visibility:v&&s?void 0:`hidden`};return(0,S.jsx)(`span`,{className:`critter-track`,ref:a,children:(0,S.jsx)(`span`,{ref:o,className:`critter-walker${w?` critter-moving critter-${w.dir}`:``}${j?` critter-calm`:``}${f?` critter-tucked`:``}`,style:oe,onPointerEnter:ae,children:(0,S.jsx)(za,{presence:e,act:E})})})}function za({presence:e,act:t=e===`waiting`?`sleep`:`stand`,size:n=ba}){return(0,S.jsxs)(`svg`,{className:`critter critter-${e} critter-act-${t}`,width:n,height:n,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:[(0,S.jsxs)(`g`,{className:`critter-figure`,children:[(0,S.jsx)(`rect`,{className:`critter-leg critter-leg-l`,x:`7`,y:`16.5`,width:`3`,height:`4.5`,rx:`1`}),(0,S.jsx)(`rect`,{className:`critter-leg critter-leg-r`,x:`14`,y:`16.5`,width:`3`,height:`4.5`,rx:`1`}),(0,S.jsxs)(`g`,{className:`critter-torso`,children:[(0,S.jsx)(`rect`,{className:`critter-body`,x:`3`,y:`3.5`,width:`18`,height:`14`,rx:`4`}),(0,S.jsxs)(`g`,{className:`critter-look`,children:[(0,S.jsx)(`path`,{className:`critter-eyes critter-eyes-shut`,d:Na.shut}),(0,S.jsxs)(`g`,{className:`critter-eyes-open`,children:[(0,S.jsx)(`rect`,{x:`8.1`,y:`8.6`,width:`1.8`,height:`3.1`,rx:`0.9`}),(0,S.jsx)(`rect`,{x:`14.1`,y:`8.6`,width:`1.8`,height:`3.1`,rx:`0.9`})]}),(0,S.jsx)(`path`,{className:`critter-eyes critter-eyes-plus`,d:Na.plus}),(0,S.jsx)(`path`,{className:`critter-eyes critter-eyes-happy`,d:Na.happy})]}),(0,S.jsxs)(`g`,{className:`critter-glasses`,children:[(0,S.jsx)(`circle`,{cx:`9`,cy:`10.2`,r:`3`}),(0,S.jsx)(`circle`,{cx:`15`,cy:`10.2`,r:`3`})]})]}),(0,S.jsxs)(`g`,{className:`critter-page`,children:[(0,S.jsx)(`rect`,{x:`6.2`,y:`13.2`,width:`11.6`,height:`7`,rx:`1`}),(0,S.jsx)(`path`,{className:`critter-line-del`,d:`M8 15.1h4`}),(0,S.jsx)(`path`,{className:`critter-line-ctx`,d:`M8 16.7h6.5`}),(0,S.jsx)(`path`,{className:`critter-line-add`,pathLength:`1`,d:`M8 18.3h5.5`})]}),(0,S.jsxs)(`g`,{className:`critter-hands`,children:[(0,S.jsx)(`circle`,{cx:`6.2`,cy:`17`,r:`1.4`}),(0,S.jsx)(`circle`,{cx:`17.8`,cy:`17`,r:`1.4`})]}),(0,S.jsxs)(`g`,{className:`critter-pen`,children:[(0,S.jsx)(`path`,{d:`M14.6 19l3.4-3.6`}),(0,S.jsx)(`circle`,{cx:`18.3`,cy:`15.3`,r:`1.4`})]}),(0,S.jsxs)(`g`,{className:`critter-mag`,children:[(0,S.jsx)(`circle`,{className:`critter-lens`,cx:`21.6`,cy:`13.4`,r:`3`}),(0,S.jsx)(`path`,{d:`M23.7 15.6l2 2`}),(0,S.jsx)(`circle`,{className:`critter-mag-hand`,cx:`25.8`,cy:`17.7`,r:`1.4`})]})]}),(0,S.jsxs)(`g`,{className:`critter-z`,children:[(0,S.jsx)(`path`,{className:`critter-z-a`,d:`M17.5 0.5h3l-3 3h3`}),(0,S.jsx)(`path`,{className:`critter-z-b`,d:`M21.5 -4.5h4l-4 4h4`})]}),(0,S.jsxs)(`g`,{className:`critter-thought`,children:[(0,S.jsx)(`circle`,{cx:`20.5`,cy:`2.6`,r:`0.9`}),(0,S.jsx)(`circle`,{cx:`22.6`,cy:`0.2`,r:`1.15`}),(0,S.jsx)(`circle`,{cx:`25.2`,cy:`-2.6`,r:`1.4`})]}),(0,S.jsx)(`path`,{className:`critter-spark critter-spark-a`,d:`M19.5 1.5h2.4M20.7 0.3v2.4`}),(0,S.jsx)(`path`,{className:`critter-spark critter-spark-b`,d:`M2.5 2.5h2.4M3.7 1.3v2.4`}),(0,S.jsxs)(`g`,{className:`critter-badge`,children:[(0,S.jsx)(`circle`,{cx:`12`,cy:`-2.5`,r:`3`}),(0,S.jsx)(`path`,{d:`M10.6 -2.5l1 1 1.9-2`})]})]})}function Ba({eyes:e}){return(0,S.jsxs)(`svg`,{className:`critter-face`,width:`18`,height:`15`,viewBox:`3 3 18 15`,"aria-hidden":`true`,focusable:`false`,children:[(0,S.jsx)(`rect`,{x:`3`,y:`3.5`,width:`18`,height:`14`,rx:`4`}),e===`open`?(0,S.jsxs)(`g`,{className:`critter-face-open`,children:[(0,S.jsx)(`rect`,{x:`8.1`,y:`8.6`,width:`1.8`,height:`3.1`,rx:`0.9`}),(0,S.jsx)(`rect`,{x:`14.1`,y:`8.6`,width:`1.8`,height:`3.1`,rx:`0.9`})]}):(0,S.jsx)(`path`,{className:`critter-face-eyes`,d:Na[e]})]})}function Va({size:e=24,className:t,label:n}){return(0,S.jsx)(`svg`,{className:t?`icon living-mark ${t}`:`icon living-mark`,width:e,height:e,viewBox:`0 0 24 24`,focusable:`false`,"aria-hidden":!n||void 0,role:n?`img`:void 0,"aria-label":n,children:(0,S.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,children:[(0,S.jsx)(`path`,{className:`lm-minus`,d:`M3.3 7.4h2.6`}),(0,S.jsx)(`path`,{className:`lm-plus-h`,d:`M3.3 16.6h2.6`}),(0,S.jsx)(`path`,{className:`lm-plus-v`,d:`M4.6 15.3v2.6`}),(0,S.jsx)(`path`,{className:`lm-l1`,d:`M9.3 7.4H20.4`}),(0,S.jsx)(`path`,{d:`M9.3 12h8`}),(0,S.jsx)(`path`,{className:`lm-l3`,d:`M9.3 16.6h10.2`})]})})}function Ha({label:e,icon:t=`more`,children:n,align:r=`right`,triggerClassName:i=`btn btn-ghost btn-icon btn-sm`}){let[a,o]=(0,x.useState)(!1),s=(0,x.useRef)(null);return(0,x.useEffect)(()=>{if(!a)return;let e=e=>{s.current?.contains(e.target)||o(!1)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),o(!1))};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t,!0),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t,!0)}},[a]),(0,S.jsxs)(`div`,{className:`menu`,ref:s,children:[(0,S.jsx)(`button`,{type:`button`,className:i,"aria-label":e,"data-tip":a?void 0:e,"aria-haspopup":`menu`,"aria-expanded":a,onClick:e=>{e.stopPropagation(),o(e=>!e)},children:(0,S.jsx)(H,{name:t})}),a&&(0,S.jsx)(`div`,{className:`menu-panel${r===`left`?` menu-panel-left`:``}`,role:`menu`,children:n(()=>o(!1))})]})}function Ua({icon:e,kbd:t,checked:n,danger:r=!1,onClick:i,children:a}){return(0,S.jsxs)(`button`,{type:`button`,role:n===void 0?`menuitem`:`menuitemradio`,...n===void 0?{}:{"aria-checked":n},className:`menu-item${r?` menu-item-danger`:``}`,onClick:i,children:[e&&(0,S.jsx)(H,{name:e,size:`sm`}),(0,S.jsx)(`span`,{className:`menu-item-label`,children:a}),n&&(0,S.jsx)(H,{name:`check`,size:`sm`,className:`menu-item-check`}),t&&(0,S.jsx)(`span`,{className:`kbd`,children:t})]})}function Wa(){return(0,S.jsx)(`hr`,{className:`menu-sep`})}function Ga({children:e}){return(0,S.jsx)(`div`,{className:`menu-label`,children:e})}function Ka({changeset:e}){let{spec:t,repo:n,pr:r}=e;if(r)return null;let i=t.kind===`working-tree`,a=i?`working tree`:n.branch||`HEAD`,o=i?`HEAD`:t.base,s=[i?`comparing your working tree against HEAD${n.branch?` on branch ${n.branch}`:``}`:`comparing ${a} against ${o}`,n.worktree&&`linked worktree '${n.worktree}'`].filter(Boolean).join(` · `);return(0,S.jsxs)(`span`,{className:`cmp`,title:s,children:[(0,S.jsx)(`span`,{className:`repo`,children:n.name}),(0,S.jsx)(`span`,{className:`cmp-dot`,"aria-hidden":`true`,children:`·`}),(0,S.jsx)(`span`,{className:`cmp-side`,children:a}),(0,S.jsx)(H,{name:`arrow`,size:`sm`,className:`cmp-arrow`}),(0,S.jsx)(`span`,{className:`cmp-side cmp-side-base`,children:o})]})}var qa={success:`CI passing`,failure:`CI failing`,pending:`CI running`,none:`no checks`,unknown:`checks not visible to your token`};function Ja(e){return e.state===`open`?e.changesRequested>0?{label:`changes requested`,className:`chip-attn`}:e.checks.state===`failure`?{label:`CI failing`,className:`pr-check-failure`}:e.draft?{label:`draft`,className:`chip-mute pr-state pr-state-draft`}:e.checks.state===`pending`?{label:`CI running`,className:`pr-check-pending`}:null:{label:e.state,className:`chip-mute pr-state pr-state-${e.state}`}}function Ya({user:e,large:t=!1}){let n=t?`pr-avatar pr-avatar-lg`:`pr-avatar`;return e.avatarUrl?(0,S.jsx)(`img`,{className:n,src:e.avatarUrl,alt:``}):(0,S.jsx)(`span`,{className:`${n} pr-avatar-none`,children:(0,S.jsx)(H,{name:`user`,size:t?`md`:`sm`})})}var Xa=e=>{let t=ya(e);return/^\d/.test(t)?`${t} ago`:t};function Za({pr:e}){let[t,n]=(0,x.useState)(!1),r=e.commits.at(-1),i=[qa[e.checks.state],r?`pushed ${Xa(r.at)}`:``].filter(Boolean).join(` · `),a=e.approvals===0&&e.changesRequested===0?{text:`no reviews yet`,tone:`mute`}:e.changesRequested>0?{text:`changes requested${e.approvals>0?` · ${e.approvals} ${e.approvals===1?`approval`:`approvals`}`:``}`,tone:`attn`}:{text:`${e.approvals} ${e.approvals===1?`approval`:`approvals`}`,tone:`ok`},o=e.commits.length,s=t=>`https://${e.host}/${e.owner}/${e.repo}/pull/${e.number}/commits/${t}`;return(0,S.jsxs)(`section`,{className:`menu-panel menu-panel-left pr-card`,"aria-label":`pull request details`,children:[(0,S.jsxs)(`div`,{className:`pr-card-who`,children:[(0,S.jsx)(Ya,{user:e.author,large:!0}),(0,S.jsxs)(`span`,{className:`pr-card-who-text`,children:[(0,S.jsx)(`span`,{className:`pr-card-login`,children:e.author.login}),(0,S.jsxs)(`span`,{className:`pr-card-where`,children:[e.owner,`/`,e.repo,` #`,e.number]})]})]}),(0,S.jsxs)(`div`,{className:`pr-card-body`,children:[(0,S.jsxs)(`div`,{className:`pr-card-refs`,title:`${e.head.ref} into ${e.base.ref}`,children:[(0,S.jsx)(`code`,{className:`pr-ref`,children:e.head.ref}),(0,S.jsx)(H,{name:`arrow`,size:`sm`,className:`cmp-arrow`}),(0,S.jsx)(`code`,{className:`pr-ref pr-ref-base`,children:e.base.ref})]}),(0,S.jsxs)(`ul`,{className:`pr-card-facts`,children:[(0,S.jsxs)(`li`,{className:`pr-fact pr-fact-${e.checks.state}`,children:[(0,S.jsx)(`i`,{className:`pr-fact-dot`,"aria-hidden":`true`}),e.checks.url?(0,S.jsx)(`a`,{href:e.checks.url,target:`_blank`,rel:`noreferrer`,children:i}):i]}),(0,S.jsxs)(`li`,{className:`pr-fact pr-fact-${a.tone}`,children:[(0,S.jsx)(H,{name:a.tone===`ok`?`check`:a.tone===`attn`?`alert`:`chat`,size:`sm`}),a.text]})]}),o>0&&(0,S.jsxs)(`div`,{className:`pr-commits`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`pr-commits-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,S.jsx)(`span`,{className:`chevron${t?``:` chevron-shut`}`,children:(0,S.jsx)(H,{name:`chev`,size:`sm`})}),o,` `,o===1?`commit`:`commits`]}),t&&(0,S.jsx)(`ol`,{className:`pr-commit-list`,children:[...e.commits].reverse().map(e=>(0,S.jsx)(`li`,{children:(0,S.jsxs)(`a`,{className:`pr-commit`,href:s(e.sha),target:`_blank`,rel:`noreferrer`,title:`${e.subject}${e.author?`, by ${e.author.login}`:``}, opens on GitHub`,children:[(0,S.jsx)(`code`,{className:`pr-commit-sha`,children:e.sha.slice(0,7)}),(0,S.jsx)(`span`,{className:`pr-commit-subject`,children:e.subject}),(0,S.jsx)(`span`,{className:`pr-commit-ago`,children:ya(e.at)})]})},e.sha))})]})]}),(0,S.jsxs)(`a`,{className:`btn btn-ghost pr-card-link`,href:e.url,target:`_blank`,rel:`noreferrer`,children:[`Open on GitHub`,(0,S.jsx)(H,{name:`link`,size:`sm`})]})]})}function Qa({pr:e}){let[t,n]=(0,x.useState)(!1),r=(0,x.useRef)(null);(0,x.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)},i=e=>{e.key===`Escape`&&(e.stopPropagation(),n(!1))};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,i,!0),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,i,!0)}},[t]);let i=Ja(e);return(0,S.jsxs)(`span`,{className:`where pr-chips menu`,ref:r,children:[(0,S.jsxs)(`button`,{type:`button`,className:`pr-title`,"aria-haspopup":`dialog`,"aria-expanded":t,onClick:()=>n(e=>!e),title:t?void 0:`${e.owner}/${e.repo}#${e.number}: author, branches, checks, reviews`,children:[(0,S.jsx)(H,{name:`pr`,size:`sm`}),(0,S.jsxs)(`span`,{className:`pr-number`,children:[`#`,e.number]}),(0,S.jsx)(`span`,{className:`pr-title-text`,children:e.title})]}),i&&(0,S.jsx)(`span`,{className:`chip ${i.className}`,children:i.label}),t&&(0,S.jsx)(Za,{pr:e})]})}var $a={waiting:`no agent is attached; sends queue for the next poll, and the prompt is copied so you can paste it yourself`,listening:`your agent is here and listening; anything you send reaches it right away`,working:`the agent received feedback and is working on it`},eo=`the agent is attached but its last poll ended; a send queues and reaches it when it polls again`,to=`your agent opened this review and is reading the change before it starts listening — its guide lands first; a send queues and reaches it at its first poll`,no=/^(working on|answered|picked up|outlining) (.+)$/,ro=e=>e.charAt(0).toUpperCase()+e.slice(1);function io(e,t,n,r){if(e===`waiting`)return r?{verb:`Invite`,detail:`your agent`}:{verb:`No agent`};if(e===`listening`)return{verb:`Listening`};if(n){let e=no.exec(n);return e?{verb:ro(e[1]),detail:e[2]}:{verb:ro(n)}}return t===`arriving`?{verb:`Reading`,detail:`the change`}:t===`repolling`?{verb:`Paused`,detail:`sends wait`}:{verb:`Working`}}function ao(e,t,n){return n?`happy`:e===`waiting`?`shut`:e===`listening`||t===`arriving`||t===`repolling`?`open`:`plus`}function oo(e,t){return e===`working`?t===`repolling`?eo:t===`arriving`?to:$a[e]:$a[e]}function so(e){let t=Math.max(0,Math.round(e/1e3));return t<60?`${t}s`:`${Math.round(t/60)}m`}function co({presence:e,reason:t,since:n,activity:r,onInvite:i,batch:a,monitorOpen:o=!1,onOpenMonitor:s,monitorPanel:c,suggestion:l,seat:u,faceAway:d=!1,onHover:f}){let[,p]=(0,x.useState)(0),m=(0,x.useRef)(null),h=e===`working`&&typeof n==`number`;(0,x.useEffect)(()=>{if(!h)return;let e=setInterval(()=>p(e=>e+1),1e4);return()=>clearInterval(e)},[h]),(0,x.useEffect)(()=>{if(!o||!s)return;let e=e=>{m.current?.contains(e.target)||s(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[o,s]);let[g,_]=(0,x.useState)(!1),v=(0,x.useRef)(t);(0,x.useEffect)(()=>{let e=v.current;if(v.current=t,t!==`replied`||e===`replied`)return;_(!0);let n=setTimeout(()=>_(!1),1500);return()=>{clearTimeout(n),_(!1)}},[t]);let y=a?.segments.length??0,b=e!==`waiting`&&!!l&&y===0,C=b?{verb:`Suggests`,detail:`layers`}:io(e,t,r,e===`waiting`&&!!i),w=e===`waiting`?void 0:f,T=(0,S.jsx)(`span`,{className:`presence-face${d?` presence-face-away`:``}${g?` presence-face-cheer`:``}`,ref:u,"aria-hidden":`true`,children:(0,S.jsx)(Ba,{eyes:b?`happy`:ao(e,t,g)})}),E=(0,S.jsxs)(S.Fragment,{children:[T,(0,S.jsxs)(`span`,{className:`presence-label`,children:[(0,S.jsx)(`span`,{className:`presence-verb`,children:C.verb}),C.detail&&(0,S.jsxs)(S.Fragment,{children:[` `,(0,S.jsx)(`span`,{className:`presence-detail`,children:C.detail})]}),h&&(0,S.jsxs)(`span`,{className:`presence-ago`,children:[` · `,so(Date.now()-n)]})]})]});if(e===`waiting`&&i)return(0,S.jsx)(`button`,{type:`button`,className:`presence presence-waiting presence-invite`,onClick:i,title:`bring your agent into this review`,children:E});if(b)return(0,S.jsxs)(`button`,{type:`button`,className:`presence presence-${e} presence-suggests`,onClick:l.onOutline,onPointerEnter:w,title:l.reason?`the agent suggests reading this in layers: “${l.reason}”`:`the agent suggests reading this in layers`,children:[E,(0,S.jsx)(`span`,{className:`presence-cta`,children:`Ask it`})]});if(e===`waiting`||y===0||!s)return(0,S.jsx)(`span`,{className:`presence presence-${e}`,title:oo(e,t),onPointerEnter:w,children:E});let D=Math.round(a.done/y*100);return(0,S.jsxs)(`div`,{className:`menu monitor-anchor`,ref:m,children:[(0,S.jsxs)(`button`,{type:`button`,className:`presence presence-${e} presence-batch`,"aria-haspopup":`dialog`,"aria-expanded":o,onClick:()=>s(!o),onPointerEnter:w,title:`${$a[e]}. ${a.done} of ${y} answered; click to watch the queue`,children:[D>0&&(0,S.jsx)(`span`,{className:`presence-fill`,style:{width:`${D}%`},"aria-hidden":`true`}),E,` `,(0,S.jsxs)(`span`,{className:`presence-batch-n`,children:[a.done,`/`,y]})]}),o&&c]})}function lo({changeset:e,agent:t={},review:n={},settings:r={}}){let{openComments:i=0,publicDrafts:a=0,onFinishReview:o}=n,s=(0,x.useRef)(null),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(0),{theme:f,onSetTheme:p,critter:m=!0,onSetCritter:h,onShowShortcuts:g,onShowPrivacy:_}=r;return(0,S.jsxs)(`header`,{className:`top`,children:[(0,S.jsxs)(`span`,{className:`mark`,children:[(0,S.jsx)(Va,{size:36}),(0,S.jsx)(`span`,{className:`wordmark`,role:`img`,"aria-label":`Diffo`,children:[...`Diffo`].map((e,t)=>(0,S.jsx)(`span`,{className:`wordmark-letter`,style:{"--i":t},"aria-hidden":`true`,children:e},t))}),zt()&&(0,S.jsx)(`span`,{className:`dev-badge`,title:`this review is served by a diffo running from a source checkout, not the released CLI`,children:`dev`})]}),e.pr&&(0,S.jsx)(Qa,{pr:e.pr}),(0,S.jsx)(Ka,{changeset:e}),t.presence&&m?(0,S.jsx)(Ra,{presence:t.presence,reason:t.reason,seat:s,onAway:l,summon:u}):(0,S.jsx)(`span`,{className:`grow`}),t.presence&&(0,S.jsx)(co,{presence:t.presence,reason:t.reason,since:t.since,activity:t.activity,onInvite:t.onInvite,batch:t.batch,monitorOpen:t.monitorOpen,onOpenMonitor:t.onOpenMonitor,monitorPanel:t.monitorPanel,suggestion:t.suggestion,seat:s,faceAway:m&&c,onHover:m?()=>d(e=>e+1):void 0}),o&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:o,title:e.pr?a>0?`submit your review on GitHub with ${a} pending ${a===1?`comment`:`comments`}; private threads go to your agent`:`submit your review on GitHub; private threads and coverage go to your agent`:`finish review: send open comments + coverage to your agent`,children:e.pr?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(H,{name:`globe`,size:`sm`}),` Submit review`,a>0?` (${a})`:``]}):`Finish review${i>0?` (${i})`:``}`}),(0,S.jsx)(Ha,{label:`Settings`,triggerClassName:`btn btn-ghost btn-icon`,children:e=>(0,S.jsxs)(S.Fragment,{children:[p&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Ga,{children:`Theme`}),(0,S.jsx)(Ua,{icon:`display`,checked:f===`system`,onClick:()=>{e(),p(`system`)},children:`System`}),(0,S.jsx)(Ua,{icon:`sun`,checked:f===`light`,onClick:()=>{e(),p(`light`)},children:`Light`}),(0,S.jsx)(Ua,{icon:`moon`,checked:f===`dark`,onClick:()=>{e(),p(`dark`)},children:`Dark`})]}),h&&(0,S.jsxs)(S.Fragment,{children:[p&&(0,S.jsx)(Wa,{}),(0,S.jsx)(Ua,{icon:`sparkle`,checked:m,onClick:()=>{e(),h(!m)},children:`Companion`})]}),g&&(0,S.jsxs)(S.Fragment,{children:[(p||h)&&(0,S.jsx)(Wa,{}),(0,S.jsx)(Ua,{icon:`keys`,kbd:`?`,onClick:()=>{e(),g()},children:`Shortcuts`})]}),_&&(0,S.jsxs)(S.Fragment,{children:[(p||h||g)&&(0,S.jsx)(Wa,{}),(0,S.jsx)(Ua,{icon:`lock`,onClick:()=>{e(),_()},children:`Privacy`})]})]})})]})}function uo({presence:e,reason:t,onClose:n}){let{data:r,isLoading:i,error:a}=xt(!0),[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(!1),f=e!==`waiting`,[p,m]=(0,x.useState)(f?`connected`:`invite`),[h,g]=(0,x.useState)(!1),_=(0,x.useRef)(f);(0,x.useEffect)(()=>{f!==_.current&&(_.current=f,m(f?`connected`:`invite`),g(!f))},[f]);let v=(0,x.useRef)(n);v.current=n,(0,x.useEffect)(()=>{if(p!==`connected`)return;let e=setTimeout(()=>v.current(),1800);return()=>clearTimeout(e)},[p]);let y=e=>{wt(e).then(e=>{l(!e),e&&(s(!0),d(!0),setTimeout(()=>s(!1),2500))})};return p===`connected`?(0,S.jsx)(jt,{title:`Agent attached`,onClose:n,children:(0,S.jsxs)(`div`,{className:`invite-connected`,children:[(0,S.jsx)(`span`,{className:`presence-dot`}),(0,S.jsx)(`p`,{className:`cov-note`,children:`Everything you send from here lands in that thread.`})]})}):(0,S.jsxs)(jt,{title:`Connect your agent`,onClose:n,children:[h&&(0,S.jsxs)(`div`,{className:`warn`,children:[(0,S.jsx)(H,{name:`alert`,size:`sm`}),(0,S.jsx)(`div`,{children:t===`ended`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`b`,{children:`Your agent left the review`}),`: it detached on purpose. Bring it back whenever you like.`]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`b`,{children:`Your agent disconnected`}),`: its poll died without detaching.`]})})]}),i&&(0,S.jsx)(`div`,{className:`shimmer`}),a&&(0,S.jsxs)(`p`,{className:`cov-note`,children:[`Couldn't build the invite: `,a.message]}),r&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`p`,{className:`cov-note`,children:`Paste this to your agent. Its Diffo skill does the rest.`}),(0,S.jsxs)(`button`,{type:`button`,className:`invite-cmd`,title:o?`Copied`:`copy the ask`,onClick:()=>y(r.ask),children:[(0,S.jsx)(`code`,{children:r.ask}),(0,S.jsx)(H,{name:o?`check`:`copy`,size:`sm`})]}),u&&(0,S.jsxs)(`div`,{className:`invite-live`,children:[(0,S.jsx)(`span`,{className:`presence-dot`}),`Listening for your agent…`]}),c&&(0,S.jsxs)(`div`,{className:`warn`,children:[(0,S.jsx)(H,{name:`alert`,size:`sm`}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`b`,{children:`Couldn't reach the clipboard`}),`: this browser blocked it. Select the text and copy it by hand.`]})]})]})]})}function fo(e){return e.hunks.length>0?e.hunks.map(e=>e.id):[po(e)]}function po(e){return`file:${e.status}:${e.oldPath??``}${e.path}`}function mo(e,t){return t!==void 0&&fo(e).every(e=>t.has(e))}var ho=`Since your review`;function go(e,t){return e.hunks.find(e=>e.lines.some(e=>e.kind!==`del`&&e.newNo===t))}function _o(e,t){let n=t.get(e.path);if(!n)return{at:e};let r=e.line===void 0?void 0:go(n,e.line);return r?{at:e,file:n,hunkId:r.id}:{at:e,file:n}}function vo(e,t){if(e&&e.length!==0)return e.map(e=>({decision:e,places:(e.at??[]).map(e=>_o(e,t))}))}function yo(e,t){if(!e||e.items.length===0)return[];let n=new Map(t.map(e=>[e.path,e])),r=new Set,i=e.items.map((e,t)=>{let i=new Set,a=[],o=[];for(let t of e.files){let e=dt(t);if(i.has(e))continue;i.add(e),r.add(e);let s=n.get(e);if(!s){o.push(e);continue}let c=ft(t);a.push(c?{file:s,note:c}:{file:s})}let s=vo(e.decisions,n);return{id:e.id,number:t+1,title:e.title,...e.summary?{summary:e.summary}:{},...e.kind?{kind:e.kind}:{},files:a,missing:o,derived:!1,...s?{decisions:s}:{}}}),a=t.filter(e=>!r.has(e.path));return a.length>0&&i.push({id:null,number:null,title:ho,files:a.map(e=>({file:e})),missing:[],derived:!0}),i}function bo(e,t){return e.map(e=>{let n=e.files.filter(e=>!t(e.file)),r=e.files.length-n.length;return r===0?e:{...e,files:n,hidden:r}})}function xo(e){return e.id??`since`}function So(e){return e.filter(e=>e.anchor.kind===`changeset`&&ct(e)).at(-1)}function Co(e){return e.find(e=>e.github?.kind===`description`)}function wo(e){let t=new Map;for(let n of e)for(let{file:e}of n.files)t.has(e.path)||t.set(e.path,n);return t}function To(e,t){let n=0,r=0,i=0;for(let{file:a}of e.files){let e=fo(a),o=e.filter(e=>t.has(e)).length;n+=e.length,r+=o,o===e.length&&i++}return{files:e.files.length,doneFiles:i,marks:n,doneMarks:r}}function Eo(e,t){let n=To(e,t);return n.doneFiles===n.files}function Do(e,t,n,r=()=>!1){for(let i=t+n;i>=0&&i<e.length;i+=n)if(!r(e[i]))return i;return null}function Oo(e,t){let n=e.findIndex(e=>e.files.length>0&&!Eo(e,t));return n===-1?0:n}var ko=`#diffo-file:`;function Ao(e,t){return`${ko}${encodeURIComponent(e)}${t===null?``:`:${t}`}`}function jo(e){if(!e.startsWith(`#diffo-file:`))return null;let t=e.slice(12),n=/^(.*):(\d+)$/.exec(t);try{return n?{path:decodeURIComponent(n[1]),line:Number.parseInt(n[2],10)}:{path:decodeURIComponent(t),line:null}}catch{return null}}var Mo=/`([^`\n]+)`/g,No=/^([^\s:`]+?)(?::(\d+)(?:-\d+)?)?$/;function Po(e){let t=e.closest(`a[href], [data-diffo-jump]`);return t?jo(t.getAttribute(`data-diffo-jump`)??t.getAttribute(`href`)??``):null}function Fo(e,t){if(t.includes(e))return e;let n=t.filter(t=>t.slice(t.lastIndexOf(`/`)+1)===e);return n.length===1?n[0]:null}function J(e,t){return t.length===0?e:e.split(/(```[\s\S]*?```|\[[^\]\n]*\]\([^)\n]*\))/).map((e,n)=>n%2==1?e:e.replace(Mo,(e,n)=>{let r=No.exec(n);if(!r)return e;let i=Fo(r[1],t);return i===null?e:`[${e}](${Ao(i,r[2]===void 0?null:Number.parseInt(r[2],10))})`})).join(``)}function Y({state:e=!1}){return(0,S.jsx)(`span`,{className:`markbox`,"data-state":e===`mixed`?`mixed`:e?`on`:`off`,"aria-hidden":`true`,children:e===!0&&(0,S.jsx)(H,{name:`check`,size:`sm`})})}var Io=()=>{let e=document.documentElement.getAttribute(`data-theme`);return e===`dark`?!0:e===`light`?!1:window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1};function Lo(){let[e,t]=(0,x.useState)(()=>typeof window<`u`&&Io());return(0,x.useEffect)(()=>{let e=()=>t(Io()),n=window.matchMedia?.(`(prefers-color-scheme: dark)`);n?.addEventListener(`change`,e);let r=new MutationObserver(e);return r.observe(document.documentElement,{attributeFilter:[`data-theme`]}),()=>{n?.removeEventListener(`change`,e),r.disconnect()}},[]),e}function Ro(e){return`file-${e.replace(/[^a-zA-Z0-9_-]/g,`_`)}`}function zo(e,t,n=`start`){let r=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1,i=e.closest(`.reading-pane`),a=i?.scrollTop,o=()=>e.scrollIntoView({behavior:r?`instant`:`smooth`,block:n});if(o(),r){t?.(e);return}let s=i?.querySelector(`.reading-col`),c=e.offsetTop,l=null;s&&typeof ResizeObserver==`function`&&(l=new ResizeObserver(()=>{let t=e.offsetTop;t!==c&&(c=t,o())}),l.observe(s));let u=!1,d=()=>{u||(u=!0,l?.disconnect(),i&&i.scrollTop===a&&e.scrollIntoView({behavior:`instant`,block:n}),t?.(e))};i?.addEventListener(`scrollend`,d,{once:!0}),setTimeout(d,1200)}var Bo=[/[._-](test|spec)s?\.[^/]+$/,/(^|\/)test_[^/]+$/,/(^|[/.a-z0-9])Tests?\.[^/]+$/,/(^|\/)test[-_]?([Uu]tils?|[Hh]elpers?|[Ss]etup|[Ss]upport)\.[^/]+$/,/\.cy\.[^/]+$/,/[._-]e2e\.[^/]+$/,/(^|\/)(jest|vitest|playwright|cypress|karma|wdio|protractor)[.-](config|setup)(\.[^/]+)?$/,/\.snap$/,/[a-z0-9]Specs?\.(kt|kts|scala|groovy|swift)$/,/[a-z0-9](IT|ITCase)\.(java|kt|groovy|scala)$/,/(^|\/)(conftest|tests?)\.py$/,/(^|\/)pytest\.ini$/,/(^|\/)(spec|rails)_helper\.rb$/,/(^|\/)spec\/.+\.rb$/,/(^|\/)phpunit\.xml(\.dist)?$/,/(^|\/)mock_[^/]+\.go$/,/_mock\.go$/,/\.golden$/,/\.(feature|robot)$/,/(^|\/)(__tests__|__mocks__|__snapshots__|__fixtures__|[Tt]ests?)\//,/\.([A-Z][A-Za-z]*)?Tests?\//,/(^|\/)[a-z]+Tests?\//,/(^|\/)test[A-Z][A-Za-z]*\//,/(^|\/)tests?[-_][a-z]+\//,/(^|[/_-])e2e([-_][^/]*)?\//,/(^|\/)(cypress|playwright|testdata|step_definitions|mocks)\//];function Vo(e){return Bo.some(t=>t.test(e))}var Ho=`diffo:ui:hideReviewed`,Uo=`diffo:ui:hideTests`;function Wo(e){let t=localStorage.getItem(e);return t===`1`||t!==`0`&&null}function Go(e,t){let n=0,r=0,i=0,a=0,o=[];for(let s of e){let e=t.isDone(s);if(!t.pinned.has(s.path)){if(t.onlyChanged&&!t.changed.has(s.path)){e||(a++,o.push(s.path));continue}if(t.hideTests&&Vo(s.path)){e||(i++,o.push(s.path));continue}}r++,e||n++}return{left:n,total:r,excludedTests:i,excludedUnchanged:a,excludedPaths:o}}function Ko(e,t){let n=[],r=t.query.trim().toLowerCase(),i=0,a=0,o=0,s=0;for(let c of e){if(t.pinned.has(c.path)){n.push(c);continue}if(r!==``&&!c.path.toLowerCase().includes(r)){s++;continue}if(t.onlyChanged&&!t.changed.has(c.path)){o++;continue}if(t.hideTests&&Vo(c.path)){i++;continue}if(t.hideReviewed&&t.isDone(c)){a++;continue}n.push(c)}return{visible:n,hiddenTests:i,hiddenReviewed:a,hiddenUnchanged:o,hiddenQuery:s}}function qo(e,t,n){let[r,i]=(0,x.useState)(()=>Wo(Ho)),[a,o]=(0,x.useState)(()=>Wo(Uo)),[s,c]=(0,x.useState)(new Set),[l,u]=(0,x.useState)(``),d=(0,x.useCallback)(e=>{u(e),c(e=>e.size===0?e:new Set)},[]),f=r??e.length>25,p=a??!1,m=(0,x.useCallback)(e=>{localStorage.setItem(Ho,e?`1`:`0`),i(e),c(new Set)},[]),h=(0,x.useCallback)(e=>{localStorage.setItem(Uo,e?`1`:`0`),o(e)},[]),g=(0,x.useCallback)(e=>{c(t=>t.has(e)?t:new Set(t).add(e))},[]),_=(0,x.useCallback)(e=>{c(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),v=n.set,y=(0,x.useCallback)(()=>{localStorage.setItem(Ho,`0`),localStorage.setItem(Uo,`0`),i(!1),o(!1),c(new Set),u(``),v(!1)},[v]),b=(0,x.useMemo)(()=>Ko(e,{query:l,hideReviewed:f,hideTests:p,onlyChanged:n.on,changed:n.changed,pinned:s,isDone:t}),[e,l,f,p,n.on,n.changed,s,t]),S=(0,x.useMemo)(()=>e.filter(e=>Vo(e.path)).length,[e]),C=(0,x.useMemo)(()=>Go(e,{hideTests:p,onlyChanged:n.on,changed:n.changed,pinned:s,isDone:t}),[e,p,n.on,n.changed,s,t]);return{query:l,setQuery:d,hideReviewed:f,hideTests:p,setHideReviewed:m,setHideTests:h,onlyChanged:n.on,setOnlyChanged:v,files:b.visible,hiddenTests:b.hiddenTests,hiddenReviewed:b.hiddenReviewed,hiddenUnchanged:b.hiddenUnchanged,hiddenQuery:b.hiddenQuery,testCount:S,changedCount:n.changed.size,scope:C,pinned:s,pin:g,unpin:_,showAll:y}}var Jo=e=>e.slice(e.lastIndexOf(`/`)+1),Yo={added:`new file`,deleted:`deleted`,renamed:`renamed`,modified:`edited`};function Xo(e){let t={dirs:new Map,files:[],path:``};for(let n of e){let e=n.path.split(`/`),r=t;for(let t of e.slice(0,-1)){let e=r.dirs.get(t);e||(e={dirs:new Map,files:[],path:r.path===``?t:`${r.path}/${t}`},r.dirs.set(t,e)),r=e}r.files.push(n)}let n=e=>{let t=[];for(let[r,i]of e.dirs){let e={kind:`dir`,name:r,path:i.path,children:n(i)};for(;;){let t=e.children.length===1?e.children[0]:void 0;if(t===void 0||t.kind!==`dir`)break;e={kind:`dir`,name:`${e.name}/${t.name}`,path:t.path,children:t.children}}t.push(e)}t.sort((e,t)=>e.name.localeCompare(t.name));let r=e.files.map(e=>({kind:`file`,file:e})).sort((e,t)=>Jo(e.file.path).localeCompare(Jo(t.file.path)));return[...t,...r]};return n(t)}function Zo(e){return e.kind===`file`?[e.file]:e.children.flatMap(Zo)}function Qo(e){return Xo(e).flatMap(Zo)}function $o({file:e,depth:t,done:n,current:r,threads:i,wantsYou:a=0,changed:o=!1,note:s,onPick:c,onToggleViewed:l,onAsk:u}){let d=i?.length??0,f=0,p=0;for(let t of e.hunks)for(let e of t.lines)e.kind===`add`?f++:e.kind===`del`&&p++;let m=f>0||p>0?` · ${f>0?`+${f}`:``}${f>0&&p>0?` `:``}${p>0?`−${p}`:``}`:``;return(0,S.jsxs)(`div`,{className:`row${n?` row-done`:``}`,"aria-current":r?`true`:void 0,"data-path":e.path,style:{paddingLeft:12+t*14},children:[(0,S.jsx)(`button`,{type:`button`,className:`row-box`,role:`checkbox`,"aria-checked":n,"aria-label":`${n?`Mark not reviewed`:`Mark reviewed`}: ${e.path}`,"data-tip":n?`Mark not reviewed`:`Mark reviewed`,disabled:!l,onClick:l,children:(0,S.jsx)(Y,{state:n})}),(0,S.jsx)(`button`,{type:`button`,className:`row-pick`,title:`${e.path} · ${Yo[e.status]}${n?` · read`:``}${m}${s?`, ${s}`:``}`,onClick:()=>{if(c)return c();let t=document.getElementById(Ro(e.path));t&&zo(t)},children:(0,S.jsxs)(`span`,{className:`row-name`,children:[e.status===`added`&&(0,S.jsx)(`span`,{className:`row-st row-st-add`,"aria-hidden":`true`,children:`+`}),e.status===`deleted`&&(0,S.jsx)(`span`,{className:`row-st row-st-del`,"aria-hidden":`true`,children:`−`}),e.status===`renamed`&&e.oldPath!==null&&(0,S.jsxs)(`span`,{className:`row-was`,children:[Jo(e.oldPath),` →`]}),(0,S.jsx)(`span`,{className:`row-base${e.status===`deleted`?` row-base-del`:``}`,children:Jo(e.path)})]})}),(0,S.jsxs)(`span`,{className:`row-right`,children:[o&&(0,S.jsx)(`span`,{role:`img`,className:`row-since row-since-changed`,title:`your agent rewrote this since you last finished a review`,"aria-label":`changed since your last review`}),(0,S.jsx)(`span`,{className:`row-passive`,children:a>0?(0,S.jsxs)(`span`,{className:`row-count row-count-hot`,title:`${a} of ${d} thread${d===1?``:`s`} needs you`,children:[(0,S.jsx)(H,{name:`chat`,size:`sm`}),a,` needs you`]}):d>0?(0,S.jsxs)(`span`,{className:`row-count`,title:`${d} thread${d===1?``:`s`}`,children:[(0,S.jsx)(H,{name:`chat`,size:`sm`}),d]}):null}),(0,S.jsx)(`span`,{className:`row-acts`,children:u&&(0,S.jsx)(`button`,{type:`button`,className:`row-act`,"data-tip":`Comment on this file`,"aria-label":`Comment on this file`,onClick:u,children:(0,S.jsx)(H,{name:`chat`,size:`sm`})})})]})]})}function es({files:e,viewed:t,selectedPath:n,onPickFile:r,onToggleFileViewed:i,onMarkFiles:a,onClearFiles:o,onAskFile:s,threads:c,attention:l,changed:u,notes:d,forceOpen:f=!1}){let[p,m]=(0,x.useState)(new Set),h=(0,x.useCallback)(e=>mo(e,t),[t]),g=(0,x.useMemo)(()=>Xo(e),[e]),_=(e,t)=>(0,S.jsx)($o,{file:e,depth:t,done:h(e),current:n===e.path,threads:c?.get(e.path),wantsYou:(l?.get(e.path)??[]).filter(e=>e.turn===`yours`).length,changed:u?.has(e.path)??!1,note:d?.get(e.path),onPick:r?()=>r(e.path):void 0,onToggleViewed:i?()=>i(e.path):void 0,onAsk:s?()=>s(e.path):void 0},e.path),v=(e,t)=>{let n=Zo(e),r=f||!p.has(e.path),i=n.filter(h).length,s=n.length>0&&i===n.length,c=n.filter(e=>!h(e)),l=(0,S.jsxs)(`div`,{className:`row row-dir${s?` row-done`:``}`,style:{paddingLeft:12+t*14},children:[(0,S.jsx)(`button`,{type:`button`,className:`row-box`,role:`checkbox`,"aria-checked":s?!0:i>0&&`mixed`,"aria-label":s?`Mark ${e.name} not reviewed`:`Mark ${c.length} file${c.length===1?``:`s`} in ${e.name} reviewed`,"data-tip":s?`Mark ${n.length} file${n.length===1?``:`s`} not reviewed`:`Mark ${c.length} file${c.length===1?``:`s`} reviewed`,disabled:s?!o:!a,onClick:()=>{s?o?.(n.map(e=>e.path)):a?.(c.map(e=>e.path))},children:(0,S.jsx)(Y,{state:s?!0:i>0&&`mixed`})}),(0,S.jsx)(`button`,{type:`button`,className:`row-pick`,title:e.path,"aria-expanded":r,onClick:()=>m(t=>{let n=new Set(t);return r?n.add(e.path):n.delete(e.path),n}),children:(0,S.jsxs)(`span`,{className:`row-name`,children:[(0,S.jsx)(`span`,{className:`chevron${r?``:` chevron-shut`}`,children:(0,S.jsx)(H,{name:`chev`,size:`sm`})}),(0,S.jsx)(`span`,{className:`dir-ico`,children:(0,S.jsx)(H,{name:`folder`,size:`sm`})}),(0,S.jsx)(`span`,{className:`row-base`,children:e.name})]})})]},`dir:${e.path}`);return r?[l,...y(e.children,t+1)]:[l]},y=(e,t)=>e.flatMap(e=>e.kind===`file`?[_(e.file,t)]:v(e,t));return(0,S.jsx)(S.Fragment,{children:y(g,0)})}function ts({files:e,viewed:t,selectedPath:n,onPickFile:r,onToggleFileViewed:i,onMarkFiles:a,onClearFiles:o,onAskFile:s,threads:c,attention:l,changed:u,query:d,onQuery:f,focusTick:p=0,hideReviewed:m=!1,onHideReviewed:h,hideTests:g=!1,onHideTests:_,onlyChanged:v=!1,onOnlyChanged:y}){let[b,C]=(0,x.useState)(``),w=d??b,T=f??C,E=(0,x.useRef)(null);(0,x.useEffect)(()=>{p>0&&E.current?.focus()},[p]);let D=(0,x.useCallback)(e=>mo(e,t),[t]),O=(0,x.useMemo)(()=>{let t=w.trim().toLowerCase();return e.filter(e=>(t===``||e.path.toLowerCase().includes(t))&&!(m&&D(e))&&!(g&&Vo(e.path))&&!(v&&!(u?.has(e.path)??!1)))},[e,w,m,g,v,u,D]),k=w.trim()!==``,A=w.trim().toLowerCase(),j=e.filter(e=>A===``||e.path.toLowerCase().includes(A)).length-O.length,M=!!(h||_||y);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`rail-search`,children:(0,S.jsxs)(`span`,{className:`sb`,children:[(0,S.jsx)(H,{name:`search`,size:`sm`}),(0,S.jsx)(`input`,{ref:E,className:`nav-search`,type:`search`,placeholder:`Filter files`,"aria-label":`Filter files`,title:`Press / to jump here`,value:w,onChange:e=>T(e.target.value)}),w!==``&&(0,S.jsx)(`button`,{type:`button`,className:`sb-clear`,"data-tip":`Clear filter`,"aria-label":`Clear filter`,onClick:()=>{T(``),E.current?.focus()},children:(0,S.jsx)(H,{name:`x`,size:`sm`})})]})}),(0,S.jsxs)(`div`,{className:`rail-scroll`,children:[(0,S.jsx)(es,{files:O,viewed:t,selectedPath:n,onPickFile:r,onToggleFileViewed:i,onMarkFiles:a,onClearFiles:o,onAskFile:s,threads:c,attention:l,changed:u,forceOpen:k}),O.length===0&&j===0&&(0,S.jsx)(`div`,{className:`rail-empty`,children:`no files match`})]}),j>0&&(0,S.jsxs)(`div`,{className:`rail-hidden`,children:[j,` `,j===1?`file`:`files`,` hidden by filters`,M&&(0,S.jsx)(`button`,{type:`button`,className:`rail-hidden-show`,onClick:()=>{m&&h?.(!1),g&&_?.(!1),v&&y?.(!1)},children:`show`})]})]})}var ns=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function rs(e,t){let n=e.hidden??0;if(e.files.length===0)return n>0?`${ns(n,`test`)} hidden`:e.missing.length===0?`nothing here now`:`${ns(e.missing.length,`listed file`)} not in the changeset`;let r=To(e,t),i=r.doneFiles===r.files?` · read`:``,a=e.kind===`mechanical`?` · mechanical`:``,o=n>0?` · ${n} hidden`:``;return`${ns(r.files,`file`)}${i}${a}${o}`}function is({layer:e,index:t,current:n,open:r,onToggleOpen:i,viewed:a,threadCount:o,onPick:s,onMarkFiles:c,onClearFiles:l}){let u=To(e,a),d=u.files>0&&u.doneFiles===u.files,f=u.doneMarks>0,p=e.files.filter(e=>!mo(e.file,a)).map(e=>e.file.path),m=e.files.map(e=>e.file.path);return(0,S.jsxs)(`div`,{className:`row row-layer${d?` row-done`:``}${e.derived?` row-layer-since`:``}`,"aria-current":n?`true`:void 0,"data-layer":e.id??`since`,onClick:()=>s(t),children:[(0,S.jsx)(`button`,{type:`button`,className:`row-box`,role:`checkbox`,"aria-checked":d?!0:f?`mixed`:!1,"aria-label":d?`Mark ${e.title} not reviewed`:`Mark ${ns(p.length,`file`)} in ${e.title} reviewed`,"data-tip":d?`Mark ${ns(m.length,`file`)} not reviewed`:`Mark ${ns(p.length,`file`)} reviewed`,disabled:m.length===0||(d?!l:!c),onClick:e=>{e.stopPropagation(),d?l?.(m):c?.(p)},children:(0,S.jsx)(Y,{state:d?!0:f?`mixed`:!1})}),(0,S.jsxs)(`button`,{type:`button`,className:`row-pick`,title:e.title,onClick:e=>{e.stopPropagation(),s(t)},children:[(0,S.jsx)(`span`,{className:`row-name`,children:(0,S.jsx)(`span`,{className:`row-base`,children:e.title})}),(0,S.jsxs)(`span`,{className:`ch-sub`,children:[u.doneMarks>0&&(0,S.jsx)(`span`,{className:`prog-track`,"aria-hidden":`true`,children:(0,S.jsx)(`i`,{style:{width:`${u.marks===0?0:Math.round(u.doneMarks/u.marks*100)}%`}})}),(0,S.jsx)(`span`,{children:rs(e,a)})]})]}),(0,S.jsxs)(`span`,{className:`row-right`,children:[o>0&&(0,S.jsxs)(`span`,{className:`row-count`,title:ns(o,`thread`),children:[(0,S.jsx)(H,{name:`chat`,size:`sm`}),o]}),e.files.length>0&&(0,S.jsx)(`button`,{type:`button`,className:`row-act ch-fold chevron${r?``:` chevron-shut`}`,"aria-expanded":r,"aria-label":`${r?`Hide`:`Show`} the files in ${e.title}`,"data-tip":r?`Hide files`:`Show files`,onClick:e=>{e.stopPropagation(),i()},children:(0,S.jsx)(H,{name:`chev`,size:`sm`})})]})]})}function as({layer:e,...t}){let n=(0,x.useMemo)(()=>e.files.map(e=>e.file),[e.files]),r=(0,x.useMemo)(()=>new Map(e.files.flatMap(e=>e.note?[[e.file.path,e.note]]:[])),[e.files]);return(0,S.jsx)(es,{files:n,notes:r,...t})}function os({layers:e,activeIndex:t,onPick:n,viewed:r,guide:i,description:a,overviewActive:o=!1,onOpenGuide:s,threads:c,attention:l,changed:u,selectedPath:d,onPickFile:f,onToggleFileViewed:p,onMarkFiles:m,onClearFiles:h,onAskFile:g,onRefresh:_,request:v=null}){let y=e=>e.files.reduce((e,t)=>e+(c?.get(t.file.path)?.length??0),0),[b,C]=(0,x.useState)(new Set),w=e=>b.has(e.id??`since`),T=e=>C(t=>{let n=new Set(t),r=e.id??`since`;return n.has(r)?n.delete(r):n.add(r),n});return(0,S.jsxs)(`div`,{className:`rail-scroll`,children:[(i||a)&&(0,S.jsxs)(`div`,{className:`row row-layer row-layer-overview`,"aria-current":o?`true`:void 0,onClick:s,children:[(0,S.jsx)(`span`,{className:`row-box`,"aria-hidden":`true`,children:(0,S.jsx)(Y,{})}),(0,S.jsxs)(`button`,{type:`button`,className:`row-pick`,title:a&&i?`The pull request description, and the agent’s guide to this change`:a?`The pull request description`:`The agent’s guide to this change`,onClick:e=>{e.stopPropagation(),s?.()},children:[(0,S.jsx)(`span`,{className:`row-name`,children:(0,S.jsx)(`span`,{className:`row-base`,children:`Overview`})}),(0,S.jsx)(`span`,{className:`ch-sub`,children:(0,S.jsx)(`span`,{children:a&&i?`the description, and the agent’s guide`:a?`the pull request description`:`the agent’s guide`})})]}),(0,S.jsx)(`span`,{className:`row-right`})]}),e.map((e,i)=>{let a=i===t,o=w(e);return(0,S.jsxs)(`div`,{className:`ch-layer`,children:[e.derived&&(0,S.jsx)(`div`,{className:`rail-rule`}),(0,S.jsx)(is,{layer:e,index:i,current:a,open:o,onToggleOpen:()=>T(e),viewed:r,threadCount:y(e),onPick:n,onMarkFiles:m,onClearFiles:h}),o&&e.files.length>0&&(0,S.jsx)(`div`,{className:`ch-files`,children:(0,S.jsx)(as,{layer:e,viewed:r,selectedPath:d,threads:c,attention:l,changed:u,onPickFile:f,onToggleFileViewed:p,onMarkFiles:m,onClearFiles:h,onAskFile:g})})]},e.id??`since`)}),v===null?_?(0,S.jsx)(`button`,{type:`button`,className:`ch-foot ch-foot-act`,title:`the change moved on; a re-post keeps your place`,onClick:_,children:`Ask the agent to re-outline…`}):(0,S.jsx)(`div`,{className:`ch-foot`,title:`Invite one from the header`,children:`No agent attached to re-outline`}):(0,S.jsxs)(`div`,{className:`ch-foot ch-foot-live`,"aria-live":`polite`,children:[(0,S.jsxs)(`span`,{className:`ch-working`,"aria-hidden":`true`,children:[(0,S.jsx)(`i`,{}),(0,S.jsx)(`i`,{}),(0,S.jsx)(`i`,{})]}),` `,v===`outlining`?`re-outlining…`:`asked · waits for the open threads`]})]})}function ss({state:e,onOutline:t,onInvite:n}){if(e===`queued`||e===`outlining`){let t=e===`outlining`;return(0,S.jsx)(`div`,{className:`rail-scroll`,children:(0,S.jsxs)(`div`,{className:`ch-empty`,"data-state":e,"aria-live":`polite`,children:[(0,S.jsxs)(`h2`,{className:`ch-empty-title`,children:[(0,S.jsxs)(`span`,{className:`ch-working${t?``:` ch-working-idle`}`,"aria-hidden":`true`,children:[(0,S.jsx)(`i`,{}),(0,S.jsx)(`i`,{}),(0,S.jsx)(`i`,{})]}),t?`Outlining…`:`Asked`]}),(0,S.jsx)(`p`,{className:`ch-empty-sub`,children:t?`The steps appear here as soon as the agent posts them.`:`The agent starts once it finishes the threads it’s answering.`})]})})}return(0,S.jsx)(`div`,{className:`rail-scroll`,children:(0,S.jsxs)(`div`,{className:`ch-empty`,"data-state":e,"aria-live":`polite`,children:[(0,S.jsx)(`h2`,{className:`ch-empty-title`,children:`Read in layers`}),(0,S.jsx)(`p`,{className:`ch-empty-sub`,children:`The agent splits its change into steps you read in order.`}),e===`noagent`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`p`,{className:`ch-empty-note`,children:`No agent is attached to outline it.`}),n&&(0,S.jsx)(`button`,{type:`button`,className:`btn ch-empty-cta`,onClick:n,children:`Invite an agent`})]}):(0,S.jsxs)(`button`,{type:`button`,className:`btn ch-empty-cta`,onClick:t,disabled:!t,children:[(0,S.jsx)(H,{name:`list`,size:`sm`}),`Ask the agent to outline`]})]})})}function cs({tab:e,onSetTab:t,fileCount:n,threadCount:r,settledCount:i=0,wantsYou:a,layerCount:o=null,layersSuggested:s=!1,layers:c,files:l,threads:u}){return(0,S.jsxs)(`nav`,{className:`rail`,children:[(0,S.jsxs)(`div`,{className:`tabs`,role:`tablist`,"aria-label":`Files, threads, or layers`,children:[(0,S.jsxs)(`button`,{type:`button`,role:`tab`,className:`tab`,"aria-selected":e===`files`,onClick:()=>t(`files`),children:[`Files `,(0,S.jsx)(`span`,{className:`tab-n`,children:n})]}),(0,S.jsxs)(`button`,{type:`button`,role:`tab`,className:`tab`,"aria-selected":e===`threads`,onClick:()=>t(`threads`),title:i>0?`${r} still going · ${i} settled`:void 0,children:[a>0&&(0,S.jsx)(`span`,{className:`tab-dot`,"aria-hidden":`true`}),`Threads `,(0,S.jsx)(`span`,{className:`tab-n`,children:r})]}),(0,S.jsxs)(`button`,{type:`button`,role:`tab`,className:`tab`,"aria-selected":e===`layers`,onClick:()=>t(`layers`),title:o===null?`The agent’s reading plan, once it posts one`:void 0,children:[s&&o===null&&(0,S.jsx)(`span`,{className:`tab-dot`,"aria-hidden":`true`}),`Layers `,o!==null&&(0,S.jsx)(`span`,{className:`tab-n`,children:o})]})]}),e===`layers`?c:e===`files`?l:u]})}var ls=(0,x.createContext)(null);function us(){return(0,x.useContext)(ls)}function ds(e){return e.state===`resolved`?`resolved`:at(e)?e.state===`open`&&!e.github?`note`:`posted`:ut(e)&&e.state===`open`?`proposed`:e.state===`open`?`note`:e.messages.at(-1)?.author===`agent`?e.awaitingFollowUp===!0?`agent`:`yours`:e.withheld?`note`:e.unanswered?e.state===`addressed`?`yours`:`unanswered`:`agent`}function fs(e){return(e.state===`open`||e.withheld===!0)&&!ut(e)&&!at(e)}var ps=[`yours`,`unanswered`,`proposed`,`agent`,`note`,`posted`,`resolved`],ms={yours:`Your turn`,unanswered:`No answer`,proposed:`From the agent`,agent:`Waiting on agent`,note:`Draft`,posted:`On GitHub`,resolved:`Resolved`},hs=[`yours`,`proposed`,`agent`,`note`,`posted`,`settled`],gs={yours:`Your turn`,proposed:`From the agent`,agent:`Waiting on the agent`,note:`Drafts`,posted:`On GitHub`,settled:`Settled`};function _s(e){switch(e){case`yours`:case`unanswered`:return`yours`;case`proposed`:return`proposed`;case`agent`:return`agent`;case`note`:return`note`;case`posted`:return`posted`;case`resolved`:return`settled`}}function vs(e){if(e.state===`open`||e.state===`resolved`||at(e))return null;let t=e.messages.at(-1)?.author===`agent`&&e.awaitingFollowUp!==!0,n=e.state===`addressed`;return t?n?`fixed`:`answered`:n?`changed`:e.unanswered?`no-answer`:`waiting`}function ys(e){for(let t of e.split(`
|
|
80
80
|
`)){let e=t.trim();if(e!==``)return e}return``}function bs(e){let t=e.anchor;return t.kind===`changeset`?{anchor:null,path:null}:t.kind===`file`?{anchor:t.path,path:t.path}:t.kind===`layer`?{anchor:`layer “${t.title}”`,path:null}:{anchor:`${t.path}:${mt(t)}`,path:t.path}}function xs(e,t){if(e.messages.some(e=>e.author===`reviewer`))return!0;if(!t)return!1;let n=RegExp(`@${t}(?![\\w-])`,`i`);return e.messages.some(e=>e.author===`github`&&(e.github?.user.login===t||n.test(e.text)))}function Ss(e){let t=e=>ps.indexOf(e.turn),n=e=>e.sort((e,n)=>t(e)-t(n)||n.updatedAt.localeCompare(e.updatedAt));return{github:n(e.filter(e=>at(e.thread))),agent:n(e.filter(e=>!at(e.thread)))}}function Cs(e,t=new Set,n=new Map){return e.map(e=>{let r=[...e.messages].reverse().find(t=>at(e)?t.author===`github`:t.author===`agent`),i=n.get(e.id),a=vs(e);return{thread:e,turn:ds(e),...a?{outcome:a}:{},...t.has(e.id)?{working:!0}:{},...i!==void 0&&!t.has(e.id)?{queued:i}:{},...e.github?.outdated===!0?{outdated:!0}:{},question:ys(e.messages[0]?.text??``),answer:r?ys(r.text):null,...bs(e),...r?.durationMs===void 0?{}:{durationMs:r.durationMs},updatedAt:e.updatedAt}})}function ws(e){return e===null?`the changeset`:e.slice(e.lastIndexOf(`/`)+1)}function Ts(e,t){let n=e.find(e=>e.working===!0);return n?`working on ${ws(n.anchor)}`:t===null?e.length>0?`picked up ${e.length} comment${e.length===1?``:`s`}`:null:`answered ${t}`}function Es(e){let t=new Map;for(let n of hs){let r=e.filter(e=>_s(e.turn)===n).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt));r.length>0&&t.set(n,r)}return t}function Ds(e){return e.filter(e=>e.turn===`yours`||e.turn===`unanswered`).length}function Os(e){return e.filter(e=>_s(e.turn)!==`settled`).length}function ks(e){let t=new Map;for(let n of e){if(n.path===null)continue;let e=t.get(n.path);e?e.push(n):t.set(n.path,[n])}return t}var As=`modulepreload`,js=function(e){return`/`+e},Ms={},X=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=js(t,n),t=s(t),t in Ms)return;Ms[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:As,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Ns=null,Ps=null,Fs=null,Is=0,Ls=pr(),Rs=/^(graph|flowchart|stateDiagram|sequenceDiagram|classDiagram|erDiagram|xychart)\b/;function zs(e){for(let t of e.split(`
|
|
81
|
-
`)){let e=t.trim();if(!(e===``||e.startsWith(`%%`)))return Rs.test(e)}return!1}var Bs={bg:`var(--fill)`,fg:`var(--ink)`,transparent:!0,font:`system-ui`};function Vs(e){return e.replace(/@import url\([^)]*\);?/g,``)}async function Hs(){return Ns||=X(()=>import(`./dist-
|
|
81
|
+
`)){let e=t.trim();if(!(e===``||e.startsWith(`%%`)))return Rs.test(e)}return!1}var Bs={bg:`var(--fill)`,fg:`var(--ink)`,transparent:!0,font:`system-ui`};function Vs(e){return e.replace(/@import url\([^)]*\);?/g,``)}async function Hs(){return Ns||=X(()=>import(`./dist-BNObUdRB.js`),[]),Ns}function Us(){let e=document.documentElement.getAttribute(`data-theme`);return e===`dark`?`dark`:e===`light`?`neutral`:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`neutral`}async function Ws(){Ps||=X(()=>import(`./mermaid.core-BZsTuSGk.js`).then(e=>e.default),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]));let e=await Ps,t=Us();return Fs!==t&&(Fs=t,e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:t,htmlLabels:!1,flowchart:{htmlLabels:!1,useMaxWidth:!1},sequence:{useMaxWidth:!1},state:{useMaxWidth:!1},er:{useMaxWidth:!1},class:{useMaxWidth:!1},pie:{useMaxWidth:!1}})),e}async function Gs(e){try{let t=await Ws();await t.parse(e);let{svg:n}=await t.render(`diffo-mermaid-${++Is}`,e);return n}catch{return null}}async function Ks(e){if(zs(e))try{return{svg:Vs((await Hs()).renderMermaidSVG(e,Bs)),live:!0}}catch{}let t=await Gs(e);return t===null?null:{svg:t,live:!1}}function qs(e){return Ls.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0}})}var Js=.6;function Ys(e){let t=e.querySelector(`svg`);if(!t)return;let n=Number.parseFloat(t.getAttribute(`width`)??``)||Number.parseFloat(t.getAttribute(`viewBox`)?.split(/\s+/)[2]??``);Number.isFinite(n)&&n>0&&(t.style.minWidth=`${Math.round(n*Js)}px`)}var Xs=[29,29,31],Zs=[245,245,247];function Qs(e){let t=e.trim().toLowerCase(),n=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.exec(t)?.[1];if(n){let[e,t,r,i]=(n.length<=4?Array.from(n,e=>e+e):n.match(/../g)).map(e=>Number.parseInt(e,16));return{rgb:[e,t,r],alpha:i===void 0?1:i/255}}let r=/^rgba?\(([^)]*)\)$/.exec(t)?.[1];if(r){let e=r.split(/[\s,/]+/).filter(Boolean);if(e.length<3)return null;let[t,n,i]=e.slice(0,3).map(Number),a=e[3]===void 0?1:Number.parseFloat(e[3])/(e[3].endsWith(`%`)?100:1);return[t,n,i,a].every(Number.isFinite)?{rgb:[t,n,i],alpha:a}:null}return null}function $s(e){let[t,n,r]=e.map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function ec(e){for(let t of Array.from(e.querySelectorAll(`g.node`))){let e=t.querySelectorAll(`text[fill="var(--_text)"]`),n=t.querySelector(`[fill]:not(text):not(tspan)`),r=n?.getAttribute(`fill`)??``;if(e.length===0||!n||r.startsWith(`var(`)||r===`none`)continue;let i=Qs(r)??Qs(getComputedStyle(n).fill);if(!i||i.alpha<.5)continue;let a=$s(i.rgb),o=(a+.05)/($s(Xs)+.05)>=($s(Zs)+.05)/(a+.05)?Xs:Zs;for(let t of Array.from(e))t.setAttribute(`fill`,`rgb(${o.join(` `)})`)}}var tc=!1;function nc(){if(tc)return;tc=!0;let e=()=>void rc();new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),window.matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,e)}async function rc(){if(Us()===Fs)return;let e=document.querySelectorAll(`.mermaid-figure[data-mermaid-source]`);for(let t of Array.from(e)){let e=await Gs(t.dataset.mermaidSource??``);e!==null&&t.isConnected&&(t.innerHTML=qs(e),Ys(t))}}function ic(e){return Array.from(e.querySelectorAll(`code.language-mermaid`)).map(e=>e.closest(`pre`)).filter(e=>e!==null&&!e.hasAttribute(`data-mermaid-done`))}async function ac(e){if(e&&ic(e).length!==0)for(let t of ic(e)){if(t.hasAttribute(`data-mermaid-done`))continue;t.setAttribute(`data-mermaid-done`,``);let e=t.textContent??``,n=await Ks(e);if(!t.isConnected)continue;if(n===null){let e=document.createElement(`div`);e.className=`mermaid-broken`,e.textContent=`diagram didn't parse, showing its source`,t.before(e);continue}let r=document.createElement(`div`);r.className=`mermaid-figure`,r.innerHTML=qs(n.svg),Ys(r),n.live||(r.dataset.mermaidSource=e,nc()),t.replaceWith(r),n.live&&ec(r)}}function oc(e){let t=Array.from(e.querySelectorAll(`tspan`));return t.length===0?e.textContent??``:t.map(e=>e.textContent??``).join(` `)}function sc(e){return e.split(/[\s·,;()[\]{}"'«»]+/).filter(Boolean)}function cc(e,t){for(let n of sc(e)){let e=No.exec(n);if(!e)continue;let r=Fo(e[1],t);if(r!==null)return{path:r,line:e[2]===void 0?null:Number.parseInt(e[2],10)}}return null}function lc(e,t){if(!e||t.length===0)return;let n=e.querySelectorAll(`.mermaid-figure text:not([data-diffo-jump]):not([data-diffo-plain])`);for(let e of Array.from(n)){let n=cc(oc(e),t);if(!n){e.setAttribute(`data-diffo-plain`,``);continue}e.setAttribute(`data-diffo-jump`,Ao(n.path,n.line)),e.setAttribute(`role`,`link`),e.setAttribute(`tabindex`,`0`),e.classList.add(`diffo-ref`)}}var uc=(0,x.memo)(function({text:e,className:t,docPath:n,paths:r}){let i=(0,x.useRef)(null),a=n===void 0?sa(e):_a(e,n);return(0,x.useEffect)(()=>{let e=i.current;if(!e)return;let t=async()=>{await ac(e),r&&lc(e,r)};t();let n=new MutationObserver(()=>{t()});return n.observe(e,{childList:!0,subtree:!0}),()=>n.disconnect()},[a,r]),(0,S.jsx)(`div`,{ref:i,className:t,dangerouslySetInnerHTML:{__html:a}})});function dc({who:e,user:t}){return e===`github`?t?.avatarUrl?(0,S.jsx)(`img`,{className:`avatar avatar-github`,src:t.avatarUrl,alt:``,"aria-hidden":`true`}):(0,S.jsx)(`span`,{className:`avatar avatar-github`,"aria-hidden":`true`,children:(t?.login??`?`).slice(0,1).toUpperCase()}):(0,S.jsx)(`span`,{className:`avatar avatar-${e}`,"aria-hidden":`true`,children:(0,S.jsx)(H,{name:e===`you`?`user`:`sparkle`,size:`sm`})})}function fc({value:e,onChange:t}){return(0,S.jsxs)(`div`,{className:`aud-tabs`,role:`radiogroup`,"aria-label":`Who this comment is for`,children:[(0,S.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":e===`pr`,className:`aud-tab aud-tab-pr${e===`pr`?` aud-tab-on`:``}`,title:`a review comment: drafted here, posted to GitHub when you submit (⌘. flips)`,onClick:()=>t(`pr`),children:[(0,S.jsx)(H,{name:`globe`,size:`sm`}),` Comment on PR`]}),(0,S.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":e===`agent`,className:`aud-tab aud-tab-agent${e===`agent`?` aud-tab-on`:``}`,title:`a private question for your agent: never leaves this machine (⌘. flips)`,onClick:()=>t(`agent`),children:[(0,S.jsx)(H,{name:`lock`,size:`sm`}),` Ask agent`]})]})}var pc=[{icon:`bold`,label:`Bold`,wrap:[`**`,`**`]},{icon:`italic`,label:`Italic`,wrap:[`_`,`_`]},{icon:`code`,label:`Code`,wrap:["`","`"]},`sep`,{icon:`link`,label:`Link`,wrap:[`[`,`](url)`]},{icon:`list`,label:`Bulleted list`,prefix:`- `},{icon:`quote`,label:`Quote`,prefix:`> `},`sep`,{icon:`at`,label:`Reference a file`,wrap:["`","`"]}],mc=[{label:`Explain this`,text:`Explain what this does and why it’s needed.`,intent:`question`},{label:`Clean up the comments`,text:`Cut comments that narrate the code. Keep the ones that explain why.`,intent:`fix`},{label:`Simplify this`,text:`Simplify this. Same behavior, less code, no new abstractions.`,intent:`fix`}],hc=[{intent:`fix`,label:`Change`,title:`ask the agent to change the code`},{intent:`question`,label:`Question`,title:`ask for an answer; the agent won’t change code`},{intent:void 0,label:`Agent decides`,title:`no label — the agent reads what you want from your words`}];function gc(e,t,n){let{value:r,selectionStart:i,selectionEnd:a}=e,o=r.slice(i,a),s,c;if(t.prefix){let e=r.lastIndexOf(`
|
|
82
82
|
`,i-1)+1,n=r.indexOf(`
|
|
83
83
|
`,a),o=n===-1?r.length:n,l=r.slice(e,o).split(`
|
|
84
84
|
`).map(e=>`${t.prefix}${e}`).join(`
|
|
85
85
|
`);s=r.slice(0,e)+l+r.slice(o),c=[e,e+l.length]}else{let[e,n]=t.wrap;s=r.slice(0,i)+e+o+n+r.slice(a),c=o?[i+e.length,i+e.length+o.length]:[i+e.length,i+e.length]}n(s),requestAnimationFrame(()=>{e.focus(),e.setSelectionRange(c[0],c[1])})}function _c({title:e,placeholder:t,scope:n,onSubmit:r,onSend:i,onCancel:a,agentConnected:o=!1,autoFocus:s=!0,draft:c,onDraft:l,draftIntent:u,onDraftIntent:d,initialText:f,fixedAudience:p,citing:m}){let[h,g]=(0,x.useState)(f??``),[_,v]=(0,x.useState)(`write`),[y,b]=(0,x.useState)(!1),C=us(),[w,T]=(0,x.useState)(`pr`),E=C===null?void 0:p??w,D=E===`pr`,O=E!==void 0&&p===void 0,k=E===`agent`&&i!==void 0,[A,j]=(0,x.useState)(void 0),[M,ee]=(0,x.useState)(!1),N=l?c??``:h,P=l??g,F=d?u:A,te=d??j,ne=(0,x.useRef)(null),re=N.trim().length>0,I=e=>m?`> ${m.label}: ${m.text}\n\n${e}`:e,ie=()=>{re&&(E===void 0?r(I(N),y,F):k?i(I(N),y,void 0):r(I(N),y,void 0,E))},ae=()=>T(e=>e===`pr`?`agent`:`pr`),oe=()=>{ee(e=>!e),v(`write`)},se=(0,S.jsx)(S.Fragment,{children:n&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`span`,{className:`scope-chip`,children:[(0,S.jsx)(H,{name:y?`cmp`:`unified`,size:`sm`}),y?`the whole changeset`:n.label,!y&&n.adjust&&(0,S.jsxs)(`span`,{className:`scope-chip-steppers`,children:[(0,S.jsx)(`button`,{type:`button`,className:`scope-chip-step`,disabled:!n.adjust.up,"data-tip":`walk the range's edge one line up; the line you started on stays put`,"aria-label":`range edge one line up`,onClick:n.adjust.up,children:(0,S.jsx)(H,{name:`up`,size:`sm`})}),(0,S.jsx)(`button`,{type:`button`,className:`scope-chip-step`,disabled:!n.adjust.down,"data-tip":`walk the range's edge one line down; the line you started on stays put`,"aria-label":`range edge one line down`,onClick:n.adjust.down,children:(0,S.jsx)(H,{name:`down`,size:`sm`})})]}),y&&n.canWiden&&(0,S.jsx)(`button`,{type:`button`,className:`scope-chip-x`,"data-tip":`Narrow the scope back`,"aria-label":`Narrow the scope back`,onClick:()=>b(!1),children:(0,S.jsx)(H,{name:`x`,size:`sm`})})]}),!y&&n.canWiden&&(0,S.jsx)(`button`,{type:`button`,className:`cbox-widen`,onClick:()=>b(!0),children:`+ whole changeset`})]})}),ce=(0,S.jsx)(`button`,{type:`button`,className:`cbox-close`,"data-tip":`Close (Esc)`,"aria-label":`Close`,onClick:a,children:(0,S.jsx)(H,{name:`x`,size:`sm`})});return(0,S.jsxs)(`div`,{className:`cbox thread-composer${E?` cbox-${E}`:``}`,onClick:e=>e.stopPropagation(),children:[(0,S.jsx)(`div`,{className:`cbox-head${O?` cbox-head-aud`:``}`,children:O?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(fc,{value:E,onChange:T}),(0,S.jsxs)(`span`,{className:`cbox-head-right`,children:[se,ce]})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`cbox-title`,children:p===`agent`?`Ask your agent`:n?`Comment on`:e}),se,ce]})}),m&&(0,S.jsxs)(`div`,{className:`cbox-cite`,children:[(0,S.jsx)(`span`,{className:`cbox-cite-label`,children:m.label}),(0,S.jsx)(`span`,{className:`cbox-cite-text`,children:m.text})]}),M&&(0,S.jsx)(`div`,{className:`cbox-tabs`,role:`tablist`,children:[`write`,`preview`].map(e=>(0,S.jsx)(`button`,{type:`button`,role:`tab`,className:`cbox-tab`,"aria-selected":_===e,onClick:()=>v(e),children:e===`write`?`Write`:`Preview`},e))}),M&&_===`write`&&(0,S.jsx)(`div`,{className:`cbox-mdbar`,children:pc.map((e,t)=>e===`sep`?(0,S.jsx)(`span`,{className:`cbox-mdsep`},t):(0,S.jsx)(`button`,{type:`button`,className:`cbox-mdb`,"data-tip":e.label,"aria-label":e.label,onClick:()=>ne.current&&gc(ne.current,e,P),children:(0,S.jsx)(H,{name:e.icon,size:`sm`})},t))}),(0,S.jsx)(`div`,{className:`cbox-body`,children:_===`write`?(0,S.jsx)(`textarea`,{ref:ne,autoFocus:s,className:`thread-input cbox-input`,placeholder:t,value:N,onChange:e=>P(e.target.value),onKeyDown:e=>{e.key===`Escape`?a():(e.metaKey||e.ctrlKey)&&e.key===`Enter`?(e.preventDefault(),ie()):(e.metaKey||e.ctrlKey)&&e.key===`.`&&O&&(e.preventDefault(),ae())}}):re?(0,S.jsx)(uc,{className:`cbox-preview markdown`,text:N}):(0,S.jsx)(`div`,{className:`cbox-preview cbox-preview-empty`,children:`Nothing to preview yet.`})}),!re&&!D&&(0,S.jsx)(`div`,{className:`cbox-openers`,children:mc.map(e=>(0,S.jsx)(`button`,{type:`button`,className:`cbox-opener`,title:e.text,onClick:()=>{P(e.text),te(e.intent),v(`write`),ne.current?.focus()},children:e.label},e.label))}),(0,S.jsxs)(`div`,{className:`cbox-foot`,children:[(0,S.jsx)(`button`,{type:`button`,className:`cbox-rich`,"aria-pressed":M,"data-tip":`Formatting and preview`,"aria-label":`Formatting and preview`,onClick:oe,children:`Aa`}),E===`pr`&&(0,S.jsx)(`span`,{className:`cbox-hint`,children:`Posts to GitHub when you submit the review`}),E===`agent`&&(0,S.jsx)(`span`,{className:`cbox-hint`,children:`Private, stays on this machine`}),E===void 0&&(0,S.jsx)(`span`,{className:`cbox-intent`,role:`radiogroup`,"aria-label":`What this comment wants`,children:hc.map(({intent:e,label:t,title:n})=>(0,S.jsx)(`button`,{type:`button`,role:`radio`,className:`cbox-intent-chip`,"aria-checked":F===e,title:n,onClick:()=>te(e),children:t},t))}),M&&(0,S.jsxs)(`span`,{className:`cbox-attach`,children:[(0,S.jsx)(H,{name:`attach`,size:`sm`}),` Markdown supported`]}),(0,S.jsxs)(`span`,{className:`cbox-actions`,children:[(0,S.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-ghost`,onClick:a,children:`Close`}),i&&!D&&!k&&(0,S.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-outline`,disabled:!re,onClick:()=>re&&i(I(N),y,F),title:o?`add the comment and send it to your agent`:`add the comment and copy its prompt for your agent`,children:[(0,S.jsx)(H,{name:`send`,size:`sm`}),` Send to agent`]}),(0,S.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,disabled:!re,onClick:ie,title:D?`add this to your review; it posts to GitHub when you submit`:k?o?`send this to your agent; it never leaves this machine`:`add this and copy its prompt for your agent`:`leave this comment on the review`,children:[k&&(0,S.jsx)(H,{name:`send`,size:`sm`}),D?`Add to review`:k?`Send to agent`:`Add comment`,(0,S.jsx)(`span`,{className:`btn-kbd`,children:`⌘↵`})]})]})]})]})}var vc={fix:`Change`,question:`Question`},yc={open:`Draft`,sent:`Sent`,addressed:`Answered`,resolved:`Resolved`},bc={open:`mute`,sent:`mute`,addressed:`ok`,resolved:`mute`};function xc(e){let t=Math.max(0,e)/1e3;if(t<60)return`${t.toFixed(1)}s`;let n=Math.round(t);return`${Math.floor(n/60)}m ${String(n%60).padStart(2,`0`)}s`}function Sc(e){return e<=1?`next in line`:`#${e} in line`}function Cc({working:e,place:t,unanswered:n,followUp:r,since:i}){let a=n?`no answer, the agent moved on`:e?`with the agent${i?` · ${va(i)}`:``}`:r?`follow-up on the way${i?` · ${va(i)}`:``}`:`queued, ${Sc(t??1)}`;return(0,S.jsxs)(`div`,{className:`cmt thread-message thread-message-agent thread-message-pending${n?` thread-message-unanswered`:``}`,children:[(0,S.jsxs)(`div`,{className:`cmt-head`,children:[(0,S.jsx)(dc,{who:`agent`}),(0,S.jsx)(`span`,{className:`cmt-who cmt-who-agent`,children:`Agent`}),(0,S.jsx)(`span`,{className:`cmt-when`,children:a})]}),(0,S.jsx)(`div`,{className:`cmt-body pending-reply`,role:`status`,"aria-label":a,children:n?(0,S.jsx)(`span`,{className:`pending-none`,children:`Send it again, or resolve it if you've let it go.`}):(0,S.jsxs)(`span`,{className:`pending-dots`,children:[(0,S.jsx)(`i`,{}),(0,S.jsx)(`i`,{}),(0,S.jsx)(`i`,{})]})})]})}function wc({code:e}){let[t,n]=(0,x.useState)(!1),r=e.split(`
|
|
86
86
|
`);return(0,S.jsxs)(`div`,{className:`thread-context-wrap`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`thread-context-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,S.jsx)(`span`,{className:`chevron${t?``:` chevron-shut`}`,children:(0,S.jsx)(H,{name:`chev`,size:`sm`})}),`the commented change`,(0,S.jsxs)(`span`,{className:`thread-context-n`,children:[r.length,` `,r.length===1?`line`:`lines`]})]}),t&&(0,S.jsx)(`pre`,{className:`thread-context`,children:r.map((e,t)=>(0,S.jsx)(`span`,{className:`ctx-line${e.startsWith(`+`)?` ctx-add`:e.startsWith(`-`)?` ctx-del`:``}`,children:e===``?`
|
|
87
|
-
`:e},`${t}-${e}`))})]})}function Tc(e,t){return e===`reviewer`||t===0?`commented`:`replied`}var Ec={APPROVED:`approved`,CHANGES_REQUESTED:`requested changes`,COMMENTED:`reviewed`,DISMISSED:`dismissed`};function Dc(e){let t=[...e.messages].reverse().find(e=>e.author===`agent`);if(t){let e=/```suggestion\n[\s\S]*?```/.exec(t.text);return e?e[0]:t.text}return[...e.messages].reverse().find(e=>e.author===`reviewer`)?.text??``}function Oc(e,t){(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),t())}function kc({text:e,links:t}){return t?(0,S.jsx)(`div`,{onClick:e=>{let n=Po(e.target);n&&(e.preventDefault(),t.onJump(n.path,n.line))},children:(0,S.jsx)(uc,{className:`cmt-body markdown`,text:J(e,t.paths),paths:t.paths})}):(0,S.jsx)(uc,{className:`cmt-body markdown`,text:e})}function Ac({message:e,live:t,editing:n,agentConnected:r,onEdit:i,onCancelEdit:a,onAdd:o,onDismiss:s,onRestore:c}){let l=e.prComment,u=l.outcome,[d,f]=(0,x.useState)(!1);if(u||!t){let e=u?u.kind:`superseded`,t=u?u.kind===`added`?u.edited?`added to your review, edited`:`added to your review`:`dismissed`:`superseded by the reply below`;return(0,S.jsxs)(`div`,{className:`psc psc-done psc-${e}`,"data-testid":`pr-suggestion-receipt`,children:[(0,S.jsxs)(`div`,{className:`psc-done-line`,children:[(0,S.jsx)(`button`,{type:`button`,className:`thread-shut chevron${d?``:` chevron-shut`}`,"aria-expanded":d,"aria-label":d?`hide the suggested comment`:`show the suggested comment`,"data-tip":d?`hide the suggested comment`:`show the suggested comment`,onClick:()=>f(!d),children:(0,S.jsx)(H,{name:`chev`,size:`sm`})}),(0,S.jsx)(H,{name:`globe`,size:`sm`}),(0,S.jsxs)(`span`,{className:`psc-done-text`,children:[`Suggested PR comment `,(0,S.jsxs)(`span`,{className:`psc-done-status`,children:[`· `,t]})]}),e===`dismissed`&&c&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,title:`bring the suggestion back, with its buttons`,onClick:c,children:`Undo`})]}),d&&(0,S.jsx)(uc,{className:`psc-body markdown`,text:l.text})]})}return n?(0,S.jsx)(`div`,{className:`psc psc-editing`,children:(0,S.jsx)(_c,{title:`Suggested PR comment`,placeholder:`The review comment as GitHub will show it…`,fixedAudience:`pr`,initialText:l.text,agentConnected:r,onSubmit:e=>void o(e),onCancel:a})}):(0,S.jsxs)(`div`,{className:`psc`,"data-testid":`pr-suggestion`,children:[(0,S.jsxs)(`div`,{className:`psc-head`,children:[(0,S.jsx)(H,{name:`globe`,size:`sm`}),(0,S.jsx)(`span`,{children:`Suggested PR comment`}),(0,S.jsx)(`span`,{className:`psc-head-note`,children:`for the author, in your words`})]}),(0,S.jsx)(uc,{className:`psc-body markdown`,text:l.text}),(0,S.jsxs)(`div`,{className:`psc-foot`,children:[(0,S.jsx)(`span`,{className:`psc-hint`,children:`Draft · posts when you submit the review`}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm psc-add`,title:`a draft PR comment on these lines, in your review; it posts when you submit`,onClick:()=>void o(l.text),children:`Add as PR comment draft`}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-sm`,title:`rewrite it before it joins the review`,onClick:i,children:`Edit`}),s&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-icon btn-sm`,"aria-label":`dismiss this suggested comment`,title:`pass on it; the thread stays open`,onClick:s,children:(0,S.jsx)(H,{name:`x`,size:`sm`})})]})]})}function jc({thread:e,actions:t,showContext:n=!1,agentConnected:r=!1,working:i=!1,queuePosition:a,gone:o=!1,links:s,asides:c}){let l=us(),u=at(e),d=e.github,f=u&&e.state===`open`&&d===void 0,p=d!==void 0&&e.id.startsWith(`gh:`),[m,h]=(0,x.useState)(null),[g,_]=(0,x.useState)(!1),[v,y]=(0,x.useState)(``),[b,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(null),[E,D]=(0,x.useState)(!1),[O,k]=(0,x.useState)(!1),[A,j]=(0,x.useState)(!1),[M,ee]=(0,x.useState)(!1),[N,P]=(0,x.useState)(null),[F,te]=(0,x.useState)(null),ne=(0,x.useRef)(null),re=(0,x.useRef)(null),I=(0,x.useRef)(void 0);(0,x.useEffect)(()=>()=>clearTimeout(I.current),[]);let ie=(n=!0)=>{v.trim()&&(D(!1),t.reply(e.id,v,n).then(()=>y(``)).catch(()=>D(!0)))},ae=N?e.messages.findIndex(e=>e.id===N.id):-1,oe=ae===-1?0:e.messages.length-1-ae,se=ae!==-1&<(e,ae),ce=se&&r&&(e.state===`sent`||e.state===`addressed`),le=n=>t.edit!==void 0&&n.author===`reviewer`&&e.state!==`resolved`&&n.github===void 0,ue=e=>{te(null),P({id:e.id,draft:e.text})},de=()=>{P(null),te(null)},fe=(n=!0)=>{if(!N||ae===-1)return;let r=N.draft.trim();if(r){if(r===e.messages[ae].text.trim())return de();te(null),t.edit(e.id,N.id,r,n).then(de).catch(e=>te(e instanceof Error&&e.message?e.message:`couldn't reach the diffo server — your text is still here; try again`))}},L=()=>(D(!1),T(null),t.send(e.id).then(({delivered:e,copied:t,prompt:n})=>{if(!e){if(!t){T(n??null);return}C(!0),clearTimeout(I.current),I.current=setTimeout(()=>C(!1),2500)}}).catch(()=>D(!0))),R=it(e),z=(n,r)=>(D(!1),t.create(e.anchor,r,void 0,{audience:`pr`,origin:{threadId:e.id,messageId:n}}).then(()=>_(!1)).catch(()=>D(!0))),pe=n=>{t.dismissPrComment&&(D(!1),t.dismissPrComment(e.id,n).catch(()=>D(!0)))},me=n=>{t.restorePrComment&&(D(!1),t.restorePrComment(e.id,n).catch(()=>D(!0)))},he=e.messages[e.messages.length-1]?.author,ge=e.withheld===!0,_e=fs(e),ve=!u&&!ge&&he===`reviewer`&&(e.state===`sent`||e.state===`addressed`),ye=e.state===`sent`&&ve&&!r,be=u&&d?e.messages.filter(e=>e.author===`reviewer`&&e.github===void 0).length:0,xe=ut(e)&&e.state===`open`,Se=!u&&r&&(e.state===`sent`||e.state===`addressed`||xe),Ce=O||v.trim()!==``,we=e.state!==`resolved`&&Ce,Te=e.state!==`resolved`&&!Ce,Ee=e.messages[e.messages.length-1],De=e.state!==`resolved`&&Ee?.author===`agent`?Ee.suggestedReply??null:null,Oe=De!==null&&v===``,B=()=>{De!==null&&(y(De),k(!0),requestAnimationFrame(()=>{let e=re.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))}))},ke=e=>Oe&&(e.key===`Tab`||e.key===`ArrowRight`)&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey,Ae=u?f?`Draft`:e.state===`resolved`?`Resolved`:`On GitHub`:xe?`From the agent`:ge?ms.note:e.state===`addressed`&&e.intent===`fix`?`Addressed`:yc[e.state],je=u?f?`attn`:e.state===`resolved`?`mute`:`pr`:xe||ge?`attn`:bc[e.state],Me=(0,S.jsxs)(S.Fragment,{children:[e.queued?.resolve&&(0,S.jsx)(`span`,{className:`thread-badge thread-badge-pr`,children:`resolves when you submit`}),e.queued?.unresolve&&(0,S.jsx)(`span`,{className:`thread-badge thread-badge-pr`,children:`reopens when you submit`})]}),Ne=(0,S.jsxs)(`span`,{className:`thread-marks`,children:[e.intent&&!ct(e)&&(0,S.jsx)(`span`,{className:`thread-badge thread-badge-kind thread-kind-${e.intent}`,children:vc[e.intent]}),e.closingNote&&(0,S.jsx)(`span`,{className:`thread-badge`,children:`closing note`}),R!==null&&(0,S.jsxs)(`span`,{className:`thread-badge thread-badge-pr`,title:`your agent drafted a review comment for the author; it is under its reply`,children:[(0,S.jsx)(H,{name:`globe`,size:`sm`}),` suggests a PR comment`]}),d?.reviewState&&(0,S.jsx)(`span`,{className:`thread-badge thread-badge-${d.reviewState.toLowerCase()}`,children:Ec[d.reviewState]}),d?.outdated&&(0,S.jsx)(`span`,{className:`thread-badge`,title:`the commented line is no longer in the diff`,children:`outdated`}),f&&(0,S.jsx)(`span`,{className:`thread-badge thread-badge-pr`,children:`posts when you submit`}),be>0&&(0,S.jsxs)(`span`,{className:`thread-badge thread-badge-pr`,children:[be===1?`reply posts`:`${be} replies post`,` when you submit`]}),Me,d?.url&&(0,S.jsxs)(`a`,{className:`thread-badge thread-badge-link`,href:d.url,target:`_blank`,rel:`noreferrer`,title:`open on GitHub`,children:[(0,S.jsx)(H,{name:`link`,size:`sm`}),` GitHub`]}),e.codeChanged&&(0,S.jsxs)(`span`,{className:`thread-badge`,children:[(0,S.jsx)(H,{name:`alert`,size:`sm`}),` code changed since this comment`]}),b&&(0,S.jsx)(`span`,{className:`thread-badge`,children:`prompt copied, paste it to your agent`}),!(xe&&ct(e))&&(0,S.jsx)(`span`,{className:`chip chip-${je}`,children:Ae})]}),Pe=e.awaitingFollowUp===!0,Fe=!u&&(i||a!==void 0||e.unanswered||Pe)?(0,S.jsx)(Cc,{working:i,place:a,followUp:Pe,unanswered:e.unanswered===!0&&a===void 0&&!i,since:e.updatedAt}):null,Ie=(i||Pe)&&e.deliveredThrough?Date.parse(e.deliveredThrough):null,Le=Ie===null?-1:e.messages.findIndex(e=>e.author===`reviewer`&&Date.parse(e.at)>Ie),Re=Le===-1?e.messages.length:Le,ze=oe>0?null:Fe,Be=e.state===`resolved`?(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>void t.reopen(e.id),children:`Reopen`}):f&&t.remove?(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,title:`drop this draft; nothing was posted`,onClick:()=>void t.remove(e.id),children:`Discard draft`}):(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,title:d?`resolve on GitHub when you submit; until then it is only marked here`:void 0,onClick:()=>void t.resolve(e.id),children:`Resolve`}),Ve=l&&!u&&R===null&&e.messages.length>0&&(0,S.jsxs)(`button`,{type:`button`,className:`btn btn-ghost btn-sm thread-promote`,title:`turn this into a review comment for GitHub; you edit it before it joins the review`,onClick:()=>h(Dc(e)),children:[(0,S.jsx)(H,{name:`globe`,size:`sm`}),` Post as PR comment`]}),He=m!==null&&(0,S.jsx)(`div`,{className:`thread-aside-compose`,children:(0,S.jsx)(_c,{title:`Comment on PR`,placeholder:`The review comment as GitHub will show it…`,fixedAudience:`pr`,initialText:m,agentConnected:r,onSubmit:n=>{t.create(e.anchor,n,void 0,{audience:`pr`}),h(null)},onCancel:()=>h(null)})}),Ue=ye&&(0,S.jsxs)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:L,children:[(0,S.jsx)(H,{name:`copy`,size:`sm`}),` Copy prompt`]}),We=_e&&(0,S.jsxs)(`button`,{type:`button`,className:`btn btn-sm ${we&&v.trim()!==``?`btn-outline`:`btn-primary`}`,onClick:L,title:r?`send this thread to your agent`:`mark sent and copy the prompt`,children:[(0,S.jsx)(H,{name:`send`,size:`sm`}),` Send`]}),Ge=e.state===`resolved`&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,title:`reopen this thread`,onClick:()=>void t.reopen(e.id),children:`Reopen`}),Ke=t.remove&&!p&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-icon btn-sm btn-ghost-danger`,"aria-label":`delete this thread`,"data-tip":`delete this thread`,onClick:()=>void t.remove(e.id),children:(0,S.jsx)(H,{name:`trash`,size:`sm`})});if(e.state===`resolved`&&!A){let t=e.messages[0];return(0,S.jsxs)(`div`,{className:`thread thread-resolved thread-collapsed`,"data-thread-id":e.id,ref:ne,onClick:e=>e.stopPropagation(),children:[(0,S.jsxs)(`button`,{type:`button`,className:`thread-collapsed-summary`,onClick:()=>j(!0),title:`expand this resolved thread`,children:[(0,S.jsx)(`span`,{className:`chip chip-mute`,children:`Resolved`}),Me,(0,S.jsx)(`span`,{className:`thread-collapsed-text`,children:ys(t?.text??``)}),(0,S.jsx)(`span`,{className:`thread-collapsed-count`,children:e.messages.length>1?`${e.messages.length} messages`:``}),(0,S.jsx)(`span`,{className:`thread-collapsed-hint chevron chevron-shut`,children:(0,S.jsx)(H,{name:`chev`,size:`sm`})})]}),Ge,Ke]})}return(0,S.jsxs)(`div`,{className:`thread conv thread-${e.state}${u?` thread-public`:l?` thread-private`:``}${e.parentId?` thread-aside`:``}`,"data-thread-id":e.id,ref:ne,onClick:e=>e.stopPropagation(),children:[(0,S.jsxs)(`div`,{className:`thread-head`,children:[(0,S.jsx)(`button`,{type:`button`,className:`thread-shut chevron${M?` chevron-shut`:``}`,"aria-expanded":!M,"data-tip":M?`expand this thread`:`collapse this thread`,"aria-label":M?`expand this thread`:`collapse this thread`,onClick:()=>ee(!M),children:(0,S.jsx)(H,{name:`chev`,size:`sm`})}),l&&(0,S.jsxs)(`span`,{className:`thread-side thread-side-${u?`pr`:`agent`}`,title:u?`a review comment: on GitHub, or headed there when you submit`:`private: between you and your agent, never leaves this machine`,children:[(0,S.jsx)(H,{name:u?`globe`:`lock`,size:`sm`}),u?`PR comment`:`Private`]}),(0,S.jsx)(`span`,{className:`thread-where${o?` thread-where-gone`:``}`,title:o?d?.outdated?`outdated on GitHub: the line left the diff`:`this file is no longer in the changeset`:void 0,children:Mc(e,o)}),M&&e.messages.length>1&&(0,S.jsxs)(`span`,{className:`thread-where-n`,children:[e.messages.length,` messages`]}),Ne,M&&Ge]}),M?(0,S.jsx)(`button`,{type:`button`,className:`thread-shut-peek`,onClick:()=>ee(!1),children:ys(e.messages[0]?.text??``)}):(0,S.jsxs)(S.Fragment,{children:[n&&e.codeContext&&(0,S.jsx)(wc,{code:e.codeContext}),ye&&(0,S.jsx)(`div`,{className:`thread-hint`,children:`waiting on your agent: paste the copied prompt into it; replies land here live`}),ge&&(0,S.jsx)(`div`,{className:`thread-hint`,children:o?`your reply is held here: Send hands it over; Finish review will not, since this file has left the changeset`:`your reply is held here: Send hands it over now, or Finish review takes it with the batch`}),(0,S.jsxs)(`div`,{className:`thread-messages`,children:[e.messages.map((n,a)=>(0,S.jsxs)(x.Fragment,{children:[a===Re&&ze,(0,S.jsxs)(`div`,{className:`cmt thread-message thread-message-${n.author}${a===ae?` thread-message-editing`:``}${ae!==-1&&a>ae?` thread-message-cut`:``}`,children:[(0,S.jsxs)(`div`,{className:`cmt-head`,children:[(0,S.jsx)(dc,{who:n.author===`reviewer`?`you`:n.author===`agent`?`agent`:`github`,user:n.github?.user}),(0,S.jsx)(`span`,{className:`cmt-who cmt-who-${n.author}`,children:n.author===`reviewer`?`You`:n.author===`agent`?`Agent`:n.github?.user.login??`GitHub`}),(0,S.jsxs)(`span`,{className:`cmt-when`,children:[n.author===`agent`&&n.durationMs!==void 0?`answered in ${xc(n.durationMs)}`:`${Tc(n.author,a)} ${va(n.at)}`,n.editedAt&&` · edited`,n.author===`github`&&` · on GitHub`,n.author===`reviewer`&&u&&n.github&&` · on GitHub`,n.author===`reviewer`&&u&&!n.github&&(f?` · draft`:` · posts when you submit`),a===0&&u&&e.origin&&(0,S.jsx)(`span`,{className:`cmt-origin`,title:`your agent wrote the first version of this comment; it posts as yours`,children:e.origin.edited?` · from your agent, edited`:` · from your agent`})]}),le(n)&&N?.id!==n.id&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-icon btn-sm cmt-edit`,"aria-label":`edit this message`,"aria-disabled":i||void 0,"data-tip":i?`the agent is answering — edit after it replies`:`edit this message`,onClick:()=>{i||ue(n)},children:(0,S.jsx)(H,{name:`edit`,size:`sm`})})]}),N?.id===n.id?(0,S.jsxs)(`div`,{className:`cmt-edit-box`,children:[(0,S.jsx)(`textarea`,{autoFocus:!0,className:`cmt-edit-input`,"aria-label":`edit your message`,value:N.draft,onFocus:e=>e.currentTarget.setSelectionRange(e.currentTarget.value.length,e.currentTarget.value.length),onChange:e=>P({id:n.id,draft:e.target.value}),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),de()):Oc(e,()=>fe(!0))}}),F&&(0,S.jsx)(`div`,{className:`cmt-edit-error`,role:`alert`,children:F}),(0,S.jsxs)(`div`,{className:`cmt-edit-foot`,children:[(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:de,children:`Cancel`}),ce&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>fe(!1),title:o?`save it without handing it over — Send takes it; the finish batch will not`:`save it without handing it over — Send or Finish takes it`,children:`Save`}),(0,S.jsxs)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,onClick:()=>fe(!0),title:ce?`save the edit and hand the thread back to your agent — its withdrawn replies are named, and code it changed for them stays until it says otherwise`:se?`save the edit — the thread waits for the agent, which is told its earlier replies were withdrawn`:`save the edit`,children:[ce?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(H,{name:`send`,size:`sm`}),` Save & resend`]}):`Save`,(0,S.jsx)(`span`,{className:`btn-kbd`,children:`⌘↵`})]})]})]}):(0,S.jsx)(kc,{text:n.text,links:s}),n.author===`agent`&&n.prComment&&(0,S.jsx)(Ac,{message:n,live:R?.id===n.id,editing:g&&R?.id===n.id,agentConnected:r,onEdit:()=>_(!0),onCancelEdit:()=>_(!1),onAdd:e=>z(n.id,e),onDismiss:t.dismissPrComment?()=>pe(n.id):void 0,onRestore:t.restorePrComment?()=>me(n.id):void 0})]}),a===ae&&oe>0&&(0,S.jsx)(`div`,{className:`cmt-cut`,role:`note`,children:(0,S.jsxs)(`span`,{children:[`Saving removes the ${oe===1?`message`:`${oe} messages`} below`,se&&` · the agent answers again`]})})]},n.id)),Re>=e.messages.length&&ze]}),c&&(0,S.jsx)(`div`,{className:`thread-asides`,children:c}),He,E&&(0,S.jsx)(`div`,{className:`thread-hint thread-hint-error`,children:`couldn't reach the diffo server; your text is still here, try again`}),w&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`thread-hint thread-hint-error`,children:`couldn't reach the clipboard; this browser blocked it. The thread is marked sent; select the prompt below and copy it by hand.`}),(0,S.jsx)(`pre`,{className:`invite-prompt`,children:w})]})]}),!M&&ae===-1&&(0,S.jsxs)(`div`,{className:`thread-foot${Te||we?``:` thread-foot-bare`}`,children:[Te&&De!==null&&(0,S.jsxs)(`div`,{className:`thread-offer replybar`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`thread-reply-stub thread-reply-stub-offer`,onClick:()=>k(!0),title:`the agent suggests this reply — click to write your own, Tab in the box takes this one`,children:[(0,S.jsx)(H,{name:`sparkle`,size:`sm`,className:`thread-offer-icon`}),(0,S.jsx)(`span`,{className:`thread-offer-text`,children:De})]}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-outline btn-sm thread-offer-use`,onClick:B,title:`take the suggested reply into the box, ready to edit or send`,children:`Use`})]}),Te&&De===null&&(0,S.jsx)(`button`,{type:`button`,className:`thread-reply-stub replybar`,onClick:()=>k(!0),children:u?`Reply on GitHub…`:`Reply…`}),we&&(0,S.jsxs)(`div`,{className:`thread-input-wrap${Oe?` thread-input-wrap-ghost`:``}`,children:[Oe&&(0,S.jsx)(H,{name:`sparkle`,size:`sm`,className:`thread-offer-icon thread-ghost-icon`}),(0,S.jsx)(`textarea`,{autoFocus:!0,ref:re,rows:1,className:`thread-input${Oe?` thread-input-ghost`:``}`,placeholder:Oe?De:u?`reply on GitHub, posts when you submit…`:`reply…`,"aria-description":Oe?`the agent offered this reply; press Tab to take it`:void 0,value:v,onChange:e=>y(e.target.value),onBlur:()=>{v.trim()||k(!1)},onKeyDown:e=>{ke(e)?(e.preventDefault(),y(De)):e.key===`Escape`&&!v.trim()?k(!1):Oc(e,()=>ie(!0))}}),Oe&&(0,S.jsx)(`button`,{type:`button`,className:`thread-offer-kbd thread-ghost-hint`,onMouseDown:e=>e.preventDefault(),onClick:B,title:`take the suggested reply (Tab)`,children:`Tab`})]}),!Te&&!we&&(0,S.jsx)(`span`,{className:`thread-spacer`}),we&&v.trim()!==``&&(0,S.jsxs)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,onClick:()=>ie(!0),title:Se?`reply and hand it to your agent in one go`:u?`reply on GitHub; it posts when you submit the review`:`write it into the thread`,children:[Se?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(H,{name:`send`,size:`sm`}),` Reply & send`]}):`Reply`,(0,S.jsx)(`span`,{className:`btn-kbd`,children:`⌘↵`})]}),we&&v.trim()!==``&&Se&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>ie(!1),title:o?`write it into the thread without handing it over: Send takes it; the finish batch will not`:`write it into the thread without handing it over: Send or Finish takes it`,children:`Reply`}),We,Ue,Ve,Be,e.state===`resolved`&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>j(!1),children:`Collapse`}),Ke]})]})}function Mc(e,t=!1){let n=e.anchor,r=e.github;if(r?.kind===`description`)return`Pull request description`;if(r?.kind===`review`)return`Review on the pull request`;if(r?.kind===`comment`||at(e)&&n.kind===`changeset`)return`Comment on the pull request`;let i=ct(e)?`Agent comment`:e.messages[0]?.author===`github`?`${e.messages[0].github?.user.login??`GitHub`}'s comment`:at(e)?`Review comment`:`Comment`;return n.kind===`changeset`?ct(e)?`${i} on the changeset`:`Note on the changeset`:n.kind===`layer`?t?`Layer “${n.title}”`:`${i} on this layer`:t?n.kind===`hunk`?`${n.path}:${mt(n)}`:n.path:n.kind===`hunk`?`${i} on ${n.endLine===void 0?`line`:`lines`} ${mt(n)}`:`${i} on this file`}function Nc({threads:e,actions:t,showContext:n=!1,agentConnected:r=!1,workingOn:i,queuedOn:a,gone:o=!1,links:s}){if(e.length===0)return null;let c=new Set(e.map(e=>e.id)),l=new Map;for(let t of e)if(t.parentId&&c.has(t.parentId)){let e=l.get(t.parentId);e?e.push(t):l.set(t.parentId,[t])}let u=(e,c)=>(0,S.jsx)(jc,{thread:e,actions:t,showContext:n,agentConnected:r,working:i?.has(e.id)??!1,queuePosition:a?.get(e.id),gone:o,links:s,asides:c},e.id);return(0,S.jsx)(`div`,{className:`thread-list`,children:e.filter(e=>!(e.parentId&&c.has(e.parentId))).map(e=>{let t=l.get(e.id);return u(e,t?.map(e=>u(e)))})})}function Pc({stillTo:e,back:t,onOpen:n,onClose:r}){let i=e.filter(e=>e.working===!0).length,a=e.length-i,o=e.length===0&&t.length>0;(0,x.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.stopPropagation(),r())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[r]);let s=[t.length>0?`${t.length} answered`:null,i>0?`${i} in progress`:null,a>0?`${a} waiting`:null].filter(Boolean);return(0,S.jsx)(`div`,{className:`monitor`,role:`dialog`,"aria-label":`Comments with your agent`,children:(0,S.jsxs)(`div`,{className:`monitor-inner`,children:[(0,S.jsx)(Fc,{stillTo:e,back:t}),s.length>0&&(0,S.jsx)(`div`,{className:`monitor-counts${o?` monitor-counts-done`:``}`,children:o?`all ${t.length} answered`:s.join(` · `)}),e.length>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`monitor-group`,children:[`Still to answer · `,e.length]}),(0,S.jsx)(`ul`,{className:`monitor-rows`,children:e.map(e=>(0,S.jsx)(Lc,{item:e,onOpen:n},e.thread.id))})]}),t.length>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`monitor-group`,children:[`Answered · `,t.length]}),(0,S.jsx)(`ul`,{className:`monitor-rows monitor-rows-done`,children:t.map(e=>(0,S.jsx)(Lc,{item:e,onOpen:n},e.thread.id))})]})]})})}function Fc({stillTo:e,back:t}){return(0,S.jsxs)(`div`,{className:`monitor-qbar`,"aria-hidden":!0,children:[t.map(e=>(0,S.jsx)(`i`,{className:`q-done`},e.thread.id)),e.map(e=>(0,S.jsx)(`i`,{className:e.working?`q-now`:`q-wait`},e.thread.id))]})}function Ic(e){if(e.working)return{label:`working on it`,kind:`now`};if(e.queued!==void 0)return{label:Sc(e.queued),kind:`wait`};if(e.turn===`agent`)return{label:`sent`,kind:`wait`};if(e.turn===`resolved`)return{label:`settled`,kind:`done`};switch(e.outcome){case`fixed`:return{label:`fixed`,kind:`done`};case`answered`:return{label:`answered`,kind:`done`};case`changed`:return{label:`changed, no reply`,kind:`silent`};case`no-answer`:return{label:`no answer`,kind:`silent`};default:return{label:`back`,kind:`done`}}}function Lc({item:e,onOpen:t}){let[n,r]=(0,x.useState)(()=>Date.now());(0,x.useEffect)(()=>{if(e.working!==!0)return;let t=setInterval(()=>r(Date.now()),1e4);return()=>clearInterval(t)},[e.working]);let{label:i,kind:a}=Ic(e),o=e.working===!0?Math.max(0,n-Date.parse(e.updatedAt)):void 0;return(0,S.jsx)(`li`,{children:(0,S.jsxs)(`button`,{type:`button`,className:`monitor-row`,onClick:()=>t(e),children:[(0,S.jsxs)(`span`,{className:`monitor-row-top`,children:[(0,S.jsxs)(`span`,{className:`monitor-st monitor-st-${a}`,children:[e.working===!0&&(0,S.jsx)(`span`,{className:`monitor-pulse`}),i]}),o!==void 0&&(0,S.jsxs)(`span`,{className:`monitor-took`,children:[xc(o),`…`]}),e.durationMs!==void 0&&!e.working&&(0,S.jsx)(`span`,{className:`monitor-took`,children:xc(e.durationMs)})]}),(0,S.jsxs)(`span`,{className:`monitor-q`,children:[(0,S.jsx)(`span`,{className:`monitor-anchor`,children:e.anchor??`the whole changeset`}),e.question]}),e.answer!==null&&(0,S.jsxs)(`span`,{className:`monitor-a`,children:[`↳ `,e.answer]})]})})}function Rc({status:e,onSetEnabled:t,onClose:n}){let[r,i]=(0,x.useState)(!1),a=e.source===`env`;return(0,S.jsxs)(jt,{title:`Privacy`,onClose:n,footer:r?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{t(!1),i(!1)},children:`Turn off`}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:()=>i(!1),children:`Keep sharing`})]}):void 0,children:[(0,S.jsxs)(`div`,{className:`privacy-row`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`pane-sw${e.enabled?` pane-sw-on`:``}`,role:`switch`,"aria-checked":e.enabled,disabled:a,onClick:()=>e.enabled?i(!0):t(!0),children:[(0,S.jsx)(`span`,{className:`pane-track`,"aria-hidden":`true`,children:(0,S.jsx)(`i`,{})}),`Share anonymous usage data`]}),(0,S.jsx)(`span`,{className:`privacy-state`,children:a?`Off: ${e.variable} is set in your environment`:e.enabled?`On`:`Off`})]}),(0,S.jsxs)(`p`,{className:`cov-note`,children:[`Two small events per review, opened and finished: the version, your OS, the kind of review, which agent, and counts. Never code, paths, or comment text. One random id per machine tells returning machines from new ones; turning this off deletes it.`,` `,(0,S.jsx)(`a`,{href:e.docs,target:`_blank`,rel:`noreferrer`,children:`What is sent`})]}),r&&(0,S.jsxs)(`p`,{className:`cov-note privacy-confirm`,children:[(0,S.jsx)(`strong`,{children:`Stop sharing?`}),` Diffo will send nothing more from this machine and delete its random id. You can turn it back on here any time.`]})]})}var zc=[/(^|\/)pnpm-lock\.yaml$/,/(^|\/)package-lock\.json$/,/(^|\/)npm-shrinkwrap\.json$/,/(^|\/)yarn\.lock$/,/(^|\/)bun\.lockb?$/,/(^|\/)Cargo\.lock$/,/(^|\/)Gemfile\.lock$/,/(^|\/)composer\.lock$/,/(^|\/)go\.sum$/,/(^|\/)poetry\.lock$/,/(^|\/)uv\.lock$/,/\.min\.(js|css)$/,/\.(js|css)\.map$/,/\.snap$/];function Bc(e){let t=0;for(let n of e.hunks)for(let e of n.lines)e.kind!==`context`&&t++;return t}function Vc(e){return e.hunks.length===0?null:zc.some(t=>t.test(e.path))?`generated`:Bc(e)>400?`large`:null}var Hc={fromTop:0,fromBottom:0};function Uc(e){return e.lines.filter(e=>e.kind!==`del`).length}function Wc(e){return e.lines.filter(e=>e.kind!==`add`).length}function Gc(e){return Uc(e)===0?e.newStart+1:e.newStart}function Kc(e){return Wc(e)===0?e.oldStart+1:e.oldStart}function qc(e){return Gc(e)}function Jc(e){return Gc(e)+Uc(e)-1}function Yc(e){return Gc(e)-Kc(e)}function Xc(e){return Gc(e)+Uc(e)-(Kc(e)+Wc(e))}function Zc(e){let t=e.hunks;if(t.length===0)return[];let n=[],r=t[0];qc(r)>1&&n.push({key:`top:${r.id}`,above:null,below:0,startNewNo:1,endNewNo:qc(r)-1,offset:Yc(r)});for(let e=1;e<t.length;e++){let r=t[e-1],i=t[e],a=Jc(r)+1,o=qc(i)-1;o>=a&&n.push({key:`${r.id}:${i.id}`,above:e-1,below:e,startNewNo:a,endNewNo:o,offset:Yc(i)})}let i=t[t.length-1],a=e.newLineCount;return typeof a==`number`&&a>Jc(i)&&n.push({key:`${i.id}:tail`,above:t.length-1,below:null,startNewNo:Jc(i)+1,endNewNo:a,offset:Xc(i)}),n}function Qc(e){return e.endNewNo-e.startNewNo+1}function $c(e,t){return Math.max(0,Qc(e)-t.fromTop-t.fromBottom)}function el(e,t,n,r){let i=[],a=Math.max(t.startNewNo,n),o=Math.min(t.endNewNo,r,e.length);for(let n=a;n<=o;n++){let r=e[n-1];if(r===void 0)break;i.push({kind:`context`,oldNo:n-t.offset,newNo:n,text:r})}return i}function tl(e,t,n){if($c(t,n)===0){let n=el(e,t,t.startNewNo,t.endNewNo);return t.below===null?{top:n,bottom:[],merged:!0}:{top:[],bottom:n,merged:!0}}return{top:n.fromTop>0?el(e,t,t.startNewNo,t.startNewNo+n.fromTop-1):[],bottom:n.fromBottom>0?el(e,t,t.endNewNo-n.fromBottom+1,t.endNewNo):[],merged:!1}}var nl={freshHunkIds:new Set,changedViewedHunkIds:new Set};function rl(e,t,n){if(!e)return nl;let r=new Set,i=new Map;for(let t of e.files){let e=new Set;for(let n of t.hunks)e.add(n.id),r.add(n.id);i.set(t.path,e)}let a=new Set,o=new Set;for(let e of t.files){let t=new Set(e.hunks.map(e=>e.id)),s=[...i.get(e.path)??new Set].some(e=>n.has(e)&&!t.has(e));for(let t of e.hunks)r.has(t.id)||(a.add(t.id),s&&o.add(t.id))}return{freshHunkIds:a,changedViewedHunkIds:o}}function il({decisions:e,open:t,onOpen:n,onJump:r,onComment:i}){return e.length===0?null:(0,S.jsxs)(`section`,{className:`ch-dec`,"aria-label":`Decisions`,children:[(0,S.jsx)(`div`,{className:`ch-dec-h`,children:`Decisions`}),e.map((e,a)=>(0,S.jsx)(ol,{resolved:e,open:t===a,onToggle:()=>n(t===a?null:a),onJump:r,onComment:i?()=>i(a):void 0},a))]})}function al(e){return e.line===void 0?e.path:`${e.path}:${e.line}${e.endLine===void 0?``:`–${e.endLine}`}`}function ol({resolved:e,open:t,onToggle:n,onJump:r,onComment:i}){let{decision:a,places:o}=e,s=o.filter(e=>e.file);return(0,S.jsxs)(`div`,{className:`ch-dec-item${t?` ch-dec-item-open`:``}`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`ch-dec-main`,"aria-expanded":t,onClick:n,children:[(0,S.jsx)(`span`,{className:`chevron ch-dec-chev${t?``:` chevron-shut`}`,children:(0,S.jsx)(H,{name:`chev`,size:`sm`})}),(0,S.jsx)(`span`,{className:`ch-dec-text`,children:a.text})]}),t&&(0,S.jsxs)(`div`,{className:`ch-dec-card`,children:[a.detail&&(0,S.jsx)(uc,{text:a.detail,className:`ch-dec-detail markdown`}),(0,S.jsxs)(`div`,{className:`ch-dec-acts`,children:[s.map(e=>(0,S.jsxs)(`button`,{type:`button`,className:`ch-dec-place`,title:al(e.at),onClick:()=>r(e.at.path,e.at.line??null),children:[(0,S.jsx)(`span`,{className:`ch-dec-place-path`,children:e.at.path}),e.at.line!==void 0&&(0,S.jsxs)(`span`,{className:`ch-dec-place-lines`,children:[e.at.line,e.at.endLine!==void 0&&`–${e.at.endLine}`]})]},al(e.at))),s.length===0&&o.length>0&&(0,S.jsxs)(`span`,{className:`ch-dec-gone`,children:[o.length===1?`its file is`:`its files are`,` not in the changeset now`]}),i&&(0,S.jsx)(`button`,{type:`button`,className:`ch-dec-comment`,onClick:i,children:`Comment`})]})]})]})}var sl={ts:`typescript`,tsx:`tsx`,js:`javascript`,jsx:`jsx`,mjs:`javascript`,cjs:`javascript`,json:`json`,css:`css`,scss:`scss`,html:`html`,md:`markdown`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,h:`c`,cpp:`cpp`,hpp:`cpp`,cs:`csharp`,sh:`shellscript`,bash:`shellscript`,zsh:`shellscript`,yml:`yaml`,yaml:`yaml`,toml:`toml`,sql:`sql`,vue:`vue`,svelte:`svelte`,php:`php`,xml:`xml`,dockerfile:`docker`},cl={c:()=>X(()=>import(`./c-DWGmR78Y.js`),__vite__mapDeps([19,20])),cpp:()=>X(()=>import(`./cpp-CJIxL8VH.js`),__vite__mapDeps([21,22,20])),csharp:()=>X(()=>import(`./csharp-oqKa8noW.js`),[]),css:()=>X(()=>import(`./css-CdtkT07m.js`),__vite__mapDeps([23,24])),docker:()=>X(()=>import(`./docker-IyjqRm3v.js`),[]),go:()=>X(()=>import(`./go-rLFTqkRN.js`),[]),html:()=>X(()=>import(`./html-DDNsd9lV.js`),__vite__mapDeps([25,26,24,27])),java:()=>X(()=>import(`./java-DxlWrXwe.js`),__vite__mapDeps([28,29])),javascript:()=>X(()=>import(`./javascript-Yelw-5ZN.js`),__vite__mapDeps([30,27])),json:()=>X(()=>import(`./json-CaljABEy.js`),__vite__mapDeps([31,32])),jsx:()=>X(()=>import(`./jsx-hEbJ82HF.js`),__vite__mapDeps([33,34])),kotlin:()=>X(()=>import(`./kotlin-DhhofPvG.js`),[]),markdown:()=>X(()=>import(`./markdown-BYOwaDjH.js`),[]),php:()=>X(()=>import(`./php-CQT4wx5i.js`),__vite__mapDeps([35,24,27,26,32,36,29,37])),python:()=>X(()=>import(`./python-gzcpVVnB.js`),[]),ruby:()=>X(()=>import(`./ruby-D_UtGFHI.js`),__vite__mapDeps([38,20,22,24,27,26,34,36,29,37,39,40,41,42])),rust:()=>X(()=>import(`./rust-Cfkwpbl8.js`),[]),scss:()=>X(()=>import(`./scss-DHtrkMkT.js`),__vite__mapDeps([43,24])),shellscript:()=>X(()=>import(`./shellscript-BiGZg9Om.js`),__vite__mapDeps([44,41])),sql:()=>X(()=>import(`./sql-0Qcw9ht3.js`),__vite__mapDeps([45,37])),svelte:()=>X(()=>import(`./svelte-BUVJxsYv.js`),__vite__mapDeps([46,24,27,39])),swift:()=>X(()=>import(`./swift-CyEgAFGc.js`),[]),toml:()=>X(()=>import(`./toml-CcmNWLt0.js`),[]),tsx:()=>X(()=>import(`./tsx-5f3ulCja.js`),__vite__mapDeps([47,40])),typescript:()=>X(()=>import(`./typescript-Utq2Cl8c.js`),__vite__mapDeps([48,39])),vue:()=>X(()=>import(`./vue-CSBlZ1UP.js`),__vite__mapDeps([49,24,27,26,32,39])),xml:()=>X(()=>import(`./xml-CoDIzWF0.js`),__vite__mapDeps([50,36,29])),yaml:()=>X(()=>import(`./yaml-CxbubiML.js`),__vite__mapDeps([51,42]))};function ll(e){let t=e.slice(e.lastIndexOf(`/`)+1).toLowerCase();return t===`dockerfile`?`docker`:sl[t.slice(t.lastIndexOf(`.`)+1)]??null}var ul=null;async function dl(){return ul||=(async()=>{let[{createHighlighterCore:e},{createOnigurumaEngine:t}]=await Promise.all([X(()=>import(`./core-Df-hGU6u.js`),[]),X(()=>import(`./engine-oniguruma-JCdnWHQL.js`),[])]);return e({themes:[X(()=>import(`./github-light-EUqPIrTm.js`),[]),X(()=>import(`./github-dark-C-LZuMrd.js`),[])],langs:[],engine:t(X(()=>import(`./wasm-BnjxR4X6.js`),[]))})})(),ul}var fl=new Map;function pl(e,t){if(e.getLoadedLanguages().includes(t))return null;let n=fl.get(t);if(n)return n;let r=cl[t];if(!r)return null;let i=r().then(t=>e.loadLanguage(t.default)).finally(()=>fl.delete(t));return fl.set(t,i),i}async function ml(e,t,n){let r=ll(t);if(!r||e.length===0)return null;try{let t=await dl();return await pl(t,r),t.getLoadedLanguages().includes(r)?t.codeToTokensBase(e.join(`
|
|
87
|
+
`:e},`${t}-${e}`))})]})}function Tc(e,t){return e===`reviewer`||t===0?`commented`:`replied`}var Ec={APPROVED:`approved`,CHANGES_REQUESTED:`requested changes`,COMMENTED:`reviewed`,DISMISSED:`dismissed`};function Dc(e){let t=[...e.messages].reverse().find(e=>e.author===`agent`);if(t){let e=/```suggestion\n[\s\S]*?```/.exec(t.text);return e?e[0]:t.text}return[...e.messages].reverse().find(e=>e.author===`reviewer`)?.text??``}function Oc(e,t){(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),t())}function kc({text:e,links:t}){return t?(0,S.jsx)(`div`,{onClick:e=>{let n=Po(e.target);n&&(e.preventDefault(),t.onJump(n.path,n.line))},children:(0,S.jsx)(uc,{className:`cmt-body markdown`,text:J(e,t.paths),paths:t.paths})}):(0,S.jsx)(uc,{className:`cmt-body markdown`,text:e})}function Ac({message:e,live:t,editing:n,agentConnected:r,onEdit:i,onCancelEdit:a,onAdd:o,onDismiss:s,onRestore:c}){let l=e.prComment,u=l.outcome,[d,f]=(0,x.useState)(!1);if(u||!t){let e=u?u.kind:`superseded`,t=u?u.kind===`added`?u.edited?`added to your review, edited`:`added to your review`:`dismissed`:`superseded by the reply below`;return(0,S.jsxs)(`div`,{className:`psc psc-done psc-${e}`,"data-testid":`pr-suggestion-receipt`,children:[(0,S.jsxs)(`div`,{className:`psc-done-line`,children:[(0,S.jsx)(`button`,{type:`button`,className:`thread-shut chevron${d?``:` chevron-shut`}`,"aria-expanded":d,"aria-label":d?`hide the suggested comment`:`show the suggested comment`,"data-tip":d?`hide the suggested comment`:`show the suggested comment`,onClick:()=>f(!d),children:(0,S.jsx)(H,{name:`chev`,size:`sm`})}),(0,S.jsx)(H,{name:`globe`,size:`sm`}),(0,S.jsxs)(`span`,{className:`psc-done-text`,children:[`Suggested PR comment `,(0,S.jsxs)(`span`,{className:`psc-done-status`,children:[`· `,t]})]}),e===`dismissed`&&c&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,title:`bring the suggestion back, with its buttons`,onClick:c,children:`Undo`})]}),d&&(0,S.jsx)(uc,{className:`psc-body markdown`,text:l.text})]})}return n?(0,S.jsx)(`div`,{className:`psc psc-editing`,children:(0,S.jsx)(_c,{title:`Suggested PR comment`,placeholder:`The review comment as GitHub will show it…`,fixedAudience:`pr`,initialText:l.text,agentConnected:r,onSubmit:e=>void o(e),onCancel:a})}):(0,S.jsxs)(`div`,{className:`psc`,"data-testid":`pr-suggestion`,children:[(0,S.jsxs)(`div`,{className:`psc-head`,children:[(0,S.jsx)(H,{name:`globe`,size:`sm`}),(0,S.jsx)(`span`,{children:`Suggested PR comment`}),(0,S.jsx)(`span`,{className:`psc-head-note`,children:`for the author, in your words`})]}),(0,S.jsx)(uc,{className:`psc-body markdown`,text:l.text}),(0,S.jsxs)(`div`,{className:`psc-foot`,children:[(0,S.jsx)(`span`,{className:`psc-hint`,children:`Draft · posts when you submit the review`}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm psc-add`,title:`a draft PR comment on these lines, in your review; it posts when you submit`,onClick:()=>void o(l.text),children:`Add as PR comment draft`}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-sm`,title:`rewrite it before it joins the review`,onClick:i,children:`Edit`}),s&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-icon btn-sm`,"aria-label":`dismiss this suggested comment`,title:`pass on it; the thread stays open`,onClick:s,children:(0,S.jsx)(H,{name:`x`,size:`sm`})})]})]})}function jc({thread:e,actions:t,showContext:n=!1,agentConnected:r=!1,working:i=!1,queuePosition:a,gone:o=!1,links:s,asides:c}){let l=us(),u=at(e),d=e.github,f=u&&e.state===`open`&&d===void 0,p=d!==void 0&&e.id.startsWith(`gh:`),[m,h]=(0,x.useState)(null),[g,_]=(0,x.useState)(!1),[v,y]=(0,x.useState)(``),[b,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(null),[E,D]=(0,x.useState)(!1),[O,k]=(0,x.useState)(!1),[A,j]=(0,x.useState)(!1),[M,ee]=(0,x.useState)(!1),[N,P]=(0,x.useState)(null),[F,te]=(0,x.useState)(null),ne=(0,x.useRef)(null),re=(0,x.useRef)(null),I=(0,x.useRef)(void 0);(0,x.useEffect)(()=>()=>clearTimeout(I.current),[]);let ie=(n=!0)=>{v.trim()&&(D(!1),t.reply(e.id,v,n).then(()=>y(``)).catch(()=>D(!0)))},ae=N?e.messages.findIndex(e=>e.id===N.id):-1,oe=ae===-1?0:e.messages.length-1-ae,se=ae!==-1&<(e,ae),ce=se&&r&&(e.state===`sent`||e.state===`addressed`),le=n=>t.edit!==void 0&&n.author===`reviewer`&&e.state!==`resolved`&&n.github===void 0,ue=e=>{te(null),P({id:e.id,draft:e.text})},de=()=>{P(null),te(null)},fe=(n=!0)=>{if(!N||ae===-1)return;let r=N.draft.trim();if(r){if(r===e.messages[ae].text.trim())return de();te(null),t.edit(e.id,N.id,r,n).then(de).catch(e=>te(e instanceof Error&&e.message?e.message:`couldn't reach the diffo server — your text is still here; try again`))}},L=()=>(D(!1),T(null),t.send(e.id).then(({delivered:e,copied:t,prompt:n})=>{if(!e){if(!t){T(n??null);return}C(!0),clearTimeout(I.current),I.current=setTimeout(()=>C(!1),2500)}}).catch(()=>D(!0))),R=it(e),z=(n,r)=>(D(!1),t.create(e.anchor,r,void 0,{audience:`pr`,origin:{threadId:e.id,messageId:n}}).then(()=>_(!1)).catch(()=>D(!0))),pe=n=>{t.dismissPrComment&&(D(!1),t.dismissPrComment(e.id,n).catch(()=>D(!0)))},me=n=>{t.restorePrComment&&(D(!1),t.restorePrComment(e.id,n).catch(()=>D(!0)))},he=e.messages[e.messages.length-1]?.author,ge=e.withheld===!0,_e=fs(e),ve=!u&&!ge&&he===`reviewer`&&(e.state===`sent`||e.state===`addressed`),ye=e.state===`sent`&&ve&&!r,be=u&&d?e.messages.filter(e=>e.author===`reviewer`&&e.github===void 0).length:0,xe=ut(e)&&e.state===`open`,Se=!u&&r&&(e.state===`sent`||e.state===`addressed`||xe),Ce=O||v.trim()!==``,we=e.state!==`resolved`&&Ce,Te=e.state!==`resolved`&&!Ce,Ee=e.messages[e.messages.length-1],De=e.state!==`resolved`&&Ee?.author===`agent`?Ee.suggestedReply??null:null,Oe=De!==null&&v===``,B=()=>{De!==null&&(y(De),k(!0),requestAnimationFrame(()=>{let e=re.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))}))},ke=e=>Oe&&(e.key===`Tab`||e.key===`ArrowRight`)&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey,Ae=u?f?`Draft`:e.state===`resolved`?`Resolved`:`On GitHub`:xe?`From the agent`:ge?ms.note:e.state===`addressed`&&e.intent===`fix`?`Addressed`:yc[e.state],je=u?f?`attn`:e.state===`resolved`?`mute`:`pr`:xe||ge?`attn`:bc[e.state],Me=(0,S.jsxs)(S.Fragment,{children:[e.queued?.resolve&&(0,S.jsx)(`span`,{className:`thread-badge thread-badge-pr`,children:`resolves when you submit`}),e.queued?.unresolve&&(0,S.jsx)(`span`,{className:`thread-badge thread-badge-pr`,children:`reopens when you submit`})]}),Ne=(0,S.jsxs)(`span`,{className:`thread-marks`,children:[e.intent&&!ct(e)&&(0,S.jsx)(`span`,{className:`thread-badge thread-badge-kind thread-kind-${e.intent}`,children:vc[e.intent]}),e.closingNote&&(0,S.jsx)(`span`,{className:`thread-badge`,children:`closing note`}),R!==null&&(0,S.jsxs)(`span`,{className:`thread-badge thread-badge-pr`,title:`your agent drafted a review comment for the author; it is under its reply`,children:[(0,S.jsx)(H,{name:`globe`,size:`sm`}),` suggests a PR comment`]}),d?.reviewState&&(0,S.jsx)(`span`,{className:`thread-badge thread-badge-${d.reviewState.toLowerCase()}`,children:Ec[d.reviewState]}),d?.outdated&&(0,S.jsx)(`span`,{className:`thread-badge`,title:`the commented line is no longer in the diff`,children:`outdated`}),f&&(0,S.jsx)(`span`,{className:`thread-badge thread-badge-pr`,children:`posts when you submit`}),be>0&&(0,S.jsxs)(`span`,{className:`thread-badge thread-badge-pr`,children:[be===1?`reply posts`:`${be} replies post`,` when you submit`]}),Me,d?.url&&(0,S.jsxs)(`a`,{className:`thread-badge thread-badge-link`,href:d.url,target:`_blank`,rel:`noreferrer`,title:`open on GitHub`,children:[(0,S.jsx)(H,{name:`link`,size:`sm`}),` GitHub`]}),e.codeChanged&&(0,S.jsxs)(`span`,{className:`thread-badge`,children:[(0,S.jsx)(H,{name:`alert`,size:`sm`}),` code changed since this comment`]}),b&&(0,S.jsx)(`span`,{className:`thread-badge`,children:`prompt copied, paste it to your agent`}),!(xe&&ct(e))&&(0,S.jsx)(`span`,{className:`chip chip-${je}`,children:Ae})]}),Pe=e.awaitingFollowUp===!0,Fe=!u&&(i||a!==void 0||e.unanswered||Pe)?(0,S.jsx)(Cc,{working:i,place:a,followUp:Pe,unanswered:e.unanswered===!0&&a===void 0&&!i,since:e.updatedAt}):null,Ie=(i||Pe)&&e.deliveredThrough?Date.parse(e.deliveredThrough):null,Le=Ie===null?-1:e.messages.findIndex(e=>e.author===`reviewer`&&Date.parse(e.at)>Ie),Re=Le===-1?e.messages.length:Le,ze=oe>0?null:Fe,Be=e.state===`resolved`?(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>void t.reopen(e.id),children:`Reopen`}):f&&t.remove?(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,title:`drop this draft; nothing was posted`,onClick:()=>void t.remove(e.id),children:`Discard draft`}):(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,title:d?`resolve on GitHub when you submit; until then it is only marked here`:void 0,onClick:()=>void t.resolve(e.id),children:`Resolve`}),Ve=l&&!u&&R===null&&e.messages.length>0&&(0,S.jsxs)(`button`,{type:`button`,className:`btn btn-ghost btn-sm thread-promote`,title:`turn this into a review comment for GitHub; you edit it before it joins the review`,onClick:()=>h(Dc(e)),children:[(0,S.jsx)(H,{name:`globe`,size:`sm`}),` Post as PR comment`]}),He=m!==null&&(0,S.jsx)(`div`,{className:`thread-aside-compose`,children:(0,S.jsx)(_c,{title:`Comment on PR`,placeholder:`The review comment as GitHub will show it…`,fixedAudience:`pr`,initialText:m,agentConnected:r,onSubmit:n=>{t.create(e.anchor,n,void 0,{audience:`pr`}),h(null)},onCancel:()=>h(null)})}),Ue=ye&&(0,S.jsxs)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:L,children:[(0,S.jsx)(H,{name:`copy`,size:`sm`}),` Copy prompt`]}),We=_e&&(0,S.jsxs)(`button`,{type:`button`,className:`btn btn-sm ${we&&v.trim()!==``?`btn-outline`:`btn-primary`}`,onClick:L,title:r?`send this thread to your agent`:`mark sent and copy the prompt`,children:[(0,S.jsx)(H,{name:`send`,size:`sm`}),` Send`]}),Ge=e.state===`resolved`&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,title:`reopen this thread`,onClick:()=>void t.reopen(e.id),children:`Reopen`}),Ke=t.remove&&!p&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-icon btn-sm btn-ghost-danger`,"aria-label":`delete this thread`,"data-tip":`delete this thread`,onClick:()=>void t.remove(e.id),children:(0,S.jsx)(H,{name:`trash`,size:`sm`})});if(e.state===`resolved`&&!A){let t=e.messages[0];return(0,S.jsxs)(`div`,{className:`thread thread-resolved thread-collapsed`,"data-thread-id":e.id,ref:ne,onClick:e=>e.stopPropagation(),children:[(0,S.jsxs)(`button`,{type:`button`,className:`thread-collapsed-summary`,onClick:()=>j(!0),title:`expand this resolved thread`,children:[(0,S.jsx)(`span`,{className:`chip chip-mute`,children:`Resolved`}),Me,(0,S.jsx)(`span`,{className:`thread-collapsed-text`,children:ys(t?.text??``)}),(0,S.jsx)(`span`,{className:`thread-collapsed-count`,children:e.messages.length>1?`${e.messages.length} messages`:``}),(0,S.jsx)(`span`,{className:`thread-collapsed-hint chevron chevron-shut`,children:(0,S.jsx)(H,{name:`chev`,size:`sm`})})]}),Ge,Ke]})}return(0,S.jsxs)(`div`,{className:`thread conv thread-${e.state}${u?` thread-public`:l?` thread-private`:``}${e.parentId?` thread-aside`:``}`,"data-thread-id":e.id,ref:ne,onClick:e=>e.stopPropagation(),children:[(0,S.jsxs)(`div`,{className:`thread-head`,children:[(0,S.jsx)(`button`,{type:`button`,className:`thread-shut chevron${M?` chevron-shut`:``}`,"aria-expanded":!M,"data-tip":M?`expand this thread`:`collapse this thread`,"aria-label":M?`expand this thread`:`collapse this thread`,onClick:()=>ee(!M),children:(0,S.jsx)(H,{name:`chev`,size:`sm`})}),l&&(0,S.jsxs)(`span`,{className:`thread-side thread-side-${u?`pr`:`agent`}`,title:u?`a review comment: on GitHub, or headed there when you submit`:`private: between you and your agent, never leaves this machine`,children:[(0,S.jsx)(H,{name:u?`globe`:`lock`,size:`sm`}),u?`PR comment`:`Private`]}),(0,S.jsx)(`span`,{className:`thread-where${o?` thread-where-gone`:``}`,title:o?d?.outdated?`outdated on GitHub: the line left the diff`:`this file is no longer in the changeset`:void 0,children:Mc(e,o)}),M&&e.messages.length>1&&(0,S.jsxs)(`span`,{className:`thread-where-n`,children:[e.messages.length,` messages`]}),Ne,M&&Ge]}),M?(0,S.jsx)(`button`,{type:`button`,className:`thread-shut-peek`,onClick:()=>ee(!1),children:ys(e.messages[0]?.text??``)}):(0,S.jsxs)(S.Fragment,{children:[n&&e.codeContext&&(0,S.jsx)(wc,{code:e.codeContext}),ye&&(0,S.jsx)(`div`,{className:`thread-hint`,children:`waiting on your agent: paste the copied prompt into it; replies land here live`}),ge&&(0,S.jsx)(`div`,{className:`thread-hint`,children:o?`your reply is held here: Send hands it over; Finish review will not, since this file has left the changeset`:`your reply is held here: Send hands it over now, or Finish review takes it with the batch`}),(0,S.jsxs)(`div`,{className:`thread-messages`,children:[e.messages.map((n,a)=>(0,S.jsxs)(x.Fragment,{children:[a===Re&&ze,(0,S.jsxs)(`div`,{className:`cmt thread-message thread-message-${n.author}${a===ae?` thread-message-editing`:``}${ae!==-1&&a>ae?` thread-message-cut`:``}`,children:[(0,S.jsxs)(`div`,{className:`cmt-head`,children:[(0,S.jsx)(dc,{who:n.author===`reviewer`?`you`:n.author===`agent`?`agent`:`github`,user:n.github?.user}),(0,S.jsx)(`span`,{className:`cmt-who cmt-who-${n.author}`,children:n.author===`reviewer`?`You`:n.author===`agent`?`Agent`:n.github?.user.login??`GitHub`}),(0,S.jsxs)(`span`,{className:`cmt-when`,children:[n.author===`agent`&&n.durationMs!==void 0?`answered in ${xc(n.durationMs)}`:`${Tc(n.author,a)} ${va(n.at)}`,n.editedAt&&` · edited`,n.author===`github`&&` · on GitHub`,n.author===`reviewer`&&u&&n.github&&` · on GitHub`,n.author===`reviewer`&&u&&!n.github&&(f?` · draft`:` · posts when you submit`),a===0&&u&&e.origin&&(0,S.jsx)(`span`,{className:`cmt-origin`,title:`your agent wrote the first version of this comment; it posts as yours`,children:e.origin.edited?` · from your agent, edited`:` · from your agent`})]}),le(n)&&N?.id!==n.id&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-icon btn-sm cmt-edit`,"aria-label":`edit this message`,"aria-disabled":i||void 0,"data-tip":i?`the agent is answering — edit after it replies`:`edit this message`,onClick:()=>{i||ue(n)},children:(0,S.jsx)(H,{name:`edit`,size:`sm`})})]}),N?.id===n.id?(0,S.jsxs)(`div`,{className:`cmt-edit-box`,children:[(0,S.jsx)(`textarea`,{autoFocus:!0,className:`cmt-edit-input`,"aria-label":`edit your message`,value:N.draft,onFocus:e=>e.currentTarget.setSelectionRange(e.currentTarget.value.length,e.currentTarget.value.length),onChange:e=>P({id:n.id,draft:e.target.value}),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),de()):Oc(e,()=>fe(!0))}}),F&&(0,S.jsx)(`div`,{className:`cmt-edit-error`,role:`alert`,children:F}),(0,S.jsxs)(`div`,{className:`cmt-edit-foot`,children:[(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:de,children:`Cancel`}),ce&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>fe(!1),title:o?`save it without handing it over — Send takes it; the finish batch will not`:`save it without handing it over — Send or Finish takes it`,children:`Save`}),(0,S.jsxs)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,onClick:()=>fe(!0),title:ce?`save the edit and hand the thread back to your agent — its withdrawn replies are named, and code it changed for them stays until it says otherwise`:se?`save the edit — the thread waits for the agent, which is told its earlier replies were withdrawn`:`save the edit`,children:[ce?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(H,{name:`send`,size:`sm`}),` Save & resend`]}):`Save`,(0,S.jsx)(`span`,{className:`btn-kbd`,children:`⌘↵`})]})]})]}):(0,S.jsx)(kc,{text:n.text,links:s}),n.author===`agent`&&n.prComment&&(0,S.jsx)(Ac,{message:n,live:R?.id===n.id,editing:g&&R?.id===n.id,agentConnected:r,onEdit:()=>_(!0),onCancelEdit:()=>_(!1),onAdd:e=>z(n.id,e),onDismiss:t.dismissPrComment?()=>pe(n.id):void 0,onRestore:t.restorePrComment?()=>me(n.id):void 0})]}),a===ae&&oe>0&&(0,S.jsx)(`div`,{className:`cmt-cut`,role:`note`,children:(0,S.jsxs)(`span`,{children:[`Saving removes the ${oe===1?`message`:`${oe} messages`} below`,se&&` · the agent answers again`]})})]},n.id)),Re>=e.messages.length&&ze]}),c&&(0,S.jsx)(`div`,{className:`thread-asides`,children:c}),He,E&&(0,S.jsx)(`div`,{className:`thread-hint thread-hint-error`,children:`couldn't reach the diffo server; your text is still here, try again`}),w&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`thread-hint thread-hint-error`,children:`couldn't reach the clipboard; this browser blocked it. The thread is marked sent; select the prompt below and copy it by hand.`}),(0,S.jsx)(`pre`,{className:`invite-prompt`,children:w})]})]}),!M&&ae===-1&&(0,S.jsxs)(`div`,{className:`thread-foot${Te||we?``:` thread-foot-bare`}`,children:[Te&&De!==null&&(0,S.jsxs)(`div`,{className:`thread-offer replybar`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`thread-reply-stub thread-reply-stub-offer`,onClick:()=>k(!0),title:`the agent suggests this reply — click to write your own, Tab in the box takes this one`,children:[(0,S.jsx)(H,{name:`sparkle`,size:`sm`,className:`thread-offer-icon`}),(0,S.jsx)(`span`,{className:`thread-offer-text`,children:De})]}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-outline btn-sm thread-offer-use`,onClick:B,title:`take the suggested reply into the box, ready to edit or send`,children:`Use`})]}),Te&&De===null&&(0,S.jsx)(`button`,{type:`button`,className:`thread-reply-stub replybar`,onClick:()=>k(!0),children:u?`Reply on GitHub…`:`Reply…`}),we&&(0,S.jsxs)(`div`,{className:`thread-input-wrap${Oe?` thread-input-wrap-ghost`:``}`,children:[Oe&&(0,S.jsx)(H,{name:`sparkle`,size:`sm`,className:`thread-offer-icon thread-ghost-icon`}),(0,S.jsx)(`textarea`,{autoFocus:!0,ref:re,rows:1,className:`thread-input${Oe?` thread-input-ghost`:``}`,placeholder:Oe?De:u?`reply on GitHub, posts when you submit…`:`reply…`,"aria-description":Oe?`the agent offered this reply; press Tab to take it`:void 0,value:v,onChange:e=>y(e.target.value),onBlur:()=>{v.trim()||k(!1)},onKeyDown:e=>{ke(e)?(e.preventDefault(),y(De)):e.key===`Escape`&&!v.trim()?k(!1):Oc(e,()=>ie(!0))}}),Oe&&(0,S.jsx)(`button`,{type:`button`,className:`thread-offer-kbd thread-ghost-hint`,onMouseDown:e=>e.preventDefault(),onClick:B,title:`take the suggested reply (Tab)`,children:`Tab`})]}),!Te&&!we&&(0,S.jsx)(`span`,{className:`thread-spacer`}),we&&v.trim()!==``&&(0,S.jsxs)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,onClick:()=>ie(!0),title:Se?`reply and hand it to your agent in one go`:u?`reply on GitHub; it posts when you submit the review`:`write it into the thread`,children:[Se?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(H,{name:`send`,size:`sm`}),` Reply & send`]}):`Reply`,(0,S.jsx)(`span`,{className:`btn-kbd`,children:`⌘↵`})]}),we&&v.trim()!==``&&Se&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>ie(!1),title:o?`write it into the thread without handing it over: Send takes it; the finish batch will not`:`write it into the thread without handing it over: Send or Finish takes it`,children:`Reply`}),We,Ue,Ve,Be,e.state===`resolved`&&(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>j(!1),children:`Collapse`}),Ke]})]})}function Mc(e,t=!1){let n=e.anchor,r=e.github;if(r?.kind===`description`)return`Pull request description`;if(r?.kind===`review`)return`Review on the pull request`;if(r?.kind===`comment`||at(e)&&n.kind===`changeset`)return`Comment on the pull request`;let i=ct(e)?`Agent comment`:e.messages[0]?.author===`github`?`${e.messages[0].github?.user.login??`GitHub`}'s comment`:at(e)?`Review comment`:`Comment`;return n.kind===`changeset`?ct(e)?`${i} on the changeset`:`Note on the changeset`:n.kind===`layer`?t?`Layer “${n.title}”`:`${i} on this layer`:t?n.kind===`hunk`?`${n.path}:${mt(n)}`:n.path:n.kind===`hunk`?`${i} on ${n.endLine===void 0?`line`:`lines`} ${mt(n)}`:`${i} on this file`}function Nc({threads:e,actions:t,showContext:n=!1,agentConnected:r=!1,workingOn:i,queuedOn:a,gone:o=!1,links:s}){if(e.length===0)return null;let c=new Set(e.map(e=>e.id)),l=new Map;for(let t of e)if(t.parentId&&c.has(t.parentId)){let e=l.get(t.parentId);e?e.push(t):l.set(t.parentId,[t])}let u=(e,c)=>(0,S.jsx)(jc,{thread:e,actions:t,showContext:n,agentConnected:r,working:i?.has(e.id)??!1,queuePosition:a?.get(e.id),gone:o,links:s,asides:c},e.id);return(0,S.jsx)(`div`,{className:`thread-list`,children:e.filter(e=>!(e.parentId&&c.has(e.parentId))).map(e=>{let t=l.get(e.id);return u(e,t?.map(e=>u(e)))})})}function Pc({stillTo:e,back:t,onOpen:n,onClose:r}){let i=e.filter(e=>e.working===!0).length,a=e.length-i,o=e.length===0&&t.length>0;(0,x.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.stopPropagation(),r())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[r]);let s=[t.length>0?`${t.length} answered`:null,i>0?`${i} in progress`:null,a>0?`${a} waiting`:null].filter(Boolean);return(0,S.jsx)(`div`,{className:`monitor`,role:`dialog`,"aria-label":`Comments with your agent`,children:(0,S.jsxs)(`div`,{className:`monitor-inner`,children:[(0,S.jsx)(Fc,{stillTo:e,back:t}),s.length>0&&(0,S.jsx)(`div`,{className:`monitor-counts${o?` monitor-counts-done`:``}`,children:o?`all ${t.length} answered`:s.join(` · `)}),e.length>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`monitor-group`,children:[`Still to answer · `,e.length]}),(0,S.jsx)(`ul`,{className:`monitor-rows`,children:e.map(e=>(0,S.jsx)(Lc,{item:e,onOpen:n},e.thread.id))})]}),t.length>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`monitor-group`,children:[`Answered · `,t.length]}),(0,S.jsx)(`ul`,{className:`monitor-rows monitor-rows-done`,children:t.map(e=>(0,S.jsx)(Lc,{item:e,onOpen:n},e.thread.id))})]})]})})}function Fc({stillTo:e,back:t}){return(0,S.jsxs)(`div`,{className:`monitor-qbar`,"aria-hidden":!0,children:[t.map(e=>(0,S.jsx)(`i`,{className:`q-done`},e.thread.id)),e.map(e=>(0,S.jsx)(`i`,{className:e.working?`q-now`:`q-wait`},e.thread.id))]})}function Ic(e){if(e.working)return{label:`working on it`,kind:`now`};if(e.queued!==void 0)return{label:Sc(e.queued),kind:`wait`};if(e.turn===`agent`)return{label:`sent`,kind:`wait`};if(e.turn===`resolved`)return{label:`settled`,kind:`done`};switch(e.outcome){case`fixed`:return{label:`fixed`,kind:`done`};case`answered`:return{label:`answered`,kind:`done`};case`changed`:return{label:`changed, no reply`,kind:`silent`};case`no-answer`:return{label:`no answer`,kind:`silent`};default:return{label:`back`,kind:`done`}}}function Lc({item:e,onOpen:t}){let[n,r]=(0,x.useState)(()=>Date.now());(0,x.useEffect)(()=>{if(e.working!==!0)return;let t=setInterval(()=>r(Date.now()),1e4);return()=>clearInterval(t)},[e.working]);let{label:i,kind:a}=Ic(e),o=e.working===!0?Math.max(0,n-Date.parse(e.updatedAt)):void 0;return(0,S.jsx)(`li`,{children:(0,S.jsxs)(`button`,{type:`button`,className:`monitor-row`,onClick:()=>t(e),children:[(0,S.jsxs)(`span`,{className:`monitor-row-top`,children:[(0,S.jsxs)(`span`,{className:`monitor-st monitor-st-${a}`,children:[e.working===!0&&(0,S.jsx)(`span`,{className:`monitor-pulse`}),i]}),o!==void 0&&(0,S.jsxs)(`span`,{className:`monitor-took`,children:[xc(o),`…`]}),e.durationMs!==void 0&&!e.working&&(0,S.jsx)(`span`,{className:`monitor-took`,children:xc(e.durationMs)})]}),(0,S.jsxs)(`span`,{className:`monitor-q`,children:[(0,S.jsx)(`span`,{className:`monitor-anchor`,children:e.anchor??`the whole changeset`}),e.question]}),e.answer!==null&&(0,S.jsxs)(`span`,{className:`monitor-a`,children:[`↳ `,e.answer]})]})})}function Rc({status:e,onSetEnabled:t,onClose:n}){let[r,i]=(0,x.useState)(!1),a=e.source===`env`;return(0,S.jsxs)(jt,{title:`Privacy`,onClose:n,footer:r?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{t(!1),i(!1)},children:`Turn off`}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:()=>i(!1),children:`Keep sharing`})]}):void 0,children:[(0,S.jsxs)(`div`,{className:`privacy-row`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`pane-sw${e.enabled?` pane-sw-on`:``}`,role:`switch`,"aria-checked":e.enabled,disabled:a,onClick:()=>e.enabled?i(!0):t(!0),children:[(0,S.jsx)(`span`,{className:`pane-track`,"aria-hidden":`true`,children:(0,S.jsx)(`i`,{})}),`Share anonymous usage data`]}),(0,S.jsx)(`span`,{className:`privacy-state`,children:a?`Off: ${e.variable} is set in your environment`:e.enabled?`On`:`Off`})]}),(0,S.jsxs)(`p`,{className:`cov-note`,children:[`Two small events per review, opened and finished: the version, your OS, the kind of review, which agent, and counts. Never code, paths, or comment text. One random id per machine tells returning machines from new ones; turning this off deletes it.`,` `,(0,S.jsx)(`a`,{href:e.docs,target:`_blank`,rel:`noreferrer`,children:`What is sent`})]}),r&&(0,S.jsxs)(`p`,{className:`cov-note privacy-confirm`,children:[(0,S.jsx)(`strong`,{children:`Stop sharing?`}),` Diffo will send nothing more from this machine and delete its random id. You can turn it back on here any time.`]})]})}var zc=[/(^|\/)pnpm-lock\.yaml$/,/(^|\/)package-lock\.json$/,/(^|\/)npm-shrinkwrap\.json$/,/(^|\/)yarn\.lock$/,/(^|\/)bun\.lockb?$/,/(^|\/)Cargo\.lock$/,/(^|\/)Gemfile\.lock$/,/(^|\/)composer\.lock$/,/(^|\/)go\.sum$/,/(^|\/)poetry\.lock$/,/(^|\/)uv\.lock$/,/\.min\.(js|css)$/,/\.(js|css)\.map$/,/\.snap$/];function Bc(e){let t=0;for(let n of e.hunks)for(let e of n.lines)e.kind!==`context`&&t++;return t}function Vc(e){return e.hunks.length===0?null:zc.some(t=>t.test(e.path))?`generated`:Bc(e)>400?`large`:null}var Hc={fromTop:0,fromBottom:0};function Uc(e){return e.lines.filter(e=>e.kind!==`del`).length}function Wc(e){return e.lines.filter(e=>e.kind!==`add`).length}function Gc(e){return Uc(e)===0?e.newStart+1:e.newStart}function Kc(e){return Wc(e)===0?e.oldStart+1:e.oldStart}function qc(e){return Gc(e)}function Jc(e){return Gc(e)+Uc(e)-1}function Yc(e){return Gc(e)-Kc(e)}function Xc(e){return Gc(e)+Uc(e)-(Kc(e)+Wc(e))}function Zc(e){let t=e.hunks;if(t.length===0)return[];let n=[],r=t[0];qc(r)>1&&n.push({key:`top:${r.id}`,above:null,below:0,startNewNo:1,endNewNo:qc(r)-1,offset:Yc(r)});for(let e=1;e<t.length;e++){let r=t[e-1],i=t[e],a=Jc(r)+1,o=qc(i)-1;o>=a&&n.push({key:`${r.id}:${i.id}`,above:e-1,below:e,startNewNo:a,endNewNo:o,offset:Yc(i)})}let i=t[t.length-1],a=e.newLineCount;return typeof a==`number`&&a>Jc(i)&&n.push({key:`${i.id}:tail`,above:t.length-1,below:null,startNewNo:Jc(i)+1,endNewNo:a,offset:Xc(i)}),n}function Qc(e){return e.endNewNo-e.startNewNo+1}function $c(e,t){return Math.max(0,Qc(e)-t.fromTop-t.fromBottom)}function el(e,t,n,r){let i=[],a=Math.max(t.startNewNo,n),o=Math.min(t.endNewNo,r,e.length);for(let n=a;n<=o;n++){let r=e[n-1];if(r===void 0)break;i.push({kind:`context`,oldNo:n-t.offset,newNo:n,text:r})}return i}function tl(e,t,n){if($c(t,n)===0){let n=el(e,t,t.startNewNo,t.endNewNo);return t.below===null?{top:n,bottom:[],merged:!0}:{top:[],bottom:n,merged:!0}}return{top:n.fromTop>0?el(e,t,t.startNewNo,t.startNewNo+n.fromTop-1):[],bottom:n.fromBottom>0?el(e,t,t.endNewNo-n.fromBottom+1,t.endNewNo):[],merged:!1}}var nl={freshHunkIds:new Set,changedViewedHunkIds:new Set};function rl(e,t,n){if(!e)return nl;let r=new Set,i=new Map;for(let t of e.files){let e=new Set;for(let n of t.hunks)e.add(n.id),r.add(n.id);i.set(t.path,e)}let a=new Set,o=new Set;for(let e of t.files){let t=new Set(e.hunks.map(e=>e.id)),s=[...i.get(e.path)??new Set].some(e=>n.has(e)&&!t.has(e));for(let t of e.hunks)r.has(t.id)||(a.add(t.id),s&&o.add(t.id))}return{freshHunkIds:a,changedViewedHunkIds:o}}function il({decisions:e,open:t,onOpen:n,onJump:r,onComment:i}){return e.length===0?null:(0,S.jsxs)(`section`,{className:`ch-dec`,"aria-label":`Decisions`,children:[(0,S.jsx)(`div`,{className:`ch-dec-h`,children:`Decisions`}),e.map((e,a)=>(0,S.jsx)(ol,{resolved:e,open:t===a,onToggle:()=>n(t===a?null:a),onJump:r,onComment:i?()=>i(a):void 0},a))]})}function al(e){return e.line===void 0?e.path:`${e.path}:${e.line}${e.endLine===void 0?``:`–${e.endLine}`}`}function ol({resolved:e,open:t,onToggle:n,onJump:r,onComment:i}){let{decision:a,places:o}=e,s=o.filter(e=>e.file);return(0,S.jsxs)(`div`,{className:`ch-dec-item${t?` ch-dec-item-open`:``}`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`ch-dec-main`,"aria-expanded":t,onClick:n,children:[(0,S.jsx)(`span`,{className:`chevron ch-dec-chev${t?``:` chevron-shut`}`,children:(0,S.jsx)(H,{name:`chev`,size:`sm`})}),(0,S.jsx)(`span`,{className:`ch-dec-text`,children:a.text})]}),t&&(0,S.jsxs)(`div`,{className:`ch-dec-card`,children:[a.detail&&(0,S.jsx)(uc,{text:a.detail,className:`ch-dec-detail markdown`}),(0,S.jsxs)(`div`,{className:`ch-dec-acts`,children:[s.map(e=>(0,S.jsxs)(`button`,{type:`button`,className:`ch-dec-place`,title:al(e.at),onClick:()=>r(e.at.path,e.at.line??null),children:[(0,S.jsx)(`span`,{className:`ch-dec-place-path`,children:e.at.path}),e.at.line!==void 0&&(0,S.jsxs)(`span`,{className:`ch-dec-place-lines`,children:[e.at.line,e.at.endLine!==void 0&&`–${e.at.endLine}`]})]},al(e.at))),s.length===0&&o.length>0&&(0,S.jsxs)(`span`,{className:`ch-dec-gone`,children:[o.length===1?`its file is`:`its files are`,` not in the changeset now`]}),i&&(0,S.jsx)(`button`,{type:`button`,className:`ch-dec-comment`,onClick:i,children:`Comment`})]})]})]})}var sl={ts:`typescript`,tsx:`tsx`,js:`javascript`,jsx:`jsx`,mjs:`javascript`,cjs:`javascript`,json:`json`,css:`css`,scss:`scss`,html:`html`,md:`markdown`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,h:`c`,cpp:`cpp`,hpp:`cpp`,cs:`csharp`,sh:`shellscript`,bash:`shellscript`,zsh:`shellscript`,yml:`yaml`,yaml:`yaml`,toml:`toml`,sql:`sql`,vue:`vue`,svelte:`svelte`,php:`php`,xml:`xml`,dockerfile:`docker`},cl={c:()=>X(()=>import(`./c-DWGmR78Y.js`),__vite__mapDeps([19,20])),cpp:()=>X(()=>import(`./cpp-CJIxL8VH.js`),__vite__mapDeps([21,22,20])),csharp:()=>X(()=>import(`./csharp-oqKa8noW.js`),[]),css:()=>X(()=>import(`./css-CdtkT07m.js`),__vite__mapDeps([23,24])),docker:()=>X(()=>import(`./docker-IyjqRm3v.js`),[]),go:()=>X(()=>import(`./go-rLFTqkRN.js`),[]),html:()=>X(()=>import(`./html-DDNsd9lV.js`),__vite__mapDeps([25,26,24,27])),java:()=>X(()=>import(`./java-DxlWrXwe.js`),__vite__mapDeps([28,29])),javascript:()=>X(()=>import(`./javascript-Yelw-5ZN.js`),__vite__mapDeps([30,27])),json:()=>X(()=>import(`./json-CaljABEy.js`),__vite__mapDeps([31,32])),jsx:()=>X(()=>import(`./jsx-hEbJ82HF.js`),__vite__mapDeps([33,34])),kotlin:()=>X(()=>import(`./kotlin-DhhofPvG.js`),[]),markdown:()=>X(()=>import(`./markdown-BYOwaDjH.js`),[]),php:()=>X(()=>import(`./php-CQT4wx5i.js`),__vite__mapDeps([35,24,27,26,32,36,29,37])),python:()=>X(()=>import(`./python-gzcpVVnB.js`),[]),ruby:()=>X(()=>import(`./ruby-D_UtGFHI.js`),__vite__mapDeps([38,20,22,24,27,26,34,36,29,37,39,40,41,42])),rust:()=>X(()=>import(`./rust-Cfkwpbl8.js`),[]),scss:()=>X(()=>import(`./scss-DHtrkMkT.js`),__vite__mapDeps([43,24])),shellscript:()=>X(()=>import(`./shellscript-BiGZg9Om.js`),__vite__mapDeps([44,41])),sql:()=>X(()=>import(`./sql-0Qcw9ht3.js`),__vite__mapDeps([45,37])),svelte:()=>X(()=>import(`./svelte-BUVJxsYv.js`),__vite__mapDeps([46,24,27,39])),swift:()=>X(()=>import(`./swift-CyEgAFGc.js`),[]),toml:()=>X(()=>import(`./toml-CcmNWLt0.js`),[]),tsx:()=>X(()=>import(`./tsx-5f3ulCja.js`),__vite__mapDeps([47,40])),typescript:()=>X(()=>import(`./typescript-Utq2Cl8c.js`),__vite__mapDeps([48,39])),vue:()=>X(()=>import(`./vue-CSBlZ1UP.js`),__vite__mapDeps([49,24,27,26,32,39])),xml:()=>X(()=>import(`./xml-CoDIzWF0.js`),__vite__mapDeps([50,36,29])),yaml:()=>X(()=>import(`./yaml-CxbubiML.js`),__vite__mapDeps([51,42]))};function ll(e){let t=e.slice(e.lastIndexOf(`/`)+1).toLowerCase();return t===`dockerfile`?`docker`:sl[t.slice(t.lastIndexOf(`.`)+1)]??null}var ul=null;async function dl(){return ul||=(async()=>{let[{createHighlighterCore:e},{createOnigurumaEngine:t}]=await Promise.all([X(()=>import(`./core-CmtFUBrQ.js`),[]),X(()=>import(`./engine-oniguruma-BjMH3wEI.js`),[])]);return e({themes:[X(()=>import(`./github-light-EUqPIrTm.js`),[]),X(()=>import(`./github-dark-C-LZuMrd.js`),[])],langs:[],engine:t(X(()=>import(`./wasm-BnjxR4X6.js`),[]))})})(),ul}var fl=new Map;function pl(e,t){if(e.getLoadedLanguages().includes(t))return null;let n=fl.get(t);if(n)return n;let r=cl[t];if(!r)return null;let i=r().then(t=>e.loadLanguage(t.default)).finally(()=>fl.delete(t));return fl.set(t,i),i}async function ml(e,t,n){let r=ll(t);if(!r||e.length===0)return null;try{let t=await dl();return await pl(t,r),t.getLoadedLanguages().includes(r)?t.codeToTokensBase(e.join(`
|
|
88
88
|
`),{lang:r,theme:n?`github-dark`:`github-light`,includeExplanation:`scopeName`}):null}catch{return null}}var hl=/^(text|comment|string|keyword|storage|punctuation|constant\.(numeric|language|character)|variable\.language|support\.type\.primitive)\b/;function gl(e){let t=e.explanation;if(!t||t.length===0)return[{content:e.content,sym:!0}];let n=[];for(let e of t){let t=!e.scopes.some(e=>hl.test(e.scopeName)),r=n[n.length-1];r&&r.sym===t?r.content+=e.content:n.push({content:e.content,sym:t})}return n}var _l=400,vl=.3,yl=400,bl=3,xl=.65;function Sl(e){return e.match(/[A-Za-z0-9_$]+|\s+|[^A-Za-z0-9_$\s]/g)??[]}function Cl(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>new Uint32Array(r+1));for(let a=n-1;a>=0;a--){let n=i[a],o=i[a+1];for(let i=r-1;i>=0;i--)n[i]=e[a]===t[i]?o[i+1]+1:Math.max(o[i],n[i+1])}let a=[],o=0,s=0;for(;o<n&&s<r;)e[o]===t[s]?(a.push([o,s]),o++,s++):i[o+1][s]>=i[o][s+1]?o++:s++;return a}function wl(e,t){let n=[],r=0;for(let i=0;i<e.length;i++){let a=e[i].length;if(!t[i]){let e=n[n.length-1];e&&e.end===r?e.end=r+a:n.push({start:r,end:r+a})}r+=a}return n.filter(t=>e.length>0&&t.end>t.start)}function Tl(e){let t=[];for(let n of e){let e=t[t.length-1];e&&n.start-e.end<=bl?e.end=n.end:t.push({...n})}return t}var El=(e,t)=>t===0?0:e.reduce((e,t)=>e+(t.end-t.start),0)/t;function Dl(e,t){if(e.length>_l||t.length>_l)return null;let n=Sl(e),r=Sl(t);if(n.length===0||r.length===0)return null;let i=Cl(n,r),a=Array(n.length).fill(!1),o=Array(r.length).fill(!1),s=0;for(let[e,t]of i)a[e]=!0,o[t]=!0,s+=n[e].length;let c=2*s/(e.length+t.length);if(c<vl)return null;let l=Tl(wl(n,a)),u=Tl(wl(r,o));return El(l,e.length)>xl||El(u,t.length)>xl?{similarity:c,del:[],add:[]}:{similarity:c,del:l,add:u}}function Ol(e,t,n){let r=[];if(t.length===n.length){for(let i=0;i<t.length;i++){let a=Dl(e[t[i]].text,e[n[i]].text);a&&r.push([t[i],n[i],a])}return r}if(t.length*n.length>yl)return r;let i=[];for(let r of t)for(let t of n){let n=Dl(e[r].text,e[t].text);n&&i.push({d:r,a:t,cmp:n})}i.sort((e,t)=>t.cmp.similarity-e.cmp.similarity);let a=new Set,o=new Set;for(let{d:e,a:t,cmp:n}of i)a.has(e)||o.has(t)||(a.add(e),o.add(t),r.push([e,t,n]));return r}function kl(e){let t=e.map(()=>null),n=0;for(;n<e.length;){if(e[n].kind!==`del`){n++;continue}let r=[];for(;n<e.length&&e[n].kind===`del`;)r.push(n++);let i=[];for(;n<e.length&&e[n].kind===`add`;)i.push(n++);if(i.length!==0)for(let[n,a,o]of Ol(e,r,i))o.del.length>0&&(t[n]=o.del),o.add.length>0&&(t[a]=o.add)}return t}function Al(e,t,n){if(!n||n.length===0)return[{text:e,changed:!1}];let r=[],i=0,a=(t,n,i)=>{if(n<=t)return;let a=e.slice(t,n),o=r[r.length-1];o&&o.changed===i?o.text+=a:r.push({text:a,changed:i})};for(let r of n){let n=Math.max(0,r.start-t),o=Math.min(e.length,r.end-t);o<=0||n>=e.length||o<=n||(a(i,n,!1),a(n,o,!0),i=Math.max(i,o))}return a(i,e.length,!1),r}function jl(e,t){let n=new Set(e.flatMap(e=>e.hunks.map(e=>e.id))),r=new Set(e.map(e=>e.path)),i=new Map,a=new Map,o=new Map,s=[],c=(e,t,n)=>{let r=e.get(t);r?r.push(n):e.set(t,[n])};for(let l of t){let t=l.anchor;if(t.kind===`changeset`)s.push(l);else if(t.kind===`layer`)c(o,t.layerId,l);else if(t.kind===`file`)r.has(t.path)?c(a,t.path,l):s.push(l);else if(n.has(t.hunkId))c(i,t.hunkId,l);else{let n=Ml(e,t);n===null?r.has(t.path)?c(a,t.path,l):s.push(l):c(i,n,l)}}return{byHunk:i,byFile:a,byLayer:o,changeset:s}}function Ml(e,t){let n=e.find(e=>e.path===t.path);return n?n.hunks.find(e=>Ll(e.lines,t)!==-1)?.id??null:null}function Nl(e,t){let n=new Map;for(let r of e){let e=[...t.byFile.get(r.path)??[]];for(let n of r.hunks)e.push(...t.byHunk.get(n.id)??[]);e.length>0&&n.set(r.path,e)}return n}function Pl(e,t,n){return n.kind===`del`?n.oldNo===null?null:{kind:`hunk`,hunkId:e,path:t,side:`old`,line:n.oldNo}:n.newNo===null?null:{kind:`hunk`,hunkId:e,path:t,side:`new`,line:n.newNo}}function Fl(e,t,n,r,i){let a=Math.max(0,Math.min(r,i)),o=Math.min(n.length-1,Math.max(r,i)),s=null;for(let r=a;r<=o&&!s;r++)s=Pl(e,t,n[r]);if(!s)return null;let c=e=>s.side===`old`?e.kind===`add`?null:e.oldNo:e.kind===`del`?null:e.newNo,l=s.line;for(let e=o;e>a;e--){let t=c(n[e]);if(t!==null){l=t;break}}return l>s.line?{...s,endLine:l}:s}function Il(e,t,n){return e.findIndex(e=>t===`old`?e.kind!==`add`&&e.oldNo===n:e.kind!==`del`&&e.newNo===n)}function Ll(e,t){return Il(e,t.side,t.line)}function Rl(e,t){if(t.endLine!==void 0){let n=Il(e,t.side,t.endLine);if(n!==-1)return n}return Ll(e,t)}function zl(e,t){let n=new Map;for(let r of t){if(r.anchor.kind!==`hunk`)continue;let t=Rl(e,r.anchor),i=n.get(t);i?i.push(r):n.set(t,[r])}return n}function Bl(e,t){let n=new Set;for(let r of t){let t=r.anchor;if(t.kind!==`hunk`||t.endLine===void 0)continue;let i=Ll(e,t),a=Rl(e,t);if(i!==-1&&a!==-1)for(let e=Math.min(i,a);e<=Math.max(i,a);e++)n.add(e)}return n}function Vl(e,t){let n=new Set;for(let r of t){let t=r.anchor;if(t.kind!==`hunk`||t.endLine===void 0)continue;let i=Ll(e,t),a=Rl(e,t);i!==-1&&a!==-1&&n.add(Math.min(i,a))}return n}function Hl(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r.kind===`context`){t.push({left:{line:r,idx:n},right:{line:r,idx:n}}),n++;continue}let i=[],a=[];for(;n<e.length&&e[n].kind===`del`;)i.push({line:e[n],idx:n}),n++;for(;n<e.length&&e[n].kind===`add`;)a.push({line:e[n],idx:n}),n++;let o=Math.max(i.length,a.length);for(let e=0;e<o;e++)t.push({left:i[e]??null,right:a[e]??null})}return t}function Ul({gap:e}){if(e.remaining<=0)return null;let t=(e,t)=>{e.stopPropagation(),t()};if(e.remaining<=20)return(0,S.jsx)(`span`,{className:`gap-x`,children:(0,S.jsx)(`button`,{type:`button`,className:`gap-btn`,"data-tip":`expand all (${e.remaining} hidden ${e.remaining===1?`line`:`lines`})`,"aria-label":`expand all ${e.remaining} hidden lines`,onClick:n=>t(n,e.onAll),children:(0,S.jsx)(H,{name:`unfold`,size:`sm`})})});let n=e.canUp&&e.canDown;return(0,S.jsxs)(`span`,{className:`gap-x${n?` gap-x-2`:``}`,children:[e.canDown&&(0,S.jsx)(`button`,{type:`button`,className:`gap-btn`,"data-tip":`expand down (20 lines)`,"aria-label":`expand down`,onClick:n=>t(n,e.onDown),children:(0,S.jsx)(H,{name:`down`,size:n?`xs`:`sm`})}),e.canUp&&(0,S.jsx)(`button`,{type:`button`,className:`gap-btn`,"data-tip":`expand up (20 lines)`,"aria-label":`expand up`,onClick:n=>t(n,e.onUp),children:(0,S.jsx)(H,{name:`up`,size:n?`xs`:`sm`})})]})}function Wl({onCollapse:e}){return(0,S.jsx)(`button`,{type:`button`,className:`gap-fold`,"data-tip":`hide expanded lines`,"aria-label":`hide expanded lines`,onClick:t=>{t.stopPropagation(),e()},children:(0,S.jsx)(H,{name:`fold`,size:`sm`})})}var Gl=`couldn't read more context; the file may have changed since`;function Kl({gap:e}){return(0,S.jsx)(`div`,{className:`gap-band`,children:(0,S.jsx)(`table`,{className:`hunk-lines`,children:(0,S.jsx)(`tbody`,{children:(0,S.jsx)(`tr`,{className:`hunk-boundary${e.merged?` hunk-boundary-merged`:``}`,children:(0,S.jsx)(`td`,{colSpan:4,children:(0,S.jsxs)(`span`,{className:`hunk-boundary-bar`,children:[!e.merged&&(0,S.jsx)(Ul,{gap:e}),(e.merged||e.expanded)&&(0,S.jsx)(Wl,{onCollapse:e.onCollapse}),e.failed&&(0,S.jsx)(`span`,{className:`hunk-expand-failed`,role:`status`,children:Gl})]})})})})})})}function ql(e,t){let n=Lo(),[r,i]=(0,x.useState)([]);return(0,x.useEffect)(()=>{let r=!1,a=e.filter(e=>e.kind!==`add`),o=e.filter(e=>e.kind!==`del`);return Promise.all([ml(a.map(e=>e.text),t,n),ml(o.map(e=>e.text),t,n)]).then(([t,n])=>{if(r)return;let a=0,o=0;i(e.map(e=>e.kind===`add`?n?.[o++]??null:(e.kind===`del`||o++,t?.[a++]??null)))}).catch(()=>{}),()=>{r=!0}},[e,t,n]),r}function Jl({line:e,tokens:t,ranges:n}){if(!t)return(0,S.jsx)(S.Fragment,{children:Al(e.text,0,n??null).map((e,t)=>e.changed?(0,S.jsx)(`span`,{className:`word-changed`,children:e.text},t):(0,S.jsx)(`span`,{children:e.text},t))});let r=0;return(0,S.jsx)(S.Fragment,{children:t.map((e,t)=>{let i=e.color?{color:e.color}:void 0;return gl(e).map((e,a)=>{let o=r;r+=e.content.length;let s=e.sym?void 0:`nosym`,c=Al(e.content,o,n??null);return c.length===1&&!c[0].changed?(0,S.jsx)(`span`,{style:i,className:s,children:e.content},`${t}:${a}`):(0,S.jsx)(`span`,{style:i,className:s,children:c.map((e,t)=>e.changed?(0,S.jsx)(`span`,{className:`word-changed`,children:e.text},t):(0,S.jsx)(`span`,{children:e.text},t))},`${t}:${a}`)})})})}var Yl={add:`+`,del:`−`,context:` `};function Xl(e,t){return{"data-side":t,"data-old":e.oldNo??void 0,"data-new":e.newNo??void 0}}function Zl(){return(0,S.jsx)(`span`,{className:`line-range-glyph`,"aria-hidden":`true`,children:(0,S.jsx)(H,{name:`chat`,size:`sm`})})}function Ql(e,t,n,...r){let i=e=>e!==void 0&&r.some(t=>t!==void 0&&e.has(t)),a=n!=null&&r.includes(n);return`${i(e)?` line-sel`:``}${i(t)?` line-ranged`:``}${a?` line-focus`:``}`}function $l(e,t){if(e)return n=>{n.button===0&&(n.preventDefault(),e(t,n.shiftKey))}}function eu({onClick:e}){return(0,S.jsx)(`button`,{type:`button`,className:`line-comment-btn`,"data-tip":`comment on this line; drag down to take more lines`,"aria-label":`comment on this line, or drag down to comment on a range`,onClick:t=>{t.stopPropagation(),t.shiftKey||e()},children:(0,S.jsx)(H,{name:`plus`,size:`sm`})})}function tu({lines:e,tokens:t,ranges:n,extraFor:r,extraClass:i,onComment:a,onRowClick:o,focusRow:s,onGutterDown:c,onLineEnter:l,selRows:u,rangeRows:d,rangeStarts:f,boundary:p}){return(0,S.jsx)(`table`,{className:`hunk-lines`,children:(0,S.jsxs)(`tbody`,{children:[p,e.map((e,p)=>{let m=r?.(p),h=$l(c,p);return(0,S.jsxs)(x.Fragment,{children:[(0,S.jsxs)(`tr`,{className:`line line-${e.kind}${Ql(u,d,s,p)}`,onMouseEnter:l?()=>l(p):void 0,onClick:o?()=>o(p):void 0,children:[(0,S.jsxs)(`td`,{className:`line-no`,onMouseDown:h,children:[f?.has(p)&&(0,S.jsx)(Zl,{}),a&&(0,S.jsx)(eu,{onClick:()=>a(p)}),e.oldNo??``]}),(0,S.jsx)(`td`,{className:`line-no`,onMouseDown:h,children:e.newNo??``}),(0,S.jsx)(`td`,{className:`line-marker`,children:Yl[e.kind]}),(0,S.jsx)(`td`,{className:`line-code`,...Xl(e,e.kind===`del`?`base`:`head`),children:(0,S.jsx)(Jl,{line:e,tokens:t[p]??null,ranges:n?.[p]})})]}),m&&(0,S.jsx)(`tr`,{className:`thread-row${i?.(p)??``}`,children:(0,S.jsx)(`td`,{colSpan:4,children:m})})]},p)})]})})}function nu({lines:e,tokens:t,ranges:n,extraFor:r,extraClass:i,onComment:a,onRowClick:o,focusRow:s,onGutterDown:c,onLineEnter:l,selRows:u,rangeRows:d,rangeStarts:f,boundary:p}){let m=Hl(e),h=e=>o&&e!==void 0?()=>o(e):void 0,g=e=>l&&e!==void 0?()=>l(e):void 0;return(0,S.jsxs)(`table`,{className:`hunk-lines hunk-lines-split`,children:[(0,S.jsxs)(`colgroup`,{children:[(0,S.jsx)(`col`,{className:`split-col-no`}),(0,S.jsx)(`col`,{}),(0,S.jsx)(`col`,{className:`split-col-no`}),(0,S.jsx)(`col`,{})]}),(0,S.jsxs)(`tbody`,{children:[p,m.map((e,o)=>{let l=e.left?r?.(e.left.idx):null,p=e.right&&e.right.idx!==e.left?.idx?r?.(e.right.idx):null;return(0,S.jsxs)(x.Fragment,{children:[(0,S.jsxs)(`tr`,{className:`line${Ql(u,d,s,e.left?.idx,e.right?.idx)}`,children:[(0,S.jsxs)(`td`,{className:`line-no`,onMouseDown:e.left?$l(c,e.left.idx):void 0,onMouseEnter:g(e.left?.idx),onClick:h(e.left?.idx),children:[e.left&&f?.has(e.left.idx)&&(0,S.jsx)(Zl,{}),a&&e.left&&(0,S.jsx)(eu,{onClick:()=>a(e.left.idx)}),e.left?.line.oldNo??``]}),(0,S.jsx)(`td`,{className:`line-half line-half-${e.left?.line.kind??`empty`}`,...e.left&&Xl(e.left.line,`base`),onMouseEnter:g(e.left?.idx),onClick:h(e.left?.idx),children:e.left&&(0,S.jsx)(Jl,{line:e.left.line,tokens:t[e.left.idx]??null,ranges:n?.[e.left.idx]})}),(0,S.jsxs)(`td`,{className:`line-no`,onMouseDown:e.right?$l(c,e.right.idx):void 0,onMouseEnter:g(e.right?.idx),onClick:h(e.right?.idx),children:[e.right&&f?.has(e.right.idx)&&(0,S.jsx)(Zl,{}),a&&e.right&&(0,S.jsx)(eu,{onClick:()=>a(e.right.idx)}),e.right?.line.newNo??``]}),(0,S.jsx)(`td`,{className:`line-half line-half-${e.right?.line.kind??`empty`}`,...e.right&&Xl(e.right.line,`head`),onMouseEnter:g(e.right?.idx),onClick:h(e.right?.idx),children:e.right&&(0,S.jsx)(Jl,{line:e.right.line,tokens:t[e.right.idx]??null,ranges:n?.[e.right.idx]})})]}),(l||p)&&(0,S.jsx)(`tr`,{className:`thread-row${l&&e.left&&i?.(e.left.idx)||p&&e.right&&i?.(e.right.idx)||``}`,children:(0,S.jsxs)(`td`,{colSpan:4,children:[l,p]})})]},o)})]})]})}function ru({hunk:e,fresh:t=!1,changedSinceReview:n=!1,changedSinceViewed:r=!1,viewed:i=!1,selected:a=!1,onSelect:o,viewMode:s=`unified`,linesAbove:c,linesBelow:l,gapAbove:u=null,threads:d=[],reviewActions:f,agentConnected:p,workingOn:m,queuedOn:h,composeRequested:g=!1,onComposeHandled:_}){let[v,y]=(0,x.useState)(null),[b,C]=(0,x.useState)(null),[w,T]=(0,x.useState)(null);(0,x.useEffect)(()=>{a||T(null)},[a]);let E=(0,x.useMemo)(()=>(c?.length??0)===0&&(l?.length??0)===0?e.lines:[...c??[],...e.lines,...l??[]],[c,l,e.lines]),D=ql(E,e.path),O=(0,x.useMemo)(()=>kl(E),[E]);(0,x.useEffect)(()=>{if(!g)return;let e=w??E.findIndex(e=>e.kind!==`context`),t=e===-1?0:e;y({at:t,edge:t}),_?.()},[g]);let[k,A]=(0,x.useState)(``),[j,M]=(0,x.useState)(void 0),ee=()=>{y(null),A(``),M(void 0)};(0,x.useEffect)(()=>{if(!b)return;let e=()=>{C(null),y({at:b.start,edge:b.end})};return window.addEventListener(`mouseup`,e),()=>window.removeEventListener(`mouseup`,e)},[b]);let N=f?(e,t)=>{if(t&&v){y({at:v.at,edge:e});return}C({start:e,end:e})}:void 0,P=b?e=>C(t=>t&&t.end!==e?{...t,end:e}:t):void 0,F=zl(E,d),te=F.get(-1)??[],ne=(0,x.useMemo)(()=>Bl(E,d),[E,d]),re=(0,x.useMemo)(()=>Vl(E,d),[E,d]),[I,ie]=(0,x.useState)(null),ae=(0,x.useMemo)(()=>{let e=b??(v?{start:v.at,end:v.edge}:null),t=new Set(I?.rows??[]);if(e)for(let n=Math.min(e.start,e.end);n<=Math.max(e.start,e.end);n++)t.add(n);return t},[b,v,I]),oe=t=>{if(!f)return null;let n=Fl(e.id,e.path,E,t.at,t.edge);if(!n)return null;let r=`${e.path.slice(e.path.lastIndexOf(`/`)+1)}:${mt(n)}`,i=e=>e?{kind:`changeset`}:n;return(0,S.jsx)(_c,{title:`Comment on ${r}`,placeholder:`Leave a comment…`,scope:{label:r,canWiden:!0,adjust:{up:t.edge>0?()=>y({at:t.at,edge:t.edge-1}):void 0,down:t.edge<E.length-1?()=>y({at:t.at,edge:t.edge+1}):void 0}},agentConnected:p,draft:k,onDraft:A,draftIntent:j,onDraftIntent:M,onSubmit:(e,t,n,r)=>{r?f.create(i(t),e,n,{audience:r}):f.create(i(t),e,n),ee()},onSend:(e,t,n)=>{f.create(i(t),e,n).then(e=>f.send(e.id)),ee()},onCancel:ee})},se=e=>{let t=F.get(e);return!t||Bl(E,t).size===0?``:` thread-row-ranged${I?.idx===e?` thread-row-lit`:``}`},ce=e=>{let t=F.get(e),n=v!==null&&Math.max(v.at,v.edge)===e?oe(v):null;if(!t&&!n)return null;let r=t?Bl(E,t):new Set;return(0,S.jsxs)(S.Fragment,{children:[t&&f&&(0,S.jsx)(`div`,{className:`thread-anchor-scope`,onMouseEnter:r.size>0?()=>ie({idx:e,rows:r}):void 0,onMouseLeave:r.size>0?()=>ie(null):void 0,children:(0,S.jsx)(Nc,{threads:t,actions:f,agentConnected:p,workingOn:m,queuedOn:h})}),n]})},le=n&&!i,ue=[`hunk`];le&&ue.push(`hunk-since-review`),t&&ue.push(`hunk-fresh`),i&&ue.push(`hunk-viewed`),a&&ue.push(`hunk-selected`);let de=e.lines.filter(e=>e.kind!==`add`).length,fe=e.lines.filter(e=>e.kind!==`del`).length,L=u?.merged??!1,R=!le&&r&&(0,S.jsx)(`span`,{className:`hunk-badge`,children:`changed since you read it`}),z=(0,S.jsx)(`tr`,{className:`hunk-boundary${L?` hunk-boundary-merged`:``}`,title:le?`the agent changed this since your last review`:void 0,children:(0,S.jsx)(`td`,{colSpan:4,children:(0,S.jsxs)(`span`,{className:`hunk-boundary-bar`,children:[u&&!L&&(0,S.jsx)(Ul,{gap:u}),u&&(L||u.expanded)&&(0,S.jsx)(Wl,{onCollapse:u.onCollapse}),!L&&(0,S.jsxs)(`span`,{className:`hunk-at`,title:`hunk position in the file`,children:[`@@ −`,e.oldStart,`,`,de,` +`,e.newStart,`,`,fe,` @@`,e.context!==void 0&&(0,S.jsxs)(`span`,{className:`hunk-at-scope`,children:[` `,e.context]})]}),u?.failed&&(0,S.jsx)(`span`,{className:`hunk-expand-failed`,role:`status`,children:Gl}),R]})})});return(0,S.jsxs)(`div`,{className:ue.join(` `),"data-hunk-id":e.id,onClick:()=>o?.(e.id),children:[s===`split`?(0,S.jsx)(nu,{lines:E,tokens:D,ranges:O,extraFor:ce,extraClass:se,onComment:f?e=>y({at:e,edge:e}):void 0,onRowClick:f?T:void 0,focusRow:w,onGutterDown:N,onLineEnter:P,selRows:ae,rangeRows:ne,rangeStarts:re,boundary:z}):(0,S.jsx)(tu,{lines:E,tokens:D,ranges:O,extraFor:ce,extraClass:se,onComment:f?e=>y({at:e,edge:e}):void 0,onRowClick:f?T:void 0,focusRow:w,onGutterDown:N,onLineEnter:P,selRows:ae,rangeRows:ne,rangeStarts:re,boundary:z}),te.length>0&&f&&(0,S.jsx)(Nc,{threads:te,actions:f,agentConnected:p,workingOn:m,queuedOn:h})]})}function iu(e,t){return`/api/file?path=${encodeURIComponent(e)}&side=${t}`}function au({file:e}){let t=e.status!==`added`,n=e.status!==`deleted`,r=e.oldPath??e.path;return(0,S.jsxs)(`div`,{className:`image-diff`,children:[t&&(0,S.jsxs)(`figure`,{className:`image-side image-side-base`,children:[(0,S.jsx)(`img`,{src:iu(r,`base`),alt:`${r} (base)`}),(0,S.jsx)(`figcaption`,{children:`base`})]}),n&&(0,S.jsxs)(`figure`,{className:`image-side image-side-head`,children:[(0,S.jsx)(`img`,{src:iu(e.path,`head`),alt:`${e.path} (head)`}),(0,S.jsx)(`figcaption`,{children:`head`})]})]})}function ou(e){return e.status!==`deleted`&&/\.(md|markdown)$/i.test(e.path)}function su({path:e,onClose:t}){let[n,r]=(0,x.useState)(null),[i,a]=(0,x.useState)(!1);return(0,x.useEffect)(()=>{let t=!1;return(async()=>{try{let n=await fetch(`/api/file?path=${encodeURIComponent(e)}&side=head`);if(!n.ok)throw Error(`/api/file → ${n.status}`);let i=await n.text();t||r(i)}catch{t||a(!0)}})(),()=>{t=!0}},[e]),(0,S.jsx)(jt,{title:e,className:`md-preview`,onClose:t,children:i?(0,S.jsx)(`div`,{className:`file-stub`,children:`couldn't read this file; it may have just changed on disk`}):n===null?(0,S.jsxs)(`div`,{"aria-hidden":`true`,children:[(0,S.jsx)(`div`,{className:`shimmer`}),(0,S.jsx)(`div`,{className:`shimmer`}),(0,S.jsx)(`div`,{className:`shimmer shimmer-short`})]}):(0,S.jsx)(uc,{className:`markdown md-doc`,text:n,docPath:e})})}function cu({navHidden:e,onToggleNav:t,left:n,total:r,hunksRead:i,hunksTotal:a,hunkAt:o=0,hunkCount:s=0,query:c=``,onClearQuery:l,hideReviewed:u,onHideReviewed:d,hideTests:f,onHideTests:p,testCount:m,onlyChanged:h,onOnlyChanged:g,changedCount:_,viewMode:v,onSetViewMode:y,allCollapsed:b,onToggleCollapseAll:x,stats:C,layer:w}){let T=r-n,E=w?w.progress:a!==void 0&&i!==void 0&&a>0?i/a:r===0?0:T/r,D=n===0?`all reviewed`:`${T} of ${r} files`,O=m>0||f,k=_>0||h,A=T>0||u,j=`${m} test ${m===1?`file`:`files`}`,M=c.trim();return(0,S.jsxs)(`div`,{className:`pane-bar`,children:[t&&(0,S.jsx)(`button`,{type:`button`,className:`pane-icon pane-nav`,onClick:t,"data-tip":`${e?`Show`:`Hide`} the file list (b)`,"aria-label":`${e?`Show`:`Hide`} the file list`,"aria-pressed":!e,children:(0,S.jsx)(H,{name:`sidebar`,size:`md`})}),E!==null&&(0,S.jsx)(`span`,{className:`prog-track prog-track-pane`,"aria-hidden":`true`,children:(0,S.jsx)(`i`,{style:{width:`${Math.round(E*100)}%`}})}),w?(0,S.jsx)(`span`,{className:`pane-left`,title:w.title,children:w.text}):(0,S.jsx)(`span`,{className:`pane-left`,title:`${T} of ${r} files marked reviewed`,children:D}),C&&!w&&(0,S.jsxs)(`span`,{className:`pane-size`,title:`lines added and removed across the changeset`,children:[C.additions>0&&(0,S.jsxs)(`span`,{className:`stat-add`,children:[`+`,C.additions.toLocaleString(`en-US`)]}),C.deletions>0&&(0,S.jsxs)(`span`,{className:`stat-del`,children:[`−`,C.deletions.toLocaleString(`en-US`)]})]}),o>0&&s>0&&(0,S.jsxs)(`span`,{className:`pane-at`,title:`the selected hunk — j / k move it`,children:[`hunk `,o,` / `,s]}),(0,S.jsx)(`span`,{className:`grow`}),!w&&M!==``&&l&&(0,S.jsxs)(`button`,{type:`button`,className:`pane-q`,title:`Showing only files matching “${M}”; click to clear`,"aria-label":`Clear the file filter “${M}”`,onClick:l,children:[(0,S.jsx)(H,{name:`search`,size:`sm`}),(0,S.jsx)(`span`,{className:`pane-q-word`,children:M}),(0,S.jsx)(H,{name:`x`,size:`sm`})]}),!w&&k&&(0,S.jsx)(lu,{on:h,onChange:g,label:_>0?`Only ${_} since review`:`Only since review`,onLabel:_>0?`only ${_} since review`:void 0}),!w&&A&&(0,S.jsx)(lu,{on:u,onChange:d,label:T>0?`Hide ${T} reviewed`:`Hide reviewed`,onLabel:T>0?`${T} reviewed hidden`:void 0}),O&&(0,S.jsx)(lu,{on:f,onChange:p,label:m>0?`Hide ${j}`:`Hide tests`,onLabel:m>0?`${j} hidden`:void 0}),(0,S.jsx)(`span`,{className:`pane-sep`}),(0,S.jsxs)(`span`,{className:`pane-modes`,role:`group`,"aria-label":`Diff layout`,children:[(0,S.jsx)(`button`,{type:`button`,className:`pane-icon`,"aria-pressed":v===`unified`,"data-tip":`Unified diff (u)`,"aria-label":`Unified diff`,onClick:()=>y(`unified`),children:(0,S.jsx)(H,{name:`unified`,size:`sm`})}),(0,S.jsx)(`button`,{type:`button`,className:`pane-icon`,"aria-pressed":v===`split`,"data-tip":`Split diff (u)`,"aria-label":`Split diff`,onClick:()=>y(`split`),children:(0,S.jsx)(H,{name:`split`,size:`sm`})})]}),(0,S.jsx)(`button`,{type:`button`,className:`pane-icon`,"aria-pressed":b,"data-tip":`${b?`Expand`:`Collapse`} all files`,"aria-label":`${b?`Expand`:`Collapse`} all files`,onClick:x,children:(0,S.jsx)(H,{name:`fold`,size:`sm`})}),w&&(w.prev||w.next)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`pane-sep`}),(0,S.jsxs)(`span`,{className:`ch-pager`,children:[w.prev&&(0,S.jsxs)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,title:`Previous layer: ${w.prev.title} ([)`,"aria-label":`Previous layer: ${w.prev.title}`,onClick:w.prev.onGo,children:[`‹ `,(0,S.jsx)(`span`,{className:`ch-pager-t`,children:w.prev.title})]}),w.next&&(0,S.jsxs)(`button`,{type:`button`,className:`btn btn-sm`,title:`Next layer: ${w.next.title} (])`,"aria-label":`Next layer: ${w.next.title}`,onClick:w.next.onGo,children:[(0,S.jsx)(`span`,{className:`ch-pager-t`,children:w.next.title}),` ›`,` `,(0,S.jsx)(`span`,{className:`kbd`,"aria-hidden":`true`,children:`]`})]})]})]})]})}function lu({on:e,onChange:t,label:n,onLabel:r}){return(0,S.jsxs)(`button`,{type:`button`,className:`pane-sw${e?` pane-sw-on`:``}`,role:`switch`,"aria-checked":e,onClick:()=>t(!e),children:[(0,S.jsx)(`span`,{className:`pane-track`,"aria-hidden":`true`,children:(0,S.jsx)(`i`,{})}),e&&r?r:n]})}var uu=e=>e.toLocaleString(`en-US`);function du({read:e,total:t,excludedTests:n,excludedUnchanged:r,stats:i,unsent:a,onFinish:o,onIncludeExcluded:s,onDismiss:c,shape:l}){let u=n+r,d=a!==void 0&&a>0?a:0,f=u===0?`That's the whole changeset`:`That's everything you asked to see`,p=t===0?1:Math.min(1,(u===0?t:e)/t),m=(0,S.jsxs)(`div`,{className:`done-stats`,children:[(0,S.jsxs)(`span`,{className:`done-stat`,children:[(0,S.jsx)(`span`,{className:`done-n`,children:u===0?uu(t):`${e} of ${t}`}),` `,t===1?`file`:`files`,` read`]}),u===0&&i&&(i.additions>0||i.deletions>0)&&(0,S.jsxs)(`span`,{className:`done-stat done-size`,children:[i.additions>0&&(0,S.jsxs)(`span`,{className:`stat-add`,children:[`+`,uu(i.additions)]}),i.deletions>0&&(0,S.jsxs)(`span`,{className:`stat-del`,children:[`−`,uu(i.deletions)]})]}),d>0&&(0,S.jsxs)(`span`,{className:`done-stat done-unsent`,role:`img`,"aria-label":`${d} comment${d===1?``:`s`} waiting to go back to your agent`,title:`${d} comment${d===1?``:`s`} waiting to go back to your agent`,children:[(0,S.jsx)(H,{name:`chat`,size:`sm`}),d]})]}),h=(0,S.jsxs)(`div`,{className:`done-meter`,children:[(0,S.jsx)(`div`,{className:`done-bar`,"aria-hidden":`true`,children:(0,S.jsx)(`i`,{style:{"--p":p}})}),m]}),g=u>0&&(0,S.jsxs)(`div`,{className:`done-caveat`,children:[(0,S.jsx)(H,{name:`eye-off`,size:`sm`}),(0,S.jsxs)(`span`,{className:`done-caveat-text`,children:[n>0&&(0,S.jsxs)(S.Fragment,{children:[n,` test `,n===1?`file was`:`files were`,` hidden`]}),n>0&&r>0&&`, and `,r>0&&(0,S.jsxs)(S.Fragment,{children:[r,` `,r===1?`file is`:`files are`,` outside this round`]}),`; nobody reviewed `,u===1?`it`:`them`,`.`]}),s&&(0,S.jsxs)(`button`,{type:`button`,className:`done-caveat-act`,onClick:s,children:[`Review `,u===1?`it`:`them`,` too`]})]}),_=(0,S.jsx)(`div`,{className:l===`full`?`empty-acts`:`done-acts`,children:o&&(0,S.jsx)(`button`,{type:`button`,className:l===`full`?`btn btn-primary`:`btn btn-primary btn-sm`,onClick:o,children:`Finish review`})});return l===`docked`?(0,S.jsxs)(`div`,{className:`done-card`,role:`status`,children:[(0,S.jsxs)(`div`,{className:`done-card-row`,children:[(0,S.jsx)(pu,{}),(0,S.jsxs)(`span`,{className:`done-said`,children:[(0,S.jsx)(`span`,{className:`done-head`,children:f}),m]}),_,c&&(0,S.jsx)(`button`,{type:`button`,className:`done-close`,"data-tip":`Dismiss`,"aria-label":`Dismiss`,onClick:c,children:(0,S.jsx)(H,{name:`x`,size:`sm`})})]}),g]}):(0,S.jsxs)(`div`,{className:`pane-done`,children:[(0,S.jsx)(pu,{drawn:!0}),(0,S.jsx)(`h2`,{children:f}),h,g,_]})}var fu=[0,1,2,3,4,5,6,7];function pu({drawn:e=!1}){return(0,S.jsxs)(`span`,{className:`done-seal${e?` done-seal-drawn`:``}`,"aria-hidden":`true`,children:[e&&(0,S.jsx)(`span`,{className:`done-spark`,children:fu.map(e=>(0,S.jsx)(`i`,{},e))}),e?(0,S.jsx)(`svg`,{className:`done-tick`,viewBox:`0 0 24 24`,width:`26`,height:`26`,"aria-hidden":`true`,children:(0,S.jsx)(`path`,{d:`M5 12.5 L10 17.5 L19 7`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`})}):(0,S.jsx)(H,{name:`check`,size:`md`})]})}function mu({sha:e,subject:t,threads:n,onClear:r,onDismiss:i,shape:a}){let[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(!1),u=us(),d=u&&u.state!==`open`?u:null,f=()=>{s(!0),l(!1),r().catch(()=>{s(!1),l(!0)})},p=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`landed-sha`,children:e.slice(0,7)}),t!==``&&(0,S.jsxs)(`span`,{className:`landed-subject`,children:[` “`,t,`”`]})]}),m=n===0?`its review record`:`its ${n===1?`thread`:`${n} threads`} and guide`,h=o?`Clearing…`:n===0?d?`Clear the review`:`Start fresh`:d?`Clear ${n===1?`the thread`:`${n} threads`}`:`Start fresh: clear ${n===1?`the thread`:`${n} threads`}`,g=d&&(d.state===`merged`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`b`,{children:`Merged`}),` as `,(0,S.jsx)(`span`,{className:`landed-sha`,children:e.slice(0,7)}),`. The diff is what shipped, and comments still post to GitHub.`]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`b`,{children:`Closed`}),` without merging. The diff stays to read, and comments still post to GitHub.`]})),_=c&&(0,S.jsx)(`p`,{className:`cov-note cov-note-error`,children:`Couldn't clear the review; the server may be down. Nothing was deleted; try again.`});return a===`docked`&&d?(0,S.jsxs)(`div`,{className:`landed-strip landed-strip-${d.state}`,role:`status`,children:[(0,S.jsx)(H,{name:`pr`,size:`sm`}),(0,S.jsx)(`span`,{className:`landed-strip-text`,children:g}),(0,S.jsx)(`button`,{type:`button`,className:`landed-strip-act`,disabled:o,title:`Deletes the threads and guide; Diffo drops the checkout when the server exits`,onClick:f,children:h}),(0,S.jsx)(`button`,{type:`button`,className:`done-close`,"data-tip":`Keep them`,"aria-label":`Keep the review as it is`,onClick:i,children:(0,S.jsx)(H,{name:`x`,size:`sm`})}),c&&(0,S.jsx)(`span`,{className:`landed-strip-err`,children:`Couldn't clear; nothing was deleted.`})]}):a===`docked`?(0,S.jsxs)(`div`,{className:`landed-card`,role:`status`,children:[(0,S.jsx)(`span`,{className:`landed-seal`,"aria-hidden":`true`,children:(0,S.jsx)(H,{name:`check`,size:`md`})}),(0,S.jsxs)(`span`,{className:`landed-said`,children:[`The previous review landed in `,p,`; `,m,` `,n===0?`is`:`are`,` still here, under this new changeset.`]}),(0,S.jsx)(`div`,{className:`landed-acts`,children:(0,S.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,disabled:o,onClick:f,children:h})}),(0,S.jsx)(`button`,{type:`button`,className:`done-close`,"data-tip":`Keep them`,"aria-label":`Keep the previous review's threads`,onClick:i,children:(0,S.jsx)(H,{name:`x`,size:`sm`})})]}):(0,S.jsxs)(`div`,{className:`empty-state landed-full`,children:[(0,S.jsx)(H,{name:`check`,size:`lg`}),g?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`h2`,{children:[`This pull request `,d.state===`merged`?`merged`:`closed`]}),(0,S.jsxs)(`p`,{children:[g,` Clear `,m,` when you are done, and Diffo drops the checkout.`]})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h2`,{children:`This review landed`}),(0,S.jsxs)(`p`,{children:[`Commit `,p,` took the whole changeset;`,` `,n===0?`${m} belongs`:`${m} belong`,` to that round. Clear the slate and the next changeset starts its own review.`]})]}),(0,S.jsxs)(`div`,{className:`empty-acts`,children:[(0,S.jsx)(`button`,{type:`button`,className:`btn btn-primary`,disabled:o,onClick:f,children:h}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:i,children:`Keep them`})]}),_]})}function hu({layer:e,filesShown:t,comments:n}){let r=e.summary?J(e.summary,e.knownPaths):null,[i,a]=(0,x.useState)(!1),[o,s]=(0,x.useState)(null),c=e.id===null?[]:n?.partition.byLayer.get(e.id)??[],l=e.id===null?null:{kind:`layer`,layerId:e.id,title:e.title},u=t=>{let n=Po(t.target);n&&(t.preventDefault(),e.onJump(n.path,n.line))},d=t===0,f=!!(e.decisions&&e.decisions.length>0&&e.onOpenDecision),p=r!==null||e.missing.length>0||d,m=n!==void 0&&l!==null;return(0,S.jsxs)(`section`,{className:`ch-head`,"aria-label":`${e.kicker}: ${e.title}`,children:[(0,S.jsxs)(`div`,{className:`ch-head-top`,children:[(0,S.jsx)(`div`,{className:`ch-head-kicker`,children:e.kicker}),m&&!i&&(0,S.jsxs)(`button`,{type:`button`,className:`btn btn-ghost btn-sm ch-head-ask`,onClick:()=>a(!0),children:[(0,S.jsx)(H,{name:`chat`,size:`sm`}),`Comment on this layer`]})]}),(0,S.jsxs)(`h2`,{children:[e.title,e.mechanical&&(0,S.jsx)(`span`,{className:`ch-kind`,title:`changes no behaviour; files are folded, expand one to check`,children:`mechanical`})]}),(p||f)&&(0,S.jsxs)(`div`,{className:`ch-head-body`,children:[p&&(0,S.jsxs)(`div`,{className:`ch-head-about`,children:[r&&(0,S.jsx)(`div`,{onClick:u,children:(0,S.jsx)(uc,{text:r,className:`cmt-body markdown ch-summary`,paths:e.knownPaths})}),e.missing.length>0&&(0,S.jsxs)(`div`,{className:`ch-head-files`,children:[(0,S.jsx)(`span`,{className:`ch-head-missing`,children:`not in the changeset now:`}),e.missing.map(e=>(0,S.jsx)(`span`,{className:`ch-chip ch-chip-done`,title:`${e}, not in the changeset now`,children:e},e))]}),d&&e.listed===0&&(0,S.jsxs)(`div`,{className:`ch-head-empty`,children:[`Nothing this layer lists is in the changeset right now. Move on with`,` `,(0,S.jsx)(`span`,{className:`kbd`,children:`]`}),`.`]}),d&&e.listed>0&&e.hidden===e.listed&&(0,S.jsxs)(`div`,{className:`ch-head-empty`,children:[e.hidden===1?`The one file`:`All ${e.hidden} files`,` in this layer`,` `,e.hidden===1?`is a test`:`are tests`,`, hidden by `,(0,S.jsx)(`b`,{children:`Hide tests`}),` on the bar. Move on with `,(0,S.jsx)(`span`,{className:`kbd`,children:`]`}),`.`]})]}),f&&(0,S.jsx)(il,{decisions:e.decisions,open:e.openDecision??null,onOpen:e.onOpenDecision,onJump:e.onJump,onComment:m?t=>{s({label:`decision`,text:e.decisions[t].decision.text}),a(!0)}:void 0})]}),m&&(c.length>0||i)&&(0,S.jsxs)(`div`,{className:`ch-head-threads`,children:[c.length>0&&(0,S.jsx)(Nc,{threads:c,actions:n.actions,showContext:!0,agentConnected:n.agentConnected,workingOn:n.workingOn,queuedOn:n.queuedOn,links:n.links}),i&&(0,S.jsx)(_c,{citing:o??void 0,title:`Comment on this layer`,placeholder:`Ask about this step, or say what should change in it…`,scope:{label:`layer “${e.title}”`,canWiden:!1},fixedAudience:`agent`,agentConnected:n.agentConnected,onSubmit:(e,t,r)=>{n.actions.create(l,e,r),a(!1),s(null)},onSend:(e,t,r)=>{n.actions.create(l,e,r).then(e=>n.actions.send(e.id)),a(!1),s(null)},onCancel:()=>{a(!1),s(null)}})]})]})}var gu={added:`added`,deleted:`deleted`,renamed:`renamed`};function _u({file:e,viewed:t,collapsed:n=!1,onToggle:r,commentCount:i=0,sinceCount:a=0,note:o,onComment:s,onToggleFileViewed:c}){let[l,u]=(0,x.useState)(!1),[d,f]=(0,x.useState)(!1),p=(0,x.useRef)(void 0);(0,x.useEffect)(()=>()=>clearTimeout(p.current),[]);let m=0,h=0;for(let t of e.hunks)for(let e of t.lines)e.kind===`add`?m++:e.kind===`del`&&h++;let g=mo(e,t),_=e.path.lastIndexOf(`/`),v=gu[e.status],y=e=>e.stopPropagation();return(0,S.jsxs)(`div`,{className:`file-header`,onClick:r,children:[(0,S.jsx)(`button`,{type:`button`,className:`file-chevron chevron${n?` chevron-shut`:``}`,"aria-expanded":!n,"data-tip":`${n?`Expand`:`Collapse`} this file`,"aria-label":`${n?`Expand`:`Collapse`} ${e.path}`,children:(0,S.jsx)(H,{name:`chev`})}),(0,S.jsxs)(`span`,{className:`file-path`,children:[e.status===`renamed`&&e.oldPath&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`file-oldpath`,children:e.oldPath}),` → `]}),_!==-1&&(0,S.jsx)(`span`,{className:`file-dir`,children:(0,S.jsx)(`bdi`,{children:e.path.slice(0,_+1)})}),(0,S.jsx)(`span`,{className:`file-base`,children:e.path.slice(_+1)})]}),v&&(0,S.jsx)(`span`,{className:`file-status file-status-${e.status}`,children:v}),a>0&&(0,S.jsxs)(`span`,{className:`file-since`,title:`since your last review; reading it settles it`,children:[`the agent changed`,` `,a===e.hunks.length?`this`:`${a} ${a===1?`hunk`:`hunks`}`]}),o&&(0,S.jsx)(`span`,{className:`ch-file-note`,title:o,children:o}),(0,S.jsx)(`button`,{type:`button`,className:`ghb file-copy`,"data-tip":l?`Copied`:`Copy path`,"aria-label":`Copy path`,onClick:t=>{y(t),wt(e.path).then(()=>{u(!0),clearTimeout(p.current),p.current=setTimeout(()=>u(!1),1500)})},children:(0,S.jsx)(H,{name:l?`check`:`copy`,size:`sm`})}),(0,S.jsx)(`span`,{className:`grow`}),(m>0||h>0)&&(0,S.jsxs)(`span`,{className:`dstat`,children:[m>0&&(0,S.jsxs)(`span`,{className:`stat-add`,children:[`+`,m]}),h>0&&(0,S.jsxs)(`span`,{className:`stat-del`,children:[`−`,h]})]}),ou(e)&&(0,S.jsxs)(`button`,{type:`button`,className:`file-preview-btn`,title:`Read this file rendered`,"aria-label":`Preview ${e.path} rendered`,onClick:e=>{y(e),f(!0)},children:[(0,S.jsx)(H,{name:`book`,size:`sm`}),`Preview`]}),c&&(0,S.jsxs)(`button`,{type:`button`,className:`file-viewed-toggle`,"aria-pressed":g,title:`mark this whole file read`,onClick:e=>{y(e),c()},children:[(0,S.jsx)(Y,{state:g}),`Viewed`]}),s&&i>0&&(0,S.jsxs)(`button`,{type:`button`,className:`ghb file-comment-btn`,title:`${i} ${i===1?`thread`:`threads`} on this file`,"aria-label":`Comment on this file`,onClick:e=>{y(e),s()},children:[(0,S.jsx)(H,{name:`chat`,size:`sm`}),(0,S.jsx)(`span`,{className:`ghb-badge`,children:i})]}),(0,S.jsx)(`span`,{onClick:y,children:(0,S.jsx)(Ha,{label:`More file actions`,triggerClassName:`ghb`,children:t=>(0,S.jsxs)(S.Fragment,{children:[s&&(0,S.jsx)(Ua,{icon:`chat`,onClick:()=>{t(),s()},children:`Comment on this file`}),(0,S.jsx)(Ua,{icon:`copy`,onClick:()=>{t(),wt(e.path)},children:`Copy path`}),(0,S.jsx)(Ua,{icon:`fold`,kbd:`o`,onClick:()=>{t(),r?.()},children:n?`Expand file`:`Collapse file`})]})})}),d&&(0,S.jsx)(`span`,{onClick:y,children:(0,S.jsx)(su,{path:e.path,onClose:()=>f(!1)})})]})}function vu(e){return{fingerprint:e,headLines:null,exp:new Map,failed:new Set}}function yu(e){let t=(0,x.useMemo)(()=>Zc(e),[e]),n=(0,x.useMemo)(()=>`${e.newLineCount??``}#${e.hunks.map(e=>e.id).join(`
|
|
89
89
|
`)}`,[e]),[r,i]=(0,x.useState)(()=>vu(n));r.fingerprint!==n&&i(vu(n));let a=r.fingerprint===n?r:vu(n),o=async(t,r)=>{let o=a.headLines;if(o===null)try{let t=await fetch(`/api/file?path=${encodeURIComponent(e.path)}&side=head`);if(!t.ok)throw Error(`/api/file → ${t.status}`);let n=await t.text();o=n.endsWith(`
|
|
90
90
|
`)?n.slice(0,-1).split(`
|
|
91
91
|
`):n.split(`
|
|
92
|
-
`)}catch{i(e=>e.fingerprint===n?{...e,failed:new Set(e.failed).add(t.key)}:e);return}let s=a.exp.get(t.key)??Hc,c=r===`all`?{fromTop:Qc(t),fromBottom:0}:r===`down`?{...s,fromTop:s.fromTop+20}:{...s,fromBottom:s.fromBottom+20},l=tl(o,t,s),u=tl(o,t,c),d=o;if(u.top.length+u.bottom.length<=l.top.length+l.bottom.length){i(e=>e.fingerprint===n?{...e,headLines:d,failed:new Set(e.failed).add(t.key)}:e);return}i(e=>{if(e.fingerprint!==n)return e;let r=new Set(e.failed);return r.delete(t.key),{...e,headLines:d,exp:new Map(e.exp).set(t.key,c),failed:r}})},s=e=>i(t=>{if(t.fingerprint!==n)return t;let r=new Map(t.exp);r.delete(e.key);let i=new Set(t.failed);return i.delete(e.key),{...t,exp:r,failed:i}}),c=(0,x.useMemo)(()=>{let e=new Map;if(a.headLines===null)return e;for(let n of t){let t=a.exp.get(n.key);t&&e.set(n.key,tl(a.headLines,n,t))}return e},[t,a]);return{gaps:t,visible:c,controlsFor:e=>{let t=a.exp.get(e.key)??Hc;return{remaining:$c(e,t),canUp:e.below!==null,canDown:e.above!==null,expanded:t.fromTop+t.fromBottom>0,merged:c.get(e.key)?.merged??!1,failed:a.failed.has(e.key),onUp:()=>void o(e,`up`),onDown:()=>void o(e,`down`),onAll:()=>void o(e,`all`),onCollapse:()=>s(e)}}}}function bu({file:e,delta:t,sinceReview:n,handlers:r,composerOpen:i=!1,onCloseComposer:a,stub:o=null,onLoadDiff:s}){let c=e.status!==`deleted`&&e.kind===`text`,{gaps:l,visible:u,controlsFor:d}=yu(e),f=r.comments,p=f?.partition.byFile.get(e.path)??[],m=e.path.slice(e.path.lastIndexOf(`/`)+1),h=t=>t?{kind:`changeset`}:{kind:`file`,path:e.path},g=f&&(p.length>0||i)&&(0,S.jsxs)(`div`,{className:`file-threads`,children:[(0,S.jsx)(Nc,{threads:p,actions:f.actions,showContext:!0,agentConnected:f.agentConnected,workingOn:f.workingOn,queuedOn:f.queuedOn}),i&&(0,S.jsx)(_c,{title:`Comment on ${m}`,placeholder:`Leave a comment…`,scope:{label:m,canWiden:!0},agentConnected:f.agentConnected,onSubmit:(e,t,n,r)=>{r?f.actions.create(h(t),e,n,{audience:r}):f.actions.create(h(t),e,n),a?.()},onSend:(e,t,n)=>{f.actions.create(h(t),e,n).then(e=>f.actions.send(e.id)),a?.()},onCancel:()=>a?.()})]});if(o!==null)return(0,S.jsxs)(S.Fragment,{children:[g,(0,S.jsxs)(`div`,{className:`file-stub file-stub-large`,children:[(0,S.jsx)(`span`,{children:o===`generated`?`Generated file, not rendered by default.`:`Large diff (${Bc(e)} changed lines), not rendered by default.`}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:s,children:`Load diff`})]})]});if(e.kind===`image`&&e.hunks.length===0)return(0,S.jsxs)(S.Fragment,{children:[g,(0,S.jsx)(au,{file:e})]});if(e.kind===`binary`)return(0,S.jsxs)(S.Fragment,{children:[g,(0,S.jsx)(`div`,{className:`file-stub`,children:`binary file changed`})]});if(e.hunks.length===0)return(0,S.jsxs)(S.Fragment,{children:[g,(0,S.jsx)(`div`,{className:`file-stub`,children:e.status===`renamed`?`renamed, no content changes`:`no content changes`})]});let _=mo(e,r.viewed),v=new Map,y=new Map;for(let e of l)e.below!==null&&v.set(e.below,e),e.above!==null&&y.set(e.above,e);let b=l.find(e=>e.below===null);return(0,S.jsxs)(S.Fragment,{children:[g,e.kind===`image`&&(0,S.jsx)(au,{file:e}),e.hunks.map((e,i)=>{let a=c?v.get(i):void 0,o=c?y.get(i):void 0;return(0,S.jsx)(ru,{hunk:e,fresh:t.freshHunkIds.has(e.id),changedSinceReview:n?.has(e.id)??!1,changedSinceViewed:t.changedViewedHunkIds.has(e.id),viewed:_,selected:r.selectedId===e.id,onSelect:r.onSelect,viewMode:r.viewMode??`unified`,linesAbove:a&&u.get(a.key)?.bottom,linesBelow:o&&u.get(o.key)?.top,gapAbove:a?d(a):null,threads:f?.partition.byHunk.get(e.id),reviewActions:f?.actions,agentConnected:f?.agentConnected,workingOn:f?.workingOn,queuedOn:f?.queuedOn,composeRequested:f?.composeHunkId===e.id,onComposeHandled:f?.onComposeHandled},e.id)}),c&&b&&(0,S.jsx)(Kl,{gap:d(b)})]})}function xu({files:e,delta:t=nl,sinceReview:n,hasMore:r=!1,onLoadMore:i,controls:a,landed:o,layer:s,overview:c=!1,...l}){let[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(!1),[m,h]=(0,x.useState)(new Set),g=l.selectedId;(0,x.useEffect)(()=>{if(!g)return;let t=e.find(e=>e.hunks.some(e=>e.id===g));t&&Vc(t)!==null&&h(e=>e.has(t.path)?e:new Set(e).add(t.path))},[g,e]);let _=(0,x.useRef)(null),v=(0,x.useRef)(null);(0,x.useEffect)(()=>{if(!r||!i)return;if(typeof IntersectionObserver>`u`){i();return}let e=v.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&i()},{root:_.current,rootMargin:`1200px 0px`});return t.observe(e),()=>t.disconnect()},[r,i,e.length]);let y=(0,x.useRef)({files:e,controls:a,viewed:l.viewed});y.current={files:e,controls:a,viewed:l.viewed};let b=(0,x.useRef)(0);(0,x.useEffect)(()=>{let e=_.current;if(!e)return;let t=0,n=()=>{t=0;let{files:n,controls:r,viewed:i}=y.current;if(!r?.hideReviewed||r.pinned.size===0)return;let a=(e.querySelector(`.pane-bar`)??e).getBoundingClientRect().bottom;for(let e of n){if(!r.pinned.has(e.path)||!mo(e,i))continue;let t=document.getElementById(Ro(e.path));if(!t)continue;let n=t.getBoundingClientRect();n.bottom>=a||(b.current+=n.height+(parseFloat(getComputedStyle(t).marginBottom)||0),r.onSweep(e.path))}},r=()=>{t!==0&&cancelAnimationFrame(t),t=requestAnimationFrame(n)};return e.addEventListener(`scroll`,r,{passive:!0}),()=>{e.removeEventListener(`scroll`,r),t!==0&&cancelAnimationFrame(t)}},[]),(0,x.useLayoutEffect)(()=>{let e=_.current;e&&b.current!==0&&(e.scrollTop-=b.current,b.current=0)});let C=l.comments?.composeFilePath??null;(0,x.useEffect)(()=>{C&&(l.collapsed?.has(C)&&l.onToggleCollapsed?.(C),d(C),l.comments?.onComposeFileHandled?.())},[C]);let[w,T]=(0,x.useState)(null),E=w??s===void 0,D=T,O=l.comments,k=O?.revealNotesTick??0;(0,x.useEffect)(()=>{k>0&&D(!0)},[k]);let A=c||E||O?.changesetComposerOpen===!0,j=c||s===void 0,[M,ee]=(0,x.useState)(!1),N=O?.revealPastTick??0;(0,x.useEffect)(()=>{N>0&&ee(!0)},[N]);let P=us(),F=O?.partition.changeset.length??0,te=P?.viewer.login??null,ne=O?.partition.changeset,{lead:re,others:I}=(0,x.useMemo)(()=>{let e=ne??[];if(!P)return{lead:e,others:[]};let t=e=>e.github?.kind===`description`||!at(e)||xs(e,te);return{lead:e.filter(t),others:e.filter(e=>!t(e))}},[ne,P,te]),[ie,ae]=(0,x.useState)(!1),oe=O?.revealThreadId??null;(0,x.useEffect)(()=>{k>0&&oe!==null&&I.some(e=>e.id===oe)&&ae(!0)},[k,oe,I]);let se=O&&j&&(F>0||O.changesetComposerOpen||c)&&(0,S.jsxs)(`section`,{className:`changeset-strip`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`strip-head`,onClick:()=>D(!E),"aria-expanded":A,children:[(0,S.jsx)(`span`,{className:`file-chevron chevron${A?``:` chevron-shut`}`,children:(0,S.jsx)(H,{name:`chev`})}),P?`On the pull request`:`On the changeset`,(0,S.jsx)(`span`,{className:`strip-n`,children:F})]}),A&&(0,S.jsxs)(`div`,{className:`strip-body`,children:[(0,S.jsx)(Nc,{threads:re,actions:O.actions,showContext:!0,agentConnected:O.agentConnected,workingOn:O.workingOn,queuedOn:O.queuedOn,links:O.links}),I.length>0&&(0,S.jsx)(`button`,{type:`button`,className:`strip-more`,"aria-expanded":ie,onClick:()=>ae(!ie),children:ie?`Only mine`:`${I.length} more from others`}),ie&&I.length>0&&(0,S.jsx)(Nc,{threads:I,actions:O.actions,showContext:!0,agentConnected:O.agentConnected,workingOn:O.workingOn,queuedOn:O.queuedOn,links:O.links}),O.changesetComposerOpen?(0,S.jsx)(_c,{title:`Note on the whole changeset`,placeholder:`Leave a note…`,scope:{label:`the whole changeset`,canWiden:!1},agentConnected:O.agentConnected,onSubmit:(e,t,n,r)=>{r?O.actions.create({kind:`changeset`},e,n,{audience:r}):O.actions.create({kind:`changeset`},e,n),O.onCloseChangesetComposer?.()},onSend:(e,t,n)=>{O.actions.create({kind:`changeset`},e,n).then(e=>O.actions.send(e.id)),O.onCloseChangesetComposer?.()},onCancel:()=>O.onCloseChangesetComposer?.()}):O.onOpenChangesetComposer&&(0,S.jsx)(`button`,{type:`button`,className:`strip-add`,onClick:O.onOpenChangesetComposer,children:P?`+ Comment on the pull request`:`+ Note on the changeset`})]})]}),ce=O?.past??[],le=ce.filter(e=>e.github?.outdated===!0).length,ue=ce.filter(e=>e.anchor.kind===`layer`).length,de=ue===ce.length?`The layer ${ce.length===1?`this hangs`:`these hang`} off left the outline: the agent re-posted without ${ce.length===1?`its`:`their`} title.`:le===ce.length?`${ce.length===1?`This one is`:`These are`} outdated on GitHub: the line ${ce.length===1?`it hangs`:`they hang`} off left the diff, though the file is still in it.`:le>0?`The file or change these hang off is no longer in the diff: reverted, deleted, or stashed; ${le} ${le===1?`is`:`are`} outdated on GitHub instead, the line left the diff.`:`The file or change these hang off is no longer in the diff: reverted, deleted, or stashed.`,fe=O&&ce.length>0&&(0,S.jsxs)(`section`,{className:`file-section past-threads`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`file-header notes-header`,onClick:()=>ee(e=>!e),"aria-expanded":M,children:[(0,S.jsx)(`span`,{className:`file-chevron chevron${M?``:` chevron-shut`}`,children:(0,S.jsx)(H,{name:`chev`})}),(0,S.jsxs)(`span`,{className:`file-path`,children:[ce.length===1?`1 thread`:`${ce.length} threads`,` whose`,` `,ue===ce.length?`layer left the outline`:`code left the changeset`]})]}),M&&(0,S.jsxs)(`div`,{className:`file-threads`,children:[(0,S.jsxs)(`div`,{className:`past-hint`,children:[de,` The conversation is intact`,ue===ce.length?`.`:`, and the snapshot inside each one is the code you commented on.`]}),(0,S.jsx)(Nc,{threads:ce,actions:O.actions,showContext:!0,gone:!0,agentConnected:O.agentConnected,workingOn:O.workingOn,queuedOn:O.queuedOn})]})]}),L=a?.total??0,R=e.length===0&&L===0,z=e.length===0&&L>0,pe=a!==void 0&&a.scopeTotal>0&&a.scopeLeft===0;(0,x.useEffect)(()=>{pe&&p(!1)},[pe]);let me=(a?.hiddenTests??0)+(a?.hiddenReviewed??0)+(a?.hiddenUnchanged??0)+(a?.hiddenQuery??0),he=a&&(0,S.jsx)(du,{read:a.total-a.left,total:a.total,excludedTests:a.excludedTests,excludedUnchanged:a.excludedUnchanged,stats:a.stats,unsent:a.unsent,onFinish:a.onFinish,onIncludeExcluded:a.onIncludeExcluded,onDismiss:()=>p(!0),shape:z?`full`:`docked`}),ge=c?null:R?o?(0,S.jsx)(mu,{...o,shape:`full`}):(0,S.jsxs)(`div`,{className:`empty-state`,children:[(0,S.jsx)(H,{name:`book`,size:`lg`}),(0,S.jsx)(`h2`,{children:`Nothing to review`}),(0,S.jsx)(`p`,{children:`The working tree is clean. Diffo is watching; start your agent and changes appear here as they land.`})]}):s&&e.length===0?(0,S.jsx)(hu,{layer:s,filesShown:0,comments:O}):z&&pe?he:z&&a?(0,S.jsxs)(`div`,{className:`empty-state`,children:[(0,S.jsx)(H,{name:`filter`,size:`lg`}),(0,S.jsxs)(`h2`,{children:[a.left,` `,a.left===1?`file`:`files`,` still to review`]}),(0,S.jsx)(`p`,{children:a.hiddenQuery===0?`They're hidden by the switches on the bar above.`:a.hiddenTests+a.hiddenReviewed+a.hiddenUnchanged===0?`None of them match “${a.query.trim()}”.`:`They're hidden by “${a.query.trim()}” and the switches on the bar above.`}),(0,S.jsx)(`div`,{className:`empty-acts`,children:(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:a.onShowAll,children:`Show all files`})})]}):(0,S.jsxs)(S.Fragment,{children:[s&&(0,S.jsx)(hu,{layer:s,filesShown:e.length,comments:O}),e.map(e=>{let r=l.collapsed?.has(e.path)??!1,i=O?.partition.byFile.get(e.path)?.length??0,a=O===void 0?0:e.hunks.reduce((e,t)=>e+(O.partition.byHunk.get(t.id)?.length??0),0),o=g!=null&&e.hunks.some(e=>e.id===g),c=m.has(e.path)||o||a>0?null:Vc(e),f=n===void 0?0:e.hunks.reduce((e,t)=>e+ +!!n.has(t.id),0);return(0,S.jsxs)(`section`,{id:Ro(e.path),className:`file-section${r?` file-section-collapsed`:``}`,children:[(0,S.jsx)(_u,{file:e,viewed:l.viewed,collapsed:r,onToggle:()=>l.onToggleCollapsed?.(e.path),commentCount:i+a,sinceCount:f,note:s?.notes.get(e.path),onToggleFileViewed:l.onToggleFileViewed?()=>l.onToggleFileViewed(e.path):void 0,onComment:O?()=>{r&&l.onToggleCollapsed?.(e.path),d(t=>t===e.path?null:e.path)}:void 0}),!r&&(0,S.jsx)(bu,{file:e,delta:t,sinceReview:n,handlers:l,composerOpen:u===e.path,onCloseComposer:()=>d(null),stub:c,onLoadDiff:()=>h(t=>new Set(t).add(e.path))})]},e.path)}),r&&(0,S.jsxs)(`div`,{ref:v,className:`load-more`,"aria-hidden":`true`,children:[(0,S.jsx)(`div`,{className:`shimmer`}),(0,S.jsx)(`div`,{className:`shimmer shimmer-short`})]}),a&&me>0&&(0,S.jsxs)(`div`,{className:`pane-hidden`,children:[(0,S.jsxs)(`span`,{className:`pane-hidden-said`,children:[(0,S.jsx)(H,{name:`eye-off`,size:`sm`}),[a.hiddenQuery>0?`${a.hiddenQuery} not matching “${a.query.trim()}”`:null,a.hiddenUnchanged>0?`${a.hiddenUnchanged} unchanged`:null,a.hiddenTests>0?`${a.hiddenTests} test${a.hiddenTests===1?``:`s`}`:null,a.hiddenReviewed>0?`${a.hiddenReviewed} reviewed`:null].filter(Boolean).join(`, `),` `,`hidden`]}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:a.onShowAll,children:`Show all files`})]})]});return(0,S.jsxs)(`div`,{className:`reading-pane${a?` reading-pane-barred`:``}`,ref:_,children:[a&&(0,S.jsx)(cu,{navHidden:a.navHidden,onToggleNav:a.onToggleNav,left:a.left,total:a.total,hunksRead:a.hunksRead,hunksTotal:a.hunksTotal,hunkAt:a.hunkAt,hunkCount:a.hunkCount,query:a.query,onClearQuery:a.onClearQuery,hideReviewed:a.hideReviewed,onHideReviewed:a.onHideReviewed,hideTests:a.hideTests,onHideTests:a.onHideTests,testCount:a.testCount,onlyChanged:a.onlyChanged,onOnlyChanged:a.onOnlyChanged,changedCount:a.changedCount,viewMode:a.viewMode,onSetViewMode:a.onSetViewMode,allCollapsed:a.allCollapsed,onToggleCollapseAll:a.onToggleCollapseAll,stats:a.stats,layer:a.layer}),(0,S.jsxs)(`div`,{className:`reading-col`,children:[o&&!R&&(0,S.jsx)(mu,{...o,shape:`docked`}),se,fe,ge]}),pe&&!z&&!f&&he]})}var Su=[{name:`Move`,keys:[[`j`,`Next hunk`],[`k`,`Previous hunk`],[`J`,`Next file`],[`K`,`Previous file`],[`n`,`Next unreviewed file`],[`]`,`Next layer`],[`[`,`Previous layer`],[`.`,`Next decision in this layer`],[`/`,`Filter files`]]},{name:`Read`,keys:[[`v`,`Mark this file reviewed`],[`h`,`Hide reviewed files`],[`u`,`Unified / split`],[`o`,`Collapse / expand file`],[`b`,`Show / hide the file list`]]},{name:`Comment`,keys:[[`c`,`Comment on the clicked line, else this hunk`],[`drag ↓`,`Comment on a range of lines`],[`⇧ click`,`Move the range’s edge to a line`],[`⌘↵`,`Add the comment`],[`esc`,`Close / cancel`],[`?`,`This sheet`]]}];function Cu({onClose:e}){return(0,S.jsx)(jt,{title:`Shortcuts`,onClose:e,children:(0,S.jsx)(`div`,{className:`keys`,children:Su.map(e=>(0,S.jsxs)(`div`,{className:`keys-group`,children:[(0,S.jsx)(`div`,{className:`keys-name`,children:e.name}),e.keys.map(([e,t])=>(0,S.jsxs)(`div`,{className:`keys-row`,children:[(0,S.jsx)(`span`,{className:`kbd`,children:e}),` `,t]},e))]},e.name))})})}var wu={COMMENT:`Commented`,APPROVE:`Approved`,REQUEST_CHANGES:`Changes requested`};function Tu({coverage:e,presence:t,onFinish:n,onInvite:r,onClose:i}){let a=us(),o=St(!0,e),s=(0,x.useRef)(null),[c,l]=(0,x.useState)(``),[u,d]=(0,x.useState)(`write`),[f,p]=(0,x.useState)(`COMMENT`),[m,h]=(0,x.useState)(!1),[g,_]=(0,x.useState)(!1),[v,y]=(0,x.useState)(null),[b,C]=(0,x.useState)(null),[w,T]=(0,x.useState)(!1),E=t!==`waiting`,D=o.data?.public,O=o.data?.outgoing??[],k=D?D.drafts.length+D.replies.length+D.resolves.length:0,A=a!==null&&a.state!==`open`,j=k>0||f!==`COMMENT`||c.trim()!==``||o.isError,M=()=>{j&&!m&&(_(!1),y(null),h(!0),n(!0,{note:c,event:f}).then(({delivered:e,public:t})=>{if(t?.failed){y(t.failed),o.refetch();return}C(t??{posted:0,resolved:0,submitted:!1,reviewId:null}),T(e)}).catch(()=>_(!0)).finally(()=>h(!1)))},ee=[[`COMMENT`,`Comment`,`Submit general feedback without explicit approval.`],[`APPROVE`,`Approve`,`Submit feedback and approve merging these changes.`],[`REQUEST_CHANGES`,`Request changes`,`Submit feedback suggesting changes.`]],N=A?`${a.state===`merged`?`Merged`:`Closed`} already: GitHub takes comments, not verdicts.`:D&&!D.canApprove?`Your own pull request: GitHub does not let you approve or block it.`:null;(0,x.useEffect)(()=>{f!==`COMMENT`&&N!==null&&p(`COMMENT`)},[f,N]);let P=O.length>0?`${O.length} private ${O.length===1?`thread`:`threads`} and your coverage`:`your coverage`,F=b?(0,S.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:i,children:`Done`}):(0,S.jsxs)(S.Fragment,{children:[o.data&&(0,S.jsxs)(`span`,{className:`sub-agent${E?``:` sub-agent-off`}`,children:[(0,S.jsx)(H,{name:E?`lock`:`alert`,size:`sm`}),(0,S.jsx)(`span`,{className:`sub-agent-text`,children:E?(0,S.jsxs)(S.Fragment,{children:[`Also, privately: `,P,` go to your agent`]}):(0,S.jsxs)(S.Fragment,{children:[`No agent attached: `,P,` wait for one.`,` `,(0,S.jsx)(`button`,{type:`button`,className:`fin-link`,onClick:r,children:`Invite one`})]})})]}),(0,S.jsx)(`span`,{className:`grow`}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,disabled:m,onClick:i,children:`Cancel`}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-gh${m?` btn-busy`:``}`,disabled:!j||m,"aria-busy":m,title:j?`post this review on GitHub, #${a?.number??``} (⌘↵)`:`nothing for GitHub yet: write a comment, pick a verdict, or draft a review comment`,onClick:M,children:m?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`spin`,"aria-hidden":`true`}),` Submitting to GitHub`]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(H,{name:`globe`,size:`sm`}),` Submit to GitHub `,(0,S.jsx)(`kbd`,{className:`sub-kbd`,children:`⌘↵`})]})})]});return(0,S.jsxs)(jt,{title:b?`Review submitted to GitHub`:`Submit review to GitHub`,wide:!0,className:`sub-modal`,onClose:i,footer:F,children:[a&&(0,S.jsxs)(`div`,{className:`sub-where`,children:[(0,S.jsx)(H,{name:`pr`,size:`sm`}),(0,S.jsxs)(`span`,{className:`sub-where-repo`,children:[`one review on `,a.owner,`/`,a.repo,` #`,a.number]}),(0,S.jsx)(`span`,{className:`sub-where-title`,children:a.title})]}),!b&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`sub-editor`,children:[(0,S.jsxs)(`div`,{className:`sub-editor-bar`,children:[(0,S.jsx)(`div`,{className:`cbox-tabs sub-tabs`,role:`tablist`,children:[`write`,`preview`].map(e=>(0,S.jsx)(`button`,{type:`button`,role:`tab`,className:`cbox-tab`,"aria-selected":u===e,onClick:()=>d(e),children:e===`write`?`Write`:`Preview`},e))}),u===`write`&&(0,S.jsx)(`div`,{className:`sub-tools`,children:pc.map((e,t)=>e===`sep`?(0,S.jsx)(`span`,{className:`cbox-mdsep`},t):(0,S.jsx)(`button`,{type:`button`,className:`cbox-mdb`,"data-tip":e.label,"aria-label":e.label,onClick:()=>s.current&&gc(s.current,e,l),children:(0,S.jsx)(H,{name:e.icon,size:`sm`})},t))})]}),u===`write`?(0,S.jsx)(`textarea`,{ref:s,autoFocus:!0,className:`sub-body`,placeholder:`Leave a comment`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),M())}}):c.trim()?(0,S.jsx)(uc,{className:`sub-preview markdown`,text:c}):(0,S.jsx)(`div`,{className:`sub-preview sub-preview-empty`,children:`Nothing to preview`})]}),(0,S.jsx)(`div`,{className:`sub-verdicts`,role:`radiogroup`,"aria-label":`Your verdict`,children:ee.map(([e,t,n])=>{let r=e!==`COMMENT`&&N!==null;return(0,S.jsxs)(`label`,{className:`sub-verdict${f===e?` sub-verdict-on`:``}${r?` sub-verdict-off`:``}`,children:[(0,S.jsx)(`input`,{type:`radio`,name:`verdict`,value:e,checked:f===e,disabled:r,onChange:()=>p(e)}),(0,S.jsxs)(`span`,{className:`sub-verdict-text`,children:[(0,S.jsx)(`b`,{children:t}),(0,S.jsx)(`small`,{className:r?`sub-verdict-why`:void 0,children:r?N:n})]})]},e)})}),(0,S.jsxs)(`div`,{className:`fin-sect`,children:[(0,S.jsxs)(`div`,{className:`fin-sect-h`,children:[(0,S.jsx)(`span`,{className:`fin-sect-label`,children:`Pending`}),D&&(0,S.jsx)(`span`,{className:`fin-sect-n`,children:k}),(0,S.jsx)(`span`,{className:`fin-sect-why`,children:o.isLoading?`· loading`:o.error||!D?`· could not load what is pending; the review still submits`:k>0?`· post to GitHub with this review; nothing has posted yet`:`· nothing drafted; a comment above still submits a review to GitHub`})]}),D&&k>0&&(0,S.jsxs)(`ul`,{className:`sub-pending`,children:[D.drafts.map(e=>(0,S.jsxs)(`li`,{className:`sub-pending-row`,children:[(0,S.jsxs)(`div`,{className:`sub-pending-at`,children:[(0,S.jsx)(`span`,{className:`sub-pending-kind`,children:e.conversation?`comment`:`review comment`}),(0,S.jsx)(`span`,{className:`sub-pending-anchor`,children:e.anchor}),e.fromAgent&&(0,S.jsxs)(`span`,{className:`fin-row-note sub-pending-origin`,title:`your agent wrote the first version; it posts as yours`,children:[`from your agent`,e.fromAgent.edited&&`, edited`]}),e.downgraded&&(0,S.jsx)(`span`,{className:`fin-row-note`,title:`GitHub only takes comments on lines in its diff`,children:`line not in the diff; posts on the file`})]}),(0,S.jsx)(`div`,{className:`sub-pending-text`,children:e.text})]},e.id)),D.replies.map(e=>(0,S.jsxs)(`li`,{className:`sub-pending-row`,children:[(0,S.jsxs)(`div`,{className:`sub-pending-at`,children:[(0,S.jsx)(`span`,{className:`sub-pending-kind`,children:e.count===1?`reply`:`${e.count} replies`}),(0,S.jsx)(`span`,{className:`sub-pending-anchor`,children:e.anchor})]}),(0,S.jsx)(`div`,{className:`sub-pending-text`,children:e.text})]},e.id)),D.resolves.map(e=>(0,S.jsx)(`li`,{className:`sub-pending-row`,children:(0,S.jsxs)(`div`,{className:`sub-pending-at`,children:[(0,S.jsx)(`span`,{className:`sub-pending-kind`,children:e.resolve?`resolve`:`reopen`}),(0,S.jsx)(`span`,{className:`sub-pending-anchor`,children:e.anchor})]})},e.id))]}),D&&(D.undecidedSuggestions??0)>0&&(0,S.jsx)(`p`,{className:`sub-undecided`,role:`note`,children:D.undecidedSuggestions===1?`One suggested comment from your agent is still undecided. It stays private and never posts.`:`${D.undecidedSuggestions} suggested comments from your agent are still undecided. They stay private and never post.`})]})]}),b&&(0,S.jsxs)(`div`,{className:`sub-done`,children:[(0,S.jsxs)(`div`,{className:`sub-done-card`,children:[(0,S.jsx)(`span`,{className:`sub-done-mark`,"aria-hidden":`true`,children:(0,S.jsx)(H,{name:`check`,size:`md`})}),(0,S.jsxs)(`div`,{className:`sub-done-text`,children:[(0,S.jsx)(`b`,{children:b.submitted?wu[f]:`Review finished`}),(0,S.jsx)(`span`,{className:`sub-done-detail`,children:[b.posted>0&&`${b.posted} ${b.posted===1?`comment`:`comments`} posted`,b.resolved>0&&`${b.resolved} ${b.resolved===1?`thread`:`threads`} resolved`].filter(Boolean).join(` · `)||`on #${a?.number??``}`})]}),b.url&&(0,S.jsxs)(`a`,{className:`btn btn-sm btn-outline`,href:b.url,target:`_blank`,rel:`noreferrer`,children:[`Open on GitHub `,(0,S.jsx)(H,{name:`link`,size:`sm`})]})]}),(0,S.jsxs)(`p`,{className:`sub-done-agent`,children:[(0,S.jsx)(H,{name:`lock`,size:`sm`}),w?`Private threads and coverage went to your agent.`:`Private threads and coverage go to your agent on its next poll.`]})]}),v&&(0,S.jsxs)(`div`,{className:`warn`,children:[(0,S.jsx)(H,{name:`alert`,size:`sm`}),(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`b`,{children:[`GitHub stopped at `,v.step]}),`: `,v.message,`. What posted before it is recorded and will not post twice; nothing went to your agent. Fix the cause and submit again.`]})]}),g&&(0,S.jsx)(`p`,{className:`cov-note cov-note-error`,children:`Couldn't submit; the server may be down. Nothing was sent; try again.`})]})}var Eu=/[A-Za-z_$][\w$]*/g;function Du(e,t){Eu.lastIndex=0;for(let n of e.matchAll(Eu)){let e=n.index,r=e+n[0].length;if(t<e)return null;if(t<=r)return{word:n[0],start:e,end:r}}return null}var Ou=new Set(`abstract and as assert async await begin bool boolean break case catch chan char class const continue crate debugger decimal def default defer del delete do done double dyn elif else elsif end ensure enum esac except export extends extern fallthrough false fi final finally float fn for from func function global go goto if impl implements import in include instanceof int interface internal is lambda let local long loop match mod module move mut namespace native new nil nonlocal not null of or override package pass private protected pub public raise readonly ref require rescue return satisfies sealed select self short signed sizeof static struct super switch template then this throw throws trait transient true try type typedef typename typeof undefined union unless unsigned until use using var virtual void volatile where while with yield None True False Self`.split(` `));function ku(e){return e.length>0&&!Ou.has(e)}function Au(e,t){return t===`base`?e!==`add`:e!==`del`}function ju(e){return e.replace(/[$\\]/g,`\\$&`)}function Mu(e,t,n){if(!t)return[];let r=RegExp(`(?<![\\w$])${ju(t)}(?![\\w$])`),i=[];for(let t of e){if(t.kind!==`text`)continue;let e=[];for(let i of t.hunks)for(let a of i.lines){if(!Au(a.kind,n))continue;let o=n===`base`?a.oldNo:a.newNo;if(o===null)continue;let s=r.exec(a.text);s&&e.push({path:t.path,hunkId:i.id,line:o,text:a.text,col:s.index})}e.length!==0&&(e.sort((e,t)=>e.line-t.line),i.push({path:t.path,usages:e}))}return i}function Nu(e){return e.reduce((e,t)=>e+t.usages.length,0)}var Pu=350,Fu=160,Iu=`sym-occ`;function Lu({files:e,onJump:t}){let[n,r]=(0,x.useState)(null),i=(0,x.useRef)(null),a=(0,x.useRef)(()=>{}),o=(0,x.useMemo)(()=>{let t=new Map;for(let n of e)for(let e of n.hunks)t.set(e.id,n.path);return t},[e]),s=(0,x.useRef)(o);s.current=o,(0,x.useEffect)(()=>{let e=null,t=null,n,o,c=(e,t)=>e===t||e!==null&&t!==null&&e.cell===t.cell&&e.start===t.start&&e.word===t.word,l=()=>{n!==void 0&&clearTimeout(n),o!==void 0&&clearTimeout(o),n=o=void 0},u=()=>{l(),e=null,t&&(t=null,Yu(),r(null))},d=n=>{l(),e=null,t=n,Ju(n.word,n.side),r(n)},f=r=>{if(c(r,e)||c(r,t)){o!==void 0&&(clearTimeout(o),o=void 0);return}l(),e=r,t?d(r):n=setTimeout(()=>d(r),Pu)},p=()=>{n!==void 0&&clearTimeout(n),n=void 0,e=null,t&&o===void 0&&(o=setTimeout(u,Fu))},m=e=>{let t=e.target;if(i.current&&t&&i.current.contains(t)){o!==void 0&&(clearTimeout(o),o=void 0);return}let n=t?qu(t,e.clientX,e.clientY,s.current):null;n?f(n):p()},h=e=>{e.key===`Escape`&&u()},g=e=>{i.current?.contains(e.target)||u()};return a.current=u,document.addEventListener(`mousemove`,m,!0),document.addEventListener(`mousedown`,g,!0),document.addEventListener(`scroll`,u,!0),document.addEventListener(`keydown`,h,!0),window.addEventListener(`resize`,u),window.addEventListener(`blur`,u),()=>{u(),document.removeEventListener(`mousemove`,m,!0),document.removeEventListener(`mousedown`,g,!0),document.removeEventListener(`scroll`,u,!0),document.removeEventListener(`keydown`,h,!0),window.removeEventListener(`resize`,u),window.removeEventListener(`blur`,u)}},[]);let c=(0,x.useMemo)(()=>n?Mu(e,n.word,n.side):[],[e,n]);return(0,x.useLayoutEffect)(()=>{let e=i.current;if(!e||!n)return;let t=Ku(n.cell,n.start,n.end)?.getBoundingClientRect();if(!t)return;let r=e.offsetWidth,a=e.offsetHeight,o=Math.max(8,Math.min(t.left-10,window.innerWidth-r-8)),s=t.top-a-6,c=s>=8?s:t.bottom+6;e.style.left=`${Math.round(o)}px`,e.style.top=`${Math.round(c)}px`,e.classList.add(`sym-card-on`)},[n]),n?(0,S.jsx)(`div`,{ref:i,className:`sym-card`,role:`dialog`,"aria-label":`usages of ${n.word}`,children:(0,S.jsx)(Ru,{word:n.word,side:n.side,groups:c,here:n.line===null?null:{hunkId:n.hunkId,line:n.line},onJump:e=>{a.current(),t(e)}},`${n.side}:${n.word}`)}):null}function Ru({word:e,side:t,groups:n,here:r,onJump:i}){let[a,o]=(0,x.useState)(()=>new Set),s=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),c=Nu(n),l=r?Math.max(0,c-1):c;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`sym-card-head`,children:[(0,S.jsx)(`code`,{className:`sym-card-word`,children:e}),(0,S.jsxs)(`span`,{className:`sym-card-count`,children:[l===0?`nowhere else in this change`:`${l} other ${l===1?`usage`:`usages`}`,t===`base`&&(0,S.jsx)(`span`,{className:`sym-card-side`,children:`before`})]})]}),c>0&&(0,S.jsx)(`div`,{className:`sym-card-list`,children:n.map(e=>{let n=a.has(e.path),o=r?e.usages.filter(e=>zu(e,r)).length:0;return(0,S.jsxs)(`div`,{className:`sym-card-file`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`sym-card-path`,"aria-expanded":n,title:e.path,onClick:()=>s(e.path),children:[(0,S.jsx)(H,{name:`chev`,size:`sm`}),(0,S.jsx)(Bu,{path:e.path}),(0,S.jsxs)(`span`,{className:`sym-card-n`,children:[e.usages.length-o,o>0&&(0,S.jsx)(`span`,{className:`sym-card-n-here`,children:` + here`})]})]}),n&&e.usages.map(e=>{let n=r!==null&&zu(e,r);return(0,S.jsxs)(`button`,{type:`button`,className:`sym-card-row${n?` sym-card-here`:``}`,"aria-current":n?`location`:void 0,onClick:()=>i({path:e.path,side:t,line:e.line}),children:[(0,S.jsx)(`span`,{className:`sym-card-ln`,children:e.line}),(0,S.jsx)(Hu,{usage:e})]},`${e.hunkId}:${e.line}`)})]},e.path)})})]})}function zu(e,t){return e.hunkId===t.hunkId&&e.line===t.line}function Bu({path:e}){let t=e.lastIndexOf(`/`);return t===-1?(0,S.jsx)(`span`,{className:`sym-card-name`,children:e}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`sym-card-name`,children:e.slice(t+1)}),(0,S.jsx)(`span`,{className:`sym-card-dir`,children:e.slice(0,t)})]})}var Vu=28;function Hu({usage:e}){let t=e.text,n=t.search(/\S|$/),r=!1;e.col-n>Vu&&(n=t.lastIndexOf(` `,e.col-Vu+8)+1,(n<=0||e.col-n>56)&&(n=e.col-Vu),r=!0);let i=t.slice(n,e.col),a=t.slice(e.col,e.col+Uu(t,e.col)),o=t.slice(e.col+a.length);return(0,S.jsxs)(`span`,{className:`sym-card-code`,children:[r&&(0,S.jsx)(`span`,{className:`sym-card-ellipsis`,children:`…`}),i,(0,S.jsx)(`mark`,{children:a}),o]})}function Uu(e,t){let n=Du(e,t);return n&&n.start===t?n.end-t:0}function Wu(e,t){let n=document;if(n.caretPositionFromPoint){let r=n.caretPositionFromPoint(e,t);return r?{node:r.offsetNode,offset:r.offset}:null}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);return r?{node:r.startContainer,offset:r.startOffset}:null}return null}function Gu(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let e=n.nextNode();e;e=n.nextNode())t.push(e);return t}function Ku(e,t,n){let r=document.createRange(),i=0,a=!1;for(let o of Gu(e)){let e=o.data.length;if(!a&&t<i+e&&(r.setStart(o,t-i),a=!0),a&&n<=i+e)return r.setEnd(o,n-i),r;i+=e}return null}function qu(e,t,n,r){let i=e.closest?.(`td[data-side]`);if(!(i instanceof HTMLElement)||e.closest(`.nosym`))return null;let a=Wu(t,n);if(!a||a.node.nodeType!==Node.TEXT_NODE||!i.contains(a.node))return null;let o=a.offset;for(let e of Gu(i)){if(e===a.node)break;o+=e.data.length}let s=Du(i.textContent??``,o);if(!s||!ku(s.word))return null;let c=Ku(i,s.start,s.end)?.getBoundingClientRect();if(!c||t<c.left-1||t>c.right+1||n<c.top-1||n>c.bottom+1)return null;let l=i.closest(`[data-hunk-id]`)?.getAttribute(`data-hunk-id`);if(!l)return null;let u=r.get(l);if(!u)return null;let d=i.dataset.side===`base`?`base`:`head`,f=Number(d===`base`?i.dataset.old:i.dataset.new);return{word:s.word,side:d,path:u,hunkId:l,line:Number.isFinite(f)&&f>0?f:null,cell:i,start:s.start,end:s.end}}function Ju(e,t){let n=globalThis.CSS?.highlights;if(!n||typeof Highlight>`u`)return;let r=RegExp(`(?<![\\w$])${e.replace(/[$\\]/g,`\\$&`)}(?![\\w$])`,`g`),i=new Highlight,a=window.innerHeight,o=t===`base`?`td[data-old]`:`td[data-new]`;for(let e of document.querySelectorAll(`.hunk-lines`)){let t=e.getBoundingClientRect();if(!(t.bottom<0||t.top>a))for(let t of e.querySelectorAll(o)){let e=t.textContent;if(e)for(let n of e.matchAll(r)){let e=Ku(t,n.index,n.index+n[0].length);e&&i.add(e)}}}n.set(Iu,i)}function Yu(){globalThis.CSS?.highlights?.delete(Iu)}var Xu=12e3;function Z({status:e,onShown:t,onAcknowledge:n}){let r=(0,x.useRef)(e.notice===`pending`),i=(0,x.useRef)(!1),a=e.enabled&&e.notice!==`acknowledged`;(0,x.useEffect)(()=>{a&&r.current&&!i.current&&(i.current=!0,t())},[a,t]);let[o,s]=(0,x.useState)(!1),c=(0,x.useRef)(Xu),[l,u]=(0,x.useState)(Xu);return(0,x.useEffect)(()=>{if(!a||o)return;let e,t,r=0,i=()=>Math.max(0,c.current-(Date.now()-r)),s=()=>{e===void 0&&(r=Date.now(),e=setTimeout(n,c.current),t=setInterval(()=>u(i()),250))},l=()=>{e!==void 0&&(clearTimeout(e),clearInterval(t),e=void 0,c.current=i(),u(c.current))},d=()=>document.visibilityState===`visible`?s():l();return d(),document.addEventListener(`visibilitychange`,d),()=>{l(),document.removeEventListener(`visibilitychange`,d)}},[a,o,n]),a?(0,S.jsxs)(`div`,{className:`telemetry-notice`,role:`status`,"aria-live":`polite`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onFocus:()=>s(!0),onBlur:()=>s(!1),children:[(0,S.jsx)(H,{name:`note`,size:`sm`}),(0,S.jsxs)(`p`,{className:`telemetry-notice-text`,children:[(0,S.jsx)(`strong`,{children:`Diffo sends anonymous usage data.`}),` Two small events per review, opened and finished: the version, your OS, the kind of review, which agent, and counts. Never code, paths, or comment text.`,` `,r.current?`Nothing has been sent yet, and nothing is during this review. `:``,`Turn it off any time under Settings → Privacy.`,` `,(0,S.jsx)(`a`,{href:e.docs,target:`_blank`,rel:`noreferrer`,children:`What is sent`})]}),(0,S.jsxs)(`span`,{className:`telemetry-notice-ok`,children:[(0,S.jsxs)(`svg`,{className:`telemetry-notice-ring`,viewBox:`0 0 40 40`,"aria-hidden":`true`,children:[(0,S.jsx)(`circle`,{className:`telemetry-notice-ring-track`,cx:`20`,cy:`20`,r:Q}),(0,S.jsx)(`circle`,{className:`telemetry-notice-ring-left`,cx:`20`,cy:`20`,r:Q,strokeDasharray:Zu,strokeDashoffset:Zu*(1-l/Xu)})]}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-sm telemetry-notice-ok-btn`,title:`dismiss; it closes on its own in a few seconds`,onClick:n,children:`OK`})]})]}):null}var Q=18,Zu=2*Math.PI*Q;function Qu(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function $u({item:e,current:t,onOpen:n,onResolve:r,onReopen:i,onDelete:a}){let o=e.turn===`resolved`,s=ot(e.thread),c=o?i:r,l=e.turn===`yours`||e.turn===`unanswered`,u=e.anchor??`the whole changeset`,d=e.outdated?`, outdated on GitHub: the line left the diff`:e.gone?`, this file left the changeset`:``;return(0,S.jsxs)(`div`,{className:`crow${l?` crow-hot`:``}${o?` crow-done`:``}`,"aria-current":t?`true`:void 0,"data-thread":e.thread.id,children:[s?(0,S.jsx)(`button`,{type:`button`,className:`crow-mark`,"data-tip":`Discard draft: drops it; nothing was posted`,"aria-label":`Discard draft`,disabled:!a,onClick:()=>a&&void a(e.thread.id),children:(0,S.jsx)(H,{name:`trash`,size:`sm`})}):(0,S.jsx)(`button`,{type:`button`,className:`crow-mark`,"aria-pressed":o,"data-tip":o?`Reopen: moves back to its turn`:`Resolve: moves to Settled`,"aria-label":o?`Reopen thread`:`Resolve thread`,disabled:!c,onClick:()=>c&&void c(e.thread.id),children:(0,S.jsx)(H,{name:`check`,size:`sm`})}),(0,S.jsxs)(`button`,{type:`button`,className:`crow-pick`,title:`${u}${d}`,onClick:()=>n?.(e),children:[(0,S.jsx)(`span`,{className:`crow-q`,children:e.question}),(0,S.jsxs)(`span`,{className:`crow-sub`,children:[e.turn===`note`&&at(e.thread)&&(0,S.jsx)(`span`,{className:`crow-pill`,children:`Draft`}),it(e.thread)!==null&&(0,S.jsxs)(`span`,{className:`crow-pill crow-pill-pr`,title:`your agent drafted a review comment for the author`,children:[(0,S.jsx)(H,{name:`globe`,size:`sm`}),` suggests`]}),e.thread.intent&&e.turn!==`proposed`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`crow-kind crow-kind-${e.thread.intent}`,children:vc[e.thread.intent]}),(0,S.jsx)(`span`,{className:`crow-sep`,children:`·`})]}),(0,S.jsx)(`span`,{className:`crow-where${e.gone?` crow-where-gone`:``}`,children:Qu(u)}),at(e.thread)?td(e)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`crow-sep`,children:`·`}),(0,S.jsx)(`span`,{className:`crow-state`,children:td(e)})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`crow-sep`,children:`·`}),(0,S.jsx)(`span`,{className:`crow-state crow-state-${e.turn}`,children:ed(e)})]})]})]}),(0,S.jsx)(`span`,{className:`crow-when`,children:ya(e.updatedAt)}),a&&!s&&(0,S.jsx)(`button`,{type:`button`,className:`row-act row-act-danger crow-del`,"data-tip":`Delete thread`,"aria-label":`Delete thread`,onClick:()=>void a(e.thread.id),children:(0,S.jsx)(H,{name:`trash`,size:`sm`})})]})}function ed(e){switch(e.turn){case`yours`:return e.outcome===`changed`?`changed the code, no reply`:e.answer??`answered`;case`unanswered`:return`no answer, the agent moved on`;case`proposed`:return`from the agent: reply or resolve`;case`agent`:return e.working?`agent is on it`:e.queued===void 0?`waiting on the agent`:`queued, ${Sc(e.queued)}`;case`note`:return`draft, not sent`;case`posted`:return e.answer??`on GitHub`;case`resolved`:return e.answer??`resolved`}}function td(e){let t=e.thread;if(e.turn===`note`)return null;if(st(t).length>0)return`reply pending`;if(t.queued?.resolve)return`resolves when you submit`;if(t.queued?.unresolve)return`reopens when you submit`;let n=nd(t);return e.turn===`resolved`?n?`${n} · resolved`:`resolved`:n??`on GitHub`}function nd(e){for(let t=e.messages.length-1;t>=0;t--){let n=e.messages[t];if(n.author===`github`&&n.github)return n.github.user.login}return null}var rd=new Set([`settled`]),id={github:{icon:`globe`,label:`GitHub`,empty:`No PR comments yet`},agent:{icon:`lock`,label:`Private`,empty:`Nothing asked of the agent yet`}},ad=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function od(e,t){let n=e=>t.filter(e).length;if(e===`github`){let e=n(e=>e.turn===`note`);return e>0?{text:ad(e,`draft`),hot:!1}:null}let r=n(e=>e.turn===`yours`||e.turn===`unanswered`);if(r>0)return{text:`${r} your turn`,hot:!0};let i=n(e=>e.turn===`proposed`);if(i>0)return{text:`${i} from the agent`,hot:!1};let a=n(e=>e.turn===`agent`);return a>0?{text:`${a} waiting`,hot:!1}:null}function sd({side:e,group:t,selectedThreadId:n,row:r}){let[i,a]=(0,x.useState)(!1),[o,s]=(0,x.useState)(`auto`),[c,l]=(0,x.useState)(`auto`),[u,d]=(0,x.useState)(n),f=us()?.viewer.login??null,p=id[e],m=od(e,t),h=t.filter(e=>e.turn!==`resolved`),g=t.filter(e=>e.turn===`resolved`),_=e===`github`?h.filter(e=>xs(e.thread,f)):h,v=h.filter(e=>!_.includes(e)),y=e=>e.thread.id===n;u!==n&&(d(n),o===`closed`&&v.some(y)&&s(`auto`),c===`closed`&&g.some(y)&&l(`auto`));let b=(e,t)=>e===`open`||e===`auto`&&t,C=b(o,v.some(y)),w=C?[..._,...v]:_,T=b(c,g.some(y));return(0,S.jsxs)(`section`,{className:`side side-${e}`,"aria-label":`${p.label} threads`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`side-head`,"aria-expanded":!i,onClick:()=>a(!i),children:[(0,S.jsx)(`span`,{className:`chevron${i?` chevron-shut`:``}`,children:(0,S.jsx)(H,{name:`chev`,size:`sm`})}),(0,S.jsx)(H,{name:p.icon,size:`sm`}),(0,S.jsx)(`span`,{className:`side-name`,children:p.label}),` `,(0,S.jsx)(`span`,{className:`side-n`,children:t.length}),m&&(0,S.jsxs)(S.Fragment,{children:[` `,(0,S.jsx)(`span`,{className:`side-badge${m.hot?` side-badge-hot`:``}`,children:m.text})]})]}),!i&&t.length===0&&(0,S.jsx)(`div`,{className:`side-empty`,children:p.empty}),!i&&w.map(r),!i&&(v.length>0||g.length>0)&&(0,S.jsxs)(`div`,{className:`side-tail`,children:[v.length>0&&(0,S.jsx)(`button`,{type:`button`,className:`side-more`,"aria-expanded":C,title:C?`back to the threads you are part of`:`threads on this pull request you are not part of, bots included`,onClick:()=>s(C?`closed`:`open`),children:C?`Only mine`:`${v.length} from others`}),g.length>0&&(0,S.jsxs)(`button`,{type:`button`,className:`side-more`,"aria-expanded":T,onClick:()=>l(T?`closed`:`open`),children:[g.length,` `,e===`github`?`resolved`:`settled`]})]}),!i&&T&&g.map(r)]})}function cd({items:e,pastItems:t=[],selectedThreadId:n,totalThreads:r,onOpen:i,onResolve:a,onReopen:o,onDelete:s,onClearAll:c,pr:l=!1}){let[u,d]=(0,x.useState)(rd),f=(0,x.useMemo)(()=>[...e,...t.map(e=>({...e,gone:!0}))],[e,t]),p=(0,x.useMemo)(()=>Es(f),[f]),m=(0,x.useMemo)(()=>l?Ss(f):null,[l,f]),h=(e,t)=>e===`yours`&&a?{icon:`check`,danger:!1,label:`Resolve all ${t.length}`,run:()=>t.forEach(e=>void a(e.thread.id))}:e===`settled`&&s?{icon:`trash`,danger:!0,label:`Delete all ${t.length} settled`,run:()=>t.forEach(e=>void s(e.thread.id))}:null,g=c&&(0,S.jsxs)(`button`,{type:`button`,className:`clist-clear`,onClick:c,children:[`Clear all threads`,r!==void 0&&r>0?` (${r})`:``,`…`]}),_=e=>(0,S.jsx)($u,{item:e,current:n===e.thread.id,onOpen:i,onResolve:a,onReopen:o,onDelete:s},e.thread.id);if(m)return(0,S.jsxs)(`div`,{className:`clist clist-pr`,children:[[`github`,`agent`].map(e=>(0,S.jsx)(sd,{side:e,group:m[e],selectedThreadId:n,row:_},e)),f.length>0&&g]});if(p.size===0)return(0,S.jsx)(`div`,{className:`clist`,children:(0,S.jsxs)(`div`,{className:`rail-empty`,children:[`No threads yet.`,(0,S.jsx)(`br`,{}),`Comment on any diff line to start one.`]})});let v=p.size===1&&p.has(`settled`);return(0,S.jsxs)(`div`,{className:`clist`,children:[v&&(0,S.jsxs)(`div`,{className:`clist-quiet`,children:[`Nothing needs you.`,(0,S.jsx)(`br`,{}),(0,S.jsxs)(`span`,{className:`clist-quiet-n`,children:[p.get(`settled`).length,` settled.`]})]}),[...p].map(([e,t])=>{let n=u.has(e),r=h(e,t);return(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`sec-row${r?` sec-row-hasact`:``}`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`sec-head sec-head-fold${e===`yours`?` sec-head-hot`:``}`,"aria-expanded":!n,onClick:()=>d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),children:[(0,S.jsx)(`span`,{className:`chevron${n?` chevron-shut`:``}`,children:(0,S.jsx)(H,{name:`chev`,size:`sm`})}),gs[e],` `,(0,S.jsx)(`span`,{className:`sec-n`,children:t.length})]}),r&&(0,S.jsx)(`button`,{type:`button`,className:`row-act sec-act${r.danger?` row-act-danger`:``}`,"data-tip":r.label,"aria-label":r.label,onClick:r.run,children:(0,S.jsx)(H,{name:r.icon,size:`sm`})})]}),!n&&t.map(_)]},e)}),g]})}var ld=`diffo:ui:critter`;function ud(){try{return localStorage.getItem(ld)!==`off`}catch{return!0}}function dd(e){try{e?localStorage.removeItem(ld):localStorage.setItem(ld,`off`)}catch{}}async function fd(){try{let e=await fetch(`/api/settings`);if(!e.ok)return null;let t=await e.json();return t?.critter===`on`||t?.critter!==`off`&&null}catch{return null}}function pd(){let[e,t]=(0,x.useState)(ud);return(0,x.useEffect)(()=>{let e=!1;return fd().then(n=>{e||n===null||n===ud()||(dd(n),t(n))}),()=>{e=!0}},[]),[e,(0,x.useCallback)(e=>{t(e),dd(e),fetch(`/api/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({critter:e?`on`:`off`})}).catch(()=>{})},[])]}function md(e,t){return e===`j`?`next-hunk`:e===`]`?`next-layer`:e===`[`?`prev-layer`:e===`.`?`next-decision`:e===`k`?`prev-hunk`:e===`J`||t&&e===`j`?`next-file`:e===`K`||t&&e===`k`?`prev-file`:e===`v`?`toggle-viewed`:e===`u`?`toggle-view-mode`:e===`b`?`toggle-nav`:e===`/`?`focus-search`:e===`c`?`comment`:e===`n`?`next-unreviewed`:e===`o`?`toggle-fold`:e===`h`?`hide-reviewed`:e===`?`?`shortcuts`:null}function hd(e){return e instanceof HTMLElement?e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable:!1}var gd={changedHunkIds:new Set,changedFiles:[],changed:new Set},_d=new Set,vd=e=>e.hunks.length>0;function yd(e,t,n=_d){if(!e||!t)return gd;let r=new Set(t.hunkIds),i=new Set,a=[];for(let t of e.files){if(!vd(t))continue;let e=t.hunks.filter(e=>!r.has(e.id)&&!n.has(e.id));if(e.length!==0){for(let t of e)i.add(t.id);a.push(t.path)}}return{changedHunkIds:i,changedFiles:a,changed:new Set(a)}}function bd(){let e=w(),t=V({queryKey:[`telemetry`],queryFn:async()=>{try{let e=await fetch(`/api/telemetry`);return e.ok?await e.json():null}catch{return null}},staleTime:1/0}),n=async t=>{try{let n=await fetch(`/api/telemetry`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});n.ok&&e.setQueryData([`telemetry`],await n.json())}catch{}};return{status:t.data??null,markShown:()=>void n({notice:`shown`}),acknowledge:()=>void n({notice:`acknowledged`}),setEnabled:e=>void n({enabled:e})}}var xd=`diffo:ui:theme`;function Sd(e){return e===`system`||e===`light`||e===`dark`?e:null}function Cd(){let e=localStorage.getItem(xd);return e===`light`||e===`dark`?e:`system`}function wd(e){e===`system`?localStorage.removeItem(xd):localStorage.setItem(xd,e)}function Td(e){e===`system`?document.documentElement.removeAttribute(`data-theme`):document.documentElement.setAttribute(`data-theme`,e)}async function Ed(){try{let e=await fetch(`/api/settings`);return e.ok?Sd((await e.json())?.theme):null}catch{return null}}function Dd(e){fetch(`/api/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({theme:e})}).catch(()=>{})}function Od(){let[e,t]=(0,x.useState)(Cd);return(0,x.useEffect)(()=>{let e=!1;return Ed().then(n=>{e||n===null||n===Cd()||(wd(n),Td(n),t(n))}),()=>{e=!0}},[]),[e,(0,x.useCallback)(e=>{t(e),Td(e),wd(e),Dd(e)},[])]}var kd=(e,t)=>`${e}:${t}`;function Ad(e){return e.flatMap(e=>e.messages.filter(e=>e.author===`agent`).map(t=>kd(e.id,t.id)))}function jd(e){let t=e.anchor;return t.kind===`changeset`?null:t.kind===`file`?t.path:t.kind===`layer`?`layer “${t.title}”`:`${t.path}:${t.line}`}function Md(e,t){let n=[];for(let r of e){let e=[...r.messages].reverse().find(e=>e.author===`agent`);if(!e||t.has(kd(r.id,e.id)))continue;let i=ut(r);n.push({key:kd(r.id,e.id),kind:i?r.anchor.kind===`changeset`?`guide`:`thread`:`answer`,threadId:r.id,anchor:jd(r),preview:e.text.split(`
|
|
92
|
+
`)}catch{i(e=>e.fingerprint===n?{...e,failed:new Set(e.failed).add(t.key)}:e);return}let s=a.exp.get(t.key)??Hc,c=r===`all`?{fromTop:Qc(t),fromBottom:0}:r===`down`?{...s,fromTop:s.fromTop+20}:{...s,fromBottom:s.fromBottom+20},l=tl(o,t,s),u=tl(o,t,c),d=o;if(u.top.length+u.bottom.length<=l.top.length+l.bottom.length){i(e=>e.fingerprint===n?{...e,headLines:d,failed:new Set(e.failed).add(t.key)}:e);return}i(e=>{if(e.fingerprint!==n)return e;let r=new Set(e.failed);return r.delete(t.key),{...e,headLines:d,exp:new Map(e.exp).set(t.key,c),failed:r}})},s=e=>i(t=>{if(t.fingerprint!==n)return t;let r=new Map(t.exp);r.delete(e.key);let i=new Set(t.failed);return i.delete(e.key),{...t,exp:r,failed:i}}),c=(0,x.useMemo)(()=>{let e=new Map;if(a.headLines===null)return e;for(let n of t){let t=a.exp.get(n.key);t&&e.set(n.key,tl(a.headLines,n,t))}return e},[t,a]);return{gaps:t,visible:c,controlsFor:e=>{let t=a.exp.get(e.key)??Hc;return{remaining:$c(e,t),canUp:e.below!==null,canDown:e.above!==null,expanded:t.fromTop+t.fromBottom>0,merged:c.get(e.key)?.merged??!1,failed:a.failed.has(e.key),onUp:()=>void o(e,`up`),onDown:()=>void o(e,`down`),onAll:()=>void o(e,`all`),onCollapse:()=>s(e)}}}}function bu({file:e,delta:t,sinceReview:n,handlers:r,composerOpen:i=!1,onCloseComposer:a,stub:o=null,onLoadDiff:s}){let c=e.status!==`deleted`&&e.kind===`text`,{gaps:l,visible:u,controlsFor:d}=yu(e),f=r.comments,p=f?.partition.byFile.get(e.path)??[],m=e.path.slice(e.path.lastIndexOf(`/`)+1),h=t=>t?{kind:`changeset`}:{kind:`file`,path:e.path},g=f&&(p.length>0||i)&&(0,S.jsxs)(`div`,{className:`file-threads`,children:[(0,S.jsx)(Nc,{threads:p,actions:f.actions,showContext:!0,agentConnected:f.agentConnected,workingOn:f.workingOn,queuedOn:f.queuedOn}),i&&(0,S.jsx)(_c,{title:`Comment on ${m}`,placeholder:`Leave a comment…`,scope:{label:m,canWiden:!0},agentConnected:f.agentConnected,onSubmit:(e,t,n,r)=>{r?f.actions.create(h(t),e,n,{audience:r}):f.actions.create(h(t),e,n),a?.()},onSend:(e,t,n)=>{f.actions.create(h(t),e,n).then(e=>f.actions.send(e.id)),a?.()},onCancel:()=>a?.()})]});if(o!==null)return(0,S.jsxs)(S.Fragment,{children:[g,(0,S.jsxs)(`div`,{className:`file-stub file-stub-large`,children:[(0,S.jsx)(`span`,{children:o===`generated`?`Generated file, not rendered by default.`:`Large diff (${Bc(e)} changed lines), not rendered by default.`}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:s,children:`Load diff`})]})]});if(e.kind===`image`&&e.hunks.length===0)return(0,S.jsxs)(S.Fragment,{children:[g,(0,S.jsx)(au,{file:e})]});if(e.kind===`binary`)return(0,S.jsxs)(S.Fragment,{children:[g,(0,S.jsx)(`div`,{className:`file-stub`,children:`binary file changed`})]});if(e.hunks.length===0)return(0,S.jsxs)(S.Fragment,{children:[g,(0,S.jsx)(`div`,{className:`file-stub`,children:e.status===`renamed`?`renamed, no content changes`:`no content changes`})]});let _=mo(e,r.viewed),v=new Map,y=new Map;for(let e of l)e.below!==null&&v.set(e.below,e),e.above!==null&&y.set(e.above,e);let b=l.find(e=>e.below===null);return(0,S.jsxs)(S.Fragment,{children:[g,e.kind===`image`&&(0,S.jsx)(au,{file:e}),e.hunks.map((e,i)=>{let a=c?v.get(i):void 0,o=c?y.get(i):void 0;return(0,S.jsx)(ru,{hunk:e,fresh:t.freshHunkIds.has(e.id),changedSinceReview:n?.has(e.id)??!1,changedSinceViewed:t.changedViewedHunkIds.has(e.id),viewed:_,selected:r.selectedId===e.id,onSelect:r.onSelect,viewMode:r.viewMode??`unified`,linesAbove:a&&u.get(a.key)?.bottom,linesBelow:o&&u.get(o.key)?.top,gapAbove:a?d(a):null,threads:f?.partition.byHunk.get(e.id),reviewActions:f?.actions,agentConnected:f?.agentConnected,workingOn:f?.workingOn,queuedOn:f?.queuedOn,composeRequested:f?.composeHunkId===e.id,onComposeHandled:f?.onComposeHandled},e.id)}),c&&b&&(0,S.jsx)(Kl,{gap:d(b)})]})}function xu({files:e,delta:t=nl,sinceReview:n,hasMore:r=!1,onLoadMore:i,controls:a,landed:o,layer:s,overview:c=!1,...l}){let[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(!1),[m,h]=(0,x.useState)(new Set),g=l.selectedId;(0,x.useEffect)(()=>{if(!g)return;let t=e.find(e=>e.hunks.some(e=>e.id===g));t&&Vc(t)!==null&&h(e=>e.has(t.path)?e:new Set(e).add(t.path))},[g,e]);let _=(0,x.useRef)(null),v=(0,x.useRef)(null);(0,x.useEffect)(()=>{if(!r||!i)return;if(typeof IntersectionObserver>`u`){i();return}let e=v.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&i()},{root:_.current,rootMargin:`1200px 0px`});return t.observe(e),()=>t.disconnect()},[r,i,e.length]);let y=(0,x.useRef)({files:e,controls:a,viewed:l.viewed});y.current={files:e,controls:a,viewed:l.viewed};let b=(0,x.useRef)(0);(0,x.useEffect)(()=>{let e=_.current;if(!e)return;let t=0,n=()=>{t=0;let{files:n,controls:r,viewed:i}=y.current;if(!r?.hideReviewed||r.pinned.size===0)return;let a=(e.querySelector(`.pane-bar`)??e).getBoundingClientRect().bottom;for(let e of n){if(!r.pinned.has(e.path)||!mo(e,i))continue;let t=document.getElementById(Ro(e.path));if(!t)continue;let n=t.getBoundingClientRect();n.bottom>=a||(b.current+=n.height+(parseFloat(getComputedStyle(t).marginBottom)||0),r.onSweep(e.path))}},r=()=>{t!==0&&cancelAnimationFrame(t),t=requestAnimationFrame(n)};return e.addEventListener(`scroll`,r,{passive:!0}),()=>{e.removeEventListener(`scroll`,r),t!==0&&cancelAnimationFrame(t)}},[]),(0,x.useLayoutEffect)(()=>{let e=_.current;e&&b.current!==0&&(e.scrollTop-=b.current,b.current=0)});let C=l.comments?.composeFilePath??null;(0,x.useEffect)(()=>{C&&(l.collapsed?.has(C)&&l.onToggleCollapsed?.(C),d(C),l.comments?.onComposeFileHandled?.())},[C]);let[w,T]=(0,x.useState)(null),E=w??s===void 0,D=T,O=l.comments,k=O?.revealNotesTick??0;(0,x.useEffect)(()=>{k>0&&D(!0)},[k]);let A=c||E||O?.changesetComposerOpen===!0,j=c||s===void 0,[M,ee]=(0,x.useState)(!1),N=O?.revealPastTick??0;(0,x.useEffect)(()=>{N>0&&ee(!0)},[N]);let P=us(),F=O?.partition.changeset.length??0,te=P?.viewer.login??null,ne=O?.partition.changeset,{lead:re,others:I}=(0,x.useMemo)(()=>{let e=ne??[];if(!P)return{lead:e,others:[]};let t=e=>e.github?.kind===`description`||!at(e)||xs(e,te);return{lead:e.filter(t),others:e.filter(e=>!t(e))}},[ne,P,te]),[ie,ae]=(0,x.useState)(!1),oe=O?.revealThreadId??null;(0,x.useEffect)(()=>{k>0&&oe!==null&&I.some(e=>e.id===oe)&&ae(!0)},[k,oe,I]);let se=O&&j&&(F>0||O.changesetComposerOpen||c)&&(0,S.jsxs)(`section`,{className:`changeset-strip`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`strip-head`,onClick:()=>D(!E),"aria-expanded":A,children:[(0,S.jsx)(`span`,{className:`file-chevron chevron${A?``:` chevron-shut`}`,children:(0,S.jsx)(H,{name:`chev`})}),P?`On the pull request`:`On the changeset`,(0,S.jsx)(`span`,{className:`strip-n`,children:F})]}),A&&(0,S.jsxs)(`div`,{className:`strip-body`,children:[(0,S.jsx)(Nc,{threads:re,actions:O.actions,showContext:!0,agentConnected:O.agentConnected,workingOn:O.workingOn,queuedOn:O.queuedOn,links:O.links}),I.length>0&&(0,S.jsx)(`button`,{type:`button`,className:`strip-more`,"aria-expanded":ie,onClick:()=>ae(!ie),children:ie?`Only mine`:`${I.length} more from others`}),ie&&I.length>0&&(0,S.jsx)(Nc,{threads:I,actions:O.actions,showContext:!0,agentConnected:O.agentConnected,workingOn:O.workingOn,queuedOn:O.queuedOn,links:O.links}),O.changesetComposerOpen?(0,S.jsx)(_c,{title:`Note on the whole changeset`,placeholder:`Leave a note…`,scope:{label:`the whole changeset`,canWiden:!1},agentConnected:O.agentConnected,onSubmit:(e,t,n,r)=>{r?O.actions.create({kind:`changeset`},e,n,{audience:r}):O.actions.create({kind:`changeset`},e,n),O.onCloseChangesetComposer?.()},onSend:(e,t,n)=>{O.actions.create({kind:`changeset`},e,n).then(e=>O.actions.send(e.id)),O.onCloseChangesetComposer?.()},onCancel:()=>O.onCloseChangesetComposer?.()}):O.onOpenChangesetComposer&&(0,S.jsx)(`button`,{type:`button`,className:`strip-add`,onClick:O.onOpenChangesetComposer,children:P?`+ Comment on the pull request`:`+ Note on the changeset`})]})]}),ce=O?.past??[],le=ce.filter(e=>e.github?.outdated===!0).length,ue=ce.filter(e=>e.anchor.kind===`layer`).length,de=ue===ce.length?`The layer ${ce.length===1?`this hangs`:`these hang`} off left the outline: the agent re-posted without ${ce.length===1?`its`:`their`} title.`:le===ce.length?`${ce.length===1?`This one is`:`These are`} outdated on GitHub: the line ${ce.length===1?`it hangs`:`they hang`} off left the diff, though the file is still in it.`:le>0?`The file or change these hang off is no longer in the diff: reverted, deleted, or stashed; ${le} ${le===1?`is`:`are`} outdated on GitHub instead, the line left the diff.`:`The file or change these hang off is no longer in the diff: reverted, deleted, or stashed.`,fe=O&&ce.length>0&&(0,S.jsxs)(`section`,{className:`file-section past-threads`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`file-header notes-header`,onClick:()=>ee(e=>!e),"aria-expanded":M,children:[(0,S.jsx)(`span`,{className:`file-chevron chevron${M?``:` chevron-shut`}`,children:(0,S.jsx)(H,{name:`chev`})}),(0,S.jsxs)(`span`,{className:`file-path`,children:[ce.length===1?`1 thread`:`${ce.length} threads`,` whose`,` `,ue===ce.length?`layer left the outline`:`code left the changeset`]})]}),M&&(0,S.jsxs)(`div`,{className:`file-threads`,children:[(0,S.jsxs)(`div`,{className:`past-hint`,children:[de,` The conversation is intact`,ue===ce.length?`.`:`, and the snapshot inside each one is the code you commented on.`]}),(0,S.jsx)(Nc,{threads:ce,actions:O.actions,showContext:!0,gone:!0,agentConnected:O.agentConnected,workingOn:O.workingOn,queuedOn:O.queuedOn})]})]}),L=a?.total??0,R=e.length===0&&L===0,z=e.length===0&&L>0,pe=a!==void 0&&a.scopeTotal>0&&a.scopeLeft===0;(0,x.useEffect)(()=>{pe&&p(!1)},[pe]);let me=(a?.hiddenTests??0)+(a?.hiddenReviewed??0)+(a?.hiddenUnchanged??0)+(a?.hiddenQuery??0),he=a&&(0,S.jsx)(du,{read:a.total-a.left,total:a.total,excludedTests:a.excludedTests,excludedUnchanged:a.excludedUnchanged,stats:a.stats,unsent:a.unsent,onFinish:a.onFinish,onIncludeExcluded:a.onIncludeExcluded,onDismiss:()=>p(!0),shape:z?`full`:`docked`}),ge=c?null:R?o?(0,S.jsx)(mu,{...o,shape:`full`}):(0,S.jsxs)(`div`,{className:`empty-state`,children:[(0,S.jsx)(H,{name:`book`,size:`lg`}),(0,S.jsx)(`h2`,{children:`Nothing to review`}),(0,S.jsx)(`p`,{children:`The working tree is clean. Diffo is watching; start your agent and changes appear here as they land.`})]}):s&&e.length===0?(0,S.jsx)(hu,{layer:s,filesShown:0,comments:O}):z&&pe?he:z&&a?(0,S.jsxs)(`div`,{className:`empty-state`,children:[(0,S.jsx)(H,{name:`filter`,size:`lg`}),(0,S.jsxs)(`h2`,{children:[a.left,` `,a.left===1?`file`:`files`,` still to review`]}),(0,S.jsx)(`p`,{children:a.hiddenQuery===0?`They're hidden by the switches on the bar above.`:a.hiddenTests+a.hiddenReviewed+a.hiddenUnchanged===0?`None of them match “${a.query.trim()}”.`:`They're hidden by “${a.query.trim()}” and the switches on the bar above.`}),(0,S.jsx)(`div`,{className:`empty-acts`,children:(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:a.onShowAll,children:`Show all files`})})]}):(0,S.jsxs)(S.Fragment,{children:[s&&(0,S.jsx)(hu,{layer:s,filesShown:e.length,comments:O}),e.map(e=>{let r=l.collapsed?.has(e.path)??!1,i=O?.partition.byFile.get(e.path)?.length??0,a=O===void 0?0:e.hunks.reduce((e,t)=>e+(O.partition.byHunk.get(t.id)?.length??0),0),o=g!=null&&e.hunks.some(e=>e.id===g),c=m.has(e.path)||o||a>0?null:Vc(e),f=n===void 0?0:e.hunks.reduce((e,t)=>e+ +!!n.has(t.id),0);return(0,S.jsxs)(`section`,{id:Ro(e.path),className:`file-section${r?` file-section-collapsed`:``}`,children:[(0,S.jsx)(_u,{file:e,viewed:l.viewed,collapsed:r,onToggle:()=>l.onToggleCollapsed?.(e.path),commentCount:i+a,sinceCount:f,note:s?.notes.get(e.path),onToggleFileViewed:l.onToggleFileViewed?()=>l.onToggleFileViewed(e.path):void 0,onComment:O?()=>{r&&l.onToggleCollapsed?.(e.path),d(t=>t===e.path?null:e.path)}:void 0}),!r&&(0,S.jsx)(bu,{file:e,delta:t,sinceReview:n,handlers:l,composerOpen:u===e.path,onCloseComposer:()=>d(null),stub:c,onLoadDiff:()=>h(t=>new Set(t).add(e.path))})]},e.path)}),r&&(0,S.jsxs)(`div`,{ref:v,className:`load-more`,"aria-hidden":`true`,children:[(0,S.jsx)(`div`,{className:`shimmer`}),(0,S.jsx)(`div`,{className:`shimmer shimmer-short`})]}),a&&me>0&&(0,S.jsxs)(`div`,{className:`pane-hidden`,children:[(0,S.jsxs)(`span`,{className:`pane-hidden-said`,children:[(0,S.jsx)(H,{name:`eye-off`,size:`sm`}),[a.hiddenQuery>0?`${a.hiddenQuery} not matching “${a.query.trim()}”`:null,a.hiddenUnchanged>0?`${a.hiddenUnchanged} unchanged`:null,a.hiddenTests>0?`${a.hiddenTests} test${a.hiddenTests===1?``:`s`}`:null,a.hiddenReviewed>0?`${a.hiddenReviewed} reviewed`:null].filter(Boolean).join(`, `),` `,`hidden`]}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:a.onShowAll,children:`Show all files`})]})]});return(0,S.jsxs)(`div`,{className:`reading-pane${a?` reading-pane-barred`:``}`,ref:_,children:[a&&(0,S.jsx)(cu,{navHidden:a.navHidden,onToggleNav:a.onToggleNav,left:a.left,total:a.total,hunksRead:a.hunksRead,hunksTotal:a.hunksTotal,hunkAt:a.hunkAt,hunkCount:a.hunkCount,query:a.query,onClearQuery:a.onClearQuery,hideReviewed:a.hideReviewed,onHideReviewed:a.onHideReviewed,hideTests:a.hideTests,onHideTests:a.onHideTests,testCount:a.testCount,onlyChanged:a.onlyChanged,onOnlyChanged:a.onOnlyChanged,changedCount:a.changedCount,viewMode:a.viewMode,onSetViewMode:a.onSetViewMode,allCollapsed:a.allCollapsed,onToggleCollapseAll:a.onToggleCollapseAll,stats:a.stats,layer:a.layer}),(0,S.jsxs)(`div`,{className:`reading-col`,children:[o&&!R&&(0,S.jsx)(mu,{...o,shape:`docked`}),se,fe,ge]}),pe&&!z&&!f&&he]})}var Su=[{name:`Move`,keys:[[`j`,`Next hunk`],[`k`,`Previous hunk`],[`J`,`Next file`],[`K`,`Previous file`],[`n`,`Next unreviewed file`],[`]`,`Next layer`],[`[`,`Previous layer`],[`.`,`Next decision in this layer`],[`/`,`Filter files`]]},{name:`Read`,keys:[[`v`,`Mark this file reviewed`],[`h`,`Hide reviewed files`],[`u`,`Unified / split`],[`o`,`Collapse / expand file`],[`b`,`Show / hide the file list`]]},{name:`Comment`,keys:[[`c`,`Comment on the clicked line, else this hunk`],[`drag ↓`,`Comment on a range of lines`],[`⇧ click`,`Move the range’s edge to a line`],[`⌘↵`,`Add the comment`],[`esc`,`Close / cancel`],[`?`,`This sheet`]]}];function Cu({onClose:e}){return(0,S.jsx)(jt,{title:`Shortcuts`,onClose:e,children:(0,S.jsx)(`div`,{className:`keys`,children:Su.map(e=>(0,S.jsxs)(`div`,{className:`keys-group`,children:[(0,S.jsx)(`div`,{className:`keys-name`,children:e.name}),e.keys.map(([e,t])=>(0,S.jsxs)(`div`,{className:`keys-row`,children:[(0,S.jsx)(`span`,{className:`kbd`,children:e}),` `,t]},e))]},e.name))})})}var wu={COMMENT:`Commented`,APPROVE:`Approved`,REQUEST_CHANGES:`Changes requested`};function Tu({coverage:e,presence:t,onFinish:n,onInvite:r,onClose:i}){let a=us(),o=St(!0,e),s=(0,x.useRef)(null),[c,l]=(0,x.useState)(``),[u,d]=(0,x.useState)(`write`),[f,p]=(0,x.useState)(`COMMENT`),[m,h]=(0,x.useState)(!1),[g,_]=(0,x.useState)(!1),[v,y]=(0,x.useState)(null),[b,C]=(0,x.useState)(null),[w,T]=(0,x.useState)(!1),E=t!==`waiting`,D=o.data?.public,O=o.data?.outgoing??[],k=D?D.drafts.length+D.replies.length+D.resolves.length:0,A=a!==null&&a.state!==`open`,j=k>0||f!==`COMMENT`||c.trim()!==``||o.isError,M=()=>{j&&!m&&(_(!1),y(null),h(!0),n(!0,{note:c,event:f}).then(({delivered:e,public:t})=>{if(t?.failed){y(t.failed),o.refetch();return}C(t??{posted:0,resolved:0,submitted:!1,reviewId:null}),T(e)}).catch(()=>_(!0)).finally(()=>h(!1)))},ee=[[`COMMENT`,`Comment`,`Submit general feedback without explicit approval.`],[`APPROVE`,`Approve`,`Submit feedback and approve merging these changes.`],[`REQUEST_CHANGES`,`Request changes`,`Submit feedback suggesting changes.`]],N=A?`${a.state===`merged`?`Merged`:`Closed`} already: GitHub takes comments, not verdicts.`:D&&!D.canApprove?`Your own pull request: GitHub does not let you approve or block it.`:null;(0,x.useEffect)(()=>{f!==`COMMENT`&&N!==null&&p(`COMMENT`)},[f,N]);let P=O.length>0?`${O.length} private ${O.length===1?`thread`:`threads`} and your coverage`:`your coverage`,F=b?(0,S.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:i,children:`Done`}):(0,S.jsxs)(S.Fragment,{children:[o.data&&(0,S.jsxs)(`span`,{className:`sub-agent${E?``:` sub-agent-off`}`,children:[(0,S.jsx)(H,{name:E?`lock`:`alert`,size:`sm`}),(0,S.jsx)(`span`,{className:`sub-agent-text`,children:E?(0,S.jsxs)(S.Fragment,{children:[`Also, privately: `,P,` go to your agent`]}):(0,S.jsxs)(S.Fragment,{children:[`No agent attached: `,P,` wait for one.`,` `,(0,S.jsx)(`button`,{type:`button`,className:`fin-link`,onClick:r,children:`Invite one`})]})})]}),(0,S.jsx)(`span`,{className:`grow`}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,disabled:m,onClick:i,children:`Cancel`}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-gh${m?` btn-busy`:``}`,disabled:!j||m,"aria-busy":m,title:j?`post this review on GitHub, #${a?.number??``} (⌘↵)`:`nothing for GitHub yet: write a comment, pick a verdict, or draft a review comment`,onClick:M,children:m?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`spin`,"aria-hidden":`true`}),` Submitting to GitHub`]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(H,{name:`globe`,size:`sm`}),` Submit to GitHub `,(0,S.jsx)(`kbd`,{className:`sub-kbd`,children:`⌘↵`})]})})]});return(0,S.jsxs)(jt,{title:b?`Review submitted to GitHub`:`Submit review to GitHub`,wide:!0,className:`sub-modal`,onClose:i,footer:F,children:[a&&(0,S.jsxs)(`div`,{className:`sub-where`,children:[(0,S.jsx)(H,{name:`pr`,size:`sm`}),(0,S.jsxs)(`span`,{className:`sub-where-repo`,children:[`one review on `,a.owner,`/`,a.repo,` #`,a.number]}),(0,S.jsx)(`span`,{className:`sub-where-title`,children:a.title})]}),!b&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`sub-editor`,children:[(0,S.jsxs)(`div`,{className:`sub-editor-bar`,children:[(0,S.jsx)(`div`,{className:`cbox-tabs sub-tabs`,role:`tablist`,children:[`write`,`preview`].map(e=>(0,S.jsx)(`button`,{type:`button`,role:`tab`,className:`cbox-tab`,"aria-selected":u===e,onClick:()=>d(e),children:e===`write`?`Write`:`Preview`},e))}),u===`write`&&(0,S.jsx)(`div`,{className:`sub-tools`,children:pc.map((e,t)=>e===`sep`?(0,S.jsx)(`span`,{className:`cbox-mdsep`},t):(0,S.jsx)(`button`,{type:`button`,className:`cbox-mdb`,"data-tip":e.label,"aria-label":e.label,onClick:()=>s.current&&gc(s.current,e,l),children:(0,S.jsx)(H,{name:e.icon,size:`sm`})},t))})]}),u===`write`?(0,S.jsx)(`textarea`,{ref:s,autoFocus:!0,className:`sub-body`,placeholder:`Leave a comment`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),M())}}):c.trim()?(0,S.jsx)(uc,{className:`sub-preview markdown`,text:c}):(0,S.jsx)(`div`,{className:`sub-preview sub-preview-empty`,children:`Nothing to preview`})]}),(0,S.jsx)(`div`,{className:`sub-verdicts`,role:`radiogroup`,"aria-label":`Your verdict`,children:ee.map(([e,t,n])=>{let r=e!==`COMMENT`&&N!==null;return(0,S.jsxs)(`label`,{className:`sub-verdict${f===e?` sub-verdict-on`:``}${r?` sub-verdict-off`:``}`,children:[(0,S.jsx)(`input`,{type:`radio`,name:`verdict`,value:e,checked:f===e,disabled:r,onChange:()=>p(e)}),(0,S.jsxs)(`span`,{className:`sub-verdict-text`,children:[(0,S.jsx)(`b`,{children:t}),(0,S.jsx)(`small`,{className:r?`sub-verdict-why`:void 0,children:r?N:n})]})]},e)})}),(0,S.jsxs)(`div`,{className:`fin-sect`,children:[(0,S.jsxs)(`div`,{className:`fin-sect-h`,children:[(0,S.jsx)(`span`,{className:`fin-sect-label`,children:`Pending`}),D&&(0,S.jsx)(`span`,{className:`fin-sect-n`,children:k}),(0,S.jsx)(`span`,{className:`fin-sect-why`,children:o.isLoading?`· loading`:o.error||!D?`· could not load what is pending; the review still submits`:k>0?`· post to GitHub with this review; nothing has posted yet`:`· nothing drafted; a comment above still submits a review to GitHub`})]}),D&&k>0&&(0,S.jsxs)(`ul`,{className:`sub-pending`,children:[D.drafts.map(e=>(0,S.jsxs)(`li`,{className:`sub-pending-row`,children:[(0,S.jsxs)(`div`,{className:`sub-pending-at`,children:[(0,S.jsx)(`span`,{className:`sub-pending-kind`,children:e.conversation?`comment`:`review comment`}),(0,S.jsx)(`span`,{className:`sub-pending-anchor`,children:e.anchor}),e.fromAgent&&(0,S.jsxs)(`span`,{className:`fin-row-note sub-pending-origin`,title:`your agent wrote the first version; it posts as yours`,children:[`from your agent`,e.fromAgent.edited&&`, edited`]}),e.downgraded&&(0,S.jsx)(`span`,{className:`fin-row-note`,title:`GitHub only takes comments on lines in its diff`,children:`line not in the diff; posts on the file`})]}),(0,S.jsx)(`div`,{className:`sub-pending-text`,children:e.text})]},e.id)),D.replies.map(e=>(0,S.jsxs)(`li`,{className:`sub-pending-row`,children:[(0,S.jsxs)(`div`,{className:`sub-pending-at`,children:[(0,S.jsx)(`span`,{className:`sub-pending-kind`,children:e.count===1?`reply`:`${e.count} replies`}),(0,S.jsx)(`span`,{className:`sub-pending-anchor`,children:e.anchor})]}),(0,S.jsx)(`div`,{className:`sub-pending-text`,children:e.text})]},e.id)),D.resolves.map(e=>(0,S.jsx)(`li`,{className:`sub-pending-row`,children:(0,S.jsxs)(`div`,{className:`sub-pending-at`,children:[(0,S.jsx)(`span`,{className:`sub-pending-kind`,children:e.resolve?`resolve`:`reopen`}),(0,S.jsx)(`span`,{className:`sub-pending-anchor`,children:e.anchor})]})},e.id))]}),D&&(D.undecidedSuggestions??0)>0&&(0,S.jsx)(`p`,{className:`sub-undecided`,role:`note`,children:D.undecidedSuggestions===1?`One suggested comment from your agent is still undecided. It stays private and never posts.`:`${D.undecidedSuggestions} suggested comments from your agent are still undecided. They stay private and never post.`})]})]}),b&&(0,S.jsxs)(`div`,{className:`sub-done`,children:[(0,S.jsxs)(`div`,{className:`sub-done-card`,children:[(0,S.jsx)(`span`,{className:`sub-done-mark`,"aria-hidden":`true`,children:(0,S.jsx)(H,{name:`check`,size:`md`})}),(0,S.jsxs)(`div`,{className:`sub-done-text`,children:[(0,S.jsx)(`b`,{children:b.submitted?wu[f]:`Review finished`}),(0,S.jsx)(`span`,{className:`sub-done-detail`,children:[b.posted>0&&`${b.posted} ${b.posted===1?`comment`:`comments`} posted`,b.resolved>0&&`${b.resolved} ${b.resolved===1?`thread`:`threads`} resolved`].filter(Boolean).join(` · `)||`on #${a?.number??``}`})]}),b.url&&(0,S.jsxs)(`a`,{className:`btn btn-sm btn-outline`,href:b.url,target:`_blank`,rel:`noreferrer`,children:[`Open on GitHub `,(0,S.jsx)(H,{name:`link`,size:`sm`})]})]}),(0,S.jsxs)(`p`,{className:`sub-done-agent`,children:[(0,S.jsx)(H,{name:`lock`,size:`sm`}),w?`Private threads and coverage went to your agent.`:`Private threads and coverage go to your agent on its next poll.`]})]}),v&&(0,S.jsxs)(`div`,{className:`warn`,children:[(0,S.jsx)(H,{name:`alert`,size:`sm`}),(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`b`,{children:[`GitHub stopped at `,v.step]}),`: `,v.message,`. What posted before it is recorded and will not post twice; nothing went to your agent. Fix the cause and submit again.`]})]}),g&&(0,S.jsx)(`p`,{className:`cov-note cov-note-error`,children:`Couldn't submit; the server may be down. Nothing was sent; try again.`})]})}var Eu={showDelay:600,leaveGrace:500},Du=class{hooks;timing;armed=null;shown=null;showTimer;hideTimer;constructor(e,t=Eu){this.hooks=e,this.timing=t}over(e){if(this.shown&&this.hooks.same(e,this.shown)){this.cancelHide();return}this.armed&&this.hooks.same(e,this.armed)||(this.shown&&this.leave(),this.cancelShow(),this.armed=e,this.showTimer=setTimeout(()=>{this.showTimer=void 0,this.armed=null,this.shown=e,this.hooks.show(e)},this.timing.showDelay))}inCard(){this.cancelHide(),this.cancelShow()}away(){this.cancelShow(),this.leave()}dismiss(){this.cancelShow(),this.cancelHide(),this.close()}get isShown(){return this.shown!==null}leave(){this.shown&&this.hideTimer===void 0&&(this.hideTimer=setTimeout(()=>{this.hideTimer=void 0,this.close()},this.timing.leaveGrace))}close(){this.shown&&(this.shown=null,this.hooks.hide())}cancelShow(){this.showTimer!==void 0&&clearTimeout(this.showTimer),this.showTimer=void 0,this.armed=null}cancelHide(){this.hideTimer!==void 0&&clearTimeout(this.hideTimer),this.hideTimer=void 0}},Ou=/[A-Za-z_$][\w$]*/g;function ku(e,t){Ou.lastIndex=0;for(let n of e.matchAll(Ou)){let e=n.index,r=e+n[0].length;if(t<e)return null;if(t<=r)return{word:n[0],start:e,end:r}}return null}var Au=new Set(`abstract and as assert async await begin bool boolean break case catch chan char class const continue crate debugger decimal def default defer del delete do done double dyn elif else elsif end ensure enum esac except export extends extern fallthrough false fi final finally float fn for from func function global go goto if impl implements import in include instanceof int interface internal is lambda let local long loop match mod module move mut namespace native new nil nonlocal not null of or override package pass private protected pub public raise readonly ref require rescue return satisfies sealed select self short signed sizeof static struct super switch template then this throw throws trait transient true try type typedef typename typeof undefined union unless unsigned until use using var virtual void volatile where while with yield None True False Self`.split(` `));function ju(e){return e.length>0&&!Au.has(e)}function Mu(e,t){return t===`base`?e!==`add`:e!==`del`}function Nu(e){return e.replace(/[$\\]/g,`\\$&`)}function Pu(e,t,n){if(!t)return[];let r=RegExp(`(?<![\\w$])${Nu(t)}(?![\\w$])`),i=[];for(let t of e){if(t.kind!==`text`)continue;let e=[];for(let i of t.hunks)for(let a of i.lines){if(!Mu(a.kind,n))continue;let o=n===`base`?a.oldNo:a.newNo;if(o===null)continue;let s=r.exec(a.text);s&&e.push({path:t.path,hunkId:i.id,line:o,text:a.text,col:s.index})}e.length!==0&&(e.sort((e,t)=>e.line-t.line),i.push({path:t.path,usages:e}))}return i}function Fu(e){return e.reduce((e,t)=>e+t.usages.length,0)}var Iu=`sym-occ`;function Lu({files:e,onJump:t}){let[n,r]=(0,x.useState)(null),i=(0,x.useRef)(null),a=(0,x.useRef)(()=>{}),o=(0,x.useMemo)(()=>{let t=new Map;for(let n of e)for(let e of n.hunks)t.set(e.id,n.path);return t},[e]),s=(0,x.useRef)(o);s.current=o,(0,x.useEffect)(()=>{let e=new Du({same:(e,t)=>e.cell===t.cell&&e.start===t.start&&e.word===t.word,show:e=>{Ju(e.word,e.side),r(e)},hide:()=>{Yu(),r(null)}}),t=e=>i.current!==null&&e instanceof Node&&i.current.contains(e),n=n=>{if(t(n.target)){e.inCard();return}let r=n.target instanceof Element?n.target:null,i=r?qu(r,n.clientX,n.clientY,s.current):null;i?e.over(i):e.away()},o=()=>e.dismiss(),c=e=>{e.key===`Escape`&&o()},l=e=>{t(e.target)||o()},u=e=>{t(e.target)||o()};return a.current=o,document.addEventListener(`mousemove`,n,!0),document.addEventListener(`mousedown`,l,!0),document.addEventListener(`scroll`,u,!0),document.addEventListener(`keydown`,c,!0),window.addEventListener(`resize`,o),window.addEventListener(`blur`,o),()=>{o(),document.removeEventListener(`mousemove`,n,!0),document.removeEventListener(`mousedown`,l,!0),document.removeEventListener(`scroll`,u,!0),document.removeEventListener(`keydown`,c,!0),window.removeEventListener(`resize`,o),window.removeEventListener(`blur`,o)}},[]);let c=(0,x.useMemo)(()=>n?Pu(e,n.word,n.side):[],[e,n]);return(0,x.useLayoutEffect)(()=>{let e=i.current;if(!e||!n)return;let t=Ku(n.cell,n.start,n.end)?.getBoundingClientRect();if(!t)return;let r=e.offsetWidth,a=e.offsetHeight,o=Math.max(8,Math.min(t.left-10,window.innerWidth-r-8)),s=t.top-a-4,c=s>=8?s:Math.min(t.bottom+4,window.innerHeight-a-8);e.style.left=`${Math.round(o)}px`,e.style.top=`${Math.round(c)}px`,e.dataset.place=s>=8?`above`:`below`,e.classList.add(`sym-card-on`)},[n]),n?(0,S.jsx)(`div`,{ref:i,className:`sym-card`,role:`dialog`,"aria-label":`usages of ${n.word}`,children:(0,S.jsx)(Ru,{word:n.word,side:n.side,groups:c,here:n.line===null?null:{hunkId:n.hunkId,line:n.line},onJump:e=>{a.current(),t(e)}},`${n.side}:${n.word}`)}):null}function Ru({word:e,side:t,groups:n,here:r,onJump:i}){let[a,o]=(0,x.useState)(()=>new Set),s=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),c=Fu(n),l=r?Math.max(0,c-1):c;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`sym-card-head`,children:[(0,S.jsx)(`code`,{className:`sym-card-word`,children:e}),(0,S.jsxs)(`span`,{className:`sym-card-count`,children:[l===0?`nowhere else in this change`:`${l} other ${l===1?`usage`:`usages`}`,t===`base`&&(0,S.jsx)(`span`,{className:`sym-card-side`,children:`before`})]})]}),c>0&&(0,S.jsx)(`div`,{className:`sym-card-list`,children:n.map(e=>{let n=a.has(e.path),o=r?e.usages.filter(e=>zu(e,r)).length:0;return(0,S.jsxs)(`div`,{className:`sym-card-file`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`sym-card-path`,"aria-expanded":n,title:e.path,onClick:()=>s(e.path),children:[(0,S.jsx)(H,{name:`chev`,size:`sm`}),(0,S.jsx)(Bu,{path:e.path}),(0,S.jsxs)(`span`,{className:`sym-card-n`,children:[e.usages.length-o,o>0&&(0,S.jsx)(`span`,{className:`sym-card-n-here`,children:` + here`})]})]}),n&&e.usages.map(e=>{let n=r!==null&&zu(e,r);return(0,S.jsxs)(`button`,{type:`button`,className:`sym-card-row${n?` sym-card-here`:``}`,"aria-current":n?`location`:void 0,onClick:()=>i({path:e.path,side:t,line:e.line}),children:[(0,S.jsx)(`span`,{className:`sym-card-ln`,children:e.line}),(0,S.jsx)(Hu,{usage:e})]},`${e.hunkId}:${e.line}`)})]},e.path)})})]})}function zu(e,t){return e.hunkId===t.hunkId&&e.line===t.line}function Bu({path:e}){let t=e.lastIndexOf(`/`);return t===-1?(0,S.jsx)(`span`,{className:`sym-card-name`,children:e}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`sym-card-name`,children:e.slice(t+1)}),(0,S.jsx)(`span`,{className:`sym-card-dir`,children:e.slice(0,t)})]})}var Vu=28;function Hu({usage:e}){let t=e.text,n=t.search(/\S|$/),r=!1;e.col-n>Vu&&(n=t.lastIndexOf(` `,e.col-Vu+8)+1,(n<=0||e.col-n>56)&&(n=e.col-Vu),r=!0);let i=t.slice(n,e.col),a=t.slice(e.col,e.col+Uu(t,e.col)),o=t.slice(e.col+a.length);return(0,S.jsxs)(`span`,{className:`sym-card-code`,children:[r&&(0,S.jsx)(`span`,{className:`sym-card-ellipsis`,children:`…`}),i,(0,S.jsx)(`mark`,{children:a}),o]})}function Uu(e,t){let n=ku(e,t);return n&&n.start===t?n.end-t:0}function Wu(e,t){let n=document;if(n.caretPositionFromPoint){let r=n.caretPositionFromPoint(e,t);return r?{node:r.offsetNode,offset:r.offset}:null}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);return r?{node:r.startContainer,offset:r.startOffset}:null}return null}function Gu(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let e=n.nextNode();e;e=n.nextNode())t.push(e);return t}function Ku(e,t,n){let r=document.createRange(),i=0,a=!1;for(let o of Gu(e)){let e=o.data.length;if(!a&&t<i+e&&(r.setStart(o,t-i),a=!0),a&&n<=i+e)return r.setEnd(o,n-i),r;i+=e}return null}function qu(e,t,n,r){let i=e.closest?.(`td[data-side]`);if(!(i instanceof HTMLElement)||e.closest(`.nosym`))return null;let a=Wu(t,n);if(!a||a.node.nodeType!==Node.TEXT_NODE||!i.contains(a.node))return null;let o=a.offset;for(let e of Gu(i)){if(e===a.node)break;o+=e.data.length}let s=ku(i.textContent??``,o);if(!s||!ju(s.word))return null;let c=Ku(i,s.start,s.end)?.getBoundingClientRect();if(!c||t<c.left-1||t>c.right+1||n<c.top-1||n>c.bottom+1)return null;let l=i.closest(`[data-hunk-id]`)?.getAttribute(`data-hunk-id`);if(!l)return null;let u=r.get(l);if(!u)return null;let d=i.dataset.side===`base`?`base`:`head`,f=Number(d===`base`?i.dataset.old:i.dataset.new);return{word:s.word,side:d,path:u,hunkId:l,line:Number.isFinite(f)&&f>0?f:null,cell:i,start:s.start,end:s.end}}function Ju(e,t){let n=globalThis.CSS?.highlights;if(!n||typeof Highlight>`u`)return;let r=RegExp(`(?<![\\w$])${e.replace(/[$\\]/g,`\\$&`)}(?![\\w$])`,`g`),i=new Highlight,a=window.innerHeight,o=t===`base`?`td[data-old]`:`td[data-new]`;for(let e of document.querySelectorAll(`.hunk-lines`)){let t=e.getBoundingClientRect();if(!(t.bottom<0||t.top>a))for(let t of e.querySelectorAll(o)){let e=t.textContent;if(e)for(let n of e.matchAll(r)){let e=Ku(t,n.index,n.index+n[0].length);e&&i.add(e)}}}n.set(Iu,i)}function Yu(){globalThis.CSS?.highlights?.delete(Iu)}var Xu=12e3;function Z({status:e,onShown:t,onAcknowledge:n}){let r=(0,x.useRef)(e.notice===`pending`),i=(0,x.useRef)(!1),a=e.enabled&&e.notice!==`acknowledged`;(0,x.useEffect)(()=>{a&&r.current&&!i.current&&(i.current=!0,t())},[a,t]);let[o,s]=(0,x.useState)(!1),c=(0,x.useRef)(Xu),[l,u]=(0,x.useState)(Xu);return(0,x.useEffect)(()=>{if(!a||o)return;let e,t,r=0,i=()=>Math.max(0,c.current-(Date.now()-r)),s=()=>{e===void 0&&(r=Date.now(),e=setTimeout(n,c.current),t=setInterval(()=>u(i()),250))},l=()=>{e!==void 0&&(clearTimeout(e),clearInterval(t),e=void 0,c.current=i(),u(c.current))},d=()=>document.visibilityState===`visible`?s():l();return d(),document.addEventListener(`visibilitychange`,d),()=>{l(),document.removeEventListener(`visibilitychange`,d)}},[a,o,n]),a?(0,S.jsxs)(`div`,{className:`telemetry-notice`,role:`status`,"aria-live":`polite`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onFocus:()=>s(!0),onBlur:()=>s(!1),children:[(0,S.jsx)(H,{name:`note`,size:`sm`}),(0,S.jsxs)(`p`,{className:`telemetry-notice-text`,children:[(0,S.jsx)(`strong`,{children:`Diffo sends anonymous usage data.`}),` Two small events per review, opened and finished: the version, your OS, the kind of review, which agent, and counts. Never code, paths, or comment text.`,` `,r.current?`Nothing has been sent yet, and nothing is during this review. `:``,`Turn it off any time under Settings → Privacy.`,` `,(0,S.jsx)(`a`,{href:e.docs,target:`_blank`,rel:`noreferrer`,children:`What is sent`})]}),(0,S.jsxs)(`span`,{className:`telemetry-notice-ok`,children:[(0,S.jsxs)(`svg`,{className:`telemetry-notice-ring`,viewBox:`0 0 40 40`,"aria-hidden":`true`,children:[(0,S.jsx)(`circle`,{className:`telemetry-notice-ring-track`,cx:`20`,cy:`20`,r:Q}),(0,S.jsx)(`circle`,{className:`telemetry-notice-ring-left`,cx:`20`,cy:`20`,r:Q,strokeDasharray:Zu,strokeDashoffset:Zu*(1-l/Xu)})]}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-sm telemetry-notice-ok-btn`,title:`dismiss; it closes on its own in a few seconds`,onClick:n,children:`OK`})]})]}):null}var Q=18,Zu=2*Math.PI*Q;function Qu(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function $u({item:e,current:t,onOpen:n,onResolve:r,onReopen:i,onDelete:a}){let o=e.turn===`resolved`,s=ot(e.thread),c=o?i:r,l=e.turn===`yours`||e.turn===`unanswered`,u=e.anchor??`the whole changeset`,d=e.outdated?`, outdated on GitHub: the line left the diff`:e.gone?`, this file left the changeset`:``;return(0,S.jsxs)(`div`,{className:`crow${l?` crow-hot`:``}${o?` crow-done`:``}`,"aria-current":t?`true`:void 0,"data-thread":e.thread.id,children:[s?(0,S.jsx)(`button`,{type:`button`,className:`crow-mark`,"data-tip":`Discard draft: drops it; nothing was posted`,"aria-label":`Discard draft`,disabled:!a,onClick:()=>a&&void a(e.thread.id),children:(0,S.jsx)(H,{name:`trash`,size:`sm`})}):(0,S.jsx)(`button`,{type:`button`,className:`crow-mark`,"aria-pressed":o,"data-tip":o?`Reopen: moves back to its turn`:`Resolve: moves to Settled`,"aria-label":o?`Reopen thread`:`Resolve thread`,disabled:!c,onClick:()=>c&&void c(e.thread.id),children:(0,S.jsx)(H,{name:`check`,size:`sm`})}),(0,S.jsxs)(`button`,{type:`button`,className:`crow-pick`,title:`${u}${d}`,onClick:()=>n?.(e),children:[(0,S.jsx)(`span`,{className:`crow-q`,children:e.question}),(0,S.jsxs)(`span`,{className:`crow-sub`,children:[e.turn===`note`&&at(e.thread)&&(0,S.jsx)(`span`,{className:`crow-pill`,children:`Draft`}),it(e.thread)!==null&&(0,S.jsxs)(`span`,{className:`crow-pill crow-pill-pr`,title:`your agent drafted a review comment for the author`,children:[(0,S.jsx)(H,{name:`globe`,size:`sm`}),` suggests`]}),e.thread.intent&&e.turn!==`proposed`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`crow-kind crow-kind-${e.thread.intent}`,children:vc[e.thread.intent]}),(0,S.jsx)(`span`,{className:`crow-sep`,children:`·`})]}),(0,S.jsx)(`span`,{className:`crow-where${e.gone?` crow-where-gone`:``}`,children:Qu(u)}),at(e.thread)?td(e)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`crow-sep`,children:`·`}),(0,S.jsx)(`span`,{className:`crow-state`,children:td(e)})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`crow-sep`,children:`·`}),(0,S.jsx)(`span`,{className:`crow-state crow-state-${e.turn}`,children:ed(e)})]})]})]}),(0,S.jsx)(`span`,{className:`crow-when`,children:ya(e.updatedAt)}),a&&!s&&(0,S.jsx)(`button`,{type:`button`,className:`row-act row-act-danger crow-del`,"data-tip":`Delete thread`,"aria-label":`Delete thread`,onClick:()=>void a(e.thread.id),children:(0,S.jsx)(H,{name:`trash`,size:`sm`})})]})}function ed(e){switch(e.turn){case`yours`:return e.outcome===`changed`?`changed the code, no reply`:e.answer??`answered`;case`unanswered`:return`no answer, the agent moved on`;case`proposed`:return`from the agent: reply or resolve`;case`agent`:return e.working?`agent is on it`:e.queued===void 0?`waiting on the agent`:`queued, ${Sc(e.queued)}`;case`note`:return`draft, not sent`;case`posted`:return e.answer??`on GitHub`;case`resolved`:return e.answer??`resolved`}}function td(e){let t=e.thread;if(e.turn===`note`)return null;if(st(t).length>0)return`reply pending`;if(t.queued?.resolve)return`resolves when you submit`;if(t.queued?.unresolve)return`reopens when you submit`;let n=nd(t);return e.turn===`resolved`?n?`${n} · resolved`:`resolved`:n??`on GitHub`}function nd(e){for(let t=e.messages.length-1;t>=0;t--){let n=e.messages[t];if(n.author===`github`&&n.github)return n.github.user.login}return null}var rd=new Set([`settled`]),id={github:{icon:`globe`,label:`GitHub`,empty:`No PR comments yet`},agent:{icon:`lock`,label:`Private`,empty:`Nothing asked of the agent yet`}},ad=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function od(e,t){let n=e=>t.filter(e).length;if(e===`github`){let e=n(e=>e.turn===`note`);return e>0?{text:ad(e,`draft`),hot:!1}:null}let r=n(e=>e.turn===`yours`||e.turn===`unanswered`);if(r>0)return{text:`${r} your turn`,hot:!0};let i=n(e=>e.turn===`proposed`);if(i>0)return{text:`${i} from the agent`,hot:!1};let a=n(e=>e.turn===`agent`);return a>0?{text:`${a} waiting`,hot:!1}:null}function sd({side:e,group:t,selectedThreadId:n,row:r}){let[i,a]=(0,x.useState)(!1),[o,s]=(0,x.useState)(`auto`),[c,l]=(0,x.useState)(`auto`),[u,d]=(0,x.useState)(n),f=us()?.viewer.login??null,p=id[e],m=od(e,t),h=t.filter(e=>e.turn!==`resolved`),g=t.filter(e=>e.turn===`resolved`),_=e===`github`?h.filter(e=>xs(e.thread,f)):h,v=h.filter(e=>!_.includes(e)),y=e=>e.thread.id===n;u!==n&&(d(n),o===`closed`&&v.some(y)&&s(`auto`),c===`closed`&&g.some(y)&&l(`auto`));let b=(e,t)=>e===`open`||e===`auto`&&t,C=b(o,v.some(y)),w=C?[..._,...v]:_,T=b(c,g.some(y));return(0,S.jsxs)(`section`,{className:`side side-${e}`,"aria-label":`${p.label} threads`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`side-head`,"aria-expanded":!i,onClick:()=>a(!i),children:[(0,S.jsx)(`span`,{className:`chevron${i?` chevron-shut`:``}`,children:(0,S.jsx)(H,{name:`chev`,size:`sm`})}),(0,S.jsx)(H,{name:p.icon,size:`sm`}),(0,S.jsx)(`span`,{className:`side-name`,children:p.label}),` `,(0,S.jsx)(`span`,{className:`side-n`,children:t.length}),m&&(0,S.jsxs)(S.Fragment,{children:[` `,(0,S.jsx)(`span`,{className:`side-badge${m.hot?` side-badge-hot`:``}`,children:m.text})]})]}),!i&&t.length===0&&(0,S.jsx)(`div`,{className:`side-empty`,children:p.empty}),!i&&w.map(r),!i&&(v.length>0||g.length>0)&&(0,S.jsxs)(`div`,{className:`side-tail`,children:[v.length>0&&(0,S.jsx)(`button`,{type:`button`,className:`side-more`,"aria-expanded":C,title:C?`back to the threads you are part of`:`threads on this pull request you are not part of, bots included`,onClick:()=>s(C?`closed`:`open`),children:C?`Only mine`:`${v.length} from others`}),g.length>0&&(0,S.jsxs)(`button`,{type:`button`,className:`side-more`,"aria-expanded":T,onClick:()=>l(T?`closed`:`open`),children:[g.length,` `,e===`github`?`resolved`:`settled`]})]}),!i&&T&&g.map(r)]})}function cd({items:e,pastItems:t=[],selectedThreadId:n,totalThreads:r,onOpen:i,onResolve:a,onReopen:o,onDelete:s,onClearAll:c,pr:l=!1}){let[u,d]=(0,x.useState)(rd),f=(0,x.useMemo)(()=>[...e,...t.map(e=>({...e,gone:!0}))],[e,t]),p=(0,x.useMemo)(()=>Es(f),[f]),m=(0,x.useMemo)(()=>l?Ss(f):null,[l,f]),h=(e,t)=>e===`yours`&&a?{icon:`check`,danger:!1,label:`Resolve all ${t.length}`,run:()=>t.forEach(e=>void a(e.thread.id))}:e===`settled`&&s?{icon:`trash`,danger:!0,label:`Delete all ${t.length} settled`,run:()=>t.forEach(e=>void s(e.thread.id))}:null,g=c&&(0,S.jsxs)(`button`,{type:`button`,className:`clist-clear`,onClick:c,children:[`Clear all threads`,r!==void 0&&r>0?` (${r})`:``,`…`]}),_=e=>(0,S.jsx)($u,{item:e,current:n===e.thread.id,onOpen:i,onResolve:a,onReopen:o,onDelete:s},e.thread.id);if(m)return(0,S.jsxs)(`div`,{className:`clist clist-pr`,children:[[`github`,`agent`].map(e=>(0,S.jsx)(sd,{side:e,group:m[e],selectedThreadId:n,row:_},e)),f.length>0&&g]});if(p.size===0)return(0,S.jsx)(`div`,{className:`clist`,children:(0,S.jsxs)(`div`,{className:`rail-empty`,children:[`No threads yet.`,(0,S.jsx)(`br`,{}),`Comment on any diff line to start one.`]})});let v=p.size===1&&p.has(`settled`);return(0,S.jsxs)(`div`,{className:`clist`,children:[v&&(0,S.jsxs)(`div`,{className:`clist-quiet`,children:[`Nothing needs you.`,(0,S.jsx)(`br`,{}),(0,S.jsxs)(`span`,{className:`clist-quiet-n`,children:[p.get(`settled`).length,` settled.`]})]}),[...p].map(([e,t])=>{let n=u.has(e),r=h(e,t);return(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`sec-row${r?` sec-row-hasact`:``}`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`sec-head sec-head-fold${e===`yours`?` sec-head-hot`:``}`,"aria-expanded":!n,onClick:()=>d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),children:[(0,S.jsx)(`span`,{className:`chevron${n?` chevron-shut`:``}`,children:(0,S.jsx)(H,{name:`chev`,size:`sm`})}),gs[e],` `,(0,S.jsx)(`span`,{className:`sec-n`,children:t.length})]}),r&&(0,S.jsx)(`button`,{type:`button`,className:`row-act sec-act${r.danger?` row-act-danger`:``}`,"data-tip":r.label,"aria-label":r.label,onClick:r.run,children:(0,S.jsx)(H,{name:r.icon,size:`sm`})})]}),!n&&t.map(_)]},e)}),g]})}var ld=`diffo:ui:critter`;function ud(){try{return localStorage.getItem(ld)!==`off`}catch{return!0}}function dd(e){try{e?localStorage.removeItem(ld):localStorage.setItem(ld,`off`)}catch{}}async function fd(){try{let e=await fetch(`/api/settings`);if(!e.ok)return null;let t=await e.json();return t?.critter===`on`||t?.critter!==`off`&&null}catch{return null}}function pd(){let[e,t]=(0,x.useState)(ud);return(0,x.useEffect)(()=>{let e=!1;return fd().then(n=>{e||n===null||n===ud()||(dd(n),t(n))}),()=>{e=!0}},[]),[e,(0,x.useCallback)(e=>{t(e),dd(e),fetch(`/api/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({critter:e?`on`:`off`})}).catch(()=>{})},[])]}function md(e,t){return e===`j`?`next-hunk`:e===`]`?`next-layer`:e===`[`?`prev-layer`:e===`.`?`next-decision`:e===`k`?`prev-hunk`:e===`J`||t&&e===`j`?`next-file`:e===`K`||t&&e===`k`?`prev-file`:e===`v`?`toggle-viewed`:e===`u`?`toggle-view-mode`:e===`b`?`toggle-nav`:e===`/`?`focus-search`:e===`c`?`comment`:e===`n`?`next-unreviewed`:e===`o`?`toggle-fold`:e===`h`?`hide-reviewed`:e===`?`?`shortcuts`:null}function hd(e){return e instanceof HTMLElement?e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable:!1}var gd={changedHunkIds:new Set,changedFiles:[],changed:new Set},_d=new Set,vd=e=>e.hunks.length>0;function yd(e,t,n=_d){if(!e||!t)return gd;let r=new Set(t.hunkIds),i=new Set,a=[];for(let t of e.files){if(!vd(t))continue;let e=t.hunks.filter(e=>!r.has(e.id)&&!n.has(e.id));if(e.length!==0){for(let t of e)i.add(t.id);a.push(t.path)}}return{changedHunkIds:i,changedFiles:a,changed:new Set(a)}}function bd(){let e=w(),t=V({queryKey:[`telemetry`],queryFn:async()=>{try{let e=await fetch(`/api/telemetry`);return e.ok?await e.json():null}catch{return null}},staleTime:1/0}),n=async t=>{try{let n=await fetch(`/api/telemetry`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});n.ok&&e.setQueryData([`telemetry`],await n.json())}catch{}};return{status:t.data??null,markShown:()=>void n({notice:`shown`}),acknowledge:()=>void n({notice:`acknowledged`}),setEnabled:e=>void n({enabled:e})}}var xd=`diffo:ui:theme`;function Sd(e){return e===`system`||e===`light`||e===`dark`?e:null}function Cd(){let e=localStorage.getItem(xd);return e===`light`||e===`dark`?e:`system`}function wd(e){e===`system`?localStorage.removeItem(xd):localStorage.setItem(xd,e)}function Td(e){e===`system`?document.documentElement.removeAttribute(`data-theme`):document.documentElement.setAttribute(`data-theme`,e)}async function Ed(){try{let e=await fetch(`/api/settings`);return e.ok?Sd((await e.json())?.theme):null}catch{return null}}function Dd(e){fetch(`/api/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({theme:e})}).catch(()=>{})}function Od(){let[e,t]=(0,x.useState)(Cd);return(0,x.useEffect)(()=>{let e=!1;return Ed().then(n=>{e||n===null||n===Cd()||(wd(n),Td(n),t(n))}),()=>{e=!0}},[]),[e,(0,x.useCallback)(e=>{t(e),Td(e),wd(e),Dd(e)},[])]}var kd=(e,t)=>`${e}:${t}`;function Ad(e){return e.flatMap(e=>e.messages.filter(e=>e.author===`agent`).map(t=>kd(e.id,t.id)))}function jd(e){let t=e.anchor;return t.kind===`changeset`?null:t.kind===`file`?t.path:t.kind===`layer`?`layer “${t.title}”`:`${t.path}:${t.line}`}function Md(e,t){let n=[];for(let r of e){let e=[...r.messages].reverse().find(e=>e.author===`agent`);if(!e||t.has(kd(r.id,e.id)))continue;let i=ut(r);n.push({key:kd(r.id,e.id),kind:i?r.anchor.kind===`changeset`?`guide`:`thread`:`answer`,threadId:r.id,anchor:jd(r),preview:e.text.split(`
|
|
93
93
|
`,1)[0].trim()})}return n}function Nd(e,t){return e>0?`(${e}) ${t}`:t}function Pd(e,t,n=!1){return e?n?`dev · ${e}`:e:t}var Fd=8e3;function Id(e,t){let n=0;return e.map(e=>e.kind===`guide`?e:{...e,expiresAt:t+350*n++})}function Ld(e,t){let n=-1/0;for(let t of e)t.expiresAt!==null&&t.expiresAt>n&&(n=t.expiresAt);return Math.max(t+Fd,n+350)}function Rd(e){let t=document;if(typeof t.startViewTransition!=`function`){e();return}let n=t.startViewTransition(()=>(0,At.flushSync)(e));n.ready.catch(()=>{}),n.finished.catch(()=>{})}function zd({threads:e,title:t,onOpenThread:n}){let[r,i]=(0,x.useState)([]),a=(0,x.useRef)(null),o=(0,x.useRef)(document.title),s=(0,x.useRef)(zt()),c=(0,x.useRef)(t),l=(0,x.useRef)(0),u=(0,x.useRef)(n);u.current=n;let d=(0,x.useCallback)(()=>{document.title=Nd(l.current,Pd(c.current,o.current,s.current))},[]);(0,x.useEffect)(()=>{c.current=t,d()},[t,d]),(0,x.useEffect)(()=>{if(!e)return;if(a.current===null){a.current=new Set(Ad(e));return}let t=Md(e,a.current);for(let t of Ad(e))a.current.add(t);if(t.length===0)return;if(document.hasFocus()){let e=Date.now(),n=t.map(e=>({...e,expiresAt:null}));Rd(()=>i(t=>[...t,...Id(n,Ld(t,e))]));return}l.current+=t.length,d();let n=t.map(e=>({...e,expiresAt:null}));Rd(()=>i(e=>[...e.map(e=>e.expiresAt===null?e:{...e,expiresAt:null}),...n]))},[e,d]),(0,x.useEffect)(()=>{let e=()=>{l.current=0,d();let e=Date.now()+Fd;i(t=>Id(t,e))};return window.addEventListener(`focus`,e),()=>{window.removeEventListener(`focus`,e),l.current=0,d()}},[d]),(0,x.useEffect)(()=>{let e=1/0;for(let t of r)t.expiresAt!==null&&t.expiresAt<e&&(e=t.expiresAt);if(e===1/0)return;let t=setTimeout(()=>{let e=Date.now();Rd(()=>i(t=>t.filter(t=>t.expiresAt===null||t.expiresAt>e)))},Math.max(0,e-Date.now()));return()=>clearTimeout(t)},[r]);let f=(0,x.useCallback)(()=>Rd(()=>i([])),[]),p=(0,x.useCallback)(e=>{Rd(()=>i(t=>t.filter(t=>t.key!==e.key)))},[]);return{notices:r,open:(0,x.useCallback)(e=>{Rd(()=>i(t=>t.filter(t=>t.key!==e.key))),u.current(e.threadId)},[]),dismiss:p,clear:f}}function Bd(e){return`diffo:viewed:${e.repo.path}:${Hd(e)}`}function Vd(e){return`diffo:viewed:${e.repo.name}:${Hd(e)}`}function Hd(e){return e.spec.kind===`working-tree`?`working-tree`:`branch:${e.spec.base}`}function Ud(e){try{let t=localStorage.getItem(e);if(!t)return new Set;let n=JSON.parse(t);return Array.isArray(n)?new Set(n.filter(e=>typeof e==`string`)):new Set}catch{return new Set}}function Wd(e,t){try{localStorage.setItem(e,JSON.stringify([...t]))}catch{}}function Gd(e){let t=e?Bd(e):null,n=e?Vd(e):null,[r,i]=(0,x.useState)(new Set),[a,o]=(0,x.useState)(!1);(0,x.useEffect)(()=>{if(!t)return;let e=Ud(t);if(e.size===0&&n!==null&&n!==t){let e=Ud(n);if(e.size>0){Wd(t,e),i(e),o(!0);return}}i(e),o(!0)},[t,n]);let s=(0,x.useCallback)(n=>{let r=e?.files.find(e=>e.path===n);r&&i(e=>{let n=new Set(e),i=fo(r),a=i.every(e=>n.has(e));for(let e of i)a?n.delete(e):n.add(e);return t&&Wd(t,n),n})},[e,t]),c=(0,x.useCallback)((n,r)=>{let a=new Set(n);i(n=>{let i=new Set(n);for(let t of e?.files??[])if(a.has(t.path))for(let e of fo(t))r?i.add(e):i.delete(e);return t&&Wd(t,i),i})},[e,t]);return{viewed:r,loaded:a,toggleFile:s,markFiles:(0,x.useCallback)(e=>c(e,!0),[c]),clearFiles:(0,x.useCallback)(e=>c(e,!1),[c]),progress:(0,x.useMemo)(()=>{let t=0,n=0;for(let i of e?.files??[])for(let e of i.hunks)t++,r.has(e.id)&&n++;return{viewed:n,total:t}},[e,r]),fileProgress:(0,x.useMemo)(()=>{let t=0,n=0;for(let i of e?.files??[])t++,mo(i,r)&&n++;return{viewed:n,total:t}},[e,r])}}var Kd=new We,qd=264,Jd=800,Yd=200,Xd=520,Zd=e=>Math.min(Xd,Math.max(Yd,e)),Qd=12,$d=`overview`,ef=16,tf=new Set,nf=new Map;function rf(e){e.removeAttribute(`data-found`),e.offsetWidth,e.setAttribute(`data-found`,``);let t=()=>e.removeAttribute(`data-found`);e.addEventListener(`animationend`,t,{once:!0}),setTimeout(t,2e3)}var af=[];function of(){let e=w(),[t,n]=(0,x.useState)(`waiting`),[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(`no-agent`),[s,c]=(0,x.useState)(null),[l,u]=(0,x.useState)(tf),[d,f]=(0,x.useState)(nf),[p,m]=(0,x.useState)(tf);return(0,x.useEffect)(()=>{let t=new EventSource(`/api/events`);return t.addEventListener(`changeset`,()=>{e.invalidateQueries({queryKey:[`changeset`]})}),t.addEventListener(`review`,()=>{e.invalidateQueries({queryKey:[`review`]})}),t.addEventListener(`presence`,e=>{try{let t=JSON.parse(e.data),{state:r}=t;(r===`waiting`||r===`listening`||r===`working`)&&(n(r),i(t.layers===`queued`||t.layers===`outlining`?t.layers:null),t.reason&&o(t.reason),c(typeof t.since==`number`?t.since:null),u(r===`working`&&Array.isArray(t.workingOn)?new Set(t.workingOn.filter(e=>typeof e==`string`)):tf),f(r!==`waiting`&&Array.isArray(t.queued)?new Map(t.queued.filter(e=>typeof e==`string`).map((e,t)=>[e,t+1])):nf),m(r!==`waiting`&&Array.isArray(t.answered)?new Set(t.answered.filter(e=>typeof e==`string`)):tf))}catch{}}),t.onopen=()=>{e.invalidateQueries({queryKey:[`review`]}),e.invalidateQueries({queryKey:[`changeset`]})},t.onerror=()=>{n(`waiting`),o(`disconnected`),c(null),u(tf),f(nf),m(tf),i(null)},()=>t.close()},[e]),{presence:t,reason:a,since:s,workingOn:l,queuedOn:d,answeredOn:p,layersRequest:r}}function sf(e,t,n){let[r,i]=(0,x.useState)(null),a=(0,x.useRef)(tf);return(0,x.useEffect)(()=>{let r=a.current;if(a.current=t,n!==`working`||t.size===0){i(null);return}let o=[...t].filter(e=>!r.has(e));if(o.length===0)return;let s=e.find(e=>e.thread.id===o[o.length-1]);s&&i(ws(s.anchor))},[e,t,n]),r}function cf(){let e=w();return(0,x.useMemo)(()=>{let t=()=>e.invalidateQueries({queryKey:[`review`]});return{create:async(e,n,r,i)=>{let a=await Ct.createThread(e,n,r,i);return await t(),a},reply:(e,n,r)=>Ct.reply(e,n,r).then(t),edit:(e,n,r,i)=>Ct.editMessage(e,n,r,i).then(t),send:async e=>{let{prompt:n,delivered:r,presence:i}=await Ct.send(e);if(r||i!==`waiting`)return await t(),{delivered:!0};let a=await wt(n);return await t(),{delivered:!1,copied:a,prompt:n}},resolve:e=>Ct.setState(e,`resolved`).then(t),reopen:e=>Ct.setState(e,`open`).then(t),remove:e=>Ct.remove(e).then(t),dismissPrComment:(e,n)=>Ct.dismissPrComment(e,n).then(t)}},[e])}function lf(){let{data:e,isLoading:t,error:n}=ht(),{presence:r,reason:i,since:a,workingOn:o,queuedOn:s,answeredOn:c,layersRequest:l}=of(),{viewed:u,loaded:d,toggleFile:f,markFiles:p,clearFiles:m,progress:h,fileProgress:g}=Gd(e),[_,v]=(0,x.useState)(`unified`),[y,b]=(0,x.useState)(null),[C,w]=(0,x.useState)(null),[T,E]=(0,x.useState)(new Set),[D,O]=(0,x.useState)(()=>{let e=localStorage.getItem(`diffo:ui:navHidden`);return e===null?window.innerWidth<Jd:e===`1`}),[k,A]=(0,x.useState)(()=>{let e=Number(localStorage.getItem(`diffo:ui:railWidth`));return e>0?Zd(e):qd}),[j,M]=(0,x.useState)(!1),ee=(0,x.useRef)(null),N=(0,x.useRef)(k);N.current=j?N.current:k;let P=(0,x.useRef)(null);(0,x.useEffect)(()=>()=>P.current?.(),[]);let{data:F}=gt(),te=cf(),[ne,re]=(0,x.useState)(null),[I,ie]=(0,x.useState)(null),[ae,oe]=(0,x.useState)(!1),[se,ce]=(0,x.useState)(!1),[le,ue]=(0,x.useState)(!1),[de,fe]=(0,x.useState)(!1),[L,R]=(0,x.useState)(!1),[z,pe]=Od(),[me,he]=pd(),ge=bd(),[_e,ve]=(0,x.useState)(!1),[ye,be]=(0,x.useState)(`files`),[xe,Se]=(0,x.useState)(0),Ce=e?.pr??null,we=r!==`waiting`,[Te,Ee]=(0,x.useState)(!1),De=(0,x.useMemo)(()=>yd(e,F?.lastFinish,u),[e,F,u]),Oe=(0,x.useMemo)(()=>Qo(e?.files??[]),[e]),B=qo(Oe,(0,x.useCallback)(e=>mo(e,u),[u]),{on:Te,changed:De.changed,set:Ee}),ke=(0,x.useMemo)(()=>yo(F?.layers,Oe),[F?.layers,Oe]),Ae=ke.length>0,je=(0,x.useMemo)(()=>wo(ke),[ke]),Me=(0,x.useMemo)(()=>B.hideTests?bo(ke,e=>Vo(e.path)&&!B.pinned.has(e.path)):ke,[ke,B.hideTests,B.pinned]),[Ne,Pe]=(0,x.useState)(null),[Fe,Ie]=(0,x.useState)(null);(0,x.useEffect)(()=>Ie(null),[Ne]);let Le=(0,x.useMemo)(()=>So(F?.threads??[]),[F?.threads]),Re=(0,x.useMemo)(()=>Ce?Co(F?.threads??[]):void 0,[Ce,F?.threads]),ze=Le!==void 0||Re!==void 0,Be=Ae&&Ne===$d&&ze,Ve=ke.findIndex(e=>xo(e)===Ne),He=(0,x.useMemo)(()=>ke.every(e=>e.files.every(e=>!mo(e.file,u))),[ke,u]),Ue=Ae?Be?-1:Ve===-1?Oo(Me,u):Ve:-1,We=Ae&&Ue>=0?Me[Ue]:void 0,Ge=Ae&&Ue>=0?ke[Ue]:void 0,Ke=Ae&&ye===`layers`,qe=Ke?We:void 0;(0,x.useEffect)(()=>{Ae&&d&&Ve===-1&&!Be&&Pe(ze&&He&&Ne===null?$d:xo(ke[Ue]))},[Ae,d,Ve,Be,ke,Ue,ze,He,Ne]);let Je=(0,x.useMemo)(()=>Ke&&Be?[]:qe?qe.files.map(e=>e.file):B.files,[Ke,Be,qe,B.files]),Ye=(0,x.useCallback)(e=>e.files.length===0,[]),[Xe,Ze]=(0,x.useState)(Qd),Qe=(0,x.useCallback)(()=>Ze(e=>e+Qd),[]),$e=(0,x.useCallback)(e=>{let t=ke[e];t&&(Pe(xo(t)),b(null),w(null),Ze(Qd),requestAnimationFrame(()=>{document.querySelector(`.reading-pane`)?.scrollTo({top:0})}))},[ke]),et=(0,x.useCallback)(()=>{Pe($d),b(null),w(null),requestAnimationFrame(()=>{document.querySelector(`.reading-pane`)?.scrollTo({top:0})})},[]),tt=(0,x.useCallback)(e=>{if(!Ke||Ge?.files.some(t=>t.file.path===e))return;let t=je.get(e);t&&$e(ke.indexOf(t))},[Ke,Ge,je,ke,$e]),nt=qe?.kind===`mechanical`?xo(qe):null,V=(0,x.useRef)(qe);V.current=qe,(0,x.useEffect)(()=>{if(nt===null)return;let e=V.current?.files.map(e=>e.file.path)??[];E(t=>new Set([...t,...e]))},[nt]),(0,x.useEffect)(()=>{Ae&&be(`layers`)},[Ae]);let rt=(0,x.useCallback)(()=>{Ct.requestLayers().catch(()=>{})},[]),it=(0,x.useCallback)(e=>{B.pin(e);let t=Ke?Ge?.files.some(t=>t.file.path===e)?Ge:je.get(e):void 0,n=t?t.files.findIndex(t=>t.file.path===e):Oe.findIndex(t=>t.path===e);n>=0&&Ze(e=>Math.max(e,n+1))},[Oe,B.pin,Ke,Ge,je]),at=(0,x.useMemo)(()=>Je.slice(0,Xe),[Je,Xe]),{active:st,past:ct}=(0,x.useMemo)(()=>{let t=pt(e?.files??[],F?.threads??[],F?.layers),n=t.active.filter(e=>e.github?.outdated===!0);return n.length===0?t:{active:t.active.filter(e=>e.github?.outdated!==!0),past:[...t.past,...n]}},[e,F]),lt=(0,x.useMemo)(()=>jl(e?.files??[],st),[e,st]),dt=(0,x.useMemo)(()=>Cs(st,o,s),[st,o,s]),ft=(0,x.useMemo)(()=>({stillTo:dt.filter(e=>e.turn===`agent`).sort((e,t)=>(e.working===!0?0:e.queued??2**53-1)-(t.working===!0?0:t.queued??2**53-1)),back:dt.filter(e=>c.has(e.thread.id))}),[dt,c]),mt=(0,x.useMemo)(()=>({segments:[...ft.back.map(()=>`done`),...ft.stillTo.map(e=>e.working===!0?`now`:`wait`)],done:ft.back.length}),[ft]),_t=sf(dt,c,r),vt=r===`working`?Ts(ft.stillTo,_t)??(l===`outlining`?`outlining layers`:null):null,[yt,bt]=(0,x.useState)(!1);(0,x.useEffect)(()=>{yt&&ft.stillTo.length===0&&ft.back.length===0&&bt(!1)},[yt,ft]),(0,x.useEffect)(()=>{Te&&De.changed.size===0&&Ee(!1)},[Te,De]);let xt=(0,x.useMemo)(()=>Cs(ct),[ct]),St=(0,x.useMemo)(()=>ks(dt),[dt]),wt=(0,x.useMemo)(()=>Nl(e?.files??[],lt),[e,lt]),Tt=Ds(dt)+Ds(xt),Dt=Os(dt)+Os(xt),Ot=dt.length+xt.length-Dt,[At,jt]=(0,x.useState)(0),[Nt,Pt]=(0,x.useState)(0),[It,Lt]=(0,x.useState)(null),[Rt,zt]=(0,x.useState)(null),Bt=(0,x.useMemo)(()=>({partition:lt,past:ct,actions:te,agentConnected:we,workingOn:o,queuedOn:s,composeHunkId:ne,onComposeHandled:()=>re(null),composeFilePath:I,onComposeFileHandled:()=>ie(null),changesetComposerOpen:ae,onOpenChangesetComposer:()=>oe(!0),onCloseChangesetComposer:()=>oe(!1),revealNotesTick:At,revealPastTick:Nt,revealThreadId:It}),[lt,ct,te,we,o,s,ne,I,ae,At,Nt,It]),Vt=(0,x.useMemo)(()=>{let e=0;for(let t of st)fs(t)&&e++;return e},[st]),U=(0,x.useMemo)(()=>st.filter(ot).length+ct.filter(ot).length,[st,ct]),[Ht,Ut]=(0,x.useState)(new Set),Wt=(0,x.useMemo)(()=>{let e=new Set;for(let t of st)ut(t)||(t.anchor.kind===`hunk`||t.anchor.kind===`file`)&&e.add(t.anchor.path);return e},[st]),Gt=(0,x.useMemo)(()=>{let e=Oe.filter(e=>!mo(e,u)),t=e.filter(e=>Ht.has(e.path)).map(e=>e.path),n=new Set(t),r=new Set(B.scope.excludedPaths),i=e.filter(e=>!n.has(e.path));return{viewedHunks:h.viewed,totalHunks:h.total,viewedFiles:g.viewed,totalFiles:g.total,changedFiles:t,commentedUnread:i.filter(e=>Wt.has(e.path)).map(e=>e.path),filteredOut:i.filter(e=>!Wt.has(e.path)&&r.has(e.path)).map(e=>e.path),skippedFiles:i.filter(e=>!Wt.has(e.path)&&!r.has(e.path)).map(e=>e.path)}},[Oe,h,g,u,Ht,Wt,B.scope.excludedPaths]),Kt=(0,x.useCallback)(async()=>{await Ct.clear(),await Kd.invalidateQueries({queryKey:[`review`]})},[]),qt=(0,x.useCallback)(()=>{Kd.setQueryData([`review`],e=>e&&{...e,landed:void 0}),Ct.dismissLanded().then(()=>Kd.invalidateQueries({queryKey:[`review`]}))},[]),Jt=(0,x.useMemo)(()=>{if(F?.landed)return{sha:F.landed.sha,subject:F.landed.subject,threads:F.threads.length,onClear:Kt,onDismiss:qt}},[F,Kt,qt]),Yt=(0,x.useMemo)(()=>{let e=e=>e.turn===`yours`||e.turn===`unanswered`;return[...dt.filter(e),...xt.filter(e).map(e=>({...e,gone:!0}))]},[dt,xt]),Xt=(0,x.useCallback)(async()=>{await Kd.invalidateQueries({queryKey:[`review`]}),await Kd.invalidateQueries({queryKey:[`finish-preview`]})},[]),Zt=(0,x.useCallback)(e=>Ct.setState(e,`resolved`).then(Xt),[Xt]),Qt=(0,x.useCallback)(e=>Ct.setState(e,`open`).then(Xt),[Xt]),$t=(0,x.useCallback)(async(e,t)=>{let n={...Gt,...t&&t.note.trim()!==``?{note:t.note.trim()}:{}},{prompt:r,delivered:i,presence:a,public:o}=await Ct.finish(n,e,t?.event);await Kd.invalidateQueries({queryKey:[`review`]}),await Kd.invalidateQueries({queryKey:[`changeset`]}),await Kd.invalidateQueries({queryKey:[`finish-preview`]});let s=i||a!==`waiting`;return e&&s&&Vt>0&&!o?.failed&&bt(!0),{prompt:r,delivered:s,...o?{public:o}:{}}},[Gt,Vt]),en=(0,x.useCallback)(e=>{let t=Zd(e);N.current=t,A(t),localStorage.setItem(`diffo:ui:railWidth`,String(t))},[]),tn=(0,x.useCallback)(e=>{if(e.button!==0)return;e.preventDefault();let t=e.clientX,n=N.current,r=n,i=e=>{r=Zd(n+e.clientX-t),N.current=r,ee.current?.style.setProperty(`--rail-w`,`${r}px`)},a=()=>{P.current?.(),P.current=null,M(!1),en(r)};P.current=()=>{document.removeEventListener(`pointermove`,i),document.removeEventListener(`pointerup`,a),document.removeEventListener(`pointercancel`,a),document.body.style.userSelect=``,document.body.style.cursor=``},document.addEventListener(`pointermove`,i),document.addEventListener(`pointerup`,a),document.addEventListener(`pointercancel`,a),document.body.style.userSelect=`none`,document.body.style.cursor=`col-resize`,M(!0)},[en]),nn=(0,x.useCallback)(()=>en(qd),[en]),rn=(0,x.useRef)(localStorage.getItem(`diffo:ui:navHidden`)!==null),an=(0,x.useCallback)(()=>{rn.current=!0,O(e=>!e)},[]);(0,x.useEffect)(()=>{rn.current&&localStorage.setItem(`diffo:ui:navHidden`,D?`1`:`0`)},[D]);let on=(0,x.useRef)(!1);(0,x.useEffect)(()=>{if(on.current||!d||!e)return;on.current=!0;let t=e.files.filter(e=>mo(e,u)).map(e=>e.path);t.length>0&&E(e=>new Set([...e,...t]))},[d,e,u]);let sn=(0,x.useCallback)(e=>{E(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),cn=(0,x.useRef)(null),ln=(0,x.useCallback)(e=>{let t=document.querySelector(`.reading-pane`),n=document.getElementById(Ro(e));if(!t||!n)return;let r=t.getBoundingClientRect().top,i=n.getBoundingClientRect(),a=i.top-r+t.scrollTop;i.bottom<=r?cn.current=t.scrollTop-(i.height+ef):i.top<=r&&(cn.current=a)},[]);(0,x.useLayoutEffect)(()=>{let e=cn.current;if(e===null)return;cn.current=null;let t=document.querySelector(`.reading-pane`);t&&(t.scrollTop=Math.max(0,e))});let un=(0,x.useCallback)(t=>{let n=e?.files.find(e=>e.path===t);if(!n)return;let r=mo(n,u);!r&&B.hideReviewed&&(ln(t),B.unpin(t)),f(t),E(e=>{let n=new Set(e);return r?n.delete(t):n.add(t),n})},[e,f,u,B.hideReviewed,B.unpin,ln]),dn=(0,x.useCallback)(e=>{let t=n=>{let r=document.getElementById(Ro(e));r?zo(r,rf):n>0&&requestAnimationFrame(()=>t(n-1))};requestAnimationFrame(()=>t(30))},[]),fn=(0,x.useCallback)(e=>{tt(e),it(e),E(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),dn(e)},[it,tt,dn]),pn=(0,x.useCallback)((t,n)=>{let r=e?.files.find(e=>e.path===t);if(!r)return;tt(t),it(t),E(e=>{if(!e.has(t))return e;let n=new Set(e);return n.delete(t),n});let i=n===null?void 0:r.hunks.find(e=>e.lines.some(e=>e.kind!==`del`&&e.newNo===n));i?(b(i.id),w(null),requestAnimationFrame(()=>{let e=t=>{let n=document.querySelector(`[data-hunk-id="${i.id}"]`);n?zo(n,rf):t>0&&requestAnimationFrame(()=>e(t-1))};e(30)})):dn(t)},[e,tt,it,dn]),mn=(0,x.useCallback)(({path:t,side:n,line:r})=>{let i=e?.files.find(e=>e.path===t);if(!i)return;tt(t),it(t),E(e=>{if(!e.has(t))return e;let n=new Set(e);return n.delete(t),n});let a=i.hunks.find(e=>e.lines.some(e=>(n===`base`?e.oldNo:e.newNo)===r));if(!a){dn(t);return}b(a.id),w(null);let o=`[data-hunk-id="${a.id}"] td[data-${n===`base`?`old`:`new`}="${r}"]`;requestAnimationFrame(()=>{let e=t=>{let n=document.querySelector(o)?.closest(`tr`);n?zo(n,rf,`center`):t>0&&requestAnimationFrame(()=>e(t-1))};e(30)})},[e,tt,it,dn]),hn=(0,x.useMemo)(()=>({paths:Oe.map(e=>e.path),onJump:pn}),[Oe,pn]),gn=(0,x.useMemo)(()=>({...Bt,links:hn}),[Bt,hn]),_n=(0,x.useCallback)(e=>{p(e);for(let t of e)B.unpin(t);E(t=>new Set([...t,...e]))},[p,B.unpin]),vn=(0,x.useCallback)(e=>{m(e),E(t=>{let n=new Set(t);for(let t of e)n.delete(t);return n})},[m]),yn=(0,x.useCallback)(()=>{let e=e=>!mo(e,u),t;if(Ke){let n=Math.max(Ue,0),r=[...Me.slice(n),...Me.slice(0,n)];for(let n of r){let r=n.files.map(e=>e.file).find(e);if(r){t=r,n!==We&&$e(Me.indexOf(n));break}}}else t=Oe.find(e);t&&(it(t.path),E(e=>{if(!e.has(t.path))return e;let n=new Set(e);return n.delete(t.path),n}),b(t.hunks[0]?.id??null),w(t.hunks.length===0?t.path:null),dn(t.path))},[Oe,u,it,Ke,Ue,We,Me,$e,dn]),bn=(0,x.useCallback)(e=>{if(zt(e.threadId),e.gone)Pt(e=>e+1);else if(e.layerId!==void 0){be(`layers`);let t=ke.findIndex(t=>t.id===e.layerId);t!==-1&&xo(ke[t])!==Ne&&$e(t)}else e.path?(tt(e.path),it(e.path),E(t=>{if(!t.has(e.path))return t;let n=new Set(t);return n.delete(e.path),n})):(Lt(e.threadId),jt(e=>e+1));let t=n=>{let r=document.querySelector(`[data-thread-id="${e.threadId}"]`);if(r){zo(r,rf);return}n>0&&requestAnimationFrame(()=>t(n-1))};requestAnimationFrame(()=>t(30))},[it,tt,ke,Ne,$e]),xn=(0,x.useCallback)((e,t=!1)=>({threadId:e.thread.id,path:e.path,...e.thread.anchor.kind===`layer`?{layerId:e.thread.anchor.layerId}:{},...t?{gone:t}:{}}),[]),Sn=(0,x.useCallback)(e=>{let t=dt.find(t=>t.thread.id===e);if(t){bn(xn(t));return}let n=xt.find(t=>t.thread.id===e);n&&bn(xn(n,!0))},[dt,xt,bn,xn]),Cn=zd({threads:F?.threads,title:F?.title,onOpenThread:Sn}),wn=(0,x.useRef)(null),Tn=(0,x.useMemo)(()=>{if(!e)return nl;let t=wn.current;return t&&t.version===e.version?nl:rl(t,e,Ud(Bd(e)))},[e]);(0,x.useEffect)(()=>{e&&(wn.current=e)},[e]),(0,x.useEffect)(()=>{e&&Tn.changedViewedHunkIds.size!==0&&Ut(t=>{let n=new Set(t);for(let t of e.files)t.hunks.some(e=>Tn.changedViewedHunkIds.has(e.id))&&n.add(t.path);return n.size===t.size?t:n})},[e,Tn]);let En=(0,x.useMemo)(()=>Je.flatMap(e=>e.hunks.map(t=>({id:t.id,path:e.path}))),[Je]);(0,x.useEffect)(()=>{y&&!En.some(e=>e.id===y)&&b(null)},[En,y]);let W=En.find(e=>e.id===y)?.path??C,Dn=(0,x.useCallback)(e=>{if(En.length===0)return;let t=En.findIndex(e=>e.id===y),n=0;if(t!==-1){if(e===`next-hunk`)n=Math.min(t+1,En.length-1);else if(e===`prev-hunk`)n=Math.max(t-1,0);else if(e===`next-file`){let e=En[t].path,r=En.findIndex((n,r)=>r>t&&n.path!==e);n=r===-1?t:r}else{let e=En[t].path,r=[...En.slice(0,t)].reverse().find(t=>t.path!==e);n=r?En.findIndex(e=>e.path===r.path):t}}let{id:r,path:i}=En[n];b(r),w(null),it(i),requestAnimationFrame(()=>{document.querySelector(`[data-hunk-id="${r}"]`)?.scrollIntoView({behavior:`instant`,block:`center`})})},[En,y,it]);(0,x.useEffect)(()=>{let e=e=>{if(e.metaKey||e.ctrlKey||e.altKey||hd(e.target))return;let t=md(e.key,e.shiftKey);if(t){if(e.preventDefault(),t===`toggle-viewed`)W&&un(W);else if(t===`comment`)y&&re(y);else if(t===`toggle-view-mode`)v(e=>e===`unified`?`split`:`unified`);else if(t===`toggle-nav`)an();else if(t===`focus-search`)be(`files`),O(!1),Se(e=>e+1);else if(t===`next-unreviewed`)yn();else if(t===`shortcuts`)fe(e=>!e);else if(t===`toggle-fold`)W&&sn(W);else if(t===`hide-reviewed`)B.setHideReviewed(!B.hideReviewed);else if(t===`next-layer`||t===`prev-layer`){if(!Ke)return;let e=Do(Me,Ue,t===`next-layer`?1:-1,Ye);e===null?t===`prev-layer`&&ze&&!Be&&et():$e(e)}else if(t===`next-decision`){let e=qe?.decisions;if(!e||e.length===0)return;let t=Fe===null?0:(Fe+1)%e.length;Ie(t);let n=e[t].places.find(e=>e.hunkId);n?pn(n.at.path,n.at.line??null):document.querySelector(`.reading-pane`)?.scrollTo({top:0})}else Dn(t)}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Dn,y,W,un,En,an,yn,sn,B.hideReviewed,B.setHideReviewed,Ke,Me,Ue,Ye,$e,et,Le,Be,qe,Fe,pn]);let On=ke.filter(e=>!e.derived).length,kn=(0,x.useMemo)(()=>{let e=qe;if(!e)return;let t=new Map;for(let{file:n,note:r}of e.files)r?t.set(n.path,r):e.kind===`mechanical`&&n.hunks.length>0&&t.set(n.path,`${n.hunks.length} ${n.hunks.length===1?`site`:`sites`}`);return{id:e.id,...e.decisions?{decisions:e.decisions,openDecision:Fe,onOpenDecision:Ie}:{},kicker:e.derived?`Outside the outline`:`Layer ${e.number} of ${On}`,title:e.title,mechanical:e.kind===`mechanical`,...e.derived?{summary:`Files no layer lists: touched after the outline was posted, or left out of it. The agent absorbs them by re-posting.`}:e.summary?{summary:e.summary}:{},missing:e.missing,listed:e.files.length+(e.hidden??0),hidden:e.hidden??0,onJump:pn,notes:t,knownPaths:Oe.map(e=>e.path)}},[qe,On,pn,Oe,Fe]),An=(0,x.useMemo)(()=>{let e=e=>Do(Me,Ue,e,Ye),t=e=>e===null?null:{title:ke[e].title,onGo:()=>$e(e)};if(Ke&&Be)return{text:Re?`overview · the description`:`overview · the guide`,title:Re?`the author’s description of this change; ] enters the first layer`:`the agent’s orientation to this change; ] enters the first layer`,progress:null,prev:null,next:t(e(1))};let n=qe;if(!n)return;let r=To(n,u),i=n.derived?`since your review`:`layer ${n.number} / ${On}`,a=r.files===0?`nothing here`:r.doneFiles===r.files?`read`:`${r.files-r.doneFiles} left`,o=e(-1);return{text:`${i} · ${r.files} ${r.files===1?`file`:`files`} · ${a}`,title:`${r.doneFiles} of ${r.files} files in this layer marked reviewed`,progress:r.marks===0?0:r.doneMarks/r.marks,prev:o===null?ze?{title:`Overview`,onGo:et}:null:t(o),next:t(e(1))}},[Ke,Be,qe,u,ke,Me,Ue,Ye,On,$e,et,Re,ze]),jn=r===`waiting`?`noagent`:l??`quiet`;return t?(0,S.jsxs)(`div`,{className:`center-note`,children:[(0,S.jsx)(Va,{size:44,className:`center-mark`}),(0,S.jsx)(`div`,{className:`shimmer`}),(0,S.jsx)(`div`,{className:`shimmer shimmer-short`}),`Reading the changeset…`]}):n?(0,S.jsxs)(`div`,{className:`center-note center-note-error`,children:[(0,S.jsx)(Et,{}),(0,S.jsx)(H,{name:`alert`,size:`lg`}),(0,S.jsx)(`h2`,{children:`Diffo couldn't read this changeset`}),(0,S.jsx)(`p`,{children:n.message}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:()=>location.reload(),children:`Try again`})]}):e?(0,S.jsx)(ls.Provider,{value:Ce,children:(0,S.jsxs)(`div`,{className:`layout`,children:[(0,S.jsx)(lo,{changeset:e,agent:{presence:r,reason:i,since:a,activity:vt,onInvite:()=>R(!0),batch:mt,suggestion:!Ae&&l===null&&F?.layersSuggested?{reason:F.layersSuggested.reason,onOutline:rt}:void 0,monitorOpen:yt,onOpenMonitor:bt,monitorPanel:(0,S.jsx)(Pc,{stillTo:ft.stillTo,back:ft.back,onOpen:e=>{bt(!1),bn(xn(e))},onClose:()=>bt(!1)})},review:{openComments:Vt,publicDrafts:U,onFinishReview:()=>ce(!0)},settings:{theme:z,onSetTheme:pe,critter:me,onSetCritter:he,...ge.status?{onShowPrivacy:()=>ve(!0)}:{},onShowShortcuts:()=>fe(!0)}}),(0,S.jsxs)(`div`,{ref:ee,className:`body${D?` nav-hidden`:``}${j?` rail-dragging`:``}`,style:{"--rail-w":`${N.current}px`},children:[(0,S.jsx)(cs,{tab:ye,onSetTab:be,fileCount:e.files.length,wantsYou:Tt,threadCount:Dt,settledCount:Ot,layerCount:Ae?On:null,layersSuggested:F?.layersSuggested!==void 0,layers:Ae?(0,S.jsx)(os,{layers:Me,activeIndex:Ue,onPick:$e,viewed:u,guide:Le,description:Re,overviewActive:Be,onOpenGuide:ze?et:void 0,threads:wt,attention:St,changed:De.changed,selectedPath:W,onPickFile:fn,onToggleFileViewed:un,onMarkFiles:_n,onClearFiles:vn,onAskFile:e=>{it(e),ie(e)},onRefresh:we?rt:void 0,request:we?l:null}):(0,S.jsx)(ss,{state:jn,onOutline:rt,onInvite:()=>R(!0)}),files:(0,S.jsx)(ts,{files:Oe,viewed:u,selectedPath:W,onPickFile:fn,onToggleFileViewed:un,onMarkFiles:_n,onClearFiles:vn,onAskFile:e=>{it(e),ie(e)},threads:wt,attention:St,changed:De.changed,query:B.query,onQuery:B.setQuery,focusTick:xe,hideReviewed:B.hideReviewed,onHideReviewed:B.setHideReviewed,hideTests:B.hideTests,onHideTests:B.setHideTests,onlyChanged:Te,onOnlyChanged:Ee}),threads:(0,S.jsx)(cd,{items:dt,pastItems:xt,pr:Ce!==null,selectedThreadId:Rt,totalThreads:F?.threads.length??0,onOpen:e=>bn(xn(e,e.gone===!0)),onResolve:te.resolve,onReopen:te.reopen,onDelete:te.remove,onClearAll:()=>ue(!0)})}),(0,S.jsx)(`div`,{className:`rail-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize file list`,"aria-valuemin":Yd,"aria-valuemax":Xd,"aria-valuenow":k,tabIndex:0,"data-tip":`Drag to resize · double-click (or Home) to reset`,onPointerDown:tn,onDoubleClick:nn,onKeyDown:e=>{e.key===`ArrowLeft`?(e.preventDefault(),en(N.current-16)):e.key===`ArrowRight`?(e.preventDefault(),en(N.current+16)):(e.key===`Home`||e.key===`Enter`)&&(e.preventDefault(),nn())}}),(0,S.jsx)(xu,{files:at,delta:Tn,landed:Jt,sinceReview:De.changedHunkIds,hasMore:Xe<Je.length,onLoadMore:Qe,layer:kn,overview:Ke&&Be,controls:{layer:An,navHidden:D,onToggleNav:an,left:g.total-g.viewed,total:g.total,hunksRead:h.viewed,hunksTotal:h.total,hunkAt:y?En.findIndex(e=>e.id===y)+1:0,hunkCount:En.length,query:B.query,onClearQuery:()=>B.setQuery(``),hiddenQuery:Ke?0:B.hiddenQuery,hideReviewed:B.hideReviewed,onHideReviewed:B.setHideReviewed,hideTests:B.hideTests,onHideTests:B.setHideTests,testCount:B.testCount,onlyChanged:B.onlyChanged,onOnlyChanged:B.setOnlyChanged,changedCount:B.changedCount,hiddenTests:Ke?qe?.hidden??0:B.hiddenTests,hiddenReviewed:Ke?0:B.hiddenReviewed,hiddenUnchanged:Ke?0:B.hiddenUnchanged,pinned:B.pinned,onSweep:B.unpin,onShowAll:B.showAll,scopeLeft:B.scope.left,scopeTotal:B.scope.total,excludedTests:B.scope.excludedTests,excludedUnchanged:B.scope.excludedUnchanged,onIncludeExcluded:()=>{B.scope.excludedTests>0&&B.setHideTests(!1),B.scope.excludedUnchanged>0&&Ee(!1)},onFinish:()=>ce(!0),stats:e.stats,unsent:Vt,viewMode:_,onSetViewMode:v,allCollapsed:T.size>=e.files.length&&e.files.length>0,onToggleCollapseAll:()=>E(t=>t.size>=e.files.length?new Set:new Set(e.files.map(e=>e.path)))},viewed:u,onToggleFileViewed:un,selectedId:y,onSelect:b,viewMode:_,collapsed:T,onToggleCollapsed:sn,comments:gn})]}),se&&(e.pr?(0,S.jsx)(Tu,{coverage:Gt,presence:r,onFinish:$t,onInvite:()=>{ce(!1),R(!0)},onClose:()=>ce(!1)}):(0,S.jsx)(Ft,{coverage:Gt,presence:r,checkOff:Yt,onResolve:Zt,onReopen:Qt,onFinish:$t,onInvite:()=>{ce(!1),R(!0)},onClose:()=>ce(!1)})),le&&(0,S.jsx)(Mt,{total:F?.threads.length??0,past:ct.length,outdated:ct.filter(e=>e.github?.outdated===!0).length,onClear:Kt,onClose:()=>ue(!1)}),(0,S.jsx)(kt,{notices:Cn.notices,onOpen:Cn.open,onDismiss:Cn.dismiss,onClear:Cn.clear,onOpenMonitor:()=>bt(!0)}),ge.status&&(0,S.jsx)(Z,{status:ge.status,onShown:ge.markShown,onAcknowledge:ge.acknowledge}),_e&&ge.status&&(0,S.jsx)(Rc,{status:ge.status,onSetEnabled:ge.setEnabled,onClose:()=>ve(!1)}),de&&(0,S.jsx)(Cu,{onClose:()=>fe(!1)}),L&&(0,S.jsx)(uo,{presence:r,reason:i,onClose:()=>R(!1)}),(0,S.jsx)(Lu,{files:e?.files??af,onJump:mn})]})}):null}function uf(){return(0,S.jsxs)(T,{client:Kd,children:[(0,S.jsx)(Et,{}),(0,S.jsx)(lf,{})]})}var df=400,ff=300;function pf(){let e=(0,x.useRef)(null);return(0,x.useEffect)(()=>{let t=e.current;if(!t)return;let n=null,r=!1,i,a=-1/0,o=null,s=()=>{if(!n)return;let e=n.getAttribute(`data-tip`);if(!e){l();return}t.textContent=e;let r=n.getBoundingClientRect(),i=t.offsetWidth,a=t.offsetHeight,o=Math.max(8,Math.min(r.left+r.width/2-i/2,window.innerWidth-i-8)),s=r.top-a-7,c=s<8?r.bottom+7:s;t.style.left=`${Math.round(o)}px`,t.style.top=`${Math.round(c)}px`},c=()=>{n&&(r=!0,o?.disconnect(),o=new MutationObserver(s),o.observe(n,{attributes:!0,attributeFilter:[`data-tip`]}),s(),r&&t.classList.add(`tip-on`))},l=()=>{i!==void 0&&clearTimeout(i),i=void 0,o?.disconnect(),o=null,r&&(a=performance.now()),r=!1,n=null,t.classList.remove(`tip-on`)},u=(e,t)=>{if(e===n)return;let o=r||performance.now()-a<ff;l(),n=e,t||o?c():i=setTimeout(c,df)},d=e=>{let t=e.target.closest?.(`[data-tip]`);t instanceof HTMLElement?u(t,!1):l()},f=e=>{let t=e.target.closest?.(`[data-tip]`);t instanceof HTMLElement&&t.matches(`:focus-visible`)?u(t,!0):l()},p=()=>{requestAnimationFrame(()=>{n&&!n.isConnected?l():s()})},m=e=>{e.key===`Escape`&&l()};return document.addEventListener(`pointerover`,d,!0),document.addEventListener(`focusin`,f,!0),document.addEventListener(`focusout`,l,!0),document.addEventListener(`click`,p,!0),document.addEventListener(`scroll`,l,!0),document.addEventListener(`keydown`,m,!0),window.addEventListener(`resize`,l),()=>{l(),document.removeEventListener(`pointerover`,d,!0),document.removeEventListener(`focusin`,f,!0),document.removeEventListener(`focusout`,l,!0),document.removeEventListener(`click`,p,!0),document.removeEventListener(`scroll`,l,!0),document.removeEventListener(`keydown`,m,!0),window.removeEventListener(`resize`,l)}},[]),(0,S.jsx)(`div`,{ref:e,className:`tip`,"aria-hidden":`true`})}Td(Cd()),(0,rt.createRoot)(document.getElementById(`root`)).render((0,S.jsxs)(x.StrictMode,{children:[(0,S.jsx)(uf,{}),(0,S.jsx)(pf,{})]}));export{u as a,s as i,pr as n,l as o,o as r,X as t};
|