function t({ text: t, display: e }) {
if (!e) return []
const s = []
let n = 0
const l = e.filter((e) => e.start <= t.length - 1).sort((t, e) => t.start - e.start)
for (const t of l) {
const { start: e, length: l, type: r, content: o, memberId: a } = t,
p = e + l
e > n && s.push({ start: n, end: e, styles: [] })
const u = s.find((t) => t.start === e && t.end === p)
;(u
? u.styles.push({ type: r, content: a || o || null })
: s.push({ start: e, end: p, styles: [{ type: r, content: a || o || null }] }),
(n = p))
}
return (n < t.length && s.push({ start: n, end: t.length, styles: [] }), s)
}
module.exports = { displayToSegment: t }