136 lines
3.3 KiB
TypeScript
136 lines
3.3 KiB
TypeScript
// Metro module 5192 (f5193).
|
|
import DiscordNative from "../lib/DiscordNative";
|
|
import { isDesktop } from "./PlatformUtils";
|
|
import { install } from "../lib/spellcheck/Spellchecker";
|
|
let value;
|
|
const r30 = isDesktop() && DiscordNative?.spellCheck != null ? install() : null;
|
|
export function isSupported() {
|
|
return isDesktop() && DiscordNative?.spellCheck != null;
|
|
}
|
|
value = r30;
|
|
export async function setEnabled(c25372_0) {
|
|
let c29474_0 = c25372_0;
|
|
let c29474_1 = await value;
|
|
if (c29474_1 != null) {
|
|
c29474_1.enabled = c29474_0;
|
|
}
|
|
}
|
|
export async function setLearnedWords(c25373_0) {
|
|
let c29475_0 = c25373_0;
|
|
let c29475_1 = await value;
|
|
if (c29475_1 != null) {
|
|
c29475_1.setLearnedWords(c29475_0);
|
|
}
|
|
}
|
|
export async function isMisspelled(c25374_0, c25374_1) {
|
|
let c25374_3;
|
|
let c29476_1, c29476_2;
|
|
c25374_3 = void 0;
|
|
c29476_1 = void 0;
|
|
let c29476_0 = c25374_0;
|
|
if (c25374_1 !== void 0) {
|
|
c29476_1 = c25374_1;
|
|
c29476_2 = void 0;
|
|
} else {
|
|
c29476_1 = false;
|
|
c29476_2 = void 0;
|
|
}
|
|
await void 0;
|
|
c29476_2 = await value;
|
|
return c29476_2 != null && c29476_2.isMisspelled(c29476_0, c29476_1);
|
|
}
|
|
export async function getCorrections(c25375_0, c25375_1, c25375_2) {
|
|
let r29;
|
|
let c25375_4;
|
|
let c29477_1, c29477_2, c29477_0, c29477_3;
|
|
L13: {
|
|
L10: {
|
|
c25375_4 = void 0;
|
|
c29477_1 = void 0;
|
|
c29477_2 = void 0;
|
|
c29477_0 = c25375_0;
|
|
if (c25375_1 !== void 0) {
|
|
c29477_1 = c25375_1;
|
|
r29 = c25375_2;
|
|
if (r29 !== void 0) {
|
|
break L10;
|
|
}
|
|
} else {
|
|
c29477_1 = false;
|
|
r29 = c25375_2;
|
|
if (r29 !== void 0) {
|
|
break L10;
|
|
}
|
|
}
|
|
c29477_2 = 5;
|
|
c29477_3 = void 0;
|
|
break L13;
|
|
}
|
|
c29477_2 = r29;
|
|
c29477_3 = void 0;
|
|
}
|
|
await void 0;
|
|
c29477_3 = await value;
|
|
return c29477_3 == null ? [] : c29477_3.getCorrectionsForMisspelling(c29477_0, c29477_1).slice(0, c29477_2);
|
|
}
|
|
export async function getCachedMisspelling(c25376_0) {
|
|
let r61;
|
|
let c25376_2;
|
|
let c29478_0, c29478_1, c29478_2;
|
|
L17: {
|
|
c25376_2 = void 0;
|
|
c29478_0 = void 0;
|
|
if (c25376_0 !== void 0) {
|
|
c29478_0 = c25376_0;
|
|
c29478_1 = void 0;
|
|
c29478_2 = void 0;
|
|
} else {
|
|
c29478_0 = 5;
|
|
c29478_1 = void 0;
|
|
c29478_2 = void 0;
|
|
}
|
|
await void 0;
|
|
c29478_1 = await value;
|
|
if (c29478_1 == null) {
|
|
r61 = {
|
|
misspelledWord: "",
|
|
corrections: []
|
|
};
|
|
break L17;
|
|
}
|
|
c29478_2 = c29478_1.getCachedMisspelling();
|
|
return {
|
|
misspelledWord: c29478_2.misspelledWord,
|
|
corrections: c29478_2.corrections.slice(0, c29478_0)
|
|
};
|
|
}
|
|
return r61;
|
|
}
|
|
export async function replaceWithCorrection(c25377_0) {
|
|
let c29479_0 = c25377_0;
|
|
let c29479_1 = await value;
|
|
if (c29479_1 != null) {
|
|
c29479_1.replaceMisspelling(c29479_0);
|
|
}
|
|
}
|
|
export async function setAppLocale(c25378_0) {
|
|
let c29480_0 = c25378_0;
|
|
let c29480_1 = await value;
|
|
if (c29480_1 != null) {
|
|
c29480_1.setAppLocale(c29480_0);
|
|
}
|
|
}
|
|
export function addResultListener(a0) {
|
|
let r10;
|
|
if (DiscordNative?.spellCheck != null) {
|
|
let r16 = DiscordNative.spellCheck.on("spellcheck-result", a0);
|
|
if (r16 == null) {
|
|
r16 = () => {};
|
|
}
|
|
r10 = r16;
|
|
} else {
|
|
r10 = () => {};
|
|
}
|
|
return r10;
|
|
}
|