dsh-use-chatgpt 1.0.0 → 1.0.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/README.md +3 -1
- package/dist/client.js +446 -229
- package/dist/index.js +107 -57
- package/docs/images/chatgpt-settings.png +0 -0
- package/package.json +2 -2
package/dist/client.js
CHANGED
|
@@ -25,13 +25,13 @@ __export(index_exports, {
|
|
|
25
25
|
inject: () => inject
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(index_exports);
|
|
28
|
-
var
|
|
28
|
+
var import_react5 = require("react");
|
|
29
29
|
var import_dsh_client_ui_primitives3 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
30
30
|
|
|
31
31
|
// package.json
|
|
32
32
|
var package_default = {
|
|
33
33
|
name: "dsh-use-chatgpt",
|
|
34
|
-
version: "1.0.
|
|
34
|
+
version: "1.0.2",
|
|
35
35
|
description: "ChatGPT plan model provider for a local DeepSeek Harness desktop instance",
|
|
36
36
|
type: "module",
|
|
37
37
|
engines: { node: "^22.19.0 || >=24.0.0" },
|
|
@@ -45,7 +45,7 @@ var package_default = {
|
|
|
45
45
|
"./client": "./dist/client.js",
|
|
46
46
|
"./package.json": "./package.json"
|
|
47
47
|
},
|
|
48
|
-
files: ["dist", "native/credential-key", "native/credential-key-universal", "cordis.patch.yml"],
|
|
48
|
+
files: ["dist", "docs/images/chatgpt-settings.png", "native/credential-key", "native/credential-key-universal", "cordis.patch.yml"],
|
|
49
49
|
dsh: {
|
|
50
50
|
bundle: { patch: "./cordis.patch.yml" },
|
|
51
51
|
client: {
|
|
@@ -319,8 +319,8 @@ function ModelCatalog({ t, language, resource, profileId }) {
|
|
|
319
319
|
)
|
|
320
320
|
] }),
|
|
321
321
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "cg-catalog-hint", children: words.hint }),
|
|
322
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { role: "alert", className: "dsh-use-chatgpt-error", children: t("modelsFailed") }),
|
|
323
|
-
|
|
322
|
+
error !== null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { role: "alert", className: "dsh-use-chatgpt-error", children: error || t("modelsFailed") }),
|
|
323
|
+
error === null && !models?.length && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { role: "status", children: t(models ? "modelsEmpty" : "modelsLoading") }),
|
|
324
324
|
models?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { className: "cg-model-list", "aria-labelledby": heading, children: models.map((model) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
325
325
|
ModelRow,
|
|
326
326
|
{
|
|
@@ -336,12 +336,201 @@ function ModelCatalog({ t, language, resource, profileId }) {
|
|
|
336
336
|
] });
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
+
// client/PluginRecommendations.jsx
|
|
340
|
+
var import_react2 = require("react");
|
|
341
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
342
|
+
var plugins = [
|
|
343
|
+
{
|
|
344
|
+
title: "dsh-free-model",
|
|
345
|
+
packageName: "@houyanchao/dsh-free-model",
|
|
346
|
+
description: "freeModelsDescription",
|
|
347
|
+
guide: "https://github.com/houyanchao/dsh-free-model#\u5728\u81EA\u7814-dsh-\u5BA2\u6237\u7AEF\u5B89\u88C5"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
title: "dsh-timeline",
|
|
351
|
+
packageName: "dsh-timeline",
|
|
352
|
+
description: "timelineDescription",
|
|
353
|
+
guide: "https://github.com/houyanchao/dsh-timeline#-\u5B89\u88C5"
|
|
354
|
+
},
|
|
355
|
+
{ title: "timeline", description: "browserDescription", stores: [
|
|
356
|
+
{ label: "chromeStore", href: "https://chromewebstore.google.com/detail/fgebdnlceacaiaeikopldglhffljjlhh" },
|
|
357
|
+
{ label: "edgeStore", href: "https://microsoftedge.microsoft.com/addons/detail/ekednjjojnhlajfobalaaihkibbdcbab" }
|
|
358
|
+
] }
|
|
359
|
+
];
|
|
360
|
+
function InstallButton({ plugin, installer, state, t }) {
|
|
361
|
+
const { packageName, title } = plugin;
|
|
362
|
+
let label = "installPlugin";
|
|
363
|
+
if (state.pending === packageName) label = "installingPlugin";
|
|
364
|
+
else if (state.inventory === "unavailable") label = "installUnavailable";
|
|
365
|
+
else if (state.inventory === "failed") label = "retryPlugins";
|
|
366
|
+
else if (state.inventory === "loading") label = "checkingPlugins";
|
|
367
|
+
else if (state.installed.has(packageName)) label = "installedPlugin";
|
|
368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
369
|
+
"button",
|
|
370
|
+
{
|
|
371
|
+
type: "button",
|
|
372
|
+
className: "cg-plugin-action",
|
|
373
|
+
"data-state": label,
|
|
374
|
+
"aria-label": t("pluginAction", { name: title, action: t(label) }),
|
|
375
|
+
disabled: Boolean(state.pending) || label !== "installPlugin" && label !== "retryPlugins",
|
|
376
|
+
onClick: () => {
|
|
377
|
+
void (label === "retryPlugins" ? installer.refresh() : installer.install(packageName));
|
|
378
|
+
},
|
|
379
|
+
children: t(label)
|
|
380
|
+
}
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
function PluginRecommendations({ installer, t }) {
|
|
384
|
+
const headingId = (0, import_react2.useId)();
|
|
385
|
+
const state = (0, import_react2.useSyncExternalStore)(installer.subscribe, installer.getSnapshot);
|
|
386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "cg-recommendations", "aria-labelledby": headingId, children: [
|
|
387
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { id: headingId, children: t("otherPlugins") }),
|
|
388
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "cg-plugin-list", children: plugins.map((plugin) => {
|
|
389
|
+
const { title, packageName, description, stores } = plugin;
|
|
390
|
+
const error = packageName && state.error?.name === packageName && !state.installed.has(packageName) && state.error;
|
|
391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { className: "cg-plugin-row", children: [
|
|
392
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
393
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: title }),
|
|
394
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: t(description) })
|
|
395
|
+
] }),
|
|
396
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "cg-plugin-actions", "aria-live": "polite", children: stores ? stores.map(
|
|
397
|
+
({ label, href }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
398
|
+
"a",
|
|
399
|
+
{
|
|
400
|
+
className: "cg-plugin-action",
|
|
401
|
+
href,
|
|
402
|
+
target: "_blank",
|
|
403
|
+
rel: "noopener noreferrer",
|
|
404
|
+
"aria-label": t("pluginAction", { name: title, action: t(label) }),
|
|
405
|
+
children: t(label)
|
|
406
|
+
},
|
|
407
|
+
label
|
|
408
|
+
)
|
|
409
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InstallButton, { plugin, installer, state, t }) }),
|
|
410
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "dsh-use-chatgpt-error", role: "alert", children: error.problem === "not-found" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
411
|
+
t("packageNotFound", { name: packageName }),
|
|
412
|
+
" ",
|
|
413
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("a", { href: plugin.guide, target: "_blank", rel: "noopener noreferrer", children: t("installGuide") })
|
|
414
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
415
|
+
t("installError"),
|
|
416
|
+
" ",
|
|
417
|
+
error.message
|
|
418
|
+
] }) })
|
|
419
|
+
] }, title);
|
|
420
|
+
}) }),
|
|
421
|
+
state.inventory === "failed" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "dsh-use-chatgpt-error", role: "alert", children: t("inventoryError") })
|
|
422
|
+
] });
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// client/plugin-installer.js
|
|
426
|
+
var npmRegistry = "https://registry.npmjs.org/";
|
|
427
|
+
var publishedVersion = /^\d+\.\d+\.\d+(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?$/i;
|
|
428
|
+
function rpcValue(reply) {
|
|
429
|
+
if (!reply?.ok) throw new Error(reply?.error?.message);
|
|
430
|
+
return reply.value;
|
|
431
|
+
}
|
|
432
|
+
function createPluginInstaller(ctx) {
|
|
433
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
434
|
+
const initial = { inventory: "unavailable", installed: /* @__PURE__ */ new Set(), pending: null, error: null };
|
|
435
|
+
let state = initial;
|
|
436
|
+
let connection;
|
|
437
|
+
let revision = 0;
|
|
438
|
+
function update(changes) {
|
|
439
|
+
state = { ...state, ...changes };
|
|
440
|
+
for (const listener of listeners) listener();
|
|
441
|
+
}
|
|
442
|
+
async function refresh() {
|
|
443
|
+
if (!connection) return;
|
|
444
|
+
const current = ++revision;
|
|
445
|
+
try {
|
|
446
|
+
const bundles = rpcValue(await connection.manager.listBundles());
|
|
447
|
+
const installed = new Set(bundles.filter((bundle) => bundle.installed || bundle.availability === "profile" || bundle.availability === "installation").map((bundle) => bundle.name));
|
|
448
|
+
if (current === revision) {
|
|
449
|
+
update({ inventory: "ready", installed, error: installed.has(state.error?.name) ? null : state.error });
|
|
450
|
+
}
|
|
451
|
+
} catch {
|
|
452
|
+
if (current === revision) update({ inventory: "failed" });
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
ctx.inject(["remote", "remote.pluginManager"], (scope) => {
|
|
456
|
+
scope.effect(() => {
|
|
457
|
+
connection = { manager: scope.remote.pluginManager };
|
|
458
|
+
const recheck = () => {
|
|
459
|
+
if (listeners.size) void refresh();
|
|
460
|
+
};
|
|
461
|
+
const unsubscribe = scope.remote.$on("plugin-manager/changed", recheck);
|
|
462
|
+
const reset = scope.on("connection/reset", recheck);
|
|
463
|
+
globalThis.window?.addEventListener("focus", recheck);
|
|
464
|
+
update({ ...initial, inventory: "loading" });
|
|
465
|
+
recheck();
|
|
466
|
+
return () => {
|
|
467
|
+
connection = void 0;
|
|
468
|
+
revision++;
|
|
469
|
+
update(initial);
|
|
470
|
+
unsubscribe();
|
|
471
|
+
reset();
|
|
472
|
+
globalThis.window?.removeEventListener("focus", recheck);
|
|
473
|
+
};
|
|
474
|
+
}, "dsh-use-chatgpt: recommended plugin inventory");
|
|
475
|
+
});
|
|
476
|
+
async function install(name) {
|
|
477
|
+
if (!connection || state.inventory !== "ready" || state.pending || state.installed.has(name)) return;
|
|
478
|
+
const active = connection;
|
|
479
|
+
const { manager } = active;
|
|
480
|
+
update({ pending: name, error: null });
|
|
481
|
+
try {
|
|
482
|
+
const info = rpcValue(await manager.inspect(name, { registry: npmRegistry }));
|
|
483
|
+
if (active !== connection) return;
|
|
484
|
+
if (info.status !== "accepted") {
|
|
485
|
+
update({ error: { name, message: info.reason, problem: info.problem } });
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
if (info.registry !== npmRegistry || info.name !== name || info.bundle !== true || typeof info.version !== "string" || !publishedVersion.test(info.version)) throw new Error();
|
|
489
|
+
const requestId = globalThis.crypto?.randomUUID?.();
|
|
490
|
+
const options = {
|
|
491
|
+
registry: npmRegistry,
|
|
492
|
+
enabled: true,
|
|
493
|
+
expected: { name, version: info.version },
|
|
494
|
+
...requestId && { requestId }
|
|
495
|
+
};
|
|
496
|
+
let result;
|
|
497
|
+
try {
|
|
498
|
+
result = rpcValue(await manager.installBundle(`${name}@${info.version}`, options));
|
|
499
|
+
} catch (error) {
|
|
500
|
+
if (!requestId || active !== connection) throw error;
|
|
501
|
+
result = rpcValue(await manager.waitForInstall(requestId));
|
|
502
|
+
if (!result) throw error;
|
|
503
|
+
}
|
|
504
|
+
if (!["applied", "restart-required", "overridden"].includes(result.application)) {
|
|
505
|
+
throw new Error(result.error?.diagnostic || result.error?.code);
|
|
506
|
+
}
|
|
507
|
+
} catch (error) {
|
|
508
|
+
if (active === connection) update({ error: { name, message: error.message } });
|
|
509
|
+
} finally {
|
|
510
|
+
if (active === connection) {
|
|
511
|
+
await refresh();
|
|
512
|
+
if (active === connection) update({ pending: null });
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
return {
|
|
517
|
+
getSnapshot: () => state,
|
|
518
|
+
subscribe(listener) {
|
|
519
|
+
listeners.add(listener);
|
|
520
|
+
if (listeners.size === 1) void refresh();
|
|
521
|
+
return () => listeners.delete(listener);
|
|
522
|
+
},
|
|
523
|
+
install,
|
|
524
|
+
refresh
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
|
|
339
528
|
// client/NativeChatOptions.jsx
|
|
340
|
-
var
|
|
529
|
+
var import_react4 = require("react");
|
|
341
530
|
var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
342
531
|
|
|
343
532
|
// client/use-chat-options.js
|
|
344
|
-
var
|
|
533
|
+
var import_react3 = require("react");
|
|
345
534
|
async function readOrSave(profileId, id, signal, patch) {
|
|
346
535
|
const params = new URLSearchParams({ profileId, sessionId: id });
|
|
347
536
|
const response = await fetch("/api/dsh-use-chatgpt/chat-options?" + params, {
|
|
@@ -357,11 +546,11 @@ async function readOrSave(profileId, id, signal, patch) {
|
|
|
357
546
|
return data.features;
|
|
358
547
|
}
|
|
359
548
|
function useChatOptions(profileId, id) {
|
|
360
|
-
const [state, setState] = (0,
|
|
361
|
-
const [revision, setRevision] = (0,
|
|
362
|
-
const generation = (0,
|
|
363
|
-
const writing = (0,
|
|
364
|
-
(0,
|
|
549
|
+
const [state, setState] = (0, import_react3.useState)({ id });
|
|
550
|
+
const [revision, setRevision] = (0, import_react3.useState)(0);
|
|
551
|
+
const generation = (0, import_react3.useRef)(null);
|
|
552
|
+
const writing = (0, import_react3.useRef)(false);
|
|
553
|
+
(0, import_react3.useEffect)(() => {
|
|
365
554
|
const controller = new AbortController();
|
|
366
555
|
const { signal } = controller;
|
|
367
556
|
generation.current = controller;
|
|
@@ -396,20 +585,20 @@ function useChatOptions(profileId, id) {
|
|
|
396
585
|
}
|
|
397
586
|
|
|
398
587
|
// client/NativeChatOptions.jsx
|
|
399
|
-
var
|
|
588
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
400
589
|
function SearchRetry({ t, message, retry }) {
|
|
401
|
-
return /* @__PURE__ */ (0,
|
|
590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { type: "button", className: "cg-search-retry", title: message, onClick: retry, children: [
|
|
402
591
|
t("searchRetry"),
|
|
403
|
-
/* @__PURE__ */ (0,
|
|
592
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "cg-search-sr", role: "alert", children: message })
|
|
404
593
|
] });
|
|
405
594
|
}
|
|
406
595
|
function SessionSearch({ profileId, id, t }) {
|
|
407
596
|
const { features, saving, save, error, retry } = useChatOptions(profileId, id);
|
|
408
|
-
if (!features) return error ? /* @__PURE__ */ (0,
|
|
409
|
-
return /* @__PURE__ */ (0,
|
|
410
|
-
/* @__PURE__ */ (0,
|
|
411
|
-
/* @__PURE__ */ (0,
|
|
412
|
-
/* @__PURE__ */ (0,
|
|
597
|
+
if (!features) return error ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SearchRetry, { t, message: error, retry }) : null;
|
|
598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "cg-search-tool", "aria-busy": Boolean(saving), children: [
|
|
599
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { title: t("searchHelp"), className: "cg-search-label", children: [
|
|
600
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("webSearch") }),
|
|
601
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
413
602
|
import_dsh_client_ui_primitives2.Switch,
|
|
414
603
|
{
|
|
415
604
|
checked: features.webSearch,
|
|
@@ -421,21 +610,21 @@ function SessionSearch({ profileId, id, t }) {
|
|
|
421
610
|
}
|
|
422
611
|
)
|
|
423
612
|
] }),
|
|
424
|
-
error && /* @__PURE__ */ (0,
|
|
613
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { role: "alert", className: "cg-search-failure", title: error, children: t("saveFailed") })
|
|
425
614
|
] });
|
|
426
615
|
}
|
|
427
616
|
function ConnectedSearch({ id, t, useConnection: useConnection2 }) {
|
|
428
617
|
const { connection, error, refresh } = useConnection2();
|
|
429
|
-
if (error) return /* @__PURE__ */ (0,
|
|
618
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SearchRetry, { t, message: t("requestFailed"), retry: () => {
|
|
430
619
|
void refresh();
|
|
431
620
|
} });
|
|
432
621
|
if (connection?.status !== "connected" || !connection.sharing || !connection.profileId) return null;
|
|
433
|
-
return /* @__PURE__ */ (0,
|
|
622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SessionSearch, { id, profileId: connection.profileId, t }, JSON.stringify([id, connection.profileId]));
|
|
434
623
|
}
|
|
435
624
|
function ModelSearch({ directory, id, t, useConnection: useConnection2 }) {
|
|
436
|
-
const model = (0,
|
|
625
|
+
const model = (0, import_react4.useSyncExternalStore)(directory.subscribe, directory.getSnapshot);
|
|
437
626
|
if (model.current?.provider !== "chatgpt-plan" || model.routable === false) return null;
|
|
438
|
-
return /* @__PURE__ */ (0,
|
|
627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ConnectedSearch, { id, t, useConnection: useConnection2 });
|
|
439
628
|
}
|
|
440
629
|
function registerNativeChatOptions(ctx, useConnection2) {
|
|
441
630
|
ctx.inject(["slots", "sessions", "modelDirectories"], (scope) => {
|
|
@@ -449,7 +638,7 @@ function registerNativeChatOptions(ctx, useConnection2) {
|
|
|
449
638
|
return { id, directory: scope.modelDirectories.directoryFor(id).store };
|
|
450
639
|
}
|
|
451
640
|
}, function NativeSearch({ id, directory, t }) {
|
|
452
|
-
return directory ? /* @__PURE__ */ (0,
|
|
641
|
+
return directory ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ModelSearch, { id, directory, t, useConnection: useConnection2 }) : null;
|
|
453
642
|
}));
|
|
454
643
|
});
|
|
455
644
|
}
|
|
@@ -461,9 +650,9 @@ var chatgpt_button_black_21_default = 'data:image/svg+xml,<svg preserveAspectRat
|
|
|
461
650
|
var chatgpt_button_white_21_default = 'data:image/svg+xml,<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="21" height="21" viewBox="0 0 21 21" fill="none" xmlns="http://www.w3.org/2000/svg">%0A<g id="ChatGPT logo &%23226;&%23128;&%23148; original vector">%0A<path id="Vector" d="M11.8102 19.1625C11.2327 19.1625 10.6841 19.0528 10.1643 18.8334C9.64459 18.6139 9.18259 18.3078 8.77834 17.9151C8.33944 18.0653 7.88322 18.1404 7.40967 18.1404C6.63582 18.1404 5.91972 17.9498 5.26137 17.5686C4.60302 17.1875 4.07172 16.6677 3.66747 16.0094C3.27477 15.351 3.07842 14.6176 3.07842 13.8091C3.07842 13.4742 3.12462 13.1103 3.21702 12.7176C2.75502 12.2903 2.39697 11.7994 2.14287 11.245C1.88877 10.679 1.76172 10.09 1.76172 9.47785C1.76172 8.85415 1.89454 8.25355 2.16019 7.67605C2.42584 7.09855 2.79544 6.6019 3.26899 6.1861C3.75409 5.75875 4.31427 5.46422 4.94952 5.30252C5.07657 4.64417 5.34222 4.05512 5.74647 3.53537C6.16227 3.00407 6.67047 2.58827 7.27107 2.28797C7.87167 1.98767 8.51269 1.83752 9.19414 1.83752C9.77164 1.83752 10.3203 1.94725 10.84 2.1667C11.3598 2.38615 11.8218 2.69222 12.226 3.08492C12.6649 2.93477 13.1211 2.8597 13.5947 2.8597C14.3685 2.8597 15.0846 3.05027 15.743 3.43142C16.4013 3.81257 16.9269 4.33232 17.3196 4.99067C17.7238 5.64902 17.9259 6.38245 17.9259 7.19095C17.9259 7.5259 17.8797 7.88973 17.7873 8.28242C18.2493 8.70977 18.6074 9.20643 18.8615 9.77238C19.1156 10.3268 19.2426 10.91 19.2426 11.5222C19.2426 12.1459 19.1098 12.7465 18.8442 13.324C18.5785 13.9015 18.2031 14.4039 17.718 14.8313C17.2445 15.2471 16.6901 15.5358 16.0548 15.6975C15.9278 16.3559 15.6564 16.9449 15.2406 17.4647C14.8363 17.996 14.3339 18.4118 13.7333 18.7121C13.1327 19.0124 12.4917 19.1625 11.8102 19.1625ZM7.53094 16.9969C8.10844 16.9969 8.61087 16.8756 9.03822 16.6331L12.2953 14.762C12.4108 14.6811 12.4686 14.5714 12.4686 14.4328V12.9429L8.27592 15.351C8.02182 15.5012 7.76772 15.5012 7.51362 15.351L4.23919 13.4626C4.23919 13.4973 4.23342 13.5377 4.22187 13.5839C4.22187 13.6301 4.22187 13.6994 4.22187 13.7918C4.22187 14.3808 4.36047 14.9237 4.63767 15.4203C4.92642 15.9054 5.32489 16.2866 5.83309 16.5638C6.34129 16.8525 6.90724 16.9969 7.53094 16.9969ZM7.70419 14.1729C7.77349 14.2076 7.83702 14.2249 7.89477 14.2249C7.95252 14.2249 8.01027 14.2076 8.06802 14.1729L9.36739 13.4279L5.19207 11.0024C4.93797 10.8523 4.81092 10.6271 4.81092 10.3268V6.56725C4.23342 6.82135 3.77142 7.21405 3.42492 7.74535C3.07842 8.2651 2.90517 8.8426 2.90517 9.47785C2.90517 10.0438 3.04954 10.5866 3.33829 11.1064C3.62704 11.6261 4.00242 12.0189 4.46442 12.2845L7.70419 14.1729ZM11.8102 18.0191C12.4224 18.0191 12.9768 17.8805 13.4734 17.6033C13.9701 17.3261 14.3628 16.9449 14.6515 16.4598C14.9403 15.9747 15.0846 15.4319 15.0846 14.8313V11.0891C15.0846 10.9505 15.0269 10.8465 14.9114 10.7772L13.5947 10.0149V14.8486C13.5947 15.1489 13.4676 15.3741 13.2135 15.5243L9.93912 17.4127C10.5051 17.817 11.1288 18.0191 11.8102 18.0191ZM12.4686 11.6781V9.32192L10.5108 8.21312L8.53579 9.32192V11.6781L10.5108 12.7869L12.4686 11.6781ZM7.40967 6.15145C7.40967 5.85115 7.53672 5.62592 7.79082 5.47577L11.0652 3.58735C10.4993 3.1831 9.87559 2.98097 9.19414 2.98097C8.58199 2.98097 8.02759 3.11957 7.53094 3.39677C7.03429 3.67397 6.64159 4.05512 6.35284 4.54022C6.07564 5.02532 5.93704 5.56817 5.93704 6.16878V9.89365C5.93704 10.0323 5.99479 10.142 6.11029 10.2228L7.40967 10.9851V6.15145ZM16.2108 14.4328C16.7883 14.1787 17.2445 13.786 17.5794 13.2547C17.9259 12.7234 18.0992 12.1459 18.0992 11.5222C18.0992 10.9562 17.9548 10.4134 17.6661 9.89365C17.3773 9.3739 17.0019 8.9812 16.5399 8.71555L13.3002 6.84445C13.2309 6.79825 13.1673 6.78092 13.1096 6.79248C13.0518 6.79248 12.9941 6.8098 12.9363 6.84445L11.637 7.5721L15.8296 10.0149C15.9567 10.0842 16.0491 10.1766 16.1068 10.2921C16.1761 10.3961 16.2108 10.5231 16.2108 10.6733V14.4328ZM12.7284 5.6317C12.9825 5.47 13.2366 5.47 13.4907 5.6317L16.7825 7.55477C16.7825 7.47393 16.7825 7.36997 16.7825 7.24292C16.7825 6.68852 16.6439 6.163 16.3667 5.66635C16.101 5.15815 15.7141 4.7539 15.2059 4.4536C14.7093 4.1533 14.1318 4.00315 13.4734 4.00315C12.8959 4.00315 12.3935 4.12442 11.9661 4.36697L8.70904 6.23808C8.59354 6.31892 8.53579 6.42865 8.53579 6.56725V8.0572L12.7284 5.6317Z" fill="white"/>%0A</g>%0A</svg>%0A';
|
|
462
651
|
|
|
463
652
|
// client/ChatGPTMark.jsx
|
|
464
|
-
var
|
|
653
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
465
654
|
function ChatGPTMark({ size = 20, className = "", tone = "auto" }) {
|
|
466
|
-
return /* @__PURE__ */ (0,
|
|
655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
467
656
|
"span",
|
|
468
657
|
{
|
|
469
658
|
className: `dsh-use-chatgpt-mark ${className}`.trimEnd(),
|
|
@@ -471,53 +660,15 @@ function ChatGPTMark({ size = 20, className = "", tone = "auto" }) {
|
|
|
471
660
|
"aria-hidden": "true",
|
|
472
661
|
style: { width: size, height: size },
|
|
473
662
|
children: [
|
|
474
|
-
/* @__PURE__ */ (0,
|
|
475
|
-
/* @__PURE__ */ (0,
|
|
663
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("img", { className: "dsh-chatgpt-dark-ink", src: chatgpt_button_black_21_default, alt: "" }),
|
|
664
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("img", { className: "dsh-chatgpt-light-ink", src: chatgpt_button_white_21_default, alt: "" })
|
|
476
665
|
]
|
|
477
666
|
}
|
|
478
667
|
);
|
|
479
668
|
}
|
|
480
669
|
|
|
481
670
|
// client/sidebar.css
|
|
482
|
-
var sidebar_default =
|
|
483
|
-
display: inline-block;
|
|
484
|
-
flex: none;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
.dsh-use-chatgpt-mark img {
|
|
488
|
-
display: block;
|
|
489
|
-
width: 100%;
|
|
490
|
-
height: 100%;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
.dsh-use-chatgpt-mark .dsh-chatgpt-light-ink,
|
|
494
|
-
.dsh-use-chatgpt-mark[data-tone="light"] .dsh-chatgpt-dark-ink,
|
|
495
|
-
body[data-ds-dark-theme] .dsh-use-chatgpt-mark[data-tone="auto"] .dsh-chatgpt-dark-ink {
|
|
496
|
-
display: none;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
.dsh-use-chatgpt-mark[data-tone="light"] .dsh-chatgpt-light-ink,
|
|
500
|
-
body[data-ds-dark-theme] .dsh-use-chatgpt-mark[data-tone="auto"] .dsh-chatgpt-light-ink {
|
|
501
|
-
display: block;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
/* The host's trailing slot normally aligns counters to the far edge. Keep the
|
|
505
|
-
update badge beside the panel name, including while the unpin button shows. */
|
|
506
|
-
button[aria-describedby] > span[id]:has(.dsh-use-chatgpt-update-badge) {
|
|
507
|
-
margin-inline-start: 0;
|
|
508
|
-
min-width: 0;
|
|
509
|
-
opacity: 1;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
.dsh-use-chatgpt-update-sr {
|
|
513
|
-
position: absolute;
|
|
514
|
-
width: 1px;
|
|
515
|
-
height: 1px;
|
|
516
|
-
overflow: hidden;
|
|
517
|
-
clip-path: inset(50%);
|
|
518
|
-
white-space: nowrap;
|
|
519
|
-
}
|
|
520
|
-
`;
|
|
671
|
+
var sidebar_default = '.dsh-use-chatgpt-mark {\n display: inline-block;\n flex: none;\n}\n\n.dsh-use-chatgpt-mark img {\n display: block;\n width: 100%;\n height: 100%;\n}\n\n.dsh-use-chatgpt-mark .dsh-chatgpt-light-ink,\n.dsh-use-chatgpt-mark[data-tone="light"] .dsh-chatgpt-dark-ink,\nbody[data-ds-dark-theme] .dsh-use-chatgpt-mark[data-tone="auto"] .dsh-chatgpt-dark-ink {\n display: none;\n}\n\n.dsh-use-chatgpt-mark[data-tone="light"] .dsh-chatgpt-light-ink,\nbody[data-ds-dark-theme] .dsh-use-chatgpt-mark[data-tone="auto"] .dsh-chatgpt-light-ink {\n display: block;\n}\n\n.dsh-use-chatgpt-update-dot {\n display: inline-block;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: var(--dsw-alias-label-primary, currentColor);\n}\n\n.dsh-use-chatgpt-update-sr {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n';
|
|
521
672
|
|
|
522
673
|
// client/updates.js
|
|
523
674
|
var versionStatuses = /* @__PURE__ */ new Set(["update_available", "release_pending", "up_to_date", "latest_unstable"]);
|
|
@@ -576,10 +727,10 @@ function openPluginDetails(ctx) {
|
|
|
576
727
|
}
|
|
577
728
|
|
|
578
729
|
// client/settings.css
|
|
579
|
-
var settings_default = ".dsh-use-chatgpt-page {\n --cg-surface: var(--dsw-alias-bg-layer-1, #fff);\n --cg-ink: var(--dsw-alias-label-primary, #0d0d0d);\n --cg-muted: var(--dsw-alias-label-secondary, #5d5d5d);\n --cg-line: color-mix(in srgb, var(--cg-ink) 13%, var(--cg-surface));\n --cg-wash: color-mix(in srgb, var(--cg-ink) 5%, var(--cg-surface));\n --cg-accent: var(--cg-ink);\n --cg-allowed: #257250;\n width: 100%; height: 100%; min-width: 0; overflow: auto;\n background: var(--cg-surface); color: var(--cg-ink);\n font-family: inherit; font-size: 14px; line-height: 1.5; container: chatgpt-page / inline-size;\n}\nbody[data-ds-dark-theme] .dsh-use-chatgpt-page { --cg-allowed: #9ad5b0; }\n.dsh-use-chatgpt-page *, .dsh-use-chatgpt-page *::before, .dsh-use-chatgpt-page *::after { box-sizing: border-box; }\n.dsh-use-chatgpt-page [hidden] { display: none !important; }\n.dsh-use-chatgpt-content { width: min(calc(100% - 48px), 728px); margin: 0 auto; padding: 30px 0 58px; }\n.dsh-use-chatgpt-header { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 5px 12px; }\n.dsh-use-chatgpt-header h1 { margin: 0; font-size: 26px; line-height: 1.25; font-weight: 600; letter-spacing: -.045em; }\n.dsh-use-chatgpt-header p { grid-column: 1 / -1; margin: 0; color: var(--cg-muted); font-size: 15px; line-height: 1.55; }\n.cg-header-version { display: grid; justify-items: end; color: var(--cg-muted); text-align: end; }\n.cg-header-links { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 2px 6px; }\n.cg-project-link {\n display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;\n border-radius: 50%; color: var(--cg-muted); text-decoration: none;\n}\n.cg-project-link:is(:hover, :focus-visible) { background: var(--cg-wash); color: var(--cg-ink); }\n.dsh-use-chatgpt-page .dsh-use-chatgpt-actions button {\n display: inline-flex; align-items: center; justify-content: center; gap: 7px;\n min-height: 36px; padding: 6px 14px; border: 1px solid var(--cg-line); border-radius: 999px;\n background: var(--cg-wash); color: var(--cg-ink); cursor: pointer;\n font: inherit; font-size: 14px; line-height: 1.4; white-space: normal;\n}\n.dsh-use-chatgpt-page .dsh-use-chatgpt-actions button:hover:enabled {\n background: color-mix(in srgb, var(--cg-ink) 9%, var(--cg-surface));\n}\n.dsh-use-chatgpt-page :where(button, select, a, summary):focus-visible { outline: 2px solid var(--cg-ink); outline-offset: 3px; }\n.dsh-use-chatgpt-page button:disabled { cursor: default; opacity: .55; }\n.cg-dashboard { display: grid; gap: 34px; margin-top: 41px; }\n.cg-account { min-width: 0; }\n.cg-account-heading { padding-bottom: 12px; border-bottom: 1px solid var(--cg-line); }\n.cg-account-heading h2 { margin: 0; font-size: 16px; line-height: 1.5; font-weight: 600; }\n.cg-profile-list { margin: 0; padding: 0; list-style: none; }\n.cg-profile {\n display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;\n min-height: 76px; padding-block: 14px; border-block-end: 1px solid var(--cg-line);\n}\n.cg-profile-avatar {\n display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; overflow: hidden;\n background: var(--cg-ink); color: var(--cg-surface); font-size: 13px; line-height: 1; font-weight: 550;\n}\n.cg-profile-text { display: grid; gap: 3px; min-width: 0; }\n.cg-profile-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }\n.cg-profile-name strong { min-width: 0; font-size: 15px; font-weight: 550; overflow-wrap: anywhere; }\n.cg-current-account {\n display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px;\n background: color-mix(in srgb, var(--cg-allowed) 13%, var(--cg-surface));\n color: var(--cg-allowed); font-size: 11px; font-weight: 600; white-space: nowrap;\n}\n.cg-profile-meta { display: flex; align-items: center; gap: 3px 12px; flex-wrap: wrap; font-size: 13px; color: var(--cg-muted); overflow-wrap: anywhere; }\n.cg-profile-actions { display: flex; align-items: center; justify-self: end; gap: 6px; }\n.cg-account-action, .cg-account-more, .cg-account-add {\n display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 32px;\n border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--cg-ink);\n font: inherit; font-size: 13px; font-weight: 500; line-height: 1.4; cursor: pointer;\n}\n.cg-account-action, .cg-account-add { border-color: var(--cg-line); padding: 5px 12px; }\n.cg-account-more { width: 32px; padding: 0; color: var(--cg-muted); }\n.cg-account-add { min-height: 36px; margin-block-start: 14px; font-size: 14px; }\n.cg-account-action:hover:enabled, .cg-account-add:hover:enabled,\n.cg-account-more:hover:enabled, .cg-account-more[aria-expanded=true] { color: var(--cg-ink); background: var(--cg-wash); }\n.cg-account-flow { display: grid; gap: 12px; justify-items: start; padding: 16px 0; }\n.cg-account-flow h3 { margin: 0 0 4px; font-size: 15px; font-weight: 550; }\n.cg-account-flow p { margin: 0; color: var(--cg-muted); }\n.dsh-use-chatgpt-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }\n.dsh-use-chatgpt-actions:empty { display: none; }\n.cg-account > p { margin: 12px 0; font-size: 14px; color: var(--cg-muted); }\n.dsh-use-chatgpt-page .dsh-use-chatgpt-error { color: var(--dsw-alias-state-warn-label, #9a461e); overflow-wrap: anywhere; }\n.cg-login-layout {\n display: grid; grid-template-columns: minmax(0, 1fr);\n grid-template-rows: minmax(min-content, 1fr) auto minmax(min-content, 1fr);\n justify-items: center; gap: 20px;\n min-height: 100%; width: 100%; padding: 20px clamp(16px, 4cqi, 40px);\n}\n.cg-welcome {\n grid-row: 2; display: flex; flex-direction: column; align-items: center;\n width: min(100%, 392px); text-align: center;\n}\n.cg-welcome-heading { display: grid; justify-items: center; gap: 22px; }\n.cg-welcome-heading h1 { margin: 0; font-size: clamp(26px, 4cqi, 34px); font-weight: 600; letter-spacing: -.035em; line-height: 1.18; text-wrap: balance; }\n.cg-welcome > .cg-account-status { margin: 12px 0 0; font-size: 15px; line-height: 1.6; text-wrap: balance; }\n.cg-welcome > .dsh-use-chatgpt-actions:not(:empty) {\n display: grid; width: min(100%, 310px); gap: 8px; margin-top: 26px;\n}\n.cg-welcome > .dsh-use-chatgpt-actions button { width: 100%; min-height: 46px; font-size: 15px; }\n.cg-welcome .dsh-use-chatgpt-actions .cg-primary { background: var(--cg-ink); color: var(--cg-surface); font-weight: 550; }\n.cg-welcome .dsh-use-chatgpt-actions .cg-primary:hover:enabled { background: color-mix(in srgb, var(--cg-ink) 85%, var(--cg-surface)); }\n.cg-login-footer { grid-row: 3; align-self: end; display: grid; justify-items: center; color: var(--cg-muted); text-align: center; }\n.cg-version {\n display: inline-flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 4px 7px; max-width: 100%;\n min-height: 32px; padding: 4px 0; border: 0; border-radius: 8px;\n background: transparent; color: inherit; font: inherit; font-size: 12px; font-variant-numeric: tabular-nums;\n overflow-wrap: anywhere; cursor: default;\n}\n.cg-login-footer .cg-version { justify-content: center; padding: 6px 10px; }\nbutton.cg-version { padding-inline: 8px; cursor: pointer; }\nbutton.cg-version:hover { color: var(--cg-ink); background: var(--cg-wash); }\n.dsh-use-chatgpt-update-badge {\n display: inline-flex; align-items: center; flex: none; vertical-align: middle;\n padding: 1px 6px; border-radius: 999px; white-space: nowrap;\n background-color: #171717;\n color: #fff;\n font-family: inherit; font-size: 11px; font-weight: 550; line-height: 16px;\n}\nbody[data-ds-dark-theme] .dsh-use-chatgpt-update-badge {\n background-color: #f5f5f5;\n color: #171717;\n}\n.cg-legacy-defaults { font-size: 14px; }\n.cg-legacy-defaults summary { cursor: pointer; }\n.cg-legacy-defaults p { margin: 8px 0; color: var(--cg-muted); }\n@container chatgpt-page (max-width: 510px) {\n .dsh-use-chatgpt-content { width: calc(100% - 36px); padding-block: 22px 36px; }\n .cg-dashboard { margin-top: 28px; }\n .cg-dashboard { gap: 26px; }\n .cg-profile { column-gap: 9px; }\n .cg-profile-meta { gap: 1px 8px; }\n}\n@container chatgpt-page (max-width: 360px) {\n .cg-profile:has(.cg-account-action) { grid-template-columns: auto minmax(0, 1fr); row-gap: 6px; }\n .cg-profile:has(.cg-account-action) .cg-profile-actions { grid-column: 2; justify-self: start; }\n}\n";
|
|
730
|
+
var settings_default = ".dsh-use-chatgpt-page {\n --cg-surface: var(--dsw-alias-bg-layer-1, #fff);\n --cg-ink: var(--dsw-alias-label-primary, #0d0d0d);\n --cg-muted: var(--dsw-alias-label-secondary, #5d5d5d);\n --cg-line: color-mix(in srgb, var(--cg-ink) 13%, var(--cg-surface));\n --cg-wash: color-mix(in srgb, var(--cg-ink) 5%, var(--cg-surface));\n --cg-accent: var(--cg-ink);\n --cg-allowed: #257250;\n width: 100%; height: 100%; min-width: 0; overflow: auto;\n background: var(--cg-surface); color: var(--cg-ink);\n font-family: inherit; font-size: 14px; line-height: 1.5; container: chatgpt-page / inline-size;\n}\nbody[data-ds-dark-theme] .dsh-use-chatgpt-page { --cg-allowed: #9ad5b0; }\n.dsh-use-chatgpt-page *, .dsh-use-chatgpt-page *::before, .dsh-use-chatgpt-page *::after { box-sizing: border-box; }\n.dsh-use-chatgpt-page [hidden] { display: none !important; }\n.dsh-use-chatgpt-content { width: min(calc(100% - 48px), 728px); margin: 0 auto; padding: 30px 0 58px; }\n.cg-update-banner {\n display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px;\n margin-block-end: 24px; padding: 8px 12px 8px 14px;\n border: 1px solid var(--dsw-alias-border-l3, var(--cg-line)); border-radius: 12px;\n background: color-mix(in srgb, var(--cg-ink) 3%, var(--cg-surface));\n}\n.cg-update-copy {\n display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px;\n flex: 1 1 180px; min-width: 0; margin: 0; overflow-wrap: anywhere;\n}\n.cg-update-copy strong { font-weight: 600; }\n.cg-update-copy span { color: var(--cg-muted); font-size: 13px; }\n.cg-update-action, .cg-plugin-action {\n display: inline-flex; align-items: center; min-height: 32px; padding-inline: 12px;\n border: 1px solid var(--dsw-alias-border-l3, var(--cg-line)); border-radius: 999px; white-space: nowrap;\n background: var(--cg-surface); color: var(--cg-ink); font-size: 13px; font-weight: 550; text-decoration: none;\n}\n.cg-update-action { margin-inline-start: auto; }\n.cg-update-action:hover, button.cg-plugin-action:enabled:hover { background: var(--dsw-alias-interactive-bg-hover, var(--cg-wash)); }\n.dsh-use-chatgpt-header { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 5px 12px; }\n.dsh-use-chatgpt-header h1 { margin: 0; font-size: 26px; line-height: 1.25; font-weight: 600; letter-spacing: -.045em; }\n.dsh-use-chatgpt-header p { grid-column: 1 / -1; margin: 0; color: var(--cg-muted); font-size: 15px; line-height: 1.55; }\n.cg-header-version { display: grid; justify-items: end; color: var(--cg-muted); text-align: end; }\n.cg-header-links { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 2px 6px; }\n.cg-project-link {\n display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;\n border-radius: 50%; color: var(--cg-muted); text-decoration: none;\n}\n.cg-project-link:is(:hover, :focus-visible) { background: var(--cg-wash); color: var(--cg-ink); }\n.dsh-use-chatgpt-page .dsh-use-chatgpt-actions button {\n display: inline-flex; align-items: center; justify-content: center; gap: 7px;\n min-height: 36px; padding: 6px 14px; border: 1px solid var(--cg-line); border-radius: 999px;\n background: var(--cg-wash); color: var(--cg-ink); cursor: pointer;\n font: inherit; font-size: 14px; line-height: 1.4; white-space: normal;\n}\n.dsh-use-chatgpt-page .dsh-use-chatgpt-actions button:hover:enabled {\n background: color-mix(in srgb, var(--cg-ink) 9%, var(--cg-surface));\n}\n.dsh-use-chatgpt-page :where(button, select, a, summary):focus-visible { outline: 2px solid var(--cg-ink); outline-offset: 3px; }\n.dsh-use-chatgpt-page button:disabled { cursor: default; opacity: .55; }\n.cg-dashboard { display: grid; gap: 34px; margin-top: 41px; }\n.cg-account { min-width: 0; }\n.cg-account-heading { padding-bottom: 12px; border-bottom: 1px solid var(--cg-line); }\n.cg-account-heading h2 { margin: 0; font-size: 16px; line-height: 1.5; font-weight: 600; }\n.cg-profile-list { margin: 0; padding: 0; list-style: none; }\n.cg-profile {\n display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;\n min-height: 76px; padding-block: 14px; border-block-end: 1px solid var(--cg-line);\n}\n.cg-profile-avatar {\n display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; overflow: hidden;\n background: var(--cg-ink); color: var(--cg-surface); font-size: 13px; line-height: 1; font-weight: 550;\n}\n.cg-profile-text { display: grid; gap: 3px; min-width: 0; }\n.cg-profile-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }\n.cg-profile-name strong { min-width: 0; font-size: 15px; font-weight: 550; overflow-wrap: anywhere; }\n.cg-current-account {\n display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px;\n background: color-mix(in srgb, var(--cg-allowed) 13%, var(--cg-surface));\n color: var(--cg-allowed); font-size: 11px; font-weight: 600; white-space: nowrap;\n}\n.cg-profile-meta { display: flex; align-items: center; gap: 3px 12px; flex-wrap: wrap; font-size: 13px; color: var(--cg-muted); overflow-wrap: anywhere; }\n.cg-profile-actions { display: flex; align-items: center; justify-self: end; gap: 6px; }\n.cg-account-action, .cg-account-more, .cg-account-add {\n display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 32px;\n border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--cg-ink);\n font: inherit; font-size: 13px; font-weight: 500; line-height: 1.4; cursor: pointer;\n}\n.cg-account-action, .cg-account-add { border-color: var(--cg-line); padding: 5px 12px; }\n.cg-account-more { width: 32px; padding: 0; color: var(--cg-muted); }\n.cg-account-add { min-height: 36px; margin-block-start: 14px; font-size: 14px; }\n.cg-account-action:hover:enabled, .cg-account-add:hover:enabled,\n.cg-account-more:hover:enabled, .cg-account-more[aria-expanded=true] { color: var(--cg-ink); background: var(--cg-wash); }\n.cg-account-flow { display: grid; gap: 12px; justify-items: start; padding: 16px 0; }\n.cg-account-flow p { margin: 0; color: var(--cg-muted); }\n.dsh-use-chatgpt-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }\n.dsh-use-chatgpt-actions:empty { display: none; }\n.cg-account > p { margin: 12px 0; font-size: 14px; color: var(--cg-muted); }\n.dsh-use-chatgpt-page .dsh-use-chatgpt-error { color: var(--dsw-alias-state-warn-label, #9a461e); overflow-wrap: anywhere; }\n.cg-login-layout {\n display: grid; grid-template-columns: minmax(0, 1fr);\n grid-template-rows: minmax(min-content, 1fr) auto minmax(min-content, 1fr);\n justify-items: center; gap: 20px;\n min-height: 100%; width: 100%; padding: 20px clamp(16px, 4cqi, 40px);\n}\n.cg-login-layout > .cg-update-banner { grid-row: 1; align-self: start; width: min(100%, 728px); margin: 0; }\n.cg-welcome {\n grid-row: 2; display: flex; flex-direction: column; align-items: center;\n width: min(100%, 392px); text-align: center;\n}\n.cg-welcome-heading { display: grid; justify-items: center; gap: 22px; }\n.cg-welcome-heading h1 { margin: 0; font-size: clamp(26px, 4cqi, 34px); font-weight: 600; letter-spacing: -.035em; line-height: 1.18; text-wrap: balance; }\n.cg-welcome > .cg-account-status { margin: 12px 0 0; font-size: 15px; line-height: 1.6; text-wrap: balance; }\n.cg-welcome > .dsh-use-chatgpt-actions:not(:empty) {\n display: grid; width: min(100%, 310px); gap: 8px; margin-top: 26px;\n}\n.cg-welcome > .dsh-use-chatgpt-actions button { width: 100%; min-height: 46px; font-size: 15px; }\n.cg-welcome .dsh-use-chatgpt-actions .cg-primary { background: var(--cg-ink); color: var(--cg-surface); font-weight: 550; }\n.cg-welcome .dsh-use-chatgpt-actions .cg-primary:hover:enabled { background: color-mix(in srgb, var(--cg-ink) 85%, var(--cg-surface)); }\n.cg-login-footer { grid-row: 3; align-self: end; display: grid; justify-items: center; color: var(--cg-muted); text-align: center; }\n.cg-version {\n display: inline-flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 4px 7px; max-width: 100%;\n min-height: 32px; padding: 4px 0; border: 0; border-radius: 8px;\n background: transparent; color: inherit; font: inherit; font-size: 12px; font-variant-numeric: tabular-nums;\n overflow-wrap: anywhere; cursor: default;\n}\n.cg-login-footer .cg-version { justify-content: center; padding: 6px 10px; }\n.dsh-use-chatgpt-update-badge {\n display: inline-flex; align-items: center; flex: none; vertical-align: middle;\n padding: 1px 6px; border-radius: 999px; white-space: nowrap;\n background-color: #171717;\n color: #fff;\n font-family: inherit; font-size: 11px; font-weight: 550; line-height: 16px;\n}\nbody[data-ds-dark-theme] .dsh-use-chatgpt-update-badge {\n background-color: #f5f5f5;\n color: #171717;\n}\n.cg-legacy-defaults { font-size: 14px; }\n.cg-legacy-defaults summary { cursor: pointer; }\n.cg-legacy-defaults p { margin: 8px 0; color: var(--cg-muted); }\n.cg-recommendations { container-type: inline-size; }\n.cg-recommendations h2 { margin: 0 0 12px; font-size: 16px; line-height: 1.4; font-weight: 600; }\n.cg-plugin-list { margin: 0; padding: 0 16px; list-style: none; border: 1px solid var(--cg-line); border-radius: 14px; }\n.cg-plugin-row {\n display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 16px; padding-block: 13px;\n}\n.cg-plugin-row + .cg-plugin-row { border-block-start: 1px solid var(--cg-line); }\n.cg-plugin-row strong { font-weight: 550; }\n.cg-plugin-row p { margin: 2px 0 0; color: var(--cg-muted); font-size: 13px; overflow-wrap: anywhere; }\n.cg-plugin-actions { display: flex; gap: 6px; flex-wrap: wrap; }\n.cg-plugin-action { justify-content: center; font-family: inherit; cursor: pointer; }\na.cg-plugin-action {\n background: var(--dsw-static-neutral-bluish-1000, #0f1115); color: #fff; border-color: rgb(255 255 255 / 18%);\n}\na.cg-plugin-action:hover { background: var(--dsw-static-neutral-bluish-850, #2c2c2e); }\n.cg-plugin-action[data-state='installedPlugin'] { color: var(--cg-muted); background: var(--cg-wash); border-color: transparent; opacity: 1; }\n.cg-plugin-row .dsh-use-chatgpt-error { grid-column: 1 / -1; }\n.cg-plugin-row .dsh-use-chatgpt-error a { color: inherit; text-decoration: underline; }\n@container (max-width: 370px) {\n .cg-plugin-row { grid-template-columns: minmax(0, 1fr); }\n .cg-plugin-list { padding-inline: 12px; }\n}\n@container chatgpt-page (max-width: 510px) {\n .dsh-use-chatgpt-content { width: calc(100% - 36px); padding-block: 22px 36px; }\n .cg-dashboard { margin-top: 28px; }\n .cg-dashboard { gap: 26px; }\n .cg-profile { column-gap: 9px; }\n .cg-profile-meta { gap: 1px 8px; }\n}\n@container chatgpt-page (max-width: 360px) {\n .cg-profile:has(.cg-account-action) { grid-template-columns: auto minmax(0, 1fr); row-gap: 6px; }\n .cg-profile:has(.cg-account-action) .cg-profile-actions { grid-column: 2; justify-self: start; }\n}\n";
|
|
580
731
|
|
|
581
732
|
// client/index.jsx
|
|
582
|
-
var
|
|
733
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
583
734
|
var pluginId = "dsh-use-chatgpt";
|
|
584
735
|
var apiBase = "/api/dsh-use-chatgpt";
|
|
585
736
|
var connectionStatuses = ["disconnected", "connecting", "connected", "reauth_required"];
|
|
@@ -604,9 +755,9 @@ var dictionaries = {
|
|
|
604
755
|
subtitle: "\u5728 DeepSeek Harness \u4E2D\u4F7F\u7528\u4F60\u7684 ChatGPT \u5957\u9910\u989D\u5EA6\u3002",
|
|
605
756
|
browserTitle: "\u5728\u6D4F\u89C8\u5668\u4E2D\u7EE7\u7EED",
|
|
606
757
|
chooseSignedIn: "\u9009\u62E9\u5DF2\u767B\u5F55\u8D26\u53F7",
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
758
|
+
authorizeHint: "\u8BF7\u5728 3 \u5206\u949F\u5185\u5B8C\u6210\u6D4F\u89C8\u5668\u4E2D\u7684\u6388\u6743\u3002\u5B8C\u6210\u540E\u5C06\u5207\u6362\u5230\u8BE5\u8D26\u53F7\u3002",
|
|
759
|
+
authorizationFailed: "\u6388\u6743\u672A\u5B8C\u6210",
|
|
760
|
+
close: "\u5173\u95ED",
|
|
610
761
|
reconnectAccount: "\u91CD\u65B0\u8FDE\u63A5",
|
|
611
762
|
pendingAccount: "\u5F85\u5B8C\u6210\u6388\u6743",
|
|
612
763
|
resumeAccount: "\u7EE7\u7EED\u6388\u6743",
|
|
@@ -632,11 +783,26 @@ var dictionaries = {
|
|
|
632
783
|
modelsEmpty: "\u6B64\u8D26\u53F7\u6682\u65F6\u6CA1\u6709\u53EF\u7528\u7684 ChatGPT \u5957\u9910\u6A21\u578B\u3002",
|
|
633
784
|
modelsFailed: "\u65E0\u6CD5\u8BFB\u53D6\u6A21\u578B\u5217\u8868\u3002",
|
|
634
785
|
refreshModels: "\u5237\u65B0\u6A21\u578B\u5217\u8868",
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
786
|
+
updateTitle: "\u6709\u65B0\u7248\u672C",
|
|
787
|
+
updateDetails: "\u67E5\u770B\u66F4\u65B0",
|
|
788
|
+
updateBadge: "\u66F4\u65B0",
|
|
789
|
+
otherPlugins: "\u4F5C\u8005\u7684\u5176\u4ED6\u63D2\u4EF6",
|
|
790
|
+
freeModelsDescription: "\u5728 DSH \u4E2D\u4F7F\u7528 Kilo \u514D\u8D39\u6A21\u578B\uFF0C\u68C0\u6D4B\u53EF\u7528\u6027\u5E76\u9009\u62E9\u5728\u5BF9\u8BDD\u4E2D\u663E\u793A\u7684\u6A21\u578B\u3002",
|
|
791
|
+
timelineDescription: "\u4E3A DSH \u5BF9\u8BDD\u6DFB\u52A0\u63D0\u95EE\u65F6\u95F4\u8F74\u3001\u6536\u85CF\u5939\u3001\u63D0\u793A\u8BCD\u5E93\u548C\u591A\u683C\u5F0F\u5BFC\u51FA\u3002",
|
|
792
|
+
browserDescription: "\u4E3A ChatGPT\u3001Gemini\u3001DeepSeek \u7B49\u7F51\u9875\u6DFB\u52A0\u5BF9\u8BDD\u65F6\u95F4\u8F74\u3001\u6536\u85CF\u5939\u548C\u63D0\u793A\u8BCD\u5E93\u3002",
|
|
793
|
+
installPlugin: "\u5B89\u88C5",
|
|
794
|
+
installedPlugin: "\u5DF2\u5B89\u88C5",
|
|
795
|
+
installingPlugin: "\u5B89\u88C5\u4E2D\u2026",
|
|
796
|
+
checkingPlugins: "\u68C0\u6D4B\u4E2D\u2026",
|
|
797
|
+
retryPlugins: "\u91CD\u65B0\u68C0\u6D4B",
|
|
798
|
+
installUnavailable: "\u5B89\u88C5\u4E0D\u53EF\u7528",
|
|
799
|
+
pluginAction: "{name} \xB7 {action}",
|
|
800
|
+
chromeStore: "Chrome \u7248",
|
|
801
|
+
edgeStore: "Edge \u7248",
|
|
802
|
+
inventoryError: "\u65E0\u6CD5\u8BFB\u53D6\u5DF2\u5B89\u88C5\u63D2\u4EF6\uFF0C\u8BF7\u91CD\u65B0\u68C0\u6D4B\u3002",
|
|
803
|
+
installError: "\u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
804
|
+
packageNotFound: "npm \u5B98\u65B9\u6E90\u6682\u672A\u627E\u5230 {name}\u3002",
|
|
805
|
+
installGuide: "\u67E5\u770B\u5B89\u88C5\u8BF4\u660E"
|
|
640
806
|
},
|
|
641
807
|
en: {
|
|
642
808
|
webSearch: "Web search",
|
|
@@ -657,9 +823,9 @@ var dictionaries = {
|
|
|
657
823
|
subtitle: "Use your ChatGPT plan allowance in DeepSeek Harness.",
|
|
658
824
|
browserTitle: "Continue in your browser",
|
|
659
825
|
chooseSignedIn: "Choose a signed-in account",
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
826
|
+
authorizeHint: "Complete authorization in your browser within 3 minutes to switch to this account.",
|
|
827
|
+
authorizationFailed: "Authorization incomplete",
|
|
828
|
+
close: "Close",
|
|
663
829
|
reconnectAccount: "Reconnect",
|
|
664
830
|
pendingAccount: "Authorization pending",
|
|
665
831
|
resumeAccount: "Continue sign-in",
|
|
@@ -685,11 +851,26 @@ var dictionaries = {
|
|
|
685
851
|
modelsEmpty: "This account currently has no available ChatGPT plan models.",
|
|
686
852
|
modelsFailed: "Could not load the model list.",
|
|
687
853
|
refreshModels: "Reload models",
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
854
|
+
updateTitle: "Update available",
|
|
855
|
+
updateDetails: "View update",
|
|
856
|
+
updateBadge: "Update",
|
|
857
|
+
otherPlugins: "More plugins by this author",
|
|
858
|
+
freeModelsDescription: "Use free Kilo models in DSH, check availability, and choose which models appear in chat.",
|
|
859
|
+
timelineDescription: "Add a question timeline, bookmark folders, a prompt library, and chat exports to DSH.",
|
|
860
|
+
browserDescription: "Add a chat timeline, bookmarks, and a prompt library to ChatGPT, Gemini, DeepSeek, and other AI chat sites.",
|
|
861
|
+
installPlugin: "Install",
|
|
862
|
+
installedPlugin: "Installed",
|
|
863
|
+
installingPlugin: "Installing\u2026",
|
|
864
|
+
checkingPlugins: "Checking\u2026",
|
|
865
|
+
retryPlugins: "Check again",
|
|
866
|
+
installUnavailable: "Install unavailable",
|
|
867
|
+
pluginAction: "{name} \xB7 {action}",
|
|
868
|
+
chromeStore: "Chrome",
|
|
869
|
+
edgeStore: "Edge",
|
|
870
|
+
inventoryError: "Could not load installed plugins. Check again.",
|
|
871
|
+
installError: "Installation failed. Try again.",
|
|
872
|
+
packageNotFound: "The npm registry could not find {name}.",
|
|
873
|
+
installGuide: "View installation guide"
|
|
693
874
|
}
|
|
694
875
|
};
|
|
695
876
|
function validFeatures(features) {
|
|
@@ -721,15 +902,18 @@ async function requestConnection(action, signal, payload) {
|
|
|
721
902
|
function isSignIn(action) {
|
|
722
903
|
return action === "sign-in" || action === "enable" || action === "add-account";
|
|
723
904
|
}
|
|
905
|
+
function isAccountDialogAction(action) {
|
|
906
|
+
return action === "add-account" || action === "cancel-add";
|
|
907
|
+
}
|
|
724
908
|
function useConnection() {
|
|
725
|
-
const [connection, setConnection] = (0,
|
|
726
|
-
const [pending, setPending] = (0,
|
|
727
|
-
const [error, setError] = (0,
|
|
728
|
-
const lifetime = (0,
|
|
729
|
-
const pendingAction = (0,
|
|
730
|
-
const refreshSignal = (0,
|
|
731
|
-
const revision = (0,
|
|
732
|
-
const refresh = (0,
|
|
909
|
+
const [connection, setConnection] = (0, import_react5.useState)(null);
|
|
910
|
+
const [pending, setPending] = (0, import_react5.useState)(null);
|
|
911
|
+
const [error, setError] = (0, import_react5.useState)(null);
|
|
912
|
+
const lifetime = (0, import_react5.useRef)(null);
|
|
913
|
+
const pendingAction = (0, import_react5.useRef)(null);
|
|
914
|
+
const refreshSignal = (0, import_react5.useRef)(null);
|
|
915
|
+
const revision = (0, import_react5.useRef)(0);
|
|
916
|
+
const refresh = (0, import_react5.useCallback)(async (clearError = true) => {
|
|
733
917
|
const signal = lifetime.current?.signal;
|
|
734
918
|
if (!signal || refreshSignal.current === signal || pendingAction.current) return;
|
|
735
919
|
const update = revision.current;
|
|
@@ -747,7 +931,7 @@ function useConnection() {
|
|
|
747
931
|
if (refreshSignal.current === signal) refreshSignal.current = null;
|
|
748
932
|
}
|
|
749
933
|
}, []);
|
|
750
|
-
(0,
|
|
934
|
+
(0, import_react5.useEffect)(() => {
|
|
751
935
|
const controller = new AbortController();
|
|
752
936
|
lifetime.current = controller;
|
|
753
937
|
const onFocus = () => {
|
|
@@ -762,8 +946,8 @@ function useConnection() {
|
|
|
762
946
|
pendingAction.current = null;
|
|
763
947
|
};
|
|
764
948
|
}, [refresh]);
|
|
765
|
-
const polling = connection?.status === "connecting";
|
|
766
|
-
(0,
|
|
949
|
+
const polling = connection?.status === "connecting" || connection?.addingAccount;
|
|
950
|
+
(0, import_react5.useEffect)(() => {
|
|
767
951
|
if (!polling) return;
|
|
768
952
|
const timer = window.setInterval(() => {
|
|
769
953
|
void refresh(false);
|
|
@@ -790,7 +974,9 @@ function useConnection() {
|
|
|
790
974
|
}
|
|
791
975
|
} catch (failure) {
|
|
792
976
|
failed = true;
|
|
793
|
-
if (!signal.aborted && revision.current === update
|
|
977
|
+
if (!signal.aborted && revision.current === update && !(action === "add-account" && failure.code === "cancelled")) {
|
|
978
|
+
setError({ action, message: failure.message, code: failure.code });
|
|
979
|
+
}
|
|
794
980
|
} finally {
|
|
795
981
|
if (!signal.aborted && revision.current === update) {
|
|
796
982
|
pendingAction.current = null;
|
|
@@ -799,13 +985,13 @@ function useConnection() {
|
|
|
799
985
|
}
|
|
800
986
|
}
|
|
801
987
|
}
|
|
802
|
-
return { connection, pending, error, refresh, run };
|
|
988
|
+
return { connection, pending, error, dismissError: () => setError(null), refresh, run };
|
|
803
989
|
}
|
|
804
990
|
function profileName(profile) {
|
|
805
991
|
return profile.identity?.email || profile.identity?.name || profile.label;
|
|
806
992
|
}
|
|
807
993
|
function LoginScreen({ t, state }) {
|
|
808
|
-
const titleId = (0,
|
|
994
|
+
const titleId = (0, import_react5.useId)();
|
|
809
995
|
const { connection, pending, error, refresh, run } = state;
|
|
810
996
|
const waiting = connection?.status === "connecting" || pending === "sign-in" || pending === "cancel";
|
|
811
997
|
const profiles = connection?.profiles ?? [];
|
|
@@ -820,18 +1006,18 @@ function LoginScreen({ t, state }) {
|
|
|
820
1006
|
const target = existing || profiles.find((profile) => profile.pending);
|
|
821
1007
|
void run("sign-in", target ? { profileId: target.id } : { newProfile: true });
|
|
822
1008
|
}
|
|
823
|
-
return /* @__PURE__ */ (0,
|
|
824
|
-
/* @__PURE__ */ (0,
|
|
825
|
-
/* @__PURE__ */ (0,
|
|
826
|
-
/* @__PURE__ */ (0,
|
|
1009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "cg-account cg-welcome", "aria-labelledby": titleId, children: [
|
|
1010
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("header", { className: "cg-welcome-heading", children: [
|
|
1011
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChatGPTMark, { size: 48 }),
|
|
1012
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { id: titleId, children: t(waiting ? "browserTitle" : choosing ? "chooseSignedIn" : "startHere") })
|
|
827
1013
|
] }),
|
|
828
|
-
hint && /* @__PURE__ */ (0,
|
|
829
|
-
message && /* @__PURE__ */ (0,
|
|
830
|
-
/* @__PURE__ */ (0,
|
|
831
|
-
!connection && error && /* @__PURE__ */ (0,
|
|
1014
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "cg-account-status", role: "status", children: hint }),
|
|
1015
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "dsh-use-chatgpt-error", role: "alert", children: message }),
|
|
1016
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "dsh-use-chatgpt-actions", children: [
|
|
1017
|
+
!connection && error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", size: "sm", onClick: () => {
|
|
832
1018
|
void refresh();
|
|
833
1019
|
}, children: t("retry") }),
|
|
834
|
-
waiting && /* @__PURE__ */ (0,
|
|
1020
|
+
waiting && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
835
1021
|
import_dsh_client_ui_primitives3.Button,
|
|
836
1022
|
{
|
|
837
1023
|
variant: "outline",
|
|
@@ -843,7 +1029,7 @@ function LoginScreen({ t, state }) {
|
|
|
843
1029
|
children: t("cancel")
|
|
844
1030
|
}
|
|
845
1031
|
),
|
|
846
|
-
choosing && signedIn.map((profile) => /* @__PURE__ */ (0,
|
|
1032
|
+
choosing && signedIn.map((profile) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
847
1033
|
import_dsh_client_ui_primitives3.Button,
|
|
848
1034
|
{
|
|
849
1035
|
variant: "outline",
|
|
@@ -856,7 +1042,7 @@ function LoginScreen({ t, state }) {
|
|
|
856
1042
|
},
|
|
857
1043
|
profile.id
|
|
858
1044
|
)),
|
|
859
|
-
connection?.available && !waiting && !choosing && /* @__PURE__ */ (0,
|
|
1045
|
+
connection?.available && !waiting && !choosing && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
860
1046
|
import_dsh_client_ui_primitives3.Button,
|
|
861
1047
|
{
|
|
862
1048
|
className: "cg-primary",
|
|
@@ -871,7 +1057,7 @@ function LoginScreen({ t, state }) {
|
|
|
871
1057
|
] });
|
|
872
1058
|
}
|
|
873
1059
|
function AccountRow({ profile, current, busy, t, run }) {
|
|
874
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
1060
|
+
const [menuOpen, setMenuOpen] = (0, import_react5.useState)(false);
|
|
875
1061
|
const { id, identity, sharing } = profile;
|
|
876
1062
|
const connected = !profile.pending && profile.status === "connected";
|
|
877
1063
|
const email = identity?.email;
|
|
@@ -883,20 +1069,20 @@ function AccountRow({ profile, current, busy, t, run }) {
|
|
|
883
1069
|
else if (profile.status === "reauth_required") status = "expiredAccount";
|
|
884
1070
|
else if (!connected) status = "signedOut";
|
|
885
1071
|
else if (!sharing) status = "noConsent";
|
|
886
|
-
return /* @__PURE__ */ (0,
|
|
887
|
-
/* @__PURE__ */ (0,
|
|
888
|
-
/* @__PURE__ */ (0,
|
|
889
|
-
/* @__PURE__ */ (0,
|
|
890
|
-
/* @__PURE__ */ (0,
|
|
891
|
-
current && connected && /* @__PURE__ */ (0,
|
|
1072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { className: "cg-profile", children: [
|
|
1073
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "cg-profile-avatar", "aria-hidden": "true", children: initials || /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PanelIcon, { name: "account", size: 19 }) }),
|
|
1074
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cg-profile-text", children: [
|
|
1075
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cg-profile-name", children: [
|
|
1076
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: display }),
|
|
1077
|
+
current && connected && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "cg-current-account", children: t("activeAccount") })
|
|
892
1078
|
] }),
|
|
893
|
-
(secondaryEmail || status) && /* @__PURE__ */ (0,
|
|
894
|
-
secondaryEmail && /* @__PURE__ */ (0,
|
|
895
|
-
status && /* @__PURE__ */ (0,
|
|
1079
|
+
(secondaryEmail || status) && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cg-profile-meta", children: [
|
|
1080
|
+
secondaryEmail && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: secondaryEmail }),
|
|
1081
|
+
status && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t(status) })
|
|
896
1082
|
] })
|
|
897
1083
|
] }),
|
|
898
|
-
/* @__PURE__ */ (0,
|
|
899
|
-
!current && /* @__PURE__ */ (0,
|
|
1084
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "cg-profile-actions", children: connected ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1085
|
+
!current && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
900
1086
|
"button",
|
|
901
1087
|
{
|
|
902
1088
|
type: "button",
|
|
@@ -909,7 +1095,7 @@ function AccountRow({ profile, current, busy, t, run }) {
|
|
|
909
1095
|
children: t("switchAccount")
|
|
910
1096
|
}
|
|
911
1097
|
),
|
|
912
|
-
/* @__PURE__ */ (0,
|
|
1098
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
913
1099
|
import_dsh_client_ui_primitives3.Menu,
|
|
914
1100
|
{
|
|
915
1101
|
open: menuOpen && !busy,
|
|
@@ -917,7 +1103,7 @@ function AccountRow({ profile, current, busy, t, run }) {
|
|
|
917
1103
|
portal: true,
|
|
918
1104
|
autoFocus: true,
|
|
919
1105
|
dense: true,
|
|
920
|
-
anchor: /* @__PURE__ */ (0,
|
|
1106
|
+
anchor: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
921
1107
|
"button",
|
|
922
1108
|
{
|
|
923
1109
|
type: "button",
|
|
@@ -927,12 +1113,12 @@ function AccountRow({ profile, current, busy, t, run }) {
|
|
|
927
1113
|
"aria-haspopup": "menu",
|
|
928
1114
|
"aria-expanded": menuOpen && !busy,
|
|
929
1115
|
onClick: () => setMenuOpen((open) => !open),
|
|
930
|
-
children: /* @__PURE__ */ (0,
|
|
1116
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PanelIcon, { name: "more" })
|
|
931
1117
|
}
|
|
932
1118
|
),
|
|
933
1119
|
items: [
|
|
934
1120
|
{ type: "label", id: "account", text: email || display },
|
|
935
|
-
{ id: "sign-out", label: t("signOut"), icon: /* @__PURE__ */ (0,
|
|
1121
|
+
{ id: "sign-out", label: t("signOut"), icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PanelIcon, { name: "signOut", size: 16 }) }
|
|
936
1122
|
],
|
|
937
1123
|
onClose: () => setMenuOpen(false),
|
|
938
1124
|
onSelect: () => {
|
|
@@ -941,12 +1127,13 @@ function AccountRow({ profile, current, busy, t, run }) {
|
|
|
941
1127
|
}
|
|
942
1128
|
}
|
|
943
1129
|
)
|
|
944
|
-
] }) : /* @__PURE__ */ (0,
|
|
1130
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
945
1131
|
"button",
|
|
946
1132
|
{
|
|
947
1133
|
type: "button",
|
|
948
1134
|
className: "cg-account-action",
|
|
949
1135
|
disabled: busy,
|
|
1136
|
+
"aria-haspopup": "dialog",
|
|
950
1137
|
onClick: () => {
|
|
951
1138
|
void run("add-account", { profileId: id });
|
|
952
1139
|
},
|
|
@@ -955,8 +1142,8 @@ function AccountRow({ profile, current, busy, t, run }) {
|
|
|
955
1142
|
) })
|
|
956
1143
|
] });
|
|
957
1144
|
}
|
|
958
|
-
function Account({ t, state
|
|
959
|
-
const titleId = (0,
|
|
1145
|
+
function Account({ t, state }) {
|
|
1146
|
+
const titleId = (0, import_react5.useId)();
|
|
960
1147
|
const { connection, pending, error, run } = state;
|
|
961
1148
|
const { profileId, profiles = [] } = connection;
|
|
962
1149
|
const rows = profiles.filter((profile) => profile.status === "connected" || !profile.requiresNewRegistration);
|
|
@@ -969,13 +1156,13 @@ function Account({ t, state, adding }) {
|
|
|
969
1156
|
sharing: connection.sharing
|
|
970
1157
|
});
|
|
971
1158
|
}
|
|
972
|
-
const waiting =
|
|
973
|
-
const busy = waiting || Boolean(pending);
|
|
1159
|
+
const waiting = connection.status === "connecting" || pending === "enable" || pending === "cancel";
|
|
1160
|
+
const busy = waiting || Boolean(pending) && !isAccountDialogAction(pending);
|
|
974
1161
|
const needsConsent = connection.status === "connected" && !connection.sharing;
|
|
975
|
-
const message = error ? error.message || t("requestFailed") : !waiting && connection.error?.message;
|
|
976
|
-
return /* @__PURE__ */ (0,
|
|
977
|
-
/* @__PURE__ */ (0,
|
|
978
|
-
/* @__PURE__ */ (0,
|
|
1162
|
+
const message = error ? !isAccountDialogAction(error.action) && (error.message || t("requestFailed")) : !waiting && connection.error?.message;
|
|
1163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "cg-account", "aria-labelledby": titleId, children: [
|
|
1164
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("header", { className: "cg-account-heading", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { id: titleId, children: t("account") }) }),
|
|
1165
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { className: "cg-profile-list", children: rows.map((profile) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
979
1166
|
AccountRow,
|
|
980
1167
|
{
|
|
981
1168
|
profile,
|
|
@@ -986,41 +1173,39 @@ function Account({ t, state, adding }) {
|
|
|
986
1173
|
},
|
|
987
1174
|
profile.id
|
|
988
1175
|
)) }),
|
|
989
|
-
message && /* @__PURE__ */ (0,
|
|
990
|
-
waiting ? /* @__PURE__ */ (0,
|
|
991
|
-
/* @__PURE__ */ (0,
|
|
992
|
-
|
|
993
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: t(adding ? "addHint" : "connecting") })
|
|
994
|
-
] }),
|
|
995
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "dsh-use-chatgpt-actions", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1176
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "dsh-use-chatgpt-error", role: "alert", children: message }),
|
|
1177
|
+
waiting ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cg-account-flow", children: [
|
|
1178
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { role: "status", children: t("connecting") }),
|
|
1179
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "dsh-use-chatgpt-actions", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
996
1180
|
import_dsh_client_ui_primitives3.Button,
|
|
997
1181
|
{
|
|
998
1182
|
variant: "outline",
|
|
999
1183
|
size: "sm",
|
|
1000
|
-
disabled: pending === "cancel"
|
|
1184
|
+
disabled: pending === "cancel",
|
|
1001
1185
|
onClick: () => {
|
|
1002
|
-
void run(
|
|
1186
|
+
void run("cancel");
|
|
1003
1187
|
},
|
|
1004
|
-
children: t(
|
|
1188
|
+
children: t("cancel")
|
|
1005
1189
|
}
|
|
1006
1190
|
) })
|
|
1007
|
-
] }) : needsConsent && /* @__PURE__ */ (0,
|
|
1008
|
-
/* @__PURE__ */ (0,
|
|
1009
|
-
/* @__PURE__ */ (0,
|
|
1191
|
+
] }) : needsConsent && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cg-account-flow", children: [
|
|
1192
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: t("needsConsent") }),
|
|
1193
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "dsh-use-chatgpt-actions", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "primary", size: "sm", disabled: busy, onClick: () => {
|
|
1010
1194
|
void run("enable", { profileId });
|
|
1011
1195
|
}, children: t("enable") }) })
|
|
1012
1196
|
] }),
|
|
1013
|
-
/* @__PURE__ */ (0,
|
|
1197
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1014
1198
|
"button",
|
|
1015
1199
|
{
|
|
1016
1200
|
type: "button",
|
|
1017
1201
|
className: "cg-account-add",
|
|
1018
1202
|
disabled: busy,
|
|
1203
|
+
"aria-haspopup": "dialog",
|
|
1019
1204
|
onClick: () => {
|
|
1020
1205
|
void run("add-account", { newProfile: true });
|
|
1021
1206
|
},
|
|
1022
1207
|
children: [
|
|
1023
|
-
/* @__PURE__ */ (0,
|
|
1208
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PanelIcon, { name: "plus", size: 17 }),
|
|
1024
1209
|
t("newAccount")
|
|
1025
1210
|
]
|
|
1026
1211
|
}
|
|
@@ -1028,17 +1213,17 @@ function Account({ t, state, adding }) {
|
|
|
1028
1213
|
] });
|
|
1029
1214
|
}
|
|
1030
1215
|
function usePageResource(read) {
|
|
1031
|
-
const [data, setData] = (0,
|
|
1032
|
-
const [error, setError] = (0,
|
|
1033
|
-
const [revision, setRevision] = (0,
|
|
1034
|
-
const [refreshing, setRefreshing] = (0,
|
|
1035
|
-
const refresh = (0,
|
|
1216
|
+
const [data, setData] = (0, import_react5.useState)(null);
|
|
1217
|
+
const [error, setError] = (0, import_react5.useState)(null);
|
|
1218
|
+
const [revision, setRevision] = (0, import_react5.useState)(0);
|
|
1219
|
+
const [refreshing, setRefreshing] = (0, import_react5.useState)(false);
|
|
1220
|
+
const refresh = (0, import_react5.useCallback)(() => {
|
|
1036
1221
|
setRevision((value) => value + 1);
|
|
1037
1222
|
}, []);
|
|
1038
|
-
(0,
|
|
1223
|
+
(0, import_react5.useEffect)(() => {
|
|
1039
1224
|
if (!read) {
|
|
1040
1225
|
setData(null);
|
|
1041
|
-
setError(
|
|
1226
|
+
setError(null);
|
|
1042
1227
|
return;
|
|
1043
1228
|
}
|
|
1044
1229
|
const controller = new AbortController();
|
|
@@ -1049,10 +1234,10 @@ function usePageResource(read) {
|
|
|
1049
1234
|
const result = await read(signal, revision > 0);
|
|
1050
1235
|
if (!signal.aborted) {
|
|
1051
1236
|
setData(result);
|
|
1052
|
-
setError(
|
|
1237
|
+
setError(null);
|
|
1053
1238
|
}
|
|
1054
|
-
} catch {
|
|
1055
|
-
if (!signal.aborted) setError(
|
|
1239
|
+
} catch (failure) {
|
|
1240
|
+
if (!signal.aborted) setError(typeof failure?.message === "string" ? failure.message : "");
|
|
1056
1241
|
} finally {
|
|
1057
1242
|
if (!signal.aborted) setRefreshing(false);
|
|
1058
1243
|
}
|
|
@@ -1116,97 +1301,129 @@ async function readModels(profileId, signal, force) {
|
|
|
1116
1301
|
if (!Array.isArray(data?.models)) throw new Error();
|
|
1117
1302
|
return data.models.filter((model) => typeof model?.id === "string" && typeof model.name === "string");
|
|
1118
1303
|
}
|
|
1119
|
-
function
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1304
|
+
function UpdateBanner({ ctx, t, data }) {
|
|
1305
|
+
if (data?.status !== "update_available") return null;
|
|
1306
|
+
function openDetails(event) {
|
|
1307
|
+
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
1308
|
+
if (openPluginDetails(ctx)) event.preventDefault();
|
|
1309
|
+
}
|
|
1310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cg-update-banner", children: [
|
|
1311
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "cg-update-copy", children: [
|
|
1312
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: t("updateTitle") }),
|
|
1313
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
|
|
1314
|
+
"v",
|
|
1315
|
+
data.latestVersion
|
|
1316
|
+
] })
|
|
1317
|
+
] }),
|
|
1318
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1319
|
+
"a",
|
|
1127
1320
|
{
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
children:
|
|
1134
|
-
loginFooter && t("pluginDetails"),
|
|
1135
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: version }),
|
|
1136
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "dsh-use-chatgpt-update-badge", children: t("updateBadge") })
|
|
1137
|
-
]
|
|
1321
|
+
className: "cg-update-action",
|
|
1322
|
+
href: `https://www.npmjs.com/package/${package_default.name}`,
|
|
1323
|
+
target: "_blank",
|
|
1324
|
+
rel: "noopener noreferrer",
|
|
1325
|
+
onClick: openDetails,
|
|
1326
|
+
children: t("updateDetails")
|
|
1138
1327
|
}
|
|
1139
|
-
)
|
|
1140
|
-
loginFooter && t("version"),
|
|
1141
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: version })
|
|
1142
|
-
] }),
|
|
1143
|
-
hasUpdate && fallback && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("small", { role: "status", children: t("pluginDetailsFallback") })
|
|
1328
|
+
)
|
|
1144
1329
|
] });
|
|
1145
1330
|
}
|
|
1146
|
-
function
|
|
1331
|
+
function PluginVersion({ t, data, loginFooter = false }) {
|
|
1332
|
+
const version = "v" + (data?.currentVersion ?? package_default.version);
|
|
1333
|
+
const Wrapper = loginFooter ? "footer" : "div";
|
|
1334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Wrapper, { className: loginFooter ? "cg-login-footer" : "cg-header-version", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "cg-version", children: [
|
|
1335
|
+
loginFooter && t("version"),
|
|
1336
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: version })
|
|
1337
|
+
] }) });
|
|
1338
|
+
}
|
|
1339
|
+
function WorkspaceBody({ t, language, state, installer }) {
|
|
1147
1340
|
const { connection, pending, run } = state;
|
|
1148
|
-
const authorized = connection.status === "connected" && connection.sharing
|
|
1341
|
+
const authorized = connection.status === "connected" && connection.sharing;
|
|
1149
1342
|
const profileId = connection?.profileId;
|
|
1150
|
-
const loadModels = (0,
|
|
1343
|
+
const loadModels = (0, import_react5.useCallback)((signal, force) => readModels(profileId, signal, force), [profileId]);
|
|
1151
1344
|
const models = usePageResource(authorized && profileId ? loadModels : null);
|
|
1152
|
-
return /* @__PURE__ */ (0,
|
|
1153
|
-
/* @__PURE__ */ (0,
|
|
1154
|
-
authorized && /* @__PURE__ */ (0,
|
|
1155
|
-
/* @__PURE__ */ (0,
|
|
1156
|
-
connection.features?.webSearch && /* @__PURE__ */ (0,
|
|
1157
|
-
/* @__PURE__ */ (0,
|
|
1158
|
-
/* @__PURE__ */ (0,
|
|
1159
|
-
/* @__PURE__ */ (0,
|
|
1345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cg-dashboard", children: [
|
|
1346
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Account, { t, state }),
|
|
1347
|
+
authorized && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1348
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ModelCatalog, { t, language, resource: models, profileId }),
|
|
1349
|
+
connection.features?.webSearch && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("details", { className: "cg-legacy-defaults", children: [
|
|
1350
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("summary", { children: t("legacyDefaults") }),
|
|
1351
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: t("legacyHint") }),
|
|
1352
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", size: "sm", disabled: Boolean(pending), onClick: () => {
|
|
1160
1353
|
void run("features", { ...connection.features, webSearch: false });
|
|
1161
1354
|
}, children: t("resetDefaults") })
|
|
1162
1355
|
] })
|
|
1163
|
-
] })
|
|
1356
|
+
] }),
|
|
1357
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PluginRecommendations, { installer, t })
|
|
1164
1358
|
] });
|
|
1165
1359
|
}
|
|
1166
|
-
function ChatGPTPage({ ctx, t, updates }) {
|
|
1167
|
-
const titleId = (0,
|
|
1360
|
+
function ChatGPTPage({ ctx, t, updates, installer }) {
|
|
1361
|
+
const titleId = (0, import_react5.useId)();
|
|
1168
1362
|
const state = useConnection();
|
|
1169
|
-
const { connection, pending } = state;
|
|
1170
|
-
const
|
|
1363
|
+
const { connection, pending, error, run, dismissError } = state;
|
|
1364
|
+
const authorizing = connection?.addingAccount || isAccountDialogAction(pending);
|
|
1365
|
+
const dialogError = isAccountDialogAction(error?.action) ? error : null;
|
|
1366
|
+
const dialogOpen = Boolean(authorizing || dialogError);
|
|
1367
|
+
function closeDialog() {
|
|
1368
|
+
if (authorizing) {
|
|
1369
|
+
if (pending !== "cancel-add") void run("cancel-add");
|
|
1370
|
+
} else dismissError();
|
|
1371
|
+
}
|
|
1171
1372
|
const connectedProfile = connection?.profiles?.some((profile) => profile.id === connection.profileId && profile.status === "connected" && !profile.pending);
|
|
1172
|
-
const signedIn = connection?.available && (connection.status === "connected" ||
|
|
1173
|
-
const version = (0,
|
|
1373
|
+
const signedIn = connection?.available && (connection.status === "connected" || connection.status === "connecting" && connectedProfile);
|
|
1374
|
+
const version = (0, import_react5.useSyncExternalStore)(updates.subscribe, updates.getSnapshot);
|
|
1174
1375
|
const language = (ctx.locale.getSnapshot?.().active || document.documentElement.lang || "zh").startsWith("en") ? "en" : "zh";
|
|
1175
|
-
(0,
|
|
1176
|
-
return /* @__PURE__ */ (0,
|
|
1177
|
-
|
|
1178
|
-
/* @__PURE__ */ (0,
|
|
1179
|
-
/* @__PURE__ */ (0,
|
|
1180
|
-
/* @__PURE__ */ (0,
|
|
1181
|
-
/* @__PURE__ */ (0,
|
|
1182
|
-
|
|
1183
|
-
{
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1376
|
+
(0, import_react5.useEffect)(updates.refresh, [updates]);
|
|
1377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "dsh-use-chatgpt-page", "aria-label": signedIn ? void 0 : t("title"), "aria-labelledby": signedIn ? titleId : void 0, children: [
|
|
1378
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: signedIn ? "dsh-use-chatgpt-content" : "cg-login-layout", inert: dialogOpen ? "" : void 0, children: [
|
|
1379
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(UpdateBanner, { ctx, t, data: version }),
|
|
1380
|
+
signedIn && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("header", { className: "dsh-use-chatgpt-header", children: [
|
|
1381
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { id: titleId, children: t("title") }),
|
|
1382
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cg-header-links", children: [
|
|
1383
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PluginVersion, { t, data: version }),
|
|
1384
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Tooltip, { label: t("viewProject"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1385
|
+
"a",
|
|
1386
|
+
{
|
|
1387
|
+
className: "cg-project-link",
|
|
1388
|
+
href: "https://github.com/houyanchao/dsh-use-chatgpt",
|
|
1389
|
+
target: "_blank",
|
|
1390
|
+
rel: "noopener noreferrer",
|
|
1391
|
+
"aria-label": t("viewProject"),
|
|
1392
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z" }) })
|
|
1393
|
+
}
|
|
1394
|
+
) })
|
|
1395
|
+
] }),
|
|
1396
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: t("subtitle") })
|
|
1192
1397
|
] }),
|
|
1193
|
-
/* @__PURE__ */ (0,
|
|
1398
|
+
signedIn ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(WorkspaceBody, { t, language, state, installer }, connection.profileId) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LoginScreen, { t, state }),
|
|
1399
|
+
!signedIn && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PluginVersion, { t, data: version, loginFooter: true })
|
|
1194
1400
|
] }),
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1401
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1402
|
+
import_dsh_client_ui_primitives3.Modal,
|
|
1403
|
+
{
|
|
1404
|
+
open: dialogOpen,
|
|
1405
|
+
title: t(dialogError ? "authorizationFailed" : "browserTitle"),
|
|
1406
|
+
description: dialogError ? dialogError.message || t("requestFailed") : t("authorizeHint"),
|
|
1407
|
+
closeLabel: t(authorizing ? "cancel" : "close"),
|
|
1408
|
+
onClose: closeDialog,
|
|
1409
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", autoFocus: true, disabled: pending === "cancel-add", onClick: closeDialog, children: t(authorizing ? "cancel" : "close") })
|
|
1410
|
+
}
|
|
1411
|
+
)
|
|
1412
|
+
] });
|
|
1198
1413
|
}
|
|
1199
1414
|
function SidebarIcon({ size = 16 }) {
|
|
1200
|
-
return /* @__PURE__ */ (0,
|
|
1415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChatGPTMark, { size });
|
|
1201
1416
|
}
|
|
1202
1417
|
function SidebarUpdateBadge({ updates, wide, t }) {
|
|
1203
|
-
const version = (0,
|
|
1418
|
+
const version = (0, import_react5.useSyncExternalStore)(updates.subscribe, updates.getSnapshot);
|
|
1204
1419
|
if (version?.status !== "update_available") return null;
|
|
1205
|
-
return /* @__PURE__ */ (0,
|
|
1420
|
+
if (wide) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "dsh-use-chatgpt-update-badge", children: t("updateBadge") });
|
|
1421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "dsh-use-chatgpt-update-dot", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "dsh-use-chatgpt-update-sr", children: t("updateBadge") }) });
|
|
1206
1422
|
}
|
|
1207
1423
|
var inject = ["locale", "slots"];
|
|
1208
1424
|
function apply(ctx) {
|
|
1209
1425
|
const updates = monitorUpdates(ctx);
|
|
1426
|
+
const installer = createPluginInstaller(ctx);
|
|
1210
1427
|
const t = ctx.locale.bind(pluginId);
|
|
1211
1428
|
registerNativeChatOptions(ctx, useConnection);
|
|
1212
1429
|
ctx.effect(() => ctx.locale.register(pluginId, dictionaries), `${pluginId} translations`);
|
|
@@ -1230,14 +1447,14 @@ function apply(ctx) {
|
|
|
1230
1447
|
id: pluginId,
|
|
1231
1448
|
locale: pluginId
|
|
1232
1449
|
}, function Trailing(props) {
|
|
1233
|
-
return /* @__PURE__ */ (0,
|
|
1450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SidebarUpdateBadge, { ...props, updates });
|
|
1234
1451
|
}));
|
|
1235
1452
|
ctx.slots.inject("main", () => ctx.slots.register({
|
|
1236
1453
|
name: "main",
|
|
1237
1454
|
key: pluginId,
|
|
1238
1455
|
locale: pluginId
|
|
1239
1456
|
}, function Panel(props) {
|
|
1240
|
-
return /* @__PURE__ */ (0,
|
|
1457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChatGPTPage, { ...props, ctx, updates, installer });
|
|
1241
1458
|
}));
|
|
1242
1459
|
}
|
|
1243
1460
|
return module.exports; } });
|