UNPKG

vue-files-preview-inno

Version:

A tool for previewing files such as doc, excel, pdf, image, markdown, txt, audio, and video and so on.

36 lines (35 loc) 1.25 kB
function k(o) { const r = {}, c = o.length; if (!c) return; let n = 0, f = -2; const a = []; for (let s = 0; s < c; s++) { const e = o[s]; if (a.push(0), (o[n].marker !== e.marker || f !== e.token - 1) && (n = s), f = e.token, e.length = e.length || 0, !e.close) continue; r.hasOwnProperty(e.marker) || (r[e.marker] = [-1, -1, -1, -1, -1, -1]); const h = r[e.marker][(e.open ? 3 : 0) + e.length % 3]; let t = n - a[n] - 1, i = t; for (; t > h; t -= a[t] + 1) { const l = o[t]; if (l.marker === e.marker && l.open && l.end < 0) { let p = !1; if ((l.close || e.open) && (l.length + e.length) % 3 === 0 && (l.length % 3 !== 0 || e.length % 3 !== 0) && (p = !0), !p) { const m = t > 0 && !o[t - 1].open ? a[t - 1] + 1 : 0; a[s] = s - t + m, a[t] = m, e.open = !1, l.end = s, l.close = !1, i = -1, f = -2; break; } } } i !== -1 && (r[e.marker][(e.open ? 3 : 0) + (e.length || 0) % 3] = i); } } function d(o) { const r = o.tokens_meta, c = o.tokens_meta.length; k(o.delimiters); for (let n = 0; n < c; n++) r[n] && r[n].delimiters && k(r[n].delimiters); } export { d as default }; //# sourceMappingURL=balance_pairs.mjs.map