@wjarka/cezarion 0.18.0-dev.5931 → 0.18.0-dev.5939
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/package.json +2 -2
- package/web/dist/assets/{activity-motion-C7SredQ0.js → activity-motion-XsGcc9eM.js} +2 -2
- package/web/dist/assets/{activity-route-WKqFXmCG.js → activity-route-DIDXHV7J.js} +1 -1
- package/web/dist/assets/agent-accounts-CuRvwNoA.js +18 -0
- package/web/dist/assets/commit-diff-panel-DtHg36xc.js +1 -0
- package/web/dist/assets/{control-locations-5bi8dzFR.js → control-locations-CljaLD_b.js} +1 -1
- package/web/dist/assets/dialog-Dw7fMdDQ.js +1 -0
- package/web/dist/assets/diff-ImdJ4tPA.js +3 -0
- package/web/dist/assets/{diff-view-dVGWG20n.js → diff-view-BMqNpcSH.js} +5 -5
- package/web/dist/assets/dist-DvNdR7gM.js +1 -0
- package/web/dist/assets/dropdown-menu-D7f0O7xR.js +1 -0
- package/web/dist/assets/{file-preview-oBW4ASBA.js → file-preview-C58stPPw.js} +2 -2
- package/web/dist/assets/git-toolbar-Dzp24LO7.js +1 -0
- package/web/dist/assets/github-Cn0hlJsH.js +1 -0
- package/web/dist/assets/github-sidebar-model-BSNdxNKJ.js +1 -0
- package/web/dist/assets/global-activity-route-D5ke1ZQa.js +1 -0
- package/web/dist/assets/index-lMBPAedr.js +17 -0
- package/web/dist/assets/input-DIwJvCgi.js +1 -0
- package/web/dist/assets/{popover-s-Wchzjn.js → popover-N-u5z2xh.js} +1 -1
- package/web/dist/assets/preview-pane-connected-Cl-W1pDv.js +3 -0
- package/web/dist/assets/repo-git-YYivBJ2x.js +1 -0
- package/web/dist/assets/report-reader-gGAlVnKU.js +1 -0
- package/web/dist/assets/reports-B_xpuTvK.js +1 -0
- package/web/dist/assets/run-header-CxRJxVsR.js +2 -0
- package/web/dist/assets/skills-CEFXcZA5.js +1 -0
- package/web/dist/assets/skills-DFBiAuJG.js +1 -0
- package/web/dist/assets/task-changes-Bm4gjXBb.js +1 -0
- package/web/dist/assets/task-commits-DYHV533w.js +1 -0
- package/web/dist/assets/task-files-Bqvj0rbX.js +1 -0
- package/web/dist/assets/{task-github-item-CDIQvV4G.js → task-github-item-YkTV2--_.js} +1 -1
- package/web/dist/assets/{task-thread-DavPe-c1.js → task-thread-CempX7k0.js} +7 -7
- package/web/dist/assets/thread-state-BpcneWuV.js +4 -0
- package/web/dist/assets/use-hand-to-agent-state-B9qtivFb.js +1 -0
- package/web/dist/assets/workflows-z-CqJ0JW.js +7 -0
- package/web/dist/index.html +11 -5
- package/web/dist/assets/commit-diff-panel-_eayzzg3.js +0 -1
- package/web/dist/assets/diff-BZbKoEDq.js +0 -3
- package/web/dist/assets/dropdown-menu-CjLqyqwB.js +0 -1
- package/web/dist/assets/git-toolbar-C9eP5-IR.js +0 -1
- package/web/dist/assets/github-C7eAFy8Z.js +0 -1
- package/web/dist/assets/global-activity-route-CudWwf5u.js +0 -1
- package/web/dist/assets/index-C2zVqh-_.js +0 -34
- package/web/dist/assets/preview-pane-connected-Grs87tzs.js +0 -3
- package/web/dist/assets/repo-git-BTHhCxbX.js +0 -1
- package/web/dist/assets/report-reader-Cd7xo3WG.js +0 -1
- package/web/dist/assets/reports-C9Pv9alE.js +0 -1
- package/web/dist/assets/run-header-BdNi5U9a.js +0 -2
- package/web/dist/assets/skills-BNyPCfRC.js +0 -1
- package/web/dist/assets/task-changes-B8l73QaA.js +0 -1
- package/web/dist/assets/task-commits-CYlua3YQ.js +0 -1
- package/web/dist/assets/task-files-BRKU94QM.js +0 -1
- package/web/dist/assets/thread-state-QXZqjukm.js +0 -4
- package/web/dist/assets/use-hand-to-agent-state-B0KY1uOs.js +0 -1
- package/web/dist/assets/workflows-B2KHSiUl.js +0 -7
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{t as e,u as t}from"./button-CS5tOblf.js";import{t as n}from"./react-runtime-CCIEwYL0.js";import{gr as r,hr as i}from"./project-scope-context-wlB-Y0ii.js";import{U as a,W as o,_ as s,f as c,g as l,h as ee,m as u}from"./live-protocol-BAiIX_Mf.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{t as f}from"./app-window-CSHwDX9N.js";import{i as p}from"./format-BNCkW110.js";import{t as te}from"./play-CmVAj_fu.js";import{X as ne,Xt as re,Z as ie,dn as ae,nn as oe}from"./index-lMBPAedr.js";var m=d(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),h=d(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),g=n(),_={registered:e=>e.server.answeredAtRegistration?{label:`Open`,run:!1}:{label:`Run and open`,run:!0},adopted:()=>({label:`Open`,run:!1}),starting:()=>({label:`Open`,run:!1}),up:()=>({label:`Open`,run:!1}),stalled:()=>({label:`View`,run:!1}),exited:()=>({label:`Start again`,run:!0}),stopped:()=>({label:`Start again`,run:!0}),unavailable:()=>void 0};function v(e){let{text:t,...n}=ie(e),r={...n,status:t},i=_[e.state](e);return i?{...r,action:i}:r}var se={"Run and open":te,Open:f,View:ae,"Start again":m};function ce({entry:e,inPreview:n,onOpen:r}){let{server:i}=e,a=v(e),o=e.state===`unavailable`,s=r?a.action:void 0,c=ne(i.command),l=p(i.registeredAt);return(0,g.jsxs)(`div`,{"data-slot":`preview-server-card`,"data-state":e.state,className:t(`min-w-0 rounded-lg border border-border bg-card px-3.5 py-3 text-sm`,o&&`text-muted-foreground`),children:[(0,g.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-soft-foreground`,children:[(0,g.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono`,children:[(0,g.jsx)(h,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,g.jsx)(`span`,{className:`truncate`,children:`cezar_preview_serve`})]}),o?(0,g.jsx)(`span`,{children:`worktree removed`}):l?(0,g.jsxs)(`span`,{children:[l,` ago`]}):null]}),(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,g.jsx)(re,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse===!0,"aria-hidden":`true`}),(0,g.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),(0,g.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,i.port]}),(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:a.status})]}),(0,g.jsx)(le,{entry:e,inPreview:n,action:s,onOpen:r})]}),(0,g.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,g.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:i.command}),i.cwd?(0,g.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,g.jsx)(`span`,{children:`cwd`}),(0,g.jsx)(`span`,{className:`break-all`,children:i.cwd})]}):null]}),s?.run?(0,g.jsx)(y,{icon:(0,g.jsx)(oe,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),children:`${s.label===`Start again`?`Starting again`:`Opening`} runs ${c} in this task's worktree, on the host.`}):null,o?(0,g.jsx)(y,{children:`The worktree this server ran in is gone. Register it again from a new task.`}):null]})}function le({entry:t,inPreview:n,action:r,onOpen:i}){let{server:a}=t,o=n&&r!==void 0&&!r.run,s=o?`In preview`:r?.label,c=o?f:r?se[r.label]:null;return r&&s&&c?(0,g.jsxs)(e,{variant:o||r.label===`View`||r.label===`Open`&&t.state===`starting`?`outline`:`contrast`,size:`sm`,className:`max-md:h-11 max-md:px-3.5`,onClick:()=>i?.({port:a.port,run:r.run}),children:[(0,g.jsx)(c,{"aria-hidden":`true`}),s]}):null}function y({icon:e,children:t}){return(0,g.jsxs)(`p`,{className:`mt-2.5 flex items-start gap-2 text-xs text-muted-foreground`,children:[e,(0,g.jsx)(`span`,{children:t})]})}var b=120;function x(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function S(e){let t=e.replace(/\s+/g,` `).trim();return t.length>b?`${t.slice(0,b-1)}…`:t}function C(e,...t){if(x(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return S(t)}}function ue(e){if(!x(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return S(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return S(e.join(` `))}}function de(e){if(!x(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)x(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function w(e){return C(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function T(e,t){return t?`${e} ${t}`:e}var fe=new Map([[`bash`,`execute`],[`commandexecution`,`execute`],[`edit`,`edit`],[`multiedit`,`edit`],[`write`,`edit`],[`notebookedit`,`edit`],[`filechange`,`edit`],[`read`,`read`],[`imageview`,`read`],[`glob`,`search`],[`grep`,`search`],[`webfetch`,`fetch`],[`websearch`,`fetch`],[`task`,`task`],[`agent`,`task`],[`skill`,`task`],[`todowrite`,`plan`],[`todolist`,`plan`],[`plan`,`plan`],[`taskcreate`,`plan`],[`taskupdate`,`plan`],[`tasklist`,`plan`],[`contextcompaction`,`other`],[`mcptoolcall`,`other`]]);function pe(e,t){switch(e){case`write`:return{toolKind:`edit`,title:T(`Write`,C(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:T(`Edit`,C(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=de(t);return{toolKind:`edit`,title:T(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}default:return{toolKind:`edit`,title:T(`Edit`,C(t,`file_path`,`filePath`,`path`))}}}function me(e,t){return e===`imageview`?{toolKind:`read`,title:T(`View image`,C(t,`path`))}:{toolKind:`read`,title:T(`Read`,C(t,`file_path`,`filePath`,`path`))}}function he(e,t){return e===`webfetch`?{toolKind:`fetch`,title:T(`Fetch`,C(t,`url`))}:{toolKind:`fetch`,title:T(`Web search`,C(t,`query`))}}function ge(e,t){if(e===`skill`){let e=C(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:C(t,`args`,`description`)}}let n=e===`agent`?`Agent`:`Task`,r=C(t,`subagent_type`,`subagentType`),i=C(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${n}: ${i}`:n,subtitle:i===r?void 0:r}}function _e(e,t,n){if(t===`contextcompaction`)return{toolKind:`other`,title:`Compacted context`};if(t===`mcptoolcall`){let e=C(n,`server`),t=C(n,`tool`);return e&&t?{toolKind:`other`,title:`${e}.${t}`}:{toolKind:`other`,title:`MCP tool`,subtitle:w(n)}}if(t.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?S(e):`Tool`,subtitle:w(n)}}function ve(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(fe.get(n)){case`execute`:return{toolKind:`execute`,title:T(`Ran`,ue(t)),subtitle:C(t,`description`)};case`edit`:return pe(n,t);case`read`:return me(n,t);case`search`:return{toolKind:`search`,title:T(`Search`,C(t,`pattern`,`query`)),subtitle:C(t,`path`)};case`fetch`:return he(n,t);case`task`:return ge(n,t);case`plan`:return{toolKind:`plan`,title:`Update plan`};default:return _e(e,n,t)}}function ye(e,t){if(t.type===`ask.requested`&&typeof t.requestId==`string`&&a.safeParse({questions:t.questions}).success)return t;if(t.type===`human-input-delivered`||t.type===`human-ask-closed`){let n=(t.type===`human-input-delivered`?l:ee).safeParse(t);if(n.success&&n.data.askSeq===e?.seq)return}return e}function E(e){if(!(e.type!==`ask.requested`||typeof e.requestId!=`string`))return{requestId:e.requestId,questions:e.questions,...e.context===void 0?{}:{context:e.context}}}function D(e){let t=E(e);return t&&{seq:e.seq,...t}}function O(e,t){let n=ye(e&&{type:`ask.requested`,seq:e.seq,ts:``},t);return n===t?D(t):n===void 0?void 0:e}function k(e){let t;for(let n of e)t=O(t,n);return t}function A(e){let t=Array.isArray(e.questions)?e.questions.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.header==`string`&&(e.options===void 0||Array.isArray(e.options))):[];if(t.length===0)return;let n=typeof e.context==`string`&&e.context!==``?e.context:void 0;return{id:e.requestId,questions:t,...n===void 0?{}:{context:n},askSeq:e.seq}}function j(){return{turns:[],itemsById:new Map,turnSeq:0,permissions:new Map,conversationEntries:new Map,outcomesByRequest:new Map,seenInputs:new Set,previewByPort:new Map,handedOff:!1}}function M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function N(e){return typeof e==`string`?e:void 0}function P(e){let t=typeof e==`string`?new Date(e):void 0;return!t||Number.isNaN(t.getTime())?``:` · ${t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}`}function F(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}var be=new Set(o.options);function xe(e){return typeof e==`string`&&be.has(e)?e:void 0}function I(e,t){e.turnSeq+=1;let n={id:t===void 0?`turn-fallback-${e.turnSeq}`:`turn-seq-${t}`,entries:[],v2Items:!1};return e.turns.push(n),n}function L(e){return e.turns.at(-1)??I(e)}function R(e,t){L(e).entries.push({origin:`meta`,entry:t})}function z(e){for(let t of e.permissions.values())t.status===`pending`&&(t.status=`expired`)}function B(e,t){let n=N(e.stepId);return n===void 0?t:`${n}:${t}`}function Se(e,t){t.v2Items=!0;for(let n of t.entries)n.origin===`v1`&&n.entry.kind===`tool`&&e.itemsById.delete(n.entry.id);t.entries=t.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}function Ce(e,t,n,r,i){let a=n.kind===`message`&&i!==void 0?{...n,ts:i}:{...n};!t.v2Items&&a.kind!==`hook`&&Se(e,t);let o=e.itemsById.get(r);if(o&&o.turn===t){o.entry.entry=a;return}let s={origin:`v2`,entry:a};t.entries.push(s),e.itemsById.set(r,{turn:t,entry:s})}var V={"not-delivered":0,queued:1,delivered:2,consumed:3},we=[`instruction`,`resumed`,`requestId`,`relationship`,`state`,`createdAt`,`requestHash`,`deadline`];function H(e){let t={};for(let n of we)e[n]!==void 0&&Object.assign(t,{[n]:e[n]});return t}function U(e,t){if(t.messageKind!==`request`)return;let n=e.outcomesByRequest.get(t.messageId);n&&(t.outcome={status:n.status,...n.replyId===void 0?{}:{replyId:n.replyId},observedAt:n.observedAt})}function Te(e,t){let n=e.conversationEntries.get(t);n&&U(e,n)}function Ee(e,t,n,r){(V[e.delivery]<V.delivered||V[n]>V[e.delivery])&&(e.delivery=n),t.text!==``&&(e.text=t.text),Object.assign(e,H(t)),r.deliveredAt!==void 0&&(e.deliveredAt=r.deliveredAt),r.consumedAt!==void 0&&(e.consumedAt=r.consumedAt),r.recordedAt!==void 0&&(n===`delivered`||e.delivery!==`delivered`)&&(e.recordedAt=r.recordedAt)}function W(e,t,n,r){let i=e.conversationEntries.get(t.id);if(i){Ee(i,t,n,r),U(e,i);return}let a={kind:`conversation`,id:`conversation-message:${t.id}`,messageId:t.id,text:t.text,senderRunId:t.senderRunId,recipientRunId:t.recipientRunId,messageKind:t.kind,delivery:n,...r,...H(t)};U(e,a),e.conversationEntries.set(t.id,a),R(e,a)}function De(e,t){let n=P(t.ts),r=N(t.message),i=t.notify===!1?`Stopped notifying the webhook${n}`:`${e.handedOff?`Note sent to webhook`:`Handed off to webhook`}${n}${r?` — ${r}`:``}`;e.handedOff=t.notify!==!1,R(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`dim`,icon:`handoff`})}function Oe(e,t){let n=typeof t.attempts==`number`?t.attempts:void 0,r=N(t.webhookName),i=`${r?`Delivery to ${r} failed`:`Webhook delivery failed`}${N(t.event)?` (${N(t.event)})`:``}${n?` after ${n} attempt${n===1?``:`s`}`:``}: ${N(t.error)??`unknown error`}`;R(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`danger`})}function ke(e,t){let n=N(t.webhookName)??`webhook`,r=N(t.title),i=`v1:${t.seq}`;if(t.ok===!1){R(e,{kind:`note`,id:i,text:`Report to ${n} failed: ${N(t.error)??`unknown error`}`,tone:`danger`});return}let a=`${t.dryRun===!0?`Report to ${n} (dry run, nothing sent)`:`Sent report to ${n}`}${P(t.ts)}${r?` — ${r}`:``}`;R(e,t.dryRun===!0?{kind:`note`,id:i,text:a,tone:`dim`}:{kind:`note`,id:i,text:a,tone:`dim`,icon:`handoff`})}function Ae(e,t){let n=t.payload??{},r=`Webhook (dry run, nothing sent): ${N(t.event)??`delivery`}${N(n.status)?` · ${N(n.status)}`:``}`;R(e,{kind:`note`,id:`v1:${t.seq}`,text:r,tone:`dim`})}function je(e,t){let n=i.safeParse(t.server);if(!n.success)return;let r=e.previewByPort.get(n.data.port);r&&(r.turn.entries=r.turn.entries.filter(e=>e!==r.draft));let a=L(e),o={origin:`meta`,entry:{kind:`preview-server`,id:`preview-server:${n.data.port}`,server:n.data,state:`registered`,stateAt:t.ts}};a.entries.push(o),e.previewByPort.set(n.data.port,{turn:a,draft:o})}function Me(e,t){let n=r.safeParse(t.state),i=typeof t.port==`number`?e.previewByPort.get(t.port):void 0;if(!n.success||!i||i.draft.entry.kind!==`preview-server`)return;let{server:a,id:o}=i.draft.entry;i.draft.entry={kind:`preview-server`,id:o,server:a,state:n.data,stateAt:t.ts,...typeof t.exitCode==`number`?{exitCode:t.exitCode}:{},...t.reason===`user`||t.reason===`idle`?{reason:t.reason}:{}}}function Ne(e,t){let n=u.safeParse(t);if(!n.success)return;let{message:r,delivery:i,deliveredAt:a,consumedAt:o,ts:s}=n.data;W(e,r,i,{deliveredAt:a,consumedAt:o,recordedAt:s})}function Pe(e,t){let n=s.safeParse(t);if(!n.success)return;let{outcome:r}=n.data,i=e.outcomesByRequest.get(r.requestId);i&&!(i.status===`timed-out`&&r.status===`replied-late`)||(e.outcomesByRequest.set(r.requestId,r),Te(e,r.requestId))}function Fe(e,t){let n=c.safeParse(t);if(!n.success)return;let{input:r}=n.data;if(!e.seenInputs.has(r.id)){if(e.seenInputs.add(r.id),r.conversation){W(e,{id:r.id,text:r.text,createdAt:r.createdAt,...r.conversation},`delivered`,{deliveredAt:r.deliveredAt,recordedAt:n.data.ts});return}R(e,{kind:`note`,id:`agent-input:${r.id}`,text:r.text,tone:`dim`,attribution:{source:r.source,parentRunId:r.parentRunId}})}}function Ie(e,t){let n=N(t.text)??``,r=e.pendingAsk;e.pendingAsk&&!e.pendingAsk.resolved&&(e.pendingAsk.resolved=!0,e.pendingAsk.answeredBy=`human`,n!==``&&(e.pendingAsk.answer=n),e.pendingAsk=void 0);let i=I(e,t.seq),a=F(t.ts);i.userMessage={text:n,ask:r,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[],...a===void 0?{}:{ts:a}},a!==void 0&&(i.startedAt=a)}function Le(e,t){let n=e.turns.at(-1),r=n&&n.turnId===void 0&&!n.v2Items?n:I(e,t.seq);r.turnId=N(t.turnId),r.startedAt??=F(t.ts)}function Re(e,t){for(let n=e.turns.length-1;n>=0;--n)if(e.turns[n].turnId===t)return e.turns[n];return e.turns.at(-1)}function ze(e,t){z(e);let n=Re(e,N(t.turnId));if(!n)return;let r=F(t.ts);n.completed={stopReason:N(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...r===void 0?{}:{ts:r}}}var G=new Set([`message`,`reasoning`,`tool`,`hook`]),Be=e=>G.has(e.kind);function Ve(e){if(!(!M(e)||!G.has(e.kind)))return typeof e.id==`string`&&e.id!==``?e:void 0}function K(e,t){let n=Ve(t.item);if(!n)return;let r=B(t,n.id);Ce(e,e.itemsById.get(r)?.turn??L(e),n,r,t.type===`item.completed`?F(t.ts):void 0)}function He(e,t){let n=e.itemsById.get(B(t,N(t.itemId)??``)),r=N(t.delta)??``;if(!n||r===``||!Be(n.entry.entry))return;let i=n.entry.entry;t.field===`output`&&i.kind===`tool`?i.output=(i.output??``)+r:t.field!==`output`&&(i.kind===`message`||i.kind===`reasoning`)&&(i.text+=r)}function Ue(e,t){let n=L(e),r=N(t.text)??``;if(r===``)return;let i=F(t.ts);n.entries.push({origin:`v1`,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:r,...i===void 0?{}:{ts:i}}})}var We=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function Ge(e){if(!M(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!M(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:We.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}var Ke=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function qe(e,t){let n=L(e),r=N(t.tool)??`Tool`;if(n.v2Items||Ke.has(r))return;let i=ve(r,t.input),a=i.toolKind===`plan`?Ge(t.input):void 0;a!==void 0&&(n.planEntries=a);let o={kind:`tool`,id:N(t.id)??`v1:${t.seq}`,name:r,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},s={origin:`v1`,entry:o};n.entries.push(s),e.itemsById.set(o.id,{turn:n,entry:s})}function Je(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}function Ye(e,t){let n=e.itemsById.get(N(t.toolCallId)??``);if(!n||n.turn.v2Items||n.entry.origin!==`v1`)return;let r=n.entry.entry;r.kind===`tool`&&(r.status=`completed`,r.output=Je(t.result))}function q(e,t,n,r){let i=N(t.message)??``;i!==``&&R(e,{kind:`note`,id:n,text:i,tone:r})}function J(e,t){q(e,t,`v1:${t.seq}`,t.tone===`danger`?`danger`:`dim`)}function Xe(e,t){q(e,t,`v1:${t.seq}`,`danger`)}function Ze(e,t){q(e,t,`v2:${t.seq}`,`danger`)}function Qe(e,t){if(t.status!==`failed`)return;let n=N(t.error)?` — ${N(t.error)}`:``;R(e,{kind:`note`,id:`v1:${t.seq}`,text:`step ${N(t.stepId)??`?`} failed${n}`,tone:`danger`})}function $e(e,t){let n=N(t.command)??`check`,r=typeof t.exitCode==`number`?t.exitCode:-1;R(e,{kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${n}`,status:r===0?`completed`:`failed`,output:N(t.text)??``,exitCode:r})}function et(e,t){let n=xe(t.provider),r=N(t.authFailureId)??``;n===void 0||r.length<1||r.length>128||R(e,{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:n,authFailureId:r})}function tt(e,t){let n=N(t.url);if(n===void 0)return;let r={kind:`image`,id:`v1:${t.seq}`,url:n},i=N(t.name);i!==void 0&&(r.name=i),R(e,r)}function nt(e,t){Array.isArray(t.entries)&&(L(e).planEntries=t.entries)}function rt(e,t){z(e);let n=N(t.message);e.sessionEnded={reason:N(t.reason)??`end_turn`,...n===void 0?{}:{message:n}}}var it=new Set([`allow_once`,`allow_always`,`reject_once`,`reject_always`]);function at(e){return M(e)&&typeof e.id==`string`&&e.id!==``&&typeof e.label==`string`&&e.label!==``&&it.has(e.kind)}function ot(e){if(!(!Array.isArray(e)||e.length===0||!e.every(at)))return new Set(e.map(e=>e.id)).size===e.length?e:void 0}function st(e,t){let n=N(t.requestId),r=N(t.title),i=ot(t.options);if(!n||!r||e.permissions.has(n)||!i)return;let a=N(t.itemId),o=N(t.details),s={kind:`permission`,id:`permission:${n}`,requestId:n,title:r,options:i.map(e=>({...e})),status:`pending`,...a===void 0?{}:{itemId:a},...o===void 0?{}:{details:o}};e.permissions.set(n,s),R(e,s)}function ct(e,t){let n=e.permissions.get(N(t.requestId)??``);if(!n||n.status!==`pending`)return;let r=N(t.optionId);r!==void 0&&n.options.some(e=>e.id===r)?(n.status=`resolved`,n.optionId=r):n.status=`expired`;let i=N(t.reason);i!==void 0&&(n.reason=i)}function lt(e,t){let n=D(t),r=n&&A(n);if(!r)return;let i={kind:`ask`,...r,questions:r.questions,resolved:!1};R(e,i),e.pendingAsk=i}function Y(e,t){let n=e.pendingAsk;return n&&!n.resolved&&n.askSeq===t.askSeq?n:void 0}function ut(e,t){let n=Y(e,t);if(!n)return;n.routedToParent=!0;let r=N(t.parentRunId);r!==void 0&&(n.parentRunId=r)}function dt(e,t){let n=Y(e,t);n&&(n.routedToParent=!1)}function ft(e,t){let n=Y(e,t);n&&X(e,n,`undeliverable`)}var pt=new Set([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`]);function mt(e,t){let n=Y(e,t);n&&pt.has(t.reason)&&X(e,n,t.reason)}function X(e,t,n){t.resolved=!0,t.closed=n,e.pendingAsk=void 0}function Z(e,t){let n=Y(e,t);if(n){if(t.source===`cezar`){X(e,n,`undeliverable`);return}t.source===`parent`&&(n.resolved=!0,n.answeredBy=`parent`,e.pendingAsk=void 0)}}var Q=()=>{},ht=new Map([[`handoff`,De],[`webhook.failed`,Oe],[`webhook.dry-run`,Ae],[`webhook.report`,ke],[`preview.server-registered`,je],[`preview.server-state`,Me],[`conversation-message`,Ne],[`request-outcome`,Pe],[`agent-input`,Fe],[`user-message`,Ie],[`turn.started`,Le],[`turn.completed`,ze],[`item.started`,K],[`item.updated`,K],[`item.completed`,K],[`item.delta`,He],[`text`,Ue],[`tool-call`,qe],[`tool-result`,Ye],[`note`,J],[`lifecycle`,J],[`error`,Xe],[`session.error`,Ze],[`step-end`,Qe],[`check-output`,$e],[`provider-auth-required`,et],[`image`,tt],[`plan.updated`,nt],[`session.started`,e=>z(e)],[`session.ended`,rt],[`permission.requested`,st],[`permission.resolved`,ct],[`ask.requested`,lt],[`worker-question-routed`,ut],[`worker-question-fallback`,dt],[`worker-question-undelivered`,ft],[`human-ask-closed`,mt],[`human-input-delivered`,Z],[`step-start`,Q],[`token-usage`,Q],[`cost`,Q],[`turn-end`,Q],[`done`,Q],[`session`,Q]]);function gt(e,t){ht.get(t.type)?.(e,t)}function _t(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function vt(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function yt(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function $(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);if(t){let e=n.trimEnd(),t=e.lastIndexOf(`
|
|
2
|
+
`)+1;/^CEZ:ASK[ \t]+.+$/.test(e.slice(t))&&(n=e.slice(0,t).trimEnd())}return n.includes(`CEZ:`)?n.split(`
|
|
3
|
+
`).filter(e=>!/^CEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
|
|
4
|
+
`):n}function bt(e){let t=e=>$(e,!0).replace(/\s+/g,``),n=new Set,r=[];for(let{origin:i,entry:a}of e.entries)if(i===`v2`&&a.kind===`message`){let e=t(a.text);n.add(e),r.push(e)}if(r.length===0)return;n.add(r.join(``));let i=[],a={entries:[],texts:[]},o=()=>{if(a.entries.length>=2&&n.has(t(a.texts.join(``)))){a={entries:[],texts:[]};return}i.push(...a.entries),a={entries:[],texts:[]}};for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`message`?(a.entries.push(t),a.texts.push(t.entry.text)):(o(),i.push(t));o(),e.entries=i}function xt(e){let t=new Set;for(let{origin:n,entry:r}of e.entries)n===`v2`&&r.kind===`message`&&t.add($(r.text,!0).trim());t.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&t.has($(e.entry.text,!0).trim()))),bt(e))}function St(e){for(let t of e.conversationEntries.values())t.messageKind!==`request`||t.outcome!==void 0||t.delivery!==`not-delivered`&&(t.state!==void 0&&t.state!==`accepted`||(t.outcome={status:`pending`}))}function Ct(e,t){let n=t||e.entries.some(({entry:e})=>e.kind===`ask`);return{id:e.id,...e.turnId===void 0?{}:{turnId:e.turnId},...e.userMessage===void 0?{}:{userMessage:e.userMessage},...e.startedAt===void 0?{}:{startedAt:e.startedAt},...e.planEntries===void 0?{}:{planEntries:e.planEntries},...e.completed===void 0?{}:{completed:e.completed},items:e.entries.map(({entry:e})=>e.kind===`message`&&e.role===`assistant`?{...e,text:$(e.text,n)}:e)}}function wt(e,t={}){let n=j();for(let t of e)gt(n,t);for(let e of n.turns)e.v2Items&&xt(e);St(n);let r=n.turns.length-1;return{turns:n.turns.map((e,n)=>Ct(e,t.activeTurn===!0&&n===r)),...n.sessionEnded===void 0?{}:{sessionEnded:n.sessionEnded}}}export{k as a,m as c,yt as i,wt as n,ce as o,vt as r,h as s,_t as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{Bt as o,C as s,Kr as c,Sr as l,nt as u,r as d,rt as f,tn as p}from"./project-scope-context-wlB-Y0ii.js";import{M as m,O as h,P as g,Pt as _,Rt as v,Tt as y,Un as b,et as x,h as S,jt as C,n as w,rt as T}from"./queries-BPdWfTBN.js";import{t as E}from"./useQuery-BHmKi9_o.js";import{n as D}from"./toaster-CRVRHlMR.js";import{A as O,Z as k,_ as A,b as j,ct as ee,d as te,ft as M,h as N,l as P,mt as ne,ot as F,r as I,rt as re,u as L,ut as ie}from"./design-icons-DmYTv2r1.js";import{i as ae,r as oe,s as R,t as se}from"./popover-N-u5z2xh.js";import{t as ce}from"./eye-B8okNWXU.js";import{a as le,i as z}from"./format-BNCkW110.js";import{t as ue}from"./message-square-B-MD-8rD.js";import{t as de}from"./play-CmVAj_fu.js";import{a as fe,i as pe,o as me,r as he,s as ge,t as _e}from"./dialog-Dw7fMdDQ.js";import{u as B,v as ve,y as V}from"./github-sidebar-model-BSNdxNKJ.js";import{t as H}from"./project-router-Dd63wBeA.js";import{A as ye,B as be,E as xe,H as Se,I as Ce,L as we,M as Te,O as Ee,V as De,_ as Oe,a as ke,b as Ae,f as je,g as Me,i as Ne,j as Pe,k as U,m as Fe,n as Ie,p as Le,r as W,s as Re,t as ze,v as Be,w as Ve,z as He}from"./agent-accounts-CuRvwNoA.js";import{d as Ue,f as We,i as Ge,s as Ke,t as qe,u as Je}from"./skills-DFBiAuJG.js";import{Ft as Ye,G as Xe,Pt as Ze,gn as Qe,gt as $e,vt as et}from"./index-lMBPAedr.js";import{t as tt}from"./diff-ImdJ4tPA.js";import{t as nt}from"./tab-link-CDrve3Rf.js";var G=e(i(),1),K=a(),rt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function q({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,K.jsx)(P,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:r(t,`text-success`)}):e===`failing`?(0,K.jsx)(A,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:r(t,`text-danger`)}):e===`pending`?(0,K.jsx)(le,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:r(t,`animate-spin text-warning`)}):(0,K.jsx)(N,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:r(t,`text-soft-foreground`)})}function it(e){return e?.available?e.mergeState:null}function at(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function ot(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function st(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function ct(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function lt(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function ut(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function dt(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function ft(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function J(e){return e?rt[e]:`Merge`}function pt(e){return e===`conflicting`?`true`:void 0}function mt({check:e}){return(0,K.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(q,{state:e.state}),(0,K.jsxs)(`span`,{children:[e.name,` · `,e.state,ut(e.required)]})]}),e.url&&t(e.url)?(0,K.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function ht({reason:e}){return(0,K.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,K.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function gt({state:e,selectedMethod:t,overrideRules:i,mergeEnabled:a,refreshPending:o,onRefresh:s,onRunAgent:c,onConfirm:l,onMethodChange:u,onOverrideChange:d}){let f=ot(e),p=st(e.reviewDecision),m=ct(e.mergeable);return(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,K.jsx)(P,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,K.jsx)(ee,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(`h3`,{className:`font-semibold`,children:f}),(0,K.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:s,children:[(0,K.jsx)(k,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,o&&`animate-spin`)}),`Refresh`]})]}),(0,K.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,K.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,K.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(q,{state:p}),(0,K.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,K.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(q,{state:m}),(0,K.jsxs)(`span`,{children:[`Conflicts: `,lt(e.mergeable)]})]}),e.checks.length===0?(0,K.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,K.jsx)(mt,{check:e},e.name)),e.blockers.map(e=>(0,K.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&c?(0,K.jsx)(n,{className:`mt-4`,onClick:c,children:`Run agent on this PR`}):null,e.canOverride?(0,K.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,K.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,K.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,K.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>u(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:e.methods.map(e=>(0,K.jsx)(`option`,{value:e,children:rt[e]},e))}),(0,K.jsx)(n,{disabled:!a,onClick:l,children:J(t)})]}):null]})]})}function _t({number:e,state:t,selectedMethod:r,confirming:i,overrideRules:a,mergePending:o,mergeError:s,onOpenChange:c,onMerge:l}){return(0,K.jsx)(_e,{open:i,onOpenChange:c,children:(0,K.jsxs)(he,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,K.jsxs)(me,{children:[(0,K.jsxs)(ge,{children:[J(r),` pull request #`,e,`?`]}),(0,K.jsx)(pe,{asChild:!0,children:(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),a&&t.canOverride?(0,K.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),s?(0,K.jsx)(`p`,{className:`text-sm text-danger`,children:s.message}):null,(0,K.jsxs)(fe,{children:[(0,K.jsx)(n,{variant:`outline`,disabled:o,onClick:()=>c(!1),children:`Cancel`}),(0,K.jsx)(n,{disabled:o,onClick:l,children:o?`Merging…`:J(r)})]})]})})}function vt({number:e,onRunAgent:t}){let n=c(),r=T(),i=E({queryKey:w.githubMergeState(e),queryFn:({signal:t})=>f(e,{},{signal:t}),retry:!1}),a=it(i.data),[s,l]=(0,G.useState)(null),[u,d]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),h=b({mutationFn:t=>f(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>D(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=at(s,a),_=()=>({mergeState:w.githubMergeState(e),list:w.githubPages(50),comments:w.githubComments(`pr`,e),item:w.githubItem(`pr`,e),refStatus:r===void 0?void 0:w.githubRefStatusOf(r)}),v=b({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return o(e,{method:g,expectedHeadSha:a.headSha,...p&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{d(!1),D(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{D(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,K.jsx)(V,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,K.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":pt(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,K.jsx)(gt,{state:a,selectedMethod:g,overrideRules:p,mergeEnabled:ft(g,a,p),refreshPending:h.isPending,onRefresh:()=>h.mutate(w.githubMergeState(e)),onRunAgent:t,onConfirm:()=>d(!0),onMethodChange:l,onOverrideChange:m}),(0,K.jsx)(_t,{number:e,state:a,selectedMethod:g,confirming:u,overrideRules:p,mergePending:v.isPending,mergeError:v.error,onOpenChange:d,onMerge:()=>v.mutate(_())})]}):(0,K.jsx)(ht,{reason:dt(i.data)})}function yt(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 bt(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))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function xt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function Y(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))`}}function St({label:e,color:t,plain:n=!1}){return(0,K.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:Y(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function Ct(e){return e===`pr`?`pull request`:`issue`}function wt(e,t,n){return e===`pr`&&!!(t||n)}function Tt({backLink:e}){return e?(0,K.jsxs)(H,{to:e.to,"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,K.jsx)(I,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Et({item:e,kindWord:n,commentCount:r,hasDiffStat:i,additions:a,deletions:o}){return(0,K.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,K.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,K.jsx)(`span`,{children:n}),`·`,(0,K.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,K.jsxs)(`span`,{children:[z(e.createdAt),` ago`]}),r?(0,K.jsxs)(K.Fragment,{children:[`·`,(0,K.jsx)(qt,{count:r})]}):null,i?(0,K.jsxs)(K.Fragment,{children:[`·`,(0,K.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,K.jsxs)(`span`,{className:`text-success`,children:[`+`,a??0]}),` `,(0,K.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,t(e.url)?(0,K.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,K.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,K.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function Dt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,K.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,K.jsx)(nt,{to:B(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,K.jsx)(nt,{to:B(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,K.jsx)(H,{to:B(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function Ot({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,K.jsx)(St,{label:e,color:t[e]},e)),n?(0,K.jsx)(Jt,{checks:n,url:e.url}):null]}):null}function kt({item:e,colors:t,body:n}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,K.jsx)(et,{children:n}):(0,K.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,K.jsx)(Mt,{item:e,colors:t})]})}function At({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=Ct(e.kind),d=h(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,m=d?.deletions??e.deletions,g=wt(e.kind,p,m),_=r??e.comments;return(0,K.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,K.jsx)(Tt,{backLink:i}),(0,K.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,K.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,K.jsx)(Et,{item:e,kindWord:u,commentCount:_,hasDiffStat:g,additions:p,deletions:m}),e.kind===`pr`?null:(0,K.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,K.jsx)(Dt,{item:e,subNav:a,changes:l}),(0,K.jsx)(Ot,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,K.jsx)(jt,{item:e}):(0,K.jsx)(kt,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,K.jsx)(vt,{number:e.number,onRunAgent:o}):null,c]})}function jt({item:e}){let i=c(),a=m(e.number),[o,s]=(0,G.useState)(``),[l,d]=(0,G.useState)(null),f=a.data,p=f?.available?f.files.filter(e=>e.path.toLowerCase().includes(o.toLowerCase())):[],h=p.findIndex(e=>e.path===l);(0,G.useEffect)(()=>{p.length>0&&!p.some(e=>e.path===l)&&d(p[0].path)},[f?.available?f.headSha:``,o]);let g=async()=>{let t=f?.available?f.headSha:null,n=w.githubPrChanges(e.number),r=await u(e.number,{refresh:!0});i.setQueryData(n,r),r.available&&t&&t!==r.headSha&&(d(r.files[0]?.path??null),D(`The reviewed revision changed.`))};if(a.isPending)return(0,K.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(a.isError||!f)return(0,K.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!f.available)return(0,K.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:f.reason});let _=p.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),v=t(e.url)?`${e.url}/files`:null,y=p.find(e=>e.path===l);return(0,K.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,K.jsxs)(`strong`,{children:[f.files.length,` changed files`]}),(0,K.jsxs)(`span`,{className:`text-success`,children:[`+`,f.additions]}),(0,K.jsxs)(`span`,{className:`text-danger`,children:[`−`,f.deletions]}),(0,K.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:f.headSha,children:[`head `,f.headSha.slice(0,8)]}),(0,K.jsx)(n,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void g(),children:`Refresh`})]}),f.truncated?(0,K.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[f.reason??`This response is incomplete.`,` `,v?(0,K.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,K.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,K.jsxs)(`aside`,{className:`min-w-0`,children:[(0,K.jsx)(`input`,{"aria-label":`Filter changed files`,value:o,onChange:e=>s(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,K.jsx)(`select`,{"aria-label":`Select changed file`,value:l??``,onChange:e=>d(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:p.map(e=>(0,K.jsx)(`option`,{children:e.path},e.path))}),(0,K.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>d(e.path),className:r(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,l===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,K.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,K.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,K.jsx)(n,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:h<=0,onClick:()=>d(p[h-1]?.path??null),children:(0,K.jsx)(Qe,{})}),(0,K.jsx)(n,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:h<0||h>=p.length-1,onClick:()=>d(p[h+1]?.path??null),children:(0,K.jsx)(te,{size:16})})]}),p.length===0?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(tt,{files:_.filter(e=>e.path===l),wrap:!0,className:`min-w-0`}),y&&!y.patch?(0,K.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,y.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Mt({item:e,colors:t}){let n=h(e.kind,e.number),r=n.data,i=(0,G.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(Nt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,K.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,K.jsx)(V,{className:`mb-3 h-3 w-24`}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsx)(V,{className:`h-14 w-full`}),(0,K.jsx)(V,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,K.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,K.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,K.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,K.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,K.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,K.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,K.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Pt(i).map(e=>e.group===`commits`?(0,K.jsx)(Ft,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,K.jsx)(Gt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,K.jsx)(It,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,K.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,K.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Nt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Pt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Ft({commits:e,colors:t}){let[n,r]=(0,G.useState)(!1),i=e[0]?.actor??`?`;return n?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,children:X.committed}),(0,K.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,K.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,K.jsx)(It,{event:e,colors:t},e.id))]}):(0,K.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,children:X.committed}),(0,K.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,K.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,K.jsx)(`span`,{className:`shrink-0`,children:z(e[e.length-1].createdAt)})]})})}var X={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function It({event:e,colors:t}){return(0,K.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:r(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:X[e.kind]}),(0,K.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,K.jsx)(Ht,{event:e,colors:t}),(0,K.jsx)(`span`,{className:`shrink-0`,children:z(e.createdAt)}),e.url?(0,K.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,K.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Lt({event:e}){return(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,K.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,K.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,K.jsx)(Ut,{checks:e.checks})]})}function Rt({event:e,colors:t}){return(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,K.jsx)(`span`,{"data-slot":`gh-event-label`,style:Y(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,K.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function zt({event:e}){return(0,K.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Bt({event:e}){return(0,K.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Vt={committed:e=>(0,K.jsx)(Lt,{event:e}),labeled:(e,t)=>(0,K.jsx)(Rt,{event:e,colors:t}),unlabeled:(e,t)=>(0,K.jsx)(Rt,{event:e,colors:t}),assigned:e=>(0,K.jsx)(zt,{event:e}),unassigned:e=>(0,K.jsx)(zt,{event:e}),merged:()=>(0,K.jsx)(`span`,{children:`merged this`}),closed:()=>(0,K.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,K.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,K.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,K.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,K.jsx)(Bt,{event:e})};function Ht({event:e,colors:t}){return Vt[e.kind]?.(e,t)??null}function Ut({checks:e}){return e?(0,K.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:r(`shrink-0`,Q[e]),children:Z[e]}):null}var Wt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Gt({comment:e}){let t=e.reviewState?Wt[e.reviewState]:null;return(0,K.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,K.jsx)(Kt,{url:e.avatarUrl,login:e.author}),(0,K.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,K.jsx)(`span`,{children:z(e.createdAt)}),t?(0,K.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:r(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,K.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,K.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,K.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,K.jsx)(et,{children:e.body}):(0,K.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Kt({url:e,login:t}){let[n,r]=(0,G.useState)(!1);return e&&!n?(0,K.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,K.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Z={passing:`✓`,failing:`✗`,pending:`○`},Q={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function qt({count:e}){return e?(0,K.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,K.jsx)(ue,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Jt({checks:e,url:t}){let n=r(`text-[11px] font-medium`,Q[e],t&&`hover:underline`),i=`${Z[e]} checks ${e}`;return t?(0,K.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:i}):(0,K.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:i})}function Yt({checks:e}){return(0,K.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:r(`shrink-0 font-sans text-[11px] font-semibold`,Q[e]),children:Z[e]})}function $(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Xt(e,t=[]){let n=$(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Zt(t)),n}function Zt(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Qt(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function $t(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function en(e,t,n){let r=(n??``).trim();if(!r)return Xt(e,t);let i=$(e),a=r.startsWith(i)?i+Qt(r.slice(i.length),e):Qt(r,e),o=$t(a,e)?a:`${i}\n\n${a}`;return t.length?o+Zt(t):o}function tn(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 nn(e,t,n,r,i={}){return t?{...i,workflow:t,task:en(e,n,r)}:n.length?{...i,steps:tn(n),task:en(e,[],r)}:{...i,workflow:`quick-task`,task:en(e,[],r)}}function rn(e){let t=x(),n=S(),r=l(t.data),i=n.data?.defaultRunner,a=Be(e.runner,r,i??r[0]??`claude`),o=y(a),s=n.data?.modelsLocked===!0,{accounts:c,repoAccount:u}=Ie(),d=c.some(t=>t.provider===a&&t.id===e.account)?e.account:null,f=Oe(s?null:e.model,a,n.data?.defaultModels,o.data),p=je(a,f,o.data);return{runner:a,runnerExplicit:e.runner!==null,model:f,effort:s?``:Me(e.effort,p),effortOptions:p,runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:c,account:d,repoAccount:u}}function an(e){return{runner:Ae(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function on(e){return{...an(e),...e.account?{agentProfile:e.account}:{}}}function sn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,G.useRef)(null),o=(0,G.useRef)(null),[s,c]=(0,G.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,G.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,G.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let l=rn(e),{runner:u,model:d,effort:f,effortOptions:p,runners:m,canRun:h,modelsLocked:g}=l,_=S(),v=y(u),b=Fe(u,v.data,[e.model,_.data?.defaultModels?.[u]]),x=n||!h,C=r?l.accounts:[],w=m.length>1||m.some(e=>ze(C,e))?(0,K.jsx)(ke,{icon:(0,K.jsx)(F,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:m,value:u,accounts:C,account:r?l.account:null,repoAccount:r?l.repoAccount:void 0,disabled:x,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===u?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,T=(0,K.jsx)(W,{icon:(0,K.jsx)(j,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:d===``?`Default`:b.find(e=>e.id===d).label,value:d,disabled:x,readOnly:g===!0,disabledHint:g?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=je(u,n,v.data);t({...e,model:n,effort:e.effort===null?null:Me(e.effort,r)})},options:b.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Le(u,v.data,v.isError,v.isFetching)},`model`),E=(0,K.jsx)(W,{icon:(0,K.jsx)(O,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:p.find(e=>e.value===f)?.label??`auto`,value:f,disabled:x,readOnly:g===!0,disabledHint:g?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:p.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,K.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,K.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,K.jsx)(Ne,{children:s?[w,E,T]:[w,T,E]})})}):(0,K.jsxs)(Ne,{children:[w,T,E]})}var cn={workflow:null,skills:[]},ln=`cez-followup-selection`;function un(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function dn(){try{let e=localStorage.getItem(ln);return e?un(JSON.parse(e)):{...cn}}catch{return{...cn}}}function fn(e){try{localStorage.setItem(ln,JSON.stringify(e))}catch{}}var pn=`cez-followup-prompt:`;function mn(e){try{return localStorage.getItem(pn+e)??``}catch{return``}}function hn(e,t){try{t===``?localStorage.removeItem(pn+e):localStorage.setItem(pn+e,t)}catch{}}function gn({item:e,workflows:r,skills:i,workflow:a,onWorkflowChange:o,selectedSkills:l,onSkillsChange:u,engine:d,onEngineChange:f,queuedRunId:m,onQueued:h}){let v=c(),y=_(),x=g().data?.capabilities.automations===!0,S=e.kind===`pr`?`PR`:`issue`,C=l.filter(e=>i.some(t=>t.name===e)),[T]=(0,G.useState)(()=>$(e)),[E,O]=(0,G.useState)(()=>mn(e.url)||T),k=rn(d),A=(0,G.useRef)(null),j=(0,G.useRef)(null);(0,G.useEffect)(()=>{hn(e.url,E===T?``:E)},[e.url,E,T]);let ee=(0,G.useMemo)(()=>Se(He(y.data?.promptTemplates),{automations:x}),[y.data?.promptTemplates,x]),te=e=>{let t=A.current,n=De({prompt:E,base:T,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:j.current}),r=we(E,n,e);O(r.text),j.current=r.caret,requestAnimationFrame(()=>{A.current?.focus(),A.current?.setSelectionRange(r.caret,r.caret)})},M=Ce(ee,C),N=(0,G.useRef)(E);N.current=E;let F=(0,G.useRef)(``);(0,G.useEffect)(()=>{let e=be(N.current,F.current,M,T);F.current=e.applied,e.text!==N.current&&O(e.text)},[M,T]);let I=b({mutationFn:async()=>k.canRun?s(nn(e,a,C,E,on(k))):null,onSuccess:t=>{if(t===null)return;let n=t;n&&h(e.url,n.id),D(`Added to the queue — ${S} #${e.number}`),C.length>0&&y.data!==void 0&&p({skillUsage:C.reduce((e,t)=>qe(e,t),y.data.skillUsage)}).then(()=>v.invalidateQueries({queryKey:w.uiState})).catch(()=>{}),hn(e.url,``),O(T),F.current=``,v.invalidateQueries({queryKey:w.runs.all})},onError:e=>D(e.message,{tone:`danger`})}),re=e=>{Ze({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!I.isPending&&k.canRun&&I.mutate())},L=e=>u(l.includes(e)?l.filter(t=>t!==e):[...l,e]);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,K.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,K.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,K.jsx)(`span`,{children:`Instructions for the agent`}),(0,K.jsx)(Xe,{ref:A,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:E,onChange:e=>O(e.target.value),onSelect:e=>{j.current=e.currentTarget.selectionStart},onKeyDown:re,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,K.jsx)(ve,{templates:ee,onInsert:te}),(0,K.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,K.jsxs)(`div`,{className:`gh-field`,children:[(0,K.jsx)(`span`,{children:`Workflow`}),(0,K.jsx)(_n,{workflows:r,value:a,onChange:o})]}),(0,K.jsxs)(`div`,{className:`gh-field`,children:[(0,K.jsx)(`span`,{children:`Skills · select one or more`}),(0,K.jsx)(yn,{skills:i,skillUsage:y.data?.skillUsage,selected:C,onToggle:L})]}),C.length>0?(0,K.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:C.map(e=>(0,K.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>L(e),title:`Remove this skill`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,K.jsx)(ne,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,K.jsx)(sn,{layout:`row`,pick:d,onChange:f,disabled:I.isPending||!k.canRun,accounts:!0}),(0,K.jsxs)(`div`,{className:`gh-field`,children:[(0,K.jsx)(`span`,{children:`Account`}),(0,K.jsx)(vn,{resolved:k,disabled:I.isPending||!k.canRun,onPick:e=>f({...d,account:e})})]}),!k.providerPending&&!k.canRun?(0,K.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[k.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,K.jsx)(H,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,K.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,K.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[t(e.url)?(0,K.jsx)(n,{asChild:!0,variant:`outline`,children:(0,K.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,K.jsxs)(n,{variant:`primary`,"data-action":`gh-run`,disabled:I.isPending||!k.canRun,onClick:()=>I.mutate(),children:[(0,K.jsx)(de,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,S]}),(0,K.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground`,children:Ye()}),m?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,K.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,K.jsx)(H,{to:`/tasks/${m}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function _n({workflows:e,value:t,onChange:n}){let[i,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(``),c=(0,G.useRef)(null),l=Ue(e,o);return(0,K.jsxs)(se,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,K.jsx)(ae,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(Re,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,K.jsx)(M,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,K.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,K.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,K.jsx)(oe,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,K.jsxs)(xe,{shouldFilter:!1,children:[(0,K.jsx)(ye,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,K.jsxs)(Te,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,K.jsx)(Ee,{children:`Nothing matches.`}):null,(0,K.jsx)(U,{children:l.map(e=>{let r=t===e.name;return(0,K.jsxs)(Pe,{value:`workflow ${e.name}`,keywords:We(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,K.jsx)(P,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function vn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:Ve,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,K.jsx)(W,{icon:(0,K.jsx)(ie,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function yn({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(null),d=(0,G.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=Je(e,s,t),g=(e,t)=>{let a=n.includes(e.name);return(0,K.jsxs)(Pe,{value:`skill ${e.name} ${e.path}`,keywords:We(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":a?`true`:void 0,onSelect:()=>i(e.name),children:[(0,K.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,K.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,K.jsx)(ce,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,K.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return e.length===0?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)($e,{skill:l,onClose:()=>u(null)}),(0,K.jsxs)(se,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,K.jsx)(ae,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:r(Re,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,K.jsx)(re,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,K.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,K.jsx)(oe,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,K.jsxs)(xe,{shouldFilter:!1,children:[(0,K.jsx)(ye,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,K.jsxs)(Te,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,K.jsx)(Ee,{children:`Nothing matches.`}):null,h?h.length>0?(0,K.jsx)(U,{children:h.map(e=>g(e,Ge(e)))}):null:(0,K.jsxs)(K.Fragment,{children:[f.length>0?(0,K.jsx)(U,{heading:`Most used`,children:f.map(e=>g(e,Ge(e)))}):null,p.length>0?(0,K.jsx)(U,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,K.jsx)(U,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var bn=new WeakMap;function xn(){let e=dn(),t={workflow:e.workflow,selectedSkills:e.skills,engine:{runner:null,model:null,effort:null,account:null},queued:new Map},n=new Set;return{snapshot:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),update:e=>{t={...t,...e},(e.workflow!==void 0||e.selectedSkills!==void 0)&&fn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function Sn(){let e=c(),{projectId:t}=d(),n=bn.get(e);n||bn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=xn());let{snapshot:i,subscribe:a,update:o}=r,s=(0,G.useSyncExternalStore)(a,i,i),l=v(),u=C(),f=_(),p=l.data?.workflows;(0,G.useEffect)(()=>{p&&s.workflow!==null&&!p.some(e=>e.name===s.workflow)&&o({workflow:null})},[o,p,s.workflow]);let m=(0,G.useMemo)(()=>Ke(u.data??[],f.data?.skillUsage),[u.data,f.data?.skillUsage]);return{...s,workflows:l,skillList:m,setWorkflow:e=>o({workflow:e}),setSelectedSkills:e=>o({selectedSkills:e}),setEngine:e=>o({engine:e}),onQueued:(e,t)=>o({queued:new Map(i().queued).set(e,t)})}}export{qt as a,Pt as c,Y as d,xt as f,Yt as i,yt as l,gn as n,At as o,Xt as r,St as s,Sn as t,bt as u};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,t as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{A as o,Kr as s,T as c,Xt as l,i as u,qt as d}from"./project-scope-context-wlB-Y0ii.js";import{Pt as f,Rt as ee,Un as p,jt as te,n as ne}from"./queries-BPdWfTBN.js";import{n as m}from"./toaster-CRVRHlMR.js";import{C as h,Q as g,S as re,X as _,a as ie,ct as ae,dt as v,l as oe,lt as y,mt as b,n as x,rt as se,st as S,u as ce,x as C,y as w}from"./design-icons-DmYTv2r1.js";import{i as T,p as le,r as E,t as D}from"./dropdown-menu-D7f0O7xR.js";import{a as O,c as k,i as A,n as j,o as M,r as ue,s as N,t as P}from"./alert-dialog-h-3h9B4l.js";import{i as F,o as de,r as I,s as L,t as R}from"./dialog-Dw7fMdDQ.js";import{t as z}from"./input-DIwJvCgi.js";import{t as fe}from"./centered-state-BmsqxbI8.js";import{i as B,l as pe,s as me}from"./skills-DFBiAuJG.js";import{_ as he,a as V,d as ge,g as _e,h as ve,i as H,l as ye,m as U,o as be,p as xe,r as Se,s as Ce,t as W,v as G}from"./sortable.esm-zp_qkYGV.js";import{G as K,lt as we}from"./index-lMBPAedr.js";import{n as Te}from"./skill-empty-hint-YDmkqgo-.js";var q=e(i(),1);function J(e){let t=[];for(let n of e){if(n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Ee(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function De(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function Oe(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function ke(e,t){return e.filter((e,n)=>n!==t)}function Y(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function X(e,t,n){let r=` `.repeat(n);return t.includes(`
|
|
2
|
+
`)?[`${r}${e}: |`,...t.split(`
|
|
3
|
+
`).map(e=>`${r} ${e}`)]:[`${r}${e}: ${Y(t)}`]}function Ae(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${Y(e.name)}`),e.skill&&t.push(` skill: ${Y(e.skill)}`),t}function Z(e){let t=[];return e.model&&t.push(` model: ${Y(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${Y(e.effort)}`),e.runner&&t.push(` runner: ${Y(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${Y(e.agentProfile)}`),t}function je(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(Y).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(Y).join(`, `)}]`),t}function Me(e){return e.onFail?[` onFail:`,` retry: ${Y(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Ne(e){return[` - id: ${Y(e.id)}`,...Ae(e),...e.prompt?X(`prompt`,e.prompt,4):[],...Z(e),...je(e),...e.command?X(`command`,e.command,4):[],...Me(e)]}function Pe(e,t,n){let r=[`name: ${Y(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...X(`description`,t.trim(),0));let i=J(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${Y(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...Ne(e))}else r.push(`skills: []`);return`${r.join(`
|
|
4
|
+
`)}\n`}function Fe(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Ie(e){let t=J(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Le(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function Re(e,t,n){let r=J(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var Q=a();function ze({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a}){return(0,Q.jsxs)(`section`,{"data-slot":`wb-metadata`,className:`flex min-w-0 flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex flex-col items-start gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs text-muted-foreground`,children:`Load an existing workflow`}),(0,Q.jsxs)(`div`,{className:`relative max-w-full`,children:[(0,Q.jsx)(ce,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsxs)(`select`,{id:`workflow-load`,value:e.some(e=>e.name===n)?n:``,onChange:t=>{let n=e.find(e=>e.name===t.target.value);n&&a(n)},className:`h-11 max-w-full rounded-lg border border-border bg-card pl-9 pr-3 text-xs font-medium appearance-none focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(`option`,{value:``,disabled:!0,children:`Choose a workflow`}),e.map(e=>(0,Q.jsx)(`option`,{value:e.name,"data-slot":`wb-load-option`,"data-name":e.name,children:e.name},e.name))]})]})]}),(0,Q.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-semibold`,children:`Workflow name`}),(0,Q.jsx)(z,{id:`workflow-name`,ref:r,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:t.name,onChange:e=>i({...t,name:e.target.value}),className:`h-12 bg-card text-sm`}),(0,Q.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-semibold`,children:`Description`}),(0,Q.jsx)(K,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,value:t.description,onChange:e=>i({...t,description:e.target.value}),className:`min-h-[72px] bg-card p-3.5 text-sm`})]})}function Be({savedFile:e,autoOpen:t,onImportToggle:r,onExport:i,onAutoToggle:a,onDeleteRequest:o}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-actions`,className:`grid grid-cols-[max-content_max-content] items-center justify-start gap-2 sm:flex sm:flex-wrap [&_button]:min-h-11 [&_button]:border [&_button]:border-border [&_button]:bg-card`,children:[(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:r,children:[(0,Q.jsx)(y,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:i,children:[(0,Q.jsx)(C,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":t,title:`Describe a chain — the agent builds it`,onClick:a,children:[(0,Q.jsx)(v,{"aria-hidden":`true`,className:`size-3`}),`Auto`]}),e?(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`text-danger hover:text-danger`,title:`Delete the saved workflow file`,onClick:o,children:[(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function Ve({text:e,onTextChange:t,pending:r,onRun:i,onCancel:a}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] leading-relaxed text-muted-foreground`,children:`Describe the outcome. An agent proposes a title and ordered skill/check steps. Review the result, edit it, then Save.`}),(0,Q.jsx)(K,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),i())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsxs)(n,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:r||e.trim()===``,onClick:i,children:[(0,Q.jsx)(v,{"aria-hidden":`true`,className:`size-3`}),r?`Building…`:`Build chain`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:a,children:[(0,Q.jsx)(b,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function He({open:e,onOpenChange:t,text:r,onTextChange:i,error:a,pending:o,onRun:s,onCancel:c}){return(0,Q.jsx)(R,{open:e,onOpenChange:t,children:(0,Q.jsxs)(I,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(L,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,Q.jsx)(F,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,Q.jsx)(K,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
|
|
5
|
+
skills:
|
|
6
|
+
- test-conventions
|
|
7
|
+
- commit-style`,value:r,onChange:e=>i(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),a===``?null:(0,Q.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:a}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsx)(n,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:o,onClick:s,children:`Import`}),(0,Q.jsx)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:c,children:`Cancel`})]})]})})}function Ue({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,Q.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,Q.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(z,{"data-slot":`wb-filter`,placeholder:`Find a skill…`,"aria-label":`Filter skills`,value:t,onChange:e=>n(e.target.value),className:`h-11 pl-9 text-xs`})]}),(0,Q.jsx)(rt,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,Q.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,Q.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,Q.jsxs)(`summary`,{"data-slot":`wb-yaml-toggle`,className:`inline-flex min-h-[44px] cursor-pointer items-center rounded-lg border border-border px-3 text-xs font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(h,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(at,{yaml:o})}),(0,Q.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 max-h-96 overflow-auto rounded-lg border border-border bg-background p-3 font-mono text-[11px] leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function We({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,Q.jsx)(nt,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function Ge({open:e,onOpenChange:t,query:r,onQueryChange:i,matches:a,skillsCount:o,error:s,selectedSkill:c,onSelectSkill:l,stepsCount:u,onCloseAutoFocus:d,onCancel:f,onAdd:ee}){return(0,Q.jsx)(R,{open:e,onOpenChange:t,children:(0,Q.jsxs)(I,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:d,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button]:min-h-11`,children:[(0,Q.jsxs)(de,{children:[(0,Q.jsx)(L,{className:`text-xl font-normal`,children:`Add step`}),(0,Q.jsx)(F,{className:`sr-only`,children:`Choose a skill to append to this workflow.`})]}),(0,Q.jsx)(z,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:r,onChange:e=>i(e.target.value)}),s===null?(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[a.map(e=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg py-2 has-[:checked]:bg-accent-strong/10 has-[:focus-visible]:outline-2`,children:[(0,Q.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.name,checked:c===e.name,onChange:()=>l(e.name)}),(0,Q.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,Q.jsx)(`span`,{className:`block`,children:e.name}),(0,Q.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description})]})]},e.name)),a.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o===0?`No skills available in this project.`:`No matching skills.`}):null]}):(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,s]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(n,{variant:`outline`,onClick:f,children:`Cancel`}),(0,Q.jsx)(n,{variant:`primary`,disabled:!c||u>=8,onClick:()=>{c&&ee(c)},children:`Add selected skill`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the selected skill, then reorder it in the existing canvas.`}),u>=8?(0,Q.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`A workflow can contain up to `,8,` steps. Remove a step before adding another.`]}):null]})})}function Ke({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(P,{open:n,onOpenChange:e=>!e&&r(),children:(0,Q.jsxs)(A,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(N,{children:[(0,Q.jsxs)(k,{children:[`“`,e,`” already exists`]}),(0,Q.jsx)(O,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,Q.jsxs)(M,{children:[(0,Q.jsx)(ue,{children:`Keep the file`}),(0,Q.jsx)(j,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,Q.jsx)(P,{open:i,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(A,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(N,{children:[(0,Q.jsxs)(k,{children:[`Delete workflow “`,e,`”?`]}),(0,Q.jsxs)(O,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,Q.jsxs)(M,{children:[(0,Q.jsx)(ue,{children:`Keep the file`}),(0,Q.jsx)(j,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function qe(e){return e.name??e.skill??e.id}function Je(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function Ye(e){let t=e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``;return`$ ${e.command}${t}`}function Xe(e,t){return Je(e)||t?.description||`Not in this repo or the team skills — the step runs on its plain prompt.`}function Ze(e,t){return e.command?Ye(e):e.skill?Xe(e,t):e.prompt??``}function Qe(e,t){return e.skill&&!t?`unknown`:null}function $e(e){return e.command?`Command step${e.onFail?` · Retry ×${e.onFail.max??2}`:``}`:e.skill?`Skill step`:`Prompt step`}function et({index:e,title:t,badge:i,onRemove:a,gripProps:o}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`inline-flex size-[26px] shrink-0 cursor-grab items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,...o,children:(0,Q.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:String(e+1).padStart(2,`0`)})}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),i?(0,Q.jsx)(`span`,{"data-slot":`wb-step-badge`,className:r(`shrink-0 rounded-full border px-2 py-px font-mono text-[11px]`,i===`unknown`&&`border-danger/35 text-danger`),children:i}):null,a?(0,Q.jsxs)(D,{children:[(0,Q.jsx)(le,{asChild:!0,children:(0,Q.jsx)(n,{"data-slot":`wb-step-actions`,variant:`ghost`,size:`icon`,className:`size-[26px]`,"aria-label":`Step ${e+1} actions: ${t}`,children:(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-4`})})}),(0,Q.jsx)(E,{align:`end`,children:(0,Q.jsxs)(T,{"data-slot":`wb-step-remove`,"aria-label":`Remove step ${e+1}: ${t}`,onSelect:a,children:[(0,Q.jsx)(S,{"aria-hidden":`true`}),` Remove step`]})})]}):null]})}function tt({index:e,onMoveUp:t,onMoveDown:r}){return(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 @min-[900px]:hidden`,children:[(0,Q.jsxs)(n,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} up`,disabled:!t,onClick:t,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,Q.jsxs)(n,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} down`,disabled:!r,onClick:r,children:[(0,Q.jsx)(x,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function nt({step:e,index:t,skills:n,onRemove:i,gripProps:a,onMoveUp:o,onMoveDown:s,overlay:c=!1}){let l=n.find(t=>t.name===e.skill),u=qe(e),d=Ze(e,l),f=Qe(e,l);return(0,Q.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:r(`rounded-lg border border-border bg-background p-4`,c&&`shadow-md`),children:[(0,Q.jsx)(et,{index:t,title:u,badge:f,onRemove:i,gripProps:a}),d?(0,Q.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-3 break-words text-xs leading-relaxed text-muted-foreground`,children:d}):null,(0,Q.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-3 text-[12px] text-link-foreground`,children:$e(e)}),c?null:(0,Q.jsx)(tt,{index:t,onMoveUp:o,onMoveDown:s})]})}function rt({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,Q.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=pe(e,t);return(0,Q.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,Q.jsx)(it,{skill:e,inFlow:r.has(e.name),onAdd:i},e.path)):(0,Q.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:(0,Q.jsx)(Te,{})})})}function it({skill:e,inFlow:t,onAdd:n}){let{attributes:i,listeners:a,setNodeRef:o,isDragging:s}=U({id:`palette:${e.name}`,data:{type:`palette`,skill:e.name}});return(0,Q.jsxs)(`div`,{ref:o,"data-slot":`wb-skill`,"data-skill":e.name,"data-in-flow":t||void 0,title:e.description??``,className:r(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,s&&`opacity-40`),...i,...a,children:[(0,Q.jsx)(`span`,{className:r(`min-w-0 flex-1 break-words text-xs`,B(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.name),className:`inline-flex size-11 shrink-0 items-center justify-center rounded-md text-link-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-3.5`})})]})}function at({yaml:e}){let[t,n]=(0,q.useState)(!1),r=(0,q.useRef)(null);return(0,q.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(oe,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(w,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}var ot=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function st(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function ct(){let{name:e}=t();return(0,Q.jsx)(lt,{routeName:e},e??``)}function lt({routeName:e}){let t=ee(),r=te(),i=f(),a=s(),[h,g]=(0,q.useState)(null),[re,ie]=(0,q.useState)(``),[v,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(``),[se,S]=(0,q.useState)(null),[ce,C]=(0,q.useState)(!1),[w,T]=(0,q.useState)(``),[le,E]=(0,q.useState)(``),[D,O]=(0,q.useState)(!1),[k,A]=(0,q.useState)(``),[j,M]=(0,q.useState)(!1),[ue,N]=(0,q.useState)(!1),[P,F]=(0,q.useState)(null),[de,I]=(0,q.useState)(null),L=(0,q.useRef)(null),R=(0,q.useRef)(null),z=t.data?.workflows??[],B=r.data??[],V=me(B,i.data?.skillUsage),ve=pe(V,b,i.data?.skillUsage);(0,q.useEffect)(()=>{if(h!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);g(r?st(r):$())},[h,t.data,e]);let H=e=>g(t=>t===null?t:{...t,steps:e}),U=p({mutationFn:e=>d(e),onSuccess:e=>{g({name:e.name,description:e.description??``,steps:e.steps}),C(!1),T(``),E(``),m(`Imported "${e.name}" — review, then Save.`)},onError:e=>E(e.message)}),W=p({mutationFn:e=>l(e),onSuccess:e=>{g(t=>{let n=t??$(),{name:r,steps:i}=Le(e,n.name);return{...n,name:r,steps:i}}),O(!1),A(``),m(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??h?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>m(e instanceof Error?e.message:String(e),{tone:`danger`})}),G=p({mutationFn:e=>c({...Re(h?.name??``,h?.description??``,h?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{M(!1),m(`Saved — ${e.path.split(`/`).pop()??e.path}`),a.invalidateQueries({queryKey:ne.workflows})},onError:e=>{e instanceof u&&e.exists===!0?M(!0):m(e instanceof Error?e.message:String(e),{tone:`danger`})}}),K=p({mutationFn:e=>o(e),onSuccess:(e,t)=>{N(!1),m(`Deleted "${t}".`),g($()),a.invalidateQueries({queryKey:ne.workflows})},onError:e=>{N(!1),m(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Te=he(_e(ge,{activationConstraint:{distance:4}}),_e(ye,{coordinateGetter:Se}));if(t.isError)return(0,Q.jsx)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,Q.jsx)(fe,{icon:(0,Q.jsx)(ae,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(h===null)return(0,Q.jsx)(we,{});let J=h.steps,Y=h.name.trim(),X=z.find(e=>e.name===Y&&e.source===`file`),Ae=Pe(h.name,h.description,J),Z=(e,t=J.length)=>{if(J.length>=8){m(`A workflow holds at most 8 steps.`,{tone:`danger`});return}H(De(J,Ee(e,J),t))};return(0,Q.jsxs)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,Q.jsxs)(`header`,{className:`mb-[22px] flex flex-wrap items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Workflows`}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Portable skill chains. Steps run from top to bottom.`})]}),(0,Q.jsxs)(n,{variant:`primary`,"data-slot":`wb-new`,className:`min-h-11`,onClick:()=>g($()),children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})]}),(0,Q.jsxs)(be,{sensors:Te,collisionDetection:xe,onDragStart:e=>{let t=e.active.data.current;F(t??null)},onDragOver:e=>{I(e.over?String(e.over.id):null)},onDragEnd:e=>{F(null),I(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===ot?J.length:J.findIndex(e=>e.id===n.id);Z(r.skill,e===-1?J.length:e);return}if(n.id===t.id)return;let i=J.findIndex(e=>e.id===t.id),a=J.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&H(Oe(J,i,a))},onDragCancel:()=>{F(null),I(null)},children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[22px] pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,Q.jsx)(ze,{workflows:z,draft:h,trimmedName:Y,nameRef:L,onDraft:g,onLoadWorkflow:e=>g(st(e))}),(0,Q.jsx)(Be,{savedFile:X,autoOpen:D,onImportToggle:()=>{E(``),O(!1),C(e=>!e)},onExport:()=>{let e=new Blob([Ae],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Fe(h.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{C(!1),O(e=>!e)},onDeleteRequest:()=>N(!0)}),D?(0,Q.jsx)(Ve,{text:k,onTextChange:A,pending:W.isPending,onRun:()=>{let e=k.trim();e===``||W.isPending||W.mutate(e)},onCancel:()=>{O(!1),A(``)}}):null,(0,Q.jsx)(He,{open:ce,onOpenChange:C,text:w,onTextChange:T,error:le,pending:U.isPending,onRun:()=>{let e=w.trim();e!==``&&U.mutate(e)},onCancel:()=>{C(!1),T(``),E(``)}}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,Q.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Steps · `,J.length,` of `,8,(0,Q.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Ie(J)})]}),(0,Q.jsx)(ut,{steps:J,skills:B,dragging:P!==null,overId:de,activeStepId:P?.type===`step`?P.step.id:null,onRemove:e=>H(ke(J,e)),onMove:(e,t)=>H(Oe(J,e,t))}),(0,Q.jsxs)(n,{ref:R,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{S(null),x(``),y(!0)},children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,Q.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,Q.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]}),(0,Q.jsxs)(`footer`,{className:`mt-4 flex flex-wrap items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Review the name and steps, then save to a workflow file.`}),(0,Q.jsxs)(n,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 max-sm:w-full`,"data-slot":`wb-save`,disabled:G.isPending,onClick:()=>{if(Y===``){L.current?.focus();return}if(J.length===0){m(`Add at least one step first.`,{tone:`danger`});return}G.mutate(!1)},children:[(0,Q.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),`Save`]})]})]}),(0,Q.jsx)(Ue,{paletteSkills:V,query:re,onQueryChange:ie,error:r.isError?r.error.message:null,inFlow:new Set(J.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Z(e),yaml:Ae})]})]}),(0,Q.jsx)(Ce,{children:(0,Q.jsx)(We,{dragging:P,steps:J,skills:B})})]}),(0,Q.jsx)(Ge,{open:v,onOpenChange:y,query:b,onQueryChange:x,matches:ve,skillsCount:B.length,error:r.isError?r.error.message:null,selectedSkill:se,onSelectSkill:S,stepsCount:J.length,onCloseAutoFocus:e=>{e.preventDefault(),R.current?.focus()},onCancel:()=>y(!1),onAdd:e=>{Z(e),y(!1)}}),(0,Q.jsx)(Ke,{trimmedName:Y,savedFile:X,overwriteOpen:j,onOverwriteDismiss:()=>M(!1),deleteOpen:ue,onDeleteDismiss:()=>N(!1),onOverwrite:()=>G.mutate(!0),onDelete:()=>K.mutate(Y)})]})}function ut({steps:e,skills:t,dragging:n,overId:i,activeStepId:a,onRemove:o,onMove:s}){let{setNodeRef:c,isOver:l}=ve({id:ot}),u=n&&i===ot;return(0,Q.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:r(`relative mt-4 rounded-lg transition-colors`,l?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,Q.jsx)(`p`,{className:r(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,l?`text-link-foreground`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,Q.jsxs)(W,{items:e.map(e=>e.id),strategy:V,children:[(0,Q.jsx)(`ol`,{className:`flex flex-col gap-4`,children:e.map((r,c)=>(0,Q.jsx)(dt,{step:r,index:c,skills:t,dragging:n,insertBefore:n&&i===r.id&&a!==r.id,onRemove:()=>o(c),onMoveUp:c>0?()=>s(c,c-1):void 0,onMoveDown:c<e.length-1?()=>s(c,c+1):void 0},r.id))}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:r(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,u?`bg-accent-strong`:`bg-transparent`)})]})})}function dt({step:e,index:t,skills:n,insertBefore:i,onRemove:a,onMoveUp:o,onMoveDown:s}){let{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:ee}=H({id:e.id,data:{type:`step`,step:e}});return(0,Q.jsxs)(`li`,{ref:u,style:{transform:G.Transform.toString(d),transition:f},className:r(`relative`,ee&&`opacity-40`),children:[i?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,Q.jsx)(nt,{step:e,index:t,skills:n,onRemove:a,onMoveUp:o,onMoveDown:s,gripProps:{...c,...l}})]})}export{ct as WorkflowsRoute};
|
package/web/dist/index.html
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
})()
|
|
49
49
|
</script>
|
|
50
|
-
<script type="module" crossorigin src="/assets/index-
|
|
50
|
+
<script type="module" crossorigin src="/assets/index-lMBPAedr.js"></script>
|
|
51
51
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
52
52
|
<link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-BT31bpU6.js">
|
|
@@ -65,15 +65,21 @@
|
|
|
65
65
|
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon-BHp8sXmF.js">
|
|
66
66
|
<link rel="modulepreload" crossorigin href="/assets/nav-row-styles-CEA9c88Q.js">
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/es2015-CX0rgbM5.js">
|
|
68
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
69
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-DvNdR7gM.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/dropdown-menu-D7f0O7xR.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/popover-N-u5z2xh.js">
|
|
70
71
|
<link rel="modulepreload" crossorigin href="/assets/eye-B8okNWXU.js">
|
|
71
72
|
<link rel="modulepreload" crossorigin href="/assets/format-BNCkW110.js">
|
|
72
73
|
<link rel="modulepreload" crossorigin href="/assets/play-CmVAj_fu.js">
|
|
73
|
-
<link rel="modulepreload" crossorigin href="/assets/control-locations-
|
|
74
|
+
<link rel="modulepreload" crossorigin href="/assets/control-locations-CljaLD_b.js">
|
|
75
|
+
<link rel="modulepreload" crossorigin href="/assets/alert-dialog-h-3h9B4l.js">
|
|
76
|
+
<link rel="modulepreload" crossorigin href="/assets/dialog-Dw7fMdDQ.js">
|
|
77
|
+
<link rel="modulepreload" crossorigin href="/assets/input-DIwJvCgi.js">
|
|
74
78
|
<link rel="modulepreload" crossorigin href="/assets/project-router-Dd63wBeA.js">
|
|
79
|
+
<link rel="modulepreload" crossorigin href="/assets/agent-accounts-CuRvwNoA.js">
|
|
80
|
+
<link rel="modulepreload" crossorigin href="/assets/skills-DFBiAuJG.js">
|
|
81
|
+
<link rel="modulepreload" crossorigin href="/assets/github-sidebar-model-BSNdxNKJ.js">
|
|
75
82
|
<link rel="modulepreload" crossorigin href="/assets/centered-state-BmsqxbI8.js">
|
|
76
|
-
<link rel="modulepreload" crossorigin href="/assets/alert-dialog-h-3h9B4l.js">
|
|
77
83
|
<link rel="modulepreload" crossorigin href="/assets/lib-BxQXEXDF.js">
|
|
78
84
|
<link rel="modulepreload" crossorigin href="/assets/chunk-BO2N2NFS-DE6qKn3r.js">
|
|
79
85
|
<link rel="modulepreload" crossorigin href="/assets/sortable.esm-zp_qkYGV.js">
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./button-CS5tOblf.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{i}from"./project-scope-context-wlB-Y0ii.js";import{M as a,ct as o,r as s}from"./design-icons-DmYTv2r1.js";import{n as c}from"./diff-controls-BHF0Pvdc.js";import{u as l}from"./control-locations-5bi8dzFR.js";import{t as u}from"./project-router-Dd63wBeA.js";import{t as d}from"./centered-state-BmsqxbI8.js";import{at as f,ot as p}from"./index-C2zVqh-_.js";import{t as m}from"./diff-BZbKoEDq.js";var h=e(n(),1),g=r();function _({commit:e,sha:n,backTo:r,backLabel:_,slot:v,className:y,diffClassName:b}){let x=p(),[S,C]=(0,h.useState)(`unified`),[w,T]=(0,h.useState)(!1),E=e.isError&&e.error instanceof i&&e.error.status===409,D=x?S:`unified`,O=!x||w;return(0,g.jsxs)(`section`,{"data-slot":v,"data-sha":n,className:y,children:[(0,g.jsxs)(`div`,{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:[(0,g.jsx)(t,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,g.jsxs)(u,{to:r,children:[(0,g.jsx)(s,{size:16,"aria-hidden":`true`}),_]})}),e.data?(0,g.jsx)(f,{stat:e.data.stat}):null,(0,g.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,g.jsx)(c,{mode:S,wrap:w,onModeChange:C,onWrapChange:T})})]}),e.isPending?(0,g.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):e.isError?(0,g.jsx)(d,{icon:E?(0,g.jsx)(l,{}):(0,g.jsx)(o,{size:16}),tone:E?`neutral`:`danger`,heading:`h2`,title:E?`Commit not found`:`Could not load the commit`,subtitle:e.error.message}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,g.jsx)(`h2`,{className:`text-sm font-semibold`,children:e.data.subject}),(0,g.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[e.data.author,` · `,e.data.when,` ·`,` `,(0,g.jsx)(`span`,{className:`font-mono select-all`,children:e.data.sha})]})]}),e.data.files.length===0?(0,g.jsx)(d,{icon:(0,g.jsx)(a,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,g.jsx)(`div`,{className:b,children:(0,g.jsx)(m,{files:e.data.files,mode:D,wrap:O,className:`min-w-0`})})]})]})}export{_ as t};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-dVGWG20n.js","assets/rolldown-runtime-QTnfLwEv.js","assets/button-CS5tOblf.js","assets/react-runtime-CCIEwYL0.js","assets/bundle-mjs-BT31bpU6.js","assets/eye-B8okNWXU.js","assets/createLucideIcon-BHp8sXmF.js","assets/index-C2zVqh-_.js","assets/live-refetch-CstQIN6c.js","assets/project-scope-context-wlB-Y0ii.js","assets/live-protocol-BAiIX_Mf.js","assets/useInfiniteQuery-hrWYY8aw.js","assets/queries-BPdWfTBN.js","assets/useQuery-BHmKi9_o.js","assets/ws-Cn8d-Fu-.js","assets/toaster-CRVRHlMR.js","assets/cez-idle-DtpdVf_5.js","assets/design-icons-DmYTv2r1.js","assets/nav-row-styles-CEA9c88Q.js","assets/popover-s-Wchzjn.js","assets/es2015-CX0rgbM5.js","assets/dropdown-menu-CjLqyqwB.js","assets/format-BNCkW110.js","assets/play-CmVAj_fu.js","assets/control-locations-5bi8dzFR.js","assets/project-router-Dd63wBeA.js","assets/centered-state-BmsqxbI8.js","assets/alert-dialog-h-3h9B4l.js","assets/chunk-BO2N2NFS-DE6qKn3r.js","assets/lib-BxQXEXDF.js","assets/sortable.esm-zp_qkYGV.js","assets/index-9YmaiQ1k.css","assets/image-preview-Dy3o8upo.js","assets/zoomable-image-UzXCYU7Z.js","assets/markdown-BBDDg-4t.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{u as t}from"./button-CS5tOblf.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{i}from"./bundle-mjs-BT31bpU6.js";import{at as a}from"./index-C2zVqh-_.js";import{n as o,t as s}from"./image-preview-Dy3o8upo.js";var c=e(n(),1),l=r();function u(e){let[n,r]=(0,c.useState)(null);return(0,c.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-dVGWG20n.js`).then(t=>{e||r({View:t.DiffView})},()=>{e||r(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34])),()=>{e=!0}},[]),e.files.length===0?(0,l.jsx)(`p`,{"data-slot":`diff-empty`,className:t(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):n===`failed`?(0,l.jsx)(d,{...e}):n===null?(0,l.jsx)(`p`,{"data-slot":`diff-loading`,className:t(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,l.jsx)(n.View,{...e})}function d({files:e,wrap:n=!1,imageSrc:r,onOpenInApp:i,viewRef:o,className:s}){let u={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(o,()=>({scrollToPath:e=>{for(let t of d.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,l.jsxs)(`div`,{ref:d,"data-slot":`diff`,"data-fallback":`true`,className:t(`flex min-w-0 flex-col gap-3`,s),children:[(0,l.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,l.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,l.jsx)(a,{stat:u})]}),e.map(e=>(0,l.jsx)(f,{file:e,wrap:n,imageSrc:r,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function f({file:e,wrap:n,imageSrc:r,onOpenInApp:i}){return(0,l.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,l.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,l.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,l.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,l.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),o(e)?(0,l.jsx)(s,{file:e,imageSrc:r,onOpenInApp:i}):e.binary?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,l.jsx)(`pre`,{className:t(`py-2 font-mono text-xs leading-[1.7]`,n?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
|
|
3
|
-
`).map((e,n)=>(0,l.jsxs)(`span`,{className:t(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[e,e===``?` `:``]},n))})]})}export{u as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,l as n,s as r,u as i}from"./button-CS5tOblf.js";import{i as a,r as o,t as s}from"./react-runtime-CCIEwYL0.js";import{d as c,h as l,l as u}from"./design-icons-DmYTv2r1.js";import{a as d,c as f,d as p,f as m,g as h,h as g,i as _,l as v,m as y,n as b,o as x,p as S,r as C,t as w,u as T}from"./es2015-CX0rgbM5.js";var E=e(a(),1),D=s();function O(e){let n=e+`CollectionProvider`,[i,a]=y(n),[o,s]=i(n,{collectionRef:{current:null},itemMap:new Map}),c=e=>{let{scope:t,children:n}=e,r=E.useRef(null),i=E.useRef(new Map).current;return(0,D.jsx)(o,{scope:t,itemMap:i,collectionRef:r,children:n})};c.displayName=n;let l=e+`CollectionSlot`,u=t(l),d=E.forwardRef((e,t)=>{let{scope:n,children:i}=e,a=r(t,s(l,n).collectionRef);return(0,D.jsx)(u,{ref:a,children:i})});d.displayName=l;let f=e+`CollectionItemSlot`,p=`data-radix-collection-item`,m=t(f),h=E.forwardRef((e,t)=>{let{scope:n,children:i,...a}=e,o=E.useRef(null),c=r(t,o),l=s(f,n);return E.useEffect(()=>(l.itemMap.set(o,{ref:o,...a}),()=>void l.itemMap.delete(o))),(0,D.jsx)(m,{[p]:``,ref:c,children:i})});h.displayName=f;function g(t){let n=s(e+`CollectionConsumer`,t);return E.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${p}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:c,Slot:d,ItemSlot:h},g,a]}var k=E.createContext(void 0);function A(e){let t=E.useContext(k);return e||t||`ltr`}var j=e(o(),1);function M(e){let[t,n]=E.useState(void 0);return m(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var N=[`top`,`right`,`bottom`,`left`],P=Math.min,F=Math.max,I=Math.round,L=Math.floor,R=e=>({x:e,y:e}),ee={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function z(e,t,n){return F(e,P(t,n))}function B(e,t){return typeof e==`function`?e(t):e}function V(e){return e.split(`-`)[0]}function H(e){return e.split(`-`)[1]}function te(e){return e===`x`?`y`:`x`}function ne(e){return e===`y`?`height`:`width`}function U(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function re(e){return te(U(e))}function ie(e,t,n){n===void 0&&(n=!1);let r=H(e),i=re(e),a=ne(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=pe(o)),[o,pe(o)]}function ae(e){let t=pe(e);return[oe(e),t,oe(t)]}function oe(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var se=[`left`,`right`],ce=[`right`,`left`],le=[`top`,`bottom`],ue=[`bottom`,`top`];function de(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ce:se:t?se:ce;case`left`:case`right`:return t?le:ue;default:return[]}}function fe(e,t,n,r){let i=H(e),a=de(V(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(oe)))),a}function pe(e){let t=V(e);return ee[t]+e.slice(t.length)}function me(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function he(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:me(e)}function ge(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function _e(e,t,n){let{reference:r,floating:i}=e,a=U(t),o=re(t),s=ne(o),c=V(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=H(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ve(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=B(t,e),p=he(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ge(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=ge(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ye=50,be=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ve},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=_e(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ye&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=_e(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},xe=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=B(e,t)||{};if(l==null)return{};let d=he(u),f={x:n,y:r},p=re(i),m=ne(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=P(d[_],T),D=P(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=z(E,k,O),j=!c.arrow&&H(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Se=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=B(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=V(r),_=U(o),v=V(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[pe(o)]:ae(o)),x=p!==`none`;!d&&x&&b.push(...fe(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ie(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==U(t))||T.every(e=>U(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=U(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ce(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function we(e){return N.some(t=>e[t]>=0)}var Te=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=B(e,t);switch(i){case`referenceHidden`:{let e=Ce(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:we(e)}}}case`escaped`:{let e=Ce(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:we(e)}}}default:return{}}}}},Ee=new Set([`left`,`top`]);async function De(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=V(n),s=H(n),c=U(n)===`y`,l=Ee.has(o)?-1:1,u=a&&c?-1:1,d=B(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Oe=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await De(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ke=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=B(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=U(i),p=te(f),m=u[p],h=u[f],g=(e,t)=>z(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Ae=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=B(e,t),u={x:n,y:r},d=U(i),f=te(d),p=u[f],m=u[d],h=B(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ee.has(V(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},je=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=B(e,t),c=await i.detectOverflow(t,s),l=V(n),u=H(n),d=U(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=P(p-c[m],g),y=P(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*F(c.left,c.right):S=p-2*F(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Me(){return typeof window<`u`}function Ne(e){return Pe(e)?(e.nodeName||``).toLowerCase():`#document`}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function G(e){return((Pe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Pe(e){return Me()?e instanceof Node||e instanceof W(e).Node:!1}function K(e){return Me()?e instanceof Element||e instanceof W(e).Element:!1}function q(e){return Me()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function Fe(e){return!Me()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}function Ie(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Y(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Le(e){return/^(table|td|th)$/.test(Ne(e))}function Re(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var ze=/transform|translate|scale|rotate|perspective|filter/,Be=/paint|layout|strict|content/,J=e=>!!e&&e!==`none`,Ve;function He(e){let t=K(e)?Y(e):e;return J(t.transform)||J(t.translate)||J(t.scale)||J(t.rotate)||J(t.perspective)||!We()&&(J(t.backdropFilter)||J(t.filter))||ze.test(t.willChange||``)||Be.test(t.contain||``)}function Ue(e){let t=qe(e);for(;q(t)&&!Ge(t);){if(He(t))return t;if(Re(t))return null;t=qe(t)}return null}function We(){return Ve??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Ve}function Ge(e){return/^(html|body|#document)$/.test(Ne(e))}function Y(e){return W(e).getComputedStyle(e)}function Ke(e){return K(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function qe(e){if(Ne(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Fe(e)&&e.host||G(e);return Fe(t)?t.host:t}function Je(e){let t=qe(e);return Ge(t)?(e.ownerDocument||e).body:q(t)&&Ie(t)?t:Je(t)}function Ye(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Je(e),i=r===e.ownerDocument?.body,a=W(r);if(i){let e=Xe(a);return t.concat(a,a.visualViewport||[],Ie(r)?r:[],e&&n?Ye(e):[])}else return t.concat(r,Ye(r,[],n))}function Xe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ze(e){let t=Y(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=q(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=I(n)!==a||I(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Qe(e){return K(e)?e:e.contextElement}function $e(e){let t=Qe(e);if(!q(t))return R(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ze(t),o=(a?I(n.width):n.width)/r,s=(a?I(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var et=R(0);function tt(e){let t=W(e);return!We()||!t.visualViewport?et:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nt(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===W(e)}function rt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Qe(e),o=R(1);t&&(r?K(r)&&(o=$e(r)):o=$e(e));let s=nt(a,n,r)?tt(a):R(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=W(a),t=K(r)?W(r):r,n=e,i=Xe(n);for(;i&&t!==n;){let e=$e(i),t=i.getBoundingClientRect(),r=Y(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=W(i),i=Xe(n)}}return ge({width:u,height:d,x:c,y:l})}function it(e,t){let n=Ke(e).scrollLeft;return t?t.left+n:rt(G(e)).left+n}function at(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-it(e,n),y:n.top+t.scrollTop}}function ot(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=G(r),s=t?Re(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=R(1),u=R(0),d=q(r);if((d||!a)&&((Ne(r)!==`body`||Ie(o))&&(c=Ke(r)),d)){let e=rt(r);l=$e(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?at(o,c):R(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function st(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function ct(e){let t=Ke(e),n=e.ownerDocument.body,r=F(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=F(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+it(e),o=-t.scrollTop;return Y(n).direction===`rtl`&&(a+=F(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var lt=25;function ut(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=W(e),a=G(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!We()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(it(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=lt&&(s-=o)}return{width:s,height:c,x:l,y:u}}function dt(e,t){let n=rt(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=$e(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ft(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=ut(e,n,t);else if(t===`document`)r=ct(G(e));else if(K(t))r=dt(t,n);else{let n=tt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ge(r)}function pt(e,t){let n=t.get(e);if(n)return n;let r=Ye(e,[],!1).filter(e=>K(e)&&Ne(e)!==`body`),i=null,a=Y(e).position===`fixed`,o=a?qe(e):e;for(;K(o)&&!Ge(o);){let e=Y(o),t=He(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=qe(o)}return t.set(e,r),r}function mt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Re(t)?[]:pt(t,this._c):[].concat(n),r],o=ft(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=ft(t,a[e],i);s=F(n.top,s),c=P(n.right,c),l=P(n.bottom,l),u=F(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function ht(e){let{width:t,height:n}=Ze(e);return{width:t,height:n}}function gt(e,t,n){let r=q(t),i=G(t),a=n===`fixed`,o=rt(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=R(0);if((r||!a)&&((Ne(t)!==`body`||Ie(i))&&(s=Ke(t)),r)){let e=rt(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=it(i));let l=i&&!r&&!a?at(i,s):R(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function _t(e){return Y(e).position===`static`}function vt(e,t){if(!q(e)||Y(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return G(e)===n&&(n=n.ownerDocument.body),n}function yt(e,t){let n=W(e);if(Re(e))return n;if(!q(e)){let t=qe(e);for(;t&&!Ge(t);){if(K(t)&&!_t(t))return t;t=qe(t)}return n}let r=vt(e,t);for(;r&&Le(r)&&_t(r);)r=vt(r,t);return r&&Ge(r)&&_t(r)&&!He(r)?n:r||Ue(e)||n}var bt=async function(e){let t=this.getOffsetParent||yt,n=this.getDimensions,r=await n(e.floating);return{reference:gt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function xt(e){return Y(e).direction===`rtl`}var St={convertOffsetParentRelativeRectToViewportRelativeRect:ot,getDocumentElement:G,getClippingRect:mt,getOffsetParent:yt,getElementRects:bt,getClientRects:st,getDimensions:ht,getScale:$e,isElement:K,isRTL:xt};function Ct(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wt(e,t,n){let r=null,i,a=G(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=L(d),h=L(a.clientWidth-(u+f)),g=L(a.clientHeight-(d+p)),_=L(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:F(0,P(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Ct(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=W(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Tt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Qe(e),u=i||a?[...l?Ye(l):[],...t?Ye(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?wt(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?rt(e):null;c&&g();function g(){let t=rt(e);h&&!Ct(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Et=Oe,Dt=ke,Ot=Se,kt=je,At=Te,jt=xe,Mt=Ae,Nt=(e,t,n)=>{let r=new Map,i=n??{},a={...St,...i.platform,_c:r};return be(e,t,{...i,platform:a})},Pt=typeof document<`u`?E.useLayoutEffect:function(){};function Ft(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ft(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ft(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function It(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Lt(e,t){let n=It(e);return Math.round(t*n)/n}function Rt(e){let t=E.useRef(e);return Pt(()=>{t.current=e}),t}function zt(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=E.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=E.useState(r);Ft(f,r)||p(r);let[m,h]=E.useState(null),[g,_]=E.useState(null),v=E.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=E.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=E.useRef(null),C=E.useRef(null),w=E.useRef(u),T=c!=null,D=Rt(c),O=Rt(i),k=Rt(l),A=E.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Nt(S.current,C.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};M.current&&!Ft(w.current,t)&&(w.current=t,j.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Pt(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=E.useRef(!1);Pt(()=>(M.current=!0,()=>{M.current=!1}),[]),Pt(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(D.current)return D.current(b,x,A);A()}},[b,x,A,D,T]);let N=E.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),P=E.useMemo(()=>({reference:b,floating:x}),[b,x]),F=E.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Lt(P.floating,u.x),r=Lt(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...It(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return E.useMemo(()=>({...u,update:A,refs:N,elements:P,floatingStyles:F}),[u,A,N,P,F])}var Bt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:jt({element:r.current,padding:i}).fn(n):r?jt({element:r,padding:i}).fn(n):{}}}},Vt=(e,t)=>{let n=Et(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ht=(e,t)=>{let n=Dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ut=(e,t)=>({fn:Mt(e).fn,options:[e,t]}),Wt=(e,t)=>{let n=Ot(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gt=(e,t)=>{let n=kt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kt=(e,t)=>{let n=At(e);return{name:n.name,fn:n.fn,options:[e,t]}},qt=(e,t)=>{let n=Bt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jt=`Arrow`,Yt=E.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,D.jsx)(g.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,D.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Yt.displayName=Jt;var Xt=Yt,Zt=`Popper`,[Qt,$t]=y(Zt),[en,tn]=Qt(Zt),nn=e=>{let{__scopePopper:t,children:n}=e,[r,i]=E.useState(null),[a,o]=E.useState(void 0);return(0,D.jsx)(en,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};nn.displayName=Zt;var rn=`PopperAnchor`,an=E.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:i,...a}=e,o=tn(rn,n),s=E.useRef(null),c=o.onAnchorChange,l=r(t,E.useCallback(e=>{s.current=e,e&&c(e)},[c])),u=E.useRef(null);E.useEffect(()=>{if(!i)return;let e=u.current;u.current=i.current,e!==u.current&&c(u.current)});let d=o.placementState&&hn(o.placementState),f=d?.[0],p=d?.[1];return i?null:(0,D.jsx)(g.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...a,ref:l})});an.displayName=rn;var on=`PopperContent`,[sn,cn]=Qt(on),ln=E.forwardRef((e,t)=>{let{__scopePopper:n,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:p=`partial`,hideWhenDetached:h=!1,updatePositionStrategy:_=`optimized`,onPlaced:v,...y}=e,b=tn(on,n),[x,S]=E.useState(null),C=r(t,S),[w,T]=E.useState(null),O=M(w),k=O?.width??0,A=O?.height??0,j=i+(o===`center`?``:`-`+o),N=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},P=Array.isArray(u)?u:[u],F=P.length>0,I={padding:N,boundary:P.filter(pn),altBoundary:F},{refs:L,floatingStyles:R,placement:ee,isPositioned:z,middlewareData:B}=zt({strategy:`fixed`,placement:j,whileElementsMounted:(...e)=>Tt(...e,{animationFrame:_===`always`}),elements:{reference:b.anchor},middleware:[Vt({mainAxis:a+A,alignmentAxis:s}),l&&Ht({mainAxis:!0,crossAxis:!1,limiter:p===`partial`?Ut():void 0,...I}),l&&Wt({...I}),Gt({...I,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),w&&qt({element:w,padding:c}),mn({arrowWidth:k,arrowHeight:A}),h&&Kt({strategy:`referenceHidden`,...I,boundary:F?I.boundary:void 0})]}),V=b.setPlacementState;m(()=>(V(ee),()=>{V(void 0)}),[ee,V]);let[H,te]=hn(ee),ne=f(v);m(()=>{z&&ne?.()},[z,ne]);let U=B.arrow?.x,re=B.arrow?.y,ie=B.arrow?.centerOffset!==0,[ae,oe]=E.useState();return m(()=>{x&&oe(window.getComputedStyle(x).zIndex)},[x]),(0,D.jsx)(`div`,{ref:L.setFloating,"data-radix-popper-content-wrapper":``,style:{...R,transform:z?R.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(` `),...B.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,D.jsx)(sn,{scope:n,placedSide:H,placedAlign:te,onArrowChange:T,arrowX:U,arrowY:re,shouldHideArrow:ie,children:(0,D.jsx)(g.div,{"data-side":H,"data-align":te,...y,ref:C,style:{...y.style,animation:z?void 0:`none`}})})})});ln.displayName=on;var un=`PopperArrow`,dn={top:`bottom`,right:`left`,bottom:`top`,left:`right`},fn=E.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=cn(un,n),a=dn[i.placedSide];return(0,D.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,D.jsx)(Xt,{...r,ref:t,style:{...r.style,display:`block`}})})});fn.displayName=un;function pn(e){return e!==null}var mn=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=hn(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function hn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var gn=nn,_n=an,vn=ln,yn=fn,bn=!1;function xn(){let[e,t]=E.useState(bn);return E.useEffect(()=>{bn||(bn=!0,t(!0))},[]),e}var Sn=E.useSyncExternalStore;function Cn(){return()=>{}}function wn(){return Sn(Cn,()=>!0,()=>!1)}var Tn=typeof Sn==`function`?wn:xn,En=`rovingFocusGroup.onEntryFocus`,Dn={bubbles:!1,cancelable:!0},On=`RovingFocusGroup`,[kn,An,jn]=O(On),[Mn,Nn]=y(On,[jn]),[Pn,Fn]=Mn(On),In=E.forwardRef((e,t)=>(0,D.jsx)(kn.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,D.jsx)(kn.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,D.jsx)(Ln,{...e,ref:t})})}));In.displayName=On;var Ln=E.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:i,loop:a=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...m}=e,h=E.useRef(null),_=r(t,h),v=A(o),[y,b]=p({prop:s,defaultProp:c??null,onChange:l,caller:On}),[x,C]=E.useState(!1),w=f(u),T=An(n),O=E.useRef(!1),[k,j]=E.useState(0);return E.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(En,w),()=>e.removeEventListener(En,w)},[w]),(0,D.jsx)(Pn,{scope:n,orientation:i,dir:v,loop:a,currentTabStopId:y,onItemFocus:E.useCallback(e=>b(e),[b]),onItemShiftTab:E.useCallback(()=>C(!0),[]),onFocusableItemAdd:E.useCallback(()=>j(e=>e+1),[]),onFocusableItemRemove:E.useCallback(()=>j(e=>e-1),[]),children:(0,D.jsx)(g.div,{tabIndex:x||k===0?-1:0,"data-orientation":i,...m,ref:_,style:{outline:`none`,...e.style},onMouseDown:S(e.onMouseDown,()=>{O.current=!0}),onFocus:S(e.onFocus,e=>{let t=!O.current;if(e.target===e.currentTarget&&t&&!x){let t=new CustomEvent(En,Dn);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=T().filter(e=>e.focusable);Un([e.find(e=>e.active),e.find(e=>e.id===y),...e].filter(Boolean).map(e=>e.ref.current),d)}}O.current=!1}),onBlur:S(e.onBlur,()=>C(!1))})})}),Rn=`RovingFocusGroupItem`,zn=E.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=v(),l=a||c,u=Fn(Rn,n),d=u.currentTabStopId===l,f=An(n),{onFocusableItemAdd:p,onFocusableItemRemove:h,currentTabStopId:_}=u,y=Tn();return m(()=>{if(!(!y||!r))return p(),()=>h()},[y,r,p,h]),E.useEffect(()=>{if(!(y||!r))return p(),()=>h()},[y,r,p,h]),(0,D.jsx)(kn.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,D.jsx)(g.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:S(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:S(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:S(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Hn(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Wn(n,r+1):n.slice(r+1)}setTimeout(()=>Un(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:_!=null}):o})})});zn.displayName=Rn;var Bn={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Vn(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Hn(e,t,n){let r=Vn(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Bn[r]}function Un(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Wn(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Gn=In,Kn=zn,qn=[`Enter`,` `],Jn=[`ArrowDown`,`PageUp`,`Home`],Yn=[`ArrowUp`,`PageDown`,`End`],Xn=[...Jn,...Yn],Zn={ltr:[...qn,`ArrowRight`],rtl:[...qn,`ArrowLeft`]},Qn={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},$n=`Menu`,[er,tr,nr]=O($n),[X,rr]=y($n,[nr,$t,Nn]),ir=$t(),ar=Nn(),[or,Z]=X($n),[sr,cr]=X($n),lr=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=ir(t),[c,l]=E.useState(null),u=E.useRef(!1),d=f(a),p=A(i);return E.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),E.useEffect(()=>{if(!n)return;let e=()=>d(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,D.jsx)(gn,{...s,children:(0,D.jsx)(or,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,D.jsx)(sr,{scope:t,onClose:E.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:p,modal:o,children:r})})})};lr.displayName=$n;var ur=`MenuAnchor`,dr=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=ir(n);return(0,D.jsx)(_n,{...i,...r,ref:t})});dr.displayName=ur;var fr=`MenuPortal`,[pr,mr]=X(fr,{forceMount:void 0}),hr=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Z(fr,t);return(0,D.jsx)(pr,{scope:t,forceMount:n,children:(0,D.jsx)(T,{present:n||a.open,children:(0,D.jsx)(_,{asChild:!0,container:i,children:r})})})};hr.displayName=fr;var Q=`MenuContent`,[gr,_r]=X(Q),vr=E.forwardRef((e,t)=>{let n=mr(Q,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Z(Q,e.__scopeMenu),o=cr(Q,e.__scopeMenu);return(0,D.jsx)(er.Provider,{scope:e.__scopeMenu,children:(0,D.jsx)(T,{present:r||a.open,children:(0,D.jsx)(er.Slot,{scope:e.__scopeMenu,children:o.modal?(0,D.jsx)(yr,{...i,ref:t}):(0,D.jsx)(br,{...i,ref:t})})})})}),yr=E.forwardRef((e,t)=>{let n=Z(Q,e.__scopeMenu),i=E.useRef(null),a=r(t,i);return E.useEffect(()=>{let e=i.current;if(e)return w(e)},[]),(0,D.jsx)(Sr,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:S(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),br=E.forwardRef((e,t)=>{let n=Z(Q,e.__scopeMenu);return(0,D.jsx)(Sr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),xr=t(`MenuContent.ScrollLock`),Sr=E.forwardRef((e,t)=>{let{__scopeMenu:n,loop:i=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:h,disableOutsideScroll:g,..._}=e,v=Z(Q,n),y=cr(Q,n),w=ir(n),T=ar(n),O=tr(n),[k,A]=E.useState(null),j=E.useRef(null),M=r(t,j,v.onContentChange),N=E.useRef(0),P=E.useRef(``),F=E.useRef(0),I=E.useRef(null),L=E.useRef(`right`),R=E.useRef(0),ee=g?b:E.Fragment,z=g?{as:xr,allowPinchZoom:!0}:void 0,B=e=>{let t=P.current+e,n=O().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=oi(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){P.current=t,window.clearTimeout(N.current),t!==``&&(N.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};E.useEffect(()=>()=>window.clearTimeout(N.current),[]),C();let V=E.useCallback(e=>L.current===I.current?.side&&ci(e,I.current?.area),[]);return(0,D.jsx)(gr,{scope:n,searchRef:P,onItemEnter:E.useCallback(e=>{V(e)&&e.preventDefault()},[V]),onItemLeave:E.useCallback(e=>{V(e)||(j.current?.focus(),A(null))},[V]),onTriggerLeave:E.useCallback(e=>{V(e)&&e.preventDefault()},[V]),pointerGraceTimerRef:F,onPointerGraceIntentChange:E.useCallback(e=>{I.current=e},[]),children:(0,D.jsx)(ee,{...z,children:(0,D.jsx)(d,{asChild:!0,trapped:a,onMountAutoFocus:S(o,e=>{e.preventDefault(),j.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,D.jsx)(x,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:h,children:(0,D.jsx)(Gn,{asChild:!0,...T,dir:y.dir,orientation:`vertical`,loop:i,currentTabStopId:k,onCurrentTabStopIdChange:A,onEntryFocus:S(l,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,D.jsx)(vn,{role:`menu`,"aria-orientation":`vertical`,"data-state":ti(v.open),"data-radix-menu-content":``,dir:y.dir,...w,..._,ref:M,style:{outline:`none`,..._.style},onKeyDown:S(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&B(e.key));let i=j.current;if(e.target!==i||!Xn.includes(e.key))return;e.preventDefault();let a=O().filter(e=>!e.disabled).map(e=>e.ref.current);Yn.includes(e.key)&&a.reverse(),ii(a)}),onBlur:S(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(N.current),P.current=``)}),onPointerMove:S(e.onPointerMove,li(e=>{let t=e.target,n=R.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>R.current?`right`:`left`;L.current=t,R.current=e.clientX}}))})})})})})})});vr.displayName=Q;var Cr=`MenuGroup`,wr=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(g.div,{role:`group`,...r,ref:t})});wr.displayName=Cr;var Tr=`MenuLabel`,Er=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(g.div,{...r,ref:t})});Er.displayName=Tr;var Dr=`MenuItem`,Or=`menu.itemSelect`,kr=E.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:i,...a}=e,o=E.useRef(null),s=cr(Dr,e.__scopeMenu),c=_r(Dr,e.__scopeMenu),l=r(t,o),u=E.useRef(!1),d=()=>{let e=o.current;if(!n&&e){let t=new CustomEvent(Or,{bubbles:!0,cancelable:!0});e.addEventListener(Or,e=>i?.(e),{once:!0}),h(e,t),t.defaultPrevented?u.current=!1:s.onClose()}};return(0,D.jsx)(Ar,{...a,ref:l,disabled:n,onClick:S(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:S(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:S(e.onKeyDown,e=>{n||e.target!==e.currentTarget||c.searchRef.current!==``&&e.key===` `||qn.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});kr.displayName=Dr;var Ar=E.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:i=!1,textValue:a,...o}=e,s=_r(Dr,n),c=ar(n),l=E.useRef(null),u=r(t,l),[d,f]=E.useState(!1),[p,m]=E.useState(``);return E.useEffect(()=>{let e=l.current;e&&m((e.textContent??``).trim())},[o.children]),(0,D.jsx)(er.ItemSlot,{scope:n,disabled:i,textValue:a??p,children:(0,D.jsx)(Kn,{asChild:!0,...c,focusable:!i,children:(0,D.jsx)(g.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,...o,ref:u,onPointerMove:S(e.onPointerMove,li(e=>{i?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:S(e.onPointerLeave,li(e=>s.onItemLeave(e))),onFocus:S(e.onFocus,()=>f(!0)),onBlur:S(e.onBlur,()=>f(!1))})})})}),jr=`MenuCheckboxItem`,Mr=E.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,D.jsx)(Br,{scope:e.__scopeMenu,checked:n,children:(0,D.jsx)(kr,{role:`menuitemcheckbox`,"aria-checked":ni(n)?`mixed`:n,...i,ref:t,"data-state":ri(n),onSelect:S(i.onSelect,()=>r?.(ni(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Mr.displayName=jr;var Nr=`MenuRadioGroup`,[Pr,Fr]=X(Nr,{value:void 0,onValueChange:()=>{}}),Ir=E.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=f(r);return(0,D.jsx)(Pr,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,D.jsx)(wr,{...i,ref:t})})});Ir.displayName=Nr;var Lr=`MenuRadioItem`,Rr=E.forwardRef((e,t)=>{let{value:n,...r}=e,i=Fr(Lr,e.__scopeMenu),a=n===i.value;return(0,D.jsx)(Br,{scope:e.__scopeMenu,checked:a,children:(0,D.jsx)(kr,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":ri(a),onSelect:S(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Rr.displayName=Lr;var zr=`MenuItemIndicator`,[Br,Vr]=X(zr,{checked:!1}),Hr=E.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Vr(zr,n);return(0,D.jsx)(T,{present:r||ni(a.checked)||a.checked===!0,children:(0,D.jsx)(g.span,{...i,ref:t,"data-state":ri(a.checked)})})});Hr.displayName=zr;var Ur=`MenuSeparator`,Wr=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(g.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Wr.displayName=Ur;var Gr=`MenuArrow`,Kr=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=ir(n);return(0,D.jsx)(yn,{...i,...r,ref:t})});Kr.displayName=Gr;var qr=`MenuSub`,[Jr,Yr]=X(qr),Xr=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Z(qr,t),o=ir(t),[s,c]=E.useState(null),[l,u]=E.useState(null),d=f(i);return E.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,D.jsx)(gn,{...o,children:(0,D.jsx)(or,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,D.jsx)(Jr,{scope:t,contentId:v(),triggerId:v(),trigger:s,onTriggerChange:c,children:n})})})};Xr.displayName=qr;var Zr=`MenuSubTrigger`,Qr=E.forwardRef((e,t)=>{let n=Z(Zr,e.__scopeMenu),i=cr(Zr,e.__scopeMenu),a=Yr(Zr,e.__scopeMenu),o=_r(Zr,e.__scopeMenu),s=E.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,u={__scopeMenu:e.__scopeMenu},d=E.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);E.useEffect(()=>d,[d]),E.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),l(null)}},[c,l]);let f=r(t,a.onTriggerChange);return(0,D.jsx)(dr,{asChild:!0,...u,children:(0,D.jsx)(Ar,{id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?a.contentId:void 0,"data-state":ti(n.open),...e,ref:f,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:S(e.onPointerMove,li(t=>{o.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:S(e.onPointerLeave,li(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,a=i?-5:5,s=t[i?`left`:`right`],l=t[i?`right`:`left`];o.onPointerGraceIntentChange({area:[{x:e.clientX+a,y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:r}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:S(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||o.searchRef.current!==``&&t.key===` `||Zn[i.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Qr.displayName=Zr;var $r=`MenuSubContent`,ei=E.forwardRef((e,t)=>{let n=mr(Q,e.__scopeMenu),{forceMount:i=n.forceMount,align:a=`start`,...o}=e,s=Z(Q,e.__scopeMenu),c=cr(Q,e.__scopeMenu),l=Yr($r,e.__scopeMenu),u=E.useRef(null),d=r(t,u);return(0,D.jsx)(er.Provider,{scope:e.__scopeMenu,children:(0,D.jsx)(T,{present:i||s.open,children:(0,D.jsx)(er.Slot,{scope:e.__scopeMenu,children:(0,D.jsx)(Sr,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:d,align:a,side:c.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&u.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:S(e.onFocusOutside,e=>{e.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:S(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:S(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Qn[c.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})});ei.displayName=$r;function ti(e){return e?`open`:`closed`}function ni(e){return e===`indeterminate`}function ri(e){return ni(e)?`indeterminate`:e?`checked`:`unchecked`}function ii(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ai(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function oi(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ai(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function si(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ci(e,t){return t?si({x:e.clientX,y:e.clientY},t):!1}function li(e){return t=>t.pointerType===`mouse`?e(t):void 0}var ui=lr,di=dr,fi=hr,pi=vr,mi=wr,hi=Er,gi=kr,_i=Mr,vi=Ir,yi=Rr,bi=Hr,xi=Wr,Si=Kr,Ci=Xr,wi=Qr,Ti=ei,Ei=`DropdownMenu`,[Di,Oi]=y(Ei,[rr]),$=rr(),[ki,Ai]=Di(Ei),ji=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=$(t),l=E.useRef(null),[u,d]=p({prop:i,defaultProp:a??!1,onChange:o,caller:Ei});return(0,D.jsx)(ki,{scope:t,triggerId:v(),triggerRef:l,contentId:v(),open:u,onOpenChange:d,onOpenToggle:E.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,D.jsx)(ui,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};ji.displayName=Ei;var Mi=`DropdownMenuTrigger`,Ni=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:i=!1,...a}=e,o=Ai(Mi,n),s=$(n),c=r(t,o.triggerRef);return(0,D.jsx)(di,{asChild:!0,...s,children:(0,D.jsx)(g.button,{type:`button`,id:o.triggerId,"aria-haspopup":`menu`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?`open`:`closed`,"data-disabled":i?``:void 0,disabled:i,...a,ref:c,onPointerDown:S(e.onPointerDown,e=>{!i&&e.button===0&&e.ctrlKey===!1&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:S(e.onKeyDown,e=>{i||([`Enter`,` `].includes(e.key)&&o.onOpenToggle(),e.key===`ArrowDown`&&o.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Ni.displayName=Mi;var Pi=`DropdownMenuPortal`,Fi=e=>{let{__scopeDropdownMenu:t,...n}=e,r=$(t);return(0,D.jsx)(fi,{...r,...n})};Fi.displayName=Pi;var Ii=`DropdownMenuContent`,Li=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ai(Ii,n),a=$(n),o=E.useRef(!1);return(0,D.jsx)(pi,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:S(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:S(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Li.displayName=Ii;var Ri=`DropdownMenuGroup`,zi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(mi,{...i,...r,ref:t})});zi.displayName=Ri;var Bi=`DropdownMenuLabel`,Vi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(hi,{...i,...r,ref:t})});Vi.displayName=Bi;var Hi=`DropdownMenuItem`,Ui=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(gi,{...i,...r,ref:t})});Ui.displayName=Hi;var Wi=`DropdownMenuCheckboxItem`,Gi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(_i,{...i,...r,ref:t})});Gi.displayName=Wi;var Ki=`DropdownMenuRadioGroup`,qi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(vi,{...i,...r,ref:t})});qi.displayName=Ki;var Ji=`DropdownMenuRadioItem`,Yi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(yi,{...i,...r,ref:t})});Yi.displayName=Ji;var Xi=`DropdownMenuItemIndicator`,Zi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(bi,{...i,...r,ref:t})});Zi.displayName=Xi;var Qi=`DropdownMenuSeparator`,$i=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(xi,{...i,...r,ref:t})});$i.displayName=Qi;var ea=`DropdownMenuArrow`,ta=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(Si,{...i,...r,ref:t})});ta.displayName=ea;var na=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=$(t),[s,c]=p({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,D.jsx)(Ci,{...o,open:s,onOpenChange:c,children:n})},ra=`DropdownMenuSubTrigger`,ia=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(wi,{...i,...r,ref:t})});ia.displayName=ra;var aa=`DropdownMenuSubContent`,oa=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(Ti,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});oa.displayName=aa;var sa=ji,ca=Ni,la=Fi,ua=Li,da=Vi,fa=Ui,pa=Gi,ma=qi,ha=Yi,ga=Zi,_a=$i,va=na,ya=ia,ba=oa;function xa({...e}){return(0,D.jsx)(sa,{"data-slot":`dropdown-menu`,...e})}function Sa({...e}){return(0,D.jsx)(la,{"data-slot":`dropdown-menu-portal`,...e})}function Ca({...e}){return(0,D.jsx)(ca,{"data-slot":`dropdown-menu-trigger`,...e})}function wa({className:e,sideOffset:t=4,...n}){return(0,D.jsx)(la,{children:(0,D.jsx)(ua,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:i(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] max-w-(--radix-dropdown-menu-content-available-width) [overflow-wrap:anywhere] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,e),...n})})}function Ta({className:e,inset:t,variant:n=`default`,...r}){return(0,D.jsx)(fa,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:i(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:ps-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function Ea({className:e,children:t,checked:r,...a}){return(0,D.jsxs)(pa,{"data-slot":`dropdown-menu-checkbox-item`,className:i(`relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pe-2 ps-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n({checked:r}),...a,children:[(0,D.jsx)(`span`,{className:`pointer-events-none absolute start-2 flex size-3.5 items-center justify-center`,children:(0,D.jsx)(ga,{children:(0,D.jsx)(u,{className:`size-4`})})}),t]})}function Da({...e}){return(0,D.jsx)(ma,{"data-slot":`dropdown-menu-radio-group`,...e})}function Oa({className:e,children:t,...n}){return(0,D.jsxs)(ha,{"data-slot":`dropdown-menu-radio-item`,className:i(`relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pe-2 ps-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[(0,D.jsx)(`span`,{className:`pointer-events-none absolute start-2 flex size-3.5 items-center justify-center`,children:(0,D.jsx)(ga,{children:(0,D.jsx)(l,{className:`size-2 fill-current`})})}),t]})}function ka({className:e,inset:t,...n}){return(0,D.jsx)(da,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:i(`px-2 py-1.5 text-sm font-medium data-[inset]:ps-8`,e),...n})}function Aa({className:e,...t}){return(0,D.jsx)(_a,{"data-slot":`dropdown-menu-separator`,className:i(`-mx-1 my-1 h-px bg-border`,e),...t})}function ja({...e}){return(0,D.jsx)(va,{"data-slot":`dropdown-menu-sub`,...e})}function Ma({className:e,inset:t,children:n,...r}){return(0,D.jsxs)(ya,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:i(`flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:ps-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,D.jsx)(c,{className:`ms-auto size-4`})]})}function Na({className:e,...t}){return(0,D.jsx)(ba,{"data-slot":`dropdown-menu-sub-content`,className:i(`z-50 min-w-[8rem] max-w-(--radix-dropdown-menu-content-available-width) [overflow-wrap:anywhere] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,e),...t})}export{A as C,M as S,_n as _,ka as a,gn as b,Oa as c,Na as d,Ma as f,Nn as g,Gn as h,Ta as i,Aa as l,Kn as m,Ea as n,Sa as o,Ca as p,wa as r,Da as s,xa as t,ja as u,yn as v,O as w,$t as x,vn as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{E as o,I as s,M as c,d as l,lt as u}from"./design-icons-DmYTv2r1.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{n as f,r as p,t as m}from"./diff-controls-BHF0Pvdc.js";import{s as h}from"./popover-s-Wchzjn.js";import{i as g,p as _,r as v,t as y}from"./dropdown-menu-CjLqyqwB.js";import{ar as b,at as x}from"./index-C2zVqh-_.js";var S=d(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),C=d(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),w=e(i(),1),T=a();function E({root:e,selected:t,onSelect:n}){return(0,T.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function D({adds:e,dels:t}){return(0,T.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] font-medium tabular-nums`,children:[e>0?(0,T.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,T.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function O({dir:e,depth:t,selected:n,onSelect:i}){let[a,s]=(0,w.useState)(!0);return(0,T.jsxs)(`li`,{children:[(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":a?`open`:`closed`,"aria-expanded":a,onClick:()=>s(e=>!e),className:`flex min-h-11 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,T.jsx)(l,{size:16,"aria-hidden":`true`,className:r(`size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,a&&`rotate-90`)}),(0,T.jsx)(o,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,T.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]}),a?(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:t+1,selected:n,onSelect:i},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:t+1,selected:n,onSelect:i},e.path))]}):null]})}var k={added:`text-success`,deleted:`text-danger`};function A({file:e,depth:t,selected:n,onSelect:i}){let a=n===e.path;return(0,T.jsx)(`li`,{children:(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":a?`true`:void 0,onClick:()=>i(e.path),className:r(`flex min-h-11 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,a?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,T.jsx)(C,{"aria-hidden":`true`,className:r(`size-3.5 shrink-0`,k[e.status])}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]})})}function j(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function M(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(M)}}var N=(e,t)=>e.name.localeCompare(t.name);function P(e){let t=j(``,``),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=j(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(N),e.files.sort(N)};return i(t),{...t,dirs:t.dirs.map(M)}}function F({bar:e,healthReady:t,branch:i,stat:a,mode:o,wrap:s,preview:c=!1,onModeChange:l,onWrapChange:u,onPreviewChange:d,onAction:h}){return(0,T.jsxs)(`div`,{"data-slot":`git-toolbar`,"data-health-ready":t,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 px-[18px] py-[22px] md:px-9 [&_button]:min-h-11`,children:[i?(0,T.jsx)(m,{branch:i}):null,a?(0,T.jsx)(R,{stat:a}):null,d?(0,T.jsx)(`span`,{className:`ml-auto flex items-center`,children:(0,T.jsx)(p,{preview:c,onPreviewChange:d})}):null,(0,T.jsxs)(`span`,{className:r(`flex items-center gap-1`,d?`max-md:ml-auto`:`ml-auto`),children:[(0,T.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,T.jsx)(f,{mode:o,wrap:s,onModeChange:l,onWrapChange:u})}),e.secondary.map(e=>(0,T.jsx)(L,{action:e,variant:`outline`,onAction:h},e.id)),(0,T.jsx)(L,{action:e.primary,variant:`primary`,onAction:h}),e.menu.length>0?(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{asChild:!0,children:(0,T.jsx)(n,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,children:(0,T.jsx)(S,{"aria-hidden":`true`})})}),(0,T.jsx)(v,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,T.jsxs)(g,{disabled:!e.enabled,title:e.reason,onSelect:()=>h(e.id),children:[I[e.id],e.label]},e.id))})]}):null]})]})}var I={commit:(0,T.jsx)(c,{size:16,"aria-hidden":`true`}),push:(0,T.jsx)(u,{size:16,"aria-hidden":`true`}),"create-pr":(0,T.jsx)(s,{size:16,"aria-hidden":`true`}),"view-pr":(0,T.jsx)(h,{"aria-hidden":`true`}),"open-terminal":(0,T.jsx)(b,{"aria-hidden":`true`})};function L({action:e,variant:r,onAction:i}){return e.id===`view-pr`?t(e.href)?(0,T.jsx)(n,{asChild:!0,variant:r,size:`sm`,"data-action":e.id,children:(0,T.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[I[e.id],e.label]})}):(0,T.jsxs)(n,{variant:r,size:`sm`,"data-action":e.id,disabled:!0,title:`View PR unavailable — the recorded PR link is not an http(s) URL`,children:[I[e.id],e.label]}):(0,T.jsxs)(n,{variant:r,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>i(e.id),children:[I[e.id],e.label]})}function R({stat:e}){return(0,T.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,T.jsx)(x,{stat:{adds:z(e.adds),dels:z(e.dels),files:e.files}})})}function z(e){let[t,n]=(0,w.useState)(e),r=(0,w.useRef)(e);return(0,w.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{E as i,F as n,P as r,R as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,L as n,M as r,t as i,u as a}from"./button-CS5tOblf.js";import{i as o,t as s}from"./react-runtime-CCIEwYL0.js";import"./live-refetch-CstQIN6c.js";import{$ as c,Bn as l,Kr as u,Q as d,X as f,et as p,ti as m,tn as h}from"./project-scope-context-wlB-Y0ii.js";import{An as g,Cn as _,D as v,E as y,N as b,P as ee,Pt as te,Un as x,X as S,j as ne,k as C,l as w,n as T}from"./queries-BPdWfTBN.js";import{n as E}from"./toaster-CRVRHlMR.js";import{I as D,L as O,Q as k,Z as A,ct as j,l as M,m as N,r as P,u as F}from"./design-icons-DmYTv2r1.js";import{l as re,n as ie}from"./nav-row-styles-CEA9c88Q.js";import{i as I,r as L,t as R}from"./popover-s-Wchzjn.js";import{a as z,i as B}from"./format-BNCkW110.js";import{r as ae,t as V}from"./project-router-Dd63wBeA.js";import{t as H}from"./centered-state-BmsqxbI8.js";import{An as U,Dn as oe,En as se,Nt as ce,_r as le,a as ue,bt as de,c as W,d as fe,f as pe,i as me,jn as he,kn as ge,l as _e,lt as ve,m as ye,n as be,nr as xe,o as Se,ot as Ce,p as we,r as Te,s as Ee,t as De,u as Oe,vr as ke}from"./index-C2zVqh-_.js";import{a as Ae,d as je,f as Me,i as Ne,l as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze,u as G}from"./use-hand-to-agent-state-B0KY1uOs.js";import{t as K}from"./tab-link-CDrve3Rf.js";var q=e(o(),1),J=`cez-github-list-width`;function Y(e){if(e==null||e===``||typeof e==`string`&&e.trim()===``)return 360;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(520,Math.max(280,Math.round(t))):360}function Be(){try{let e=localStorage.getItem(J);return e===null?360:Y(e)}catch{return 360}}function Ve(e){try{localStorage.setItem(J,String(Y(e)))}catch{}}var X=s();function He({number:e,repo:t}){let n=r();return(0,X.jsx)(Ue,{number:e,repo:t,scope:n},JSON.stringify([n,t,e]))}function Ue({number:e,repo:t,scope:n}){let r=(0,q.useId)(),a=(0,q.useId)(),[o,s]=(0,q.useState)(!1),c=o?ke:le,u=S(n,!0,n==="default"),d=w(`#${e}`,!0),f=(0,q.useMemo)(()=>fe(g(u.data??[],d.data?.pages.flatMap(e=>e.runs)??[]),e,t,n),[u.data,d.data,e,t,n]);return(0,X.jsxs)(`section`,{"aria-labelledby":r,className:`mt-4 min-w-0 rounded-lg border border-border p-3`,children:[(0,X.jsx)(`h3`,{id:r,className:`text-xs font-semibold text-muted-foreground`,children:(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":o,"aria-controls":a,onClick:()=>s(e=>!e),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-left hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,X.jsx)(c,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,X.jsxs)(`span`,{children:[`Linked tasks`,u.data?` (${f.length}${d.hasNextPage||d.isError?`+`:``})`:``]})]})}),(0,X.jsx)(`div`,{id:a,children:o?(0,X.jsxs)(X.Fragment,{children:[u.isPending?(0,X.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:`Loading linked tasks…`}):null,u.isError?(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Couldn’t load linked tasks. Check your connection and try again.`}),(0,X.jsx)(i,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void u.refetch(),disabled:u.isFetching,children:`Retry linked tasks`})]}):null,u.data&&f.length===0&&!u.isError?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No linked tasks yet.`}):null,f.length>0?(0,X.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:f.map(e=>{let t=l(e);return(0,X.jsx)(`li`,{children:(0,X.jsxs)(V,{to:`/tasks/${encodeURIComponent(e.id)}`,className:`flex min-h-11 min-w-0 flex-col justify-center gap-1 rounded-md px-2 py-2 hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium break-words [overflow-wrap:anywhere]`,children:_(e)}),(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(de,{tone:t.tone,shape:t.shape,pulse:t.pulse,role:`img`,"aria-label":t.label,title:t.label}),e.archived?(0,X.jsx)(`span`,{className:`rounded border border-border px-1`,children:`Archived`}):null,(0,X.jsx)(`time`,{dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleDateString()})]})]})},e.id)})}):null,d.isError?(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Couldn’t load older archived linked tasks.`}),(0,X.jsx)(i,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.refetch(),disabled:d.isFetching,children:`Retry older linked tasks`})]}):d.hasNextPage?(0,X.jsx)(i,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.fetchNextPage(),disabled:d.isFetchingNextPage,children:d.isFetchingNextPage?`Loading older linked tasks…`:`Show older linked tasks`}):null]}):null})]})}var Z=`w-44 max-w-full`,Q=`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm text-foreground focus-visible:outline-ring disabled:opacity-50`;function We(e,t){let n=new Map;for(let t of e)for(let e of t.assignees??[])n.set(e.toLowerCase(),e);for(let e of t)n.set(e.toLowerCase(),e);return[...n.values()].sort((e,t)=>e.localeCompare(t))}function Ge(e,t){return!!e&&t.length===1&&t[0]?.toLowerCase()===e.toLowerCase()}function Ke(e){let t=` Previous memberships are shown; issues with unknown membership remain visible.`;return e.projectsState===`refreshing`&&e.projects?`Refreshing project boards.${t}`:e.projectsState===`unavailable`&&e.projects?`${e.projectsReason}${t}`:e.projects?``:e.projectsReason??(e.projectsState===`refreshing`?`Project memberships pending.`:`Project boards unavailable.`)}function qe(e){return[e.viewerLogin?``:`GitHub login unavailable.`,Ke(e)].filter(Boolean).join(` `)}function Je({options:e,assignees:t,onAssigneesChange:n}){return(0,X.jsxs)(R,{children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:Q,disabled:e.length===0,children:[`Assignee`,t.length?` · ${t.length}`:``,(0,X.jsx)(F,{size:12,"aria-hidden":`true`,className:`ml-1 inline size-3 shrink-0 align-[-1px] text-soft-foreground`})]})}),(0,X.jsx)(L,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,X.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,X.jsx)(`legend`,{className:`px-2 text-xs text-muted-foreground`,children:`Match any selected assignee`}),e.map(e=>{let r=t.some(t=>t.toLowerCase()===e.toLowerCase());return(0,X.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>n(r?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,X.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]})}function Ye({data:e,projectId:t,onProjectChange:n,pickerRef:r}){return e.projects?.length?(0,X.jsxs)(`select`,{ref:r,"aria-label":`Project board`,className:`${Q} ${Z}`,value:t,onChange:e=>n(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`All boards`}),e.projects.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.title},e.id))]}):e.projects||e.projectsState?(0,X.jsx)(`select`,{ref:r,"aria-label":`Project board`,className:`${Q} ${Z}`,disabled:!0,value:``,children:(0,X.jsx)(`option`,{value:``,children:e.projects?`No boards`:e.projectsState===`refreshing`?`Loading boards…`:`Boards unavailable`})}):null}function Xe({data:e,message:t,lastMessage:n,hasMessage:r,statusOpen:i,setStatusOpen:a,triggerRef:o,contentRef:s}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{role:`status`,className:`sr-only`,children:t}),(0,X.jsxs)(R,{open:i,onOpenChange:a,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(`button`,{ref:o,type:`button`,className:`${Q} inline-flex items-center justify-center ${t?``:`invisible`}`,"aria-label":`Project board status`,tabIndex:t?void 0:-1,children:e.projectsState===`refreshing`?(0,X.jsx)(A,{size:14,"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):(0,X.jsx)(j,{size:14,"aria-hidden":`true`,className:`size-3.5`})})}),(0,X.jsx)(L,{ref:s,align:`start`,"data-slot":`gh-issue-status`,onCloseAutoFocus:e=>{r||e.preventDefault()},className:`w-72 max-w-[calc(100vw-2rem)] p-3 text-xs text-muted-foreground`,children:t||n.current})]})]})}function Ze({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let[a,o]=(0,q.useState)(!1),s=(0,q.useRef)(null),c=(0,q.useRef)(null),l=(0,q.useRef)(null),u=(0,q.useRef)(null),d=We(e.issues,t),f=Ge(e.viewerLogin,t),p=qe(e),m=p!==``,h=(0,q.useRef)(p);m&&(h.current=p);let g=(0,q.useRef)(!m);g.current=!m;let _=()=>(l.current&&!l.current.disabled?l.current:u.current)?.focus();return(0,q.useEffect)(()=>{let e=s.current;if(!e)return;let t=e=>{g.current&&!e.relatedTarget&&requestAnimationFrame(()=>{(!document.activeElement||document.activeElement===document.body)&&_()})};return e.addEventListener(`blur`,t),()=>e.removeEventListener(`blur`,t)},[]),(0,q.useEffect)(()=>{if(m)return;let e=document.activeElement,t=!!e&&(e===s.current||!!c.current?.contains(e));o(!1),t&&_()},[m]),(0,X.jsxs)(`div`,{className:`contents`,"data-slot":`gh-issue-filters`,children:[(0,X.jsx)(Je,{options:d,assignees:t,onAssigneesChange:r}),(0,X.jsx)(`button`,{ref:u,type:`button`,className:`${Q} aria-pressed:border-foreground aria-pressed:bg-foreground aria-pressed:text-background`,disabled:!e.viewerLogin,"aria-pressed":f,onClick:()=>r(f?[]:[e.viewerLogin]),children:`Assigned to me`}),(0,X.jsx)(Ye,{data:e,projectId:n,onProjectChange:i,pickerRef:l}),(0,X.jsx)(Xe,{data:e,message:p,lastMessage:h,hasMessage:m,statusOpen:a,setStatusOpen:o,triggerRef:s,contentRef:c})]})}function Qe({onRefresh:e,refreshing:t}){let n=De(r());return(0,X.jsxs)(`div`,{"data-route":`github`,"data-slot":`github-filter-screen`,className:ie,children:[(0,X.jsxs)(`div`,{className:`mb-[16px] flex items-center gap-[8px]`,children:[(0,X.jsx)(`h1`,{className:a(re,`min-w-0 flex-1`),children:`GitHub`}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`gh-screen-refresh`,"aria-label":`Refresh from GitHub`,title:`Refresh from GitHub`,disabled:t,onClick:e,className:`-my-2 -mr-[10px] flex size-11 shrink-0 items-center justify-center rounded-md text-soft-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,children:(0,X.jsx)(A,{size:17,"aria-hidden":`true`,className:a(`size-[17px]`,t&&`motion-safe:animate-spin`)})})]}),(0,X.jsx)(be,{model:n,variant:`screen`})]})}function $e(e){let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`?e:e.closest(`[data-slot="main"]`)??e}function et(e){let[t,n]=(0,q.useState)(null);return(0,q.useLayoutEffect)(()=>{if(!e){n(null);return}let t=()=>n($e(e));t();let r=typeof window.matchMedia==`function`?window.matchMedia(`(min-width: 768px)`):null;r?.addEventListener(`change`,t);let i=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return i?.observe(e),()=>{r?.removeEventListener(`change`,t),i?.disconnect()}},[e]),t}function tt(e,t){let[n,r]=(0,q.useState)(0);return(0,q.useLayoutEffect)(()=>{let n=()=>{!e||!t||r(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return n(),window.addEventListener(`resize`,n),()=>window.removeEventListener(`resize`,n)},[e,t]),n}function nt(e,t,n){let[r,i]=(0,q.useState)(null),a=(0,q.useRef)(n);return(0,q.useEffect)(()=>{a.current=n}),(0,q.useEffect)(()=>{if(!e||!r||!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&a.current()},{root:t.getAttribute(`data-slot`)===`main`?null:t,rootMargin:`0px 0px 600px 0px`});return n.observe(r),()=>n.disconnect()},[e,r,t]),i}function rt(e,t,n,r,i){let[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(null),l=et(a),u=(0,q.useRef)(null);u.current=l;let d=tt(s,l),f=e===`issues`?n?.issues.length??0:n?.prs.length??0,p=t.hasNextPage&&r===null&&f>0;return{listEl:a,setListEl:o,setRowsEl:c,scrollOwner:l,scrollOwnerRef:u,startMargin:d,pagingAvailable:p,manualPaging:p&&i,loadMoreRef:nt(p&&!i&&!t.isFetchingNextPage&&!t.isFetchNextPageError,l,()=>void t.fetchNextPage())}}var it=100;function at(e,t,n,r,i){if(!e?.available||t!==`prs`)return[];let a=new Set;n!==null&&Number.isInteger(n)&&a.add(n);for(let t of[...r,...i,...e.prs]){if(a.size>=it)break;a.add(t.number)}return[...a]}function ot(e,t,n,r,i,a){let o=at(n,e,r,i,a),s=y(o,e===`prs`),c=s.data?.available?s.data.checks:void 0,l=v(e===`issues`?`issue`:`pr`,(0,q.useMemo)(()=>(t.data?.pages??[]).map(t=>(e===`issues`?t.issues:t.prs).map(e=>e.number)),[t.data,e]),n?.available===!0&&n.commentsDeferred===!0),u=(0,q.useMemo)(()=>new Set(n?.commentsDeferred?(e===`issues`?n.issues:n.prs).map(e=>e.number):[]),[n,e]);return{checkPrNumbers:o,checksMap:c,commentsOf:e=>l[e.number]??(u.has(e.number)?void 0:e.comments)}}function st(e){let[t,n]=ce(),r=t.get(`filter`),i=pe(e,r);return{rawFilterParam:r,filter:i,activeFilter:i??`all`,setFilterParam:e=>n(t=>{let n=new URLSearchParams(t);return e===null?n.delete(`filter`):n.set(`filter`,e),n})}}function ct(e,t,{filter:n,activeFilter:r,setFilterParam:i}){let[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)([]),[l,u]=(0,q.useState)([]),{setProjectFilter:d,activeProject:f}=lt(t),p=e===`issues`&&r===`assigned`,m=p?t?.viewerLogin?[t.viewerLogin]:[]:l;return{query:a,setQuery:o,labelFilter:s,setLabelFilter:c,setProjectFilter:d,activeProject:f,isAssignedFilter:p,effectiveAssignees:m,changeAssignees:e=>{u(e),p&&i(`all`)},clearFilters:()=>{o(``),c([]),u([]),d(``),n!==null&&n!==`all`&&i(`all`)},filtering:a.trim()!==``||s.length>0||e===`issues`&&(m.length>0||f!==``)||n!==null&&n!==`all`,narrowing:a.trim()!==``||s.length>0||e===`issues`&&(!p&&l.length>0||f!==``)}}function lt(e){let[t,n]=(0,q.useState)(``),r=e?.projectsState===`refreshing`||e?.projectsState===`unavailable`,i=r||e?.projects?.some(e=>e.id===t)?t:``;return(0,q.useEffect)(()=>{e&&!r&&t&&!i&&n(``)},[e,t,i,r]),{setProjectFilter:n,activeProject:i}}function ut(e,t,{filter:n,activeFilter:i},a){let o=r(),s=e===`issues`&&(i===`no-task`||i===`has-task`),c=S(o,s,o==="default"),l=(0,q.useMemo)(()=>c.data?Oe(c.data,t?.repo,o):null,[c.data,t?.repo,o]),u=_e(e,n)?ye(n):null,d=b(`pr`,u??``,u!==null&&t?.available===!0),f=u!==null&&d.data?.available?d.data.items:null,p=(0,q.useMemo)(()=>t?.available?e===`issues`?t.issues:t.prs:[],[t,e]),m=(0,q.useMemo)(()=>f?we(f,p):null,[f,p]),h=dt({view:e,gh:t,activeFilter:i,isAssignedFilter:a,taskFilter:s,taskNumbers:l,runsQuery:c,backedQuery:u,filterHits:f,filterSearch:d});return{backedQuery:u,filterSearch:d,fullList:p,filterRows:m,filterGate:h,openItems:(0,q.useMemo)(()=>h?[]:m??p,[h,m,p]),narrow:(0,q.useMemo)(()=>e===`issues`?i===`no-task`&&l?{excludeNumbers:l}:i===`has-task`&&l?{includeNumbers:l}:{}:i===`mine`&&t?.viewerLogin?{author:t.viewerLogin}:f?{includeNumbers:new Set(f.map(e=>e.number))}:{},[e,i,l,t?.viewerLogin,f])}}function dt({view:e,gh:t,activeFilter:n,isAssignedFilter:r,taskFilter:i,taskNumbers:a,runsQuery:o,backedQuery:s,filterHits:c,filterSearch:l}){return t?.available?(r||e===`prs`&&n===`mine`)&&!t.viewerLogin?{kind:`blocked`,message:`GitHub login unavailable, so this filter cannot be applied.`}:i&&!a?o.isError?{kind:`blocked`,message:`The task list is unavailable, so this filter cannot be applied.`}:{kind:`loading`,message:`Loading tasks…`}:s!==null&&!c?l.data?.available===!1?{kind:`blocked`,message:`GitHub could not be searched: ${l.data.reason??`unknown reason`}.`}:l.isError?{kind:`blocked`,message:`GitHub could not be searched: ${l.error instanceof Error?l.error.message:`the search request failed`}.`}:{kind:`loading`,message:`Searching GitHub…`}:null:null}function $(e,t){return t?p(t.kind,t.number,{refresh:!0}).then(n=>(e.setQueryData(t.key,n),!0)).catch(()=>!1):Promise.resolve(!0)}function ft(e,t,n,{filterGate:r,filterRows:i,fullList:a}){let o=T.github()[0],s=t===void 0?null:Number.parseInt(t,10),c=!r&&n.data?.available?n.data.items.find(e=>e.number===s):void 0,l=i&&s!==null&&!a.some(e=>e.number===s)?i.find(e=>e.number===s):void 0,u=c??l,[d,f]=(0,q.useState)(null);return(0,q.useEffect)(()=>{u&&f({scope:o,view:e,item:u})},[o,e,u]),{selectedNumber:s,remoteDetail:u??(d?.scope===o&&d.view===e&&d.item.number===s?d.item:null)}}function pt(e,t,n,{fullList:r,filterRows:i},a){let o=u(),s=(0,q.useRef)(null),c=e===`issues`?`issue`:`pr`,l=t?.available===!0&&n!==null&&Number.isSafeInteger(n)&&n>0&&!r.some(e=>e.number===n)&&!i?.some(e=>e.number===n)&&a===null,d=C(c,n??0,l),f=l&&d.data?.available&&d.data.item?.kind===c?d.data.item:null;s.current=l&&n!==null?{kind:c,number:n,key:T.githubItem(c,n)}:null;let[p,m]=(0,q.useState)(!1);return{exactWanted:l,exactItem:d,exactDetail:f,exactTargetRef:s,retryingExact:p,retryExact:()=>{m(!0),$(o,s.current).then(e=>{m(!1),e||E(`Could not reach GitHub for #${n}`,{tone:`danger`})})}}}function mt(e,t,n){let r=u(),i=(0,q.useRef)(null);return{refresh:x({mutationFn:e=>($(r,e),f({refresh:!0,limit:50})),onSuccess:async a=>{await r.cancelQueries({queryKey:T.githubPages(50),exact:!0}),r.setQueryData(T.githubPages(50),{pages:[a],pageParams:[{}]}),r.invalidateQueries({queryKey:T.githubChecks(t)});let o=e===`issues`?`issue`:`pr`,s=(e===`issues`?a.issues:a.prs).map(e=>e.number),l=T.githubCommentCounts(o,s);r.removeQueries({queryKey:T.githubCommentCounts(o,[]).slice(0,4),predicate:e=>e.queryHash!==m(l)}),a.available&&a.commentsDeferred&&s.length>0&&d(o,s,{refresh:!0}).then(e=>r.setQueryData(l,e)).catch(()=>{}),r.invalidateQueries({queryKey:T.githubSearch(e===`issues`?`issue`:`pr`,n)}),r.invalidateQueries({queryKey:T.githubSearch(`pr`,Ee)}),r.invalidateQueries({queryKey:T.githubSearch(`pr`,me)});let u=i.current;if(!u){r.removeQueries({queryKey:[`github`,`comments`]});return}let f=T.githubComments(u.kind,u.number);c(u.kind,u.number,{refresh:!0}).then(e=>r.setQueryData(f,e)).catch(()=>{}),r.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==m(f)})},onError:e=>E(e.message,{tone:`danger`})}),openThreadRef:i}}var ht=350;function gt(e,t){let[n,r]=(0,q.useState)(e);return(0,q.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function _t(e,t,{query:n,labelFilter:r,effectiveAssignees:i,activeProject:a},{openItems:o,narrow:s,filterGate:c}){let l=gt(n,ht),u=(0,q.useMemo)(()=>G(o,{query:l,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),[o,l,r,e,i,a,s]),d=n.trim()===l.trim(),f=t?.available===!0&&!c&&d&&Me(l,u),p=b(e===`issues`?`issue`:`pr`,l,f),m=G(o,{query:n,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),h=f&&p.data?.available?p.data:null,g=new Set(m.map(e=>e.number)),_=vt(e,h,a,i);return{debouncedQuery:l,searchWanted:f,forgeSearch:p,items:m,searchPayload:h,metadataFailure:_,searchHits:h&&!_?G(h.items,{labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}).filter(e=>!g.has(e.number)):[],...yt(n,d,f,p)}}function vt(e,t,n,r){return e===`issues`&&t?n&&t.items.some(e=>e.projectIds===void 0)?t.projectsReason??`Project board data is incomplete. Refresh to try again.`:r.length&&t.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null}function yt(e,t,n,r){return{searching:e.trim()!==``&&!t||n&&r.isPending,searchFailed:n&&(r.data?.available===!1||r.isError),searchFailureReason:r.data?.available===!1?r.data.reason??`unknown reason`:r.error instanceof Error?r.error.message:`the search request failed`}}function bt({width:e,onWidthChange:t}){let n=(0,q.useRef)(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(Y(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,X.jsx)(`div`,{"data-slot":`gh-list-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the GitHub list`,"aria-valuenow":e,"aria-valuemin":280,"aria-valuemax":520,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?280:n.key===`End`?520:null;r!==null&&(n.preventDefault(),t(Y(r)))},onDoubleClick:()=>t(360),title:`Drag to resize the GitHub list — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 hidden w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-accent-strong/40 focus-visible:bg-accent-strong/60 focus-visible:outline-none md:block`})}function xt({view:e,changes:n=!1,index:r=!1}){let{n:i}=t(),a=st(e),{rawFilterParam:o,activeFilter:s}=a,c=Ce(),{pages:l,data:u}=ne(50),d=ee().data?.capabilities?.automations===!0,f=Ct(),p=ze(),m=St({index:r,isDesktop:c,rawFilterParam:o,n:i,rememberedView:te().data?.githubView}),h=wt(u?.available===!0&&!m.filterScreen),[g,_]=(0,q.useState)(!1),v=ct(e,u,a),y=ut(e,u,a,v.isAssignedFilter),b=_t(e,u,v,y),x=ft(e,i,b.forgeSearch,y),S=pt(e,u,x.selectedNumber,y,x.remoteDetail),C=ot(e,l,u,x.selectedNumber,b.searchHits,y.openItems),{refresh:w,openThreadRef:T}=mt(e,C.checkPrNumbers,b.debouncedQuery),E=rt(e,l,u,y.backedQuery,v.narrowing);if(m.restorePrs)return(0,X.jsx)(ae,{to:`/github/prs`,replace:!0});if(!u)return l.isError?(0,X.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(H,{icon:(0,X.jsx)(j,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:l.error.message})}):(0,X.jsx)(xe,{});T.current=null;let D=()=>w.mutate(S.exactTargetRef.current);if(m.filterScreen&&u.available)return(0,X.jsx)(Qe,{onRefresh:D,refreshing:w.isPending});if(!u.available)return(0,X.jsx)(kt,{reason:u.reason,refreshing:w.isPending,onRetry:D});let{labelColors:O,labelOptions:k}=Tt(u,b.searchPayload,y.openItems,y.fullList),A=Et({number:x.selectedNumber,items:b.items,searchHits:b.searchHits,fullList:y.fullList,filterRows:y.filterRows,remoteDetail:x.remoteDetail,exactDetail:S.exactDetail});T.current=A?{kind:A.kind,number:A.number}:null;let{linkFilter:M,listPath:N}=Dt(e,o,s,c),P={view:e,filter:M,colors:O,selected:A,queued:p.queued,checksMap:C.checksMap,commentsOf:C.commentsOf},F=Ot(e,v,y.filterGate,b);return(0,X.jsxs)(`div`,{ref:h.routeRef,"data-route":`github`,className:`flex min-h-full flex-col gap-3 px-[18px] pt-[18px] pb-[calc(90px+env(safe-area-inset-bottom))] md:gap-[22px] md:px-7 md:pt-4 md:pb-4`,children:[(0,X.jsx)(At,{view:e,activeFilter:s,isDesktop:c,rawFilterParam:o,n:i,gh:u}),(0,X.jsxs)(`div`,{ref:h.workspaceRef,"data-slot":`gh-workspace`,"data-stacked":h.panesStacked,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 md:h-[calc(var(--gh-workspace-height,calc(100dvh-4rem))-1rem)] md:flex-none md:gap-[22px]`,children:[(0,X.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 bg-background md:gap-[22px]`,children:[(0,X.jsx)(jt,{view:e,isDesktop:c,gh:u,automationsAvailable:d,onSaveView:f,refreshing:w.isPending,onRefresh:D}),(0,X.jsx)(Mt,{view:e,gh:u,filters:v,labelOptions:k,labelColors:O,searchPayload:b.searchPayload})]}),(0,X.jsxs)(`div`,{"data-slot":`gh-panes`,className:`flex min-h-0 min-w-0 flex-1 flex-col items-start gap-[22px] md:flex-row md:items-stretch md:overflow-hidden`,children:[(0,X.jsx)(Ft,{view:e,n:i,rows:P,verdict:F,search:b,sidebar:y,list:l,paging:E,width:h.githubListWidth,onWidthChange:h.changeGithubListWidth,expanded:g,onExpandedChange:_}),(0,X.jsx)(Vt,{view:e,n:i,selected:A,selectedNumber:x.selectedNumber,exact:S,repo:u.repo,rows:P,listPath:N,changes:n,handToAgent:p})]})]})]})}function St({index:e,isDesktop:t,rawFilterParam:n,n:r,rememberedView:i}){return{filterScreen:e&&!t&&n===null&&r===void 0,restorePrs:e&&t&&n===null&&i===`prs`}}function Ct(){let e=u();return t=>{e.setQueryData(T.uiState,e=>({...e,githubView:t})),h({githubView:t}).then(t=>e.setQueryData(T.uiState,t)).catch(t=>{E(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:T.uiState})})}}function wt(e){let[t,n]=(0,q.useState)(Be),[r,i]=(0,q.useState)(!0),a=(0,q.useRef)(null),o=(0,q.useRef)(null);return(0,q.useEffect)(()=>{if(!e)return;let n=a.current,r=o.current,s=n?.closest(`[data-slot="main"]`);if(!n||!r||!s)return;let c=window.matchMedia(`(min-width: 768px)`),l=!1,u=()=>{if(l=c.matches&&r.clientWidth>=t+22+360,i(!l),!l||s.clientHeight<1){n.style.removeProperty(`--gh-workspace-height`);return}n.style.setProperty(`--gh-workspace-height`,`${Math.round(s.clientHeight)}px`)};u();let d=new ResizeObserver(u);d.observe(s),d.observe(r);let f=e=>{if(!l||e.ctrlKey||!e.deltaY||Math.abs(e.deltaX)>Math.abs(e.deltaY)||r.getBoundingClientRect().top<=s.getBoundingClientRect().top+1||!(e.target instanceof Element)||!e.target.closest(`[data-slot="gh-panes"]`))return;e.preventDefault();let t=e.deltaMode===1?16:e.deltaMode===2?s.clientHeight:1;s.scrollTop+=e.deltaY*t};return r.addEventListener(`wheel`,f,{passive:!1}),c.addEventListener(`change`,u),()=>{r.removeEventListener(`wheel`,f),d.disconnect(),c.removeEventListener(`change`,u)}},[e,t]),{githubListWidth:t,changeGithubListWidth:e=>{let t=Y(e);n(t),Ve(t)},panesStacked:r,routeRef:a,workspaceRef:o}}function Tt(e,t,n,r){return{labelColors:{...t?.labelColors,...e.labelColors},labelOptions:Pe([...n,...r,...t?.items??[]])}}function Et({number:e,items:t,searchHits:n,fullList:r,filterRows:i,remoteDetail:a,exactDetail:o}){return e===null?t[0]??n[0]??null:r.find(t=>t.number===e)??i?.find(t=>t.number===e)??a??o??null}function Dt(e,t,n,r){let i=t===null?null:n;return{linkFilter:i,listPath:W(e,i??(e===`issues`&&!r?`all`:null))}}function Ot(e,{query:t,filtering:n},r,{searching:i,searchFailed:a,searchFailureReason:o,metadataFailure:s,searchHits:c,searchPayload:l,items:u}){let d=e===`issues`?`issues`:`pull requests`;return r?(0,X.jsxs)(`p`,{role:`status`,className:`flex items-center gap-1.5`,"data-slot":`gh-filter-gate`,"data-kind":r.kind,children:[r.kind===`loading`?(0,X.jsx)(z,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):null,r.message]}):n?i?(0,X.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(z,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,t.trim(),`”…`]}):a?c.length>0?(0,X.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,o,`. Use Refresh to try again.`]}):u.length>0?(0,X.jsxs)(`p`,{children:[`GitHub could not be searched: `,o,`.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,` match your filter, and GitHub could not be searched: `,o,`.`]}):s?(0,X.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,s]}):c.length>0?null:l?.truncated?(0,X.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):l&&u.length>0?(0,X.jsxs)(`p`,{children:[`No additional `,d,` match your filter on GitHub.`]}):l?(0,X.jsxs)(`p`,{children:[`No `,d,` match your filter — open, closed or merged.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,` match your filter.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,`.`]})}function kt({reason:e,refreshing:t,onRetry:r}){return(0,X.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(H,{icon:(0,X.jsx)(O,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:e??`unknown reason`,actions:(0,X.jsx)(i,{variant:`outline`,"data-action":`gh-retry`,disabled:t,onClick:r,children:`Try again`}),children:(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in `,n(`cezar`),` works without it.`]})})})}function At({view:e,activeFilter:t,isDesktop:n,rawFilterParam:r,n:i,gh:a}){return(0,X.jsxs)(`div`,{"data-slot":`gh-masthead`,className:`flex min-w-0 shrink-0 flex-col gap-1 md:flex-row md:items-baseline md:gap-3`,children:[(0,X.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[15px] md:tracking-normal`,children:n?`${e===`issues`?`Issues`:`Pull requests`} · ${Te[t]}`:`GitHub`}),r!==null&&i===void 0?(0,X.jsxs)(`div`,{"data-slot":`gh-filter-context`,className:`flex min-w-0 items-center gap-3 md:hidden`,children:[(0,X.jsxs)(V,{to:`/github`,"data-slot":`gh-back-filters`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,X.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to filters`]}),t===`all`?null:(0,X.jsx)(`span`,{"data-slot":`gh-active-filter`,className:`truncate text-xs text-soft-foreground`,children:[...ue,...Se].find(e=>e.id===t)?.label})]}):null,a.repo?(0,X.jsxs)(`span`,{className:`min-w-0 truncate text-[13px] text-muted-foreground md:text-[11px] md:text-soft-foreground`,children:[(0,X.jsx)(`span`,{"data-slot":`gh-repo`,children:a.repo}),(0,X.jsxs)(`span`,{"data-slot":`gh-synced`,children:[` · `,a.syncedAt?`Synced ${B(a.syncedAt)} ago`:`Not synced yet`]})]}):null]})}function jt({view:e,isDesktop:t,gh:n,automationsAvailable:r,onSaveView:i,refreshing:o,onRefresh:s}){return(0,X.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,X.jsxs)(K,{to:t?`/github`:`/github?filter=all`,active:e===`issues`,onClick:()=>i(`issues`),children:[`Issues · `,n.issuesTotal??n.issues.length]}),(0,X.jsxs)(K,{to:`/github/prs`,active:e===`prs`,onClick:()=>i(`prs`),children:[`Pull requests · `,n.prsTotal??n.prs.length]}),r?(0,X.jsx)(V,{to:`/automations/new`,className:`gh-utility`,children:`Set up automations`}):null,(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:o,onClick:s,className:`gh-utility`,children:[(0,X.jsx)(A,{size:16,"aria-hidden":`true`,className:a(`size-3.5`,o&&`motion-safe:animate-spin`)}),`Refresh`]})]})}function Mt({view:e,gh:t,filters:n,labelOptions:r,labelColors:i,searchPayload:a}){return(0,X.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,X.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,X.jsx)(k,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,X.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:e===`issues`?`Filter issues…`:`Filter pull requests…`,value:n.query,onChange:e=>n.setQuery(e.target.value),className:`min-h-11 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,X.jsx)(qt,{options:r,colors:i,selected:n.labelFilter,onChange:n.setLabelFilter}),e===`issues`?(0,X.jsx)(Ze,{data:{...t,issues:[...t.issues,...a?.items??[]]},assignees:n.effectiveAssignees,projectId:n.activeProject,onAssigneesChange:n.changeAssignees,onProjectChange:n.setProjectFilter}):null,(0,X.jsx)(`button`,{type:`button`,disabled:!n.filtering,className:`min-h-11 min-w-11 rounded-md border border-border bg-card px-4 text-xs disabled:opacity-50`,onClick:n.clearFilters,children:`Clear filters`})]})}function Nt(e,t){return e.kind===`pr`?t?.[e.number]??e.checks:e.checks}function Pt(e,t){return(0,X.jsx)(Kt,{item:e,view:t.view,filter:t.filter,colors:t.colors,active:t.selected?.url===e.url,queued:t.queued.has(e.url),checks:Nt(e,t.checksMap),comments:t.commentsOf(e)})}function Ft({view:e,n:t,rows:n,verdict:r,search:i,sidebar:a,list:o,paging:s,width:c,onWidthChange:l,expanded:u,onExpandedChange:d}){let{items:f,searchHits:p}=i,m=e===`issues`&&t!==void 0&&!u;return(0,X.jsxs)(`section`,{ref:s.setListEl,"data-slot":`gh-list`,"data-mobile-preview":m||void 0,style:{"--github-list-width":`${c}px`},className:`relative flex w-full min-h-0 min-w-0 flex-col rounded-lg border border-border bg-card p-3 md:w-[var(--github-list-width)] md:shrink-0 md:overflow-x-hidden md:overflow-y-auto`,children:[f.length===0?r&&(0,X.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:r}):(0,X.jsx)(It,{items:f,rows:n,compactPreview:m,paging:s}),s.pagingAvailable?(0,X.jsx)(Lt,{view:e,list:o,paging:s}):null,(0,X.jsx)(Rt,{backedQuery:a.backedQuery,filterSearch:a.filterSearch}),(0,X.jsx)(zt,{view:e,n:t,count:f.length,expanded:u,onExpandedChange:d}),f.length>0&&i.searchWanted&&r?(0,X.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-soft-foreground`,children:r}):null,p.length>0?(0,X.jsx)(Bt,{hits:p,searchPayload:i.searchPayload,rows:n}):null,(0,X.jsx)(bt,{width:c,onWidthChange:l})]})}function It({items:e,rows:t,compactPreview:n,paging:r}){let{setRowsEl:i,scrollOwner:a,listEl:o,scrollOwnerRef:s,startMargin:c}=r,l=e.map((e,r)=>(0,X.jsx)(`div`,{role:`listitem`,"data-slot":`gh-row-item`,"data-divided":r>0||void 0,"data-compact-hidden":n&&r>=2&&t.selected?.url!==e.url||void 0,children:Pt(e,t)},e.url));return(0,X.jsx)(`div`,{ref:i,"data-slot":`gh-rows`,"data-virtualized":a?`true`:void 0,role:`list`,children:a?(0,X.jsx)(ve,{scrollRef:s,startMargin:c,children:l},a===o?`list`:`main`):l})}function Lt({view:e,list:t,paging:n}){return(0,X.jsx)(`div`,{ref:n.loadMoreRef,"data-slot":`gh-load-more`,className:`flex min-h-6 items-center justify-center gap-1.5 px-4 pb-3 text-xs text-soft-foreground`,children:t.isFetchingNextPage?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(z,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):t.isFetchNextPageError?(0,X.jsxs)(X.Fragment,{children:[`Could not load more.`,(0,X.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-retry`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Retry`})]}):n.manualPaging?(0,X.jsxs)(X.Fragment,{children:[`Filters cover the loaded `,e===`issues`?`issues`:`pull requests`,`.`,(0,X.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-manual`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Load more`})]}):null})}function Rt({backedQuery:e,filterSearch:t}){return e!==null&&t.data?.available&&t.data.truncated?(0,X.jsxs)(`div`,{"data-slot":`gh-filter-note`,role:`status`,className:`px-4 py-3 text-xs text-soft-foreground`,children:[`Showing the first `,t.data.items.length,` matches from GitHub search; more may exist.`]}):null}function zt({view:e,n:t,count:n,expanded:r,onExpandedChange:a}){return e===`issues`&&t!==void 0&&n>2?(0,X.jsx)(i,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":r,onClick:()=>a(e=>!e),children:r?`Show fewer issues`:`View all ${n} issues`}):null}function Bt({hits:e,searchPayload:t,rows:n}){return(0,X.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,X.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,t?.truncated?` (first matches)`:``]}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:e.map(e=>(0,X.jsx)(`li`,{children:Pt(e,n)},e.url))})]})}function Vt({view:e,n:t,selected:n,selectedNumber:r,exact:i,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}){let{exactWanted:d,exactItem:f}=i;return(0,X.jsx)(`section`,{"data-slot":`gh-detail`,className:a(`w-full min-w-0 min-h-0 flex-1 flex-col rounded-lg border border-border bg-card md:overflow-y-auto`,t===void 0?`hidden md:flex`:`flex`),children:n?(0,X.jsx)(Ht,{item:n,n:t,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}):d&&f.isPending?(0,X.jsx)(`div`,{"data-slot":`gh-detail-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,X.jsx)(H,{icon:(0,X.jsx)(z,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:`Loading #${r}…`,subtitle:`It is not among the open items, so the tab is asking GitHub for it.`})}):d&&(f.isError||f.data?.available===!1)?(0,X.jsx)(Ut,{number:r,exact:i}):(0,X.jsx)(Wt,{view:e,number:r})})}function Ht({item:e,n:t,repo:n,rows:r,listPath:i,changes:a,handToAgent:o}){let{workflows:s,skillList:c,workflow:l,setWorkflow:u,selectedSkills:d,setSelectedSkills:f,engine:p,setEngine:m,queued:h,onQueued:g}=o;return(0,X.jsx)(Ie,{item:e,comments:r.commentsOf(e),afterHeading:e.kind===`issue`?(0,X.jsx)(He,{number:e.number,repo:n},t??`list`):void 0,backLink:{to:i},subNav:{filter:r.filter,changes:a},onRunAgent:Gt,colors:r.colors,checks:Nt(e,r.checksMap),children:(0,X.jsx)(Fe,{item:e,workflows:s.data?.workflows??[],skills:c,workflow:l,onWorkflowChange:u,selectedSkills:d,onSkillsChange:f,engine:p,onEngineChange:m,queuedRunId:h.get(e.url)??null,onQueued:g},e.url)})}function Ut({number:e,exact:t}){let{exactItem:n,retryingExact:r,retryExact:a}=t;return(0,X.jsx)(H,{icon:(0,X.jsx)(j,{size:16}),tone:n.isError?`danger`:`neutral`,heading:`h2`,title:`Could not load #${e}`,subtitle:n.data?.available===!1?n.data.reason:n.error instanceof Error?n.error.message:`The request failed.`,actions:(0,X.jsx)(i,{variant:`outline`,disabled:r,onClick:a,children:`Retry`})})}function Wt({view:e,number:t}){return(0,X.jsx)(H,{icon:e===`issues`?(0,X.jsx)(N,{size:16}):(0,X.jsx)(D,{size:16}),tone:`neutral`,heading:`h2`,title:t===null?`Nothing selected`:`Not found`,subtitle:t===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${t} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${t} above to look it up on GitHub, closed and merged included.`})}function Gt(){let e=document.querySelector(`[data-slot="gh-detail-inner"] [data-slot="gh-custom-prompt"]`);e?.scrollIntoView({block:`center`}),e?.focus({preventScroll:!0})}function Kt({item:e,view:t,filter:n,colors:r,active:i,queued:o,checks:s,comments:l}){let d=e.kind===`issue`?N:D,f=u(),p=()=>{f.prefetchQuery({queryKey:T.githubComments(e.kind,e.number),queryFn:({signal:t})=>c(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,X.jsxs)(V,{to:W(t,n,e.number),draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Le(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:p,onFocus:p,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":i?`page`:void 0,title:`Drag into the composer to prefill a task`,className:a(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,i&&`bg-accent-strong/10 text-accent-text`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,X.jsx)(d,{"aria-hidden":`true`,className:a(`mt-0.5 size-3.5 shrink-0 md:mt-0`,e.kind===`issue`?`text-success`:`text-accent-icon`)}),(0,X.jsx)(`span`,{className:a(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,i&&`font-semibold`),children:e.title})]}),(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 pl-[22px] font-mono text-[11px] text-muted-foreground md:flex-nowrap md:gap-y-0`,children:[(0,X.jsxs)(`span`,{children:[`#`,e.number]}),(0,X.jsx)(`span`,{className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,X.jsx)(`span`,{children:B(e.createdAt)}),(0,X.jsx)(Ae,{count:l}),s?(0,X.jsx)(Ne,{checks:s}):null,o?(0,X.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-accent-text`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,X.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,X.jsx)(Re,{label:e,color:r[e],plain:!0},e))}):null]})}function qt({options:e,colors:t,selected:n,onChange:r}){let[i,o]=(0,q.useState)(!1),s=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,X.jsxs)(R,{open:i,onOpenChange:o,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:a(`flex min-h-11 min-w-11 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-accent-strong/60 text-foreground`),children:[n.length>0?`Labels · ${n.length}`:`Labels`,(0,X.jsx)(F,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`})]})}),(0,X.jsx)(L,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,X.jsxs)(se,{children:[(0,X.jsx)(ge,{placeholder:`Filter labels…`}),(0,X.jsxs)(he,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,X.jsx)(oe,{children:`No labels.`}),n.length>0?(0,X.jsxs)(U,{value:`__clear__`,onSelect:()=>r([]),className:`min-h-11 text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,X.jsxs)(U,{value:e,onSelect:()=>s(e),className:`min-h-11`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:je(t[e])}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,X.jsx)(M,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}export{xt as GithubRoute};
|