dsh-xiaomi-tts 2.3.2 → 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 +84 -6
  2. package/README.md +19 -10
  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 +10 -4
  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 +559 -224
  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 +121 -33
  36. package/lib/{shared-9qFFYsWe.js → shared-Cf9qZwUl.js} +104 -32
  37. package/lib/shared.d.ts +82 -26
  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
@@ -41,22 +41,54 @@ const TTS_STREAM_ROUTE = "/plugins/xiaomi-mimo-tts/synthesize-stream";
41
41
  const TTS_UNINSTALL_ROUTE = "/plugins/xiaomi-mimo-tts/uninstall";
42
42
  /** Same-origin route that checks the published npm version. */
43
43
  const TTS_UPDATE_ROUTE = "/plugins/xiaomi-mimo-tts/update";
44
- /** Keep the UI version visible without making the browser bundle load package.json. */
45
- const TTS_VERSION = "2.3.2";
46
44
  /** Same-origin route that reports API key configuration status without exposing the key. */
47
45
  const TTS_API_KEY_STATUS_ROUTE = "/plugins/xiaomi-mimo-tts/api-key-status";
48
46
  /** Same-origin prefix used by the Web client to load voice-design preset icons. */
49
47
  const TTS_VOICE_DESIGN_ASSET_ROUTE = "/plugins/xiaomi-mimo-tts/voice-presets";
50
- /** Supported built-in Xiaomi MiMo voices. */
51
- const TTS_VOICES = [
52
- "冰糖",
53
- "茉莉",
54
- "苏打",
55
- "白桦",
56
- "Mia",
57
- "Chloe",
58
- "Milo",
59
- "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
+ }
60
92
  ];
61
93
  /** TTS models supported by this plugin. */
62
94
  const TTS_MODELS = ["mimo-v2.5-tts", "mimo-v2.5-tts-voicedesign"];
@@ -64,61 +96,80 @@ const TTS_MODELS = ["mimo-v2.5-tts", "mimo-v2.5-tts-voicedesign"];
64
96
  const TTS_VOICE_DESIGN_PRESETS = [
65
97
  {
66
98
  id: "energetic-girl",
67
- label: "林小满",
68
- summary: "女 · 16岁 · 元气少女,明亮高饱和声线",
69
- 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 岁,普通话,温和克制的中低音,声线清晰自然,声音偏亮不沉闷,略带书卷气和理工感,语速中等偏慢,停顿审慎,表达理性简洁,情绪稳定,不夸张。"
70
108
  },
71
109
  {
72
110
  id: "asmr-whisper",
73
111
  label: "沈听澜",
74
- summary: "女 · 19岁 · ASMR低语,轻柔耳语带微弱气息",
112
+ summary: "ASMR低语",
75
113
  prompt: "女性18-20岁,轻柔耳语带微弱气息,普通话,声线细腻清晰,私密温柔感,安静平和带轻柔低语,语速缓慢音量很轻,私密低语场景。"
76
114
  },
115
+ {
116
+ id: "young-man",
117
+ label: "江予辰",
118
+ summary: "阳光少年",
119
+ prompt: "男性青年16-22岁,清亮干净的中高音带少年感,普通话标准无口音,轻快明亮的活力声线,气息轻盈吐字利索,语速偏快语调自然上扬,情绪积极阳光带朝气,广告旁白或轻松解说场景。"
120
+ },
77
121
  {
78
122
  id: "gentle-girlfriend",
79
- label: "张子莯",
80
- summary: "女 · 22岁 · 温柔女友,声线柔软细腻",
123
+ label: "张子苜",
124
+ summary: "温柔陪伴",
81
125
  prompt: "年轻女性16-22岁,声线柔软细腻,低饱和带微微暖意,标准普通话,温柔亲密的邻家风格,语速偏慢,语调轻柔连贯,气息自然流畅,安静私密陪伴场景。"
82
126
  },
127
+ {
128
+ id: "tech-explainer",
129
+ label: "周砚川",
130
+ summary: "科技解说",
131
+ prompt: "成年男性25-35岁,清晰利落中音、干净偏冷,标准普通话,精准干练的都市精英感,语速中等偏快、语调平稳,理性简洁、逻辑感强,现代资讯播报或商业讲解场景。"
132
+ },
83
133
  {
84
134
  id: "girl-next-door",
85
135
  label: "陈念安",
86
- summary: "女 · 25岁 · 邻家女孩,柔润清甜带撒娇感",
136
+ summary: "邻家甜声",
87
137
  prompt: "年轻女性20-25岁,柔润清甜带撒娇感,普通话,清澈明亮的少女音,轻松温柔的亲近感,轻松平缓带温柔,中等偏快语速中等音量,生活分享场景。"
88
138
  },
139
+ {
140
+ id: "documentary-narrator",
141
+ label: "陆远山",
142
+ summary: "纪录片旁白",
143
+ prompt: "男性40-50岁,低沉醇厚有胸腔共鸣,普通话,稳重可靠的叙事者风格,语速中等偏慢,语调沉稳克制带叙事纵深感,气息舒展停顿有留白,纪录片旁白或深度访谈场景。"
144
+ },
89
145
  {
90
146
  id: "news-anchor",
91
147
  label: "顾知微",
92
- summary: "女 · 35岁 · 新闻播报,声线中低音区饱满清晰",
148
+ summary: "沉稳播报",
93
149
  prompt: "专业新闻播音女主持,成年女性30-40岁,普通话标准无口音,声线中低音区饱满清晰,端庄知性沉稳,语气克制权威,语速从容均匀,音量适中稳定,新闻播报与专题解说场景。"
94
150
  },
95
- {
96
- id: "young-man",
97
- label: "江予辰",
98
- summary: "男 · 19岁 · 青年男声,清亮干净的中高音带少年感",
99
- prompt: "男性青年16-22岁,清亮干净的中高音带少年感,普通话标准无口音,轻快明亮的活力声线,气息轻盈吐字利索,语速偏快语调自然上扬,情绪积极阳光带朝气,广告旁白或轻松解说场景。"
100
- },
101
- {
102
- id: "tech-explainer",
103
- label: "周砚川",
104
- summary: "男 · 30岁 · 科技解说,清晰利落中音、干净偏冷",
105
- prompt: "成年男性25-35岁,清晰利落中音、干净偏冷,标准普通话,精准干练的都市精英感,语速中等偏快、语调平稳,理性简洁、逻辑感强,现代资讯播报或商业讲解场景。"
106
- },
107
151
  {
108
152
  id: "suspense-narrator",
109
153
  label: "裴沉舟",
110
- summary: "男 · 35岁 · 悬疑旁白,低沉沉稳带神秘磁性",
154
+ summary: "悬疑旁白",
111
155
  prompt: "男性中年30-40岁,低沉沉稳带神秘磁性,普通话,压抑克制的叙事风格,语速缓慢均匀,语调低沉平稳,情绪冷静悬疑,旁白解说场景。"
112
- },
113
- {
114
- id: "documentary-narrator",
115
- label: "陆远山",
116
- summary: "男 · 45岁 · 纪录片,低沉醇厚有胸腔共鸣",
117
- prompt: "男性40-50岁,低沉醇厚有胸腔共鸣,普通话,稳重可靠的叙事者风格,语速中等偏慢,语调沉稳克制带叙事纵深感,气息舒展停顿有留白,纪录片旁白或深度访谈场景。"
118
156
  }
119
157
  ];
