dsh-xiaomi-tts 2.3.1 → 2.3.3

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 (40) hide show
  1. package/README.en.md +85 -7
  2. package/README.md +20 -11
  3. package/assets/menu.png +0 -0
  4. package/assets/preset.png +0 -0
  5. package/assets/social.png +0 -0
  6. package/assets/voice-avatars/baihua.webp +0 -0
  7. package/assets/voice-avatars/bingtang.webp +0 -0
  8. package/assets/voice-avatars/chloe.webp +0 -0
  9. package/assets/voice-avatars/dean.webp +0 -0
  10. package/assets/voice-avatars/mia.webp +0 -0
  11. package/assets/voice-avatars/milo.webp +0 -0
  12. package/assets/voice-avatars/moli.webp +0 -0
  13. package/assets/voice-avatars/suda.webp +0 -0
  14. package/assets/voice-presets/energetic-girl.webp +0 -0
  15. package/assets/voice-presets/liang-wenfeng.webp +0 -0
  16. package/cordis.patch.yml +4 -1
  17. package/lib/client/built-in-voice-picker.d.ts +10 -0
  18. package/lib/client/built-in-voice-picker.d.ts.map +1 -0
  19. package/lib/client/conversation.d.ts.map +1 -1
  20. package/lib/client/live-speech-controller.d.ts +6 -0
  21. package/lib/client/live-speech-controller.d.ts.map +1 -1
  22. package/lib/client/localization.d.ts +16 -8
  23. package/lib/client/localization.d.ts.map +1 -1
  24. package/lib/client/pcm-audio-queue.d.ts +7 -0
  25. package/lib/client/pcm-audio-queue.d.ts.map +1 -1
  26. package/lib/client/settings-card.d.ts.map +1 -1
  27. package/lib/client/settings-scope.d.ts.map +1 -1
  28. package/lib/client/styles.d.ts +1 -1
  29. package/lib/client/styles.d.ts.map +1 -1
  30. package/lib/client/voice-design-picker.d.ts.map +1 -1
  31. package/lib/client.js +640 -227
  32. package/lib/client.js.map +1 -1
  33. package/lib/index.d.ts +8 -2
  34. package/lib/index.d.ts.map +1 -1
  35. package/lib/index.js +273 -49
  36. package/lib/{shared-Ari92Zhu.js → shared-Cf9qZwUl.js} +147 -31
  37. package/lib/shared.d.ts +95 -25
  38. package/lib/shared.d.ts.map +1 -1
  39. package/lib/shared.js +2 -2
  40. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -39,18 +39,56 @@ const TTS_ROUTE = "/plugins/xiaomi-mimo-tts/synthesize";
39
39
  const TTS_STREAM_ROUTE = "/plugins/xiaomi-mimo-tts/synthesize-stream";
40
40
  /** Same-origin route that removes this plugin from the DSH Web profile. */
41
41
  const TTS_UNINSTALL_ROUTE = "/plugins/xiaomi-mimo-tts/uninstall";
42
+ /** Same-origin route that checks the published npm version. */
43
+ const TTS_UPDATE_ROUTE = "/plugins/xiaomi-mimo-tts/update";
44
+ /** Same-origin route that reports API key configuration status without exposing the key. */
45
+ const TTS_API_KEY_STATUS_ROUTE = "/plugins/xiaomi-mimo-tts/api-key-status";
42
46
  /** Same-origin prefix used by the Web client to load voice-design preset icons. */
43
47
  const TTS_VOICE_DESIGN_ASSET_ROUTE = "/plugins/xiaomi-mimo-tts/voice-presets";
