dsh-mishu 0.6.2 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -33,7 +33,7 @@ __export(index_exports, {
33
33
  module.exports = __toCommonJS(index_exports);
34
34
 
35
35
  // src/client/Board.tsx
36
- var import_react4 = require("react");
36
+ var import_react6 = require("react");
37
37
 
38
38
  // src/client/api.ts
39
39
  async function post(path, body) {
@@ -70,6 +70,10 @@ var settingsApi = {
70
70
  testGithub: (lang) => post("/github/test", { lang }),
71
71
  saveToken: (lang, token) => post("/github/token/save", { lang, token }),
72
72
  deleteToken: (lang) => post("/github/token/delete", { lang }),
73
+ saveNotify: (lang, notify) => post("/notify/save", { lang, notify }),
74
+ testNotify: (lang, channel) => post("/notify/test", { lang, channel }),
75
+ saveFeishu: (lang, webhook, secret) => post("/feishu/save", { lang, webhook, secret }),
76
+ deleteFeishu: (lang) => post("/feishu/delete", { lang }),
73
77
  deviceStart: (lang) => post("/github/device/start", { lang }),
74
78
  deviceStatus: (lang) => post("/github/device/status", { lang }),
75
79
  deviceCancel: (lang) => post("/github/device/cancel", { lang }),
@@ -232,8 +236,41 @@ var zh = {
232
236
  mMore: "\u66F4\u591A\u8BBE\u7F6E",
233
237
  mLength: (label, want, got) => `${label}${/[A-Za-z]$/.test(label) ? " " : ""}\u7684\u6388\u6743\u7801\uFF08\u5E94\u7528\u4E13\u7528\u5BC6\u7801\uFF09\u662F ${want} \u4F4D\uFF0C\u4F60\u586B\u7684\u662F ${got} \u4F4D\uFF0C\u53EF\u80FD\u586B\u6210\u4E86\u767B\u5F55\u5BC6\u7801\u3002`,
234
238
  mSavedUnread: (n) => `\u5DF2\u4FDD\u5B58\u3002\u8FDE\u4E0A\u4E86\uFF0C\u6700\u8FD1\u6709 ${n} \u5C01\u672A\u8BFB\u90AE\u4EF6\u3002`,
235
- sFeishu: "\u98DE\u4E66",
236
- sComing: "\u5373\u5C06\u63A5\u5165",
239
+ bSources: "\u2460 \u5B83\u770B\u54EA\u91CC",
240
+ bSourcesHint: "\u5C0F\u79D8\u4E66\u4ECE\u8FD9\u4E9B\u5730\u65B9\u627E\u8981\u4F60\u5904\u7406\u7684\u4E8B\u3002",
241
+ bWhat: "\u2461 \u4EC0\u4E48\u4E8B\u8981\u544A\u8BC9\u4F60",
242
+ bUrgentRule: "\u8FD9\u4E9B\u7B97\u6025\u4E8B\uFF0C\u4E00\u51FA\u73B0\u5C31\u63D0\u9192\u4F60\uFF1A\u6709\u4EBA\u8BF7\u4F60 review\u3001@ \u4F60\u3001\u628A\u4E8B\u5206\u914D\u7ED9\u4F60\uFF1B\u4F1A\u8BAE\u9080\u8BF7\uFF1B\u4F60\u4EA4\u4EE3\u7684\u4E8B\u5230\u4E86\u5F53\u5929\u6216\u5DF2\u7ECF\u8FC7\u671F\u3002\u5176\u4ED6\u4E8B\u90FD\u653E\u8FDB\u6BCF\u5929\u7684\u7B80\u62A5\u3002",
243
+ bWhen: "\u2462 \u4EC0\u4E48\u65F6\u5019\u3001\u600E\u4E48\u544A\u8BC9\u4F60",
244
+ bDo: "\u2463 \u80FD\u66FF\u4F60\u529E\u4EC0\u4E48",
245
+ bMailReadOnly: "\u90AE\u4EF6\uFF1A\u53EA\u8BFB\u3002\u5C0F\u79D8\u4E66\u4ECE\u4E0D\u66FF\u4F60\u6539\u90AE\u7BB1\u91CC\u7684\u4EFB\u4F55\u4E1C\u897F\uFF0C\u4E5F\u4E0D\u4F1A\u628A\u90AE\u4EF6\u6807\u6210\u5DF2\u8BFB\u3002",
246
+ nBrief: "\u6BCF\u65E5\u7B80\u62A5\uFF0C\u65F6\u95F4",
247
+ nUrgent: "\u6025\u4E8B\u7ACB\u523B\u63D0\u9192",
248
+ nQuiet: "\u514D\u6253\u6270\uFF0C\u4ECE",
249
+ nTo: "\u5230",
250
+ nZone: (zone) => `\u6309 ${zone} \u7684\u65F6\u95F4\u3002\u514D\u6253\u6270\u671F\u95F4\u4E0D\u53D1\uFF0C\u671F\u95F4\u51FA\u73B0\u7684\u6025\u4E8B\u7B49\u7ED3\u675F\u540E\u4E00\u8D77\u53D1\u3002`,
251
+ nChannels: "\u53D1\u5230\u54EA\u91CC",
252
+ nDesktop: "\u7535\u8111\u901A\u77E5",
253
+ nDesktopOn: "\u5728\u8FD9\u53F0\u7535\u8111\u53F3\u4E0A\u89D2\u5F39\u51FA\u901A\u77E5\u3002",
254
+ nFeishu: "\u98DE\u4E66",
255
+ nFeishuOn: "\u53D1\u5230\u4F60\u7684\u98DE\u4E66\u7FA4\uFF0C\u624B\u673A\u4E0A\u4E5F\u80FD\u6536\u5230\u3002",
256
+ nTest: "\u53D1\u4E00\u6761\u8BD5\u8BD5",
257
+ nTestSent: "\u53D1\u51FA\u53BB\u4E86\uFF0C\u770B\u770B\u6536\u5230\u6CA1\u6709",
258
+ nFeishuConnect: "\u8FDE\u4E0A\u98DE\u4E66",
259
+ nFeishuChange: "\u6362\u4E00\u4E2A\u673A\u5668\u4EBA",
260
+ nFeishuRemove: "\u79FB\u9664",
261
+ nFeishuRemoveConfirm: "\u79FB\u9664\u98DE\u4E66\u673A\u5668\u4EBA\uFF1F\u4EE5\u540E\u63D0\u9192\u4E0D\u518D\u53D1\u5230\u98DE\u4E66\u3002",
262
+ nFeishuSaved: "\u98DE\u4E66\u8FDE\u4E0A\u4E86\uFF0C\u7FA4\u91CC\u5E94\u8BE5\u6536\u5230\u4E86\u4E00\u6761\u6D88\u606F\u3002",
263
+ nFeishuSteps: [
264
+ "\u5728\u98DE\u4E66\u91CC\u5EFA\u4E00\u4E2A\u7FA4\uFF0C\u53EA\u62C9\u4F60\u81EA\u5DF1\u4E5F\u884C\u3002",
265
+ '\u6253\u5F00\u7FA4\u8BBE\u7F6E \u2192\u300C\u7FA4\u673A\u5668\u4EBA\u300D\u2192\u300C\u6DFB\u52A0\u673A\u5668\u4EBA\u300D\u2192\u300C\u81EA\u5B9A\u4E49\u673A\u5668\u4EBA\u300D\uFF0C\u540D\u5B57\u586B"\u5C0F\u79D8\u4E66"\u3002',
266
+ '\u5B89\u5168\u8BBE\u7F6E\u9009\u300C\u7B7E\u540D\u6821\u9A8C\u300D\u5E76\u590D\u5236\u5BC6\u94A5\uFF1B\u6216\u8005\u9009\u300C\u81EA\u5B9A\u4E49\u5173\u952E\u8BCD\u300D\uFF0C\u5173\u952E\u8BCD\u586B"\u5C0F\u79D8\u4E66"\u3002',
267
+ "\u70B9\u300C\u6DFB\u52A0\u300D\uFF0C\u590D\u5236\u300CWebhook \u5730\u5740\u300D\uFF0C\u7C98\u8D34\u5230\u4E0B\u9762\u3002"
268
+ ],
269
+ nWebhook: "Webhook \u5730\u5740",
270
+ nSecret: "\u7B7E\u540D\u5BC6\u94A5\uFF08\u9009\u4E86\u7B7E\u540D\u6821\u9A8C\u624D\u586B\uFF09",
271
+ nFeishuPrivacy: "\u63D0\u9192\u7684\u5185\u5BB9\uFF08\u4E8B\u60C5\u7684\u6807\u9898\u548C\u7B80\u77ED\u8BF4\u660E\uFF09\u4F1A\u7ECF\u8FC7\u98DE\u4E66\u7684\u670D\u52A1\u5668\u3002\u5730\u5740\u548C\u5BC6\u94A5\u53EA\u5B58\u5728\u8FD9\u53F0\u7535\u8111\u4E0A\u3002",
272
+ nFeishuTry: "\u8FDE\u4E0A\u5E76\u53D1\u4E00\u6761\u8BD5\u8BD5",
273
+ nLast: (at, kind, results) => `\u4E0A\u6B21\u63D0\u9192\uFF1A${at} ${kind === "brief" ? "\u6BCF\u65E5\u7B80\u62A5" : kind === "urgent" ? "\u6025\u4E8B" : "\u6D4B\u8BD5"}\uFF0C${results.map((r) => `${r.channel === "feishu" ? "\u98DE\u4E66" : "\u7535\u8111\u901A\u77E5"}${r.ok ? "\u5DF2\u9001\u8FBE" : `\u6CA1\u9001\u5230\uFF08${r.error ?? ""}\uFF09`}`).join("\uFF0C")}`,
237
274
  ai: "+AI",
238
275
  aiTitle: "\u5728\u5BF9\u8BDD\u91CC\u95EE AI\uFF1A\u628A\u8FD9\u4EF6\u4E8B\u653E\u8FDB\u4E00\u4E2A\u65B0\u5BF9\u8BDD\u7684\u8F93\u5165\u6846\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u53D1\u9001\uFF0C\u4F60\u770B\u8FC7\u518D\u6309\u53D1\u9001",
239
276
  aiOpened: "\u5DF2\u653E\u8FDB\u65B0\u5BF9\u8BDD\u7684\u8F93\u5165\u6846\uFF0C\u770B\u8FC7\u540E\u6309\u53D1\u9001\u5C31\u884C",
@@ -386,8 +423,41 @@ var en = {
386
423
  mMore: "More settings",
387
424
  mLength: (label, want, got) => `A ${label} app password is ${want} characters; this one is ${got}. It may be your sign-in password instead.`,
388
425
  mSavedUnread: (n) => `Saved. Connected; ${n} unread messages recently.`,
389
- sFeishu: "Feishu / Lark",
390
- sComing: "Coming soon",
426
+ bSources: "1. Where it looks",
427
+ bSourcesHint: "The secretary finds what needs you in these places.",
428
+ bWhat: "2. What to tell you about",
429
+ bUrgentRule: "These are urgent and reach you as they come: a review requested, a mention, an assignment; a meeting invitation; something you told it that is due today or overdue. Everything else goes into the daily brief.",
430
+ bWhen: "3. When and how to tell you",
431
+ bDo: "4. What it may do for you",
432
+ bMailReadOnly: "Mail: read-only. The secretary never changes anything in your mailbox and never marks mail read.",
433
+ nBrief: "Daily brief at",
434
+ nUrgent: "Urgent items right away",
435
+ nQuiet: "Quiet hours from",
436
+ nTo: "to",
437
+ nZone: (zone) => `In ${zone} time. Nothing is sent during quiet hours; urgent items from then come when they end.`,
438
+ nChannels: "Where to send",
439
+ nDesktop: "This computer",
440
+ nDesktopOn: "A notification in the corner of this screen.",
441
+ nFeishu: "Feishu / Lark",
442
+ nFeishuOn: "To your Feishu group, on your phone too.",
443
+ nTest: "Send a test",
444
+ nTestSent: "Sent; check that it arrived",
445
+ nFeishuConnect: "Connect Feishu",
446
+ nFeishuChange: "Use another bot",
447
+ nFeishuRemove: "Remove",
448
+ nFeishuRemoveConfirm: "Remove the Feishu bot? Reminders will no longer go to Feishu.",
449
+ nFeishuSaved: "Feishu is connected; the group should have a message.",
450
+ nFeishuSteps: [
451
+ "Create a Feishu group; just you is fine.",
452
+ 'Group settings \u2192 Bots \u2192 Add bot \u2192 Custom bot; name it "\u5C0F\u79D8\u4E66".',
453
+ 'Under security choose signature verification and copy the secret, or a custom keyword set to "\u5C0F\u79D8\u4E66".',
454
+ "Click Add, copy the webhook address and paste it below."
455
+ ],
456
+ nWebhook: "Webhook address",
457
+ nSecret: "Signing secret (only with signature verification)",
458
+ nFeishuPrivacy: "What reminders say (titles and a short note) passes through Feishu's servers. The address and secret stay on this computer.",
459
+ nFeishuTry: "Connect and send a test",
460
+ nLast: (at, kind, results) => `Last reminder: ${at}, ${kind === "brief" ? "daily brief" : kind === "urgent" ? "urgent" : "test"}; ${results.map((r) => `${r.channel === "feishu" ? "Feishu" : "this computer"} ${r.ok ? "delivered" : `failed (${r.error ?? ""})`}`).join(", ")}`,
391
461
  ai: "+AI",
392
462
  aiTitle: "Ask AI in a chat: puts this into a new chat's input box, unsent; read it, then press send",
393
463
  aiOpened: "Put into a new chat's input box; read it and press send",
@@ -446,14 +516,52 @@ function AskAI({ topic, lang, locale, openChat: openChat2, compact = false }) {
446
516
  }
447
517
 
448
518
  // src/client/Settings.tsx
449
- var import_react3 = require("react");
519
+ var import_react5 = require("react");
450
520
 
451
- // src/client/Modal.tsx
521
+ // src/client/Fold.tsx
452
522
  var import_react2 = require("react");
453
- var import_react_dom = require("react-dom");
454
523
  var import_jsx_runtime2 = require("react/jsx-runtime");
524
+ var FoldCtx = (0, import_react2.createContext)({ open: void 0, toggle: () => {
525
+ } });
526
+ function FoldGroup({ children }) {
527
+ const [open, setOpen] = (0, import_react2.useState)();
528
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FoldCtx.Provider, { value: { open, toggle: (key) => setOpen((current) => current === key ? void 0 : key) }, children });
529
+ }
530
+ function Fold({ id, title, aside, className = "", children }) {
531
+ const parent = (0, import_react2.useContext)(FoldCtx);
532
+ const [inner, setInner] = (0, import_react2.useState)();
533
+ const open = parent.open === id;
534
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `mishu-card mishu-fold${open ? " open" : ""}${className === "" ? "" : ` ${className}`}`, children: [
535
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
536
+ "div",
537
+ {
538
+ className: "mishu-card-head",
539
+ role: "button",
540
+ tabIndex: 0,
541
+ "aria-expanded": open,
542
+ onClick: () => parent.toggle(id),
543
+ onKeyDown: (event) => {
544
+ if (event.key !== "Enter" && event.key !== " ") return;
545
+ event.preventDefault();
546
+ parent.toggle(id);
547
+ },
548
+ children: [
549
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "mishu-caret", "aria-hidden": "true" }),
550
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "mishu-card-title", children: title }),
551
+ aside === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "mishu-card-aside", onClick: (event) => event.stopPropagation(), children: aside })
552
+ ]
553
+ }
554
+ ),
555
+ open ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "mishu-card-body", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FoldCtx.Provider, { value: { open: inner, toggle: (key) => setInner((current) => current === key ? void 0 : key) }, children }) }) : null
556
+ ] });
557
+ }
558
+
559
+ // src/client/Modal.tsx
560
+ var import_react3 = require("react");
561
+ var import_react_dom = require("react-dom");
562
+ var import_jsx_runtime3 = require("react/jsx-runtime");
455
563
  function Modal({ title, onClose, children }) {
456
- (0, import_react2.useEffect)(() => {
564
+ (0, import_react3.useEffect)(() => {
457
565
  const key = (event) => {
458
566
  if (event.key === "Escape") onClose();
459
567
  };
@@ -461,12 +569,12 @@ function Modal({ title, onClose, children }) {
461
569
  return () => window.removeEventListener("keydown", key);
462
570
  }, [onClose]);
463
571
  return (0, import_react_dom.createPortal)(
464
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "mishu-modal-backdrop", onMouseDown: (event) => {
572
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-modal-backdrop", onMouseDown: (event) => {
465
573
  if (event.target === event.currentTarget) onClose();
466
- }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "mishu-modal", role: "dialog", "aria-modal": "true", "aria-label": title, children: [
467
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "mishu-modal-head", children: [
468
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: title }),
469
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", "aria-label": "\xD7", onClick: onClose, children: "\xD7" })
574
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-modal", role: "dialog", "aria-modal": "true", "aria-label": title, children: [
575
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-modal-head", children: [
576
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { children: title }),
577
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", "aria-label": "\xD7", onClick: onClose, children: "\xD7" })
470
578
  ] }),
471
579
  children
472
580
  ] }) }),
