@acemarke/diffloupe 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,r as n,t as r}from"./react-jlQz0HNM.js";import{a as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./diffs-D52k9AsX.js";import{a as d,c as f,i as p,l as m,n as h,o as g,r as _,s as v,t as y,u as b}from"./router-DvNvfdSS.js";import{a as x,c as S,i as C,l as w,n as ee,o as te,r as T,s as E,t as ne,u as D}from"./state-a-GRkbSP.js";import{t as O}from"./arktype-bg7F_Ihs.js";(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 k=e(n(),1),re=r(),A=S.withTypes(),j=w.withTypes(),ie=D.withTypes(),ae=`diffloupe:view`,oe={diffStyle:`split`,wrap:!1,theme:`system`,fileTreeLayout:`tree`,sidebar:!0,collapsedFiles:{},collapsedGroups:{}};function se(){try{let e=JSON.parse(localStorage.getItem(`diffloupe:view`)??`{}`);if(!e||typeof e!=`object`)return{};let t=e,n={};return(t.diffStyle===`split`||t.diffStyle===`unified`)&&(n.diffStyle=t.diffStyle),typeof t.wrap==`boolean`&&(n.wrap=t.wrap),(t.theme===`system`||t.theme===`light`||t.theme===`dark`)&&(n.theme=t.theme),(t.fileTreeLayout===`tree`||t.fileTreeLayout===`list`)&&(n.fileTreeLayout=t.fileTreeLayout),typeof t.sidebar==`boolean`&&(n.sidebar=t.sidebar),n}catch{return{}}}function ce(e,t){let n=e??[];return n.includes(t)?n.filter(e=>e!==t):[...n,t]}var M=x({name:`view`,initialState:()=>({...oe,...se()}),reducers:{diffStyleSet(e,t){e.diffStyle=t.payload},wrapToggled(e){e.wrap=!e.wrap},themeSet(e,t){e.theme=t.payload},fileTreeLayoutSet(e,t){e.fileTreeLayout=t.payload},sidebarToggled(e){e.sidebar=!e.sidebar},filesCollapsedSet(e,t){e.collapsedFiles[t.payload.runId]=t.payload.paths},fileCollapseToggled(e,t){let{runId:n,path:r}=t.payload;e.collapsedFiles[n]=ce(e.collapsedFiles[n],r)},fileExpanded(e,t){let{runId:n,path:r}=t.payload,i=e.collapsedFiles[n];i?.includes(r)&&(e.collapsedFiles[n]=i.filter(e=>e!==r))},groupFoldToggled(e,t){let{runId:n,groupId:r}=t.payload;e.collapsedGroups[n]=ce(e.collapsedGroups[n],r)}},selectors:{selectSavedView:e=>({diffStyle:e.diffStyle,wrap:e.wrap,theme:e.theme,fileTreeLayout:e.fileTreeLayout,sidebar:e.sidebar}),selectDiffStyle:e=>e.diffStyle,selectWrap:e=>e.wrap,selectTheme:e=>e.theme,selectFileTreeLayout:e=>e.fileTreeLayout,selectSidebar:e=>e.sidebar,selectCollapsedFiles:(e,t)=>e.collapsedFiles[t],selectCollapsedGroups:(e,t)=>e.collapsedGroups[t]}}),{diffStyleSet:le,wrapToggled:ue,themeSet:de,fileTreeLayoutSet:fe,sidebarToggled:pe,filesCollapsedSet:me,fileCollapseToggled:he,fileExpanded:ge,groupFoldToggled:_e}=M.actions,{selectSavedView:ve,selectDiffStyle:ye,selectWrap:be,selectTheme:xe,selectFileTreeLayout:Se,selectSidebar:Ce,selectCollapsedFiles:we,selectCollapsedGroups:Te}=M.selectors,Ee={message:`_message_1k4pr_1`,error:`_error_1k4pr_15`,actions:`_actions_1k4pr_26`,button:`_button_1k4pr_32`},N=t(),De=()=>null;function Oe(){let e=j(xe);(0,k.useEffect)(()=>{let t=document.documentElement;e===`system`?delete t.dataset.theme:t.dataset.theme=e},[e])}function ke(){return Oe(),(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(_,{}),(0,N.jsx)(k.Suspense,{children:(0,N.jsx)(De,{position:`bottom-right`})})]})}function Ae(){return(0,N.jsxs)(`main`,{className:Ee.message,children:[(0,N.jsx)(`h1`,{children:`Not found`}),(0,N.jsx)(`p`,{children:`There is nothing at this address.`}),(0,N.jsx)(v,{to:`/`,children:`Back to runs`})]})}function je({error:e}){let t=m();return(0,N.jsxs)(`main`,{className:Ee.message,children:[(0,N.jsx)(`h1`,{children:`Something went wrong`}),(0,N.jsx)(`pre`,{className:Ee.error,children:Me(e)}),(0,N.jsxs)(`div`,{className:Ee.actions,children:[(0,N.jsx)(`button`,{type:`button`,className:Ee.button,onClick:()=>void t.invalidate(),children:`Retry`}),(0,N.jsx)(v,{to:`/`,children:`Back to runs`})]})]})}function Me(e){if(e instanceof Error)return e.message;if(e&&typeof e==`object`){let t=e;if(t.data&&typeof t.data==`object`&&`error`in t.data)return String(t.data.error);if(typeof t.error==`string`)return t.error;if(t.status!==void 0)return`Request failed (${String(t.status)})`}return String(e)}var Ne=p()({component:ke,notFoundComponent:Ae,errorComponent:je});function Pe(e){let t=new Map;for(let n of s(e))for(let e of n.files)t.set(e.name,e);return t}var Fe=new Map;function Ie(e,t){let n=Fe.get(e);if(n&&n.patch===t)return n.files;let r=Pe(t);return Fe.set(e,{patch:t,files:r}),r}var P={dialog:`_dialog_14w5c_1`,header:`_header_14w5c_16`,title:`_title_14w5c_20`,hint:`_hint_14w5c_26`,text:`_text_14w5c_31`,keys:`_keys_14w5c_43`,key:`_key_14w5c_43`,actions:`_actions_14w5c_70`,button:`_button_14w5c_76`};function Le({text:e,onClose:t}){let n=(0,k.useRef)(null),r=(0,k.useRef)(null);return(0,k.useEffect)(()=>{n.current?.showModal(),r.current?.select()},[]),(0,N.jsxs)(`dialog`,{ref:n,className:P.dialog,"aria-labelledby":`copy-fallback-title`,onClose:t,children:[(0,N.jsx)(`header`,{className:P.header,children:(0,N.jsx)(`h2`,{id:`copy-fallback-title`,className:P.title,children:`Copy this text`})}),(0,N.jsx)(`p`,{className:P.hint,children:`The browser blocked clipboard access. The text is selected; press Ctrl+C or ⌘C.`}),(0,N.jsx)(`textarea`,{ref:r,className:P.text,readOnly:!0,value:e,rows:16}),(0,N.jsx)(`div`,{className:P.actions,children:(0,N.jsx)(`button`,{type:`button`,className:P.button,onClick:()=>n.current?.close(),children:`Close`})})]})}var Re=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`m213.66 101.66l-80 80a8 8 0 0 1-11.32 0l-80-80a8 8 0 0 1 11.32-11.32L128 164.69l74.34-74.35a8 8 0 0 1 11.32 11.32`})]})),ze=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`m181.66 133.66l-80 80a8 8 0 0 1-11.32-11.32L164.69 128L90.34 53.66a8 8 0 0 1 11.32-11.32l80 80a8 8 0 0 1 0 11.32`})]})),Be={blocker:`Blocker`,"should-fix":`Should fix`,"nice-to-have":`Nice to have`,question:`Question`};function Ve(e){switch(e.kind){case`pr`:return`#${e.number} ${e.title}`;case`staged`:return e.branch?`Staged changes on ${e.branch}`:`Staged changes`;case`worktree`:return e.branch?`Working tree on ${e.branch}`:`Working tree`;default:return`${e.kind[0].toUpperCase()}${e.kind.slice(1)} ${e.spec}`}}function He(e){return e===0?`$0`:e<.01?`<$0.01`:`$${e.toFixed(2)}`}function Ue(e){let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${String(t%60).padStart(2,`0`)}s`}var We=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function Ge(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:We.format(t)}function Ke(e,t=Date.now()){let n=(t-new Date(e).getTime())/1e3;return Number.isFinite(n)?n<60?`just now`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:n<604800?`${Math.floor(n/86400)}d ago`:Ge(e):e}function F(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function qe(e){return/^[0-9a-f]{40}$/i.test(e)?e.slice(0,12):e}function Je(e,t,n){return e.filter(e=>e.bottom>t&&e.top<n).map(e=>e.id)}function Ye(e,t,n){if(e.length===0||t<=n)return null;let r=e[0];for(let t of e){if(t.top>n)break;r=t}return r.path}var Xe={groups:[],files:{}},Ze=`[data-app-header]`,Qe=`[data-group-section]`,$e=`[data-file-start]`;function et(){let e=document.querySelector(Ze);return e?Math.max(0,e.getBoundingClientRect().bottom):0}function tt(){let e=et(),t=window.innerHeight,n=[...document.querySelectorAll(Qe)].map(e=>{let t=e.getBoundingClientRect();return{id:e.dataset.groupSection??``,top:t.top,bottom:t.bottom,el:e}}),r=Je(n,e,t),i={};for(let t of n){if(!r.includes(t.id))continue;let n=Ye([...t.el.querySelectorAll($e)].map(e=>({path:e.dataset.path??``,top:e.getBoundingClientRect().top})),t.bottom,e);n!==null&&(i[t.id]=n)}return{groups:r,files:i}}var nt=(e,t)=>e.groups.length===t.groups.length&&e.groups.every((e,n)=>e===t.groups[n])&&Object.keys(e.files).length===Object.keys(t.files).length&&Object.entries(e.files).every(([e,n])=>t.files[e]===n);function rt(e,t){let[n,r]=(0,k.useState)(Xe);return(0,k.useEffect)(()=>{if(!e)return;let t=0,n=()=>{t=0;let e=tt();r(t=>nt(t,e)?t:e)},i=()=>{t===0&&(t=requestAnimationFrame(n))};i(),document.addEventListener(`scroll`,i,{capture:!0,passive:!0}),window.addEventListener(`resize`,i);let a=new ResizeObserver(i);return a.observe(document.body),()=>{document.removeEventListener(`scroll`,i,{capture:!0}),window.removeEventListener(`resize`,i),a.disconnect(),t!==0&&cancelAnimationFrame(t)}},[e,t]),n}var it=e=>`group-${e}`;function at(e){document.getElementById(it(e))?.scrollIntoView({behavior:`smooth`,block:`start`})}function ot(e,t,n=8){let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();i.top<r.top+n?e.scrollTop-=r.top+n-i.top:i.bottom>r.bottom-n&&(e.scrollTop+=i.bottom-(r.bottom-n))}function st(e,t){return document.getElementById(it(e))?.querySelector(`[data-file-start][data-path="${CSS.escape(t)}"]`)??null}function ct(e,t,n={}){let r=0,i=()=>{let a=st(e,t);if(!a)return;let o=a.getBoundingClientRect().top-et();Math.abs(o)>2&&window.scrollBy({top:o,behavior:`instant`}),++r<6&&(r<2||Math.abs(o)>2)?requestAnimationFrame(i):n.focus&&a.focus({preventScroll:!0})};requestAnimationFrame(i)}var lt=120;function ut(e,t,n){let r=0,i=0,a=!1,o=()=>{if(++r>90)return;let s=document.getElementById(n);if(s&&s.getClientRects().length>0){let e=s.getBoundingClientRect().top-et()-lt;Math.abs(e)>2?(window.scrollBy({top:e,behavior:`instant`}),i=0):i++,i<2?requestAnimationFrame(o):s.focus({preventScroll:!0});return}let c=st(e,t);if(c){if(!a)a=!0,window.scrollBy({top:c.getBoundingClientRect().top-et(),behavior:`instant`});else if(r%3==0){if((c.nextElementSibling?.getBoundingClientRect().bottom??0)<=window.innerHeight)return;window.scrollBy({top:window.innerHeight*.8,behavior:`instant`})}requestAnimationFrame(o)}};requestAnimationFrame(o)}function dt(){let e=et()+4,t=null;for(let n of document.querySelectorAll(`[data-file-start]`))if(n.getBoundingClientRect().top<=e)t=n;else break;let n=t?.closest(`[data-group-section]`),r=t?.dataset.path;return n?.dataset.groupSection&&r?{groupId:n.dataset.groupSection,path:r}:null}var ft={stats:`_stats_1audl_1`,add:`_add_1audl_9`,del:`_del_1audl_13`,binary:`_binary_1audl_17`};function I({additions:e,deletions:t,binary:n}){return n&&e===0&&t===0?(0,N.jsx)(`span`,{className:ft.binary,children:`binary`}):(0,N.jsxs)(`span`,{className:ft.stats,children:[(0,N.jsxs)(`span`,{className:ft.add,children:[`+`,e]}),(0,N.jsxs)(`span`,{className:ft.del,children:[`-`,t]})]})}var pt=O(`'running' | 'complete' | 'failed' | 'cancelled'`),mt=O({kind:`'pr'`,number:`number`,url:`string`,title:`string`,author:`string`,baseRef:`string`,headRef:`string`,state:`string`,isDraft:`boolean`}).or({kind:`'range' | 'branch' | 'commit'`,spec:`string`}).or({kind:`'staged' | 'worktree'`,"branch?":`string`}),ht=O(`'additions' | 'deletions'`),gt=O(`'not-in-diff' | 'far-from-diff' | 'no-line' | 'deleted-file' | 'no-hunks'`),_t=O({file:`string`,side:ht,kind:`'line' | 'nearby' | 'file'`,line:`number`,"endLine?":`number`,cited:{line:`number`,"endLine?":`number`},"text?":`string`,"reason?":gt}),vt=O(`'added' | 'removed' | 'modified' | 'renamed' | 'copied'`),yt=O(`'product' | 'deploy' | 'tooling'`),bt=O({path:`string`,"previousPath?":`string`,status:vt,additions:`number`,deletions:`number`,isBinary:`boolean`,"blob?":`string`,groupId:`string`,classification:`'code' | 'docs' | 'skip'`,"surface?":yt}),xt=O(`'bug' | 'wrench' | 'path' | 'flask' | 'doc' | 'gear'`),St=O({id:`string`,"parentId?":`string`,title:`string`,"summary?":`string`,"icon?":xt,files:`string[]`,findingIds:`string[]`,stopIds:`string[]`,critical:`boolean`}),Ct=O({id:`string`,chapterId:`string`,index:`number`,title:`string`,"prose?":`string`,importance:`'critical' | 'normal' | 'context'`,locations:_t.and({"label?":`string`}).array()}),wt=O(`'blocker' | 'should-fix' | 'nice-to-have' | 'question'`),Tt=O({id:`string`,file:`string`,anchor:_t,severity:wt,category:`string`,title:`string`,explanation:`string`,evidence:`string`,"impact?":`string`,confidence:`'high' | 'medium' | 'low'`,"effort?":`'quick' | 'moderate' | 'involved'`,"suggestion?":`string`,"suggestedCode?":`string`,"crossFileRefs?":O({file:`string`,"line?":`number`}).array(),"repeatOf?":`number`,"carriedFrom?":`string`,"surface?":yt,"preexisting?":`boolean`}),Et=O({input:`number`,output:`number`,reasoning:`number`,cacheRead:`number`,cacheWrite:`number`,"firstStep?":{input:`number`,cacheRead:`number`,cacheWrite:`number`}}),Dt=O({unit:`string`,part:`number`,parts:`number`,status:`'ok' | 'failed'`,costUsd:`number`,wallMs:`number`,"usage?":Et}),Ot=O({costUsd:`number`,wallMs:`number`,"usage?":Et}),kt=O({root:`string`,"slug?":`string`,"remote?":`boolean`}),At=O(`'review' | 'diff'`);function jt(e){return e.meta.kind??`review`}var Mt=O({id:`string`,acted:`boolean`,control:`boolean`}),Nt=O({schemaVersion:`1`,id:`string`,status:pt,createdAt:`string`,repo:kt,target:mt,base:`string`,head:`string`,intent:{"stated?":`string`,"inferred?":`string`,"alignment?":`'aligned' | 'partial' | 'misaligned'`,"matches?":`string[]`,"mismatches?":`string[]`,"unstated?":`string[]`,"missing?":`string[]`},overview:{"focus?":`string`,"changeType?":`string`,startHere:O({file:`string`,why:`string`}).array()},files:bt.array(),groups:St.array(),stops:Ct.array(),findings:Tt.array(),overCapFindings:Tt.array(),resolved:O({id:`string`,"note?":`string`,"title?":`string`,"file?":`string`}).array(),unreviewed:{overCap:`string[]`,failed:`string[]`,"budget?":`string[]`},meta:{"model?":`string`,"effort?":`string`,"models?":{"review?":{model:`string`,"source?":`string`},"coordinator?":{model:`string`,"source?":`string`},"walkthrough?":{model:`string`,"source?":`string`},"intent?":{model:`string`,"source?":`string`}},"kind?":At,wallMs:`number`,costUsd:`number`,slices:Dt.array(),"stages?":{"coordinator?":Ot,"walkthrough?":Ot,"intent?":Ot},rejectedCount:`number`,coreSource:`string`,"mergeMode?":`'coordinator' | 'nothing-to-merge' | 'deterministic-fallback'`,"budgetStopped?":`boolean`,"reviewScope?":`'full' | 'incremental'`,"reviewedFiles?":`number`,"scopeReason?":`string`,"promptVersion?":`string`,"instructionsHash?":`string`},untrackedSkipped:`string[]`,"priorRunId?":`string`,"round?":`number`,"priorActedOn?":Mt.array(),"error?":`string`}),Pt=O(`'open' | 'accepted' | 'dismissed'`),Ft=O(`'wrong' | 'not-worth-fixing' | 'already-handled' | 'duplicate' | 'other'`),It=[`wrong`,`not-worth-fixing`,`already-handled`,`duplicate`,`other`],Lt=O({reason:Ft,"note?":`string`,at:`string`}),Rt=O({reviewedFiles:O.Record(`string`,`string`),findingStatus:O.Record(`string`,Pt),"findingNotes?":O.Record(`string`,Lt),comments:O({id:`string`,file:`string`,side:ht,line:`number`,"endLine?":`number`,body:`string`}).array(),"submitted?":{at:`string`,"url?":`string`}}),zt=O({id:`string`,status:pt,createdAt:`string`,target:mt,repo:kt,"kind?":At,findingCounts:{blocker:`number`,"should-fix":`number`,"nice-to-have":`number`,question:`number`},costUsd:`number`,"invalid?":`string`}),Bt=class extends Error{constructor(e){super(e),this.name=`StateOpError`}};function Vt(){return{reviewedFiles:{},findingStatus:{},comments:[]}}var Ht=/^0+$/;function Ut(e,t,n){let r=t.filter(e=>!n.has(e));if(r.length>0)throw new Bt(`unknown ${e}: ${r.join(`, `)}`)}function Wt(e,t,n){if(t.op===`reviewed`){let r=new Map(n.files.map(e=>[e.path,e]));Ut(t.paths.length===1?`file`:`files`,t.paths,new Set(r.keys()));let i={...e.reviewedFiles};for(let e of t.paths){let n=r.get(e);t.value?i[e]=n?.status===`removed`||!n?.blob||Ht.test(n.blob)?``:n.blob:delete i[e]}return{...e,reviewedFiles:i}}if(t.ids.length===0)throw new Bt(`no finding ids given`);let r=new Set([...n.findings,...n.overCapFindings].map(e=>e.id));if(Ut(t.ids.length===1?`finding`:`findings`,t.ids,r),t.status===`dismissed`&&!t.reason)throw new Bt(`dismissing a finding needs a reason`);let i={...e.findingStatus},a={...e.findingNotes};for(let e of t.ids)delete a[e],t.status===`open`?delete i[e]:i[e]=t.status,t.status===`dismissed`&&t.reason&&(a[e]={reason:t.reason,...t.note?{note:t.note}:{},at:t.at});let o={...e,findingStatus:i,findingNotes:a};return Object.keys(a).length===0&&delete o.findingNotes,o}O({"+":`reject`,"target?":`string`,"repo?":`string`,"base?":`string`,"intent?":`string`,"models?":{"+":`reject`,"review?":`string`,"coordinator?":`string`,"walkthrough?":`string`,"intent?":`string`},"effort?":`string`,"maxCostUsd?":`number > 0`,"settingsFile?":`string`,"kind?":At,"walkthrough?":`boolean`,"fromRun?":`string`,"full?":`boolean`,"github?":`boolean`,"head?":/^[0-9a-fA-F]{40}$/});var Gt=O({id:`string`,url:`string`});O({status:Pt,"reason?":Ft,"note?":`string`}),O({path:`string`,reviewed:`boolean`});var Kt=O(`'resolving_target' | 'checking_registry' | 'building_map' | 'grouping' | 'reviewing' | 'coordinating' | 'walkthrough' | 'verifying' | 'writing'`),qt=O({type:`'stage'`,stage:Kt}).or({type:`'slice'`,index:`number`,total:`number`,title:`string`,status:`'started' | 'ok' | 'failed'`,"costUsd?":`number`,"wallMs?":`number`,"findings?":`number`}).or({type:`'log'`,message:`string`}).or({type:`'cost'`,totalUsd:`number`}).or({type:`'budget'`,totalUsd:`number`,limitUsd:`number`,skippedSlices:`number`}),Jt=O({type:`'groups'`,groups:St.array(),files:O({path:`string`,groupId:`string`,classification:`'code' | 'docs' | 'skip'`}).array()}),Yt=qt.or(Jt).or({type:`'done'`,status:`'complete'`,findings:`number`,"carriedOver?":`number`,costUsd:`number`,wallMs:`number`,"noChanges?":`boolean`,"kind?":At,"files?":`number`}).or({type:`'cancelled'`}).or({type:`'error'`,message:`string`}).and({seq:`number`,at:`string`}),Xt=O({app:`'diffloupe'`,version:`string`,pid:`number`,defaultRepo:`string | null`,activeRunId:`string | null`,gh:{available:`boolean`,authed:`boolean`,"message?":`string`},opencode:{path:`string | null`,version:`string | null`}});O({error:`string`,"activeRunId?":`string`});function Zt(e,t){let n=new Map(t.files.map(e=>[e.path,e]));return{...e,groups:t.groups,files:e.files.map(e=>{let t=n.get(e.path);return t?{...e,groupId:t.groupId,classification:t.classification}:e})}}var Qt=[`stage`,`slice`,`log`,`cost`,`budget`,`done`,`cancelled`,`error`],$t=new Set([`done`,`cancelled`,`error`]);function en(e,t){let n=new EventSource(`/api/runs/${encodeURIComponent(e)}/events`),r=!1,i=()=>{r||(r=!0,n.close(),t.onEnd())},a=r=>{if(!(r instanceof MessageEvent)){n.readyState===EventSource.CLOSED&&i();return}let a;try{a=JSON.parse(String(r.data))}catch{console.warn(`[diffloupe] run ${e}: event is not JSON`,r.data);return}let o=Yt(a);o instanceof O.errors?console.warn(`[diffloupe] run ${e}: skipping malformed event: ${o.summary}`):(t.onEvent(o),$t.has(o.type)&&i())};for(let e of Qt)n.addEventListener(e,a);return n.addEventListener(`end`,i),()=>{r=!0,n.close()}}var tn=O(`string > 0`),nn=()=>({slicesTotal:0,slicesDone:0,slicesFailed:0,activeSlices:[],costUsd:0}),L=ne({reducerPath:`api`,baseQuery:ee({baseUrl:`/api`}),tagTypes:[`Run`,`RunList`,`RunState`],onSchemaFailure:(e,t)=>{console.error(`[diffloupe] ${t.endpoint} ${e.schemaName} failed:`,e.issues)},catchSchemaFailure:(e,t)=>({status:`CUSTOM_ERROR`,error:`${t.endpoint} returned data that does not match the expected shape: ${e.message}`}),endpoints:e=>({getHealth:e.query({query:e=>`/health`,responseSchema:Xt}),listRuns:e.query({query:e=>`/runs`,responseSchema:zt.array(),providesTags:[`RunList`]}),getRun:e.query({query:e=>`/runs/${encodeURIComponent(e)}`,argSchema:tn,responseSchema:Nt,providesTags:(e,t,n)=>[{type:`Run`,id:n}],async onCacheEntryAdded(e,{cacheDataLoaded:t,cacheEntryRemoved:n,updateCachedData:r,dispatch:i,getCacheEntry:a}){try{await t}catch{return}if(a().data?.status!==`running`)return;let o=en(e,{onEvent(e){e.type===`groups`?r(t=>{let n=Zt(t,e);t.groups=n.groups,t.files=n.files}):r(t=>{let n=t.progress??=nn();switch(e.type){case`stage`:n.stage=e.stage;break;case`slice`:n.slicesTotal=e.total,e.status===`started`?n.activeSlices.push(e.title):(n.activeSlices=n.activeSlices.filter(t=>t!==e.title),e.status===`ok`?n.slicesDone+=1:n.slicesFailed+=1),e.costUsd!==void 0&&(n.costUsd=Math.max(n.costUsd,e.costUsd));break;case`cost`:n.costUsd=e.totalUsd;break;case`log`:n.lastMessage=e.message;break;case`budget`:n.lastMessage=`Budget reached: $${e.totalUsd.toFixed(2)} of $${e.limitUsd.toFixed(2)}`}})},onEnd(){i(L.util.invalidateTags([{type:`Run`,id:e},{type:`RunState`,id:e},`RunList`]))}});await n,o()}}),getRunPatch:e.query({query:e=>({url:`/runs/${encodeURIComponent(e)}/diff`,responseHandler:`text`}),argSchema:tn,providesTags:(e,t,n)=>[{type:`Run`,id:n}]}),getRunState:e.query({query:e=>`/runs/${encodeURIComponent(e)}/state`,argSchema:tn,responseSchema:Rt,providesTags:(e,t,n)=>[{type:`RunState`,id:n}]}),updateRunState:e.mutation({query:({runId:e,op:t})=>{let n=`/runs/${encodeURIComponent(e)}/state`;if(t.op===`reviewed`)return{url:`${n}/files`,method:`PUT`,body:{path:t.paths[0],reviewed:t.value}};let{status:r,reason:i,note:a}=t;return{url:`${n}/findings/${encodeURIComponent(t.ids[0]??``)}`,method:`PUT`,body:{status:r,...i?{reason:i}:{},...a?{note:a}:{}}}},responseSchema:Rt,async onQueryStarted({runId:e,op:t},{dispatch:n,getState:r,queryFulfilled:i}){let a=L.endpoints.getRun.select(e)(r()).data,o=a?n(L.util.updateQueryData(`getRunState`,e,e=>{try{return Wt(e,t,a)}catch{return e}})):void 0;try{let{data:t}=await i;n(L.util.upsertQueryData(`getRunState`,e,t))}catch{o?.undo()}}}),startRun:e.mutation({query:e=>({url:`/runs`,method:`POST`,body:e}),responseSchema:Gt,invalidatesTags:[`RunList`]}),deleteRun:e.mutation({query:e=>({url:`/runs/${encodeURIComponent(e)}`,method:`DELETE`}),argSchema:tn,invalidatesTags:[`RunList`]})})}),{useGetHealthQuery:rn,useListRunsQuery:an,useGetRunQuery:on,useGetRunPatchQuery:sn,useGetRunStateQuery:cn,useUpdateRunStateMutation:ln,useStartRunMutation:un,useDeleteRunMutation:dn}=L,fn=Vt();function pn(e){return cn(e).data??fn}function mn(e){let t=pn(e);return(0,k.useMemo)(()=>new Set(Object.entries(t.findingStatus).flatMap(([e,t])=>t===`dismissed`?[e]:[])),[t.findingStatus])}function hn(e){let[t]=ln();return(0,k.useCallback)(n=>void t({runId:e,op:n}),[e,t])}var gn=`(max-width: 639.98px)`,_n=`(min-width: 1024px)`;function vn(e){return(0,k.useSyncExternalStore)(t=>{let n=window.matchMedia(e);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},()=>window.matchMedia(e).matches)}var yn=(0,k.createContext)(null);function R(){let e=(0,k.useContext)(yn);if(!e)throw Error(`useRunNav needs a RunNavContext provider`);return e}var bn={status:`_status_11pfu_1`},xn={added:`A`,removed:`D`,modified:`M`,renamed:`R`,copied:`C`};function Sn({status:e}){return(0,N.jsx)(`span`,{className:bn.status,"data-status":e,title:e,children:xn[e]})}function Cn(e,t=``){let n=e.match(/`+/g)??[],r=Math.max(3,...n.map(e=>e.length+1)),i="`".repeat(r);return`${i}${t}\n${e.replace(/\n$/,``)}\n${i}`}function wn(e){let t=e.match(/`+/g)??[],n=Math.max(1,...t.map(e=>e.length+1)),r="`".repeat(n),i=e.startsWith("`")||e.endsWith("`")?` `:``;return`${r}${i}${e}${i}${r}`}function Tn(e){return e.kind===`pr`?`PR #${e.number} ${e.title}`:`spec`in e?`${e.kind} ${e.spec}`:e.branch?`${e.kind} (${e.branch})`:e.kind}function En(e){if(!e.round||e.round<2)return;let{reviewScope:t,reviewedFiles:n,scopeReason:r}=e.meta;if(t===`incremental`){let t=n??0;return t===0?`Round ${e.round}: no code changed since the last review`:`Round ${e.round}: only the ${t===1?`file`:`${t} files`} changed since the last review ${t===1?`was`:`were`} reviewed again`}return`Round ${e.round}: full review${r?` (${r})`:``}`}var z=[`blocker`,`should-fix`,`nice-to-have`,`question`],Dn={ts:`ts`,mts:`ts`,cts:`ts`,tsx:`tsx`,js:`js`,mjs:`js`,cjs:`js`,jsx:`jsx`,json:`json`,css:`css`,scss:`scss`,html:`html`,md:`md`,py:`python`,rs:`rust`,go:`go`,rb:`ruby`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,h:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,hpp:`cpp`,hh:`cpp`,sh:`sh`,bash:`sh`,yml:`yaml`,yaml:`yaml`,toml:`toml`,sql:`sql`};function On(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n>0?Dn[t.slice(n+1).toLowerCase()]??``:``}function kn(e,t){return t&&t!==e?`${e}-${t}`:`${e}`}function An(e){let t=e.side===`deletions`?` (old)`:``;return e.kind===`file`?e.cited.line>0?`${e.file}:${kn(e.cited.line,e.cited.endLine)}`:e.file:e.kind===`nearby`?`${e.file}:${kn(e.cited.line,e.cited.endLine)}${t}`:`${e.file}:${kn(e.line,e.endLine)}${t}`}function jn(e,t){let n=t?.findingStatus[e.id];if(n===`accepted`)return` (accepted)`;if(n!==`dismissed`)return``;let r=t?.findingNotes?.[e.id]?.reason;return r?` (dismissed: ${r})`:` (dismissed)`}function Mn(e,t,n={}){let r=[`### [${e.severity}] ${e.title}${jn(e,t)}`,`${wn(An(e.anchor))} · id ${wn(e.id)}`],i=t?.findingStatus[e.id]===`dismissed`?t.findingNotes?.[e.id]?.note?.trim():void 0;i&&r.push(`> Dismissed: ${i}`);let a=[!n.github&&e.carriedFrom&&`Open since run ${e.carriedFrom}.`,e.repeatOf!==void 0&&`Repeats PR comment #${e.repeatOf}.`,e.preexisting&&`Pre-existing: not introduced by this change.`].filter(Boolean);return a.length&&r.push(`_${a.join(` `)}_`),r.push(e.explanation.trim()),e.impact?.trim()&&r.push(`**Impact:** ${e.impact.trim()}`),e.evidence.trim()&&r.push(`**Evidence:** ${e.evidence.trim()}`),e.suggestedCode?(e.suggestion?.trim()&&r.push(`**Suggestion:** ${e.suggestion.trim()}`),r.push(Cn(e.suggestedCode,On(e.file)))):e.suggestion?.trim()&&r.push(`**Suggestion:** ${e.suggestion.trim()}`),r.join(`
2
-
3
- `)}function Nn(e){return[...e].sort((e,t)=>z.indexOf(e.severity)-z.indexOf(t.severity)||e.file.localeCompare(t.file)||e.anchor.line-t.anchor.line)}function Pn(e,t,n){let r=(t.length?` ${t.length} pre-existing.`:``)+(n?` ${n} more over the posting cap.`:``);if(e.length===0)return`${t.length?`No issues found in this change.`:`No issues found.`}${r}`;let i=z.map(t=>[t,e.filter(e=>e.severity===t).length]).filter(([,e])=>e>0).map(([e,t])=>`${t} ${e}`),a=e.length;return`${a} finding${a===1?``:`s`}: ${i.join(`, `)}.${r}`}function Fn(e,t){return[`### [${e.severity}] ${e.title}${jn(e,t)}`,`${wn(An(e.anchor))} · id ${wn(e.id)}`].join(`
4
-
5
- `)}function In(e,t={}){let n=En(e),r=[`# Review findings: ${Tn(e.target)}`,`Base ${wn(e.base.slice(0,12))}, head ${wn(e.head.slice(0,12))}${n?`. ${n}.`:``}`],{state:i}=t,a=e=>t.includeDismissed||i?.findingStatus[e.id]!==`dismissed`,o=e.findings.filter(a),s=e.overCapFindings.filter(a),c=t.includeOverCap?s:[],l=o.filter(e=>!e.preexisting),u=o.filter(e=>e.preexisting),d=e.findings.length-o.length+e.overCapFindings.length-s.length;r.push(Pn(l,u,s.length)+(d?` ${d} dismissed finding${d===1?``:`s`} left out.`:``));let f=[Nn(l),Nn(u),Nn(c)],p=Math.min(t.shorten?.count??0,f.flat().length),m=new Set(p>0?f.flat().slice(-p):[]);p>0&&t.shorten&&r.push(t.shorten.note);let h=e=>m.has(e)?Fn(e,i):Mn(e,i,t),[g=[],_=[],v=[]]=f;for(let e of g)r.push(h(e));if(_.length){r.push(`## Pre-existing (not introduced by this change)`);for(let e of _)r.push(h(e))}if(v.length){r.push(`## Over the posting cap (${v.length})`);for(let e of v)r.push(h(e))}return`${r.join(`
6
-
7
- `)}\n`}var Ln=e=>z.indexOf(e.severity);function Rn(e,t){if(e.lineNumber!==t.lineNumber)return e.lineNumber-t.lineNumber;if(e.side!==t.side)return e.side===`deletions`?-1:1;let n=e.metadata,r=t.metadata;return n.kind===r.kind?n.kind===`finding`&&r.kind===`finding`?n.overCap===r.overCap?Ln(n.finding)-Ln(r.finding):n.overCap?1:-1:0:n.kind===`finding`?-1:1}function zn(e,t={}){let n=new Map,r=(e,t)=>{let r=n.get(e.file),i={side:e.side,lineNumber:e.kind===`file`?0:e.line,metadata:t};r?r.push(i):n.set(e.file,[i])},i=e=>!t.hidden?.has(e.id);for(let t of e.findings.filter(i))r(t.anchor,{kind:`finding`,finding:t,overCap:!1});if(t.showOverCap)for(let t of e.overCapFindings.filter(i))r(t.anchor,{kind:`finding`,finding:t,overCap:!0});for(let t of e.stops)t.locations.forEach((e,n)=>r(e,{kind:`stop`,stop:t,location:n}));for(let e of n.values())e.sort(Rn);return n}function Bn(e){return e.kind===`file`?null:{start:e.line,end:e.endLine??e.line,side:e.side}}function Vn(e){let{line:t,endLine:n}=e.cited;return n!==void 0&&n!==t?`lines ${t}-${n}`:`line ${t}`}function Hn(e){if(e.kind===`line`)return;if(e.kind===`nearby`)return`Cited ${Vn(e)}, which the diff does not show. Placed at the nearest changed line.`;let t=e.cited.line>0?`Cited ${Vn(e)}. `:``;switch(e.reason){case`not-in-diff`:return`${t}This file is not part of the diff.`;case`far-from-diff`:return`${t}That is too far from any changed line to place on the diff.`;case`deleted-file`:return`${t}The file was deleted.`;case`no-hunks`:return`${t}The file has no content changes to show.`;case`no-line`:return`About the whole file; no line cited.`;default:return t?t.trim():void 0}}var Un={runId:null,file:null,finding:null,stop:null,stopLocation:0,sidebarMode:`groups`,showOverCap:!1,showDismissed:!1,helpOpen:!1},Wn=x({name:`focus`,initialState:Un,reducers:{runEntered(e,t){if(e.runId!==t.payload)return{...Un,runId:t.payload,sidebarMode:e.sidebarMode}},fileFocused(e,t){e.file=t.payload},findingFocused(e,t){e.finding=t.payload.id,t.payload.file&&(e.file=t.payload.file),t.payload.id&&(e.stop=null)},stopFocused(e,t){e.stop=t.payload.id,e.stopLocation=t.payload.location??0,t.payload.file&&(e.file=t.payload.file),t.payload.id&&(e.finding=null)},sidebarModeSet(e,t){e.sidebarMode=t.payload},overCapToggled(e){e.showOverCap=!e.showOverCap},dismissedToggled(e){e.showDismissed=!e.showDismissed},helpSet(e,t){e.helpOpen=t.payload}},selectors:{selectFocusedFile:e=>e.file,selectFocusedFinding:e=>e.finding,selectFocusedStop:e=>e.stop,selectStopLocation:e=>e.stopLocation,selectSidebarMode:e=>e.sidebarMode,selectShowOverCap:e=>e.showOverCap,selectShowDismissed:e=>e.showDismissed,selectHelpOpen:e=>e.helpOpen}}),{runEntered:Gn,fileFocused:Kn,findingFocused:qn,stopFocused:Jn,sidebarModeSet:Yn,overCapToggled:Xn,dismissedToggled:Zn,helpSet:Qn}=Wn.actions,{selectFocusedFile:$n,selectFocusedFinding:er,selectFocusedStop:tr,selectStopLocation:nr,selectSidebarMode:rr,selectShowOverCap:ir,selectShowDismissed:ar,selectHelpOpen:or}=Wn.selectors,sr=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`m229.66 77.66l-128 128a8 8 0 0 1-11.32 0l-56-56a8 8 0 0 1 11.32-11.32L96 188.69L218.34 66.34a8 8 0 0 1 11.32 11.32`})]})),cr=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M216 32H88a8 8 0 0 0-8 8v40H40a8 8 0 0 0-8 8v128a8 8 0 0 0 8 8h128a8 8 0 0 0 8-8v-40h40a8 8 0 0 0 8-8V40a8 8 0 0 0-8-8m-56 176H48V96h112Zm48-48h-32V88a8 8 0 0 0-8-8H96V48h112Z`})]})),lr={button:`_button_12iod_1`};function ur({text:e,label:t,title:n}){let{copy:r}=R(),[i,a]=(0,k.useState)(!1);return(0,k.useEffect)(()=>{if(!i)return;let e=setTimeout(()=>a(!1),1500);return()=>clearTimeout(e)},[i]),(0,N.jsxs)(`button`,{type:`button`,className:lr.button,title:n??t,onClick:async t=>{t.stopPropagation(),await r(e())&&a(!0)},children:[i?(0,N.jsx)(sr,{"aria-hidden":!0}):(0,N.jsx)(cr,{"aria-hidden":!0}),(0,N.jsx)(`span`,{children:i?`Copied`:t})]})}var dr={markdown:`_markdown_c7bef_1`,heading:`_heading_c7bef_42`},fr=/^\s*(?:([-*+])|(\d+)[.)])\s+(.*)$/;function pr(e){let t=[],n=e.replace(/\r\n/g,`
8
- `).split(`
9
- `),r=[],i=()=>{r.length>0&&t.push({kind:`p`,text:r.join(` `)}),r=[]};for(let e=0;e<n.length;e++){let a=n[e];if(a.trim()===``){i();continue}if(a.trimStart().startsWith("```")){i();let r=[];for(;++e<n.length&&!n[e].trimStart().startsWith("```");)r.push(n[e]);t.push({kind:`code`,text:r.join(`
10
- `)});continue}let o=/^(#{1,6})\s+(.*)$/.exec(a);if(o){i(),t.push({kind:`h`,level:o[1].length,text:o[2]});continue}let s=fr.exec(a);if(s){i();let e=s[1]?`ul`:`ol`,n=t.at(-1);n&&n.kind===e?n.items.push(s[3]):t.push({kind:e,items:[s[3]]});continue}let c=t.at(-1);r.length===0&&c&&(c.kind===`ul`||c.kind===`ol`)&&/^\s+\S/.test(a)?c.items[c.items.length-1]+=` ${a.trim()}`:r.push(a.trim())}return i(),t}var mr=/`([^`]+)`|\*\*([^*]+)\*\*|__([^_]+)__|\*([^*\s][^*]*)\*|_([^_\s][^_]*)_|\[([^\]]+)\]\(([^)\s]+)\)/g;function hr(e){let t=[],n=0;for(let r of e.matchAll(mr)){r.index>n&&t.push(e.slice(n,r.index));let i=r.index;if(r[1]!==void 0)t.push((0,N.jsx)(`code`,{children:r[1]},i));else if(r[2]!==void 0||r[3]!==void 0)t.push((0,N.jsx)(`strong`,{children:hr(r[2]??r[3])},i));else if(r[4]!==void 0||r[5]!==void 0)t.push((0,N.jsx)(`em`,{children:hr(r[4]??r[5])},i));else if(r[6]!==void 0&&r[7]!==void 0){let e=/^(https?:|\/|#)/.test(r[7]);t.push(e?(0,N.jsx)(`a`,{href:r[7],target:`_blank`,rel:`noreferrer`,children:hr(r[6])},i):r[6])}n=r.index+r[0].length}return n<e.length&&t.push(e.slice(n)),t}function gr(e,t){switch(e.kind){case`p`:return(0,N.jsx)(`p`,{children:hr(e.text)},t);case`h`:return(0,N.jsx)(`p`,{className:dr.heading,children:hr(e.text)},t);case`code`:return(0,N.jsx)(`pre`,{children:(0,N.jsx)(`code`,{children:e.text})},t);case`ul`:case`ol`:{let n=e.kind;return(0,N.jsx)(n,{children:e.items.map((e,t)=>(0,N.jsx)(`li`,{children:hr(e)},t))},t)}}}function B({source:e,className:t}){return(0,N.jsx)(`div`,{className:[dr.markdown,t].filter(Boolean).join(` `),children:pr(e).map(gr)})}var V={card:`_card_kmb34_1`,head:`_head_kmb34_50`,severity:`_severity_kmb34_56`,title:`_title_kmb34_65`,meta:`_meta_kmb34_73`,badge:`_badge_kmb34_81`,note:`_note_kmb34_94`,body:`_body_kmb34_101`,details:`_details_kmb34_105`,code:`_code_kmb34_121`,triage:`_triage_kmb34_139`,status:`_status_kmb34_180`,more:`_more_kmb34_184`},_r={wrong:`Wrong`,"not-worth-fixing":`Not worth fixing`,"already-handled":`Already handled`,duplicate:`Duplicate`,other:`Other`};function vr({finding:e}){let{runId:t}=R(),n=pn(t),r=hn(t),i=on(t).data?.status===`running`,[o,s]=(0,k.useState)(!1),[c,l]=(0,k.useState)(`wrong`),[u,d]=(0,k.useState)(``),f=a();(0,k.useEffect)(()=>{f?.markDOMDirty()},[o,f]);let p=n.findingStatus[e.id]??`open`,m=n.findingNotes?.[e.id],h=(t,n={})=>{r({op:`finding`,ids:[e.id],status:t,...n,at:new Date().toISOString()}),s(!1)},g=i?`Available when the run finishes`:void 0;return o?(0,N.jsxs)(`form`,{className:V.triage,onSubmit:e=>{e.preventDefault(),h(`dismissed`,{reason:c,...u.trim()?{note:u.trim()}:{}})},children:[(0,N.jsx)(`select`,{"aria-label":`Reason`,value:c,onChange:e=>l(e.target.value),children:It.map(e=>(0,N.jsx)(`option`,{value:e,children:_r[e]},e))}),(0,N.jsx)(`input`,{"aria-label":`Note`,placeholder:`Note (optional)`,value:u,onChange:e=>d(e.target.value)}),(0,N.jsx)(`button`,{type:`submit`,children:`Dismiss`}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>s(!1),children:`Cancel`})]}):p===`open`?(0,N.jsxs)(`div`,{className:V.triage,children:[(0,N.jsx)(`button`,{type:`button`,disabled:i,title:g??`Mark this finding worth fixing`,onClick:()=>h(`accepted`),children:`Accept`}),(0,N.jsx)(`button`,{type:`button`,disabled:i,title:g??`Dismiss this finding with a reason`,onClick:()=>s(!0),children:`Dismiss`})]}):(0,N.jsxs)(`div`,{className:V.triage,children:[(0,N.jsx)(`span`,{className:V.status,children:p===`accepted`?`Accepted`:`Dismissed: ${_r[m?.reason??`other`]}`}),m?.note&&(0,N.jsx)(`span`,{children:m.note}),(0,N.jsx)(`button`,{type:`button`,disabled:i,title:g,onClick:()=>h(`open`),children:`Reopen`})]})}var yr=(0,k.memo)(function({finding:e,overCap:t}){let n=R(),r=a(),i=pn(n.runId),o=i.findingStatus[e.id]??`open`,s=j(er)===e.id,[c,l]=(0,k.useState)(!1),u=c||s;(0,k.useEffect)(()=>{r?.markDOMDirty()},[u,o,r]);let d=Hn(e.anchor),f=!!(e.impact||e.evidence||e.suggestion||e.suggestedCode);return(0,N.jsxs)(`article`,{id:`finding-${e.id}`,tabIndex:-1,className:V.card,"data-severity":e.severity,"data-focused":s,"data-preexisting":e.preexisting??!1,"data-status":o,"aria-label":`${Be[e.severity]}: ${e.title}`,onClick:t=>{t.target.closest(`a, button, select, input`)||s||n.goToFinding(e.id,{scroll:!1})},children:[(0,N.jsxs)(`header`,{className:V.head,children:[(0,N.jsx)(`span`,{className:V.severity,children:Be[e.severity]}),(0,N.jsx)(`h3`,{className:V.title,children:e.title}),(0,N.jsx)(ur,{label:`Copy`,title:`Copy this finding as Markdown`,text:()=>Mn(e,i)})]}),(0,N.jsxs)(`div`,{className:V.meta,children:[(0,N.jsx)(`span`,{children:e.category}),(0,N.jsxs)(`span`,{children:[e.confidence,` confidence`]}),e.preexisting&&(0,N.jsx)(`span`,{className:V.badge,title:`The problem is in code this change did not add or modify`,children:`pre-existing`}),t&&(0,N.jsx)(`span`,{className:V.badge,children:`over the posting cap`}),e.carriedFrom&&(0,N.jsx)(v,{to:`/runs/$runId`,params:{runId:e.carriedFrom},className:V.badge,children:`from earlier run`}),e.repeatOf!==void 0&&(0,N.jsxs)(`span`,{className:V.badge,children:[`repeats comment #`,e.repeatOf]})]}),d&&(0,N.jsx)(`p`,{className:V.note,children:d}),(0,N.jsx)(B,{source:e.explanation,className:V.body}),f&&u&&(0,N.jsxs)(`div`,{className:V.details,children:[e.impact&&(0,N.jsxs)(`section`,{children:[(0,N.jsx)(`h4`,{children:`Impact`}),(0,N.jsx)(B,{source:e.impact})]}),e.evidence&&(0,N.jsxs)(`section`,{children:[(0,N.jsx)(`h4`,{children:`Evidence`}),(0,N.jsx)(B,{source:e.evidence})]}),(e.suggestion||e.suggestedCode)&&(0,N.jsxs)(`section`,{children:[(0,N.jsx)(`h4`,{children:`Suggestion`}),e.suggestion&&(0,N.jsx)(B,{source:e.suggestion}),e.suggestedCode&&(0,N.jsx)(`pre`,{className:V.code,children:(0,N.jsx)(`code`,{children:e.suggestedCode})})]})]}),f&&!s&&(0,N.jsx)(`button`,{type:`button`,className:V.more,onClick:()=>l(!c),"aria-expanded":u,children:u?`Hide details`:`Show details`}),(0,N.jsx)(vr,{finding:e})]})}),br=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M224 128a8 8 0 0 1-8 8H59.31l58.35 58.34a8 8 0 0 1-11.32 11.32l-72-72a8 8 0 0 1 0-11.32l72-72a8 8 0 0 1 11.32 11.32L59.31 120H216a8 8 0 0 1 8 8`})]})),xr=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`m221.66 133.66l-72 72a8 8 0 0 1-11.32-11.32L196.69 136H40a8 8 0 0 1 0-16h156.69l-58.35-58.34a8 8 0 0 1 11.32-11.32l72 72a8 8 0 0 1 0 11.32`})]})),Sr=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M246 106.65L212.33 69.3a16 16 0 0 0-11.89-5.3H136V32a8 8 0 0 0-16 0v32H40a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h80v64a8 8 0 0 0 16 0v-64h64.44a16 16 0 0 0 11.89-5.3L246 117.35a8 8 0 0 0 0-10.7M200.44 144H40V80h160.44l28.8 32Z`})]})),H={card:`_card_se589_1`,head:`_head_se589_32`,icon:`_icon_se589_38`,kicker:`_kicker_se589_44`,title:`_title_se589_53`,importance:`_importance_se589_61`,label:`_label_se589_71`,note:`_note_se589_76`,body:`_body_se589_82`,nav:`_nav_se589_86`},Cr=(0,k.memo)(function({stop:e,location:t}){let n=R(),r=a(),i=j(n=>tr(n)===e.id&&nr(n)===t);(0,k.useEffect)(()=>{r?.markDOMDirty()},[i,r]);let o=n.stops.findIndex(t=>t.id===e.id),s=n.stops[o-1],c=n.stops[o+1],l=e.locations[t],u=l?Hn(l):void 0,d=e.locations.length>1;return(0,N.jsxs)(`aside`,{id:`stop-${e.id}-${t}`,tabIndex:-1,className:H.card,"data-importance":e.importance,"data-focused":i,"aria-label":`Walkthrough stop ${o+1} of ${n.stops.length}: ${e.title}`,onClick:r=>{r.target.closest(`a, button`)||i||n.goToStop(e.id,t,{scroll:!1})},children:[(0,N.jsxs)(`header`,{className:H.head,children:[(0,N.jsx)(Sr,{"aria-hidden":!0,className:H.icon}),(0,N.jsxs)(`span`,{className:H.kicker,children:[`Stop `,o+1,` of `,n.stops.length]}),(0,N.jsx)(`h3`,{className:H.title,children:e.title}),e.importance!==`normal`&&(0,N.jsx)(`span`,{className:H.importance,children:e.importance})]}),l?.label&&(0,N.jsx)(`p`,{className:H.label,children:l.label}),u&&(0,N.jsx)(`p`,{className:H.note,children:u}),e.prose&&(0,N.jsx)(B,{source:e.prose,className:H.body}),(0,N.jsxs)(`nav`,{className:H.nav,"aria-label":`Walkthrough`,children:[(0,N.jsxs)(`button`,{type:`button`,disabled:!s,onClick:()=>s&&n.goToStop(s.id),children:[(0,N.jsx)(br,{"aria-hidden":!0}),` Previous stop`]}),d&&(0,N.jsxs)(`button`,{type:`button`,onClick:()=>n.goToStop(e.id,(t+1)%e.locations.length),title:`Location ${t+1} of ${e.locations.length}`,children:[`Next location (`,t+1,`/`,e.locations.length,`)`]}),(0,N.jsxs)(`button`,{type:`button`,disabled:!c,onClick:()=>c&&n.goToStop(c.id),children:[`Next stop `,(0,N.jsx)(xr,{"aria-hidden":!0})]})]})]})}),U={frame:`_frame_1chdr_1`,caret:`_caret_1chdr_8`,plainHeader:`_plainHeader_1chdr_20`,path:`_path_1chdr_29`,meta:`_meta_1chdr_39`,tag:`_tag_1chdr_45`,count:`_count_1chdr_50`,reviewed:`_reviewed_1chdr_59`,cards:`_cards_1chdr_78`,placeholder:`_placeholder_1chdr_83`},wr=`[data-diffs-header][data-sticky] { top: calc(var(--header-height, 0px) - 1px); }
11
- [data-diffs-header] [data-additions-count], [data-diffs-header] [data-deletions-count] { display: none; }`,Tr=[];function Er({meta:e}){return e.kind===`finding`?(0,N.jsx)(yr,{finding:e.finding,overCap:e.overCap}):(0,N.jsx)(Cr,{stop:e.stop,location:e.location})}function Dr({annotations:e}){let t=e.filter(e=>e.metadata.kind===`finding`).length,n=e.length-t;if(!t&&!n)return null;let r=[t?`${t} finding${t===1?``:`s`}`:``,n?`${n} stop${n===1?``:`s`}`:``];return(0,N.jsx)(`span`,{className:U.count,children:r.filter(Boolean).join(`, `)})}var Or=(0,k.memo)(function({runId:e,file:t,diff:n,collapsed:r,annotations:i=Tr,selection:a}){let s=A(),c=j(ye),l=j(be),u=j(xe),d=vn(gn),f=R(),p=t.path in pn(e).reviewedFiles,m=on(e).data?.status===`running`,h=t.status===`added`||t.status===`removed`,g=c===`unified`||h||d?`unified`:`split`,_=(0,k.useMemo)(()=>({diffStyle:g,overflow:l?`wrap`:`scroll`,themeType:u,collapsed:r,stickyHeader:!0,unsafeCSS:wr}),[g,l,u,r]),v=(0,k.useCallback)(e=>(0,N.jsx)(Er,{meta:e.metadata}),[]),y=(0,N.jsxs)(`label`,{className:U.reviewed,title:m?`Available when the run finishes`:`Mark this file reviewed (r)`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:p,disabled:m,onChange:e=>f.setReviewed(t.path,e.target.checked)}),`Viewed`]}),b=(0,N.jsx)(`button`,{type:`button`,className:U.caret,onClick:()=>s(he({runId:e,path:t.path})),"aria-expanded":!r,title:r?`Expand file`:`Collapse file`,children:r?(0,N.jsx)(ze,{"aria-hidden":!0}):(0,N.jsx)(Re,{"aria-hidden":!0})}),x=n!==void 0&&n.hunks.length>0;return t.isBinary||!x?(0,N.jsxs)(`div`,{className:U.frame,"data-collapsed":r,children:[(0,N.jsxs)(`div`,{className:U.plainHeader,children:[b,(0,N.jsx)(`span`,{className:U.path,title:t.path,children:t.previousPath?`${t.previousPath} → ${t.path}`:t.path}),(0,N.jsxs)(`span`,{className:U.meta,children:[(0,N.jsx)(Dr,{annotations:i}),t.isBinary?(0,N.jsx)(`span`,{className:U.tag,children:`binary`}):(0,N.jsx)(I,{additions:t.additions,deletions:t.deletions}),(0,N.jsx)(Sn,{status:t.status}),y]})]}),!r&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:U.placeholder,children:t.isBinary?`Binary file not shown.`:n?`No content changes.`:`This file is not in the saved patch.`}),i.length>0&&(0,N.jsx)(`div`,{className:U.cards,children:i.map((e,t)=>(0,N.jsx)(Er,{meta:e.metadata},t))})]})]}):(0,N.jsx)(`div`,{className:U.frame,"data-collapsed":r,children:(0,N.jsx)(o,{fileDiff:n,options:_,lineAnnotations:i,selectedLines:a,renderAnnotation:v,renderHeaderPrefix:()=>b,renderHeaderMetadata:()=>(0,N.jsxs)(`span`,{className:U.meta,children:[r&&(0,N.jsx)(Dr,{annotations:i}),(0,N.jsx)(I,{additions:t.additions,deletions:t.deletions}),(0,N.jsx)(Sn,{status:t.status}),y]})})})}),kr=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsxs)(`g`,{fill:`currentColor`,children:[(0,N.jsx)(`path`,{d:`M224 88v112.89a7.11 7.11 0 0 1-7.11 7.11H40a8 8 0 0 1-8-8V64a8 8 0 0 1 8-8h53.33a8 8 0 0 1 4.8 1.6L128 80h88a8 8 0 0 1 8 8`,opacity:.2}),(0,N.jsx)(`path`,{d:`M216 72h-85.33l-27.74-20.8a16.12 16.12 0 0 0-9.6-3.2H40a16 16 0 0 0-16 16v136a16 16 0 0 0 16 16h176.89A15.13 15.13 0 0 0 232 200.89V88a16 16 0 0 0-16-16m0 128H40V64h53.33l29.87 22.4A8 8 0 0 0 128 88h88Z`})]})]}));function Ar(e){if(e.kind===`file`)return`file`;let t=e.kind===`line`?e.line:e.cited.line;return t?`L${t}`:`file`}function jr(e){if(e.kind===`file`)return`whole file`;let t=e.kind===`line`?e.line:e.cited.line,n=e.kind===`line`?e.endLine:e.cited.endLine,r=n!==void 0&&n!==t?`lines ${t}-${n}`:`line ${t}`;return e.side===`deletions`?`old ${r}`:r}function Mr(e,t){let n=new Map(t.map((e,t)=>[e.id,t+1]));return e.flatMap(e=>{let t=e.metadata;if(t.kind===`finding`){let e=t.finding,n=Be[e.severity],r=jr(e.anchor),i=Hn(e.anchor);return[{kind:`finding`,key:`finding:${e.id}`,id:e.id,severity:e.severity,overCap:t.overCap,title:e.title,line:Ar(e.anchor),side:e.anchor.side,label:`${n} finding, ${r}: ${e.title}`,tooltip:[`${n}${t.overCap?` (over the posting cap)`:``}: ${e.title}`,r,i].filter(Boolean).join(`
12
- `)}]}let{stop:r,location:i}=t,a=r.locations[i];if(!a)return[];let o=n.get(r.id)??0,s=`${r.importance===`critical`?`Critical walkthrough stop`:`Walkthrough stop`} ${o}`,c=jr(a),l=r.locations.length>1?` (location ${i+1} of ${r.locations.length})`:``;return[{kind:`stop`,key:`stop:${r.id}:${i}`,id:r.id,location:i,number:o,importance:r.importance,title:r.title,line:Ar(a),side:a.side,label:`${s}${l}, ${c}: ${r.title}`,tooltip:[`${s}${l}: ${r.title}`,a.label,c,Hn(a)].filter(Boolean).join(`
13
- `)}]})}function Nr(e,t,n){let r=[...e.map(e=>({path:e.path,file:e})),...t.map(e=>({path:e,file:void 0}))];if(n===`list`)return r.map(({path:e,file:t})=>t?{key:`file:${e}`,depth:0,type:`file`,name:e,file:t}:{key:`missing:${e}`,depth:0,type:`missing`,name:e});let i={name:``,children:new Map};for(let{path:e,file:t}of r){let n=e.split(`/`),r=i;for(let e=0;e<n.length-1;e++){let t=n[e],i=r.children.get(t);i||(i={name:t,children:new Map},r.children.set(t,i)),r=i}r.children.set(`\0file:${e}`,{name:n[n.length-1],children:new Map,file:t,missing:!t})}function a(e){let t=[];for(let n of e.children.values())t.push(...n.file?[n.file]:a(n));return t}let o=[];function s(e,t,n){for(let[r,i]of e.children){if(i.file){o.push({key:`file:${i.file.path}`,depth:t,type:`file`,name:i.name,file:i.file});continue}if(i.missing){o.push({key:`missing:${n}${i.name}`,depth:t,type:`missing`,name:i.name});continue}let e=i.name,c=i,l=`${n}${r}/`;for(;c.children.size===1;){let[t,n]=[...c.children.entries()][0];if(n.file||n.missing)break;e+=`/${n.name}`,c=n,l+=`${t}/`}o.push({key:`folder:${l}`,depth:t,type:`folder`,name:e,files:a(c)}),s(c,t+1,l)}}return s(i,0,``),o}var W={tree:`_tree_mjw0z_1`,row:`_row_mjw0z_10`,folder:`_folder_mjw0z_26`,file:`_file_mjw0z_34`,name:`_name_mjw0z_48`,missing:`_missing_mjw0z_60`,notes:`_notes_mjw0z_65`,note:`_note_mjw0z_65`,noteTitle:`_noteTitle_mjw0z_108`,dot:`_dot_mjw0z_116`,signpost:`_signpost_mjw0z_125`,stopNumber:`_stopNumber_mjw0z_143`,line:`_line_mjw0z_154`};function Pr({files:e,activePath:t,annotations:n,onSelect:r}){let i=j(Se),a=R(),o=pn(a.runId).reviewedFiles,s=(0,k.useMemo)(()=>Nr(e,[],i),[e,i]),c=(0,k.useMemo)(()=>{let t=new Map;for(let r of e){let e=n.get(r.path);e?.length&&t.set(r.path,Mr(e,a.stops))}return t},[n,e,a.stops]),l=(0,k.useRef)(null);return(0,k.useEffect)(()=>{let e=l.current,t=e?.querySelector(`[data-active="true"]`);e&&t&&ot(e,t)},[t]),(0,N.jsx)(`ul`,{ref:l,className:W.tree,"data-layout":i,children:s.map(e=>{let n=e.file&&c.get(e.file.path);return(0,N.jsxs)(`li`,{children:[(0,N.jsx)(`div`,{className:W.row,"data-active":e.file?.path===t,style:{paddingLeft:`${.5+e.depth}em`},children:e.type===`folder`?(0,N.jsxs)(`span`,{className:W.folder,children:[(0,N.jsx)(kr,{"aria-hidden":!0}),(0,N.jsx)(`span`,{className:W.name,children:e.name})]}):e.file?(0,N.jsxs)(`button`,{type:`button`,className:W.file,"data-reviewed":e.file.path in o,onClick:()=>r(e.file.path),title:e.file.path in o?`${e.file.path} (viewed)`:e.file.path,children:[(0,N.jsx)(`span`,{className:W.name,children:e.name}),(0,N.jsx)(I,{additions:e.file.additions,deletions:e.file.deletions,binary:e.file.isBinary}),(0,N.jsx)(Sn,{status:e.file.status})]}):(0,N.jsx)(`span`,{className:W.missing,children:e.name})}),n&&(0,N.jsx)(Fr,{notes:n,depth:e.depth,file:e.name})]},e.key)})})}function Fr({notes:e,depth:t,file:n}){let r=R(),i=j(er),a=j(tr),o=j(nr);return(0,N.jsx)(`ul`,{className:W.notes,style:{marginLeft:`${.5+t+.45}em`},"aria-label":`Notes on ${n}`,children:e.map(e=>{let t=e.kind===`finding`?e.id===i:e.id===a&&e.location===o;return(0,N.jsx)(`li`,{children:(0,N.jsxs)(`button`,{type:`button`,className:W.note,"data-kind":e.kind,"data-severity":e.kind===`finding`?e.severity:void 0,"data-importance":e.kind===`stop`?e.importance:void 0,"data-over-cap":e.kind===`finding`&&e.overCap?`true`:void 0,"aria-current":t?`true`:void 0,"aria-label":e.label,title:e.tooltip,onClick:()=>e.kind===`finding`?r.goToFinding(e.id):r.goToStop(e.id,e.location),children:[e.kind===`finding`?(0,N.jsx)(`span`,{className:W.dot,"aria-hidden":!0}):(0,N.jsx)(Sr,{className:W.signpost,"aria-hidden":!0}),(0,N.jsx)(`span`,{className:W.noteTitle,children:e.title}),e.kind===`stop`&&e.number>0&&(0,N.jsxs)(`span`,{className:W.stopNumber,"aria-hidden":!0,children:[`(`,e.number,`)`]}),(0,N.jsx)(`span`,{className:W.line,"data-side":e.side,children:e.line})]})},e.key)})})}var Ir=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsxs)(`g`,{fill:`currentColor`,children:[(0,N.jsx)(`path`,{d:`M232 56v144h-72a32 32 0 0 0-32 32a32 32 0 0 0-32-32H24V56h72a32 32 0 0 1 32 32a32 32 0 0 1 32-32Z`,opacity:.2}),(0,N.jsx)(`path`,{d:`M232 48h-72a40 40 0 0 0-32 16a40 40 0 0 0-32-16H24a8 8 0 0 0-8 8v144a8 8 0 0 0 8 8h72a24 24 0 0 1 24 24a8 8 0 0 0 16 0a24 24 0 0 1 24-24h72a8 8 0 0 0 8-8V56a8 8 0 0 0-8-8M96 192H32V64h64a24 24 0 0 1 24 24v112a39.8 39.8 0 0 0-24-8m128 0h-64a39.8 39.8 0 0 0-24 8V88a24 24 0 0 1 24-24h64Z`})]})]})),Lr=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsxs)(`g`,{fill:`currentColor`,children:[(0,N.jsx)(`path`,{d:`M208 128v16a80 80 0 0 1-160 0v-16Z`,opacity:.2}),(0,N.jsx)(`path`,{d:`M144 92a12 12 0 1 1 12 12a12 12 0 0 1-12-12m-44-12a12 12 0 1 0 12 12a12 12 0 0 0-12-12m116 64a87.8 87.8 0 0 1-3 23l22.24 9.72A8 8 0 0 1 232 192a7.9 7.9 0 0 1-3.2-.67L207.38 182a88 88 0 0 1-158.76 0l-21.42 9.33a7.9 7.9 0 0 1-3.2.67a8 8 0 0 1-3.2-15.33L43 167a87.8 87.8 0 0 1-3-23v-8H16a8 8 0 0 1 0-16h24v-8a87.8 87.8 0 0 1 3-23l-22.2-9.67a8 8 0 1 1 6.4-14.66L48.62 74a88 88 0 0 1 158.76 0l21.42-9.36a8 8 0 0 1 6.4 14.66L213 89.05a87.8 87.8 0 0 1 3 23v8h24a8 8 0 0 1 0 16h-24ZM56 120h144v-8a72 72 0 0 0-144 0Zm64 95.54V136H56v8a72.08 72.08 0 0 0 64 71.54M200 144v-8h-64v79.54A72.08 72.08 0 0 0 200 144`})]})]})),Rr=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M232 128c0 12.5-17.8 22-22.7 33.7s1.4 30.6-7.8 39.8s-28.5 3.1-39.8 7.8S140.5 232 128 232s-22-17.8-33.7-22.7s-30.6 1.4-39.8-7.8s-3.1-28.5-7.8-39.8S24 140.5 24 128s17.8-22 22.7-33.7s-1.4-30.6 7.8-39.8s28.5-3.1 39.8-7.8S115.5 24 128 24s22 17.8 33.7 22.7s30.6-1.4 39.8 7.8s3.1 28.5 7.8 39.8S232 115.5 232 128Z`,opacity:.2}),(0,N.jsx)(`path`,{fill:`currentColor`,d:`M225.9 102.8c-3.8-3.9-7.7-8-9.2-11.5s-1.4-8.7-1.5-14c-.1-9.7-.3-20.8-8-28.5s-18.8-7.9-28.5-8c-5.3-.1-10.7-.2-14-1.5s-7.6-5.4-11.5-9.2C146.3 23.5 138.4 16 128 16s-18.3 7.5-25.2 14.1c-3.9 3.8-8 7.7-11.5 9.2s-8.7 1.4-14 1.5c-9.7.1-20.8.3-28.5 8s-7.9 18.8-8 28.5c-.1 5.3-.2 10.7-1.5 14s-5.4 7.6-9.2 11.5C23.5 109.7 16 117.6 16 128s7.5 18.3 14.1 25.2c3.8 3.9 7.7 8 9.2 11.5s1.4 8.7 1.5 14c.1 9.7.3 20.8 8 28.5s18.8 7.9 28.5 8c5.3.1 10.7.2 14 1.5s7.6 5.4 11.5 9.2c6.9 6.6 14.8 14.1 25.2 14.1s18.3-7.5 25.2-14.1c3.9-3.8 8-7.7 11.5-9.2s8.7-1.4 14-1.5c9.7-.1 20.8-.3 28.5-8s7.9-18.8 8-28.5c.1-5.3.2-10.7 1.5-14s5.4-7.6 9.2-11.5c6.6-6.9 14.1-14.8 14.1-25.2s-7.5-18.3-14.1-25.2Zm-11.6 39.3c-4.8 5-9.7 10.2-12.4 16.5s-2.6 13.1-2.7 19.8s-.2 14.4-3.3 17.5s-10.4 3.2-17.5 3.3s-13.7.2-19.8 2.7s-11.5 7.6-16.5 12.4S132 224 128 224s-9.1-4.9-14.1-9.7s-10.2-9.7-16.5-12.4s-13.1-2.6-19.8-2.7s-14.4-.2-17.5-3.3s-3.2-10.4-3.3-17.5s-.2-13.7-2.7-19.8s-7.6-11.5-12.4-16.5S32 132 32 128s4.9-9.1 9.7-14.1s9.7-10.2 12.4-16.5s2.6-13.1 2.7-19.8s.2-14.4 3.3-17.5s10.4-3.2 17.5-3.3s13.7-.2 19.8-2.7s11.5-7.6 16.5-12.4S124 32 128 32s9.1 4.9 14.1 9.7s10.2 9.7 16.5 12.4s13.1 2.6 19.8 2.7s14.4.2 17.5 3.3s3.2 10.4 3.3 17.5s.2 13.7 2.7 19.8s7.6 11.5 12.4 16.5S224 124 224 128s-4.9 9.1-9.7 14.1ZM120 136V80a8 8 0 0 1 16 0v56a8 8 0 0 1-16 0Zm20 36a12 12 0 1 1-12-12a12 12 0 0 1 12 12Z`})]})),zr=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsxs)(`g`,{fill:`currentColor`,children:[(0,N.jsx)(`path`,{d:`M224 128a96 96 0 1 1-96-96a96 96 0 0 1 96 96`,opacity:.2}),(0,N.jsx)(`path`,{d:`M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24m0 192a88 88 0 1 1 88-88a88.1 88.1 0 0 1-88 88m56-88a12 12 0 1 1-12-12a12 12 0 0 1 12 12m-44 0a12 12 0 1 1-12-12a12 12 0 0 1 12 12m-44 0a12 12 0 1 1-12-12a12 12 0 0 1 12 12`})]})]})),Br=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsxs)(`g`,{fill:`currentColor`,children:[(0,N.jsx)(`path`,{d:`M208 216H48a8 8 0 0 1-6.86-12.12l30.48-50.8c13.23-2.48 32-1.41 56.37 10.92c32.25 16.33 54.75 12.91 67.5 7.65l19.34 32.23A8 8 0 0 1 208 216`,opacity:.2}),(0,N.jsx)(`path`,{d:`M221.69 199.77L160 96.92V40h8a8 8 0 0 0 0-16H88a8 8 0 0 0 0 16h8v56.92L34.31 199.77A16 16 0 0 0 48 224h160a16 16 0 0 0 13.72-24.23Zm-110.83-96.52a7.93 7.93 0 0 0 1.14-4.11V40h32v59.14a7.93 7.93 0 0 0 1.14 4.11L183.36 167c-12 2.37-29.07 1.37-51.75-10.11c-15.91-8.05-31.05-12.32-45.22-12.81ZM48 208l28.54-47.58c14.25-1.73 30.31 1.85 47.82 10.72c19 9.61 35 12.88 48 12.88a69.9 69.9 0 0 0 19.55-2.7L208 208Z`})]})]})),Vr=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsxs)(`g`,{fill:`currentColor`,children:[(0,N.jsx)(`path`,{d:`m207.86 123.18l16.78-21a99 99 0 0 0-10.07-24.29l-26.7-3a81 81 0 0 0-6.81-6.81l-3-26.71a99.4 99.4 0 0 0-24.3-10l-21 16.77a82 82 0 0 0-9.64 0l-21-16.78a99 99 0 0 0-24.21 10.07l-3 26.7a81 81 0 0 0-6.81 6.81l-26.71 3a99.4 99.4 0 0 0-10 24.3l16.77 21a82 82 0 0 0 0 9.64l-16.78 21a99 99 0 0 0 10.07 24.29l26.7 3a81 81 0 0 0 6.81 6.81l3 26.71a99.4 99.4 0 0 0 24.3 10l21-16.77a82 82 0 0 0 9.64 0l21 16.78a99 99 0 0 0 24.29-10.07l3-26.7a81 81 0 0 0 6.81-6.81l26.71-3a99.4 99.4 0 0 0 10-24.3l-16.77-21a82 82 0 0 0-.08-9.64M128 168a40 40 0 1 1 40-40a40 40 0 0 1-40 40`,opacity:.2}),(0,N.jsx)(`path`,{d:`M128 80a48 48 0 1 0 48 48a48.05 48.05 0 0 0-48-48m0 80a32 32 0 1 1 32-32a32 32 0 0 1-32 32m88-29.84q.06-2.16 0-4.32l14.92-18.64a8 8 0 0 0 1.48-7.06a107.6 107.6 0 0 0-10.88-26.25a8 8 0 0 0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186 40.54a8 8 0 0 0-3.94-6a107.3 107.3 0 0 0-26.25-10.86a8 8 0 0 0-7.06 1.48L130.16 40h-4.32L107.2 25.11a8 8 0 0 0-7.06-1.48a107.6 107.6 0 0 0-26.25 10.88a8 8 0 0 0-3.93 6l-2.64 23.76q-1.56 1.49-3 3L40.54 70a8 8 0 0 0-6 3.94a107.7 107.7 0 0 0-10.87 26.25a8 8 0 0 0 1.49 7.06L40 125.84v4.32L25.11 148.8a8 8 0 0 0-1.48 7.06a107.6 107.6 0 0 0 10.88 26.25a8 8 0 0 0 6 3.93l23.72 2.64q1.49 1.56 3 3L70 215.46a8 8 0 0 0 3.94 6a107.7 107.7 0 0 0 26.25 10.87a8 8 0 0 0 7.06-1.49L125.84 216q2.16.06 4.32 0l18.64 14.92a8 8 0 0 0 7.06 1.48a107.2 107.2 0 0 0 26.25-10.88a8 8 0 0 0 3.93-6l2.64-23.72q1.56-1.48 3-3l23.78-2.8a8 8 0 0 0 6-3.94a107.7 107.7 0 0 0 10.87-26.25a8 8 0 0 0-1.49-7.06Zm-16.1-6.5a74 74 0 0 1 0 8.68a8 8 0 0 0 1.74 5.48l14.19 17.73a91.6 91.6 0 0 1-6.23 15l-22.6 2.56a8 8 0 0 0-5.1 2.64a74 74 0 0 1-6.14 6.14a8 8 0 0 0-2.64 5.1l-2.51 22.58a91.3 91.3 0 0 1-15 6.23l-17.74-14.19a8 8 0 0 0-5-1.75h-.48a74 74 0 0 1-8.68 0a8.06 8.06 0 0 0-5.48 1.74l-17.78 14.2a91.6 91.6 0 0 1-15-6.23L82.89 187a8 8 0 0 0-2.64-5.1a74 74 0 0 1-6.14-6.14a8 8 0 0 0-5.1-2.64l-22.58-2.52a91.3 91.3 0 0 1-6.23-15l14.19-17.74a8 8 0 0 0 1.74-5.48a74 74 0 0 1 0-8.68a8 8 0 0 0-1.74-5.48L40.2 100.45a91.6 91.6 0 0 1 6.23-15L69 82.89a8 8 0 0 0 5.1-2.64a74 74 0 0 1 6.14-6.14A8 8 0 0 0 82.89 69l2.51-22.57a91.3 91.3 0 0 1 15-6.23l17.74 14.19a8 8 0 0 0 5.48 1.74a74 74 0 0 1 8.68 0a8.06 8.06 0 0 0 5.48-1.74l17.77-14.19a91.6 91.6 0 0 1 15 6.23L173.11 69a8 8 0 0 0 2.64 5.1a74 74 0 0 1 6.14 6.14a8 8 0 0 0 5.1 2.64l22.58 2.51a91.3 91.3 0 0 1 6.23 15l-14.19 17.74a8 8 0 0 0-1.74 5.53Z`})]})]})),Hr=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsxs)(`g`,{fill:`currentColor`,children:[(0,N.jsx)(`path`,{d:`M224 200a24 24 0 1 1-24-24a24 24 0 0 1 24 24`,opacity:.2}),(0,N.jsx)(`path`,{d:`M200 168a32.06 32.06 0 0 0-31 24H72a32 32 0 0 1 0-64h96a40 40 0 0 0 0-80H72a8 8 0 0 0 0 16h96a24 24 0 0 1 0 48H72a48 48 0 0 0 0 96h97a32 32 0 1 0 31-40m0 48a16 16 0 1 1 16-16a16 16 0 0 1-16 16`})]})]})),Ur=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsxs)(`g`,{fill:`currentColor`,children:[(0,N.jsx)(`path`,{d:`M224 96a64 64 0 0 1-94.94 56L73 217a24 24 0 0 1-34-34l65-56.06a64 64 0 0 1 80-90.29L144 80l5.66 26.34L176 112l43.35-40A63.8 63.8 0 0 1 224 96`,opacity:.2}),(0,N.jsx)(`path`,{d:`M226.76 69a8 8 0 0 0-12.84-2.88l-40.3 37.19l-17.23-3.7l-3.7-17.23l37.19-40.3A8 8 0 0 0 187 29.24A72 72 0 0 0 88 96a72.3 72.3 0 0 0 6 28.94L33.79 177c-.15.12-.29.26-.43.39a32 32 0 0 0 45.26 45.26c.13-.13.27-.28.39-.42L131.06 162A72 72 0 0 0 232 96a71.6 71.6 0 0 0-5.24-27M160 152a56.14 56.14 0 0 1-27.07-7a8 8 0 0 0-9.92 1.77l-55.9 64.74a16 16 0 0 1-22.62-22.62L109.18 133a8 8 0 0 0 1.77-9.93a56 56 0 0 1 58.36-82.31l-31.2 33.81a8 8 0 0 0-1.94 7.1l5.66 26.33a8 8 0 0 0 6.14 6.14l26.35 5.66a8 8 0 0 0 7.1-1.94l33.81-31.2A56.06 56.06 0 0 1 160 152`})]})]})),Wr={icon:`_icon_144da_1`,critical:`_critical_144da_30`},Gr={bug:Lr,wrench:Ur,path:Hr,flask:Br,doc:Ir,gear:Vr};function Kr({icon:e,className:t}){let n=e?Gr[e]:zr;return(0,N.jsx)(n,{className:[Wr.icon,t].filter(Boolean).join(` `),"data-icon":e??`missing`,"aria-hidden":!0})}function qr({reason:e}){let t=e?`Needs close review: ${e}`:`Needs close review`;return(0,N.jsx)(`span`,{className:Wr.critical,title:t,role:`img`,"aria-label":t,children:(0,N.jsx)(Rr,{"aria-hidden":!0})})}var G={panel:`_panel_oufx1_1`,head:`_head_oufx1_17`,crumb:`_crumb_oufx1_23`,titleRow:`_titleRow_oufx1_34`,caret:`_caret_oufx1_40`,icon:`_icon_oufx1_52`,title:`_title_oufx1_34`,stats:`_stats_oufx1_63`,summary:`_summary_oufx1_72`};function Jr({group:e,parent:t,stats:n,files:r,allCollapsed:i,activePath:a,annotations:o,onToggleFiles:s,onSelectFile:c}){return(0,N.jsxs)(`aside`,{className:G.panel,children:[(0,N.jsxs)(`div`,{className:G.head,children:[t&&(0,N.jsxs)(`button`,{type:`button`,className:G.crumb,onClick:()=>at(t.id),children:[t.title,` ›`]}),(0,N.jsxs)(`div`,{className:G.titleRow,children:[(0,N.jsx)(`button`,{type:`button`,className:G.caret,onClick:s,title:i?`Expand all files in this group`:`Collapse all files in this group`,children:i?(0,N.jsx)(ze,{"aria-hidden":!0}):(0,N.jsx)(Re,{"aria-hidden":!0})}),(0,N.jsx)(Kr,{icon:e.icon,className:G.icon}),(0,N.jsx)(`h2`,{className:G.title,children:e.title}),n.critical&&(0,N.jsx)(qr,{reason:n.criticalReason})]}),(0,N.jsxs)(`div`,{className:G.stats,children:[(0,N.jsx)(I,{additions:n.additions,deletions:n.deletions,binary:n.binary===n.files}),(0,N.jsx)(`span`,{children:F(n.files,`file`)})]})]}),e.summary&&(0,N.jsx)(B,{source:e.summary,className:G.summary}),(0,N.jsx)(Pr,{files:r,activePath:a,annotations:o,onSelect:c})]})}var K={chapter:`_chapter_wsoz0_1`,unit:`_unit_wsoz0_2`,chapterTitle:`_chapterTitle_wsoz0_14`,caret:`_caret_wsoz0_27`,chapterIcon:`_chapterIcon_wsoz0_32`,chapterStats:`_chapterStats_wsoz0_36`,chapterSummary:`_chapterSummary_wsoz0_45`,files:`_files_wsoz0_67`,file:`_file_wsoz0_67`,marker:`_marker_wsoz0_78`,empty:`_empty_wsoz0_82`},Yr=(0,k.memo)(function({chapter:e,stats:t,unitCount:n,folded:r,onToggleFold:i}){return(0,N.jsxs)(`section`,{id:it(e.id),"data-group-section":e.id,className:K.chapter,children:[(0,N.jsxs)(`button`,{type:`button`,className:K.chapterTitle,onClick:i,"aria-expanded":!r,children:[r?(0,N.jsx)(ze,{"aria-hidden":!0,className:K.caret}):(0,N.jsx)(Re,{"aria-hidden":!0,className:K.caret}),(0,N.jsx)(Kr,{icon:e.icon,className:K.chapterIcon}),(0,N.jsx)(`h2`,{children:e.title}),t.critical&&(0,N.jsx)(qr,{reason:t.criticalReason})]}),t.files>0?(0,N.jsxs)(`div`,{className:K.chapterStats,children:[(0,N.jsx)(I,{additions:t.additions,deletions:t.deletions,binary:t.binary===t.files}),(0,N.jsx)(`span`,{children:F(t.files,`file`)}),n>0&&(0,N.jsx)(`span`,{children:F(n,`unit`)})]}):e.stopIds.length>0&&(0,N.jsx)(`div`,{className:K.chapterStats,children:(0,N.jsx)(`span`,{children:`Walkthrough only: no files of its own. Its stops point at files in other groups.`})}),e.summary&&(0,N.jsx)(B,{source:e.summary,className:K.chapterSummary})]})}),Xr=(0,k.memo)(function({runId:e,group:t,parent:n,stats:r,files:i,diffs:a,collapsed:o,activePath:s,annotations:c,selection:l}){let u=A(),d=i.length>0&&i.every(e=>o.has(e.path)),f=(0,k.useCallback)(()=>{let t=new Set(o);for(let e of i)d?t.delete(e.path):t.add(e.path);u(me({runId:e,paths:[...t]}))},[d,o,u,i,e]),p=(0,k.useCallback)(n=>{u(ge({runId:e,path:n})),ct(t.id,n)},[u,t.id,e]);return(0,N.jsxs)(`section`,{id:it(t.id),"data-group-section":t.id,className:K.unit,children:[(0,N.jsx)(Jr,{group:t,parent:n,stats:r,files:i,allCollapsed:d,activePath:s,annotations:c,onToggleFiles:f,onSelectFile:p}),(0,N.jsxs)(`div`,{className:K.files,children:[i.map(t=>(0,N.jsxs)(`div`,{className:K.file,children:[(0,N.jsx)(`div`,{"data-file-start":!0,"data-path":t.path,className:K.marker,tabIndex:-1,"aria-label":`File ${t.path}`}),(0,N.jsx)(Or,{runId:e,file:t,diff:a.get(t.path),collapsed:o.has(t.path),annotations:c.get(t.path),selection:l?.path===t.path?l.range:null})]},t.path)),i.length===0&&(0,N.jsx)(`p`,{className:K.empty,children:`No files in this group.`})]})]})}),Zr=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M104 32H64a16 16 0 0 0-16 16v160a16 16 0 0 0 16 16h40a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16m0 176H64V48h40Zm88-176h-40a16 16 0 0 0-16 16v160a16 16 0 0 0 16 16h40a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16m0 176h-40V48h40Z`})]})),Qr=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M208 40H48a24 24 0 0 0-24 24v112a24 24 0 0 0 24 24h72v16H96a8 8 0 0 0 0 16h64a8 8 0 0 0 0-16h-24v-16h72a24 24 0 0 0 24-24V64a24 24 0 0 0-24-24M48 56h160a8 8 0 0 1 8 8v80H40V64a8 8 0 0 1 8-8m160 128H48a8 8 0 0 1-8-8v-16h176v16a8 8 0 0 1-8 8`})]})),$r=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`m219.31 108.68l-80-80a16 16 0 0 0-22.62 0l-80 80A15.87 15.87 0 0 0 32 120v96a8 8 0 0 0 8 8h64a8 8 0 0 0 8-8v-56h32v56a8 8 0 0 0 8 8h64a8 8 0 0 0 8-8v-96a15.87 15.87 0 0 0-4.69-11.32M208 208h-48v-56a8 8 0 0 0-8-8h-48a8 8 0 0 0-8 8v56H48v-88l80-80l80 80Z`})]})),ei=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M80 64a8 8 0 0 1 8-8h128a8 8 0 0 1 0 16H88a8 8 0 0 1-8-8m136 56H88a8 8 0 0 0 0 16h128a8 8 0 0 0 0-16m0 64H88a8 8 0 0 0 0 16h128a8 8 0 0 0 0-16M44 52a12 12 0 1 0 12 12a12 12 0 0 0-12-12m0 64a12 12 0 1 0 12 12a12 12 0 0 0-12-12m0 64a12 12 0 1 0 12 12a12 12 0 0 0-12-12`})]})),ti=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M233.54 142.23a8 8 0 0 0-8-2a88.08 88.08 0 0 1-109.8-109.8a8 8 0 0 0-10-10a104.84 104.84 0 0 0-52.91 37A104 104 0 0 0 136 224a103.1 103.1 0 0 0 62.52-20.88a104.84 104.84 0 0 0 37-52.91a8 8 0 0 0-1.98-7.98m-44.64 48.11A88 88 0 0 1 65.66 67.11a89 89 0 0 1 31.4-26A106 106 0 0 0 96 56a104.11 104.11 0 0 0 104 104a106 106 0 0 0 14.92-1.06a89 89 0 0 1-26.02 31.4`})]})),ni=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M208 136H48a16 16 0 0 0-16 16v40a16 16 0 0 0 16 16h160a16 16 0 0 0 16-16v-40a16 16 0 0 0-16-16m0 56H48v-40h160zm0-144H48a16 16 0 0 0-16 16v40a16 16 0 0 0 16 16h160a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16m0 56H48V64h160z`})]})),ri=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M216 40H40a16 16 0 0 0-16 16v144a16 16 0 0 0 16 16h176a16 16 0 0 0 16-16V56a16 16 0 0 0-16-16M40 56h40v144H40Zm176 144H96V56h120z`})]})),ii=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M120 40V16a8 8 0 0 1 16 0v24a8 8 0 0 1-16 0m72 88a64 64 0 1 1-64-64a64.07 64.07 0 0 1 64 64m-16 0a48 48 0 1 0-48 48a48.05 48.05 0 0 0 48-48M58.34 69.66a8 8 0 0 0 11.32-11.32l-16-16a8 8 0 0 0-11.32 11.32Zm0 116.68l-16 16a8 8 0 0 0 11.32 11.32l16-16a8 8 0 0 0-11.32-11.32M192 72a8 8 0 0 0 5.66-2.34l16-16a8 8 0 0 0-11.32-11.32l-16 16A8 8 0 0 0 192 72m5.66 114.34a8 8 0 0 0-11.32 11.32l16 16a8 8 0 0 0 11.32-11.32ZM48 128a8 8 0 0 0-8-8H16a8 8 0 0 0 0 16h24a8 8 0 0 0 8-8m80 80a8 8 0 0 0-8 8v24a8 8 0 0 0 16 0v-24a8 8 0 0 0-8-8m112-88h-24a8 8 0 0 0 0 16h24a8 8 0 0 0 0-16`})]})),ai=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M32 64a8 8 0 0 1 8-8h176a8 8 0 0 1 0 16H40a8 8 0 0 1-8-8m8 48h128a8 8 0 0 0 0-16H40a8 8 0 0 0 0 16m176 24H40a8 8 0 0 0 0 16h176a8 8 0 0 0 0-16m-48 40H40a8 8 0 0 0 0 16h128a8 8 0 0 0 0-16`})]})),oi=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M160 112h48a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16h-48a16 16 0 0 0-16 16v16h-16a24 24 0 0 0-24 24v32H72v-8a16 16 0 0 0-16-16H24a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h32a16 16 0 0 0 16-16v-8h32v32a24 24 0 0 0 24 24h16v16a16 16 0 0 0 16 16h48a16 16 0 0 0 16-16v-48a16 16 0 0 0-16-16h-48a16 16 0 0 0-16 16v16h-16a8 8 0 0 1-8-8V88a8 8 0 0 1 8-8h16v16a16 16 0 0 0 16 16M56 144H24v-32h32zm104 16h48v48h-48Zm0-112h48v48h-48Z`})]})),si=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M232 112a64.07 64.07 0 0 1-64 64H51.31l34.35 34.34a8 8 0 0 1-11.32 11.32l-48-48a8 8 0 0 1 0-11.32l48-48a8 8 0 0 1 11.32 11.32L51.31 160H168a48 48 0 0 0 0-96H80a8 8 0 0 1 0-16h88a64.07 64.07 0 0 1 64 64`})]})),ci=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M205.66 138.34a8 8 0 0 1-11.32 11.32L136 91.31V224a8 8 0 0 1-16 0V91.31l-58.34 58.35a8 8 0 0 1-11.32-11.32l72-72a8 8 0 0 1 11.32 0ZM216 32H40a8 8 0 0 0 0 16h176a8 8 0 0 0 0-16`})]})),li=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M224 48H32a16 16 0 0 0-16 16v128a16 16 0 0 0 16 16h192a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16m0 144H32V64h192zm-16-64a8 8 0 0 1-8 8H56a8 8 0 0 1 0-16h144a8 8 0 0 1 8 8m0-32a8 8 0 0 1-8 8H56a8 8 0 0 1 0-16h144a8 8 0 0 1 8 8M72 160a8 8 0 0 1-8 8h-8a8 8 0 0 1 0-16h8a8 8 0 0 1 8 8m96 0a8 8 0 0 1-8 8H96a8 8 0 0 1 0-16h64a8 8 0 0 1 8 8m40 0a8 8 0 0 1-8 8h-8a8 8 0 0 1 0-16h8a8 8 0 0 1 8 8`})]})),ui=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M224 128a8 8 0 0 1-8 8H40a8 8 0 0 1 0-16h176a8 8 0 0 1 8 8m-101.66-26.34a8 8 0 0 0 11.32 0l32-32a8 8 0 0 0-11.32-11.32L136 76.69V16a8 8 0 0 0-16 0v60.69l-18.34-18.35a8 8 0 0 0-11.32 11.32Zm11.32 52.68a8 8 0 0 0-11.32 0l-32 32a8 8 0 0 0 11.32 11.32L120 179.31V240a8 8 0 0 0 16 0v-60.69l18.34 18.35a8 8 0 0 0 11.32-11.32Z`})]})),di={wrap:`_wrap_18f2t_1`,trigger:`_trigger_18f2t_5`,small:`_small_18f2t_22`,menu:`_menu_18f2t_26`,item:`_item_18f2t_41`};function fi({actions:e}){let[t,n]=(0,k.useState)(!1),r=(0,k.useRef)(null);return(0,k.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)},i=e=>{e.key===`Escape`&&n(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,i)}},[t]),(0,N.jsxs)(`div`,{className:di.wrap,ref:r,children:[(0,N.jsxs)(`button`,{type:`button`,className:di.trigger,onClick:()=>n(e=>!e),"aria-haspopup":`menu`,"aria-expanded":t,title:`Expand or collapse files`,children:[(0,N.jsx)(ui,{"aria-hidden":!0}),(0,N.jsx)(Re,{"aria-hidden":!0,className:di.small})]}),t&&(0,N.jsx)(`div`,{className:di.menu,role:`menu`,children:e.map(e=>(0,N.jsx)(`button`,{type:`button`,role:`menuitem`,className:di.item,onClick:()=>{e.run(),n(!1)},children:e.label},e.label))})]})}var q={strip:`_strip_1qqee_1`,stage:`_stage_1qqee_12`,slices:`_slices_1qqee_17`,bar:`_bar_1qqee_25`,fill:`_fill_1qqee_34`,failed:`_failed_1qqee_41`,active:`_active_1qqee_45`,message:`_message_1qqee_46`,cost:`_cost_1qqee_62`},pi={resolving_target:`Resolving target`,checking_registry:`Checking registry`,building_map:`Building repo map`,grouping:`Grouping files`,reviewing:`Reviewing`,coordinating:`Merging findings`,walkthrough:`Writing walkthrough`,verifying:`Verifying`,writing:`Writing results`};function mi({progress:e}){let t=e,n=t?t.slicesDone+t.slicesFailed:0,r=t&&t.slicesTotal>0?Math.round(n/t.slicesTotal*100):null;return(0,N.jsxs)(`div`,{className:q.strip,role:`status`,"aria-live":`polite`,children:[(0,N.jsxs)(`span`,{className:q.stage,children:[t?.stage?pi[t.stage]:`Starting`,`…`]}),t&&t.slicesTotal>0&&(0,N.jsxs)(`span`,{className:q.slices,children:[(0,N.jsx)(`span`,{className:q.bar,children:(0,N.jsx)(`span`,{className:q.fill,style:{width:`${r}%`}})}),n,`/`,t.slicesTotal,` slices`,t.slicesFailed>0&&(0,N.jsxs)(`span`,{className:q.failed,children:[` (`,t.slicesFailed,` failed)`]})]}),t&&t.activeSlices.length>0&&(0,N.jsx)(`span`,{className:q.active,title:t.activeSlices.join(`
14
- `),children:t.activeSlices.join(`, `)}),t?.lastMessage&&(0,N.jsx)(`span`,{className:q.message,title:t.lastMessage,children:t.lastMessage}),t&&t.costUsd>0&&(0,N.jsx)(`span`,{className:q.cost,children:He(t.costUsd)})]})}var hi=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsxs)(`g`,{fill:`currentColor`,children:[(0,N.jsx)(`path`,{d:`M224 128a96 96 0 1 1-96-96a96 96 0 0 1 96 96`,opacity:.2}),(0,N.jsx)(`path`,{d:`M173.66 98.34a8 8 0 0 1 0 11.32l-56 56a8 8 0 0 1-11.32 0l-24-24a8 8 0 0 1 11.32-11.32L112 148.69l50.34-50.35a8 8 0 0 1 11.32 0M232 128A104 104 0 1 1 128 24a104.11 104.11 0 0 1 104 104m-16 0a88 88 0 1 0-88 88a88.1 88.1 0 0 0 88-88`})]})]})),gi=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M232 128a104 104 0 0 1-208 0c0-41 23.81-78.36 60.66-95.27a8 8 0 0 1 6.68 14.54C60.15 61.59 40 93.27 40 128a88 88 0 0 0 176 0c0-34.73-20.15-66.41-51.34-80.73a8 8 0 0 1 6.68-14.54C208.19 49.64 232 87 232 128`})]})),_i=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsxs)(`g`,{fill:`currentColor`,children:[(0,N.jsx)(`path`,{d:`M224 128a96 96 0 1 1-96-96a96 96 0 0 1 96 96`,opacity:.2}),(0,N.jsx)(`path`,{d:`M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24m88 104a87.56 87.56 0 0 1-20.41 56.28L71.72 60.4A88 88 0 0 1 216 128m-176 0a87.56 87.56 0 0 1 20.41-56.28L184.28 195.6A88 88 0 0 1 40 128`})]})]})),vi=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsxs)(`g`,{fill:`currentColor`,children:[(0,N.jsx)(`path`,{d:`M224 128a96 96 0 1 1-96-96a96 96 0 0 1 96 96`,opacity:.2}),(0,N.jsx)(`path`,{d:`M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24m0 192a88 88 0 1 1 88-88a88.1 88.1 0 0 1-88 88m-8-80V80a8 8 0 0 1 16 0v56a8 8 0 0 1-16 0m20 36a12 12 0 1 1-12-12a12 12 0 0 1 12 12`})]})]})),yi={badge:`_badge_19nmu_1`,icon:`_icon_19nmu_23`,spin:`_spin_19nmu_1`},bi={running:gi,complete:hi,failed:vi,cancelled:_i};function xi({status:e,compact:t=!1}){let n=bi[e];return(0,N.jsxs)(`span`,{className:yi.badge,"data-status":e,title:e,children:[(0,N.jsx)(n,{className:yi.icon,"aria-hidden":!0}),!t&&(0,N.jsx)(`span`,{children:e})]})}var J={header:`_header_hages_1`,inner:`_inner_hages_22`,row:`_row_hages_30`,home:`_home_hages_36`,title:`_title_hages_49`,controls:`_controls_hages_67`,toggle:`_toggle_hages_74`,meta:`_meta_hages_94`,author:`_author_hages_103`,refs:`_refs_hages_108`,ref:`_ref_hages_108`,right:`_right_hages_128`,action:`_action_hages_134`,actionError:`_actionError_hages_150`,error:`_error_hages_154`,tabs:`_tabs_hages_163`,tab:`_tab_hages_163`,tabLabel:`_tabLabel_hages_196`},Si={system:`light`,light:`dark`,dark:`system`},Ci={system:Qr,light:ii,dark:ti};function wi(e){let t=(0,k.useRef)(null),[n,r]=(0,k.useState)(!1),[i,a]=(0,k.useState)(!1),[o,s]=(0,k.useState)(0);return(0,k.useEffect)(()=>{let e=t.current;if(!e)return;let n=new ResizeObserver(()=>s(e.offsetHeight));return n.observe(e),()=>n.disconnect()},[]),(0,k.useEffect)(()=>{document.documentElement.style.setProperty(`--header-height`,`${n?0:o}px`)},[o,n]),(0,k.useEffect)(()=>()=>{document.documentElement.style.removeProperty(`--header-height`)},[]),(0,k.useEffect)(()=>{let t=window.scrollY,n=t,i=()=>{let i=window.scrollY;i<t&&(n=i),t=i,a(i>20),r(!e&&i-n>300)};return i(),window.addEventListener(`scroll`,i,{passive:!0}),()=>window.removeEventListener(`scroll`,i)},[e]),{ref:t,hidden:n,scrolled:i}}function Ti({title:e,pressed:t,onClick:n,children:r}){return(0,N.jsx)(`button`,{type:`button`,className:J.toggle,title:e,"aria-pressed":t,onClick:n,children:r})}function Ei({collapseActions:e,wide:t}){let n=A(),r=j(ye),i=j(be),a=j(xe),o=j(Se),s=j(Ce),c=Ci[a],l=R();return(0,N.jsxs)(`div`,{className:J.controls,children:[(0,N.jsx)(Ti,{title:`Back to the summary (t)`,onClick:()=>l.goToTop(),children:(0,N.jsx)(ci,{"aria-hidden":!0})}),(0,N.jsx)(fi,{actions:e}),(0,N.jsx)(Ti,{title:r===`split`?`Split view (switch to unified)`:`Unified view (switch to split)`,onClick:()=>n(le(r===`split`?`unified`:`split`)),children:r===`split`?(0,N.jsx)(Zr,{"aria-hidden":!0}):(0,N.jsx)(ni,{"aria-hidden":!0})}),(0,N.jsx)(Ti,{title:i?`Wrap long lines: on`:`Wrap long lines: off`,pressed:i,onClick:()=>n(ue()),children:i?(0,N.jsx)(si,{"aria-hidden":!0}):(0,N.jsx)(ai,{"aria-hidden":!0})}),(0,N.jsx)(Ti,{title:o===`tree`?`File tree (switch to list)`:`File list (switch to tree)`,onClick:()=>n(fe(o===`tree`?`list`:`tree`)),children:o===`tree`?(0,N.jsx)(oi,{"aria-hidden":!0}):(0,N.jsx)(ei,{"aria-hidden":!0})}),t&&(0,N.jsx)(Ti,{title:s?`Hide sidebar (show group tabs)`:`Show sidebar`,pressed:s,onClick:()=>n(pe()),children:(0,N.jsx)(ri,{"aria-hidden":!0})}),(0,N.jsx)(Ti,{title:`Theme: ${a}`,onClick:()=>n(de(Si[a])),children:(0,N.jsx)(c,{"aria-hidden":!0})}),(0,N.jsx)(Ti,{title:`Keyboard shortcuts (?)`,onClick:()=>n(Qn(!0)),children:(0,N.jsx)(li,{"aria-hidden":!0})})]})}function Di({tree:e,visible:t}){let n=e.ordered.find(e=>t.has(e.id))?.id,r=(0,k.useRef)(null);return(0,k.useEffect)(()=>{n&&r.current?.querySelector(`[data-group-id="${CSS.escape(n)}"]`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[n]),(0,N.jsx)(`div`,{className:J.tabs,ref:r,children:e.ordered.map(t=>{let r=e.stats.get(t.id);return(0,N.jsxs)(`button`,{type:`button`,className:J.tab,"data-group-id":t.id,"data-active":t.id===n,"data-chapter":!t.parentId&&t.files.length===0,onClick:()=>at(t.id),children:[(0,N.jsx)(Kr,{icon:t.icon}),(0,N.jsx)(`span`,{className:J.tabLabel,children:t.title}),r?.critical&&(0,N.jsx)(qr,{reason:r.criticalReason}),r&&r.files>0&&(0,N.jsx)(I,{additions:r.additions,deletions:r.deletions,binary:r.binary===r.files})]},t.id)})})}function Oi({run:e}){let[t,{isLoading:n,error:r}]=un(),i=f(),a=async()=>{let n=await t({kind:`review`,fromRun:e.id});`data`in n&&n.data&&i({to:`/runs/$runId`,params:{runId:n.data.id}})};return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`button`,{type:`button`,className:J.action,disabled:n||e.status===`running`,onClick:()=>void a(),title:`Start a full review of this base and head`,children:n?`Starting review…`:`Review these changes`}),r&&(0,N.jsx)(`span`,{className:J.actionError,children:Me(r)})]})}function ki(e){let{reviewScope:t,reviewedFiles:n,scopeReason:r}=e.meta;return t===`incremental`?n?`Only the ${F(n,`file`)} changed since the last review were reviewed again`:`No code changed since the last review`:r?`Full review: ${r}`:`Full review`}function Ai({run:e,tree:t,visible:n,collapseActions:r}){let i=vn(_n),a=j(Ce),{ref:o,hidden:s,scrolled:c}=wi(i),l=e.target,u=e.files.reduce((e,t)=>({additions:e.additions+t.additions,deletions:e.deletions+t.deletions}),{additions:0,deletions:0}),d=l.kind===`pr`?l.baseRef:qe(e.base),f=l.kind===`pr`?l.headRef:qe(e.head),p=e.status===`running`?e.progress?.costUsd??0:e.meta.costUsd,m=jt(e)===`diff`;return(0,N.jsx)(`header`,{ref:o,"data-app-header":!0,className:J.header,"data-hidden":s,"data-scrolled":c,children:(0,N.jsxs)(`div`,{className:J.inner,children:[(0,N.jsxs)(`div`,{className:J.row,children:[(0,N.jsx)(v,{to:`/`,className:J.home,title:`All runs`,children:(0,N.jsx)($r,{"aria-hidden":!0})}),(0,N.jsx)(xi,{status:e.status,compact:!0}),(0,N.jsx)(`h1`,{className:J.title,children:l.kind===`pr`?(0,N.jsx)(`a`,{href:l.url,target:`_blank`,rel:`noreferrer`,children:Ve(l)}):Ve(l)}),(0,N.jsx)(Ei,{collapseActions:r,wide:i})]}),(0,N.jsxs)(`div`,{className:J.meta,children:[l.kind===`pr`&&(0,N.jsx)(`span`,{className:J.author,children:l.author}),(0,N.jsxs)(`span`,{className:J.refs,children:[(0,N.jsx)(`code`,{className:J.ref,title:e.base,children:d}),(0,N.jsx)(`span`,{"aria-label":`from`,children:`←`}),(0,N.jsx)(`code`,{className:J.ref,title:e.head,children:f})]}),(0,N.jsx)(`span`,{children:F(e.files.length,`file`)}),(0,N.jsx)(I,{additions:u.additions,deletions:u.deletions}),e.round!==void 0&&e.round>1&&(0,N.jsxs)(`span`,{title:ki(e),children:[`Round `,e.round]}),(0,N.jsxs)(`span`,{className:J.right,children:[m&&!e.repo.remote&&(0,N.jsx)(Oi,{run:e}),(0,N.jsx)(`span`,{title:e.repo.root,children:e.repo.slug??e.repo.root}),(0,N.jsx)(`span`,{children:Ke(e.createdAt)}),(!m||p>0)&&(0,N.jsx)(`span`,{title:`Model cost`,children:He(p)})]})]}),e.status===`running`&&(0,N.jsx)(mi,{progress:e.progress}),e.status===`failed`&&e.error&&(0,N.jsxs)(`p`,{className:J.error,children:[m?`Run`:`Review`,` failed: `,e.error]}),(!i||!a)&&(0,N.jsx)(Di,{tree:t,visible:n})]})})}var ji=[[`j / k`,`Next / previous file`],[`n / p`,`Next / previous finding`],[`] / [`,`Next / previous walkthrough stop`],[`x`,`Collapse or expand the current file`],[`r`,`Mark the current file viewed (or not)`],[`t`,`Back to the summary (Back returns here)`],[`?`,`Show this list`]];function Mi(){let e=j(or),t=A(),n=(0,k.useRef)(null);return(0,k.useEffect)(()=>{let t=n.current;t&&(e&&!t.open&&t.showModal(),!e&&t.open&&t.close())},[e]),(0,N.jsxs)(`dialog`,{ref:n,className:P.dialog,"aria-labelledby":`keyboard-help-title`,onClose:()=>t(Qn(!1)),onClick:e=>{e.target===e.currentTarget&&n.current?.close()},children:[(0,N.jsx)(`header`,{className:P.header,children:(0,N.jsx)(`h2`,{id:`keyboard-help-title`,className:P.title,children:`Keyboard shortcuts`})}),(0,N.jsx)(`dl`,{className:P.keys,children:ji.map(([e,t])=>(0,N.jsxs)(`div`,{className:P.key,children:[(0,N.jsx)(`dt`,{children:e.split(` / `).map((e,t)=>(0,N.jsxs)(`span`,{children:[t>0&&` / `,(0,N.jsx)(`kbd`,{children:e})]},e))}),(0,N.jsx)(`dd`,{children:t})]},e))}),(0,N.jsx)(`div`,{className:P.actions,children:(0,N.jsx)(`button`,{type:`button`,className:P.button,onClick:()=>n.current?.close(),children:`Close`})})]})}var Y={files:`_files_133vo_1`,findings:`_findings_133vo_2`,empty:`_empty_133vo_18`,file:`_file_133vo_1`,finding:`_finding_133vo_2`,title:`_title_133vo_63`,tag:`_tag_133vo_79`,dot:`_dot_133vo_97`,line:`_line_133vo_114`};function Ni(e){let t=[];for(let n of e){let e=t.at(-1);e?.file===n.anchor.file?e.findings.push(n):t.push({file:n.anchor.file,findings:[n]})}return t}function Pi(e){let t=e.anchor,n=t.kind===`line`?t.line:t.cited.line;return n?`L${n}`:`file`}function Fi(e){return e.slice(e.lastIndexOf(`/`)+1)}function Ii({findings:e,overCap:t,dismissed:n}){let r=R(),i=j(er),a=(0,k.useRef)(null);return(0,k.useEffect)(()=>{let e=a.current,t=e?.closest(`nav`)?.parentElement?.parentElement,n=e?.querySelector(`[aria-current="true"]`);t&&n&&ot(t,n)},[i]),e.length===0?(0,N.jsx)(`p`,{className:Y.empty,children:n.size>0?`Every finding has been dismissed.`:`No findings in the changed files.`}):(0,N.jsx)(`ol`,{ref:a,className:Y.files,children:Ni(e).map((e,a)=>(0,N.jsxs)(`li`,{children:[(0,N.jsx)(`button`,{type:`button`,className:Y.file,title:e.file,onClick:()=>r.goToFile(e.file),children:Fi(e.file)}),(0,N.jsx)(`ol`,{className:Y.findings,children:e.findings.map(e=>(0,N.jsx)(`li`,{children:(0,N.jsxs)(`button`,{type:`button`,className:Y.finding,"data-severity":e.severity,"data-over-cap":t.has(e.id),"data-preexisting":e.preexisting??!1,"data-dismissed":n.has(e.id),"aria-current":e.id===i?`true`:void 0,title:`${Be[e.severity]}${e.preexisting?` (pre-existing)`:``}${n.has(e.id)?` (dismissed)`:``}: ${e.title}`,onClick:()=>r.goToFinding(e.id),children:[(0,N.jsx)(`span`,{className:Y.dot,"aria-hidden":!0}),(0,N.jsx)(`span`,{className:Y.title,children:e.title}),e.preexisting&&(0,N.jsx)(`span`,{className:Y.tag,children:`pre-existing`}),(0,N.jsx)(`span`,{className:Y.line,children:Pi(e)})]})},e.id))})]},`${e.file}-${a}`))})}var Li={chapters:`_chapters_12sy8_1`,stops:`_stops_12sy8_2`,chapter:`_chapter_12sy8_1`,stop:`_stop_12sy8_2`,number:`_number_12sy8_49`,title:`_title_12sy8_62`};function Ri(e,t){let n=new Map(e.filter(e=>!e.parentId).map(e=>[e.id,e.title])),r=[],i=new Map;for(let e of t){let t=n.has(e.chapterId)?e.chapterId:``,a=i.get(t);a||(a={id:t,title:n.get(t)??`Walkthrough`,stops:[]},i.set(t,a),r.push(a)),a.stops.push(e)}return r}function zi({groups:e,stops:t}){let n=R(),r=j(tr),i=(0,k.useRef)(null),a=Ri(e,t),o=0;return(0,k.useEffect)(()=>{let e=i.current,t=e?.closest(`nav`)?.parentElement?.parentElement,n=e?.querySelector(`[aria-current="step"]`);t&&n&&ot(t,n)},[r]),(0,N.jsx)(`ol`,{ref:i,className:Li.chapters,children:a.map(e=>(0,N.jsxs)(`li`,{children:[(0,N.jsx)(`h3`,{className:Li.chapter,children:e.title}),(0,N.jsx)(`ol`,{className:Li.stops,children:e.stops.map(e=>(o+=1,(0,N.jsx)(`li`,{children:(0,N.jsxs)(`button`,{type:`button`,className:Li.stop,"data-importance":e.importance,"aria-current":e.id===r?`step`:void 0,onClick:()=>n.goToStop(e.id),children:[(0,N.jsx)(`span`,{className:Li.number,children:o}),(0,N.jsx)(`span`,{className:Li.title,children:e.title})]})},e.id)))})]},e.id||`loose`))})}var X={sidebar:`_sidebar_1dwkw_1`,modes:`_modes_1dwkw_7`,mode:`_mode_1dwkw_7`,modeCount:`_modeCount_1dwkw_32`,nav:`_nav_1dwkw_38`,list:`_list_1dwkw_42`,row:`_row_1dwkw_51`,caret:`_caret_1dwkw_69`,caretSpace:`_caretSpace_1dwkw_70`,link:`_link_1dwkw_87`,label:`_label_1dwkw_101`,icon:`_icon_1dwkw_108`,title:`_title_1dwkw_116`,sub:`_sub_1dwkw_127`};function Bi({group:e,stats:t,depth:n,visible:r,fold:i}){return(0,N.jsxs)(`li`,{className:X.row,"data-visible":r,"data-depth":n,children:[i?(0,N.jsx)(`button`,{type:`button`,className:X.caret,onClick:i.onToggle,title:i.folded?`Show units`:`Hide units`,"aria-expanded":!i.folded,children:i.folded?(0,N.jsx)(ze,{"aria-hidden":!0}):(0,N.jsx)(Re,{"aria-hidden":!0})}):(0,N.jsx)(`span`,{className:X.caretSpace}),(0,N.jsxs)(`button`,{type:`button`,className:X.link,onClick:()=>at(e.id),children:[(0,N.jsxs)(`span`,{className:X.label,children:[(0,N.jsx)(Kr,{icon:e.icon,className:X.icon}),(0,N.jsx)(`span`,{className:X.title,children:e.title}),t?.critical&&(0,N.jsx)(qr,{reason:t.criticalReason})]}),t&&t.files>0&&(0,N.jsxs)(`span`,{className:X.sub,children:[(0,N.jsx)(I,{additions:t.additions,deletions:t.deletions,binary:t.binary===t.files}),(0,N.jsxs)(`span`,{children:[`・`,F(t.files,`file`)]})]}),t?.files===0&&e.stopIds.length>0&&(0,N.jsx)(`span`,{className:X.sub,children:`Walkthrough only`})]})]})}var Vi={groups:`Groups`,findings:`Findings`,guide:`Guide`};function Hi({run:e,tree:t,visible:n,folded:r,onToggleFold:i,findings:a,overCap:o,dismissed:s}){let c=A(),l=j(rr),u=[`groups`];e.findings.length+e.overCapFindings.length>0&&u.push(`findings`),e.stops.length>0&&u.push(`guide`);let d=u.includes(l)?l:`groups`;return(0,N.jsxs)(`div`,{className:X.sidebar,children:[u.length>1&&(0,N.jsx)(`div`,{className:X.modes,role:`group`,"aria-label":`Sidebar view`,children:u.map(e=>(0,N.jsxs)(`button`,{type:`button`,className:X.mode,"aria-pressed":d===e,onClick:()=>c(Yn(e)),children:[Vi[e],e===`findings`&&(0,N.jsx)(`span`,{className:X.modeCount,children:a.length})]},e))}),d===`guide`&&(0,N.jsx)(`nav`,{className:X.nav,"aria-label":`Walkthrough`,children:(0,N.jsx)(zi,{groups:e.groups,stops:e.stops})}),d===`findings`&&(0,N.jsx)(`nav`,{className:X.nav,"aria-label":`Findings`,children:(0,N.jsx)(Ii,{findings:a,overCap:o,dismissed:s})}),d===`groups`&&(0,N.jsx)(Ui,{tree:t,visible:n,folded:r,onToggleFold:i})]})}function Ui({tree:e,visible:t,folded:n,onToggleFold:r}){let i=(0,k.useRef)(null),a=e.ordered.find(e=>t.has(e.id))?.id;return(0,k.useEffect)(()=>{let e=i.current,t=e?.parentElement?.parentElement,n=e?.querySelector(`[data-visible="true"]`);t&&n&&ot(t,n)},[a]),(0,N.jsx)(`nav`,{ref:i,className:X.nav,"aria-label":`Groups`,children:(0,N.jsx)(`ul`,{className:X.list,children:e.chapters.flatMap(({chapter:i,units:a})=>{let o=[];if(i){let s=n.has(i.id);if(o.push((0,N.jsx)(Bi,{group:i,stats:e.stats.get(i.id),depth:0,visible:t.has(i.id),fold:a.length>0?{folded:s,onToggle:()=>r(i.id)}:void 0},i.id)),s)return o}for(let n of a)o.push((0,N.jsx)(Bi,{group:n,stats:e.stats.get(n.id),depth:+!!i,visible:t.has(n.id)},n.id));return o})})})}var Wi={product:0,deploy:1,tooling:2},Gi=[`product`,`deploy`,`tooling`],Ki={product:`Prod risk`,deploy:`Deploy risk`,tooling:`Main findings — tooling`},qi=e=>e.severity===`blocker`||e.severity===`should-fix`;function Ji(e){let t=e.filter(e=>!e.preexisting),n=t.filter(e=>e.severity===`blocker`).length,r=t.filter(e=>e.severity===`should-fix`).length;return n?{level:`high`,label:`Merge risk: high`,detail:`${n} ${n===1?`blocker`:`blockers`} open.`}:r?{level:`moderate`,label:`Merge risk: moderate`,detail:`${r} should-fix ${r===1?`finding`:`findings`} open.`}:{level:`low`,label:`Merge risk: low`,detail:`nothing found that should block this.`}}function Yi(e){let t=e.filter(e=>e.surface===`product`&&!e.preexisting),n=t.filter(qi).length;return t.length===0?{level:`low`,label:`Prod risk: none`,detail:`everything found is in tooling, deploy or test code.`}:n?{level:`high`,label:`Prod risk: ${n}`,detail:`${n===1?`finding`:`findings`} in production code worth acting on.`}:{level:`moderate`,label:`Prod risk: low`,detail:`${t.length} in production code, none above a question.`}}function Xi(e){let t=new Set(e);return Gi.find(e=>t.has(e))??`product`}function Zi(e,t){return Wi[e]<=Wi[t]}var Qi=[`high`,`medium`,`low`];function $i(e){let t=new Map;for(let n of e){let e=t.get(n.file);e?e.push(n):t.set(n.file,[n])}return[...t].map(([e,t])=>({file:e,findings:t}))}function ea(e){let t=[...e.findings].sort((e,t)=>z.indexOf(e.severity)-z.indexOf(t.severity)||Qi.indexOf(e.confidence)-Qi.indexOf(t.confidence)),n=t.filter(e=>e.repeatOf===void 0&&!e.preexisting),r=t.filter(e=>e.repeatOf===void 0&&e.preexisting),i=t.filter(e=>e.repeatOf!==void 0),a=z.map(e=>[e,n.filter(t=>t.severity===e).length]).filter(([,e])=>e>0),o=n.flatMap(e=>e.surface?[{finding:e,severity:e.severity,surface:e.surface}]:[]),s=o.length===n.length,c=e.files.flatMap(e=>e.surface?[e.surface]:[]),l=s?Xi(c.length?c:o.map(e=>e.surface)):null,u=l?o.filter(e=>Zi(e.surface,l)).map(e=>e.finding):n,d=l?o.filter(e=>!Zi(e.surface,l)).map(e=>e.finding):[];return{merge:Ji(n),...s?{prod:Yi(o)}:{},counts:a,title:l?Ki[l]:`Findings`,main:$i(u),other:$i(d),preexisting:$i(r),echoed:i}}var ta=new Set([`range`,`branch`,`commit`]);function na(e){if(e.target.kind===`pr`)return`the description`;let t=ta.has(e.target.kind);return e.intent.stated?t?`the stated intent and commit messages`:`the stated intent`:t?`the commit messages`:void 0}var Z={summary:`_summary_19fm7_1`,verdicts:`_verdicts_19fm7_22`,dot:`_dot_19fm7_28`,sep:`_sep_19fm7_64`,section:`_section_19fm7_68`,sectionHeader:`_sectionHeader_19fm7_74`,heading:`_heading_19fm7_81`,subheading:`_subheading_19fm7_87`,findings:`_findings_19fm7_94`,fileFindings:`_fileFindings_19fm7_95`,list:`_list_19fm7_96`,finding:`_finding_19fm7_94`,outside:`_outside_19fm7_113`,lineLink:`_lineLink_19fm7_120`,fileLink:`_fileLink_19fm7_121`,path:`_path_19fm7_133`,details:`_details_19fm7_141`,overCap:`_overCap_19fm7_150`,labelled:`_labelled_19fm7_157`,inline:`_inline_19fm7_161`,alignment:`_alignment_19fm7_169`,why:`_why_19fm7_185`,note:`_note_19fm7_190`,files:`_files_19fm7_194`,footer:`_footer_19fm7_203`},ra=`summary`,ia={aligned:e=>`Matches ${e}`,partial:e=>`Partly matches ${e}`,misaligned:e=>`Does not match ${e}`},aa=[[`matches`,()=>`Holds up on`],[`mismatches`,()=>`Does not hold up on`],[`unstated`,e=>`In the diff but not in ${e}`],[`missing`,()=>`Stated but not accomplished`]];function oa(e){let t=e.replace(/^the /,``);return t.charAt(0).toUpperCase()+t.slice(1)}var sa=[[`overCap`,`More code files than the reviewers could read; these were left out.`],[`failed`,`The reviewer for these files failed.`],[`budget`,`The cost limit stopped the review before these files.`]];function ca({path:e,known:t}){let n=R();return t?(0,N.jsx)(`button`,{type:`button`,className:Z.fileLink,onClick:()=>n.goToFile(e),children:(0,N.jsx)(`code`,{className:Z.path,children:e})}):(0,N.jsx)(`code`,{className:Z.path,children:e})}function la({verdict:e}){return(0,N.jsxs)(`p`,{className:Z.verdict,children:[(0,N.jsx)(`span`,{className:Z.dot,"data-level":e.level,"aria-hidden":!0}),(0,N.jsx)(`strong`,{children:e.label}),` — `,e.detail]})}function ua(e){let t=e.anchor,n=t.kind===`line`?t.line:t.cited.line,r=t.kind===`line`?t.endLine:t.cited.endLine;return n?r&&r!==n?`L${n}-${r}`:`L${n}`:`whole file`}function da({groups:e,files:t}){let n=R();return(0,N.jsx)(`ul`,{className:Z.findings,children:e.map(({file:e,findings:r})=>{let i=t.has(e);return(0,N.jsxs)(`li`,{children:[(0,N.jsx)(ca,{path:e,known:i}),!i&&(0,N.jsx)(`span`,{className:Z.outside,children:`outside the diff`}),(0,N.jsx)(`ul`,{className:Z.fileFindings,children:r.map(e=>(0,N.jsxs)(`li`,{className:Z.finding,children:[(0,N.jsx)(`span`,{className:Z.dot,"data-severity":e.severity,"aria-hidden":!0}),(0,N.jsx)(`strong`,{children:Be[e.severity]}),` `,e.title,` —`,` `,i?(0,N.jsx)(`button`,{type:`button`,className:Z.lineLink,onClick:()=>n.goToFinding(e.id),children:ua(e)}):(0,N.jsx)(`span`,{children:ua(e)})]},e.id))})]},e)})})}function fa({label:e,children:t}){return(0,N.jsxs)(`div`,{className:Z.labelled,children:[(0,N.jsx)(`strong`,{children:e}),` `,t]})}function pa({run:e}){let t=A(),n=j(ir),r=j(ar),i=pn(e.id),a=mn(e.id),o=Object.values(i.findingStatus).filter(e=>e===`accepted`).length,s=e.files.filter(e=>e.path in i.reviewedFiles).length,c=e=>r||!a.has(e.id),l=new Set(e.files.map(e=>e.path)),u=ea({files:e.files,findings:e.findings.filter(e=>!a.has(e.id))}),d=r?ea({files:e.files,findings:e.findings.filter(c)}):u,{intent:f,overview:p,meta:m}=e,h=u.main.length+u.other.length,g=e.findings.some(e=>a.has(e.id)&&!e.preexisting&&e.repeatOf===void 0),_=d.main.reduce((e,t)=>e+t.findings.length,0),y=d.other.reduce((e,t)=>e+t.findings.length,0),b=d.preexisting.reduce((e,t)=>e+t.findings.length,0),x=e.overCapFindings.filter(c),S=na(e),C=S?f.alignment:void 0,w=S?aa.filter(([e])=>(f[e]?.length??0)>0):[],ee=sa.filter(([t])=>(e.unreviewed[t]?.length??0)>0),te=S?f.mismatches?.[0]:void 0,T=jt(e)===`diff`,E=e.groups.filter(e=>e.files.length>0).length;return(0,N.jsxs)(`section`,{id:ra,tabIndex:-1,className:Z.summary,"aria-label":T?`Diff summary`:`Review summary`,children:[T?(0,N.jsxs)(`p`,{children:[F(e.files.length,`changed file`),` in `,F(E,`group`),e.status===`complete`&&e.stops.length===0&&!p.focus&&(0,N.jsxs)(`span`,{className:Z.note,children:[` · no walkthrough (add one with `,(0,N.jsx)(`code`,{children:`diffloupe diff --walkthrough`}),`)`]})]}):h===0?(0,N.jsx)(`p`,{children:e.status===`running`?`Reviewing the changed files. Findings appear here when the review finishes.`:e.status===`complete`?g?`Every finding has been dismissed.`:`No new issues found in the changed files.`:`The review ${e.status===`failed`?`failed`:`was cancelled`} before reporting any findings.`}):(0,N.jsxs)(`div`,{className:Z.verdicts,children:[(0,N.jsx)(la,{verdict:u.merge}),u.prod&&(0,N.jsx)(la,{verdict:u.prod}),(0,N.jsx)(`p`,{className:Z.counts,children:u.counts.map(([e,t],n)=>(0,N.jsxs)(`span`,{children:[n>0&&(0,N.jsx)(`span`,{className:Z.sep,children:` · `}),(0,N.jsx)(`span`,{className:Z.dot,"data-severity":e,"aria-hidden":!0}),(0,N.jsx)(`strong`,{children:Be[e]}),`: `,t]},e))})]}),_>0&&(0,N.jsxs)(`section`,{className:Z.section,children:[(0,N.jsxs)(`div`,{className:Z.sectionHeader,children:[(0,N.jsxs)(`h3`,{className:Z.heading,children:[d.title,` (`,_,`)`]}),(0,N.jsx)(ur,{text:()=>In(e,{includeOverCap:n,state:i,includeDismissed:r}),label:`Copy all`,title:`Copy all findings as markdown`})]}),(0,N.jsx)(da,{groups:d.main,files:l})]}),y>0&&(0,N.jsxs)(`details`,{className:Z.details,children:[(0,N.jsxs)(`summary`,{children:[`Everything else (`,y,`) — lower-risk surfaces`]}),(0,N.jsx)(da,{groups:d.other,files:l})]}),b>0&&(0,N.jsxs)(`details`,{className:Z.details,children:[(0,N.jsxs)(`summary`,{children:[`Pre-existing (`,b,`) — not introduced by this change`]}),(0,N.jsx)(da,{groups:d.preexisting,files:l})]}),x.length>0&&(0,N.jsxs)(`div`,{className:Z.section,children:[(0,N.jsxs)(`label`,{className:Z.overCap,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>t(Xn())}),F(x.length,`more finding`),` past the posting cap. Show them here and in the diff.`]}),n&&(0,N.jsx)(da,{groups:$i(x),files:l})]}),(a.size>0||o>0||s>0)&&(0,N.jsxs)(`div`,{className:Z.section,children:[(0,N.jsx)(`p`,{className:Z.note,children:[o>0?`${o} accepted`:``,a.size>0?`${a.size} dismissed`:``,`${s} of ${F(e.files.length,`file`)} reviewed`].filter(Boolean).join(` · `)}),a.size>0&&(0,N.jsxs)(`label`,{className:Z.overCap,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>t(Zn())}),`Show dismissed findings here and in the diff.`]})]}),d.echoed.length>0&&(0,N.jsxs)(`details`,{className:Z.details,children:[(0,N.jsxs)(`summary`,{children:[`Agreeing with `,F(d.echoed.length,`existing review comment`)]}),(0,N.jsx)(da,{groups:$i(d.echoed),files:l})]}),(C||f.inferred||f.stated||w.length>0)&&(0,N.jsxs)(`div`,{className:Z.section,children:[S&&(C||te)&&(0,N.jsxs)(fa,{label:`Intent:`,children:[C&&(0,N.jsx)(`span`,{className:Z.alignment,"data-alignment":C,children:ia[C](S)}),te&&(0,N.jsxs)(N.Fragment,{children:[` — `,te]})]}),f.inferred&&(0,N.jsx)(fa,{label:`What it does:`,children:f.inferred}),S&&(f.stated||w.length>0)&&(0,N.jsxs)(`details`,{className:Z.details,children:[(0,N.jsxs)(`summary`,{children:[oa(S),` compared with the code`]}),f.stated&&(0,N.jsx)(fa,{label:`Stated:`,children:f.stated}),w.map(([e,t])=>(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h4`,{className:Z.subheading,children:t(S)}),(0,N.jsx)(`ul`,{className:Z.list,children:(f[e]??[]).map(e=>(0,N.jsx)(`li`,{children:e},e))})]},e))]})]}),p.focus&&(0,N.jsxs)(`div`,{className:Z.labelled,children:[(0,N.jsx)(`strong`,{children:`What to focus on:`}),` `,(0,N.jsx)(B,{source:p.focus,className:Z.inline})]}),p.startHere.length>0&&(0,N.jsxs)(`section`,{className:Z.section,children:[(0,N.jsx)(`h3`,{className:Z.heading,children:`Start here`}),(0,N.jsx)(`ol`,{className:Z.list,children:p.startHere.map(e=>(0,N.jsxs)(`li`,{children:[(0,N.jsx)(ca,{path:e.file,known:l.has(e.file)}),` — `,e.why]},e.file))})]}),e.resolved.length>0&&(0,N.jsxs)(`section`,{className:Z.section,children:[(0,N.jsx)(`h3`,{className:Z.heading,children:`Fixed since the last run`}),(0,N.jsx)(`ul`,{className:Z.list,children:e.resolved.map(t=>(0,N.jsxs)(`li`,{children:[e.priorRunId?(0,N.jsx)(v,{to:`/runs/$runId`,params:{runId:e.priorRunId},search:{finding:t.id},children:t.title??t.id}):t.title??t.id,t.file&&(0,N.jsxs)(`code`,{className:Z.path,children:[` `,t.file]}),t.note&&(0,N.jsx)(`span`,{className:Z.why,children:t.note})]},t.id))})]}),ee.length>0&&(0,N.jsxs)(`section`,{className:Z.section,children:[(0,N.jsx)(`h3`,{className:Z.heading,children:`Not reviewed`}),ee.map(([t,n])=>(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:Z.note,children:n}),(0,N.jsx)(`ul`,{className:Z.files,children:(e.unreviewed[t]??[]).map(e=>(0,N.jsx)(`li`,{children:(0,N.jsx)(ca,{path:e,known:l.has(e)})},e))})]},t))]}),(0,N.jsxs)(`footer`,{className:Z.footer,children:[p.changeType&&(0,N.jsx)(`span`,{children:p.changeType}),m.costUsd>0||e.status===`running`&&!T?(0,N.jsx)(`span`,{children:He(m.costUsd)}):!T&&(0,N.jsx)(`span`,{children:`cost not reported`}),m.wallMs>0&&(0,N.jsx)(`span`,{children:Ue(m.wallMs)}),m.model&&(0,N.jsx)(`span`,{children:m.effort?`${m.model} (${m.effort})`:m.model}),(0,N.jsx)(`span`,{children:e.status})]})]})}function ma(e,t){let n=new Map;for(let t of e){let e=n.get(t.groupId);e?e.push(t):n.set(t.groupId,[t])}return t.ordered.flatMap(e=>n.get(e.id)??[])}function ha(e,t,n={}){let r=ma(e.files,t),i=new Map(r.map((e,t)=>[e.path,t])),a=n.showOverCap?[...e.findings,...e.overCapFindings]:e.findings,o=e=>e.anchor.kind===`file`?0:e.anchor.line;return{files:r,findings:a.filter(e=>i.has(e.anchor.file)&&!n.hidden?.has(e.id)).map((e,t)=>({f:e,i:t})).sort((e,t)=>i.get(e.f.anchor.file)-i.get(t.f.anchor.file)||o(e.f)-o(t.f)||z.indexOf(e.f.severity)-z.indexOf(t.f.severity)||e.i-t.i).map(({f:e})=>e),stops:[...e.stops]}}function ga(e,t,n){if(!e.length)return;let r=t===void 0?-1:e.indexOf(t);return r===-1?e[0]:e[r+n]}var _a={j:`nextFile`,k:`prevFile`,n:`nextFinding`,p:`prevFinding`,"]":`nextStop`,"[":`prevStop`,x:`toggleFile`,r:`toggleReviewed`,t:`top`,"?":`help`},va=new Set([`checkbox`,`radio`,`button`,`submit`,`reset`]);function ya(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.tagName===`INPUT`?!va.has(t.type??`text`):t.isContentEditable===!0||t.tagName===`TEXTAREA`||t.tagName===`SELECT`}function ba(e){return e.ctrlKey||e.metaKey||e.altKey||ya(e.target)?null:_a[e.key]??null}function xa(e,t,n,r,i){let a=e.map(e=>e.id);return t&&a.includes(t)?ga(a,t,n):i===void 0?n===1?a[0]:void 0:n===1?e.find(e=>r(e)>=i)?.id:e.filter(e=>r(e)<i).at(-1)?.id}function Sa(e,t,n){let r=ie(),i=(0,k.useRef)({lists:e,nav:t});i.current={lists:e,nav:t},(0,k.useEffect)(()=>{function e(e){let t=ba(e),{lists:a,nav:o}=i.current;if(!t||!a||document.querySelector(`dialog[open]`))return;e.preventDefault();let s=r.getState(),c=dt(),l=a.files.map(e=>e.path),u=c?l.indexOf(c.path):void 0,d=e=>l.indexOf(e),f=t.startsWith(`next`)?1:-1;switch(t){case`nextFile`:case`prevFile`:{let e=c?ga(l,c.path,f):f===1?l[0]:void 0;e&&o.goToFile(e);return}case`nextFinding`:case`prevFinding`:{let e=xa(a.findings,s.focus.finding,f,e=>d(e.anchor.file),u);e&&o.goToFinding(e);return}case`nextStop`:case`prevStop`:{let e=xa(a.stops,s.focus.stop,f,()=>0,void 0);e&&o.goToStop(e);return}case`toggleFile`:{let e=c?.path??s.focus.file;if(!e)return;let t=we(s,n)?.includes(e)??!1;r.dispatch(he({runId:n,path:e}));let i=c?.groupId??a.files.find(t=>t.path===e)?.groupId;!t&&i&&ct(i,e,{focus:!0});return}case`toggleReviewed`:{let e=c?.path??s.focus.file;if(!e)return;let t=L.endpoints.getRunState.select(n)(s).data?.reviewedFiles??{};o.setReviewed(e,!(e in t));return}case`top`:o.goToTop();return;case`help`:r.dispatch(Qn(!0));return}}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r,n])}async function Ca(e){if(typeof window>`u`||!window.isSecureContext||!navigator.clipboard)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function wa(e,t,n={findings:[],stops:[]}){let r=new Map(e.map(e=>[e.id,e])),i=new Map(t.map(e=>[e.path,e])),a=[],o=new Map;for(let t of e){let n=t.parentId===void 0?void 0:r.get(t.parentId);if(n){let e=o.get(n.id);e||(e={chapter:n,units:[]},o.set(n.id,e),a.push(e)),e.units.push(t)}else if(Oa(t,e)){if(!o.has(t.id)){let e={chapter:t,units:[]};o.set(t.id,e),a.push(e)}}else{let e=a.at(-1);e&&e.chapter===null?e.units.push(t):a.push({chapter:null,units:[t]})}}let s=new Map,c=e=>{let t={files:0,additions:0,deletions:0,binary:0,critical:e.critical};for(let n of e.files){let e=i.get(n);t.files+=1,t.additions+=e?.additions??0,t.deletions+=e?.deletions??0,e?.isBinary&&(t.binary+=1)}return t};for(let{chapter:e,units:t}of a){let n=e?c(e):{files:0,additions:0,deletions:0,binary:0,critical:!1};for(let e of t){let t=c(e);s.set(e.id,t),n.files+=t.files,n.additions+=t.additions,n.deletions+=t.deletions,n.binary+=t.binary,n.critical||=t.critical}e&&s.set(e.id,n)}let l=Da(n);for(let{chapter:e,units:t}of a){for(let e of t)Ta(s.get(e.id),l([e]));e&&Ta(s.get(e.id),l([e,...t]))}return{chapters:a,stats:s,byId:r,ordered:a.flatMap(({chapter:e,units:t})=>e?[e,...t]:t)}}function Ta(e,t){e?.critical&&t&&(e.criticalReason=t)}var Ea=[`blocker`,`should-fix`];function Da({findings:e,stops:t}){let n=new Map(e.map(e=>[e.id,e.severity])),r=new Set(t.filter(e=>e.importance===`critical`).map(e=>e.id));return e=>{let t=new Set(e.flatMap(e=>e.findingIds)),i=new Set(e.flatMap(e=>e.stopIds)),a=Ea.map(e=>({sev:e,n:[...t].filter(t=>n.get(t)===e).length})).filter(e=>e.n>0),o=[];if(a.length){let e=a.reduce((e,t)=>e+t.n,0);o.push(`${a.map(e=>`${e.n} ${e.sev}`).join(`, `)} ${e===1?`finding`:`findings`}`)}let s=[...i].filter(e=>r.has(e)).length;return s&&o.push(F(s,`critical walkthrough stop`)),o.length?o.join(`; `):void 0}}function Oa(e,t){return e.parentId===void 0?e.files.length===0||t.some(t=>t.parentId===e.id):!1}var ka=new Map;function Aa(){let e=history.state;if(e&&typeof e==`object`&&`__TSR_key`in e&&typeof e.__TSR_key==`string`)return e.__TSR_key}function ja(){let e=Aa();return e!==void 0&&ka.has(e)}function Ma(){(0,k.useEffect)(()=>{let e=()=>{let e=Aa();e&&ka.set(e,window.scrollY)},t=()=>{let e=Aa(),t=e?ka.get(e):void 0;if(t===void 0)return;let n=0,r=()=>{window.scrollTo({top:t,behavior:`instant`}),++n<4&&requestAnimationFrame(r)};requestAnimationFrame(r)};return window.addEventListener(`scroll`,e,{passive:!0}),window.addEventListener(`popstate`,t),()=>{window.removeEventListener(`scroll`,e),window.removeEventListener(`popstate`,t)}},[])}var Q={page:`_page_iew0b_1`,body:`_body_iew0b_5`,aside:`_aside_iew0b_10`,asideInner:`_asideInner_iew0b_16`,main:`_main_iew0b_24`,chapter:`_chapter_iew0b_34`,end:`_end_iew0b_40`,skeleton:`_skeleton_iew0b_49`,skeletonHeader:`_skeletonHeader_iew0b_55`,skeletonBody:`_skeletonBody_iew0b_60`,skeletonAside:`_skeletonAside_iew0b_65`,skeletonMain:`_skeletonMain_iew0b_70`,pulse:`_pulse_iew0b_1`},Na=g(`/runs/$runId`),Pa=[];function Fa(e,t){let{finding:n,stop:r,file:i,...a}=e;return{...a,...t}}function Ia(){let[e,t]=(0,k.useState)(null);return(0,k.useEffect)(()=>{let e=new i;return e.setup(document),t(e),()=>{e.cleanUp(),t(null)}},[]),e}function La(){let{runId:e}=Na.useParams(),{file:t,finding:n,stop:r}=Na.useSearch(),i=Na.useNavigate(),a=Na.useLoaderData(),o=A(),{data:s}=on(e),{data:l}=sn(e),u=l===void 0?a.files:Ie(e,l),d=Ia(),f=vn(_n),p=j(Ce),m=j(t=>we(t,e))??Pa,h=j(t=>Te(t,e))??Pa,g=(0,k.useMemo)(()=>new Set(m),[m]),_=(0,k.useMemo)(()=>new Set(h),[h]),v=j(ir),y=j(ar),b=mn(e),x=y?za:b,S=hn(e),C=j(er),w=j(tr),ee=j(nr),[te,T]=(0,k.useState)(null);(0,k.useEffect)(()=>{o(Gn(e))},[o,e]);let E=(0,k.useMemo)(()=>s?wa(s.groups,s.files,s):null,[s]),ne=(0,k.useMemo)(()=>{let e=new Map;for(let t of s?.files??[]){let n=e.get(t.groupId);n?n.push(t):e.set(t.groupId,[t])}return e},[s]),D=(0,k.useMemo)(()=>{let e=[...s?.findings??[],...s?.overCapFindings??[]];return{files:new Map((s?.files??[]).map(e=>[e.path,e])),findings:new Map(e.map(e=>[e.id,e])),overCap:new Set((s?.overCapFindings??[]).map(e=>e.id)),stops:new Map((s?.stops??[]).map(e=>[e.id,e]))}},[s]),O=(0,k.useMemo)(()=>s?zn(s,{showOverCap:v,hidden:x}):new Map,[s,v,x]),re=(0,k.useMemo)(()=>s&&E?ha(s,E,{showOverCap:v,hidden:x}):null,[s,E,v,x]),ie=(0,k.useMemo)(()=>re&&{...re,findings:re.findings.filter(e=>!b.has(e.id))},[re,b]),ae=rt(d!==null,E),oe=(0,k.useMemo)(()=>new Set(ae.groups),[ae.groups]),se=(0,k.useRef)({folded:_,showOverCap:v,showDismissed:y,dismissed:b,collapsedList:m});se.current={folded:_,showOverCap:v,showDismissed:y,dismissed:b,collapsedList:m};let ce=(0,k.useCallback)((t,n)=>{let r=D.files.get(t);if(!r)return;o(ge({runId:e,path:t}));let i=E?.byId.get(r.groupId)?.parentId;i&&se.current.folded.has(i)&&o(_e({runId:e,groupId:i})),n?ut(r.groupId,t,n):ct(r.groupId,t,{focus:!0})},[o,D,e,E]),M=(0,k.useMemo)(()=>{let t=(e,t)=>{t?.fromUrl||i({search:t=>Fa(t,e),replace:t?.scroll===!1,resetScroll:!1})};return{runId:e,stops:s?.stops??[],goToTop(){o(qn({id:null})),o(Jn({id:null})),i({search:e=>Fa(e,null)}).then(()=>document.getElementById(ra)?.focus({preventScroll:!0}))},goToFile(e){o(Kn(e)),ce(e,null)},goToFinding(e,n){let r=D.findings.get(e);r&&(D.overCap.has(e)&&!se.current.showOverCap&&o(Xn()),se.current.dismissed.has(e)&&!se.current.showDismissed&&o(Zn()),o(qn({id:e,file:r.anchor.file})),t({finding:e},n),n?.scroll!==!1&&ce(r.anchor.file,`finding-${e}`))},goToStop(e,n=0,r){let i=D.stops.get(e);if(!i)return;let a=i.locations[n];o(Jn({id:e,location:n,...a?{file:a.file}:{}})),t({stop:e},n>0?{...r,scroll:!1}:r),a&&r?.scroll!==!1&&ce(a.file,`stop-${e}-${n}`)},async copy(e){let t=await Ca(e);return t||T(e),t},setReviewed(t,n){let r=D.files.get(t);if(!r||s?.status===`running`)return;if(S({op:`reviewed`,paths:[t],value:n}),!n){o(ge({runId:e,path:t}));return}let i=se.current.collapsedList.filter(e=>e!==t);o(me({runId:e,paths:[...i,t]})),ct(r.groupId,t,{focus:!0})}}},[S,o,D,i,ce,s?.status,s?.stops,e]);(0,k.useEffect)(()=>{if(!t||!s||!d)return;let n=s.files.find(e=>e.path===t);n&&(o(ge({runId:e,path:n.path})),ct(n.groupId,n.path))},[t,s,d,o,e]);let le=s!==void 0&&d!==null;Ma();let ue=()=>({fromUrl:!0,scroll:!ja()});(0,k.useEffect)(()=>{le&&(n&&n!==C?M.goToFinding(n,ue()):!n&&C&&o(qn({id:null})))},[le,n]),(0,k.useEffect)(()=>{le&&(r&&r!==w?M.goToStop(r,0,ue()):!r&&w&&o(Jn({id:null})))},[le,r]),Sa(ie,M,e);let de=(0,k.useMemo)(()=>{if(C){let e=D.findings.get(C);return e?{path:e.anchor.file,range:Bn(e.anchor)}:null}let e=w?D.stops.get(w)?.locations[ee]:void 0;return e?{path:e.file,range:Bn(e)}:null},[C,w,D,ee]),fe=de?D.files.get(de.path)?.groupId:void 0,pe=e=>fe===e?de:null,he=(0,k.useMemo)(()=>{let t=s?.files.map(e=>e.path)??[],n=t=>()=>o(me({runId:e,paths:t}));return[{label:`Expand all files`,run:n([])},{label:`Collapse all files`,run:n(t)},{label:`Collapse skipped files`,run:n(s?.files.filter(e=>e.classification===`skip`).map(e=>e.path)??[])}]},[o,s,e]),ve=(0,k.useCallback)(t=>o(_e({runId:e,groupId:t})),[o,e]);if(!s||!E)return(0,N.jsx)(Va,{});let ye=f&&p;return(0,N.jsx)(yn.Provider,{value:M,children:(0,N.jsxs)(`div`,{className:Q.page,children:[(0,N.jsx)(Ai,{run:s,tree:E,visible:oe,collapseActions:he}),(0,N.jsxs)(`div`,{className:Q.body,children:[ye&&(0,N.jsx)(`aside`,{className:Q.aside,children:(0,N.jsx)(`div`,{className:Q.asideInner,children:(0,N.jsx)(Hi,{run:s,tree:E,visible:oe,folded:_,onToggleFold:ve,findings:re?.findings??Ba,overCap:D.overCap,dismissed:b})})}),(0,N.jsxs)(`main`,{className:Q.main,children:[(0,N.jsx)(pa,{run:s}),d&&(0,N.jsx)(c.Provider,{value:d,children:E.chapters.map(({chapter:t,units:n},r)=>{let i=t!==null&&_.has(t.id),a=t?ne.get(t.id)??[]:[];return(0,N.jsxs)(`div`,{className:Q.chapter,children:[t&&(a.length>0?(0,N.jsx)(Xr,{runId:e,group:t,parent:void 0,stats:E.stats.get(t.id),files:a,diffs:u,collapsed:g,activePath:ae.files[t.id],annotations:O,selection:pe(t.id)}):(0,N.jsx)(Yr,{chapter:t,stats:E.stats.get(t.id),unitCount:n.length,folded:i,onToggleFold:()=>ve(t.id)})),!i&&n.map(n=>(0,N.jsx)(Xr,{runId:e,group:n,parent:t??void 0,stats:E.stats.get(n.id),files:ne.get(n.id)??Ra,diffs:u,collapsed:g,activePath:ae.files[n.id],annotations:O,selection:pe(n.id)},n.id))]},t?.id??`loose-${r}`)})}),(0,N.jsx)(`p`,{className:Q.end,children:`End of diff`})]})]}),(0,N.jsx)(Mi,{}),te!==null&&(0,N.jsx)(Le,{text:te,onClose:()=>T(null)})]})})}var Ra=[],za=new Set,Ba=[];function Va(){return(0,N.jsxs)(`div`,{className:Q.skeleton,"aria-busy":`true`,children:[(0,N.jsx)(`div`,{className:Q.skeletonHeader}),(0,N.jsxs)(`div`,{className:Q.skeletonBody,children:[(0,N.jsx)(`div`,{className:Q.skeletonAside}),(0,N.jsxs)(`div`,{className:Q.skeletonMain,children:[(0,N.jsx)(`div`,{}),(0,N.jsx)(`div`,{}),(0,N.jsx)(`div`,{})]})]})]})}var Ha=O({"file?":`string`,"finding?":`string`,"stop?":`string`}),Ua=e=>typeof e==`object`&&!!e&&`status`in e&&e.status===404,Wa=d({getParentRoute:()=>Ne,path:`/runs/$runId`,validateSearch:Ha,loader:async({context:{store:e},params:{runId:t}})=>{let n=e.dispatch(L.endpoints.getRun.initiate(t)),r=e.dispatch(L.endpoints.getRunPatch.initiate(t));try{let[i,a]=await Promise.all([n.unwrap(),r.unwrap()]);if(we(e.getState(),t)===void 0){let n=i.files.filter(e=>e.classification===`skip`).map(e=>e.path);e.dispatch(me({runId:t,paths:n}))}return{files:Ie(t,a)}}catch(e){throw Ua(e)?b():e}finally{n.unsubscribe(),r.unsubscribe()}},pendingComponent:Va,errorComponent:je,component:La}),Ga=(0,k.forwardRef)(({title:e,titleId:t,...n},r)=>(0,N.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,N.jsx)(`title`,{id:t,children:e}):null,(0,N.jsx)(`path`,{fill:`currentColor`,d:`M216 48h-40v-8a24 24 0 0 0-24-24h-48a24 24 0 0 0-24 24v8H40a8 8 0 0 0 0 16h8v144a16 16 0 0 0 16 16h128a16 16 0 0 0 16-16V64h8a8 8 0 0 0 0-16M96 40a8 8 0 0 1 8-8h48a8 8 0 0 1 8 8v8H96Zm96 168H64V64h128Zm-80-104v64a8 8 0 0 1-16 0v-64a8 8 0 0 1 16 0m48 0v64a8 8 0 0 1-16 0v-64a8 8 0 0 1 16 0`})]})),$={page:`_page_oa1c1_1`,header:`_header_oa1c1_10`,muted:`_muted_oa1c1_21`,error:`_error_oa1c1_27`,table:`_table_oa1c1_31`,row:`_row_oa1c1_52`,target:`_target_oa1c1_56`,link:`_link_oa1c1_62`,repo:`_repo_oa1c1_72`,invalid:`_invalid_oa1c1_78`,count:`_count_oa1c1_86`,kind:`_kind_oa1c1_111`,filters:`_filters_oa1c1_123`,filter:`_filter_oa1c1_123`,delete:`_delete_oa1c1_146`},Ka=[{key:`blocker`,label:`Blockers`},{key:`should-fix`,label:`Should fix`},{key:`nice-to-have`,label:`Nice to have`},{key:`question`,label:`Questions`}],qa=[{key:`all`,label:`All`},{key:`review`,label:`Reviews`},{key:`diff`,label:`Diffs`}];function Ja({run:e}){let[t,{isLoading:n}]=dn(),r=Ve(e.target),i=e.kind??`review`;return(0,N.jsxs)(`tr`,{className:$.row,children:[(0,N.jsx)(`td`,{children:(0,N.jsx)(xi,{status:e.status})}),(0,N.jsx)(`td`,{children:(0,N.jsx)(`span`,{className:$.kind,"data-kind":i,children:i===`diff`?`Diff`:`Review`})}),(0,N.jsx)(`td`,{children:(0,N.jsxs)(`div`,{className:$.target,children:[e.invalid?(0,N.jsxs)(`span`,{title:e.invalid,children:[r,` `,(0,N.jsx)(`span`,{className:$.invalid,children:`invalid`})]}):(0,N.jsx)(v,{to:`/runs/$runId`,params:{runId:e.id},className:$.link,children:r}),(0,N.jsx)(`span`,{className:$.repo,children:e.repo.slug??e.repo.root})]})}),(0,N.jsx)(`td`,{title:Ge(e.createdAt),className:$.muted,children:Ke(e.createdAt)}),Ka.map(({key:t})=>i===`diff`?(0,N.jsx)(`td`,{className:$.count,"data-zero":!0},t):(0,N.jsx)(`td`,{className:$.count,"data-severity":t,"data-zero":e.findingCounts[t]===0,children:e.findingCounts[t]},t)),(0,N.jsx)(`td`,{className:$.count,children:i===`diff`&&e.costUsd===0?``:He(e.costUsd)}),(0,N.jsx)(`td`,{children:e.status!==`running`&&(0,N.jsx)(`button`,{type:`button`,className:$.delete,onClick:()=>{window.confirm(`Delete run ${e.id}?`)&&t(e.id)},disabled:n,title:`Delete run`,children:(0,N.jsx)(Ga,{"aria-label":`Delete run`})})})]})}function Ya(){let{data:e,error:t,isFetching:n}=an(),[r,i]=(0,k.useState)(`all`),a=r===`all`?e:e?.filter(e=>(e.kind??`review`)===r),o=e?.some(e=>e.kind===`diff`)??!1;return(0,N.jsxs)(`main`,{className:$.page,children:[(0,N.jsxs)(`header`,{className:$.header,children:[(0,N.jsx)(`h1`,{children:`DiffLoupe`}),(0,N.jsx)(`span`,{className:$.muted,children:n?`Refreshing…`:a?`${a.length} runs`:``}),o&&(0,N.jsx)(`div`,{className:$.filters,role:`group`,"aria-label":`Show`,children:qa.map(({key:e,label:t})=>(0,N.jsx)(`button`,{type:`button`,className:$.filter,"aria-pressed":r===e,onClick:()=>i(e),children:t},e))})]}),t?(0,N.jsx)(`p`,{className:$.error,children:Me(t)}):e&&e.length===0?(0,N.jsxs)(`p`,{className:$.muted,children:[`No runs yet. Start one with `,(0,N.jsx)(`code`,{children:`diffloupe diff`}),` or `,(0,N.jsx)(`code`,{children:`diffloupe review`}),`.`]}):(0,N.jsxs)(`table`,{className:$.table,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{children:[(0,N.jsx)(`th`,{children:`Status`}),(0,N.jsx)(`th`,{children:`Kind`}),(0,N.jsx)(`th`,{children:`Target`}),(0,N.jsx)(`th`,{children:`Created`}),Ka.map(({key:e,label:t})=>(0,N.jsx)(`th`,{className:$.count,"data-severity":e,children:t},e)),(0,N.jsx)(`th`,{className:$.count,children:`Cost`}),(0,N.jsx)(`th`,{"aria-label":`Actions`})]})}),(0,N.jsx)(`tbody`,{children:a?.map(e=>(0,N.jsx)(Ja,{run:e},e.id))})]})]})}var Xa=d({getParentRoute:()=>Ne,path:`/`,loader:async({context:{store:e}})=>{let t=e.dispatch(L.endpoints.listRuns.initiate());try{await t.unwrap()}finally{t.unsubscribe()}},component:Ya}),Za=Ne.addChildren([Xa,Wa]);function Qa(e){return h({routeTree:Za,context:{store:e},defaultPreload:`intent`,defaultPreloadStaleTime:0,scrollRestoration:!0})}var $a=C();function eo(){return T({reducer:{[L.reducerPath]:L.reducer,[M.reducerPath]:M.reducer,[Wn.reducerPath]:Wn.reducer},middleware:e=>e().prepend($a.middleware).concat(L.middleware)})}$a.startListening.withTypes()({matcher:te(le,ue,de,fe,pe),effect:(e,{getState:t})=>{localStorage.setItem(ae,JSON.stringify(ve(t())))}});var to=document.getElementById(`root`);if(!to)throw Error(`Root element not found`);var no=eo(),ro=Qa(no),io={workerFactory:()=>new u,poolSize:Math.min(4,Math.max(1,navigator.hardwareConcurrency-1))};(0,re.createRoot)(to).render((0,N.jsx)(k.StrictMode,{children:(0,N.jsx)(l,{poolOptions:io,highlighterOptions:{},children:(0,N.jsx)(E,{store:no,children:(0,N.jsx)(y,{router:ro})})})}));