UNPKG

view-transitions-polyfill

Version:
1,688 lines (1,687 loc) 291 kB
/** * View Transitions API polyfill 1.0.6 * ISC License (text on website) * * Copyright (c) 2024 Marco Pizzorusso <demarketed@gmail.com> * https://github.com/demarketed/view-transitions-polyfill */ class ui extends HTMLElement { constructor() { super(), this.live = !1, this.style.display = "block", this.clone = document.createElement("canvas"), this.clone.style.width = "100%", this.clone.style.height = "100%", this.appendChild(this.clone); const t = this.clone.getContext("2d"); if (!t) throw new Error("Canvas context 2D is unsupported"); this.ctx = t; } setup(t, n) { this.element = t, n && (this.live = n), this.element instanceof HTMLVideoElement ? (this.clone.width = this.element.videoWidth, this.clone.height = this.element.videoHeight) : this.element instanceof HTMLCanvasElement && (this.clone.width = this.element.width, this.clone.height = this.element.height); } connectedCallback() { this.live ? this.drawLive() : this.draw(); } disconnectedCallback() { this.nextAnimationFrame && cancelAnimationFrame(this.nextAnimationFrame); } drawLive() { if (this) { if (!this.element || !document.documentElement.contains(this.element)) { this.nextAnimationFrame && cancelAnimationFrame(this.nextAnimationFrame); return; } this.ctx.drawImage(this.element, 0, 0), this.nextAnimationFrame = requestAnimationFrame( () => this.drawLive.call(this) ); } } draw() { if (this.element) return this.ctx.drawImage(this.element, 0, 0); } } customElements.define("view-transition-media", ui); const xe = 0, b = 1, C = 2, D = 3, I = 4, he = 5, Pt = 6, U = 7, X = 8, A = 9, v = 10, N = 11, T = 12, j = 13, nt = 14, J = 15, G = 16, K = 17, Z = 18, te = 19, ue = 20, $ = 21, x = 22, H = 23, ie = 24, q = 25, os = 0; function V(e) { return e >= 48 && e <= 57; } function ve(e) { return V(e) || // 0 .. 9 e >= 65 && e <= 70 || // A .. F e >= 97 && e <= 102; } function On(e) { return e >= 65 && e <= 90; } function ss(e) { return e >= 97 && e <= 122; } function as(e) { return On(e) || ss(e); } function ls(e) { return e >= 128; } function wt(e) { return as(e) || ls(e) || e === 95; } function hi(e) { return wt(e) || V(e) || e === 45; } function cs(e) { return e >= 0 && e <= 8 || e === 11 || e >= 14 && e <= 31 || e === 127; } function xt(e) { return e === 10 || e === 13 || e === 12; } function $e(e) { return xt(e) || e === 32 || e === 9; } function fe(e, t) { return !(e !== 92 || xt(t) || t === os); } function mt(e, t, n) { return e === 45 ? wt(t) || t === 45 || fe(t, n) : wt(e) ? !0 : e === 92 ? fe(e, t) : !1; } function Rt(e, t, n) { return e === 43 || e === 45 ? V(t) ? 2 : t === 46 && V(n) ? 3 : 0 : e === 46 ? V(t) ? 2 : 0 : V(e) ? 1 : 0; } function pi(e) { return e === 65279 || e === 65534 ? 1 : 0; } const un = new Array(128), us = 128, ft = 130, di = 131, Ln = 132, mi = 133; for (let e = 0; e < un.length; e++) un[e] = $e(e) && ft || V(e) && di || wt(e) && Ln || cs(e) && mi || e || us; function Bt(e) { return e < 128 ? un[e] : Ln; } function ze(e, t) { return t < e.length ? e.charCodeAt(t) : 0; } function hn(e, t, n) { return n === 13 && ze(e, t + 1) === 10 ? 2 : 1; } function Me(e, t, n) { let r = e.charCodeAt(t); return On(r) && (r = r | 32), r === n; } function Ze(e, t, n, r) { if (n - t !== r.length || t < 0 || n > e.length) return !1; for (let i = t; i < n; i++) { const o = r.charCodeAt(i - t); let s = e.charCodeAt(i); if (On(s) && (s = s | 32), s !== o) return !1; } return !0; } function hs(e, t) { for (; t >= 0 && $e(e.charCodeAt(t)); t--) ; return t + 1; } function ot(e, t) { for (; t < e.length && $e(e.charCodeAt(t)); t++) ; return t; } function Ht(e, t) { for (; t < e.length && V(e.charCodeAt(t)); t++) ; return t; } function Ne(e, t) { if (t += 2, ve(ze(e, t - 1))) { for (const r = Math.min(e.length, t + 5); t < r && ve(ze(e, t)); t++) ; const n = ze(e, t); $e(n) && (t += hn(e, t, n)); } return t; } function st(e, t) { for (; t < e.length; t++) { const n = e.charCodeAt(t); if (!hi(n)) { if (fe(n, ze(e, t + 1))) { t = Ne(e, t) - 1; continue; } break; } } return t; } function _t(e, t) { let n = e.charCodeAt(t); if ((n === 43 || n === 45) && (n = e.charCodeAt(t += 1)), V(n) && (t = Ht(e, t + 1), n = e.charCodeAt(t)), n === 46 && V(e.charCodeAt(t + 1)) && (t += 2, t = Ht(e, t)), Me( e, t, 101 /* e */ )) { let r = 0; n = e.charCodeAt(t + 1), (n === 45 || n === 43) && (r = 1, n = e.charCodeAt(t + 2)), V(n) && (t = Ht(e, t + 1 + r + 1)); } return t; } function Vt(e, t) { for (; t < e.length; t++) { const n = e.charCodeAt(t); if (n === 41) { t++; break; } fe(n, ze(e, t + 1)) && (t = Ne(e, t)); } return t; } function fi(e) { if (e.length === 1 && !ve(e.charCodeAt(0))) return e[0]; let t = parseInt(e, 16); return (t === 0 || // If this number is zero, t >= 55296 && t <= 57343 || // or is for a surrogate, t > 1114111) && (t = 65533), String.fromCodePoint(t); } const gi = [ "EOF-token", "ident-token", "function-token", "at-keyword-token", "hash-token", "string-token", "bad-string-token", "url-token", "bad-url-token", "delim-token", "number-token", "percentage-token", "dimension-token", "whitespace-token", "CDO-token", "CDC-token", "colon-token", "semicolon-token", "comma-token", "[-token", "]-token", "(-token", ")-token", "{-token", "}-token", "comment-token" ], ps = 16 * 1024; function vt(e = null, t) { return e === null || e.length < t ? new Uint32Array(Math.max(t + 1024, ps)) : e; } const tr = 10, ds = 12, nr = 13; function rr(e) { const t = e.source, n = t.length, r = t.length > 0 ? pi(t.charCodeAt(0)) : 0, i = vt(e.lines, n), o = vt(e.columns, n); let s = e.startLine, c = e.startColumn; for (let l = r; l < n; l++) { const a = t.charCodeAt(l); i[l] = s, o[l] = c++, (a === tr || a === nr || a === ds) && (a === nr && l + 1 < n && t.charCodeAt(l + 1) === tr && (l++, i[l] = s, o[l] = c), s++, c = 1); } i[n] = s, o[n] = c, e.lines = i, e.columns = o, e.computed = !0; } class ms { constructor() { this.lines = null, this.columns = null, this.computed = !1; } setSource(t, n = 0, r = 1, i = 1) { this.source = t, this.startOffset = n, this.startLine = r, this.startColumn = i, this.computed = !1; } getLocation(t, n) { return this.computed || rr(this), { source: n, offset: this.startOffset + t, line: this.lines[t], column: this.columns[t] }; } getLocationRange(t, n, r) { return this.computed || rr(this), { source: r, start: { offset: this.startOffset + t, line: this.lines[t], column: this.columns[t] }, end: { offset: this.startOffset + n, line: this.lines[n], column: this.columns[n] } }; } } const ne = 16777215, pe = 24, fs = /* @__PURE__ */ new Map([ [C, x], [$, x], [te, ue], [H, ie] ]); class gs { constructor(t, n) { this.setSource(t, n); } reset() { this.eof = !1, this.tokenIndex = -1, this.tokenType = 0, this.tokenStart = this.firstCharOffset, this.tokenEnd = this.firstCharOffset; } setSource(t = "", n = () => { }) { t = String(t || ""); const r = t.length, i = vt(this.offsetAndType, t.length + 1), o = vt(this.balance, t.length + 1); let s = 0, c = 0, l = 0, a = -1; for (this.offsetAndType = null, this.balance = null, n(t, (u, p, m) => { switch (u) { default: o[s] = r; break; case c: { let g = l & ne; for (l = o[g], c = l >> pe, o[s] = g, o[g++] = s; g < s; g++) o[g] === r && (o[g] = s); break; } case $: case C: case te: case H: o[s] = l, c = fs.get(u), l = c << pe | s; break; } i[s++] = u << pe | m, a === -1 && (a = p); }), i[s] = xe << pe | r, o[s] = r, o[r] = r; l !== 0; ) { const u = l & ne; l = o[u], o[u] = r; } this.source = t, this.firstCharOffset = a === -1 ? 0 : a, this.tokenCount = s, this.offsetAndType = i, this.balance = o, this.reset(), this.next(); } lookupType(t) { return t += this.tokenIndex, t < this.tokenCount ? this.offsetAndType[t] >> pe : xe; } lookupTypeNonSC(t) { for (let n = this.tokenIndex; n < this.tokenCount; n++) { const r = this.offsetAndType[n] >> pe; if (r !== j && r !== q && t-- === 0) return r; } return xe; } lookupOffset(t) { return t += this.tokenIndex, t < this.tokenCount ? this.offsetAndType[t - 1] & ne : this.source.length; } lookupOffsetNonSC(t) { for (let n = this.tokenIndex; n < this.tokenCount; n++) { const r = this.offsetAndType[n] >> pe; if (r !== j && r !== q && t-- === 0) return n - this.tokenIndex; } return xe; } lookupValue(t, n) { return t += this.tokenIndex, t < this.tokenCount ? Ze( this.source, this.offsetAndType[t - 1] & ne, this.offsetAndType[t] & ne, n ) : !1; } getTokenStart(t) { return t === this.tokenIndex ? this.tokenStart : t > 0 ? t < this.tokenCount ? this.offsetAndType[t - 1] & ne : this.offsetAndType[this.tokenCount] & ne : this.firstCharOffset; } substrToCursor(t) { return this.source.substring(t, this.tokenStart); } isBalanceEdge(t) { return this.balance[this.tokenIndex] < t; } isDelim(t, n) { return n ? this.lookupType(n) === A && this.source.charCodeAt(this.lookupOffset(n)) === t : this.tokenType === A && this.source.charCodeAt(this.tokenStart) === t; } skip(t) { let n = this.tokenIndex + t; n < this.tokenCount ? (this.tokenIndex = n, this.tokenStart = this.offsetAndType[n - 1] & ne, n = this.offsetAndType[n], this.tokenType = n >> pe, this.tokenEnd = n & ne) : (this.tokenIndex = this.tokenCount, this.next()); } next() { let t = this.tokenIndex + 1; t < this.tokenCount ? (this.tokenIndex = t, this.tokenStart = this.tokenEnd, t = this.offsetAndType[t], this.tokenType = t >> pe, this.tokenEnd = t & ne) : (this.eof = !0, this.tokenIndex = this.tokenCount, this.tokenType = xe, this.tokenStart = this.tokenEnd = this.source.length); } skipSC() { for (; this.tokenType === j || this.tokenType === q; ) this.next(); } skipUntilBalanced(t, n) { let r = t, i, o; e: for (; r < this.tokenCount; r++) { if (i = this.balance[r], i < t) break e; switch (o = r > 0 ? this.offsetAndType[r - 1] & ne : this.firstCharOffset, n(this.source.charCodeAt(o))) { case 1: break e; case 2: r++; break e; default: this.balance[i] === r && (r = i); } } this.skip(r - this.tokenIndex); } forEachToken(t) { for (let n = 0, r = this.firstCharOffset; n < this.tokenCount; n++) { const i = r, o = this.offsetAndType[n], s = o & ne, c = o >> pe; r = s, t(c, i, s, n); } } dump() { const t = new Array(this.tokenCount); return this.forEachToken((n, r, i, o) => { t[o] = { idx: o, type: gi[n], chunk: this.source.substring(r, i), balance: this.balance[o] }; }), t; } } function It(e, t) { function n(p) { return p < c ? e.charCodeAt(p) : 0; } function r() { if (a = _t(e, a), mt(n(a), n(a + 1), n(a + 2))) { u = T, a = st(e, a); return; } if (n(a) === 37) { u = N, a++; return; } u = v; } function i() { const p = a; if (a = st(e, a), Ze(e, p, a, "url") && n(a) === 40) { if (a = ot(e, a + 1), n(a) === 34 || n(a) === 39) { u = C, a = p + 4; return; } s(); return; } if (n(a) === 40) { u = C, a++; return; } u = b; } function o(p) { for (p || (p = n(a++)), u = he; a < e.length; a++) { const m = e.charCodeAt(a); switch (Bt(m)) { case p: a++; return; case ft: if (xt(m)) { a += hn(e, a, m), u = Pt; return; } break; case 92: if (a === e.length - 1) break; const g = n(a + 1); xt(g) ? a += hn(e, a + 1, g) : fe(m, g) && (a = Ne(e, a) - 1); break; } } } function s() { for (u = U, a = ot(e, a); a < e.length; a++) { const p = e.charCodeAt(a); switch (Bt(p)) { case 41: a++; return; case ft: if (a = ot(e, a), n(a) === 41 || a >= e.length) { a < e.length && a++; return; } a = Vt(e, a), u = X; return; case 34: case 39: case 40: case mi: a = Vt(e, a), u = X; return; case 92: if (fe(p, n(a + 1))) { a = Ne(e, a) - 1; break; } a = Vt(e, a), u = X; return; } } } e = String(e || ""); const c = e.length; let l = pi(n(0)), a = l, u; for (; a < c; ) { const p = e.charCodeAt(a); switch (Bt(p)) { case ft: u = j, a = ot(e, a + 1); break; case 34: o(); break; case 35: hi(n(a + 1)) || fe(n(a + 1), n(a + 2)) ? (u = I, a = st(e, a + 1)) : (u = A, a++); break; case 39: o(); break; case 40: u = $, a++; break; case 41: u = x, a++; break; case 43: Rt(p, n(a + 1), n(a + 2)) ? r() : (u = A, a++); break; case 44: u = Z, a++; break; case 45: Rt(p, n(a + 1), n(a + 2)) ? r() : n(a + 1) === 45 && n(a + 2) === 62 ? (u = J, a = a + 3) : mt(p, n(a + 1), n(a + 2)) ? i() : (u = A, a++); break; case 46: Rt(p, n(a + 1), n(a + 2)) ? r() : (u = A, a++); break; case 47: n(a + 1) === 42 ? (u = q, a = e.indexOf("*/", a + 2), a = a === -1 ? e.length : a + 2) : (u = A, a++); break; case 58: u = G, a++; break; case 59: u = K, a++; break; case 60: n(a + 1) === 33 && n(a + 2) === 45 && n(a + 3) === 45 ? (u = nt, a = a + 4) : (u = A, a++); break; case 64: mt(n(a + 1), n(a + 2), n(a + 3)) ? (u = D, a = st(e, a + 1)) : (u = A, a++); break; case 91: u = te, a++; break; case 92: fe(p, n(a + 1)) ? i() : (u = A, a++); break; case 93: u = ue, a++; break; case 123: u = H, a++; break; case 125: u = ie, a++; break; case di: r(); break; case Ln: i(); break; default: u = A, a++; } t(u, l, l = a); } } let Oe = null; class B { static createItem(t) { return { prev: null, next: null, data: t }; } constructor() { this.head = null, this.tail = null, this.cursor = null; } createItem(t) { return B.createItem(t); } // cursor helpers allocateCursor(t, n) { let r; return Oe !== null ? (r = Oe, Oe = Oe.cursor, r.prev = t, r.next = n, r.cursor = this.cursor) : r = { prev: t, next: n, cursor: this.cursor }, this.cursor = r, r; } releaseCursor() { const { cursor: t } = this; this.cursor = t.cursor, t.prev = null, t.next = null, t.cursor = Oe, Oe = t; } updateCursors(t, n, r, i) { let { cursor: o } = this; for (; o !== null; ) o.prev === t && (o.prev = n), o.next === r && (o.next = i), o = o.cursor; } *[Symbol.iterator]() { for (let t = this.head; t !== null; t = t.next) yield t.data; } // getters get size() { let t = 0; for (let n = this.head; n !== null; n = n.next) t++; return t; } get isEmpty() { return this.head === null; } get first() { return this.head && this.head.data; } get last() { return this.tail && this.tail.data; } // convertors fromArray(t) { let n = null; this.head = null; for (let r of t) { const i = B.createItem(r); n !== null ? n.next = i : this.head = i, i.prev = n, n = i; } return this.tail = n, this; } toArray() { return [...this]; } toJSON() { return [...this]; } // array-like methods forEach(t, n = this) { const r = this.allocateCursor(null, this.head); for (; r.next !== null; ) { const i = r.next; r.next = i.next, t.call(n, i.data, i, this); } this.releaseCursor(); } forEachRight(t, n = this) { const r = this.allocateCursor(this.tail, null); for (; r.prev !== null; ) { const i = r.prev; r.prev = i.prev, t.call(n, i.data, i, this); } this.releaseCursor(); } reduce(t, n, r = this) { let i = this.allocateCursor(null, this.head), o = n, s; for (; i.next !== null; ) s = i.next, i.next = s.next, o = t.call(r, o, s.data, s, this); return this.releaseCursor(), o; } reduceRight(t, n, r = this) { let i = this.allocateCursor(this.tail, null), o = n, s; for (; i.prev !== null; ) s = i.prev, i.prev = s.prev, o = t.call(r, o, s.data, s, this); return this.releaseCursor(), o; } some(t, n = this) { for (let r = this.head; r !== null; r = r.next) if (t.call(n, r.data, r, this)) return !0; return !1; } map(t, n = this) { const r = new B(); for (let i = this.head; i !== null; i = i.next) r.appendData(t.call(n, i.data, i, this)); return r; } filter(t, n = this) { const r = new B(); for (let i = this.head; i !== null; i = i.next) t.call(n, i.data, i, this) && r.appendData(i.data); return r; } nextUntil(t, n, r = this) { if (t === null) return; const i = this.allocateCursor(null, t); for (; i.next !== null; ) { const o = i.next; if (i.next = o.next, n.call(r, o.data, o, this)) break; } this.releaseCursor(); } prevUntil(t, n, r = this) { if (t === null) return; const i = this.allocateCursor(t, null); for (; i.prev !== null; ) { const o = i.prev; if (i.prev = o.prev, n.call(r, o.data, o, this)) break; } this.releaseCursor(); } // mutation clear() { this.head = null, this.tail = null; } copy() { const t = new B(); for (let n of this) t.appendData(n); return t; } prepend(t) { return this.updateCursors(null, t, this.head, t), this.head !== null ? (this.head.prev = t, t.next = this.head) : this.tail = t, this.head = t, this; } prependData(t) { return this.prepend(B.createItem(t)); } append(t) { return this.insert(t); } appendData(t) { return this.insert(B.createItem(t)); } insert(t, n = null) { if (n !== null) if (this.updateCursors(n.prev, t, n, t), n.prev === null) { if (this.head !== n) throw new Error("before doesn't belong to list"); this.head = t, n.prev = t, t.next = n, this.updateCursors(null, t); } else n.prev.next = t, t.prev = n.prev, n.prev = t, t.next = n; else this.updateCursors(this.tail, t, null, t), this.tail !== null ? (this.tail.next = t, t.prev = this.tail) : this.head = t, this.tail = t; return this; } insertData(t, n) { return this.insert(B.createItem(t), n); } remove(t) { if (this.updateCursors(t, t.prev, t, t.next), t.prev !== null) t.prev.next = t.next; else { if (this.head !== t) throw new Error("item doesn't belong to list"); this.head = t.next; } if (t.next !== null) t.next.prev = t.prev; else { if (this.tail !== t) throw new Error("item doesn't belong to list"); this.tail = t.prev; } return t.prev = null, t.next = null, t; } push(t) { this.insert(B.createItem(t)); } pop() { return this.tail !== null ? this.remove(this.tail) : null; } unshift(t) { this.prepend(B.createItem(t)); } shift() { return this.head !== null ? this.remove(this.head) : null; } prependList(t) { return this.insertList(t, this.head); } appendList(t) { return this.insertList(t); } insertList(t, n) { return t.head === null ? this : (n != null ? (this.updateCursors(n.prev, t.tail, n, t.head), n.prev !== null ? (n.prev.next = t.head, t.head.prev = n.prev) : this.head = t.head, n.prev = t.tail, t.tail.next = n) : (this.updateCursors(this.tail, t.tail, null, t.head), this.tail !== null ? (this.tail.next = t.head, t.head.prev = this.tail) : this.head = t.head, this.tail = t.tail), t.head = null, t.tail = null, this); } replace(t, n) { "head" in n ? this.insertList(n, t) : this.insert(n, t), this.remove(t); } } function zt(e, t) { const n = Object.create(SyntaxError.prototype), r = new Error(); return Object.assign(n, { name: e, message: t, get stack() { return (r.stack || "").replace(/^(.+\n){1,3}/, `${e}: ${t} `); } }); } const qt = 100, ir = 60, or = " "; function sr({ source: e, line: t, column: n, baseLine: r, baseColumn: i }, o) { function s(w, M) { return a.slice(w, M).map( (L, E) => String(w + E + 1).padStart(m) + " |" + L ).join(` `); } const c = ` `.repeat(Math.max(r - 1, 0)), l = " ".repeat(Math.max(i - 1, 0)), a = (c + l + e).split(/\r\n?|\n|\f/), u = Math.max(1, t - o) - 1, p = Math.min(t + o, a.length + 1), m = Math.max(4, String(p).length) + 1; let g = 0; n += (or.length - 1) * (a[t - 1].substr(0, n - 1).match(/\t/g) || []).length, n > qt && (g = n - ir + 3, n = ir - 2); for (let w = u; w <= p; w++) w >= 0 && w < a.length && (a[w] = a[w].replace(/\t/g, or), a[w] = (g > 0 && a[w].length > g ? "…" : "") + a[w].substr(g, qt - 2) + (a[w].length > g + qt - 1 ? "…" : "")); return [ s(u, t), new Array(n + m + 2).join("-") + "^", s(t, p) ].filter(Boolean).join(` `).replace(/^(\s+\d+\s+\|\n)+/, "").replace(/\n(\s+\d+\s+\|)+$/, ""); } function ar(e, t, n, r, i, o = 1, s = 1) { return Object.assign(zt("SyntaxError", e), { source: t, offset: n, line: r, column: i, sourceFragment(l) { return sr({ source: t, line: r, column: i, baseLine: o, baseColumn: s }, isNaN(l) ? 0 : l); }, get formattedMessage() { return `Parse error: ${e} ` + sr({ source: t, line: r, column: i, baseLine: o, baseColumn: s }, 2); } }); } function bs(e) { const t = this.createList(); let n = !1; const r = { recognizer: e }; for (; !this.eof; ) { switch (this.tokenType) { case q: this.next(); continue; case j: n = !0, this.next(); continue; } let i = e.getNode.call(this, r); if (i === void 0) break; n && (e.onWhiteSpace && e.onWhiteSpace.call(this, i, t, r), n = !1), t.push(i); } return n && e.onWhiteSpace && e.onWhiteSpace.call(this, null, t, r), t; } const lr = () => { }, ys = 33, ks = 35, Wt = 59, cr = 123, ur = 0; function ws(e) { return function() { return this[e](); }; } function Ut(e) { const t = /* @__PURE__ */ Object.create(null); for (const n of Object.keys(e)) { const r = e[n], i = r.parse || r; i && (t[n] = i); } return t; } function xs(e) { const t = { context: /* @__PURE__ */ Object.create(null), features: Object.assign(/* @__PURE__ */ Object.create(null), e.features), scope: Object.assign(/* @__PURE__ */ Object.create(null), e.scope), atrule: Ut(e.atrule), pseudo: Ut(e.pseudo), node: Ut(e.node) }; for (const [n, r] of Object.entries(e.parseContext)) switch (typeof r) { case "function": t.context[n] = r; break; case "string": t.context[n] = ws(r); break; } return { config: t, ...t, ...t.node }; } function vs(e) { let t = "", n = "<unknown>", r = !1, i = lr, o = !1; const s = new ms(), c = Object.assign(new gs(), xs(e || {}), { parseAtrulePrelude: !0, parseRulePrelude: !0, parseValue: !0, parseCustomProperty: !1, readSequence: bs, consumeUntilBalanceEnd: () => 0, consumeUntilLeftCurlyBracket(a) { return a === cr ? 1 : 0; }, consumeUntilLeftCurlyBracketOrSemicolon(a) { return a === cr || a === Wt ? 1 : 0; }, consumeUntilExclamationMarkOrSemicolon(a) { return a === ys || a === Wt ? 1 : 0; }, consumeUntilSemicolonIncluded(a) { return a === Wt ? 2 : 0; }, createList() { return new B(); }, createSingleNodeList(a) { return new B().appendData(a); }, getFirstListNode(a) { return a && a.first; }, getLastListNode(a) { return a && a.last; }, parseWithFallback(a, u) { const p = this.tokenIndex; try { return a.call(this); } catch (m) { if (o) throw m; this.skip(p - this.tokenIndex); const g = u.call(this); return o = !0, i(m, g), o = !1, g; } }, lookupNonWSType(a) { let u; do if (u = this.lookupType(a++), u !== j && u !== q) return u; while (u !== ur); return ur; }, charCodeAt(a) { return a >= 0 && a < t.length ? t.charCodeAt(a) : 0; }, substring(a, u) { return t.substring(a, u); }, substrToCursor(a) { return this.source.substring(a, this.tokenStart); }, cmpChar(a, u) { return Me(t, a, u); }, cmpStr(a, u, p) { return Ze(t, a, u, p); }, consume(a) { const u = this.tokenStart; return this.eat(a), this.substrToCursor(u); }, consumeFunctionName() { const a = t.substring(this.tokenStart, this.tokenEnd - 1); return this.eat(C), a; }, consumeNumber(a) { const u = t.substring(this.tokenStart, _t(t, this.tokenStart)); return this.eat(a), u; }, eat(a) { if (this.tokenType !== a) { const u = gi[a].slice(0, -6).replace(/-/g, " ").replace(/^./, (g) => g.toUpperCase()); let p = `${/[[\](){}]/.test(u) ? `"${u}"` : u} is expected`, m = this.tokenStart; switch (a) { case b: this.tokenType === C || this.tokenType === U ? (m = this.tokenEnd - 1, p = "Identifier is expected but function found") : p = "Identifier is expected"; break; case I: this.isDelim(ks) && (this.next(), m++, p = "Name is expected"); break; case N: this.tokenType === v && (m = this.tokenEnd, p = "Percent sign is expected"); break; } this.error(p, m); } this.next(); }, eatIdent(a) { (this.tokenType !== b || this.lookupValue(0, a) === !1) && this.error(`Identifier "${a}" is expected`), this.next(); }, eatDelim(a) { this.isDelim(a) || this.error(`Delim "${String.fromCharCode(a)}" is expected`), this.next(); }, getLocation(a, u) { return r ? s.getLocationRange( a, u, n ) : null; }, getLocationFromList(a) { if (r) { const u = this.getFirstListNode(a), p = this.getLastListNode(a); return s.getLocationRange( u !== null ? u.loc.start.offset - s.startOffset : this.tokenStart, p !== null ? p.loc.end.offset - s.startOffset : this.tokenStart, n ); } return null; }, error(a, u) { const p = typeof u < "u" && u < t.length ? s.getLocation(u) : this.eof ? s.getLocation(hs(t, t.length - 1)) : s.getLocation(this.tokenStart); throw new ar( a || "Unexpected input", t, p.offset, p.line, p.column, s.startLine, s.startColumn ); } }); return Object.assign(function(a, u) { t = a, u = u || {}, c.setSource(t, It), s.setSource( t, u.offset, u.line, u.column ), n = u.filename || "<unknown>", r = !!u.positions, i = typeof u.onParseError == "function" ? u.onParseError : lr, o = !1, c.parseAtrulePrelude = "parseAtrulePrelude" in u ? !!u.parseAtrulePrelude : !0, c.parseRulePrelude = "parseRulePrelude" in u ? !!u.parseRulePrelude : !0, c.parseValue = "parseValue" in u ? !!u.parseValue : !0, c.parseCustomProperty = "parseCustomProperty" in u ? !!u.parseCustomProperty : !1; const { context: p = "default", onComment: m } = u; if (!(p in c.context)) throw new Error("Unknown context `" + p + "`"); typeof m == "function" && c.forEachToken((w, M, L) => { if (w === q) { const E = c.getLocation(M, L), y = Ze(t, L - 2, L, "*/") ? t.slice(M + 2, L - 2) : t.slice(M + 2, L); m(y, E); } }); const g = c.context[p].call(c, u); return c.eof || c.error(), g; }, { SyntaxError: ar, config: c.config }); } var Pn = {}, _n = {}, hr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""); _n.encode = function(e) { if (0 <= e && e < hr.length) return hr[e]; throw new TypeError("Must be between 0 and 63: " + e); }; _n.decode = function(e) { var t = 65, n = 90, r = 97, i = 122, o = 48, s = 57, c = 43, l = 47, a = 26, u = 52; return t <= e && e <= n ? e - t : r <= e && e <= i ? e - r + a : o <= e && e <= s ? e - o + u : e == c ? 62 : e == l ? 63 : -1; }; var bi = _n, In = 5, yi = 1 << In, ki = yi - 1, wi = yi; function Ss(e) { return e < 0 ? (-e << 1) + 1 : (e << 1) + 0; } function Cs(e) { var t = (e & 1) === 1, n = e >> 1; return t ? -n : n; } Pn.encode = function(t) { var n = "", r, i = Ss(t); do r = i & ki, i >>>= In, i > 0 && (r |= wi), n += bi.encode(r); while (i > 0); return n; }; Pn.decode = function(t, n, r) { var i = t.length, o = 0, s = 0, c, l; do { if (n >= i) throw new Error("Expected more digits in base 64 VLQ value."); if (l = bi.decode(t.charCodeAt(n++)), l === -1) throw new Error("Invalid base64 digit: " + t.charAt(n - 1)); c = !!(l & wi), l &= ki, o = o + (l << s), s += In; } while (c); r.value = Cs(o), r.rest = n; }; var Mt = {}; (function(e) { function t(h, d, k) { if (d in h) return h[d]; if (arguments.length === 3) return k; throw new Error('"' + d + '" is a required argument.'); } e.getArg = t; var n = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/, r = /^data:.+\,.+$/; function i(h) { var d = h.match(n); return d ? { scheme: d[1], auth: d[2], host: d[3], port: d[4], path: d[5] } : null; } e.urlParse = i; function o(h) { var d = ""; return h.scheme && (d += h.scheme + ":"), d += "//", h.auth && (d += h.auth + "@"), h.host && (d += h.host), h.port && (d += ":" + h.port), h.path && (d += h.path), d; } e.urlGenerate = o; var s = 32; function c(h) { var d = []; return function(k) { for (var f = 0; f < d.length; f++) if (d[f].input === k) { var ge = d[0]; return d[0] = d[f], d[f] = ge, d[0].result; } var ae = h(k); return d.unshift({ input: k, result: ae }), d.length > s && d.pop(), ae; }; } var l = c(function(d) { var k = d, f = i(d); if (f) { if (!f.path) return d; k = f.path; } for (var ge = e.isAbsolute(k), ae = [], rt = 0, Y = 0; ; ) if (rt = Y, Y = k.indexOf("/", rt), Y === -1) { ae.push(k.slice(rt)); break; } else for (ae.push(k.slice(rt, Y)); Y < k.length && k[Y] === "/"; ) Y++; for (var it, Re = 0, Y = ae.length - 1; Y >= 0; Y--) it = ae[Y], it === "." ? ae.splice(Y, 1) : it === ".." ? Re++ : Re > 0 && (it === "" ? (ae.splice(Y + 1, Re), Re = 0) : (ae.splice(Y, 2), Re--)); return k = ae.join("/"), k === "" && (k = ge ? "/" : "."), f ? (f.path = k, o(f)) : k; }); e.normalize = l; function a(h, d) { h === "" && (h = "."), d === "" && (d = "."); var k = i(d), f = i(h); if (f && (h = f.path || "/"), k && !k.scheme) return f && (k.scheme = f.scheme), o(k); if (k || d.match(r)) return d; if (f && !f.host && !f.path) return f.host = d, o(f); var ge = d.charAt(0) === "/" ? d : l(h.replace(/\/+$/, "") + "/" + d); return f ? (f.path = ge, o(f)) : ge; } e.join = a, e.isAbsolute = function(h) { return h.charAt(0) === "/" || n.test(h); }; function u(h, d) { h === "" && (h = "."), h = h.replace(/\/$/, ""); for (var k = 0; d.indexOf(h + "/") !== 0; ) { var f = h.lastIndexOf("/"); if (f < 0 || (h = h.slice(0, f), h.match(/^([^\/]+:\/)?\/*$/))) return d; ++k; } return Array(k + 1).join("../") + d.substr(h.length + 1); } e.relative = u; var p = function() { var h = /* @__PURE__ */ Object.create(null); return !("__proto__" in h); }(); function m(h) { return h; } function g(h) { return M(h) ? "$" + h : h; } e.toSetString = p ? m : g; function w(h) { return M(h) ? h.slice(1) : h; } e.fromSetString = p ? m : w; function M(h) { if (!h) return !1; var d = h.length; if (d < 9 || h.charCodeAt(d - 1) !== 95 || h.charCodeAt(d - 2) !== 95 || h.charCodeAt(d - 3) !== 111 || h.charCodeAt(d - 4) !== 116 || h.charCodeAt(d - 5) !== 111 || h.charCodeAt(d - 6) !== 114 || h.charCodeAt(d - 7) !== 112 || h.charCodeAt(d - 8) !== 95 || h.charCodeAt(d - 9) !== 95) return !1; for (var k = d - 10; k >= 0; k--) if (h.charCodeAt(k) !== 36) return !1; return !0; } function L(h, d, k) { var f = S(h.source, d.source); return f !== 0 || (f = h.originalLine - d.originalLine, f !== 0) || (f = h.originalColumn - d.originalColumn, f !== 0 || k) || (f = h.generatedColumn - d.generatedColumn, f !== 0) || (f = h.generatedLine - d.generatedLine, f !== 0) ? f : S(h.name, d.name); } e.compareByOriginalPositions = L; function E(h, d, k) { var f; return f = h.originalLine - d.originalLine, f !== 0 || (f = h.originalColumn - d.originalColumn, f !== 0 || k) || (f = h.generatedColumn - d.generatedColumn, f !== 0) || (f = h.generatedLine - d.generatedLine, f !== 0) ? f : S(h.name, d.name); } e.compareByOriginalPositionsNoSource = E; function y(h, d, k) { var f = h.generatedLine - d.generatedLine; return f !== 0 || (f = h.generatedColumn - d.generatedColumn, f !== 0 || k) || (f = S(h.source, d.source), f !== 0) || (f = h.originalLine - d.originalLine, f !== 0) || (f = h.originalColumn - d.originalColumn, f !== 0) ? f : S(h.name, d.name); } e.compareByGeneratedPositionsDeflated = y; function z(h, d, k) { var f = h.generatedColumn - d.generatedColumn; return f !== 0 || k || (f = S(h.source, d.source), f !== 0) || (f = h.originalLine - d.originalLine, f !== 0) || (f = h.originalColumn - d.originalColumn, f !== 0) ? f : S(h.name, d.name); } e.compareByGeneratedPositionsDeflatedNoLine = z; function S(h, d) { return h === d ? 0 : h === null ? 1 : d === null ? -1 : h > d ? 1 : -1; } function Q(h, d) { var k = h.generatedLine - d.generatedLine; return k !== 0 || (k = h.generatedColumn - d.generatedColumn, k !== 0) || (k = S(h.source, d.source), k !== 0) || (k = h.originalLine - d.originalLine, k !== 0) || (k = h.originalColumn - d.originalColumn, k !== 0) ? k : S(h.name, d.name); } e.compareByGeneratedPositionsInflated = Q; function se(h) { return JSON.parse(h.replace(/^\)]}'[^\n]*\n/, "")); } e.parseSourceMapInput = se; function R(h, d, k) { if (d = d || "", h && (h[h.length - 1] !== "/" && d[0] !== "/" && (h += "/"), d = h + d), k) { var f = i(k); if (!f) throw new Error("sourceMapURL could not be parsed"); if (f.path) { var ge = f.path.lastIndexOf("/"); ge >= 0 && (f.path = f.path.substring(0, ge + 1)); } d = a(o(f), d); } return l(d); } e.computeSourceURL = R; })(Mt); var xi = {}, zn = Mt, Mn = Object.prototype.hasOwnProperty, Te = typeof Map < "u"; function ye() { this._array = [], this._set = Te ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null); } ye.fromArray = function(t, n) { for (var r = new ye(), i = 0, o = t.length; i < o; i++) r.add(t[i], n); return r; }; ye.prototype.size = function() { return Te ? this._set.size : Object.getOwnPropertyNames(this._set).length; }; ye.prototype.add = function(t, n) { var r = Te ? t : zn.toSetString(t), i = Te ? this.has(t) : Mn.call(this._set, r), o = this._array.length; (!i || n) && this._array.push(t), i || (Te ? this._set.set(t, o) : this._set[r] = o); }; ye.prototype.has = function(t) { if (Te) return this._set.has(t); var n = zn.toSetString(t); return Mn.call(this._set, n); }; ye.prototype.indexOf = function(t) { if (Te) { var n = this._set.get(t); if (n >= 0) return n; } else { var r = zn.toSetString(t); if (Mn.call(this._set, r)) return this._set[r]; } throw new Error('"' + t + '" is not in the set.'); }; ye.prototype.at = function(t) { if (t >= 0 && t < this._array.length) return this._array[t]; throw new Error("No element indexed by " + t); }; ye.prototype.toArray = function() { return this._array.slice(); }; xi.ArraySet = ye; var vi = {}, Si = Mt; function Es(e, t) { var n = e.generatedLine, r = t.generatedLine, i = e.generatedColumn, o = t.generatedColumn; return r > n || r == n && o >= i || Si.compareByGeneratedPositionsInflated(e, t) <= 0; } function Nt() { this._array = [], this._sorted = !0, this._last = { generatedLine: -1, generatedColumn: 0 }; } Nt.prototype.unsortedForEach = function(t, n) { this._array.forEach(t, n); }; Nt.prototype.add = function(t) { Es(this._last, t) ? (this._last = t, this._array.push(t)) : (this._sorted = !1, this._array.push(t)); }; Nt.prototype.toArray = function() { return this._sorted || (this._array.sort(Si.compareByGeneratedPositionsInflated), this._sorted = !0), this._array; }; vi.MappingList = Nt; var Be = Pn, F = Mt, St = xi.ArraySet, Ts = vi.MappingList; function oe(e) { e || (e = {}), this._file = F.getArg(e, "file", null), this._sourceRoot = F.getArg(e, "sourceRoot", null), this._skipValidation = F.getArg(e, "skipValidation", !1), this._ignoreInvalidMapping = F.getArg(e, "ignoreInvalidMapping", !1), this._sources = new St(), this._names = new St(), this._mappings = new Ts(), this._sourcesContents = null; } oe.prototype._version = 3; oe.fromSourceMap = function(t, n) { var r = t.sourceRoot, i = new oe(Object.assign(n || {}, { file: t.file, sourceRoot: r })); return t.eachMapping(function(o) { var s = { generated: { line: o.generatedLine, column: o.generatedColumn } }; o.source != null && (s.source = o.source, r != null && (s.source = F.relative(r, s.source)), s.original = { line: o.originalLine, column: o.originalColumn }, o.name != null && (s.name = o.name)), i.addMapping(s); }), t.sources.forEach(function(o) { var s = o; r !== null && (s = F.relative(r, o)), i._sources.has(s) || i._sources.add(s); var c = t.sourceContentFor(o); c != null && i.setSourceContent(o, c); }), i; }; oe.prototype.addMapping = function(t) { var n = F.getArg(t, "generated"), r = F.getArg(t, "original", null), i = F.getArg(t, "source", null), o = F.getArg(t, "name", null); !this._skipValidation && this._validateMapping(n, r, i, o) === !1 || (i != null && (i = String(i), this._sources.has(i) || this._sources.add(i)), o != null && (o = String(o), this._names.has(o) || this._names.add(o)), this._mappings.add({ generatedLine: n.line, generatedColumn: n.column, originalLine: r != null && r.line, originalColumn: r != null && r.column, source: i, name: o })); }; oe.prototype.setSourceContent = function(t, n) { var r = t; this._sourceRoot != null && (r = F.relative(this._sourceRoot, r)), n != null ? (this._sourcesContents || (this._sourcesContents = /* @__PURE__ */ Object.create(null)), this._sourcesContents[F.toSetString(r)] = n) : this._sourcesContents && (delete this._sourcesContents[F.toSetString(r)], Object.keys(this._sourcesContents).length === 0 && (this._sourcesContents = null)); }; oe.prototype.applySourceMap = function(t, n, r) { var i = n; if (n == null) { if (t.file == null) throw new Error( `SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.` ); i = t.file; } var o = this._sourceRoot; o != null && (i = F.relative(o, i)); var s = new St(), c = new St(); this._mappings.unsortedForEach(function(l) { if (l.source === i && l.originalLine != null) { var a = t.originalPositionFor({ line: l.originalLine, column: l.originalColumn }); a.source != null && (l.source = a.source, r != null && (l.source = F.join(r, l.source)), o != null && (l.source = F.relative(o, l.source)), l.originalLine = a.line, l.originalColumn = a.column, a.name != null && (l.name = a.name)); } var u = l.source; u != null && !s.has(u) && s.add(u); var p = l.name; p != null && !c.has(p) && c.add(p); }, this), this._sources = s, this._names = c, t.sources.forEach(function(l) { var a = t.sourceContentFor(l); a != null && (r != null && (l = F.join(r, l)), o != null && (l = F.relative(o, l)), this.setSourceContent(l, a)); }, this); }; oe.prototype._validateMapping = function(t, n, r, i) { if (n && typeof n.line != "number" && typeof n.column != "number") { var o = "original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values."; if (this._ignoreInvalidMapping) return typeof console < "u" && console.warn && console.warn(o), !1; throw new Error(o); } if (!(t && "line" in t && "column" in t && t.line > 0 && t.column >= 0 && !n && !r && !i)) { if (t && "line" in t && "column" in t && n && "line" in n && "column" in n && t.line > 0 && t.column >= 0 && n.line > 0 && n.column >= 0 && r) return; var o = "Invalid mapping: " + JSON.stringify({ generated: t, source: r, original: n, name: i }); if (this._ignoreInvalidMapping) return typeof console < "u" && console.warn && console.warn(o), !1; throw new Error(o); } }; oe.prototype._serializeMappings = function() { for (var t = 0, n = 1, r = 0, i = 0, o = 0, s = 0, c = "", l, a, u, p, m = this._mappings.toArray(), g = 0, w = m.length; g < w; g++) { if (a = m[g], l = "", a.generatedLine !== n) for (t = 0; a.generatedLine !== n; ) l += ";", n++; else if (g > 0) { if (!F.compareByGeneratedPositionsInflated(a, m[g - 1])) continue; l += ","; } l += Be.encode(a.generatedColumn - t), t = a.generatedColumn, a.source != null && (p = this._sources.indexOf(a.source), l += Be.encode(p - s), s = p, l += Be.encode(a.originalLine - 1 - i), i = a.originalLine - 1, l += Be.encode(a.originalColumn - r), r = a.originalColumn, a.name != null && (u = this._names.indexOf(a.name), l += Be.encode(u - o), o = u)), c += l; } return c; }; oe.prototype._generateSourcesContent = function(t, n) { return t.map(function(r) { if (!this._sourcesContents) return null; n != null && (r = F.relative(n, r)); var i = F.toSetString(r); return Object.prototype.hasOwnProperty.call(this._sourcesContents, i) ? this._sourcesContents[i] : null; }, this); }; oe.prototype.toJSON = function() { var t = { version: this._version, sources: this._sources.toArray(), names: this._names.toArray(), mappings: this._serializeMappings() }; return this._file != null && (t.file = this._file), this._sourceRoot != null && (t.sourceRoot = this._sourceRoot), this._sourcesContents && (t.sourcesContent = this._generateSourcesContent(t.sources, t.sourceRoot)), t; }; oe.prototype.toString = function() { return JSON.stringify(this.toJSON()); }; var As = oe; const pr = /* @__PURE__ */ new Set(["Atrule", "Selector", "Declaration"]); function $s(e) { const t = new As(), n = { line: 1, column: 0 }, r = { line: 0, // should be zero to add first mapping column: 0 }, i = { line: 1, column: 0 }, o = { generated: i }; let s = 1, c = 0, l = !1; const a = e.node; e.node = function(m) { if (m.loc && m.loc.start && pr.has(m.type)) { const g = m.loc.start.line, w = m.loc.start.column - 1; (r.line !== g || r.column !== w) && (r.line = g, r.column = w, n.line = s, n.column = c, l && (l = !1, (n.line !== i.line || n.column !== i.column) && t.addMapping(o)), l = !0, t.addMapping({ source: m.loc.source, original: r, generated: n })); } a.call(this, m), l && pr.has(m.type) && (i.line = s, i.column = c); }; const u = e.emit; e.emit = function(m, g, w) { for (let M = 0; M < m.length; M++) m.charCodeAt(M) === 10 ? (s++, c = 0) : c++; u(m, g, w); }; const p = e.result; return e.result = function() { return l && t.addMapping(o), { css: p(), map: t }; }, e; } const Os = 43, Ls = 45, Gt = (e, t) => { if (e === A && (e = t), typeof e == "string") { const n = e.charCodeAt(0); return n > 127 ? 32768 : n << 8; } return e; }, Ci = [ [b, b], [b, C], [b, U], [b, X], [b, "-"], [b, v], [b, N], [b, T], [b, J], [b, $], [D, b], [D, C], [D, U], [D, X], [D, "-"], [D, v], [D, N], [D, T], [D, J], [I, b], [I, C], [I, U], [I, X], [I, "-"], [I, v], [I, N], [I, T], [I, J], [T, b], [T, C], [T, U], [T, X], [T, "-"], [T, v], [T, N], [T, T], [T, J], ["#", b], ["#", C], ["#", U], ["#", X], ["#", "-"], ["#", v], ["#", N], ["#", T], ["#", J], // https://github.com/w3c/csswg-drafts/pull/6874 ["-", b], ["-", C], ["-", U], ["-", X], ["-", "-"], ["-", v], ["-", N], ["-", T], ["-", J], // https://github.com/w3c/csswg-drafts/pull/6874 [v, b], [v, C], [v, U], [v, X], [v, v], [v, N], [v, T], [v, "%"], [v, J], // https://github.com/w3c/csswg-drafts/pull/6874 ["@", b], ["@", C], ["@", U], ["@", X], ["@", "-"], ["@", J], // https://github.com/w3c/csswg-drafts/pull/6874 [".", v], [".", N], [".", T], ["+", v], ["+", N], ["+", T], ["/", "*"] ], Ps = Ci.concat([ [b, I], [T, I], [I, I], [D, $], [D, he], [D, G], [N, N], [N, T], [N, C], [N, "-"], [x, b], [x, C], [x, N], [x, T], [x, I], [x, "-"] ]); function Ei(e) { const t = new Set( e.map(([n, r]) => Gt(n) << 16 | Gt(r)) ); return function(n, r, i) { const o = Gt(r, i), s = i.charCodeAt(0); return (s === Ls && r !== b && r !== C && r !== J || s === Os ? t.has(n << 16 | s << 8) : t.has(n << 16 | o)) && this.emit(" ", j, !0), o; }; } const _s = Ei(Ci), Ti = Ei(Ps), dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, safe: Ti, spec: _s }, Symbol.toStringTag, { value: "Module" })), Is = 92; function zs(e, t) { if (typeof t == "function") { let n = null; e.children.forEach((r) => { n !== null && t.call(this, n), this.node(r), n = r; }); return; } e.children.forEach(this.node, this); } function Ms(e) { It(e, (t, n, r) => { this.token(t, e.slice(n, r)); }); } function Ns(e) { const t = /* @__PURE__ */ new Map(); for (let [n, r] of Object.entries(e.node)) typeof (r.generate || r) == "function" && t.set(n, r.generate || r); return function(n, r) { let i = "", o = 0, s = { node(l) { if (t.has(l.type)) t.get(l.type).call(c, l); else throw new Error("Unknown node type: " + l.type); }, tokenBefore: Ti, token(l, a) { o = this.tokenBefore(o, l, a), this.emit(a, l, !1), l === A && a.charCodeAt(0) === Is && this.emit(` `, j, !0); }, emit(l) { i += l; }, result() { return i; } }; r && (typeof r.decorator == "function" && (s = r.decorator(s)), r.sourceMap && (s = $s(s)), r.mode in dr && (s.tokenBefore = dr[r.mode])); const c = { node: (l) => s.node(l), children: zs, token: (l, a) => s.token(l, a), tokenize: Ms }; return s.node(n), s.result(); }; } function js(e) { return { fromPlainObject(t) { return e(t, { enter(n) { n.children && !(n.children instanceof B) && (n.children = new B().fromArray(n.children)); } }), t; }, toPlainObject(t) { return e(t, { leave(n) { n.children && n.children instanceof B && (n.children = n.children.toArray()); } }), t; } }; } const { hasOwnProperty: Nn } = Object.prototype, Ve = function() { }; function mr(e) { return typeof e == "function" ? e : Ve; } function fr(e, t) { return function(n, r, i) { n.type === t && e.call(this, n, r, i); }; } function Fs(e, t) { const n = t.structure, r = []; for (const i in n) { if (Nn.call(n, i) === !1) continue; let o = n[i]; const s = { name: i, type: !1, nullable: !1 }; Array.isArray(o) || (o = [o]); for (const c of o) c === null ? s.nullable = !0 : typeof c == "string" ? s.type = "node" : Array.isArray(c) && (s.type = "list"); s.type && r.push(s); } return r.length ? { context: t.walkContext, fields: r } : null; } function Ds(e) { const t = {}; for (const n in e.node) if (Nn.call(e.node, n)) { const r = e.node[n];