@corti/dictation-web 0.0.0-test.562 → 0.0.0-test.571
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 +164 -112
- package/dist/bundle.js +1416 -546
- package/dist/components/audio-visualiser.d.ts +3 -2
- package/dist/components/audio-visualiser.js +15 -12
- package/dist/components/audio-visualiser.js.map +1 -1
- package/dist/components/corti-dictation.d.ts +26 -13
- package/dist/components/corti-dictation.js +70 -21
- package/dist/components/corti-dictation.js.map +1 -1
- package/dist/components/device-selector.d.ts +6 -16
- package/dist/components/device-selector.js +27 -58
- package/dist/components/device-selector.js.map +1 -1
- package/dist/components/keybinding-selector.d.ts +14 -0
- package/dist/components/keybinding-selector.js +81 -0
- package/dist/components/keybinding-selector.js.map +1 -0
- package/dist/components/language-selector.d.ts +8 -17
- package/dist/components/language-selector.js +26 -52
- package/dist/components/language-selector.js.map +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 +8 -14
- package/dist/components/recording-button.js +155 -96
- package/dist/components/recording-button.js.map +1 -1
- package/dist/components/settings-menu.d.ts +4 -2
- package/dist/components/settings-menu.js +34 -14
- package/dist/components/settings-menu.js.map +1 -1
- package/dist/constants.d.ts +5 -0
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -1
- package/dist/contexts/dictation-context.d.ts +24 -14
- package/dist/contexts/dictation-context.js +128 -46
- package/dist/contexts/dictation-context.js.map +1 -1
- package/dist/controllers/devices-controller.d.ts +26 -0
- package/dist/controllers/devices-controller.js +99 -0
- package/dist/controllers/devices-controller.js.map +1 -0
- package/dist/controllers/dictation-controller.d.ts +29 -0
- package/dist/controllers/dictation-controller.js +179 -0
- package/dist/controllers/dictation-controller.js.map +1 -0
- package/dist/controllers/keybinding-controller.d.ts +17 -0
- package/dist/controllers/keybinding-controller.js +80 -0
- package/dist/controllers/keybinding-controller.js.map +1 -0
- package/dist/controllers/languages-controller.d.ts +26 -0
- package/dist/controllers/languages-controller.js +83 -0
- package/dist/controllers/languages-controller.js.map +1 -0
- package/dist/controllers/media-controller.d.ts +24 -0
- package/dist/controllers/media-controller.js +115 -0
- package/dist/controllers/media-controller.js.map +1 -0
- package/dist/index.d.ts +9 -7
- package/dist/index.js +30 -20
- package/dist/index.js.map +1 -1
- package/dist/src/components/audio-visualiser.d.ts +1 -0
- package/dist/src/components/audio-visualiser.js +6 -3
- package/dist/src/components/audio-visualiser.js.map +1 -1
- package/dist/src/components/corti-dictation.d.ts +21 -6
- package/dist/src/components/corti-dictation.js +25 -2
- package/dist/src/components/corti-dictation.js.map +1 -1
- package/dist/src/components/recording-button.d.ts +4 -0
- package/dist/src/components/recording-button.js +34 -10
- package/dist/src/components/recording-button.js.map +1 -1
- package/dist/src/components/settings-menu.js +1 -1
- package/dist/src/components/settings-menu.js.map +1 -1
- package/dist/src/constants.js +24 -6
- package/dist/src/constants.js.map +1 -1
- package/dist/src/contexts/dictation-context.d.ts +19 -5
- package/dist/src/contexts/dictation-context.js +32 -12
- package/dist/src/contexts/dictation-context.js.map +1 -1
- package/dist/src/controllers/DictationController.d.ts +5 -0
- package/dist/src/controllers/DictationController.js +27 -8
- package/dist/src/controllers/DictationController.js.map +1 -1
- package/dist/src/controllers/MediaController.d.ts +6 -0
- package/dist/src/controllers/MediaController.js +17 -1
- package/dist/src/controllers/MediaController.js.map +1 -1
- package/dist/src/styles/ComponentStyles.js +5 -5
- package/dist/src/styles/ComponentStyles.js.map +1 -1
- package/dist/src/styles/audio-visualiser.js +1 -1
- package/dist/src/styles/audio-visualiser.js.map +1 -1
- package/dist/src/styles/buttons.js +12 -12
- package/dist/src/styles/buttons.js.map +1 -1
- package/dist/src/styles/callout.js +7 -7
- package/dist/src/styles/callout.js.map +1 -1
- package/dist/src/styles/select.js +8 -8
- package/dist/src/styles/select.js.map +1 -1
- package/dist/src/styles/settings-menu.js +4 -4
- package/dist/src/styles/settings-menu.js.map +1 -1
- package/dist/src/types.d.ts +5 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/converters.js +4 -1
- package/dist/src/utils/converters.js.map +1 -1
- package/dist/src/utils/events.d.ts +11 -4
- package/dist/src/utils/events.js.map +1 -1
- package/dist/src/utils/languages.js +2 -1
- package/dist/src/utils/languages.js.map +1 -1
- package/dist/src/utils/media.d.ts +1 -1
- package/dist/src/utils/media.js +13 -1
- package/dist/src/utils/media.js.map +1 -1
- package/dist/src/utils/token.d.ts +1 -1
- package/dist/src/utils/token.js +12 -11
- package/dist/src/utils/token.js.map +1 -1
- package/dist/styles/buttons.js +1 -2
- package/dist/styles/buttons.js.map +1 -1
- package/dist/styles/component-styles.d.ts +3 -0
- package/dist/styles/component-styles.js +32 -0
- package/dist/styles/component-styles.js.map +1 -0
- 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 +54 -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.stories.tsbuildinfo +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/events.d.ts +12 -3
- package/dist/utils/events.js +14 -0
- package/dist/utils/events.js.map +1 -1
- package/dist/utils/keybinding.d.ts +49 -0
- package/dist/utils/keybinding.js +140 -0
- package/dist/utils/keybinding.js.map +1 -0
- package/dist/utils/languages.d.ts +4 -3
- package/dist/utils/languages.js.map +1 -1
- package/dist/utils/token.d.ts +1 -1
- package/dist/utils/token.js +12 -11
- package/dist/utils/token.js.map +1 -1
- package/package.json +9 -8
package/dist/bundle.js
CHANGED
|
@@ -811,6 +811,7 @@ var DEFAULT_DICTATION_CONFIG = {
|
|
|
811
811
|
primaryLanguage: "en",
|
|
812
812
|
spokenPunctuation: true
|
|
813
813
|
};
|
|
814
|
+
var AUDIO_CHUNK_INTERVAL_MS = 250;
|
|
814
815
|
|
|
815
816
|
// dist/utils/converters.js
|
|
816
817
|
var commaSeparatedConverter = {
|
|
@@ -960,37 +961,37 @@ function c5({ context: c6, subscribe: e10 }) {
|
|
|
960
961
|
};
|
|
961
962
|
}
|
|
962
963
|
|
|
963
|
-
// dist/
|
|
964
|
-
|
|
965
|
-
.
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
display: flex;
|
|
972
|
-
gap: 4px;
|
|
973
|
-
height: 46px;
|
|
974
|
-
width: fit-content;
|
|
975
|
-
box-sizing: border-box;
|
|
976
|
-
overflow: hidden;
|
|
964
|
+
// dist/utils/devices.js
|
|
965
|
+
async function requestMicAccess() {
|
|
966
|
+
if (!navigator.permissions) {
|
|
967
|
+
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
968
|
+
stream.getTracks().forEach((track) => {
|
|
969
|
+
track.stop();
|
|
970
|
+
});
|
|
971
|
+
return;
|
|
977
972
|
}
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
const initialToken = "accessToken" in config ? {
|
|
984
|
-
accessToken: config.accessToken,
|
|
985
|
-
refreshToken: config.refreshToken
|
|
986
|
-
} : await config.refreshAccessToken();
|
|
987
|
-
if (!initialToken?.accessToken || typeof initialToken.accessToken !== "string") {
|
|
988
|
-
throw new Error("Access token is required and must be a string");
|
|
973
|
+
const permissionStatus = await navigator.permissions.query({
|
|
974
|
+
name: "microphone"
|
|
975
|
+
});
|
|
976
|
+
if (permissionStatus.state === "denied") {
|
|
977
|
+
throw new Error("Microphone permission is denied");
|
|
989
978
|
}
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
979
|
+
if (permissionStatus.state === "prompt") {
|
|
980
|
+
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
981
|
+
stream.getTracks().forEach((track) => {
|
|
982
|
+
track.stop();
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
async function getAudioDevices() {
|
|
987
|
+
if (!navigator.mediaDevices?.enumerateDevices) {
|
|
988
|
+
throw new Error("MediaDevices API is not available");
|
|
989
|
+
}
|
|
990
|
+
await requestMicAccess();
|
|
991
|
+
const devices = await navigator.mediaDevices.enumerateDevices();
|
|
992
|
+
const audioDevices = devices.filter((device) => device.kind === "audioinput");
|
|
993
|
+
const defaultDevice = audioDevices.length > 0 ? audioDevices[0] : void 0;
|
|
994
|
+
return { defaultDevice, devices: audioDevices };
|
|
994
995
|
}
|
|
995
996
|
|
|
996
997
|
// dist/utils/events.js
|
|
@@ -1078,6 +1079,323 @@ function networkActivityEvent(direction, data) {
|
|
|
1078
1079
|
detail: { data, direction }
|
|
1079
1080
|
});
|
|
1080
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
|
+
|
|
1097
|
+
// dist/controllers/devices-controller.js
|
|
1098
|
+
var __classPrivateFieldSet = function(receiver, state, value, kind, f5) {
|
|
1099
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
1100
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a setter");
|
|
1101
|
+
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");
|
|
1102
|
+
return kind === "a" ? f5.call(receiver, value) : f5 ? f5.value = value : state.set(receiver, value), value;
|
|
1103
|
+
};
|
|
1104
|
+
var __classPrivateFieldGet = function(receiver, state, kind, f5) {
|
|
1105
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
1106
|
+
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");
|
|
1107
|
+
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
1108
|
+
};
|
|
1109
|
+
var _DevicesController_instances;
|
|
1110
|
+
var _DevicesController_autoLoadedDevices;
|
|
1111
|
+
var _DevicesController_loadingDevices;
|
|
1112
|
+
var _DevicesController_deviceChangeHandler;
|
|
1113
|
+
var _DevicesController_initialized;
|
|
1114
|
+
var _DevicesController_setupDeviceChangeListener;
|
|
1115
|
+
var _DevicesController_removeDeviceChangeListener;
|
|
1116
|
+
var _DevicesController_loadDevices;
|
|
1117
|
+
var DevicesController = class {
|
|
1118
|
+
constructor(host) {
|
|
1119
|
+
_DevicesController_instances.add(this);
|
|
1120
|
+
_DevicesController_autoLoadedDevices.set(this, false);
|
|
1121
|
+
_DevicesController_loadingDevices.set(this, false);
|
|
1122
|
+
_DevicesController_deviceChangeHandler.set(this, void 0);
|
|
1123
|
+
_DevicesController_initialized.set(this, false);
|
|
1124
|
+
this.host = host;
|
|
1125
|
+
host.addController(this);
|
|
1126
|
+
}
|
|
1127
|
+
initialize() {
|
|
1128
|
+
__classPrivateFieldSet(this, _DevicesController_initialized, true, "f");
|
|
1129
|
+
if (this.host.devices === void 0) {
|
|
1130
|
+
__classPrivateFieldGet(this, _DevicesController_instances, "m", _DevicesController_loadDevices).call(this);
|
|
1131
|
+
__classPrivateFieldGet(this, _DevicesController_instances, "m", _DevicesController_setupDeviceChangeListener).call(this);
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
hostDisconnected() {
|
|
1135
|
+
__classPrivateFieldGet(this, _DevicesController_instances, "m", _DevicesController_removeDeviceChangeListener).call(this);
|
|
1136
|
+
}
|
|
1137
|
+
hostUpdate() {
|
|
1138
|
+
if (!__classPrivateFieldGet(this, _DevicesController_initialized, "f")) {
|
|
1139
|
+
return;
|
|
1140
|
+
}
|
|
1141
|
+
if (this.host.devices === void 0) {
|
|
1142
|
+
__classPrivateFieldGet(this, _DevicesController_instances, "m", _DevicesController_loadDevices).call(this);
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Clear the auto-loaded flag (when devices are set externally)
|
|
1147
|
+
*/
|
|
1148
|
+
clearAutoLoadedFlag() {
|
|
1149
|
+
__classPrivateFieldSet(this, _DevicesController_autoLoadedDevices, false, "f");
|
|
1150
|
+
}
|
|
1151
|
+
};
|
|
1152
|
+
_DevicesController_autoLoadedDevices = /* @__PURE__ */ new WeakMap(), _DevicesController_loadingDevices = /* @__PURE__ */ new WeakMap(), _DevicesController_deviceChangeHandler = /* @__PURE__ */ new WeakMap(), _DevicesController_initialized = /* @__PURE__ */ new WeakMap(), _DevicesController_instances = /* @__PURE__ */ new WeakSet(), _DevicesController_setupDeviceChangeListener = function _DevicesController_setupDeviceChangeListener2() {
|
|
1153
|
+
if (__classPrivateFieldGet(this, _DevicesController_deviceChangeHandler, "f")) {
|
|
1154
|
+
return;
|
|
1155
|
+
}
|
|
1156
|
+
__classPrivateFieldSet(this, _DevicesController_deviceChangeHandler, () => {
|
|
1157
|
+
if (__classPrivateFieldGet(this, _DevicesController_autoLoadedDevices, "f")) {
|
|
1158
|
+
__classPrivateFieldGet(this, _DevicesController_instances, "m", _DevicesController_loadDevices).call(this);
|
|
1159
|
+
}
|
|
1160
|
+
}, "f");
|
|
1161
|
+
navigator.mediaDevices.addEventListener("devicechange", __classPrivateFieldGet(this, _DevicesController_deviceChangeHandler, "f"));
|
|
1162
|
+
}, _DevicesController_removeDeviceChangeListener = function _DevicesController_removeDeviceChangeListener2() {
|
|
1163
|
+
if (!__classPrivateFieldGet(this, _DevicesController_deviceChangeHandler, "f")) {
|
|
1164
|
+
return;
|
|
1165
|
+
}
|
|
1166
|
+
navigator.mediaDevices.removeEventListener("devicechange", __classPrivateFieldGet(this, _DevicesController_deviceChangeHandler, "f"));
|
|
1167
|
+
__classPrivateFieldSet(this, _DevicesController_deviceChangeHandler, void 0, "f");
|
|
1168
|
+
}, _DevicesController_loadDevices = async function _DevicesController_loadDevices2() {
|
|
1169
|
+
if (__classPrivateFieldGet(this, _DevicesController_loadingDevices, "f")) {
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
__classPrivateFieldSet(this, _DevicesController_loadingDevices, true, "f");
|
|
1173
|
+
try {
|
|
1174
|
+
const { devices, defaultDevice } = await getAudioDevices();
|
|
1175
|
+
__classPrivateFieldSet(this, _DevicesController_autoLoadedDevices, true, "f");
|
|
1176
|
+
this.host._devices = devices;
|
|
1177
|
+
const previousDevice = this.host.selectedDevice;
|
|
1178
|
+
const selectedDevice = (previousDevice && devices.find((d3) => d3.deviceId === previousDevice.deviceId)) ?? defaultDevice;
|
|
1179
|
+
this.host.selectedDevice = selectedDevice;
|
|
1180
|
+
this.host.requestUpdate();
|
|
1181
|
+
this.host.dispatchEvent(recordingDevicesChangedEvent(devices, selectedDevice));
|
|
1182
|
+
this.host.dispatchEvent(readyEvent());
|
|
1183
|
+
} catch (error) {
|
|
1184
|
+
this.host.dispatchEvent(errorEvent(error));
|
|
1185
|
+
} finally {
|
|
1186
|
+
__classPrivateFieldSet(this, _DevicesController_loadingDevices, false, "f");
|
|
1187
|
+
}
|
|
1188
|
+
};
|
|
1189
|
+
|
|
1190
|
+
// dist/utils/languages.js
|
|
1191
|
+
var DEFAULT_LANGUAGES_BY_REGION = {
|
|
1192
|
+
default: LANGUAGES_SUPPORTED_EU,
|
|
1193
|
+
eu: LANGUAGES_SUPPORTED_EU,
|
|
1194
|
+
us: LANGUAGES_SUPPORTED_US
|
|
1195
|
+
};
|
|
1196
|
+
function getLanguageName(languageCode) {
|
|
1197
|
+
try {
|
|
1198
|
+
const userLocale = navigator.language || "en";
|
|
1199
|
+
const displayNames = new Intl.DisplayNames([userLocale], {
|
|
1200
|
+
type: "language"
|
|
1201
|
+
});
|
|
1202
|
+
const languageName = displayNames.of(languageCode);
|
|
1203
|
+
return languageName || languageCode;
|
|
1204
|
+
} catch {
|
|
1205
|
+
return languageCode;
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
function getLanguagesByRegion(region) {
|
|
1209
|
+
const languages = DEFAULT_LANGUAGES_BY_REGION[region || "default"] || DEFAULT_LANGUAGES_BY_REGION["default"];
|
|
1210
|
+
const defaultLanguage = languages?.[0];
|
|
1211
|
+
return { defaultLanguage, languages };
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
// dist/controllers/languages-controller.js
|
|
1215
|
+
var __classPrivateFieldSet2 = function(receiver, state, value, kind, f5) {
|
|
1216
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
1217
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a setter");
|
|
1218
|
+
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");
|
|
1219
|
+
return kind === "a" ? f5.call(receiver, value) : f5 ? f5.value = value : state.set(receiver, value), value;
|
|
1220
|
+
};
|
|
1221
|
+
var __classPrivateFieldGet2 = function(receiver, state, kind, f5) {
|
|
1222
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
1223
|
+
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");
|
|
1224
|
+
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
1225
|
+
};
|
|
1226
|
+
var _LanguagesController_instances;
|
|
1227
|
+
var _LanguagesController_autoLoadedLanguages;
|
|
1228
|
+
var _LanguagesController_loadingLanguages;
|
|
1229
|
+
var _LanguagesController_previousRegion;
|
|
1230
|
+
var _LanguagesController_initialized;
|
|
1231
|
+
var _LanguagesController_loadLanguages;
|
|
1232
|
+
var LanguagesController = class {
|
|
1233
|
+
constructor(host) {
|
|
1234
|
+
_LanguagesController_instances.add(this);
|
|
1235
|
+
_LanguagesController_autoLoadedLanguages.set(this, false);
|
|
1236
|
+
_LanguagesController_loadingLanguages.set(this, false);
|
|
1237
|
+
_LanguagesController_previousRegion.set(this, void 0);
|
|
1238
|
+
_LanguagesController_initialized.set(this, false);
|
|
1239
|
+
this.host = host;
|
|
1240
|
+
host.addController(this);
|
|
1241
|
+
}
|
|
1242
|
+
initialize() {
|
|
1243
|
+
__classPrivateFieldSet2(this, _LanguagesController_initialized, true, "f");
|
|
1244
|
+
if (this.host._languages === void 0) {
|
|
1245
|
+
__classPrivateFieldGet2(this, _LanguagesController_instances, "m", _LanguagesController_loadLanguages).call(this);
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
hostUpdate() {
|
|
1249
|
+
if (!__classPrivateFieldGet2(this, _LanguagesController_initialized, "f")) {
|
|
1250
|
+
return;
|
|
1251
|
+
}
|
|
1252
|
+
if (__classPrivateFieldGet2(this, _LanguagesController_previousRegion, "f") !== this.host.region && __classPrivateFieldGet2(this, _LanguagesController_autoLoadedLanguages, "f") || this.host._languages === void 0) {
|
|
1253
|
+
__classPrivateFieldGet2(this, _LanguagesController_instances, "m", _LanguagesController_loadLanguages).call(this);
|
|
1254
|
+
}
|
|
1255
|
+
__classPrivateFieldSet2(this, _LanguagesController_previousRegion, this.host.region, "f");
|
|
1256
|
+
}
|
|
1257
|
+
/**
|
|
1258
|
+
* Clear the auto-loaded flag (when languages are set externally)
|
|
1259
|
+
*/
|
|
1260
|
+
clearAutoLoadedFlag() {
|
|
1261
|
+
__classPrivateFieldSet2(this, _LanguagesController_autoLoadedLanguages, false, "f");
|
|
1262
|
+
}
|
|
1263
|
+
};
|
|
1264
|
+
_LanguagesController_autoLoadedLanguages = /* @__PURE__ */ new WeakMap(), _LanguagesController_loadingLanguages = /* @__PURE__ */ new WeakMap(), _LanguagesController_previousRegion = /* @__PURE__ */ new WeakMap(), _LanguagesController_initialized = /* @__PURE__ */ new WeakMap(), _LanguagesController_instances = /* @__PURE__ */ new WeakSet(), _LanguagesController_loadLanguages = async function _LanguagesController_loadLanguages2() {
|
|
1265
|
+
if (__classPrivateFieldGet2(this, _LanguagesController_loadingLanguages, "f")) {
|
|
1266
|
+
return;
|
|
1267
|
+
}
|
|
1268
|
+
__classPrivateFieldSet2(this, _LanguagesController_loadingLanguages, true, "f");
|
|
1269
|
+
try {
|
|
1270
|
+
const { languages, defaultLanguage } = getLanguagesByRegion(this.host.region);
|
|
1271
|
+
__classPrivateFieldSet2(this, _LanguagesController_autoLoadedLanguages, true, "f");
|
|
1272
|
+
this.host._languages = languages;
|
|
1273
|
+
const previousLanguage = this.host.dictationConfig?.primaryLanguage;
|
|
1274
|
+
const selectedLanguage = previousLanguage && languages.includes(previousLanguage) ? previousLanguage : defaultLanguage;
|
|
1275
|
+
this.host.dictationConfig = {
|
|
1276
|
+
...this.host.dictationConfig,
|
|
1277
|
+
primaryLanguage: selectedLanguage || "en"
|
|
1278
|
+
};
|
|
1279
|
+
this.host.requestUpdate();
|
|
1280
|
+
this.host.dispatchEvent(languagesChangedEvent(languages, selectedLanguage));
|
|
1281
|
+
} catch (error) {
|
|
1282
|
+
this.host.dispatchEvent(errorEvent(error));
|
|
1283
|
+
} finally {
|
|
1284
|
+
__classPrivateFieldSet2(this, _LanguagesController_loadingLanguages, false, "f");
|
|
1285
|
+
}
|
|
1286
|
+
};
|
|
1287
|
+
|
|
1288
|
+
// dist/styles/component-styles.js
|
|
1289
|
+
var ComponentStyles = i`
|
|
1290
|
+
:host {
|
|
1291
|
+
font-family: var(--component-font-family, -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, Cantarell, Ubuntu, roboto, noto, helvetica, arial, sans-serif);
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
.wrapper {
|
|
1295
|
+
background-color: var(--card-background, light-dark(#fff, #333));
|
|
1296
|
+
border: 1px solid var(--card-border-color, light-dark(#ddd, #555));
|
|
1297
|
+
border-radius: var(--card-border-radius, 8px);
|
|
1298
|
+
box-shadow: var(--card-box-shadow, 0 2px 5px rgba(0, 0, 0, 0.1));
|
|
1299
|
+
padding: var(--card-padding, 4px);
|
|
1300
|
+
display: flex;
|
|
1301
|
+
gap: 4px;
|
|
1302
|
+
height: 46px;
|
|
1303
|
+
width: fit-content;
|
|
1304
|
+
box-sizing: border-box;
|
|
1305
|
+
overflow: hidden;
|
|
1306
|
+
}
|
|
1307
|
+
`;
|
|
1308
|
+
var LabelStyles = i`
|
|
1309
|
+
label {
|
|
1310
|
+
display: block;
|
|
1311
|
+
font-size: 0.8rem;
|
|
1312
|
+
padding-bottom: 0.5rem;
|
|
1313
|
+
font-weight: 500;
|
|
1314
|
+
color: var(--component-text-color, light-dark(#333, #eee));
|
|
1315
|
+
pointer-events: none;
|
|
1316
|
+
}
|
|
1317
|
+
`;
|
|
1318
|
+
var component_styles_default = ComponentStyles;
|
|
1319
|
+
|
|
1320
|
+
// dist/utils/auth.js
|
|
1321
|
+
async function getInitialToken(config) {
|
|
1322
|
+
const initialToken = "accessToken" in config ? {
|
|
1323
|
+
accessToken: config.accessToken,
|
|
1324
|
+
refreshToken: config.refreshToken
|
|
1325
|
+
} : await config.refreshAccessToken();
|
|
1326
|
+
if (!initialToken?.accessToken || typeof initialToken.accessToken !== "string") {
|
|
1327
|
+
throw new Error("Access token is required and must be a string");
|
|
1328
|
+
}
|
|
1329
|
+
return {
|
|
1330
|
+
accessToken: initialToken.accessToken,
|
|
1331
|
+
refreshToken: initialToken.refreshToken
|
|
1332
|
+
};
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
// dist/utils/keybinding.js
|
|
1336
|
+
function isMac() {
|
|
1337
|
+
if (typeof navigator === "undefined") {
|
|
1338
|
+
return false;
|
|
1339
|
+
}
|
|
1340
|
+
return /Mac|iPhone|iPad|iPod/.test(navigator.userAgent);
|
|
1341
|
+
}
|
|
1342
|
+
function capitalize(str) {
|
|
1343
|
+
if (str.length === 0) {
|
|
1344
|
+
return str;
|
|
1345
|
+
}
|
|
1346
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1347
|
+
}
|
|
1348
|
+
function normalizeKeyForKeybinding(key) {
|
|
1349
|
+
if (key === " ") {
|
|
1350
|
+
return "Space";
|
|
1351
|
+
}
|
|
1352
|
+
const normalized = key.trim().toLowerCase();
|
|
1353
|
+
if (normalized === "control") {
|
|
1354
|
+
return "Ctrl";
|
|
1355
|
+
}
|
|
1356
|
+
if (normalized === "meta" || normalized === "cmd") {
|
|
1357
|
+
return isMac() ? "Cmd" : "Meta";
|
|
1358
|
+
}
|
|
1359
|
+
if (normalized === "alt" || normalized === "opt") {
|
|
1360
|
+
return isMac() ? "Opt" : "Alt";
|
|
1361
|
+
}
|
|
1362
|
+
if (normalized === "space") {
|
|
1363
|
+
return "Space";
|
|
1364
|
+
}
|
|
1365
|
+
return normalized.length > 1 ? capitalize(normalized) : normalized;
|
|
1366
|
+
}
|
|
1367
|
+
function normalizeKeybinding(keybinding) {
|
|
1368
|
+
if (!keybinding) {
|
|
1369
|
+
return null;
|
|
1370
|
+
}
|
|
1371
|
+
const trimmed = keybinding.trim();
|
|
1372
|
+
if (trimmed === "") {
|
|
1373
|
+
return null;
|
|
1374
|
+
}
|
|
1375
|
+
return normalizeKeyForKeybinding(trimmed);
|
|
1376
|
+
}
|
|
1377
|
+
function matchesKeybinding(event, keybinding) {
|
|
1378
|
+
const normalizedKeybinding = normalizeKeybinding(keybinding);
|
|
1379
|
+
if (!normalizedKeybinding) {
|
|
1380
|
+
return false;
|
|
1381
|
+
}
|
|
1382
|
+
const normalizedKey = normalizeKeyForKeybinding(event.key);
|
|
1383
|
+
const normalizedCode = normalizeKeyForKeybinding(event.code);
|
|
1384
|
+
return normalizedKey === normalizedKeybinding || normalizedCode === normalizedKeybinding;
|
|
1385
|
+
}
|
|
1386
|
+
function shouldIgnoreKeybinding(element) {
|
|
1387
|
+
if (!element) {
|
|
1388
|
+
return false;
|
|
1389
|
+
}
|
|
1390
|
+
const tagName = element.tagName.toLowerCase();
|
|
1391
|
+
if (tagName === "input" || tagName === "textarea") {
|
|
1392
|
+
return true;
|
|
1393
|
+
}
|
|
1394
|
+
if (element instanceof HTMLElement && element.contentEditable === "true") {
|
|
1395
|
+
return true;
|
|
1396
|
+
}
|
|
1397
|
+
return false;
|
|
1398
|
+
}
|
|
1081
1399
|
|
|
1082
1400
|
// dist/utils/token.js
|
|
1083
1401
|
function decodeToken(token) {
|
|
@@ -1105,15 +1423,16 @@ function decodeToken(token) {
|
|
|
1105
1423
|
}
|
|
1106
1424
|
const regex = /^https:\/\/(keycloak|auth)\.([^.]+)\.corti\.app\/realms\/([^/]+)/;
|
|
1107
1425
|
const match = issuerUrl.match(regex);
|
|
1108
|
-
if (match) {
|
|
1109
|
-
|
|
1110
|
-
return {
|
|
1111
|
-
accessToken: token,
|
|
1112
|
-
environment: match[2],
|
|
1113
|
-
expiresAt,
|
|
1114
|
-
tenant: match[3]
|
|
1115
|
-
};
|
|
1426
|
+
if (!match) {
|
|
1427
|
+
throw new Error("Access token does not match expected format");
|
|
1116
1428
|
}
|
|
1429
|
+
const expiresAt = tokenDetails.exp && typeof tokenDetails.exp === "number" ? tokenDetails.exp : void 0;
|
|
1430
|
+
return {
|
|
1431
|
+
accessToken: token,
|
|
1432
|
+
environment: match[2],
|
|
1433
|
+
expiresAt,
|
|
1434
|
+
tenant: match[3]
|
|
1435
|
+
};
|
|
1117
1436
|
}
|
|
1118
1437
|
|
|
1119
1438
|
// dist/contexts/dictation-context.js
|
|
@@ -1123,19 +1442,34 @@ var __decorate = function(decorators, target, key, desc) {
|
|
|
1123
1442
|
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;
|
|
1124
1443
|
return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
|
|
1125
1444
|
};
|
|
1126
|
-
var
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
var
|
|
1132
|
-
var
|
|
1133
|
-
var
|
|
1134
|
-
var
|
|
1135
|
-
var
|
|
1136
|
-
var
|
|
1137
|
-
var
|
|
1138
|
-
var
|
|
1445
|
+
var __classPrivateFieldGet3 = function(receiver, state, kind, f5) {
|
|
1446
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
1447
|
+
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");
|
|
1448
|
+
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
1449
|
+
};
|
|
1450
|
+
var _DictationRoot_languagesController;
|
|
1451
|
+
var _DictationRoot_devicesController;
|
|
1452
|
+
var _DictationRoot_handleLanguageChanged;
|
|
1453
|
+
var _DictationRoot_handleDeviceChanged;
|
|
1454
|
+
var _DictationRoot_handleRecordingStateChanged;
|
|
1455
|
+
var _DictationRoot_handleContextRequest;
|
|
1456
|
+
var _DictationRoot_handleModeChanged;
|
|
1457
|
+
var _DictationRoot_handleKeybindingChanged;
|
|
1458
|
+
var regionContext = n7(Symbol("region"));
|
|
1459
|
+
var tenantNameContext = n7(Symbol("tenantName"));
|
|
1460
|
+
var languagesContext = n7(Symbol("languages"));
|
|
1461
|
+
var devicesContext = n7(Symbol("devices"));
|
|
1462
|
+
var selectedDeviceContext = n7(Symbol("selectedDevice"));
|
|
1463
|
+
var recordingStateContext = n7(Symbol("recordingState"));
|
|
1464
|
+
var accessTokenContext = n7(Symbol("accessToken"));
|
|
1465
|
+
var dictationConfigContext = n7(Symbol("dictationConfig"));
|
|
1466
|
+
var authConfigContext = n7(Symbol("authConfig"));
|
|
1467
|
+
var socketUrlContext = n7(Symbol("socketUrl"));
|
|
1468
|
+
var socketProxyContext = n7(Symbol("socketProxy"));
|
|
1469
|
+
var debugDisplayAudioContext = n7(Symbol("debugDisplayAudio"));
|
|
1470
|
+
var modeContext = n7(Symbol("mode"));
|
|
1471
|
+
var keybindingContext = n7(Symbol("keybinding"));
|
|
1472
|
+
var DictationRoot = class DictationRoot2 extends i4 {
|
|
1139
1473
|
set accessToken(token) {
|
|
1140
1474
|
this.setAccessToken(token);
|
|
1141
1475
|
}
|
|
@@ -1148,33 +1482,76 @@ var DictationContext = class DictationContext2 extends i4 {
|
|
|
1148
1482
|
get authConfig() {
|
|
1149
1483
|
return this._authConfig;
|
|
1150
1484
|
}
|
|
1485
|
+
set languages(value) {
|
|
1486
|
+
this._languages = value;
|
|
1487
|
+
if (value !== void 0) {
|
|
1488
|
+
__classPrivateFieldGet3(this, _DictationRoot_languagesController, "f").clearAutoLoadedFlag();
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
get languages() {
|
|
1492
|
+
return this._languages;
|
|
1493
|
+
}
|
|
1494
|
+
set devices(value) {
|
|
1495
|
+
this._devices = value;
|
|
1496
|
+
if (value !== void 0) {
|
|
1497
|
+
__classPrivateFieldGet3(this, _DictationRoot_devicesController, "f").clearAutoLoadedFlag();
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
get devices() {
|
|
1501
|
+
return this._devices;
|
|
1502
|
+
}
|
|
1151
1503
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
1152
1504
|
// Lifecycle
|
|
1153
1505
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
1154
1506
|
constructor() {
|
|
1155
1507
|
super();
|
|
1156
1508
|
this.recordingState = "stopped";
|
|
1509
|
+
_DictationRoot_languagesController.set(this, new LanguagesController(this));
|
|
1510
|
+
_DictationRoot_devicesController.set(this, new DevicesController(this));
|
|
1511
|
+
this.mode = "toggle-to-talk";
|
|
1157
1512
|
this.noWrapper = false;
|
|
1158
|
-
this
|
|
1513
|
+
_DictationRoot_handleLanguageChanged.set(this, (e10) => {
|
|
1159
1514
|
const event = e10;
|
|
1160
|
-
this.languages = event.detail.languages;
|
|
1161
1515
|
this.dictationConfig = {
|
|
1162
1516
|
...this.dictationConfig,
|
|
1163
1517
|
primaryLanguage: event.detail.selectedLanguage
|
|
1164
1518
|
};
|
|
1165
|
-
};
|
|
1166
|
-
this
|
|
1519
|
+
});
|
|
1520
|
+
_DictationRoot_handleDeviceChanged.set(this, (e10) => {
|
|
1167
1521
|
const event = e10;
|
|
1168
|
-
this.devices = event.detail.devices;
|
|
1169
1522
|
this.selectedDevice = event.detail.selectedDevice;
|
|
1170
|
-
};
|
|
1171
|
-
this
|
|
1523
|
+
});
|
|
1524
|
+
_DictationRoot_handleRecordingStateChanged.set(this, (e10) => {
|
|
1172
1525
|
const event = e10;
|
|
1173
1526
|
this.recordingState = event.detail.state;
|
|
1174
|
-
};
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1527
|
+
});
|
|
1528
|
+
_DictationRoot_handleContextRequest.set(this, (e10) => {
|
|
1529
|
+
if (e10.context === languagesContext) {
|
|
1530
|
+
__classPrivateFieldGet3(this, _DictationRoot_languagesController, "f").initialize();
|
|
1531
|
+
} else if (e10.context === devicesContext) {
|
|
1532
|
+
__classPrivateFieldGet3(this, _DictationRoot_devicesController, "f").initialize();
|
|
1533
|
+
} else if (e10.context === keybindingContext && e10.contextTarget.tagName.toLowerCase() === "dictation-keybinding-selector") {
|
|
1534
|
+
if (this.keybinding === void 0) {
|
|
1535
|
+
this.keybinding = "`";
|
|
1536
|
+
this.dispatchEvent(keybindingChangedEvent("`", "Backquote"));
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
});
|
|
1540
|
+
_DictationRoot_handleModeChanged.set(this, (e10) => {
|
|
1541
|
+
const event = e10;
|
|
1542
|
+
this.mode = event.detail.mode;
|
|
1543
|
+
});
|
|
1544
|
+
_DictationRoot_handleKeybindingChanged.set(this, (e10) => {
|
|
1545
|
+
const event = e10;
|
|
1546
|
+
const normalizedKeybinding = normalizeKeybinding(event.detail.key);
|
|
1547
|
+
this.keybinding = normalizedKeybinding;
|
|
1548
|
+
});
|
|
1549
|
+
this.addEventListener("languages-changed", __classPrivateFieldGet3(this, _DictationRoot_handleLanguageChanged, "f"));
|
|
1550
|
+
this.addEventListener("recording-devices-changed", __classPrivateFieldGet3(this, _DictationRoot_handleDeviceChanged, "f"));
|
|
1551
|
+
this.addEventListener("recording-state-changed", __classPrivateFieldGet3(this, _DictationRoot_handleRecordingStateChanged, "f"));
|
|
1552
|
+
this.addEventListener("context-request", __classPrivateFieldGet3(this, _DictationRoot_handleContextRequest, "f"));
|
|
1553
|
+
this.addEventListener("mode-changed", __classPrivateFieldGet3(this, _DictationRoot_handleModeChanged, "f"));
|
|
1554
|
+
this.addEventListener("keybinding-changed", __classPrivateFieldGet3(this, _DictationRoot_handleKeybindingChanged, "f"));
|
|
1178
1555
|
}
|
|
1179
1556
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
1180
1557
|
// Public methods
|
|
@@ -1243,70 +1620,92 @@ var DictationContext = class DictationContext2 extends i4 {
|
|
|
1243
1620
|
</div>`;
|
|
1244
1621
|
}
|
|
1245
1622
|
};
|
|
1246
|
-
|
|
1623
|
+
_DictationRoot_languagesController = /* @__PURE__ */ new WeakMap();
|
|
1624
|
+
_DictationRoot_devicesController = /* @__PURE__ */ new WeakMap();
|
|
1625
|
+
_DictationRoot_handleLanguageChanged = /* @__PURE__ */ new WeakMap();
|
|
1626
|
+
_DictationRoot_handleDeviceChanged = /* @__PURE__ */ new WeakMap();
|
|
1627
|
+
_DictationRoot_handleRecordingStateChanged = /* @__PURE__ */ new WeakMap();
|
|
1628
|
+
_DictationRoot_handleContextRequest = /* @__PURE__ */ new WeakMap();
|
|
1629
|
+
_DictationRoot_handleModeChanged = /* @__PURE__ */ new WeakMap();
|
|
1630
|
+
_DictationRoot_handleKeybindingChanged = /* @__PURE__ */ new WeakMap();
|
|
1631
|
+
DictationRoot.styles = [component_styles_default];
|
|
1247
1632
|
__decorate([
|
|
1248
1633
|
e9({ context: regionContext }),
|
|
1249
1634
|
r5()
|
|
1250
|
-
],
|
|
1635
|
+
], DictationRoot.prototype, "region", void 0);
|
|
1251
1636
|
__decorate([
|
|
1252
1637
|
e9({ context: tenantNameContext }),
|
|
1253
1638
|
r5()
|
|
1254
|
-
],
|
|
1639
|
+
], DictationRoot.prototype, "tenantName", void 0);
|
|
1255
1640
|
__decorate([
|
|
1256
1641
|
e9({ context: recordingStateContext }),
|
|
1257
1642
|
r5()
|
|
1258
|
-
],
|
|
1643
|
+
], DictationRoot.prototype, "recordingState", void 0);
|
|
1259
1644
|
__decorate([
|
|
1260
1645
|
e9({ context: accessTokenContext }),
|
|
1261
1646
|
r5()
|
|
1262
|
-
],
|
|
1647
|
+
], DictationRoot.prototype, "_accessToken", void 0);
|
|
1263
1648
|
__decorate([
|
|
1264
1649
|
n4({ type: String })
|
|
1265
|
-
],
|
|
1650
|
+
], DictationRoot.prototype, "accessToken", null);
|
|
1266
1651
|
__decorate([
|
|
1267
1652
|
e9({ context: authConfigContext }),
|
|
1268
1653
|
r5()
|
|
1269
|
-
],
|
|
1654
|
+
], DictationRoot.prototype, "_authConfig", void 0);
|
|
1270
1655
|
__decorate([
|
|
1271
1656
|
n4({ attribute: false, type: Object })
|
|
1272
|
-
],
|
|
1657
|
+
], DictationRoot.prototype, "authConfig", null);
|
|
1273
1658
|
__decorate([
|
|
1274
1659
|
e9({ context: socketUrlContext }),
|
|
1275
1660
|
n4({ type: String })
|
|
1276
|
-
],
|
|
1661
|
+
], DictationRoot.prototype, "socketUrl", void 0);
|
|
1277
1662
|
__decorate([
|
|
1278
1663
|
e9({ context: socketProxyContext }),
|
|
1279
1664
|
n4({ attribute: false, type: Object })
|
|
1280
|
-
],
|
|
1665
|
+
], DictationRoot.prototype, "socketProxy", void 0);
|
|
1281
1666
|
__decorate([
|
|
1282
1667
|
e9({ context: dictationConfigContext }),
|
|
1283
1668
|
n4({ attribute: false, type: Object })
|
|
1284
|
-
],
|
|
1669
|
+
], DictationRoot.prototype, "dictationConfig", void 0);
|
|
1285
1670
|
__decorate([
|
|
1286
1671
|
e9({ context: languagesContext }),
|
|
1672
|
+
r5()
|
|
1673
|
+
], DictationRoot.prototype, "_languages", void 0);
|
|
1674
|
+
__decorate([
|
|
1287
1675
|
n4({
|
|
1288
1676
|
converter: commaSeparatedConverter,
|
|
1289
1677
|
type: Array
|
|
1290
1678
|
})
|
|
1291
|
-
],
|
|
1679
|
+
], DictationRoot.prototype, "languages", null);
|
|
1292
1680
|
__decorate([
|
|
1293
1681
|
e9({ context: devicesContext }),
|
|
1682
|
+
r5()
|
|
1683
|
+
], DictationRoot.prototype, "_devices", void 0);
|
|
1684
|
+
__decorate([
|
|
1294
1685
|
n4({ attribute: false, type: Array })
|
|
1295
|
-
],
|
|
1686
|
+
], DictationRoot.prototype, "devices", null);
|
|
1296
1687
|
__decorate([
|
|
1297
1688
|
e9({ context: selectedDeviceContext }),
|
|
1298
1689
|
n4({ attribute: false, type: Object })
|
|
1299
|
-
],
|
|
1690
|
+
], DictationRoot.prototype, "selectedDevice", void 0);
|
|
1300
1691
|
__decorate([
|
|
1301
1692
|
e9({ context: debugDisplayAudioContext }),
|
|
1302
1693
|
n4({ attribute: "debug-display-audio", type: Boolean })
|
|
1303
|
-
],
|
|
1694
|
+
], DictationRoot.prototype, "debug_displayAudio", void 0);
|
|
1695
|
+
__decorate([
|
|
1696
|
+
e9({ context: modeContext }),
|
|
1697
|
+
n4({ type: String })
|
|
1698
|
+
], DictationRoot.prototype, "mode", void 0);
|
|
1699
|
+
__decorate([
|
|
1700
|
+
e9({ context: keybindingContext }),
|
|
1701
|
+
n4({ type: String })
|
|
1702
|
+
], DictationRoot.prototype, "keybinding", void 0);
|
|
1304
1703
|
__decorate([
|
|
1305
1704
|
n4({ type: Boolean })
|
|
1306
|
-
],
|
|
1307
|
-
|
|
1308
|
-
t3("dictation-
|
|
1309
|
-
],
|
|
1705
|
+
], DictationRoot.prototype, "noWrapper", void 0);
|
|
1706
|
+
DictationRoot = __decorate([
|
|
1707
|
+
t3("dictation-root")
|
|
1708
|
+
], DictationRoot);
|
|
1310
1709
|
|
|
1311
1710
|
// node_modules/@corti/sdk/dist/esm/core/json.mjs
|
|
1312
1711
|
var toJson = (value, replacer, space) => {
|
|
@@ -5839,7 +6238,7 @@ var Auth = class {
|
|
|
5839
6238
|
function getEnvironment(environment = "eu") {
|
|
5840
6239
|
return typeof environment === "string" ? {
|
|
5841
6240
|
base: `https://api.${environment}.corti.app/v2`,
|
|
5842
|
-
wss: `wss://api.${environment}.corti.app`,
|
|
6241
|
+
wss: `wss://api.${environment}.corti.app/audio-bridge/v2`,
|
|
5843
6242
|
login: `https://auth.${environment}.corti.app/realms`,
|
|
5844
6243
|
agents: `https://api.${environment}.corti.app`
|
|
5845
6244
|
} : environment;
|
|
@@ -10053,7 +10452,7 @@ var Stream = class {
|
|
|
10053
10452
|
_queryParams["token"] = token;
|
|
10054
10453
|
let _headers = Object.assign({}, headers);
|
|
10055
10454
|
const socket = new ReconnectingWebSocket({
|
|
10056
|
-
url: url_exports.join((_a = yield Supplier.get(this._options["baseUrl"])) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options["environment"])).wss, `/
|
|
10455
|
+
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`),
|
|
10057
10456
|
protocols: [],
|
|
10058
10457
|
queryParameters: _queryParams,
|
|
10059
10458
|
headers: _headers,
|
|
@@ -10432,7 +10831,7 @@ var Transcribe = class {
|
|
|
10432
10831
|
_queryParams["token"] = token;
|
|
10433
10832
|
let _headers = Object.assign({}, headers);
|
|
10434
10833
|
const socket = new ReconnectingWebSocket({
|
|
10435
|
-
url: url_exports.join((_a = yield Supplier.get(this._options["baseUrl"])) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options["environment"])).wss, "/
|
|
10834
|
+
url: url_exports.join((_a = yield Supplier.get(this._options["baseUrl"])) !== null && _a !== void 0 ? _a : (yield Supplier.get(this._options["environment"])).wss, "/transcribe"),
|
|
10436
10835
|
protocols: [],
|
|
10437
10836
|
queryParameters: _queryParams,
|
|
10438
10837
|
headers: _headers,
|
|
@@ -10595,7 +10994,7 @@ var Transcribe2 = class extends Transcribe {
|
|
|
10595
10994
|
};
|
|
10596
10995
|
|
|
10597
10996
|
// node_modules/@corti/sdk/dist/esm/version.mjs
|
|
10598
|
-
var SDK_VERSION = "0.8.0
|
|
10997
|
+
var SDK_VERSION = "0.8.0";
|
|
10599
10998
|
|
|
10600
10999
|
// node_modules/@corti/sdk/dist/esm/custom/utils/resolveClientOptions.mjs
|
|
10601
11000
|
var __awaiter30 = function(thisArg, _arguments, P2, generator) {
|
|
@@ -10801,13 +11200,13 @@ var CortiClient = class {
|
|
|
10801
11200
|
var CortiEnvironment = {
|
|
10802
11201
|
Eu: {
|
|
10803
11202
|
base: "https://api.eu.corti.app/v2",
|
|
10804
|
-
wss: "wss://api.eu.corti.app",
|
|
11203
|
+
wss: "wss://api.eu.corti.app/audio-bridge/v2",
|
|
10805
11204
|
login: "https://auth.eu.corti.app/realms",
|
|
10806
11205
|
agents: "https://api.eu.corti.app"
|
|
10807
11206
|
},
|
|
10808
11207
|
Us: {
|
|
10809
11208
|
base: "https://api.us.corti.app/v2",
|
|
10810
|
-
wss: "wss://api.us.corti.app",
|
|
11209
|
+
wss: "wss://api.us.corti.app/audio-bridge/v2",
|
|
10811
11210
|
login: "https://auth.us.corti.app/realms",
|
|
10812
11211
|
agents: "https://api.us.corti.app"
|
|
10813
11212
|
}
|
|
@@ -10851,11 +11250,41 @@ var CortiWebSocketProxyClient = class {
|
|
|
10851
11250
|
}
|
|
10852
11251
|
};
|
|
10853
11252
|
|
|
10854
|
-
// dist/controllers/
|
|
11253
|
+
// dist/controllers/dictation-controller.js
|
|
11254
|
+
var __classPrivateFieldGet4 = function(receiver, state, kind, f5) {
|
|
11255
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
11256
|
+
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");
|
|
11257
|
+
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
11258
|
+
};
|
|
11259
|
+
var __classPrivateFieldSet3 = function(receiver, state, value, kind, f5) {
|
|
11260
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
11261
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a setter");
|
|
11262
|
+
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");
|
|
11263
|
+
return kind === "a" ? f5.call(receiver, value) : f5 ? f5.value = value : state.set(receiver, value), value;
|
|
11264
|
+
};
|
|
11265
|
+
var _DictationController_instances;
|
|
11266
|
+
var _DictationController_cortiClient;
|
|
11267
|
+
var _DictationController_webSocket;
|
|
11268
|
+
var _DictationController_closeTimeout;
|
|
11269
|
+
var _DictationController_callbacks;
|
|
11270
|
+
var _DictationController_lastDictationConfig;
|
|
11271
|
+
var _DictationController_lastSocketUrl;
|
|
11272
|
+
var _DictationController_lastSocketProxy;
|
|
11273
|
+
var _DictationController_configHasChanged;
|
|
11274
|
+
var _DictationController_connectProxy;
|
|
11275
|
+
var _DictationController_connectAuth;
|
|
11276
|
+
var _DictationController_setupWebSocketHandlers;
|
|
11277
|
+
var _DictationController_setupMediaRecorder;
|
|
10855
11278
|
var DictationController = class {
|
|
10856
11279
|
constructor(host) {
|
|
10857
|
-
this
|
|
10858
|
-
this
|
|
11280
|
+
_DictationController_instances.add(this);
|
|
11281
|
+
_DictationController_cortiClient.set(this, null);
|
|
11282
|
+
_DictationController_webSocket.set(this, null);
|
|
11283
|
+
_DictationController_closeTimeout.set(this, void 0);
|
|
11284
|
+
_DictationController_callbacks.set(this, void 0);
|
|
11285
|
+
_DictationController_lastDictationConfig.set(this, null);
|
|
11286
|
+
_DictationController_lastSocketUrl.set(this, void 0);
|
|
11287
|
+
_DictationController_lastSocketProxy.set(this, void 0);
|
|
10859
11288
|
this.host = host;
|
|
10860
11289
|
host.addController(this);
|
|
10861
11290
|
}
|
|
@@ -10866,112 +11295,223 @@ var DictationController = class {
|
|
|
10866
11295
|
if (!mediaRecorder) {
|
|
10867
11296
|
throw new Error("MediaRecorder is required to connect");
|
|
10868
11297
|
}
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
11298
|
+
const newConnection = __classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_configHasChanged).call(this) || __classPrivateFieldGet4(this, _DictationController_webSocket, "f")?.readyState !== WebSocket.OPEN;
|
|
11299
|
+
if (newConnection) {
|
|
11300
|
+
this.cleanup();
|
|
11301
|
+
if (__classPrivateFieldGet4(this, _DictationController_webSocket, "f")?.readyState === WebSocket.OPEN) {
|
|
11302
|
+
throw new Error("Already connected. Disconnect before reconnecting.");
|
|
11303
|
+
}
|
|
11304
|
+
__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");
|
|
11305
|
+
__classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onNetworkActivity?.("sent", {
|
|
11306
|
+
configuration: dictationConfig,
|
|
11307
|
+
type: "config"
|
|
11308
|
+
});
|
|
11309
|
+
__classPrivateFieldSet3(this, _DictationController_lastDictationConfig, this.host._dictationConfig || null, "f");
|
|
11310
|
+
__classPrivateFieldSet3(this, _DictationController_lastSocketUrl, this.host._socketUrl, "f");
|
|
11311
|
+
__classPrivateFieldSet3(this, _DictationController_lastSocketProxy, this.host._socketProxy, "f");
|
|
10883
11312
|
}
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
}
|
|
10889
|
-
async connectAuth(dictationConfig) {
|
|
10890
|
-
if (!this.host._authConfig && !this.host._accessToken) {
|
|
10891
|
-
throw new Error("Auth configuration or access token is required to connect");
|
|
10892
|
-
}
|
|
10893
|
-
const auth = this.host._authConfig || {
|
|
10894
|
-
accessToken: this.host._accessToken || "",
|
|
10895
|
-
refreshAccessToken: () => ({
|
|
10896
|
-
accessToken: this.host._accessToken || ""
|
|
10897
|
-
})
|
|
10898
|
-
};
|
|
10899
|
-
this._cortiClient = new CortiClient({
|
|
10900
|
-
auth,
|
|
10901
|
-
environment: this.host._region,
|
|
10902
|
-
tenantName: this.host._tenantName
|
|
10903
|
-
});
|
|
10904
|
-
return await this._cortiClient.transcribe.connect({
|
|
10905
|
-
configuration: dictationConfig
|
|
10906
|
-
});
|
|
10907
|
-
}
|
|
10908
|
-
setupWebSocketHandlers(callbacks) {
|
|
10909
|
-
if (!this._webSocket) {
|
|
10910
|
-
throw new Error("WebSocket not initialized");
|
|
10911
|
-
}
|
|
10912
|
-
this._webSocket.on("message", (message) => {
|
|
10913
|
-
this._onNetworkActivity?.("received", message);
|
|
10914
|
-
if (callbacks.onMessage) {
|
|
10915
|
-
callbacks.onMessage(message);
|
|
10916
|
-
}
|
|
10917
|
-
});
|
|
10918
|
-
this._webSocket.on("error", (event) => {
|
|
10919
|
-
if (callbacks.onError) {
|
|
10920
|
-
callbacks.onError(event);
|
|
10921
|
-
}
|
|
10922
|
-
});
|
|
10923
|
-
this._webSocket.on("close", (event) => {
|
|
10924
|
-
if (callbacks.onClose) {
|
|
10925
|
-
callbacks.onClose(event);
|
|
10926
|
-
}
|
|
10927
|
-
});
|
|
10928
|
-
}
|
|
10929
|
-
setupMediaRecorder(mediaRecorder) {
|
|
10930
|
-
mediaRecorder.ondataavailable = (event) => {
|
|
10931
|
-
this._webSocket?.sendAudio(event.data);
|
|
10932
|
-
this._onNetworkActivity?.("sent", {
|
|
10933
|
-
size: event.data.size,
|
|
10934
|
-
type: "audio"
|
|
10935
|
-
});
|
|
10936
|
-
};
|
|
11313
|
+
__classPrivateFieldSet3(this, _DictationController_callbacks, callbacks, "f");
|
|
11314
|
+
__classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_setupMediaRecorder).call(this, mediaRecorder);
|
|
11315
|
+
__classPrivateFieldGet4(this, _DictationController_instances, "m", _DictationController_setupWebSocketHandlers).call(this, callbacks);
|
|
11316
|
+
return newConnection;
|
|
10937
11317
|
}
|
|
10938
11318
|
async disconnect(onClose) {
|
|
10939
11319
|
await new Promise((resolve, reject) => {
|
|
10940
|
-
if (!this
|
|
11320
|
+
if (!__classPrivateFieldGet4(this, _DictationController_webSocket, "f") || __classPrivateFieldGet4(this, _DictationController_webSocket, "f").readyState !== WebSocket.OPEN) {
|
|
10941
11321
|
resolve();
|
|
10942
11322
|
return;
|
|
10943
11323
|
}
|
|
10944
|
-
this.
|
|
10945
|
-
if (this
|
|
10946
|
-
clearTimeout(this
|
|
10947
|
-
this
|
|
11324
|
+
__classPrivateFieldGet4(this, _DictationController_webSocket, "f").on("close", (event) => {
|
|
11325
|
+
if (__classPrivateFieldGet4(this, _DictationController_closeTimeout, "f")) {
|
|
11326
|
+
clearTimeout(__classPrivateFieldGet4(this, _DictationController_closeTimeout, "f"));
|
|
11327
|
+
__classPrivateFieldSet3(this, _DictationController_closeTimeout, void 0, "f");
|
|
10948
11328
|
}
|
|
10949
11329
|
if (onClose) {
|
|
10950
11330
|
onClose(event);
|
|
10951
11331
|
}
|
|
10952
11332
|
resolve();
|
|
10953
11333
|
});
|
|
10954
|
-
this
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
|
|
11334
|
+
__classPrivateFieldGet4(this, _DictationController_webSocket, "f").on("message", (message) => {
|
|
11335
|
+
__classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onNetworkActivity?.("received", message);
|
|
11336
|
+
if (__classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onMessage) {
|
|
11337
|
+
__classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onMessage(message);
|
|
11338
|
+
}
|
|
11339
|
+
if (message.type === "flushed") {
|
|
11340
|
+
if (__classPrivateFieldGet4(this, _DictationController_closeTimeout, "f")) {
|
|
11341
|
+
clearTimeout(__classPrivateFieldGet4(this, _DictationController_closeTimeout, "f"));
|
|
11342
|
+
__classPrivateFieldSet3(this, _DictationController_closeTimeout, void 0, "f");
|
|
11343
|
+
}
|
|
11344
|
+
resolve();
|
|
11345
|
+
return;
|
|
11346
|
+
}
|
|
11347
|
+
});
|
|
11348
|
+
__classPrivateFieldGet4(this, _DictationController_webSocket, "f").sendFlush({ type: "flush" });
|
|
11349
|
+
__classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onNetworkActivity?.("sent", { type: "flush" });
|
|
11350
|
+
__classPrivateFieldSet3(this, _DictationController_closeTimeout, window.setTimeout(() => {
|
|
11351
|
+
reject(new Error("Audio processing timeout"));
|
|
11352
|
+
if (__classPrivateFieldGet4(this, _DictationController_webSocket, "f")?.readyState === WebSocket.OPEN) {
|
|
11353
|
+
__classPrivateFieldGet4(this, _DictationController_webSocket, "f").close();
|
|
10960
11354
|
}
|
|
10961
|
-
}, 1e4);
|
|
11355
|
+
}, 1e4), "f");
|
|
10962
11356
|
});
|
|
10963
|
-
this.cleanup();
|
|
10964
11357
|
}
|
|
10965
11358
|
cleanup() {
|
|
10966
|
-
if (this
|
|
10967
|
-
clearTimeout(this
|
|
10968
|
-
this
|
|
11359
|
+
if (__classPrivateFieldGet4(this, _DictationController_closeTimeout, "f")) {
|
|
11360
|
+
clearTimeout(__classPrivateFieldGet4(this, _DictationController_closeTimeout, "f"));
|
|
11361
|
+
__classPrivateFieldSet3(this, _DictationController_closeTimeout, void 0, "f");
|
|
10969
11362
|
}
|
|
10970
|
-
if (this
|
|
10971
|
-
this.
|
|
11363
|
+
if (__classPrivateFieldGet4(this, _DictationController_webSocket, "f")?.readyState === WebSocket.OPEN) {
|
|
11364
|
+
__classPrivateFieldGet4(this, _DictationController_webSocket, "f").close();
|
|
10972
11365
|
}
|
|
10973
|
-
this
|
|
10974
|
-
this
|
|
11366
|
+
__classPrivateFieldSet3(this, _DictationController_webSocket, null, "f");
|
|
11367
|
+
__classPrivateFieldSet3(this, _DictationController_cortiClient, null, "f");
|
|
11368
|
+
__classPrivateFieldSet3(this, _DictationController_lastDictationConfig, null, "f");
|
|
11369
|
+
__classPrivateFieldSet3(this, _DictationController_lastSocketUrl, void 0, "f");
|
|
11370
|
+
__classPrivateFieldSet3(this, _DictationController_lastSocketProxy, void 0, "f");
|
|
11371
|
+
}
|
|
11372
|
+
};
|
|
11373
|
+
_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() {
|
|
11374
|
+
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"));
|
|
11375
|
+
}, _DictationController_connectProxy = async function _DictationController_connectProxy2(dictationConfig) {
|
|
11376
|
+
const proxyOptions = this.host._socketProxy || {
|
|
11377
|
+
url: this.host._socketUrl || ""
|
|
11378
|
+
};
|
|
11379
|
+
if (!proxyOptions.url) {
|
|
11380
|
+
throw new Error("Proxy URL is required when using proxy client");
|
|
11381
|
+
}
|
|
11382
|
+
return await CortiWebSocketProxyClient.transcribe.connect({
|
|
11383
|
+
configuration: dictationConfig,
|
|
11384
|
+
proxy: proxyOptions
|
|
11385
|
+
});
|
|
11386
|
+
}, _DictationController_connectAuth = async function _DictationController_connectAuth2(dictationConfig) {
|
|
11387
|
+
if (!this.host._authConfig && !this.host._accessToken) {
|
|
11388
|
+
throw new Error("Auth configuration or access token is required to connect");
|
|
11389
|
+
}
|
|
11390
|
+
const auth = this.host._authConfig || {
|
|
11391
|
+
accessToken: this.host._accessToken || "",
|
|
11392
|
+
refreshAccessToken: () => ({
|
|
11393
|
+
accessToken: this.host._accessToken || ""
|
|
11394
|
+
})
|
|
11395
|
+
};
|
|
11396
|
+
__classPrivateFieldSet3(this, _DictationController_cortiClient, new CortiClient({
|
|
11397
|
+
auth,
|
|
11398
|
+
environment: this.host._region,
|
|
11399
|
+
tenantName: this.host._tenantName
|
|
11400
|
+
}), "f");
|
|
11401
|
+
return await __classPrivateFieldGet4(this, _DictationController_cortiClient, "f").transcribe.connect({
|
|
11402
|
+
configuration: dictationConfig
|
|
11403
|
+
});
|
|
11404
|
+
}, _DictationController_setupWebSocketHandlers = function _DictationController_setupWebSocketHandlers2(callbacks) {
|
|
11405
|
+
if (!__classPrivateFieldGet4(this, _DictationController_webSocket, "f")) {
|
|
11406
|
+
throw new Error("WebSocket not initialized");
|
|
11407
|
+
}
|
|
11408
|
+
__classPrivateFieldGet4(this, _DictationController_webSocket, "f").on("message", (message) => {
|
|
11409
|
+
callbacks.onNetworkActivity?.("received", message);
|
|
11410
|
+
if (callbacks.onMessage) {
|
|
11411
|
+
callbacks.onMessage(message);
|
|
11412
|
+
}
|
|
11413
|
+
});
|
|
11414
|
+
__classPrivateFieldGet4(this, _DictationController_webSocket, "f").on("error", (event) => {
|
|
11415
|
+
if (callbacks.onError) {
|
|
11416
|
+
callbacks.onError(event);
|
|
11417
|
+
}
|
|
11418
|
+
});
|
|
11419
|
+
__classPrivateFieldGet4(this, _DictationController_webSocket, "f").on("close", (event) => {
|
|
11420
|
+
if (callbacks.onClose) {
|
|
11421
|
+
callbacks.onClose(event);
|
|
11422
|
+
}
|
|
11423
|
+
});
|
|
11424
|
+
}, _DictationController_setupMediaRecorder = function _DictationController_setupMediaRecorder2(mediaRecorder) {
|
|
11425
|
+
mediaRecorder.ondataavailable = (event) => {
|
|
11426
|
+
__classPrivateFieldGet4(this, _DictationController_webSocket, "f")?.sendAudio(event.data);
|
|
11427
|
+
__classPrivateFieldGet4(this, _DictationController_callbacks, "f")?.onNetworkActivity?.("sent", {
|
|
11428
|
+
size: event.data.size,
|
|
11429
|
+
type: "audio"
|
|
11430
|
+
});
|
|
11431
|
+
};
|
|
11432
|
+
};
|
|
11433
|
+
|
|
11434
|
+
// dist/controllers/keybinding-controller.js
|
|
11435
|
+
var __classPrivateFieldGet5 = function(receiver, state, kind, f5) {
|
|
11436
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
11437
|
+
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");
|
|
11438
|
+
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
11439
|
+
};
|
|
11440
|
+
var __classPrivateFieldSet4 = function(receiver, state, value, kind, f5) {
|
|
11441
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
11442
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a setter");
|
|
11443
|
+
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");
|
|
11444
|
+
return kind === "a" ? f5.call(receiver, value) : f5 ? f5.value = value : state.set(receiver, value), value;
|
|
11445
|
+
};
|
|
11446
|
+
var _KeybindingController_instances;
|
|
11447
|
+
var _KeybindingController_keydownHandler;
|
|
11448
|
+
var _KeybindingController_keyupHandler;
|
|
11449
|
+
var _KeybindingController_blurHandler;
|
|
11450
|
+
var _KeybindingController_setupListeners;
|
|
11451
|
+
var _KeybindingController_removeListeners;
|
|
11452
|
+
var KeybindingController = class {
|
|
11453
|
+
constructor(host) {
|
|
11454
|
+
_KeybindingController_instances.add(this);
|
|
11455
|
+
_KeybindingController_keydownHandler.set(this, void 0);
|
|
11456
|
+
_KeybindingController_keyupHandler.set(this, void 0);
|
|
11457
|
+
_KeybindingController_blurHandler.set(this, void 0);
|
|
11458
|
+
this.host = host;
|
|
11459
|
+
host.addController(this);
|
|
11460
|
+
}
|
|
11461
|
+
hostConnected() {
|
|
11462
|
+
__classPrivateFieldGet5(this, _KeybindingController_instances, "m", _KeybindingController_setupListeners).call(this);
|
|
11463
|
+
}
|
|
11464
|
+
hostDisconnected() {
|
|
11465
|
+
__classPrivateFieldGet5(this, _KeybindingController_instances, "m", _KeybindingController_removeListeners).call(this);
|
|
11466
|
+
}
|
|
11467
|
+
};
|
|
11468
|
+
_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() {
|
|
11469
|
+
__classPrivateFieldGet5(this, _KeybindingController_instances, "m", _KeybindingController_removeListeners).call(this);
|
|
11470
|
+
__classPrivateFieldSet4(this, _KeybindingController_keydownHandler, (event) => {
|
|
11471
|
+
if (!this.host._keybinding) {
|
|
11472
|
+
return;
|
|
11473
|
+
}
|
|
11474
|
+
if (shouldIgnoreKeybinding(document.activeElement)) {
|
|
11475
|
+
return;
|
|
11476
|
+
}
|
|
11477
|
+
if (matchesKeybinding(event, this.host._keybinding)) {
|
|
11478
|
+
event.preventDefault();
|
|
11479
|
+
if (this.host._mode === "push-to-talk") {
|
|
11480
|
+
this.host.startRecording();
|
|
11481
|
+
}
|
|
11482
|
+
if (this.host._mode === "toggle-to-talk") {
|
|
11483
|
+
this.host.toggleRecording();
|
|
11484
|
+
}
|
|
11485
|
+
}
|
|
11486
|
+
}, "f");
|
|
11487
|
+
__classPrivateFieldSet4(this, _KeybindingController_keyupHandler, (event) => {
|
|
11488
|
+
if (!this.host._keybinding) {
|
|
11489
|
+
return;
|
|
11490
|
+
}
|
|
11491
|
+
if (this.host._mode === "push-to-talk" && matchesKeybinding(event, this.host._keybinding)) {
|
|
11492
|
+
this.host.stopRecording();
|
|
11493
|
+
}
|
|
11494
|
+
}, "f");
|
|
11495
|
+
__classPrivateFieldSet4(this, _KeybindingController_blurHandler, () => {
|
|
11496
|
+
if (this.host._mode === "push-to-talk") {
|
|
11497
|
+
this.host.stopRecording();
|
|
11498
|
+
}
|
|
11499
|
+
}, "f");
|
|
11500
|
+
window.addEventListener("keydown", __classPrivateFieldGet5(this, _KeybindingController_keydownHandler, "f"));
|
|
11501
|
+
window.addEventListener("keyup", __classPrivateFieldGet5(this, _KeybindingController_keyupHandler, "f"));
|
|
11502
|
+
window.addEventListener("blur", __classPrivateFieldGet5(this, _KeybindingController_blurHandler, "f"));
|
|
11503
|
+
}, _KeybindingController_removeListeners = function _KeybindingController_removeListeners2() {
|
|
11504
|
+
if (__classPrivateFieldGet5(this, _KeybindingController_keydownHandler, "f")) {
|
|
11505
|
+
window.removeEventListener("keydown", __classPrivateFieldGet5(this, _KeybindingController_keydownHandler, "f"));
|
|
11506
|
+
__classPrivateFieldSet4(this, _KeybindingController_keydownHandler, void 0, "f");
|
|
11507
|
+
}
|
|
11508
|
+
if (__classPrivateFieldGet5(this, _KeybindingController_keyupHandler, "f")) {
|
|
11509
|
+
window.removeEventListener("keyup", __classPrivateFieldGet5(this, _KeybindingController_keyupHandler, "f"));
|
|
11510
|
+
__classPrivateFieldSet4(this, _KeybindingController_keyupHandler, void 0, "f");
|
|
11511
|
+
}
|
|
11512
|
+
if (__classPrivateFieldGet5(this, _KeybindingController_blurHandler, "f")) {
|
|
11513
|
+
window.removeEventListener("blur", __classPrivateFieldGet5(this, _KeybindingController_blurHandler, "f"));
|
|
11514
|
+
__classPrivateFieldSet4(this, _KeybindingController_blurHandler, void 0, "f");
|
|
10975
11515
|
}
|
|
10976
11516
|
};
|
|
10977
11517
|
|
|
@@ -11013,14 +11553,36 @@ function calculateAudioLevel(analyser) {
|
|
|
11013
11553
|
return Math.sqrt(sumSquares / dataArray.length);
|
|
11014
11554
|
}
|
|
11015
11555
|
|
|
11016
|
-
// dist/controllers/
|
|
11556
|
+
// dist/controllers/media-controller.js
|
|
11557
|
+
var __classPrivateFieldSet5 = function(receiver, state, value, kind, f5) {
|
|
11558
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
11559
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a setter");
|
|
11560
|
+
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");
|
|
11561
|
+
return kind === "a" ? f5.call(receiver, value) : f5 ? f5.value = value : state.set(receiver, value), value;
|
|
11562
|
+
};
|
|
11563
|
+
var __classPrivateFieldGet6 = function(receiver, state, kind, f5) {
|
|
11564
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
11565
|
+
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");
|
|
11566
|
+
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
11567
|
+
};
|
|
11568
|
+
var _MediaController_mediaStream;
|
|
11569
|
+
var _MediaController_audioContext;
|
|
11570
|
+
var _MediaController_analyser;
|
|
11571
|
+
var _MediaController_mediaRecorder;
|
|
11572
|
+
var _MediaController_visualiserInterval;
|
|
11573
|
+
var _MediaController_audioLevel;
|
|
11574
|
+
var _MediaController_onTrackEnded;
|
|
11575
|
+
var _MediaController_onAudioLevelChange;
|
|
11017
11576
|
var MediaController = class {
|
|
11018
11577
|
constructor(host) {
|
|
11019
|
-
this
|
|
11020
|
-
this
|
|
11021
|
-
this
|
|
11022
|
-
this
|
|
11023
|
-
this
|
|
11578
|
+
_MediaController_mediaStream.set(this, null);
|
|
11579
|
+
_MediaController_audioContext.set(this, null);
|
|
11580
|
+
_MediaController_analyser.set(this, null);
|
|
11581
|
+
_MediaController_mediaRecorder.set(this, null);
|
|
11582
|
+
_MediaController_visualiserInterval.set(this, void 0);
|
|
11583
|
+
_MediaController_audioLevel.set(this, 0);
|
|
11584
|
+
_MediaController_onTrackEnded.set(this, void 0);
|
|
11585
|
+
_MediaController_onAudioLevelChange.set(this, void 0);
|
|
11024
11586
|
this.host = host;
|
|
11025
11587
|
host.addController(this);
|
|
11026
11588
|
}
|
|
@@ -11029,64 +11591,64 @@ var MediaController = class {
|
|
|
11029
11591
|
}
|
|
11030
11592
|
async initialize(onTrackEnded) {
|
|
11031
11593
|
await this.cleanup();
|
|
11032
|
-
this
|
|
11033
|
-
this
|
|
11034
|
-
this.
|
|
11594
|
+
__classPrivateFieldSet5(this, _MediaController_onTrackEnded, onTrackEnded, "f");
|
|
11595
|
+
__classPrivateFieldSet5(this, _MediaController_mediaStream, await getMediaStream(this.host._selectedDevice?.deviceId, this.host._debug_displayAudio), "f");
|
|
11596
|
+
__classPrivateFieldGet6(this, _MediaController_mediaStream, "f").getTracks().forEach((track) => {
|
|
11035
11597
|
track.addEventListener("ended", () => {
|
|
11036
|
-
if (this
|
|
11037
|
-
this.
|
|
11598
|
+
if (__classPrivateFieldGet6(this, _MediaController_onTrackEnded, "f")) {
|
|
11599
|
+
__classPrivateFieldGet6(this, _MediaController_onTrackEnded, "f").call(this);
|
|
11038
11600
|
}
|
|
11039
11601
|
});
|
|
11040
11602
|
});
|
|
11041
|
-
const { audioContext, analyser } = createAudioAnalyzer(this
|
|
11042
|
-
this
|
|
11043
|
-
this
|
|
11044
|
-
this
|
|
11603
|
+
const { audioContext, analyser } = createAudioAnalyzer(__classPrivateFieldGet6(this, _MediaController_mediaStream, "f"));
|
|
11604
|
+
__classPrivateFieldSet5(this, _MediaController_audioContext, audioContext, "f");
|
|
11605
|
+
__classPrivateFieldSet5(this, _MediaController_analyser, analyser, "f");
|
|
11606
|
+
__classPrivateFieldSet5(this, _MediaController_mediaRecorder, new MediaRecorder(__classPrivateFieldGet6(this, _MediaController_mediaStream, "f")), "f");
|
|
11045
11607
|
}
|
|
11046
11608
|
getAudioLevel() {
|
|
11047
|
-
return this
|
|
11609
|
+
return __classPrivateFieldGet6(this, _MediaController_analyser, "f") ? calculateAudioLevel(__classPrivateFieldGet6(this, _MediaController_analyser, "f")) : 0;
|
|
11048
11610
|
}
|
|
11049
11611
|
startAudioLevelMonitoring(onAudioLevelChange) {
|
|
11050
11612
|
this.stopAudioLevelMonitoring();
|
|
11051
|
-
this
|
|
11052
|
-
this
|
|
11053
|
-
this
|
|
11613
|
+
__classPrivateFieldSet5(this, _MediaController_onAudioLevelChange, onAudioLevelChange, "f");
|
|
11614
|
+
__classPrivateFieldSet5(this, _MediaController_visualiserInterval, window.setInterval(() => {
|
|
11615
|
+
__classPrivateFieldSet5(this, _MediaController_audioLevel, this.getAudioLevel() * 3, "f");
|
|
11054
11616
|
this.host.requestUpdate();
|
|
11055
|
-
if (this
|
|
11056
|
-
this.
|
|
11617
|
+
if (__classPrivateFieldGet6(this, _MediaController_onAudioLevelChange, "f")) {
|
|
11618
|
+
__classPrivateFieldGet6(this, _MediaController_onAudioLevelChange, "f").call(this, __classPrivateFieldGet6(this, _MediaController_audioLevel, "f"));
|
|
11057
11619
|
}
|
|
11058
|
-
}, 150);
|
|
11620
|
+
}, 150), "f");
|
|
11059
11621
|
}
|
|
11060
11622
|
stopAudioLevelMonitoring() {
|
|
11061
|
-
if (this
|
|
11062
|
-
clearInterval(this
|
|
11063
|
-
this
|
|
11623
|
+
if (__classPrivateFieldGet6(this, _MediaController_visualiserInterval, "f")) {
|
|
11624
|
+
clearInterval(__classPrivateFieldGet6(this, _MediaController_visualiserInterval, "f"));
|
|
11625
|
+
__classPrivateFieldSet5(this, _MediaController_visualiserInterval, void 0, "f");
|
|
11064
11626
|
}
|
|
11065
|
-
this
|
|
11627
|
+
__classPrivateFieldSet5(this, _MediaController_audioLevel, 0, "f");
|
|
11066
11628
|
this.host.requestUpdate();
|
|
11067
|
-
if (this
|
|
11068
|
-
this.
|
|
11629
|
+
if (__classPrivateFieldGet6(this, _MediaController_onAudioLevelChange, "f")) {
|
|
11630
|
+
__classPrivateFieldGet6(this, _MediaController_onAudioLevelChange, "f").call(this, __classPrivateFieldGet6(this, _MediaController_audioLevel, "f"));
|
|
11069
11631
|
}
|
|
11070
11632
|
}
|
|
11071
11633
|
async cleanup() {
|
|
11072
11634
|
this.stopAudioLevelMonitoring();
|
|
11073
|
-
if (this
|
|
11074
|
-
this.
|
|
11635
|
+
if (__classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f")?.state === "recording") {
|
|
11636
|
+
__classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f").stop();
|
|
11075
11637
|
}
|
|
11076
|
-
if (this
|
|
11077
|
-
this.
|
|
11638
|
+
if (__classPrivateFieldGet6(this, _MediaController_mediaStream, "f")) {
|
|
11639
|
+
__classPrivateFieldGet6(this, _MediaController_mediaStream, "f").getTracks().forEach((track) => {
|
|
11078
11640
|
track.stop();
|
|
11079
11641
|
});
|
|
11080
|
-
this
|
|
11642
|
+
__classPrivateFieldSet5(this, _MediaController_mediaStream, null, "f");
|
|
11081
11643
|
}
|
|
11082
|
-
if (this
|
|
11083
|
-
await this.
|
|
11644
|
+
if (__classPrivateFieldGet6(this, _MediaController_audioContext, "f") && __classPrivateFieldGet6(this, _MediaController_audioContext, "f").state !== "closed") {
|
|
11645
|
+
await __classPrivateFieldGet6(this, _MediaController_audioContext, "f").close();
|
|
11084
11646
|
}
|
|
11085
|
-
this
|
|
11086
|
-
this
|
|
11087
|
-
this
|
|
11088
|
-
this
|
|
11089
|
-
this
|
|
11647
|
+
__classPrivateFieldSet5(this, _MediaController_audioContext, null, "f");
|
|
11648
|
+
__classPrivateFieldSet5(this, _MediaController_analyser, null, "f");
|
|
11649
|
+
__classPrivateFieldSet5(this, _MediaController_mediaRecorder, null, "f");
|
|
11650
|
+
__classPrivateFieldSet5(this, _MediaController_onTrackEnded, void 0, "f");
|
|
11651
|
+
__classPrivateFieldSet5(this, _MediaController_onAudioLevelChange, void 0, "f");
|
|
11090
11652
|
}
|
|
11091
11653
|
/**
|
|
11092
11654
|
* Stops the media recorder and waits for all buffered data to be flushed.
|
|
@@ -11094,23 +11656,24 @@ var MediaController = class {
|
|
|
11094
11656
|
*/
|
|
11095
11657
|
async stopRecording() {
|
|
11096
11658
|
return new Promise((resolve) => {
|
|
11097
|
-
if (!this
|
|
11659
|
+
if (!__classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f") || __classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f").state !== "recording") {
|
|
11098
11660
|
resolve();
|
|
11099
11661
|
return;
|
|
11100
11662
|
}
|
|
11101
|
-
this.
|
|
11663
|
+
__classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f").onstop = () => {
|
|
11102
11664
|
resolve();
|
|
11103
11665
|
};
|
|
11104
|
-
this.
|
|
11666
|
+
__classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f").stop();
|
|
11105
11667
|
});
|
|
11106
11668
|
}
|
|
11107
11669
|
get mediaRecorder() {
|
|
11108
|
-
return this
|
|
11670
|
+
return __classPrivateFieldGet6(this, _MediaController_mediaRecorder, "f");
|
|
11109
11671
|
}
|
|
11110
11672
|
get audioLevel() {
|
|
11111
|
-
return this
|
|
11673
|
+
return __classPrivateFieldGet6(this, _MediaController_audioLevel, "f");
|
|
11112
11674
|
}
|
|
11113
11675
|
};
|
|
11676
|
+
_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();
|
|
11114
11677
|
|
|
11115
11678
|
// dist/styles/buttons.js
|
|
11116
11679
|
var ButtonStyles = i`
|
|
@@ -11128,7 +11691,6 @@ var ButtonStyles = i`
|
|
|
11128
11691
|
align-items: center;
|
|
11129
11692
|
justify-content: center;
|
|
11130
11693
|
transition: background 0.3s ease;
|
|
11131
|
-
font-family: var(--component-font-family, -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, Cantarell, Ubuntu, roboto, noto, helvetica, arial, sans-serif);
|
|
11132
11694
|
}
|
|
11133
11695
|
|
|
11134
11696
|
button:hover {
|
|
@@ -11235,12 +11797,12 @@ var __decorate2 = function(decorators, target, key, desc) {
|
|
|
11235
11797
|
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;
|
|
11236
11798
|
return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
|
|
11237
11799
|
};
|
|
11238
|
-
var
|
|
11239
|
-
var AudioVisualiser = class AudioVisualiser2 extends i4 {
|
|
11800
|
+
var DictationAudioVisualiser = class DictationAudioVisualiser2 extends i4 {
|
|
11240
11801
|
constructor() {
|
|
11241
11802
|
super(...arguments);
|
|
11242
11803
|
this.level = 0;
|
|
11243
11804
|
this.active = false;
|
|
11805
|
+
this.segmentCount = 5;
|
|
11244
11806
|
}
|
|
11245
11807
|
willUpdate(changedProperties) {
|
|
11246
11808
|
if (changedProperties.has("level")) {
|
|
@@ -11248,11 +11810,11 @@ var AudioVisualiser = class AudioVisualiser2 extends i4 {
|
|
|
11248
11810
|
}
|
|
11249
11811
|
}
|
|
11250
11812
|
render() {
|
|
11251
|
-
const activeSegments = Math.round(this.level *
|
|
11252
|
-
const segments = o8(o9(
|
|
11813
|
+
const activeSegments = Math.round(this.level * this.segmentCount);
|
|
11814
|
+
const segments = o8(o9(this.segmentCount), (i7) => x`<div class=${e6({
|
|
11253
11815
|
active: i7 < activeSegments,
|
|
11254
11816
|
segment: true
|
|
11255
|
-
})}
|
|
11817
|
+
})} />`);
|
|
11256
11818
|
return x`
|
|
11257
11819
|
<div class=${e6({
|
|
11258
11820
|
active: this.active,
|
|
@@ -11263,16 +11825,19 @@ var AudioVisualiser = class AudioVisualiser2 extends i4 {
|
|
|
11263
11825
|
`;
|
|
11264
11826
|
}
|
|
11265
11827
|
};
|
|
11266
|
-
|
|
11828
|
+
DictationAudioVisualiser.styles = audio_visualiser_default;
|
|
11267
11829
|
__decorate2([
|
|
11268
11830
|
n4({ type: Number })
|
|
11269
|
-
],
|
|
11831
|
+
], DictationAudioVisualiser.prototype, "level", void 0);
|
|
11270
11832
|
__decorate2([
|
|
11271
11833
|
n4({ type: Boolean })
|
|
11272
|
-
],
|
|
11273
|
-
|
|
11274
|
-
|
|
11275
|
-
],
|
|
11834
|
+
], DictationAudioVisualiser.prototype, "active", void 0);
|
|
11835
|
+
__decorate2([
|
|
11836
|
+
n4({ type: Number })
|
|
11837
|
+
], DictationAudioVisualiser.prototype, "segmentCount", void 0);
|
|
11838
|
+
DictationAudioVisualiser = __decorate2([
|
|
11839
|
+
t3("dictation-audio-visualiser")
|
|
11840
|
+
], DictationAudioVisualiser);
|
|
11276
11841
|
|
|
11277
11842
|
// dist/icons/icons.js
|
|
11278
11843
|
var __decorate3 = function(decorators, target, key, desc) {
|
|
@@ -11432,29 +11997,48 @@ var __decorate4 = function(decorators, target, key, desc) {
|
|
|
11432
11997
|
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;
|
|
11433
11998
|
return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
|
|
11434
11999
|
};
|
|
11435
|
-
var
|
|
12000
|
+
var __classPrivateFieldGet7 = function(receiver, state, kind, f5) {
|
|
12001
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
12002
|
+
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");
|
|
12003
|
+
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
12004
|
+
};
|
|
12005
|
+
var _DictationRecordingButton_instances;
|
|
12006
|
+
var _DictationRecordingButton_mediaController;
|
|
12007
|
+
var _DictationRecordingButton_dictationController;
|
|
12008
|
+
var _DictationRecordingButton_keybindingController;
|
|
12009
|
+
var _DictationRecordingButton_handleMouseDown;
|
|
12010
|
+
var _DictationRecordingButton_handleMouseUp;
|
|
12011
|
+
var _DictationRecordingButton_handleMouseLeave;
|
|
12012
|
+
var _DictationRecordingButton_handleWebSocketMessage;
|
|
12013
|
+
var _DictationRecordingButton_handleWebSocketError;
|
|
12014
|
+
var _DictationRecordingButton_handleWebSocketClose;
|
|
12015
|
+
var _DictationRecordingButton_handleStart;
|
|
12016
|
+
var _DictationRecordingButton_handleStop;
|
|
12017
|
+
var DictationRecordingButton = class DictationRecordingButton2 extends i4 {
|
|
11436
12018
|
constructor() {
|
|
11437
12019
|
super(...arguments);
|
|
12020
|
+
_DictationRecordingButton_instances.add(this);
|
|
11438
12021
|
this._recordingState = "stopped";
|
|
11439
|
-
this.
|
|
11440
|
-
this
|
|
11441
|
-
this
|
|
11442
|
-
this
|
|
12022
|
+
this.allowButtonFocus = false;
|
|
12023
|
+
_DictationRecordingButton_mediaController.set(this, new MediaController(this));
|
|
12024
|
+
_DictationRecordingButton_dictationController.set(this, new DictationController(this));
|
|
12025
|
+
_DictationRecordingButton_keybindingController.set(this, new KeybindingController(this));
|
|
12026
|
+
_DictationRecordingButton_handleWebSocketMessage.set(this, (message) => {
|
|
11443
12027
|
switch (message.type) {
|
|
11444
12028
|
case "CONFIG_ACCEPTED":
|
|
11445
|
-
this.
|
|
11446
|
-
this.
|
|
12029
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").mediaRecorder?.start(AUDIO_CHUNK_INTERVAL_MS);
|
|
12030
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").startAudioLevelMonitoring((level) => {
|
|
11447
12031
|
this.dispatchEvent(audioLevelChangedEvent(level));
|
|
11448
12032
|
});
|
|
11449
12033
|
this.dispatchEvent(recordingStateChangedEvent("recording"));
|
|
11450
12034
|
break;
|
|
11451
12035
|
case "CONFIG_DENIED":
|
|
11452
12036
|
this.dispatchEvent(errorEvent(`Config denied: ${message.reason ?? "Unknown reason"}`));
|
|
11453
|
-
this.
|
|
12037
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
11454
12038
|
break;
|
|
11455
12039
|
case "CONFIG_TIMEOUT":
|
|
11456
12040
|
this.dispatchEvent(errorEvent("Config timeout"));
|
|
11457
|
-
this.
|
|
12041
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
11458
12042
|
break;
|
|
11459
12043
|
case "transcript":
|
|
11460
12044
|
this.dispatchEvent(transcriptEvent(message));
|
|
@@ -11467,147 +12051,194 @@ var RecordingButton = class RecordingButton2 extends i4 {
|
|
|
11467
12051
|
break;
|
|
11468
12052
|
case "error":
|
|
11469
12053
|
this.dispatchEvent(errorEvent(message.error));
|
|
11470
|
-
this.
|
|
12054
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
11471
12055
|
break;
|
|
11472
12056
|
}
|
|
11473
|
-
};
|
|
11474
|
-
this
|
|
12057
|
+
});
|
|
12058
|
+
_DictationRecordingButton_handleWebSocketError.set(this, (error) => {
|
|
11475
12059
|
this.dispatchEvent(errorEvent("Socket error: " + error.message));
|
|
11476
|
-
this.
|
|
11477
|
-
};
|
|
11478
|
-
this
|
|
12060
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
12061
|
+
});
|
|
12062
|
+
_DictationRecordingButton_handleWebSocketClose.set(this, (event) => {
|
|
11479
12063
|
this.dispatchEvent(streamClosedEvent(event));
|
|
11480
|
-
};
|
|
11481
|
-
}
|
|
11482
|
-
_handleMouseDown(event) {
|
|
11483
|
-
if (this.preventFocus) {
|
|
11484
|
-
event.preventDefault();
|
|
11485
|
-
}
|
|
11486
|
-
}
|
|
11487
|
-
async _handleStart() {
|
|
11488
|
-
this.dispatchEvent(recordingStateChangedEvent("initializing"));
|
|
11489
|
-
try {
|
|
11490
|
-
await this._mediaController.initialize(() => {
|
|
11491
|
-
if (this._recordingState === "recording") {
|
|
11492
|
-
this.dispatchEvent(errorEvent("Microphone access was lost."));
|
|
11493
|
-
this._handleStop();
|
|
11494
|
-
}
|
|
11495
|
-
});
|
|
11496
|
-
await this._dictationController.connect(this._mediaController.mediaRecorder, this._dictationConfig, {
|
|
11497
|
-
onClose: this._handleWebSocketClose,
|
|
11498
|
-
onError: this._handleWebSocketError,
|
|
11499
|
-
onMessage: this._handleWebSocketMessage,
|
|
11500
|
-
onNetworkActivity: (direction, data) => {
|
|
11501
|
-
this.dispatchEvent(networkActivityEvent(direction, data));
|
|
11502
|
-
}
|
|
11503
|
-
});
|
|
11504
|
-
} catch (error) {
|
|
11505
|
-
this.dispatchEvent(errorEvent(error));
|
|
11506
|
-
await this._handleStop();
|
|
11507
|
-
}
|
|
11508
|
-
}
|
|
11509
|
-
async _handleStop() {
|
|
11510
|
-
this.dispatchEvent(recordingStateChangedEvent("stopping"));
|
|
11511
|
-
try {
|
|
11512
|
-
this._mediaController.stopAudioLevelMonitoring();
|
|
11513
|
-
await this._mediaController.stopRecording();
|
|
11514
|
-
await this._dictationController.disconnect(this._handleWebSocketClose);
|
|
11515
|
-
await this._mediaController.cleanup();
|
|
11516
|
-
} catch (error) {
|
|
11517
|
-
this.dispatchEvent(errorEvent(error));
|
|
11518
|
-
}
|
|
11519
|
-
this.dispatchEvent(recordingStateChangedEvent("stopped"));
|
|
11520
|
-
}
|
|
11521
|
-
_handleClick() {
|
|
11522
|
-
if (this._recordingState === "stopped") {
|
|
11523
|
-
this._handleStart();
|
|
11524
|
-
} else if (this._recordingState === "recording") {
|
|
11525
|
-
this._handleStop();
|
|
11526
|
-
}
|
|
12064
|
+
});
|
|
11527
12065
|
}
|
|
11528
12066
|
startRecording() {
|
|
11529
12067
|
if (this._recordingState !== "stopped") {
|
|
11530
12068
|
return;
|
|
11531
12069
|
}
|
|
11532
|
-
this.
|
|
12070
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStart).call(this);
|
|
11533
12071
|
}
|
|
11534
12072
|
stopRecording() {
|
|
11535
|
-
if (this._recordingState
|
|
12073
|
+
if (this._recordingState === "stopped") {
|
|
11536
12074
|
return;
|
|
11537
12075
|
}
|
|
11538
|
-
this.
|
|
12076
|
+
if (this._recordingState === "initializing") {
|
|
12077
|
+
this.addEventListener("recording-state-changed", (event) => {
|
|
12078
|
+
if (event.detail.state === "recording") {
|
|
12079
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
12080
|
+
}
|
|
12081
|
+
}, {
|
|
12082
|
+
once: true
|
|
12083
|
+
});
|
|
12084
|
+
return;
|
|
12085
|
+
}
|
|
12086
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
11539
12087
|
}
|
|
11540
12088
|
toggleRecording() {
|
|
11541
|
-
this.
|
|
12089
|
+
if (this._recordingState === "stopped") {
|
|
12090
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStart).call(this);
|
|
12091
|
+
} else if (this._recordingState === "recording") {
|
|
12092
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
12093
|
+
}
|
|
11542
12094
|
}
|
|
11543
12095
|
render() {
|
|
11544
12096
|
const isLoading = this._recordingState === "initializing" || this._recordingState === "stopping";
|
|
11545
12097
|
const isRecording = this._recordingState === "recording";
|
|
11546
12098
|
return x`
|
|
11547
12099
|
<button
|
|
11548
|
-
@mousedown=${this
|
|
11549
|
-
@
|
|
12100
|
+
@mousedown=${__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleMouseDown)}
|
|
12101
|
+
@mouseup=${__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleMouseUp)}
|
|
12102
|
+
@mouseleave=${__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleMouseLeave)}
|
|
11550
12103
|
?disabled=${isLoading}
|
|
11551
12104
|
class=${isRecording ? "red" : "accent"}
|
|
11552
12105
|
aria-label=${isRecording ? "Stop recording" : "Start recording"}
|
|
11553
12106
|
aria-pressed=${isRecording}
|
|
11554
12107
|
>
|
|
11555
|
-
${isLoading ? x`<icon-loading-spinner
|
|
11556
|
-
<audio-visualiser
|
|
11557
|
-
.level=${this.
|
|
12108
|
+
${isLoading ? x`<icon-loading-spinner />` : isRecording ? x`<icon-recording />` : x`<icon-mic-on />`}
|
|
12109
|
+
<dictation-audio-visualiser
|
|
12110
|
+
.level=${__classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").audioLevel}
|
|
11558
12111
|
?active=${isRecording}
|
|
11559
|
-
|
|
12112
|
+
/>
|
|
11560
12113
|
</button>
|
|
11561
12114
|
`;
|
|
11562
12115
|
}
|
|
11563
12116
|
};
|
|
11564
|
-
|
|
12117
|
+
_DictationRecordingButton_mediaController = /* @__PURE__ */ new WeakMap();
|
|
12118
|
+
_DictationRecordingButton_dictationController = /* @__PURE__ */ new WeakMap();
|
|
12119
|
+
_DictationRecordingButton_keybindingController = /* @__PURE__ */ new WeakMap();
|
|
12120
|
+
_DictationRecordingButton_handleWebSocketMessage = /* @__PURE__ */ new WeakMap();
|
|
12121
|
+
_DictationRecordingButton_handleWebSocketError = /* @__PURE__ */ new WeakMap();
|
|
12122
|
+
_DictationRecordingButton_handleWebSocketClose = /* @__PURE__ */ new WeakMap();
|
|
12123
|
+
_DictationRecordingButton_instances = /* @__PURE__ */ new WeakSet();
|
|
12124
|
+
_DictationRecordingButton_handleMouseDown = function _DictationRecordingButton_handleMouseDown2(event) {
|
|
12125
|
+
if (!this.allowButtonFocus) {
|
|
12126
|
+
event.preventDefault();
|
|
12127
|
+
}
|
|
12128
|
+
if (this._mode === "push-to-talk") {
|
|
12129
|
+
this.startRecording();
|
|
12130
|
+
}
|
|
12131
|
+
};
|
|
12132
|
+
_DictationRecordingButton_handleMouseUp = function _DictationRecordingButton_handleMouseUp2() {
|
|
12133
|
+
if (this._mode === "push-to-talk") {
|
|
12134
|
+
this.stopRecording();
|
|
12135
|
+
return;
|
|
12136
|
+
}
|
|
12137
|
+
if (this._mode === "toggle-to-talk") {
|
|
12138
|
+
this.toggleRecording();
|
|
12139
|
+
}
|
|
12140
|
+
};
|
|
12141
|
+
_DictationRecordingButton_handleMouseLeave = function _DictationRecordingButton_handleMouseLeave2() {
|
|
12142
|
+
if (this._mode === "push-to-talk") {
|
|
12143
|
+
this.stopRecording();
|
|
12144
|
+
}
|
|
12145
|
+
};
|
|
12146
|
+
_DictationRecordingButton_handleStart = async function _DictationRecordingButton_handleStart2() {
|
|
12147
|
+
this.dispatchEvent(recordingStateChangedEvent("initializing"));
|
|
12148
|
+
try {
|
|
12149
|
+
await __classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").initialize(() => {
|
|
12150
|
+
if (this._recordingState === "recording") {
|
|
12151
|
+
this.dispatchEvent(errorEvent("Recording device access was lost."));
|
|
12152
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
12153
|
+
}
|
|
12154
|
+
});
|
|
12155
|
+
const isNewConnection = await __classPrivateFieldGet7(this, _DictationRecordingButton_dictationController, "f").connect(__classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").mediaRecorder, this._dictationConfig, {
|
|
12156
|
+
onClose: __classPrivateFieldGet7(this, _DictationRecordingButton_handleWebSocketClose, "f"),
|
|
12157
|
+
onError: __classPrivateFieldGet7(this, _DictationRecordingButton_handleWebSocketError, "f"),
|
|
12158
|
+
onMessage: __classPrivateFieldGet7(this, _DictationRecordingButton_handleWebSocketMessage, "f"),
|
|
12159
|
+
onNetworkActivity: (direction, data) => {
|
|
12160
|
+
this.dispatchEvent(networkActivityEvent(direction, data));
|
|
12161
|
+
}
|
|
12162
|
+
});
|
|
12163
|
+
if (!isNewConnection) {
|
|
12164
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").mediaRecorder?.start(AUDIO_CHUNK_INTERVAL_MS);
|
|
12165
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").startAudioLevelMonitoring((level) => {
|
|
12166
|
+
this.dispatchEvent(audioLevelChangedEvent(level));
|
|
12167
|
+
});
|
|
12168
|
+
this.dispatchEvent(recordingStateChangedEvent("recording"));
|
|
12169
|
+
}
|
|
12170
|
+
} catch (error) {
|
|
12171
|
+
this.dispatchEvent(errorEvent(error));
|
|
12172
|
+
await __classPrivateFieldGet7(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
|
|
12173
|
+
}
|
|
12174
|
+
};
|
|
12175
|
+
_DictationRecordingButton_handleStop = async function _DictationRecordingButton_handleStop2() {
|
|
12176
|
+
this.dispatchEvent(recordingStateChangedEvent("stopping"));
|
|
12177
|
+
try {
|
|
12178
|
+
__classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").stopAudioLevelMonitoring();
|
|
12179
|
+
await __classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").stopRecording();
|
|
12180
|
+
await __classPrivateFieldGet7(this, _DictationRecordingButton_dictationController, "f").disconnect(__classPrivateFieldGet7(this, _DictationRecordingButton_handleWebSocketClose, "f"));
|
|
12181
|
+
await __classPrivateFieldGet7(this, _DictationRecordingButton_mediaController, "f").cleanup();
|
|
12182
|
+
} catch (error) {
|
|
12183
|
+
this.dispatchEvent(errorEvent(error));
|
|
12184
|
+
}
|
|
12185
|
+
this.dispatchEvent(recordingStateChangedEvent("stopped"));
|
|
12186
|
+
};
|
|
12187
|
+
DictationRecordingButton.styles = [recording_button_default, buttons_default];
|
|
11565
12188
|
__decorate4([
|
|
11566
12189
|
c5({ context: recordingStateContext, subscribe: true }),
|
|
11567
12190
|
r5()
|
|
11568
|
-
],
|
|
12191
|
+
], DictationRecordingButton.prototype, "_recordingState", void 0);
|
|
11569
12192
|
__decorate4([
|
|
11570
12193
|
c5({ context: selectedDeviceContext, subscribe: true }),
|
|
11571
12194
|
r5()
|
|
11572
|
-
],
|
|
12195
|
+
], DictationRecordingButton.prototype, "_selectedDevice", void 0);
|
|
11573
12196
|
__decorate4([
|
|
11574
12197
|
c5({ context: accessTokenContext, subscribe: true }),
|
|
11575
12198
|
r5()
|
|
11576
|
-
],
|
|
12199
|
+
], DictationRecordingButton.prototype, "_accessToken", void 0);
|
|
11577
12200
|
__decorate4([
|
|
11578
12201
|
c5({ context: authConfigContext, subscribe: true }),
|
|
11579
12202
|
r5()
|
|
11580
|
-
],
|
|
12203
|
+
], DictationRecordingButton.prototype, "_authConfig", void 0);
|
|
11581
12204
|
__decorate4([
|
|
11582
12205
|
c5({ context: regionContext, subscribe: true }),
|
|
11583
12206
|
r5()
|
|
11584
|
-
],
|
|
12207
|
+
], DictationRecordingButton.prototype, "_region", void 0);
|
|
11585
12208
|
__decorate4([
|
|
11586
12209
|
c5({ context: tenantNameContext, subscribe: true }),
|
|
11587
12210
|
r5()
|
|
11588
|
-
],
|
|
12211
|
+
], DictationRecordingButton.prototype, "_tenantName", void 0);
|
|
11589
12212
|
__decorate4([
|
|
11590
12213
|
c5({ context: dictationConfigContext, subscribe: true }),
|
|
11591
12214
|
r5()
|
|
11592
|
-
],
|
|
12215
|
+
], DictationRecordingButton.prototype, "_dictationConfig", void 0);
|
|
11593
12216
|
__decorate4([
|
|
11594
12217
|
c5({ context: socketUrlContext, subscribe: true }),
|
|
11595
12218
|
r5()
|
|
11596
|
-
],
|
|
12219
|
+
], DictationRecordingButton.prototype, "_socketUrl", void 0);
|
|
11597
12220
|
__decorate4([
|
|
11598
12221
|
c5({ context: socketProxyContext, subscribe: true }),
|
|
11599
12222
|
r5()
|
|
11600
|
-
],
|
|
12223
|
+
], DictationRecordingButton.prototype, "_socketProxy", void 0);
|
|
11601
12224
|
__decorate4([
|
|
11602
12225
|
c5({ context: debugDisplayAudioContext, subscribe: true }),
|
|
11603
12226
|
r5()
|
|
11604
|
-
],
|
|
12227
|
+
], DictationRecordingButton.prototype, "_debug_displayAudio", void 0);
|
|
12228
|
+
__decorate4([
|
|
12229
|
+
c5({ context: keybindingContext, subscribe: true }),
|
|
12230
|
+
r5()
|
|
12231
|
+
], DictationRecordingButton.prototype, "_keybinding", void 0);
|
|
12232
|
+
__decorate4([
|
|
12233
|
+
c5({ context: modeContext, subscribe: true }),
|
|
12234
|
+
r5()
|
|
12235
|
+
], DictationRecordingButton.prototype, "_mode", void 0);
|
|
11605
12236
|
__decorate4([
|
|
11606
12237
|
n4({ type: Boolean })
|
|
11607
|
-
],
|
|
11608
|
-
|
|
11609
|
-
t3("recording-button")
|
|
11610
|
-
],
|
|
12238
|
+
], DictationRecordingButton.prototype, "allowButtonFocus", void 0);
|
|
12239
|
+
DictationRecordingButton = __decorate4([
|
|
12240
|
+
t3("dictation-recording-button")
|
|
12241
|
+
], DictationRecordingButton);
|
|
11611
12242
|
|
|
11612
12243
|
// dist/styles/callout.js
|
|
11613
12244
|
var CalloutStyles = i`
|
|
@@ -11661,21 +12292,23 @@ var SettingsMenuStyles = i`
|
|
|
11661
12292
|
.settings-wrapper {
|
|
11662
12293
|
display: flex;
|
|
11663
12294
|
flex-direction: column;
|
|
11664
|
-
gap:
|
|
12295
|
+
gap: 16px;
|
|
12296
|
+
}
|
|
12297
|
+
.settings-group {
|
|
12298
|
+
background: var(--muted-background, light-dark(#fafafa, #2a2a2a));
|
|
12299
|
+
padding: 12px;
|
|
12300
|
+
border-radius: 10px;
|
|
12301
|
+
display: flex;
|
|
12302
|
+
flex-direction: column;
|
|
12303
|
+
gap: 16px;
|
|
11665
12304
|
}
|
|
11666
12305
|
`;
|
|
11667
12306
|
var settings_menu_default = SettingsMenuStyles;
|
|
11668
12307
|
|
|
11669
12308
|
// dist/styles/select.js
|
|
11670
|
-
var SelectStyles =
|
|
11671
|
-
|
|
11672
|
-
|
|
11673
|
-
font-size: 0.8rem;
|
|
11674
|
-
padding-bottom: 0.5rem;
|
|
11675
|
-
font-weight: 500;
|
|
11676
|
-
color: var(--component-text-color, light-dark(#333, #eee));
|
|
11677
|
-
pointer-events: none;
|
|
11678
|
-
}
|
|
12309
|
+
var SelectStyles = [
|
|
12310
|
+
LabelStyles,
|
|
12311
|
+
i`
|
|
11679
12312
|
select {
|
|
11680
12313
|
background: var(--card-background, light-dark(#fff, #333));
|
|
11681
12314
|
color: var(--component-text-color, light-dark(#333, #eee));
|
|
@@ -11699,42 +12332,10 @@ var SelectStyles = i`
|
|
|
11699
12332
|
outline: 2px solid var(--action-accent-background, light-dark(#007bff, #0056b3));
|
|
11700
12333
|
/* outline-offset: 2px; */
|
|
11701
12334
|
}
|
|
11702
|
-
|
|
12335
|
+
`
|
|
12336
|
+
];
|
|
11703
12337
|
var select_default = SelectStyles;
|
|
11704
12338
|
|
|
11705
|
-
// dist/utils/devices.js
|
|
11706
|
-
async function requestMicAccess() {
|
|
11707
|
-
if (!navigator.permissions) {
|
|
11708
|
-
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
11709
|
-
stream.getTracks().forEach((track) => {
|
|
11710
|
-
track.stop();
|
|
11711
|
-
});
|
|
11712
|
-
return;
|
|
11713
|
-
}
|
|
11714
|
-
const permissionStatus = await navigator.permissions.query({
|
|
11715
|
-
name: "microphone"
|
|
11716
|
-
});
|
|
11717
|
-
if (permissionStatus.state === "denied") {
|
|
11718
|
-
throw new Error("Microphone permission is denied");
|
|
11719
|
-
}
|
|
11720
|
-
if (permissionStatus.state === "prompt") {
|
|
11721
|
-
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
11722
|
-
stream.getTracks().forEach((track) => {
|
|
11723
|
-
track.stop();
|
|
11724
|
-
});
|
|
11725
|
-
}
|
|
11726
|
-
}
|
|
11727
|
-
async function getAudioDevices() {
|
|
11728
|
-
if (!navigator.mediaDevices?.enumerateDevices) {
|
|
11729
|
-
throw new Error("MediaDevices API is not available");
|
|
11730
|
-
}
|
|
11731
|
-
await requestMicAccess();
|
|
11732
|
-
const devices = await navigator.mediaDevices.enumerateDevices();
|
|
11733
|
-
const audioDevices = devices.filter((device) => device.kind === "audioinput");
|
|
11734
|
-
const defaultDevice = audioDevices.length > 0 ? audioDevices[0] : void 0;
|
|
11735
|
-
return { defaultDevice, devices: audioDevices };
|
|
11736
|
-
}
|
|
11737
|
-
|
|
11738
12339
|
// dist/components/device-selector.js
|
|
11739
12340
|
var __decorate5 = function(decorators, target, key, desc) {
|
|
11740
12341
|
var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
|
|
@@ -11742,49 +12343,18 @@ var __decorate5 = function(decorators, target, key, desc) {
|
|
|
11742
12343
|
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;
|
|
11743
12344
|
return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
|
|
11744
12345
|
};
|
|
11745
|
-
var
|
|
12346
|
+
var __classPrivateFieldGet8 = function(receiver, state, kind, f5) {
|
|
12347
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
12348
|
+
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");
|
|
12349
|
+
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
12350
|
+
};
|
|
12351
|
+
var _DictationDeviceSelector_instances;
|
|
12352
|
+
var _DictationDeviceSelector_handleSelectDevice;
|
|
12353
|
+
var DictationDeviceSelector = class DictationDeviceSelector2 extends i4 {
|
|
11746
12354
|
constructor() {
|
|
11747
12355
|
super(...arguments);
|
|
12356
|
+
_DictationDeviceSelector_instances.add(this);
|
|
11748
12357
|
this.disabled = false;
|
|
11749
|
-
this._loadedDevices = [];
|
|
11750
|
-
this._handleDeviceChange = async () => {
|
|
11751
|
-
if (this._devicesAutoLoaded()) {
|
|
11752
|
-
await this._loadDevices();
|
|
11753
|
-
}
|
|
11754
|
-
};
|
|
11755
|
-
}
|
|
11756
|
-
_devicesAutoLoaded() {
|
|
11757
|
-
return this._loadedDevices === this._devices;
|
|
11758
|
-
}
|
|
11759
|
-
async connectedCallback() {
|
|
11760
|
-
super.connectedCallback();
|
|
11761
|
-
if (!this._devices) {
|
|
11762
|
-
await this._loadDevices();
|
|
11763
|
-
navigator.mediaDevices.addEventListener("devicechange", this._handleDeviceChange);
|
|
11764
|
-
}
|
|
11765
|
-
this.dispatchEvent(readyEvent());
|
|
11766
|
-
}
|
|
11767
|
-
disconnectedCallback() {
|
|
11768
|
-
super.disconnectedCallback();
|
|
11769
|
-
navigator.mediaDevices.removeEventListener("devicechange", this._handleDeviceChange);
|
|
11770
|
-
}
|
|
11771
|
-
async _loadDevices() {
|
|
11772
|
-
try {
|
|
11773
|
-
const { devices, defaultDevice } = await getAudioDevices();
|
|
11774
|
-
this._loadedDevices = devices;
|
|
11775
|
-
const selectedDevice = devices.find((d3) => d3.deviceId === this._selectedDevice?.deviceId) ?? defaultDevice;
|
|
11776
|
-
this.dispatchEvent(recordingDevicesChangedEvent(devices, selectedDevice));
|
|
11777
|
-
} catch (error) {
|
|
11778
|
-
this.dispatchEvent(errorEvent(error));
|
|
11779
|
-
}
|
|
11780
|
-
}
|
|
11781
|
-
_handleSelectDevice(e10) {
|
|
11782
|
-
const deviceId = e10.target.value;
|
|
11783
|
-
const device = this._devices?.find((d3) => d3.deviceId === deviceId);
|
|
11784
|
-
if (!device) {
|
|
11785
|
-
return;
|
|
11786
|
-
}
|
|
11787
|
-
this.dispatchEvent(recordingDevicesChangedEvent(this._devices || [], device));
|
|
11788
12358
|
}
|
|
11789
12359
|
render() {
|
|
11790
12360
|
return x`
|
|
@@ -11795,7 +12365,7 @@ var DeviceSelector = class DeviceSelector2 extends i4 {
|
|
|
11795
12365
|
<select
|
|
11796
12366
|
id="device-select"
|
|
11797
12367
|
aria-labelledby="device-select-label"
|
|
11798
|
-
@change=${this
|
|
12368
|
+
@change=${__classPrivateFieldGet8(this, _DictationDeviceSelector_instances, "m", _DictationDeviceSelector_handleSelectDevice)}
|
|
11799
12369
|
?disabled=${this.disabled || !this._devices || this._devices.length === 0}
|
|
11800
12370
|
>
|
|
11801
12371
|
${this._devices?.map((device) => x`
|
|
@@ -11811,87 +12381,199 @@ var DeviceSelector = class DeviceSelector2 extends i4 {
|
|
|
11811
12381
|
`;
|
|
11812
12382
|
}
|
|
11813
12383
|
};
|
|
11814
|
-
|
|
12384
|
+
_DictationDeviceSelector_instances = /* @__PURE__ */ new WeakSet();
|
|
12385
|
+
_DictationDeviceSelector_handleSelectDevice = function _DictationDeviceSelector_handleSelectDevice2(e10) {
|
|
12386
|
+
const deviceId = e10.target.value;
|
|
12387
|
+
const device = this._devices?.find((d3) => d3.deviceId === deviceId);
|
|
12388
|
+
if (!device) {
|
|
12389
|
+
return;
|
|
12390
|
+
}
|
|
12391
|
+
this.dispatchEvent(recordingDevicesChangedEvent(this._devices || [], device));
|
|
12392
|
+
};
|
|
12393
|
+
DictationDeviceSelector.styles = select_default;
|
|
11815
12394
|
__decorate5([
|
|
11816
12395
|
c5({ context: devicesContext, subscribe: true }),
|
|
11817
12396
|
r5()
|
|
11818
|
-
],
|
|
12397
|
+
], DictationDeviceSelector.prototype, "_devices", void 0);
|
|
11819
12398
|
__decorate5([
|
|
11820
12399
|
c5({ context: selectedDeviceContext, subscribe: true }),
|
|
11821
12400
|
r5()
|
|
11822
|
-
],
|
|
12401
|
+
], DictationDeviceSelector.prototype, "_selectedDevice", void 0);
|
|
11823
12402
|
__decorate5([
|
|
11824
12403
|
n4({ type: Boolean })
|
|
11825
|
-
],
|
|
11826
|
-
|
|
11827
|
-
t3("device-selector")
|
|
11828
|
-
],
|
|
11829
|
-
|
|
11830
|
-
// dist/
|
|
11831
|
-
var
|
|
11832
|
-
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11836
|
-
function getLanguageName(languageCode) {
|
|
11837
|
-
try {
|
|
11838
|
-
const userLocale = navigator.language || "en";
|
|
11839
|
-
const displayNames = new Intl.DisplayNames([userLocale], {
|
|
11840
|
-
type: "language"
|
|
11841
|
-
});
|
|
11842
|
-
const languageName = displayNames.of(languageCode);
|
|
11843
|
-
return languageName || languageCode;
|
|
11844
|
-
} catch {
|
|
11845
|
-
return languageCode;
|
|
12404
|
+
], DictationDeviceSelector.prototype, "disabled", void 0);
|
|
12405
|
+
DictationDeviceSelector = __decorate5([
|
|
12406
|
+
t3("dictation-device-selector")
|
|
12407
|
+
], DictationDeviceSelector);
|
|
12408
|
+
|
|
12409
|
+
// dist/styles/keybinding-selector.js
|
|
12410
|
+
var KeybindingSelectorStyles = [
|
|
12411
|
+
LabelStyles,
|
|
12412
|
+
i`
|
|
12413
|
+
:host {
|
|
12414
|
+
display: block;
|
|
11846
12415
|
}
|
|
11847
|
-
|
|
11848
|
-
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
12416
|
+
.keybinding-selector-wrapper {
|
|
12417
|
+
display: flex;
|
|
12418
|
+
align-items: center;
|
|
12419
|
+
gap: 12px;
|
|
12420
|
+
padding: var(--card-padding, 4px) 8px;
|
|
12421
|
+
background: var(--card-background, light-dark(#fff, #333));
|
|
12422
|
+
border: 1px solid var(--card-border-color, light-dark(#ddd, #555));
|
|
12423
|
+
border-radius: var(--card-inner-border-radius, 6px);
|
|
12424
|
+
overflow: hidden;
|
|
12425
|
+
}
|
|
12426
|
+
.keybinding-selector-wrapper:focus-within {
|
|
12427
|
+
border-color: var(--action-accent-background, light-dark(#007bff, #0056b3));
|
|
12428
|
+
outline: 2px solid var(--action-accent-background, light-dark(#007bff, #0056b3));
|
|
12429
|
+
}
|
|
12430
|
+
.keybinding-selector-input {
|
|
12431
|
+
flex: 1;
|
|
12432
|
+
min-width: 0;
|
|
12433
|
+
border: none;
|
|
12434
|
+
background: transparent;
|
|
12435
|
+
font-size: 14px;
|
|
12436
|
+
line-height: 24px;
|
|
12437
|
+
color: var(--component-text-color, light-dark(#333, #eee));
|
|
12438
|
+
outline: none;
|
|
12439
|
+
padding: 0;
|
|
12440
|
+
cursor: text;
|
|
12441
|
+
}
|
|
12442
|
+
.keybinding-selector-input::placeholder {
|
|
12443
|
+
opacity: 0.6;
|
|
12444
|
+
color: var(--component-text-color, light-dark(#333, #eee));
|
|
12445
|
+
}
|
|
12446
|
+
.keybinding-selector-input:disabled {
|
|
12447
|
+
cursor: not-allowed;
|
|
12448
|
+
opacity: 0.5;
|
|
12449
|
+
}
|
|
12450
|
+
.keybinding-key {
|
|
12451
|
+
display: flex;
|
|
12452
|
+
align-items: center;
|
|
12453
|
+
justify-content: center;
|
|
12454
|
+
padding: 0 0.5rem;
|
|
12455
|
+
height: 24px;
|
|
12456
|
+
background: var(--card-background, light-dark(#fff, #333));
|
|
12457
|
+
border: 1px solid var(--card-border-color, light-dark(#ddd, #555));
|
|
12458
|
+
border-radius: var(--card-inner-border-radius, 6px);
|
|
12459
|
+
box-shadow: var(--card-box-shadow, 0 2px 5px rgba(0, 0, 0, 0.1));
|
|
12460
|
+
font-size: 16px;
|
|
12461
|
+
line-height: 28px;
|
|
12462
|
+
color: var(--component-text-color, light-dark(#333, #eee));
|
|
12463
|
+
opacity: 0.6;
|
|
12464
|
+
text-align: center;
|
|
12465
|
+
flex-shrink: 0;
|
|
12466
|
+
}
|
|
12467
|
+
.keybinding-help {
|
|
12468
|
+
font-size: 12px;
|
|
12469
|
+
line-height: 20px;
|
|
12470
|
+
color: var(--component-text-color, light-dark(#333, #eee));
|
|
12471
|
+
opacity: 0.6;
|
|
12472
|
+
margin: 0;
|
|
12473
|
+
letter-spacing: 0.01px;
|
|
12474
|
+
padding-top: 8px;
|
|
12475
|
+
}
|
|
12476
|
+
`
|
|
12477
|
+
];
|
|
12478
|
+
var keybinding_selector_default = KeybindingSelectorStyles;
|
|
11853
12479
|
|
|
11854
|
-
// dist/components/
|
|
12480
|
+
// dist/components/keybinding-selector.js
|
|
11855
12481
|
var __decorate6 = function(decorators, target, key, desc) {
|
|
11856
12482
|
var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
|
|
11857
12483
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
|
|
11858
12484
|
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;
|
|
11859
12485
|
return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
|
|
11860
12486
|
};
|
|
11861
|
-
var
|
|
12487
|
+
var __classPrivateFieldGet9 = function(receiver, state, kind, f5) {
|
|
12488
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
12489
|
+
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");
|
|
12490
|
+
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
12491
|
+
};
|
|
12492
|
+
var _DictationKeybindingSelector_instances;
|
|
12493
|
+
var _DictationKeybindingSelector_handleKeybindingInputFocus;
|
|
12494
|
+
var _DictationKeybindingSelector_handleKeybindingInputBlur;
|
|
12495
|
+
var _DictationKeybindingSelector_handleKeybindingKeyDown;
|
|
12496
|
+
var DictationKeybindingSelector = class DictationKeybindingSelector2 extends i4 {
|
|
11862
12497
|
constructor() {
|
|
11863
12498
|
super(...arguments);
|
|
12499
|
+
_DictationKeybindingSelector_instances.add(this);
|
|
11864
12500
|
this.disabled = false;
|
|
11865
|
-
this.
|
|
12501
|
+
this._isCapturingKeybinding = false;
|
|
11866
12502
|
}
|
|
11867
|
-
|
|
11868
|
-
return
|
|
11869
|
-
|
|
11870
|
-
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
|
|
11875
|
-
|
|
11876
|
-
|
|
11877
|
-
|
|
11878
|
-
|
|
11879
|
-
|
|
11880
|
-
|
|
12503
|
+
render() {
|
|
12504
|
+
return x`
|
|
12505
|
+
<div>
|
|
12506
|
+
<label>Keybinding</label>
|
|
12507
|
+
<div class="keybinding-selector-wrapper">
|
|
12508
|
+
<div class="keybinding-key">${this._keybinding}</div>
|
|
12509
|
+
<input
|
|
12510
|
+
type="text"
|
|
12511
|
+
class="keybinding-selector-input"
|
|
12512
|
+
.value=""
|
|
12513
|
+
placeholder="Click and press a key..."
|
|
12514
|
+
readonly
|
|
12515
|
+
@focusin=${__classPrivateFieldGet9(this, _DictationKeybindingSelector_instances, "m", _DictationKeybindingSelector_handleKeybindingInputFocus)}
|
|
12516
|
+
@focusout=${__classPrivateFieldGet9(this, _DictationKeybindingSelector_instances, "m", _DictationKeybindingSelector_handleKeybindingInputBlur)}
|
|
12517
|
+
@keydown=${__classPrivateFieldGet9(this, _DictationKeybindingSelector_instances, "m", _DictationKeybindingSelector_handleKeybindingKeyDown)}
|
|
12518
|
+
?disabled=${this.disabled}
|
|
12519
|
+
/>
|
|
12520
|
+
</div>
|
|
12521
|
+
<p class="keybinding-help">
|
|
12522
|
+
Press ${this._keybinding} to start/stop recording
|
|
12523
|
+
</p>
|
|
12524
|
+
</div>
|
|
12525
|
+
`;
|
|
11881
12526
|
}
|
|
11882
|
-
|
|
11883
|
-
|
|
11884
|
-
|
|
11885
|
-
|
|
11886
|
-
|
|
11887
|
-
|
|
11888
|
-
|
|
11889
|
-
|
|
12527
|
+
};
|
|
12528
|
+
_DictationKeybindingSelector_instances = /* @__PURE__ */ new WeakSet();
|
|
12529
|
+
_DictationKeybindingSelector_handleKeybindingInputFocus = function _DictationKeybindingSelector_handleKeybindingInputFocus2() {
|
|
12530
|
+
this._isCapturingKeybinding = true;
|
|
12531
|
+
};
|
|
12532
|
+
_DictationKeybindingSelector_handleKeybindingInputBlur = function _DictationKeybindingSelector_handleKeybindingInputBlur2() {
|
|
12533
|
+
this._isCapturingKeybinding = false;
|
|
12534
|
+
};
|
|
12535
|
+
_DictationKeybindingSelector_handleKeybindingKeyDown = function _DictationKeybindingSelector_handleKeybindingKeyDown2(event) {
|
|
12536
|
+
if (!this._isCapturingKeybinding) {
|
|
12537
|
+
return;
|
|
11890
12538
|
}
|
|
11891
|
-
|
|
11892
|
-
|
|
11893
|
-
|
|
11894
|
-
|
|
12539
|
+
event.preventDefault();
|
|
12540
|
+
event.stopPropagation();
|
|
12541
|
+
this.dispatchEvent(keybindingChangedEvent(event.key, event.code));
|
|
12542
|
+
};
|
|
12543
|
+
DictationKeybindingSelector.styles = keybinding_selector_default;
|
|
12544
|
+
__decorate6([
|
|
12545
|
+
c5({ context: keybindingContext, subscribe: true }),
|
|
12546
|
+
r5()
|
|
12547
|
+
], DictationKeybindingSelector.prototype, "_keybinding", void 0);
|
|
12548
|
+
__decorate6([
|
|
12549
|
+
n4({ type: Boolean })
|
|
12550
|
+
], DictationKeybindingSelector.prototype, "disabled", void 0);
|
|
12551
|
+
__decorate6([
|
|
12552
|
+
r5()
|
|
12553
|
+
], DictationKeybindingSelector.prototype, "_isCapturingKeybinding", void 0);
|
|
12554
|
+
DictationKeybindingSelector = __decorate6([
|
|
12555
|
+
t3("dictation-keybinding-selector")
|
|
12556
|
+
], DictationKeybindingSelector);
|
|
12557
|
+
|
|
12558
|
+
// dist/components/language-selector.js
|
|
12559
|
+
var __decorate7 = function(decorators, target, key, desc) {
|
|
12560
|
+
var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
|
|
12561
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
|
|
12562
|
+
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;
|
|
12563
|
+
return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
|
|
12564
|
+
};
|
|
12565
|
+
var __classPrivateFieldGet10 = function(receiver, state, kind, f5) {
|
|
12566
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
12567
|
+
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");
|
|
12568
|
+
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
12569
|
+
};
|
|
12570
|
+
var _DictationLanguageSelector_instances;
|
|
12571
|
+
var _DictationLanguageSelector_handleSelectLanguage;
|
|
12572
|
+
var DictationLanguageSelector = class DictationLanguageSelector2 extends i4 {
|
|
12573
|
+
constructor() {
|
|
12574
|
+
super(...arguments);
|
|
12575
|
+
_DictationLanguageSelector_instances.add(this);
|
|
12576
|
+
this.disabled = false;
|
|
11895
12577
|
}
|
|
11896
12578
|
render() {
|
|
11897
12579
|
return x`
|
|
@@ -11902,7 +12584,7 @@ var LanguageSelector = class LanguageSelector2 extends i4 {
|
|
|
11902
12584
|
<select
|
|
11903
12585
|
id="language-select"
|
|
11904
12586
|
aria-labelledby="language-select-label"
|
|
11905
|
-
@change=${this
|
|
12587
|
+
@change=${__classPrivateFieldGet10(this, _DictationLanguageSelector_instances, "m", _DictationLanguageSelector_handleSelectLanguage)}
|
|
11906
12588
|
?disabled=${this.disabled || !this._languages || this._languages.length === 0}
|
|
11907
12589
|
>
|
|
11908
12590
|
${this._languages?.map((language) => x`
|
|
@@ -11918,50 +12600,174 @@ var LanguageSelector = class LanguageSelector2 extends i4 {
|
|
|
11918
12600
|
`;
|
|
11919
12601
|
}
|
|
11920
12602
|
};
|
|
11921
|
-
|
|
11922
|
-
|
|
12603
|
+
_DictationLanguageSelector_instances = /* @__PURE__ */ new WeakSet();
|
|
12604
|
+
_DictationLanguageSelector_handleSelectLanguage = function _DictationLanguageSelector_handleSelectLanguage2(e10) {
|
|
12605
|
+
const language = e10.target.value;
|
|
12606
|
+
this.dispatchEvent(languagesChangedEvent(this._languages || [], language));
|
|
12607
|
+
this.dispatchEvent(languageChangedEvent(language));
|
|
12608
|
+
};
|
|
12609
|
+
DictationLanguageSelector.styles = select_default;
|
|
12610
|
+
__decorate7([
|
|
11923
12611
|
c5({ context: languagesContext, subscribe: true }),
|
|
11924
12612
|
r5()
|
|
11925
|
-
],
|
|
11926
|
-
|
|
12613
|
+
], DictationLanguageSelector.prototype, "_languages", void 0);
|
|
12614
|
+
__decorate7([
|
|
11927
12615
|
c5({ context: dictationConfigContext, subscribe: true }),
|
|
11928
12616
|
r5()
|
|
11929
|
-
],
|
|
11930
|
-
|
|
12617
|
+
], DictationLanguageSelector.prototype, "_dictationConfig", void 0);
|
|
12618
|
+
__decorate7([
|
|
11931
12619
|
n4({ type: Boolean })
|
|
11932
|
-
],
|
|
11933
|
-
|
|
11934
|
-
|
|
12620
|
+
], DictationLanguageSelector.prototype, "disabled", void 0);
|
|
12621
|
+
DictationLanguageSelector = __decorate7([
|
|
12622
|
+
t3("dictation-language-selector")
|
|
12623
|
+
], DictationLanguageSelector);
|
|
12624
|
+
|
|
12625
|
+
// dist/styles/mode-selector.js
|
|
12626
|
+
var ModeSelectorStyles = [
|
|
12627
|
+
LabelStyles,
|
|
12628
|
+
i`
|
|
12629
|
+
:host {
|
|
12630
|
+
display: block;
|
|
12631
|
+
}
|
|
12632
|
+
.mode-selector-tabs {
|
|
12633
|
+
display: flex;
|
|
12634
|
+
background: var(--muted-background, light-dark(#fafafa, #2a2a2a));
|
|
12635
|
+
border: 1px solid var(--card-border-color, light-dark(#ddd, #555));
|
|
12636
|
+
border-radius: var(--card-inner-border-radius, 6px);
|
|
12637
|
+
padding: 0;
|
|
12638
|
+
overflow: hidden;
|
|
12639
|
+
align-items: center;
|
|
12640
|
+
justify-content: center;
|
|
12641
|
+
text-wrap: nowrap;
|
|
12642
|
+
gap: 2px;
|
|
12643
|
+
}
|
|
12644
|
+
.mode-selector-tab {
|
|
12645
|
+
flex: 1;
|
|
12646
|
+
padding: 4px 8px;
|
|
12647
|
+
border: 1px solid transparent;
|
|
12648
|
+
background: transparent;
|
|
12649
|
+
font-size: 14px;
|
|
12650
|
+
font-weight: 500;
|
|
12651
|
+
line-height: 24px;
|
|
12652
|
+
color: var(--component-text-color, light-dark(#333, #eee));
|
|
12653
|
+
cursor: pointer;
|
|
12654
|
+
transition: all 0.2s;
|
|
12655
|
+
height: 32px;
|
|
12656
|
+
display: flex;
|
|
12657
|
+
align-items: center;
|
|
12658
|
+
justify-content: center;
|
|
12659
|
+
border-radius: var(--card-inner-border-radius, 6px);
|
|
12660
|
+
margin: -1px;
|
|
12661
|
+
}
|
|
12662
|
+
.mode-selector-tab:hover:not(:disabled) {
|
|
12663
|
+
background: var(--action-plain-background-hover, light-dark(#ddd, #444));
|
|
12664
|
+
}
|
|
12665
|
+
.mode-selector-tab.active {
|
|
12666
|
+
background: var(--card-background, light-dark(#fff, #333));
|
|
12667
|
+
border-color: var(--card-border-color, light-dark(#ddd, #555));
|
|
12668
|
+
box-shadow: var(--card-box-shadow, 0 2px 5px rgba(0, 0, 0, 0.1));
|
|
12669
|
+
}
|
|
12670
|
+
.mode-selector-tab:disabled {
|
|
12671
|
+
opacity: 0.5;
|
|
12672
|
+
cursor: not-allowed;
|
|
12673
|
+
}
|
|
12674
|
+
`
|
|
12675
|
+
];
|
|
12676
|
+
var mode_selector_default = ModeSelectorStyles;
|
|
12677
|
+
|
|
12678
|
+
// dist/components/mode-selector.js
|
|
12679
|
+
var __decorate8 = function(decorators, target, key, desc) {
|
|
12680
|
+
var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
|
|
12681
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
|
|
12682
|
+
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;
|
|
12683
|
+
return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
|
|
12684
|
+
};
|
|
12685
|
+
var __classPrivateFieldGet11 = function(receiver, state, kind, f5) {
|
|
12686
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
12687
|
+
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");
|
|
12688
|
+
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
12689
|
+
};
|
|
12690
|
+
var _DictationModeSelector_instances;
|
|
12691
|
+
var _DictationModeSelector_handleModeChange;
|
|
12692
|
+
var DictationModeSelector = class DictationModeSelector2 extends i4 {
|
|
12693
|
+
constructor() {
|
|
12694
|
+
super(...arguments);
|
|
12695
|
+
_DictationModeSelector_instances.add(this);
|
|
12696
|
+
this._mode = "toggle-to-talk";
|
|
12697
|
+
this.disabled = false;
|
|
12698
|
+
}
|
|
12699
|
+
render() {
|
|
12700
|
+
return x`
|
|
12701
|
+
<div>
|
|
12702
|
+
<label>Dictation Mode</label>
|
|
12703
|
+
<div class="mode-selector-tabs">
|
|
12704
|
+
<button
|
|
12705
|
+
class=${e6({
|
|
12706
|
+
active: this._mode === "toggle-to-talk",
|
|
12707
|
+
"mode-selector-tab": true
|
|
12708
|
+
})}
|
|
12709
|
+
@click=${() => __classPrivateFieldGet11(this, _DictationModeSelector_instances, "m", _DictationModeSelector_handleModeChange).call(this, "toggle-to-talk")}
|
|
12710
|
+
?disabled=${this.disabled}
|
|
12711
|
+
>
|
|
12712
|
+
Toggle-to-Talk
|
|
12713
|
+
</button>
|
|
12714
|
+
<button
|
|
12715
|
+
class=${e6({
|
|
12716
|
+
active: this._mode === "push-to-talk",
|
|
12717
|
+
"mode-selector-tab": true
|
|
12718
|
+
})}
|
|
12719
|
+
@click=${() => __classPrivateFieldGet11(this, _DictationModeSelector_instances, "m", _DictationModeSelector_handleModeChange).call(this, "push-to-talk")}
|
|
12720
|
+
?disabled=${this.disabled}
|
|
12721
|
+
>
|
|
12722
|
+
Push-to-Talk
|
|
12723
|
+
</button>
|
|
12724
|
+
</div>
|
|
12725
|
+
</div>
|
|
12726
|
+
`;
|
|
12727
|
+
}
|
|
12728
|
+
};
|
|
12729
|
+
_DictationModeSelector_instances = /* @__PURE__ */ new WeakSet();
|
|
12730
|
+
_DictationModeSelector_handleModeChange = function _DictationModeSelector_handleModeChange2(mode) {
|
|
12731
|
+
this.dispatchEvent(modeChangedEvent(mode));
|
|
12732
|
+
};
|
|
12733
|
+
DictationModeSelector.styles = mode_selector_default;
|
|
12734
|
+
__decorate8([
|
|
12735
|
+
c5({ context: modeContext, subscribe: true }),
|
|
11935
12736
|
r5()
|
|
11936
|
-
],
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
],
|
|
12737
|
+
], DictationModeSelector.prototype, "_mode", void 0);
|
|
12738
|
+
__decorate8([
|
|
12739
|
+
n4({ type: Boolean })
|
|
12740
|
+
], DictationModeSelector.prototype, "disabled", void 0);
|
|
12741
|
+
DictationModeSelector = __decorate8([
|
|
12742
|
+
t3("dictation-mode-selector")
|
|
12743
|
+
], DictationModeSelector);
|
|
11940
12744
|
|
|
11941
12745
|
// dist/components/settings-menu.js
|
|
11942
|
-
var
|
|
12746
|
+
var __decorate9 = function(decorators, target, key, desc) {
|
|
11943
12747
|
var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
|
|
11944
12748
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
|
|
11945
12749
|
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;
|
|
11946
12750
|
return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
|
|
11947
12751
|
};
|
|
11948
|
-
var
|
|
12752
|
+
var DictationSettingsMenu = class DictationSettingsMenu2 extends i4 {
|
|
11949
12753
|
constructor() {
|
|
11950
12754
|
super(...arguments);
|
|
11951
12755
|
this._recordingState = "stopped";
|
|
11952
12756
|
this.settingsEnabled = ["device", "language"];
|
|
11953
12757
|
}
|
|
11954
12758
|
render() {
|
|
11955
|
-
if (
|
|
12759
|
+
if (this.settingsEnabled?.length === 0) {
|
|
11956
12760
|
return E;
|
|
11957
12761
|
}
|
|
11958
12762
|
const isRecording = this._recordingState === "recording";
|
|
11959
12763
|
const showDeviceSelector = this.settingsEnabled.includes("device");
|
|
11960
12764
|
const showLanguageSelector = this.settingsEnabled.includes("language");
|
|
12765
|
+
const showModeSelector = this.settingsEnabled.includes("mode");
|
|
12766
|
+
const showKeybinding = this.settingsEnabled.includes("keybinding");
|
|
11961
12767
|
return x`
|
|
11962
12768
|
<div class="mic-selector">
|
|
11963
12769
|
<button id="settings-popover-button" popovertarget="settings-popover">
|
|
11964
|
-
<icon-settings
|
|
12770
|
+
<icon-settings />
|
|
11965
12771
|
</button>
|
|
11966
12772
|
<div id="settings-popover" popover>
|
|
11967
12773
|
<div class="settings-wrapper">
|
|
@@ -11970,53 +12776,71 @@ var SettingsMenu = class SettingsMenu2 extends i4 {
|
|
|
11970
12776
|
Recording is in progress. Stop recording to change settings.
|
|
11971
12777
|
</div>
|
|
11972
12778
|
` : E}
|
|
11973
|
-
${showDeviceSelector ? x`<device-selector
|
|
12779
|
+
${showDeviceSelector ? x`<dictation-device-selector
|
|
11974
12780
|
?disabled=${isRecording}
|
|
11975
|
-
|
|
11976
|
-
${showLanguageSelector ? x`<language-selector
|
|
12781
|
+
/>` : E}
|
|
12782
|
+
${showLanguageSelector ? x`<dictation-language-selector
|
|
11977
12783
|
?disabled=${isRecording}
|
|
11978
|
-
|
|
12784
|
+
/>` : E}
|
|
12785
|
+
${showModeSelector || showKeybinding ? x`
|
|
12786
|
+
<div class="settings-group">
|
|
12787
|
+
${showModeSelector ? x`<dictation-mode-selector
|
|
12788
|
+
?disabled=${isRecording}
|
|
12789
|
+
/>` : E}
|
|
12790
|
+
${showKeybinding ? x`<dictation-keybinding-selector
|
|
12791
|
+
?disabled=${isRecording}
|
|
12792
|
+
/>` : E}
|
|
12793
|
+
</div>
|
|
12794
|
+
` : E}
|
|
11979
12795
|
</div>
|
|
11980
12796
|
</div>
|
|
11981
12797
|
</div>
|
|
11982
12798
|
`;
|
|
11983
12799
|
}
|
|
11984
12800
|
};
|
|
11985
|
-
|
|
12801
|
+
DictationSettingsMenu.styles = [
|
|
11986
12802
|
settings_menu_default,
|
|
11987
12803
|
buttons_default,
|
|
11988
12804
|
callout_default
|
|
11989
12805
|
];
|
|
11990
|
-
|
|
12806
|
+
__decorate9([
|
|
11991
12807
|
c5({ context: recordingStateContext, subscribe: true }),
|
|
11992
12808
|
r5()
|
|
11993
|
-
],
|
|
11994
|
-
|
|
12809
|
+
], DictationSettingsMenu.prototype, "_recordingState", void 0);
|
|
12810
|
+
__decorate9([
|
|
11995
12811
|
n4({
|
|
11996
12812
|
converter: commaSeparatedConverter,
|
|
11997
12813
|
type: Array
|
|
11998
12814
|
})
|
|
11999
|
-
],
|
|
12000
|
-
|
|
12001
|
-
t3("settings-menu")
|
|
12002
|
-
],
|
|
12815
|
+
], DictationSettingsMenu.prototype, "settingsEnabled", void 0);
|
|
12816
|
+
DictationSettingsMenu = __decorate9([
|
|
12817
|
+
t3("dictation-settings-menu")
|
|
12818
|
+
], DictationSettingsMenu);
|
|
12003
12819
|
|
|
12004
12820
|
// dist/components/corti-dictation.js
|
|
12005
|
-
var
|
|
12821
|
+
var __decorate10 = function(decorators, target, key, desc) {
|
|
12006
12822
|
var c6 = arguments.length, r7 = c6 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
|
|
12007
12823
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r7 = Reflect.decorate(decorators, target, key, desc);
|
|
12008
12824
|
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;
|
|
12009
12825
|
return c6 > 3 && r7 && Object.defineProperty(target, key, r7), r7;
|
|
12010
12826
|
};
|
|
12827
|
+
var __classPrivateFieldGet12 = function(receiver, state, kind, f5) {
|
|
12828
|
+
if (kind === "a" && !f5) throw new TypeError("Private accessor was defined without a getter");
|
|
12829
|
+
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");
|
|
12830
|
+
return kind === "m" ? f5 : kind === "a" ? f5.call(receiver) : f5 ? f5.value : state.get(receiver);
|
|
12831
|
+
};
|
|
12832
|
+
var _CortiDictation_recordingButtonRef;
|
|
12833
|
+
var _CortiDictation_contextProviderRef;
|
|
12011
12834
|
var CortiDictation = class CortiDictation2 extends i4 {
|
|
12012
12835
|
constructor() {
|
|
12013
12836
|
super(...arguments);
|
|
12014
|
-
this
|
|
12015
|
-
this
|
|
12837
|
+
_CortiDictation_recordingButtonRef.set(this, e7());
|
|
12838
|
+
_CortiDictation_contextProviderRef.set(this, e7());
|
|
12016
12839
|
this.settingsEnabled = ["device", "language"];
|
|
12017
12840
|
this.allowButtonFocus = false;
|
|
12018
12841
|
this.debug_displayAudio = false;
|
|
12019
12842
|
this._dictationConfig = DEFAULT_DICTATION_CONFIG;
|
|
12843
|
+
this._mode = "toggle-to-talk";
|
|
12020
12844
|
}
|
|
12021
12845
|
/**
|
|
12022
12846
|
* List of all language codes available for use with the Web Component.
|
|
@@ -12026,7 +12850,7 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12026
12850
|
this._languagesSupported = value;
|
|
12027
12851
|
}
|
|
12028
12852
|
get languagesSupported() {
|
|
12029
|
-
return this.
|
|
12853
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.languages || this._languagesSupported || [];
|
|
12030
12854
|
}
|
|
12031
12855
|
/**
|
|
12032
12856
|
* Configuration settings for dictation
|
|
@@ -12035,7 +12859,7 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12035
12859
|
this._dictationConfig = value;
|
|
12036
12860
|
}
|
|
12037
12861
|
get dictationConfig() {
|
|
12038
|
-
return this.
|
|
12862
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.dictationConfig || this._dictationConfig;
|
|
12039
12863
|
}
|
|
12040
12864
|
/**
|
|
12041
12865
|
* List of available recording devices
|
|
@@ -12044,7 +12868,7 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12044
12868
|
this._devices = value;
|
|
12045
12869
|
}
|
|
12046
12870
|
get devices() {
|
|
12047
|
-
return this.
|
|
12871
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.devices || this._devices || [];
|
|
12048
12872
|
}
|
|
12049
12873
|
/**
|
|
12050
12874
|
* The selected device used for recording (MediaDeviceInfo).
|
|
@@ -12053,13 +12877,33 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12053
12877
|
this._selectedDevice = value;
|
|
12054
12878
|
}
|
|
12055
12879
|
get selectedDevice() {
|
|
12056
|
-
return this.
|
|
12880
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.selectedDevice || this._selectedDevice;
|
|
12057
12881
|
}
|
|
12058
12882
|
/**
|
|
12059
12883
|
* Current state of recording (stopped, recording, initializing and stopping, ).
|
|
12060
12884
|
*/
|
|
12061
12885
|
get recordingState() {
|
|
12062
|
-
return this.
|
|
12886
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.recordingState || "stopped";
|
|
12887
|
+
}
|
|
12888
|
+
/**
|
|
12889
|
+
* Dictation mode: "toggle-to-talk" or "push-to-talk"
|
|
12890
|
+
*/
|
|
12891
|
+
set mode(value) {
|
|
12892
|
+
this._mode = value;
|
|
12893
|
+
}
|
|
12894
|
+
get mode() {
|
|
12895
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.mode || this._mode || "toggle-to-talk";
|
|
12896
|
+
}
|
|
12897
|
+
/**
|
|
12898
|
+
* Keybinding for keyboard shortcut. Single key only (e.g., "`", "k", "meta", "ctrl").
|
|
12899
|
+
* Combinations with "+" are not supported.
|
|
12900
|
+
* Defaults to "`" if keybinding is in settingsEnabled, otherwise undefined
|
|
12901
|
+
*/
|
|
12902
|
+
set keybinding(value) {
|
|
12903
|
+
this._keybinding = value;
|
|
12904
|
+
}
|
|
12905
|
+
get keybinding() {
|
|
12906
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.keybinding || this._keybinding;
|
|
12063
12907
|
}
|
|
12064
12908
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
12065
12909
|
// Public methods
|
|
@@ -12071,7 +12915,7 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12071
12915
|
*/
|
|
12072
12916
|
setAccessToken(token) {
|
|
12073
12917
|
this.accessToken = token;
|
|
12074
|
-
return this.
|
|
12918
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.setAccessToken(token) ?? {
|
|
12075
12919
|
accessToken: token,
|
|
12076
12920
|
environment: void 0,
|
|
12077
12921
|
tenant: void 0
|
|
@@ -12084,7 +12928,7 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12084
12928
|
*/
|
|
12085
12929
|
async setAuthConfig(config) {
|
|
12086
12930
|
this.authConfig = config;
|
|
12087
|
-
return this.
|
|
12931
|
+
return __classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f").value?.setAuthConfig(config) ?? {
|
|
12088
12932
|
accessToken: void 0,
|
|
12089
12933
|
environment: void 0,
|
|
12090
12934
|
tenant: void 0
|
|
@@ -12094,19 +12938,19 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12094
12938
|
* Starts a recording.
|
|
12095
12939
|
*/
|
|
12096
12940
|
startRecording() {
|
|
12097
|
-
this.
|
|
12941
|
+
__classPrivateFieldGet12(this, _CortiDictation_recordingButtonRef, "f").value?.startRecording();
|
|
12098
12942
|
}
|
|
12099
12943
|
/**
|
|
12100
12944
|
* Stops a recording.
|
|
12101
12945
|
*/
|
|
12102
12946
|
stopRecording() {
|
|
12103
|
-
this.
|
|
12947
|
+
__classPrivateFieldGet12(this, _CortiDictation_recordingButtonRef, "f").value?.stopRecording();
|
|
12104
12948
|
}
|
|
12105
12949
|
/**
|
|
12106
12950
|
* Starts or stops recording. Convenience layer on top of the start/stop methods.
|
|
12107
12951
|
*/
|
|
12108
12952
|
toggleRecording() {
|
|
12109
|
-
this.
|
|
12953
|
+
__classPrivateFieldGet12(this, _CortiDictation_recordingButtonRef, "f").value?.toggleRecording();
|
|
12110
12954
|
}
|
|
12111
12955
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
12112
12956
|
// Render
|
|
@@ -12114,8 +12958,8 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12114
12958
|
render() {
|
|
12115
12959
|
const isHidden = !this.accessToken && !this.authConfig && !this.socketUrl && !this.socketProxy;
|
|
12116
12960
|
return x`
|
|
12117
|
-
<dictation-
|
|
12118
|
-
${n6(this
|
|
12961
|
+
<dictation-root
|
|
12962
|
+
${n6(__classPrivateFieldGet12(this, _CortiDictation_contextProviderRef, "f"))}
|
|
12119
12963
|
class=${e6({ hidden: isHidden })}
|
|
12120
12964
|
.accessToken=${this.accessToken}
|
|
12121
12965
|
.authConfig=${this.authConfig}
|
|
@@ -12126,73 +12970,91 @@ var CortiDictation = class CortiDictation2 extends i4 {
|
|
|
12126
12970
|
.devices=${this._devices}
|
|
12127
12971
|
.selectedDevice=${this._selectedDevice}
|
|
12128
12972
|
.debug_displayAudio=${this.debug_displayAudio}
|
|
12973
|
+
.mode=${this._mode}
|
|
12974
|
+
.keybinding=${this._keybinding}
|
|
12129
12975
|
>
|
|
12130
|
-
<recording-button
|
|
12131
|
-
${n6(this
|
|
12132
|
-
|
|
12133
|
-
></recording-button>
|
|
12134
|
-
|
|
12135
|
-
|
|
12976
|
+
<dictation-recording-button
|
|
12977
|
+
${n6(__classPrivateFieldGet12(this, _CortiDictation_recordingButtonRef, "f"))}
|
|
12978
|
+
?allowButtonFocus=${this.allowButtonFocus}
|
|
12979
|
+
></dictation-recording-button>
|
|
12980
|
+
${this.settingsEnabled?.length > 0 ? x`<dictation-settings-menu
|
|
12981
|
+
.settingsEnabled=${this.settingsEnabled}
|
|
12982
|
+
></dictation-settings-menu>` : E}
|
|
12983
|
+
</dictation-root>
|
|
12136
12984
|
`;
|
|
12137
12985
|
}
|
|
12138
12986
|
};
|
|
12987
|
+
_CortiDictation_recordingButtonRef = /* @__PURE__ */ new WeakMap();
|
|
12988
|
+
_CortiDictation_contextProviderRef = /* @__PURE__ */ new WeakMap();
|
|
12139
12989
|
CortiDictation.styles = i`
|
|
12140
12990
|
.hidden {
|
|
12141
12991
|
display: none;
|
|
12142
12992
|
}
|
|
12143
12993
|
`;
|
|
12144
|
-
|
|
12994
|
+
__decorate10([
|
|
12145
12995
|
n4({ type: String })
|
|
12146
12996
|
], CortiDictation.prototype, "accessToken", void 0);
|
|
12147
|
-
|
|
12997
|
+
__decorate10([
|
|
12148
12998
|
n4({ attribute: false, type: Object })
|
|
12149
12999
|
], CortiDictation.prototype, "authConfig", void 0);
|
|
12150
|
-
|
|
13000
|
+
__decorate10([
|
|
12151
13001
|
n4({ type: String })
|
|
12152
13002
|
], CortiDictation.prototype, "socketUrl", void 0);
|
|
12153
|
-
|
|
13003
|
+
__decorate10([
|
|
12154
13004
|
n4({ attribute: false, type: Object })
|
|
12155
13005
|
], CortiDictation.prototype, "socketProxy", void 0);
|
|
12156
|
-
|
|
13006
|
+
__decorate10([
|
|
12157
13007
|
n4({
|
|
12158
13008
|
converter: commaSeparatedConverter,
|
|
12159
13009
|
type: Array
|
|
12160
13010
|
})
|
|
12161
13011
|
], CortiDictation.prototype, "languagesSupported", null);
|
|
12162
|
-
|
|
13012
|
+
__decorate10([
|
|
12163
13013
|
r5()
|
|
12164
13014
|
], CortiDictation.prototype, "_languagesSupported", void 0);
|
|
12165
|
-
|
|
13015
|
+
__decorate10([
|
|
12166
13016
|
n4({
|
|
12167
13017
|
converter: commaSeparatedConverter,
|
|
12168
13018
|
type: Array
|
|
12169
13019
|
})
|
|
12170
13020
|
], CortiDictation.prototype, "settingsEnabled", void 0);
|
|
12171
|
-
|
|
13021
|
+
__decorate10([
|
|
12172
13022
|
n4({ type: Boolean })
|
|
12173
13023
|
], CortiDictation.prototype, "allowButtonFocus", void 0);
|
|
12174
|
-
|
|
13024
|
+
__decorate10([
|
|
12175
13025
|
n4({ attribute: "debug-display-audio", type: Boolean })
|
|
12176
13026
|
], CortiDictation.prototype, "debug_displayAudio", void 0);
|
|
12177
|
-
|
|
13027
|
+
__decorate10([
|
|
12178
13028
|
n4({ attribute: false, type: Object })
|
|
12179
13029
|
], CortiDictation.prototype, "dictationConfig", null);
|
|
12180
|
-
|
|
13030
|
+
__decorate10([
|
|
12181
13031
|
r5()
|
|
12182
13032
|
], CortiDictation.prototype, "_dictationConfig", void 0);
|
|
12183
|
-
|
|
13033
|
+
__decorate10([
|
|
12184
13034
|
n4({ attribute: false, type: Array })
|
|
12185
13035
|
], CortiDictation.prototype, "devices", null);
|
|
12186
|
-
|
|
13036
|
+
__decorate10([
|
|
12187
13037
|
r5()
|
|
12188
13038
|
], CortiDictation.prototype, "_devices", void 0);
|
|
12189
|
-
|
|
13039
|
+
__decorate10([
|
|
12190
13040
|
n4({ attribute: false, type: Object })
|
|
12191
13041
|
], CortiDictation.prototype, "selectedDevice", null);
|
|
12192
|
-
|
|
13042
|
+
__decorate10([
|
|
12193
13043
|
r5()
|
|
12194
13044
|
], CortiDictation.prototype, "_selectedDevice", void 0);
|
|
12195
|
-
|
|
13045
|
+
__decorate10([
|
|
13046
|
+
n4({ type: String })
|
|
13047
|
+
], CortiDictation.prototype, "mode", null);
|
|
13048
|
+
__decorate10([
|
|
13049
|
+
r5()
|
|
13050
|
+
], CortiDictation.prototype, "_mode", void 0);
|
|
13051
|
+
__decorate10([
|
|
13052
|
+
n4({ type: String })
|
|
13053
|
+
], CortiDictation.prototype, "keybinding", null);
|
|
13054
|
+
__decorate10([
|
|
13055
|
+
r5()
|
|
13056
|
+
], CortiDictation.prototype, "_keybinding", void 0);
|
|
13057
|
+
CortiDictation = __decorate10([
|
|
12196
13058
|
t3("corti-dictation")
|
|
12197
13059
|
], CortiDictation);
|
|
12198
13060
|
|
|
@@ -12200,29 +13062,37 @@ CortiDictation = __decorate8([
|
|
|
12200
13062
|
if (!customElements.get("corti-dictation")) {
|
|
12201
13063
|
customElements.define("corti-dictation", CortiDictation);
|
|
12202
13064
|
}
|
|
12203
|
-
if (!customElements.get("recording-button")) {
|
|
12204
|
-
customElements.define("recording-button",
|
|
13065
|
+
if (!customElements.get("dictation-recording-button")) {
|
|
13066
|
+
customElements.define("dictation-recording-button", DictationRecordingButton);
|
|
13067
|
+
}
|
|
13068
|
+
if (!customElements.get("dictation-device-selector")) {
|
|
13069
|
+
customElements.define("dictation-device-selector", DictationDeviceSelector);
|
|
13070
|
+
}
|
|
13071
|
+
if (!customElements.get("dictation-language-selector")) {
|
|
13072
|
+
customElements.define("dictation-language-selector", DictationLanguageSelector);
|
|
12205
13073
|
}
|
|
12206
|
-
if (!customElements.get("
|
|
12207
|
-
customElements.define("
|
|
13074
|
+
if (!customElements.get("dictation-mode-selector")) {
|
|
13075
|
+
customElements.define("dictation-mode-selector", DictationModeSelector);
|
|
12208
13076
|
}
|
|
12209
|
-
if (!customElements.get("
|
|
12210
|
-
customElements.define("
|
|
13077
|
+
if (!customElements.get("dictation-keybinding-selector")) {
|
|
13078
|
+
customElements.define("dictation-keybinding-selector", DictationKeybindingSelector);
|
|
12211
13079
|
}
|
|
12212
|
-
if (!customElements.get("settings-menu")) {
|
|
12213
|
-
customElements.define("settings-menu",
|
|
13080
|
+
if (!customElements.get("dictation-settings-menu")) {
|
|
13081
|
+
customElements.define("dictation-settings-menu", DictationSettingsMenu);
|
|
12214
13082
|
}
|
|
12215
|
-
if (!customElements.get("dictation-
|
|
12216
|
-
customElements.define("dictation-
|
|
13083
|
+
if (!customElements.get("dictation-root")) {
|
|
13084
|
+
customElements.define("dictation-root", DictationRoot);
|
|
12217
13085
|
}
|
|
12218
13086
|
var index_default = CortiDictation;
|
|
12219
13087
|
export {
|
|
12220
13088
|
CortiDictation,
|
|
12221
|
-
|
|
12222
|
-
|
|
12223
|
-
|
|
12224
|
-
|
|
12225
|
-
|
|
13089
|
+
DictationDeviceSelector,
|
|
13090
|
+
DictationKeybindingSelector,
|
|
13091
|
+
DictationLanguageSelector,
|
|
13092
|
+
DictationModeSelector,
|
|
13093
|
+
DictationRecordingButton,
|
|
13094
|
+
DictationRoot,
|
|
13095
|
+
DictationSettingsMenu,
|
|
12226
13096
|
index_default as default
|
|
12227
13097
|
};
|
|
12228
13098
|
/*! Bundled license information:
|