44
- /** Supported built-in Xiaomi MiMo voices. */
45
- const TTS_VOICES = [
46
- "冰糖",
47
- "茉莉",
48
- "苏打",
49
- "白桦",
50
- "Mia",
51
- "Chloe",
52
- "Milo",
53
- "Dean"
48
+ /** Same-origin prefix used by the Web client to load official built-in voice avatars. */
49
+ const TTS_VOICE_ASSET_ROUTE = "/plugins/xiaomi-mimo-tts/voice-avatars";
50
+ /** Built-in voice metadata mirrored from Xiaomi MiMo's official selector. */
51
+ const TTS_VOICE_PRESETS = [
52
+ {
53
+ id: "bingtang",
54
+ value: "冰糖",
55
+ summary: "活泼少女"
56
+ },
57
+ {
58
+ id: "mia",
59
+ value: "Mia",
60
+ summary: "Lively girl"
61
+ },
62
+ {
63
+ id: "moli",
64
+ value: "茉莉",
65
+ summary: "知性女声"
66
+ },
67
+ {
68
+ id: "chloe",
69
+ value: "Chloe",
70
+ summary: "Witty Grace"
71
+ },
72
+ {
73
+ id: "suda",
74
+ value: "苏打",
75
+ summary: "阳光少年"
76
+ },
77
+ {
78
+ id: "milo",
79
+ value: "Milo",
80
+ summary: "Sunny boy"
81
+ },
82
+ {
83
+ id: "baihua",
84
+ value: "白桦",
85
+ summary: "成熟男声"
86
+ },
87
+ {
88
+ id: "dean",
89
+ value: "Dean",
90
+ summary: "Steady Gentle"
91
+ }
54
92
  ];
55
93
  /** TTS models supported by this plugin. */
56
94
  const TTS_MODELS = ["mimo-v2.5-tts", "mimo-v2.5-tts-voicedesign"];
@@ -58,61 +96,80 @@ const TTS_MODELS = ["mimo-v2.5-tts", "mimo-v2.5-tts-voicedesign"];
58
96
  const TTS_VOICE_DESIGN_PRESETS = [
59
97
  {
60
98
  id: "energetic-girl",
61
- label: "林小满",
62
- summary: "女 · 16岁 · 元气少女,明亮高饱和声线",
63
- prompt: "年轻女性15-20岁,普通话,明亮高饱和声线,笑意自然外放,咬字灵巧跳跃,语速偏快,语调上扬有活力,情绪积极爽朗,活力播报风格"
99
+ label: "鲸鱼娘",
100
+ summary: "爱吃白米饭",
101
+ prompt: "年轻女性16-22岁,标准普通话,清透甜美的中高音,音色明亮而不尖锐,带一点轻盈柔软的空气感;吐字清楚、节奏灵动,语速中等偏快,语调自然上扬,情绪开朗亲切又略带俏皮,整体听感温柔、有陪伴感。"
102
+ },
103
+ {
104
+ id: "liang-wenfeng",
105
+ label: "梁文峰",
106
+ summary: "理性克制",
107
+ prompt: "成年男性 35–40 岁,普通话,温和克制的中低音,声线清晰自然,声音偏亮不沉闷,略带书卷气和理工感,语速中等偏慢,停顿审慎,表达理性简洁,情绪稳定,不夸张。"
64
108
  },
65
109
  {
66
110
  id: "asmr-whisper",
67
111
  label: "沈听澜",
68
- summary: "女 · 19岁 · ASMR低语,轻柔耳语带微弱气息",
112
+ summary: "ASMR低语",
69
113
  prompt: "女性18-20岁,轻柔耳语带微弱气息,普通话,声线细腻清晰,私密温柔感,安静平和带轻柔低语,语速缓慢音量很轻,私密低语场景。"
70
114
  },
115
+ {
116
+ id: "young-man",
117
+ label: "江予辰",
118
+ summary: "阳光少年",
119
+ prompt: "男性青年16-22岁,清亮干净的中高音带少年感,普通话标准无口音,轻快明亮的活力声线,气息轻盈吐字利索,语速偏快语调自然上扬,情绪积极阳光带朝气,广告旁白或轻松解说场景。"
120
+ },
71
121
  {
72
122
  id: "gentle-girlfriend",
73
- label: "张子莯",
74
- summary: "女 · 22岁 · 温柔女友,声线柔软细腻",
123
+ label: "张子苜",
124
+ summary: "温柔陪伴",
75
125
  prompt: "年轻女性16-22岁,声线柔软细腻,低饱和带微微暖意,标准普通话,温柔亲密的邻家风格,语速偏慢,语调轻柔连贯,气息自然流畅,安静私密陪伴场景。"
76
126
  },
127
+ {
128
+ id: "tech-explainer",
129
+ label: "周砚川",
130
+ summary: "科技解说",
131
+ prompt: "成年男性25-35岁,清晰利落中音、干净偏冷,标准普通话,精准干练的都市精英感,语速中等偏快、语调平稳,理性简洁、逻辑感强,现代资讯播报或商业讲解场景。"
132
+ },
77
133
  {
78
134
  id: "girl-next-door",
79
135
  label: "陈念安",
80
- summary: "女 · 25岁 · 邻家女孩,柔润清甜带撒娇感",
136
+ summary: "邻家甜声",
81
137
  prompt: "年轻女性20-25岁,柔润清甜带撒娇感,普通话,清澈明亮的少女音,轻松温柔的亲近感,轻松平缓带温柔,中等偏快语速中等音量,生活分享场景。"
82
138
  },
139
+ {
140
+ id: "documentary-narrator",
141
+ label: "陆远山",
142
+ summary: "纪录片旁白",
143
+ prompt: "男性40-50岁,低沉醇厚有胸腔共鸣,普通话,稳重可靠的叙事者风格,语速中等偏慢,语调沉稳克制带叙事纵深感,气息舒展停顿有留白,纪录片旁白或深度访谈场景。"
144
+ },
83
145
  {
84
146
  id: "news-anchor",
85
147
  label: "顾知微",
86
- summary: "女 · 35岁 · 新闻播报,声线中低音区饱满清晰",
148
+ summary: "沉稳播报",
87
149
  prompt: "专业新闻播音女主持,成年女性30-40岁,普通话标准无口音,声线中低音区饱满清晰,端庄知性沉稳,语气克制权威,语速从容均匀,音量适中稳定,新闻播报与专题解说场景。"
88
150
  },
89
- {
90
- id: "young-man",
91
- label: "江予辰",
92
- summary: "男 · 19岁 · 青年男声,清亮干净的中高音带少年感",
93
- prompt: "男性青年16-22岁,清亮干净的中高音带少年感,普通话标准无口音,轻快明亮的活力声线,气息轻盈吐字利索,语速偏快语调自然上扬,情绪积极阳光带朝气,广告旁白或轻松解说场景。"
94
- },
95
- {
96
- id: "tech-explainer",
97
- label: "周砚川",
98
- summary: "男 · 30岁 · 科技解说,清晰利落中音、干净偏冷",
99
- prompt: "成年男性25-35岁,清晰利落中音、干净偏冷,标准普通话,精准干练的都市精英感,语速中等偏快、语调平稳,理性简洁、逻辑感强,现代资讯播报或商业讲解场景。"
100
- },
101
151
  {
102
152
  id: "suspense-narrator",
103
153
  label: "裴沉舟",
104
- summary: "男 · 35岁 · 悬疑旁白,低沉沉稳带神秘磁性",
154
+ summary: "悬疑旁白",
105
155
  prompt: "男性中年30-40岁,低沉沉稳带神秘磁性,普通话,压抑克制的叙事风格,语速缓慢均匀,语调低沉平稳,情绪冷静悬疑,旁白解说场景。"
106
- },
107
- {
108
- id: "documentary-narrator",
109
- label: "陆远山",
110
- summary: "男 · 45岁 · 纪录片,低沉醇厚有胸腔共鸣",
111
- prompt: "男性40-50岁,低沉醇厚有胸腔共鸣,普通话,稳重可靠的叙事者风格,语速中等偏慢,语调沉稳克制带叙事纵深感,气息舒展停顿有留白,纪录片旁白或深度访谈场景。"
112
156
  }
113
157
  ];
158
+ /** Supported audio formats. */
159
+ const TTS_FORMATS = [
160
+ "pcm",
161
+ "mp3",
162
+ "wav"
163
+ ];
114
164
  /** Minimum spoken characters to accumulate before starting one PCM stream request. */
115
165
  const MIN_TTS_STREAM_CHARACTERS = 20;
166
+ /** Maximum decoded complete MP3 payload accepted from Xiaomi MiMo. */
167
+ const DEFAULT_MAX_MP3_AUDIO_BYTES = 32 * 1024 * 1024;
168
+ /** Maximum decoded complete WAV payload accepted from Xiaomi MiMo. */
169
+ const DEFAULT_MAX_WAV_AUDIO_BYTES = 128 * 1024 * 1024;
170
+ const DEFAULT_MAX_PAUSED_PCM_BYTES = 32 * 1024 * 1024;
171
+ /** Extra JSON envelope allowance around a Base64 audio payload. */
172
+ const TTS_AUDIO_RESPONSE_JSON_OVERHEAD_BYTES = 1024 * 1024;
116
173
  const TTS_PUNCTUATION = {
117
174
  ",": ",",
118
175
  "。": ".",
@@ -262,12 +319,20 @@ const DEFAULT_TTS_SETTINGS = {
262
319
  voiceDesignPrompt: "青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。",
263
320
  voiceDesignCustomPrompt: "青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。",
264
321
  presetStylePrompt: "使用清晰、自然、准确的声音朗读,语速适中,停顿自然,语气平和克制,避免夸张表达。",
265
- format: "mp3",
322
+ format: "pcm",
266
323
  autoPlay: true,
267
324
  instruction: "请忠实朗读原文,根据文本语气自然表达,不添加或改写内容。",
268
325
  maxTextLength: 12e3,
269
- requestTimeoutMs: 12e4
326
+ requestTimeoutMs: 12e4,
327
+ maxMp3AudioBytes: DEFAULT_MAX_MP3_AUDIO_BYTES,
328
+ maxWavAudioBytes: DEFAULT_MAX_WAV_AUDIO_BYTES,
329
+ maxPausedPcmBytes: DEFAULT_MAX_PAUSED_PCM_BYTES
270
330
  };
331
+ /** Whether an API key selects one of the Xiaomi endpoints supported by this plugin. */
332
+ function isSupportedTtsApiKey(apiKey) {
333
+ const normalized = apiKey.trim();
334
+ return normalized.startsWith("sk-") || normalized.startsWith("tp-");
335
+ }
271
336
  /** Resolve an optional settings snapshot into the values used by the form. */
272
337
  function resolveTtsSettings(value) {
273
338
  const resolved = {
@@ -288,12 +353,27 @@ var PcmAudioQueue = class {
288
353
  context = null;
289
354
  scheduledAt = 0;
290
355
  sources = /* @__PURE__ */ new Set();
356
+ sourceBytes = /* @__PURE__ */ new Map();
291
357
  revision = 0;
292
358
  chain = Promise.resolve();
293
359
  busy = false;
360
+ userPaused = false;
361
+ queuedBytes = 0;
362
+ maxPausedPcmBytes = 32 * 1024 * 1024;
294
363
  constructor(callbacks) {
295
364
  this.callbacks = callbacks;
296
365
  }
366
+ setMaxPausedPcmBytes(value) {
367
+ this.maxPausedPcmBytes = Number.isFinite(value) && value > 0 ? value : 32 * 1024 * 1024;
368
+ }
369
+ async pause() {
370
+ this.userPaused = true;
371
+ if (this.context !== null && this.context.state === "running") await this.context.suspend();
372
+ }
373
+ async resume() {
374
+ if (this.context !== null && this.context.state !== "running") await this.context.resume();
375
+ this.userPaused = false;
376
+ }
297
377
  enqueue(base64) {
298
378
  const revision = this.revision;
299
379
  const run = this.chain.then(() => this.schedule(base64, revision));
@@ -304,10 +384,13 @@ var PcmAudioQueue = class {
304
384
  this.revision += 1;
305
385
  this.scheduledAt = 0;
306
386
  this.chain = Promise.resolve();
387
+ this.userPaused = false;
388
+ this.queuedBytes = 0;
307
389
  for (const source of this.sources) try {
308
390
  source.stop();
309
391
  } catch {}
310
392
  this.sources.clear();
393
+ this.sourceBytes.clear();
311
394
  this.setBusy(false);
312
395
  }
313
396
  async dispose() {
@@ -321,7 +404,7 @@ var PcmAudioQueue = class {
321
404
  const bytes = Uint8Array.from(atob(base64), (character) => character.charCodeAt(0));
322
405
  if (bytes.byteLength < 2) return;
323
406
  const context = this.getContext();
324
- if (context.state !== "running") await context.resume();
407
+ if (context.state !== "running" && !this.userPaused) await context.resume();
325
408
  if (revision !== this.revision) return;
326
409
  const sampleCount = Math.floor(bytes.byteLength / 2);
327
410
  const buffer = context.createBuffer(1, sampleCount, 24e3);
@@ -333,16 +416,23 @@ var PcmAudioQueue = class {
333
416
  source.connect(context.destination);
334
417
  const startAt = Math.max(context.currentTime + .03, this.scheduledAt);
335
418
  this.scheduledAt = startAt + buffer.duration;
419
+ if (this.userPaused && this.queuedBytes + bytes.byteLength > this.maxPausedPcmBytes) throw new Error("pcm-pause-buffer-limit");
336
420
  this.sources.add(source);
421
+ this.sourceBytes.set(source, bytes.byteLength);
422
+ this.queuedBytes += bytes.byteLength;
337
423
  source.addEventListener("ended", () => {
338
424
  if (revision !== this.revision) return;
339
425
  this.sources.delete(source);
426
+ this.queuedBytes -= this.sourceBytes.get(source) ?? 0;
427
+ this.sourceBytes.delete(source);
340
428
  if (this.sources.size === 0) this.setBusy(false);
341
429
  }, { once: true });
342
430
  try {
343
431
  source.start(startAt);
344
432
  } catch (error) {
345
433
  this.sources.delete(source);
434
+ this.queuedBytes -= this.sourceBytes.get(source) ?? 0;
435
+ this.sourceBytes.delete(source);
346
436
  throw error;
347
437
  }
348
438
  this.setBusy(true);
@@ -363,12 +453,11 @@ var PcmAudioQueue = class {
363
453
  //#region src/client/live-speech-controller.ts
364
454
  function pcmDeltaFromSse(data) {
365
455
  if (data === "[DONE]") return null;
366
- try {
367
- const pcm = JSON.parse(data).choices?.[0]?.delta?.audio?.data;
368
- return typeof pcm === "string" && pcm.length > 0 ? pcm : null;
369
- } catch {
370
- return null;
371
- }
456
+ const value = JSON.parse(data);
457
+ const upstreamError = typeof value.error === "string" ? value.error : value.error?.message;
458
+ if (upstreamError !== void 0) throw new Error(upstreamError);
459
+ const pcm = value.choices?.[0]?.delta?.audio?.data;
460
+ return typeof pcm === "string" && pcm.length > 0 ? pcm : null;
372
461
  }
373
462
  var LiveSpeechController = class {
374
463
  audio = new PcmAudioQueue({
@@ -391,10 +480,33 @@ var LiveSpeechController = class {
391
480
  requestBusy = false;
392
481
  audioBusy = false;
393
482
  blockedTurn = null;
483
+ completed = null;
394
484
  onStateChange = null;
395
485
  setStateChangeListener(listener) {
396
486
  this.onStateChange = listener;
397
487
  }
488
+ setMaxPausedPcmBytes(value) {
489
+ this.audio.setMaxPausedPcmBytes(value);
490
+ }
491
+ async pause(sessionId) {
492
+ if (this.sessionId !== sessionId || this.status !== "playing") return false;
493
+ await this.audio.pause();
494
+ this.setStatus("paused");
495
+ return true;
496
+ }
497
+ async resume(sessionId) {
498
+ if (this.sessionId !== sessionId || this.status !== "paused") return false;
499
+ try {
500
+ await this.audio.resume();
501
+ this.setStatus("playing");
502
+ return true;
503
+ } catch {
504
+ this.setStatus("error");
505
+ this.replaceQueue();
506
+ this.audio.stop();
507
+ return false;
508
+ }
509
+ }
398
510
  activateSession(sessionId) {
399
511
  if (this.sessionId === sessionId) return;
400
512
  this.cancel();
@@ -421,6 +533,20 @@ var LiveSpeechController = class {
421
533
  this.observed = text;
422
534
  this.drain(false);
423
535
  }
536
+ /** Stream one already-completed preset-model reply as PCM, falling back only before playback starts. */
537
+ playCompleted(sessionId, messageId, text, fallback) {
538
+ if (this.sessionId !== sessionId || text.length === 0) return;
539
+ this.resetState();
540
+ this.completed = {
541
+ sessionId,
542
+ messageId,
543
+ audioStarted: false,
544
+ fallback
545
+ };
546
+ this.messageId = messageId;
547
+ this.setStatus("loading");
548
+ this.queue.enqueue(text);
549
+ }
424
550
  finish(sessionId, final) {
425
551
  const key = `${sessionId}:${final.turn}:${final.step}`;
426
552
  if (this.blockedTurn === `${sessionId}:${final.turn}`) {
@@ -439,8 +565,8 @@ var LiveSpeechController = class {
439
565
  this.handled.add(key);
440
566
  }
441
567
  stop(sessionId) {
442
- if (this.sessionId !== sessionId || this.active === null || this.status !== "loading" && this.status !== "playing") return false;
443
- this.blockedTurn = `${sessionId}:${this.active.turn}`;
568
+ if (this.sessionId !== sessionId || this.status !== "loading" && this.status !== "playing") return false;
569
+ if (this.active !== null) this.blockedTurn = `${sessionId}:${this.active.turn}`;
444
570
  this.resetState();
445
571
  return true;
446
572
  }
@@ -471,6 +597,7 @@ var LiveSpeechController = class {
471
597
  this.beginSegment(next, true);
472
598
  }
473
599
  beginSegment(next, preserveMessageId) {
600
+ this.completed = null;
474
601
  this.active = next;
475
602
  this.observed = "";
476
603
  this.consumed = 0;
@@ -484,8 +611,9 @@ var LiveSpeechController = class {
484
611
  this.observed = "";
485
612
  this.consumed = 0;
486
613
  this.pendingText = "";
487
- this.messageId = null;
488
614
  this.setStatus("idle");
615
+ this.messageId = null;
616
+ this.completed = null;
489
617
  }
490
618
  cursorKey(cursor) {
491
619
  return `${cursor.sessionId}:${cursor.turn}:${cursor.step}`;
@@ -542,6 +670,18 @@ var LiveSpeechController = class {
542
670
  const reader = response.body.getReader();
543
671
  const decoder = new TextDecoder();
544
672
  let pending = "";
673
+ let receivedPcm = false;
674
+ const consume = async (events) => {
675
+ for (const event of events) {
676
+ if (!this.isCurrentStream(generation, signal)) return;
677
+ const pcm = pcmDeltaFromSse(event);
678
+ if (pcm !== null) {
679
+ await this.audio.enqueue(pcm);
680
+ receivedPcm = true;
681
+ if (!this.isCurrentStream(generation, signal)) return;
682
+ }
683
+ }
684
+ };
545
685
  try {
546
686
  while (this.isCurrentStream(generation, signal)) {
547
687
  const result = await reader.read();
@@ -549,23 +689,26 @@ var LiveSpeechController = class {
549
689
  pending += decoder.decode(result.value, { stream: true });
550
690
  const parsed = parseSseRecords(pending);
551
691
  pending = parsed.remainder;
552
- for (const event of parsed.events) {
553
- if (!this.isCurrentStream(generation, signal)) return;
554
- const pcm = pcmDeltaFromSse(event);
555
- if (pcm !== null) {
556
- await this.audio.enqueue(pcm);
557
- if (!this.isCurrentStream(generation, signal)) return;
558
- }
559
- }
692
+ await consume(parsed.events);
560
693
  }
694
+ pending += decoder.decode();
695
+ if (pending.trim().length > 0) await consume(parseSseRecords(`${pending}\n\n`).events);
561
696
  } finally {
562
697
  reader.releaseLock();
563
698
  }
699
+ if (!receivedPcm && this.isCurrentStream(generation, signal)) throw new Error("stream-audio-empty");
564
700
  } catch (error) {
565
701
  if (this.isCurrentStream(generation, signal)) throw error;
566
702
  }
567
703
  }
568
704
  handleStreamError(error) {
705
+ const completed = this.completed;
706
+ if (completed !== null && !completed.audioStarted) {
707
+ const fallback = completed.fallback;
708
+ this.resetState();
709
+ fallback();
710
+ return;
711
+ }
569
712
  if (this.active !== null) this.blockedTurn = `${this.active.sessionId}:${this.active.turn}`;
570
713
  this.setStatus("error");
571
714
  this.replaceQueue();
@@ -577,6 +720,7 @@ var LiveSpeechController = class {
577
720
  setStatus(status) {
578
721
  if (this.status === status) return;
579
722
  this.status = status;
723
+ if (status === "playing" && this.completed !== null) this.completed.audioStarted = true;
580
724
  this.reportStatus();
581
725
  }
582
726
  reportStatus() {
@@ -860,10 +1004,11 @@ function decodeSettings(value) {
860
1004
  if (typeof value.voice === "string") decoded.voice = value.voice;
861
1005
  if (typeof value.voiceDesignPrompt === "string") decoded.voiceDesignPrompt = value.voiceDesignPrompt;
862
1006
  if (typeof value.voiceDesignCustomPrompt === "string") decoded.voiceDesignCustomPrompt = value.voiceDesignCustomPrompt;
863
- if (value.format === "mp3" || value.format === "wav") decoded.format = value.format;
1007
+ if (TTS_FORMATS.includes(value.format)) decoded.format = value.format;
864
1008
  if (typeof value.autoPlay === "boolean") decoded.autoPlay = value.autoPlay;
865
1009
  if (typeof value.maxTextLength === "number") decoded.maxTextLength = value.maxTextLength;
866
1010
  if (typeof value.requestTimeoutMs === "number") decoded.requestTimeoutMs = value.requestTimeoutMs;
1011
+ if (typeof value.maxPausedPcmBytes === "number") decoded.maxPausedPcmBytes = value.maxPausedPcmBytes;
867
1012
  return decoded;
868
1013
  }
869
1014
  function useSettingsSnapshot(scope) {
@@ -918,6 +1063,7 @@ function messageLiveIdentity(snapshot, messageId) {
918
1063
  /** Own the active-session boundary and feed its partial assistant output into realtime speech. */
919
1064
  function SessionPlaybackObserver({ sessionId, session, playback, live, settings }) {
920
1065
  const resolvedSettings = resolveTtsSettings(useSettingsSnapshot(settings).value);
1066
+ live.setMaxPausedPcmBytes(resolvedSettings.maxPausedPcmBytes);
921
1067
  const active = (0, react.useRef)(null);
922
1068
  const wasRunning = (0, react.useRef)(session.running);
923
1069
  const runArmed = (0, react.useRef)(!session.running);
@@ -951,7 +1097,7 @@ function SessionPlaybackObserver({ sessionId, session, playback, live, settings
951
1097
  active.current = null;
952
1098
  }
953
1099
  playback.observeSession(sessionId, session.running && runArmed.current, latestMessageId);
954
- if (!resolvedSettings.enabled || !resolvedSettings.autoPlay || resolvedSettings.model !== "mimo-v2.5-tts") {
1100
+ if (!resolvedSettings.enabled || !resolvedSettings.autoPlay || resolvedSettings.model !== "mimo-v2.5-tts" || resolvedSettings.format !== "pcm") {
955
1101
  live.cancelSession(sessionId);
956
1102
  active.current = null;
957
1103
  if (session.running) runArmed.current = false;
@@ -984,6 +1130,7 @@ function SessionPlaybackObserver({ sessionId, session, playback, live, settings
984
1130
  playback,
985
1131
  resolvedSettings.autoPlay,
986
1132
  resolvedSettings.enabled,
1133
+ resolvedSettings.format,
987
1134
  resolvedSettings.model,
988
1135
  session,
989
1136
  sessionId,
@@ -1001,11 +1148,23 @@ function ReadAloudAction({ sessionId, messageId, useSession, playback, live, set
1001
1148
  }));
1002
1149
  const text = message.text;
1003
1150
  const settingsSnapshot = useSettingsSnapshot(settings);
1151
+ const resolvedSettings = resolveTtsSettings(settingsSnapshot.value);
1004
1152
  const view = (0, react.useSyncExternalStore)(playback.subscribe, playback.getSnapshot, playback.getSnapshot);
1153
+ const playCompletedReply = (automatic) => {
1154
+ if (resolvedSettings.model === "mimo-v2.5-tts" && resolvedSettings.format === "pcm") {
1155
+ playback.cancelPlayback(sessionId);
1156
+ live.playCompleted(sessionId, messageId, text, () => {
1157
+ playback.toggle(sessionId, messageId, text, automatic);
1158
+ });
1159
+ return;
1160
+ }
1161
+ live.cancelSession(sessionId);
1162
+ playback.toggle(sessionId, messageId, text, automatic);
1163
+ };
1005
1164
  (0, react.useEffect)(() => {
1006
1165
  if (text.length === 0 || settingsSnapshot.value?.enabled !== true || settingsSnapshot.value?.autoPlay !== true || live.hasHandled(sessionId, message.identity) || message.running || message.latestMessageId !== messageId || message.time === null || message.time < playback.autoPlayArmedAt) return;
1007
1166
  const cancel = window.setTimeout(() => {
1008
- if (!live.hasHandled(sessionId, message.identity) && playback.claimAutomaticPlayback(sessionId, messageId)) playback.toggle(sessionId, messageId, text, true);
1167
+ if (!live.hasHandled(sessionId, message.identity) && playback.claimAutomaticPlayback(sessionId, messageId)) playCompletedReply(true);
1009
1168
  }, 0);
1010
1169
  return () => window.clearTimeout(cancel);
1011
1170
  }, [
@@ -1016,6 +1175,8 @@ function ReadAloudAction({ sessionId, messageId, useSession, playback, live, set
1016
1175
  message.time,
1017
1176
  messageId,
1018
1177
  playback,
1178
+ resolvedSettings.format,
1179
+ resolvedSettings.model,
1019
1180
  sessionId,
1020
1181
  settingsSnapshot.value?.autoPlay,
1021
1182
  settingsSnapshot.value?.enabled,
@@ -1039,13 +1200,19 @@ function ReadAloudAction({ sessionId, messageId, useSession, playback, live, set
1039
1200
  "aria-pressed": status === "playing" || liveActive,
1040
1201
  disabled: status === "loading" && !liveActive,
1041
1202
  onClick: () => {
1042
- if (mine && source === "live" && (status === "loading" || status === "playing")) {
1043
- live.stop(sessionId);
1044
- playback.cancelPlayback(sessionId);
1203
+ if (mine && source === "live") {
1204
+ if (status === "loading") {
1205
+ live.stop(sessionId);
1206
+ playback.cancelPlayback(sessionId);
1207
+ } else if (status === "playing") live.pause(sessionId);
1208
+ else if (status === "paused") live.resume(sessionId);
1209
+ return;
1210
+ }
1211
+ if (mine && source === "complete") {
1212
+ playback.toggle(sessionId, messageId, text, false);
1045
1213
  return;
1046
1214
  }
1047
- live.cancelSession(sessionId);
1048
- playback.toggle(sessionId, messageId, text, false);
1215
+ playCompletedReply(false);
1049
1216
  },
1050
1217
  children: status === "loading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__deepseek_ai_dsh_client_ui_primitives.IconLoadingOutline16, { className: "xmimo-tts-spin" }) : status === "playing" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__deepseek_ai_dsh_client_ui_primitives.IconPauseOutline16, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__deepseek_ai_dsh_client_ui_primitives.IconPlayOutline16, {})
1051
1218
  })
@@ -1071,27 +1238,34 @@ const zh = {
1071
1238
  "error.request": "语音生成失败。",
1072
1239
  "error.play": "浏览器阻止了自动播放,请点击朗读按钮。",
1073
1240
  "settings.title": "语音朗读 (Xiaomi MiMo)",
1074
- "settings.description": "在助手回复操作栏中使用 Xiaomi MiMo TTS 生成并播放语音。",
1241
+ "settings.description": "在对话中使用 Xiaomi MiMo TTS 生成并播放语音。",
1075
1242
  "settings.enabled": "显示朗读按钮",
1076
- "settings.enabledHint": "关闭后不会在助手回复操作栏显示朗读按钮,也不会自动播报。",
1243
+ "settings.enabledHint": "关闭后不会显示朗读按钮,也不会自动播报。",
1077
1244
  "settings.apiKey": "API Key",
1078
- "settings.apiKeyHint": "密钥保存在 DSH 设置文件中,传到浏览器前会被脱敏。",
1079
1245
  "settings.apiKeyStatus": "只有输入新值并保存时才会替换现有密钥。",
1080
1246
  "settings.apiKeyConfigured": "已配置",
1247
+ "settings.apiKeyMissing": "尚未配置 API Key,请先获取并设置密钥。",
1248
+ "settings.apiKeyUnsupported": "这个 API Key 似乎是错的,请检查并重新设置(sk-/tp- 开头)。",
1081
1249
  "settings.getApiKey": "获取 API Key",
1082
1250
  "settings.autoPlay": "开启自动播报",
1083
1251
  "settings.autoPlayHint": "开启时会同步显示朗读按钮;浏览器也可能拒绝自动播放。",
1084
1252
  "settings.model": "TTS 模型",
1085
1253
  "settings.presetModel": "预置音色模型 (mimo-v2.5-tts)",
1086
1254
  "settings.voiceDesignModel": "自定义音色模型 (mimo-v2.5-tts-voicedesign)",
1087
- "settings.modelAutoPlayHintPreset": "预置音色模型支持实时流式播放。",
1255
+ "settings.modelAutoPlayHintPreset": "预置音色的播放方式由音频格式决定。",
1088
1256
  "settings.modelAutoPlayHintVoiceDesign": "自定义音色仅支持在回复完成后自动播放。",
1089
1257
  "settings.voice": "内置音色",
1258
+ "settings.format": "音频格式",
1259
+ "settings.formatPcm": "PCM(流式播放)",
1260
+ "settings.formatMp3": "MP3(完整音频)",
1261
+ "settings.formatWav": "WAV(完整音频)",
1262
+ "settings.formatPcmHint": "边生成边播放,支持暂停和继续;首个音频分片前失败时自动回退 MP3。",
1263
+ "settings.formatMp3Hint": "完整生成后播放,文件更小;支持暂停和继续。",
1264
+ "settings.formatWavHint": "完整生成后播放,保留无损音频但文件更大;支持暂停和继续。",
1090
1265
  "settings.voiceDesignPrompt": "自定义音色描述",
1091
1266
  "settings.customVoiceOption": "自定义",
1092
1267
  "settings.customVoiceSummary": "手动编写音色描述",
1093
1268
  "settings.voiceDesignPromptHint": "按“年龄段 + 性别、声音质感、语速节奏、情绪底色”描述声音本身;不写场景或动作。",
1094
- "settings.format": "音频格式",
1095
1269
  "settings.save": "保存",
1096
1270
  "settings.saving": "保存中…",
1097
1271
  "settings.saved": "已保存",
@@ -1100,14 +1274,15 @@ const zh = {
1100
1274
  "settings.reset": "恢复默认",
1101
1275
  "settings.discard": "放弃修改",
1102
1276
  "settings.failed": "保存失败,请重试。",
1103
- "settings.star": "点亮Star⭐",
1104
- "settings.uninstall": "卸载此插件",
1277
+ "settings.source": "✨查看源码",
1278
+ "settings.uninstall": "卸载",
1105
1279
  "settings.uninstalling": "卸载中…",
1106
1280
  "settings.uninstallQuestion": "确认卸载?",
1107
1281
  "settings.uninstallConfirm": "确认",
1108
1282
  "settings.uninstallCancel": "取消",
1109
- "settings.uninstalled": "已卸载,重启 DSH Web 后生效。",
1283
+ "settings.uninstalled": "已卸载;重启DSH不再加载此插件。",
1110
1284
  "settings.uninstallFailed": "卸载失败,请重试或使用 DSH 命令行卸载。",
1285
+ "settings.updateAvailable": "🎉新版已发布",
1111
1286
  "settings.readOnly": "当前 DSH 设置为只读。",
1112
1287
  "settings.secretPlaceholder": "输入新的 Xiaomi MiMo API Key",
1113
1288
  "settings.expand": "展开设置",
@@ -1129,23 +1304,30 @@ const en = {
1129
1304
  "settings.enabled": "Show read-aloud button",
1130
1305
  "settings.enabledHint": "When disabled, the read-aloud button and automatic speech are both turned off.",
1131
1306
  "settings.apiKey": "API Key",
1132
- "settings.apiKeyHint": "Stored in DSH settings and redacted before settings are sent to the browser.",
1133
1307
  "settings.apiKeyStatus": "An existing key changes only when you save a new value.",
1134
1308
  "settings.apiKeyConfigured": "Configured",
1309
+ "settings.apiKeyMissing": "No API key is configured. Get and set an API key first.",
1310
+ "settings.apiKeyUnsupported": "This API key seems invalid. Check it and set it again (starting with sk- or tp-).",
1135
1311
  "settings.getApiKey": "Get API Key",
1136
1312
  "settings.autoPlay": "Enable automatic read-aloud",
1137
1313
  "settings.autoPlayHint": "Enabling it also shows the read-aloud button; the browser may reject autoplay.",
1138
1314
  "settings.model": "TTS model",
1139
1315
  "settings.presetModel": "Preset voices (mimo-v2.5-tts)",
1140
1316
  "settings.voiceDesignModel": "Custom voice design (mimo-v2.5-tts-voicedesign)",
1141
- "settings.modelAutoPlayHintPreset": "Preset voices support realtime streaming playback.",
1317
+ "settings.modelAutoPlayHintPreset": "The selected audio format controls preset-voice playback.",
1142
1318
  "settings.modelAutoPlayHintVoiceDesign": "Custom voice design supports automatic playback only after the reply is complete.",
1143
1319
  "settings.voice": "Built-in voice",
1320
+ "settings.format": "Audio format",
1321
+ "settings.formatPcm": "PCM (streaming)",
1322
+ "settings.formatMp3": "MP3 (complete audio)",
1323
+ "settings.formatWav": "WAV (complete audio)",
1324
+ "settings.formatPcmHint": "Plays chunks as they arrive for a shorter wait; supports pause and resume. Falls back to MP3 if streaming fails before the first audio chunk.",
1325
+ "settings.formatMp3Hint": "Plays after the complete file is generated. Smaller file size; supports pause and resume.",
1326
+ "settings.formatWavHint": "Plays after the complete lossless file is generated. Larger file size; supports pause and resume.",
1144
1327
  "settings.voiceDesignPrompt": "Custom voice description",
1145
1328
  "settings.customVoiceOption": "Custom",
1146
1329
  "settings.customVoiceSummary": "Write a custom voice description",
1147
1330
  "settings.voiceDesignPromptHint": "Describe the voice itself with age/gender, texture, pace, and emotional baseline; avoid scenes or actions.",
1148
- "settings.format": "Audio format",
1149
1331
  "settings.save": "Save",
1150
1332
  "settings.saving": "Saving…",
1151
1333
  "settings.saved": "Saved",
@@ -1154,20 +1336,164 @@ const en = {
1154
1336
  "settings.reset": "Restore default",
1155
1337
  "settings.discard": "Discard changes",
1156
1338
  "settings.failed": "Save failed. Try again.",
1157
- "settings.star": "Feedback or Star us ⭐",
1158
- "settings.uninstall": "Uninstall this plugin",
1339
+ "settings.source": "✨ View source",
1340
+ "settings.uninstall": "Uninstall",
1159
1341
  "settings.uninstalling": "Uninstalling…",
1160
1342
  "settings.uninstallQuestion": "Confirm uninstall?",
1161
1343
  "settings.uninstallConfirm": "Confirm",
1162
1344
  "settings.uninstallCancel": "Cancel",
1163
- "settings.uninstalled": "Uninstalled. Restart DSH Web to apply the change.",
1345
+ "settings.uninstalled": "Uninstalled. DSH remains active and will not load the plugin on its next start.",
1164
1346
  "settings.uninstallFailed": "Uninstall failed. Try again or remove the plugin with the DSH CLI.",
1347
+ "settings.updateAvailable": "🎉 New release",
1165
1348
  "settings.readOnly": "DSH settings are read-only.",
1166
1349
  "settings.secretPlaceholder": "Enter a new Xiaomi MiMo API key",
1167
1350
  "settings.expand": "Expand settings",
1168
1351
  "settings.collapse": "Collapse settings"
1169
1352
  };
1170
1353
 
1354
+ //#endregion
1355
+ //#region src/client/built-in-voice-picker.tsx
1356
+ function VoiceAvatar({ preset }) {
1357
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
1358
+ className: "xmimo-tts-builtin-voice-avatar",
1359
+ src: `${TTS_VOICE_ASSET_ROUTE}/${preset.id}.webp`,
1360
+ alt: "",
1361
+ width: 36,
1362
+ height: 36,
1363
+ loading: "lazy",
1364
+ "aria-hidden": "true"
1365
+ });
1366
+ }
1367
+ function SelectedCheck() {
1368
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
1369
+ className: "xmimo-tts-builtin-voice-check",
1370
+ viewBox: "0 0 16 16",
1371
+ "aria-hidden": "true",
1372
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
1373
+ cx: "8",
1374
+ cy: "8",
1375
+ r: "7"
1376
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m4.8 8.1 2 2 4.4-4.5" })]
1377
+ });
1378
+ }
1379
+ function BuiltInVoicePicker({ value, disabled, label, onChange }) {
1380
+ const [open, setOpen] = (0, react.useState)(false);
1381
+ const rootRef = (0, react.useRef)(null);
1382
+ const triggerRef = (0, react.useRef)(null);
1383
+ const optionRefs = (0, react.useRef)([]);
1384
+ const listboxId = (0, react.useId)();
1385
+ const selectedIndex = TTS_VOICE_PRESETS.findIndex((preset) => preset.value === value);
1386
+ const selected = TTS_VOICE_PRESETS[selectedIndex < 0 ? 0 : selectedIndex];
1387
+ (0, react.useEffect)(() => {
1388
+ if (!open) return;
1389
+ const closeOnOutsidePointer = (event) => {
1390
+ if (event.target instanceof Node && !rootRef.current?.contains(event.target)) setOpen(false);
1391
+ };
1392
+ document.addEventListener("pointerdown", closeOnOutsidePointer);
1393
+ return () => document.removeEventListener("pointerdown", closeOnOutsidePointer);
1394
+ }, [open]);
1395
+ (0, react.useEffect)(() => {
1396
+ if (disabled) setOpen(false);
1397
+ }, [disabled]);
1398
+ const focusOption = (index) => {
1399
+ const normalized = (index + TTS_VOICE_PRESETS.length) % TTS_VOICE_PRESETS.length;
1400
+ requestAnimationFrame(() => optionRefs.current[normalized]?.focus());
1401
+ };
1402
+ const choose = (next) => {
1403
+ onChange(next);
1404
+ setOpen(false);
1405
+ requestAnimationFrame(() => triggerRef.current?.focus());
1406
+ };
1407
+ const handleTriggerKeyDown = (event) => {
1408
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
1409
+ event.preventDefault();
1410
+ setOpen(true);
1411
+ focusOption(selectedIndex < 0 ? 0 : selectedIndex);
1412
+ } else if (event.key === "Home") {
1413
+ event.preventDefault();
1414
+ setOpen(true);
1415
+ focusOption(0);
1416
+ } else if (event.key === "End") {
1417
+ event.preventDefault();
1418
+ setOpen(true);
1419
+ focusOption(TTS_VOICE_PRESETS.length - 1);
1420
+ }
1421
+ };
1422
+ const handleOptionKeyDown = (event, index) => {
1423
+ if (event.key === "ArrowRight" || event.key === "ArrowDown") {
1424
+ event.preventDefault();
1425
+ focusOption(index + 1);
1426
+ } else if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
1427
+ event.preventDefault();
1428
+ focusOption(index - 1);
1429
+ } else if (event.key === "Home") {
1430
+ event.preventDefault();
1431
+ focusOption(0);
1432
+ } else if (event.key === "End") {
1433
+ event.preventDefault();
1434
+ focusOption(TTS_VOICE_PRESETS.length - 1);
1435
+ } else if (event.key === "Escape") {
1436
+ event.preventDefault();
1437
+ setOpen(false);
1438
+ triggerRef.current?.focus();
1439
+ } else if (event.key === "Tab") setOpen(false);
1440
+ };
1441
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1442
+ className: "xmimo-tts-builtin-voice-picker",
1443
+ ref: rootRef,
1444
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1445
+ ref: triggerRef,
1446
+ type: "button",
1447
+ className: "xmimo-tts-builtin-voice-trigger",
1448
+ disabled,
1449
+ "aria-label": label,
1450
+ "aria-haspopup": "listbox",
1451
+ "aria-expanded": open,
1452
+ "aria-controls": open ? listboxId : void 0,
1453
+ onClick: () => {
1454
+ setOpen((current) => !current);
1455
+ },
1456
+ onKeyDown: handleTriggerKeyDown,
1457
+ children: [
1458
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceAvatar, { preset: selected }),
1459
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1460
+ className: "xmimo-tts-builtin-voice-copy",
1461
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: selected.value }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: selected.summary })]
1462
+ }),
1463
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, { className: open ? "xmimo-tts-voice-picker-chevron xmimo-tts-voice-picker-chevron-open" : "xmimo-tts-voice-picker-chevron" })
1464
+ ]
1465
+ }), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1466
+ id: listboxId,
1467
+ className: "xmimo-tts-builtin-voice-menu",
1468
+ role: "listbox",
1469
+ "aria-label": label,
1470
+ children: TTS_VOICE_PRESETS.map((preset, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1471
+ ref: (node) => {
1472
+ optionRefs.current[index] = node;
1473
+ },
1474
+ type: "button",
1475
+ role: "option",
1476
+ "aria-selected": preset.value === value,
1477
+ className: preset.value === value ? "xmimo-tts-builtin-voice-option xmimo-tts-builtin-voice-option-selected" : "xmimo-tts-builtin-voice-option",
1478
+ onClick: () => {
1479
+ choose(preset.value);
1480
+ },
1481
+ onKeyDown: (event) => {
1482
+ handleOptionKeyDown(event, index);
1483
+ },
1484
+ children: [
1485
+ preset.value === value ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectedCheck, {}) : null,
1486
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceAvatar, { preset }),
1487
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1488
+ className: "xmimo-tts-builtin-voice-copy",
1489
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: preset.value }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: preset.summary })]
1490
+ })
1491
+ ]
1492
+ }, preset.id))
1493
+ }) : null]
1494
+ });
1495
+ }
1496
+
1171
1497
  //#endregion
1172
1498
  //#region src/client/voice-design-picker.tsx
1173
1499
  const CUSTOM_VOICE_DESIGN_OPTION = "__custom__";
@@ -1176,7 +1502,7 @@ function isPresetVoiceDesignPrompt(value) {
1176
1502
  }
1177
1503
  function VoicePresetAvatar({ preset }) {
1178
1504
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
1179
- className: "xmimo-tts-voice-avatar",
1505
+ className: "xmimo-tts-builtin-voice-avatar",
1180
1506
  src: `${TTS_VOICE_DESIGN_ASSET_ROUTE}/${preset.id}.webp`,
1181
1507
  alt: "",
1182
1508
  width: 40,
@@ -1187,7 +1513,7 @@ function VoicePresetAvatar({ preset }) {
1187
1513
  }
1188
1514
  function CustomVoiceAvatar() {
1189
1515
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1190
- className: "xmimo-tts-voice-avatar xmimo-tts-custom-voice-avatar",
1516
+ className: "xmimo-tts-builtin-voice-avatar xmimo-tts-custom-voice-avatar",
1191
1517
  "aria-hidden": "true",
1192
1518
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
1193
1519
  viewBox: "0 0 40 40",
@@ -1204,6 +1530,18 @@ function CustomVoiceAvatar() {
1204
1530
  })
1205
1531
  });
1206
1532
  }
1533
+ function VoicePresetCheck() {
1534
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
1535
+ className: "xmimo-tts-builtin-voice-check",
1536
+ viewBox: "0 0 14 14",
1537
+ "aria-hidden": "true",
1538
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
1539
+ cx: "7",
1540
+ cy: "7",
1541
+ r: "7"
1542
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m3.5 7 2.1 2.1 4.9-4.7" })]
1543
+ });
1544
+ }
1207
1545
  function VoiceDesignPresetPicker({ value, disabled, label, customLabel, customSummary, onChange }) {
1208
1546
  const [open, setOpen] = (0, react.useState)(false);
1209
1547
  const rootRef = (0, react.useRef)(null);
@@ -1273,7 +1611,7 @@ function VoiceDesignPresetPicker({ value, disabled, label, customLabel, customSu
1273
1611
  } else if (event.key === "Tab") setOpen(false);
1274
1612
  };
1275
1613
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1276
- className: "xmimo-tts-voice-picker",
1614
+ className: "xmimo-tts-voice-picker xmimo-tts-builtin-voice-picker",
1277
1615
  ref: rootRef,
1278
1616
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1279
1617
  ref: triggerRef,
@@ -1298,7 +1636,7 @@ function VoiceDesignPresetPicker({ value, disabled, label, customLabel, customSu
1298
1636
  ]
1299
1637
  }), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1300
1638
  id: listboxId,
1301
- className: "xmimo-tts-voice-picker-menu",
1639
+ className: "xmimo-tts-voice-picker-menu xmimo-tts-builtin-voice-menu",
1302
1640
  role: "listbox",
1303
1641
  "aria-label": label,
1304
1642
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
@@ -1308,17 +1646,21 @@ function VoiceDesignPresetPicker({ value, disabled, label, customLabel, customSu
1308
1646
  type: "button",
1309
1647
  role: "option",
1310
1648
  "aria-selected": selectedPreset === void 0,
1311
- className: selectedPreset === void 0 ? "xmimo-tts-voice-option xmimo-tts-voice-option-selected" : "xmimo-tts-voice-option",
1649
+ className: selectedPreset === void 0 ? "xmimo-tts-builtin-voice-option xmimo-tts-builtin-voice-option-selected xmimo-tts-builtin-voice-option-custom" : "xmimo-tts-builtin-voice-option xmimo-tts-builtin-voice-option-custom",
1312
1650
  onClick: () => {
1313
1651
  choose(CUSTOM_VOICE_DESIGN_OPTION);
1314
1652
  },
1315
1653
  onKeyDown: (event) => {
1316
1654
  handleOptionKeyDown(event, 0);
1317
1655
  },
1318
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomVoiceAvatar, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1319
- className: "xmimo-tts-voice-option-copy",
1320
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: customLabel }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: customSummary })]
1321
- })]
1656
+ children: [
1657
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomVoiceAvatar, {}),
1658
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1659
+ className: "xmimo-tts-voice-option-copy",
1660
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: customLabel }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: customSummary })]
1661
+ }),
1662
+ selectedPreset === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoicePresetCheck, {}) : null
1663
+ ]
1322
1664
  }), TTS_VOICE_DESIGN_PRESETS.map((preset, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1323
1665
  ref: (node) => {
1324
1666
  optionRefs.current[index + 1] = node;
@@ -1326,17 +1668,21 @@ function VoiceDesignPresetPicker({ value, disabled, label, customLabel, customSu
1326
1668
  type: "button",
1327
1669
  role: "option",
1328
1670
  "aria-selected": selectedPreset?.id === preset.id,
1329
- className: selectedPreset?.id === preset.id ? "xmimo-tts-voice-option xmimo-tts-voice-option-selected" : "xmimo-tts-voice-option",
1671
+ className: selectedPreset?.id === preset.id ? "xmimo-tts-builtin-voice-option xmimo-tts-builtin-voice-option-selected" : "xmimo-tts-builtin-voice-option",
1330
1672
  onClick: () => {
1331
1673
  choose(preset.prompt);
1332
1674
  },
1333
1675
  onKeyDown: (event) => {
1334
1676
  handleOptionKeyDown(event, index + 1);
1335
1677
  },
1336
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoicePresetAvatar, { preset }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1337
- className: "xmimo-tts-voice-option-copy",
1338
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: preset.label }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: preset.summary })]
1339
- })]
1678
+ children: [
1679
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoicePresetAvatar, { preset }),
1680
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1681
+ className: "xmimo-tts-voice-option-copy",
1682
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: preset.label }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: preset.summary })]
1683
+ }),
1684
+ selectedPreset?.id === preset.id ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoicePresetCheck, {}) : null
1685
+ ]
1340
1686
  }, preset.id))]
