@xmanrui/dsh-im 5.2.0 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/THIRD_PARTY_NOTICES.md +209 -0
  2. package/docs/client-integration.md +8 -4
  3. package/lib/client.js +1988 -250
  4. package/lib/index.js +327 -321
  5. package/package.json +1 -1
  6. package/plugin-src/client/channels/telegram/group-triggers-settings.js +393 -0
  7. package/plugin-src/client/connection-error.js +2 -1
  8. package/plugin-src/client/delivery-settings.js +21 -1
  9. package/plugin-src/client/ds-bot-avatar-data.js +537 -0
  10. package/plugin-src/client/ds-bot-avatar.js +55 -0
  11. package/plugin-src/client/ds-bot-session-avatars.js +77 -0
  12. package/plugin-src/client/ds-bot-settings.js +194 -0
  13. package/plugin-src/client/global-settings.js +2 -1
  14. package/plugin-src/client/i18n.js +67 -1
  15. package/plugin-src/client/index.js +49 -18
  16. package/plugin-src/client/plugin-page.js +39 -17
  17. package/plugin-src/client/sidebar-settings.js +129 -0
  18. package/plugin-src/client/styles.js +33 -5
  19. package/plugin-src/host/channels/dingtalk/production.mjs +2 -1
  20. package/plugin-src/host/channels/dingtalk/rpc.mjs +5 -1
  21. package/plugin-src/host/channels/feishu/production.mjs +13 -5
  22. package/plugin-src/host/channels/feishu/rpc.mjs +5 -1
  23. package/plugin-src/host/channels/qq/production.mjs +2 -1
  24. package/plugin-src/host/channels/qq/rpc.mjs +5 -1
  25. package/plugin-src/host/channels/shared/group-triggers-rpc.mjs +110 -0
  26. package/plugin-src/host/channels/shared/production.mjs +7 -1
  27. package/plugin-src/host/channels/slack/production.mjs +2 -1
  28. package/plugin-src/host/channels/telegram/index.mjs +1 -0
  29. package/plugin-src/host/channels/telegram/production.mjs +2 -0
  30. package/plugin-src/host/channels/telegram/rpc.mjs +17 -2
  31. package/plugin-src/host/channels/wecom/production.mjs +4 -1
  32. package/plugin-src/host/channels/wecom/rpc.mjs +5 -1
  33. package/plugin-src/host/channels/wecom-app/production.mjs +2 -1
  34. package/plugin-src/host/channels/weixin/production.mjs +2 -1
  35. package/plugin-src/host/channels/weixin/rpc.mjs +3 -2
  36. package/plugin-src/host/channels/whatsapp/production.mjs +2 -1
  37. package/plugin-src/host/channels/whatsapp/rpc.mjs +5 -1
  38. package/plugin-src/host/delivery-adapter.mjs +89 -9
  39. package/plugin-src/host/delivery-rpc.mjs +33 -1
  40. package/plugin-src/host/delivery-service.mjs +70 -1
  41. package/plugin-src/host/delivery-suggestions.mjs +11 -0
  42. package/plugin-src/host/ds-bot-client.mjs +74 -0
  43. package/plugin-src/host/index.mjs +12 -1
  44. package/plugin-src/host/sidebar-settings.mjs +113 -0
  45. package/src/channels/feishu/feishu-cards.mjs +11 -7
  46. package/src/channels/imessage/imessage-api.mjs +67 -2
  47. package/src/channels/shared/bot-workspace-store.mjs +136 -7
  48. package/src/channels/shared/connection-error.mjs +5 -5
  49. package/src/channels/shared/diagnostic-details.mjs +15 -1
  50. package/src/channels/shared/group-history-store.mjs +26 -0
  51. package/src/channels/shared/i18n-en/diagnostics.mjs +5 -0
  52. package/src/channels/shared/i18n-en/feishu.mjs +1 -0
  53. package/src/channels/shared/i18n-en/wecom.mjs +4 -0
  54. package/src/channels/shared/qr-encoding-error.mjs +39 -0
  55. package/src/channels/shared/session-binding-lock.mjs +2 -0
  56. package/src/channels/shared/workspace-session.mjs +5 -1
  57. package/src/channels/telegram/config-store.mjs +5 -1
  58. package/src/channels/telegram/group-triggers.mjs +229 -0
  59. package/src/channels/telegram/telegram-api.mjs +12 -0
  60. package/src/channels/telegram/telegram-controller.mjs +110 -1
  61. package/src/channels/telegram/telegram-runtime.mjs +15 -2
  62. package/src/channels/wecom/stream-supervisor.mjs +184 -0
  63. package/src/channels/wecom/wecom-bridge.mjs +25 -11
  64. package/src/channels/wecom/wecom-runtime.mjs +12 -1
  65. package/src/channels/weixin/connection-error.mjs +1 -0
package/lib/client.js CHANGED
@@ -590,12 +590,12 @@ async function callManagementRpc(connection, channel7, method, payload, signal)
590
590
  }
591
591
 
592
592
  // plugin-src/client/index.js
593
- var React41 = __toESM(require("react"), 1);
593
+ var React46 = __toESM(require("react"), 1);
594
594
 
595
595
  // package.json