@@ -474,19 +582,167 @@ function Modal({ title, onClose, children }) {
474
582
  );
475
583
  }
476
584
 
585
+ // src/client/Notify.tsx
586
+ var import_react4 = require("react");
587
+ var import_jsx_runtime4 = require("react/jsx-runtime");
588
+ var browserZone = () => {
589
+ try {
590
+ return Intl.DateTimeFormat().resolvedOptions().timeZone ?? "";
591
+ } catch {
592
+ return "";
593
+ }
594
+ };
595
+ function NotifySection({ view, lang, locale, take }) {
596
+ const t = TEXT[lang];
597
+ const notify = view.notify.settings;
598
+ const [tested, setTested] = (0, import_react4.useState)({});
599
+ const [feishuOpen, setFeishuOpen] = (0, import_react4.useState)(false);
600
+ const save = async (patch) => take(await settingsApi.saveNotify(locale(), patch), t.sSaved);
601
+ (0, import_react4.useEffect)(() => {
602
+ const zone = browserZone();
603
+ if (notify.timeZone === "" && zone !== "") void settingsApi.saveNotify(locale(), { timeZone: zone }).then((r) => take(r));
604
+ }, [notify.timeZone, locale]);
605
+ const test = async (channel) => {
606
+ setTested({ ...tested, [channel]: { ok: true, text: t.sTesting } });
607
+ const r = await settingsApi.testNotify(locale(), channel);
608
+ setTested({ ...tested, [channel]: r.ok ? { ok: true, text: t.nTestSent } : { ok: false, text: r.message } });
609
+ };
610
+ const time = (value, onChange) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "time", step: 60, value, onChange: (e) => {
611
+ if (e.target.value !== "") onChange(e.target.value);
612
+ } });
613
+ const last = view.notify.last;
614
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
615
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-notify-row", children: [
616
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-check", children: [
617
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "checkbox", checked: notify.brief.enabled, onChange: (e) => {
618
+ void save({ brief: { ...notify.brief, enabled: e.target.checked } });
619
+ } }),
620
+ t.nBrief
621
+ ] }),
622
+ time(notify.brief.time, (value) => {
623
+ void save({ brief: { ...notify.brief, time: value } });
624
+ })
625
+ ] }),
626
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-notify-row", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-check", children: [
627
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "checkbox", checked: notify.urgent, onChange: (e) => {
628
+ void save({ urgent: e.target.checked });
629
+ } }),
630
+ t.nUrgent
631
+ ] }) }),
632
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-notify-row", children: [
633
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-check", children: [
634
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "checkbox", checked: notify.quiet.enabled, onChange: (e) => {
635
+ void save({ quiet: { ...notify.quiet, enabled: e.target.checked } });
636
+ } }),
637
+ t.nQuiet
638
+ ] }),
639
+ time(notify.quiet.from, (value) => {
640
+ void save({ quiet: { ...notify.quiet, from: value } });
641
+ }),
642
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "mishu-hint", children: t.nTo }),
643
+ time(notify.quiet.to, (value) => {
644
+ void save({ quiet: { ...notify.quiet, to: value } });
645
+ })
646
+ ] }),
647
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-hint", children: t.nZone(notify.timeZone || browserZone()) }),
648
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { children: t.nChannels }),
649
+ view.notify.channels.map((channel) => {
650
+ const result = tested[channel.id];
651
+ const feishu = channel.id === "feishu";
652
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
653
+ Fold,
654
+ {
655
+ id: `channel-${channel.id}`,
656
+ title: feishu ? t.nFeishu : t.nDesktop,
657
+ aside: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { className: "mishu-check mishu-check-inline", title: channel.available ? void 0 : channel.why, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
658
+ "input",
659
+ {
660
+ type: "checkbox",
661
+ checked: channel.enabled,
662
+ disabled: !channel.available,
663
+ onChange: (e) => {
664
+ void save({ channels: { ...notify.channels, [channel.id]: e.target.checked } });
665
+ }
666
+ }
667
+ ) }),
668
+ children: [
669
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: `mishu-card-note ${channel.available ? "" : "mishu-warn"}`, children: channel.available ? feishu ? t.nFeishuOn : t.nDesktopOn : channel.why }),
670
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-actions", children: [
671
+ channel.available ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => {
672
+ void test(channel.id);
673
+ }, children: t.nTest }) : null,
674
+ feishu ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: view.notify.feishu.configured ? "mishu-btn" : "mishu-btn primary", onClick: () => setFeishuOpen(true), children: view.notify.feishu.configured ? t.nFeishuChange : t.nFeishuConnect }) : null,
675
+ feishu && view.notify.feishu.configured ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", onClick: () => {
676
+ if (window.confirm(t.nFeishuRemoveConfirm)) void settingsApi.deleteFeishu(locale()).then((r) => take(r));
677
+ }, children: t.nFeishuRemove }) : null,
678
+ result === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: result.ok ? "mishu-hint" : "mishu-hint mishu-danger", children: result.text })
679
+ ] })
680
+ ]
681
+ },
682
+ channel.id
683
+ );
684
+ }),
685
+ last === null ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-hint", children: t.nLast(new Date(last.at).toLocaleString(), last.kind, last.results) }),
686
+ feishuOpen ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FeishuDialog, { lang, locale, onDone: (next) => {
687
+ setFeishuOpen(false);
688
+ if (next !== void 0) take({ ok: true, view: next }, t.nFeishuSaved);
689
+ } }) : null
690
+ ] });
691
+ }
692
+ function FeishuDialog({ lang, locale, onDone }) {
693
+ const t = TEXT[lang];
694
+ const [webhook, setWebhook] = (0, import_react4.useState)("");
695
+ const [secret, setSecret] = (0, import_react4.useState)("");
696
+ const [busy, setBusy] = (0, import_react4.useState)(false);
697
+ const [error, setError] = (0, import_react4.useState)();
698
+ const connect = async () => {
699
+ setBusy(true);
700
+ setError(void 0);
701
+ const r = await settingsApi.saveFeishu(locale(), webhook, secret);
702
+ setBusy(false);
703
+ if (r.ok) onDone(r.view);
704
+ else setError(r.message);
705
+ };
706
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Modal, { title: t.nFeishuConnect, onClose: () => onDone(), children: [
707
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-steps", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ol", { children: t.nFeishuSteps.map((step, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { children: step }, i)) }) }),
708
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
709
+ t.nWebhook,
710
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { value: webhook, autoComplete: "off", spellCheck: false, placeholder: "https://open.feishu.cn/open-apis/bot/v2/hook/\u2026", onChange: (e) => {
711
+ setWebhook(e.target.value);
712
+ setError(void 0);
713
+ } })
714
+ ] }),
715
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
716
+ t.nSecret,
717
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "password", value: secret, autoComplete: "off", spellCheck: false, onChange: (e) => {
718
+ setSecret(e.target.value);
719
+ setError(void 0);
720
+ } })
721
+ ] }),
722
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-hint", children: t.nFeishuPrivacy }),
723
+ error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-preview mishu-danger", children: error }),
724
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-actions", children: [
725
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn primary", disabled: busy || webhook.trim() === "", onClick: () => {
726
+ void connect();
727
+ }, children: busy ? t.sTesting : t.nFeishuTry }),
728
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => onDone(), children: t.sCancel })
729
+ ] })
730
+ ] });
731
+ }
732
+
477
733
  // src/client/Settings.tsx
