@popcorn245/cornfield-components 0.52.1 → 0.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/around-BcnegEdS.js +99 -0
  3. package/dist/chunks/connection-KDiWvV19.js +23 -0
  4. package/dist/chunks/{engine-BmXtSISH.js → engine-xmHJvQY9.js} +1188 -1186
  5. package/dist/chunks/{layers-Bj4Tluxe.js → layers-ho10a2y7.js} +48 -48
  6. package/dist/chunks/{map-BZRFOYkt.js → map-DbfPgQRe.js} +385 -385
  7. package/dist/chunks/node-panel-CC8UrSzJ.js +410 -0
  8. package/dist/chunks/panel-review-ih7RlfkH.js +884 -0
  9. package/dist/chunks/review-pieces-DtRxCDMr.js +2523 -0
  10. package/dist/chunks/{review-source-CK5tYIqk.js → review-source-CmbwaPCM.js} +1 -1
  11. package/dist/chunks/scope-2m2VmJXn.js +185 -0
  12. package/dist/chunks/scope-proposal-T06ndbin.js +116 -0
  13. package/dist/chunks/{sheets-D-sMZzSs.js → sheets-BWANwtZP.js} +7 -2
  14. package/dist/chunks/source-address-DXanAREm.js +57 -0
  15. package/dist/chunks/{status-DI5QLlAp.js → status-DM-iIEsg.js} +4 -3
  16. package/dist/corn-changes.js +43 -0
  17. package/dist/corn-decision.js +52 -0
  18. package/dist/corn-layers.js +275 -1
  19. package/dist/corn-map.js +125 -1
  20. package/dist/corn-node-panel.js +42 -1
  21. package/dist/corn-proposal.js +50 -0
  22. package/dist/corn-review.js +425 -1
  23. package/dist/corn-scope.js +33 -9
  24. package/dist/corn-search.js +484 -1
  25. package/dist/index.js +11 -8
  26. package/dist/manifest.json +95 -70
  27. package/dist/tokens.css +6 -0
  28. package/dist/types/components.d.ts +111 -5
  29. package/dist/types/corn-changes.d.ts +2 -0
  30. package/dist/types/corn-decision.d.ts +2 -0
  31. package/dist/types/corn-proposal.d.ts +2 -0
  32. package/dist/types/index.d.ts +3 -0
  33. package/dist/version.json +1 -1
  34. package/package.json +17 -5
  35. package/dist/chunks/around-BFqYTZ0K.js +0 -78
  36. package/dist/chunks/corn-layers-Cni5rISZ.js +0 -275
  37. package/dist/chunks/corn-map-B2-YxiEL.js +0 -125
  38. package/dist/chunks/corn-node-panel-BkvJThlp.js +0 -42
  39. package/dist/chunks/corn-review-5wf7AT4o.js +0 -2900
  40. package/dist/chunks/corn-search-CXs5d06S.js +0 -484
  41. package/dist/chunks/node-panel-BdvFvWCE.js +0 -1291
  42. package/dist/chunks/scope-CqPbHcKL.js +0 -137
  43. package/dist/chunks/source-address-C70zNPIj.js +0 -79
