@corti/dictation-web 0.6.1-rc.1 → 0.7.0-ambient

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 (85) hide show
  1. package/dist/bundle.js +1834 -1457
  2. package/dist/components/ambient-recording-button.d.ts +16 -0
  3. package/dist/components/ambient-recording-button.js +68 -0
  4. package/dist/components/ambient-recording-button.js.map +1 -0
  5. package/dist/components/corti-ambient.d.ts +27 -0
  6. package/dist/components/corti-ambient.js +97 -0
  7. package/dist/components/corti-ambient.js.map +1 -0
  8. package/dist/components/corti-dictation.d.ts +9 -109
  9. package/dist/components/corti-dictation.js +12 -187
  10. package/dist/components/corti-dictation.js.map +1 -1
  11. package/dist/components/corti-root.d.ts +121 -0
  12. package/dist/components/corti-root.js +196 -0
  13. package/dist/components/corti-root.js.map +1 -0
  14. package/dist/components/device-selector.js +1 -1
  15. package/dist/components/device-selector.js.map +1 -1
  16. package/dist/components/dictation-recording-button.d.ts +13 -0
  17. package/dist/components/dictation-recording-button.js +30 -0
  18. package/dist/components/dictation-recording-button.js.map +1 -0
  19. package/dist/components/keybinding-input.js +1 -1
  20. package/dist/components/keybinding-input.js.map +1 -1
  21. package/dist/components/keybinding-selector.js +1 -1
  22. package/dist/components/keybinding-selector.js.map +1 -1
  23. package/dist/components/language-selector.js +2 -1
  24. package/dist/components/language-selector.js.map +1 -1
  25. package/dist/components/{recording-button.d.ts → recording-button-base.d.ts} +7 -9
  26. package/dist/components/recording-button-base.js +321 -0
  27. package/dist/components/recording-button-base.js.map +1 -0
  28. package/dist/components/settings-menu.js +1 -1
  29. package/dist/components/settings-menu.js.map +1 -1
  30. package/dist/constants.d.ts +1 -0
  31. package/dist/constants.js +9 -0
  32. package/dist/constants.js.map +1 -1
  33. package/dist/contexts/ambient-context.d.ts +18 -0
  34. package/dist/contexts/ambient-context.js +48 -0
  35. package/dist/contexts/ambient-context.js.map +1 -0
  36. package/dist/contexts/dictation-context.d.ts +3 -92
  37. package/dist/contexts/dictation-context.js +5 -257
  38. package/dist/contexts/dictation-context.js.map +1 -1
  39. package/dist/contexts/mixins/auth-context.d.ts +32 -0
  40. package/dist/contexts/mixins/auth-context.js +116 -0
  41. package/dist/contexts/mixins/auth-context.js.map +1 -0
  42. package/dist/contexts/mixins/devices-context.d.ts +14 -0
  43. package/dist/contexts/mixins/devices-context.js +58 -0
  44. package/dist/contexts/mixins/devices-context.js.map +1 -0
  45. package/dist/contexts/mixins/keybindings-context.d.ts +13 -0
  46. package/dist/contexts/mixins/keybindings-context.js +62 -0
  47. package/dist/contexts/mixins/keybindings-context.js.map +1 -0
  48. package/dist/contexts/mixins/languages-context.d.ts +11 -0
  49. package/dist/contexts/mixins/languages-context.js +54 -0
  50. package/dist/contexts/mixins/languages-context.js.map +1 -0
  51. package/dist/contexts/mixins/proxy-context.d.ts +14 -0
  52. package/dist/contexts/mixins/proxy-context.js +24 -0
  53. package/dist/contexts/mixins/proxy-context.js.map +1 -0
  54. package/dist/contexts/mixins/recording-state-context.d.ts +13 -0
  55. package/dist/contexts/mixins/recording-state-context.js +30 -0
  56. package/dist/contexts/mixins/recording-state-context.js.map +1 -0
  57. package/dist/contexts/mixins/types.d.ts +5 -0
  58. package/dist/contexts/mixins/types.js +2 -0
  59. package/dist/contexts/mixins/types.js.map +1 -0
  60. package/dist/contexts/root-context.d.ts +8 -0
  61. package/dist/contexts/root-context.js +34 -0
  62. package/dist/contexts/root-context.js.map +1 -0
  63. package/dist/controllers/ambient-controller.d.ts +16 -0
  64. package/dist/controllers/ambient-controller.js +24 -0
  65. package/dist/controllers/ambient-controller.js.map +1 -0
  66. package/dist/controllers/dictation-controller.d.ts +8 -31
  67. package/dist/controllers/dictation-controller.js +17 -283
  68. package/dist/controllers/dictation-controller.js.map +1 -1
  69. package/dist/controllers/languages-controller.js +0 -4
  70. package/dist/controllers/languages-controller.js.map +1 -1
  71. package/dist/controllers/socket-controller.d.ts +51 -0
  72. package/dist/controllers/socket-controller.js +281 -0
  73. package/dist/controllers/socket-controller.js.map +1 -0
  74. package/dist/index.d.ts +5 -2
  75. package/dist/index.js +12 -2
  76. package/dist/index.js.map +1 -1
  77. package/dist/tsconfig.tsbuildinfo +1 -1
  78. package/dist/types.d.ts +3 -0
  79. package/dist/types.js.map +1 -1
  80. package/dist/utils/events.d.ts +5 -3
  81. package/dist/utils/events.js +7 -0
  82. package/dist/utils/events.js.map +1 -1
  83. package/package.json +1 -1
  84. package/dist/components/recording-button.js +0 -331
  85. package/dist/components/recording-button.js.map +0 -1
package/dist/bundle.js CHANGED
@@ -46,20 +46,169 @@ var require_browser = __commonJS({
46
46
  }
47
47
  });
48
48
 
49
+ // node_modules/@lit/context/lib/context-request-event.js
50
+ var s = class extends Event {
51
+ constructor(s8, t7, e10, o10) {
52
+ super("context-request", { bubbles: true, composed: true }), this.context = s8, this.contextTarget = t7, this.callback = e10, this.subscribe = o10 ?? false;
53
+ }
54
+ };
55
+
56
+ // node_modules/@lit/context/lib/create-context.js
57
+ function n(n8) {
58
+ return n8;
59
+ }
60
+
61
+ // node_modules/@lit/context/lib/controllers/context-consumer.js
62
+ var s2 = class {
63
+ constructor(t7, s8, i7, h5) {
64
+ if (this.subscribe = false, this.provided = false, this.value = void 0, this.t = (t8, s9) => {
65
+ this.unsubscribe && (this.unsubscribe !== s9 && (this.provided = false, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = t8, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = true, this.callback && this.callback(t8, s9)), this.unsubscribe = s9;
66
+ }, this.host = t7, void 0 !== s8.context) {
67
+ const t8 = s8;
68
+ this.context = t8.context, this.callback = t8.callback, this.subscribe = t8.subscribe ?? false;
69
+ } else this.context = s8, this.callback = i7, this.subscribe = h5 ?? false;
70
+ this.host.addController(this);
71
+ }
72
+ hostConnected() {
73
+ this.dispatchRequest();
74
+ }
75
+ hostDisconnected() {
76
+ this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0);
77
+ }
78
+ dispatchRequest() {
79
+ this.host.dispatchEvent(new s(this.context, this.host, this.t, this.subscribe));
80
+ }
81
+ };
82
+
83
+ // node_modules/@lit/context/lib/value-notifier.js
84
+ var s3 = class {
85
+ get value() {
86
+ return this.o;
87
+ }
88
+ set value(s8) {
89
+ this.setValue(s8);
90
+ }
91
+ setValue(s8, t7 = false) {
92
+ const i7 = t7 || !Object.is(s8, this.o);
93
+ this.o = s8, i7 && this.updateObservers();
94
+ }
95
+ constructor(s8) {
96
+ this.subscriptions = /* @__PURE__ */ new Map(), this.updateObservers = () => {
97
+ for (const [s9, { disposer: t7 }] of this.subscriptions) s9(this.o, t7);
98
+ }, void 0 !== s8 && (this.value = s8);
99
+ }
100
+ addCallback(s8, t7, i7) {
101
+ if (!i7) return void s8(this.value);
102
+ this.subscriptions.has(s8) || this.subscriptions.set(s8, { disposer: () => {
103
+ this.subscriptions.delete(s8);
104
+ }, consumerHost: t7 });
105
+ const { disposer: h5 } = this.subscriptions.get(s8);
106
+ s8(this.value, h5);
107
+ }
108
+ clearCallbacks() {
109
+ this.subscriptions.clear();
110
+ }
111
+ };
112
+
113
+ // node_modules/@lit/context/lib/controllers/context-provider.js
114
+ var e = class extends Event {
115
+ constructor(t7, s8) {
116
+ super("context-provider", { bubbles: true, composed: true }), this.context = t7, this.contextTarget = s8;
117
+ }
118
+ };
119
+ var i = class extends s3 {
120
+ constructor(s8, e10, i7) {
121
+ super(void 0 !== e10.context ? e10.initialValue : i7), this.onContextRequest = (t7) => {
122
+ if (t7.context !== this.context) return;
123
+ const s9 = t7.contextTarget ?? t7.composedPath()[0];
124
+ s9 !== this.host && (t7.stopPropagation(), this.addCallback(t7.callback, s9, t7.subscribe));
125
+ }, this.onProviderRequest = (s9) => {
126
+ if (s9.context !== this.context) return;
127
+ if ((s9.contextTarget ?? s9.composedPath()[0]) === this.host) return;
128
+ const e11 = /* @__PURE__ */ new Set();
129
+ for (const [s10, { consumerHost: i8 }] of this.subscriptions) e11.has(s10) || (e11.add(s10), i8.dispatchEvent(new s(this.context, i8, s10, true)));
130
+ s9.stopPropagation();
131
+ }, this.host = s8, void 0 !== e10.context ? this.context = e10.context : this.context = e10, this.attachListeners(), this.host.addController?.(this);
132
+ }
133
+ attachListeners() {
134
+ this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
135
+ }
136
+ hostConnected() {
137
+ this.host.dispatchEvent(new e(this.context, this.host));
138
+ }
139
+ };
140
+
141
+ // node_modules/@lit/context/lib/decorators/provide.js
142
+ function e2({ context: e10 }) {
143
+ return (n8, i7) => {
144
+ const r7 = /* @__PURE__ */ new WeakMap();
145
+ if ("object" == typeof i7) return { get() {
146
+ return n8.get.call(this);
147
+ }, set(t7) {
148
+ return r7.get(this).setValue(t7), n8.set.call(this, t7);
149
+ }, init(n9) {
150
+ return r7.set(this, new i(this, { context: e10, initialValue: n9 })), n9;
151
+ } };
152
+ {
153
+ n8.constructor.addInitializer((n9) => {
154
+ r7.set(n9, new i(n9, { context: e10 }));
155
+ });
156
+ const o10 = Object.getOwnPropertyDescriptor(n8, i7);
157
+ let s8;
158
+ if (void 0 === o10) {
159
+ const t7 = /* @__PURE__ */ new WeakMap();
160
+ s8 = { get() {
161
+ return t7.get(this);
162
+ }, set(e11) {
163
+ r7.get(this).setValue(e11), t7.set(this, e11);
164
+ }, configurable: true, enumerable: true };
165
+ } else {
166
+ const t7 = o10.set;
167
+ s8 = { ...o10, set(e11) {
168
+ r7.get(this).setValue(e11), t7?.call(this, e11);
169
+ } };
170
+ }
171
+ return void Object.defineProperty(n8, i7, s8);
172
+ }
173
+ };
174
+ }
175
+
176
+ // node_modules/@lit/context/lib/decorators/consume.js
177
+ function c({ context: c6, subscribe: e10 }) {
178
+ return (o10, n8) => {
179
+ "object" == typeof n8 ? n8.addInitializer(function() {
180
+ new s2(this, { context: c6, callback: (t7) => {
181
+ o10.set.call(this, t7);
182
+ }, subscribe: e10 });
183
+ }) : o10.constructor.addInitializer((o11) => {
184
+ new s2(o11, { context: c6, callback: (t7) => {
185
+ o11[n8] = t7;
186
+ }, subscribe: e10 });
187
+ });
188
+ };
189
+ }
190
+
191
+ // node_modules/@lit/reactive-element/decorators/custom-element.js
192
+ var t2 = (t7) => (e10, o10) => {
193
+ void 0 !== o10 ? o10.addInitializer(() => {
194
+ customElements.define(t7, e10);
195
+ }) : customElements.define(t7, e10);
196
+ };
197
+
49
198
  // node_modules/@lit/reactive-element/css-tag.js