478
- var import_jsx_runtime3 = require("react/jsx-runtime");
734
+ var import_jsx_runtime5 = require("react/jsx-runtime");
479
735
  var CATEGORIES = ["document", "bill", "birthday", "renewal", "other"];
480
736
  function MishuSettings({ lang, locale, openChat: openChat2 }) {
481
737
  const t = TEXT[lang];
482
- const [view, setView] = (0, import_react3.useState)();
483
- const [error, setError] = (0, import_react3.useState)();
484
- const [note, setNote] = (0, import_react3.useState)();
485
- const [lead, setLead] = (0, import_react3.useState)({});
486
- const [githubTest, setGithubTest] = (0, import_react3.useState)();
487
- const [confirmOn, setConfirmOn] = (0, import_react3.useState)(false);
488
- const [pasting, setPasting] = (0, import_react3.useState)(false);
489
- const [editing, setEditing] = (0, import_react3.useState)();
738
+ const [view, setView] = (0, import_react5.useState)();
739
+ const [error, setError] = (0, import_react5.useState)();
740
+ const [note, setNote] = (0, import_react5.useState)();
741
+ const [lead, setLead] = (0, import_react5.useState)({});
742
+ const [githubTest, setGithubTest] = (0, import_react5.useState)();
743
+ const [confirmOn, setConfirmOn] = (0, import_react5.useState)(false);
744
+ const [pasting, setPasting] = (0, import_react5.useState)(false);
745
+ const [editing, setEditing] = (0, import_react5.useState)();
490
746
  const take = (result, saved) => {
491
747
  if (result.ok) {
492
748
  setView(result.view);
@@ -497,11 +753,11 @@ function MishuSettings({ lang, locale, openChat: openChat2 }) {
497
753
  setError(result.message);
498
754
  }
499
755
  };
500
- (0, import_react3.useEffect)(() => {
756
+ (0, import_react5.useEffect)(() => {
501
757
  void settingsApi.load(locale()).then((r) => take(r));
502
758
  }, [locale]);
503
759
  if (view === void 0) {
504
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-settings", children: error === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mishu-empty", children: t.loading }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-error", children: [
760
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-settings", children: error === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-empty", children: t.loading }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-error", children: [
505
761
  t.failed,
506
762
  error
507
763
  ] }) });
@@ -509,92 +765,71 @@ function MishuSettings({ lang, locale, openChat: openChat2 }) {
509
765
  const save = async (settings) => take(await settingsApi.save(locale(), settings), t.sSaved);
510
766
  const token = view.github.token;
511
767
  const secretKind = t.secretKinds[view.secrets.kind] ?? view.secrets.kind;
512
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-settings", children: [
513
- error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-error", children: [
768
+ const markRead = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
769
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
770
+ t.sMarkRead,
771
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { value: view.settings.markRead, onChange: (e) => {
772
+ const value = e.target.value;
773
+ if (value === "on") setConfirmOn(true);
774
+ else void save({ markRead: value });
775
+ }, children: [
776
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "off", children: t.sMarkOff }),
777
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "shadow", children: t.sMarkShadow }),
778
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "on", children: t.sMarkOn })
779
+ ] })
780
+ ] }),
781
+ confirmOn ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-banner", children: [
782
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: t.sMarkConfirm }),
783
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-actions", children: [
784
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => {
785
+ setConfirmOn(false);
786
+ void save({ markRead: "on" });
787
+ }, children: t.sConfirm }),
788
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => setConfirmOn(false), children: t.sCancel })
789
+ ] })
790
+ ] }) : null
791
+ ] });
792
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FoldGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-settings", children: [
793
+ error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-error", children: [
514
794
  t.failed,
515
795
  error
516
796
  ] }),
517
- note === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-ok", children: note }),
518
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "mishu-panel", children: [
519
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { children: t.sGeneral }),
520
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-field", children: [
521
- t.sLanguage,
522
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("select", { value: view.settings.language, onChange: (e) => {
523
- void save({ language: e.target.value });
524
- }, children: [
525
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "auto", children: t.sLanguageAuto }),
526
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "zh", children: "\u4E2D\u6587" }),
527
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "en", children: "English" })
528
- ] })
529
- ] }),
530
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-field", children: t.sLead }),
531
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-grid5", children: CATEGORIES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-field", children: [
532
- t.categories[c],
533
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "number", min: 0, max: 366, value: lead[c] ?? 0, onChange: (e) => setLead({ ...lead, [c]: Number(e.target.value) }) })
534
- ] }, c)) }),
535
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => {
536
- void save({ leadDays: lead });
537
- }, children: t.sSave })
538
- ] }),
539
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "mishu-panel", children: [
540
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { children: t.sGithub }),
541
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-check", children: [
542
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "checkbox", checked: view.settings.githubEnabled, onChange: (e) => {
797
+ note === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-ok", children: note }),
798
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Fold, { id: "sources", className: "mishu-panel", title: t.bSources, children: [
799
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-hint", children: t.bSourcesHint }),
800
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { children: t.sGithub }),
801
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-check", children: [
802
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "checkbox", checked: view.settings.githubEnabled, onChange: (e) => {
543
803
  void save({ githubEnabled: e.target.checked });
544
804
  } }),
545
805
  t.sGithubOn
546
806
  ] }),
547
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-row-explain", children: [
548
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "mishu-row-label", children: t.sToken }),
549
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: token.found ? "" : "mishu-danger", children: token.found ? token.from === "env" ? t.sTokenEnv(view.github.tokenEnv) : token.from === "keychain" ? t.sTokenKeychain : t.sTokenGh : token.text })
807
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-row-explain", children: [
808
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "mishu-row-label", children: t.sToken }),
809
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: token.found ? "" : "mishu-danger", children: token.found ? token.from === "env" ? t.sTokenEnv(view.github.tokenEnv) : token.from === "keychain" ? t.sTokenKeychain : t.sTokenGh : token.text })
550
810
  ] }),
551
- token.found ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-actions", children: [
552
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => {
811
+ token.found ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-actions", children: [
812
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => {
553
813
  setGithubTest(t.sTesting);
554
814
  void settingsApi.testGithub(locale()).then((r) => setGithubTest(r.ok ? t.sGithubOk(r.login) : `${t.failed}${r.message}`));
555
815
  }, children: t.sTest }),
556
- token.from === "env" || pasting ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => setPasting(true), children: t.sTokenReplace }),
557
- token.from === "keychain" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", onClick: () => {
816
+ token.from === "env" || pasting ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => setPasting(true), children: t.sTokenReplace }),
817
+ token.from === "keychain" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", onClick: () => {
558
818
  if (window.confirm(t.sTokenRemoveConfirm)) void settingsApi.deleteToken(locale()).then((r) => {
559
819
  setGithubTest(void 0);
560
820
  take(r);
561
821
  });
562
822
  }, children: t.sTokenRemove }) : null,
563
- githubTest === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "mishu-hint", children: githubTest })
823
+ githubTest === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "mishu-hint", children: githubTest })
564
824
  ] }) : null,
565
- !token.found || pasting ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GithubConnect, { view, lang, locale, onSaved: (next, login) => {
825
+ !token.found || pasting ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(GithubConnect, { view, lang, locale, onSaved: (next, login) => {
566
826
  setPasting(false);
567
827
  setGithubTest(t.sTokenSaved(login));
568
828
  take({ ok: true, view: next });
569
829
  }, onCancel: token.found ? () => setPasting(false) : void 0 }) : null,
570
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-field", children: [
571
- t.sMarkRead,
572
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("select", { value: view.settings.markRead, onChange: (e) => {
573
- const value = e.target.value;
574
- if (value === "on") setConfirmOn(true);
575
- else void save({ markRead: value });
576
- }, children: [
577
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "off", children: t.sMarkOff }),
578
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "shadow", children: t.sMarkShadow }),
579
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "on", children: t.sMarkOn })
580
- ] })
581
- ] }),
582
- confirmOn ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-banner", children: [
583
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: t.sMarkConfirm }),
584
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-actions", children: [
585
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => {
586
- setConfirmOn(false);
587
- void save({ markRead: "on" });
588
- }, children: t.sConfirm }),
589
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => setConfirmOn(false), children: t.sCancel })
590
- ] })
591
- ] }) : null
592
- ] }),
593
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "mishu-panel", children: [
594
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { children: t.sMail }),
595
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mishu-hint", children: t.sMailPrivacy }),
596
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: view.secrets.available && view.secrets.file === void 0 ? "mishu-hint" : "mishu-hint mishu-warn", children: !view.secrets.available ? t.sSecretsNone(view.secrets.why ?? secretKind) : view.secrets.file !== void 0 ? t.sSecretsFile(view.secrets.file.path, view.secrets.file.why) : t.sSecretsAt(secretKind) }),
597
- view.accounts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mishu-empty", children: t.sNoAccounts }) : view.accounts.map((account) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
830
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { children: t.sMail }),
831
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-hint", children: t.sMailPrivacy }),
832
+ view.accounts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-empty", children: t.sNoAccounts }) : view.accounts.map((account) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
598
833
  AccountRow,
599
834
  {
600
835
  account,
@@ -607,8 +842,8 @@ function MishuSettings({ lang, locale, openChat: openChat2 }) {
607
842
  },
608
843
  account.id
609
844
  )),
610
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn mishu-add-toggle", onClick: () => setEditing({ preset: "custom", sinceDays: 14, enabled: true }), children: t.sAddAccount }),
611
- editing === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
845
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn mishu-add-toggle", onClick: () => setEditing({ preset: "custom", sinceDays: 14, enabled: true }), children: t.sAddAccount }),
846
+ editing === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
612
847
  MailDialog,