1341
1687
  }) : null]
1342
1688
  });
@@ -1353,6 +1699,11 @@ const EDITABLE_SETTING_FIELDS = [
1353
1699
  "voiceDesignCustomPrompt",
1354
1700
  "format"
1355
1701
  ];
1702
+ const RELEASES_URL = "https://github.com/ppy-web/dsh-plugin-xiaomi-mimo-tts/releases";
1703
+ function hostRoute(path) {
1704
+ const relative = path.replace(/^\/+/, "");
1705
+ return typeof document === "undefined" ? `/${relative}` : new URL(relative, document.baseURI).pathname;
1706
+ }
1356
1707
  function layerSettings(value) {
1357
1708
  return isRecord(value) ? value : void 0;
1358
1709
  }
@@ -1393,13 +1744,15 @@ function SettingsCard({ scope, t }) {
1393
1744
  const [autoPlay, setAutoPlay] = (0, react.useState)(initial.autoPlay);
1394
1745
  const [model, setModel] = (0, react.useState)(initial.model);
1395
1746
  const [voice, setVoice] = (0, react.useState)(initial.voice);
1747
+ const [format, setFormat] = (0, react.useState)(initial.format);
1396
1748
  const [voiceDesignPrompt, setVoiceDesignPrompt] = (0, react.useState)(initial.voiceDesignPrompt);
1397
1749
  const [voiceDesignCustomPrompt, setVoiceDesignCustomPrompt] = (0, react.useState)(initial.voiceDesignCustomPrompt);
1398
- const [format, setFormat] = (0, react.useState)(initial.format);
1399
1750
  const [changes, setChanges] = (0, react.useState)({});
1400
1751
  const [state, setState] = (0, react.useState)("idle");
1401
1752
  const [uninstallState, setUninstallState] = (0, react.useState)("idle");
1402
1753
  const [open, setOpen] = (0, react.useState)(false);
1754
+ const [apiKeyStatus, setApiKeyStatus] = (0, react.useState)("loading");
1755
+ const [latestVersion, setLatestVersion] = (0, react.useState)(null);
1403
1756
  const accepted = resolveTtsSettings(value);
1404
1757
  const base = resolveTtsSettings(layerSettings(snapshot.base));
1405
1758
  const draft = {
@@ -1430,6 +1783,45 @@ function SettingsCard({ scope, t }) {
1430
1783
  };
1431
1784
  const apiKeyDirty = changes.apiKey?.kind === "clear" ? hasOverride("apiKey") : changes.apiKey?.kind === "set" && apiKey.trim().length > 0;
1432
1785
  const dirty = EDITABLE_SETTING_FIELDS.some(fieldDirty) || apiKeyDirty === true;
1786
+ const enteredApiKey = apiKey.trim();
1787
+ const apiKeyWarning = enteredApiKey.length > 0 ? !isSupportedTtsApiKey(enteredApiKey) : apiKeyStatus === "missing" || apiKeyStatus === "unsupported";
1788
+ const apiKeyMessage = enteredApiKey.length > 0 ? isSupportedTtsApiKey(enteredApiKey) ? t("settings.apiKeyStatus") : t("settings.apiKeyUnsupported") : apiKeyStatus === "missing" ? t("settings.apiKeyMissing") : apiKeyStatus === "unsupported" ? t("settings.apiKeyUnsupported") : t("settings.apiKeyStatus");
1789
+ (0, react.useEffect)(() => {
1790
+ if (snapshot.status === "unavailable") return;
1791
+ let active = true;
1792
+ setApiKeyStatus("loading");
1793
+ fetch(TTS_API_KEY_STATUS_ROUTE, { headers: { accept: "application/json" } }).then(async (response) => {
1794
+ if (!response.ok) throw new Error("api-key-status-failed");
1795
+ return await response.json();
1796
+ }).then((status) => {
1797
+ if (!active) return;
1798
+ setApiKeyStatus(status.configured !== true ? "missing" : status.supported === true ? "supported" : "unsupported");
1799
+ }).catch(() => {
1800
+ if (active) setApiKeyStatus("missing");
1801
+ });
1802
+ return () => {
1803
+ active = false;
1804
+ };
1805
+ }, [snapshot.status, value]);
1806
+ (0, react.useEffect)(() => {
1807
+ if (!open) return;
1808
+ let active = true;
1809
+ fetch(hostRoute(TTS_UPDATE_ROUTE), {
1810
+ cache: "no-store",
1811
+ headers: { accept: "application/json" }
1812
+ }).then(async (response) => {
1813
+ if (!response.ok) throw new Error("version-check-failed");
1814
+ return await response.json();
1815
+ }).then((result) => {
1816
+ if (!active) return;
1817
+ setLatestVersion(result.updateAvailable === true && typeof result.latestVersion === "string" ? result.latestVersion : null);
1818
+ }).catch(() => {
1819
+ if (active) setLatestVersion(null);
1820
+ });
1821
+ return () => {
1822
+ active = false;
1823
+ };
1824
+ }, [open]);
1433
1825
  (0, react.useEffect)(() => {
1434
1826
  if (dirty) return;
1435
1827
  const next = resolveTtsSettings(value);
@@ -1437,9 +1829,9 @@ function SettingsCard({ scope, t }) {
1437
1829
  setAutoPlay(next.autoPlay);
1438
1830
  setModel(next.model);
1439
1831
  setVoice(next.voice);
1832
+ setFormat(next.format);
1440
1833
  setVoiceDesignPrompt(next.voiceDesignPrompt);
1441
1834
  setVoiceDesignCustomPrompt(next.voiceDesignCustomPrompt);
1442
- setFormat(next.format);
1443
1835
  setChanges({});
1444
1836
  }, [dirty, value]);
1445
1837
  if (snapshot.status === "unavailable") return null;
@@ -1456,9 +1848,9 @@ function SettingsCard({ scope, t }) {
1456
1848
  if (field === "autoPlay") setAutoPlay(base.autoPlay);
1457
1849
  if (field === "model") setModel(base.model);
1458
1850
  if (field === "voice") setVoice(base.voice);
1851
+ if (field === "format") setFormat(base.format);
1459
1852
  if (field === "voiceDesignPrompt") setVoiceDesignPrompt(base.voiceDesignPrompt);
1460
1853
  if (field === "voiceDesignCustomPrompt") setVoiceDesignCustomPrompt(base.voiceDesignCustomPrompt);
1461
- if (field === "format") setFormat(base.format);
1462
1854
  };
1463
1855
  const discard = () => {
1464
1856
  const next = resolveTtsSettings(scope.getSnapshot().value);
@@ -1466,9 +1858,9 @@ function SettingsCard({ scope, t }) {
1466
1858
  setAutoPlay(next.autoPlay);
1467
1859
  setModel(next.model);
1468
1860
  setVoice(next.voice);
1861
+ setFormat(next.format);
1469
1862
  setVoiceDesignPrompt(next.voiceDesignPrompt);
1470
1863
  setVoiceDesignCustomPrompt(next.voiceDesignCustomPrompt);
1471
- setFormat(next.format);
1472
1864
  setApiKey("");
1473
1865
  setChanges({});
1474
1866
  setState("idle");
@@ -1497,7 +1889,7 @@ function SettingsCard({ scope, t }) {
1497
1889
  const uninstall = async () => {
1498
1890
  setUninstallState("uninstalling");
1499
1891
  try {
1500
- const response = await fetch(TTS_UNINSTALL_ROUTE, {
1892
+ const response = await fetch(hostRoute(TTS_UNINSTALL_ROUTE), {
1501
1893
  method: "POST",
1502
1894
  headers: { "content-type": "application/json" },
1503
1895
  body: "{}"
@@ -1577,96 +1969,13 @@ function SettingsCard({ scope, t }) {
1577
1969
  markChange("apiKey");
1578
1970
  }
1579
1971
  }),
1580
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1581
- className: "xmimo-tts-api-key-hints",
1582
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: t("settings.apiKeyStatus") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: t("settings.apiKeyHint") })]
1972
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
1973
+ className: apiKeyWarning ? "xmimo-tts-api-key-warning" : void 0,
1974
+ role: apiKeyWarning ? "alert" : void 0,
1975
+ children: apiKeyMessage
1583
1976
  })
1584
1977
  ]
1585
1978
  }),
1586
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1587
- className: "xmimo-tts-switch-row xmimo-tts-wide",
1588
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1589
- className: "xmimo-tts-checkbox-row",
1590
- children: [
1591
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1592
- className: "xmimo-tts-switch-copy",
1593
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
1594
- label: t("settings.enabled"),
1595
- overriddenLabel: t("settings.overridden"),
1596
- resetLabel: t("settings.reset"),
1597
- overridden: false,
1598
- resettable: false,
1599
- disabled: !snapshot.writable,
1600
- onReset: () => {
1601
- resetField("enabled");
1602
- }
1603
- })
1604
- }),
1605
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1606
- type: "checkbox",
1607
- checked: enabled,
1608
- disabled: !snapshot.writable,
1609
- onChange: (event) => {
1610
- const next = event.target.checked;
1611
- setEnabled(next);
1612
- if (!next) {
1613
- setAutoPlay(false);
1614
- setChanges((current) => ({
1615
- ...current,
1616
- enabled: { kind: "set" },
1617
- autoPlay: { kind: "set" }
1618
- }));
1619
- } else markChange("enabled");
1620
- setState("idle");
1621
- }
1622
- }),
1623
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1624
- className: "xmimo-tts-switch-control",
1625
- "aria-hidden": "true"
1626
- })
1627
- ]
1628
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1629
- className: "xmimo-tts-checkbox-row",
1630
- children: [
1631
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1632
- className: "xmimo-tts-switch-copy",
1633
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
1634
- label: t("settings.autoPlay"),
1635
- overriddenLabel: t("settings.overridden"),
1636
- resetLabel: t("settings.reset"),
1637
- overridden: false,
1638
- resettable: false,
1639
- disabled: !snapshot.writable,
1640
- onReset: () => {
1641
- resetField("autoPlay");
1642
- }
1643
- })
1644
- }),
1645
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1646
- type: "checkbox",
1647
- checked: enabled && autoPlay,
1648
- disabled: !snapshot.writable,
1649
- onChange: (event) => {
1650
- const next = event.target.checked;
1651
- setAutoPlay(next);
1652
- if (next) {
1653
- setEnabled(true);
1654
- setChanges((current) => ({
1655
- ...current,
1656
- autoPlay: { kind: "set" },
1657
- enabled: { kind: "set" }
1658
- }));
1659
- } else markChange("autoPlay");
1660
- setState("idle");
1661
- }
1662
- }),
1663
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1664
- className: "xmimo-tts-switch-control",
1665
- "aria-hidden": "true"
1666
- })
1667
- ]
1668
- })]
1669
- }),
1670
1979
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1671
1980
  className: "xmimo-tts-model xmimo-tts-wide",
