software-defence-factory 0.13.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,6 +35,7 @@ shell endpoint or a second scheduler.
35
35
  | Synthetic qualification | `demo`, `qualify` | No qualification endpoint | Synthetic disclosure only | Explicit separate state; never target an application accidentally |
36
36
  | Immutable source admission | `init --source-ref`, `run --source-ref`, `issue start --source-ref`; status and build evidence carry the resolved SHA | `POST /api/v1/jobs` resolves/retains before acknowledgement; shared source metadata in status | Issue Start work, local request and revision forms accept a ref; task detail shows requested ref, resolved SHA and prior source commits | Build/retry use retained objects; revisions start fresh by default; explicit continuation keeps the reviewed tree and recorded source; a new ref replaces the base; legacy source remains unknown |
37
37
  | Trusted PR handoff | `publish JOB_ID` publishes/reconciles; `abandon-delivery JOB_ID --branch-sha SHA` records a checked local resolution for a pre-write branch collision | Authenticated `POST /api/v1/jobs/:id/publish` and `/abandon-delivery`; shared receipt, conflict identity and removal policy | Publish/reconcile and explicit “Abandon local delivery; keep remote branch” actions share controller state; errors/results and inspected branch identity are visible | New writes require matching protected Codex/Pi build/review provenance, deterministic verify/handoff provenance, non-synthetic bound artifacts and a qualified GitHub Actions tree. Shared delivery status exposes `workflow_qualification` and the same reason blocks CLI/API/dashboard capability and publication/retry. Candidate workflow changes, unsupported triggers/syntax, or active generated-push, selected-ref-dispatch and PR jobs with write/secrets/environment/OIDC/deploy access, self-hosted runners or ambiguous privileged guards refuse trusted writes. Supported ASCII guard comparisons follow GitHub's case-insensitive string semantics; unknown PR refs, non-ASCII mismatches, and glob/escaped branch filters cannot prove a privileged job inactive. The shared summary's `action_mode` distinguishes new/resumable publication from read-only reconciliation and drives idle and pending task button wording. Branch-only collisions and unknown/abandoned states offer neither; known PR receipts and pending PR-creation checkpoints retain read-only reconciliation. Abandonment checks the current run, saved intent, exact branch head and absence of an associated PR; it writes no provider data, preserves the remote branch/evidence, disables republishing and permits local removal. Uncertain effects and incompatible evidence stay blocked. Destination remains private operator config; patch-only remains default |
38
+ | Delivered-commit check readback | `publish JOB_ID` reconciles, `status` returns saved checks | Existing publish/status routes return the same `delivery_status.checks` | Delivered-commit checks, per-row conclusions/scope, uncertainty and refresh | 0.13.1 verifies exact commit/provider identity; installed/live/browser qualification pending; no required-check or mergeability claim |
38
39
  | Optional trusted web verification | `web probe` performs a real local Chromium interaction; `doctor` reports readiness | Verify stores a shared story summary and protected JSON artifact in the run | Task history shows passed/failed/unavailable/inconclusive plus tool, candidate, policy and story hashes | Disabled by default. Required operator stories and Playwright/Chromium image ID are frozen in attempt policy. Linux Chromium proof cannot qualify native/mobile OS behavior; see [the browser contract](web-verification.md) |
39
40
 
40
41
  The current generic task form can name the Defence workflow; that is not a
@@ -128,3 +129,50 @@ remain visible when it is closed. Rows and cards share compact metadata; source
128
129
  readiness remains distinct from the runtime badge, and full assignments and
129
130
  linked attempts remain in detail. These presentation controls do not change
130
131
  headless records or admission semantics.
132
+
133
+ ## Delivered-commit checks (0.13.1, bounded #37 slice)
134
+
135
+ The controller keeps its before/after PR repository, branch, target and immutable
136
+ head guards. The GitHub adapter reads that delivered head, not a moving ref or
137
+ merge commit. CLI/API/dashboard share the saved normalized `checks` object:
138
+
139
+ - `target`: requested `repository` URL, immutable `sha`, validated
140
+ `pull_request_number`; null for an invalid request. This names the read target,
141
+ not proof that every returned row belongs to it.
142
+ - Each check run retains `head_sha`, raw `conclusion`, `status`, `passed` and
143
+ `non_blocking`; `scope` is `commit`, `pull_request` or `unknown`. An exact
144
+ `head_sha` with `pull_requests: []` is commit-scoped. Missing/malformed or
145
+ conflicting associations do not qualify. Commit statuses use the combined
146
+ response's exact SHA and repository identity and carry the same scope/flags.
147
+ Supplied PR `head`/`base`, repository and owner containers must be objects,
148
+ never null, scalars or arrays. Supplied repository names, owner login and
149
+ API/HTML URLs must agree, including on combined statuses; supplied combined
150
+ commit/status URLs must identify the exact target. Optional association details
151
+ may be absent. A supplied head SHA must match; a supplied base SHA must be
152
+ well formed but may differ from the delivered head. Combined statuses still
153
+ require a repository `full_name` and exact commit SHA.
154
+ - Optional row API self `url` fields must name the requested repository and
155
+ `check-runs/{id}` or `statuses/{id}` resource, agreeing with a supplied numeric
156
+ row ID. The documented legacy `statuses/{sha}` form must name the exact delivered
157
+ SHA; its suffix is a commit identity, not a row ID. Missing self URLs remain
158
+ supported. Malformed or contradictory self URLs make that row's status/scope
159
+ unknown and both flags false. CI details/HTML/target links are presentation
160
+ links, not repository identity; external CI destinations remain usable.
161
+ - `pagination_complete` requires both arrays and exact nonnegative totals
162
+ within the existing 100-row bound. No extra pages or polling are introduced.
163
+ Empty, partial, unreadable or unknown data never establishes aggregate success;
164
+ `reason` explains unknown results. Verified failures remain visible with partial
165
+ data. Otherwise incomplete/unverified data takes precedence over cancellation,
166
+ pending and positive results.
167
+ - `success` requires at least one executed success and all observed rows to be
168
+ non-blocking. Skipped/neutral-only results are `non_blocking`, not passing
169
+ execution. `pending`, `failure`, `cancelled` and `unknown` remain distinct;
170
+ raw conclusions retain timeout/action-required and unrecognized outcomes.
171
+
172
+ Old receipts are not rewritten. Without matching target/scope metadata the
173
+ human view marks recorded results unverified and offers the existing refresh;
174
+ headless consumers must likewise treat absent provenance as unknown. These are
175
+ observations of delivered-commit checks, not proof of required-check completion,
176
+ branch protection, mergeability, deployment or model quality. Protected Verify,
177
+ independent Review and explicit acceptance remain unchanged. #37 remains open
178
+ for the other parity gaps above; no role/profile or workflow redesign is included.
package/docs/npm.md CHANGED
@@ -104,8 +104,8 @@ installation or retained attempt needs them.
104
104
 
105
105
  ## Protected evidence compatibility
106
106
 
107
- Factory 0.13.0 recognizes version-1 execution profiles emitted by native
108
- **0.8.0, 0.9.0, 0.9.1, 0.10.0, 0.11.0, 0.11.1, 0.11.2, 0.12.0 and 0.13.0**. This is an exact allowlist in
107
+ Factory 0.13.1 recognizes version-1 execution profiles emitted by native
108
+ **0.8.0, 0.9.0, 0.9.1, 0.10.0, 0.11.0, 0.11.1, 0.11.2, 0.12.0, 0.13.0 and 0.13.1**. This is an exact allowlist in
109
109
  `factory/execution-profile.mjs`, independent of the installed package version;
110
110
  it is not a semver range or an automatic promise for later releases. Unknown
111
111
  runtime strings, unknown profile formats and incomplete legacy acceptance
@@ -162,6 +162,14 @@ policy checks, isolation and model credential rules are unchanged. Foundation
162
162
  is outside the job catalog. Supported old immutable evidence remains subject
163
163
  to every existing guard; unknown later versions receive no automatic trust.
164
164
 
165
+ Version 0.13.1 changes only delivered-commit check readback and its presentation.
166
+ The same writer/validator audit above found no changes to protected v1 execution,
167
+ candidate, check, review or acceptance writers, policy binding, isolation or
168
+ credentials. The explicit 0.13.1 entry is covered by retained-profile capability
169
+ and publication validation tests; old records remain immutable and unknown
170
+ versions remain blocked. Provider check observations are separate from protected
171
+ Verify evidence and cannot authorize acceptance or publication.
172
+
165
173
  Old installed releases retain their own files and mount paths until an idle,
166
174
  reviewed update. No installed catalog, execution profile or historical hash is
167
175
  rewritten by this layout change. Qualify the exact updated package/image before
@@ -11,13 +11,14 @@ import { expectedWebStories, webPolicyHash } from './web-verification.mjs';
11
11
  // 0.11.2 (exact patch bytes and pre-acceptance reconstruction; same v1 schema).
12
12
  // 0.12.0 restores the Inbox read model/presentation; protected writers and guards are unchanged.
13
13
  // 0.13.0 relocates identical job skills and adds a read-only Codex discovery alias.
14
+ // 0.13.1 corrects read-only delivered-commit checks; protected v1 writers are unchanged.
14
15
  // Candidate/check/review/acceptance schemas, isolation and credential/permission guards are unchanged.
15
16
  // Older writers still require exact patch/tree reconstruction before publication.
16
17
  // Deliberately independent of VERSION: a release bump is not
17
18
  // evidence compatibility. Re-audit this list for every trust-relevant writer,
18
19
  // isolation or validation change; remove versions whose guarantees no longer
19
20
  // satisfy current policy. See docs/npm.md. This predicate alone grants no trust.
20
- const SUPPORTED_EXECUTION_RUNTIMES_V1 = new Set(['0.8.0', '0.9.0', '0.9.1', '0.10.0', '0.11.0', '0.11.1', '0.11.2', '0.12.0', '0.13.0']);
21
+ const SUPPORTED_EXECUTION_RUNTIMES_V1 = new Set(['0.8.0', '0.9.0', '0.9.1', '0.10.0', '0.11.0', '0.11.1', '0.11.2', '0.12.0', '0.13.0', '0.13.1']);
21
22
 