158
+ /** Supported audio formats. */
159
+ const TTS_FORMATS = [
160
+ "pcm",
161
+ "mp3",
162
+ "wav"
163
+ ];
120
164
  /** Minimum spoken characters to accumulate before starting one PCM stream request. */
121
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;
122
173
  const TTS_PUNCTUATION = {
123
174
  ",": ",",
124
175
  "。": ".",
@@ -268,11 +319,14 @@ const DEFAULT_TTS_SETTINGS = {
268
319
  voiceDesignPrompt: "青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。",
269
320
  voiceDesignCustomPrompt: "青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。",
270
321
  presetStylePrompt: "使用清晰、自然、准确的声音朗读,语速适中,停顿自然,语气平和克制,避免夸张表达。",
271
- format: "mp3",
322
+ format: "pcm",
272
323
  autoPlay: true,
273
324
  instruction: "请忠实朗读原文,根据文本语气自然表达,不添加或改写内容。",
274
325
  maxTextLength: 12e3,
275
- 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
276
330
  };
277
331
  /** Whether an API key selects one of the Xiaomi endpoints supported by this plugin. */
278
332
  function isSupportedTtsApiKey(apiKey) {
@@ -299,12 +353,27 @@ var PcmAudioQueue = class {
299
353
  context = null;
300
354
  scheduledAt = 0;
301
355
  sources = /* @__PURE__ */ new Set();
356
+ sourceBytes = /* @__PURE__ */ new Map();
302
357
  revision = 0;
303
358
  chain = Promise.resolve();
304
359
  busy = false;
360
+ userPaused = false;
361
+ queuedBytes = 0;
362
+ maxPausedPcmBytes = 32 * 1024 * 1024;
305
363
  constructor(callbacks) {
306
364
  this.callbacks = callbacks;
307
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
+ }
308
377
  enqueue(base64) {
309
378
  const revision = this.revision;
310
379
  const run = this.chain.then(() => this.schedule(base64, revision));
@@ -315,10 +384,13 @@ var PcmAudioQueue = class {
315
384
  this.revision += 1;
316
385
  this.scheduledAt = 0;
317
386
  this.chain = Promise.resolve();
387
+ this.userPaused = false;
388
+ this.queuedBytes = 0;
318
389
  for (const source of this.sources) try {
319
390
  source.stop();
320
391
  } catch {}
321
392
  this.sources.clear();
393
+ this.sourceBytes.clear();
322
394
  this.setBusy(false);
323
395
  }
324
396
  async dispose() {
@@ -332,7 +404,7 @@ var PcmAudioQueue = class {
332
404
  const bytes = Uint8Array.from(atob(base64), (character) => character.charCodeAt(0));
333
405
  if (bytes.byteLength < 2) return;
334
406
  const context = this.getContext();
335
- if (context.state !== "running") await context.resume();
407
+ if (context.state !== "running" && !this.userPaused) await context.resume();
336
408
  if (revision !== this.revision) return;
337
409
  const sampleCount = Math.floor(bytes.byteLength / 2);
338
410
  const buffer = context.createBuffer(1, sampleCount, 24e3);
@@ -344,16 +416,23 @@ var PcmAudioQueue = class {
344
416
  source.connect(context.destination);
345
417
  const startAt = Math.max(context.currentTime + .03, this.scheduledAt);
346
418
  this.scheduledAt = startAt + buffer.duration;
419
+ if (this.userPaused && this.queuedBytes + bytes.byteLength > this.maxPausedPcmBytes) throw new Error("pcm-pause-buffer-limit");
347
420
  this.sources.add(source);
421
+ this.sourceBytes.set(source, bytes.byteLength);
422
+ this.queuedBytes += bytes.byteLength;
348
423
  source.addEventListener("ended", () => {
349
424
  if (revision !== this.revision) return;
350
425
  this.sources.delete(source);
426
+ this.queuedBytes -= this.sourceBytes.get(source) ?? 0;
427
+ this.sourceBytes.delete(source);
351
428
  if (this.sources.size === 0) this.setBusy(false);
352
429
  }, { once: true });
353
430
  try {
354
431
  source.start(startAt);
355
432
  } catch (error) {
356
433
  this.sources.delete(source);
434
+ this.queuedBytes -= this.sourceBytes.get(source) ?? 0;
435
+ this.sourceBytes.delete(source);
357
436
  throw error;
358
437
  }
359
438
  this.setBusy(true);
@@ -374,12 +453,11 @@ var PcmAudioQueue = class {
374
453
  //#region src/client/live-speech-controller.ts
375
454
  function pcmDeltaFromSse(data) {
376
455
  if (data === "[DONE]") return null;
377
- try {
378
- const pcm = JSON.parse(data).choices?.[0]?.delta?.audio?.data;
379
- return typeof pcm === "string" && pcm.length > 0 ? pcm : null;
380
- } catch {
381
- return null;
382
- }
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;
383
461
  }
384
462
  var LiveSpeechController = class {
385
463
  audio = new PcmAudioQueue({
@@ -402,10 +480,33 @@ var LiveSpeechController = class {
402
480
  requestBusy = false;
403
481
  audioBusy = false;
404
482
  blockedTurn = null;
483
+ completed = null;
405
484
  onStateChange = null;
406
485
  setStateChangeListener(listener) {
407
486
  this.onStateChange = listener;
408
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
+ }
409
510
  activateSession(sessionId) {
410
511
  if (this.sessionId === sessionId) return;
411
512
  this.cancel();
@@ -432,6 +533,20 @@ var LiveSpeechController = class {
432
533
  this.observed = text;
433
534
  this.drain(false);
434
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
+ }
435
550
  finish(sessionId, final) {
436
551
  const key = `${sessionId}:${final.turn}:${final.step}`;
437
552
  if (this.blockedTurn === `${sessionId}:${final.turn}`) {
@@ -450,8 +565,8 @@ var LiveSpeechController = class {
450
565
  this.handled.add(key);
451
566
  }
452
567
  stop(sessionId) {
453
- if (this.sessionId !== sessionId || this.active === null || this.status !== "loading" && this.status !== "playing") return false;
454
- 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}`;
455
570
  this.resetState();
456
571
  return true;
457
572
  }
@@ -482,6 +597,7 @@ var LiveSpeechController = class {
482
597
  this.beginSegment(next, true);
483
598
  }
484
599
  beginSegment(next, preserveMessageId) {
600
+ this.completed = null;
485
601
  this.active = next;
486
602
  this.observed = "";
487
603
  this.consumed = 0;
@@ -495,8 +611,9 @@ var LiveSpeechController = class {
495
611
  this.observed = "";
496
612
  this.consumed = 0;
497
613
  this.pendingText = "";
498
- this.messageId = null;
499
614
  this.setStatus("idle");
615
+ this.messageId = null;
616
+ this.completed = null;
500
617
  }
501
618
  cursorKey(cursor) {
502
619
  return `${cursor.sessionId}:${cursor.turn}:${cursor.step}`;
@@ -553,6 +670,18 @@ var LiveSpeechController = class {
553
670
  const reader = response.body.getReader();
554
671
  const decoder = new TextDecoder();
555
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
+ };
556
685
  try {
557
686
  while (this.isCurrentStream(generation, signal)) {
558
687
  const result = await reader.read();
@@ -560,23 +689,26 @@ var LiveSpeechController = class {
560
689
  pending += decoder.decode(result.value, { stream: true });
561
690
  const parsed = parseSseRecords(pending);
562
691
  pending = parsed.remainder;
563
- for (const event of parsed.events) {
564
- if (!this.isCurrentStream(generation, signal)) return;
565
- const pcm = pcmDeltaFromSse(event);
566
- if (pcm !== null) {
567
- await this.audio.enqueue(pcm);
568
- if (!this.isCurrentStream(generation, signal)) return;
569
- }
570
- }
692
+ await consume(parsed.events);
571
693
  }
694
+ pending += decoder.decode();
695
+ if (pending.trim().length > 0) await consume(parseSseRecords(`${pending}\n\n`).events);
572
696
  } finally {
573
697
  reader.releaseLock();
574
698
  }
699
+ if (!receivedPcm && this.isCurrentStream(generation, signal)) throw new Error("stream-audio-empty");
575
700
  } catch (error) {
576
701
  if (this.isCurrentStream(generation, signal)) throw error;
577
702
  }
578
703
  }
579
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
+ }
580
712
  if (this.active !== null) this.blockedTurn = `${this.active.sessionId}:${this.active.turn}`;
581
713
  this.setStatus("error");
582
714
  this.replaceQueue();
@@ -588,6 +720,7 @@ var LiveSpeechController = class {
588
720
  setStatus(status) {
589
721
  if (this.status === status) return;
590
722
  this.status = status;
723
+ if (status === "playing" && this.completed !== null) this.completed.audioStarted = true;
591
724
  this.reportStatus();
592
725
  }
593
726
  reportStatus() {
@@ -871,10 +1004,11 @@ function decodeSettings(value) {
871
1004
  if (typeof value.voice === "string") decoded.voice = value.voice;
872
1005
  if (typeof value.voiceDesignPrompt === "string") decoded.voiceDesignPrompt = value.voiceDesignPrompt;
873
1006
  if (typeof value.voiceDesignCustomPrompt === "string") decoded.voiceDesignCustomPrompt = value.voiceDesignCustomPrompt;
874
- if (value.format === "mp3" || value.format === "wav") decoded.format = value.format;
1007
+ if (TTS_FORMATS.includes(value.format)) decoded.format = value.format;
875
1008
  if (typeof value.autoPlay === "boolean") decoded.autoPlay = value.autoPlay;
876
1009
  if (typeof value.maxTextLength === "number") decoded.maxTextLength = value.maxTextLength;
877
1010
  if (typeof value.requestTimeoutMs === "number") decoded.requestTimeoutMs = value.requestTimeoutMs;
1011
+ if (typeof value.maxPausedPcmBytes === "number") decoded.maxPausedPcmBytes = value.maxPausedPcmBytes;
878
1012
  return decoded;
879
1013
  }
880
1014
  function useSettingsSnapshot(scope) {
@@ -929,6 +1063,7 @@ function messageLiveIdentity(snapshot, messageId) {
929
1063
  /** Own the active-session boundary and feed its partial assistant output into realtime speech. */
930
1064
  function SessionPlaybackObserver({ sessionId, session, playback, live, settings }) {
931
1065
  const resolvedSettings = resolveTtsSettings(useSettingsSnapshot(settings).value);
1066
+ live.setMaxPausedPcmBytes(resolvedSettings.maxPausedPcmBytes);
932
1067
  const active = (0, react.useRef)(null);
933
1068
  const wasRunning = (0, react.useRef)(session.running);
934
1069
  const runArmed = (0, react.useRef)(!session.running);
@@ -962,7 +1097,7 @@ function SessionPlaybackObserver({ sessionId, session, playback, live, settings
962
1097
  active.current = null;
963
1098
  }
964
1099
  playback.observeSession(sessionId, session.running && runArmed.current, latestMessageId);
965
- 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") {
966
1101
  live.cancelSession(sessionId);
967
1102
  active.current = null;
968
1103
  if (session.running) runArmed.current = false;
@@ -995,6 +1130,7 @@ function SessionPlaybackObserver({ sessionId, session, playback, live, settings
995
1130
  playback,
996
1131
  resolvedSettings.autoPlay,
997
1132
  resolvedSettings.enabled,
1133
+ resolvedSettings.format,
998
1134
  resolvedSettings.model,
999
1135
  session,
1000
1136
  sessionId,
@@ -1012,11 +1148,23 @@ function ReadAloudAction({ sessionId, messageId, useSession, playback, live, set
1012
1148
  }));
1013
1149
  const text = message.text;
1014
1150
  const settingsSnapshot = useSettingsSnapshot(settings);
1151
+ const resolvedSettings = resolveTtsSettings(settingsSnapshot.value);
1015
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
+ };
1016
1164
  (0, react.useEffect)(() => {
1017
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;
1018
1166
  const cancel = window.setTimeout(() => {
1019
- 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);
1020
1168
  }, 0);
1021
1169
  return () => window.clearTimeout(cancel);
1022
1170
  }, [
@@ -1027,6 +1175,8 @@ function ReadAloudAction({ sessionId, messageId, useSession, playback, live, set
1027
1175
  message.time,
1028
1176
  messageId,
1029
1177
  playback,
1178
+ resolvedSettings.format,
1179
+ resolvedSettings.model,
1030
1180
  sessionId,
1031
1181
  settingsSnapshot.value?.autoPlay,
1032
1182
  settingsSnapshot.value?.enabled,
@@ -1050,13 +1200,19 @@ function ReadAloudAction({ sessionId, messageId, useSession, playback, live, set
1050
1200
  "aria-pressed": status === "playing" || liveActive,
1051
1201
  disabled: status === "loading" && !liveActive,
1052
1202
  onClick: () => {
1053
- if (mine && source === "live" && (status === "loading" || status === "playing")) {
1054
- live.stop(sessionId);
1055
- 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);
1056
1209
  return;
1057
1210
  }
1058
- live.cancelSession(sessionId);
1059
- playback.toggle(sessionId, messageId, text, false);
1211
+ if (mine && source === "complete") {
1212
+ playback.toggle(sessionId, messageId, text, false);
1213
+ return;
1214
+ }
1215
+ playCompletedReply(false);
1060
1216
  },
1061
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, {})
1062
1218
  })
@@ -1082,9 +1238,9 @@ const zh = {
1082
1238
  "error.request": "语音生成失败。",
1083
1239
  "error.play": "浏览器阻止了自动播放,请点击朗读按钮。",
1084
1240
  "settings.title": "语音朗读 (Xiaomi MiMo)",
1085
- "settings.description": "在助手回复操作栏中使用 Xiaomi MiMo TTS 生成并播放语音。",
1241
+ "settings.description": "在对话中使用 Xiaomi MiMo TTS 生成并播放语音。",
1086
1242
  "settings.enabled": "显示朗读按钮",
1087
- "settings.enabledHint": "关闭后不会在助手回复操作栏显示朗读按钮,也不会自动播报。",
1243
+ "settings.enabledHint": "关闭后不会显示朗读按钮,也不会自动播报。",
1088
1244
  "settings.apiKey": "API Key",
1089
1245
  "settings.apiKeyStatus": "只有输入新值并保存时才会替换现有密钥。",
1090
1246
  "settings.apiKeyConfigured": "已配置",
@@ -1096,14 +1252,20 @@ const zh = {
1096
1252
  "settings.model": "TTS 模型",
1097
1253
  "settings.presetModel": "预置音色模型 (mimo-v2.5-tts)",
1098
1254
  "settings.voiceDesignModel": "自定义音色模型 (mimo-v2.5-tts-voicedesign)",
1099
- "settings.modelAutoPlayHintPreset": "预置音色模型支持实时流式播放。",
1255
+ "settings.modelAutoPlayHintPreset": "预置音色的播放方式由音频格式决定。",
1100
1256
  "settings.modelAutoPlayHintVoiceDesign": "自定义音色仅支持在回复完成后自动播放。",
1101
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": "完整生成后播放,保留无损音频但文件更大;支持暂停和继续。",
1102
1265
  "settings.voiceDesignPrompt": "自定义音色描述",
1103
1266
  "settings.customVoiceOption": "自定义",
1104
1267
  "settings.customVoiceSummary": "手动编写音色描述",
1105
1268
  "settings.voiceDesignPromptHint": "按“年龄段 + 性别、声音质感、语速节奏、情绪底色”描述声音本身;不写场景或动作。",
1106
- "settings.format": "音频格式",
1107
1269
  "settings.save": "保存",
1108
1270
  "settings.saving": "保存中…",
1109
1271
  "settings.saved": "已保存",
@@ -1152,14 +1314,20 @@ const en = {
1152
1314
  "settings.model": "TTS model",
1153
1315
  "settings.presetModel": "Preset voices (mimo-v2.5-tts)",
1154
1316
  "settings.voiceDesignModel": "Custom voice design (mimo-v2.5-tts-voicedesign)",
1155
- "settings.modelAutoPlayHintPreset": "Preset voices support realtime streaming playback.",
1317
+ "settings.modelAutoPlayHintPreset": "The selected audio format controls preset-voice playback.",
1156
1318
  "settings.modelAutoPlayHintVoiceDesign": "Custom voice design supports automatic playback only after the reply is complete.",
1157
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.",
1158
1327
  "settings.voiceDesignPrompt": "Custom voice description",
1159
1328
  "settings.customVoiceOption": "Custom",
1160
1329
  "settings.customVoiceSummary": "Write a custom voice description",
1161
1330
  "settings.voiceDesignPromptHint": "Describe the voice itself with age/gender, texture, pace, and emotional baseline; avoid scenes or actions.",
1162
- "settings.format": "Audio format",
1163
1331
  "settings.save": "Save",
1164
1332
  "settings.saving": "Saving…",
1165
1333
  "settings.saved": "Saved",
@@ -1183,6 +1351,149 @@ const en = {
1183
1351
  "settings.collapse": "Collapse settings"
1184
1352
  };
1185
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
+
1186
1497
  //#endregion
1187
1498
  //#region src/client/voice-design-picker.tsx
1188
1499
  const CUSTOM_VOICE_DESIGN_OPTION = "__custom__";
@@ -1191,7 +1502,7 @@ function isPresetVoiceDesignPrompt(value) {
1191
1502
  }
1192
1503
  function VoicePresetAvatar({ preset }) {
1193
1504
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
1194
- className: "xmimo-tts-voice-avatar",
1505
+ className: "xmimo-tts-builtin-voice-avatar",
1195
1506
  src: `${TTS_VOICE_DESIGN_ASSET_ROUTE}/${preset.id}.webp`,
1196
1507
  alt: "",
1197
1508
  width: 40,
@@ -1202,7 +1513,7 @@ function VoicePresetAvatar({ preset }) {
1202
1513
  }
1203
1514
  function CustomVoiceAvatar() {
1204
1515
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1205
- className: "xmimo-tts-voice-avatar xmimo-tts-custom-voice-avatar",
1516
+ className: "xmimo-tts-builtin-voice-avatar xmimo-tts-custom-voice-avatar",
1206
1517
  "aria-hidden": "true",
1207
1518
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
1208
1519
  viewBox: "0 0 40 40",
@@ -1219,6 +1530,18 @@ function CustomVoiceAvatar() {
1219
1530
  })
1220
1531
  });
1221
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
+ }
1222
1545
  function VoiceDesignPresetPicker({ value, disabled, label, customLabel, customSummary, onChange }) {
1223
1546
  const [open, setOpen] = (0, react.useState)(false);
1224
1547
  const rootRef = (0, react.useRef)(null);
@@ -1288,7 +1611,7 @@ function VoiceDesignPresetPicker({ value, disabled, label, customLabel, customSu
1288
1611
  } else if (event.key === "Tab") setOpen(false);
1289
1612
  };
1290
1613
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1291
- className: "xmimo-tts-voice-picker",
1614
+ className: "xmimo-tts-voice-picker xmimo-tts-builtin-voice-picker",
1292
1615
  ref: rootRef,
1293
1616
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1294
1617
  ref: triggerRef,
@@ -1313,7 +1636,7 @@ function VoiceDesignPresetPicker({ value, disabled, label, customLabel, customSu
1313
1636
  ]
1314
1637
  }), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1315
1638
  id: listboxId,
1316
- className: "xmimo-tts-voice-picker-menu",
1639
+ className: "xmimo-tts-voice-picker-menu xmimo-tts-builtin-voice-menu",
1317
1640
  role: "listbox",
1318
1641
  "aria-label": label,
1319
1642
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
@@ -1323,17 +1646,21 @@ function VoiceDesignPresetPicker({ value, disabled, label, customLabel, customSu
1323
1646
  type: "button",
1324
1647
  role: "option",
1325
1648
  "aria-selected": selectedPreset === void 0,
1326
- 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",
1327
1650
  onClick: () => {
1328
1651
  choose(CUSTOM_VOICE_DESIGN_OPTION);
1329
1652
  },
1330
1653
  onKeyDown: (event) => {
1331
1654
  handleOptionKeyDown(event, 0);
1332
1655
  },
1333
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomVoiceAvatar, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1334
- className: "xmimo-tts-voice-option-copy",
1335
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: customLabel }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: customSummary })]
1336
- })]
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
+ ]
1337
1664
  }), TTS_VOICE_DESIGN_PRESETS.map((preset, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1338
1665
  ref: (node) => {
1339
1666
  optionRefs.current[index + 1] = node;
@@ -1341,17 +1668,21 @@ function VoiceDesignPresetPicker({ value, disabled, label, customLabel, customSu
1341
1668
  type: "button",
1342
1669
  role: "option",
1343
1670
  "aria-selected": selectedPreset?.id === preset.id,
1344
- 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",
1345
1672
  onClick: () => {
1346
1673
  choose(preset.prompt);
1347
1674
  },
1348
1675
  onKeyDown: (event) => {
1349
1676
  handleOptionKeyDown(event, index + 1);
1350
1677
  },
1351
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoicePresetAvatar, { preset }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1352
- className: "xmimo-tts-voice-option-copy",
1353
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: preset.label }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: preset.summary })]
1354
- })]
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
+ ]
1355
1686
  }, preset.id))]
1356
1687
  }) : null]
1357
1688
  });
@@ -1413,9 +1744,9 @@ function SettingsCard({ scope, t }) {
1413
1744
  const [autoPlay, setAutoPlay] = (0, react.useState)(initial.autoPlay);
1414
1745
  const [model, setModel] = (0, react.useState)(initial.model);
1415
1746
  const [voice, setVoice] = (0, react.useState)(initial.voice);
1747
+ const [format, setFormat] = (0, react.useState)(initial.format);
1416
1748
  const [voiceDesignPrompt, setVoiceDesignPrompt] = (0, react.useState)(initial.voiceDesignPrompt);
1417
1749
  const [voiceDesignCustomPrompt, setVoiceDesignCustomPrompt] = (0, react.useState)(initial.voiceDesignCustomPrompt);
1418
- const [format, setFormat] = (0, react.useState)(initial.format);
1419
1750
  const [changes, setChanges] = (0, react.useState)({});
1420
1751
  const [state, setState] = (0, react.useState)("idle");
1421
1752
  const [uninstallState, setUninstallState] = (0, react.useState)("idle");
@@ -1498,9 +1829,9 @@ function SettingsCard({ scope, t }) {
1498
1829
  setAutoPlay(next.autoPlay);
1499
1830
  setModel(next.model);
1500
1831
  setVoice(next.voice);
1832
+ setFormat(next.format);
1501
1833
  setVoiceDesignPrompt(next.voiceDesignPrompt);
1502
1834
  setVoiceDesignCustomPrompt(next.voiceDesignCustomPrompt);
1503
- setFormat(next.format);
1504
1835
  setChanges({});
1505
1836
  }, [dirty, value]);
1506
1837
  if (snapshot.status === "unavailable") return null;
@@ -1517,9 +1848,9 @@ function SettingsCard({ scope, t }) {
1517
1848
  if (field === "autoPlay") setAutoPlay(base.autoPlay);
1518
1849
  if (field === "model") setModel(base.model);
1519
1850
  if (field === "voice") setVoice(base.voice);
1851
+ if (field === "format") setFormat(base.format);
1520
1852
  if (field === "voiceDesignPrompt") setVoiceDesignPrompt(base.voiceDesignPrompt);
1521
1853
  if (field === "voiceDesignCustomPrompt") setVoiceDesignCustomPrompt(base.voiceDesignCustomPrompt);
1522
- if (field === "format") setFormat(base.format);
1523
1854
  };
1524
1855
  const discard = () => {
1525
1856
  const next = resolveTtsSettings(scope.getSnapshot().value);
@@ -1527,9 +1858,9 @@ function SettingsCard({ scope, t }) {
1527
1858
  setAutoPlay(next.autoPlay);
1528
1859
  setModel(next.model);
1529
1860
  setVoice(next.voice);
1861
+ setFormat(next.format);
1530
1862
  setVoiceDesignPrompt(next.voiceDesignPrompt);
1531
1863
  setVoiceDesignCustomPrompt(next.voiceDesignCustomPrompt);
1532
- setFormat(next.format);
1533
1864
  setApiKey("");
1534
1865
  setChanges({});
1535
1866
  setState("idle");
@@ -1583,16 +1914,9 @@ function SettingsCard({ scope, t }) {
1583
1914
  children: [
1584
1915
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1585
1916
  className: "xmimo-tts-card-head-text",
1586
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1917
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1587
1918
  className: "xmimo-tts-card-title",
1588
- children: [
1589
- t("settings.title"),
1590
- " ",
1591
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("small", {
1592
- className: "xmimo-tts-version",
1593
- children: ["v", TTS_VERSION]
1594
- })
1595
- ]
1919
+ children: t("settings.title")
1596
1920
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1597
1921
  className: "xmimo-tts-card-description",
1598
1922
  children: t("settings.description")
@@ -1652,90 +1976,6 @@ function SettingsCard({ scope, t }) {
1652
1976
  })
1653
1977
  ]
1654
1978
  }),
1655
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1656
- className: "xmimo-tts-switch-row xmimo-tts-wide",
1657
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1658
- className: "xmimo-tts-checkbox-row",
1659
- children: [
1660
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1661
- className: "xmimo-tts-switch-copy",
1662
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
1663
- label: t("settings.enabled"),
1664
- overriddenLabel: t("settings.overridden"),
1665
- resetLabel: t("settings.reset"),
1666
- overridden: false,
1667
- resettable: false,
1668
- disabled: !snapshot.writable,
1669
- onReset: () => {
1670
- resetField("enabled");
1671
- }
1672
- })
1673
- }),
1674
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1675
- type: "checkbox",
1676
- checked: enabled,
1677
- disabled: !snapshot.writable,
1678
- onChange: (event) => {
1679
- const next = event.target.checked;
1680
- setEnabled(next);
1681
- if (!next) {
1682
- setAutoPlay(false);
1683
- setChanges((current) => ({
1684
- ...current,
1685
- enabled: { kind: "set" },
1686
- autoPlay: { kind: "set" }
1687
- }));
1688
- } else markChange("enabled");
1689
- setState("idle");
1690
- }
1691
- }),
1692
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1693
- className: "xmimo-tts-switch-control",
1694
- "aria-hidden": "true"
1695
- })
1696
- ]
1697
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1698
- className: "xmimo-tts-checkbox-row",
1699
- children: [
1700
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1701
- className: "xmimo-tts-switch-copy",
1702
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
1703
- label: t("settings.autoPlay"),
1704
- overriddenLabel: t("settings.overridden"),
1705
- resetLabel: t("settings.reset"),
1706
- overridden: false,
1707
- resettable: false,
1708
- disabled: !snapshot.writable,
1709
- onReset: () => {
1710
- resetField("autoPlay");
1711
- }
1712
- })
1713
- }),
1714
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1715
- type: "checkbox",
1716
- checked: enabled && autoPlay,
1717
- disabled: !snapshot.writable,
1718
- onChange: (event) => {
1719
- const next = event.target.checked;
1720
- setAutoPlay(next);
1721
- if (next) {
1722
- setEnabled(true);
1723
- setChanges((current) => ({
1724
- ...current,
1725
- autoPlay: { kind: "set" },
1726
- enabled: { kind: "set" }
1727
- }));
1728
- } else markChange("autoPlay");
1729
- setState("idle");
1730
- }
1731
- }),
1732
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1733
- className: "xmimo-tts-switch-control",
1734
- "aria-hidden": "true"
1735
- })
1736
- ]
1737
- })]
1738
- }),
1739
1979
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1740
1980
  className: "xmimo-tts-model xmimo-tts-wide",
1741
1981
  children: [
@@ -1813,55 +2053,147 @@ function SettingsCard({ scope, t }) {
1813
2053
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: t("settings.voiceDesignPromptHint") })
1814
2054
  ]
1815
2055
  }) : null,
1816
- model === "mimo-v2.5-tts" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1817
- className: "xmimo-tts-select-column xmimo-tts-wide",
1818
- 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, {
1819
2059
  label: t("settings.voice"),
1820
2060
  overriddenLabel: t("settings.overridden"),
1821
2061
  resetLabel: t("settings.reset"),
1822
- overridden: false,
1823
- resettable: false,
2062
+ overridden: fieldOverridden("voice"),
2063
+ resettable: true,
1824
2064
  disabled: !snapshot.writable,
1825
2065
  onReset: () => {
1826
2066
  resetField("voice");
1827
2067
  }
1828
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
2068
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BuiltInVoicePicker, {
1829
2069
  value: voice,
1830
2070
  disabled: !snapshot.writable,
1831
- onChange: (event) => {
1832
- setVoice(event.target.value);
2071
+ label: t("settings.voice"),
2072
+ onChange: (next) => {
2073
+ setVoice(next);
1833
2074
  markChange("voice");
1834
- },
1835
- children: TTS_VOICES.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1836
- value: item,
1837
- children: item
1838
- }, item))
1839
- })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
1840
- label: t("settings.format"),
1841
- overriddenLabel: t("settings.overridden"),
1842
- resetLabel: t("settings.reset"),
1843
- overridden: false,
1844
- resettable: false,
1845
- disabled: !snapshot.writable,
1846
- onReset: () => {
1847
- resetField("format");
1848
2075
  }
1849
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
1850
- value: format,
1851
- disabled: !snapshot.writable,
1852
- onChange: (event) => {
1853
- setFormat(event.target.value);
1854
- markChange("format");
1855
- },
1856
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1857
- value: "mp3",
1858
- children: "MP3"
1859
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1860
- value: "wav",
1861
- children: "WAV"
1862
- })]
1863
- })] })]
1864
- }) : 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
+ })
1865
2197
  ]
1866
2198
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1867
2199
  className: "xmimo-tts-card-actions",
@@ -1954,11 +2286,14 @@ const CLIENT_STYLES = `
1954
2286
  .xmimo-tts-inline-error{max-width:220px;color:var(--dsw-alias-state-error-primary,#dc2626);font-size:12px}
1955
2287
  .xmimo-tts-api-key-warning{color:var(--dsw-alias-state-error-primary,#dc2626)!important}
1956
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}
1957
- .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}
1958
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)}
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}
1959
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}
1960
- @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}}
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}}
1961
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}
1962
2297
  `;
1963
2298
 
1964
2299
  //#endregion