613
848
  {
614
849
  draft: editing,
@@ -623,25 +858,50 @@ function MishuSettings({ lang, locale, openChat: openChat2 }) {
623
858
  }
624
859
  )
625
860
  ] }),
626
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "mishu-panel", children: [
627
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { children: t.sFeishu }),
628
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mishu-hint", children: t.sComing })
861
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Fold, { id: "what", className: "mishu-panel", title: t.bWhat, children: [
862
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-hint", children: t.bUrgentRule }),
863
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-field", children: t.sLead }),
864
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-grid5", children: CATEGORIES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
865
+ t.categories[c],
866
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "number", min: 0, max: 366, value: lead[c] ?? 0, onChange: (e) => setLead({ ...lead, [c]: Number(e.target.value) }) })
867
+ ] }, c)) }),
868
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => {
869
+ void save({ leadDays: lead });
870
+ }, children: t.sSave })
871
+ ] }),
872
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Fold, { id: "when", className: "mishu-panel", title: t.bWhen, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(NotifySection, { view, lang, locale, take }) }),
873
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Fold, { id: "do", className: "mishu-panel", title: t.bDo, children: [
874
+ markRead,
875
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-hint", children: t.bMailReadOnly })
876
+ ] }),
877
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Fold, { id: "general", className: "mishu-panel", title: t.sGeneral, children: [
878
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
879
+ t.sLanguage,
880
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { value: view.settings.language, onChange: (e) => {
881
+ void save({ language: e.target.value });
882
+ }, children: [
883
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "auto", children: t.sLanguageAuto }),
884
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "zh", children: "\u4E2D\u6587" }),
885
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "en", children: "English" })
886
+ ] })
887
+ ] }),
888
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: view.secrets.available && view.secrets.file === void 0 ? "mishu-hint" : "mishu-hint mishu-warn", children: !view.secrets.available ? t.sSecretsNone(view.secrets.why ?? secretKind) : view.secrets.file !== void 0 ? t.sSecretsFile(view.secrets.file.path, view.secrets.file.why) : t.sSecretsAt(secretKind) })
629
889
  ] })
630
- ] });
890
+ ] }) });
631
891
  }
632
892
  function GithubConnect({ view, lang, locale, onSaved, onCancel }) {
633
893
  const t = TEXT[lang];
634
- const [signingIn, setSigningIn] = (0, import_react3.useState)(false);
635
- const [paste, setPaste] = (0, import_react3.useState)(!view.github.deviceLogin);
636
- if (!view.github.deviceLogin) return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TokenForm, { view, lang, locale, onSaved, onCancel });
637
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
638
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-actions", children: [
639
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => setSigningIn(true), children: t.gLogin }),
640
- paste ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", onClick: () => setPaste(true), children: t.gPasteInstead }),
641
- onCancel === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn", onClick: onCancel, children: t.sCancel })
894
+ const [signingIn, setSigningIn] = (0, import_react5.useState)(false);
895
+ const [paste, setPaste] = (0, import_react5.useState)(!view.github.deviceLogin);
896
+ if (!view.github.deviceLogin) return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TokenForm, { view, lang, locale, onSaved, onCancel });
897
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
898
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-actions", children: [
899
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => setSigningIn(true), children: t.gLogin }),
900
+ paste ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", onClick: () => setPaste(true), children: t.gPasteInstead }),
901
+ onCancel === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", onClick: onCancel, children: t.sCancel })
642
902
  ] }),
643
- paste ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TokenForm, { view, lang, locale, onSaved, onCancel: void 0 }) : null,
644
- signingIn ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GithubLoginDialog, { lang, locale, onClose: () => setSigningIn(false), onSaved: (next, login) => {
903
+ paste ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TokenForm, { view, lang, locale, onSaved, onCancel: void 0 }) : null,
904
+ signingIn ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(GithubLoginDialog, { lang, locale, onClose: () => setSigningIn(false), onSaved: (next, login) => {
645
905
  setSigningIn(false);
646
906
  onSaved(next, login);
647
907
  } }) : null
@@ -649,12 +909,12 @@ function GithubConnect({ view, lang, locale, onSaved, onCancel }) {
649
909
  }
650
910
  function GithubLoginDialog({ lang, locale, onClose, onSaved }) {
651
911
  const t = TEXT[lang];
652
- const [login, setLogin] = (0, import_react3.useState)();
653
- const [error, setError] = (0, import_react3.useState)();
654
- const [copied, setCopied] = (0, import_react3.useState)(false);
655
- const [attempt, setAttempt] = (0, import_react3.useState)(0);
656
- const saved = (0, import_react3.useRef)(void 0);
657
- (0, import_react3.useEffect)(() => {
912
+ const [login, setLogin] = (0, import_react5.useState)();
913
+ const [error, setError] = (0, import_react5.useState)();
914
+ const [copied, setCopied] = (0, import_react5.useState)(false);
915
+ const [attempt, setAttempt] = (0, import_react5.useState)(0);
916
+ const saved = (0, import_react5.useRef)(void 0);
917
+ (0, import_react5.useEffect)(() => {
658
918
  let alive = true;
659
919
  let timer;
660
920
  setLogin(void 0);
@@ -698,42 +958,42 @@ function GithubLoginDialog({ lang, locale, onClose, onSaved }) {
698
958
  const copy2 = (code) => {
699
959
  void navigator.clipboard?.writeText(code).then(() => setCopied(true), () => setCopied(false));
700
960
  };
701
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Modal, { title: t.gLogin, onClose: close, children: error !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
702
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-preview mishu-danger", children: error }),
703
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-actions", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn", onClick: close, children: t.gClose }) })
704
- ] }) : login === void 0 || login.state === "idle" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mishu-hint", children: t.gStarting }) : login.state === "waiting" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
705
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-field", children: t.gStep1 }),
706
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-code-row", children: [
707
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("code", { className: "mishu-code", children: login.userCode }),
708
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => copy2(login.userCode), children: copied ? t.gCopied : t.gCopy })
961
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Modal, { title: t.gLogin, onClose: close, children: error !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
962
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-preview mishu-danger", children: error }),
963
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-actions", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", onClick: close, children: t.gClose }) })
964
+ ] }) : login === void 0 || login.state === "idle" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-hint", children: t.gStarting }) : login.state === "waiting" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
965
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-field", children: t.gStep1 }),
966
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-code-row", children: [
967
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("code", { className: "mishu-code", children: login.userCode }),
968
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => copy2(login.userCode), children: copied ? t.gCopied : t.gCopy })
709
969
  ] }),
710
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-field", children: t.gStep2 }),
711
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-actions", children: [
712
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => window.open(login.verificationUri, "_blank", "noopener"), children: t.gOpen }),
713
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "mishu-hint", children: t.gWaiting })
970
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-field", children: t.gStep2 }),
971
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-actions", children: [
972
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => window.open(login.verificationUri, "_blank", "noopener"), children: t.gOpen }),
973
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "mishu-hint", children: t.gWaiting })
714
974
  ] }),
715
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mishu-hint", children: t.gScopes })
716
- ] }) : login.state === "done" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
717
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-ok", children: t.gDone(login.login) }),
718
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-actions", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: close, children: t.gClose }) })
719
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
720
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-preview mishu-danger", children: login.message }),
721
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-actions", children: [
722
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => {
975
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-hint", children: t.gScopes })
976
+ ] }) : login.state === "done" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
977
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-ok", children: t.gDone(login.login) }),
978
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-actions", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: close, children: t.gClose }) })
979
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
980
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-preview mishu-danger", children: login.message }),
981
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-actions", children: [
982
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn primary", onClick: () => {
723
983
  setCopied(false);
724
984
  setAttempt(attempt + 1);
725
985
  }, children: t.gRetry }),
726
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn", onClick: close, children: t.gClose })
986
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", onClick: close, children: t.gClose })
727
987
  ] })
728
988
  ] }) });
729
989
  }
730
990
  function TokenForm({ view, lang, locale, onSaved, onCancel }) {
731
991
  const t = TEXT[lang];
732
- const [token, setToken] = (0, import_react3.useState)("");
733
- const [busy, setBusy] = (0, import_react3.useState)(false);
734
- const [message, setMessage] = (0, import_react3.useState)();
992
+ const [token, setToken] = (0, import_react5.useState)("");
993
+ const [busy, setBusy] = (0, import_react5.useState)(false);
994
+ const [message, setMessage] = (0, import_react5.useState)();
735
995
  if (!view.secrets.available) {
736
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mishu-hint mishu-warn", children: t.sTokenNoKeychain(view.github.tokenEnv, view.secrets.why ?? "") });
996
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-hint mishu-warn", children: t.sTokenNoKeychain(view.github.tokenEnv, view.secrets.why ?? "") });
737
997
  }
738
998
  const save = async () => {
739
999
  setBusy(true);
@@ -747,58 +1007,54 @@ function TokenForm({ view, lang, locale, onSaved, onCancel }) {
747
1007
  setMessage(r.message);
748
1008
  }
749
1009
  };
750
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-add", children: [
751
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-field", children: [
1010
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-add", children: [
1011
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
752
1012
  t.sTokenPaste,
753
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "password", value: token, autoComplete: "off", spellCheck: false, placeholder: "ghp_\u2026", onChange: (e) => {
1013
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "password", value: token, autoComplete: "off", spellCheck: false, placeholder: "ghp_\u2026", onChange: (e) => {
754
1014
  setToken(e.target.value);
755
1015
  setMessage(void 0);
756
1016
  } })
757
1017
  ] }),
758
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mishu-hint", children: t.sTokenHow }),
759
- message === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-preview mishu-danger", children: message }),
760
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-actions", children: [
761
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => window.open(view.github.newTokenUrl, "_blank", "noopener"), children: t.sTokenNew }),
762
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn primary", disabled: busy || token.trim() === "", onClick: () => {
1018
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-hint", children: t.sTokenHow }),
1019
+ message === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-preview mishu-danger", children: message }),
1020
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-actions", children: [
1021
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => window.open(view.github.newTokenUrl, "_blank", "noopener"), children: t.sTokenNew }),
1022
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn primary", disabled: busy || token.trim() === "", onClick: () => {
763
1023
  void save();
764
1024
  }, children: busy ? t.sTesting : t.sTokenSave }),
765
- onCancel === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn", onClick: onCancel, children: t.sCancel })
1025
+ onCancel === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", onClick: onCancel, children: t.sCancel })
766
1026
  ] })
767
1027
  ] });
768
1028
  }
769
1029
  function AccountRow({ account, secretsOk, lang, locale, openChat: openChat2, onEdit, onView }) {
770
1030
  const t = TEXT[lang];
771
- const [busy, setBusy] = (0, import_react3.useState)(false);
1031
+ const [busy, setBusy] = (0, import_react5.useState)(false);
772
1032
  const report = account.report;
773
1033
  const status = !account.hasPassword ? secretsOk ? t.sNoPassword : t.sEnvHint(account.envName) : report === null ? t.sNeverChecked : report.error !== void 0 ? report.error[lang] : lang === "zh" ? `${new Date(report.at).toLocaleString()} \u6536\u4FE1\uFF0C${report.messages} \u5C01\u672A\u8BFB` : `checked ${new Date(report.at).toLocaleString()}, ${report.messages} unread`;
774
1034
  const failed = !account.hasPassword || report?.error !== void 0;
775
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-card", children: [
776
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-card-title", children: [
777
- account.label,
778
- account.enabled ? "" : ` (${lang === "zh" ? "\u5DF2\u505C\u7528" : "disabled"})`
779
- ] }),
780
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-card-meta", children: [
1035
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Fold, { id: `account-${account.id}`, title: `${account.label}${account.enabled ? "" : ` (${lang === "zh" ? "\u5DF2\u505C\u7528" : "disabled"})`}`, children: [
1036
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-card-meta", children: [
781
1037
  account.address,
782
1038
  " \xB7 ",
783
1039
  account.host,
784
1040
  ":",
785
1041
  account.port
786
1042
  ] }),
