@corti/dictation-web 0.4.0-rc.2 → 0.5.0-rc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -3
- package/dist/bundle.js +795 -152
- package/dist/components/corti-dictation.d.ts +15 -1
- package/dist/components/corti-dictation.js +35 -0
- package/dist/components/corti-dictation.js.map +1 -1
- package/dist/components/device-selector.d.ts +1 -1
- package/dist/components/keybinding-selector.d.ts +14 -0
- package/dist/components/keybinding-selector.js +82 -0
- package/dist/components/keybinding-selector.js.map +1 -0
- package/dist/components/language-selector.d.ts +1 -1
- package/dist/components/mode-selector.d.ts +14 -0
- package/dist/components/mode-selector.js +73 -0
- package/dist/components/mode-selector.js.map +1 -0
- package/dist/components/recording-button.d.ts +5 -2
- package/dist/components/recording-button.js +83 -17
- package/dist/components/recording-button.js.map +1 -1
- package/dist/components/settings-menu.d.ts +2 -0
- package/dist/components/settings-menu.js +20 -0
- package/dist/components/settings-menu.js.map +1 -1
- package/dist/contexts/dictation-context.d.ts +9 -1
- package/dist/contexts/dictation-context.js +35 -2
- package/dist/contexts/dictation-context.js.map +1 -1
- package/dist/controllers/dictation-controller.d.ts +2 -1
- package/dist/controllers/dictation-controller.js +53 -19
- package/dist/controllers/dictation-controller.js.map +1 -1
- package/dist/controllers/keybinding-controller.d.ts +18 -0
- package/dist/controllers/keybinding-controller.js +86 -0
- package/dist/controllers/keybinding-controller.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/package.json +87 -7
- package/dist/styles/component-styles.d.ts +1 -0
- package/dist/styles/component-styles.js +10 -0
- package/dist/styles/component-styles.js.map +1 -1
- package/dist/styles/keybinding-selector.d.ts +2 -0
- package/dist/styles/keybinding-selector.js +72 -0
- package/dist/styles/keybinding-selector.js.map +1 -0
- package/dist/styles/mode-selector.d.ts +2 -0
- package/dist/styles/mode-selector.js +56 -0
- package/dist/styles/mode-selector.js.map +1 -0
- package/dist/styles/select.d.ts +1 -1
- package/dist/styles/select.js +6 -10
- package/dist/styles/select.js.map +1 -1
- package/dist/styles/settings-menu.js +9 -1
- package/dist/styles/settings-menu.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.d.ts +3 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/events.d.ts +14 -1
- package/dist/utils/events.js +22 -0
- package/dist/utils/events.js.map +1 -1
- package/dist/utils/keybinding.d.ts +36 -0
- package/dist/utils/keybinding.js +125 -0
- package/dist/utils/keybinding.js.map +1 -0
- package/package.json +2 -2
- package/dist/CortiDictation.d.ts +0 -55
- package/dist/CortiDictation.js +0 -303
- package/dist/CortiDictation.js.map +0 -1
- package/dist/DictationService.d.ts +0 -16
- package/dist/DictationService.js +0 -88
- package/dist/DictationService.js.map +0 -1
- package/dist/RecorderManager.d.ts +0 -25
- package/dist/RecorderManager.js +0 -145
- package/dist/RecorderManager.js.map +0 -1
- package/dist/audioService.d.ts +0 -6
- package/dist/audioService.js +0 -21
- package/dist/audioService.js.map +0 -1
- package/dist/controllers/DictationController.d.ts +0 -35
- package/dist/controllers/DictationController.js +0 -130
- package/dist/controllers/DictationController.js.map +0 -1
- package/dist/controllers/MediaController.d.ts +0 -31
- package/dist/controllers/MediaController.js +0 -99
- package/dist/controllers/MediaController.js.map +0 -1
- package/dist/src/components/audio-visualiser.d.ts +0 -14
- package/dist/src/components/audio-visualiser.js +0 -57
- package/dist/src/components/audio-visualiser.js.map +0 -1
- package/dist/src/components/corti-dictation.d.ts +0 -123
- package/dist/src/components/corti-dictation.js +0 -224
- package/dist/src/components/corti-dictation.js.map +0 -1
- package/dist/src/components/device-selector.d.ts +0 -24
- package/dist/src/components/device-selector.js +0 -106
- package/dist/src/components/device-selector.js.map +0 -1
- package/dist/src/components/language-selector.d.ts +0 -24
- package/dist/src/components/language-selector.js +0 -100
- package/dist/src/components/language-selector.js.map +0 -1
- package/dist/src/components/recording-button.d.ts +0 -37
- package/dist/src/components/recording-button.js +0 -203
- package/dist/src/components/recording-button.js.map +0 -1
- package/dist/src/components/settings-menu.d.ts +0 -16
- package/dist/src/components/settings-menu.js +0 -80
- package/dist/src/components/settings-menu.js.map +0 -1
- package/dist/src/constants.d.ts +0 -4
- package/dist/src/constants.js +0 -37
- package/dist/src/constants.js.map +0 -1
- package/dist/src/contexts/dictation-context.d.ts +0 -97
- package/dist/src/contexts/dictation-context.js +0 -208
- package/dist/src/contexts/dictation-context.js.map +0 -1
- package/dist/src/controllers/DictationController.d.ts +0 -35
- package/dist/src/controllers/DictationController.js +0 -130
- package/dist/src/controllers/DictationController.js.map +0 -1
- package/dist/src/controllers/MediaController.d.ts +0 -31
- package/dist/src/controllers/MediaController.js +0 -99
- package/dist/src/controllers/MediaController.js.map +0 -1
- package/dist/src/icons/icons.d.ts +0 -17
- package/dist/src/icons/icons.js +0 -158
- package/dist/src/icons/icons.js.map +0 -1
- package/dist/src/styles/ComponentStyles.d.ts +0 -2
- package/dist/src/styles/ComponentStyles.js +0 -18
- package/dist/src/styles/ComponentStyles.js.map +0 -1
- package/dist/src/styles/audio-visualiser.d.ts +0 -2
- package/dist/src/styles/audio-visualiser.js +0 -33
- package/dist/src/styles/audio-visualiser.js.map +0 -1
- package/dist/src/styles/buttons.d.ts +0 -2
- package/dist/src/styles/buttons.js +0 -52
- package/dist/src/styles/buttons.js.map +0 -1
- package/dist/src/styles/callout.d.ts +0 -2
- package/dist/src/styles/callout.js +0 -23
- package/dist/src/styles/callout.js.map +0 -1
- package/dist/src/styles/default-theme.d.ts +0 -2
- package/dist/src/styles/default-theme.js +0 -50
- package/dist/src/styles/default-theme.js.map +0 -1
- package/dist/src/styles/recording-button.d.ts +0 -2
- package/dist/src/styles/recording-button.js +0 -8
- package/dist/src/styles/recording-button.js.map +0 -1
- package/dist/src/styles/select.d.ts +0 -2
- package/dist/src/styles/select.js +0 -36
- package/dist/src/styles/select.js.map +0 -1
- package/dist/src/styles/settings-menu.d.ts +0 -2
- package/dist/src/styles/settings-menu.js +0 -34
- package/dist/src/styles/settings-menu.js.map +0 -1
- package/dist/src/types.d.ts +0 -7
- package/dist/src/types.js +0 -2
- package/dist/src/types.js.map +0 -1
- package/dist/src/utils/auth.d.ts +0 -9
- package/dist/src/utils/auth.js +0 -21
- package/dist/src/utils/auth.js.map +0 -1
- package/dist/src/utils/converters.d.ts +0 -4
- package/dist/src/utils/converters.js +0 -8
- package/dist/src/utils/converters.js.map +0 -1
- package/dist/src/utils/devices.d.ts +0 -26
- package/dist/src/utils/devices.js +0 -53
- package/dist/src/utils/devices.js.map +0 -1
- package/dist/src/utils/events.d.ts +0 -44
- package/dist/src/utils/events.js +0 -88
- package/dist/src/utils/events.js.map +0 -1
- package/dist/src/utils/languages.d.ts +0 -7
- package/dist/src/utils/languages.js +0 -29
- package/dist/src/utils/languages.js.map +0 -1
- package/dist/src/utils/media.d.ts +0 -6
- package/dist/src/utils/media.js +0 -39
- package/dist/src/utils/media.js.map +0 -1
- package/dist/src/utils/token.d.ts +0 -13
- package/dist/src/utils/token.js +0 -60
- package/dist/src/utils/token.js.map +0 -1
- package/dist/src/utils/validation.d.ts +0 -1
- package/dist/src/utils/validation.js +0 -7
- package/dist/src/utils/validation.js.map +0 -1
- package/dist/stories/audio-visualiser.stories.d.ts +0 -39
- package/dist/stories/audio-visualiser.stories.js +0 -71
- package/dist/stories/audio-visualiser.stories.js.map +0 -1
- package/dist/stories/corti-dictation.stories.d.ts +0 -27
- package/dist/stories/corti-dictation.stories.js +0 -129
- package/dist/stories/corti-dictation.stories.js.map +0 -1
- package/dist/stories/device-selector.stories.d.ts +0 -18
- package/dist/stories/device-selector.stories.js +0 -84
- package/dist/stories/device-selector.stories.js.map +0 -1
- package/dist/stories/language-selector.stories.d.ts +0 -18
- package/dist/stories/language-selector.stories.js +0 -53
- package/dist/stories/language-selector.stories.js.map +0 -1
- package/dist/stories/recording-button.stories.d.ts +0 -27
- package/dist/stories/recording-button.stories.js +0 -90
- package/dist/stories/recording-button.stories.js.map +0 -1
- package/dist/stories/settings-menu.stories.d.ts +0 -23
- package/dist/stories/settings-menu.stories.js +0 -156
- package/dist/stories/settings-menu.stories.js.map +0 -1
- package/dist/styles/ComponentStyles.d.ts +0 -2
- package/dist/styles/ComponentStyles.js +0 -18
- package/dist/styles/ComponentStyles.js.map +0 -1
- package/dist/styles/default-theme.d.ts +0 -2
- package/dist/styles/default-theme.js +0 -14
- package/dist/styles/default-theme.js.map +0 -1
- package/dist/styles/theme.d.ts +0 -2
- package/dist/styles/theme.js +0 -56
- package/dist/styles/theme.js.map +0 -1
- package/dist/tsconfig.stories.tsbuildinfo +0 -1
- package/dist/utils.d.ts +0 -59
- package/dist/utils.js +0 -179
- package/dist/utils.js.map +0 -1
package/dist/bundle.js
CHANGED
|
@@ -1079,6 +1079,28 @@ function networkActivityEvent(direction, data) {
|
|
|
1079
1079
|
detail: { data, direction }
|
|
1080
1080
|
});
|
|
1081
1081
|
}
|
|
1082
|
+
function modeChangedEvent(mode) {
|
|
1083
|
+
return new CustomEvent("mode-changed", {
|
|
1084
|
+
bubbles: true,
|
|
1085
|
+
composed: true,
|
|
1086
|
+
detail: { mode }
|
|
1087
|
+
});
|
|
1088
|
+
}
|
|
1089
|
+
function keybindingChangedEvent(key, code) {
|
|
1090
|
+
return new CustomEvent("keybinding-changed", {
|
|
1091
|
+
bubbles: true,
|
|
1092
|
+
composed: true,
|
|
1093
|
+
detail: { code, key }
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
function keybindingActivatedEvent(keyboardEvent) {
|
|
1097
|
+
return new CustomEvent("keybinding-activated", {
|
|
1098
|
+
bubbles: true,
|
|
1099
|
+
cancelable: true,
|
|
1100
|
+
composed: true,
|
|
1101
|
+
detail: { keyboardEvent }
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1082
1104
|
|
|
1083
1105
|
// dist/controllers/devices-controller.js
|
|
1084
1106
|
var __classPrivateFieldSet = function(receiver, state, value, kind, f5) {
|
|
@@ -1291,6 +1313,16 @@ var ComponentStyles = i`
|
|
|
1291
1313
|
overflow: hidden;
|
|
1292
1314
|
}
|
|
1293
1315
|
`;
|
|
1316
|
+
var LabelStyles = i`
|
|
1317
|
+
label {
|
|
1318
|
+
display: block;
|
|
1319
|
+
font-size: 0.8rem;
|
|
1320
|
+
padding-bottom: 0.5rem;
|
|
1321
|
+
font-weight: 500;
|
|
1322
|
+
color: var(--component-text-color, light-dark(#333, #eee));
|
|
1323
|
+
pointer-events: none;
|
|
1324
|
+
}
|
|
1325
|
+
`;
|
|
1294
1326
|
var component_styles_default = ComponentStyles;
|
|
1295
1327
|
|
|
1296
1328
|
// dist/utils/auth.js
|
|
@@ -1308,6 +1340,71 @@ async function getInitialToken(config) {
|
|
|
1308
1340
|
};
|
|
1309
1341
|
}
|
|
1310
1342
|
|
|
1343
|
+
// dist/utils/keybinding.js
|
|
1344
|
+
function isMac() {
|
|
1345
|
+
if (typeof navigator === "undefined") {
|
|
1346
|
+
return false;
|
|
1347
|
+
}
|
|
1348
|
+
return /Mac|iPhone|iPad|iPod/.test(navigator.userAgent);
|
|
1349
|
+
}
|
|
1350
|
+
function capitalize(str) {
|
|
1351
|
+
if (str.length === 0) {
|
|
1352
|
+
return str;
|
|
1353
|
+
}
|
|
1354
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1355
|
+
}
|
|
1356
|
+
function normalizeKeyForKeybinding(key) {
|
|
1357
|
+
if (key === " ") {
|
|
1358
|
+
return "Space";
|
|
1359
|
+
}
|
|
1360
|
+
const normalized = key.trim().toLowerCase();
|
|
1361
|
+
if (normalized === "control") {
|
|
1362
|
+
return "Ctrl";
|
|
1363
|
+
}
|
|
1364
|
+
if (normalized === "meta" || normalized === "cmd") {
|
|
1365
|
+
return isMac() ? "Cmd" : "Meta";
|
|
1366
|
+
}
|
|
1367
|
+
if (normalized === "alt" || normalized === "opt") {
|
|
1368
|
+
return isMac() ? "Opt" : "Alt";
|
|
1369
|
+
}
|
|
1370
|
+
if (normalized === "space") {
|
|
1371
|
+
return "Space";
|
|
1372
|
+
}
|
|
1373
|
+
return normalized.length > 1 ? capitalize(normalized) : normalized;
|
|
1374
|
+
}
|
|
1375
|
+
function normalizeKeybinding(keybinding) {
|
|
1376
|
+
if (!keybinding) {
|
|
1377
|
+
return null;
|
|
1378
|
+
}
|
|
1379
|
+
const trimmed = keybinding.trim();
|
|
1380
|
+
if (trimmed === "") {
|
|
1381
|
+
return null;
|
|
1382
|
+
}
|
|
1383
|
+
return normalizeKeyForKeybinding(trimmed);
|
|
1384
|
+
}
|
|
1385
|
+
function matchesKeybinding(event, keybinding) {
|
|
1386
|
+
const normalizedKeybinding = normalizeKeybinding(keybinding);
|
|
1387
|
+
if (!normalizedKeybinding) {
|
|
1388
|
+
return false;
|
|
1389
|
+
}
|
|
1390
|
+
const normalizedKey = normalizeKeyForKeybinding(event.key);
|
|
1391
|
+
const normalizedCode = normalizeKeyForKeybinding(event.code);
|
|
1392
|
+
return normalizedKey === normalizedKeybinding || normalizedCode === normalizedKeybinding;
|
|
1393
|
+
}
|
|
1394
|
+
function shouldIgnoreKeybinding(element) {
|
|
1395
|
+
if (!element) {
|
|
1396
|
+
return false;
|
|
1397
|
+
}
|
|
1398
|
+
const tagName = element.tagName.toLowerCase();
|
|
1399
|
+
if (tagName === "input" || tagName === "textarea") {
|
|
1400
|
+
return true;
|
|
1401
|
+
}
|
|
1402
|
+
if (element instanceof HTMLElement && element.contentEditable === "true") {
|
|
1403
|
+
return true;
|
|
1404
|
+
}
|
|
1405
|
+
return false;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1311
1408
|
// dist/utils/token.js
|
|
1312
1409
|
function decodeToken(token) {
|
|
1313
1410
|
const parts = token.split(".");
|
|
@@ -1364,6 +1461,8 @@ var _DictationRoot_handleLanguageChanged;
|
|
|
1364
1461
|
var _DictationRoot_handleDeviceChanged;
|
|
1365
1462
|
var _DictationRoot_handleRecordingStateChanged;
|
|
1366
1463
|
var _DictationRoot_handleContextRequest;
|
|
1464
|
+
var _DictationRoot_handleModeChanged;
|
|
1465
|
+
var _DictationRoot_handleKeybindingChanged;
|
|
1367
1466
|
var regionContext = n7(Symbol("region"));
|
|
1368
1467
|
var tenantNameContext = n7(Symbol("tenantName"));
|
|
1369
1468
|
var languagesContext = n7(Symbol("languages"));
|
|
@@ -1376,6 +1475,8 @@ var authConfigContext = n7(Symbol("authConfig"));
|
|
|
1376
1475
|
var socketUrlContext = n7(Symbol("socketUrl"));
|
|
1377
1476
|
var socketProxyContext = n7(Symbol("socketProxy"));
|
|
1378
1477
|
var debugDisplayAudioContext = n7(Symbol("debugDisplayAudio"));
|
|
1478
|
+
var modeContext = n7(Symbol("mode"));
|
|
1479
|
+
var keybindingContext = n7(Symbol("keybinding"));
|
|
1379
1480
|
var DictationRoot = class DictationRoot2 extends i4 {
|
|
1380
1481
|
set accessToken(token) {
|
|
1381
1482
|
this.setAccessToken(token);
|
|
@@ -1415,6 +1516,7 @@ var DictationRoot = class DictationRoot2 extends i4 {
|
|
|
1415
1516
|
this.recordingState = "stopped";
|
|
1416
1517
|
_DictationRoot_languagesController.set(this, new LanguagesController(this));
|
|
1417
1518
|
_DictationRoot_devicesController.set(this, new DevicesController(this));
|
|
1519
|
+
this.mode = "toggle-to-talk";
|
|
1418
1520
|
this.noWrapper = false;
|
|
1419
1521
|
_DictationRoot_handleLanguageChanged.set(this, (e10) => {
|
|
1420
1522
|
const event = e10;
|
|
@@ -1436,12 +1538,28 @@ var DictationRoot = class DictationRoot2 extends i4 {
|
|
|
1436
1538
|
__classPrivateFieldGet3(this, _DictationRoot_languagesController, "f").initialize();
|
|
1437
1539
|
} else if (e10.context === devicesContext) {
|
|
1438
1540
|
__classPrivateFieldGet3(this, _DictationRoot_devicesController, "f").initialize();
|
|
1541
|
+
} else if (e10.context === keybindingContext && e10.contextTarget.tagName.toLowerCase() === "dictation-keybinding-selector") {
|
|
1542
|
+
if (this.keybinding === void 0) {
|
|
1543
|
+
this.keybinding = "`";
|
|
1544
|
+
this.dispatchEvent(keybindingChangedEvent("`", "Backquote"));
|
|
1545
|
+
}
|
|
1439
1546
|
}
|
|
1440
1547
|
});
|
|
1548
|
+
_DictationRoot_handleModeChanged.set(this, (e10) => {
|
|
1549
|
+
const event = e10;
|
|
1550
|
+
this.mode = event.detail.mode;
|
|
1551
|
+
});
|
|
1552
|
+
_DictationRoot_handleKeybindingChanged.set(this, (e10) => {
|
|
1553
|
+
const event = e10;
|
|
1554
|
+
const normalizedKeybinding = normalizeKeybinding(event.detail.key);
|
|
1555
|
+
this.keybinding = normalizedKeybinding;
|
|
1556
|
+
});
|
|
1441
1557
|
this.addEventListener("languages-changed", __classPrivateFieldGet3(this, _DictationRoot_handleLanguageChanged, "f"));
|
|
1442
1558
|
this.addEventListener("recording-devices-changed", __classPrivateFieldGet3(this, _DictationRoot_handleDeviceChanged, "f"));
|
|
1443
1559
|
this.addEventListener("recording-state-changed", __classPrivateFieldGet3(this, _DictationRoot_handleRecordingStateChanged, "f"));
|
|
1444
1560
|
this.addEventListener("context-request", __classPrivateFieldGet3(this, _DictationRoot_handleContextRequest, "f"));
|
|
1561
|
+
this.addEventListener("mode-changed", __classPrivateFieldGet3(this, _DictationRoot_handleModeChanged, "f"));
|
|
1562
|
+
this.addEventListener("keybinding-changed", __classPrivateFieldGet3(this, _DictationRoot_handleKeybindingChanged, "f"));
|
|
1445
1563
|
}
|
|
1446
1564
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
1447
1565
|
// Public methods
|
|
@@ -1516,6 +1634,8 @@ _DictationRoot_handleLanguageChanged = /* @__PURE__ */ new WeakMap();
|
|
|
1516
1634
|
_DictationRoot_handleDeviceChanged = /* @__PURE__ */ new WeakMap();
|
|
1517
1635
|
_DictationRoot_handleRecordingStateChanged = /* @__PURE__ */ new WeakMap();
|
|
1518
1636
|
_DictationRoot_handleContextRequest = /* @__PURE__ */ new WeakMap();
|
|
1637
|
+
_DictationRoot_handleModeChanged = /* @__PURE__ */ new WeakMap();
|
|
1638
|
+
_DictationRoot_handleKeybindingChanged = /* @__PURE__ */ new WeakMap();
|
|
1519
1639
|
DictationRoot.styles = [component_styles_default];
|
|
1520
1640
|
__decorate([
|
|
1521
1641
|
e9({ context: regionContext }),
|
|
@@ -1580,6 +1700,14 @@ __decorate([
|
|
|
1580
1700
|
e9({ context: debugDisplayAudioContext }),
|
|
1581
1701
|
n4({ attribute: "debug-display-audio", type: Boolean })
|
|
1582
1702
|
], DictationRoot.prototype, "debug_displayAudio", void 0);
|
|
1703
|
+
__decorate([
|
|
1704
|
+
e9({ context: modeContext }),
|
|
1705
|
+
n4({ type: String })
|
|
1706
|
+
], DictationRoot.prototype, "mode", void 0);
|
|
1707
|
+
__decorate([
|
|
1708
|
+
e9({ context: keybindingContext }),
|
|
1709
|
+
n4({ type: String })
|
|
1710
|
+
], DictationRoot.prototype, "keybinding", void 0);
|
|
1583
1711
|
__decorate([
|
|
1584
1712
|
n4({ type: Boolean })
|
|
1585
1713
|
], DictationRoot.prototype, "noWrapper", void 0);
|
|
@@ -6118,7 +6246,7 @@ var Auth = class {
|
|
|
6118
6246
|
function getEnvironment(environment = "eu") {
|
|
6119
6247
|
return typeof environment === "string" ? {
|
|
6120
6248
|
base: `https://api.${environment}.corti.app/v2`,
|
|
6121
|
-
wss: `wss://api.${environment}.corti.app`,
|
|
6249
|
+
wss: `wss://api.${environment}.corti.app/audio-bridge/v2`,
|
|
6122
6250
|
login: `https://auth.${environment}.corti.app/realms`,
|
|
6123
6251
|
agents: `https://api.${environment}.corti.app`
|
|
6124
6252
|
} : environment;
|
|
@@ -10332,7 +10460,7 @@ var Stream = class {
|
|
|
10332
10460
|
_queryParams["token"] = token;
|
|
10333
10461
|
let _headers = Object.assign({}, headers);
|
|
10334
10462
|
const socket = new ReconnectingWebSocket({
|
|
10335
|
-
url: url_exports.join((_a = yield Supplier.get(this._options["baseUrl"])) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options["environment"])).wss, `/
|
|
10463
|
+
url: url_exports.join((_a = yield Supplier.get(this._options["baseUrl"])) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options["environment"])).wss, `/interactions/${encodeURIComponent(id)}/streams`),
|
|
10336
10464
|
protocols: [],
|
|
10337
10465
|
queryParameters: _queryParams,
|
|
10338
10466
|
headers: _headers,
|
|
@@ -10711,7 +10839,7 @@ var Transcribe = class {
|
|
|
10711
10839
|
_queryParams["token"] = token;
|
|
10712
10840
|
let _headers = Object.assign({}, headers);
|
|
10713
10841
|
const socket = new ReconnectingWebSocket({
|
|
10714
|
-
url: url_exports.join((_a = yield Supplier.get(this._options["baseUrl"])) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options["environment"])).wss, "/
|
|
10842
|
+
url: url_exports.join((_a = yield Supplier.get(this._options["baseUrl"])) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options["environment"])).wss, "/transcribe"),
|
|
10715
10843
|
protocols: [],
|
|
10716
10844
|
queryParameters: _queryParams,
|
|
10717
10845
|
headers: _headers,
|
|
@@ -10874,7 +11002,7 @@ var Transcribe2 = class extends Transcribe {
|
|
|
10874
11002
|
};
|
|
10875
11003
|
|
|
10876
11004
|
// node_modules/@corti/sdk/dist/esm/version.mjs
|
|
10877
|
-
var SDK_VERSION = "0.8.0
|
|
11005
|
+
var SDK_VERSION = "0.8.0";
|
|
10878
11006
|
|
|
10879
11007
|
// node_modules/@corti/sdk/dist/esm/custom/utils/resolveClientOptions.mjs
|
|
10880
11008
|
var __awaiter30 = function(thisArg, _arguments, P2, generator) {
|
|
@@ -11080,13 +11208,13 @@ var CortiClient = class {
|
|
|
11080
11208
|
var CortiEnvironment = {
|
|
11081
11209
|
Eu: {
|
|
11082
11210
|
base: "https://api.eu.corti.app/v2",
|
|
11083
|
-
wss: "wss://api.eu.corti.app",
|
|
11211
|
+
wss: "wss://api.eu.corti.app/audio-bridge/v2",
|
|
11084
11212
|
login: "https://auth.eu.corti.app/realms",
|
|
11085
11213
|
agents: "https://api.eu.corti.app"
|
|
11086
11214
|
},
|
|
11087
11215
|
Us: {
|
|
11088
11216
|
base: "https://api.us.corti.app/v2",
|
|
11089
|
-
wss: "wss://api.us.corti.app",
|
|
11217
|
+
wss: "wss://api.us.corti.app/audio-bridge/v2",
|
|
11090
11218
|
login: "https://auth.us.corti.app/realms",
|
|
11091
11219
|
agents: "https://api.us.corti.app"
|
|
11092
11220
|
}
|
|
@@ -11146,7 +11274,11 @@ var _DictationController_instances;
|
|
|
11146
11274
|
var _DictationController_cortiClient;
|
|
11147
11275
|
var _DictationController_webSocket;
|
|
11148
11276
|
var _DictationController_closeTimeout;
|
|
11149
|
-
var
|
|
11277
|
+
var _DictationController_callbacks;
|
|
11278
|
+
var _DictationController_lastDictationConfig;
|
|
11279
|
+
var _DictationController_lastSocketUrl;
|
|
11280
|
+
var _DictationController_lastSocketProxy;
|
|
11281
|
+
var _DictationController_configHasChanged;
|
|
11150
11282
|
var _DictationController_connectProxy;
|
|
11151
11283
|
var _DictationController_connectAuth;
|
|
11152
11284
|
var _DictationController_setupWebSocketHandlers;
|
|
@@ -11157,7 +11289,10 @@ var DictationController = class {
|
|
|
11157
11289
|
_DictationController_cortiClient.set(this, null);
|
|
11158
11290
|
_DictationController_webSocket.set(this, null);
|
|
11159
11291
|
_DictationController_closeTimeout.set(this, void 0);
|
|
11160
|
-
|
|
11292
|
+
_DictationController_callbacks.set(this, void 0);
|
|
11293
|
+
_DictationController_lastDictationConfig.set(this, null);
|
|
11294
|
+
_DictationController_lastSocketUrl.set(this, void 0);
|
|
11295
|
+
_DictationController_lastSocketProxy.set(this, void 0);
|
|
11161
11296
|
this.host = host;
|
|
11162
11297
|
host.addController(this);
|
|
11163
11298
|
}
|
|
@@ -11168,17 +11303,25 @@ var DictationController = class {
|
|
|
11168
11303
|
if (!mediaRecorder) {
|
|
11169
11304
|
throw new Error("MediaRecorder is required to connect");
|
|
11170
11305
|
}
|
|
11171
|
-
|
|
11172
|
-
|
|
11306
|
+
const newConnection = __classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_configHasChanged).call(this) || __classPrivateFieldGet4(this, _DictationController_webSocket, "f")?.readyState !== WebSocket.OPEN;
|
|
11307
|
+
if (newConnection) {
|
|
11308
|
+
this.cleanup();
|
|
11309
|
+
if (__classPrivateFieldGet4(this, _DictationController_webSocket, "f")?.readyState === WebSocket.OPEN) {
|
|
11310
|
+
throw new Error("Already connected. Disconnect before reconnecting.");
|
|
11311
|
+
}
|
|
11312
|
+
__classPrivateFieldSet3(this, _DictationController_webSocket, 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), "f");
|
|
11313
|
+
__classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onNetworkActivity?.("sent", {
|
|
11314
|
+
configuration: dictationConfig,
|
|
11315
|
+
type: "config"
|
|
11316
|
+
});
|
|
11317
|
+
__classPrivateFieldSet3(this, _DictationController_lastDictationConfig, this.host._dictationConfig || null, "f");
|
|
11318
|
+
__classPrivateFieldSet3(this, _DictationController_lastSocketUrl, this.host._socketUrl, "f");
|
|
11319
|
+
__classPrivateFieldSet3(this, _DictationController_lastSocketProxy, this.host._socketProxy, "f");
|
|
11173
11320
|
}
|
|
11174
|
-
__classPrivateFieldSet3(this,
|
|
11175
|
-
__classPrivateFieldSet3(this, _DictationController_onNetworkActivity, callbacks.onNetworkActivity, "f");
|
|
11176
|
-
__classPrivateFieldGet4(this, _DictationController_onNetworkActivity, "f")?.call(this, "sent", {
|
|
11177
|
-
configuration: dictationConfig,
|
|
11178
|
-
type: "config"
|
|
11179
|
-
});
|
|
11321
|
+
__classPrivateFieldSet3(this, _DictationController_callbacks, callbacks, "f");
|
|
11180
11322
|
__classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_setupMediaRecorder).call(this, mediaRecorder);
|
|
11181
11323
|
__classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_setupWebSocketHandlers).call(this, callbacks);
|
|
11324
|
+
return newConnection;
|
|
11182
11325
|
}
|
|
11183
11326
|
async disconnect(onClose) {
|
|
11184
11327
|
await new Promise((resolve, reject) => {
|
|
@@ -11196,16 +11339,29 @@ var DictationController = class {
|
|
|
11196
11339
|
}
|
|
11197
11340
|
resolve();
|
|
11198
11341
|
});
|
|
11199
|
-
__classPrivateFieldGet4(this, _DictationController_webSocket, "f").
|
|
11200
|
-
|
|
11342
|
+
__classPrivateFieldGet4(this, _DictationController_webSocket, "f").on("message", (message) => {
|
|
11343
|
+
__classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onNetworkActivity?.("received", message);
|
|
11344
|
+
if (__classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onMessage) {
|
|
11345
|
+
__classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onMessage(message);
|
|
11346
|
+
}
|
|
11347
|
+
if (message.type === "flushed") {
|
|
11348
|
+
if (__classPrivateFieldGet4(this, _DictationController_closeTimeout, "f")) {
|
|
11349
|
+
clearTimeout(__classPrivateFieldGet4(this, _DictationController_closeTimeout, "f"));
|
|
11350
|
+
__classPrivateFieldSet3(this, _DictationController_closeTimeout, void 0, "f");
|
|
11351
|
+
}
|
|
11352
|
+
resolve();
|
|
11353
|
+
return;
|
|
11354
|
+
}
|
|
11355
|
+
});
|
|
11356
|
+
__classPrivateFieldGet4(this, _DictationController_webSocket, "f").sendFlush({ type: "flush" });
|
|
11357
|
+
__classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onNetworkActivity?.("sent", { type: "flush" });
|
|
11201
11358
|
__classPrivateFieldSet3(this, _DictationController_closeTimeout, window.setTimeout(() => {
|
|
11202
|
-
reject(new Error("
|
|
11359
|
+
reject(new Error("Audio processing timeout"));
|
|
11203
11360
|
if (__classPrivateFieldGet4(this, _DictationController_webSocket, "f")?.readyState === WebSocket.OPEN) {
|
|
11204
11361
|
__classPrivateFieldGet4(this, _DictationController_webSocket, "f").close();
|
|
11205
11362
|
}
|
|
11206
11363
|
}, 1e4), "f");
|
|
11207
11364
|
});
|
|
11208
|
-
this.cleanup();
|
|
11209
11365
|
}
|
|
11210
11366
|
cleanup() {
|
|
11211
11367
|
if (__classPrivateFieldGet4(this, _DictationController_closeTimeout, "f")) {
|
|
@@ -11217,9 +11373,14 @@ var DictationController = class {
|
|
|
11217
11373
|
}
|
|
11218
11374
|
__classPrivateFieldSet3(this, _DictationController_webSocket, null, "f");
|
|
11219
11375
|
__classPrivateFieldSet3(this, _DictationController_cortiClient, null, "f");
|
|
11376
|
+
__classPrivateFieldSet3(this, _DictationController_lastDictationConfig, null, "f");
|
|
11377
|
+
__classPrivateFieldSet3(this, _DictationController_lastSocketUrl, void 0, "f");
|
|
11378
|
+
__classPrivateFieldSet3(this, _DictationController_lastSocketProxy, void 0, "f");
|
|
11220
11379
|
}
|
|
11221
11380
|
};
|
|
11222
|
-
_DictationController_cortiClient = /* @__PURE__ */ new WeakMap(), _DictationController_webSocket = /* @__PURE__ */ new WeakMap(), _DictationController_closeTimeout = /* @__PURE__ */ new WeakMap(),
|
|
11381
|
+
_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_instances = /* @__PURE__ */ new WeakSet(), _DictationController_configHasChanged = function _DictationController_configHasChanged2() {
|
|
11382
|
+
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"));
|
|
11383
|
+
}, _DictationController_connectProxy = async function _DictationController_connectProxy2(dictationConfig) {
|
|
11223
11384
|
const proxyOptions = this.host._socketProxy || {
|
|
11224
11385
|
url: this.host._socketUrl || ""
|
|
11225
11386
|
};
|
|
@@ -11253,7 +11414,7 @@ _DictationController_cortiClient = /* @__PURE__ */ new WeakMap(), _DictationCont
|
|
|
11253
11414
|
throw new Error("WebSocket not initialized");
|
|
11254
11415
|
}
|
|
11255
11416
|
__classPrivateFieldGet4(this, _DictationController_webSocket, "f").on("message", (message) => {
|
|
11256
|
-
|
|
11417
|
+
callbacks.onNetworkActivity?.("received", message);
|
|
11257
11418
|
if (callbacks.onMessage) {
|
|
11258
11419
|
callbacks.onMessage(message);
|
|
11259
11420
|
}
|
|
@@ -11271,13 +11432,102 @@ _DictationController_cortiClient = /* @__PURE__ */ new WeakMap(), _DictationCont
|
|
|
11271
11432
|
}, _DictationController_setupMediaRecorder = function _DictationController_setupMediaRecorder2(mediaRecorder) {
|
|
11272
11433
|
mediaRecorder.ondataavailable = (event) => {
|
|
11273
11434
|
__classPrivateFieldGet4(this, _DictationController_webSocket, "f")?.sendAudio(event.data);
|
|
11274
|
-
__classPrivateFieldGet4(this,
|
|
11435
|
+
__classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onNetworkActivity?.("sent", {
|
|
11275
11436
|
size: event.data.size,
|
|
11276
11437
|
type: "audio"
|
|
11277
11438
|
});
|
|
11278
11439
|
};
|
|
11279
11440
|
};
|
|
11280
11441
|
|
|
11442
|
+
// dist/controllers/keybinding-controller.js
|
|
11443
|
+
var __classPrivateFieldGet5 = function(receiver, state, kind, f5) {
|
|
11444
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
11445
|
+
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");
|
|
11446
|
+
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
11447
|
+
};
|
|
11448
|
+
var __classPrivateFieldSet4 = function(receiver, state, value, kind, f5) {
|
|
11449
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
11450
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a setter");
|
|
11451
|
+
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");
|
|
11452
|
+
return kind === "a" ? f5.call(receiver, value) : f5 ? f5.value = value : state.set(receiver, value), value;
|
|
11453
|
+
};
|
|
11454
|
+
var _KeybindingController_instances;
|
|
11455
|
+
var _KeybindingController_keydownHandler;
|
|
11456
|
+
var _KeybindingController_keyupHandler;
|
|
11457
|
+
var _KeybindingController_blurHandler;
|
|
11458
|
+
var _KeybindingController_setupListeners;
|
|
11459
|
+
var _KeybindingController_removeListeners;
|
|
11460
|
+
var KeybindingController = class {
|
|
11461
|
+
constructor(host) {
|
|
11462
|
+
_KeybindingController_instances.add(this);
|
|
11463
|
+
_KeybindingController_keydownHandler.set(this, void 0);
|
|
11464
|
+
_KeybindingController_keyupHandler.set(this, void 0);
|
|
11465
|
+
_KeybindingController_blurHandler.set(this, void 0);
|
|
11466
|
+
this.host = host;
|
|
11467
|
+
host.addController(this);
|
|
11468
|
+
}
|
|
11469
|
+
hostConnected() {
|
|
11470
|
+
__classPrivateFieldGet5(this, _KeybindingController_instances, "m", _KeybindingController_setupListeners).call(this);
|
|
11471
|
+
}
|
|
11472
|
+
hostDisconnected() {
|
|
11473
|
+
__classPrivateFieldGet5(this, _KeybindingController_instances, "m", _KeybindingController_removeListeners).call(this);
|
|
11474
|
+
}
|
|
11475
|
+
};
|
|
11476
|
+
_KeybindingController_keydownHandler = /* @__PURE__ */ new WeakMap(), _KeybindingController_keyupHandler = /* @__PURE__ */ new WeakMap(), _KeybindingController_blurHandler = /* @__PURE__ */ new WeakMap(), _KeybindingController_instances = /* @__PURE__ */ new WeakSet(), _KeybindingController_setupListeners = function _KeybindingController_setupListeners2() {
|
|
11477
|
+
__classPrivateFieldGet5(this, _KeybindingController_instances, "m", _KeybindingController_removeListeners).call(this);
|
|
11478
|
+
__classPrivateFieldSet4(this, _KeybindingController_keydownHandler, (event) => {
|
|
11479
|
+
if (!this.host._keybinding) {
|
|
11480
|
+
return;
|
|
11481
|
+
}
|
|
11482
|
+
if (shouldIgnoreKeybinding(document.activeElement)) {
|
|
11483
|
+
return;
|
|
11484
|
+
}
|
|
11485
|
+
if (matchesKeybinding(event, this.host._keybinding)) {
|
|
11486
|
+
if (!this.host.dispatchEvent(keybindingActivatedEvent(event))) {
|
|
11487
|
+
return;
|
|
11488
|
+
}
|
|
11489
|
+
if (this.host._mode === "push-to-talk") {
|
|
11490
|
+
this.host.startRecording();
|
|
11491
|
+
}
|
|
11492
|
+
if (this.host._mode === "toggle-to-talk") {
|
|
11493
|
+
this.host.toggleRecording();
|
|
11494
|
+
}
|
|
11495
|
+
}
|
|
11496
|
+
}, "f");
|
|
11497
|
+
__classPrivateFieldSet4(this, _KeybindingController_keyupHandler, (event) => {
|
|
11498
|
+
if (!this.host._keybinding) {
|
|
11499
|
+
return;
|
|
11500
|
+
}
|
|
11501
|
+
if (this.host._mode === "push-to-talk" && matchesKeybinding(event, this.host._keybinding)) {
|
|
11502
|
+
if (!this.host.dispatchEvent(keybindingActivatedEvent(event))) {
|
|
11503
|
+
return;
|
|
11504
|
+
}
|
|
11505
|
+
this.host.stopRecording();
|
|
11506
|
+
}
|
|
11507
|
+
}, "f");
|
|
11508
|
+
__classPrivateFieldSet4(this, _KeybindingController_blurHandler, () => {
|
|
11509
|
+
if (this.host._mode === "push-to-talk") {
|
|
11510
|
+
this.host.stopRecording();
|
|
11511
|
+
}
|
|
11512
|
+
}, "f");
|
|
11513
|
+
window.addEventListener("keydown", __classPrivateFieldGet5(this, _KeybindingController_keydownHandler, "f"));
|
|
11514
|
+
window.addEventListener("keyup", __classPrivateFieldGet5(this, _KeybindingController_keyupHandler, "f"));
|
|
11515
|
+
window.addEventListener("blur", __classPrivateFieldGet5(this, _KeybindingController_blurHandler, "f"));
|
|
11516
|
+
}, _KeybindingController_removeListeners = function _KeybindingController_removeListeners2() {
|
|
11517
|
+
if (__classPrivateFieldGet5(this, _KeybindingController_keydownHandler, "f")) {
|
|
11518
|
+
window.removeEventListener("keydown", __classPrivateFieldGet5(this, _KeybindingController_keydownHandler, "f"));
|
|
11519
|
+
__classPrivateFieldSet4(this, _KeybindingController_keydownHandler, void 0, "f");
|
|
11520
|
+
}
|
|
11521
|
+
if (__classPrivateFieldGet5(this, _KeybindingController_keyupHandler, "f")) {
|
|
11522
|
+
window.removeEventListener("keyup", __classPrivateFieldGet5(this, _KeybindingController_keyupHandler, "f"));
|
|
11523
|
+
__classPrivateFieldSet4(this, _KeybindingController_keyupHandler, void 0, "f");
|
|
11524
|
+
}
|
|
11525
|
+
if (__classPrivateFieldGet5(this, _KeybindingController_blurHandler, "f")) {
|
|
11526
|
+
window.removeEventListener("blur", __classPrivateFieldGet5(this, _KeybindingController_blurHandler, "f"));
|
|
11527
|
+
__classPrivateFieldSet4(this, _KeybindingController_blurHandler, void 0, "f");
|
|
11528
|
+
}
|
|
11529
|
+
};
|
|
11530
|
+
|
|
11281
11531
|
// dist/utils/media.js
|
|
11282
11532
|
async function getMediaStream(deviceId, debug_displayAudio) {
|
|
11283
11533
|
if (debug_displayAudio) {
|
|
@@ -11317,13 +11567,13 @@ function calculateAudioLevel(analyser) {
|
|
|
11317
11567
|
}
|
|
11318
11568
|
|
|
11319
11569
|
// dist/controllers/media-controller.js
|
|
11320
|
-
var
|
|
11570
|
+
var __classPrivateFieldSet5 = function(receiver, state, value, kind, f5) {
|
|
11321
11571
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
11322
11572
|
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a setter");
|
|
11323
11573
|
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");
|
|
11324
11574
|
return kind === "a" ? f5.call(receiver, value) : f5 ? f5.value = value : state.set(receiver, value), value;
|
|
11325
11575
|
};
|
|
11326
|
-
var
|
|
11576
|
+
var __classPrivateFieldGet6 = function(receiver, state, kind, f5) {
|
|
11327
11577
|
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
11328
11578
|
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");
|
|
11329
11579
|
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
@@ -11354,64 +11604,64 @@ var MediaController = class {
|
|
|
11354
11604
|
}
|
|
11355
11605
|
async initialize(onTrackEnded) {
|
|
11356
11606
|
await this.cleanup();
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
|
|
11607
|
+
__classPrivateFieldSet5(this, _MediaController_onTrackEnded, onTrackEnded, "f");
|
|
11608
|
+
__classPrivateFieldSet5(this, _MediaController_mediaStream, await getMediaStream(this.host._selectedDevice?.deviceId, this.host._debug_displayAudio), "f");
|
|
11609
|
+
__classPrivateFieldGet6(this, _MediaController_mediaStream, "f").getTracks().forEach((track) => {
|
|
11360
11610
|
track.addEventListener("ended", () => {
|
|
11361
|
-
if (
|
|
11362
|
-
|
|
11611
|
+
if (__classPrivateFieldGet6(this, _MediaController_onTrackEnded, "f")) {
|
|
11612
|
+
__classPrivateFieldGet6(this, _MediaController_onTrackEnded, "f").call(this);
|
|
11363
11613
|
}
|
|
11364
11614
|
});
|
|
11365
11615
|
});
|
|
11366
|
-
const { audioContext, analyser } = createAudioAnalyzer(
|
|
11367
|
-
|
|
11368
|
-
|
|
11369
|
-
|
|
11616
|
+
const { audioContext, analyser } = createAudioAnalyzer(__classPrivateFieldGet6(this, _MediaController_mediaStream, "f"));
|
|
11617
|
+
__classPrivateFieldSet5(this, _MediaController_audioContext, audioContext, "f");
|
|
11618
|
+
__classPrivateFieldSet5(this, _MediaController_analyser, analyser, "f");
|
|
11619
|
+
__classPrivateFieldSet5(this, _MediaController_mediaRecorder, new MediaRecorder(__classPrivateFieldGet6(this, _MediaController_mediaStream, "f")), "f");
|
|
11370
11620
|
}
|
|
11371
11621
|
getAudioLevel() {
|
|
11372
|
-
return
|
|
11622
|
+
return __classPrivateFieldGet6(this, _MediaController_analyser, "f") ? calculateAudioLevel(__classPrivateFieldGet6(this, _MediaController_analyser, "f")) : 0;
|
|
11373
11623
|
}
|
|
11374
11624
|
startAudioLevelMonitoring(onAudioLevelChange) {
|
|
11375
11625
|
this.stopAudioLevelMonitoring();
|
|
11376
|
-
|
|
11377
|
-
|
|
11378
|
-
|
|
11626
|
+
__classPrivateFieldSet5(this, _MediaController_onAudioLevelChange, onAudioLevelChange, "f");
|
|
11627
|
+
__classPrivateFieldSet5(this, _MediaController_visualiserInterval, window.setInterval(() => {
|
|
11628
|
+
__classPrivateFieldSet5(this, _MediaController_audioLevel, this.getAudioLevel() * 3, "f");
|
|
11379
11629
|
this.host.requestUpdate();
|
|
11380
|
-
if (
|
|
11381
|
-
|
|
11630
|
+
if (__classPrivateFieldGet6(this, _MediaController_onAudioLevelChange, "f")) {
|
|
11631
|
+
__classPrivateFieldGet6(this, _MediaController_onAudioLevelChange, "f").call(this, __classPrivateFieldGet6(this, _MediaController_audioLevel, "f"));
|
|
11382
11632
|
}
|
|
11383
11633
|
}, 150), "f");
|
|
11384
11634
|
}
|
|
11385
11635
|
stopAudioLevelMonitoring() {
|
|
11386
|
-
if (
|
|
11387
|
-
clearInterval(
|
|
11388
|
-
|
|
11636
|
+
if (__classPrivateFieldGet6(this, _MediaController_visualiserInterval, "f")) {
|
|
11637
|
+
clearInterval(__classPrivateFieldGet6(this, _MediaController_visualiserInterval, "f"));
|
|
11638
|
+
__classPrivateFieldSet5(this, _MediaController_visualiserInterval, void 0, "f");
|
|
11389
11639
|
}
|
|
11390
|
-
|
|
11640
|
+
__classPrivateFieldSet5(this, _MediaController_audioLevel, 0, "f");
|
|
11391
11641
|
this.host.requestUpdate();
|
|
11392
|
-
if (
|
|
11393
|
-
|
|
11642
|
+
if (__classPrivateFieldGet6(this, _MediaController_onAudioLevelChange, "f")) {
|
|
11643
|
+
__classPrivateFieldGet6(this, _MediaController_onAudioLevelChange, "f").call(this, __classPrivateFieldGet6(this, _MediaController_audioLevel, "f"));
|
|
11394
11644
|
}
|
|
11395
11645
|
}
|
|
11396
11646
|
async cleanup() {
|
|
11397
11647
|
this.stopAudioLevelMonitoring();
|
|
11398
|
-
if (
|
|
11399
|
-
|
|
11648
|
+
if (__classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f")?.state === "recording") {
|
|
11649
|
+
__classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f").stop();
|
|
11400
11650
|
}
|
|
11401
|
-
if (
|
|
11402
|
-
|
|
11651
|
+
if (__classPrivateFieldGet6(this, _MediaController_mediaStream, "f")) {
|
|
11652
|
+
__classPrivateFieldGet6(this, _MediaController_mediaStream, "f").getTracks().forEach((track) => {
|
|
11403
11653
|
track.stop();
|
|
11404
11654
|
});
|
|
11405
|
-
|
|
11655
|
+
__classPrivateFieldSet5(this, _MediaController_mediaStream, null, "f");
|
|
11406
11656
|
}
|
|
11407
|
-
if (
|
|
11408
|
-
await
|
|
11657
|
+
if (__classPrivateFieldGet6(this, _MediaController_audioContext, "f") && __classPrivateFieldGet6(this, _MediaController_audioContext, "f").state !== "closed") {
|
|
11658
|
+
await __classPrivateFieldGet6(this, _MediaController_audioContext, "f").close();
|
|
11409
11659
|
}
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11660
|
+
__classPrivateFieldSet5(this, _MediaController_audioContext, null, "f");
|
|
11661
|
+
__classPrivateFieldSet5(this, _MediaController_analyser, null, "f");
|
|
11662
|
+
__classPrivateFieldSet5(this, _MediaController_mediaRecorder, null, "f");
|
|
11663
|
+
__classPrivateFieldSet5(this, _MediaController_onTrackEnded, void 0, "f");
|
|
11664
|
+
__classPrivateFieldSet5(this, _MediaController_onAudioLevelChange, void 0, "f");
|
|
11415
11665
|
}
|
|
11416
11666
|
/**
|
|
11417
11667
|
* Stops the media recorder and waits for all buffered data to be flushed.
|
|
@@ -11419,21 +11669,21 @@ var MediaController = class {
|
|
|
11419
11669
|
*/
|
|
11420
11670
|
async stopRecording() {
|
|
11421
11671
|
return new Promise((resolve) => {
|
|
11422
|
-
if (!
|
|
11672
|
+
if (!__classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f") || __classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f").state !== "recording") {
|
|
11423
11673
|
resolve();
|
|
11424
11674
|
return;
|
|
11425
11675
|
}
|
|
11426
|
-
|
|
11676
|
+
__classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f").onstop = () => {
|
|
11427
11677
|
resolve();
|
|
11428
11678
|
};
|
|
11429
|
-
|
|
11679
|
+
__classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f").stop();
|
|
11430
11680
|
});
|
|
11431
11681
|
}
|
|
11432
11682
|
get mediaRecorder() {
|
|
11433
|
-
return
|
|
11683
|
+
return __classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f");
|
|
11434
11684
|
}
|
|
11435
11685
|
get audioLevel() {
|
|
11436
|
-
return
|
|
11686
|
+
return __classPrivateFieldGet6(this, _MediaController_audioLevel, "f");
|
|
11437
11687
|
}
|
|
11438
11688
|
};
|
|
11439
11689
|
_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();
|
|
@@ -11760,21 +12010,30 @@ var __decorate4 = function(decorators, target, key, desc) {
|
|
|
11760
12010
|
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;
|
|
11761
12011
|
return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
|
|
11762
12012
|
};
|
|
11763
|
-
var
|
|
12013
|
+
var __classPrivateFieldGet7 = function(receiver, state, kind, f5) {
|
|
11764
12014
|
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
11765
12015
|
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");
|
|
11766
12016
|
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
11767
12017
|
};
|
|
12018
|
+
var __classPrivateFieldSet6 = function(receiver, state, value, kind, f5) {
|
|
12019
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12020
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a setter");
|
|
12021
|
+
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");
|
|
12022
|
+
return kind === "a" ? f5.call(receiver, value) : f5 ? f5.value = value : state.set(receiver, value), value;
|
|
12023
|
+
};
|
|
11768
12024
|
var _DictationRecordingButton_instances;
|
|
11769
12025
|
var _DictationRecordingButton_mediaController;
|
|
11770
12026
|
var _DictationRecordingButton_dictationController;
|
|
11771
|
-
var
|
|
12027
|
+
var _DictationRecordingButton_keybindingController;
|
|
12028
|
+
var _DictationRecordingButton_closeConnectionOnInit;
|
|
12029
|
+
var _DictationRecordingButton_handlePointerDown;
|
|
12030
|
+
var _DictationRecordingButton_handlePointerUp;
|
|
12031
|
+
var _DictationRecordingButton_handlePointerLeave;
|
|
11772
12032
|
var _DictationRecordingButton_handleWebSocketMessage;
|
|
11773
12033
|
var _DictationRecordingButton_handleWebSocketError;
|
|
11774
12034
|
var _DictationRecordingButton_handleWebSocketClose;
|
|
11775
12035
|
var _DictationRecordingButton_handleStart;
|
|
11776
12036
|
var _DictationRecordingButton_handleStop;
|
|
11777
|
-
var _DictationRecordingButton_handleClick;
|
|
11778
12037
|
var DictationRecordingButton = class DictationRecordingButton2 extends i4 {
|
|
11779
12038
|
constructor() {
|
|
11780
12039
|
super(...arguments);
|
|
@@ -11783,22 +12042,24 @@ var DictationRecordingButton = class DictationRecordingButton2 extends i4 {
|
|
|
11783
12042
|
this.allowButtonFocus = false;
|
|
11784
12043
|
_DictationRecordingButton_mediaController.set(this, new MediaController(this));
|
|
11785
12044
|
_DictationRecordingButton_dictationController.set(this, new DictationController(this));
|
|
12045
|
+
_DictationRecordingButton_keybindingController.set(this, new KeybindingController(this));
|
|
12046
|
+
_DictationRecordingButton_closeConnectionOnInit.set(this, false);
|
|
11786
12047
|
_DictationRecordingButton_handleWebSocketMessage.set(this, (message) => {
|
|
11787
12048
|
switch (message.type) {
|
|
11788
12049
|
case "CONFIG_ACCEPTED":
|
|
11789
|
-
|
|
11790
|
-
|
|
12050
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").mediaRecorder?.start(AUDIO_CHUNK_INTERVAL_MS);
|
|
12051
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").startAudioLevelMonitoring((level) => {
|
|
11791
12052
|
this.dispatchEvent(audioLevelChangedEvent(level));
|
|
11792
12053
|
});
|
|
11793
12054
|
this.dispatchEvent(recordingStateChangedEvent("recording"));
|
|
11794
12055
|
break;
|
|
11795
12056
|
case "CONFIG_DENIED":
|
|
11796
12057
|
this.dispatchEvent(errorEvent(`Config denied: ${message.reason ?? "Unknown reason"}`));
|
|
11797
|
-
|
|
12058
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
11798
12059
|
break;
|
|
11799
12060
|
case "CONFIG_TIMEOUT":
|
|
11800
12061
|
this.dispatchEvent(errorEvent("Config timeout"));
|
|
11801
|
-
|
|
12062
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
11802
12063
|
break;
|
|
11803
12064
|
case "transcript":
|
|
11804
12065
|
this.dispatchEvent(transcriptEvent(message));
|
|
@@ -11811,40 +12072,57 @@ var DictationRecordingButton = class DictationRecordingButton2 extends i4 {
|
|
|
11811
12072
|
break;
|
|
11812
12073
|
case "error":
|
|
11813
12074
|
this.dispatchEvent(errorEvent(message.error));
|
|
11814
|
-
|
|
12075
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
11815
12076
|
break;
|
|
11816
12077
|
}
|
|
11817
12078
|
});
|
|
11818
12079
|
_DictationRecordingButton_handleWebSocketError.set(this, (error) => {
|
|
11819
12080
|
this.dispatchEvent(errorEvent("Socket error: " + error.message));
|
|
11820
|
-
|
|
12081
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
11821
12082
|
});
|
|
11822
12083
|
_DictationRecordingButton_handleWebSocketClose.set(this, (event) => {
|
|
11823
12084
|
this.dispatchEvent(streamClosedEvent(event));
|
|
11824
12085
|
});
|
|
11825
12086
|
}
|
|
12087
|
+
update(changedProperties) {
|
|
12088
|
+
if (changedProperties.has("_recordingState") && this._recordingState === "recording" && __classPrivateFieldGet7(this, _DictationRecordingButton_closeConnectionOnInit, "f")) {
|
|
12089
|
+
__classPrivateFieldSet6(this, _DictationRecordingButton_closeConnectionOnInit, false, "f");
|
|
12090
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
12091
|
+
}
|
|
12092
|
+
super.update(changedProperties);
|
|
12093
|
+
}
|
|
11826
12094
|
startRecording() {
|
|
11827
12095
|
if (this._recordingState !== "stopped") {
|
|
11828
12096
|
return;
|
|
11829
12097
|
}
|
|
11830
|
-
|
|
12098
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStart).call(this);
|
|
11831
12099
|
}
|
|
11832
12100
|
stopRecording() {
|
|
11833
|
-
if (this._recordingState
|
|
12101
|
+
if (this._recordingState === "stopped" || this._recordingState === "stopping") {
|
|
12102
|
+
return;
|
|
12103
|
+
}
|
|
12104
|
+
if (this._recordingState === "initializing") {
|
|
12105
|
+
__classPrivateFieldSet6(this, _DictationRecordingButton_closeConnectionOnInit, true, "f");
|
|
11834
12106
|
return;
|
|
11835
12107
|
}
|
|
11836
|
-
|
|
12108
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
11837
12109
|
}
|
|
11838
12110
|
toggleRecording() {
|
|
11839
|
-
|
|
12111
|
+
if (this._recordingState === "stopped") {
|
|
12112
|
+
this.startRecording();
|
|
12113
|
+
} else if (this._recordingState === "recording") {
|
|
12114
|
+
this.stopRecording();
|
|
12115
|
+
}
|
|
11840
12116
|
}
|
|
11841
12117
|
render() {
|
|
11842
12118
|
const isLoading = this._recordingState === "initializing" || this._recordingState === "stopping";
|
|
11843
12119
|
const isRecording = this._recordingState === "recording";
|
|
11844
12120
|
return x`
|
|
11845
12121
|
<button
|
|
11846
|
-
@
|
|
11847
|
-
@
|
|
12122
|
+
@pointerdown=${__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handlePointerDown)}
|
|
12123
|
+
@pointerup=${__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handlePointerUp)}
|
|
12124
|
+
@pointerleave=${__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handlePointerLeave)}
|
|
12125
|
+
@pointercancel=${__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handlePointerLeave)}
|
|
11848
12126
|
?disabled=${isLoading}
|
|
11849
12127
|
class=${isRecording ? "red" : "accent"}
|
|
11850
12128
|
aria-label=${isRecording ? "Stop recording" : "Start recording"}
|
|
@@ -11852,7 +12130,7 @@ var DictationRecordingButton = class DictationRecordingButton2 extends i4 {
|
|
|
11852
12130
|
>
|
|
11853
12131
|
${isLoading ? x`<icon-loading-spinner />` : isRecording ? x`<icon-recording />` : x`<icon-mic-on />`}
|
|
11854
12132
|
<dictation-audio-visualiser
|
|
11855
|
-
.level=${
|
|
12133
|
+
.level=${__classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").audioLevel}
|
|
11856
12134
|
?active=${isRecording}
|
|
11857
12135
|
/>
|
|
11858
12136
|
</button>
|
|
@@ -11861,56 +12139,84 @@ var DictationRecordingButton = class DictationRecordingButton2 extends i4 {
|
|
|
11861
12139
|
};
|
|
11862
12140
|
_DictationRecordingButton_mediaController = /* @__PURE__ */ new WeakMap();
|
|
11863
12141
|
_DictationRecordingButton_dictationController = /* @__PURE__ */ new WeakMap();
|
|
12142
|
+
_DictationRecordingButton_keybindingController = /* @__PURE__ */ new WeakMap();
|
|
12143
|
+
_DictationRecordingButton_closeConnectionOnInit = /* @__PURE__ */ new WeakMap();
|
|
11864
12144
|
_DictationRecordingButton_handleWebSocketMessage = /* @__PURE__ */ new WeakMap();
|
|
11865
12145
|
_DictationRecordingButton_handleWebSocketError = /* @__PURE__ */ new WeakMap();
|
|
11866
12146
|
_DictationRecordingButton_handleWebSocketClose = /* @__PURE__ */ new WeakMap();
|
|
11867
12147
|
_DictationRecordingButton_instances = /* @__PURE__ */ new WeakSet();
|
|
11868
|
-
|
|
12148
|
+
_DictationRecordingButton_handlePointerDown = function _DictationRecordingButton_handlePointerDown2(event) {
|
|
11869
12149
|
if (!this.allowButtonFocus) {
|
|
11870
12150
|
event.preventDefault();
|
|
11871
12151
|
}
|
|
12152
|
+
if (this._mode === "push-to-talk") {
|
|
12153
|
+
this.startRecording();
|
|
12154
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
12155
|
+
}
|
|
12156
|
+
};
|
|
12157
|
+
_DictationRecordingButton_handlePointerUp = function _DictationRecordingButton_handlePointerUp2(event) {
|
|
12158
|
+
if (this._mode === "push-to-talk") {
|
|
12159
|
+
this.stopRecording();
|
|
12160
|
+
const button = event.currentTarget;
|
|
12161
|
+
if (button.hasPointerCapture(event.pointerId)) {
|
|
12162
|
+
button.releasePointerCapture(event.pointerId);
|
|
12163
|
+
}
|
|
12164
|
+
return;
|
|
12165
|
+
}
|
|
12166
|
+
if (this._mode === "toggle-to-talk") {
|
|
12167
|
+
this.toggleRecording();
|
|
12168
|
+
}
|
|
12169
|
+
};
|
|
12170
|
+
_DictationRecordingButton_handlePointerLeave = function _DictationRecordingButton_handlePointerLeave2(event) {
|
|
12171
|
+
if (this._mode === "push-to-talk") {
|
|
12172
|
+
this.stopRecording();
|
|
12173
|
+
const button = event.currentTarget;
|
|
12174
|
+
if (button.hasPointerCapture(event.pointerId)) {
|
|
12175
|
+
button.releasePointerCapture(event.pointerId);
|
|
12176
|
+
}
|
|
12177
|
+
}
|
|
11872
12178
|
};
|
|
11873
12179
|
_DictationRecordingButton_handleStart = async function _DictationRecordingButton_handleStart2() {
|
|
11874
12180
|
this.dispatchEvent(recordingStateChangedEvent("initializing"));
|
|
11875
12181
|
try {
|
|
11876
|
-
await
|
|
12182
|
+
await __classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").initialize(() => {
|
|
11877
12183
|
if (this._recordingState === "recording") {
|
|
11878
12184
|
this.dispatchEvent(errorEvent("Recording device access was lost."));
|
|
11879
|
-
|
|
12185
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
11880
12186
|
}
|
|
11881
12187
|
});
|
|
11882
|
-
await
|
|
11883
|
-
onClose:
|
|
11884
|
-
onError:
|
|
11885
|
-
onMessage:
|
|
12188
|
+
const isNewConnection = await __classPrivateFieldGet7(this, _DictationRecordingButton_dictationController, "f").connect(__classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").mediaRecorder, this._dictationConfig, {
|
|
12189
|
+
onClose: __classPrivateFieldGet7(this, _DictationRecordingButton_handleWebSocketClose, "f"),
|
|
12190
|
+
onError: __classPrivateFieldGet7(this, _DictationRecordingButton_handleWebSocketError, "f"),
|
|
12191
|
+
onMessage: __classPrivateFieldGet7(this, _DictationRecordingButton_handleWebSocketMessage, "f"),
|
|
11886
12192
|
onNetworkActivity: (direction, data) => {
|
|
11887
12193
|
this.dispatchEvent(networkActivityEvent(direction, data));
|
|
11888
12194
|
}
|
|
11889
12195
|
});
|
|
12196
|
+
if (!isNewConnection) {
|
|
12197
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").mediaRecorder?.start(AUDIO_CHUNK_INTERVAL_MS);
|
|
12198
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").startAudioLevelMonitoring((level) => {
|
|
12199
|
+
this.dispatchEvent(audioLevelChangedEvent(level));
|
|
12200
|
+
});
|
|
12201
|
+
this.dispatchEvent(recordingStateChangedEvent("recording"));
|
|
12202
|
+
}
|
|
11890
12203
|
} catch (error) {
|
|
11891
12204
|
this.dispatchEvent(errorEvent(error));
|
|
11892
|
-
await
|
|
12205
|
+
await __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
11893
12206
|
}
|
|
11894
12207
|
};
|
|
11895
12208
|
_DictationRecordingButton_handleStop = async function _DictationRecordingButton_handleStop2() {
|
|
11896
12209
|
this.dispatchEvent(recordingStateChangedEvent("stopping"));
|
|
11897
12210
|
try {
|
|
11898
|
-
|
|
11899
|
-
await
|
|
11900
|
-
await
|
|
11901
|
-
await
|
|
12211
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").stopAudioLevelMonitoring();
|
|
12212
|
+
await __classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").stopRecording();
|
|
12213
|
+
await __classPrivateFieldGet7(this, _DictationRecordingButton_dictationController, "f").disconnect(__classPrivateFieldGet7(this, _DictationRecordingButton_handleWebSocketClose, "f"));
|
|
12214
|
+
await __classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").cleanup();
|
|
11902
12215
|
} catch (error) {
|
|
11903
12216
|
this.dispatchEvent(errorEvent(error));
|
|
11904
12217
|
}
|
|
11905
12218
|
this.dispatchEvent(recordingStateChangedEvent("stopped"));
|
|
11906
12219
|
};
|
|
11907
|
-
_DictationRecordingButton_handleClick = function _DictationRecordingButton_handleClick2() {
|
|
11908
|
-
if (this._recordingState === "stopped") {
|
|
11909
|
-
__classPrivateFieldGet6(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStart).call(this);
|
|
11910
|
-
} else if (this._recordingState === "recording") {
|
|
11911
|
-
__classPrivateFieldGet6(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
11912
|
-
}
|
|
11913
|
-
};
|
|
11914
12220
|
DictationRecordingButton.styles = [recording_button_default, buttons_default];
|
|
11915
12221
|
__decorate4([
|
|
11916
12222
|
c5({ context: recordingStateContext, subscribe: true }),
|
|
@@ -11952,6 +12258,14 @@ __decorate4([
|
|
|
11952
12258
|
c5({ context: debugDisplayAudioContext, subscribe: true }),
|
|
11953
12259
|
r5()
|
|
11954
12260
|
], DictationRecordingButton.prototype, "_debug_displayAudio", void 0);
|
|
12261
|
+
__decorate4([
|
|
12262
|
+
c5({ context: keybindingContext, subscribe: true }),
|
|
12263
|
+
r5()
|
|
12264
|
+
], DictationRecordingButton.prototype, "_keybinding", void 0);
|
|
12265
|
+
__decorate4([
|
|
12266
|
+
c5({ context: modeContext, subscribe: true }),
|
|
12267
|
+
r5()
|
|
12268
|
+
], DictationRecordingButton.prototype, "_mode", void 0);
|
|
11955
12269
|
__decorate4([
|
|
11956
12270
|
n4({ type: Boolean })
|
|
11957
12271
|
], DictationRecordingButton.prototype, "allowButtonFocus", void 0);
|
|
@@ -12011,21 +12325,23 @@ var SettingsMenuStyles = i`
|
|
|
12011
12325
|
.settings-wrapper {
|
|
12012
12326
|
display: flex;
|
|
12013
12327
|
flex-direction: column;
|
|
12014
|
-
gap:
|
|
12328
|
+
gap: 16px;
|
|
12329
|
+
}
|
|
12330
|
+
.settings-group {
|
|
12331
|
+
background: var(--muted-background, light-dark(#fafafa, #2a2a2a));
|
|
12332
|
+
padding: 12px;
|
|
12333
|
+
border-radius: 10px;
|
|
12334
|
+
display: flex;
|
|
12335
|
+
flex-direction: column;
|
|
12336
|
+
gap: 16px;
|
|
12015
12337
|
}
|
|
12016
12338
|
`;
|
|
12017
12339
|
var settings_menu_default = SettingsMenuStyles;
|
|
12018
12340
|
|
|
12019
12341
|
// dist/styles/select.js
|
|
12020
|
-
var SelectStyles =
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
font-size: 0.8rem;
|
|
12024
|
-
padding-bottom: 0.5rem;
|
|
12025
|
-
font-weight: 500;
|
|
12026
|
-
color: var(--component-text-color, light-dark(#333, #eee));
|
|
12027
|
-
pointer-events: none;
|
|
12028
|
-
}
|
|
12342
|
+
var SelectStyles = [
|
|
12343
|
+
LabelStyles,
|
|
12344
|
+
i`
|
|
12029
12345
|
select {
|
|
12030
12346
|
background: var(--card-background, light-dark(#fff, #333));
|
|
12031
12347
|
color: var(--component-text-color, light-dark(#333, #eee));
|
|
@@ -12049,7 +12365,8 @@ var SelectStyles = i`
|
|
|
12049
12365
|
outline: 2px solid var(--action-accent-background, light-dark(#007bff, #0056b3));
|
|
12050
12366
|
/* outline-offset: 2px; */
|
|
12051
12367
|
}
|
|
12052
|
-
|
|
12368
|
+
`
|
|
12369
|
+
];
|
|
12053
12370
|
var select_default = SelectStyles;
|
|
12054
12371
|
|
|
12055
12372
|
// dist/components/device-selector.js
|
|
@@ -12059,7 +12376,7 @@ var __decorate5 = function(decorators, target, key, desc) {
|
|
|
12059
12376
|
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;
|
|
12060
12377
|
return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
|
|
12061
12378
|
};
|
|
12062
|
-
var
|
|
12379
|
+
var __classPrivateFieldGet8 = function(receiver, state, kind, f5) {
|
|
12063
12380
|
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
12064
12381
|
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");
|
|
12065
12382
|
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
@@ -12081,7 +12398,7 @@ var DictationDeviceSelector = class DictationDeviceSelector2 extends i4 {
|
|
|
12081
12398
|
<select
|
|
12082
12399
|
id="device-select"
|
|
12083
12400
|
aria-labelledby="device-select-label"
|
|
12084
|
-
@change=${
|
|
12401
|
+
@change=${__classPrivateFieldGet8(this, _DictationDeviceSelector_instances, "m", _DictationDeviceSelector_handleSelectDevice)}
|
|
12085
12402
|
?disabled=${this.disabled || !this._devices || this._devices.length === 0}
|
|
12086
12403
|
>
|
|
12087
12404
|
${this._devices?.map((device) => x`
|
|
@@ -12122,14 +12439,163 @@ DictationDeviceSelector = __decorate5([
|
|
|
12122
12439
|
t3("dictation-device-selector")
|
|
12123
12440
|
], DictationDeviceSelector);
|
|
12124
12441
|
|
|
12125
|
-
// dist/
|
|
12442
|
+
// dist/styles/keybinding-selector.js
|
|
12443
|
+
var KeybindingSelectorStyles = [
|
|
12444
|
+
LabelStyles,
|
|
12445
|
+
i`
|
|
12446
|
+
:host {
|
|
12447
|
+
display: block;
|
|
12448
|
+
}
|
|
12449
|
+
.keybinding-selector-wrapper {
|
|
12450
|
+
display: flex;
|
|
12451
|
+
align-items: center;
|
|
12452
|
+
gap: 12px;
|
|
12453
|
+
padding: var(--card-padding, 4px) 8px;
|
|
12454
|
+
background: var(--card-background, light-dark(#fff, #333));
|
|
12455
|
+
border: 1px solid var(--card-border-color, light-dark(#ddd, #555));
|
|
12456
|
+
border-radius: var(--card-inner-border-radius, 6px);
|
|
12457
|
+
overflow: hidden;
|
|
12458
|
+
}
|
|
12459
|
+
.keybinding-selector-wrapper:focus-within {
|
|
12460
|
+
border-color: var(--action-accent-background, light-dark(#007bff, #0056b3));
|
|
12461
|
+
outline: 2px solid var(--action-accent-background, light-dark(#007bff, #0056b3));
|
|
12462
|
+
}
|
|
12463
|
+
.keybinding-selector-input {
|
|
12464
|
+
flex: 1;
|
|
12465
|
+
min-width: 0;
|
|
12466
|
+
border: none;
|
|
12467
|
+
background: transparent;
|
|
12468
|
+
font-size: 14px;
|
|
12469
|
+
line-height: 24px;
|
|
12470
|
+
color: var(--component-text-color, light-dark(#333, #eee));
|
|
12471
|
+
outline: none;
|
|
12472
|
+
padding: 0;
|
|
12473
|
+
cursor: text;
|
|
12474
|
+
}
|
|
12475
|
+
.keybinding-selector-input::placeholder {
|
|
12476
|
+
opacity: 0.6;
|
|
12477
|
+
color: var(--component-text-color, light-dark(#333, #eee));
|
|
12478
|
+
}
|
|
12479
|
+
.keybinding-selector-input:disabled {
|
|
12480
|
+
cursor: not-allowed;
|
|
12481
|
+
opacity: 0.5;
|
|
12482
|
+
}
|
|
12483
|
+
.keybinding-key {
|
|
12484
|
+
display: flex;
|
|
12485
|
+
align-items: center;
|
|
12486
|
+
justify-content: center;
|
|
12487
|
+
padding: 0 0.5rem;
|
|
12488
|
+
height: 24px;
|
|
12489
|
+
background: var(--card-background, light-dark(#fff, #333));
|
|
12490
|
+
border: 1px solid var(--card-border-color, light-dark(#ddd, #555));
|
|
12491
|
+
border-radius: var(--card-inner-border-radius, 6px);
|
|
12492
|
+
box-shadow: var(--card-box-shadow, 0 2px 5px rgba(0, 0, 0, 0.1));
|
|
12493
|
+
font-size: 16px;
|
|
12494
|
+
line-height: 28px;
|
|
12495
|
+
color: var(--component-text-color, light-dark(#333, #eee));
|
|
12496
|
+
opacity: 0.6;
|
|
12497
|
+
text-align: center;
|
|
12498
|
+
flex-shrink: 0;
|
|
12499
|
+
}
|
|
12500
|
+
.keybinding-help {
|
|
12501
|
+
font-size: 12px;
|
|
12502
|
+
line-height: 20px;
|
|
12503
|
+
color: var(--component-text-color, light-dark(#333, #eee));
|
|
12504
|
+
opacity: 0.6;
|
|
12505
|
+
margin: 0;
|
|
12506
|
+
letter-spacing: 0.01px;
|
|
12507
|
+
padding-top: 8px;
|
|
12508
|
+
}
|
|
12509
|
+
`
|
|
12510
|
+
];
|
|
12511
|
+
var keybinding_selector_default = KeybindingSelectorStyles;
|
|
12512
|
+
|
|
12513
|
+
// dist/components/keybinding-selector.js
|
|
12126
12514
|
var __decorate6 = function(decorators, target, key, desc) {
|
|
12127
12515
|
var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
|
|
12128
12516
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
|
|
12129
12517
|
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;
|
|
12130
12518
|
return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
|
|
12131
12519
|
};
|
|
12132
|
-
var
|
|
12520
|
+
var __classPrivateFieldGet9 = function(receiver, state, kind, f5) {
|
|
12521
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
12522
|
+
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");
|
|
12523
|
+
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
12524
|
+
};
|
|
12525
|
+
var _DictationKeybindingSelector_instances;
|
|
12526
|
+
var _DictationKeybindingSelector_handleKeybindingInputFocus;
|
|
12527
|
+
var _DictationKeybindingSelector_handleKeybindingInputBlur;
|
|
12528
|
+
var _DictationKeybindingSelector_handleKeybindingKeyDown;
|
|
12529
|
+
var DictationKeybindingSelector = class DictationKeybindingSelector2 extends i4 {
|
|
12530
|
+
constructor() {
|
|
12531
|
+
super(...arguments);
|
|
12532
|
+
_DictationKeybindingSelector_instances.add(this);
|
|
12533
|
+
this.disabled = false;
|
|
12534
|
+
this._isCapturingKeybinding = false;
|
|
12535
|
+
}
|
|
12536
|
+
render() {
|
|
12537
|
+
return x`
|
|
12538
|
+
<div>
|
|
12539
|
+
<label>Keybinding</label>
|
|
12540
|
+
<div class="keybinding-selector-wrapper">
|
|
12541
|
+
${this._keybinding && x`<div class="keybinding-key">${this._keybinding}</div>`}
|
|
12542
|
+
<input
|
|
12543
|
+
type="text"
|
|
12544
|
+
class="keybinding-selector-input"
|
|
12545
|
+
.value=""
|
|
12546
|
+
placeholder="Click and press a key..."
|
|
12547
|
+
readonly
|
|
12548
|
+
@focusin=${__classPrivateFieldGet9(this, _DictationKeybindingSelector_instances, "m", _DictationKeybindingSelector_handleKeybindingInputFocus)}
|
|
12549
|
+
@focusout=${__classPrivateFieldGet9(this, _DictationKeybindingSelector_instances, "m", _DictationKeybindingSelector_handleKeybindingInputBlur)}
|
|
12550
|
+
@keydown=${__classPrivateFieldGet9(this, _DictationKeybindingSelector_instances, "m", _DictationKeybindingSelector_handleKeybindingKeyDown)}
|
|
12551
|
+
?disabled=${this.disabled}
|
|
12552
|
+
/>
|
|
12553
|
+
</div>
|
|
12554
|
+
${this._keybinding && x`<p class="keybinding-help">
|
|
12555
|
+
Press ${this._keybinding} to start/stop recording
|
|
12556
|
+
</p>`}
|
|
12557
|
+
</div>
|
|
12558
|
+
`;
|
|
12559
|
+
}
|
|
12560
|
+
};
|
|
12561
|
+
_DictationKeybindingSelector_instances = /* @__PURE__ */ new WeakSet();
|
|
12562
|
+
_DictationKeybindingSelector_handleKeybindingInputFocus = function _DictationKeybindingSelector_handleKeybindingInputFocus2() {
|
|
12563
|
+
this._isCapturingKeybinding = true;
|
|
12564
|
+
};
|
|
12565
|
+
_DictationKeybindingSelector_handleKeybindingInputBlur = function _DictationKeybindingSelector_handleKeybindingInputBlur2() {
|
|
12566
|
+
this._isCapturingKeybinding = false;
|
|
12567
|
+
};
|
|
12568
|
+
_DictationKeybindingSelector_handleKeybindingKeyDown = function _DictationKeybindingSelector_handleKeybindingKeyDown2(event) {
|
|
12569
|
+
if (!this._isCapturingKeybinding) {
|
|
12570
|
+
return;
|
|
12571
|
+
}
|
|
12572
|
+
event.preventDefault();
|
|
12573
|
+
event.stopPropagation();
|
|
12574
|
+
this.dispatchEvent(keybindingChangedEvent(event.key, event.code));
|
|
12575
|
+
};
|
|
12576
|
+
DictationKeybindingSelector.styles = keybinding_selector_default;
|
|
12577
|
+
__decorate6([
|
|
12578
|
+
c5({ context: keybindingContext, subscribe: true }),
|
|
12579
|
+
r5()
|
|
12580
|
+
], DictationKeybindingSelector.prototype, "_keybinding", void 0);
|
|
12581
|
+
__decorate6([
|
|
12582
|
+
n4({ type: Boolean })
|
|
12583
|
+
], DictationKeybindingSelector.prototype, "disabled", void 0);
|
|
12584
|
+
__decorate6([
|
|
12585
|
+
r5()
|
|
12586
|
+
], DictationKeybindingSelector.prototype, "_isCapturingKeybinding", void 0);
|
|
12587
|
+
DictationKeybindingSelector = __decorate6([
|
|
12588
|
+
t3("dictation-keybinding-selector")
|
|
12589
|
+
], DictationKeybindingSelector);
|
|
12590
|
+
|
|
12591
|
+
// dist/components/language-selector.js
|
|
12592
|
+
var __decorate7 = function(decorators, target, key, desc) {
|
|
12593
|
+
var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
|
|
12594
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
|
|
12595
|
+
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;
|
|
12596
|
+
return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
|
|
12597
|
+
};
|
|
12598
|
+
var __classPrivateFieldGet10 = function(receiver, state, kind, f5) {
|
|
12133
12599
|
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
12134
12600
|
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");
|
|
12135
12601
|
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
@@ -12151,7 +12617,7 @@ var DictationLanguageSelector = class DictationLanguageSelector2 extends i4 {
|
|
|
12151
12617
|
<select
|
|
12152
12618
|
id="language-select"
|
|
12153
12619
|
aria-labelledby="language-select-label"
|
|
12154
|
-
@change=${
|
|
12620
|
+
@change=${__classPrivateFieldGet10(this, _DictationLanguageSelector_instances, "m", _DictationLanguageSelector_handleSelectLanguage)}
|
|
12155
12621
|
?disabled=${this.disabled || !this._languages || this._languages.length === 0}
|
|
12156
12622
|
>
|
|
12157
12623
|
${this._languages?.map((language) => x`
|
|
@@ -12174,23 +12640,145 @@ _DictationLanguageSelector_handleSelectLanguage = function _DictationLanguageSel
|
|
|
12174
12640
|
this.dispatchEvent(languageChangedEvent(language));
|
|
12175
12641
|
};
|
|
12176
12642
|
DictationLanguageSelector.styles = select_default;
|
|
12177
|
-
|
|
12643
|
+
__decorate7([
|
|
12178
12644
|
c5({ context: languagesContext, subscribe: true }),
|
|
12179
12645
|
r5()
|
|
12180
12646
|
], DictationLanguageSelector.prototype, "_languages", void 0);
|
|
12181
|
-
|
|
12647
|
+
__decorate7([
|
|
12182
12648
|
c5({ context: dictationConfigContext, subscribe: true }),
|
|
12183
12649
|
r5()
|
|
12184
12650
|
], DictationLanguageSelector.prototype, "_dictationConfig", void 0);
|
|
12185
|
-
|
|
12651
|
+
__decorate7([
|
|
12186
12652
|
n4({ type: Boolean })
|
|
12187
12653
|
], DictationLanguageSelector.prototype, "disabled", void 0);
|
|
12188
|
-
DictationLanguageSelector =
|
|
12654
|
+
DictationLanguageSelector = __decorate7([
|
|
12189
12655
|
t3("dictation-language-selector")
|
|
12190
12656
|
], DictationLanguageSelector);
|
|
12191
12657
|
|
|
12658
|
+
// dist/styles/mode-selector.js
|
|
12659
|
+
var ModeSelectorStyles = [
|
|
12660
|
+
LabelStyles,
|
|
12661
|
+
i`
|
|
12662
|
+
:host {
|
|
12663
|
+
display: block;
|
|
12664
|
+
}
|
|
12665
|
+
.mode-selector-tabs {
|
|
12666
|
+
display: flex;
|
|
12667
|
+
background: var(--muted-background, light-dark(#fafafa, #2a2a2a));
|
|
12668
|
+
border: 1px solid var(--card-border-color, light-dark(#ddd, #555));
|
|
12669
|
+
border-radius: var(--card-inner-border-radius, 6px);
|
|
12670
|
+
padding: 0;
|
|
12671
|
+
overflow: hidden;
|
|
12672
|
+
align-items: center;
|
|
12673
|
+
justify-content: center;
|
|
12674
|
+
text-wrap: nowrap;
|
|
12675
|
+
gap: 2px;
|
|
12676
|
+
}
|
|
12677
|
+
.mode-selector-tab {
|
|
12678
|
+
flex: 1;
|
|
12679
|
+
padding: 4px 8px;
|
|
12680
|
+
border: 1px solid transparent;
|
|
12681
|
+
background: transparent;
|
|
12682
|
+
font-size: 14px;
|
|
12683
|
+
font-weight: 500;
|
|
12684
|
+
line-height: 24px;
|
|
12685
|
+
color: var(--component-text-color, light-dark(#333, #eee));
|
|
12686
|
+
opacity: 0.6;
|
|
12687
|
+
cursor: pointer;
|
|
12688
|
+
transition: all 0.2s;
|
|
12689
|
+
height: 32px;
|
|
12690
|
+
display: flex;
|
|
12691
|
+
align-items: center;
|
|
12692
|
+
justify-content: center;
|
|
12693
|
+
border-radius: var(--card-inner-border-radius, 6px);
|
|
12694
|
+
margin: -1px;
|
|
12695
|
+
}
|
|
12696
|
+
.mode-selector-tab:hover:not(:disabled) {
|
|
12697
|
+
opacity: 1;
|
|
12698
|
+
}
|
|
12699
|
+
.mode-selector-tab.active {
|
|
12700
|
+
background: var(--card-background, light-dark(#fff, #333));
|
|
12701
|
+
border-color: var(--card-border-color, light-dark(#ddd, #555));
|
|
12702
|
+
box-shadow: var(--card-box-shadow, 0 2px 5px rgba(0, 0, 0, 0.1));
|
|
12703
|
+
opacity: 1;
|
|
12704
|
+
}
|
|
12705
|
+
.mode-selector-tab:disabled {
|
|
12706
|
+
opacity: 0.5;
|
|
12707
|
+
cursor: not-allowed;
|
|
12708
|
+
}
|
|
12709
|
+
`
|
|
12710
|
+
];
|
|
12711
|
+
var mode_selector_default = ModeSelectorStyles;
|
|
12712
|
+
|
|
12713
|
+
// dist/components/mode-selector.js
|
|
12714
|
+
var __decorate8 = function(decorators, target, key, desc) {
|
|
12715
|
+
var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
|
|
12716
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
|
|
12717
|
+
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;
|
|
12718
|
+
return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
|
|
12719
|
+
};
|
|
12720
|
+
var __classPrivateFieldGet11 = function(receiver, state, kind, f5) {
|
|
12721
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
12722
|
+
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");
|
|
12723
|
+
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
12724
|
+
};
|
|
12725
|
+
var _DictationModeSelector_instances;
|
|
12726
|
+
var _DictationModeSelector_handleModeChange;
|
|
12727
|
+
var DictationModeSelector = class DictationModeSelector2 extends i4 {
|
|
12728
|
+
constructor() {
|
|
12729
|
+
super(...arguments);
|
|
12730
|
+
_DictationModeSelector_instances.add(this);
|
|
12731
|
+
this._mode = "toggle-to-talk";
|
|
12732
|
+
this.disabled = false;
|
|
12733
|
+
}
|
|
12734
|
+
render() {
|
|
12735
|
+
return x`
|
|
12736
|
+
<div>
|
|
12737
|
+
<label>Dictation Mode</label>
|
|
12738
|
+
<div class="mode-selector-tabs">
|
|
12739
|
+
<button
|
|
12740
|
+
class=${e6({
|
|
12741
|
+
active: this._mode === "toggle-to-talk",
|
|
12742
|
+
"mode-selector-tab": true
|
|
12743
|
+
})}
|
|
12744
|
+
@click=${() => __classPrivateFieldGet11(this, _DictationModeSelector_instances, "m", _DictationModeSelector_handleModeChange).call(this, "toggle-to-talk")}
|
|
12745
|
+
?disabled=${this.disabled}
|
|
12746
|
+
>
|
|
12747
|
+
Toggle-to-Talk
|
|
12748
|
+
</button>
|
|
12749
|
+
<button
|
|
12750
|
+
class=${e6({
|
|
12751
|
+
active: this._mode === "push-to-talk",
|
|
12752
|
+
"mode-selector-tab": true
|
|
12753
|
+
})}
|
|
12754
|
+
@click=${() => __classPrivateFieldGet11(this, _DictationModeSelector_instances, "m", _DictationModeSelector_handleModeChange).call(this, "push-to-talk")}
|
|
12755
|
+
?disabled=${this.disabled}
|
|
12756
|
+
>
|
|
12757
|
+
Push-to-Talk
|
|
12758
|
+
</button>
|
|
12759
|
+
</div>
|
|
12760
|
+
</div>
|
|
12761
|
+
`;
|
|
12762
|
+
}
|
|
12763
|
+
};
|
|
12764
|
+
_DictationModeSelector_instances = /* @__PURE__ */ new WeakSet();
|
|
12765
|
+
_DictationModeSelector_handleModeChange = function _DictationModeSelector_handleModeChange2(mode) {
|
|
12766
|
+
this.dispatchEvent(modeChangedEvent(mode));
|
|
12767
|
+
};
|
|
12768
|
+
DictationModeSelector.styles = mode_selector_default;
|
|
12769
|
+
__decorate8([
|
|
12770
|
+
c5({ context: modeContext, subscribe: true }),
|
|
12771
|
+
r5()
|
|
12772
|
+
], DictationModeSelector.prototype, "_mode", void 0);
|
|
12773
|
+
__decorate8([
|
|
12774
|
+
n4({ type: Boolean })
|
|
12775
|
+
], DictationModeSelector.prototype, "disabled", void 0);
|
|
12776
|
+
DictationModeSelector = __decorate8([
|
|
12777
|
+
t3("dictation-mode-selector")
|
|
12778
|
+
], DictationModeSelector);
|
|
12779
|
+
|
|
12192
12780
|
// dist/components/settings-menu.js
|
|
12193
|
-
var
|
|
12781
|
+
var __decorate9 = function(decorators, target, key, desc) {
|
|
12194
12782
|
var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
|
|
12195
12783
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
|
|
12196
12784
|
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;
|
|
@@ -12209,6 +12797,8 @@ var DictationSettingsMenu = class DictationSettingsMenu2 extends i4 {
|
|
|
12209
12797
|
const isRecording = this._recordingState === "recording";
|
|
12210
12798
|
const showDeviceSelector = this.settingsEnabled.includes("device");
|
|
12211
12799
|
const showLanguageSelector = this.settingsEnabled.includes("language");
|
|
12800
|
+
const showModeSelector = this.settingsEnabled.includes("mode");
|
|
12801
|
+
const showKeybinding = this.settingsEnabled.includes("keybinding");
|
|
12212
12802
|
return x`
|
|
12213
12803
|
<div class="mic-selector">
|
|
12214
12804
|
<button id="settings-popover-button" popovertarget="settings-popover">
|
|
@@ -12227,6 +12817,16 @@ var DictationSettingsMenu = class DictationSettingsMenu2 extends i4 {
|
|
|
12227
12817
|
${showLanguageSelector ? x`<dictation-language-selector
|
|
12228
12818
|
?disabled=${isRecording}
|
|
12229
12819
|
/>` : E}
|
|
12820
|
+
${showModeSelector || showKeybinding ? x`
|
|
12821
|
+
<div class="settings-group">
|
|
12822
|
+
${showModeSelector ? x`<dictation-mode-selector
|
|
12823
|
+
?disabled=${isRecording}
|
|
12824
|
+
/>` : E}
|
|
12825
|
+
${showKeybinding ? x`<dictation-keybinding-selector
|
|
12826
|
+
?disabled=${isRecording}
|
|
12827
|
+
/>` : E}
|
|
12828
|
+
</div>
|
|
12829
|
+
` : E}
|
|
12230
12830
|
</div>
|
|
12231
12831
|
</div>
|
|
12232
12832
|
</div>
|
|
@@ -12238,28 +12838,28 @@ DictationSettingsMenu.styles = [
|
|
|
12238
12838
|
buttons_default,
|
|
12239
12839
|
callout_default
|
|
12240
12840
|
];
|
|
12241
|
-
|
|
12841
|
+
__decorate9([
|
|
12242
12842
|
c5({ context: recordingStateContext, subscribe: true }),
|
|
12243
12843
|
r5()
|
|
12244
12844
|
], DictationSettingsMenu.prototype, "_recordingState", void 0);
|
|
12245
|
-
|
|
12845
|
+
__decorate9([
|
|
12246
12846
|
n4({
|
|
12247
12847
|
converter: commaSeparatedConverter,
|
|
12248
12848
|
type: Array
|
|
12249
12849
|
})
|
|
12250
12850
|
], DictationSettingsMenu.prototype, "settingsEnabled", void 0);
|
|
12251
|
-
DictationSettingsMenu =
|
|
12851
|
+
DictationSettingsMenu = __decorate9([
|
|
12252
12852
|
t3("dictation-settings-menu")
|
|
12253
12853
|
], DictationSettingsMenu);
|
|
12254
12854
|
|
|
12255
12855
|
// dist/components/corti-dictation.js
|
|
12256
|
-
var
|
|
12856
|
+
var __decorate10 = function(decorators, target, key, desc) {
|
|
12257
12857
|
var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
|
|
12258
12858
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
|
|
12259
12859
|
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;
|
|
12260
12860
|
return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
|
|
12261
12861
|
};
|
|
12262
|
-
var
|
|
12862
|
+
var __classPrivateFieldGet12 = function(receiver, state, kind, f5) {
|
|
12263
12863
|
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
12264
12864
|
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");
|
|
12265
12865
|
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
@@ -12275,6 +12875,7 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12275
12875
|
this.allowButtonFocus = false;
|
|
12276
12876
|
this.debug_displayAudio = false;
|
|
12277
12877
|
this._dictationConfig = DEFAULT_DICTATION_CONFIG;
|
|
12878
|
+
this._mode = "toggle-to-talk";
|
|
12278
12879
|
}
|
|
12279
12880
|
/**
|
|
12280
12881
|
* List of all language codes available for use with the Web Component.
|
|
@@ -12284,7 +12885,7 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12284
12885
|
this._languagesSupported = value;
|
|
12285
12886
|
}
|
|
12286
12887
|
get languagesSupported() {
|
|
12287
|
-
return
|
|
12888
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.languages || this._languagesSupported || [];
|
|
12288
12889
|
}
|
|
12289
12890
|
/**
|
|
12290
12891
|
* Configuration settings for dictation
|
|
@@ -12293,7 +12894,7 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12293
12894
|
this._dictationConfig = value;
|
|
12294
12895
|
}
|
|
12295
12896
|
get dictationConfig() {
|
|
12296
|
-
return
|
|
12897
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.dictationConfig || this._dictationConfig;
|
|
12297
12898
|
}
|
|
12298
12899
|
/**
|
|
12299
12900
|
* List of available recording devices
|
|
@@ -12302,7 +12903,7 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12302
12903
|
this._devices = value;
|
|
12303
12904
|
}
|
|
12304
12905
|
get devices() {
|
|
12305
|
-
return
|
|
12906
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.devices || this._devices || [];
|
|
12306
12907
|
}
|
|
12307
12908
|
/**
|
|
12308
12909
|
* The selected device used for recording (MediaDeviceInfo).
|
|
@@ -12311,13 +12912,33 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12311
12912
|
this._selectedDevice = value;
|
|
12312
12913
|
}
|
|
12313
12914
|
get selectedDevice() {
|
|
12314
|
-
return
|
|
12915
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.selectedDevice || this._selectedDevice;
|
|
12315
12916
|
}
|
|
12316
12917
|
/**
|
|
12317
12918
|
* Current state of recording (stopped, recording, initializing and stopping, ).
|
|
12318
12919
|
*/
|
|
12319
12920
|
get recordingState() {
|
|
12320
|
-
return
|
|
12921
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.recordingState || "stopped";
|
|
12922
|
+
}
|
|
12923
|
+
/**
|
|
12924
|
+
* Dictation mode: "toggle-to-talk" or "push-to-talk"
|
|
12925
|
+
*/
|
|
12926
|
+
set mode(value) {
|
|
12927
|
+
this._mode = value;
|
|
12928
|
+
}
|
|
12929
|
+
get mode() {
|
|
12930
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.mode || this._mode || "toggle-to-talk";
|
|
12931
|
+
}
|
|
12932
|
+
/**
|
|
12933
|
+
* Keybinding for keyboard shortcut. Single key only (e.g., "`", "k", "meta", "ctrl").
|
|
12934
|
+
* Combinations with "+" are not supported.
|
|
12935
|
+
* Defaults to "`" if keybinding is in settingsEnabled, otherwise undefined
|
|
12936
|
+
*/
|
|
12937
|
+
set keybinding(value) {
|
|
12938
|
+
this._keybinding = value;
|
|
12939
|
+
}
|
|
12940
|
+
get keybinding() {
|
|
12941
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.keybinding || this._keybinding;
|
|
12321
12942
|
}
|
|
12322
12943
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
12323
12944
|
// Public methods
|
|
@@ -12329,7 +12950,7 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12329
12950
|
*/
|
|
12330
12951
|
setAccessToken(token) {
|
|
12331
12952
|
this.accessToken = token;
|
|
12332
|
-
return
|
|
12953
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.setAccessToken(token) ?? {
|
|
12333
12954
|
accessToken: token,
|
|
12334
12955
|
environment: void 0,
|
|
12335
12956
|
tenant: void 0
|
|
@@ -12342,7 +12963,7 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12342
12963
|
*/
|
|
12343
12964
|
async setAuthConfig(config) {
|
|
12344
12965
|
this.authConfig = config;
|
|
12345
|
-
return
|
|
12966
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.setAuthConfig(config) ?? {
|
|
12346
12967
|
accessToken: void 0,
|
|
12347
12968
|
environment: void 0,
|
|
12348
12969
|
tenant: void 0
|
|
@@ -12352,19 +12973,19 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12352
12973
|
* Starts a recording.
|
|
12353
12974
|
*/
|
|
12354
12975
|
startRecording() {
|
|
12355
|
-
|
|
12976
|
+
__classPrivateFieldGet12(this, _CortiDictation_recordingButtonRef, "f").value?.startRecording();
|
|
12356
12977
|
}
|
|
12357
12978
|
/**
|
|
12358
12979
|
* Stops a recording.
|
|
12359
12980
|
*/
|
|
12360
12981
|
stopRecording() {
|
|
12361
|
-
|
|
12982
|
+
__classPrivateFieldGet12(this, _CortiDictation_recordingButtonRef, "f").value?.stopRecording();
|
|
12362
12983
|
}
|
|
12363
12984
|
/**
|
|
12364
12985
|
* Starts or stops recording. Convenience layer on top of the start/stop methods.
|
|
12365
12986
|
*/
|
|
12366
12987
|
toggleRecording() {
|
|
12367
|
-
|
|
12988
|
+
__classPrivateFieldGet12(this, _CortiDictation_recordingButtonRef, "f").value?.toggleRecording();
|
|
12368
12989
|
}
|
|
12369
12990
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
12370
12991
|
// Render
|
|
@@ -12373,7 +12994,7 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12373
12994
|
const isHidden = !this.accessToken && !this.authConfig && !this.socketUrl && !this.socketProxy;
|
|
12374
12995
|
return x`
|
|
12375
12996
|
<dictation-root
|
|
12376
|
-
${n6(
|
|
12997
|
+
${n6(__classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f"))}
|
|
12377
12998
|
class=${e6({ hidden: isHidden })}
|
|
12378
12999
|
.accessToken=${this.accessToken}
|
|
12379
13000
|
.authConfig=${this.authConfig}
|
|
@@ -12384,9 +13005,11 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12384
13005
|
.devices=${this._devices}
|
|
12385
13006
|
.selectedDevice=${this._selectedDevice}
|
|
12386
13007
|
.debug_displayAudio=${this.debug_displayAudio}
|
|
13008
|
+
.mode=${this._mode}
|
|
13009
|
+
.keybinding=${this._keybinding}
|
|
12387
13010
|
>
|
|
12388
13011
|
<dictation-recording-button
|
|
12389
|
-
${n6(
|
|
13012
|
+
${n6(__classPrivateFieldGet12(this, _CortiDictation_recordingButtonRef, "f"))}
|
|
12390
13013
|
?allowButtonFocus=${this.allowButtonFocus}
|
|
12391
13014
|
></dictation-recording-button>
|
|
12392
13015
|
${this.settingsEnabled?.length > 0 ? x`<dictation-settings-menu
|
|
@@ -12403,58 +13026,70 @@ CortiDictation.styles = i`
|
|
|
12403
13026
|
display: none;
|
|
12404
13027
|
}
|
|
12405
13028
|
`;
|
|
12406
|
-
|
|
13029
|
+
__decorate10([
|
|
12407
13030
|
n4({ type: String })
|
|
12408
13031
|
], CortiDictation.prototype, "accessToken", void 0);
|
|
12409
|
-
|
|
13032
|
+
__decorate10([
|
|
12410
13033
|
n4({ attribute: false, type: Object })
|
|
12411
13034
|
], CortiDictation.prototype, "authConfig", void 0);
|
|
12412
|
-
|
|
13035
|
+
__decorate10([
|
|
12413
13036
|
n4({ type: String })
|
|
12414
13037
|
], CortiDictation.prototype, "socketUrl", void 0);
|
|
12415
|
-
|
|
13038
|
+
__decorate10([
|
|
12416
13039
|
n4({ attribute: false, type: Object })
|
|
12417
13040
|
], CortiDictation.prototype, "socketProxy", void 0);
|
|
12418
|
-
|
|
13041
|
+
__decorate10([
|
|
12419
13042
|
n4({
|
|
12420
13043
|
converter: commaSeparatedConverter,
|
|
12421
13044
|
type: Array
|
|
12422
13045
|
})
|
|
12423
13046
|
], CortiDictation.prototype, "languagesSupported", null);
|
|
12424
|
-
|
|
13047
|
+
__decorate10([
|
|
12425
13048
|
r5()
|
|
12426
13049
|
], CortiDictation.prototype, "_languagesSupported", void 0);
|
|
12427
|
-
|
|
13050
|
+
__decorate10([
|
|
12428
13051
|
n4({
|
|
12429
13052
|
converter: commaSeparatedConverter,
|
|
12430
13053
|
type: Array
|
|
12431
13054
|
})
|
|
12432
13055
|
], CortiDictation.prototype, "settingsEnabled", void 0);
|
|
12433
|
-
|
|
13056
|
+
__decorate10([
|
|
12434
13057
|
n4({ type: Boolean })
|
|
12435
13058
|
], CortiDictation.prototype, "allowButtonFocus", void 0);
|
|
12436
|
-
|
|
13059
|
+
__decorate10([
|
|
12437
13060
|
n4({ attribute: "debug-display-audio", type: Boolean })
|
|
12438
13061
|
], CortiDictation.prototype, "debug_displayAudio", void 0);
|
|
12439
|
-
|
|
13062
|
+
__decorate10([
|
|
12440
13063
|
n4({ attribute: false, type: Object })
|
|
12441
13064
|
], CortiDictation.prototype, "dictationConfig", null);
|
|
12442
|
-
|
|
13065
|
+
__decorate10([
|
|
12443
13066
|
r5()
|
|
12444
13067
|
], CortiDictation.prototype, "_dictationConfig", void 0);
|
|
12445
|
-
|
|
13068
|
+
__decorate10([
|
|
12446
13069
|
n4({ attribute: false, type: Array })
|
|
12447
13070
|
], CortiDictation.prototype, "devices", null);
|
|
12448
|
-
|
|
13071
|
+
__decorate10([
|
|
12449
13072
|
r5()
|
|
12450
13073
|
], CortiDictation.prototype, "_devices", void 0);
|
|
12451
|
-
|
|
13074
|
+
__decorate10([
|
|
12452
13075
|
n4({ attribute: false, type: Object })
|
|
12453
13076
|
], CortiDictation.prototype, "selectedDevice", null);
|
|
12454
|
-
|
|
13077
|
+
__decorate10([
|
|
12455
13078
|
r5()
|
|
12456
13079
|
], CortiDictation.prototype, "_selectedDevice", void 0);
|
|
12457
|
-
|
|
13080
|
+
__decorate10([
|
|
13081
|
+
n4({ type: String })
|
|
13082
|
+
], CortiDictation.prototype, "mode", null);
|
|
13083
|
+
__decorate10([
|
|
13084
|
+
r5()
|
|
13085
|
+
], CortiDictation.prototype, "_mode", void 0);
|
|
13086
|
+
__decorate10([
|
|
13087
|
+
n4({ type: String })
|
|
13088
|
+
], CortiDictation.prototype, "keybinding", null);
|
|
13089
|
+
__decorate10([
|
|
13090
|
+
r5()
|
|
13091
|
+
], CortiDictation.prototype, "_keybinding", void 0);
|
|
13092
|
+
CortiDictation = __decorate10([
|
|
12458
13093
|
t3("corti-dictation")
|
|
12459
13094
|
], CortiDictation);
|
|
12460
13095
|
|
|
@@ -12471,6 +13106,12 @@ if (!customElements.get("dictation-device-selector")) {
|
|
|
12471
13106
|
if (!customElements.get("dictation-language-selector")) {
|
|
12472
13107
|
customElements.define("dictation-language-selector", DictationLanguageSelector);
|
|
12473
13108
|
}
|
|
13109
|
+
if (!customElements.get("dictation-mode-selector")) {
|
|
13110
|
+
customElements.define("dictation-mode-selector", DictationModeSelector);
|
|
13111
|
+
}
|
|
13112
|
+
if (!customElements.get("dictation-keybinding-selector")) {
|
|
13113
|
+
customElements.define("dictation-keybinding-selector", DictationKeybindingSelector);
|
|
13114
|
+
}
|
|
12474
13115
|
if (!customElements.get("dictation-settings-menu")) {
|
|
12475
13116
|
customElements.define("dictation-settings-menu", DictationSettingsMenu);
|
|
12476
13117
|
}
|
|
@@ -12481,7 +13122,9 @@ var index_default = CortiDictation;
|
|
|
12481
13122
|
export {
|
|
12482
13123
|
CortiDictation,
|
|
12483
13124
|
DictationDeviceSelector,
|
|
13125
|
+
DictationKeybindingSelector,
|
|
12484
13126
|
DictationLanguageSelector,
|
|
13127
|
+
DictationModeSelector,
|
|
12485
13128
|
DictationRecordingButton,
|
|
12486
13129
|
DictationRoot,
|
|
12487
13130
|
DictationSettingsMenu,
|