dsh-better-ask-user 0.2.0 → 0.3.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/README.md +23 -4
- package/lib/client.js +336 -258
- package/package.json +12 -12
- package/src/ask-tool.js +7 -1
- package/src/client/AskHistoryRow.module.css +20 -10
- package/src/client/AskHistoryRow.tsx +18 -6
- package/src/client/PlanReviewPanel.module.css +254 -38
- package/src/client/PlanReviewPanel.tsx +9 -3
- package/src/client/QuestionComposer.module.css +504 -77
- package/src/client/QuestionComposer.tsx +51 -27
- package/src/client/QuestionReplyView.module.css +95 -31
- package/src/client/QuestionReplyView.tsx +25 -15
- package/src/client/QuestionWaitBar.module.css +39 -19
- package/src/client/QuestionWaitBar.tsx +0 -2
- package/src/client/contract/slots.ts +19 -4
- package/src/client/index.ts +5 -5
- package/src/client/locales.ts +4 -0
- package/src/client/settings-locales.ts +22 -20
- package/src/client/settings.module.css +108 -108
- package/src/client/settings.tsx +101 -125
- package/src/index.js +2 -14
package/lib/client.js
CHANGED
|
@@ -161,6 +161,7 @@ var PendingQuestion = class _PendingQuestion {
|
|
|
161
161
|
#siblings;
|
|
162
162
|
#listeners = /* @__PURE__ */ new Set();
|
|
163
163
|
#snapshot;
|
|
164
|
+
#requiresDecision;
|
|
164
165
|
#waitMs;
|
|
165
166
|
#timeoutMode = "native";
|
|
166
167
|
#defaultAnswer;
|
|
@@ -174,6 +175,7 @@ var PendingQuestion = class _PendingQuestion {
|
|
|
174
175
|
constructor(sessionId, questions, callId, siblings, review, settings) {
|
|
175
176
|
this.sessionId = sessionId;
|
|
176
177
|
this.questions = questions;
|
|
178
|
+
this.#requiresDecision = questions.some((question) => question.intent?.kind === "plan-review" || question.intent?.kind === "approval");
|
|
177
179
|
this.#waitMs = settings?.waitMs;
|
|
178
180
|
this.#timeoutMode = settings?.timeoutMode ?? "native";
|
|
179
181
|
this.#defaultAnswer = settings?.defaultAnswer;
|
|
@@ -211,6 +213,13 @@ var PendingQuestion = class _PendingQuestion {
|
|
|
211
213
|
this.#listeners.delete(listener);
|
|
212
214
|
};
|
|
213
215
|
};
|
|
216
|
+
/** Apply timing policy when the forwarded request arrives after its projection created the card. */
|
|
217
|
+
configure(settings) {
|
|
218
|
+
this.#waitMs = settings.waitMs;
|
|
219
|
+
this.#timeoutMode = settings.timeoutMode ?? "native";
|
|
220
|
+
this.#defaultAnswer = settings.defaultAnswer;
|
|
221
|
+
this.publish();
|
|
222
|
+
}
|
|
214
223
|
/** Read the stable current card state. */
|
|
215
224
|
snapshot = () => this.#snapshot;
|
|
216
225
|
/** Observable snapshot read by the renderer's keyed Hook. */
|
|
@@ -267,11 +276,12 @@ var PendingQuestion = class _PendingQuestion {
|
|
|
267
276
|
*/
|
|
268
277
|
attachWaterfall(channel) {
|
|
269
278
|
this.#waterfall = channel;
|
|
270
|
-
|
|
279
|
+
const deadline = this.#requiresDecision ? void 0 : channel.deadline;
|
|
280
|
+
this.#timedWait = deadline !== void 0;
|
|
271
281
|
if (!this.#held && !this.#engaged) {
|
|
272
|
-
this.#deadline =
|
|
273
|
-
if (this.#focused &&
|
|
274
|
-
this.#remainingMs = Math.max(0,
|
|
282
|
+
this.#deadline = deadline;
|
|
283
|
+
if (this.#focused && deadline !== void 0) {
|
|
284
|
+
this.#remainingMs = Math.max(0, deadline - Date.now());
|
|
275
285
|
this.#deadline = void 0;
|
|
276
286
|
}
|
|
277
287
|
}
|
|
@@ -380,6 +390,7 @@ var PendingQuestion = class _PendingQuestion {
|
|
|
380
390
|
}
|
|
381
391
|
/** Settle with the host-authored default answer in default timeout mode. */
|
|
382
392
|
autoSelect() {
|
|
393
|
+
if (this.#requiresDecision) return;
|
|
383
394
|
if (this.#held || this.#engaged || this.#focused) return;
|
|
384
395
|
const channel = this.#waterfall;
|
|
385
396
|
if (channel === void 0) return;
|
|
@@ -396,6 +407,7 @@ var PendingQuestion = class _PendingQuestion {
|
|
|
396
407
|
}
|
|
397
408
|
/** Local countdown reached zero: default-select or settle with `ASK_TIMED_OUT`. */
|
|
398
409
|
timeout() {
|
|
410
|
+
if (this.#requiresDecision) return;
|
|
399
411
|
if (this.#held || this.#engaged || this.#focused) return;
|
|
400
412
|
if (this.#timeoutMode === "default" && this.#defaultAnswer !== void 0) {
|
|
401
413
|
this.autoSelect();
|
|
@@ -485,10 +497,11 @@ function createQuestionDraftStore() {
|
|
|
485
497
|
}
|
|
486
498
|
|
|
487
499
|
// src/client/AskHistoryRow.tsx
|
|
500
|
+
var import_react = require("react");
|
|
488
501
|
var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
489
502
|
|
|
490
503
|
// src/client/AskHistoryRow.module.css
|
|
491
|
-
var css = "/* src/client/AskHistoryRow.module.css */\n.
|
|
504
|
+
var css = "/* src/client/AskHistoryRow.module.css */\n.AskHistoryRow_frame {\n --cfg-line: var(--dsw-alias-border-l2);\n --cfg-ink: var(--dsw-alias-label-primary);\n --cfg-muted: var(--dsw-alias-label-secondary);\n --cfg-accent: #3388bb;\n --cfg-accent-text: #14587f;\n --cfg-hover: var(--dsw-alias-interactive-bg-hover);\n min-width: 0;\n}\n.AskHistoryRow_row {\n appearance: none;\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n min-height: 32px;\n min-width: 0;\n padding: 4px 8px;\n border: 0;\n border-radius: 8px;\n background: transparent;\n color: var(--cfg-muted);\n font: inherit;\n line-height: 20px;\n text-align: left;\n}\nbutton.AskHistoryRow_row {\n cursor: pointer;\n transition: background-color 140ms ease, color 140ms ease;\n}\nbutton.AskHistoryRow_row:hover {\n background: var(--cfg-hover);\n color: var(--cfg-ink);\n}\nbutton.AskHistoryRow_row:active {\n background: color-mix(in srgb, var(--cfg-accent) 9%, transparent);\n}\nbutton.AskHistoryRow_row:focus-visible {\n outline: 2px solid var(--cfg-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_summary {\n min-width: 0;\n flex: 1;\n overflow: hidden;\n color: var(--cfg-ink);\n font-size: 13px;\n line-height: 20px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.AskHistoryRow_open {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n flex: none;\n color: var(--cfg-muted);\n font-size: 11px;\n line-height: 18px;\n white-space: nowrap;\n}\n.AskHistoryRow_error {\n display: block;\n padding: 4px 8px 4px 30px;\n color: var(--dsw-alias-state-error-primary);\n font-size: 12px;\n line-height: 18px;\n overflow-wrap: anywhere;\n}\n@media (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[data-ds-dark-theme] .AskHistoryRow_frame {\n --cfg-accent: #4eb0e8;\n --cfg-accent-text: #6fc0ee;\n}\n";
|
|
492
505
|
var id = "dsh-better-ask-user/AskHistoryRow.module.css";
|
|
493
506
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id) + "]") === null) {
|
|
494
507
|
const tag = document.createElement("style");
|
|
@@ -498,11 +511,12 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
498
511
|
document.head.appendChild(tag);
|
|
499
512
|
}
|
|
500
513
|
var AskHistoryRow_default = {
|
|
514
|
+
frame: "AskHistoryRow_frame",
|
|
501
515
|
row: "AskHistoryRow_row",
|
|
502
516
|
icon: "AskHistoryRow_icon",
|
|
503
|
-
title: "AskHistoryRow_title",
|
|
504
517
|
summary: "AskHistoryRow_summary",
|
|
505
|
-
open: "AskHistoryRow_open"
|
|
518
|
+
open: "AskHistoryRow_open",
|
|
519
|
+
error: "AskHistoryRow_error"
|
|
506
520
|
};
|
|
507
521
|
var css_modules_entry_default = AskHistoryRow_default;
|
|
508
522
|
|
|
@@ -576,6 +590,7 @@ function AskHistoryRow({
|
|
|
576
590
|
reviewPanel,
|
|
577
591
|
t
|
|
578
592
|
}) {
|
|
593
|
+
const [failedAction, setFailedAction] = (0, import_react.useState)(null);
|
|
579
594
|
const argsRaw = "kind" in block ? block.call?.argsRaw ?? "" : block.argsRaw;
|
|
580
595
|
const output = "kind" in block ? resultText(block.content) : void 0;
|
|
581
596
|
const questions = questionList(argsRaw);
|
|
@@ -583,25 +598,37 @@ function AskHistoryRow({
|
|
|
583
598
|
const record = questions !== void 0 && answers !== void 0 ? { questions, answers } : void 0;
|
|
584
599
|
const summary = questions?.[0]?.question.split("\n").find((line) => line.trim() !== "")?.trim() ?? t("history.title");
|
|
585
600
|
const review = record !== void 0;
|
|
586
|
-
const action = review ? () =>
|
|
587
|
-
|
|
588
|
-
} : isPending(output) || phase === "start" ? () => {
|
|
589
|
-
revealPanel(callId);
|
|
590
|
-
} : void 0;
|
|
601
|
+
const action = review ? () => reviewPanel(callId, record) : isPending(output) || phase === "start" ? () => revealPanel(callId) : void 0;
|
|
602
|
+
const actionKey = `${callId}-${review ? "review" : "open"}`;
|
|
591
603
|
const content = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
592
604
|
/* @__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
605
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css_modules_entry_default.summary, title: summary, children: summary }),
|
|
595
606
|
action !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: css_modules_entry_default.open, children: [
|
|
596
607
|
review ? t("history.review") : t("history.reopen"),
|
|
597
608
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronRightOutlineRegular, { size: 14 })
|
|
598
609
|
] })
|
|
599
610
|
] });
|
|
600
|
-
return
|
|
611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css_modules_entry_default.frame, role: "group", "aria-label": t("history.title"), children: [
|
|
612
|
+
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)(
|
|
613
|
+
"button",
|
|
614
|
+
{
|
|
615
|
+
type: "button",
|
|
616
|
+
className: css_modules_entry_default.row,
|
|
617
|
+
"data-question-history": callId,
|
|
618
|
+
"data-history-action": review ? "review" : "open",
|
|
619
|
+
onClick: () => {
|
|
620
|
+
setFailedAction(action() ? null : actionKey);
|
|
621
|
+
},
|
|
622
|
+
"aria-label": `${review ? t("history.review") : t("history.reopen")} \xB7 ${summary}`,
|
|
623
|
+
children: content
|
|
624
|
+
}
|
|
625
|
+
),
|
|
626
|
+
failedAction === actionKey && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css_modules_entry_default.error, role: "alert", children: t("history.unavailable") })
|
|
627
|
+
] });
|
|
601
628
|
}
|
|
602
629
|
|
|
603
630
|
// src/client/QuestionComposer.tsx
|
|
604
|
-
var
|
|
631
|
+
var import_react4 = require("react");
|
|
605
632
|
|
|
606
633
|
// node_modules/clsx/dist/clsx.mjs
|
|
607
634
|
function r(e) {
|
|
@@ -623,14 +650,14 @@ var clsx_default = clsx;
|
|
|
623
650
|
var import_dsh_client_ui_primitives3 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
624
651
|
|
|
625
652
|
// src/client/PlanReviewPanel.tsx
|
|
626
|
-
var
|
|
653
|
+
var import_react3 = require("react");
|
|
627
654
|
var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
628
655
|
|
|
629
656
|
// src/client/QuestionWaitBar.tsx
|
|
630
|
-
var
|
|
657
|
+
var import_react2 = require("react");
|
|
631
658
|
|
|
632
659
|
// src/client/QuestionWaitBar.module.css
|
|
633
|
-
var css2 = "/* src/client/QuestionWaitBar.module.css */\n.QuestionWaitBar_bar {\n --
|
|
660
|
+
var css2 = "/* src/client/QuestionWaitBar.module.css */\n.QuestionWaitBar_bar {\n --ui-accent: #3388bb;\n --ui-accent-text: #14587f;\n --ui-ink-1: var(--dsw-alias-label-primary, #0f1115);\n --ui-ink-2: var(--dsw-alias-label-secondary, #61666b);\n --ui-ink-3: var(--dsw-alias-label-tertiary, #81858c);\n --ui-line-1: var(--dsw-alias-border-l1, #0000000a);\n --ui-line-2: var(--dsw-alias-border-l2, #0000001a);\n --ui-raised: var(--dsw-alias-bg-layer-2, #fff);\n --ui-hover: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, var(--ui-ink-1) 5%, transparent));\n display: flex;\n align-items: center;\n flex-shrink: 0;\n gap: 8px;\n min-width: 0;\n min-height: 36px;\n margin: 0 16px 10px;\n padding: 4px 6px 4px 10px;\n border: 1px solid var(--ui-line-2);\n border-radius: 8px;\n background: var(--ui-raised);\n color: var(--ui-ink-1);\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(--ui-line-2);\n}\n.QuestionWaitBar_remaining {\n stroke: var(--ui-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(--ui-ink-2);\n border-bottom: 1.5px solid var(--ui-ink-2);\n}\n.QuestionWaitBar_pause {\n width: 16px;\n height: 16px;\n color: var(--ui-ink-2);\n}\n.QuestionWaitBar_status {\n display: flex;\n align-items: center;\n min-width: 0;\n}\n.QuestionWaitBar_time {\n color: var(--ui-ink-1);\n font-size: 12px;\n line-height: 20px;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n}\n.QuestionWaitBar_bar[data-wait-state=counting] .QuestionWaitBar_time {\n font-weight: 500;\n}\n.QuestionWaitBar_takeTime {\n appearance: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n margin-left: auto;\n min-height: 28px;\n padding: 0 10px;\n border: 0;\n border-radius: 6px;\n background: transparent;\n color: var(--ui-ink-3);\n font: inherit;\n font-size: 12px;\n line-height: 18px;\n font-weight: 500;\n cursor: pointer;\n transition: background-color 140ms ease, color 140ms ease;\n}\n.QuestionWaitBar_takeTime:hover:not(:disabled) {\n background: var(--ui-hover);\n color: var(--ui-ink-1);\n}\n.QuestionWaitBar_takeTime:focus-visible {\n outline: 2px solid var(--ui-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 margin: 0 12px 8px;\n padding: 4px 6px 4px 8px;\n }\n}\n@media (pointer: coarse) {\n .QuestionWaitBar_takeTime {\n min-height: 44px;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .QuestionWaitBar_takeTime {\n transition: none;\n }\n}\n[data-ds-dark-theme] .QuestionWaitBar_bar {\n --ui-accent: #4eb0e8;\n --ui-accent-text: #6fc0ee;\n}\n";
|
|
634
661
|
var id2 = "dsh-better-ask-user/QuestionWaitBar.module.css";
|
|
635
662
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id2) + "]") === null) {
|
|
636
663
|
const tag = document.createElement("style");
|
|
@@ -649,7 +676,6 @@ var QuestionWaitBar_default = {
|
|
|
649
676
|
pause: "QuestionWaitBar_pause",
|
|
650
677
|
status: "QuestionWaitBar_status",
|
|
651
678
|
time: "QuestionWaitBar_time",
|
|
652
|
-
policy: "QuestionWaitBar_policy",
|
|
653
679
|
takeTime: "QuestionWaitBar_takeTime"
|
|
654
680
|
};
|
|
655
681
|
var css_modules_entry_default2 = QuestionWaitBar_default;
|
|
@@ -658,7 +684,7 @@ var css_modules_entry_default2 = QuestionWaitBar_default;
|
|
|
658
684
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
659
685
|
function QuestionWaitBar({ card, t, busy, onTakeTime }) {
|
|
660
686
|
const countdown = card?.countdown;
|
|
661
|
-
const initialWindow = (0,
|
|
687
|
+
const initialWindow = (0, import_react2.useRef)(countdown?.remainingMs);
|
|
662
688
|
if (card === void 0 || countdown === void 0 && card.state !== "continued") return null;
|
|
663
689
|
const continued = card.state === "continued";
|
|
664
690
|
const held = card.waitState === "waiting" || card.waitState === "editing";
|
|
@@ -675,17 +701,13 @@ function QuestionWaitBar({ card, t, busy, onTakeTime }) {
|
|
|
675
701
|
] }),
|
|
676
702
|
!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
703
|
] }),
|
|
678
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
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
|
-
] }),
|
|
704
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: css_modules_entry_default2.status, role: held || continued ? "status" : void 0, "aria-atomic": "true", children: /* @__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")}` }) }),
|
|
683
705
|
!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
706
|
] });
|
|
685
707
|
}
|
|
686
708
|
|
|
687
709
|
// src/client/PlanReviewPanel.module.css
|
|
688
|
-
var css3 = "/* src/client/PlanReviewPanel.module.css */\n.PlanReviewPanel_frame {\n --
|
|
710
|
+
var css3 = "/* src/client/PlanReviewPanel.module.css */\n.PlanReviewPanel_frame {\n --cfg-line: var(--dsw-alias-border-l2);\n --cfg-line-strong: var(--dsw-alias-border-l3);\n --cfg-surface: var(--dsw-alias-bg-layer-2);\n --cfg-sunken: color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-alias-bg-layer-1));\n --cfg-ink: var(--dsw-alias-label-primary);\n --cfg-muted: var(--dsw-alias-label-secondary);\n --cfg-accent: #3388bb;\n --cfg-accent-text: #14587f;\n --cfg-hover: var(--dsw-alias-interactive-bg-hover);\n --cfg-danger: var(--dsw-alias-state-error-primary);\n --cfg-solid: #20709e;\n --cfg-solid-hover: #1c638d;\n --cfg-on-solid: #fff;\n display: flex;\n justify-content: center;\n padding: 6px calc(var(--dsh-composer-side-clearance) + 16px) calc(10px + 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: 1px solid var(--cfg-line);\n border-top-color: var(--cfg-accent);\n border-radius: 12px;\n background: var(--cfg-surface);\n color: var(--cfg-ink);\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: 8px;\n min-width: 0;\n padding: 8px 12px 8px 16px;\n border-bottom: 1px solid var(--cfg-line);\n}\n.PlanReviewPanel_panelLabel {\n display: inline-flex;\n align-items: center;\n height: 20px;\n padding: 0 7px;\n border: 1px solid var(--cfg-line);\n border-radius: 999px;\n background: var(--cfg-sunken);\n color: var(--cfg-muted);\n font-size: 11px;\n line-height: 18px;\n font-weight: 500;\n white-space: nowrap;\n}\n.PlanReviewPanel_previewActions {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 4px;\n min-width: 0;\n margin-left: auto;\n}\n.PlanReviewPanel_summary {\n min-width: 0;\n min-height: 0;\n overflow-y: auto;\n overscroll-behavior: contain;\n scrollbar-gutter: stable;\n padding: 12px 16px;\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: 2;\n overflow: hidden;\n margin: 4px 0 0;\n color: var(--cfg-muted);\n font-size: 12px;\n line-height: 18px;\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: 8px 12px;\n padding: 8px 12px;\n border-top: 1px solid var(--cfg-line);\n}\n.PlanReviewPanel_feedback {\n flex: 1;\n min-width: 0;\n display: flex;\n align-items: center;\n gap: 6px;\n color: var(--cfg-muted);\n font-size: 12px;\n line-height: 18px;\n overflow-wrap: anywhere;\n}\n.PlanReviewPanel_feedback[data-error] {\n color: var(--cfg-danger);\n}\n.PlanReviewPanel_discuss,\n.PlanReviewPanel_primary,\n.PlanReviewPanel_decline {\n appearance: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: 32px;\n padding: 0 12px;\n border: 1px solid var(--cfg-line);\n border-radius: 8px;\n background: var(--cfg-surface);\n color: var(--cfg-ink);\n box-shadow: none;\n font: inherit;\n font-size: 13px;\n font-weight: 500;\n cursor: pointer;\n transition:\n background-color 140ms ease,\n border-color 140ms ease,\n color 140ms ease;\n}\n.PlanReviewPanel_discuss:hover:not(:disabled) {\n background: var(--cfg-hover);\n}\n.PlanReviewPanel_primary {\n border-color: transparent;\n background: var(--cfg-solid);\n color: var(--cfg-on-solid);\n}\n.PlanReviewPanel_primary:hover:not(:disabled) {\n background: var(--cfg-solid-hover);\n}\n.PlanReviewPanel_spinner {\n flex: none;\n width: 12px;\n height: 12px;\n border: 1px solid currentColor;\n border-right-color: transparent;\n border-radius: 50%;\n animation: PlanReviewPanel_spin 800ms linear infinite;\n}\n@keyframes PlanReviewPanel_spin {\n to {\n transform: rotate(360deg);\n }\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_decline {\n min-height: 32px;\n padding: 0 12px;\n border: 0;\n border-radius: 8px;\n background: transparent;\n color: var(--cfg-muted);\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n cursor: pointer;\n}\n.PlanReviewPanel_decline:hover:not(:disabled),\n.PlanReviewPanel_decline:active:not(:disabled) {\n background: var(--cfg-hover);\n color: var(--cfg-ink);\n}\n.PlanReviewPanel_discuss {\n gap: 6px;\n}\n.PlanReviewPanel_card button:focus-visible {\n outline: 2px solid var(--cfg-accent);\n outline-offset: -2px;\n}\n.PlanReviewPanel_card button:disabled {\n opacity: 0.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: 8px 12px;\n }\n .PlanReviewPanel_summary {\n padding: 12px;\n }\n .PlanReviewPanel_footer {\n padding: 8px;\n }\n .PlanReviewPanel_feedback {\n flex: 1 1 100%;\n }\n}\n@media (max-width: 420px) {\n .PlanReviewPanel_actions {\n display: grid;\n grid-template-columns: 1fr 1fr;\n width: 100%;\n gap: 8px;\n }\n .PlanReviewPanel_decline {\n grid-column: 1 / -1;\n justify-content: flex-start;\n }\n .PlanReviewPanel_actions > button {\n flex: none;\n width: 100%;\n }\n .PlanReviewPanel_discuss,\n .PlanReviewPanel_primary,\n .PlanReviewPanel_decline {\n white-space: nowrap;\n }\n}\n@media (pointer: coarse) {\n .PlanReviewPanel_card button {\n min-height: 44px;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .PlanReviewPanel_spinner {\n animation: none;\n }\n}\n[data-ds-dark-theme] .PlanReviewPanel_frame {\n --cfg-accent: #4eb0e8;\n --cfg-accent-text: #6fc0ee;\n --cfg-solid: #4eb0e8;\n --cfg-solid-hover: #6fc0ee;\n --cfg-on-solid: #0e1014;\n}\n";
|
|
689
711
|
var id3 = "dsh-better-ask-user/PlanReviewPanel.module.css";
|
|
690
712
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id3) + "]") === null) {
|
|
691
713
|
const tag = document.createElement("style");
|
|
@@ -707,10 +729,12 @@ var PlanReviewPanel_default = {
|
|
|
707
729
|
description: "PlanReviewPanel_description",
|
|
708
730
|
footer: "PlanReviewPanel_footer",
|
|
709
731
|
feedback: "PlanReviewPanel_feedback",
|
|
710
|
-
actions: "PlanReviewPanel_actions",
|
|
711
|
-
decline: "PlanReviewPanel_decline",
|
|
712
732
|
discuss: "PlanReviewPanel_discuss",
|
|
713
|
-
|
|
733
|
+
primary: "PlanReviewPanel_primary",
|
|
734
|
+
decline: "PlanReviewPanel_decline",
|
|
735
|
+
spinner: "PlanReviewPanel_spinner",
|
|
736
|
+
spin: "PlanReviewPanel_spin",
|
|
737
|
+
actions: "PlanReviewPanel_actions",
|
|
714
738
|
srOnly: "PlanReviewPanel_srOnly"
|
|
715
739
|
};
|
|
716
740
|
var css_modules_entry_default3 = PlanReviewPanel_default;
|
|
@@ -721,19 +745,19 @@ function tooltip(description) {
|
|
|
721
745
|
return description === void 0 ? {} : { title: description };
|
|
722
746
|
}
|
|
723
747
|
function PlanReviewPanel({ pending, review, t, renderSlot, useQuestionCard }) {
|
|
724
|
-
const [busy, setBusy] = (0,
|
|
725
|
-
const [error, setError] = (0,
|
|
748
|
+
const [busy, setBusy] = (0, import_react3.useState)(false);
|
|
749
|
+
const [error, setError] = (0, import_react3.useState)(null);
|
|
726
750
|
const card = useQuestionCard(pending.key, (snapshot) => snapshot);
|
|
727
751
|
const canDecide = card !== void 0 && !card.closed && card.channel !== "none";
|
|
728
|
-
const surface = (0,
|
|
729
|
-
const sentVia = (0,
|
|
730
|
-
(0,
|
|
752
|
+
const surface = (0, import_react3.useRef)(null);
|
|
753
|
+
const sentVia = (0, import_react3.useRef)(null);
|
|
754
|
+
(0, import_react3.useEffect)(() => {
|
|
731
755
|
if (sentVia.current !== "waterfall" || card?.state !== "continued") return;
|
|
732
756
|
sentVia.current = null;
|
|
733
757
|
setBusy(false);
|
|
734
758
|
setError(t("error.resubmit"));
|
|
735
759
|
}, [card?.state, t]);
|
|
736
|
-
(0,
|
|
760
|
+
(0, import_react3.useEffect)(() => {
|
|
737
761
|
const release = () => {
|
|
738
762
|
pending.releaseFocus();
|
|
739
763
|
};
|
|
@@ -774,7 +798,7 @@ function PlanReviewPanel({ pending, review, t, renderSlot, useQuestionCard }) {
|
|
|
774
798
|
settle(() => pending.answer({ answers: [{ id: review.id, selected: [label] }] }), pending.snapshot().channel === "rpc");
|
|
775
799
|
};
|
|
776
800
|
const decline = review.decline;
|
|
777
|
-
const summary = (0,
|
|
801
|
+
const summary = (0, import_react3.useMemo)(() => {
|
|
778
802
|
const title = (0, import_dsh_client_ui_primitives2.extractMarkdownPlainText)(review.plan, { mode: "first-line" });
|
|
779
803
|
const description = (0, import_dsh_client_ui_primitives2.extractMarkdownPlainText)(review.plan, { mode: "first-paragraph" });
|
|
780
804
|
return { title, description: description === title ? "" : description };
|
|
@@ -808,7 +832,10 @@ function PlanReviewPanel({ pending, review, t, renderSlot, useQuestionCard }) {
|
|
|
808
832
|
summary.description !== "" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css_modules_entry_default3.description, children: summary.description })
|
|
809
833
|
] }),
|
|
810
834
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css_modules_entry_default3.footer, "data-plan-decision": true, children: [
|
|
811
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.
|
|
835
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css_modules_entry_default3.feedback, role: error === null ? "status" : "alert", "aria-atomic": "true", "data-error": error !== null || void 0, children: [
|
|
836
|
+
busy && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css_modules_entry_default3.spinner, "aria-hidden": "true" }),
|
|
837
|
+
error ?? (busy ? t("submitting") : null)
|
|
838
|
+
] }),
|
|
812
839
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css_modules_entry_default3.actions, children: [
|
|
813
840
|
decline !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
814
841
|
"button",
|
|
@@ -841,7 +868,7 @@ function PlanReviewPanel({ pending, review, t, renderSlot, useQuestionCard }) {
|
|
|
841
868
|
import_dsh_client_ui_primitives2.Button,
|
|
842
869
|
{
|
|
843
870
|
variant: "primary",
|
|
844
|
-
className: css_modules_entry_default3.
|
|
871
|
+
className: css_modules_entry_default3.primary,
|
|
845
872
|
...tooltip(review.approve.description),
|
|
846
873
|
"aria-describedby": review.approve.description === void 0 ? void 0 : `plan-approve-${pending.key}`,
|
|
847
874
|
disabled: busy || !canDecide,
|
|
@@ -861,7 +888,7 @@ function PlanReviewPanel({ pending, review, t, renderSlot, useQuestionCard }) {
|
|
|
861
888
|
}
|
|
862
889
|
|
|
863
890
|
// src/client/QuestionComposer.module.css
|
|
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';
|
|
891
|
+
var css4 = '/* src/client/QuestionComposer.module.css */\n.QuestionComposer_frame {\n --cfg-line: var(--dsw-alias-border-l2);\n --cfg-line-strong: var(--dsw-alias-border-l3);\n --cfg-surface: var(--dsw-alias-bg-layer-2);\n --cfg-sunken: color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-alias-bg-layer-1));\n --cfg-ink: var(--dsw-alias-label-primary);\n --cfg-muted: var(--dsw-alias-label-secondary);\n --cfg-accent: #3388bb;\n --cfg-accent-text: #14587f;\n --cfg-hover: var(--dsw-alias-interactive-bg-hover);\n --cfg-danger: var(--dsw-alias-state-error-primary);\n --cfg-solid: #20709e;\n --cfg-solid-hover: #1c638d;\n --cfg-on-solid: #fff;\n display: flex;\n justify-content: center;\n padding: 6px calc(var(--dsh-composer-side-clearance) + 16px) calc(10px + 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: 1px solid var(--cfg-line);\n border-top-color: var(--cfg-accent);\n border-radius: 12px;\n background: var(--cfg-surface);\n color: var(--cfg-ink);\n font-size: inherit;\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: 12px 12px 8px 16px;\n}\n.QuestionComposer_headingBlock {\n flex: 1;\n min-width: 0;\n}\n.QuestionComposer_titleRow {\n display: flex;\n align-items: flex-start;\n flex-wrap: wrap;\n gap: 6px;\n min-width: 0;\n}\n.QuestionComposer_title {\n flex: 1 1 auto;\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_headerChip,\n.QuestionComposer_statusChip {\n display: inline-flex;\n align-items: center;\n flex: none;\n height: 20px;\n max-width: 200px;\n padding: 0 7px;\n overflow: hidden;\n border: 1px solid var(--cfg-line);\n border-radius: 999px;\n background: var(--cfg-sunken);\n color: var(--cfg-muted);\n font-size: 11px;\n line-height: 18px;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.QuestionComposer_statusChip {\n border-color: color-mix(in srgb, var(--cfg-accent) 30%, var(--cfg-line));\n background: color-mix(in srgb, var(--cfg-accent) 10%, transparent);\n color: var(--cfg-accent-text);\n font-weight: 500;\n}\n.QuestionComposer_title,\n.QuestionComposer_headerChip,\n.QuestionComposer_statusChip,\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_headerChip > div,\n.QuestionComposer_statusChip > div,\n.QuestionComposer_optionLabel > div,\n.QuestionComposer_description > div {\n margin: 0;\n}\n.QuestionComposer_title > [data-markdown-variant=compact],\n.QuestionComposer_headerChip > [data-markdown-variant=compact],\n.QuestionComposer_optionLabel > [data-markdown-variant=compact],\n.QuestionComposer_title > [data-markdown-variant=compact] > p,\n.QuestionComposer_headerChip > [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: 28px;\n height: 28px;\n padding: 0;\n border: 0;\n border-radius: 6px;\n background: transparent;\n color: var(--cfg-muted);\n cursor: pointer;\n}\n.QuestionComposer_iconButton:hover:not(:disabled) {\n background: var(--cfg-hover);\n color: var(--cfg-ink);\n}\n.QuestionComposer_card button:focus-visible {\n outline: 2px solid var(--cfg-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 opacity: 0.4;\n}\n.QuestionComposer_iconButton:active:not(:disabled),\n.QuestionComposer_option:active:not(:disabled) {\n background: var(--cfg-hover);\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 8px;\n color: var(--cfg-muted);\n}\n.QuestionComposer_options {\n display: flex;\n flex-direction: column;\n gap: 2px;\n padding: 0 8px 8px;\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: 7px 8px;\n border: 1px solid transparent;\n border-radius: 8px;\n transition: background-color 140ms ease, border-color 140ms 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(--cfg-hover);\n}\n.QuestionComposer_optionSelected,\n.QuestionComposer_optionSelected:hover:not(:disabled),\n.QuestionComposer_customRowActive {\n border-color: var(--cfg-accent);\n background: color-mix(in srgb, var(--cfg-accent) 8%, transparent);\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(--cfg-muted);\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}\n.QuestionComposer_radioChecked::before {\n border: 5px solid var(--cfg-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: var(--cfg-accent);\n}\n.QuestionComposer_checkboxChecked::before {\n border-color: currentColor;\n background: color-mix(in srgb, var(--cfg-accent) 10%, transparent);\n}\n.QuestionComposer_optionCopy {\n display: grid;\n gap: 2px;\n min-width: 0;\n flex: 1;\n}\n.QuestionComposer_optionLine {\n display: flex;\n align-items: baseline;\n flex-wrap: wrap;\n gap: 2px 6px;\n}\n.QuestionComposer_optionLabel {\n display: block;\n font-size: inherit;\n font-weight: 500;\n line-height: 20px;\n}\n.QuestionComposer_badge {\n display: inline-flex;\n align-items: center;\n height: 20px;\n padding: 0 6px;\n border: 1px solid color-mix(in srgb, var(--cfg-accent) 30%, var(--cfg-line));\n border-radius: 999px;\n background: color-mix(in srgb, var(--cfg-accent) 10%, transparent);\n color: var(--cfg-accent-text);\n font-size: 11px;\n font-weight: 500;\n line-height: 18px;\n}\n.QuestionComposer_description {\n display: block;\n color: var(--cfg-muted);\n font-size: 12px;\n line-height: 18px;\n font-weight: 400;\n}\n.QuestionComposer_reviewNote {\n margin: 0;\n padding: 6px 8px;\n color: var(--cfg-muted);\n font-size: 12px;\n line-height: 20px;\n}\n.QuestionComposer_customRow {\n margin-top: 8px;\n border-color: var(--cfg-line);\n background: var(--cfg-surface);\n}\n.QuestionComposer_customRow:has(.QuestionComposer_fieldInput:focus-visible),\n.QuestionComposer_customBlock:has(.QuestionComposer_fieldInput:focus-visible) {\n outline: 2px solid var(--cfg-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: inherit;\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(--cfg-ink);\n caret-color: var(--cfg-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: 60px;\n flex-shrink: 0;\n margin: 0 8px;\n border: 1px solid var(--cfg-line);\n border-radius: 8px;\n background: var(--cfg-surface);\n --dsh-answer-field-padding: 8px 12px;\n}\n.QuestionComposer_footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-shrink: 0;\n gap: 8px;\n padding: 8px 12px;\n border-top: 1px solid var(--cfg-line);\n}\n.QuestionComposer_progress {\n padding: 0 4px;\n color: var(--cfg-muted);\n font-size: 11px;\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(--cfg-muted);\n font-size: 12px;\n line-height: 18px;\n overflow-wrap: anywhere;\n text-align: right;\n}\n.QuestionComposer_feedback[data-error] {\n color: var(--cfg-danger);\n}\n.QuestionComposer_button,\n.QuestionComposer_primary {\n appearance: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n height: 32px;\n padding: 0 12px;\n border: 1px solid var(--cfg-line);\n border-radius: 8px;\n box-shadow: none;\n background: var(--cfg-surface);\n color: var(--cfg-ink);\n font: inherit;\n font-size: 13px;\n font-weight: 500;\n cursor: pointer;\n transition:\n background-color 140ms ease,\n border-color 140ms ease,\n color 140ms ease;\n}\n.QuestionComposer_button:hover:not(:disabled) {\n background: var(--cfg-hover);\n}\n.QuestionComposer_primary {\n min-width: 128px;\n border-color: transparent;\n background: var(--cfg-solid);\n color: var(--cfg-on-solid);\n}\n.QuestionComposer_primary:hover:not(:disabled) {\n background: var(--cfg-solid-hover);\n}\n.QuestionComposer_button:active:not(:disabled),\n.QuestionComposer_primary:active:not(:disabled) {\n background: color-mix(in srgb, var(--cfg-accent) 12%, var(--cfg-surface));\n}\n.QuestionComposer_iconButton,\n.QuestionComposer_option {\n appearance: none;\n box-shadow: none;\n}\n.QuestionComposer_spinner {\n width: 12px;\n height: 12px;\n border: 1px solid currentColor;\n border-right-color: transparent;\n border-radius: 50%;\n animation: QuestionComposer_spin 800ms linear infinite;\n}\n@keyframes QuestionComposer_spin {\n to {\n transform: rotate(360deg);\n }\n}\n.QuestionComposer_feedback:empty {\n display: none;\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: 10px 8px 8px 12px;\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: 8px;\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 (pointer: coarse) {\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}\n@media (prefers-reduced-motion: reduce) {\n .QuestionComposer_spinner {\n animation: none;\n }\n .QuestionComposer_option,\n .QuestionComposer_customRow {\n transition: none;\n }\n}\n[data-ds-dark-theme] .QuestionComposer_frame {\n --cfg-accent: #4eb0e8;\n --cfg-accent-text: #6fc0ee;\n --cfg-solid: #4eb0e8;\n --cfg-solid-hover: #6fc0ee;\n --cfg-on-solid: #0e1014;\n}\n';
|
|
865
892
|
var id4 = "dsh-better-ask-user/QuestionComposer.module.css";
|
|
866
893
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id4) + "]") === null) {
|
|
867
894
|
const tag = document.createElement("style");
|
|
@@ -876,8 +903,10 @@ var QuestionComposer_default = {
|
|
|
876
903
|
cardMinimized: "QuestionComposer_cardMinimized",
|
|
877
904
|
header: "QuestionComposer_header",
|
|
878
905
|
headingBlock: "QuestionComposer_headingBlock",
|
|
879
|
-
|
|
906
|
+
titleRow: "QuestionComposer_titleRow",
|
|
880
907
|
title: "QuestionComposer_title",
|
|
908
|
+
headerChip: "QuestionComposer_headerChip",
|
|
909
|
+
statusChip: "QuestionComposer_statusChip",
|
|
881
910
|
optionLabel: "QuestionComposer_optionLabel",
|
|
882
911
|
description: "QuestionComposer_description",
|
|
883
912
|
detail: "QuestionComposer_detail",
|
|
@@ -886,30 +915,32 @@ var QuestionComposer_default = {
|
|
|
886
915
|
pager: "QuestionComposer_pager",
|
|
887
916
|
iconButton: "QuestionComposer_iconButton",
|
|
888
917
|
option: "QuestionComposer_option",
|
|
889
|
-
fieldInput: "QuestionComposer_fieldInput",
|
|
890
918
|
body: "QuestionComposer_body",
|
|
891
919
|
options: "QuestionComposer_options",
|
|
892
920
|
customRow: "QuestionComposer_customRow",
|
|
893
921
|
optionSelected: "QuestionComposer_optionSelected",
|
|
894
922
|
customRowActive: "QuestionComposer_customRowActive",
|
|
895
|
-
optionCopy: "QuestionComposer_optionCopy",
|
|
896
|
-
optionLine: "QuestionComposer_optionLine",
|
|
897
|
-
badge: "QuestionComposer_badge",
|
|
898
923
|
radio: "QuestionComposer_radio",
|
|
899
924
|
checkbox: "QuestionComposer_checkbox",
|
|
900
925
|
customIcon: "QuestionComposer_customIcon",
|
|
901
926
|
radioChecked: "QuestionComposer_radioChecked",
|
|
902
927
|
checkboxChecked: "QuestionComposer_checkboxChecked",
|
|
928
|
+
optionCopy: "QuestionComposer_optionCopy",
|
|
929
|
+
optionLine: "QuestionComposer_optionLine",
|
|
930
|
+
badge: "QuestionComposer_badge",
|
|
931
|
+
reviewNote: "QuestionComposer_reviewNote",
|
|
932
|
+
fieldInput: "QuestionComposer_fieldInput",
|
|
903
933
|
customBlock: "QuestionComposer_customBlock",
|
|
904
934
|
field: "QuestionComposer_field",
|
|
905
935
|
fieldMirror: "QuestionComposer_fieldMirror",
|
|
906
936
|
customInline: "QuestionComposer_customInline",
|
|
907
937
|
footer: "QuestionComposer_footer",
|
|
908
|
-
primaryButton: "QuestionComposer_primaryButton",
|
|
909
938
|
progress: "QuestionComposer_progress",
|
|
910
939
|
feedback: "QuestionComposer_feedback",
|
|
911
|
-
|
|
912
|
-
|
|
940
|
+
button: "QuestionComposer_button",
|
|
941
|
+
primary: "QuestionComposer_primary",
|
|
942
|
+
spinner: "QuestionComposer_spinner",
|
|
943
|
+
spin: "QuestionComposer_spin"
|
|
913
944
|
};
|
|
914
945
|
var css_modules_entry_default4 = QuestionComposer_default;
|
|
915
946
|
|
|
@@ -927,6 +958,7 @@ function parseRecommendedLabel(label) {
|
|
|
927
958
|
return suffix.test(label) ? { label: label.replace(suffix, ""), recommended: true } : { label, recommended: false };
|
|
928
959
|
}
|
|
929
960
|
function recommendedFirstOption(question) {
|
|
961
|
+
if (question.intent?.kind === "approval" || question.intent?.kind === "plan-review") return void 0;
|
|
930
962
|
const label = question.options?.[0]?.label;
|
|
931
963
|
return label !== void 0 && parseRecommendedLabel(label).recommended ? label : void 0;
|
|
932
964
|
}
|
|
@@ -966,7 +998,7 @@ function AnswerField(props) {
|
|
|
966
998
|
}
|
|
967
999
|
function QuestionComposer(props) {
|
|
968
1000
|
const question = props.matched;
|
|
969
|
-
const review = (0,
|
|
1001
|
+
const review = (0, import_react4.useMemo)(() => planReviewOf(question.questions), [question]);
|
|
970
1002
|
return review === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
971
1003
|
QuestionFlow,
|
|
972
1004
|
{
|
|
@@ -982,11 +1014,11 @@ function QuestionComposer(props) {
|
|
|
982
1014
|
function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
983
1015
|
const questions = pending.questions;
|
|
984
1016
|
const review = pending.review;
|
|
985
|
-
const markdownLabels = (0,
|
|
1017
|
+
const markdownLabels = (0, import_react4.useMemo)(() => ({
|
|
986
1018
|
code: { copyLabel: t("copy"), copiedLabel: t("copied"), toolbarLabels: { codeLabel: t("codeBlock.title"), wrapLabel: t("codeBlock.wrap"), unwrapLabel: t("codeBlock.unwrap") } },
|
|
987
1019
|
footnotes: t("markdown.footnotes")
|
|
988
1020
|
}), [t]);
|
|
989
|
-
const initialDrafts = (0,
|
|
1021
|
+
const initialDrafts = (0, import_react4.useMemo)(() => {
|
|
990
1022
|
const recorded = new Map((review ?? []).map((answer) => [answer.id, answer]));
|
|
991
1023
|
return questions.map((item) => {
|
|
992
1024
|
const answer = recorded.get(item.id);
|
|
@@ -1006,36 +1038,37 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1006
1038
|
const index = validStored?.index ?? 0;
|
|
1007
1039
|
const drafts = storedProgress?.drafts ?? initialDrafts;
|
|
1008
1040
|
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);
|
|
1009
|
-
const [busy, setBusy] = (0,
|
|
1010
|
-
const [error, setError] = (0,
|
|
1041
|
+
const [busy, setBusy] = (0, import_react4.useState)(null);
|
|
1042
|
+
const [error, setError] = (0, import_react4.useState)(null);
|
|
1011
1043
|
const card = useQuestionCard(pending.key, (snapshot) => snapshot ?? REMOVED_CARD);
|
|
1012
|
-
const canSubmit = card.channel !== "none";
|
|
1044
|
+
const canSubmit = !card.closed && card.channel !== "none";
|
|
1013
1045
|
const locked = busy !== null || review !== void 0;
|
|
1014
|
-
const sentVia = (0,
|
|
1015
|
-
(0,
|
|
1046
|
+
const sentVia = (0, import_react4.useRef)(null);
|
|
1047
|
+
(0, import_react4.useEffect)(() => {
|
|
1016
1048
|
if (sentVia.current !== "waterfall" || card.state !== "continued") return;
|
|
1017
1049
|
sentVia.current = null;
|
|
1018
1050
|
setBusy(null);
|
|
1019
1051
|
setError({ key: "error.resubmit" });
|
|
1020
1052
|
}, [card.state]);
|
|
1021
|
-
(0,
|
|
1053
|
+
(0, import_react4.useEffect)(() => {
|
|
1022
1054
|
if (card.closed) actions.clear(pending.key);
|
|
1023
1055
|
}, [actions, card.closed, pending.key]);
|
|
1024
|
-
(0,
|
|
1056
|
+
(0, import_react4.useEffect)(() => {
|
|
1025
1057
|
actions.prune(pending.liveKeys());
|
|
1026
1058
|
}, [actions, pending]);
|
|
1027
|
-
const waitDisposition = (0,
|
|
1028
|
-
(0,
|
|
1059
|
+
const waitDisposition = (0, import_react4.useRef)(restoredWait);
|
|
1060
|
+
(0, import_react4.useEffect)(() => {
|
|
1029
1061
|
if (waitDisposition.current === "waiting") pending.takeTime();
|
|
1030
1062
|
if (waitDisposition.current === "editing") pending.bump();
|
|
1031
1063
|
}, [pending]);
|
|
1032
1064
|
const countdown = card.countdown;
|
|
1033
|
-
const [minimized, setMinimized] = (0,
|
|
1034
|
-
const focusedQuestions = (0,
|
|
1035
|
-
const answerSurface = (0,
|
|
1065
|
+
const [minimized, setMinimized] = (0, import_react4.useState)(false);
|
|
1066
|
+
const focusedQuestions = (0, import_react4.useRef)(/* @__PURE__ */ new Set());
|
|
1067
|
+
const answerSurface = (0, import_react4.useRef)(null);
|
|
1036
1068
|
const question = questions[index];
|
|
1037
1069
|
const draft = drafts[index];
|
|
1038
1070
|
const hasOptions = (question.options?.length ?? 0) > 0;
|
|
1071
|
+
const fixedActions = question.intent?.kind === "approval";
|
|
1039
1072
|
const questionId = `question-${pending.key}-${String(index)}`;
|
|
1040
1073
|
const replaceProgress = (nextIndex, nextDrafts) => {
|
|
1041
1074
|
pending.bump();
|
|
@@ -1056,7 +1089,7 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1056
1089
|
const blurAnswerSurface = (event) => {
|
|
1057
1090
|
if (!event.currentTarget.contains(event.relatedTarget)) pending.releaseFocus();
|
|
1058
1091
|
};
|
|
1059
|
-
(0,
|
|
1092
|
+
(0, import_react4.useEffect)(() => {
|
|
1060
1093
|
const release = () => {
|
|
1061
1094
|
pending.releaseFocus();
|
|
1062
1095
|
};
|
|
@@ -1100,14 +1133,28 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1100
1133
|
replaceProgress(nextIndex, nextDrafts);
|
|
1101
1134
|
setError(null);
|
|
1102
1135
|
};
|
|
1103
|
-
const choose = (label) => {
|
|
1136
|
+
const choose = (label, advance = true) => {
|
|
1104
1137
|
updateDraft((current) => {
|
|
1105
1138
|
if (question.multiSelect === true) {
|
|
1106
1139
|
const selected = current.selected.includes(label) ? current.selected.filter((item) => item !== label) : [...current.selected, label];
|
|
1107
1140
|
return { ...current, selected, skipped: false };
|
|
1108
1141
|
}
|
|
1109
1142
|
return { selected: [label], custom: "", skipped: false };
|
|
1110
|
-
}, question.multiSelect !== true && index < questions.length - 1 ? index + 1 : index);
|
|
1143
|
+
}, advance && question.multiSelect !== true && index < questions.length - 1 ? index + 1 : index);
|
|
1144
|
+
};
|
|
1145
|
+
const navigateOptions = (event, optionIndex) => {
|
|
1146
|
+
if (question.multiSelect === true || locked || event.defaultPrevented) return;
|
|
1147
|
+
const options = question.options ?? [];
|
|
1148
|
+
let next;
|
|
1149
|
+
if (event.key === "ArrowDown" || event.key === "ArrowRight") next = (optionIndex + 1) % options.length;
|
|
1150
|
+
else if (event.key === "ArrowUp" || event.key === "ArrowLeft") next = (optionIndex - 1 + options.length) % options.length;
|
|
1151
|
+
else if (event.key === "Home") next = 0;
|
|
1152
|
+
else if (event.key === "End") next = options.length - 1;
|
|
1153
|
+
else return;
|
|
1154
|
+
event.preventDefault();
|
|
1155
|
+
event.stopPropagation();
|
|
1156
|
+
event.currentTarget.parentElement?.querySelectorAll('[role="radio"]')[next]?.focus();
|
|
1157
|
+
choose(options[next].label, false);
|
|
1111
1158
|
};
|
|
1112
1159
|
const answered = (item) => item.selected.length > 0 || item.custom.trim() !== "";
|
|
1113
1160
|
const completed = (item) => answered(item) || item.skipped;
|
|
@@ -1174,7 +1221,7 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1174
1221
|
}));
|
|
1175
1222
|
};
|
|
1176
1223
|
const continueFromCustom = (event) => {
|
|
1177
|
-
if (event.key !== "Enter" || event.shiftKey || isComposing(event)) return;
|
|
1224
|
+
if (event.defaultPrevented || event.repeat || event.key !== "Enter" || event.shiftKey || isComposing(event)) return;
|
|
1178
1225
|
event.preventDefault();
|
|
1179
1226
|
continueFlow();
|
|
1180
1227
|
};
|
|
@@ -1190,13 +1237,15 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1190
1237
|
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)(
|
|
1191
1238
|
"section",
|
|
1192
1239
|
{
|
|
1240
|
+
ref: answerSurface,
|
|
1193
1241
|
className: clsx_default(css_modules_entry_default4.card, minimized && css_modules_entry_default4.cardMinimized),
|
|
1242
|
+
onFocusCapture: focusAnswerSurface,
|
|
1243
|
+
onBlurCapture: blurAnswerSurface,
|
|
1194
1244
|
"aria-labelledby": questionId,
|
|
1195
1245
|
"aria-busy": busy !== null,
|
|
1196
1246
|
children: [
|
|
1197
1247
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("header", { className: css_modules_entry_default4.header, children: [
|
|
1198
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.
|
|
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 }) }),
|
|
1248
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: css_modules_entry_default4.headingBlock, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css_modules_entry_default4.titleRow, children: [
|
|
1200
1249
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1201
1250
|
"div",
|
|
1202
1251
|
{
|
|
@@ -1206,8 +1255,10 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1206
1255
|
"aria-level": 2,
|
|
1207
1256
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.MarkdownText, { text: question.question, variant: "compact", labels: markdownLabels })
|
|
1208
1257
|
}
|
|
1209
|
-
)
|
|
1210
|
-
|
|
1258
|
+
),
|
|
1259
|
+
question.header !== void 0 && question.header.trim() !== question.question.trim() && !question.question.toLocaleLowerCase().includes(question.header.trim().toLocaleLowerCase()) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css_modules_entry_default4.headerChip, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.MarkdownText, { text: question.header, variant: "compact", labels: markdownLabels }) }),
|
|
1260
|
+
review !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css_modules_entry_default4.statusChip, children: t("review.status") })
|
|
1261
|
+
] }) }),
|
|
1211
1262
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css_modules_entry_default4.headerActions, children: [
|
|
1212
1263
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1213
1264
|
"button",
|
|
@@ -1239,16 +1290,12 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1239
1290
|
] })
|
|
1240
1291
|
] }),
|
|
1241
1292
|
/* @__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
1293
|
!minimized && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1244
1294
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1245
1295
|
"div",
|
|
1246
1296
|
{
|
|
1247
|
-
ref: answerSurface,
|
|
1248
1297
|
className: css_modules_entry_default4.body,
|
|
1249
1298
|
"data-question-scroll": true,
|
|
1250
|
-
onFocusCapture: focusAnswerSurface,
|
|
1251
|
-
onBlurCapture: blurAnswerSurface,
|
|
1252
1299
|
children: [
|
|
1253
1300
|
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
1301
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css_modules_entry_default4.options, role: hasOptions && question.multiSelect !== true ? "radiogroup" : "group", "aria-labelledby": questionId, children: [
|
|
@@ -1265,6 +1312,10 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1265
1312
|
"aria-label": display.recommended ? `${display.label}, ${t("option.recommended")}` : display.label,
|
|
1266
1313
|
"aria-describedby": option.description === void 0 ? void 0 : `${questionId}-option-${String(optionIndex)}`,
|
|
1267
1314
|
disabled: locked,
|
|
1315
|
+
tabIndex: question.multiSelect === true || selected || draft.selected.length === 0 && optionIndex === 0 ? 0 : -1,
|
|
1316
|
+
onKeyDown: (event) => {
|
|
1317
|
+
navigateOptions(event, optionIndex);
|
|
1318
|
+
},
|
|
1268
1319
|
onClick: () => {
|
|
1269
1320
|
choose(option.label);
|
|
1270
1321
|
},
|
|
@@ -1283,7 +1334,7 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1283
1334
|
);
|
|
1284
1335
|
}),
|
|
1285
1336
|
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)(
|
|
1337
|
+
!fixedActions && (review === void 0 || draft.custom !== "") && (hasOptions ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1287
1338
|
"div",
|
|
1288
1339
|
{
|
|
1289
1340
|
className: clsx_default(
|
|
@@ -1369,17 +1420,21 @@ function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }) {
|
|
|
1369
1420
|
}
|
|
1370
1421
|
)
|
|
1371
1422
|
] }),
|
|
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 }),
|
|
1423
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: css_modules_entry_default4.feedback, role: "status", "aria-atomic": "true", "data-error": error !== null && (!("key" in error) || error.key !== "status.sent") || void 0, children: error === null ? null : "key" in error ? t(error.key) : error.text }),
|
|
1373
1424
|
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.
|
|
1425
|
+
!fixedActions && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", className: css_modules_entry_default4.button, disabled: busy !== null, onClick: skipQuestion, children: t("action.skip") }),
|
|
1426
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1376
1427
|
import_dsh_client_ui_primitives3.Button,
|
|
1377
1428
|
{
|
|
1378
1429
|
variant: "primary",
|
|
1379
|
-
className: css_modules_entry_default4.
|
|
1430
|
+
className: css_modules_entry_default4.primary,
|
|
1431
|
+
"aria-busy": busy === "answer",
|
|
1380
1432
|
disabled: busy !== null || !answered(draft) || index === questions.length - 1 && !canSubmit,
|
|
1381
1433
|
onClick: continueFlow,
|
|
1382
|
-
children:
|
|
1434
|
+
children: [
|
|
1435
|
+
busy === "answer" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css_modules_entry_default4.spinner, "aria-hidden": "true" }),
|
|
1436
|
+
busy === "answer" ? t("submitting") : index === questions.length - 1 ? t("submit") : t("action.next")
|
|
1437
|
+
]
|
|
1383
1438
|
}
|
|
1384
1439
|
)
|
|
1385
1440
|
] })
|
|
@@ -1509,11 +1564,11 @@ var questionReplyDefinition = {
|
|
|
1509
1564
|
};
|
|
1510
1565
|
|
|
1511
1566
|
// src/client/QuestionReplyView.tsx
|
|
1512
|
-
var
|
|
1567
|
+
var import_react5 = require("react");
|
|
1513
1568
|
var import_dsh_client_ui_primitives4 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1514
1569
|
|
|
1515
1570
|
// src/client/QuestionReplyView.module.css
|
|
1516
|
-
var css5 = "/* src/client/QuestionReplyView.module.css */\n.QuestionReplyView_row {\n --
|
|
1571
|
+
var css5 = "/* src/client/QuestionReplyView.module.css */\n.QuestionReplyView_row {\n --cfg-line: var(--dsw-alias-border-l2);\n --cfg-line-strong: var(--dsw-alias-border-l3);\n --cfg-surface: var(--dsw-alias-bg-layer-2);\n --cfg-sunken: color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-alias-bg-layer-1));\n --cfg-ink: var(--dsw-alias-label-primary);\n --cfg-muted: var(--dsw-alias-label-secondary);\n --cfg-accent: #3388bb;\n --cfg-accent-text: #14587f;\n --cfg-hover: var(--dsw-alias-interactive-bg-hover);\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: 4px;\n min-width: 0;\n padding: 4px 0;\n}\n.QuestionReplyView_bubble {\n max-width: 85%;\n min-width: 0;\n overflow: hidden;\n border: 1px solid var(--cfg-line);\n border-radius: 12px;\n background: var(--cfg-surface);\n color: var(--cfg-ink);\n font-size: inherit;\n line-height: 1.5;\n text-align: left;\n overflow-wrap: anywhere;\n}\n.QuestionReplyView_toggle {\n appearance: none;\n display: block;\n width: 100%;\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(--cfg-hover);\n}\n.QuestionReplyView_toggle:focus-visible {\n outline: 2px solid var(--cfg-accent);\n outline-offset: -3px;\n border-radius: 8px;\n}\n.QuestionReplyView_labelRow {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.QuestionReplyView_caret {\n display: inline-flex;\n flex: none;\n color: var(--cfg-muted);\n}\n.QuestionReplyView_caret svg {\n width: 12px;\n height: 12px;\n}\n.QuestionReplyView_label {\n color: var(--cfg-muted);\n font-size: 11px;\n line-height: 18px;\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: 10px;\n border-top: 1px solid var(--cfg-line);\n}\n.QuestionReplyView_details > div + div {\n margin-top: 12px;\n}\n.QuestionReplyView_question {\n display: grid;\n gap: 4px;\n font-size: inherit;\n}\n.QuestionReplyView_questionText {\n font-weight: 500;\n}\n.QuestionReplyView_header,\n.QuestionReplyView_detail,\n.QuestionReplyView_options {\n color: var(--cfg-muted);\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: 4px 0 0;\n padding: 0;\n list-style: none;\n}\n.QuestionReplyView_options li {\n display: flex;\n align-items: flex-start;\n gap: 6px;\n padding: 6px 8px;\n border: 1px solid transparent;\n border-radius: 8px;\n}\n.QuestionReplyView_options li[data-selected] {\n border-color: var(--cfg-accent);\n color: var(--cfg-ink);\n background: color-mix(in srgb, var(--cfg-accent) 8%, transparent);\n}\n.QuestionReplyView_selection {\n display: grid;\n place-items: center;\n width: 16px;\n height: 18px;\n flex: none;\n color: var(--cfg-accent);\n}\n.QuestionReplyView_optionCopy {\n display: grid;\n min-width: 0;\n gap: 2px;\n}\n.QuestionReplyView_optionDescription {\n color: var(--cfg-muted);\n}\n.QuestionReplyView_answer {\n margin: 8px 0 0;\n white-space: pre-wrap;\n}\n.QuestionReplyView_answerLabel {\n margin-right: 4px;\n color: var(--cfg-muted);\n font-size: 11px;\n line-height: 18px;\n}\n.QuestionReplyView_actions {\n display: flex;\n align-items: center;\n gap: 4px;\n padding-right: 2px;\n color: var(--dsw-alias-label-tertiary);\n}\n.QuestionReplyView_time {\n font-size: 11px;\n font-variant-numeric: tabular-nums;\n}\n.QuestionReplyView_action {\n appearance: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n border: 0;\n border-radius: 6px;\n background: transparent;\n color: inherit;\n cursor: pointer;\n transition: background-color 140ms ease, color 140ms ease;\n}\n.QuestionReplyView_action svg {\n width: 14px;\n height: 14px;\n}\n.QuestionReplyView_action:hover {\n background: var(--cfg-hover);\n color: var(--cfg-ink);\n}\n.QuestionReplyView_action:focus-visible {\n outline: 2px solid var(--cfg-accent);\n outline-offset: 2px;\n}\n.QuestionReplyView_action:disabled {\n opacity: .4;\n cursor: default;\n}\n.QuestionReplyView_copyFeedback {\n color: var(--cfg-muted);\n font-size: 12px;\n}\n.QuestionReplyView_copyFeedback[role=alert] {\n color: var(--dsw-alias-state-error-primary);\n}\n.QuestionReplyView_copyFeedback:empty {\n display: none;\n}\n.QuestionReplyView_spinner {\n width: 12px;\n height: 12px;\n border: 1px solid currentColor;\n border-right-color: transparent;\n border-radius: 50%;\n animation: QuestionReplyView_spin 800ms linear infinite;\n}\n@keyframes QuestionReplyView_spin {\n to {\n transform: rotate(360deg);\n }\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}\n@media (pointer: coarse) {\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 .QuestionReplyView_action {\n transition: none;\n }\n .QuestionReplyView_spinner {\n animation: none;\n }\n}\n[data-ds-dark-theme] .QuestionReplyView_row {\n --cfg-accent: #4eb0e8;\n --cfg-accent-text: #6fc0ee;\n}\n";
|
|
1517
1572
|
var id5 = "dsh-better-ask-user/QuestionReplyView.module.css";
|
|
1518
1573
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id5) + "]") === null) {
|
|
1519
1574
|
const tag = document.createElement("style");
|
|
@@ -1544,36 +1599,45 @@ var QuestionReplyView_default = {
|
|
|
1544
1599
|
answerLabel: "QuestionReplyView_answerLabel",
|
|
1545
1600
|
actions: "QuestionReplyView_actions",
|
|
1546
1601
|
time: "QuestionReplyView_time",
|
|
1547
|
-
action: "QuestionReplyView_action"
|
|
1602
|
+
action: "QuestionReplyView_action",
|
|
1603
|
+
copyFeedback: "QuestionReplyView_copyFeedback",
|
|
1604
|
+
spinner: "QuestionReplyView_spinner",
|
|
1605
|
+
spin: "QuestionReplyView_spin"
|
|
1548
1606
|
};
|
|
1549
1607
|
var css_modules_entry_default5 = QuestionReplyView_default;
|
|
1550
1608
|
|
|
1551
1609
|
// src/client/QuestionReplyView.tsx
|
|
1552
1610
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1553
|
-
var QuestionReplyView = (0,
|
|
1611
|
+
var QuestionReplyView = (0, import_react5.memo)(function QuestionReplyView2({ node, t }) {
|
|
1554
1612
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(QuestionReplyBubble, { data: node.data, t });
|
|
1555
1613
|
});
|
|
1556
1614
|
function QuestionReplyBubble({ data, t }) {
|
|
1557
1615
|
const label = t("reply.label");
|
|
1558
|
-
const [open, setOpen] = (0,
|
|
1616
|
+
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
1559
1617
|
const toggleLabel = t(open ? "reply.close" : "reply.open");
|
|
1560
1618
|
const summary = data.questions.length === 0 ? data.text : data.questions.flatMap((question) => replyAnswerValues(data, question.id)).join(", ");
|
|
1561
1619
|
const copyText = replyClipboardText(data, t);
|
|
1562
|
-
const
|
|
1563
|
-
const
|
|
1564
|
-
(0,
|
|
1620
|
+
const detailsId = (0, import_react5.useId)();
|
|
1621
|
+
const [copyState, setCopyState] = (0, import_react5.useState)("idle");
|
|
1622
|
+
const copyTimer = (0, import_react5.useRef)();
|
|
1623
|
+
(0, import_react5.useEffect)(() => () => {
|
|
1565
1624
|
window.clearTimeout(copyTimer.current);
|
|
1566
1625
|
}, []);
|
|
1567
|
-
const onCopy = (0,
|
|
1568
|
-
if (copied) return;
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1626
|
+
const onCopy = (0, import_react5.useCallback)(async () => {
|
|
1627
|
+
if (copyState === "copying" || copyState === "copied") return;
|
|
1628
|
+
window.clearTimeout(copyTimer.current);
|
|
1629
|
+
setCopyState("copying");
|
|
1630
|
+
try {
|
|
1631
|
+
const ok = await (0, import_dsh_client_ui_primitives4.writeClipboard)(copyText);
|
|
1632
|
+
setCopyState(ok ? "copied" : "error");
|
|
1633
|
+
if (ok) copyTimer.current = window.setTimeout(() => {
|
|
1634
|
+
setCopyState("idle");
|
|
1635
|
+
}, 1500);
|
|
1636
|
+
} catch {
|
|
1637
|
+
setCopyState("error");
|
|
1638
|
+
}
|
|
1639
|
+
}, [copyState, copyText]);
|
|
1640
|
+
const copyLabel = copyState === "copied" ? t("copied") : t("copy");
|
|
1577
1641
|
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
1642
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css_modules_entry_default5.bubble, children: [
|
|
1579
1643
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
@@ -1582,6 +1646,7 @@ function QuestionReplyBubble({ data, t }) {
|
|
|
1582
1646
|
type: "button",
|
|
1583
1647
|
className: css_modules_entry_default5.toggle,
|
|
1584
1648
|
"aria-expanded": open,
|
|
1649
|
+
"aria-controls": open ? detailsId : void 0,
|
|
1585
1650
|
"aria-label": `${label} \xB7 ${toggleLabel}`,
|
|
1586
1651
|
onClick: () => {
|
|
1587
1652
|
setOpen((value) => !value);
|
|
@@ -1595,7 +1660,7 @@ function QuestionReplyBubble({ data, t }) {
|
|
|
1595
1660
|
]
|
|
1596
1661
|
}
|
|
1597
1662
|
),
|
|
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) => {
|
|
1663
|
+
open && (data.questions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: css_modules_entry_default5.text, id: detailsId, children: data.text }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dl", { className: css_modules_entry_default5.details, id: detailsId, children: data.questions.map((question) => {
|
|
1599
1664
|
const values = replyAnswerValues(data, question.id);
|
|
1600
1665
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1601
1666
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("dt", { className: css_modules_entry_default5.question, children: [
|
|
@@ -1619,7 +1684,10 @@ function QuestionReplyBubble({ data, t }) {
|
|
|
1619
1684
|
] }),
|
|
1620
1685
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css_modules_entry_default5.actions, children: [
|
|
1621
1686
|
/* @__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:
|
|
1687
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.Tooltip, { label: copyLabel, side: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: css_modules_entry_default5.action, "aria-label": copyLabel, "aria-busy": copyState === "copying", disabled: copyState === "copying", onClick: () => {
|
|
1688
|
+
void onCopy();
|
|
1689
|
+
}, children: copyState === "copying" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.spinner, "aria-hidden": "true" }) : copyState === "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, {}) }) }),
|
|
1690
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css_modules_entry_default5.copyFeedback, role: copyState === "error" ? "alert" : "status", children: copyState === "error" ? t("reply.copyFailed") : copyState === "copied" ? t("copied") : null })
|
|
1623
1691
|
] })
|
|
1624
1692
|
] });
|
|
1625
1693
|
}
|
|
@@ -1634,6 +1702,8 @@ var zh = {
|
|
|
1634
1702
|
"history.title": "\u95EE\u9898",
|
|
1635
1703
|
"history.review": "\u67E5\u770B",
|
|
1636
1704
|
"history.reopen": "\u6253\u5F00",
|
|
1705
|
+
"history.unavailable": "\u95EE\u9898\u6682\u65F6\u65E0\u6CD5\u6253\u5F00\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
1706
|
+
"reply.copyFailed": "\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
1637
1707
|
"wait.takeTime": "\u6162\u6162\u56DE\u7B54",
|
|
1638
1708
|
"wait.countdown": "{seconds} \u79D2\u540E\u7EE7\u7EED\u5DE5\u4F5C",
|
|
1639
1709
|
"wait.autoCountdown": "{seconds} \u79D2\u540E\u81EA\u52A8\u9009\u62E9\u9ED8\u8BA4\u9879",
|
|
@@ -1674,6 +1744,8 @@ var en = {
|
|
|
1674
1744
|
"history.title": "Question",
|
|
1675
1745
|
"history.review": "Review",
|
|
1676
1746
|
"history.reopen": "Open",
|
|
1747
|
+
"history.unavailable": "Cannot open this question right now. Try again.",
|
|
1748
|
+
"reply.copyFailed": "Copy failed. Try again.",
|
|
1677
1749
|
"wait.takeTime": "Take time",
|
|
1678
1750
|
"wait.countdown": "Continuing in {seconds}s",
|
|
1679
1751
|
"wait.autoCountdown": "Defaults selected in {seconds}s",
|
|
@@ -1707,29 +1779,29 @@ var en = {
|
|
|
1707
1779
|
};
|
|
1708
1780
|
|
|
1709
1781
|
// src/client/settings.tsx
|
|
1710
|
-
var
|
|
1711
|
-
var import_dsh_client_ui_primitives5 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1782
|
+
var import_react6 = require("react");
|
|
1712
1783
|
|
|
1713
1784
|
// src/client/settings-locales.ts
|
|
1714
1785
|
var settingsZh = {
|
|
1715
1786
|
summary: "\u7B49\u5F85\u4E0E\u8D85\u65F6",
|
|
1716
1787
|
title: "\u63D0\u95EE",
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
durationLabel: "\u7B49\u5F85\u65F6\u957F",
|
|
1788
|
+
waitLabel: "\u7B49\u5F85",
|
|
1789
|
+
durationLabel: "\u7B49\u5F85\u65F6\u957F\uFF08\u79D2\uFF09",
|
|
1720
1790
|
timed: "\u5012\u8BA1\u65F6",
|
|
1721
1791
|
unlimited: "\u4E0D\u9650\u65F6",
|
|
1722
1792
|
seconds: "\u79D2",
|
|
1723
|
-
waitHint: "\u8F93\u5165\u65F6\u91CD\u65B0\u8BA1\u65F6\u3002
|
|
1793
|
+
waitHint: "\u8F93\u5165\u65F6\u91CD\u65B0\u8BA1\u65F6\u3002",
|
|
1724
1794
|
unlimitedHint: "\u4E00\u76F4\u7B49\u5F85\u56DE\u7B54\uFF0C\u8F93\u5165\u65E0\u9700\u7EED\u671F\u3002",
|
|
1725
|
-
timeoutTitle: "\
|
|
1795
|
+
timeoutTitle: "\u8D85\u65F6\u540E",
|
|
1726
1796
|
behaviorLabel: "\u666E\u901A\u4F1A\u8BDD",
|
|
1727
1797
|
goalBehaviorLabel: "Goal \u6D3B\u8DC3\u65F6",
|
|
1728
|
-
native: "\
|
|
1729
|
-
default: "\
|
|
1798
|
+
native: "\u7EE7\u7EED\u5DE5\u4F5C",
|
|
1799
|
+
default: "\u9009\u62E9\u9ED8\u8BA4\u7B54\u6848",
|
|
1800
|
+
advanced: "\u9AD8\u7EA7",
|
|
1801
|
+
discard: "\u653E\u5F03\u6539\u52A8",
|
|
1730
1802
|
nativeHint: "\u8D85\u65F6\u540E\u4ECD\u53EF\u56DE\u7B54\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u540C\u610F\u3002",
|
|
1731
|
-
defaultHint: "\
|
|
1732
|
-
timeoutDisabled: "\u4E0D\u9650\u65F6\
|
|
1803
|
+
defaultHint: "\u8D85\u65F6\u540E\u81EA\u52A8\u63D0\u4EA4\u9ED8\u8BA4\u7B54\u6848\u3002",
|
|
1804
|
+
timeoutDisabled: "\u4E0D\u9650\u65F6\u6A21\u5F0F\u4E0B\u4E0D\u89E6\u53D1\u8D85\u65F6\u884C\u4E3A\uFF0C\u4FDD\u7559\u4EE5\u4E0B\u6B21\u4F7F\u7528\u3002",
|
|
1733
1805
|
readonly: "\u5F53\u524D\u914D\u7F6E\u4E3A\u53EA\u8BFB\u3002",
|
|
1734
1806
|
loading: "\u6B63\u5728\u8BFB\u53D6\u8BBE\u7F6E\u2026",
|
|
1735
1807
|
unavailable: "\u5F53\u524D\u8FDE\u63A5\u4E0B\u8BE5\u914D\u7F6E\u4E0D\u53EF\u7528\u3002",
|
|
@@ -1737,7 +1809,7 @@ var settingsZh = {
|
|
|
1737
1809
|
invalidWait: "\u7B49\u5F85\u65F6\u957F\u987B\u4E3A 1 \u5230 2147483 \u7684\u6574\u6570\u3002",
|
|
1738
1810
|
save: "\u4FDD\u5B58",
|
|
1739
1811
|
saving: "\u4FDD\u5B58\u4E2D\u2026",
|
|
1740
|
-
saved: "\u5DF2\u4FDD\u5B58",
|
|
1812
|
+
saved: "\u5DF2\u4FDD\u5B58\uFF0C\u5BF9\u65B0\u63D0\u95EE\u751F\u6548",
|
|
1741
1813
|
conflict: "\u8BBE\u7F6E\u5DF2\u88AB\u5176\u4ED6\u7A97\u53E3\u4FEE\u6539\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
1742
1814
|
saveFailed: "\u4FDD\u5B58\u5931\u8D25\uFF1A",
|
|
1743
1815
|
dirty: "\u6709\u672A\u4FDD\u5B58\u7684\u4FEE\u6539"
|
|
@@ -1745,22 +1817,23 @@ var settingsZh = {
|
|
|
1745
1817
|
var settingsEn = {
|
|
1746
1818
|
summary: "Wait and timeout",
|
|
1747
1819
|
title: "Questions",
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
durationLabel: "Wait duration",
|
|
1820
|
+
waitLabel: "Wait",
|
|
1821
|
+
durationLabel: "Wait duration in seconds",
|
|
1751
1822
|
timed: "Countdown",
|
|
1752
1823
|
unlimited: "Unlimited",
|
|
1753
1824
|
seconds: "sec",
|
|
1754
|
-
waitHint: "Typing restarts the countdown.
|
|
1825
|
+
waitHint: "Typing restarts the countdown.",
|
|
1755
1826
|
unlimitedHint: "Wait until answered, with no countdown to extend.",
|
|
1756
|
-
timeoutTitle: "
|
|
1827
|
+
timeoutTitle: "At timeout",
|
|
1757
1828
|
behaviorLabel: "Standard session",
|
|
1758
1829
|
goalBehaviorLabel: "Active Goal",
|
|
1759
|
-
native: "
|
|
1760
|
-
default: "
|
|
1830
|
+
native: "Continue work",
|
|
1831
|
+
default: "Use defaults",
|
|
1832
|
+
advanced: "Advanced",
|
|
1833
|
+
discard: "Discard",
|
|
1761
1834
|
nativeHint: "You can still answer after timeout. Nothing is automatically approved.",
|
|
1762
|
-
defaultHint: "
|
|
1763
|
-
timeoutDisabled: "
|
|
1835
|
+
defaultHint: "Submits default answers when the countdown ends.",
|
|
1836
|
+
timeoutDisabled: "Timeout behavior is inactive while waiting without a limit. Your choices are kept.",
|
|
1764
1837
|
readonly: "This configuration is read-only.",
|
|
1765
1838
|
loading: "Loading settings\u2026",
|
|
1766
1839
|
unavailable: "This configuration is unavailable on the current connection.",
|
|
@@ -1768,14 +1841,14 @@ var settingsEn = {
|
|
|
1768
1841
|
invalidWait: "Enter a whole number from 1 to 2147483 seconds.",
|
|
1769
1842
|
save: "Save",
|
|
1770
1843
|
saving: "Saving\u2026",
|
|
1771
|
-
saved: "Saved",
|
|
1844
|
+
saved: "Saved for new questions",
|
|
1772
1845
|
conflict: "The settings changed in another window; try again.",
|
|
1773
1846
|
saveFailed: "Save failed: ",
|
|
1774
1847
|
dirty: "Unsaved changes"
|
|
1775
1848
|
};
|
|
1776
1849
|
|
|
1777
1850
|
// 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";
|
|
1851
|
+
var css6 = "/* src/client/settings.module.css */\n.settings_cfg {\n --ui-accent: #3388bb;\n --ui-accent-solid: #20709e;\n --ui-accent-text: #14587f;\n --ui-accent-fg: #fff;\n --ui-accent-soft: color-mix(in srgb, var(--ui-accent) 10%, transparent);\n --ui-ink-1: var(--dsw-alias-label-primary, #0f1115);\n --ui-ink-2: var(--dsw-alias-label-secondary, #61666b);\n --ui-ink-3: color-mix(in srgb, var(--dsw-alias-label-tertiary, #81858c) 80%, var(--dsw-alias-label-primary, #0f1115));\n --ui-line-1: var(--dsw-alias-border-l1, #0000000a);\n --ui-line-2: var(--dsw-alias-border-l2, #0000001a);\n --ui-line-3: var(--dsw-alias-border-l3, #0000001f);\n --ui-canvas: var(--dsw-alias-bg-layer-1, #fff);\n --ui-raised: var(--dsw-alias-bg-layer-2, #fff);\n --ui-sunken: color-mix(in srgb, var(--ui-ink-1) 4%, var(--ui-canvas));\n --ui-hover: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, var(--ui-ink-1) 5%, transparent));\n --ui-danger: var(--dsw-alias-state-error-primary, #c8322b);\n --ui-radius-sm: 6px;\n --ui-radius-md: 8px;\n display: flex;\n flex-direction: column;\n gap: 20px;\n width: 100%;\n max-width: 920px;\n margin: 0 auto;\n min-width: 0;\n color: var(--ui-ink-1);\n font: inherit;\n line-height: 20px;\n font-variant-numeric: tabular-nums;\n}\n.settings_cfg *,\n.settings_cfg {\n box-sizing: border-box;\n}\n.settings_pageHead {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n min-width: 0;\n}\n.settings_title {\n margin: 0;\n font-size: 20px;\n line-height: 28px;\n font-weight: 500;\n letter-spacing: -.01em;\n}\n.settings_badge {\n display: inline-flex;\n align-items: center;\n height: 20px;\n padding: 0 8px;\n border: 1px solid var(--ui-line-2);\n border-radius: 999px;\n background: var(--ui-raised);\n color: var(--ui-ink-3);\n font-size: 11px;\n line-height: 18px;\n white-space: nowrap;\n}\n.settings_group {\n display: flex;\n flex-direction: column;\n min-width: 0;\n border-top: 1px solid var(--ui-line-2);\n}\n.settings_row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 24px;\n min-height: 44px;\n min-width: 0;\n padding: 10px 0;\n border-bottom: 1px solid var(--ui-line-1);\n}\n.settings_rowText {\n display: flex;\n flex-direction: column;\n gap: 2px;\n flex: 1;\n min-width: 0;\n}\n.settings_rowTitle {\n color: var(--ui-ink-1);\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n}\n.settings_rowDesc {\n color: var(--ui-ink-3);\n font-size: 12px;\n line-height: 18px;\n}\n.settings_control {\n display: flex;\n align-items: center;\n gap: 8px;\n flex: none;\n min-width: 0;\n}\n.settings_choices {\n display: inline-flex;\n flex: none;\n gap: 2px;\n height: 32px;\n padding: 1px;\n border: 1px solid var(--ui-line-2);\n border-radius: var(--ui-radius-md);\n background: var(--ui-sunken);\n}\n.settings_choice {\n position: relative;\n display: inline-flex;\n min-width: 0;\n}\n.settings_choice input {\n appearance: none;\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n opacity: 0;\n cursor: pointer;\n}\n.settings_choice span {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 28px;\n padding: 0 12px;\n border-radius: var(--ui-radius-sm);\n color: var(--ui-ink-3);\n font-size: 13px;\n line-height: 20px;\n white-space: nowrap;\n transition:\n background-color 140ms ease,\n color 140ms ease,\n box-shadow 140ms ease;\n}\n.settings_choice:has(input:checked) span {\n background: var(--ui-raised);\n box-shadow: inset 0 0 0 1px var(--ui-line-2);\n color: var(--ui-accent-text);\n font-weight: 500;\n}\n.settings_choice:has(input:hover:not(:disabled):not(:checked)) span {\n background: var(--ui-hover);\n color: var(--ui-ink-1);\n}\n.settings_choice:has(input:focus-visible) span {\n outline: 2px solid var(--ui-accent);\n outline-offset: 2px;\n}\n.settings_choice:has(input:disabled) {\n opacity: .4;\n}\n.settings_choice input:disabled {\n cursor: not-allowed;\n}\n.settings_input {\n appearance: none;\n width: 76px;\n min-width: 0;\n height: 32px;\n padding: 0 8px;\n border: 1px solid var(--ui-line-2);\n border-radius: var(--ui-radius-md);\n background: var(--ui-raised);\n color: var(--ui-ink-1);\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n font-variant-numeric: tabular-nums;\n transition: border-color 140ms ease, box-shadow 140ms ease;\n}\n.settings_input:hover:not(:disabled) {\n border-color: var(--ui-line-3);\n}\n.settings_input:focus-visible {\n outline: none;\n border-color: var(--ui-accent);\n box-shadow: 0 0 0 2px var(--ui-accent-soft);\n}\n.settings_input[aria-invalid=true] {\n border-color: var(--ui-danger);\n}\n.settings_input:disabled {\n opacity: .4;\n cursor: not-allowed;\n}\n.settings_duration {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n flex: none;\n}\n.settings_unit {\n color: var(--ui-ink-3);\n font-size: 12px;\n line-height: 18px;\n}\n.settings_srOnly {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n.settings_fieldError {\n margin: 6px 0 0;\n color: var(--ui-danger);\n font-size: 12px;\n line-height: 18px;\n overflow-wrap: anywhere;\n}\n.settings_sectionLabel {\n margin: 20px 0 0;\n padding-bottom: 6px;\n border-bottom: 1px solid var(--ui-line-2);\n color: var(--ui-ink-3);\n font-size: 12px;\n line-height: 18px;\n font-weight: 500;\n letter-spacing: .02em;\n}\n.settings_advanced {\n margin-top: 12px;\n border-top: 1px solid var(--ui-line-1);\n}\n.settings_advanced summary {\n display: flex;\n align-items: center;\n gap: 8px;\n min-height: 32px;\n padding: 4px 0;\n color: var(--ui-ink-2);\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n list-style: none;\n cursor: pointer;\n}\n.settings_advanced summary::-webkit-details-marker {\n display: none;\n}\n.settings_advanced summary:hover {\n color: var(--ui-ink-1);\n}\n.settings_advanced summary:focus-visible {\n outline: 2px solid var(--ui-accent);\n outline-offset: 2px;\n border-radius: 4px;\n}\n.settings_advancedValue {\n margin-left: auto;\n color: var(--ui-ink-3);\n font-size: 11px;\n line-height: 18px;\n font-weight: 400;\n white-space: nowrap;\n}\n.settings_chevron {\n width: 6px;\n height: 6px;\n margin: 0 4px 3px auto;\n border-right: 1px solid currentColor;\n border-bottom: 1px solid currentColor;\n transform: rotate(45deg);\n transition: transform 140ms ease;\n}\n.settings_advancedValue + .settings_chevron {\n margin-left: 0;\n}\n.settings_advanced[open] .settings_chevron {\n transform: rotate(225deg);\n margin-bottom: -3px;\n}\n.settings_status {\n margin: 0;\n color: var(--ui-ink-3);\n font-size: 12px;\n line-height: 18px;\n overflow-wrap: anywhere;\n}\n.settings_footer {\n position: sticky;\n bottom: 0;\n z-index: 2;\n display: flex;\n align-items: center;\n gap: 8px;\n flex-wrap: wrap;\n padding: 12px 0;\n border-top: 1px solid var(--ui-line-2);\n background: var(--ui-canvas);\n margin-top: auto;\n}\n.settings_footer .settings_status {\n flex: 1;\n min-width: 0;\n}\n.settings_button,\n.settings_primary {\n appearance: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n gap: 6px;\n height: 32px;\n padding: 0 12px;\n border: 1px solid var(--ui-line-2);\n border-radius: var(--ui-radius-md);\n background: var(--ui-raised);\n color: var(--ui-ink-1);\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n cursor: pointer;\n transition:\n background-color 140ms ease,\n border-color 140ms ease,\n color 140ms ease;\n}\n.settings_button:hover:not(:disabled) {\n background: var(--ui-hover);\n}\n.settings_button:active:not(:disabled) {\n background: var(--ui-sunken);\n}\n.settings_primary {\n min-width: 96px;\n border-color: transparent;\n background: var(--ui-accent-solid);\n color: var(--ui-accent-fg);\n}\n.settings_primary:hover:not(:disabled) {\n background: color-mix(in srgb, var(--ui-accent-solid) 88%, black);\n}\n.settings_primary:active:not(:disabled) {\n background: color-mix(in srgb, var(--ui-accent-solid) 80%, black);\n}\n.settings_button:focus-visible,\n.settings_primary:focus-visible {\n outline: 2px solid var(--ui-accent);\n outline-offset: 2px;\n}\n.settings_button:disabled,\n.settings_primary:disabled {\n opacity: .4;\n cursor: not-allowed;\n}\n.settings_spinner {\n width: 12px;\n height: 12px;\n border: 1px solid currentColor;\n border-right-color: transparent;\n border-radius: 50%;\n animation: settings_spin 800ms linear infinite;\n}\n@keyframes settings_spin {\n to {\n transform: rotate(360deg);\n }\n}\n@media (max-width: 640px) {\n .settings_title {\n font-size: 18px;\n line-height: 26px;\n }\n .settings_row {\n align-items: stretch;\n flex-direction: column;\n gap: 8px;\n }\n .settings_control {\n width: 100%;\n flex-wrap: wrap;\n }\n .settings_choice {\n flex: 1;\n }\n .settings_choice span {\n width: 100%;\n }\n .settings_footer {\n flex-wrap: wrap;\n }\n .settings_footer .settings_status {\n flex-basis: 100%;\n }\n .settings_advancedValue {\n max-width: 65%;\n text-align: right;\n white-space: normal;\n }\n}\n@media (pointer: coarse) {\n .settings_choices {\n height: auto;\n }\n .settings_choice span,\n .settings_input,\n .settings_button,\n .settings_primary {\n min-height: 44px;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .settings_spinner {\n animation: none;\n }\n .settings_input,\n .settings_choice span,\n .settings_button,\n .settings_primary,\n .settings_chevron {\n transition: none;\n }\n}\n[data-ds-dark-theme] .settings_cfg {\n --ui-accent: #4eb0e8;\n --ui-accent-solid: #4eb0e8;\n --ui-accent-text: #6fc0ee;\n --ui-accent-fg: #0e1014;\n --ui-accent-soft: color-mix(in srgb, var(--ui-accent) 14%, transparent);\n}\n";
|
|
1779
1852
|
var id6 = "dsh-better-ask-user/settings.module.css";
|
|
1780
1853
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(id6) + "]") === null) {
|
|
1781
1854
|
const tag = document.createElement("style");
|
|
@@ -1786,30 +1859,32 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
1786
1859
|
}
|
|
1787
1860
|
var settings_default = {
|
|
1788
1861
|
cfg: "settings_cfg",
|
|
1862
|
+
pageHead: "settings_pageHead",
|
|
1789
1863
|
title: "settings_title",
|
|
1790
|
-
|
|
1791
|
-
dependency: "settings_dependency",
|
|
1864
|
+
badge: "settings_badge",
|
|
1792
1865
|
group: "settings_group",
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
sectionTitle: "settings_sectionTitle",
|
|
1796
|
-
choiceGroup: "settings_choiceGroup",
|
|
1866
|
+
row: "settings_row",
|
|
1867
|
+
rowText: "settings_rowText",
|
|
1797
1868
|
rowTitle: "settings_rowTitle",
|
|
1869
|
+
rowDesc: "settings_rowDesc",
|
|
1870
|
+
control: "settings_control",
|
|
1798
1871
|
choices: "settings_choices",
|
|
1799
1872
|
choice: "settings_choice",
|
|
1800
|
-
choiceInput: "settings_choiceInput",
|
|
1801
|
-
duration: "settings_duration",
|
|
1802
|
-
durationControl: "settings_durationControl",
|
|
1803
1873
|
input: "settings_input",
|
|
1874
|
+
duration: "settings_duration",
|
|
1804
1875
|
unit: "settings_unit",
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1876
|
+
srOnly: "settings_srOnly",
|
|
1877
|
+
fieldError: "settings_fieldError",
|
|
1878
|
+
sectionLabel: "settings_sectionLabel",
|
|
1879
|
+
advanced: "settings_advanced",
|
|
1880
|
+
advancedValue: "settings_advancedValue",
|
|
1881
|
+
chevron: "settings_chevron",
|
|
1810
1882
|
status: "settings_status",
|
|
1811
|
-
|
|
1812
|
-
|
|
1883
|
+
footer: "settings_footer",
|
|
1884
|
+
button: "settings_button",
|
|
1885
|
+
primary: "settings_primary",
|
|
1886
|
+
spinner: "settings_spinner",
|
|
1887
|
+
spin: "settings_spin"
|
|
1813
1888
|
};
|
|
1814
1889
|
var css_modules_entry_default6 = settings_default;
|
|
1815
1890
|
|
|
@@ -1848,42 +1923,50 @@ function parseDraft(draft) {
|
|
|
1848
1923
|
if (seconds === void 0) return void 0;
|
|
1849
1924
|
return { questionTimeoutSeconds: seconds, timeoutBehavior: draft.timeoutBehavior, goalTimeoutBehavior: draft.goalTimeoutBehavior };
|
|
1850
1925
|
}
|
|
1851
|
-
function
|
|
1852
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("
|
|
1853
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.
|
|
1854
|
-
|
|
1855
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1856
|
-
|
|
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)) })
|
|
1926
|
+
function Row({ id: id7, label, hint, children }) {
|
|
1927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.row, children: [
|
|
1928
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.rowText, children: [
|
|
1929
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css_modules_entry_default6.rowTitle, id: `${id7}-label`, children: label }),
|
|
1930
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css_modules_entry_default6.rowDesc, id: `${id7}-hint`, children: hint }) : null
|
|
1931
|
+
] }),
|
|
1932
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: css_modules_entry_default6.control, children })
|
|
1871
1933
|
] });
|
|
1872
1934
|
}
|
|
1935
|
+
function Choices({ id: id7, value, options, disabled, describedBy, onChange }) {
|
|
1936
|
+
const name = (0, import_react6.useId)();
|
|
1937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: css_modules_entry_default6.choices, id: id7, role: "radiogroup", "aria-labelledby": `${id7}-label`, "aria-disabled": disabled, children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: css_modules_entry_default6.choice, children: [
|
|
1938
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1939
|
+
"input",
|
|
1940
|
+
{
|
|
1941
|
+
id: `${id7}-${option.value}`,
|
|
1942
|
+
type: "radio",
|
|
1943
|
+
name,
|
|
1944
|
+
value: option.value,
|
|
1945
|
+
checked: value === option.value,
|
|
1946
|
+
disabled,
|
|
1947
|
+
"aria-describedby": describedBy,
|
|
1948
|
+
onChange: () => {
|
|
1949
|
+
onChange(option.value);
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
),
|
|
1953
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: option.label })
|
|
1954
|
+
] }, option.value)) });
|
|
1955
|
+
}
|
|
1873
1956
|
function SettingsPage({ form, t = fallbackT }) {
|
|
1874
1957
|
const state = form?.state;
|
|
1875
1958
|
const revision = state?.revision;
|
|
1876
1959
|
const host = state?.status === "ready" ? normalize(state.value) : null;
|
|
1877
1960
|
const base = host === null ? null : toDraft(host);
|
|
1878
|
-
const [draft, setDraft] = (0,
|
|
1879
|
-
const [busy, setBusy] = (0,
|
|
1880
|
-
const [timedSeconds, setTimedSeconds] = (0,
|
|
1881
|
-
const [notice, setNotice] = (0,
|
|
1961
|
+
const [draft, setDraft] = (0, import_react6.useState)(null);
|
|
1962
|
+
const [busy, setBusy] = (0, import_react6.useState)(false);
|
|
1963
|
+
const [timedSeconds, setTimedSeconds] = (0, import_react6.useState)(String(DEFAULTS.questionTimeoutSeconds));
|
|
1964
|
+
const [notice, setNotice] = (0, import_react6.useState)(null);
|
|
1882
1965
|
const live = draft !== null && draft.revision === revision ? draft.value : base;
|
|
1883
1966
|
const parsed = live === null ? void 0 : parseDraft(live);
|
|
1884
1967
|
const writable = state?.status === "ready" && state?.writable === true;
|
|
1885
|
-
const dirty = host !== null && parsed
|
|
1886
|
-
const edit = (0,
|
|
1968
|
+
const dirty = host !== null && (parsed === void 0 || !same(host, parsed));
|
|
1969
|
+
const edit = (0, import_react6.useCallback)((mutate) => {
|
|
1887
1970
|
setNotice(null);
|
|
1888
1971
|
if (base === null) return;
|
|
1889
1972
|
setDraft((previous) => {
|
|
@@ -1891,7 +1974,7 @@ function SettingsPage({ form, t = fallbackT }) {
|
|
|
1891
1974
|
return { revision: revision ?? 0, value: mutate(current) };
|
|
1892
1975
|
});
|
|
1893
1976
|
}, [base, revision]);
|
|
1894
|
-
const save = (0,
|
|
1977
|
+
const save = (0, import_react6.useCallback)(async () => {
|
|
1895
1978
|
if (form === void 0 || host === null || parsed === void 0) return;
|
|
1896
1979
|
if (!writable || busy || !dirty) return;
|
|
1897
1980
|
const ops = [];
|
|
@@ -1910,10 +1993,7 @@ function SettingsPage({ form, t = fallbackT }) {
|
|
|
1910
1993
|
try {
|
|
1911
1994
|
const accepted = await form.mutate(ops, revision);
|
|
1912
1995
|
if (accepted) setNotice({ tone: "ok", text: t("saved") });
|
|
1913
|
-
else {
|
|
1914
|
-
setDraft(null);
|
|
1915
|
-
setNotice({ tone: "error", text: t("conflict") });
|
|
1916
|
-
}
|
|
1996
|
+
else setNotice({ tone: "error", text: t("conflict") });
|
|
1917
1997
|
} catch (error) {
|
|
1918
1998
|
setNotice({ tone: "error", text: t("saveFailed") + String(error?.message ?? error) });
|
|
1919
1999
|
} finally {
|
|
@@ -1930,23 +2010,24 @@ function SettingsPage({ form, t = fallbackT }) {
|
|
|
1930
2010
|
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") }) });
|
|
1931
2011
|
}
|
|
1932
2012
|
const invalid = parsed === void 0;
|
|
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
2013
|
const unlimited = live.questionTimeoutSeconds === "-1";
|
|
1935
2014
|
const controlsDisabled = !writable || busy;
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
2015
|
+
const behaviors = [{ value: "native", label: t("native") }, { value: "default", label: t("default") }];
|
|
2016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.cfg, "aria-busy": busy, "data-settings-dirty": dirty, "data-settings-busy": busy, children: [
|
|
2017
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.pageHead, children: [
|
|
2018
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { className: css_modules_entry_default6.title, id: "better-ask-user-title", children: t("title") }),
|
|
2019
|
+
writable ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css_modules_entry_default6.badge, role: "status", children: t("readonly") })
|
|
2020
|
+
] }),
|
|
1939
2021
|
/* @__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)(
|
|
2022
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Row, { id: "better-ask-user-wait-mode", label: t("waitLabel"), children: [
|
|
1941
2023
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1942
|
-
|
|
2024
|
+
Choices,
|
|
1943
2025
|
{
|
|
1944
2026
|
id: "better-ask-user-wait-mode",
|
|
1945
|
-
label: t("waitLabel"),
|
|
1946
2027
|
value: unlimited ? "unlimited" : "timed",
|
|
1947
2028
|
options: [{ value: "timed", label: t("timed") }, { value: "unlimited", label: t("unlimited") }],
|
|
1948
2029
|
disabled: controlsDisabled,
|
|
1949
|
-
|
|
2030
|
+
describedBy: "better-ask-user-wait-hint",
|
|
1950
2031
|
onChange: (value) => {
|
|
1951
2032
|
const nextUnlimited = value === "unlimited";
|
|
1952
2033
|
if (nextUnlimited && !invalid) setTimedSeconds(live.questionTimeoutSeconds);
|
|
@@ -1954,98 +2035,95 @@ function SettingsPage({ form, t = fallbackT }) {
|
|
|
1954
2035
|
}
|
|
1955
2036
|
}
|
|
1956
2037
|
),
|
|
1957
|
-
unlimited ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("
|
|
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: [
|
|
2038
|
+
unlimited ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: css_modules_entry_default6.duration, children: [
|
|
1988
2039
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1989
|
-
|
|
2040
|
+
"input",
|
|
1990
2041
|
{
|
|
1991
|
-
id: "better-ask-user-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2042
|
+
id: "better-ask-user-wait",
|
|
2043
|
+
className: css_modules_entry_default6.input,
|
|
2044
|
+
"aria-label": t("durationLabel"),
|
|
2045
|
+
"aria-describedby": invalid ? "better-ask-user-error" : "better-ask-user-wait-hint",
|
|
2046
|
+
type: "text",
|
|
2047
|
+
inputMode: "numeric",
|
|
2048
|
+
"aria-invalid": invalid || void 0,
|
|
2049
|
+
value: live.questionTimeoutSeconds,
|
|
2050
|
+
disabled: controlsDisabled,
|
|
2051
|
+
onChange: (event) => {
|
|
2052
|
+
edit((current) => ({ ...current, questionTimeoutSeconds: event.target.value }));
|
|
2000
2053
|
}
|
|
2001
2054
|
}
|
|
2002
2055
|
),
|
|
2003
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2004
|
-
|
|
2056
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css_modules_entry_default6.unit, children: t("seconds") })
|
|
2057
|
+
] })
|
|
2058
|
+
] }),
|
|
2059
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.srOnly, id: "better-ask-user-wait-hint", children: t(unlimited ? "unlimitedHint" : "waitHint") }),
|
|
2060
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.fieldError, id: "better-ask-user-error", role: "alert", children: t("invalidWait") }),
|
|
2061
|
+
!unlimited && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
2062
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: css_modules_entry_default6.sectionLabel, children: t("timeoutTitle") }),
|
|
2063
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { id: "better-ask-user-behavior", label: t("behaviorLabel"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2064
|
+
Choices,
|
|
2065
|
+
{
|
|
2066
|
+
id: "better-ask-user-behavior",
|
|
2067
|
+
value: live.timeoutBehavior,
|
|
2068
|
+
options: behaviors,
|
|
2069
|
+
disabled: controlsDisabled,
|
|
2070
|
+
describedBy: "better-ask-user-timeout-hint",
|
|
2071
|
+
onChange: (value) => {
|
|
2072
|
+
edit((current) => ({ ...current, timeoutBehavior: value }));
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
) }),
|
|
2076
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.srOnly, id: "better-ask-user-timeout-hint", children: t(live.timeoutBehavior === "default" ? "defaultHint" : "nativeHint") }),
|
|
2077
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("details", { className: css_modules_entry_default6.advanced, children: [
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("summary", { children: [
|
|
2079
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t("advanced") }),
|
|
2080
|
+
live.goalTimeoutBehavior !== DEFAULTS.goalTimeoutBehavior && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: css_modules_entry_default6.advancedValue, children: [
|
|
2081
|
+
t("goalBehaviorLabel"),
|
|
2082
|
+
" \xB7 ",
|
|
2083
|
+
t(live.goalTimeoutBehavior)
|
|
2084
|
+
] }),
|
|
2085
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css_modules_entry_default6.chevron, "aria-hidden": "true" })
|
|
2086
|
+
] }),
|
|
2087
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { id: "better-ask-user-goal-behavior", label: t("goalBehaviorLabel"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2088
|
+
Choices,
|
|
2005
2089
|
{
|
|
2006
2090
|
id: "better-ask-user-goal-behavior",
|
|
2007
|
-
label: t("goalBehaviorLabel"),
|
|
2008
2091
|
value: live.goalTimeoutBehavior,
|
|
2009
|
-
options:
|
|
2010
|
-
disabled: controlsDisabled
|
|
2011
|
-
|
|
2092
|
+
options: behaviors,
|
|
2093
|
+
disabled: controlsDisabled,
|
|
2094
|
+
describedBy: "better-ask-user-goal-hint",
|
|
2012
2095
|
onChange: (value) => {
|
|
2013
|
-
|
|
2014
|
-
edit((current) => ({ ...current, goalTimeoutBehavior: next }));
|
|
2096
|
+
edit((current) => ({ ...current, goalTimeoutBehavior: value }));
|
|
2015
2097
|
}
|
|
2016
2098
|
}
|
|
2017
|
-
)
|
|
2018
|
-
|
|
2019
|
-
|
|
2099
|
+
) }),
|
|
2100
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css_modules_entry_default6.srOnly, id: "better-ask-user-goal-hint", children: t(live.goalTimeoutBehavior === "default" ? "defaultHint" : "nativeHint") })
|
|
2101
|
+
] })
|
|
2020
2102
|
] })
|
|
2021
2103
|
] }),
|
|
2022
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.
|
|
2023
|
-
|
|
2024
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
setDraft(null);
|
|
2033
|
-
setNotice(null);
|
|
2034
|
-
setTimedSeconds(String(host.questionTimeoutSeconds === -1 ? DEFAULTS.questionTimeoutSeconds : host.questionTimeoutSeconds));
|
|
2035
|
-
},
|
|
2036
|
-
children: t("discard")
|
|
2037
|
-
}
|
|
2038
|
-
),
|
|
2039
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2040
|
-
import_dsh_client_ui_primitives5.Button,
|
|
2104
|
+
notice !== null && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: notice.tone === "ok" ? css_modules_entry_default6.status : css_modules_entry_default6.fieldError, role: notice.tone === "error" ? "alert" : "status", children: notice.text }),
|
|
2105
|
+
dirty && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css_modules_entry_default6.footer, id: "better-ask-user-settings-footer", children: [
|
|
2106
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css_modules_entry_default6.status, children: t("dirty") }),
|
|
2107
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: css_modules_entry_default6.button, id: "better-ask-user-discard", disabled: controlsDisabled, onClick: () => {
|
|
2108
|
+
setDraft(null);
|
|
2109
|
+
setNotice(null);
|
|
2110
|
+
setTimedSeconds(String(host.questionTimeoutSeconds === -1 ? DEFAULTS.questionTimeoutSeconds : host.questionTimeoutSeconds));
|
|
2111
|
+
}, children: t("discard") }),
|
|
2112
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
2113
|
+
"button",
|
|
2041
2114
|
{
|
|
2042
|
-
|
|
2043
|
-
className: css_modules_entry_default6.
|
|
2044
|
-
|
|
2115
|
+
type: "button",
|
|
2116
|
+
className: css_modules_entry_default6.primary,
|
|
2117
|
+
"data-settings-save": true,
|
|
2118
|
+
disabled: controlsDisabled || invalid,
|
|
2119
|
+
"aria-busy": busy,
|
|
2045
2120
|
onClick: () => {
|
|
2046
2121
|
void save();
|
|
2047
2122
|
},
|
|
2048
|
-
children:
|
|
2123
|
+
children: [
|
|
2124
|
+
busy && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css_modules_entry_default6.spinner, "aria-hidden": "true" }),
|
|
2125
|
+
busy ? t("saving") : t("save")
|
|
2126
|
+
]
|
|
2049
2127
|
}
|
|
2050
2128
|
)
|
|
2051
2129
|
] })
|
|
@@ -2086,7 +2164,10 @@ var QuestionCards = class {
|
|
|
2086
2164
|
ensure(sessionId, questions, callId, settings) {
|
|
2087
2165
|
if (callId !== void 0) {
|
|
2088
2166
|
const existing = this.byCallId(sessionId, callId);
|
|
2089
|
-
if (existing !== void 0)
|
|
2167
|
+
if (existing !== void 0) {
|
|
2168
|
+
if (settings !== void 0) existing.pending.configure(settings);
|
|
2169
|
+
return existing;
|
|
2170
|
+
}
|
|
2090
2171
|
}
|
|
2091
2172
|
return this.#create(new PendingQuestion(sessionId, questions, callId, () => this.keysFor(sessionId), void 0, settings));
|
|
2092
2173
|
}
|
|
@@ -2351,10 +2432,7 @@ function apply(ctx) {
|
|
|
2351
2432
|
name: "tool.call.toolview",
|
|
2352
2433
|
key: "ask_user_question",
|
|
2353
2434
|
locale: NS,
|
|
2354
|
-
// The
|
|
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.
|
|
2435
|
+
// The host already owns this key at priority 0; lower priority shadows it.
|
|
2358
2436
|
priority: -1,
|
|
2359
2437
|
inject: (sessionId) => ({
|
|
2360
2438
|
revealPanel: (callId) => ctx.get("userQuestionPanels")?.reveal(sessionId, callId) ?? false,
|