787
- account.mismatch === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mishu-card-note mishu-warn", children: account.mismatch }),
788
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: `mishu-card-note ${failed ? "mishu-danger" : ""}`, children: [
1043
+ account.mismatch === null ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mishu-card-note mishu-warn", children: account.mismatch }),
1044
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `mishu-card-note ${failed ? "mishu-danger" : ""}`, children: [
789
1045
  status,
790
- account.hasPassword && report?.error !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AskAI, { topic: { kind: "mail-error", accountId: account.id }, lang, locale, openChat: openChat2, compact: true }) : null
1046
+ account.hasPassword && report?.error !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AskAI, { topic: { kind: "mail-error", accountId: account.id }, lang, locale, openChat: openChat2, compact: true }) : null
791
1047
  ] }),
792
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-actions", children: [
793
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn", disabled: busy || !account.hasPassword, onClick: () => {
1048
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-actions", children: [
1049
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", disabled: busy || !account.hasPassword, onClick: () => {
794
1050
  setBusy(true);
795
1051
  void settingsApi.syncMail(locale(), account.id).then((r) => {
796
1052
  setBusy(false);
797
1053
  onView(r);
798
1054
  });
799
1055
  }, children: busy ? t.sTesting : t.sCheckNow }),
800
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: account.hasPassword && account.mismatch === null ? "mishu-btn" : "mishu-btn primary", onClick: onEdit, children: t.sEdit }),
801
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", onClick: () => {
1056
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: account.hasPassword && account.mismatch === null ? "mishu-btn" : "mishu-btn primary", onClick: onEdit, children: t.sEdit }),
1057
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", onClick: () => {
802
1058
  if (window.confirm(t.sDeleteConfirm)) void settingsApi.deleteMail(locale(), account.id).then(onView);
803
1059
  }, children: t.sDelete })
804
1060
  ] })
@@ -807,12 +1063,12 @@ function AccountRow({ account, secretsOk, lang, locale, openChat: openChat2, onE
807
1063
  function MailDialog({ draft, view, lang, locale, openChat: openChat2, onDone }) {
808
1064
  const t = TEXT[lang];
809
1065
  const existing = draft.id !== void 0;
810
- const [account, setAccount] = (0, import_react3.useState)(draft);
811
- const [picked, setPicked] = (0, import_react3.useState)(existing);
812
- const [password, setPassword] = (0, import_react3.useState)("");
813
- const [message, setMessage] = (0, import_react3.useState)();
814
- const [failedTest, setFailedTest] = (0, import_react3.useState)(false);
815
- const [busy, setBusy] = (0, import_react3.useState)(false);
1066
+ const [account, setAccount] = (0, import_react5.useState)(draft);
1067
+ const [picked, setPicked] = (0, import_react5.useState)(existing);
1068
+ const [password, setPassword] = (0, import_react5.useState)("");
1069
+ const [message, setMessage] = (0, import_react5.useState)();
1070
+ const [failedTest, setFailedTest] = (0, import_react5.useState)(false);
1071
+ const [busy, setBusy] = (0, import_react5.useState)(false);
816
1072
  const preset = view.presets.find((p) => p.id === account.preset) ?? view.presets[view.presets.length - 1];
817
1073
  const custom = preset.id === "custom";
818
1074
  const set = (patch) => {
@@ -845,93 +1101,93 @@ function MailDialog({ draft, view, lang, locale, openChat: openChat2, onDone })
845
1101
  setMessage({ ok: false, text: r.message });
846
1102
  }
847
1103
  };
848
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Modal, { title: existing ? t.mTitleEdit : t.mTitleAdd, onClose: () => onDone(), children: [
849
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-field", children: [
1104
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Modal, { title: existing ? t.mTitleEdit : t.mTitleAdd, onClose: () => onDone(), children: [
1105
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
850
1106
  t.sAddress,
851
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "email", value: account.address ?? "", autoComplete: "off", autoFocus: !existing, onChange: (e) => setAddress(e.target.value) })
1107
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "email", value: account.address ?? "", autoComplete: "off", autoFocus: !existing, onChange: (e) => setAddress(e.target.value) })
852
1108
  ] }),
853
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-field", children: [
1109
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
854
1110
  t.sProvider,
855
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("select", { value: account.preset, onChange: (e) => {
1111
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("select", { value: account.preset, onChange: (e) => {
856
1112
  setPicked(true);
857
1113
  set({ preset: e.target.value });
858
- }, children: view.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: p.id, children: p.label }, p.id)) })
1114
+ }, children: view.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: p.id, children: p.label }, p.id)) })
859
1115
  ] }),
860
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: `mishu-steps${preset.supported ? "" : " mishu-danger"}${failedTest ? " attention" : ""}`, children: [
861
- preset.steps.length === 0 ? preset.howTo : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ol", { children: preset.steps.map((step, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { children: [
1116
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `mishu-steps${preset.supported ? "" : " mishu-danger"}${failedTest ? " attention" : ""}`, children: [
1117
+ preset.steps.length === 0 ? preset.howTo : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ol", { children: preset.steps.map((step, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("li", { children: [
862
1118
  step.text,
863
- step.link === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1119
+ step.link === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
864
1120
  " ",
865
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => window.open(step.link.url, "_blank", "noopener"), children: step.link.label })
1121
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => window.open(step.link.url, "_blank", "noopener"), children: step.link.label })
866
1122
  ] })
867
1123
  ] }, i)) }),
868
- preset.supported ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-steps-help", children: [
1124
+ preset.supported ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-steps-help", children: [
869
1125
  t.mStepsHelp,
870
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AskAI, { topic: { kind: "mail-setup", preset: preset.id }, lang, locale, openChat: openChat2, compact: true })
1126
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AskAI, { topic: { kind: "mail-setup", preset: preset.id }, lang, locale, openChat: openChat2, compact: true })
871
1127
  ] }) : null
872
1128
  ] }),
873
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-field", children: [
1129
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
874
1130
  t.sPassword,
875
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "password", value: password, autoComplete: "new-password", placeholder: existing && view.secrets.available ? t.sPasswordKeep : "", onChange: (e) => {
1131
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "password", value: password, autoComplete: "new-password", placeholder: existing && view.secrets.available ? t.sPasswordKeep : "", onChange: (e) => {
876
1132
  setPassword(e.target.value);
877
1133
  setMessage(void 0);
878
1134
  setFailedTest(false);
879
1135
  } })
880
1136
  ] }),
881
- lengthOff ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mishu-hint mishu-warn", children: t.mLength(preset.label, preset.passwordLength, typed.length) }) : null,
882
- view.secrets.available ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mishu-hint mishu-warn", children: t.sPasswordTestOnly }),
883
- custom ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-row", children: [
884
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-field", children: [
1137
+ lengthOff ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-hint mishu-warn", children: t.mLength(preset.label, preset.passwordLength, typed.length) }) : null,
1138
+ view.secrets.available ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "mishu-hint mishu-warn", children: t.sPasswordTestOnly }),
1139
+ custom ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-row", children: [
1140
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
885
1141
  t.sHost,
886
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { value: account.host ?? "", placeholder: "imap.example.com", onChange: (e) => set({ host: e.target.value }) })
1142
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { value: account.host ?? "", placeholder: "imap.example.com", onChange: (e) => set({ host: e.target.value }) })
887
1143
  ] }),
888
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-field", children: [
1144
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
889
1145
  t.sPort,
890
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "number", value: account.port ?? 993, onChange: (e) => set({ port: Number(e.target.value) }) })
1146
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "number", value: account.port ?? 993, onChange: (e) => set({ port: Number(e.target.value) }) })
891
1147
  ] })
892
1148
  ] }) : null,
893
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("details", { className: "mishu-more", children: [
894
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("summary", { children: t.mMore }),
895
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-row", children: [
896
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-field", children: [
1149
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("details", { className: "mishu-more", children: [
1150
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("summary", { children: t.mMore }),
1151
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-row", children: [
1152
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
897
1153
  t.sLabel,
898
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { value: account.label ?? "", placeholder: account.address ?? "", onChange: (e) => set({ label: e.target.value }) })
1154
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { value: account.label ?? "", placeholder: account.address ?? "", onChange: (e) => set({ label: e.target.value }) })
899
1155
  ] }),
900
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-field", children: [
1156
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
901
1157
  t.sUser,
902
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { value: account.user ?? "", placeholder: account.address ?? "", autoComplete: "off", onChange: (e) => set({ user: e.target.value }) })
1158
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { value: account.user ?? "", placeholder: account.address ?? "", autoComplete: "off", onChange: (e) => set({ user: e.target.value }) })
903
1159
  ] })
904
1160
  ] }),
905
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-row", children: [
906
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-field", children: [
1161
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-row", children: [
1162
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-field", children: [
907
1163
  t.sSince,
908
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "number", min: 1, max: 90, value: account.sinceDays ?? 14, onChange: (e) => set({ sinceDays: Number(e.target.value) }) })
1164
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "number", min: 1, max: 90, value: account.sinceDays ?? 14, onChange: (e) => set({ sinceDays: Number(e.target.value) }) })
909
1165
  ] }),
910
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "mishu-check", children: [
911
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "checkbox", checked: account.enabled !== false, onChange: (e) => set({ enabled: e.target.checked }) }),
1166
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "mishu-check", children: [
1167
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "checkbox", checked: account.enabled !== false, onChange: (e) => set({ enabled: e.target.checked }) }),
912
1168
  t.sEnabled
913
1169
  ] })
914
1170
  ] })
915
1171
  ] }),
916
- message === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: `mishu-preview ${message.ok ? "" : "mishu-danger"}`, children: [
1172
+ message === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `mishu-preview ${message.ok ? "" : "mishu-danger"}`, children: [
917
1173
  message.text,
918
- message.ok || !preset.supported ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AskAI, { topic: { kind: "mail-setup", preset: preset.id, error: message.text }, lang, locale, openChat: openChat2, compact: true })
1174
+ message.ok || !preset.supported ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AskAI, { topic: { kind: "mail-setup", preset: preset.id, error: message.text }, lang, locale, openChat: openChat2, compact: true })
919
1175
  ] }),
920
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mishu-actions", children: [
921
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn primary", disabled: busy || !preset.supported || (account.address ?? "") === "", onClick: () => {
1176
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mishu-actions", children: [
1177
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn primary", disabled: busy || !preset.supported || (account.address ?? "") === "", onClick: () => {
922
1178
  void testAndSave();
923
1179
  }, children: busy ? t.sTesting : t.mTestSave }),
924
- failedTest ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", disabled: busy, onClick: () => {
1180
+ failedTest ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", disabled: busy, onClick: () => {
925
1181
  setBusy(true);
926
1182
  void save();
927
1183
  }, children: t.mSaveAnyway }) : null,
928
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => onDone(), children: t.sCancel })
1184
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => onDone(), children: t.sCancel })
929
1185
  ] })
930
1186
  ] });
931
1187
  }
932
1188
 
933
1189
  // src/client/Board.tsx