22
23
  export function isSupportedExecutionProfile(profile) {
23
24
  return profile?.version === 1 && SUPPORTED_EXECUTION_RUNTIMES_V1.has(profile.runtimeVersion);
@@ -32,45 +32,92 @@ function slug(repository) {
32
32
  return `${match[1]}/${match[2]}`;
33
33
  }
34
34
 
35
- function checkSummary(runs, status, pullRequestNumber) {
36
- const checkRuns = Array.isArray(runs?.check_runs) ? runs.check_runs.slice(0, 100).map(run => ({
37
- kind: 'check_run',
38
- name: String(run.name || 'Unnamed check').slice(0, 200),
39
- status: pullRequestNumber && Array.isArray(run.pull_requests)
40
- && run.pull_requests.some(pull => pull.number === pullRequestNumber)
41
- ? ['queued', 'in_progress', 'completed'].includes(run.status) ? run.status : 'unknown'
42
- : 'unknown',
43
- conclusion: typeof run.conclusion === 'string' ? run.conclusion : null,
44
- url: typeof run.html_url === 'string' ? run.html_url : null,
45
- passed: run.status === 'completed' && run.conclusion === 'success'
46
- && pullRequestNumber && Array.isArray(run.pull_requests) && run.pull_requests.some(pull => pull.number === pullRequestNumber),
47
- non_blocking: run.status === 'completed' && ['success', 'skipped', 'neutral'].includes(run.conclusion)
48
- && pullRequestNumber && Array.isArray(run.pull_requests) && run.pull_requests.some(pull => pull.number === pullRequestNumber),
49
- })) : [];
50
- const contexts = Array.isArray(status?.statuses) ? status.statuses.slice(0, 100).map(item => ({
51
- name: String(item.context || 'Unnamed status').slice(0, 200),
52
- status: ['pending', 'success', 'failure', 'error'].includes(item.state) ? item.state : 'unknown',
53
- url: typeof item.target_url === 'string' ? item.target_url : null,
54
- })) : [];
55
- const rows = [
56
- ...checkRuns.map(item => ({ ...item, kind: 'check_run',
57
- passed: item.status === 'completed' && item.conclusion === 'success',
58
- non_blocking: item.status === 'completed' && ['success', 'skipped', 'neutral'].includes(item.conclusion) })),
59
- ...contexts.map(item => ({ ...item, kind: 'commit_status', passed: item.status === 'success', non_blocking: item.status === 'success' })),
60
- ];
35
+ // This is observed commit evidence, never branch-protection or acceptance policy.
36
+ function checkSummary(runs, status, target) {
37
+ const repositoryName = slug(target.repository).toLowerCase();
38
+ const repositoryAPI = `https://api.github.com/repos/${repositoryName}`;
39
+ const object = value => value !== null && typeof value === 'object' && !Array.isArray(value);
40
+ const optionalIdentity = (value, expected) => value === undefined
41
+ || (typeof value === 'string' && value.toLowerCase() === expected);
42
+ // API self URLs identify a repository resource; CI details/target links do
43
+ // not. Status examples also use the legacy statuses/{sha} endpoint, whose
44
+ // suffix identifies the commit rather than the individual status ID.
45
+ const matchesSelfURL = (row, endpoint) => {
46
+ if (row.url === undefined) return true;
47
+ if (typeof row.url !== 'string') return false;
48
+ if (endpoint === 'statuses' && optionalIdentity(row.url, `${repositoryAPI}/statuses/${target.sha}`)) return true;
49
+ const match = row.url.match(/\/([1-9][0-9]*)$/);
50
+ return !!match && Number.isSafeInteger(Number(match[1]))
51
+ && optionalIdentity(row.url, `${repositoryAPI}/${endpoint}/${match[1]}`)
52
+ && (row.id === undefined || (Number.isSafeInteger(row.id) && String(row.id) === match[1]));
53
+ };
54
+ // Optional details may be absent, but supplied containers and identities must
55
+ // all agree. Optional chaining alone would erase malformed head/base values.
56
+ const matchesRepository = repo => repo === undefined || (object(repo)
57
+ && optionalIdentity(repo.full_name, repositoryName)
58
+ && optionalIdentity(repo.url, repositoryAPI)
59
+ && optionalIdentity(repo.html_url, target.repository.toLowerCase())
60
+ && optionalIdentity(repo.name, repositoryName.split('/')[1])
61
+ && (repo.owner === undefined || (object(repo.owner)
62
+ && optionalIdentity(repo.owner.login, repositoryName.split('/')[0]))));
63
+ const matchesPullSide = (side, head) => side === undefined || (object(side)
64
+ && (side.sha === undefined || (typeof side.sha === 'string' && /^[a-f0-9]{40}$/.test(side.sha)
65
+ && (!head || side.sha === target.sha)))
66
+ && matchesRepository(side.repo));
67
+ const checkRuns = Array.isArray(runs?.check_runs) ? runs.check_runs.slice(0, 100).map(run => {
68
+ const associations = run?.pull_requests;
69
+ const identity = object(run) && run.head_sha === target.sha && matchesSelfURL(run, 'check-runs') && Array.isArray(associations)
70
+ && associations.every(pull => object(pull) && pull.number === target.pull_request_number
71
+ && optionalIdentity(pull.url, `${repositoryAPI}/pulls/${target.pull_request_number}`)
72
+ && matchesPullSide(pull.head, true) && matchesPullSide(pull.base, false));
73
+ const runStatus = identity && ['queued', 'in_progress', 'completed'].includes(run?.status) ? run.status : 'unknown';
74
+ return {
75
+ kind: 'check_run',
76
+ name: String(run?.name || 'Unnamed check').slice(0, 200),
77
+ head_sha: typeof run?.head_sha === 'string' ? run.head_sha : null,
78
+ scope: identity ? (associations.length ? 'pull_request' : 'commit') : 'unknown',
79
+ status: runStatus,
80
+ conclusion: typeof run?.conclusion === 'string' ? run.conclusion : null,
81
+ url: typeof run?.html_url === 'string' ? run.html_url : null,
82
+ passed: runStatus === 'completed' && run.conclusion === 'success',
83
+ non_blocking: runStatus === 'completed' && ['success', 'skipped', 'neutral'].includes(run.conclusion),
84
+ };
85
+ }) : [];
86
+ const statusIdentity = object(status) && status.sha === target.sha
87
+ && object(status.repository) && typeof status.repository.full_name === 'string'
88
+ && matchesRepository(status.repository)
89
+ && optionalIdentity(status.commit_url, `${repositoryAPI}/commits/${target.sha}`)
90
+ && optionalIdentity(status.url, `${repositoryAPI}/commits/${target.sha}/status`);
91
+ const contexts = Array.isArray(status?.statuses) ? status.statuses.slice(0, 100).map(item => {
92
+ const identity = statusIdentity && object(item) && matchesSelfURL(item, 'statuses');
93
+ const itemStatus = identity && ['pending', 'success', 'failure', 'error'].includes(item?.state) ? item.state : 'unknown';
94
+ return {
95
+ kind: 'commit_status',
96
+ name: String(item?.context || 'Unnamed status').slice(0, 200),
97
+ head_sha: typeof status?.sha === 'string' ? status.sha : null,
98
+ scope: identity ? 'commit' : 'unknown',
99
+ status: itemStatus,
100
+ url: typeof item?.target_url === 'string' ? item.target_url : null,
101
+ passed: itemStatus === 'success', non_blocking: itemStatus === 'success',
102
+ };
103
+ }) : [];
104
+ const rows = [...checkRuns, ...contexts];
61
105
  const failed = rows.some(item => item.kind === 'check_run'
62
- ? item.status === 'completed' && ['failure', 'action_required', 'timed_out', 'cancelled'].includes(item.conclusion)
106
+ ? item.status === 'completed' && ['failure', 'action_required', 'timed_out'].includes(item.conclusion)
63
107
  : item.status === 'failure' || item.status === 'error');
108
+ const cancelled = rows.some(item => item.status === 'completed' && item.conclusion === 'cancelled');
64
109
  const pending = rows.some(item => item.status === 'pending' || item.status === 'queued' || item.status === 'in_progress');
65
- const unknown = rows.some(item => item.status === 'unknown'
110
+ const unknown = !statusIdentity || rows.some(item => item.status === 'unknown'
66
111
  || (item.kind === 'check_run' && item.status === 'completed'
67
112
  && !['success', 'skipped', 'neutral', 'failure', 'action_required', 'timed_out', 'cancelled'].includes(item.conclusion)));
68
- const complete = Number.isSafeInteger(runs?.total_count) && runs.total_count === checkRuns.length
69
- && Number.isSafeInteger(status?.total_count) && status.total_count === contexts.length;
113
+ const completePage = (payload, key) => Array.isArray(payload?.[key]) && payload[key].length <= 100
114
+ && Number.isSafeInteger(payload.total_count) && payload.total_count === payload[key].length;
115
+ const complete = completePage(runs, 'check_runs') && completePage(status, 'statuses');
70
116
  const onlyNonBlocking = rows.length > 0 && rows.every(item => item.non_blocking);
71
- const state = failed ? 'failure' : !complete || unknown ? 'unknown' : pending ? 'pending'
117
+ const state = failed ? 'failure' : !complete || unknown ? 'unknown' : cancelled ? 'cancelled' : pending ? 'pending'
72
118
  : onlyNonBlocking ? (rows.some(item => item.passed) ? 'success' : 'non_blocking') : 'unknown';
73
- return { state, pagination_complete: complete, check_runs: checkRuns, commit_statuses: contexts };
119
+ return { state, target, pagination_complete: complete, check_runs: checkRuns, commit_statuses: contexts,
120
+ ...(state === 'unknown' ? { reason: 'Check readback is empty, incomplete or contains unverified identity or status.' } : {}) };
74
121
  }
75
122
 
76
123
  export function githubDeliveryProvider({ request = requestGitHub } = {}) {
@@ -145,16 +192,17 @@ export function githubDeliveryProvider({ request = requestGitHub } = {}) {
145
192
  return get(`${apiRoot}/${slug(repository)}/pulls/${number}`);
146
193
  },
147
194
  async readChecks(repository, sha, pullRequestNumber) {
148
- if (!Number.isSafeInteger(pullRequestNumber) || pullRequestNumber < 1)
149
- return { state: 'unknown', check_runs: [], commit_statuses: [], reason: 'A pull request identity is required to associate checks with delivery.' };
195
+ if (!Number.isSafeInteger(pullRequestNumber) || pullRequestNumber < 1 || !/^[a-f0-9]{40}$/.test(sha || ''))
196
+ return { state: 'unknown', target: null, pagination_complete: false, check_runs: [], commit_statuses: [], reason: 'A valid pull request number and immutable delivered commit are required.' };
197
+ const target = { repository, sha, pull_request_number: pullRequestNumber };
150
198
  try {
151
199
  const [runs, status] = await Promise.all([
152
200
  get(`${apiRoot}/${slug(repository)}/commits/${sha}/check-runs?per_page=100`),
153
201
  get(`${apiRoot}/${slug(repository)}/commits/${sha}/status?per_page=100`),
154
202
  ]);
155
- return checkSummary(runs, status, pullRequestNumber);
203
+ return checkSummary(runs, status, target);
156
204
  } catch {
157
- return { state: 'unknown', check_runs: [], commit_statuses: [], reason: 'GitHub checks could not be read with the configured identity.' };
205
+ return { state: 'unknown', target, pagination_complete: false, check_runs: [], commit_statuses: [], reason: 'GitHub checks could not be read with the configured identity.' };
158
206
  }
159
207
  },
160
208
  };
@@ -1,6 +1,6 @@
1
1
  var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function ee(){}var C={H:null,A:null,T:null,S:null},w=Object.prototype.hasOwnProperty;function T(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function te(e,t){return T(e.type,t,e.props)}function E(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ne(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var D=/\/+/g;function re(e,t){return typeof e==`object`&&e&&e.key!=null?ne(``+e.key):t.toString(36)}function O(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(ee,ee):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function k(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,k(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+re(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(D,`$&/`)+`/`),k(o,r,i,``,function(e){return e})):o!=null&&(E(o)&&(o=te(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(D,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+re(a,u),c+=k(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+re(a,u++),c+=k(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return k(O(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function A(e,t,n){if(e==null)return e;var r=[],i=0;return k(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function j(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var M=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},ie={map:A,forEach:function(e,t,n){A(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return A(e,function(){t++}),t},toArray:function(e){return A(e,function(e){return e})||[]},only:function(e){if(!E(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ie,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return C.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!w.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return T(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)w.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return T(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=E,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:j}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=C.T,n={};C.T=n;try{var r=e(),i=C.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(ee,M)}catch(e){M(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),C.T=t}},e.unstable_useCacheRefresh=function(){return C.H.useCacheRefresh()},e.use=function(e){return C.H.use(e)},e.useActionState=function(e,t,n){return C.H.useActionState(e,t,n)},e.useCallback=function(e,t){return C.H.useCallback(e,t)},e.useContext=function(e){return C.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return C.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return C.H.useEffect(e,t)},e.useEffectEvent=function(e){return C.H.useEffectEvent(e)},e.useId=function(){return C.H.useId()},e.useImperativeHandle=function(e,t,n){return C.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return C.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return C.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return C.H.useMemo(e,t)},e.useOptimistic=function(e,t){return C.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return C.H.useReducer(e,t,n)},e.useRef=function(e){return C.H.useRef(e)},e.useState=function(e){return C.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return C.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return C.H.useTransition()},e.version=`19.2.8`})),u=o(((e,t)=>{t.exports=l()})),d=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),f=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),p=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),m=e=>{let t=p(e);return t.charAt(0).toUpperCase()+t.slice(1)},h={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},g=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},_=c(u(),1),v=(0,_.createContext)({}),y=()=>(0,_.useContext)(v),b=(0,_.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:f=!1,color:p=`currentColor`,className:m=``}=y()??{},v=r??f?Number(n??u)*24/Number(t??l):n??u;return(0,_.createElement)(`svg`,{ref:c,...h,width:t??l??h.width,height:t??l??h.height,stroke:e??p,strokeWidth:v,className:d(`lucide`,m,i),...!a&&!g(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,_.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),x=(e,t)=>{let n=(0,_.forwardRef)(({className:n,...r},i)=>(0,_.createElement)(b,{ref:i,iconNode:t,className:d(`lucide-${f(m(e))}`,`lucide-${e}`,n),...r}));return n.displayName=m(e),n},S=x(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),ee=x(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),C=x(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),w=x(`book-open`,[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]),T=x(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),te=x(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),E=x(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),ne=x(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),D=x(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),re=x(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),O=x(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),k=x(`circle-pause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),A=x(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),j=x(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),M=x(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),ie=x(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),ae=x(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),oe=x(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),N=x(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),P=x(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),F=x(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),se=x(`file-text`,[[`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`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),ce=x(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),I=x(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),le=x(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),ue=x(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),de=x(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),fe=x(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),pe=x(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),me=x(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),he=x(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ge=x(`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`}]]),_e=x(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),ve=x(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ye=x(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),L=x(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),be=x(`timer-reset`,[[`path`,{d:`M10 2h4`,key:`n1abiw`}],[`path`,{d:`M12 14v-4`,key:`1evpnu`}],[`path`,{d:`M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6`,key:`1ts96g`}],[`path`,{d:`M9 17H4v5`,key:`8t5av`}]]),xe=x(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Se=Object.defineProperty,Ce=(e,t)=>Se(e,`name`,{value:t,configurable:!0});function R(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Ce(R,`setRef`);function we(...e){return t=>{let n=!1,r=e.map(e=>{let r=R(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():R(e[t],null)}}}}Ce(we,`composeRefs`);function Te(...e){return _.useCallback(we(...e),e)}Ce(Te,`useComposedRefs`);var Ee=Object.defineProperty,De=(e,t)=>Ee(e,`name`,{value:t,configurable:!0});function Oe(e){let t=_.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Le(r)&&typeof Ve==`function`&&(r=Ve(r._payload)),_.Children.forEach(r,e=>{if(Fe(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Le(n)&&typeof Ve==`function`&&(n=Ve(n._payload)),a=Me(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=_.cloneElement(a,void 0,s):!o&&_.Children.count(r)===1&&_.isValidElement(r)&&(a=r);let c=a?Pe(a):void 0,l=Te(n,c);if(!a){if(r||r===0)throw Error(o?Be(e):ze(e));return r}let u=Ne(i,a.props??{});return a.type!==_.Fragment&&(u.ref=n?l:c),_.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}De(Oe,`createSlot`);var ke=Oe(`Slot`),Ae=Symbol.for(`radix.slottable`);function je(e){let t=De(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=Ae,t}De(je,`createSlottable`);var Me=De((e,t)=>{if(`child`in e.props){let t=e.props.child;return _.isValidElement(t)?_.cloneElement(t,void 0,e.props.children(t.props.children)):null}return _.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function Ne(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}De(Ne,`mergeProps`);function Pe(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}De(Pe,`getElementRef`);function Fe(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ae}De(Fe,`isSlottable`);var Ie=Symbol.for(`react.lazy`);function Le(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Ie&&`_payload`in e&&Re(e._payload)}De(Le,`isLazyComponent`);function Re(e){return typeof e==`object`&&!!e&&`then`in e}De(Re,`isPromiseLike`);var ze=De(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),Be=De(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),Ve=_.use;function He(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=He(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Ue(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=He(e))&&(r&&(r+=` `),r+=t);return r}var We=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Ge=Ue,Ke=(e,t)=>n=>{if(t?.variants==null)return Ge(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=We(t)||We(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Ge(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},qe=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Je=(e,t)=>({classGroupId:e,validator:t}),Ye=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Xe=`-`,Ze=[],Qe=`arbitrary..`,$e=e=>{let t=nt(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return tt(e);let n=e.split(Xe);return et(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?qe(i,t):t:i||Ze}return n[e]||Ze}}},et=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=et(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Xe):e.slice(t).join(Xe),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},tt=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Qe+r:void 0})(),nt=e=>{let{theme:t,classGroups:n}=e;return rt(n,t)},rt=(e,t)=>{let n=Ye();for(let r in e){let i=e[r];it(i,n,r,t)}return n},it=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];at(i,t,n,r)}},at=(e,t,n,r)=>{if(typeof e==`string`){ot(e,t,n);return}if(typeof e==`function`){st(e,t,n,r);return}ct(e,t,n,r)},ot=(e,t,n)=>{let r=e===``?t:lt(t,e);r.classGroupId=n},st=(e,t,n,r)=>{if(ut(e)){it(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Je(n,e))},ct=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];it(o,lt(t,a),n,r)}},lt=(e,t)=>{let n=e,r=t.split(Xe),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Ye(),n.nextPart.set(t,i)),n=i}return n},ut=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,dt=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},ft=`!`,pt=`:`,mt=[],ht=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),gt=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===pt){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(ft)?(c=s.slice(0,-1),l=!0):s.startsWith(ft)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return ht(t,l,c,u)};if(t){let e=t+pt,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):ht(mt,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},_t=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},vt=e=>({cache:dt(e.cacheSize),parseClassName:gt(e),sortModifiers:_t(e),postfixLookupClassGroupIds:yt(e),...$e(e)}),yt=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},bt=/\s+/,xt=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(bt),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+ft:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},St=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Ct(n))&&(i&&(i+=` `),i+=r);return i},Ct=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Ct(e[r]))&&(n&&(n+=` `),n+=t);return n},wt=(e,...t)=>{let n,r,i,a,o=o=>(n=vt(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=xt(e,n);return i(e,a),a};return a=o,(...e)=>a(St(...e))},Tt=[],Et=e=>{let t=t=>t[e]||Tt;return t.isThemeGetter=!0,t},Dt=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ot=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kt=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,At=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,jt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Mt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Nt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Pt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ft=e=>kt.test(e),z=e=>!!e&&!Number.isNaN(Number(e)),It=e=>!!e&&Number.isInteger(Number(e)),Lt=e=>e.endsWith(`%`)&&z(e.slice(0,-1)),Rt=e=>At.test(e),zt=()=>!0,Bt=e=>jt.test(e)&&!Mt.test(e),Vt=()=>!1,Ht=e=>Nt.test(e),Ut=e=>Pt.test(e),Wt=e=>!B(e)&&!V(e),Gt=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Kt=e=>cn(e,fn,Vt),B=e=>Dt.test(e),qt=e=>cn(e,pn,Bt),Jt=e=>cn(e,mn,z),Yt=e=>cn(e,gn,zt),Xt=e=>cn(e,hn,Vt),Zt=e=>cn(e,un,Vt),Qt=e=>cn(e,dn,Ut),$t=e=>cn(e,_n,Ht),V=e=>Ot.test(e),en=e=>ln(e,pn),tn=e=>ln(e,hn),nn=e=>ln(e,un),rn=e=>ln(e,fn),an=e=>ln(e,dn),on=e=>ln(e,_n,!0),sn=e=>ln(e,gn,!0),cn=(e,t,n)=>{let r=Dt.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},ln=(e,t,n=!1)=>{let r=Ot.exec(e);return r?r[1]?t(r[1]):n:!1},un=e=>e===`position`||e===`percentage`,dn=e=>e===`image`||e===`url`,fn=e=>e===`length`||e===`size`||e===`bg-size`,pn=e=>e===`length`,mn=e=>e===`number`,hn=e=>e===`family-name`,gn=e=>e===`number`||e===`weight`,_n=e=>e===`shadow`,vn=wt(()=>{let e=Et(`color`),t=Et(`font`),n=Et(`text`),r=Et(`font-weight`),i=Et(`tracking`),a=Et(`leading`),o=Et(`breakpoint`),s=Et(`container`),c=Et(`spacing`),l=Et(`radius`),u=Et(`shadow`),d=Et(`inset-shadow`),f=Et(`text-shadow`),p=Et(`drop-shadow`),m=Et(`blur`),h=Et(`perspective`),g=Et(`aspect`),_=Et(`ease`),v=Et(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),V,B],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],ee=()=>[`auto`,`contain`,`none`],C=()=>[V,B,c],w=()=>[Ft,`full`,`auto`,...C()],T=()=>[It,`none`,`subgrid`,V,B],te=()=>[`auto`,{span:[`full`,It,V,B]},It,V,B],E=()=>[It,`auto`,V,B],ne=()=>[`auto`,`min`,`max`,`fr`,V,B],D=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],re=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],O=()=>[`auto`,...C()],k=()=>[Ft,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...C()],A=()=>[Ft,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...C()],j=()=>[Ft,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...C()],M=()=>[e,V,B],ie=()=>[...b(),nn,Zt,{position:[V,B]}],ae=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],oe=()=>[`auto`,`cover`,`contain`,rn,Kt,{size:[V,B]}],N=()=>[Lt,en,qt],P=()=>[``,`none`,`full`,l,V,B],F=()=>[``,z,en,qt],se=()=>[`solid`,`dashed`,`dotted`,`double`],ce=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],I=()=>[z,Lt,nn,Zt],le=()=>[``,`none`,m,V,B],ue=()=>[`none`,z,V,B],de=()=>[`none`,z,V,B],fe=()=>[z,V,B],pe=()=>[Ft,`full`,...C()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Rt],breakpoint:[Rt],color:[zt],container:[Rt],"drop-shadow":[Rt],ease:[`in`,`out`,`in-out`],font:[Wt],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Rt],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Rt],shadow:[Rt],spacing:[`px`,z],text:[Rt],"text-shadow":[Rt],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Ft,B,V,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,V,B]}],"container-named":[Gt],columns:[{columns:[z,B,V,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:ee()}],"overscroll-x":[{"overscroll-x":ee()}],"overscroll-y":[{"overscroll-y":ee()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{"inset-s":w(),start:w()}],end:[{"inset-e":w(),end:w()}],"inset-bs":[{"inset-bs":w()}],"inset-be":[{"inset-be":w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[It,`auto`,V,B]}],basis:[{basis:[Ft,`full`,`auto`,s,...C()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[z,Ft,`auto`,`initial`,`none`,B]}],grow:[{grow:[``,z,V,B]}],shrink:[{shrink:[``,z,V,B]}],order:[{order:[It,`first`,`last`,`none`,V,B]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ne()}],"auto-rows":[{"auto-rows":ne()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...D(),`normal`]}],"justify-items":[{"justify-items":[...re(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...re()]}],"align-content":[{content:[`normal`,...D()]}],"align-items":[{items:[...re(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...re(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":D()}],"place-items":[{"place-items":[...re(),`baseline`]}],"place-self":[{"place-self":[`auto`,...re()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pbs:[{pbs:C()}],pbe:[{pbe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mbs:[{mbs:O()}],mbe:[{mbe:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":C()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":C()}],"space-y-reverse":[`space-y-reverse`],size:[{size:k()}],"inline-size":[{inline:[`auto`,...A()]}],"min-inline-size":[{"min-inline":[`auto`,...A()]}],"max-inline-size":[{"max-inline":[`none`,...A()]}],"block-size":[{block:[`auto`,...j()]}],"min-block-size":[{"min-block":[`auto`,...j()]}],"max-block-size":[{"max-block":[`none`,...j()]}],w:[{w:[s,`screen`,...k()]}],"min-w":[{"min-w":[s,`screen`,`none`,...k()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...k()]}],h:[{h:[`screen`,`lh`,...k()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...k()]}],"max-h":[{"max-h":[`screen`,`lh`,...k()]}],"font-size":[{text:[`base`,n,en,qt]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,sn,Yt]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Lt,B]}],"font-family":[{font:[tn,Xt,t]}],"font-features":[{"font-features":[B]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,V,B]}],"line-clamp":[{"line-clamp":[z,`none`,V,Jt]}],leading:[{leading:[a,...C()]}],"list-image":[{"list-image":[`none`,V,B]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,V,B]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...se(),`wavy`]}],"text-decoration-thickness":[{decoration:[z,`from-font`,`auto`,V,qt]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[z,`auto`,V,B]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:C()}],"tab-size":[{tab:[It,V,B]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,V,B]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,V,B]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:ie()}],"bg-repeat":[{bg:ae()}],"bg-size":[{bg:oe()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},It,V,B],radial:[``,V,B],conic:[It,V,B]},an,Qt]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:N()}],"gradient-via-pos":[{via:N()}],"gradient-to-pos":[{to:N()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-bs":[{"border-bs":F()}],"border-w-be":[{"border-be":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":F()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...se(),`hidden`,`none`]}],"divide-style":[{divide:[...se(),`hidden`,`none`]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...se(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[z,V,B]}],"outline-w":[{outline:[``,z,en,qt]}],"outline-color":[{outline:M()}],shadow:[{shadow:[``,`none`,u,on,$t]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":[`none`,d,on,$t]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:F()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[z,qt]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":[`none`,f,on,$t]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[z,V,B]}],"mix-blend":[{"mix-blend":[...ce(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[z]}],"mask-image-linear-from-pos":[{"mask-linear-from":I()}],"mask-image-linear-to-pos":[{"mask-linear-to":I()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":I()}],"mask-image-t-to-pos":[{"mask-t-to":I()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":I()}],"mask-image-r-to-pos":[{"mask-r-to":I()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":I()}],"mask-image-b-to-pos":[{"mask-b-to":I()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":I()}],"mask-image-l-to-pos":[{"mask-l-to":I()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":I()}],"mask-image-x-to-pos":[{"mask-x-to":I()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":I()}],"mask-image-y-to-pos":[{"mask-y-to":I()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[V,B]}],"mask-image-radial-from-pos":[{"mask-radial-from":I()}],"mask-image-radial-to-pos":[{"mask-radial-to":I()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[z]}],"mask-image-conic-from-pos":[{"mask-conic-from":I()}],"mask-image-conic-to-pos":[{"mask-conic-to":I()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ie()}],"mask-repeat":[{mask:ae()}],"mask-size":[{mask:oe()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,V,B]}],filter:[{filter:[``,`none`,V,B]}],blur:[{blur:le()}],brightness:[{brightness:[z,V,B]}],contrast:[{contrast:[z,V,B]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,on,$t]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:[``,z,V,B]}],"hue-rotate":[{"hue-rotate":[z,V,B]}],invert:[{invert:[``,z,V,B]}],saturate:[{saturate:[z,V,B]}],sepia:[{sepia:[``,z,V,B]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,V,B]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[z,V,B]}],"backdrop-contrast":[{"backdrop-contrast":[z,V,B]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,z,V,B]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[z,V,B]}],"backdrop-invert":[{"backdrop-invert":[``,z,V,B]}],"backdrop-opacity":[{"backdrop-opacity":[z,V,B]}],"backdrop-saturate":[{"backdrop-saturate":[z,V,B]}],"backdrop-sepia":[{"backdrop-sepia":[``,z,V,B]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,V,B]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[z,`initial`,V,B]}],ease:[{ease:[`linear`,`initial`,_,V,B]}],delay:[{delay:[z,V,B]}],animate:[{animate:[`none`,v,V,B]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,V,B]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":[`scale-3d`],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[V,B,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:pe()}],"translate-x":[{"translate-x":pe()}],"translate-y":[{"translate-y":pe()}],"translate-z":[{"translate-z":pe()}],"translate-none":[`translate-none`],zoom:[{zoom:[It,V,B]}],accent:[{accent:M()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,V,B]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":M()}],"scrollbar-track-color":[{"scrollbar-track":M()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mbs":[{"scroll-mbs":C()}],"scroll-mbe":[{"scroll-mbe":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pbs":[{"scroll-pbs":C()}],"scroll-pbe":[{"scroll-pbe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,V,B]}],fill:[{fill:[`none`,...M()]}],"stroke-w":[{stroke:[z,en,qt,Jt]}],stroke:[{stroke:[`none`,...M()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function yn(...e){return vn(Ue(e))}var bn=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),H=o(((e,t)=>{t.exports=bn()}))(),xn=Ke(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,outline:`border border-border/70 bg-transparent hover:bg-muted`,ghost:`text-muted-foreground hover:bg-muted hover:text-foreground`},size:{default:`h-9 px-3.5`,sm:`h-8 px-3`,icon:`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function U({className:e,variant:t,size:n,asChild:r=!1,...i}){return(0,H.jsx)(r?ke:`button`,{className:yn(xn({variant:t,size:n}),e),...i})}function Sn(e){if(!/^[a-f0-9]{6}$/i.test(e||``))return`neutral`;let[t,n,r]=e.match(/../g).map(e=>parseInt(e,16)/255),i=Math.max(t,n,r),a=i-Math.min(t,n,r);if(a<.025)return`neutral`;let o=i===t?(n-r)/a%6:i===n?(r-t)/a+2:(t-n)/a+4;return o=(o*60+360)%360,o<15||o>=345?`red`:o<45?`orange`:o<75?`yellow`:o<165?`green`:o<195?`cyan`:o<255?`blue`:`purple`}function Cn({labels:e=[]}){return e.length?(0,H.jsx)(`div`,{className:`issue-choice-meta`,children:e.map(e=>(0,H.jsx)(`span`,{className:`issue-label label-${Sn(e.color)}`,children:e.name},e.name))}):null}var wn=`0001-01-01T00:00:00Z`,Tn=e=>({running:`violet`,queued:`cyan`,awaiting_approval:`pink`,succeeded:`green`,failed:`amber`,timed_out:`amber`,blocked:`amber`,interrupted:`amber`})[e]||`neutral`;function En({value:e}){let t=e===`succeeded`?E:e===`running`?M:[`failed`,`blocked`,`timed_out`,`interrupted`].includes(e)?re:e===`awaiting_approval`?F:j;return(0,H.jsx)(`span`,{className:`task-status-icon tone-${Tn(e)}`,"aria-hidden":`true`,children:(0,H.jsx)(t,{size:14})})}function Dn({value:e}){return(0,H.jsxs)(`span`,{className:`task-state tone-${Tn(e)}`,children:[(0,H.jsx)(`span`,{className:`state-dot`}),jn(e)]})}function On(e){return String(e||``).replaceAll(`_`,` `).replaceAll(`-`,` `).replace(/^./,e=>e.toUpperCase())}function kn(e){if(!e||e===wn)return`Not started`;let t=Date.parse(e);if(!Number.isFinite(t))return`Unavailable`;let n=Math.max(0,Math.floor((Date.now()-t)/1e3));if(n<10)return`just now`;if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function An(e){return!e||e===wn||!Number.isFinite(Date.parse(e))?`Unavailable`:new Date(e).toLocaleString()}function jn(e){return{not_started:`Not started`,awaiting_approval:`Awaiting acceptance`,cancelling:`Cancelling`,failed:`Failed`,interrupted:`Interrupted`,queued:`Queued`,running:`Running`,succeeded:`Completed`,timed_out:`Timed out`,cancelled:`Cancelled`,blocked:`Blocked`}[e]||(e?On(e):`Unknown`)}Object.freeze({triage:`factory:triage`,spec:`factory:spec`,ready:`factory:ready`,blocked:`factory:blocked`});function Mn(e){if(typeof e!=`string`||e.length>2048||/(?:^|\/)\.\.?(?:\/|$)/.test(e))return null;try{let t=new URL(e);if(![`https:`,`http:`].includes(t.protocol)||t.hostname!==`github.com`||t.username||t.password||t.port)return null;let n=t.pathname.match(/^\/([A-Za-z0-9-]+)\/([A-Za-z0-9_.-]+)\/issues\/([1-9][0-9]*)\/?$/i);if(!n||!Number.isSafeInteger(Number(n[3])))return null;let r=`https://github.com/${n[1]}/${n[2]}`.toLowerCase(),i=Number(n[3]);return{key:`github:${r}:${i}`,provider:`github`,repository:r,number:i,url:`${r}/issues/${i}`}}catch{return null}}function Nn(e){return!e.deleted_at&&(![`succeeded`,`failed`,`cancelled`].includes(e.state)||!!(e.delivery&&![`published`,`abandoned`].includes(e.delivery.state)))}function Pn(e,t){let n=e.filter(e=>Mn(e.task?.source_url)?.key===t.key).sort((e,t)=>String(t.created_at||``).localeCompare(String(e.created_at||``))||t.id.localeCompare(e.id)),r=e=>({id:e.id,state:e.state,workflow:e.workflow?.name||null,phase:e.workflow?.steps?.[e.workflow.current_step]||null,created_at:e.created_at,updated_at:e.updated_at}),i=n.filter(Nn).map(r);return{executions:n.map(r),latest_execution:n[0]?r(n[0]):null,active_execution:i[0]||null,active_executions:i}}function Fn(e,t){let n=new Set(t.map(e=>e.identity.key)),r=new Map;for(let t of e){let i=Mn(t.task?.source_url);if(i&&n.has(i.key))continue;let a=i?.key||`local:${t.id}`;r.has(a)||r.set(a,{identity:i,key:a,title:t.task?.title||t.prompt?.split(`
2
2
  `)[0]||t.id,url:i?.url||null,source_status:i?`not_loaded`:`local`,...i?Pn(e,i):{executions:[{id:t.id,state:t.state,workflow:t.workflow?.name||null,phase:t.workflow?.steps?.[t.workflow.current_step]||null}]}})}return[...r.values()]}function In(e=[],t=[]){let n=new Map(t.map(e=>[e.identity.key,e])),r=Fn(e,[]),i=new Map(r.map(e=>[e.key,e]));for(let[t,r]of n)i.set(t,{...r,key:t,...Pn(e,r.identity)});return[...i.values()].map(e=>{let t=n.get(e.key)||null,r=e.active_execution||e.latest_execution||e.executions[0]||null;return{key:e.key,identity:e.identity,title:t?.title||e.title,url:e.url,source_status:t?`loaded`:e.identity?`not_loaded`:`local`,issue:t,executions:e.executions,active_execution:e.active_execution||null,latest_execution:e.latest_execution||r,execution_id:r?.id||null,state:r?.state||`not_started`,workflow:r?.workflow||null,phase:r?.phase||null}})}function Ln({items:e,label:t}){let[n,r]=(0,_.useState)(e[0].id),i=(0,_.useId)(),a=e.some(e=>e.id===n)?n:e[0].id;function o(t,n){let a;t.key===`ArrowRight`&&(a=(n+1)%e.length),t.key===`ArrowLeft`&&(a=(n+e.length-1)%e.length),t.key===`Home`&&(a=0),t.key===`End`&&(a=e.length-1),a!==void 0&&(t.preventDefault(),r(e[a].id),document.getElementById(`${i}-tab-${e[a].id}`)?.focus())}return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{role:`tablist`,"aria-label":t,className:`mb-6 flex gap-4 overflow-x-auto overflow-y-hidden border-b border-border`,children:e.map((e,t)=>(0,H.jsx)(`button`,{id:`${i}-tab-${e.id}`,type:`button`,role:`tab`,"aria-selected":a===e.id,"aria-controls":`${i}-panel-${e.id}`,tabIndex:a===e.id?0:-1,onKeyDown:e=>o(e,t),onClick:()=>r(e.id),className:yn(`-mb-px border-b-2 px-0 py-3 text-sm font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2`,a===e.id?`border-primary text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:e.label},e.id))}),e.map(e=>(0,H.jsx)(`section`,{id:`${i}-panel-${e.id}`,role:`tabpanel`,"aria-labelledby":`${i}-tab-${e.id}`,hidden:a!==e.id,tabIndex:0,className:`focus-visible:outline-2 focus-visible:outline-ring`,children:e.content},e.id))]})}function Rn({className:e,...t}){return(0,H.jsx)(`div`,{className:yn(`crafted-card rounded-sm border border-border bg-surface`,e),...t})}function zn(e,t){let[n,r]=(0,_.useState)({jobID:null,byRun:{},error:``});return(0,_.useEffect)(()=>{if(!e?.task)return;let n=new AbortController;return fetch(`/api/v1/jobs/${encodeURIComponent(e.id)}/artifacts`,{headers:{"X-Factory-Session":t},signal:n.signal}).then(async e=>{if(!e.ok)throw Error(`Could not load outputs`);return e.json()}).then(t=>{let i=Object.create(null);for(let e of t)(i[e.run_id]||=[]).push(e);n.signal.aborted||r({jobID:e.id,byRun:i,error:``})}).catch(t=>{n.signal.aborted||r({jobID:e.id,byRun:{},error:t.message})}),()=>n.abort()},[e?.id,e?.updated_at,!!e?.task,t]),n.jobID===e?.id?n:{byRun:{},error:``}}function Bn({artifacts:e,runID:t,csrfToken:n}){let r=(0,_.useRef)(null),i=(0,_.useRef)(null),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(``),p=e.byRun[t]||[];(0,_.useEffect)(()=>(o(null),c(``),u(``),()=>{r.current?.abort(),i.current&&URL.revokeObjectURL(i.current),i.current=null}),[t]);function m(e){return e.content_type===`image/png`?e.size<=2097152:e.size<=1048576&&(e.content_type?.startsWith(`text/`)||/\.(md|txt|json|csv|log|ya?ml|toml|py|js|ts|go|sh|html|xml|css)$/i.test(e.path))}function h(){i.current&&URL.revokeObjectURL(i.current),i.current=null,o(null)}async function g(e){r.current?.abort();let t=new AbortController;r.current=t,h(),c(e.id),u(``);try{let r=await fetch(`/api/v1/artifacts/${encodeURIComponent(e.id)}/content`,{headers:{"X-Factory-Session":n},signal:t.signal});if(!r.ok)throw Error(r.status===410?`This file has expired.`:`Could not open file`);if(e.content_type===`image/png`){let n=URL.createObjectURL(await r.blob());t.signal.aborted?URL.revokeObjectURL(n):(i.current=n,o({file:e,imageUrl:n}))}else{let n=await r.text();if(n.includes(`\0`))throw Error(`This file is binary. Download it to view it.`);t.signal.aborted||o({file:e,body:n})}}catch(e){t.signal.aborted||u(e.message)}finally{t.signal.aborted||c(``)}}async function v(e){u(``),f(e.id);try{let t=await fetch(`/api/v1/artifacts/${encodeURIComponent(e.id)}/content`,{headers:{"X-Factory-Session":n}});if(!t.ok)throw Error(t.status===410?`This output has expired.`:`Download failed`);let r=URL.createObjectURL(await t.blob()),i=document.createElement(`a`);i.href=r,i.download=e.path.split(`/`).at(-1),i.click(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch(e){u(e.message)}finally{f(``)}}return!p.length&&!l&&!e.error?null:(0,H.jsxs)(`section`,{"aria-label":`Files`,className:`space-y-2`,children:[(l||e.error)&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:l||e.error}),(0,H.jsx)(`ul`,{className:`divide-y divide-border rounded-lg border border-border`,children:p.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-center gap-4 px-4 py-3 text-sm`,children:[(0,H.jsx)(se,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),e.expired_at?(0,H.jsx)(`span`,{className:`min-w-0 flex-1 break-all text-muted-foreground`,children:e.path}):(0,H.jsx)(`button`,{type:`button`,className:`min-w-0 flex-1 break-all text-left font-medium text-primary underline underline-offset-4 hover:decoration-2 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,"aria-label":`${m(e)?`View`:`Download`} ${e.path}`,disabled:!!(s||d),onClick:()=>m(e)?g(e):v(e),children:s===e.id?`Opening…`:e.path}),(0,H.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.expired_at?`Expired`:`${(e.size/1024).toFixed(1)} KB`}),!e.expired_at&&(0,H.jsx)(`button`,{type:`button`,className:`rounded-md p-2 text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,"aria-label":`Download ${e.path}`,disabled:!!d,onClick:()=>v(e),children:(0,H.jsx)(N,{className:`size-4`})})]},e.id))}),a&&(0,H.jsxs)(`section`,{"aria-label":`Preview ${a.file.path}`,className:`overflow-hidden rounded-lg border border-border`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-border bg-muted/40 px-4 py-2`,children:[(0,H.jsxs)(`h3`,{className:`min-w-0 break-all text-sm font-medium`,children:[a.file.path,` `,(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`· Preview`})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded-md p-2 hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,"aria-label":`Close file preview`,onClick:h,children:(0,H.jsx)(xe,{className:`size-4`})})]}),a.imageUrl?(0,H.jsx)(`img`,{src:a.imageUrl,alt:`Browser verification screenshot ${a.file.path}`,className:`h-auto max-h-[70vh] max-w-full object-contain`}):(0,H.jsx)(`pre`,{tabIndex:0,className:`max-h-[60vh] overflow-auto whitespace-pre-wrap break-words p-4 font-mono text-xs leading-6`,children:a.body})]})]})}function Vn(e){let t=e.runs||[],n=t.at(-1),r=e.state===`awaiting_approval`?t.find(e=>e.id===n?.reviewed_run_id):n,i=e.workflow?.current_step??0;return{result:r,history:t.filter(e=>e.id!==r?.id&&e.id!==n?.id),stages:(e.workflow?.steps||[]).map((t,n)=>({name:t,current:n===i&&e.state!==`succeeded`,complete:n<i||e.state===`succeeded`}))}}var Hn=[{id:`not_started`,label:`Not started`,count:`notStarted`,tone:`neutral`,states:[`not_started`]},{id:`in_progress`,label:`In progress`,count:`active`,tone:`violet`,states:[`queued`,`running`,`cancelling`],children:[[`queued`,`Queued`,`queued`],[`running`,`Running`,`running`],[`cancelling`,`Cancelling`,`cancelling`]]},{id:`needs_attention`,label:`Needs attention`,count:`needsAttention`,tone:`amber`,states:[`failed`,`timed_out`,`blocked`,`interrupted`],children:[[`failed`,`Failed`,`failed`],[`blocked`,`Blocked`,`blocked`],[`interrupted`,`Interrupted`,`interrupted`],[`review_changes`,`Revisions available · subset`,`reviewChanges`]]},{id:`awaiting_approval`,label:`Awaiting acceptance`,count:`awaitingApproval`,tone:`pink`,states:[`awaiting_approval`]},{id:`succeeded`,label:`Completed`,count:`succeeded`,tone:`green`,states:[`succeeded`]},{id:`cancelled`,label:`Cancelled`,count:`cancelled`,tone:`neutral`,states:[`cancelled`]},{id:`other`,label:`Other state`,count:`other`,tone:`neutral`,states:[]}],Un=Hn.map(e=>({...e,title:e.label})),Wn=new Set([`queued`,`running`,`cancelling`]),Gn=new Set([`failed`,`timed_out`]),Kn=new Set([`failed`,`timed_out`,`blocked`,`interrupted`]),qn=new Set([`not_started`,`queued`,`running`,`cancelling`,`failed`,`timed_out`,`blocked`,`interrupted`,`awaiting_approval`,`succeeded`,`cancelled`]);function Jn(e){return Hn.find(t=>t.states.includes(e))?.id||`other`}function Yn(e,t){return Array.isArray(t)?t.length?e.filter(e=>t.some(t=>Yn([e],t).length)):e:e.filter(e=>{switch(t){case`active`:case`in_progress`:return Wn.has(e.state);case`needs_attention`:return Kn.has(e.state);case`failed`:return Gn.has(e.state);case`not_started`:return e.state===`not_started`;case`queued`:return e.state===`queued`;case`running`:return e.state===`running`;case`cancelling`:return e.state===`cancelling`;case`blocked`:return e.state===`blocked`;case`interrupted`:return e.state===`interrupted`;case`failed_review`:return e.state===`failed`&&e.runs?.at(-1)?.command===`review`;case`review_changes`:return e.state===`failed`&&e.runs?.at(-1)?.command===`review`&&e.can_request_changes===!0;case`awaiting_approval`:return e.state===`awaiting_approval`;case`succeeded`:return e.state===`succeeded`;case`cancelled`:return e.state===`cancelled`;case`other`:return!qn.has(e.state);default:return!0}})}function Xn(e,t){let n=String(t||``).trim().toLocaleLowerCase();return n?e.filter(e=>{let t=e.runs?.at(-1);return[rr(e),e.id,e.state,e.repository,e.workflow?.name,e.command,t?.command,e.task?.spec,e.task?.source_url,e.prompt,e.trigger_subject,e.work?.identity?.number,...(e.work?.issue?.labels||[]).map(e=>e.name),...(e.work?.executions||[]).map(e=>`${e.id} ${e.workflow||``} ${e.state} ${e.phase||``}`)].some(e=>String(e||``).toLocaleLowerCase().includes(n))}):e}function Zn(e){let t=Object.fromEntries(Hn.map(e=>[e.id,[]]));for(let n of e)t[Jn(n.state)].push(n);return t}function Qn(e){let t={all:e.length,notStarted:0,active:0,failed:0,needsAttention:0,reviewFailed:0,reviewChanges:0,queued:0,running:0,cancelling:0,blocked:0,interrupted:0,awaitingApproval:0,succeeded:0,cancelled:0,other:0};for(let n of e)n.state===`not_started`&&(t.notStarted+=1),Wn.has(n.state)&&(t.active+=1),Gn.has(n.state)&&(t.failed+=1),Kn.has(n.state)&&(t.needsAttention+=1),n.state===`queued`&&(t.queued+=1),n.state===`running`&&(t.running+=1),n.state===`cancelling`&&(t.cancelling+=1),n.state===`blocked`&&(t.blocked+=1),n.state===`interrupted`&&(t.interrupted+=1),n.state===`failed`&&n.runs?.at(-1)?.command===`review`&&(t.reviewFailed+=1,n.can_request_changes===!0&&(t.reviewChanges+=1)),n.state===`awaiting_approval`&&(t.awaitingApproval+=1),n.state===`succeeded`&&(t.succeeded+=1),n.state===`cancelled`&&(t.cancelled+=1),qn.has(n.state)||(t.other+=1);return t}function $n(e){let t=e.runs||[];return e.workflow?t.at(-1):[...t].reverse().find(e=>e.state!==`queued`)||t[0]}function er(e){let t=e.runs||[];if(e.state===`awaiting_approval`){let n=t.at(-1);return t.find(e=>e.id===n?.reviewed_run_id)?.command||n?.command||e.command||``}return e.workflow?.steps?.[e.workflow.current_step]||$n(e)?.command||e.command||``}function tr(e){let t=e.runs?.at(-1);switch(e.state){case`not_started`:return`Open context to start work`;case`queued`:return`Waiting for a worker`;case`running`:return`Work in progress`;case`cancelling`:return`Stopping task`;case`failed`:return e.can_request_changes===!0&&t?.command===`review`?`Revise or retry review`:`Retry the failed phase`;case`timed_out`:return`Inspect timeout evidence and recovery options`;case`blocked`:return`Resolve the blocker; cancel before retry`;case`interrupted`:case`cancelled`:return`Verify the worker stopped before retry`;case`awaiting_approval`:return`Approve handoff or request changes`;case`succeeded`:return e.workflow?.steps?.includes(`handoff`)?`Handoff complete`:`Issue complete`;default:return`Inspect task`}}function nr(e){let t=e=>Date.parse(e.updated_at)||Date.parse(e.created_at)||0;return[...e].sort((e,n)=>t(n)-t(e))}function rr(e){let t=e.task?.title;if(typeof t==`string`&&/^Issue: https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/\d+$/.test(t)){let n=String(e.task?.spec||``).split(`
3
- `);if(n[0]?.trim()===t){let e=n.slice(1).find(e=>e.trim());if(e)return e.replace(/^#+\s*/,``).trim()}}let n=typeof e.github_issue_title==`string`?e.github_issue_title.trim():``;return e.task?.title||n||e.task?.spec||e.task?.source_url||e.prompt||e.id}var ir=`0001-01-01T00:00:00Z`,ar=new Set([`queued`,`running`]),or=new Set([`succeeded`,`failed`]);function sr(e,t,n=new Date){let r=new Date(n);return r.setHours(0,0,0,0),r.setDate(r.getDate()-Number(t)+1),e.filter(e=>{let t=Date.parse(e.created_at);return br(e.created_at)&&t>=r.getTime()&&t<=n.getTime()})}function cr(e,t,n=new Date){let r=sr(e,t,n),i=r.filter(e=>or.has(e.state)),a=i.flatMap(e=>{let t=gr(e.runs);return t===void 0?[]:[t]}),o=i.filter(e=>e.state===`succeeded`).length;return{tasks:r,totalTasks:r.length,successRate:i.length?o/i.length:null,failedTasks:i.length-o,activeTasks:r.filter(e=>ar.has(e.state)).length,averageTaskDurationMillis:a.length?Math.round(a.reduce((e,t)=>e+t,0)/a.length):null,contributingTasks:a.length}}function lr(e){return e.flatMap(e=>e.runs).filter(e=>br(e.completed_at)).sort((e,t)=>Date.parse(t.completed_at)-Date.parse(e.completed_at))}function ur(e){if(!Number.isSafeInteger(e)||e<0)return`Unavailable`;if(e<1e3)return`${e}ms`;let t=Math.floor(e/1e3),n=e%1e3;if(t<60)return n?`${t}.${String(n).padStart(3,`0`).replace(/0+$/,``)}s`:`${t}s`;let r=Math.floor(t/60),i=t%60;return r<60?`${r}m ${i}s`:`${Math.floor(r/60)}h ${r%60}m ${i}s`}function dr(e){return typeof e==`string`&&/^(0|[1-9]\d*)$/.test(e)?e.replace(/\B(?=(\d{3})+(?!\d))/g,`,`):`Unavailable`}function fr(e){return typeof e!=`number`||!Number.isFinite(e)||e<0||e>1?`Unavailable`:`${Math.round(e*1e3)/10}%`}function pr(e){let t=0n,n=0n,r=0n,i=0n,a=0,o=0,s=0,c=0,l=0;for(let u of e)if(br(u.completed_at)){if(mr(u)){l+=1;continue}o+=1,yr(u.token_usage)&&(t+=BigInt(u.token_usage),a+=1,u.usage?.coverage===`partial`&&(s+=1),[u.usage?.input_tokens,u.usage?.output_tokens,u.usage?.cached_input_tokens].every(yr)&&(c+=1,n+=BigInt(u.usage.input_tokens),r+=BigInt(u.usage.output_tokens),i+=BigInt(u.usage.cached_input_tokens)))}return{total:a?t.toString():void 0,reported:a,completed:o,partial:s,notApplicable:l,unavailable:o-a,...c&&c===a?{input:n.toString(),output:r.toString(),cached:i.toString()}:{}}}function mr(e){return e.usage?.status===`not_applicable`||[`verify`,`handoff`].includes(e.command)||e.executor===`mock`}function hr(e){if(mr(e))return`Not applicable`;let t=dr(e.token_usage);return t===`Unavailable`?t:`${t}${e.usage?.coverage===`partial`?` · partial`:``}`}function gr(e){let t=e;if(!(!t.length||!t.every(e=>xr(e.duration_millis))))return t.reduce((e,t)=>e+t.duration_millis,0)}function _r(e){return e.completed?`${e.reported} of ${e.completed} AI run${e.completed===1?``:`s`}${e.partial?` · ${e.partial} partial`:``}`:`No completed AI runs`}function vr(e){if(e.total===void 0)return`Not reported`;let t=`${dr(e.total)} tokens`,n=[];return e.partial&&n.push(`partial`),e.unavailable&&n.push(`${e.unavailable} run${e.unavailable===1?``:`s`} unreported`),n.length?`${t} reported · ${n.join(` · `)}`:t}function yr(e){return typeof e==`string`&&/^(0|[1-9]\d*)$/.test(e)}function br(e){return!!(e&&e!==ir&&Number.isFinite(Date.parse(e)))}function xr(e){return Number.isSafeInteger(e)&&e>=0}function Sr({source:e,identity:t,links:n,navigation:r=[],csrfToken:i,job:a,loaded:o,error:s,actionError:c,removalError:l,deliveryActionError:u=``,deleting:d,onDelete:f,onWorkflowAction:p}){let m=zn(a,i);if(!a&&e)return(0,H.jsxs)(`div`,{className:`task-detail-layout`,children:[(0,H.jsxs)(`div`,{className:`task-detail-main`,children:[(0,H.jsx)(kr,{item:e,navigation:r}),(0,H.jsxs)(`header`,{className:`task-detail-heading`,children:[(0,H.jsx)(En,{value:`not_started`}),(0,H.jsx)(`h2`,{children:e.title})]}),e.panel]}),(0,H.jsxs)(`aside`,{className:`task-metadata`,"aria-label":`Issue details`,children:[(0,H.jsxs)(`h3`,{children:[(0,H.jsx)(se,{size:15}),`Metadata`]}),e.metadata]})]});if(!a)return(0,H.jsxs)(`div`,{className:`p-8`,children:[(0,H.jsx)(`a`,{href:`#/runs`,className:`text-sm underline`,children:`Back to inbox`}),(0,H.jsx)(`p`,{className:`mt-4`,children:o?`Issue not found.`:`Loading issue…`}),s&&(0,H.jsx)(`p`,{role:`alert`,children:s})]});let h=pr(a.runs||[]),g=[`succeeded`,`failed`,`cancelled`].includes(a.state),_=a.runs.at(-1),v=a.workflow?.name===`software`&&a.delivery_status&&(a.state===`succeeded`||a.delivery_status.candidate_sha||a.delivery_removal_blocked),y=a.runs.findLast(e=>e.outcome===`complete`),b=a.source_admission||{status:`legacy_unknown`,note:`Admission-time source revision was not recorded for this job.`},{result:x,history:S,stages:ee}=Vn(a),w=a.state===`awaiting_approval`;return(0,H.jsxs)(`div`,{className:`task-detail-layout`,children:[(0,H.jsxs)(`div`,{className:`task-detail-main`,children:[(0,H.jsx)(kr,{item:e||{id:a.id,href:`#/runs/${encodeURIComponent(a.id)}`},navigation:r}),(0,H.jsxs)(`header`,{className:`task-detail-heading`,children:[(0,H.jsx)(En,{value:a.state}),(0,H.jsx)(`h2`,{children:e?.title||rr(a)}),s&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:s})]}),e?.panel,ee.length>1&&(0,H.jsx)(`ol`,{className:`task-progress flex flex-wrap items-center gap-3 text-sm`,"aria-label":`Issue progress`,children:ee.map((e,t)=>(0,H.jsxs)(`li`,{className:`flex items-center gap-3`,"aria-current":e.current?`step`:void 0,children:[t>0&&(0,H.jsx)(C,{className:`size-4 text-muted-foreground`,"aria-hidden":`true`}),(0,H.jsxs)(`span`,{className:yn(`flex items-center gap-2 py-1`,e.current?`font-medium text-foreground`:`text-muted-foreground`),children:[e.complete?(0,H.jsx)(E,{className:`size-4 text-success`,"aria-label":`Complete`}):(0,H.jsx)(`span`,{className:`text-xs`,children:t+1}),On(e.name),e.current&&(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:w?`Awaiting approval`:jn(a.state)})]})]},t))}),(0,H.jsx)(Ln,{label:`Issue sections`,items:[{id:`result`,label:`Result`,content:(0,H.jsxs)(Rn,{className:`task-result space-y-5 p-5 sm:p-6`,"aria-label":`Current result`,children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold`,children:Or(a,x)}),x?.summary&&(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`Run report`}),(0,H.jsx)(`p`,{className:`line-clamp-3 whitespace-pre-wrap break-words text-sm leading-6 text-muted-foreground`,children:x.summary}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Agent-reported text. The workflow state and its evidence determine acceptance.`})]}),x?.error&&x.error!==x.summary&&(0,H.jsx)(`p`,{role:`alert`,className:`whitespace-pre-wrap break-words text-sm text-danger`,children:x.error}),(0,H.jsx)(wr,{evidence:x?.web_verification}),v&&(0,H.jsx)(Dr,{delivery:a.delivery_status}),x&&a.task&&(0,H.jsx)(Bn,{artifacts:m,runID:x.id,csrfToken:i},x.id),a.workflow&&(0,H.jsx)(Er,{job:a,result:x,deliveryActionError:u,revisionActionError:c,onAction:p},`${a.id}:${_?.id}:${a.state}`)]})},...a.task&&y?[{id:`files`,label:`Files`,content:(0,H.jsx)(Bn,{artifacts:m,runID:y.id,csrfToken:i})}]:[],...S.length?[{id:`history`,label:`History`,content:(0,H.jsx)(`ol`,{className:`space-y-4`,children:S.map(e=>(0,H.jsxs)(`li`,{className:`space-y-3 border-l-2 border-border pl-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`h3`,{className:`font-medium`,children:e.outcome===`changes_requested`?`Changes requested`:On(e.command)}),(0,H.jsx)(Dn,{value:e.outcome===`complete`?`succeeded`:e.outcome||e.state})]}),e.summary&&(0,H.jsx)(`p`,{className:`whitespace-pre-wrap break-words leading-6`,children:e.summary}),e.error&&e.error!==e.summary&&(0,H.jsx)(`p`,{className:`text-danger`,children:e.error}),(0,H.jsx)(wr,{evidence:e.web_verification}),a.task&&(0,H.jsx)(Bn,{artifacts:m,runID:e.id,csrfToken:i}),(0,H.jsx)(Cr,{run:e})]},e.id))})}]:[],{id:`instructions`,label:`Instructions`,content:(0,H.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans leading-6`,children:a.task?a.task.spec||`Use the linked source for requirements.`:a.prompt})},{id:`details`,label:`Details`,content:(0,H.jsxs)(`div`,{className:`space-y-6 text-sm`,children:[x?.revision&&(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:`mb-2 font-medium`,children:`Requested changes`}),(0,H.jsx)(`p`,{className:`whitespace-pre-wrap`,children:x.revision.feedback})]}),x?.summary&&(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:`mb-2 font-medium`,children:`Full summary`}),(0,H.jsx)(`p`,{className:`whitespace-pre-wrap break-words leading-6`,children:x.summary})]}),x&&(0,H.jsx)(Cr,{run:x}),(0,H.jsxs)(`section`,{className:`border-t border-border pt-4`,children:[(0,H.jsxs)(`dl`,{className:`my-4 grid gap-3 sm:grid-cols-3`,children:[(0,H.jsx)(Tr,{label:`Issue ID`,value:a.id}),(0,H.jsx)(Tr,{label:`Repository`,value:a.repository}),(0,H.jsx)(Tr,{label:`Created`,value:An(a.created_at)}),(0,H.jsx)(Tr,{label:`Updated`,value:An(a.updated_at)})]}),(0,H.jsx)(U,{variant:`outline`,disabled:!g||d||a.can_remove===!1,onClick:()=>f(a),children:d?`Removing…`:`Remove local execution history`}),l&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:l}),a.delivery_removal_blocked&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,role:`note`,children:a.removal_block_reason||`Trusted PR delivery is unresolved. Reconcile it or inspect the remote collision before removing this local execution history.`})]})]})}]},a.id)]}),(0,H.jsxs)(`aside`,{className:`task-metadata`,"aria-label":`Issue details`,children:[(0,H.jsxs)(`h3`,{children:[(0,H.jsx)(se,{size:15}),`Metadata`]}),e?.metadata,(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Factory job`}),(0,H.jsx)(`dd`,{children:(0,H.jsx)(`code`,{className:`source-revision-sha`,children:a.id})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Status`}),(0,H.jsx)(`dd`,{children:(0,H.jsx)(Dn,{value:a.state})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Project`}),(0,H.jsx)(`dd`,{children:t?.name||a.repository})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Workflow`}),(0,H.jsx)(`dd`,{children:On(a.workflow?.name||a.command)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Created`}),(0,H.jsx)(`dd`,{children:An(a.created_at)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Last activity`}),(0,H.jsx)(`dd`,{children:An(a.updated_at)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Requested models`}),(0,H.jsx)(`dd`,{children:[...new Set((a.runs||[]).map(e=>e.model||e.execution?.requestedModel).filter(Boolean))].join(`, `)||a.model||`Not recorded`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Recorded duration`}),(0,H.jsx)(`dd`,{children:ur(gr(a.runs||[]))})]}),(0,H.jsxs)(`div`,{className:`task-usage`,children:[(0,H.jsxs)(`dt`,{children:[(0,H.jsx)(ie,{size:13}),`Reported tokens`]}),(0,H.jsx)(`dd`,{children:vr(h)}),(0,H.jsx)(`dd`,{className:`metadata-hint`,children:_r(h)})]}),h.input!==void 0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Token breakdown`}),(0,H.jsxs)(`dd`,{children:[dr(h.input),` input`,(0,H.jsx)(`br`,{}),dr(h.output),` output`,(0,H.jsx)(`br`,{}),dr(h.cached),` cached input`]}),(0,H.jsx)(`dd`,{className:`metadata-hint`,children:`Cached input is a subset of input.`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Monetary cost`}),(0,H.jsx)(`dd`,{children:`Not reported`}),(0,H.jsx)(`dd`,{className:`metadata-hint`,children:`Token counts are usage, not a charge.`})]}),(0,H.jsxs)(`div`,{className:`task-source-revision`,children:[(0,H.jsx)(`dt`,{children:`Source ref`}),(0,H.jsx)(`dd`,{children:b.status===`retained`?b.requested_ref:`Not recorded (legacy/unknown)`})]}),(0,H.jsxs)(`div`,{className:`task-source-revision`,children:[(0,H.jsx)(`dt`,{children:`Resolved source commit`}),(0,H.jsx)(`dd`,{children:b.status===`retained`?(0,H.jsx)(`code`,{className:`source-revision-sha`,title:b.resolved_sha,children:b.resolved_sha}):b.note})]}),b.status===`retained`&&(0,H.jsxs)(`div`,{className:`task-source-revision`,children:[(0,H.jsx)(`dt`,{children:`Repository identity`}),(0,H.jsx)(`dd`,{children:(0,H.jsx)(`code`,{className:`source-revision-sha`,title:b.repository_identity,children:b.repository_identity})})]}),a.revision_mode&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Revision starting point`}),(0,H.jsx)(`dd`,{children:{fresh_source:`Fresh admitted source`,replace_source:`Explicit source replacement`,continue_candidate:`Reviewed candidate continuation`}[a.revision_mode]})]}),a.continuation&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Selected reviewed checkpoint`}),(0,H.jsxs)(`dd`,{children:[(0,H.jsx)(`code`,{className:`source-revision-sha`,children:a.continuation.head}),`Review `,(0,H.jsx)(`code`,{className:`source-revision-sha`,children:a.continuation.review_run_id}),`Original baseline `,(0,H.jsx)(`code`,{className:`source-revision-sha`,children:a.continuation.original_base})]})]}),(a.source_history||[]).length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Previous source commits`}),(0,H.jsx)(`dd`,{children:a.source_history.map((e,t)=>(0,H.jsx)(`code`,{className:`source-revision-sha`,title:e.resolved_sha,children:e.resolved_sha},`${e.resolved_sha}-${t}`))})]}),n?.repository&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Repository`}),(0,H.jsx)(`dd`,{children:(0,H.jsxs)(`a`,{className:`metadata-link`,href:n.repository,target:`_blank`,rel:`noreferrer`,children:[(0,H.jsx)(ce,{size:13}),`View repo`]})})]}),Mn(a.task?.source_url)&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Issue history`}),(0,H.jsx)(`dd`,{children:(0,H.jsx)(`a`,{href:`#/issues/${encodeURIComponent(Mn(a.task.source_url).key)}`,children:`Context and all executions`})})]}),a.task?.source_url&&/^https?:\/\//.test(a.task.source_url)&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Source`}),(0,H.jsx)(`dd`,{children:(0,H.jsxs)(`a`,{className:`metadata-link`,href:a.task.source_url,target:`_blank`,rel:`noreferrer`,children:[(0,H.jsx)(le,{size:13}),`Open source`]})})]})]})]})]})}function Cr({run:e}){let t=e.execution?e.execution.modelSelection===`not_applicable`||[`deterministic`,`mock`].includes(e.executor)?`Not applicable`:[`codex`,`pi`].includes(e.executor)?e.model||`Provider default requested`:`Not recorded by custom executor`:`Not recorded`;return(0,H.jsx)(`section`,{"aria-label":`execution details`,className:`text-xs text-muted-foreground`,children:(0,H.jsxs)(`dl`,{className:`mt-3 grid gap-3 sm:grid-cols-3`,children:[(0,H.jsx)(Tr,{label:`Started`,value:An(e.started_at)}),(0,H.jsx)(Tr,{label:`Completed`,value:An(e.completed_at)}),(0,H.jsx)(Tr,{label:`Exit code`,value:e.exit_code===void 0?`Unavailable`:String(e.exit_code)}),(0,H.jsx)(Tr,{label:`Run ID`,value:e.id,mono:!0}),(0,H.jsx)(Tr,{label:`Executor`,value:e.execution?e.executor:e.started_at?`Not recorded (legacy/unknown)`:`Not started`}),(0,H.jsx)(Tr,{label:`Host`,value:e.host_name||e.worker_name||(e.started_at?`Not recorded`:`Not assigned yet`)}),(0,H.jsx)(Tr,{label:`Duration`,value:Number.isSafeInteger(e.duration_millis)?ur(e.duration_millis):`Not available`}),(0,H.jsx)(Tr,{label:`Requested model`,value:t}),(0,H.jsx)(Tr,{label:`Runtime version`,value:e.execution?.runtimeVersion||`Not recorded`}),(0,H.jsx)(Tr,{label:`Job image`,value:e.execution?e.execution.image||`Not applicable`:`Not recorded`,mono:!0}),(0,H.jsx)(Tr,{label:`Policy hash`,value:e.execution?.policyHash||`Not recorded`,mono:!0}),(0,H.jsx)(Tr,{label:`Tokens`,value:hr(e)===`Unavailable`?`Not reported`:hr(e)})]})})}function wr({evidence:e}){if(!e)return null;let t={passed:`succeeded`,failed:`failed`,unavailable:`blocked`,inconclusive:`interrupted`}[e.status]||`blocked`;return(0,H.jsxs)(`section`,{"aria-label":`Browser verification`,className:`space-y-2 rounded-lg border border-border p-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`h4`,{className:`text-sm font-medium`,children:`Browser verification`}),(0,H.jsx)(Dn,{value:t})]}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.adapter||`Unknown tool`,e.version?` ${e.version}`:``,` · `,e.browser||`browser unknown`,e.browser_version?` ${e.browser_version}`:``,` · `,e.platform||`platform unknown`,` · `,e.coverage||`coverage unknown`]}),(0,H.jsxs)(`p`,{className:`break-all font-mono text-xs text-muted-foreground`,title:e.policyHash||``,children:[`Candidate `,String(e.candidate||`unknown`).slice(0,12),` · attempt `,e.attempt||`unknown`,` · policy `,String(e.policyHash||`unknown`).slice(0,12)]}),e.stories?.length>0&&(0,H.jsx)(`ul`,{className:`space-y-1 text-xs`,children:e.stories.map(e=>(0,H.jsxs)(`li`,{className:`space-y-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsxs)(`span`,{title:e.contentHash||``,children:[e.id,` `,(0,H.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:String(e.contentHash||``).slice(0,12)})]}),(0,H.jsx)(Dn,{value:e.status===`passed`?`succeeded`:e.status===`failed`?`failed`:e.status===`unavailable`?`blocked`:`interrupted`})]}),e.screenshot?.file&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Screenshot retained: `,e.screenshot.file]}),e.trace?.length>0&&(0,H.jsxs)(`details`,{className:`rounded-md bg-muted/30 px-2 py-1`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer`,children:[`Action trace (`,e.trace.length,`)`]}),(0,H.jsx)(`ol`,{className:`mt-1 space-y-1 pl-5`,children:e.trace.map(t=>(0,H.jsxs)(`li`,{className:`break-words`,children:[(0,H.jsx)(`span`,{className:`font-mono`,children:t.op}),t.role&&(0,H.jsxs)(H.Fragment,{children:[` · `,t.role,` “`,t.name,`”`]}),t.key&&(0,H.jsxs)(H.Fragment,{children:[` · `,t.key]}),t.expectedText&&(0,H.jsxs)(H.Fragment,{children:[` · expected “`,t.expectedText,`”`]}),(0,H.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,t.status,t.message?` · ${t.message}`:``]})]},`${e.id}:${t.index}`))})]}),e.message&&(0,H.jsx)(`p`,{className:`break-words text-xs text-muted-foreground`,children:e.message})]},e.id))})]})}function Tr({label:e,value:t,mono:n=!1}){return(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e}),(0,H.jsx)(`dd`,{className:yn(`mt-0.5 truncate text-sm`,n&&`font-mono`),title:t,children:t})]})}function Er({job:e,result:t,deliveryActionError:n=``,revisionActionError:r=``,onAction:i}){let[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(`fresh_source`),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(!1),b=e.runs.at(-1),x=async t=>{y(!0);try{await i(e,t,a,t===`request_changes`?l:``,t===`request_changes`&&p===`replace_source`?d:``,t===`request_changes`?{revision_mode:p,...p===`continue_candidate`?{run_id:h?.run_id,candidate_head:h?.head,candidate_tree:h?.tree}:{}}:{})}finally{y(!1)}},S=e.source_admission?.status===`retained`,ee=S&&[`failed`,`interrupted`,`cancelled`].includes(e.state),C=!S&&[`blocked`,`failed`,`interrupted`,`cancelled`].includes(e.state),w=e.can_request_changes??(e.state===`awaiting_approval`&&e.workflow?.name===`software`),T=e.delivery_status;return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[r&&!s&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:r}),(e.state===`awaiting_approval`||w)&&(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.state===`awaiting_approval`&&(0,H.jsxs)(U,{disabled:v||s,onClick:()=>x(`approve`),children:[`Approve and start `,On(b?.command).toLowerCase()]}),w&&(0,H.jsx)(U,{variant:`outline`,disabled:v,onClick:()=>{m(`fresh_source`),g({...e.continuation_status,run_id:b?.id}),c(!0)},children:`Request changes`})]}),s&&(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`label`,{className:`block`,children:[(0,H.jsx)(`span`,{className:`field-label`,children:`What needs to change?`}),(0,H.jsx)(`textarea`,{className:`field-control min-h-24`,value:l,onChange:e=>u(e.target.value),maxLength:4e3,placeholder:`Explain what to revise in the previous stage’s result.`})]}),(0,H.jsxs)(`label`,{className:`block`,children:[(0,H.jsx)(`span`,{className:`field-label`,children:`Revision starting point`}),(0,H.jsxs)(`select`,{className:`field-control`,value:p,onChange:e=>m(e.target.value),"aria-describedby":`revision-context-${e.id}`,children:[(0,H.jsx)(`option`,{value:`fresh_source`,children:`Start fresh from admitted source`}),(0,H.jsx)(`option`,{value:`continue_candidate`,disabled:!h?.available,children:`Continue current reviewed candidate`}),(0,H.jsx)(`option`,{value:`replace_source`,children:`Replace source with an explicit ref`})]})]}),(0,H.jsxs)(`div`,{id:`revision-context-${e.id}`,className:`text-xs text-muted-foreground space-y-2`,children:[(0,H.jsxs)(`p`,{children:[`Original source / delivery baseline `,(0,H.jsx)(`code`,{className:`source-revision-sha`,children:e.source_admission?.resolved_sha||`Unknown`})]}),p===`continue_candidate`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`p`,{children:[`Selected reviewed checkpoint `,(0,H.jsx)(`code`,{className:`source-revision-sha`,children:h?.head})]}),(0,H.jsxs)(`p`,{children:[`Tree `,(0,H.jsx)(`code`,{className:`source-revision-sha`,children:h?.tree})]}),(0,H.jsxs)(`p`,{children:[`Review attempt `,(0,H.jsx)(`code`,{className:`source-revision-sha`,children:h?.review_run_id})]}),(0,H.jsx)(`p`,{children:`Keeps the reviewed tree and the original baseline. The next review covers the whole combined change.`})]}):p===`fresh_source`?(0,H.jsx)(`p`,{children:`Discards the candidate from the next build and restores the admitted source. Prior code and evidence stay in history.`}):(0,H.jsx)(`p`,{children:`Resolves and retains a new source baseline, then starts fresh. Protected delivery still requires that base to equal the unchanged remote target.`}),!h?.available&&(0,H.jsxs)(`p`,{children:[`Continuation unavailable: `,h?.reason||`No current reviewed checkpoint is recorded.`]}),(0,H.jsx)(`p`,{children:`Every choice requires a new Build, full checks, independent Review and approval.`})]}),p===`replace_source`&&(0,H.jsxs)(`label`,{className:`block`,children:[(0,H.jsx)(`span`,{className:`field-label`,children:`New base ref`}),(0,H.jsx)(`input`,{className:`field-control`,value:d,onChange:e=>f(e.target.value),maxLength:256,placeholder:`Branch, tag or full commit ID`})]}),r&&(0,H.jsx)(`p`,{id:`revision-error-${e.id}`,role:`alert`,"aria-live":`assertive`,className:`revision-error text-sm text-danger`,children:r}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(U,{disabled:v||!l.trim()||p===`replace_source`&&!d.trim()||p===`continue_candidate`&&!h?.available,"aria-describedby":r?`revision-error-${e.id}`:`revision-context-${e.id}`,onClick:()=>x(`request_changes`),children:v?`Submitting…`:`Send feedback and revise`}),(0,H.jsx)(U,{variant:`ghost`,disabled:v,onClick:()=>c(!1),children:`Keep reviewing`})]})]})]}),(T?.can_publish||T?.can_abandon||n)&&T&&(0,H.jsxs)(`section`,{className:`trusted-delivery-action space-y-2 rounded-lg border border-border p-3`,"aria-label":`Trusted PR delivery action`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:`Optional PR delivery`}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[T.repository,` · target `,T.target,`. `,T.action_mode===`reconcile`?`This action reads the saved PR and current checks; it does not publish new content.`:T.action_mode===`publish`?`Publishing uses the accepted patch and current evidence.`:`Publication is unavailable; inspect and resolve the saved branch collision if offered.`,` Merge, integration and deployment remain separate.`]}),(n||T.error)&&(0,H.jsx)(`p`,{id:`delivery-action-error-${e.id}`,role:`alert`,"aria-live":`assertive`,className:`text-sm text-danger`,children:n||T.error}),T.can_publish&&(T.action_mode===`publish`||T.action_mode===`reconcile`)&&(0,H.jsx)(U,{className:`delivery-action-button`,variant:T.action_mode===`reconcile`?`outline`:`default`,disabled:v,"aria-describedby":n||T.error?`delivery-action-error-${e.id}`:void 0,onClick:()=>x(`publish`),children:v?T.action_mode===`reconcile`?`Reconciling…`:`Publishing…`:T.action_mode===`reconcile`?T.state===`published`?`Refresh PR readback and checks`:`Reconcile PR delivery`:`Publish accepted candidate as draft PR`}),T.can_abandon&&T.remote_collision&&(0,H.jsxs)(`div`,{className:`space-y-2 border-t border-border pt-2`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Inspect this GitHub branch and confirm it is unrelated. Factory will recheck this exact head and confirm no pull request is attached; this action records local abandonment only and leaves the remote branch unchanged.`}),(0,H.jsxs)(`p`,{className:`break-all text-xs font-mono`,children:[T.remote_collision.repository,`/`,T.remote_collision.branch,` · `,T.remote_collision.sha||`identity unavailable`]}),(0,H.jsx)(U,{className:`delivery-action-button`,variant:`outline`,disabled:v,"aria-describedby":n||T.error?`delivery-action-error-${e.id}`:void 0,onClick:()=>x(`abandon-delivery`),children:v?`Checking branch…`:`Abandon local delivery; keep remote branch`})]})]}),e.state===`blocked`&&S&&(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Resolve the blocker, then cancel this work to reconcile the worker before retrying.`}),C&&(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This legacy job has no admission-time source record and cannot be retried or revised. Submit a replacement to capture the configured source before work starts.`}),e.state===`timed_out`&&(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Inspect the timeout evidence and recovery options. This state cannot be retried directly.`}),S&&[`interrupted`,`cancelled`].includes(e.state)&&(0,H.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked)}),`I have verified the previous worker process has stopped. Retrying will inspect existing work before continuing.`]}),[`queued`,`running`,`awaiting_approval`,`blocked`,`interrupted`].includes(e.state)&&(0,H.jsx)(U,{variant:`ghost`,className:`text-muted-foreground hover:text-danger`,disabled:v,onClick:()=>x(`cancel`),children:`Cancel work`}),ee&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Retry repeats the stopped `,On(b?.command).toLowerCase(),` phase.`,b?.command===`review`&&` It does not change the candidate.`,w&&` Request changes when the implementation needs revision.`]}),ee&&(0,H.jsxs)(U,{disabled:v||s||[`interrupted`,`cancelled`].includes(e.state)&&!a,onClick:()=>x(`retry`),children:[`Retry `,On(b?.command).toLowerCase()]})]})}function Dr({delivery:e}){let t=e.pull_request,n=e.checks,r=e=>({success:`Passed`,failure:`Failed`,pending:`Pending`,queued:`Queued`,in_progress:`In progress`,unknown:`Unknown`,non_blocking:`Non-blocking results`,skipped:`Skipped`,neutral:`Neutral`,action_required:`Action required`,timed_out:`Timed out`,cancelled:`Cancelled`})[e]||`Unknown`,i=e=>{if(e.kind!==`check_run`||e.status!==`completed`)return r(e.status||`unknown`);let t=typeof e.conclusion==`string`?e.conclusion:`unknown`;return`${r(t)} · ${t}`};return(0,H.jsxs)(`section`,{className:`space-y-2 rounded-lg border border-border bg-muted/20 p-3`,"aria-label":`Delivery status`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Delivery`}),e.state===`patch_only`||e.state===`patch_only_unsupported_provider`?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Patch-only handoff · no trusted PR destination is enabled.`}):(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[e.state===`published`?`PR created or reconciled`:e.state===`ready`?`Ready for explicit draft PR delivery`:{intent:`Delivery intent saved; reconcile the same PR before deleting this issue`,publishing:`PR delivery is in progress; reconcile the same PR before deleting this issue`,uncertain:`PR delivery response is uncertain; reconcile the same PR before deleting this issue`,blocked:`PR delivery is blocked; restore current evidence or inspect the saved delivery before deleting this issue`,conflict:`PR delivery has a remote collision; inspect it before deleting this issue`,abandoned:`Local delivery was abandoned by the operator; the remote branch is preserved and publishing is disabled`,legacy_unverified:`Legacy acceptance has no bound publication evidence`,unverified:`Candidate evidence is unavailable; PR delivery is blocked`}[e.state]||e.state.replaceAll(`_`,` `),` · `,e.repository,` · target `,e.target]}),e.error&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e.error}),e.remote_collision&&(0,H.jsxs)(`dl`,{className:`grid gap-1 text-xs sm:grid-cols-2`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Conflicting remote branch`}),(0,H.jsxs)(`dd`,{className:`break-all font-mono`,children:[e.remote_collision.branch,` · `,e.remote_collision.sha||`identity unavailable`]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Remote repository and target`}),(0,H.jsxs)(`dd`,{className:`break-all`,children:[e.remote_collision.repository,` → `,e.remote_collision.target]})]})]}),e.resolution&&(0,H.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`Local delivery abandoned after confirming `,e.resolution.inspected.repository,`/`,e.resolution.inspected.branch,` at `,e.resolution.inspected.sha,`; no provider write was made and the branch remains untouched.`]}),(e.source_ref||!t&&e.branch)&&(0,H.jsxs)(`dl`,{className:`grid gap-1 text-xs sm:grid-cols-2`,children:[!t&&e.branch&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Delivery branch`}),(0,H.jsx)(`dd`,{className:`break-all font-mono`,children:e.branch})]}),e.source_ref&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Source ref at admission`}),(0,H.jsx)(`dd`,{className:`break-all font-mono`,children:e.source_ref})]})]}),t&&(0,H.jsxs)(`dl`,{className:`grid gap-1 text-xs sm:grid-cols-2`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Pull request`}),(0,H.jsx)(`dd`,{children:(0,H.jsxs)(`a`,{className:`underline`,href:t.url,target:`_blank`,rel:`noreferrer`,children:[`#`,t.number,` · `,t.state,t.merged?` · merged`:t.draft?` · draft`:``]})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Branch → target`}),(0,H.jsxs)(`dd`,{className:`break-all`,children:[t.branch,` → `,t.target]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Accepted base`}),(0,H.jsx)(`dd`,{className:`break-all font-mono`,children:e.accepted_base_sha||t.base_sha})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`PR base`}),(0,H.jsx)(`dd`,{className:`break-all font-mono`,children:t.base_sha})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`PR head / tree`}),(0,H.jsxs)(`dd`,{className:`break-all font-mono`,children:[t.head_sha,` / `,t.tree]})]}),e.candidate_sha&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Accepted candidate`}),(0,H.jsx)(`dd`,{className:`break-all font-mono`,children:e.candidate_sha})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Triggered PR checks`}),(0,H.jsx)(`dd`,{children:r(n?.state||`unknown`)})]})]}),n&&(0,H.jsxs)(`ul`,{className:`space-y-1 text-xs`,"aria-label":`Actual PR check results`,children:[[...n.check_runs||[],...n.commit_statuses||[]].map((e,t)=>(0,H.jsxs)(`li`,{className:`flex flex-wrap justify-between gap-2`,children:[e.url&&/^https:\/\//.test(e.url)?(0,H.jsx)(`a`,{className:`underline`,href:e.url,target:`_blank`,rel:`noreferrer`,children:e.name}):(0,H.jsx)(`span`,{children:e.name}),(0,H.jsx)(`span`,{children:i(e)})]},`${e.kind||e.name}-${t}`)),n.state===`unknown`&&(0,H.jsx)(`li`,{className:`text-muted-foreground`,children:`No successful PR check result is recorded.`})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Delivery records a PR only. Integration and deployment are separate.`})]})}function Or(e,t){let n=On(e.runs.at(-1)?.command);switch(e.state){case`awaiting_approval`:return t?`${On(t.command)} ready for review`:`Ready to start ${n.toLowerCase()}`;case`running`:return`${n} in progress`;case`queued`:return`${n} queued`;case`succeeded`:return`Issue complete`;default:return`${n} · ${jn(e.state)}`}}function kr({item:e,navigation:t}){let[n,r]=(0,_.useState)(``);(0,_.useEffect)(()=>{r(``);let e=e=>{e.key===`Escape`&&!e.defaultPrevented&&!e.target.closest?.(`input, textarea, select`)&&(window.location.hash=`#/inbox`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[e.id]);let i=t.findIndex(t=>t.id===e.id||t.executionID===e.id);return(0,H.jsxs)(`div`,{className:`detail-toolbar`,children:[(0,H.jsxs)(`div`,{className:`detail-position`,children:[(0,H.jsx)(`span`,{children:i>=0?`${i+1} / ${t.length}`:`Execution`}),(0,H.jsx)(`div`,{children:[-1,1].map(e=>{let n=i>=0?t[i+e]:null,r=e<0?D:ne,a=e<0?`Previous issue`:`Next issue`;return n?(0,H.jsx)(`a`,{href:n.href||`#/runs/${encodeURIComponent(n.id)}`,"aria-label":a,title:n.title,children:(0,H.jsx)(r,{size:14})},e):(0,H.jsx)(`span`,{"aria-label":`${a} unavailable`,children:(0,H.jsx)(r,{size:14})},e)})})]}),(0,H.jsxs)(`div`,{className:`detail-toolbar-actions`,children:[(0,H.jsx)(`span`,{role:`status`,className:`copy-status`,children:n}),(0,H.jsx)(`button`,{type:`button`,"aria-label":`Copy issue link`,onClick:async()=>{try{await navigator.clipboard.writeText(`${window.location.origin}/${e.href}`),r(`Link copied`)}catch{r(`Unable to copy link`)}},children:(0,H.jsx)(le,{size:16})}),(0,H.jsx)(`a`,{href:`#/inbox`,"aria-label":`Close issue detail`,title:`Close issue detail (Esc)`,children:(0,H.jsx)(xe,{size:18})})]})]})}function Ar({className:e,...t}){return(0,H.jsx)(`span`,{className:yn(`inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-semibold capitalize`,e),...t})}function jr(e){return[...new Set([e.model,...(e.runs||[]).map(e=>e.model||e.execution?.requestedModel)].filter(Boolean))]}var Mr=e=>Array.isArray(e)?e:e?[e]:[];function Nr(e,t,n){let r=Mr(t),i=Mr(n);return e.filter(e=>(!r.length||r.includes(e.workflow?.name||e.command))&&(!i.length||jr(e).some(e=>i.includes(e))))}function Pr({jobs:e,availableWorkflows:t=[],workflow:n,setWorkflow:r,model:i,setModel:a,filter:o,setFilter:s,options:c,disabled:l,labels:u=[],setLabels:d}){let f=[...new Set([...t,...e.map(e=>e.workflow?.name||e.command)].filter(Boolean))].sort(),p=[...new Set(e.flatMap(jr))].sort();return(0,H.jsxs)(`div`,{className:`task-facets`,"aria-label":`Work filters`,children:[(0,H.jsx)(Fr,{label:`Work type`,value:n,change:r,disabled:l,Icon:I,options:f.map(e=>({id:e,label:On(e)}))}),(0,H.jsx)(Fr,{label:`Models`,value:i,change:a,disabled:l,Icon:oe,options:p.map(e=>({id:e,label:e}))}),d&&(0,H.jsx)(Fr,{label:`Labels`,value:u,change:d,disabled:l,Icon:L,searchable:!0,options:[...new Map(e.flatMap(e=>e.work?.issue?.labels||[]).map(e=>[e.name,e])).values()].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({id:e.name,label:e.name,color:e.color}))}),(0,H.jsx)(Fr,{label:`Statuses`,value:o,change:s,disabled:l,Icon:L,options:c.filter(e=>e.id!==`all`)})]})}function Fr({label:e,value:t,change:n,disabled:r,Icon:i,options:a,searchable:o=!1}){let[s,c]=(0,_.useState)(!1),l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useId)(),[f,p]=(0,_.useState)(``),m=Mr(t),h=a.length>0&&a.every(e=>m.includes(e.id));return(0,_.useEffect)(()=>{if(!s)return;let e=e=>{l.current?.contains(e.target)||c(!1)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),c(!1),u.current?.focus())};return document.addEventListener(`pointerdown`,e),document.addEventListener(`focusin`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`focusin`,e),document.removeEventListener(`keydown`,t)}},[s]),(0,H.jsxs)(`div`,{ref:l,className:`facet-container`,children:[(0,H.jsxs)(`button`,{ref:u,type:`button`,className:`task-facet${m.length?` is-selected`:``}`,"aria-label":`Filter by ${e.toLowerCase()}`,"aria-expanded":s,"aria-controls":d,disabled:r,onClick:()=>c(e=>!e),children:[(0,H.jsx)(i,{size:14,"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:e}),m.length>0&&(0,H.jsx)(`span`,{className:`facet-count`,children:m.length}),(0,H.jsx)(ne,{size:12,"aria-hidden":`true`})]}),s&&(0,H.jsxs)(`div`,{id:d,className:`facet-popover`,role:`group`,"aria-label":`${e} filter options`,children:[(0,H.jsxs)(`div`,{className:`facet-popover-heading`,children:[(0,H.jsx)(`span`,{children:e}),(0,H.jsx)(`button`,{type:`button`,"aria-disabled":!m.length,onClick:()=>{m.length&&n([])},children:`Reset`})]}),o&&(0,H.jsx)(`input`,{className:`facet-search`,"aria-label":`Filter ${e.toLowerCase()} options`,placeholder:`Filter`,value:f,onChange:e=>p(e.target.value)}),(0,H.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":h,className:`facet-option facet-select-all`,disabled:!a.length,onClick:()=>n(h?[]:a.map(e=>e.id)),children:[(0,H.jsx)(`span`,{className:`facet-check`,"aria-hidden":`true`,children:h&&(0,H.jsx)(E,{size:12})}),`Select all`]}),(0,H.jsx)(`div`,{className:`facet-options`,children:a.length?a.filter(e=>e.label.toLowerCase().includes(f.toLowerCase())).map(e=>(0,H.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":m.includes(e.id),className:`facet-option`,onClick:()=>n(m.includes(e.id)?m.filter(t=>t!==e.id):[...m,e.id]),children:[(0,H.jsx)(`span`,{className:`facet-check`,"aria-hidden":`true`,children:m.includes(e.id)&&(0,H.jsx)(E,{size:12})}),(0,H.jsx)(`span`,{className:e.color?`issue-label label-${Sn(e.color)}`:void 0,children:e.label})]},e.id)):(0,H.jsx)(`p`,{className:`facet-empty`,children:`No recorded options`})})]})]})}var Ir=[{id:`not_started`,label:`Not started`,count:`notStarted`},{id:`all`,label:`All work`,count:`all`},{id:`in_progress`,label:`In progress`,count:`active`},{id:`queued`,label:`Queued`,count:`queued`},{id:`running`,label:`Running`,count:`running`},{id:`cancelling`,label:`Cancelling`,count:`cancelling`},{id:`needs_attention`,label:`Needs attention`,count:`needsAttention`},{id:`failed`,label:`Failed work`,count:`failed`},{id:`failed_review`,label:`Failed review`,count:`reviewFailed`},{id:`review_changes`,label:`Review changes available`,count:`reviewChanges`},{id:`blocked`,label:`Blocked`,count:`blocked`},{id:`interrupted`,label:`Interrupted`,count:`interrupted`},{id:`awaiting_approval`,label:`Awaiting acceptance`,count:`awaitingApproval`},{id:`succeeded`,label:`Completed`,count:`succeeded`},{id:`cancelled`,label:`Cancelled`,count:`cancelled`},{id:`other`,label:`Other state`,count:`other`}];function Lr(e,t){return e[t]??`—`}function Rr({visibleJobs:e,jobs:t,workflows:n,counts:r,loaded:i,statusError:a,submitError:o,synthetic:s,filter:c,setFilter:l,search:u,setSearch:d,workflowFilter:f,setWorkflowFilter:p,modelFilter:m,setModelFilter:h,clearFilters:g,runsView:_,setRunsView:v,refresh:y,openComposer:b,composer:x,labelFilter:S=[],setLabelFilter:ee,sourceControls:C,sourceNotice:w,sourceLoading:T,sourceUnavailable:te}){let E=S.length>0||c.length>0||!!u.trim()||f.length>0||m.length>0,ne=e=>l(e===`all`||c.length===1&&c[0]===e?[]:[e]);return(0,H.jsxs)(`div`,{className:`runs-page`,children:[(0,H.jsxs)(`div`,{className:`tasks-toolbar`,children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Inbox work`}),(0,H.jsx)(Pr,{jobs:t,availableWorkflows:n,workflow:f,setWorkflow:p,model:m,setModel:h,filter:c,setFilter:l,labels:S,setLabels:ee,options:Ir,disabled:!i}),(0,H.jsxs)(`div`,{className:`tasks-tools`,children:[(0,H.jsxs)(`div`,{className:`view-toggle`,role:`group`,"aria-label":`Work view`,children:[(0,H.jsxs)(U,{variant:`ghost`,size:`sm`,className:yn(_===`list`&&`view-active`),"aria-pressed":_===`list`,onClick:()=>v(`list`),"aria-label":`List`,title:`List view`,children:[(0,H.jsx)(ue,{className:`size-3.5`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`List`})]}),(0,H.jsxs)(U,{variant:`ghost`,size:`sm`,className:yn(_===`board`&&`view-active`),"aria-pressed":_===`board`,onClick:()=>v(`board`),"aria-label":`Board`,title:`Kanban board`,children:[(0,H.jsx)(ae,{className:`size-3.5`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Board`})]})]}),(0,H.jsxs)(`div`,{className:`task-search`,role:`search`,children:[(0,H.jsx)(he,{className:`size-4`,"aria-hidden":`true`}),(0,H.jsx)(`input`,{type:`search`,"aria-label":`Search loaded work`,placeholder:`Search loaded work`,value:u,onChange:e=>d(e.target.value)}),u&&(0,H.jsx)(`button`,{type:`button`,className:`clear-search`,"aria-label":`Clear search`,onClick:()=>d(``),children:(0,H.jsx)(xe,{className:`size-3.5`})})]})]})]}),s&&(0,H.jsx)(`p`,{className:`synthetic-note`,children:`Synthetic installation demo — no model calls.`}),(0,H.jsxs)(`div`,{className:`active-filters`,children:[(0,H.jsx)(`span`,{role:`status`,children:i?`${e.length===t.length?t.length:`${e.length} of ${t.length}`} items`:`Loading work…`}),C,(0,H.jsx)(`div`,{className:`task-list-actions`,children:(0,H.jsxs)(`button`,{onClick:g,disabled:!E,children:[`Clear filters`,(0,H.jsx)(xe,{size:12})]})})]}),w,x,a&&i&&(0,H.jsxs)(`div`,{className:`stale-banner`,role:`status`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:`Status stale.`}),` Showing the last available task data. `,a]}),(0,H.jsx)(U,{variant:`outline`,size:`sm`,onClick:y,children:`Refresh`})]}),(0,H.jsxs)(`div`,{className:yn(`run-workspace`,_===`board`&&`is-board`),children:[(0,H.jsx)(zr,{counts:r,loaded:i,filter:c,setFilter:ne}),(0,H.jsx)(`section`,{className:`task-results`,"aria-label":`Work results`,children:!i&&!a?(0,H.jsx)(Br,{kind:`loading`,title:`Loading executions`,description:`Checking the latest task state.`}):!i&&a?(0,H.jsx)(Br,{kind:`error`,title:`Execution status unavailable`,description:a,action:`Retry status`,onAction:y}):!t.length&&T?(0,H.jsx)(Br,{kind:`loading`,title:`Loading repository work`,description:`Waiting for the requested provider page.`}):!t.length&&te?(0,H.jsx)(Br,{kind:`error`,title:`Repository work unavailable`,description:`No retained executions are available. Refresh issues to retry the provider read.`}):e.length?_===`board`?(0,H.jsx)(Vr,{jobs:e}):(0,H.jsx)(`div`,{className:`task-list`,role:`list`,children:e.map(e=>(0,H.jsx)(Ur,{job:e,setFilter:ne},e.id))}):(0,H.jsx)(Wr,{filtered:E,clearFilters:g,openComposer:b})})]})]})}function zr({counts:e,loaded:t,filter:n,setFilter:r}){let i={in_progress:M,needs_attention:re,awaiting_approval:ve,succeeded:O,cancelled:k,not_started:k,other:A},a=Hn.filter(t=>(t.id!==`other`||e.other)&&(t.id!==`not_started`||e.notStarted)).map(e=>({...e,Icon:i[e.id]})),[o,s]=(0,_.useState)({in_progress:!0,needs_attention:!0});return(0,H.jsxs)(`aside`,{className:`task-filter-rail`,"aria-label":`Filter work by status`,children:[(0,H.jsx)(`button`,{className:`all-tasks-filter`,type:`button`,"aria-pressed":n.length===0,onClick:()=>r(`all`),disabled:!t,children:(0,H.jsx)(`span`,{children:`All work`})}),a.map(({Icon:i,...a})=>(0,H.jsxs)(`section`,{className:`filter-card tone-${a.tone}`,children:[(0,H.jsx)(`button`,{className:`filter-card-main`,type:`button`,"aria-pressed":n.includes(a.id),onClick:()=>r(a.id),disabled:!t,children:(0,H.jsxs)(`span`,{className:`filter-card-heading`,children:[(0,H.jsx)(i,{size:14}),(0,H.jsx)(`span`,{children:a.label}),(0,H.jsx)(`span`,{className:`filter-card-count`,children:t?e[a.count]:`—`})]})}),a.children&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{className:`filter-disclosure`,"aria-expanded":!!o[a.id],"aria-controls":`filter-${a.id}`,onClick:()=>s(e=>({...e,[a.id]:!e[a.id]})),children:[`Status details`,(0,H.jsx)(ne,{size:12})]}),(0,H.jsx)(`div`,{className:`filter-card-children`,id:`filter-${a.id}`,hidden:!o[a.id],children:a.children.map(([i,a,o])=>(0,H.jsxs)(`button`,{type:`button`,className:`filter-substate`,"aria-pressed":n.includes(i),onClick:()=>r(i),disabled:!t,children:[(0,H.jsx)(`span`,{children:a}),(0,H.jsx)(`span`,{children:Lr(t?e:{},o)})]},i))})]})]},a.id))]})}function Br({kind:e,title:t,description:n,action:r,onAction:i}){return(0,H.jsxs)(`div`,{className:`task-message task-message-${e}`,role:e===`error`?`alert`:`status`,children:[(0,H.jsx)(`h3`,{children:t}),(0,H.jsx)(`p`,{children:n}),r&&(0,H.jsx)(U,{variant:`outline`,size:`sm`,onClick:i,children:r})]})}function Vr({jobs:e}){let t=Zn(e);return(0,H.jsx)(`div`,{className:`kanban-scroll`,role:`region`,"aria-label":`Issue board — scroll horizontally`,tabIndex:0,children:(0,H.jsx)(`div`,{className:`kanban-board`,children:Un.filter(e=>(e.id!==`other`||t.other.length>0)&&(e.id!==`not_started`||t.not_started.length>0)).map(e=>(0,H.jsxs)(`section`,{className:`run-column tone-${e.tone}`,"aria-labelledby":`board-${e.id}`,children:[(0,H.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-border px-3 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h2`,{id:`board-${e.id}`,className:`text-sm font-semibold`,children:e.title}),(0,H.jsx)(`p`,{className:`break-words text-xs text-muted-foreground`,children:e.description})]}),(0,H.jsx)(Ar,{className:`shrink-0 border-border bg-surface text-muted-foreground`,"aria-label":`${t[e.id].length} visible ${e.title.toLowerCase()} work records`,children:t[e.id].length})]}),(0,H.jsx)(`div`,{className:`grid min-w-0 gap-2 p-2`,children:t[e.id].length?t[e.id].map(e=>(0,H.jsx)(Hr,{job:e},e.id)):(0,H.jsx)(`p`,{className:`px-2 py-8 text-center text-xs text-muted-foreground`,children:`No work`})})]},e.id))})})}function Hr({job:e}){let t=rr(e);return(0,H.jsx)(Rn,{className:`overflow-hidden`,children:(0,H.jsxs)(`a`,{href:e.href||`#/runs/${encodeURIComponent(e.id)}`,className:`run-card-link`,"aria-label":`Open work ${t}`,children:[(0,H.jsx)(`p`,{className:`run-card-title`,children:t}),(0,H.jsx)(Gr,{job:e}),(0,H.jsxs)(`div`,{className:`run-card-status`,children:[(0,H.jsx)(Dn,{value:e.state}),(0,H.jsx)(`span`,{children:tr(e)})]})]})})}function Ur({job:e,setFilter:t}){let n=rr(e);return(0,H.jsxs)(`article`,{className:`task-row`,role:`listitem`,children:[(0,H.jsx)(En,{value:e.state}),(0,H.jsxs)(`a`,{href:e.href||`#/runs/${encodeURIComponent(e.id)}`,className:`task-row-link`,"aria-label":`Open work ${n}, ${jn(e.state)}, ${tr(e)}`,children:[(0,H.jsx)(`p`,{className:`task-row-title`,children:n}),(0,H.jsx)(Gr,{job:e})]}),(0,H.jsx)(`button`,{className:`row-badge-filter`,"aria-label":`Filter by ${jn(e.state)} badge`,onClick:()=>t(e.state===`timed_out`?`failed`:Ir.some(t=>t.id===e.state)?e.state:`other`),children:(0,H.jsx)(Dn,{value:e.state})})]})}function Wr({filtered:e,clearFilters:t,openComposer:n}){return(0,H.jsxs)(`div`,{className:`empty-tasks`,role:`status`,children:[(0,H.jsx)(`h3`,{children:e?`No matching work`:`No loaded work yet`}),(0,H.jsx)(`p`,{children:e?`Try another state or search term.`:`Start work explicitly from a repository issue or a local execution request.`}),e?(0,H.jsx)(U,{variant:`outline`,size:`sm`,onClick:t,children:`Clear filters`}):(0,H.jsxs)(U,{variant:`outline`,size:`sm`,onClick:n,children:[(0,H.jsx)(me,{className:`size-3.5`}),`New issue`]})]})}function Gr({job:e}){let t=e.work,n=e.workflow?.name||e.command,r=er(e),i=[t?.identity?`#${t.identity.number}${t.issue?.author?` by ${t.issue.author}`:``}`:t?`Local request`:null,e.updated_at?(0,H.jsx)(`time`,{dateTime:e.updated_at,title:`Last activity ${e.updated_at}`,children:kn(e.updated_at)}):null,[n,r].filter(Boolean).map(On).join(` · `),t?.identity&&(t.issue?t.issue.state:`Source not loaded`),t?.issue?.readiness&&(0,H.jsx)(`span`,{title:`Issue readiness`,children:t.issue.readiness.label}),t?.executions.length>1?`${t.executions.length} attempts`:null].filter(Boolean);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`task-row-meta`,children:i.map((e,t)=>(0,H.jsx)(`span`,{className:`work-meta-part`,children:e},t))}),(0,H.jsx)(Cn,{labels:t?.issue?.labels})]})}var Kr=e=>`#/issues/${encodeURIComponent(e)}`;function qr({token:e,provider:t,jobs:n=[],loaded:r,refreshKey:i,onStarted:a,onLocalRequest:o,onNewIssue:s,statusError:c,refreshStatus:l,synthetic:u,issueKey:d,active:f=!0,identity:p,links:m,onNavigation:h,detailProps:g={}}){let[v,y]=(0,_.useState)(`open`),[b,x]=(0,_.useState)(null),[S,ee]=(0,_.useState)(!1),[C,w]=(0,_.useState)(``),[T,te]=(0,_.useState)({}),[E,ne]=(0,_.useState)(!1),[D,re]=(0,_.useState)(``),[O,k]=(0,_.useState)(!1),[A,j]=(0,_.useState)([]),[M,ie]=(0,_.useState)(``),[ae,oe]=(0,_.useState)([]),[N,P]=(0,_.useState)([]),[F,se]=(0,_.useState)([]),[ce,I]=(0,_.useState)(()=>window.localStorage.getItem(`factory-runs-view`)===`board`?`board`:`list`),le=(0,_.useRef)(null),ue=(0,_.useRef)(null),de=(0,_.useRef)(!0),fe=(0,_.useRef)(T);fe.current=T;let pe=(0,_.useMemo)(()=>In(n,b?.issues||[]),[n,b]),me=(0,_.useMemo)(()=>pe.map(e=>{let t=n.find(t=>t.id===e.execution_id);return{...t,id:e.key,work:e,state:e.state,task:{...t?.task,title:e.title,source_url:e.url},updated_at:t?.updated_at||e.issue?.updated_at,runs:t?.runs||[],href:e.identity?Kr(e.key):`#/runs/${e.execution_id}`}}),[pe,n]),he=(0,_.useMemo)(()=>Nr(Xn(me,M),ae,N).filter(e=>!F.length||e.work.issue?.labels.some(e=>F.includes(e.name))),[me,M,ae,N,F]),ge=(0,_.useMemo)(()=>nr(Yn(he,A)),[he,A]),_e=(0,_.useMemo)(()=>ge.map(e=>({id:e.id,executionID:e.work.execution_id,title:e.task.title,href:e.href})),[ge]);(0,_.useEffect)(()=>{h?.(_e)},[_e,h]);let ve=()=>{j([]),ie(``),oe([]),P([]),se([])},ye=d&&Mn(d.replace(/^github:/,``).replace(/:(\d+)$/,`/issues/$1`)),L=pe.find(e=>e.key===d)||(ye?{key:d,identity:ye,title:`Issue #${ye.number}`,url:ye.url,executions:[],source_status:`not_loaded`}:null),be=e=>te(t=>({...t,[d]:{...t[d],...e}}));async function xe(t,n,r){let i=await fetch(t,{method:n===void 0?`GET`:`POST`,headers:{"Content-Type":`application/json`,"X-Factory-Session":e},...n===void 0?{}:{body:JSON.stringify(n)},signal:r}),a=await i.json();if(!i.ok)throw Error(a.error||`Repository request failed.`);return a}async function Se(e=1){le.current?.abort();let t=new AbortController;le.current=t,ee(!0),w(``);try{let n=await xe(`/api/v1/issues?page=${e}&state=${v}`,void 0,t.signal);!t.signal.aborted&&de.current&&x({...n,fetched_at:new Date().toLocaleTimeString()})}catch(e){!t.signal.aborted&&de.current&&w(e.message)}finally{!t.signal.aborted&&de.current&&ee(!1)}}(0,_.useEffect)(()=>(de.current=!0,()=>{de.current=!1,le.current?.abort(),ue.current?.abort()}),[]),(0,_.useEffect)(()=>{e&&Se()},[e,v,i]);async function Ce(e,t=!1){if(ue.current?.abort(),re(``),!t&&fe.current[e.key]?.context){ne(!1);return}let n=new AbortController;ue.current=n,ne(!0);try{let t=await xe(`/api/v1/issues/preview`,{url:e.url},n.signal);!n.signal.aborted&&de.current&&te(n=>({...n,[e.key]:{brief:``,workflow:t.recommendation.workflow,sourceRef:``,model:``,...n[e.key],context:t}}))}catch(e){!n.signal.aborted&&de.current&&re(e.message)}finally{!n.signal.aborted&&de.current&&ne(!1)}}(0,_.useEffect)(()=>(f&&L&&e&&Ce(L),()=>{ue.current?.abort()}),[d,f,e]);let R=L&&T[d],we=R?.context,Te=L?.active_execution?`An execution is active or unresolved. Open its history to continue or cancel it.`:we?.start_block_reason;async function Ee(e){if(e.preventDefault(),!(O||!we||Te||D||c)){k(!0),re(``);try{let e=await xe(`/api/v1/issues/start`,{url:we.url,expected_spec:we.spec,brief:R.brief,workflow:R.workflow,...R.sourceRef.trim()?{source_ref:R.sourceRef.trim()}:{},model:R.model.trim()});de.current&&(await a(e),Se(b?.page||1))}catch(e){de.current&&re(e.message)}finally{de.current&&k(!1)}}}let De=(0,H.jsx)(Jr,{snapshot:b,state:v,setState:y,loading:S,token:e,load:Se,onLocalRequest:o,records:pe}),Oe=(0,H.jsxs)(H.Fragment,{children:[!t?.supported&&t&&(0,H.jsx)(`p`,{className:`source-boundary`,children:`Remote issues unsupported on this host. Local execution requests remain available.`}),C&&(0,H.jsxs)(`p`,{role:`alert`,className:`form-error`,children:[b?`Repository data stale. `:`Repository issues unavailable. `,C]}),S&&(0,H.jsx)(`p`,{role:`status`,className:`source-boundary`,children:`Loading repository issues…`}),b&&!b.issues?.length&&!C&&!S&&(0,H.jsx)(`p`,{className:`source-boundary`,children:`No issues on this page. Other pages or states may contain issues.`})]}),ke=L&&(0,H.jsxs)(`section`,{className:`issue-context`,"aria-label":`Repository issue context`,children:[(0,H.jsx)(U,{variant:`outline`,size:`sm`,disabled:O||E,onClick:()=>Ce(L,!0),children:`Refresh issue context`}),E&&(0,H.jsx)(`p`,{role:`status`,children:`Loading issue context…`}),D&&(0,H.jsxs)(`p`,{role:`alert`,className:`form-error`,children:[we?`Context may be stale. `:``,D]}),c&&(0,H.jsxs)(`p`,{role:`alert`,className:`form-error`,children:[`Execution history stale: `,c]}),we&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`details`,{open:!L.execution_id,children:[(0,H.jsx)(`summary`,{children:`Issue context`}),(0,H.jsx)(`pre`,{className:`inbox-body`,children:we.body})]}),(0,H.jsxs)(`details`,{open:!L.execution_id,children:[(0,H.jsx)(`summary`,{children:`Start work · explicit scope and options`}),(0,H.jsxs)(`form`,{onSubmit:Ee,className:`inbox-start`,children:[(0,H.jsxs)(`p`,{className:`work-help`,children:[`Suggested: `,On(we.recommendation.workflow),`. `,we.recommendation.reason]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`field-label`,children:`Work type`}),(0,H.jsxs)(`select`,{className:`field-control`,value:R.workflow,onChange:e=>be({workflow:e.target.value}),children:[(0,H.jsx)(`option`,{value:`software`,children:`Software`}),(0,H.jsx)(`option`,{value:`defence`,children:`Defence`})]})]}),(0,H.jsx)(`p`,{className:`work-help`,children:R.workflow===`defence`?`Investigates supplied, non-sensitive evidence and produces a private draft. Private security reports use incident --file, never public issues.`:`Implements scoped changes, runs checks and requests independent review. Security remediation can be Software work.`}),(0,H.jsxs)(`details`,{children:[(0,H.jsx)(`summary`,{children:`Operator brief and additional options`}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`field-label`,children:`Operator brief · optional`}),(0,H.jsx)(`textarea`,{className:`field-control`,maxLength:16e3,value:R.brief,onChange:e=>be({brief:e.target.value})})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`field-label`,children:`Source ref · optional`}),(0,H.jsx)(`input`,{className:`field-control`,maxLength:256,value:R.sourceRef,onChange:e=>be({sourceRef:e.target.value})})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`field-label`,children:`Model override · optional`}),(0,H.jsx)(`input`,{className:`field-control`,maxLength:128,value:R.model,onChange:e=>be({model:e.target.value})})]})]}),Te&&(0,H.jsx)(`p`,{className:`work-help`,children:Te}),(0,H.jsx)(U,{disabled:O||E||!r||!!D||!!c||!!Te,children:O?`Starting…`:`Start work`})]})]})]}),(0,H.jsxs)(`details`,{open:!L.execution_id,children:[(0,H.jsxs)(`summary`,{children:[`Linked execution attempts (`,L.executions.length,`)`]}),(0,H.jsx)(`div`,{className:`inbox-attempts`,children:L.executions.length?L.executions.map(e=>(0,H.jsxs)(`a`,{href:`#/runs/${e.id}`,children:[On(e.workflow)||`Workflow unknown`,` · `,jn(e.state),` · `,On(e.phase),` `,(0,H.jsx)(`small`,{children:e.id})]},e.id)):(0,H.jsx)(`p`,{className:`work-help`,children:`No executions. Browsing does not start work.`})})]})]}),Ae=L&&(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Repository issue`}),(0,H.jsx)(`dd`,{children:(0,H.jsxs)(`a`,{href:L.url,target:`_blank`,rel:`noreferrer`,children:[`#`,L.identity.number,` · View original issue ↗`]})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Source state`}),(0,H.jsxs)(`dd`,{children:[we?.state||L.issue?.state||`Not loaded`,D?` · unavailable / stale`:``]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Readiness`}),(0,H.jsx)(`dd`,{children:we?.readiness.label||L.issue?.readiness.label||`Unknown`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Labels`}),(0,H.jsx)(`dd`,{children:(0,H.jsx)(Cn,{labels:we?.labels||L.issue?.labels})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Created`}),(0,H.jsx)(`dd`,{children:An(we?.created_at||L.issue?.created_at)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Author`}),(0,H.jsx)(`dd`,{children:we?.author||L.issue?.author||`Unknown`})]}),!L.execution_id&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Execution`}),(0,H.jsx)(`dd`,{children:`Not started`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Workflow / model`}),(0,H.jsx)(`dd`,{children:`Unassigned / unknown`})]})]})]});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`section`,{className:`inbox-page`,"aria-label":`Project Inbox`,hidden:!!d,children:(0,H.jsx)(Rr,{visibleJobs:ge,jobs:me,counts:Qn(he),loaded:r,statusError:c,synthetic:u,filter:A,setFilter:j,search:M,setSearch:ie,workflowFilter:ae,setWorkflowFilter:oe,modelFilter:N,setModelFilter:P,labelFilter:F,setLabelFilter:se,clearFilters:ve,runsView:ce,setRunsView:e=>{I(e),window.localStorage.setItem(`factory-runs-view`,e)},refresh:l,openComposer:s,sourceControls:De,sourceNotice:Oe,sourceLoading:S&&!b,sourceUnavailable:!!C&&!b})}),f&&d&&(0,H.jsx)(Sr,{...g,identity:p,links:m,csrfToken:e,job:n.find(e=>e.id===L?.execution_id),loaded:r,error:c,navigation:_e,source:L&&{id:L.key,href:Kr(L.key),title:we?.title||L.title,panel:ke,metadata:Ae}})]})}function Jr({snapshot:e,state:t,setState:n,loading:r,token:i,load:a,onLocalRequest:o,records:s}){let[c,l]=(0,_.useState)(!1),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useId)();(0,_.useEffect)(()=>{if(!c)return;let e=e=>{u.current?.contains(e.target)||l(!1)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),l(!1),d.current?.focus())};return document.addEventListener(`pointerdown`,e),document.addEventListener(`focusin`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`focusin`,e),document.removeEventListener(`keydown`,t)}},[c]);let p=s.filter(e=>e.identity).length,m=s.reduce((e,t)=>e+t.executions.length,0);return(0,H.jsxs)(`div`,{className:`repository-control`,ref:u,children:[(0,H.jsxs)(`button`,{type:`button`,className:`repository-trigger`,ref:d,"aria-label":`Repository`,"aria-describedby":`${f}-scope`,"aria-expanded":c,"aria-controls":f,onClick:()=>l(e=>!e),children:[(0,H.jsxs)(`span`,{children:[`Repository `,(0,H.jsx)(ne,{size:12,"aria-hidden":`true`})]}),(0,H.jsx)(`span`,{className:`repository-scope`,id:`${f}-scope`,children:e?`${e.loaded_count} loaded · Page ${e.page}`:`Page not loaded`})]}),c&&(0,H.jsxs)(`div`,{id:f,className:`repository-popover`,role:`group`,"aria-label":`Repository tools`,children:[(0,H.jsxs)(`div`,{className:`source-controls`,children:[(0,H.jsxs)(`label`,{children:[`Issue state `,(0,H.jsxs)(`select`,{"aria-label":`Repository issue state`,value:t,onChange:e=>n(e.target.value),children:[(0,H.jsx)(`option`,{value:`open`,children:`Open`}),(0,H.jsx)(`option`,{value:`closed`,children:`Closed`}),(0,H.jsx)(`option`,{value:`all`,children:`All states`})]})]}),(0,H.jsx)(U,{variant:`ghost`,size:`sm`,disabled:r||!i,onClick:()=>a(e?.state===t?e.page:1),children:`Refresh issues`}),e?.page>1&&(0,H.jsx)(U,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>a(e.page-1),children:`Previous page`}),e?.next_page&&(0,H.jsx)(U,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>a(e.next_page),children:`Next page`})]}),(0,H.jsxs)(`p`,{className:`source-boundary`,children:[e?`${e.loaded_count} issues loaded on page ${e.page} (${e.state}); ${e.total==null?`total unknown`:`${e.total} total`}. Read at ${e.fetched_at}.`:`Repository page not loaded.`,` Search covers loaded issues and retained execution history only.`,e&&e.state!==t?` Showing the previous issue-state filter until refresh succeeds.`:``]}),(0,H.jsxs)(`p`,{className:`source-boundary`,children:[s.length,` items: `,p,` repository issues and `,s.length-p,` local requests, with `,m,` execution attempts. Includes retained history outside the loaded page.`]}),o&&(0,H.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>{l(!1),o()},children:`Local execution request`})]})]})}async function Yr(e,t,n,r){let i=JSON.stringify({provider:e.id,repository:e.repository,actor:e.actor_id??e.actor,title:t.trim(),spec:n.trim(),labels:[...new Set(r)].sort()}),a=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(i));return`browser_${Array.from(new Uint8Array(a),e=>e.toString(16).padStart(2,`0`)).join(``)}`}function Xr({title:e,spec:t,labels:n,csrfToken:r,onCreated:i,onBusy:a}){let o=(0,_.useRef)(null),s=(0,_.useRef)(!0),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)([]),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(``),[g,v]=(0,_.useState)(null);async function y(e,t,n){let i=await fetch(e,{method:t===void 0?`GET`:`POST`,headers:{"Content-Type":`application/json`,"X-Factory-Session":r},...t===void 0?{}:{body:JSON.stringify(t)},signal:n}),a=await i.json();if(!i.ok)throw Error(a.error||`Repository request failed.`);return a}async function b(e){h(``);try{let[t,n]=await Promise.all([y(`/api/v1/issue-connection`,void 0,e),y(`/api/v1/issue-submissions`,void 0,e)]);s.current&&!e?.aborted&&(l(t),d(n.filter(e=>[`pending`,`uncertain`].includes(e.state))))}catch(t){s.current&&!e?.aborted&&h(t.message)}}(0,_.useEffect)(()=>{s.current=!0;let e=new AbortController;return b(e.signal),()=>{s.current=!1,e.abort()}},[]);async function x(e){p(!0),a(!0),h(``);try{await e()}catch(e){if(s.current){h(e.message);try{let e=await y(`/api/v1/issue-submissions`);if(s.current){let t=e.find(e=>e.request_id===o.current&&e.state===`created`);if(t){i(t);return}d(e.filter(e=>[`pending`,`uncertain`].includes(e.state)))}}catch{}}}finally{a(!1),s.current&&p(!1)}}return(0,H.jsxs)(`section`,{className:`issue-publish`,"aria-label":`Repository issue creation`,children:[c?(0,H.jsxs)(`p`,{className:`work-help`,children:[`Create in `,(0,H.jsx)(`strong`,{children:c.repository}),` as `,(0,H.jsx)(`strong`,{children:c.actor}),`. No execution starts.`]}):(0,H.jsx)(`p`,{className:`work-help`,children:m?`Repository connection unavailable.`:`Checking repository identity…`}),n.length>0&&(0,H.jsxs)(`p`,{className:`work-help`,children:[`Labels: `,n.join(`, `)]}),m&&(0,H.jsx)(`p`,{role:`alert`,className:`form-error`,children:m}),u.map(e=>(0,H.jsxs)(`div`,{className:`issue-receipt`,children:[(0,H.jsxs)(`strong`,{children:[`Unconfirmed: `,e.title]}),(0,H.jsx)(`p`,{className:`work-help`,children:`Check this earlier submission before creating another copy.`}),(0,H.jsx)(U,{type:`button`,variant:`outline`,disabled:f,onClick:()=>x(async()=>{let t=await y(`/api/v1/issue-submissions/${e.request_id}/recover`,{});s.current&&(v(t),d(t=>t.filter(t=>t.request_id!==e.request_id)))}),children:`Check submission`})]},e.request_id)),g?.issue&&(0,H.jsxs)(`p`,{role:`status`,children:[(0,H.jsxs)(`a`,{href:g.issue.url,target:`_blank`,rel:`noreferrer`,children:[`Recovered #`,g.issue.number,`: `,g.title,` ↗`]}),`. Select it from repository issues to start work.`]}),(0,H.jsxs)(`div`,{className:`issue-publish-actions`,children:[(0,H.jsx)(U,{type:`button`,variant:`ghost`,disabled:f,onClick:()=>b(),children:`Refresh connection`}),(0,H.jsx)(U,{type:`button`,disabled:f||!c?.available||!e.trim()||!t.trim(),onClick:()=>x(async()=>{o.current=await Yr(c,e,t,n);let r=await y(`/api/v1/issues`,{title:e,spec:t,labels:n,request_id:o.current,repository:c.repository,actor:c.actor});s.current&&i(r)}),children:f?`Creating…`:`Create issue on ${c?.label||`repository`}`})]})]})}function Zr({template:e,answers:t,setAnswers:n}){let r=(e,t)=>n(n=>({...n,[e]:t}));return(0,H.jsx)(`div`,{className:`issue-form-fields`,children:e.fields.map(e=>{if(e.type===`markdown`)return(0,H.jsx)(`p`,{className:`template-note`,children:e.value},e.id);let n=t[e.id]??e.value,i=(0,H.jsxs)(H.Fragment,{children:[e.label,e.required&&(0,H.jsx)(`span`,{"aria-label":`required`,children:` *`})]});return e.multiple?(0,H.jsx)(Qr,{field:e,value:n,onChange:t=>r(e.id,t)},e.id):(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`field-label`,children:i}),e.description&&(0,H.jsx)(`span`,{className:`work-help field-description`,children:e.description}),e.type===`dropdown`?(0,H.jsxs)(`select`,{className:`field-control`,value:n,required:e.required,onChange:t=>r(e.id,t.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`Choose an option`}),e.options.map(e=>(0,H.jsx)(`option`,{value:e.label,children:e.label},e.label))]}):e.type===`textarea`?(0,H.jsx)(`textarea`,{className:`field-control issue-form-textarea`,required:e.required,value:n,placeholder:e.placeholder,onChange:t=>r(e.id,t.target.value)}):(0,H.jsx)(`input`,{className:`field-control`,required:e.required,value:n,placeholder:e.placeholder,onChange:t=>r(e.id,t.target.value)})]},e.id)})})}function Qr({field:e,value:t,onChange:n}){let r=(0,_.useRef)(null),[i,a]=(0,_.useState)(!1),o=e.required&&!t.length,s=`Select at least one option for ${e.label}.`;(0,_.useEffect)(()=>{r.current?.setCustomValidity(o?s:``),o||a(!1)},[o,s]);let c=`choice-${e.id}-hint`;return(0,H.jsxs)(`fieldset`,{className:`issue-form-options`,"aria-describedby":e.required?c:void 0,children:[(0,H.jsxs)(`legend`,{className:`field-label`,children:[e.label,e.required?` *`:``]}),e.description&&(0,H.jsx)(`p`,{className:`work-help`,children:e.description}),e.required&&(0,H.jsx)(`p`,{id:c,className:i?`form-error`:`work-help`,role:i?`alert`:void 0,children:i?s:`Choose at least one option.`}),e.options.map((e,i)=>(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{ref:i===0?r:void 0,type:`checkbox`,checked:t.includes(e.label),required:e.required,onInvalid:()=>{o&&a(!0)},onChange:r=>n(r.target.checked?[...t,e.label]:t.filter(t=>t!==e.label))}),(0,H.jsxs)(`span`,{children:[e.label,e.required?` *`:``]})]},e.label))]})}function $r(e){if(typeof e!=`string`)return;let t=e.trim();if(!t)return;let n=t.split(/[\\/]+/).filter(Boolean).at(-1);if(!(!n||n===`.`||n===`..`||/^[a-z]:$/i.test(n)))return{name:n,path:t}}function ei(e,t){return e===`app`?t?.name||`Project identity unavailable`:e}function ti({localOnly:e=!1,onCreated:t,issueProvider:n,title:r,setTitle:i,sourceRef:a,setSourceRef:o,sourceRefDefault:s,choices:c,identity:l,selection:u,setSelection:d,repository:f,prompt:p,setPrompt:m,model:h,setModel:g,submitting:v,submit:y,close:b,csrfToken:x,projectLinks:S,error:w}){let T=(0,_.useRef)(null),te=(0,_.useRef)(!0),E=(0,_.useRef)(null),ne=(0,_.useRef)(!1),[D,re]=(0,_.useState)(`source`),[O,k]=(0,_.useState)(!1),[A,j]=(0,_.useState)(``),[M,ie]=(0,_.useState)([]),[ae,oe]=(0,_.useState)(null),[N,P]=(0,_.useState)(!1),[F,se]=(0,_.useState)(null),[ce,I]=(0,_.useState)(null),[le,ue]=(0,_.useState)({}),de=!e&&(n?.capabilities?.create??!!S?.repository),fe=n?.capabilities?.templates??!!S?.repository,me=n?.label||`GitHub`,he=de?`remote`:`local`,[ge,_e]=(0,_.useState)(!1),[ve,ye]=(0,_.useState)(null),L=u===`workflow:defence`;(0,_.useEffect)(()=>{let e=document.activeElement;return te.current=!0,T.current.showModal(),fe&&Ce(),T.current.querySelector(`[data-blank-issue]`)?.focus(),()=>{te.current=!1,E.current?.abort(),e?.focus?.()}},[]),(0,_.useEffect)(()=>{D===`review`?T.current.querySelector(`[data-review-heading]`)?.focus():T.current.querySelector(D===`fields`?`input[name="issue-title"]`:`[data-blank-issue]`)?.focus()},[D]);async function be(e,t,n){E.current?.abort();let r=new AbortController;E.current=r,k(!0),j(``);try{let i=await fetch(e,{method:t===void 0?`GET`:`POST`,headers:{"Content-Type":`application/json`,"X-Factory-Session":x},...t===void 0?{}:{body:JSON.stringify(t)},signal:r.signal}),a=await i.json();if(!i.ok)throw Error(a.error||`Could not load this issue. Try again.`);te.current&&!r.signal.aborted&&n(a)}catch(e){te.current&&!r.signal.aborted&&j(e.message)}finally{te.current&&!r.signal.aborted&&k(!1)}}function Se(e){oe(e),P(!1),ne.current||d(`workflow:${e.workflow}`),re(`review`)}function Ce(){return be(`/api/v1/issue-templates`,void 0,se)}function R(e){E.current?.abort(),k(!1),j(``),I(e),ue({}),ne.current=!1,i(e?.title||``),m(``),ie(e?.labels||[]),oe(null),re(`fields`)}function we(e){e.preventDefault(),!(D!==`fields`||O||v)&&(ce?be(`/api/v1/issue-templates/draft`,{template:ce.id,sha:ce.sha,title:r,answers:le},e=>{i(e.title),m(e.spec),ie(e.labels),Se(e.recommendation)}):p.trim()&&be(`/api/v1/intake/recommend`,{spec:[r,p].join(`
3
+ `);if(n[0]?.trim()===t){let e=n.slice(1).find(e=>e.trim());if(e)return e.replace(/^#+\s*/,``).trim()}}let n=typeof e.github_issue_title==`string`?e.github_issue_title.trim():``;return e.task?.title||n||e.task?.spec||e.task?.source_url||e.prompt||e.id}var ir=`0001-01-01T00:00:00Z`,ar=new Set([`queued`,`running`]),or=new Set([`succeeded`,`failed`]);function sr(e,t,n=new Date){let r=new Date(n);return r.setHours(0,0,0,0),r.setDate(r.getDate()-Number(t)+1),e.filter(e=>{let t=Date.parse(e.created_at);return br(e.created_at)&&t>=r.getTime()&&t<=n.getTime()})}function cr(e,t,n=new Date){let r=sr(e,t,n),i=r.filter(e=>or.has(e.state)),a=i.flatMap(e=>{let t=gr(e.runs);return t===void 0?[]:[t]}),o=i.filter(e=>e.state===`succeeded`).length;return{tasks:r,totalTasks:r.length,successRate:i.length?o/i.length:null,failedTasks:i.length-o,activeTasks:r.filter(e=>ar.has(e.state)).length,averageTaskDurationMillis:a.length?Math.round(a.reduce((e,t)=>e+t,0)/a.length):null,contributingTasks:a.length}}function lr(e){return e.flatMap(e=>e.runs).filter(e=>br(e.completed_at)).sort((e,t)=>Date.parse(t.completed_at)-Date.parse(e.completed_at))}function ur(e){if(!Number.isSafeInteger(e)||e<0)return`Unavailable`;if(e<1e3)return`${e}ms`;let t=Math.floor(e/1e3),n=e%1e3;if(t<60)return n?`${t}.${String(n).padStart(3,`0`).replace(/0+$/,``)}s`:`${t}s`;let r=Math.floor(t/60),i=t%60;return r<60?`${r}m ${i}s`:`${Math.floor(r/60)}h ${r%60}m ${i}s`}function dr(e){return typeof e==`string`&&/^(0|[1-9]\d*)$/.test(e)?e.replace(/\B(?=(\d{3})+(?!\d))/g,`,`):`Unavailable`}function fr(e){return typeof e!=`number`||!Number.isFinite(e)||e<0||e>1?`Unavailable`:`${Math.round(e*1e3)/10}%`}function pr(e){let t=0n,n=0n,r=0n,i=0n,a=0,o=0,s=0,c=0,l=0;for(let u of e)if(br(u.completed_at)){if(mr(u)){l+=1;continue}o+=1,yr(u.token_usage)&&(t+=BigInt(u.token_usage),a+=1,u.usage?.coverage===`partial`&&(s+=1),[u.usage?.input_tokens,u.usage?.output_tokens,u.usage?.cached_input_tokens].every(yr)&&(c+=1,n+=BigInt(u.usage.input_tokens),r+=BigInt(u.usage.output_tokens),i+=BigInt(u.usage.cached_input_tokens)))}return{total:a?t.toString():void 0,reported:a,completed:o,partial:s,notApplicable:l,unavailable:o-a,...c&&c===a?{input:n.toString(),output:r.toString(),cached:i.toString()}:{}}}function mr(e){return e.usage?.status===`not_applicable`||[`verify`,`handoff`].includes(e.command)||e.executor===`mock`}function hr(e){if(mr(e))return`Not applicable`;let t=dr(e.token_usage);return t===`Unavailable`?t:`${t}${e.usage?.coverage===`partial`?` · partial`:``}`}function gr(e){let t=e;if(!(!t.length||!t.every(e=>xr(e.duration_millis))))return t.reduce((e,t)=>e+t.duration_millis,0)}function _r(e){return e.completed?`${e.reported} of ${e.completed} AI run${e.completed===1?``:`s`}${e.partial?` · ${e.partial} partial`:``}`:`No completed AI runs`}function vr(e){if(e.total===void 0)return`Not reported`;let t=`${dr(e.total)} tokens`,n=[];return e.partial&&n.push(`partial`),e.unavailable&&n.push(`${e.unavailable} run${e.unavailable===1?``:`s`} unreported`),n.length?`${t} reported · ${n.join(` · `)}`:t}function yr(e){return typeof e==`string`&&/^(0|[1-9]\d*)$/.test(e)}function br(e){return!!(e&&e!==ir&&Number.isFinite(Date.parse(e)))}function xr(e){return Number.isSafeInteger(e)&&e>=0}function Sr({source:e,identity:t,links:n,navigation:r=[],csrfToken:i,job:a,loaded:o,error:s,actionError:c,removalError:l,deliveryActionError:u=``,deleting:d,onDelete:f,onWorkflowAction:p}){let m=zn(a,i);if(!a&&e)return(0,H.jsxs)(`div`,{className:`task-detail-layout`,children:[(0,H.jsxs)(`div`,{className:`task-detail-main`,children:[(0,H.jsx)(kr,{item:e,navigation:r}),(0,H.jsxs)(`header`,{className:`task-detail-heading`,children:[(0,H.jsx)(En,{value:`not_started`}),(0,H.jsx)(`h2`,{children:e.title})]}),e.panel]}),(0,H.jsxs)(`aside`,{className:`task-metadata`,"aria-label":`Issue details`,children:[(0,H.jsxs)(`h3`,{children:[(0,H.jsx)(se,{size:15}),`Metadata`]}),e.metadata]})]});if(!a)return(0,H.jsxs)(`div`,{className:`p-8`,children:[(0,H.jsx)(`a`,{href:`#/runs`,className:`text-sm underline`,children:`Back to inbox`}),(0,H.jsx)(`p`,{className:`mt-4`,children:o?`Issue not found.`:`Loading issue…`}),s&&(0,H.jsx)(`p`,{role:`alert`,children:s})]});let h=pr(a.runs||[]),g=[`succeeded`,`failed`,`cancelled`].includes(a.state),_=a.runs.at(-1),v=a.workflow?.name===`software`&&a.delivery_status&&(a.state===`succeeded`||a.delivery_status.candidate_sha||a.delivery_removal_blocked),y=a.runs.findLast(e=>e.outcome===`complete`),b=a.source_admission||{status:`legacy_unknown`,note:`Admission-time source revision was not recorded for this job.`},{result:x,history:S,stages:ee}=Vn(a),w=a.state===`awaiting_approval`;return(0,H.jsxs)(`div`,{className:`task-detail-layout`,children:[(0,H.jsxs)(`div`,{className:`task-detail-main`,children:[(0,H.jsx)(kr,{item:e||{id:a.id,href:`#/runs/${encodeURIComponent(a.id)}`},navigation:r}),(0,H.jsxs)(`header`,{className:`task-detail-heading`,children:[(0,H.jsx)(En,{value:a.state}),(0,H.jsx)(`h2`,{children:e?.title||rr(a)}),s&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:s})]}),e?.panel,ee.length>1&&(0,H.jsx)(`ol`,{className:`task-progress flex flex-wrap items-center gap-3 text-sm`,"aria-label":`Issue progress`,children:ee.map((e,t)=>(0,H.jsxs)(`li`,{className:`flex items-center gap-3`,"aria-current":e.current?`step`:void 0,children:[t>0&&(0,H.jsx)(C,{className:`size-4 text-muted-foreground`,"aria-hidden":`true`}),(0,H.jsxs)(`span`,{className:yn(`flex items-center gap-2 py-1`,e.current?`font-medium text-foreground`:`text-muted-foreground`),children:[e.complete?(0,H.jsx)(E,{className:`size-4 text-success`,"aria-label":`Complete`}):(0,H.jsx)(`span`,{className:`text-xs`,children:t+1}),On(e.name),e.current&&(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:w?`Awaiting approval`:jn(a.state)})]})]},t))}),(0,H.jsx)(Ln,{label:`Issue sections`,items:[{id:`result`,label:`Result`,content:(0,H.jsxs)(Rn,{className:`task-result space-y-5 p-5 sm:p-6`,"aria-label":`Current result`,children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold`,children:Or(a,x)}),x?.summary&&(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`Run report`}),(0,H.jsx)(`p`,{className:`line-clamp-3 whitespace-pre-wrap break-words text-sm leading-6 text-muted-foreground`,children:x.summary}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Agent-reported text. The workflow state and its evidence determine acceptance.`})]}),x?.error&&x.error!==x.summary&&(0,H.jsx)(`p`,{role:`alert`,className:`whitespace-pre-wrap break-words text-sm text-danger`,children:x.error}),(0,H.jsx)(wr,{evidence:x?.web_verification}),v&&(0,H.jsx)(Dr,{delivery:a.delivery_status}),x&&a.task&&(0,H.jsx)(Bn,{artifacts:m,runID:x.id,csrfToken:i},x.id),a.workflow&&(0,H.jsx)(Er,{job:a,result:x,deliveryActionError:u,revisionActionError:c,onAction:p},`${a.id}:${_?.id}:${a.state}`)]})},...a.task&&y?[{id:`files`,label:`Files`,content:(0,H.jsx)(Bn,{artifacts:m,runID:y.id,csrfToken:i})}]:[],...S.length?[{id:`history`,label:`History`,content:(0,H.jsx)(`ol`,{className:`space-y-4`,children:S.map(e=>(0,H.jsxs)(`li`,{className:`space-y-3 border-l-2 border-border pl-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`h3`,{className:`font-medium`,children:e.outcome===`changes_requested`?`Changes requested`:On(e.command)}),(0,H.jsx)(Dn,{value:e.outcome===`complete`?`succeeded`:e.outcome||e.state})]}),e.summary&&(0,H.jsx)(`p`,{className:`whitespace-pre-wrap break-words leading-6`,children:e.summary}),e.error&&e.error!==e.summary&&(0,H.jsx)(`p`,{className:`text-danger`,children:e.error}),(0,H.jsx)(wr,{evidence:e.web_verification}),a.task&&(0,H.jsx)(Bn,{artifacts:m,runID:e.id,csrfToken:i}),(0,H.jsx)(Cr,{run:e})]},e.id))})}]:[],{id:`instructions`,label:`Instructions`,content:(0,H.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans leading-6`,children:a.task?a.task.spec||`Use the linked source for requirements.`:a.prompt})},{id:`details`,label:`Details`,content:(0,H.jsxs)(`div`,{className:`space-y-6 text-sm`,children:[x?.revision&&(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:`mb-2 font-medium`,children:`Requested changes`}),(0,H.jsx)(`p`,{className:`whitespace-pre-wrap`,children:x.revision.feedback})]}),x?.summary&&(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:`mb-2 font-medium`,children:`Full summary`}),(0,H.jsx)(`p`,{className:`whitespace-pre-wrap break-words leading-6`,children:x.summary})]}),x&&(0,H.jsx)(Cr,{run:x}),(0,H.jsxs)(`section`,{className:`border-t border-border pt-4`,children:[(0,H.jsxs)(`dl`,{className:`my-4 grid gap-3 sm:grid-cols-3`,children:[(0,H.jsx)(Tr,{label:`Issue ID`,value:a.id}),(0,H.jsx)(Tr,{label:`Repository`,value:a.repository}),(0,H.jsx)(Tr,{label:`Created`,value:An(a.created_at)}),(0,H.jsx)(Tr,{label:`Updated`,value:An(a.updated_at)})]}),(0,H.jsx)(U,{variant:`outline`,disabled:!g||d||a.can_remove===!1,onClick:()=>f(a),children:d?`Removing…`:`Remove local execution history`}),l&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:l}),a.delivery_removal_blocked&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,role:`note`,children:a.removal_block_reason||`Trusted PR delivery is unresolved. Reconcile it or inspect the remote collision before removing this local execution history.`})]})]})}]},a.id)]}),(0,H.jsxs)(`aside`,{className:`task-metadata`,"aria-label":`Issue details`,children:[(0,H.jsxs)(`h3`,{children:[(0,H.jsx)(se,{size:15}),`Metadata`]}),e?.metadata,(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Factory job`}),(0,H.jsx)(`dd`,{children:(0,H.jsx)(`code`,{className:`source-revision-sha`,children:a.id})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Status`}),(0,H.jsx)(`dd`,{children:(0,H.jsx)(Dn,{value:a.state})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Project`}),(0,H.jsx)(`dd`,{children:t?.name||a.repository})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Workflow`}),(0,H.jsx)(`dd`,{children:On(a.workflow?.name||a.command)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Created`}),(0,H.jsx)(`dd`,{children:An(a.created_at)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Last activity`}),(0,H.jsx)(`dd`,{children:An(a.updated_at)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Requested models`}),(0,H.jsx)(`dd`,{children:[...new Set((a.runs||[]).map(e=>e.model||e.execution?.requestedModel).filter(Boolean))].join(`, `)||a.model||`Not recorded`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Recorded duration`}),(0,H.jsx)(`dd`,{children:ur(gr(a.runs||[]))})]}),(0,H.jsxs)(`div`,{className:`task-usage`,children:[(0,H.jsxs)(`dt`,{children:[(0,H.jsx)(ie,{size:13}),`Reported tokens`]}),(0,H.jsx)(`dd`,{children:vr(h)}),(0,H.jsx)(`dd`,{className:`metadata-hint`,children:_r(h)})]}),h.input!==void 0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Token breakdown`}),(0,H.jsxs)(`dd`,{children:[dr(h.input),` input`,(0,H.jsx)(`br`,{}),dr(h.output),` output`,(0,H.jsx)(`br`,{}),dr(h.cached),` cached input`]}),(0,H.jsx)(`dd`,{className:`metadata-hint`,children:`Cached input is a subset of input.`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Monetary cost`}),(0,H.jsx)(`dd`,{children:`Not reported`}),(0,H.jsx)(`dd`,{className:`metadata-hint`,children:`Token counts are usage, not a charge.`})]}),(0,H.jsxs)(`div`,{className:`task-source-revision`,children:[(0,H.jsx)(`dt`,{children:`Source ref`}),(0,H.jsx)(`dd`,{children:b.status===`retained`?b.requested_ref:`Not recorded (legacy/unknown)`})]}),(0,H.jsxs)(`div`,{className:`task-source-revision`,children:[(0,H.jsx)(`dt`,{children:`Resolved source commit`}),(0,H.jsx)(`dd`,{children:b.status===`retained`?(0,H.jsx)(`code`,{className:`source-revision-sha`,title:b.resolved_sha,children:b.resolved_sha}):b.note})]}),b.status===`retained`&&(0,H.jsxs)(`div`,{className:`task-source-revision`,children:[(0,H.jsx)(`dt`,{children:`Repository identity`}),(0,H.jsx)(`dd`,{children:(0,H.jsx)(`code`,{className:`source-revision-sha`,title:b.repository_identity,children:b.repository_identity})})]}),a.revision_mode&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Revision starting point`}),(0,H.jsx)(`dd`,{children:{fresh_source:`Fresh admitted source`,replace_source:`Explicit source replacement`,continue_candidate:`Reviewed candidate continuation`}[a.revision_mode]})]}),a.continuation&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Selected reviewed checkpoint`}),(0,H.jsxs)(`dd`,{children:[(0,H.jsx)(`code`,{className:`source-revision-sha`,children:a.continuation.head}),`Review `,(0,H.jsx)(`code`,{className:`source-revision-sha`,children:a.continuation.review_run_id}),`Original baseline `,(0,H.jsx)(`code`,{className:`source-revision-sha`,children:a.continuation.original_base})]})]}),(a.source_history||[]).length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Previous source commits`}),(0,H.jsx)(`dd`,{children:a.source_history.map((e,t)=>(0,H.jsx)(`code`,{className:`source-revision-sha`,title:e.resolved_sha,children:e.resolved_sha},`${e.resolved_sha}-${t}`))})]}),n?.repository&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Repository`}),(0,H.jsx)(`dd`,{children:(0,H.jsxs)(`a`,{className:`metadata-link`,href:n.repository,target:`_blank`,rel:`noreferrer`,children:[(0,H.jsx)(ce,{size:13}),`View repo`]})})]}),Mn(a.task?.source_url)&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Issue history`}),(0,H.jsx)(`dd`,{children:(0,H.jsx)(`a`,{href:`#/issues/${encodeURIComponent(Mn(a.task.source_url).key)}`,children:`Context and all executions`})})]}),a.task?.source_url&&/^https?:\/\//.test(a.task.source_url)&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Source`}),(0,H.jsx)(`dd`,{children:(0,H.jsxs)(`a`,{className:`metadata-link`,href:a.task.source_url,target:`_blank`,rel:`noreferrer`,children:[(0,H.jsx)(le,{size:13}),`Open source`]})})]})]})]})]})}function Cr({run:e}){let t=e.execution?e.execution.modelSelection===`not_applicable`||[`deterministic`,`mock`].includes(e.executor)?`Not applicable`:[`codex`,`pi`].includes(e.executor)?e.model||`Provider default requested`:`Not recorded by custom executor`:`Not recorded`;return(0,H.jsx)(`section`,{"aria-label":`execution details`,className:`text-xs text-muted-foreground`,children:(0,H.jsxs)(`dl`,{className:`mt-3 grid gap-3 sm:grid-cols-3`,children:[(0,H.jsx)(Tr,{label:`Started`,value:An(e.started_at)}),(0,H.jsx)(Tr,{label:`Completed`,value:An(e.completed_at)}),(0,H.jsx)(Tr,{label:`Exit code`,value:e.exit_code===void 0?`Unavailable`:String(e.exit_code)}),(0,H.jsx)(Tr,{label:`Run ID`,value:e.id,mono:!0}),(0,H.jsx)(Tr,{label:`Executor`,value:e.execution?e.executor:e.started_at?`Not recorded (legacy/unknown)`:`Not started`}),(0,H.jsx)(Tr,{label:`Host`,value:e.host_name||e.worker_name||(e.started_at?`Not recorded`:`Not assigned yet`)}),(0,H.jsx)(Tr,{label:`Duration`,value:Number.isSafeInteger(e.duration_millis)?ur(e.duration_millis):`Not available`}),(0,H.jsx)(Tr,{label:`Requested model`,value:t}),(0,H.jsx)(Tr,{label:`Runtime version`,value:e.execution?.runtimeVersion||`Not recorded`}),(0,H.jsx)(Tr,{label:`Job image`,value:e.execution?e.execution.image||`Not applicable`:`Not recorded`,mono:!0}),(0,H.jsx)(Tr,{label:`Policy hash`,value:e.execution?.policyHash||`Not recorded`,mono:!0}),(0,H.jsx)(Tr,{label:`Tokens`,value:hr(e)===`Unavailable`?`Not reported`:hr(e)})]})})}function wr({evidence:e}){if(!e)return null;let t={passed:`succeeded`,failed:`failed`,unavailable:`blocked`,inconclusive:`interrupted`}[e.status]||`blocked`;return(0,H.jsxs)(`section`,{"aria-label":`Browser verification`,className:`space-y-2 rounded-lg border border-border p-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`h4`,{className:`text-sm font-medium`,children:`Browser verification`}),(0,H.jsx)(Dn,{value:t})]}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.adapter||`Unknown tool`,e.version?` ${e.version}`:``,` · `,e.browser||`browser unknown`,e.browser_version?` ${e.browser_version}`:``,` · `,e.platform||`platform unknown`,` · `,e.coverage||`coverage unknown`]}),(0,H.jsxs)(`p`,{className:`break-all font-mono text-xs text-muted-foreground`,title:e.policyHash||``,children:[`Candidate `,String(e.candidate||`unknown`).slice(0,12),` · attempt `,e.attempt||`unknown`,` · policy `,String(e.policyHash||`unknown`).slice(0,12)]}),e.stories?.length>0&&(0,H.jsx)(`ul`,{className:`space-y-1 text-xs`,children:e.stories.map(e=>(0,H.jsxs)(`li`,{className:`space-y-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsxs)(`span`,{title:e.contentHash||``,children:[e.id,` `,(0,H.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:String(e.contentHash||``).slice(0,12)})]}),(0,H.jsx)(Dn,{value:e.status===`passed`?`succeeded`:e.status===`failed`?`failed`:e.status===`unavailable`?`blocked`:`interrupted`})]}),e.screenshot?.file&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Screenshot retained: `,e.screenshot.file]}),e.trace?.length>0&&(0,H.jsxs)(`details`,{className:`rounded-md bg-muted/30 px-2 py-1`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer`,children:[`Action trace (`,e.trace.length,`)`]}),(0,H.jsx)(`ol`,{className:`mt-1 space-y-1 pl-5`,children:e.trace.map(t=>(0,H.jsxs)(`li`,{className:`break-words`,children:[(0,H.jsx)(`span`,{className:`font-mono`,children:t.op}),t.role&&(0,H.jsxs)(H.Fragment,{children:[` · `,t.role,` “`,t.name,`”`]}),t.key&&(0,H.jsxs)(H.Fragment,{children:[` · `,t.key]}),t.expectedText&&(0,H.jsxs)(H.Fragment,{children:[` · expected “`,t.expectedText,`”`]}),(0,H.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,t.status,t.message?` · ${t.message}`:``]})]},`${e.id}:${t.index}`))})]}),e.message&&(0,H.jsx)(`p`,{className:`break-words text-xs text-muted-foreground`,children:e.message})]},e.id))})]})}function Tr({label:e,value:t,mono:n=!1}){return(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e}),(0,H.jsx)(`dd`,{className:yn(`mt-0.5 truncate text-sm`,n&&`font-mono`),title:t,children:t})]})}function Er({job:e,result:t,deliveryActionError:n=``,revisionActionError:r=``,onAction:i}){let[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(`fresh_source`),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(!1),b=e.runs.at(-1),x=async t=>{y(!0);try{await i(e,t,a,t===`request_changes`?l:``,t===`request_changes`&&p===`replace_source`?d:``,t===`request_changes`?{revision_mode:p,...p===`continue_candidate`?{run_id:h?.run_id,candidate_head:h?.head,candidate_tree:h?.tree}:{}}:{})}finally{y(!1)}},S=e.source_admission?.status===`retained`,ee=S&&[`failed`,`interrupted`,`cancelled`].includes(e.state),C=!S&&[`blocked`,`failed`,`interrupted`,`cancelled`].includes(e.state),w=e.can_request_changes??(e.state===`awaiting_approval`&&e.workflow?.name===`software`),T=e.delivery_status;return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[r&&!s&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:r}),(e.state===`awaiting_approval`||w)&&(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.state===`awaiting_approval`&&(0,H.jsxs)(U,{disabled:v||s,onClick:()=>x(`approve`),children:[`Approve and start `,On(b?.command).toLowerCase()]}),w&&(0,H.jsx)(U,{variant:`outline`,disabled:v,onClick:()=>{m(`fresh_source`),g({...e.continuation_status,run_id:b?.id}),c(!0)},children:`Request changes`})]}),s&&(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`label`,{className:`block`,children:[(0,H.jsx)(`span`,{className:`field-label`,children:`What needs to change?`}),(0,H.jsx)(`textarea`,{className:`field-control min-h-24`,value:l,onChange:e=>u(e.target.value),maxLength:4e3,placeholder:`Explain what to revise in the previous stage’s result.`})]}),(0,H.jsxs)(`label`,{className:`block`,children:[(0,H.jsx)(`span`,{className:`field-label`,children:`Revision starting point`}),(0,H.jsxs)(`select`,{className:`field-control`,value:p,onChange:e=>m(e.target.value),"aria-describedby":`revision-context-${e.id}`,children:[(0,H.jsx)(`option`,{value:`fresh_source`,children:`Start fresh from admitted source`}),(0,H.jsx)(`option`,{value:`continue_candidate`,disabled:!h?.available,children:`Continue current reviewed candidate`}),(0,H.jsx)(`option`,{value:`replace_source`,children:`Replace source with an explicit ref`})]})]}),(0,H.jsxs)(`div`,{id:`revision-context-${e.id}`,className:`text-xs text-muted-foreground space-y-2`,children:[(0,H.jsxs)(`p`,{children:[`Original source / delivery baseline `,(0,H.jsx)(`code`,{className:`source-revision-sha`,children:e.source_admission?.resolved_sha||`Unknown`})]}),p===`continue_candidate`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`p`,{children:[`Selected reviewed checkpoint `,(0,H.jsx)(`code`,{className:`source-revision-sha`,children:h?.head})]}),(0,H.jsxs)(`p`,{children:[`Tree `,(0,H.jsx)(`code`,{className:`source-revision-sha`,children:h?.tree})]}),(0,H.jsxs)(`p`,{children:[`Review attempt `,(0,H.jsx)(`code`,{className:`source-revision-sha`,children:h?.review_run_id})]}),(0,H.jsx)(`p`,{children:`Keeps the reviewed tree and the original baseline. The next review covers the whole combined change.`})]}):p===`fresh_source`?(0,H.jsx)(`p`,{children:`Discards the candidate from the next build and restores the admitted source. Prior code and evidence stay in history.`}):(0,H.jsx)(`p`,{children:`Resolves and retains a new source baseline, then starts fresh. Protected delivery still requires that base to equal the unchanged remote target.`}),!h?.available&&(0,H.jsxs)(`p`,{children:[`Continuation unavailable: `,h?.reason||`No current reviewed checkpoint is recorded.`]}),(0,H.jsx)(`p`,{children:`Every choice requires a new Build, full checks, independent Review and approval.`})]}),p===`replace_source`&&(0,H.jsxs)(`label`,{className:`block`,children:[(0,H.jsx)(`span`,{className:`field-label`,children:`New base ref`}),(0,H.jsx)(`input`,{className:`field-control`,value:d,onChange:e=>f(e.target.value),maxLength:256,placeholder:`Branch, tag or full commit ID`})]}),r&&(0,H.jsx)(`p`,{id:`revision-error-${e.id}`,role:`alert`,"aria-live":`assertive`,className:`revision-error text-sm text-danger`,children:r}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(U,{disabled:v||!l.trim()||p===`replace_source`&&!d.trim()||p===`continue_candidate`&&!h?.available,"aria-describedby":r?`revision-error-${e.id}`:`revision-context-${e.id}`,onClick:()=>x(`request_changes`),children:v?`Submitting…`:`Send feedback and revise`}),(0,H.jsx)(U,{variant:`ghost`,disabled:v,onClick:()=>c(!1),children:`Keep reviewing`})]})]})]}),(T?.can_publish||T?.can_abandon||n)&&T&&(0,H.jsxs)(`section`,{className:`trusted-delivery-action space-y-2 rounded-lg border border-border p-3`,"aria-label":`Trusted PR delivery action`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:`Optional PR delivery`}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[T.repository,` · target `,T.target,`. `,T.action_mode===`reconcile`?`This action reads the saved PR and current checks; it does not publish new content.`:T.action_mode===`publish`?`Publishing uses the accepted patch and current evidence.`:`Publication is unavailable; inspect and resolve the saved branch collision if offered.`,` Merge, integration and deployment remain separate.`]}),(n||T.error)&&(0,H.jsx)(`p`,{id:`delivery-action-error-${e.id}`,role:`alert`,"aria-live":`assertive`,className:`text-sm text-danger`,children:n||T.error}),T.can_publish&&(T.action_mode===`publish`||T.action_mode===`reconcile`)&&(0,H.jsx)(U,{className:`delivery-action-button`,variant:T.action_mode===`reconcile`?`outline`:`default`,disabled:v,"aria-describedby":n||T.error?`delivery-action-error-${e.id}`:void 0,onClick:()=>x(`publish`),children:v?T.action_mode===`reconcile`?`Reconciling…`:`Publishing…`:T.action_mode===`reconcile`?T.state===`published`?`Refresh PR readback and checks`:`Reconcile PR delivery`:`Publish accepted candidate as draft PR`}),T.can_abandon&&T.remote_collision&&(0,H.jsxs)(`div`,{className:`space-y-2 border-t border-border pt-2`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Inspect this GitHub branch and confirm it is unrelated. Factory will recheck this exact head and confirm no pull request is attached; this action records local abandonment only and leaves the remote branch unchanged.`}),(0,H.jsxs)(`p`,{className:`break-all text-xs font-mono`,children:[T.remote_collision.repository,`/`,T.remote_collision.branch,` · `,T.remote_collision.sha||`identity unavailable`]}),(0,H.jsx)(U,{className:`delivery-action-button`,variant:`outline`,disabled:v,"aria-describedby":n||T.error?`delivery-action-error-${e.id}`:void 0,onClick:()=>x(`abandon-delivery`),children:v?`Checking branch…`:`Abandon local delivery; keep remote branch`})]})]}),e.state===`blocked`&&S&&(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Resolve the blocker, then cancel this work to reconcile the worker before retrying.`}),C&&(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This legacy job has no admission-time source record and cannot be retried or revised. Submit a replacement to capture the configured source before work starts.`}),e.state===`timed_out`&&(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Inspect the timeout evidence and recovery options. This state cannot be retried directly.`}),S&&[`interrupted`,`cancelled`].includes(e.state)&&(0,H.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked)}),`I have verified the previous worker process has stopped. Retrying will inspect existing work before continuing.`]}),[`queued`,`running`,`awaiting_approval`,`blocked`,`interrupted`].includes(e.state)&&(0,H.jsx)(U,{variant:`ghost`,className:`text-muted-foreground hover:text-danger`,disabled:v,onClick:()=>x(`cancel`),children:`Cancel work`}),ee&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Retry repeats the stopped `,On(b?.command).toLowerCase(),` phase.`,b?.command===`review`&&` It does not change the candidate.`,w&&` Request changes when the implementation needs revision.`]}),ee&&(0,H.jsxs)(U,{disabled:v||s||[`interrupted`,`cancelled`].includes(e.state)&&!a,onClick:()=>x(`retry`),children:[`Retry `,On(b?.command).toLowerCase()]})]})}function Dr({delivery:e}){let t=e.pull_request,n=e.checks,r=n?.target?.sha===t?.head_sha&&/^[a-f0-9]{40}$/.test(n?.target?.sha||``)&&n?.target?.repository===e.repository&&n?.target?.pull_request_number===t?.number,i=e=>({success:`Passed`,failure:`Failed`,pending:`Pending`,queued:`Queued`,in_progress:`In progress`,unknown:`Unknown`,non_blocking:`Non-blocking results`,skipped:`Skipped`,neutral:`Neutral`,action_required:`Action required`,timed_out:`Timed out`,cancelled:`Cancelled`})[e]||`Unknown`,a=e=>{if(!r||![`commit`,`pull_request`].includes(e.scope))return`Unknown · recorded ${e.conclusion||e.status||`unknown`}`;if(e.kind!==`check_run`||e.status!==`completed`)return i(e.status||`unknown`);let t=typeof e.conclusion==`string`?e.conclusion:`unknown`;return`${i(t)} · ${t}`};return(0,H.jsxs)(`section`,{className:`space-y-2 rounded-lg border border-border bg-muted/20 p-3`,"aria-label":`Delivery status`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Delivery`}),e.state===`patch_only`||e.state===`patch_only_unsupported_provider`?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Patch-only handoff · no trusted PR destination is enabled.`}):(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[e.state===`published`?`PR created or reconciled`:e.state===`ready`?`Ready for explicit draft PR delivery`:{intent:`Delivery intent saved; reconcile the same PR before deleting this issue`,publishing:`PR delivery is in progress; reconcile the same PR before deleting this issue`,uncertain:`PR delivery response is uncertain; reconcile the same PR before deleting this issue`,blocked:`PR delivery is blocked; restore current evidence or inspect the saved delivery before deleting this issue`,conflict:`PR delivery has a remote collision; inspect it before deleting this issue`,abandoned:`Local delivery was abandoned by the operator; the remote branch is preserved and publishing is disabled`,legacy_unverified:`Legacy acceptance has no bound publication evidence`,unverified:`Candidate evidence is unavailable; PR delivery is blocked`}[e.state]||e.state.replaceAll(`_`,` `),` · `,e.repository,` · target `,e.target]}),e.error&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e.error}),e.remote_collision&&(0,H.jsxs)(`dl`,{className:`grid gap-1 text-xs sm:grid-cols-2`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Conflicting remote branch`}),(0,H.jsxs)(`dd`,{className:`break-all font-mono`,children:[e.remote_collision.branch,` · `,e.remote_collision.sha||`identity unavailable`]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Remote repository and target`}),(0,H.jsxs)(`dd`,{className:`break-all`,children:[e.remote_collision.repository,` → `,e.remote_collision.target]})]})]}),e.resolution&&(0,H.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`Local delivery abandoned after confirming `,e.resolution.inspected.repository,`/`,e.resolution.inspected.branch,` at `,e.resolution.inspected.sha,`; no provider write was made and the branch remains untouched.`]}),(e.source_ref||!t&&e.branch)&&(0,H.jsxs)(`dl`,{className:`grid gap-1 text-xs sm:grid-cols-2`,children:[!t&&e.branch&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Delivery branch`}),(0,H.jsx)(`dd`,{className:`break-all font-mono`,children:e.branch})]}),e.source_ref&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Source ref at admission`}),(0,H.jsx)(`dd`,{className:`break-all font-mono`,children:e.source_ref})]})]}),t&&(0,H.jsxs)(`dl`,{className:`grid gap-1 text-xs sm:grid-cols-2`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Pull request`}),(0,H.jsx)(`dd`,{children:(0,H.jsxs)(`a`,{className:`underline`,href:t.url,target:`_blank`,rel:`noreferrer`,children:[`#`,t.number,` · `,t.state,t.merged?` · merged`:t.draft?` · draft`:``]})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Branch → target`}),(0,H.jsxs)(`dd`,{className:`break-all`,children:[t.branch,` → `,t.target]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Accepted base`}),(0,H.jsx)(`dd`,{className:`break-all font-mono`,children:e.accepted_base_sha||t.base_sha})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`PR base`}),(0,H.jsx)(`dd`,{className:`break-all font-mono`,children:t.base_sha})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`PR head / tree`}),(0,H.jsxs)(`dd`,{className:`break-all font-mono`,children:[t.head_sha,` / `,t.tree]})]}),e.candidate_sha&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Accepted candidate`}),(0,H.jsx)(`dd`,{className:`break-all font-mono`,children:e.candidate_sha})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Delivered-commit checks`}),(0,H.jsx)(`dd`,{children:i(r&&n?.state||`unknown`)})]})]}),n&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r?(0,H.jsxs)(H.Fragment,{children:[`Read from delivered commit `,(0,H.jsx)(`span`,{className:`break-all font-mono`,children:n.target.sha}),`. Commit-scoped results may have no PR association.`]}):`Check identity was not recorded; refresh PR readback to verify the delivered commit.`}),n&&(0,H.jsxs)(`ul`,{className:`space-y-1 text-xs`,"aria-label":`Delivered-commit check results`,children:[[...n.check_runs||[],...n.commit_statuses||[]].map((e,t)=>(0,H.jsxs)(`li`,{className:`flex flex-wrap justify-between gap-2`,children:[e.url&&/^https:\/\//.test(e.url)?(0,H.jsx)(`a`,{className:`underline`,href:e.url,target:`_blank`,rel:`noreferrer`,children:e.name}):(0,H.jsx)(`span`,{children:e.name}),(0,H.jsxs)(`span`,{children:[a(e),r&&e.scope===`commit`?` · commit-scoped`:``]})]},`${e.kind||e.name}-${t}`)),n.state===`unknown`&&(0,H.jsx)(`li`,{className:`text-muted-foreground`,children:n.reason||`Check readback is incomplete or unverified; individual results do not establish overall success.`})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Observed checks do not establish required-check completion, branch protection or mergeability. Integration and deployment are separate.`})]})}function Or(e,t){let n=On(e.runs.at(-1)?.command);switch(e.state){case`awaiting_approval`:return t?`${On(t.command)} ready for review`:`Ready to start ${n.toLowerCase()}`;case`running`:return`${n} in progress`;case`queued`:return`${n} queued`;case`succeeded`:return`Issue complete`;default:return`${n} · ${jn(e.state)}`}}function kr({item:e,navigation:t}){let[n,r]=(0,_.useState)(``);(0,_.useEffect)(()=>{r(``);let e=e=>{e.key===`Escape`&&!e.defaultPrevented&&!e.target.closest?.(`input, textarea, select`)&&(window.location.hash=`#/inbox`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[e.id]);let i=t.findIndex(t=>t.id===e.id||t.executionID===e.id);return(0,H.jsxs)(`div`,{className:`detail-toolbar`,children:[(0,H.jsxs)(`div`,{className:`detail-position`,children:[(0,H.jsx)(`span`,{children:i>=0?`${i+1} / ${t.length}`:`Execution`}),(0,H.jsx)(`div`,{children:[-1,1].map(e=>{let n=i>=0?t[i+e]:null,r=e<0?D:ne,a=e<0?`Previous issue`:`Next issue`;return n?(0,H.jsx)(`a`,{href:n.href||`#/runs/${encodeURIComponent(n.id)}`,"aria-label":a,title:n.title,children:(0,H.jsx)(r,{size:14})},e):(0,H.jsx)(`span`,{"aria-label":`${a} unavailable`,children:(0,H.jsx)(r,{size:14})},e)})})]}),(0,H.jsxs)(`div`,{className:`detail-toolbar-actions`,children:[(0,H.jsx)(`span`,{role:`status`,className:`copy-status`,children:n}),(0,H.jsx)(`button`,{type:`button`,"aria-label":`Copy issue link`,onClick:async()=>{try{await navigator.clipboard.writeText(`${window.location.origin}/${e.href}`),r(`Link copied`)}catch{r(`Unable to copy link`)}},children:(0,H.jsx)(le,{size:16})}),(0,H.jsx)(`a`,{href:`#/inbox`,"aria-label":`Close issue detail`,title:`Close issue detail (Esc)`,children:(0,H.jsx)(xe,{size:18})})]})]})}function Ar({className:e,...t}){return(0,H.jsx)(`span`,{className:yn(`inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-semibold capitalize`,e),...t})}function jr(e){return[...new Set([e.model,...(e.runs||[]).map(e=>e.model||e.execution?.requestedModel)].filter(Boolean))]}var Mr=e=>Array.isArray(e)?e:e?[e]:[];function Nr(e,t,n){let r=Mr(t),i=Mr(n);return e.filter(e=>(!r.length||r.includes(e.workflow?.name||e.command))&&(!i.length||jr(e).some(e=>i.includes(e))))}function Pr({jobs:e,availableWorkflows:t=[],workflow:n,setWorkflow:r,model:i,setModel:a,filter:o,setFilter:s,options:c,disabled:l,labels:u=[],setLabels:d}){let f=[...new Set([...t,...e.map(e=>e.workflow?.name||e.command)].filter(Boolean))].sort(),p=[...new Set(e.flatMap(jr))].sort();return(0,H.jsxs)(`div`,{className:`task-facets`,"aria-label":`Work filters`,children:[(0,H.jsx)(Fr,{label:`Work type`,value:n,change:r,disabled:l,Icon:I,options:f.map(e=>({id:e,label:On(e)}))}),(0,H.jsx)(Fr,{label:`Models`,value:i,change:a,disabled:l,Icon:oe,options:p.map(e=>({id:e,label:e}))}),d&&(0,H.jsx)(Fr,{label:`Labels`,value:u,change:d,disabled:l,Icon:L,searchable:!0,options:[...new Map(e.flatMap(e=>e.work?.issue?.labels||[]).map(e=>[e.name,e])).values()].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({id:e.name,label:e.name,color:e.color}))}),(0,H.jsx)(Fr,{label:`Statuses`,value:o,change:s,disabled:l,Icon:L,options:c.filter(e=>e.id!==`all`)})]})}function Fr({label:e,value:t,change:n,disabled:r,Icon:i,options:a,searchable:o=!1}){let[s,c]=(0,_.useState)(!1),l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useId)(),[f,p]=(0,_.useState)(``),m=Mr(t),h=a.length>0&&a.every(e=>m.includes(e.id));return(0,_.useEffect)(()=>{if(!s)return;let e=e=>{l.current?.contains(e.target)||c(!1)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),c(!1),u.current?.focus())};return document.addEventListener(`pointerdown`,e),document.addEventListener(`focusin`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`focusin`,e),document.removeEventListener(`keydown`,t)}},[s]),(0,H.jsxs)(`div`,{ref:l,className:`facet-container`,children:[(0,H.jsxs)(`button`,{ref:u,type:`button`,className:`task-facet${m.length?` is-selected`:``}`,"aria-label":`Filter by ${e.toLowerCase()}`,"aria-expanded":s,"aria-controls":d,disabled:r,onClick:()=>c(e=>!e),children:[(0,H.jsx)(i,{size:14,"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:e}),m.length>0&&(0,H.jsx)(`span`,{className:`facet-count`,children:m.length}),(0,H.jsx)(ne,{size:12,"aria-hidden":`true`})]}),s&&(0,H.jsxs)(`div`,{id:d,className:`facet-popover`,role:`group`,"aria-label":`${e} filter options`,children:[(0,H.jsxs)(`div`,{className:`facet-popover-heading`,children:[(0,H.jsx)(`span`,{children:e}),(0,H.jsx)(`button`,{type:`button`,"aria-disabled":!m.length,onClick:()=>{m.length&&n([])},children:`Reset`})]}),o&&(0,H.jsx)(`input`,{className:`facet-search`,"aria-label":`Filter ${e.toLowerCase()} options`,placeholder:`Filter`,value:f,onChange:e=>p(e.target.value)}),(0,H.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":h,className:`facet-option facet-select-all`,disabled:!a.length,onClick:()=>n(h?[]:a.map(e=>e.id)),children:[(0,H.jsx)(`span`,{className:`facet-check`,"aria-hidden":`true`,children:h&&(0,H.jsx)(E,{size:12})}),`Select all`]}),(0,H.jsx)(`div`,{className:`facet-options`,children:a.length?a.filter(e=>e.label.toLowerCase().includes(f.toLowerCase())).map(e=>(0,H.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":m.includes(e.id),className:`facet-option`,onClick:()=>n(m.includes(e.id)?m.filter(t=>t!==e.id):[...m,e.id]),children:[(0,H.jsx)(`span`,{className:`facet-check`,"aria-hidden":`true`,children:m.includes(e.id)&&(0,H.jsx)(E,{size:12})}),(0,H.jsx)(`span`,{className:e.color?`issue-label label-${Sn(e.color)}`:void 0,children:e.label})]},e.id)):(0,H.jsx)(`p`,{className:`facet-empty`,children:`No recorded options`})})]})]})}var Ir=[{id:`not_started`,label:`Not started`,count:`notStarted`},{id:`all`,label:`All work`,count:`all`},{id:`in_progress`,label:`In progress`,count:`active`},{id:`queued`,label:`Queued`,count:`queued`},{id:`running`,label:`Running`,count:`running`},{id:`cancelling`,label:`Cancelling`,count:`cancelling`},{id:`needs_attention`,label:`Needs attention`,count:`needsAttention`},{id:`failed`,label:`Failed work`,count:`failed`},{id:`failed_review`,label:`Failed review`,count:`reviewFailed`},{id:`review_changes`,label:`Review changes available`,count:`reviewChanges`},{id:`blocked`,label:`Blocked`,count:`blocked`},{id:`interrupted`,label:`Interrupted`,count:`interrupted`},{id:`awaiting_approval`,label:`Awaiting acceptance`,count:`awaitingApproval`},{id:`succeeded`,label:`Completed`,count:`succeeded`},{id:`cancelled`,label:`Cancelled`,count:`cancelled`},{id:`other`,label:`Other state`,count:`other`}];function Lr(e,t){return e[t]??`—`}function Rr({visibleJobs:e,jobs:t,workflows:n,counts:r,loaded:i,statusError:a,submitError:o,synthetic:s,filter:c,setFilter:l,search:u,setSearch:d,workflowFilter:f,setWorkflowFilter:p,modelFilter:m,setModelFilter:h,clearFilters:g,runsView:_,setRunsView:v,refresh:y,openComposer:b,composer:x,labelFilter:S=[],setLabelFilter:ee,sourceControls:C,sourceNotice:w,sourceLoading:T,sourceUnavailable:te}){let E=S.length>0||c.length>0||!!u.trim()||f.length>0||m.length>0,ne=e=>l(e===`all`||c.length===1&&c[0]===e?[]:[e]);return(0,H.jsxs)(`div`,{className:`runs-page`,children:[(0,H.jsxs)(`div`,{className:`tasks-toolbar`,children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Inbox work`}),(0,H.jsx)(Pr,{jobs:t,availableWorkflows:n,workflow:f,setWorkflow:p,model:m,setModel:h,filter:c,setFilter:l,labels:S,setLabels:ee,options:Ir,disabled:!i}),(0,H.jsxs)(`div`,{className:`tasks-tools`,children:[(0,H.jsxs)(`div`,{className:`view-toggle`,role:`group`,"aria-label":`Work view`,children:[(0,H.jsxs)(U,{variant:`ghost`,size:`sm`,className:yn(_===`list`&&`view-active`),"aria-pressed":_===`list`,onClick:()=>v(`list`),"aria-label":`List`,title:`List view`,children:[(0,H.jsx)(ue,{className:`size-3.5`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`List`})]}),(0,H.jsxs)(U,{variant:`ghost`,size:`sm`,className:yn(_===`board`&&`view-active`),"aria-pressed":_===`board`,onClick:()=>v(`board`),"aria-label":`Board`,title:`Kanban board`,children:[(0,H.jsx)(ae,{className:`size-3.5`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Board`})]})]}),(0,H.jsxs)(`div`,{className:`task-search`,role:`search`,children:[(0,H.jsx)(he,{className:`size-4`,"aria-hidden":`true`}),(0,H.jsx)(`input`,{type:`search`,"aria-label":`Search loaded work`,placeholder:`Search loaded work`,value:u,onChange:e=>d(e.target.value)}),u&&(0,H.jsx)(`button`,{type:`button`,className:`clear-search`,"aria-label":`Clear search`,onClick:()=>d(``),children:(0,H.jsx)(xe,{className:`size-3.5`})})]})]})]}),s&&(0,H.jsx)(`p`,{className:`synthetic-note`,children:`Synthetic installation demo — no model calls.`}),(0,H.jsxs)(`div`,{className:`active-filters`,children:[(0,H.jsx)(`span`,{role:`status`,children:i?`${e.length===t.length?t.length:`${e.length} of ${t.length}`} items`:`Loading work…`}),C,(0,H.jsx)(`div`,{className:`task-list-actions`,children:(0,H.jsxs)(`button`,{onClick:g,disabled:!E,children:[`Clear filters`,(0,H.jsx)(xe,{size:12})]})})]}),w,x,a&&i&&(0,H.jsxs)(`div`,{className:`stale-banner`,role:`status`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:`Status stale.`}),` Showing the last available task data. `,a]}),(0,H.jsx)(U,{variant:`outline`,size:`sm`,onClick:y,children:`Refresh`})]}),(0,H.jsxs)(`div`,{className:yn(`run-workspace`,_===`board`&&`is-board`),children:[(0,H.jsx)(zr,{counts:r,loaded:i,filter:c,setFilter:ne}),(0,H.jsx)(`section`,{className:`task-results`,"aria-label":`Work results`,children:!i&&!a?(0,H.jsx)(Br,{kind:`loading`,title:`Loading executions`,description:`Checking the latest task state.`}):!i&&a?(0,H.jsx)(Br,{kind:`error`,title:`Execution status unavailable`,description:a,action:`Retry status`,onAction:y}):!t.length&&T?(0,H.jsx)(Br,{kind:`loading`,title:`Loading repository work`,description:`Waiting for the requested provider page.`}):!t.length&&te?(0,H.jsx)(Br,{kind:`error`,title:`Repository work unavailable`,description:`No retained executions are available. Refresh issues to retry the provider read.`}):e.length?_===`board`?(0,H.jsx)(Vr,{jobs:e}):(0,H.jsx)(`div`,{className:`task-list`,role:`list`,children:e.map(e=>(0,H.jsx)(Ur,{job:e,setFilter:ne},e.id))}):(0,H.jsx)(Wr,{filtered:E,clearFilters:g,openComposer:b})})]})]})}function zr({counts:e,loaded:t,filter:n,setFilter:r}){let i={in_progress:M,needs_attention:re,awaiting_approval:ve,succeeded:O,cancelled:k,not_started:k,other:A},a=Hn.filter(t=>(t.id!==`other`||e.other)&&(t.id!==`not_started`||e.notStarted)).map(e=>({...e,Icon:i[e.id]})),[o,s]=(0,_.useState)({in_progress:!0,needs_attention:!0});return(0,H.jsxs)(`aside`,{className:`task-filter-rail`,"aria-label":`Filter work by status`,children:[(0,H.jsx)(`button`,{className:`all-tasks-filter`,type:`button`,"aria-pressed":n.length===0,onClick:()=>r(`all`),disabled:!t,children:(0,H.jsx)(`span`,{children:`All work`})}),a.map(({Icon:i,...a})=>(0,H.jsxs)(`section`,{className:`filter-card tone-${a.tone}`,children:[(0,H.jsx)(`button`,{className:`filter-card-main`,type:`button`,"aria-pressed":n.includes(a.id),onClick:()=>r(a.id),disabled:!t,children:(0,H.jsxs)(`span`,{className:`filter-card-heading`,children:[(0,H.jsx)(i,{size:14}),(0,H.jsx)(`span`,{children:a.label}),(0,H.jsx)(`span`,{className:`filter-card-count`,children:t?e[a.count]:`—`})]})}),a.children&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{className:`filter-disclosure`,"aria-expanded":!!o[a.id],"aria-controls":`filter-${a.id}`,onClick:()=>s(e=>({...e,[a.id]:!e[a.id]})),children:[`Status details`,(0,H.jsx)(ne,{size:12})]}),(0,H.jsx)(`div`,{className:`filter-card-children`,id:`filter-${a.id}`,hidden:!o[a.id],children:a.children.map(([i,a,o])=>(0,H.jsxs)(`button`,{type:`button`,className:`filter-substate`,"aria-pressed":n.includes(i),onClick:()=>r(i),disabled:!t,children:[(0,H.jsx)(`span`,{children:a}),(0,H.jsx)(`span`,{children:Lr(t?e:{},o)})]},i))})]})]},a.id))]})}function Br({kind:e,title:t,description:n,action:r,onAction:i}){return(0,H.jsxs)(`div`,{className:`task-message task-message-${e}`,role:e===`error`?`alert`:`status`,children:[(0,H.jsx)(`h3`,{children:t}),(0,H.jsx)(`p`,{children:n}),r&&(0,H.jsx)(U,{variant:`outline`,size:`sm`,onClick:i,children:r})]})}function Vr({jobs:e}){let t=Zn(e);return(0,H.jsx)(`div`,{className:`kanban-scroll`,role:`region`,"aria-label":`Issue board — scroll horizontally`,tabIndex:0,children:(0,H.jsx)(`div`,{className:`kanban-board`,children:Un.filter(e=>(e.id!==`other`||t.other.length>0)&&(e.id!==`not_started`||t.not_started.length>0)).map(e=>(0,H.jsxs)(`section`,{className:`run-column tone-${e.tone}`,"aria-labelledby":`board-${e.id}`,children:[(0,H.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-border px-3 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h2`,{id:`board-${e.id}`,className:`text-sm font-semibold`,children:e.title}),(0,H.jsx)(`p`,{className:`break-words text-xs text-muted-foreground`,children:e.description})]}),(0,H.jsx)(Ar,{className:`shrink-0 border-border bg-surface text-muted-foreground`,"aria-label":`${t[e.id].length} visible ${e.title.toLowerCase()} work records`,children:t[e.id].length})]}),(0,H.jsx)(`div`,{className:`grid min-w-0 gap-2 p-2`,children:t[e.id].length?t[e.id].map(e=>(0,H.jsx)(Hr,{job:e},e.id)):(0,H.jsx)(`p`,{className:`px-2 py-8 text-center text-xs text-muted-foreground`,children:`No work`})})]},e.id))})})}function Hr({job:e}){let t=rr(e);return(0,H.jsx)(Rn,{className:`overflow-hidden`,children:(0,H.jsxs)(`a`,{href:e.href||`#/runs/${encodeURIComponent(e.id)}`,className:`run-card-link`,"aria-label":`Open work ${t}`,children:[(0,H.jsx)(`p`,{className:`run-card-title`,children:t}),(0,H.jsx)(Gr,{job:e}),(0,H.jsxs)(`div`,{className:`run-card-status`,children:[(0,H.jsx)(Dn,{value:e.state}),(0,H.jsx)(`span`,{children:tr(e)})]})]})})}function Ur({job:e,setFilter:t}){let n=rr(e);return(0,H.jsxs)(`article`,{className:`task-row`,role:`listitem`,children:[(0,H.jsx)(En,{value:e.state}),(0,H.jsxs)(`a`,{href:e.href||`#/runs/${encodeURIComponent(e.id)}`,className:`task-row-link`,"aria-label":`Open work ${n}, ${jn(e.state)}, ${tr(e)}`,children:[(0,H.jsx)(`p`,{className:`task-row-title`,children:n}),(0,H.jsx)(Gr,{job:e})]}),(0,H.jsx)(`button`,{className:`row-badge-filter`,"aria-label":`Filter by ${jn(e.state)} badge`,onClick:()=>t(e.state===`timed_out`?`failed`:Ir.some(t=>t.id===e.state)?e.state:`other`),children:(0,H.jsx)(Dn,{value:e.state})})]})}function Wr({filtered:e,clearFilters:t,openComposer:n}){return(0,H.jsxs)(`div`,{className:`empty-tasks`,role:`status`,children:[(0,H.jsx)(`h3`,{children:e?`No matching work`:`No loaded work yet`}),(0,H.jsx)(`p`,{children:e?`Try another state or search term.`:`Start work explicitly from a repository issue or a local execution request.`}),e?(0,H.jsx)(U,{variant:`outline`,size:`sm`,onClick:t,children:`Clear filters`}):(0,H.jsxs)(U,{variant:`outline`,size:`sm`,onClick:n,children:[(0,H.jsx)(me,{className:`size-3.5`}),`New issue`]})]})}function Gr({job:e}){let t=e.work,n=e.workflow?.name||e.command,r=er(e),i=[t?.identity?`#${t.identity.number}${t.issue?.author?` by ${t.issue.author}`:``}`:t?`Local request`:null,e.updated_at?(0,H.jsx)(`time`,{dateTime:e.updated_at,title:`Last activity ${e.updated_at}`,children:kn(e.updated_at)}):null,[n,r].filter(Boolean).map(On).join(` · `),t?.identity&&(t.issue?t.issue.state:`Source not loaded`),t?.issue?.readiness&&(0,H.jsx)(`span`,{title:`Issue readiness`,children:t.issue.readiness.label}),t?.executions.length>1?`${t.executions.length} attempts`:null].filter(Boolean);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`task-row-meta`,children:i.map((e,t)=>(0,H.jsx)(`span`,{className:`work-meta-part`,children:e},t))}),(0,H.jsx)(Cn,{labels:t?.issue?.labels})]})}var Kr=e=>`#/issues/${encodeURIComponent(e)}`;function qr({token:e,provider:t,jobs:n=[],loaded:r,refreshKey:i,onStarted:a,onLocalRequest:o,onNewIssue:s,statusError:c,refreshStatus:l,synthetic:u,issueKey:d,active:f=!0,identity:p,links:m,onNavigation:h,detailProps:g={}}){let[v,y]=(0,_.useState)(`open`),[b,x]=(0,_.useState)(null),[S,ee]=(0,_.useState)(!1),[C,w]=(0,_.useState)(``),[T,te]=(0,_.useState)({}),[E,ne]=(0,_.useState)(!1),[D,re]=(0,_.useState)(``),[O,k]=(0,_.useState)(!1),[A,j]=(0,_.useState)([]),[M,ie]=(0,_.useState)(``),[ae,oe]=(0,_.useState)([]),[N,P]=(0,_.useState)([]),[F,se]=(0,_.useState)([]),[ce,I]=(0,_.useState)(()=>window.localStorage.getItem(`factory-runs-view`)===`board`?`board`:`list`),le=(0,_.useRef)(null),ue=(0,_.useRef)(null),de=(0,_.useRef)(!0),fe=(0,_.useRef)(T);fe.current=T;let pe=(0,_.useMemo)(()=>In(n,b?.issues||[]),[n,b]),me=(0,_.useMemo)(()=>pe.map(e=>{let t=n.find(t=>t.id===e.execution_id);return{...t,id:e.key,work:e,state:e.state,task:{...t?.task,title:e.title,source_url:e.url},updated_at:t?.updated_at||e.issue?.updated_at,runs:t?.runs||[],href:e.identity?Kr(e.key):`#/runs/${e.execution_id}`}}),[pe,n]),he=(0,_.useMemo)(()=>Nr(Xn(me,M),ae,N).filter(e=>!F.length||e.work.issue?.labels.some(e=>F.includes(e.name))),[me,M,ae,N,F]),ge=(0,_.useMemo)(()=>nr(Yn(he,A)),[he,A]),_e=(0,_.useMemo)(()=>ge.map(e=>({id:e.id,executionID:e.work.execution_id,title:e.task.title,href:e.href})),[ge]);(0,_.useEffect)(()=>{h?.(_e)},[_e,h]);let ve=()=>{j([]),ie(``),oe([]),P([]),se([])},ye=d&&Mn(d.replace(/^github:/,``).replace(/:(\d+)$/,`/issues/$1`)),L=pe.find(e=>e.key===d)||(ye?{key:d,identity:ye,title:`Issue #${ye.number}`,url:ye.url,executions:[],source_status:`not_loaded`}:null),be=e=>te(t=>({...t,[d]:{...t[d],...e}}));async function xe(t,n,r){let i=await fetch(t,{method:n===void 0?`GET`:`POST`,headers:{"Content-Type":`application/json`,"X-Factory-Session":e},...n===void 0?{}:{body:JSON.stringify(n)},signal:r}),a=await i.json();if(!i.ok)throw Error(a.error||`Repository request failed.`);return a}async function Se(e=1){le.current?.abort();let t=new AbortController;le.current=t,ee(!0),w(``);try{let n=await xe(`/api/v1/issues?page=${e}&state=${v}`,void 0,t.signal);!t.signal.aborted&&de.current&&x({...n,fetched_at:new Date().toLocaleTimeString()})}catch(e){!t.signal.aborted&&de.current&&w(e.message)}finally{!t.signal.aborted&&de.current&&ee(!1)}}(0,_.useEffect)(()=>(de.current=!0,()=>{de.current=!1,le.current?.abort(),ue.current?.abort()}),[]),(0,_.useEffect)(()=>{e&&Se()},[e,v,i]);async function Ce(e,t=!1){if(ue.current?.abort(),re(``),!t&&fe.current[e.key]?.context){ne(!1);return}let n=new AbortController;ue.current=n,ne(!0);try{let t=await xe(`/api/v1/issues/preview`,{url:e.url},n.signal);!n.signal.aborted&&de.current&&te(n=>({...n,[e.key]:{brief:``,workflow:t.recommendation.workflow,sourceRef:``,model:``,...n[e.key],context:t}}))}catch(e){!n.signal.aborted&&de.current&&re(e.message)}finally{!n.signal.aborted&&de.current&&ne(!1)}}(0,_.useEffect)(()=>(f&&L&&e&&Ce(L),()=>{ue.current?.abort()}),[d,f,e]);let R=L&&T[d],we=R?.context,Te=L?.active_execution?`An execution is active or unresolved. Open its history to continue or cancel it.`:we?.start_block_reason;async function Ee(e){if(e.preventDefault(),!(O||!we||Te||D||c)){k(!0),re(``);try{let e=await xe(`/api/v1/issues/start`,{url:we.url,expected_spec:we.spec,brief:R.brief,workflow:R.workflow,...R.sourceRef.trim()?{source_ref:R.sourceRef.trim()}:{},model:R.model.trim()});de.current&&(await a(e),Se(b?.page||1))}catch(e){de.current&&re(e.message)}finally{de.current&&k(!1)}}}let De=(0,H.jsx)(Jr,{snapshot:b,state:v,setState:y,loading:S,token:e,load:Se,onLocalRequest:o,records:pe}),Oe=(0,H.jsxs)(H.Fragment,{children:[!t?.supported&&t&&(0,H.jsx)(`p`,{className:`source-boundary`,children:`Remote issues unsupported on this host. Local execution requests remain available.`}),C&&(0,H.jsxs)(`p`,{role:`alert`,className:`form-error`,children:[b?`Repository data stale. `:`Repository issues unavailable. `,C]}),S&&(0,H.jsx)(`p`,{role:`status`,className:`source-boundary`,children:`Loading repository issues…`}),b&&!b.issues?.length&&!C&&!S&&(0,H.jsx)(`p`,{className:`source-boundary`,children:`No issues on this page. Other pages or states may contain issues.`})]}),ke=L&&(0,H.jsxs)(`section`,{className:`issue-context`,"aria-label":`Repository issue context`,children:[(0,H.jsx)(U,{variant:`outline`,size:`sm`,disabled:O||E,onClick:()=>Ce(L,!0),children:`Refresh issue context`}),E&&(0,H.jsx)(`p`,{role:`status`,children:`Loading issue context…`}),D&&(0,H.jsxs)(`p`,{role:`alert`,className:`form-error`,children:[we?`Context may be stale. `:``,D]}),c&&(0,H.jsxs)(`p`,{role:`alert`,className:`form-error`,children:[`Execution history stale: `,c]}),we&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`details`,{open:!L.execution_id,children:[(0,H.jsx)(`summary`,{children:`Issue context`}),(0,H.jsx)(`pre`,{className:`inbox-body`,children:we.body})]}),(0,H.jsxs)(`details`,{open:!L.execution_id,children:[(0,H.jsx)(`summary`,{children:`Start work · explicit scope and options`}),(0,H.jsxs)(`form`,{onSubmit:Ee,className:`inbox-start`,children:[(0,H.jsxs)(`p`,{className:`work-help`,children:[`Suggested: `,On(we.recommendation.workflow),`. `,we.recommendation.reason]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`field-label`,children:`Work type`}),(0,H.jsxs)(`select`,{className:`field-control`,value:R.workflow,onChange:e=>be({workflow:e.target.value}),children:[(0,H.jsx)(`option`,{value:`software`,children:`Software`}),(0,H.jsx)(`option`,{value:`defence`,children:`Defence`})]})]}),(0,H.jsx)(`p`,{className:`work-help`,children:R.workflow===`defence`?`Investigates supplied, non-sensitive evidence and produces a private draft. Private security reports use incident --file, never public issues.`:`Implements scoped changes, runs checks and requests independent review. Security remediation can be Software work.`}),(0,H.jsxs)(`details`,{children:[(0,H.jsx)(`summary`,{children:`Operator brief and additional options`}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`field-label`,children:`Operator brief · optional`}),(0,H.jsx)(`textarea`,{className:`field-control`,maxLength:16e3,value:R.brief,onChange:e=>be({brief:e.target.value})})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`field-label`,children:`Source ref · optional`}),(0,H.jsx)(`input`,{className:`field-control`,maxLength:256,value:R.sourceRef,onChange:e=>be({sourceRef:e.target.value})})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`field-label`,children:`Model override · optional`}),(0,H.jsx)(`input`,{className:`field-control`,maxLength:128,value:R.model,onChange:e=>be({model:e.target.value})})]})]}),Te&&(0,H.jsx)(`p`,{className:`work-help`,children:Te}),(0,H.jsx)(U,{disabled:O||E||!r||!!D||!!c||!!Te,children:O?`Starting…`:`Start work`})]})]})]}),(0,H.jsxs)(`details`,{open:!L.execution_id,children:[(0,H.jsxs)(`summary`,{children:[`Linked execution attempts (`,L.executions.length,`)`]}),(0,H.jsx)(`div`,{className:`inbox-attempts`,children:L.executions.length?L.executions.map(e=>(0,H.jsxs)(`a`,{href:`#/runs/${e.id}`,children:[On(e.workflow)||`Workflow unknown`,` · `,jn(e.state),` · `,On(e.phase),` `,(0,H.jsx)(`small`,{children:e.id})]},e.id)):(0,H.jsx)(`p`,{className:`work-help`,children:`No executions. Browsing does not start work.`})})]})]}),Ae=L&&(0,H.jsxs)(`dl`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Repository issue`}),(0,H.jsx)(`dd`,{children:(0,H.jsxs)(`a`,{href:L.url,target:`_blank`,rel:`noreferrer`,children:[`#`,L.identity.number,` · View original issue ↗`]})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Source state`}),(0,H.jsxs)(`dd`,{children:[we?.state||L.issue?.state||`Not loaded`,D?` · unavailable / stale`:``]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Readiness`}),(0,H.jsx)(`dd`,{children:we?.readiness.label||L.issue?.readiness.label||`Unknown`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Labels`}),(0,H.jsx)(`dd`,{children:(0,H.jsx)(Cn,{labels:we?.labels||L.issue?.labels})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Created`}),(0,H.jsx)(`dd`,{children:An(we?.created_at||L.issue?.created_at)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Author`}),(0,H.jsx)(`dd`,{children:we?.author||L.issue?.author||`Unknown`})]}),!L.execution_id&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Execution`}),(0,H.jsx)(`dd`,{children:`Not started`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Workflow / model`}),(0,H.jsx)(`dd`,{children:`Unassigned / unknown`})]})]})]});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`section`,{className:`inbox-page`,"aria-label":`Project Inbox`,hidden:!!d,children:(0,H.jsx)(Rr,{visibleJobs:ge,jobs:me,counts:Qn(he),loaded:r,statusError:c,synthetic:u,filter:A,setFilter:j,search:M,setSearch:ie,workflowFilter:ae,setWorkflowFilter:oe,modelFilter:N,setModelFilter:P,labelFilter:F,setLabelFilter:se,clearFilters:ve,runsView:ce,setRunsView:e=>{I(e),window.localStorage.setItem(`factory-runs-view`,e)},refresh:l,openComposer:s,sourceControls:De,sourceNotice:Oe,sourceLoading:S&&!b,sourceUnavailable:!!C&&!b})}),f&&d&&(0,H.jsx)(Sr,{...g,identity:p,links:m,csrfToken:e,job:n.find(e=>e.id===L?.execution_id),loaded:r,error:c,navigation:_e,source:L&&{id:L.key,href:Kr(L.key),title:we?.title||L.title,panel:ke,metadata:Ae}})]})}function Jr({snapshot:e,state:t,setState:n,loading:r,token:i,load:a,onLocalRequest:o,records:s}){let[c,l]=(0,_.useState)(!1),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useId)();(0,_.useEffect)(()=>{if(!c)return;let e=e=>{u.current?.contains(e.target)||l(!1)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),l(!1),d.current?.focus())};return document.addEventListener(`pointerdown`,e),document.addEventListener(`focusin`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`focusin`,e),document.removeEventListener(`keydown`,t)}},[c]);let p=s.filter(e=>e.identity).length,m=s.reduce((e,t)=>e+t.executions.length,0);return(0,H.jsxs)(`div`,{className:`repository-control`,ref:u,children:[(0,H.jsxs)(`button`,{type:`button`,className:`repository-trigger`,ref:d,"aria-label":`Repository`,"aria-describedby":`${f}-scope`,"aria-expanded":c,"aria-controls":f,onClick:()=>l(e=>!e),children:[(0,H.jsxs)(`span`,{children:[`Repository `,(0,H.jsx)(ne,{size:12,"aria-hidden":`true`})]}),(0,H.jsx)(`span`,{className:`repository-scope`,id:`${f}-scope`,children:e?`${e.loaded_count} loaded · Page ${e.page}`:`Page not loaded`})]}),c&&(0,H.jsxs)(`div`,{id:f,className:`repository-popover`,role:`group`,"aria-label":`Repository tools`,children:[(0,H.jsxs)(`div`,{className:`source-controls`,children:[(0,H.jsxs)(`label`,{children:[`Issue state `,(0,H.jsxs)(`select`,{"aria-label":`Repository issue state`,value:t,onChange:e=>n(e.target.value),children:[(0,H.jsx)(`option`,{value:`open`,children:`Open`}),(0,H.jsx)(`option`,{value:`closed`,children:`Closed`}),(0,H.jsx)(`option`,{value:`all`,children:`All states`})]})]}),(0,H.jsx)(U,{variant:`ghost`,size:`sm`,disabled:r||!i,onClick:()=>a(e?.state===t?e.page:1),children:`Refresh issues`}),e?.page>1&&(0,H.jsx)(U,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>a(e.page-1),children:`Previous page`}),e?.next_page&&(0,H.jsx)(U,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>a(e.next_page),children:`Next page`})]}),(0,H.jsxs)(`p`,{className:`source-boundary`,children:[e?`${e.loaded_count} issues loaded on page ${e.page} (${e.state}); ${e.total==null?`total unknown`:`${e.total} total`}. Read at ${e.fetched_at}.`:`Repository page not loaded.`,` Search covers loaded issues and retained execution history only.`,e&&e.state!==t?` Showing the previous issue-state filter until refresh succeeds.`:``]}),(0,H.jsxs)(`p`,{className:`source-boundary`,children:[s.length,` items: `,p,` repository issues and `,s.length-p,` local requests, with `,m,` execution attempts. Includes retained history outside the loaded page.`]}),o&&(0,H.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>{l(!1),o()},children:`Local execution request`})]})]})}async function Yr(e,t,n,r){let i=JSON.stringify({provider:e.id,repository:e.repository,actor:e.actor_id??e.actor,title:t.trim(),spec:n.trim(),labels:[...new Set(r)].sort()}),a=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(i));return`browser_${Array.from(new Uint8Array(a),e=>e.toString(16).padStart(2,`0`)).join(``)}`}function Xr({title:e,spec:t,labels:n,csrfToken:r,onCreated:i,onBusy:a}){let o=(0,_.useRef)(null),s=(0,_.useRef)(!0),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)([]),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(``),[g,v]=(0,_.useState)(null);async function y(e,t,n){let i=await fetch(e,{method:t===void 0?`GET`:`POST`,headers:{"Content-Type":`application/json`,"X-Factory-Session":r},...t===void 0?{}:{body:JSON.stringify(t)},signal:n}),a=await i.json();if(!i.ok)throw Error(a.error||`Repository request failed.`);return a}async function b(e){h(``);try{let[t,n]=await Promise.all([y(`/api/v1/issue-connection`,void 0,e),y(`/api/v1/issue-submissions`,void 0,e)]);s.current&&!e?.aborted&&(l(t),d(n.filter(e=>[`pending`,`uncertain`].includes(e.state))))}catch(t){s.current&&!e?.aborted&&h(t.message)}}(0,_.useEffect)(()=>{s.current=!0;let e=new AbortController;return b(e.signal),()=>{s.current=!1,e.abort()}},[]);async function x(e){p(!0),a(!0),h(``);try{await e()}catch(e){if(s.current){h(e.message);try{let e=await y(`/api/v1/issue-submissions`);if(s.current){let t=e.find(e=>e.request_id===o.current&&e.state===`created`);if(t){i(t);return}d(e.filter(e=>[`pending`,`uncertain`].includes(e.state)))}}catch{}}}finally{a(!1),s.current&&p(!1)}}return(0,H.jsxs)(`section`,{className:`issue-publish`,"aria-label":`Repository issue creation`,children:[c?(0,H.jsxs)(`p`,{className:`work-help`,children:[`Create in `,(0,H.jsx)(`strong`,{children:c.repository}),` as `,(0,H.jsx)(`strong`,{children:c.actor}),`. No execution starts.`]}):(0,H.jsx)(`p`,{className:`work-help`,children:m?`Repository connection unavailable.`:`Checking repository identity…`}),n.length>0&&(0,H.jsxs)(`p`,{className:`work-help`,children:[`Labels: `,n.join(`, `)]}),m&&(0,H.jsx)(`p`,{role:`alert`,className:`form-error`,children:m}),u.map(e=>(0,H.jsxs)(`div`,{className:`issue-receipt`,children:[(0,H.jsxs)(`strong`,{children:[`Unconfirmed: `,e.title]}),(0,H.jsx)(`p`,{className:`work-help`,children:`Check this earlier submission before creating another copy.`}),(0,H.jsx)(U,{type:`button`,variant:`outline`,disabled:f,onClick:()=>x(async()=>{let t=await y(`/api/v1/issue-submissions/${e.request_id}/recover`,{});s.current&&(v(t),d(t=>t.filter(t=>t.request_id!==e.request_id)))}),children:`Check submission`})]},e.request_id)),g?.issue&&(0,H.jsxs)(`p`,{role:`status`,children:[(0,H.jsxs)(`a`,{href:g.issue.url,target:`_blank`,rel:`noreferrer`,children:[`Recovered #`,g.issue.number,`: `,g.title,` ↗`]}),`. Select it from repository issues to start work.`]}),(0,H.jsxs)(`div`,{className:`issue-publish-actions`,children:[(0,H.jsx)(U,{type:`button`,variant:`ghost`,disabled:f,onClick:()=>b(),children:`Refresh connection`}),(0,H.jsx)(U,{type:`button`,disabled:f||!c?.available||!e.trim()||!t.trim(),onClick:()=>x(async()=>{o.current=await Yr(c,e,t,n);let r=await y(`/api/v1/issues`,{title:e,spec:t,labels:n,request_id:o.current,repository:c.repository,actor:c.actor});s.current&&i(r)}),children:f?`Creating…`:`Create issue on ${c?.label||`repository`}`})]})]})}function Zr({template:e,answers:t,setAnswers:n}){let r=(e,t)=>n(n=>({...n,[e]:t}));return(0,H.jsx)(`div`,{className:`issue-form-fields`,children:e.fields.map(e=>{if(e.type===`markdown`)return(0,H.jsx)(`p`,{className:`template-note`,children:e.value},e.id);let n=t[e.id]??e.value,i=(0,H.jsxs)(H.Fragment,{children:[e.label,e.required&&(0,H.jsx)(`span`,{"aria-label":`required`,children:` *`})]});return e.multiple?(0,H.jsx)(Qr,{field:e,value:n,onChange:t=>r(e.id,t)},e.id):(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`field-label`,children:i}),e.description&&(0,H.jsx)(`span`,{className:`work-help field-description`,children:e.description}),e.type===`dropdown`?(0,H.jsxs)(`select`,{className:`field-control`,value:n,required:e.required,onChange:t=>r(e.id,t.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`Choose an option`}),e.options.map(e=>(0,H.jsx)(`option`,{value:e.label,children:e.label},e.label))]}):e.type===`textarea`?(0,H.jsx)(`textarea`,{className:`field-control issue-form-textarea`,required:e.required,value:n,placeholder:e.placeholder,onChange:t=>r(e.id,t.target.value)}):(0,H.jsx)(`input`,{className:`field-control`,required:e.required,value:n,placeholder:e.placeholder,onChange:t=>r(e.id,t.target.value)})]},e.id)})})}function Qr({field:e,value:t,onChange:n}){let r=(0,_.useRef)(null),[i,a]=(0,_.useState)(!1),o=e.required&&!t.length,s=`Select at least one option for ${e.label}.`;(0,_.useEffect)(()=>{r.current?.setCustomValidity(o?s:``),o||a(!1)},[o,s]);let c=`choice-${e.id}-hint`;return(0,H.jsxs)(`fieldset`,{className:`issue-form-options`,"aria-describedby":e.required?c:void 0,children:[(0,H.jsxs)(`legend`,{className:`field-label`,children:[e.label,e.required?` *`:``]}),e.description&&(0,H.jsx)(`p`,{className:`work-help`,children:e.description}),e.required&&(0,H.jsx)(`p`,{id:c,className:i?`form-error`:`work-help`,role:i?`alert`:void 0,children:i?s:`Choose at least one option.`}),e.options.map((e,i)=>(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{ref:i===0?r:void 0,type:`checkbox`,checked:t.includes(e.label),required:e.required,onInvalid:()=>{o&&a(!0)},onChange:r=>n(r.target.checked?[...t,e.label]:t.filter(t=>t!==e.label))}),(0,H.jsxs)(`span`,{children:[e.label,e.required?` *`:``]})]},e.label))]})}function $r(e){if(typeof e!=`string`)return;let t=e.trim();if(!t)return;let n=t.split(/[\\/]+/).filter(Boolean).at(-1);if(!(!n||n===`.`||n===`..`||/^[a-z]:$/i.test(n)))return{name:n,path:t}}function ei(e,t){return e===`app`?t?.name||`Project identity unavailable`:e}function ti({localOnly:e=!1,onCreated:t,issueProvider:n,title:r,setTitle:i,sourceRef:a,setSourceRef:o,sourceRefDefault:s,choices:c,identity:l,selection:u,setSelection:d,repository:f,prompt:p,setPrompt:m,model:h,setModel:g,submitting:v,submit:y,close:b,csrfToken:x,projectLinks:S,error:w}){let T=(0,_.useRef)(null),te=(0,_.useRef)(!0),E=(0,_.useRef)(null),ne=(0,_.useRef)(!1),[D,re]=(0,_.useState)(`source`),[O,k]=(0,_.useState)(!1),[A,j]=(0,_.useState)(``),[M,ie]=(0,_.useState)([]),[ae,oe]=(0,_.useState)(null),[N,P]=(0,_.useState)(!1),[F,se]=(0,_.useState)(null),[ce,I]=(0,_.useState)(null),[le,ue]=(0,_.useState)({}),de=!e&&(n?.capabilities?.create??!!S?.repository),fe=n?.capabilities?.templates??!!S?.repository,me=n?.label||`GitHub`,he=de?`remote`:`local`,[ge,_e]=(0,_.useState)(!1),[ve,ye]=(0,_.useState)(null),L=u===`workflow:defence`;(0,_.useEffect)(()=>{let e=document.activeElement;return te.current=!0,T.current.showModal(),fe&&Ce(),T.current.querySelector(`[data-blank-issue]`)?.focus(),()=>{te.current=!1,E.current?.abort(),e?.focus?.()}},[]),(0,_.useEffect)(()=>{D===`review`?T.current.querySelector(`[data-review-heading]`)?.focus():T.current.querySelector(D===`fields`?`input[name="issue-title"]`:`[data-blank-issue]`)?.focus()},[D]);async function be(e,t,n){E.current?.abort();let r=new AbortController;E.current=r,k(!0),j(``);try{let i=await fetch(e,{method:t===void 0?`GET`:`POST`,headers:{"Content-Type":`application/json`,"X-Factory-Session":x},...t===void 0?{}:{body:JSON.stringify(t)},signal:r.signal}),a=await i.json();if(!i.ok)throw Error(a.error||`Could not load this issue. Try again.`);te.current&&!r.signal.aborted&&n(a)}catch(e){te.current&&!r.signal.aborted&&j(e.message)}finally{te.current&&!r.signal.aborted&&k(!1)}}function Se(e){oe(e),P(!1),ne.current||d(`workflow:${e.workflow}`),re(`review`)}function Ce(){return be(`/api/v1/issue-templates`,void 0,se)}function R(e){E.current?.abort(),k(!1),j(``),I(e),ue({}),ne.current=!1,i(e?.title||``),m(``),ie(e?.labels||[]),oe(null),re(`fields`)}function we(e){e.preventDefault(),!(D!==`fields`||O||v)&&(ce?be(`/api/v1/issue-templates/draft`,{template:ce.id,sha:ce.sha,title:r,answers:le},e=>{i(e.title),m(e.spec),ie(e.labels),Se(e.recommendation)}):p.trim()&&be(`/api/v1/intake/recommend`,{spec:[r,p].join(`
4
4
  `),labels:M},Se))}return(0,H.jsxs)(`dialog`,{ref:T,className:`work-dialog`,"aria-labelledby":`start-work-title`,"aria-describedby":`start-work-description`,onCancel:e=>{e.preventDefault(),!v&&!ge&&b()},children:[(0,H.jsxs)(`header`,{className:`work-dialog-header`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{id:`start-work-title`,children:D===`review`?`Review issue`:de?`New issue`:`Local execution request`}),(0,H.jsx)(`p`,{id:`start-work-description`,children:ei(f,l)})]}),(0,H.jsx)(U,{variant:`ghost`,size:`icon`,onClick:b,disabled:v||ge,"aria-label":`Close start work form`,children:(0,H.jsx)(xe,{size:18})})]}),(0,H.jsxs)(`form`,{onSubmit:D===`review`?e=>{if(!p.trim()||v||O){e.preventDefault();return}if(he===`remote`){e.preventDefault();return}y(e)}:we,children:[(0,H.jsxs)(`fieldset`,{disabled:v||ge||!!ve,className:`work-dialog-body`,children:[D===`source`&&(0,H.jsx)(H.Fragment,{children:(0,H.jsxs)(`section`,{className:`template-chooser`,"aria-label":`Issue templates`,children:[(0,H.jsx)(`p`,{className:`work-help`,children:`Choose a template for the issue.`}),O&&(0,H.jsx)(`p`,{role:`status`,className:`work-help`,children:`Loading repository templates…`}),F?.templates.map(e=>(0,H.jsx)(`div`,{className:`template-choice`,children:e.unavailable?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`strong`,{children:e.name}),(0,H.jsx)(`p`,{className:`work-help`,children:e.unavailable}),(0,H.jsx)(`a`,{href:e.form_url,target:`_blank`,rel:`noreferrer`,children:`Open on GitHub ↗`})]}):(0,H.jsxs)(`button`,{type:`button`,onClick:()=>R(e),children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:e.name}),(0,H.jsx)(`span`,{children:e.description})]}),(0,H.jsx)(C,{size:16})]})},e.id)),(0,H.jsx)(`div`,{className:`template-choice`,children:(0,H.jsxs)(`button`,{type:`button`,"data-blank-issue":!0,onClick:()=>R(null),children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{children:`Blank issue`}),(0,H.jsx)(`span`,{children:`Write your own title, instructions and acceptance criteria.`})]}),(0,H.jsx)(C,{size:16})]})}),F?.contacts.map(e=>(0,H.jsxs)(`a`,{className:`template-contact`,href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,H.jsxs)(`strong`,{children:[e.name,` ↗`]}),(0,H.jsx)(`span`,{children:e.description})]},e.url)),F?.warnings.map(e=>(0,H.jsx)(`p`,{className:`work-help`,children:e},e)),!O&&fe&&(0,H.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:Ce,children:A?`Retry templates`:`Refresh templates`})]})}),(D===`fields`||D===`review`)&&(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`field-label`,children:`Title *`}),(0,H.jsx)(`input`,{name:`issue-title`,readOnly:D===`review`,className:`field-control`,value:r,onChange:e=>i(e.target.value),required:!0,maxLength:160,placeholder:`A short, clear title`})]}),D===`fields`&&ce&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h3`,{className:`template-form-name`,children:ce.name}),(0,H.jsx)(Zr,{template:ce,answers:le,setAnswers:ue})]}),(D===`fields`&&!ce||D===`review`)&&(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`field-label`,children:D===`review`?`Instructions and acceptance criteria`:`Description and acceptance criteria`}),(0,H.jsx)(`textarea`,{className:`field-control work-brief`,value:p,onChange:e=>{E.current?.abort(),k(!1),m(e.target.value),D===`review`&&P(!0)},placeholder:`Describe the work, its boundaries and how we will know it is done…`,required:!0})]}),D===`review`&&(0,H.jsxs)(H.Fragment,{children:[he===`local`&&(0,H.jsxs)(`section`,{className:`work-recommendation`,children:[(0,H.jsxs)(`h3`,{tabIndex:-1,"data-review-heading":!0,children:[`Suggested: `,ae.workflow===`defence`?`Defence`:`Software`]}),(0,H.jsx)(`p`,{className:`work-help`,children:N?`Instructions changed. Keep your chosen type or refresh the suggestion.`:ae.reason}),N&&(0,H.jsx)(U,{type:`button`,variant:`outline`,size:`sm`,disabled:O||!p.trim(),onClick:()=>be(`/api/v1/intake/recommend`,{spec:[r,p].join(`
5
5
  `),labels:M},Se),children:`Refresh suggestion`}),(0,H.jsx)(`div`,{className:`workflow-choices`,role:`group`,"aria-label":`Work type`,children:c.map(e=>(0,H.jsx)(`button`,{type:`button`,"aria-pressed":u===e.value,onClick:()=>{ne.current=!0,d(e.value)},children:e.label},e.value))}),(0,H.jsx)(`p`,{className:`work-help`,children:L?`Investigates supplied, non-sensitive evidence and produces a private draft. For validated incident intake, use incident --file in the CLI.`:`Implements the change, runs checks and requests an independent review.`})]}),he===`local`&&(0,H.jsxs)(`details`,{className:`work-options`,children:[(0,H.jsx)(`summary`,{children:`Additional options`}),(0,H.jsxs)(`div`,{className:`work-options-fields`,children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`field-label`,children:`Source ref · optional`}),(0,H.jsx)(`input`,{className:`field-control`,value:a,onChange:e=>o(e.target.value),maxLength:256,placeholder:`Configured ref: ${s}`}),(0,H.jsx)(`span`,{className:`work-help`,children:`Factory resolves this ref in the configured repository and retains that commit before admitting the job.`})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{className:`field-label`,children:`Model override · optional`}),(0,H.jsx)(`input`,{className:`field-control`,value:h,onChange:e=>g(e.target.value),maxLength:128,placeholder:`Use the configured model`})]})]})]})]})]}),D===`review`&&he===`remote`&&!ve&&(0,H.jsx)(Xr,{title:r,spec:p,labels:M,csrfToken:x,onBusy:_e,onCreated:e=>{ye(e),t?.(e)}},ce?.id||`blank`),ve&&(0,H.jsxs)(`section`,{className:`issue-created`,role:`status`,children:[(0,H.jsxs)(`strong`,{children:[`Issue #`,ve.issue.number,` created`]}),(0,H.jsxs)(`p`,{children:[(0,H.jsxs)(`a`,{href:ve.issue.url,target:`_blank`,rel:`noreferrer`,children:[`View on `,me,` ↗`]}),` · No execution has started.`]}),ve.issue.missing_labels?.length>0&&(0,H.jsxs)(`p`,{children:[`Labels not applied: `,ve.issue.missing_labels.join(`, `)]})]}),(A||w)&&(0,H.jsx)(`p`,{role:`alert`,className:`form-error`,children:A||w}),(0,H.jsx)(`footer`,{className:`work-dialog-footer`,children:D===`review`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(U,{type:`button`,variant:`ghost`,disabled:v||ge,onClick:()=>{if(ve){b();return}E.current?.abort(),k(!1),re(`fields`),j(``)},children:[(0,H.jsx)(ee,{size:14}),ve?`Done`:`Back`]}),he===`local`&&!ve&&(0,H.jsxs)(U,{disabled:v||ge||O||!p.trim()||!r.trim()||!u||!f,children:[v?`Starting…`:ve?`Start work`:`Start local execution`,(0,H.jsx)(pe,{size:14})]})]}):D===`fields`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(U,{type:`button`,variant:`ghost`,onClick:()=>{E.current?.abort(),k(!1),j(``),re(`source`)},children:[(0,H.jsx)(ee,{size:14}),`Templates`]}),(0,H.jsxs)(U,{disabled:O||!r.trim()||!ce&&!p.trim(),children:[O?`Preparing…`:`Continue`,(0,H.jsx)(C,{size:14})]})]}):(0,H.jsx)(`p`,{children:de?`Choose a repository template or blank issue. Nothing starts.`:e?`Local execution request: no repository issue will be published.`:`Local execution request: this host has no supported issue publisher.`})})]})]})}function ni({size:e=16}){return(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,fill:`currentColor`,"aria-hidden":`true`,viewBox:`0 0 16 16`,children:(0,H.jsx)(`path`,{d:`M6.766 11.328c-2.063-.25-3.516-1.734-3.516-3.656 0-.781.281-1.625.75-2.188-.203-.515-.172-1.609.063-2.062.625-.078 1.468.25 1.968.703.594-.187 1.219-.281 1.985-.281.765 0 1.39.094 1.953.265.484-.437 1.344-.765 1.969-.687.218.422.25 1.515.046 2.047.5.593.766 1.39.766 2.203 0 1.922-1.453 3.375-3.547 3.64.531.344.89 1.094.89 1.954v1.625c0 .468.391.734.86.547C13.781 14.359 16 11.53 16 8.03 16 3.61 12.406 0 7.984 0 3.563 0 0 3.61 0 8.031a7.88 7.88 0 0 0 5.172 7.422c.422.156.828-.125.828-.547v-1.25c-.219.094-.5.156-.75.156-1.031 0-1.64-.562-2.078-1.609-.172-.422-.36-.672-.719-.719-.187-.015-.25-.093-.25-.187 0-.188.313-.328.625-.328.453 0 .844.281 1.25.86.313.452.64.655 1.031.655s.641-.14 1-.5c.266-.265.47-.5.657-.656`})})}var ri=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,E());else{var t=n(l);t!==null&&re(x,t.startTime-e)}}}var S=!1,ee=-1,C=5,w=-1;function T(){return g?!0:!(e.unstable_now()-w<C)}function te(){if(g=!1,S){var t=e.unstable_now();w=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(ee),ee=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&T());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&re(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?E():S=!1}}}var E;if(typeof y==`function`)E=function(){y(te)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,D=ne.port2;ne.port1.onmessage=te,E=function(){D.postMessage(null)}}else E=function(){_(te,0)};function re(t,n){ee=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):C=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(ee),ee=-1):h=!0,re(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,E()))),r},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),ii=o(((e,t)=>{t.exports=ri()})),ai=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),oi=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ai()})),si=o((e=>{var t=ii(),n=u(),r=oi();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),ee=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),w=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),te=Symbol.for(`react.activity`),E=Symbol.for(`react.memo_cache_sentinel`),ne=Symbol.iterator;function D(e){return typeof e!=`object`||!e?null:(e=ne&&e[ne]||e[`@@iterator`],typeof e==`function`?e:null)}var re=Symbol.for(`react.client.reference`);function O(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===re?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case ee:return`Suspense`;case C:return`SuspenseList`;case te:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case w:return t=e.displayName||null,t===null?O(e.type)||`Memo`:t;case T:t=e._payload,e=e._init;try{return O(e(t))}catch{}}return null}var k=Array.isArray,A=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M={pending:!1,data:null,method:null,action:null},ie=[],ae=-1;function oe(e){return{current:e}}function N(e){0>ae||(e.current=ie[ae],ie[ae]=null,ae--)}function P(e,t){ae++,ie[ae]=e.current,e.current=t}var F=oe(null),se=oe(null),ce=oe(null),I=oe(null);function le(e,t){switch(P(ce,t),P(se,e),P(F,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}N(F),P(F,e)}function ue(){N(F),N(se),N(ce)}function de(e){e.memoizedState!==null&&P(I,e);var t=F.current,n=Hd(t,e.type);t!==n&&(P(se,e),P(F,n))}function fe(e){se.current===e&&(N(F),N(se)),I.current===e&&(N(I),Qf._currentValue=M)}var pe,me;function he(e){if(pe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);pe=t&&t[1]||``,me=-1<e.stack.indexOf(`
6
6
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <meta name="color-scheme" content="dark" />
7
7
  <title>Factory — Software &amp; Defence</title>
8
- <script type="module" crossorigin src="/assets/index-C4dC3_0i.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BeYYHh_8.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-CO7NjDS4.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "software-defence-factory",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "Factory: scoped software delivery and defence investigations with isolated jobs, evidence and review",
5
5
  "type": "module",
6
6
  "license": "MIT",