/* tslint:disable */ const asciiList: { [id: string]: string } = { "*\\0/*": "1f646", "*\\O/*": "1f646", "-___-": "1f611", ":'-)": "1f602", "':-)": "1f605", "':-D": "1f605", ">:-)": "1f606", "':-(": "1f613", ">:-(": "1f620", ":'-(": "1f622", "O:-)": "1f607", "0:-3": "1f607", "0:-)": "1f607", "0;^)": "1f607", "O;-)": "1f607", "0;-)": "1f607", "O:-3": "1f607", "-__-": "1f611", ":-Þ": "1f61b", ":)": "1f606", ">;)": "1f606", ">=)": "1f606", ";-)": "1f609", "*-)": "1f609", ";-]": "1f609", ";^)": "1f609", "':(": "1f613", "'=(": "1f613", ":-*": "1f618", ":^*": "1f618", ">:P": "1f61c", "X-P": "1f61c", ">:[": "1f61e", ":-(": "1f61e", ":-[": "1f61e", ">:(": "1f620", ":'(": "1f622", ";-(": "1f622", ">.<": "1f623", "#-)": "1f635", "%-)": "1f635", "X-)": "1f635", "\\0/": "1f646", "\\O/": "1f646", "0:3": "1f607", "0:)": "1f607", "O:)": "1f607", "O=)": "1f607", "O:3": "1f607", "B-)": "1f60e", "8-)": "1f60e", "B-D": "1f60e", "8-D": "1f60e", "-_-": "1f611", ">:\\": "1f615", ">:/": "1f615", ":-/": "1f615", ":-.": "1f615", ":-P": "1f61b", ":Þ": "1f61b", ":-b": "1f61b", ":-O": "1f62e", "O_O": "1f62e", ">:O": "1f62e", ":-X": "1f636", ":-#": "1f636", ":-)": "1f642", "(y)": "1f44d", "<3": "2764", ":D": "1f603", "=D": "1f603", ";)": "1f609", "*)": "1f609", ";]": "1f609", ";D": "1f609", ":*": "1f618", "=*": "1f618", ":(": "1f61e", ":[": "1f61e", "=(": "1f61e", ":@": "1f620", ";(": "1f622", "D:": "1f628", ":$": "1f633", "=$": "1f633", "#)": "1f635", "%)": "1f635", "X)": "1f635", "B)": "1f60e", "8)": "1f60e", ":/": "1f615", ":\\": "1f615", "=/": "1f615", "=\\": "1f615", ":L": "1f615", "=L": "1f615", ":P": "1f61b", "=P": "1f61b", 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\\\|\\=\\/|\\=\\\\|\\:L|\\=L|\\:P|\\=P|\\:b|\\:O|\\:X|\\:#|\\=X|\\=#|\\:\\)|\\=\\]|\\=\\)|\\:\\])"; const regAscii = new RegExp("]*>.*?<\/object>|]*>.*?<\/span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>|((\\s|^)" + asciiRegexp + "(?=\\s|$|[!,.?]))", "gi"); // const regAsciiRisky = new RegExp("]*>.*?<\/object>|]*>.*?<\/span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>|(()" + asciiRegexp + "())", "gi"); function unescapeHTML(str: string) { return str; } // for converting unicode code points and code pairs to their respective characters function convert(unicode: string) { if (unicode.indexOf("-") > -1) { let parts = []; let s = unicode.split("-"); for (let i = 0; i < s.length; i++) { let part: any = parseInt(s[i], 16); if (part >= 0x10000 && part <= 0x10FFFF) { var hi = Math.floor((part - 0x10000) / 0x400) + 0xD800; var lo = ((part - 0x10000) % 0x400) + 0xDC00; part = (String.fromCharCode(hi) + String.fromCharCode(lo)); } else { part = String.fromCharCode(part); } parts.push(part); } return parts.join(""); } else { var s = parseInt(unicode, 16); if (s >= 0x10000 && s <= 0x10FFFF) { var hi = Math.floor((s - 0x10000) / 0x400) + 0xD800; var lo = ((s - 0x10000) % 0x400) + 0xDC00; return (String.fromCharCode(hi) + String.fromCharCode(lo)); } else { return String.fromCharCode(s); } } } export function convertAsciiToUnicode(str: string) { var asciiRX = regAscii; return str.replace(asciiRX, function (entire, m1, m2, m3) { if ((typeof m3 === "undefined") || (m3 === "") || (!(unescapeHTML(m3) in asciiList))) { // if the ascii doesnt exist just return the entire match return entire; } m3 = unescapeHTML(m3); const unicode = asciiList[m3].toUpperCase(); return m2 + convert(unicode); }); }