(() => {
// src/core/protocol.js
var PROTOCOL_VERSION = 1;
var FIELD = "debugOverlay";
var LEGACY_FIELD = "dbgov";
var STATE = {
on: null,
// (bool)
tools: null,
// (roster: [{id, icon, title, fam, roles}], coreVersion) — on hello
tool: null,
// (id, armed)
count: null,
// (n)
swept: null,
// (showing, n)
removeMode: null,
// (bool)
update: null,
// (version) — a KNOWN newer version exists
checked: null,
// (version|null) — a forced check's answer, null = current
page: null,
// (origin) — whose page this connection speaks for
webPanel: null,
// (visible) — is the on-page bar showing alongside us
flash: null,
// (msg, sel)
badgeControls: (groups) => [groups.map(packBadgeGroup)],
rows: (view, rows, empty) => [view, rows.map(packRow), empty],
events: null,
// (toolId, events[], isBacklog) — timeline entries, plain data;
// a backlog REPLACES that tool's entries for this page visit
docked: null,
// (bool) — a side panel is driving, so the bar
// dropped the controls this panel already carries
driver: null,
// ({live, busy, cmd, n, recent}) — an AI session
// driving this page, and what it is doing now
bye: null
// the page is unloading — expect a reconnect
};
var CMD = {
toggle: null,
// power
tool: null,
// (id) arm/disarm
sweep: null,
copy: null,
clear: null,
badgeControl: null,
// (key)
updateCheck: null,
// (force)
updateApply: null,
webPanel: null,
// (visible) — show/hide the on-page bar
openView: null,
// (view) — compute and push that view's rows
rowActivate: null,
// (view, i)
rowRemove: null,
// (view, i)
rowChange: null,
// (view, i, raw)
hello: null
// a side panel connected — push everything
};
function packRow(row) {
const out = {};
for (const k of [
"title",
"heading",
"detail",
"tag",
"label",
"accent",
"inert",
"removable",
"rmTitle",
"activatable",
"control"
]) {
if (row[k] !== void 0) out[k] = row[k];
}
if (row.pins) out.pinCount = row.pins.length;
return out;
}
function packBadgeGroup(g) {
return {
key: g.key,
glyph: g.glyph,
title: g.title,
rows: (g.rows || []).map((r) => ({
key: r.key,
glyph: r.glyph,
title: r.title,
label: r.label,
armed: !!r.armed,
fixed: !!r.fixed
}))
};
}
function envelope(kind, table, name, args) {
if (!(name in table)) throw new Error(`unknown ${kind}: ${name}`);
const pack = table[name];
return {
[FIELD]: PROTOCOL_VERSION,
kind,
name,
args: pack ? pack(...args) : args
};
}
var Protocol = {
/** Build a state-push message. */
state: (name, ...args) => envelope("state", STATE, name, args),
/** Build a command message. */
cmd: (name, ...args) => envelope("cmd", CMD, name, args),
/**
* Read a message from the wire. Returns { kind, name, args } for a
* valid message of OUR protocol, and null for everything else —
* the extension's worker traffic (debug-overlay-fetch and friends)
* and any other extension's noise pass through untouched.
*/
read(msg) {
if (!msg || msg[FIELD] !== PROTOCOL_VERSION) return null;
const table = msg.kind === "state" ? STATE : msg.kind === "cmd" ? CMD : null;
if (!table || !(msg.name in table) || !Array.isArray(msg.args)) return null;
return { kind: msg.kind, name: msg.name, args: msg.args };
},
/** A different-version message of ours — worth telling the user
* "refresh this page" instead of silently ignoring. */
stale: (msg) => !!msg && (LEGACY_FIELD in msg || typeof msg[FIELD] === "number" && msg[FIELD] !== PROTOCOL_VERSION)
};
// browser-extension-source/side-panel/side-panel.js
var VERSION = "3.8.202";
var $ = (s) => document.querySelector(s);
var body = document.body;
var IC = {
power: '',
sweep: '',
copy: '',
clear: '',
pin: '',
gear: '',
webPanel: '',
refresh: ''
};
var isSvg = (s) => /^