augnitosdk
Version:
AugnitoSDK lets you make use of the Speech Recognition AI. You can edit, format and complete reports at the speed of human speech, with the best-in-class accuracy
1,323 lines (1,307 loc) • 460 kB
JavaScript
// src/support/AugnitoSDKErrors.ts
var AugnitoSDKError = /* @__PURE__ */ ((AugnitoSDKError2) => {
AugnitoSDKError2[AugnitoSDKError2["ERR_NETWORK"] = 1] = "ERR_NETWORK";
AugnitoSDKError2[AugnitoSDKError2["ERR_AUDIO"] = 2] = "ERR_AUDIO";
AugnitoSDKError2[AugnitoSDKError2["ERR_SERVER"] = 3] = "ERR_SERVER";
AugnitoSDKError2[AugnitoSDKError2["ERR_CLIENT"] = 4] = "ERR_CLIENT";
return AugnitoSDKError2;
})(AugnitoSDKError || {});
// src/utils/Logger.ts
var Logger = class {
static defaultTag = "AugnitoSDK";
static log(message, tag) {
const logTag = tag != null ? tag : this.defaultTag;
console.log(`${logTag}:`, message);
}
static error(message, tag) {
const logTag = tag != null ? tag : this.defaultTag;
console.error(`${logTag}:`, message);
}
};
// src/client/WebClient.ts
var WebClient = class {
_logTag = "WebClient";
_speechSocket = null;
// private _audioStream: MediaStream | null = null;
_isConnecting = false;
_config;
constructor(config) {
this._config = config;
}
isConnecting() {
return this._isConnecting;
}
/**
* Returns the connected state
* @returns true, if the socket state is OPEN; otherwise false
*/
get connected() {
return this._speechSocket !== null && this._speechSocket.readyState === WebSocket.OPEN;
}
/**
* Retrieves the client SDK configuration
* @returns The SDKConfig
*/
getConfig() {
return this._config;
}
/**
* Toggles the Speech API connection
* @description if already connected, it will stop the web socket; otherwise, it will start a new connection
*/
toggleListening() {
if (this._isConnecting) {
return;
}
if (this._speechSocket) {
this.stopListening(true);
return;
}
this.startListening(this._config.prepareSpeechURL(), 0 /* WEB_APP */);
}
/**
* @description
* Creates Augnito Client
*
* @param {String} socketURL The URL of the socket
* @param {AugnitoSource} source The source of the application
*/
startListening(socketURL, source) {
if (this._isConnecting) {
return;
}
if (localStorage.getItem("AugnitoConnectionStatus" /* KEY */) === "On" /* ON */) {
this.onMicrophoneOnError();
return;
}
try {
this._isConnecting = true;
this._config.source = source;
if (this._speechSocket) {
this.closeWebSocket();
}
this.onEvent(1 /* WS_CONNECTING */, "Connecting ...");
this.createWebSocket(socketURL);
} catch (e2) {
this.onError(2 /* ERR_AUDIO */, "unable to start listening");
}
}
/**
* Stops the web socket if the connection is alive.
* @param alertEndOfSession If true, EndOfSession event will be fired.
* @returns
*/
stopListening(alertEndOfSession) {
if (this._isConnecting) {
return;
}
this.clearAll();
if (alertEndOfSession) {
this.onEndOfSession();
}
this._isConnecting = false;
}
/**
* closes all sockets and streams
*/
dispose() {
this.stopListening(false);
}
createWebSocket(socketUrl) {
this._speechSocket = new WebSocket(socketUrl);
this._speechSocket.onmessage = (e2) => {
try {
const augnitoResponse = JSON.parse(e2.data);
if (augnitoResponse.Status !== 0) {
this.onError(
3 /* ERR_SERVER */,
`Server error: ${augnitoResponse.Status}`
);
}
if (augnitoResponse.Type === "meta") {
this.onSessionEvent(augnitoResponse);
return;
}
if (augnitoResponse.Result.Final) {
this.onSocketFinalResult(augnitoResponse);
} else {
this.onSocketPartialResult(augnitoResponse.Result);
}
} catch (e3) {
this.onError(3 /* ERR_SERVER */, "invalid response");
}
};
this._speechSocket.onopen = (e2) => {
this.onReadyForSpeech();
this.onEvent(9 /* MSG_WEB_SOCKET_OPEN */, e2.toString());
this._isConnecting = false;
};
this._speechSocket.onclose = ({ code, reason, wasClean }) => {
this.clearAll();
this.onEndOfSession();
this.onEvent(
10 /* MSG_WEB_SOCKET_CLOSE */,
`${code}/${reason}/${wasClean}`
);
this._isConnecting = false;
};
this._speechSocket.onerror = (e2) => {
this.clearAll();
this.onError(1 /* ERR_NETWORK */, e2.toString());
this.onEndOfSession();
this._isConnecting = false;
};
}
// private startAudioStream(): void {
// if (this._config.source === AugnitoSource.MOBILE_APP) {
// return;
// }
// // support for old browser (added types via @types/webrtc)
// navigator.getUserMedia =
// navigator.getUserMedia ||
// navigator.webkitGetUserMedia ||
// navigator.mozGetUserMedia;
// const audioSourceConstraints = { audio: true, video: false };
// if (navigator.getUserMedia) {
// navigator.getUserMedia(
// audioSourceConstraints,
// (stream: MediaStream) => {
// this.processAudioStream(stream);
// },
// () => {
// this.clearAll();
// this.onError(
// AugnitoSDKError.ERR_CLIENT,
// 'No live audio input in this browser'
// );
// }
// );
// } else if (navigator.mediaDevices.getUserMedia) {
// navigator.mediaDevices
// .getUserMedia(audioSourceConstraints)
// .then((stream: MediaStream) => {
// this.processAudioStream(stream);
// })
// .catch(() => {
// this.clearAll();
// this.onError(
// AugnitoSDKError.ERR_CLIENT,
// 'No live audio input in this browser'
// );
// });
// } else {
// this.clearAll();
// this.onError(AugnitoSDKError.ERR_CLIENT, 'No user media support');
// }
// }
// private processAudioStream(stream: MediaStream): void {
// this._audioStream = stream;
// this.onEvent(
// AugnitoSDKEvent.MSG_MEDIA_STREAM_CREATED,
// 'Media stream created'
// );
// const options: RecordRTC.Options = {
// mimeType: 'audio/wav',
// type: 'audio',
// checkForInactiveTracks: true,
// desiredSampRate: 16000,
// timeSlice: this._config.interval,
// numberOfAudioChannels: 1,
// disableLogs: true,
// noHeaders: true,
// leftChannel: false,
// noWorker: true,
// noBlobOnStop: true,
// recorderType: RecordRTC.StereoAudioRecorder,
// ondataavailable: (e: Blob) => {
// this.socketSend(e);
// }
// };
// this._recorder = new RecordRTC(stream, options);
// if (!this._recorder) {
// this.onError(AugnitoSDKError.ERR_AUDIO, 'Recorder undefined');
// return;
// }
// this.onEvent(AugnitoSDKEvent.MSG_INIT_RECORDER, 'Recorder initialized');
// this._recorder.startRecording();
// this.onEvent(AugnitoSDKEvent.MSG_RECORDING, 'Recording started');
// }
// private socketSend(item: Blob): void {
// if (this._speechSocket) {
// const state = this._speechSocket.readyState;
// if (state === WebSocket.OPEN) {
// // If item is an audio blob
// if (item instanceof Blob) {
// if (item.size > 0) {
// this._speechSocket.send(item);
// } else {
// this.onEvent(
// AugnitoSDKEvent.MSG_SEND_EMPTY,
// `Send: blob: ${item.type}, EMPTY`
// );
// }
// } else {
// this._speechSocket.send(item);
// }
// } else {
// this.clearAll();
// this.onError(
// AugnitoSDKError.ERR_NETWORK,
// `WebSocket: readyState!=1: ${state}: failed to send: ${item}`
// );
// }
// } else {
// this.clearAll();
// this.onError(
// AugnitoSDKError.ERR_CLIENT,
// `No web socket connection: failed to send: ${item}`
// );
// }
// }
clearAll() {
if (this._speechSocket) {
localStorage.setItem("AugnitoConnectionStatus" /* KEY */, "Off" /* OFF */);
}
this.closeWebSocket();
}
closeWebSocket() {
if (this._speechSocket) {
try {
this._speechSocket.close();
this._speechSocket = null;
} catch (e2) {
this.onError(1 /* ERR_NETWORK */, "unable to close socket");
}
}
}
// private stopStream(): void {
// if (this._audioStream) {
// try {
// this._audioStream.getAudioTracks()[0].stop();
// } catch (e) {
// this.onError(AugnitoSDKError.ERR_AUDIO, 'unable to stop stream');
// }
// }
// }
// private stopRecorder(): void {
// if (this._recorder) {
// try {
// this._recorder.startRecording();
// this.onEvent(AugnitoSDKEvent.MSG_STOP, 'Stopped recorderRTC');
// } catch (error) {
// this.onError(AugnitoSDKError.ERR_CLIENT, 'unable to stop recorder');
// }
// }
// }
onPartialText(text) {
if (this._config.onSocketPartialResult) {
this._config.onSocketPartialResult(text);
}
}
//#region callbacks
onEvent(event, data) {
if (this._config.enableLogs) {
Logger.log({ type: "AugnitoSDKEvent", data }, this._logTag);
}
if (this._config.onEvent) {
this._config.onEvent(event, data);
}
}
onError(error, data) {
if (this._config.enableLogs) {
Logger.error({ type: "onError", error, data }, this._logTag);
}
if (this._config.onError) {
this._config.onError(data);
}
}
onSocketPartialResult(data) {
if (this._config.enableLogs) {
Logger.log({ type: "onSocketPartialResult", data }, this._logTag);
}
this.onPartialText(data.Transcript);
}
onSocketFinalResult(data) {
if (this._config.enableLogs) {
Logger.log({ type: "onSocketFinalResult", data }, this._logTag);
}
if (this._config.onSocketFinalResult) {
this._config.onSocketFinalResult(data);
}
}
onSessionEvent(data) {
if (this._config.enableLogs) {
Logger.log({ type: "onSessionEvent", data }, this._logTag);
}
if (this._config.onSessionEvent) {
this._config.onSessionEvent(data);
}
}
onEndOfSession() {
if (this._config.onEndOfSession) {
this._config.onEndOfSession(false);
}
}
onReadyForSpeech() {
if (this._config.onReadyForSpeech) {
this._config.onReadyForSpeech(true);
}
}
onMicrophoneOnError() {
if (this._config.onMicrophoneOnError) {
this._config.onMicrophoneOnError(true);
}
}
//#endregion
};
// src/client/MobileClient.ts
var MobileClient = class {
constructor(_config, _notificationClient) {
this._config = _config;
this._notificationClient = _notificationClient;
this._notificationClient.ensureNotificationClientConnected();
this._notificationClient.onMobileScan = this.onMobileScanCallback.bind(this);
this._notificationClient.onConnectionRequest = this.onConnectionRequestCallback.bind(this);
}
_logTag = "MobileClient";
/** Callback when a mobile client is requesting to connect */
onConnectionRequest;
/** Callback when a mobile client has scanned the QR Code */
onMobileScan;
dispose() {
this._notificationClient.dispose();
}
onMobileScanCallback() {
if (this.onMobileScan) {
this.onMobileScan();
}
}
onConnectionRequestCallback(augnitoResponse) {
this.createWebSocketForMobileMic(augnitoResponse);
if (this.onConnectionRequest) {
this.onConnectionRequest();
}
}
createWebSocketForMobileMic(JSONResponse) {
if (!this._notificationClient) {
Logger.error(
"Unable to create socket for mobile mic: pushNotificationSocket not created",
this._logTag
);
return;
}
if (localStorage.getItem("AugnitoConnectionStatus" /* KEY */) === "On" /* ON */) {
this._notificationClient.Send(
this._notificationClient.getReplyMessage(
JSONResponse,
"DEVICE_ALREADY_IN_USE"
)
);
if (this._config.onMicrophoneOnError) {
this._config.onMicrophoneOnError(false);
}
Logger.error("Device already in use", this._logTag);
return;
}
if (this._config.userTag !== JSONResponse.Data.UserTag) {
this._notificationClient.Send(
this._notificationClient.getReplyMessage(
JSONResponse,
"DIFFERENT_LOGIN_USER"
)
);
return;
}
this._config.startListening(JSONResponse);
}
stopMobileListening() {
this._config.stopListening();
}
};
// src/commands/AugnitoCommands.ts
var AugnitoCommands = /* @__PURE__ */ ((AugnitoCommands2) => {
AugnitoCommands2["BOLD_IT"] = "boldit";
AugnitoCommands2["UN_BOLD_IT"] = "unboldit";
AugnitoCommands2["UNDERLINE_IT"] = "underlineit";
AugnitoCommands2["ITALICIZE_IT"] = "italicizeit";
AugnitoCommands2["UNITALICIZE_IT"] = "unitalicizeit";
AugnitoCommands2["COPY_IT"] = "copyit";
AugnitoCommands2["CUT_IT"] = "cutit";
AugnitoCommands2["PASTE_IT"] = "pasteit";
AugnitoCommands2["PRESS_DELETE"] = "pressdelete";
AugnitoCommands2["HEADER_IT"] = "headerit";
AugnitoCommands2["CAPITALIZED_IT"] = "capitalizeit";
AugnitoCommands2["UN_CAPITALIZED_IT"] = "uncapitalizeit";
AugnitoCommands2["UNDO_IT"] = "undoit";
AugnitoCommands2["REDO_IT"] = "redoit";
AugnitoCommands2["SELECT_PREVIOUS_WORD"] = "selectpreviousword";
AugnitoCommands2["SELECT_NEXT_WORD"] = "selectnextword";
AugnitoCommands2["SELECT_WORD"] = "selectword";
AugnitoCommands2["SELECT_ALL"] = "selectall";
AugnitoCommands2["SELECT"] = "select";
AugnitoCommands2["DESELECT_IT"] = "deselectit";
AugnitoCommands2["GO_TO_LINE_START"] = "gotolinestart";
AugnitoCommands2["GO_TO_LINE_END"] = "gotolineend";
AugnitoCommands2["SELECT_ACTIVE_LINE"] = "selectactiveline";
AugnitoCommands2["SELECT_ACTIVE_PARAGRAPH"] = "selectactiveparagraph";
AugnitoCommands2["SELECT_ACTIVE_WORD"] = "selectactiveword";
AugnitoCommands2["SELECT_ACTIVE_SENTENCE"] = "selectactivesentence";
AugnitoCommands2["SELECT_ACTIVE_CHAR"] = "selectactivechar";
AugnitoCommands2["BULLET_LIST_START"] = "bulletliststart";
AugnitoCommands2["NUMBER_LIST_START"] = "numberliststart";
AugnitoCommands2["BULLET_LIST_STOP"] = "bulletliststop";
AugnitoCommands2["NUMBER_LIST_STOP"] = "numberliststop";
AugnitoCommands2["LIST_STOP"] = "stoplist";
AugnitoCommands2["ALIGN_LEFT"] = "alignleft";
AugnitoCommands2["ALIGN_RIGHT"] = "alignright";
AugnitoCommands2["ALIGN_CENTER"] = "aligncenter";
AugnitoCommands2["ALIGN_JUSTIFY"] = "alignjustify";
AugnitoCommands2["STOP_MIC"] = "stopmic";
AugnitoCommands2["GO_UP"] = "goup";
AugnitoCommands2["GO_DOWN"] = "godown";
AugnitoCommands2["GO_RIGHT"] = "goright";
AugnitoCommands2["GO_LEFT"] = "goleft";
AugnitoCommands2["TAB_SPACE_ADD"] = "tabspaceadd";
AugnitoCommands2["SPACE_ADD"] = "spaceadd";
AugnitoCommands2["BACKSPACE"] = "backspace";
AugnitoCommands2["START_BOLD_TEXT"] = "boldstart";
AugnitoCommands2["STOP_BOLD_TEXT"] = "boldstop";
AugnitoCommands2["GO_TO_DOCUMENT_START"] = "gotodocumentstart";
AugnitoCommands2["GO_TO_DOCUMENT_END"] = "gotodocumentend";
AugnitoCommands2["GO_TO_NEXT_PAGE"] = "gotonextpage";
AugnitoCommands2["GO_TO_PREVIOUS_PAGE"] = "gotopreviouspage";
AugnitoCommands2["OK"] = "ok";
AugnitoCommands2["DOCUMENT_SAVE"] = "documentsave";
AugnitoCommands2["DOCUMENT_PRINT"] = "documentprint";
AugnitoCommands2["NEW_DOCUMENT"] = "newdocument";
AugnitoCommands2["SELECT_PARAGRAPH"] = "paragraph";
AugnitoCommands2["NEXT_LINE_TEXT"] = "@newline@";
AugnitoCommands2["SELECT_LINE"] = "selectline";
AugnitoCommands2["SELECT_CHAR"] = "char";
AugnitoCommands2["SELECT_SENTENCE"] = "selectsentence";
AugnitoCommands2["DELETE"] = "delete";
AugnitoCommands2["GOTO"] = "goto";
AugnitoCommands2["DELETE_PREVIOUS_WORD"] = "deletepreviousword";
AugnitoCommands2["UNDERLIE_PREVIOUS_WORD"] = "underlinepreviousword";
AugnitoCommands2["CAPITALIZE_PREVIOUS_WORD"] = "capitalizepreviousword";
AugnitoCommands2["ITALICIZE_PREVIOUS_WORD"] = "italicizepreviousword";
AugnitoCommands2["BOLD_PREVIOUS_WORD"] = "boldpreviousword";
AugnitoCommands2["BOLD_LAST_LINE"] = "boldlastline";
AugnitoCommands2["DELETE_NEXT_WORD"] = "deletenextword";
AugnitoCommands2["DELETE_PREVIOUS_LINE"] = "deletepreviousline";
AugnitoCommands2["SELECT_PREVIOUS_LINE"] = "selectpreviousline";
AugnitoCommands2["BOLD_PREVIOUS_LINE"] = "boldpreviousline";
AugnitoCommands2["UNDERLINE_PREVIOUS_LINE"] = "underlinepreviousline";
AugnitoCommands2["ITALICIZE_PREVIOUS_LINE"] = "italicizepreviousline";
AugnitoCommands2["CAPITALIZE_PREVIOUS_LINE"] = "capitalizepreviousline";
AugnitoCommands2["SELECT_NEXT_LINE"] = "selectnextline";
AugnitoCommands2["SELECT_PREVIOUS_PARAGRAPH"] = "selectpreviousparagraph";
AugnitoCommands2["SELECT_NEXT_PARAGRAPH"] = "selectnextparagraph";
AugnitoCommands2["SETFONTSIZEN"] = "setfontsize";
AugnitoCommands2["INSERT_BEFORE_TEXT"] = "insertbefore";
AugnitoCommands2["INSERT_AFTER_TEXT"] = "insertafter";
AugnitoCommands2["DELETE_PREVIOUS_SENTENCE"] = "deleteprevioussentence";
AugnitoCommands2["SELECT_PREVIOUS_SENTENCE"] = "selectprevioussentence";
AugnitoCommands2["SELECT_NEXT_SENTENCE"] = "selectnextsentence";
AugnitoCommands2["START_CAPITAL_TEXT"] = "capitalizestart";
AugnitoCommands2["STOP_CAPITAL_TEXT"] = "capitalizestop";
AugnitoCommands2["NEXT_FIELD"] = "dynamicfieldnext";
AugnitoCommands2["PREVIOUS_FIELD"] = "dynamicfieldprevious";
AugnitoCommands2["GET_ORDER"] = "getorder";
AugnitoCommands2["ADD_MEDICINE"] = "addmedicine";
AugnitoCommands2["NUMBER"] = "number";
return AugnitoCommands2;
})(AugnitoCommands || {});
// src/commands/utils/TextToWordInteger.ts
var TextWordToInteger = class {
_wordToDigit = {
zero: 0,
one: 1,
two: 2,
three: 3,
four: 4,
five: 5,
six: 6,
seven: 7,
eight: 8,
nine: 9,
ten: 10,
x: 10,
eleven: 11,
twelve: 12,
thirteen: 13,
fourteen: 14,
fifteen: 15,
sixteen: 16,
seventeen: 17,
eighteen: 18,
nineteen: 19,
twenty: 20,
twentyone: 21,
twentytwo: 22,
twentythree: 23,
twentyfour: 24,
twentyfive: 25,
twentysix: 26,
twentyseven: 27,
twentyeight: 28,
twentynine: 29,
thirty: 30,
thirtyone: 31,
thirtytwo: 32,
thirtythree: 33,
thirtyfour: 34,
thirtyfive: 35,
thirtysix: 36,
thirtyseven: 37,
thirtyeight: 38,
thirtynine: 39,
forty: 40,
fortyone: 41,
fortytwo: 42,
fortythree: 43,
fortyfour: 44,
fortyfive: 45,
fortysix: 46,
fortyseven: 47,
fortyeight: 48,
fortynine: 49,
fifty: 50,
fiftyone: 51,
fiftytwo: 52,
fiftythree: 53,
fiftyfour: 54,
fiftyfive: 55,
fiftysix: 56,
fiftyseven: 57,
fiftyeight: 58,
fiftynine: 59,
sixty: 60,
sixtyone: 61,
sixtytwo: 62,
sixtythree: 63,
sixtyfour: 64,
sixtyfive: 65,
sixtysix: 66,
sixtyseven: 67,
sixtyeight: 68,
sixtynine: 69,
seventy: 70,
seventyone: 71,
seventytwo: 72,
seventythree: 73,
seventyfour: 74,
seventyfive: 75,
seventysix: 76,
seventyseven: 77,
seventyeight: 78,
seventynine: 79,
eighty: 80,
eightyone: 81,
eightytwo: 82,
eightythree: 83,
eightyfour: 84,
eightyfive: 85,
eightysix: 86,
eightyseven: 87,
eightyeight: 88,
eightynine: 89,
ninety: 90,
ninetyone: 91,
ninetytwo: 92,
ninetythree: 93,
ninetyfour: 94,
ninetyfive: 95,
ninetysix: 96,
ninetyseven: 97,
ninetyeight: 98,
ninetynine: 99,
onehundred: 100
};
parse(word) {
let result = 0;
if (word) {
word = word.replace(/ /gi, "").toLowerCase().trim();
if (word) {
result = parseInt(word);
if (isNaN(result) && word in this._wordToDigit) {
result = this._wordToDigit[word];
}
}
}
return result;
}
};
// src/commands/AugnitoCommandsRegex.ts
var ACTION_CMD = "select|choose|copy text|copytext|cut text|cuttext|correct|bold|underline|delete|header|capitalize|unbold|debold|dbold|uncapitalize|remove|capitalise|dcapitalise|dcapitalize|decapitalize|decapitalise|uncapitalise|Uncap|d capitalise|d capitalize|d underline|dunderline|deunderline|ununderline|goto|moveto|move|italicize|italicise|unitalicise|unitalicize";
var AugnitoCommandsRegex = class {
static prepareRecipe(command) {
let cmdText = command.receivedText.replace(
/\n/gi,
"@newline@" /* NEXT_LINE_TEXT */
);
cmdText = cmdText.replace(/ /gi, "").toLowerCase().trim();
cmdText = cmdText.replace(
new RegExp("@newline@" /* NEXT_LINE_TEXT */, "gi"),
"\n"
);
command.name = cmdText;
command.receivedTextWithoutSpace = cmdText;
return this.fillDynamicCommand(command, cmdText);
}
static fillDynamicCommand(recipe, commandText) {
const textWordToInteger = new TextWordToInteger();
const baseRecipe = {
sessionCode: recipe.sessionCode,
isCommand: recipe.isCommand,
final: recipe.final,
receivedText: recipe.receivedText,
receivedTextWithoutSpace: commandText,
action: recipe.action
};
if (commandText === "goto\n" || commandText === "move\n" || commandText === "moveto\n") {
return {
...baseRecipe,
name: "selectline" /* SELECT_LINE */,
nextPrevious: "next",
chooseNumber: 1,
isCommand: true,
selectFor: "gotoend",
action: "select" /* SELECT */
};
}
if (commandText === "delete\n") {
return {
...baseRecipe,
name: "selectline" /* SELECT_LINE */,
nextPrevious: "next",
chooseNumber: 1,
isCommand: true,
selectFor: "delete",
action: "select" /* SELECT */
};
}
if (commandText === "goto\n\n" || commandText === "move\n\n" || commandText === "moveto\n\n") {
return {
name: "paragraph" /* SELECT_PARAGRAPH */,
nextPrevious: "next",
chooseNumber: 1,
isCommand: true,
selectFor: "gotoend",
action: "select" /* SELECT */
};
}
const ACTIVE_X = new RegExp(
"^(" + ACTION_CMD + ")(the)?(active|current)?(word[s]?|line[s]?|sentence[s]?|paragraph[s]?|para[s]?|char[s]?|character[s]?|space|\n\n|\n)$",
"gi"
);
const ACTIVE_X_Matches = ACTIVE_X.exec(commandText.trim());
if (ACTIVE_X_Matches && ACTIVE_X_Matches.length > 4) {
let cmdAction = ACTIVE_X_Matches[1];
cmdAction = this.setActionCommandVariant(cmdAction);
const item = ACTIVE_X_Matches[4].toLowerCase();
if (item && cmdAction) {
var _recipe = {
...baseRecipe,
name: this.setActiveObjectType(item),
searchText: item,
isCommand: true,
selectFor: cmdAction === "select" /* SELECT */ ? "" : cmdAction,
action: "select" /* SELECT */
};
if (_recipe.nextPrevious == void 0 && ACTIVE_X_Matches[2] == void 0) {
_recipe.nextPrevious = "next";
}
return _recipe;
}
}
const NAVIGATION_WITHOUT_GO_TO = new RegExp(
// eslint-disable-next-line no-control-regex
"^(last|previous|next|down)(.*?)(word[s]?|line[s]?|sentence[s]?|paragraph[s]?|para[s]?|char[s]?|character[s]?|space|\n\n|\n)$",
"gi"
);
const NavigationWithoutGoToMatches = NAVIGATION_WITHOUT_GO_TO.exec(
commandText.trim()
);
if (NavigationWithoutGoToMatches && NavigationWithoutGoToMatches.length > 3) {
const direction = NavigationWithoutGoToMatches[1];
const item = NavigationWithoutGoToMatches[3].toLowerCase();
return {
...baseRecipe,
name: this.setSelectObjectType(item),
nextPrevious: direction,
chooseNumber: 1,
isCommand: true,
selectFor: direction === "preivous" || direction === "last" ? "gotostart" : "gotoend",
action: "select" /* SELECT */
};
}
const SELECT_WORD_LINE_NEXT_PREVIOUS = new RegExp(
"^(" + ACTION_CMD + ")(the)?(last|previous|next)(.*?)(word[s]?|line[s]?|sentence[s]?|paragraph[s]?|para[s]?|char[s]?|character[s]?|space|\n\n|\n)$",
"gi"
);
const SelectManyWordMatches = SELECT_WORD_LINE_NEXT_PREVIOUS.exec(commandText);
if (SelectManyWordMatches && SelectManyWordMatches.length > 3) {
const cmdAction = this.setActionCommandVariant(
SelectManyWordMatches[1].toLowerCase()
);
const direction = SelectManyWordMatches[3];
let wordCount = textWordToInteger.parse(SelectManyWordMatches[4]);
wordCount = wordCount === 0 ? 1 : wordCount;
const item = SelectManyWordMatches[5].toLowerCase();
if (item && cmdAction && direction) {
recipe.name = this.setSelectObjectType(item);
recipe.nextPrevious = direction;
recipe.chooseNumber = wordCount;
recipe.searchText = item;
recipe.isCommand = true;
recipe.selectFor = "select" /* SELECT */ === cmdAction ? "" : cmdAction;
recipe.action = "select" /* SELECT */;
return recipe;
}
}
if (commandText.trim().startsWith("setfontsize" /* SETFONTSIZEN */)) {
const SET_FONT_SIZE = new RegExp(
"^setfontsize(to)?([0-9]+)(point[s]?)?$",
"gi"
);
const SET_FONT_SIZE_Matches = SET_FONT_SIZE.exec(commandText.trim());
if (SET_FONT_SIZE_Matches && SET_FONT_SIZE_Matches.length > 2) {
recipe.name = "setfontsize" /* SETFONTSIZEN */;
recipe.fontSize = textWordToInteger.parse(SET_FONT_SIZE_Matches[2]);
recipe.isCommand = true;
return recipe;
}
}
if (recipe.receivedText) {
const SELECT_GROUP_2 = new RegExp(
"^(" + ACTION_CMD + ")( )(the)?(.*?)$",
"gi"
);
const SelectMatches = SELECT_GROUP_2.exec(recipe.receivedText.trim());
if (SelectMatches && SelectMatches.length > 3) {
let cmdAction = SelectMatches[1];
cmdAction = this.setActionCommandVariant(cmdAction.toLowerCase());
const searchText = SelectMatches[4];
if (searchText) {
recipe.name = "select" /* SELECT */;
recipe.searchText = searchText.trim();
recipe.isCommand = true;
recipe.selectFor = "select" /* SELECT */ === cmdAction ? "" : cmdAction;
return recipe;
}
}
if (commandText.trim().startsWith("insertbefore" /* INSERT_BEFORE_TEXT */)) {
recipe.name = "insertbefore" /* INSERT_BEFORE_TEXT */;
recipe.searchText = recipe.receivedText.trim();
recipe.searchText = recipe.searchText.trim().substr(6);
recipe.searchText = recipe.searchText.trim().substr(6).trim();
recipe.isCommand = true;
return recipe;
}
if (commandText.trim().startsWith("insertafter" /* INSERT_AFTER_TEXT */)) {
recipe.name = "insertafter" /* INSERT_AFTER_TEXT */;
recipe.searchText = recipe.receivedText.trim();
recipe.searchText = recipe.searchText.trim().substr(6);
recipe.searchText = recipe.searchText.trim().substr(5).trim();
recipe.isCommand = true;
return recipe;
}
if (recipe.name && recipe.name.startsWith("goto" /* GOTO */)) {
recipe.name = "goto" /* GOTO */;
recipe.searchText = recipe.receivedText.trim().substr(2);
recipe.searchText = recipe.searchText.trim().substr(2).trim();
recipe.isCommand = true;
return recipe;
}
}
return recipe;
}
//#region private
static setActionCommandVariant(cmdAction) {
return cmdAction === "d capitalise" ? "uncapitalize" : cmdAction === "d capitalize" ? "uncapitalize" : cmdAction === "decapitalize" ? "uncapitalize" : cmdAction === "decapitalise" ? "uncapitalize" : cmdAction === "dcapitalise" ? "uncapitalize" : cmdAction === "dcapitalize" ? "uncapitalize" : cmdAction === "uncapitalize" ? "uncapitalize" : cmdAction === "uncapitalise" ? "uncapitalize" : cmdAction === "uncap" ? "uncapitalize" : cmdAction === "d underline" ? "deunderline" : cmdAction === "dunderline" ? "deunderline" : cmdAction === "dunderline" ? "dunderline" : cmdAction === "ununderline" ? "deunderline" : cmdAction === "capitalise" ? "capitalize" : cmdAction === "remove" ? "delete" : cmdAction === "goto" ? "gotostart" : cmdAction === "move" ? "gotostart" : cmdAction === "debold" ? "unbold" : cmdAction === "dbold" ? "unbold" : cmdAction === "cuttext" ? "cut" : cmdAction === "cut text" ? "cut" : cmdAction === "copytext" ? "copy" : cmdAction === "copy text" ? "copy" : cmdAction === "choose" ? "select" : cmdAction === "italicise" ? "italicize" : cmdAction === "unitalicise" ? "unitalicize" : cmdAction === "movto" ? "gotostart" : cmdAction;
}
static setActiveObjectType(item) {
return item === "word" || item === "words" ? "selectactiveword" /* SELECT_ACTIVE_WORD */ : item === "sentence" || item === "sentences" ? "selectactivesentence" /* SELECT_ACTIVE_SENTENCE */ : item === "line" || item === "lines" ? "selectactiveline" /* SELECT_ACTIVE_LINE */ : item === "paragraph" || item === "paragraphs" ? "selectactiveparagraph" /* SELECT_ACTIVE_PARAGRAPH */ : item === "para" || item === "paras" ? "selectactiveparagraph" /* SELECT_ACTIVE_PARAGRAPH */ : item === "\n\n" ? "selectactiveparagraph" /* SELECT_ACTIVE_PARAGRAPH */ : item === "\n" ? "selectline" /* SELECT_LINE */ : item === "char" || item === "chars" ? "selectactivechar" /* SELECT_ACTIVE_CHAR */ : item === "space" ? "selectactivechar" /* SELECT_ACTIVE_CHAR */ : item === "character" || item === "characters" ? "selectactivechar" /* SELECT_ACTIVE_CHAR */ : item;
}
static setSelectObjectType(item) {
return "word" == item || "words" == item ? "selectword" /* SELECT_WORD */ : "sentence" == item || "sentences" == item ? "selectsentence" /* SELECT_SENTENCE */ : "line" == item || "lines" == item ? "selectline" /* SELECT_LINE */ : "paragraph" == item || "paragraphs" == item ? "paragraph" /* SELECT_PARAGRAPH */ : "para" == item || "paras" == item ? "paragraph" /* SELECT_PARAGRAPH */ : "\n\n" == item ? "paragraph" /* SELECT_PARAGRAPH */ : "\n\ns" == item.toLowerCase() ? "paragraph" /* SELECT_PARAGRAPH */ : "\n" == item ? "selectline" /* SELECT_LINE */ : "\ns" == item.toLowerCase() ? "selectline" /* SELECT_LINE */ : "char" == item || "chars" == item ? "char" /* SELECT_CHAR */ : "space" == item ? "char" /* SELECT_CHAR */ : "character" == item || "characters" == item ? "char" /* SELECT_CHAR */ : item;
}
//#endregion
};
// src/commands/AugnitoCommandsStatic.ts
var AugnitoCommandsStatic = class {
static createGoToDocumentEndCommand() {
return {
action: "gotodocumentend",
final: true,
isCommand: true,
name: "gotodocumentend",
receivedText: " go to document end",
receivedTextWithoutSpace: "gotodocumentend"
};
}
static prepareRecipe(command) {
let commandText = command.receivedText.replace(
/\n/gi,
"@newline@" /* NEXT_LINE_TEXT */
);
commandText = commandText.replace(/ /gi, "").toLowerCase().trim();
commandText = commandText.replace(
new RegExp("@newline@" /* NEXT_LINE_TEXT */, "gi"),
"\n"
);
const baseRecipe = {
action: command.action,
sessionCode: command.sessionCode,
isCommand: command.isCommand,
final: command.final,
receivedText: command.receivedText,
receivedTextWithoutSpace: commandText
};
switch (command.action) {
case "deletepreviousword" /* DELETE_PREVIOUS_WORD */:
return {
...baseRecipe,
name: "selectword" /* SELECT_WORD */,
chooseNumber: 1,
nextPrevious: "previous",
selectFor: "delete",
action: "select" /* SELECT */
};
case "deletepreviousline" /* DELETE_PREVIOUS_LINE */:
return {
...baseRecipe,
name: "selectline" /* SELECT_LINE */,
chooseNumber: 1,
nextPrevious: "previous",
selectFor: "delete",
action: "select" /* SELECT */
};
case "boldlastline" /* BOLD_LAST_LINE */:
return {
...baseRecipe,
name: "selectline" /* SELECT_LINE */,
chooseNumber: 1,
nextPrevious: "previous",
selectFor: "bold"
};
case "selectpreviousline" /* SELECT_PREVIOUS_LINE */:
return {
...baseRecipe,
name: "selectline" /* SELECT_LINE */,
chooseNumber: 1,
nextPrevious: "previous",
action: "select" /* SELECT */
};
case "selectpreviousparagraph" /* SELECT_PREVIOUS_PARAGRAPH */:
return {
...baseRecipe,
name: "paragraph" /* SELECT_PARAGRAPH */,
chooseNumber: 1,
nextPrevious: "previous",
action: "select" /* SELECT */
};
case "selectnextparagraph" /* SELECT_NEXT_PARAGRAPH */:
return {
...baseRecipe,
name: "paragraph" /* SELECT_PARAGRAPH */,
chooseNumber: 1,
nextPrevious: "next",
action: "select" /* SELECT */
};
case "selectnextline" /* SELECT_NEXT_LINE */:
return {
...baseRecipe,
name: "selectline" /* SELECT_LINE */,
chooseNumber: 1,
nextPrevious: "next",
action: "select" /* SELECT */
};
case "deleteprevioussentence" /* DELETE_PREVIOUS_SENTENCE */:
return {
...baseRecipe,
name: "selectsentence" /* SELECT_SENTENCE */,
chooseNumber: 1,
nextPrevious: "previous",
selectFor: "delete",
action: "select" /* SELECT */
};
case "selectnextsentence" /* SELECT_NEXT_SENTENCE */:
return {
...baseRecipe,
name: "selectsentence" /* SELECT_SENTENCE */,
chooseNumber: 1,
nextPrevious: "next",
action: "select" /* SELECT */
};
case "selectprevioussentence" /* SELECT_PREVIOUS_SENTENCE */:
return {
...baseRecipe,
name: "selectsentence" /* SELECT_SENTENCE */,
chooseNumber: 1,
nextPrevious: "previous",
action: "select" /* SELECT */
};
case "boldpreviousword" /* BOLD_PREVIOUS_WORD */:
return {
...baseRecipe,
name: "selectword" /* SELECT_WORD */,
chooseNumber: 1,
nextPrevious: "last",
selectFor: "bold",
action: "select" /* SELECT */
};
case "capitalizepreviousword" /* CAPITALIZE_PREVIOUS_WORD */:
return {
...baseRecipe,
name: "selectword" /* SELECT_WORD */,
chooseNumber: 1,
nextPrevious: "last",
selectFor: "capitalize"
};
case "italicizepreviousword" /* ITALICIZE_PREVIOUS_WORD */:
return {
...baseRecipe,
name: "selectword" /* SELECT_WORD */,
chooseNumber: 1,
nextPrevious: "last",
selectFor: "italicize"
};
case "underlinepreviousword" /* UNDERLIE_PREVIOUS_WORD */:
return {
...baseRecipe,
name: "selectword" /* SELECT_WORD */,
chooseNumber: 1,
nextPrevious: "last",
selectFor: "underline",
action: "select" /* SELECT */
};
case "selectpreviousword" /* SELECT_PREVIOUS_WORD */:
return {
...baseRecipe,
name: "selectword" /* SELECT_WORD */,
chooseNumber: 1,
nextPrevious: "last",
searchText: "previousword",
selectFor: "select",
action: "select" /* SELECT */
};
case "selectall" /* SELECT_ALL */:
return {
...baseRecipe,
name: "select" /* SELECT */,
searchText: "all"
};
case "selectnextword" /* SELECT_NEXT_WORD */:
return {
...baseRecipe,
name: "selectword" /* SELECT_WORD */,
chooseNumber: 1,
nextPrevious: "next",
searchText: "nextword",
action: "select" /* SELECT */
};
case "boldpreviousline" /* BOLD_PREVIOUS_LINE */:
return {
...baseRecipe,
name: "selectline" /* SELECT_LINE */,
chooseNumber: 1,
nextPrevious: "previous",
selectFor: "bold"
};
case "italicizepreviousline" /* ITALICIZE_PREVIOUS_LINE */:
return {
...baseRecipe,
name: "selectline" /* SELECT_LINE */,
chooseNumber: 1,
nextPrevious: "previous",
selectFor: "italicize"
};
case "capitalizepreviousline" /* CAPITALIZE_PREVIOUS_LINE */:
return {
...baseRecipe,
name: "selectline" /* SELECT_LINE */,
chooseNumber: 1,
nextPrevious: "previous",
selectFor: "capitalize"
};
case "underlinepreviousline" /* UNDERLINE_PREVIOUS_LINE */:
return {
...baseRecipe,
name: "selectline" /* SELECT_LINE */,
chooseNumber: 1,
nextPrevious: "previous",
selectFor: "underline"
};
default:
return {
...baseRecipe,
name: commandText
};
}
}
};
// src/utils/Guard.ts
var Guard = class _Guard {
static instance;
constructor() {
}
static get Against() {
if (!_Guard.instance) {
_Guard.instance = new _Guard();
}
return _Guard.instance;
}
NullOrUndefined(value, paramName) {
if (value === null) throw new TypeError(`${paramName} is null`);
if (value === void 0) throw new TypeError(`${paramName} is undefined`);
return value;
}
NullOrEmpty(value, paramName) {
value = _Guard.Against.NullOrUndefined(value, paramName);
if (!value) throw new TypeError(`${paramName} is empty`);
return value;
}
Enums(e2, value, enumName) {
_Guard.Against.NullOrUndefined(value, enumName);
if (!this.isSomeEnum(e2)(value))
throw new TypeError(`${value} is not a valid value of ${enumName}`);
}
isSomeEnum(e2) {
return (token) => Object.values(e2).includes(token);
}
};
// src/config/AugnitoConfig.ts
var AugnitoAPIServer = /* @__PURE__ */ ((AugnitoAPIServer2) => {
AugnitoAPIServer2[AugnitoAPIServer2["INDIA"] = 0] = "INDIA";
AugnitoAPIServer2[AugnitoAPIServer2["UK"] = 1] = "UK";
AugnitoAPIServer2[AugnitoAPIServer2["US"] = 2] = "US";
AugnitoAPIServer2[AugnitoAPIServer2["KSA"] = 3] = "KSA";
return AugnitoAPIServer2;
})(AugnitoAPIServer || {});
// src/utils/AugnitoDomainUtils.ts
var getDomainName = (server) => {
if (typeof server === "string") return server;
let domainName = "";
switch (server) {
case 0 /* INDIA */:
domainName = "apis.augnito.ai";
break;
case 2 /* US */:
domainName = "us.apis.augnito.ai";
break;
case 1 /* UK */:
domainName = "uk.apis.augnito.ai";
break;
case 3 /* KSA */:
domainName = "sa-apis.augnito.ai";
break;
default:
throw new TypeError(`Invalid domain ${server}`);
}
return domainName;
};
// src/config/SDKConfig.ts
var SDKConfig = class {
constructor(_config) {
this._config = _config;
const domainName = getDomainName(_config.server);
if (_config.deviceId) {
this.qrCode = this.getQRCode(_config, domainName);
}
if (_config.noiseCt) {
this.noiseCt = _config.noiseCt;
}
this.domainURL = `wss://${domainName}/v2/speechapi/fast`;
this.macroServiceURL = `https://${domainName}/manage/v2`;
this.pushNotificationURL = `wss://${domainName}/speechapi/notification/`;
this.speechMicURL = `wss://${domainName}/v2/speechapi/mobile/client/`;
}
qrCode = "";
customSpeechURL;
contentType = "audio/x-raw,+layout=(string)interleaved,+rate=(int)16000,+format=(string)S16LE,+channels=(int)1";
noiseCt = "1";
interval = 100;
domainURL;
macroServiceURL;
pushNotificationURL;
speechMicURL;
source = 0 /* WEB_APP */;
onSocketPartialResult;
onSocketFinalResult;
onEndOfSession;
onReadyForSpeech;
onEvent;
onSessionEvent;
onError;
onMicrophoneOnError;
setLmId(lmId) {
Guard.Against.NullOrEmpty(lmId, "lmId");
this._config.lmId = lmId;
}
setSpeechURL(speechURL) {
Guard.Against.NullOrEmpty(speechURL, "speechURL");
this.customSpeechURL = speechURL;
}
setDomainName(domainName) {
this.domainURL = `wss://${domainName}/v2/speechapi`;
this.macroServiceURL = `https://${domainName}/manage/v2`;
this.pushNotificationURL = `wss://${domainName}/speechapi/notification/`;
this.speechMicURL = `wss://${domainName}/v2/speechapi/mobile/client/`;
}
setAccountCode(accountCode) {
Guard.Against.NullOrEmpty(accountCode, "accountCode");
this._config.accountCode = accountCode;
}
setAccessKey(accessKey) {
Guard.Against.NullOrEmpty(accessKey, "accessKey");
this._config.accessKey = accessKey;
}
setEnableLogs(enableLogs) {
this._config.enableLogs = enableLogs;
}
get clientConfig() {
return this._config;
}
get enableLogs() {
return this._config.enableLogs;
}
prepareSpeechURL() {
if (this.customSpeechURL) return this.customSpeechURL;
let speechURL = this.domainURL;
speechURL += `?content-type=${this.contentType}`;
speechURL += `&accountcode=${this._config.accountCode}`;
speechURL += `&accesskey=${this._config.accessKey}`;
speechURL += `&lmid=${this._config.lmId}`;
speechURL += `&usertag=${this._config.userTag}`;
speechURL += `&logintoken=${this._config.loginToken || ""}`;
speechURL += `&noisect=${this.noiseCt}`;
speechURL += `&otherinfo=${this._config.otherInfo || ""}`;
speechURL += `&sourceapp=${this._config.sourceApp}`;
return speechURL;
}
getQRCode(config, domainName) {
return `${config.accountCode}|${config.accessKey}|${config.userTag}|${config.deviceId}|${config.lmId}|${config.sourceApp}|${domainName}|1`;
}
};
// src/interop/core/EditorType.ts
var EditorType = /* @__PURE__ */ ((EditorType2) => {
EditorType2[EditorType2["HTML"] = 1] = "HTML";
EditorType2[EditorType2["CKEDITOR4"] = 2] = "CKEDITOR4";
EditorType2[EditorType2["CKEDITOR5"] = 3] = "CKEDITOR5";
EditorType2[EditorType2["DEVEXPRESS"] = 4] = "DEVEXPRESS";
EditorType2[EditorType2["GENERIC"] = 99] = "GENERIC";
return EditorType2;
})(EditorType || {});
// src/interop/core/PhilipsMicMode.ts
var PhilipsMicMode = /* @__PURE__ */ ((PhilipsMicMode2) => {
PhilipsMicMode2[PhilipsMicMode2["HandsFree"] = 1] = "HandsFree";
PhilipsMicMode2[PhilipsMicMode2["PushToTalk"] = 2] = "PushToTalk";
PhilipsMicMode2[PhilipsMicMode2["BOTH"] = 3] = "BOTH";
return PhilipsMicMode2;
})(PhilipsMicMode || {});
// src/utils/AugnitoUtils.ts
var createUniqueIdentifier = () => {
let dt = (/* @__PURE__ */ new Date()).getTime();
const uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
/[xy]/g,
function(c) {
const r2 = (dt + Math.random() * 16) % 16 | 0;
dt = Math.floor(dt / 16);
return (c === "x" ? r2 : r2 & 3 | 8).toString(16);
}
);
return uuid;
};
var getCurrentTimestamp = () => {
const today = /* @__PURE__ */ new Date();
const date = today.getFullYear() + "" + ("0" + (today.getMonth() + 1)).slice(-2) + ("0" + today.getDate()).slice(-2);
const time = ("0" + today.getHours()).slice(-2) + "" + ("0" + today.getMinutes()).slice(-2) + ("0" + today.getSeconds()).slice(-2) + ("000" + today.getMilliseconds()).slice(-4);
const dateTime = date + "" + time;
return dateTime;
};
// src/config/ConfigValidator.ts
var validateConfig = (config) => {
Guard.Against.NullOrUndefined(config, "Config");
Guard.Against.NullOrEmpty(config.userTag, "UserTag");
Guard.Against.NullOrEmpty(config.lmId, "LmId");
Guard.Against.NullOrEmpty(config.accountCode, "AccountCode");
Guard.Against.NullOrEmpty(config.accessKey, "AccessKey");
Guard.Against.NullOrEmpty(config.sourceApp, "SourceApp");
Guard.Against.NullOrEmpty(getDomainName(config.server), "AugnitoAPIServer");
validateEditorType(config);
config.enableLogs = config.enableLogs || false;
config.deviceId = config.deviceId || createUniqueIdentifier();
return config;
};
var validateMobileConfig = (webClient, config) => {
Guard.Against.NullOrUndefined(webClient, "WebClient");
Guard.Against.NullOrEmpty(
webClient.getConfig().clientConfig.deviceId,
"deviceId"
);
config.enableLogs = config.enableLogs || false;
return config;
};
var validateEditorType = (config) => {
if (!config.editor || config.editor === 1 /* HTML */) return;
Guard.Against.Enums(EditorType, config.editor, "EditorType");
if (config.editor === 2 /* CKEDITOR4 */ && typeof CKEDITOR === "undefined") {
throw new Error(
"CKEditor4 is set as the editor type, but CKEditor4 library was not found. Please add references to your project"
);
}
};
// src/interop/core/RichEditClientCommand.ts
var RichEditClientCommand = /* @__PURE__ */ ((RichEditClientCommand2) => {
RichEditClientCommand2[RichEditClientCommand2["None"] = 0] = "None";
RichEditClientCommand2[RichEditClientCommand2["filenew"] = 1] = "filenew";
RichEditClientCommand2[RichEditClientCommand2["fileopen"] = 2] = "fileopen";
RichEditClientCommand2[RichEditClientCommand2["filesave"] = 3] = "filesave";
RichEditClientCommand2[RichEditClientCommand2["filesaveas"] = 4] = "filesaveas";
RichEditClientCommand2[RichEditClientCommand2["fileprint"] = 5] = "fileprint";
RichEditClientCommand2[RichEditClientCommand2["undoit"] = 6] = "undoit";
RichEditClientCommand2[RichEditClientCommand2["redoit"] = 7] = "redoit";
RichEditClientCommand2[RichEditClientCommand2["pasteselection"] = 8] = "pasteselection";
RichEditClientCommand2[RichEditClientCommand2["copyselection"] = 9] = "copyselection";
RichEditClientCommand2[RichEditClientCommand2["cutselection"] = 10] = "cutselection";
RichEditClientCommand2[RichEditClientCommand2["changefontname"] = 11] = "changefontname";
RichEditClientCommand2[RichEditClientCommand2["changestyle"] = 12] = "changestyle";
RichEditClientCommand2[RichEditClientCommand2["changefontsize"] = 13] = "changefontsize";
RichEditClientCommand2[RichEditClientCommand2["increasefontsize"] = 14] = "increasefontsize";
RichEditClientCommand2[RichEditClientCommand2["decreasefontsize"] = 15] = "decreasefontsize";
RichEditClientCommand2[RichEditClientCommand2["maketextuppercase"] = 16] = "maketextuppercase";
RichEditClientCommand2[RichEditClientCommand2["maketextlowercase"] = 17] = "maketextlowercase";
RichEditClientCommand2[RichEditClientCommand2["capitalizeeachwordtextcase"] = 18] = "capitalizeeachwordtextcase";
RichEditClientCommand2[RichEditClientCommand2["toggletextcase"] = 19] = "toggletextcase";
RichEditClientCommand2[RichEditClientCommand2["togglefontbold"] = 20] = "togglefontbold";
RichEditClientCommand2[RichEditClientCommand2["togglefontitalic"] = 21] = "togglefontitalic";
RichEditClientCommand2[RichEditClientCommand2["togglefontunderline"] = 22] = "togglefontunderline";
RichEditClientCommand2[RichEditClientCommand2["togglefontdoubleunderline"] = 23] = "togglefontdoubleunderline";
RichEditClientCommand2[RichEditClientCommand2["togglefontstrikeout"] = 24] = "togglefontstrikeout";
RichEditClientCommand2[RichEditClientCommand2["togglefontsuperscript"] = 26] = "togglefontsuperscript";
RichEditClientCommand2[RichEditClientCommand2["togglefontsubscript"] = 27] = "togglefontsubscript";
RichEditClientCommand2[RichEditClientCommand2["changefontforecolor"] = 28] = "changefontforecolor";
RichEditClientCommand2[RichEditClientCommand2["changefontbackcolor"] = 29] = "changefontbackcolor";
RichEditClientCommand2[RichEditClientCommand2["clearformatting"] = 30] = "clearformatting";
RichEditClientCommand2[RichEditClientCommand2["togglebulletedlistitem"] = 31] = "togglebulletedlistitem";
RichEditClientCommand2[RichEditClientCommand2["togglenumberinglistitem"] = 32] = "togglenumberinglistitem";
RichEditClientCommand2[RichEditClientCommand2["togglemultilevellistitem"] = 33] = "togglemultilevellistitem";
RichEditClientCommand2[RichEditClientCommand2["decreaseindent"] = 34] = "decreaseindent";
RichEditClientCommand2[RichEditClientCommand2["increaseindent"] = 35] = "increaseindent";
RichEditClientCommand2[RichEditClientCommand2["toggleshowwhitespace"] = 36] = "toggleshowwhitespace";
RichEditClientCommand2[RichEditClientCommand2["toggleparagraphalignmentleft"] = 37] = "toggleparagraphalignmentleft";
RichEditClientCommand2[RichEditClientCommand2["toggleparagraphalignmentcenter"] = 38] = "toggleparagraphalignmentcenter";
RichEditClientCommand2[RichEditClientCommand2["toggleparagraphalignmentright"] = 39] = "toggleparagraphalignmentright";
RichEditClientCommand2[RichEditClientCommand2["toggleparagraphalignmentjustify"] = 40] = "toggleparagraphalignmentjustify";
RichEditClientCommand2[RichEditClientCommand2["setsingleparagraphspacing"] = 41] = "setsingleparagraphspacing";
RichEditClientCommand2[RichEditClientCommand2["setsesquialteralparagraphspacing"] = 42] = "setsesquialteralparagraphspacing";
RichEditClientCommand2[RichEditClientCommand2["setdoubleparagraphspacing"] = 43] = "setdoubleparagraphspacing";
RichEditClientCommand2[RichEditClientCommand2["addspacingbeforeparagraph"] = 45] = "addspacingbeforeparagraph";
RichEditClientCommand2[RichEditClientCommand2["addspacingafterparagraph"] = 46] = "addspacingafterparagraph";
RichEditClientCommand2[RichEditClientCommand2["removespacingbeforeparagraph"] = 47] = "removespacingbeforeparagraph";
RichEditClientCommand2[RichEditClientCommand2["removespacingafterparagraph"] = 48] = "removespacingafterparagraph";
RichEditClientCommand2[RichEditClientCommand2["changeparagraphbackcolor"] = 49] = "changeparagraphbackcolor";
RichEditClientCommand2[RichEditClientCommand2["find"] = 50] = "find";
RichEditClientCommand2[RichEditClientCommand2["repl