···11import 'fast-text-encoding'
22-import Graphemer from 'graphemer'
32// @ts-ignore no decl -prf
43import findLast from 'array.prototype.findlast'
54export {}
···5453 }
5554 return result
5655}
5757-5858-const splitter = new Graphemer()
5959-globalThis.Intl = globalThis.Intl || {}
6060-6161-// @ts-ignore we're polyfilling -prf
6262-globalThis.Intl.Segmenter =
6363- // @ts-ignore we're polyfilling -prf
6464- globalThis.Intl.Segmenter ||
6565- class Segmenter {
6666- constructor() {}
6767- // NOTE
6868- // this is not a precisely correct polyfill but it's sufficient for our needs
6969- // -prf
7070- segment = splitter.iterateGraphemes
7171- }
+1-5
src/platform/polyfills.web.ts
···991010// @ts-ignore not on the TS signature due to bad support -prf
1111if (!globalThis.Intl?.Segmenter) {
1212- // NOTE loading as a separate script to reduce main bundle size, as this is only needed in FF -prf
1313- const script = document.createElement('script')
1414- script.setAttribute('src', '/static/js/intl-segmenter-polyfill.min.js')
1515- document.head.appendChild(script)
1616-1712 // loading emoji mart data
1313+ // TODO: This condition doesn't make sense; emojimart has nothing to do with Intl.
1814 const emojiMartScript = document.createElement('script')
1915 emojiMartScript.setAttribute('src', '/static/js/emoji-mart-data.js')
2016 document.head.appendChild(emojiMartScript)