1672
1981
  children: [
@@ -1744,59 +2053,158 @@ function SettingsCard({ scope, t }) {
1744
2053
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: t("settings.voiceDesignPromptHint") })
1745
2054
  ]
1746
2055
  }) : null,
1747
- model === "mimo-v2.5-tts" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1748
- className: "xmimo-tts-select-column xmimo-tts-wide",
1749
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
2056
+ model === "mimo-v2.5-tts" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2057
+ className: "xmimo-tts-voice xmimo-tts-wide",
2058
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
1750
2059
  label: t("settings.voice"),
1751
2060
  overriddenLabel: t("settings.overridden"),
1752
2061
  resetLabel: t("settings.reset"),
1753
- overridden: false,
1754
- resettable: false,
2062
+ overridden: fieldOverridden("voice"),
2063
+ resettable: true,
1755
2064
  disabled: !snapshot.writable,
1756
2065
  onReset: () => {
1757
2066
  resetField("voice");
1758
2067
  }
1759
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
2068
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BuiltInVoicePicker, {
1760
2069
  value: voice,
1761
2070
  disabled: !snapshot.writable,
1762
- onChange: (event) => {
1763
- setVoice(event.target.value);
2071
+ label: t("settings.voice"),
2072
+ onChange: (next) => {
2073
+ setVoice(next);
1764
2074
  markChange("voice");
1765
- },
1766
- children: TTS_VOICES.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1767
- value: item,
1768
- children: item
1769
- }, item))
1770
- })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
1771
- label: t("settings.format"),
1772
- overriddenLabel: t("settings.overridden"),
1773
- resetLabel: t("settings.reset"),
1774
- overridden: false,
1775
- resettable: false,
1776
- disabled: !snapshot.writable,
1777
- onReset: () => {
1778
- resetField("format");
1779
2075
  }