50
- var t = globalThis;
51
- var e = t.ShadowRoot && (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
52
- var s = Symbol();
199
+ var t3 = globalThis;
200
+ var e3 = t3.ShadowRoot && (void 0 === t3.ShadyCSS || t3.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
201
+ var s4 = Symbol();
53
202
  var o = /* @__PURE__ */ new WeakMap();
54
- var n = class {
203
+ var n2 = class {
55
204
  constructor(t7, e10, o10) {
56
- if (this._$cssResult$ = true, o10 !== s) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
205
+ if (this._$cssResult$ = true, o10 !== s4) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
57
206
  this.cssText = t7, this.t = e10;
58
207
  }
59
208
  get styleSheet() {
60
209
  let t7 = this.o;
61
210
  const s8 = this.t;
62
- if (e && void 0 === t7) {
211
+ if (e3 && void 0 === t7) {
63
212
  const e10 = void 0 !== s8 && 1 === s8.length;
64
213
  e10 && (t7 = o.get(s8)), void 0 === t7 && ((this.o = t7 = new CSSStyleSheet()).replaceSync(this.cssText), e10 && o.set(s8, t7));
65
214
  }
@@ -69,33 +218,33 @@ var n = class {
69
218
  return this.cssText;
70
219
  }
71
220
  };
72
- var r = (t7) => new n("string" == typeof t7 ? t7 : t7 + "", void 0, s);
73
- var i = (t7, ...e10) => {
221
+ var r = (t7) => new n2("string" == typeof t7 ? t7 : t7 + "", void 0, s4);
222
+ var i2 = (t7, ...e10) => {
74
223
  const o10 = 1 === t7.length ? t7[0] : e10.reduce((e11, s8, o11) => e11 + ((t8) => {
75
224
  if (true === t8._$cssResult$) return t8.cssText;
76
225
  if ("number" == typeof t8) return t8;
77
226
  throw Error("Value passed to 'css' function must be a 'css' function result: " + t8 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
78
227
  })(s8) + t7[o11 + 1], t7[0]);
79
- return new n(o10, t7, s);
228
+ return new n2(o10, t7, s4);
80
229
  };
81
230
  var S = (s8, o10) => {
82
- if (e) s8.adoptedStyleSheets = o10.map((t7) => t7 instanceof CSSStyleSheet ? t7 : t7.styleSheet);
231
+ if (e3) s8.adoptedStyleSheets = o10.map((t7) => t7 instanceof CSSStyleSheet ? t7 : t7.styleSheet);
83
232
  else for (const e10 of o10) {
84
- const o11 = document.createElement("style"), n8 = t.litNonce;
233
+ const o11 = document.createElement("style"), n8 = t3.litNonce;
85
234
  void 0 !== n8 && o11.setAttribute("nonce", n8), o11.textContent = e10.cssText, s8.appendChild(o11);
86
235
  }
87
236
  };
88
- var c = e ? (t7) => t7 : (t7) => t7 instanceof CSSStyleSheet ? ((t8) => {
237
+ var c2 = e3 ? (t7) => t7 : (t7) => t7 instanceof CSSStyleSheet ? ((t8) => {
89
238
  let e10 = "";
90
239
  for (const s8 of t8.cssRules) e10 += s8.cssText;
91
240
  return r(e10);
92
241
  })(t7) : t7;
93
242
 
94
243
  // node_modules/@lit/reactive-element/reactive-element.js
95
- var { is: i2, defineProperty: e2, getOwnPropertyDescriptor: h, getOwnPropertyNames: r2, getOwnPropertySymbols: o2, getPrototypeOf: n2 } = Object;
244
+ var { is: i3, defineProperty: e4, getOwnPropertyDescriptor: h, getOwnPropertyNames: r2, getOwnPropertySymbols: o2, getPrototypeOf: n3 } = Object;
96
245
  var a = globalThis;
97
- var c2 = a.trustedTypes;
98
- var l = c2 ? c2.emptyScript : "";
246
+ var c3 = a.trustedTypes;
247
+ var l = c3 ? c3.emptyScript : "";
99
248
  var p = a.reactiveElementPolyfillSupport;
100
249
  var d = (t7, s8) => t7;
101
250
  var u = { toAttribute(t7, s8) {
@@ -127,7 +276,7 @@ var u = { toAttribute(t7, s8) {
127
276
  }
128
277
  return i7;
129
278
  } };
130
- var f = (t7, s8) => !i2(t7, s8);
279
+ var f = (t7, s8) => !i3(t7, s8);
131
280
  var b = { attribute: true, type: String, converter: u, reflect: false, useDefault: false, hasChanged: f };
132
281
  Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
133
282
  var y = class extends HTMLElement {
@@ -140,7 +289,7 @@ var y = class extends HTMLElement {
140
289
  static createProperty(t7, s8 = b) {
141
290
  if (s8.state && (s8.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t7) && ((s8 = Object.create(s8)).wrapped = true), this.elementProperties.set(t7, s8), !s8.noAccessor) {
142
291
  const i7 = Symbol(), h5 = this.getPropertyDescriptor(t7, i7, s8);
143
- void 0 !== h5 && e2(this.prototype, t7, h5);
292
+ void 0 !== h5 && e4(this.prototype, t7, h5);
144
293
  }
145
294
  }
146
295
  static getPropertyDescriptor(t7, s8, i7) {
@@ -159,7 +308,7 @@ var y = class extends HTMLElement {
159
308
  }
160
309
  static _$Ei() {
161
310
  if (this.hasOwnProperty(d("elementProperties"))) return;
162
- const t7 = n2(this);
311
+ const t7 = n3(this);
163
312
  t7.finalize(), void 0 !== t7.l && (this.l = [...t7.l]), this.elementProperties = new Map(t7.elementProperties);
164
313
  }
165
314
  static finalize() {
@@ -184,8 +333,8 @@ var y = class extends HTMLElement {
184
333
  const i7 = [];
185
334
  if (Array.isArray(s8)) {
186
335
  const e10 = new Set(s8.flat(1 / 0).reverse());
187
- for (const s9 of e10) i7.unshift(c(s9));
188
- } else void 0 !== s8 && i7.push(c(s8));
336
+ for (const s9 of e10) i7.unshift(c2(s9));
337
+ } else void 0 !== s8 && i7.push(c2(s8));
189
338
  return i7;
190
339
  }
191
340
  static _$Eu(t7, s8) {
@@ -313,17 +462,100 @@ var y = class extends HTMLElement {
313
462
  };
314
463
  y.elementStyles = [], y.shadowRootOptions = { mode: "open" }, y[d("elementProperties")] = /* @__PURE__ */ new Map(), y[d("finalized")] = /* @__PURE__ */ new Map(), p?.({ ReactiveElement: y }), (a.reactiveElementVersions ??= []).push("2.1.1");
315
464
 
465
+ // node_modules/@lit/reactive-element/decorators/property.js
466
+ var o3 = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
467
+ var r3 = (t7 = o3, e10, r7) => {
468
+ const { kind: n8, metadata: i7 } = r7;
469
+ let s8 = globalThis.litPropertyMetadata.get(i7);
470
+ if (void 0 === s8 && globalThis.litPropertyMetadata.set(i7, s8 = /* @__PURE__ */ new Map()), "setter" === n8 && ((t7 = Object.create(t7)).wrapped = true), s8.set(r7.name, t7), "accessor" === n8) {
471
+ const { name: o10 } = r7;
472
+ return { set(r8) {
473
+ const n9 = e10.get.call(this);
474
+ e10.set.call(this, r8), this.requestUpdate(o10, n9, t7);
475
+ }, init(e11) {
476
+ return void 0 !== e11 && this.C(o10, void 0, t7, e11), e11;
477
+ } };
478
+ }
479
+ if ("setter" === n8) {
480
+ const { name: o10 } = r7;
481
+ return function(r8) {
482
+ const n9 = this[o10];
483
+ e10.call(this, r8), this.requestUpdate(o10, n9, t7);
484
+ };
485
+ }
486
+ throw Error("Unsupported decorator location: " + n8);
487
+ };
488
+ function n4(t7) {
489
+ return (e10, o10) => "object" == typeof o10 ? r3(t7, e10, o10) : ((t8, e11, o11) => {
490
+ const r7 = e11.hasOwnProperty(o11);
491
+ return e11.constructor.createProperty(o11, t8), r7 ? Object.getOwnPropertyDescriptor(e11, o11) : void 0;
492
+ })(t7, e10, o10);
493
+ }
494
+
495
+ // node_modules/@lit/reactive-element/decorators/state.js
496
+ function r4(r7) {
497
+ return n4({ ...r7, state: true, attribute: false });
498
+ }
499
+
500
+ // dist/constants.js
501
+ var LANGUAGES_SUPPORTED_EU = [
502
+ "da",
503
+ "de",
504
+ "de-CH",
505
+ "en",
506
+ "en-GB",
507
+ "es",
508
+ "fr",
509
+ "hu",
510
+ "it",
511
+ "nl",
512
+ "no",
513
+ "pt",
514
+ "sv",
515
+ "gsw-CH"
516
+ ].sort();
517
+ var LANGUAGES_SUPPORTED_US = [
518
+ "da",
519
+ "de",
520
+ "de-CH",
521
+ "en",
522
+ "en-GB",
523
+ "es",
524
+ "fr",
525
+ "hu",
526
+ "it",
527
+ "nl",
528
+ "no",
529
+ "pt",
530
+ "sv"
531
+ ].sort();
532
+ var DEFAULT_DICTATION_CONFIG = {
533
+ automaticPunctuation: false,
534
+ primaryLanguage: "en",
535
+ spokenPunctuation: true
536
+ };
537
+ var DEFAULT_STREAM_CONFIG = {
538
+ mode: { outputLocale: "en", type: "facts" },
539
+ transcription: {
540
+ isDiarization: true,
541
+ isMultichannel: false,
542
+ participants: [],
543
+ primaryLanguage: "en"
544
+ }
545
+ };
546
+ var AUDIO_CHUNK_INTERVAL_MS = 250;
547
+
316
548
  // node_modules/lit-html/lit-html.js
317
- var t2 = globalThis;
318
- var i3 = t2.trustedTypes;
319
- var s2 = i3 ? i3.createPolicy("lit-html", { createHTML: (t7) => t7 }) : void 0;
320
- var e3 = "$lit$";
549
+ var t4 = globalThis;
550
+ var i4 = t4.trustedTypes;
551
+ var s5 = i4 ? i4.createPolicy("lit-html", { createHTML: (t7) => t7 }) : void 0;
552
+ var e6 = "$lit$";
321
553
  var h2 = `lit$${Math.random().toFixed(9).slice(2)}$`;
322
- var o3 = "?" + h2;
323
- var n3 = `<${o3}>`;
324
- var r3 = document;
325
- var l2 = () => r3.createComment("");
326
- var c3 = (t7) => null === t7 || "object" != typeof t7 && "function" != typeof t7;
554
+ var o4 = "?" + h2;
555
+ var n5 = `<${o4}>`;
556
+ var r5 = document;
557
+ var l2 = () => r5.createComment("");
558
+ var c4 = (t7) => null === t7 || "object" != typeof t7 && "function" != typeof t7;
327
559
  var a2 = Array.isArray;
328
560
  var u2 = (t7) => a2(t7) || "function" == typeof t7?.[Symbol.iterator];
329
561
  var d2 = "[ \n\f\r]";
@@ -342,10 +574,10 @@ var w = y2(3);
342
574
  var T = Symbol.for("lit-noChange");
343
575
  var E = Symbol.for("lit-nothing");
344
576
  var A = /* @__PURE__ */ new WeakMap();
345
- var C = r3.createTreeWalker(r3, 129);
577
+ var C = r5.createTreeWalker(r5, 129);
346
578
  function P(t7, i7) {
347
579
  if (!a2(t7) || !t7.hasOwnProperty("raw")) throw Error("invalid template strings array");
348
- return void 0 !== s2 ? s2.createHTML(i7) : i7;
580
+ return void 0 !== s5 ? s5.createHTML(i7) : i7;
349
581
  }
350
582
  var V = (t7, i7) => {
351
583
  const s8 = t7.length - 1, o10 = [];
@@ -355,7 +587,7 @@ var V = (t7, i7) => {
355
587
  let a3, u3, d3 = -1, y3 = 0;
356
588
  for (; y3 < s9.length && (c6.lastIndex = y3, u3 = c6.exec(s9), null !== u3); ) y3 = c6.lastIndex, c6 === f2 ? "!--" === u3[1] ? c6 = v : void 0 !== u3[1] ? c6 = _ : void 0 !== u3[2] ? ($.test(u3[2]) && (r7 = RegExp("</" + u3[2], "g")), c6 = m) : void 0 !== u3[3] && (c6 = m) : c6 === m ? ">" === u3[0] ? (c6 = r7 ?? f2, d3 = -1) : void 0 === u3[1] ? d3 = -2 : (d3 = c6.lastIndex - u3[2].length, a3 = u3[1], c6 = void 0 === u3[3] ? m : '"' === u3[3] ? g : p2) : c6 === g || c6 === p2 ? c6 = m : c6 === v || c6 === _ ? c6 = f2 : (c6 = m, r7 = void 0);
357
589
  const x2 = c6 === m && t7[i8 + 1].startsWith("/>") ? " " : "";
358
- l3 += c6 === f2 ? s9 + n3 : d3 >= 0 ? (o10.push(a3), s9.slice(0, d3) + e3 + s9.slice(d3) + h2 + x2) : s9 + h2 + (-2 === d3 ? i8 : x2);
590
+ l3 += c6 === f2 ? s9 + n5 : d3 >= 0 ? (o10.push(a3), s9.slice(0, d3) + e6 + s9.slice(d3) + h2 + x2) : s9 + h2 + (-2 === d3 ? i8 : x2);
359
591
  }
360
592
  return [P(t7, l3 + (t7[s8] || "<?>") + (2 === i7 ? "</svg>" : 3 === i7 ? "</math>" : "")), o10];
361
593
  };
@@ -371,19 +603,19 @@ var N = class _N {
371
603
  }
372
604
  for (; null !== (r7 = C.nextNode()) && d3.length < u3; ) {
373
605
  if (1 === r7.nodeType) {
374
- if (r7.hasAttributes()) for (const t8 of r7.getAttributeNames()) if (t8.endsWith(e3)) {
606
+ if (r7.hasAttributes()) for (const t8 of r7.getAttributeNames()) if (t8.endsWith(e6)) {
375
607
  const i7 = v2[a3++], s9 = r7.getAttribute(t8).split(h2), e10 = /([.?@])?(.*)/.exec(i7);
376
608
  d3.push({ type: 1, index: c6, name: e10[2], strings: s9, ctor: "." === e10[1] ? H : "?" === e10[1] ? I : "@" === e10[1] ? L : k }), r7.removeAttribute(t8);
377
609
  } else t8.startsWith(h2) && (d3.push({ type: 6, index: c6 }), r7.removeAttribute(t8));
378
610
  if ($.test(r7.tagName)) {
379
611
  const t8 = r7.textContent.split(h2), s9 = t8.length - 1;
380
612
  if (s9 > 0) {
381
- r7.textContent = i3 ? i3.emptyScript : "";
613
+ r7.textContent = i4 ? i4.emptyScript : "";
382
614
  for (let i7 = 0; i7 < s9; i7++) r7.append(t8[i7], l2()), C.nextNode(), d3.push({ type: 2, index: ++c6 });
383
615
  r7.append(t8[s9], l2());
384
616
  }
385
617
  }
386
- } else if (8 === r7.nodeType) if (r7.data === o3) d3.push({ type: 2, index: c6 });
618
+ } else if (8 === r7.nodeType) if (r7.data === o4) d3.push({ type: 2, index: c6 });
387
619
  else {
388
620
  let t8 = -1;
389
621
  for (; -1 !== (t8 = r7.data.indexOf(h2, t8 + 1)); ) d3.push({ type: 7, index: c6 }), t8 += h2.length - 1;
@@ -392,14 +624,14 @@ var N = class _N {
392
624
  }
393
625
  }
394
626
  static createElement(t7, i7) {
395
- const s8 = r3.createElement("template");
627
+ const s8 = r5.createElement("template");
396
628
  return s8.innerHTML = t7, s8;
397
629
  }
398
630
  };
399
631
  function S2(t7, i7, s8 = t7, e10) {
400
632
  if (i7 === T) return i7;
401
633
  let h5 = void 0 !== e10 ? s8._$Co?.[e10] : s8._$Cl;
402
- const o10 = c3(i7) ? void 0 : i7._$litDirective$;
634
+ const o10 = c4(i7) ? void 0 : i7._$litDirective$;
403
635
  return h5?.constructor !== o10 && (h5?._$AO?.(false), void 0 === o10 ? h5 = void 0 : (h5 = new o10(t7), h5._$AT(t7, s8, e10)), void 0 !== e10 ? (s8._$Co ??= [])[e10] = h5 : s8._$Cl = h5), void 0 !== h5 && (i7 = S2(t7, h5._$AS(t7, i7.values), h5, e10)), i7;
404
636
  }
405
637
  var M = class {
@@ -413,7 +645,7 @@ var M = class {
413
645
  return this._$AM._$AU;
414
646
  }
415
647
  u(t7) {
416
- const { el: { content: i7 }, parts: s8 } = this._$AD, e10 = (t7?.creationScope ?? r3).importNode(i7, true);
648
+ const { el: { content: i7 }, parts: s8 } = this._$AD, e10 = (t7?.creationScope ?? r5).importNode(i7, true);
417
649
  C.currentNode = e10;
418
650
  let h5 = C.nextNode(), o10 = 0, n8 = 0, l3 = s8[0];
419
651
  for (; void 0 !== l3; ) {
@@ -423,7 +655,7 @@ var M = class {
423
655
  }
424
656
  o10 !== l3?.index && (h5 = C.nextNode(), o10++);
425
657
  }
426
- return C.currentNode = r3, e10;
658
+ return C.currentNode = r5, e10;
427
659
  }
428
660
  p(t7) {
429
661
  let i7 = 0;
@@ -449,7 +681,7 @@ var R = class _R {
449
681
  return this._$AB;
450
682
  }
451
683
  _$AI(t7, i7 = this) {
452
- t7 = S2(this, t7, i7), c3(t7) ? t7 === E || null == t7 || "" === t7 ? (this._$AH !== E && this._$AR(), this._$AH = E) : t7 !== this._$AH && t7 !== T && this._(t7) : void 0 !== t7._$litType$ ? this.$(t7) : void 0 !== t7.nodeType ? this.T(t7) : u2(t7) ? this.k(t7) : this._(t7);
684
+ t7 = S2(this, t7, i7), c4(t7) ? t7 === E || null == t7 || "" === t7 ? (this._$AH !== E && this._$AR(), this._$AH = E) : t7 !== this._$AH && t7 !== T && this._(t7) : void 0 !== t7._$litType$ ? this.$(t7) : void 0 !== t7.nodeType ? this.T(t7) : u2(t7) ? this.k(t7) : this._(t7);
453
685
  }
454
686
  O(t7) {
455
687
  return this._$AA.parentNode.insertBefore(t7, this._$AB);
@@ -458,7 +690,7 @@ var R = class _R {
458
690
  this._$AH !== t7 && (this._$AR(), this._$AH = this.O(t7));
459
691
  }
460
692
  _(t7) {
461
- this._$AH !== E && c3(this._$AH) ? this._$AA.nextSibling.data = t7 : this.T(r3.createTextNode(t7)), this._$AH = t7;
693
+ this._$AH !== E && c4(this._$AH) ? this._$AA.nextSibling.data = t7 : this.T(r5.createTextNode(t7)), this._$AH = t7;
462
694
  }
463
695
  $(t7) {
464
696
  const { values: i7, _$litType$: s8 } = t7, e10 = "number" == typeof s8 ? this._$AC(t7) : (void 0 === s8.el && (s8.el = N.createElement(P(s8.h, s8.h[0]), this.options)), s8);
@@ -502,11 +734,11 @@ var k = class {
502
734
  _$AI(t7, i7 = this, s8, e10) {
503
735
  const h5 = this.strings;
504
736
  let o10 = false;
505
- if (void 0 === h5) t7 = S2(this, t7, i7, 0), o10 = !c3(t7) || t7 !== this._$AH && t7 !== T, o10 && (this._$AH = t7);
737
+ if (void 0 === h5) t7 = S2(this, t7, i7, 0), o10 = !c4(t7) || t7 !== this._$AH && t7 !== T, o10 && (this._$AH = t7);
506
738
  else {
507
739
  const e11 = t7;
508
740
  let n8, r7;
509
- for (t7 = h5[0], n8 = 0; n8 < h5.length - 1; n8++) r7 = S2(this, e11[s8 + n8], i7, n8), r7 === T && (r7 = this._$AH[n8]), o10 ||= !c3(r7) || r7 !== this._$AH[n8], r7 === E ? t7 = E : t7 !== E && (t7 += (r7 ?? "") + h5[n8 + 1]), this._$AH[n8] = r7;
741
+ for (t7 = h5[0], n8 = 0; n8 < h5.length - 1; n8++) r7 = S2(this, e11[s8 + n8], i7, n8), r7 === T && (r7 = this._$AH[n8]), o10 ||= !c4(r7) || r7 !== this._$AH[n8], r7 === E ? t7 = E : t7 !== E && (t7 += (r7 ?? "") + h5[n8 + 1]), this._$AH[n8] = r7;
510
742
  }
511
743
  o10 && !e10 && this.j(t7);
512
744
  }
@@ -554,9 +786,9 @@ var z = class {
554
786
  S2(this, t7);
555
787
  }
556
788
  };
557
- var Z = { M: e3, P: h2, A: o3, C: 1, L: V, R: M, D: u2, V: S2, I: R, H: k, N: I, U: L, B: H, F: z };
558
- var j = t2.litHtmlPolyfillSupport;
559
- j?.(N, R), (t2.litHtmlVersions ??= []).push("3.3.1");
789
+ var Z = { M: e6, P: h2, A: o4, C: 1, L: V, R: M, D: u2, V: S2, I: R, H: k, N: I, U: L, B: H, F: z };
790
+ var j = t4.litHtmlPolyfillSupport;
791
+ j?.(N, R), (t4.litHtmlVersions ??= []).push("3.3.1");
560
792
  var B = (t7, i7, s8) => {
561
793
  const e10 = s8?.renderBefore ?? i7;
562
794
  let h5 = e10._$litPart$;
@@ -568,8 +800,8 @@ var B = (t7, i7, s8) => {
568
800
  };
569
801
 
570
802
  // node_modules/lit-element/lit-element.js
571
- var s3 = globalThis;
572
- var i4 = class extends y {
803
+ var s6 = globalThis;
804
+ var i5 = class extends y {
573
805
  constructor() {
574
806
  super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
575
807
  }
@@ -591,415 +823,57 @@ var i4 = class extends y {
591
823
  return T;
592
824
  }
593
825
  };
594
- i4._$litElement$ = true, i4["finalized"] = true, s3.litElementHydrateSupport?.({ LitElement: i4 });
595
- var o4 = s3.litElementPolyfillSupport;
596
- o4?.({ LitElement: i4 });
597
- (s3.litElementVersions ??= []).push("4.2.1");
826
+ i5._$litElement$ = true, i5["finalized"] = true, s6.litElementHydrateSupport?.({ LitElement: i5 });
827
+ var o5 = s6.litElementPolyfillSupport;
828
+ o5?.({ LitElement: i5 });
829
+ (s6.litElementVersions ??= []).push("4.2.1");
598
830
 
599
- // node_modules/@lit/reactive-element/decorators/custom-element.js
600
- var t3 = (t7) => (e10, o10) => {
601
- void 0 !== o10 ? o10.addInitializer(() => {
602
- customElements.define(t7, e10);
603
- }) : customElements.define(t7, e10);
604
- };
831
+ // dist/styles/component-styles.js
832
+ var ComponentStyles = i2`
833
+ :host {
834
+ font-family: var(--component-font-family, -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, Cantarell, Ubuntu, roboto, noto, helvetica, arial, sans-serif);
835
+ }
605
836
 
606
- // node_modules/@lit/reactive-element/decorators/property.js
607
- var o5 = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
608
- var r4 = (t7 = o5, e10, r7) => {
609
- const { kind: n8, metadata: i7 } = r7;
610
- let s8 = globalThis.litPropertyMetadata.get(i7);
611
- if (void 0 === s8 && globalThis.litPropertyMetadata.set(i7, s8 = /* @__PURE__ */ new Map()), "setter" === n8 && ((t7 = Object.create(t7)).wrapped = true), s8.set(r7.name, t7), "accessor" === n8) {
612
- const { name: o10 } = r7;
613
- return { set(r8) {
614
- const n9 = e10.get.call(this);
615
- e10.set.call(this, r8), this.requestUpdate(o10, n9, t7);
616
- }, init(e11) {
617
- return void 0 !== e11 && this.C(o10, void 0, t7, e11), e11;
618
- } };
837
+ .wrapper {
838
+ background-color: var(--card-background, light-dark(#fff, #333));
839
+ border: 1px solid var(--card-border-color, light-dark(#ddd, #555));
840
+ border-radius: var(--card-border-radius, 8px);
841
+ box-shadow: var(--card-box-shadow, 0 2px 5px rgba(0, 0, 0, 0.1));
842
+ padding: var(--card-padding, 4px);
843
+ display: flex;
844
+ gap: 4px;
845
+ height: 46px;
846
+ width: fit-content;
847
+ box-sizing: border-box;
848
+ overflow: hidden;
619
849
  }
620
- if ("setter" === n8) {
621
- const { name: o10 } = r7;
622
- return function(r8) {
623
- const n9 = this[o10];
624
- e10.call(this, r8), this.requestUpdate(o10, n9, t7);
625
- };
850
+ `;
851
+ var LabelStyles = i2`
852
+ label {
853
+ display: block;
854
+ font-size: 0.8rem;
855
+ padding-bottom: 0.5rem;
856
+ font-weight: 500;
857
+ color: var(--component-text-color, light-dark(#333, #eee));
858
+ pointer-events: none;
626
859
  }
627
- throw Error("Unsupported decorator location: " + n8);
628
- };
629
- function n4(t7) {
630
- return (e10, o10) => "object" == typeof o10 ? r4(t7, e10, o10) : ((t8, e11, o11) => {
631
- const r7 = e11.hasOwnProperty(o11);
632
- return e11.constructor.createProperty(o11, t8), r7 ? Object.getOwnPropertyDescriptor(e11, o11) : void 0;
633
- })(t7, e10, o10);
634
- }
635
-
636
- // node_modules/@lit/reactive-element/decorators/state.js
637
- function r5(r7) {
638
- return n4({ ...r7, state: true, attribute: false });
639
- }
640
-
641
- // node_modules/lit-html/directive.js
642
- var t4 = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 };
643
- var e5 = (t7) => (...e10) => ({ _$litDirective$: t7, values: e10 });
644
- var i5 = class {
645
- constructor(t7) {
646
- }
647
- get _$AU() {
648
- return this._$AM._$AU;
649
- }
650
- _$AT(t7, e10, i7) {
651
- this._$Ct = t7, this._$AM = e10, this._$Ci = i7;
652
- }
653
- _$AS(t7, e10) {
654
- return this.update(t7, e10);
655
- }
656
- update(t7, e10) {
657
- return this.render(...e10);
658
- }
659
- };
660
-
661
- // node_modules/lit-html/directives/class-map.js
662
- var e6 = e5(class extends i5 {
663
- constructor(t7) {
664
- if (super(t7), t7.type !== t4.ATTRIBUTE || "class" !== t7.name || t7.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
665
- }
666
- render(t7) {
667
- return " " + Object.keys(t7).filter((s8) => t7[s8]).join(" ") + " ";
668
- }
669
- update(s8, [i7]) {
670
- if (void 0 === this.st) {
671
- this.st = /* @__PURE__ */ new Set(), void 0 !== s8.strings && (this.nt = new Set(s8.strings.join(" ").split(/\s/).filter((t7) => "" !== t7)));
672
- for (const t7 in i7) i7[t7] && !this.nt?.has(t7) && this.st.add(t7);
673
- return this.render(i7);
674
- }
675
- const r7 = s8.element.classList;
676
- for (const t7 of this.st) t7 in i7 || (r7.remove(t7), this.st.delete(t7));
677
- for (const t7 in i7) {
678
- const s9 = !!i7[t7];
679
- s9 === this.st.has(t7) || this.nt?.has(t7) || (s9 ? (r7.add(t7), this.st.add(t7)) : (r7.remove(t7), this.st.delete(t7)));
680
- }
681
- return T;
682
- }
683
- });
684
-
685
- // node_modules/lit-html/directive-helpers.js
686
- var { I: t5 } = Z;
687
- var f3 = (o10) => void 0 === o10.strings;
688
-
689
- // node_modules/lit-html/async-directive.js
690
- var s4 = (i7, t7) => {
691
- const e10 = i7._$AN;
692
- if (void 0 === e10) return false;
693
- for (const i8 of e10) i8._$AO?.(t7, false), s4(i8, t7);
694
- return true;
695
- };
696
- var o6 = (i7) => {
697
- let t7, e10;
698
- do {
699
- if (void 0 === (t7 = i7._$AM)) break;
700
- e10 = t7._$AN, e10.delete(i7), i7 = t7;
701
- } while (0 === e10?.size);
702
- };
703
- var r6 = (i7) => {
704
- for (let t7; t7 = i7._$AM; i7 = t7) {
705
- let e10 = t7._$AN;
706
- if (void 0 === e10) t7._$AN = e10 = /* @__PURE__ */ new Set();
707
- else if (e10.has(i7)) break;
708
- e10.add(i7), c4(t7);
709
- }
710
- };
711
- function h3(i7) {
712
- void 0 !== this._$AN ? (o6(this), this._$AM = i7, r6(this)) : this._$AM = i7;
713
- }
714
- function n5(i7, t7 = false, e10 = 0) {
715
- const r7 = this._$AH, h5 = this._$AN;
716
- if (void 0 !== h5 && 0 !== h5.size) if (t7) if (Array.isArray(r7)) for (let i8 = e10; i8 < r7.length; i8++) s4(r7[i8], false), o6(r7[i8]);
717
- else null != r7 && (s4(r7, false), o6(r7));
718
- else s4(this, i7);
719
- }
720
- var c4 = (i7) => {
721
- i7.type == t4.CHILD && (i7._$AP ??= n5, i7._$AQ ??= h3);
722
- };
723
- var f4 = class extends i5 {
724
- constructor() {
725
- super(...arguments), this._$AN = void 0;
726
- }
727
- _$AT(i7, t7, e10) {
728
- super._$AT(i7, t7, e10), r6(this), this.isConnected = i7._$AU;
729
- }
730
- _$AO(i7, t7 = true) {
731
- i7 !== this.isConnected && (this.isConnected = i7, i7 ? this.reconnected?.() : this.disconnected?.()), t7 && (s4(this, i7), o6(this));
732
- }
733
- setValue(t7) {
734
- if (f3(this._$Ct)) this._$Ct._$AI(t7, this);
735
- else {
736
- const i7 = [...this._$Ct._$AH];
737
- i7[this._$Ci] = t7, this._$Ct._$AI(i7, this, 0);
738
- }
739
- }
740
- disconnected() {
741
- }
742
- reconnected() {
743
- }
744
- };
745
-
746
- // node_modules/lit-html/directives/ref.js
747
- var e7 = () => new h4();
748
- var h4 = class {
749
- };
750
- var o7 = /* @__PURE__ */ new WeakMap();
751
- var n6 = e5(class extends f4 {
752
- render(i7) {
753
- return E;
754
- }
755
- update(i7, [s8]) {
756
- const e10 = s8 !== this.G;
757
- return e10 && void 0 !== this.G && this.rt(void 0), (e10 || this.lt !== this.ct) && (this.G = s8, this.ht = i7.options?.host, this.rt(this.ct = i7.element)), E;
758
- }
759
- rt(t7) {
760
- if (this.isConnected || (t7 = void 0), "function" == typeof this.G) {
761
- const i7 = this.ht ?? globalThis;
762
- let s8 = o7.get(i7);
763
- void 0 === s8 && (s8 = /* @__PURE__ */ new WeakMap(), o7.set(i7, s8)), void 0 !== s8.get(this.G) && this.G.call(this.ht, void 0), s8.set(this.G, t7), void 0 !== t7 && this.G.call(this.ht, t7);
764
- } else this.G.value = t7;
765
- }
766
- get lt() {
767
- return "function" == typeof this.G ? o7.get(this.ht ?? globalThis)?.get(this.G) : this.G?.value;
768
- }
769
- disconnected() {
770
- this.lt === this.ct && this.rt(void 0);
771
- }
772
- reconnected() {
773
- this.rt(this.ct);
774
- }
775
- });
776
-
777
- // dist/constants.js
778
- var LANGUAGES_SUPPORTED_EU = [
779
- "da",
780
- "de",
781
- "de-CH",
782
- "en",
783
- "en-GB",
784
- "es",
785
- "fr",
786
- "hu",
787
- "it",
788
- "nl",
789
- "no",
790
- "pt",
791
- "sv",
792
- "gsw-CH"
793
- ].sort();
794
- var LANGUAGES_SUPPORTED_US = [
795
- "da",
796
- "de",
797
- "de-CH",
798
- "en",
799
- "en-GB",
800
- "es",
801
- "fr",
802
- "hu",
803
- "it",
804
- "nl",
805
- "no",
806
- "pt",
807
- "sv"
808
- ].sort();
809
- var DEFAULT_DICTATION_CONFIG = {
810
- automaticPunctuation: false,
811
- primaryLanguage: "en",
812
- spokenPunctuation: true
813
- };
814
- var AUDIO_CHUNK_INTERVAL_MS = 250;
815
-
816
- // dist/utils/converters.js
817
- var commaSeparatedConverter = {
818
- fromAttribute: (value) => value?.split(",").map((s8) => s8.trim()).filter(Boolean),
819
- toAttribute: (value) => value?.join(",")
820
- };
821
-
822
- // node_modules/@lit/context/lib/context-request-event.js
823
- var s5 = class extends Event {
824
- constructor(s8, t7, e10, o10) {
825
- super("context-request", { bubbles: true, composed: true }), this.context = s8, this.contextTarget = t7, this.callback = e10, this.subscribe = o10 ?? false;
826
- }
827
- };
828
-
829
- // node_modules/@lit/context/lib/create-context.js
830
- function n7(n8) {
831
- return n8;
832
- }
833
-
834
- // node_modules/@lit/context/lib/controllers/context-consumer.js
835
- var s6 = class {
836
- constructor(t7, s8, i7, h5) {
837
- if (this.subscribe = false, this.provided = false, this.value = void 0, this.t = (t8, s9) => {
838
- this.unsubscribe && (this.unsubscribe !== s9 && (this.provided = false, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = t8, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = true, this.callback && this.callback(t8, s9)), this.unsubscribe = s9;
839
- }, this.host = t7, void 0 !== s8.context) {
840
- const t8 = s8;
841
- this.context = t8.context, this.callback = t8.callback, this.subscribe = t8.subscribe ?? false;
842
- } else this.context = s8, this.callback = i7, this.subscribe = h5 ?? false;
843
- this.host.addController(this);
844
- }
845
- hostConnected() {
846
- this.dispatchRequest();
847
- }
848
- hostDisconnected() {
849
- this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0);
850
- }
851
- dispatchRequest() {
852
- this.host.dispatchEvent(new s5(this.context, this.host, this.t, this.subscribe));
853
- }
854
- };
855
-
856
- // node_modules/@lit/context/lib/value-notifier.js
857
- var s7 = class {
858
- get value() {
859
- return this.o;
860
- }
861
- set value(s8) {
862
- this.setValue(s8);
863
- }
864
- setValue(s8, t7 = false) {
865
- const i7 = t7 || !Object.is(s8, this.o);
866
- this.o = s8, i7 && this.updateObservers();
867
- }
868
- constructor(s8) {
869
- this.subscriptions = /* @__PURE__ */ new Map(), this.updateObservers = () => {
870
- for (const [s9, { disposer: t7 }] of this.subscriptions) s9(this.o, t7);
871
- }, void 0 !== s8 && (this.value = s8);
872
- }
873
- addCallback(s8, t7, i7) {
874
- if (!i7) return void s8(this.value);
875
- this.subscriptions.has(s8) || this.subscriptions.set(s8, { disposer: () => {
876
- this.subscriptions.delete(s8);
877
- }, consumerHost: t7 });
878
- const { disposer: h5 } = this.subscriptions.get(s8);
879
- s8(this.value, h5);
880
- }
881
- clearCallbacks() {
882
- this.subscriptions.clear();
883
- }
884
- };
885
-
886
- // node_modules/@lit/context/lib/controllers/context-provider.js
887
- var e8 = class extends Event {
888
- constructor(t7, s8) {
889
- super("context-provider", { bubbles: true, composed: true }), this.context = t7, this.contextTarget = s8;
890
- }
891
- };
892
- var i6 = class extends s7 {
893
- constructor(s8, e10, i7) {
894
- super(void 0 !== e10.context ? e10.initialValue : i7), this.onContextRequest = (t7) => {
895
- if (t7.context !== this.context) return;
896
- const s9 = t7.contextTarget ?? t7.composedPath()[0];
897
- s9 !== this.host && (t7.stopPropagation(), this.addCallback(t7.callback, s9, t7.subscribe));
898
- }, this.onProviderRequest = (s9) => {
899
- if (s9.context !== this.context) return;
900
- if ((s9.contextTarget ?? s9.composedPath()[0]) === this.host) return;
901
- const e11 = /* @__PURE__ */ new Set();
902
- for (const [s10, { consumerHost: i8 }] of this.subscriptions) e11.has(s10) || (e11.add(s10), i8.dispatchEvent(new s5(this.context, i8, s10, true)));
903
- s9.stopPropagation();
904
- }, this.host = s8, void 0 !== e10.context ? this.context = e10.context : this.context = e10, this.attachListeners(), this.host.addController?.(this);
905
- }
906
- attachListeners() {
907
- this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
908
- }
909
- hostConnected() {
910
- this.host.dispatchEvent(new e8(this.context, this.host));
911
- }
912
- };
913
-
914
- // node_modules/@lit/context/lib/decorators/provide.js
915
- function e9({ context: e10 }) {
916
- return (n8, i7) => {
917
- const r7 = /* @__PURE__ */ new WeakMap();
918
- if ("object" == typeof i7) return { get() {
919
- return n8.get.call(this);
920
- }, set(t7) {
921
- return r7.get(this).setValue(t7), n8.set.call(this, t7);
922
- }, init(n9) {
923
- return r7.set(this, new i6(this, { context: e10, initialValue: n9 })), n9;
924
- } };
925
- {
926
- n8.constructor.addInitializer((n9) => {
927
- r7.set(n9, new i6(n9, { context: e10 }));
928
- });
929
- const o10 = Object.getOwnPropertyDescriptor(n8, i7);
930
- let s8;
931
- if (void 0 === o10) {
932
- const t7 = /* @__PURE__ */ new WeakMap();
933
- s8 = { get() {
934
- return t7.get(this);
935
- }, set(e11) {
936
- r7.get(this).setValue(e11), t7.set(this, e11);
937
- }, configurable: true, enumerable: true };
938
- } else {
939
- const t7 = o10.set;
940
- s8 = { ...o10, set(e11) {
941
- r7.get(this).setValue(e11), t7?.call(this, e11);
942
- } };
943
- }
944
- return void Object.defineProperty(n8, i7, s8);
945
- }
946
- };
947
- }
948
-
949
- // node_modules/@lit/context/lib/decorators/consume.js
950
- function c5({ context: c6, subscribe: e10 }) {
951
- return (o10, n8) => {
952
- "object" == typeof n8 ? n8.addInitializer(function() {
953
- new s6(this, { context: c6, callback: (t7) => {
954
- o10.set.call(this, t7);
955
- }, subscribe: e10 });
956
- }) : o10.constructor.addInitializer((o11) => {
957
- new s6(o11, { context: c6, callback: (t7) => {
958
- o11[n8] = t7;
959
- }, subscribe: e10 });
960
- });
961
- };
962
- }
860
+ `;
861
+ var component_styles_default = ComponentStyles;
963
862
 
964
- // dist/utils/devices.js
965
- async function primeMicStream() {
966
- if (navigator.permissions) {
967
- const permissionStatus = await navigator.permissions.query({
968
- name: "microphone"
969
- });
970
- if (permissionStatus.state === "denied") {
971
- throw new Error("Microphone permission is denied");
972
- }
973
- }
974
- const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
975
- stream.getTracks().forEach((track) => {
976
- track.stop();
977
- });
978
- }
979
- async function getAudioDevices() {
980
- if (!navigator.mediaDevices?.enumerateDevices) {
981
- throw new Error("MediaDevices API is not available");
982
- }
983
- let audioDevices = await listAudioInputs();
984
- if (needsMicPriming(audioDevices)) {
985
- await primeMicStream();
986
- audioDevices = await listAudioInputs();
863
+ // dist/utils/auth.js
864
+ async function getInitialToken(config) {
865
+ const initialToken = "accessToken" in config ? {
866
+ accessToken: config.accessToken,
867
+ refreshToken: config.refreshToken
868
+ } : await config.refreshAccessToken();
869
+ if (!initialToken?.accessToken || typeof initialToken.accessToken !== "string") {
870
+ throw new Error("Access token is required and must be a string");
987
871
  }
988
872
  return {
989
- defaultDevice: audioDevices[0],
990
- devices: audioDevices
873
+ accessToken: initialToken.accessToken,
874
+ refreshToken: initialToken.refreshToken
991
875
  };
992
876
  }
993
- async function listAudioInputs() {
994
- const devices = await navigator.mediaDevices.enumerateDevices();
995
- return devices.filter((device) => device.kind === "audioinput");
996
- }
997
- function needsMicPriming(audioInputs) {
998
- if (audioInputs.length === 0) {
999
- return false;
1000
- }
1001
- return audioInputs.some((d3) => d3.deviceId === "" || d3.label === "");
1002
- }
1003
877
 
1004
878
  // dist/utils/events.js
1005
879
  function languagesChangedEvent(languages, selectedLanguage) {
@@ -1062,6 +936,13 @@ function deltaUsageEvent(detail) {
1062
936
  detail
1063
937
  });
1064
938
  }
939
+ function factsEvent(detail) {
940
+ return new CustomEvent("facts", {
941
+ bubbles: true,
942
+ composed: true,
943
+ detail
944
+ });
945
+ }
1065
946
  function errorToMessage(error) {
1066
947
  if (error instanceof Error) {
1067
948
  return error.message;
@@ -1126,6 +1007,194 @@ function keybindingActivatedEvent(keyboardEvent) {
1126
1007
  });
1127
1008
  }
1128
1009
 
1010
+ // dist/utils/token.js
1011
+ function decodeToken(token) {
1012
+ const parts = token.split(".");
1013
+ if (parts.length < 2) {
1014
+ throw new Error("Invalid token format");
1015
+ }
1016
+ const base64Url = parts[1];
1017
+ const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
1018
+ let jsonPayload;
1019
+ try {
1020
+ jsonPayload = decodeURIComponent(atob(base64).split("").map((c6) => "%" + ("00" + c6.charCodeAt(0).toString(16)).slice(-2)).join(""));
1021
+ } catch (error) {
1022
+ throw new Error("Failed to decode token payload");
1023
+ }
1024
+ let tokenDetails;
1025
+ try {
1026
+ tokenDetails = JSON.parse(jsonPayload);
1027
+ } catch (error) {
1028
+ throw new Error("Invalid JSON payload in token");
1029
+ }
1030
+ const issuerUrl = tokenDetails.iss;
1031
+ if (!issuerUrl) {
1032
+ throw new Error("Token payload does not contain an issuer (iss) field");
1033
+ }
1034
+ const regex = /^https:\/\/(keycloak|auth)\.([^.]+)\.corti\.app\/realms\/([^/]+)/;
1035
+ const match = issuerUrl.match(regex);
1036
+ if (!match) {
1037
+ throw new Error("Access token does not match expected format");
1038
+ }
1039
+ const expiresAt = tokenDetails.exp && typeof tokenDetails.exp === "number" ? tokenDetails.exp : void 0;
1040
+ return {
1041
+ accessToken: token,
1042
+ environment: match[2],
1043
+ expiresAt,
1044
+ tenant: match[3]
1045
+ };
1046
+ }
1047
+
1048
+ // dist/contexts/mixins/auth-context.js
1049
+ var __decorate = function(decorators, target, key, desc) {
1050
+ var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
1051
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
1052
+ else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
1053
+ return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
1054
+ };
1055
+ var regionContext = n(Symbol("region"));
1056
+ var tenantNameContext = n(Symbol("tenantName"));
1057
+ var accessTokenContext = n(Symbol("accessToken"));
1058
+ var authConfigContext = n(Symbol("authConfig"));
1059
+ function AuthContextMixin(superclass) {
1060
+ class AuthContextMixinClass extends superclass {
1061
+ set accessToken(token) {
1062
+ this.setAccessToken(token);
1063
+ }
1064
+ get accessToken() {
1065
+ return this._accessToken;
1066
+ }
1067
+ set authConfig(config) {
1068
+ this.setAuthConfig(config);
1069
+ }
1070
+ get authConfig() {
1071
+ return this._authConfig;
1072
+ }
1073
+ // ─────────────────────────────────────────────────────────────────────────────
1074
+ // Public methods
1075
+ // ─────────────────────────────────────────────────────────────────────────────
1076
+ /**
1077
+ * Sets the access token and parses region/tenant from it.
1078
+ * @returns ServerConfig with environment, tenant, and accessToken
1079
+ * @deprecated Use 'accessToken' property instead.
1080
+ */
1081
+ setAccessToken(token) {
1082
+ this._accessToken = token;
1083
+ this.region = void 0;
1084
+ this.tenantName = void 0;
1085
+ if (!token) {
1086
+ return {
1087
+ accessToken: token,
1088
+ environment: void 0,
1089
+ tenant: void 0
1090
+ };
1091
+ }
1092
+ try {
1093
+ const decoded = decodeToken(token);
1094
+ this.region = decoded?.environment;
1095
+ this.tenantName = decoded?.tenant;
1096
+ return {
1097
+ accessToken: token,
1098
+ environment: decoded?.environment,
1099
+ tenant: decoded?.tenant
1100
+ };
1101
+ } catch (error) {
1102
+ this.dispatchEvent(errorEvent(error));
1103
+ }
1104
+ return { accessToken: token, environment: void 0, tenant: void 0 };
1105
+ }
1106
+ /**
1107
+ * Sets the auth config and parses region/tenant from the initial token.
1108
+ * @returns Promise with ServerConfig containing environment, tenant, and accessToken
1109
+ * @deprecated Use 'authConfig' property instead.
1110
+ */
1111
+ async setAuthConfig(config) {
1112
+ this._authConfig = config;
1113
+ if (!config) {
1114
+ return {
1115
+ accessToken: void 0,
1116
+ environment: void 0,
1117
+ tenant: void 0
1118
+ };
1119
+ }
1120
+ try {
1121
+ const { accessToken } = await getInitialToken(config);
1122
+ return this.setAccessToken(accessToken);
1123
+ } catch (error) {
1124
+ this.dispatchEvent(errorEvent(error));
1125
+ }
1126
+ return {
1127
+ accessToken: void 0,
1128
+ environment: void 0,
1129
+ tenant: void 0
1130
+ };
1131
+ }
1132
+ }
1133
+ __decorate([
1134
+ e2({ context: regionContext }),
1135
+ r4()
1136
+ ], AuthContextMixinClass.prototype, "region", void 0);
1137
+ __decorate([
1138
+ e2({ context: tenantNameContext }),
1139
+ r4()
1140
+ ], AuthContextMixinClass.prototype, "tenantName", void 0);
1141
+ __decorate([
1142
+ e2({ context: accessTokenContext }),
1143
+ r4()
1144
+ ], AuthContextMixinClass.prototype, "_accessToken", void 0);
1145
+ __decorate([
1146
+ n4({ type: String })
1147
+ ], AuthContextMixinClass.prototype, "accessToken", null);
1148
+ __decorate([
1149
+ e2({ context: authConfigContext }),
1150
+ r4()
1151
+ ], AuthContextMixinClass.prototype, "_authConfig", void 0);
1152
+ __decorate([
1153
+ n4({ attribute: false, type: Object })
1154
+ ], AuthContextMixinClass.prototype, "authConfig", null);
1155
+ return AuthContextMixinClass;
1156
+ }
1157
+
1158
+ // dist/utils/devices.js
1159
+ async function primeMicStream() {
1160
+ if (navigator.permissions) {
1161
+ const permissionStatus = await navigator.permissions.query({
1162
+ name: "microphone"
1163
+ });
1164
+ if (permissionStatus.state === "denied") {
1165
+ throw new Error("Microphone permission is denied");
1166
+ }
1167
+ }
1168
+ const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
1169
+ stream.getTracks().forEach((track) => {
1170
+ track.stop();
1171
+ });
1172
+ }
1173
+ async function getAudioDevices() {
1174
+ if (!navigator.mediaDevices?.enumerateDevices) {
1175
+ throw new Error("MediaDevices API is not available");
1176
+ }
1177
+ let audioDevices = await listAudioInputs();
1178
+ if (needsMicPriming(audioDevices)) {
1179
+ await primeMicStream();
1180
+ audioDevices = await listAudioInputs();
1181
+ }
1182
+ return {
1183
+ defaultDevice: audioDevices[0],
1184
+ devices: audioDevices
1185
+ };
1186
+ }
1187
+ async function listAudioInputs() {
1188
+ const devices = await navigator.mediaDevices.enumerateDevices();
1189
+ return devices.filter((device) => device.kind === "audioinput");
1190
+ }
1191
+ function needsMicPriming(audioInputs) {
1192
+ if (audioInputs.length === 0) {
1193
+ return false;
1194
+ }
1195
+ return audioInputs.some((d3) => d3.deviceId === "" || d3.label === "");
1196
+ }
1197
+
1129
1198
  // dist/controllers/devices-controller.js
1130
1199
  var __classPrivateFieldSet = function(receiver, state, value, kind, f5) {
1131
1200
  if (kind === "m") throw new TypeError("Private method is not writable");
@@ -1219,6 +1288,117 @@ _DevicesController_autoLoadedDevices = /* @__PURE__ */ new WeakMap(), _DevicesCo
1219
1288
  }
1220
1289
  };
1221
1290
 
1291
+ // dist/contexts/mixins/devices-context.js
1292
+ var __decorate2 = function(decorators, target, key, desc) {
1293
+ var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
1294
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
1295
+ else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
1296
+ return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
1297
+ };
1298
+ var __classPrivateFieldGet2 = function(receiver, state, kind, f5) {
1299
+ if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
1300
+ if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1301
+ return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
1302
+ };
1303
+ var devicesContext = n(Symbol("devices"));
1304
+ var selectedDeviceContext = n(Symbol("selectedDevice"));
1305
+ function DevicesContextMixin(superclass) {
1306
+ var _DevicesContextMixinClass_devicesController;
1307
+ class DevicesContextMixinClass extends superclass {
1308
+ set devices(value) {
1309
+ this._devices = value;
1310
+ if (value !== void 0) {
1311
+ __classPrivateFieldGet2(this, _DevicesContextMixinClass_devicesController, "f").clearAutoLoadedFlag();
1312
+ }
1313
+ }
1314
+ get devices() {
1315
+ return this._devices;
1316
+ }
1317
+ constructor(...args) {
1318
+ super(...args);
1319
+ _DevicesContextMixinClass_devicesController.set(this, new DevicesController(this));
1320
+ this.addEventListener("recording-devices-changed", (e10) => {
1321
+ const event = e10;
1322
+ this.selectedDevice = event.detail.selectedDevice;
1323
+ });
1324
+ this.addEventListener("context-request", (ev) => {
1325
+ if (ev.context === devicesContext) {
1326
+ __classPrivateFieldGet2(this, _DevicesContextMixinClass_devicesController, "f").initialize();
1327
+ }
1328
+ });
1329
+ }
1330
+ }
1331
+ _DevicesContextMixinClass_devicesController = /* @__PURE__ */ new WeakMap();
1332
+ __decorate2([
1333
+ e2({ context: devicesContext }),
1334
+ r4()
1335
+ ], DevicesContextMixinClass.prototype, "_devices", void 0);
1336
+ __decorate2([
1337
+ n4({ attribute: false, type: Array })
1338
+ ], DevicesContextMixinClass.prototype, "devices", null);
1339
+ __decorate2([
1340
+ e2({ context: selectedDeviceContext }),
1341
+ n4({ attribute: false, type: Object })
1342
+ ], DevicesContextMixinClass.prototype, "selectedDevice", void 0);
1343
+ return DevicesContextMixinClass;
1344
+ }
1345
+
1346
+ // dist/contexts/mixins/keybindings-context.js
1347
+ var __decorate3 = function(decorators, target, key, desc) {
1348
+ var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
1349
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
1350
+ else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
1351
+ return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
1352
+ };
1353
+ var __classPrivateFieldGet3 = function(receiver, state, kind, f5) {
1354
+ if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
1355
+ if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1356
+ return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
1357
+ };
1358
+ var pushToTalkKeybindingContext = n(Symbol("pushToTalkKeybinding"));
1359
+ var toggleToTalkKeybindingContext = n(Symbol("toggleToTalkKeybinding"));
1360
+ function KeybindingsContextMixin(superclass) {
1361
+ var _KeybindingsContextMixinClass_handleContextRequest, _KeybindingsContextMixinClass_handleKeybindingChanged;
1362
+ class KeybindingsContextMixinClass extends superclass {
1363
+ constructor(...args) {
1364
+ super(...args);
1365
+ _KeybindingsContextMixinClass_handleContextRequest.set(this, (e10) => {
1366
+ if (e10.contextTarget.tagName.toLowerCase() === "dictation-keybinding-selector") {
1367
+ if (e10.context === pushToTalkKeybindingContext && this.pushToTalkKeybinding === void 0) {
1368
+ this.pushToTalkKeybinding = "Space";
1369
+ this.dispatchEvent(keybindingChangedEvent(" ", "Space", "Space", "push-to-talk"));
1370
+ }
1371
+ if (e10.context === toggleToTalkKeybindingContext && this.toggleToTalkKeybinding === void 0) {
1372
+ this.toggleToTalkKeybinding = "Enter";
1373
+ this.dispatchEvent(keybindingChangedEvent("Enter", "Enter", "Enter", "toggle-to-talk"));
1374
+ }
1375
+ }
1376
+ });
1377
+ _KeybindingsContextMixinClass_handleKeybindingChanged.set(this, (e10) => {
1378
+ const event = e10;
1379
+ const keybinding = event.detail.keybinding;
1380
+ if (event.detail.type === "push-to-talk") {
1381
+ this.pushToTalkKeybinding = keybinding;
1382
+ } else if (event.detail.type === "toggle-to-talk") {
1383
+ this.toggleToTalkKeybinding = keybinding;
1384
+ }
1385
+ });
1386
+ this.addEventListener("keybinding-changed", __classPrivateFieldGet3(this, _KeybindingsContextMixinClass_handleKeybindingChanged, "f"));
1387
+ this.addEventListener("context-request", __classPrivateFieldGet3(this, _KeybindingsContextMixinClass_handleContextRequest, "f"));
1388
+ }
1389
+ }
1390
+ _KeybindingsContextMixinClass_handleContextRequest = /* @__PURE__ */ new WeakMap(), _KeybindingsContextMixinClass_handleKeybindingChanged = /* @__PURE__ */ new WeakMap();
1391
+ __decorate3([
1392
+ e2({ context: pushToTalkKeybindingContext }),
1393
+ n4({ type: String })
1394
+ ], KeybindingsContextMixinClass.prototype, "pushToTalkKeybinding", void 0);
1395
+ __decorate3([
1396
+ e2({ context: toggleToTalkKeybindingContext }),
1397
+ n4({ type: String })
1398
+ ], KeybindingsContextMixinClass.prototype, "toggleToTalkKeybinding", void 0);
1399
+ return KeybindingsContextMixinClass;
1400
+ }
1401
+
1222
1402
  // dist/utils/languages.js
1223
1403
  var DEFAULT_LANGUAGES_BY_REGION = {
1224
1404
  default: LANGUAGES_SUPPORTED_EU,
@@ -1250,7 +1430,7 @@ var __classPrivateFieldSet2 = function(receiver, state, value, kind, f5) {
1250
1430
  if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1251
1431
  return kind === "a" ? f5.call(receiver, value) : f5 ? f5.value = value : state.set(receiver, value), value;
1252
1432
  };
1253
- var __classPrivateFieldGet2 = function(receiver, state, kind, f5) {
1433
+ var __classPrivateFieldGet4 = function(receiver, state, kind, f5) {
1254
1434
  if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
1255
1435
  if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1256
1436
  return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
@@ -1274,15 +1454,15 @@ var LanguagesController = class {
1274
1454
  initialize() {
1275
1455
  __classPrivateFieldSet2(this, _LanguagesController_initialized, true, "f");
1276
1456
  if (this.host._languages === void 0) {
1277
- __classPrivateFieldGet2(this, _LanguagesController_instances, "m", _LanguagesController_loadLanguages).call(this);
1457
+ __classPrivateFieldGet4(this, _LanguagesController_instances, "m", _LanguagesController_loadLanguages).call(this);
1278
1458
  }
1279
1459
  }
1280
1460
  hostUpdate() {
1281
- if (!__classPrivateFieldGet2(this, _LanguagesController_initialized, "f")) {
1461
+ if (!__classPrivateFieldGet4(this, _LanguagesController_initialized, "f")) {
1282
1462
  return;
1283
1463
  }
1284
- if (__classPrivateFieldGet2(this, _LanguagesController_previousRegion, "f") !== this.host.region && __classPrivateFieldGet2(this, _LanguagesController_autoLoadedLanguages, "f") || this.host._languages === void 0) {
1285
- __classPrivateFieldGet2(this, _LanguagesController_instances, "m", _LanguagesController_loadLanguages).call(this);
1464
+ if (__classPrivateFieldGet4(this, _LanguagesController_previousRegion, "f") !== this.host.region && __classPrivateFieldGet4(this, _LanguagesController_autoLoadedLanguages, "f") || this.host._languages === void 0) {
1465
+ __classPrivateFieldGet4(this, _LanguagesController_instances, "m", _LanguagesController_loadLanguages).call(this);
1286
1466
  }
1287
1467
  __classPrivateFieldSet2(this, _LanguagesController_previousRegion, this.host.region, "f");
1288
1468
  }
@@ -1294,291 +1474,142 @@ var LanguagesController = class {
1294
1474
  }
1295
1475
  };
1296
1476
  _LanguagesController_autoLoadedLanguages = /* @__PURE__ */ new WeakMap(), _LanguagesController_loadingLanguages = /* @__PURE__ */ new WeakMap(), _LanguagesController_previousRegion = /* @__PURE__ */ new WeakMap(), _LanguagesController_initialized = /* @__PURE__ */ new WeakMap(), _LanguagesController_instances = /* @__PURE__ */ new WeakSet(), _LanguagesController_loadLanguages = async function _LanguagesController_loadLanguages2() {
1297
- if (__classPrivateFieldGet2(this, _LanguagesController_loadingLanguages, "f")) {
1477
+ if (__classPrivateFieldGet4(this, _LanguagesController_loadingLanguages, "f")) {
1298
1478
  return;
1299
1479
  }
1300
1480
  __classPrivateFieldSet2(this, _LanguagesController_loadingLanguages, true, "f");
1301
1481
  try {
1302
- const { languages, defaultLanguage } = getLanguagesByRegion(this.host.region);
1303
- __classPrivateFieldSet2(this, _LanguagesController_autoLoadedLanguages, true, "f");
1304
- this.host._languages = languages;
1305
- const previousLanguage = this.host.dictationConfig?.primaryLanguage;
1306
- const selectedLanguage = previousLanguage && languages.includes(previousLanguage) ? previousLanguage : defaultLanguage;
1307
- this.host.dictationConfig = {
1308
- ...this.host.dictationConfig,
1309
- primaryLanguage: selectedLanguage || "en"
1310
- };
1311
- this.host.requestUpdate();
1312
- this.host.dispatchEvent(languagesChangedEvent(languages, selectedLanguage));
1313
- } catch (error) {
1314
- this.host.dispatchEvent(errorEvent(error));
1315
- } finally {
1316
- __classPrivateFieldSet2(this, _LanguagesController_loadingLanguages, false, "f");
1317
- }
1318
- };
1319
-
1320
- // dist/styles/component-styles.js
1321
- var ComponentStyles = i`
1322
- :host {
1323
- font-family: var(--component-font-family, -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, Cantarell, Ubuntu, roboto, noto, helvetica, arial, sans-serif);
1324
- }
1325
-
1326
- .wrapper {
1327
- background-color: var(--card-background, light-dark(#fff, #333));
1328
- border: 1px solid var(--card-border-color, light-dark(#ddd, #555));
1329
- border-radius: var(--card-border-radius, 8px);
1330
- box-shadow: var(--card-box-shadow, 0 2px 5px rgba(0, 0, 0, 0.1));
1331
- padding: var(--card-padding, 4px);
1332
- display: flex;
1333
- gap: 4px;
1334
- height: 46px;
1335
- width: fit-content;
1336
- box-sizing: border-box;
1337
- overflow: hidden;
1338
- }
1339
- `;
1340
- var LabelStyles = i`
1341
- label {
1342
- display: block;
1343
- font-size: 0.8rem;
1344
- padding-bottom: 0.5rem;
1345
- font-weight: 500;
1346
- color: var(--component-text-color, light-dark(#333, #eee));
1347
- pointer-events: none;
1348
- }
1349
- `;
1350
- var component_styles_default = ComponentStyles;
1351
-
1352
- // dist/utils/auth.js
1353
- async function getInitialToken(config) {
1354
- const initialToken = "accessToken" in config ? {
1355
- accessToken: config.accessToken,
1356
- refreshToken: config.refreshToken
1357
- } : await config.refreshAccessToken();
1358
- if (!initialToken?.accessToken || typeof initialToken.accessToken !== "string") {
1359
- throw new Error("Access token is required and must be a string");
1360
- }
1361
- return {
1362
- accessToken: initialToken.accessToken,
1363
- refreshToken: initialToken.refreshToken
1364
- };
1365
- }
1366
-
1367
- // dist/utils/token.js
1368
- function decodeToken(token) {
1369
- const parts = token.split(".");
1370
- if (parts.length < 2) {
1371
- throw new Error("Invalid token format");
1372
- }
1373
- const base64Url = parts[1];
1374
- const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
1375
- let jsonPayload;
1376
- try {
1377
- jsonPayload = decodeURIComponent(atob(base64).split("").map((c6) => "%" + ("00" + c6.charCodeAt(0).toString(16)).slice(-2)).join(""));
1378
- } catch (error) {
1379
- throw new Error("Failed to decode token payload");
1380
- }
1381
- let tokenDetails;
1382
- try {
1383
- tokenDetails = JSON.parse(jsonPayload);
1384
- } catch (error) {
1385
- throw new Error("Invalid JSON payload in token");
1386
- }
1387
- const issuerUrl = tokenDetails.iss;
1388
- if (!issuerUrl) {
1389
- throw new Error("Token payload does not contain an issuer (iss) field");
1390
- }
1391
- const regex = /^https:\/\/(keycloak|auth)\.([^.]+)\.corti\.app\/realms\/([^/]+)/;
1392
- const match = issuerUrl.match(regex);
1393
- if (!match) {
1394
- throw new Error("Access token does not match expected format");
1482
+ const { languages, defaultLanguage } = getLanguagesByRegion(this.host.region);
1483
+ __classPrivateFieldSet2(this, _LanguagesController_autoLoadedLanguages, true, "f");
1484
+ this.host._languages = languages;
1485
+ const previousLanguage = this.host.dictationConfig?.primaryLanguage;
1486
+ const selectedLanguage = previousLanguage && languages.includes(previousLanguage) ? previousLanguage : defaultLanguage;
1487
+ this.host.requestUpdate();
1488
+ this.host.dispatchEvent(languagesChangedEvent(languages, selectedLanguage));
1489
+ } catch (error) {
1490
+ this.host.dispatchEvent(errorEvent(error));
1491
+ } finally {
1492
+ __classPrivateFieldSet2(this, _LanguagesController_loadingLanguages, false, "f");
1395
1493
  }
1396
- const expiresAt = tokenDetails.exp && typeof tokenDetails.exp === "number" ? tokenDetails.exp : void 0;
1397
- return {
1398
- accessToken: token,
1399
- environment: match[2],
1400
- expiresAt,
1401
- tenant: match[3]
1402
- };
1403
- }
1494
+ };
1404
1495
 
1405
- // dist/contexts/dictation-context.js
1406
- var __decorate = function(decorators, target, key, desc) {
1496
+ // dist/utils/converters.js
1497
+ var commaSeparatedConverter = {
1498
+ fromAttribute: (value) => value?.split(",").map((s8) => s8.trim()).filter(Boolean),
1499
+ toAttribute: (value) => value?.join(",")
1500
+ };
1501
+
1502
+ // dist/contexts/mixins/languages-context.js
1503
+ var __decorate4 = function(decorators, target, key, desc) {
1407
1504
  var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
1408
1505
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
1409
1506
  else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
1410
1507
  return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
1411
1508
  };
1412
- var __classPrivateFieldGet3 = function(receiver, state, kind, f5) {
1509
+ var __classPrivateFieldGet5 = function(receiver, state, kind, f5) {
1413
1510
  if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
1414
1511
  if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1415
1512
  return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
1416
1513
  };
1417
- var _DictationRoot_languagesController;
1418
- var _DictationRoot_devicesController;
1419
- var _DictationRoot_handleLanguageChanged;
1420
- var _DictationRoot_handleDeviceChanged;
1421
- var _DictationRoot_handleRecordingStateChanged;
1422
- var _DictationRoot_handleContextRequest;
1423
- var _DictationRoot_handleKeybindingChanged;
1424
- var regionContext = n7(Symbol("region"));
1425
- var tenantNameContext = n7(Symbol("tenantName"));
1426
- var languagesContext = n7(Symbol("languages"));
1427
- var devicesContext = n7(Symbol("devices"));
1428
- var selectedDeviceContext = n7(Symbol("selectedDevice"));
1429
- var recordingStateContext = n7(Symbol("recordingState"));
1430
- var accessTokenContext = n7(Symbol("accessToken"));
1431
- var dictationConfigContext = n7(Symbol("dictationConfig"));
1432
- var authConfigContext = n7(Symbol("authConfig"));
1433
- var socketUrlContext = n7(Symbol("socketUrl"));
1434
- var socketProxyContext = n7(Symbol("socketProxy"));
1435
- var debugDisplayAudioContext = n7(Symbol("debugDisplayAudio"));
1436
- var pushToTalkKeybindingContext = n7(Symbol("pushToTalkKeybinding"));
1437
- var toggleToTalkKeybindingContext = n7(Symbol("toggleToTalkKeybinding"));
1438
- var DictationRoot = class DictationRoot2 extends i4 {
1439
- set accessToken(token) {
1440
- this.setAccessToken(token);
1441
- }
1442
- get accessToken() {
1443
- return this._accessToken;
1444
- }
1445
- set authConfig(config) {
1446
- this.setAuthConfig(config);
1447
- }
1448
- get authConfig() {
1449
- return this._authConfig;
1450
- }
1451
- set languages(value) {
1452
- this._languages = value;
1453
- if (value !== void 0) {
1454
- __classPrivateFieldGet3(this, _DictationRoot_languagesController, "f").clearAutoLoadedFlag();
1455
- }
1456
- }
1457
- get languages() {
1458
- return this._languages;
1459
- }
1460
- set devices(value) {
1461
- this._devices = value;
1462
- if (value !== void 0) {
1463
- __classPrivateFieldGet3(this, _DictationRoot_devicesController, "f").clearAutoLoadedFlag();
1514
+ var languagesContext = n(Symbol("languages"));
1515
+ function LanguagesContextMixin(superclass) {
1516
+ var _LanguagesContextMixinClass_languagesController;
1517
+ class LanguagesContextMixinClass extends superclass {
1518
+ set languages(value) {
1519
+ this._languages = value;
1520
+ if (value !== void 0) {
1521
+ __classPrivateFieldGet5(this, _LanguagesContextMixinClass_languagesController, "f").clearAutoLoadedFlag();
1522
+ }
1523
+ }
1524
+ get languages() {
1525
+ return this._languages;
1526
+ }
1527
+ constructor(...args) {
1528
+ super(...args);
1529
+ _LanguagesContextMixinClass_languagesController.set(this, new LanguagesController(this));
1530
+ this.addEventListener("context-request", (e10) => {
1531
+ const ev = e10;
1532
+ if (ev.context === languagesContext) {
1533
+ __classPrivateFieldGet5(this, _LanguagesContextMixinClass_languagesController, "f").initialize();
1534
+ }
1535
+ });
1464
1536
  }
1465
1537
  }
1466
- get devices() {
1467
- return this._devices;
1468
- }
1469
- // ─────────────────────────────────────────────────────────────────────────────
1470
- // Lifecycle
1471
- // ─────────────────────────────────────────────────────────────────────────────
1472
- constructor() {
1473
- super();
1474
- this.recordingState = "stopped";
1475
- _DictationRoot_languagesController.set(this, new LanguagesController(this));
1476
- _DictationRoot_devicesController.set(this, new DevicesController(this));
1477
- this.noWrapper = false;
1478
- _DictationRoot_handleLanguageChanged.set(this, (e10) => {
1479
- const event = e10;
1480
- this.dictationConfig = {
1481
- ...this.dictationConfig,
1482
- primaryLanguage: event.detail.selectedLanguage
1483
- };
1484
- });
1485
- _DictationRoot_handleDeviceChanged.set(this, (e10) => {
1486
- const event = e10;
1487
- this.selectedDevice = event.detail.selectedDevice;
1488
- });
1489
- _DictationRoot_handleRecordingStateChanged.set(this, (e10) => {
1490
- const event = e10;
1491
- this.recordingState = event.detail.state;
1492
- });
1493
- _DictationRoot_handleContextRequest.set(this, (e10) => {
1494
- if (e10.context === languagesContext) {
1495
- __classPrivateFieldGet3(this, _DictationRoot_languagesController, "f").initialize();
1496
- } else if (e10.context === devicesContext) {
1497
- __classPrivateFieldGet3(this, _DictationRoot_devicesController, "f").initialize();
1498
- } else if (e10.contextTarget.tagName.toLowerCase() === "dictation-keybinding-selector") {
1499
- if (e10.context === pushToTalkKeybindingContext && this.pushToTalkKeybinding === void 0) {
1500
- this.pushToTalkKeybinding = "Space";
1501
- this.dispatchEvent(keybindingChangedEvent(" ", "Space", "Space", "push-to-talk"));
1502
- }
1503
- if (e10.context === toggleToTalkKeybindingContext && this.toggleToTalkKeybinding === void 0) {
1504
- this.toggleToTalkKeybinding = "Enter";
1505
- this.dispatchEvent(keybindingChangedEvent("Enter", "Enter", "Enter", "toggle-to-talk"));
1506
- }
1507
- }
1508
- });
1509
- _DictationRoot_handleKeybindingChanged.set(this, (e10) => {
1510
- const event = e10;
1511
- const keybinding = event.detail.keybinding;
1512
- if (event.detail.type === "push-to-talk") {
1513
- this.pushToTalkKeybinding = keybinding;
1514
- } else if (event.detail.type === "toggle-to-talk") {
1515
- this.toggleToTalkKeybinding = keybinding;
1516
- }
1517
- });
1518
- this.addEventListener("languages-changed", __classPrivateFieldGet3(this, _DictationRoot_handleLanguageChanged, "f"));
1519
- this.addEventListener("recording-devices-changed", __classPrivateFieldGet3(this, _DictationRoot_handleDeviceChanged, "f"));
1520
- this.addEventListener("recording-state-changed", __classPrivateFieldGet3(this, _DictationRoot_handleRecordingStateChanged, "f"));
1521
- this.addEventListener("context-request", __classPrivateFieldGet3(this, _DictationRoot_handleContextRequest, "f"));
1522
- this.addEventListener("keybinding-changed", __classPrivateFieldGet3(this, _DictationRoot_handleKeybindingChanged, "f"));
1538
+ _LanguagesContextMixinClass_languagesController = /* @__PURE__ */ new WeakMap();
1539
+ __decorate4([
1540
+ e2({ context: languagesContext }),
1541
+ r4()
1542
+ ], LanguagesContextMixinClass.prototype, "_languages", void 0);
1543
+ __decorate4([
1544
+ n4({
1545
+ converter: commaSeparatedConverter,
1546
+ type: Array
1547
+ })
1548
+ ], LanguagesContextMixinClass.prototype, "languages", null);
1549
+ return LanguagesContextMixinClass;
1550
+ }
1551
+
1552
+ // dist/contexts/mixins/proxy-context.js
1553
+ var __decorate5 = function(decorators, target, key, desc) {
1554
+ var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
1555
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
1556
+ else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
1557
+ return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
1558
+ };
1559
+ var socketUrlContext = n(Symbol("socketUrl"));
1560
+ var socketProxyContext = n(Symbol("socketProxy"));
1561
+ function ProxyContextMixin(superclass) {
1562
+ class ProxyContextMixinClass extends superclass {
1523
1563
  }
1524
- // ─────────────────────────────────────────────────────────────────────────────
1525
- // Public methods
1526
- // ─────────────────────────────────────────────────────────────────────────────
1527
- /**
1528
- * Sets the access token and parses region/tenant from it.
1529
- * @returns ServerConfig with environment, tenant, and accessToken
1530
- * @deprecated Use 'accessToken' property instead.
1531
- */
1532
- setAccessToken(token) {
1533
- this._accessToken = token;
1534
- this.region = void 0;
1535
- this.tenantName = void 0;
1536
- if (!token) {
1537
- return { accessToken: token, environment: void 0, tenant: void 0 };
1538
- }
1539
- try {
1540
- const decoded = decodeToken(token);
1541
- this.region = decoded?.environment;
1542
- this.tenantName = decoded?.tenant;
1543
- return {
1544
- accessToken: token,
1545
- environment: decoded?.environment,
1546
- tenant: decoded?.tenant
1547
- };
1548
- } catch (error) {
1549
- this.dispatchEvent(errorEvent(error));
1564
+ __decorate5([
1565
+ e2({ context: socketUrlContext }),
1566
+ n4({ type: String })
1567
+ ], ProxyContextMixinClass.prototype, "socketUrl", void 0);
1568
+ __decorate5([
1569
+ e2({ context: socketProxyContext }),
1570
+ n4({ attribute: false, type: Object })
1571
+ ], ProxyContextMixinClass.prototype, "socketProxy", void 0);
1572
+ return ProxyContextMixinClass;
1573
+ }
1574
+
1575
+ // dist/contexts/mixins/recording-state-context.js
1576
+ var __decorate6 = function(decorators, target, key, desc) {
1577
+ var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
1578
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
1579
+ else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
1580
+ return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
1581
+ };
1582
+ var recordingStateContext = n(Symbol("recordingState"));
1583
+ function RecordingStateContextMixin(superclass) {
1584
+ class RecordingStateContextMixinClass extends superclass {
1585
+ constructor(...args) {
1586
+ super(...args);
1587
+ this.recordingState = "stopped";
1588
+ this.addEventListener("recording-state-changed", (e10) => {
1589
+ const event = e10;
1590
+ this.recordingState = event.detail.state;
1591
+ });
1550
1592
  }
1551
- return { accessToken: token, environment: void 0, tenant: void 0 };
1552
1593
  }
1553
- /**
1554
- * Sets the auth config and parses region/tenant from the initial token.
1555
- * @returns Promise with ServerConfig containing environment, tenant, and accessToken
1556
- * @deprecated Use 'authConfig' property instead.
1557
- */
1558
- async setAuthConfig(config) {
1559
- this._authConfig = config;
1560
- if (!config) {
1561
- return {
1562
- accessToken: void 0,
1563
- environment: void 0,
1564
- tenant: void 0
1565
- };
1566
- }
1567
- try {
1568
- const { accessToken } = await getInitialToken(config);
1569
- return this.setAccessToken(accessToken);
1570
- } catch (error) {
1571
- this.dispatchEvent(errorEvent(error));
1572
- }
1573
- return {
1574
- accessToken: void 0,
1575
- environment: void 0,
1576
- tenant: void 0
1577
- };
1594
+ __decorate6([
1595
+ e2({ context: recordingStateContext }),
1596
+ r4()
1597
+ ], RecordingStateContextMixinClass.prototype, "recordingState", void 0);
1598
+ return RecordingStateContextMixinClass;
1599
+ }
1600
+
1601
+ // dist/contexts/root-context.js
1602
+ var __decorate7 = function(decorators, target, key, desc) {
1603
+ var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
1604
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
1605
+ else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
1606
+ return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
1607
+ };
1608
+ var RootContext = class extends DevicesContextMixin(RecordingStateContextMixin(KeybindingsContextMixin(LanguagesContextMixin(AuthContextMixin(ProxyContextMixin(i5)))))) {
1609
+ constructor() {
1610
+ super(...arguments);
1611
+ this.noWrapper = false;
1578
1612
  }
1579
- // ─────────────────────────────────────────────────────────────────────────────
1580
- // Render
1581
- // ─────────────────────────────────────────────────────────────────────────────
1582
1613
  render() {
1583
1614
  if (this.noWrapper) {
1584
1615
  return x`<slot></slot>`;
@@ -1588,91 +1619,53 @@ var DictationRoot = class DictationRoot2 extends i4 {
1588
1619
  </div>`;
1589
1620
  }
1590
1621
  };
1591
- _DictationRoot_languagesController = /* @__PURE__ */ new WeakMap();
1592
- _DictationRoot_devicesController = /* @__PURE__ */ new WeakMap();
1593
- _DictationRoot_handleLanguageChanged = /* @__PURE__ */ new WeakMap();
1594
- _DictationRoot_handleDeviceChanged = /* @__PURE__ */ new WeakMap();
1595
- _DictationRoot_handleRecordingStateChanged = /* @__PURE__ */ new WeakMap();
1596
- _DictationRoot_handleContextRequest = /* @__PURE__ */ new WeakMap();
1597
- _DictationRoot_handleKeybindingChanged = /* @__PURE__ */ new WeakMap();
1598
- DictationRoot.styles = [component_styles_default];
1599
- __decorate([
1600
- e9({ context: regionContext }),
1601
- r5()
1602
- ], DictationRoot.prototype, "region", void 0);
1603
- __decorate([
1604
- e9({ context: tenantNameContext }),
1605
- r5()
1606
- ], DictationRoot.prototype, "tenantName", void 0);
1607
- __decorate([
1608
- e9({ context: recordingStateContext }),
1609
- r5()
1610
- ], DictationRoot.prototype, "recordingState", void 0);
1611
- __decorate([
1612
- e9({ context: accessTokenContext }),
1613
- r5()
1614
- ], DictationRoot.prototype, "_accessToken", void 0);
1615
- __decorate([
1616
- n4({ type: String })
1617
- ], DictationRoot.prototype, "accessToken", null);
1618
- __decorate([
1619
- e9({ context: authConfigContext }),
1620
- r5()
1621
- ], DictationRoot.prototype, "_authConfig", void 0);
1622
- __decorate([
1623
- n4({ attribute: false, type: Object })
1624
- ], DictationRoot.prototype, "authConfig", null);
1625
- __decorate([
1626
- e9({ context: socketUrlContext }),
1627
- n4({ type: String })
1628
- ], DictationRoot.prototype, "socketUrl", void 0);
1629
- __decorate([
1630
- e9({ context: socketProxyContext }),
1631
- n4({ attribute: false, type: Object })
1632
- ], DictationRoot.prototype, "socketProxy", void 0);
1633
- __decorate([
1634
- e9({ context: dictationConfigContext }),
1635
- n4({ attribute: false, type: Object })
1636
- ], DictationRoot.prototype, "dictationConfig", void 0);
1637
- __decorate([
1638
- e9({ context: languagesContext }),
1639
- r5()
1640
- ], DictationRoot.prototype, "_languages", void 0);
1641
- __decorate([
1642
- n4({
1643
- converter: commaSeparatedConverter,
1644
- type: Array
1645
- })
1646
- ], DictationRoot.prototype, "languages", null);
1647
- __decorate([
1648
- e9({ context: devicesContext }),
1649
- r5()
1650
- ], DictationRoot.prototype, "_devices", void 0);
1651
- __decorate([
1652
- n4({ attribute: false, type: Array })
1653
- ], DictationRoot.prototype, "devices", null);
1654
- __decorate([
1655
- e9({ context: selectedDeviceContext }),
1622
+ RootContext.styles = [component_styles_default];
1623
+ __decorate7([
1624
+ n4({ type: Boolean })
1625
+ ], RootContext.prototype, "noWrapper", void 0);
1626
+
1627
+ // dist/contexts/ambient-context.js
1628
+ var __decorate8 = function(decorators, target, key, desc) {
1629
+ var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
1630
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
1631
+ else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
1632
+ return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
1633
+ };
1634
+ var ambientConfigContext = n(Symbol("ambientConfig"));
1635
+ var interactionIdContext = n(Symbol("interactionId"));
1636
+ var AmbientRoot = class AmbientRoot2 extends RootContext {
1637
+ constructor() {
1638
+ super();
1639
+ this.ambientConfig = DEFAULT_STREAM_CONFIG;
1640
+ this.addEventListener("languages-changed", (e10) => {
1641
+ const event = e10;
1642
+ const lang = event.detail.selectedLanguage ?? "en";
1643
+ const base = this.ambientConfig ?? DEFAULT_STREAM_CONFIG;
1644
+ this.ambientConfig = {
1645
+ ...base,
1646
+ mode: {
1647
+ ...base.mode,
1648
+ outputLocale: lang
1649
+ },
1650
+ transcription: {
1651
+ ...base.transcription,
1652
+ primaryLanguage: lang
1653
+ }
1654
+ };
1655
+ });
1656
+ }
1657
+ };
1658
+ __decorate8([
1659
+ e2({ context: ambientConfigContext }),
1656
1660
  n4({ attribute: false, type: Object })
1657
- ], DictationRoot.prototype, "selectedDevice", void 0);
1658
- __decorate([
1659
- e9({ context: debugDisplayAudioContext }),
1660
- n4({ attribute: "debug-display-audio", type: Boolean })
1661
- ], DictationRoot.prototype, "debug_displayAudio", void 0);
1662
- __decorate([
1663
- e9({ context: pushToTalkKeybindingContext }),
1664
- n4({ type: String })
1665
- ], DictationRoot.prototype, "pushToTalkKeybinding", void 0);
1666
- __decorate([
1667
- e9({ context: toggleToTalkKeybindingContext }),
1661
+ ], AmbientRoot.prototype, "ambientConfig", void 0);
1662
+ __decorate8([
1663
+ e2({ context: interactionIdContext }),
1668
1664
  n4({ type: String })
1669
- ], DictationRoot.prototype, "toggleToTalkKeybinding", void 0);
1670
- __decorate([
1671
- n4({ type: Boolean })
1672
- ], DictationRoot.prototype, "noWrapper", void 0);
1673
- DictationRoot = __decorate([
1674
- t3("dictation-root")
1675
- ], DictationRoot);
1665
+ ], AmbientRoot.prototype, "interactionId", void 0);
1666
+ AmbientRoot = __decorate8([
1667
+ t2("ambient-root")
1668
+ ], AmbientRoot);
1676
1669
 
1677
1670
  // node_modules/@corti/sdk/dist/esm/core/json.mjs
1678
1671
  var toJson = (value, replacer, space) => {
@@ -12537,8 +12530,8 @@ var CortiWebSocketProxyClient = class {
12537
12530
  CortiWebSocketProxyClient.stream = new CustomProxyStream();
12538
12531
  CortiWebSocketProxyClient.transcribe = new CustomProxyTranscribe();
12539
12532
 
12540
- // dist/controllers/dictation-controller.js
12541
- var __classPrivateFieldGet4 = function(receiver, state, kind, f5) {
12533
+ // dist/controllers/socket-controller.js
12534
+ var __classPrivateFieldGet6 = function(receiver, state, kind, f5) {
12542
12535
  if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
12543
12536
  if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
12544
12537
  return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
@@ -12549,121 +12542,126 @@ var __classPrivateFieldSet3 = function(receiver, state, value, kind, f5) {
12549
12542
  if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
12550
12543
  return kind === "a" ? f5.call(receiver, value) : f5 ? f5.value = value : state.set(receiver, value), value;
12551
12544
  };
12552
- var _DictationController_instances;
12553
- var _DictationController_cortiClient;
12554
- var _DictationController_webSocket;
12555
- var _DictationController_closeTimeout;
12556
- var _DictationController_callbacks;
12557
- var _DictationController_lastDictationConfig;
12558
- var _DictationController_lastSocketUrl;
12559
- var _DictationController_lastSocketProxy;
12560
- var _DictationController_outboundQueue;
12561
- var _DictationController_socketReady;
12562
- var _DictationController_connectingPromise;
12563
- var _DictationController_connectionGeneration;
12564
- var _DictationController_isConnecting;
12565
- var _DictationController_configHasChanged;
12566
- var _DictationController_doConnect;
12567
- var _DictationController_connectProxy;
12568
- var _DictationController_connectAuth;
12569
- var _DictationController_setupWebSocketHandlers;
12570
- var _DictationController_isSocketOpen;
12571
- var _DictationController_drain;
12572
- var DictationController = class {
12545
+ var _SocketController_instances;
12546
+ var _SocketController_webSocket;
12547
+ var _SocketController_cortiClient;
12548
+ var _SocketController_connectionGeneration;
12549
+ var _SocketController_socketReady;
12550
+ var _SocketController_closeTimeout;
12551
+ var _SocketController_outboundQueue;
12552
+ var _SocketController_callbacks;
12553
+ var _SocketController_lastConfig;
12554
+ var _SocketController_lastSocketUrl;
12555
+ var _SocketController_lastSocketProxy;
12556
+ var _SocketController_connectingPromise;
12557
+ var _SocketController_isConnecting;
12558
+ var _SocketController_openViaProxy;
12559
+ var _SocketController_openViaAuth;
12560
+ var _SocketController_doConnect;
12561
+ var _SocketController_isSocketOpen;
12562
+ var _SocketController_configHasChanged;
12563
+ var _SocketController_drain;
12564
+ var _SocketController_setupWebSocketHandlers;
12565
+ var SocketController = class {
12573
12566
  constructor(host) {
12574
- _DictationController_instances.add(this);
12575
- _DictationController_cortiClient.set(this, null);
12576
- _DictationController_webSocket.set(this, null);
12577
- _DictationController_closeTimeout.set(this, void 0);
12578
- _DictationController_callbacks.set(this, void 0);
12579
- _DictationController_lastDictationConfig.set(this, null);
12580
- _DictationController_lastSocketUrl.set(this, void 0);
12581
- _DictationController_lastSocketProxy.set(this, void 0);
12582
- _DictationController_outboundQueue.set(this, []);
12583
- _DictationController_socketReady.set(this, false);
12584
- _DictationController_connectingPromise.set(this, null);
12585
- _DictationController_connectionGeneration.set(this, 0);
12586
- _DictationController_isConnecting.set(this, false);
12567
+ _SocketController_instances.add(this);
12568
+ _SocketController_webSocket.set(this, null);
12569
+ _SocketController_cortiClient.set(this, null);
12570
+ _SocketController_connectionGeneration.set(this, 0);
12571
+ _SocketController_socketReady.set(this, false);
12572
+ _SocketController_closeTimeout.set(this, void 0);
12573
+ _SocketController_outboundQueue.set(this, []);
12574
+ _SocketController_callbacks.set(this, void 0);
12575
+ _SocketController_lastConfig.set(this, null);
12576
+ _SocketController_lastSocketUrl.set(this, void 0);
12577
+ _SocketController_lastSocketProxy.set(this, void 0);
12578
+ _SocketController_connectingPromise.set(this, null);
12579
+ _SocketController_isConnecting.set(this, false);
12587
12580
  this.mediaRecorderHandler = (data) => {
12588
- if (__classPrivateFieldGet4(this, _DictationController_socketReady, "f") && __classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_isSocketOpen).call(this)) {
12589
- __classPrivateFieldGet4(this, _DictationController_webSocket, "f")?.send(data);
12590
- __classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onNetworkActivity?.("sent", {
12581
+ if (__classPrivateFieldGet6(this, _SocketController_socketReady, "f") && __classPrivateFieldGet6(this, _SocketController_instances, "m", _SocketController_isSocketOpen).call(this)) {
12582
+ __classPrivateFieldGet6(this, _SocketController_webSocket, "f")?.send(data);
12583
+ __classPrivateFieldGet6(this, _SocketController_callbacks, "f")?.onNetworkActivity?.("sent", {
12591
12584
  size: data.size,
12592
12585
  type: "audio"
12593
12586
  });
12594
12587
  return;
12595
12588
  }
12596
- __classPrivateFieldGet4(this, _DictationController_outboundQueue, "f").push(data);
12589
+ __classPrivateFieldGet6(this, _SocketController_outboundQueue, "f").push(data);
12597
12590
  };
12598
12591
  this.host = host;
12599
12592
  host.addController(this);
12600
12593
  }
12601
- hostDisconnected() {
12602
- this.cleanup();
12603
- }
12604
- async connect(dictationConfig = DEFAULT_DICTATION_CONFIG, callbacks = {}) {
12605
- if (__classPrivateFieldGet4(this, _DictationController_connectingPromise, "f") && !__classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_configHasChanged).call(this)) {
12606
- return __classPrivateFieldGet4(this, _DictationController_connectingPromise, "f");
12594
+ async connect(config, callbacks) {
12595
+ if (__classPrivateFieldGet6(this, _SocketController_connectingPromise, "f") && !__classPrivateFieldGet6(this, _SocketController_instances, "m", _SocketController_configHasChanged).call(this, config)) {
12596
+ return __classPrivateFieldGet6(this, _SocketController_connectingPromise, "f");
12607
12597
  }
12608
- __classPrivateFieldSet3(this, _DictationController_isConnecting, true, "f");
12609
- __classPrivateFieldSet3(this, _DictationController_connectingPromise, __classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_doConnect).call(this, dictationConfig, callbacks).finally(() => {
12610
- __classPrivateFieldSet3(this, _DictationController_isConnecting, false, "f");
12611
- __classPrivateFieldSet3(this, _DictationController_connectingPromise, null, "f");
12598
+ __classPrivateFieldSet3(this, _SocketController_isConnecting, true, "f");
12599
+ __classPrivateFieldSet3(this, _SocketController_connectingPromise, __classPrivateFieldGet6(this, _SocketController_instances, "m", _SocketController_doConnect).call(this, config, callbacks).finally(() => {
12600
+ __classPrivateFieldSet3(this, _SocketController_isConnecting, false, "f");
12601
+ __classPrivateFieldSet3(this, _SocketController_connectingPromise, null, "f");
12612
12602
  }), "f");
12613
- return __classPrivateFieldGet4(this, _DictationController_connectingPromise, "f");
12603
+ return __classPrivateFieldGet6(this, _SocketController_connectingPromise, "f");
12614
12604
  }
12615
- async pause() {
12616
- if (__classPrivateFieldGet4(this, _DictationController_socketReady, "f") && __classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_isSocketOpen).call(this)) {
12617
- __classPrivateFieldGet4(this, _DictationController_webSocket, "f")?.send(JSON.stringify({ type: "flush" }));
12618
- __classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onNetworkActivity?.("sent", { type: "flush" });
12619
- return;
12620
- }
12621
- __classPrivateFieldGet4(this, _DictationController_outboundQueue, "f").push({ type: "flush" });
12605
+ hostDisconnected() {
12606
+ this.cleanup();
12622
12607
  }
12623
12608
  isConnectionOpen() {
12624
- return __classPrivateFieldGet4(this, _DictationController_webSocket, "f") !== null && (__classPrivateFieldGet4(this, _DictationController_webSocket, "f").readyState === WebSocket.OPEN || __classPrivateFieldGet4(this, _DictationController_webSocket, "f").readyState === WebSocket.CONNECTING);
12609
+ return __classPrivateFieldGet6(this, _SocketController_webSocket, "f") !== null && (__classPrivateFieldGet6(this, _SocketController_webSocket, "f").readyState === WebSocket.OPEN || __classPrivateFieldGet6(this, _SocketController_webSocket, "f").readyState === WebSocket.CONNECTING);
12625
12610
  }
12626
12611
  isConnecting() {
12627
- return __classPrivateFieldGet4(this, _DictationController_isConnecting, "f");
12612
+ return __classPrivateFieldGet6(this, _SocketController_isConnecting, "f");
12628
12613
  }
12629
12614
  async waitForConnection() {
12630
- await __classPrivateFieldGet4(this, _DictationController_connectingPromise, "f");
12615
+ await __classPrivateFieldGet6(this, _SocketController_connectingPromise, "f");
12616
+ }
12617
+ async pause() {
12618
+ if (__classPrivateFieldGet6(this, _SocketController_socketReady, "f") && __classPrivateFieldGet6(this, _SocketController_instances, "m", _SocketController_isSocketOpen).call(this)) {
12619
+ __classPrivateFieldGet6(this, _SocketController_webSocket, "f")?.send(JSON.stringify({ type: "flush" }));
12620
+ __classPrivateFieldGet6(this, _SocketController_callbacks, "f")?.onNetworkActivity?.("sent", { type: "flush" });
12621
+ return;
12622
+ }
12623
+ __classPrivateFieldGet6(this, _SocketController_outboundQueue, "f").push({ type: "flush" });
12624
+ }
12625
+ async stopRecording() {
12626
+ await this.pause();
12631
12627
  }
12632
12628
  async closeConnection(onClose) {
12633
12629
  await new Promise((resolve, reject) => {
12634
- const oldSocket = __classPrivateFieldGet4(this, _DictationController_webSocket, "f");
12635
- __classPrivateFieldSet3(this, _DictationController_webSocket, null, "f");
12630
+ const oldSocket = __classPrivateFieldGet6(this, _SocketController_webSocket, "f");
12631
+ __classPrivateFieldSet3(this, _SocketController_webSocket, null, "f");
12636
12632
  if (!oldSocket || oldSocket.readyState !== WebSocket.OPEN && oldSocket.readyState !== WebSocket.CONNECTING) {
12637
- __classPrivateFieldSet3(this, _DictationController_socketReady, false, "f");
12633
+ __classPrivateFieldSet3(this, _SocketController_socketReady, false, "f");
12638
12634
  resolve();
12639
12635
  return;
12640
12636
  }
12641
12637
  oldSocket.on("close", (event) => {
12642
- if (__classPrivateFieldGet4(this, _DictationController_closeTimeout, "f")) {
12643
- clearTimeout(__classPrivateFieldGet4(this, _DictationController_closeTimeout, "f"));
12644
- __classPrivateFieldSet3(this, _DictationController_closeTimeout, void 0, "f");
12638
+ if (__classPrivateFieldGet6(this, _SocketController_closeTimeout, "f")) {
12639
+ clearTimeout(__classPrivateFieldGet6(this, _SocketController_closeTimeout, "f"));
12640
+ __classPrivateFieldSet3(this, _SocketController_closeTimeout, void 0, "f");
12645
12641
  }
12646
12642
  if (onClose) {
12647
12643
  onClose(event);
12644
+ } else if (__classPrivateFieldGet6(this, _SocketController_callbacks, "f")?.onClose) {
12645
+ __classPrivateFieldGet6(this, _SocketController_callbacks, "f").onClose(event);
12648
12646
  }
12649
12647
  resolve();
12650
12648
  });
12651
- const wasReady = __classPrivateFieldGet4(this, _DictationController_socketReady, "f");
12652
- __classPrivateFieldSet3(this, _DictationController_socketReady, false, "f");
12649
+ const wasReady = __classPrivateFieldGet6(this, _SocketController_socketReady, "f");
12650
+ __classPrivateFieldSet3(this, _SocketController_socketReady, false, "f");
12653
12651
  oldSocket.on("message", (message) => {
12654
- __classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onNetworkActivity?.("received", message);
12655
- if (__classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onMessage) {
12656
- __classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onMessage(message);
12652
+ __classPrivateFieldGet6(this, _SocketController_callbacks, "f")?.onNetworkActivity?.("received", message);
12653
+ if (__classPrivateFieldGet6(this, _SocketController_callbacks, "f")?.onMessage) {
12654
+ __classPrivateFieldGet6(this, _SocketController_callbacks, "f").onMessage(message);
12657
12655
  }
12658
12656
  if (!wasReady && message.type === "CONFIG_ACCEPTED") {
12659
12657
  oldSocket.sendEnd({ type: "end" });
12660
- __classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onNetworkActivity?.("sent", { type: "end" });
12658
+ __classPrivateFieldGet6(this, _SocketController_callbacks, "f")?.onNetworkActivity?.("sent", { type: "end" });
12661
12659
  return;
12662
12660
  }
12663
- if (message.type === "ended") {
12664
- if (__classPrivateFieldGet4(this, _DictationController_closeTimeout, "f")) {
12665
- clearTimeout(__classPrivateFieldGet4(this, _DictationController_closeTimeout, "f"));
12666
- __classPrivateFieldSet3(this, _DictationController_closeTimeout, void 0, "f");
12661
+ if (message.type === "ended" || message.type === "ENDED") {
12662
+ if (__classPrivateFieldGet6(this, _SocketController_closeTimeout, "f")) {
12663
+ clearTimeout(__classPrivateFieldGet6(this, _SocketController_closeTimeout, "f"));
12664
+ __classPrivateFieldSet3(this, _SocketController_closeTimeout, void 0, "f");
12667
12665
  }
12668
12666
  resolve();
12669
12667
  return;
@@ -12671,9 +12669,9 @@ var DictationController = class {
12671
12669
  });
12672
12670
  if (wasReady) {
12673
12671
  oldSocket.sendEnd({ type: "end" });
12674
- __classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onNetworkActivity?.("sent", { type: "end" });
12672
+ __classPrivateFieldGet6(this, _SocketController_callbacks, "f")?.onNetworkActivity?.("sent", { type: "end" });
12675
12673
  }
12676
- __classPrivateFieldSet3(this, _DictationController_closeTimeout, window.setTimeout(() => {
12674
+ __classPrivateFieldSet3(this, _SocketController_closeTimeout, window.setTimeout(() => {
12677
12675
  reject(new Error("Connection close timeout"));
12678
12676
  if (oldSocket?.readyState === WebSocket.OPEN) {
12679
12677
  oldSocket.close();
@@ -12683,68 +12681,35 @@ var DictationController = class {
12683
12681
  }
12684
12682
  cleanup() {
12685
12683
  var _a;
12686
- __classPrivateFieldSet3(this, _DictationController_connectionGeneration, (_a = __classPrivateFieldGet4(this, _DictationController_connectionGeneration, "f"), _a++, _a), "f");
12687
- __classPrivateFieldSet3(this, _DictationController_socketReady, false, "f");
12688
- if (__classPrivateFieldGet4(this, _DictationController_closeTimeout, "f")) {
12689
- clearTimeout(__classPrivateFieldGet4(this, _DictationController_closeTimeout, "f"));
12690
- __classPrivateFieldSet3(this, _DictationController_closeTimeout, void 0, "f");
12684
+ __classPrivateFieldSet3(this, _SocketController_connectionGeneration, (_a = __classPrivateFieldGet6(this, _SocketController_connectionGeneration, "f"), _a++, _a), "f");
12685
+ __classPrivateFieldSet3(this, _SocketController_socketReady, false, "f");
12686
+ if (__classPrivateFieldGet6(this, _SocketController_closeTimeout, "f")) {
12687
+ clearTimeout(__classPrivateFieldGet6(this, _SocketController_closeTimeout, "f"));
12688
+ __classPrivateFieldSet3(this, _SocketController_closeTimeout, void 0, "f");
12691
12689
  }
12692
12690
  if (this.isConnectionOpen()) {
12693
- __classPrivateFieldGet4(this, _DictationController_webSocket, "f")?.close();
12691
+ __classPrivateFieldGet6(this, _SocketController_webSocket, "f")?.close();
12694
12692
  }
12695
- __classPrivateFieldSet3(this, _DictationController_webSocket, null, "f");
12696
- __classPrivateFieldSet3(this, _DictationController_cortiClient, null, "f");
12697
- __classPrivateFieldSet3(this, _DictationController_lastDictationConfig, null, "f");
12698
- __classPrivateFieldSet3(this, _DictationController_lastSocketUrl, void 0, "f");
12699
- __classPrivateFieldSet3(this, _DictationController_lastSocketProxy, void 0, "f");
12700
- if (__classPrivateFieldGet4(this, _DictationController_outboundQueue, "f").length > 0) {
12701
- this.host.dispatchEvent(errorEvent(`${__classPrivateFieldGet4(this, _DictationController_outboundQueue, "f").length} unsent message(s) were discarded because the configuration changed before the connection was closed`));
12693
+ __classPrivateFieldSet3(this, _SocketController_webSocket, null, "f");
12694
+ __classPrivateFieldSet3(this, _SocketController_cortiClient, null, "f");
12695
+ __classPrivateFieldSet3(this, _SocketController_lastConfig, null, "f");
12696
+ __classPrivateFieldSet3(this, _SocketController_lastSocketUrl, void 0, "f");
12697
+ __classPrivateFieldSet3(this, _SocketController_lastSocketProxy, void 0, "f");
12698
+ if (__classPrivateFieldGet6(this, _SocketController_outboundQueue, "f").length > 0) {
12699
+ this.host.dispatchEvent(errorEvent(`${__classPrivateFieldGet6(this, _SocketController_outboundQueue, "f").length} unsent message(s) were discarded because the configuration changed before the connection was closed`));
12702
12700
  }
12703
- __classPrivateFieldSet3(this, _DictationController_outboundQueue, [], "f");
12701
+ __classPrivateFieldSet3(this, _SocketController_outboundQueue, [], "f");
12704
12702
  }
12705
12703
  };
12706
- _DictationController_cortiClient = /* @__PURE__ */ new WeakMap(), _DictationController_webSocket = /* @__PURE__ */ new WeakMap(), _DictationController_closeTimeout = /* @__PURE__ */ new WeakMap(), _DictationController_callbacks = /* @__PURE__ */ new WeakMap(), _DictationController_lastDictationConfig = /* @__PURE__ */ new WeakMap(), _DictationController_lastSocketUrl = /* @__PURE__ */ new WeakMap(), _DictationController_lastSocketProxy = /* @__PURE__ */ new WeakMap(), _DictationController_outboundQueue = /* @__PURE__ */ new WeakMap(), _DictationController_socketReady = /* @__PURE__ */ new WeakMap(), _DictationController_connectingPromise = /* @__PURE__ */ new WeakMap(), _DictationController_connectionGeneration = /* @__PURE__ */ new WeakMap(), _DictationController_isConnecting = /* @__PURE__ */ new WeakMap(), _DictationController_instances = /* @__PURE__ */ new WeakSet(), _DictationController_configHasChanged = function _DictationController_configHasChanged2() {
12707
- return JSON.stringify(this.host._dictationConfig) !== JSON.stringify(__classPrivateFieldGet4(this, _DictationController_lastDictationConfig, "f")) || this.host._socketUrl !== __classPrivateFieldGet4(this, _DictationController_lastSocketUrl, "f") || JSON.stringify(this.host._socketProxy) !== JSON.stringify(__classPrivateFieldGet4(this, _DictationController_lastSocketProxy, "f"));
12708
- }, _DictationController_doConnect = async function _DictationController_doConnect2(dictationConfig, callbacks) {
12709
- const newConnection = __classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_configHasChanged).call(this) || !this.isConnectionOpen();
12710
- if (newConnection) {
12711
- this.cleanup();
12712
- __classPrivateFieldSet3(this, _DictationController_lastDictationConfig, this.host._dictationConfig || null, "f");
12713
- __classPrivateFieldSet3(this, _DictationController_lastSocketUrl, this.host._socketUrl, "f");
12714
- __classPrivateFieldSet3(this, _DictationController_lastSocketProxy, this.host._socketProxy, "f");
12715
- const generation = __classPrivateFieldGet4(this, _DictationController_connectionGeneration, "f");
12716
- const socket = this.host._socketUrl || this.host._socketProxy ? await __classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_connectProxy).call(this, dictationConfig) : await __classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_connectAuth).call(this, dictationConfig);
12717
- if (__classPrivateFieldGet4(this, _DictationController_connectionGeneration, "f") !== generation) {
12718
- socket.close();
12719
- return "superseded";
12720
- }
12721
- __classPrivateFieldSet3(this, _DictationController_webSocket, socket, "f");
12722
- __classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onNetworkActivity?.("sent", {
12723
- configuration: dictationConfig,
12724
- type: "config"
12725
- });
12726
- }
12727
- __classPrivateFieldSet3(this, _DictationController_callbacks, callbacks, "f");
12728
- __classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_setupWebSocketHandlers).call(this, callbacks);
12729
- if (!newConnection && this.isConnectionOpen()) {
12730
- __classPrivateFieldSet3(this, _DictationController_socketReady, true, "f");
12731
- __classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_drain).call(this);
12732
- }
12733
- return newConnection;
12734
- }, _DictationController_connectProxy = async function _DictationController_connectProxy2(dictationConfig) {
12704
+ _SocketController_webSocket = /* @__PURE__ */ new WeakMap(), _SocketController_cortiClient = /* @__PURE__ */ new WeakMap(), _SocketController_connectionGeneration = /* @__PURE__ */ new WeakMap(), _SocketController_socketReady = /* @__PURE__ */ new WeakMap(), _SocketController_closeTimeout = /* @__PURE__ */ new WeakMap(), _SocketController_outboundQueue = /* @__PURE__ */ new WeakMap(), _SocketController_callbacks = /* @__PURE__ */ new WeakMap(), _SocketController_lastConfig = /* @__PURE__ */ new WeakMap(), _SocketController_lastSocketUrl = /* @__PURE__ */ new WeakMap(), _SocketController_lastSocketProxy = /* @__PURE__ */ new WeakMap(), _SocketController_connectingPromise = /* @__PURE__ */ new WeakMap(), _SocketController_isConnecting = /* @__PURE__ */ new WeakMap(), _SocketController_instances = /* @__PURE__ */ new WeakSet(), _SocketController_openViaProxy = async function _SocketController_openViaProxy2(config) {
12735
12705
  const proxyOptions = this.host._socketProxy || {
12736
12706
  url: this.host._socketUrl || ""
12737
12707
  };
12738
12708
  if (!proxyOptions.url) {
12739
12709
  throw new Error("Proxy URL is required when using proxy client");
12740
12710
  }
12741
- return await CortiWebSocketProxyClient.transcribe.connect({
12742
- // setting to "false" to have CONFIG_* message in network activity events
12743
- awaitConfiguration: false,
12744
- configuration: dictationConfig,
12745
- proxy: proxyOptions
12746
- });
12747
- }, _DictationController_connectAuth = async function _DictationController_connectAuth2(dictationConfig) {
12711
+ return this._connectThroughProxy(config, proxyOptions);
12712
+ }, _SocketController_openViaAuth = async function _SocketController_openViaAuth2(config) {
12748
12713
  if (!this.host._authConfig && !this.host._accessToken) {
12749
12714
  throw new Error("Auth configuration or access token is required to connect");
12750
12715
  }
@@ -12754,67 +12719,150 @@ _DictationController_cortiClient = /* @__PURE__ */ new WeakMap(), _DictationCont
12754
12719
  accessToken: this.host._accessToken || ""
12755
12720
  })
12756
12721
  };
12757
- __classPrivateFieldSet3(this, _DictationController_cortiClient, new CortiClient2({
12722
+ __classPrivateFieldSet3(this, _SocketController_cortiClient, new CortiClient2({
12758
12723
  auth,
12759
12724
  environment: this.host._region,
12760
12725
  tenantName: this.host._tenantName
12761
12726
  }), "f");
12762
- return await __classPrivateFieldGet4(this, _DictationController_cortiClient, "f").transcribe.connect({
12763
- // setting to "false" to have CONFIG_* message in network activity events
12764
- awaitConfiguration: false,
12765
- configuration: dictationConfig
12766
- });
12767
- }, _DictationController_setupWebSocketHandlers = function _DictationController_setupWebSocketHandlers2(callbacks) {
12768
- if (!__classPrivateFieldGet4(this, _DictationController_webSocket, "f")) {
12727
+ return this._connectThroughAuth(__classPrivateFieldGet6(this, _SocketController_cortiClient, "f"), config);
12728
+ }, _SocketController_doConnect = async function _SocketController_doConnect2(config, callbacks) {
12729
+ const newConnection = __classPrivateFieldGet6(this, _SocketController_instances, "m", _SocketController_configHasChanged).call(this, config) || !this.isConnectionOpen();
12730
+ if (newConnection) {
12731
+ this.cleanup();
12732
+ __classPrivateFieldSet3(this, _SocketController_lastConfig, config, "f");
12733
+ __classPrivateFieldSet3(this, _SocketController_lastSocketUrl, this.host._socketUrl, "f");
12734
+ __classPrivateFieldSet3(this, _SocketController_lastSocketProxy, this.host._socketProxy, "f");
12735
+ const generation = __classPrivateFieldGet6(this, _SocketController_connectionGeneration, "f");
12736
+ const socket = this.host._socketUrl || this.host._socketProxy ? await __classPrivateFieldGet6(this, _SocketController_instances, "m", _SocketController_openViaProxy).call(this, config) : await __classPrivateFieldGet6(this, _SocketController_instances, "m", _SocketController_openViaAuth).call(this, config);
12737
+ if (__classPrivateFieldGet6(this, _SocketController_connectionGeneration, "f") !== generation) {
12738
+ socket.close();
12739
+ return "superseded";
12740
+ }
12741
+ __classPrivateFieldSet3(this, _SocketController_webSocket, socket, "f");
12742
+ __classPrivateFieldGet6(this, _SocketController_callbacks, "f")?.onNetworkActivity?.("sent", {
12743
+ configuration: config,
12744
+ type: "config"
12745
+ });
12746
+ }
12747
+ __classPrivateFieldSet3(this, _SocketController_callbacks, callbacks, "f");
12748
+ __classPrivateFieldGet6(this, _SocketController_instances, "m", _SocketController_setupWebSocketHandlers).call(this, callbacks);
12749
+ if (!newConnection && this.isConnectionOpen()) {
12750
+ __classPrivateFieldSet3(this, _SocketController_socketReady, true, "f");
12751
+ __classPrivateFieldGet6(this, _SocketController_instances, "m", _SocketController_drain).call(this);
12752
+ }
12753
+ return newConnection;
12754
+ }, _SocketController_isSocketOpen = function _SocketController_isSocketOpen2() {
12755
+ return __classPrivateFieldGet6(this, _SocketController_webSocket, "f") !== null && __classPrivateFieldGet6(this, _SocketController_webSocket, "f").readyState === WebSocket.OPEN;
12756
+ }, _SocketController_configHasChanged = function _SocketController_configHasChanged2(nextConfig) {
12757
+ return JSON.stringify(nextConfig) !== JSON.stringify(__classPrivateFieldGet6(this, _SocketController_lastConfig, "f")) || this.host._socketUrl !== __classPrivateFieldGet6(this, _SocketController_lastSocketUrl, "f") || JSON.stringify(this.host._socketProxy) !== JSON.stringify(__classPrivateFieldGet6(this, _SocketController_lastSocketProxy, "f"));
12758
+ }, _SocketController_drain = function _SocketController_drain2() {
12759
+ if (!__classPrivateFieldGet6(this, _SocketController_socketReady, "f") || !__classPrivateFieldGet6(this, _SocketController_instances, "m", _SocketController_isSocketOpen).call(this) || __classPrivateFieldGet6(this, _SocketController_outboundQueue, "f").length === 0) {
12760
+ return;
12761
+ }
12762
+ while (__classPrivateFieldGet6(this, _SocketController_outboundQueue, "f").length > 0 && __classPrivateFieldGet6(this, _SocketController_instances, "m", _SocketController_isSocketOpen).call(this)) {
12763
+ const item = __classPrivateFieldGet6(this, _SocketController_outboundQueue, "f").shift();
12764
+ if (item === void 0) {
12765
+ break;
12766
+ }
12767
+ if (item instanceof Blob) {
12768
+ __classPrivateFieldGet6(this, _SocketController_webSocket, "f").send(item);
12769
+ __classPrivateFieldGet6(this, _SocketController_callbacks, "f")?.onNetworkActivity?.("sent", {
12770
+ size: item.size,
12771
+ type: "audio"
12772
+ });
12773
+ continue;
12774
+ }
12775
+ __classPrivateFieldGet6(this, _SocketController_webSocket, "f").send(JSON.stringify(item));
12776
+ __classPrivateFieldGet6(this, _SocketController_callbacks, "f")?.onNetworkActivity?.("sent", {
12777
+ type: item.type
12778
+ });
12779
+ }
12780
+ }, _SocketController_setupWebSocketHandlers = function _SocketController_setupWebSocketHandlers2(callbacks) {
12781
+ if (!__classPrivateFieldGet6(this, _SocketController_webSocket, "f")) {
12769
12782
  throw new Error("WebSocket not initialized");
12770
12783
  }
12771
- __classPrivateFieldGet4(this, _DictationController_webSocket, "f").on("message", (message) => {
12784
+ __classPrivateFieldGet6(this, _SocketController_webSocket, "f").on("message", (message) => {
12772
12785
  if (message.type === "CONFIG_ACCEPTED") {
12773
- __classPrivateFieldSet3(this, _DictationController_socketReady, true, "f");
12774
- __classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_drain).call(this);
12786
+ __classPrivateFieldSet3(this, _SocketController_socketReady, true, "f");
12787
+ __classPrivateFieldGet6(this, _SocketController_instances, "m", _SocketController_drain).call(this);
12775
12788
  }
12776
12789
  callbacks.onNetworkActivity?.("received", message);
12777
12790
  if (callbacks.onMessage) {
12778
12791
  callbacks.onMessage(message);
12779
12792
  }
12780
12793
  });
12781
- __classPrivateFieldGet4(this, _DictationController_webSocket, "f").on("error", (event) => {
12782
- __classPrivateFieldSet3(this, _DictationController_socketReady, false, "f");
12794
+ __classPrivateFieldGet6(this, _SocketController_webSocket, "f").on("error", (event) => {
12795
+ __classPrivateFieldSet3(this, _SocketController_socketReady, false, "f");
12783
12796
  if (callbacks.onError) {
12784
12797
  callbacks.onError(event);
12785
12798
  }
12786
12799
  });
12787
- __classPrivateFieldGet4(this, _DictationController_webSocket, "f").on("close", (event) => {
12788
- __classPrivateFieldSet3(this, _DictationController_socketReady, false, "f");
12800
+ __classPrivateFieldGet6(this, _SocketController_webSocket, "f").on("close", (event) => {
12801
+ __classPrivateFieldSet3(this, _SocketController_socketReady, false, "f");
12789
12802
  if (callbacks.onClose) {
12790
12803
  callbacks.onClose(event);
12791
12804
  }
12792
12805
  });
12793
- }, _DictationController_isSocketOpen = function _DictationController_isSocketOpen2() {
12794
- return __classPrivateFieldGet4(this, _DictationController_webSocket, "f") !== null && __classPrivateFieldGet4(this, _DictationController_webSocket, "f").readyState === WebSocket.OPEN;
12795
- }, _DictationController_drain = function _DictationController_drain2() {
12796
- if (!__classPrivateFieldGet4(this, _DictationController_socketReady, "f") || !__classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_isSocketOpen).call(this) || __classPrivateFieldGet4(this, _DictationController_outboundQueue, "f").length === 0) {
12797
- return;
12806
+ };
12807
+
12808
+ // dist/controllers/ambient-controller.js
12809
+ var AmbientController = class extends SocketController {
12810
+ async stopRecording() {
12811
+ await this.closeConnection();
12798
12812
  }
12799
- while (__classPrivateFieldGet4(this, _DictationController_outboundQueue, "f").length > 0 && __classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_isSocketOpen).call(this)) {
12800
- const item = __classPrivateFieldGet4(this, _DictationController_outboundQueue, "f").shift();
12801
- if (item === void 0) {
12802
- break;
12803
- }
12804
- if (item instanceof Blob) {
12805
- __classPrivateFieldGet4(this, _DictationController_webSocket, "f").send(item);
12806
- __classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onNetworkActivity?.("sent", {
12807
- size: item.size,
12808
- type: "audio"
12809
- });
12810
- continue;
12811
- }
12812
- __classPrivateFieldGet4(this, _DictationController_webSocket, "f").send(JSON.stringify(item));
12813
- __classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onNetworkActivity?.("sent", {
12814
- type: item.type
12813
+ async _connectThroughProxy(session, proxy) {
12814
+ return await CortiWebSocketProxyClient.stream.connect({
12815
+ // awaitConfiguration: false CONFIG_* appears in network activity before the socket is configured server-side
12816
+ awaitConfiguration: false,
12817
+ configuration: session.configuration,
12818
+ proxy
12819
+ });
12820
+ }
12821
+ async _connectThroughAuth(client, session) {
12822
+ return await client.stream.connect({
12823
+ // awaitConfiguration: false — CONFIG_* appears in network activity before the socket is configured server-side
12824
+ awaitConfiguration: false,
12825
+ configuration: session.configuration,
12826
+ id: session.interactionId
12827
+ });
12828
+ }
12829
+ };
12830
+
12831
+ // dist/contexts/dictation-context.js
12832
+ var __decorate9 = function(decorators, target, key, desc) {
12833
+ var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
12834
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
12835
+ else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
12836
+ return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
12837
+ };
12838
+ var dictationConfigContext = n(Symbol("dictationConfig"));
12839
+ var debugDisplayAudioContext = n(Symbol("debugDisplayAudio"));
12840
+ var DictationRoot = class DictationRoot2 extends RootContext {
12841
+ // ─────────────────────────────────────────────────────────────────────────────
12842
+ // Lifecycle
12843
+ // ─────────────────────────────────────────────────────────────────────────────
12844
+ constructor() {
12845
+ super();
12846
+ this.addEventListener("languages-changed", (e10) => {
12847
+ const event = e10;
12848
+ this.dictationConfig = {
12849
+ ...this.dictationConfig,
12850
+ primaryLanguage: event.detail.selectedLanguage ?? "en"
12851
+ };
12815
12852
  });
12816
12853
  }
12817
12854
  };
12855
+ __decorate9([
12856
+ e2({ context: dictationConfigContext }),
12857
+ n4({ attribute: false, type: Object })
12858
+ ], DictationRoot.prototype, "dictationConfig", void 0);
12859
+ __decorate9([
12860
+ e2({ context: debugDisplayAudioContext }),
12861
+ n4({ attribute: "debug-display-audio", type: Boolean })
12862
+ ], DictationRoot.prototype, "debug_displayAudio", void 0);
12863
+ DictationRoot = __decorate9([
12864
+ t2("dictation-root")
12865
+ ], DictationRoot);
12818
12866
 
12819
12867
  // dist/utils/keybinding.js
12820
12868
  function isMac() {
@@ -12881,7 +12929,7 @@ function shouldIgnoreKeybinding(element) {
12881
12929
  }
12882
12930
 
12883
12931
  // dist/controllers/keybinding-controller.js
12884
- var __classPrivateFieldGet5 = function(receiver, state, kind, f5) {
12932
+ var __classPrivateFieldGet7 = function(receiver, state, kind, f5) {
12885
12933
  if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
12886
12934
  if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
12887
12935
  return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
@@ -12910,19 +12958,19 @@ var KeybindingController = class {
12910
12958
  host.addController(this);
12911
12959
  }
12912
12960
  hostConnected() {
12913
- __classPrivateFieldGet5(this, _KeybindingController_instances, "m", _KeybindingController_setupListeners).call(this);
12961
+ __classPrivateFieldGet7(this, _KeybindingController_instances, "m", _KeybindingController_setupListeners).call(this);
12914
12962
  }
12915
12963
  hostDisconnected() {
12916
- __classPrivateFieldGet5(this, _KeybindingController_instances, "m", _KeybindingController_removeListeners).call(this);
12964
+ __classPrivateFieldGet7(this, _KeybindingController_instances, "m", _KeybindingController_removeListeners).call(this);
12917
12965
  }
12918
12966
  };
12919
12967
  _KeybindingController_keydownHandler = /* @__PURE__ */ new WeakMap(), _KeybindingController_keyupHandler = /* @__PURE__ */ new WeakMap(), _KeybindingController_blurHandler = /* @__PURE__ */ new WeakMap(), _KeybindingController_isPushToTalkKeyPressed = /* @__PURE__ */ new WeakMap(), _KeybindingController_instances = /* @__PURE__ */ new WeakSet(), _KeybindingController_setupListeners = function _KeybindingController_setupListeners2() {
12920
- __classPrivateFieldGet5(this, _KeybindingController_instances, "m", _KeybindingController_removeListeners).call(this);
12968
+ __classPrivateFieldGet7(this, _KeybindingController_instances, "m", _KeybindingController_removeListeners).call(this);
12921
12969
  __classPrivateFieldSet4(this, _KeybindingController_keydownHandler, (event) => {
12922
12970
  if (shouldIgnoreKeybinding(document.activeElement)) {
12923
12971
  return;
12924
12972
  }
12925
- if (this.host._toggleToTalkKeybinding && matchesKeybinding(event, this.host._toggleToTalkKeybinding) && !__classPrivateFieldGet5(this, _KeybindingController_isPushToTalkKeyPressed, "f")) {
12973
+ if (this.host._toggleToTalkKeybinding && matchesKeybinding(event, this.host._toggleToTalkKeybinding) && !__classPrivateFieldGet7(this, _KeybindingController_isPushToTalkKeyPressed, "f")) {
12926
12974
  if (!this.host.dispatchEvent(keybindingActivatedEvent(event))) {
12927
12975
  return;
12928
12976
  }
@@ -12947,25 +12995,25 @@ _KeybindingController_keydownHandler = /* @__PURE__ */ new WeakMap(), _Keybindin
12947
12995
  }
12948
12996
  }, "f");
12949
12997
  __classPrivateFieldSet4(this, _KeybindingController_blurHandler, () => {
12950
- if (__classPrivateFieldGet5(this, _KeybindingController_isPushToTalkKeyPressed, "f")) {
12998
+ if (__classPrivateFieldGet7(this, _KeybindingController_isPushToTalkKeyPressed, "f")) {
12951
12999
  __classPrivateFieldSet4(this, _KeybindingController_isPushToTalkKeyPressed, false, "f");
12952
13000
  this.host.stopRecording();
12953
13001
  }
12954
13002
  }, "f");
12955
- window.addEventListener("keydown", __classPrivateFieldGet5(this, _KeybindingController_keydownHandler, "f"));
12956
- window.addEventListener("keyup", __classPrivateFieldGet5(this, _KeybindingController_keyupHandler, "f"));
12957
- window.addEventListener("blur", __classPrivateFieldGet5(this, _KeybindingController_blurHandler, "f"));
13003
+ window.addEventListener("keydown", __classPrivateFieldGet7(this, _KeybindingController_keydownHandler, "f"));
13004
+ window.addEventListener("keyup", __classPrivateFieldGet7(this, _KeybindingController_keyupHandler, "f"));
13005
+ window.addEventListener("blur", __classPrivateFieldGet7(this, _KeybindingController_blurHandler, "f"));
12958
13006
  }, _KeybindingController_removeListeners = function _KeybindingController_removeListeners2() {
12959
- if (__classPrivateFieldGet5(this, _KeybindingController_keydownHandler, "f")) {
12960
- window.removeEventListener("keydown", __classPrivateFieldGet5(this, _KeybindingController_keydownHandler, "f"));
13007
+ if (__classPrivateFieldGet7(this, _KeybindingController_keydownHandler, "f")) {
13008
+ window.removeEventListener("keydown", __classPrivateFieldGet7(this, _KeybindingController_keydownHandler, "f"));
12961
13009
  __classPrivateFieldSet4(this, _KeybindingController_keydownHandler, void 0, "f");
12962
13010
  }
12963
- if (__classPrivateFieldGet5(this, _KeybindingController_keyupHandler, "f")) {
12964
- window.removeEventListener("keyup", __classPrivateFieldGet5(this, _KeybindingController_keyupHandler, "f"));
13011
+ if (__classPrivateFieldGet7(this, _KeybindingController_keyupHandler, "f")) {
13012
+ window.removeEventListener("keyup", __classPrivateFieldGet7(this, _KeybindingController_keyupHandler, "f"));
12965
13013
  __classPrivateFieldSet4(this, _KeybindingController_keyupHandler, void 0, "f");
12966
13014
  }
12967
- if (__classPrivateFieldGet5(this, _KeybindingController_blurHandler, "f")) {
12968
- window.removeEventListener("blur", __classPrivateFieldGet5(this, _KeybindingController_blurHandler, "f"));
13015
+ if (__classPrivateFieldGet7(this, _KeybindingController_blurHandler, "f")) {
13016
+ window.removeEventListener("blur", __classPrivateFieldGet7(this, _KeybindingController_blurHandler, "f"));
12969
13017
  __classPrivateFieldSet4(this, _KeybindingController_blurHandler, void 0, "f");
12970
13018
  }
12971
13019
  };
@@ -13015,7 +13063,7 @@ var __classPrivateFieldSet5 = function(receiver, state, value, kind, f5) {
13015
13063
  if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
13016
13064
  return kind === "a" ? f5.call(receiver, value) : f5 ? f5.value = value : state.set(receiver, value), value;
13017
13065
  };
13018
- var __classPrivateFieldGet6 = function(receiver, state, kind, f5) {
13066
+ var __classPrivateFieldGet8 = function(receiver, state, kind, f5) {
13019
13067
  if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
13020
13068
  if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
13021
13069
  return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
@@ -13051,25 +13099,25 @@ var MediaController = class {
13051
13099
  __classPrivateFieldSet5(this, _MediaController_onTrackEnded, onTrackEnded, "f");
13052
13100
  __classPrivateFieldSet5(this, _MediaController_dataHandler, dataHandler, "f");
13053
13101
  __classPrivateFieldSet5(this, _MediaController_mediaStream, await getMediaStream(this.host._selectedDevice?.deviceId, this.host._debug_displayAudio), "f");
13054
- __classPrivateFieldGet6(this, _MediaController_mediaStream, "f").getTracks().forEach((track) => {
13102
+ __classPrivateFieldGet8(this, _MediaController_mediaStream, "f").getTracks().forEach((track) => {
13055
13103
  track.addEventListener("ended", () => {
13056
- if (__classPrivateFieldGet6(this, _MediaController_onTrackEnded, "f")) {
13057
- __classPrivateFieldGet6(this, _MediaController_onTrackEnded, "f").call(this);
13104
+ if (__classPrivateFieldGet8(this, _MediaController_onTrackEnded, "f")) {
13105
+ __classPrivateFieldGet8(this, _MediaController_onTrackEnded, "f").call(this);
13058
13106
  }
13059
13107
  });
13060
13108
  });
13061
- const { audioContext, analyser } = createAudioAnalyzer(__classPrivateFieldGet6(this, _MediaController_mediaStream, "f"));
13109
+ const { audioContext, analyser } = createAudioAnalyzer(__classPrivateFieldGet8(this, _MediaController_mediaStream, "f"));
13062
13110
  __classPrivateFieldSet5(this, _MediaController_audioContext, audioContext, "f");
13063
13111
  __classPrivateFieldSet5(this, _MediaController_analyser, analyser, "f");
13064
- __classPrivateFieldSet5(this, _MediaController_mediaRecorder, new MediaRecorder(__classPrivateFieldGet6(this, _MediaController_mediaStream, "f")), "f");
13065
- __classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f").ondataavailable = (event) => {
13066
- if (__classPrivateFieldGet6(this, _MediaController_dataHandler, "f")) {
13067
- __classPrivateFieldGet6(this, _MediaController_dataHandler, "f").call(this, event.data);
13112
+ __classPrivateFieldSet5(this, _MediaController_mediaRecorder, new MediaRecorder(__classPrivateFieldGet8(this, _MediaController_mediaStream, "f")), "f");
13113
+ __classPrivateFieldGet8(this, _MediaController_mediaRecorder, "f").ondataavailable = (event) => {
13114
+ if (__classPrivateFieldGet8(this, _MediaController_dataHandler, "f")) {
13115
+ __classPrivateFieldGet8(this, _MediaController_dataHandler, "f").call(this, event.data);
13068
13116
  }
13069
13117
  };
13070
13118
  }
13071
13119
  getAudioLevel() {
13072
- return __classPrivateFieldGet6(this, _MediaController_analyser, "f") ? calculateAudioLevel(__classPrivateFieldGet6(this, _MediaController_analyser, "f")) : 0;
13120
+ return __classPrivateFieldGet8(this, _MediaController_analyser, "f") ? calculateAudioLevel(__classPrivateFieldGet8(this, _MediaController_analyser, "f")) : 0;
13073
13121
  }
13074
13122
  startAudioLevelMonitoring(onAudioLevelChange) {
13075
13123
  this.stopAudioLevelMonitoring();
@@ -13077,38 +13125,38 @@ var MediaController = class {
13077
13125
  __classPrivateFieldSet5(this, _MediaController_visualiserInterval, window.setInterval(() => {
13078
13126
  __classPrivateFieldSet5(this, _MediaController_audioLevel, this.getAudioLevel() * 3, "f");
13079
13127
  this.host.requestUpdate();
13080
- if (__classPrivateFieldGet6(this, _MediaController_onAudioLevelChange, "f")) {
13081
- __classPrivateFieldGet6(this, _MediaController_onAudioLevelChange, "f").call(this, __classPrivateFieldGet6(this, _MediaController_audioLevel, "f"));
13128
+ if (__classPrivateFieldGet8(this, _MediaController_onAudioLevelChange, "f")) {
13129
+ __classPrivateFieldGet8(this, _MediaController_onAudioLevelChange, "f").call(this, __classPrivateFieldGet8(this, _MediaController_audioLevel, "f"));
13082
13130
  }
13083
13131
  }, 150), "f");
13084
13132
  }
13085
13133
  stopAudioLevelMonitoring() {
13086
- if (__classPrivateFieldGet6(this, _MediaController_visualiserInterval, "f")) {
13087
- clearInterval(__classPrivateFieldGet6(this, _MediaController_visualiserInterval, "f"));
13134
+ if (__classPrivateFieldGet8(this, _MediaController_visualiserInterval, "f")) {
13135
+ clearInterval(__classPrivateFieldGet8(this, _MediaController_visualiserInterval, "f"));
13088
13136
  __classPrivateFieldSet5(this, _MediaController_visualiserInterval, void 0, "f");
13089
13137
  }
13090
13138
  __classPrivateFieldSet5(this, _MediaController_audioLevel, 0, "f");
13091
13139
  this.host.requestUpdate();
13092
- if (__classPrivateFieldGet6(this, _MediaController_onAudioLevelChange, "f")) {
13093
- __classPrivateFieldGet6(this, _MediaController_onAudioLevelChange, "f").call(this, __classPrivateFieldGet6(this, _MediaController_audioLevel, "f"));
13140
+ if (__classPrivateFieldGet8(this, _MediaController_onAudioLevelChange, "f")) {
13141
+ __classPrivateFieldGet8(this, _MediaController_onAudioLevelChange, "f").call(this, __classPrivateFieldGet8(this, _MediaController_audioLevel, "f"));
13094
13142
  }
13095
13143
  }
13096
13144
  async cleanup() {
13097
13145
  this.stopAudioLevelMonitoring();
13098
- if (__classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f")?.state === "recording") {
13099
- __classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f").stop();
13146
+ if (__classPrivateFieldGet8(this, _MediaController_mediaRecorder, "f")?.state === "recording") {
13147
+ __classPrivateFieldGet8(this, _MediaController_mediaRecorder, "f").stop();
13100
13148
  }
13101
- if (__classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f")) {
13102
- __classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f").ondataavailable = null;
13149
+ if (__classPrivateFieldGet8(this, _MediaController_mediaRecorder, "f")) {
13150
+ __classPrivateFieldGet8(this, _MediaController_mediaRecorder, "f").ondataavailable = null;
13103
13151
  }
13104
- if (__classPrivateFieldGet6(this, _MediaController_mediaStream, "f")) {
13105
- __classPrivateFieldGet6(this, _MediaController_mediaStream, "f").getTracks().forEach((track) => {
13152
+ if (__classPrivateFieldGet8(this, _MediaController_mediaStream, "f")) {
13153
+ __classPrivateFieldGet8(this, _MediaController_mediaStream, "f").getTracks().forEach((track) => {
13106
13154
  track.stop();
13107
13155
  });
13108
13156
  __classPrivateFieldSet5(this, _MediaController_mediaStream, null, "f");
13109
13157
  }
13110
- if (__classPrivateFieldGet6(this, _MediaController_audioContext, "f") && __classPrivateFieldGet6(this, _MediaController_audioContext, "f").state !== "closed") {
13111
- await __classPrivateFieldGet6(this, _MediaController_audioContext, "f").close();
13158
+ if (__classPrivateFieldGet8(this, _MediaController_audioContext, "f") && __classPrivateFieldGet8(this, _MediaController_audioContext, "f").state !== "closed") {
13159
+ await __classPrivateFieldGet8(this, _MediaController_audioContext, "f").close();
13112
13160
  }
13113
13161
  __classPrivateFieldSet5(this, _MediaController_audioContext, null, "f");
13114
13162
  __classPrivateFieldSet5(this, _MediaController_analyser, null, "f");
@@ -13123,27 +13171,27 @@ var MediaController = class {
13123
13171
  */
13124
13172
  async stopRecording() {
13125
13173
  return new Promise((resolve) => {
13126
- if (!__classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f") || __classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f").state !== "recording") {
13174
+ if (!__classPrivateFieldGet8(this, _MediaController_mediaRecorder, "f") || __classPrivateFieldGet8(this, _MediaController_mediaRecorder, "f").state !== "recording") {
13127
13175
  resolve();
13128
13176
  return;
13129
13177
  }
13130
- __classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f").onstop = () => {
13178
+ __classPrivateFieldGet8(this, _MediaController_mediaRecorder, "f").onstop = () => {
13131
13179
  resolve();
13132
13180
  };
13133
- __classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f").stop();
13181
+ __classPrivateFieldGet8(this, _MediaController_mediaRecorder, "f").stop();
13134
13182
  });
13135
13183
  }
13136
13184
  get mediaRecorder() {
13137
- return __classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f");
13185
+ return __classPrivateFieldGet8(this, _MediaController_mediaRecorder, "f");
13138
13186
  }
13139
13187
  get audioLevel() {
13140
- return __classPrivateFieldGet6(this, _MediaController_audioLevel, "f");
13188
+ return __classPrivateFieldGet8(this, _MediaController_audioLevel, "f");
13141
13189
  }
13142
13190
  };
13143
13191
  _MediaController_mediaStream = /* @__PURE__ */ new WeakMap(), _MediaController_audioContext = /* @__PURE__ */ new WeakMap(), _MediaController_analyser = /* @__PURE__ */ new WeakMap(), _MediaController_mediaRecorder = /* @__PURE__ */ new WeakMap(), _MediaController_visualiserInterval = /* @__PURE__ */ new WeakMap(), _MediaController_audioLevel = /* @__PURE__ */ new WeakMap(), _MediaController_onTrackEnded = /* @__PURE__ */ new WeakMap(), _MediaController_onAudioLevelChange = /* @__PURE__ */ new WeakMap(), _MediaController_dataHandler = /* @__PURE__ */ new WeakMap();
13144
13192
 
13145
13193
  // dist/styles/buttons.js
13146
- var ButtonStyles = i`
13194
+ var ButtonStyles = i2`
13147
13195
  /* Default (plain) button styling */
13148
13196
  button {
13149
13197
  background: var(--action-plain-background, transparent);
@@ -13194,15 +13242,59 @@ var ButtonStyles = i`
13194
13242
  var buttons_default = ButtonStyles;
13195
13243
 
13196
13244
  // dist/styles/recording-button.js
13197
- var RecordingButtonStyles = i`
13245
+ var RecordingButtonStyles = i2`
13198
13246
  :host {
13199
13247
  display: inline-flex;
13200
13248
  }
13201
13249
  `;
13202
13250
  var recording_button_default = RecordingButtonStyles;
13203
13251
 
13252
+ // node_modules/lit-html/directive.js
13253
+ var t5 = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 };
13254
+ var e7 = (t7) => (...e10) => ({ _$litDirective$: t7, values: e10 });
13255
+ var i6 = class {
13256
+ constructor(t7) {
13257
+ }
13258
+ get _$AU() {
13259
+ return this._$AM._$AU;
13260
+ }
13261
+ _$AT(t7, e10, i7) {
13262
+ this._$Ct = t7, this._$AM = e10, this._$Ci = i7;
13263
+ }
13264
+ _$AS(t7, e10) {
13265
+ return this.update(t7, e10);
13266
+ }
13267
+ update(t7, e10) {
13268
+ return this.render(...e10);
13269
+ }
13270
+ };
13271
+
13272
+ // node_modules/lit-html/directives/class-map.js
13273
+ var e8 = e7(class extends i6 {
13274
+ constructor(t7) {
13275
+ if (super(t7), t7.type !== t5.ATTRIBUTE || "class" !== t7.name || t7.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
13276
+ }
13277
+ render(t7) {
13278
+ return " " + Object.keys(t7).filter((s8) => t7[s8]).join(" ") + " ";
13279
+ }
13280
+ update(s8, [i7]) {
13281
+ if (void 0 === this.st) {
13282
+ this.st = /* @__PURE__ */ new Set(), void 0 !== s8.strings && (this.nt = new Set(s8.strings.join(" ").split(/\s/).filter((t7) => "" !== t7)));
13283
+ for (const t7 in i7) i7[t7] && !this.nt?.has(t7) && this.st.add(t7);
13284
+ return this.render(i7);
13285
+ }
13286
+ const r7 = s8.element.classList;
13287
+ for (const t7 of this.st) t7 in i7 || (r7.remove(t7), this.st.delete(t7));
13288
+ for (const t7 in i7) {
13289
+ const s9 = !!i7[t7];
13290
+ s9 === this.st.has(t7) || this.nt?.has(t7) || (s9 ? (r7.add(t7), this.st.add(t7)) : (r7.remove(t7), this.st.delete(t7)));
13291
+ }
13292
+ return T;
13293
+ }
13294
+ });
13295
+
13204
13296
  // node_modules/lit-html/directives/map.js
13205
- function* o8(o10, f5) {
13297
+ function* o6(o10, f5) {
13206
13298
  if (void 0 !== o10) {
13207
13299
  let i7 = 0;
13208
13300
  for (const t7 of o10) yield f5(t7, i7++);
@@ -13210,14 +13302,14 @@ function* o8(o10, f5) {
13210
13302
  }
13211
13303
 
13212
13304
  // node_modules/lit-html/directives/range.js
13213
- function* o9(o10, t7, e10 = 1) {
13305
+ function* o7(o10, t7, e10 = 1) {
13214
13306
  const i7 = void 0 === t7 ? 0 : o10;
13215
13307
  t7 ??= o10;
13216
13308
  for (let o11 = i7; e10 > 0 ? o11 < t7 : t7 < o11; o11 += e10) yield o11;
13217
13309
  }
13218
13310
 
13219
13311
  // dist/styles/audio-visualiser.js
13220
- var AudioVisualiserStyles = i`
13312
+ var AudioVisualiserStyles = i2`
13221
13313
  :host {
13222
13314
  height: 100%;
13223
13315
  }
@@ -13258,13 +13350,13 @@ function normalizeToRange(value, min = 0, max = 1) {
13258
13350
  }
13259
13351
 
13260
13352
  // dist/components/audio-visualiser.js
13261
- var __decorate2 = function(decorators, target, key, desc) {
13353
+ var __decorate10 = function(decorators, target, key, desc) {
13262
13354
  var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
13263
13355
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
13264
13356
  else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
13265
13357
  return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
13266
13358
  };
13267
- var DictationAudioVisualiser = class DictationAudioVisualiser2 extends i4 {
13359
+ var DictationAudioVisualiser = class DictationAudioVisualiser2 extends i5 {
13268
13360
  constructor() {
13269
13361
  super(...arguments);
13270
13362
  this.level = 0;
@@ -13278,12 +13370,12 @@ var DictationAudioVisualiser = class DictationAudioVisualiser2 extends i4 {
13278
13370
  }
13279
13371
  render() {
13280
13372
  const activeSegments = Math.round(this.level * this.segmentCount);
13281
- const segments = o8(o9(this.segmentCount), (i7) => x`<div class=${e6({
13373
+ const segments = o6(o7(this.segmentCount), (i7) => x`<div class=${e8({
13282
13374
  active: i7 < activeSegments,
13283
13375
  segment: true
13284
13376
  })} />`);
13285
13377
  return x`
13286
- <div class=${e6({
13378
+ <div class=${e8({
13287
13379
  active: this.active,
13288
13380
  container: true
13289
13381
  })}>
@@ -13293,27 +13385,27 @@ var DictationAudioVisualiser = class DictationAudioVisualiser2 extends i4 {
13293
13385
  }
13294
13386
  };
13295
13387
  DictationAudioVisualiser.styles = audio_visualiser_default;
13296
- __decorate2([
13388
+ __decorate10([
13297
13389
  n4({ type: Number })
13298
13390
  ], DictationAudioVisualiser.prototype, "level", void 0);
13299
- __decorate2([
13391
+ __decorate10([
13300
13392
  n4({ type: Boolean })
13301
13393
  ], DictationAudioVisualiser.prototype, "active", void 0);
13302
- __decorate2([
13394
+ __decorate10([
13303
13395
  n4({ type: Number })
13304
13396
  ], DictationAudioVisualiser.prototype, "segmentCount", void 0);
13305
- DictationAudioVisualiser = __decorate2([
13306
- t3("dictation-audio-visualiser")
13397
+ DictationAudioVisualiser = __decorate10([
13398
+ t2("dictation-audio-visualiser")
13307
13399
  ], DictationAudioVisualiser);
13308
13400
 
13309
13401
  // dist/icons/icons.js
13310
- var __decorate3 = function(decorators, target, key, desc) {
13402
+ var __decorate11 = function(decorators, target, key, desc) {
13311
13403
  var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
13312
13404
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
13313
13405
  else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
13314
13406
  return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
13315
13407
  };
13316
- var IconMicOn = class IconMicOn2 extends i4 {
13408
+ var IconMicOn = class IconMicOn2 extends i5 {
13317
13409
  render() {
13318
13410
  return x`
13319
13411
  <div style="display: flex">
@@ -13337,10 +13429,10 @@ var IconMicOn = class IconMicOn2 extends i4 {
13337
13429
  `;
13338
13430
  }
13339
13431
  };
13340
- IconMicOn = __decorate3([
13341
- t3("icon-mic-on")
13432
+ IconMicOn = __decorate11([
13433
+ t2("icon-mic-on")
13342
13434
  ], IconMicOn);
13343
- var IconMicOff = class IconMicOff2 extends i4 {
13435
+ var IconMicOff = class IconMicOff2 extends i5 {
13344
13436
  render() {
13345
13437
  return x` <div style="display: flex">
13346
13438
  <svg
@@ -13365,10 +13457,10 @@ var IconMicOff = class IconMicOff2 extends i4 {
13365
13457
  </div>`;
13366
13458
  }
13367
13459
  };
13368
- IconMicOff = __decorate3([
13369
- t3("icon-mic-off")
13460
+ IconMicOff = __decorate11([
13461
+ t2("icon-mic-off")
13370
13462
  ], IconMicOff);
13371
- var IconRecording = class IconRecording2 extends i4 {
13463
+ var IconRecording = class IconRecording2 extends i5 {
13372
13464
  render() {
13373
13465
  return x`
13374
13466
  <div style="display: flex;">
@@ -13391,10 +13483,10 @@ var IconRecording = class IconRecording2 extends i4 {
13391
13483
  `;
13392
13484
  }
13393
13485
  };
13394
- IconRecording = __decorate3([
13395
- t3("icon-recording")
13486
+ IconRecording = __decorate11([
13487
+ t2("icon-recording")
13396
13488
  ], IconRecording);
13397
- var IconSettings = class IconSettings2 extends i4 {
13489
+ var IconSettings = class IconSettings2 extends i5 {
13398
13490
  render() {
13399
13491
  return x`<div style="display: flex">
13400
13492
  <svg
@@ -13417,10 +13509,10 @@ var IconSettings = class IconSettings2 extends i4 {
13417
13509
  </div>`;
13418
13510
  }
13419
13511
  };
13420
- IconSettings = __decorate3([
13421
- t3("icon-settings")
13512
+ IconSettings = __decorate11([
13513
+ t2("icon-settings")
13422
13514
  ], IconSettings);
13423
- var IconLoadingSpinner = class IconLoadingSpinner2 extends i4 {
13515
+ var IconLoadingSpinner = class IconLoadingSpinner2 extends i5 {
13424
13516
  render() {
13425
13517
  return x`<div style="display: flex">
13426
13518
  <svg
@@ -13440,7 +13532,7 @@ var IconLoadingSpinner = class IconLoadingSpinner2 extends i4 {
13440
13532
  </div>`;
13441
13533
  }
13442
13534
  };
13443
- IconLoadingSpinner.styles = i`
13535
+ IconLoadingSpinner.styles = i2`
13444
13536
  @keyframes spin {
13445
13537
  0% {
13446
13538
  transform: rotate(0deg);
@@ -13453,18 +13545,18 @@ IconLoadingSpinner.styles = i`
13453
13545
  animation: spin 1s linear infinite;
13454
13546
  }
13455
13547
  `;
13456
- IconLoadingSpinner = __decorate3([
13457
- t3("icon-loading-spinner")
13548
+ IconLoadingSpinner = __decorate11([
13549
+ t2("icon-loading-spinner")
13458
13550
  ], IconLoadingSpinner);
13459
13551
 
13460
- // dist/components/recording-button.js
13461
- var __decorate4 = function(decorators, target, key, desc) {
13552
+ // dist/components/recording-button-base.js
13553
+ var __decorate12 = function(decorators, target, key, desc) {
13462
13554
  var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
13463
13555
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
13464
13556
  else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
13465
13557
  return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
13466
13558
  };
13467
- var __classPrivateFieldGet7 = function(receiver, state, kind, f5) {
13559
+ var __classPrivateFieldGet9 = function(receiver, state, kind, f5) {
13468
13560
  if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
13469
13561
  if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
13470
13562
  return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
@@ -13475,41 +13567,39 @@ var __classPrivateFieldSet6 = function(receiver, state, value, kind, f5) {
13475
13567
  if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
13476
13568
  return kind === "a" ? f5.call(receiver, value) : f5 ? f5.value = value : state.set(receiver, value), value;
13477
13569
  };
13478
- var _DictationRecordingButton_instances;
13479
- var _DictationRecordingButton_mediaController;
13480
- var _DictationRecordingButton_dictationController;
13481
- var _DictationRecordingButton_keybindingController;
13482
- var _DictationRecordingButton_closeConnectionOnInit;
13483
- var _DictationRecordingButton_processing;
13484
- var _DictationRecordingButton_connection;
13485
- var _DictationRecordingButton_handleClick;
13486
- var _DictationRecordingButton_handleWebSocketMessage;
13487
- var _DictationRecordingButton_handleWebSocketError;
13488
- var _DictationRecordingButton_handleWebSocketClose;
13489
- var _DictationRecordingButton_dispatchRecordingStateChanged;
13490
- var _DictationRecordingButton_handleStart;
13491
- var _DictationRecordingButton_handleStop;
13492
- var DictationRecordingButton = class DictationRecordingButton2 extends i4 {
13570
+ var _RecordingButtonBase_instances;
13571
+ var _RecordingButtonBase_mediaController;
13572
+ var _RecordingButtonBase_keybindingController;
13573
+ var _RecordingButtonBase_closeConnectionOnInit;
13574
+ var _RecordingButtonBase_processing;
13575
+ var _RecordingButtonBase_connection;
13576
+ var _RecordingButtonBase_handleClick;
13577
+ var _RecordingButtonBase_handleWebSocketMessage;
13578
+ var _RecordingButtonBase_handleWebSocketError;
13579
+ var _RecordingButtonBase_handleWebSocketClose;
13580
+ var _RecordingButtonBase_dispatchRecordingStateChanged;
13581
+ var _RecordingButtonBase_handleStart;
13582
+ var _RecordingButtonBase_handleStop;
13583
+ var RecordingButtonBase = class extends i5 {
13493
13584
  constructor() {
13494
13585
  super(...arguments);
13495
- _DictationRecordingButton_instances.add(this);
13586
+ _RecordingButtonBase_instances.add(this);
13496
13587
  this._recordingState = "stopped";
13497
13588
  this.allowButtonFocus = false;
13498
- _DictationRecordingButton_mediaController.set(this, new MediaController(this));
13499
- _DictationRecordingButton_dictationController.set(this, new DictationController(this));
13500
- _DictationRecordingButton_keybindingController.set(this, new KeybindingController(this));
13501
- _DictationRecordingButton_closeConnectionOnInit.set(this, false);
13502
- _DictationRecordingButton_processing.set(this, false);
13503
- _DictationRecordingButton_connection.set(this, "CLOSED");
13504
- _DictationRecordingButton_handleWebSocketMessage.set(this, (message) => {
13589
+ _RecordingButtonBase_mediaController.set(this, new MediaController(this));
13590
+ _RecordingButtonBase_keybindingController.set(this, new KeybindingController(this));
13591
+ _RecordingButtonBase_closeConnectionOnInit.set(this, false);
13592
+ _RecordingButtonBase_processing.set(this, false);
13593
+ _RecordingButtonBase_connection.set(this, "CLOSED");
13594
+ _RecordingButtonBase_handleWebSocketMessage.set(this, (message) => {
13505
13595
  switch (message.type) {
13506
13596
  case "CONFIG_DENIED":
13507
13597
  this.dispatchEvent(errorEvent(`Config denied: ${message.reason ?? "Unknown reason"}`));
13508
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
13598
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_handleStop).call(this);
13509
13599
  break;
13510
13600
  case "CONFIG_TIMEOUT":
13511
13601
  this.dispatchEvent(errorEvent("Config timeout"));
13512
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
13602
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_handleStop).call(this);
13513
13603
  break;
13514
13604
  case "transcript":
13515
13605
  this.dispatchEvent(transcriptEvent(message));
@@ -13517,6 +13607,9 @@ var DictationRecordingButton = class DictationRecordingButton2 extends i4 {
13517
13607
  case "command":
13518
13608
  this.dispatchEvent(commandEvent(message));
13519
13609
  break;
13610
+ case "facts":
13611
+ this.dispatchEvent(factsEvent(message));
13612
+ break;
13520
13613
  case "usage":
13521
13614
  this.dispatchEvent(usageEvent(message));
13522
13615
  break;
@@ -13525,36 +13618,41 @@ var DictationRecordingButton = class DictationRecordingButton2 extends i4 {
13525
13618
  break;
13526
13619
  case "error":
13527
13620
  this.dispatchEvent(errorEvent(message.error));
13528
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
13621
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_handleStop).call(this);
13622
+ break;
13623
+ case "ended":
13624
+ case "ENDED":
13625
+ __classPrivateFieldSet6(this, _RecordingButtonBase_processing, false, "f");
13626
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_dispatchRecordingStateChanged).call(this, this._recordingState);
13529
13627
  break;
13530
13628
  case "flushed":
13531
13629
  if (this._recordingState === "stopped" || this._recordingState === "stopping") {
13532
- __classPrivateFieldSet6(this, _DictationRecordingButton_processing, false, "f");
13533
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_dispatchRecordingStateChanged).call(this, this._recordingState);
13630
+ __classPrivateFieldSet6(this, _RecordingButtonBase_processing, false, "f");
13631
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_dispatchRecordingStateChanged).call(this, this._recordingState);
13534
13632
  }
13535
13633
  break;
13536
13634
  }
13537
13635
  });
13538
- _DictationRecordingButton_handleWebSocketError.set(this, (error) => {
13539
- this.dispatchEvent(errorEvent("Socket error: " + error.message));
13540
- __classPrivateFieldSet6(this, _DictationRecordingButton_processing, false, "f");
13541
- __classPrivateFieldSet6(this, _DictationRecordingButton_connection, "CLOSED", "f");
13542
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
13636
+ _RecordingButtonBase_handleWebSocketError.set(this, (error) => {
13637
+ this.dispatchEvent(errorEvent(`Socket error: ${error.message}`));
13638
+ __classPrivateFieldSet6(this, _RecordingButtonBase_processing, false, "f");
13639
+ __classPrivateFieldSet6(this, _RecordingButtonBase_connection, "CLOSED", "f");
13640
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_handleStop).call(this);
13543
13641
  });
13544
- _DictationRecordingButton_handleWebSocketClose.set(this, (event) => {
13545
- if (__classPrivateFieldGet7(this, _DictationRecordingButton_dictationController, "f").isConnectionOpen() || __classPrivateFieldGet7(this, _DictationRecordingButton_dictationController, "f").isConnecting()) {
13642
+ _RecordingButtonBase_handleWebSocketClose.set(this, (event) => {
13643
+ if (this._socketController.isConnectionOpen() || this._socketController.isConnecting()) {
13546
13644
  return;
13547
13645
  }
13548
- __classPrivateFieldSet6(this, _DictationRecordingButton_processing, false, "f");
13549
- __classPrivateFieldSet6(this, _DictationRecordingButton_connection, "CLOSED", "f");
13646
+ __classPrivateFieldSet6(this, _RecordingButtonBase_processing, false, "f");
13647
+ __classPrivateFieldSet6(this, _RecordingButtonBase_connection, "CLOSED", "f");
13550
13648
  this.dispatchEvent(streamClosedEvent(event));
13551
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_dispatchRecordingStateChanged).call(this, this._recordingState);
13649
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_dispatchRecordingStateChanged).call(this, this._recordingState);
13552
13650
  });
13553
13651
  }
13554
13652
  update(changedProperties) {
13555
- if (changedProperties.has("_recordingState") && this._recordingState === "recording" && __classPrivateFieldGet7(this, _DictationRecordingButton_closeConnectionOnInit, "f")) {
13556
- __classPrivateFieldSet6(this, _DictationRecordingButton_closeConnectionOnInit, false, "f");
13557
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
13653
+ if (changedProperties.has("_recordingState") && this._recordingState === "recording" && __classPrivateFieldGet9(this, _RecordingButtonBase_closeConnectionOnInit, "f")) {
13654
+ __classPrivateFieldSet6(this, _RecordingButtonBase_closeConnectionOnInit, false, "f");
13655
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_handleStop).call(this);
13558
13656
  }
13559
13657
  super.update(changedProperties);
13560
13658
  }
@@ -13562,17 +13660,17 @@ var DictationRecordingButton = class DictationRecordingButton2 extends i4 {
13562
13660
  if (this._recordingState !== "stopped") {
13563
13661
  return;
13564
13662
  }
13565
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStart).call(this);
13663
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_handleStart).call(this);
13566
13664
  }
13567
13665
  stopRecording() {
13568
13666
  if (this._recordingState === "stopped" || this._recordingState === "stopping") {
13569
13667
  return;
13570
13668
  }
13571
13669
  if (this._recordingState === "initializing") {
13572
- __classPrivateFieldSet6(this, _DictationRecordingButton_closeConnectionOnInit, true, "f");
13670
+ __classPrivateFieldSet6(this, _RecordingButtonBase_closeConnectionOnInit, true, "f");
13573
13671
  return;
13574
13672
  }
13575
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
13673
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_handleStop).call(this);
13576
13674
  }
13577
13675
  toggleRecording() {
13578
13676
  if (this._recordingState === "stopped") {
@@ -13582,46 +13680,46 @@ var DictationRecordingButton = class DictationRecordingButton2 extends i4 {
13582
13680
  }
13583
13681
  }
13584
13682
  async openConnection() {
13585
- if (this._recordingState !== "stopped" || __classPrivateFieldGet7(this, _DictationRecordingButton_processing, "f")) {
13683
+ if (this._recordingState !== "stopped" || __classPrivateFieldGet9(this, _RecordingButtonBase_processing, "f")) {
13586
13684
  return;
13587
13685
  }
13588
- if (__classPrivateFieldGet7(this, _DictationRecordingButton_dictationController, "f").isConnectionOpen()) {
13686
+ if (this._socketController.isConnectionOpen()) {
13589
13687
  return;
13590
13688
  }
13591
13689
  try {
13592
- __classPrivateFieldSet6(this, _DictationRecordingButton_connection, "CONNECTING", "f");
13593
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_dispatchRecordingStateChanged).call(this, this._recordingState);
13594
- await __classPrivateFieldGet7(this, _DictationRecordingButton_dictationController, "f").connect(this._dictationConfig, {
13595
- onClose: __classPrivateFieldGet7(this, _DictationRecordingButton_handleWebSocketClose, "f"),
13596
- onError: __classPrivateFieldGet7(this, _DictationRecordingButton_handleWebSocketError, "f"),
13597
- onMessage: __classPrivateFieldGet7(this, _DictationRecordingButton_handleWebSocketMessage, "f"),
13690
+ __classPrivateFieldSet6(this, _RecordingButtonBase_connection, "CONNECTING", "f");
13691
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_dispatchRecordingStateChanged).call(this, this._recordingState);
13692
+ await this._socketController.connect(this._getConnectConfig(), {
13693
+ onClose: __classPrivateFieldGet9(this, _RecordingButtonBase_handleWebSocketClose, "f"),
13694
+ onError: __classPrivateFieldGet9(this, _RecordingButtonBase_handleWebSocketError, "f"),
13695
+ onMessage: __classPrivateFieldGet9(this, _RecordingButtonBase_handleWebSocketMessage, "f"),
13598
13696
  onNetworkActivity: (direction, data) => {
13599
13697
  this.dispatchEvent(networkActivityEvent(direction, data));
13600
13698
  }
13601
13699
  });
13602
- __classPrivateFieldSet6(this, _DictationRecordingButton_connection, "OPEN", "f");
13603
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_dispatchRecordingStateChanged).call(this, this._recordingState);
13700
+ __classPrivateFieldSet6(this, _RecordingButtonBase_connection, "OPEN", "f");
13701
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_dispatchRecordingStateChanged).call(this, this._recordingState);
13604
13702
  } catch (error) {
13605
- __classPrivateFieldSet6(this, _DictationRecordingButton_connection, "CLOSED", "f");
13703
+ __classPrivateFieldSet6(this, _RecordingButtonBase_connection, "CLOSED", "f");
13606
13704
  this.dispatchEvent(errorEvent(error));
13607
13705
  }
13608
13706
  }
13609
13707
  async closeConnection() {
13610
- if (this._recordingState !== "stopped" || __classPrivateFieldGet7(this, _DictationRecordingButton_processing, "f")) {
13708
+ if (this._recordingState !== "stopped" || __classPrivateFieldGet9(this, _RecordingButtonBase_processing, "f")) {
13611
13709
  return;
13612
13710
  }
13613
- if (__classPrivateFieldGet7(this, _DictationRecordingButton_dictationController, "f").isConnecting()) {
13614
- await __classPrivateFieldGet7(this, _DictationRecordingButton_dictationController, "f").waitForConnection();
13711
+ if (this._socketController.isConnecting()) {
13712
+ await this._socketController.waitForConnection();
13615
13713
  }
13616
- if (!__classPrivateFieldGet7(this, _DictationRecordingButton_dictationController, "f").isConnectionOpen()) {
13617
- __classPrivateFieldSet6(this, _DictationRecordingButton_connection, "CLOSED", "f");
13618
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_dispatchRecordingStateChanged).call(this, "stopped");
13714
+ if (!this._socketController.isConnectionOpen()) {
13715
+ __classPrivateFieldSet6(this, _RecordingButtonBase_connection, "CLOSED", "f");
13716
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_dispatchRecordingStateChanged).call(this, "stopped");
13619
13717
  return;
13620
13718
  }
13621
13719
  try {
13622
- __classPrivateFieldSet6(this, _DictationRecordingButton_connection, "CLOSING", "f");
13623
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_dispatchRecordingStateChanged).call(this, "stopped");
13624
- await __classPrivateFieldGet7(this, _DictationRecordingButton_dictationController, "f").closeConnection(__classPrivateFieldGet7(this, _DictationRecordingButton_handleWebSocketClose, "f"));
13720
+ __classPrivateFieldSet6(this, _RecordingButtonBase_connection, "CLOSING", "f");
13721
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_dispatchRecordingStateChanged).call(this, "stopped");
13722
+ await this._socketController.closeConnection(__classPrivateFieldGet9(this, _RecordingButtonBase_handleWebSocketClose, "f"));
13625
13723
  } catch (error) {
13626
13724
  this.dispatchEvent(errorEvent(error));
13627
13725
  }
@@ -13631,7 +13729,7 @@ var DictationRecordingButton = class DictationRecordingButton2 extends i4 {
13631
13729
  const isRecording = this._recordingState === "recording";
13632
13730
  return x`
13633
13731
  <button
13634
- @click=${__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleClick)}
13732
+ @click=${__classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_handleClick)}
13635
13733
  ?disabled=${isLoading}
13636
13734
  class=${isRecording ? "red" : "accent"}
13637
13735
  aria-label=${isRecording ? "Stop recording" : "Start recording"}
@@ -13639,57 +13737,45 @@ var DictationRecordingButton = class DictationRecordingButton2 extends i4 {
13639
13737
  >
13640
13738
  ${isLoading ? x`<icon-loading-spinner />` : isRecording ? x`<icon-recording />` : x`<icon-mic-on />`}
13641
13739
  <dictation-audio-visualiser
13642
- .level=${__classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").audioLevel}
13740
+ .level=${__classPrivateFieldGet9(this, _RecordingButtonBase_mediaController, "f").audioLevel}
13643
13741
  ?active=${isRecording}
13644
13742
  />
13645
13743
  </button>
13646
13744
  `;
13647
13745
  }
13648
13746
  };
13649
- _DictationRecordingButton_mediaController = /* @__PURE__ */ new WeakMap();
13650
- _DictationRecordingButton_dictationController = /* @__PURE__ */ new WeakMap();
13651
- _DictationRecordingButton_keybindingController = /* @__PURE__ */ new WeakMap();
13652
- _DictationRecordingButton_closeConnectionOnInit = /* @__PURE__ */ new WeakMap();
13653
- _DictationRecordingButton_processing = /* @__PURE__ */ new WeakMap();
13654
- _DictationRecordingButton_connection = /* @__PURE__ */ new WeakMap();
13655
- _DictationRecordingButton_handleWebSocketMessage = /* @__PURE__ */ new WeakMap();
13656
- _DictationRecordingButton_handleWebSocketError = /* @__PURE__ */ new WeakMap();
13657
- _DictationRecordingButton_handleWebSocketClose = /* @__PURE__ */ new WeakMap();
13658
- _DictationRecordingButton_instances = /* @__PURE__ */ new WeakSet();
13659
- _DictationRecordingButton_handleClick = function _DictationRecordingButton_handleClick2(event) {
13747
+ _RecordingButtonBase_mediaController = /* @__PURE__ */ new WeakMap(), _RecordingButtonBase_keybindingController = /* @__PURE__ */ new WeakMap(), _RecordingButtonBase_closeConnectionOnInit = /* @__PURE__ */ new WeakMap(), _RecordingButtonBase_processing = /* @__PURE__ */ new WeakMap(), _RecordingButtonBase_connection = /* @__PURE__ */ new WeakMap(), _RecordingButtonBase_handleWebSocketMessage = /* @__PURE__ */ new WeakMap(), _RecordingButtonBase_handleWebSocketError = /* @__PURE__ */ new WeakMap(), _RecordingButtonBase_handleWebSocketClose = /* @__PURE__ */ new WeakMap(), _RecordingButtonBase_instances = /* @__PURE__ */ new WeakSet(), _RecordingButtonBase_handleClick = function _RecordingButtonBase_handleClick2(event) {
13660
13748
  if (!this.allowButtonFocus) {
13661
13749
  event.preventDefault();
13662
13750
  }
13663
13751
  this.toggleRecording();
13664
- };
13665
- _DictationRecordingButton_dispatchRecordingStateChanged = function _DictationRecordingButton_dispatchRecordingStateChanged2(state) {
13752
+ }, _RecordingButtonBase_dispatchRecordingStateChanged = function _RecordingButtonBase_dispatchRecordingStateChanged2(state) {
13666
13753
  this.dispatchEvent(recordingStateChangedEvent(state, {
13667
- connection: __classPrivateFieldGet7(this, _DictationRecordingButton_connection, "f"),
13668
- processing: __classPrivateFieldGet7(this, _DictationRecordingButton_processing, "f")
13754
+ connection: __classPrivateFieldGet9(this, _RecordingButtonBase_connection, "f"),
13755
+ processing: __classPrivateFieldGet9(this, _RecordingButtonBase_processing, "f")
13669
13756
  }));
13670
- };
13671
- _DictationRecordingButton_handleStart = async function _DictationRecordingButton_handleStart2() {
13672
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_dispatchRecordingStateChanged).call(this, "initializing");
13757
+ }, _RecordingButtonBase_handleStart = async function _RecordingButtonBase_handleStart2() {
13758
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_dispatchRecordingStateChanged).call(this, "initializing");
13673
13759
  try {
13674
- await __classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").initialize(() => {
13760
+ await __classPrivateFieldGet9(this, _RecordingButtonBase_mediaController, "f").initialize(() => {
13675
13761
  if (this._recordingState === "recording") {
13676
13762
  this.dispatchEvent(errorEvent("Recording device access was lost."));
13677
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
13763
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_handleStop).call(this);
13678
13764
  }
13679
- }, __classPrivateFieldGet7(this, _DictationRecordingButton_dictationController, "f").mediaRecorderHandler);
13680
- __classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").mediaRecorder?.start(AUDIO_CHUNK_INTERVAL_MS);
13681
- __classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").startAudioLevelMonitoring((level) => {
13765
+ }, this._socketController.mediaRecorderHandler);
13766
+ __classPrivateFieldGet9(this, _RecordingButtonBase_mediaController, "f").mediaRecorder?.start(AUDIO_CHUNK_INTERVAL_MS);
13767
+ __classPrivateFieldGet9(this, _RecordingButtonBase_mediaController, "f").startAudioLevelMonitoring((level) => {
13682
13768
  this.dispatchEvent(audioLevelChangedEvent(level));
13683
13769
  });
13684
- __classPrivateFieldSet6(this, _DictationRecordingButton_processing, true, "f");
13685
- if (__classPrivateFieldGet7(this, _DictationRecordingButton_connection, "f") !== "OPEN") {
13686
- __classPrivateFieldSet6(this, _DictationRecordingButton_connection, "CONNECTING", "f");
13770
+ __classPrivateFieldSet6(this, _RecordingButtonBase_processing, true, "f");
13771
+ if (__classPrivateFieldGet9(this, _RecordingButtonBase_connection, "f") !== "OPEN") {
13772
+ __classPrivateFieldSet6(this, _RecordingButtonBase_connection, "CONNECTING", "f");
13687
13773
  }
13688
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_dispatchRecordingStateChanged).call(this, "recording");
13689
- const isNewConnection = await __classPrivateFieldGet7(this, _DictationRecordingButton_dictationController, "f").connect(this._dictationConfig, {
13690
- onClose: __classPrivateFieldGet7(this, _DictationRecordingButton_handleWebSocketClose, "f"),
13691
- onError: __classPrivateFieldGet7(this, _DictationRecordingButton_handleWebSocketError, "f"),
13692
- onMessage: __classPrivateFieldGet7(this, _DictationRecordingButton_handleWebSocketMessage, "f"),
13774
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_dispatchRecordingStateChanged).call(this, "recording");
13775
+ const isNewConnection = await this._socketController.connect(this._getConnectConfig(), {
13776
+ onClose: __classPrivateFieldGet9(this, _RecordingButtonBase_handleWebSocketClose, "f"),
13777
+ onError: __classPrivateFieldGet9(this, _RecordingButtonBase_handleWebSocketError, "f"),
13778
+ onMessage: __classPrivateFieldGet9(this, _RecordingButtonBase_handleWebSocketMessage, "f"),
13693
13779
  onNetworkActivity: (direction, data) => {
13694
13780
  this.dispatchEvent(networkActivityEvent(direction, data));
13695
13781
  }
@@ -13697,83 +13783,404 @@ _DictationRecordingButton_handleStart = async function _DictationRecordingButton
13697
13783
  if (isNewConnection === "superseded") {
13698
13784
  return;
13699
13785
  }
13700
- __classPrivateFieldSet6(this, _DictationRecordingButton_connection, "OPEN", "f");
13701
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_dispatchRecordingStateChanged).call(this, this._recordingState);
13786
+ __classPrivateFieldSet6(this, _RecordingButtonBase_connection, "OPEN", "f");
13787
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_dispatchRecordingStateChanged).call(this, this._recordingState);
13702
13788
  } catch (error) {
13703
13789
  this.dispatchEvent(errorEvent(error));
13704
- await __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
13790
+ await __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_handleStop).call(this);
13705
13791
  }
13706
- };
13707
- _DictationRecordingButton_handleStop = async function _DictationRecordingButton_handleStop2() {
13708
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_dispatchRecordingStateChanged).call(this, "stopping");
13792
+ }, _RecordingButtonBase_handleStop = async function _RecordingButtonBase_handleStop2() {
13793
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_dispatchRecordingStateChanged).call(this, "stopping");
13709
13794
  try {
13710
- __classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").stopAudioLevelMonitoring();
13711
- await __classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").stopRecording();
13712
- __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_dispatchRecordingStateChanged).call(this, "stopped");
13713
- await __classPrivateFieldGet7(this, _DictationRecordingButton_dictationController, "f").pause();
13714
- await __classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").cleanup();
13795
+ __classPrivateFieldGet9(this, _RecordingButtonBase_mediaController, "f").stopAudioLevelMonitoring();
13796
+ await __classPrivateFieldGet9(this, _RecordingButtonBase_mediaController, "f").stopRecording();
13797
+ await this._socketController.stopRecording();
13798
+ await __classPrivateFieldGet9(this, _RecordingButtonBase_mediaController, "f").cleanup();
13715
13799
  } catch (error) {
13716
13800
  this.dispatchEvent(errorEvent(error));
13717
13801
  }
13802
+ __classPrivateFieldGet9(this, _RecordingButtonBase_instances, "m", _RecordingButtonBase_dispatchRecordingStateChanged).call(this, "stopped");
13803
+ };
13804
+ RecordingButtonBase.styles = [recording_button_default, buttons_default];
13805
+ __decorate12([
13806
+ c({ context: recordingStateContext, subscribe: true }),
13807
+ r4()
13808
+ ], RecordingButtonBase.prototype, "_recordingState", void 0);
13809
+ __decorate12([
13810
+ c({ context: selectedDeviceContext, subscribe: true }),
13811
+ r4()
13812
+ ], RecordingButtonBase.prototype, "_selectedDevice", void 0);
13813
+ __decorate12([
13814
+ c({ context: accessTokenContext, subscribe: true }),
13815
+ r4()
13816
+ ], RecordingButtonBase.prototype, "_accessToken", void 0);
13817
+ __decorate12([
13818
+ c({ context: authConfigContext, subscribe: true }),
13819
+ r4()
13820
+ ], RecordingButtonBase.prototype, "_authConfig", void 0);
13821
+ __decorate12([
13822
+ c({ context: regionContext, subscribe: true }),
13823
+ r4()
13824
+ ], RecordingButtonBase.prototype, "_region", void 0);
13825
+ __decorate12([
13826
+ c({ context: tenantNameContext, subscribe: true }),
13827
+ r4()
13828
+ ], RecordingButtonBase.prototype, "_tenantName", void 0);
13829
+ __decorate12([
13830
+ c({ context: socketUrlContext, subscribe: true }),
13831
+ r4()
13832
+ ], RecordingButtonBase.prototype, "_socketUrl", void 0);
13833
+ __decorate12([
13834
+ c({ context: socketProxyContext, subscribe: true }),
13835
+ r4()
13836
+ ], RecordingButtonBase.prototype, "_socketProxy", void 0);
13837
+ __decorate12([
13838
+ c({ context: debugDisplayAudioContext, subscribe: true }),
13839
+ r4()
13840
+ ], RecordingButtonBase.prototype, "_debug_displayAudio", void 0);
13841
+ __decorate12([
13842
+ c({ context: pushToTalkKeybindingContext, subscribe: true }),
13843
+ r4()
13844
+ ], RecordingButtonBase.prototype, "_pushToTalkKeybinding", void 0);
13845
+ __decorate12([
13846
+ c({ context: toggleToTalkKeybindingContext, subscribe: true }),
13847
+ r4()
13848
+ ], RecordingButtonBase.prototype, "_toggleToTalkKeybinding", void 0);
13849
+ __decorate12([
13850
+ n4({ type: Boolean })
13851
+ ], RecordingButtonBase.prototype, "allowButtonFocus", void 0);
13852
+
13853
+ // dist/components/ambient-recording-button.js
13854
+ var __decorate13 = function(decorators, target, key, desc) {
13855
+ var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
13856
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
13857
+ else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
13858
+ return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
13859
+ };
13860
+ var __classPrivateFieldGet10 = function(receiver, state, kind, f5) {
13861
+ if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
13862
+ if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
13863
+ return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
13864
+ };
13865
+ var _AmbientRecordingButton_instances;
13866
+ var _AmbientRecordingButton_trimmedInteractionId;
13867
+ var interactionIdRequiredError = () => new Error("interactionId is required. Set interactionId on ambient-root.");
13868
+ var AmbientRecordingButton = class AmbientRecordingButton2 extends RecordingButtonBase {
13869
+ constructor() {
13870
+ super(...arguments);
13871
+ _AmbientRecordingButton_instances.add(this);
13872
+ this._socketController = new AmbientController(this);
13873
+ }
13874
+ startRecording() {
13875
+ if (!__classPrivateFieldGet10(this, _AmbientRecordingButton_instances, "m", _AmbientRecordingButton_trimmedInteractionId).call(this)) {
13876
+ this.dispatchEvent(errorEvent(interactionIdRequiredError()));
13877
+ return;
13878
+ }
13879
+ super.startRecording();
13880
+ }
13881
+ async openConnection() {
13882
+ if (!__classPrivateFieldGet10(this, _AmbientRecordingButton_instances, "m", _AmbientRecordingButton_trimmedInteractionId).call(this)) {
13883
+ this.dispatchEvent(errorEvent(interactionIdRequiredError()));
13884
+ return;
13885
+ }
13886
+ await super.openConnection();
13887
+ }
13888
+ _getConnectConfig() {
13889
+ const interactionId = __classPrivateFieldGet10(this, _AmbientRecordingButton_instances, "m", _AmbientRecordingButton_trimmedInteractionId).call(this);
13890
+ if (!interactionId) {
13891
+ throw interactionIdRequiredError();
13892
+ }
13893
+ return {
13894
+ configuration: this._ambientConfig ?? DEFAULT_STREAM_CONFIG,
13895
+ interactionId
13896
+ };
13897
+ }
13898
+ };
13899
+ _AmbientRecordingButton_instances = /* @__PURE__ */ new WeakSet();
13900
+ _AmbientRecordingButton_trimmedInteractionId = function _AmbientRecordingButton_trimmedInteractionId2() {
13901
+ return this._interactionId?.trim();
13902
+ };
13903
+ __decorate13([
13904
+ c({ context: ambientConfigContext, subscribe: true }),
13905
+ r4()
13906
+ ], AmbientRecordingButton.prototype, "_ambientConfig", void 0);
13907
+ __decorate13([
13908
+ c({ context: interactionIdContext, subscribe: true }),
13909
+ r4()
13910
+ ], AmbientRecordingButton.prototype, "_interactionId", void 0);
13911
+ AmbientRecordingButton = __decorate13([
13912
+ t2("ambient-recording-button")
13913
+ ], AmbientRecordingButton);
13914
+
13915
+ // node_modules/lit-html/directive-helpers.js
13916
+ var { I: t6 } = Z;
13917
+ var f3 = (o10) => void 0 === o10.strings;
13918
+
13919
+ // node_modules/lit-html/async-directive.js
13920
+ var s7 = (i7, t7) => {
13921
+ const e10 = i7._$AN;
13922
+ if (void 0 === e10) return false;
13923
+ for (const i8 of e10) i8._$AO?.(t7, false), s7(i8, t7);
13924
+ return true;
13925
+ };
13926
+ var o8 = (i7) => {
13927
+ let t7, e10;
13928
+ do {
13929
+ if (void 0 === (t7 = i7._$AM)) break;
13930
+ e10 = t7._$AN, e10.delete(i7), i7 = t7;
13931
+ } while (0 === e10?.size);
13932
+ };
13933
+ var r6 = (i7) => {
13934
+ for (let t7; t7 = i7._$AM; i7 = t7) {
13935
+ let e10 = t7._$AN;
13936
+ if (void 0 === e10) t7._$AN = e10 = /* @__PURE__ */ new Set();
13937
+ else if (e10.has(i7)) break;
13938
+ e10.add(i7), c5(t7);
13939
+ }
13940
+ };
13941
+ function h3(i7) {
13942
+ void 0 !== this._$AN ? (o8(this), this._$AM = i7, r6(this)) : this._$AM = i7;
13943
+ }
13944
+ function n6(i7, t7 = false, e10 = 0) {
13945
+ const r7 = this._$AH, h5 = this._$AN;
13946
+ if (void 0 !== h5 && 0 !== h5.size) if (t7) if (Array.isArray(r7)) for (let i8 = e10; i8 < r7.length; i8++) s7(r7[i8], false), o8(r7[i8]);
13947
+ else null != r7 && (s7(r7, false), o8(r7));
13948
+ else s7(this, i7);
13949
+ }
13950
+ var c5 = (i7) => {
13951
+ i7.type == t5.CHILD && (i7._$AP ??= n6, i7._$AQ ??= h3);
13952
+ };
13953
+ var f4 = class extends i6 {
13954
+ constructor() {
13955
+ super(...arguments), this._$AN = void 0;
13956
+ }
13957
+ _$AT(i7, t7, e10) {
13958
+ super._$AT(i7, t7, e10), r6(this), this.isConnected = i7._$AU;
13959
+ }
13960
+ _$AO(i7, t7 = true) {
13961
+ i7 !== this.isConnected && (this.isConnected = i7, i7 ? this.reconnected?.() : this.disconnected?.()), t7 && (s7(this, i7), o8(this));
13962
+ }
13963
+ setValue(t7) {
13964
+ if (f3(this._$Ct)) this._$Ct._$AI(t7, this);
13965
+ else {
13966
+ const i7 = [...this._$Ct._$AH];
13967
+ i7[this._$Ci] = t7, this._$Ct._$AI(i7, this, 0);
13968
+ }
13969
+ }
13970
+ disconnected() {
13971
+ }
13972
+ reconnected() {
13973
+ }
13974
+ };
13975
+
13976
+ // node_modules/lit-html/directives/ref.js
13977
+ var e9 = () => new h4();
13978
+ var h4 = class {
13979
+ };
13980
+ var o9 = /* @__PURE__ */ new WeakMap();
13981
+ var n7 = e7(class extends f4 {
13982
+ render(i7) {
13983
+ return E;
13984
+ }
13985
+ update(i7, [s8]) {
13986
+ const e10 = s8 !== this.G;
13987
+ return e10 && void 0 !== this.G && this.rt(void 0), (e10 || this.lt !== this.ct) && (this.G = s8, this.ht = i7.options?.host, this.rt(this.ct = i7.element)), E;
13988
+ }
13989
+ rt(t7) {
13990
+ if (this.isConnected || (t7 = void 0), "function" == typeof this.G) {
13991
+ const i7 = this.ht ?? globalThis;
13992
+ let s8 = o9.get(i7);
13993
+ void 0 === s8 && (s8 = /* @__PURE__ */ new WeakMap(), o9.set(i7, s8)), void 0 !== s8.get(this.G) && this.G.call(this.ht, void 0), s8.set(this.G, t7), void 0 !== t7 && this.G.call(this.ht, t7);
13994
+ } else this.G.value = t7;
13995
+ }
13996
+ get lt() {
13997
+ return "function" == typeof this.G ? o9.get(this.ht ?? globalThis)?.get(this.G) : this.G?.value;
13998
+ }
13999
+ disconnected() {
14000
+ this.lt === this.ct && this.rt(void 0);
14001
+ }
14002
+ reconnected() {
14003
+ this.rt(this.ct);
14004
+ }
14005
+ });
14006
+
14007
+ // dist/components/corti-root.js
14008
+ var __decorate14 = function(decorators, target, key, desc) {
14009
+ var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
14010
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
14011
+ else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
14012
+ return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
14013
+ };
14014
+ var CortiRoot = class extends i5 {
14015
+ constructor() {
14016
+ super(...arguments);
14017
+ this.settingsEnabled = ["device", "language"];
14018
+ this.allowButtonFocus = false;
14019
+ this._contextProviderRef = e9();
14020
+ this._recordingButtonRef = e9();
14021
+ }
14022
+ /**
14023
+ * List of all language codes available for use with the Web Component.
14024
+ * Default list depends on the accessToken
14025
+ */
14026
+ set languagesSupported(value) {
14027
+ this._languagesSupported = value;
14028
+ }
14029
+ get languagesSupported() {
14030
+ return this._contextProviderRef.value?.languages || this._languagesSupported || [];
14031
+ }
14032
+ /**
14033
+ * List of available recording devices
14034
+ */
14035
+ set devices(value) {
14036
+ this._devices = value;
14037
+ }
14038
+ get devices() {
14039
+ return this._contextProviderRef.value?.devices || this._devices || [];
14040
+ }
14041
+ /**
14042
+ * The selected device used for recording (MediaDeviceInfo).
14043
+ */
14044
+ set selectedDevice(value) {
14045
+ this._selectedDevice = value;
14046
+ }
14047
+ get selectedDevice() {
14048
+ return this._contextProviderRef.value?.selectedDevice || this._selectedDevice;
14049
+ }
14050
+ /**
14051
+ * Push-to-talk keybinding for keyboard shortcut. Single key only (e.g., "Space", "k", "meta", "ctrl").
14052
+ * Combinations with "+" are not supported.
14053
+ * Keydown starts recording, keyup stops recording.
14054
+ * Defaults to "Space" if keybinding is in settingsEnabled, otherwise undefined
14055
+ */
14056
+ set pushToTalkKeybinding(value) {
14057
+ this._pushToTalkKeybinding = value;
14058
+ }
14059
+ get pushToTalkKeybinding() {
14060
+ return this._contextProviderRef.value?.pushToTalkKeybinding || this._pushToTalkKeybinding;
14061
+ }
14062
+ /**
14063
+ * Toggle-to-talk keybinding for keyboard shortcut. Single key only (e.g., "`", "k", "meta", "ctrl").
14064
+ * Combinations with "+" are not supported.
14065
+ * Pressing the key toggles recording on/off.
14066
+ * Defaults to "`" if keybinding is in settingsEnabled, otherwise undefined
14067
+ */
14068
+ set toggleToTalkKeybinding(value) {
14069
+ this._toggleToTalkKeybinding = value;
14070
+ }
14071
+ get toggleToTalkKeybinding() {
14072
+ return this._contextProviderRef.value?.toggleToTalkKeybinding || this._toggleToTalkKeybinding;
14073
+ }
14074
+ // ─────────────────────────────────────────────────────────────────────────────
14075
+ // Public methods
14076
+ // ─────────────────────────────────────────────────────────────────────────────
14077
+ /**
14078
+ * Current state of recording (stopped, recording, initializing and stopping, ).
14079
+ */
14080
+ get recordingState() {
14081
+ return this._contextProviderRef.value?.recordingState ?? "stopped";
14082
+ }
14083
+ /**
14084
+ * Starts a recording.
14085
+ */
14086
+ startRecording() {
14087
+ this._recordingButtonRef.value?.startRecording();
14088
+ }
14089
+ /**
14090
+ * Stops a recording.
14091
+ */
14092
+ stopRecording() {
14093
+ this._recordingButtonRef.value?.stopRecording();
14094
+ }
14095
+ /**
14096
+ * Starts or stops recording. Convenience layer on top of the start/stop methods.
14097
+ */
14098
+ toggleRecording() {
14099
+ this._recordingButtonRef.value?.toggleRecording();
14100
+ }
14101
+ /**
14102
+ * Opens the WebSocket connection without starting recording.
14103
+ * Use this to pre-establish the connection before recording starts.
14104
+ */
14105
+ async openConnection() {
14106
+ await this._recordingButtonRef.value?.openConnection();
14107
+ }
14108
+ /**
14109
+ * Closes the WebSocket connection by sending "end" and waiting for "ended".
14110
+ * Call this to receive "usage" statistics or when done with the connection.
14111
+ */
14112
+ async closeConnection() {
14113
+ await this._recordingButtonRef.value?.closeConnection();
14114
+ }
14115
+ // ─────────────────────────────────────────────────────────────────────────────
14116
+ // Render
14117
+ // ─────────────────────────────────────────────────────────────────────────────
14118
+ render() {
14119
+ return x``;
14120
+ }
13718
14121
  };
13719
- DictationRecordingButton.styles = [recording_button_default, buttons_default];
13720
- __decorate4([
13721
- c5({ context: recordingStateContext, subscribe: true }),
13722
- r5()
13723
- ], DictationRecordingButton.prototype, "_recordingState", void 0);
13724
- __decorate4([
13725
- c5({ context: selectedDeviceContext, subscribe: true }),
13726
- r5()
13727
- ], DictationRecordingButton.prototype, "_selectedDevice", void 0);
13728
- __decorate4([
13729
- c5({ context: accessTokenContext, subscribe: true }),
13730
- r5()
13731
- ], DictationRecordingButton.prototype, "_accessToken", void 0);
13732
- __decorate4([
13733
- c5({ context: authConfigContext, subscribe: true }),
13734
- r5()
13735
- ], DictationRecordingButton.prototype, "_authConfig", void 0);
13736
- __decorate4([
13737
- c5({ context: regionContext, subscribe: true }),
13738
- r5()
13739
- ], DictationRecordingButton.prototype, "_region", void 0);
13740
- __decorate4([
13741
- c5({ context: tenantNameContext, subscribe: true }),
13742
- r5()
13743
- ], DictationRecordingButton.prototype, "_tenantName", void 0);
13744
- __decorate4([
13745
- c5({ context: dictationConfigContext, subscribe: true }),
13746
- r5()
13747
- ], DictationRecordingButton.prototype, "_dictationConfig", void 0);
13748
- __decorate4([
13749
- c5({ context: socketUrlContext, subscribe: true }),
13750
- r5()
13751
- ], DictationRecordingButton.prototype, "_socketUrl", void 0);
13752
- __decorate4([
13753
- c5({ context: socketProxyContext, subscribe: true }),
13754
- r5()
13755
- ], DictationRecordingButton.prototype, "_socketProxy", void 0);
13756
- __decorate4([
13757
- c5({ context: debugDisplayAudioContext, subscribe: true }),
13758
- r5()
13759
- ], DictationRecordingButton.prototype, "_debug_displayAudio", void 0);
13760
- __decorate4([
13761
- c5({ context: pushToTalkKeybindingContext, subscribe: true }),
13762
- r5()
13763
- ], DictationRecordingButton.prototype, "_pushToTalkKeybinding", void 0);
13764
- __decorate4([
13765
- c5({ context: toggleToTalkKeybindingContext, subscribe: true }),
13766
- r5()
13767
- ], DictationRecordingButton.prototype, "_toggleToTalkKeybinding", void 0);
13768
- __decorate4([
14122
+ CortiRoot.styles = i2`
14123
+ .hidden {
14124
+ display: none;
14125
+ }
14126
+ `;
14127
+ __decorate14([
14128
+ n4({ type: String })
14129
+ ], CortiRoot.prototype, "accessToken", void 0);
14130
+ __decorate14([
14131
+ n4({ attribute: false, type: Object })
14132
+ ], CortiRoot.prototype, "authConfig", void 0);
14133
+ __decorate14([
14134
+ n4({ type: String })
14135
+ ], CortiRoot.prototype, "socketUrl", void 0);
14136
+ __decorate14([
14137
+ n4({ attribute: false, type: Object })
14138
+ ], CortiRoot.prototype, "socketProxy", void 0);
14139
+ __decorate14([
14140
+ n4({
14141
+ converter: commaSeparatedConverter,
14142
+ type: Array
14143
+ })
14144
+ ], CortiRoot.prototype, "settingsEnabled", void 0);
14145
+ __decorate14([
13769
14146
  n4({ type: Boolean })
13770
- ], DictationRecordingButton.prototype, "allowButtonFocus", void 0);
13771
- DictationRecordingButton = __decorate4([
13772
- t3("dictation-recording-button")
13773
- ], DictationRecordingButton);
14147
+ ], CortiRoot.prototype, "allowButtonFocus", void 0);
14148
+ __decorate14([
14149
+ n4({
14150
+ converter: commaSeparatedConverter,
14151
+ type: Array
14152
+ })
14153
+ ], CortiRoot.prototype, "languagesSupported", null);
14154
+ __decorate14([
14155
+ r4()
14156
+ ], CortiRoot.prototype, "_languagesSupported", void 0);
14157
+ __decorate14([
14158
+ n4({ attribute: false, type: Array })
14159
+ ], CortiRoot.prototype, "devices", null);
14160
+ __decorate14([
14161
+ r4()
14162
+ ], CortiRoot.prototype, "_devices", void 0);
14163
+ __decorate14([
14164
+ n4({ attribute: false, type: Object })
14165
+ ], CortiRoot.prototype, "selectedDevice", null);
14166
+ __decorate14([
14167
+ r4()
14168
+ ], CortiRoot.prototype, "_selectedDevice", void 0);
14169
+ __decorate14([
14170
+ n4({ type: String })
14171
+ ], CortiRoot.prototype, "pushToTalkKeybinding", null);
14172
+ __decorate14([
14173
+ r4()
14174
+ ], CortiRoot.prototype, "_pushToTalkKeybinding", void 0);
14175
+ __decorate14([
14176
+ n4({ type: String })
14177
+ ], CortiRoot.prototype, "toggleToTalkKeybinding", null);
14178
+ __decorate14([
14179
+ r4()
14180
+ ], CortiRoot.prototype, "_toggleToTalkKeybinding", void 0);
13774
14181
 
13775
14182
  // dist/styles/callout.js
13776
- var CalloutStyles = i`
14183
+ var CalloutStyles = i2`
13777
14184
  .callout {
13778
14185
  background: var(--callout-info-background, light-dark(#007bff33, #0056b333));
13779
14186
  border: 1px solid var(--callout-info-border, light-dark(#007bff99, #0056b399));
@@ -13796,7 +14203,7 @@ var CalloutStyles = i`
13796
14203
  var callout_default = CalloutStyles;
13797
14204
 
13798
14205
  // dist/styles/settings-menu.js
13799
- var SettingsMenuStyles = i`
14206
+ var SettingsMenuStyles = i2`
13800
14207
  :host {
13801
14208
  display: block;
13802
14209
  }
@@ -13832,7 +14239,7 @@ var settings_menu_default = SettingsMenuStyles;
13832
14239
  // dist/styles/select.js
13833
14240
  var SelectStyles = [
13834
14241
  LabelStyles,
13835
- i`
14242
+ i2`
13836
14243
  select {
13837
14244
  background: var(--card-background, light-dark(#fff, #333));
13838
14245
  color: var(--component-text-color, light-dark(#333, #eee));
@@ -13861,20 +14268,20 @@ var SelectStyles = [
13861
14268
  var select_default = SelectStyles;
13862
14269
 
13863
14270
  // dist/components/device-selector.js
13864
- var __decorate5 = function(decorators, target, key, desc) {
14271
+ var __decorate15 = function(decorators, target, key, desc) {
13865
14272
  var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
13866
14273
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
13867
14274
  else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
13868
14275
  return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
13869
14276
  };
13870
- var __classPrivateFieldGet8 = function(receiver, state, kind, f5) {
14277
+ var __classPrivateFieldGet11 = function(receiver, state, kind, f5) {
13871
14278
  if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
13872
14279
  if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
13873
14280
  return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
13874
14281
  };
13875
14282
  var _DictationDeviceSelector_instances;
13876
14283
  var _DictationDeviceSelector_handleSelectDevice;
13877
- var DictationDeviceSelector = class DictationDeviceSelector2 extends i4 {
14284
+ var DictationDeviceSelector = class DictationDeviceSelector2 extends i5 {
13878
14285
  constructor() {
13879
14286
  super(...arguments);
13880
14287
  _DictationDeviceSelector_instances.add(this);
@@ -13889,7 +14296,7 @@ var DictationDeviceSelector = class DictationDeviceSelector2 extends i4 {
13889
14296
  <select
13890
14297
  id="device-select"
13891
14298
  aria-labelledby="device-select-label"
13892
- @change=${__classPrivateFieldGet8(this, _DictationDeviceSelector_instances, "m", _DictationDeviceSelector_handleSelectDevice)}
14299
+ @change=${__classPrivateFieldGet11(this, _DictationDeviceSelector_instances, "m", _DictationDeviceSelector_handleSelectDevice)}
13893
14300
  ?disabled=${this.disabled || !this._devices || this._devices.length === 0}
13894
14301
  >
13895
14302
  ${this._devices?.map((device) => x`
@@ -13915,25 +14322,25 @@ _DictationDeviceSelector_handleSelectDevice = function _DictationDeviceSelector_
13915
14322
  this.dispatchEvent(recordingDevicesChangedEvent(this._devices || [], device));
13916
14323
  };
13917
14324
  DictationDeviceSelector.styles = select_default;
13918
- __decorate5([
13919
- c5({ context: devicesContext, subscribe: true }),
13920
- r5()
14325
+ __decorate15([
14326
+ c({ context: devicesContext, subscribe: true }),
14327
+ r4()
13921
14328
  ], DictationDeviceSelector.prototype, "_devices", void 0);
13922
- __decorate5([
13923
- c5({ context: selectedDeviceContext, subscribe: true }),
13924
- r5()
14329
+ __decorate15([
14330
+ c({ context: selectedDeviceContext, subscribe: true }),
14331
+ r4()
13925
14332
  ], DictationDeviceSelector.prototype, "_selectedDevice", void 0);
13926
- __decorate5([
14333
+ __decorate15([
13927
14334
  n4({ type: Boolean })
13928
14335
  ], DictationDeviceSelector.prototype, "disabled", void 0);
13929
- DictationDeviceSelector = __decorate5([
13930
- t3("dictation-device-selector")
14336
+ DictationDeviceSelector = __decorate15([
14337
+ t2("dictation-device-selector")
13931
14338
  ], DictationDeviceSelector);
13932
14339
 
13933
14340
  // dist/styles/keybinding-selector.js
13934
14341
  var KeybindingSelectorStyles = [
13935
14342
  LabelStyles,
13936
- i`
14343
+ i2`
13937
14344
  :host {
13938
14345
  display: block;
13939
14346
  }
@@ -14008,13 +14415,13 @@ var KeybindingSelectorStyles = [
14008
14415
  var keybinding_selector_default = KeybindingSelectorStyles;
14009
14416
 
14010
14417
  // dist/components/keybinding-input.js
14011
- var __decorate6 = function(decorators, target, key, desc) {
14418
+ var __decorate16 = function(decorators, target, key, desc) {
14012
14419
  var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
14013
14420
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
14014
14421
  else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
14015
14422
  return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
14016
14423
  };
14017
- var __classPrivateFieldGet9 = function(receiver, state, kind, f5) {
14424
+ var __classPrivateFieldGet12 = function(receiver, state, kind, f5) {
14018
14425
  if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
14019
14426
  if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14020
14427
  return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
@@ -14023,7 +14430,7 @@ var _DictationKeybindingInput_instances;
14023
14430
  var _DictationKeybindingInput_handleKeybindingInputFocus;
14024
14431
  var _DictationKeybindingInput_handleKeybindingInputBlur;
14025
14432
  var _DictationKeybindingInput_handleKeybindingKeyDown;
14026
- var DictationKeybindingInput = class DictationKeybindingInput2 extends i4 {
14433
+ var DictationKeybindingInput = class DictationKeybindingInput2 extends i5 {
14027
14434
  constructor() {
14028
14435
  super(...arguments);
14029
14436
  _DictationKeybindingInput_instances.add(this);
@@ -14045,9 +14452,9 @@ var DictationKeybindingInput = class DictationKeybindingInput2 extends i4 {
14045
14452
  .value=""
14046
14453
  placeholder="Click and press a key..."
14047
14454
  readonly
14048
- @focusin=${__classPrivateFieldGet9(this, _DictationKeybindingInput_instances, "m", _DictationKeybindingInput_handleKeybindingInputFocus)}
14049
- @focusout=${__classPrivateFieldGet9(this, _DictationKeybindingInput_instances, "m", _DictationKeybindingInput_handleKeybindingInputBlur)}
14050
- @keydown=${__classPrivateFieldGet9(this, _DictationKeybindingInput_instances, "m", _DictationKeybindingInput_handleKeybindingKeyDown)}
14455
+ @focusin=${__classPrivateFieldGet12(this, _DictationKeybindingInput_instances, "m", _DictationKeybindingInput_handleKeybindingInputFocus)}
14456
+ @focusout=${__classPrivateFieldGet12(this, _DictationKeybindingInput_instances, "m", _DictationKeybindingInput_handleKeybindingInputBlur)}
14457
+ @keydown=${__classPrivateFieldGet12(this, _DictationKeybindingInput_instances, "m", _DictationKeybindingInput_handleKeybindingKeyDown)}
14051
14458
  ?disabled=${this.disabled}
14052
14459
  />
14053
14460
  </div>
@@ -14072,35 +14479,35 @@ _DictationKeybindingInput_handleKeybindingKeyDown = function _DictationKeybindin
14072
14479
  this.dispatchEvent(keybindingChangedEvent(event.key, event.code, keybinding, this.keybindingType));
14073
14480
  };
14074
14481
  DictationKeybindingInput.styles = keybinding_selector_default;
14075
- __decorate6([
14482
+ __decorate16([
14076
14483
  n4({ type: String })
14077
14484
  ], DictationKeybindingInput.prototype, "keybindingType", void 0);
14078
- __decorate6([
14079
- c5({ context: pushToTalkKeybindingContext, subscribe: true }),
14080
- r5()
14485
+ __decorate16([
14486
+ c({ context: pushToTalkKeybindingContext, subscribe: true }),
14487
+ r4()
14081
14488
  ], DictationKeybindingInput.prototype, "_pushToTalkKeybinding", void 0);
14082
- __decorate6([
14083
- c5({ context: toggleToTalkKeybindingContext, subscribe: true }),
14084
- r5()
14489
+ __decorate16([
14490
+ c({ context: toggleToTalkKeybindingContext, subscribe: true }),
14491
+ r4()
14085
14492
  ], DictationKeybindingInput.prototype, "_toggleToTalkKeybinding", void 0);
14086
- __decorate6([
14493
+ __decorate16([
14087
14494
  n4({ type: Boolean })
14088
14495
  ], DictationKeybindingInput.prototype, "disabled", void 0);
14089
- __decorate6([
14090
- r5()
14496
+ __decorate16([
14497
+ r4()
14091
14498
  ], DictationKeybindingInput.prototype, "_isCapturingKeybinding", void 0);
14092
- DictationKeybindingInput = __decorate6([
14093
- t3("dictation-keybinding-input")
14499
+ DictationKeybindingInput = __decorate16([
14500
+ t2("dictation-keybinding-input")
14094
14501
  ], DictationKeybindingInput);
14095
14502
 
14096
14503
  // dist/components/keybinding-selector.js
14097
- var __decorate7 = function(decorators, target, key, desc) {
14504
+ var __decorate17 = function(decorators, target, key, desc) {
14098
14505
  var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
14099
14506
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
14100
14507
  else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
14101
14508
  return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
14102
14509
  };
14103
- var DictationKeybindingSelector = class DictationKeybindingSelector2 extends i4 {
14510
+ var DictationKeybindingSelector = class DictationKeybindingSelector2 extends i5 {
14104
14511
  constructor() {
14105
14512
  super(...arguments);
14106
14513
  this.disabled = false;
@@ -14124,36 +14531,36 @@ var DictationKeybindingSelector = class DictationKeybindingSelector2 extends i4
14124
14531
  }
14125
14532
  };
14126
14533
  DictationKeybindingSelector.styles = keybinding_selector_default;
14127
- __decorate7([
14128
- c5({ context: pushToTalkKeybindingContext, subscribe: true }),
14129
- r5()
14534
+ __decorate17([
14535
+ c({ context: pushToTalkKeybindingContext, subscribe: true }),
14536
+ r4()
14130
14537
  ], DictationKeybindingSelector.prototype, "_pushToTalkKeybinding", void 0);
14131
- __decorate7([
14132
- c5({ context: toggleToTalkKeybindingContext, subscribe: true }),
14133
- r5()
14538
+ __decorate17([
14539
+ c({ context: toggleToTalkKeybindingContext, subscribe: true }),
14540
+ r4()
14134
14541
  ], DictationKeybindingSelector.prototype, "_toggleToTalkKeybinding", void 0);
14135
- __decorate7([
14542
+ __decorate17([
14136
14543
  n4({ type: Boolean })
14137
14544
  ], DictationKeybindingSelector.prototype, "disabled", void 0);
14138
- DictationKeybindingSelector = __decorate7([
14139
- t3("dictation-keybinding-selector")
14545
+ DictationKeybindingSelector = __decorate17([
14546
+ t2("dictation-keybinding-selector")
14140
14547
  ], DictationKeybindingSelector);
14141
14548
 
14142
14549
  // dist/components/language-selector.js
14143
- var __decorate8 = function(decorators, target, key, desc) {
14550
+ var __decorate18 = function(decorators, target, key, desc) {
14144
14551
  var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
14145
14552
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
14146
14553
  else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
14147
14554
  return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
14148
14555
  };
14149
- var __classPrivateFieldGet10 = function(receiver, state, kind, f5) {
14556
+ var __classPrivateFieldGet13 = function(receiver, state, kind, f5) {
14150
14557
  if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
14151
14558
  if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14152
14559
  return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
14153
14560
  };
14154
14561
  var _DictationLanguageSelector_instances;
14155
14562
  var _DictationLanguageSelector_handleSelectLanguage;
14156
- var DictationLanguageSelector = class DictationLanguageSelector2 extends i4 {
14563
+ var DictationLanguageSelector = class DictationLanguageSelector2 extends i5 {
14157
14564
  constructor() {
14158
14565
  super(...arguments);
14159
14566
  _DictationLanguageSelector_instances.add(this);
@@ -14168,7 +14575,7 @@ var DictationLanguageSelector = class DictationLanguageSelector2 extends i4 {
14168
14575
  <select
14169
14576
  id="language-select"
14170
14577
  aria-labelledby="language-select-label"
14171
- @change=${__classPrivateFieldGet10(this, _DictationLanguageSelector_instances, "m", _DictationLanguageSelector_handleSelectLanguage)}
14578
+ @change=${__classPrivateFieldGet13(this, _DictationLanguageSelector_instances, "m", _DictationLanguageSelector_handleSelectLanguage)}
14172
14579
  ?disabled=${this.disabled || !this._languages || this._languages.length === 0}
14173
14580
  >
14174
14581
  ${this._languages?.map((language) => x`
@@ -14191,29 +14598,29 @@ _DictationLanguageSelector_handleSelectLanguage = function _DictationLanguageSel
14191
14598
  this.dispatchEvent(languageChangedEvent(language));
14192
14599
  };
14193
14600
  DictationLanguageSelector.styles = select_default;
14194
- __decorate8([
14195
- c5({ context: languagesContext, subscribe: true }),
14196
- r5()
14601
+ __decorate18([
14602
+ c({ context: languagesContext, subscribe: true }),
14603
+ r4()
14197
14604
  ], DictationLanguageSelector.prototype, "_languages", void 0);
14198
- __decorate8([
14199
- c5({ context: dictationConfigContext, subscribe: true }),
14200
- r5()
14605
+ __decorate18([
14606
+ c({ context: dictationConfigContext, subscribe: true }),
14607
+ r4()
14201
14608
  ], DictationLanguageSelector.prototype, "_dictationConfig", void 0);
14202
- __decorate8([
14609
+ __decorate18([
14203
14610
  n4({ type: Boolean })
14204
14611
  ], DictationLanguageSelector.prototype, "disabled", void 0);
14205
- DictationLanguageSelector = __decorate8([
14206
- t3("dictation-language-selector")
14612
+ DictationLanguageSelector = __decorate18([
14613
+ t2("dictation-language-selector")
14207
14614
  ], DictationLanguageSelector);
14208
14615
 
14209
14616
  // dist/components/settings-menu.js
14210
- var __decorate9 = function(decorators, target, key, desc) {
14617
+ var __decorate19 = function(decorators, target, key, desc) {
14211
14618
  var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
14212
14619
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
14213
14620
  else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
14214
14621
  return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
14215
14622
  };
14216
- var DictationSettingsMenu = class DictationSettingsMenu2 extends i4 {
14623
+ var DictationSettingsMenu = class DictationSettingsMenu2 extends i5 {
14217
14624
  constructor() {
14218
14625
  super(...arguments);
14219
14626
  this._recordingState = "stopped";
@@ -14259,110 +14666,165 @@ DictationSettingsMenu.styles = [
14259
14666
  buttons_default,
14260
14667
  callout_default
14261
14668
  ];
14262
- __decorate9([
14263
- c5({ context: recordingStateContext, subscribe: true }),
14264
- r5()
14669
+ __decorate19([
14670
+ c({ context: recordingStateContext, subscribe: true }),
14671
+ r4()
14265
14672
  ], DictationSettingsMenu.prototype, "_recordingState", void 0);
14266
- __decorate9([
14673
+ __decorate19([
14267
14674
  n4({
14268
14675
  converter: commaSeparatedConverter,
14269
14676
  type: Array
14270
14677
  })
14271
14678
  ], DictationSettingsMenu.prototype, "settingsEnabled", void 0);
14272
- DictationSettingsMenu = __decorate9([
14273
- t3("dictation-settings-menu")
14679
+ DictationSettingsMenu = __decorate19([
14680
+ t2("dictation-settings-menu")
14274
14681
  ], DictationSettingsMenu);
14275
14682
 
14276
- // dist/components/corti-dictation.js
14277
- var __decorate10 = function(decorators, target, key, desc) {
14683
+ // dist/components/corti-ambient.js
14684
+ var __decorate20 = function(decorators, target, key, desc) {
14278
14685
  var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
14279
14686
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
14280
14687
  else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
14281
14688
  return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
14282
14689
  };
14283
- var __classPrivateFieldGet11 = function(receiver, state, kind, f5) {
14284
- if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
14285
- if (typeof state === "function" ? receiver !== state || !f5 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14286
- return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
14287
- };
14288
- var _CortiDictation_recordingButtonRef;
14289
- var _CortiDictation_contextProviderRef;
14290
- var CortiDictation = class CortiDictation2 extends i4 {
14690
+ var CortiAmbient = class CortiAmbient2 extends CortiRoot {
14291
14691
  constructor() {
14292
14692
  super(...arguments);
14293
- _CortiDictation_recordingButtonRef.set(this, e7());
14294
- _CortiDictation_contextProviderRef.set(this, e7());
14295
- this.settingsEnabled = ["device", "language"];
14296
- this.allowButtonFocus = false;
14297
- this.debug_displayAudio = false;
14298
- this._dictationConfig = DEFAULT_DICTATION_CONFIG;
14693
+ this._ambientConfig = DEFAULT_STREAM_CONFIG;
14299
14694
  }
14300
14695
  /**
14301
- * List of all language codes available for use with the Web Component.
14302
- * Default list depends on the accessToken
14696
+ * Stream configuration for ambient capture (modes, transcription, etc.).
14303
14697
  */
14304
- set languagesSupported(value) {
14305
- this._languagesSupported = value;
14698
+ set ambientConfig(value) {
14699
+ this._ambientConfig = value;
14306
14700
  }
14307
- get languagesSupported() {
14308
- return __classPrivateFieldGet11(this, _CortiDictation_contextProviderRef, "f").value?.languages || this._languagesSupported || [];
14701
+ get ambientConfig() {
14702
+ return this._contextProviderRef.value?.ambientConfig ?? this._ambientConfig ?? DEFAULT_STREAM_CONFIG;
14309
14703
  }
14310
14704
  /**
14311
- * Configuration settings for dictation
14705
+ * Stream interaction id passed to `stream.connect` for this session.
14312
14706
  */
14313
- set dictationConfig(value) {
14314
- this._dictationConfig = value;
14707
+ set interactionId(value) {
14708
+ this._interactionId = value;
14315
14709
  }
14316
- get dictationConfig() {
14317
- return __classPrivateFieldGet11(this, _CortiDictation_contextProviderRef, "f").value?.dictationConfig || this._dictationConfig;
14710
+ get interactionId() {
14711
+ return this._contextProviderRef.value?.interactionId ?? this._interactionId;
14318
14712
  }
14319
- /**
14320
- * List of available recording devices
14321
- */
14322
- set devices(value) {
14323
- this._devices = value;
14713
+ // ─────────────────────────────────────────────────────────────────────────────
14714
+ // Render
14715
+ // ─────────────────────────────────────────────────────────────────────────────
14716
+ render() {
14717
+ const isHidden = !this.accessToken && !this.authConfig && !this.socketUrl && !this.socketProxy;
14718
+ return x`
14719
+ <ambient-root
14720
+ ${n7(this._contextProviderRef)}
14721
+ class=${e8({ hidden: isHidden })}
14722
+ .accessToken=${this.accessToken}
14723
+ .authConfig=${this.authConfig}
14724
+ .socketUrl=${this.socketUrl}
14725
+ .socketProxy=${this.socketProxy}
14726
+ .ambientConfig=${this._ambientConfig}
14727
+ .interactionId=${this._interactionId}
14728
+ .languages=${this._languagesSupported}
14729
+ .devices=${this._devices}
14730
+ .selectedDevice=${this._selectedDevice}
14731
+ .pushToTalkKeybinding=${this._pushToTalkKeybinding}
14732
+ .toggleToTalkKeybinding=${this._toggleToTalkKeybinding}
14733
+ >
14734
+ <ambient-recording-button
14735
+ ${n7(this._recordingButtonRef)}
14736
+ ?allowButtonFocus=${this.allowButtonFocus}
14737
+ ></ambient-recording-button>
14738
+ ${this.settingsEnabled?.length > 0 ? x`<dictation-settings-menu
14739
+ .settingsEnabled=${this.settingsEnabled}
14740
+ ></dictation-settings-menu>` : E}
14741
+ </ambient-root>
14742
+ `;
14324
14743
  }
14325
- get devices() {
14326
- return __classPrivateFieldGet11(this, _CortiDictation_contextProviderRef, "f").value?.devices || this._devices || [];
14744
+ };
14745
+ __decorate20([
14746
+ n4({ attribute: false, type: Object })
14747
+ ], CortiAmbient.prototype, "ambientConfig", null);
14748
+ __decorate20([
14749
+ r4()
14750
+ ], CortiAmbient.prototype, "_ambientConfig", void 0);
14751
+ __decorate20([
14752
+ n4({ type: String })
14753
+ ], CortiAmbient.prototype, "interactionId", null);
14754
+ __decorate20([
14755
+ r4()
14756
+ ], CortiAmbient.prototype, "_interactionId", void 0);
14757
+ CortiAmbient = __decorate20([
14758
+ t2("corti-ambient")
14759
+ ], CortiAmbient);
14760
+
14761
+ // dist/controllers/dictation-controller.js
14762
+ var DictationController = class extends SocketController {
14763
+ async stopRecording() {
14764
+ await this.pause();
14327
14765
  }
14328
- /**
14329
- * The selected device used for recording (MediaDeviceInfo).
14330
- */
14331
- set selectedDevice(value) {
14332
- this._selectedDevice = value;
14766
+ async _connectThroughProxy(dictationConfig, proxy) {
14767
+ return await CortiWebSocketProxyClient.transcribe.connect({
14768
+ // awaitConfiguration: false — CONFIG_* appears in network activity before the socket is configured server-side
14769
+ awaitConfiguration: false,
14770
+ configuration: dictationConfig,
14771
+ proxy
14772
+ });
14333
14773
  }
14334
- get selectedDevice() {
14335
- return __classPrivateFieldGet11(this, _CortiDictation_contextProviderRef, "f").value?.selectedDevice || this._selectedDevice;
14774
+ async _connectThroughAuth(client, dictationConfig) {
14775
+ return await client.transcribe.connect({
14776
+ // awaitConfiguration: false — CONFIG_* appears in network activity before the socket is configured server-side
14777
+ awaitConfiguration: false,
14778
+ configuration: dictationConfig
14779
+ });
14336
14780
  }
14337
- /**
14338
- * Current state of recording (stopped, recording, initializing and stopping, ).
14339
- */
14340
- get recordingState() {
14341
- return __classPrivateFieldGet11(this, _CortiDictation_contextProviderRef, "f").value?.recordingState || "stopped";
14781
+ };
14782
+
14783
+ // dist/components/dictation-recording-button.js
14784
+ var __decorate21 = function(decorators, target, key, desc) {
14785
+ var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
14786
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
14787
+ else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
14788
+ return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
14789
+ };
14790
+ var DictationRecordingButton = class DictationRecordingButton2 extends RecordingButtonBase {
14791
+ constructor() {
14792
+ super(...arguments);
14793
+ this._socketController = new DictationController(this);
14342
14794
  }
14343
- /**
14344
- * Push-to-talk keybinding for keyboard shortcut. Single key only (e.g., "Space", "k", "meta", "ctrl").
14345
- * Combinations with "+" are not supported.
14346
- * Keydown starts recording, keyup stops recording.
14347
- * Defaults to "Space" if keybinding is in settingsEnabled, otherwise undefined
14348
- */
14349
- set pushToTalkKeybinding(value) {
14350
- this._pushToTalkKeybinding = value;
14795
+ _getConnectConfig() {
14796
+ return this._dictationConfig ?? DEFAULT_DICTATION_CONFIG;
14351
14797
  }
14352
- get pushToTalkKeybinding() {
14353
- return __classPrivateFieldGet11(this, _CortiDictation_contextProviderRef, "f").value?.pushToTalkKeybinding || this._pushToTalkKeybinding;
14798
+ };
14799
+ __decorate21([
14800
+ c({ context: dictationConfigContext, subscribe: true }),
14801
+ r4()
14802
+ ], DictationRecordingButton.prototype, "_dictationConfig", void 0);
14803
+ DictationRecordingButton = __decorate21([
14804
+ t2("dictation-recording-button")
14805
+ ], DictationRecordingButton);
14806
+
14807
+ // dist/components/corti-dictation.js
14808
+ var __decorate22 = function(decorators, target, key, desc) {
14809
+ var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
14810
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
14811
+ else for (var i7 = decorators.length - 1; i7 >= 0; i7--) if (d3 = decorators[i7]) r7 = (c6 < 3 ? d3(r7) : c6 > 3 ? d3(target, key, r7) : d3(target, key)) || r7;
14812
+ return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
14813
+ };
14814
+ var CortiDictation = class CortiDictation2 extends CortiRoot {
14815
+ constructor() {
14816
+ super(...arguments);
14817
+ this.debug_displayAudio = false;
14818
+ this._dictationConfig = DEFAULT_DICTATION_CONFIG;
14354
14819
  }
14355
14820
  /**
14356
- * Toggle-to-talk keybinding for keyboard shortcut. Single key only (e.g., "`", "k", "meta", "ctrl").
14357
- * Combinations with "+" are not supported.
14358
- * Pressing the key toggles recording on/off.
14359
- * Defaults to "`" if keybinding is in settingsEnabled, otherwise undefined
14821
+ * Configuration settings for dictation
14360
14822
  */
14361
- set toggleToTalkKeybinding(value) {
14362
- this._toggleToTalkKeybinding = value;
14823
+ set dictationConfig(value) {
14824
+ this._dictationConfig = value;
14363
14825
  }
14364
- get toggleToTalkKeybinding() {
14365
- return __classPrivateFieldGet11(this, _CortiDictation_contextProviderRef, "f").value?.toggleToTalkKeybinding || this._toggleToTalkKeybinding;
14826
+ get dictationConfig() {
14827
+ return this._contextProviderRef.value?.dictationConfig || this._dictationConfig;
14366
14828
  }
14367
14829
  // ─────────────────────────────────────────────────────────────────────────────
14368
14830
  // Public methods
@@ -14374,7 +14836,7 @@ var CortiDictation = class CortiDictation2 extends i4 {
14374
14836
  */
14375
14837
  setAccessToken(token) {
14376
14838
  this.accessToken = token;
14377
- return __classPrivateFieldGet11(this, _CortiDictation_contextProviderRef, "f").value?.setAccessToken(token) ?? {
14839
+ return this._contextProviderRef.value?.setAccessToken(token) ?? {
14378
14840
  accessToken: token,
14379
14841
  environment: void 0,
14380
14842
  tenant: void 0
@@ -14387,44 +14849,12 @@ var CortiDictation = class CortiDictation2 extends i4 {
14387
14849
  */
14388
14850
  async setAuthConfig(config) {
14389
14851
  this.authConfig = config;
14390
- return __classPrivateFieldGet11(this, _CortiDictation_contextProviderRef, "f").value?.setAuthConfig(config) ?? {
14852
+ return this._contextProviderRef.value?.setAuthConfig(config) ?? {
14391
14853
  accessToken: void 0,
14392
14854
  environment: void 0,
14393
14855
  tenant: void 0
14394
14856
  };
14395
14857
  }
14396
- /**
14397
- * Starts a recording.
14398
- */
14399
- startRecording() {
14400
- __classPrivateFieldGet11(this, _CortiDictation_recordingButtonRef, "f").value?.startRecording();
14401
- }
14402
- /**
14403
- * Stops a recording.
14404
- */
14405
- stopRecording() {
14406
- __classPrivateFieldGet11(this, _CortiDictation_recordingButtonRef, "f").value?.stopRecording();
14407
- }
14408
- /**
14409
- * Starts or stops recording. Convenience layer on top of the start/stop methods.
14410
- */
14411
- toggleRecording() {
14412
- __classPrivateFieldGet11(this, _CortiDictation_recordingButtonRef, "f").value?.toggleRecording();
14413
- }
14414
- /**
14415
- * Opens the WebSocket connection without starting recording.
14416
- * Use this to pre-establish the connection before recording starts.
14417
- */
14418
- async openConnection() {
14419
- await __classPrivateFieldGet11(this, _CortiDictation_recordingButtonRef, "f").value?.openConnection();
14420
- }
14421
- /**
14422
- * Closes the WebSocket connection by sending "end" and waiting for "ended".
14423
- * Call this to receive "usage" statistics or when done with the connection.
14424
- */
14425
- async closeConnection() {
14426
- await __classPrivateFieldGet11(this, _CortiDictation_recordingButtonRef, "f").value?.closeConnection();
14427
- }
14428
14858
  // ─────────────────────────────────────────────────────────────────────────────
14429
14859
  // Render
14430
14860
  // ─────────────────────────────────────────────────────────────────────────────
@@ -14432,8 +14862,8 @@ var CortiDictation = class CortiDictation2 extends i4 {
14432
14862
  const isHidden = !this.accessToken && !this.authConfig && !this.socketUrl && !this.socketProxy;
14433
14863
  return x`
14434
14864
  <dictation-root
14435
- ${n6(__classPrivateFieldGet11(this, _CortiDictation_contextProviderRef, "f"))}
14436
- class=${e6({ hidden: isHidden })}
14865
+ ${n7(this._contextProviderRef)}
14866
+ class=${e8({ hidden: isHidden })}
14437
14867
  .accessToken=${this.accessToken}
14438
14868
  .authConfig=${this.authConfig}
14439
14869
  .socketUrl=${this.socketUrl}
@@ -14447,7 +14877,7 @@ var CortiDictation = class CortiDictation2 extends i4 {
14447
14877
  .toggleToTalkKeybinding=${this._toggleToTalkKeybinding}
14448
14878
  >
14449
14879
  <dictation-recording-button
14450
- ${n6(__classPrivateFieldGet11(this, _CortiDictation_recordingButtonRef, "f"))}
14880
+ ${n7(this._recordingButtonRef)}
14451
14881
  ?allowButtonFocus=${this.allowButtonFocus}
14452
14882
  ></dictation-recording-button>
14453
14883
  ${this.settingsEnabled?.length > 0 ? x`<dictation-settings-menu
@@ -14457,81 +14887,26 @@ var CortiDictation = class CortiDictation2 extends i4 {
14457
14887
  `;
14458
14888
  }
14459
14889
  };
14460
- _CortiDictation_recordingButtonRef = /* @__PURE__ */ new WeakMap();
14461
- _CortiDictation_contextProviderRef = /* @__PURE__ */ new WeakMap();
14462
- CortiDictation.styles = i`
14463
- .hidden {
14464
- display: none;
14465
- }
14466
- `;
14467
- __decorate10([
14468
- n4({ type: String })
14469
- ], CortiDictation.prototype, "accessToken", void 0);
14470
- __decorate10([
14471
- n4({ attribute: false, type: Object })
14472
- ], CortiDictation.prototype, "authConfig", void 0);
14473
- __decorate10([
14474
- n4({ type: String })
14475
- ], CortiDictation.prototype, "socketUrl", void 0);
14476
- __decorate10([
14477
- n4({ attribute: false, type: Object })
14478
- ], CortiDictation.prototype, "socketProxy", void 0);
14479
- __decorate10([
14480
- n4({
14481
- converter: commaSeparatedConverter,
14482
- type: Array
14483
- })
14484
- ], CortiDictation.prototype, "languagesSupported", null);
14485
- __decorate10([
14486
- r5()
14487
- ], CortiDictation.prototype, "_languagesSupported", void 0);
14488
- __decorate10([
14489
- n4({
14490
- converter: commaSeparatedConverter,
14491
- type: Array
14492
- })
14493
- ], CortiDictation.prototype, "settingsEnabled", void 0);
14494
- __decorate10([
14495
- n4({ type: Boolean })
14496
- ], CortiDictation.prototype, "allowButtonFocus", void 0);
14497
- __decorate10([
14890
+ __decorate22([
14498
14891
  n4({ attribute: "debug-display-audio", type: Boolean })
14499
14892
  ], CortiDictation.prototype, "debug_displayAudio", void 0);
14500
- __decorate10([
14893
+ __decorate22([
14501
14894
  n4({ attribute: false, type: Object })
14502
14895
  ], CortiDictation.prototype, "dictationConfig", null);
14503
- __decorate10([
14504
- r5()
14896
+ __decorate22([
14897
+ r4()
14505
14898
  ], CortiDictation.prototype, "_dictationConfig", void 0);
14506
- __decorate10([
14507
- n4({ attribute: false, type: Array })
14508
- ], CortiDictation.prototype, "devices", null);
14509
- __decorate10([
14510
- r5()
14511
- ], CortiDictation.prototype, "_devices", void 0);
14512
- __decorate10([
14513
- n4({ attribute: false, type: Object })
14514
- ], CortiDictation.prototype, "selectedDevice", null);
14515
- __decorate10([
14516
- r5()
14517
- ], CortiDictation.prototype, "_selectedDevice", void 0);
14518
- __decorate10([
14519
- n4({ type: String })
14520
- ], CortiDictation.prototype, "pushToTalkKeybinding", null);
14521
- __decorate10([
14522
- r5()
14523
- ], CortiDictation.prototype, "_pushToTalkKeybinding", void 0);
14524
- __decorate10([
14525
- n4({ type: String })
14526
- ], CortiDictation.prototype, "toggleToTalkKeybinding", null);
14527
- __decorate10([
14528
- r5()
14529
- ], CortiDictation.prototype, "_toggleToTalkKeybinding", void 0);
14530
- CortiDictation = __decorate10([
14531
- t3("corti-dictation")
14899
+ CortiDictation = __decorate22([
14900
+ t2("corti-dictation")
14532
14901
  ], CortiDictation);
14533
14902
 
14534
14903
  // dist/index.js
14904
+ if (!customElements.get("ambient-recording-button")) {
14905
+ customElements.define("ambient-recording-button", AmbientRecordingButton);
14906
+ }
14907
+ if (!customElements.get("corti-ambient")) {
14908
+ customElements.define("corti-ambient", CortiAmbient);
14909
+ }
14535
14910
  if (!customElements.get("corti-dictation")) {
14536
14911
  customElements.define("corti-dictation", CortiDictation);
14537
14912
  }
@@ -14555,6 +14930,8 @@ if (!customElements.get("dictation-root")) {
14555
14930
  }
14556
14931
  var index_default = CortiDictation;
14557
14932
  export {
14933
+ AmbientRecordingButton,
14934
+ CortiAmbient,
14558
14935
  CortiDictation,
14559
14936
  DictationDeviceSelector,
14560
14937
  DictationKeybindingSelector,
@@ -14566,17 +14943,24 @@ export {
14566
14943
  };
14567
14944
  /*! Bundled license information:
14568
14945
 
14569
- @lit/reactive-element/css-tag.js:
14946
+ @lit/context/lib/context-request-event.js:
14947
+ @lit/context/lib/create-context.js:
14948
+ @lit/context/lib/controllers/context-consumer.js:
14949
+ @lit/context/lib/value-notifier.js:
14950
+ @lit/context/lib/controllers/context-provider.js:
14951
+ @lit/context/lib/context-root.js:
14952
+ @lit/reactive-element/decorators/query-assigned-elements.js:
14953
+ lit-html/directives/map.js:
14954
+ lit-html/directives/range.js:
14570
14955
  (**
14571
14956
  * @license
14572
- * Copyright 2019 Google LLC
14957
+ * Copyright 2021 Google LLC
14573
14958
  * SPDX-License-Identifier: BSD-3-Clause
14574
14959
  *)
14575
14960
 
14576
- @lit/reactive-element/reactive-element.js:
14577
- lit-html/lit-html.js:
14578
- lit-element/lit-element.js:
14961
+ @lit/context/lib/decorators/provide.js:
14579
14962
  @lit/reactive-element/decorators/custom-element.js:
14963
+ @lit/reactive-element/reactive-element.js:
14580
14964
  @lit/reactive-element/decorators/property.js:
14581
14965
  @lit/reactive-element/decorators/state.js:
14582
14966
  @lit/reactive-element/decorators/event-options.js:
@@ -14585,35 +14969,28 @@ lit-element/lit-element.js:
14585
14969
  @lit/reactive-element/decorators/query-all.js:
14586
14970
  @lit/reactive-element/decorators/query-async.js:
14587
14971
  @lit/reactive-element/decorators/query-assigned-nodes.js:
14972
+ lit-html/lit-html.js:
14973
+ lit-element/lit-element.js:
14588
14974
  lit-html/directive.js:
14589
14975
  lit-html/async-directive.js:
14590
- @lit/context/lib/decorators/provide.js:
14591
14976
  (**
14592
14977
  * @license
14593
14978
  * Copyright 2017 Google LLC
14594
14979
  * SPDX-License-Identifier: BSD-3-Clause
14595
14980
  *)
14596
14981
 
14597
- lit-html/is-server.js:
14598
14982
  @lit/context/lib/decorators/consume.js:
14983
+ lit-html/is-server.js:
14599
14984
  (**
14600
14985
  * @license
14601
14986
  * Copyright 2022 Google LLC
14602
14987
  * SPDX-License-Identifier: BSD-3-Clause
14603
14988
  *)
14604
14989
 
14605
- @lit/reactive-element/decorators/query-assigned-elements.js:
14606
- @lit/context/lib/context-request-event.js:
14607
- @lit/context/lib/create-context.js:
14608
- @lit/context/lib/controllers/context-consumer.js:
14609
- @lit/context/lib/value-notifier.js:
14610
- @lit/context/lib/controllers/context-provider.js:
14611
- @lit/context/lib/context-root.js:
14612
- lit-html/directives/map.js:
14613
- lit-html/directives/range.js:
14990
+ @lit/reactive-element/css-tag.js:
14614
14991
  (**
14615
14992
  * @license
14616
- * Copyright 2021 Google LLC
14993
+ * Copyright 2019 Google LLC
14617
14994
  * SPDX-License-Identifier: BSD-3-Clause
14618
14995
  *)
14619
14996