934
- var import_jsx_runtime4 = require("react/jsx-runtime");
1190
+ var import_jsx_runtime6 = require("react/jsx-runtime");
935
1191
  var SOURCE_KEY = "dsh-mishu.source";
936
1192
  function loadSource() {
937
1193
  try {
@@ -967,14 +1223,15 @@ function saveWidths(widths) {
967
1223
  }
968
1224
  }
969
1225
  function MishuBoard({ locale, openChat: openChat2 }) {
970
- const [board, setBoard] = (0, import_react4.useState)();
971
- const [error, setError] = (0, import_react4.useState)();
972
- const [busy, setBusy] = (0, import_react4.useState)(false);
973
- const [syncing, setSyncing] = (0, import_react4.useState)(false);
974
- const [dropOn, setDropOn] = (0, import_react4.useState)();
975
- const [widths, setWidths] = (0, import_react4.useState)(loadWidths);
976
- const [tab, setTab] = (0, import_react4.useState)("board");
977
- const [source, setSourceState] = (0, import_react4.useState)(loadSource);
1226
+ const [board, setBoard] = (0, import_react6.useState)();
1227
+ const [error, setError] = (0, import_react6.useState)();
1228
+ const [busy, setBusy] = (0, import_react6.useState)(false);
1229
+ const [syncing, setSyncing] = (0, import_react6.useState)(false);
1230
+ const [dropOn, setDropOn] = (0, import_react6.useState)();
1231
+ const [widths, setWidths] = (0, import_react6.useState)(loadWidths);
1232
+ const [tab, setTab] = (0, import_react6.useState)("board");
1233
+ const [openCard, setOpenCard] = (0, import_react6.useState)();
1234
+ const [source, setSourceState] = (0, import_react6.useState)(loadSource);
978
1235
  const setSource = (next) => {
979
1236
  setSourceState(next);
980
1237
  try {
@@ -982,11 +1239,11 @@ function MishuBoard({ locale, openChat: openChat2 }) {
982
1239
  } catch {
983
1240
  }
984
1241
  };
985
- const dragged = (0, import_react4.useRef)(void 0);
986
- const columnsRef = (0, import_react4.useRef)(null);
1242
+ const dragged = (0, import_react6.useRef)(void 0);
1243
+ const columnsRef = (0, import_react6.useRef)(null);
987
1244
  const lang = board?.lang ?? uiLang(locale());
988
1245
  const t = TEXT[lang];
989
- const take = (0, import_react4.useCallback)((result) => {
1246
+ const take = (0, import_react6.useCallback)((result) => {
990
1247
  if (result.ok) {
991
1248
  setBoard(result.board);
992
1249
  setError(void 0);
@@ -994,8 +1251,8 @@ function MishuBoard({ locale, openChat: openChat2 }) {
994
1251
  setError(result.message);
995
1252
  }
996
1253
  }, []);
997
- const load = (0, import_react4.useCallback)(() => mishuApi.board(locale()).then(take), [locale, take]);
998
- (0, import_react4.useEffect)(() => {
1254
+ const load = (0, import_react6.useCallback)(() => mishuApi.board(locale()).then(take), [locale, take]);
1255
+ (0, import_react6.useEffect)(() => {
999
1256
  void load();
1000
1257
  const timer = setInterval(() => {
1001
1258
  void load();
@@ -1085,7 +1342,12 @@ function MishuBoard({ locale, openChat: openChat2 }) {
1085
1342
  reopen: t.reopen,
1086
1343
  stop: t.stop
1087
1344
  };
1088
- const card = (item, column) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1345
+ const cardKey = (item) => `${item.target}-${item.id}`;
1346
+ const toggleCard = (item) => {
1347
+ const key = cardKey(item);
1348
+ setOpenCard((current) => current === key ? void 0 : key);
1349
+ };
1350
+ const card = (item, column) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1089
1351
  Card,
1090
1352
  {
1091
1353
  item,
@@ -1095,6 +1357,8 @@ function MishuBoard({ locale, openChat: openChat2 }) {
1095
1357
  busy,
1096
1358
  label,
1097
1359
  openChat: openChat2,
1360
+ open: openCard === cardKey(item),
1361
+ onToggle: () => toggleCard(item),
1098
1362
  onAct: (action) => {
1099
1363
  void act(item, action);
1100
1364
  },
@@ -1106,15 +1370,15 @@ function MishuBoard({ locale, openChat: openChat2 }) {
1106
1370
  setDropOn(void 0);
1107
1371
  }
1108
1372
  },
1109
- `${item.target}-${item.id}`
1373
+ cardKey(item)
1110
1374
  );
1111
1375
  if (board === void 0) {
1112
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-page", children: [
1113
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-head", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-title", children: [
1114
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h1", { children: t.title }),
1115
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RestartButton, { lang, locale })
1376
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-page", children: [
1377
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-head", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-title", children: [
1378
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { children: t.title }),
1379
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RestartButton, { lang, locale })
1116
1380
  ] }) }),
1117
- error === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-empty", children: t.loading }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-error", children: [
1381
+ error === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-empty", children: t.loading }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-error", children: [
1118
1382
  t.failed,
1119
1383
  error
1120
1384
  ] })
@@ -1139,7 +1403,7 @@ function MishuBoard({ locale, openChat: openChat2 }) {
1139
1403
  { id: "manual", label: t.sourceManual }
1140
1404
  ];
1141
1405
  const template = `minmax(0, ${widths[0]}fr) 10px minmax(0, ${widths[1]}fr) 10px minmax(0, ${widths[2]}fr)`;
1142
- const divider = (index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1406
+ const divider = (index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1143
1407
  "div",
1144
1408
  {
1145
1409
  className: "mishu-divider",
@@ -1150,133 +1414,135 @@ function MishuBoard({ locale, openChat: openChat2 }) {
1150
1414
  onDoubleClick: resetWidths
1151
1415
  }
1152
1416
  );
1153
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-page", "data-mishu-board": "", children: [
1154
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-head", children: [
1155
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-title", children: [
1156
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h1", { children: t.title }),
1157
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-tabs", role: "tablist", children: [
1158
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === "board", className: tab === "board" ? "active" : "", onClick: () => setTab("board"), children: t.tabBoard }),
1159
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === "settings", className: tab === "settings" ? "active" : "", onClick: () => setTab("settings"), children: t.tabSettings })
1417
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-page", "data-mishu-board": "", children: [
1418
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-head", children: [
1419
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-title", children: [
1420
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { children: t.title }),
1421
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-tabs", role: "tablist", children: [
1422
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === "board", className: tab === "board" ? "active" : "", onClick: () => setTab("board"), children: t.tabBoard }),
1423
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === "settings", className: tab === "settings" ? "active" : "", onClick: () => setTab("settings"), children: t.tabSettings })
1160
1424
  ] }),
1161
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RestartButton, { lang, locale })
1425
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RestartButton, { lang, locale })
1162
1426
  ] }),
1163
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-sources", children: [
1164
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
1165
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("i", { className: `mishu-dot ${board.sources.github.state}` }),
1427
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-sources", children: [
1428
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
1429
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("i", { className: `mishu-dot ${board.sources.github.state}` }),
1166
1430
  board.sources.github.text,
1167
- board.sources.github.state === "error" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AskAI, { topic: { kind: "github-error" }, lang, locale, openChat: openChat2, compact: true }) : null
1431
+ board.sources.github.state === "error" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AskAI, { topic: { kind: "github-error" }, lang, locale, openChat: openChat2, compact: true }) : null
1168
1432
  ] }),
1169
- board.sources.mail.map((m) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
1170
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("i", { className: `mishu-dot ${m.state}` }),
1433
+ board.sources.mail.map((m) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
1434
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("i", { className: `mishu-dot ${m.state}` }),
1171
1435
  m.text,
1172
- m.state === "error" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AskAI, { topic: { kind: "mail-error", accountId: m.id }, lang, locale, openChat: openChat2, compact: true }) : null
1436
+ m.state === "error" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AskAI, { topic: { kind: "mail-error", accountId: m.id }, lang, locale, openChat: openChat2, compact: true }) : null
1173
1437
  ] }, m.id)),
1174
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", disabled: syncing, onClick: () => {
1438
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", disabled: syncing, onClick: () => {
1175
1439
  void sync();
1176
1440
  }, children: syncing ? t.syncing : t.sync })
1177
1441
  ] })
1178
1442
  ] }),
1179
- tab === "settings" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MishuSettings, { lang, locale, openChat: openChat2 }) : null,
1180
- tab === "settings" ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1181
- error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-error", children: [
1443
+ tab === "settings" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MishuSettings, { lang, locale, openChat: openChat2 }) : null,
1444
+ tab === "settings" ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1445
+ error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-error", children: [
1182
1446
  t.failed,
1183
1447
  error
1184
1448
  ] }),
1185
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "mishu-summary", children: [
1449
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "mishu-summary", children: [
1186
1450
  board.summary,
1187
1451
  " ",
1188
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AskAI, { topic: { kind: "summary" }, lang, locale, openChat: openChat2, compact: true })
1452
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AskAI, { topic: { kind: "summary" }, lang, locale, openChat: openChat2, compact: true })
1189
1453
  ] }),
1190
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-metrics", children: [
1191
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-metric", children: [
1192
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-metric-label", children: t.metricHandle }),
1193
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-metric-value", children: [
1454
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-metrics", children: [
1455
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-metric", children: [
1456
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-metric-label", children: t.metricHandle }),
1457
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-metric-value", children: [
1194
1458
  metrics.handle,
1195
- metrics.overdue > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("small", { className: "mishu-danger", children: [
1459
+ metrics.overdue > 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("small", { className: "mishu-danger", children: [
1196
1460
  metrics.overdue,
1197
1461
  " ",
1198
1462
  t.metricOverdue
1199
1463
  ] }) : null
1200
1464
  ] })
1201
1465
  ] }),
1202
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-metric", children: [
1203
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-metric-label", children: t.metricSoon }),
1204
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-metric-value", children: metrics.dueSoon })
1466
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-metric", children: [
1467
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-metric-label", children: t.metricSoon }),
1468
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-metric-value", children: metrics.dueSoon })
1205
1469
  ] }),
1206
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-metric", children: [
1207
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-metric-label", children: t.metricClosed }),
1208
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-metric-value", children: metrics.closedToday })
1470
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-metric", children: [
1471
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-metric-label", children: t.metricClosed }),
1472
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-metric-value", children: metrics.closedToday })
1209
1473
  ] }),
1210
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-metric", children: [
1211
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-metric-label", children: t.metricShadow }),
1212
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-metric-value", children: [
1474
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-metric", children: [
1475
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-metric-label", children: t.metricShadow }),
1476
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-metric-value", children: [
1213
1477
  metrics.shadow,
1214
- board.markRead === "shadow" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("small", { className: "mishu-warn", children: t.shadowTag }) : null
1478
+ board.markRead === "shadow" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("small", { className: "mishu-warn", children: t.shadowTag }) : null
1215
1479
  ] })
1216
1480
  ] })
1217
1481
  ] }),
1218
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-filters", role: "group", children: sources.map((s) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { type: "button", "aria-pressed": source === s.id, className: `mishu-chip ${source === s.id ? "active" : ""}`, onClick: () => setSource(s.id), children: [
1482
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-filters", role: "group", children: sources.map((s) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", "aria-pressed": source === s.id, className: `mishu-chip ${source === s.id ? "active" : ""}`, onClick: () => setSource(s.id), children: [
1219
1483
  s.label,
1220
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: count(s.id) })
1484
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: count(s.id) })
1221
1485
  ] }, s.id)) }),