596
596
  var package_default = {
597
597
  name: "@xmanrui/dsh-im",
598
- version: "5.2.0",
598
+ version: "5.4.0",
599
599
  icon: "./assets/logo-plugin-message-link-gradient.webp",
600
600
  description: "\u628A\u5FAE\u4FE1\u3001\u98DE\u4E66\u3001\u4F01\u5FAE\u3001\u9489\u9489\u3001QQ\u3001Telegram\u3001WhatsApp\u3001Slack\u3001Discord\u3001Matrix\u63A5\u5165DSH\u3002 Connect Telegram, WhatsApp, Slack, Discord, Matrix, WeChat, Feishu, WeCom, DingTalk, and QQ to DSH.",
601
601
  keywords: [
@@ -963,6 +963,10 @@ var image_input_default = {
963
963
 
964
964
  // src/channels/shared/i18n-en/diagnostics.mjs
965
965
  var diagnostics_default = Object.freeze({
966
+ "\u5F02\u5E38\u7C7B\u578B": "Exception types",
967
+ "\u4E8C\u7EF4\u7801\u7F16\u7801\u5668": "QR encoder",
968
+ "\u4E8C\u7EF4\u7801\u56FE\u7247\u683C\u5F0F": "QR image format",
969
+ "\u672C\u673A\u4E8C\u7EF4\u7801\u56FE\u7247\u751F\u6210\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\uFF1B\u82E5\u6301\u7EED\u5931\u8D25\uFF0C\u8BF7\u590D\u5236\u8BCA\u65AD\u4FE1\u606F\u5E76\u68C0\u67E5 DSH \u8FD0\u884C\u73AF\u5883\u3002": "The QR-code image could not be generated locally. Retry; if it keeps failing, copy the diagnostics and check the DSH runtime environment.",
966
970
  "\u51C6\u5907\u4F1A\u8BDD": "Prepare session",
967
971
  "\u51C6\u5907\u6D88\u606F": "Prepare message",
968
972
  "\u5EFA\u7ACB\u4EA4\u4E92\u901A\u9053": "Open interaction channel",
@@ -1180,10 +1184,43 @@ var connection_error_en_default = {
1180
1184
  var React2 = __toESM(require("react"), 1);
1181
1185
  var IM_LOCALE_NAMESPACE = "dsh-im";
1182
1186
  var EN = Object.freeze({
1187
+ "\u79C1\u804A\u5BF9\u8C61": "Private chat",
1188
+ "\u9009\u62E9\u79C1\u804A\u5BF9\u8C61": "Select a private chat",
1189
+ "\u4EC5\u652F\u6301\u5DF2\u7ECF\u5EFA\u7ACB\u4F1A\u8BDD\u7684\u79C1\u804A\uFF0C\u8BF7\u5148\u4E0E\u673A\u5668\u4EBA\u79C1\u804A\u540E\u5237\u65B0\u3002": "Only established private chats are supported. Message the bot privately, then refresh.",
1190
+ "\u9009\u62E9 DS Bot \u548C\u79C1\u804A\u5BF9\u8C61\uFF0C\u76F4\u63A5\u4F7F\u7528 Bot \u7684\u4F1A\u8BDD\u3002": "Choose a DS Bot and a private chat to use the Bot\u2019s session.",
1191
+ "\u8FD8\u6CA1\u6709\u53EF\u7ED1\u5B9A\u7684\u79C1\u804A\u3002\u5148\u7ED9\u8FD9\u4E2A\u673A\u5668\u4EBA\u53D1\u4E00\u6761\u79C1\u804A\u6D88\u606F\uFF0C\u518D\u70B9\u51FB\u5237\u65B0\u3002": "No private chats yet. Send this bot a private message, then refresh.",
1192
+ "\u7ED1\u5B9Abot": "Bind bot",
1193
+ "\u6B63\u5728\u68C0\u6D4B DS Bot\u2026": "Checking DS Bot\u2026",
1194
+ "\u9009\u62E9 DS Bot": "Select DS Bot",
1195
+ "\u6682\u65E0\u53EF\u9009 DS Bot": "No available DS Bots",
1196
+ "\u6682\u65E0\u53EF\u9009\u79C1\u804A\u5BF9\u8C61": "No available private chats",
1197
+ "\u5DF2\u7ED1\u5B9A\u7684 DS Bot \u548C\u79C1\u804A\u5BF9\u8C61\u4E0D\u53EF\u91CD\u590D\u9009\u62E9\uFF0C\u89E3\u9664\u7ED1\u5B9A\u540E\u53EF\u91CD\u65B0\u9009\u62E9\u3002": "Bound DS Bots and private chats cannot be selected again. Unbind them to make them available.",
1198
+ "\u6240\u9009 DS Bot \u6216\u79C1\u804A\u5BF9\u8C61\u5DF2\u7ED1\u5B9A\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u65B0\u9009\u62E9\u3002": "The selected DS Bot or private chat is already bound. Refresh and choose again.",
1199
+ "\u89E3\u9664\u7ED1\u5B9A": "Unbind",
1200
+ "\u5DF2\u7ED1\u5B9A": "Bound",
1201
+ "\u672A\u5B89\u88C5 DS Bot\uFF0C\u8BF7\u5148\u5728 DSH \u63D2\u4EF6\u7BA1\u7406\u4E2D\u5B89\u88C5 ds-bot\uFF0C\u7136\u540E\u5237\u65B0\u3002": "DS Bot is not installed. Install ds-bot in DSH plugin management, then refresh.",
1202
+ "DS Bot \u5C1A\u672A\u542F\u7528\uFF0C\u8BF7\u5728 DSH \u63D2\u4EF6\u7BA1\u7406\u4E2D\u542F\u7528\u540E\u5237\u65B0\u3002": "DS Bot is disabled. Enable it in DSH plugin management, then refresh.",
1203
+ "\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6 DS Bot\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u662F\u5426\u6B63\u5E38\u8FD0\u884C\u540E\u91CD\u8BD5\u3002": "Unable to read DS Bot. Check that the plugin is running, then retry.",
1204
+ "DS Bot \u5F53\u524D\u7531\u5176\u4ED6 Host \u7BA1\u7406\uFF0C\u8BF7\u5728\u8FD0\u884C\u5B83\u7684 Host \u4E2D\u7ED1\u5B9A\u3002": "DS Bot is managed by another Host. Bind it on that Host.",
1205
+ "\u7ED1\u5B9Abot\u4EC5\u652F\u6301\u5F53\u524D Host \u7684\u4F1A\u8BDD\uFF0C\u8BF7\u5148\u68C0\u67E5\u673A\u5668\u4EBA\u7684 Harness \u8FDE\u63A5\u8BBE\u7F6E\u3002": "Bot binding requires the current Host. Check the bot\u2019s Harness connection settings.",
1206
+ "\u6240\u9009 DS Bot \u5DF2\u4E0D\u5B58\u5728\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u65B0\u9009\u62E9\u3002": "The selected DS Bot no longer exists. Refresh and select another.",
1207
+ "\u7ED1\u5B9A\u8BBE\u7F6E\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5\u3002": "Could not save the binding. Refresh and retry.",
1208
+ "\u7ED1\u5B9A\u5DF2\u4FDD\u5B58\u3002": "Binding saved.",
1209
+ "\u5DF2\u89E3\u9664\u7ED1\u5B9A\uFF0C\u804A\u5929\u8BB0\u5F55\u4FDD\u7559\u3002": "Binding removed. Chat history is preserved.",
1210
+ "\u8FD8\u6CA1\u6709 DS Bot\uFF0C\u8BF7\u5148\u5728 DS Bot \u4E2D\u521B\u5EFA\u673A\u5668\u4EBA\u540E\u5237\u65B0\u3002": "No bots yet. Create a bot in DS Bot, then refresh.",
1211
+ "DS Bot \u6682\u4E0D\u53EF\u7528": "DS Bot unavailable",
1183
1212
  ...connection_error_en_default,
1184
1213
  ...diagnostics_default,
1185
1214
  ...image_input_default,
1186
1215
  "$locale": "en",
1216
+ "\u4FA7\u8FB9\u680F\u5165\u53E3": "Sidebar entry",
1217
+ "\u81EA\u52A8\u6A21\u5F0F\uFF1A\u672A\u914D\u7F6E\u6E20\u9053\u65F6\u663E\u793A\uFF0C\u914D\u7F6E\u81F3\u5C11\u4E00\u4E2A\u6E20\u9053\u540E\u9690\u85CF\u3002\u9690\u85CF\u540E\u4ECD\u53EF\u4ECE\u63D2\u4EF6\u8BE6\u60C5\u6216\u8BBE\u7F6E\u8FDB\u5165\uFF0C\u4E0D\u5F71\u54CD\u673A\u5668\u4EBA\u540E\u53F0\u8FD0\u884C\u3002": "Automatic: show before any channel is configured, then hide. Plugin details and Settings remain available; bots keep running in the background.",
1218
+ "\u81EA\u52A8\u9690\u85CF": "Auto-hide",
1219
+ "\u59CB\u7EC8\u663E\u793A": "Always show",
1220
+ "\u59CB\u7EC8\u9690\u85CF": "Always hide",
1221
+ "\u6B63\u5728\u8BFB\u53D6\u4FA7\u8FB9\u680F\u8BBE\u7F6E\u2026": "Loading sidebar settings\u2026",
1222
+ "\u65E0\u6CD5\u8BFB\u53D6\u6216\u4FDD\u5B58\u4FA7\u8FB9\u680F\u8BBE\u7F6E\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002": "Unable to read or save sidebar settings. Try again.",
1223
+ "\u4FA7\u8FB9\u680F\u8BBE\u7F6E\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94\u3002": "Unrecognized sidebar settings response.",
1187
1224
  "\u4FDD\u6301\u672C\u9875\u6253\u5F00\uFF0C\u7B49\u5F85\u6743\u9650\u751F\u6548": "Keep this page open while the permission takes effect",
1188
1225
  "\u7FA4\u804A\u5929\u8BB0\u5F55": "Group chat history",
1189
1226
  "\u7FA4\u804A\u5929\u8BB0\u5F55\u4FDD\u7559\u5929\u6570": "Group chat retention (days)",
@@ -1233,7 +1270,6 @@ var EN = Object.freeze({
1233
1270
  "macOS Messages \u6743\u9650": "macOS Messages permissions",
1234
1271
  "IM\u673A\u5668\u4EBA": "IM bots",
1235
1272
  "\u6253\u5F00 IM\u673A\u5668\u4EBA": "Open IM bots",
1236
- "\u8FD4\u56DE\u63D2\u4EF6\u8BE6\u60C5": "Back to plugin details",
1237
1273
  "IM\u673A\u5668\u4EBA\u8BBE\u7F6E": "IM bot settings",
1238
1274
  "IM \u9762\u677F\u52A0\u8F7D\u5931\u8D25": "Could not load the IM panel",
1239
1275
  "\u66F4\u591A\u673A\u5668\u4EBA\u8BBE\u7F6E": "More bot settings",
@@ -1244,6 +1280,38 @@ var EN = Object.freeze({
1244
1280
  "\u673A\u5668\u4EBA\u8BBE\u7F6E": "Bot settings",
1245
1281
  "\u673A\u5668\u4EBA\u8BBE\u7F6E\u9875\u7B7E": "Bot settings tabs",
1246
1282
  "\u6295\u9012\u8BBE\u7F6E": "Delivery settings",
1283
+ "\u673A\u5668\u4EBA\u7FA4\u804A\u884C\u4E3A": "Bot in groups",
1284
+ "\u65B0\u7FA4\u804A\u9ED8\u8BA4\u8BBE\u7F6E": "Default for new groups",
1285
+ "\u54CD\u5E94\u6761\u4EF6": "React to",
1286
+ "\u4E0D\u54CD\u5E94": "Do not react",
1287
+ "\u88AB @ \u6216\u56DE\u590D\u65F6\uFF08\u4EFB\u4F55\u4EBA\uFF09": "Mention or reply, anyone",
1288
+ "\u88AB @ \u6216\u56DE\u590D\u65F6\uFF08\u4EC5\u540D\u5355\u6210\u5458\uFF09": "Mention or reply, listed members only",
1289
+ "\u6240\u6709\u6D88\u606F\uFF08\u4EFB\u4F55\u4EBA\uFF09": "All messages, anyone",
1290
+ "\u6240\u6709\u6D88\u606F\uFF08\u4EC5\u540D\u5355\u6210\u5458\uFF09": "All messages, listed members only",
1291
+ "\u6210\u5458\u540D\u5355": "Members list",
1292
+ "\u540D\u5355\u4E3A\u7A7A\uFF1A\u8BE5\u6A21\u5F0F\u4E0D\u4F1A\u54CD\u5E94\u4EFB\u4F55\u6210\u5458\u3002": "The list is empty, so nobody can trigger the bot in this mode.",
1293
+ "\u5F53\u524D\u6A21\u5F0F\u4E0D\u4F7F\u7528\u540D\u5355\u3002": "This mode does not use the list.",
1294
+ "\u7FA4 ID": "Group",
1295
+ "\u6807\u9898": "Title",
1296
+ "\u6700\u8FD1\u6D3B\u52A8": "Last activity",
1297
+ "\uFF08\u9ED8\u8BA4\uFF09": " (default)",
1298
+ "\xD7 \u79FB\u9664": "\xD7 Remove",
1299
+ "\u81EA\u5B9A\u4E49": "Customize",
1300
+ "\u6DFB\u52A0\u7FA4\u804A": "Add group",
1301
+ "\u7FA4 ID\u3001@\u7528\u6237\u540D\u6216\u6D88\u606F\u94FE\u63A5": "Group ID, @username or message link",
1302
+ "\u652F\u6301\u6570\u5B57 ID\u3001@\u7528\u6237\u540D\u3001t.me/<name> \u6216 t.me/c/<id>/<msg>\uFF1B\u771F\u5B9E ID \u901A\u8FC7 getChat \u89E3\u6790\u3002": "Accepts a numeric ID, @username, t.me/<name> or t.me/c/<id>/<msg>; the real ID is resolved through getChat.",
1303
+ "+ \u6DFB\u52A0": "+ Add",
1304
+ "\u4FDD\u5B58\u7FA4\u804A\u8BBE\u7F6E": "Save group settings",
1305
+ "\u5DF2\u4ECE\u5217\u8868\u79FB\u9664\uFF0C\u4FDD\u5B58\u540E\u751F\u6548\u3002": "Removed from the list. Save to apply.",
1306
+ "\u5DF2\u6DFB\u52A0\uFF0C\u4FDD\u5B58\u540E\u751F\u6548\u3002": "Added. Save to apply.",
1307
+ "\u5DF2\u6DFB\u52A0\u3002Telegram \u672A\u786E\u8BA4\u8BE5\u7FA4\uFF08\u673A\u5668\u4EBA\u53EF\u80FD\u8FD8\u4E0D\u5728\u7FA4\u91CC\uFF09\uFF0C\u4FDD\u5B58\u540E\u751F\u6548\u3002": "Added without Telegram confirmation (the bot may not be in that group yet). Save to apply.",
1308
+ "\u7FA4\u804A\u8BBE\u7F6E\u5DF2\u4FDD\u5B58\u3002": "Group settings saved.",
1309
+ "\u6B63\u5728\u8BFB\u53D6\u7FA4\u804A\u8BBE\u7F6E\u2026": "Loading group settings\u2026",
1310
+ "\u65E0\u6CD5\u8BFB\u53D6\u7FA4\u804A\u8BBE\u7F6E\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002": "Unable to read group settings. Try again.",
1311
+ "\u65E0\u6CD5\u4FDD\u5B58\u7FA4\u804A\u8BBE\u7F6E\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002": "Unable to save group settings. Try again.",
1312
+ "\u65E0\u6CD5\u8BFB\u53D6\u6216\u4FDD\u5B58\u7FA4\u804A\u8BBE\u7F6E\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002": "Unable to read or save group settings. Try again.",
1313
+ "\u65E0\u6CD5\u89E3\u6790\u8BE5\u7FA4\u804A\uFF0C\u8BF7\u91CD\u8BD5\u6216\u586B\u5199\u6570\u5B57\u7FA4 ID\u3002": "Could not resolve this group. Try again or enter the numeric group ID.",
1314
+ "\u8BE5\u7FA4\u5DF2\u5728\u5217\u8868\u4E2D\uFF0C\u8BF7\u7F16\u8F91\u4E0A\u65B9\u7684\u5361\u7247\u3002": "This group is already in the list. Edit its card above instead.",
1247
1315
  "\u8BBF\u95EE\u8BBE\u7F6E": "Access settings",
1248
1316
  "\u67E5\u770B\u8BBF\u95EE\u6743\u9650\u8BF4\u660E": "View access permission details",
1249
1317
  "\u5141\u8BB8\u6240\u6709\u7528\u6237": "Allow all users",
@@ -2635,6 +2703,20 @@ var REASONS = /* @__PURE__ */ new Set([
2635
2703
  "EMFILE",
2636
2704
  "ENFILE",
2637
2705
  "EEXIST",
2706
+ "ERR_INVALID_ARG_TYPE",
2707
+ "ERR_INVALID_ARG_VALUE",
2708
+ "ERR_OUT_OF_RANGE",
2709
+ "ERR_BUFFER_OUT_OF_BOUNDS",
2710
+ "ERR_ZLIB_INITIALIZATION_FAILED",
2711
+ "ERR_STREAM_DESTROYED",
2712
+ "ERR_STREAM_PREMATURE_CLOSE",
2713
+ "Z_STREAM_ERROR",
2714
+ "Z_DATA_ERROR",
2715
+ "Z_MEM_ERROR",
2716
+ "Z_BUF_ERROR",
2717
+ "Z_VERSION_ERROR",
2718
+ "MODULE_NOT_FOUND",
2719
+ "ERR_MODULE_NOT_FOUND",
2638
2720
  "unknown",
2639
2721
  "multiple-causes",
2640
2722
  "timeout",
@@ -2671,6 +2753,18 @@ var RPC_METHODS = /* @__PURE__ */ new Set([
2671
2753
  var TRANSPORTS = /* @__PURE__ */ new Set(["host-api", "http", "websocket"]);
2672
2754
  var SUBMISSION_STATES = /* @__PURE__ */ new Set(["not-submitted", "accepted", "unknown"]);
2673
2755
  var CONFIG_FILES = /* @__PURE__ */ new Set(["config.json", "workspaces.json"]);
2756
+ var DIAGNOSTIC_ERROR_TYPES = /* @__PURE__ */ new Set([
2757
+ "Error",
2758
+ "TypeError",
2759
+ "RangeError",
2760
+ "ReferenceError",
2761
+ "SyntaxError",
2762
+ "AggregateError",
2763
+ "DOMException",
2764
+ "AxiosError",
2765
+ "TimeoutError",
2766
+ "AbortError"
2767
+ ]);
2674
2768
  var CONFIG_ISSUE_LABELS = Object.freeze({
2675
2769
  "expected-object": "\u5E94\u4E3A JSON \u5BF9\u8C61\u3002",
2676
2770
  "expected-array": "\u5E94\u4E3A JSON \u6570\u7EC4\u3002",
@@ -2695,6 +2789,12 @@ function normalizeDiagnosticDetails(value) {
2695
2789
  if (allowed.has(value[field2])) result2[field2] = value[field2];
2696
2790
  }
2697
2791
  if (DIAGNOSTIC_CHANNELS.includes(value.channel)) result2.channel = value.channel;
2792
+ if (Array.isArray(value.errorTypes)) {
2793
+ const errorTypes = [...new Set(value.errorTypes.filter((type) => DIAGNOSTIC_ERROR_TYPES.has(type)))];
2794
+ if (errorTypes.length) result2.errorTypes = errorTypes;
2795
+ }
2796
+ if (value.qrEncoder === "qrcode") result2.qrEncoder = value.qrEncoder;
2797
+ if (value.qrRenderer === "png") result2.qrRenderer = value.qrRenderer;
2698
2798
  if (Array.isArray(value.reasons)) {
2699
2799
  const reasons = [...new Set(value.reasons.filter((v) => REASONS.has(v) && !["unknown", "multiple-causes"].includes(v)))].slice(0, 16);
2700
2800
  if (reasons.length) result2.reasons = reasons;
@@ -2706,7 +2806,7 @@ function normalizeDiagnosticDetails(value) {
2706
2806
  if (["ilinkai.weixin.qq.com", "oapi.dingtalk.com", "api.dingtalk.com", "api.telegram.org", "discord.com", "slack.com", "open.feishu.cn", "qyapi.weixin.qq.com"].includes(value.host)) result2.host = value.host;
2707
2807
  if (value.dependencies && typeof value.dependencies === "object") {
2708
2808
  const dependencies = {};
2709
- for (const name2 of ["dingtalkStream", "axios", "httpsProxyAgent", "agentBase"]) {
2809
+ for (const name2 of ["dingtalkStream", "axios", "httpsProxyAgent", "agentBase", "qrcode", "pngjs", "zlib"]) {
2710
2810
  const version = value.dependencies[name2];
2711
2811
  if (typeof version === "string" && /^\d+\.\d+\.\d+(?:[-+][A-Za-z0-9.-]+)?$/.test(version) && version.length <= 80) dependencies[name2] = version;
2712
2812
  }
@@ -2799,7 +2899,7 @@ function formatConnectionDiagnostic(value) {
2799
2899
  localizeText(error.message),
2800
2900
  details.hint ? localizeText(details.hint) : null,
2801
2901
  localizeText("\u9519\u8BEF\u7801") + ": " + error.code,
2802
- ...["channel", "operation", "stage", "method", "transport", "submissionState", "attempts", "lastFailureReason", "reason", "reasons", "host", "durationMs", "timeoutMs", "nodeVersion", "dshVersion", "platform", "dependencies", "proxyConfigured", "truncated", "httpStatus", "providerCode", "resource", "file", "field", "issue", "referenceId", "occurredAt", "rollback", "pluginVersion"].filter((field2) => details[field2] !== void 0).map((field2) => `${field2}: ${typeof details[field2] === "object" ? JSON.stringify(details[field2]) : details[field2]}`)
2902
+ ...["channel", "operation", "stage", "method", "transport", "submissionState", "attempts", "lastFailureReason", "reason", "reasons", "errorTypes", "qrEncoder", "qrRenderer", "host", "durationMs", "timeoutMs", "nodeVersion", "dshVersion", "platform", "dependencies", "proxyConfigured", "truncated", "httpStatus", "providerCode", "resource", "file", "field", "issue", "referenceId", "occurredAt", "rollback", "pluginVersion"].filter((field2) => details[field2] !== void 0).map((field2) => `${field2}: ${typeof details[field2] === "object" ? JSON.stringify(details[field2]) : details[field2]}`)
2803
2903
  ].filter(Boolean).join("\n");
2804
2904
  }
2805
2905
  function ConnectionError({ error: value, warning = false, showMessage = true }) {
@@ -2824,6 +2924,9 @@ function ConnectionError({ error: value, warning = false, showMessage = true })
2824
2924
  ["\u8C03\u7528\u65B9\u5F0F", details.transport === "host-api" ? localizeText("\u5BBF\u4E3B API\uFF08\u8FDB\u7A0B\u5185\uFF09") : details.transport === "http" ? "HTTP" : details.transport === "websocket" ? "WebSocket" : void 0],
2825
2925
  ["\u6D88\u606F\u63D0\u4EA4\u72B6\u6001", localizeText(SUBMISSION_LABELS[details.submissionState] ?? "")],
2826
2926
  ["\u8FDE\u63A5\u5C1D\u8BD5\u6B21\u6570", details.attempts],
2927
+ ["\u5F02\u5E38\u7C7B\u578B", details.errorTypes?.join(", ")],
2928
+ ["\u4E8C\u7EF4\u7801\u7F16\u7801\u5668", details.qrEncoder],
2929
+ ["\u4E8C\u7EF4\u7801\u56FE\u7247\u683C\u5F0F", details.qrRenderer],
2827
2930
  ["\u6700\u8FD1\u4E00\u6B21\u8FDE\u63A5\u5931\u8D25", localizeText(STREAM_REASON_LABELS[details.lastFailureReason] ?? details.lastFailureReason ?? "")],
2828
2931
  ["\u5E95\u5C42\u539F\u56E0", details.reason === "unknown" ? localizeText("\u6682\u672A\u8BC6\u522B") : details.reason],
2829
2932
  ["\u591A\u4E2A\u539F\u56E0", details.reasons?.join(", ")],
@@ -6626,7 +6729,7 @@ var TOKEN_BOT_ENDPOINTS = Object.freeze({
6626
6729
  function createTokenChannelApi(channel7, connectionSummary, {
6627
6730
  normalizeBotExtension = () => ({})
6628
6731
  } = {}) {
6629
- const unwrapRpcResult17 = (result2) => {
6732
+ const unwrapRpcResult18 = (result2) => {
6630
6733
  if (!isRecord2(result2) || typeof result2.ok !== "boolean") {
6631
6734
  throw new Error(`${channel7} \u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94`);
6632
6735
  }
@@ -6697,7 +6800,7 @@ function createTokenChannelApi(channel7, connectionSummary, {
6697
6800
  code: text2(error?.code, `${channel7.toUpperCase()}_ERROR`, 80),
6698
6801
  message: text2(error?.message, `${channel7}\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5`)
6699
6802
  });
6700
- return Object.freeze({ unwrapRpcResult: unwrapRpcResult17, normalizeSnapshot: normalizeSnapshot13, presentError: presentError17 });
6803
+ return Object.freeze({ unwrapRpcResult: unwrapRpcResult18, normalizeSnapshot: normalizeSnapshot13, presentError: presentError17 });
6701
6804
  }
6702
6805
 
6703
6806
  // plugin-src/client/channels/discord/api.js
@@ -16316,7 +16419,7 @@ function installInterfaceLanguageMirror(ctx, {
16316
16419
  }
16317
16420
 
16318
16421
  // plugin-src/client/delivery-settings.js
16319
- var React35 = __toESM(require("react"), 1);
16422
+ var React38 = __toESM(require("react"), 1);
16320
16423
 
16321
16424
  // plugin-src/client/access-policy-settings.js
16322
16425
  var React28 = __toESM(require("react"), 1);
@@ -17009,8 +17112,904 @@ function BotSettingsTabs({ tabs, activeTabId, onChange }) {
17009
17112
  );
17010
17113
  }
17011
17114
 
17012
- // plugin-src/client/channels/feishu/group-settings.js
17115
+ // plugin-src/client/ds-bot-settings.js
17116
+ var React32 = __toESM(require("react"), 1);
17117
+
17118
+ // plugin-src/client/ds-bot-avatar.js
17013
17119
  var React31 = __toESM(require("react"), 1);
17120
+
17121
+ // plugin-src/client/ds-bot-avatar-data.js
17122
+ var SHAPES = {
17123
+ "whale": {
17124
+ "label": "Whale",
17125
+ "body": "M65.3 20.9l5.1 .1 4.8 .9 4.8 1.7 4.3 2.3 3.8 3.1 3 3.4 2.3 3.8 1.6 4.3 .9 4.3 0 4.8-.8 4.8-1.4 4.3-2.3 4.3-3.2 4.3-3.4 3.3-4.3 3.1-7.2 3.5-7.6 1.7-7.2 .1-9.6-1.6-3.3-1-2.9-1.7-8.8-8.9-6-4.7-3.3-.5-7.7 1.1-4.8-.1-4.7-1.2-1.9-1.2-1-1-.5-1.5 .4-1.4 1.1-1.3 1.9-1.3 4.7-1.5 7.7-.6 1.1-.5 .7-1 0-1.4-2.8-7.2-1.2-5.3-.1-4.3 .4-1.4 .9-1.2 1.9-.2 2 1 2.2 2.3 2.2 3.4 3.2 7.6 1.9 9.7 .5-.1 1.1-7.2 1.8-4.8 3.2-5.2 3.9-4.3 4.9-3.9 5.6-2.9 5.8-1.9z",
17126
+ "paints": [
17127
+ [
17128
+ "M93.3 55.8l1-.3 .1 1.2-2.4 5.3-3.4 4.8-3.8 3.8-4.8 3.4-5.7 2.8-4.8 1.5-4.8 .4 20.1-17.4 5.2-3.7z",
17129
+ "#fff",
17130
+ 1
17131
+ ]
17132
+ ],
17133
+ "shade": "M88.6 29.5l2.4 2.9 1.9 2.8 2.4 6.3 .5 3.3 .1 5.3-1.5 6.6-1.9 4.3-2 3.3-4.8 5.4-5.7 4.3-7.2 3.3-6.2 1.5-6.7 .1-3.3-.2-9.6-1.8-3.3-1.5-2.4-1.9-8.6-8.9-5.3-3.9-3.3-.1-2.9 .2-3.3 .8-5.8 0-4.3-1-2.9-1.9 .6-.6 3.8-1.3 10.5-2.5 4.3 .9 1.4-.1 2.2-1.7 .5-1.4-.3-1.5-1.2-1.4-2.2-1.4-1.2-1.9-.6-12 .4-3.3 .5-.5 2.9 3.8 2.4 4.8 1.9 5.7 .7 5.8 .7 2.8 2.1 2.4 2.7 5.5 3.8 4.3 2.9 2.2 3.3 1 3.4-.4 6.2-3 7.1-4.5 7.3-5.6 6.6-5.9 5.9-6.5 3.7-5.3 1.7-4.2 .1-2.9z",
17134
+ "light": "M55.6 22.8l1.9-.3 1.5 .3 .6 1 .1 .9-2 4.3-3.8 5.3-5.8 6.2-5.4 4.4-4.8 2.3-1.4 0-1.2-.5-.8-1.9 .5-3.3 2.5-4.8 3.3-4.3 2.4-2.4 5.3-3.9zM19.3 28.1l-1.4 2 .3-1.1zM21.7 49.1l.6 .5-.3 .5-.8 0zM35.8 52l1.2-.4 .9 .7 .7 1.6-.4 .9-1.2 .1-2.6-.5zM7.2 52.9l-2.9 2.9 1.2-1.6z",
17135
+ "eyes": [
17136
+ [
17137
+ 72.5,
17138
+ 48.4,
17139
+ 9.3,
17140
+ 23,
17141
+ -15.8
17142
+ ],
17143
+ [
17144
+ 85.6,
17145
+ 43.4,
17146
+ 7,
17147
+ 22.9,
17148
+ -21.2
17149
+ ]
17150
+ ]
17151
+ },
17152
+ "star": {
17153
+ "label": "Star",
17154
+ "body": "M40.1 4.4l1.5-.4 1.9 .1 5.2 1.1 1.9 .9 13.2 14.9 17.1-.8 5.2 1.1 1.8 .9 1.7 1.6 .7 2.4-.4 1.9-9.7 23.6 5.6 23.7 .1 1.9-.6 1.4-2.1 1.8-2.3 .5-19.9-1.8-16.6 15.5-1.9 1-1.9 .3-7-1.5-2.6-2.1-.9-2.4-2.8-24.1-16-13.6-1.1-1.5-.5-1.9 .4-1.9 1.2-1.5 18.9-13.6 7.1-24.6 1-1.7z",
17155
+ "shade": "M52 7.7l14.3 16.1 1 2.9 .3 3.1 19.4-1.3 2-1.4 .7-2.3-.4-1 .5 .5 .5 1.9-.4 1.9-9.8 23.2 5.5 23.1 .1 3.4-2 2.4-2.8 .8-19.4-2.1-1.9 1.4-14.7 14-2.4 1.4-3.3 .1-4.7-1-2-1 .6-.2 3.3 .8 2.8 .1 5.1-2.1 .7-.9 .4-2.4-2.6-22.7-.3-.3-1.4 .2-1.4 .7-5.7 .7-5.6-1.2-16.7-13.8 1-.1 5.2 1 3.8-1.1 1-.7 1.9-.4 .4-.4 1.5 .3 .4-.4 1 .2 18-12.8 6.7-23.5 0-1.8-.4-.5-.3-1.9 .4-2.4z",
17156
+ "light": "M40.1 4.4l2-.1 4.7 1 .7 1-.5 1.4-2.8 1.5-6.6 23.1 .7 1.2 .6 .3-18.1 12.5-1.8 2.1-3.4 .7-5.2-1.2-.3-.4 .3-.9 1.4-1.4 18.3-12.9 .9-2.3 6.4-22.7 .8-1.4z",
17157
+ "eyes": [
17158
+ [
17159
+ 53.9,
17160
+ 53.4,
17161
+ 7.2,
17162
+ 18.8,
17163
+ -10
17164
+ ],
17165
+ [
17166
+ 65.1,
17167
+ 49.2,
17168
+ 7.2,
17169
+ 18.8,
17170
+ -10
17171
+ ]
17172
+ ]
17173
+ },
17174
+ "moon": {
17175
+ "label": "Moon",
17176
+ "body": "M45.8 4.2l4.7-.2 4.2 .4 10.2 2.4 3.7 1.6 3.6 2.1 3.3 2.5 3 3.1 4.6 6.7 3.4 8.3 1.5 8.8 .1 4.6-.8 7.8-2.6 8.8-3.9 7.7-5.1 6.7-6.1 5.3-4.1 2.6-3.6 1.6-27.2 10.2-2.8 .7-2.6 0-5.7-1.3-2-.8-1.9-1.7-1.1-2.6-6.5-37.7-.2-5.2 .8-7.7 1.3-5.2 3.1-7.8 4.2-6.7 3-3.6 3.9-3.6 6.3-4.2 4.1-1.8z",
17177
+ "paints": [
17178
+ [
17179
+ "M57.6 9.9l.2-.3 .2 .3 2 4.7 1.9 1.9 2.6 .5 1.5-.7 1.1-1.1 .4 .4-.1 1.6-.7 1.5-2.2 2.5-1.6 .7-2 0-1.6-.8-1.3-1.4-.8-2-.4-2.6 .1-3.1z",
17180
+ "#1783FF",
17181
+ 1
17182
+ ]
17183
+ ],
17184
+ "shade": "M74.3 13.5l2.1 1.5 .3-.4-.3-.6 2.1 2.1 4.6 6.7 3.1 7.4 1.5 7.6 .1 10.4-.6 4.6-2.5 8.3-4.2 8.2-3.1 4.2-5.7 5.7-6.2 4.2-4.6 2-28 10.3-4.1 0-5.2-1.1-2-.9-.5-.7 .5 .5 1.5 0 3.6 1 2.6-.3 5.7-2.1 2.1-2.1-5.4-31.5-.2-4.1 .4-1.1-.1-2.6 .5-3.6 1.8-7.7 2.8-6.7 1.9-3.1 3.9-5.2 3.2-3.1 2.5-2 5.2-2.9 3.1-1.1 3.1-.8 2.1 0 .5-.4 2.6 .2 1-.3 1.6 .4 1-.5 2.1 .8 1-.8 2.1 1.2z",
17185
+ "light": "M38 6.3l1.7-.3 2.5 .2 .6 .4 1.5 0 .5 .5 1.6 .3-3.1 1.3 .4 .7-2.5 1.6-.5 1-2.5 2.1-2.7 2.9-6.2 7.9-1.5 2.7-1 .9-1.2 2.6-1.4 1-1.3 3.7-1.3 .3-6-1.4-1 3.6-.8 0 .9-3.6-.5-1 1.1-3.6 2.7-5.7 4.1-6.2 5.7-5.8 3.1-2.4 3.6-2.2z",
17186
+ "eyes": [
17187
+ [
17188
+ 51.6,
17189
+ 48.5,
17190
+ 8.4,
17191
+ 22.1,
17192
+ -10
17193
+ ],
17194
+ [
17195
+ 66.8,
17196
+ 42.9,
17197
+ 8.4,
17198
+ 22.1,
17199
+ -10
17200
+ ]
17201
+ ]
17202
+ },
17203
+ "wave": {
17204
+ "label": "Wave",
17205
+ "body": "M46.1 4l6.1 .3 9.6 2.1 4.5 1.8 4.1 2.4 3.5 2.8 4.4 4.8 2.6 4 2.1 4.1 2.2 6 4.8 26 .5 5.3-.3 4.1-1.2 3.8-1.5 2.8-2.4 2.5-2.1 1.4-3.1 1-3 .3-8.1-1.5-3.2 5.3-2.1 2.1-2.5 1.5-2.8 1-3 .4-9.1-1.6-2.7 4.2-3.4 3.1-4 1.7-4.6 .1-7-1.5-3.5-1.9-3.4-3.5-2.1-4-1.5-5.6-3.7-20.7-.6-5.6-.1-5 .5-6.1 2.3-9.6 2.3-5.5 2.7-4.9 2.7-3.7 3.2-3.6 4.2-3.6 4.7-2.9 4.4-2 4-1.2z",
17206
+ "paints": [
17207
+ [
17208
+ "M61.6 48.5l2.2-.3 2 1.1 1.1 2.2 .3 3-.6 3.1-1.5 3.5-2.5 4.1-2.4 2.8-5-2.2-3-2.2-2.3-3-.7-3.5 .6-2.6 1.8-2.1 1.6-.7 1.5 0 1.5 .6 1.5 1.3 2-3.6z",
17209
+ "#fff",
17210
+ 0.4
17211
+ ]
17212
+ ],
17213
+ "shade": "M69.3 13.6l2.6 1.3 .5-.3 .5-1.3 2 1.7 .5 0 2.5 2.7 3.5 5.5 3.6 8.6 1.5 6.6 3.5 19.7 .5 5.5-.4 4.6-2 5-1 1.6-2.6 2.5-3 1.5-2.1 .5-4 0-6.6-1.4-1.4 2.9-1.9 2.5-2.7 2.6-3.1 1.5-2.5 .6-4 .1-7.1-1.5-1.5 2.8-2.6 3-2 1.6-3 1.4-4.5 .6-7.1-1.5-3.6-1.5-3.5-3.1 6.6 1.5 2.8-.5 .5-.5-.3-.5 3.2-2-.4-1 1.4-1.5-.3-1 .7-1.6-.2-2.5-3.4-19.2 .3-.5-.6-5 .5-.5-.1-4.6 .4-.5 .3-4 1-4.1 1.5-4.5 3.8-7.7 5.5-6.9 3.1-2.6 6.5-3.9 7.6-2.2 3.1 0 .5-.4 3 .5 1-.5 2.5 1z",
17214
+ "light": "M36.5 6.1l2-.3 .5 .6 4.1 .5 1 .7-3.3 1.5-.3 1.2-3 2-.3 .8-2.8 2.6-3.5 4-3.9 5-2 3.6-1 .5-1.7 4-1.5 .5-1.4 4.6-1.6 .2-.5-.4-5.6-.9-.4-.4 1.4-5.1 1.5-3.5 2.6-5.1 4-5.5 6.6-6.2 4-2.5z",
17215
+ "eyes": [
17216
+ [
17217
+ 47.5,
17218
+ 37.2,
17219
+ 8.4,
17220
+ 22.1,
17221
+ -10
17222
+ ],
17223
+ [
17224
+ 61.6,
17225
+ 31.9,
17226
+ 8.4,
17227
+ 22.1,
17228
+ -10
17229
+ ]
17230
+ ]
17231
+ },
17232
+ "squircle": {
17233
+ "label": "Squircle",
17234
+ "body": "M54.5 4.2l3.9-.2 3.7 .3 11.6 2.7 3.1 1.6 2.8 1.9 2.6 2.7 2.2 3.1 2.4 4.8 1.9 5.8 3.7 19.4 .8 11.1-.4 4.7-1 4.7-1.3 3.5-1.8 3.4-4.8 5.8-6.4 4.7-8 4-14.2 5.3-9.5 2.2-7.4 .1-10.5-2.2-5.3-2.5-4.3-3.7-3.3-4.8-2.7-6.3-2.4-9.5-2.8-17.9-.2-7.8 1.3-7.9 2.2-5.3 2.8-4.2 4.1-4.2 4.3-3.1 6.3-3.4 11.6-4.6 7.9-2.7z",
17235
+ "shade": "M80.5 11.6l2.1 2.1 2.1 3.2 3.2 7.3 2.1 8.4 2.7 15.8 .5 7.9-.6 7.4-2 6.3-3.8 6.3-4.2 4.3-2.6 2-6.9 3.8-15.2 6.2-9.5 2.7-6.8 .6-6.2-.7-8.5-2-5.8-3.2-3.2-3.3 .5 .4 1.1-.2 5.8 1.4 2.1-.8 1.4-.7-.3-.5 1.4-1.1-.1-1 .8-.5 0-1.1 1.1-1 .1-2.1 .4-.6-.2-3.6-2.4-17.9-.2-9.5 .8-5.3 1.1-3.6 1.2-2.7 2.2-3.5 2.7-2.8 3.1-2.5 5.8-3.2 17.9-6.9 5.3-1.4 8.4-1.4 1.6-1.1 .5 .1 .9-1.5z",
17236
+ "light": "M39.4 8.4l1.2 0-1.6 .7-1-.1 1-.1zM36.8 9.5l1 0 .6 .9 4.2 .6 .7 .6-3.8-.4-.3 .4 1.9 .3 .1 .7-3.2 1.6-6.9 5.8-5.3 6-4.7 6.1-3.8 3.7-.2 .5-1.8 .1-6.8-1.7 .4-3.6 2.1-4.2 2.2-3.2 4.2-4.3 4.2-3 3.1-1.8 5.3-2.5zM35.1 10.5l1.7 0-.5 .4zM36.5 11.1l.3-.5 2.2 .1 .4 .4-.4 .3z",
17237
+ "eyes": [
17238
+ [
17239
+ 52.6,
17240
+ 52.4,
17241
+ 8.4,
17242
+ 22.1,
17243
+ -10
17244
+ ],
17245
+ [
17246
+ 67.3,
17247
+ 46.9,
17248
+ 8.4,
17249
+ 22.1,
17250
+ -10
17251
+ ]
17252
+ ]
17253
+ },
17254
+ "zed": {
17255
+ "label": "Bull",
17256
+ "body": "M77 4.4l1.1-.4 1.1 .2 1.2 1.3 2 9.8 2.2 5.9 .4 2.8-.3 2.1-.8 1.7-4.7 5.1-1.3 1.9-.4 1.7 .1 1.6 1 1.7 4.4 .2 3.8 1.3 2 1.7 .6 1.6-.3 1.7-.7 1.1-3.5 2.7 1.7 6 .4 5.9-.8 6.6-1.9 6-3.4 5.9-4.4 5.3-5.5 4.4-6 3.1-6.5 2-7.1 .7-6.5-.7-6.5-2.1-6-3.4-4.8-4.4-3.5-4.9-3.1-6.7-3.3 1.1-2.7 .3-2-.6-1.1-1.1-.3-2.2 .9-2.7 2.9-3.8 4.6-3.8 1.8-7.1-6.3-1.8-1.6-1.3-1.3-1.8-.6-2.7 0-6.6-1.4-8.7 .2-1.1 1.5-1.4 1.1-.1 1 .5 5.5 7.9 2.2 2.2 2.7 1.4 4.9 .4 .5-.1 6.5-5.1 6.6-3.2 6-1.6 8.7-.7 3.8-.9 2.7-1.5 3.9-3.2 3-3.8 2.4-4.9 2.1-10z",
17257
+ "paints": [
17258
+ [
17259
+ "M61 36.5l1.9 .7 1.4 2-.7 5.4 .3 .4 2.8-1.2 1.1 0 1 .9 .5 1.6-.5 .8-1 .5-7.1 2.4-1.1-.5-.9-1.6 1.4-5.4-.5-.6-3.3 1.1-1.1-.1-1.6-1-1-1.6 .5-.9z",
17260
+ "#fff",
17261
+ 1
17262
+ ]
17263
+ ],
17264
+ "shade": "M80.2 5.5l.6 1.6 1.3 8.2 2.5 6 .2 3.7-.1 1.1-1.2 2.2-5.2 5.4-1.1 3.3 .9 2.7 3.8 3.9 1.6 .1 4.4-1.4 1.2 1.2 .1 1.1-.2 1.7-.6 1.1-3.6 2.7 .9 2.2 1.1 5.4 .1 6-1.1 6.5-2.3 6-3.8 6-6 6-4.9 3.3-5.9 2.6-7.1 1.7-7.1 .1-6-1.1-5.9-2.3-4.4-2.7-4.4-4.5 3.8 .4 5.5-1.5 7.6-3.9 6.8-4.7 7.9-6.5 7.1-6.9 5.4-6.5 4.4-6.7 1.8-4.4 .4-3.2-.3-1.1-3.3-3.8-.8-2.8 .8-2.7 6.2-7 .8-2.2-.1-2.7-1.7-4.4-.8-8.2zM14.9 29.9l.1-.5 4 6.5 2.3 2.7-1.4 .1-2-.6-3.6-7.1zM24.3 44.6l1-.3 1.1 .2 3.3 2.9 1.7 .5 .3 1.6-.5 2.2-1 1.6-1.6 1.5-1.6 .7-1.7 .1-3.2-2.2-2.2 0-2.7-.6-2.9-1.6 3.9-1.6 2.2-1.7 2.2-2.3zM21 68.6l.5-.5 1.1 .1 1.1 .5 .8 1 .6 2.7-.1 1.1-.7 1.1-.6 .1-2.2-1.2-2.7 1.1-3.8 .6-2.7-1.2 3.4-1.6z",
17265
+ "light": "M77 4.4l.6-.2 .1 .7-1.2 .8-.1-.8zM74.2 15.8l.6 1.1 .1 2.7-.6 2.2-1 1.6-5.5 5-1.7 .7-3.3 .3 .1-.6 2.1-1.2 4.2-3.6 2.7-3.9zM11.7 28.9l.8 0-.1 .5-1.2 .8-.1-.8zM44.3 32.1l3.1 0 .8 1.1 0 1.1-1.9 4.3-3 4.1-1.7-1.1-2.1-.8-4.4-.6-4.4 .1 5.5-4.4zM22 54.4l.6 0-.3 .6 .2 .5 2.3 2.7 .4 1.7-1 .9-4.8 2.3-7.1 7.8 0-1.8 2.1-3.3 6.4-5.4 1.2-4.3z",
17266
+ "eyes": [
17267
+ [
17268
+ 61.8,
17269
+ 69,
17270
+ 9.5,
17271
+ 22.3,
17272
+ -10.5
17273
+ ],
17274
+ [
17275
+ 78.4,
17276
+ 62.7,
17277
+ 6.9,
17278
+ 22.2,
17279
+ -11.2
17280
+ ]
17281
+ ]
17282
+ },
17283
+ "hex": {
17284
+ "label": "Blossom",
17285
+ "body": "M38.8 4.2l2.6-.1 6 1.3 2 1.3 3 3.3 12-4.5 2-.5 6.5 1.1 2.9 1.6 4.9 6 .8 2 .3 2-.2 2.5-1.9 7-1.3 2.2-1.9 1.8 2.9 1.3 1.8 1.7 10.1 12.5 1.5 3 .1 4-1.8 7-.9 2-2.8 2.7-7.1 2.7-5.2 20-.8 2-1.4 1.9-1.5 1.1-6.5 2.6-3 .2-6.5-1.6-2-1.4-4-4.9-16 5.7-2 .1-4.5-1-3-1.2-5.2-6-1.3-3 0-3.5 2-8.5-10.8-13.4-1.4-3-.3-2 .3-2.5 1.7-6.5 1.8-3 2.2-1.8 5.9-2.2 2.1-.4 2.5 .3 .4-.4-.7-2.5 .1-2.5 4.8-18.5 1-2.5 2.9-2.9z",
17286
+ "shade": "M49.7 7.7l.2-.4 .5 .4 2 2.3 0 .7 1.6 1.5 1 2 .1 1.5-.3 .5 .6 1.3 17.5-6.5 2.5-1.3 1-1.5 4.5 6 .6 1.5 .3 3-1.9 8-1 2-3 3-.3 1 .4 .5-1.7 3 .1 .5-.5 .5 0 .7 5.5-2.2 1.5-1.5 2 2 8 10 1 1.5 1 2.5-.1 4-1.9 7-1.1 1.9-2.9 2.5-6.8 2.5-4.7 19-1.5 3.5-2.5 2.5-6.5 2.6-4 0-5.5-1.4-2.2-1.7-3.2-4 4.9 .8 2.5-1.4 1.5-2.6 .7-2.3 1.7-6.5-.4-.3-.6 .8-.7 3.5-1.1 1.5 .3 .5-.3 .5-.7-.5-1.4-5.5-.5 1-.2 2-.9 1-.1 1.5-1.1 2-2.7 2.8-1 .4-1 .1-15.5 5.8-3-.1-4.5-1-2-1-2-2-2.2-3 .2-.2 4 .9 2-1.1 1.7-1.6 1.3-3.2 1.7-6.3 1.1-2.5-.3-.3-.5 .2-6.5-.3-.5-.5-2 0-.5-.5-1.7-.1-10.4-13.4 4.1 .7 3.1-1.7 1.3-2 2.5-8.5 .9-1.5 1.7-1.3 6.5-2.7 2-1.5-.3-.5 .3-.5 1.5-1.2 1.5-3 5.6-20.3 1.9-2 6-2.4 1.1-.6zM73.2 31.2l1.5 0-.8 1-34 12.7-1 .1-1.5-.5-2 .8-1.9-2.6 .4-.9 2 .5 1.5 1 .5-.4 1 .5 1-.3 1 .4 3-1.5 1 .1 3-1.6 1 .1 3-1.6 1 .1 3-1.6 2.5-.5 1.5-1 2.5-.5 1.5-1 2.5-.5 1.5-1 2.5-.5 1.5-1 1 0zM61.3 74.6l.1-.2 .4 .2-.4 1.7z",
17287
+ "light": "M33.4 6.2l3 .1 1.9 .9-.1 .5-1.8 2.5-3.4 3.5-4.5 17-3.6-.9-1 .4 0-1 4.4-16.5 0-1.5 2.1-3.1zM68.2 6.2l1.2 0zM14.9 37.7l3.5 .9 .4 .6-.3 1-5 5.5-1.1 4.6-2.5-.5-2 .1 0-1.7 1-4.5 1-2.5 2-2.1zM19.4 71.6l4 .7 1.8 .8-1.2 1-1.1 5.1-4.5-.5-.5-.6 1.4-5z",
17288
+ "eyes": [
17289
+ [
17290
+ 49.8,
17291
+ 55.5,
17292
+ 6.7,
17293
+ 17.7,
17294
+ -10
17295
+ ],
17296
+ [
17297
+ 61.6,
17298
+ 51.1,
17299
+ 6.7,
17300
+ 17.7,
17301
+ -10
17302
+ ]
17303
+ ]
17304
+ },
17305
+ "gumdrop": {
17306
+ "body": "M38.7 4.5l4.4-.5 4.6 .8 4.1 1.9 3.7 3.2 23.2 36.6 2.3 5 1.4 5.1 .7 6.4-.7 6.4-1.8 6.1-3.1 5.7-4.1 5.1-5.2 4.2-5.8 3.1-6 1.8-6.4 .6-6.4-.6-6-1.8-5.9-3.1-5.1-4.2-4.1-5.1-3-5.4-1.9-6.4-.7-6 .5-5.9 9-41.6 2-4.1 2.6-3.2 3.4-2.5z",
17307
+ "shade": "M54.9 9.5l1.9 2.3 22.9 36.5 1.8 4.6 .9 3.7 .6 4.1-.1 5.9-1.4 6.4-2.3 5.5-3.7 5.4-4.1 4.2-4.5 3.3-7.3 3.2-6.4 1.2-6.4 0-5.1-.9-5.9-2.1-5.5-3.3-4.6-4.1 .5-.3 4.1 .8 5.5-1 6.4-2.6 7.3-4.5 7.2-5.7 6.5-6.4 5.5-6.9 3.5-5.9-18.1-37 1.1-3.7 .2-2.3z",
17308
+ "light": "M37.1 4.9l2.5 0 .8 1.4-.5 2.1-1.8 2.9-3.2 3.2-3.2 2.1-2.3 .7-1.8-.1-.7-.9 .1-1.8 2.4-4.1 2.7-2.8z",
17309
+ "eyes": [
17310
+ [
17311
+ 52.1,
17312
+ 40.3,
17313
+ 9.7,
17314
+ 22.9,
17315
+ -15.2
17316
+ ],
17317
+ [
17318
+ 64.8,
17319
+ 35.6,
17320
+ 6.3,
17321
+ 23,
17322
+ -27
17323
+ ]
17324
+ ]
17325
+ },
17326
+ "peanut": {
17327
+ "body": "M43.5 4l6.6 .7 5.8 2.2 5.4 3.8 4.1 4.7 2 3.8 1.4 4.3 1.3 11.9 1 4.3 1.6 3.8 5.8 10.5 1.4 3.8 .8 4.3 .1 6.2-1 5.7-2.1 5.5-3.2 4.9-4.1 4.3-4.8 3.4-5.6 2.4-5.7 1.3-6.1 .1-5.8-1.1-5.7-2.2-4.7-3.1-4.3-4.1-3.3-4.8-2.5-5.7-1.2-5.7-.1-6.7 1.7-9 .4-4.3-.5-4.7-2.5-9.6-.6-3.8 .2-5.2 1.2-5.2 1.5-3.4 2.2-3.3 2.5-2.9 2.8-2.3 3.4-2.1 3.4-1.4 3.8-.9z",
17328
+ "shade": "M62.7 12.6l2.6 2.8 2.8 5.8 1.1 4.2 1 11.9 1 3.4 2.3 4.7 4.2 6.7 1.9 4.7 .9 3.8 .2 2.9-.1 6.2-.5 3.3-1.9 5.3-3.4 5.7-3.4 3.8-4.2 3.3-5.7 2.9-4.8 1.4-5.7 .6-6.2-.6-3.8-1-5.2-2.3-4.8-3.4-2.9-2.8 3.9 .8 5.2-.7 6.2-2.5 5.7-3.3 6.7-5.1 6.2-5.9 5.1-6.2 3.5-5.7-1.1-2.8-2.4-2.4-3.2-1.7-11.5-4.1-2.7-1.8-1.6-2.4-.2-2.4 .8-2.9 7.8-8 4.9-7.7 1.6-5.2z",
17329
+ "light": "M35.9 5.4l3.2-.2 1.3 .7 .5 1-.5 3.3-2.9 4.8-4.1 4.1-4.8 3.3-4.2 1.5-1.5 0-1.4-.6-.7-1.2 .2-2.4 1.9-3.8 2.4-3.3 4.3-3.9z",
17330
+ "eyes": [
17331
+ [
17332
+ 50.9,
17333
+ 31.5,
17334
+ 8.7,
17335
+ 20.5,
17336
+ -11.9
17337
+ ],
17338
+ [
17339
+ 64.2,
17340
+ 26.5,
17341
+ 5.7,
17342
+ 20.3,
17343
+ -16.3
17344
+ ]
17345
+ ]
17346
+ },
17347
+ "saucer": {
17348
+ "body": "M45 22.7l6.7 .1 6.7 1.9 4.3 2.5 3.5 3.1 2.8 3.5 2.5 4.5 6.8 .9 5.6 1.2 4.5 1.6 3.5 2.1 2.8 2.8 1.3 3.5-.5 3.5-2 3.5-2.6 2.8-3.5 2.8-4.5 2.8-5.1 2.6-12 4.4-13.6 3.1-13.6 1.5-12.6-.3-5.5-.7-5-1.2-4.1-1.6-3.5-2-2.8-3.1-1.1-3 .5-3.5 2-3.6 2.7-3 3.7-2.9 10.3-5.6 .7-5.1 1.5-4.5 2.6-4.5 3.1-3.5 3-2.4 3.5-2 3.5-1.4z",
17349
+ "shade": "M66.5 31.3l.3-.2 .6 .7 1.9 2.5 2 4.5 1.6 1.5 .1 1.5-1.7 1.7-3 1.2-3.1 .5-3.1-.3 4-8.1 .7-3.5zM94.9 47.4l1.1 3-.5 3.5-2.1 3.5-4 4.1-5 3.5-6.1 3.1-7 2.9-6.6 2.1-8 2-9.1 1.5-6.5 .6-11.6 0-4.5-.2-8-1.4-4.6-1.5-3.6-2.1 4.1 1.2 5.1 .8 7 .3 6-.2 15.1-1.9 15.6-3.6 14.5-5.1 5.4-2.5 5.3-3.1 4-3 2.3-2.5 1.2-2.1zM7.3 71l.7 .5z",
17350
+ "light": "M40.6 23.7l2.8 0 .8 .5 .7 1.5-.8 3.6-2.6 4-3.9 4-4.5 3.2-4.6 1.7-2.5-.4-1-1.4 0-1.6 .9-2.5 2.1-3.5 2.6-3 3-2.6 3.5-2.1zM22.4 47.4l.7 0-.5 .5 0 1.5 .4 .8 2 1.4 3 1.2 9.1 2 15.1 1.1-.2 1.5-2.2 3.6-3 2.5-4.9 2.5-6 2-7.9 1.5-6.5 .5-7.1-.4-4.9-1.1-3-1.5-1.6-1.7-.6-2.3 1.1-3.1 2.9-3.5 4.1-3.5 4.1-2.6z",
17351
+ "eyes": [
17352
+ [
17353
+ 53.6,
17354
+ 45,
17355
+ 7.8,
17356
+ 18.4,
17357
+ -14.5
17358
+ ],
17359
+ [
17360
+ 66.2,
17361
+ 40.3,
17362
+ 5,
17363
+ 18.3,
17364
+ -25.1
17365
+ ]
17366
+ ]
17367
+ },
17368
+ "bunny": {
17369
+ "body": "M49.3 4.4l1.5-.4 2 1.2 1.6 2.7 1.2 3.4 1.6 8.9 .2 6-.2 6.4 .6 3 2.4 2.5 5.4 3 3.4 2.4 5.1 5.5 2.4 3.9 1.7 4 1.1 4.4 .4 4.5-.5 5.9-1.6 5.5-2.8 5.4-3.6 4.5-4.6 3.8-4.9 2.7-5.5 1.7-5.9 .7-6-.5-5.4-1.7-4.9-2.5-4.7-3.7-3.8-4.5-2.7-4.9-1.8-5.5-.7-5.9 .6-6.5 1.9-5.9 3.1-5.4 4.6-5.5-.4-2-3.4-8.4-1.8-6.9-.6-6.9 .3-3 .6-2 1.3-1.4 2-.1 2.5 1.5 2.1 2.5 4 6.9 2.1 5.5 1.7 5.9 1.5 2.1 1.8-1.6 .7-2-.4-12.4 1-8.9 1.6-4.9z",
17370
+ "shade": "M52.7 5.4l2.1 3.5 1.9 7.4 .7 7.9-.5 8.4 .8 3.6-4.4-2.5-2.1-2.6 1.4-17.3zM31.2 15.3l.3-.5 2 2.5 2.9 4.9 2.5 6 1.7 6.4 1.4 2.5 0 .5-1.1 .9-4.5 1.9-2.4 .2-1.2-.6zM71.5 46l3.6 4.4 2.9 6 1.5 6.4 .1 5.5-1.1 6.3-2 5-3.4 5.4-3.5 3.6-4 2.9-6.4 3-4 1-6.9 .5-5.9-1-5.5-2-5.4-3.5-3.6-3.4 2.6 .7 2.5 .1 2.9-.5 4-1.3 8.4-4.6 8.7-6.8 7.4-7.9 5.3-7.9 1.3-3 1-3.5 .2-2.9-.2-2z",
17371
+ "light": "M49.3 4.4l.6 0-3.6 6.2 1-3.7zM26 13.3l.5-.4 .2 .4-1.7 2.2 0-.7zM44.8 34.6l.5-.1 1.2 1.1 .8 1 0 .7-.5 .3-4-.5zM45.1 42.5l.8 0-.3 1-2.4 4.5-3.8 4.4-4.1 3.5-3.8 2.4-4 1.6-2.9 .1-1.8-1.1-.4-2.5 1.1-3.5 3.5-5.4 3-3.1 .2 1.6 .8 .8 3 .1 4.4-1.2z",
17372
+ "eyes": [
17373
+ [
17374
+ 59.2,
17375
+ 69.2,
17376
+ 8.2,
17377
+ 19.3,
17378
+ -12
17379
+ ],
17380
+ [
17381
+ 72.9,
17382
+ 64,
17383
+ 5.6,
17384
+ 19.1,
17385
+ -15.4
17386
+ ]
17387
+ ]
17388
+ },
17389
+ "kitty": {
17390
+ "body": "M62.4 4.2l1.6-.1 1.5 1.2 7.4 21.3 3.7 6.4 6.2 7.4 3.1 5.9 1.5 4.8 .7 5.3-.2 5.4-1.1 5.3-3 7.4-4.4 6.4-5.3 5.4-6.9 4.6-7.5 3.1-8 1.7-8 .2-7.4-1.4-4.3-1.5-3.7-1.8-3.8-2.5-3.1-2.7-2.7-3-2.5-3.7-1.9-3.7-1.4-4.3-.9-5.3 .1-5.8 1.4-7 1.6-4.2 2-3.8 .8-3.2 .2-20.2 1.1-1.4 1.1-.3 1.1 .3 12.2 9.7 5.9-2.5 8-2.1 3.2-1.8 2.3-2.4 8.3-16z",
17391
+ "shade": "M64.9 5.8l.1-.3 .7 .3 6.5 19.7 3.1 5.9 2.5 3.2-1.6-.8-2.6-2.4-5.1-8zM79.4 36.7l2.2 2.1 1.6 2.2 3.3 6.9 1.5 6.9-.1 6.4-1.6 7.5-3.1 6.9-3.8 5.3-5.3 5.4-6.4 4.3-7 3.1-6.3 1.6-4.3 .6-5.3 0-7.5-1.1-5.8-2-5.9-3.3-5.9-5.4 2.7 .7 3.2-.1 3.7-.8 5.2-1.9 10.3-5.5 11-7.8 10.7-9.6 7.8-9.1 3-4.6 1.6-3.4 .7-3.2z",
17392
+ "light": "M62.4 4.2l.5-.1 0 .6-.8 1.1-4.5 14.4 .2 2.7-.3 1.6-1.1 1-2 .6-6.9-.5 2.6-1.3 3.1-3 8.1-16zM18.7 20.7l1.1-.5 0 .8-1.1 .9-.6-.1zM39.5 27.7l2.6-.3 1.9 .8 .4 1.6-.7 1.8-4.2-1.5-5.4 .2 0-.5zM16 47.4l.3 4.2 1.6 2.2 3 2.1-.6 .5-3.7 .6-1.1-.3-1.1-1.1-.4-1.8 .4-2.7z",
17393
+ "eyes": [
17394
+ [
17395
+ 59.6,
17396
+ 65.1,
17397
+ 9.4,
17398
+ 22.6,
17399
+ -11.9
17400
+ ],
17401
+ [
17402
+ 77.5,
17403
+ 58.4,
17404
+ 7,
17405
+ 22.5,
17406
+ -14
17407
+ ]
17408
+ ]
17409
+ },
17410
+ "beacon": {
17411
+ "body": "M40 4.1l2.7 0 2.5 .9 2 1.7 1.1 2.1 .5 2-.2 2.1-2.1 4.1-.4 1.6 1.5 7.7 9-3.1 4.1-.2 18.5 4 3.1 1.6 2.4 2.3 1.3 2.1 .9 2.6 5.8 33.4-.4 3.1-1.3 3.1-2 2.5-2.6 1.9-41.7 15.7-4.1 .7-19.6-4-3.5-1.9-2.5-2.5-1.2-2.1-.8-2.6-5.7-32.9 .4-3.1 1-2.7 1.7-2.5 2.4-1.9 28.4-10.9-1.5-9.3-.7-1-3.5-3.3-.9-1.9-.4-2 .5-2.6 1.1-2.1 1.7-1.5z",
17412
+ "shade": "M47.1 7.2l.4 0 .8 1.6 .3 2-.2 2.6-2.5 4.7 1.5 8.2 0 2 .5 .6 .1 1.5 .5 1-1.2 .4-1.3-.4-.3-.5-1.9-10.3-4.1-1.5-3.2-2.6 3.1-.9 3.2-2.2 2.5-2.6zM84.2 30.9l1.2 1.1 1.5 3.6 5.7 32.4 0 2.6-1 3.6-1 1.5-3.1 3.2-4.2 1.9-40.6 15-4.2 0-16.4-3.6-3.6-1.4-2.6-2.2 .5 .4 17.5 3.4 3.8-1.2 5-3.4 1-1.3-5.4-30.3 .2-.6 3.1-3.4 40.2-15.1 2-3.6z",
17413
+ "light": "M38.5 4.7l2 0-.1 1-.8 1.4-2.6 2.2-1 .4-1.1-.1-.1-.8 .7-1.6 1.5-1.6zM55 23.7l1.1 .1-1.6 .6-.9-.2 .9 0zM52.4 24.7l1 0-3 1.2-.9-.1 2.4-.6zM48.3 26.3l1 0-1.5 .6zM40 29.4l1.1 0-3.1 1.2-.9-.2 2.5-.5zM35.9 30.9l1 0-3 1.2-.9-.1 2.5-.6zM31.8 32.5l1 0-3 1.2-.9-.2 2.4-.5zM40.2 33l.4-.4 1-.1 1.6 .8 3 .7-1.5 .5-4.1 0-.9-1zM27.7 34l1 0-3 1.2-1-.2 2.5-.5zM23.6 35.6l1 0-3 1.1-1-.1 2.5-.5zM19.4 37.1l1 0-2.4 .8-.5 .7 15.4 3.3 .5 .3 .3 1.1-1.1 2.6-3.3 3.3-3.1 1.5-17.5-3.6-.6-1.2 .5-1.6 3.2-3.7 2.1-1.4 2.5-1.1 1 0 .6-.5 1 0z",
17414
+ "eyes": [
17415
+ [
17416
+ 55.5,
17417
+ 65.3,
17418
+ 8.4,
17419
+ 22.1,
17420
+ -10
17421
+ ],
17422
+ [
17423
+ 74.2,
17424
+ 58.3,
17425
+ 8.4,
17426
+ 22.1,
17427
+ -10
17428
+ ]
17429
+ ]
17430
+ },
17431
+ "plus": {
17432
+ "body": "M44.6 4.3l3.3-.1 11.9 2.5 2.5 1.3 1.3 1.4 .7 1.6 2.1 11.4 4.1-1.2 2.1 0 12.3 2.6 2.8 1.6 1.2 1.5 .7 1.5 3.8 21.6-.5 3.1-1 1.5-1.3 1.3-17 6.6 3.4 20.4-.4 2.5-1.2 2.1-2.3 1.6-19 6.9-2-.2-11.9-2.5-2.5-1.3-1.3-1.4-.7-1.6-2.1-11.4-4.1 1.2-2.1 0-12.3-2.6-2.8-1.6-1.2-1.5-.7-1.5-3.8-21.6 .5-3.1 1-1.5 1.3-1.3 17-6.6-3.4-20.4 .2-2 1.1-2.2 2.6-2z",
17433
+ "shade": "M63.2 9.4l.7 .6 .5 1.5 2.1 13.3 .6 .6 0 2.5 .5 .5 .1 2.6 .5 .5 .1 2.1-.8 3.1 19-7.1 1-1.2 1-2.1 1.1 2.1 .4 2.6 3.2 18 0 3.1-1 2-2.2 2.1-15.9 5.8-.8 .8 3.6 19.5-.1 2.6-1.5 2.6-2.2 1.6-16.4 6.1-2.1 .6-2.5 0-12.4-2.7-2.2-1.5 12.5 2.5 2.4-1 2.7-2-3.9-22.1-3.8 3.5-1 .4-2.6 .5-1.5 1-2.6 .5-1.5 1-2.6 .4-1.5 1-4.6 1.5-2.5 0-11.9-2.6-2.7-1.6 12.4 2.3 2.6-.9 2.4-1.9-3.4-20.5 .3-.5 1.7-1.8 18.6-6.9 .3-.6-.7-1-3.8-22.1 2.1-2.1 16.4-6.1 .6-.5z",
17434
+ "light": "M28.4 10.5l1.1 .5 10.2 2.1 .5 .4-.1 1.1-1.9 2.3-2.1 1-12.3-2.5-.1-1.3 1-1.6 1.2-1zM11.4 43.3l11.4 2.2 1 .6 0 .8-1.5 2.3-2.6 1.4-12.3-2.6-.2-1.1 .6-1 2.2-2.1z",
17435
+ "eyes": [
17436
+ [
17437
+ 54.5,
17438
+ 53.1,
17439
+ 6.1,
17440
+ 15.9,
17441
+ -10
17442
+ ],
17443
+ [
17444
+ 64.5,
17445
+ 49.4,
17446
+ 6.1,
17447
+ 15.9,
17448
+ -10
17449
+ ]
17450
+ ]
17451
+ },
17452
+ "magnet": {
17453
+ "body": "M71.9 4.2l1.2-.2 12.1 2.6 .5 .3 .6 1 6.2 35.6 .6 5.8-.1 5.7-.7 5.8-1.5 5.7-2.2 5.8-4.2 7.3-5.5 6.5-6.5 5-7.1 3.4-6.3 1.3-6.3 0-15.2-3.1-5.2-1.8-5.2-3-4.6-4.1-4-5.2-2.9-5.8-2.4-7.8-6.4-36.2 25-9.5 13.1 2.9 .5 .9 6.3 35.3 1.8-3.9 .5-4.7-6.3-36.1 .4-.6z",
17454
+ "shade": "M86.2 9.5l.5 1 5.8 33 .6 4.7 0 5.2-.6 5.8-2.1 8.4-3.1 7.3-3.7 5.8-6.3 6.8-5.7 4.1-5.8 2.7-6.8 1.5-6.3 0-15.2-3.1-5.7-2-5.2-3.2-5.9-5.8 .1-.7 11.5 2.5 .3-3.4-1.9-13.6-5.7-32.4 1-.1 18.3-6.9 .9-.9 .4-1 6.1 35 1.6 2.1 .1 .6 4 4.7 3.2 1.1 3.6-.6 3.2-1.9 2.4-2.8 1.9-4.2 .6-3.7-6.4-36.6 19.3-7.1 .8-.8z",
17455
+ "light": "M53.6 54.5l.7-.4 12 2.8 .6 1.8-.6 2.1-2.1 2.4-2.6 1-1.5 0-6.3-1.4-1.6-2.6-.2-2.1z",
17456
+ "eyes": [
17457
+ [
17458
+ 59.6,
17459
+ 82.1,
17460
+ 6.1,
17461
+ 15.9,
17462
+ -10
17463
+ ],
17464
+ [
17465
+ 72,
17466
+ 77.5,
17467
+ 6.1,
17468
+ 15.9,
17469
+ -10
17470
+ ]
17471
+ ]
17472
+ },
17473
+ "acorn": {
17474
+ "body": "M47.6 4l2.1 .6 1.3 1.5 .4 1.5-.4 5.2 .3 .3 8.8-.1 7.7 1 7.3 2.1 5.7 2.9 3.6 2.9 2.6 3 1.8 3.4 .9 3.7 0 4.1-1 3.6-1.7 2.2-3.9 3 2.9 8.3 .9 8.3-.9 8.3-2.7 7.7-4.2 6.8-2.9 3.1-3.2 2.6-6.7 3.8-3.7 1.2-4.1 .8-7.2 0-7.3-1.7-7-3.6-5.9-5.1-4.8-6.3-3.3-7.3-1.8-7.7-.1-8.3-4.5-1.5-2.6-1.7-2.6-4.1-1.1-4.1 0-4.2 1.2-4.1 2.2-4.1 2.8-3.7 5.2-4.6 6.3-3.8 7.2-3.2 8.3-2.3 .9-8.3 1.2-1.4z",
17475
+ "shade": "M50.6 6.1l.1-.5 .6 2-.6 5.7 .2 2.1-1.2 .2-1.2-.7 .5-6.8zM85.8 23.7l1.7 2 1.6 3.7 .6 2.6-.1 4.1-.5 2.6-1.1 2.1-2.1 2-2.9 2.1 1.4 3.1 1.6 5.2 .9 8.8-.5 5.7-1.4 5.7-2.2 5.1-2.6 4.2-5.1 5.7-5.2 3.6-4.7 2.2-6.2 1.5-7.7 .1-5.7-1.2-6.8-3-4.6-3.2-4.2-4.2 2.1 1 2.1 .3 3.1-.3 3.1-.9 6.4-3.1 6.5-4.6 6.6-5.8 5.9-6.4 5.6-7.9 4-7.4-2.4 .4-.5 .5-1.1 0-.5 .5-1 0-.5 .5-1.1 0-.5 .5-1 0-.5 .6-1.6-.1-.5 .5-1.6 0-.5 .5-3.6 .5-.5 .5-2.1-.1-.5 .6-2.1-.1-.5 .7-3.1-.2-.5 .5-3.1 0-.5 .7-4.7-.2-.5 .7-15.6-.3 0-.3 8.3-.6 11.4-2.4 11.4-3.8 10.5-4.8 9.2-5.7 6-5.2 2.2-2.6 1.6-2.9 .5-1.7z",
17476
+ "light": "M46 4.5l1.1-.1 0 .6-1.5 1.6-1.1 .2-.1-.7zM38.5 15.9l5 0 3.3 1.6 1.6 3.1 .1 3.1-.9 3.1-1.9 3.1-3.2 3.6-4 3.1-3.6 2.1-8.5 3.2-4.1 .7-4.2 .1-3.1-.5-2.6-1.5-1.1-2 .1-2.1 .5-1.5 2.1-3.7 4.1-4.6 3.7-3.1 5.1-3.2 6.3-3z",
17477
+ "eyes": [
17478
+ [
17479
+ 63.6,
17480
+ 63.3,
17481
+ 9.6,
17482
+ 22.7,
17483
+ -11.9
17484
+ ],
17485
+ [
17486
+ 79.5,
17487
+ 57.3,
17488
+ 6.5,
17489
+ 22.5,
17490
+ -15.5
17491
+ ]
17492
+ ]
17493
+ },
17494
+ "pebbles": {
17495
+ "body": "M47.3 4.5l2.7-.4 2.7 .1 13.7 3 4.3 2.1 3.3 3.4 1.3 2.2 1 2.8 2 12-.5 4.3-3.1 7.7 .2 .5 8.4 1.9 2.7 1 3.3 2.1 2.7 2.8 2.4 4.3 1.4 6.5 .1 4.4-.8 3.8-1.3 2.7-2 2.8-2.4 2.2-2.7 1.6-45.5 17-3.3 .6-3.2-.2-19.2-4.2-4.9-2.8-3.4-3.8-1.9-4.4-1.3-7.7 .2-3.2 .8-2.8 1.3-2.7 2-2.7 3.2-2.8 7.9-3.8 2.5-2.2-.4-1.6-5.4-6.1-1.8-3.8-2.3-12.5 .2-3.3 .7-2.7 2.6-4.4 2.2-2 2.2-1.4z",
17496
+ "shade": "M73.2 12.2l.4 0 1.5 2.2 1.2 3.3 1.8 11.4-.2 4.4-3.3 7.6 0 1.1 .6 1.1-1.2 1.3-26.8 10.1-3.2 .5-5.8-.4-15.2-3.3-1.4-.5-3.5-3.8 .2-.3 1.6 .2 10.9 2.2 2.8-.5 4.4-2.2 5-3.8 .1-.6-1.5-8.7 4-4.5 24.2-9.2 2.4-3.8zM90.9 48.8l2.8 3.8 1 2.8 1.2 6 0 4.3-1.1 3.9-1.7 3.2-3.8 3.9-2.7 1.7-42.1 15.8-5.5 1.6-3.8 0-18-3.8-4.9-2.1-3.4-2.9 17.6 3.8 2.7-.2 3.3-1.2 4.3-2.6 4.4-3.6-.4-3.8 4.4-4.9 42.5-16 2.1-3.1 1.1-2.8 .5-3.3z",
17497
+ "light": "M45.6 5.1l1.5 0-.4 .2-22.9 8.5 11.4 2.5 .6 .8 0 1.6-1.5 2.8-1.9 2.2-2.8 2.1-3.1 1.2-13.2-2.8-.1-2.2 1.2-2.2 1.7-2.2 2.7-2.2 2.2-1.1 2.2-.5 .5-.5 2.8-.6 1.6-1.1 2.7-.5 1.7-1.1 2.7-.6 1.6-1 2.8-.6 1.6-1.1 2.8-.5zM21.6 53.2l15.8 3.6 1.2 .7-.1 .9-.8 .8-3.1 1.6-1.3 3.8-3 3.8-3.3 2.5-3.3 1.4-18-3.6-.6-1.3 .6-2.2 1.6-2.7 1.7-1.8 3.8-2.8 5.5-2.2z",
17498
+ "eyes": [
17499
+ [
17500
+ 51.2,
17501
+ 34.1,
17502
+ 6.9,
17503
+ 18.1,
17504
+ -10
17505
+ ],
17506
+ [
17507
+ 66.4,
17508
+ 28.4,
17509
+ 6.9,
17510
+ 18.1,
17511
+ -10
17512
+ ]
17513
+ ]
17514
+ },
17515
+ "cushion": {
17516
+ "body": "M64.2 4.4l3.3-.4 2.8 .2 3.9 .8 2.8 1.1 2.7 1.7 2.4 2.1 1.9 2.4 1.5 2.8 1.2 3.9 7.1 40.6-.1 5-1.4 4.5-1.6 2.9-1.9 2.2-2.2 1.9-2.8 1.7-45.6 17.1-3.4 .9-3.4 .2-4.5-.7-3.4-1.2-3.3-2-2.9-2.7-2.3-3.4-1.5-3.9-7.3-41.7 .1-5 1.4-4.5 1.6-2.9 1.9-2.2 2.2-1.9 2.8-1.7z",
17517
+ "shade": "M82.1 10l2.9 4 1.6 4.5 7.3 42.2-.5 5.1-1.1 3.3-1.7 2.9-4.6 4.5-3.3 1.7-46.8 17.4-5.6 .2-4-.7-3.3-1.2-3.4-2.2-1.7-1.8 .6 .4 3.3 .2 4.5-1.2 5.1-2.8 5.3-4.4-6.9-39.4 5-5.7 43.9-16.4 2.3-3.6 1.1-2.8 .5-3.6z",
17518
+ "light": "M62.3 4.9l1.8 .1-43.4 16.1 1.1 .4 .8 .9 .1 1.7-1.6 3.4-2.6 3-3.4 2.7-3.4 1.5-3.4-.2-.8-.8-.2-1.2 .4-1.6 1.7-2.9 3.4-3.5 2.3-1.6 3.4-1.6 5.6-1.8 .6-.5 1.1 0 .5-.6 2.3-.5 .6-.6 1.1 0 .6-.6 2.2-.5 .6-.6 1.1 0 .6-.6 2.2-.5 .6-.6 1.1 0 .6-.5 2.2-.6 .6-.6 1.1 0 .6-.5 2.2-.6 .6-.5 1.1-.1 .6-.5 2.2-.6 .6-.5 1.1-.1 .6-.5 2.2-.6 .6-.5 1.1 0 .6-.6 2.2-.6 .6-.5 1.1 0z",
17519
+ "eyes": [
17520
+ [
17521
+ 51.1,
17522
+ 57.2,
17523
+ 8.4,
17524
+ 22.1,
17525
+ -10
17526
+ ],
17527
+ [
17528
+ 69.9,
17529
+ 50.1,
17530
+ 8.4,
17531
+ 22.1,
17532
+ -10
17533
+ ]
17534
+ ]
17535
+ },
17536
+ "ring": {
17537
+ "body": "M48.1 4.3l8-.1 7.8 1.8 7.3 3.5 6.7 5.4 5.2 6.7 4.1 8.3 2.3 8.9 .7 9-1 9.5-2.5 8.9-4.1 8.3-5.3 7.3-6.6 6.1-7.3 4.5-7.8 2.7-8.4 .9-7.2-.8-7.3-2.5-6.7-4.1-5.6-5.3-4.5-6.5-3.5-7.8-2-8.4-.6-8.4 .9-8.9 2.2-8.4 3.5-7.8 4.9-7.2 5.8-6.1 6.3-4.5 7.1-3.3zM50.5 33.8l2.3-.3 1.7 .4 1.6 1.1 2 2.2 1.3 2.8 .8 2.7 .4 3.4-.1 3.3-1.4 6.2-3 5.6-2.2 2.4-2.2 1.6-2.3 1-2.2 .3-1.7-.4-1.6-1.1-2.8-3.7-1.5-5.2-.1-5.5 1.2-5.6 2.4-5 3.6-4z",
17538
+ "shade": "M76.2 14.9l1.1-.5 3.4 3.8 2.8 3.9 2.3 4.5 1.6 3.9 1.6 5.6 1.1 8.3-.4 10.1-1.3 6.1-2.6 7.8-4.6 8.3-4.4 5.6-6.2 5.7-6.1 3.8-7.2 2.9-6.2 1.1-7.8-.1-7.2-1.7-3.9-1.6-4-2.2-5.5-4.5-2.8-3.4 1.7-.6 2.4-2.1 2-2.8 1.2-2.8 1.2-5 1.1-13.4 1.4-7.8 2.5-7.8 3.8-7.3 3.3-4.5 3.4-3.4 3.9-3.1 4.4-2.6 3.9-1.5 4.5-1.1 12.3-.9zM50.5 33.8l.6-.3 2.8 0 1.6 .9 2.7 2.8 3 1.4 3.3 .5 6.1 .2 3.9 .9 1.7 1 1.7 1.6 2.1 4.4 .7 4.5-.3 5-1.2 5-1.9 4.5-2.8 4.2-3.3 3.6-3.9 2.8-3.9 1.7-3.4 .6-3.3-.1-3.4-1.1-2.5-1.7-2.5-3-3.6-7-2.9-3.4-2.1-5-.6-5.6 .6-4.4 1-3.4 2.3-4.4 1.4-2.1 2.3-2.2 2.7-1.7z",
17539
+ "light": "M41.1 5.9l.5 .1 .2 .5-.3 .6-12.4 13.3-13.1 18.1-2.3 2.1-1.1 0-.2-1.2 .2-2.8 1.6-5 4.6-8.3 3.9-5.1 4.4-4.4 4.5-3.4 5-2.8zM60.5 53.3l1.2-.3 1.1 .6 1.1 1.3 .8 1.8-.2 3.3-1.5 2.8-2 1.7-2.6 1-7.3 .2 2.2-1.4 2.6-2.6z",
17540
+ "eyes": [
17541
+ [
17542
+ 56.2,
17543
+ 84.6,
17544
+ 5.3,
17545
+ 13.3,
17546
+ -6.8
17547
+ ],
17548
+ [
17549
+ 71.7,
17550
+ 78.8,
17551
+ 5.1,
17552
+ 13.4,
17553
+ -6.5
17554
+ ]
17555
+ ]
17556
+ },
17557
+ "gem": {
17558
+ "body": "M57 9.3l2.9-.4 14.9 3.5 19.6 14.1 1 1.4 .6 1.6-.5 2.6-27.1 56.5-1.6 1.8-2.1 .7-15.9-3.4-42.9-30.7-1.3-1.6-.6-1.6 .5-2.6 12-25.2 1.1-1.5 1.5-1z",
17559
+ "shade": "M75.7 14.6l.1-.4 .6 .2 16.9 12.3 1.1 .7 .5-.2 .5 .7 .6 2.6-.5 1.6-26.4 55.1-1.2 2.1-1.1 1.1-1.6 .6-2.1 0-14.3-3.3-42.8-30.7 1.5-.2 11.6 2.5 2.2-.7 2.8-2.6 11.9-24.9 .6-.8 38.2-14.2z",
17560
+ "light": "M19.1 23.6l1.1-.4 .5 .5 11.7 2.2 1 .9-.2 .5-1.8 2.7-11.7 24.4-1.6 .6-13.3-2.8-.5-.5 12.1-25.4 1.2-1.7z",
17561
+ "eyes": [
17562
+ [
17563
+ 51.4,
17564
+ 42.9,
17565
+ 6.7,
17566
+ 17.7,
17567
+ -10
17568
+ ],
17569
+ [
17570
+ 66.1,
17571
+ 37.4,
17572
+ 6.7,
17573
+ 17.7,
17574
+ -10
17575
+ ]
17576
+ ]
17577
+ }
17578
+ };
17579
+ var INKS = {
17580
+ "deepseek": [
17581
+ "#4D6BFE",
17582
+ "#6A84FF"
17583
+ ],
17584
+ "charcoal": [
17585
+ "#141416",
17586
+ "#F1F2F4"
17587
+ ],
17588
+ "graphite": [
17589
+ "#2D2D2D",
17590
+ "#D6D6DA"
17591
+ ],
17592
+ "rose": [
17593
+ "#EC2F6B",
17594
+ "#FF5A7A"
17595
+ ],
17596
+ "sky": [
17597
+ "#0AA8D6",
17598
+ "#2EE6E0"
17599
+ ],
17600
+ "tangerine": [
17601
+ "#FF6900",
17602
+ "#FF8A2E"
17603
+ ],
17604
+ "cobalt": [
17605
+ "#082DFF",
17606
+ "#5C78FF"
17607
+ ],
17608
+ "black": [
17609
+ "#000000",
17610
+ "#FFFFFF"
17611
+ ],
17612
+ "brown": [
17613
+ "#A27952",
17614
+ "#855C36"
17615
+ ],
17616
+ "red": [
17617
+ "#FF3E51",
17618
+ "#E02135"
17619
+ ],
17620
+ "orange": [
17621
+ "#FF781C",
17622
+ "#FF6700"
17623
+ ],
17624
+ "yellow": [
17625
+ "#FFAF38",
17626
+ "#FF9800"
17627
+ ],
17628
+ "green": [
17629
+ "#00C972",
17630
+ "#009957"
17631
+ ],
17632
+ "cyan": [
17633
+ "#1CC3B0",
17634
+ "#00A592"
17635
+ ],
17636
+ "blue": [
17637
+ "#2A92FE",
17638
+ "#0E74E0"
17639
+ ],
17640
+ "violet": [
17641
+ "#A97EFE",
17642
+ "#804EE0"
17643
+ ],
17644
+ "magenta": [
17645
+ "#FF5EB1",
17646
+ "#E02A88"
17647
+ ],
17648
+ "gray": [
17649
+ "#959595",
17650
+ "#777777"
17651
+ ],
17652
+ "aurora": [
17653
+ "#00B8D4",
17654
+ "#2EE6E0"
17655
+ ]
17656
+ };
17657
+
17658
+ // plugin-src/client/ds-bot-avatar.js
17659
+ function defaultLook(id6 = "") {
17660
+ let hash = 2166136261;
17661
+ for (const char of id6) hash = Math.imul(hash ^ char.charCodeAt(0), 16777619);
17662
+ let shape = Math.imul(hash ^ hash >>> 16, 73244475);
17663
+ shape = Math.imul(shape ^ shape >>> 13, 3266489909);
17664
+ const shapes = ["star", "moon", "gumdrop", "peanut", "bunny", "kitty", "acorn"];
17665
+ const seed = hash + 1831565813 | 0;
17666
+ let color = Math.imul(seed ^ seed >>> 15, 1 | seed);
17667
+ color = color + Math.imul(color ^ color >>> 7, 61 | color) ^ color;
17668
+ const colors = ["red", "orange", "yellow", "green", "cyan", "blue", "violet", "magenta"];
17669
+ return {
17670
+ shape: shapes[((shape ^ shape >>> 16) >>> 0) % shapes.length],
17671
+ color: colors[Math.floor(((color ^ color >>> 14) >>> 0) / 4294967296 * colors.length)]
17672
+ };
17673
+ }
17674
+ function DsBotAvatar({ bot, size = 24 }) {
17675
+ const id6 = React31.useId().replaceAll(":", "");
17676
+ const fallback = defaultLook(bot?.id);
17677
+ const shape = Object.hasOwn(SHAPES, bot?.avatar?.shape) ? SHAPES[bot.avatar.shape] : SHAPES[fallback.shape];
17678
+ const color = bot?.color ?? fallback.color;
17679
+ const fill = /^#[0-9a-f]{6}$/i.test(color) ? color : (Object.hasOwn(INKS, color) ? INKS[color] : INKS[fallback.color])[0];
17680
+ const image = bot?.avatar?.image;
17681
+ if (typeof image === "string" && /^data:image\/(?:png|jpeg|webp|gif);base64,[A-Za-z0-9+/=]+$/.test(image)) {
17682
+ return React31.createElement("img", {
17683
+ className: "dim-dsBotAvatar",
17684
+ src: image,
17685
+ width: size,
17686
+ height: size,
17687
+ alt: ""
17688
+ });
17689
+ }
17690
+ const h4 = React31.createElement;
17691
+ return h4(
17692
+ "svg",
17693
+ { className: "dim-dsBotAvatar", width: size, height: size, viewBox: "0 0 100 100", "aria-hidden": true },
17694
+ h4(
17695
+ "defs",
17696
+ null,
17697
+ h4(
17698
+ "mask",
17699
+ { id: `${id6}mask` },
17700
+ h4("rect", { width: 100, height: 100, fill: "#fff" }),
17701
+ shape.eyes.map(([x, y, w, height, angle], index) => h4("rect", {
17702
+ key: index,
17703
+ x: -w / 2,
17704
+ y: -height / 2,
17705
+ width: w,
17706
+ height,
17707
+ rx: w / 2,
17708
+ fill: "#000",
17709
+ transform: `translate(${x} ${y}) rotate(${angle})`
17710
+ }))
17711
+ ),
17712
+ color === "aurora" ? h4(
17713
+ "linearGradient",
17714
+ { id: `${id6}gradient`, x1: "0%", y1: "0%", x2: "100%", y2: "100%" },
17715
+ h4("stop", { offset: 0, stopColor: "#A4FFB0" }),
17716
+ h4("stop", { offset: ".42", stopColor: "#00F0E4" }),
17717
+ h4("stop", { offset: 1, stopColor: "#2E9EF7" })
17718
+ ) : null
17719
+ ),
17720
+ h4(
17721
+ "g",
17722
+ { mask: `url(#${id6}mask)`, fillRule: "evenodd" },
17723
+ h4("path", { d: shape.body, fill: color === "aurora" ? `url(#${id6}gradient)` : fill }),
17724
+ (shape.paints ?? []).map(([d, paint, opacity], index) => h4("path", { key: index, d, fill: paint, opacity })),
17725
+ h4("path", { d: shape.shade, fill: "#000", opacity: 0.14 }),
17726
+ h4("path", { d: shape.light, fill: "#fff", opacity: 0.16 })
17727
+ )
17728
+ );
17729
+ }
17730
+
17731
+ // plugin-src/client/ds-bot-settings.js
17732
+ var DS_BOT_MESSAGES = Object.freeze({
17733
+ missing: "\u672A\u5B89\u88C5 DS Bot\uFF0C\u8BF7\u5148\u5728 DSH \u63D2\u4EF6\u7BA1\u7406\u4E2D\u5B89\u88C5 ds-bot\uFF0C\u7136\u540E\u5237\u65B0\u3002",
17734
+ disabled: "DS Bot \u5C1A\u672A\u542F\u7528\uFF0C\u8BF7\u5728 DSH \u63D2\u4EF6\u7BA1\u7406\u4E2D\u542F\u7528\u540E\u5237\u65B0\u3002",
17735
+ unavailable: "\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6 DS Bot\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u662F\u5426\u6B63\u5E38\u8FD0\u884C\u540E\u91CD\u8BD5\u3002",
17736
+ readonly: "DS Bot \u5F53\u524D\u7531\u5176\u4ED6 Host \u7BA1\u7406\uFF0C\u8BF7\u5728\u8FD0\u884C\u5B83\u7684 Host \u4E2D\u7ED1\u5B9A\u3002",
17737
+ remote: "\u7ED1\u5B9Abot\u4EC5\u652F\u6301\u5F53\u524D Host \u7684\u4F1A\u8BDD\uFF0C\u8BF7\u5148\u68C0\u67E5\u673A\u5668\u4EBA\u7684 Harness \u8FDE\u63A5\u8BBE\u7F6E\u3002"
17738
+ });
17739
+ function dsBotErrorMessage(error) {
17740
+ return {
17741
+ "ds-bot-unavailable": DS_BOT_MESSAGES.unavailable,
17742
+ "ds-bot-not-found": "\u6240\u9009 DS Bot \u5DF2\u4E0D\u5B58\u5728\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u65B0\u9009\u62E9\u3002",
17743
+ "ds-bot-private-required": "\u4EC5\u652F\u6301\u5DF2\u7ECF\u5EFA\u7ACB\u4F1A\u8BDD\u7684\u79C1\u804A\uFF0C\u8BF7\u5148\u4E0E\u673A\u5668\u4EBA\u79C1\u804A\u540E\u5237\u65B0\u3002",
17744
+ "ds-bot-binding-conflict": "\u6240\u9009 DS Bot \u6216\u79C1\u804A\u5BF9\u8C61\u5DF2\u7ED1\u5B9A\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u65B0\u9009\u62E9\u3002"
17745
+ }[error?.code] ?? "\u7ED1\u5B9A\u8BBE\u7F6E\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5\u3002";
17746
+ }
17747
+ function DsBotPicker({ bots, value, onChange, disabled }) {
17748
+ const [open, setOpen] = React32.useState(false);
17749
+ const [active, setActive] = React32.useState(0);
17750
+ const root = React32.useRef(null);
17751
+ const trigger = React32.useRef(null);
17752
+ const listId = React32.useId();
17753
+ const selected = bots.find((bot) => bot.id === value);
17754
+ const isOpen = open && !disabled && bots.length > 0;
17755
+ React32.useEffect(() => {
17756
+ const dismiss = (event) => {
17757
+ if (!root.current?.contains(event.target)) setOpen(false);
17758
+ };
17759
+ if (open) globalThis.document?.addEventListener("pointerdown", dismiss);
17760
+ return () => globalThis.document?.removeEventListener("pointerdown", dismiss);
17761
+ }, [open]);
17762
+ const choose = (bot) => {
17763
+ onChange(bot.id);
17764
+ setOpen(false);
17765
+ trigger.current?.focus();
17766
+ };
17767
+ const optionId = (index) => `${listId}-${index}`;
17768
+ return h2(
17769
+ "div",
17770
+ { className: "dim-dsBotPicker", ref: root },
17771
+ h2(
17772
+ "button",
17773
+ {
17774
+ type: "button",
17775
+ role: "combobox",
17776
+ ref: trigger,
17777
+ className: "dim-dsBotPickerTrigger",
17778
+ disabled: disabled || !bots.length,
17779
+ "aria-label": "DS Bot",
17780
+ "aria-expanded": isOpen,
17781
+ "aria-controls": listId,
17782
+ "aria-haspopup": "listbox",
17783
+ "aria-activedescendant": isOpen ? optionId(active) : void 0,
17784
+ onClick: () => {
17785
+ setActive(Math.max(0, bots.findIndex((bot) => bot.id === value)));
17786
+ setOpen(!open);
17787
+ },
17788
+ onKeyDown: (event) => {
17789
+ if (disabled || !bots.length) return;
17790
+ if (["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) {
17791
+ event.preventDefault();
17792
+ const index = event.key === "Home" ? 0 : event.key === "End" ? bots.length - 1 : open ? (active + (event.key === "ArrowDown" ? 1 : -1) + bots.length) % bots.length : Math.max(0, bots.findIndex((bot) => bot.id === value));
17793
+ setActive(index);
17794
+ setOpen(true);
17795
+ } else if (open && ["Enter", " "].includes(event.key)) {
17796
+ event.preventDefault();
17797
+ if (bots[active]) choose(bots[active]);
17798
+ } else if (event.key === "Escape" || event.key === "Tab") setOpen(false);
17799
+ }
17800
+ },
17801
+ selected ? h2(DsBotAvatar, { bot: selected }) : null,
17802
+ selected ? React32.createElement("span", { className: "dim-dsBotPickerName" }, selected.name) : h2("span", { className: "dim-dsBotPickerName" }, bots.length ? "\u9009\u62E9 DS Bot" : "\u6682\u65E0\u53EF\u9009 DS Bot"),
17803
+ h2(
17804
+ "svg",
17805
+ { width: 14, height: 14, viewBox: "0 0 16 16", "aria-hidden": true },
17806
+ h2("path", { d: "m4 6 4 4 4-4", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round" })
17807
+ )
17808
+ ),
17809
+ isOpen ? h2(
17810
+ "div",
17811
+ { id: listId, role: "listbox", "aria-label": "DS Bot", className: "dim-dsBotOptions" },
17812
+ bots.map((bot, index) => h2(
17813
+ "button",
17814
+ {
17815
+ key: bot.id,
17816
+ id: optionId(index),
17817
+ type: "button",
17818
+ role: "option",
17819
+ tabIndex: -1,
17820
+ "aria-selected": value === bot.id,
17821
+ "data-active": active === index,
17822
+ onMouseDown: (event) => event.preventDefault(),
17823
+ onMouseEnter: () => setActive(index),
17824
+ onClick: () => choose(bot)
17825
+ },
17826
+ h2(DsBotAvatar, { bot }),
17827
+ React32.createElement("span", { className: "dim-dsBotPickerName" }, bot.name),
17828
+ value === bot.id ? h2("span", { "aria-hidden": true }, "\u2713") : null
17829
+ ))
17830
+ ) : null
17831
+ );
17832
+ }
17833
+ function conversationLabel(conversation) {
17834
+ if (conversation.name) return conversation.name;
17835
+ const value = conversation.address;
17836
+ return value.length > 24 ? `${value.slice(0, 10)}\u2026${value.slice(-8)}` : value;
17837
+ }
17838
+ function DsBotSettingsPage({ botId, rpcCall }) {
17839
+ const [status, setStatus] = React32.useState(null);
17840
+ const [dsBotId, setDsBotId] = React32.useState("");
17841
+ const [conversationKey, setConversationKey] = React32.useState("");
17842
+ const [loading, setLoading] = React32.useState(true);
17843
+ const [busy, setBusy] = React32.useState(false);
17844
+ const [feedback, setFeedback] = React32.useState(null);
17845
+ const [feedbackTone, setFeedbackTone] = React32.useState("success");
17846
+ const requests = React32.useRef({ revision: 0, busy: false, controller: null });
17847
+ const refresh = React32.useCallback(async (signal = requests.current.controller?.signal) => {
17848
+ const state = requests.current;
17849
+ if (signal?.aborted) return;
17850
+ const revision = ++state.revision;
17851
+ const current = () => !signal?.aborted && revision === state.revision;
17852
+ setLoading(true);
17853
+ try {
17854
+ const value = await rpcCall("ds-bot.status", { botId }, signal);
17855
+ if (current()) setStatus(value);
17856
+ } catch {
17857
+ if (current()) setStatus((previous) => ({ ...previous, state: "unavailable" }));
17858
+ } finally {
17859
+ if (current()) setLoading(false);
17860
+ }
17861
+ }, [botId, rpcCall]);
17862
+ React32.useEffect(() => {
17863
+ const controller = new AbortController();
17864
+ requests.current.controller = controller;
17865
+ void refresh(controller.signal);
17866
+ return () => {
17867
+ controller.abort();
17868
+ requests.current.revision++;
17869
+ };
17870
+ }, [refresh]);
17871
+ const conversations = status?.conversations ?? [];
17872
+ const bots = status?.bots ?? [];
17873
+ const bindings = conversations.filter((conversation) => conversation.dsBotId);
17874
+ const usedBotIds = new Set(bindings.map((binding) => binding.dsBotId));
17875
+ const availableBots = bots.filter((bot) => !usedBotIds.has(bot.id));
17876
+ const availableConversations = conversations.filter((conversation) => !conversation.dsBotId);
17877
+ const canSave = !busy && !loading && status?.state === "ready" && availableBots.some((bot) => bot.id === dsBotId) && availableConversations.some((conversation) => conversation.conversationKey === conversationKey);
17878
+ React32.useEffect(() => {
17879
+ setDsBotId((value) => availableBots.some((bot) => bot.id === value) ? value : "");
17880
+ setConversationKey((value) => availableConversations.some((conversation) => conversation.conversationKey === value) ? value : "");
17881
+ }, [status]);
17882
+ const save = async (event) => {
17883
+ event.preventDefault();
17884
+ if (!canSave || requests.current.busy) return;
17885
+ requests.current.busy = true;
17886
+ requests.current.revision++;
17887
+ setBusy(true);
17888
+ setFeedback(null);
17889
+ try {
17890
+ await rpcCall("ds-bot.bind", { botId, conversationKey, dsBotId });
17891
+ setDsBotId("");
17892
+ setConversationKey("");
17893
+ await refresh();
17894
+ setFeedbackTone("success");
17895
+ setFeedback("\u7ED1\u5B9A\u5DF2\u4FDD\u5B58\u3002");
17896
+ } catch (error) {
17897
+ if (error?.code === "ds-bot-binding-conflict") await refresh();
17898
+ setFeedbackTone("error");
17899
+ setFeedback(dsBotErrorMessage(error));
17900
+ } finally {
17901
+ requests.current.busy = false;
17902
+ setBusy(false);
17903
+ }
17904
+ };
17905
+ const unbind = async (key) => {
17906
+ if (requests.current.busy) return;
17907
+ requests.current.busy = true;
17908
+ requests.current.revision++;
17909
+ setBusy(true);
17910
+ setFeedback(null);
17911
+ try {
17912
+ await rpcCall("ds-bot.unbind", { botId, conversationKey: key });
17913
+ await refresh();
17914
+ setFeedbackTone("success");
17915
+ setFeedback("\u5DF2\u89E3\u9664\u7ED1\u5B9A\uFF0C\u804A\u5929\u8BB0\u5F55\u4FDD\u7559\u3002");
17916
+ } catch (error) {
17917
+ setFeedbackTone("error");
17918
+ setFeedback(dsBotErrorMessage(error));
17919
+ } finally {
17920
+ requests.current.busy = false;
17921
+ setBusy(false);
17922
+ }
17923
+ };
17924
+ return h2(
17925
+ "section",
17926
+ { className: "dim-deliveryTargets dim-dsBotSettings", "aria-label": "\u7ED1\u5B9Abot" },
17927
+ h2(
17928
+ "div",
17929
+ { className: "dim-deliverySectionHeading" },
17930
+ h2("div", null, h2("h3", null, "\u7ED1\u5B9Abot"), h2("p", null, "\u9009\u62E9 DS Bot \u548C\u79C1\u804A\u5BF9\u8C61\uFF0C\u76F4\u63A5\u4F7F\u7528 Bot \u7684\u4F1A\u8BDD\u3002")),
17931
+ h2("button", { className: "dim-deliveryButton", type: "button", disabled: busy || loading, onClick: () => void refresh() }, "\u5237\u65B0")
17932
+ ),
17933
+ !status ? h2("p", { className: "dim-dsBotNotice", role: "status" }, "\u6B63\u5728\u68C0\u6D4B DS Bot\u2026") : status.state !== "ready" ? h2("p", { className: "dim-dsBotNotice", role: "status" }, DS_BOT_MESSAGES[status.state] ?? DS_BOT_MESSAGES.unavailable) : !bots.length ? h2("p", { className: "dim-dsBotNotice" }, "\u8FD8\u6CA1\u6709 DS Bot\uFF0C\u8BF7\u5148\u5728 DS Bot \u4E2D\u521B\u5EFA\u673A\u5668\u4EBA\u540E\u5237\u65B0\u3002") : !conversations.length ? h2("p", { className: "dim-dsBotNotice" }, "\u8FD8\u6CA1\u6709\u53EF\u7ED1\u5B9A\u7684\u79C1\u804A\u3002\u5148\u7ED9\u8FD9\u4E2A\u673A\u5668\u4EBA\u53D1\u4E00\u6761\u79C1\u804A\u6D88\u606F\uFF0C\u518D\u70B9\u51FB\u5237\u65B0\u3002") : h2(
17934
+ "form",
17935
+ { className: "dim-dsBotForm", onSubmit: save },
17936
+ h2(
17937
+ "div",
17938
+ { className: "dim-targetFormGrid" },
17939
+ h2(
17940
+ "div",
17941
+ { className: "dim-targetField" },
17942
+ h2("span", null, "DS Bot"),
17943
+ h2(DsBotPicker, { bots: availableBots, value: dsBotId, onChange: setDsBotId, disabled: busy || loading })
17944
+ ),
17945
+ h2(
17946
+ "label",
17947
+ { className: "dim-targetField" },
17948
+ h2("span", null, "\u79C1\u804A\u5BF9\u8C61"),
17949
+ h2(
17950
+ "select",
17951
+ {
17952
+ value: conversationKey,
17953
+ required: true,
17954
+ disabled: busy || loading || !availableConversations.length,
17955
+ onChange: (event) => setConversationKey(event.target.value)
17956
+ },
17957
+ h2("option", { value: "" }, availableConversations.length ? "\u9009\u62E9\u79C1\u804A\u5BF9\u8C61" : "\u6682\u65E0\u53EF\u9009\u79C1\u804A\u5BF9\u8C61"),
17958
+ availableConversations.map((conversation) => React32.createElement("option", {
17959
+ key: conversation.conversationKey,
17960
+ value: conversation.conversationKey
17961
+ }, conversationLabel(conversation)))
17962
+ )
17963
+ )
17964
+ ),
17965
+ !availableBots.length || !availableConversations.length ? h2("p", { className: "dim-dsBotNotice" }, "\u5DF2\u7ED1\u5B9A\u7684 DS Bot \u548C\u79C1\u804A\u5BF9\u8C61\u4E0D\u53EF\u91CD\u590D\u9009\u62E9\uFF0C\u89E3\u9664\u7ED1\u5B9A\u540E\u53EF\u91CD\u65B0\u9009\u62E9\u3002") : null,
17966
+ h2(
17967
+ "div",
17968
+ { className: "dim-targetFormActions" },
17969
+ h2("button", {
17970
+ type: "submit",
17971
+ className: "dim-deliveryButton",
17972
+ "data-kind": "primary",
17973
+ disabled: !canSave
17974
+ }, busy ? "\u6B63\u5728\u4FDD\u5B58\u2026" : "\u4FDD\u5B58\u7ED1\u5B9A")
17975
+ )
17976
+ ),
17977
+ bindings.length ? h2("ul", { className: "dim-targetList" }, bindings.map((conversation) => {
17978
+ const bot = bots.find((entry) => entry.id === conversation.dsBotId);
17979
+ return h2(
17980
+ "li",
17981
+ { className: "dim-targetRow dim-dsBotBinding", key: conversation.conversationKey },
17982
+ h2(
17983
+ "div",
17984
+ { className: "dim-dsBotBoundIdentity" },
17985
+ h2(DsBotAvatar, { bot: bot ?? { id: conversation.dsBotId }, size: 32 }),
17986
+ h2(
17987
+ "div",
17988
+ { className: "dim-targetSummary" },
17989
+ h2(
17990
+ "div",
17991
+ { className: "dim-targetTitle" },
17992
+ bot ? React32.createElement("strong", null, bot.name) : h2("strong", null, "DS Bot \u6682\u4E0D\u53EF\u7528"),
17993
+ h2("span", null, "\u5DF2\u7ED1\u5B9A")
17994
+ ),
17995
+ React32.createElement("p", { className: "dim-dsBotDestination" }, conversationLabel(conversation))
17996
+ )
17997
+ ),
17998
+ h2("button", {
17999
+ type: "button",
18000
+ className: "dim-deliveryButton",
18001
+ "data-kind": "danger",
18002
+ disabled: busy || loading,
18003
+ onClick: () => void unbind(conversation.conversationKey)
18004
+ }, "\u89E3\u9664\u7ED1\u5B9A")
18005
+ );
18006
+ })) : null,
18007
+ feedback ? h2("p", { role: "status", className: "dim-targetFeedback", "data-tone": feedbackTone }, feedback) : null
18008
+ );
18009
+ }
18010
+
18011
+ // plugin-src/client/channels/feishu/group-settings.js
18012
+ var React33 = __toESM(require("react"), 1);
17014
18013
  var GROUP_MESSAGE_PERMISSION_OPERATION2 = FEISHU_REGISTRATION_OPERATIONS.GROUP_MESSAGE_PERMISSION;
17015
18014
  function SettingsButton({ children, kind = "secondary", className = "", ...props }) {
17016
18015
  return h2("button", {
@@ -17071,9 +18070,9 @@ function GroupResponseModeEditor({
17071
18070
  onAuthorize
17072
18071
  }) {
17073
18072
  const current = normalizeGroupResponseMode(value);
17074
- const [saving, setSaving] = React31.useState(false);
17075
- const [authorizing, setAuthorizing] = React31.useState(false);
17076
- const [error, setError] = React31.useState(null);
18073
+ const [saving, setSaving] = React33.useState(false);
18074
+ const [authorizing, setAuthorizing] = React33.useState(false);
18075
+ const [error, setError] = React33.useState(null);
17077
18076
  const change = async (event) => {
17078
18077
  const next = normalizeGroupResponseMode(event.target.value);
17079
18078
  if (next === current || saving || disabled) return;
@@ -17154,8 +18153,8 @@ function GroupResponseModeEditor({
17154
18153
  }
17155
18154
  function MentionTopicReplyEditor({ value = true, disabled = false, onSave }) {
17156
18155
  const current = value === true ? "on" : "off";
17157
- const [saving, setSaving] = React31.useState(false);
17158
- const [error, setError] = React31.useState(null);
18156
+ const [saving, setSaving] = React33.useState(false);
18157
+ const [error, setError] = React33.useState(null);
17159
18158
  const change = async (event) => {
17160
18159
  const next = event.target.value === "on";
17161
18160
  if ((next ? "on" : "off") === current || saving || disabled) return;
@@ -17342,14 +18341,14 @@ function PermissionFlow({ provision, now, busy, botName, onRetry, onCancel, onCl
17342
18341
  );
17343
18342
  }
17344
18343
  function FeishuGroupSettingsPage({ account, rpcCall }) {
17345
- const [settings, setSettings] = React31.useState(() => groupSettingsFrom(account));
17346
- const [refreshing, setRefreshing] = React31.useState(false);
17347
- const [refreshError, setRefreshError] = React31.useState(null);
17348
- const [provision, setProvision] = React31.useState(null);
17349
- const [provisionBusy, setProvisionBusy] = React31.useState(false);
17350
- const [now, setNow] = React31.useState(() => Date.now());
17351
- const mounted = React31.useRef(true);
17352
- React31.useEffect(() => {
18344
+ const [settings, setSettings] = React33.useState(() => groupSettingsFrom(account));
18345
+ const [refreshing, setRefreshing] = React33.useState(false);
18346
+ const [refreshError, setRefreshError] = React33.useState(null);
18347
+ const [provision, setProvision] = React33.useState(null);
18348
+ const [provisionBusy, setProvisionBusy] = React33.useState(false);
18349
+ const [now, setNow] = React33.useState(() => Date.now());
18350
+ const mounted = React33.useRef(true);
18351
+ React33.useEffect(() => {
17353
18352
  setSettings(groupSettingsFrom(account));
17354
18353
  }, [
17355
18354
  account.botId,
@@ -17357,22 +18356,22 @@ function FeishuGroupSettingsPage({ account, rpcCall }) {
17357
18356
  account.mentionTopicReply,
17358
18357
  account.groupMessagePermissionGranted
17359
18358
  ]);
17360
- React31.useEffect(() => {
18359
+ React33.useEffect(() => {
17361
18360
  mounted.current = true;
17362
18361
  return () => {
17363
18362
  mounted.current = false;
17364
18363
  };
17365
18364
  }, []);
17366
- const invoke = React31.useCallback(async (endpoint, payload = {}, signal) => {
18365
+ const invoke = React33.useCallback(async (endpoint, payload = {}, signal) => {
17367
18366
  if (typeof rpcCall !== "function") throw new Error("\u98DE\u4E66\u7FA4\u804A\u8BBE\u7F6E\u6682\u4E0D\u53EF\u7528\u3002");
17368
18367
  return unwrapRpcResult3(await rpcCall(endpoint, payload, signal));
17369
18368
  }, [rpcCall]);
17370
- const applySnapshot = React31.useCallback((value) => {
18369
+ const applySnapshot = React33.useCallback((value) => {
17371
18370
  const result2 = targetBotFromSnapshot(value, account.botId);
17372
18371
  if (mounted.current) setSettings(groupSettingsFrom(result2.bot));
17373
18372
  return result2;
17374
18373
  }, [account.botId]);
17375
- const loadSettings = React31.useCallback(async ({ signal, restoreProvisioning = false } = {}) => {
18374
+ const loadSettings = React33.useCallback(async ({ signal, restoreProvisioning = false } = {}) => {
17376
18375
  setRefreshing(true);
17377
18376
  setRefreshError(null);
17378
18377
  try {
@@ -17401,16 +18400,16 @@ function FeishuGroupSettingsPage({ account, rpcCall }) {
17401
18400
  if (!signal?.aborted && mounted.current) setRefreshing(false);
17402
18401
  }
17403
18402
  }, [account.botId, applySnapshot, invoke]);
17404
- React31.useEffect(() => {
18403
+ React33.useEffect(() => {
17405
18404
  const controller = new AbortController();
17406
18405
  void loadSettings({ signal: controller.signal, restoreProvisioning: true });
17407
18406
  return () => controller.abort();
17408
18407
  }, [loadSettings]);
17409
- const saveSetting = React31.useCallback(async (endpoint, payload) => {
18408
+ const saveSetting = React33.useCallback(async (endpoint, payload) => {
17410
18409
  const value = await invoke(endpoint, { botId: account.botId, ...payload });
17411
18410
  applySnapshot(value);
17412
18411
  }, [account.botId, applySnapshot, invoke]);
17413
- const startAuthorization = React31.useCallback(async ({ replace = false, preserveResponseMode = provision?.preserveResponseMode === true } = {}) => {
18412
+ const startAuthorization = React33.useCallback(async ({ replace = false, preserveResponseMode = provision?.preserveResponseMode === true } = {}) => {
17414
18413
  if (provisionBusy) return;
17415
18414
  const previousAttemptId = provision?.attemptId;
17416
18415
  setProvisionBusy(true);
@@ -17452,13 +18451,13 @@ function FeishuGroupSettingsPage({ account, rpcCall }) {
17452
18451
  if (mounted.current) setProvisionBusy(false);
17453
18452
  }
17454
18453
  }, [account.botId, invoke, provision?.attemptId, provisionBusy]);
17455
- const finishAuthorization = React31.useCallback(async (signal) => {
18454
+ const finishAuthorization = React33.useCallback(async (signal) => {
17456
18455
  const bot = await loadSettings({ signal, restoreProvisioning: false });
17457
18456
  if (signal?.aborted || !mounted.current) return;
17458
18457
  if (!bot) throw new Error("\u7FA4\u6D88\u606F\u6743\u9650\u5DF2\u66F4\u65B0\uFF0C\u4F46\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u673A\u5668\u4EBA\u8FDE\u63A5\u72B6\u6001");
17459
18458
  setProvision(null);
17460
18459
  }, [loadSettings]);
17461
- React31.useEffect(() => {
18460
+ React33.useEffect(() => {
17462
18461
  if (!provision?.attemptId || !["qr", "connecting"].includes(provision.phase) || provision.expired) return void 0;
17463
18462
  const timerHost = globalThis.window ?? globalThis;
17464
18463
  const controller = new AbortController();
@@ -17502,7 +18501,7 @@ function FeishuGroupSettingsPage({ account, rpcCall }) {
17502
18501
  timerHost.clearTimeout(timer);
17503
18502
  };
17504
18503
  }, [account.botId, finishAuthorization, invoke, provision]);
17505
- React31.useEffect(() => {
18504
+ React33.useEffect(() => {
17506
18505
  if (!provision?.attemptId || provision.phase !== "qr" || provision.expired) return void 0;
17507
18506
  const timerHost = globalThis.window ?? globalThis;
17508
18507
  const tick = () => {
@@ -17516,7 +18515,7 @@ function FeishuGroupSettingsPage({ account, rpcCall }) {
17516
18515
  const timer = timerHost.setInterval(tick, 1e3);
17517
18516
  return () => timerHost.clearInterval(timer);
17518
18517
  }, [provision?.attemptId, provision?.expired, provision?.expiresAt, provision?.phase]);
17519
- const cancelAuthorization = React31.useCallback(async () => {
18518
+ const cancelAuthorization = React33.useCallback(async () => {
17520
18519
  if (!provision?.attemptId || provisionBusy) {
17521
18520
  setProvision(null);
17522
18521
  return;
@@ -17605,21 +18604,21 @@ function FeishuGroupSettingsPage({ account, rpcCall }) {
17605
18604
  }
17606
18605
 
17607
18606
  // plugin-src/client/channels/feishu/voice-settings.js
17608
- var React33 = __toESM(require("react"), 1);
18607
+ var React35 = __toESM(require("react"), 1);
17609
18608
 
17610
18609
  // plugin-src/client/channels/feishu/voice-editor.js
17611
- var React32 = __toESM(require("react"), 1);
18610
+ var React34 = __toESM(require("react"), 1);
17612
18611
  function VoiceEditor({ value = null, disabled = false, onSave }) {
17613
- const [enabled, setEnabled] = React32.useState(value != null);
17614
- const [secretRef, setSecretRef] = React32.useState(value?.secretRef ?? "DASHSCOPE_API_KEY");
17615
- const [asrModel, setAsrModel] = React32.useState(value?.asrModel ?? "qwen3-asr-flash");
17616
- const [ttsModel, setTtsModel] = React32.useState(value?.ttsModel ?? "qwen3-tts-flash");
17617
- const [ttsVoice, setTtsVoice] = React32.useState(value?.ttsVoice ?? "Momo");
17618
- const [saving, setSaving] = React32.useState(false);
17619
- const [error, setError] = React32.useState(null);
17620
- const titleId = React32.useId();
18612
+ const [enabled, setEnabled] = React34.useState(value != null);
18613
+ const [secretRef, setSecretRef] = React34.useState(value?.secretRef ?? "DASHSCOPE_API_KEY");
18614
+ const [asrModel, setAsrModel] = React34.useState(value?.asrModel ?? "qwen3-asr-flash");
18615
+ const [ttsModel, setTtsModel] = React34.useState(value?.ttsModel ?? "qwen3-tts-flash");
18616
+ const [ttsVoice, setTtsVoice] = React34.useState(value?.ttsVoice ?? "Momo");
18617
+ const [saving, setSaving] = React34.useState(false);
18618
+ const [error, setError] = React34.useState(null);
18619
+ const titleId = React34.useId();
17621
18620
  const helpId = `${titleId}-help`;
17622
- React32.useEffect(() => {
18621
+ React34.useEffect(() => {
17623
18622
  setEnabled(value != null);
17624
18623
  if (value) {
17625
18624
  setSecretRef(value.secretRef ?? "DASHSCOPE_API_KEY");
@@ -17733,20 +18732,20 @@ function VoiceEditor({ value = null, disabled = false, onSave }) {
17733
18732
 
17734
18733
  // plugin-src/client/channels/feishu/voice-settings.js
17735
18734
  function FeishuVoiceSettingsPage({ account, rpcCall }) {
17736
- const [voice, setVoice] = React33.useState(null);
17737
- const [phase, setPhase] = React33.useState("loading");
17738
- const [error, setError] = React33.useState(null);
17739
- const mounted = React33.useRef(true);
17740
- const invoke = React33.useCallback(async (endpoint, payload, signal) => {
18735
+ const [voice, setVoice] = React35.useState(null);
18736
+ const [phase, setPhase] = React35.useState("loading");
18737
+ const [error, setError] = React35.useState(null);
18738
+ const mounted = React35.useRef(true);
18739
+ const invoke = React35.useCallback(async (endpoint, payload, signal) => {
17741
18740
  if (typeof rpcCall !== "function") throw new Error("\u98DE\u4E66\u8BED\u97F3\u8BBE\u7F6E\u6682\u4E0D\u53EF\u7528\u3002");
17742
18741
  return unwrapRpcResult3(await rpcCall(endpoint, payload, signal));
17743
18742
  }, [rpcCall]);
17744
- const applySnapshot = React33.useCallback((value) => {
18743
+ const applySnapshot = React35.useCallback((value) => {
17745
18744
  const bot = normalizeBotsSnapshot(value).bots.find((entry) => entry.botId === account.botId);
17746
18745
  if (!bot) throw new Error("\u672A\u627E\u5230\u5F53\u524D\u98DE\u4E66\u673A\u5668\u4EBA\uFF0C\u8BF7\u8FD4\u56DE\u5217\u8868\u540E\u91CD\u8BD5\u3002");
17747
18746
  if (mounted.current) setVoice(bot.voice);
17748
18747
  }, [account.botId]);
17749
- const loadSettings = React33.useCallback(async (signal) => {
18748
+ const loadSettings = React35.useCallback(async (signal) => {
17750
18749
  setPhase("loading");
17751
18750
  setError(null);
17752
18751
  try {
@@ -17760,7 +18759,7 @@ function FeishuVoiceSettingsPage({ account, rpcCall }) {
17760
18759
  setPhase("error");
17761
18760
  }
17762
18761
  }, [applySnapshot, invoke]);
17763
- React33.useEffect(() => {
18762
+ React35.useEffect(() => {
17764
18763
  mounted.current = true;
17765
18764
  const controller = new AbortController();
17766
18765
  void loadSettings(controller.signal);
@@ -17799,7 +18798,7 @@ function FeishuVoiceSettingsPage({ account, rpcCall }) {
17799
18798
  }
17800
18799
 
17801
18800
  // plugin-src/client/channels/feishu/slash-panel-settings.js
17802
- var React34 = __toESM(require("react"), 1);
18801
+ var React36 = __toESM(require("react"), 1);
17803
18802
  var MANIFEST_BY_NAME = new Map(SLASH_COMMAND_MANIFEST.map((entry) => [entry.command, entry]));
17804
18803
  var ALL_COMMANDS = Object.freeze(SLASH_COMMAND_MANIFEST.map((entry) => entry.command));
17805
18804
  function PanelButton({ children, disabled = false, onClick, ...props }) {
@@ -17820,30 +18819,30 @@ function commandText(name2) {
17820
18819
  return `/${name2} \u2014 ${entry?.default ?? name2}`;
17821
18820
  }
17822
18821
  function FeishuSlashPanelSettingsPage({ account, rpcCall, onSaved }) {
17823
- const incoming = React34.useMemo(() => normalizeSlashPanelConfig(account.slashPanel), [account.botId, panelSignature(account.slashPanel)]);
17824
- const [mode, setMode] = React34.useState(incoming.mode);
17825
- const [order, setOrder] = React34.useState(() => [...incoming.order]);
17826
- const [pending, setPending] = React34.useState("");
17827
- const [dirty, setDirty] = React34.useState(false);
17828
- const [saving, setSaving] = React34.useState(false);
17829
- const [saved, setSaved] = React34.useState(false);
17830
- const [syncing, setSyncing] = React34.useState(false);
17831
- const [syncTargets, setSyncTargets] = React34.useState(null);
17832
- const [syncNotice, setSyncNotice] = React34.useState(null);
17833
- const [error, setError] = React34.useState(null);
17834
- const mounted = React34.useRef(true);
17835
- React34.useEffect(() => {
18822
+ const incoming = React36.useMemo(() => normalizeSlashPanelConfig(account.slashPanel), [account.botId, panelSignature(account.slashPanel)]);
18823
+ const [mode, setMode] = React36.useState(incoming.mode);
18824
+ const [order, setOrder] = React36.useState(() => [...incoming.order]);
18825
+ const [pending, setPending] = React36.useState("");
18826
+ const [dirty, setDirty] = React36.useState(false);
18827
+ const [saving, setSaving] = React36.useState(false);
18828
+ const [saved, setSaved] = React36.useState(false);
18829
+ const [syncing, setSyncing] = React36.useState(false);
18830
+ const [syncTargets, setSyncTargets] = React36.useState(null);
18831
+ const [syncNotice, setSyncNotice] = React36.useState(null);
18832
+ const [error, setError] = React36.useState(null);
18833
+ const mounted = React36.useRef(true);
18834
+ React36.useEffect(() => {
17836
18835
  mounted.current = true;
17837
18836
  return () => {
17838
18837
  mounted.current = false;
17839
18838
  };
17840
18839
  }, []);
17841
- React34.useEffect(() => {
18840
+ React36.useEffect(() => {
17842
18841
  if (dirty) return;
17843
18842
  setMode(incoming.mode);
17844
18843
  setOrder([...incoming.order]);
17845
18844
  }, [incoming.mode, incoming.order, dirty]);
17846
- const edit = React34.useCallback((update) => {
18845
+ const edit = React36.useCallback((update) => {
17847
18846
  setSaved(false);
17848
18847
  setDirty(true);
17849
18848
  update();
@@ -17980,7 +18979,7 @@ function FeishuSlashPanelSettingsPage({ account, rpcCall, onSaved }) {
17980
18979
  h2("option", { value: SLASH_PANEL_MODES.CUSTOM }, "\u81EA\u5B9A\u4E49\uFF08\u81EA\u5DF1\u6311\u6307\u4EE4\u548C\u987A\u5E8F\uFF09")
17981
18980
  ),
17982
18981
  mode === SLASH_PANEL_MODES.CUSTOM ? h2(
17983
- React34.Fragment,
18982
+ React36.Fragment,
17984
18983
  null,
17985
18984
  order.length === 0 ? h2("p", { className: "dim-feishuGroupHelp" }, "\u5F53\u524D\u6CA1\u6709\u9009\u62E9\u4EFB\u4F55\u6307\u4EE4\uFF0C\u4FDD\u5B58\u540E\u300C/\u300D\u9762\u677F\u4F1A\u53D8\u6210\u7A7A\u7684\u3002") : h2(
17986
18985
  "ul",
@@ -18101,7 +19100,389 @@ function FeishuSlashPanelSettingsPage({ account, rpcCall, onSaved }) {
18101
19100
  );
18102
19101
  }
18103
19102
 
18104
- // plugin-src/client/delivery-settings.js
19103
+ // plugin-src/client/channels/telegram/group-triggers-settings.js
19104
+ var React37 = __toESM(require("react"), 1);
19105
+ var GROUP_TRIGGERS_ENDPOINTS = Object.freeze({
19106
+ get: "bot.group-triggers.get",
19107
+ set: "bot.group-triggers.set",
19108
+ resolve: "bot.group-triggers.resolve"
19109
+ });
19110
+ var GROUP_TRIGGER_MODE_OPTIONS = Object.freeze([
19111
+ Object.freeze({ value: "off", label: "\u4E0D\u54CD\u5E94" }),
19112
+ Object.freeze({ value: "mention", label: "\u88AB @ \u6216\u56DE\u590D\u65F6\uFF08\u4EFB\u4F55\u4EBA\uFF09" }),
19113
+ Object.freeze({ value: "mention-list", label: "\u88AB @ \u6216\u56DE\u590D\u65F6\uFF08\u4EC5\u540D\u5355\u6210\u5458\uFF09" }),
19114
+ Object.freeze({ value: "all", label: "\u6240\u6709\u6D88\u606F\uFF08\u4EFB\u4F55\u4EBA\uFF09" }),
19115
+ Object.freeze({ value: "all-list", label: "\u6240\u6709\u6D88\u606F\uFF08\u4EC5\u540D\u5355\u6210\u5458\uFF09" })
19116
+ ]);
19117
+ var LIST_MODES = /* @__PURE__ */ new Set(["mention-list", "all-list"]);
19118
+ var DEFAULT_ENTRY = Object.freeze({ mode: "off", sendersText: "" });
19119
+ function isListMode(mode) {
19120
+ return LIST_MODES.has(mode);
19121
+ }
19122
+ function modeLabel(value) {
19123
+ return GROUP_TRIGGER_MODE_OPTIONS.find((option) => option.value === value)?.label ?? GROUP_TRIGGER_MODE_OPTIONS[0].label;
19124
+ }
19125
+ function splitMemberIds(text8) {
19126
+ return String(text8 ?? "").split(/[\s,;]+/).map((item) => item.trim()).filter(Boolean);
19127
+ }
19128
+ function entryFromConfig(value) {
19129
+ const mode = GROUP_TRIGGER_MODE_OPTIONS.some((option) => option.value === value?.mode) ? value.mode : "off";
19130
+ const senders = Array.isArray(value?.senders) ? value.senders.map((id6) => String(id6)) : [];
19131
+ return { mode, sendersText: senders.join("\n") };
19132
+ }
19133
+ function stateFromSnapshot(value) {
19134
+ const source = value && typeof value === "object" ? value : {};
19135
+ const groups = {};
19136
+ for (const [chatId, entry] of Object.entries(source.groups ?? {})) {
19137
+ groups[String(chatId)] = entryFromConfig(entry);
19138
+ }
19139
+ const seen = {};
19140
+ for (const entry of Array.isArray(source.seen) ? source.seen : []) {
19141
+ const chatId = typeof entry?.chatId === "string" ? entry.chatId : "";
19142
+ if (!chatId) continue;
19143
+ seen[chatId] = {
19144
+ title: typeof entry.title === "string" ? entry.title : null,
19145
+ type: typeof entry.type === "string" ? entry.type : null,
19146
+ lastSeenAt: typeof entry.lastSeenAt === "string" ? entry.lastSeenAt : null,
19147
+ lastSenderName: typeof entry.lastSenderName === "string" ? entry.lastSenderName : null
19148
+ };
19149
+ }
19150
+ return { defaults: entryFromConfig(source.defaults), groups, seen, removed: [] };
19151
+ }
19152
+ function unwrapRpcResult15(result2) {
19153
+ if (result2?.ok === false) {
19154
+ const error = new Error(result2.error?.message || "\u65E0\u6CD5\u8BFB\u53D6\u6216\u4FDD\u5B58\u7FA4\u804A\u8BBE\u7F6E\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");
19155
+ error.code = result2.error?.code;
19156
+ throw error;
19157
+ }
19158
+ return result2?.ok === true ? result2.value : result2;
19159
+ }
19160
+ function formatMoment(value) {
19161
+ if (typeof value !== "string" || !value) return "\u2014";
19162
+ return value.slice(0, 16).replace("T", " ");
19163
+ }
19164
+ function memberHelp(entry) {
19165
+ if (splitMemberIds(entry.sendersText).length > 0) return null;
19166
+ return isListMode(entry.mode) ? "\u540D\u5355\u4E3A\u7A7A\uFF1A\u8BE5\u6A21\u5F0F\u4E0D\u4F1A\u54CD\u5E94\u4EFB\u4F55\u6210\u5458\u3002" : "\u5F53\u524D\u6A21\u5F0F\u4E0D\u4F7F\u7528\u540D\u5355\u3002";
19167
+ }
19168
+ function ModeField({ entry, onChange, disabled }) {
19169
+ return h2(
19170
+ "label",
19171
+ { className: "dim-accessField" },
19172
+ h2("span", null, "\u54CD\u5E94\u6761\u4EF6"),
19173
+ h2("select", {
19174
+ value: entry.mode,
19175
+ disabled,
19176
+ onChange: (event) => onChange(event.target.value)
19177
+ }, GROUP_TRIGGER_MODE_OPTIONS.map((option) => h2("option", {
19178
+ key: option.value,
19179
+ value: option.value
19180
+ }, option.label)))
19181
+ );
19182
+ }
19183
+ function MembersField({ entry, onChange, disabled }) {
19184
+ const help = memberHelp(entry);
19185
+ return h2(
19186
+ "label",
19187
+ { className: "dim-accessField" },
19188
+ h2("span", null, "\u6210\u5458\u540D\u5355"),
19189
+ h2("textarea", {
19190
+ ...AUTOFILL_GUARD,
19191
+ value: entry.sendersText,
19192
+ rows: 2,
19193
+ disabled,
19194
+ spellCheck: false,
19195
+ placeholder: "123456789",
19196
+ onChange: (event) => onChange(event.target.value)
19197
+ }),
19198
+ help ? h2("span", { className: "dim-channelHelp" }, help) : null
19199
+ );
19200
+ }
19201
+ function ValueRow({ label, value, suffix }) {
19202
+ return h2(
19203
+ "div",
19204
+ { className: "dim-accessField" },
19205
+ h2("span", null, label),
19206
+ h2("code", { className: "dim-groupTriggerValue" }, value, suffix ?? null)
19207
+ );
19208
+ }
19209
+ var AUTOFILL_GUARD = Object.freeze({
19210
+ autoComplete: "off",
19211
+ autoCapitalize: "none",
19212
+ autoCorrect: "off",
19213
+ "data-1p-ignore": "true",
19214
+ "data-lpignore": "true",
19215
+ "data-bwignore": "true",
19216
+ "data-form-type": "other"
19217
+ });
19218
+ function TelegramGroupTriggersSettings({ account, rpcCall }) {
19219
+ const [state, setState] = React37.useState(null);
19220
+ const [addDraft, setAddDraft] = React37.useState(null);
19221
+ const [manualId, setManualId] = React37.useState("");
19222
+ const [phase, setPhase] = React37.useState("loading");
19223
+ const [saving, setSaving] = React37.useState(false);
19224
+ const [resolving, setResolving] = React37.useState(false);
19225
+ const [feedback, setFeedback] = React37.useState(null);
19226
+ const botId = account?.botId;
19227
+ const load = React37.useCallback(async () => {
19228
+ setPhase("loading");
19229
+ setFeedback(null);
19230
+ try {
19231
+ const value = unwrapRpcResult15(await rpcCall(GROUP_TRIGGERS_ENDPOINTS.get, { botId }));
19232
+ setState(stateFromSnapshot(value));
19233
+ setAddDraft(null);
19234
+ setPhase("ready");
19235
+ } catch (error) {
19236
+ setPhase("error");
19237
+ setFeedback({ tone: "error", message: error?.message || "\u65E0\u6CD5\u8BFB\u53D6\u7FA4\u804A\u8BBE\u7F6E\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002" });
19238
+ }
19239
+ }, [botId, rpcCall]);
19240
+ React37.useEffect(() => {
19241
+ void load();
19242
+ }, [load]);
19243
+ if (phase === "loading") {
19244
+ return h2("div", { className: "dim-accessState", "aria-busy": "true" }, "\u6B63\u5728\u8BFB\u53D6\u7FA4\u804A\u8BBE\u7F6E\u2026");
19245
+ }
19246
+ if (phase === "error" || !state) {
19247
+ return h2(
19248
+ "div",
19249
+ { className: "dim-accessState", role: "alert" },
19250
+ h2("p", null, feedback?.message || "\u65E0\u6CD5\u8BFB\u53D6\u7FA4\u804A\u8BBE\u7F6E\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"),
19251
+ h2(
19252
+ "button",
19253
+ { type: "button", className: "dim-deliveryButton", onClick: () => void load() },
19254
+ "\u91CD\u8BD5"
19255
+ )
19256
+ );
19257
+ }
19258
+ const removed = new Set(state.removed);
19259
+ const chatIds = [.../* @__PURE__ */ new Set([...Object.keys(state.groups), ...Object.keys(state.seen)])].filter((chatId) => !removed.has(chatId));
19260
+ const addEntry = addDraft ?? DEFAULT_ENTRY;
19261
+ const updateDefault = (patch) => {
19262
+ setState((current) => ({ ...current, defaults: { ...current.defaults, ...patch } }));
19263
+ setFeedback(null);
19264
+ };
19265
+ const updateGroup = (chatId, patch) => {
19266
+ setState((current) => ({
19267
+ ...current,
19268
+ groups: { ...current.groups, [chatId]: { ...current.groups[chatId] ?? current.defaults, ...patch } }
19269
+ }));
19270
+ setFeedback(null);
19271
+ };
19272
+ const removeGroup = (chatId) => {
19273
+ setState((current) => {
19274
+ const groups = { ...current.groups };
19275
+ delete groups[chatId];
19276
+ return { ...current, groups, removed: [...current.removed, chatId] };
19277
+ });
19278
+ setFeedback({ tone: "success", message: "\u5DF2\u4ECE\u5217\u8868\u79FB\u9664\uFF0C\u4FDD\u5B58\u540E\u751F\u6548\u3002" });
19279
+ };
19280
+ const addGroup = async () => {
19281
+ const raw = manualId.replace(/[\s\u00a0]+/g, "");
19282
+ if (!raw) return;
19283
+ setResolving(true);
19284
+ setFeedback(null);
19285
+ try {
19286
+ const resolved = unwrapRpcResult15(await rpcCall(GROUP_TRIGGERS_ENDPOINTS.resolve, { botId, input: raw }));
19287
+ const chatId = typeof resolved?.chatId === "string" ? resolved.chatId : "";
19288
+ if (!chatId) throw new Error("\u65E0\u6CD5\u89E3\u6790\u8BE5\u7FA4\u804A\uFF0C\u8BF7\u91CD\u8BD5\u6216\u586B\u5199\u6570\u5B57\u7FA4 ID\u3002");
19289
+ if (Object.hasOwn(state.groups, chatId)) {
19290
+ setFeedback({
19291
+ tone: "error",
19292
+ message: "\u8BE5\u7FA4\u5DF2\u5728\u5217\u8868\u4E2D\uFF0C\u8BF7\u7F16\u8F91\u4E0A\u65B9\u7684\u5361\u7247\u3002",
19293
+ detail: chatId
19294
+ });
19295
+ return;
19296
+ }
19297
+ setState((current) => ({
19298
+ ...current,
19299
+ groups: { ...current.groups, [chatId]: { ...addEntry } },
19300
+ // Re-adding a hidden chat must undo the previous removal.
19301
+ removed: current.removed.filter((entry) => entry !== chatId),
19302
+ seen: resolved?.title ? { ...current.seen, [chatId]: { ...current.seen[chatId] ?? {}, title: resolved.title } } : current.seen
19303
+ }));
19304
+ setManualId("");
19305
+ setAddDraft(null);
19306
+ setFeedback({
19307
+ tone: "success",
19308
+ message: resolved?.verified === false ? "\u5DF2\u6DFB\u52A0\u3002Telegram \u672A\u786E\u8BA4\u8BE5\u7FA4\uFF08\u673A\u5668\u4EBA\u53EF\u80FD\u8FD8\u4E0D\u5728\u7FA4\u91CC\uFF09\uFF0C\u4FDD\u5B58\u540E\u751F\u6548\u3002" : "\u5DF2\u6DFB\u52A0\uFF0C\u4FDD\u5B58\u540E\u751F\u6548\u3002"
19309
+ });
19310
+ } catch (error) {
19311
+ setFeedback({ tone: "error", message: error?.message || "\u65E0\u6CD5\u89E3\u6790\u8BE5\u7FA4\u804A\uFF0C\u8BF7\u91CD\u8BD5\u6216\u586B\u5199\u6570\u5B57\u7FA4 ID\u3002" });
19312
+ } finally {
19313
+ setResolving(false);
19314
+ }
19315
+ };
19316
+ const save = async (event) => {
19317
+ event.preventDefault();
19318
+ setSaving(true);
19319
+ setFeedback(null);
19320
+ try {
19321
+ const groups = {};
19322
+ for (const [chatId, entry] of Object.entries(state.groups)) {
19323
+ groups[chatId] = { mode: entry.mode, senders: splitMemberIds(entry.sendersText) };
19324
+ }
19325
+ const value = unwrapRpcResult15(await rpcCall(GROUP_TRIGGERS_ENDPOINTS.set, {
19326
+ botId,
19327
+ config: {
19328
+ defaults: { mode: state.defaults.mode, senders: splitMemberIds(state.defaults.sendersText) },
19329
+ groups
19330
+ },
19331
+ removed: state.removed
19332
+ }));
19333
+ setState(stateFromSnapshot(value));
19334
+ setAddDraft(null);
19335
+ setFeedback({ tone: "success", message: "\u7FA4\u804A\u8BBE\u7F6E\u5DF2\u4FDD\u5B58\u3002" });
19336
+ } catch (error) {
19337
+ setFeedback({ tone: "error", message: error?.message || "\u65E0\u6CD5\u4FDD\u5B58\u7FA4\u804A\u8BBE\u7F6E\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002" });
19338
+ } finally {
19339
+ setSaving(false);
19340
+ }
19341
+ };
19342
+ return h2(
19343
+ "form",
19344
+ { className: "dim-accessPage", onSubmit: (event) => void save(event) },
19345
+ h2(
19346
+ "fieldset",
19347
+ { className: "dim-accessScene" },
19348
+ h2("legend", null, "\u65B0\u7FA4\u804A\u9ED8\u8BA4\u8BBE\u7F6E"),
19349
+ h2(
19350
+ "div",
19351
+ { className: "dim-accessControls" },
19352
+ h2(ModeField, {
19353
+ entry: state.defaults,
19354
+ disabled: saving,
19355
+ onChange: (mode) => updateDefault({ mode })
19356
+ })
19357
+ ),
19358
+ h2(MembersField, {
19359
+ entry: state.defaults,
19360
+ disabled: saving,
19361
+ onChange: (sendersText) => updateDefault({ sendersText })
19362
+ })
19363
+ ),
19364
+ chatIds.map((chatId) => {
19365
+ const configured = Object.hasOwn(state.groups, chatId);
19366
+ const entry = state.groups[chatId] ?? state.defaults;
19367
+ const info = state.seen[chatId] ?? {};
19368
+ return h2(
19369
+ "fieldset",
19370
+ { key: chatId, className: "dim-accessScene" },
19371
+ h2("legend", null, info.title || chatId),
19372
+ h2(ValueRow, { label: "\u7FA4 ID", value: chatId }),
19373
+ info.title ? h2(ValueRow, { label: "\u6807\u9898", value: info.title }) : null,
19374
+ h2(ValueRow, {
19375
+ label: "\u6700\u8FD1\u6D3B\u52A8",
19376
+ value: `${formatMoment(info.lastSeenAt)}${info.lastSenderName ? ` \xB7 ${info.lastSenderName}` : ""}`
19377
+ }),
19378
+ configured ? h2(ModeField, {
19379
+ entry,
19380
+ disabled: saving,
19381
+ onChange: (mode) => updateGroup(chatId, { mode })
19382
+ }) : h2(ValueRow, {
19383
+ label: "\u54CD\u5E94\u6761\u4EF6",
19384
+ value: modeLabel(state.defaults.mode),
19385
+ suffix: "\uFF08\u9ED8\u8BA4\uFF09"
19386
+ }),
19387
+ configured ? h2(MembersField, {
19388
+ entry,
19389
+ disabled: saving,
19390
+ onChange: (sendersText) => updateGroup(chatId, { sendersText })
19391
+ }) : null,
19392
+ h2(
19393
+ "div",
19394
+ { className: "dim-accessActions" },
19395
+ configured ? null : h2("button", {
19396
+ type: "button",
19397
+ className: "dim-deliveryButton",
19398
+ "data-kind": "primary",
19399
+ disabled: saving,
19400
+ onClick: () => updateGroup(chatId, {})
19401
+ }, "\u81EA\u5B9A\u4E49"),
19402
+ h2("button", {
19403
+ type: "button",
19404
+ className: "dim-deliveryButton",
19405
+ "data-kind": "danger",
19406
+ disabled: saving,
19407
+ onClick: () => removeGroup(chatId)
19408
+ }, "\xD7 \u79FB\u9664")
19409
+ )
19410
+ );
19411
+ }),
19412
+ h2(
19413
+ "fieldset",
19414
+ { className: "dim-accessScene" },
19415
+ h2("legend", null, "\u6DFB\u52A0\u7FA4\u804A"),
19416
+ h2(
19417
+ "label",
19418
+ { className: "dim-accessField" },
19419
+ h2("span", null, "\u7FA4 ID\u3001@\u7528\u6237\u540D\u6216\u6D88\u606F\u94FE\u63A5"),
19420
+ h2("textarea", {
19421
+ ...AUTOFILL_GUARD,
19422
+ value: manualId,
19423
+ rows: 1,
19424
+ spellCheck: false,
19425
+ placeholder: "-1001234567890",
19426
+ style: { resize: "none", minHeight: "2.4em", overflow: "hidden" },
19427
+ onChange: (event) => setManualId(event.target.value.replace(/[\s\u00a0]+/g, "")),
19428
+ onKeyDown: (event) => {
19429
+ if (event.key !== "Enter") return;
19430
+ event.preventDefault();
19431
+ if (!saving && !resolving && manualId) void addGroup();
19432
+ }
19433
+ }),
19434
+ h2(
19435
+ "span",
19436
+ { className: "dim-channelHelp" },
19437
+ "\u652F\u6301\u6570\u5B57 ID\u3001@\u7528\u6237\u540D\u3001t.me/<name> \u6216 t.me/c/<id>/<msg>\uFF1B\u771F\u5B9E ID \u901A\u8FC7 getChat \u89E3\u6790\u3002"
19438
+ )
19439
+ ),
19440
+ h2(
19441
+ "div",
19442
+ { className: "dim-accessControls" },
19443
+ h2(ModeField, {
19444
+ entry: addEntry,
19445
+ disabled: saving,
19446
+ onChange: (mode) => setAddDraft({ ...addEntry, mode })
19447
+ })
19448
+ ),
19449
+ h2(MembersField, {
19450
+ entry: addEntry,
19451
+ disabled: saving,
19452
+ onChange: (sendersText) => setAddDraft({ ...addEntry, sendersText })
19453
+ }),
19454
+ h2(
19455
+ "div",
19456
+ { className: "dim-accessActions" },
19457
+ h2("button", {
19458
+ type: "button",
19459
+ className: "dim-deliveryButton",
19460
+ "data-kind": "primary",
19461
+ disabled: saving || resolving || !manualId,
19462
+ onClick: () => void addGroup()
19463
+ }, resolving ? "\u2026" : "+ \u6DFB\u52A0")
19464
+ )
19465
+ ),
19466
+ feedback ? h2("p", {
19467
+ className: "dim-accessFeedback",
19468
+ "data-tone": feedback.tone,
19469
+ role: feedback.tone === "error" ? "alert" : "status",
19470
+ "aria-live": "polite"
19471
+ }, feedback.message, feedback.detail ? h2("code", { className: "dim-groupTriggerValue" }, feedback.detail) : null) : null,
19472
+ h2(
19473
+ "div",
19474
+ { className: "dim-accessActions" },
19475
+ h2("button", {
19476
+ type: "submit",
19477
+ className: "dim-deliveryButton",
19478
+ "data-kind": "primary",
19479
+ disabled: saving
19480
+ }, saving ? "\u6B63\u5728\u4FDD\u5B58\u2026" : "\u4FDD\u5B58\u7FA4\u804A\u8BBE\u7F6E")
19481
+ )
19482
+ );
19483
+ }
19484
+
19485
+ // plugin-src/client/delivery-settings.js
18105
19486
  var DELIVERY_RPC_CHANNEL = "/dsh-im-delivery";
18106
19487
  var DELIVERY_DOCS_URL = Object.freeze({
18107
19488
  zh: "https://github.com/xmanrui/dsh-im/blob/main/PROACTIVE_DELIVERY.md",
@@ -18119,6 +19500,7 @@ var DELIVERY_ENDPOINTS = Object.freeze({
18119
19500
  var BOT_SETTINGS_TABS = Object.freeze([
18120
19501
  Object.freeze({ id: "general", label: "\u901A\u7528" }),
18121
19502
  Object.freeze({ id: "delivery", label: "\u6295\u9012\u8BBE\u7F6E" }),
19503
+ Object.freeze({ id: "ds-bot", label: "\u7ED1\u5B9Abot" }),
18122
19504
  Object.freeze({ id: "access", label: "\u8BBF\u95EE\u8BBE\u7F6E" })
18123
19505
  ]);
18124
19506
  var FEISHU_BOT_SETTINGS_TABS = Object.freeze([
@@ -18127,8 +19509,14 @@ var FEISHU_BOT_SETTINGS_TABS = Object.freeze([
18127
19509
  Object.freeze({ id: "slash", label: "\u6307\u4EE4\u9762\u677F" }),
18128
19510
  Object.freeze({ id: "voice", label: "\u8BED\u97F3\u4EA4\u4E92" })
18129
19511
  ]);
19512
+ var TELEGRAM_BOT_SETTINGS_TABS = Object.freeze([
19513
+ ...BOT_SETTINGS_TABS,
19514
+ Object.freeze({ id: "groups", label: "\u673A\u5668\u4EBA\u7FA4\u804A\u884C\u4E3A" })
19515
+ ]);
18130
19516
  function botSettingsTabsForChannel(channel7) {
18131
- return channel7 === "feishu" ? FEISHU_BOT_SETTINGS_TABS : BOT_SETTINGS_TABS;
19517
+ if (channel7 === "feishu") return FEISHU_BOT_SETTINGS_TABS;
19518
+ if (channel7 === "telegram") return TELEGRAM_BOT_SETTINGS_TABS;
19519
+ return BOT_SETTINGS_TABS;
18132
19520
  }
18133
19521
  var CHANNEL_DEFINITIONS = Object.freeze({
18134
19522
  weixin: {
@@ -18219,7 +19607,7 @@ var CHANNEL_DEFINITIONS = Object.freeze({
18219
19607
  function presentError14(error, fallback) {
18220
19608
  return error?.message || fallback;
18221
19609
  }
18222
- function unwrapRpcResult15(result2) {
19610
+ function unwrapRpcResult16(result2) {
18223
19611
  if (result2?.ok === true) return result2.value;
18224
19612
  if (result2?.ok === false) {
18225
19613
  const error = new Error(result2.error?.message || "\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");
@@ -18337,13 +19725,13 @@ function TargetForm({
18337
19725
  }) {
18338
19726
  const editing = mode === "edit";
18339
19727
  const initialKind = initialValue?.kind && definition.fields[initialValue.kind] ? initialValue.kind : definition.kinds[0].value;
18340
- const [targetId, setTargetId] = React35.useState(initialValue?.targetId ?? "");
18341
- const [name2, setName] = React35.useState(initialValue?.name ?? "");
18342
- const [kind, setKind] = React35.useState(initialKind);
18343
- const [route, setRoute] = React35.useState(initialValue?.route ?? {});
18344
- const [error, setError] = React35.useState(null);
18345
- const [testing, setTesting] = React35.useState(false);
18346
- const [testState, setTestState] = React35.useState(null);
19728
+ const [targetId, setTargetId] = React38.useState(initialValue?.targetId ?? "");
19729
+ const [name2, setName] = React38.useState(initialValue?.name ?? "");
19730
+ const [kind, setKind] = React38.useState(initialKind);
19731
+ const [route, setRoute] = React38.useState(initialValue?.route ?? {});
19732
+ const [error, setError] = React38.useState(null);
19733
+ const [testing, setTesting] = React38.useState(false);
19734
+ const [testState, setTestState] = React38.useState(null);
18347
19735
  const currentTarget = () => {
18348
19736
  const normalizedRoute = Object.fromEntries(fieldsFor(definition, kind).map((field2) => {
18349
19737
  const raw = String(route[field2.key] ?? "").trim();
@@ -18560,7 +19948,7 @@ function TargetSuggestionPicker({
18560
19948
  suggestions.map((suggestion, index) => {
18561
19949
  const identity = routeIdentity(definition, suggestion);
18562
19950
  const added = configured.has(identity);
18563
- return React35.createElement("option", {
19951
+ return React38.createElement("option", {
18564
19952
  key: suggestion.id ?? suggestion.suggestionId ?? `${identity}:${index}`,
18565
19953
  value: String(index),
18566
19954
  disabled: added
@@ -18577,11 +19965,11 @@ function TargetSuggestionPicker({
18577
19965
  );
18578
19966
  }
18579
19967
  function TargetRow({ definition, target, botId, connected, rpcCall, onChanged, onEdit }) {
18580
- const [action, setAction] = React35.useState(null);
18581
- const [testState, setTestState] = React35.useState(null);
18582
- const [syncFeedback, setSyncFeedback] = React35.useState(null);
18583
- const [copyState, setCopyState] = React35.useState(null);
18584
- const [confirmDelete, setConfirmDelete] = React35.useState(false);
19968
+ const [action, setAction] = React38.useState(null);
19969
+ const [testState, setTestState] = React38.useState(null);
19970
+ const [syncFeedback, setSyncFeedback] = React38.useState(null);
19971
+ const [copyState, setCopyState] = React38.useState(null);
19972
+ const [confirmDelete, setConfirmDelete] = React38.useState(false);
18585
19973
  const sessionSync = target.sessionSync ?? { enabled: false, state: "unavailable" };
18586
19974
  const syncDescription = sessionSync.state === "active" ? "\u81EA\u52A8\u8DDF\u968F\u8BE5\u79C1\u804A\u7684\u5F53\u524D\u4F1A\u8BDD" : sessionSync.state === "waiting" ? "\u7B49\u5F85\u8BE5\u79C1\u804A\u5EFA\u7ACB\u65B0\u4F1A\u8BDD" : sessionSync.state === "unavailable" ? "\u4EC5\u652F\u6301\u5DF2\u7ECF\u804A\u8FC7\u3001\u5DF2\u5EFA\u7ACB\u5F53\u524D\u4F1A\u8BDD\u4E14\u4F7F\u7528\u5F53\u524D Host Harness \u7684\u79C1\u804A\u76EE\u6807" : "\u5173\u95ED\u65F6\u4E0D\u53D1\u9001 DSH \u4F1A\u8BDD\u6D88\u606F";
18587
19975
  const testTarget = async () => {
@@ -18644,7 +20032,7 @@ function TargetRow({ definition, target, botId, connected, rpcCall, onChanged, o
18644
20032
  h2(
18645
20033
  "div",
18646
20034
  { className: "dim-targetTitle" },
18647
- React35.createElement("strong", null, target.name || target.targetId),
20035
+ React38.createElement("strong", null, target.name || target.targetId),
18648
20036
  h2("span", null, kindLabel(definition, target.kind))
18649
20037
  ),
18650
20038
  h2("code", null, `targetId: ${target.targetId}`)
@@ -18730,30 +20118,30 @@ function DeliveryTargetSettingsPage({
18730
20118
  onBack
18731
20119
  }) {
18732
20120
  const definition = CHANNEL_DEFINITIONS[channel7];
18733
- const [activeTabId, setActiveTabId] = React35.useState(BOT_SETTINGS_TABS[0].id);
18734
- const [phase, setPhase] = React35.useState("loading");
18735
- const [targets, setTargets] = React35.useState([]);
18736
- const [suggestionPhase, setSuggestionPhase] = React35.useState("idle");
18737
- const [suggestions, setSuggestions] = React35.useState([]);
18738
- const [suggestionError, setSuggestionError] = React35.useState(null);
18739
- const [error, setError] = React35.useState(null);
18740
- const [editor, setEditor] = React35.useState(null);
18741
- const [saving, setSaving] = React35.useState(false);
18742
- const [botCopyState, setBotCopyState] = React35.useState(null);
18743
- const [accessPolicy, setAccessPolicy] = React35.useState(account.accessPolicy);
18744
- const [slashPanel, setSlashPanel] = React35.useState(account.slashPanel);
18745
- const mounted = React35.useRef(true);
18746
- React35.useEffect(() => {
20121
+ const [activeTabId, setActiveTabId] = React38.useState(BOT_SETTINGS_TABS[0].id);
20122
+ const [phase, setPhase] = React38.useState("loading");
20123
+ const [targets, setTargets] = React38.useState([]);
20124
+ const [suggestionPhase, setSuggestionPhase] = React38.useState("idle");
20125
+ const [suggestions, setSuggestions] = React38.useState([]);
20126
+ const [suggestionError, setSuggestionError] = React38.useState(null);
20127
+ const [error, setError] = React38.useState(null);
20128
+ const [editor, setEditor] = React38.useState(null);
20129
+ const [saving, setSaving] = React38.useState(false);
20130
+ const [botCopyState, setBotCopyState] = React38.useState(null);
20131
+ const [accessPolicy, setAccessPolicy] = React38.useState(account.accessPolicy);
20132
+ const [slashPanel, setSlashPanel] = React38.useState(account.slashPanel);
20133
+ const mounted = React38.useRef(true);
20134
+ React38.useEffect(() => {
18747
20135
  setAccessPolicy(account.accessPolicy);
18748
20136
  }, [account.botId, account.accessPolicy]);
18749
- React35.useEffect(() => {
20137
+ React38.useEffect(() => {
18750
20138
  setSlashPanel(account.slashPanel);
18751
20139
  }, [account.botId, account.slashPanel]);
18752
- const invoke = React35.useCallback(async (endpoint, payload = {}, signal) => {
20140
+ const invoke = React38.useCallback(async (endpoint, payload = {}, signal) => {
18753
20141
  if (typeof rpcCall !== "function") throw new Error("\u6295\u9012\u76EE\u6807\u8BBE\u7F6E\u6682\u4E0D\u53EF\u7528\u3002");
18754
- return unwrapRpcResult15(await rpcCall(endpoint, payload, signal));
20142
+ return unwrapRpcResult16(await rpcCall(endpoint, payload, signal));
18755
20143
  }, [rpcCall]);
18756
- const loadTargets = React35.useCallback(async ({ signal, silent = false } = {}) => {
20144
+ const loadTargets = React38.useCallback(async ({ signal, silent = false } = {}) => {
18757
20145
  if (!silent) setPhase("loading");
18758
20146
  setError(null);
18759
20147
  try {
@@ -18767,7 +20155,7 @@ function DeliveryTargetSettingsPage({
18767
20155
  setPhase("error");
18768
20156
  }
18769
20157
  }, [account.botId, invoke]);
18770
- const loadSuggestions = React35.useCallback(async () => {
20158
+ const loadSuggestions = React38.useCallback(async () => {
18771
20159
  setSuggestionPhase("loading");
18772
20160
  setSuggestionError(null);
18773
20161
  try {
@@ -18781,7 +20169,7 @@ function DeliveryTargetSettingsPage({
18781
20169
  setSuggestionPhase("error");
18782
20170
  }
18783
20171
  }, [account.botId, definition, invoke]);
18784
- React35.useEffect(() => {
20172
+ React38.useEffect(() => {
18785
20173
  mounted.current = true;
18786
20174
  const controller = new AbortController();
18787
20175
  void loadTargets({ signal: controller.signal });
@@ -18876,11 +20264,19 @@ function DeliveryTargetSettingsPage({
18876
20264
  role: "tabpanel",
18877
20265
  "aria-labelledby": activeTabDomId
18878
20266
  },
18879
- activeTab.id === "general" ? h2(BotGeneralSettingsPage, { key: `${channel7}:${account.botId}`, channel: channel7, account, rpcCall: accessRpcCall }) : activeTab.id === "access" ? h2(AccessPolicySettingsPage, {
20267
+ activeTab.id === "general" ? h2(BotGeneralSettingsPage, { key: `${channel7}:${account.botId}`, channel: channel7, account, rpcCall: accessRpcCall }) : activeTab.id === "ds-bot" ? h2(DsBotSettingsPage, {
20268
+ key: account.botId,
20269
+ botId: account.botId,
20270
+ rpcCall: invoke
20271
+ }) : activeTab.id === "access" ? h2(AccessPolicySettingsPage, {
18880
20272
  channel: channel7,
18881
20273
  account: { ...account, accessPolicy },
18882
20274
  rpcCall: accessRpcCall,
18883
20275
  onSaved: setAccessPolicy
20276
+ }) : activeTab.id === "groups" && channel7 === "telegram" ? h2(TelegramGroupTriggersSettings, {
20277
+ key: `${channel7}:${account.botId}:groups`,
20278
+ account,
20279
+ rpcCall: accessRpcCall
18884
20280
  }) : activeTab.id === "group" && channel7 === "feishu" ? h2(FeishuGroupSettingsPage, {
18885
20281
  account,
18886
20282
  rpcCall: accessRpcCall
@@ -18893,7 +20289,7 @@ function DeliveryTargetSettingsPage({
18893
20289
  account,
18894
20290
  rpcCall: accessRpcCall
18895
20291
  }) : h2(
18896
- React35.Fragment,
20292
+ React38.Fragment,
18897
20293
  null,
18898
20294
  h2(
18899
20295
  "section",
@@ -19004,7 +20400,7 @@ function DeliveryTargetSettingsPage({
19004
20400
  }
19005
20401
 
19006
20402
  // plugin-src/client/group-history-settings.js
19007
- var React36 = __toESM(require("react"), 1);
20403
+ var React39 = __toESM(require("react"), 1);
19008
20404
  var GROUP_HISTORY_SETTINGS_ENDPOINTS = Object.freeze({
19009
20405
  get: "settings.group-history.get",
19010
20406
  set: "settings.group-history.set"
@@ -19014,14 +20410,14 @@ function result(value) {
19014
20410
  return value?.ok === true ? value.value : value;
19015
20411
  }
19016
20412
  function GroupHistorySettings({ rpcCall }) {
19017
- const [days, setDays] = React36.useState("14");
19018
- const [phase, setPhase] = React36.useState("loading");
19019
- const [error, setError] = React36.useState(null);
19020
- const [notice, setNotice] = React36.useState(null);
19021
- const mounted = React36.useRef(false);
19022
- const busy = React36.useRef(false);
19023
- const id6 = React36.useId();
19024
- const load = React36.useCallback(async (signal) => {
20413
+ const [days, setDays] = React39.useState("14");
20414
+ const [phase, setPhase] = React39.useState("loading");
20415
+ const [error, setError] = React39.useState(null);
20416
+ const [notice, setNotice] = React39.useState(null);
20417
+ const mounted = React39.useRef(false);
20418
+ const busy = React39.useRef(false);
20419
+ const id6 = React39.useId();
20420
+ const load = React39.useCallback(async (signal) => {
19025
20421
  setPhase("loading");
19026
20422
  setError(null);
19027
20423
  try {
@@ -19037,7 +20433,7 @@ function GroupHistorySettings({ rpcCall }) {
19037
20433
  setPhase("error");
19038
20434
  }
19039
20435
  }, [rpcCall]);
19040
- React36.useEffect(() => {
20436
+ React39.useEffect(() => {
19041
20437
  mounted.current = true;
19042
20438
  const controller = new AbortController();
19043
20439
  void load(controller.signal);
@@ -19123,8 +20519,194 @@ function GroupHistorySettings({ rpcCall }) {
19123
20519
  );
19124
20520
  }
19125
20521
 
20522
+ // plugin-src/client/sidebar-settings.js
20523
+ var React40 = __toESM(require("react"), 1);
20524
+ var SIDEBAR_SETTINGS_RPC_CHANNEL = "/dsh-im-sidebar";
20525
+ var SIDEBAR_SETTINGS_ENDPOINTS = Object.freeze({
20526
+ get: "settings.sidebar-entry.get",
20527
+ set: "settings.sidebar-entry.set"
20528
+ });
20529
+ function settingsResult(result2) {
20530
+ if (result2?.ok === false) throw new Error(result2.error?.message || "\u65E0\u6CD5\u8BFB\u53D6\u6216\u4FDD\u5B58\u4FA7\u8FB9\u680F\u8BBE\u7F6E\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");
20531
+ const value = result2?.ok === true ? result2.value : result2;
20532
+ if (!["auto", "show", "hide"].includes(value?.mode) || typeof value.visible !== "boolean") {
20533
+ throw new Error("\u4FA7\u8FB9\u680F\u8BBE\u7F6E\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94\u3002");
20534
+ }
20535
+ return value;
20536
+ }
20537
+ function installSidebarVisibilitySync({
20538
+ rpcCall,
20539
+ setVisible,
20540
+ setTimeoutFn = globalThis.setTimeout,
20541
+ clearTimeoutFn = globalThis.clearTimeout,
20542
+ pollMs = 3e4
20543
+ }) {
20544
+ const abort = new AbortController();
20545
+ let timer;
20546
+ let running = false;
20547
+ let pending = false;
20548
+ let revision = 0;
20549
+ const schedule = (delay) => {
20550
+ clearTimeoutFn(timer);
20551
+ if (!abort.signal.aborted) timer = setTimeoutFn(refresh, delay);
20552
+ };
20553
+ const refresh = async () => {
20554
+ if (abort.signal.aborted) return;
20555
+ if (running) {
20556
+ pending = true;
20557
+ return;
20558
+ }
20559
+ running = true;
20560
+ pending = false;
20561
+ const current = revision;
20562
+ try {
20563
+ const value = settingsResult(await rpcCall(SIDEBAR_SETTINGS_ENDPOINTS.get, {}, abort.signal));
20564
+ if (!abort.signal.aborted && current === revision && !pending) setVisible(value.visible);
20565
+ } catch {
20566
+ } finally {
20567
+ running = false;
20568
+ schedule(pending ? 0 : pollMs);
20569
+ }
20570
+ };
20571
+ void refresh();
20572
+ return {
20573
+ refresh() {
20574
+ revision++;
20575
+ if (running) pending = true;
20576
+ else schedule(0);
20577
+ },
20578
+ apply(value) {
20579
+ revision++;
20580
+ if (!abort.signal.aborted) setVisible(settingsResult(value).visible);
20581
+ },
20582
+ dispose() {
20583
+ abort.abort();
20584
+ clearTimeoutFn(timer);
20585
+ }
20586
+ };
20587
+ }
20588
+ function SidebarSettings({ rpcCall }) {
20589
+ const [mode, setMode] = React40.useState("auto");
20590
+ const [phase, setPhase] = React40.useState("loading");
20591
+ const [error, setError] = React40.useState(null);
20592
+ const [saved, setSaved] = React40.useState(false);
20593
+ const mounted = React40.useRef(false);
20594
+ const busy = React40.useRef(false);
20595
+ const failedMode = React40.useRef(null);
20596
+ const id6 = React40.useId();
20597
+ const disabled = phase === "loading" || phase === "saving";
20598
+ const load = React40.useCallback(async (signal) => {
20599
+ setPhase("loading");
20600
+ setError(null);
20601
+ setSaved(false);
20602
+ failedMode.current = null;
20603
+ try {
20604
+ const value = settingsResult(await rpcCall(SIDEBAR_SETTINGS_ENDPOINTS.get, {}, signal));
20605
+ if (signal?.aborted || !mounted.current) return;
20606
+ setMode(value.mode);
20607
+ setPhase("ready");
20608
+ } catch (caught) {
20609
+ if (signal?.aborted || !mounted.current) return;
20610
+ setError(caught.message);
20611
+ setPhase("error");
20612
+ }
20613
+ }, [rpcCall]);
20614
+ React40.useEffect(() => {
20615
+ mounted.current = true;
20616
+ const abort = new AbortController();
20617
+ void load(abort.signal);
20618
+ return () => {
20619
+ mounted.current = false;
20620
+ abort.abort();
20621
+ };
20622
+ }, [load]);
20623
+ const save = async (nextMode) => {
20624
+ if (busy.current || disabled) return;
20625
+ const previousMode = mode;
20626
+ busy.current = true;
20627
+ setPhase("saving");
20628
+ setError(null);
20629
+ setSaved(false);
20630
+ setMode(nextMode);
20631
+ failedMode.current = null;
20632
+ try {
20633
+ const value = settingsResult(await rpcCall(SIDEBAR_SETTINGS_ENDPOINTS.set, { mode: nextMode }));
20634
+ if (mounted.current) {
20635
+ setMode(value.mode);
20636
+ setSaved(true);
20637
+ setPhase("ready");
20638
+ }
20639
+ } catch (caught) {
20640
+ if (mounted.current) {
20641
+ failedMode.current = nextMode;
20642
+ setMode(previousMode);
20643
+ setError(caught.message);
20644
+ setPhase("error");
20645
+ }
20646
+ } finally {
20647
+ busy.current = false;
20648
+ }
20649
+ };
20650
+ return h2(
20651
+ "section",
20652
+ { className: "dim-botGeneralSettings dim-sidebarSettings", "aria-label": "\u4FA7\u8FB9\u680F\u5165\u53E3", "aria-busy": disabled },
20653
+ h2(
20654
+ "div",
20655
+ { className: "dim-botGeneralRow" },
20656
+ h2(
20657
+ "div",
20658
+ { className: "dim-botGeneralText" },
20659
+ h2(
20660
+ "div",
20661
+ { className: "dim-sidebarHeading" },
20662
+ h2("label", { className: "dim-botGeneralTitle", htmlFor: id6 }, "\u4FA7\u8FB9\u680F\u5165\u53E3"),
20663
+ h2(
20664
+ "span",
20665
+ { role: "status", className: "dim-botGeneralHelp" },
20666
+ phase === "loading" ? "\u6B63\u5728\u8BFB\u53D6\u4FA7\u8FB9\u680F\u8BBE\u7F6E\u2026" : phase === "saving" ? "\u4FDD\u5B58\u4E2D\u2026" : saved ? "\u5DF2\u4FDD\u5B58" : ""
20667
+ )
20668
+ ),
20669
+ h2("p", { className: "dim-botGeneralHelp", id: `${id6}-help` }, "\u81EA\u52A8\u6A21\u5F0F\uFF1A\u672A\u914D\u7F6E\u6E20\u9053\u65F6\u663E\u793A\uFF0C\u914D\u7F6E\u81F3\u5C11\u4E00\u4E2A\u6E20\u9053\u540E\u9690\u85CF\u3002\u9690\u85CF\u540E\u4ECD\u53EF\u4ECE\u63D2\u4EF6\u8BE6\u60C5\u6216\u8BBE\u7F6E\u8FDB\u5165\uFF0C\u4E0D\u5F71\u54CD\u673A\u5668\u4EBA\u540E\u53F0\u8FD0\u884C\u3002")
20670
+ ),
20671
+ h2(
20672
+ "div",
20673
+ { className: "dim-botGeneralControl" },
20674
+ h2(
20675
+ "select",
20676
+ {
20677
+ id: id6,
20678
+ className: "dim-sidebarSelect",
20679
+ value: mode,
20680
+ disabled,
20681
+ "aria-describedby": `${id6}-help`,
20682
+ onChange: (event) => save(event.target.value)
20683
+ },
20684
+ h2("option", { value: "auto" }, "\u81EA\u52A8\u9690\u85CF"),
20685
+ h2("option", { value: "show" }, "\u59CB\u7EC8\u663E\u793A"),
20686
+ h2("option", { value: "hide" }, "\u59CB\u7EC8\u9690\u85CF")
20687
+ ),
20688
+ h2(
20689
+ "svg",
20690
+ { width: 16, height: 16, viewBox: "0 0 16 16", "aria-hidden": true },
20691
+ h2("path", { d: "m4 6 4 4 4-4", fill: "none", stroke: "currentColor", strokeWidth: 1.5 })
20692
+ )
20693
+ )
20694
+ ),
20695
+ error ? h2(
20696
+ "div",
20697
+ { className: "dim-sidebarFeedback" },
20698
+ h2("p", { role: "alert", className: "dim-accessFeedback", "data-tone": "error" }, error),
20699
+ h2("button", {
20700
+ type: "button",
20701
+ className: "dim-deliveryButton",
20702
+ onClick: () => failedMode.current === null ? load() : save(failedMode.current)
20703
+ }, "\u91CD\u8BD5")
20704
+ ) : null
20705
+ );
20706
+ }
20707
+
19126
20708
  // plugin-src/client/global-settings.js
19127
- var React37 = __toESM(require("react"), 1);
20709
+ var React41 = __toESM(require("react"), 1);
19128
20710
 
19129
20711
  // src/channels/shared/inbound-ttl.mjs
19130
20712
  var DEFAULT_INBOUND_TTL_HOURS = 168;
@@ -19179,7 +20761,7 @@ var GLOBAL_SETTINGS_ENDPOINTS = Object.freeze({
19179
20761
  function presentError15(error, fallback) {
19180
20762
  return error?.message || fallback;
19181
20763
  }
19182
- function unwrapRpcResult16(result2) {
20764
+ function unwrapRpcResult17(result2) {
19183
20765
  if (result2?.ok === true) return result2.value;
19184
20766
  if (result2?.ok === false) {
19185
20767
  const error = new Error(result2.error?.message || "\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");
@@ -19209,18 +20791,18 @@ function GlobalButton({ children, kind = "secondary", className = "", ...props }
19209
20791
  }, children);
19210
20792
  }
19211
20793
  function ImageInputSettings({ rpcCall }) {
19212
- const [values, setValues] = React37.useState(DEFAULT_IMAGE_INPUT_SETTINGS);
19213
- const [phase, setPhase] = React37.useState("loading");
19214
- const [error, setError] = React37.useState(null);
19215
- const [saved, setSaved] = React37.useState(false);
19216
- const mounted = React37.useRef(false);
19217
- const saving = React37.useRef(false);
19218
- const id6 = React37.useId();
19219
- const load = React37.useCallback(async (signal) => {
20794
+ const [values, setValues] = React41.useState(DEFAULT_IMAGE_INPUT_SETTINGS);
20795
+ const [phase, setPhase] = React41.useState("loading");
20796
+ const [error, setError] = React41.useState(null);
20797
+ const [saved, setSaved] = React41.useState(false);
20798
+ const mounted = React41.useRef(false);
20799
+ const saving = React41.useRef(false);
20800
+ const id6 = React41.useId();
20801
+ const load = React41.useCallback(async (signal) => {
19220
20802
  setPhase("loading");
19221
20803
  setError(null);
19222
20804
  try {
19223
- const result2 = unwrapRpcResult16(await rpcCall(GLOBAL_SETTINGS_ENDPOINTS.getImages, {}, signal));
20805
+ const result2 = unwrapRpcResult17(await rpcCall(GLOBAL_SETTINGS_ENDPOINTS.getImages, {}, signal));
19224
20806
  if (signal?.aborted || !mounted.current) return;
19225
20807
  const settings = normalizeImageInputSettings(result2);
19226
20808
  if (!settings) throw new Error("\u901A\u7528\u8BBE\u7F6E\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94\u3002");
@@ -19232,7 +20814,7 @@ function ImageInputSettings({ rpcCall }) {
19232
20814
  setPhase("error");
19233
20815
  }
19234
20816
  }, [rpcCall]);
19235
- React37.useEffect(() => {
20817
+ React41.useEffect(() => {
19236
20818
  mounted.current = true;
19237
20819
  const controller = new AbortController();
19238
20820
  void load(controller.signal);
@@ -19254,7 +20836,7 @@ function ImageInputSettings({ rpcCall }) {
19254
20836
  setPhase("saving");
19255
20837
  setError(null);
19256
20838
  try {
19257
- const result2 = unwrapRpcResult16(await rpcCall(GLOBAL_SETTINGS_ENDPOINTS.setImages, settings));
20839
+ const result2 = unwrapRpcResult17(await rpcCall(GLOBAL_SETTINGS_ENDPOINTS.setImages, settings));
19258
20840
  if (!normalizeImageInputSettings(result2)) throw new Error("\u901A\u7528\u8BBE\u7F6E\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94\u3002");
19259
20841
  if (mounted.current) {
19260
20842
  setValues(result2);
@@ -19339,29 +20921,29 @@ function ImageInputSettings({ rpcCall }) {
19339
20921
  );
19340
20922
  }
19341
20923
  function AttachmentSettingsPanel({ rpcCall }) {
19342
- const [phase, setPhase] = React37.useState("loading");
19343
- const [loadError, setLoadError] = React37.useState(null);
19344
- const [ttlInput, setTtlInput] = React37.useState("");
19345
- const [savedTtl, setSavedTtl] = React37.useState(null);
19346
- const [ttlError, setTtlError] = React37.useState(false);
19347
- const [saveError, setSaveError] = React37.useState(null);
19348
- const [saveSucceeded, setSaveSucceeded] = React37.useState(false);
19349
- const [isSaving, setIsSaving] = React37.useState(false);
19350
- const [sweepConfirming, setSweepConfirming] = React37.useState(false);
19351
- const [sweeping, setSweeping] = React37.useState(false);
19352
- const ttlErrorId = React37.useId();
19353
- const ttlHintsId = React37.useId();
19354
- const sweepTriggerId = React37.useId();
19355
- const sweepConfirmId = React37.useId();
19356
- const sweepConfirmTextId = React37.useId();
19357
- const sweepConfirmButtonId = React37.useId();
19358
- const mounted = React37.useRef(true);
19359
- const saving = React37.useRef(false);
19360
- const invoke = React37.useCallback(async (endpoint, payload = {}, signal) => {
20924
+ const [phase, setPhase] = React41.useState("loading");
20925
+ const [loadError, setLoadError] = React41.useState(null);
20926
+ const [ttlInput, setTtlInput] = React41.useState("");
20927
+ const [savedTtl, setSavedTtl] = React41.useState(null);
20928
+ const [ttlError, setTtlError] = React41.useState(false);
20929
+ const [saveError, setSaveError] = React41.useState(null);
20930
+ const [saveSucceeded, setSaveSucceeded] = React41.useState(false);
20931
+ const [isSaving, setIsSaving] = React41.useState(false);
20932
+ const [sweepConfirming, setSweepConfirming] = React41.useState(false);
20933
+ const [sweeping, setSweeping] = React41.useState(false);
20934
+ const ttlErrorId = React41.useId();
20935
+ const ttlHintsId = React41.useId();
20936
+ const sweepTriggerId = React41.useId();
20937
+ const sweepConfirmId = React41.useId();
20938
+ const sweepConfirmTextId = React41.useId();
20939
+ const sweepConfirmButtonId = React41.useId();
20940
+ const mounted = React41.useRef(true);
20941
+ const saving = React41.useRef(false);
20942
+ const invoke = React41.useCallback(async (endpoint, payload = {}, signal) => {
19361
20943
  if (typeof rpcCall !== "function") throw new Error("\u901A\u7528\u8BBE\u7F6E\u6682\u4E0D\u53EF\u7528\u3002");
19362
- return unwrapRpcResult16(await rpcCall(endpoint, payload, signal));
20944
+ return unwrapRpcResult17(await rpcCall(endpoint, payload, signal));
19363
20945
  }, [rpcCall]);
19364
- const loadSettings = React37.useCallback(async ({ signal } = {}) => {
20946
+ const loadSettings = React41.useCallback(async ({ signal } = {}) => {
19365
20947
  setPhase("loading");
19366
20948
  setLoadError(null);
19367
20949
  try {
@@ -19385,7 +20967,7 @@ function AttachmentSettingsPanel({ rpcCall }) {
19385
20967
  setPhase("error");
19386
20968
  }
19387
20969
  }, [invoke]);
19388
- React37.useEffect(() => {
20970
+ React41.useEffect(() => {
19389
20971
  mounted.current = true;
19390
20972
  const controller = new AbortController();
19391
20973
  void loadSettings({ signal: controller.signal });
@@ -19394,7 +20976,7 @@ function AttachmentSettingsPanel({ rpcCall }) {
19394
20976
  controller.abort();
19395
20977
  };
19396
20978
  }, [loadSettings]);
19397
- React37.useEffect(() => {
20979
+ React41.useEffect(() => {
19398
20980
  if (!sweepConfirming) return;
19399
20981
  globalThis.document?.getElementById(sweepConfirmButtonId)?.focus();
19400
20982
  }, [sweepConfirmButtonId, sweepConfirming]);
@@ -19616,7 +21198,7 @@ function AttachmentSettingsPanel({ rpcCall }) {
19616
21198
  );
19617
21199
  }
19618
21200
  function GlobalSettingsPanel({ rpcCall }) {
19619
- const [tab, setTab] = React37.useState("general");
21201
+ const [tab, setTab] = React41.useState("general");
19620
21202
  const tabs = [{ key: "general", label: "\u901A\u7528" }, { key: "attachments", label: "\u9644\u4EF6" }];
19621
21203
  return h2(
19622
21204
  "section",
@@ -19653,7 +21235,7 @@ function GlobalSettingsPanel({ rpcCall }) {
19653
21235
  className: "dim-generalSettingsTabPanel",
19654
21236
  role: "tabpanel",
19655
21237
  "aria-labelledby": "dim-general-settings-tab-general"
19656
- }, h2(GroupHistorySettings, { rpcCall })) : h2(AttachmentSettingsPanel, { rpcCall })
21238
+ }, h2(SidebarSettings, { rpcCall }), h2(GroupHistorySettings, { rpcCall })) : h2(AttachmentSettingsPanel, { rpcCall })
19657
21239
  );
19658
21240
  }
19659
21241
 
@@ -19718,13 +21300,10 @@ var CSS15 = String.raw`
19718
21300
  .dim-sidebarIcon { display: block; flex: none; }
19719
21301
  .dim-pluginOpen { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 7px 14px; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 8px; color: var(--dsw-alias-label-primary, #1f2329); background: var(--dsw-alias-bg-layer-1, #fff); font: inherit; font-size: 13px; line-height: 20px; cursor: pointer; }
19720
21302
  .dim-pluginOpen:hover { background: var(--dsw-alias-interactive-bg-hover, #f7f8fa); }
19721
- .dim-pluginOpen:focus-visible, .dim-pluginBack:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary, #3370ff); outline-offset: 3px; }
21303
+ .dim-pluginOpen:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary, #3370ff); outline-offset: 3px; }
19722
21304
  .dim-pluginPage { height: 100%; min-height: 0; overflow: auto; box-sizing: border-box; padding: 24px clamp(16px, 4vw, 48px) 32px; color: var(--dsw-alias-label-primary, #1f2329); }
19723
21305
  .dim-pluginPageContent { max-width: 1080px; margin: 0 auto; }
19724
- .dim-pluginBack { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; margin: 0 0 24px; padding: 6px 8px; border: 0; border-radius: 8px; color: var(--dsw-alias-label-secondary, #646a73); background: transparent; font: inherit; font-size: 13px; line-height: 20px; cursor: pointer; }
19725
- .dim-pluginBack:hover { color: var(--dsw-alias-label-primary, #1f2329); background: var(--dsw-alias-interactive-bg-hover, #f7f8fa); }
19726
- .dim-pluginBack > span { font-size: 22px; line-height: 20px; }
19727
- @media (pointer: coarse) { .dim-pluginOpen, .dim-pluginBack { min-height: 44px; } }
21306
+ @media (pointer: coarse) { .dim-pluginOpen { min-height: 44px; } }
19728
21307
  .dim-connectionDiagnostic { min-width: 0; width: 100%; color: var(--dsw-alias-label-secondary, #646a73); overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; }
19729
21308
  .dim-connectionDiagnostic[data-warning="true"] { color: var(--dsw-alias-state-warn-primary, #d97706); }
19730
21309
  .dim-connectionDiagnostic p { margin: 4px 0; }
@@ -20316,6 +21895,25 @@ var CSS15 = String.raw`
20316
21895
  .dim-targetField input[readonly] { color: var(--dsw-alias-label-secondary, #646a73); background: var(--dsw-alias-bg-module-platform, #f7f8fa); }
20317
21896
  .dim-targetFormError { margin: 10px 0 0; font-size: 12px; line-height: 18px; }
20318
21897
  .dim-targetFormActions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 12px; }
21898
+ .dim-dsBotForm { margin-top: 20px; }
21899
+ .dim-dsBotForm .dim-targetFormGrid { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); margin-top: 0; gap: 16px; }
21900
+ .dim-dsBotForm .dim-targetFormActions { margin-top: 16px; }
21901
+ .dim-targetRow.dim-dsBotBinding { grid-template-columns: minmax(0, 1fr) max-content; align-items: center; }
21902
+ .dim-dsBotDestination { margin: 3px 0 0; color: var(--dsw-alias-label-secondary, #646a73); font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
21903
+ .dim-dsBotNotice { margin: 20px 0 0; color: var(--dsw-alias-label-secondary, #646a73); font-size: 12px; line-height: 20px; }
21904
+ .dim-dsBotNotice p { margin: 0 0 10px; }
21905
+ .dim-dsBotSettings > .dim-targetFeedback { margin-top: 12px; }
21906
+ .dim-dsBotAvatar { display: block; flex: none; object-fit: cover; border-radius: 5px; }
21907
+ .dim-dsBotBoundIdentity { display: flex; align-items: center; gap: 10px; min-width: 0; }
21908
+ .dim-dsBotPicker { position: relative; min-width: 0; }
21909
+ .dim-dsBotPickerTrigger { display: flex; align-items: center; gap: 8px; width: 100%; height: 34px; padding: 0 9px; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 7px; color: var(--dsw-alias-label-primary, #1f2329); background: var(--dsw-alias-bg-layer-1, #fff); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
21910
+ .dim-dsBotPickerName { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
21911
+ .dim-dsBotPickerTrigger:focus-visible { outline: 2px solid color-mix(in srgb, var(--dsw-alias-state-business-primary, #3370ff) 28%, transparent); border-color: var(--dsw-alias-state-business-primary, #3370ff); }
21912
+ .dim-dsBotPickerTrigger:disabled { opacity: .5; cursor: not-allowed; }
21913
+ .dim-dsBotOptions { position: absolute; z-index: 20; inset: calc(100% + 5px) 0 auto; max-height: 240px; overflow-y: auto; padding: 4px; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 9px; background: var(--dsw-alias-bg-layer-1, #fff); box-shadow: 0 5px 18px rgb(0 0 0 / 10%); }
21914
+ .dim-dsBotOptions > button { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 5px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--dsw-alias-label-primary, #1f2329); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
21915
+ .dim-dsBotOptions > button[data-active="true"] { background: var(--dsw-alias-interactive-bg-hover, #eef0f3); }
21916
+ .dim-dsBotOptions > button[aria-selected="true"] { color: var(--dsw-alias-state-business-primary, #3370ff); }
20319
21917
  .dim-accessPage { min-width: 0; display: grid; gap: 14px; }
20320
21918
  .dim-accessScene { position: relative; min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 12px; background: var(--dsw-alias-bg-layer-3, #fff); }
20321
21919
  .dim-accessScene > legend { padding: 0 6px; color: var(--dsw-alias-label-primary, #1f2329); font-size: 15px; line-height: 22px; font-weight: 650; }
@@ -20326,6 +21924,10 @@ var CSS15 = String.raw`
20326
21924
  .dim-accessControls[data-mode="allowlist"] { grid-template-columns: minmax(0, 1fr); }
20327
21925
  .dim-accessField { min-width: 0; display: grid; align-content: start; gap: 5px; color: var(--dsw-alias-label-secondary, #646a73); font-size: 11px; line-height: 16px; }
20328
21926
  .dim-accessField input, .dim-accessField select { width: 100%; min-width: 0; height: 36px; padding: 0 9px; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 7px; color: var(--dsw-alias-label-primary, #1f2329); background: var(--dsw-alias-bg-layer-1, #fff); font: inherit; font-size: 12px; }
21927
+ .dim-accessField textarea { width: 100%; min-width: 0; padding: 7px 9px; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 7px; color: var(--dsw-alias-label-primary, #1f2329); background: var(--dsw-alias-bg-layer-1, #fff); font: inherit; font-size: 12px; line-height: 18px; resize: vertical; }
21928
+ .dim-accessField textarea:focus { outline: 2px solid color-mix(in srgb, var(--dsw-alias-state-business-primary, #3370ff) 28%, transparent); border-color: var(--dsw-alias-state-business-primary, #3370ff); }
21929
+ .dim-accessField textarea:disabled { opacity: .6; }
21930
+ .dim-groupTriggerValue { color: var(--dsw-alias-label-primary, #1f2329); font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
20329
21931
  .dim-accessField input:focus, .dim-accessField select:focus { outline: 2px solid color-mix(in srgb, var(--dsw-alias-state-business-primary, #3370ff) 28%, transparent); border-color: var(--dsw-alias-state-business-primary, #3370ff); }
20330
21932
  .dim-accessUsers { min-width: 0; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--dsw-alias-border-l1, #eef0f3); }
20331
21933
  .dim-accessUsersHeading { position: relative; min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
@@ -20360,6 +21962,14 @@ var CSS15 = String.raw`
20360
21962
  .dim-botGeneralControl { position: relative; min-width: 0; max-width: 100%; justify-self: end; color: var(--dsw-alias-label-primary, #1f2329); }
20361
21963
  .dim-botGeneralControl select, .dim-groupHistoryInput { display: block; min-width: 104px; max-width: 100%; height: 36px; padding: 0 36px 0 14px; border: 0; border-radius: 10px; color: inherit; background: var(--dsw-alias-bg-module-platform, #f5f6f7); font: inherit; font-size: 14px; line-height: 22px; appearance: none; }
20362
21964
  .dim-botGeneralControl select { cursor: pointer; }
21965
+ .dim-sidebarSettings { border-bottom: 1px solid var(--dsw-alias-border-l2, #dfe1e5); }
21966
+ .dim-sidebarSettings .dim-botGeneralRow { border-bottom: 0; }
21967
+ .dim-sidebarHeading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
21968
+ .dim-sidebarFeedback { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; }
21969
+ .dim-sidebarFeedback .dim-accessFeedback { flex: 1; min-width: 0; }
21970
+ /* Native option popups do not inherit the select's painted background on
21971
+ Windows. Set both colors so dark Host text never lands on a light popup. */
21972
+ .dim-sidebarSelect option { color: var(--dsw-alias-label-primary, #1f2329); background: var(--dsw-alias-bg-layer-3, #fff); }
20363
21973
  .dim-botGeneralControl select:hover:not(:disabled), .dim-groupHistoryInput:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover, #eef0f3); }
20364
21974
  .dim-botGeneralControl select:focus-visible, .dim-groupHistoryInput:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary, #3370ff); outline-offset: 2px; }
20365
21975
  .dim-botGeneralControl select:disabled, .dim-groupHistoryInput:disabled { opacity: .5; cursor: not-allowed; }
@@ -20768,8 +22378,91 @@ function installSessionChannelLogos(document2 = globalThis.document) {
20768
22378
  };
20769
22379
  }
20770
22380
 
22381
+ // plugin-src/client/ds-bot-session-avatars.js
22382
+ var React42 = __toESM(require("react"), 1);
22383
+ var DS_BOT_SESSIONS_ENDPOINT = "ds-bot.sessions.list";
22384
+ function installDsBotSessionAvatars(ctx, {
22385
+ rpcCall,
22386
+ setTimeoutFn = globalThis.setTimeout,
22387
+ clearTimeoutFn = globalThis.clearTimeout,
22388
+ document: document2 = globalThis.document,
22389
+ window: window2 = globalThis.window
22390
+ }) {
22391
+ let refresh = () => {
22392
+ };
22393
+ const stop = ctx.slots.inject("sidebar.session.row.leading", () => {
22394
+ const abort = new AbortController();
22395
+ const listeners = /* @__PURE__ */ new Set();
22396
+ let bots = /* @__PURE__ */ new Map();
22397
+ let signature = "";
22398
+ let timer;
22399
+ let running = false;
22400
+ let revision = 0;
22401
+ const publish = (entries) => {
22402
+ const next = JSON.stringify(entries);
22403
+ if (next === signature) return;
22404
+ signature = next;
22405
+ bots = new Map(entries.map(({ sessionId, bot }) => [sessionId, bot]));
22406
+ for (const listener of listeners) listener();
22407
+ };
22408
+ const subscribe = (listener) => {
22409
+ listeners.add(listener);
22410
+ return () => listeners.delete(listener);
22411
+ };
22412
+ function SessionAvatar({ sessionId }) {
22413
+ const bot = React42.useSyncExternalStore(subscribe, () => bots.get(sessionId) ?? null);
22414
+ return bot ? React42.createElement(DsBotAvatar, { bot, size: 16 }) : null;
22415
+ }
22416
+ const schedule = () => {
22417
+ clearTimeoutFn(timer);
22418
+ if (!abort.signal.aborted) timer = setTimeoutFn(load, 0);
22419
+ };
22420
+ const load = async () => {
22421
+ if (abort.signal.aborted || running) return;
22422
+ running = true;
22423
+ const current = revision;
22424
+ try {
22425
+ const result2 = await rpcCall(DS_BOT_SESSIONS_ENDPOINT, {}, abort.signal);
22426
+ if (result2?.ok !== true || !Array.isArray(result2.value)) throw new Error("Unavailable");
22427
+ if (!abort.signal.aborted && current === revision) publish(result2.value);
22428
+ } catch {
22429
+ if (!abort.signal.aborted && current === revision) publish([]);
22430
+ } finally {
22431
+ running = false;
22432
+ if (current !== revision) schedule();
22433
+ }
22434
+ };
22435
+ refresh = () => {
22436
+ revision++;
22437
+ if (!running) schedule();
22438
+ };
22439
+ const wake = () => {
22440
+ if (!document2?.hidden) refresh();
22441
+ };
22442
+ window2?.addEventListener("focus", wake);
22443
+ document2?.addEventListener("visibilitychange", wake);
22444
+ const unregister = ctx.slots.register({
22445
+ name: "sidebar.session.row.leading",
22446
+ id: "dsh-im-ds-bot-avatar",
22447
+ order: 0
22448
+ }, SessionAvatar);
22449
+ void load();
22450
+ return () => {
22451
+ abort.abort();
22452
+ clearTimeoutFn(timer);
22453
+ window2?.removeEventListener("focus", wake);
22454
+ document2?.removeEventListener("visibilitychange", wake);
22455
+ refresh = () => {
22456
+ };
22457
+ unregister();
22458
+ listeners.clear();
22459
+ };
22460
+ });
22461
+ return { refresh: () => refresh(), dispose: stop };
22462
+ }
22463
+
20771
22464
  // plugin-src/client/update-panel.js
20772
- var React38 = __toESM(require("react"), 1);
22465
+ var React43 = __toESM(require("react"), 1);
20773
22466
  var import_react_dom4 = require("react-dom");
20774
22467
  var import_valid = __toESM(require_valid(), 1);
20775
22468
  var import_rcompare = __toESM(require_rcompare(), 1);
@@ -20862,11 +22555,11 @@ function manualUpdateCommand(snapshot) {
20862
22555
  return `dsh plugin --profile ${profileArgument} add -w @xmanrui/dsh-im@${version}`;
20863
22556
  }
20864
22557
  function ManualUpdateCommand({ command, disabled, sourceInstall, desktop }) {
20865
- const [copyState, setCopyState] = React38.useState("idle");
20866
- const commandRef = React38.useRef(null);
20867
- const mounted = React38.useRef(false);
20868
- const copying = React38.useRef(false);
20869
- React38.useEffect(() => {
22558
+ const [copyState, setCopyState] = React43.useState("idle");
22559
+ const commandRef = React43.useRef(null);
22560
+ const mounted = React43.useRef(false);
22561
+ const copying = React43.useRef(false);
22562
+ React43.useEffect(() => {
20870
22563
  mounted.current = true;
20871
22564
  return () => {
20872
22565
  mounted.current = false;
@@ -20898,7 +22591,7 @@ function ManualUpdateCommand({ command, disabled, sourceInstall, desktop }) {
20898
22591
  { className: "dim-updateManual", "aria-label": "\u624B\u5DE5\u66F4\u65B0" },
20899
22592
  h2("h4", { className: "dim-updateManualHeading" }, "\u624B\u5DE5\u66F4\u65B0"),
20900
22593
  command ? h2(
20901
- React38.Fragment,
22594
+ React43.Fragment,
20902
22595
  null,
20903
22596
  h2("p", { className: "dim-updateManualHint" }, "\u81EA\u52A8\u66F4\u65B0\u5931\u8D25\u53EF\u4EE5\u4F7F\u7528\u547D\u4EE4\u66F4\u65B0\uFF1A"),
20904
22597
  h2(
@@ -20934,7 +22627,7 @@ function ManualUpdateCommand({ command, disabled, sourceInstall, desktop }) {
20934
22627
  "aria-hidden": "true",
20935
22628
  focusable: "false"
20936
22629
  }, copyState === "copied" ? h2("path", { d: "m4 10 4 4 8-8" }) : h2(
20937
- React38.Fragment,
22630
+ React43.Fragment,
20938
22631
  null,
20939
22632
  h2("rect", { x: 7, y: 7, width: 10, height: 11, rx: 1.5 }),
20940
22633
  h2("path", { d: "M5 13H3.5A1.5 1.5 0 0 1 2 11.5v-8A1.5 1.5 0 0 1 3.5 2h8A1.5 1.5 0 0 1 13 3.5V5" })
@@ -20959,10 +22652,10 @@ function ManualUpdateCommand({ command, disabled, sourceInstall, desktop }) {
20959
22652
  );
20960
22653
  }
20961
22654
  function UpdateDialog({ children, onClose }) {
20962
- const dialogRef = React38.useRef(null);
20963
- const titleId = React38.useId();
20964
- const descriptionId = React38.useId();
20965
- React38.useEffect(() => {
22655
+ const dialogRef = React43.useRef(null);
22656
+ const titleId = React43.useId();
22657
+ const descriptionId = React43.useId();
22658
+ React43.useEffect(() => {
20966
22659
  const previous = globalThis.document?.activeElement;
20967
22660
  dialogRef.current?.focus?.();
20968
22661
  return () => {
@@ -21020,20 +22713,20 @@ function UpdateDialog({ children, onClose }) {
21020
22713
  return typeof document !== "undefined" && document.body ? (0, import_react_dom4.createPortal)(content, document.body) : content;
21021
22714
  }
21022
22715
  function UpdatePanel({ rpcCall, clientVersion, onStatus }) {
21023
- const tooltipId = React38.useId();
21024
- const [snapshot, setSnapshot] = React38.useState(null);
21025
- const [action, setAction] = React38.useState("status");
21026
- const [error, setError] = React38.useState(null);
21027
- const [open, setOpen] = React38.useState(false);
21028
- const [uncertainInstall, setUncertainInstall] = React38.useState(false);
21029
- const mounted = React38.useRef(false);
21030
- const busy = React38.useRef(false);
21031
- const readController = React38.useRef(null);
21032
- const pollReadController = React38.useRef(null);
21033
- const installRequest = React38.useRef(null);
21034
- const onStatusRef = React38.useRef(onStatus);
22716
+ const tooltipId = React43.useId();
22717
+ const [snapshot, setSnapshot] = React43.useState(null);
22718
+ const [action, setAction] = React43.useState("status");
22719
+ const [error, setError] = React43.useState(null);
22720
+ const [open, setOpen] = React43.useState(false);
22721
+ const [uncertainInstall, setUncertainInstall] = React43.useState(false);
22722
+ const mounted = React43.useRef(false);
22723
+ const busy = React43.useRef(false);
22724
+ const readController = React43.useRef(null);
22725
+ const pollReadController = React43.useRef(null);
22726
+ const installRequest = React43.useRef(null);
22727
+ const onStatusRef = React43.useRef(onStatus);
21035
22728
  onStatusRef.current = onStatus;
21036
- const accept = React38.useCallback((next) => {
22729
+ const accept = React43.useCallback((next) => {
21037
22730
  setSnapshot(next);
21038
22731
  onStatusRef.current?.(next);
21039
22732
  }, []);
@@ -21042,7 +22735,7 @@ function UpdatePanel({ rpcCall, clientVersion, onStatus }) {
21042
22735
  setUncertainInstall(false);
21043
22736
  accept(next);
21044
22737
  };
21045
- const invoke = React38.useCallback(async (endpoint, payload = {}, signal) => {
22738
+ const invoke = React43.useCallback(async (endpoint, payload = {}, signal) => {
21046
22739
  if (typeof rpcCall !== "function") {
21047
22740
  const unavailable = new Error("\u5F53\u524D Host \u4E0D\u652F\u6301\u66F4\u65B0\u63A5\u53E3\uFF0C\u8BF7\u5148\u624B\u52A8\u66F4\u65B0\u63D2\u4EF6\u5E76\u91CD\u542F\u3002");
21048
22741
  unavailable.code = "update-unavailable";
@@ -21050,7 +22743,7 @@ function UpdatePanel({ rpcCall, clientVersion, onStatus }) {
21050
22743
  }
21051
22744
  return unwrapSnapshot(await rpcCall(endpoint, payload, signal));
21052
22745
  }, [rpcCall]);
21053
- React38.useEffect(() => {
22746
+ React43.useEffect(() => {
21054
22747
  mounted.current = true;
21055
22748
  busy.current = true;
21056
22749
  const controller = new AbortController();
@@ -21073,7 +22766,7 @@ function UpdatePanel({ rpcCall, clientVersion, onStatus }) {
21073
22766
  const activeJob = ACTIVE_STATES4.has(snapshot?.job?.state);
21074
22767
  const restartRequired = snapshot?.job?.state === "restart-required" || snapshot?.blockedReason === "pending-restart";
21075
22768
  const shouldPoll = activeJob || uncertainInstall;
21076
- React38.useEffect(() => {
22769
+ React43.useEffect(() => {
21077
22770
  if (!shouldPoll) return void 0;
21078
22771
  let controller;
21079
22772
  const scheduler = createPollScheduler({
@@ -21174,7 +22867,7 @@ function UpdatePanel({ rpcCall, clientVersion, onStatus }) {
21174
22867
  const buttonLabel = action === "checking" ? "\u68C0\u67E5\u4E2D\u2026" : action === "starting" || activeJob ? "\u6B63\u5728\u66F4\u65B0\u2026" : restartRequired ? "\u5F85\u624B\u52A8\u91CD\u542F" : snapshot?.canInstall ? "\u66F4\u65B0\u81F3" : "\u68C0\u67E5\u66F4\u65B0";
21175
22868
  const buttonDescription = localizeText(buttonLabel) + (buttonLabel === "\u66F4\u65B0\u81F3" ? ` v${snapshot.latestVersion}` : "");
21176
22869
  return h2(
21177
- React38.Fragment,
22870
+ React43.Fragment,
21178
22871
  null,
21179
22872
  h2(
21180
22873
  "span",
@@ -21224,25 +22917,25 @@ function UpdatePanel({ rpcCall, clientVersion, onStatus }) {
21224
22917
  h2("dt", null, "\u8FD0\u884C\u7248\u672C"),
21225
22918
  h2("dd", null, `v${snapshot?.runningVersion ?? clientVersion}`),
21226
22919
  snapshot?.installedVersion && snapshot.installedVersion !== snapshot.runningVersion ? h2(
21227
- React38.Fragment,
22920
+ React43.Fragment,
21228
22921
  null,
21229
22922
  h2("dt", null, "\u5DF2\u5B89\u88C5\u7248\u672C"),
21230
22923
  h2("dd", null, `v${snapshot.installedVersion}`)
21231
22924
  ) : null,
21232
22925
  targetVersion ? h2(
21233
- React38.Fragment,
22926
+ React43.Fragment,
21234
22927
  null,
21235
22928
  h2("dt", null, "\u76EE\u6807\u7248\u672C"),
21236
22929
  h2("dd", null, `v${targetVersion}`)
21237
22930
  ) : null,
21238
22931
  latestVersion ? h2(
21239
- React38.Fragment,
22932
+ React43.Fragment,
21240
22933
  null,
21241
22934
  h2("dt", null, "\u6700\u65B0\u7248\u672C"),
21242
22935
  h2("dd", null, `v${latestVersion}`)
21243
22936
  ) : null,
21244
22937
  historicalTargetVersion ? h2(
21245
- React38.Fragment,
22938
+ React43.Fragment,
21246
22939
  null,
21247
22940
  h2("dt", null, "\u4E0A\u6B21\u66F4\u65B0\u76EE\u6807"),
21248
22941
  h2("dd", null, `v${historicalTargetVersion}`)
@@ -21319,8 +23012,8 @@ function UpdatePanel({ rpcCall, clientVersion, onStatus }) {
21319
23012
  }
21320
23013
 
21321
23014
  // plugin-src/client/panel-error-boundary.js
21322
- var React39 = __toESM(require("react"), 1);
21323
- var IMPanelErrorBoundary = class extends React39.Component {
23015
+ var React44 = __toESM(require("react"), 1);
23016
+ var IMPanelErrorBoundary = class extends React44.Component {
21324
23017
  state = { failed: false };
21325
23018
  static getDerivedStateFromError() {
21326
23019
  return { failed: true };
@@ -21340,9 +23033,9 @@ var IMPanelErrorBoundary = class extends React39.Component {
21340
23033
  };
21341
23034
 
21342
23035
  // plugin-src/client/plugin-page.js
21343
- var React40 = __toESM(require("react"), 1);
23036
+ var React45 = __toESM(require("react"), 1);
21344
23037
  var IM_MAIN_PANEL_ID = "xmanrui-dsh-im";
21345
- var h3 = React40.createElement;
23038
+ var h3 = React45.createElement;
21346
23039
  function OpenImAction({ subject, packageName, onOpen, t }) {
21347
23040
  if (subject?.kind !== "bundle" && subject?.kind !== "row") return null;
21348
23041
  if (subject.pkg?.name !== packageName) return null;
@@ -21353,19 +23046,13 @@ function OpenImAction({ subject, packageName, onOpen, t }) {
21353
23046
  onClick: onOpen
21354
23047
  }, t("\u6253\u5F00 IM\u673A\u5668\u4EBA"));
21355
23048
  }
21356
- function ImPluginPage({ renderPanel, onBack, t }) {
23049
+ function ImPluginPage({ renderPanel }) {
21357
23050
  return h3(
21358
23051
  "div",
21359
23052
  { className: "dim-pluginPage" },
21360
23053
  h3(
21361
23054
  "div",
21362
23055
  { className: "dim-pluginPageContent" },
21363
- h3(
21364
- "button",
21365
- { type: "button", className: "dim-pluginBack", onClick: onBack },
21366
- h3("span", { "aria-hidden": true }, "\u2039"),
21367
- t("\u8FD4\u56DE\u63D2\u4EF6\u8BE6\u60C5")
21368
- ),
21369
23056
  renderPanel()
21370
23057
  )
21371
23058
  );
@@ -21390,25 +23077,43 @@ function ImSidebarIcon({ size }) {
21390
23077
  h3("path", { d: "M12 6.5A2.5 2.5 0 0 1 14.5 9v2.8a2.4 2.4 0 0 1-.7 1.7l.7 1.2-2.3-.7H8A2.5 2.5 0 0 1 5.5 11.5V9A2.5 2.5 0 0 1 8 6.5h.5" })
21391
23078
  );
21392
23079
  }
21393
- function installImPluginPage(ctx, { packageName, renderPanel }) {
21394
- if (typeof ctx.inject !== "function") return;
21395
- ctx.inject(["layout", "pluginNavigation"], (pageCtx) => pageCtx.slots.inject("main", () => {
23080
+ function installImPluginPage(ctx, { packageName, renderPanel, sidebarVisible = false }) {
23081
+ let visible = sidebarVisible;
23082
+ let updateSidebar = null;
23083
+ const controller = {
23084
+ setSidebarVisible(value) {
23085
+ if (typeof value !== "boolean") throw new TypeError("visible must be a boolean");
23086
+ visible = value;
23087
+ updateSidebar?.();
23088
+ }
23089
+ };
23090
+ if (typeof ctx.inject !== "function") return controller;
23091
+ ctx.inject(["layout"], (pageCtx) => pageCtx.slots.inject("main", () => {
21396
23092
  const unregisterPage = pageCtx.slots.register({
21397
23093
  name: "main",
21398
23094
  key: IM_MAIN_PANEL_ID,
21399
23095
  locale: IM_LOCALE_NAMESPACE,
21400
- inject: () => ({
21401
- renderPanel,
21402
- onBack: () => pageCtx.pluginNavigation.openBundle(packageName)
21403
- })
23096
+ inject: () => ({ renderPanel })
21404
23097
  }, ImPluginPage);
21405
- const stopSidebar = pageCtx.slots.inject("sidebar.panellist", () => pageCtx.slots.register({
21406
- name: "sidebar.panellist",
21407
- id: IM_MAIN_PANEL_ID,
21408
- order: 10,
21409
- label: () => pageCtx.locale.bind(IM_LOCALE_NAMESPACE)("IM\u673A\u5668\u4EBA"),
21410
- locale: IM_LOCALE_NAMESPACE
21411
- }, ImSidebarIcon));
23098
+ let stopSidebar = null;
23099
+ const update = () => {
23100
+ if (visible === (stopSidebar !== null)) return;
23101
+ if (!visible) {
23102
+ const stop = stopSidebar;
23103
+ stopSidebar = null;
23104
+ stop();
23105
+ return;
23106
+ }
23107
+ stopSidebar = pageCtx.slots.inject("sidebar.panellist", () => pageCtx.slots.register({
23108
+ name: "sidebar.panellist",
23109
+ id: IM_MAIN_PANEL_ID,
23110
+ order: 10,
23111
+ label: () => pageCtx.locale.bind(IM_LOCALE_NAMESPACE)("IM\u673A\u5668\u4EBA"),
23112
+ locale: IM_LOCALE_NAMESPACE
23113
+ }, ImSidebarIcon));
23114
+ };
23115
+ updateSidebar = update;
23116
+ update();
21412
23117
  const stopActions = pageCtx.slots.inject("plugins.detail.actions", () => pageCtx.slots.register({
21413
23118
  name: "plugins.detail.actions",
21414
23119
  id: "xmanrui-dsh-im-open",
@@ -21421,10 +23126,12 @@ function installImPluginPage(ctx, { packageName, renderPanel }) {
21421
23126
  }, OpenImAction));
21422
23127
  return () => {
21423
23128
  stopActions();
21424
- stopSidebar();
23129
+ updateSidebar = null;
23130
+ stopSidebar?.();
21425
23131
  unregisterPage();
21426
23132
  };
21427
23133
  }));
23134
+ return controller;
21428
23135
  }
21429
23136
 
21430
23137
  // plugin-src/client/index.js
@@ -21601,28 +23308,28 @@ function IMSettingsTab({
21601
23308
  browserLocation = globalThis.location,
21602
23309
  navigateToRecoveryUrl = replacePageLocation
21603
23310
  }) {
21604
- const [selected, setSelected] = React41.useState(() => preferredSectionId === GLOBAL_SETTINGS_TAB_ID || CHANNELS.some((channel7) => channel7.id === preferredSectionId) ? preferredSectionId : "weixin");
21605
- const [loopbackRecovery, setLoopbackRecovery] = React41.useState(null);
21606
- const [runningVersion, setRunningVersion] = React41.useState(IM_PLUGIN_VERSION);
21607
- const [deliverySettings, setDeliverySettings] = React41.useState(null);
23311
+ const [selected, setSelected] = React46.useState(() => preferredSectionId === GLOBAL_SETTINGS_TAB_ID || CHANNELS.some((channel7) => channel7.id === preferredSectionId) ? preferredSectionId : "weixin");
23312
+ const [loopbackRecovery, setLoopbackRecovery] = React46.useState(null);
23313
+ const [runningVersion, setRunningVersion] = React46.useState(IM_PLUGIN_VERSION);
23314
+ const [deliverySettings, setDeliverySettings] = React46.useState(null);
21608
23315
  const emailEnabled = useEmailChannelEnabled(emailRpcCall);
21609
- const visibleChannels = React41.useMemo(
23316
+ const visibleChannels = React46.useMemo(
21610
23317
  () => CHANNELS.filter((channel7) => channel7.id !== "email" || emailEnabled),
21611
23318
  [emailEnabled]
21612
23319
  );
21613
- const githubTooltipId = React41.useId();
21614
- const generalSettingsTooltipId = React41.useId();
23320
+ const githubTooltipId = React46.useId();
23321
+ const generalSettingsTooltipId = React46.useId();
21615
23322
  const globalSettingsSelected = selected === GLOBAL_SETTINGS_TAB_ID;
21616
23323
  const active = visibleChannels.find((channel7) => channel7.id === selected) ?? visibleChannels[0];
21617
23324
  const activeTabId = globalSettingsSelected ? "dim-general-settings-trigger" : `dim-tab-${active.id}`;
21618
23325
  const activePanelId = globalSettingsSelected ? `dim-panel-${GLOBAL_SETTINGS_TAB_ID}` : `dim-panel-${active.id}`;
21619
- const reportLoopbackRecovery = React41.useCallback((recovery) => {
23326
+ const reportLoopbackRecovery = React46.useCallback((recovery) => {
21620
23327
  setLoopbackRecovery((current) => current?.url === recovery.url ? current : recovery);
21621
23328
  }, []);
21622
- const reportUpdateStatus = React41.useCallback((snapshot) => {
23329
+ const reportUpdateStatus = React46.useCallback((snapshot) => {
21623
23330
  setRunningVersion(snapshot.runningVersion);
21624
23331
  }, []);
21625
- const rpcCalls = React41.useMemo(() => createLoopbackAwareRpcCalls({
23332
+ const rpcCalls = React46.useMemo(() => createLoopbackAwareRpcCalls({
21626
23333
  dingtalkRpcCall,
21627
23334
  discordRpcCall,
21628
23335
  feishuRpcCall,
@@ -21664,7 +23371,7 @@ function IMSettingsTab({
21664
23371
  weixinRpcCall,
21665
23372
  whatsappRpcCall
21666
23373
  ]);
21667
- const botSettingsContext = React41.useMemo(() => Object.freeze({
23374
+ const botSettingsContext = React46.useMemo(() => Object.freeze({
21668
23375
  openBotSettings: setDeliverySettings
21669
23376
  }), []);
21670
23377
  return h2(
@@ -21822,6 +23529,16 @@ function apply(ctx) {
21822
23529
  "im-settings: mirror the DSH interface language"
21823
23530
  );
21824
23531
  ctx.effect(() => installSessionChannelLogos(), "im-settings: Session channel logos");
23532
+ let dsBotAvatars;
23533
+ ctx.effect(() => {
23534
+ dsBotAvatars = installDsBotSessionAvatars(ctx, {
23535
+ rpcCall: (endpoint, payload, signal) => callManagementRpc(ctx.connection, DELIVERY_RPC_CHANNEL, endpoint, payload, signal)
23536
+ });
23537
+ return () => {
23538
+ dsBotAvatars.dispose();
23539
+ dsBotAvatars = null;
23540
+ };
23541
+ }, "im-settings: bound DS Bot session avatars");
21825
23542
  ctx.effect(() => {
21826
23543
  const disposers = [
21827
23544
  installFeishuStyles(),
@@ -21843,23 +23560,34 @@ function apply(ctx) {
21843
23560
  for (const dispose of disposers.reverse()) dispose();
21844
23561
  };
21845
23562
  }, "im-settings: install combined channel styles");
21846
- const feishuRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, FEISHU_RPC_CHANNEL, endpoint, payload, signal);
21847
- const weixinRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, WEIXIN_RPC_CHANNEL, endpoint, payload, signal);
21848
- const dingtalkRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, DINGTALK_RPC_CHANNEL, endpoint, payload, signal);
21849
- const qqRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, QQ_RPC_CHANNEL, endpoint, payload, signal);
21850
- const wecomRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, WECOM_RPC_CHANNEL, endpoint, payload, signal);
21851
- const wecomAppRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, WECOM_APP_RPC_CHANNEL, endpoint, payload, signal);
21852
- const telegramRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, TELEGRAM_RPC_CHANNEL, endpoint, payload, signal);
21853
- const discordRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, DISCORD_RPC_CHANNEL, endpoint, payload, signal);
21854
- const whatsappRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, WHATSAPP_RPC_CHANNEL, endpoint, payload, signal);
21855
- const imessageRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, IMESSAGE_RPC_CHANNEL, endpoint, payload, signal);
21856
- const emailRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, EMAIL_RPC_CHANNEL, endpoint, payload, signal);
21857
- const matrixRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, MATRIX_RPC_CHANNEL, endpoint, payload, signal);
21858
- const slackRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, SLACK_RPC_CHANNEL, endpoint, payload, signal);
21859
- const officeRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, OFFICE_RPC_CHANNEL, endpoint, payload, signal);
21860
- const updateRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, UPDATE_RPC_CHANNEL, endpoint, payload, signal);
21861
- const deliveryRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, DELIVERY_RPC_CHANNEL, endpoint, payload, signal);
21862
- const globalSettingsRpcCall = (endpoint, payload, signal) => callManagementRpc(ctx.connection, GLOBAL_SETTINGS_RPC_CHANNEL, endpoint, payload, signal);
23563
+ let sidebarSync;
23564
+ const managementRpc = async (connection, channel7, endpoint, payload, signal) => {
23565
+ const result2 = await callManagementRpc(connection, channel7, endpoint, payload, signal);
23566
+ if (result2?.ok === true) {
23567
+ const dsBotRead = channel7 === DELIVERY_RPC_CHANNEL && endpoint === "ds-bot.status";
23568
+ if (channel7 === DELIVERY_RPC_CHANNEL && ["ds-bot.bind", "ds-bot.unbind"].includes(endpoint)) dsBotAvatars?.refresh();
23569
+ if (endpoint === SIDEBAR_SETTINGS_ENDPOINTS.set) sidebarSync?.apply(result2);
23570
+ else if (!dsBotRead && endpoint !== SIDEBAR_SETTINGS_ENDPOINTS.get) sidebarSync?.refresh();
23571
+ }
23572
+ return result2;
23573
+ };
23574
+ const feishuRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, FEISHU_RPC_CHANNEL, endpoint, payload, signal);
23575
+ const weixinRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, WEIXIN_RPC_CHANNEL, endpoint, payload, signal);
23576
+ const dingtalkRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, DINGTALK_RPC_CHANNEL, endpoint, payload, signal);
23577
+ const qqRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, QQ_RPC_CHANNEL, endpoint, payload, signal);
23578
+ const wecomRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, WECOM_RPC_CHANNEL, endpoint, payload, signal);
23579
+ const wecomAppRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, WECOM_APP_RPC_CHANNEL, endpoint, payload, signal);
23580
+ const telegramRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, TELEGRAM_RPC_CHANNEL, endpoint, payload, signal);
23581
+ const discordRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, DISCORD_RPC_CHANNEL, endpoint, payload, signal);
23582
+ const whatsappRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, WHATSAPP_RPC_CHANNEL, endpoint, payload, signal);
23583
+ const imessageRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, IMESSAGE_RPC_CHANNEL, endpoint, payload, signal);
23584
+ const emailRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, EMAIL_RPC_CHANNEL, endpoint, payload, signal);
23585
+ const matrixRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, MATRIX_RPC_CHANNEL, endpoint, payload, signal);
23586
+ const slackRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, SLACK_RPC_CHANNEL, endpoint, payload, signal);
23587
+ const officeRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, OFFICE_RPC_CHANNEL, endpoint, payload, signal);
23588
+ const updateRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, UPDATE_RPC_CHANNEL, endpoint, payload, signal);
23589
+ const deliveryRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, DELIVERY_RPC_CHANNEL, endpoint, payload, signal);
23590
+ const globalSettingsRpcCall = (endpoint, payload, signal) => managementRpc(ctx.connection, Object.values(SIDEBAR_SETTINGS_ENDPOINTS).includes(endpoint) ? SIDEBAR_SETTINGS_RPC_CHANNEL : GLOBAL_SETTINGS_RPC_CHANNEL, endpoint, payload, signal);
21863
23591
  const workspaceDirectoryPicker = Object.freeze({
21864
23592
  listDirectory: (path, signal) => callWorkspaceDirectoryApi(ctx, "listDirectory", path, signal),
21865
23593
  pickDirectory: () => callWorkspaceDirectoryApi(ctx, "pickDirectory")
@@ -21888,7 +23616,7 @@ function apply(ctx) {
21888
23616
  };
21889
23617
  const localeSnapshot = () => ctx.locale.getLocale?.()?.active ?? "";
21890
23618
  function IMPanel({ preferredSectionId }) {
21891
- React41.useSyncExternalStore(subscribeLocale, localeSnapshot, localeSnapshot);
23619
+ React46.useSyncExternalStore(subscribeLocale, localeSnapshot, localeSnapshot);
21892
23620
  return h2(
21893
23621
  IMPanelErrorBoundary,
21894
23622
  null,
@@ -21898,10 +23626,20 @@ function apply(ctx) {
21898
23626
  const buildPanelElement = (props = {}) => h2(IMPanel, {
21899
23627
  preferredSectionId: props.preferredSectionId
21900
23628
  });
21901
- installImPluginPage(ctx, {
23629
+ const pluginPage = installImPluginPage(ctx, {
21902
23630
  packageName: package_default.name,
21903
23631
  renderPanel: buildPanelElement
21904
23632
  });
23633
+ ctx.effect(() => {
23634
+ sidebarSync = installSidebarVisibilitySync({
23635
+ rpcCall: (endpoint, payload, signal) => callManagementRpc(ctx.connection, SIDEBAR_SETTINGS_RPC_CHANNEL, endpoint, payload, signal),
23636
+ setVisible: (visible) => pluginPage.setSidebarVisible(visible)
23637
+ });
23638
+ return () => {
23639
+ sidebarSync.dispose();
23640
+ sidebarSync = null;
23641
+ };
23642
+ }, "im-settings: sidebar visibility");
21905
23643
  ctx.effect(() => {
21906
23644
  let disposed = false;
21907
23645
  let stopSettings = null;