{ "version": 3, "sources": ["../../../lib.web.utils/decorate_emojis.ts"], "sourcesContent": ["import {detect_emoji} from \"./detect_emoji\"\n\nexport function decorate_emojis(html: string, emoji_css_class = \"emoji\"): string {\n let i = 0,\n j = 0\n const n = html.length\n const a: string[] = []\n while (j < n) {\n if (html.charAt(j) === \"<\") {\n j = html.indexOf(\">\", j) + 1\n } else {\n let x = detect_emoji(html, j)\n if (x) {\n if (j > i) {\n a.push(html.substring(i, j))\n }\n a.push(`<span class=\"${emoji_css_class}\">`)\n let k = j\n do {\n k += x\n x = detect_emoji(html, k)\n } while (x)\n a.push(html.substring(j, k))\n a.push(\"</span>\")\n i = j = k\n } else {\n ++j\n }\n }\n }\n if (a.length) {\n a.push(html.slice(i))\n html = a.join(\"\")\n }\n return html\n}\n\nexport function emojis_should_be_large(html: string): boolean {\n const n = html.length\n let i = 0\n let emoji_counter = 0\n while (i < n) {\n if (html.charAt(i) === \"<\") {\n i = html.indexOf(\">\", i) + 1\n } else {\n const x = detect_emoji(html, i)\n if (!x) {\n // `html` contains text characters, which are not an emoji.\n return false\n }\n emoji_counter += 1\n if (emoji_counter > 5) {\n // `html` contains more than 5 emojis.\n return false\n }\n i += x\n }\n }\n return true\n}\n"], "mappings": "gFAEO,SAASA,EAAgBC,EAAcC,EAAkB,QAAiB,CAC7E,IAAIC,EAAI,EACJC,EAAI,EACFC,EAAIJ,EAAK,OACTK,EAAc,CAAC,EACrB,KAAOF,EAAIC,GACP,GAAIJ,EAAK,OAAOG,CAAC,IAAM,IACnBA,EAAIH,EAAK,QAAQ,IAAKG,CAAC,EAAI,MACxB,CACH,IAAIG,EAAIC,EAAaP,EAAMG,CAAC,EAC5B,GAAIG,EAAG,CACCH,EAAID,GACJG,EAAE,KAAKL,EAAK,UAAUE,EAAGC,CAAC,CAAC,EAE/BE,EAAE,KAAK,gBAAgBJ,CAAe,IAAI,EAC1C,IAAIO,EAAIL,EACR,GACIK,GAAKF,EACLA,EAAIC,EAAaP,EAAMQ,CAAC,QACnBF,GACTD,EAAE,KAAKL,EAAK,UAAUG,EAAGK,CAAC,CAAC,EAC3BH,EAAE,KAAK,SAAS,EAChBH,EAAIC,EAAIK,CACZ,KACI,EAAEL,CAEV,CAEJ,OAAIE,EAAE,SACFA,EAAE,KAAKL,EAAK,MAAME,CAAC,CAAC,EACpBF,EAAOK,EAAE,KAAK,EAAE,GAEbL,CACX,CAjCgBS,EAAAV,EAAA,mBAmCT,SAASW,EAAuBV,EAAuB,CAC1D,IAAMI,EAAIJ,EAAK,OACXE,EAAI,EACJS,EAAgB,EACpB,KAAOT,EAAIE,GACP,GAAIJ,EAAK,OAAOE,CAAC,IAAM,IACnBA,EAAIF,EAAK,QAAQ,IAAKE,CAAC,EAAI,MACxB,CACH,IAAMI,EAAIC,EAAaP,EAAME,CAAC,EAM9B,GALI,CAACI,IAILK,GAAiB,EACbA,EAAgB,GAEhB,MAAO,GAEXT,GAAKI,CACT,CAEJ,MAAO,EACX,CAtBgBG,EAAAC,EAAA", "names": ["decorate_emojis", "html", "emoji_css_class", "i", "j", "n", "a", "x", "detect_emoji", "k", "__name", "emojis_should_be_large", "emoji_counter"] }