1222
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-columns", ref: columnsRef, style: { ["--mishu-cols"]: template }, children: [
1223
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: `mishu-col ${dropOn === "handle" ? "drop" : ""}`, ...dropProps("handle"), "aria-label": t.handle, children: [
1224
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-col-head", children: [
1486
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-columns", ref: columnsRef, style: { ["--mishu-cols"]: template }, children: [
1487
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: `mishu-col ${dropOn === "handle" ? "drop" : ""}`, ...dropProps("handle"), "aria-label": t.handle, children: [
1488
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-col-head", children: [
1225
1489
  t.handle,
1226
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: columns.handle.length })
1490
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: columns.handle.length })
1227
1491
  ] }),
1228
- columns.handle.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-empty", children: t.emptyHandle }) : columns.handle.map((item) => card(item, "handle"))
1492
+ columns.handle.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-empty", children: t.emptyHandle }) : columns.handle.map((item) => card(item, "handle"))
1229
1493
  ] }),
1230
1494
  divider(0),
1231
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: `mishu-col ${dropOn === "remember" ? "drop" : ""}`, ...dropProps("remember"), "aria-label": t.remember, title: t.dropRemember, children: [
1232
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-col-head", children: [
1495
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: `mishu-col ${dropOn === "remember" ? "drop" : ""}`, ...dropProps("remember"), "aria-label": t.remember, title: t.dropRemember, children: [
1496
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-col-head", children: [
1233
1497
  t.remember,
1234
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: columns.remember.length })
1498
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: columns.remember.length })
1235
1499
  ] }),
1236
- columns.remember.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-empty", children: t.emptyRemember }) : columns.remember.map((item) => card(item, "remember")),
1237
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AddForm, { lang, locale, onAdded: (next) => setBoard(next) })
1500
+ columns.remember.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-empty", children: t.emptyRemember }) : columns.remember.map((item) => card(item, "remember")),
1501
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AddForm, { lang, locale, onAdded: (next) => setBoard(next) })
1238
1502
  ] }),
1239
1503
  divider(1),
1240
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: `mishu-col ${dropOn === "done" ? "drop" : ""}`, ...dropProps("done"), "aria-label": t.done, title: t.dropDone, children: [
1241
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-col-head", children: [
1504
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: `mishu-col ${dropOn === "done" ? "drop" : ""}`, ...dropProps("done"), "aria-label": t.done, title: t.dropDone, children: [
1505
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-col-head", children: [
1242
1506
  t.done,
1243
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: columns.done.total })
1507
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: columns.done.total })
1244
1508
  ] }),
1245
- columns.done.groups.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-empty", children: t.emptyDone }) : columns.done.groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("details", { className: "mishu-group", children: [
1246
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("summary", { children: [
1509
+ columns.done.groups.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-empty", children: t.emptyDone }) : columns.done.groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("details", { className: "mishu-group", children: [
1510
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("summary", { children: [
1247
1511
  group.label,
1248
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: group.items.length })
1512
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: group.items.length })
1249
1513
  ] }),
1250
1514
  group.items.map((item) => card(item, "done"))
1251
1515
  ] }, group.reason)),
1252
- columns.done.total > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-hint", children: t.doneHint }) : null,
1253
- metrics.shadow > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-banner", children: t.shadow(metrics.shadow) }) : null
1516
+ columns.done.total > 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-hint", children: t.doneHint }) : null,
1517
+ metrics.shadow > 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-banner", children: t.shadow(metrics.shadow) }) : null
1254
1518
  ] })
1255
1519
  ] })
1256
1520
  ] })
1257
1521
  ] });
1258
1522
  }
1259
- function Card({ item, column, lang, locale, busy, label, openChat: openChat2, onAct, onDragStart, onDragEnd }) {
1523
+ function Card({ item, column, lang, locale, busy, label, openChat: openChat2, open, onToggle, onAct, onDragStart, onDragEnd }) {
1260
1524
  const t = TEXT[lang];
1261
- const [open, setOpen] = (0, import_react4.useState)(false);
1262
- const [detail, setDetail] = (0, import_react4.useState)();
1525
+ const [detail, setDetail] = (0, import_react6.useState)();
1263
1526
  const explain = item.explain;
1264
1527
  const compact = column === "done";
1265
- const toggle = () => {
1266
- const next = !open;
1267
- setOpen(next);
1268
- if (next && item.target === "matter") {
1269
- void mishuApi.detail(locale(), item.id).then((r) => setDetail(r.ok ? r.detail : { error: r.message }));
1270
- }
1271
- };
1272
- const row = (name, text, className = "") => text === null || text === void 0 || text === "" ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `mishu-row-explain ${className}`, children: [
1273
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "mishu-row-label", children: name }),
1274
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: text })
1528
+ (0, import_react6.useEffect)(() => {
1529
+ if (!open || item.target !== "matter" || detail !== void 0) return;
1530
+ let alive = true;
1531
+ void mishuApi.detail(locale(), item.id).then((r) => {
1532
+ if (alive) setDetail(r.ok ? r.detail : { error: r.message });
1533
+ });
1534
+ return () => {
1535
+ alive = false;
1536
+ };
1537
+ }, [open, item.target, item.id, detail, locale]);
1538
+ const row = (name, text, className = "") => text === null || text === void 0 || text === "" ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `mishu-row-explain ${className}`, children: [
1539
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mishu-row-label", children: name }),
1540
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: text })
1275
1541
  ] });
1276
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1542
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1277
1543
  "div",
1278
1544
  {
1279
- className: `mishu-card ${item.tone === "normal" ? "" : item.tone}`,
1545
+ className: `mishu-card ${open ? "open" : ""} ${item.tone === "normal" ? "" : item.tone}`,
1280
1546
  draggable: item.target === "matter" && column !== "done",
1281
1547
  onDragStart: (event) => {
1282
1548
  event.dataTransfer.effectAllowed = "move";
@@ -1284,48 +1550,68 @@ function Card({ item, column, lang, locale, busy, label, openChat: openChat2, on
1284
1550
  },
1285
1551
  onDragEnd,
1286
1552
  children: [
1287
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-card-title", children: item.title }),
1288
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-card-meta", children: item.meta }),
1289
- !compact && explain !== null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-explain", children: [
1290
- row(t.what, explain.what),
1291
- row(column === "remember" ? t.whyKeep : t.why, explain.why),
1292
- row(t.fix, explain.fix, "mishu-fix")
1293
- ] }) : null,
1294
- !compact && explain === null && item.note !== null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-card-note", children: item.note }) : null,
1295
- open ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-detail", children: detail === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-empty", children: t.loading }) : "error" in detail ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-danger", children: detail.error }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1296
- compact && detail.explain !== null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1297
- row(t.what, detail.explain.what),
1298
- row(t.whyDone, detail.explain.why)
1299
- ] }) : null,
1300
- detail.did.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-row-explain", children: [
1301
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "mishu-row-label", children: t.did }),
1302
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: detail.did.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: line }, i)) })
1303
- ] }) : null,
1304
- detail.messages.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-messages", children: [
1305
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mishu-row-label", children: t.messages(detail.messages.length) }),
1306
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { children: detail.messages.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("li", { children: [
1307
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: m.at }),
1308
- " ",
1309
- m.title
1310
- ] }, i)) })
1311
- ] }) : null
1312
- ] }) }) : null,
1313
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-actions", children: [
1314
- column === "handle" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AskAI, { topic: item.target === "series" ? { kind: "series", id: item.id } : { kind: "matter", id: item.id }, lang, locale, openChat: openChat2 }) : null,
1315
- item.actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1316
- "button",
1317
- {
1318
- type: "button",
1319
- className: `mishu-btn ${index === 0 ? "primary" : ""}`,
1320
- disabled: busy && action !== "open",
1321
- onClick: () => onAct(action),
1322
- children: action === "open" && explain?.link !== void 0 ? explain.link.label : label[action]
1553
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1554
+ "div",
1555
+ {
1556
+ className: "mishu-card-head",
1557
+ role: "button",
1558
+ tabIndex: 0,
1559
+ "aria-expanded": open,
1560
+ title: open ? t.hide : compact ? t.explainDone : t.detail,
1561
+ onClick: onToggle,
1562
+ onKeyDown: (event) => {
1563
+ if (event.key !== "Enter" && event.key !== " ") return;
1564
+ event.preventDefault();
1565
+ onToggle();
1323
1566
  },
1324
- action
1325
- )),
1326
- item.target === "matter" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn mishu-btn-quiet", "aria-expanded": open, onClick: toggle, children: open ? t.hide : compact ? t.explainDone : t.detail }) : null,
1327
- column === "handle" ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AskAI, { topic: item.target === "series" ? { kind: "series", id: item.id } : { kind: "matter", id: item.id }, lang, locale, openChat: openChat2, compact: true })
1328
- ] })
1567
+ children: [
1568
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mishu-caret", "aria-hidden": "true" }),
1569
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mishu-card-title", children: item.title })
1570
+ ]
1571
+ }
1572
+ ),
1573
+ open ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-card-body", children: [
1574
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-card-meta", children: item.meta }),
1575
+ !compact && explain !== null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-explain", children: [
1576
+ row(t.what, explain.what),
1577
+ row(column === "remember" ? t.whyKeep : t.why, explain.why),
1578
+ row(t.fix, explain.fix, "mishu-fix")
1579
+ ] }) : null,
1580
+ !compact && explain === null && item.note !== null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-card-note", children: item.note }) : null,
1581
+ item.target === "matter" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-detail", children: detail === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-empty", children: t.loading }) : "error" in detail ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-danger", children: detail.error }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1582
+ compact && detail.explain !== null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1583
+ row(t.what, detail.explain.what),
1584
+ row(t.whyDone, detail.explain.why)
1585
+ ] }) : null,
1586
+ detail.did.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-row-explain", children: [
1587
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mishu-row-label", children: t.did }),
1588
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: detail.did.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children: line }, i)) })
1589
+ ] }) : null,
1590
+ detail.messages.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-messages", children: [
1591
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mishu-row-label", children: t.messages(detail.messages.length) }),
1592
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { children: detail.messages.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { children: [
1593
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: m.at }),
1594
+ " ",
1595
+ m.title
1596
+ ] }, i)) })
1597
+ ] }) : null
1598
+ ] }) }) : null,
1599
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-actions", children: [
1600
+ column === "handle" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AskAI, { topic: item.target === "series" ? { kind: "series", id: item.id } : { kind: "matter", id: item.id }, lang, locale, openChat: openChat2 }) : null,
1601
+ item.actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1602
+ "button",
1603
+ {
1604
+ type: "button",
1605
+ className: `mishu-btn ${index === 0 ? "primary" : ""}`,
1606
+ disabled: busy && action !== "open",
1607
+ onClick: () => onAct(action),
1608
+ children: action === "open" && explain?.link !== void 0 ? explain.link.label : label[action]
1609
+ },
1610
+ action
1611
+ )),
1612
+ column === "handle" ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AskAI, { topic: item.target === "series" ? { kind: "series", id: item.id } : { kind: "matter", id: item.id }, lang, locale, openChat: openChat2, compact: true })
1613
+ ] })
1614
+ ] }) : null
1329
1615
  ]
1330
1616
  }
1331
1617
  );
