@michengai/dsh-im-connect 0.1.77 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/CHANGELOG.zh-CN.md +12 -0
- package/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/client.js +692 -107
- package/lib/client.js +724 -340
- package/lib/engine/file-delivery.js +1 -1
- package/lib/engine/file-delivery.js.map +1 -1
- package/lib/plugin-updater.d.ts +3 -0
- package/lib/plugin-updater.d.ts.map +1 -1
- package/lib/plugin-updater.js +188 -3
- package/lib/plugin-updater.js.map +1 -1
- package/package.json +16 -16
- package/src/engine/file-delivery.ts +1 -1
- package/src/plugin-update-ui.js +32 -13
- package/src/plugin-updater.ts +162 -3
package/client.js
CHANGED
|
@@ -9,10 +9,12 @@ window.__ModuleLoader__.load({
|
|
|
9
9
|
const React = require("react");
|
|
10
10
|
const { useState, useEffect, useLayoutEffect, useCallback, useRef, useSyncExternalStore } = React;
|
|
11
11
|
const ReactDOM = require("react-dom");
|
|
12
|
-
const primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
12
|
+
const primitives = typeof require === "function" ? (function () { try { return require("@deepseek-ai/dsh-client-ui-primitives"); } catch { return {}; } })() : {};
|
|
13
|
+
const PrimitiveButton = primitives.Button;
|
|
14
|
+
const HostMenu = primitives.Menu;
|
|
15
|
+
const HostModal = primitives.Modal;
|
|
16
|
+
// 只关最上层。下层监听先注册,不是顶层就放行,避免一次 Escape 关掉弹窗和宿主设置。
|
|
17
|
+
const modalLayers = [];
|
|
16
18
|
// 0.1.7 把尺寸从图标名里拿掉了(IconEditOutlineRegular)。旧宿主仍导出 *16/*20。
|
|
17
19
|
function pickHostIcon(...names) {
|
|
18
20
|
for (const name of names) {
|
|
@@ -63,15 +65,398 @@ window.__ModuleLoader__.load({
|
|
|
63
65
|
const IconFolderClose = pickHostIcon("IconFolderCloseRegular", "IconFolderClose16", "IconFolderClose");
|
|
64
66
|
const IconClockOutline = pickHostIcon("IconClockOutlineRegular", "IconClockOutline16");
|
|
65
67
|
const IconFlatListOutline = pickHostIcon("IconFlatListOutlineRegular");
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
function alertIcon(type) {
|
|
69
|
+
if (type === "success") {
|
|
70
|
+
return React.createElement("svg", { viewBox: "0 0 16 16", width: 14, height: 14, fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round" },
|
|
71
|
+
React.createElement("path", { d: "m3 8.5 3.5 3.5 6.5-7" })
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
if (type === "error") {
|
|
75
|
+
return React.createElement("svg", { viewBox: "0 0 16 16", width: 14, height: 14, fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round" },
|
|
76
|
+
React.createElement("circle", { cx: 8, cy: 8, r: 6 }),
|
|
77
|
+
React.createElement("path", { d: "m8 5v3.5M8 11.5h.01" })
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return React.createElement("svg", { viewBox: "0 0 16 16", width: 14, height: 14, fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round" },
|
|
81
|
+
React.createElement("circle", { cx: 8, cy: 8, r: 6 }),
|
|
82
|
+
React.createElement("path", { d: "M8 7.5v3.5M8 5h.01" })
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
function Alert({ type = "info", message, className, role, showIcon }) {
|
|
86
|
+
return React.createElement("div", {
|
|
87
|
+
role: role || (type === "error" ? "alert" : undefined),
|
|
88
|
+
className: ["ima-alert", "ima-alert-" + type, className].filter(Boolean).join(" "),
|
|
89
|
+
},
|
|
90
|
+
showIcon && React.createElement("span", { className: "ima-alert-icon" }, alertIcon(type)),
|
|
91
|
+
React.createElement("span", { className: "ima-alert-message" }, message)
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
function Tag({ color, children, icon, className, bordered, ...props }) {
|
|
95
|
+
const colorCls = color ? "ima-tag-" + color : "";
|
|
96
|
+
return React.createElement("span", {
|
|
97
|
+
...props,
|
|
98
|
+
className: ["ima-tag", colorCls, className].filter(Boolean).join(" "),
|
|
99
|
+
}, icon && React.createElement("span", { className: "ima-tag-icon", style: { display: "inline-flex", alignItems: "center", marginRight: children ? 4 : 0 } }, icon), children);
|
|
100
|
+
}
|
|
101
|
+
function Input(props) {
|
|
102
|
+
const { className, type = "text", ...rest } = props;
|
|
103
|
+
return React.createElement("input", {
|
|
104
|
+
type,
|
|
105
|
+
...rest,
|
|
106
|
+
className: ["ima-input", className].filter(Boolean).join(" "),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function TextArea(props) {
|
|
110
|
+
const { autoSize, className, rows, ...rest } = props;
|
|
111
|
+
return React.createElement("textarea", {
|
|
112
|
+
...rest,
|
|
113
|
+
className: ["ima-input ima-textarea", className].filter(Boolean).join(" "),
|
|
114
|
+
rows: autoSize?.minRows || rows || 4,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
Input.TextArea = TextArea;
|
|
118
|
+
function Checkbox({ checked, onChange, children, className, disabled, ...props }) {
|
|
119
|
+
return React.createElement("label", {
|
|
120
|
+
className: ["ima-checkbox-label", disabled ? "is-disabled" : "", className].filter(Boolean).join(" "),
|
|
121
|
+
},
|
|
122
|
+
React.createElement("input", {
|
|
123
|
+
type: "checkbox",
|
|
124
|
+
checked: Boolean(checked),
|
|
125
|
+
disabled,
|
|
126
|
+
onChange,
|
|
127
|
+
className: "ima-checkbox",
|
|
128
|
+
...props,
|
|
129
|
+
}),
|
|
130
|
+
children ? React.createElement("span", { className: "ima-checkbox-text" }, children) : null
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
function Segmented({ options = [], value, onChange, disabled, block, className }) {
|
|
134
|
+
return React.createElement("div", {
|
|
135
|
+
role: "radiogroup",
|
|
136
|
+
className: ["ima-segmented", block ? "is-block" : "", className].filter(Boolean).join(" "),
|
|
137
|
+
}, options.map((opt) => {
|
|
138
|
+
const val = typeof opt === "object" ? opt.value : opt;
|
|
139
|
+
const lbl = typeof opt === "object" ? opt.label : opt;
|
|
140
|
+
const active = val === value;
|
|
141
|
+
return React.createElement("button", {
|
|
142
|
+
key: String(val),
|
|
143
|
+
type: "button",
|
|
144
|
+
role: "radio",
|
|
145
|
+
"aria-checked": active,
|
|
146
|
+
disabled,
|
|
147
|
+
className: ["ima-segmented-item", active ? "is-active" : ""].filter(Boolean).join(" "),
|
|
148
|
+
onClick: () => { if (!disabled && onChange) onChange(val); },
|
|
149
|
+
}, lbl);
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
function hostModalButton(label, onClick, kind, extra) {
|
|
153
|
+
const options = extra || {};
|
|
154
|
+
const variant = kind === "primary" ? "primary" : "outline";
|
|
155
|
+
if (typeof PrimitiveButton === "function") {
|
|
156
|
+
return React.createElement(PrimitiveButton, {
|
|
157
|
+
variant,
|
|
158
|
+
disabled: options.disabled,
|
|
159
|
+
className: options.className,
|
|
160
|
+
onClick,
|
|
161
|
+
type: "button",
|
|
162
|
+
}, label);
|
|
163
|
+
}
|
|
164
|
+
return React.createElement(Button, {
|
|
165
|
+
variant,
|
|
166
|
+
disabled: options.disabled,
|
|
167
|
+
className: options.className,
|
|
168
|
+
onClick,
|
|
169
|
+
}, label);
|
|
170
|
+
}
|
|
171
|
+
function Modal(props) {
|
|
172
|
+
const { open, title, onCancel, onOk, okText, cancelText, okButtonProps, confirmLoading, width = 640, zIndex = 1100, children, footer, className, keyboard, maskClosable, closeLabel, description } = props;
|
|
173
|
+
const requestClose = onCancel || props.onClose;
|
|
174
|
+
const closeRef = useRef(requestClose);
|
|
175
|
+
closeRef.current = requestClose;
|
|
176
|
+
const layerRef = useRef(null);
|
|
177
|
+
if (!layerRef.current) layerRef.current = { owner: props.layerOwner || "modal" };
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
if (!open) return undefined;
|
|
180
|
+
const layer = layerRef.current;
|
|
181
|
+
modalLayers.push(layer);
|
|
182
|
+
const onKey = (event) => {
|
|
183
|
+
if (event.key !== "Escape") return;
|
|
184
|
+
if (modalLayers[modalLayers.length - 1] !== layer) return;
|
|
185
|
+
event.preventDefault();
|
|
186
|
+
event.stopPropagation();
|
|
187
|
+
if (typeof event.stopImmediatePropagation === "function") event.stopImmediatePropagation();
|
|
188
|
+
if (keyboard === false) return;
|
|
189
|
+
if (closeRef.current) closeRef.current();
|
|
190
|
+
};
|
|
191
|
+
window.addEventListener("keydown", onKey, true);
|
|
192
|
+
return () => {
|
|
193
|
+
window.removeEventListener("keydown", onKey, true);
|
|
194
|
+
const index = modalLayers.lastIndexOf(layer);
|
|
195
|
+
if (index >= 0) modalLayers.splice(index, 1);
|
|
196
|
+
};
|
|
197
|
+
}, [open, keyboard]);
|
|
198
|
+
if (!open) return null;
|
|
199
|
+
const handleClose = () => { if (closeRef.current) closeRef.current(); };
|
|
200
|
+
const handleOk = () => { if (onOk) onOk(); };
|
|
201
|
+
const actionRow = footer === null ? null : (footer || React.createElement(React.Fragment, null,
|
|
202
|
+
hostModalButton(cancelText || "取消", handleClose, "outline"),
|
|
203
|
+
hostModalButton(okText || "确定", handleOk, "primary", { disabled: okButtonProps?.disabled || confirmLoading })
|
|
204
|
+
));
|
|
205
|
+
const footerNode = Array.isArray(actionRow)
|
|
206
|
+
? React.createElement(React.Fragment, null, actionRow)
|
|
207
|
+
: actionRow;
|
|
208
|
+
const hostDescription = typeof description === "string" && description !== "" ? { description } : {};
|
|
209
|
+
if (typeof HostModal === "function") {
|
|
210
|
+
return h(HostModal, {
|
|
211
|
+
open: true,
|
|
212
|
+
title,
|
|
213
|
+
onClose: handleClose,
|
|
214
|
+
closeLabel: closeLabel || "Close",
|
|
215
|
+
className,
|
|
216
|
+
footer: footerNode,
|
|
217
|
+
...hostDescription,
|
|
218
|
+
}, children);
|
|
219
|
+
}
|
|
220
|
+
const allowMask = maskClosable !== false && modalLayers[modalLayers.length - 1] === layerRef.current;
|
|
221
|
+
return React.createElement("div", { className: "ima-modal-root", style: { zIndex } },
|
|
222
|
+
React.createElement("div", { className: "ima-modal-mask", onClick: allowMask ? handleClose : undefined }),
|
|
223
|
+
React.createElement("div", { className: ["ima-modal-wrap", className].filter(Boolean).join(" ") },
|
|
224
|
+
React.createElement("div", { className: "ima-modal-panel", style: { width } },
|
|
225
|
+
React.createElement("div", { className: "ima-modal-header" },
|
|
226
|
+
React.createElement("div", { className: "ima-modal-title" }, title),
|
|
227
|
+
React.createElement("button", { type: "button", className: "ima-modal-close", "aria-label": closeLabel || "Close", onClick: handleClose },
|
|
228
|
+
React.createElement("svg", { viewBox: "0 0 16 16", width: 14, height: 14, fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round" },
|
|
229
|
+
React.createElement("path", { d: "m4 4 8 8M12 4 4 12" })
|
|
230
|
+
)
|
|
231
|
+
)
|
|
232
|
+
),
|
|
233
|
+
React.createElement("div", { className: "ima-modal-body" },
|
|
234
|
+
description ? React.createElement("p", { className: "ima-confirm-content" }, description) : null,
|
|
235
|
+
children),
|
|
236
|
+
footerNode && React.createElement("div", { className: "ima-modal-footer-wrap" }, footerNode)
|
|
237
|
+
)
|
|
238
|
+
)
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
function useModal() {
|
|
242
|
+
const [config, setConfig] = React.useState(null);
|
|
243
|
+
const confirm = (opts) => { setConfig(opts); };
|
|
244
|
+
const holder = config ? React.createElement(Modal, {
|
|
245
|
+
open: true,
|
|
246
|
+
title: config.title,
|
|
247
|
+
width: 480,
|
|
248
|
+
description: config.description,
|
|
249
|
+
onCancel: () => { setConfig(null); },
|
|
250
|
+
onOk: () => {
|
|
251
|
+
const p = config.onOk?.();
|
|
252
|
+
if (p && typeof p.then === "function") {
|
|
253
|
+
p.then(() => setConfig(null));
|
|
254
|
+
} else {
|
|
255
|
+
setConfig(null);
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
okText: config.okText,
|
|
259
|
+
cancelText: config.cancelText,
|
|
260
|
+
okButtonProps: config.okButtonProps,
|
|
261
|
+
}, config.content ? React.createElement("p", { className: "ima-confirm-content" }, config.content) : null) : null;
|
|
262
|
+
return [{ confirm }, holder];
|
|
263
|
+
}
|
|
264
|
+
Modal.useModal = useModal;
|
|
265
|
+
function Switch(props) {
|
|
266
|
+
const on = Boolean(props.checked);
|
|
267
|
+
return React.createElement("button", {
|
|
268
|
+
type: "button",
|
|
269
|
+
role: "switch",
|
|
270
|
+
"aria-checked": on,
|
|
271
|
+
"aria-label": props["aria-label"],
|
|
272
|
+
title: props.title,
|
|
273
|
+
disabled: props.disabled,
|
|
274
|
+
className: "ima-enable-switch" + (props.className ? " " + props.className : ""),
|
|
275
|
+
onClick: function (event) {
|
|
276
|
+
if (event && typeof event.stopPropagation === "function") event.stopPropagation();
|
|
277
|
+
if (!props.disabled && props.onChange) props.onChange(!on);
|
|
278
|
+
},
|
|
279
|
+
}, React.createElement("span", { className: "ima-enable-switch-thumb", "aria-hidden": "true" }));
|
|
280
|
+
}
|
|
281
|
+
function Select(props) {
|
|
282
|
+
const [open, setOpen] = useState(false);
|
|
283
|
+
useEffect(() => {
|
|
284
|
+
if (!open || typeof window === "undefined") return undefined;
|
|
285
|
+
const layer = { owner: "select" };
|
|
286
|
+
modalLayers.push(layer);
|
|
287
|
+
function onKey(event) {
|
|
288
|
+
if (event.key !== "Escape") return;
|
|
289
|
+
if (modalLayers[modalLayers.length - 1] !== layer) return;
|
|
290
|
+
event.preventDefault();
|
|
291
|
+
event.stopPropagation();
|
|
292
|
+
event.stopImmediatePropagation();
|
|
293
|
+
setOpen(false);
|
|
294
|
+
}
|
|
295
|
+
window.addEventListener("keydown", onKey, true);
|
|
296
|
+
return () => {
|
|
297
|
+
window.removeEventListener("keydown", onKey, true);
|
|
298
|
+
const index = modalLayers.lastIndexOf(layer);
|
|
299
|
+
if (index >= 0) modalLayers.splice(index, 1);
|
|
300
|
+
};
|
|
301
|
+
}, [open]);
|
|
302
|
+
|
|
303
|
+
const items = React.useMemo(() => {
|
|
304
|
+
const list = [];
|
|
305
|
+
(props.options || []).forEach((opt, idx) => {
|
|
306
|
+
if (Array.isArray(opt.options)) {
|
|
307
|
+
list.push({ type: "label", id: "group-" + idx, text: opt.label || "" });
|
|
308
|
+
opt.options.forEach((sub) => {
|
|
309
|
+
list.push({ id: String(sub.value), label: sub.label, disabled: sub.disabled, danger: sub.danger });
|
|
310
|
+
});
|
|
311
|
+
} else {
|
|
312
|
+
list.push({ id: String(opt.value), label: opt.label, disabled: opt.disabled, danger: opt.danger });
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
return list;
|
|
316
|
+
}, [props.options]);
|
|
317
|
+
|
|
318
|
+
const footer = React.useMemo(() => {
|
|
319
|
+
if (!Array.isArray(props.footer) || props.footer.length === 0) return undefined;
|
|
320
|
+
return props.footer.map((item) => ({
|
|
321
|
+
id: String(item.value),
|
|
322
|
+
label: item.label,
|
|
323
|
+
disabled: item.disabled,
|
|
324
|
+
danger: item.danger,
|
|
325
|
+
}));
|
|
326
|
+
}, [props.footer]);
|
|
327
|
+
|
|
328
|
+
const selectedOption = React.useMemo(() => {
|
|
329
|
+
for (const opt of props.options || []) {
|
|
330
|
+
if (Array.isArray(opt.options)) {
|
|
331
|
+
const found = opt.options.find((sub) => String(sub.value) === String(props.value));
|
|
332
|
+
if (found) return found;
|
|
333
|
+
} else if (String(opt.value) === String(props.value)) {
|
|
334
|
+
return opt;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return null;
|
|
338
|
+
}, [props.options, props.value]);
|
|
339
|
+
|
|
340
|
+
const currentText = selectedOption ? selectedOption.label : (props.placeholder || props["aria-label"] || "");
|
|
341
|
+
|
|
342
|
+
return React.createElement("div", {
|
|
343
|
+
className: "ima-menu-select-wrap " + (props.className || ""),
|
|
344
|
+
style: props.style,
|
|
345
|
+
},
|
|
346
|
+
React.createElement(HostMenu, {
|
|
347
|
+
open: open,
|
|
348
|
+
onClose: () => setOpen(false),
|
|
349
|
+
onSelect: (id) => {
|
|
350
|
+
if (props.footer && props.footer.some((item) => String(item.value) === id)) {
|
|
351
|
+
if (typeof props.onFooter === "function") props.onFooter(id);
|
|
352
|
+
setOpen(false);
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
if (props.onChange) props.onChange(id);
|
|
356
|
+
setOpen(false);
|
|
357
|
+
},
|
|
358
|
+
selectedId: props.value != null ? String(props.value) : undefined,
|
|
359
|
+
align: "start",
|
|
360
|
+
portal: true,
|
|
361
|
+
dense: true,
|
|
362
|
+
anchor: React.createElement(Button, {
|
|
363
|
+
variant: "outline",
|
|
364
|
+
size: "sm",
|
|
365
|
+
role: "combobox",
|
|
366
|
+
"aria-label": props["aria-label"] || props.placeholder,
|
|
367
|
+
"aria-expanded": open,
|
|
368
|
+
disabled: props.disabled,
|
|
369
|
+
className: "ima-menu-select-trigger" + (open ? " is-open" : ""),
|
|
370
|
+
onClick: () => { if (!props.disabled) setOpen((prev) => !prev); },
|
|
371
|
+
},
|
|
372
|
+
React.createElement("span", { className: "ima-menu-select-label" }, currentText),
|
|
373
|
+
React.createElement("svg", {
|
|
374
|
+
className: "ima-menu-select-arrow",
|
|
375
|
+
viewBox: "0 0 16 16",
|
|
376
|
+
width: 12,
|
|
377
|
+
height: 12,
|
|
378
|
+
fill: "none",
|
|
379
|
+
stroke: "currentColor",
|
|
380
|
+
strokeWidth: 1.8,
|
|
381
|
+
strokeLinecap: "round",
|
|
382
|
+
strokeLinejoin: "round",
|
|
383
|
+
style: { marginLeft: 4, transition: "transform 150ms ease", transform: open ? "rotate(180deg)" : "none" },
|
|
384
|
+
}, React.createElement("path", { d: "m4 6 4 4 4-4" }))
|
|
385
|
+
),
|
|
386
|
+
items: items,
|
|
387
|
+
...(footer ? { footer } : {}),
|
|
388
|
+
})
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
function createSpinner() {
|
|
392
|
+
return React.createElement("svg", {
|
|
393
|
+
className: "ima-btn-spinner",
|
|
394
|
+
viewBox: "0 0 16 16",
|
|
395
|
+
width: 14,
|
|
396
|
+
height: 14,
|
|
397
|
+
fill: "none",
|
|
398
|
+
stroke: "currentColor",
|
|
399
|
+
strokeWidth: 2,
|
|
400
|
+
strokeLinecap: "round",
|
|
401
|
+
style: { marginRight: 6, display: "inline-block", verticalAlign: "-2px", animation: "ima-spin 0.8s linear infinite" },
|
|
402
|
+
"aria-hidden": "true",
|
|
403
|
+
}, React.createElement("path", { d: "M8 1.5a6.5 6.5 0 1 0 6.5 6.5" }));
|
|
404
|
+
}
|
|
405
|
+
function Button({ variant, type, danger, loading, block, size, shape, className, children, href, target, rel, icon, ...props }) {
|
|
406
|
+
let mappedVariant = variant ?? "outline";
|
|
407
|
+
if (type === "primary") mappedVariant = "primary";
|
|
408
|
+
else if (type === "text" || type === "link") mappedVariant = "ghost";
|
|
409
|
+
|
|
410
|
+
const isPrimary = mappedVariant === "primary";
|
|
411
|
+
const mappedSize = (size === "small" || size === "sm") ? "sm" : "md";
|
|
412
|
+
|
|
413
|
+
const classes = [
|
|
414
|
+
"ima-btn",
|
|
415
|
+
href ? "ima-link-btn" : "",
|
|
416
|
+
className,
|
|
417
|
+
isPrimary ? "is-primary" : "",
|
|
418
|
+
danger ? "is-danger ima-btn-danger" : "",
|
|
419
|
+
(danger && isPrimary) ? "ima-btn-danger-primary" : "",
|
|
420
|
+
block ? "is-block" : "",
|
|
421
|
+
loading ? "is-loading" : "",
|
|
422
|
+
].filter(Boolean).join(" ");
|
|
423
|
+
|
|
424
|
+
const iconElement = loading
|
|
425
|
+
? createSpinner()
|
|
426
|
+
: (icon ? React.createElement("span", {
|
|
427
|
+
key: "icon",
|
|
428
|
+
className: "ima-btn-icon",
|
|
429
|
+
style: { display: "inline-flex", alignItems: "center" },
|
|
430
|
+
}, icon) : null);
|
|
431
|
+
const content = [iconElement, children];
|
|
432
|
+
|
|
433
|
+
if (href) {
|
|
434
|
+
return React.createElement("a", Object.assign({}, props, {
|
|
435
|
+
href,
|
|
436
|
+
target,
|
|
437
|
+
rel: rel || (target === "_blank" ? "noreferrer" : undefined),
|
|
438
|
+
className: classes || undefined,
|
|
439
|
+
"aria-label": props["aria-label"],
|
|
440
|
+
style: props.style,
|
|
441
|
+
}), content);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
if (typeof PrimitiveButton === "function") {
|
|
445
|
+
return React.createElement(PrimitiveButton, Object.assign({}, props, {
|
|
446
|
+
variant: mappedVariant,
|
|
447
|
+
size: mappedSize,
|
|
448
|
+
className: classes || undefined,
|
|
449
|
+
disabled: props.disabled || loading,
|
|
450
|
+
icon: undefined,
|
|
451
|
+
}), content);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
return React.createElement("button", Object.assign({}, props, {
|
|
455
|
+
type: "button",
|
|
456
|
+
className: classes || undefined,
|
|
457
|
+
disabled: props.disabled || loading,
|
|
458
|
+
}), content);
|
|
459
|
+
}
|
|
75
460
|
const HoverCard = primitives.HoverCard;
|
|
76
461
|
const StateDot = primitives.StateDot;
|
|
77
462
|
const IconSettingsOutline16 = pickHostIcon("IconSettingsOutlineRegular", "IconSettingsOutline16");
|
|
@@ -419,7 +804,7 @@ window.__ModuleLoader__.load({
|
|
|
419
804
|
"qr.weixin": "请使用微信扫描二维码完成绑定", "qr.feishu": "请使用飞书扫描二维码,将自动创建机器人", "qr.lark": "请使用 Lark 扫描二维码完成配对", "qr.wecom": "请使用企业微信扫描二维码,快捷绑定机器人", "qr.dingtalk": "请使用钉钉扫描二维码,自动创建机器人", "qr.qq": "请使用手机 QQ 扫描二维码,创建开放平台机器人", "qr.default": "请使用对应 App 扫描二维码",
|
|
420
805
|
"status.connected": "已连接", "action.more": "{channel} 更多",
|
|
421
806
|
"error.loadAssistant": "无法加载账号配置", "error.noModels": "当前 Host 还没有可用模型,请先在网页里配置提供商", "error.save": "保存失败", "error.chooseWorkspace": "请选择工作区目录", "error.workspaceUnavailable": "当前 Host 无法新增工作区", "error.addWorkspace": "新增工作区失败", "error.load": "加载失败", "error.connection": "无法连接本机 IM 助理接口", "error.request": "请求失败", "error.action": "操作失败", "error.qr": "无法生成二维码", "error.detailsInLog": "操作失败,请查看服务器日志。",
|
|
422
|
-
"composer.noWorkspaces": "暂无工作区", "composer.addWorkspace": "添加工作区…", "composer.workspaceRequired": "请先添加工作区,否则无法保存", "composer.permission": "权限", "composer.noModels": "暂无模型", "
|
|
807
|
+
"composer.noWorkspaces": "暂无工作区", "composer.addWorkspace": "添加工作区…", "composer.workspaceRequired": "请先添加工作区,否则无法保存", "composer.permission": "权限", "composer.noModels": "暂无模型", "action.cancel": "取消",
|
|
423
808
|
"permission.readOnly": "只读", "permission.workspaceWrite": "工作区写入", "permission.fullAccess": "完全访问",
|
|
424
809
|
"rail.workspace": "工作区", "rail.sessions": "会话", "rail.search": "搜索", "rail.searchPlaceholder": "搜索会话...", "rail.clearSearch": "清除搜索", "rail.filter": "筛选", "rail.group": "分组方式", "rail.byWorkspace": "按工作区", "rail.list": "单列表", "rail.byWorkspaceTree": "按工作区树", "rail.sort": "排序方式", "rail.recent": "最近更新", "rail.showArchived": "显示已归档", "rail.onlyArchived": "仅显示已归档", "rail.running": "运行中", "rail.idle": "空闲", "rail.waitingApproval": "等待审批", "rail.planReview": "计划待审", "rail.waitingAnswer": "等待回答", "rail.subagents": "{n} 个子代理运行中", "rail.completed": "已完成", "rail.archived": "已归档", "rail.compactApproval": "待审批", "rail.compactPlan": "计划待审", "rail.compactAnswer": "待回答", "rail.renameAria": "重命名会话", "rail.rename": "重命名", "rail.fork": "分叉会话", "rail.archive": "归档会话", "rail.unarchive": "恢复会话", "rail.stopArchive": "停止并归档", "rail.stopArchiveDescription": "会话“{name}”仍在运行。停止后才能归档。", "rail.stopArchiveConfirm": "停止并归档", "rail.stopArchivePending": "正在停止并归档…", "rail.stopArchiveGroupDescription": "“{name}”下仍有运行中的会话。停止这些会话后才能归档整组。", "rail.archiveFailed": "归档失败,未移除会话。请稍后重试或检查宿主日志。", "rail.deleteSession": "删除会话", "rail.deleteSessionConfirm": "删除会话", "rail.deleteSessionDescription": "将永久删除会话“{name}”及其子代理(含正在运行的)和全部记录(对话内容、统计、缓存),此操作不可恢复。", "rail.deleteSessionPending": "正在删除会话…", "rail.deleteSessionFailed": "删除会话失败:{message}", "rail.deleteSessionClose": "关闭", "rail.deleteSessionCancel": "取消", "rail.groupActions": "“{name}”的频道操作", "rail.channelSettings": "渠道设置", "rail.archiveGroup": "归档整组会话", "rail.archiveGroupConfirm": "确认归档", "rail.archiveGroupDescription": "将归档“{name}”下的 {count} 个会话。归档后可以在“设置 → 已归档”中恢复。", "rail.archiveGroupPending": "正在归档整组会话…", "rail.archiveGroupFailed": "部分会话归档失败:{message}", "rail.archiveGroupClose": "关闭", "rail.archiveGroupCancel": "取消", "rail.empty": "还没有频道会话。先在设置 → IM助理 里连接渠道,并给机器人发一条消息。", "rail.noTasks": "暂无网页任务", "rail.ungrouped": "未分组", "rail.tabsAria": "工作区分类", "rail.tasks": "任务", "rail.channels": "频道",
|
|
425
810
|
"time.now": "刚刚", "time.minutes": "{n}分钟", "time.hours": "{n}小时", "time.days": "{n}天", "time.months": "{n}个月", "time.years": "{n}年", "time.ago": "{t}前",
|
|
@@ -448,7 +833,7 @@ window.__ModuleLoader__.load({
|
|
|
448
833
|
"qr.weixin": "Scan the QR code with WeChat to connect", "qr.feishu": "Scan with Feishu; a bot will be created automatically", "qr.lark": "Scan with Lark to pair", "qr.wecom": "Scan with WeCom to quickly connect a bot", "qr.dingtalk": "Scan with DingTalk; a bot will be created automatically", "qr.qq": "Scan with mobile QQ to create an Open Platform bot", "qr.default": "Scan the QR code with the corresponding app",
|
|
449
834
|
"status.connected": "Connected", "action.more": "More options for {channel}",
|
|
450
835
|
"error.loadAssistant": "Could not load account settings", "error.noModels": "No models are available in the Host. Configure a provider in the web app first.", "error.save": "Could not save", "error.chooseWorkspace": "Choose a workspace directory", "error.workspaceUnavailable": "This Host cannot create workspaces", "error.addWorkspace": "Could not add workspace", "error.load": "Could not load", "error.connection": "Could not connect to the local IM Assistant API", "error.request": "Request failed", "error.action": "Action failed", "error.qr": "Could not generate a QR code", "error.detailsInLog": "The operation failed. Check the server logs for details.",
|
|
451
|
-
"composer.noWorkspaces": "No workspaces", "composer.addWorkspace": "Add workspace…", "composer.workspaceRequired": "Add a workspace before saving.", "composer.permission": "Permission", "composer.noModels": "No models", "
|
|
836
|
+
"composer.noWorkspaces": "No workspaces", "composer.addWorkspace": "Add workspace…", "composer.workspaceRequired": "Add a workspace before saving.", "composer.permission": "Permission", "composer.noModels": "No models", "action.cancel": "Cancel",
|
|
452
837
|
"permission.readOnly": "Read Only", "permission.workspaceWrite": "Workspace Write", "permission.fullAccess": "Full access",
|
|
453
838
|
"rail.workspace": "Workspaces", "rail.sessions": "Sessions", "rail.search": "Search", "rail.searchPlaceholder": "Search sessions...", "rail.clearSearch": "Clear search", "rail.filter": "Filter", "rail.group": "Group by", "rail.byWorkspace": "By workspace", "rail.list": "Single list", "rail.byWorkspaceTree": "Workspace Tree", "rail.sort": "Sort by", "rail.recent": "Recently updated", "rail.showArchived": "Show archived", "rail.onlyArchived": "Archived only", "rail.running": "Running", "rail.idle": "Idle", "rail.waitingApproval": "Waiting for approval", "rail.planReview": "Plan to review", "rail.waitingAnswer": "Waiting for an answer", "rail.subagents": "{n} subagents running", "rail.completed": "Completed", "rail.archived": "Archived", "rail.compactApproval": "Approval", "rail.compactPlan": "Plan review", "rail.compactAnswer": "Answer", "rail.renameAria": "Rename session", "rail.rename": "Rename", "rail.fork": "Fork session", "rail.archive": "Archive session", "rail.unarchive": "Restore session", "rail.stopArchive": "Stop and archive", "rail.stopArchiveDescription": "Session “{name}” is still running. Stop it before archiving.", "rail.stopArchiveConfirm": "Stop and archive", "rail.stopArchivePending": "Stopping and archiving…", "rail.stopArchiveGroupDescription": "Some conversations in “{name}” are still running. Stop them before archiving the group.", "rail.archiveFailed": "Archive failed. The session was kept. Retry or check the Host logs.", "rail.deleteSession": "Delete session", "rail.deleteSessionConfirm": "Delete session", "rail.deleteSessionDescription": "This permanently deletes session “{name}”, its child agents (including any that are still running), and all of its records (conversation, stats, cache). This cannot be undone.", "rail.deleteSessionPending": "Deleting session…", "rail.deleteSessionFailed": "Could not delete the session: {message}", "rail.deleteSessionClose": "Close", "rail.deleteSessionCancel": "Cancel", "rail.groupActions": "Actions for {name}", "rail.channelSettings": "Channel settings", "rail.archiveGroup": "Archive all conversations", "rail.archiveGroupConfirm": "Archive all", "rail.archiveGroupDescription": "Archive all {count} conversations for “{name}”. You can restore them later in Settings → Archived.", "rail.archiveGroupPending": "Archiving conversations…", "rail.archiveGroupFailed": "Some conversations could not be archived: {message}", "rail.archiveGroupClose": "Close", "rail.archiveGroupCancel": "Cancel", "rail.empty": "No channel sessions yet. Connect a channel in Settings → IM Assistant, then send the bot a message.", "rail.noTasks": "No web tasks", "rail.ungrouped": "Ungrouped", "rail.tabsAria": "Workspace categories", "rail.tasks": "Tasks", "rail.channels": "Channels",
|
|
454
839
|
"time.now": "now", "time.minutes": "{n}min", "time.hours": "{n}h", "time.days": "{n}d", "time.months": "{n}mo", "time.years": "{n}y", "time.ago": "{t} ago",
|
|
@@ -485,18 +870,8 @@ window.__ModuleLoader__.load({
|
|
|
485
870
|
}, []);
|
|
486
871
|
return dark;
|
|
487
872
|
}
|
|
488
|
-
function
|
|
489
|
-
|
|
490
|
-
const lang = locale || currentUiLang();
|
|
491
|
-
return h(ConfigProvider, {
|
|
492
|
-
locale: lang === "en" ? antdEn : antdZh,
|
|
493
|
-
theme: {
|
|
494
|
-
algorithm: dark ? theme.darkAlgorithm : theme.defaultAlgorithm,
|
|
495
|
-
token: { fontFamily: "inherit" },
|
|
496
|
-
components: { Button: { borderRadius: 8 } },
|
|
497
|
-
},
|
|
498
|
-
button: { autoInsertSpace: false },
|
|
499
|
-
}, children);
|
|
873
|
+
function HostThemeProvider({ children }) {
|
|
874
|
+
return children;
|
|
500
875
|
}
|
|
501
876
|
|
|
502
877
|
const CSS = `
|
|
@@ -504,12 +879,31 @@ window.__ModuleLoader__.load({
|
|
|
504
879
|
.ima-page{box-sizing:border-box;max-width:none;width:100%;margin:0;padding:0 0 32px;color:var(--ima-text)}
|
|
505
880
|
.ima-head{display:flex;flex-direction:column;align-items:stretch;gap:12px;margin-bottom:12px}
|
|
506
881
|
.ima-heading h2,.ima-title{margin:0;font-size:24px;line-height:32px;font-weight:600;letter-spacing:-.4px;white-space:nowrap;text-align:left}
|
|
507
|
-
.ima-title-row{display:flex;align-items:center;gap:8px;min-width:0;flex-wrap:wrap}
|
|
508
|
-
.ima-title-links{display:
|
|
509
|
-
.ima-title-links
|
|
882
|
+
.ima-title-row{display:flex;align-items:center;gap:8px 12px;min-width:0;flex-wrap:wrap}
|
|
883
|
+
.ima-title-links{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
|
|
884
|
+
.ima-title-links>span[data-mpi-check]{display:inline-flex;align-items:center}
|
|
885
|
+
.ima-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:32px;padding:0 12px;border:0.5px solid var(--dsw-alias-border-l2,#494949);border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-bg-layer-1,transparent);color:var(--dsw-alias-label-primary,#eee);font:inherit;font-size:13px;line-height:20px;cursor:pointer;user-select:none;box-sizing:border-box;text-decoration:none;transition:border-color 120ms ease,color 120ms ease,background 120ms ease}
|
|
886
|
+
.ima-btn:not(.is-primary){color:var(--dsw-alias-label-primary,#eee)}
|
|
887
|
+
.ima-btn:hover:not(:disabled){border-color:var(--dsw-alias-border-l3,#555);color:var(--dsw-alias-label-primary,#fff);background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
|
|
888
|
+
.ima-btn:focus-visible{outline:var(--dsw-focus-ring-width,1px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:0}
|
|
889
|
+
.ima-btn:disabled,.ima-btn.is-disabled{opacity:.5;cursor:default;pointer-events:none}
|
|
890
|
+
.ima-btn.is-primary,.ima-bind-ready .ima-btn.is-primary{background:var(--dsw-alias-state-business-primary,#4176e6)!important;border-color:transparent!important;color:#fff!important}
|
|
891
|
+
.ima-btn.is-primary *,.ima-bind-ready .ima-btn.is-primary *{color:#fff!important;fill:currentColor!important}
|
|
892
|
+
.ima-btn.is-primary:hover:not(:disabled),.ima-bind-ready .ima-btn.is-primary:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-state-business-primary,#4176e6) 88%, #fff)!important;color:#fff!important}
|
|
893
|
+
.ima-btn.is-primary:disabled,.ima-bind-ready .ima-btn.is-primary:disabled{opacity:.45!important;cursor:default!important}
|
|
894
|
+
.ima-btn.is-block{width:100%}
|
|
895
|
+
.ima-link-btn{height:28px;padding:0 10px;font-size:12px}
|
|
510
896
|
.ima-sub{margin:12px 0 0;max-width:none;color:var(--ima-muted);font-size:14px;line-height:22px;text-align:left}
|
|
511
897
|
.ima-error{color:var(--ima-danger);font-size:12px;margin:0 0 12px}
|
|
512
|
-
.ima-pending,.ima-page>.
|
|
898
|
+
.ima-pending,.ima-page>.ima-alert,.ima-inspector .ima-alert{margin:0 0 12px}
|
|
899
|
+
.ima-alert{display:flex;align-items:flex-start;gap:8px;padding:10px 14px;border-radius:var(--dsw-radius-sm,8px);font-size:13px;line-height:20px;border:0.5px solid var(--dsw-alias-border-l2,rgba(255,255,255,.1))}
|
|
900
|
+
.ima-alert-error{background:color-mix(in srgb, var(--dsw-alias-state-error-primary,#f85149) 12%, transparent);border-color:color-mix(in srgb, var(--dsw-alias-state-error-primary,#f85149) 30%, transparent);color:var(--dsw-alias-label-primary,#eee)}
|
|
901
|
+
.ima-alert-error .ima-alert-icon{color:var(--dsw-alias-state-error-primary,#f85149)}
|
|
902
|
+
.ima-alert-success{background:color-mix(in srgb, var(--dsw-alias-state-success-primary,#3fb950) 12%, transparent);border-color:color-mix(in srgb, var(--dsw-alias-state-success-primary,#3fb950) 30%, transparent);color:var(--dsw-alias-label-primary,#eee)}
|
|
903
|
+
.ima-alert-success .ima-alert-icon{color:var(--dsw-alias-state-success-primary,#3fb950)}
|
|
904
|
+
.ima-alert-info{background:var(--dsw-alias-bg-layer-2,rgba(128,128,128,.08));color:var(--dsw-alias-label-primary,#eee)}
|
|
905
|
+
.ima-alert-icon{display:inline-flex;align-items:center;flex:none;margin-top:3px}
|
|
906
|
+
.ima-alert-message{flex:1;min-width:0;word-break:break-word}
|
|
513
907
|
.ima-pending-row{display:flex;gap:8px;align-items:center;margin-top:8px}
|
|
514
908
|
.ima-wrap{display:flex;flex-direction:column;min-height:0;flex:1;height:100%;overflow:hidden}.ima-official-tree{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.ima-native.ima-rail,.ima-rail.dcu-wb{box-sizing:border-box;overflow:hidden}
|
|
515
909
|
.ima-tabs{display:flex;gap:18px;padding:4px 12px 0;border-bottom:1px solid var(--ima-line)}
|
|
@@ -528,10 +922,43 @@ window.__ModuleLoader__.load({
|
|
|
528
922
|
.ima-logo.sm[data-brand="wecom"]{border-radius:4px;box-shadow:none;background:transparent}
|
|
529
923
|
.ima-qrbox{display:flex;flex-direction:column;align-items:center;gap:10px;padding:8px 0 4px}
|
|
530
924
|
.ima-qrbox img{width:200px;height:200px;background:#fff;border:1px solid var(--ima-line);border-radius:12px;object-fit:contain}
|
|
531
|
-
.ima-bind-ready{display:flex;flex-direction:column;align-items:center;gap:14px;padding:12px 0 4px}.ima-bind-ready .
|
|
925
|
+
.ima-bind-ready{display:flex;flex-direction:column;align-items:center;gap:14px;padding:12px 0 4px}.ima-bind-ready .ima-btn{min-width:136px}.ima-bind-status{min-height:40px;display:grid;place-items:center;color:var(--ima-muted);font-size:13px;text-align:center}
|
|
532
926
|
.ima-hint{margin:0;color:var(--ima-muted);font-size:13px;text-align:center;line-height:1.6}
|
|
533
927
|
.ima-field{display:flex;flex-direction:column;gap:6px;margin-bottom:12px;font-size:13px}
|
|
534
|
-
.ima-field .
|
|
928
|
+
.ima-field .ima-input,.ima-field input{width:100%}
|
|
929
|
+
.ima-input,.ima-account-remark-input,.ima-field input,.ima-rename,.ima-n-search-input{box-sizing:border-box!important;height:36px!important;padding:0 12px!important;border:0.5px solid var(--dsw-alias-border-l2,#494949)!important;border-radius:var(--dsw-radius-sm,8px)!important;background:var(--dsw-alias-bg-layer-1,transparent)!important;color:var(--dsw-alias-label-primary,#eee)!important;font:inherit!important;font-size:13px!important;line-height:20px!important;transition:border-color 120ms ease,background 120ms ease!important}
|
|
930
|
+
.ima-textarea{height:auto!important;min-height:80px;padding:8px 12px!important;resize:vertical}
|
|
931
|
+
.ima-input:hover:not(:disabled),.ima-account-remark-input:hover:not(:disabled),.ima-field input:hover:not(:disabled),.ima-rename:hover,.ima-n-search-input:hover{border-color:var(--dsw-alias-border-l3,#666)!important}
|
|
932
|
+
.ima-input:focus,.ima-account-remark-input:focus,.ima-field input:focus,.ima-rename:focus,.ima-n-search-input:focus{border-color:var(--dsw-alias-brand-primary,#4b7cff)!important;outline:var(--dsw-focus-ring-width,1px) solid var(--dsw-focus-ring-color,var(--dsw-alias-brand-primary,#4b7cff))!important;outline-offset:0!important}
|
|
933
|
+
.ima-input::placeholder,.ima-account-remark-input::placeholder,.ima-field input::placeholder,.ima-n-search-input::placeholder{color:var(--dsw-alias-label-tertiary,#888)!important}
|
|
934
|
+
.ima-input:disabled,.ima-account-remark-input:disabled{opacity:.5!important;cursor:not-allowed!important}
|
|
935
|
+
.ima-checkbox-label{display:inline-flex;align-items:center;gap:8px;font-size:13px;color:var(--dsw-alias-label-primary,#eee);cursor:pointer;user-select:none}
|
|
936
|
+
.ima-checkbox-label.is-disabled{opacity:.5;cursor:not-allowed}
|
|
937
|
+
.ima-checkbox{width:16px;height:16px;margin:0;accent-color:var(--dsw-alias-state-business-primary,#4176e6);cursor:inherit}
|
|
938
|
+
.ima-segmented{display:inline-flex;background:var(--dsw-alias-bg-layer-2,rgba(128,128,128,.1));padding:2px;border-radius:var(--dsw-radius-sm,8px);gap:2px;border:0.5px solid var(--dsw-alias-border-l1,rgba(255,255,255,.06))}
|
|
939
|
+
.ima-segmented.is-block{display:flex;width:100%}
|
|
940
|
+
.ima-segmented-item{flex:1;min-width:0;height:28px;padding:0 12px;border:none;border-radius:calc(var(--dsw-radius-sm,8px) - 2px);background:transparent;color:var(--dsw-alias-label-secondary,#a0a0a0);font:inherit;font-size:12px;font-weight:500;cursor:pointer;transition:all 120ms ease;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
941
|
+
.ima-segmented-item:hover:not(:disabled){color:var(--dsw-alias-label-primary,#eee)}
|
|
942
|
+
.ima-segmented-item.is-active{background:var(--dsw-alias-bg-layer-1,#222);color:var(--dsw-alias-label-primary,#fff);box-shadow:0 1px 3px rgba(0,0,0,.2)}
|
|
943
|
+
.ima-tag{display:inline-flex!important;align-items:center!important;gap:4px!important;height:22px!important;padding:0 8px!important;font-size:12px!important;line-height:20px!important;border-radius:var(--dsw-radius-sm,6px)!important;font-weight:500!important;box-sizing:border-box!important;vertical-align:middle!important;background:var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.12));color:var(--dsw-alias-label-secondary,#b9b9b9);border:none}
|
|
944
|
+
.ima-tag .ima-btn-spinner{width:11px!important;height:11px!important;margin-right:2px!important;vertical-align:0!important}
|
|
945
|
+
.ima-tag-processing,.ima-tag.is-busy{background:color-mix(in srgb,var(--dsw-alias-state-business-primary,#4176e6) 14%,transparent)!important;color:var(--dsw-alias-state-business-primary,#4176e6)!important}
|
|
946
|
+
.ima-tag-success{background:color-mix(in srgb,var(--dsw-alias-state-success-primary,#3fb950) 14%,transparent)!important;color:var(--dsw-alias-state-success-primary,#3fb950)!important}
|
|
947
|
+
.ima-tag-warning{background:color-mix(in srgb,var(--dsw-alias-state-warn-primary,#d29922) 14%,transparent)!important;color:var(--dsw-alias-state-warn-primary,#d29922)!important}
|
|
948
|
+
.ima-tag-error{background:color-mix(in srgb,var(--dsw-alias-state-error-primary,#f85149) 14%,transparent)!important;color:var(--dsw-alias-state-error-primary,#f85149)!important}
|
|
949
|
+
.ima-modal-root{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;z-index:1100}
|
|
950
|
+
.ima-modal-mask{position:absolute;inset:0;background:rgba(0,0,0,.45);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px)}
|
|
951
|
+
.ima-modal-wrap{position:relative;max-width:calc(100vw - 32px);max-height:calc(100vh - 48px);overflow:auto;display:flex}
|
|
952
|
+
.ima-modal-panel{position:relative;isolation:isolate;box-sizing:border-box;padding:24px 28px 28px;border-radius:var(--dsw-radius-panel,28px);background:var(--dsw-specific-menu,var(--dsw-alias-bg-layer-1));backdrop-filter:var(--dsw-menu-backdrop-filter,blur(20px));-webkit-backdrop-filter:var(--dsw-menu-backdrop-filter,blur(20px));border:0.5px solid var(--dsw-alias-border-l1,rgba(255,255,255,.1));box-shadow:var(--dsw-elevation-panel,0 20px 48px -12px rgba(0,0,0,.35));color:var(--dsw-alias-label-primary,#eee);display:flex;flex-direction:column;gap:16px}
|
|
953
|
+
.ima-modal-header{display:flex;align-items:center;justify-content:space-between;min-height:24px}
|
|
954
|
+
.ima-modal-title{font-size:17px;font-weight:600;line-height:24px;color:var(--dsw-alias-label-primary,#eee)}
|
|
955
|
+
.ima-modal-close{width:28px;height:28px;display:flex;align-items:center;justify-content:center;border:none;border-radius:var(--dsw-radius-sm,8px);background:transparent;color:var(--dsw-alias-label-tertiary,#888);cursor:pointer;transition:all 120ms ease}
|
|
956
|
+
.ima-modal-close:hover{color:var(--dsw-alias-label-primary,#fff);background:var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.12))}
|
|
957
|
+
.ima-modal-body{min-height:0;overflow:visible;display:flex;flex-direction:column;gap:12px}
|
|
958
|
+
.ima-modal-actions{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px}
|
|
959
|
+
.ima-modal-footer-wrap{display:flex;justify-content:flex-end;margin-top:12px;padding-top:16px}
|
|
960
|
+
.ima-inspector-actions>button{flex:none;white-space:nowrap}
|
|
961
|
+
.ima-confirm-content{margin:8px 0 0;font-size:13px;line-height:22px;color:var(--dsw-alias-label-secondary,#b9b9b9)}
|
|
535
962
|
.ima-page.ima-account-page{container-type:inline-size;min-width:0;max-width:1080px;width:100%;margin:0 auto;padding:0 0 32px}
|
|
536
963
|
.ima-account-shell,.ima-account-shell *{box-sizing:border-box}
|
|
537
964
|
.ima-account-shell{display:block;min-height:0;border:0;border-radius:0;overflow:visible;background:transparent}
|
|
@@ -548,19 +975,49 @@ window.__ModuleLoader__.load({
|
|
|
548
975
|
.ima-account-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto auto;align-items:center;gap:12px;width:100%;min-height:48px;padding:10px 12px;border:0;border-radius:8px;background:color-mix(in srgb,var(--ima-text) 7%,transparent);color:inherit;text-align:left}
|
|
549
976
|
.ima-account-row:hover{background:var(--ima-card-hover)}
|
|
550
977
|
.ima-platform-head:focus-visible,.ima-account-row:focus-visible{outline:2px solid var(--ima-accent);outline-offset:2px}
|
|
551
|
-
.ima-account-copy{min-width:0}.ima-account-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:500}.ima-account-rename-button{width:100%;padding:0;border:0;background:transparent;color:inherit;text-align:left;cursor:text}.ima-account-rename-button:hover,.ima-account-rename-button:focus-visible{color:var(--ima-accent)}.ima-account-rename,.ima-account-remark-input{box-sizing:border-box;width:100%;height:32px;padding:4px 8px;border:1px solid var(--ima-line);border-radius:6px;background:transparent;color:inherit;font:inherit}.ima-account-id{display:block;margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ima-muted);font-size:11px}
|
|
978
|
+
.ima-account-copy{min-width:0}.ima-account-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:500}.ima-account-rename-button{width:100%;padding:0;border:0;background:transparent;color:inherit;text-align:left;cursor:text}.ima-account-rename-button:hover,.ima-account-rename-button:focus-visible{color:var(--ima-accent)}.ima-account-rename,.ima-account-remark-input{box-sizing:border-box;width:100%;height:32px;padding:4px 8px;border:1px solid var(--ima-line);border-radius:6px;background:transparent;color:inherit;font:inherit}.ima-account-id{display:block;margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ima-muted);font-size:11px}
|
|
979
|
+
.ima-account-row .ima-tag{margin-inline-end:0}
|
|
552
980
|
.ima-account-receive{display:inline-flex;align-items:center;justify-content:flex-end;gap:8px;white-space:nowrap;font-size:12px;color:var(--ima-muted)}
|
|
553
981
|
.ima-inspector{padding:22px 24px 26px;min-width:0}.ima-inspector-head{display:flex;align-items:flex-start;gap:12px;padding-bottom:18px;border-bottom:1px solid var(--ima-line)}.ima-inspector-head-copy{min-width:0;flex:1}.ima-inspector-title{margin:1px 0 3px;font-size:17px;line-height:24px}.ima-inspector-title-row{display:flex;align-items:center;gap:12px;min-width:0}.ima-inspector-title-row .ima-inspector-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:0}.ima-inspector-title-row .ima-inspector-status{flex:none;white-space:nowrap;font-size:11px}.ima-inspector-head-copy>.ima-account-id{margin-top:5px}
|
|
554
982
|
.ima-inspector-status{flex:none}
|
|
555
983
|
.ima-form{display:flex;flex-direction:column;gap:16px;padding-top:20px}
|
|
556
984
|
.ima-command-permissions{min-width:0;margin:0;padding:0;border:0}
|
|
557
|
-
.ima-diagnostic-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.ima-inspector-title-row .
|
|
558
|
-
.ima-inspector-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:
|
|
559
|
-
.ima-account-
|
|
560
|
-
.ima-
|
|
985
|
+
.ima-diagnostic-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.ima-inspector-title-row .ima-tag{margin-inline-end:0}.ima-bind-modal .ima-segmented{width:100%;margin:0 0 16px}.ima-bind-modal .ima-alert{margin-bottom:12px}.ima-connection-check{display:grid;gap:6px;padding:12px;border:1px solid var(--ima-line);border-radius:8px;font-size:12px;line-height:1.6;overflow-wrap:anywhere;color:var(--ima-muted)}.ima-connection-check strong{color:var(--ima-text)}.ima-diagnostic-item{padding:8px 0;border-top:1px solid var(--ima-line)}
|
|
986
|
+
.ima-inspector-actions{display:flex!important;flex-wrap:wrap!important;align-items:center!important;justify-content:flex-end!important;gap:8px!important;margin-top:16px!important;padding-top:16px!important;padding-bottom:4px!important}
|
|
987
|
+
.ima-account-modal .ima-inspector{padding:0 0 16px 0}
|
|
988
|
+
.ima-bind-modal,.ima-account-modal{width:min(720px,100%) !important;max-height:100%}
|
|
989
|
+
.ima-account-settings{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 16px;width:100%;box-sizing:border-box}
|
|
990
|
+
.ima-account-settings.compact{grid-template-columns:1fr}
|
|
991
|
+
.ima-picker-field{display:flex;min-width:0;width:100%;flex-direction:column;gap:6px;box-sizing:border-box}
|
|
992
|
+
.ima-picker-field.wide,.ima-picker-note,.ima-model-effort{grid-column:1/-1}
|
|
993
|
+
.ima-model-effort{display:grid;grid-template-columns:1fr 1fr;gap:14px 16px;min-width:0;width:100%;box-sizing:border-box}
|
|
994
|
+
.ima-account-settings.compact .ima-model-effort{grid-template-columns:1fr}
|
|
995
|
+
.ima-picker-label{color:var(--dsw-alias-label-secondary,var(--ima-muted));font-size:12px;font-weight:550;line-height:16px}
|
|
996
|
+
.ima-picker-note{color:var(--dsw-alias-label-tertiary,var(--ima-muted));font-size:11px;line-height:1.6;margin-top:2px}
|
|
997
|
+
.ima-picker-note.warning{color:var(--ima-warning)}
|
|
561
998
|
.ima-save-note{color:var(--ima-muted);font-size:11px}.ima-save-note.ok{color:var(--ima-ok)}
|
|
562
|
-
.ima-
|
|
999
|
+
.ima-bind-modal .ima-setup-section{padding:16px!important;margin:0 0 16px!important;border-radius:var(--dsw-radius-md,12px)!important;background:var(--dsw-alias-bg-layer-2,rgba(128,128,128,.04))!important;border:0.5px solid var(--dsw-alias-border-l1,rgba(255,255,255,.06))!important}
|
|
1000
|
+
.ima-bind-ready{display:flex!important;flex-direction:column!important;align-items:center!important;gap:14px!important;padding:20px 16px!important;border-radius:var(--dsw-radius-md,12px)!important;background:var(--dsw-alias-bg-layer-2,rgba(128,128,128,.04))!important;border:0.5px solid var(--dsw-alias-border-l1,rgba(255,255,255,.06))!important}
|
|
1001
|
+
.ima-bind-ready .ima-btn{min-width:140px!important;height:36px!important}
|
|
563
1002
|
.ima-account-picker{width:100%}
|
|
1003
|
+
.ima-enable-switch{box-sizing:border-box;position:relative;flex:0 0 auto;width:36px;height:20px;padding:2px;border:0;border-radius:999px;corner-shape:round;background:var(--dsw-alias-border-l3,#555);cursor:pointer}
|
|
1004
|
+
.ima-enable-switch[aria-checked=true]{background:var(--dsw-alias-brand-primary)}
|
|
1005
|
+
.ima-enable-switch:disabled{cursor:default;opacity:.5}
|
|
1006
|
+
.ima-enable-switch:focus-visible{outline:var(--dsw-focus-ring-width,1px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}
|
|
1007
|
+
.ima-enable-switch-thumb{display:block;width:16px;height:16px;border-radius:50%;corner-shape:round;background:var(--dsw-alias-label-primary-foreground,#fff);transition:transform 120ms ease;pointer-events:none}
|
|
1008
|
+
.ima-enable-switch[aria-checked=false] .ima-enable-switch-thumb{background:var(--dsw-alias-switch-thumb,#fff)}
|
|
1009
|
+
.ima-enable-switch[aria-checked=true] .ima-enable-switch-thumb{transform:translateX(16px)}
|
|
1010
|
+
.ima-menu-select-wrap,.ima-menu-select-wrap > *,.ima-menu-select-wrap span[class*="_root_"],.ima-menu-select-wrap .ima-menu-select-trigger,.ima-account-picker{display:flex!important;width:100%!important;min-width:0!important;box-sizing:border-box!important}
|
|
1011
|
+
.ima-menu-select-trigger{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:6px!important;width:100%!important;height:36px!important;padding:0 12px!important;border:0.5px solid var(--dsw-alias-border-l2,#494949)!important;border-radius:var(--dsw-radius-sm,8px)!important;background:var(--dsw-alias-bg-layer-1,transparent)!important;color:var(--dsw-alias-label-primary,#eee)!important;font:inherit!important;font-size:13px!important;cursor:pointer!important;user-select:none!important;box-sizing:border-box!important;transition:border-color 120ms ease,background 120ms ease!important}
|
|
1012
|
+
.ima-menu-select-trigger:hover:not(:disabled){border-color:var(--dsw-alias-border-l3,#666)!important;background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))!important}
|
|
1013
|
+
.ima-menu-select-trigger.is-open{border-color:var(--dsw-alias-brand-primary,#4b7cff)!important;outline:var(--dsw-focus-ring-width,1px) solid var(--dsw-focus-ring-color,var(--dsw-alias-brand-primary,#4b7cff))!important}
|
|
1014
|
+
.ima-menu-select-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;text-align:left}
|
|
1015
|
+
.ima-menu-select-arrow{flex:none;opacity:0.6}
|
|
1016
|
+
.ima-btn-spinner{display:inline-block;vertical-align:-2px;animation:ima-spin 0.8s linear infinite}
|
|
1017
|
+
@keyframes ima-spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
|
|
1018
|
+
.ima-btn-danger{color:var(--dsw-alias-state-error-primary,var(--ima-danger))!important;border-color:var(--dsw-alias-state-error-primary,var(--ima-danger))!important}
|
|
1019
|
+
.ima-btn-danger:hover:not(:disabled){color:var(--dsw-alias-state-error-primary,var(--ima-danger))!important;border-color:var(--dsw-alias-state-error-primary,var(--ima-danger))!important;background:rgba(239,68,68,.12)!important}
|
|
1020
|
+
.ima-btn-danger-primary,.ima-btn-danger.ima-btn-danger-primary{background:var(--dsw-alias-state-error-primary,var(--ima-danger))!important;border-color:var(--dsw-alias-state-error-primary,var(--ima-danger))!important;color:#fff!important}
|
|
564
1021
|
@container (max-width:480px){.ima-account-row{grid-template-columns:minmax(0,1fr) auto auto;gap:8px;padding:10px}.ima-account-receive>span{display:none}.ima-platform-head{padding:10px 12px}.ima-account-list{padding:0 12px 12px}}
|
|
565
1022
|
|
|
566
1023
|
`;
|
|
@@ -936,10 +1393,32 @@ window.__ModuleLoader__.load({
|
|
|
936
1393
|
}
|
|
937
1394
|
return false;
|
|
938
1395
|
}
|
|
1396
|
+
function parsePickedPath(value) {
|
|
1397
|
+
if (typeof value === "string" && value.trim() !== "") return value;
|
|
1398
|
+
if (value === null || typeof value !== "object") return undefined;
|
|
1399
|
+
if (value.canceled === true) return undefined;
|
|
1400
|
+
if (typeof value.path === "string" && value.path.trim() !== "") return value.path;
|
|
1401
|
+
const first = Array.isArray(value.filePaths) ? value.filePaths[0] : undefined;
|
|
1402
|
+
return typeof first === "string" && first.trim() !== "" ? first : undefined;
|
|
1403
|
+
}
|
|
939
1404
|
function pickHostDirectory(ctx) {
|
|
1405
|
+
const host = typeof globalThis !== "undefined" ? globalThis.__DSH_DIRECTORY_PICKER__ : undefined;
|
|
1406
|
+
if (host && typeof host.pick === "function") {
|
|
1407
|
+
return Promise.resolve(host.pick()).then(parsePickedPath);
|
|
1408
|
+
}
|
|
940
1409
|
const uiWorkspace = probeService(ctx, "uiWorkspace");
|
|
941
|
-
if (uiWorkspace && typeof uiWorkspace.pickDirectory === "function") return uiWorkspace.pickDirectory();
|
|
942
|
-
|
|
1410
|
+
if (uiWorkspace && typeof uiWorkspace.pickDirectory === "function") return Promise.resolve(uiWorkspace.pickDirectory()).then(parsePickedPath);
|
|
1411
|
+
const dialog = probeService(ctx, "dialog");
|
|
1412
|
+
if (dialog && typeof dialog.pickDirectory === "function") return Promise.resolve(dialog.pickDirectory()).then(parsePickedPath);
|
|
1413
|
+
if (ctx && ctx.workspaces && typeof ctx.workspaces.pickDirectory === "function") return Promise.resolve(ctx.workspaces.pickDirectory()).then(parsePickedPath);
|
|
1414
|
+
// 全部来源都不可用时必须显式拒绝:调用方据此提示“当前 Host 无法新增工作区”,
|
|
1415
|
+
// 否则点击“添加工作区…”会静默无响应(取消选择由 resolve(undefined) 表示,二者不能混淆)。
|
|
1416
|
+
return Promise.reject(workspacePickerUnavailable());
|
|
1417
|
+
}
|
|
1418
|
+
function workspacePickerUnavailable() {
|
|
1419
|
+
const error = new Error("workspace picker unavailable");
|
|
1420
|
+
error.code = "workspace/picker-unavailable";
|
|
1421
|
+
return error;
|
|
943
1422
|
}
|
|
944
1423
|
function activeSessionRefusal(error) {
|
|
945
1424
|
const reason = error && (error.reason || error);
|
|
@@ -1154,6 +1633,7 @@ window.__ModuleLoader__.load({
|
|
|
1154
1633
|
onCloseRef.current = onClose;
|
|
1155
1634
|
useEffect(() => {
|
|
1156
1635
|
const onKeyDown = (event) => {
|
|
1636
|
+
if (modalLayers.length && modalLayers[modalLayers.length - 1].owner !== "bind") return;
|
|
1157
1637
|
if (event.key !== "Escape") return;
|
|
1158
1638
|
event.preventDefault();
|
|
1159
1639
|
event.stopPropagation();
|
|
@@ -1208,14 +1688,17 @@ window.__ModuleLoader__.load({
|
|
|
1208
1688
|
open: true,
|
|
1209
1689
|
className: "ima-bind-modal",
|
|
1210
1690
|
title: t("bind.title", { channel: channelLabel(ch, t) }),
|
|
1211
|
-
width:
|
|
1691
|
+
width: 720,
|
|
1212
1692
|
zIndex: 1100,
|
|
1213
1693
|
destroyOnHidden: true,
|
|
1694
|
+
layerOwner: "bind",
|
|
1214
1695
|
maskClosable: !saving,
|
|
1215
|
-
keyboard: false,
|
|
1216
1696
|
onCancel: close,
|
|
1217
1697
|
footer: tab === "manual" && hasManual
|
|
1218
|
-
?
|
|
1698
|
+
? h("div", { className: "ima-modal-actions" },
|
|
1699
|
+
hostModalButton(t("action.cancel"), close, "outline", { disabled: busy }),
|
|
1700
|
+
hostModalButton(busy ? t("action.saving") : t("action.confirm"), saveManual, "primary", { disabled: busy || !workspaceIsListed(settings.cwd, workspaces) }),
|
|
1701
|
+
)
|
|
1219
1702
|
: null,
|
|
1220
1703
|
},
|
|
1221
1704
|
hasQr && hasManual && h(Segmented, {
|
|
@@ -1264,13 +1747,13 @@ window.__ModuleLoader__.load({
|
|
|
1264
1747
|
remain > 0 && h("p", { className: "ima-hint" }, t("bind.expire", { time: Math.floor(remain / 60) + ":" + String(remain % 60).padStart(2, "0") })),
|
|
1265
1748
|
status === "scanned" && h("p", { className: "ima-hint" }, t("bind.scanned")),
|
|
1266
1749
|
(status === "expired" || status === "failed") && h("p", { className: "ima-error" }, serverText(pairing && pairing.error, t) || t("bind.retry")),
|
|
1267
|
-
|
|
1750
|
+
hostModalButton(t("bind.refresh"), () => startQr(true), "outline", { disabled: busy }),
|
|
1268
1751
|
)
|
|
1269
1752
|
: h("div", { className: "ima-bind-ready" },
|
|
1270
1753
|
h("p", { className: "ima-hint" }, hintOf(ch, t)),
|
|
1271
1754
|
(busy || status === "starting") && h("div", { className: "ima-bind-status" }, t("bind.generating")),
|
|
1272
1755
|
(status === "expired" || status === "failed") && h("div", { className: "ima-error" }, serverText(pairing && pairing.error, t) || t("bind.retry")),
|
|
1273
|
-
|
|
1756
|
+
hostModalButton(busy ? t("bind.generating") : qrStarted ? t("bind.refresh") : t("action.generateQr"), () => startQr(qrStarted), "primary", { disabled: busy || !workspaceIsListed(settings.cwd, workspaces) || !settings.provider || !settings.model || !settings.permission }),
|
|
1274
1757
|
)
|
|
1275
1758
|
),
|
|
1276
1759
|
tab === "manual" && hasManual && h("div", null,
|
|
@@ -1325,8 +1808,6 @@ window.__ModuleLoader__.load({
|
|
|
1325
1808
|
const permissionT = props.permissionT || ((key) => key);
|
|
1326
1809
|
const presetT = props.presetT || ((key) => key);
|
|
1327
1810
|
const value = props.value || {};
|
|
1328
|
-
const [adding, setAdding] = useState(false);
|
|
1329
|
-
const [addPath, setAddPath] = useState("");
|
|
1330
1811
|
const [addBusy, setAddBusy] = useState(false);
|
|
1331
1812
|
const [hint, setHint] = useState("");
|
|
1332
1813
|
const [confirmingFullAccess, setConfirmingFullAccess] = useState(false);
|
|
@@ -1382,21 +1863,31 @@ window.__ModuleLoader__.load({
|
|
|
1382
1863
|
return Promise.resolve(props.createWorkspace({ path: next })).then((created) => {
|
|
1383
1864
|
const cwdPath = (created && (created.path || created.cwd)) || next;
|
|
1384
1865
|
update({ cwd: cwdPath });
|
|
1385
|
-
setAdding(false);
|
|
1386
|
-
setAddPath("");
|
|
1387
1866
|
}).catch((error) => setHint((error && error.message) || t("error.addWorkspace")))
|
|
1388
1867
|
.finally(() => setAddBusy(false));
|
|
1389
1868
|
};
|
|
1390
1869
|
const onAddWorkspace = () => {
|
|
1391
1870
|
setHint("");
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
// Web 宿主可能返回空路径;始终保留可见的手动输入入口。
|
|
1396
|
-
return Promise.resolve().then(() => props.pickDirectory()).then(picked => {
|
|
1397
|
-
if (typeof picked === "string" && picked.trim()) return addWorkspace(picked);
|
|
1398
|
-
}).catch(() => { setAdding(true); });
|
|
1871
|
+
if (typeof props.pickDirectory !== "function") {
|
|
1872
|
+
setHint(t("error.workspaceUnavailable"));
|
|
1873
|
+
return Promise.resolve();
|
|
1399
1874
|
}
|
|
1875
|
+
setAddBusy(true);
|
|
1876
|
+
return Promise.resolve()
|
|
1877
|
+
.then(() => props.pickDirectory())
|
|
1878
|
+
.then((picked) => {
|
|
1879
|
+
if (typeof picked === "string" && picked.trim()) {
|
|
1880
|
+
return addWorkspace(picked);
|
|
1881
|
+
}
|
|
1882
|
+
})
|
|
1883
|
+
.catch((error) => {
|
|
1884
|
+
setHint(error && error.code === "workspace/picker-unavailable"
|
|
1885
|
+
? t("error.workspaceUnavailable")
|
|
1886
|
+
: (error && error.message) || t("error.addWorkspace"));
|
|
1887
|
+
})
|
|
1888
|
+
.finally(() => {
|
|
1889
|
+
setAddBusy(false);
|
|
1890
|
+
});
|
|
1400
1891
|
};
|
|
1401
1892
|
const selectPermission = (next) => {
|
|
1402
1893
|
if (next === permission) return;
|
|
@@ -1415,7 +1906,7 @@ window.__ModuleLoader__.load({
|
|
|
1415
1906
|
return h("div", { className: "ima-account-settings" + (props.compact ? " compact" : "") },
|
|
1416
1907
|
field("workspace", props.workspaceLabel || t("account.workspace"), items.length === 0
|
|
1417
1908
|
? h("div", null,
|
|
1418
|
-
h(Button, { type: "primary", icon: h(PlusIcon), onClick: onAddWorkspace }, t("composer.addWorkspace")),
|
|
1909
|
+
h(Button, { type: "primary", icon: h(PlusIcon), disabled: addBusy, onClick: onAddWorkspace }, t("composer.addWorkspace")),
|
|
1419
1910
|
h("div", { className: "ima-picker-note warning" }, t("composer.workspaceRequired")),
|
|
1420
1911
|
)
|
|
1421
1912
|
: h(Select, {
|
|
@@ -1425,13 +1916,10 @@ window.__ModuleLoader__.load({
|
|
|
1425
1916
|
"aria-label": props.workspaceLabel || t("account.workspace"),
|
|
1426
1917
|
popupMatchSelectWidth: false,
|
|
1427
1918
|
options: items.map((item) => ({ value: item.path, label: item.title || item.path })),
|
|
1919
|
+
footer: [{ value: "add-workspace", label: t("composer.addWorkspace"), disabled: addBusy }],
|
|
1920
|
+
onFooter: () => { onAddWorkspace(); },
|
|
1428
1921
|
notFoundContent: t("composer.noWorkspaces"),
|
|
1429
1922
|
onChange: (next) => update({ cwd: next }),
|
|
1430
|
-
dropdownRender: (menu) => h("div", null,
|
|
1431
|
-
menu,
|
|
1432
|
-
h("div", { style: { height: 1, margin: "6px 8px", background: "var(--dsw-alias-border-l2,rgba(255,255,255,.1))" } }),
|
|
1433
|
-
h(Button, { type: "link", icon: h(PlusIcon), onClick: onAddWorkspace }, t("composer.addWorkspace")),
|
|
1434
|
-
),
|
|
1435
1923
|
})),
|
|
1436
1924
|
field("agentPreset", presetT("nav"), h(Select, {
|
|
1437
1925
|
className: "ima-account-picker",
|
|
@@ -1497,20 +1985,9 @@ window.__ModuleLoader__.load({
|
|
|
1497
1985
|
privateAccess === "all" && h("div", { className: "ima-picker-note warning" }, t("settings.publicChatNotice")),
|
|
1498
1986
|
hint && h("div", { className: "ima-picker-note" }, hint),
|
|
1499
1987
|
props.showAutoNameNote && h("div", { className: "ima-picker-note" }, t("account.autoNameNote")),
|
|
1500
|
-
h(Modal, {
|
|
1501
|
-
open: adding,
|
|
1502
|
-
title: t("composer.addWorkspace"),
|
|
1503
|
-
onCancel: () => { setAdding(false); setAddPath(""); },
|
|
1504
|
-
onOk: () => addWorkspace(addPath),
|
|
1505
|
-
okButtonProps: { disabled: addBusy || !addPath.trim() },
|
|
1506
|
-
confirmLoading: addBusy,
|
|
1507
|
-
okText: addBusy ? t("action.adding") : t("action.confirm"),
|
|
1508
|
-
cancelText: t("action.cancel"),
|
|
1509
|
-
},
|
|
1510
|
-
h(Input, { autoFocus: true, value: addPath, placeholder: t("composer.workspacePath"), "aria-label": t("composer.workspacePath"), onChange: (event) => setAddPath(event.target.value) }),
|
|
1511
|
-
),
|
|
1512
1988
|
h(Modal, {
|
|
1513
1989
|
open: confirmingFullAccess,
|
|
1990
|
+
layerOwner: "full-access",
|
|
1514
1991
|
title: permissionT("confirm.title"),
|
|
1515
1992
|
keyboard: false,
|
|
1516
1993
|
maskClosable: false,
|
|
@@ -1680,15 +2157,14 @@ window.__ModuleLoader__.load({
|
|
|
1680
2157
|
h(CommandPermissionSettings, { value: draft.commandPermissions, onSave: commandPermissions => save({ commandPermissions }), t }),
|
|
1681
2158
|
note && h("div", { className: note === "status.saved" ? "ima-save-note ok" : "ima-save-note" }, t(note)),
|
|
1682
2159
|
h("div", { className: "ima-inspector-actions" },
|
|
1683
|
-
h(Button, { disabled: Boolean(busy) || checking, onClick: check }, t(checking ? "connection.checking" : "action.checkConnection")),
|
|
1684
|
-
h(Button, { disabled: Boolean(busy) || checking, onClick: () => { setCheckResult(null); return onAction(account.id, "reconnect"); } }, t("action.reconnectAccount")),
|
|
1685
|
-
h(Button, {
|
|
2160
|
+
h(Button, { variant: "outline", disabled: Boolean(busy) || checking, onClick: check }, t(checking ? "connection.checking" : "action.checkConnection")),
|
|
2161
|
+
h(Button, { variant: "outline", disabled: Boolean(busy) || checking, onClick: () => { setCheckResult(null); return onAction(account.id, "reconnect"); } }, t("action.reconnectAccount")),
|
|
2162
|
+
h(Button, { variant: "outline", disabled: Boolean(busy) || checking, onClick: () => {
|
|
1686
2163
|
modal.confirm({
|
|
1687
2164
|
title: t("action.removeAccount"),
|
|
1688
|
-
|
|
2165
|
+
description: t("account.removeConfirm"),
|
|
1689
2166
|
okText: t("action.removeAccount"),
|
|
1690
2167
|
cancelText: t("action.cancel"),
|
|
1691
|
-
okButtonProps: { danger: true },
|
|
1692
2168
|
onOk: () => onAction(account.id, "remove"),
|
|
1693
2169
|
});
|
|
1694
2170
|
} }, t("action.removeAccount")),
|
|
@@ -1769,6 +2245,11 @@ window.__ModuleLoader__.load({
|
|
|
1769
2245
|
h("path", { fill: "currentColor", d: "M8 0a8 8 0 0 0-2.53 15.59c.4.074.547-.173.547-.385 0-.19-.007-.693-.01-1.36-2.226.484-2.695-1.073-2.695-1.073-.364-.924-.89-1.17-.89-1.17-.726-.496.055-.486.055-.486.803.056 1.225.824 1.225.824.714 1.223 1.872.87 2.328.665.072-.517.28-.87.508-1.07-1.777-.202-3.645-.888-3.645-3.956 0-.874.31-1.588.823-2.148-.083-.202-.357-1.017.078-2.12 0 0 .672-.215 2.2.82A7.65 7.65 0 0 1 8 4.8c.68.003 1.365.092 2.004.27 1.527-1.035 2.197-.82 2.197-.82.437 1.103.162 1.918.08 2.12.513.56.822 1.274.822 2.148 0 3.076-1.872 3.752-3.654 3.95.288.248.544.735.544 1.482 0 1.07-.01 1.932-.01 2.195 0 .214.144.463.55.384A8.001 8.001 0 0 0 8 0Z" }),
|
|
1770
2246
|
);
|
|
1771
2247
|
}
|
|
2248
|
+
function FeedbackIcon() {
|
|
2249
|
+
return h("svg", { viewBox: "0 0 16 16", width: 16, height: 16, "aria-hidden": true, focusable: "false" },
|
|
2250
|
+
h("path", { fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", d: "M9.5 2.5 13.5 6.5 6 14H2v-4z" }),
|
|
2251
|
+
);
|
|
2252
|
+
}
|
|
1772
2253
|
|
|
1773
2254
|
function SettingsPage(props) {
|
|
1774
2255
|
const t = props.t || fallbackT;
|
|
@@ -1817,8 +2298,9 @@ window.__ModuleLoader__.load({
|
|
|
1817
2298
|
useEffect(() => {
|
|
1818
2299
|
if (!settingsAccount) return undefined;
|
|
1819
2300
|
const onKey = (event) => {
|
|
2301
|
+
if (modalLayers.length && modalLayers[modalLayers.length - 1].owner !== "settings-account") return;
|
|
1820
2302
|
if (event.key !== "Escape") return;
|
|
1821
|
-
if (document.querySelector(".
|
|
2303
|
+
if (document.querySelector("[role='listbox'], [role='menu'], .ima-menu-select-dropdown")) return;
|
|
1822
2304
|
event.preventDefault();
|
|
1823
2305
|
event.stopPropagation();
|
|
1824
2306
|
if (typeof event.stopImmediatePropagation === "function") event.stopImmediatePropagation();
|
|
@@ -1887,8 +2369,20 @@ window.__ModuleLoader__.load({
|
|
|
1887
2369
|
h("div", { className: "ima-title-row" },
|
|
1888
2370
|
h("h2", { className: "ima-title" }, t("settings.title")),
|
|
1889
2371
|
h("div", { className: "ima-title-links" },
|
|
1890
|
-
h(
|
|
1891
|
-
|
|
2372
|
+
h(PrimitiveButton, {
|
|
2373
|
+
variant: "outline",
|
|
2374
|
+
size: "sm",
|
|
2375
|
+
"aria-label": t("settings.viewProject"),
|
|
2376
|
+
icon: h(GithubMark16),
|
|
2377
|
+
onClick: () => { window.open("https://github.com/MichengAI/dsh-im-connect", "_blank", "noreferrer"); }
|
|
2378
|
+
}, t("settings.viewProject")),
|
|
2379
|
+
h(PrimitiveButton, {
|
|
2380
|
+
variant: "outline",
|
|
2381
|
+
size: "sm",
|
|
2382
|
+
"aria-label": t("settings.feedback"),
|
|
2383
|
+
icon: h(FeedbackIcon),
|
|
2384
|
+
onClick: () => { window.open("https://github.com/MichengAI/dsh-im-connect/issues", "_blank", "noreferrer"); }
|
|
2385
|
+
}, t("settings.feedback")),
|
|
1892
2386
|
),
|
|
1893
2387
|
),
|
|
1894
2388
|
h("p", { className: "ima-sub" }, t("settings.description")),
|
|
@@ -1928,8 +2422,10 @@ window.__ModuleLoader__.load({
|
|
|
1928
2422
|
...(ch.accounts || []).map((account) => h("div", { key: account.id, className: "ima-account-row" },
|
|
1929
2423
|
h("span", { className: "ima-account-copy" }, h(AccountRemarkEditor, { account, t, disabled: Boolean(busy[account.id]), onSave: (name) => onAction(account.id, "settings", { name }) })),
|
|
1930
2424
|
h(Tag, {
|
|
1931
|
-
color: busy[account.id] ? "
|
|
2425
|
+
color: busy[account.id] ? "processing" : account.receiveConfigured === false ? "warning" : account.connectionState === "connected" ? "success" : "warning",
|
|
1932
2426
|
bordered: false,
|
|
2427
|
+
className: "ima-account-status-tag" + (busy[account.id] ? " is-busy" : ""),
|
|
2428
|
+
icon: busy[account.id] ? createSpinner() : undefined,
|
|
1933
2429
|
}, busy[account.id] ? t("account.statusProcessing") : t(account.receiveConfigured === false ? "connection.paused" : "connection." + (account.connectionState || "unknown"))),
|
|
1934
2430
|
h("div", { className: "ima-account-receive", title: t("account.receiveDescription") },
|
|
1935
2431
|
h("span", null, t("account.receive")),
|
|
@@ -1945,10 +2441,10 @@ window.__ModuleLoader__.load({
|
|
|
1945
2441
|
open: true,
|
|
1946
2442
|
className: "ima-account-modal",
|
|
1947
2443
|
title: t("action.settings"),
|
|
1948
|
-
width:
|
|
2444
|
+
width: 720,
|
|
1949
2445
|
zIndex: 1100,
|
|
2446
|
+
layerOwner: "settings-account",
|
|
1950
2447
|
destroyOnHidden: true,
|
|
1951
|
-
keyboard: false,
|
|
1952
2448
|
onCancel: () => setSettingsAccount(null),
|
|
1953
2449
|
footer: null,
|
|
1954
2450
|
},
|
|
@@ -2044,11 +2540,8 @@ window.__ModuleLoader__.load({
|
|
|
2044
2540
|
.ima-n-menu button.danger:hover{background:var(--dsw-alias-interactive-bg-hover-danger,rgba(248,81,73,.12))}
|
|
2045
2541
|
.ima-n-rename{flex:1;min-width:0;margin:0 6px 0 4px;border:.5px solid var(--dsw-alias-border-l4);border-radius:4px;outline:none;background:var(--dsw-alias-button-elevated-fill,rgba(255,255,255,.04));color:inherit;padding:0 2px;font-size:14px;line-height:20px}
|
|
2046
2542
|
.ima-n-dialog-actions{display:flex;justify-content:flex-end;gap:8px}
|
|
2047
|
-
.ima-n-dialog-copy{margin:0;color:var(--dsw-alias-label-secondary);font-size:14px;line-height:22px}
|
|
2048
2543
|
.ima-n-dialog-status{margin-top:12px;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}
|
|
2049
2544
|
.ima-n-dialog-error{margin-top:12px;color:var(--dsw-alias-state-error-primary,#f85149);font-size:13px;line-height:20px}
|
|
2050
|
-
.ima-n-danger-button{color:var(--dsw-alias-state-error-primary,#f85149)!important}
|
|
2051
|
-
.ima-n-danger-button:hover{background:var(--dsw-alias-interactive-bg-hover-danger,rgba(248,81,73,.12))!important}
|
|
2052
2545
|
.ima-n-restore{flex:none;border:0;background:transparent;color:var(--dsw-alias-label-secondary,#c9cdd4);font:12px/16px inherit;padding:2px 4px;cursor:pointer}`;
|
|
2053
2546
|
|
|
2054
2547
|
function NativeSvg(viewBox, size, children) {
|
|
@@ -2747,45 +3240,48 @@ window.__ModuleLoader__.load({
|
|
|
2747
3240
|
}),
|
|
2748
3241
|
),
|
|
2749
3242
|
),
|
|
2750
|
-
h(
|
|
3243
|
+
h(Modal, {
|
|
2751
3244
|
open: !!archiveGroupTarget,
|
|
3245
|
+
layerOwner: "sidebar-archive",
|
|
2752
3246
|
onClose: () => { if (!archiveGroupBusy) { setArchiveGroupTarget(undefined); setArchiveGroupError(undefined); } },
|
|
2753
3247
|
closeLabel: t("rail.archiveGroupClose"),
|
|
2754
3248
|
title: t("rail.archiveGroup"),
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
3249
|
+
description: archiveGroupTarget ? t("rail.archiveGroupDescription", { name: archiveGroupTarget.name, count: archiveGroupTarget.sessionIds.length }) : "",
|
|
3250
|
+
footer: h(React.Fragment, null,
|
|
3251
|
+
hostModalButton(t("rail.archiveGroupCancel"), () => { setArchiveGroupTarget(undefined); setArchiveGroupError(undefined); }, "outline", { disabled: archiveGroupBusy }),
|
|
3252
|
+
hostModalButton(t("rail.archiveGroupConfirm"), confirmArchiveGroup, "primary", { disabled: archiveGroupBusy }),
|
|
2758
3253
|
),
|
|
2759
3254
|
},
|
|
2760
|
-
h("p", { className: "ima-n-dialog-copy" }, archiveGroupTarget ? t("rail.archiveGroupDescription", { name: archiveGroupTarget.name, count: archiveGroupTarget.sessionIds.length }) : ""),
|
|
2761
3255
|
archiveGroupBusy && h("div", { className: "ima-n-dialog-status", role: "status" }, t("rail.archiveGroupPending")),
|
|
2762
3256
|
archiveGroupError && h("div", { className: "ima-n-dialog-error", role: "alert" }, t("rail.archiveGroupFailed", { message: archiveGroupError })),
|
|
2763
3257
|
),
|
|
2764
|
-
h(
|
|
3258
|
+
h(Modal, {
|
|
2765
3259
|
open: !!stopArchiveTarget,
|
|
3260
|
+
layerOwner: "sidebar-stop",
|
|
2766
3261
|
onClose: () => { if (!stopArchiveBusy) { setStopArchiveTarget(undefined); setStopArchiveError(undefined); } },
|
|
2767
3262
|
closeLabel: t("action.cancel"),
|
|
2768
3263
|
title: t("rail.stopArchive"),
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
3264
|
+
description: stopArchiveTarget ? t(stopArchiveTarget.group ? "rail.stopArchiveGroupDescription" : "rail.stopArchiveDescription", { name: stopArchiveTarget.title }) : "",
|
|
3265
|
+
footer: h(React.Fragment, null,
|
|
3266
|
+
hostModalButton(t("action.cancel"), () => { setStopArchiveTarget(undefined); setStopArchiveError(undefined); }, "outline", { disabled: stopArchiveBusy }),
|
|
3267
|
+
hostModalButton(t("rail.stopArchiveConfirm"), confirmStopArchive, "primary", { disabled: stopArchiveBusy }),
|
|
2772
3268
|
),
|
|
2773
3269
|
},
|
|
2774
|
-
h("p", { className: "ima-n-dialog-copy" }, stopArchiveTarget ? t(stopArchiveTarget.group ? "rail.stopArchiveGroupDescription" : "rail.stopArchiveDescription", { name: stopArchiveTarget.title }) : ""),
|
|
2775
3270
|
stopArchiveBusy && h("div", { className: "ima-n-dialog-status", role: "status" }, t("rail.stopArchivePending")),
|
|
2776
3271
|
stopArchiveError && h("div", { className: "ima-n-dialog-error", role: "alert" }, t("rail.archiveFailed")),
|
|
2777
3272
|
),
|
|
2778
|
-
h(
|
|
3273
|
+
h(Modal, {
|
|
2779
3274
|
open: !!deleteTarget,
|
|
3275
|
+
layerOwner: "sidebar-delete",
|
|
2780
3276
|
onClose: () => { if (!deleteBusy) { setDeleteTarget(undefined); setDeleteError(undefined); } },
|
|
2781
3277
|
closeLabel: t("rail.deleteSessionClose"),
|
|
2782
3278
|
title: t("rail.deleteSession"),
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
3279
|
+
description: deleteTarget ? t("rail.deleteSessionDescription", { name: deleteTarget.title }) : "",
|
|
3280
|
+
footer: h(React.Fragment, null,
|
|
3281
|
+
hostModalButton(t("rail.deleteSessionCancel"), () => { setDeleteTarget(undefined); setDeleteError(undefined); }, "outline", { disabled: deleteBusy }),
|
|
3282
|
+
hostModalButton(t("rail.deleteSessionConfirm"), confirmDelete, "primary", { disabled: deleteBusy }),
|
|
2786
3283
|
),
|
|
2787
3284
|
},
|
|
2788
|
-
h("p", { className: "ima-n-dialog-copy" }, deleteTarget ? t("rail.deleteSessionDescription", { name: deleteTarget.title }) : ""),
|
|
2789
3285
|
deleteBusy && h("div", { className: "ima-n-dialog-status", role: "status" }, t("rail.deleteSessionPending")),
|
|
2790
3286
|
deleteError && h("div", { className: "ima-n-dialog-error", role: "alert" }, t("rail.deleteSessionFailed", { message: deleteError })),
|
|
2791
3287
|
),
|
|
@@ -3149,15 +3645,15 @@ window.__ModuleLoader__.load({
|
|
|
3149
3645
|
};
|
|
3150
3646
|
function LocalizedChannelRail(props) {
|
|
3151
3647
|
useSyncExternalStore(subscribeLocale, localeSnapshot, localeSnapshot);
|
|
3152
|
-
return h(
|
|
3648
|
+
return h(HostThemeProvider, null, h(ChannelRail, Object.assign({}, props, { t, openChannelSettings })));
|
|
3153
3649
|
}
|
|
3154
3650
|
function LocalizedSessionSwitcher(props) {
|
|
3155
3651
|
useSyncExternalStore(subscribeLocale, localeSnapshot, localeSnapshot);
|
|
3156
|
-
return h(
|
|
3652
|
+
return h(HostThemeProvider, null, h(SessionSwitcher, Object.assign({}, props, { t, officialT: props.t, openChannelSettings })));
|
|
3157
3653
|
}
|
|
3158
3654
|
function LocalizedSettingsPage(props) {
|
|
3159
3655
|
useSyncExternalStore(subscribeLocale, localeSnapshot, localeSnapshot);
|
|
3160
|
-
return h(
|
|
3656
|
+
return h(HostThemeProvider, null, h(SettingsPage, Object.assign({}, props, { t, permissionT, modelT, presetT, readMainSessionModel: () => readMainSessionModel(ctx) })));
|
|
3161
3657
|
}
|
|
3162
3658
|
openImSession = (id) => {
|
|
3163
3659
|
try {
|
|
@@ -3166,6 +3662,95 @@ window.__ModuleLoader__.load({
|
|
|
3166
3662
|
try { return openHostSession(ctx, id); }
|
|
3167
3663
|
catch (error) { console.warn("[dsh-im-connect] 无法打开会话", id, error); return false; }
|
|
3168
3664
|
};
|
|
3665
|
+
|
|
3666
|
+
const NAV_ICON_MARKER = "data-ima-nav-icon";
|
|
3667
|
+
const NAV_ICON_ORIGINAL = "data-ima-nav-original";
|
|
3668
|
+
const NAV_ROW_SELECTOR = '[role="dialog"] nav button';
|
|
3669
|
+
const IM_NAV_PATHS = '<path fill="currentColor" d="M2.15 2.9h11.7v8.2H6.42L2.15 13.85V2.9Zm1.4 1.4v6.62l1.78-1.12h7.12V4.3H3.55Z"/>';
|
|
3670
|
+
|
|
3671
|
+
function isOwnNavRow(rowText, wantedLabel) {
|
|
3672
|
+
const wanted = String(wantedLabel ?? "").trim();
|
|
3673
|
+
if (wanted.length === 0) return false;
|
|
3674
|
+
const current = String(rowText ?? "").trim();
|
|
3675
|
+
return current === wanted;
|
|
3676
|
+
}
|
|
3677
|
+
|
|
3678
|
+
function applySettingsNavIcon(button, wantedLabel) {
|
|
3679
|
+
if (!isOwnNavRow(button.textContent, wantedLabel())) return false;
|
|
3680
|
+
const svg = button.querySelector("svg");
|
|
3681
|
+
if (!svg) return false;
|
|
3682
|
+
if (svg.getAttribute("data-ima-nav-icon") === "assistant") return false;
|
|
3683
|
+
|
|
3684
|
+
if (!svg.getAttribute(NAV_ICON_ORIGINAL)) {
|
|
3685
|
+
svg.setAttribute(NAV_ICON_ORIGINAL, JSON.stringify({
|
|
3686
|
+
innerHTML: svg.innerHTML,
|
|
3687
|
+
viewBox: svg.getAttribute("viewBox"),
|
|
3688
|
+
fill: svg.getAttribute("fill"),
|
|
3689
|
+
}));
|
|
3690
|
+
}
|
|
3691
|
+
svg.setAttribute("data-ima-nav-icon", "assistant");
|
|
3692
|
+
svg.setAttribute("viewBox", "0 0 16 16");
|
|
3693
|
+
svg.setAttribute("fill", "none");
|
|
3694
|
+
svg.innerHTML = IM_NAV_PATHS;
|
|
3695
|
+
button.setAttribute(NAV_ICON_MARKER, "");
|
|
3696
|
+
return true;
|
|
3697
|
+
}
|
|
3698
|
+
|
|
3699
|
+
function restoreSettingsNavIcon(button) {
|
|
3700
|
+
const svg = button.querySelector("svg");
|
|
3701
|
+
button.removeAttribute(NAV_ICON_MARKER);
|
|
3702
|
+
if (!svg) return false;
|
|
3703
|
+
const raw = svg.getAttribute(NAV_ICON_ORIGINAL);
|
|
3704
|
+
svg.removeAttribute("data-ima-nav-icon");
|
|
3705
|
+
svg.removeAttribute(NAV_ICON_ORIGINAL);
|
|
3706
|
+
if (!raw) return false;
|
|
3707
|
+
try {
|
|
3708
|
+
const saved = JSON.parse(raw);
|
|
3709
|
+
svg.innerHTML = saved.innerHTML;
|
|
3710
|
+
if (saved.viewBox == null) svg.removeAttribute("viewBox");
|
|
3711
|
+
else svg.setAttribute("viewBox", saved.viewBox);
|
|
3712
|
+
if (saved.fill == null) svg.removeAttribute("fill");
|
|
3713
|
+
else svg.setAttribute("fill", saved.fill);
|
|
3714
|
+
} catch { /* ignore */ }
|
|
3715
|
+
return true;
|
|
3716
|
+
}
|
|
3717
|
+
|
|
3718
|
+
function installSettingsNavIcon(targetCtx, resolveLabel) {
|
|
3719
|
+
if (typeof document === "undefined") return;
|
|
3720
|
+
targetCtx.effect(() => {
|
|
3721
|
+
let disposed = false;
|
|
3722
|
+
let scheduled = false;
|
|
3723
|
+
|
|
3724
|
+
const sync = () => {
|
|
3725
|
+
scheduled = false;
|
|
3726
|
+
if (disposed) return;
|
|
3727
|
+
for (const row of document.querySelectorAll(NAV_ROW_SELECTOR)) {
|
|
3728
|
+
applySettingsNavIcon(row, resolveLabel);
|
|
3729
|
+
}
|
|
3730
|
+
};
|
|
3731
|
+
|
|
3732
|
+
const schedule = () => {
|
|
3733
|
+
if (scheduled || disposed) return;
|
|
3734
|
+
scheduled = true;
|
|
3735
|
+
queueMicrotask(sync);
|
|
3736
|
+
};
|
|
3737
|
+
|
|
3738
|
+
sync();
|
|
3739
|
+
const observer = new MutationObserver(schedule);
|
|
3740
|
+
observer.observe(document.body, { childList: true, subtree: true, characterData: true });
|
|
3741
|
+
|
|
3742
|
+
return () => {
|
|
3743
|
+
disposed = true;
|
|
3744
|
+
observer.disconnect();
|
|
3745
|
+
for (const row of document.querySelectorAll(`[${NAV_ICON_MARKER}]`)) {
|
|
3746
|
+
restoreSettingsNavIcon(row);
|
|
3747
|
+
}
|
|
3748
|
+
};
|
|
3749
|
+
}, "im-connect: settings nav icon");
|
|
3750
|
+
}
|
|
3751
|
+
|
|
3752
|
+
installSettingsNavIcon(ctx, () => t("settings.label"));
|
|
3753
|
+
|
|
3169
3754
|
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
3170
3755
|
name: "settings.section",
|
|
3171
3756
|
id: "im-assistant",
|