@pat-lewczuk/cezar 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +124 -37
- package/dist/config.d.ts +46 -0
- package/dist/config.js +31 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-runner.d.ts +16 -0
- package/dist/core/agent-runner.js +9 -0
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/claude-cli-runner.d.ts +6 -0
- package/dist/core/claude-cli-runner.js +27 -43
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/codex-app-server-runner.js +42 -5
- package/dist/core/codex-app-server-runner.js.map +1 -1
- package/dist/core/opencode-server-runner.js +42 -5
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/git-worktree.d.ts +21 -0
- package/dist/git-worktree.js +48 -4
- package/dist/git-worktree.js.map +1 -1
- package/dist/handoff.d.ts +1 -1
- package/dist/handoff.js +2 -0
- package/dist/handoff.js.map +1 -1
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/dist/runs/store.d.ts +82 -1
- package/dist/runs/store.js +57 -5
- package/dist/runs/store.js.map +1 -1
- package/dist/server/git.js +12 -1
- package/dist/server/git.js.map +1 -1
- package/dist/server/github.d.ts +8 -29
- package/dist/server/github.js +7 -139
- package/dist/server/github.js.map +1 -1
- package/dist/server/pr.d.ts +5 -20
- package/dist/server/pr.js +4 -95
- package/dist/server/pr.js.map +1 -1
- package/dist/server/server.d.ts +30 -1
- package/dist/server/server.js +448 -19
- package/dist/server/server.js.map +1 -1
- package/dist/workflows/run.d.ts +90 -0
- package/dist/workflows/run.js +412 -29
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/types.d.ts +16 -16
- package/package.json +44 -6
- package/scripts/check-pack.mjs +46 -0
- package/scripts/dev.mjs +74 -0
- package/scripts/mock-claude.mjs +54 -2
- package/scripts/test-process-usage.mjs +47 -0
- package/web/dist/assets/{toaster-BS2E1bhz.js → centered-state-zgEVNWsj.js} +1 -1
- package/web/dist/assets/compare-variants-ChHCcSQX.js +1 -0
- package/web/dist/assets/dialog-DDRjj-uK.js +1 -0
- package/web/dist/assets/{diff-view-CctnJHWe.js → diff-view-CWRO0GMe.js} +1 -1
- package/web/dist/assets/dist-id2CeyV-.js +1 -0
- package/web/dist/assets/git-toolbar-C4jo602L.js +1 -0
- package/web/dist/assets/github-BOIzQFwE.js +1 -0
- package/web/dist/assets/index-Cv1pQs9U.js +11 -0
- package/web/dist/assets/repo-git-BuyJiqna.js +1 -0
- package/web/dist/assets/{run-diff-C7mfxj7f.js → run-diff-BocG6LVd.js} +1 -1
- package/web/dist/assets/run-header-CDKw22ek.js +1 -0
- package/web/dist/assets/skill-detail-CcFFKmGO.js +1 -0
- package/web/dist/assets/skills-Bc_4U3yq.js +1 -0
- package/web/dist/assets/tab-link-C77EP3i6.js +1 -0
- package/web/dist/assets/task-changes-DsDgN8-x.js +1 -0
- package/web/dist/assets/task-commits-Dve6Fozc.js +1 -0
- package/web/dist/assets/{task-files-FOAAz2FB.js → task-files-BDMc_z0B.js} +1 -1
- package/web/dist/assets/{task-thread-Bncxe8Os.js → task-thread-CmRuPj9H.js} +2 -2
- package/web/dist/assets/use-desktop-CyEWsxSU.js +3 -0
- package/web/dist/assets/{workflows-Dg2wQg6i.js → workflows-J3z3kYic.js} +1 -1
- package/web/dist/index.html +5 -5
- package/web/app/node_modules/.vite/vitest/ca84d1343b96baa8137c943ed1860e522cacb238/results.json +0 -1
- package/web/app/src/components/app-shell-container.tsx +0 -76
- package/web/app.js +0 -3428
- package/web/dist/assets/compare-variants-D6fPL9cS.js +0 -1
- package/web/dist/assets/dialog-BEgEWFDS.js +0 -1
- package/web/dist/assets/dist-CW7M_Jhs.js +0 -1
- package/web/dist/assets/git-toolbar-D8OPPqBP.js +0 -1
- package/web/dist/assets/github-BYIHwIJB.js +0 -1
- package/web/dist/assets/index-9qG98Orw.js +0 -11
- package/web/dist/assets/repo-git-XTqlVOl2.js +0 -1
- package/web/dist/assets/run-header-CfVeY3uM.js +0 -1
- package/web/dist/assets/skill-detail-C9cniyId.js +0 -1
- package/web/dist/assets/skills-DXgY1uXJ.js +0 -1
- package/web/dist/assets/tab-link-phWEqSBy.js +0 -1
- package/web/dist/assets/task-changes-DYwnPnTN.js +0 -1
- package/web/dist/assets/task-commits-DZzxEzbn.js +0 -1
- package/web/dist/assets/use-desktop-eHm2iTXX.js +0 -3
- package/web/index.html +0 -108
- package/web/style.css +0 -1767
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Unit check for the pure half of src/core/process-usage.ts (#348): ps-output
|
|
3
|
+
// parsing + process-tree aggregation against canned `ps -axo pid=,ppid=,rss=,%cpu=`
|
|
4
|
+
// output. Dependency-free; needs `npm run build` first (imports from dist/).
|
|
5
|
+
// node scripts/test-process-usage.mjs
|
|
6
|
+
|
|
7
|
+
import assert from 'node:assert/strict';
|
|
8
|
+
import { aggregateTreeUsage, parsePsOutput } from '../dist/core/process-usage.js';
|
|
9
|
+
|
|
10
|
+
// Canned snapshot: two registered roots (100, 200) plus unrelated noise.
|
|
11
|
+
// Root 100 owns a 3-level tree: 100 → 110 → 111, and 100 → 120.
|
|
12
|
+
const PS_OUTPUT = `
|
|
13
|
+
1 0 1200 0.1
|
|
14
|
+
100 1 50000 10.0
|
|
15
|
+
110 100 20000 5.5
|
|
16
|
+
111 110 8000 0.0
|
|
17
|
+
120 100 4000 2.5
|
|
18
|
+
200 1 30000 50.0
|
|
19
|
+
210 200 10000 25.0
|
|
20
|
+
999 1 70000 99.0
|
|
21
|
+
garbage line that ps should never emit
|
|
22
|
+
300 1
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
const procs = parsePsOutput(PS_OUTPUT);
|
|
26
|
+
assert.equal(procs.length, 8, 'parses 8 well-formed rows, skips malformed ones');
|
|
27
|
+
assert.deepEqual(procs[1], { pid: 100, ppid: 1, rssKb: 50000, cpuPct: 10 });
|
|
28
|
+
|
|
29
|
+
// Root 100: 4 processes across 3 levels; rss in KB × 1024 → bytes.
|
|
30
|
+
const a = aggregateTreeUsage(procs, 100);
|
|
31
|
+
assert.deepEqual(a, {
|
|
32
|
+
cpuPct: 18,
|
|
33
|
+
rssBytes: (50000 + 20000 + 8000 + 4000) * 1024,
|
|
34
|
+
procCount: 4,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Root 200: 2 processes; the other tree's processes never leak in.
|
|
38
|
+
const b = aggregateTreeUsage(procs, 200);
|
|
39
|
+
assert.deepEqual(b, { cpuPct: 75, rssBytes: (30000 + 10000) * 1024, procCount: 2 });
|
|
40
|
+
|
|
41
|
+
// A root missing from the snapshot (process exited) → null, not zeros.
|
|
42
|
+
assert.equal(aggregateTreeUsage(procs, 12345), null);
|
|
43
|
+
|
|
44
|
+
// A leaf works as a root of its own single-node tree.
|
|
45
|
+
assert.deepEqual(aggregateTreeUsage(procs, 111), { cpuPct: 0, rssBytes: 8000 * 1024, procCount: 1 });
|
|
46
|
+
|
|
47
|
+
console.log('process-usage: all assertions passed');
|
|
@@ -40,4 +40,4 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
|
|
|
40
40
|
`},Es=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Ds=function(){O.useEffect(function(){return document.body.setAttribute(ws,(Es()+1).toString()),function(){var e=Es()-1;e<=0?document.body.removeAttribute(ws):document.body.setAttribute(ws,e.toString())}},[])},Os=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Ds();var a=O.useMemo(function(){return Ss(i)},[i]);return O.createElement(Cs,{styles:Ts(a,!t,i,n?``:`!important`)})},ks=!1;if(typeof window<`u`)try{var As=Object.defineProperty({},"passive",{get:function(){return ks=!0,!0}});window.addEventListener(`test`,As,As),window.removeEventListener(`test`,As,As)}catch{ks=!1}var Z=ks?{passive:!1}:!1,js=function(e){return e.tagName===`TEXTAREA`},Ms=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!js(e)&&n[t]===`visible`)},Ns=function(e){return Ms(e,`overflowY`)},Ps=function(e){return Ms(e,`overflowX`)},Fs=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Rs(e,r)){var i=zs(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Is=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Ls=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Rs=function(e,t){return e===`v`?Ns(t):Ps(t)},zs=function(e,t){return e===`v`?Is(t):Ls(t)},Bs=function(e,t){return e===`h`&&t===`rtl`?-1:1},Vs=function(e,t,n,r,i){var a=Bs(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=zs(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Rs(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Hs=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Us=function(e){return[e.deltaX,e.deltaY]},Ws=function(e){return e&&`current`in e?e.current:e},Gs=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Ks=function(e){return`
|
|
41
41
|
.block-interactivity-${e} {pointer-events: none;}
|
|
42
42
|
.allow-interactivity-${e} {pointer-events: all;}
|
|
43
|
-
`},qs=0,Q=[];function Js(e){var t=O.useRef([]),n=O.useRef([0,0]),r=O.useRef(),i=O.useState(qs++)[0],a=O.useState(vs)[0],o=O.useRef(e);O.useEffect(function(){o.current=e},[e]),O.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=qo([e.lockRef.current],(e.shards||[]).map(Ws),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=O.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Hs(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Fs(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Fs(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Vs(h,t,e,h===`h`?s:c,!0)},[]),c=O.useCallback(function(e){var n=e;if(!(!Q.length||Q[Q.length-1]!==a)){var r=`deltaY`in n?Us(n):Hs(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Gs(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Ws).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=O.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Ys(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=O.useCallback(function(e){n.current=Hs(e),r.current=void 0},[]),d=O.useCallback(function(t){l(t.type,Us(t),t.target,s(t,e.lockRef.current))},[]),f=O.useCallback(function(t){l(t.type,Hs(t),t.target,s(t,e.lockRef.current))},[]);O.useEffect(function(){return Q.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Z),document.addEventListener(`touchmove`,c,Z),document.addEventListener(`touchstart`,u,Z),function(){Q=Q.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Z),document.removeEventListener(`touchmove`,c,Z),document.removeEventListener(`touchstart`,u,Z)}},[]);var p=e.removeScrollBar,m=e.inert;return O.createElement(O.Fragment,null,m?O.createElement(a,{styles:Ks(i)}):null,p?O.createElement(Os,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ys(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Xs=ss(cs,Js),Zs=O.forwardRef(function(e,t){return O.createElement(us,X({},e,{ref:t,sideCar:Xs}))});Zs.classNames=us.classNames;var Qs=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},$=new WeakMap,$s=new WeakMap,ec={},tc=0,nc=function(e){return e&&(e.host||nc(e.parentNode))},rc=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=nc(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},ic=function(e,t,n,r){var i=rc(t,Array.isArray(e)?e:[e]);ec[n]||(ec[n]=new WeakMap);var a=ec[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=($.get(e)||0)+1,l=(a.get(e)||0)+1;$.set(e,c),a.set(e,l),o.push(e),c===1&&i&&$s.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),tc++,function(){o.forEach(function(e){var t=$.get(e)-1,i=a.get(e)-1;$.set(e,t),a.set(e,i),t||($s.has(e)||e.removeAttribute(r),$s.delete(e)),i||e.removeAttribute(n)}),tc--,tc||($=new WeakMap,$=new WeakMap,$s=new WeakMap,ec={})}},ac=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Qs(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),ic(r,i,n,`aria-hidden`)):function(){return null}},oc=Da(`inline-flex shrink-0 items-center justify-center gap-[7px] rounded-md font-semibold whitespace-nowrap transition-[background-color,border-color,opacity,filter] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{primary:`bg-primary text-primary-foreground hover:brightness-[0.96]`,contrast:`bg-contrast text-contrast-foreground hover:brightness-[0.96]`,outline:`border border-border bg-card hover:bg-muted`,ghost:`text-muted-foreground hover:bg-muted hover:text-foreground`,"danger-ghost":`text-danger hover:bg-danger/10`},size:{default:`h-9 px-3.5 text-[13.5px]`,sm:`h-[30px] rounded-sm px-2.5 text-[12.5px]`,icon:`size-9`,"icon-sm":`size-[30px] rounded-sm`}},defaultVariants:{variant:`primary`,size:`default`}});function sc({className:e,variant:t=`primary`,size:n=`default`,asChild:r=!1,...i}){return(0,k.jsx)(r?Ma:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:o(oc({variant:t,size:n,className:e})),...i})}var cc={primary:`border-primary/25 bg-primary/15 text-primary`,neutral:`border-border bg-card text-foreground shadow-xs`,danger:`border-danger/20 bg-danger/15 text-danger`};function
|
|
43
|
+
`},qs=0,Q=[];function Js(e){var t=O.useRef([]),n=O.useRef([0,0]),r=O.useRef(),i=O.useState(qs++)[0],a=O.useState(vs)[0],o=O.useRef(e);O.useEffect(function(){o.current=e},[e]),O.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=qo([e.lockRef.current],(e.shards||[]).map(Ws),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=O.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Hs(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Fs(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Fs(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Vs(h,t,e,h===`h`?s:c,!0)},[]),c=O.useCallback(function(e){var n=e;if(!(!Q.length||Q[Q.length-1]!==a)){var r=`deltaY`in n?Us(n):Hs(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Gs(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Ws).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=O.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Ys(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=O.useCallback(function(e){n.current=Hs(e),r.current=void 0},[]),d=O.useCallback(function(t){l(t.type,Us(t),t.target,s(t,e.lockRef.current))},[]),f=O.useCallback(function(t){l(t.type,Hs(t),t.target,s(t,e.lockRef.current))},[]);O.useEffect(function(){return Q.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Z),document.addEventListener(`touchmove`,c,Z),document.addEventListener(`touchstart`,u,Z),function(){Q=Q.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Z),document.removeEventListener(`touchmove`,c,Z),document.removeEventListener(`touchstart`,u,Z)}},[]);var p=e.removeScrollBar,m=e.inert;return O.createElement(O.Fragment,null,m?O.createElement(a,{styles:Ks(i)}):null,p?O.createElement(Os,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ys(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Xs=ss(cs,Js),Zs=O.forwardRef(function(e,t){return O.createElement(us,X({},e,{ref:t,sideCar:Xs}))});Zs.classNames=us.classNames;var Qs=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},$=new WeakMap,$s=new WeakMap,ec={},tc=0,nc=function(e){return e&&(e.host||nc(e.parentNode))},rc=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=nc(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},ic=function(e,t,n,r){var i=rc(t,Array.isArray(e)?e:[e]);ec[n]||(ec[n]=new WeakMap);var a=ec[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=($.get(e)||0)+1,l=(a.get(e)||0)+1;$.set(e,c),a.set(e,l),o.push(e),c===1&&i&&$s.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),tc++,function(){o.forEach(function(e){var t=$.get(e)-1,i=a.get(e)-1;$.set(e,t),a.set(e,i),t||($s.has(e)||e.removeAttribute(r),$s.delete(e)),i||e.removeAttribute(n)}),tc--,tc||($=new WeakMap,$=new WeakMap,$s=new WeakMap,ec={})}},ac=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Qs(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),ic(r,i,n,`aria-hidden`)):function(){return null}},oc=Da(`inline-flex shrink-0 items-center justify-center gap-[7px] rounded-md font-semibold whitespace-nowrap transition-[background-color,border-color,opacity,filter] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{primary:`bg-primary text-primary-foreground hover:brightness-[0.96]`,contrast:`bg-contrast text-contrast-foreground hover:brightness-[0.96]`,outline:`border border-border bg-card hover:bg-muted`,ghost:`text-muted-foreground hover:bg-muted hover:text-foreground`,"danger-ghost":`text-danger hover:bg-danger/10`},size:{default:`h-9 px-3.5 text-[13.5px]`,sm:`h-[30px] rounded-sm px-2.5 text-[12.5px]`,icon:`size-9`,"icon-sm":`size-[30px] rounded-sm`}},defaultVariants:{variant:`primary`,size:`default`}});function sc({className:e,variant:t=`primary`,size:n=`default`,asChild:r=!1,...i}){return(0,k.jsx)(r?Ma:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:o(oc({variant:t,size:n,className:e})),...i})}var cc=5e3,lc=[],uc=1,dc=new Set;function fc(e){lc=e;for(let e of dc)e()}function pc(e){return dc.add(e),()=>dc.delete(e)}function mc(e,t={}){let n={id:uc++,message:e,tone:t.tone??`default`};fc([...lc,n]),setTimeout(()=>fc(lc.filter(e=>e.id!==n.id)),cc)}function hc(){let e=(0,O.useSyncExternalStore)(pc,()=>lc);return e.length===0?null:(0,k.jsx)(`div`,{"data-slot":`toaster`,className:`pointer-events-none fixed inset-x-0 bottom-[calc(16px+env(safe-area-inset-bottom))] z-50 flex flex-col items-center gap-2 px-4`,children:e.map(e=>(0,k.jsx)(`div`,{role:`status`,"data-slot":`toast`,"data-tone":e.tone,className:o(`pointer-events-auto max-w-full rounded-md px-3.5 py-2.5 text-[13px] font-medium shadow-modal`,e.tone===`danger`?`bg-danger text-danger-foreground`:`bg-contrast text-contrast-foreground`),children:e.message},e.id))})}var gc={primary:`border-primary/25 bg-primary/15 text-primary`,neutral:`border-border bg-card text-foreground shadow-xs`,danger:`border-danger/20 bg-danger/15 text-danger`};function _c({icon:e,tone:t=`neutral`,title:n,subtitle:r,children:i,actions:a,backdrop:s=!1,heading:c=`h1`,className:l}){return(0,k.jsxs)(`div`,{"data-slot":`centered-state`,"data-tone":t,className:o(`relative isolate flex min-h-full flex-1 flex-col items-center justify-center px-6 py-12 text-center`,l),children:[s?(0,k.jsx)(bc,{}):null,(0,k.jsxs)(`div`,{className:`flex w-full max-w-md flex-col items-center gap-4`,children:[(0,k.jsx)(`div`,{"data-slot":`centered-state-tile`,className:o(`flex size-[72px] items-center justify-center rounded-[18px] border [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-7`,gc[t]),children:e}),(0,k.jsx)(c,{className:`text-2xl font-semibold text-balance text-foreground`,children:n}),r?(0,k.jsx)(`p`,{className:`text-sm text-pretty text-muted-foreground`,children:r}):null,i?(0,k.jsx)(`div`,{className:`w-full pt-2`,children:i}):null,a?(0,k.jsx)(`div`,{className:`flex items-center justify-center gap-3 pt-2`,children:a}):null]})]})}var vc=[{top:`6%`,left:`14%`,size:2,tone:`violet`,opacity:.5},{top:`11%`,left:`31%`,size:3,tone:`violet`,opacity:.45},{top:`8%`,left:`52%`,size:2,tone:`pending`,opacity:.4},{top:`15%`,left:`71%`,size:2,tone:`violet`,opacity:.5},{top:`9%`,left:`86%`,size:3,tone:`primary`,opacity:.4},{top:`22%`,left:`8%`,size:2,tone:`pending`,opacity:.4},{top:`27%`,left:`24%`,size:2,tone:`primary`,opacity:.35},{top:`20%`,left:`44%`,size:3,tone:`violet`,opacity:.35},{top:`25%`,left:`62%`,size:2,tone:`violet`,opacity:.4},{top:`30%`,left:`79%`,size:2,tone:`primary`,opacity:.35},{top:`36%`,left:`12%`,size:3,tone:`violet`,opacity:.3},{top:`42%`,left:`35%`,size:2,tone:`pending`,opacity:.28},{top:`47%`,left:`58%`,size:2,tone:`primary`,opacity:.28},{top:`52%`,left:`88%`,size:2,tone:`violet`,opacity:.25},{top:`60%`,left:`29%`,size:3,tone:`violet`,opacity:.22}],yc={violet:`bg-violet`,primary:`bg-primary`,pending:`bg-pending`};function bc({className:e}){return(0,k.jsx)(`div`,{"data-slot":`twinkle-backdrop`,"aria-hidden":`true`,className:o(`pointer-events-none absolute inset-0 -z-10 overflow-hidden [mask-image:linear-gradient(to_bottom,black_25%,transparent_88%)]`,e),children:vc.map((e,t)=>(0,k.jsx)(`span`,{className:o(`absolute rounded-[1px] motion-safe:animate-pulse`,e.size===3?`size-[3px]`:`size-0.5`,yc[e.tone]),style:{top:e.top,left:e.left,opacity:e.opacity,animationDuration:`3.5s`,animationDelay:`${t%5*700}ms`}},t))})}export{Mi as $,c as $t,ca as A,Un as At,ua as B,Fe as Bt,ja as C,zi as Ct,K as D,Ir as Dt,Da as E,Pr as Et,ga as F,vn as Ft,ra as G,S as Gt,aa as H,he as Ht,_a as I,Wr as It,fa as J,y as Jt,Sa as K,x as Kt,va as L,et as Lt,ha as M,H as Mt,na as N,pn as Nt,ya as O,Lr as Ot,xa as P,gn as Pt,Ni as Q,se as Qt,ia as R,Be as Rt,Ga as S,hi as St,Aa as T,Bi as Tt,sa as U,D as Ut,la as V,we as Vt,da as W,m as Wt,pa as X,C as Xt,ba as Y,p as Yt,ti as Z,_ as Zt,Xa as _,Vi as _t,sc as a,Ii as at,Ka as b,ea as bt,Zs as c,Qi as ct,ko as d,li as dt,s as en,ji as et,go as f,Di as ft,eo as g,Li as gt,co as h,Zi as ht,mc as i,Ai as it,ta as j,Gn as jt,Ca as k,Hn as kt,Wo as l,Pi as lt,J as m,Hi as mt,bc as n,Fi as nt,oc as o,Xi as ot,yo as p,Wi as pt,ma as q,b as qt,hc as r,Ji as rt,ac as s,Ri as st,_c as t,Gi as tt,Vo as u,Ci as ut,q as v,Yi as vt,ka as w,Oi as wt,Wa as x,$i as xt,Ja as y,Ki as yt,oa as z,ze as zt};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,o as n}from"./bundle-mjs-DLPpRFyl.js";import{A as r,D as i,Dt as a,Ft as o,G as s,Lt as c,Pt as l,Z as u,_t as d,a as f,i as p,t as m,zt as h}from"./centered-state-zgEVNWsj.js";import{t as g}from"./utils-rQGbOrwc.js";import{n as _}from"./loader-circle-BV3DO9mE.js";import{t as v}from"./search-x-CoCyl7zT.js";import{i as y,n as b,r as x,t as S}from"./run-diff-BocG6LVd.js";import{t as C}from"./markdown-CR_HLGTs.js";import{B as w,F as T,O as E,Q as D,R as O,_ as k,b as A,g as j,h as M,i as N,m as P,n as F,ot as I,t as L,v as R,x as z,y as B}from"./index-Cv1pQs9U.js";var V=t(n(),1),H=e();function U(){let{groupId:e}=o(),t=r(e),n=h();if((0,V.useEffect)(()=>{e&&n.invalidateQueries({queryKey:i.groups.detail(e)})},[n,e,(s().data??[]).filter(t=>t.groupId===e).map(e=>`${e.id}:${e.status}:${e.archived}`).sort().join(`,`)]),t.isPending)return(0,H.jsx)(E,{});if(t.isError){let e=t.error instanceof u&&t.error.status===404;return(0,H.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,H.jsx)(m,{icon:e?(0,H.jsx)(v,{}):(0,H.jsx)(D,{}),tone:e?`neutral`:`danger`,title:e?`No such variant group`:`Could not load the variants`,subtitle:e?`No runs share this group id. The group may have been deleted, or a winner was already picked and the others removed.`:t.error.message,actions:(0,H.jsx)(f,{asChild:!0,variant:`outline`,children:(0,H.jsx)(a,{to:`/`,children:`Back to tasks`})})})})}return(0,H.jsx)(W,{groupId:e,variants:t.data.runs})}function W({groupId:e,variants:t}){let n=l(),r=h(),[a,o]=(0,V.useState)(null),s=t.every(e=>L.has(e.status)),u=t[0]?T(t[0]):``,f=c({mutationFn:t=>d(e,t),onSuccess:(t,a)=>{r.invalidateQueries({queryKey:i.runs.all}),r.invalidateQueries({queryKey:i.groups.detail(e)}),n(`/tasks/${t.winner?.id??a}`)},onError:e=>p(e.message,{tone:`danger`})});return(0,H.jsxs)(`div`,{"data-route":`compare`,className:`mx-auto flex w-full max-w-6xl flex-col gap-4 px-4 py-5 md:px-6`,children:[(0,H.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,H.jsxs)(`h1`,{className:`flex items-center gap-2 text-xl font-semibold`,children:[(0,H.jsx)(D,{className:`size-5 shrink-0 text-violet`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate`,title:u,children:u})]}),(0,H.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[t.length,` variants of the same task, each in its own worktree — pick the diff you want to keep. The others are cancelled and archived, their worktrees and branches removed.`]})]}),(0,H.jsx)(`div`,{"data-slot":`compare-columns`,className:g(`grid grid-cols-1 gap-3`,t.length>=3?`md:grid-cols-3`:`md:grid-cols-2`),children:t.map(e=>(0,H.jsx)(G,{variant:e,allTerminal:s,pickPending:f.isPending,onPick:()=>o(e)},e.id))}),(0,H.jsx)(`section`,{"aria-label":`Full diffs`,className:`flex flex-col gap-2`,children:t.map(e=>(0,H.jsx)(K,{variant:e},e.id))}),(0,H.jsx)(P,{open:a!==null,onOpenChange:e=>!e&&o(null),children:(0,H.jsxs)(k,{children:[(0,H.jsxs)(A,{children:[(0,H.jsxs)(z,{children:[`Pick variant `,a?.variant,`?`]}),(0,H.jsxs)(R,{children:[`Variant `,a?.variant,`'s changes go to the review gate. The other`,` `,t.length-1==1?`variant is`:`${t.length-1} variants are`,` `,`cancelled if still open, archived, and their worktrees and branches removed. There is no undo.`]})]}),(0,H.jsxs)(B,{children:[(0,H.jsx)(j,{children:`Keep comparing`}),(0,H.jsxs)(M,{"data-slot":`confirm-pick`,onClick:()=>{a&&f.mutate(a.id),o(null)},children:[(0,H.jsx)(_,{"aria-hidden":`true`}),`Pick variant `,a?.variant]})]})]})})]})}function G({variant:e,allTerminal:t,pickPending:n,onPick:r}){let i=w(e),a=F(e.costUsd);return(0,H.jsxs)(`article`,{"data-slot":`variant-column`,"data-variant":e.variant,className:`flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-card p-3.5 shadow-xs`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{"data-slot":`variant-letter`,"aria-label":`Variant ${e.variant}`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full bg-violet/15 font-mono text-xs font-semibold text-violet`,children:e.variant}),(0,H.jsx)(N,{dot:i.tone,pulse:i.pulse,children:i.label}),(0,H.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:[O(e.tokensUsed),a?` · ${a}`:``]})]}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`git diff --stat`}),(0,H.jsx)(`pre`,{"data-slot":`variant-diffstat`,className:`max-h-36 overflow-auto rounded-md bg-muted/60 px-2.5 py-2 font-mono text-[11px] leading-[1.6] whitespace-pre text-muted-foreground`,children:e.diffStat.trimEnd()||`(no changes)`})]}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`Progress`}),e.handoffExcerpt?(0,H.jsx)(`div`,{"data-slot":`variant-progress`,className:`max-h-28 min-w-0 overflow-hidden text-[12.5px] text-muted-foreground [mask-image:linear-gradient(to_bottom,black_75%,transparent)]`,children:(0,H.jsx)(C,{children:e.handoffExcerpt})}):(0,H.jsx)(`p`,{"data-slot":`variant-progress`,className:`text-xs text-soft-foreground`,children:`(no progress notes)`})]}),(0,H.jsxs)(f,{"data-slot":`variant-pick`,title:t?`Keep variant ${e.variant}'s changes and archive the others`:`Every variant must finish before you can pick`,disabled:!t||n,onClick:r,children:[(0,H.jsx)(_,{"aria-hidden":`true`}),`Pick this one`]})]})}function K({variant:e}){let[t,n]=(0,V.useState)(!1);return(0,H.jsxs)(b,{open:t,onOpenChange:n,"data-slot":`variant-diff`,"data-variant":e.variant,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card`,children:[(0,H.jsxs)(y,{className:`flex w-full items-center gap-2 px-3.5 py-2.5 text-left text-[13px] font-medium hover:bg-muted/50`,children:[(0,H.jsx)(I,{className:g(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),`Variant `,e.variant,` — full diff`]}),(0,H.jsx)(x,{children:(0,H.jsx)(`div`,{className:`border-t border-border/50 px-3 py-3`,children:(0,H.jsx)(S,{runId:e.id})})})]})}export{U as CompareVariantsRoute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,o as t}from"./bundle-mjs-DLPpRFyl.js";import{a as n}from"./centered-state-zgEVNWsj.js";import{t as r}from"./utils-rQGbOrwc.js";import{t as i}from"./x-Br_jIDBw.js";import{a,i as o,n as s,o as c,r as l,s as u,t as d}from"./dist-id2CeyV-.js";t();var f=e();function p({...e}){return(0,f.jsx)(d,{"data-slot":`dialog`,...e})}function m({...e}){return(0,f.jsx)(c,{"data-slot":`dialog-portal`,...e})}function h({...e}){return(0,f.jsx)(s,{"data-slot":`dialog-close`,...e})}function g({className:e,...t}){return(0,f.jsx)(a,{"data-slot":`dialog-overlay`,className:r(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function _({className:e,children:t,showCloseButton:n=!0,...a}){return(0,f.jsxs)(m,{"data-slot":`dialog-portal`,children:[(0,f.jsx)(g,{}),(0,f.jsxs)(l,{"data-slot":`dialog-content`,className:r(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...a,children:[t,n&&(0,f.jsxs)(s,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,f.jsx)(i,{}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function v({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`dialog-header`,className:r(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function y({className:e,showCloseButton:t=!1,children:i,...a}){return(0,f.jsxs)(`div`,{"data-slot":`dialog-footer`,className:r(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...a,children:[i,t&&(0,f.jsx)(s,{asChild:!0,children:(0,f.jsx)(n,{variant:`outline`,children:`Close`})})]})}function b({className:e,...t}){return(0,f.jsx)(u,{"data-slot":`dialog-title`,className:r(`text-lg leading-none font-semibold`,e),...t})}function x({className:e,...t}){return(0,f.jsx)(o,{"data-slot":`dialog-description`,className:r(`text-sm text-muted-foreground`,e),...t})}export{y as a,x as i,h as n,v as o,_ as r,b as s,p as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,l as t,o as n}from"./bundle-mjs-DLPpRFyl.js";import{t as r}from"./utils-rQGbOrwc.js";import{i,n as a,r as o}from"./highlighter-BKVEsACy.js";import{P as s,ot as c}from"./index-
|
|
1
|
+
import{a as e,l as t,o as n}from"./bundle-mjs-DLPpRFyl.js";import{t as r}from"./utils-rQGbOrwc.js";import{i,n as a,r as o}from"./highlighter-BKVEsACy.js";import{P as s,ot as c}from"./index-Cv1pQs9U.js";var l=t(n(),1),u=/[A-Za-z0-9_]+|\s+|[^\sA-Za-z0-9_]+/g,d=300,f=.3;function p(e,t){if(e===t)return null;let n=e.match(u)??[],r=t.match(u)??[];if(n.length===0||r.length===0||n.length>d||r.length>d)return null;let i=r.length+1,a=new Uint16Array((n.length+1)*i);for(let e=1;e<=n.length;e++)for(let t=1;t<=r.length;t++)a[e*i+t]=n[e-1]===r[t-1]?(a[(e-1)*i+(t-1)]??0)+1:Math.max(a[(e-1)*i+t]??0,a[e*i+(t-1)]??0);if((a[n.length*i+r.length]??0)/Math.max(n.length,r.length)<f)return null;let o=Array(n.length).fill(!1),s=Array(r.length).fill(!1),c=n.length,l=r.length;for(;c>0&&l>0;)n[c-1]===r[l-1]?(o[c-1]=!0,s[l-1]=!0,c--,l--):(a[(c-1)*i+l]??0)>=(a[c*i+(l-1)]??0)?c--:l--;return{del:m(n,o),add:m(r,s)}}function m(e,t){let n=[];return e.forEach((e,r)=>{let i=!(t[r]??!1),a=n[n.length-1];a&&a.changed===i?a.text+=e:n.push({text:e,changed:i})}),n}function h(e,t,n){if(!t||t.length===0)return e?e.map(e=>({text:e.content,color:e.color,changed:!1})):n===``?[]:[{text:n,changed:!1}];if(!e||e.length===0)return t.map(e=>({text:e.text,changed:e.changed}));let r=[],i=0,a=0,o=0,s=0;for(;i<e.length&&o<t.length;){let n=e[i],c=t[o],l=n.content.length-a,u=c.text.length-s,d=Math.min(l,u);d>0&&(r.push({text:n.content.slice(a,a+d),color:n.color,changed:c.changed}),a+=d,s+=d),n.content.length-a<=0&&(i++,a=0),c.text.length-s<=0&&(o++,s=0)}for(;i<e.length;){let t=e[i],n=t.content.slice(a);n!==``&&r.push({text:n,color:t.color,changed:!1}),i++,a=0}return r}var g=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,_=`… (patch truncated)`;function v(e){let t=[],n=!1,r=null,i=0,a=0,o=e.split(`
|
|
2
2
|
`);o.at(-1)===``&&o.pop();for(let e of o){let o=g.exec(e);if(o){r={header:e,oldStart:Number(o[1]),oldCount:o[2]===void 0?1:Number(o[2]),newStart:Number(o[3]),newCount:o[4]===void 0?1:Number(o[4]),lines:[]},i=r.oldStart,a=r.newStart,t.push(r);continue}if(e.includes(_)){n=!0,r=null;continue}r&&(e.startsWith(`+`)?r.lines.push({kind:`add`,text:e.slice(1),newLine:a++}):e.startsWith(`-`)?r.lines.push({kind:`del`,text:e.slice(1),oldLine:i++}):e.startsWith(`\\`)||r.lines.push({kind:`context`,text:e.slice(1),oldLine:i++,newLine:a++}))}return{hunks:t,truncated:n}}function y(e,t=!1){let n=[],r=e[0];if(!r)return n;r.newStart>1&&n.push({beforeHunk:0,count:r.newStart-1,oldStart:1,newStart:1});for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t],a=r.oldStart+r.oldCount,o=r.newStart+r.newCount,s=i.newStart-o;s>0&&n.push({beforeHunk:t,count:s,oldStart:a,newStart:o})}if(t){let t=e[e.length-1];n.push({beforeHunk:e.length,oldStart:t.oldStart+t.oldCount,newStart:t.newStart+t.newCount})}return n}function b(e,t){let n=e.count===void 0?t.length:e.newStart+e.count-1,r=e.oldStart-e.newStart,i=[];for(let a=e.newStart;a<=Math.min(n,t.length);a++)i.push({kind:`context`,text:t[a-1]??``,oldLine:a+r,newLine:a});return i}function x(e,t){let n=Array(e.length),r=Array(t.length),i=Math.min(e.length,t.length);for(let a=0;a<i;a++){let i=p(e[a].text,t[a].text);i&&(n[a]=i.del,r[a]=i.add)}return{dels:e,adds:t,delSpans:n,addSpans:r}}function S(e,t,n){let r=0;for(;r<e.lines.length;){let i=e.lines[r];if(i.kind===`del`||i.kind===`add`){let t=[],i=[];for(;r<e.lines.length&&e.lines[r].kind===`del`;)t.push(e.lines[r++]);for(;r<e.lines.length&&e.lines[r].kind===`add`;)i.push(e.lines[r++]);n(x(t,i))}else t(i),r++}}function C(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`line`,cell:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),S(e,e=>i.push({type:`line`,cell:{line:e}}),e=>{e.dels.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.delSpans[n]}})),e.adds.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.addSpans[n]}}))})}),a(e.length),i}function w(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`pair`,left:{line:e},right:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),S(e,e=>i.push({type:`pair`,left:{line:e},right:{line:e}}),e=>{let t=Math.max(e.dels.length,e.adds.length);for(let n=0;n<t;n++){let t=e.dels[n],r=e.adds[n];i.push({type:`pair`,...t?{left:{line:t,spans:e.delSpans[n]}}:{},...r?{right:{line:r,spans:e.addSpans[n]}}:{}})}})}),a(e.length),i}var T=e(),E=1500;function D({files:e,mode:t=`unified`,wrap:n=!1,loadFileText:i,className:a}){let o=(0,l.useMemo)(()=>({adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length}),[e]);return(0,T.jsxs)(`div`,{"data-slot":`diff`,"data-mode":t,className:r(`flex min-w-0 flex-col gap-3`,a),children:[(0,T.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,T.jsxs)(`span`,{children:[o.files,` `,o.files===1?`file`:`files`,` changed`]}),(0,T.jsx)(s,{stat:o})]}),e.map(e=>(0,T.jsx)(k,{file:e,mode:t,wrap:n,loadFileText:i},`${e.oldPath??``}→${e.path}`))]})}var O={added:`added`,deleted:`deleted`,renamed:`renamed`,copied:`copied`};function k({file:e,mode:t,wrap:n,loadFileText:i}){let[a,o]=(0,l.useState)(!0),u=O[e.status];return(0,T.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,T.jsx)(`header`,{className:`sticky top-[var(--diff-sticky-top,0px)] z-10 rounded-t-md border-b border-border/50 bg-card`,children:(0,T.jsxs)(`button`,{type:`button`,"data-slot":`diff-file-header`,"aria-expanded":a,onClick:()=>o(e=>!e),className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,T.jsx)(c,{className:r(`size-3.5 shrink-0 text-soft-foreground transition-transform`,a&&`rotate-90`),"aria-hidden":`true`}),(0,T.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),u?(0,T.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:u}):null,e.binary?(0,T.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:`binary`}):null,(0,T.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,T.jsx)(s,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]})}),a?(0,T.jsx)(A,{file:e,mode:t,wrap:n,loadFileText:i}):null]})}function A({file:e,mode:t,wrap:n,loadFileText:i}){let a=(0,l.useMemo)(()=>v(e.patch),[e.patch]),o=i!==void 0&&e.status!==`added`&&e.status!==`deleted`,s=(0,l.useMemo)(()=>y(a.hunks,o),[a.hunks,o]),[c,u]=(0,l.useState)(new Map),d=async t=>{if(!i)return;let n=await i(e.path);if(n===null)return;let r=b(t,n.split(`
|
|
3
3
|
`));u(e=>new Map(e).set(t.beforeHunk,r))},f=(0,l.useMemo)(()=>{let e=[];a.hunks.forEach((t,n)=>{let r=c.get(n);r&&e.push(...r),e.push(...t.lines)});let t=c.get(a.hunks.length);return t&&e.push(...t),e},[a.hunks,c]),p=(0,l.useMemo)(()=>new Map(f.map((e,t)=>[e,t])),[f]),m=j(e.path,f),h=(0,l.useMemo)(()=>t===`unified`?C(a.hunks,s,c):null,[t,a.hunks,s,c]),g=(0,l.useMemo)(()=>t===`split`?w(a.hunks,s,c):null,[t,a.hunks,s,c]);if(e.binary)return(0,T.jsx)(M,{children:`Binary file — no text diff.`});if(a.hunks.length===0)return(0,T.jsx)(M,{children:a.truncated?`Patch truncated by the server.`:`No content changes (metadata only).`});let _=e=>{if(!m)return null;let t=p.get(e);return t===void 0?null:m[t]??null},x=i!==void 0&&e.status!==`added`&&e.status!==`deleted`;return(0,T.jsxs)(`div`,{"data-slot":`diff-file-body`,"data-wrap":n||void 0,className:r(`py-1 font-mono text-xs leading-[1.7]`,!n&&`overflow-x-auto`),children:[h?h.map((e,t)=>(0,T.jsx)(z,{row:e,wrap:n,tokensFor:_,onExpand:x?d:void 0},t)):null,g?g.map((e,t)=>(0,T.jsx)(B,{row:e,wrap:n,tokensFor:_,onExpand:x?d:void 0},t)):null,a.truncated?(0,T.jsx)(M,{children:`Patch truncated by the server — counts above remain exact.`}):null]})}function j(e,t){let n=(0,l.useMemo)(()=>t.length>E?null:t.map(e=>e.text).join(`
|
|
4
4
|
`),[t]),r=(0,l.useMemo)(()=>i(e),[e]),[s,c]=(0,l.useState)(null);return(0,l.useEffect)(()=>{if(n===null||r===null)return;let e=!1;return a(n,r).then(t=>{e||c({text:n,tokens:t.tokens})}),()=>{e=!0}},[n,r]),n===null||r===null?null:s?.text===n?s.tokens:o(n,r)?.tokens??null}function M({children:e}){return(0,T.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:e})}var N={add:`bg-diff-add`,del:`bg-diff-del`,context:void 0},P={add:`+`,del:`−`,context:` `};function F({hunk:e}){return(0,T.jsx)(`div`,{"data-slot":`diff-hunk`,className:`bg-muted/40 px-4 py-0.5 whitespace-pre text-soft-foreground`,children:e.header})}function I({gap:e,onExpand:t}){let n=e.count===void 0?`⋯ unchanged lines to end of file`:`⋯ ${e.count} unchanged ${e.count===1?`line`:`lines`}`;return t?(0,T.jsxs)(`button`,{type:`button`,"data-slot":`diff-gap`,onClick:()=>t(e),className:`block w-full border-y border-border/40 bg-muted/20 px-4 py-0.5 text-left text-[11px] text-soft-foreground hover:bg-muted/50 hover:text-foreground`,children:[n,` — expand`]}):(0,T.jsx)(`div`,{"data-slot":`diff-gap`,className:`border-y border-border/40 bg-muted/20 px-4 py-0.5 text-[11px] text-soft-foreground`,children:n})}function L({cell:e,tokens:t,wrap:n}){let i=h(t,e.spans,e.line.text),a=e.line.kind===`add`?`bg-diff-add-strong`:`bg-diff-del-strong`;return(0,T.jsxs)(`span`,{className:r(`min-w-0 flex-1 pr-4`,n?`break-words whitespace-pre-wrap`:`whitespace-pre`),children:[i.map((t,n)=>(0,T.jsx)(`span`,{"data-word":t.changed?e.line.kind:void 0,style:t.color===void 0?void 0:{color:t.color},className:t.changed?r(`rounded-[2px]`,a):void 0,children:t.text},n)),e.line.text===``?` `:``]})}function R({value:e}){return(0,T.jsx)(`span`,{className:`w-10 shrink-0 pr-2 text-right text-soft-foreground/70 tabular-nums select-none`,children:e??``})}function z({row:e,wrap:t,tokensFor:n,onExpand:i}){if(e.type===`hunk`)return(0,T.jsx)(F,{hunk:e.hunk});if(e.type===`gap`)return(0,T.jsx)(I,{gap:e.gap,onExpand:i});let{line:a}=e.cell;return(0,T.jsxs)(`div`,{"data-slot":`diff-line`,"data-line":a.kind,className:r(`flex`,N[a.kind]),children:[(0,T.jsx)(R,{value:a.oldLine}),(0,T.jsx)(R,{value:a.newLine}),(0,T.jsx)(`span`,{className:`w-4 shrink-0 text-soft-foreground select-none`,children:P[a.kind]}),(0,T.jsx)(L,{cell:e.cell,tokens:n(a),wrap:t})]})}function B({row:e,wrap:t,tokensFor:n,onExpand:r}){return e.type===`hunk`?(0,T.jsx)(F,{hunk:e.hunk}):e.type===`gap`?(0,T.jsx)(I,{gap:e.gap,onExpand:r}):(0,T.jsxs)(`div`,{"data-slot":`diff-pair`,className:`grid grid-cols-2`,children:[(0,T.jsx)(V,{cell:e.left,side:`old`,tokensFor:n,wrap:t}),(0,T.jsx)(V,{cell:e.right,side:`new`,tokensFor:n,wrap:t})]})}function V({cell:e,side:t,tokensFor:n,wrap:i}){if(!e)return(0,T.jsx)(`div`,{"data-slot":`diff-cell-empty`,className:r(`bg-muted/20`,t===`new`&&`border-l border-border/40`)});let{line:a}=e;return(0,T.jsxs)(`div`,{"data-slot":`diff-cell`,"data-line":a.kind,className:r(`flex min-w-0`,N[a.kind],t===`new`&&`border-l border-border/40`),children:[(0,T.jsx)(R,{value:t===`old`?a.oldLine:a.newLine}),(0,T.jsx)(`span`,{className:`w-4 shrink-0 text-soft-foreground select-none`,children:P[a.kind]}),(0,T.jsx)(L,{cell:e,tokens:n(a),wrap:i})]})}export{D as DiffView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,o as n}from"./bundle-mjs-DLPpRFyl.js";import{C as r,T as i,_ as a,b as o,c as s,d as c,f as l,g as u,h as d,l as f,p,s as m,u as h,x as g,y as _}from"./centered-state-zgEVNWsj.js";var v=t(n(),1),y=e(),b=`Dialog`,[x,S]=o(b),[C,w]=x(b),T=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=e,c=v.useRef(null),l=v.useRef(null),[u,f]=a({prop:r,defaultProp:i??!1,onChange:o,caller:b});return(0,y.jsx)(C,{scope:t,triggerRef:c,contentRef:l,contentId:d(),titleId:d(),descriptionId:d(),open:u,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),modal:s,children:n})};T.displayName=b;var E=`DialogTrigger`,D=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,a=w(E,n),o=i(t,a.triggerRef);return(0,y.jsx)(g.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":q(a.open),...r,ref:o,onClick:_(e.onClick,a.onOpenToggle)})});D.displayName=E;var O=`DialogPortal`,[k,A]=x(O,{forceMount:void 0}),j=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=w(O,t);return(0,y.jsx)(k,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,y.jsx)(u,{present:n||a.open,children:(0,y.jsx)(h,{asChild:!0,container:i,children:e})}))})};j.displayName=O;var M=`DialogOverlay`,N=v.forwardRef((e,t)=>{let n=A(M,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(M,e.__scopeDialog);return a.modal?(0,y.jsx)(u,{present:r||a.open,children:(0,y.jsx)(F,{...i,ref:t})}):null});N.displayName=M;var P=r(`DialogOverlay.RemoveScroll`),F=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,a=w(M,n),o=i(t,p());return(0,y.jsx)(s,{as:P,allowPinchZoom:!0,shards:[a.contentRef],children:(0,y.jsx)(g.div,{"data-state":q(a.open),...r,ref:o,style:{pointerEvents:`auto`,...r.style}})})}),I=`DialogContent`,L=v.forwardRef((e,t)=>{let n=A(I,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(I,e.__scopeDialog);return(0,y.jsx)(u,{present:r||a.open,children:a.modal?(0,y.jsx)(R,{...i,ref:t}):(0,y.jsx)(z,{...i,ref:t})})});L.displayName=I;var R=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(null),a=i(t,n.contentRef,r);return v.useEffect(()=>{let e=r.current;if(e)return m(e)},[]),(0,y.jsx)(B,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:_(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:_(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:_(e.onFocusOutside,e=>e.preventDefault())})}),z=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,y.jsx)(B,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),B=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=w(I,n);return f(),(0,y.jsx)(y.Fragment,{children:(0,y.jsx)(c,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,y.jsx)(l,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":q(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),V=`DialogTitle`,H=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(V,n);return(0,y.jsx)(g.h2,{id:i.titleId,...r,ref:t})});H.displayName=V;var U=`DialogDescription`,W=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(U,n);return(0,y.jsx)(g.p,{id:i.descriptionId,...r,ref:t})});W.displayName=U;var G=`DialogClose`,K=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(G,n);return(0,y.jsx)(g.button,{type:`button`,...r,ref:t,onClick:_(e.onClick,()=>i.onOpenChange(!1))})});K.displayName=G;function q(e){return e?`open`:`closed`}export{N as a,D as c,W as i,S as l,K as n,j as o,L as r,H as s,T as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,o as n}from"./bundle-mjs-DLPpRFyl.js";import{a as r}from"./centered-state-zgEVNWsj.js";import{n as i,t as a}from"./utils-rQGbOrwc.js";import{t as o}from"./ellipsis-vertical-DJPAfccS.js";import{n as s}from"./tab-link-C77EP3i6.js";import{n as c,t as l}from"./folder-RbRLfIX-.js";import{a as u,i as d,r as f}from"./use-desktop-CyEWsxSU.js";import{t as p}from"./git-pull-request-DJkAMT0f.js";import{t as m}from"./square-terminal-B6PZX4Qp.js";import{t as h}from"./upload-Bp7hQxll.js";import{A as g,N as _,P as v,j as y,k as b,ot as x}from"./index-Cv1pQs9U.js";var S=i(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),C=t(n(),1),w=e();function T({root:e,selected:t,onSelect:n}){return(0,w.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,w.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,w.jsx)(D,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,w.jsx)(k,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function E({adds:e,dels:t}){return(0,w.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] font-medium tabular-nums`,children:[e>0?(0,w.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,w.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function D({dir:e,depth:t,selected:n,onSelect:r}){let[i,o]=(0,C.useState)(!0);return(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":i?`open`:`closed`,"aria-expanded":i,onClick:()=>o(e=>!e),className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,w.jsx)(x,{"aria-hidden":`true`,className:a(`size-3.5 shrink-0 transition-transform`,i&&`rotate-90`)}),(0,w.jsx)(l,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,w.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,w.jsx)(E,{adds:e.adds,dels:e.dels})]}),i?(0,w.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,w.jsx)(D,{dir:e,depth:t+1,selected:n,onSelect:r},e.path)),e.files.map(e=>(0,w.jsx)(k,{file:e,depth:t+1,selected:n,onSelect:r},e.path))]}):null]})}var O={added:`text-success`,deleted:`text-danger`};function k({file:e,depth:t,selected:n,onSelect:r}){let i=n===e.path;return(0,w.jsx)(`li`,{children:(0,w.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":i?`true`:void 0,onClick:()=>r(e.path),className:a(`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,i?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,w.jsx)(c,{"aria-hidden":`true`,className:a(`size-3.5 shrink-0`,O[e.status])}),(0,w.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,w.jsx)(E,{adds:e.adds,dels:e.dels})]})})}function A(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function j(e){let t=e;for(;t.files.length===0&&t.dirs.length===1;){let e=t.dirs[0];t={...e,name:`${t.name}/${e.name}`}}return{...t,dirs:t.dirs.map(j)}}var M=(e,t)=>e.name.localeCompare(t.name);function N(e){let t=A(``,``),n=new Map([[``,t]]),r=e=>{let t=n.get(e);if(t)return t;let i=e.lastIndexOf(`/`),a=r(i===-1?``:e.slice(0,i)),o=A(i===-1?e:e.slice(i+1),e);return a.dirs.push(o),n.set(e,o),o};for(let t of e){let e=t.path.lastIndexOf(`/`);r(e===-1?``:t.path.slice(0,e)).files.push({kind:`file`,name:e===-1?t.path:t.path.slice(e+1),path:t.path,status:t.status,adds:t.adds,dels:t.dels,binary:t.binary})}let i=e=>{e.dirs.forEach(i),e.adds=e.files.reduce((e,t)=>e+t.adds,0)+e.dirs.reduce((e,t)=>e+t.adds,0),e.dels=e.files.reduce((e,t)=>e+t.dels,0)+e.dirs.reduce((e,t)=>e+t.dels,0),e.fileCount=e.files.length+e.dirs.reduce((e,t)=>e+t.fileCount,0),e.dirs.sort(M),e.files.sort(M)};return i(t),{...t,dirs:t.dirs.map(j)}}function P({bar:e,branch:t,stat:n,mode:i,wrap:a,onModeChange:s,onWrapChange:c,onAction:l}){return(0,w.jsxs)(`div`,{"data-slot":`git-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[t?(0,w.jsx)(f,{branch:t}):null,n?(0,w.jsx)(L,{stat:n}):null,(0,w.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,w.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,w.jsx)(d,{mode:i,wrap:a,onModeChange:s,onWrapChange:c})}),e.secondary.map(e=>(0,w.jsx)(I,{action:e,variant:`outline`,onAction:l},e.id)),(0,w.jsx)(I,{action:e.primary,variant:`primary`,onAction:l}),e.menu.length>0?(0,w.jsxs)(b,{children:[(0,w.jsx)(_,{asChild:!0,children:(0,w.jsx)(r,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,children:(0,w.jsx)(o,{"aria-hidden":`true`})})}),(0,w.jsx)(g,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,w.jsxs)(y,{disabled:!e.enabled,title:e.reason,onSelect:()=>l(e.id),children:[F[e.id],e.label]},e.id))})]}):null]})]})}var F={commit:(0,w.jsx)(u,{"aria-hidden":`true`}),push:(0,w.jsx)(h,{"aria-hidden":`true`}),"create-pr":(0,w.jsx)(p,{"aria-hidden":`true`}),"view-pr":(0,w.jsx)(s,{"aria-hidden":`true`}),"open-terminal":(0,w.jsx)(m,{"aria-hidden":`true`})};function I({action:e,variant:t,onAction:n}){return e.id===`view-pr`&&e.href?(0,w.jsx)(r,{asChild:!0,variant:t,size:`sm`,"data-action":e.id,children:(0,w.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[F[e.id],e.label]})}):(0,w.jsxs)(r,{variant:t,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>n(e.id),children:[F[e.id],e.label]})}function L({stat:e}){return(0,w.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,w.jsx)(v,{stat:{adds:R(e.adds),dels:R(e.dels),files:e.files}})})}function R(e){let[t,n]=(0,C.useState)(e),r=(0,C.useRef)(e);return(0,C.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}export{S as a,T as i,P as n,N as r,L as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,o as n}from"./bundle-mjs-DLPpRFyl.js";import{D as r,Dt as i,Ft as a,Lt as o,X as s,a as c,i as l,it as u,k as d,q as f,t as p,ut as m,zt as h}from"./centered-state-zgEVNWsj.js";import{n as g,t as _}from"./utils-rQGbOrwc.js";import{t as v}from"./arrow-left-BE957rJs.js";import{i as y,n as b}from"./skill-detail-CcFFKmGO.js";import{n as x}from"./loader-circle-BV3DO9mE.js";import{n as S,t as C}from"./tab-link-C77EP3i6.js";import{t as w}from"./git-pull-request-DJkAMT0f.js";import{t as ee}from"./refresh-cw-DCa-Rlwz.js";import{t as te}from"./triangle-alert-6su4Js5O.js";import{t as T}from"./x-Br_jIDBw.js";import{r as E}from"./skills-ynuO5oCr.js";import{t as D}from"./markdown-CR_HLGTs.js";import{D as O,E as k,G as A,H as j,J as ne,K as M,T as N,U as P,V as F,W as I,X as L,Y as R,Z as re,c as z,et as B,it as V,st as H,w as U,z as W}from"./index-Cv1pQs9U.js";var G=g(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),ie=g(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),K=t(n(),1);function q(e,t=[]){let n=`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`;return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=`\n\nUse these skills where relevant: ${t.join(`, `)}.`),n}function ae(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function oe(e,t,n,r){let i=r?.trim();return t?{workflow:t,task:i||q(e,n)}:n.length?{steps:ae(n),task:i||q(e)}:{workflow:`quick-task`,task:i||q(e)}}function se(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function ce(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function J(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}var Y=e();function le({item:e,workflows:t,skills:n,workflow:a,onWorkflowChange:s,selectedSkills:d,onSkillsChange:f,queuedRunId:p,onQueued:m}){let g=h(),_=d.filter(e=>n.some(t=>t.name===e)),[v,b]=(0,K.useState)(``),S=o({mutationFn:()=>u(oe(e,a,_,v)),onSuccess:t=>{let n=`runs`in t?t.runs[0]:t;n&&m(e.url,n.id),g.invalidateQueries({queryKey:r.runs.all})},onError:e=>l(e.message,{tone:`danger`})}),C=e=>f(d.includes(e)?d.filter(t=>t!==e):[...d,e]);return(0,Y.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:[(0,Y.jsx)(y,{"aria-hidden":`true`,className:`size-3.5 text-violet`}),`Hand this to the agent`]}),(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(ue,{workflows:t,value:a,onChange:s}),(0,Y.jsx)(de,{skills:n,selected:d,onToggle:C})]}),d.length>0?(0,Y.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:d.map(e=>(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>C(e),title:`Remove this skill`,className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,Y.jsx)(T,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,Y.jsx)(z,{"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,value:v,onChange:e=>b(e.target.value),placeholder:`Add instructions for the agent… (empty uses the default "${e.kind===`pr`?`Address`:`Fix`} #${e.number}" prompt)`,className:`mt-3 min-h-20 text-[13px]`}),(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,Y.jsxs)(c,{variant:`contrast`,"data-action":`gh-run`,disabled:S.isPending,onClick:()=>S.mutate(),children:[(0,Y.jsx)(B,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,e.kind===`pr`?`PR`:`issue`]}),p?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Y.jsx)(x,{"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Y.jsx)(i,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-violet hover:underline`,children:`View task →`})]}):null]})]})}var X=`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`;function ue({workflows:e,value:t,onChange:n}){let[r,i]=(0,K.useState)(!1);return(0,Y.jsxs)(U,{open:r,onOpenChange:i,children:[(0,Y.jsx)(k,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:_(X,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,Y.jsx)(`span`,{className:`max-w-44 truncate`,children:t??`workflow`}),(0,Y.jsx)(H,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(N,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(I,{placeholder:`search workflows…`}),(0,Y.jsxs)(M,{"data-slot":`gh-workflow-menu`,className:`max-h-64`,children:[(0,Y.jsx)(j,{children:`Nothing matches.`}),(0,Y.jsx)(P,{children:e.map(e=>{let r=t===e.name;return(0,Y.jsxs)(A,{value:`workflow ${e.name}`,keywords:e.description?[e.description]:void 0,"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),i(!1)},children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Y.jsx)(x,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.name)})})]})]})})]})}function de({skills:e,selected:t,onToggle:n}){let[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),s=e.filter(E),c=e.filter(e=>!E(e)),l=(e,r)=>{let i=t.includes(e.name);return(0,Y.jsxs)(A,{value:`skill ${e.name} ${e.path}`,keywords:e.description?[e.description]:void 0,"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":i?`true`:void 0,onSelect:()=>n(e.name),children:[(0,Y.jsx)(`span`,{className:_(`shrink-0 font-mono text-xs`,r&&`font-semibold`),children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),o(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Y.jsx)(V,{"aria-hidden":`true`,className:`size-3.5`})}),i?(0,Y.jsx)(x,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.path)};return e.length===0?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(b,{skill:a,onClose:()=>o(null)}),(0,Y.jsxs)(U,{open:r,onOpenChange:i,children:[(0,Y.jsx)(k,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:_(X,t.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Y.jsx)(L,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),`skills`,t.length>0?` · ${t.length}`:``,(0,Y.jsx)(H,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(N,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(I,{placeholder:`search skills…`}),(0,Y.jsxs)(M,{"data-slot":`gh-skill-menu`,className:`max-h-64`,children:[(0,Y.jsx)(j,{children:`Nothing matches.`}),s.length>0?(0,Y.jsx)(P,{heading:`Project skills`,children:s.map(e=>l(e,!0))}):null,c.length>0?(0,Y.jsx)(P,{heading:`Global`,children:c.map(e=>l(e,!1))}):null]})]})})]})]})}var fe=30,Z=1e3;function pe({view:e}){let{n:t}=a(),n=d(),i=d({limit:Z},n.data?.available===!0),u=i.data?.available?i.data:n.data,g=i.data?.available===!0,v=h(),y=o({mutationFn:()=>m({refresh:!0}),onSuccess:e=>{v.setQueryData(r.github({}),e),v.invalidateQueries({queryKey:r.github({limit:Z})})},onError:e=>l(e.message,{tone:`danger`})}),b=s(),x=f(),[S,T]=(0,K.useState)(null),[E,D]=(0,K.useState)([]),[k,A]=(0,K.useState)(new Map),[j,M]=(0,K.useState)(``),[N,P]=(0,K.useState)([]);if(!u)return n.isError?(0,Y.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(p,{icon:(0,Y.jsx)(te,{}),tone:`danger`,title:`Could not load GitHub`,subtitle:n.error.message})}):(0,Y.jsx)(O,{});if(!u.available)return(0,Y.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(p,{icon:(0,Y.jsx)(ne,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:u.reason??`unknown reason`,actions:(0,Y.jsx)(c,{variant:`outline`,"data-action":`gh-retry`,disabled:y.isPending,onClick:()=>y.mutate(),children:`Try again`}),children:(0,Y.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Y.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Y.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in cezar works without it.`]})})});let F=e===`issues`?u.issues:u.prs,I=u.labelColors??{},L=se(F),R=ce(F,{query:j,labels:N}),z=j.trim()!==``||N.length>0,B=t===void 0?null:Number.parseInt(t,10),V=B===null?R[0]??null:F.find(e=>e.number===B)??null,H=e===`issues`?`/github`:`/github/prs`;return(0,Y.jsxs)(`div`,{"data-route":`github`,className:`flex h-full min-h-0 items-stretch`,children:[(0,Y.jsxs)(`section`,{"data-slot":`gh-list`,className:_(`w-full min-h-0 flex-col overflow-y-auto overscroll-contain border-border md:flex md:w-[360px] md:shrink-0 md:border-r`,t===void 0?`flex`:`hidden`),children:[(0,Y.jsxs)(`header`,{"data-slot":`gh-header`,className:`sticky top-0 z-10 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Y.jsx)(`h1`,{className:`text-lg font-semibold`,children:`GitHub`}),u.repo?(0,Y.jsx)(`span`,{"data-slot":`gh-repo`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,children:u.repo}):null,(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:y.isPending,onClick:()=>y.mutate(),className:`ml-auto flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-[10px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,Y.jsx)(ee,{"aria-hidden":`true`,className:_(`size-[9px]`,y.isPending&&`motion-safe:animate-spin`)}),u.syncedAt?`synced ${W(u.syncedAt)} ago`:`refresh`]})]}),(0,Y.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,Y.jsxs)(C,{to:`/github`,active:e===`issues`,children:[`Issues · `,Q(u.issues.length,g)]}),(0,Y.jsxs)(C,{to:`/github/prs`,active:e===`prs`,children:[`Pull requests · `,Q(u.prs.length,g)]})]}),(0,Y.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 pb-3`,children:[(0,Y.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,Y.jsx)(re,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,Y.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:j,onChange:e=>M(e.target.value),className:`w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,Y.jsx)(he,{options:L,colors:I,selected:N,onChange:P})]})]}),R.length===0?(0,Y.jsx)(`p`,{className:`px-4 py-4 text-sm text-soft-foreground`,children:z?`No ${e===`issues`?`issues`:`pull requests`} match your filter.`:`No open ${e===`issues`?`issues`:`pull requests`}.`}):(0,Y.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-0.5 px-2 py-2`,children:R.map(t=>(0,Y.jsx)(me,{item:t,view:e,colors:I,active:V?.url===t.url,queued:k.has(t.url)},t.url))})]}),(0,Y.jsx)(`section`,{"data-slot":`gh-detail`,className:_(`min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,t===void 0?`hidden md:flex`:`flex`),children:V?(0,Y.jsx)(ge,{item:V,listPath:H,colors:I,children:(0,Y.jsx)(le,{item:V,workflows:b.data?.workflows??[],skills:x.data??[],workflow:S,onWorkflowChange:T,selectedSkills:E,onSkillsChange:D,queuedRunId:k.get(V.url)??null,onQueued:(e,t)=>A(n=>new Map(n).set(e,t))},V.url)}):(0,Y.jsx)(p,{icon:e===`issues`?(0,Y.jsx)(G,{}):(0,Y.jsx)(w,{}),tone:`neutral`,heading:`h2`,title:B===null?`Nothing selected`:`Not in the open list`,subtitle:B===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${B} is not among the open ${e===`issues`?`issues`:`pull requests`} — it may be closed, or still outside the fetched batch.`})})]})}function Q(e,t){return`${e}${!t&&e>=fe?`+`:``}`}function me({item:e,view:t,colors:n,active:r,queued:a}){let o=e.kind===`issue`?G:w;return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(i,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,q(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},"data-slot":`gh-row`,"data-number":e.number,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:_(`flex flex-col gap-1 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,r&&`bg-muted`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(o,{"aria-hidden":`true`,className:_(`size-3.5 shrink-0`,e.kind===`issue`?`text-success`:`text-violet`)}),(0,Y.jsx)(`span`,{className:_(`min-w-0 truncate text-[13px] font-medium`,r&&`font-semibold`),children:e.title})]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 pl-[22px] font-mono text-[10.5px] text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`#`,e.number]}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:e.author}),(0,Y.jsx)(`span`,{children:W(e.createdAt)}),a?(0,Y.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-violet`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Y.jsx)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Y.jsx)($,{label:e,color:n[e]},e))}):null]})})}function he({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,K.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Y.jsxs)(U,{open:i,onOpenChange:a,children:[(0,Y.jsx)(k,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:_(`flex shrink-0 items-center gap-1 rounded-md border border-input bg-card px-2 py-1 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-primary/60 text-foreground`),children:[(0,Y.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,Y.jsx)(N,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(I,{placeholder:`Filter labels…`}),(0,Y.jsxs)(M,{className:`max-h-64`,children:[(0,Y.jsx)(j,{children:`No labels.`}),n.length>0?(0,Y.jsxs)(A,{value:`__clear__`,onSelect:()=>r([]),className:`text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,Y.jsxs)(A,{value:e,onSelect:()=>o(e),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:J(t[e])}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Y.jsx)(x,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e)})]})]})})]})}function $({label:e,color:t}){return(0,Y.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:J(t),className:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function ge({item:e,listPath:t,colors:n,children:r}){let a=e.kind===`pr`?`pull request`:`issue`,o=e.kind===`pr`&&!!(e.additions||e.deletions);return(0,Y.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Y.jsxs)(i,{to:t,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Y.jsx)(v,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,Y.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[10.5px] text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Y.jsx)(`span`,{children:a}),`·`,(0,Y.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Y.jsxs)(`span`,{children:[W(e.createdAt),` ago`]}),e.comments?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsxs)(`span`,{children:[e.comments,` comments`]})]}):null,o?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(S,{"aria-hidden":`true`,className:`size-2.5`})]})]}),(0,Y.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:e.title}),e.labels.length>0||e.checks?(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Y.jsx)($,{label:e,color:n[e]},e)),e.checks?(0,Y.jsx)(_e,{checks:e.checks}):null]}):null,(0,Y.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,Y.jsx)(D,{children:e.body}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),r]})}function _e({checks:e}){return(0,Y.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:_(`text-[11px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e===`passing`?`✓ checks passing`:e===`failing`?`✗ checks failing`:`○ checks pending`})}export{pe as GithubRoute};
|