1780
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
1781
- value: format,
1782
- disabled: !snapshot.writable,
1783
- onChange: (event) => {
1784
- setFormat(event.target.value);
1785
- markChange("format");
1786
- },
1787
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1788
- value: "mp3",
1789
- children: "MP3"
1790
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1791
- value: "wav",
1792
- children: "WAV"
1793
- })]
1794
- })] })]
1795
- }) : null
2076
+ })]
2077
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2078
+ className: "xmimo-tts-format xmimo-tts-wide",
2079
+ children: [
2080
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
2081
+ label: t("settings.format"),
2082
+ overriddenLabel: t("settings.overridden"),
2083
+ resetLabel: t("settings.reset"),
2084
+ overridden: fieldOverridden("format"),
2085
+ resettable: true,
2086
+ disabled: !snapshot.writable,
2087
+ onReset: () => {
2088
+ resetField("format");
2089
+ }
2090
+ }),
2091
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2092
+ className: "xmimo-tts-format-options",
2093
+ role: "radiogroup",
2094
+ "aria-label": t("settings.format"),
2095
+ children: TTS_FORMATS.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
2096
+ className: format === item ? "xmimo-tts-format-option xmimo-tts-format-option-selected" : "xmimo-tts-format-option",
2097
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2098
+ type: "radio",
2099
+ name: "xmimo-tts-format",
2100
+ value: item,
2101
+ checked: format === item,
2102
+ disabled: !snapshot.writable,
2103
+ onChange: () => {
2104
+ setFormat(item);
2105
+ markChange("format");
2106
+ }
2107
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: item.toUpperCase() })]
2108
+ }, item))
2109
+ }),
2110
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: t(format === "pcm" ? "settings.formatPcmHint" : format === "mp3" ? "settings.formatMp3Hint" : "settings.formatWavHint") })
2111
+ ]
2112
+ })] }) : null,
2113
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2114
+ className: "xmimo-tts-switch-row xmimo-tts-wide",
2115
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
2116
+ className: "xmimo-tts-checkbox-row",
2117
+ children: [
2118
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2119
+ className: "xmimo-tts-switch-copy",
2120
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
2121
+ label: t("settings.enabled"),
2122
+ overriddenLabel: t("settings.overridden"),
2123
+ resetLabel: t("settings.reset"),
2124
+ overridden: false,
2125
+ resettable: false,
2126
+ disabled: !snapshot.writable,
2127
+ onReset: () => {
2128
+ resetField("enabled");
2129
+ }
2130
+ })
2131
+ }),
2132
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2133
+ type: "checkbox",
2134
+ checked: enabled,
2135
+ disabled: !snapshot.writable,
2136
+ onChange: (event) => {
2137
+ const next = event.target.checked;
2138
+ setEnabled(next);
2139
+ if (!next) {
2140
+ setAutoPlay(false);
2141
+ setChanges((current) => ({
2142
+ ...current,
2143
+ enabled: { kind: "set" },
2144
+ autoPlay: { kind: "set" }
2145
+ }));
2146
+ } else markChange("enabled");
2147
+ setState("idle");
2148
+ }
2149
+ }),
2150
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2151
+ className: "xmimo-tts-switch-control",
2152
+ "aria-hidden": "true"
2153
+ })
2154
+ ]
2155
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
2156
+ className: "xmimo-tts-checkbox-row",
2157
+ children: [
2158
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2159
+ className: "xmimo-tts-switch-copy",
2160
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
2161
+ label: t("settings.autoPlay"),
2162
+ overriddenLabel: t("settings.overridden"),
2163
+ resetLabel: t("settings.reset"),
2164
+ overridden: false,
2165
+ resettable: false,
2166
+ disabled: !snapshot.writable,
2167
+ onReset: () => {
2168
+ resetField("autoPlay");
2169
+ }
2170
+ })
2171
+ }),
2172
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2173
+ type: "checkbox",
2174
+ checked: enabled && autoPlay,
2175
+ disabled: !snapshot.writable,
2176
+ onChange: (event) => {
2177
+ const next = event.target.checked;
2178
+ setAutoPlay(next);
2179
+ if (next) {
2180
+ setEnabled(true);
2181
+ setChanges((current) => ({
2182
+ ...current,
2183
+ autoPlay: { kind: "set" },
2184
+ enabled: { kind: "set" }
2185
+ }));
2186
+ } else markChange("autoPlay");
2187
+ setState("idle");
2188
+ }
2189
+ }),
2190
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2191
+ className: "xmimo-tts-switch-control",
2192
+ "aria-hidden": "true"
2193
+ })
2194
+ ]
2195
+ })]
2196
+ })
1796
2197
  ]