@@ -1,2900 +0,0 @@
1
- import { n as e, r as t, t as n } from "./runtime-DFu6W5g-.js";
2
- import { An as r, B as i, Dn as a, En as o, Ft as s, I as c, Kt as l, L as u, Mn as d, On as f, R as p, Rt as m, T as h, Tn as g, V as _, _t as v, bn as y, c as b, ct as x, dn as S, dt as C, fn as w, hn as T, j as E, jn as D, kn as O, kt as k, l as A, nn as j, ot as M, qt as N, rn as ee, st as P, t as F, vn as I, vt as L, z as R } from "./engine-BmXtSISH.js";
3
- import { i as z, n as B, r as V, t as H } from "./map-BZRFOYkt.js";
4
- import { A as U, C as W, D as G, E as K, O as q, S as te, T as J, _ as ne, a as re, b as ie, c as Y, d as ae, f as oe, g as se, h as ce, i as le, k as ue, l as X, m as Z, o as de, p as fe, r as pe, s as me, t as he, u as ge, v as _e, w as ve, x as ye, y as be } from "./node-panel-BdvFvWCE.js";
5
- import { c as xe, d as Se, i as Ce, l as we, n as Te, o as Ee, r as De, s as Oe, t as ke } from "./sheets-D-sMZzSs.js";
6
- import { c as Ae, d as je, f as Me, i as Ne, l as Pe, m as Fe, n as Ie, p as Le, r as Re, t as ze } from "./layers-Bj4Tluxe.js";
7
- import { a as Be, i as Ve, n as He, r as Ue } from "./source-address-C70zNPIj.js";
8
- // ../explorer/engine/proposal.js
9
- var Q = (e) => e.slot("proposal", () => ({
10
- pinnedSource: !1,
11
- listing: null,
12
- listingProblem: null,
13
- forgeProblem: null,
14
- listingAt: 0,
15
- watchers: /* @__PURE__ */ new Set(),
16
- openToken: 0,
17
- message: null
18
- })), We = (e) => e.proposal && typeof e.proposal.title == "string" && e.proposal.title || e.proposalSlug || "Proposal", Ge = (e) => e.ask("proposal:specs-list") === !1 ? null : {
19
- label: D(e, "openSpecsList"),
20
- way: "specs"
21
- };
22
- function Ke(e) {
23
- let t = Q(e);
24
- return {
25
- entries: t.listing,
26
- problem: t.listingProblem,
27
- forgeProblem: t.forgeProblem,
28
- at: t.listingAt
29
- };
30
- }
31
- async function qe(e) {
32
- let t = Q(e), n = Ve(e);
33
- try {
34
- let r;
35
- try {
36
- r = await n("/proposals", { cache: "no-store" });
37
- } catch {
38
- throw Error(e.offline() ? "You are offline." : "cornfield could not be reached. Check that it is still running.");
39
- }
40
- if (!r.ok) throw Error(`The server could not list them (error ${r.status}).`);
41
- let i;
42
- try {
43
- i = await r.json();
44
- } catch {
45
- throw Error("cornfield sent a list this page could not read.");
46
- }
47
- if (!Array.isArray(i)) throw Error("cornfield sent something that is not a list of proposals.");
48
- t.listing = i, t.listingProblem = null;
49
- let a = r.headers.get("X-Proposals-Forge-Error");
50
- t.forgeProblem = a ? decodeURIComponent(a) : null;
51
- } catch (e) {
52
- t.listing = null, t.forgeProblem = null, t.listingProblem = e.message || "cornfield did not answer.";
53
- }
54
- t.listingAt = Date.now(), e.emit("proposal:listing");
55
- for (let e of [...t.watchers]) e();
56
- return t.listing;
57
- }
58
- function Je(e, t, n = !1, r = []) {
59
- let i = Q(e);
60
- i.message = {
61
- text: t,
62
- isError: n,
63
- ways: r
64
- }, e.emit("proposal:message", i.message);
65
- }
66
- var Ye = (e) => Q(e).message;
67
- async function Xe(e, t, n = null) {
68
- let r = Q(e), i = ++r.openToken;
69
- if (!ne(t)) {
70
- let r = ie(t);
71
- return Je(e, r, !0, []), e.emit("proposal:failed", {
72
- slug: t,
73
- source: n,
74
- status: 0,
75
- notFound: !1,
76
- message: r
77
- }), !1;
78
- }
79
- Je(e, `Opening ${t} …`);
80
- try {
81
- let r;
82
- try {
83
- r = await Ve(e)(`/proposals/${encodeURIComponent(t)}.json${n ? `?source=${encodeURIComponent(n)}` : ""}`, { cache: "no-store" });
84
- } catch {
85
- throw Error(e.offline() ? `${t} could not be opened: you are offline.` : `${t} could not be opened: cornfield could not be reached.`);
86
- }
87
- if (!r.ok) {
88
- let i = "";
89
- try {
90
- i = (await r.json()).error || "";
91
- } catch {}
92
- let a = r.status === 401 || r.status === 403;
93
- a && e.emit("auth", {
94
- status: r.status,
95
- during: "proposal"
96
- });
97
- let o = a ? r.status === 403 ? "this is for the project's maintainers." : "you are not signed in." : `the server had a problem (error ${r.status}).`, s = Error(r.status === 404 ? ye(t, n) : `${t} could not be opened: ${typeof i == "string" && i ? i : o}`);
98
- throw s.notFound = r.status === 404, s.status = r.status, s;
99
- }
100
- let i = r.headers.get("X-Proposal-Source"), a;
101
- try {
102
- a = await r.json();
103
- } catch {
104
- throw Error(`${t} could not be opened: cornfield sent a file this page could not read.`);
105
- }
106
- let o = r.headers.get("X-Proposal-Sha256");
107
- return !e.ended && (Ze(e, a, {
108
- slug: t,
109
- source: n || (i ? decodeURIComponent(i) : null),
110
- pinSource: !!n,
111
- view: "diff",
112
- fit: !0,
113
- sha256: o
114
- }), N(e, [e.ask("changes:opened-line", We(e.state)), je(e)].filter(Boolean).join(" ")), !0);
115
- } catch (a) {
116
- if (e.ended) return !1;
117
- console.error("Opening the proposal failed", a);
118
- let o = a.message || `${t} could not be opened.`;
119
- if (Je(e, o, !0, a.notFound ? [Ge(e)].filter(Boolean) : [{
120
- label: "Retry",
121
- way: "retry",
122
- slug: t,
123
- source: n
124
- }, {
125
- label: "Close",
126
- way: "close"
127
- }]), a.notFound && i === r.openToken) {
128
- await qe(e);
129
- let a = new Set((Array.isArray(r.listing) ? r.listing : []).map((e) => e && e.source));
130
- i === r.openToken && (o = ye(t, n, a), Je(e, o, !0, [...te(r.listing, t, n).map((e) => ({
131
- label: e.label,
132
- way: "open",
133
- slug: e.slug,
134
- source: e.source
135
- })), Ge(e)].filter(Boolean)));
136
- }
137
- return i === r.openToken && e.emit("proposal:failed", {
138
- slug: t,
139
- source: n,
140
- status: a.status || 0,
141
- notFound: !!a.notFound,
142
- message: o
143
- }), !1;
144
- }
145
- }
146
- function Ze(e, t, { slug: n = null, source: r = null, pinSource: i = !1, view: a, fit: o = !0, sha256: s = null } = {}) {
147
- let { state: c } = e;
148
- c.proposal = t, Ie(e), c.proposalSlug = n, c.proposalSource = r, c.proposalSha256 = typeof s == "string" && /^[0-9a-f]{64}$/.test(s) ? s : null, Q(e).pinnedSource = i, a ? c.proposalView = a : Z.includes(c.proposalView) || (c.proposalView = "diff");
149
- let l = e.ask("proposal:effective", t);
150
- et(e, l === void 0 ? t : l, { fit: o }), Qe(e, "opened");
151
- }
152
- function Qe(e, t) {
153
- let { state: n } = e;
154
- e.emit("proposal", {
155
- change: t,
156
- slug: n.proposalSlug || null,
157
- source: n.proposalSource || null,
158
- pinSource: Q(e).pinnedSource,
159
- view: n.proposalView,
160
- proposal: n.proposal || null
161
- });
162
- }
163
- function $e(e) {
164
- let t = !!e.state.proposal;
165
- e.emit("proposal:draw", { open: t }), e.emit("proposal:bar", { open: t });
166
- }
167
- function et(e, t, { fit: n = !1 } = {}) {
168
- let { state: r } = e;
169
- if (t === void 0) {
170
- let n = e.ask("proposal:effective", r.proposal);
171
- t = n === void 0 ? r.proposal : n;
172
- }
173
- let i = {
174
- nodes: r.baseNodes,
175
- edges: r.baseEdges
176
- }, a;
177
- r.effectiveProposal = t;
178
- try {
179
- r.proposalErrors = ge(i, t).errors, a = Y(i, t), e.emit("proposal:mark", {
180
- applied: a,
181
- effective: t,
182
- proposal: r.proposal
183
- });
184
- } catch (e) {
185
- r.proposalErrors = [{
186
- path: "",
187
- message: `This proposal could not be read: ${e.message}`
188
- }], a = {
189
- nodes: r.baseNodes.map((e) => ({
190
- ...e,
191
- mark: "none"
192
- })),
193
- edges: r.baseEdges.map((e) => ({
194
- ...e,
195
- mark: "none"
196
- }))
197
- };
198
- }
199
- rt(e, a.nodes, a.edges), $e(e), Pe(e), n && it(e), e.map.render(), e.map.ensureFlowLoop();
200
- }
201
- function tt(e) {
202
- let { state: t } = e;
203
- return e.ask("proposal:before-close") !== !1 && (t.proposal = null, t.effectiveProposal = null, t.proposalSlug = null, t.proposalSource = null, t.proposalSha256 = null, t.proposalErrors = [], Ne(e), rt(e, t.baseNodes.map((e) => ({ ...e })), t.baseEdges), e.map.fitGraphToViewport(e.map.fitPadding()), e.map.render(), e.map.ensureFlowLoop(), $e(e), Qe(e, "closed"), !0);
204
- }
205
- function nt(e, t, { quiet: n = !1 } = {}) {
206
- let { state: r } = e;
207
- r.proposal && Z.includes(t) && r.proposalView !== t && (r.proposalView = t, e.touchScene(), r.selectedNode && !e.map.isNodeVisible(r.selectedNode) && j(e, { source: "api" }), t === "diff" && it(e), e.map.render(), $e(e), Qe(e, "view"), n || N(e, J(t)));
208
- }
209
- function rt(e, t, n) {
210
- let { state: r } = e, i = r.selectedNode ? r.selectedNode.id : null;
211
- if (e.ask("map:set", {
212
- nodes: t,
213
- edges: n
214
- }) || (r.mapNodes = t, r.mapEdges = n, r.nodes = t, r.edges = n), r.selectedEdge = null, i) {
215
- let t = r.nodes.find((e) => e.id === i);
216
- t ? r.selectedNode = t : j(e, { source: "api" });
217
- }
218
- e.touchScene();
219
- }
220
- function it(e) {
221
- let { state: t, map: n } = e, { touched: r } = s(t.nodes, e.viewEdges()), i = t.nodes.filter((e) => r.has(e.id) && n.isNodeVisible(e)), a = T(e), o = {
222
- padding: n.fitPadding(),
223
- maxZoom: 1,
224
- minZoom: n.getMinZoom()
225
- }, c = me(i, a, {
226
- ...o,
227
- minZoom: Math.max(o.minZoom, re)
228
- }), l = i.length ? y(c, a, o) : null;
229
- l ? (Object.assign(t.camera, l), n.render()) : n.fitGraphToViewport(n.fitPadding());
230
- }
231
- var at = (e, t) => (e.nodes.find((e) => e.id === t) || { label: t }).label, ot = (e) => e.kind || (e.dashed ? "usage" : "ownership");
232
- function st(e, t, n, { select: r = !0 } = {}) {
233
- let { state: i, map: a } = e, o = t === "edge" ? i.edges.find((e) => X(e) === n) : i.nodes.find((e) => e.id === n);
234
- if (!o) return;
235
- let s = (t === "edge" ? [i.nodes.find((e) => e.id === o.from), i.nodes.find((e) => e.id === o.to)] : [o]).filter(Boolean);
236
- if (!s.length) return;
237
- i.proposalView !== "diff" && s.some((e) => !a.isNodeVisible(e)) && nt(e, "diff", { quiet: !0 }), r && (t === "edge" ? lt(e, o) : ee(e, o));
238
- let c = y(s, T(e), {
239
- padding: a.fitPadding(),
240
- maxZoom: Math.max(1, i.camera.zoom),
241
- minZoom: a.getMinZoom()
242
- });
243
- c && Object.assign(i.camera, c), a.render(), N(e, _e(fe[o.mark] || o.mark, t === "edge" ? `${at(i, o.from)} to ${at(i, o.to)}` : o.label));
244
- }
245
- function ct(e, t, n, r) {
246
- let i = null, a = r;
247
- for (let r of e.map.getScene().edges) if (r.mark !== "none") for (let e = 0; e <= 1; e += 1 / 20) {
248
- let o = h(r, e), s = Math.hypot(o.x - t, o.y - n);
249
- s <= a && (i = r, a = s);
250
- }
251
- return i && e.viewEdges().find((e) => e.from === i.from && e.to === i.to && ot(e) === i.kind) || null;
252
- }
253
- function lt(e, t) {
254
- j(e, { source: "api" }), e.state.selectedEdge = t, e.emit("node:show-edge", { edge: t }), e.touchScene(), e.map.render();
255
- }
256
- function ut(e, t) {
257
- let n = e.state.canvas;
258
- if (!n) return () => {};
259
- let r = null, i = [t(n, "mousedown", (e) => {
260
- r = {
261
- x: e.clientX,
262
- y: e.clientY
263
- };
264
- }), t(n, "click", (t) => {
265
- let { state: i } = e;
266
- if (!i.proposal || i.proposalView === "before" || r && Math.hypot(t.clientX - r.x, t.clientY - r.y) > 5) return;
267
- let a = n.getBoundingClientRect(), o = e.map.screenToWorld(t.clientX - a.left, t.clientY - a.top), s = i.camera.zoom;
268
- if (i.nodes.some((t) => e.map.isNodeVisible(t) && Math.hypot(t.x - o.x, t.y - o.y) <= t.r + 6 / s)) return;
269
- let c = ct(e, o.x, o.y, 8 / s);
270
- c && lt(e, c);
271
- })];
272
- return () => i.forEach((e) => e());
273
- }
274
- var dt = (e) => Q(e).pinnedSource, ft = ({ edit: e = !0 } = {}) => ({
275
- bar: "<section id=\"proposal-bar\" class=\"hx-proposal-bar glass\" aria-label=\"Open proposal\" hidden data-corn=\"proposal-bar\"><p id=\"proposal-message\" class=\"hx-proposal-message\" data-corn=\"message\" role=\"status\" hidden></p><div id=\"proposal-ways\" class=\"hx-proposal-ways\" role=\"group\" aria-label=\"Ways on\" data-corn=\"proposal-ways\" hidden></div><div id=\"proposal-body\"><div class=\"hx-proposal-head\" data-corn=\"proposal-head\" role=\"group\" aria-label=\"Proposal actions\"><h2 id=\"proposal-title\" class=\"hx-proposal-name\" data-corn=\"proposal-title\"></h2><a id=\"proposal-source\" class=\"hx-proposal-source\" data-corn=\"proposal-source\" hidden></a><div class=\"hx-proposal-counts\"><div id=\"proposal-chip\" class=\"hx-proposal-chip\" data-corn=\"proposal-counts\"></div><p id=\"proposal-peek\" class=\"hx-proposal-peek\"></p><button type=\"button\" id=\"proposal-mode\" class=\"hx-proposal-mode\" data-corn=\"proposal-mode\" data-action=\"toggle-proposal-mode\" data-peek-ok aria-expanded=\"false\" aria-controls=\"proposal-seg\" title=\"Before, Diff or After\"></button></div><div id=\"proposal-seg\" class=\"hx-seg\" data-corn=\"compare\" role=\"group\" aria-label=\"Compare\"><button data-corn=\"compare-option\" type=\"button\" class=\"hx-seg-btn\" data-action=\"proposal-view\" data-view=\"before\" aria-pressed=\"false\" data-corn-string=\"before\">Before</button><button data-corn=\"compare-option\" type=\"button\" class=\"hx-seg-btn\" data-action=\"proposal-view\" data-view=\"diff\" aria-pressed=\"true\" data-corn-string=\"diff\">Diff</button><button data-corn=\"compare-option\" type=\"button\" class=\"hx-seg-btn\" data-action=\"proposal-view\" data-view=\"after\" aria-pressed=\"false\" data-corn-string=\"after\">After</button></div><div class=\"hx-proposal-tools\"><button data-corn=\"whole-map\" data-corn-kind=\"secondary\" type=\"button\" id=\"proposal-whole\" class=\"hx-btn\" data-action=\"proposal-whole\" aria-pressed=\"false\" aria-label=\"Show the whole map\" title=\"Show the whole map\" data-peek-ok data-corn-string=\"wholeMap\" data-corn-string-aria-label=\"showWholeMap\">Whole map</button>" + (e ? "<button data-corn-kind=\"secondary\" type=\"button\" id=\"proposal-myedits\" class=\"hx-btn\" aria-pressed=\"true\" data-peek-ok data-corn-string=\"myEdits\" hidden>My edits</button><button data-corn-kind=\"secondary\" type=\"button\" id=\"proposal-edit\" class=\"hx-btn\" aria-expanded=\"false\" aria-controls=\"whatif\" title=\"Try a change: add a node or an edge, reword a scenario\">Edit</button>" : "") + "</div><div class=\"hx-proposal-more\"><button type=\"button\" id=\"proposal-more\" class=\"hx-btn hx-btn--icon\" data-action=\"toggle-proposal-more\" aria-haspopup=\"menu\" aria-expanded=\"false\" aria-controls=\"proposal-more-menu\" aria-label=\"More\" data-corn-kind=\"icon\"><svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\"><circle cx=\"3\" cy=\"8\" r=\"1.5\"/><circle cx=\"8\" cy=\"8\" r=\"1.5\"/><circle cx=\"13\" cy=\"8\" r=\"1.5\"/></svg></button><div id=\"proposal-more-menu\" class=\"hx-proposal-more-menu glass\" data-corn=\"proposal-menu\" role=\"menu\" aria-label=\"More\" hidden><button type=\"button\" role=\"menuitem\" class=\"hx-btn hx-btn--quiet\" data-action=\"close-proposal\" title=\"Close the proposal and go back to the map\" data-corn-kind=\"quiet\" data-corn-string=\"closeProposal\">Close</button></div></div></div><details id=\"proposal-errors\" class=\"hx-proposal-errors\" data-corn=\"proposal-errors\" hidden><summary data-corn=\"summary\" id=\"proposal-errors-count\"></summary><ul id=\"proposal-errors-list\"></ul><p class=\"hx-faint\">The map shows what it can.</p></details></div></section>",
276
- menu: "<div id=\"proposal-wrap\"><button type=\"button\" id=\"proposal-btn\" class=\"hx-account-item\" data-action=\"toggle-proposals-menu\" aria-haspopup=\"true\" aria-expanded=\"false\" title=\"Open a proposal: what a change would add, change and remove\" data-corn=\"proposals-button\"><span data-corn-string=\"proposals\">Proposals</span><span class=\"hx-faint\" aria-hidden=\"true\">▾</span></button><div id=\"proposal-menu\" class=\"hx-menu hx-menu--proposals\" hidden data-corn=\"proposals-menu\"></div></div>"
277
- });
278
- function pt(e, t = 8) {
279
- let n = e.slice(0, t).map((e) => `<li>${e.path ? `<code class="hx-code">${l(e.path)}</code> ` : ""}${l(e.message)}</li>`);
280
- return e.length > t && n.push(`<li class="hx-faint">and ${e.length - t} more</li>`), n.join("");
281
- }
282
- var mt = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, ht = (e) => typeof e == "string" && /^https?:\/\//i.test(e) ? e : null;
283
- function gt(e) {
284
- return e.pull ? `Spec PR #${e.pull.number}${e.pull.draft ? " (draft)" : ""}${e.pull.author ? ` by ${e.pull.author}` : ""}` : e.source === "checkout" ? "In the checkout" : `In worktree ${e.source}`;
285
- }
286
- function _t(e, t) {
287
- let n = t && t.slug === e.slug && t.source === e.source, r = `<span class="hx-proposal-title">${l(e.title || e.slug)}</span>`, a = [`<span class="hx-proposal-where">${l(gt(e))}</span>`];
288
- if (e.spec && a.push(`<span>spec ${l(e.spec)}</span>`), e.error) return `<div class="hx-proposal-item is-broken" data-corn="row">${r}<span class="hx-proposal-sum hx-error-text">${l(e.error)}</span><span class="hx-proposal-meta">${a.join("")}</span></div>`;
289
- e.counts && a.push(`<span>${l(se(e.counts))}</span>`);
290
- let o = i(e.review, Date.now());
291
- return o && a.push(`<span class="hx-proposal-reviewed">${l(o)}</span>`), e.errors && a.push(`<span class="hx-warn">${l(mt(e.errors, "problem"))}</span>`), `<button type="button" class="hx-proposal-item${n ? " is-current" : ""}" data-action="open-proposal" data-slug="${l(e.slug)}" data-source="${l(e.source)}" data-corn="row">${r}${e.summary ? `<span class="hx-proposal-sum">${l(e.summary)}</span>` : ""}<span class="hx-proposal-meta">${a.join("")}</span></button>`;
292
- }
293
- function vt(e, t, n = {}) {
294
- let { state: r } = t, i = a(t), s = ft({ edit: n.edit !== !1 }), c = [...o(t, e, s.bar, n.slots, "bar"), ...o(t, e, s.menu, n.slots, "menu")], u = (e) => {
295
- for (let t of c) {
296
- if (t.id === e) return t;
297
- let n = t.querySelector(`[id="${e}"]`);
298
- if (n) return n;
299
- }
300
- return null;
301
- };
302
- i.keepParts(...c);
303
- let d = u("proposal-bar"), f = null, p = null, m = !1;
304
- function h({ text: e, isError: t, ways: n }) {
305
- d.hidden = !1, d.classList.toggle("is-error", t), u("proposal-body").hidden = !0;
306
- let r = u("proposal-message");
307
- r.hidden = !1, r.textContent = e;
308
- let i = u("proposal-ways");
309
- i.hidden = n.length === 0, i.innerHTML = n.map((e) => `<button type="button" class="hx-btn" data-action="proposal-way" data-way="${l(e.way)}"${e.slug ? ` data-slug="${l(e.slug)}"` : ""}${e.source ? ` data-source="${l(e.source)}"` : ""} data-peek-ok data-corn-kind="quiet">${l(e.label)}</button>`).join(""), g(i);
310
- }
311
- let _ = t.slot("proposal-pulls", () => /* @__PURE__ */ new Map()), v = null;
312
- function y() {
313
- let e = u("proposal-source"), n = r.proposal ? r.proposalSource : null;
314
- if (e.hidden = !n, !n) return;
315
- let i = W(n), a = i ? _.get(i) : null, o = Ke(t).entries, s = i && Array.isArray(o) ? o.find((e) => e.slug === r.proposalSlug && e.source === n) : null, c = ve(n, a && a.pull || s && s.pull || null, a ? a.checks : null);
316
- e.textContent = c.text, c.state ? e.dataset.cornState = c.state : delete e.dataset.cornState;
317
- let l = ht(c.href);
318
- l ? (e.setAttribute("href", l), e.setAttribute("target", "_blank"), e.setAttribute("rel", "noreferrer"), e.title = "Open this pull request") : (e.removeAttribute("href"), e.removeAttribute("target"), e.removeAttribute("rel"), e.title = c.label);
319
- let d = `${n}/${r.proposalSlug}`;
320
- i && v !== d && (v = d, x(i));
321
- }
322
- async function x(e) {
323
- try {
324
- let n = await Ve(t)(`/api/forge/pulls/${e}`), i = n.ok ? await n.json() : null;
325
- if (m) return;
326
- i && i.ok !== !1 && i.pull && _.set(e, {
327
- pull: i.pull,
328
- checks: Array.isArray(i.checks) ? i.checks : null
329
- }), i && i.pull && W(r.proposalSource) === e && t.emit("proposal:pull-head", i.pull.head && typeof i.pull.head.sha == "string" ? i.pull.head.sha : "");
330
- } catch {}
331
- !m && r.proposal && W(r.proposalSource) === e && y();
332
- }
333
- function S({ open: e = !!r.proposal } = {}) {
334
- if (d.hidden = !e, !e) {
335
- k(), M(!1), Te(t, "proposal");
336
- return;
337
- }
338
- d.classList.remove("is-error"), u("proposal-message").hidden = !0, u("proposal-body").hidden = !1;
339
- let n = r.proposal, i = u("proposal-title");
340
- i.textContent = n && typeof n.title == "string" && n.title || r.proposalSlug || "Proposal", y(), i.title = n && typeof n.summary == "string" && n.summary || "";
341
- let a = u("proposal-chip");
342
- a.innerHTML = ce(ae(n)).map((e) => {
343
- let t = e.mark ? `<span class="hx-mark-dot hx-mark-dot--${e.mark}" data-corn="mark-dot"${U(e.mark)} aria-hidden="true"></span>` : "";
344
- return !e.mark && /scenarios?$/.test(e.text) ? `<button type="button" class="hx-proposal-count" data-action="review-show-scenarios" data-corn-kind="quiet" title="Show the personas and their scenarios">${l(e.text)}</button>` : `<button type="button" class="hx-proposal-count" data-action="review-show-changes" data-corn-kind="quiet" title="Show the list of changes">${t}${l(e.text)}</button>`;
345
- }).join("<span class=\"hx-proposal-sep\" aria-hidden=\"true\"> · </span>");
346
- let o = K(r.whatIf && r.whatIf.edits, !!r.whatIfOff);
347
- o && a.insertAdjacentHTML("beforeend", `<span class="hx-proposal-sep" aria-hidden="true"> · </span><span class="hx-proposal-count hx-proposal-yours"><span class="hx-mark-dot hx-mark-dot--edit" data-corn="mark-dot" data-corn-state="edit" aria-hidden="true"></span>${l(o)}</span>`), g(a), u("proposal-mode").textContent = D(t, r.proposalView);
348
- for (let e of d.querySelectorAll("[data-action=\"proposal-view\"]")) {
349
- let t = e.dataset.view === r.proposalView;
350
- e.setAttribute("aria-pressed", String(t)), e.classList.toggle("is-on", t);
351
- }
352
- let s = u("proposal-whole"), c = !!(r.review && r.review.whole);
353
- s.setAttribute("aria-pressed", String(c)), s.title = D(t, "showWholeMap"), s.classList.toggle("hx-btn--active", c);
354
- let f = r.proposalErrors || [], p = u("proposal-errors");
355
- p.hidden = f.length === 0, f.length && (u("proposal-errors-count").textContent = `${mt(f.length, "problem")} in this proposal`, u("proposal-errors-list").innerHTML = pt(f));
356
- }
357
- function C() {
358
- let e = u("proposal-body");
359
- if (f && f.isConnected) return f;
360
- f = t.doc.createElement("p"), f.className = "hx-waiting-line", f.dataset.corn = "waiting-line", f.setAttribute("part", "waiting-line"), f.dataset.cornState = "waiting", f.hidden = !0, f.innerHTML = "<span data-waiting-words></span> <button type=\"button\" class=\"hx-btn hx-forge-act\" data-waiting-answer data-peek-ok data-corn-kind=\"secondary\"></button>";
361
- let n = e.querySelector(".hx-proposal-head");
362
- return n ? n.after(f) : e.append(f), f;
363
- }
364
- function w(e, n) {
365
- let r = C();
366
- if (r.hidden = !e, !e) {
367
- p = null;
368
- return;
369
- }
370
- let i = G(e);
371
- r.querySelector("[data-waiting-words]").textContent = i;
372
- let a = r.querySelector("[data-waiting-answer]");
373
- a.textContent = D(t, "answer"), a.dataset.waitingAnswer = e.runId, a.setAttribute("aria-label", `${D(t, "answer")}: ${i}`);
374
- let o = `${n}|${e.runId}`;
375
- p !== o && (p = o, N(t, i));
376
- }
377
- let T = () => [...d.querySelectorAll("#proposal-more-menu [role=\"menuitem\"]")], O = () => {
378
- let e = u("proposal-more-menu");
379
- return !!e && !e.hidden;
380
- };
381
- function k(e = !1) {
382
- u("proposal-more-menu").hidden = !0;
383
- let t = u("proposal-more");
384
- t.setAttribute("aria-expanded", "false"), e && t.focus();
385
- }
386
- function j(e = "first") {
387
- u("proposal-more-menu").hidden = !1, u("proposal-more").setAttribute("aria-expanded", "true");
388
- let t = T();
389
- (e === "last" ? t[t.length - 1] : t[0])?.focus();
390
- }
391
- function M(e) {
392
- let t = typeof e == "boolean" ? e : d.dataset.modeOpen !== "true";
393
- d.dataset.modeOpen = String(t), u("proposal-mode").setAttribute("aria-expanded", String(t));
394
- }
395
- function ee(e) {
396
- let n = u("proposal-more");
397
- if (e.target === n && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
398
- e.preventDefault(), j(e.key === "ArrowUp" ? "last" : "first");
399
- return;
400
- }
401
- if (!O()) return;
402
- if (e.key === "Escape") {
403
- e.preventDefault(), k(!0);
404
- return;
405
- }
406
- if (e.key === "Tab") {
407
- k();
408
- return;
409
- }
410
- let r = T(), i = r.indexOf(t.active());
411
- if (i < 0) return;
412
- let a = {
413
- ArrowDown: (i + 1) % r.length,
414
- ArrowUp: (i - 1 + r.length) % r.length,
415
- Home: 0,
416
- End: r.length - 1
417
- }[e.key];
418
- a !== void 0 && (e.preventDefault(), r[a].focus());
419
- }
420
- let P = () => {
421
- let e = u("proposal-menu");
422
- return !!e && !e.hidden;
423
- };
424
- function F() {
425
- u("proposal-menu").hidden = !0, u("proposal-btn").setAttribute("aria-expanded", "false");
426
- }
427
- async function I() {
428
- let e = u("proposal-menu");
429
- if (P()) return F();
430
- e.hidden = !1, u("proposal-btn").setAttribute("aria-expanded", "true"), Ke(t).entries || L(!0), await qe(t);
431
- }
432
- function L(e = !1) {
433
- let n = u("proposal-menu"), { entries: i, problem: a, forgeProblem: o } = Ke(t), s = r.proposal ? {
434
- slug: r.proposalSlug,
435
- source: r.proposalSource
436
- } : null, c;
437
- c = e && !i ? "<p class=\"hx-faint hx-proposal-empty\">Looking for proposals …</p>" : a ? `<p class="hx-error-text hx-proposal-empty">The list could not be loaded: ${l(a)}</p>` : !i || i.length === 0 ? "<p class=\"hx-faint hx-proposal-empty\">No proposals</p>" : `<div class="hx-proposal-list" role="list">${i.map((e) => `<div role="listitem">${_t(e, s)}</div>`).join("")}</div>`;
438
- let d = o && !a ? `<p class="hx-error-text hx-proposal-empty">The spec PRs could not be listed: ${l(o)}</p>` : "";
439
- n.innerHTML = `<div class="hx-menu-title hx-menu-head" data-corn="menu-title"><span>${l(D(t, "proposals"))}</span></div>${d}${c}`, g(n);
440
- }
441
- async function R(e, n) {
442
- let r = await Xe(t, e, n);
443
- if (m) return;
444
- let i = r ? u("proposal-title") : d.querySelector("#proposal-ways [data-way=\"retry\"]");
445
- i && (r && (i.tabIndex = -1), i.focus());
446
- }
447
- function z() {
448
- tt(t), r.canvas && r.canvas.focus();
449
- }
450
- function B() {
451
- t.ask("work:open-specs") !== !0 && (P() || I());
452
- }
453
- let V = {
454
- "toggle-proposals-menu": () => I(),
455
- "open-proposal": (e) => Xe(t, e.dataset.slug, e.dataset.source || null),
456
- "close-proposal": () => tt(t),
457
- "proposal-whole": () => {
458
- Fe(t, !(r.review && r.review.whole)), $e(t);
459
- },
460
- "proposal-view": (e) => {
461
- nt(t, e.dataset.view), M(!1);
462
- },
463
- "toggle-proposal-mode": () => M(),
464
- "toggle-proposal-more": () => O() ? k() : j(),
465
- "review-show-changes": () => t.emit("changes:show", "changes"),
466
- "review-show-scenarios": () => t.emit("changes:show", "scenarios"),
467
- "proposal-way": (e) => e.dataset.way === "open" ? Xe(t, e.dataset.slug, e.dataset.source || null) : e.dataset.way === "retry" ? R(e.dataset.slug, e.dataset.source || null) : e.dataset.way === "close" ? z() : B()
468
- };
469
- i.listen(t.root, "click", (e) => {
470
- let t = e.target.closest ? e.target.closest("[data-action]") : null, n = t && Object.hasOwn(V, t.dataset.action) && V[t.dataset.action];
471
- n && n(t), O() && !(t && t.dataset.action === "toggle-proposal-more") && k(!!(t && t.closest("#proposal-more-menu")));
472
- let r = u("proposal-wrap");
473
- P() && r && !r.contains(e.target) && !(t && t.dataset.action === "proposal-way") && F();
474
- }), i.listen(d, "click", (e) => {
475
- let n = e.target.closest && e.target.closest("[data-waiting-answer]");
476
- n && (e.preventDefault(), e.stopPropagation(), t.emit("work:answer", { run: n.dataset.waitingAnswer }));
477
- }, !0);
478
- let H = (e) => {
479
- let t = u("proposal-wrap");
480
- t && (t.hidden = !!e);
481
- };
482
- i.on("work:available", ({ on: e }) => H(e)), t.ask("work:on") && H(!0), i.listen(t.root, "keydown", (e) => {
483
- e.key === "Escape" && P() && F(), ee(e);
484
- });
485
- function q() {
486
- let e = t.tokenElement();
487
- if (!e || !e.style) return;
488
- let { mark: n } = b(E(r.theme), A(t).get());
489
- for (let t of Object.keys(n)) e.style.setProperty(`--hx-mark-${t}`, n[t].color);
490
- }
491
- q(), i.on("theme", q), i.own(A(t).onChange(() => q())), i.on("proposal:draw", ({ open: e }) => S({ open: e })), i.on("changes:peek", (e) => {
492
- u("proposal-peek").textContent = e;
493
- }), i.on("proposal:focus-title", () => {
494
- let e = u("proposal-title");
495
- e.tabIndex = -1, e.focus();
496
- }), i.on("proposal:message", (e) => h(e)), i.on("proposal:listing", () => {
497
- L(), r.proposal && y();
498
- }), i.on("proposal:waiting", ({ run: e, key: t }) => w(e, t)), i.on("proposal:waiting-reset", () => {
499
- p = null, f = null;
500
- }), i.on("proposal", ({ change: e }) => {
501
- e === "opened" && F();
502
- }), i.own(ut(t, (e, t, n) => i.listen(e, t, n))), Ce(t), xe(t, "proposal", d, { stub: () => ({ title: u("proposal-title") && u("proposal-title").textContent || "Proposal" }) }), i.own(() => Se(t, "proposal")), i.own(() => {
503
- m = !0, c.forEach((e) => e.remove());
504
- }), S();
505
- let te = Ye(t);
506
- return te && !r.proposal && h(te), {
507
- elements: c,
508
- renderBar: () => $e(t),
509
- paintWaitingLine: w,
510
- toggleMenu: I,
511
- closeMenu: F,
512
- setMessage: (e, n, r) => Je(t, e, n, r),
513
- sayBadLink: (e) => {
514
- let n = be(e);
515
- return n && Je(t, n, !0, [{
516
- label: D(t, "openSpecsList"),
517
- way: "specs"
518
- }]), !!n;
519
- },
520
- update(e) {
521
- if (!e || !("proposal" in e || "view" in e)) {
522
- $e(t);
523
- return;
524
- }
525
- let n;
526
- if ("proposal" in e) {
527
- let i = e.proposal;
528
- i === null ? tt(t) : typeof i == "string" ? n = r.proposal && r.proposalSlug === i && (e.source || null) === (r.proposalSource || null) && r.proposal ? Promise.resolve(!0) : Xe(t, i, e.source || null) : i && typeof i == "object" && Ze(t, i, {
529
- slug: e.slug || null,
530
- source: e.source || null,
531
- pinSource: !!e.source,
532
- view: Z.includes(e.view) ? e.view : "diff",
533
- sha256: e.sha256 || null
534
- });
535
- }
536
- return "view" in e && Z.includes(e.view) && !(typeof e.proposal == "string" && n) ? nt(t, e.view, { quiet: !0 }) : "view" in e && n && (n = n.then((n) => (n && Z.includes(e.view) && nt(t, e.view, { quiet: !0 }), n))), n;
537
- },
538
- pinnedSource: () => dt(t),
539
- destroy: () => i.destroy()
540
- };
541
- }
542
- var yt = (e) => e === void 0 ? null : Array.isArray(e) ? e : [e], bt = (e) => !e.kind && !e.dashed;
543
- function xt(e, t) {
544
- if (!t) return null;
545
- let n = k(t);
546
- return e.find((e) => e.type === "persona" && (e.id === n || e.id === t)) || null;
547
- }
548
- function St(e) {
549
- return e.account === !1 ? { account: !1 } : {
550
- role: e.role,
551
- groups: Array.isArray(e.groups) ? [...e.groups] : []
552
- };
553
- }
554
- var Ct = (e) => e ? e.codeLabel || e.label || e.id : "";
555
- function wt(e, t) {
556
- let n = new Map(e.map((e) => [e.id, e])), r = /* @__PURE__ */ new Map();
557
- for (let e of t) bt(e) && !r.has(e.to) && r.set(e.to, e.from);
558
- return {
559
- nodes: e,
560
- byId: n,
561
- owner: r
562
- };
563
- }
564
- function Tt(e, t) {
565
- let n = e.byId.get(t);
566
- return n ? n.type === "table" && (n.table || n.label) || null : typeof t == "string" && t.startsWith("table-") ? t.slice(6) : null;
567
- }
568
- function Et(e, t, n) {
569
- return !t || t.type !== "page" || !Array.isArray(t.methods) || t.methods.length === 0 ? !1 : !n || !Array.isArray(n.apps) || n.apps.includes(e.owner.get(t.id));
570
- }
571
- function Dt(e, t, n) {
572
- let r = yt(e && e.check);
573
- if (r) return r.map((e) => ({ ...e }));
574
- if (!e) return [];
575
- if (e.node !== void 0) {
576
- let r = t.byId.get(e.node);
577
- if (!Et(t, r, n)) return [];
578
- let i = r.methods.map((e) => String(e).toUpperCase());
579
- return [{
580
- route: r.label,
581
- method: i.includes("GET") ? "GET" : i[0]
582
- }];
583
- }
584
- if (e.edge && e.edge.kind === "writes") {
585
- let n = Tt(t, e.edge.to);
586
- return n ? [{
587
- table: n,
588
- op: "write"
589
- }] : [];
590
- }
591
- if (e.edge && e.edge.kind === "reads") {
592
- let n = Tt(t, e.edge.from);
593
- return n ? [{
594
- table: n,
595
- op: "read"
596
- }] : [];
597
- }
598
- return [];
599
- }
600
- function Ot(e, t, n, { as: r = null } = {}) {
601
- let i = [], a = [];
602
- return (e && Array.isArray(e.steps) ? e.steps : []).forEach((o, s) => {
603
- let c = r || o.actor || e.actor || null, l = {
604
- index: s,
605
- actor: c,
606
- actorLabel: "",
607
- kind: "none",
608
- checks: [],
609
- expect: o.expect
610
- };
611
- if (i.push(l), !c) return;
612
- let u = xt(t.nodes, c);
613
- if (l.actorLabel = u ? Ct(u) : c, !u) {
614
- l.kind = "unchecked", l.why = `no persona "${c}" on the map`;
615
- return;
616
- }
617
- let d = Dt(o, t, n);
618
- if (d.length === 0) {
619
- l.kind = "unchecked", l.why = Array.isArray(o.check) ? "this step is not a permission question" : "nothing in this step to ask";
620
- return;
621
- }
622
- l.kind = "ask";
623
- let f = St(u);
624
- l.checks = d.map((e, t) => ({
625
- id: `s${s + 1}-${t + 1}`,
626
- ...e
627
- })), l.checks.forEach((e) => a.push({
628
- ...e,
629
- actor: f
630
- }));
631
- }), {
632
- steps: i,
633
- items: a,
634
- key: JSON.stringify(a)
635
- };
636
- }
637
- function kt(e, t = {}) {
638
- let n = Error(t.message || e);
639
- return n.reason = e, Object.assign(n, t), n;
640
- }
641
- async function At(e, t, { signal: n } = {}) {
642
- let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
643
- if (!e) throw kt("no-checker", { message: "no permission checker" });
644
- let a = e.max > 0 ? e.max : 100, o = t.slice();
645
- for (; o.length;) {
646
- let t = o.slice(0, a), s;
647
- try {
648
- s = await e.check(t, { signal: n });
649
- } catch (e) {
650
- let n = e && e.reason === "bad-check" ? e.checkId : null;
651
- if (n && t.some((e) => e.id === n)) {
652
- i.set(n, e.message || "the checker refused this check"), o = o.filter((e) => e.id !== n);
653
- continue;
654
- }
655
- throw e;
656
- }
657
- for (let e of s || []) e && typeof e.id == "string" && r.set(e.id, e);
658
- o = o.slice(t.length);
659
- }
660
- return {
661
- results: r,
662
- bad: i
663
- };
664
- }
665
- function jt(e, t) {
666
- let n = {
667
- mismatch: !1,
668
- actor: e ? e.actorLabel : "",
669
- checks: []
670
- };
671
- if (!e || e.kind === "none") return {
672
- ...n,
673
- state: "none"
674
- };
675
- if (e.expect && (n.expect = e.expect), e.kind === "unchecked") return {
676
- ...n,
677
- state: "unchecked",
678
- why: e.why
679
- };
680
- if (!t || t.status === "idle" || t.status === "pending") return {
681
- ...n,
682
- state: "pending",
683
- checks: e.checks
684
- };
685
- if (t.status === "failed") return {
686
- ...n,
687
- state: "unavailable",
688
- why: Mt(t.error),
689
- checks: e.checks
690
- };
691
- let r = e.checks.map((e) => ({
692
- ...e,
693
- result: t.results.get(e.id) || null
694
- })), i = e.checks.find((e) => t.bad && t.bad.has(e.id));
695
- if (i) return {
696
- ...n,
697
- state: "unchecked",
698
- why: t.bad.get(i.id),
699
- checks: r
700
- };
701
- if (r.some((e) => !e.result)) return {
702
- ...n,
703
- state: "unavailable",
704
- why: "the checker gave no answer for this step",
705
- checks: r
706
- };
707
- let a = r.find((e) => e.result.allowed !== !0), o = a ? "refused" : "allowed", s = {
708
- ...n,
709
- state: o,
710
- checks: r
711
- };
712
- return a && (s.reason = a.result.reason || `refused (${a.result.status})`, a.result.rule && (s.rule = a.result.rule)), s.mismatch = !!e.expect && e.expect !== o, s;
713
- }
714
- function Mt(e) {
715
- let t = e && e.reason;
716
- return t === "no-checker" ? "no permission checker" : t === "no-token" ? `no token${e.hint ? ` (${e.hint})` : ""}` : t === "forbidden" ? "the token is not an admin's" : "the checker is not answering";
717
- }
718
- function Nt(e) {
719
- return e.route === void 0 ? [
720
- e.table,
721
- e.op,
722
- e.row
723
- ].filter(Boolean).join(" · ") : `${String(e.method || "").toUpperCase()} ${e.route}`;
724
- }
725
- function Pt(e) {
726
- if (!e || e.state === "none") return null;
727
- let t = e.actor ? ` as ${e.actor}` : "", n = e.checks.map(Nt).join(", "), r = n ? `${n}${t}` : e.actor ? `As ${e.actor}` : "", i = () => `${e.reason}${e.rule ? ` (${e.rule})` : ""}`;
728
- if (e.state === "pending") return {
729
- tone: "pending",
730
- pill: "Checking…",
731
- line: `Checking${t}…`,
732
- detail: r
733
- };
734
- if (e.state === "unchecked") return {
735
- tone: "unchecked",
736
- pill: "Not checked",
737
- line: `Not checked: ${e.why}`,
738
- detail: r
739
- };
740
- if (e.state === "unavailable") return {
741
- tone: "unavailable",
742
- pill: "Unavailable",
743
- line: `Not checked: live layer unavailable (${e.why})`,
744
- detail: r
745
- };
746
- if (e.mismatch) {
747
- let t = e.state === "refused" ? `Expected allowed, but refused: ${i()}` : "Expected refused, but allowed";
748
- return {
749
- tone: "mismatch",
750
- pill: `Expected ${e.expect}`,
751
- line: t,
752
- detail: r
753
- };
754
- }
755
- return e.state === "refused" ? {
756
- tone: "refused",
757
- pill: "✕ Refused",
758
- line: `Refused: ${i()}`,
759
- detail: r
760
- } : {
761
- tone: "allowed",
762
- pill: "✓ Allowed",
763
- line: "Allowed",
764
- detail: r
765
- };
766
- }
767
- // ../explorer/engine/checks.js
768
- var Ft = (e) => !!e && (!!e.actor || Array.isArray(e.steps) && e.steps.some((e) => e && e.actor));
769
- function It(e, t = {}) {
770
- let { state: n } = e, r = t.checker || null, i = null, a = 0, o = /* @__PURE__ */ new WeakMap(), s = [];
771
- function c() {
772
- i && i.controller && i.controller.abort(), i = null, a++;
773
- }
774
- function u(e) {
775
- e ||= null, e !== r && c(), r = e;
776
- }
777
- function d() {
778
- let e = i;
779
- if (!e) return;
780
- e.controller && e.controller.abort();
781
- let t = e.plan.items;
782
- if (t.length === 0) {
783
- e.answer = {
784
- status: "ok",
785
- results: /* @__PURE__ */ new Map(),
786
- bad: /* @__PURE__ */ new Map()
787
- }, a++;
788
- return;
789
- }
790
- let n = new AbortController();
791
- e.controller = n, e.answer = { status: "pending" }, a++, At(r, t, { signal: n.signal }).then(({ results: t, bad: r }) => f(e, n, {
792
- status: "ok",
793
- results: t,
794
- bad: r
795
- }), (t) => {
796
- n.signal.aborted || f(e, n, {
797
- status: "failed",
798
- error: t
799
- });
800
- });
801
- }
802
- function f(e, t, n) {
803
- i === e && e.controller === t && (e.controller = null, e.answer = n, a++, e.onChange());
804
- }
805
- function p(e, t = !1) {
806
- let o = i;
807
- if (!o || !t && o.scenario === e && o.nodes === n.nodes && o.plan) return;
808
- let s = o.plan ? o.plan.key : null;
809
- o.scenario = e, o.nodes = n.nodes, o.plan = Ot(e, wt(n.nodes, n.edges), r, { as: o.as }), a++, (t || o.plan.key !== s) && d();
810
- }
811
- function m(t, r = () => {}) {
812
- i && i.scenario && t && i.scenario.id === t.id ? (i.onChange = r, p(t)) : (c(), i = {
813
- scenario: null,
814
- as: null,
815
- nodes: null,
816
- plan: null,
817
- answer: { status: "idle" },
818
- controller: null,
819
- onChange: r
820
- }, Ft(t) && P(n).persona !== !0 && Me(e, "persona", !0, { scenario: !0 }), p(t));
821
- }
822
- function h(e, t) {
823
- if (!i) return e;
824
- p(t);
825
- let n = i.plan.steps[e.index];
826
- return e.verdict = jt(n, i.answer), i.as && n && n.actor && (e.current.actor = n.actor), e;
827
- }
828
- function _() {
829
- return !i || !i.plan ? [] : i.plan.steps.map((e) => jt(e, i.answer));
830
- }
831
- function v(e) {
832
- i && (i.as = e || null, p(i.scenario, !0), i.onChange());
833
- }
834
- function y() {
835
- i && (p(i.scenario, !0), i.onChange());
836
- }
837
- function b(t) {
838
- let n = e.doc, r = n.createElement("span");
839
- r.className = "hx-player-verdict", r.dataset.corn = "state-pill", r.hidden = !0;
840
- let i = t.querySelector(".hx-player-text");
841
- i ? i.append(" ", r) : t.prepend(r);
842
- let a = n.createElement("p");
843
- a.className = "hx-player-check", a.dataset.corn = "scenario-check", a.hidden = !0;
844
- let o = n.createElement("div");
845
- o.className = "hx-player-as", o.innerHTML = "\n <label class=\"hx-player-as-label\">As <select data-corn=\"control\" class=\"hx-player-speed hx-player-as-menu\" data-check=\"as\" aria-label=\"Act every step as\"></select></label>\n <button data-corn-kind=\"secondary\" type=\"button\" class=\"hx-btn\" data-check=\"recheck\">Check again</button>\n <span class=\"hx-player-as-sum hx-faint\"></span>";
846
- let c = t.querySelector(".hx-player-track");
847
- c ? (c.before(a), c.before(o)) : (t.appendChild(a), t.appendChild(o));
848
- for (let e of [
849
- r,
850
- a,
851
- o
852
- ]) e.hasAttribute("data-corn") && e.setAttribute("part", e.getAttribute("data-corn"));
853
- g(o);
854
- let l = o.querySelector("[data-check=as]"), u = o.querySelector("[data-check=recheck]"), d = (e) => v(e.target.value);
855
- l.addEventListener("change", d), u.addEventListener("click", y), s.push(() => {
856
- l.removeEventListener("change", d), u.removeEventListener("click", y);
857
- });
858
- }
859
- function x() {
860
- let e = s;
861
- s = [], e.forEach((e) => e());
862
- }
863
- function S(e) {
864
- let t = [{
865
- value: "",
866
- label: "As written"
867
- }, ...n.nodes.filter((e) => e.type === "persona").map((e) => ({
868
- value: e.id.replace(/^persona-/, ""),
869
- label: Ct(e)
870
- }))], r = t.map((e) => `${e.value}\u0000${e.label}`).join("");
871
- e.dataset.key !== r && (e.innerHTML = t.map((e) => `<option value="${l(e.value)}">${l(e.label)}</option>`).join(""), e.dataset.key = r), e.value = i && i.as ? i.as : "";
872
- }
873
- function C() {
874
- let e = _(), t = e.reduce((e, t) => e + t.checks.length, 0);
875
- if (!i || i.answer.status === "pending") return t ? `Checking ${t}…` : "";
876
- if (i.answer.status === "failed") return "";
877
- let n = e.filter((e) => e.state === "refused").length, r = e.filter((e) => e.mismatch).length, a = [`${t} ${t === 1 ? "check" : "checks"}`];
878
- return n && a.push(`${n} refused`), r && a.push(`${r} not as expected`), t ? a.join(" · ") : "No permission questions";
879
- }
880
- function w(e, t) {
881
- if (!e || !i) return;
882
- if (!e.querySelector(".hx-player-as")) {
883
- if (!Ft(i.scenario)) return;
884
- b(e);
885
- }
886
- let n = e.querySelector(".hx-player-verdict"), r = e.querySelector(".hx-player-check"), a = e.querySelector(".hx-player-as");
887
- if (!n || !r || !a) return;
888
- let s = t.done ? null : Pt(t.verdict);
889
- if (n.hidden = !s, r.hidden = !s, s) {
890
- n.dataset.tone = s.tone, ue(s.tone) ? n.dataset.cornState = ue(s.tone) : delete n.dataset.cornState, n.textContent = s.pill, n.title = s.line, r.dataset.tone = s.tone;
891
- let e = `${l(s.line)}${s.detail ? ` <span class="hx-player-check-detail">${l(s.detail)}</span>` : ""}`;
892
- o.get(r) !== e && (o.set(r, e), r.innerHTML = e);
893
- }
894
- S(a.querySelector("[data-check=as]")), a.querySelector("[data-check=recheck]").disabled = i.answer.status === "pending", a.querySelector(".hx-player-as-sum").textContent = C();
895
- }
896
- return {
897
- setChecker: u,
898
- open: m,
899
- close: c,
900
- decorate: h,
901
- paint: w,
902
- unmount: x,
903
- verdicts: _,
904
- chooseActor: v,
905
- recheck: y,
906
- version: () => a,
907
- checkedScenarioId: () => i && i.scenario ? i.scenario.id : null
908
- };
909
- }
910
- // ../explorer/scenario.js
911
- var Lt = 5e3, Rt = "topology.scenarioSpeed", zt = [
912
- {
913
- value: "2000",
914
- label: "2 s"
915
- },
916
- {
917
- value: "5000",
918
- label: "5 s"
919
- },
920
- {
921
- value: "10000",
922
- label: "10 s"
923
- },
924
- {
925
- value: "manual",
926
- label: "Manual"
927
- }
928
- ];
929
- function Bt(e) {
930
- let t = zt.find((t) => t.value === e);
931
- return t ? t.value === "manual" ? "manual" : Number(t.value) : Lt;
932
- }
933
- function Vt(e, t = Lt) {
934
- let n = e && e.ms;
935
- return typeof n == "number" && n > 0 && Number.isFinite(n) ? n : t;
936
- }
937
- var Ht = (e) => e && Array.isArray(e.steps) ? e.steps : [];
938
- function Ut(e) {
939
- let t = e && Array.isArray(e.down) ? e.down : [];
940
- return [...new Set(t.filter((e) => typeof e == "string" && e !== ""))];
941
- }
942
- function Wt(e, t) {
943
- return t && t.actor || e && e.actor || null;
944
- }
945
- function Gt(e, t = {}) {
946
- let n = e, r = t.stepMs, i = () => r === "manual", a = () => n.stepMs ?? (typeof r == "number" && r > 0 ? r : 5e3), o = t.maxFrameMs ?? Infinity, s = 0, c = !1, l = Ht(e).length === 0, u = 0, d = null, f = null, p = () => Ht(n), m = () => p().length - 1, h = (e) => Vt(p()[e], a()), g = (e) => Math.max(0, Math.min(Math.max(0, m()), e)), _ = () => {
947
- s = 0, l = p().length === 0, u = 0, d = null, f = null;
948
- }, v = () => {
949
- c = !1, d = null, f = null;
950
- };
951
- return {
952
- play() {
953
- p().length === 0 || i() || (l && _(), c || (c = !0, d = null));
954
- },
955
- pause() {
956
- v();
957
- },
958
- isPlaying: () => c,
959
- next() {
960
- v(), s < m() ? (s++, u = 0) : p().length && (l = !0);
961
- },
962
- prev() {
963
- v(), l = !1, s > 0 && (s--, u = 0);
964
- },
965
- goTo(e) {
966
- if (v(), !Number.isFinite(e)) return;
967
- let t = g(Math.floor(e));
968
- t !== s && (s = t, u = 0), l = !1;
969
- },
970
- stop() {
971
- v(), _();
972
- },
973
- setSpeed(e) {
974
- r = e, i() && v();
975
- },
976
- scenario: () => n,
977
- setScenario(e) {
978
- n = e, s = g(s), p().length === 0 && (l = !0);
979
- },
980
- tick(e) {
981
- if (!c || i()) return;
982
- if (d === null) {
983
- d = e, f = e - u;
984
- return;
985
- }
986
- let t = Math.max(0, e - d);
987
- for (u += Math.min(t, o), t > o && (f = e - u), d = e; u >= h(s);) {
988
- if (s >= m()) {
989
- u = h(s), l = !0, v();
990
- return;
991
- }
992
- u -= h(s), f += h(s), s++;
993
- }
994
- },
995
- snapshot() {
996
- let e = p(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = [];
997
- for (let n = 0; n <= s && n < e.length; n++) {
998
- let i = e[n];
999
- if (i.node !== void 0 && t.add(i.node), i.at !== void 0 && t.add(i.at), i.edge) {
1000
- t.add(i.edge.from), t.add(i.edge.to);
1001
- let e = X(i.edge);
1002
- r.has(e) || (r.add(e), a.push({ ...i.edge }));
1003
- }
1004
- }
1005
- let o = e[s], d = { text: o ? String(o.text ?? "") : "" };
1006
- o && o.node !== void 0 && (d.node = o.node), o && o.edge && (d.edge = { ...o.edge }, d.edgeKey = X(o.edge));
1007
- let m = Wt(n, o);
1008
- m && (d.actor = m), o && o.at !== void 0 && (d.at = o.at), o && o.check !== void 0 && (d.check = JSON.parse(JSON.stringify(o.check))), o && o.expect !== void 0 && (d.expect = o.expect);
1009
- let g = h(s);
1010
- return {
1011
- id: n.id,
1012
- title: n.title,
1013
- total: e.length,
1014
- index: s,
1015
- playing: c,
1016
- done: l,
1017
- visited: {
1018
- nodes: t,
1019
- edges: r,
1020
- edgeList: a
1021
- },
1022
- current: d,
1023
- progress: l ? 1 : i() ? 0 : Math.min(1, u / g),
1024
- manual: i(),
1025
- stepMs: g,
1026
- stepStartMs: f,
1027
- linkNodes: !!n.linkNodes,
1028
- down: Ut(n)
1029
- };
1030
- }
1031
- };
1032
- }
1033
- function Kt(e, t, n, r, i = 60, a = I) {
1034
- if (!n.width || !n.height) return null;
1035
- let o = e.node === void 0 ? e.edge ? [e.edge.from, e.edge.to] : [] : [e.node], s = o.map((e) => r.get(e));
1036
- if (s.length === 0 || s.some((e) => !e)) return null;
1037
- e.at !== void 0 && r.has(e.at) && !o.includes(e.at) && s.push(r.get(e.at));
1038
- let c = {
1039
- x: n.x || 0,
1040
- y: n.y || 0,
1041
- width: n.width,
1042
- height: n.height
1043
- }, l = y(s, c, {
1044
- padding: i,
1045
- maxZoom: Math.max(1, t.zoom),
1046
- minZoom: a
1047
- }), u = Math.min(i, c.width / 4, c.height / 4);
1048
- return de(s, t, c, u) && t.zoom >= l.zoom - .001 ? null : l;
1049
- }
1050
- // ../explorer/outage-scenario.js
1051
- function qt(e, t) {
1052
- if (!e) return [];
1053
- let n = new Map(t.map((e) => [e.id, e])), r = /* @__PURE__ */ new Set();
1054
- for (let t of [...e.down, ...e.hits.keys()]) {
1055
- let e = n.get(t);
1056
- e && r.add(e.type === "external" ? m(e) : e.type);
1057
- }
1058
- return [...r];
1059
- }
1060
- var Jt = 3, Yt = " (in the visitor's browser)";
1061
- function Xt(e) {
1062
- if (e.length < 2) return e.join("");
1063
- let t = e.some((e) => e.includes(" and ")) ? ", and " : " and ";
1064
- return `${e.slice(0, -1).join(", ")}${t}${e[e.length - 1]}`;
1065
- }
1066
- function Zt(e) {
1067
- let t = /* @__PURE__ */ new Map();
1068
- for (let n of e) t.has(n.type) || t.set(n.type, []), t.get(n.type).push(n);
1069
- return Xt([...t].sort(([e, t], [n, r]) => r.length - t.length || L(e) - L(n) || e.localeCompare(n)).map(([e, t]) => {
1070
- let n = le(e, t.length);
1071
- if (t.length > Jt) {
1072
- let e = t.filter((e) => e.browser).length;
1073
- return `${t.length} ${n}${e === t.length ? Yt : e ? ` (${e} in the visitor's browser)` : ""}`;
1074
- }
1075
- return `the ${n} ${Xt(t.map((e) => `${e.label}${e.browser ? Yt : ""}`))}`;
1076
- }));
1077
- }
1078
- function Qt(e, t, n) {
1079
- let r = new Map(t.map((e) => [e.id, e])), i = String(e.label || e.id), a = v([e.id], t, n), o = (e) => (t) => a.hits.has(t.id) && a.hits.get(t.id).when === e, s = new Map(pe(e, t, n).map((e) => [e.when, e.types.flatMap((e) => e.items).filter(o(e.when)).map((e) => ({
1080
- ...e,
1081
- browser: a.hits.get(e.id).browser
1082
- }))])), c = [
1083
- `${i} is down.`,
1084
- e.breaks ? String(e.breaks) : "",
1085
- a.groups.length ? "" : "Nothing on the map uses it."
1086
- ].filter(Boolean).join(" "), l = [{
1087
- node: e.id,
1088
- text: c
1089
- }];
1090
- for (let t of a.groups) {
1091
- let n = s.get(t.when) || [], i = new Set(n.map((e) => e.id)), o = t.ids.filter((e) => !i.has(e)).map((e) => {
1092
- let t = r.get(e);
1093
- return {
1094
- id: e,
1095
- label: String(t.label || e),
1096
- type: t.type,
1097
- browser: a.hits.get(e).browser
1098
- };
1099
- }), c;
1100
- c = n.length ? `${t.title}: ${Zt(n)}.${o.length ? ` Through ${n.length === 1 ? "it" : "them"}: ${Zt(o)}.` : ""}` : `${t.title}, through what uses it: ${Zt(o)}.`, l.push(n.length ? {
1101
- edge: {
1102
- from: n[0].id,
1103
- to: e.id,
1104
- kind: "calls"
1105
- },
1106
- text: c
1107
- } : {
1108
- node: t.ids[0],
1109
- text: c
1110
- });
1111
- }
1112
- return {
1113
- id: `outage-${e.id}`,
1114
- title: `${i} is down`,
1115
- down: [e.id],
1116
- steps: l
1117
- };
1118
- }
1119
- // ../explorer/scenario-list-model.js
1120
- var $ = (e) => Array.isArray(e) ? e : [], $t = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, en = (e) => String(e ?? "").replace(/[^A-Za-z0-9_-]+/g, "_") || "_", tn = (e) => String(e.id).replace(/^persona-/, ""), nn = (e) => e.codeLabel || e.label || tn(e);
1121
- function rn(e, t, n) {
1122
- let r = new Set([
1123
- "add",
1124
- "change",
1125
- "remove"
1126
- ].flatMap((e) => $(n?.edges?.[e]).map(X))), i = (t) => (e.find((e) => e.id === t) || { label: t }).label || t, a = [];
1127
- for (let n of [...oe, "edit"]) {
1128
- for (let t of e.filter((e) => e.mark === n)) a.push({
1129
- kind: "node",
1130
- key: t.id,
1131
- mark: n,
1132
- word: fe[n],
1133
- name: String(t.label ?? t.id),
1134
- type: String(t.type ?? "")
1135
- });
1136
- for (let e of t.filter((e) => e.mark === n && r.has(X(e)))) a.push({
1137
- kind: "edge",
1138
- key: X(e),
1139
- mark: n,
1140
- word: fe[n],
1141
- name: `${i(e.from)} → ${i(e.to)}`,
1142
- type: String(e.kind || "ownership")
1143
- });
1144
- }
1145
- return a;
1146
- }
1147
- function an(e) {
1148
- let t = [], n = (e) => {
1149
- typeof e == "string" && e && !t.includes(e) && t.push(e);
1150
- };
1151
- n(e?.actor);
1152
- for (let t of $(e?.steps)) n(t?.actor);
1153
- return t;
1154
- }
1155
- function on(e, t = {}) {
1156
- let n = t.notChecked || "Not checked";
1157
- return !e || e.state === "none" ? null : e.state === "pending" ? {
1158
- words: "Checking…",
1159
- state: "",
1160
- tone: "pending"
1161
- } : e.state === "unchecked" ? {
1162
- words: `${n}: ${e.why || "nothing to ask"}`,
1163
- state: "",
1164
- tone: "unchecked"
1165
- } : e.state === "unavailable" ? {
1166
- words: `${n}: the checker did not answer${e.why ? ` (${e.why})` : ""}`,
1167
- state: "",
1168
- tone: "unavailable"
1169
- } : e.mismatch ? {
1170
- words: e.state === "refused" ? `Expected allowed, was refused${e.reason ? `: ${e.reason}` : ""}` : "Expected refused, was allowed",
1171
- state: "failure",
1172
- tone: "mismatch"
1173
- } : e.state === "refused" ? {
1174
- words: `Refused: ${e.reason || "no reason given"}`,
1175
- state: e.expect === "refused" ? "success" : "failure",
1176
- tone: "refused"
1177
- } : {
1178
- words: "Allowed",
1179
- state: "success",
1180
- tone: "allowed"
1181
- };
1182
- }
1183
- function sn(e, t) {
1184
- return $(e.steps).map((n, r) => {
1185
- let i = n && n.actor || e.actor || null, a = "", o = "", s = [];
1186
- if (n && n.edge) {
1187
- a = `${t.label(n.edge.from)} → ${t.label(n.edge.to)}`, s = [
1188
- `edge:${X(n.edge)}`,
1189
- `node:${n.edge.from}`,
1190
- `node:${n.edge.to}`
1191
- ];
1192
- let e = t.edges.find((e) => X(e) === X(n.edge));
1193
- e && e.mark && e.mark !== "none" && t.changeKeys.has(`edge:${X(e)}`) && (o = e.mark);
1194
- } else if (n && n.node !== void 0) {
1195
- a = t.label(n.node), s = [`node:${n.node}`];
1196
- let e = t.nodes.find((e) => e.id === n.node);
1197
- e && e.mark && e.mark !== "none" && (o = e.mark);
1198
- }
1199
- let c = t.verdicts ? on(t.verdicts[r], t.words) : null, l = !!t.hidden && s.some((e) => e.startsWith("node:") && t.hidden(e.slice(5)));
1200
- return {
1201
- index: r,
1202
- number: r + 1,
1203
- actor: i,
1204
- actorLabel: i ? t.personaLabel(i) : "",
1205
- where: a,
1206
- mark: o,
1207
- markWord: o && fe[o] || "",
1208
- text: String((n && n.text) ?? ""),
1209
- verdict: i ? c : null,
1210
- layerOff: l,
1211
- touched: s
1212
- };
1213
- });
1214
- }
1215
- function cn(e, t) {
1216
- let n = [
1217
- e.where,
1218
- e.markWord,
1219
- e.layerOff ? "on a layer that is off" : ""
1220
- ].filter(Boolean).join(", ");
1221
- return [
1222
- `Step ${e.number} of ${t}${e.actorLabel ? `, as ${e.actorLabel}` : ""}${n ? `: ${n}` : ""}.`,
1223
- e.text,
1224
- e.verdict ? `${e.verdict.words}${/[.!?…]$/.test(e.verdict.words) ? "" : "."}` : ""
1225
- ].filter(Boolean).join(" ");
1226
- }
1227
- function ln({ snap: e, nodes: t, edges: n, words: r = {} }) {
1228
- let i = e.current || {}, a = (e) => String((t.find((t) => t.id === e) || { label: e }).label ?? e), o = i.actor ? t.find((e) => e.type === "persona" && (e.id === `persona-${i.actor}` || e.id === i.actor)) : null, s = "", c = "";
1229
- if (i.edge) {
1230
- s = `${a(i.edge.from)} → ${a(i.edge.to)}`;
1231
- let e = n.find((e) => X(e) === X(i.edge));
1232
- e && e.mark && e.mark !== "none" && (c = e.mark);
1233
- } else if (i.node !== void 0) {
1234
- s = a(i.node);
1235
- let e = t.find((e) => e.id === i.node);
1236
- e && e.mark && e.mark !== "none" && (c = e.mark);
1237
- }
1238
- let l = i.actor ? on(e.verdict, r) : null;
1239
- return cn({
1240
- number: e.index + 1,
1241
- actorLabel: i.actor ? o ? nn(o) : String(i.actor) : "",
1242
- where: s,
1243
- markWord: c && fe[c] || "",
1244
- text: String(i.text ?? ""),
1245
- verdict: l
1246
- }, e.total);
1247
- }
1248
- function un(e) {
1249
- let t = (t) => e.filter((e) => e.verdict && e.verdict.tone === t).length;
1250
- return [
1251
- [t("allowed"), "allowed"],
1252
- [t("refused"), "refused"],
1253
- [t("mismatch"), "not as expected"]
1254
- ].filter(([e]) => e > 0).map(([e, t]) => `${e} ${t}`).join(" · ");
1255
- }
1256
- function dn({ scenarios: e, nodes: t, edges: n, proposal: r = null, verdicts: i = null, seen: a = null, words: o = {}, hidden: s = null }) {
1257
- let c = $(e), l = t.filter((e) => e.type === "persona"), u = new Map(l.map((e) => [tn(e), e])), d = (e) => String((t.find((t) => t.id === e) || { label: e }).label ?? e), f = (e) => u.has(e) ? nn(u.get(e)) : String(e), p = rn(t, n, r), m = new Set(p.map((e) => `${e.kind}:${e.key}`)), h = new Set($(a?.played)), g = new Set($(a?.read)), _ = c.map((e, r) => {
1258
- let a = i && i.get(e.id), c = sn(e, {
1259
- nodes: t,
1260
- edges: n,
1261
- changeKeys: m,
1262
- verdicts: a || null,
1263
- words: o,
1264
- label: d,
1265
- personaLabel: f,
1266
- hidden: s
1267
- }), l = new Set(c.flatMap((e) => e.touched).filter((e) => m.has(e))), u = c.length, p = [$t(u, "step")];
1268
- m.size > 0 && p.push(`walks ${l.size} of ${$t(m.size, "change")}`);
1269
- let _ = un(c);
1270
- return {
1271
- index: r,
1272
- id: String(e.id ?? ""),
1273
- key: `${r}-${en(e.id)}`,
1274
- title: String(e.title ?? e.id ?? ""),
1275
- actors: an(e),
1276
- steps: c,
1277
- stepCount: u,
1278
- summary: p.join(" · "),
1279
- verdictSummary: _,
1280
- seen: h.has(String(e.id)) ? "played" : g.has(String(e.id)) ? "read" : ""
1281
- };
1282
- }), v = [...u.keys()];
1283
- for (let e of _) for (let t of e.actors) v.includes(t) || v.push(t);
1284
- let y = [];
1285
- for (let e of v) {
1286
- let t = _.filter((t) => t.actors.includes(e));
1287
- if (!t.length) continue;
1288
- let n = f(e);
1289
- y.push({
1290
- key: en(e),
1291
- persona: e,
1292
- label: n,
1293
- anyone: !1,
1294
- heading: `${n} · ${$t(t.length, "scenario")}`,
1295
- scenarios: t
1296
- });
1297
- }
1298
- let b = _.filter((e) => e.actors.length === 0);
1299
- b.length && y.push({
1300
- key: "anyone",
1301
- persona: null,
1302
- label: "Anyone",
1303
- anyone: !0,
1304
- heading: `Anyone · ${$t(b.length, "scenario")}`,
1305
- scenarios: b
1306
- });
1307
- let x = new Set(_.flatMap((e) => e.actors)), S = _.length ? l.filter((e) => !x.has(tn(e))).map(nn) : [], C = _.filter((e) => e.seen === "played").length;
1308
- return {
1309
- total: _.length,
1310
- personaCount: y.filter((e) => !e.anyone).length,
1311
- groups: y,
1312
- notInAny: S,
1313
- coverage: S.length ? `Not in any scenario: ${S.join(", ")}` : "",
1314
- playedLine: _.length && C ? `${C} of ${_.length} ${_.length === 1 ? "scenario" : "scenarios"} played` : ""
1315
- };
1316
- }
1317
- function fn(e, t) {
1318
- let n = [$t(e, "change")];
1319
- return t.total > 0 && n.push(`${$t(t.total, "scenario")}${t.personaCount > 0 ? ` for ${$t(t.personaCount, "persona")}` : ""}`), n.join(" · ");
1320
- }
1321
- function pn(e, t, n) {
1322
- return `Opened ${e}: ${fn(t, n).replace(" · ", ", ")}.`;
1323
- }
1324
- var mn = (e, t, n = "") => `cornfield.seen.${e || "checkout"}/${t || ""}@${n || ""}`;
1325
- function hn(e, t) {
1326
- let n = {
1327
- played: [],
1328
- read: []
1329
- };
1330
- try {
1331
- let r = e && e.getItem(t);
1332
- if (!r) return n;
1333
- let i = JSON.parse(r), a = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string").slice(0, 200) : [];
1334
- return {
1335
- played: a(i && i.played),
1336
- read: a(i && i.read)
1337
- };
1338
- } catch {
1339
- return n;
1340
- }
1341
- }
1342
- function gn(e, t, n, r, i = null) {
1343
- let a = i ? {
1344
- played: [...$(i.played)],
1345
- read: [...$(i.read)]
1346
- } : hn(e, t), o = String(n);
1347
- r === "played" ? (a.played.includes(o) || a.played.push(o), a.read = a.read.filter((e) => e !== o)) : !a.read.includes(o) && !a.played.includes(o) && a.read.push(o);
1348
- try {
1349
- e && e.setItem(t, JSON.stringify(a));
1350
- } catch {}
1351
- return a;
1352
- }
1353
- // ../explorer/engine/player.js
1354
- var _n = 250, vn = 140;
1355
- function yn(e, t) {
1356
- let { state: n } = e;
1357
- if (!t || n.view === "dataflow" || n.view === "house") return [];
1358
- let r = P(n), i = (e) => r[e] !== !1, a = t.type;
1359
- if (a === "root" || C(n, t)) return [];
1360
- let o = x(n, t);
1361
- if (o) return i(o) ? [] : [o];
1362
- if (a === "core") return [...i("core") ? [] : ["core"], ...r.pkg || r.atom ? [] : ["pkg"]];
1363
- if (a === "store") return ["flow", "store"].filter((e) => !i(e));
1364
- if (a === "rom") return ["rom", "flow"].filter((e) => !i(e));
1365
- if (a === "floor" || a === "room") return i("house") ? [] : ["house"];
1366
- let s = a === "external" ? m(t) : a;
1367
- return i(s) ? [] : [s];
1368
- }
1369
- var bn = (e) => (Array.isArray(e?.steps) ? e.steps : []).flatMap((e) => e?.edge ? [e.edge.from, e.edge.to] : e && e.node !== void 0 ? [e.node] : []), xn = "input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"]", Sn = (e) => !!(e && e.closest && e.closest(xn));
1370
- function Cn(e, t) {
1371
- let n = new Set(e.map((e) => e.id)), r = (t) => (e.find((e) => e.id === t) || { label: t }).label, i = t.filter((e) => (e.kind || e.dashed) && n.has(e.from) && n.has(e.to) && e.from !== e.to);
1372
- if (!i.length) return null;
1373
- let a = /* @__PURE__ */ new Map();
1374
- for (let e of i) a.has(e.from) || a.set(e.from, []), a.get(e.from).push(e);
1375
- let o = [...a.keys()].sort((e, t) => a.get(t).length - a.get(e).length || e.localeCompare(t))[0], s = [{
1376
- node: o,
1377
- text: `It starts at ${r(o)}.`
1378
- }], c = /* @__PURE__ */ new Set([o]), l = o;
1379
- for (let e = 0; e < 3; e++) {
1380
- let e = (a.get(l) || []).find((e) => !c.has(e.to));
1381
- if (!e) break;
1382
- let t = {
1383
- from: e.from,
1384
- to: e.to,
1385
- ...e.kind ? { kind: e.kind } : {},
1386
- ...e.kind === "flow" ? { flow: e.flow } : {}
1387
- };
1388
- s.push({
1389
- edge: t,
1390
- text: `${r(e.from)} ${e.label || e.kind || "uses"} ${r(e.to)}.`
1391
- }), s.push({
1392
- node: e.to,
1393
- text: `Now at ${r(e.to)}.`
1394
- }), c.add(e.to), l = e.to;
1395
- }
1396
- return s.length < 2 ? null : {
1397
- id: "demo",
1398
- title: "A walk over the map",
1399
- steps: s
1400
- };
1401
- }
1402
- function wn(e, t, n) {
1403
- let { state: r } = e, i = null, a = null, o = "", s = null, c = !1, u = -1, d = null, f = -1, p = null, m = null, h = null, _ = null, y = /* @__PURE__ */ new Set(), b = [], x = (t) => {
1404
- for (let e of [...y]) e(t);
1405
- e.emit("scenario:player", t);
1406
- }, S = () => r.canvas ? r.canvas.parentElement : null, C = () => e.map.render();
1407
- function w() {
1408
- let t = e.active();
1409
- return t && t !== e.doc.body && !t.closest?.(".hx-player") && !t.closest?.("#review-column") && t !== r.canvas ? t : null;
1410
- }
1411
- function E() {
1412
- let t = e.active();
1413
- return !!t && t !== e.doc.body && !Sn(t);
1414
- }
1415
- function O() {
1416
- let t = p;
1417
- p = null;
1418
- let n = (t) => !t || !t.isConnected || t.hidden || t.disabled || t.closest("[hidden]") ? !1 : (t.focus(), e.active() === t);
1419
- n(m && m()) || n(t) || n(r.canvas);
1420
- }
1421
- function k(t) {
1422
- t && Array.isArray(t.down) && t.down.length && qt(v(t.down, r.nodes, r.edges), r.nodes).forEach((t) => {
1423
- M(r, t) || Me(e, t, !0, { scenario: !0 });
1424
- });
1425
- }
1426
- function A(t) {
1427
- let n = new Map(r.nodes.map((e) => [e.id, e])), i = [];
1428
- for (let r of bn(t)) for (let t of yn(e, n.get(r))) i.includes(t) || i.push(t);
1429
- if (!i.length) return;
1430
- for (let t of i) Me(e, t, !0, { scenario: !0 });
1431
- let a = i.map((e) => (ze.find((t) => t.key === e) || (r.projectLayers || []).find((t) => t.key === e) || { label: e }).label);
1432
- N(e, `Turned on ${a.length > 1 ? `${a.slice(0, -1).join(", ")} and ${a[a.length - 1]}` : a[0]} to show this scenario's steps.`);
1433
- }
1434
- function j(t, r = {}) {
1435
- let o = w(), s = E() && r.focus !== !1;
1436
- P({ keepChecks: !0 }), p = o;
1437
- let c = r.stepMs ?? H();
1438
- if (i = Gt(t, {
1439
- stepMs: c,
1440
- maxFrameMs: _n
1441
- }), Number.isFinite(r.step) && r.step > 0 && i.goTo(r.step), V(c), n.open(t, () => {
1442
- I(), C();
1443
- }), k(t), A(t), r.autoplay !== !1 && !(r.step > 0) && i.play(), I(!0), C(), e.map.ensureFlowLoop(), s && a) {
1444
- let e = a.querySelector("[data-action=scenario-toggle]");
1445
- e && !e.disabled ? e.focus() : a.querySelector("[data-action=scenario-next]")?.focus();
1446
- }
1447
- return i;
1448
- }
1449
- function ee(e) {
1450
- let t = r.nodes.find((t) => t.id === e);
1451
- return !t || t.type !== "external" || t.kind !== "cloud" ? null : j(Qt(t, r.nodes, r.edges));
1452
- }
1453
- function P({ keepChecks: t = !1, closing: c = !1 } = {}) {
1454
- let l = !!i || !!r.scenario;
1455
- l && Re(e), i = null, s = null, o = "", r.scenario = null, t || n.close(), d &&= (d.disconnect(), null), a &&= (Se(e, "player"), b.forEach((e) => e()), b = [], n.unmount(), a.remove(), null), l && (!t || c) && x(null);
1456
- }
1457
- function F() {
1458
- if (!i && !r.scenario) return;
1459
- let t = e.active(), n = !!a && a.contains(t) || !!t?.closest?.("#review-column");
1460
- P({
1461
- keepChecks: !!i && !!h && h(i.scenario().id),
1462
- closing: !0
1463
- }), e.touchScene(), C();
1464
- let o = e.active();
1465
- n || !o || o === e.doc.body ? O() : p = null;
1466
- }
1467
- function I(t = !1) {
1468
- if (!i) return !1;
1469
- let a = n.decorate(i.snapshot(), i.scenario());
1470
- r.scenario = a;
1471
- let s = `${a.index}|${a.playing}|${a.done}|${a.stepStartMs}|${a.stepMs}|${a.manual}|${n.version()}`, l = t || s !== o;
1472
- if (l) {
1473
- let n = t || s.split("|")[0] !== o.split("|")[0];
1474
- o = s, e.touchScene(), n && (c = !1, L(a));
1475
- }
1476
- return G(a), l && x({
1477
- id: a.id,
1478
- index: a.index,
1479
- total: a.total,
1480
- done: a.done,
1481
- playing: a.playing,
1482
- checks: n.version()
1483
- }), l;
1484
- }
1485
- function L(t) {
1486
- let n = /* @__PURE__ */ new Map();
1487
- r.nodes.forEach((t) => {
1488
- e.map.isNodeVisible(t) && n.set(t.id, t);
1489
- });
1490
- let i = T(e);
1491
- u = a ? a.offsetHeight : 0;
1492
- let o = Kt({
1493
- node: t.current.node,
1494
- edge: t.current.edge,
1495
- at: t.current.at,
1496
- text: t.current.text
1497
- }, r.camera, i, n, 60, e.map.getMinZoom());
1498
- o && (e.reducedMotion ? (Object.assign(r.camera, o), s = null, C()) : (s = {
1499
- to: o,
1500
- last: null
1501
- }, e.map.ensureFlowLoop()));
1502
- }
1503
- function R(e) {
1504
- if (!s) return;
1505
- let t = s.last === null ? 16 : Math.min(e - s.last, 100);
1506
- s.last = e;
1507
- let n = 1 - Math.exp(-t / vn), i = r.camera;
1508
- i.x += (s.to.x - i.x) * n, i.y += (s.to.y - i.y) * n, i.zoom += (s.to.zoom - i.zoom) * n, Math.abs(s.to.x - i.x) < .5 && Math.abs(s.to.y - i.y) < .5 && Math.abs(s.to.zoom - i.zoom) < .002 && (Object.assign(i, s.to), s = null);
1509
- }
1510
- let z = () => !!i && (i.isPlaying() || !!s);
1511
- function B(e) {
1512
- i && (i.tick(e), I(), R(e));
1513
- }
1514
- t.own(e.map.addFrameClient({
1515
- wants: z,
1516
- tick: B
1517
- }));
1518
- function V(t) {
1519
- let n = S();
1520
- if (!n) return;
1521
- a = e.doc.createElement("div"), a.className = "hx-player glass", a.dataset.corn = "scenario-player", a.setAttribute("part", "scenario-player"), a.setAttribute("role", "region"), a.setAttribute("aria-label", "Scenario player"), a.innerHTML = `
1522
- <span class="hx-player-title hx-sr-only"></span>
1523
- <div class="hx-player-controls" role="group">
1524
- <button data-corn-kind="secondary" type="button" class="hx-btn hx-player-prev" data-action="scenario-prev" data-peek-ok><span class="hx-player-label"></span></button>
1525
- <button type="button" class="hx-btn hx-btn--active hx-player-toggle" data-action="scenario-toggle" data-peek-ok data-corn-kind="primary"><span class="hx-player-label"></span></button>
1526
- <button data-corn-kind="secondary" type="button" class="hx-btn hx-player-next" data-action="scenario-next" data-peek-ok><span class="hx-player-label"></span></button>
1527
- <button data-corn-kind="secondary" type="button" class="hx-btn hx-player-next-scenario" data-action="scenario-next-scenario" data-peek-ok hidden></button>
1528
- </div>
1529
- <p class="hx-player-text"><span class="hx-player-count" data-corn="count"></span><span class="hx-player-sep" aria-hidden="true"> · </span><span class="hx-player-who"></span><span class="hx-player-step"></span></p>
1530
- <span class="hx-player-says hx-sr-only" role="status" aria-live="polite"></span>
1531
- <div class="hx-player-side">
1532
- <select data-corn="control" class="hx-player-speed" data-action="scenario-speed" aria-label="Time for each step" title="Time for each step">${zt.map((e) => `<option value="${l(String(e.value))}">${l(e.label)}</option>`).join("")}</select>
1533
- <button type="button" class="hx-close" data-action="scenario-close" aria-label="Close the scenario" data-corn-kind="icon">✕</button>
1534
- </div>
1535
- <div class="hx-player-track" data-corn="scenario-track" aria-hidden="true"><span class="hx-player-fill" data-corn="scenario-fill"></span></div>`, g(a), a.querySelector(".hx-player-controls").setAttribute("aria-label", D(e, "steps")), a.querySelector(".hx-player-prev .hx-player-label").textContent = D(e, "previousStep"), a.querySelector(".hx-player-next .hx-player-label").textContent = D(e, "nextStep"), a.querySelector(".hx-player-next-scenario").textContent = D(e, "nextScenario");
1536
- let o = (e) => {
1537
- let t = e.target.closest("[data-action]");
1538
- t && W(t.dataset.action);
1539
- }, s = a.querySelector(".hx-player-speed"), f = (e) => U(e.target.value), p = a;
1540
- p.addEventListener("click", o), s.value = String(t), s.addEventListener("change", f), b.push(() => {
1541
- p.removeEventListener("click", o), s.removeEventListener("change", f);
1542
- });
1543
- let m = e.el("sheet-dock"), h = e.el("spec-drawer");
1544
- m && h && h.parentElement === m ? m.insertBefore(a, h) : (m || n).appendChild(a), xe(e, "player", a), ke(e);
1545
- let _ = e.win && e.win.ResizeObserver;
1546
- typeof _ == "function" && (d = new _(() => {
1547
- a && i && r.scenario && !c && a.offsetHeight !== u && L(i.snapshot());
1548
- }), d.observe(a));
1549
- }
1550
- let H = () => Bt(e.store.get(Rt));
1551
- function U(t) {
1552
- let n = Bt(t);
1553
- e.store.set(Rt, String(n)), i && (i.setSpeed(n), I(), C(), e.map.ensureFlowLoop());
1554
- }
1555
- function W(t) {
1556
- if (i) {
1557
- if (t === "scenario-close") return F();
1558
- if (t === "scenario-next-scenario") {
1559
- let e = _ ? _(i.scenario().id) : null;
1560
- e && j(e);
1561
- } else {
1562
- if (t === "scenario-toggle") {
1563
- let t = i.snapshot();
1564
- t.playing ? i.pause() : i.play(), N(e, t.playing ? "Paused" : t.done ? "Playing again" : t.index > 0 || t.progress > 0 ? "Resumed" : "Playing");
1565
- } else if (t === "scenario-prev") i.prev();
1566
- else if (t === "scenario-next") i.next();
1567
- else return;
1568
- I(), C(), e.map.ensureFlowLoop();
1569
- }
1570
- }
1571
- }
1572
- function G(t) {
1573
- if (!a) return;
1574
- let i = (e) => a.querySelector(e), o = (e, t) => {
1575
- let n = i(e);
1576
- n.textContent !== t && (n.textContent = t);
1577
- };
1578
- o(".hx-player-title", t.title), a.setAttribute("aria-label", `Scenario player: ${t.title}`), o(".hx-player-count", `${Math.min(t.index + 1, Math.max(t.total, 1))} of ${t.total}`);
1579
- let s = t.current.actor ? Ct(xt(r.nodes, t.current.actor)) || t.current.actor : "";
1580
- o(".hx-player-who", s && !t.done ? `As ${s} · ` : ""), o(".hx-player-step", t.done ? "Played to the end" : t.current.text), a.dataset.done = String(!!t.done);
1581
- let c = i("[data-action=scenario-toggle]");
1582
- o("[data-action=scenario-toggle] .hx-player-label", t.playing ? D(e, "pause") : t.done ? D(e, "playAgain") : D(e, "play")), c.dataset.state = t.playing ? "playing" : t.done ? "done" : "paused", c.disabled = t.total === 0 || t.manual, c.title = t.manual ? "The time for each step is Manual: use Next" : "", i("[data-action=scenario-prev]").disabled = t.index === 0 && !t.done;
1583
- let l = i("[data-action=scenario-next]");
1584
- l.disabled = t.done || t.total === 0;
1585
- let u = t.done && _ ? _(t.id) : null;
1586
- i("[data-action=scenario-next-scenario]").hidden = !u, l.hidden = !!u, o(".hx-player-says", t.done ? `${t.title}: played to the end.` : ln({
1587
- snap: t,
1588
- nodes: r.nodes,
1589
- edges: r.edges,
1590
- words: { notChecked: D(e, "notChecked") }
1591
- }));
1592
- let d = t.total ? Math.round((t.done ? t.total : t.index + t.progress) / t.total * 1e3) / 10 : 0;
1593
- d !== f && (f = d, i(".hx-player-fill").style.width = `${d}%`), n.paint(a, t);
1594
- }
1595
- function K() {
1596
- return !!e.root.querySelector("#legend-dropdown:not([hidden]), #proposal-more-menu:not([hidden]), [data-corn=\"dialog-scrim\"]:not([hidden]), .hx-mockup-dialog");
1597
- }
1598
- t.listen(e.root, "keydown", (e) => {
1599
- if (e.key === "Escape" && !e.defaultPrevented && !e.ctrlKey && !e.metaKey && !e.altKey && i && !Sn(e.target) && !K()) {
1600
- e.preventDefault(), F();
1601
- return;
1602
- }
1603
- if (!i || e.defaultPrevented || e.ctrlKey || e.metaKey || e.altKey || Sn(e.target) || (e.key === " " || e.code === "Space") && e.target.closest?.("#review-column")) return;
1604
- let t = e.key === " " || e.code === "Space" ? "scenario-toggle" : e.key === "ArrowLeft" ? "scenario-prev" : e.key === "ArrowRight" ? "scenario-next" : null;
1605
- t && (e.preventDefault(), W(t));
1606
- }), t.listen(e.root, "keyup", (e) => {
1607
- i && (e.key === " " || e.code === "Space") && !Sn(e.target) && e.preventDefault();
1608
- }), t.own(Ee(e, () => {
1609
- i && r.scenario && L(i.snapshot());
1610
- }));
1611
- for (let n of [
1612
- "pointerdown",
1613
- "wheel",
1614
- "touchstart",
1615
- "mousedown"
1616
- ]) t.listen(e.root, n, (e) => {
1617
- e.target === r.canvas && (s = null, c = !0);
1618
- }, {
1619
- passive: !0,
1620
- capture: !0
1621
- });
1622
- return t.on("scenario:clear", () => P()), t.own(() => {
1623
- P({ keepChecks: !1 }), y.clear();
1624
- }), {
1625
- play: j,
1626
- stop: F,
1627
- clear: P,
1628
- tick: B,
1629
- playOutage: ee,
1630
- getPlayer: () => i,
1631
- bar: () => a,
1632
- wantsFrames: z,
1633
- onChange(e) {
1634
- return y.add(e), () => y.delete(e);
1635
- },
1636
- setCloseFocus(e) {
1637
- m = typeof e == "function" ? e : null;
1638
- },
1639
- setNextScenario(e) {
1640
- _ = typeof e == "function" ? e : null;
1641
- },
1642
- setKeepChecksOnClose(e) {
1643
- h = typeof e == "function" ? e : null;
1644
- },
1645
- demo(e = !0) {
1646
- if (!e) return !1;
1647
- let t = Cn(r.nodes, r.edges);
1648
- return t ? (j(t), !0) : (console.warn("scenario-demo: the map has none of the nodes the demo walks over"), !1);
1649
- }
1650
- };
1651
- }
1652
- // ../explorer/pieces/changes.js
1653
- var Tn = "cornfield.reviewTab", En = 1360, Dn = () => ({ column: "<aside id=\"review-column\" class=\"hx-review-column glass\" aria-label=\"Review\" data-corn=\"review-column\" hidden><div class=\"hx-rc-scroll\"><p id=\"proposal-summary\" class=\"hx-proposal-summary\" hidden></p><div id=\"review-lists\" class=\"hx-rc-lists\"></div></div><!--corn-piece:decision/foot--></aside>" }), On = (e, t) => `${l(e)}<span aria-hidden="true"> · </span><span class="hx-sr-only">, </span><span data-corn="count">${t}</span>`;
1654
- function kn(e) {
1655
- let t = `${e.word} ${e.name}, ${e.type}`;
1656
- return `<li><button type="button" class="hx-change-row" data-action="proposal-focus" data-kind="${e.kind}" data-key="${l(e.key)}" data-focus-key="ch:${l(e.kind)}:${l(e.key)}" data-corn="row" aria-label="${l(t)}"><span class="hx-mark-dot hx-mark-dot--${e.mark}" data-corn="mark-dot"${U(e.mark)} aria-hidden="true"></span><span class="hx-change-what">${l(e.word)}</span><span class="hx-name">${l(e.name)}</span><span class="hx-faint">${l(e.type)}</span></button></li>`;
1657
- }
1658
- function An(e, t, n = {}) {
1659
- let { state: r } = t, i = a(t), s = o(t, e, Dn().column, n.slots, "column"), c = (e) => {
1660
- for (let t of s) {
1661
- if (t.id === e) return t;
1662
- let n = t.querySelector(`[id="${e}"]`);
1663
- if (n) return n;
1664
- }
1665
- return null;
1666
- };
1667
- i.keepParts(...s);
1668
- let u = c("review-column"), d = !1, f = It(t, { checker: n.checker }), p = wn(t, i, f);
1669
- i.own(() => f.close());
1670
- let m = {
1671
- checks: 0,
1672
- open: null,
1673
- tab: null,
1674
- tabNow: null,
1675
- tabFor: "",
1676
- openFor: "",
1677
- head: "",
1678
- headFor: "",
1679
- current: null,
1680
- lastStep: null,
1681
- seen: {
1682
- played: [],
1683
- read: []
1684
- },
1685
- seenFor: "",
1686
- pending: []
1687
- }, h = {
1688
- getItem: (e) => t.store.get(e),
1689
- setItem: (e, n) => t.store.set(e, n)
1690
- }, _ = t.store.get(Tn);
1691
- (_ === "changes" || _ === "scenarios") && (m.tab = _);
1692
- let v = () => {
1693
- let e = r.effectiveProposal || r.proposal;
1694
- return e && Array.isArray(e.scenarios) ? e.scenarios : [];
1695
- }, y = () => `${r.proposalSource || ""}/${r.proposalSlug || ""}`;
1696
- function b() {
1697
- return W(r.proposalSource) ? m.headFor === y() && m.head ? mn(r.proposalSource, r.proposalSlug, m.head) : null : mn(r.proposalSource, r.proposalSlug, "");
1698
- }
1699
- function x() {
1700
- let e = b(), t = e || `pending:${y()}`;
1701
- if (m.seenFor === t) return;
1702
- let n = m.seenFor;
1703
- if (m.seenFor = t, !e) m.seen = {
1704
- played: [],
1705
- read: []
1706
- }, m.pending = [];
1707
- else {
1708
- if (m.seen = hn(h, e), n === `pending:${y()}`) for (let [t, n] of m.pending) m.seen = gn(h, e, t, n);
1709
- m.pending = [];
1710
- }
1711
- }
1712
- function C(e, t) {
1713
- x(), m.seenFor.startsWith("pending:") ? (m.pending.push([String(e), t]), m.seen = gn(null, "", e, t, m.seen)) : m.seen = gn(h, m.seenFor, e, t);
1714
- }
1715
- function w(e) {
1716
- let t = typeof e == "string" ? e : "";
1717
- (t !== m.head || m.headFor !== y()) && (m.head = t, m.headFor = y(), r.proposal && R());
1718
- }
1719
- function T() {
1720
- x();
1721
- let e = /* @__PURE__ */ new Map(), n = f.checkedScenarioId();
1722
- n !== null && e.set(n, f.verdicts());
1723
- let i = r.effectiveProposal || r.proposal, a = { notChecked: D(t, "notChecked") }, o = new Map(r.nodes.map((e) => [e.id, e]));
1724
- return dn({
1725
- scenarios: v(),
1726
- nodes: r.nodes,
1727
- edges: r.edges,
1728
- proposal: i,
1729
- verdicts: e,
1730
- seen: m.seen,
1731
- words: a,
1732
- hidden: (e) => o.has(e) && yn(t, o.get(e)).length > 0
1733
- });
1734
- }
1735
- let E = (e) => rn(r.nodes, r.edges, e).filter((e) => e.mark !== "edit");
1736
- function O(e) {
1737
- let t = r.effectiveProposal || r.proposal;
1738
- return pn(e, E(t).length, T());
1739
- }
1740
- function k() {
1741
- let e = r.effectiveProposal || r.proposal;
1742
- return fn(E(e).length, T());
1743
- }
1744
- function A(e, t, n, r) {
1745
- let i = m.current && m.current.index === e.index && m.current.step === t.index && m.current.id === e.id, a = t.verdict ? `<span class="hx-step-verdict" data-corn="state-pill" data-tone="${l(t.verdict.tone)}"${t.verdict.state ? ` data-corn-state="${t.verdict.state}"` : ""}>${l(t.verdict.words)}</span>` : "", o = t.mark ? `<span class="hx-step-mark"><span class="hx-mark-dot hx-mark-dot--${t.mark}" data-corn="mark-dot"${U(t.mark)} aria-hidden="true"></span>${l(t.markWord)}</span>` : "", s = t.actorLabel ? `<span class="hx-step-who">As ${l(t.actorLabel)}</span>` : "";
1746
- return `<li><button type="button" class="hx-step" data-corn="step" data-action="scenario-step" data-scenario-index="${e.index}" data-step-index="${t.index}" data-focus-key="st:${n.key}:${e.key}:${t.index}" aria-label="${l(cn(t, r))}"${i ? " aria-current=\"step\"" : ""}><span class="hx-step-n" aria-hidden="true">${t.number}</span><span class="hx-step-body"><span class="hx-step-line">${s}<span class="hx-step-where">${l(t.where)}</span>${o}${t.layerOff ? "<span class=\"hx-step-off\">Layer off: shown when played</span>" : ""}</span><span class="hx-step-text">${l(t.text)}</span></span>${a}</button></li>`;
1747
- }
1748
- function M(e, n) {
1749
- let r = m.open === e.id, i = `rc-steps-${n.key}-${e.key}`, a = e.seen ? `<span class="hx-sc-seen" data-seen="${e.seen}">${e.seen === "played" ? "✓ Played" : "✓ Read"}</span>` : "", o = e.verdictSummary ? ` · ${l(e.verdictSummary)}` : "", s = r && B(e.id) && e.steps.some((e) => e.actor) ? "<p class=\"hx-faint hx-rc-note hx-sc-waits\" data-corn=\"notice\">Not checked while another scenario plays. Close the player, or choose a step here to play this one.</p>" : "";
1750
- return `<li class="hx-sc" data-open="${r}"><button type="button" class="hx-sc-row" data-corn="row" data-action="scenario-open" data-scenario-index="${e.index}" data-focus-key="sc:${n.key}:${e.key}" aria-expanded="${r}" aria-controls="${i}"><span class="hx-sc-caret" aria-hidden="true">${r ? "▾" : "▸"}</span><span class="hx-sc-main"><span class="hx-sc-title">${l(e.title)}</span><span class="hx-sc-meta">${l(e.summary)}${o}</span></span>${a}</button>${s}<ol class="hx-steps" id="${i}" data-corn="step-list" aria-label="${l(D(t, "steps"))}: ${l(e.title)}"${r ? "" : " hidden"}>${r ? e.steps.map((t) => A(e, t, n, e.steps.length)).join("") : ""}</ol></li>`;
1751
- }
1752
- function N(e) {
1753
- let n = e.scenarios.length, r = e.anyone ? D(t, "anyone") : e.label, i = `${l(r)}<span aria-hidden="true"> · </span><span class="hx-sr-only">, </span>${n} ${n === 1 ? "scenario" : "scenarios"}`;
1754
- return `<div class="hx-persona" data-corn="persona-group" data-persona="${l(e.key)}"><h4 class="hx-persona-name">${i}</h4><ul class="hx-sc-list">${e.scenarios.map((t) => M(t, e)).join("")}</ul></div>`;
1755
- }
1756
- function ee() {
1757
- let e = r.effectiveProposal || r.proposal, n = rn(r.nodes, r.edges, e), i = n.filter((e) => e.mark !== "edit"), a = n.filter((e) => e.mark === "edit"), o = T(), s = S(t);
1758
- m.tabFor !== y() && (m.tabFor = y(), m.tabNow = o.total ? m.tab || "scenarios" : "changes");
1759
- let c = m.tabNow || "changes", u = r.nodes.some((e) => e.type === "persona"), d = `<div class="hx-rc-tabs" role="tablist" aria-label="Review" data-corn="tabs"${s ? "" : " hidden"}><button type="button" role="tab" id="rc-tab-changes" class="hx-rc-tab" data-corn="tab" data-action="review-tab" data-tab="changes" aria-selected="${c === "changes"}" aria-controls="rc-changes" tabindex="${c === "changes" ? 0 : -1}">${l(D(t, "changes"))} · ${i.length}</button><button type="button" role="tab" id="rc-tab-scenarios" class="hx-rc-tab" data-corn="tab" data-action="review-tab" data-tab="scenarios" aria-selected="${c === "scenarios"}" aria-controls="rc-scenarios" tabindex="${c === "scenarios" ? 0 : -1}">${l(D(t, "scenarios"))} · ${o.total}</button></div>`, f = `<section id="rc-changes" class="hx-rc-section" data-corn="proposal-changes"${s ? ` role="tabpanel" aria-labelledby="rc-tab-changes"${c === "changes" ? "" : " hidden"}` : " aria-labelledby=\"rc-changes-h\""}><h3 id="rc-changes-h" class="hx-rc-h" tabindex="-1">${On(D(t, "changes"), i.length)}</h3>` + (a.length ? `<h4 class="hx-rc-sub">${On(D(t, "yourEdits"), a.length)}</h4><ul class="hx-change-list">${a.map(kn).join("")}</ul>` : "") + (i.length ? `<ul class="hx-change-list">${i.map(kn).join("")}</ul>` : "<p class=\"hx-faint hx-rc-empty\">This proposal changes nothing on the map.</p>") + "</section>", p;
1760
- return o.total ? (p = o.groups.map(N).join(""), u || (p += `<p class="hx-faint hx-rc-note">This map has no personas (topology.personas.json), so every scenario is listed under ${l(D(t, "anyone"))}.</p>`), o.coverage && (p += `<p class="hx-rc-coverage" data-corn="notice">${l(D(t, "notInAnyScenario"))}: ${o.notInAny.map(l).join(", ")}</p>`)) : p = "<p class=\"hx-faint hx-rc-empty\">This proposal has no scenarios: there is nothing to walk through, and its changes are all it shows.</p>", `${d}${f}${`<section id="rc-scenarios" class="hx-rc-section" data-corn="scenario-list"${s ? ` role="tabpanel" aria-labelledby="rc-tab-scenarios"${c === "scenarios" ? "" : " hidden"}` : " aria-labelledby=\"rc-scenarios-h\""}><h3 id="rc-scenarios-h" class="hx-rc-h" tabindex="-1">${On(D(t, "personasAndScenarios"), o.total)}</h3><div class="hx-rc-sbody">${p}</div></section>`}`;
1761
- }
1762
- function P() {
1763
- let e = t.el("sheet-dock"), n = t.el("proposal-body");
1764
- if (S(t) && n) u.parentElement !== n && n.appendChild(u);
1765
- else if (e) {
1766
- let n = t.el("proposal-bar");
1767
- n && u.parentElement !== e && n.after(u);
1768
- }
1769
- return u;
1770
- }
1771
- function F() {
1772
- let e = t.el("proposal-bar");
1773
- !e || S(t) || e.hidden || u.style.setProperty("--hx-column-top", `${Math.round(e.offsetTop + e.offsetHeight + 8)}px`);
1774
- }
1775
- function I() {
1776
- if (d) return;
1777
- P();
1778
- let e = !!r.proposal;
1779
- if (u.hidden = !e, !e) {
1780
- m.open = null, m.current = null, m.lastStep = null, V();
1781
- let e = c("review-lists");
1782
- e && (e.innerHTML = "");
1783
- } else R(), F();
1784
- }
1785
- function L() {
1786
- let e = c("review-lists"), n = c("rc-scenarios");
1787
- if (!e || !n || u.hidden || S(t)) return;
1788
- let r = e.clientHeight;
1789
- if (!r) return;
1790
- let i = parseFloat(t.win.getComputedStyle(e).rowGap) || 0, a = n.querySelector(".hx-rc-h"), o = n.querySelector(".hx-rc-sbody"), s = Math.ceil((a ? a.offsetHeight + (parseFloat(t.win.getComputedStyle(a).marginBottom) || 0) : 0) + (o ? o.scrollHeight : 0));
1791
- u.style.setProperty("--hx-scenarios-need", `${s}px`), u.style.setProperty("--hx-changes-max", `${Math.floor(Math.max(.4 * r, r - s - i))}px`);
1792
- }
1793
- function R() {
1794
- let e = c("review-lists");
1795
- if (d || !e || !r.proposal) return;
1796
- m.openFor !== y() && (m.openFor = y(), p.getPlayer() || (m.open = null, m.current = null, m.lastStep = null)), m.open !== null && !v().some((e) => e.id === m.open) && (m.open = null);
1797
- let n = m.open !== null && !p.getPlayer() ? v().find((e) => e.id === m.open) : null;
1798
- n && f.checkedScenarioId() === n.id && f.open(n, () => R());
1799
- let i = t.active(), a = i && e.contains(i) && i.getAttribute ? i.getAttribute("data-focus-key") : null, o = e.scrollTop;
1800
- e.innerHTML = ee(), g(e);
1801
- let s = r.proposal, l = c("proposal-summary");
1802
- if (l.textContent = s && typeof s.summary == "string" && s.summary || "", l.hidden = !l.textContent, e.scrollTop = o, t.emit("changes:peek", k()), a) {
1803
- let t = [...e.querySelectorAll("[data-focus-key]")].find((e) => e.getAttribute("data-focus-key") === a);
1804
- t && t.focus();
1805
- }
1806
- L(), t.emit("changes:paint");
1807
- }
1808
- let z = (e) => v()[Number(e.dataset.scenarioIndex)] || null, B = (e) => {
1809
- let t = p.getPlayer();
1810
- return !!t && t.scenario().id !== e;
1811
- };
1812
- function V() {
1813
- p.getPlayer() || f.close();
1814
- }
1815
- function H(e) {
1816
- m.open === e.id ? (m.open = null, p.getPlayer() || f.close()) : (m.open = e.id, C(e.id, "read"), B(e.id) || f.open(e, () => R())), R();
1817
- }
1818
- function G(e, n) {
1819
- m.open = e.id;
1820
- let i = t.el("spec-drawer"), a = r.canvas && r.canvas.parentElement;
1821
- !S(t) && i && i.classList.contains("drawer-open") && a && a.clientWidth < En && j(t, { source: "api" }), p.play(e, {
1822
- autoplay: !1,
1823
- step: n,
1824
- focus: S(t)
1825
- }), R();
1826
- }
1827
- function K(e, { focus: n = !1 } = {}) {
1828
- m.tab = e, m.tabNow = e, m.tabFor = y(), t.store.set(Tn, e), R(), n && c(`rc-tab-${e}`)?.focus();
1829
- }
1830
- function q(e) {
1831
- if (!r.proposal) return;
1832
- S(t) && (K(e), De(t, "proposal"));
1833
- let n = c(e === "scenarios" ? "rc-scenarios" : "rc-changes"), i = c(e === "scenarios" ? "rc-scenarios-h" : "rc-changes-h");
1834
- n && typeof n.scrollIntoView == "function" && n.scrollIntoView({ block: "start" }), i && i.focus();
1835
- }
1836
- i.listen(u, "click", (e) => {
1837
- let n = e.target.closest ? e.target.closest("[data-action]") : null;
1838
- if (!n) return;
1839
- let r = n.dataset.action;
1840
- if (r === "scenario-open") {
1841
- let e = z(n);
1842
- e && H(e);
1843
- } else if (r === "scenario-step") {
1844
- let e = z(n);
1845
- e && G(e, Number(n.dataset.stepIndex));
1846
- } else r === "review-tab" ? K(n.dataset.tab, { focus: !1 }) : r === "proposal-focus" && st(t, n.dataset.kind, n.dataset.key);
1847
- }), i.listen(u, "keydown", (e) => {
1848
- let t = e.target.closest ? e.target.closest("[role=\"tab\"]") : null;
1849
- t && [
1850
- "ArrowLeft",
1851
- "ArrowRight",
1852
- "Home",
1853
- "End"
1854
- ].includes(e.key) && (e.preventDefault(), K(t.dataset.tab === "changes" ? "scenarios" : "changes", { focus: !0 }));
1855
- });
1856
- function te(e) {
1857
- if (!e) {
1858
- let e = m.open !== null && r.proposal && m.openFor === y() ? v().find((e) => e.id === m.open) : null;
1859
- e && f.open(e, () => R()), (m.current || e) && (m.current = null, R());
1860
- return;
1861
- }
1862
- let t = v().findIndex((t) => t.id === e.id), n = {
1863
- id: e.id,
1864
- index: t,
1865
- step: Math.min(e.index, Math.max(e.total - 1, 0))
1866
- };
1867
- m.lastStep = n, e.done && (x(), m.seen.played.includes(e.id) || C(e.id, "played"));
1868
- let i = m.current && m.current.id === n.id && m.current.step === n.step;
1869
- m.current = n, m.open !== e.id && (m.open = e.id), (!i || e.done || e.checks !== m.checks) && (m.checks = e.checks, R());
1870
- }
1871
- function J() {
1872
- let e = m.lastStep;
1873
- if (!e) return null;
1874
- S(t) && De(t, "proposal");
1875
- let n = c("review-lists");
1876
- return n ? n.querySelector(`[data-action="scenario-step"][data-scenario-index="${e.index}"][data-step-index="${e.step}"]`) : null;
1877
- }
1878
- function ne(e) {
1879
- let t = [];
1880
- for (let e of T().groups) for (let n of e.scenarios) t.includes(n.id) || t.push(n.id);
1881
- let n = t.indexOf(e), r = n >= 0 ? t[n + 1] : void 0;
1882
- return r === void 0 ? null : v().find((e) => String(e.id) === r) || null;
1883
- }
1884
- i.own(p.onChange(te)), p.setCloseFocus(J), p.setNextScenario(ne), p.setKeepChecksOnClose((e) => m.open === e && !!r.proposal), i.own(Ae(t, () => {
1885
- r.proposal && R();
1886
- })), i.on("proposal:draw", () => I()), i.on("proposal:pull-head", (e) => w(e)), i.on("changes:show", (e) => q(e));
1887
- let re = t.win && t.win.ResizeObserver, ie = (e, t) => {
1888
- if (e && typeof re == "function") {
1889
- let n = new re(t);
1890
- n.observe(e), i.own(() => n.disconnect());
1891
- }
1892
- };
1893
- return ie(t.el("proposal-bar"), () => F()), ie(u, () => L()), i.own(Oe(t, () => {
1894
- r.proposal && I();
1895
- })), i.own(() => {
1896
- d = !0, s.forEach((e) => e.remove());
1897
- }), I(), i.on("changes:opened-line", (e) => r.proposal ? O(e) : void 0), i.on("changes:played-line", () => r.proposal ? T().playedLine : ""), {
1898
- elements: s,
1899
- playScenario: p.play,
1900
- stopScenario: p.stop,
1901
- clearScenario: p.clear,
1902
- playOutage: p.playOutage,
1903
- getPlayer: p.getPlayer,
1904
- wantsFrames: p.wantsFrames,
1905
- setCloseFocus: p.setCloseFocus,
1906
- setNextScenario: p.setNextScenario,
1907
- setKeepChecksOnClose: p.setKeepChecksOnClose,
1908
- tickScenario: p.tick,
1909
- demo: p.demo,
1910
- layersHiding: (e) => yn(t, e),
1911
- checks: f,
1912
- renderColumn: I,
1913
- shareRoom: L,
1914
- setPullHead: w,
1915
- openedLine: O,
1916
- peekLine: k,
1917
- update(e) {
1918
- e && "checker" in e && f.setChecker(e.checker), r.proposal && R();
1919
- },
1920
- destroy: () => i.destroy()
1921
- };
1922
- }
1923
- // ../explorer/decision-model.js
1924
- var jn = 5e3, Mn = 3, Nn = 40, Pn = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Fn = (e) => String(e).replace(/\s+/g, " ").trim(), In = (e) => {
1925
- let t = Fn(e);
1926
- return t.length > Nn ? `${t.slice(0, 39)}…` : t;
1927
- };
1928
- function Ln(e) {
1929
- let t = e.slice(0, Mn).map(In), n = e.length - t.length;
1930
- return n > 0 ? `${t.join(", ")} and ${n} more` : t.length < 2 ? t.join("") : `${t.slice(0, -1).join(", ")} and ${t[t.length - 1]}`;
1931
- }
1932
- var Rn = (e) => e && e.checks && Array.isArray(e.checks.failed) ? e.checks.failed : [], zn = (e) => e && e.checks && e.checks.running || 0, Bn = (e) => `${Ln(e)} failed`;
1933
- function Vn(e, t) {
1934
- if (!e) return "";
1935
- let n = [
1936
- "code",
1937
- "summary",
1938
- "brief",
1939
- "proposal"
1940
- ].includes(e.kind) ? e.kind : "code", r = n === "code" ? "a code run" : `a ${n} run`;
1941
- if (e.open) return `No new run is asked for: ${typeof e.open == "string" ? `run ${Fn(e.open).slice(0, 40)} is` : "one is"} still open on it.`;
1942
- if (e.fired) return `No new run is asked for: ${r} was asked for at this head already.`;
1943
- let i = `Then ${r} is asked for.`;
1944
- if (e.transport !== "pull") return `${i} The request is posted for your runner.`;
1945
- if (e.runner === "online") return `${i} A runner is online.`;
1946
- let a = typeof e.lastSeen == "string" ? Date.parse(e.lastSeen) : NaN;
1947
- return e.runner === "quiet" && Number.isFinite(a) ? `${i} No runner has polled for ${q(t - a)}: the run will wait.` : `${i} No runner has polled yet: the run will wait.`;
1948
- }
1949
- var Hn = (e) => e > 0 ? `Your ${Pn(e, "edit")} ${e === 1 ? "goes" : "go"} in the comment, for the agent to fold in.` : "";
1950
- function Un(e) {
1951
- let t = e.pull.number, n = !!e.lands;
1952
- if (e.pull.draft) return n ? `PR #${t} is a draft. Approve posts an approval; it lands only if the PR is marked ready within 60 minutes.` : `PR #${t} is a draft. Approve posts an approval on it.`;
1953
- let r = `Approve posts an approval on PR #${t}.`, i = e.checks, a = Rn(e), o = zn(e);
1954
- return a.length ? n ? `${r} It will not land: ${Bn(a)}.` : `${r} ${Bn(a)}.` : i && i.total === 0 ? n ? `${r} It will not land: the PR has no checks.` : `${r} It does not land it.` : o ? n ? `${r} It lands once ${o === 1 ? "1 running check passes" : `${o} running checks pass`}.` : `${r} ${o === 1 ? "1 check is" : `${o} checks are`} still running.` : i && !i.passed ? n ? `${r} It will not land: no check has passed.` : `${r} It does not land it.` : n ? `Approve posts an approval on PR #${t} and lands it.` : `${r} It does not land it.`;
1955
- }
1956
- function Wn(e, t) {
1957
- return `An approval of this version of PR #${e} stands.${t && t.landing ? " Its landing waits for the checks." : ""} A push makes Approve live again.`;
1958
- }
1959
- function Gn({ facts: e, edits: t = 0, form: n = null }) {
1960
- let r = [];
1961
- if (e && e.pull) {
1962
- let t = Rn(e);
1963
- t.length && r.push({
1964
- key: "failed",
1965
- text: `${Bn(t)} on PR #${e.pull.number}.`
1966
- }), e.pull.draft && r.push({
1967
- key: "draft",
1968
- text: `PR #${e.pull.number} is a draft: its author has not marked it ready.`
1969
- });
1970
- }
1971
- return n && r.push({
1972
- key: "form",
1973
- text: `Your ${Fn(n.name)} form is not added.`
1974
- }), e && e.pull && e.lands && t > 0 && r.push({
1975
- key: "edits",
1976
- text: `PR #${e.pull.number} lands as written; your ${Pn(t, "edit")} only go${t === 1 ? "es" : ""} in the comment.`
1977
- }), r;
1978
- }
1979
- function Kn(e, t = "Approve") {
1980
- if (!e.length) return "";
1981
- let n = e.length === 1 ? e[0] : null, r = n && n.key === "form" ? `${t} without it?` : `${t} anyway?`;
1982
- return `${e.map((e) => e.text).join(" ")} ${r}`;
1983
- }
1984
- var qn = (e, t) => e.filter((e) => !t.includes(e.key)), Jn = "Shown to read only: there is no cornfield server here to send an approval or a send back to.";
1985
- function Yn({ source: e, facts: t, factsState: n, review: r = null, edits: i = 0, form: a = null, played: o = "", now: s = Date.now() }) {
1986
- let c = W(e), l = (...e) => e.filter(Boolean).join(" ");
1987
- if (!c) return {
1988
- line: `Draft in ${!e || e === "checkout" ? "the checkout" : `worktree ${Fn(e)}`}: push it as a spec PR to review it here.`,
1989
- approve: "refused",
1990
- reasons: [],
1991
- ask: ""
1992
- };
1993
- let u = !!r && r.verdict === "approved" && r.current === !0;
1994
- if (n === "loading" || !t && n !== "unread") return {
1995
- line: l(`Reading PR #${c} …`, o),
1996
- approve: u ? "done" : "reading",
1997
- reasons: [],
1998
- ask: ""
1999
- };
2000
- if (!t || n === "unread") return {
2001
- line: l(`Could not read PR #${c}'s checks. Approve posts an approval on it.`, Hn(i), o),
2002
- approve: u ? "done" : "allowed",
2003
- reasons: Gn({
2004
- facts: null,
2005
- edits: i,
2006
- form: a
2007
- }),
2008
- ask: ""
2009
- };
2010
- let d = Gn({
2011
- facts: t,
2012
- edits: i,
2013
- form: a
2014
- }), f = t.run ? Vn(t.run, s) : "", p = l(Un(t), f, Hn(i), o);
2015
- return u ? {
2016
- line: l(Wn(c, t), o),
2017
- approve: "done",
2018
- reasons: d,
2019
- ask: ""
2020
- } : {
2021
- line: p,
2022
- approve: d.length ? "asks" : "allowed",
2023
- reasons: d,
2024
- ask: Kn(d)
2025
- };
2026
- }
2027
- function Xn({ source: e, edits: t = 0 }) {
2028
- let n = W(e);
2029
- return n ? `Posts ${t > 0 ? `your note and ${Pn(t, "edit")}` : "your note"} on PR #${n} for the drafting agent. No run is asked for.` : "";
2030
- }
2031
- function Zn({ form: e = null }) {
2032
- let t = Gn({
2033
- facts: null,
2034
- edits: 0,
2035
- form: e
2036
- });
2037
- return {
2038
- asks: t.length > 0,
2039
- reasons: t,
2040
- ask: Kn(t, "Send back")
2041
- };
2042
- }
2043
- function Qn(e, t = "") {
2044
- if (e === 401) return "Your sign-in has ended. Sign in again: your edits are kept here.";
2045
- let n = Fn(t);
2046
- return e === 403 || e === 409 ? n || "The review was not posted." : `The review was not posted. ${n || `The server answered ${e}.`}`;
2047
- }
2048
- var $n = (e, t) => `${e === "approved" ? "Approving" : "Sending back"} in ${Math.max(0, Math.ceil(t))} s`, er = (e, t) => `${e === "approved" ? "Approving" : "Sending back"} in ${Pn(Math.ceil(t), "second")}. Undo to stop it; nothing has been sent.`;
2049
- function tr(e, t) {
2050
- let n = e === "approved" ? "The approval" : "The send back";
2051
- return `${{
2052
- undo: `${n} was undone.`,
2053
- escape: `${n} was undone.`,
2054
- closed: `${n} was stopped: the proposal was closed.`,
2055
- other: `${n} was stopped: another proposal was opened.`,
2056
- hidden: `${n} was stopped: this tab was hidden.`,
2057
- offline: `${n} was stopped: you are offline.`,
2058
- edits: `${n} was stopped: your edits changed.`,
2059
- pushed: `${n} was stopped: the PR was pushed to while it was held, so it is not what you looked at. Look again before you decide.`
2060
- }[t] || `${n} was stopped.`} Nothing was sent.`;
2061
- }
2062
- var nr = (e) => `Sent with ${Pn(e, "edit")}`, rr = 3e4, ir = 3e4, ar = "cornfield.reviewNote.", or = () => ({ foot: "<div id=\"review-decision\" class=\"hx-rc-foot\" data-corn=\"decision\" role=\"group\" aria-label=\"Decision\"><div id=\"review\" class=\"hx-review\" data-corn=\"review-bar\"><p class=\"hx-review-status\" data-review-status hidden><span data-review-verdict role=\"status\"></span><span data-review-when></span></p><div class=\"hx-review-form\" id=\"review-form\" data-review-form hidden><label class=\"hx-review-label\" for=\"review-note\" data-corn=\"review-label\"></label><textarea data-corn=\"review-note\" id=\"review-note\" class=\"hx-review-note\" rows=\"2\" maxlength=\"20000\"></textarea><p class=\"hx-review-line\" id=\"review-sendback-line\" data-review-sendback-line></p><div class=\"hx-review-row\"><button type=\"button\" class=\"hx-btn hx-btn--quiet\" data-review-cancel data-corn-kind=\"quiet\">Cancel</button></div></div><p class=\"hx-review-msg\" data-review-loadfail role=\"alert\" hidden data-corn=\"message\" data-corn-state=\"failure\"><span data-review-loadfail-text></span> <button type=\"button\" class=\"hx-btn hx-btn--quiet\" data-review-retry data-corn-kind=\"quiet\">Retry</button></p><p class=\"hx-review-msg\" data-review-msg role=\"alert\" hidden></p><p class=\"hx-review-line\" id=\"review-hint\" data-review-hint role=\"status\" hidden></p><details class=\"hx-sent-edits\" data-corn=\"sent-edits\" data-review-sent hidden><summary data-corn=\"summary\" data-review-sent-summary></summary><ul class=\"hx-whatif-list\" data-review-sent-list></ul></details><div class=\"hx-review-landing\" data-corn=\"notice\" data-corn-state=\"waiting\" data-review-landing hidden><p data-review-landing-text></p><button type=\"button\" class=\"hx-btn hx-btn--quiet\" data-review-cancel-landing data-corn-kind=\"quiet\"></button></div><p class=\"hx-review-ask\" id=\"review-ask\" data-corn=\"message\" data-corn-state=\"waiting\" data-review-ask role=\"alert\" hidden></p><p class=\"hx-decision-line\" id=\"review-line\" data-review-line></p><div class=\"hx-hold\" data-review-hold hidden aria-hidden=\"true\"><span class=\"hx-hold-fill\" data-review-hold-fill></span></div><p class=\"hx-sr-only\" data-review-hold-live role=\"status\"></p></div><div class=\"hx-proposal-actions\"><button data-corn-kind=\"secondary\" type=\"button\" class=\"hx-btn\" data-review=\"notes\" data-peek-ok title=\"Send it back to the drafting agent with a note and your edits\" data-corn-string=\"sendBack\">Send back</button><button type=\"button\" class=\"hx-btn hx-review-undo\" data-review-undo data-corn-kind=\"secondary\" hidden></button><button type=\"button\" class=\"hx-btn hx-btn--approve\" data-review=\"approved\" data-peek-ok title=\"Sign this proposal off\" data-corn-kind=\"approve\" data-corn-string=\"approve\">Approve</button></div></div>" });
2063
- function sr(e, t, n = {}) {
2064
- let { state: r } = t, i = a(t), s = typeof n.now == "function" ? n.now : () => Date.now(), l = typeof n.unnamed == "string" && n.unnamed ? n.unnamed : "", d = Ve(t), f = o(t, e, or().foot, n.slots, "foot");
2065
- i.keepParts(...f);
2066
- let m = f[0], h = m.querySelector("#review"), g = m.querySelector(".hx-proposal-actions"), v = !1, y = {
2067
- key: null,
2068
- reviewable: !1,
2069
- review: null,
2070
- loadFailed: !1,
2071
- busy: !1,
2072
- noting: !1,
2073
- message: "",
2074
- hint: "",
2075
- facts: null,
2076
- factsState: "loading",
2077
- factsAt: 0,
2078
- asking: null,
2079
- hold: null,
2080
- sent: null
2081
- }, b = () => r.proposalSlug || null, x = () => r.proposal && b() ? `${r.proposalSource || ""}/${b()}` : null, C = () => r.proposalSource ? `?source=${encodeURIComponent(r.proposalSource)}` : "", w = () => `/proposals/${encodeURIComponent(b())}/review${C()}`, T = (e) => `/proposals/${encodeURIComponent(b())}/decision${C()}${e ? "&fresh=1" : ""}`, E = (e) => h.querySelector(e), O = (e) => m.querySelector(`[data-review="${e}"]`), k = () => m.querySelector("[data-review-undo]"), A = () => {
2082
- let e = t.ask("whatif:edits");
2083
- return Array.isArray(e) ? e : [];
2084
- }, j = () => {
2085
- let e = t.ask("whatif:form");
2086
- return e === void 0 ? null : e;
2087
- }, M = () => {
2088
- let e = t.ask("changes:played-line");
2089
- return typeof e == "string" ? e : "";
2090
- }, ee = () => r.whatIf ? r.whatIf.edits.length : 0;
2091
- function P() {
2092
- return Yn({
2093
- source: r.proposalSource,
2094
- facts: y.facts,
2095
- factsState: y.factsState,
2096
- review: y.review,
2097
- edits: ee(),
2098
- form: j(),
2099
- played: M(),
2100
- now: s()
2101
- });
2102
- }
2103
- function F() {
2104
- if (v) return;
2105
- let e = E("[data-review-status]"), { verdict: n, when: i } = R(y.review, s()), a = E("[data-review-verdict]");
2106
- a.textContent !== n && (a.textContent = n), E("[data-review-when]").textContent = i ? ` ${i}` : "", e.hidden = !n;
2107
- let o = E("[data-review-loadfail]");
2108
- o.hidden = !y.loadFailed, E("[data-review-loadfail-text]").textContent = y.loadFailed ? `Could not load this proposal's reviews.${t.offline() ? " You are offline." : ""} It may already be approved or sent back; try again before you decide.` : "";
2109
- let c = P(), u = "";
2110
- if (y.asking && !y.hold) {
2111
- if (y.asking.verdict === "approved") u = c.reasons.length ? Kn(c.reasons) : "";
2112
- else {
2113
- let e = Zn({ form: j() });
2114
- u = e.asks ? e.ask : "";
2115
- }
2116
- u || (y.asking = null);
2117
- }
2118
- let d = y.hold, f = O("approved"), p = O("notes"), h = y.asking && y.asking.verdict === "approved" ? "anyway" : d && d.verdict === "approved" ? "hold" : c.approve === "done" ? "done" : "plain", _ = y.asking && y.asking.verdict === "notes" ? "anyway" : d && d.verdict === "notes" ? "hold" : "plain", b = E("[data-review-line]"), x = !y.key && !!r.proposal && !!l;
2119
- b.textContent = y.key ? c.line : x ? l : "", b.hidden = !y.key && !x || !!u, g.hidden = x;
2120
- let S = E("[data-review-ask]");
2121
- S.textContent !== u && (S.textContent = u), S.hidden = !u, E("[data-review-sendback-line]").textContent = Xn({
2122
- source: r.proposalSource,
2123
- edits: ee()
2124
- });
2125
- let C = y.key && c.approve === "refused";
2126
- for (let e of m.querySelectorAll("[data-review]")) !y.reviewable || y.busy || d || e === f && (c.approve === "done" || c.approve === "reading") ? e.setAttribute("aria-disabled", "true") : e.removeAttribute("aria-disabled"), e.disabled = !1, y.key && e === f ? e.setAttribute("aria-describedby", u ? "review-ask" : "review-line") : y.key && !y.noting && e === p && C ? e.setAttribute("aria-describedby", "review-line") : y.key && y.noting && e === p ? e.setAttribute("aria-describedby", "review-sendback-line") : e.removeAttribute("aria-describedby");
2127
- f && (f.textContent = h === "hold" ? $n("approved", d.left) : h === "anyway" ? D(t, "approveAnyway") : h === "done" ? D(t, "approved") : D(t, "approve"), f.dataset.holding = h === "hold" ? "true" : "false"), p && (p.textContent = _ === "hold" ? $n("notes", d.left) : _ === "anyway" ? D(t, "sendBackAnyway") : y.noting ? D(t, "sendBackWithNote") : D(t, "sendBack"), p.setAttribute("aria-expanded", String(y.noting)), p.setAttribute("aria-controls", "review-form"), p.dataset.holding = _ === "hold" ? "true" : "false");
2128
- let w = k();
2129
- w && (w.hidden = !d, w.textContent = D(t, "undo"));
2130
- let T = E("[data-review-hold]");
2131
- T.hidden = !d, E("[data-review-form]").hidden = !y.noting, E("[data-review-cancel]").disabled = y.busy || !!d;
2132
- let A = E("#review-note");
2133
- A.disabled = !y.reviewable, A.readOnly = !!d;
2134
- for (let [e, t] of [["[data-review-msg]", y.message], ["[data-review-hint]", y.reviewable ? y.hint : ""]]) {
2135
- let n = E(e);
2136
- n.hidden = !t, n.textContent = t;
2137
- }
2138
- let M = E("[data-review-sent]");
2139
- if (M.hidden = !y.sent, y.sent) {
2140
- E("[data-review-sent-summary]").textContent = nr(y.sent.lines.length);
2141
- let e = E("[data-review-sent-list]");
2142
- e.dataset.for !== y.sent.key && (e.dataset.for = y.sent.key, e.replaceChildren(...y.sent.lines.map((e) => {
2143
- let n = t.doc.createElement("li");
2144
- return n.className = "hx-whatif-edit", n.textContent = e, n;
2145
- })));
2146
- }
2147
- let N = E("[data-review-landing]"), F = y.reviewable && y.facts && y.facts.landing ? y.facts.landing : null;
2148
- N.hidden = !F, F && (E("[data-review-landing-text]").textContent = `Landing on approval waits for PR #${y.facts.pull.number} to be ready and green.`);
2149
- }
2150
- E(".hx-review-label").textContent = D(t, "reviewNoteLabel"), E("#review-note").setAttribute("placeholder", D(t, "reviewNotePlaceholder")), E("[data-review-cancel-landing]").textContent = D(t, "cancelLanding"), k().textContent = D(t, "undo");
2151
- function I() {
2152
- y.noting = !0, y.message = "", F(), S(t) && De(t, "proposal"), E("#review-note").focus();
2153
- let e = O("notes");
2154
- S(t) && e && typeof e.scrollIntoView == "function" && e.scrollIntoView({ block: "nearest" });
2155
- }
2156
- function L() {
2157
- y.noting = !1, y.asking = null, y.message = "", E("#review-note").value = "", K(y.key), F();
2158
- let e = O("notes");
2159
- e && e.focus();
2160
- }
2161
- function z({ open: e }) {
2162
- let t = e ? x() : null;
2163
- if (h.hidden = !(t || e && l), t === y.key) {
2164
- F();
2165
- return;
2166
- }
2167
- y.hold && Y(e ? "other" : "closed", { quiet: !1 }), y.key = t, y.reviewable = !!t && u(r.proposalSource), y.review = null, y.loadFailed = !1, y.busy = !1, y.noting = !1, y.asking = null, y.sent = null, y.facts = null, y.factsState = y.reviewable ? "loading" : "ready", y.message = y.hint = "";
2168
- let n = E("#review-note"), i = t && y.reviewable ? G(t) : "";
2169
- n && (n.value = i), i && (y.noting = !0), F(), t && y.reviewable && (J(t), V());
2170
- }
2171
- let B = (e, n) => {
2172
- (e === 401 || e === 403) && t.emit("auth", {
2173
- status: e,
2174
- during: n
2175
- });
2176
- };
2177
- async function V({ fresh: e = !1 } = {}) {
2178
- let t = y.key;
2179
- if (!t || !y.reviewable || !W(r.proposalSource)) return;
2180
- y.factsAt = s();
2181
- let n = null;
2182
- try {
2183
- let t = await d(T(e), { cache: "no-store" });
2184
- t.ok ? n = await t.json() : B(t.status, "facts");
2185
- } catch {
2186
- n = null;
2187
- }
2188
- if (v || t !== y.key) return;
2189
- let i = n && n.pull ? n.pull.head : null, a = y.facts && y.facts.pull ? y.facts.pull.head : null;
2190
- y.facts = n && n.pull ? n : null, y.factsState = y.facts ? "ready" : "unread", i && a && i !== a && J(t), F();
2191
- }
2192
- let H = () => {
2193
- try {
2194
- return t.win.sessionStorage;
2195
- } catch {
2196
- return null;
2197
- }
2198
- };
2199
- function U(e, t) {
2200
- if (e) try {
2201
- t && t.trim() ? H().setItem(ar + e, t.slice(0, 2e4)) : H().removeItem(ar + e);
2202
- } catch {}
2203
- }
2204
- function G(e) {
2205
- try {
2206
- return H().getItem(ar + e) || "";
2207
- } catch {
2208
- return "";
2209
- }
2210
- }
2211
- function K(e) {
2212
- if (e) try {
2213
- H().removeItem(ar + e);
2214
- } catch {}
2215
- }
2216
- function q(e = 0) {
2217
- y.key && y.reviewable && !y.hold && !y.busy && (t.hidden() || s() - y.factsAt < e || V());
2218
- }
2219
- function te() {
2220
- let e = t.active(), n = !!e && h.contains(e) && e.matches("[data-review-retry]");
2221
- y.loadFailed = !1, F(), n && t.emit("proposal:focus-title");
2222
- }
2223
- async function J(e) {
2224
- try {
2225
- let t = await d(w(), { cache: "no-store" });
2226
- if (v || e !== y.key) return;
2227
- if (t.status === 404) {
2228
- y.review = null, te();
2229
- return;
2230
- }
2231
- if (!t.ok) throw B(t.status, "review"), Error(`The server answered ${t.status}.`);
2232
- let n = await t.json();
2233
- if (v || e !== y.key) return;
2234
- n && typeof n.verdict == "string" && (y.review = {
2235
- verdict: n.verdict,
2236
- at: n.at,
2237
- current: n.current === !0
2238
- }), te();
2239
- } catch {
2240
- !v && e === y.key && (y.loadFailed = !0, F());
2241
- }
2242
- }
2243
- function ne(e) {
2244
- if (!e.target.closest || e.detail > 1 && e.target.closest("[data-review], [data-review-undo]")) return;
2245
- if (e.target.closest("[data-review-undo]")) {
2246
- y.hold && Y("undo");
2247
- return;
2248
- }
2249
- if (y.hold || y.busy) return;
2250
- if (e.target.closest("[data-review-cancel-landing]")) {
2251
- oe();
2252
- return;
2253
- }
2254
- if (e.target.closest("[data-review-cancel]")) {
2255
- L();
2256
- return;
2257
- }
2258
- if (e.target.closest("[data-review-retry]")) {
2259
- E("[data-review-loadfail-text]").textContent = "Reading the reviews again …", J(y.key);
2260
- return;
2261
- }
2262
- let t = e.target.closest("[data-review]");
2263
- if (!t) return;
2264
- let n = t.dataset.review;
2265
- y.asking && y.asking.verdict !== n && (y.asking = null, F()), t.getAttribute("aria-disabled") !== "true" && y.reviewable && (n === "notes" && !y.noting ? I() : re(n));
2266
- }
2267
- function re(e) {
2268
- if (y.message = "", y.hint = "", y.sent = null, t.offline()) {
2269
- y.asking = null, y.message = Be(t, e === "approved" ? "Your approval" : "Your send back"), F();
2270
- return;
2271
- }
2272
- let n = [];
2273
- if (e === "notes") {
2274
- let e = _(E("#review-note").value);
2275
- if (e) {
2276
- y.message = e, y.noting = !0, F(), S(t) && De(t, "proposal"), E("#review-note").focus();
2277
- return;
2278
- }
2279
- let r = Zn({ form: j() });
2280
- if (r.asks && !(y.asking && y.asking.verdict === "notes")) {
2281
- y.asking = {
2282
- verdict: "notes",
2283
- answered: []
2284
- }, F(), N(t, r.ask);
2285
- return;
2286
- }
2287
- n = r.reasons.map((e) => e.key);
2288
- } else {
2289
- let e = P();
2290
- if (e.approve === "refused" || e.approve === "done" || e.approve === "reading") {
2291
- F();
2292
- return;
2293
- }
2294
- if (e.approve === "asks" && !(y.asking && y.asking.verdict === "approved")) {
2295
- y.asking = {
2296
- verdict: "approved",
2297
- answered: []
2298
- }, F();
2299
- return;
2300
- }
2301
- n = e.reasons.map((e) => e.key);
2302
- }
2303
- ie(e, n);
2304
- }
2305
- function ie(e, t) {
2306
- let n = {
2307
- ...r.proposalSha256 ? { sha256: r.proposalSha256 } : {},
2308
- ...y.facts && y.facts.pull && y.facts.pull.head ? { headSha: y.facts.pull.head } : {}
2309
- }, i = {
2310
- ...p(e, e === "notes" ? E("#review-note").value : "", A()),
2311
- ...n
2312
- };
2313
- y.asking = null;
2314
- let a = {
2315
- verdict: e,
2316
- body: i,
2317
- answered: t,
2318
- left: jn / 1e3,
2319
- tick: null,
2320
- end: null
2321
- };
2322
- y.hold = a, a.tick = setInterval(() => {
2323
- a.left = Math.max(0, a.left - 1), F();
2324
- }, 1e3), a.end = setTimeout(() => {
2325
- ae(a);
2326
- }, jn), E("[data-review-hold-fill]").style.animationDuration = `${jn}ms`, F(), E("[data-review-hold-live]").textContent = er(e, jn / 1e3);
2327
- let o = k();
2328
- o && o.focus();
2329
- }
2330
- function Y(e, { quiet: n = !1 } = {}) {
2331
- let r = y.hold;
2332
- if (!r) return;
2333
- clearInterval(r.tick), clearTimeout(r.end), y.hold = null;
2334
- let i = tr(r.verdict, e);
2335
- if (e === "closed" || e === "other" ? n || N(t, i) : y.message = i, v) return;
2336
- F();
2337
- let a = E("[data-review-hold-live]");
2338
- a && (a.textContent = e === "closed" || e === "other" ? "" : i), e !== "closed" && e !== "other" && O(r.verdict)?.focus();
2339
- }
2340
- async function ae(e) {
2341
- if (y.hold !== e) return;
2342
- if (clearInterval(e.tick), t.offline()) {
2343
- Y("offline");
2344
- return;
2345
- }
2346
- if (t.hidden()) {
2347
- Y("hidden");
2348
- return;
2349
- }
2350
- let n = y.key;
2351
- if (e.verdict === "approved" && y.reviewable && await V({ fresh: !0 }), v || y.hold !== e || n !== y.key) return;
2352
- let r = y.facts && y.facts.pull ? y.facts.pull.head : null;
2353
- if (e.verdict === "approved" && e.body.headSha && r && r !== e.body.headSha) {
2354
- Y("pushed");
2355
- return;
2356
- }
2357
- if (e.verdict === "approved" && qn(Gn({
2358
- facts: y.facts,
2359
- edits: e.body.edits.length,
2360
- form: j()
2361
- }), e.answered).length) {
2362
- y.hold = null, y.asking = {
2363
- verdict: "approved",
2364
- answered: e.answered
2365
- }, F(), O("approved")?.focus();
2366
- return;
2367
- }
2368
- y.hold = null;
2369
- let i = E("[data-review-hold-live]");
2370
- i && (i.textContent = ""), await se(e.verdict, { body: e.body });
2371
- }
2372
- async function oe() {
2373
- let e = W(r.proposalSource);
2374
- if (!e) return;
2375
- y.busy = !0, F();
2376
- let n = "";
2377
- try {
2378
- let t = await d(`/api/forge/pulls/${e}/landing/cancel`, {
2379
- method: "POST",
2380
- headers: { "Content-Type": "application/json" },
2381
- body: "{}"
2382
- });
2383
- if (!t.ok) {
2384
- B(t.status, "landing");
2385
- let e = "";
2386
- try {
2387
- e = (await t.json()).error || "";
2388
- } catch {}
2389
- n = Qn(t.status, e);
2390
- }
2391
- } catch {
2392
- n = Be(t, "Cancelling the landing");
2393
- }
2394
- v || (y.busy = !1, y.message = n, await V({ fresh: !0 }), v || (F(), n || N(t, "Landing cancelled. The approval stands and the PR stays open."), (O("approved") || O("notes"))?.focus()));
2395
- }
2396
- async function se(e, n = {}) {
2397
- if (v || !r.proposal || !b() || !y.reviewable) return !1;
2398
- let i = E("#review-note"), a = e === "notes" ? i.value : "";
2399
- if (y.hint = "", e === "notes" && !n.body) {
2400
- let e = _(a);
2401
- if (e) return y.message = e, y.noting = !0, F(), S(t) && De(t, "proposal"), i.focus(), !1;
2402
- }
2403
- y.message = "", y.busy = !0, F();
2404
- let o = y.key, s = b(), l = r.proposalSource || null, u = n.body || p(e, a, A()), f = t.ask("whatif:describe"), m = e === "notes" && Array.isArray(f) ? f : [], h, g = e === "approved" ? "Your approval" : "Your send back", x;
2405
- try {
2406
- x = await d(w(), {
2407
- method: "PUT",
2408
- headers: { "Content-Type": "application/json" },
2409
- body: JSON.stringify(u)
2410
- });
2411
- } catch {
2412
- return v || (y.busy = !1, y.message = Be(t, g), F()), !1;
2413
- }
2414
- if (v) return !1;
2415
- try {
2416
- let e = null;
2417
- try {
2418
- e = await x.json();
2419
- } catch {}
2420
- if (x.status === 401 || x.redirected) throw Object.assign(/* @__PURE__ */ Error(""), { status: 401 });
2421
- if (!x.ok) throw Object.assign(Error(e && e.error || ""), { status: x.status });
2422
- h = e;
2423
- } catch (e) {
2424
- return v || (y.busy = !1, y.message = Qn(e.status || x.status, e.message), F(), B(e.status || x.status, "send"), (x.status === 409 || x.status === 429) && o === y.key && (J(o), V({ fresh: !0 }))), !1;
2425
- }
2426
- if (y.busy = !1, o !== y.key) return t.emit("decision", {
2427
- outcome: e,
2428
- review: h,
2429
- slug: s,
2430
- source: l,
2431
- open: !1
2432
- }), !0;
2433
- y.review = {
2434
- verdict: h.verdict,
2435
- at: h.at,
2436
- current: h.verdict === "approved"
2437
- }, y.hint = e === "approved" ? c(e, u.edits.length) : "", h.posted === !1 && (y.hint = `It was approved already${h.by ? ` by ${h.by}` : ""}; nothing new was posted.`), K(o), e === "notes" && m.length && (y.sent = {
2438
- key: `${h.at}`,
2439
- lines: m
2440
- }), i.value = "";
2441
- let C = y.noting;
2442
- y.noting = !1, F();
2443
- let T = t.active(), D = !T || T === t.doc.body || !T.isConnected || T.hidden;
2444
- return e === "approved" ? D && O("approved")?.focus() : (C || D) && O("notes")?.focus(), t.emit("decision", {
2445
- outcome: e,
2446
- review: h,
2447
- slug: s,
2448
- source: l,
2449
- open: !0
2450
- }), t.emit("mockups:refresh"), e === "notes" && t.emit("whatif:clear"), V({ fresh: !0 }), !0;
2451
- }
2452
- i.listen(m, "click", ne), i.listen(h, "input", (e) => {
2453
- e.target && e.target.id === "review-note" && U(y.key, e.target.value), y.message && (y.message = "", F());
2454
- }), i.listen(h, "keydown", (e) => {
2455
- e.key === "Escape" && y.noting && !y.asking && !y.hold && (e.stopPropagation(), L());
2456
- }), i.listen(t.root, "keydown", (e) => {
2457
- e.repeat && (e.key === "Enter" || e.key === " ") && e.target && e.target.closest && e.target.closest("#review-decision [data-review], #review-decision [data-review-undo]") ? (e.preventDefault(), e.stopPropagation()) : e.key === "Escape" && y.key && (y.hold ? (e.stopPropagation(), e.preventDefault(), Y("escape")) : y.asking && (e.stopPropagation(), e.preventDefault(), y.asking = null, F()));
2458
- }, !0), i.own(t.onNetwork((e) => {
2459
- e ? y.hold && Y("offline") : y.loadFailed && y.key && J(y.key);
2460
- })), i.own(t.onWindowFocus(() => q(5e3))), i.own(t.onPageHide(() => {
2461
- y.hold && Y("closed", { quiet: !0 });
2462
- })), i.own(t.onHide(() => {
2463
- y.hold && Y("hidden");
2464
- })), i.own(t.onShown(() => q(5e3))), i.on("proposal:bar", z), i.on("whatif:edits-changed", () => {
2465
- y.hold && Y("edits"), F();
2466
- }), i.on("changes:paint", () => F());
2467
- let ce = setInterval(() => {
2468
- y.review && F();
2469
- }, rr), le = setInterval(() => q(), ir);
2470
- return i.own(() => {
2471
- clearInterval(ce), clearInterval(le);
2472
- }), i.own(() => {
2473
- v = !0, y.hold &&= (clearInterval(y.hold.tick), clearTimeout(y.hold.end), null), f.forEach((e) => e.remove());
2474
- }), z({ open: !!r.proposal }), {
2475
- elements: f,
2476
- sendReview: se,
2477
- loadFacts: V,
2478
- paint: F,
2479
- update() {
2480
- z({ open: !!r.proposal });
2481
- },
2482
- destroy: () => i.destroy()
2483
- };
2484
- }
2485
- // ../explorer/pieces/review.js
2486
- var cr = "Arrow keys pan, plus and minus zoom, 0 fits the map. N and P select the next and the previous node, Home and End the first and the last. F frames the selected node and what it lights. Enter goes to the selected node's panel, Escape closes it.", lr = [
2487
- "map",
2488
- "orbit",
2489
- "dataflow"
2490
- ], ur = "There is no map to show: the topology has no nodes.", dr = "<div class=\"hx-stage\" data-corn=\"stage\"><!--corn-piece:map/stage--><div id=\"sheet-dock\" class=\"hx-dock\" data-corn=\"dock\"><!--corn-piece:proposal/bar--><!--corn-piece:changes/column--><!--corn-piece:node-panel/drawer--></div><!--corn-piece:node-panel/backdrop--><p class=\"hx-review-empty\" data-corn=\"empty\" role=\"status\" hidden></p></div><div class=\"hx-review-spare\" hidden><!--corn-piece:proposal/menu--></div>";
2491
- function fr(e, t) {
2492
- let n = {}, r = e.createTreeWalker(t, 128);
2493
- for (let e = r.nextNode(); e; e = r.nextNode()) e.data.startsWith("corn-piece:") && (n[e.data.slice(11)] = e);
2494
- return n;
2495
- }
2496
- function pr(e, t, n = {}) {
2497
- let i = e.ownerDocument || e, a = i.createElement("div");
2498
- a.setAttribute("data-corn", "review"), a.setAttribute("part", "review"), a.setAttribute("role", "region"), a.setAttribute("aria-label", typeof n.label == "string" && n.label.trim() ? n.label.trim() : "Proposal review"), a.innerHTML = f(dr), e.append(a);
2499
- let o = !t, s = o && typeof n.src == "string" ? n.src !== "" : o && n.src !== void 0 && n.src !== null, c = s ? He(n.src) : null, l = !!c && !c.ok;
2500
- o ? t = d({
2501
- root: a,
2502
- base: c ? c.ok ? c.base : "" : n.base || "",
2503
- fetch: l ? () => Promise.reject(/* @__PURE__ */ TypeError("The review has no server: its src is not an address.")) : n.fetch,
2504
- strings: n.strings
2505
- }) : n.strings !== void 0 && r(t, n.strings);
2506
- let { state: u } = t;
2507
- we(t, a), O(t, a);
2508
- let p = !1, m = !1, h = !0, g = !1, _ = !1, v = () => {
2509
- if (g || _ || p || !m || !h) return;
2510
- let e = t.map;
2511
- if (!e || typeof e.onPaint != "function") {
2512
- g = !0, n.onReady && n.onReady();
2513
- return;
2514
- }
2515
- _ = !0;
2516
- let r = e.onPaint(() => {
2517
- r(), _ = !1, g || p || !h || (g = !0, n.onReady && n.onReady());
2518
- });
2519
- e.render();
2520
- }, y = fr(i, a), b = H(a, t, {
2521
- slots: { stage: y["map/stage"] },
2522
- measureCovered: () => w(t),
2523
- keysHelp: cr,
2524
- renderer: n.renderer,
2525
- theme: n.theme,
2526
- tokens: n.tokens,
2527
- onSelect: n.onSelect,
2528
- onReady: () => {
2529
- m = !0, v();
2530
- }
2531
- }), x = he(a, t, { slots: {
2532
- drawer: y["node-panel/drawer"],
2533
- backdrop: y["node-panel/backdrop"]
2534
- } }), S = vt(a, t, {
2535
- slots: {
2536
- bar: y["proposal/bar"],
2537
- menu: y["proposal/menu"]
2538
- },
2539
- edit: !1
2540
- }), C = An(a, t, {
2541
- slots: { column: y["changes/column"] },
2542
- checker: n.checker
2543
- }), T = fr(i, a)["decision/foot"], E = sr(a, t, {
2544
- slots: { foot: T },
2545
- now: n.now,
2546
- unnamed: Jn
2547
- }), D = t.on("map:set", ({ nodes: e, edges: n }) => (V(t, e, n), !0)), k = !n.base && !n.fetch && !(c && c.ok), A = {
2548
- topology: void 0,
2549
- proposal: null,
2550
- source: null,
2551
- slug: null,
2552
- sha256: null,
2553
- proposalView: null,
2554
- shown: null,
2555
- hasTopology: !1,
2556
- held: !1
2557
- }, j = () => {
2558
- S.update(), C.update(), E.update(), x.update();
2559
- };
2560
- function M() {
2561
- if (p) return;
2562
- let e = A.proposal;
2563
- if (e == null || e === "") {
2564
- A.held = !1, A.shown = null, h = !0, u.proposal && tt(t), v();
2565
- return;
2566
- }
2567
- if (!A.hasTopology) {
2568
- A.held = !0, h = !1;
2569
- return;
2570
- }
2571
- A.held = !1;
2572
- let n = A.proposalView;
2573
- if (typeof e == "string" && l) {
2574
- h = !0, v();
2575
- return;
2576
- }
2577
- if (typeof e == "string" && k) {
2578
- let n = ne(e) ? `${e} cannot be opened here: there is no cornfield server to read it from (the review has no src).` : ie(e);
2579
- A.shown = null, Je(t, n, !0, []), t.emit("proposal:failed", {
2580
- slug: e,
2581
- source: A.source,
2582
- status: 0,
2583
- notFound: !1,
2584
- message: n
2585
- }), h = !0, v();
2586
- return;
2587
- }
2588
- if (typeof e == "string") {
2589
- if (u.proposal && u.proposalSlug === e && (!A.source || A.source === u.proposalSource)) {
2590
- A.shown = `${e}\u0000${A.source || ""}`, Z.includes(n) && u.proposalView !== n && S.update({ view: n }), h = !0;
2591
- return;
2592
- }
2593
- let t = `${e}\u0000${A.source || ""}`;
2594
- if (A.shown === t && u.proposal) return;
2595
- A.shown = t, h = !1;
2596
- let r = S.update({
2597
- proposal: e,
2598
- source: A.source,
2599
- view: n
2600
- });
2601
- return Promise.resolve(r).then(() => {
2602
- A.shown === t && (h = !0, v());
2603
- }), r;
2604
- }
2605
- if (A.shown === e && u.proposal) return;
2606
- A.shown = e;
2607
- let r = k ? {} : {
2608
- source: A.source,
2609
- slug: A.slug,
2610
- sha256: A.sha256
2611
- };
2612
- S.update({
2613
- proposal: e,
2614
- ...r,
2615
- view: n
2616
- }), h = !0, v();
2617
- }
2618
- function N(e) {
2619
- A.hasTopology = z(t, e);
2620
- let n = a.querySelector(".hx-review-empty");
2621
- n.textContent = A.hasTopology ? "" : ur, n.hidden = A.hasTopology, A.hasTopology ? (B(t), u.proposal ? et(t, void 0, { fit: !0 }) : b.fit(), t.map.render(), t.map.ensureFlowLoop(), A.held && M()) : t.map.render();
2622
- }
2623
- function ee(e) {
2624
- let n = e === "dataflow" ? "dataflow" : "orbit";
2625
- u.view !== n && (u.view = n, t.emit("scenario:clear"), t.touchScene(), u.nodes.length && (V(t, u.mapNodes, u.mapEdges), b.fit(), t.map.ensureFlowLoop()), t.emit("view", u.view));
2626
- }
2627
- function P(e) {
2628
- Z.includes(e) ? (A.proposalView = e, u.proposal && S.update({ view: e })) : lr.includes(e) && ee(e);
2629
- }
2630
- function F(e) {
2631
- e && typeof e == "object" && ("layers" in e && Le(t, e.layers), e.theme && b.applyTheme(e.theme));
2632
- }
2633
- function I(e) {
2634
- e !== A.topology && (A.topology = e, N(e));
2635
- }
2636
- let L = {}, R = null, U = (e) => {
2637
- R ? R.provide(e) : s && Object.assign(L, e);
2638
- };
2639
- A.useTheme = !!n.useTheme, A.theme = n.theme, s && n.strings !== void 0 && U({ strings: n.strings });
2640
- let W = () => t.base ? Ue(t.base, typeof n.pageUrl == "function" ? n.pageUrl() : "") : "", G = [], K = "";
2641
- G.push(t.on("auth", ({ status: e, during: t }) => {
2642
- let r = W();
2643
- if (R && R.showSignIn({
2644
- status: e,
2645
- signIn: r
2646
- }), t === "facts") {
2647
- if (K === `${e}`) return;
2648
- K = `${e}`;
2649
- } else K = "";
2650
- n.onAuth && n.onAuth({
2651
- status: e,
2652
- signIn: r,
2653
- during: t
2654
- });
2655
- })), G.push(t.on("decision", () => {
2656
- K = "", R && R.clearSignIn();
2657
- })), n.onDecision && G.push(t.on("decision", ({ outcome: e, review: t, slug: r, source: i, open: a }) => n.onDecision({
2658
- outcome: e,
2659
- proposal: r,
2660
- source: i,
2661
- open: a,
2662
- review: t
2663
- }))), n.onNavigate && G.push(t.on("proposal", ({ change: e, slug: t, source: r, pinSource: i, view: a }) => n.onNavigate({
2664
- proposal: t,
2665
- source: i ? r : null,
2666
- view: e === "closed" ? null : a,
2667
- change: e
2668
- }))), n.onError && G.push(t.on("proposal:failed", ({ message: e }) => n.onError({
2669
- kind: "proposal",
2670
- message: e
2671
- }))), G.push(t.on("proposal:specs-list", () => !1)), s && import("./review-source-CK5tYIqk.js").then(({ attachSource: r }) => {
2672
- p || (R = r(t, {
2673
- root: e,
2674
- stage: a.querySelector("[data-corn=\"stage\"]"),
2675
- parsed: c,
2676
- tokens: n.tokens,
2677
- version: n.version,
2678
- pageUrl: n.pageUrl,
2679
- useTheme: A.useTheme,
2680
- theme: A.theme,
2681
- topology: L.topology,
2682
- config: L.config,
2683
- strings: L.strings,
2684
- onTopology: (e) => I(e),
2685
- onConfig: () => {
2686
- O(t, a), j();
2687
- },
2688
- onAuth: (e) => {
2689
- n.onAuth && n.onAuth(e);
2690
- },
2691
- onError: (e) => {
2692
- n.onError && n.onError(e);
2693
- },
2694
- onMode: () => b.refresh(),
2695
- focusMap: () => {
2696
- u.canvas && u.canvas.focus();
2697
- }
2698
- }));
2699
- }, (e) => {
2700
- !p && n.onError && n.onError({
2701
- kind: "offline",
2702
- message: `the review's loader did not load: ${e && e.message ? e.message : e}`
2703
- });
2704
- });
2705
- function q(e = {}) {
2706
- if (p) return;
2707
- let n = !1;
2708
- "strings" in e && (r(t, e.strings), O(t, a), n = !0, U({ strings: e.strings })), "useTheme" in e && (A.useTheme = !!e.useTheme, R && R.setUseTheme(A.useTheme)), "config" in e && (s ? U({ config: e.config || null }) : F(e.config)), "theme" in e && (b.update({ theme: e.theme }), A.theme = e.theme, R && R.setTheme(e.theme)), "checker" in e && C.update({ checker: e.checker }), "topology" in e && (s ? U({ topology: e.topology || null }) : I(e.topology));
2709
- let i, o = [
2710
- "proposal",
2711
- "source",
2712
- "slug",
2713
- "sha256"
2714
- ].some((t) => t in e);
2715
- return o && ("source" in e && (A.source = e.source || null), "slug" in e && (A.slug = e.slug || null), "sha256" in e && (A.sha256 = e.sha256 || null), "proposal" in e && (A.proposal = e.proposal, A.shown = null), "view" in e && Z.includes(e.view) && (A.proposalView = e.view), i = M()), "view" in e && !(o && Z.includes(e.view)) && P(e.view), "node" in e && b.update({ node: e.node }), n && j(), i;
2716
- }
2717
- function te() {
2718
- if (!p) {
2719
- p = !0, D(), G.forEach((e) => e()), R && R.destroy(), R = null;
2720
- for (let e of [
2721
- E,
2722
- C,
2723
- S,
2724
- x,
2725
- b
2726
- ]) e.destroy();
2727
- we(t, null), a.remove(), o && t.destroy();
2728
- }
2729
- }
2730
- let J = {};
2731
- for (let e of [
2732
- "config",
2733
- "topology",
2734
- "proposal",
2735
- "source",
2736
- "slug",
2737
- "sha256",
2738
- "view",
2739
- "node"
2740
- ]) n[e] !== void 0 && (J[e] = n[e]);
2741
- if (s) for (let e of ["topology", "config"]) e in J && (U({ [e]: J[e] || null }), delete J[e]);
2742
- return q(J), {
2743
- inst: t,
2744
- elements: [a],
2745
- map: b,
2746
- proposal: S,
2747
- changes: C,
2748
- decision: E,
2749
- nodePanel: x,
2750
- update: q,
2751
- destroy: te,
2752
- fit: () => b.fit(),
2753
- focusNode: (e) => b.focusNode(e),
2754
- refresh: () => b.refresh()
2755
- };
2756
- }
2757
- // \0stencil-css:/home/runner/work/CornField/CornField/components/src/components/corn-review/corn-review?tag=corn-review&encapsulation=shadow&__ext=css
2758
- var mr = () => ":host{contain:layout;min-width:0;height:100%;color:var(--corn-text);font-family:var(--corn-font);display:block}:host([hidden]){display:none!important}", hr = () => "*,:before,:after{box-sizing:border-box}*{--hx-control-h:var(--corn-control-height);--hx-seg-inner:calc(var(--hx-control-h) - var(--corn-space-1) - 2 * var(--corn-border))}@container corn-box (width<=767px){*{--hx-control-h:max(44px, var(--corn-control-height));--hx-seg-inner:var(--hx-control-h)}}img{image-rendering:var(--hx-pixelated,auto)}[hidden]{display:none!important}button{font:inherit;color:inherit;cursor:pointer}h1,h2,h3,p{margin:0}.glass{background:var(--corn-surface-1);-webkit-backdrop-filter:blur(var(--corn-blur));border:var(--corn-border) solid var(--corn-line);box-shadow:var(--corn-shadow)}.glass-header{background:color-mix(in srgb, var(--corn-ground) 88%, transparent);-webkit-backdrop-filter:blur(var(--corn-blur));border-bottom:var(--corn-border) solid var(--corn-line)}::-webkit-scrollbar{width:5px;height:5px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--corn-text) 18%, transparent);border-radius:var(--corn-radius-pill)}::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb, var(--corn-text) 28%, transparent)}.hx-faint{color:var(--corn-text-3)}.hx-mono{font-family:var(--corn-mono);font-size:var(--corn-text-2xs)}.hx-strong{color:var(--corn-text-2)}.hx-bold{font-weight:700}.hx-name{color:var(--corn-text-2)}.hx-accent{color:var(--corn-accent-text)}.hx-good{color:var(--corn-ok)}.hx-warn{color:var(--corn-warn)}.hx-rom{color:var(--corn-hue-fuchsia)}.hx-link{color:var(--corn-info);text-decoration:underline}.hx-link-faint{color:var(--corn-text-3);font-family:var(--corn-mono);font-size:var(--corn-text-2xs)}.hx-link-faint:hover{color:var(--corn-warn)}.hx-code{color:var(--corn-warn);font-family:var(--corn-mono);font-size:var(--corn-text-2xs)}.hx-chips{gap:var(--corn-space-1);padding-top:var(--corn-space-1);flex-wrap:wrap;display:flex}.hx-pt{padding-top:var(--corn-space-3)}.hx-switch{border-radius:var(--corn-radius-pill);border:var(--corn-border) solid var(--corn-line);background:var(--corn-surface-3);flex:none;width:28px;height:16px;position:relative}.hx-switch:after{content:\"\";background:var(--corn-text-3);border-radius:50%;width:10px;height:10px;transition:transform .15s;position:absolute;top:2px;left:2px}[aria-checked=true]>.hx-switch{background:var(--corn-accent);border-color:var(--corn-accent)}[aria-checked=true]>.hx-switch:after{background:var(--corn-text-on-accent);transform:translate(12px)}@media (prefers-reduced-motion:reduce){.hx-switch:after{transition:none}}.hx-btn{align-items:center;gap:var(--corn-space-2);padding:var(--corn-space-1) var(--corn-space-3);border-radius:var(--corn-radius-sm);border:var(--corn-border) solid var(--corn-line);background:var(--corn-surface-2);color:var(--corn-text-2);font-size:var(--corn-text-xs);white-space:nowrap;font-weight:600;transition:background .15s,color .15s,border-color .15s;display:inline-flex}.hx-btn:hover{background:var(--corn-surface-3);color:var(--corn-text)}.hx-btn:focus-visible,.hx-textbtn:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-btn--active,.hx-btn--active:hover{background:var(--corn-accent);border-color:var(--corn-accent-text);color:var(--corn-text-on-accent);box-shadow:var(--corn-shadow-sm)}.hx-btn--quiet{color:var(--corn-text-3);font-weight:500}.hx-btn--icon{width:28px;height:28px;font-size:var(--corn-text-base);justify-content:center;padding:0}.hx-btn--rom{width:100%;margin-top:var(--corn-space-1);padding:var(--corn-space-2);background:color-mix(in srgb, var(--corn-hue-fuchsia) 20%, transparent);border-color:color-mix(in srgb, var(--corn-hue-fuchsia) 40%, transparent);color:color-mix(in srgb, var(--corn-hue-fuchsia) 60%, var(--corn-text));justify-content:center;font-weight:700}.hx-btn--rom:hover{background:color-mix(in srgb, var(--corn-hue-fuchsia) 30%, transparent)}.hx-input{width:128px;padding:var(--corn-space-1) var(--corn-space-3) var(--corn-space-1) var(--corn-space-6);border-radius:var(--corn-radius-sm);border:var(--corn-border) solid var(--corn-line);background:color-mix(in srgb, var(--corn-ground) 80%, transparent);color:var(--corn-text);font:inherit;font-size:var(--corn-text-sm);user-select:text;outline:none;transition:width .2s,border-color .2s}.hx-input:focus{border-color:var(--corn-focus);width:208px}.hx-input::placeholder{color:var(--corn-text-3)}.hx-input--wide,.hx-input--wide:focus{flex:1;width:100%}.hx-menu-wrap{flex:none;position:relative}.hx-menu{margin-top:var(--corn-space-3);width:288px;max-width:calc(100cqw - 24px);max-height:calc(100cqh - 80px);padding:var(--corn-space-4);border-radius:var(--corn-radius-lg);font-size:var(--corn-text-xs);z-index:50;user-select:none;position:absolute;top:100%;left:0;overflow-y:auto}.hx-textbtn{padding:calc(var(--corn-space-1) / 2) var(--corn-space-1);border-radius:var(--corn-radius-xs);color:var(--corn-text-3);font-size:var(--corn-text-2xs);background:0 0;border:0;font-weight:600}.hx-textbtn:hover{background:var(--corn-line-soft);color:var(--corn-text-2)}.hx-textbtn--accent{color:var(--corn-accent-text)}.hx-close{width:var(--hx-control-h);height:var(--hx-control-h);border-radius:var(--corn-radius-sm);background:var(--corn-surface-2);color:var(--corn-text-3);font-weight:700;font-size:var(--corn-text-base);border:0;flex:none}.hx-close:hover{color:var(--corn-text)}.hx-mark-dot{width:12px;height:12px;margin-right:var(--corn-space-2);border:var(--corn-border-strong) solid var(--corn-changed);vertical-align:-2px;border-radius:50%;flex:none;display:inline-block}.hx-mark-dot--added{border-color:var(--corn-added);border-style:dashed}.hx-mark-dot--changed{border-color:var(--corn-changed)}.hx-mark-dot--removed{border-color:var(--corn-removed);background:color-mix(in srgb, var(--corn-removed) 25%, transparent)}.hx-mark-dot--edit{border-color:var(--corn-edit);border-style:dotted}.hx-glyph{color:color-mix(in srgb, var(--glyph) var(--corn-glyph-mix), var(--corn-text))}.hx-sr-only{clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0;padding:0;overflow:hidden;position:absolute!important}:where(button,a[href],summary,select,textarea,[tabindex]):focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}@media (prefers-reduced-motion:reduce){.hx-input,.hx-btn,.hx-menu{transition:none;animation:none}}.hx-btn[aria-disabled=true]{opacity:.6;cursor:progress}@container corn-box (width<=767px){.hx-textbtn{min-width:44px;min-height:44px}}@media (pointer:coarse){.hx-textbtn{min-width:44px;min-height:44px}}", gr = () => "@container corn-box (width<=767px){.hx-stage .hx-hint{top:68px}}#graph-canvas{cursor:grab;touch-action:none;width:100%;height:100%;display:block}#graph-canvas:active{cursor:grabbing}#label-canvas{pointer-events:none;width:100%;height:100%;position:absolute;inset:0}.hx-overlay{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0}.hx-hint{align-items:center;gap:var(--corn-space-2);max-width:85cqw;padding:var(--corn-space-1) var(--corn-space-4);border-radius:var(--corn-radius-pill);font-size:var(--corn-text-2xs);color:var(--corn-text-2);pointer-events:none;z-index:10;white-space:nowrap;display:flex;position:absolute;top:12px;left:50%;transform:translate(-50%)}.hx-hint span:last-child{text-overflow:ellipsis;overflow:hidden}@container corn-box (width>=640px){.hx-hint{font-size:var(--corn-text-xs)}}.hx-state{color:var(--corn-text-3);font-size:var(--corn-text-md);z-index:5;text-align:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.hx-state--error{align-items:center;gap:var(--corn-space-3);width:min(440px,100cqw - 32px);padding:var(--corn-space-6);border-radius:var(--corn-radius-lg);color:var(--corn-text-2);user-select:text;flex-direction:column;display:flex}.hx-state--error strong{color:var(--corn-bad);font-size:var(--corn-text-lg)}.hx-state--error p{font-size:var(--corn-text-sm);line-height:1.5}.hx-state--error #error-message{font-family:var(--corn-mono);color:var(--corn-warn);word-break:break-word}#graph-canvas.is-drawing-edge{touch-action:none}#graph-canvas:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:calc(var(--corn-focus-width) * -1)}.hx-run-overlay{z-index:2;pointer-events:none;position:absolute;inset:0;overflow:hidden}.hx-run-overlay[hidden]{display:none}.hx-run-mark{--r:14px;width:0;height:0;position:absolute}.hx-run-ring{left:calc(var(--r) * -1);top:calc(var(--r) * -1);width:calc(var(--r) * 2);height:calc(var(--r) * 2);box-sizing:border-box;border:var(--corn-border-strong) solid var(--corn-added);border-radius:50%;position:absolute}.hx-run-mark--flight .hx-run-ring{animation:1.8s ease-out infinite hx-run-pulse}@keyframes hx-run-pulse{0%{opacity:1;transform:scale(.9)}to{opacity:.1;transform:scale(1.55)}}.hx-run-overlay.is-static .hx-run-ring{opacity:1;border-width:calc(var(--corn-border-strong) + var(--corn-border));animation:none;transform:none}@media (prefers-reduced-motion:reduce){.hx-run-ring{opacity:1;border-width:calc(var(--corn-border-strong) + var(--corn-border));transform:none;animation:none!important}}.hx-run-mark--collision .hx-run-ring{border:calc(var(--corn-border-strong) + var(--corn-border)) dashed var(--corn-map-collision);animation:none}.hx-run-tag{left:0;top:calc(var(--r) + 4px);white-space:nowrap;padding:calc(var(--corn-space-1) / 2) var(--corn-space-2);border-radius:var(--corn-radius-pill);border:var(--corn-border) solid var(--corn-map-collision);background:color-mix(in srgb, var(--corn-ground) 80%, transparent);color:var(--corn-map-collision);font-size:var(--corn-text-xs);font-weight:700;position:absolute;transform:translate(-50%)}.hx-run-swatch{box-sizing:border-box;border:var(--corn-border-strong) solid var(--corn-added);border-radius:50%;flex:none;width:14px;height:14px;display:inline-block}.hx-run-swatch--collision{border:var(--corn-border-strong) dashed var(--corn-map-collision)}", _r = () => ".hx-var{color:var(--corn-hue-pink);font-family:var(--corn-mono);font-size:var(--corn-text-2xs);background:color-mix(in srgb, var(--corn-ground) 55%, transparent);padding:0 var(--corn-space-1);border-radius:var(--corn-radius-xs)}.hx-drawer-title{font-family:var(--corn-font-display)}.hx-backdrop{z-index:40;background:var(--corn-scrim);backdrop-filter:blur(calc(var(--corn-blur) / 4));position:fixed;inset:0}@container corn-box (width>=768px){.hx-backdrop{display:none}}.hx-drawer{z-index:40;border-color:var(--corn-line);box-shadow:var(--corn-shadow-lg);pointer-events:none;touch-action:pan-y;flex-direction:column;transition:transform .2s ease-out;display:flex}.hx-drawer *{touch-action:pan-y}.hx-drawer.drawer-open{pointer-events:auto}.hx-drawer:not(.drawer-open){box-shadow:none}@container corn-box (width<=767px){.hx-drawer{border-radius:var(--corn-radius-lg) var(--corn-radius-lg) 0 0;z-index:auto;border-left:0;width:100%;position:relative;transform:none}.hx-drawer:not(.drawer-open){display:none}}@container corn-box (width>=768px){.hx-drawer{width:480px;position:absolute;top:0;bottom:0;right:0;transform:translate(100%)}.hx-drawer.drawer-open{transform:translate(0)}}.hx-drawer-handle{padding:var(--corn-space-3) 0 var(--corn-space-1);justify-content:center;display:flex}.hx-drawer-handle span{border-radius:var(--corn-radius-pill);background:var(--corn-surface-3);width:48px;height:6px}.hx-drawer-body{gap:var(--corn-space-5);padding:var(--corn-panel-pad);user-select:text;flex-direction:column;flex:1;display:flex;overflow-y:auto}.hx-drawer-head{justify-content:space-between;align-items:flex-start;gap:var(--corn-space-3);display:flex}.hx-drawer-title{font-size:var(--corn-text-lg);color:var(--corn-text);overflow-wrap:anywhere;font-weight:700}.hx-lead{font-size:var(--corn-text-base);color:var(--corn-text-2);line-height:1.5}.hx-block{gap:var(--corn-space-3);flex-direction:column;display:flex}.hx-meta{gap:var(--corn-space-5);font-size:var(--corn-text-md);color:var(--corn-text-2);overflow-wrap:anywhere;flex-direction:column;display:flex}.hx-meta>:empty{display:none}.hx-sec{margin-top:var(--corn-space-2);padding-top:var(--corn-space-2);border-top:var(--corn-border) solid var(--corn-line)}.hx-line{align-items:flex-start;gap:var(--corn-space-2);padding:calc(var(--corn-space-1) / 2) 0;display:flex}.hx-linkbtn{margin-left:var(--corn-space-1);color:var(--corn-hue-fuchsia);font-size:inherit;background:0 0;border:0;padding:0;text-decoration:underline}.hx-sim{gap:var(--corn-space-2);padding-top:var(--corn-space-1);font-family:var(--corn-font);flex-direction:column;display:flex}.hx-field-label{font-size:var(--corn-text-2xs);color:var(--corn-text-3)}.hx-field{width:100%;padding:var(--corn-space-1) var(--corn-space-3);border-radius:var(--corn-radius-sm);border:var(--corn-border) solid var(--corn-line);background:color-mix(in srgb, var(--corn-ground) 80%, transparent);color:var(--corn-text-2);font-family:var(--corn-mono);font-size:var(--corn-text-xs)}.hx-sim-result{font-size:var(--corn-text-xs)}.hx-error-text{padding-top:var(--corn-space-3);color:var(--corn-bad)}.hx-ms{text-align:right;width:56px;color:var(--corn-hue-fuchsia);flex:none}.hx-file{padding:calc(var(--corn-space-1) / 2) 0}.hx-sandbox{gap:var(--corn-space-4);padding:var(--corn-space-5);border-radius:var(--corn-radius);border:var(--corn-border) solid var(--corn-line);background:color-mix(in srgb, var(--corn-ground) 80%, transparent);flex-direction:column;display:flex}.hx-sandbox-title{font-size:var(--corn-text-2xs);text-transform:uppercase;letter-spacing:.05em;color:var(--corn-text-3);justify-content:space-between;align-items:center;font-weight:700;display:flex}.hx-sandbox-name{align-items:center;gap:var(--corn-space-2);display:flex}.hx-sandbox-stage{min-height:90px;padding:var(--corn-space-5);border-radius:var(--corn-radius-sm);border:var(--corn-border) dashed var(--corn-surface-2);background:var(--corn-ground);justify-content:center;align-items:center;display:flex;overflow-x:auto}.hx-sandbox-controls{gap:var(--corn-space-2);padding-top:var(--corn-space-3);border-top:var(--corn-border) solid var(--corn-line);font-size:var(--corn-text-xs);flex-direction:column;display:flex}.hx-ctl-row{align-items:center;gap:var(--corn-space-2);color:var(--corn-text-2);flex-wrap:wrap;display:flex}.hx-check{align-items:center;gap:var(--corn-space-1);margin-right:var(--corn-space-3);cursor:pointer;display:inline-flex}.hx-chip{padding:calc(var(--corn-space-1) / 2) var(--corn-space-3);border-radius:var(--corn-radius-xs);font-size:var(--corn-text-xs);color:var(--corn-text-on-accent);border:0;font-weight:500}.hx-chip--ghost{background:var(--corn-surface-2);color:var(--corn-text-2)}.hx-chip--outline{background:var(--corn-surface-2);color:var(--corn-accent-text)}.hx-chip--primary{background:var(--corn-accent)}.hx-chip--danger{background:var(--corn-bad)}.hx-chip--success{background:var(--corn-ok)}.hx-chip--warning{background:var(--corn-warn)}.hx-chip--danger,.hx-chip--success,.hx-chip--warning{color:var(--corn-ground)}.hx-drawer-foot{align-items:stretch;gap:var(--corn-space-3);padding:var(--corn-space-4) var(--corn-space-5) calc(var(--corn-space-4) + env(safe-area-inset-bottom,0px));border-top:var(--corn-border) solid var(--corn-line-soft);flex:none;display:flex}.hx-open{justify-content:center;align-items:center;gap:var(--corn-space-2);min-height:var(--hx-control-h);padding:0 var(--corn-space-4);border-radius:var(--corn-radius-sm);background:var(--corn-accent);color:var(--corn-text-on-accent);font-size:var(--corn-text-sm);text-align:center;flex:auto;font-weight:600;text-decoration:none;transition:background .15s;display:flex}.hx-open:hover{background:var(--corn-accent-hover)}.hx-proposal-sec{padding:var(--corn-space-3) var(--corn-space-3);border:var(--corn-border) solid var(--corn-line);border-left-width:var(--corn-border-strong);border-radius:var(--corn-radius-sm);background:color-mix(in srgb, var(--corn-ground) 55%, transparent);margin:0 0 var(--corn-space-2);font-family:var(--corn-font)}.hx-proposal-sec--added{border-left-color:var(--corn-added)}.hx-proposal-sec--changed{border-left-color:var(--corn-changed)}.hx-proposal-sec--removed{border-left-color:var(--corn-removed)}.hx-proposal-sec--edit{border-left-color:var(--corn-edit)}.hx-why{margin:var(--corn-space-1) 0 var(--corn-space-2);color:var(--corn-text-2);font-size:var(--corn-text-sm);line-height:1.5}.hx-change{align-items:baseline;gap:calc(var(--corn-space-1) / 2) var(--corn-space-3);padding:var(--corn-space-1) 0;border-top:var(--corn-border) solid var(--corn-line-soft);font-family:var(--corn-mono);font-size:var(--corn-text-xs);flex-wrap:wrap;display:flex}.hx-change-field{min-width:64px;color:var(--corn-text-3);flex:none}.hx-change-before{color:var(--corn-bad);text-decoration:line-through;text-decoration-color:color-mix(in srgb, var(--corn-bad) 50%, transparent);overflow-wrap:anywhere}.hx-change-arrow{color:var(--corn-text-3)}.hx-change-after{color:var(--corn-ok);overflow-wrap:anywhere}.hx-change em{color:var(--corn-text-3);text-decoration:none}.hx-mockup-list{margin:var(--corn-space-1) 0 0;gap:var(--corn-space-2);flex-direction:column;padding:0;list-style:none;display:flex}.hx-mockup-item{align-items:center;gap:var(--corn-space-1) var(--corn-space-3);flex-wrap:wrap;display:flex}.hx-mockup-open{white-space:normal;text-align:left;max-width:100%}.hx-mockup-state{font-size:var(--corn-text-xs);color:var(--corn-text-2);margin:0}.hx-mockup-state--approved{color:var(--corn-added-text)}.hx-mockup-state--changed{color:var(--corn-warn);font-weight:600}.hx-mockup-state--missing{color:var(--corn-bad)}@container corn-box (width<=767px){.hx-backdrop{display:none}.hx-drawer{max-height:60cqh}}.hx-cloud-browser{color:var(--corn-text-3);font-size:var(--corn-text-sm)}.hx-drawer-title:focus{outline:none}.hx-drawer-title:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-drawer-id{flex:1;min-width:0}.hx-kicker{margin:0 0 var(--corn-space-2);font-size:var(--corn-text-sm);color:var(--corn-text-3);flex-wrap:wrap;align-items:center;display:flex}.hx-kicker [data-corn=badge]{overflow-wrap:anywhere;min-width:0;max-width:100%}#drawer-host{white-space:pre}.hx-diffpill{margin-left:var(--corn-space-3);padding:0 var(--corn-space-3);border-radius:var(--corn-radius-pill);border:var(--corn-border) dashed var(--corn-added);color:var(--corn-added-text);font-size:var(--corn-text-xs)}.hx-drawer-id .hx-drawer-title.hx-mono{font-family:var(--corn-mono)}.hx-facts{gap:var(--corn-space-2);flex-direction:column;display:flex}.hx-fact{gap:var(--corn-space-4);grid-template-columns:96px minmax(0,1fr);display:grid}.hx-fact-k{color:var(--corn-text-3)}.hx-fact-v{min-width:0;color:var(--corn-text)}.hx-fact-v .hx-line{padding:0}.hx-fact-v .hx-name{color:var(--corn-text)}.hx-fact-v .hx-code{color:var(--corn-text-2);font-size:var(--corn-text-sm)}.hx-fact-v .hx-chips{padding-top:0}.hx-sec-block{gap:var(--corn-space-3);flex-direction:column;display:flex}.hx-sec-title{font-size:var(--corn-text-sm);color:var(--corn-text-3);margin:0;font-weight:600}.hx-drawer .hx-mockups{border:0;margin:0;padding:0}.hx-rows{gap:var(--corn-space-2);flex-direction:column;margin:0;padding:0;list-style:none;display:flex}.hx-row{align-items:center;gap:var(--corn-space-4);width:100%;min-height:36px;padding:var(--corn-space-3) var(--corn-space-4);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius-sm);background:var(--corn-surface-2);color:var(--corn-text);font:inherit;text-align:left;display:flex}.hx-row:hover{background:var(--corn-accent-soft)}.hx-row:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-row-title{overflow-wrap:anywhere;flex:1;min-width:0}.hx-row-meta{font-size:var(--corn-text-sm);color:var(--corn-text-3);font-variant-numeric:tabular-nums;flex:none}.hx-drawer .hx-mockup-list{margin:var(--corn-space-3) 0 0}.hx-drawer .hx-mockup-item{gap:var(--corn-space-4);padding:var(--corn-space-1) var(--corn-space-1) var(--corn-space-1) 0;border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius-sm);background:var(--corn-surface-2);flex-wrap:nowrap}.hx-drawer .hx-mockup-open{min-width:0;min-height:36px;color:var(--corn-text);background:0 0;border:0;flex:1;font-weight:400}.hx-drawer .hx-mockup-state{padding-right:var(--corn-space-3);color:var(--corn-text-3);flex:none}.hx-drawer .hx-mockup-state--approved{color:var(--corn-added-text)}.hx-drawer .hx-mockup-state--changed{color:var(--corn-warn)}.hx-drawer .hx-mockup-state--missing{color:var(--corn-bad)}.hx-textact{background:0 0;border:0;align-self:flex-start;padding-left:0}.hx-diff{gap:var(--corn-space-1) var(--corn-space-4);padding:var(--corn-space-1) 0 var(--corn-space-1) var(--corn-space-4);border-left:var(--corn-border-strong) solid var(--corn-changed);font-family:var(--corn-mono);font-size:var(--corn-text-sm);color:var(--corn-text-2);grid-template-columns:70px minmax(0,1fr);display:grid}.hx-diff--added{border-left-color:var(--corn-added)}.hx-diff--removed{border-left-color:var(--corn-removed)}.hx-diff--edit{border-left-color:var(--corn-edit)}.hx-diff-k{color:var(--corn-text-3)}.hx-diff-v{overflow-wrap:anywhere;min-width:0}.hx-drawer .hx-why{margin:0}.hx-drawer-foot .hx-open[hidden],.hx-drawer-foot .hx-foot-btn[hidden]{display:none}.hx-foot-btn{min-height:var(--hx-control-h);padding:0 var(--corn-space-4);justify-content:center}@container corn-box (width<=767px){.hx-drawer-foot{flex-direction:column}.hx-drawer-foot .hx-open,.hx-foot-btn,.hx-drawer .hx-row,.hx-drawer .hx-mockup-open,.hx-textact,.hx-drawer .hx-whatif-drawer .hx-btn,.hx-cloud-play{min-height:44px}.hx-drawer .hx-close{width:44px;height:44px}}.hx-cloud-play{align-self:flex-start}.hx-drawer-foot .hx-btn--quiet{background:0 0;border-color:#0000;text-decoration:none}.hx-more{display:contents}.hx-more[hidden]{display:none}.hx-more-btn{margin-top:var(--corn-space-1);min-height:0;font-size:var(--corn-text-sm);padding:0;display:block}@container corn-box (width<=767px){.hx-more-btn{min-height:44px}}.hx-drawer-body{scroll-padding-block:calc(var(--corn-focus-width) + var(--corn-focus-offset) + var(--corn-space-1))}.hx-ms,.hx-row-meta{font-family:var(--corn-font-num);font-variant-numeric:tabular-nums}@media (prefers-reduced-motion:reduce){.hx-drawer{transition:none;animation:none}}.hx-fact-v{overflow-wrap:break-word;word-break:normal}.hx-drawer-foot .hx-forge-result{flex-basis:100%}.hx-lines{gap:var(--corn-space-2);flex-direction:column;display:flex}.hx-lines .hx-chips{padding-top:0}.hx-lines-kind{align-items:baseline;gap:var(--corn-space-1);min-height:28px;padding:0 var(--corn-space-3);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius-pill);color:var(--corn-text-2);font:inherit;font-size:var(--corn-text-xs);cursor:pointer;background:0 0;font-weight:600;display:inline-flex}.hx-lines-kind:hover{background:var(--corn-surface-3);color:var(--corn-text)}.hx-lines-kind[aria-pressed=true]{border-color:var(--corn-accent);background:var(--corn-accent-soft);color:var(--corn-accent-text)}.hx-lines-kind:focus-visible,.hx-lines-switch input:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-lines-count{font-variant-numeric:tabular-nums;color:var(--corn-text-3)}.hx-lines-list{align-items:flex-start;gap:calc(var(--corn-space-1) / 2);flex-direction:column;display:flex}.hx-lines-list .hx-linkbtn{text-align:left;overflow-wrap:anywhere;margin-left:0}.hx-lines-switch{align-items:center;gap:var(--corn-space-2);min-height:28px;font-size:var(--corn-text-sm);color:var(--corn-text-2);cursor:pointer;display:flex}.hx-lines-reach{align-items:center;gap:var(--corn-space-3);font-size:var(--corn-text-sm);color:var(--corn-text-2);font-variant-numeric:tabular-nums;flex-wrap:wrap;display:flex}@container corn-box (width<=767px){.hx-lines-kind,.hx-lines-switch,.hx-lines-list .hx-linkbtn,.hx-lines-reach .hx-btn{min-height:44px}.hx-lines-kind{align-items:center}.hx-lines-switch input{width:24px;height:24px}}@media (pointer:coarse){.hx-lines-kind,.hx-lines-switch,.hx-lines-list .hx-linkbtn,.hx-lines-reach .hx-btn{min-height:44px}.hx-lines-kind{align-items:center}.hx-lines-switch input{width:24px;height:24px}}.hx-drawer-title{font-size:var(--corn-text-lg);letter-spacing:normal;font-weight:700;line-height:1.25}.hx-drawer-head{min-height:var(--corn-panel-head-height)}", vr = () => ".hx-menu--proposals{width:360px}.hx-proposal-list{gap:var(--corn-space-1);flex-direction:column;display:flex}.hx-proposal-empty{padding:var(--corn-space-3) calc(var(--corn-space-1) / 2);font-size:var(--corn-text-sm)}.hx-proposal-item{align-items:flex-start;gap:var(--corn-space-1);width:100%;padding:var(--corn-space-3) var(--corn-space-3);border-radius:var(--corn-radius);border:var(--corn-border) solid var(--corn-line);background:var(--corn-surface-2);color:var(--corn-text);text-align:left;font-size:var(--corn-text-xs);flex-direction:column;display:flex}button.hx-proposal-item:hover{background:var(--corn-surface-3)}button.hx-proposal-item:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-proposal-item.is-current{border-color:var(--corn-added-text);background:color-mix(in srgb, var(--corn-added) 12%, transparent)}.hx-proposal-item.is-broken{opacity:.8;cursor:default}.hx-proposal-title{font-size:var(--corn-text-sm);color:var(--corn-text);overflow-wrap:anywhere;font-weight:600}.hx-proposal-sum{color:var(--corn-text-2);line-height:1.4}.hx-proposal-meta{gap:calc(var(--corn-space-1) / 2) var(--corn-space-3);color:var(--corn-text-3);font-size:var(--corn-text-2xs);flex-wrap:wrap;display:flex}.hx-proposal-where{color:var(--corn-added-text)}.hx-proposal-bar{width:min(960px,100% - 24px);padding:var(--corn-space-3) var(--corn-space-3);border-radius:var(--corn-radius-lg);font-size:var(--corn-text-sm);z-index:15;user-select:text;position:absolute;top:48px;left:12px}.hx-proposal-bar.is-error{border-color:color-mix(in srgb, var(--corn-removed) 50%, transparent)}.hx-proposal-message{color:var(--corn-text-2)}.hx-proposal-bar.is-error .hx-proposal-message{color:var(--corn-bad)}.hx-proposal-count:focus-visible,.hx-proposal-mode:focus-visible,.hx-seg-btn:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-proposal-summary{margin-top:var(--corn-space-2);color:var(--corn-text-2);line-height:1.5}.hx-seg{padding:calc(var(--corn-space-1) / 2);border-radius:var(--corn-radius-sm);border:var(--corn-border) solid var(--corn-line);background:color-mix(in srgb, var(--corn-ground) 55%, transparent);display:inline-flex}.hx-seg-btn{height:var(--hx-seg-inner);padding:0 var(--corn-space-4);border-radius:var(--corn-radius-sm);color:var(--corn-text-3);font-size:var(--corn-text-sm);background:0 0;border:0;font-weight:500}.hx-seg-btn:hover{color:var(--corn-text)}.hx-seg-btn.is-on,.hx-seg-btn[aria-pressed=true]{background:var(--corn-accent);color:var(--corn-text-on-accent)}.hx-proposal-errors{margin-top:var(--corn-space-2);padding:var(--corn-space-2) var(--corn-space-3);border-radius:var(--corn-radius-sm);background:color-mix(in srgb, var(--corn-removed) 10%, transparent);border:var(--corn-border) solid color-mix(in srgb, var(--corn-removed) 30%, transparent);color:var(--corn-text-2)}.hx-proposal-errors summary{cursor:pointer;color:var(--corn-bad);font-weight:600}.hx-proposal-errors ul{margin:var(--corn-space-2) 0 var(--corn-space-1);padding-left:var(--corn-space-5);line-height:1.5}.hx-proposal-errors p{margin-top:var(--corn-space-1);font-size:var(--corn-text-xs)}@container corn-box (width>=768px){.hx-stage:has(.drawer-open) .hx-proposal-bar{width:min(960px,100% - 504px)}}@container corn-box (width<=639px){.hx-menu--proposals{width:auto;max-width:none;position:fixed;top:60px;left:12px;right:12px}}.hx-proposal-reviewed{color:var(--corn-added-text)}.hx-proposal-head{align-items:center;gap:var(--corn-space-3) var(--corn-space-4);flex-wrap:wrap;display:flex}.hx-proposal-name{text-overflow:ellipsis;white-space:nowrap;min-width:0;max-width:28ch;color:var(--corn-text);flex:0 auto;overflow:hidden}.hx-proposal-counts{display:contents}.hx-proposal-chip{color:var(--corn-text-2);font-size:var(--corn-text-sm);font-variant-numeric:tabular-nums;white-space:nowrap;flex-wrap:wrap;align-items:center;display:inline-flex}.hx-proposal-count{min-height:var(--hx-control-h);padding:var(--corn-space-1) var(--corn-space-2);border-radius:var(--corn-radius-sm);color:inherit;font:inherit;white-space:inherit;cursor:pointer;background:0 0;border:0;align-items:center;display:inline-flex}.hx-proposal-count:hover{color:var(--corn-text);text-decoration:underline}.hx-proposal-peek{margin:0;display:none}.hx-proposal-chip .hx-mark-dot{margin:0 var(--corn-space-2) 0 0}h2.hx-proposal-name{margin:0}.hx-proposal-sep{margin:0 var(--corn-space-2);color:var(--corn-text-3)}.hx-proposal-mode{display:none}.hx-proposal-tools{align-items:center;gap:var(--corn-space-3);display:flex}.hx-proposal-tools .hx-btn{height:var(--hx-control-h);font-size:var(--corn-text-sm);font-weight:500}#proposal-edit.hx-btn--active{background:var(--corn-edit-text);border-color:var(--corn-edit);color:var(--corn-ground)}.hx-proposal-more{position:relative}.hx-proposal-more .hx-btn--icon{width:var(--hx-control-h);height:var(--hx-control-h);color:var(--corn-text-3);background:0 0;border-color:#0000}.hx-proposal-more .hx-btn--icon:hover,.hx-proposal-more .hx-btn--icon[aria-expanded=true]{background:var(--corn-surface-3);color:var(--corn-text)}.hx-proposal-more-menu{z-index:20;min-width:160px;margin-top:var(--corn-space-2);padding:var(--corn-space-2);border-radius:var(--corn-radius);border:var(--corn-border) solid var(--corn-line);box-shadow:var(--corn-shadow);flex-direction:column;display:flex;position:absolute;top:100%;right:0}.hx-proposal-more-menu[hidden]{display:none}.hx-proposal-more-menu .hx-btn{width:100%;height:var(--hx-control-h);color:var(--corn-text-2);font-size:var(--corn-text-sm);background:0 0;border-color:#0000}.hx-proposal-more-menu .hx-btn:hover{background:var(--corn-surface-3);color:var(--corn-text)}@container corn-box (width<=767px){.hx-proposal-head{gap:var(--corn-space-2) var(--corn-space-3);grid-template-columns:1fr auto;display:grid}.hx-proposal-name{order:1;grid-column:1/-1;max-width:none}.hx-proposal-counts{align-items:center;column-gap:var(--corn-space-2);flex-wrap:wrap;order:2;grid-column:1/-1;display:flex}.hx-proposal-count,.hx-proposal-mode{min-height:44px}.hx-proposal-mode{align-items:center;gap:var(--corn-space-2);padding:0 var(--corn-space-3);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius-sm);background:var(--corn-surface-2);color:var(--corn-text);font-size:var(--corn-text-sm);font-weight:600;display:inline-flex}.hx-proposal-mode:after{content:\"\";background:currentColor;width:10px;height:10px;-webkit-mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 3.5l3 3 3-3'/%3E%3C/svg%3E\") 50%/contain no-repeat;mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 3.5l3 3 3-3'/%3E%3C/svg%3E\") 50%/contain no-repeat}.hx-proposal-mode[aria-expanded=true]:after{transform:rotate(180deg)}.hx-seg{order:3;grid-column:1/-1}.hx-proposal-bar:not([data-mode-open=true]) .hx-seg{display:none}.hx-seg-btn{height:var(--hx-seg-inner);font-size:var(--corn-text-md);flex:1}.hx-proposal-tools{order:5}.hx-proposal-tools .hx-btn{height:auto;min-height:44px;padding:0 var(--corn-space-5);font-size:var(--corn-text-md)}.hx-proposal-more{display:contents}.hx-proposal-more .hx-btn--icon{width:var(--hx-control-h);height:var(--hx-control-h);order:6}.hx-proposal-more-menu{box-shadow:none;order:7;grid-column:1/-1;position:static}.hx-proposal-more-menu .hx-btn{height:auto;min-height:44px;font-size:var(--corn-text-md)}.hx-proposal-bar{max-height:50cqh;padding:0 var(--corn-space-4) var(--corn-space-3);overflow-y:auto}}@container corn-box (width>=768px){.hx-stage:has(.forge-open) .hx-proposal-bar{left:calc(var(--hx-forge-w) + 12px);width:min(960px, calc(100% - var(--hx-forge-w) - 36px))}.hx-stage:has(.forge-open):has(.drawer-open) .hx-proposal-bar{width:min(960px, calc(100% - var(--hx-forge-w) - 540px))}}.hx-proposal-bar{scroll-padding-block:calc(var(--corn-focus-width) + var(--corn-focus-offset) + var(--corn-space-1))}@media (forced-colors:active){.hx-proposal-mode:after{background:canvastext}}.hx-proposal-source{min-width:0;max-width:100%;padding:calc(var(--corn-space-1) / 2) var(--corn-space-3);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius-pill);background:var(--corn-surface-2);color:var(--corn-text-2);font-size:var(--corn-text-xs);overflow-wrap:anywhere;align-items:center;line-height:1.4;text-decoration:none;display:inline-flex}.hx-proposal-source[hidden]{display:none}a.hx-proposal-source{min-height:24px}a.hx-proposal-source:hover{color:var(--corn-text);text-decoration:underline}a.hx-proposal-source:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-proposal-source[data-corn-state=draft]{border-color:color-mix(in srgb, var(--corn-changed) 50%, transparent)}.hx-proposal-ways{gap:var(--corn-space-2) var(--corn-space-3);margin-top:var(--corn-space-3);flex-wrap:wrap;display:flex}.hx-proposal-ways[hidden]{display:none}.hx-proposal-ways .hx-btn{height:auto;min-height:32px;padding:var(--corn-space-1) var(--corn-space-4);white-space:normal;text-align:left}@container corn-box (width<=767px){.hx-proposal-source{order:1;grid-column:1/-1;justify-self:start}.hx-proposal-ways .hx-btn,a.hx-proposal-source{min-height:44px}.hx-proposal-source{background:0 0;border:0;border-radius:0;padding:0}a.hx-proposal-source{text-underline-offset:3px;text-decoration:underline}.hx-proposal-bar:has(.hx-review-form:not([hidden])) :is(.hx-proposal-name,.hx-proposal-source,.hx-proposal-counts,.hx-proposal-tools,.hx-proposal-more,.hx-review-status,.hx-review-line,.hx-rc-scroll,.hx-rc-tabs,.hx-proposal-peek){display:none}.hx-proposal-bar{overflow-wrap:anywhere;overflow-x:hidden}.hx-proposal-head{grid-template-columns:minmax(0,1fr) auto}.hx-proposal-chip{white-space:normal;text-align:left;flex-wrap:wrap;max-width:100%}.hx-proposal-counts{min-width:0}.hx-proposal-chip{white-space:normal;text-align:left;flex-wrap:wrap}.hx-proposal-count{white-space:normal;text-align:left}}@media (pointer:coarse){.hx-proposal-chip{white-space:normal;text-align:left;flex-wrap:wrap}.hx-proposal-count{white-space:normal;text-align:left}}.hx-proposal-summary{-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;flex:none;margin:0;display:-webkit-box;overflow:hidden}@container corn-box (width<=767px){.hx-proposal-summary{display:none}}.hx-waiting-line{align-items:center;gap:var(--corn-space-2) var(--corn-space-3);margin:var(--corn-space-2) 0 0;padding:var(--corn-space-1) var(--corn-space-3);border-left:calc(var(--corn-border-strong) * 2) solid var(--corn-run-waiting);border-radius:var(--corn-radius-sm);background:var(--corn-surface-2);color:var(--corn-text);overflow-wrap:anywhere;flex-wrap:wrap;line-height:1.4;display:flex}.hx-waiting-line[hidden]{display:none}@container corn-box (width<=767px){.hx-waiting-line .hx-btn{min-width:44px;min-height:44px}}.hx-proposal-yours{align-items:center;gap:var(--corn-space-1);color:var(--corn-text-2);display:inline-flex}.hx-proposal-tools [aria-pressed=false]:not([data-corn=whole-map]){opacity:.8}.hx-proposal-name{font-size:var(--corn-text-lg);letter-spacing:normal;font-weight:700;line-height:1.25}@container corn-box (width>=768px){.hx-proposal-tools{display:contents}.hx-proposal-name,.hx-proposal-source{order:-2}:where(.hx-proposal-head) [data-corn=whole-map]{margin-block:calc((var(--corn-space-6) - var(--hx-control-h)) / 2);order:-1}}", yr = () => ".hx-change-row:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-change-row{align-items:center;gap:var(--corn-space-3);width:100%;padding:var(--corn-space-1) var(--corn-space-2);border-radius:var(--corn-radius-sm);text-align:left;font-size:var(--corn-text-xs);background:0 0;border:0;display:flex}.hx-change-row:hover{background:var(--corn-line-soft)}.hx-change-what{width:56px;color:var(--corn-text-3);flex:none}.hx-change-row .hx-name{overflow-wrap:anywhere;min-width:0}.hx-change-row .hx-mark-dot{margin-right:0}.hx-player{left:calc(var(--hx-col-w,0px) + 24px);align-items:center;gap:var(--corn-space-2) var(--corn-space-4);padding:var(--corn-space-3) var(--corn-space-4);border-radius:var(--corn-radius-lg);z-index:25;flex-wrap:wrap;display:flex;position:absolute;bottom:12px;right:12px;overflow:hidden}.hx-player .hx-close{width:var(--hx-control-h);height:var(--hx-control-h);font-size:var(--corn-text-sm)}.hx-player-speed{height:var(--hx-control-h);padding:0 var(--corn-space-2);border-radius:var(--corn-radius-sm);border:var(--corn-border) solid var(--corn-line);background:color-mix(in srgb, var(--corn-ground) 80%, transparent);color:var(--corn-text);font:inherit;font-size:var(--corn-text-sm);cursor:pointer;flex:none}.hx-player-speed:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:calc(var(--corn-focus-offset) / 2)}.hx-player-text{min-width:0;font-size:var(--corn-text-base);color:var(--corn-text);user-select:text;overflow-wrap:anywhere;flex:18em;margin:0;line-height:1.4}.hx-player-who{color:var(--corn-text-2);font-weight:600}.hx-player-text .hx-player-verdict{margin-left:var(--corn-space-2)}.hx-player-count{color:var(--corn-accent-text);white-space:nowrap;font-weight:600}.hx-player-controls{gap:var(--corn-space-3);flex:none;display:flex}.hx-player-side{align-items:center;gap:var(--corn-space-3);flex:none;margin-left:auto;display:flex}.hx-player-controls .hx-btn{white-space:nowrap;justify-content:center}.hx-player-controls .hx-btn[hidden]{display:none}.hx-player-prev:before{content:\"◀\" / \"\";margin-right:var(--corn-space-2)}.hx-player-next:after{content:\"▶\" / \"\";margin-left:var(--corn-space-2)}.hx-player-toggle[data-state=playing]:before{content:\"\" / \"\";box-sizing:border-box;width:1em;height:1em;margin-right:var(--corn-space-2);border-left:calc(var(--corn-border-strong) * 1.5) solid currentColor;border-right:calc(var(--corn-border-strong) * 1.5) solid currentColor;display:inline-block}.hx-player-toggle[data-state=paused]:before{content:\"▶\" / \"\";margin-right:var(--corn-space-2)}.hx-player-toggle[data-state=done]:before{content:\"↻\" / \"\";margin-right:var(--corn-space-2)}.hx-player-controls .hx-btn:disabled{opacity:.4;cursor:default}.hx-player-track{background:var(--corn-line-soft);height:3px;position:absolute;bottom:0;left:0;right:0}.hx-player-fill{background:var(--corn-accent-text);width:0;height:100%;display:block}@container corn-box (width<=767px){.hx-player{gap:0 var(--corn-space-3);max-height:50cqh;padding:0 var(--corn-space-4) var(--corn-space-3);--sheet-pb:var(--corn-space-3);flex-wrap:wrap;position:relative;bottom:auto;left:auto;right:auto;overflow:hidden}}.hx-player-verdict{padding:calc(var(--corn-space-1) / 2) var(--corn-space-3);border-radius:var(--corn-radius-pill);font-size:var(--corn-text-xs);white-space:nowrap;border:var(--corn-border) solid var(--corn-line);color:var(--corn-text-2);background:color-mix(in srgb, var(--corn-text-3) 12%, transparent);flex:none;font-weight:600}.hx-player-check{padding:var(--corn-space-2) var(--corn-space-3);border-radius:var(--corn-radius-sm);font-size:var(--corn-text-md);color:var(--corn-text-2);background:color-mix(in srgb, var(--corn-text-3) 10%, transparent);border-left:var(--corn-border-strong) solid color-mix(in srgb, var(--corn-text-3) 50%, transparent);user-select:text;margin:0;line-height:1.4}.hx-player-check-detail{font-size:var(--corn-text-xs);color:var(--corn-text-3);display:block}.hx-player-verdict[data-tone=allowed],.hx-player-check[data-tone=allowed]{color:var(--corn-ok);background:var(--corn-ok-soft);border-color:color-mix(in srgb, var(--corn-ok) 60%, transparent)}.hx-player-verdict[data-tone=refused],.hx-player-check[data-tone=refused]{color:var(--corn-bad);background:color-mix(in srgb, var(--corn-removed) 16%, transparent);border-color:color-mix(in srgb, var(--corn-removed) 70%, transparent)}.hx-player-verdict[data-tone=mismatch],.hx-player-check[data-tone=mismatch]{color:var(--corn-warn);background:color-mix(in srgb, var(--corn-changed) 16%, transparent);border-color:color-mix(in srgb, var(--corn-changed) 70%, transparent)}.hx-player-verdict[data-tone=pending]{opacity:.75}.hx-player-as{align-items:center;gap:var(--corn-space-3);font-size:var(--corn-text-sm);color:var(--corn-text-2);flex-wrap:wrap;display:flex}.hx-player-as-label{align-items:center;gap:var(--corn-space-2);display:inline-flex}.hx-player-as .hx-btn{padding:var(--corn-space-1) var(--corn-space-3);font-size:var(--corn-text-sm)}.hx-player-as .hx-btn:disabled{opacity:.4;cursor:default}.hx-player-as-sum{font-size:var(--corn-text-xs);margin-left:auto}.hx-player-as[hidden],.hx-player-verdict[hidden],.hx-player-check[hidden]{display:none}.hx-rc-scroll{scroll-padding-block:calc(var(--corn-focus-width) + var(--corn-focus-offset) + var(--corn-space-1))}.hx-player-count{font-family:var(--corn-font-num);font-variant-numeric:tabular-nums}@container corn-box (width<=767px){.hx-player-controls .hx-btn{min-width:44px;min-height:44px;padding:0 var(--corn-space-3);white-space:nowrap}.hx-player-prev .hx-player-label,.hx-player-next .hx-player-label,.hx-player-toggle .hx-player-label{clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0;padding:0;position:absolute;overflow:hidden}.hx-player-prev:before,.hx-player-next:after,.hx-player-toggle:before{margin:0}.hx-player-next-scenario{font-size:var(--corn-text-sm)}.hx-player-controls{gap:var(--corn-space-2)}}.hx-change-row{min-height:28px}@container corn-box (width<=767px){.hx-change-row,.hx-sc-row,.hx-step,.hx-rc-tab,.hx-player-speed,.hx-player .hx-close{min-height:44px}.hx-player-speed,.hx-player .hx-close{min-width:44px}}@media (pointer:coarse){.hx-change-row,.hx-sc-row,.hx-step,.hx-rc-tab,.hx-player-speed,.hx-player .hx-close{min-height:44px}.hx-player-speed,.hx-player .hx-close{min-width:44px}}.hx-review-column{bottom:12px;left:12px;top:var(--hx-column-top,150px);z-index:14;border-radius:var(--corn-radius-lg);width:400px;font-size:var(--corn-text-sm);user-select:text;flex-direction:column;display:flex;position:absolute;overflow:hidden}.hx-review-column[hidden]{display:none}@container corn-box (width<=1023px){.hx-review-column{width:320px}}@container corn-box (width>=1280px){.hx-stage:has(.forge-open) .hx-review-column{left:calc(var(--hx-forge-w) + 12px)}}@container corn-box (width>=768px) and (width<=1023px){.hx-stage:has(.drawer-open) .hx-review-column{width:min(320px,100% - 504px)}}.hx-rc-scroll{gap:var(--corn-space-2);min-height:0;padding:var(--corn-space-3) var(--corn-space-4);flex-direction:column;flex:1;display:flex;overflow:hidden}.hx-rc-lists{gap:var(--corn-space-4);flex-direction:column;flex:1;min-height:0;display:flex}.hx-rc-section{flex-direction:column;min-height:0;display:flex}#rc-changes{max-height:var(--hx-changes-max,40%);flex:0 auto}#rc-scenarios{min-height:min(12em, var(--hx-scenarios-need,12em));flex:1 1 0}.hx-change-list,.hx-rc-sbody{min-height:0;scroll-padding-block:var(--corn-space-2);overflow-y:auto}.hx-rc-h{flex:none}.hx-rc-tabs{gap:var(--corn-space-2);display:flex}.hx-rc-tabs[hidden]{display:none}.hx-rc-tab{min-height:var(--hx-control-h);padding:0 var(--corn-space-3);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius-sm);color:var(--corn-text-3);font:inherit;cursor:pointer;background:0 0;flex:1;font-weight:600}.hx-rc-tab[aria-selected=true]{background:var(--corn-accent);border-color:var(--corn-accent);color:var(--corn-text-on-accent)}.hx-rc-tab:focus-visible,.hx-sc-row:focus-visible,.hx-step:focus-visible,.hx-rc-h:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-rc-section[hidden]{display:none}.hx-rc-h{margin:0 0 var(--corn-space-2);font-size:var(--corn-text-sm);color:var(--corn-text);font-weight:700}.hx-rc-h [data-corn=count]{color:var(--corn-text-3);font-variant-numeric:tabular-nums}.hx-rc-empty,.hx-rc-note,.hx-rc-coverage{margin:var(--corn-space-2) 0 0;line-height:1.5}.hx-rc-coverage{color:var(--corn-text-2)}.hx-change-list,.hx-sc-list,.hx-steps{margin:0;padding:0;list-style:none}.hx-change-list{gap:calc(var(--corn-space-1) / 2);flex-direction:column;display:flex}.hx-persona{margin-top:var(--corn-space-4)}.hx-persona:first-of-type{margin-top:0}.hx-persona-name{margin:0 0 var(--corn-space-1);font-size:var(--corn-text-xs);letter-spacing:.02em;color:var(--corn-text-3);overflow-wrap:anywhere;font-weight:600}.hx-sc-list{gap:var(--corn-space-1);flex-direction:column;display:flex}.hx-sc-row{align-items:flex-start;gap:var(--corn-space-3);width:100%;padding:var(--corn-space-2) var(--corn-space-2);border:var(--corn-border) solid var(--corn-line-soft);border-radius:var(--corn-radius-sm);color:var(--corn-text);font:inherit;text-align:left;cursor:pointer;background:0 0;display:flex}.hx-sc-row:hover{background:color-mix(in srgb, var(--corn-accent-hover) 18%, transparent)}.hx-sc-caret{width:1em;color:var(--corn-text-3);flex:none}.hx-sc-main{gap:calc(var(--corn-space-1) / 2);flex-direction:column;flex:1;min-width:0;display:flex}.hx-sc-title{overflow-wrap:anywhere;font-weight:600}.hx-sc-meta{font-size:var(--corn-text-xs);color:var(--corn-text-3)}.hx-sc-seen{font-size:var(--corn-text-xs);color:var(--corn-added-text);white-space:nowrap;flex:none}.hx-steps{margin:var(--corn-space-1) 0 var(--corn-space-2) var(--corn-space-4);gap:calc(var(--corn-space-1) / 2);flex-direction:column;display:flex}.hx-steps[hidden]{display:none}.hx-step{align-items:flex-start;gap:var(--corn-space-3);width:100%;padding:var(--corn-space-2) var(--corn-space-2);border:0;border-left:var(--corn-border-strong) solid transparent;border-radius:var(--corn-radius-sm);color:var(--corn-text);font:inherit;font-size:var(--corn-text-xs);text-align:left;cursor:pointer;background:0 0;display:flex}.hx-step:hover{background:var(--corn-line-soft)}.hx-step[aria-current=step]{border-left-color:var(--corn-accent-text);background:color-mix(in srgb, var(--corn-accent-hover) 22%, transparent)}.hx-step-n{min-width:1.4em;color:var(--corn-accent-text);font-variant-numeric:tabular-nums;flex:none;font-weight:600}.hx-step-body{gap:calc(var(--corn-space-1) / 2);flex-direction:column;flex:1;min-width:0;display:flex}.hx-step-line{align-items:baseline;gap:0 var(--corn-space-3);flex-wrap:wrap;display:flex}.hx-step-who{color:var(--corn-text-2);font-weight:600}.hx-step-where{overflow-wrap:anywhere;font-weight:600}.hx-step-mark{align-items:center;gap:var(--corn-space-1);color:var(--corn-text-3);display:inline-flex}.hx-step-mark .hx-mark-dot{margin:0}.hx-step-text{color:var(--corn-text-2);overflow-wrap:anywhere;line-height:1.4}.hx-step-off{color:var(--corn-text-3);font-style:italic}.hx-step-verdict{white-space:normal;text-align:right;overflow-wrap:anywhere;align-self:flex-start;max-width:40%}@container corn-box (width<=767px){.hx-review-column{width:auto;max-height:none;box-shadow:none;-webkit-backdrop-filter:none;background:0 0;border:0;border-radius:0;position:static;overflow:visible}.hx-rc-scroll,.hx-rc-lists,.hx-rc-section,.hx-change-list,.hx-rc-sbody{min-height:0;max-height:none;display:block;overflow:visible}.hx-rc-scroll{padding:var(--corn-space-2) 0}.hx-rc-section[hidden]{display:none}#rc-changes,#rc-scenarios{flex:none;min-height:0;max-height:none}.hx-rc-lists{flex-direction:column;display:flex}.hx-change-list{display:flex}.hx-step,.hx-sc-row,.hx-rc-tab{min-height:44px}.hx-step-verdict{max-width:45%}}@container corn-box (width>=768px){.hx-stage:has(.drawer-open) .hx-player{right:504px}}.hx-player-as,.hx-player-check{flex:1 0 100%}.hx-player-speed[data-corn=control]{color:var(--corn-text)}.hx-rc-sub{margin:var(--corn-space-2) 0 var(--corn-space-1);font-size:var(--corn-text-sm);color:var(--corn-text);font-weight:600}", br = () => ".hx-review{gap:var(--corn-space-2);flex-direction:column;flex:1 0 100%;order:1;display:flex}.hx-review[hidden],.hx-review:not(:has(>:not([hidden]))){display:none}.hx-review-form{gap:var(--corn-space-2);flex-direction:column;display:flex}.hx-review-form[hidden]{display:none}.hx-review-label{color:var(--corn-text-3);font-size:var(--corn-text-xs)}.hx-review-note{resize:vertical;width:100%;min-height:44px;padding:var(--corn-space-2) var(--corn-space-3);border-radius:var(--corn-radius-sm);border:var(--corn-border) solid var(--corn-line);background:color-mix(in srgb, var(--corn-ground) 80%, transparent);color:var(--corn-text);font:inherit;font-size:var(--corn-text-sm);user-select:text;line-height:1.4}.hx-review-note:focus{outline:var(--corn-focus-width) solid var(--corn-added-text);outline-offset:calc(var(--corn-focus-offset) / 2)}.hx-review-row{align-items:center;gap:var(--corn-space-2) var(--corn-space-3);flex-wrap:wrap;display:flex}.hx-btn--approve{border-color:color-mix(in srgb, var(--corn-added) 50%, transparent);color:var(--corn-added-text)}.hx-btn--approve:hover{background:color-mix(in srgb, var(--corn-added) 20%, transparent);color:var(--corn-added-text)}.hx-review-status{color:var(--corn-added-text);font-variant-numeric:tabular-nums;margin:0}.hx-review-status[hidden],.hx-review-msg[hidden],.hx-review-line[hidden]{display:none}.hx-review-msg{padding:var(--corn-space-1) var(--corn-space-3);border-radius:var(--corn-radius-sm);background:color-mix(in srgb, var(--corn-removed) 12%, transparent);border:var(--corn-border) solid color-mix(in srgb, var(--corn-removed) 35%, transparent);color:var(--corn-bad);margin:0;line-height:1.4}.hx-review-line{color:var(--corn-text-2);margin:0;line-height:1.4}.hx-proposal-actions{align-items:center;gap:var(--corn-space-3);margin-left:auto;display:flex}.hx-proposal-actions .hx-btn{height:var(--hx-control-h);padding:0 var(--corn-space-5);font-size:var(--corn-text-sm);justify-content:center;font-weight:500}.hx-proposal-actions .hx-btn--approve,.hx-proposal-actions .hx-btn--approve:hover{background:var(--corn-accent);border-color:var(--corn-accent);color:var(--corn-text-on-accent);font-weight:600}.hx-proposal-actions .hx-btn:disabled{opacity:.4;cursor:default}@container corn-box (width<=767px){.hx-review{order:3;grid-column:1/-1}.hx-proposal-actions{gap:var(--corn-space-3);order:4;grid-column:1/-1;grid-template-columns:1fr 1fr;margin-left:0;display:grid}.hx-proposal-actions .hx-btn{height:auto;min-height:44px;padding:var(--corn-space-2) var(--corn-space-3);white-space:normal;text-align:center;font-size:var(--corn-text-md)}.hx-review .hx-btn{min-height:44px}}.hx-forge-cta .hx-btn--approve{flex:1}@container corn-box (width<=767px){.hx-proposal-bar:has(.hx-review-form:not([hidden])) .hx-proposal-actions{order:4;grid-template-columns:1fr}.hx-proposal-bar:has(.hx-review-form:not([hidden])) .hx-proposal-actions .hx-btn--approve{display:none}}.hx-rc-foot{gap:var(--corn-space-2);padding:var(--corn-space-3) var(--corn-space-4);border-top:var(--corn-border) solid var(--corn-line);flex-direction:column;flex:none;display:flex}.hx-rc-foot .hx-review{flex:none;order:0}.hx-rc-foot .hx-proposal-actions{margin-left:auto}@container corn-box (width<=767px){.hx-rc-foot{padding:var(--corn-space-3) 0 0}.hx-rc-foot .hx-proposal-actions{width:100%;margin-left:0}}.hx-decision-line{color:var(--corn-text-2);font-size:var(--corn-text-sm);margin:0;line-height:1.5}.hx-decision-line[hidden],.hx-review-ask[hidden],.hx-hold[hidden],.hx-review-landing[hidden],.hx-sent-edits[hidden]{display:none}.hx-review-ask{padding:var(--corn-space-2) var(--corn-space-3);border-radius:var(--corn-radius-sm);border:var(--corn-border) solid color-mix(in srgb, var(--corn-warn) 55%, transparent);background:color-mix(in srgb, var(--corn-warn) 14%, transparent);color:var(--corn-text);margin:0;line-height:1.4}.hx-review-landing{justify-content:space-between;align-items:center;gap:var(--corn-space-3);padding:var(--corn-space-2) var(--corn-space-3);border-radius:var(--corn-radius-sm);border:var(--corn-border) solid var(--corn-line);color:var(--corn-text-2);display:flex}.hx-review-landing p{margin:0;line-height:1.4}.hx-sent-edits{color:var(--corn-text-2)}.hx-sent-edits summary{cursor:pointer;min-height:24px}.hx-hold{border-radius:var(--corn-radius-sm);background:color-mix(in srgb, var(--corn-accent) 22%, transparent);height:3px;overflow:hidden}.hx-hold-fill{background:var(--corn-accent);transform-origin:0;width:100%;height:100%;animation-name:hx-hold-drain;animation-timing-function:linear;animation-fill-mode:forwards;display:block}@keyframes hx-hold-drain{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.hx-proposal-actions .hx-btn[aria-disabled=true]{opacity:.55;cursor:default}.hx-proposal-actions .hx-btn[data-holding=true]{opacity:1;font-variant-numeric:tabular-nums}.hx-review-undo[hidden]{display:none}@container corn-box (width<=767px){.hx-review-undo{order:1;grid-column:1/-1;min-width:44px;min-height:44px}.hx-review-landing .hx-btn{min-height:44px}.hx-proposal-bar:has(.hx-review-form:not([hidden])) .hx-decision-line{display:none}}@media (prefers-reduced-motion:reduce){.hx-hold{display:none}.hx-hold-fill{animation:none}}", xr = () => ".hx-dock{display:contents}.hx-sheet-handle{display:none}@keyframes hx-sheet-in{0%{opacity:0;transform:translateY(28px)}}@container corn-box (width<=767px){.hx-dock{z-index:45;pointer-events:none;flex-direction:column;justify-content:flex-end;display:flex;position:absolute;bottom:0;left:0;right:0}.hx-dock>*{pointer-events:auto}.hx-dock>.hx-sheet{border-radius:var(--corn-radius-lg) var(--corn-radius-lg) 0 0;width:100%;max-width:none;box-shadow:var(--corn-shadow-sheet);overscroll-behavior:contain;--sheet-pb:var(--corn-space-3);border-bottom:0;margin:0;animation:.2s ease-out hx-sheet-in;position:relative;inset:auto;transform:none}.hx-dock>.hx-sheet[data-sheet-last]:not(.hx-drawer){padding-bottom:calc(var(--sheet-pb) + env(safe-area-inset-bottom,0px))}.hx-sheet-handle{cursor:grab;touch-action:none;background:0 0;border:0;flex:none;justify-content:center;align-items:center;width:100%;height:22px;padding:0;display:flex}.hx-sheet-handle span{border-radius:var(--corn-radius-pill);background:var(--corn-surface-3);width:40px;height:5px}.hx-sheet-handle:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:calc(var(--corn-focus-width) * -1);border-radius:var(--corn-radius)}.hx-player>.hx-sheet-handle{flex:0 0 100%}}@media (prefers-reduced-motion:reduce){.hx-dock>.hx-sheet{animation:none}.hx-sheet,.hx-dock>.hx-sheet{transition:none;animation:none}}@container corn-box (width<=767px){.hx-sheet-handle{height:44px}}@media (pointer:coarse){.hx-sheet-handle{height:44px}}.hx-sheet-stub{display:none}@container corn-box (width<=767px){.hx-dock>.hx-sheet[data-sheet-away]{display:none}.hx-dock>.hx-sheet[data-sheet-state=stub]{min-height:44px;max-height:44px;padding-top:0;padding-bottom:0;overflow:hidden}.hx-dock>.hx-sheet[data-sheet-state=stub]>:not(.hx-sheet-stub){display:none!important}.hx-sheet-stub{align-items:center;gap:var(--corn-space-3);width:100%;min-height:44px;padding:0 var(--corn-space-1);color:var(--corn-text);font:inherit;text-align:left;background:0 0;border:0;font-weight:600;display:flex}.hx-sheet-stub[hidden]{display:none}.hx-sheet-stub:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:calc(var(--corn-focus-width) * -1);border-radius:var(--corn-radius)}.hx-sheet-stub-title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.hx-proposal-bar[data-sheet-state=peek] .hx-review>:not([data-review-hint]):not([data-review-msg]):not([data-review-line]):not([data-review-ask]):not([data-review-hold]):not([data-review-hold-live]):not([data-review-landing]),.hx-dock:has(>.hx-player) .hx-proposal-bar[data-sheet-state=peek] .hx-rc-foot{display:none}.hx-proposal-bar[data-sheet-state=expanded] .hx-whatif-panel{max-height:none;overflow:visible}.hx-proposal-bar[data-sheet-state=peek]>:not(.hx-sheet-handle):not(#proposal-message):not(#proposal-ways):not(#proposal-body),.hx-proposal-bar[data-sheet-state=peek] #proposal-body>:not(.hx-proposal-head),.hx-proposal-bar[data-sheet-state=peek] .hx-proposal-head>:is(.hx-proposal-tools,.hx-proposal-more,.hx-proposal-more-menu){display:none}@container corn-page (height<=480px){.hx-proposal-bar[data-sheet-state=expanded]{max-height:calc(100cqh - var(--corn-space-3))}}.hx-proposal-bar[data-sheet-state=peek] .hx-proposal-chip{display:none}.hx-proposal-bar[data-sheet-state=expanded]{max-height:62cqh}.hx-proposal-bar[data-sheet-state=expanded] .hx-proposal-chip,.hx-proposal-bar[data-sheet-state=expanded] .hx-proposal-summary{display:none}.hx-proposal-bar[data-sheet-state=expanded] .hx-proposal-counts{order:3;grid-column:1}.hx-proposal-bar[data-sheet-state=expanded] .hx-proposal-tools{order:4;grid-column:2}.hx-proposal-bar[data-sheet-state=expanded] .hx-proposal-head{grid-template-columns:minmax(0,1fr) auto auto}.hx-proposal-bar[data-sheet-state=expanded] .hx-proposal-more .hx-btn--icon{order:4;grid-column:3}.hx-proposal-bar[data-sheet-state=peek] .hx-proposal-peek{color:var(--corn-text-2);display:block}@container corn-page (height>=481px){.hx-dock>.hx-proposal-bar[data-sheet-state=expanded]{max-height:min(var(--hx-sheet-cap,50cqh), 50cqh)}}.hx-player[data-sheet-state=expanded]{overflow-y:auto}.hx-player[data-sheet-state=peek]>:not(.hx-sheet-handle):not(.hx-player-controls):not(.hx-player-text):not(.hx-player-side):not(.hx-player-track):not(.hx-player-says){display:none}.hx-player[data-sheet-state=peek] .hx-player-text{align-items:center;gap:var(--corn-space-2);min-height:44px;font-size:var(--corn-text-md);white-space:nowrap;flex:1 1 0;display:flex;overflow:hidden}.hx-player[data-sheet-state=peek] .hx-player-step,.hx-player[data-sheet-state=peek] .hx-player-who,.hx-player[data-sheet-state=peek] .hx-player-sep,.hx-player[data-sheet-state=peek] .hx-player-side .hx-player-speed{display:none}.hx-player[data-sheet-state=expanded] .hx-player-text{flex:1 0 100%;order:3}.hx-player[data-sheet-state=expanded] .hx-player-title{clip:auto;clip-path:none;width:auto;height:auto;font-size:var(--corn-text-sm);color:var(--corn-text-2);flex:0 0 100%;order:0;font-weight:600;position:static;overflow:visible}@container corn-page (height<=480px){.hx-player[data-sheet-state=expanded]{max-height:calc(100cqh - var(--corn-space-3))}}.hx-proposal-bar[data-sheet-state=peek] #proposal-body>.hx-review-column{display:flex}.hx-proposal-bar[data-sheet-state=peek] .hx-review-column>:not(.hx-rc-foot){display:none}@container corn-page (height>=481px){.hx-dock>.hx-player[data-sheet-state=expanded]{max-height:min(var(--hx-sheet-cap,50cqh), 50cqh)}}.hx-dock>.hx-drawer[data-sheet-last][data-sheet-state=peek]{padding-bottom:calc(var(--sheet-pb) + env(safe-area-inset-bottom,0px))}.hx-stage[data-sheet-open=drawer] .hx-backdrop:not([hidden]){-webkit-backdrop-filter:none;background:0 0;display:block}.hx-drawer[data-sheet-state=peek] .hx-drawer-body{padding:0 var(--corn-space-5) var(--corn-space-3);flex:none;gap:0;overflow:hidden}.hx-drawer[data-sheet-state=peek] .hx-drawer-body>:not(.hx-drawer-head),.hx-drawer[data-sheet-state=peek] .hx-drawer-foot{display:none}.hx-drawer[data-sheet-state=peek] .hx-drawer-title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}@container corn-page (height<=480px){.hx-drawer[data-sheet-state=peek] .hx-drawer-title{text-overflow:clip;white-space:normal;overflow:visible}}@container corn-page (height>=481px){.hx-dock>.hx-drawer[data-sheet-state=expanded]{max-height:min(var(--hx-sheet-cap,60cqh), 60cqh)}}.hx-forge[data-sheet-state=peek] .hx-forge-body{padding:0 var(--corn-space-5) var(--corn-space-3);gap:var(--corn-space-1);flex:none;overflow:hidden}.hx-forge[data-sheet-state=peek] .hx-forge-body>:not(.hx-forge-top):not(#forge-bar),.hx-forge[data-sheet-state=peek] #forge-filter-chip,.hx-forge[data-sheet-state=peek] .hx-forge-tabs{display:none}.hx-forge[data-sheet-state=peek] .hx-forge-head{border-bottom:0;padding-bottom:0}.hx-forge[data-sheet-state=peek] .hx-forge-head .hx-btn{display:none}@container corn-page (height>=481px){.hx-dock>.hx-forge[data-sheet-state=expanded]{max-height:min(var(--hx-sheet-cap,60cqh), 60cqh)}}}", Sr = () => "[data-corn=review]{all:initial;box-sizing:border-box;contain:layout;background-color:var(--corn-ground);background-image:var(--corn-ground-image);width:100%;height:100%;min-height:24rem;color:var(--corn-text);font-family:var(--corn-font);-webkit-font-smoothing:antialiased;user-select:none;flex-direction:column;display:flex;position:relative;overflow:hidden;container:corn-box corn-page/size}.hx-stage{flex:1;width:100%;min-height:0;position:relative;overflow:hidden}@container corn-box (width>=768px){.hx-stage:has(.hx-review-column:not([hidden])){--hx-col-w:400px}}@container corn-box (width>=768px) and (width<=1023px){.hx-stage:has(.hx-review-column:not([hidden])){--hx-col-w:320px}}.hx-review-empty{z-index:1;padding:var(--corn-space-5);text-align:center;color:var(--corn-text-2);font-size:var(--corn-text-md);pointer-events:none;justify-content:center;align-items:center;margin:0;display:flex;position:absolute;inset:0}.hx-proposal-bar{top:12px}[data-corn=review] canvas{border:0}[data-corn=review] :is(p,h1,h2,h3,h4){text-indent:0;font-variant:normal}[data-corn=review] [data-corn=source-status],[data-corn=review] [data-corn=source-notice]{z-index:50}", Cr = () => "[data-corn=source-status]{z-index:2;box-sizing:border-box;align-items:center;gap:var(--corn-space-3);width:min(26rem, calc(100% - var(--corn-space-6) * 2));padding:var(--corn-space-6);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius-lg);background:var(--corn-surface-1);color:var(--corn-text-2);box-shadow:var(--corn-shadow);text-align:center;font-family:var(--corn-font);font-size:var(--corn-text-md);flex-direction:column;line-height:1.5;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}[data-corn=source-status][hidden]{display:none}[data-corn=source-status]:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}[data-corn=source-status][data-corn-state=running]{box-shadow:none;color:var(--corn-text-3);background:0 0;border-color:#0000;padding:0}[data-corn=source-status][data-corn-state=running] [data-corn=source-title]{font-size:var(--corn-text-md);color:var(--corn-text-3);font-weight:400}[data-corn=source-status][data-corn-state=failure] [data-corn=source-title]{color:var(--corn-bad)}[data-corn=source-status][data-corn-state=waiting] [data-corn=source-title]{color:var(--corn-accent-text)}[data-corn=source-title],[data-corn=source-text]{margin:0}[data-corn=source-title]{font-size:var(--corn-text-lg);color:var(--corn-text);font-weight:600}[data-corn=source-text]{overflow-wrap:anywhere;user-select:text}[data-corn=source-origin]{font-family:var(--corn-mono);color:var(--corn-warn);overflow-wrap:anywhere;user-select:all}[data-corn=source-sign-in],[data-corn=source-retry]{box-sizing:border-box;min-height:max(var(--corn-control-height), 2.75rem);padding:0 var(--corn-space-6);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius);background:var(--corn-surface-2);color:var(--corn-text);font-family:inherit;font-size:inherit;cursor:pointer;justify-content:center;align-items:center;text-decoration:none;display:inline-flex}[data-corn=source-sign-in]{border-color:var(--corn-accent);background:var(--corn-accent);color:var(--corn-text-on-accent);font-weight:600}[data-corn=source-sign-in]:hover{background:var(--corn-accent-hover)}[data-corn=source-retry]:hover{background:var(--corn-surface-3)}[data-corn=source-sign-in]:focus-visible,[data-corn=source-retry]:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}[data-corn=source-notice]{z-index:2;box-sizing:border-box;padding:var(--corn-space-3) var(--corn-space-6);background:var(--corn-surface-1);border-top:var(--corn-border) solid var(--corn-line-soft);color:var(--corn-text-2);font-family:var(--corn-font);font-size:var(--corn-text-sm);text-align:center;overflow-wrap:anywhere;margin:0;position:absolute;bottom:0;left:0;right:0}[data-corn=source-notice][hidden]{display:none}", wr = class extends n {
2759
- constructor(t) {
2760
- super(), t !== !1 && this.__registerHost(), this.__attachShadow(), this.cornReady = e(this, "cornReady", 7), this.cornSelect = e(this, "cornSelect", 7), this.cornNavigate = e(this, "cornNavigate", 7), this.cornDecision = e(this, "cornDecision", 7), this.cornAuth = e(this, "cornAuth", 7), this.cornError = e(this, "cornError", 7);
2761
- }
2762
- get el() {
2763
- return this;
2764
- }
2765
- src;
2766
- proposal;
2767
- source;
2768
- view;
2769
- node;
2770
- theme;
2771
- useTheme = !1;
2772
- topology;
2773
- config;
2774
- strings;
2775
- checker;
2776
- cornReady;
2777
- cornSelect;
2778
- cornNavigate;
2779
- cornDecision;
2780
- cornAuth;
2781
- cornError;
2782
- piece = null;
2783
- loaded = !1;
2784
- changes = {};
2785
- connectedCallback() {
2786
- this.loaded && this.mountPiece();
2787
- }
2788
- componentDidLoad() {
2789
- this.loaded = !0, this.mountPiece();
2790
- }
2791
- disconnectedCallback() {
2792
- this.unmountPiece();
2793
- }
2794
- unmountPiece() {
2795
- this.piece && this.piece.destroy(), this.piece = null;
2796
- }
2797
- remount() {
2798
- this.unmountPiece(), this.loaded && this.el.isConnected && this.mountPiece();
2799
- }
2800
- mountPiece() {
2801
- !this.piece && this.el.shadowRoot && (this.changes = {}, this.piece = pr(this.el.shadowRoot, null, {
2802
- src: this.src,
2803
- useTheme: this.useTheme,
2804
- version: "0.52.1",
2805
- pageUrl: () => typeof location > "u" ? "" : location.href,
2806
- tokens: F,
2807
- topology: this.topology,
2808
- config: this.config,
2809
- strings: this.strings,
2810
- checker: this.checker,
2811
- proposal: this.proposal,
2812
- source: this.source,
2813
- view: this.view,
2814
- node: this.node,
2815
- theme: this.theme,
2816
- onSelect: (e) => {
2817
- this.node = e.kind === "node" ? e.id : null, delete this.changes.node, this.cornSelect.emit(e);
2818
- },
2819
- onNavigate: (e) => {
2820
- e.view && (this.view = e.view, delete this.changes.view), e.change === "closed" && (this.proposal = null, delete this.changes.proposal), e.change === "opened" && e.proposal && (this.proposal = e.proposal, delete this.changes.proposal), this.cornNavigate.emit(e);
2821
- },
2822
- onDecision: (e) => this.cornDecision.emit(e),
2823
- onAuth: (e) => this.cornAuth.emit(e),
2824
- onError: (e) => this.cornError.emit(e),
2825
- onReady: () => this.cornReady.emit()
2826
- }));
2827
- }
2828
- componentDidRender() {
2829
- let e = this.changes;
2830
- this.changes = {}, this.piece && Object.keys(e).length && this.piece.update(e);
2831
- }
2832
- changed(e, t, n) {
2833
- this.changes[n] = e;
2834
- }
2835
- addressChanged() {
2836
- this.piece && this.remount();
2837
- }
2838
- async fit() {
2839
- this.piece && this.piece.fit();
2840
- }
2841
- async focusNode(e) {
2842
- this.piece && this.piece.focusNode(e);
2843
- }
2844
- async refresh() {
2845
- this.piece && this.piece.refresh();
2846
- }
2847
- static get watchers() {
2848
- return {
2849
- proposal: [{ changed: 0 }],
2850
- source: [{ changed: 0 }],
2851
- view: [{ changed: 0 }],
2852
- node: [{ changed: 0 }],
2853
- theme: [{ changed: 0 }],
2854
- useTheme: [{ changed: 0 }],
2855
- topology: [{ changed: 0 }],
2856
- config: [{ changed: 0 }],
2857
- strings: [{ changed: 0 }],
2858
- checker: [{ changed: 0 }],
2859
- src: [{ addressChanged: 0 }]
2860
- };
2861
- }
2862
- static get style() {
2863
- return mr() + hr() + gr() + _r() + vr() + yr() + br() + xr() + Sr() + Cr();
2864
- }
2865
- };
2866
- t(wr, [
2867
- 513,
2868
- "corn-review",
2869
- {
2870
- src: [1],
2871
- proposal: [1025],
2872
- source: [1],
2873
- view: [1537],
2874
- node: [1537],
2875
- theme: [513],
2876
- useTheme: [4, "use-theme"],
2877
- topology: [16],
2878
- config: [16],
2879
- strings: [16],
2880
- checker: [16],
2881
- fit: [64],
2882
- focusNode: [64],
2883
- refresh: [64]
2884
- },
2885
- void 0,
2886
- {
2887
- proposal: [{ changed: 0 }],
2888
- source: [{ changed: 0 }],
2889
- view: [{ changed: 0 }],
2890
- node: [{ changed: 0 }],
2891
- theme: [{ changed: 0 }],
2892
- useTheme: [{ changed: 0 }],
2893
- topology: [{ changed: 0 }],
2894
- config: [{ changed: 0 }],
2895
- strings: [{ changed: 0 }],
2896
- checker: [{ changed: 0 }],
2897
- src: [{ addressChanged: 0 }]
2898
- }
2899
- ]);
2900
- export { wr as t };