dsh-better-ask-user 0.1.6 → 0.2.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/LICENSE +202 -674
- package/NOTICE +23 -1
- package/lib/client.js +662 -323
- package/package.json +4 -3
- package/src/ask-tool.js +47 -5
- package/src/client/AskHistoryRow.module.css +13 -47
- package/src/client/AskHistoryRow.tsx +11 -17
- package/src/client/PlanReviewPanel.module.css +46 -132
- package/src/client/PlanReviewPanel.tsx +63 -13
- package/src/client/QuestionComposer.module.css +85 -580
- package/src/client/QuestionComposer.tsx +46 -63
- package/src/client/QuestionReplyView.module.css +37 -193
- package/src/client/QuestionReplyView.tsx +13 -4
- package/src/client/QuestionWaitBar.module.css +30 -0
- package/src/client/QuestionWaitBar.tsx +41 -0
- package/src/client/index.ts +6 -1
- package/src/client/locales.ts +6 -2
- package/src/client/settings-locales.ts +42 -28
- package/src/client/settings.module.css +119 -0
- package/src/client/settings.tsx +134 -74
- package/src/settings.js +11 -9
package/lib/client.js
CHANGED
|
@@ -25,12 +25,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
25
25
|
var index_exports = {};
|
|
26
26
|
__export(index_exports, {
|
|
27
27
|
PendingQuestion: () => PendingQuestion,
|
|
28
|
+
SettingsEntry: () => SettingsEntry,
|
|
28
29
|
apply: () => apply,
|
|
29
30
|
inject: () => inject
|
|
30
31
|
});
|
|
31
32
|
module.exports = __toCommonJS(index_exports);
|
|
32
33
|
|
|
33
|
-
//
|
|
34
|
+
// node_modules/@deepseek-ai/dsh-brand/lib/index.js
|
|
34
35
|
function brandString(value) {
|
|
35
36
|
return value;
|
|
36
37
|
}
|
|
@@ -487,7 +488,7 @@ function createQuestionDraftStore() {
|
|
|
487
488
|
var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
488
489
|
|
|
489
490
|
// src/client/AskHistoryRow.module.css
|
|
490
|
-
var css = ".
|
|
491
|
+
var css = "/* src/client/AskHistoryRow.module.css */\n.AskHistoryRow_row {\n --ask-accent: #3388BB;\n display: flex;\n align-items: center;\n gap: 10px;\n width: 100%;\n min-height: 32px;\n min-width: 0;\n padding: 4px 8px;\n border: 0;\n border-radius: 6px;\n background: transparent;\n color: var(--dsw-alias-label-secondary);\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n text-align: left;\n}\nbutton.AskHistoryRow_row {\n cursor: pointer;\n transition: background-color 100ms ease;\n}\nbutton.AskHistoryRow_row:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\nbutton.AskHistoryRow_row:active {\n background: color-mix(in srgb, var(--ask-accent) 9%, transparent);\n}\nbutton.AskHistoryRow_row:focus-visible {\n outline: 2px solid var(--ask-accent);\n outline-offset: -2px;\n}\n.AskHistoryRow_icon {\n display: inline-flex;\n flex: none;\n color: var(--dsw-alias-label-tertiary);\n}\n.AskHistoryRow_icon svg {\n width: 14px;\n height: 14px;\n}\n.AskHistoryRow_title {\n flex: none;\n color: var(--dsw-alias-label-primary);\n font-weight: 500;\n}\n.AskHistoryRow_summary {\n min-width: 0;\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--dsw-alias-label-secondary);\n}\n.AskHistoryRow_open {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n flex: none;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n}\n.AskHistoryRow_row:hover .AskHistoryRow_open {\n color: var(--dsw-alias-label-primary);\n}\n@media (max-width: 640px), (pointer: coarse) {\n .AskHistoryRow_row {\n min-height: 44px;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n button.AskHistoryRow_row {\n transition: none;\n }\n}\n";
|
|
491
492
|
var id = "dsh-better-ask-user/AskHistoryRow.module.css";
|
|
492
493
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id) + "]") === null) {
|
|
493
494
|
const tag = document.createElement("style");
|
|
@@ -496,7 +497,14 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
496
497
|
tag.textContent = css;
|
|
497
498
|
document.head.appendChild(tag);
|
|
498
499
|
}
|
|
499
|
-
var AskHistoryRow_default = {
|
|
500
|
+
var AskHistoryRow_default = {
|
|
501
|
+
row: "AskHistoryRow_row",
|
|
502
|
+
icon: "AskHistoryRow_icon",
|
|
503
|
+
title: "AskHistoryRow_title",
|
|
504
|
+
summary: "AskHistoryRow_summary",
|
|
505
|
+
open: "AskHistoryRow_open"
|
|
506
|
+
};
|
|
507
|
+
var css_modules_entry_default = AskHistoryRow_default;
|
|
500
508
|
|
|
501
509
|
// src/client/AskHistoryRow.tsx
|
|
502
510
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -528,13 +536,14 @@ function questionList(argsRaw) {
|
|
|
528
536
|
id: candidate.id,
|
|
529
537
|
question: candidate.question,
|
|
530
538
|
...typeof candidate.header === "string" ? { header: candidate.header } : {},
|
|
539
|
+
...typeof candidate.detail === "string" ? { detail: candidate.detail } : {},
|
|
531
540
|
...Array.isArray(candidate.options) ? {
|
|
532
541
|
options: candidate.options.flatMap((option) => isRecord(option) && typeof option.label === "string" ? [{
|
|
533
542
|
label: option.label,
|
|
534
543
|
...typeof option.description === "string" ? { description: option.description } : {}
|
|
535
544
|
}] : [])
|
|
536
545
|
} : {},
|
|
537
|
-
...typeof candidate.multi_select === "boolean" ? {
|
|
546
|
+
...typeof candidate.multi_select === "boolean" ? { multiSelect: candidate.multi_select } : {}
|
|
538
547
|
});
|
|
539
548
|
}
|
|
540
549
|
return questions;
|
|
@@ -579,27 +588,22 @@ function AskHistoryRow({
|
|
|
579
588
|
} : isPending(output) || phase === "start" ? () => {
|
|
580
589
|
revealPanel(callId);
|
|
581
590
|
} : void 0;
|
|
582
|
-
|
|
583
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className:
|
|
584
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className:
|
|
585
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className:
|
|
586
|
-
action !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
587
|
-
"
|
|
588
|
-
{
|
|
589
|
-
|
|
590
|
-
className: AskHistoryRow_default.open,
|
|
591
|
-
onClick: action,
|
|
592
|
-
"aria-label": review ? t("history.review") : t("history.reopen"),
|
|
593
|
-
children: review ? t("history.review") : t("history.reopen")
|
|
594
|
-
}
|
|
595
|
-
)
|
|
591
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
592
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css_modules_entry_default.icon, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconQuestionOutlineRegular, {}) }),
|
|
593
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css_modules_entry_default.title, children: t("history.title") }),
|
|
594
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css_modules_entry_default.summary, title: summary, children: summary }),
|
|
595
|
+
action !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: css_modules_entry_default.open, children: [
|
|
596
|
+
review ? t("history.review") : t("history.reopen"),
|
|
597
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronRightOutlineRegular, { size: 14 })
|
|
598
|
+
] })
|
|
596
599
|
] });
|
|
600
|
+
return action === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: css_modules_entry_default.row, "data-question-history": callId, children: content }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: css_modules_entry_default.row, "data-question-history": callId, "data-history-action": review ? "review" : "open", onClick: action, "aria-label": review ? t("history.review") : t("history.reopen"), children: content });
|
|
597
601
|
}
|
|
598
602
|
|
|
599
603
|
// src/client/QuestionComposer.tsx
|
|
600
|
-
var
|
|
604
|
+
var import_react3 = require("react");
|
|
601
605
|
|
|
602
|
-
//
|
|
606
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
603
607
|
function r(e) {
|
|
604
608
|
var t, f, n = "";
|
|
605
609
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
@@ -619,12 +623,15 @@ var clsx_default = clsx;
|
|
|
619
623
|
var import_dsh_client_ui_primitives3 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
620
624
|
|
|
621
625
|
// src/client/PlanReviewPanel.tsx
|
|
622
|
-
var
|
|
626
|
+
var import_react2 = require("react");
|
|
623
627
|
var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
624
628
|
|
|
625
|
-
// src/client/
|
|
626
|
-
var
|
|
627
|
-
|
|
629
|
+
// src/client/QuestionWaitBar.tsx
|
|
630
|
+
var import_react = require("react");
|
|
631
|
+
|
|
632
|
+
// src/client/QuestionWaitBar.module.css
|
|
633
|
+
var css2 = "/* src/client/QuestionWaitBar.module.css */\n.QuestionWaitBar_bar {\n --ask-accent: #3388BB;\n display: flex;\n align-items: center;\n flex-shrink: 0;\n gap: 8px;\n min-height: 36px;\n margin: 0 16px 12px;\n padding: 2px 4px 2px 8px;\n border: 0.5px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n background: var(--dsw-alias-bg-layer-2);\n color: var(--dsw-alias-label-primary);\n}\n.QuestionWaitBar_clock {\n position: relative;\n display: grid;\n place-items: center;\n width: 24px;\n height: 24px;\n flex: none;\n}\n.QuestionWaitBar_ring {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n fill: none;\n stroke-width: 2;\n transform: rotate(-90deg);\n}\n.QuestionWaitBar_track {\n stroke: var(--dsw-alias-border-l2);\n}\n.QuestionWaitBar_remaining {\n stroke: var(--ask-accent);\n}\n.QuestionWaitBar_clockHand {\n width: 8px;\n height: 9px;\n margin-top: -4px;\n margin-left: 5px;\n border-left: 1.5px solid var(--dsw-alias-label-secondary);\n border-bottom: 1.5px solid var(--dsw-alias-label-secondary);\n}\n.QuestionWaitBar_pause {\n width: 16px;\n height: 16px;\n color: var(--dsw-alias-label-secondary);\n}\n.QuestionWaitBar_status {\n display: flex;\n align-items: baseline;\n flex-wrap: wrap;\n gap: 4px 12px;\n min-width: 0;\n}\n.QuestionWaitBar_time {\n font-size: 12px;\n line-height: 20px;\n}\n.QuestionWaitBar_bar[data-wait-state=counting] .QuestionWaitBar_time,\n.QuestionWaitBar_bar[data-wait-state=paused] .QuestionWaitBar_time {\n font-family:\n ui-monospace,\n SFMono-Regular,\n monospace;\n font-size: 13px;\n font-weight: 500;\n font-variant-numeric: tabular-nums;\n}\n.QuestionWaitBar_policy {\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 20px;\n}\n.QuestionWaitBar_takeTime {\n flex: none;\n margin-left: auto;\n min-height: 32px;\n padding: 0 8px;\n border: 0;\n border-radius: 6px;\n background: transparent;\n color: var(--dsw-alias-label-secondary);\n font: inherit;\n font-size: 12px;\n cursor: pointer;\n}\n.QuestionWaitBar_takeTime:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-primary);\n}\n.QuestionWaitBar_takeTime:active:not(:disabled) {\n background: color-mix(in srgb, var(--ask-accent) 10%, transparent);\n}\n.QuestionWaitBar_takeTime:focus-visible {\n outline: 2px solid var(--ask-accent);\n outline-offset: 2px;\n}\n.QuestionWaitBar_takeTime:disabled {\n opacity: .4;\n cursor: default;\n}\n@media (max-width: 720px) {\n .QuestionWaitBar_bar {\n gap: 8px;\n margin: 0 16px 12px;\n padding: 4px 8px;\n }\n .QuestionWaitBar_status {\n display: grid;\n gap: 0;\n }\n .QuestionWaitBar_takeTime {\n min-height: 44px;\n }\n}\n";
|
|
634
|
+
var id2 = "dsh-better-ask-user/QuestionWaitBar.module.css";
|
|
628
635
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id2) + "]") === null) {
|
|
629
636
|
const tag = document.createElement("style");
|
|
630
637
|
tag.dataset.plugin = "dsh-better-ask-user";
|
|
@@ -632,19 +639,125 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
632
639
|
tag.textContent = css2;
|
|
633
640
|
document.head.appendChild(tag);
|
|
634
641
|
}
|
|
635
|
-
var
|
|
642
|
+
var QuestionWaitBar_default = {
|
|
643
|
+
bar: "QuestionWaitBar_bar",
|
|
644
|
+
clock: "QuestionWaitBar_clock",
|
|
645
|
+
ring: "QuestionWaitBar_ring",
|
|
646
|
+
track: "QuestionWaitBar_track",
|
|
647
|
+
remaining: "QuestionWaitBar_remaining",
|
|
648
|
+
clockHand: "QuestionWaitBar_clockHand",
|
|
649
|
+
pause: "QuestionWaitBar_pause",
|
|
650
|
+
status: "QuestionWaitBar_status",
|
|
651
|
+
time: "QuestionWaitBar_time",
|
|
652
|
+
policy: "QuestionWaitBar_policy",
|
|
653
|
+
takeTime: "QuestionWaitBar_takeTime"
|
|
654
|
+
};
|
|
655
|
+
var css_modules_entry_default2 = QuestionWaitBar_default;
|
|
636
656
|
|
|
637
|
-
// src/client/
|
|
657
|
+
// src/client/QuestionWaitBar.tsx
|
|
638
658
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
659
|
+
function QuestionWaitBar({ card, t, busy, onTakeTime }) {
|
|
660
|
+
const countdown = card?.countdown;
|
|
661
|
+
const initialWindow = (0, import_react.useRef)(countdown?.remainingMs);
|
|
662
|
+
if (card === void 0 || countdown === void 0 && card.state !== "continued") return null;
|
|
663
|
+
const continued = card.state === "continued";
|
|
664
|
+
const held = card.waitState === "waiting" || card.waitState === "editing";
|
|
665
|
+
const running = !held && !continued && countdown?.running === true;
|
|
666
|
+
const seconds = Math.max(0, Math.ceil((countdown?.remainingMs ?? 0) / 1e3));
|
|
667
|
+
const duration = card.waitMs ?? initialWindow.current;
|
|
668
|
+
const fraction = duration === void 0 || duration <= 0 ? void 0 : Math.min(1, Math.max(0, (countdown?.remainingMs ?? 0) / duration));
|
|
669
|
+
const status = continued ? t("wait.continued") : held ? t("wait.held") : t(!running ? "wait.paused" : card.timeoutMode === "default" ? "wait.autoCountdown" : "wait.countdown", { seconds });
|
|
670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css_modules_entry_default2.bar, "data-question-wait": true, "data-wait-state": continued ? "continued" : held ? "held" : running ? "counting" : "paused", children: [
|
|
671
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: css_modules_entry_default2.clock, "aria-hidden": "true", children: [
|
|
672
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { viewBox: "0 0 32 32", className: css_modules_entry_default2.ring, children: [
|
|
673
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { className: css_modules_entry_default2.track, cx: "16", cy: "16", r: "13" }),
|
|
674
|
+
!held && !continued && fraction !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { className: css_modules_entry_default2.remaining, cx: "16", cy: "16", r: "13", pathLength: "100", strokeDasharray: "100", strokeDashoffset: 100 * (1 - fraction) })
|
|
675
|
+
] }),
|
|
676
|
+
!running ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { className: css_modules_entry_default2.pause, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: continued ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m3 8 3 3 7-7" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M6 4v8M10 4v8" }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css_modules_entry_default2.clockHand })
|
|
677
|
+
] }),
|
|
678
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css_modules_entry_default2.status, role: held || continued ? "status" : void 0, "aria-atomic": "true", children: [
|
|
679
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css_modules_entry_default2.time, "aria-label": status, children: held || continued ? status : `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}` }),
|
|
680
|
+
!held && !continued && !running && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css_modules_entry_default2.policy, children: t("wait.pauseLabel") }),
|
|
681
|
+
!held && !continued && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css_modules_entry_default2.policy, children: t(card.timeoutMode === "default" ? "wait.auto" : "wait.extend") })
|
|
682
|
+
] }),
|
|
683
|
+
!held && !continued && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: css_modules_entry_default2.takeTime, disabled: busy, onClick: onTakeTime, children: t("wait.takeTime") })
|
|
684
|
+
] });
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// src/client/PlanReviewPanel.module.css
|
|
688
|
+
var css3 = "/* src/client/PlanReviewPanel.module.css */\n.PlanReviewPanel_frame {\n --ask-accent: #3388BB;\n display: flex;\n justify-content: center;\n padding: 8px calc(var(--dsh-composer-side-clearance) + 16px) calc(12px + env(safe-area-inset-bottom));\n}\n.PlanReviewPanel_card {\n display: flex;\n flex-direction: column;\n width: 100%;\n min-width: 0;\n max-width: var(--dsh-chat-content-width);\n max-height: min(75vh, 640px);\n max-height: min(75dvh, 640px);\n overflow: hidden;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: 12px;\n background: var(--dsw-alias-bg-layer-3);\n color: var(--dsw-alias-label-primary);\n font-size: 13px;\n line-height: 20px;\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n}\n.PlanReviewPanel_card,\n.PlanReviewPanel_card * {\n box-sizing: border-box;\n}\n.PlanReviewPanel_strip {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n flex-wrap: wrap;\n gap: 12px;\n min-width: 0;\n padding: 12px 16px;\n}\n.PlanReviewPanel_panelLabel {\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n font-weight: 500;\n line-height: 20px;\n}\n.PlanReviewPanel_previewActions {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 8px;\n min-width: 0;\n margin-left: auto;\n}\n.PlanReviewPanel_summary {\n position: relative;\n min-width: 0;\n min-height: 0;\n overflow-y: auto;\n overscroll-behavior: contain;\n scrollbar-gutter: stable;\n padding: 4px 16px 24px;\n}\n.PlanReviewPanel_documentHeading {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n}\n.PlanReviewPanel_documentIcon {\n flex: none;\n width: 18px;\n height: 20px;\n color: var(--dsw-alias-label-tertiary);\n}\n.PlanReviewPanel_title,\n.PlanReviewPanel_description {\n min-width: 0;\n overflow-wrap: anywhere;\n word-break: break-word;\n}\n.PlanReviewPanel_title {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n}\n.PlanReviewPanel_description {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n margin: 8px 0 0;\n color: var(--dsw-alias-label-secondary);\n font-size: 13px;\n line-height: 20px;\n}\n.PlanReviewPanel_footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n flex-shrink: 0;\n flex-wrap: wrap;\n gap: 12px;\n padding: 8px 16px;\n border-top: 0.5px solid var(--dsw-alias-border-l2);\n}\n.PlanReviewPanel_feedback {\n flex: 1;\n min-width: 0;\n color: var(--dsw-alias-state-error-primary);\n font-size: 12px;\n line-height: 18px;\n overflow-wrap: anywhere;\n}\n.PlanReviewPanel_feedback:empty {\n display: none;\n}\n.PlanReviewPanel_actions {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 8px;\n}\n.PlanReviewPanel_actions > button,\n.PlanReviewPanel_previewActions button {\n height: 32px;\n min-height: 32px;\n padding: 0 12px;\n border-radius: 6px;\n font-size: 13px;\n line-height: 20px;\n}\n.PlanReviewPanel_decline {\n padding: 0 12px;\n border: 0;\n background: transparent;\n color: var(--dsw-alias-label-secondary);\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n cursor: pointer;\n}\n.PlanReviewPanel_decline:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-primary);\n}\n.PlanReviewPanel_decline:active:not(:disabled) {\n background: color-mix(in srgb, var(--ask-accent) 10%, transparent);\n}\n.PlanReviewPanel_discuss {\n gap: 8px;\n}\n.PlanReviewPanel_primaryButton {\n --dsw-alias-button-primary-fill: color-mix(in srgb, var(--ask-accent) 85%, black);\n --dsw-alias-button-primary-fill-hover: color-mix(in srgb, var(--ask-accent) 72%, black);\n --dsw-alias-label-primary-foreground: #fff;\n border-color: color-mix(in srgb, var(--ask-accent) 25%, var(--dsw-alias-border-l2));\n background: var(--dsw-alias-button-primary-fill);\n color: var(--dsw-alias-label-primary-foreground);\n}\n.PlanReviewPanel_primaryButton:hover:not(:disabled) {\n background: var(--dsw-alias-button-primary-fill-hover);\n}\n.PlanReviewPanel_primaryButton:active:not(:disabled) {\n background: var(--dsw-alias-button-primary-fill-hover);\n}\n.PlanReviewPanel_card button:focus-visible {\n outline: 2px solid var(--ask-accent);\n outline-offset: -2px;\n}\n.PlanReviewPanel_card button:disabled {\n opacity: .4;\n cursor: default;\n}\n.PlanReviewPanel_srOnly {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n padding: 0;\n border: 0;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n@media (max-width: 720px) {\n .PlanReviewPanel_card {\n max-height: calc(100vh - 160px);\n max-height: calc(100dvh - 160px);\n }\n .PlanReviewPanel_strip {\n padding: 12px 16px;\n }\n .PlanReviewPanel_summary {\n padding: 8px 16px 24px;\n }\n .PlanReviewPanel_card button {\n min-height: 44px;\n }\n .PlanReviewPanel_footer {\n padding: 12px 16px;\n }\n .PlanReviewPanel_feedback {\n flex: 1 1 100%;\n }\n}\n@media (max-width: 420px) {\n .PlanReviewPanel_actions {\n width: 100%;\n }\n .PlanReviewPanel_actions > button {\n flex: 1;\n }\n}\n";
|
|
689
|
+
var id3 = "dsh-better-ask-user/PlanReviewPanel.module.css";
|
|
690
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id3) + "]") === null) {
|
|
691
|
+
const tag = document.createElement("style");
|
|
692
|
+
tag.dataset.plugin = "dsh-better-ask-user";
|
|
693
|
+
tag.dataset.pluginCss = id3;
|
|
694
|
+
tag.textContent = css3;
|
|
695
|
+
document.head.appendChild(tag);
|
|
696
|
+
}
|
|
697
|
+
var PlanReviewPanel_default = {
|
|
698
|
+
frame: "PlanReviewPanel_frame",
|
|
699
|
+
card: "PlanReviewPanel_card",
|
|
700
|
+
strip: "PlanReviewPanel_strip",
|
|
701
|
+
panelLabel: "PlanReviewPanel_panelLabel",
|
|
702
|
+
previewActions: "PlanReviewPanel_previewActions",
|
|
703
|
+
summary: "PlanReviewPanel_summary",
|
|
704
|
+
documentHeading: "PlanReviewPanel_documentHeading",
|
|
705
|
+
documentIcon: "PlanReviewPanel_documentIcon",
|
|
706
|
+
title: "PlanReviewPanel_title",
|
|
707
|
+
description: "PlanReviewPanel_description",
|
|
708
|
+
footer: "PlanReviewPanel_footer",
|
|
709
|
+
feedback: "PlanReviewPanel_feedback",
|
|
710
|
+
actions: "PlanReviewPanel_actions",
|
|
711
|
+
decline: "PlanReviewPanel_decline",
|
|
712
|
+
discuss: "PlanReviewPanel_discuss",
|
|
713
|
+
primaryButton: "PlanReviewPanel_primaryButton",
|
|
714
|
+
srOnly: "PlanReviewPanel_srOnly"
|
|
715
|
+
};
|
|
716
|
+
var css_modules_entry_default3 = PlanReviewPanel_default;
|
|
717
|
+
|
|
718
|
+
// src/client/PlanReviewPanel.tsx
|
|
719
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
639
720
|
function tooltip(description) {
|
|
640
721
|
return description === void 0 ? {} : { title: description };
|
|
641
722
|
}
|
|
642
|
-
function PlanReviewPanel({ pending, review, t, renderSlot }) {
|
|
643
|
-
const [busy, setBusy] = (0,
|
|
644
|
-
const [error, setError] = (0,
|
|
723
|
+
function PlanReviewPanel({ pending, review, t, renderSlot, useQuestionCard }) {
|
|
724
|
+
const [busy, setBusy] = (0, import_react2.useState)(false);
|
|
725
|
+
const [error, setError] = (0, import_react2.useState)(null);
|
|
726
|
+
const card = useQuestionCard(pending.key, (snapshot) => snapshot);
|
|
727
|
+
const canDecide = card !== void 0 && !card.closed && card.channel !== "none";
|
|
728
|
+
const surface = (0, import_react2.useRef)(null);
|
|
729
|
+
const sentVia = (0, import_react2.useRef)(null);
|
|
730
|
+
(0, import_react2.useEffect)(() => {
|
|
731
|
+
if (sentVia.current !== "waterfall" || card?.state !== "continued") return;
|
|
732
|
+
sentVia.current = null;
|
|
733
|
+
setBusy(false);
|
|
734
|
+
setError(t("error.resubmit"));
|
|
735
|
+
}, [card?.state, t]);
|
|
736
|
+
(0, import_react2.useEffect)(() => {
|
|
737
|
+
const release = () => {
|
|
738
|
+
pending.releaseFocus();
|
|
739
|
+
};
|
|
740
|
+
const refocus = () => {
|
|
741
|
+
if (surface.current?.contains(document.activeElement) === true) pending.holdFocus();
|
|
742
|
+
};
|
|
743
|
+
const visibilityChanged = () => {
|
|
744
|
+
if (document.hidden) release();
|
|
745
|
+
else refocus();
|
|
746
|
+
};
|
|
747
|
+
window.addEventListener("blur", release);
|
|
748
|
+
window.addEventListener("focus", refocus);
|
|
749
|
+
document.addEventListener("visibilitychange", visibilityChanged);
|
|
750
|
+
return () => {
|
|
751
|
+
release();
|
|
752
|
+
window.removeEventListener("blur", release);
|
|
753
|
+
window.removeEventListener("focus", refocus);
|
|
754
|
+
document.removeEventListener("visibilitychange", visibilityChanged);
|
|
755
|
+
};
|
|
756
|
+
}, [pending]);
|
|
645
757
|
const settle = (send, remote = false) => {
|
|
646
758
|
setBusy(true);
|
|
647
759
|
setError(null);
|
|
760
|
+
sentVia.current = pending.snapshot().channel === "waterfall" ? "waterfall" : null;
|
|
648
761
|
void send().then(() => {
|
|
649
762
|
if (!remote) return;
|
|
650
763
|
setBusy(false);
|
|
@@ -652,6 +765,7 @@ function PlanReviewPanel({ pending, review, t, renderSlot }) {
|
|
|
652
765
|
setError(t("status.sent"));
|
|
653
766
|
});
|
|
654
767
|
}).catch((cause) => {
|
|
768
|
+
sentVia.current = null;
|
|
655
769
|
setBusy(false);
|
|
656
770
|
setError(cause instanceof Error ? cause.message : String(cause));
|
|
657
771
|
});
|
|
@@ -659,68 +773,148 @@ function PlanReviewPanel({ pending, review, t, renderSlot }) {
|
|
|
659
773
|
const decide = (label) => {
|
|
660
774
|
settle(() => pending.answer({ answers: [{ id: review.id, selected: [label] }] }), pending.snapshot().channel === "rpc");
|
|
661
775
|
};
|
|
662
|
-
const
|
|
776
|
+
const decline = review.decline;
|
|
777
|
+
const summary = (0, import_react2.useMemo)(() => {
|
|
663
778
|
const title = (0, import_dsh_client_ui_primitives2.extractMarkdownPlainText)(review.plan, { mode: "first-line" });
|
|
664
779
|
const description = (0, import_dsh_client_ui_primitives2.extractMarkdownPlainText)(review.plan, { mode: "first-paragraph" });
|
|
665
780
|
return { title, description: description === title ? "" : description };
|
|
666
781
|
}, [review.plan]);
|
|
667
|
-
return /* @__PURE__ */ (0,
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
{
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
children:
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: css_modules_entry_default3.frame, "data-plan-review-key": pending.key, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
783
|
+
"section",
|
|
784
|
+
{
|
|
785
|
+
ref: surface,
|
|
786
|
+
className: css_modules_entry_default3.card,
|
|
787
|
+
"aria-label": review.question,
|
|
788
|
+
"aria-busy": busy,
|
|
789
|
+
onFocusCapture: (event) => {
|
|
790
|
+
if (!event.currentTarget.contains(event.relatedTarget)) pending.holdFocus();
|
|
791
|
+
},
|
|
792
|
+
onBlurCapture: (event) => {
|
|
793
|
+
if (!event.currentTarget.contains(event.relatedTarget)) pending.releaseFocus();
|
|
794
|
+
},
|
|
795
|
+
children: [
|
|
796
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css_modules_entry_default3.strip, children: [
|
|
797
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css_modules_entry_default3.panelLabel, children: t("plan.header") }),
|
|
798
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: css_modules_entry_default3.previewActions, children: renderSlot("conversation.plan-review.actions", { review, requestKey: pending.key }) })
|
|
799
|
+
] }),
|
|
800
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(QuestionWaitBar, { card, t, busy, onTakeTime: () => {
|
|
801
|
+
pending.takeTime();
|
|
802
|
+
} }),
|
|
803
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css_modules_entry_default3.summary, "data-plan-document": true, children: [
|
|
804
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css_modules_entry_default3.documentHeading, children: [
|
|
805
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { className: css_modules_entry_default3.documentIcon, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M14 3H6a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8zM14 3v5h5M9 12h6M9 16h6" }) }),
|
|
806
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { className: css_modules_entry_default3.title, children: summary.title })
|
|
807
|
+
] }),
|
|
808
|
+
summary.description !== "" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css_modules_entry_default3.description, children: summary.description })
|
|
809
|
+
] }),
|
|
810
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css_modules_entry_default3.footer, "data-plan-decision": true, children: [
|
|
811
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: css_modules_entry_default3.feedback, role: "status", "aria-atomic": "true", children: error }),
|
|
812
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css_modules_entry_default3.actions, children: [
|
|
813
|
+
decline !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
814
|
+
"button",
|
|
815
|
+
{
|
|
816
|
+
type: "button",
|
|
817
|
+
className: css_modules_entry_default3.decline,
|
|
818
|
+
...tooltip(decline.description),
|
|
819
|
+
"aria-describedby": decline.description === void 0 ? void 0 : `plan-decline-${pending.key}`,
|
|
820
|
+
disabled: busy || !canDecide,
|
|
821
|
+
onClick: () => {
|
|
822
|
+
decide(decline.label);
|
|
823
|
+
},
|
|
824
|
+
children: decline.label
|
|
825
|
+
}
|
|
826
|
+
),
|
|
827
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
828
|
+
import_dsh_client_ui_primitives2.Button,
|
|
829
|
+
{
|
|
830
|
+
variant: "outline",
|
|
831
|
+
className: css_modules_entry_default3.discuss,
|
|
832
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.IconEditOutlineRegular, { size: 14 }),
|
|
833
|
+
disabled: busy,
|
|
834
|
+
onClick: () => {
|
|
835
|
+
settle(() => pending.dismiss());
|
|
836
|
+
},
|
|
837
|
+
children: t("plan.discuss")
|
|
838
|
+
}
|
|
839
|
+
),
|
|
840
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
841
|
+
import_dsh_client_ui_primitives2.Button,
|
|
842
|
+
{
|
|
843
|
+
variant: "primary",
|
|
844
|
+
className: css_modules_entry_default3.primaryButton,
|
|
845
|
+
...tooltip(review.approve.description),
|
|
846
|
+
"aria-describedby": review.approve.description === void 0 ? void 0 : `plan-approve-${pending.key}`,
|
|
847
|
+
disabled: busy || !canDecide,
|
|
848
|
+
onClick: () => {
|
|
849
|
+
decide(review.approve.label);
|
|
850
|
+
},
|
|
851
|
+
children: t("plan.approve")
|
|
852
|
+
}
|
|
853
|
+
)
|
|
854
|
+
] })
|
|
855
|
+
] }),
|
|
856
|
+
decline?.description !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css_modules_entry_default3.srOnly, id: `plan-decline-${pending.key}`, children: decline.description }),
|
|
857
|
+
review.approve.description !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css_modules_entry_default3.srOnly, id: `plan-approve-${pending.key}`, children: review.approve.description })
|
|
858
|
+
]
|
|
859
|
+
}
|
|
860
|
+
) });
|
|
708
861
|
}
|
|
709
862
|
|
|
710
863
|
// src/client/QuestionComposer.module.css
|
|
711
|
-
var css3 = "/* The takeover seats where the input card sits, centered on the InputBar\n axis at the shared content width (input card - 32): sides = clearance +\n 16px so the relation also holds on narrow viewports. */\n.bau-frame {\n display: flex;\n justify-content: center;\n padding: 6px calc(var(--dsh-composer-side-clearance) + 16px) 10px;\n}\n\n/* Figma Input 973:36348 body over the 1019:36938 header: no banner strip \u2014\n the card keeps zero padding and sections carry their own insets. */\n.bau-card {\n display: flex;\n flex-direction: column;\n width: 100%;\n max-width: var(--dsh-chat-content-width);\n /* Composer seat sits in a fixed-height conversation column (overflow\n hidden): cap the card against the viewport and scroll the option list\n so header and footer actions stay reachable on long batches. */\n max-height: min(60vh, 520px);\n padding: 0 0 10px;\n border: 0;\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l2-darkmode-thin);\n border-radius: var(--dsw-radius-xl);\n background: var(--dsw-specific-input-major);\n box-shadow: var(--dsw-elevation-panel);\n color: var(--dsw-alias-label-primary);\n overflow: hidden;\n /* Elevated surface in dark, same as the menus: the body inside scrolls\n once the card hits the cap above, so the thumb takes the l2 pair. Declared\n on the card because the elevation belongs to the surface, and the custom\n properties inherit down to `.bau-body` (see ui-theme styles/scrollbar.bau-css\n for the rebinding contract). */\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n}\n\n.bau-card,\n.bau-card * {\n box-sizing: border-box;\n}\n\n/* Collapsed to the header strip: drop the height cap and the inner scroll\n seat so the card hugs the title row, freeing the viewport for the\n conversation above while the question stays pending. */\n.bau-cardMinimized {\n max-height: none;\n}\n\n/* The header strip is the whole card when collapsed: the title row needs\n bottom padding once the body that normally carries it is hidden. */\n.bau-cardMinimized .bau-header {\n padding-bottom: 14px;\n}\n\n/* Header button group: minimize sits next to the close action, both on the\n same 24px icon-button grid. */\n.bau-headerActions {\n display: flex;\n align-items: center;\n gap: 4px;\n flex-shrink: 0;\n}\n\n.bau-waitButton {\n white-space: nowrap;\n}\n\n.bau-waitStatus {\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 24px;\n white-space: nowrap;\n}\n\n/* Figma 1019:36938 header, user-tuned: heading block left, close right; the\n pager sits in the footer to balance the card. */\n.bau-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: 16px;\n flex-shrink: 0;\n padding: 20px 16px 0 24px;\n}\n\n.bau-headingBlock {\n min-width: 0;\n}\n\n.bau-eyebrow {\n /* Eyebrow-to-title gap widened from the figma 2px (user-tuned). */\n margin-bottom: 5px;\n color: var(--dsw-alias-label-tertiary);\n font-size: 11px;\n line-height: 16px;\n}\n\n.bau-title {\n margin: 0;\n font-size: 16px;\n line-height: 22px;\n font-weight: 500;\n}\n\n.bau-detail {\n margin: 0 2px 8px;\n}\n\n.bau-footerActions {\n display: flex;\n align-items: center;\n gap: 12px;\n flex-shrink: 0;\n}\n\n.bau-pager {\n display: flex;\n align-items: center;\n gap: 6px;\n flex-shrink: 0;\n}\n\n.bau-progress {\n padding: 0 4px;\n color: var(--dsw-alias-label-secondary);\n font-size: 14px;\n line-height: 24px;\n font-weight: 500;\n white-space: nowrap;\n /* Narrow the plain spaces around the slash without touching glyph tracking. */\n word-spacing: -2px;\n}\n\n.bau-iconButton {\n display: grid;\n place-items: center;\n width: 24px;\n height: 24px;\n padding: 0;\n border: none;\n border-radius: 999px;\n corner-shape: round;\n background: transparent;\n color: var(--dsw-alias-label-tertiary);\n cursor: pointer;\n}\n\n.bau-iconButton:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-primary);\n}\n\n.bau-iconButton:disabled {\n color: var(--dsw-alias-label-dimmed);\n cursor: default;\n}\n\n.bau-body {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n min-height: 0;\n overflow-y: auto;\n overscroll-behavior: contain;\n}\n\n.bau-options {\n display: flex;\n flex-direction: column;\n gap: 1px;\n margin: 8px 0 0;\n padding: 4px 12px;\n}\n\n.bau-option {\n display: flex;\n /* flex-start, not center: with a wrapped description the indicator must\n stay on the FIRST line (centering drifts it down the taller copy block).\n The 8px padding makes a single-line row 40px exactly, so nothing reads\n as top-heavy; .bau-number/.bau-checkbox re-center against the first line box. */\n align-items: flex-start;\n gap: 8px;\n width: 100%;\n min-height: 40px;\n /* Rows are the scroll content, never the slack absorber: a shrinkable row\n collapses to min-height while its wrapped copy keeps the taller\n intrinsic height, and centered content then paints outside the row box \u2014\n over the title and the next row. Overflow belongs to .bau-options. */\n flex-shrink: 0;\n padding: 8px 12px 8px 8px;\n border: 1px solid transparent;\n border-radius: var(--dsw-radius-md);\n background: transparent;\n color: inherit;\n text-align: left;\n cursor: pointer;\n transition: background-color 120ms ease, border-color 120ms ease;\n}\n\n.bau-option:hover:not(:disabled),\n.bau-optionSelected {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.bau-optionSelected {\n border-color: var(--dsw-alias-border-l2);\n}\n\n.bau-option:disabled {\n cursor: default;\n}\n\n/* Leading indicator (20\xD720): single-select shows the option\n number, multi-select swaps in a checkbox; the custom-answer row follows \u2014\n its checkbox mirrors the typed draft (styling only, exclusivity holds). */\n.bau-number {\n display: grid;\n place-items: center;\n flex: 0 0 20px;\n width: 20px;\n height: 20px;\n /* (24px first-line box \u2212 20px indicator) / 2: centers the indicator against\n the first text line under the row's flex-start alignment. */\n margin-top: 2px;\n border-radius: var(--dsw-radius-xs);\n background: var(--dsw-alias-bg-overlay);\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n font-weight: 500;\n line-height: 18px;\n}\n\n/* Multi-select box (figma 1055:41594, user-tuned down to 14\xD714): a radius-4\n box centered in the 20px indicator seat; the box itself is the ::before\n layer so the check icon stacks over it in the same grid cell. */\n.bau-checkbox {\n display: grid;\n place-items: center;\n flex: 0 0 20px;\n width: 20px;\n height: 20px;\n /* Same first-line centering as .bau-number under flex-start alignment. */\n margin-top: 2px;\n}\n\n.bau-checkbox::before {\n content: '';\n grid-area: 1 / 1;\n width: 14px;\n height: 14px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-xs);\n transition: background-color 120ms ease, border-color 120ms ease;\n}\n\n.bau-checkbox > svg {\n grid-area: 1 / 1;\n}\n\n/* Checked: label-primary fill with a primary-foreground check \u2014 the pair\n inverts with the theme (dark fill in light mode, light fill in dark mode). */\n.bau-checkboxChecked {\n color: var(--dsw-alias-label-primary-foreground);\n}\n\n.bau-checkboxChecked::before {\n border-color: var(--dsw-alias-label-primary);\n background: var(--dsw-alias-label-primary);\n}\n\n.bau-optionCopy {\n min-width: 0;\n flex: 1;\n}\n\n.bau-optionLine {\n display: flex;\n align-items: baseline;\n flex-wrap: wrap;\n gap: 2px 6px;\n}\n\n.bau-optionLabel {\n font-size: 14px;\n line-height: 24px;\n font-weight: 500;\n}\n\n.bau-badge {\n padding: 0 4px;\n border-radius: var(--dsw-radius-xs);\n background: var(--dsw-specific-sidebar-nav-item-active-accent);\n color: var(--dsw-alias-button-info-fill);\n font-size: 11px;\n line-height: 18px;\n font-weight: 600;\n}\n\n.bau-description {\n color: var(--dsw-alias-label-tertiary);\n font-size: 14px;\n line-height: 24px;\n font-weight: 400;\n}\n\n/* Read-only note standing in for a question the user skipped: it takes the\n option rows' horizontal padding so it lines up with the choices above it. */\n.bau-reviewNote {\n margin: 0;\n padding: 8px 12px;\n color: var(--dsw-alias-label-tertiary);\n font-size: 14px;\n line-height: 24px;\n}\n\n/* Custom answer row (figma 973:36427): an option-shaped row whose copy is an\n inline text input; focus or a typed draft gives it the selected look.\n While a single-select option is chosen, focus alone does not apply that\n look, so the radio group shows one selection; typing clears the option. */\n.bau-customRow {\n display: flex;\n /* Same first-line alignment as .bau-option \u2014 the indicator seat carries the\n 2px re-centering margin. */\n align-items: flex-start;\n gap: 8px;\n width: 100%;\n min-height: 40px;\n /* Same reason as .bau-option: the custom row is scroll content, and shrinking\n it pushes the inline input past the footer. */\n flex-shrink: 0;\n padding: 8px 12px 8px 8px;\n border: 1px solid transparent;\n border-radius: var(--dsw-radius-md);\n transition: background-color 120ms ease, border-color 120ms ease;\n}\n\n.bau-customRow:hover,\n.bau-customRow:focus-within:not(.bau-customRowYielded),\n.bau-customRowActive {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.bau-customRow:focus-within:not(.bau-customRowYielded),\n.bau-customRowActive {\n border-color: var(--dsw-alias-border-l2);\n}\n\n/* Auto-growing free-text answer (see AnswerField): mirror and textarea share\n one grid cell, the mirror sizes it, and the textarea stretches to it. The\n two layers MUST keep identical type, padding and wrapping \u2014 a mismatch\n makes the box the wrong height for the text the user is typing. */\n.bau-field {\n display: grid;\n min-width: 0;\n --dsh-answer-field-padding: 0;\n}\n\n.bau-field > * {\n grid-area: 1 / 1;\n min-width: 0;\n padding: var(--dsh-answer-field-padding);\n font: inherit;\n font-size: 14px;\n line-height: 24px;\n white-space: pre-wrap;\n word-break: break-word;\n overflow-wrap: anywhere;\n}\n\n/* The height ruler, never painted. Growth stops at 6 lines: the card body is\n capped at 520px and still owes that budget to the title, the option rows and\n the footer actions, so a long answer scrolls in the textarea instead of\n pushing the choices it belongs to out of view.\n content-box overrides the card-wide border-box so the cap counts TEXT lines\n in both variants: under border-box the block variant's 16px of vertical\n padding eats two thirds of a line and the sixth one arrives as an 8px sliver.\n Width is unaffected \u2014 a stretched grid item's used width comes from the\n track, not from this box-sizing. */\n.bau-fieldMirror {\n box-sizing: content-box;\n max-height: 144px;\n overflow: hidden;\n visibility: hidden;\n}\n\n.bau-fieldInput {\n resize: none;\n /* The stack's only scrollport: past the mirror's cap the field stops growing\n and this scrolls. */\n overflow-y: auto;\n border: none;\n outline: none;\n background: transparent;\n color: var(--dsw-alias-label-primary);\n caret-color: var(--dsw-alias-state-business-primary);\n}\n\n.bau-fieldInput::placeholder {\n color: var(--dsw-alias-label-caption);\n}\n\n/* Inline variant: the custom row's copy column, borrowing the row's chrome. */\n.bau-customInline {\n flex: 1;\n}\n\n/* Optionless question: the free-form answer is the whole body, so it carries\n its own frame. The 12px side margins add to the .bau-options 12px padding so both\n edges align with the title's 24px inset; two lines are reserved before the\n answer starts growing. */\n.bau-customBlock {\n min-height: 64px;\n flex-shrink: 0;\n margin: 0 12px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-alias-bg-module-platform);\n --dsh-answer-field-padding: 8px 12px;\n}\n\n.bau-customBlock:focus-within {\n border-color: var(--dsw-alias-state-business-primary);\n}\n\n.bau-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n flex-shrink: 0;\n margin-top: 12px;\n padding: 0 10px 0 18px;\n}\n\n.bau-feedback {\n flex: 1;\n min-height: 16px;\n color: var(--dsw-alias-state-error-primary);\n font-size: 11px;\n line-height: 16px;\n text-align: right;\n}\n\n@media (max-width: 720px) {\n .bau-card {\n border-radius: var(--dsw-radius-xl);\n }\n\n .bau-header {\n padding: 10px 12px 0 18px;\n }\n\n .bau-options {\n padding: 4px 8px;\n }\n\n .bau-title {\n font-size: 15px;\n line-height: 21px;\n }\n\n .bau-option,\n .bau-customRow {\n padding: 8px 6px;\n }\n\n .bau-footer {\n align-items: flex-end;\n padding: 0 10px;\n }\n\n .bau-footerActions {\n flex-shrink: 0;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .bau-option,\n .bau-customRow {\n transition: none;\n }\n}\n\n/* \u2500\u2500 Better ask-user adaptations: markdown / long text / narrow screens \u2500\u2500 */\n.bau-title,\n.bau-eyebrow,\n.bau-optionLabel,\n.bau-description {\n min-width: 0;\n overflow-wrap: anywhere;\n word-break: break-word;\n}\n\n.bau-title {\n max-height: 30vh;\n overflow-y: auto;\n}\n\n.bau-title > div,\n.bau-eyebrow > div,\n.bau-optionLabel > div,\n.bau-description > div {\n margin: 0;\n}\n\n.bau-optionLabel {\n display: block;\n}\n\n.bau-description {\n display: block;\n}\n\n.bau-card {\n max-height: min(75vh, 640px);\n max-height: min(75dvh, 640px);\n}\n\n.bau-frame {\n padding-bottom: calc(10px + env(safe-area-inset-bottom));\n}\n\n@media (max-width: 720px) {\n .bau-header {\n flex-wrap: wrap;\n }\n\n .bau-headingBlock {\n flex: 1 1 100%;\n }\n\n .bau-headerActions {\n flex-wrap: wrap;\n justify-content: flex-end;\n margin-left: auto;\n }\n\n .bau-waitStatus {\n white-space: normal;\n }\n\n .bau-card {\n max-height: calc(100vh - 160px);\n max-height: calc(100dvh - 160px);\n }\n\n .bau-title {\n max-height: 24vh;\n max-height: 24dvh;\n font-size: 15px;\n line-height: 21px;\n }\n\n .bau-footer {\n flex-wrap: wrap;\n }\n\n .bau-feedback {\n flex: 1 1 100%;\n text-align: left;\n }\n\n .bau-footerActions {\n width: 100%;\n justify-content: flex-end;\n flex-wrap: wrap;\n }\n\n .bau-option,\n .bau-customRow {\n min-height: 44px;\n }\n}\n\n@media (max-width: 420px) {\n .bau-footer {\n align-items: stretch;\n flex-direction: column;\n }\n\n .bau-pager {\n justify-content: space-between;\n width: 100%;\n }\n\n .bau-footerActions {\n width: 100%;\n }\n\n .bau-footerActions > button {\n flex: 1 1 auto;\n }\n}\n";
|
|
712
|
-
var
|
|
713
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(
|
|
864
|
+
var css4 = '/* src/client/QuestionComposer.module.css */\n.QuestionComposer_frame {\n --ask-accent: #3388BB;\n display: flex;\n justify-content: center;\n padding: 8px calc(var(--dsh-composer-side-clearance) + 16px) calc(12px + env(safe-area-inset-bottom));\n}\n.QuestionComposer_card {\n display: flex;\n flex-direction: column;\n width: 100%;\n min-width: 0;\n max-width: var(--dsh-chat-content-width);\n max-height: min(75vh, 640px);\n max-height: min(75dvh, 640px);\n overflow: hidden;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: 12px;\n background: var(--dsw-alias-bg-layer-3);\n color: var(--dsw-alias-label-primary);\n font-size: 13px;\n line-height: 20px;\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n}\n.QuestionComposer_card,\n.QuestionComposer_card * {\n box-sizing: border-box;\n}\n.QuestionComposer_cardMinimized {\n max-height: none;\n}\n.QuestionComposer_header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n flex-shrink: 0;\n gap: 12px;\n padding: 16px 16px 12px;\n}\n.QuestionComposer_headingBlock {\n flex: 1;\n min-width: 0;\n}\n.QuestionComposer_eyebrow {\n margin-bottom: 4px;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n line-height: 18px;\n}\n.QuestionComposer_title {\n margin: 0;\n max-height: 24vh;\n max-height: 24dvh;\n overflow-y: auto;\n font-size: 14px;\n line-height: 20px;\n font-weight: 500;\n}\n.QuestionComposer_title,\n.QuestionComposer_eyebrow,\n.QuestionComposer_optionLabel,\n.QuestionComposer_description,\n.QuestionComposer_detail {\n min-width: 0;\n overflow-wrap: anywhere;\n word-break: break-word;\n}\n.QuestionComposer_title > div,\n.QuestionComposer_eyebrow > div,\n.QuestionComposer_optionLabel > div,\n.QuestionComposer_description > div {\n margin: 0;\n}\n.QuestionComposer_title > [data-markdown-variant=compact],\n.QuestionComposer_optionLabel > [data-markdown-variant=compact],\n.QuestionComposer_title > [data-markdown-variant=compact] > p,\n.QuestionComposer_optionLabel > [data-markdown-variant=compact] > p {\n color: inherit;\n font: inherit;\n}\n.QuestionComposer_headerActions,\n.QuestionComposer_footerActions,\n.QuestionComposer_pager {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n gap: 4px;\n}\n.QuestionComposer_footerActions {\n margin-left: auto;\n gap: 8px;\n}\n.QuestionComposer_iconButton {\n display: grid;\n place-items: center;\n width: 32px;\n height: 32px;\n padding: 0;\n border: 0;\n border-radius: 6px;\n background: transparent;\n color: var(--dsw-alias-label-secondary);\n cursor: pointer;\n}\n.QuestionComposer_iconButton:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-primary);\n}\n.QuestionComposer_card button:focus-visible {\n outline: 2px solid var(--ask-accent);\n outline-offset: -2px;\n}\n.QuestionComposer_card button:disabled {\n cursor: default;\n}\n.QuestionComposer_iconButton:disabled,\n.QuestionComposer_footerActions > button:disabled,\n.QuestionComposer_card[aria-busy=true] .QuestionComposer_option,\n.QuestionComposer_fieldInput:disabled {\n opacity: .4;\n}\n.QuestionComposer_iconButton:active:not(:disabled) {\n background: color-mix(in srgb, var(--ask-accent) 10%, transparent);\n}\n.QuestionComposer_body {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n min-height: 0;\n overflow-y: auto;\n overscroll-behavior: contain;\n scrollbar-gutter: stable;\n}\n.QuestionComposer_detail {\n margin: 0 16px 12px;\n color: var(--dsw-alias-label-secondary);\n font-size: 13px;\n line-height: 20px;\n}\n.QuestionComposer_options {\n display: flex;\n flex-direction: column;\n gap: 2px;\n padding: 0 8px 16px;\n}\n.QuestionComposer_option,\n.QuestionComposer_customRow {\n display: flex;\n align-items: flex-start;\n flex-shrink: 0;\n gap: 8px;\n width: 100%;\n min-height: 36px;\n padding: 8px;\n border: 0.5px solid transparent;\n border-radius: 8px;\n transition: background-color 100ms ease, border-color 100ms ease;\n}\n.QuestionComposer_option {\n background: transparent;\n color: inherit;\n text-align: left;\n cursor: pointer;\n font: inherit;\n}\n.QuestionComposer_option:hover:not(:disabled),\n.QuestionComposer_customRow:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n.QuestionComposer_optionSelected,\n.QuestionComposer_optionSelected:hover:not(:disabled),\n.QuestionComposer_customRowActive {\n border-color: color-mix(in srgb, var(--ask-accent) 22%, var(--dsw-alias-border-l2));\n background: color-mix(in srgb, var(--ask-accent) 7%, transparent);\n}\n.QuestionComposer_option:active:not(:disabled) {\n background: color-mix(in srgb, var(--ask-accent) 13%, transparent);\n}\n.QuestionComposer_optionCopy {\n display: grid;\n gap: 4px;\n min-width: 0;\n flex: 1;\n}\n.QuestionComposer_optionLine {\n display: flex;\n align-items: baseline;\n flex-wrap: wrap;\n gap: 4px 8px;\n}\n.QuestionComposer_optionLabel {\n display: block;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n}\n.QuestionComposer_badge {\n padding: 0 6px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: 999px;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n font-weight: 400;\n line-height: 18px;\n}\n.QuestionComposer_description {\n display: block;\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 18px;\n font-weight: 400;\n}\n.QuestionComposer_radio,\n.QuestionComposer_checkbox,\n.QuestionComposer_customIcon {\n display: grid;\n place-items: center;\n flex: 0 0 20px;\n width: 20px;\n height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n.QuestionComposer_radio::before,\n.QuestionComposer_checkbox::before {\n content: "";\n box-sizing: border-box;\n grid-area: 1 / 1;\n width: 16px;\n height: 16px;\n border: 1px solid var(--dsw-alias-border-l4);\n}\n.QuestionComposer_radio::before {\n border-radius: 50%;\n corner-shape: round;\n}\n.QuestionComposer_radioChecked::before {\n border: 5px solid var(--ask-accent);\n}\n.QuestionComposer_checkbox::before {\n border-radius: 4px;\n}\n.QuestionComposer_checkbox > svg {\n grid-area: 1 / 1;\n}\n.QuestionComposer_checkboxChecked {\n color: color-mix(in srgb, var(--ask-accent) 72%, var(--dsw-alias-label-primary));\n}\n.QuestionComposer_checkboxChecked::before {\n border-color: var(--ask-accent);\n background: color-mix(in srgb, var(--ask-accent) 10%, transparent);\n}\n.QuestionComposer_customRow {\n margin-top: 12px;\n border-color: var(--dsw-alias-border-l2);\n border-radius: 8px;\n background: var(--dsw-alias-bg-layer-1);\n}\n.QuestionComposer_customRow:has(.QuestionComposer_fieldInput:focus-visible),\n.QuestionComposer_customBlock:has(.QuestionComposer_fieldInput:focus-visible) {\n outline: 2px solid var(--ask-accent);\n outline-offset: -2px;\n}\n.QuestionComposer_field {\n display: grid;\n min-width: 0;\n --dsh-answer-field-padding: 0;\n}\n.QuestionComposer_field > * {\n grid-area: 1 / 1;\n min-width: 0;\n padding: var(--dsh-answer-field-padding);\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n white-space: pre-wrap;\n word-break: break-word;\n overflow-wrap: anywhere;\n}\n.QuestionComposer_fieldMirror {\n box-sizing: content-box;\n max-height: 120px;\n overflow: hidden;\n visibility: hidden;\n}\n.QuestionComposer_fieldInput {\n resize: none;\n overflow-y: auto;\n border: 0;\n outline: none;\n background: transparent;\n color: var(--dsw-alias-label-primary);\n caret-color: var(--ask-accent);\n}\n.QuestionComposer_fieldInput::placeholder {\n color: var(--dsw-alias-label-tertiary);\n}\n.QuestionComposer_customInline {\n flex: 1;\n}\n.QuestionComposer_customBlock {\n min-height: 96px;\n flex-shrink: 0;\n margin: 0 8px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n background: var(--dsw-alias-bg-layer-1);\n --dsh-answer-field-padding: 7px 10px;\n}\n.QuestionComposer_footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-shrink: 0;\n gap: 12px;\n padding: 8px 16px;\n border-top: 0.5px solid var(--dsw-alias-border-l2);\n}\n.QuestionComposer_footerActions > button {\n height: 32px;\n min-height: 32px;\n padding: 0 12px;\n border-radius: 6px;\n font-size: 13px;\n line-height: 20px;\n}\n.QuestionComposer_primaryButton {\n --dsw-alias-button-primary-fill: color-mix(in srgb, var(--ask-accent) 85%, black);\n --dsw-alias-button-primary-fill-hover: color-mix(in srgb, var(--ask-accent) 72%, black);\n --dsw-alias-label-primary-foreground: #fff;\n border-color: color-mix(in srgb, var(--ask-accent) 25%, var(--dsw-alias-border-l2));\n background: var(--dsw-alias-button-primary-fill);\n color: var(--dsw-alias-label-primary-foreground);\n}\n.QuestionComposer_primaryButton:hover:not(:disabled) {\n background: var(--dsw-alias-button-primary-fill-hover);\n}\n.QuestionComposer_primaryButton:active:not(:disabled) {\n background: var(--dsw-alias-button-primary-fill-hover);\n}\n.QuestionComposer_progress {\n padding: 0 4px;\n color: var(--dsw-alias-label-secondary);\n font-family:\n ui-monospace,\n SFMono-Regular,\n monospace;\n font-size: 12px;\n font-variant-numeric: tabular-nums;\n line-height: 20px;\n white-space: nowrap;\n}\n.QuestionComposer_feedback {\n flex: 1;\n min-width: 0;\n color: var(--dsw-alias-state-error-primary);\n font-size: 12px;\n line-height: 18px;\n overflow-wrap: anywhere;\n text-align: right;\n}\n.QuestionComposer_feedback:empty {\n display: none;\n}\n.QuestionComposer_reviewStatus,\n.QuestionComposer_reviewNote {\n margin: 0;\n padding: 0 16px 12px;\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 20px;\n}\n@media (max-width: 720px) {\n .QuestionComposer_card {\n max-height: calc(100vh - 160px);\n max-height: calc(100dvh - 160px);\n }\n .QuestionComposer_header {\n gap: 8px;\n padding: 16px 8px 16px 16px;\n }\n .QuestionComposer_detail {\n margin: 0 16px 16px;\n }\n .QuestionComposer_options {\n padding: 0 8px 16px;\n }\n .QuestionComposer_option,\n .QuestionComposer_customRow,\n .QuestionComposer_card button {\n min-height: 44px;\n }\n .QuestionComposer_iconButton {\n width: 44px;\n height: 44px;\n }\n .QuestionComposer_field > * {\n font-size: 16px;\n line-height: 24px;\n }\n .QuestionComposer_fieldMirror {\n max-height: 144px;\n }\n .QuestionComposer_footer {\n flex-wrap: wrap;\n padding: 12px 16px;\n }\n .QuestionComposer_feedback {\n flex: 1 1 100%;\n order: 1;\n text-align: left;\n }\n .QuestionComposer_footerActions {\n margin-left: auto;\n }\n}\n@media (max-width: 420px) {\n .QuestionComposer_header {\n flex-wrap: wrap;\n }\n .QuestionComposer_headingBlock {\n flex-basis: calc(100% - 104px);\n }\n .QuestionComposer_footerActions {\n flex: 1 1 100%;\n }\n .QuestionComposer_footerActions > button {\n flex: 1;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .QuestionComposer_option,\n .QuestionComposer_customRow {\n transition: none;\n }\n}\n';
|
|
865
|
+
var id4 = "dsh-better-ask-user/QuestionComposer.module.css";
|
|
866
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id4) + "]") === null) {
|
|
714
867
|
const tag = document.createElement("style");
|
|
715
868
|
tag.dataset.plugin = "dsh-better-ask-user";
|
|
716
|
-
tag.dataset.pluginCss =
|
|
717
|
-
tag.textContent =
|
|
869
|
+
tag.dataset.pluginCss = id4;
|
|
870
|
+
tag.textContent = css4;
|
|
718
871
|
document.head.appendChild(tag);
|
|
719
872
|
}
|
|
720
|
-
var QuestionComposer_default = {
|
|
873
|
+
var QuestionComposer_default = {
|
|
874
|
+
frame: "QuestionComposer_frame",
|
|
875
|
+
card: "QuestionComposer_card",
|
|
876
|
+
cardMinimized: "QuestionComposer_cardMinimized",
|
|
877
|
+
header: "QuestionComposer_header",
|
|
878
|
+
headingBlock: "QuestionComposer_headingBlock",
|
|
879
|
+
eyebrow: "QuestionComposer_eyebrow",
|
|
880
|
+
title: "QuestionComposer_title",
|
|
881
|
+
optionLabel: "QuestionComposer_optionLabel",
|
|
882
|
+
description: "QuestionComposer_description",
|
|
883
|
+
detail: "QuestionComposer_detail",
|
|
884
|
+
headerActions: "QuestionComposer_headerActions",
|
|
885
|
+
footerActions: "QuestionComposer_footerActions",
|
|
886
|
+
pager: "QuestionComposer_pager",
|
|
887
|
+
iconButton: "QuestionComposer_iconButton",
|
|
888
|
+
option: "QuestionComposer_option",
|
|
889
|
+
fieldInput: "QuestionComposer_fieldInput",
|
|
890
|
+
body: "QuestionComposer_body",
|
|
891
|
+
options: "QuestionComposer_options",
|
|
892
|
+
customRow: "QuestionComposer_customRow",
|
|
893
|
+
optionSelected: "QuestionComposer_optionSelected",
|
|
894
|
+
customRowActive: "QuestionComposer_customRowActive",
|
|
895
|
+
optionCopy: "QuestionComposer_optionCopy",
|
|
896
|
+
optionLine: "QuestionComposer_optionLine",
|
|
897
|
+
badge: "QuestionComposer_badge",
|
|
898
|
+
radio: "QuestionComposer_radio",
|
|
899
|
+
checkbox: "QuestionComposer_checkbox",
|
|
900
|
+
customIcon: "QuestionComposer_customIcon",
|
|
901
|
+
radioChecked: "QuestionComposer_radioChecked",
|
|
902
|
+
checkboxChecked: "QuestionComposer_checkboxChecked",
|
|
903
|
+
customBlock: "QuestionComposer_customBlock",
|
|
904
|
+
field: "QuestionComposer_field",
|
|
905
|
+
fieldMirror: "QuestionComposer_fieldMirror",
|
|
906
|
+
customInline: "QuestionComposer_customInline",
|
|
907
|
+
footer: "QuestionComposer_footer",
|
|
908
|
+
primaryButton: "QuestionComposer_primaryButton",
|
|
909
|
+
progress: "QuestionComposer_progress",
|
|
910
|
+
feedback: "QuestionComposer_feedback",
|
|
911
|
+
reviewStatus: "QuestionComposer_reviewStatus",
|
|
912
|
+
reviewNote: "QuestionComposer_reviewNote"
|
|
913
|
+
};
|
|
914
|
+
var css_modules_entry_default4 = QuestionComposer_default;
|
|
721
915
|
|
|
722
916
|
// src/client/QuestionComposer.tsx
|
|
723
|
-
var
|
|
917
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
724
918
|
var REMOVED_CARD = {
|
|
725
919
|
state: "open",
|
|
726
920
|
waitState: "counting",
|
|
@@ -750,18 +944,19 @@ function isComposing(event) {
|
|
|
750
944
|
return event.nativeEvent.isComposing || Reflect.get(event.nativeEvent, "keyCode") === 229;
|
|
751
945
|
}
|
|
752
946
|
function AnswerField(props) {
|
|
753
|
-
return /* @__PURE__ */ (0,
|
|
754
|
-
/* @__PURE__ */ (0,
|
|
947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: clsx_default(css_modules_entry_default4.field, props.variant === "inline" ? css_modules_entry_default4.customInline : css_modules_entry_default4.customBlock), children: [
|
|
948
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { "aria-hidden": true, className: css_modules_entry_default4.fieldMirror, children: `${props.value}
|
|
755
949
|
` }),
|
|
756
|
-
/* @__PURE__ */ (0,
|
|
950
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
757
951
|
"textarea",
|
|
758
952
|
{
|
|
759
953
|
autoFocus: props.autoFocus,
|
|
760
|
-
className:
|
|
954
|
+
className: css_modules_entry_default4.fieldInput,
|
|
761
955
|
value: props.value,
|
|
762
956
|
disabled: props.disabled,
|
|
763
957
|
rows: 1,
|
|
764
958
|
placeholder: props.placeholder,
|
|
959
|
+
"aria-labelledby": props.labelledBy,
|
|
765
960
|
onFocus: props.onFocus,
|
|
766
961
|
onChange: props.onChange,
|
|
767
962
|
onKeyDown: props.onKeyDown
|
|
@@ -771,8 +966,8 @@ function AnswerField(props) {
|
|
|
771
966
|
}
|
|
772
967
|
function QuestionComposer(props) {
|
|
773
968
|
const question = props.matched;
|
|
774
|
-
const review = (0,
|
|
775
|
-
return review === void 0 ? /* @__PURE__ */ (0,
|
|
969
|
+
const review = (0, import_react3.useMemo)(() => planReviewOf(question.questions), [question]);
|
|
970
|
+
return review === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
776
971
|
QuestionFlow,
|
|
777
972
|
{
|
|
778
973
|
pending: question,
|
|
@@ -782,16 +977,16 @@ function QuestionComposer(props) {
|
|
|
782
977
|
actions: props.actions
|
|
783
978
|
},
|
|
784
979
|
question.key
|
|
785
|
-
) : /* @__PURE__ */ (0,
|
|
980
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PlanReviewPanel, { pending: question, review, t: props.t, renderSlot: props.renderSlot, useQuestionCard: props.useQuestionCard }, question.key);
|
|
786
981
|
}
|
|
787
982
|
function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
788
983
|
const questions = pending.questions;
|
|
789
984
|
const review = pending.review;
|
|
790
|
-
const markdownLabels = (0,
|
|
985
|
+
const markdownLabels = (0, import_react3.useMemo)(() => ({
|
|
791
986
|
code: { copyLabel: t("copy"), copiedLabel: t("copied"), toolbarLabels: { codeLabel: t("codeBlock.title"), wrapLabel: t("codeBlock.wrap"), unwrapLabel: t("codeBlock.unwrap") } },
|
|
792
987
|
footnotes: t("markdown.footnotes")
|
|
793
988
|
}), [t]);
|
|
794
|
-
const initialDrafts = (0,
|
|
989
|
+
const initialDrafts = (0, import_react3.useMemo)(() => {
|
|
795
990
|
const recorded = new Map((review ?? []).map((answer) => [answer.id, answer]));
|
|
796
991
|
return questions.map((item) => {
|
|
797
992
|
const answer = recorded.get(item.id);
|
|
@@ -811,36 +1006,37 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
811
1006
|
const index = validStored?.index ?? 0;
|
|
812
1007
|
const drafts = storedProgress?.drafts ?? initialDrafts;
|
|
813
1008
|
const restoredWait = storedProgress?.wait ?? (storedProgress?.drafts.some((item, itemIndex) => item.selected.length !== initialDrafts[itemIndex]?.selected.length || item.selected.some((label, labelIndex) => label !== initialDrafts[itemIndex]?.selected[labelIndex]) || item.custom !== "" || item.skipped) === true ? "editing" : void 0);
|
|
814
|
-
const [busy, setBusy] = (0,
|
|
815
|
-
const [error, setError] = (0,
|
|
1009
|
+
const [busy, setBusy] = (0, import_react3.useState)(null);
|
|
1010
|
+
const [error, setError] = (0, import_react3.useState)(null);
|
|
816
1011
|
const card = useQuestionCard(pending.key, (snapshot) => snapshot ?? REMOVED_CARD);
|
|
817
1012
|
const canSubmit = card.channel !== "none";
|
|
818
1013
|
const locked = busy !== null || review !== void 0;
|
|
819
|
-
const sentVia = (0,
|
|
820
|
-
(0,
|
|
1014
|
+
const sentVia = (0, import_react3.useRef)(null);
|
|
1015
|
+
(0, import_react3.useEffect)(() => {
|
|
821
1016
|
if (sentVia.current !== "waterfall" || card.state !== "continued") return;
|
|
822
1017
|
sentVia.current = null;
|
|
823
1018
|
setBusy(null);
|
|
824
1019
|
setError({ key: "error.resubmit" });
|
|
825
1020
|
}, [card.state]);
|
|
826
|
-
(0,
|
|
1021
|
+
(0, import_react3.useEffect)(() => {
|
|
827
1022
|
if (card.closed) actions.clear(pending.key);
|
|
828
1023
|
}, [actions, card.closed, pending.key]);
|
|
829
|
-
(0,
|
|
1024
|
+
(0, import_react3.useEffect)(() => {
|
|
830
1025
|
actions.prune(pending.liveKeys());
|
|
831
1026
|
}, [actions, pending]);
|
|
832
|
-
const waitDisposition = (0,
|
|
833
|
-
(0,
|
|
1027
|
+
const waitDisposition = (0, import_react3.useRef)(restoredWait);
|
|
1028
|
+
(0, import_react3.useEffect)(() => {
|
|
834
1029
|
if (waitDisposition.current === "waiting") pending.takeTime();
|
|
835
1030
|
if (waitDisposition.current === "editing") pending.bump();
|
|
836
1031
|
}, [pending]);
|
|
837
1032
|
const countdown = card.countdown;
|
|
838
|
-
const [minimized, setMinimized] = (0,
|
|
839
|
-
const focusedQuestions = (0,
|
|
840
|
-
const answerSurface = (0,
|
|
1033
|
+
const [minimized, setMinimized] = (0, import_react3.useState)(false);
|
|
1034
|
+
const focusedQuestions = (0, import_react3.useRef)(/* @__PURE__ */ new Set());
|
|
1035
|
+
const answerSurface = (0, import_react3.useRef)(null);
|
|
841
1036
|
const question = questions[index];
|
|
842
1037
|
const draft = drafts[index];
|
|
843
1038
|
const hasOptions = (question.options?.length ?? 0) > 0;
|
|
1039
|
+
const questionId = `question-${pending.key}-${String(index)}`;
|
|
844
1040
|
const replaceProgress = (nextIndex, nextDrafts) => {
|
|
845
1041
|
pending.bump();
|
|
846
1042
|
actions.replace(pending.key, {
|
|
@@ -860,7 +1056,7 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
860
1056
|
const blurAnswerSurface = (event) => {
|
|
861
1057
|
if (!event.currentTarget.contains(event.relatedTarget)) pending.releaseFocus();
|
|
862
1058
|
};
|
|
863
|
-
(0,
|
|
1059
|
+
(0, import_react3.useEffect)(() => {
|
|
864
1060
|
const release = () => {
|
|
865
1061
|
pending.releaseFocus();
|
|
866
1062
|
};
|
|
@@ -991,40 +1187,33 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
991
1187
|
}
|
|
992
1188
|
submitDrafts(nextDrafts);
|
|
993
1189
|
};
|
|
994
|
-
return /* @__PURE__ */ (0,
|
|
1190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: css_modules_entry_default4.frame, "data-question-key": pending.key, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
995
1191
|
"section",
|
|
996
1192
|
{
|
|
997
|
-
className: clsx_default(
|
|
998
|
-
"aria-labelledby":
|
|
1193
|
+
className: clsx_default(css_modules_entry_default4.card, minimized && css_modules_entry_default4.cardMinimized),
|
|
1194
|
+
"aria-labelledby": questionId,
|
|
1195
|
+
"aria-busy": busy !== null,
|
|
999
1196
|
children: [
|
|
1000
|
-
/* @__PURE__ */ (0,
|
|
1001
|
-
/* @__PURE__ */ (0,
|
|
1002
|
-
question.header !== void 0 && /* @__PURE__ */ (0,
|
|
1003
|
-
/* @__PURE__ */ (0,
|
|
1197
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("header", { className: css_modules_entry_default4.header, children: [
|
|
1198
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css_modules_entry_default4.headingBlock, children: [
|
|
1199
|
+
question.header !== void 0 && question.header.trim() !== question.question.trim() && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: css_modules_entry_default4.eyebrow, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.MarkdownText, { text: question.header, variant: "compact", labels: markdownLabels }) }),
|
|
1200
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1004
1201
|
"div",
|
|
1005
1202
|
{
|
|
1006
|
-
className:
|
|
1007
|
-
id:
|
|
1203
|
+
className: css_modules_entry_default4.title,
|
|
1204
|
+
id: questionId,
|
|
1008
1205
|
role: "heading",
|
|
1009
1206
|
"aria-level": 2,
|
|
1010
|
-
children: /* @__PURE__ */ (0,
|
|
1207
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.MarkdownText, { text: question.question, variant: "compact", labels: markdownLabels })
|
|
1011
1208
|
}
|
|
1012
1209
|
)
|
|
1013
1210
|
] }),
|
|
1014
|
-
/* @__PURE__ */ (0,
|
|
1015
|
-
|
|
1016
|
-
seconds: Math.ceil(countdown.remainingMs / 1e3)
|
|
1017
|
-
}) }),
|
|
1018
|
-
countdown !== void 0 && card.waitState !== "waiting" && card.waitState !== "editing" && card.waitState !== "continued" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: QuestionComposer_default.waitStatus, children: t(card.timeoutMode === "default" ? "wait.auto" : "wait.extend") }),
|
|
1019
|
-
countdown !== void 0 && card.waitState !== "waiting" && card.waitState !== "editing" && card.waitState !== "continued" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", className: QuestionComposer_default.waitButton, onClick: takeTime, children: t("wait.takeTime") }),
|
|
1020
|
-
card.state === "continued" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: QuestionComposer_default.waitStatus, children: t("wait.continued") }),
|
|
1021
|
-
countdown !== void 0 && (card.waitState === "waiting" || card.waitState === "editing") && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: QuestionComposer_default.waitStatus, children: t("wait.held") }),
|
|
1022
|
-
review !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: QuestionComposer_default.waitStatus, children: t("review.status") }),
|
|
1023
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1211
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css_modules_entry_default4.headerActions, children: [
|
|
1212
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1024
1213
|
"button",
|
|
1025
1214
|
{
|
|
1026
1215
|
type: "button",
|
|
1027
|
-
className:
|
|
1216
|
+
className: css_modules_entry_default4.iconButton,
|
|
1028
1217
|
"aria-label": t(minimized ? "nav.maximize" : "nav.minimize"),
|
|
1029
1218
|
title: t(minimized ? "nav.maximize" : "nav.minimize"),
|
|
1030
1219
|
"aria-expanded": !minimized,
|
|
@@ -1032,99 +1221,99 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1032
1221
|
onClick: () => {
|
|
1033
1222
|
setMinimized((current) => !current);
|
|
1034
1223
|
},
|
|
1035
|
-
children: minimized ? /* @__PURE__ */ (0,
|
|
1224
|
+
children: minimized ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconChevronUpOutlineRegular, {}) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconChevronDownOutlineRegular, {})
|
|
1036
1225
|
}
|
|
1037
1226
|
),
|
|
1038
|
-
/* @__PURE__ */ (0,
|
|
1227
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1039
1228
|
"button",
|
|
1040
1229
|
{
|
|
1041
1230
|
type: "button",
|
|
1042
|
-
className:
|
|
1231
|
+
className: css_modules_entry_default4.iconButton,
|
|
1043
1232
|
"aria-label": t(pending.dismissal === "hide" ? "nav.close" : "nav.cancel"),
|
|
1044
1233
|
title: t(pending.dismissal === "hide" ? "nav.close" : "nav.cancel"),
|
|
1045
1234
|
disabled: busy !== null,
|
|
1046
1235
|
onClick: dismissFlow,
|
|
1047
|
-
children: /* @__PURE__ */ (0,
|
|
1236
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconCloseOutlineRegular, {})
|
|
1048
1237
|
}
|
|
1049
1238
|
)
|
|
1050
1239
|
] })
|
|
1051
1240
|
] }),
|
|
1052
|
-
|
|
1053
|
-
|
|
1241
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(QuestionWaitBar, { card, t, busy: busy !== null, onTakeTime: takeTime }),
|
|
1242
|
+
review !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: css_modules_entry_default4.reviewStatus, children: t("review.status") }),
|
|
1243
|
+
!minimized && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1244
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1054
1245
|
"div",
|
|
1055
1246
|
{
|
|
1056
1247
|
ref: answerSurface,
|
|
1057
|
-
className:
|
|
1248
|
+
className: css_modules_entry_default4.body,
|
|
1058
1249
|
"data-question-scroll": true,
|
|
1059
1250
|
onFocusCapture: focusAnswerSurface,
|
|
1060
1251
|
onBlurCapture: blurAnswerSurface,
|
|
1061
1252
|
children: [
|
|
1062
|
-
question.detail !== void 0 && /* @__PURE__ */ (0,
|
|
1063
|
-
/* @__PURE__ */ (0,
|
|
1253
|
+
question.detail !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: css_modules_entry_default4.detail, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.MarkdownText, { text: question.detail, labels: markdownLabels }) }),
|
|
1254
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css_modules_entry_default4.options, role: hasOptions && question.multiSelect !== true ? "radiogroup" : "group", "aria-labelledby": questionId, children: [
|
|
1064
1255
|
(question.options ?? []).map((option, optionIndex) => {
|
|
1065
1256
|
const selected = draft.selected.includes(option.label);
|
|
1066
1257
|
const display = parseRecommendedLabel(option.label);
|
|
1067
|
-
return /* @__PURE__ */ (0,
|
|
1258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1068
1259
|
"button",
|
|
1069
1260
|
{
|
|
1070
1261
|
type: "button",
|
|
1071
|
-
className: clsx_default(
|
|
1262
|
+
className: clsx_default(css_modules_entry_default4.option, selected && css_modules_entry_default4.optionSelected),
|
|
1072
1263
|
role: question.multiSelect === true ? "checkbox" : "radio",
|
|
1073
1264
|
"aria-checked": selected,
|
|
1074
|
-
"aria-label": display.label,
|
|
1265
|
+
"aria-label": display.recommended ? `${display.label}, ${t("option.recommended")}` : display.label,
|
|
1266
|
+
"aria-describedby": option.description === void 0 ? void 0 : `${questionId}-option-${String(optionIndex)}`,
|
|
1075
1267
|
disabled: locked,
|
|
1076
1268
|
onClick: () => {
|
|
1077
1269
|
choose(option.label);
|
|
1078
1270
|
},
|
|
1079
|
-
onKeyDown: (event) => {
|
|
1080
|
-
if (event.key !== "Enter") return;
|
|
1081
|
-
event.preventDefault();
|
|
1082
|
-
submitDrafts(drafts);
|
|
1083
|
-
},
|
|
1084
1271
|
children: [
|
|
1085
|
-
question.multiSelect === true ? /* @__PURE__ */ (0,
|
|
1086
|
-
/* @__PURE__ */ (0,
|
|
1087
|
-
/* @__PURE__ */ (0,
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1272
|
+
question.multiSelect === true ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: clsx_default(css_modules_entry_default4.checkbox, selected && css_modules_entry_default4.checkboxChecked), "aria-hidden": "true", children: selected && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconCheckOutlineRegular, { size: 12 }) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: clsx_default(css_modules_entry_default4.radio, selected && css_modules_entry_default4.radioChecked), "aria-hidden": "true" }),
|
|
1273
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: css_modules_entry_default4.optionCopy, children: [
|
|
1274
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: css_modules_entry_default4.optionLine, children: [
|
|
1275
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css_modules_entry_default4.optionLabel, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.MarkdownText, { text: display.label, variant: "compact", labels: markdownLabels }) }),
|
|
1276
|
+
display.recommended && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css_modules_entry_default4.badge, children: t("option.recommended") })
|
|
1277
|
+
] }),
|
|
1278
|
+
option.description !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css_modules_entry_default4.description, id: `${questionId}-option-${String(optionIndex)}`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.MarkdownText, { text: option.description, variant: "compact", labels: markdownLabels }) })
|
|
1279
|
+
] })
|
|
1091
1280
|
]
|
|
1092
1281
|
},
|
|
1093
1282
|
`${option.label}-${String(optionIndex)}`
|
|
1094
1283
|
);
|
|
1095
1284
|
}),
|
|
1096
|
-
review !== void 0 && draft.skipped && /* @__PURE__ */ (0,
|
|
1097
|
-
(review === void 0 || draft.custom !== "") && (hasOptions ? /* @__PURE__ */ (0,
|
|
1285
|
+
review !== void 0 && draft.skipped && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css_modules_entry_default4.reviewNote, children: t("review.skipped") }),
|
|
1286
|
+
(review === void 0 || draft.custom !== "") && (hasOptions ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1098
1287
|
"div",
|
|
1099
1288
|
{
|
|
1100
1289
|
className: clsx_default(
|
|
1101
|
-
|
|
1102
|
-
draft.custom !== "" &&
|
|
1103
|
-
question.multiSelect !== true && draft.selected.length > 0 && QuestionComposer_default.customRowYielded
|
|
1290
|
+
css_modules_entry_default4.customRow,
|
|
1291
|
+
draft.custom !== "" && css_modules_entry_default4.customRowActive
|
|
1104
1292
|
),
|
|
1105
1293
|
children: [
|
|
1106
|
-
question.multiSelect === true ? /* @__PURE__ */ (0,
|
|
1294
|
+
question.multiSelect === true ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1107
1295
|
"span",
|
|
1108
1296
|
{
|
|
1109
|
-
className: clsx_default(
|
|
1297
|
+
className: clsx_default(css_modules_entry_default4.checkbox, draft.custom !== "" && css_modules_entry_default4.checkboxChecked),
|
|
1110
1298
|
"aria-hidden": "true",
|
|
1111
|
-
children: draft.custom !== "" && /* @__PURE__ */ (0,
|
|
1299
|
+
children: draft.custom !== "" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconCheckOutlineRegular, { size: 12 })
|
|
1112
1300
|
}
|
|
1113
|
-
) : /* @__PURE__ */ (0,
|
|
1114
|
-
/* @__PURE__ */ (0,
|
|
1301
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css_modules_entry_default4.customIcon, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconEditOutlineRegular, { size: 12 }) }),
|
|
1302
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1115
1303
|
AnswerField,
|
|
1116
1304
|
{
|
|
1117
1305
|
variant: "inline",
|
|
1118
1306
|
value: draft.custom,
|
|
1119
1307
|
disabled: locked,
|
|
1120
1308
|
placeholder: t("custom.placeholder"),
|
|
1309
|
+
labelledBy: questionId,
|
|
1121
1310
|
onChange: draftCustom,
|
|
1122
1311
|
onKeyDown: continueFromCustom
|
|
1123
1312
|
}
|
|
1124
1313
|
)
|
|
1125
1314
|
]
|
|
1126
1315
|
}
|
|
1127
|
-
) : /* @__PURE__ */ (0,
|
|
1316
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1128
1317
|
AnswerField,
|
|
1129
1318
|
{
|
|
1130
1319
|
autoFocus: canSubmit && countdown === void 0 && !locked && !focusedQuestions.current.has(index),
|
|
@@ -1132,6 +1321,7 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1132
1321
|
value: draft.custom,
|
|
1133
1322
|
disabled: locked,
|
|
1134
1323
|
placeholder: t("custom.placeholder"),
|
|
1324
|
+
labelledBy: questionId,
|
|
1135
1325
|
onFocus: () => {
|
|
1136
1326
|
focusedQuestions.current.add(index);
|
|
1137
1327
|
},
|
|
@@ -1143,49 +1333,50 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1143
1333
|
]
|
|
1144
1334
|
}
|
|
1145
1335
|
),
|
|
1146
|
-
/* @__PURE__ */ (0,
|
|
1147
|
-
/* @__PURE__ */ (0,
|
|
1148
|
-
/* @__PURE__ */ (0,
|
|
1336
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("footer", { className: css_modules_entry_default4.footer, children: [
|
|
1337
|
+
questions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css_modules_entry_default4.pager, children: [
|
|
1338
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1149
1339
|
"button",
|
|
1150
1340
|
{
|
|
1151
1341
|
type: "button",
|
|
1152
|
-
className:
|
|
1342
|
+
className: css_modules_entry_default4.iconButton,
|
|
1153
1343
|
"aria-label": t("nav.prev"),
|
|
1154
1344
|
disabled: index === 0 || busy !== null,
|
|
1155
1345
|
onClick: () => {
|
|
1156
1346
|
replaceProgress(index - 1, drafts);
|
|
1157
1347
|
setError(null);
|
|
1158
1348
|
},
|
|
1159
|
-
children: /* @__PURE__ */ (0,
|
|
1349
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconChevronLeftOutlineRegular, {})
|
|
1160
1350
|
}
|
|
1161
1351
|
),
|
|
1162
|
-
/* @__PURE__ */ (0,
|
|
1352
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: css_modules_entry_default4.progress, children: [
|
|
1163
1353
|
index + 1,
|
|
1164
1354
|
" / ",
|
|
1165
1355
|
questions.length
|
|
1166
1356
|
] }),
|
|
1167
|
-
/* @__PURE__ */ (0,
|
|
1357
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1168
1358
|
"button",
|
|
1169
1359
|
{
|
|
1170
1360
|
type: "button",
|
|
1171
|
-
className:
|
|
1361
|
+
className: css_modules_entry_default4.iconButton,
|
|
1172
1362
|
"aria-label": t("nav.next"),
|
|
1173
1363
|
disabled: index === questions.length - 1 || busy !== null,
|
|
1174
1364
|
onClick: () => {
|
|
1175
1365
|
replaceProgress(index + 1, drafts);
|
|
1176
1366
|
setError(null);
|
|
1177
1367
|
},
|
|
1178
|
-
children: /* @__PURE__ */ (0,
|
|
1368
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconChevronRightOutlineRegular, {})
|
|
1179
1369
|
}
|
|
1180
1370
|
)
|
|
1181
1371
|
] }),
|
|
1182
|
-
/* @__PURE__ */ (0,
|
|
1183
|
-
review === void 0 && /* @__PURE__ */ (0,
|
|
1184
|
-
/* @__PURE__ */ (0,
|
|
1185
|
-
/* @__PURE__ */ (0,
|
|
1372
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: css_modules_entry_default4.feedback, role: "status", "aria-atomic": "true", children: error === null ? null : "key" in error ? t(error.key) : error.text }),
|
|
1373
|
+
review === void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css_modules_entry_default4.footerActions, children: [
|
|
1374
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", disabled: busy !== null, onClick: skipQuestion, children: t("action.skip") }),
|
|
1375
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1186
1376
|
import_dsh_client_ui_primitives3.Button,
|
|
1187
1377
|
{
|
|
1188
1378
|
variant: "primary",
|
|
1379
|
+
className: css_modules_entry_default4.primaryButton,
|
|
1189
1380
|
disabled: busy !== null || !answered(draft) || index === questions.length - 1 && !canSubmit,
|
|
1190
1381
|
onClick: continueFlow,
|
|
1191
1382
|
children: busy === "answer" ? t("submitting") : index === questions.length - 1 ? t("submit") : t("action.next")
|
|
@@ -1199,7 +1390,7 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1199
1390
|
) });
|
|
1200
1391
|
}
|
|
1201
1392
|
|
|
1202
|
-
//
|
|
1393
|
+
// node_modules/@deepseek-ai/dsh-session/lib/types/surface.js
|
|
1203
1394
|
var SURFACE_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
1204
1395
|
"system/message",
|
|
1205
1396
|
"developer/message",
|
|
@@ -1258,8 +1449,8 @@ function replyPairsOf(text) {
|
|
|
1258
1449
|
}
|
|
1259
1450
|
return { questions, answers };
|
|
1260
1451
|
}
|
|
1261
|
-
function replyAnswerValues(data,
|
|
1262
|
-
const answer = data.answers.find((item) => item.id ===
|
|
1452
|
+
function replyAnswerValues(data, id7) {
|
|
1453
|
+
const answer = data.answers.find((item) => item.id === id7);
|
|
1263
1454
|
const custom = answer?.custom?.trim() ?? "";
|
|
1264
1455
|
return [...answer?.selected ?? [], ...custom === "" ? [] : [custom]];
|
|
1265
1456
|
}
|
|
@@ -1318,86 +1509,117 @@ var questionReplyDefinition = {
|
|
|
1318
1509
|
};
|
|
1319
1510
|
|
|
1320
1511
|
// src/client/QuestionReplyView.tsx
|
|
1321
|
-
var
|
|
1512
|
+
var import_react4 = require("react");
|
|
1322
1513
|
var import_dsh_client_ui_primitives4 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1323
1514
|
|
|
1324
1515
|
// src/client/QuestionReplyView.module.css
|
|
1325
|
-
var
|
|
1326
|
-
var
|
|
1327
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(
|
|
1516
|
+
var css5 = "/* src/client/QuestionReplyView.module.css */\n.QuestionReplyView_row {\n --ask-accent: #3388BB;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: 4px;\n min-width: 0;\n padding: 8px 0;\n}\n.QuestionReplyView_bubble {\n max-width: 85%;\n min-width: 0;\n overflow: hidden;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: 12px;\n background: var(--dsw-alias-bg-layer-3);\n color: var(--dsw-alias-label-primary);\n font-size: 13px;\n line-height: 20px;\n text-align: left;\n overflow-wrap: anywhere;\n}\n.QuestionReplyView_toggle {\n display: block;\n width: 100%;\n min-height: 32px;\n padding: 10px 12px;\n border: 0;\n background: transparent;\n color: inherit;\n cursor: pointer;\n font: inherit;\n text-align: left;\n transition: background-color 100ms ease;\n}\n.QuestionReplyView_toggle:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n.QuestionReplyView_toggle:active {\n background: color-mix(in srgb, var(--ask-accent) 10%, transparent);\n}\n.QuestionReplyView_toggle:focus-visible {\n outline: 2px solid var(--ask-accent);\n outline-offset: -2px;\n border-radius: 8px;\n}\n.QuestionReplyView_labelRow {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.QuestionReplyView_caret {\n display: inline-flex;\n flex: none;\n color: var(--dsw-alias-label-secondary);\n}\n.QuestionReplyView_caret svg {\n width: 12px;\n height: 12px;\n}\n.QuestionReplyView_label {\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n font-weight: 500;\n}\n.QuestionReplyView_summary {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n margin-top: 4px;\n white-space: pre-wrap;\n}\n.QuestionReplyView_text {\n margin: 0;\n padding: 0 12px 12px;\n white-space: pre-wrap;\n}\n.QuestionReplyView_details {\n max-height: min(50vh, 400px);\n margin: 0;\n padding: 0 12px 12px;\n overflow: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n scrollbar-gutter: stable;\n}\n.QuestionReplyView_details > div {\n padding-top: 16px;\n border-top: 1px solid var(--dsw-alias-border-l2);\n}\n.QuestionReplyView_details > div + div {\n margin-top: 16px;\n}\n.QuestionReplyView_question {\n display: grid;\n gap: 4px;\n font-size: 13px;\n}\n.QuestionReplyView_questionText {\n font-weight: 500;\n}\n.QuestionReplyView_header,\n.QuestionReplyView_detail {\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n}\n.QuestionReplyView_detail {\n white-space: pre-wrap;\n}\n.QuestionReplyView_options {\n display: grid;\n gap: 4px;\n margin: 0;\n padding: 0;\n list-style: none;\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n}\n.QuestionReplyView_options li {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n padding: 8px;\n border-radius: 6px;\n}\n.QuestionReplyView_options li[data-selected] {\n background: color-mix(in srgb, var(--ask-accent) 9%, transparent);\n color: var(--dsw-alias-label-primary);\n}\n.QuestionReplyView_selection {\n display: grid;\n place-items: center;\n width: 16px;\n height: 18px;\n flex: none;\n color: color-mix(in srgb, var(--ask-accent) 72%, var(--dsw-alias-label-primary));\n}\n.QuestionReplyView_optionCopy {\n display: grid;\n min-width: 0;\n gap: 4px;\n}\n.QuestionReplyView_optionDescription {\n color: var(--dsw-alias-label-secondary);\n}\n.QuestionReplyView_answer {\n margin: 12px 0 0;\n white-space: pre-wrap;\n}\n.QuestionReplyView_answerLabel {\n margin-right: 8px;\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n}\n.QuestionReplyView_actions {\n display: flex;\n align-items: center;\n gap: 8px;\n color: var(--dsw-alias-label-tertiary);\n}\n.QuestionReplyView_time {\n font-family:\n ui-monospace,\n SFMono-Regular,\n monospace;\n font-size: 12px;\n font-variant-numeric: tabular-nums;\n}\n.QuestionReplyView_action {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n padding: 0;\n border: 0;\n border-radius: 6px;\n background: transparent;\n color: inherit;\n cursor: pointer;\n}\n.QuestionReplyView_action svg {\n width: 14px;\n height: 14px;\n}\n.QuestionReplyView_action:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-primary);\n}\n.QuestionReplyView_action:active {\n background: color-mix(in srgb, var(--ask-accent) 10%, transparent);\n}\n.QuestionReplyView_action:focus-visible {\n outline: 2px solid var(--ask-accent);\n outline-offset: 2px;\n}\n.QuestionReplyView_question,\n.QuestionReplyView_answer,\n.QuestionReplyView_text {\n min-width: 0;\n overflow-wrap: anywhere;\n}\n@media (max-width: 640px) {\n .QuestionReplyView_bubble {\n max-width: 100%;\n }\n .QuestionReplyView_toggle {\n min-height: 44px;\n }\n .QuestionReplyView_action {\n width: 44px;\n height: 44px;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .QuestionReplyView_toggle {\n transition: none;\n }\n}\n";
|
|
1517
|
+
var id5 = "dsh-better-ask-user/QuestionReplyView.module.css";
|
|
1518
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id5) + "]") === null) {
|
|
1328
1519
|
const tag = document.createElement("style");
|
|
1329
1520
|
tag.dataset.plugin = "dsh-better-ask-user";
|
|
1330
|
-
tag.dataset.pluginCss =
|
|
1331
|
-
tag.textContent =
|
|
1521
|
+
tag.dataset.pluginCss = id5;
|
|
1522
|
+
tag.textContent = css5;
|
|
1332
1523
|
document.head.appendChild(tag);
|
|
1333
1524
|
}
|
|
1334
|
-
var QuestionReplyView_default = {
|
|
1525
|
+
var QuestionReplyView_default = {
|
|
1526
|
+
row: "QuestionReplyView_row",
|
|
1527
|
+
bubble: "QuestionReplyView_bubble",
|
|
1528
|
+
toggle: "QuestionReplyView_toggle",
|
|
1529
|
+
labelRow: "QuestionReplyView_labelRow",
|
|
1530
|
+
caret: "QuestionReplyView_caret",
|
|
1531
|
+
label: "QuestionReplyView_label",
|
|
1532
|
+
summary: "QuestionReplyView_summary",
|
|
1533
|
+
text: "QuestionReplyView_text",
|
|
1534
|
+
details: "QuestionReplyView_details",
|
|
1535
|
+
question: "QuestionReplyView_question",
|
|
1536
|
+
questionText: "QuestionReplyView_questionText",
|
|
1537
|
+
header: "QuestionReplyView_header",
|
|
1538
|
+
detail: "QuestionReplyView_detail",
|
|
1539
|
+
options: "QuestionReplyView_options",
|
|
1540
|
+
selection: "QuestionReplyView_selection",
|
|
1541
|
+
optionCopy: "QuestionReplyView_optionCopy",
|
|
1542
|
+
optionDescription: "QuestionReplyView_optionDescription",
|
|
1543
|
+
answer: "QuestionReplyView_answer",
|
|
1544
|
+
answerLabel: "QuestionReplyView_answerLabel",
|
|
1545
|
+
actions: "QuestionReplyView_actions",
|
|
1546
|
+
time: "QuestionReplyView_time",
|
|
1547
|
+
action: "QuestionReplyView_action"
|
|
1548
|
+
};
|
|
1549
|
+
var css_modules_entry_default5 = QuestionReplyView_default;
|
|
1335
1550
|
|
|
1336
1551
|
// src/client/QuestionReplyView.tsx
|
|
1337
|
-
var
|
|
1338
|
-
var QuestionReplyView = (0,
|
|
1339
|
-
return /* @__PURE__ */ (0,
|
|
1552
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1553
|
+
var QuestionReplyView = (0, import_react4.memo)(function QuestionReplyView2({ node, t }) {
|
|
1554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(QuestionReplyBubble, { data: node.data, t });
|
|
1340
1555
|
});
|
|
1341
1556
|
function QuestionReplyBubble({ data, t }) {
|
|
1342
1557
|
const label = t("reply.label");
|
|
1343
|
-
const [open, setOpen] = (0,
|
|
1558
|
+
const [open, setOpen] = (0, import_react4.useState)(false);
|
|
1344
1559
|
const toggleLabel = t(open ? "reply.close" : "reply.open");
|
|
1345
|
-
const summary = data.questions.
|
|
1560
|
+
const summary = data.questions.length === 0 ? data.text : data.questions.flatMap((question) => replyAnswerValues(data, question.id)).join(", ");
|
|
1346
1561
|
const copyText = replyClipboardText(data, t);
|
|
1347
|
-
const [copied, setCopied] = (0,
|
|
1348
|
-
const
|
|
1562
|
+
const [copied, setCopied] = (0, import_react4.useState)(false);
|
|
1563
|
+
const copyTimer = (0, import_react4.useRef)();
|
|
1564
|
+
(0, import_react4.useEffect)(() => () => {
|
|
1565
|
+
window.clearTimeout(copyTimer.current);
|
|
1566
|
+
}, []);
|
|
1567
|
+
const onCopy = (0, import_react4.useCallback)(() => {
|
|
1349
1568
|
if (copied) return;
|
|
1350
1569
|
void (0, import_dsh_client_ui_primitives4.writeClipboard)(copyText).then((ok) => {
|
|
1351
1570
|
if (!ok) return;
|
|
1352
1571
|
setCopied(true);
|
|
1353
|
-
window.setTimeout(() => {
|
|
1572
|
+
copyTimer.current = window.setTimeout(() => {
|
|
1354
1573
|
setCopied(false);
|
|
1355
1574
|
}, 1e3);
|
|
1356
1575
|
});
|
|
1357
1576
|
}, [copied, copyText]);
|
|
1358
|
-
return /* @__PURE__ */ (0,
|
|
1359
|
-
/* @__PURE__ */ (0,
|
|
1360
|
-
/* @__PURE__ */ (0,
|
|
1577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css_modules_entry_default5.row, "data-question-reply": data.callId, "data-reply-outcome": data.outcome, role: "group", "aria-label": label, children: [
|
|
1578
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css_modules_entry_default5.bubble, children: [
|
|
1579
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1361
1580
|
"button",
|
|
1362
1581
|
{
|
|
1363
1582
|
type: "button",
|
|
1364
|
-
className:
|
|
1583
|
+
className: css_modules_entry_default5.toggle,
|
|
1365
1584
|
"aria-expanded": open,
|
|
1366
1585
|
"aria-label": `${label} \xB7 ${toggleLabel}`,
|
|
1367
1586
|
onClick: () => {
|
|
1368
1587
|
setOpen((value) => !value);
|
|
1369
1588
|
},
|
|
1370
1589
|
children: [
|
|
1371
|
-
/* @__PURE__ */ (0,
|
|
1372
|
-
/* @__PURE__ */ (0,
|
|
1373
|
-
/* @__PURE__ */ (0,
|
|
1590
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: css_modules_entry_default5.labelRow, children: [
|
|
1591
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.caret, "aria-hidden": "true", children: open ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.IconChevronDownOutlineRegular, {}) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.IconChevronRightOutlineRegular, {}) }),
|
|
1592
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.label, children: label })
|
|
1374
1593
|
] }),
|
|
1375
|
-
!open && /* @__PURE__ */ (0,
|
|
1594
|
+
!open && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.summary, children: summary === "" ? t("reply.skipped") : summary })
|
|
1376
1595
|
]
|
|
1377
1596
|
}
|
|
1378
1597
|
),
|
|
1379
|
-
open && (data.questions.length === 0 ? /* @__PURE__ */ (0,
|
|
1598
|
+
open && (data.questions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: css_modules_entry_default5.text, children: data.text }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dl", { className: css_modules_entry_default5.details, children: data.questions.map((question) => {
|
|
1380
1599
|
const values = replyAnswerValues(data, question.id);
|
|
1381
|
-
return /* @__PURE__ */ (0,
|
|
1382
|
-
/* @__PURE__ */ (0,
|
|
1383
|
-
question.header && question.header !== question.question && /* @__PURE__ */ (0,
|
|
1384
|
-
/* @__PURE__ */ (0,
|
|
1385
|
-
question.detail && /* @__PURE__ */ (0,
|
|
1386
|
-
question.options && question.options.length > 0 && /* @__PURE__ */ (0,
|
|
1387
|
-
option.label,
|
|
1388
|
-
|
|
1600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1601
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("dt", { className: css_modules_entry_default5.question, children: [
|
|
1602
|
+
question.header && question.header !== question.question && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.header, children: question.header }),
|
|
1603
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.questionText, children: question.question }),
|
|
1604
|
+
question.detail && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.detail, children: question.detail }),
|
|
1605
|
+
question.options && question.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: css_modules_entry_default5.options, children: question.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("li", { "data-selected": values.includes(option.label) || void 0, children: [
|
|
1606
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.selection, "aria-hidden": "true", children: values.includes(option.label) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.IconCheckOutlineRegular, { size: 12 }) : null }),
|
|
1607
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: css_modules_entry_default5.optionCopy, children: [
|
|
1608
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: option.label }),
|
|
1609
|
+
option.description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.optionDescription, children: option.description })
|
|
1610
|
+
] })
|
|
1389
1611
|
] }, option.label)) })
|
|
1390
1612
|
] }),
|
|
1391
|
-
/* @__PURE__ */ (0,
|
|
1392
|
-
/* @__PURE__ */ (0,
|
|
1613
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("dd", { className: css_modules_entry_default5.answer, children: [
|
|
1614
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.answerLabel, children: t("reply.answerLabel") }),
|
|
1393
1615
|
values.length === 0 ? t("reply.skipped") : values.join(", ")
|
|
1394
1616
|
] })
|
|
1395
1617
|
] }, question.id);
|
|
1396
1618
|
}) }))
|
|
1397
1619
|
] }),
|
|
1398
|
-
/* @__PURE__ */ (0,
|
|
1399
|
-
/* @__PURE__ */ (0,
|
|
1400
|
-
/* @__PURE__ */ (0,
|
|
1620
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css_modules_entry_default5.actions, children: [
|
|
1621
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.time, children: new Intl.DateTimeFormat(void 0, { hour: "2-digit", minute: "2-digit", hour12: false }).format(data.time) }),
|
|
1622
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.Tooltip, { label: copied ? t("copied") : t("copy"), side: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: css_modules_entry_default5.action, "aria-label": copied ? t("copied") : t("copy"), onClick: onCopy, children: copied ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.IconCheckOutlineRegular, {}) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.IconCopyOutlineRegular, {}) }) })
|
|
1401
1623
|
] })
|
|
1402
1624
|
] });
|
|
1403
1625
|
}
|
|
@@ -1414,6 +1636,8 @@ var zh = {
|
|
|
1414
1636
|
"history.reopen": "\u6253\u5F00",
|
|
1415
1637
|
"wait.takeTime": "\u6162\u6162\u56DE\u7B54",
|
|
1416
1638
|
"wait.countdown": "{seconds} \u79D2\u540E\u7EE7\u7EED\u5DE5\u4F5C",
|
|
1639
|
+
"wait.autoCountdown": "{seconds} \u79D2\u540E\u81EA\u52A8\u9009\u62E9\u9ED8\u8BA4\u9879",
|
|
1640
|
+
"wait.pauseLabel": "\u5DF2\u6682\u505C",
|
|
1417
1641
|
"wait.paused": "\u5DF2\u6682\u505C \xB7 \u5269\u4F59 {seconds} \u79D2",
|
|
1418
1642
|
"wait.held": "\u4F1A\u4E00\u76F4\u7B49\u4F60\u56DE\u7B54",
|
|
1419
1643
|
"wait.extend": "\u8F93\u5165\u4F1A\u81EA\u52A8\u7EED\u671F",
|
|
@@ -1421,7 +1645,7 @@ var zh = {
|
|
|
1421
1645
|
"wait.continued": "\u5DF2\u7EE7\u7EED\u5DE5\u4F5C\uFF0C\u4ECD\u53EF\u56DE\u7B54",
|
|
1422
1646
|
"review.status": "\u5DF2\u56DE\u7B54",
|
|
1423
1647
|
"review.skipped": "\u8FD9\u9053\u95EE\u9898\u5F53\u65F6\u88AB\u8DF3\u8FC7\u3002",
|
|
1424
|
-
"reply.label": "\
|
|
1648
|
+
"reply.label": "\u95EE\u9898\u56DE\u590D",
|
|
1425
1649
|
"reply.open": "\u5C55\u5F00\u95EE\u9898\u8BE6\u60C5",
|
|
1426
1650
|
"reply.close": "\u6536\u8D77\u95EE\u9898\u8BE6\u60C5",
|
|
1427
1651
|
"reply.answerLabel": "\u56DE\u7B54\uFF1A",
|
|
@@ -1452,6 +1676,8 @@ var en = {
|
|
|
1452
1676
|
"history.reopen": "Open",
|
|
1453
1677
|
"wait.takeTime": "Take time",
|
|
1454
1678
|
"wait.countdown": "Continuing in {seconds}s",
|
|
1679
|
+
"wait.autoCountdown": "Defaults selected in {seconds}s",
|
|
1680
|
+
"wait.pauseLabel": "Paused",
|
|
1455
1681
|
"wait.paused": "Paused \xB7 {seconds}s remaining",
|
|
1456
1682
|
"wait.held": "Waiting until you answer",
|
|
1457
1683
|
"wait.extend": "Typing extends the wait",
|
|
@@ -1459,7 +1685,7 @@ var en = {
|
|
|
1459
1685
|
"wait.continued": "Work continued \u2014 you can still answer",
|
|
1460
1686
|
"review.status": "Answered",
|
|
1461
1687
|
"review.skipped": "This question was skipped.",
|
|
1462
|
-
"reply.label": "
|
|
1688
|
+
"reply.label": "Question reply",
|
|
1463
1689
|
"reply.open": "Open question details",
|
|
1464
1690
|
"reply.close": "Close question details",
|
|
1465
1691
|
"reply.answerLabel": "Answer: ",
|
|
@@ -1481,60 +1707,114 @@ var en = {
|
|
|
1481
1707
|
};
|
|
1482
1708
|
|
|
1483
1709
|
// src/client/settings.tsx
|
|
1484
|
-
var
|
|
1710
|
+
var import_react5 = require("react");
|
|
1711
|
+
var import_dsh_client_ui_primitives5 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1485
1712
|
|
|
1486
1713
|
// src/client/settings-locales.ts
|
|
1487
1714
|
var settingsZh = {
|
|
1488
|
-
summary: "\
|
|
1489
|
-
title: "\u63D0\u95EE
|
|
1490
|
-
|
|
1491
|
-
waitLabel: "\u7B49\u5F85\
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1715
|
+
summary: "\u7B49\u5F85\u4E0E\u8D85\u65F6",
|
|
1716
|
+
title: "\u63D0\u95EE",
|
|
1717
|
+
discard: "\u653E\u5F03\u4FEE\u6539",
|
|
1718
|
+
waitLabel: "\u7B49\u5F85\u56DE\u7B54",
|
|
1719
|
+
durationLabel: "\u7B49\u5F85\u65F6\u957F",
|
|
1720
|
+
timed: "\u5012\u8BA1\u65F6",
|
|
1721
|
+
unlimited: "\u4E0D\u9650\u65F6",
|
|
1722
|
+
seconds: "\u79D2",
|
|
1723
|
+
waitHint: "\u8F93\u5165\u65F6\u91CD\u65B0\u8BA1\u65F6\u3002\u4FEE\u6539\u5BF9\u65B0\u63D0\u95EE\u548C\u8BA1\u5212\u5BA1\u6838\u751F\u6548\u3002",
|
|
1724
|
+
unlimitedHint: "\u4E00\u76F4\u7B49\u5F85\u56DE\u7B54\uFF0C\u8F93\u5165\u65E0\u9700\u7EED\u671F\u3002",
|
|
1725
|
+
timeoutTitle: "\u5012\u8BA1\u65F6\u7ED3\u675F\u540E",
|
|
1726
|
+
behaviorLabel: "\u666E\u901A\u4F1A\u8BDD",
|
|
1727
|
+
goalBehaviorLabel: "Goal \u6D3B\u8DC3\u65F6",
|
|
1728
|
+
native: "\u4FDD\u7559\u95EE\u9898\uFF0C\u7A0D\u540E\u56DE\u7B54",
|
|
1729
|
+
default: "\u81EA\u52A8\u9009\u62E9\u9ED8\u8BA4\u7B54\u6848",
|
|
1730
|
+
nativeHint: "\u8D85\u65F6\u540E\u4ECD\u53EF\u56DE\u7B54\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u540C\u610F\u3002",
|
|
1731
|
+
defaultHint: "\u81EA\u52A8\u7ED3\u679C\u4F1A\u6807\u8BB0\uFF1A\u5355\u9009\u53D6\u9996\u9879\uFF0C\u591A\u9009\u53D6\u63A8\u8350\u9879\uFF08\u65E0\u5219\u9996\u9879\uFF09\uFF0C\u65E0\u9009\u9879\u5219\u8DF3\u8FC7\u3002",
|
|
1732
|
+
timeoutDisabled: "\u4E0D\u9650\u65F6\uFF0C\u65E0\u9700\u8D85\u65F6\u5904\u7406\u3002\u4EE5\u4E0B\u9009\u62E9\u4F1A\u4FDD\u7559\u3002",
|
|
1499
1733
|
readonly: "\u5F53\u524D\u914D\u7F6E\u4E3A\u53EA\u8BFB\u3002",
|
|
1500
1734
|
loading: "\u6B63\u5728\u8BFB\u53D6\u8BBE\u7F6E\u2026",
|
|
1501
1735
|
unavailable: "\u5F53\u524D\u8FDE\u63A5\u4E0B\u8BE5\u914D\u7F6E\u4E0D\u53EF\u7528\u3002",
|
|
1502
|
-
waiting: "\u6B63\u5728\u7B49\u5F85\u5BBF\u4E3B\
|
|
1503
|
-
invalidWait: "\u7B49\u5F85\u65F6\u957F\
|
|
1736
|
+
waiting: "\u6B63\u5728\u7B49\u5F85\u5BBF\u4E3B\u914D\u7F6E\u2026",
|
|
1737
|
+
invalidWait: "\u7B49\u5F85\u65F6\u957F\u987B\u4E3A 1 \u5230 2147483 \u7684\u6574\u6570\u3002",
|
|
1504
1738
|
save: "\u4FDD\u5B58",
|
|
1505
1739
|
saving: "\u4FDD\u5B58\u4E2D\u2026",
|
|
1506
|
-
saved: "\u5DF2\u4FDD\u5B58
|
|
1740
|
+
saved: "\u5DF2\u4FDD\u5B58",
|
|
1507
1741
|
conflict: "\u8BBE\u7F6E\u5DF2\u88AB\u5176\u4ED6\u7A97\u53E3\u4FEE\u6539\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
1508
1742
|
saveFailed: "\u4FDD\u5B58\u5931\u8D25\uFF1A",
|
|
1509
1743
|
dirty: "\u6709\u672A\u4FDD\u5B58\u7684\u4FEE\u6539"
|
|
1510
1744
|
};
|
|
1511
1745
|
var settingsEn = {
|
|
1512
|
-
summary: "
|
|
1513
|
-
title: "
|
|
1514
|
-
|
|
1515
|
-
waitLabel: "Wait
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1746
|
+
summary: "Wait and timeout",
|
|
1747
|
+
title: "Questions",
|
|
1748
|
+
discard: "Discard",
|
|
1749
|
+
waitLabel: "Wait for answers",
|
|
1750
|
+
durationLabel: "Wait duration",
|
|
1751
|
+
timed: "Countdown",
|
|
1752
|
+
unlimited: "Unlimited",
|
|
1753
|
+
seconds: "sec",
|
|
1754
|
+
waitHint: "Typing restarts the countdown. Changes apply to new questions and plan reviews.",
|
|
1755
|
+
unlimitedHint: "Wait until answered, with no countdown to extend.",
|
|
1756
|
+
timeoutTitle: "When the countdown ends",
|
|
1757
|
+
behaviorLabel: "Standard session",
|
|
1758
|
+
goalBehaviorLabel: "Active Goal",
|
|
1759
|
+
native: "Keep questions pending",
|
|
1760
|
+
default: "Select default answers",
|
|
1761
|
+
nativeHint: "You can still answer after timeout. Nothing is automatically approved.",
|
|
1762
|
+
defaultHint: "Marked as automatic: first option for single choice; recommended options (or first) for multiple choice. No options skips the question.",
|
|
1763
|
+
timeoutDisabled: "Inactive with unlimited wait. These choices are kept for timed waits.",
|
|
1523
1764
|
readonly: "This configuration is read-only.",
|
|
1524
1765
|
loading: "Loading settings\u2026",
|
|
1525
1766
|
unavailable: "This configuration is unavailable on the current connection.",
|
|
1526
|
-
waiting: "Waiting for
|
|
1527
|
-
invalidWait: "
|
|
1767
|
+
waiting: "Waiting for host configuration\u2026",
|
|
1768
|
+
invalidWait: "Enter a whole number from 1 to 2147483 seconds.",
|
|
1528
1769
|
save: "Save",
|
|
1529
1770
|
saving: "Saving\u2026",
|
|
1530
|
-
saved: "Saved
|
|
1771
|
+
saved: "Saved",
|
|
1531
1772
|
conflict: "The settings changed in another window; try again.",
|
|
1532
1773
|
saveFailed: "Save failed: ",
|
|
1533
1774
|
dirty: "Unsaved changes"
|
|
1534
1775
|
};
|
|
1535
1776
|
|
|
1777
|
+
// src/client/settings.module.css
|
|
1778
|
+
var css6 = "/* src/client/settings.module.css */\n.settings_cfg {\n --cfg-accent: #3388BB;\n --dsw-alias-button-primary-fill: color-mix(in srgb, var(--cfg-accent) 85%, black);\n --dsw-alias-button-primary-fill-hover: color-mix(in srgb, var(--cfg-accent) 72%, black);\n --dsw-alias-label-primary-foreground: #fff;\n display: flex;\n flex-direction: column;\n gap: 24px;\n max-width: 760px;\n min-width: 0;\n color: var(--dsw-alias-label-primary);\n font-size: 13px;\n line-height: 20px;\n}\n.settings_cfg *,\n.settings_cfg {\n box-sizing: border-box;\n}\n.settings_title {\n margin: 0;\n font-size: 18px;\n line-height: 26px;\n font-weight: 500;\n}\n.settings_note,\n.settings_dependency {\n margin: 0;\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 1.5;\n}\n.settings_group {\n display: flex;\n flex-direction: column;\n gap: 32px;\n min-width: 0;\n}\n.settings_waitSection,\n.settings_timeoutSection {\n display: flex;\n flex-direction: column;\n gap: 12px;\n min-width: 0;\n}\n.settings_timeoutSection {\n padding-top: 24px;\n border-top: 1px solid var(--dsw-alias-border-l2);\n}\n.settings_sectionTitle {\n margin: 0;\n font-size: 14px;\n line-height: 20px;\n font-weight: 500;\n}\n.settings_choiceGroup {\n min-width: 0;\n padding: 0;\n margin: 0;\n border: 0;\n}\n.settings_rowTitle {\n padding: 0;\n margin-bottom: 4px;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n line-height: 18px;\n font-weight: 400;\n}\n.settings_waitSection > .settings_choiceGroup > .settings_rowTitle {\n margin-bottom: 12px;\n color: var(--dsw-alias-label-primary);\n font-size: 14px;\n line-height: 20px;\n font-weight: 500;\n}\n.settings_choices {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 2px;\n padding: 2px;\n border-radius: 10px;\n background: var(--dsw-alias-bg-module-platform, var(--dsw-alias-bg-layer-2));\n}\n.settings_choice {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n min-width: 0;\n min-height: 28px;\n padding: 0 12px;\n border: 0.5px solid transparent;\n border-radius: 8px;\n background: transparent;\n color: var(--dsw-alias-label-secondary);\n cursor: pointer;\n transition: background-color 100ms ease, border-color 100ms ease;\n}\n.settings_choice:has(:checked) {\n border-color: var(--dsw-alias-border-l3);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n font-weight: 500;\n}\n.settings_choice:hover:not(:has(:disabled)) {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n.settings_choice:has(:checked):hover:not(:has(:disabled)) {\n background: var(--dsw-alias-bg-layer-1);\n}\n.settings_choice:active:not(:has(:disabled)) {\n border-color: var(--cfg-accent);\n}\n.settings_choice:has(:focus-visible) {\n outline: 2px solid var(--cfg-accent);\n outline-offset: 2px;\n}\n.settings_choice:has(:disabled) {\n opacity: .4;\n cursor: not-allowed;\n}\n.settings_choiceInput {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: 0;\n overflow: hidden;\n clip-path: inset(50%);\n}\n.settings_choiceInput:focus-visible {\n outline: none;\n}\n.settings_duration {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n line-height: 18px;\n}\n.settings_durationControl {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.settings_input {\n width: 112px;\n min-width: 0;\n height: 32px;\n padding: 0 12px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 6px;\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 13px;\n font-variant-numeric: tabular-nums;\n transition: border-color 100ms ease;\n}\n.settings_unit {\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n}\n.settings_input:hover:not(:disabled) {\n border-color: var(--dsw-alias-label-tertiary);\n}\n.settings_input:focus-visible,\n.settings_button:focus-visible,\n.settings_discard:focus-visible {\n outline: 2px solid var(--cfg-accent);\n outline-offset: 2px;\n}\n.settings_input:disabled,\n.settings_button:disabled,\n.settings_discard:disabled {\n opacity: .4;\n cursor: not-allowed;\n}\n.settings_input[aria-invalid=true] {\n border-color: var(--dsw-alias-state-error-primary);\n}\n.settings_timeoutChoices {\n display: flex;\n flex-direction: column;\n gap: 24px;\n}\n.settings_footer {\n display: flex;\n align-items: center;\n gap: 8px;\n padding-top: 24px;\n border-top: 1px solid var(--dsw-alias-border-l2);\n}\n.settings_statusSlot {\n flex: 1;\n min-width: 0;\n}\n.settings_cfg .settings_discard {\n height: 32px;\n min-height: 32px;\n padding: 0 12px;\n border-radius: 6px;\n font-size: 13px;\n line-height: 20px;\n}\n.settings_cfg .settings_button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n height: 32px;\n min-height: 32px;\n padding: 0 12px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 6px;\n background: var(--dsw-alias-button-primary-fill);\n color: var(--dsw-alias-label-primary-foreground);\n font: inherit;\n font-weight: 500;\n cursor: pointer;\n transition: background-color 100ms ease;\n}\n.settings_cfg .settings_button:hover:not(:disabled),\n.settings_cfg .settings_button:active:not(:disabled) {\n background: var(--dsw-alias-button-primary-fill-hover);\n}\n.settings_status {\n flex: 1;\n min-width: 0;\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n overflow-wrap: anywhere;\n}\n.settings_statusOk {\n color: var(--dsw-alias-state-success-primary);\n}\n.settings_statusError {\n color: var(--dsw-alias-state-error-primary);\n}\n@media (max-width: 640px) {\n .settings_choices {\n grid-template-columns: 1fr;\n }\n .settings_choice,\n .settings_input,\n .settings_cfg .settings_button,\n .settings_cfg .settings_discard {\n min-height: 44px;\n }\n .settings_duration {\n align-items: flex-start;\n flex-direction: column;\n gap: 8px;\n }\n .settings_durationControl {\n width: 100%;\n }\n .settings_input {\n flex: 1;\n }\n .settings_footer {\n align-items: center;\n flex-wrap: wrap;\n }\n .settings_statusSlot:not(:empty) {\n flex-basis: 100%;\n }\n .settings_discard {\n margin-left: auto;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .settings_choice,\n .settings_input,\n .settings_cfg .settings_button {\n transition: none;\n }\n}\n";
|
|
1779
|
+
var id6 = "dsh-better-ask-user/settings.module.css";
|
|
1780
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id6) + "]") === null) {
|
|
1781
|
+
const tag = document.createElement("style");
|
|
1782
|
+
tag.dataset.plugin = "dsh-better-ask-user";
|
|
1783
|
+
tag.dataset.pluginCss = id6;
|
|
1784
|
+
tag.textContent = css6;
|
|
1785
|
+
document.head.appendChild(tag);
|
|
1786
|
+
}
|
|
1787
|
+
var settings_default = {
|
|
1788
|
+
cfg: "settings_cfg",
|
|
1789
|
+
title: "settings_title",
|
|
1790
|
+
note: "settings_note",
|
|
1791
|
+
dependency: "settings_dependency",
|
|
1792
|
+
group: "settings_group",
|
|
1793
|
+
waitSection: "settings_waitSection",
|
|
1794
|
+
timeoutSection: "settings_timeoutSection",
|
|
1795
|
+
sectionTitle: "settings_sectionTitle",
|
|
1796
|
+
choiceGroup: "settings_choiceGroup",
|
|
1797
|
+
rowTitle: "settings_rowTitle",
|
|
1798
|
+
choices: "settings_choices",
|
|
1799
|
+
choice: "settings_choice",
|
|
1800
|
+
choiceInput: "settings_choiceInput",
|
|
1801
|
+
duration: "settings_duration",
|
|
1802
|
+
durationControl: "settings_durationControl",
|
|
1803
|
+
input: "settings_input",
|
|
1804
|
+
unit: "settings_unit",
|
|
1805
|
+
button: "settings_button",
|
|
1806
|
+
discard: "settings_discard",
|
|
1807
|
+
timeoutChoices: "settings_timeoutChoices",
|
|
1808
|
+
footer: "settings_footer",
|
|
1809
|
+
statusSlot: "settings_statusSlot",
|
|
1810
|
+
status: "settings_status",
|
|
1811
|
+
statusOk: "settings_statusOk",
|
|
1812
|
+
statusError: "settings_statusError"
|
|
1813
|
+
};
|
|
1814
|
+
var css_modules_entry_default6 = settings_default;
|
|
1815
|
+
|
|
1536
1816
|
// src/client/settings.tsx
|
|
1537
|
-
var
|
|
1817
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1538
1818
|
var DEFAULTS = { questionTimeoutSeconds: 120, timeoutBehavior: "native", goalTimeoutBehavior: "native" };
|
|
1539
1819
|
var MAX_QUESTION_TIMEOUT_SECONDS = 2147483;
|
|
1540
1820
|
var fallbackT = (key) => settingsEn[key];
|
|
@@ -1568,24 +1848,42 @@ function parseDraft(draft) {
|
|
|
1568
1848
|
if (seconds === void 0) return void 0;
|
|
1569
1849
|
return { questionTimeoutSeconds: seconds, timeoutBehavior: draft.timeoutBehavior, goalTimeoutBehavior: draft.goalTimeoutBehavior };
|
|
1570
1850
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1851
|
+
function ChoiceGroup({ id: id7, label, value, options, disabled, hint, onChange }) {
|
|
1852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("fieldset", { className: css_modules_entry_default6.choiceGroup, id: id7, disabled, "aria-describedby": hint, children: [
|
|
1853
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("legend", { className: css_modules_entry_default6.rowTitle, children: label }),
|
|
1854
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: css_modules_entry_default6.choices, children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: css_modules_entry_default6.choice, children: [
|
|
1855
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1856
|
+
"input",
|
|
1857
|
+
{
|
|
1858
|
+
className: css_modules_entry_default6.choiceInput,
|
|
1859
|
+
id: `${id7}-${option.value}`,
|
|
1860
|
+
type: "radio",
|
|
1861
|
+
name: id7,
|
|
1862
|
+
value: option.value,
|
|
1863
|
+
checked: value === option.value,
|
|
1864
|
+
disabled,
|
|
1865
|
+
"aria-describedby": hint,
|
|
1866
|
+
onChange: () => onChange(option.value)
|
|
1867
|
+
}
|
|
1868
|
+
),
|
|
1869
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: option.label })
|
|
1870
|
+
] }, option.value)) })
|
|
1871
|
+
] });
|
|
1872
|
+
}
|
|
1576
1873
|
function SettingsPage({ form, t = fallbackT }) {
|
|
1577
1874
|
const state = form?.state;
|
|
1578
1875
|
const revision = state?.revision;
|
|
1579
1876
|
const host = state?.status === "ready" ? normalize(state.value) : null;
|
|
1580
1877
|
const base = host === null ? null : toDraft(host);
|
|
1581
|
-
const [draft, setDraft] = (0,
|
|
1582
|
-
const [busy, setBusy] = (0,
|
|
1583
|
-
const [
|
|
1878
|
+
const [draft, setDraft] = (0, import_react5.useState)(null);
|
|
1879
|
+
const [busy, setBusy] = (0, import_react5.useState)(false);
|
|
1880
|
+
const [timedSeconds, setTimedSeconds] = (0, import_react5.useState)(String(DEFAULTS.questionTimeoutSeconds));
|
|
1881
|
+
const [notice, setNotice] = (0, import_react5.useState)(null);
|
|
1584
1882
|
const live = draft !== null && draft.revision === revision ? draft.value : base;
|
|
1585
1883
|
const parsed = live === null ? void 0 : parseDraft(live);
|
|
1586
1884
|
const writable = state?.status === "ready" && state?.writable === true;
|
|
1587
1885
|
const dirty = host !== null && parsed !== void 0 && !same(host, parsed);
|
|
1588
|
-
const edit = (0,
|
|
1886
|
+
const edit = (0, import_react5.useCallback)((mutate) => {
|
|
1589
1887
|
setNotice(null);
|
|
1590
1888
|
if (base === null) return;
|
|
1591
1889
|
setDraft((previous) => {
|
|
@@ -1593,7 +1891,7 @@ function SettingsPage({ form, t = fallbackT }) {
|
|
|
1593
1891
|
return { revision: revision ?? 0, value: mutate(current) };
|
|
1594
1892
|
});
|
|
1595
1893
|
}, [base, revision]);
|
|
1596
|
-
const save = (0,
|
|
1894
|
+
const save = (0, import_react5.useCallback)(async () => {
|
|
1597
1895
|
if (form === void 0 || host === null || parsed === void 0) return;
|
|
1598
1896
|
if (!writable || busy || !dirty) return;
|
|
1599
1897
|
const ops = [];
|
|
@@ -1623,104 +1921,140 @@ function SettingsPage({ form, t = fallbackT }) {
|
|
|
1623
1921
|
}
|
|
1624
1922
|
}, [busy, dirty, form, host, parsed, revision, t, writable]);
|
|
1625
1923
|
if (state === void 0) {
|
|
1626
|
-
return /* @__PURE__ */ (0,
|
|
1924
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: css_modules_entry_default6.cfg, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.note, role: "status", children: t("waiting") }) });
|
|
1627
1925
|
}
|
|
1628
1926
|
if (state.status === "loading") {
|
|
1629
|
-
return /* @__PURE__ */ (0,
|
|
1927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: css_modules_entry_default6.cfg, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.note, role: "status", children: t("loading") }) });
|
|
1630
1928
|
}
|
|
1631
1929
|
if (host === null || live === null) {
|
|
1632
|
-
return /* @__PURE__ */ (0,
|
|
1930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: css_modules_entry_default6.cfg, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.note, role: "alert", children: t("unavailable") }) });
|
|
1633
1931
|
}
|
|
1634
1932
|
const invalid = parsed === void 0;
|
|
1635
|
-
const status = notice !== null ? /* @__PURE__ */ (0,
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
/* @__PURE__ */ (0,
|
|
1641
|
-
|
|
1642
|
-
/* @__PURE__ */ (0,
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1933
|
+
const status = notice !== null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: `${css_modules_entry_default6.status} ${notice.tone === "ok" ? css_modules_entry_default6.statusOk : css_modules_entry_default6.statusError}`, role: notice.tone === "error" ? "alert" : "status", children: notice.text }) : invalid ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: `${css_modules_entry_default6.status} ${css_modules_entry_default6.statusError}`, id: "better-ask-user-error", role: "alert", children: t("invalidWait") }) : dirty ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css_modules_entry_default6.status, role: "status", children: t("dirty") }) : null;
|
|
1934
|
+
const unlimited = live.questionTimeoutSeconds === "-1";
|
|
1935
|
+
const controlsDisabled = !writable || busy;
|
|
1936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.cfg, "aria-busy": busy, children: [
|
|
1937
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { className: css_modules_entry_default6.title, id: "better-ask-user-title", children: t("title") }),
|
|
1938
|
+
writable ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.note, role: "status", children: t("readonly") }),
|
|
1939
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: css_modules_entry_default6.group, "aria-label": t("title"), children: [
|
|
1940
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.waitSection, children: [
|
|
1941
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1942
|
+
ChoiceGroup,
|
|
1943
|
+
{
|
|
1944
|
+
id: "better-ask-user-wait-mode",
|
|
1945
|
+
label: t("waitLabel"),
|
|
1946
|
+
value: unlimited ? "unlimited" : "timed",
|
|
1947
|
+
options: [{ value: "timed", label: t("timed") }, { value: "unlimited", label: t("unlimited") }],
|
|
1948
|
+
disabled: controlsDisabled,
|
|
1949
|
+
hint: "better-ask-user-wait-hint",
|
|
1950
|
+
onChange: (value) => {
|
|
1951
|
+
const nextUnlimited = value === "unlimited";
|
|
1952
|
+
if (nextUnlimited && !invalid) setTimedSeconds(live.questionTimeoutSeconds);
|
|
1953
|
+
edit((current) => ({ ...current, questionTimeoutSeconds: nextUnlimited ? "-1" : timedSeconds }));
|
|
1954
|
+
}
|
|
1656
1955
|
}
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1956
|
+
),
|
|
1957
|
+
unlimited ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.duration, children: [
|
|
1958
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: "better-ask-user-wait", children: t("durationLabel") }),
|
|
1959
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.durationControl, children: [
|
|
1960
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1961
|
+
"input",
|
|
1962
|
+
{
|
|
1963
|
+
id: "better-ask-user-wait",
|
|
1964
|
+
className: css_modules_entry_default6.input,
|
|
1965
|
+
"aria-describedby": invalid ? "better-ask-user-error" : "better-ask-user-wait-hint",
|
|
1966
|
+
type: "number",
|
|
1967
|
+
min: 1,
|
|
1968
|
+
max: MAX_QUESTION_TIMEOUT_SECONDS,
|
|
1969
|
+
step: 1,
|
|
1970
|
+
inputMode: "numeric",
|
|
1971
|
+
"aria-invalid": invalid || void 0,
|
|
1972
|
+
value: live.questionTimeoutSeconds,
|
|
1973
|
+
disabled: controlsDisabled,
|
|
1974
|
+
onChange: (event) => {
|
|
1975
|
+
const next = event.target.value;
|
|
1976
|
+
edit((current) => ({ ...current, questionTimeoutSeconds: next }));
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
),
|
|
1980
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css_modules_entry_default6.unit, children: t("seconds") })
|
|
1981
|
+
] })
|
|
1982
|
+
] }),
|
|
1983
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.dependency, id: "better-ask-user-wait-hint", children: t(unlimited ? "unlimitedHint" : "waitHint") })
|
|
1984
|
+
] }),
|
|
1985
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.timeoutSection, children: [
|
|
1986
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: css_modules_entry_default6.sectionTitle, children: t("timeoutTitle") }),
|
|
1987
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.timeoutChoices, children: [
|
|
1988
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1989
|
+
ChoiceGroup,
|
|
1990
|
+
{
|
|
1991
|
+
id: "better-ask-user-behavior",
|
|
1992
|
+
label: t("behaviorLabel"),
|
|
1993
|
+
value: live.timeoutBehavior,
|
|
1994
|
+
options: [{ value: "native", label: t("native") }, { value: "default", label: t("default") }],
|
|
1995
|
+
disabled: controlsDisabled || unlimited,
|
|
1996
|
+
hint: "better-ask-user-timeout-hint",
|
|
1997
|
+
onChange: (value) => {
|
|
1998
|
+
const next = value === "default" ? "default" : "native";
|
|
1999
|
+
edit((current) => ({ ...current, timeoutBehavior: next }));
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
),
|
|
2003
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2004
|
+
ChoiceGroup,
|
|
2005
|
+
{
|
|
2006
|
+
id: "better-ask-user-goal-behavior",
|
|
2007
|
+
label: t("goalBehaviorLabel"),
|
|
2008
|
+
value: live.goalTimeoutBehavior,
|
|
2009
|
+
options: [{ value: "native", label: t("native") }, { value: "default", label: t("default") }],
|
|
2010
|
+
disabled: controlsDisabled || unlimited,
|
|
2011
|
+
hint: "better-ask-user-timeout-hint",
|
|
2012
|
+
onChange: (value) => {
|
|
2013
|
+
const next = value === "default" ? "default" : "native";
|
|
2014
|
+
edit((current) => ({ ...current, goalTimeoutBehavior: next }));
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
)
|
|
2018
|
+
] }),
|
|
2019
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.dependency, id: "better-ask-user-timeout-hint", children: t(unlimited ? "timeoutDisabled" : live.timeoutBehavior === "default" || live.goalTimeoutBehavior === "default" ? "defaultHint" : "nativeHint") })
|
|
2020
|
+
] })
|
|
1681
2021
|
] }),
|
|
1682
|
-
/* @__PURE__ */ (0,
|
|
1683
|
-
/* @__PURE__ */ (0,
|
|
1684
|
-
/* @__PURE__ */ (0,
|
|
1685
|
-
|
|
2022
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.footer, id: "better-ask-user-settings-footer", children: [
|
|
2023
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: css_modules_entry_default6.statusSlot, children: status }),
|
|
2024
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2025
|
+
import_dsh_client_ui_primitives5.Button,
|
|
1686
2026
|
{
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
disabled:
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
2027
|
+
variant: "outline",
|
|
2028
|
+
className: css_modules_entry_default6.discard,
|
|
2029
|
+
id: "better-ask-user-discard",
|
|
2030
|
+
disabled: controlsDisabled || (draft === null || draft.revision !== revision) && notice === null,
|
|
2031
|
+
onClick: () => {
|
|
2032
|
+
setDraft(null);
|
|
2033
|
+
setNotice(null);
|
|
2034
|
+
setTimedSeconds(String(host.questionTimeoutSeconds === -1 ? DEFAULTS.questionTimeoutSeconds : host.questionTimeoutSeconds));
|
|
1694
2035
|
},
|
|
1695
|
-
children:
|
|
1696
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "native", children: t("native") }),
|
|
1697
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "default", children: t("default") })
|
|
1698
|
-
]
|
|
2036
|
+
children: t("discard")
|
|
1699
2037
|
}
|
|
1700
2038
|
),
|
|
1701
|
-
/* @__PURE__ */ (0,
|
|
1702
|
-
|
|
1703
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [
|
|
1704
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1705
|
-
"button",
|
|
2039
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2040
|
+
import_dsh_client_ui_primitives5.Button,
|
|
1706
2041
|
{
|
|
1707
|
-
|
|
2042
|
+
variant: "primary",
|
|
2043
|
+
className: css_modules_entry_default6.button,
|
|
1708
2044
|
disabled: !writable || busy || !dirty || invalid,
|
|
1709
2045
|
onClick: () => {
|
|
1710
2046
|
void save();
|
|
1711
2047
|
},
|
|
1712
|
-
style: { padding: "7px 16px", borderRadius: 8, border: "1px solid rgba(127,127,127,.35)", background: "rgba(127,127,127,.12)", color: "inherit", font: "inherit", cursor: "pointer" },
|
|
1713
2048
|
children: busy ? t("saving") : t("save")
|
|
1714
2049
|
}
|
|
1715
|
-
)
|
|
1716
|
-
status
|
|
2050
|
+
)
|
|
1717
2051
|
] })
|
|
1718
2052
|
] });
|
|
1719
2053
|
}
|
|
1720
2054
|
function SettingsEntry(props) {
|
|
1721
2055
|
const t = props.t ?? fallbackT;
|
|
1722
|
-
if (props.view === "summary") return /* @__PURE__ */ (0,
|
|
1723
|
-
return /* @__PURE__ */ (0,
|
|
2056
|
+
if (props.view === "summary") return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t("summary") });
|
|
2057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SettingsPage, { form: props.form, t });
|
|
1724
2058
|
}
|
|
1725
2059
|
|
|
1726
2060
|
// src/client/index.ts
|
|
@@ -2017,6 +2351,11 @@ function apply(ctx) {
|
|
|
2017
2351
|
name: "tool.call.toolview",
|
|
2018
2352
|
key: "ask_user_question",
|
|
2019
2353
|
locale: NS,
|
|
2354
|
+
// The shipped `@deepseek-ai/dsh-client-ui-tool` already registers
|
|
2355
|
+
// `ask-question-toolview` for this key at priority 0, and the slot registry
|
|
2356
|
+
// rejects a second entry at the same priority (which failed the whole client
|
|
2357
|
+
// boot). A lower priority shadows it: lowest renders.
|
|
2358
|
+
priority: -1,
|
|
2020
2359
|
inject: (sessionId) => ({
|
|
2021
2360
|
revealPanel: (callId) => ctx.get("userQuestionPanels")?.reveal(sessionId, callId) ?? false,
|
|
2022
2361
|
reviewPanel: (callId, record) => ctx.get("userQuestionPanels")?.review(sessionId, callId, record) ?? false
|