glimmervoid 0.48.4-next.366 → 0.48.4-next.367
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/glimmervoid.js +4 -4
- package/dist/chunks/config-store-Bp-9Hnv1.js +1 -0
- package/dist/chunks/{config-store-C4F1jFS5.js → config-store-_A681WTh.js} +19 -19
- package/dist/chunks/{main-DBmWw1C0.js → main-zC1ZiLto.js} +3 -3
- package/dist/chunks/{pair-cli-C3fWhIAi.js → pair-cli-39Abgbgj.js} +2 -2
- package/dist/chunks/{pairings-store-f7H7GLth.js → pairings-store-DshCT7KO.js} +1 -1
- package/dist/chunks/{settings-cli-DjwrypAR.js → settings-cli-B4708aPa.js} +2 -2
- package/dist/chunks/{settings-readout-core-ysijObpZ.js → settings-readout-core-iX9Lmx9C.js} +1 -1
- package/dist/chunks/{why-cli-QAQcKDac.js → why-cli-D368n3Uj.js} +1 -1
- package/dist/client/assets/{benchmark-panel-ll3fmGdo.js → benchmark-panel-BrGfFoNE.js} +1 -1
- package/dist/client/assets/benchmark-panel-BrGfFoNE.js.br +0 -0
- package/dist/client/assets/{boards-view-DtV4j1hX.js → boards-view-2D1xKQgq.js} +1 -1
- package/dist/client/assets/boards-view-2D1xKQgq.js.br +0 -0
- package/dist/client/assets/{community-panel-Bq1kijas.js → community-panel-DqxgjCLq.js} +1 -1
- package/dist/client/assets/community-panel-DqxgjCLq.js.br +0 -0
- package/dist/client/assets/{dialogs-NUwI_R5d.js → dialogs-CzCxA5Ux.js} +1 -1
- package/dist/client/assets/dialogs-CzCxA5Ux.js.br +0 -0
- package/dist/client/assets/{doc-editor-ui-BAwbVdzJ.js → doc-editor-ui-CyYkJPMj.js} +1 -1
- package/dist/client/assets/doc-editor-ui-CyYkJPMj.js.br +0 -0
- package/dist/client/assets/{feature-hint-BoM_Kksb.js → feature-hint-BNhdPlzZ.js} +1 -1
- package/dist/client/assets/feature-hint-BNhdPlzZ.js.br +0 -0
- package/dist/client/assets/{first-run-checklist-D_hn2wjh.js → first-run-checklist-CbdanmwZ.js} +1 -1
- package/dist/client/assets/first-run-checklist-CbdanmwZ.js.br +0 -0
- package/dist/client/assets/{hooks-panel-wvyTxDz0.js → hooks-panel-B6JRtpmJ.js} +1 -1
- package/dist/client/assets/hooks-panel-B6JRtpmJ.js.br +0 -0
- package/dist/client/assets/{index-DHeVbbPl.js → index-Bq8I2EvJ.js} +5 -5
- package/dist/client/assets/index-Bq8I2EvJ.js.br +0 -0
- package/dist/client/assets/{issues-panel-FPxMs3wr.js → issues-panel-G4mEB3dK.js} +1 -1
- package/dist/client/assets/issues-panel-G4mEB3dK.js.br +0 -0
- package/dist/client/assets/{my-prs-panel-BEvxTp93.js → my-prs-panel-DOdmzv68.js} +1 -1
- package/dist/client/assets/my-prs-panel-DOdmzv68.js.br +0 -0
- package/dist/client/assets/{nyan-cat-CQ3DHXyW.js → nyan-cat-DlhEx1mZ.js} +1 -1
- package/dist/client/assets/nyan-cat-DlhEx1mZ.js.br +0 -0
- package/dist/client/assets/{phone-shell-CvDXY8Yx.js → phone-shell-fB6lPELg.js} +1 -1
- package/dist/client/assets/phone-shell-fB6lPELg.js.br +0 -0
- package/dist/client/assets/{plan-face-COeIXi2K.js → plan-face-tBYo_PZH.js} +1 -1
- package/dist/client/assets/plan-face-tBYo_PZH.js.br +0 -0
- package/dist/client/assets/{pr-queue-columns-D7zc20dF.js → pr-queue-columns-DxnG1qNa.js} +1 -1
- package/dist/client/assets/pr-queue-columns-DxnG1qNa.js.br +0 -0
- package/dist/client/assets/{radar-panel-ueCpP-eo.js → radar-panel-D55NzF80.js} +1 -1
- package/dist/client/assets/radar-panel-D55NzF80.js.br +0 -0
- package/dist/client/assets/{repo-roots-adder-Cvu6s0w3.js → repo-roots-adder-v6aAPuPt.js} +1 -1
- package/dist/client/assets/repo-roots-adder-v6aAPuPt.js.br +0 -0
- package/dist/client/assets/{resume-dialog-DxxOlpNZ.js → resume-dialog-Dw2z4Ojb.js} +1 -1
- package/dist/client/assets/resume-dialog-Dw2z4Ojb.js.br +0 -0
- package/dist/client/assets/{review-queue-panel-DLvDoMDI.js → review-queue-panel-BNKkooZu.js} +1 -1
- package/dist/client/assets/review-queue-panel-BNKkooZu.js.br +0 -0
- package/dist/client/assets/{settings-panel-B8vZQqsl.js → settings-panel-4KwHrqDp.js} +2 -2
- package/dist/client/assets/settings-panel-4KwHrqDp.js.br +0 -0
- package/dist/client/assets/{shown-lightbox-CFgAKsJY.js → shown-lightbox-C7TDDwJJ.js} +1 -1
- package/dist/client/assets/shown-lightbox-C7TDDwJJ.js.br +0 -0
- package/dist/client/assets/{team-review-panel-BpO51bDg.js → team-review-panel-fzO8k-mj.js} +1 -1
- package/dist/client/assets/team-review-panel-fzO8k-mj.js.br +0 -0
- package/dist/client/assets/{trace-panel-C-F9mUNe.js → trace-panel-CF81yqIl.js} +1 -1
- package/dist/client/assets/trace-panel-CF81yqIl.js.br +0 -0
- package/dist/client/assets/{usage-panel-DHthuhyM.js → usage-panel-myBGax-F.js} +1 -1
- package/dist/client/assets/usage-panel-myBGax-F.js.br +0 -0
- package/dist/client/assets/{your-day-tip-gUCEbqv5.js → your-day-tip-CqIuEa1V.js} +1 -1
- package/dist/client/assets/your-day-tip-CqIuEa1V.js.br +5 -0
- package/dist/client/index.html +1 -1
- package/dist/client/index.html.br +0 -0
- package/dist/server/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/config-store-BCRofrnq.js +0 -1
- package/dist/client/assets/benchmark-panel-ll3fmGdo.js.br +0 -0
- package/dist/client/assets/boards-view-DtV4j1hX.js.br +0 -0
- package/dist/client/assets/community-panel-Bq1kijas.js.br +0 -0
- package/dist/client/assets/dialogs-NUwI_R5d.js.br +0 -0
- package/dist/client/assets/doc-editor-ui-BAwbVdzJ.js.br +0 -0
- package/dist/client/assets/feature-hint-BoM_Kksb.js.br +0 -0
- package/dist/client/assets/first-run-checklist-D_hn2wjh.js.br +0 -0
- package/dist/client/assets/hooks-panel-wvyTxDz0.js.br +0 -0
- package/dist/client/assets/index-DHeVbbPl.js.br +0 -0
- package/dist/client/assets/issues-panel-FPxMs3wr.js.br +0 -0
- package/dist/client/assets/my-prs-panel-BEvxTp93.js.br +0 -0
- package/dist/client/assets/nyan-cat-CQ3DHXyW.js.br +0 -0
- package/dist/client/assets/phone-shell-CvDXY8Yx.js.br +0 -0
- package/dist/client/assets/plan-face-COeIXi2K.js.br +0 -0
- package/dist/client/assets/pr-queue-columns-D7zc20dF.js.br +0 -0
- package/dist/client/assets/radar-panel-ueCpP-eo.js.br +0 -0
- package/dist/client/assets/repo-roots-adder-Cvu6s0w3.js.br +0 -0
- package/dist/client/assets/resume-dialog-DxxOlpNZ.js.br +0 -0
- package/dist/client/assets/review-queue-panel-DLvDoMDI.js.br +0 -0
- package/dist/client/assets/settings-panel-B8vZQqsl.js.br +0 -0
- package/dist/client/assets/shown-lightbox-CFgAKsJY.js.br +0 -0
- package/dist/client/assets/team-review-panel-BpO51bDg.js.br +0 -0
- package/dist/client/assets/trace-panel-C-F9mUNe.js.br +0 -0
- package/dist/client/assets/usage-panel-DHthuhyM.js.br +0 -0
- package/dist/client/assets/your-day-tip-gUCEbqv5.js.br +0 -0
package/dist/bin/glimmervoid.js
CHANGED
|
@@ -63,7 +63,7 @@ var OWNED_COMMAND_RUNNERS = {
|
|
|
63
63
|
return await runDoctor() ? 0 : 1;
|
|
64
64
|
},
|
|
65
65
|
pair: async ({ values }) => {
|
|
66
|
-
const { runPairCli } = await import("../chunks/pair-cli-
|
|
66
|
+
const { runPairCli } = await import("../chunks/pair-cli-39Abgbgj.js");
|
|
67
67
|
return runPairCli({
|
|
68
68
|
isListing: values.list === true,
|
|
69
69
|
revokeDeviceId: typeof values.revoke === "string" ? values.revoke : null,
|
|
@@ -75,11 +75,11 @@ var OWNED_COMMAND_RUNNERS = {
|
|
|
75
75
|
return runAgentSetupCli();
|
|
76
76
|
},
|
|
77
77
|
settings: async (parsed) => {
|
|
78
|
-
const { runParsedSettingsCli } = await import("../chunks/settings-cli-
|
|
78
|
+
const { runParsedSettingsCli } = await import("../chunks/settings-cli-B4708aPa.js");
|
|
79
79
|
return runParsedSettingsCli(parsed);
|
|
80
80
|
},
|
|
81
81
|
why: async ({ positionals }) => {
|
|
82
|
-
const { runWhyCli } = await import("../chunks/why-cli-
|
|
82
|
+
const { runWhyCli } = await import("../chunks/why-cli-D368n3Uj.js");
|
|
83
83
|
return runWhyCli({ targetArgument: positionals[0] ?? "" });
|
|
84
84
|
},
|
|
85
85
|
"ssh-sign": async ({ rawArgs }) => {
|
|
@@ -176,7 +176,7 @@ async function readDeclaredCustomAgents() {
|
|
|
176
176
|
declared: [],
|
|
177
177
|
error: null
|
|
178
178
|
};
|
|
179
|
-
const { loadConfigFile } = await import("../chunks/config-store-
|
|
179
|
+
const { loadConfigFile } = await import("../chunks/config-store-Bp-9Hnv1.js");
|
|
180
180
|
try {
|
|
181
181
|
const loaded = loadConfigFile(decided.path, { exitOnError: false });
|
|
182
182
|
if (!loaded.config) return {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { c as loadConfigFile } from "./config-store-_A681WTh.js";
|
|
@@ -914,7 +914,7 @@ var SECTIONS = Object.freeze([
|
|
|
914
914
|
sectionId: "browser-appearance",
|
|
915
915
|
settingId: "alert-sounds-enabled"
|
|
916
916
|
}],
|
|
917
|
-
description: "Play a sound when a session needs you
|
|
917
|
+
description: "Play a sound when a session needs you, like the note button in the header.",
|
|
918
918
|
control: "toggle",
|
|
919
919
|
keywords: [
|
|
920
920
|
"audio",
|
|
@@ -933,7 +933,7 @@ var SECTIONS = Object.freeze([
|
|
|
933
933
|
sectionId: "browser-appearance",
|
|
934
934
|
settingId: "alert-sound"
|
|
935
935
|
}],
|
|
936
|
-
description: "Sound played when a session needs you
|
|
936
|
+
description: "Sound played when a session needs you, including files you add to ~/.glimmervoid/sounds/.",
|
|
937
937
|
control: "select",
|
|
938
938
|
optionsFrom: "sounds",
|
|
939
939
|
keywords: [
|
|
@@ -982,7 +982,7 @@ var SECTIONS = Object.freeze([
|
|
|
982
982
|
id: "telegram-chat-id",
|
|
983
983
|
path: "telegram.chatId",
|
|
984
984
|
title: "Chat id",
|
|
985
|
-
description: "Chat the bot posts to
|
|
985
|
+
description: "Chat the bot posts to, read as message.chat.id from its getUpdates page after you message it.",
|
|
986
986
|
control: "text",
|
|
987
987
|
keywords: ["destination", "channel"],
|
|
988
988
|
defaultValue: "",
|
|
@@ -1032,7 +1032,7 @@ var SECTIONS = Object.freeze([
|
|
|
1032
1032
|
id: "tab-order",
|
|
1033
1033
|
path: "viewTabOrder",
|
|
1034
1034
|
title: "Tab order",
|
|
1035
|
-
description: "Order of the dashboard tabs
|
|
1035
|
+
description: "Order of the dashboard tabs, also set by dragging tabs in the header.",
|
|
1036
1036
|
control: "tab-order",
|
|
1037
1037
|
keywords: [
|
|
1038
1038
|
"tabs",
|
|
@@ -1180,7 +1180,7 @@ var SECTIONS = Object.freeze([
|
|
|
1180
1180
|
id: "sane-yolo-unreadable-paths",
|
|
1181
1181
|
path: "saneYoloUnreadablePaths",
|
|
1182
1182
|
title: "Unreadable folders",
|
|
1183
|
-
description: "Extra files and folders agents may not read
|
|
1183
|
+
description: "Extra files and folders agents may not read, where ~ is your home folder.",
|
|
1184
1184
|
control: "list",
|
|
1185
1185
|
keywords: [
|
|
1186
1186
|
"guardrails",
|
|
@@ -1298,7 +1298,7 @@ var SECTIONS = Object.freeze([
|
|
|
1298
1298
|
id: "usage-your-day",
|
|
1299
1299
|
path: "usage.yourDay",
|
|
1300
1300
|
title: "Your day",
|
|
1301
|
-
description: "Recap yesterday and suggest a pace for today
|
|
1301
|
+
description: "Recap yesterday and suggest a pace for today when usage tracking is on.",
|
|
1302
1302
|
control: "toggle",
|
|
1303
1303
|
keywords: [
|
|
1304
1304
|
"burnout",
|
|
@@ -1325,7 +1325,7 @@ var SECTIONS = Object.freeze([
|
|
|
1325
1325
|
id: "usage-daily-budget",
|
|
1326
1326
|
path: "usage.budget.dailyUsd",
|
|
1327
1327
|
title: "Daily budget",
|
|
1328
|
-
description: "Alert at 50%, 75% and 100% of this estimated daily spend
|
|
1328
|
+
description: "Alert at 50%, 75% and 100% of this estimated daily spend, or never at zero.",
|
|
1329
1329
|
control: "number",
|
|
1330
1330
|
range: USAGE_BUDGET_RANGE,
|
|
1331
1331
|
unit: USD,
|
|
@@ -1341,7 +1341,7 @@ var SECTIONS = Object.freeze([
|
|
|
1341
1341
|
id: "usage-monthly-budget",
|
|
1342
1342
|
path: "usage.budget.monthlyUsd",
|
|
1343
1343
|
title: "Monthly budget",
|
|
1344
|
-
description: "Alert at 50%, 75% and 100% of this estimated monthly spend
|
|
1344
|
+
description: "Alert at 50%, 75% and 100% of this estimated monthly spend, or never at zero.",
|
|
1345
1345
|
control: "number",
|
|
1346
1346
|
range: USAGE_BUDGET_RANGE,
|
|
1347
1347
|
unit: USD,
|
|
@@ -1396,7 +1396,7 @@ var SECTIONS = Object.freeze([
|
|
|
1396
1396
|
id: "posthog-projects",
|
|
1397
1397
|
path: "posthog.projects",
|
|
1398
1398
|
title: "Projects",
|
|
1399
|
-
description: "Project ids to watch,
|
|
1399
|
+
description: "Project ids to watch, where empty watches all and none watches none.",
|
|
1400
1400
|
control: "list",
|
|
1401
1401
|
keywords: ["project ids", "filter"],
|
|
1402
1402
|
defaultValue: "all",
|
|
@@ -1457,7 +1457,7 @@ var SECTIONS = Object.freeze([
|
|
|
1457
1457
|
id: "posthog-auto-fix",
|
|
1458
1458
|
path: "posthog.autoFix",
|
|
1459
1459
|
title: "Attempt fixes for major issues",
|
|
1460
|
-
description: "Let an agent fix an issue on a local branch
|
|
1460
|
+
description: "Let an agent fix an issue on a local branch, opening a pull request only after you approve.",
|
|
1461
1461
|
control: "toggle",
|
|
1462
1462
|
keywords: ["automatic", "pull request"],
|
|
1463
1463
|
danger: true,
|
|
@@ -1478,7 +1478,7 @@ var SECTIONS = Object.freeze([
|
|
|
1478
1478
|
id: "team-review-enabled",
|
|
1479
1479
|
path: "teamReview.enabled",
|
|
1480
1480
|
title: "Enable team review",
|
|
1481
|
-
description: "Draft a review of each open team pull request
|
|
1481
|
+
description: "Draft a review of each open team pull request, posting nothing until you approve or comment.",
|
|
1482
1482
|
control: "toggle",
|
|
1483
1483
|
keywords: ["pull requests", "github"],
|
|
1484
1484
|
defaultValue: true,
|
|
@@ -1532,7 +1532,7 @@ var SECTIONS = Object.freeze([
|
|
|
1532
1532
|
id: "team-review-skill",
|
|
1533
1533
|
path: "teamReview.skill",
|
|
1534
1534
|
title: "Review skill",
|
|
1535
|
-
description: "Skill Claude Code follows for each review
|
|
1535
|
+
description: "Skill Claude Code follows for each review, or none when empty.",
|
|
1536
1536
|
control: "text",
|
|
1537
1537
|
keywords: [
|
|
1538
1538
|
"skill",
|
|
@@ -1547,7 +1547,7 @@ var SECTIONS = Object.freeze([
|
|
|
1547
1547
|
id: "team-review-reviewer-model",
|
|
1548
1548
|
path: "teamReview.reviewer.model",
|
|
1549
1549
|
title: "Review model",
|
|
1550
|
-
description: "Model for reviews
|
|
1550
|
+
description: "Model for reviews, or the agent's default when empty.",
|
|
1551
1551
|
control: "text",
|
|
1552
1552
|
keywords: [
|
|
1553
1553
|
"model",
|
|
@@ -1563,7 +1563,7 @@ var SECTIONS = Object.freeze([
|
|
|
1563
1563
|
id: "team-review-reviewer-effort",
|
|
1564
1564
|
path: "teamReview.reviewer.effort",
|
|
1565
1565
|
title: "Review effort",
|
|
1566
|
-
description: "Effort for reviews
|
|
1566
|
+
description: "Effort for reviews, or the agent's default when empty.",
|
|
1567
1567
|
control: "text",
|
|
1568
1568
|
keywords: [
|
|
1569
1569
|
"effort",
|
|
@@ -1721,7 +1721,7 @@ var SECTIONS = Object.freeze([
|
|
|
1721
1721
|
id: "workflows-rules",
|
|
1722
1722
|
path: "status:workflow-rules",
|
|
1723
1723
|
title: "Workflow rules",
|
|
1724
|
-
description: "Turn each rule on or off.
|
|
1724
|
+
description: "Turn each workflow rule on or off.",
|
|
1725
1725
|
control: "readonly",
|
|
1726
1726
|
keywords: [
|
|
1727
1727
|
"pull requests",
|
|
@@ -1744,7 +1744,7 @@ var SECTIONS = Object.freeze([
|
|
|
1744
1744
|
id: "benchmarks-enabled",
|
|
1745
1745
|
path: "benchmarks.enabled",
|
|
1746
1746
|
title: "Enable benchmarks",
|
|
1747
|
-
description: "Show the Bench tab
|
|
1747
|
+
description: "Show the Bench tab, where nothing runs until you start it.",
|
|
1748
1748
|
control: "toggle",
|
|
1749
1749
|
keywords: [
|
|
1750
1750
|
"eval",
|
|
@@ -1765,7 +1765,7 @@ var SECTIONS = Object.freeze([
|
|
|
1765
1765
|
id: "coherence-enabled",
|
|
1766
1766
|
path: "coherence.enabled",
|
|
1767
1767
|
title: "Show session Coherence",
|
|
1768
|
-
description: "Show each session's Coherence hook status and decisions
|
|
1768
|
+
description: "Show each session's Coherence hook status and decisions (needs @posthog/coherence 1.8 or newer).",
|
|
1769
1769
|
control: "toggle",
|
|
1770
1770
|
keywords: [
|
|
1771
1771
|
"experimental",
|
|
@@ -1824,7 +1824,7 @@ var SECTIONS = Object.freeze([
|
|
|
1824
1824
|
id: "community-skill",
|
|
1825
1825
|
path: "community.skill",
|
|
1826
1826
|
title: "Research skill",
|
|
1827
|
-
description: "Skill the research agent follows
|
|
1827
|
+
description: "Skill the research agent follows, or none when empty.",
|
|
1828
1828
|
control: "text",
|
|
1829
1829
|
keywords: [
|
|
1830
1830
|
"skill",
|
|
@@ -1867,7 +1867,7 @@ var SECTIONS = Object.freeze([
|
|
|
1867
1867
|
id: "community-discord-channels",
|
|
1868
1868
|
path: "community.discordChannels",
|
|
1869
1869
|
title: "Discord channels",
|
|
1870
|
-
description: "Discord channels to watch for questions, without the
|
|
1870
|
+
description: "Discord channels to watch for questions, without the #, or none to skip Discord.",
|
|
1871
1871
|
control: "list",
|
|
1872
1872
|
keywords: [
|
|
1873
1873
|
"discord",
|
|
@@ -18,15 +18,15 @@ import { r as knownWriteHookInput } from "./posthog-read-gate-core-CeSY56AB.js";
|
|
|
18
18
|
import { a as readPageTitle, c as planSteps$1, i as filesAfterRetention, l as unitsOf, n as decideShownKind, o as shownMimeForFilename, r as describeOverCap, s as findDependencyCycle, t as SHOWN_SNIFF_BYTES } from "./shown-files-core-B6ovU6SV.js";
|
|
19
19
|
import { n as shellQuote } from "./hook-command-core-qTNK-xMF.js";
|
|
20
20
|
import { C as parseCgroupBytes, D as DEFAULT_MAX_MS, E as DEFAULT_BASE_MS, O as nextBackoffMs, S as memoryReserveBytes, T as parseMemAvailableBytes, _ as createSpawnGate, a as jsonStateLoadError, b as cgroupLimitBytes, c as loadedJsonValue, d as writeJsonAtomicSync, g as createSerialQueue, h as createMemoryAdmission, i as createJsonStateWriter, m as createKeyedSerialQueue, n as appendJsonLines, o as loadJsonStateFile, p as writeTextAtomicSync, r as createJsonStateStore, s as loadJsonStateFileSync, t as appendJsonLine, u as writeJsonAtomic, v as isQueueAdmissionTimeout, w as parseCgroupV2Path, x as headroomFromReadings, y as cgroupAncestorPaths } from "./json-file-AKRVPqG1.js";
|
|
21
|
-
import { $ as stableConfigKey, B as buildPersonProperties, F as TELEMETRY_FLAGS_URL, G as decideRemoteTelemetryState, H as claudeAccountUuidOf, I as adapterBucket, J as nodeMajorVersion, K as decideTelemetryConsent, L as buildAiGenerationEvents, M as isExperimentalSetting, N as FIRST_RUN_NOTICE, P as TELEMETRY_BATCH_URL, R as buildBrowserExceptionProperties, U as codexUserIdOf, V as classifySessionExit, W as decideIsDevInstall, X as resolveProjectToken, Y as parsePosthogReleaseId, _ as settingsBlockSpecFor, a as ensureProjectIds, at as sessionIdFromBranch, ct as canonicalizePath, f as DEFAULT_TIMER_FNS, g as mergeSettingsBlock, i as createConfigStore, it as planWorktreeGc, k as valueAtPath, lt as comparableDirectoryPath, n as DEFAULT_CONFIG, nt as matchedPrefix, o as generateProjectId, ot as usablePrefixes, p as unrefTimer, q as exceptionFingerprint, rt as planBranchGc, s as glimmervoidHomeDir$1, st as worktreeIntegrationTips, t as ABORT_CONFIG_SAVE, tt as DEFAULT_BRANCH_GC_PREFIXES, ut as isSameDirectoryPath, v as validateSettingsBlock, y as SETTINGS_INDEX, z as buildExceptionProperties } from "./config-store-
|
|
21
|
+
import { $ as stableConfigKey, B as buildPersonProperties, F as TELEMETRY_FLAGS_URL, G as decideRemoteTelemetryState, H as claudeAccountUuidOf, I as adapterBucket, J as nodeMajorVersion, K as decideTelemetryConsent, L as buildAiGenerationEvents, M as isExperimentalSetting, N as FIRST_RUN_NOTICE, P as TELEMETRY_BATCH_URL, R as buildBrowserExceptionProperties, U as codexUserIdOf, V as classifySessionExit, W as decideIsDevInstall, X as resolveProjectToken, Y as parsePosthogReleaseId, _ as settingsBlockSpecFor, a as ensureProjectIds, at as sessionIdFromBranch, ct as canonicalizePath, f as DEFAULT_TIMER_FNS, g as mergeSettingsBlock, i as createConfigStore, it as planWorktreeGc, k as valueAtPath, lt as comparableDirectoryPath, n as DEFAULT_CONFIG, nt as matchedPrefix, o as generateProjectId, ot as usablePrefixes, p as unrefTimer, q as exceptionFingerprint, rt as planBranchGc, s as glimmervoidHomeDir$1, st as worktreeIntegrationTips, t as ABORT_CONFIG_SAVE, tt as DEFAULT_BRANCH_GC_PREFIXES, ut as isSameDirectoryPath, v as validateSettingsBlock, y as SETTINGS_INDEX, z as buildExceptionProperties } from "./config-store-_A681WTh.js";
|
|
22
22
|
import { _ as TelemetryState, a as DEEP_HISTORY_SCROLLBACK_LINES, c as describeDataAttach, d as DashboardTelemetryReport, h as TELEMETRY_EVENT_SCHEMAS, i as HookEnvelope, l as parseDataAttach, m as PendingCrashReport, r as HTTP_URL_RE, s as LOGGED_FAST_CLOSE_COUNTS, u as parseDataClientMessage } from "./build-channel-CgXyvO8w.js";
|
|
23
23
|
import { i as resolveArgvCommandMatches } from "./kimi-DGnMgNsj.js";
|
|
24
24
|
import { $ as grokHomes, A as decideUploadType, B as containmentRefusalReason, C as parseRegistryLatest, Ct as shouldReplace, D as openContainedFile, Dt as claudeCode, E as shortSha$1, Et as HOOK_TOOLS, F as planUploadRetention, G as codexFallbackRoots, H as planContiguousRead, I as MAX_TRANSCRIPT_READ_BYTES, J as codexSessionIdFromPath, K as codexHomes, L as TRACE_TAIL_SCAN_BYTES, M as framePathPaste, N as imageMimeForUploadFilename, O as MAX_UPLOAD_BYTES, P as isSafePathSegment, Q as expandTilde, R as committedOffsetFromTraceTailOrNull, S as parseRegistryDeprecation, St as parseUsageLine, T as pickNewestPublished, Tt as vendorUsageEntry, U as resumeOffsetFrom, V as isOversizedPartialLine, W as withCommittedOffset, X as decideFileRead, Y as continuationDelayMs, Z as dedupeCodexFiles, _ as decideInstallFlavor, _t as foldReplacementIntoGenerationRollup, a as describeAgentResolvability, at as scopedClaudeRoots, b as normalizeSha, bt as mergeGenerationRollups, c as isKnownAgentId, ct as shouldPersistWarehouse, d as resolveAdapter, dt as parseKimiUsageLine, et as isUsageFile, f as setCustomAgents, ft as addEntryToTotals, g as NODE_PTY_INSTALL_SCRIPT_FLAG, gt as foldEntryIntoGenerationRollup, h as requestCodexAppServer, ht as expandAdvisorIterations, i as customAgentFingerprint, it as resolveProjectsDirs, j as exceedsUploadCap, k as buildUploadFilename, l as listAgentIds, lt as splitLines, m as readHostCodexVersion, mt as emptyTotals, n as cachedAgentResolvability, nt as passOutcome, o as getAdapter, ot as sessionsRootCandidates, p as codex, pt as dedupKeys, q as codexRootCandidates, r as commandFor, rt as projectDirCandidates, s as hookProfileOf, st as shouldEvaluateDespiteIoFailures, t as DEFAULT_AGENT_ID$1, tt as kimiHomes, u as resetCommandCache, ut as kimiDedupIdentity, v as decideUpdateStatus, vt as identityFromRelPath, w as parseResolvedSha, wt as totalTokensOf$1, x as normalizeUpdateChannel, xt as parseJsonLine, y as isCheckFresh, yt as isWithinGenerationRecencyWindow, z as completeLineBytes } from "./adapters-BDT8SItf.js";
|
|
25
25
|
import { c as CODEX_HOME_PROFILE, l as KIMI_HOME_PROFILE } from "./agent-home-core-DgW3orTE.js";
|
|
26
26
|
import { d as releaseSessionLock, f as sessionIdOfLockFile, l as releaseUnheldAgentHomeSecrets, n as generatedAgentHomePath, p as trashSessionTempFolderOnceUnheld, s as realAgentHome, u as createHeldSessionTempFolder } from "./agent-home-BzANIIVe.js";
|
|
27
27
|
import { a as formatSshPublicKey, c as orderAgentSockets, i as commitSigningShimText, l as parseSshPublicKey, n as NO_AGENT_HOLDS_KEY, o as isForwardedAgentDirName, r as agentListsKey, s as isSignableGitObject, t as COMMIT_SIGNING_SHIM_NAME } from "./ssh-signing-core-CRhVVWNW.js";
|
|
28
|
-
import { a as defaultPairingsPath, c as decideDeviceAuth, i as createSeenStore, l as deviceNameFromUserAgent, n as configSiblingPath, o as defaultSeenPath, r as createPairingsStore, s as DEFAULT_DEVICE_MAX_AGE_MS, u as hashSecret } from "./pairings-store-
|
|
29
|
-
import { n as configFileViewOf, u as readSettingsForAgent } from "./settings-readout-core-
|
|
28
|
+
import { a as defaultPairingsPath, c as decideDeviceAuth, i as createSeenStore, l as deviceNameFromUserAgent, n as configSiblingPath, o as defaultSeenPath, r as createPairingsStore, s as DEFAULT_DEVICE_MAX_AGE_MS, u as hashSecret } from "./pairings-store-DshCT7KO.js";
|
|
29
|
+
import { n as configFileViewOf, u as readSettingsForAgent } from "./settings-readout-core-iX9Lmx9C.js";
|
|
30
30
|
import { n as normalizeRemoteConfig, r as validateRemoteConfig, t as decideBindHost } from "./remote-config-Dcejfz01.js";
|
|
31
31
|
import { g as runGit, h as runGh, i as createCommitSessions, m as runCommand, p as gitCommandFailure, t as COMMIT_SESSIONS_FOLDER_NAME } from "./commit-sessions-DdXZUMYK.js";
|
|
32
32
|
import { createRequire } from "node:module";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as errorMessage } from "./text-DoirglWV.js";
|
|
2
|
-
import { l as resolveConfigPath } from "./config-store-
|
|
3
|
-
import { a as defaultPairingsPath, i as createSeenStore, o as defaultSeenPath, r as createPairingsStore, t as REVOCATION_PROPAGATION_SECONDS } from "./pairings-store-
|
|
2
|
+
import { l as resolveConfigPath } from "./config-store-_A681WTh.js";
|
|
3
|
+
import { a as defaultPairingsPath, i as createSeenStore, o as defaultSeenPath, r as createPairingsStore, t as REVOCATION_PROPAGATION_SECONDS } from "./pairings-store-DshCT7KO.js";
|
|
4
4
|
import { n as normalizeRemoteConfig } from "./remote-config-Dcejfz01.js";
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
//#region server/text-format.ts
|
|
@@ -2,7 +2,7 @@ import { n as errorLabel, r as errorMessage } from "./text-DoirglWV.js";
|
|
|
2
2
|
import { l as equalsIgnoringCaseOnWindows } from "./runtime-paths-D_ZjJLE0.js";
|
|
3
3
|
import { n as isRecord } from "./coerce-oz_Z_6E7.js";
|
|
4
4
|
import { a as jsonStateLoadError, d as writeJsonAtomicSync, l as sleepSync, s as loadJsonStateFileSync, u as writeJsonAtomic } from "./json-file-AKRVPqG1.js";
|
|
5
|
-
import { ct as canonicalizePath, f as DEFAULT_TIMER_FNS, p as unrefTimer, s as glimmervoidHomeDir } from "./config-store-
|
|
5
|
+
import { ct as canonicalizePath, f as DEFAULT_TIMER_FNS, p as unrefTimer, s as glimmervoidHomeDir } from "./config-store-_A681WTh.js";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import crypto from "node:crypto";
|
|
@@ -4,8 +4,8 @@ import { m as AgentSettingsReply } from "./session-CmkfJxzB.js";
|
|
|
4
4
|
import { r as BrowserConfig } from "./config-ClFP3R54.js";
|
|
5
5
|
import { n as isRecord } from "./coerce-oz_Z_6E7.js";
|
|
6
6
|
import { t as renderTable } from "./ascii-figure-core-pDAwtlKO.js";
|
|
7
|
-
import { E as setValueAtPath, Q as readEnvSecrets, T as scoreSettingsSearch, Z as ENV_SECRET_BINDINGS, b as cloneValue, c as loadConfigFile, d as validateConfig, et as withEnvSecrets, j as SETTINGS_REGISTRY, k as valueAtPath, m as isSettingAvailable, r as IS_EXPERIMENTAL_BUILD, u as saveConfigFileOnce, w as parsePosthogProjectSelection, x as deleteValueAtPath } from "./config-store-
|
|
8
|
-
import { a as fail, c as listSettings, d as renderSectionTables, f as requireConfigFileSetting, g as valueText, h as succeed, i as describeSetting, l as readSetting, m as settingsRequestForServer, n as configFileViewOf, o as fitColumn, p as sectionOf, r as defaultText, s as getSetting, t as availableSettings } from "./settings-readout-core-
|
|
7
|
+
import { E as setValueAtPath, Q as readEnvSecrets, T as scoreSettingsSearch, Z as ENV_SECRET_BINDINGS, b as cloneValue, c as loadConfigFile, d as validateConfig, et as withEnvSecrets, j as SETTINGS_REGISTRY, k as valueAtPath, m as isSettingAvailable, r as IS_EXPERIMENTAL_BUILD, u as saveConfigFileOnce, w as parsePosthogProjectSelection, x as deleteValueAtPath } from "./config-store-_A681WTh.js";
|
|
8
|
+
import { a as fail, c as listSettings, d as renderSectionTables, f as requireConfigFileSetting, g as valueText, h as succeed, i as describeSetting, l as readSetting, m as settingsRequestForServer, n as configFileViewOf, o as fitColumn, p as sectionOf, r as defaultText, s as getSetting, t as availableSettings } from "./settings-readout-core-iX9Lmx9C.js";
|
|
9
9
|
import fs from "node:fs";
|
|
10
10
|
import os from "node:os";
|
|
11
11
|
//#region server/settings-cli.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h as AgentSettingsRequest } from "./session-CmkfJxzB.js";
|
|
2
2
|
import { t as renderTable } from "./ascii-figure-core-pDAwtlKO.js";
|
|
3
|
-
import { A as FILE_ONLY_GROUPS, C as hasScaledUnit, D as settingsGroupOf, O as settingsOf, Q as readEnvSecrets, S as displayText, b as cloneValue, j as SETTINGS_REGISTRY, k as valueAtPath, m as isSettingAvailable, y as SETTINGS_INDEX } from "./config-store-
|
|
3
|
+
import { A as FILE_ONLY_GROUPS, C as hasScaledUnit, D as settingsGroupOf, O as settingsOf, Q as readEnvSecrets, S as displayText, b as cloneValue, j as SETTINGS_REGISTRY, k as valueAtPath, m as isSettingAvailable, y as SETTINGS_INDEX } from "./config-store-_A681WTh.js";
|
|
4
4
|
//#region server/core/settings-readout-core.ts
|
|
5
5
|
var VALUE_COLUMN_WIDTH = 40;
|
|
6
6
|
var SECTION_BY_SETTING_ID = new Map([...SETTINGS_REGISTRY.sections.flatMap((section) => section.settings.map((setting) => [setting.id, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as firstLine } from "./text-core-rXHoQWP9.js";
|
|
2
|
-
import { n as configSiblingPath } from "./pairings-store-
|
|
2
|
+
import { n as configSiblingPath } from "./pairings-store-DshCT7KO.js";
|
|
3
3
|
import { a as gitCommonDirectoryOf, c as findRecord, d as parseCommitLog, f as parseWhyTarget, g as runGit, l as formatWhy, n as GIT_MAX_BUFFER, o as patchIdsOfBatch, r as GIT_TIMEOUT_MS, s as storePathFor, t as COMMIT_SESSIONS_FOLDER_NAME, u as lastPromptBefore } from "./commit-sessions-DdXZUMYK.js";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./updates-view-core-Qkm1ZY4B.js";import{n as e,r as t,s as n}from"./dom-helpers-DBbFg1c_.js";import{$ as r,Q as i,et as a}from"./index-
|
|
1
|
+
import"./updates-view-core-Qkm1ZY4B.js";import{n as e,r as t,s as n}from"./dom-helpers-DBbFg1c_.js";import{$ as r,Q as i,et as a}from"./index-Bq8I2EvJ.js";var o={mine:`Mine`,run:`Run`,cancel:`Cancel`},s=null;function c(e){return e===null?`n/a`:`${Math.round(e*100)}%`}function l(e){if(e===null)return`n/a`;let t=Math.round(e*100);return t>0?`+${t}`:String(t)}function u(e,t,i){let a=n(`button`,`bench-action-button`,o[t]);return a.type=`button`,a.disabled=i,a.addEventListener(`click`,()=>r(e.id,t)),a}function d(e,t){let n=e.inFlight;if(!n||n.suiteId!==t.id)return``;let r=n.caseId?`case ${n.caseId}, `:``;return`Cell ${n.cellIndex+1} of ${n.cellCount}: ${r}arm ${n.armId}, trial ${n.trial}, ${n.phase}.`}function f(e){let t=n(`td`,`bench-score`,c(e?.recall??null));return e&&e.invalid>0&&(t.title=`${e.invalid} invalid or failed cell(s)`),e&&e.degraded>0&&(t.dataset.degraded=`true`),t}function p(e){let t=e.armIds.filter(t=>t!==e.baselineArm),r=n(`table`,`bench-table`),i=n(`tr`);i.append(n(`th`,null,`Case`),...e.armIds.map(t=>n(`th`,null,t===e.baselineArm?`${t} (baseline)`:t))),i.append(...t.map(e=>n(`th`,null,`${e} vs baseline`))),r.append(i);for(let i of e.rows){let a=n(`tr`);a.append(n(`td`,`bench-case`,i.caseId),...e.armIds.map(e=>f(i.arms[e]))),a.append(...t.map(e=>n(`td`,`bench-delta`,l(i.deltaVsBaseline[e]??null)))),r.append(a)}let a=[...new Set(e.armIds.flatMap(t=>Object.keys(e.totals[t]?.recallByTag??{})))].sort(),o=n(`tr`,`bench-total`);o.append(n(`td`,`bench-case`,`Paired recall`),...e.armIds.map(t=>f(e.totals[t]))),r.append(o);for(let t of a){let i=n(`tr`,`bench-total`);i.append(n(`td`,`bench-case`,`Recall, ${t}`),...e.armIds.map(r=>n(`td`,`bench-score`,c(e.totals[r]?.recallByTag[t]??null)))),r.append(i)}return r}function m(e,r){let{isServerConnected:a,pendingActionBySuite:o,outcomeBySuite:s}=i(),c=n(`div`,`bench-suite`),l=e.inFlight?.suiteId===r.id,f=!!e.inFlight&&!l,m=o.has(r.id)||!a,h=n(`div`,`bench-summary`);h.append(n(`span`,`bench-suite-title`,r.title),t(`bench`,r.caseCount===1?`case`:`cases`,String(r.caseCount)),t(`bench`,r.candidateCount===1?`candidate`:`candidates`,String(r.candidateCount)),t(`bench`,`arms`,String(r.armIds.length))),c.append(h);let g=n(`div`,`bench-controls`),_=e.configured===!0&&r.error===null;g.append(u(r,`mine`,!_||m||l),u(r,`run`,!_||m||l||f||r.caseCount===0),u(r,`cancel`,m||!l));let v=n(`span`,`bench-status`,(a?``:`Not connected to the server. Reconnecting.`)||d(e,r)||s.get(r.id)||``);if(v.setAttribute(`role`,`status`),g.append(v),c.append(g),r.error)return c.append(n(`p`,`bench-error`,r.error)),c;let y=r.latestReport;return y?(c.append(n(`p`,`bench-run-line`,`Latest run ${y.runId}: ${y.status}. Only cases every arm scored count toward paired recall.`)),y.rows.length>0&&c.append(p(y)),c):(c.append(n(`p`,`bench-empty`,r.caseCount===0?`Move approved candidates into the cases folder, then choose Run.`:`No run yet.`)),c)}function h(){if(!s)return;s.textContent=``;let{status:t}=i(),r=e(`bench`,`Benchmarks`,`Suites from the benchmarks folder of the Glimmervoid home, one run at a time.`);if(s.append(r),!t)s.append(n(`p`,`bench-empty`,`Waiting for the server.`));else if(!t.configured)s.append(n(`p`,`bench-empty`,t.reason||`Benchmarks are off.`));else if(t.suites.length===0)s.append(n(`p`,`bench-empty`,`No suites yet. Create a folder holding suite.json under benchmarks in the Glimmervoid home.`));else for(let e of t.suites)s.append(m(t,e))}function g(e){s||(s=n(`div`,`bench-content`),e.append(s),a(h),h())}var _={mount:g};export{_ as view};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bt as e}from"./updates-view-core-Qkm1ZY4B.js";import{s as t}from"./dom-helpers-DBbFg1c_.js";import{a as n,r}from"./card-registry-CLrAbqh5.js";import{i}from"./action-status-SSA4xM57.js";import{a,n as o}from"./modal-USMHOKBI.js";import{$r as s,Sn as c,ai as l,bi as u,ci as d,ei as f,ii as p,li as m,ni as h,oi as g,ri as _,si as v,ti as y,xi as ee,yi as te}from"./index-DHeVbbPl.js";var ne=4,re=200,ie=2e4,ae=1.1,oe=[`wire`,`note`,`frame`,`box`,`unit`];function b(e){let t=Math.random().toString(36).slice(2,8);return`${e}-${Date.now().toString(36)}${t}`}function x(){return document.documentElement.dataset.layout===`phone`}function se(e){return e instanceof Element?e.closest(`[data-linked-board-id]`)?.dataset.linkedBoardId??null:null}function ce(e){let{svg:n,canvas:r,renderer:i}=e,a=new Map,o=new Set,s={x:0,y:0,width:1e3,height:600},c=null,l=null;function u(){n.setAttribute(`viewBox`,`${s.x} ${s.y} ${s.width} ${s.height}`)}function d(){let e=i.layout();if(!e)return;let{bounds:t}=e,r=n.clientWidth,a=n.clientHeight;if(r===0||a===0){s={...t},u();return}let o=Math.max(1,t.width/r,t.height/a),c=r*o;s={x:t.x-(c-t.width)/2,y:t.y,width:c,height:a*o},u()}function f(e,t){let r=n.getScreenCTM();if(!r)return{x:e,y:t};let i=new DOMPoint(e,t).matrixTransform(r.inverse());return{x:i.x,y:i.y}}function p(){let e=n.clientWidth||1,t=n.clientHeight||1;return Math.max(s.width/e,s.height/t)}function m(e,t){let n=Math.min(ie,Math.max(re,s.width*t)),r=n/s.width;s={x:e.x-(e.x-s.x)*r,y:e.y-(e.y-s.y)*r,width:n,height:s.height*r},u()}function h(e,t){let n=p();s={...s,x:s.x-e*n,y:s.y-t*n},u()}function g(t){o=t,i.setSelection(o),e.onSelectionChange(o)}function _(e,t){if(!t){g(o.has(e)&&o.size===1?new Set:new Set([e]));return}let n=new Set(o);n.delete(e)||n.add(e),g(n)}function v(e){let t=new Set([...o].filter(t=>e?.elements[t]));t.size!==o.size&&g(t)}function y(e){let t=i.layout()?.elements.find(t=>t.id===e);return t?.kind===`box`?t:null}function ee(){let[e,t]=[...a.values()];return!e||!t?0:Math.hypot(e.x-t.x,e.y-t.y)}function te(){c={kind:`pinch`,distance:ee(),viewWidth:s.width}}function b(t){if(t.button!==0||l)return;let r=se(t.target);if(r){e.onOpenLinkedBoard(r);return}if(a.set(t.pointerId,{x:t.clientX,y:t.clientY}),n.setPointerCapture(t.pointerId),a.size===2){te();return}let o=i.elementFromTarget(t.target),s=o?.kind===`box`&&!x()?y(o.id):null;if(o&&s){c={kind:`drag`,pointerId:t.pointerId,boxId:o.id,origin:f(t.clientX,t.clientY),start:s,hasMoved:!1,isAdditive:t.shiftKey};return}if(o&&!x()){_(o.id,t.shiftKey);return}let u=o?.kind===`box`?o.id:null;c={kind:`pan`,pointerId:t.pointerId,lastClient:{x:t.clientX,y:t.clientY},hasMoved:!1,tappedBoxId:u}}function ce(e,t){let n=f(t.clientX,t.clientY),r=n.x-e.origin.x,a=n.y-e.origin.y;!e.hasMoved&&Math.hypot(r,a)<ne*p()||(e.hasMoved=!0,i.nodeOf(e.boxId)?.setAttribute(`transform`,`translate(${r} ${a})`))}function S(e,t){let n=t.clientX-e.lastClient.x,r=t.clientY-e.lastClient.y;!e.hasMoved&&Math.hypot(n,r)<ne||(e.hasMoved=!0,e.lastClient={x:t.clientX,y:t.clientY},h(n,r))}function le(e){let t=ee();if(t<=0||e.distance<=0)return;let n=[...a.values()];m(f(n.reduce((e,t)=>e+t.x,0)/n.length,n.reduce((e,t)=>e+t.y,0)/n.length),e.viewWidth*(e.distance/t)/s.width)}function C(e){a.has(e.pointerId)&&(a.set(e.pointerId,{x:e.clientX,y:e.clientY}),c?.kind===`pinch`?le(c):c?.kind===`drag`&&c.pointerId===e.pointerId?ce(c,e):c?.kind===`pan`&&c.pointerId===e.pointerId&&S(c,e))}async function w(t,n){if(!t.hasMoved){_(t.boxId,t.isAdditive);return}let r=f(n.clientX,n.clientY),a=i.layout()?.pinnedOffsetY??0,o={x:Math.round(t.start.x+r.x-t.origin.x),y:Math.round(t.start.y+r.y-t.origin.y-a)};await e.sendOps([{op:`set`,id:t.boxId,fields:{at:o}}])||i.nodeOf(t.boxId)?.removeAttribute(`transform`)}function ue(t){if(!a.delete(t.pointerId))return;let n=c;n?.kind===`pinch`?c=null:(c=null,n?.kind===`drag`&&n.pointerId===t.pointerId?w(n,t):n?.kind!==`pan`||n.hasMoved||(n.tappedBoxId&&x()?e.onPhoneTapBox(n.tappedBoxId):n.tappedBoxId||g(new Set)))}function de(e){a.delete(e.pointerId),c?.kind===`drag`&&i.nodeOf(c.boxId)?.removeAttribute(`transform`),c=null}function fe(e){e.preventDefault(),e.ctrlKey||e.metaKey?m(f(e.clientX,e.clientY),e.deltaY>0?ae:1/ae):h(-e.deltaX,-e.deltaY)}function T(){let e=l;l=null,e?.remove()}function pe(a){let o=e.currentBoard()?.elements[a],s=i.nodeOf(a);if(o?.kind!==`box`||!s)return;T();let c=r.getBoundingClientRect(),u=s.getBoundingClientRect(),d=t(`input`,`wb-title-input`);d.type=`text`,d.value=o.title,d.maxLength=80,d.setAttribute(`aria-label`,`Box title`),d.style.left=`${u.left-c.left}px`,d.style.top=`${u.top-c.top}px`,d.style.width=`${Math.max(160,u.width)}px`,l=d,r.append(d),d.addEventListener(`keydown`,t=>{if(t.key===`Escape`){t.preventDefault(),T(),n.focus();return}if(t.key!==`Enter`)return;t.preventDefault();let r=d.value.trim();T(),n.focus(),r&&r!==o.title&&e.sendOps([{op:`set`,id:a,fields:{title:r}}])}),d.addEventListener(`blur`,T),d.focus(),d.select()}function E(e){if(x())return;let t=i.elementFromTarget(document.elementFromPoint(e.clientX,e.clientY));t?.kind===`box`&&pe(t.id)}function D(){let t=e.currentBoard();if(!t||o.size===0)return;let n=[...o].flatMap(e=>t.elements[e]??[]),r=oe.flatMap(e=>n.filter(t=>t.kind===e)).map(e=>({op:`remove`,id:e.id}));g(new Set),e.sendOps(r)}function me(e){e.target===n&&(e.key===`Delete`||e.key===`Backspace`?(e.preventDefault(),D()):e.key===`Escape`&&g(new Set))}return n.tabIndex=0,n.addEventListener(`pointerdown`,b),n.addEventListener(`pointermove`,C),n.addEventListener(`pointerup`,ue),n.addEventListener(`pointercancel`,de),n.addEventListener(`wheel`,fe,{passive:!1}),n.addEventListener(`dblclick`,E),n.addEventListener(`keydown`,me),{fit:d,selectedIds:()=>o,clearSelection:()=>g(new Set),pruneSelection:v,closeTitleInput:T}}var S=40,le=44,C=220,w=90,ue=30,de=20,fe=18,T=20,pe=26,E=18,D=26,me=170,he=21,ge=17,_e=10,ve=22,ye=24,be=16,xe=16,Se=26,Ce=24,we=8,Te=10,Ee=14,De=4,Oe=14,ke=8,O=6,Ae=4,je=6,Me=12,Ne=10,Pe=6.6,k=5,A=10,Fe=2,Ie=100,Le=120,Re=4,ze=40,Be=[.5,.35,.65,.2,.8],Ve=Object.freeze({blue:`#60a5fa`,green:`#4ade80`,orange:`#fb923c`,pink:`#f472b6`,cyan:`#22d3ee`,yellow:`#facc15`});function j(e,t){let n=e.split(/\s+/).filter(Boolean),r=[],i=``;for(let e of n){let n=e.match(RegExp(`.{1,${t}}`,`g`))??[e];for(let e of n){let n=i?`${i} ${e}`:e;n.length<=t?i=n:(r.push(i),i=e)}}return i&&r.push(i),r.length>0?r:[``]}function He(e,t){let n=e.lanes.find(e=>e.id===t.lane);return n?{label:n.label||n.id,hex:Ve[n.color]}:null}function Ue(e,t){let n=j(t.title,T),r=t.lines.flatMap(e=>j(e.text,pe-(e.muted?2:0)).map(t=>({text:t,muted:e.muted}))),i=He(e,t);return{titleLines:n,bodyLines:r,lane:i,height:24+n.length*de+r.length*fe+(i?26:0)}}function M(e,t){return Object.values(e.elements).filter(e=>e.kind===t)}function We(e){let t=j(e.text,he);return{lines:t,height:24+(t.length+1)*ge}}function Ge(e){let t=new Map;for(let n of M(e,`note`)){let e=t.get(n.on),r=We(n).height;t.set(n.on,e===void 0?r:e+_e+r)}return t}function Ke(e){return e.columns.map(e=>e.title?j(e.title,ye):[])}function qe(e){return(Math.max(1,...e.map(e=>e.length))-1)*be}function N(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e);i?i.push(r):n.set(e,[r])}return n}function Je(e,t){let n=M(e,`box`).filter(e=>!e.at),r=new Set(n.filter(e=>t.has(e.id)).map(e=>e.column)),i=new Set(M(e,`frame`).flatMap(e=>e.contains)),a=new Set(n.filter(e=>i.has(e.id)).map(e=>e.column)),o=e=>Te+(e!==void 0&&a.has(e)?E:0);return e.columns.map((t,n)=>{let i=r.has(t.id);return{left:i?156:o(t.id),right:o(e.columns[n+1]?.id),minimumWidth:i?Math.max(w,186):w}})}function Ye(e,t,n){return e.map((e,r)=>{let i=t[r]??0,a=n[r]??0,o=i>0?e.left+e.right+(i+1)*Ee:0,s=a>0?e.left+e.right+a+20:0;return Math.max(e.minimumWidth,o,s)})}function Xe(e,t){let n=[],r=S;for(let[i]of e.columns.entries())n.push(r),r+=C+(t[i]??w);return n}function Ze(e,t,n){return e.map((e,r)=>{let i=n[r]??{left:Te,right:Te,minimumWidth:w},a=e+C+(t[r]??w);return{left:e+C+i.left,right:a-i.right}})}function Qe(e,t,n,r){if(!t.at)return Math.max(0,e.columns.findIndex(e=>e.id===t.column));let i=n.x+n.width/2,a=r.findLastIndex(e=>e<=i);return Math.max(0,a)}function $e(e){let t=new Map;for(let n of M(e,`frame`))for(let e of n.contains)t.has(e)||t.set(e,n.id);return t}function et(e,t){return e===t?0:(e?E:0)+(t?44:0)}function tt(e,t,n,r){let i=new Map,a=new Map,o=new Map,s=$e(e),c=M(e,`box`).map((e,t)=>({box:e,index:t})).sort((e,t)=>e.box.order-t.box.order||e.index-t.index);for(let{box:l}of c){let c=Math.max(0,e.columns.findIndex(e=>e.id===l.column)),u=Ue(e,l),d=s.get(l.id)??null,f=(a.get(l.column)??n)+et(o.get(l.column)??null,d),p=l.at??{x:t[c]??S,y:f};if(!l.at){let e=(r.get(l.id)??0)-we;a.set(l.column,f+Math.max(u.height,e)+ue),o.set(l.column,d)}i.set(l.id,{kind:`box`,id:l.id,x:p.x,y:p.y,width:C,height:u.height,titleLines:u.titleLines,bodyLines:u.bodyLines,lane:u.lane,isGhost:l.ghost})}return i}function nt(e){if(e.length===0)return null;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y)),r=Math.max(...e.map(e=>e.x+e.width)),i=Math.max(...e.map(e=>e.y+e.height));return{x:t,y:n,width:r-t,height:i-n}}function rt(e,t){return M(e,`frame`).flatMap(e=>{let n=nt(e.contains.flatMap(e=>t.get(e)??[]));return n?[{kind:`frame`,id:e.id,title:e.title,x:n.x-E,y:n.y-E-D,width:n.width+36,height:n.height+36+D}]:[]})}function it(e){return e===`left`||e===`right`}function P(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function at(e,t,n,r){let i=e.y<t.y?e:t,a=i===e?t:e;return[...r.boxesById.values()].some(o=>o.id!==e.id&&o.id!==t.id&&r.columnIndexByBoxId.get(o.id)===n&&o.y<a.y&&o.y+o.height>i.y+i.height)}function ot(e,t,n){let r=n.columnIndexByBoxId.get(e.id)??0,i=n.columnIndexByBoxId.get(t.id)??0;if(r===i){if(e.id!==t.id&&!at(e,t,r,n)){let n=t.y>e.y;return{shape:`straight`,exitSide:n?`bottom`:`top`,entrySide:n?`top`:`bottom`,sourceGap:-1,targetGap:-1}}return{shape:`channel`,exitSide:`right`,entrySide:`right`,sourceGap:r,targetGap:r}}return i>r?{shape:i===r+1?`channel`:`long`,exitSide:`right`,entrySide:`left`,sourceGap:r,targetGap:i-1}:{shape:i===r-1?`channel`:`long`,exitSide:`left`,entrySide:`right`,sourceGap:r-1,targetGap:i}}function st(e){let t=e.wires.flatMap(t=>{let n=e.boxesById.get(t.from),r=e.boxesById.get(t.to);if(!n||!r)return[];let i=t.tone===`lane`?n.lane?.hex??null:null,a=P(n);return[{wire:t,from:n,to:r,strokeHex:i,styleKey:`${t.dashed}|${t.tone}|${i}`,...ot(n,r,e),busKey:null,start:a,end:P(r),crossingY:a.y}]}),n=new Map,r=e=>`${e.to.id}|${e.entrySide}|${e.styleKey}`;for(let e of t)e.shape!==`straight`&&n.set(r(e),(n.get(r(e))??0)+1);for(let e of t)e.shape!==`straight`&&(n.get(r(e))??0)>1&&(e.busKey=r(e));return t}function ct(e,t,n){let r=Array.from({length:n},(e,t)=>t);if(it(t)){let i=t===`left`?e.x:e.x+e.width,a=Math.min(Oe,(e.height-16)/Math.max(n-1,1)),o=e.y+Math.min(e.height/2,40)-(n-1)*a/2,s=Math.max(e.y+ke,Math.min(o,e.y+e.height-ke-(n-1)*a));return r.map(e=>({x:i,y:Math.round(s+e*a)}))}let i=t===`top`?e.y:e.y+e.height,a=e.x+e.width/2-(n-1)*Oe/2;return r.map(e=>({x:Math.round(a+e*Oe),y:i}))}function lt(e){return N(e.flatMap(e=>[{box:e.from,side:e.exitSide,groupKey:`exit|${e.styleKey}`,wireId:e.wire.id,farPoint:P(e.to),assign:t=>{e.start=t}},{box:e.to,side:e.entrySide,groupKey:e.busKey?`bus|${e.busKey}`:`entry|${e.wire.id}`,wireId:e.wire.id,farPoint:P(e.from),assign:t=>{e.end=t}}]),e=>`${e.box.id}|${e.side}`)}function ut(e){return new Map([...e.entries()].map(([e,t])=>[e,[...N(t,e=>e.groupKey).entries()].map(([e,t])=>({groupKey:e,firstWireId:t.map(e=>e.wireId).sort()[0]??e,farCoordinate:t.reduce((e,t)=>e+(it(t.side)?t.farPoint.y:t.farPoint.x),0)/t.length})).sort((e,t)=>e.farCoordinate-t.farCoordinate||e.firstWireId.localeCompare(t.firstWireId)||e.groupKey.localeCompare(t.groupKey)).map(e=>e.groupKey)]))}function dt(e,t){for(let[n,r]of e){let e=r[0],i=t.get(n)??[];if(!e)continue;let a=ct(e.box,e.side,i.length);for(let e of r){let t=a[i.indexOf(e.groupKey)];t&&e.assign(t)}}}function ft(e,t){let n=t[e.sourceGap]??{left:e.start.x,right:e.start.x},r=t[e.targetGap]??{left:e.end.x,right:e.end.x};return{left:Math.min(n.left,r.left),right:Math.max(n.right,r.right)}}function pt(e,t,n){return[...[...n.boxesById.values()].filter(t=>t.id!==e.from.id&&t.id!==e.to.id),...n.obstacles].filter(e=>e.x<t.right&&e.x+e.width>t.left)}function mt(e,t){return!t.some(t=>e>t.y-O&&e<t.y+t.height+O)}function ht(e){let t=e.map(e=>({top:e.y-O,bottom:e.y+e.height+O})).sort((e,t)=>e.top-t.top),n=[];for(let e of t){let t=n.at(-1);t&&e.top<=t.bottom?t.bottom=Math.max(t.bottom,e.bottom):n.push({...e})}return n.slice(1).flatMap((e,t)=>{let r=n[t];return!r||e.top-r.bottom<Ae?[]:[{top:r.bottom,bottom:e.top}]})}function gt(e,t){return e.left<t.right&&t.left<e.right}function _t(e,t){let n=[];return e.forEach((r,i)=>{let a=e.slice(0,i).flatMap((e,i)=>t(r,e)?[n[i]??0]:[]);n.push(a.length>0?Math.max(...a)+1:0)}),n}function vt(e,t){let n=[],r=[];for(let i of e){if(i.shape!==`long`)continue;let e=ft(i,t.gaps),a=pt(i,e,t),o=[i.start.y,i.end.y].find(e=>mt(e,a));if(o!==void 0){i.crossingY=o;continue}let s=(i.start.y+i.end.y)/2,c=ht(a).sort((e,t)=>Math.abs((e.top+e.bottom)/2-s)-Math.abs((t.top+t.bottom)/2-s))[0];c?n.push({plan:i,interval:c,span:e}):r.push({plan:i,span:e})}let i=N(n,e=>`${Math.round(e.interval.top)}|${Math.round(e.interval.bottom)}`);for(let e of i.values()){let t=[...e].sort((e,t)=>e.plan.start.y-t.plan.start.y||e.plan.wire.id.localeCompare(t.plan.wire.id)),n=_t(t,(e,t)=>gt(e.span,t.span)),i=t[0]?.interval??{top:0,bottom:0},a=i.bottom-i.top,o=Math.max(1,Math.floor(a/je)-1),s=Math.min(o,Math.max(...n)+1);t.forEach((e,t)=>{let c=n[t]??0;c>=o?r.push({plan:e.plan,span:e.span}):e.plan.crossingY=Math.round(i.top+a*(c+1)/(s+1))})}let a=[...r].sort((e,t)=>t.span.right-t.span.left-(e.span.right-e.span.left)||e.plan.wire.id.localeCompare(t.plan.wire.id)),o=_t(a,(e,t)=>gt(e.span,t.span)).map(e=>a.length-1-e);return a.forEach(({plan:e},n)=>{e.crossingY=t.topBandBottom-(o[n]??0)*Me}),r.length>0?Math.max(...o)+1:0}function yt(e,t){return t<=e?`left`:`right`}function bt(e,t){return{key:e,gap:t,top:1/0,bottom:-1/0,leftYs:[],rightYs:[],track:-1,x:0}}function F(e,t,n){(t===`left`?e.leftYs:e.rightYs).push(n),e.top=Math.min(e.top,n),e.bottom=Math.max(e.bottom,n)}function I(e){return e.busKey?`bus|${e.busKey}`:`wire|${e.wire.id}|target`}function xt(e,t){let n=new Map,r=(e,t)=>{let r=n.get(e);if(r)return r;let i=bt(e,t);return n.set(e,i),i},i=new Set;for(let n of e){if(n.shape===`straight`)continue;let e=t.columnIndexByBoxId.get(n.from.id)??0,a=t.columnIndexByBoxId.get(n.to.id)??0,o=n.exitSide===`right`&&n.entrySide===`left`,s=r(I(n),n.targetGap);if(n.shape===`channel`&&F(s,yt(n.targetGap,e),n.start.y),n.shape===`long`){let t=r(`wire|${n.wire.id}|source`,n.sourceGap);F(t,yt(n.sourceGap,e),n.start.y),F(t,o?`right`:`left`,n.crossingY),F(s,o?`left`:`right`,n.crossingY)}i.has(s.key)||(i.add(s.key),F(s,yt(n.targetGap,a),n.end.y))}return n}function St(e,t){return e.filter(e=>e>t.top&&e<t.bottom).length}function Ct(e,t){return St(t.leftYs,e)+St(e.rightYs,t)}function wt(e,t){let n=t.map(()=>0),r=N([...e.values()].filter(e=>e.bottom>e.top),e=>e.gap);for(let[e,i]of r){let r=[...i].sort((e,t)=>Ct(e,t)-Ct(t,e)||e.top-t.top||e.key.localeCompare(t.key)),a=_t(r,(e,t)=>e.top<t.bottom+De&&t.top<e.bottom+De),o=Math.max(...a)+1;n[e]=o;let s=t[e]??{left:0,right:0};r.forEach((e,t)=>{e.track=a[t]??0,e.x=Math.round(s.left+(s.right-s.left)*(e.track+1)/(o+1))})}for(let n of e.values()){if(n.track>=0)continue;let e=t[n.gap]??{left:0,right:0};n.x=Math.round((e.left+e.right)/2)}return n}function Tt(e){let t=e.filter((t,n)=>{let r=e[n-1];return!r||r.x!==t.x||r.y!==t.y});return t.filter((e,n)=>{let r=t[n-1],i=t[n+1];return!r||!i||!(r.x===e.x&&e.x===i.x||r.y===e.y&&e.y===i.y)})}function Et(e){return e.slice(1).flatMap((t,n)=>{let r=e[n];return r?[{from:r,to:t}]:[]})}function Dt(e){if(e.start.x===e.end.x)return[e.start,e.end];let t=Math.round((e.start.y+e.end.y)/2);return[e.start,{x:e.start.x,y:t},{x:e.end.x,y:t},e.end]}function Ot(e,t){if(e.shape===`straight`)return Dt(e);let n=t.get(I(e))?.x??e.end.x,r=e.shape===`long`?e.crossingY:e.start.y,i=t.get(`wire|${e.wire.id}|source`)?.x??n,a=e.shape===`long`?[e.start,{x:i,y:e.start.y},{x:i,y:r},{x:n,y:r}]:[e.start,{x:n,y:r}];return e.busKey?a:[...a,{x:n,y:e.end.y},e.end]}function kt(e){return e.map((e,t)=>`${t===0?`M`:`L`} ${e.x} ${e.y}`).join(` `)}function At(e,t){let n=new Map;for(let t of[...e].sort((e,t)=>e.wire.id.localeCompare(t.wire.id)))t.busKey&&!n.has(t.busKey)&&n.set(t.busKey,t.wire.id);return e.map(e=>{let r=Tt(Ot(e,t)),i=e.busKey?t.get(I(e)):void 0,a=e.busKey!==null&&n.get(e.busKey)===e.wire.id,o=i&&a?[{from:{x:i.x,y:i.top},to:{x:i.x,y:i.bottom}},{from:{x:i.x,y:e.end.y},to:e.end}].filter(e=>e.from.x!==e.to.x||e.from.y!==e.to.y):[];return{plan:e,points:r,trunk:o,segments:[...Et(r),...o]}})}function L(e){return e.from.y===e.to.y}function jt(e,t){let n=t.x+t.width,r=t.y+t.height;if(L(e)){let i=e.from.y;return t.y<i&&i<r&&Math.min(e.from.x,e.to.x)<n&&Math.max(e.from.x,e.to.x)>t.x}let i=e.from.x;return t.x<i&&i<n&&Math.min(e.from.y,e.to.y)<r&&Math.max(e.from.y,e.to.y)>t.y}function Mt(e,t){return e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height}function Nt(e){return Math.ceil(e.length*Pe)}function Pt(e,t){return{x:e.x-t/2,y:e.y-A,width:t,height:13}}function Ft(e){return Math.abs(e.from.x-e.to.x)+Math.abs(e.from.y-e.to.y)}function It(e,t){let n=[...e].sort((e,t)=>Ft(t)-Ft(e));return[...e.slice(0,1),...n].flatMap(e=>[...Be.flatMap(n=>{let r=e.from.x+(e.to.x-e.from.x)*n,i=e.from.y+(e.to.y-e.from.y)*n;return L(e)?[{x:r,y:i-k},{x:r,y:i+k+A}]:[{x:r+k+t/2,y:i+A/2},{x:r-k-t/2,y:i+A/2}]}),...Lt(e,t)])}function Lt(e,t){if(!L(e))return[];let n=e.from.y;return[Math.min(e.from.x,e.to.x)+k+t/2,Math.max(e.from.x,e.to.x)-k-t/2].flatMap(e=>[{x:e,y:n-k},{x:e,y:n+k+A}])}function Rt(e,t){return{x:e.x-t,y:e.y-t,width:e.width+t*2,height:e.height+t*2}}function zt(e,t,n){let r=new Map,i=e.flatMap(e=>e.segments),a=[...t.boxesById.values(),...t.obstacles];for(let o of e){let e=o.plan.wire.label;if(!e)continue;let s=Nt(e),c=It(o.segments,s),l=c.find(e=>{let n=Pt(e,s);if(n.y<t.contentTop)return!1;let o=Rt(n,Fe);return i.some(e=>jt(e,o))||a.some(e=>Mt(n,e))?!1:![...r.values()].some(e=>Mt(n,e.bounds))}),u=l??c[0]??P(o.plan.from);l||n.push(`wire ${o.plan.wire.id} label "${e}" has no clear spot`),r.set(o.plan.wire.id,{at:{x:Math.round(u.x),y:Math.round(u.y)},bounds:Pt(u,s)})}return r}function Bt(e,t,n){return e>Math.min(t,n)+.5&&e<Math.max(t,n)-.5}function Vt(e,t){if(L(e)===L(t))return!1;let n=L(e)?e:t,r=n===e?t:e;return Bt(r.from.x,n.from.x,n.to.x)&&Bt(n.from.y,r.from.y,r.to.y)}function Ht(e,t){if(L(e)!==L(t))return!1;let n=L(e),r=e=>n?e.from.y:e.from.x,i=e=>Math.min(n?e.from.x:e.from.y,n?e.to.x:e.to.y),a=e=>Math.max(n?e.from.x:e.from.y,n?e.to.x:e.to.y);return r(e)===r(t)&&Math.min(a(e),a(t))-Math.max(i(e),i(t))>1}function Ut(e,t){return e.plan.styleKey===t.plan.styleKey&&e.plan.start.x===t.plan.start.x&&e.plan.start.y===t.plan.start.y}function Wt(e){return e.flatMap((t,n)=>e.slice(n+1).flatMap(e=>{if(t.plan.busKey!==null&&t.plan.busKey===e.plan.busKey)return[];let n=t.segments.flatMap(t=>e.segments.map(e=>[t,e]));return n.some(([e,t])=>Vt(e,t))?[`wire ${t.plan.wire.id} crosses wire ${e.plan.wire.id}`]:Ut(t,e)?[]:n.some(([e,t])=>Ht(e,t))?[`wire ${t.plan.wire.id} overlaps wire ${e.plan.wire.id}`]:[]}))}function Gt(e,t){let n=[...t.boxesById.values()];return e.flatMap(e=>n.flatMap(t=>{if(t.id===e.plan.from.id||t.id===e.plan.to.id)return[];let n=Rt(t,-2);return e.segments.some(e=>jt(e,n))?[`wire ${e.plan.wire.id} runs through box ${t.id}`]:[]}))}function Kt(t){if(t.length<=e.layoutWarnings)return[...t];let n=t.slice(0,e.layoutWarnings-1);return[...n,`and ${t.length-n.length} more`]}function qt(e,t){let n=t.map(()=>0);for(let t of e)t.wire.label&&t.shape===`channel`&&(n[t.targetGap]=Math.max(n[t.targetGap]??0,Nt(t.wire.label)));return n}function Jt(e,t){return nt([...e.flatMap(e=>e.segments.flatMap(e=>[e.from,e.to])).map(e=>({x:e.x,y:e.y,width:0,height:0})),...t])}function Yt(e,t,n,r){dt(n,r);let i=vt(e,t),a=xt(e,t),o=wt(a,t.gaps),s=At(e,a);return{runsByKey:a,tracksByGap:o,topTrackCount:i,drawn:s,crossingCost:Gt(s,t).length*Ie+Wt(s).length}}function Xt(e,t){let n=e[t],r=e[t+1];n!==void 0&&r!==void 0&&(e[t]=r,e[t+1]=n)}function Zt(e,t){let n=lt(e),r=ut(n),i=Yt(e,t,n,r).crossingCost,a=e.length<=Le;for(let o of r.values())for(let s=0;a&&i>0&&s+1<o.length;s+=1){Xt(o,s);let a=Yt(e,t,n,r).crossingCost;a<i?i=a:Xt(o,s)}return Yt(e,t,n,r)}function Qt(e){let t=st(e),{runsByKey:n,tracksByGap:r,topTrackCount:i,drawn:a}=Zt(t,e),o=[],s=zt(a,e,o),c=a.map(({plan:e,points:t,trunk:r})=>{let i=t.at(-1)??e.end,a=e.busKey?n.get(I(e)):void 0,o=r.length>0,c=a!==void 0&&i.y>a.top&&i.y<a.bottom;return{kind:`wire`,id:e.wire.id,path:[kt(t),...r.map(e=>kt([e.from,e.to]))].join(` `),start:e.start,end:o||!e.busKey?e.end:i,label:e.wire.label,labelAt:s.get(e.wire.id)?.at??P(e.from),isDashed:e.wire.dashed,strokeHex:e.strokeHex,tone:e.wire.tone,hasArrowhead:e.busKey===null||o,joinAt:c?i:null}}),l=[...s.values()].map(e=>e.bounds);return{wires:c,tracksByGap:r,topTrackCount:i,labelWidthByGap:qt(t,e.gaps),warnings:Kt([...Gt(a,e),...Wt(a),...o]),extent:Jt(a,l)}}function $t(e){return e.resolvedBy?`resolved by ${e.resolvedBy}`:e.author?`from ${e.author}`:``}function en(e,t){let n=new Map;return M(e,`note`).flatMap(e=>{let r=t.get(e.on);if(!r)return[];let{lines:i,height:a}=We(e),o=n.get(e.on)??r.y-we;return n.set(e.on,o+a+_e),[{kind:`note`,id:e.id,x:r.x+r.width-Ce,y:o,width:me,height:a,lines:i,byline:$t(e),isResolved:e.resolvedBy!==null}]})}function tn(e,t,n,r){let i=e.flatMap(e=>e.kind===`wire`?[]:[e]),a=(n.at(-1)??S)+C,o=nt([...i,...t?[t]:[],{x:0,y:0,width:a,height:r}]);return o?{x:Math.min(0,o.x-S),y:Math.min(0,o.y-S),width:o.width+80,height:o.height+80}:{x:0,y:0,width:a+S,height:80}}function nn(e,t){let n=Xe(e,t.gapWidths),r=tt(e,n,t.boxesTop,t.stackHeightByBoxId),i=rt(e,r),a=en(e,r),o=new Map(M(e,`box`).flatMap(t=>{let i=r.get(t.id);return i?[[t.id,Qe(e,t,i,n)]]:[]}));return{columnLeftEdges:n,boxesById:r,frames:i,notes:a,routing:Qt({wires:M(e,`wire`),boxesById:r,columnIndexByBoxId:o,obstacles:[...a,...i.map(e=>({x:e.x,y:e.y,width:e.width,height:D}))],gaps:Ze(n,t.gapWidths,t.reserves),topBandBottom:t.boxesTop-Ne,contentTop:t.contentTop})}}function rn(e,t){return Array.from({length:Math.max(e.length,t.length)},(n,r)=>Math.max(e[r]??0,t[r]??0))}function an(e,t,n){let r=t.tracksByGap,i=t.topTrackCount;for(let a=1;;a+=1){let o=Ye(n.reserves,r,t.labelWidthByGap),s=n.headerBoxesTop+fn(i),c=nn(e,{gapWidths:o,reserves:n.reserves,boxesTop:s,contentTop:n.contentTop,stackHeightByBoxId:n.stackHeightByBoxId}),l=c.routing.topTrackCount>i,u=c.routing.tracksByGap.some((e,t)=>e>(r[t]??0));if(a>=Re||!l&&!u)return{placed:c,boxesTop:s};i=Math.max(i,c.routing.topTrackCount),r=rn(r,c.routing.tracksByGap)}}function on(e){let t=j(e.title,T),n=e.lines.flatMap(e=>j(e.text,pe)),r=+!!e.linkedBoardId;return{titleLines:t,bodyLines:n,height:42+t.length*de+(n.length+r)*fe}}function sn(e){let t=new Map,n=new Map;for(let r of m(e)){let i=e.elements[r.unitId];if(i?.kind!==`unit`)continue;let a=on(i),o=n.get(r.level)??70;n.set(r.level,o+a.height+ue),t.set(i.id,{kind:`unit`,id:i.id,x:S+(r.level-1)*310,y:o,width:C,height:a.height,label:r.label,titleLines:a.titleLines,bodyLines:a.bodyLines,linkedBoardId:i.linkedBoardId})}return t}function cn(e,t){let n={x:e.x+e.width,y:e.y+Math.round(e.height/2)},r={x:t.x,y:t.y+Math.round(t.height/2)},i=t.x-Math.round(w/2);return kt(Tt([n,{x:i,y:n.y},{x:i,y:r.y},r]))}function ln(e,t){return M(e,`unit`).flatMap(e=>{let n=t.get(e.id);return n?e.after.flatMap(e=>{let r=t.get(e);return r?[cn(r,n)]:[]}):[]})}function un(e){return e.size===0?S:Math.max(...[...e.values()].map(e=>e.y+e.height))+ze}function dn(e,t){if(t===0)return e;let n=Object.fromEntries(Object.entries(e.elements).map(([e,n])=>n.kind!==`box`||!n.at?[e,n]:[e,{...n,at:{x:n.at.x,y:n.at.y+t}}]));return{...e,elements:n}}function fn(e){return e>0?e*Me+Ne:0}function pn(e){let t=sn(e),n=un(t),r=n-S,i=dn(e,r),a=Ge(i),o=Ke(i),s=qe(o),c=n+Se+s,l=n+le+s,u=Je(i,a),{placed:d,boxesTop:f}=an(i,nn(i,{gapWidths:Ye(u,[],[]),reserves:u,boxesTop:l,contentTop:c,stackHeightByBoxId:a}).routing,{reserves:u,headerBoxesTop:l,contentTop:c,stackHeightByBoxId:a}),{columnLeftEdges:p}=d,m=[...d.frames,...d.routing.wires,...d.boxesById.values(),...d.notes,...t.values()],h=tn(m,d.routing.extent,p,f),g=h.y+h.height,_=i.lanes.map((e,t)=>({label:e.label||e.id,hex:Ve[e.color],x:S,y:g+t*ve})),v=g+_.length*ve+(_.length>0?12:0),y=i.caption?{text:i.caption,x:S,y:v}:null,ee=_.length*ve+(y?30:0)+(_.length>0?12:0);return{columns:i.columns.map((e,t)=>({id:e.id,titleLines:o[t]??[],titleBaselineY:n+xe,ruleY:c,x:p[t]??S,width:C})),elements:m,legend:_,caption:y,pinnedOffsetY:r,plan:t.size>0?{titleAt:{x:S,y:56},arrowPaths:ln(i,t)}:null,bounds:{...h,height:h.height+ee},warnings:d.routing.warnings}}function mn(e){return JSON.stringify(e)}var hn=`http://www.w3.org/2000/svg`,R=12,gn=26,_n=20,vn=18,yn=17,bn=14,xn=16,Sn=24,Cn=18,wn=`Plan`,Tn=`open linked board`;function z(e,t={},n=``){let r=document.createElementNS(hn,e);for(let[e,n]of Object.entries(t))r.setAttribute(e,String(n));return n&&r.setAttribute(`class`,n),r}function B(e,t,n,r){let i=z(`text`,{x:t,y:n},r);return i.textContent=e,i}function V(e,t){let n=z(`g`,{},`wb-element ${t}`);return n.dataset.elementId=e.id,n.dataset.elementKind=e.kind,n}function En(e){let t=V(e,e.isGhost?`wb-box wb-ghost`:`wb-box`),n=z(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:8},`wb-box-outline`);e.lane&&(n.style.stroke=e.lane.hex),t.append(n),e.titleLines.forEach((n,r)=>{t.append(B(n,e.x+R,e.y+gn+r*_n,`wb-box-title`))});let r=e.y+gn+e.titleLines.length*_n;if(e.bodyLines.forEach((n,i)=>{let a=e.x+R+(n.muted?bn:0);t.append(B(n.text,a,r+i*vn,n.muted?`wb-box-line wb-muted`:`wb-box-line`))}),!e.lane)return t;let i=e.y+e.height-28,a=Math.min(e.width-24,16+e.lane.label.length*8),o=z(`rect`,{x:e.x+R,y:i,width:a,height:18,rx:9},`wb-lane-pill`);o.style.stroke=e.lane.hex;let s=B(e.lane.label,e.x+R+8,i+13,`wb-lane-pill-text`);return s.style.fill=e.lane.hex,t.append(o,s),t}function Dn(e){let t=V(e,`wb-frame`);return t.append(z(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:12},`wb-frame-outline`),B(e.title,e.x+14,e.y+18,`wb-frame-title`)),t}function On(e){let t=V(e,`wb-wire wb-tone-${e.tone}`),n=z(`path`,{d:e.path},`wb-wire-hit`),r=z(`path`,e.hasArrowhead?{d:e.path,"marker-end":`url(#wb-arrow)`}:{d:e.path},e.isDashed?`wb-wire-line wb-dashed`:`wb-wire-line`);return e.strokeHex&&(r.style.stroke=e.strokeHex),t.append(n,r,z(`circle`,{cx:e.start.x,cy:e.start.y,r:3},`wb-wire-dot`)),e.joinAt&&t.append(z(`circle`,{cx:e.joinAt.x,cy:e.joinAt.y,r:3},`wb-wire-dot`)),e.label&&t.append(B(e.label,e.labelAt.x,e.labelAt.y,`wb-wire-label`)),t}function kn(e){let t=V(e,e.isResolved?`wb-note wb-resolved`:`wb-note`);return t.append(z(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:4},`wb-note-card`)),e.lines.forEach((n,r)=>{t.append(B(n,e.x+10,e.y+22+r*yn,`wb-note-text`))}),e.byline&&t.append(B(e.byline,e.x+10,e.y+22+e.lines.length*yn,`wb-note-byline`)),t}function An(e){let t=V(e,`wb-unit`);t.append(z(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:8},`wb-unit-outline`),B(e.label,e.x+R,e.y+Sn,`wb-unit-label`));let n=e.y+Sn+Cn;e.titleLines.forEach((r,i)=>{t.append(B(r,e.x+R,n+i*_n,`wb-box-title`))});let r=n+e.titleLines.length*_n;if(e.bodyLines.forEach((n,i)=>{t.append(B(n,e.x+R,r+i*vn,`wb-box-line`))}),!e.linkedBoardId)return t;let i=B(Tn,e.x+R,r+e.bodyLines.length*vn,`wb-unit-link`);return i.dataset.linkedBoardId=e.linkedBoardId,t.append(i),t}var jn={frame:`frames`,wire:`wires`,box:`boxes`,note:`notes`,unit:`units`},Mn=[`box`,`frame`,`wire`,`note`,`unit`];function Nn(e){switch(e.kind){case`box`:return En(e);case`frame`:return Dn(e);case`wire`:return On(e);case`note`:return kn(e);case`unit`:return An(e)}}function Pn(e){let t=z(`g`,{},`wb-chrome`);if(e.plan){t.append(B(wn,e.plan.titleAt.x,e.plan.titleAt.y,`wb-column-title`));for(let n of e.plan.arrowPaths)t.append(z(`path`,{d:n,"marker-end":`url(#wb-arrow)`},`wb-wire-line`))}for(let n of e.columns)n.titleLines.length!==0&&(n.titleLines.forEach((e,r)=>{t.append(B(e,n.x,n.titleBaselineY+r*xn,`wb-column-title`))}),t.append(z(`line`,{x1:n.x,y1:n.ruleY,x2:n.x+n.width,y2:n.ruleY},`wb-column-rule`)));for(let n of e.legend){let e=z(`rect`,{x:n.x,y:n.y,width:14,height:14,rx:3},`wb-legend-swatch`);e.style.fill=n.hex,t.append(e,B(n.label,n.x+22,n.y+12,`wb-legend-text`))}return e.caption&&t.append(B(e.caption.text,e.caption.x,e.caption.y+16,`wb-caption`)),t}function Fn(){let e=z(`defs`),t=z(`marker`,{id:`wb-arrow`,viewBox:`0 0 10 10`,refX:9,refY:5,markerWidth:8,markerHeight:8,orient:`auto-start-reverse`});return t.append(z(`path`,{d:`M 0 1 L 10 5 L 0 9 z`,fill:`context-stroke`})),e.append(t),e}function In(e){let t={frames:z(`g`,{},`wb-layer`),wires:z(`g`,{},`wb-layer`),boxes:z(`g`,{},`wb-layer`),notes:z(`g`,{},`wb-layer`),units:z(`g`,{},`wb-layer`)},n=z(`g`);e.replaceChildren(Fn(),n,t.frames,t.wires,t.boxes,t.notes,t.units);let r=new Map,i=null,a=new Set;function o(e,t){t.classList.toggle(`is-selected`,a.has(e))}function s(e){let a=pn(e),s=Pn(a);n.replaceWith(s),n=s;let c=new Set;for(let e of a.elements){c.add(e.id);let n=mn(e),i=r.get(e.id);if(i?.signature===n)continue;let a=Nn(e);o(e.id,a),i&&i.node.replaceWith(a),i||t[jn[e.kind]].append(a),r.set(e.id,{signature:n,node:a})}for(let[e,t]of r)c.has(e)||(t.node.remove(),r.delete(e));return i=a,a}function c(e){if(!(e instanceof Element))return null;let t=e.closest(`.wb-element`),n=t?.dataset.elementId,r=Mn.find(e=>e===t?.dataset.elementKind);return!n||!r?null:{id:n,kind:r}}function l(e){a=e;for(let[e,t]of r)o(e,t.node)}function u(){for(let e of r.values())e.node.remove();r.clear();let e=z(`g`);n.replaceWith(e),n=e,i=null}return{render:s,layout:()=>i,elementFromTarget:c,nodeOf:e=>r.get(e)?.node??null,setSelection:l,clear:u}}var Ln=`http://www.w3.org/2000/svg`,Rn=`No boards yet. Make one here, or have an agent run glimmervoid whiteboard new <title>.`,zn=`Pick a board above.`,H=null,U=null,W=null,G=null,Bn=!0,K=null,q=i(`action-status wb-status`),J=i(`action-status wb-status`);function Y(e){let{dialog:n,close:r,actions:i,btnCancel:a}=o({title:e.title}),s=t(`input`,`dialog-input`);s.type=`text`,s.placeholder=e.placeholder,s.maxLength=e.maxLength,s.value=e.initialValue??``,s.autocomplete=`off`,s.setAttribute(`aria-label`,e.label);let c=t(`div`,`dialog-error`);c.setAttribute(`role`,`alert`);let l=e.choices?t(`select`,`dialog-input wb-dialog-select`):null;if(l&&e.choices){l.setAttribute(`aria-label`,e.choices.label);for(let n of e.choices.options){let e=t(`option`,null,n.text);e.value=n.value,l.append(e)}}let u=t(`button`,`btn-dialog btn-dialog-confirm`,e.confirmLabel);u.type=`button`,i.append(u),n.append(t(`label`,`dialog-label`,e.label),s,...l?[l]:[],c,i);async function d(){let t=s.value.trim();if(!t){c.textContent=`${e.label} is empty.`;return}u.disabled=!0;let n=await e.onSubmit(t,l?.value??null);u.disabled=!1,n?c.textContent=n:r()}a.addEventListener(`click`,r),u.addEventListener(`click`,()=>void d()),s.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),d())}),requestAnimationFrame(()=>s.focus())}function X(){return H?g(H):null}function Vn(){return s().find(e=>e.id===H)??null}async function Hn(e){if(!H||e.length===0)return!1;let t=await v(H,e);return t.ok?(q.clear(),!0):(q.show(`error`,t.error),!1)}async function Un(e){if(!H)return`No board is open.`;let t=await v(H,e);return t.ok?null:t.error}function Wn(e){let t=r(e);return t?n(t):`closed session`}function Z(e){let t=X();return[...G?.selectedIds()??new Set].flatMap(e=>t?.elements[e]??[]).filter(t=>t.kind===e)}function Gn(){if(!U)return;let e=X(),t=Z(`box`).length,n=G?.selectedIds().size??0;U.buttons.box.disabled=!e,U.buttons.wire.disabled=t!==2,U.buttons.note.disabled=t!==1,U.buttons.frame.disabled=t===0,U.buttons.unit.disabled=!e,U.buttons.fit.disabled=!e,U.buttons.remove.disabled=!e,U.toolbar.dataset.selectedCount=String(n)}function Kn(){if(!U)return;let e=s();H&&!e.some(e=>e.id===H)&&(H=null),!H&&e[0]&&Q(e[0].id),U.list.replaceChildren(...e.map(e=>{let n=t(`button`,`wb-board-tab`,e.title);return n.type=`button`,n.setAttribute(`aria-pressed`,String(e.id===H)),e.connectedSessionIds.length>0&&n.append(t(`span`,`wb-board-tab-count`,String(e.connectedSessionIds.length))),n.addEventListener(`click`,()=>Q(e.id)),n})),qn()}function qn(){if(!U)return;let e=Vn(),n=s().length>0;U.boardHead.hidden=!e,U.canvas.hidden=!e,U.empty.hidden=!!e,U.empty.textContent=n?zn:Rn,e&&(U.boardMeta.textContent=`v${e.version}`,U.presence.replaceChildren(...e.connectedSessionIds.map(e=>t(`span`,`wb-presence-pill`,Wn(e)))),e.connectedSessionIds.length===0&&U.presence.append(t(`span`,`wb-presence-none`,`no sessions connected`)),Gn(),Yn())}function Jn(e,t){let n=Wn(t);if(!e?.connectedSessionIds.includes(t))return`${n} is not connected to this board`;let r=e.queuedBySessionId[t]??0;return r===0?`${n} has read every change`:`${r} board ${r===1?`edit`:`edits`} queued for ${n}`}function Yn(){if(!U||!K)return;let e=Vn();U.dockQueued.textContent=Jn(e,K),U.sendToAgent.disabled=!e?.connectedSessionIds.includes(K)}async function Xn(){if(!U||!H||!K)return;U.sendToAgent.disabled=!0,J.show(`busy`,`sending`);let e=await h(H,K);Yn(),e.ok?J.show(`ok`,`sent; the agent reads the board when it is ready`):J.show(`error`,e.error)}function Zn(){if(!W)return;let e=X();e?(W.render(e),G?.pruneSelection(e),Bn&&=(G?.fit(),!1),Gn()):W.clear()}function Q(e){H!==e&&(H=e,Bn=!0,G?.clearSelection(),G?.closeTitleInput(),W?.clear(),q.clear(),Kn(),l(e).then(Zn))}function Qn(){let t=X();if(!t)return;let n=Z(`box`)[0],r=t.columns.map(e=>({value:e.id,text:e.title||e.id})),i=n?.column;i&&r.sort((e,t)=>Number(t.value===i)-Number(e.value===i)),Y({title:`Add a box`,label:`Box title`,placeholder:`parse the feed`,maxLength:e.title,confirmLabel:`Add box`,choices:r.length>1?{label:`Column`,options:r}:void 0,onSubmit:(e,t)=>Un([{op:`add`,element:{kind:`box`,id:b(`box`),title:e,column:t??r[0]?.value??`main`,lines:[],lane:null,ghost:!1,order:0,at:null}}])})}function $n(){let t=X();if(!t)return;let n=s().filter(e=>e.id!==t.id),r=[{value:``,text:`No linked board`},...n.map(e=>({value:e.id,text:e.title}))];Y({title:`Add a unit`,label:`Unit title`,placeholder:`index the diffs`,maxLength:e.title,confirmLabel:`Add unit`,choices:n.length>0?{label:`Linked board`,options:r}:void 0,onSubmit:(e,t)=>Un([{op:`add`,element:{kind:`unit`,id:b(`unit`),title:e,lines:[],after:[],linkedBoardId:t||null}}])})}function er(t){Y({title:`Pin a note`,label:`Note`,placeholder:`what about retries?`,maxLength:e.noteText,confirmLabel:`Pin note`,onSubmit:e=>Un([{op:`add`,element:{kind:`note`,id:b(`note`),on:t,text:e,author:``,resolvedBy:null}}])})}function tr(){let[e,t]=Z(`box`);e&&t&&(G?.clearSelection(),Hn([{op:`add`,element:{kind:`wire`,id:b(`wire`),from:e.id,to:t.id,dashed:!1,tone:`plain`,label:null}}]))}function nr(){let t=Z(`box`).map(e=>e.id);t.length!==0&&Y({title:`Frame the selected boxes`,label:`Frame title`,placeholder:`intake`,maxLength:e.title,confirmLabel:`Add frame`,onSubmit:async e=>{let n=await Un([{op:`add`,element:{kind:`frame`,id:b(`frame`),title:e,contains:t}}]);return n||G?.clearSelection(),n}})}function rr(){let e=Vn();if(!e)return;let t=e.connectedSessionIds.map(Wn),n=t.length>0?` ${t.join(`, `)} ${t.length===1?`is`:`are`} connected and will lose it.`:``;a({title:`Delete board`,message:`Delete "${e.title}" for good?${n}`,confirmLabel:`Delete board`,danger:!0,onConfirm:()=>{y(e.id).then(e=>{e.ok||q.show(`error`,e.error)})}})}function ir(){Y({title:`New board`,label:`Board title`,placeholder:`knowledge writer`,maxLength:e.title,confirmLabel:`Create board`,onSubmit:async e=>{let t=await f(e);return t.ok?(Q(t.boardId),null):t.error}})}function $(e,n,r=``){let i=t(`button`,`wb-button ${r}`.trim(),e);return i.type=`button`,i.addEventListener(`click`,n),i}function ar(e){let n=t(`div`,`wb-top`),r=t(`div`,`wb-board-list`);r.setAttribute(`aria-label`,`Boards`);let i=t(`div`,`wb-board-head`),a=t(`div`,`wb-title-row`),o=t(`span`,`wb-board-meta`),s=t(`div`,`wb-presence`);a.append(o,s);let c=t(`div`,`wb-toolbar`),l={box:$(`box`,Qn),wire:$(`wire`,tr),note:$(`note`,()=>{let[e]=Z(`box`);e&&er(e.id)}),frame:$(`frame`,nr),unit:$(`unit`,$n),fit:$(`fit`,()=>G?.fit()),remove:$(`delete board`,rr,`wb-button-danger`)};l.fit.dataset.phoneVisible=``,c.append(l.box,l.wire,l.note,l.frame,l.unit,l.fit,l.remove,q.element),i.append(a,c),n.append(r,$(`new board`,ir),i);let u=t(`div`,`wb-canvas`),d=document.createElementNS(Ln,`svg`);d.setAttribute(`class`,`wb-svg`),d.setAttribute(`role`,`img`),d.setAttribute(`aria-label`,`Whiteboard`),d.setAttribute(`preserveAspectRatio`,`xMidYMin meet`),u.append(d);let f=t(`p`,`wb-empty`,Rn),m=t(`div`,`wb-dock`);m.hidden=!0;let h=t(`span`,`wb-dock-queued`),g=$(`send to agent`,()=>void Xn()),v=t(`div`,`wb-dock-bar`);v.append(h,g,J.element),m.append(v),e.replaceChildren(n,u,f,m),U={list:r,boardHead:i,boardMeta:o,presence:s,toolbar:c,canvas:u,empty:f,dock:m,dockQueued:h,sendToAgent:g,buttons:l};let y=In(d);W=y,G=ce({svg:d,canvas:u,renderer:y,currentBoard:X,sendOps:Hn,onSelectionChange:Gn,onPhoneTapBox:er,onOpenLinkedBoard:Q}),p(Kn),_(e=>{e===H&&Zn()}),Kn()}function or(){return document.documentElement.dataset.layout===`phone`}function sr(){K&&u()===K&&ee(),K=null,U&&(U.dock.hidden=!0)}function cr(e){if(!U||or())return;let t=r(e);t&&(K=e,U.dock.hidden=!1,J.clear(),Yn(),te(t,e,U.dock,{className:`wb-docked-card`}),c(t,e,!0))}function lr(){let e=d();e&&(Q(e.boardId),e.dockSessionId&&cr(e.dockSessionId)),Kn(),H&&l(H).then(Zn)}var ur={mount:ar,refresh:lr,deactivate:sr};export{ur as view};
|
|
1
|
+
import{bt as e}from"./updates-view-core-Qkm1ZY4B.js";import{s as t}from"./dom-helpers-DBbFg1c_.js";import{a as n,r}from"./card-registry-CLrAbqh5.js";import{i}from"./action-status-SSA4xM57.js";import{a,n as o}from"./modal-USMHOKBI.js";import{$r as s,Sn as c,ai as l,bi as u,ci as d,ei as f,ii as p,li as m,ni as h,oi as g,ri as _,si as v,ti as y,xi as ee,yi as te}from"./index-Bq8I2EvJ.js";var ne=4,re=200,ie=2e4,ae=1.1,oe=[`wire`,`note`,`frame`,`box`,`unit`];function b(e){let t=Math.random().toString(36).slice(2,8);return`${e}-${Date.now().toString(36)}${t}`}function x(){return document.documentElement.dataset.layout===`phone`}function se(e){return e instanceof Element?e.closest(`[data-linked-board-id]`)?.dataset.linkedBoardId??null:null}function ce(e){let{svg:n,canvas:r,renderer:i}=e,a=new Map,o=new Set,s={x:0,y:0,width:1e3,height:600},c=null,l=null;function u(){n.setAttribute(`viewBox`,`${s.x} ${s.y} ${s.width} ${s.height}`)}function d(){let e=i.layout();if(!e)return;let{bounds:t}=e,r=n.clientWidth,a=n.clientHeight;if(r===0||a===0){s={...t},u();return}let o=Math.max(1,t.width/r,t.height/a),c=r*o;s={x:t.x-(c-t.width)/2,y:t.y,width:c,height:a*o},u()}function f(e,t){let r=n.getScreenCTM();if(!r)return{x:e,y:t};let i=new DOMPoint(e,t).matrixTransform(r.inverse());return{x:i.x,y:i.y}}function p(){let e=n.clientWidth||1,t=n.clientHeight||1;return Math.max(s.width/e,s.height/t)}function m(e,t){let n=Math.min(ie,Math.max(re,s.width*t)),r=n/s.width;s={x:e.x-(e.x-s.x)*r,y:e.y-(e.y-s.y)*r,width:n,height:s.height*r},u()}function h(e,t){let n=p();s={...s,x:s.x-e*n,y:s.y-t*n},u()}function g(t){o=t,i.setSelection(o),e.onSelectionChange(o)}function _(e,t){if(!t){g(o.has(e)&&o.size===1?new Set:new Set([e]));return}let n=new Set(o);n.delete(e)||n.add(e),g(n)}function v(e){let t=new Set([...o].filter(t=>e?.elements[t]));t.size!==o.size&&g(t)}function y(e){let t=i.layout()?.elements.find(t=>t.id===e);return t?.kind===`box`?t:null}function ee(){let[e,t]=[...a.values()];return!e||!t?0:Math.hypot(e.x-t.x,e.y-t.y)}function te(){c={kind:`pinch`,distance:ee(),viewWidth:s.width}}function b(t){if(t.button!==0||l)return;let r=se(t.target);if(r){e.onOpenLinkedBoard(r);return}if(a.set(t.pointerId,{x:t.clientX,y:t.clientY}),n.setPointerCapture(t.pointerId),a.size===2){te();return}let o=i.elementFromTarget(t.target),s=o?.kind===`box`&&!x()?y(o.id):null;if(o&&s){c={kind:`drag`,pointerId:t.pointerId,boxId:o.id,origin:f(t.clientX,t.clientY),start:s,hasMoved:!1,isAdditive:t.shiftKey};return}if(o&&!x()){_(o.id,t.shiftKey);return}let u=o?.kind===`box`?o.id:null;c={kind:`pan`,pointerId:t.pointerId,lastClient:{x:t.clientX,y:t.clientY},hasMoved:!1,tappedBoxId:u}}function ce(e,t){let n=f(t.clientX,t.clientY),r=n.x-e.origin.x,a=n.y-e.origin.y;!e.hasMoved&&Math.hypot(r,a)<ne*p()||(e.hasMoved=!0,i.nodeOf(e.boxId)?.setAttribute(`transform`,`translate(${r} ${a})`))}function S(e,t){let n=t.clientX-e.lastClient.x,r=t.clientY-e.lastClient.y;!e.hasMoved&&Math.hypot(n,r)<ne||(e.hasMoved=!0,e.lastClient={x:t.clientX,y:t.clientY},h(n,r))}function le(e){let t=ee();if(t<=0||e.distance<=0)return;let n=[...a.values()];m(f(n.reduce((e,t)=>e+t.x,0)/n.length,n.reduce((e,t)=>e+t.y,0)/n.length),e.viewWidth*(e.distance/t)/s.width)}function C(e){a.has(e.pointerId)&&(a.set(e.pointerId,{x:e.clientX,y:e.clientY}),c?.kind===`pinch`?le(c):c?.kind===`drag`&&c.pointerId===e.pointerId?ce(c,e):c?.kind===`pan`&&c.pointerId===e.pointerId&&S(c,e))}async function w(t,n){if(!t.hasMoved){_(t.boxId,t.isAdditive);return}let r=f(n.clientX,n.clientY),a=i.layout()?.pinnedOffsetY??0,o={x:Math.round(t.start.x+r.x-t.origin.x),y:Math.round(t.start.y+r.y-t.origin.y-a)};await e.sendOps([{op:`set`,id:t.boxId,fields:{at:o}}])||i.nodeOf(t.boxId)?.removeAttribute(`transform`)}function ue(t){if(!a.delete(t.pointerId))return;let n=c;n?.kind===`pinch`?c=null:(c=null,n?.kind===`drag`&&n.pointerId===t.pointerId?w(n,t):n?.kind!==`pan`||n.hasMoved||(n.tappedBoxId&&x()?e.onPhoneTapBox(n.tappedBoxId):n.tappedBoxId||g(new Set)))}function de(e){a.delete(e.pointerId),c?.kind===`drag`&&i.nodeOf(c.boxId)?.removeAttribute(`transform`),c=null}function fe(e){e.preventDefault(),e.ctrlKey||e.metaKey?m(f(e.clientX,e.clientY),e.deltaY>0?ae:1/ae):h(-e.deltaX,-e.deltaY)}function T(){let e=l;l=null,e?.remove()}function pe(a){let o=e.currentBoard()?.elements[a],s=i.nodeOf(a);if(o?.kind!==`box`||!s)return;T();let c=r.getBoundingClientRect(),u=s.getBoundingClientRect(),d=t(`input`,`wb-title-input`);d.type=`text`,d.value=o.title,d.maxLength=80,d.setAttribute(`aria-label`,`Box title`),d.style.left=`${u.left-c.left}px`,d.style.top=`${u.top-c.top}px`,d.style.width=`${Math.max(160,u.width)}px`,l=d,r.append(d),d.addEventListener(`keydown`,t=>{if(t.key===`Escape`){t.preventDefault(),T(),n.focus();return}if(t.key!==`Enter`)return;t.preventDefault();let r=d.value.trim();T(),n.focus(),r&&r!==o.title&&e.sendOps([{op:`set`,id:a,fields:{title:r}}])}),d.addEventListener(`blur`,T),d.focus(),d.select()}function E(e){if(x())return;let t=i.elementFromTarget(document.elementFromPoint(e.clientX,e.clientY));t?.kind===`box`&&pe(t.id)}function D(){let t=e.currentBoard();if(!t||o.size===0)return;let n=[...o].flatMap(e=>t.elements[e]??[]),r=oe.flatMap(e=>n.filter(t=>t.kind===e)).map(e=>({op:`remove`,id:e.id}));g(new Set),e.sendOps(r)}function me(e){e.target===n&&(e.key===`Delete`||e.key===`Backspace`?(e.preventDefault(),D()):e.key===`Escape`&&g(new Set))}return n.tabIndex=0,n.addEventListener(`pointerdown`,b),n.addEventListener(`pointermove`,C),n.addEventListener(`pointerup`,ue),n.addEventListener(`pointercancel`,de),n.addEventListener(`wheel`,fe,{passive:!1}),n.addEventListener(`dblclick`,E),n.addEventListener(`keydown`,me),{fit:d,selectedIds:()=>o,clearSelection:()=>g(new Set),pruneSelection:v,closeTitleInput:T}}var S=40,le=44,C=220,w=90,ue=30,de=20,fe=18,T=20,pe=26,E=18,D=26,me=170,he=21,ge=17,_e=10,ve=22,ye=24,be=16,xe=16,Se=26,Ce=24,we=8,Te=10,Ee=14,De=4,Oe=14,ke=8,O=6,Ae=4,je=6,Me=12,Ne=10,Pe=6.6,k=5,A=10,Fe=2,Ie=100,Le=120,Re=4,ze=40,Be=[.5,.35,.65,.2,.8],Ve=Object.freeze({blue:`#60a5fa`,green:`#4ade80`,orange:`#fb923c`,pink:`#f472b6`,cyan:`#22d3ee`,yellow:`#facc15`});function j(e,t){let n=e.split(/\s+/).filter(Boolean),r=[],i=``;for(let e of n){let n=e.match(RegExp(`.{1,${t}}`,`g`))??[e];for(let e of n){let n=i?`${i} ${e}`:e;n.length<=t?i=n:(r.push(i),i=e)}}return i&&r.push(i),r.length>0?r:[``]}function He(e,t){let n=e.lanes.find(e=>e.id===t.lane);return n?{label:n.label||n.id,hex:Ve[n.color]}:null}function Ue(e,t){let n=j(t.title,T),r=t.lines.flatMap(e=>j(e.text,pe-(e.muted?2:0)).map(t=>({text:t,muted:e.muted}))),i=He(e,t);return{titleLines:n,bodyLines:r,lane:i,height:24+n.length*de+r.length*fe+(i?26:0)}}function M(e,t){return Object.values(e.elements).filter(e=>e.kind===t)}function We(e){let t=j(e.text,he);return{lines:t,height:24+(t.length+1)*ge}}function Ge(e){let t=new Map;for(let n of M(e,`note`)){let e=t.get(n.on),r=We(n).height;t.set(n.on,e===void 0?r:e+_e+r)}return t}function Ke(e){return e.columns.map(e=>e.title?j(e.title,ye):[])}function qe(e){return(Math.max(1,...e.map(e=>e.length))-1)*be}function N(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e);i?i.push(r):n.set(e,[r])}return n}function Je(e,t){let n=M(e,`box`).filter(e=>!e.at),r=new Set(n.filter(e=>t.has(e.id)).map(e=>e.column)),i=new Set(M(e,`frame`).flatMap(e=>e.contains)),a=new Set(n.filter(e=>i.has(e.id)).map(e=>e.column)),o=e=>Te+(e!==void 0&&a.has(e)?E:0);return e.columns.map((t,n)=>{let i=r.has(t.id);return{left:i?156:o(t.id),right:o(e.columns[n+1]?.id),minimumWidth:i?Math.max(w,186):w}})}function Ye(e,t,n){return e.map((e,r)=>{let i=t[r]??0,a=n[r]??0,o=i>0?e.left+e.right+(i+1)*Ee:0,s=a>0?e.left+e.right+a+20:0;return Math.max(e.minimumWidth,o,s)})}function Xe(e,t){let n=[],r=S;for(let[i]of e.columns.entries())n.push(r),r+=C+(t[i]??w);return n}function Ze(e,t,n){return e.map((e,r)=>{let i=n[r]??{left:Te,right:Te,minimumWidth:w},a=e+C+(t[r]??w);return{left:e+C+i.left,right:a-i.right}})}function Qe(e,t,n,r){if(!t.at)return Math.max(0,e.columns.findIndex(e=>e.id===t.column));let i=n.x+n.width/2,a=r.findLastIndex(e=>e<=i);return Math.max(0,a)}function $e(e){let t=new Map;for(let n of M(e,`frame`))for(let e of n.contains)t.has(e)||t.set(e,n.id);return t}function et(e,t){return e===t?0:(e?E:0)+(t?44:0)}function tt(e,t,n,r){let i=new Map,a=new Map,o=new Map,s=$e(e),c=M(e,`box`).map((e,t)=>({box:e,index:t})).sort((e,t)=>e.box.order-t.box.order||e.index-t.index);for(let{box:l}of c){let c=Math.max(0,e.columns.findIndex(e=>e.id===l.column)),u=Ue(e,l),d=s.get(l.id)??null,f=(a.get(l.column)??n)+et(o.get(l.column)??null,d),p=l.at??{x:t[c]??S,y:f};if(!l.at){let e=(r.get(l.id)??0)-we;a.set(l.column,f+Math.max(u.height,e)+ue),o.set(l.column,d)}i.set(l.id,{kind:`box`,id:l.id,x:p.x,y:p.y,width:C,height:u.height,titleLines:u.titleLines,bodyLines:u.bodyLines,lane:u.lane,isGhost:l.ghost})}return i}function nt(e){if(e.length===0)return null;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y)),r=Math.max(...e.map(e=>e.x+e.width)),i=Math.max(...e.map(e=>e.y+e.height));return{x:t,y:n,width:r-t,height:i-n}}function rt(e,t){return M(e,`frame`).flatMap(e=>{let n=nt(e.contains.flatMap(e=>t.get(e)??[]));return n?[{kind:`frame`,id:e.id,title:e.title,x:n.x-E,y:n.y-E-D,width:n.width+36,height:n.height+36+D}]:[]})}function it(e){return e===`left`||e===`right`}function P(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function at(e,t,n,r){let i=e.y<t.y?e:t,a=i===e?t:e;return[...r.boxesById.values()].some(o=>o.id!==e.id&&o.id!==t.id&&r.columnIndexByBoxId.get(o.id)===n&&o.y<a.y&&o.y+o.height>i.y+i.height)}function ot(e,t,n){let r=n.columnIndexByBoxId.get(e.id)??0,i=n.columnIndexByBoxId.get(t.id)??0;if(r===i){if(e.id!==t.id&&!at(e,t,r,n)){let n=t.y>e.y;return{shape:`straight`,exitSide:n?`bottom`:`top`,entrySide:n?`top`:`bottom`,sourceGap:-1,targetGap:-1}}return{shape:`channel`,exitSide:`right`,entrySide:`right`,sourceGap:r,targetGap:r}}return i>r?{shape:i===r+1?`channel`:`long`,exitSide:`right`,entrySide:`left`,sourceGap:r,targetGap:i-1}:{shape:i===r-1?`channel`:`long`,exitSide:`left`,entrySide:`right`,sourceGap:r-1,targetGap:i}}function st(e){let t=e.wires.flatMap(t=>{let n=e.boxesById.get(t.from),r=e.boxesById.get(t.to);if(!n||!r)return[];let i=t.tone===`lane`?n.lane?.hex??null:null,a=P(n);return[{wire:t,from:n,to:r,strokeHex:i,styleKey:`${t.dashed}|${t.tone}|${i}`,...ot(n,r,e),busKey:null,start:a,end:P(r),crossingY:a.y}]}),n=new Map,r=e=>`${e.to.id}|${e.entrySide}|${e.styleKey}`;for(let e of t)e.shape!==`straight`&&n.set(r(e),(n.get(r(e))??0)+1);for(let e of t)e.shape!==`straight`&&(n.get(r(e))??0)>1&&(e.busKey=r(e));return t}function ct(e,t,n){let r=Array.from({length:n},(e,t)=>t);if(it(t)){let i=t===`left`?e.x:e.x+e.width,a=Math.min(Oe,(e.height-16)/Math.max(n-1,1)),o=e.y+Math.min(e.height/2,40)-(n-1)*a/2,s=Math.max(e.y+ke,Math.min(o,e.y+e.height-ke-(n-1)*a));return r.map(e=>({x:i,y:Math.round(s+e*a)}))}let i=t===`top`?e.y:e.y+e.height,a=e.x+e.width/2-(n-1)*Oe/2;return r.map(e=>({x:Math.round(a+e*Oe),y:i}))}function lt(e){return N(e.flatMap(e=>[{box:e.from,side:e.exitSide,groupKey:`exit|${e.styleKey}`,wireId:e.wire.id,farPoint:P(e.to),assign:t=>{e.start=t}},{box:e.to,side:e.entrySide,groupKey:e.busKey?`bus|${e.busKey}`:`entry|${e.wire.id}`,wireId:e.wire.id,farPoint:P(e.from),assign:t=>{e.end=t}}]),e=>`${e.box.id}|${e.side}`)}function ut(e){return new Map([...e.entries()].map(([e,t])=>[e,[...N(t,e=>e.groupKey).entries()].map(([e,t])=>({groupKey:e,firstWireId:t.map(e=>e.wireId).sort()[0]??e,farCoordinate:t.reduce((e,t)=>e+(it(t.side)?t.farPoint.y:t.farPoint.x),0)/t.length})).sort((e,t)=>e.farCoordinate-t.farCoordinate||e.firstWireId.localeCompare(t.firstWireId)||e.groupKey.localeCompare(t.groupKey)).map(e=>e.groupKey)]))}function dt(e,t){for(let[n,r]of e){let e=r[0],i=t.get(n)??[];if(!e)continue;let a=ct(e.box,e.side,i.length);for(let e of r){let t=a[i.indexOf(e.groupKey)];t&&e.assign(t)}}}function ft(e,t){let n=t[e.sourceGap]??{left:e.start.x,right:e.start.x},r=t[e.targetGap]??{left:e.end.x,right:e.end.x};return{left:Math.min(n.left,r.left),right:Math.max(n.right,r.right)}}function pt(e,t,n){return[...[...n.boxesById.values()].filter(t=>t.id!==e.from.id&&t.id!==e.to.id),...n.obstacles].filter(e=>e.x<t.right&&e.x+e.width>t.left)}function mt(e,t){return!t.some(t=>e>t.y-O&&e<t.y+t.height+O)}function ht(e){let t=e.map(e=>({top:e.y-O,bottom:e.y+e.height+O})).sort((e,t)=>e.top-t.top),n=[];for(let e of t){let t=n.at(-1);t&&e.top<=t.bottom?t.bottom=Math.max(t.bottom,e.bottom):n.push({...e})}return n.slice(1).flatMap((e,t)=>{let r=n[t];return!r||e.top-r.bottom<Ae?[]:[{top:r.bottom,bottom:e.top}]})}function gt(e,t){return e.left<t.right&&t.left<e.right}function _t(e,t){let n=[];return e.forEach((r,i)=>{let a=e.slice(0,i).flatMap((e,i)=>t(r,e)?[n[i]??0]:[]);n.push(a.length>0?Math.max(...a)+1:0)}),n}function vt(e,t){let n=[],r=[];for(let i of e){if(i.shape!==`long`)continue;let e=ft(i,t.gaps),a=pt(i,e,t),o=[i.start.y,i.end.y].find(e=>mt(e,a));if(o!==void 0){i.crossingY=o;continue}let s=(i.start.y+i.end.y)/2,c=ht(a).sort((e,t)=>Math.abs((e.top+e.bottom)/2-s)-Math.abs((t.top+t.bottom)/2-s))[0];c?n.push({plan:i,interval:c,span:e}):r.push({plan:i,span:e})}let i=N(n,e=>`${Math.round(e.interval.top)}|${Math.round(e.interval.bottom)}`);for(let e of i.values()){let t=[...e].sort((e,t)=>e.plan.start.y-t.plan.start.y||e.plan.wire.id.localeCompare(t.plan.wire.id)),n=_t(t,(e,t)=>gt(e.span,t.span)),i=t[0]?.interval??{top:0,bottom:0},a=i.bottom-i.top,o=Math.max(1,Math.floor(a/je)-1),s=Math.min(o,Math.max(...n)+1);t.forEach((e,t)=>{let c=n[t]??0;c>=o?r.push({plan:e.plan,span:e.span}):e.plan.crossingY=Math.round(i.top+a*(c+1)/(s+1))})}let a=[...r].sort((e,t)=>t.span.right-t.span.left-(e.span.right-e.span.left)||e.plan.wire.id.localeCompare(t.plan.wire.id)),o=_t(a,(e,t)=>gt(e.span,t.span)).map(e=>a.length-1-e);return a.forEach(({plan:e},n)=>{e.crossingY=t.topBandBottom-(o[n]??0)*Me}),r.length>0?Math.max(...o)+1:0}function yt(e,t){return t<=e?`left`:`right`}function bt(e,t){return{key:e,gap:t,top:1/0,bottom:-1/0,leftYs:[],rightYs:[],track:-1,x:0}}function F(e,t,n){(t===`left`?e.leftYs:e.rightYs).push(n),e.top=Math.min(e.top,n),e.bottom=Math.max(e.bottom,n)}function I(e){return e.busKey?`bus|${e.busKey}`:`wire|${e.wire.id}|target`}function xt(e,t){let n=new Map,r=(e,t)=>{let r=n.get(e);if(r)return r;let i=bt(e,t);return n.set(e,i),i},i=new Set;for(let n of e){if(n.shape===`straight`)continue;let e=t.columnIndexByBoxId.get(n.from.id)??0,a=t.columnIndexByBoxId.get(n.to.id)??0,o=n.exitSide===`right`&&n.entrySide===`left`,s=r(I(n),n.targetGap);if(n.shape===`channel`&&F(s,yt(n.targetGap,e),n.start.y),n.shape===`long`){let t=r(`wire|${n.wire.id}|source`,n.sourceGap);F(t,yt(n.sourceGap,e),n.start.y),F(t,o?`right`:`left`,n.crossingY),F(s,o?`left`:`right`,n.crossingY)}i.has(s.key)||(i.add(s.key),F(s,yt(n.targetGap,a),n.end.y))}return n}function St(e,t){return e.filter(e=>e>t.top&&e<t.bottom).length}function Ct(e,t){return St(t.leftYs,e)+St(e.rightYs,t)}function wt(e,t){let n=t.map(()=>0),r=N([...e.values()].filter(e=>e.bottom>e.top),e=>e.gap);for(let[e,i]of r){let r=[...i].sort((e,t)=>Ct(e,t)-Ct(t,e)||e.top-t.top||e.key.localeCompare(t.key)),a=_t(r,(e,t)=>e.top<t.bottom+De&&t.top<e.bottom+De),o=Math.max(...a)+1;n[e]=o;let s=t[e]??{left:0,right:0};r.forEach((e,t)=>{e.track=a[t]??0,e.x=Math.round(s.left+(s.right-s.left)*(e.track+1)/(o+1))})}for(let n of e.values()){if(n.track>=0)continue;let e=t[n.gap]??{left:0,right:0};n.x=Math.round((e.left+e.right)/2)}return n}function Tt(e){let t=e.filter((t,n)=>{let r=e[n-1];return!r||r.x!==t.x||r.y!==t.y});return t.filter((e,n)=>{let r=t[n-1],i=t[n+1];return!r||!i||!(r.x===e.x&&e.x===i.x||r.y===e.y&&e.y===i.y)})}function Et(e){return e.slice(1).flatMap((t,n)=>{let r=e[n];return r?[{from:r,to:t}]:[]})}function Dt(e){if(e.start.x===e.end.x)return[e.start,e.end];let t=Math.round((e.start.y+e.end.y)/2);return[e.start,{x:e.start.x,y:t},{x:e.end.x,y:t},e.end]}function Ot(e,t){if(e.shape===`straight`)return Dt(e);let n=t.get(I(e))?.x??e.end.x,r=e.shape===`long`?e.crossingY:e.start.y,i=t.get(`wire|${e.wire.id}|source`)?.x??n,a=e.shape===`long`?[e.start,{x:i,y:e.start.y},{x:i,y:r},{x:n,y:r}]:[e.start,{x:n,y:r}];return e.busKey?a:[...a,{x:n,y:e.end.y},e.end]}function kt(e){return e.map((e,t)=>`${t===0?`M`:`L`} ${e.x} ${e.y}`).join(` `)}function At(e,t){let n=new Map;for(let t of[...e].sort((e,t)=>e.wire.id.localeCompare(t.wire.id)))t.busKey&&!n.has(t.busKey)&&n.set(t.busKey,t.wire.id);return e.map(e=>{let r=Tt(Ot(e,t)),i=e.busKey?t.get(I(e)):void 0,a=e.busKey!==null&&n.get(e.busKey)===e.wire.id,o=i&&a?[{from:{x:i.x,y:i.top},to:{x:i.x,y:i.bottom}},{from:{x:i.x,y:e.end.y},to:e.end}].filter(e=>e.from.x!==e.to.x||e.from.y!==e.to.y):[];return{plan:e,points:r,trunk:o,segments:[...Et(r),...o]}})}function L(e){return e.from.y===e.to.y}function jt(e,t){let n=t.x+t.width,r=t.y+t.height;if(L(e)){let i=e.from.y;return t.y<i&&i<r&&Math.min(e.from.x,e.to.x)<n&&Math.max(e.from.x,e.to.x)>t.x}let i=e.from.x;return t.x<i&&i<n&&Math.min(e.from.y,e.to.y)<r&&Math.max(e.from.y,e.to.y)>t.y}function Mt(e,t){return e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height}function Nt(e){return Math.ceil(e.length*Pe)}function Pt(e,t){return{x:e.x-t/2,y:e.y-A,width:t,height:13}}function Ft(e){return Math.abs(e.from.x-e.to.x)+Math.abs(e.from.y-e.to.y)}function It(e,t){let n=[...e].sort((e,t)=>Ft(t)-Ft(e));return[...e.slice(0,1),...n].flatMap(e=>[...Be.flatMap(n=>{let r=e.from.x+(e.to.x-e.from.x)*n,i=e.from.y+(e.to.y-e.from.y)*n;return L(e)?[{x:r,y:i-k},{x:r,y:i+k+A}]:[{x:r+k+t/2,y:i+A/2},{x:r-k-t/2,y:i+A/2}]}),...Lt(e,t)])}function Lt(e,t){if(!L(e))return[];let n=e.from.y;return[Math.min(e.from.x,e.to.x)+k+t/2,Math.max(e.from.x,e.to.x)-k-t/2].flatMap(e=>[{x:e,y:n-k},{x:e,y:n+k+A}])}function Rt(e,t){return{x:e.x-t,y:e.y-t,width:e.width+t*2,height:e.height+t*2}}function zt(e,t,n){let r=new Map,i=e.flatMap(e=>e.segments),a=[...t.boxesById.values(),...t.obstacles];for(let o of e){let e=o.plan.wire.label;if(!e)continue;let s=Nt(e),c=It(o.segments,s),l=c.find(e=>{let n=Pt(e,s);if(n.y<t.contentTop)return!1;let o=Rt(n,Fe);return i.some(e=>jt(e,o))||a.some(e=>Mt(n,e))?!1:![...r.values()].some(e=>Mt(n,e.bounds))}),u=l??c[0]??P(o.plan.from);l||n.push(`wire ${o.plan.wire.id} label "${e}" has no clear spot`),r.set(o.plan.wire.id,{at:{x:Math.round(u.x),y:Math.round(u.y)},bounds:Pt(u,s)})}return r}function Bt(e,t,n){return e>Math.min(t,n)+.5&&e<Math.max(t,n)-.5}function Vt(e,t){if(L(e)===L(t))return!1;let n=L(e)?e:t,r=n===e?t:e;return Bt(r.from.x,n.from.x,n.to.x)&&Bt(n.from.y,r.from.y,r.to.y)}function Ht(e,t){if(L(e)!==L(t))return!1;let n=L(e),r=e=>n?e.from.y:e.from.x,i=e=>Math.min(n?e.from.x:e.from.y,n?e.to.x:e.to.y),a=e=>Math.max(n?e.from.x:e.from.y,n?e.to.x:e.to.y);return r(e)===r(t)&&Math.min(a(e),a(t))-Math.max(i(e),i(t))>1}function Ut(e,t){return e.plan.styleKey===t.plan.styleKey&&e.plan.start.x===t.plan.start.x&&e.plan.start.y===t.plan.start.y}function Wt(e){return e.flatMap((t,n)=>e.slice(n+1).flatMap(e=>{if(t.plan.busKey!==null&&t.plan.busKey===e.plan.busKey)return[];let n=t.segments.flatMap(t=>e.segments.map(e=>[t,e]));return n.some(([e,t])=>Vt(e,t))?[`wire ${t.plan.wire.id} crosses wire ${e.plan.wire.id}`]:Ut(t,e)?[]:n.some(([e,t])=>Ht(e,t))?[`wire ${t.plan.wire.id} overlaps wire ${e.plan.wire.id}`]:[]}))}function Gt(e,t){let n=[...t.boxesById.values()];return e.flatMap(e=>n.flatMap(t=>{if(t.id===e.plan.from.id||t.id===e.plan.to.id)return[];let n=Rt(t,-2);return e.segments.some(e=>jt(e,n))?[`wire ${e.plan.wire.id} runs through box ${t.id}`]:[]}))}function Kt(t){if(t.length<=e.layoutWarnings)return[...t];let n=t.slice(0,e.layoutWarnings-1);return[...n,`and ${t.length-n.length} more`]}function qt(e,t){let n=t.map(()=>0);for(let t of e)t.wire.label&&t.shape===`channel`&&(n[t.targetGap]=Math.max(n[t.targetGap]??0,Nt(t.wire.label)));return n}function Jt(e,t){return nt([...e.flatMap(e=>e.segments.flatMap(e=>[e.from,e.to])).map(e=>({x:e.x,y:e.y,width:0,height:0})),...t])}function Yt(e,t,n,r){dt(n,r);let i=vt(e,t),a=xt(e,t),o=wt(a,t.gaps),s=At(e,a);return{runsByKey:a,tracksByGap:o,topTrackCount:i,drawn:s,crossingCost:Gt(s,t).length*Ie+Wt(s).length}}function Xt(e,t){let n=e[t],r=e[t+1];n!==void 0&&r!==void 0&&(e[t]=r,e[t+1]=n)}function Zt(e,t){let n=lt(e),r=ut(n),i=Yt(e,t,n,r).crossingCost,a=e.length<=Le;for(let o of r.values())for(let s=0;a&&i>0&&s+1<o.length;s+=1){Xt(o,s);let a=Yt(e,t,n,r).crossingCost;a<i?i=a:Xt(o,s)}return Yt(e,t,n,r)}function Qt(e){let t=st(e),{runsByKey:n,tracksByGap:r,topTrackCount:i,drawn:a}=Zt(t,e),o=[],s=zt(a,e,o),c=a.map(({plan:e,points:t,trunk:r})=>{let i=t.at(-1)??e.end,a=e.busKey?n.get(I(e)):void 0,o=r.length>0,c=a!==void 0&&i.y>a.top&&i.y<a.bottom;return{kind:`wire`,id:e.wire.id,path:[kt(t),...r.map(e=>kt([e.from,e.to]))].join(` `),start:e.start,end:o||!e.busKey?e.end:i,label:e.wire.label,labelAt:s.get(e.wire.id)?.at??P(e.from),isDashed:e.wire.dashed,strokeHex:e.strokeHex,tone:e.wire.tone,hasArrowhead:e.busKey===null||o,joinAt:c?i:null}}),l=[...s.values()].map(e=>e.bounds);return{wires:c,tracksByGap:r,topTrackCount:i,labelWidthByGap:qt(t,e.gaps),warnings:Kt([...Gt(a,e),...Wt(a),...o]),extent:Jt(a,l)}}function $t(e){return e.resolvedBy?`resolved by ${e.resolvedBy}`:e.author?`from ${e.author}`:``}function en(e,t){let n=new Map;return M(e,`note`).flatMap(e=>{let r=t.get(e.on);if(!r)return[];let{lines:i,height:a}=We(e),o=n.get(e.on)??r.y-we;return n.set(e.on,o+a+_e),[{kind:`note`,id:e.id,x:r.x+r.width-Ce,y:o,width:me,height:a,lines:i,byline:$t(e),isResolved:e.resolvedBy!==null}]})}function tn(e,t,n,r){let i=e.flatMap(e=>e.kind===`wire`?[]:[e]),a=(n.at(-1)??S)+C,o=nt([...i,...t?[t]:[],{x:0,y:0,width:a,height:r}]);return o?{x:Math.min(0,o.x-S),y:Math.min(0,o.y-S),width:o.width+80,height:o.height+80}:{x:0,y:0,width:a+S,height:80}}function nn(e,t){let n=Xe(e,t.gapWidths),r=tt(e,n,t.boxesTop,t.stackHeightByBoxId),i=rt(e,r),a=en(e,r),o=new Map(M(e,`box`).flatMap(t=>{let i=r.get(t.id);return i?[[t.id,Qe(e,t,i,n)]]:[]}));return{columnLeftEdges:n,boxesById:r,frames:i,notes:a,routing:Qt({wires:M(e,`wire`),boxesById:r,columnIndexByBoxId:o,obstacles:[...a,...i.map(e=>({x:e.x,y:e.y,width:e.width,height:D}))],gaps:Ze(n,t.gapWidths,t.reserves),topBandBottom:t.boxesTop-Ne,contentTop:t.contentTop})}}function rn(e,t){return Array.from({length:Math.max(e.length,t.length)},(n,r)=>Math.max(e[r]??0,t[r]??0))}function an(e,t,n){let r=t.tracksByGap,i=t.topTrackCount;for(let a=1;;a+=1){let o=Ye(n.reserves,r,t.labelWidthByGap),s=n.headerBoxesTop+fn(i),c=nn(e,{gapWidths:o,reserves:n.reserves,boxesTop:s,contentTop:n.contentTop,stackHeightByBoxId:n.stackHeightByBoxId}),l=c.routing.topTrackCount>i,u=c.routing.tracksByGap.some((e,t)=>e>(r[t]??0));if(a>=Re||!l&&!u)return{placed:c,boxesTop:s};i=Math.max(i,c.routing.topTrackCount),r=rn(r,c.routing.tracksByGap)}}function on(e){let t=j(e.title,T),n=e.lines.flatMap(e=>j(e.text,pe)),r=+!!e.linkedBoardId;return{titleLines:t,bodyLines:n,height:42+t.length*de+(n.length+r)*fe}}function sn(e){let t=new Map,n=new Map;for(let r of m(e)){let i=e.elements[r.unitId];if(i?.kind!==`unit`)continue;let a=on(i),o=n.get(r.level)??70;n.set(r.level,o+a.height+ue),t.set(i.id,{kind:`unit`,id:i.id,x:S+(r.level-1)*310,y:o,width:C,height:a.height,label:r.label,titleLines:a.titleLines,bodyLines:a.bodyLines,linkedBoardId:i.linkedBoardId})}return t}function cn(e,t){let n={x:e.x+e.width,y:e.y+Math.round(e.height/2)},r={x:t.x,y:t.y+Math.round(t.height/2)},i=t.x-Math.round(w/2);return kt(Tt([n,{x:i,y:n.y},{x:i,y:r.y},r]))}function ln(e,t){return M(e,`unit`).flatMap(e=>{let n=t.get(e.id);return n?e.after.flatMap(e=>{let r=t.get(e);return r?[cn(r,n)]:[]}):[]})}function un(e){return e.size===0?S:Math.max(...[...e.values()].map(e=>e.y+e.height))+ze}function dn(e,t){if(t===0)return e;let n=Object.fromEntries(Object.entries(e.elements).map(([e,n])=>n.kind!==`box`||!n.at?[e,n]:[e,{...n,at:{x:n.at.x,y:n.at.y+t}}]));return{...e,elements:n}}function fn(e){return e>0?e*Me+Ne:0}function pn(e){let t=sn(e),n=un(t),r=n-S,i=dn(e,r),a=Ge(i),o=Ke(i),s=qe(o),c=n+Se+s,l=n+le+s,u=Je(i,a),{placed:d,boxesTop:f}=an(i,nn(i,{gapWidths:Ye(u,[],[]),reserves:u,boxesTop:l,contentTop:c,stackHeightByBoxId:a}).routing,{reserves:u,headerBoxesTop:l,contentTop:c,stackHeightByBoxId:a}),{columnLeftEdges:p}=d,m=[...d.frames,...d.routing.wires,...d.boxesById.values(),...d.notes,...t.values()],h=tn(m,d.routing.extent,p,f),g=h.y+h.height,_=i.lanes.map((e,t)=>({label:e.label||e.id,hex:Ve[e.color],x:S,y:g+t*ve})),v=g+_.length*ve+(_.length>0?12:0),y=i.caption?{text:i.caption,x:S,y:v}:null,ee=_.length*ve+(y?30:0)+(_.length>0?12:0);return{columns:i.columns.map((e,t)=>({id:e.id,titleLines:o[t]??[],titleBaselineY:n+xe,ruleY:c,x:p[t]??S,width:C})),elements:m,legend:_,caption:y,pinnedOffsetY:r,plan:t.size>0?{titleAt:{x:S,y:56},arrowPaths:ln(i,t)}:null,bounds:{...h,height:h.height+ee},warnings:d.routing.warnings}}function mn(e){return JSON.stringify(e)}var hn=`http://www.w3.org/2000/svg`,R=12,gn=26,_n=20,vn=18,yn=17,bn=14,xn=16,Sn=24,Cn=18,wn=`Plan`,Tn=`open linked board`;function z(e,t={},n=``){let r=document.createElementNS(hn,e);for(let[e,n]of Object.entries(t))r.setAttribute(e,String(n));return n&&r.setAttribute(`class`,n),r}function B(e,t,n,r){let i=z(`text`,{x:t,y:n},r);return i.textContent=e,i}function V(e,t){let n=z(`g`,{},`wb-element ${t}`);return n.dataset.elementId=e.id,n.dataset.elementKind=e.kind,n}function En(e){let t=V(e,e.isGhost?`wb-box wb-ghost`:`wb-box`),n=z(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:8},`wb-box-outline`);e.lane&&(n.style.stroke=e.lane.hex),t.append(n),e.titleLines.forEach((n,r)=>{t.append(B(n,e.x+R,e.y+gn+r*_n,`wb-box-title`))});let r=e.y+gn+e.titleLines.length*_n;if(e.bodyLines.forEach((n,i)=>{let a=e.x+R+(n.muted?bn:0);t.append(B(n.text,a,r+i*vn,n.muted?`wb-box-line wb-muted`:`wb-box-line`))}),!e.lane)return t;let i=e.y+e.height-28,a=Math.min(e.width-24,16+e.lane.label.length*8),o=z(`rect`,{x:e.x+R,y:i,width:a,height:18,rx:9},`wb-lane-pill`);o.style.stroke=e.lane.hex;let s=B(e.lane.label,e.x+R+8,i+13,`wb-lane-pill-text`);return s.style.fill=e.lane.hex,t.append(o,s),t}function Dn(e){let t=V(e,`wb-frame`);return t.append(z(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:12},`wb-frame-outline`),B(e.title,e.x+14,e.y+18,`wb-frame-title`)),t}function On(e){let t=V(e,`wb-wire wb-tone-${e.tone}`),n=z(`path`,{d:e.path},`wb-wire-hit`),r=z(`path`,e.hasArrowhead?{d:e.path,"marker-end":`url(#wb-arrow)`}:{d:e.path},e.isDashed?`wb-wire-line wb-dashed`:`wb-wire-line`);return e.strokeHex&&(r.style.stroke=e.strokeHex),t.append(n,r,z(`circle`,{cx:e.start.x,cy:e.start.y,r:3},`wb-wire-dot`)),e.joinAt&&t.append(z(`circle`,{cx:e.joinAt.x,cy:e.joinAt.y,r:3},`wb-wire-dot`)),e.label&&t.append(B(e.label,e.labelAt.x,e.labelAt.y,`wb-wire-label`)),t}function kn(e){let t=V(e,e.isResolved?`wb-note wb-resolved`:`wb-note`);return t.append(z(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:4},`wb-note-card`)),e.lines.forEach((n,r)=>{t.append(B(n,e.x+10,e.y+22+r*yn,`wb-note-text`))}),e.byline&&t.append(B(e.byline,e.x+10,e.y+22+e.lines.length*yn,`wb-note-byline`)),t}function An(e){let t=V(e,`wb-unit`);t.append(z(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:8},`wb-unit-outline`),B(e.label,e.x+R,e.y+Sn,`wb-unit-label`));let n=e.y+Sn+Cn;e.titleLines.forEach((r,i)=>{t.append(B(r,e.x+R,n+i*_n,`wb-box-title`))});let r=n+e.titleLines.length*_n;if(e.bodyLines.forEach((n,i)=>{t.append(B(n,e.x+R,r+i*vn,`wb-box-line`))}),!e.linkedBoardId)return t;let i=B(Tn,e.x+R,r+e.bodyLines.length*vn,`wb-unit-link`);return i.dataset.linkedBoardId=e.linkedBoardId,t.append(i),t}var jn={frame:`frames`,wire:`wires`,box:`boxes`,note:`notes`,unit:`units`},Mn=[`box`,`frame`,`wire`,`note`,`unit`];function Nn(e){switch(e.kind){case`box`:return En(e);case`frame`:return Dn(e);case`wire`:return On(e);case`note`:return kn(e);case`unit`:return An(e)}}function Pn(e){let t=z(`g`,{},`wb-chrome`);if(e.plan){t.append(B(wn,e.plan.titleAt.x,e.plan.titleAt.y,`wb-column-title`));for(let n of e.plan.arrowPaths)t.append(z(`path`,{d:n,"marker-end":`url(#wb-arrow)`},`wb-wire-line`))}for(let n of e.columns)n.titleLines.length!==0&&(n.titleLines.forEach((e,r)=>{t.append(B(e,n.x,n.titleBaselineY+r*xn,`wb-column-title`))}),t.append(z(`line`,{x1:n.x,y1:n.ruleY,x2:n.x+n.width,y2:n.ruleY},`wb-column-rule`)));for(let n of e.legend){let e=z(`rect`,{x:n.x,y:n.y,width:14,height:14,rx:3},`wb-legend-swatch`);e.style.fill=n.hex,t.append(e,B(n.label,n.x+22,n.y+12,`wb-legend-text`))}return e.caption&&t.append(B(e.caption.text,e.caption.x,e.caption.y+16,`wb-caption`)),t}function Fn(){let e=z(`defs`),t=z(`marker`,{id:`wb-arrow`,viewBox:`0 0 10 10`,refX:9,refY:5,markerWidth:8,markerHeight:8,orient:`auto-start-reverse`});return t.append(z(`path`,{d:`M 0 1 L 10 5 L 0 9 z`,fill:`context-stroke`})),e.append(t),e}function In(e){let t={frames:z(`g`,{},`wb-layer`),wires:z(`g`,{},`wb-layer`),boxes:z(`g`,{},`wb-layer`),notes:z(`g`,{},`wb-layer`),units:z(`g`,{},`wb-layer`)},n=z(`g`);e.replaceChildren(Fn(),n,t.frames,t.wires,t.boxes,t.notes,t.units);let r=new Map,i=null,a=new Set;function o(e,t){t.classList.toggle(`is-selected`,a.has(e))}function s(e){let a=pn(e),s=Pn(a);n.replaceWith(s),n=s;let c=new Set;for(let e of a.elements){c.add(e.id);let n=mn(e),i=r.get(e.id);if(i?.signature===n)continue;let a=Nn(e);o(e.id,a),i&&i.node.replaceWith(a),i||t[jn[e.kind]].append(a),r.set(e.id,{signature:n,node:a})}for(let[e,t]of r)c.has(e)||(t.node.remove(),r.delete(e));return i=a,a}function c(e){if(!(e instanceof Element))return null;let t=e.closest(`.wb-element`),n=t?.dataset.elementId,r=Mn.find(e=>e===t?.dataset.elementKind);return!n||!r?null:{id:n,kind:r}}function l(e){a=e;for(let[e,t]of r)o(e,t.node)}function u(){for(let e of r.values())e.node.remove();r.clear();let e=z(`g`);n.replaceWith(e),n=e,i=null}return{render:s,layout:()=>i,elementFromTarget:c,nodeOf:e=>r.get(e)?.node??null,setSelection:l,clear:u}}var Ln=`http://www.w3.org/2000/svg`,Rn=`No boards yet. Make one here, or have an agent run glimmervoid whiteboard new <title>.`,zn=`Pick a board above.`,H=null,U=null,W=null,G=null,Bn=!0,K=null,q=i(`action-status wb-status`),J=i(`action-status wb-status`);function Y(e){let{dialog:n,close:r,actions:i,btnCancel:a}=o({title:e.title}),s=t(`input`,`dialog-input`);s.type=`text`,s.placeholder=e.placeholder,s.maxLength=e.maxLength,s.value=e.initialValue??``,s.autocomplete=`off`,s.setAttribute(`aria-label`,e.label);let c=t(`div`,`dialog-error`);c.setAttribute(`role`,`alert`);let l=e.choices?t(`select`,`dialog-input wb-dialog-select`):null;if(l&&e.choices){l.setAttribute(`aria-label`,e.choices.label);for(let n of e.choices.options){let e=t(`option`,null,n.text);e.value=n.value,l.append(e)}}let u=t(`button`,`btn-dialog btn-dialog-confirm`,e.confirmLabel);u.type=`button`,i.append(u),n.append(t(`label`,`dialog-label`,e.label),s,...l?[l]:[],c,i);async function d(){let t=s.value.trim();if(!t){c.textContent=`${e.label} is empty.`;return}u.disabled=!0;let n=await e.onSubmit(t,l?.value??null);u.disabled=!1,n?c.textContent=n:r()}a.addEventListener(`click`,r),u.addEventListener(`click`,()=>void d()),s.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),d())}),requestAnimationFrame(()=>s.focus())}function X(){return H?g(H):null}function Vn(){return s().find(e=>e.id===H)??null}async function Hn(e){if(!H||e.length===0)return!1;let t=await v(H,e);return t.ok?(q.clear(),!0):(q.show(`error`,t.error),!1)}async function Un(e){if(!H)return`No board is open.`;let t=await v(H,e);return t.ok?null:t.error}function Wn(e){let t=r(e);return t?n(t):`closed session`}function Z(e){let t=X();return[...G?.selectedIds()??new Set].flatMap(e=>t?.elements[e]??[]).filter(t=>t.kind===e)}function Gn(){if(!U)return;let e=X(),t=Z(`box`).length,n=G?.selectedIds().size??0;U.buttons.box.disabled=!e,U.buttons.wire.disabled=t!==2,U.buttons.note.disabled=t!==1,U.buttons.frame.disabled=t===0,U.buttons.unit.disabled=!e,U.buttons.fit.disabled=!e,U.buttons.remove.disabled=!e,U.toolbar.dataset.selectedCount=String(n)}function Kn(){if(!U)return;let e=s();H&&!e.some(e=>e.id===H)&&(H=null),!H&&e[0]&&Q(e[0].id),U.list.replaceChildren(...e.map(e=>{let n=t(`button`,`wb-board-tab`,e.title);return n.type=`button`,n.setAttribute(`aria-pressed`,String(e.id===H)),e.connectedSessionIds.length>0&&n.append(t(`span`,`wb-board-tab-count`,String(e.connectedSessionIds.length))),n.addEventListener(`click`,()=>Q(e.id)),n})),qn()}function qn(){if(!U)return;let e=Vn(),n=s().length>0;U.boardHead.hidden=!e,U.canvas.hidden=!e,U.empty.hidden=!!e,U.empty.textContent=n?zn:Rn,e&&(U.boardMeta.textContent=`v${e.version}`,U.presence.replaceChildren(...e.connectedSessionIds.map(e=>t(`span`,`wb-presence-pill`,Wn(e)))),e.connectedSessionIds.length===0&&U.presence.append(t(`span`,`wb-presence-none`,`no sessions connected`)),Gn(),Yn())}function Jn(e,t){let n=Wn(t);if(!e?.connectedSessionIds.includes(t))return`${n} is not connected to this board`;let r=e.queuedBySessionId[t]??0;return r===0?`${n} has read every change`:`${r} board ${r===1?`edit`:`edits`} queued for ${n}`}function Yn(){if(!U||!K)return;let e=Vn();U.dockQueued.textContent=Jn(e,K),U.sendToAgent.disabled=!e?.connectedSessionIds.includes(K)}async function Xn(){if(!U||!H||!K)return;U.sendToAgent.disabled=!0,J.show(`busy`,`sending`);let e=await h(H,K);Yn(),e.ok?J.show(`ok`,`sent; the agent reads the board when it is ready`):J.show(`error`,e.error)}function Zn(){if(!W)return;let e=X();e?(W.render(e),G?.pruneSelection(e),Bn&&=(G?.fit(),!1),Gn()):W.clear()}function Q(e){H!==e&&(H=e,Bn=!0,G?.clearSelection(),G?.closeTitleInput(),W?.clear(),q.clear(),Kn(),l(e).then(Zn))}function Qn(){let t=X();if(!t)return;let n=Z(`box`)[0],r=t.columns.map(e=>({value:e.id,text:e.title||e.id})),i=n?.column;i&&r.sort((e,t)=>Number(t.value===i)-Number(e.value===i)),Y({title:`Add a box`,label:`Box title`,placeholder:`parse the feed`,maxLength:e.title,confirmLabel:`Add box`,choices:r.length>1?{label:`Column`,options:r}:void 0,onSubmit:(e,t)=>Un([{op:`add`,element:{kind:`box`,id:b(`box`),title:e,column:t??r[0]?.value??`main`,lines:[],lane:null,ghost:!1,order:0,at:null}}])})}function $n(){let t=X();if(!t)return;let n=s().filter(e=>e.id!==t.id),r=[{value:``,text:`No linked board`},...n.map(e=>({value:e.id,text:e.title}))];Y({title:`Add a unit`,label:`Unit title`,placeholder:`index the diffs`,maxLength:e.title,confirmLabel:`Add unit`,choices:n.length>0?{label:`Linked board`,options:r}:void 0,onSubmit:(e,t)=>Un([{op:`add`,element:{kind:`unit`,id:b(`unit`),title:e,lines:[],after:[],linkedBoardId:t||null}}])})}function er(t){Y({title:`Pin a note`,label:`Note`,placeholder:`what about retries?`,maxLength:e.noteText,confirmLabel:`Pin note`,onSubmit:e=>Un([{op:`add`,element:{kind:`note`,id:b(`note`),on:t,text:e,author:``,resolvedBy:null}}])})}function tr(){let[e,t]=Z(`box`);e&&t&&(G?.clearSelection(),Hn([{op:`add`,element:{kind:`wire`,id:b(`wire`),from:e.id,to:t.id,dashed:!1,tone:`plain`,label:null}}]))}function nr(){let t=Z(`box`).map(e=>e.id);t.length!==0&&Y({title:`Frame the selected boxes`,label:`Frame title`,placeholder:`intake`,maxLength:e.title,confirmLabel:`Add frame`,onSubmit:async e=>{let n=await Un([{op:`add`,element:{kind:`frame`,id:b(`frame`),title:e,contains:t}}]);return n||G?.clearSelection(),n}})}function rr(){let e=Vn();if(!e)return;let t=e.connectedSessionIds.map(Wn),n=t.length>0?` ${t.join(`, `)} ${t.length===1?`is`:`are`} connected and will lose it.`:``;a({title:`Delete board`,message:`Delete "${e.title}" for good?${n}`,confirmLabel:`Delete board`,danger:!0,onConfirm:()=>{y(e.id).then(e=>{e.ok||q.show(`error`,e.error)})}})}function ir(){Y({title:`New board`,label:`Board title`,placeholder:`knowledge writer`,maxLength:e.title,confirmLabel:`Create board`,onSubmit:async e=>{let t=await f(e);return t.ok?(Q(t.boardId),null):t.error}})}function $(e,n,r=``){let i=t(`button`,`wb-button ${r}`.trim(),e);return i.type=`button`,i.addEventListener(`click`,n),i}function ar(e){let n=t(`div`,`wb-top`),r=t(`div`,`wb-board-list`);r.setAttribute(`aria-label`,`Boards`);let i=t(`div`,`wb-board-head`),a=t(`div`,`wb-title-row`),o=t(`span`,`wb-board-meta`),s=t(`div`,`wb-presence`);a.append(o,s);let c=t(`div`,`wb-toolbar`),l={box:$(`box`,Qn),wire:$(`wire`,tr),note:$(`note`,()=>{let[e]=Z(`box`);e&&er(e.id)}),frame:$(`frame`,nr),unit:$(`unit`,$n),fit:$(`fit`,()=>G?.fit()),remove:$(`delete board`,rr,`wb-button-danger`)};l.fit.dataset.phoneVisible=``,c.append(l.box,l.wire,l.note,l.frame,l.unit,l.fit,l.remove,q.element),i.append(a,c),n.append(r,$(`new board`,ir),i);let u=t(`div`,`wb-canvas`),d=document.createElementNS(Ln,`svg`);d.setAttribute(`class`,`wb-svg`),d.setAttribute(`role`,`img`),d.setAttribute(`aria-label`,`Whiteboard`),d.setAttribute(`preserveAspectRatio`,`xMidYMin meet`),u.append(d);let f=t(`p`,`wb-empty`,Rn),m=t(`div`,`wb-dock`);m.hidden=!0;let h=t(`span`,`wb-dock-queued`),g=$(`send to agent`,()=>void Xn()),v=t(`div`,`wb-dock-bar`);v.append(h,g,J.element),m.append(v),e.replaceChildren(n,u,f,m),U={list:r,boardHead:i,boardMeta:o,presence:s,toolbar:c,canvas:u,empty:f,dock:m,dockQueued:h,sendToAgent:g,buttons:l};let y=In(d);W=y,G=ce({svg:d,canvas:u,renderer:y,currentBoard:X,sendOps:Hn,onSelectionChange:Gn,onPhoneTapBox:er,onOpenLinkedBoard:Q}),p(Kn),_(e=>{e===H&&Zn()}),Kn()}function or(){return document.documentElement.dataset.layout===`phone`}function sr(){K&&u()===K&&ee(),K=null,U&&(U.dock.hidden=!0)}function cr(e){if(!U||or())return;let t=r(e);t&&(K=e,U.dock.hidden=!1,J.clear(),Yn(),te(t,e,U.dock,{className:`wb-docked-card`}),c(t,e,!0))}function lr(){let e=d();e&&(Q(e.boardId),e.dockSessionId&&cr(e.dockSessionId)),Kn(),H&&l(H).then(Zn)}var ur={mount:ar,refresh:lr,deactivate:sr};export{ur as view};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e,d as t,f as n,s as r}from"./dom-helpers-DBbFg1c_.js";import{d as i,u as a}from"./control-ws-ByEqbpGM.js";import{o}from"./card-registry-CLrAbqh5.js";import{c as s,i as c,s as ee,t as l}from"./action-status-SSA4xM57.js";import{i as u}from"./modal-USMHOKBI.js";import{Bt as d,Ct as f,Dt as p,Lt as m,Nt as h,Pt as g,Qr as _,Rt as v,St as y,Vt as b,Zr as te,_ as ne,bt as x,dn as re,fn as ie,j as ae,jt as oe,lt as se,m as ce,vt as le,wt as ue,x as de,xt as fe,yt as pe}from"./index-DHeVbbPl.js";import{t as me}from"./team-review-panel-BpO51bDg.js";import{t as he}from"./pr-queue-columns-D7zc20dF.js";import{n as S}from"./setup-step-D0y3riKj.js";var ge={HIGH:`High confidence`,MEDIUM:`Medium confidence`,LOW:`Low confidence`},_e={HIGH:`ok`,MEDIUM:`warn`,LOW:`muted`},C={queued:`Waiting to be researched`,running:`Researching`,error:`Research failed`,aside:`Set aside`},ve={forum:`Forum`,discord:`Discord`};function w(e){return e.status===`ready`&&e.verdict?{text:ge[e.verdict],tone:_e[e.verdict]}:e.status===`ready`?{text:`Researched`,tone:`muted`}:e.status===`error`?{text:C.error,tone:`danger`}:{text:C[e.status],tone:`muted`}}function T(e){let t=ve[e.item.source];return e.item.channel?`${t} #${e.item.channel}`:t}function E(e){return e.entry.item.title||`Untitled question`}function ye(e){return e.status!==`running`&&e.status!==`queued`}function be(e){return e.status!==`aside`}function xe(e){let t=e.find(e=>e.id===`working`)?.items.length??0;return t===0?`No community question needs you right now.`:`No community question needs you right now. ${t} ${t===1?`question is`:`questions are`} being researched.`}function D(e){return e?e.configured===!1?e.reason??`The community lane is not set up yet.`:`No community questions yet. New ones asked after you turned this on show up here.`:`Waiting for the community lane to report.`}function Se(e){return e.filter(e=>!e.isWorkspace&&!e.isEphemeral).map(({id:e,name:t})=>({id:e,name:t})).toSorted((e,t)=>e.name.localeCompare(t.name))}var O=[`key`,`project`,`skill`,`discord`];function Ce(e){let t=e===`finished`?O.length:O.indexOf(e),n=e=>e<t?`done`:e===t?`current`:`upcoming`;return{key:n(0),project:n(1),skill:n(2),discord:n(3)}}function we(e){let t=e.split(/[\s,]+/).map(e=>e.replace(/^#/,``)).filter(Boolean);return[...new Set(t)]}var k=2;function A(e){a({type:`dashboard-telemetry`,event:`operator_action`,properties:{surface:`onboarding`,action:e}})}function j(){let e=ae().community,t=typeof e==`object`&&e?e:{},n=Array.isArray(t.discordChannels)?t.discordChannels.filter(e=>typeof e==`string`):[];return{projectId:typeof t.projectId==`number`?t.projectId:k,skill:typeof t.skill==`string`?t.skill:``,discordChannels:n}}function Te(e,t,n,i){let a=r(`input`,`dialog-input repo-roots-adder-input`);return a.id=e,a.type=i,a.value=t,a.placeholder=n,a.autocomplete=`off`,a.spellcheck=!1,a}function M(e,t){let n=r(`button`,`btn-dialog btn-dialog-${t}`,e);return n.type=`button`,n}function Ee({onFinish:e}){let t=r(`section`,`first-run-checklist review-setup`);t.setAttribute(`aria-labelledby`,`community-setup-title`);let n=r(`h2`,`first-run-title`,`Answer community questions`);n.id=`community-setup-title`;let a=r(`ol`,`first-run-steps`),o=r(`p`,`first-run-step-hint review-setup-foot`,`Each question gets a researched draft reply. Nothing posts until you post it yourself. `);o.append(ne(`lanes-community`,`community-enabled`,`All community settings`));let s=r(`div`,`first-run-step-actions`),u=M(`Finish setup`,`confirm`);s.append(u),s.hidden=!0,t.append(r(`span`,`first-run-eyebrow`,`SET UP COMMUNITY`),n,a,s,o);let d=null;u.addEventListener(`click`,()=>{A(`finish-community-setup`),d=null,e()});function f(e){d=e,y(),(a.querySelector(`[aria-current="step"] input`)??(s.hidden?null:u))?.focus()}async function p(e,t,n,r){t.disabled=!0,n.show(`busy`,`Saving`);try{let t=await i(`update-settings`,{settings:e},{timeoutMs:l});if(t.type===`settings-error`){n.show(`error`,t.message);return}if(t.type!==`settings-updated`){n.show(`error`,`The server did not confirm the save.`);return}de(t.settings),f(r)}catch(e){n.show(`error`,ee(e,l))}finally{t.disabled=!1}}function m(e){let t=Te(e.inputId,e.initialValue,e.placeholder,e.inputType),n=r(`label`,`repo-roots-adder-label`,e.label);n.htmlFor=t.id;let i=r(`div`,`first-run-step-actions`),a=c(),o=M(e.saveLabel,`confirm`),s=()=>{let n=e.settingsPatch(t.value);typeof n==`string`?a.show(`error`,n):(A(e.action),p(n,o,a,e.nextProgress))};if(o.addEventListener(`click`,s),t.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),s())}),i.append(o),e.isSkippable){let t=M(`Skip`,`cancel`);t.addEventListener(`click`,()=>f(e.nextProgress)),i.append(t)}return i.append(a.element),[r(`p`,`first-run-step-text`,e.advice),n,t,i]}let h=()=>m({advice:`Glimmervoid reads new forum and Discord questions through your PostHog personal API key. Create one in PostHog under Settings, Personal API keys. Community needs only the query:read scope on the project that holds the questions. PostHog error monitoring shares this key, so add error tracking read and write if you turn that on.`,label:`PERSONAL API KEY`,inputId:`community-setup-key`,inputType:`password`,initialValue:``,placeholder:`phx_`,saveLabel:`Save key`,action:`save-community-key`,nextProgress:`project`,isSkippable:!1,settingsPatch:e=>e.trim()?{posthog:{apiKey:e.trim()}}:`Paste a PostHog personal API key.`}),g=()=>m({advice:`The PostHog project that holds the synced community forum table and the Discord bot events. PostHog's own community lives in project 2.`,label:`PROJECT ID`,inputId:`community-setup-project`,inputType:`number`,initialValue:String(j().projectId),placeholder:String(k),saveLabel:`Use project`,action:`save-community-project`,nextProgress:`skill`,isSkippable:!1,settingsPatch:e=>{let t=Number(e.trim());return Number.isInteger(t)&&t>0?{community:{projectId:t}}:`Type the project id as a whole number, such as 2.`}}),_=()=>m({advice:`The Claude Code skill the research agent follows for each question, typed by name. A skill that knows your docs and support playbook gives the best drafts. Skip to research with whatever skills the agent has.`,label:`SKILL`,inputId:`community-setup-skill`,inputType:`text`,initialValue:j().skill,placeholder:`skill name`,saveLabel:`Save skill`,action:`save-community-skill`,nextProgress:`discord`,isSkippable:!0,settingsPatch:e=>({community:{skill:e.trim().replace(/^\//,``)}})}),v=()=>m({advice:`Discord questions come from a Discord bot that sends message_sent and thread_created events into the project above. With that bot in place, list the channels to watch by name, without the #. A cheap model picks out the real questions; only those are researched.`,label:`CHANNELS`,inputId:`community-setup-discord`,inputType:`text`,initialValue:j().discordChannels.join(`, `),placeholder:`community-questions, help`,saveLabel:`Save channels`,action:`save-community-discord`,nextProgress:`finished`,isSkippable:!0,settingsPatch:e=>{let t=we(e);return t.length>0?{community:{discordChannels:t}}:`Type at least one channel, or skip.`}});function y(){if(!d)return;let e=Ce(d);a.replaceChildren(S({title:`1. PostHog personal API key`,state:e.key,summary:`Key saved`,badge:`NEEDED`,body:h}),S({title:`2. PostHog project`,state:e.project,summary:`Project ${j().projectId}`,badge:``,body:g}),S({title:`3. Research skill (optional)`,state:e.skill,summary:j().skill||`No skill`,badge:``,body:_}),S({title:`4. Discord (optional)`,state:e.discord,summary:j().discordChannels.map(e=>`#${e}`).join(` `)||`Forum only`,badge:``,body:v})),s.hidden=d!==`finished`}function b(){d=`key`,y()}return{element:t,open:b,isOpen:()=>d!==null}}var N=null,P=null,F=null,I=null,L=[],R=null,z=!1,B=null,V=null,H=``,U=new Map,W=null;function De(){return Se([...o].map(([e,t])=>({id:e,name:t.nameEl.textContent??e,isWorkspace:t.card.dataset.workspace!==void 0,isEphemeral:t.card.dataset.ephemeral!==void 0})))}function G(e,t){let n=r(`button`,`pr-action pr-action-ghost`,e);return n.type=`button`,n.disabled=!_(t),n.addEventListener(`click`,()=>te(t)),n}function K(e,t,n){let i=r(`button`,`pr-action`,e);return i.type=`button`,i.disabled=!t,i.addEventListener(`click`,n),i}function q(e,t,n){let i=r(`ul`,e);i.setAttribute(`aria-label`,t);for(let e of n)i.append(r(`li`,null,e));return i}function Oe(e){let t=r(`div`,`pr-detail-heading`),n=r(`div`,`pr-detail-title`);n.append(r(`h2`,null,e.item.title||`Untitled question`));let i=r(`div`,`pr-detail-meta`),a=Date.parse(e.item.createdAt);return i.append(r(`span`,null,e.item.author),r(`span`,null,T(e))),Number.isNaN(a)||i.append(r(`span`,null,`Asked ${ce(a)}`)),t.append(n,i),t}function ke(e){let t=r(`section`,`community-question`);return t.setAttribute(`aria-label`,`Question as asked`),t.append(r(`h3`,`pr-section-heading`,`Question as asked`),r(`p`,`community-question-body`,e.item.body)),t}function Ae(e){let t=r(`section`,`pr-verdict-box`);t.setAttribute(`aria-label`,`Research`);let n=w(e),i=r(`div`,`pr-verdict-line`),a=r(`strong`,`community-badge`,n.text);if(a.dataset.tone=n.tone,i.append(a),t.append(i),e.error&&t.append(r(`p`,`pr-attention-detail`,e.error)),e.summary&&t.append(r(`p`,`pr-verdict-summary`,e.summary)),e.goal&&t.append(r(`p`,`community-goal`,`Goal: ${e.goal}`)),e.gaps.length>0&&t.append(q(`pr-verdict-gaps`,`Not covered`,e.gaps)),e.checked.length===0)return t;let o=r(`details`,`pr-verdict-checked`);return o.append(r(`summary`,null,`What it checked (${e.checked.length})`),q(`community-checked`,`What it checked`,e.checked)),t.append(o),t}function je(e){if(!e.draft)return null;let t=r(`section`,`community-draft`);t.setAttribute(`aria-label`,`Draft reply`),t.append(r(`h3`,`pr-section-heading`,`Draft reply`),r(`p`,`community-draft-body`,e.draft.body));let n=e.draft.publicLinks.filter(_);if(n.length===0)return t;let i=r(`ul`,`community-links`);for(let e of n){let t=r(`li`);t.append(G(e,e)),i.append(t)}return t.append(i),t}function Me(t,n){let r=t.draft?e(t.draft.body):null;r?r.then(()=>n.show(`ok`,`Draft copied. Post it yourself where the question was asked.`),()=>n.show(`error`,`Copying failed. Select the draft text instead.`)):n.show(`error`,`This browser does not allow copying here. Select the draft text instead.`)}async function Ne(e,t){if(!H){t.show(`error`,`Pick a session to start from first.`);return}let n=await s(`open-community-session`,{key:e.item.key,projectId:H},t,{busyText:`Starting a session with the research.`});n?.type===`open-community-session-result`&&(n.ok?(t.show(`ok`,`Started ${n.sessionName??`a session`}.`),n.sessionId&&se()?.openTerminal(n.sessionId)):t.show(`error`,n.error??`The session did not start.`))}async function J(e,t,n){let r=t===`rerun`?`Queuing the research again.`:`Setting the question aside.`,i=await s(`community-action`,{key:e.item.key,action:t},n,{busyText:r});i?.type===`community-action-result`&&(i.ok||n.show(`error`,i.error??`The change did not apply.`))}function Pe(){let e=r(`select`,`community-session-picker`);e.setAttribute(`aria-label`,`Session to start from`);let t=De();t.some(e=>e.id===H)||(H=t[0]?.id??``);for(let n of t){let t=r(`option`,null,n.name);t.value=n.id,t.selected=n.id===H,e.append(t)}return e.disabled=t.length===0,e.addEventListener(`change`,()=>{H=e.value}),e}function Fe(e){let t=r(`div`,`community-actions`),n=c(`pr-action-status`),i=r(`div`,`community-action-buttons`);return i.append(K(`Copy draft`,e.draft!==null,()=>Me(e,n)),G(`Open thread`,e.item.url),Pe(),K(`Start session`,!0,()=>void Ne(e,n)),K(`Re-run`,ye(e),()=>void J(e,`rerun`,n)),K(`Set aside`,be(e),()=>void J(e,`set-aside`,n))),t.append(i,n.element),t}function Ie(e){let t=r(`article`,`pr-detail community-detail`),n=je(e);return t.append(Oe(e),Fe(e),...n?[n]:[],Ae(e),ke(e)),t}function Y(){if(!F)return;let e=m(L,R),t=e?JSON.stringify(e.entry):`empty:${b(L).length}`;if(t===V)return;if(V=t,e){F.replaceChildren(Ie(e.entry));return}let n=L.some(e=>e.items.length>0);F.replaceChildren(n?me({title:`All caught up`,detail:xe(L)}):r(`p`,`pr-empty`,D(x())))}function Le(e,t){f(h(e))&&t.querySelector(`.pr-queue-unseen`)?.remove()}function X(){if(!I)return;let e=g(L,E);ie(I,p(e),e.filter(e=>e.id!==R))}function Z(e){R=e;for(let[t,n]of U)n.setAttribute(`aria-current`,String(t===e));let t=m(L,e),n=U.get(e);t&&n&&Le(t,n),Y(),X(),N&&(N.dataset.detailOpen=`true`)}function Re(){N&&(N.dataset.detailOpen=`false`),R&&U.get(R)?.focus({preventScroll:!0})}function Q(e){let t=m(L,e);if(!t)return;L.find(e=>e.items.includes(t))?.id===`aside`&&(z=!0),R=e,$(),Z(e);let n=U.get(e);n?.focus({preventScroll:!0}),n?.scrollIntoView({block:`nearest`})}function ze(e){if(e.repeat||e.defaultPrevented||!N||t(N)||u()||n(e)||document.activeElement?.classList.contains(`xterm-helper-textarea`))return;let r=v(e);if(r!==`next-row`&&r!==`previous-row`)return;let i=d([...U.keys()],R,r===`next-row`?1:-1);i&&(e.preventDefault(),i!==R&&Q(i))}function Be(e,t){let n=r(`button`,`pr-queue-row pr-queue-row-quiet`);n.type=`button`,n.dataset.queueKey=e.key,n.setAttribute(`aria-current`,String(e.key===R));let i=w(e.entry),a=r(`span`,`review-queue-action community-badge`,i.text);a.dataset.tone=i.tone;let o=r(`span`,`pr-queue-top`);if(o.append(a,r(`span`,`pr-queue-title`,E(e))),n.append(o,r(`span`,`pr-queue-elapsed`,T(e.entry))),n.title=E(e),t&&y(h(e))){let e=r(`span`,`tab-activity active pr-queue-unseen`);e.setAttribute(`aria-hidden`,`true`),n.append(e)}return n.addEventListener(`click`,()=>Z(e.key)),U.set(e.key,n),n}function Ve(e){let t=r(`h3`,`pr-section-heading review-group-heading`),n=r(`span`,`review-group-count`,String(e.items.length));if(e.id!==`aside`)return t.append(r(`span`,null,e.title),n),t;let i=r(`button`,`review-group-toggle`),a=r(`span`,`review-group-chevron`,`▸`);return a.setAttribute(`aria-hidden`,`true`),i.append(a,e.title),i.type=`button`,i.setAttribute(`aria-expanded`,String(z)),i.addEventListener(`click`,()=>{z=!z,B=null,$()}),t.append(i,n),t}function He(e){let t=r(`section`,`pr-queue-section`);if(t.dataset.group=e.id,t.append(Ve(e)),e.id===`aside`&&!z)return t;for(let n of e.items)t.append(Be(n,e.id===`turn`));return t}function Ue(){if(!N||!W)return!1;x()?.configured===!1&&!W.isOpen()&&W.open();let e=W.isOpen();return N.dataset.setup=String(e),W.element.hidden=!e,e}function $(){if(!P||Ue())return;L=pe(),R=oe(L.filter(e=>e.id!==`aside`||z),R),X();let e=JSON.stringify([L,R,z,fe(),x()?.error??null]);if(e!==B){B=e,U.clear();let t=x()?.error,n=t?[r(`p`,`my-pr-note`,t)]:[],i=L.filter(e=>e.items.length>0).map(He);P.replaceChildren(...n,...i.length>0?i:[r(`p`,`pr-empty`,D(x()))])}Y()}function We(e){if(N)return;N=r(`div`,`pr-content review-queue community-queue`),e.append(N);let n=he({queueLabel:`Community questions`,scopeTabs:null,resizerLabel:`Resize community queue`});P=n.queue,F=r(`div`,`review-queue-detail`);let i=r(`div`,`review-queue-phone-bar`),a=r(`button`,`pr-action pr-action-ghost review-queue-back`,`Back to queue`);a.type=`button`,a.addEventListener(`click`,Re),i.append(a),n.detail.append(i,F),I=re({onJump:()=>{let e=g(L,E).find(e=>e.id!==R)?.id;e&&Q(e)},rowFor:e=>U.get(e)}),I.classList.add(`review-queue-banner`),n.queue.before(I),W=Ee({onFinish:$}),W.element.hidden=!0,N.append(W.element,n.columns),N.dataset.detailOpen=`false`,le(()=>!t(N)),ue(e=>{e.kind===`status`&&$()}),document.addEventListener(`keydown`,ze),$()}var Ge={mount:We,refresh:()=>{V=null,$()}};export{Ge as view};
|
|
1
|
+
import{b as e,d as t,f as n,s as r}from"./dom-helpers-DBbFg1c_.js";import{d as i,u as a}from"./control-ws-ByEqbpGM.js";import{o}from"./card-registry-CLrAbqh5.js";import{c as s,i as c,s as ee,t as l}from"./action-status-SSA4xM57.js";import{i as u}from"./modal-USMHOKBI.js";import{Bt as d,Ct as f,Dt as p,Lt as m,Nt as h,Pt as g,Qr as _,Rt as v,St as y,Vt as b,Zr as te,_ as ne,bt as x,dn as re,fn as ie,j as ae,jt as oe,lt as se,m as ce,vt as le,wt as ue,x as de,xt as fe,yt as pe}from"./index-Bq8I2EvJ.js";import{t as me}from"./team-review-panel-fzO8k-mj.js";import{t as he}from"./pr-queue-columns-DxnG1qNa.js";import{n as S}from"./setup-step-D0y3riKj.js";var ge={HIGH:`High confidence`,MEDIUM:`Medium confidence`,LOW:`Low confidence`},_e={HIGH:`ok`,MEDIUM:`warn`,LOW:`muted`},C={queued:`Waiting to be researched`,running:`Researching`,error:`Research failed`,aside:`Set aside`},ve={forum:`Forum`,discord:`Discord`};function w(e){return e.status===`ready`&&e.verdict?{text:ge[e.verdict],tone:_e[e.verdict]}:e.status===`ready`?{text:`Researched`,tone:`muted`}:e.status===`error`?{text:C.error,tone:`danger`}:{text:C[e.status],tone:`muted`}}function T(e){let t=ve[e.item.source];return e.item.channel?`${t} #${e.item.channel}`:t}function E(e){return e.entry.item.title||`Untitled question`}function ye(e){return e.status!==`running`&&e.status!==`queued`}function be(e){return e.status!==`aside`}function xe(e){let t=e.find(e=>e.id===`working`)?.items.length??0;return t===0?`No community question needs you right now.`:`No community question needs you right now. ${t} ${t===1?`question is`:`questions are`} being researched.`}function D(e){return e?e.configured===!1?e.reason??`The community lane is not set up yet.`:`No community questions yet. New ones asked after you turned this on show up here.`:`Waiting for the community lane to report.`}function Se(e){return e.filter(e=>!e.isWorkspace&&!e.isEphemeral).map(({id:e,name:t})=>({id:e,name:t})).toSorted((e,t)=>e.name.localeCompare(t.name))}var O=[`key`,`project`,`skill`,`discord`];function Ce(e){let t=e===`finished`?O.length:O.indexOf(e),n=e=>e<t?`done`:e===t?`current`:`upcoming`;return{key:n(0),project:n(1),skill:n(2),discord:n(3)}}function we(e){let t=e.split(/[\s,]+/).map(e=>e.replace(/^#/,``)).filter(Boolean);return[...new Set(t)]}var k=2;function A(e){a({type:`dashboard-telemetry`,event:`operator_action`,properties:{surface:`onboarding`,action:e}})}function j(){let e=ae().community,t=typeof e==`object`&&e?e:{},n=Array.isArray(t.discordChannels)?t.discordChannels.filter(e=>typeof e==`string`):[];return{projectId:typeof t.projectId==`number`?t.projectId:k,skill:typeof t.skill==`string`?t.skill:``,discordChannels:n}}function Te(e,t,n,i){let a=r(`input`,`dialog-input repo-roots-adder-input`);return a.id=e,a.type=i,a.value=t,a.placeholder=n,a.autocomplete=`off`,a.spellcheck=!1,a}function M(e,t){let n=r(`button`,`btn-dialog btn-dialog-${t}`,e);return n.type=`button`,n}function Ee({onFinish:e}){let t=r(`section`,`first-run-checklist review-setup`);t.setAttribute(`aria-labelledby`,`community-setup-title`);let n=r(`h2`,`first-run-title`,`Answer community questions`);n.id=`community-setup-title`;let a=r(`ol`,`first-run-steps`),o=r(`p`,`first-run-step-hint review-setup-foot`,`Each question gets a researched draft reply. Nothing posts until you post it yourself. `);o.append(ne(`lanes-community`,`community-enabled`,`All community settings`));let s=r(`div`,`first-run-step-actions`),u=M(`Finish setup`,`confirm`);s.append(u),s.hidden=!0,t.append(r(`span`,`first-run-eyebrow`,`SET UP COMMUNITY`),n,a,s,o);let d=null;u.addEventListener(`click`,()=>{A(`finish-community-setup`),d=null,e()});function f(e){d=e,y(),(a.querySelector(`[aria-current="step"] input`)??(s.hidden?null:u))?.focus()}async function p(e,t,n,r){t.disabled=!0,n.show(`busy`,`Saving`);try{let t=await i(`update-settings`,{settings:e},{timeoutMs:l});if(t.type===`settings-error`){n.show(`error`,t.message);return}if(t.type!==`settings-updated`){n.show(`error`,`The server did not confirm the save.`);return}de(t.settings),f(r)}catch(e){n.show(`error`,ee(e,l))}finally{t.disabled=!1}}function m(e){let t=Te(e.inputId,e.initialValue,e.placeholder,e.inputType),n=r(`label`,`repo-roots-adder-label`,e.label);n.htmlFor=t.id;let i=r(`div`,`first-run-step-actions`),a=c(),o=M(e.saveLabel,`confirm`),s=()=>{let n=e.settingsPatch(t.value);typeof n==`string`?a.show(`error`,n):(A(e.action),p(n,o,a,e.nextProgress))};if(o.addEventListener(`click`,s),t.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),s())}),i.append(o),e.isSkippable){let t=M(`Skip`,`cancel`);t.addEventListener(`click`,()=>f(e.nextProgress)),i.append(t)}return i.append(a.element),[r(`p`,`first-run-step-text`,e.advice),n,t,i]}let h=()=>m({advice:`Glimmervoid reads new forum and Discord questions through your PostHog personal API key. Create one in PostHog under Settings, Personal API keys. Community needs only the query:read scope on the project that holds the questions. PostHog error monitoring shares this key, so add error tracking read and write if you turn that on.`,label:`PERSONAL API KEY`,inputId:`community-setup-key`,inputType:`password`,initialValue:``,placeholder:`phx_`,saveLabel:`Save key`,action:`save-community-key`,nextProgress:`project`,isSkippable:!1,settingsPatch:e=>e.trim()?{posthog:{apiKey:e.trim()}}:`Paste a PostHog personal API key.`}),g=()=>m({advice:`The PostHog project that holds the synced community forum table and the Discord bot events. PostHog's own community lives in project 2.`,label:`PROJECT ID`,inputId:`community-setup-project`,inputType:`number`,initialValue:String(j().projectId),placeholder:String(k),saveLabel:`Use project`,action:`save-community-project`,nextProgress:`skill`,isSkippable:!1,settingsPatch:e=>{let t=Number(e.trim());return Number.isInteger(t)&&t>0?{community:{projectId:t}}:`Type the project id as a whole number, such as 2.`}}),_=()=>m({advice:`The Claude Code skill the research agent follows for each question, typed by name. A skill that knows your docs and support playbook gives the best drafts. Skip to research with whatever skills the agent has.`,label:`SKILL`,inputId:`community-setup-skill`,inputType:`text`,initialValue:j().skill,placeholder:`skill name`,saveLabel:`Save skill`,action:`save-community-skill`,nextProgress:`discord`,isSkippable:!0,settingsPatch:e=>({community:{skill:e.trim().replace(/^\//,``)}})}),v=()=>m({advice:`Discord questions come from a Discord bot that sends message_sent and thread_created events into the project above. With that bot in place, list the channels to watch by name, without the #. A cheap model picks out the real questions; only those are researched.`,label:`CHANNELS`,inputId:`community-setup-discord`,inputType:`text`,initialValue:j().discordChannels.join(`, `),placeholder:`community-questions, help`,saveLabel:`Save channels`,action:`save-community-discord`,nextProgress:`finished`,isSkippable:!0,settingsPatch:e=>{let t=we(e);return t.length>0?{community:{discordChannels:t}}:`Type at least one channel, or skip.`}});function y(){if(!d)return;let e=Ce(d);a.replaceChildren(S({title:`1. PostHog personal API key`,state:e.key,summary:`Key saved`,badge:`NEEDED`,body:h}),S({title:`2. PostHog project`,state:e.project,summary:`Project ${j().projectId}`,badge:``,body:g}),S({title:`3. Research skill (optional)`,state:e.skill,summary:j().skill||`No skill`,badge:``,body:_}),S({title:`4. Discord (optional)`,state:e.discord,summary:j().discordChannels.map(e=>`#${e}`).join(` `)||`Forum only`,badge:``,body:v})),s.hidden=d!==`finished`}function b(){d=`key`,y()}return{element:t,open:b,isOpen:()=>d!==null}}var N=null,P=null,F=null,I=null,L=[],R=null,z=!1,B=null,V=null,H=``,U=new Map,W=null;function De(){return Se([...o].map(([e,t])=>({id:e,name:t.nameEl.textContent??e,isWorkspace:t.card.dataset.workspace!==void 0,isEphemeral:t.card.dataset.ephemeral!==void 0})))}function G(e,t){let n=r(`button`,`pr-action pr-action-ghost`,e);return n.type=`button`,n.disabled=!_(t),n.addEventListener(`click`,()=>te(t)),n}function K(e,t,n){let i=r(`button`,`pr-action`,e);return i.type=`button`,i.disabled=!t,i.addEventListener(`click`,n),i}function q(e,t,n){let i=r(`ul`,e);i.setAttribute(`aria-label`,t);for(let e of n)i.append(r(`li`,null,e));return i}function Oe(e){let t=r(`div`,`pr-detail-heading`),n=r(`div`,`pr-detail-title`);n.append(r(`h2`,null,e.item.title||`Untitled question`));let i=r(`div`,`pr-detail-meta`),a=Date.parse(e.item.createdAt);return i.append(r(`span`,null,e.item.author),r(`span`,null,T(e))),Number.isNaN(a)||i.append(r(`span`,null,`Asked ${ce(a)}`)),t.append(n,i),t}function ke(e){let t=r(`section`,`community-question`);return t.setAttribute(`aria-label`,`Question as asked`),t.append(r(`h3`,`pr-section-heading`,`Question as asked`),r(`p`,`community-question-body`,e.item.body)),t}function Ae(e){let t=r(`section`,`pr-verdict-box`);t.setAttribute(`aria-label`,`Research`);let n=w(e),i=r(`div`,`pr-verdict-line`),a=r(`strong`,`community-badge`,n.text);if(a.dataset.tone=n.tone,i.append(a),t.append(i),e.error&&t.append(r(`p`,`pr-attention-detail`,e.error)),e.summary&&t.append(r(`p`,`pr-verdict-summary`,e.summary)),e.goal&&t.append(r(`p`,`community-goal`,`Goal: ${e.goal}`)),e.gaps.length>0&&t.append(q(`pr-verdict-gaps`,`Not covered`,e.gaps)),e.checked.length===0)return t;let o=r(`details`,`pr-verdict-checked`);return o.append(r(`summary`,null,`What it checked (${e.checked.length})`),q(`community-checked`,`What it checked`,e.checked)),t.append(o),t}function je(e){if(!e.draft)return null;let t=r(`section`,`community-draft`);t.setAttribute(`aria-label`,`Draft reply`),t.append(r(`h3`,`pr-section-heading`,`Draft reply`),r(`p`,`community-draft-body`,e.draft.body));let n=e.draft.publicLinks.filter(_);if(n.length===0)return t;let i=r(`ul`,`community-links`);for(let e of n){let t=r(`li`);t.append(G(e,e)),i.append(t)}return t.append(i),t}function Me(t,n){let r=t.draft?e(t.draft.body):null;r?r.then(()=>n.show(`ok`,`Draft copied. Post it yourself where the question was asked.`),()=>n.show(`error`,`Copying failed. Select the draft text instead.`)):n.show(`error`,`This browser does not allow copying here. Select the draft text instead.`)}async function Ne(e,t){if(!H){t.show(`error`,`Pick a session to start from first.`);return}let n=await s(`open-community-session`,{key:e.item.key,projectId:H},t,{busyText:`Starting a session with the research.`});n?.type===`open-community-session-result`&&(n.ok?(t.show(`ok`,`Started ${n.sessionName??`a session`}.`),n.sessionId&&se()?.openTerminal(n.sessionId)):t.show(`error`,n.error??`The session did not start.`))}async function J(e,t,n){let r=t===`rerun`?`Queuing the research again.`:`Setting the question aside.`,i=await s(`community-action`,{key:e.item.key,action:t},n,{busyText:r});i?.type===`community-action-result`&&(i.ok||n.show(`error`,i.error??`The change did not apply.`))}function Pe(){let e=r(`select`,`community-session-picker`);e.setAttribute(`aria-label`,`Session to start from`);let t=De();t.some(e=>e.id===H)||(H=t[0]?.id??``);for(let n of t){let t=r(`option`,null,n.name);t.value=n.id,t.selected=n.id===H,e.append(t)}return e.disabled=t.length===0,e.addEventListener(`change`,()=>{H=e.value}),e}function Fe(e){let t=r(`div`,`community-actions`),n=c(`pr-action-status`),i=r(`div`,`community-action-buttons`);return i.append(K(`Copy draft`,e.draft!==null,()=>Me(e,n)),G(`Open thread`,e.item.url),Pe(),K(`Start session`,!0,()=>void Ne(e,n)),K(`Re-run`,ye(e),()=>void J(e,`rerun`,n)),K(`Set aside`,be(e),()=>void J(e,`set-aside`,n))),t.append(i,n.element),t}function Ie(e){let t=r(`article`,`pr-detail community-detail`),n=je(e);return t.append(Oe(e),Fe(e),...n?[n]:[],Ae(e),ke(e)),t}function Y(){if(!F)return;let e=m(L,R),t=e?JSON.stringify(e.entry):`empty:${b(L).length}`;if(t===V)return;if(V=t,e){F.replaceChildren(Ie(e.entry));return}let n=L.some(e=>e.items.length>0);F.replaceChildren(n?me({title:`All caught up`,detail:xe(L)}):r(`p`,`pr-empty`,D(x())))}function Le(e,t){f(h(e))&&t.querySelector(`.pr-queue-unseen`)?.remove()}function X(){if(!I)return;let e=g(L,E);ie(I,p(e),e.filter(e=>e.id!==R))}function Z(e){R=e;for(let[t,n]of U)n.setAttribute(`aria-current`,String(t===e));let t=m(L,e),n=U.get(e);t&&n&&Le(t,n),Y(),X(),N&&(N.dataset.detailOpen=`true`)}function Re(){N&&(N.dataset.detailOpen=`false`),R&&U.get(R)?.focus({preventScroll:!0})}function Q(e){let t=m(L,e);if(!t)return;L.find(e=>e.items.includes(t))?.id===`aside`&&(z=!0),R=e,$(),Z(e);let n=U.get(e);n?.focus({preventScroll:!0}),n?.scrollIntoView({block:`nearest`})}function ze(e){if(e.repeat||e.defaultPrevented||!N||t(N)||u()||n(e)||document.activeElement?.classList.contains(`xterm-helper-textarea`))return;let r=v(e);if(r!==`next-row`&&r!==`previous-row`)return;let i=d([...U.keys()],R,r===`next-row`?1:-1);i&&(e.preventDefault(),i!==R&&Q(i))}function Be(e,t){let n=r(`button`,`pr-queue-row pr-queue-row-quiet`);n.type=`button`,n.dataset.queueKey=e.key,n.setAttribute(`aria-current`,String(e.key===R));let i=w(e.entry),a=r(`span`,`review-queue-action community-badge`,i.text);a.dataset.tone=i.tone;let o=r(`span`,`pr-queue-top`);if(o.append(a,r(`span`,`pr-queue-title`,E(e))),n.append(o,r(`span`,`pr-queue-elapsed`,T(e.entry))),n.title=E(e),t&&y(h(e))){let e=r(`span`,`tab-activity active pr-queue-unseen`);e.setAttribute(`aria-hidden`,`true`),n.append(e)}return n.addEventListener(`click`,()=>Z(e.key)),U.set(e.key,n),n}function Ve(e){let t=r(`h3`,`pr-section-heading review-group-heading`),n=r(`span`,`review-group-count`,String(e.items.length));if(e.id!==`aside`)return t.append(r(`span`,null,e.title),n),t;let i=r(`button`,`review-group-toggle`),a=r(`span`,`review-group-chevron`,`▸`);return a.setAttribute(`aria-hidden`,`true`),i.append(a,e.title),i.type=`button`,i.setAttribute(`aria-expanded`,String(z)),i.addEventListener(`click`,()=>{z=!z,B=null,$()}),t.append(i,n),t}function He(e){let t=r(`section`,`pr-queue-section`);if(t.dataset.group=e.id,t.append(Ve(e)),e.id===`aside`&&!z)return t;for(let n of e.items)t.append(Be(n,e.id===`turn`));return t}function Ue(){if(!N||!W)return!1;x()?.configured===!1&&!W.isOpen()&&W.open();let e=W.isOpen();return N.dataset.setup=String(e),W.element.hidden=!e,e}function $(){if(!P||Ue())return;L=pe(),R=oe(L.filter(e=>e.id!==`aside`||z),R),X();let e=JSON.stringify([L,R,z,fe(),x()?.error??null]);if(e!==B){B=e,U.clear();let t=x()?.error,n=t?[r(`p`,`my-pr-note`,t)]:[],i=L.filter(e=>e.items.length>0).map(He);P.replaceChildren(...n,...i.length>0?i:[r(`p`,`pr-empty`,D(x()))])}Y()}function We(e){if(N)return;N=r(`div`,`pr-content review-queue community-queue`),e.append(N);let n=he({queueLabel:`Community questions`,scopeTabs:null,resizerLabel:`Resize community queue`});P=n.queue,F=r(`div`,`review-queue-detail`);let i=r(`div`,`review-queue-phone-bar`),a=r(`button`,`pr-action pr-action-ghost review-queue-back`,`Back to queue`);a.type=`button`,a.addEventListener(`click`,Re),i.append(a),n.detail.append(i,F),I=re({onJump:()=>{let e=g(L,E).find(e=>e.id!==R)?.id;e&&Q(e)},rowFor:e=>U.get(e)}),I.classList.add(`review-queue-banner`),n.queue.before(I),W=Ee({onFinish:$}),W.element.hidden=!0,N.append(W.element,n.columns),N.dataset.detailOpen=`false`,le(()=>!t(N)),ue(e=>{e.kind===`status`&&$()}),document.addEventListener(`keydown`,ze),$()}var Ge={mount:We,refresh:()=>{V=null,$()}};export{Ge as view};
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e,F as t,I as n,L as r,at as i,it as a}from"./updates-view-core-Qkm1ZY4B.js";import{g as o,h as s,s as c}from"./dom-helpers-DBbFg1c_.js";import{d as l}from"./control-ws-ByEqbpGM.js";import{i as u,s as d,t as f}from"./action-status-SSA4xM57.js";import{n as p,r as m,t as h}from"./modal-USMHOKBI.js";import{n as g}from"./session-tick-D6kuntKS.js";import{Ar as _,Dr as v,In as y,Mr as b,Or as x,Tr as S,_r as C,gi as w,hi as T,jr as E,kr as D,m as O,mi as k}from"./index-
|
|
1
|
+
import{C as e,F as t,I as n,L as r,at as i,it as a}from"./updates-view-core-Qkm1ZY4B.js";import{g as o,h as s,s as c}from"./dom-helpers-DBbFg1c_.js";import{d as l}from"./control-ws-ByEqbpGM.js";import{i as u,s as d,t as f}from"./action-status-SSA4xM57.js";import{n as p,r as m,t as h}from"./modal-USMHOKBI.js";import{n as g}from"./session-tick-D6kuntKS.js";import{Ar as _,Dr as v,In as y,Mr as b,Or as x,Tr as S,_r as C,gi as w,hi as T,jr as E,kr as D,m as O,mi as k}from"./index-Bq8I2EvJ.js";import{t as ee}from"./repo-roots-adder-v6aAPuPt.js";import{t as te}from"./sandboxed-frame-D9MEfNuX.js";var ne=`<h2 class="dialog-title" id="add-session-title">Add Session</h2>
|
|
2
2
|
<fieldset class="dialog-mode-controls add-session-agent-only" aria-label="Session kind">
|
|
3
3
|
<button type="button" class="dialog-mode-button" id="add-session-single-mode" aria-pressed="true">Single repo</button>
|
|
4
4
|
<button type="button" class="dialog-mode-button" id="add-session-workspace-mode" aria-pressed="false">Workspace</button>
|
|
Binary file
|