dsh-claude-workbench 0.0.0-stage → 0.1.2

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/lib/client.js ADDED
@@ -0,0 +1,922 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "dsh-claude-workbench",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ const inject = [];
7
+ function panesUi(boot, ctx) {
8
+ try {
9
+ if (window.self !== window.top) return;
10
+ var protocol = location.protocol;
11
+ if (protocol !== "dsh-app:" && protocol !== "http:" && protocol !== "https:") return;
12
+ if (boot === undefined || boot === null || !Array.isArray(boot.injections)) return;
13
+ var context = ctx === undefined || ctx === null ? {} : ctx;
14
+
15
+ var scriptOpen = "<" + "script>";
16
+ var scriptClose = "<" + "/" + "script>";
17
+ var bootJson = JSON.stringify(boot).replace(/</g, "\\u003c");
18
+ var baseHref = document.baseURI;
19
+ var CURRENT_KEY = "dsh.sessions.current";
20
+
21
+ function absolute(element, attribute) {
22
+ try {
23
+ return new URL(element.getAttribute(attribute), document.baseURI).href;
24
+ } catch (error) {
25
+ return null;
26
+ }
27
+ }
28
+
29
+ var styles = Array.from(document.querySelectorAll('link[rel="stylesheet"][href]'))
30
+ .map(function (element) { return absolute(element, "href"); })
31
+ .filter(Boolean);
32
+ var preloads = Array.from(document.querySelectorAll('link[rel="modulepreload"][href]'))
33
+ .map(function (element) { return absolute(element, "href"); })
34
+ .filter(Boolean);
35
+ var modules = Array.from(document.querySelectorAll('script[type="module"][src]'))
36
+ .map(function (element) { return absolute(element, "src"); })
37
+ .filter(Boolean);
38
+
39
+ function frameDocumentHtml(extraSeed) {
40
+ return (
41
+ "<!doctype html><html><head><meta charset=\"utf-8\">" +
42
+ "<base href=\"" + baseHref + "\">" +
43
+ scriptOpen + "globalThis.__DSH_BOOT_READY__ = Promise.withResolvers()" + scriptClose +
44
+ (extraSeed === undefined ? "" : scriptOpen + extraSeed + scriptClose) +
45
+ styles.map(function (href) { return "<link rel=\"stylesheet\" href=\"" + href + "\">"; }).join("") +
46
+ "</head><body><div id=\"root\"></div>" +
47
+ scriptOpen +
48
+ "globalThis.__DSH_PANES_BOOT__ = " + bootJson + ";" +
49
+ "globalThis.dshDesktopBoot = {" +
50
+ " ready: function () { return Promise.resolve(globalThis.__DSH_PANES_BOOT__); }," +
51
+ " failed: function (error) { console.error('[dsh-panes]', error); }" +
52
+ "};" +
53
+ scriptClose +
54
+ preloads.map(function (href) { return "<link rel=\"modulepreload\" href=\"" + href + "\">"; }).join("") +
55
+ modules.map(function (href) {
56
+ return "<" + "script type=\"module\" src=\"" + href + "\">" + "<" + "/" + "script>";
57
+ }).join("") +
58
+ "</body></html>"
59
+ );
60
+ }
61
+
62
+ var documentHtml = frameDocumentHtml(undefined);
63
+
64
+ var STYLE_ID = "dsh-panes-style";
65
+ if (document.getElementById(STYLE_ID) !== null) return;
66
+ var style = document.createElement("style");
67
+ style.id = STYLE_ID;
68
+ style.textContent = [
69
+ '#dsh-panes-toggle{position:fixed;z-index:2147483001;right:14px;bottom:14px;display:flex;align-items:center;gap:6px;height:30px;padding:0 12px;border-radius:999px;border:1px solid var(--dsw-alias-border-l3,#0002);background:var(--dsw-alias-button-elevated-fill,#fff);color:var(--dsw-alias-label-secondary,#555);font:500 12px/1 var(--dsw-font-family,system-ui);cursor:pointer;box-shadow:0 2px 10px #00000014}',
70
+ '#dsh-panes-toggle:hover{background:var(--dsw-alias-interactive-bg-hover-solid,#f2efe7);color:var(--dsw-alias-label-primary,#111)}',
71
+ '#dsh-panes{position:fixed;inset:0;z-index:2147483000;display:none;flex-direction:column;background:var(--dsw-alias-bg-base,#f6f4ec);font-family:var(--dsw-font-family,system-ui)}',
72
+ '#dsh-panes[data-open="1"]{display:flex}',
73
+ '.dsh-panes-bar{flex:none;height:38px;display:flex;align-items:center;gap:10px;padding:0 14px;border-bottom:1px solid var(--dsw-alias-border-l2,#0001);color:var(--dsw-alias-label-tertiary,#666);font-size:12px}',
74
+ '.dsh-panes-bar .dsh-panes-title{font:600 13px/1 var(--dsw-font-family,system-ui);color:var(--dsw-alias-label-primary,#111)}',
75
+ '.dsh-panes-bar .spacer{flex:1}',
76
+ '.dsh-panes-bar button,.dsh-sidechat-bar button{height:24px;padding:0 10px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--dsw-alias-label-secondary,#555);font:500 12px/1 var(--dsw-font-family,system-ui);cursor:pointer}',
77
+ '.dsh-panes-bar button:hover,.dsh-sidechat-bar button:hover{background:var(--dsw-alias-interactive-bg-hover,#00000010)}',
78
+ '.dsh-panes-bar button[data-active="1"]{background:var(--dsw-alias-interactive-bg-hover-solid,#efece2);border-color:var(--dsw-alias-border-l3,#0002);color:var(--dsw-alias-label-primary,#111)}',
79
+ '.dsh-panes-row{flex:1;min-height:0;display:flex;gap:8px;padding:8px}',
80
+ '.dsh-panes-pane{flex:1;min-width:0;display:flex;border-radius:12px;overflow:hidden;background:var(--dsw-alias-bg-base,#fcfcfb);box-shadow:0 0 0 .5px var(--dsw-alias-border-l3,#0002),0 8px 24px #00000010}',
81
+ '.dsh-panes-pane iframe{flex:1;width:100%;height:100%;border:0;background:#fff}',
82
+ '#dsh-sidechat{position:fixed;top:0;right:0;bottom:0;z-index:2147483000;display:none;flex-direction:column;width:var(--dsh-sidechat-width,min(46vw,680px));background:var(--dsw-alias-bg-base,#fbfaf6);border-left:1px solid var(--dsw-alias-border-l2,#0001);box-shadow:-8px 0 24px #00000010;font-family:var(--dsw-font-family,system-ui)}',
83
+ '#dsh-sidechat[data-open="1"]{display:flex}',
84
+ '.dsh-sidechat-bar{flex:none;height:38px;display:flex;align-items:center;gap:8px;padding:0 12px;border-bottom:1px solid var(--dsw-alias-border-l2,#0001);color:var(--dsw-alias-label-tertiary,#666);font-size:12px}',
85
+ '.dsh-sidechat-bar .dsh-sidechat-title{font:600 13px/1 var(--dsw-font-family,system-ui);color:var(--dsw-alias-label-primary,#111)}',
86
+ '.dsh-sidechat-bar .dsh-sidechat-meta{font:11px/1 var(--dsw-font-family-code,monospace);color:var(--dsw-alias-label-caption,#999);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:140px}',
87
+ '.dsh-sidechat-bar .spacer{flex:1}',
88
+ '.dsh-sidechat-body{flex:1;min-height:0;position:relative}',
89
+ '.dsh-sidechat-body iframe{width:100%;height:100%;border:0;background:#fff}',
90
+ '.dsh-sidechat-grip{position:absolute;left:-3px;top:0;bottom:0;width:6px;cursor:col-resize;z-index:1}',
91
+ '.dsh-sidechat-toast{position:absolute;left:12px;right:12px;top:12px;padding:8px 10px;border-radius:8px;background:var(--dsw-alias-state-error-tertiary,#fdece9);color:var(--dsw-alias-state-error-primary,#b42318);font-size:12px;line-height:1.5;display:none;z-index:2}',
92
+ 'body[data-dsh-sidechat="1"]{--dsh-sidechat-width:min(46vw,680px)}',
93
+ 'body[data-dsh-sidechat="1"] #root{width:calc(100% - var(--dsh-sidechat-width))}',
94
+ '#dsh-panes-global-toast{position:fixed;z-index:2147483003;left:50%;bottom:56px;transform:translateX(-50%);display:none;max-width:min(560px,80vw);padding:9px 14px;border-radius:10px;background:var(--dsw-alias-toast-bg,#333);color:var(--dsw-alias-toast-label,#fff);font:500 12px/1.5 var(--dsw-font-family,system-ui);box-shadow:0 8px 24px #00000033}',
95
+ '#dsh-panes-global-toast[data-show="1"]{display:block}',
96
+ '#dsh-theme-toggle{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary,#555);cursor:pointer;flex:none}',
97
+ '#dsh-theme-toggle:hover{background:var(--dsw-alias-interactive-bg-hover,#00000012);color:var(--dsw-alias-label-primary,#111)}',
98
+ '#dsh-theme-toggle svg{width:15px;height:15px;pointer-events:none}',
99
+ '#dsh-theme-menu{position:fixed;z-index:2147483002;display:none;min-width:168px;padding:4px;border-radius:10px;background:var(--dsw-menu-surface-fill,#fff);border:.5px solid var(--dsw-alias-border-l3,#0002);box-shadow:0 8px 24px #00000022,0 2px 6px #00000012;backdrop-filter:blur(20px);font-family:var(--dsw-font-family,system-ui)}',
100
+ '#dsh-theme-menu[data-open="1"]{display:block}',
101
+ '#dsh-theme-menu button{display:flex;align-items:center;gap:8px;width:100%;height:30px;padding:0 9px;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-primary,#111);font:500 12px/1 var(--dsw-font-family,system-ui);cursor:pointer;text-align:left}',
102
+ '#dsh-theme-menu button:hover{background:var(--dsw-alias-interactive-bg-hover,#00000012)}',
103
+ '#dsh-theme-menu button svg{width:14px;height:14px;flex:none;color:var(--dsw-alias-label-secondary,#666)}',
104
+ '#dsh-theme-menu .dsh-theme-check{width:14px;height:14px;flex:none;margin-left:auto;color:var(--dsw-alias-state-business-primary,#c6613f);visibility:hidden}',
105
+ '#dsh-theme-menu button[data-active="1"] .dsh-theme-check{visibility:visible}',
106
+ '#dsh-theme-menu .dsh-theme-sep{height:1px;margin:4px 6px;background:var(--dsw-alias-border-l2,#0001)}',
107
+ '#dsh-sidechat-menu{position:fixed;z-index:2147483002;display:none;min-width:196px;padding:4px;border-radius:10px;background:var(--dsw-menu-surface-fill,#fff);border:.5px solid var(--dsw-alias-border-l3,#0002);box-shadow:0 8px 24px #00000022,0 2px 6px #00000012;backdrop-filter:blur(20px);font-family:var(--dsw-font-family,system-ui)}',
108
+ '#dsh-sidechat-menu button{display:flex;align-items:center;gap:8px;width:100%;height:30px;padding:0 9px;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-primary,#111);font:500 12px/1 var(--dsw-font-family,system-ui);cursor:pointer;text-align:left}',
109
+ '#dsh-sidechat-menu button:hover{background:var(--dsw-alias-interactive-bg-hover,#00000012)}',
110
+ '#dsh-sidechat-menu .dsh-ctx-icon{width:16px;text-align:center;color:var(--dsw-alias-label-tertiary,#888)}'
111
+ ].join("\n");
112
+ document.head.appendChild(style);
113
+ document.body.setAttribute("data-dsh-sidechat", "0");
114
+
115
+ // ---------------------------------------------------------------- panes
116
+ var overlay = document.createElement("div");
117
+ overlay.id = "dsh-panes";
118
+ overlay.innerHTML =
119
+ '<div class="dsh-panes-bar">' +
120
+ '<span class="dsh-panes-title">Split view</span>' +
121
+ "<span>并排会话 · 每个面板里可以独立打开 / 切换不同会话</span>" +
122
+ '<span class="spacer"></span>' +
123
+ '<button type="button" data-count="2">2 栏</button>' +
124
+ '<button type="button" data-count="3">3 栏</button>' +
125
+ '<button type="button" data-close="1">退出 Split view</button>' +
126
+ "</div>" +
127
+ '<div class="dsh-panes-row"></div>';
128
+ document.body.appendChild(overlay);
129
+ var row = overlay.querySelector(".dsh-panes-row");
130
+
131
+ var toggle = document.createElement("button");
132
+ toggle.id = "dsh-panes-toggle";
133
+ toggle.type = "button";
134
+ toggle.textContent = "◫ Split view";
135
+ toggle.title = "Split view:并排查看 2–3 个会话";
136
+ toggle.setAttribute("aria-label", "Split view(并排会话)");
137
+ toggle.addEventListener("click", function () { openPanes(2); });
138
+ document.body.appendChild(toggle);
139
+
140
+ function setRootVisible(visible) {
141
+ var root = document.getElementById("root");
142
+ if (root !== null) root.style.display = visible ? "" : "none";
143
+ }
144
+
145
+ function buildFrame() {
146
+ var pane = document.createElement("div");
147
+ pane.className = "dsh-panes-pane";
148
+ var frame = document.createElement("iframe");
149
+ frame.title = "Split view";
150
+ pane.appendChild(frame);
151
+ return { pane: pane, frame: frame };
152
+ }
153
+
154
+ function openPanes(count) {
155
+ if (sideOpen) closeSideChat();
156
+ var wanted = count === 3 ? 3 : 2;
157
+ var active = row.children.length === wanted && row.getAttribute("data-built") === String(wanted);
158
+ if (!active) {
159
+ row.textContent = "";
160
+ row.setAttribute("data-built", String(wanted));
161
+ for (var index = 0; index < wanted; index += 1) {
162
+ var built = buildFrame();
163
+ row.appendChild(built.pane);
164
+ try {
165
+ var frameDocument = built.frame.contentDocument;
166
+ if (frameDocument !== null) {
167
+ frameDocument.open();
168
+ frameDocument.write(documentHtml);
169
+ frameDocument.close();
170
+ }
171
+ } catch (error) {
172
+ console.error("[dsh-panes] pane boot failed", error);
173
+ }
174
+ }
175
+ }
176
+ Array.prototype.forEach.call(overlay.querySelectorAll("button[data-count]"), function (button) {
177
+ button.setAttribute("data-active", button.getAttribute("data-count") === String(wanted) ? "1" : "0");
178
+ });
179
+ overlay.setAttribute("data-open", "1");
180
+ toggle.style.display = "none";
181
+ setRootVisible(false);
182
+ }
183
+
184
+ function closePanes() {
185
+ overlay.setAttribute("data-open", "0");
186
+ row.textContent = "";
187
+ row.removeAttribute("data-built");
188
+ toggle.style.display = "";
189
+ setRootVisible(true);
190
+ }
191
+
192
+ overlay.addEventListener("click", function (event) {
193
+ var target = event.target;
194
+ if (!(target instanceof Element)) return;
195
+ var button = target.closest("button");
196
+ if (button === null) return;
197
+ if (button.hasAttribute("data-close")) { closePanes(); return; }
198
+ var count = Number(button.getAttribute("data-count"));
199
+ if (count === 2 || count === 3) openPanes(count);
200
+ });
201
+
202
+ // ------------------------------------------------------------- side chat
203
+ var sidePanel = document.createElement("div");
204
+ sidePanel.id = "dsh-sidechat";
205
+ sidePanel.innerHTML =
206
+ '<div class="dsh-sidechat-bar">' +
207
+ '<span class="dsh-sidechat-title">旁聊</span>' +
208
+ '<span class="dsh-sidechat-meta"></span>' +
209
+ '<span class="spacer"></span>' +
210
+ '<button type="button" data-promote="1" title="把这个旁聊会话放到主对话区">在主对话打开</button>' +
211
+ '<button type="button" data-side-close="1" title="关闭并归档这个旁聊会话">关闭</button>' +
212
+ "</div>" +
213
+ '<div class="dsh-sidechat-body"><div class="dsh-sidechat-toast"></div><div class="dsh-sidechat-grip"></div></div>';
214
+ document.body.appendChild(sidePanel);
215
+ var sideBody = sidePanel.querySelector(".dsh-sidechat-body");
216
+ var sideFrame = null;
217
+ var sideMeta = sidePanel.querySelector(".dsh-sidechat-meta");
218
+ var sideToast = sidePanel.querySelector(".dsh-sidechat-toast");
219
+ var sideGrip = sidePanel.querySelector(".dsh-sidechat-grip");
220
+
221
+ var globalToast = document.createElement("div");
222
+ globalToast.id = "dsh-panes-global-toast";
223
+ document.body.appendChild(globalToast);
224
+
225
+ var sideOpen = false;
226
+ var sideSessionId = null;
227
+ var sidePreviousSelection = null;
228
+ var sideBusy = false;
229
+
230
+ function showGlobalToast(message) {
231
+ globalToast.textContent = message;
232
+ globalToast.setAttribute("data-show", "1");
233
+ clearTimeout(showGlobalToast.timer);
234
+ showGlobalToast.timer = setTimeout(function () { globalToast.removeAttribute("data-show"); }, 6000);
235
+ }
236
+
237
+ function showSideToast(message) {
238
+ if (!sideOpen) { showGlobalToast(message); return; }
239
+ sideToast.textContent = message;
240
+ sideToast.style.display = "block";
241
+ clearTimeout(showSideToast.timer);
242
+ showSideToast.timer = setTimeout(function () { sideToast.style.display = "none"; }, 6000);
243
+ }
244
+
245
+ function getService(name) {
246
+ try {
247
+ return context.get === undefined ? undefined : context.get(name);
248
+ } catch (error) {
249
+ return undefined;
250
+ }
251
+ }
252
+
253
+ function currentSessionId() {
254
+ var sessions = getService("sessions");
255
+ if (sessions !== undefined && sessions.list !== undefined && sessions.list.getSnapshot !== undefined) {
256
+ try {
257
+ var list = sessions.list.getSnapshot();
258
+ var byId = (list && list.byId) || {};
259
+ var ids = Object.keys(byId);
260
+ for (var index = 0; index < ids.length; index += 1) {
261
+ var summary = byId[ids[index]];
262
+ var retained = summary && summary.retainedBy;
263
+ if (retained !== undefined && retained !== null && (retained.mainView || 0) > 0) {
264
+ return summary.id !== undefined ? summary.id : summary.sessionId;
265
+ }
266
+ }
267
+ } catch (error) {
268
+ console.error("[dsh-panes] read current session failed", error);
269
+ }
270
+ }
271
+ try {
272
+ var raw = localStorage.getItem(CURRENT_KEY);
273
+ if (raw !== null) {
274
+ var parsed = JSON.parse(raw);
275
+ if (parsed !== null && typeof parsed === "object" && typeof parsed.sessionId === "string") return parsed.sessionId;
276
+ }
277
+ } catch (error) {
278
+ /* ignore malformed persisted selection */
279
+ }
280
+ return null;
281
+ }
282
+
283
+ function rememberSelectionRestore(previous) {
284
+ sidePreviousSelection = previous;
285
+ }
286
+
287
+ function restoreSelection() {
288
+ var previous = sidePreviousSelection;
289
+ if (previous === undefined) return;
290
+ try {
291
+ if (previous === null) localStorage.removeItem(CURRENT_KEY);
292
+ else localStorage.setItem(CURRENT_KEY, previous);
293
+ } catch (error) {
294
+ /* ignore storage failures */
295
+ }
296
+ }
297
+
298
+ function restoreAfterBoot(frame, previous) {
299
+ var started = Date.now();
300
+ var timer = setInterval(function () {
301
+ var booted = false;
302
+ try {
303
+ var documentRoot = frame.contentDocument !== null ? frame.contentDocument.getElementById("root") : null;
304
+ booted = documentRoot !== null && documentRoot !== undefined && documentRoot.childElementCount > 0;
305
+ } catch (error) {
306
+ booted = true;
307
+ }
308
+ var expired = Date.now() - started > 15000;
309
+ if (!booted && !expired) return;
310
+ clearInterval(timer);
311
+ setTimeout(function () {
312
+ try {
313
+ if (previous === null) localStorage.removeItem(CURRENT_KEY);
314
+ else localStorage.setItem(CURRENT_KEY, previous);
315
+ } catch (error) {
316
+ /* ignore storage failures */
317
+ }
318
+ try {
319
+ var bootedDocument = frame.contentDocument;
320
+ var editor = bootedDocument === null ? null : bootedDocument.querySelector('[contenteditable="true"], textarea');
321
+ if (editor !== null) {
322
+ editor.focus();
323
+ if (bootedDocument.getSelection !== undefined && editor.isContentEditable) {
324
+ var caret = bootedDocument.createRange();
325
+ caret.selectNodeContents(editor);
326
+ caret.collapse(false);
327
+ var frameSelection = bootedDocument.getSelection();
328
+ frameSelection.removeAllRanges();
329
+ frameSelection.addRange(caret);
330
+ }
331
+ }
332
+ } catch (error) {
333
+ /* focus is best effort */
334
+ }
335
+ }, booted ? 900 : 0);
336
+ }, 250);
337
+ }
338
+
339
+ function quoteSelection(text) {
340
+ var lines = String(text).split(/\r?\n/);
341
+ return lines.map(function (line) { return line.length === 0 ? ">" : "> " + line; }).join("\n") + "\n\n";
342
+ }
343
+
344
+ function seedSideDraft(childId, text) {
345
+ try {
346
+ var key = "dsh.conversation." + childId;
347
+ var existing = null;
348
+ try { existing = JSON.parse(localStorage.getItem(key) || "null"); } catch (error) { existing = null; }
349
+ var state = existing !== null && typeof existing === "object" ? existing : { draft: { text: "", references: [] }, view: null, viewRequest: null };
350
+ state.draft = { text: quoteSelection(text), references: [] };
351
+ localStorage.setItem(key, JSON.stringify(state));
352
+ } catch (error) {
353
+ console.warn("[dsh-panes] seed side draft failed", error);
354
+ }
355
+ }
356
+
357
+ function writeSideFrame(previous) {
358
+ if (sideFrame === null) return;
359
+ try {
360
+ var frameDocument = sideFrame.contentDocument;
361
+ if (frameDocument === null) return;
362
+ frameDocument.open();
363
+ frameDocument.write(documentHtml);
364
+ frameDocument.close();
365
+ } catch (error) {
366
+ console.error("[dsh-panes] side chat boot failed", error);
367
+ showSideToast("旁聊加载失败:" + String(error));
368
+ }
369
+ restoreAfterBoot(sideFrame, previous);
370
+ }
371
+
372
+ async function openSideChat(options) {
373
+ var seed = options !== undefined && options !== null && typeof options.seed === "string" ? options.seed : "";
374
+ if (sideOpen) { closeSideChat(); return; }
375
+ if (sideBusy) return;
376
+ if (overlay.getAttribute("data-open") === "1") closePanes();
377
+ var uiWorkspace = getService("uiWorkspace");
378
+ var sourceId = currentSessionId();
379
+ if (uiWorkspace === undefined || typeof uiWorkspace.forkSession !== "function") {
380
+ showGlobalToast("旁聊暂不可用:客户端 workspace 服务未就绪。");
381
+ return;
382
+ }
383
+ if (sourceId === null) {
384
+ showGlobalToast("旁聊需要一个已打开的会话。");
385
+ return;
386
+ }
387
+ sideBusy = true;
388
+ try {
389
+ var childId = await uiWorkspace.forkSession(sourceId);
390
+ if (typeof childId !== "string" || childId === "") {
391
+ throw new Error("fork 没有返回会话 id");
392
+ }
393
+ var previous = null;
394
+ try { previous = localStorage.getItem(CURRENT_KEY); } catch (error) { previous = null; }
395
+ try { localStorage.setItem(CURRENT_KEY, JSON.stringify({ sessionId: childId })); } catch (error) { /* ignore */ }
396
+ rememberSelectionRestore(previous);
397
+ if (seed.trim().length > 0) seedSideDraft(childId, seed.slice(0, 8000));
398
+ sideSessionId = childId;
399
+ sideMeta.textContent = childId.replace(/^session-/, "").slice(0, 12);
400
+ sideOpen = true;
401
+ sidePanel.setAttribute("data-open", "1");
402
+ document.body.setAttribute("data-dsh-sidechat", "1");
403
+ toggle.style.display = "none";
404
+ if (sideFrame !== null) sideFrame.remove();
405
+ sideFrame = document.createElement("iframe");
406
+ sideFrame.title = "旁聊";
407
+ sideBody.appendChild(sideFrame);
408
+ writeSideFrame(previous);
409
+ } catch (error) {
410
+ var message = String(error && error.message ? error.message : error);
411
+ var friendly = message.indexOf("fork-unavailable") >= 0 ? "当前会话还没有已完成的轮次(或正在运行),旁聊需要从已完成的对话分叉。" : message;
412
+ showGlobalToast("旁聊创建失败:" + friendly);
413
+ console.error("[dsh-panes] side chat fork failed", error);
414
+ } finally {
415
+ sideBusy = false;
416
+ }
417
+ }
418
+
419
+ function closeSideChat(keepSession) {
420
+ if (!sideOpen) return;
421
+ var archivedId = keepSession === true ? null : sideSessionId;
422
+ if (archivedId !== null) {
423
+ var workspaceService = getService("uiWorkspace");
424
+ if (workspaceService !== undefined && typeof workspaceService.archiveSession === "function") {
425
+ Promise.resolve(workspaceService.archiveSession(archivedId)).catch(function (error) {
426
+ console.warn("[dsh-panes] side chat archive failed", error);
427
+ });
428
+ }
429
+ }
430
+ sideOpen = false;
431
+ sideSessionId = null;
432
+ sidePanel.setAttribute("data-open", "0");
433
+ document.body.setAttribute("data-dsh-sidechat", "0");
434
+ if (sideFrame !== null) {
435
+ sideFrame.remove();
436
+ sideFrame = null;
437
+ }
438
+ restoreSelection();
439
+ var panesOpen = overlay.getAttribute("data-open") === "1";
440
+ toggle.style.display = panesOpen ? "none" : "";
441
+ }
442
+
443
+ sidePanel.addEventListener("click", function (event) {
444
+ var target = event.target;
445
+ if (!(target instanceof Element)) return;
446
+ var button = target.closest("button");
447
+ if (button === null) return;
448
+ if (button.hasAttribute("data-side-close")) { closeSideChat(); return; }
449
+ if (button.hasAttribute("data-promote") && sideSessionId !== null) {
450
+ var uiWorkspace = getService("uiWorkspace");
451
+ if (uiWorkspace !== undefined && typeof uiWorkspace.openSession === "function") {
452
+ uiWorkspace.openSession(sideSessionId);
453
+ closeSideChat(true);
454
+ }
455
+ }
456
+ });
457
+
458
+ // ------------------------------------------- selection → "在旁聊中提问"
459
+ var selectionMenu = document.createElement("div");
460
+ selectionMenu.id = "dsh-sidechat-menu";
461
+ selectionMenu.innerHTML =
462
+ '<button type="button" data-act="sidechat"><span class="dsh-ctx-icon">◧</span><span>在旁聊中提问</span></button>' +
463
+ '<button type="button" data-act="copy"><span class="dsh-ctx-icon">⧉</span><span>复制</span></button>';
464
+ document.body.appendChild(selectionMenu);
465
+ var pendingSelection = "";
466
+
467
+ function hideSelectionMenu() {
468
+ selectionMenu.style.display = "none";
469
+ pendingSelection = "";
470
+ }
471
+
472
+ function showSelectionMenu(x, y) {
473
+ selectionMenu.style.display = "block";
474
+ var rect = selectionMenu.getBoundingClientRect();
475
+ var left = Math.max(8, Math.min(x, window.innerWidth - rect.width - 8));
476
+ var top = Math.max(8, Math.min(y, window.innerHeight - rect.height - 8));
477
+ selectionMenu.style.left = left + "px";
478
+ selectionMenu.style.top = top + "px";
479
+ }
480
+
481
+ function insideConversation(node) {
482
+ var element = node instanceof Element ? node : node !== null && node !== undefined && node.parentElement ? node.parentElement : null;
483
+ return element !== null && element.closest('[data-conversation-scroll]') !== null;
484
+ }
485
+
486
+ document.addEventListener("contextmenu", function (event) {
487
+ try {
488
+ var target = event.target;
489
+ if (target instanceof Element && target.closest("#dsh-sidechat, #dsh-panes, #dsh-sidechat-menu") !== null) return;
490
+ var selection = window.getSelection();
491
+ var text = selection === null ? "" : selection.toString().trim();
492
+ if (text.length === 0 && selection !== null && selection.rangeCount > 0) {
493
+ try { text = selection.getRangeAt(0).toString().trim(); } catch (error) { text = ""; }
494
+ }
495
+ if (text.length === 0) return;
496
+ if (!insideConversation(target)) return;
497
+ pendingSelection = text.slice(0, 8000);
498
+ event.preventDefault();
499
+ showSelectionMenu(event.clientX, event.clientY);
500
+ } catch (error) {
501
+ console.error("[dsh-panes] selection menu failed", error);
502
+ }
503
+ }, true);
504
+
505
+ document.addEventListener("mousedown", function (event) {
506
+ if (selectionMenu.style.display !== "block") return;
507
+ var target = event.target;
508
+ if (target instanceof Element && target.closest("#dsh-sidechat-menu") !== null) return;
509
+ hideSelectionMenu();
510
+ }, true);
511
+ document.addEventListener("keydown", function (event) {
512
+ if (event.key === "Escape") hideSelectionMenu();
513
+ }, true);
514
+ window.addEventListener("scroll", hideSelectionMenu, true);
515
+ window.addEventListener("blur", hideSelectionMenu);
516
+
517
+ selectionMenu.addEventListener("click", function (event) {
518
+ var target = event.target;
519
+ if (!(target instanceof Element)) return;
520
+ var button = target.closest("button");
521
+ if (button === null) return;
522
+ var action = button.getAttribute("data-act");
523
+ var text = pendingSelection;
524
+ hideSelectionMenu();
525
+ if (action === "copy") {
526
+ try {
527
+ if (navigator.clipboard !== undefined) navigator.clipboard.writeText(text).catch(function () {});
528
+ } catch (error) {
529
+ /* clipboard unavailable */
530
+ }
531
+ return;
532
+ }
533
+ if (action === "sidechat") openSideChat({ seed: text });
534
+ });
535
+
536
+ var dragState = null;
537
+ sideGrip.addEventListener("pointerdown", function (event) {
538
+ dragState = { startX: event.clientX, startWidth: sidePanel.getBoundingClientRect().width };
539
+ try { sideGrip.setPointerCapture(event.pointerId); } catch (error) { /* ignore */ }
540
+ });
541
+ sideGrip.addEventListener("pointermove", function (event) {
542
+ if (dragState === null) return;
543
+ var width = Math.min(Math.max(dragState.startWidth + (dragState.startX - event.clientX), 360), Math.round(window.innerWidth * 0.7));
544
+ document.body.style.setProperty("--dsh-sidechat-width", width + "px");
545
+ });
546
+ sideGrip.addEventListener("pointerup", function () { dragState = null; });
547
+ sideGrip.addEventListener("pointercancel", function () { dragState = null; });
548
+ // ------------------------------------- top-right light/dark quick switch
549
+ var THEME_ICONS = {
550
+ system:
551
+ '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"><rect x="1.6" y="2.6" width="12.8" height="8.4" rx="1.4"/><path d="M5.4 13.4h5.2M8 11v2.4"/></svg>',
552
+ light:
553
+ '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"><circle cx="8" cy="8" r="3.1"/><path d="M8 1.2v1.7M8 13.1v1.7M1.2 8h1.7M13.1 8h1.7M3.2 3.2l1.2 1.2M11.6 11.6l1.2 1.2M12.8 3.2l-1.2 1.2M4.4 11.6l-1.2 1.2"/></svg>',
554
+ dark:
555
+ '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"><path d="M13.4 9.6A5.9 5.9 0 0 1 6.4 2.6 6 6 0 1 0 13.4 9.6Z"/></svg>'
556
+ };
557
+
558
+ var SOUND_ICON =
559
+ '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 11V7a4 4 0 0 1 8 0v4l1.2 1.6H2.8L4 11Z"/><path d="M6.2 13.2a1.9 1.9 0 0 0 3.6 0"/></svg>';
560
+
561
+ var themeButton = document.createElement("button");
562
+ themeButton.id = "dsh-theme-toggle";
563
+ themeButton.type = "button";
564
+ themeButton.title = "切换外观:跟随系统 / 浅色 / 深色";
565
+ themeButton.setAttribute("aria-label", "切换外观");
566
+ themeButton.innerHTML = THEME_ICONS.system;
567
+
568
+ var themeMenu = document.createElement("div");
569
+ themeMenu.id = "dsh-theme-menu";
570
+ themeMenu.innerHTML =
571
+ '<button type="button" data-pref="system"><span class="dsh-theme-icon"></span><span>跟随系统</span><span class="dsh-theme-check">✓</span></button>' +
572
+ '<button type="button" data-pref="light"><span class="dsh-theme-icon"></span><span>浅色</span><span class="dsh-theme-check">✓</span></button>' +
573
+ '<button type="button" data-pref="dark"><span class="dsh-theme-icon"></span><span>深色</span><span class="dsh-theme-check">✓</span></button>' +
574
+ '<div class="dsh-theme-sep"></div>' +
575
+ '<button type="button" data-sound="1"><span class="dsh-theme-icon">' + SOUND_ICON + '</span><span>完成提示音</span><span class="dsh-theme-check">✓</span></button>';
576
+ document.body.appendChild(themeMenu);
577
+ var themeMenuItems = Array.prototype.slice.call(themeMenu.querySelectorAll("button[data-pref]"));
578
+ themeMenuItems.forEach(function (button) {
579
+ var icon = button.querySelector(".dsh-theme-icon");
580
+ if (icon !== null) icon.innerHTML = THEME_ICONS[button.getAttribute("data-pref")] || "";
581
+ });
582
+
583
+ // ------------------------------------------ completion sound (turn finished)
584
+ var CHIME_KEY = "dsh-workbench.completion-sound";
585
+ var chimeEnabled = true;
586
+ try { if (localStorage.getItem(CHIME_KEY) === "0") chimeEnabled = false; } catch (error) { /* ignore */ }
587
+ var chimeLog = [];
588
+ var chimeAttachAttempts = 0;
589
+ var chimeUnsubscribe = null;
590
+ var chimeAudioContext = null;
591
+ var chimeLastPlayedAt = 0;
592
+ var chimePreviousRunning = new Map();
593
+ var soundButton = themeMenu.querySelector("button[data-sound]");
594
+
595
+ function ensureChimeAudio() {
596
+ try {
597
+ var AudioCtor = window.AudioContext || window.webkitAudioContext;
598
+ if (AudioCtor === undefined) return null;
599
+ if (chimeAudioContext === null) chimeAudioContext = new AudioCtor();
600
+ if (chimeAudioContext.state === "suspended" && typeof chimeAudioContext.resume === "function") {
601
+ chimeAudioContext.resume().catch(function () { /* waits for the next user gesture */ });
602
+ }
603
+ return chimeAudioContext;
604
+ } catch (error) {
605
+ return null;
606
+ }
607
+ }
608
+
609
+ function playCompletionChime() {
610
+ chimeLog.push(Date.now());
611
+ if (chimeLog.length > 50) chimeLog.shift();
612
+ if (!chimeEnabled) return;
613
+ var audio = ensureChimeAudio();
614
+ if (audio === null) return;
615
+ try {
616
+ var start = audio.currentTime + 0.01;
617
+ function tone(frequency, offset, duration, peak, type) {
618
+ var oscillator = audio.createOscillator();
619
+ var gain = audio.createGain();
620
+ oscillator.type = type === undefined ? "sine" : type;
621
+ oscillator.frequency.value = frequency;
622
+ gain.gain.setValueAtTime(0.0001, start + offset);
623
+ gain.gain.exponentialRampToValueAtTime(peak, start + offset + 0.006);
624
+ gain.gain.exponentialRampToValueAtTime(0.0001, start + offset + duration);
625
+ oscillator.connect(gain);
626
+ gain.connect(audio.destination);
627
+ oscillator.start(start + offset);
628
+ oscillator.stop(start + offset + duration + 0.03);
629
+ }
630
+ tone(1046.5, 0, 0.34, 0.13, "sine");
631
+ tone(1567.98, 0.07, 0.3, 0.09, "sine");
632
+ tone(3135.96, 0.07, 0.14, 0.02, "sine");
633
+ } catch (error) {
634
+ /* audio is best effort */
635
+ }
636
+ }
637
+
638
+ function triggerCompletionChime() {
639
+ var now = Date.now();
640
+ if (now - chimeLastPlayedAt < 750) return;
641
+ chimeLastPlayedAt = now;
642
+ playCompletionChime();
643
+ }
644
+
645
+ function isSubagentChimeSession(sessionId) {
646
+ try {
647
+ var sessions = getService("sessions");
648
+ if (sessions === undefined || sessions.list === undefined || sessions.list.getSnapshot === undefined) return false;
649
+ var row = (sessions.list.getSnapshot().byId || {})[sessionId];
650
+ return row !== undefined && row !== null && row.subagent !== undefined && row.subagent !== null;
651
+ } catch (error) {
652
+ return false;
653
+ }
654
+ }
655
+
656
+ function onSessionRunningChanged(sessionId, running) {
657
+ var value = chimePreviousRunning.get(sessionId) === true;
658
+ chimePreviousRunning.set(sessionId, running);
659
+ if (!value || running) return;
660
+ if (isSubagentChimeSession(sessionId)) return;
661
+ triggerCompletionChime();
662
+ }
663
+
664
+ function installCompletionChime() {
665
+ var uiSession = getService("uiSession");
666
+ var status = uiSession === undefined || uiSession === null ? undefined : uiSession.sessionStatus;
667
+ if (status === undefined || status === null || typeof status.subscribe !== "function") {
668
+ chimeAttachAttempts += 1;
669
+ if (chimeAttachAttempts < 100) setTimeout(installCompletionChime, 300);
670
+ return;
671
+ }
672
+ try {
673
+ var initial = status.getSnapshot();
674
+ initial.forEach(function (value, id) {
675
+ chimePreviousRunning.set(id, value !== undefined && value !== null && value.running === true);
676
+ });
677
+ chimeUnsubscribe = status.subscribe(function (snapshot) {
678
+ try {
679
+ snapshot.forEach(function (value, id) {
680
+ onSessionRunningChanged(id, value !== undefined && value !== null && value.running === true);
681
+ });
682
+ } catch (error) {
683
+ /* ignore */
684
+ }
685
+ });
686
+ } catch (error) {
687
+ console.error("[claude-workbench] completion sound subscription failed", error);
688
+ }
689
+ }
690
+
691
+ function toggleCompletionSound() {
692
+ chimeEnabled = !chimeEnabled;
693
+ try { localStorage.setItem(CHIME_KEY, chimeEnabled ? "1" : "0"); } catch (error) { /* ignore */ }
694
+ if (chimeEnabled) {
695
+ ensureChimeAudio();
696
+ if (soundButton !== null) soundButton.setAttribute("data-active", "1");
697
+ playCompletionChime();
698
+ }
699
+ refreshThemeButton();
700
+ }
701
+
702
+ function unlockChimeAudio() {
703
+ ensureChimeAudio();
704
+ }
705
+
706
+ document.addEventListener("pointerdown", unlockChimeAudio, true);
707
+ document.addEventListener("keydown", unlockChimeAudio, true);
708
+ installCompletionChime();
709
+
710
+ function themeService() {
711
+ return getService("theme");
712
+ }
713
+
714
+ function currentThemePreference() {
715
+ var service = themeService();
716
+ try {
717
+ if (service !== undefined && typeof service.getTheme === "function") {
718
+ var snapshot = service.getTheme();
719
+ if (snapshot !== null && snapshot !== undefined && typeof snapshot.preference === "string") return snapshot.preference;
720
+ }
721
+ } catch (error) {
722
+ /* fall through */
723
+ }
724
+ return "system";
725
+ }
726
+
727
+ function effectiveScheme() {
728
+ return document.body.hasAttribute("data-ds-dark-theme") ? "dark" : "light";
729
+ }
730
+
731
+ function refreshThemeButton() {
732
+ var preference = currentThemePreference();
733
+ var iconKey = preference === "light" || preference === "dark" ? preference : "system";
734
+ themeButton.innerHTML = THEME_ICONS[iconKey];
735
+ themeButton.setAttribute("data-preference", preference);
736
+ themeButton.title = "当前:" + (preference === "system" ? "跟随系统(" + (effectiveScheme() === "dark" ? "深色" : "浅色") + ")" : preference === "dark" ? "深色" : "浅色") + " · 点击切换";
737
+ themeMenuItems.forEach(function (button) {
738
+ button.setAttribute("data-active", button.getAttribute("data-pref") === preference ? "1" : "0");
739
+ });
740
+ if (soundButton !== null) {
741
+ soundButton.setAttribute("data-active", chimeEnabled ? "1" : "0");
742
+ soundButton.title = chimeEnabled ? "完成提示音:开(点击关闭)" : "完成提示音:关(点击开启)";
743
+ }
744
+ }
745
+
746
+ function closeThemeMenu() {
747
+ themeMenu.removeAttribute("data-open");
748
+ }
749
+
750
+ function openThemeMenu() {
751
+ refreshThemeButton();
752
+ var rect = themeButton.getBoundingClientRect();
753
+ themeMenu.setAttribute("data-open", "1");
754
+ var menuRect = themeMenu.getBoundingClientRect();
755
+ var left = Math.min(Math.max(rect.right - menuRect.width, 8), window.innerWidth - menuRect.width - 8);
756
+ var top = Math.min(rect.bottom + 6, window.innerHeight - menuRect.height - 8);
757
+ themeMenu.style.left = left + "px";
758
+ themeMenu.style.top = top + "px";
759
+ }
760
+
761
+ themeButton.addEventListener("click", function (event) {
762
+ event.preventDefault();
763
+ event.stopPropagation();
764
+ if (themeMenu.getAttribute("data-open") === "1") closeThemeMenu();
765
+ else openThemeMenu();
766
+ });
767
+
768
+ themeMenu.addEventListener("click", function (event) {
769
+ var target = event.target;
770
+ if (!(target instanceof Element)) return;
771
+ if (target.closest("button[data-sound]") !== null) {
772
+ toggleCompletionSound();
773
+ return;
774
+ }
775
+ var button = target.closest("button[data-pref]");
776
+ if (button === null) return;
777
+ var preference = button.getAttribute("data-pref");
778
+ var service = themeService();
779
+ closeThemeMenu();
780
+ if (service === undefined || typeof service.setTheme !== "function") {
781
+ showGlobalToast("外观切换暂不可用:主题服务未就绪。");
782
+ return;
783
+ }
784
+ try {
785
+ service.setTheme(preference);
786
+ } catch (error) {
787
+ showGlobalToast("外观切换失败:" + String(error && error.message ? error.message : error));
788
+ return;
789
+ }
790
+ refreshThemeButton();
791
+ });
792
+
793
+ document.addEventListener("mousedown", function (event) {
794
+ if (themeMenu.getAttribute("data-open") !== "1") return;
795
+ var target = event.target;
796
+ if (target instanceof Element && (target.closest("#dsh-theme-menu") !== null || target.closest("#dsh-theme-toggle") !== null)) return;
797
+ closeThemeMenu();
798
+ }, true);
799
+ document.addEventListener("keydown", function (event) {
800
+ if (event.key === "Escape") closeThemeMenu();
801
+ }, true);
802
+ window.addEventListener("scroll", closeThemeMenu, true);
803
+ window.addEventListener("resize", closeThemeMenu);
804
+
805
+ function mountThemeButton() {
806
+ var host = document.querySelector("[data-conversation-header-corner]");
807
+ if (host === null) {
808
+ if (themeButton.parentElement !== null) themeButton.remove();
809
+ return;
810
+ }
811
+ if (themeButton.parentElement !== host) host.insertBefore(themeButton, host.firstChild);
812
+ }
813
+
814
+ var themeMountTimer = setInterval(function () {
815
+ try { mountThemeButton(); } catch (error) { /* ignore */ }
816
+ }, 800);
817
+ try { mountThemeButton(); } catch (error) { /* ignore */ }
818
+ try { refreshThemeButton(); } catch (error) { /* ignore */ }
819
+
820
+ try {
821
+ if (typeof context.on === "function") {
822
+ context.on("theme/change", function () {
823
+ try { refreshThemeButton(); } catch (error) { /* ignore */ }
824
+ });
825
+ }
826
+ } catch (error) {
827
+ /* theme change subscription is best effort */
828
+ }
829
+
830
+ try {
831
+ globalThis.__dshPanesTeardown = function () {
832
+ try { clearInterval(themeMountTimer); } catch (error) { /* ignore */ }
833
+ try { if (typeof chimeUnsubscribe === "function") chimeUnsubscribe(); } catch (error) { /* ignore */ }
834
+ chimeUnsubscribe = null;
835
+ document.removeEventListener("pointerdown", unlockChimeAudio, true);
836
+ document.removeEventListener("keydown", unlockChimeAudio, true);
837
+ try { if (chimeAudioContext !== null && typeof chimeAudioContext.close === "function") chimeAudioContext.close(); } catch (error) { /* ignore */ }
838
+ chimeAudioContext = null;
839
+ closeThemeMenu();
840
+ if (themeButton.parentElement !== null) themeButton.remove();
841
+ themeMenu.remove();
842
+ globalToast.remove();
843
+ };
844
+ } catch (error) {
845
+ /* teardown hook is optional */
846
+ }
847
+
848
+ try {
849
+ globalThis.__dshPanes = {
850
+ listSessions: function () {
851
+ var sessions = getService("sessions");
852
+ var list = sessions !== undefined && sessions.list !== undefined ? sessions.list.getSnapshot() : null;
853
+ var byId = (list && list.byId) || {};
854
+ return Object.keys(byId).map(function (id) {
855
+ var row = byId[id] || {};
856
+ return { id: id, title: row.title === undefined ? null : row.title, mainView: ((row.retainedBy || {}).mainView || 0) > 0 };
857
+ });
858
+ },
859
+ archivedIds: function () {
860
+ var workspaces = getService("workspaces");
861
+ try {
862
+ return workspaces.list.getSnapshot().archivedSessionIds || [];
863
+ } catch (error) {
864
+ return [];
865
+ }
866
+ },
867
+ archiveSession: function (id) {
868
+ var workspaceService = getService("uiWorkspace");
869
+ return workspaceService.archiveSession(id);
870
+ },
871
+ playChime: playCompletionChime,
872
+ chimeInfo: function () {
873
+ return {
874
+ enabled: chimeEnabled,
875
+ attached: typeof chimeUnsubscribe === "function",
876
+ log: chimeLog.slice()
877
+ };
878
+ },
879
+ toggleChime: toggleCompletionSound
880
+ };
881
+ } catch (error) {
882
+ /* debug hook is optional */
883
+ }
884
+ } catch (error) {
885
+ console.error("[dsh-panes] initialization failed", error);
886
+ }
887
+ }
888
+
889
+ let started = false;
890
+ async function start(ctx) {
891
+ if (started) return;
892
+ started = true;
893
+ if (window.self !== window.top) return;
894
+ try {
895
+ const response = await fetch("/dsh-claude-workbench/boot", { credentials: "include", cache: "no-store" });
896
+ if (!response.ok) throw new Error("boot payload HTTP " + response.status);
897
+ panesUi(await response.json(), ctx);
898
+ } catch (error) {
899
+ console.error("[claude-workbench]", error);
900
+ }
901
+ }
902
+
903
+ function apply(ctx) {
904
+ start(ctx);
905
+ if (typeof ctx.effect === "function") {
906
+ ctx.effect(() => () => {
907
+ try { globalThis.__dshPanesTeardown?.(); } catch (error) { /* ignore */ }
908
+ for (const id of ["dsh-panes", "dsh-panes-toggle", "dsh-panes-style", "dsh-theme-toggle", "dsh-theme-menu"]) {
909
+ const node = document.getElementById(id);
910
+ if (node !== null) node.remove();
911
+ }
912
+ const root = document.getElementById("root");
913
+ if (root !== null) root.style.removeProperty("display");
914
+ });
915
+ }
916
+ }
917
+
918
+ exports.apply = apply;
919
+ exports.inject = inject;
920
+ return module.exports;
921
+ }
922
+ });