1797
2198
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1798
2199
  className: "xmimo-tts-card-actions",
1799
2200
  children: [
2201
+ uninstallState === "idle" && latestVersion !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
2202
+ className: "xmimo-tts-update",
2203
+ href: RELEASES_URL,
2204
+ target: "_blank",
2205
+ rel: "noopener noreferrer",
2206
+ children: t("settings.updateAvailable")
2207
+ }) : null,
1800
2208
  uninstallState === "confirming" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1801
2209
  className: "xmimo-tts-uninstall-confirmation",
1802
2210
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("settings.uninstallQuestion") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
@@ -1829,7 +2237,7 @@ function SettingsCard({ scope, t }) {
1829
2237
  href: "https://github.com/ppy-web/dsh-plugin-xiaomi-mimo-tts",
1830
2238
  target: "_blank",
1831
2239
  rel: "noopener noreferrer",
1832
- children: t("settings.star")
2240
+ children: t("settings.source")
1833
2241
  }),
1834
2242
  !snapshot.writable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("settings.readOnly") }) : null,
1835
2243
  uninstallState === "uninstalled" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -1876,11 +2284,16 @@ function SettingsCard({ scope, t }) {
1876
2284
  const CLIENT_STYLES = `
1877
2285
  .xmimo-tts-action{width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:transparent;border:none;border-radius:28px;justify-content:center;align-items:center;padding:6px;display:inline-flex}.xmimo-tts-action:hover{background:var(--dsw-alias-interactive-bg-hover,#f3f4f6);color:var(--dsw-alias-label-secondary,#5f6875)}.xmimo-tts-action[aria-pressed=true]{background:var(--dsw-alias-interactive-bg-hover,#f3f4f6);color:var(--dsw-alias-label-secondary,#5f6875)}.xmimo-tts-action:disabled{cursor:default;opacity:.45}.xmimo-tts-spin{animation:xmimo-spin 1s linear infinite}@keyframes xmimo-spin{to{transform:rotate(360deg)}}
1878
2286
  .xmimo-tts-inline-error{max-width:220px;color:var(--dsw-alias-state-error-primary,#dc2626);font-size:12px}
2287
+ .xmimo-tts-api-key-warning{color:var(--dsw-alias-state-error-primary,#dc2626)!important}
1879
2288
  .xmimo-tts-card{list-style:none;border:1px solid var(--dsw-alias-border-l2,#e5e7eb);border-radius:12px;color:var(--dsw-alias-label-primary,#1f2328);background:var(--dsw-alias-bg-layer-3,#fff);overflow:hidden;transition:border-color 160ms ease,background 160ms ease}.xmimo-tts-card:hover{border-color:var(--dsw-alias-label-dimmed,#c8ccd4)}.xmimo-tts-card-open{background:var(--dsw-alias-bg-layer-2,#f7f8fa);border-color:var(--dsw-alias-label-dimmed,#c8ccd4)}.xmimo-tts-card-header{appearance:none;display:flex;width:100%;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;border:0;border-radius:12px;color:inherit;text-align:left;background:transparent;font:inherit;cursor:pointer}.xmimo-tts-card-header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:-2px}.xmimo-tts-card-head-text{display:flex;min-width:0;flex:1;flex-direction:column;gap:4px}.xmimo-tts-card-title{font-size:15px;font-weight:600}.xmimo-tts-card-description{color:var(--dsw-alias-label-tertiary,#8b93a1);font-size:13px;line-height:18px}.xmimo-tts-chevron{flex:none;color:var(--dsw-alias-label-tertiary,#8b93a1);transition:transform 160ms ease}.xmimo-tts-chevron-open{transform:rotate(180deg)}.xmimo-tts-pending{flex:none;border-radius:999px;padding:1px 8px;color:var(--dsw-alias-label-secondary,#5f6875);background:var(--dsw-alias-bg-module-platform,#eef0f3);font-size:11px;font-weight:500;line-height:17px}.xmimo-tts-card-body{border-top:1px solid var(--dsw-alias-border-l2,#e5e7eb);margin:0 16px;padding:0 0 16px}
1880
- .xmimo-tts-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:0;align-items:start}.xmimo-tts-grid>*{box-sizing:border-box;padding:16px 0;border-top:1px solid var(--dsw-alias-border-l2,#e5e7eb)}.xmimo-tts-grid>:first-child{border-top:0}.xmimo-tts-grid label,.xmimo-tts-api-key,.xmimo-tts-model,.xmimo-tts-voice-design-prompt,.xmimo-tts-select-column>div{display:flex;min-width:0;flex-direction:column;gap:6px;font-size:13px}.xmimo-tts-grid input,.xmimo-tts-grid select,.xmimo-tts-grid textarea{box-sizing:border-box;width:100%;border:1px solid var(--dsw-alias-border-l2,#e5e7eb);border-radius:8px;padding:8px 10px;color:var(--dsw-alias-label-primary,#1f2328);background:var(--dsw-alias-bg-layer-2,#f3f4f6);font:inherit}.xmimo-tts-grid select{color-scheme:light dark}.xmimo-tts-grid select option{color:var(--dsw-alias-label-primary,#1f2328);background:var(--dsw-alias-bg-layer-1,#fff)}.xmimo-tts-grid select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}.xmimo-tts-grid small{color:var(--dsw-alias-label-tertiary,#8b93a1);line-height:17px}.xmimo-tts-field-heading{display:flex;min-width:0;min-height:20px;flex-direction:row!important;align-items:center;justify-content:space-between;gap:8px}.xmimo-tts-field-label{display:inline-flex;min-width:0;align-items:center;gap:8px}.xmimo-tts-api-key-link{color:var(--dsw-alias-brand-primary,#4f6ef7);font-size:12px;text-decoration:none}.xmimo-tts-api-key-link:hover{text-decoration:underline}.xmimo-tts-field-badges{display:flex!important;flex:none;flex-direction:row!important;align-items:center;gap:8px}.xmimo-tts-overridden{border-radius:999px;padding:1px 7px;color:var(--dsw-alias-label-secondary,#5f6875);background:var(--dsw-alias-bg-module-platform,#eef0f3);font-size:11px;line-height:17px}.xmimo-tts-reset{padding:0;border:0;color:var(--dsw-alias-label-secondary,#5f6875);background:transparent;font:inherit;font-size:12px;cursor:pointer}.xmimo-tts-reset:hover:not(:disabled){color:var(--dsw-alias-label-primary,#1f2328)}.xmimo-tts-reset:disabled{cursor:not-allowed;opacity:.45}.xmimo-tts-api-key-hints{display:flex;min-width:0;gap:8px;align-items:center}.xmimo-tts-api-key-hints small{min-width:0;white-space:nowrap}.xmimo-tts-wide{grid-column:1/-1}.xmimo-tts-switch-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:0}.xmimo-tts-switch-row>*:first-child{padding-right:14px}.xmimo-tts-switch-row>*+*{padding-left:14px;border-left:1px solid var(--dsw-alias-border-l2,#e5e7eb)}.xmimo-tts-checkbox-row{position:relative;flex-direction:row!important;align-items:center!important;gap:10px!important;cursor:pointer}.xmimo-tts-switch-copy{display:flex;min-width:0;flex-direction:column;gap:4px}.xmimo-tts-checkbox-row>input{position:absolute;width:1px!important;height:1px;margin:0!important;padding:0!important;overflow:hidden;border:0!important;opacity:0;clip-path:inset(50%)}.xmimo-tts-switch-control{box-sizing:border-box;position:relative;display:inline-block!important;width:36px;height:20px;min-width:36px;flex:none;border:1px solid var(--dsw-alias-border-l2,#c8ccd4);border-radius:999px;background:var(--dsw-alias-bg-module-platform,#e5e7eb);transition:border-color 160ms ease,background 160ms ease}.xmimo-tts-switch-control:after{content:"";position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:var(--dsw-alias-bg-layer-1,#fff);box-shadow:0 1px 3px rgba(15,23,42,.24);transition:transform 160ms ease}.xmimo-tts-checkbox-row>input:checked+.xmimo-tts-switch-control{border-color:var(--dsw-alias-brand-primary,#4f6ef7);background:var(--dsw-alias-brand-primary,#4f6ef7)}.xmimo-tts-checkbox-row>input:checked+.xmimo-tts-switch-control:after{transform:translateX(16px)}.xmimo-tts-checkbox-row>input:focus-visible+.xmimo-tts-switch-control{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}.xmimo-tts-checkbox-row>input:disabled+.xmimo-tts-switch-control{cursor:not-allowed;opacity:.45}.xmimo-tts-select-column{display:flex;min-width:0;flex-direction:row;gap:0}.xmimo-tts-select-column>div{flex:1}.xmimo-tts-select-column>div:first-child:not(:only-child){padding-right:16px}.xmimo-tts-select-column>div+div{padding-left:16px;border-left:1px solid var(--dsw-alias-border-l2,#e5e7eb)}
2289
+ .xmimo-tts-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:0;align-items:start}.xmimo-tts-grid>*{box-sizing:border-box;padding:16px 0;border-top:1px solid var(--dsw-alias-border-l2,#e5e7eb)}.xmimo-tts-grid>:first-child{border-top:0}.xmimo-tts-grid label,.xmimo-tts-api-key,.xmimo-tts-model,.xmimo-tts-format,.xmimo-tts-voice-design-prompt,.xmimo-tts-voice{display:flex;min-width:0;flex-direction:column;gap:6px;font-size:13px}.xmimo-tts-grid input,.xmimo-tts-grid select,.xmimo-tts-grid textarea{box-sizing:border-box;width:100%;border:1px solid var(--dsw-alias-border-l2,#e5e7eb);border-radius:8px;padding:8px 10px;color:var(--dsw-alias-label-primary,#1f2328);background:var(--dsw-alias-bg-layer-2,#f3f4f6);font:inherit}.xmimo-tts-grid select{color-scheme:light dark}.xmimo-tts-grid select option{color:var(--dsw-alias-label-primary,#1f2328);background:var(--dsw-alias-bg-layer-1,#fff)}.xmimo-tts-grid select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}.xmimo-tts-grid small{color:var(--dsw-alias-label-tertiary,#8b93a1);line-height:17px}.xmimo-tts-field-heading{display:flex;min-width:0;min-height:20px;flex-direction:row!important;align-items:center;justify-content:space-between;gap:8px}.xmimo-tts-field-label{display:inline-flex;min-width:0;align-items:center;gap:8px}.xmimo-tts-api-key-link{color:var(--dsw-alias-brand-primary,#4f6ef7);font-size:12px;text-decoration:none}.xmimo-tts-api-key-link:hover{text-decoration:underline}.xmimo-tts-field-badges{display:flex!important;flex:none;flex-direction:row!important;align-items:center;gap:8px}.xmimo-tts-overridden{border-radius:999px;padding:1px 7px;color:var(--dsw-alias-label-secondary,#5f6875);background:var(--dsw-alias-bg-module-platform,#eef0f3);font-size:11px;line-height:17px}.xmimo-tts-reset{padding:0;border:0;color:var(--dsw-alias-label-secondary,#5f6875);background:transparent;font:inherit;font-size:12px;cursor:pointer}.xmimo-tts-reset:hover:not(:disabled){color:var(--dsw-alias-label-primary,#1f2328)}.xmimo-tts-reset:disabled{cursor:not-allowed;opacity:.45}.xmimo-tts-api-key-hints{display:flex;min-width:0;gap:8px;align-items:center}.xmimo-tts-api-key-hints small{min-width:0;white-space:nowrap}.xmimo-tts-wide{grid-column:1/-1}.xmimo-tts-switch-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:0}.xmimo-tts-switch-row>*:first-child{padding-right:14px}.xmimo-tts-switch-row>*+*{padding-left:14px;border-left:1px solid var(--dsw-alias-border-l2,#e5e7eb)}.xmimo-tts-checkbox-row{position:relative;flex-direction:row!important;align-items:center!important;gap:10px!important;cursor:pointer}.xmimo-tts-switch-copy{display:flex;min-width:0;flex-direction:column;gap:4px}.xmimo-tts-checkbox-row>input{position:absolute;width:1px!important;height:1px;margin:0!important;padding:0!important;overflow:hidden;border:0!important;opacity:0;clip-path:inset(50%)}.xmimo-tts-switch-control{box-sizing:border-box;position:relative;display:inline-block!important;width:36px;height:20px;min-width:36px;flex:none;border:1px solid var(--dsw-alias-border-l2,#c8ccd4);border-radius:999px;background:var(--dsw-alias-bg-module-platform,#e5e7eb);transition:border-color 160ms ease,background 160ms ease}.xmimo-tts-switch-control:after{content:"";position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:var(--dsw-alias-bg-layer-1,#fff);box-shadow:0 1px 3px rgba(15,23,42,.24);transition:transform 160ms ease}.xmimo-tts-checkbox-row>input:checked+.xmimo-tts-switch-control{border-color:var(--dsw-alias-brand-primary,#4f6ef7);background:var(--dsw-alias-brand-primary,#4f6ef7)}.xmimo-tts-checkbox-row>input:checked+.xmimo-tts-switch-control:after{transform:translateX(16px)}.xmimo-tts-checkbox-row>input:focus-visible+.xmimo-tts-switch-control{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}.xmimo-tts-checkbox-row>input:disabled+.xmimo-tts-switch-control{cursor:not-allowed;opacity:.45}
1881
2290
  .xmimo-tts-voice-picker{display:flex;min-width:0;flex-direction:column;gap:6px}.xmimo-tts-voice-picker-trigger,.xmimo-tts-voice-option{box-sizing:border-box;display:flex;width:100%;min-width:0;align-items:center;gap:10px;border:1px solid var(--dsw-alias-border-l2,#e5e7eb);color:var(--dsw-alias-label-primary,#1f2328);background:var(--dsw-alias-bg-layer-2,#f3f4f6);font:inherit;text-align:left;cursor:pointer}.xmimo-tts-voice-picker-trigger{min-height:54px;border-radius:10px;padding:6px 10px}.xmimo-tts-voice-picker-trigger:hover:not(:disabled){border-color:var(--dsw-alias-label-dimmed,#c8ccd4);background:var(--dsw-alias-interactive-bg-hover,#eef0f3)}.xmimo-tts-voice-picker-trigger:focus-visible,.xmimo-tts-voice-option:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}.xmimo-tts-voice-picker-trigger:disabled{cursor:not-allowed;opacity:.55}.xmimo-tts-voice-avatar{box-sizing:border-box;display:block;width:40px;height:40px;flex:none;border:1px solid color-mix(in srgb,var(--dsw-alias-border-l2,#e5e7eb) 80%,transparent);border-radius:50%;object-fit:cover;background:var(--dsw-alias-bg-layer-1,#fff)}.xmimo-tts-custom-voice-avatar{display:grid;place-items:center;color:var(--dsw-alias-brand-primary,#4f6ef7);background:color-mix(in srgb,var(--dsw-alias-brand-primary,#4f6ef7) 12%,var(--dsw-alias-bg-layer-1,#fff))}.xmimo-tts-custom-voice-avatar svg{width:30px;height:30px;overflow:visible}.xmimo-tts-custom-voice-avatar circle{fill:currentColor}.xmimo-tts-custom-voice-avatar path{fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.xmimo-tts-voice-option-copy{display:flex;min-width:0;flex:1;flex-direction:column;gap:1px}.xmimo-tts-voice-option-copy strong{overflow:hidden;font-size:13px;font-weight:600;line-height:18px;text-overflow:ellipsis;white-space:nowrap}.xmimo-tts-voice-option-copy small{overflow:hidden;font-size:12px;text-overflow:ellipsis;white-space:nowrap}.xmimo-tts-voice-picker-chevron{flex:none;color:var(--dsw-alias-label-tertiary,#8b93a1);transition:transform 160ms ease}.xmimo-tts-voice-picker-chevron-open{transform:rotate(180deg)}.xmimo-tts-voice-picker-menu{display:grid;max-height:310px;overflow:auto;overscroll-behavior:contain;border:1px solid var(--dsw-alias-border-l2,#e5e7eb);border-radius:10px;padding:5px;background:var(--dsw-alias-bg-layer-1,#fff);box-shadow:0 10px 28px rgba(15,23,42,.12)}.xmimo-tts-voice-option{min-height:50px;border:0;border-radius:7px;padding:5px 7px;background:transparent}.xmimo-tts-voice-option:hover,.xmimo-tts-voice-option:focus-visible{background:var(--dsw-alias-interactive-bg-hover,#f3f4f6)}.xmimo-tts-voice-option-selected{background:color-mix(in srgb,var(--dsw-alias-brand-primary,#4f6ef7) 10%,transparent)}
1882
- .xmimo-tts-card-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;padding-top:12px;border-top:1px solid var(--dsw-alias-border-l2,#e5e7eb);font-size:12px;color:var(--dsw-alias-label-tertiary,#8b93a1)}.xmimo-tts-card-actions button{border:1px solid var(--dsw-alias-brand-primary,#4f6ef7);border-radius:8px;padding:5px 14px;color:var(--dsw-alias-bg-layer-1,#fff);background:var(--dsw-alias-brand-primary,#4f6ef7);cursor:pointer;font:inherit}.xmimo-tts-card-actions button:hover:not(:disabled){filter:brightness(1.08)}.xmimo-tts-card-actions button:disabled{cursor:not-allowed;color:var(--dsw-alias-label-dimmed,#9ca3af);background:var(--dsw-alias-bg-layer-2,#f3f4f6);border-color:var(--dsw-alias-border-l2,#e5e7eb);opacity:1}.xmimo-tts-card-actions .xmimo-tts-star{border-color:transparent;color:var(--dsw-alias-brand-primary,#4f6ef7);background:transparent;font-weight:500}.xmimo-tts-card-actions .xmimo-tts-star:hover{text-decoration:underline}.xmimo-tts-card-actions .xmimo-tts-uninstall{margin-right:auto;border-color:#F56C6C;color:#F56C6C;background:transparent}.xmimo-tts-card-actions .xmimo-tts-uninstall:hover:not(:disabled){background:color-mix(in srgb,#F56C6C 10%,transparent)}.xmimo-tts-card-actions .xmimo-tts-uninstall:disabled{border-color:#F56C6C;color:#F56C6C;background:transparent;opacity:.55}.xmimo-tts-uninstall-confirmation{display:flex;align-items:center;gap:8px;margin-right:auto;color:#F56C6C}.xmimo-tts-uninstall-choice{display:inline-flex;overflow:hidden;border:1px solid #F56C6C;border-radius:8px}.xmimo-tts-card-actions .xmimo-tts-uninstall-choice button{border:0;border-radius:0;padding:5px 12px;color:#F56C6C;background:transparent}.xmimo-tts-card-actions .xmimo-tts-uninstall-choice button+button{border-left:1px solid #F56C6C}.xmimo-tts-card-actions .xmimo-tts-uninstall-choice button:hover{filter:none;background:color-mix(in srgb,#F56C6C 10%,transparent)}.xmimo-tts-card-actions .xmimo-tts-discard{border-color:var(--dsw-alias-border-l2,#e5e7eb);color:var(--dsw-alias-label-secondary,#5f6875);background:transparent}.xmimo-tts-card-actions .xmimo-tts-discard:hover:not(:disabled){color:var(--dsw-alias-label-primary,#1f2328);border-color:var(--dsw-alias-label-dimmed,#c8ccd4)}.xmimo-tts-failed{color:var(--dsw-alias-state-error-primary,#dc2626)}
1883
- @media(max-width:720px){.xmimo-tts-grid{grid-template-columns:1fr}.xmimo-tts-wide{grid-column:auto}.xmimo-tts-switch-row{grid-template-columns:1fr}.xmimo-tts-switch-row>*:first-child{padding-right:0;padding-bottom:16px}.xmimo-tts-switch-row>*+*{padding-top:16px;padding-left:0;border-top:1px solid var(--dsw-alias-border-l2,#e5e7eb);border-left:0}.xmimo-tts-select-column{grid-column:auto;flex-direction:column}.xmimo-tts-select-column>div:first-child:not(:only-child){padding-right:0;padding-bottom:16px}.xmimo-tts-select-column>div+div{padding-top:16px;padding-left:0;border-top:1px solid var(--dsw-alias-border-l2,#e5e7eb);border-left:0}.xmimo-tts-api-key-hints{flex-wrap:wrap}.xmimo-tts-api-key-hints small{white-space:normal}}
2291
+ .xmimo-tts-builtin-voice-picker{display:flex;min-width:0;flex-direction:column;gap:8px}.xmimo-tts-builtin-voice-trigger,.xmimo-tts-builtin-voice-option{box-sizing:border-box;display:flex;width:100%;min-width:0;align-items:center;gap:10px;border:1px solid var(--dsw-alias-border-l2,#e5e7eb);border-radius:9px;color:var(--dsw-alias-label-primary,#1f2328);background:var(--dsw-alias-bg-layer-1,#fff);font:inherit;text-align:left;cursor:pointer}.xmimo-tts-builtin-voice-trigger{min-height:54px;padding:8px 11px}.xmimo-tts-builtin-voice-trigger:hover:not(:disabled),.xmimo-tts-builtin-voice-option:hover{border-color:var(--dsw-alias-label-dimmed,#c8ccd4);background:var(--dsw-alias-interactive-bg-hover,#f7f7f5)}.xmimo-tts-builtin-voice-trigger:focus-visible,.xmimo-tts-builtin-voice-option:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}.xmimo-tts-builtin-voice-trigger:disabled{cursor:not-allowed;opacity:.55}.xmimo-tts-builtin-voice-avatar{box-sizing:border-box;display:block;width:36px;height:36px;flex:none;border-radius:50%;object-fit:cover;background:#f4f2ed}.xmimo-tts-builtin-voice-copy{display:flex;min-width:0;flex:1;flex-direction:column;gap:1px}.xmimo-tts-builtin-voice-copy strong{overflow:hidden;font-size:14px;font-weight:600;line-height:18px;text-overflow:ellipsis;white-space:nowrap}.xmimo-tts-builtin-voice-copy small{overflow:hidden;color:var(--dsw-alias-label-tertiary,#77736b);font-size:12px;line-height:15px;text-overflow:ellipsis;white-space:nowrap}.xmimo-tts-builtin-voice-menu{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;max-height:320px;overflow:auto;overscroll-behavior:contain;border:1px solid var(--dsw-alias-border-l2,#e5e7eb);border-radius:12px;padding:10px;background:var(--dsw-alias-bg-layer-1,#fff);box-shadow:0 10px 28px rgba(15,23,42,.12)}.xmimo-tts-builtin-voice-option{position:relative;min-height:60px;padding:9px 12px}.xmimo-tts-builtin-voice-option-selected{background:color-mix(in srgb,#dedbd2 24%,var(--dsw-alias-bg-layer-1,#fff))}.xmimo-tts-builtin-voice-check{position:absolute;top:6px;right:6px;width:14px;height:14px}.xmimo-tts-builtin-voice-check circle{fill:#383932}.xmimo-tts-builtin-voice-check path{fill:none;stroke:#fff;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
2292
+ .xmimo-tts-card-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;padding-top:12px;border-top:1px solid var(--dsw-alias-border-l2,#e5e7eb);font-size:12px;color:var(--dsw-alias-label-tertiary,#8b93a1)}.xmimo-tts-card-actions button{border:1px solid var(--dsw-alias-brand-primary,#4f6ef7);border-radius:8px;padding:5px 14px;color:var(--dsw-alias-bg-layer-1,#fff);background:var(--dsw-alias-brand-primary,#4f6ef7);cursor:pointer;font:inherit}.xmimo-tts-card-actions button:hover:not(:disabled){filter:brightness(1.08)}.xmimo-tts-card-actions button:disabled{cursor:not-allowed;color:var(--dsw-alias-label-dimmed,#9ca3af);background:var(--dsw-alias-bg-layer-2,#f3f4f6);border-color:var(--dsw-alias-border-l2,#e5e7eb);opacity:1}.xmimo-tts-card-actions .xmimo-tts-update{display:inline-flex;align-items:center;border:1px solid var(--dsw-alias-brand-primary,#4f6ef7);border-radius:8px;padding:5px 14px;color:var(--dsw-alias-brand-primary,#4f6ef7);background:transparent;text-decoration:none}.xmimo-tts-card-actions .xmimo-tts-update:hover{filter:brightness(1.08)}.xmimo-tts-card-actions .xmimo-tts-star{border-color:transparent;color:var(--dsw-alias-brand-primary,#4f6ef7);background:transparent;font-weight:500}.xmimo-tts-card-actions .xmimo-tts-star:hover{text-decoration:underline}.xmimo-tts-card-actions .xmimo-tts-uninstall{margin-right:auto;border-color:#F56C6C;color:#F56C6C;background:transparent}.xmimo-tts-card-actions .xmimo-tts-uninstall:hover:not(:disabled){background:color-mix(in srgb,#F56C6C 10%,transparent)}.xmimo-tts-card-actions .xmimo-tts-uninstall:disabled{border-color:#F56C6C;color:#F56C6C;background:transparent;opacity:.55}.xmimo-tts-uninstall-confirmation{display:flex;align-items:center;gap:8px;margin-right:auto;color:#F56C6C}.xmimo-tts-uninstall-choice{display:inline-flex;overflow:hidden;border:1px solid #F56C6C;border-radius:8px}.xmimo-tts-card-actions .xmimo-tts-uninstall-choice button{border:0;border-radius:0;padding:5px 12px;color:#F56C6C;background:transparent}.xmimo-tts-card-actions .xmimo-tts-uninstall-choice button+button{border-left:1px solid #F56C6C}.xmimo-tts-card-actions .xmimo-tts-uninstall-choice button:hover{filter:none;background:color-mix(in srgb,#F56C6C 10%,transparent)}.xmimo-tts-card-actions .xmimo-tts-discard{border-color:var(--dsw-alias-border-l2,#e5e7eb);color:var(--dsw-alias-label-secondary,#5f6875);background:transparent}.xmimo-tts-card-actions .xmimo-tts-discard:hover:not(:disabled){color:var(--dsw-alias-label-primary,#1f2328);border-color:var(--dsw-alias-label-dimmed,#c8ccd4)}.xmimo-tts-failed{color:var(--dsw-alias-state-error-primary,#dc2626)}.xmimo-tts-version{color:var(--dsw-alias-label-tertiary,#8b93a1);font-size:11px;font-weight:400}
2293
+ @media(max-width:720px){.xmimo-tts-grid{grid-template-columns:1fr}.xmimo-tts-wide{grid-column:auto}.xmimo-tts-switch-row{grid-template-columns:1fr}.xmimo-tts-switch-row>*:first-child{padding-right:0;padding-bottom:16px}.xmimo-tts-switch-row>*+*{padding-top:16px;padding-left:0;border-top:1px solid var(--dsw-alias-border-l2,#e5e7eb);border-left:0}.xmimo-tts-api-key-hints{flex-wrap:wrap}.xmimo-tts-api-key-hints small{white-space:normal}}@media(max-width:480px){.xmimo-tts-builtin-voice-menu{grid-template-columns:1fr}}
2294
+ .xmimo-tts-card-actions .xmimo-tts-uninstall{margin-right:0}.xmimo-tts-card-actions .xmimo-tts-star{margin-right:auto}.xmimo-tts-uninstall-confirmation{margin-right:0}
2295
+ .xmimo-tts-format-option-selected{z-index:1;border-color:var(--dsw-alias-brand-primary,#4f6ef7)}.xmimo-tts-format-option{text-transform:uppercase}
2296
+ .xmimo-tts-format-options{display:flex;width:100%;gap:0}.xmimo-tts-format-option{position:relative;flex:1;padding:8px 4px;border:1px solid var(--dsw-alias-border-l2,#e5e7eb);text-align:center;cursor:pointer}.xmimo-tts-format-option:first-child{border-radius:8px 0 0 8px}.xmimo-tts-format-option:last-child{border-radius:0 8px 8px 0}.xmimo-tts-format-option+.xmimo-tts-format-option{border-left:0}.xmimo-tts-format-option input{position:absolute;width:1px;height:1px;opacity:0}.xmimo-tts-format-option-selected{color:var(--dsw-alias-brand-primary,#4f6ef7);font-weight:600}.xmimo-tts-format-option:focus-within{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}.xmimo-tts-builtin-voice-option-custom{grid-column:1/-1}
1884
2297
  `;
1885
2298
 
1886
2299
  //#endregion