@@ -1333,11 +1619,11 @@ function Card({ item, column, lang, locale, busy, label, openChat: openChat2, on
1333
1619
  var EMPTY = { title: "", due: "", repeat: "none", category: "other", note: "" };
1334
1620
  function AddForm({ lang, locale, onAdded }) {
1335
1621
  const t = TEXT[lang];
1336
- const [open, setOpen] = (0, import_react4.useState)(false);
1337
- const [item, setItem] = (0, import_react4.useState)(EMPTY);
1338
- const [preview, setPreview] = (0, import_react4.useState)();
1339
- const [saving, setSaving] = (0, import_react4.useState)(false);
1340
- (0, import_react4.useEffect)(() => {
1622
+ const [open, setOpen] = (0, import_react6.useState)(false);
1623
+ const [item, setItem] = (0, import_react6.useState)(EMPTY);
1624
+ const [preview, setPreview] = (0, import_react6.useState)();
1625
+ const [saving, setSaving] = (0, import_react6.useState)(false);
1626
+ (0, import_react6.useEffect)(() => {
1341
1627
  if (!open || item.title.trim() === "" || item.due === "") {
1342
1628
  setPreview(void 0);
1343
1629
  return;
@@ -1348,7 +1634,7 @@ function AddForm({ lang, locale, onAdded }) {
1348
1634
  return () => clearTimeout(timer);
1349
1635
  }, [open, item, locale]);
1350
1636
  if (!open) {
1351
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { type: "button", className: "mishu-btn mishu-add-toggle", onClick: () => setOpen(true), children: [
1637
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", className: "mishu-btn mishu-add-toggle", onClick: () => setOpen(true), children: [
1352
1638
  "+ ",
1353
1639
  t.add
1354
1640
  ] });
@@ -1366,49 +1652,49 @@ function AddForm({ lang, locale, onAdded }) {
1366
1652
  setPreview({ ok: false, text: result.message });
1367
1653
  }
1368
1654
  };
1369
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-add", children: [
1370
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
1655
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-add", children: [
1656
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
1371
1657
  t.addTitle,
1372
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { value: item.title, placeholder: t.addTitlePlaceholder, onChange: set("title") })
1658
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { value: item.title, placeholder: t.addTitlePlaceholder, onChange: set("title") })
1373
1659
  ] }),
1374
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-row", children: [
1375
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
1660
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-row", children: [
1661
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
1376
1662
  t.addDue,
1377
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "date", value: item.due, onChange: set("due") })
1663
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "date", value: item.due, onChange: set("due") })
1378
1664
  ] }),
1379
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
1665
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
1380
1666
  t.addRepeat,
1381
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("select", { value: item.repeat, onChange: set("repeat"), children: Object.entries(t.repeats).map(([value, text]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value, children: text }, value)) })
1667
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("select", { value: item.repeat, onChange: set("repeat"), children: Object.entries(t.repeats).map(([value, text]) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value, children: text }, value)) })
1382
1668
  ] })
1383
1669
  ] }),
1384
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-row", children: [
1385
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
1670
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-row", children: [
1671
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
1386
1672
  t.addCategory,
1387
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("select", { value: item.category, onChange: set("category"), children: Object.entries(t.categories).map(([value, text]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value, children: text }, value)) })
1673
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("select", { value: item.category, onChange: set("category"), children: Object.entries(t.categories).map(([value, text]) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value, children: text }, value)) })
1388
1674
  ] }),
1389
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "mishu-field", children: [
1675
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "mishu-field", children: [
1390
1676
  t.addNote,
1391
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { value: item.note, onChange: set("note") })
1677
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { value: item.note, onChange: set("note") })
1392
1678
  ] })
1393
1679
  ] }),
1394
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: `mishu-preview ${preview?.ok === false ? "mishu-danger" : ""}`, children: preview?.text ?? t.previewHint }),
1395
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mishu-actions", children: [
1396
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn primary", disabled: saving || preview?.ok !== true, onClick: () => {
1680
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `mishu-preview ${preview?.ok === false ? "mishu-danger" : ""}`, children: preview?.text ?? t.previewHint }),
1681
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mishu-actions", children: [
1682
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn primary", disabled: saving || preview?.ok !== true, onClick: () => {
1397
1683
  void save();
1398
1684
  }, children: t.save }),
1399
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => {
1685
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", onClick: () => {
1400
1686
  setOpen(false);
1401
1687
  setItem(EMPTY);
1402
1688
  }, children: t.cancel })
1403
1689
  ] }),
1404
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mishu-hint", children: t.chatHint })
1690
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mishu-hint", children: t.chatHint })
1405
1691
  ] });
1406
1692
  }
1407
1693
  function RestartButton({ lang, locale }) {
1408
1694
  const t = TEXT[lang];
1409
- const [why, setWhy] = (0, import_react4.useState)();
1410
- const [status, setStatus] = (0, import_react4.useState)();
1411
- (0, import_react4.useEffect)(() => {
1695
+ const [why, setWhy] = (0, import_react6.useState)();
1696
+ const [status, setStatus] = (0, import_react6.useState)();
1697
+ (0, import_react6.useEffect)(() => {
1412
1698
  void restartApi.info(locale()).then((r) => {
1413
1699
  if (r.ok && !r.supported) setWhy(r.why);
1414
1700
  });
@@ -1428,12 +1714,12 @@ function RestartButton({ lang, locale }) {
1428
1714
  setStatus({ ok: true, text: await reconnect(locale) ? t.restartReloading : t.restartSlow });
1429
1715
  }
1430
1716
  };
1431
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1432
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "mishu-btn", title: why === void 0 ? t.restartTip : `${t.restartTip}
1717
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1718
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mishu-btn", title: why === void 0 ? t.restartTip : `${t.restartTip}
1433
1719
  ${why}`, disabled: status?.ok === true, onClick: () => {
1434
1720
  void restart();
1435
1721
  }, children: t.restart }),
1436
- status === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: status.ok ? "mishu-hint" : "mishu-hint mishu-warn", children: status.text })
1722
+ status === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: status.ok ? "mishu-hint" : "mishu-hint mishu-warn", children: status.text })
1437
1723
  ] });
1438
1724
  }
1439
1725
  async function reconnect(locale) {
@@ -1490,10 +1776,17 @@ var STYLES = `
1490
1776
  .mishu-col-head{display:flex;justify-content:space-between;align-items:baseline;font-weight:600;margin:2px 4px 8px}
1491
1777
  .mishu-col-head span{color:${MUTED};font-weight:400}
1492
1778
  .mishu-empty{color:${FAINT};padding:8px 4px}
1493
- .mishu-card{background:${LAYER2};border:1px solid ${LINE};border-radius:8px;padding:8px 10px;margin-bottom:8px}
1779
+ .mishu-card{background:${LAYER2};border:1px solid ${LINE};border-radius:8px;padding:6px 8px;margin-bottom:8px}
1494
1780
  .mishu-card[draggable=true]{cursor:grab}
1495
1781
  .mishu-card.danger{border-color:${DANGER}}
1496
- .mishu-card-title{font-weight:600;word-break:break-word}
1782
+ .mishu-card.open{padding-bottom:8px}
1783
+ .mishu-card-head{display:flex;align-items:flex-start;gap:6px;width:100%;font:inherit;font-size:13px;text-align:left;color:inherit;background:transparent;border:0;border-radius:6px;padding:3px 4px;cursor:pointer}
1784
+ .mishu-card-head:hover{background:${HOVER}}
1785
+ .mishu-card-head:focus-visible{outline:2px solid ${ACCENT};outline-offset:1px}
1786
+ .mishu-caret{flex:0 0 auto;width:0;height:0;margin-top:6px;border-left:4px solid ${FAINT};border-top:4px solid transparent;border-bottom:4px solid transparent;transition:transform .12s}
1787
+ .mishu-card.open .mishu-caret{transform:rotate(90deg);border-left-color:${ACCENT}}
1788
+ .mishu-card-body{padding:0 4px}
1789
+ .mishu-card-title{font-weight:600;word-break:break-word;min-width:0;flex:1 1 auto}
1497
1790
  .mishu-card-meta{font-size:12px;color:${MUTED};margin-top:2px}
1498
1791
  .mishu-card.danger .mishu-card-meta{color:${DANGER}}
1499
1792
  .mishu-card.warn .mishu-card-meta{color:${WARN}}
@@ -1552,9 +1845,19 @@ var STYLES = `
1552
1845
  .mishu-chip span{color:${FAINT}}
1553
1846
  .mishu-chip.active{border-color:${ACCENT};color:${ACCENT}}
1554
1847
  .mishu-chip.active span{color:${ACCENT}}
1555
- .mishu-settings{display:flex;flex-direction:column;gap:12px;max-width:760px}
1556
- .mishu-panel{background:${LAYER1};border-radius:12px;padding:12px 14px}
1557
- .mishu-panel h2{font-size:14px;font-weight:600;margin:0 0 8px}
1848
+ .mishu-settings{display:flex;flex-direction:column;gap:8px;max-width:760px}
1849
+ .mishu-panel{background:${LAYER1};border:1px solid transparent;border-radius:12px;padding:6px 10px}
1850
+ .mishu-panel.open{border-color:${LINE}}
1851
+ .mishu-panel .mishu-card-head{font-size:14px;padding:6px 4px}
1852
+ .mishu-panel .mishu-card-body{padding:2px 6px 8px}
1853
+ .mishu-panel h3{font-size:13px;font-weight:600;margin:14px 0 6px}
1854
+ .mishu-fold+.mishu-fold{margin-top:6px}
1855
+ .mishu-fold .mishu-fold{background:${LAYER2}}
1856
+ .mishu-card-aside{flex:0 0 auto;display:inline-flex;align-items:center;margin-left:auto}
1857
+ .mishu-check-inline{margin:0}
1858
+ .mishu-check-inline input{cursor:pointer}
1859
+ .mishu-notify-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:6px}
1860
+ .mishu-notify-row input[type=time]{font:inherit;font-size:13px;color:${TEXT2};background:${LAYER2};border:1px solid ${LINE_STRONG};border-radius:6px;padding:2px 6px}
1558
1861
  .mishu-grid5{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px;margin-bottom:8px}
1559
1862
  .mishu-check{display:flex;align-items:center;gap:6px;font-size:13px;margin:4px 0 8px;color:${TEXT2}}
1560
1863
  .mishu-ok{padding:6px 10px;border-radius:8px;border:1px solid ${OK};color:${OK};font-size:12px}
@@ -1570,18 +1873,18 @@ var STYLES = `
1570
1873
  `;
1571
1874
 
1572
1875
  // src/client/index.tsx
1573
- var import_jsx_runtime5 = require("react/jsx-runtime");
1876
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1574
1877
  var PACKAGE_NAME = "dsh-mishu";
1575
1878
  var inject = ["slots", "locale"];
1576
1879
  var PANEL_ID = "dsh-mishu";
1577
1880
  var NS = "dsh-mishu";
1578
1881
  var openChat;
1579
1882
  function MishuIcon({ size }) {
1580
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
1581
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: "5", y: "4", width: "14", height: "17", rx: "2" }),
1582
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M9 4h6v3H9z" }),
1583
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M9 12l2 2 4-4" }),
1584
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M9 17h6" })
1883
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
1884
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("rect", { x: "5", y: "4", width: "14", height: "17", rx: "2" }),
1885
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M9 4h6v3H9z" }),
1886
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M9 12l2 2 4-4" }),
1887
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M9 17h6" })
1585
1888
  ] });
1586
1889
  }
1587
1890
  function apply(ctx) {