view-transitions-polyfill
Version:
A polyfill for the View Transitions API.
1,686 lines • 290 kB
JavaScript
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), 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, S = 2, F = 3, I = 4, he = 5, Pt = 6, U = 7, Y = 8, A = 9, v = 10, M = 11, T = 12, N = 13, nt = 14, X = 15, G = 16, K = 17, J = 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, l = e.startColumn;
for (let c = r; c < n; c++) {
const a = t.charCodeAt(c);
i[c] = s, o[c] = l++, (a === tr || a === nr || a === ds) && (a === nr && c + 1 < n && t.charCodeAt(c + 1) === tr && (c++, i[c] = s, o[c] = l), s++, l = 1);
}
i[n] = s, o[n] = l, 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([
[S, 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, l = 0, c = 0, a = -1;
for (this.offsetAndType = null, this.balance = null, n(t, (u, p, d) => {
switch (u) {
default:
o[s] = r;
break;
case l: {
let g = c & ne;
for (c = o[g], l = c >> pe, o[s] = g, o[g++] = s; g < s; g++)
o[g] === r && (o[g] = s);
break;
}
case $:
case S:
case te:
case H:
o[s] = c, l = fs.get(u), c = l << pe | s;
break;
}
i[s++] = u << pe | d, a === -1 && (a = p);
}), i[s] = xe << pe | r, o[s] = r, o[r] = r; c !== 0; ) {
const u = c & ne;
c = 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 !== N && 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 !== N && 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 === N || 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, l = o >> pe;
r = s, t(l, 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 < l ? 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 = M, 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 = S, a = p + 4;
return;
}
s();
return;
}
if (n(a) === 40) {
u = S, a++;
return;
}
u = b;
}
function o(p) {
for (p || (p = n(a++)), u = he; a < e.length; a++) {
const d = e.charCodeAt(a);
switch (Bt(d)) {
case p:
a++;
return;
case ft:
if (xt(d)) {
a += hn(e, a, d), 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(d, 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 = Y;
return;
case 34:
case 39:
case 40:
case mi:
a = Vt(e, a), u = Y;
return;
case 92:
if (fe(p, n(a + 1))) {
a = Ne(e, a) - 1;
break;
}
a = Vt(e, a), u = Y;
return;
}
}
}
e = String(e || "");
const l = e.length;
let c = pi(n(0)), a = c, u;
for (; a < l; ) {
const p = e.charCodeAt(a);
switch (Bt(p)) {
case ft:
u = N, 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 = J, a++;
break;
case 45:
Rt(p, n(a + 1), n(a + 2)) ? r() : n(a + 1) === 45 && n(a + 2) === 62 ? (u = X, 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 = F, 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, c, c = 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, z) {
return a.slice(w, z).map(
(L, y) => String(w + y + 1).padStart(d) + " |" + L
).join(`
`);
}
const l = `
`.repeat(Math.max(r - 1, 0)), c = " ".repeat(Math.max(i - 1, 0)), a = (l + c + e).split(/\r\n?|\n|\f/), u = Math.max(1, t - o) - 1, p = Math.min(t + o, a.length + 1), d = 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 + d + 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(c) {
return sr({ source: t, line: r, column: i, baseLine: o, baseColumn: s }, isNaN(c) ? 0 : c);
},
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 N:
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(), l = 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 (d) {
if (o)
throw d;
this.skip(p - this.tokenIndex);
const g = u.call(this);
return o = !0, i(d, g), o = !1, g;
}
},
lookupNonWSType(a) {
let u;
do
if (u = this.lookupType(a++), u !== N && 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(S), 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`, d = this.tokenStart;
switch (a) {
case b:
this.tokenType === S || this.tokenType === U ? (d = this.tokenEnd - 1, p = "Identifier is expected but function found") : p = "Identifier is expected";
break;
case I:
this.isDelim(ks) && (this.next(), d++, p = "Name is expected");
break;
case M:
this.tokenType === v && (d = this.tokenEnd, p = "Percent sign is expected");
break;
}
this.error(p, d);
}
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 || {}, l.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, l.parseAtrulePrelude = "parseAtrulePrelude" in u ? !!u.parseAtrulePrelude : !0, l.parseRulePrelude = "parseRulePrelude" in u ? !!u.parseRulePrelude : !0, l.parseValue = "parseValue" in u ? !!u.parseValue : !0, l.parseCustomProperty = "parseCustomProperty" in u ? !!u.parseCustomProperty : !1;
const { context: p = "default", onComment: d } = u;
if (!(p in l.context))
throw new Error("Unknown context `" + p + "`");
typeof d == "function" && l.forEachToken((w, z, L) => {
if (w === q) {
const y = l.getLocation(z, L), C = Ze(t, L - 2, L, "*/") ? t.slice(z + 2, L - 2) : t.slice(z + 2, L);
d(C, y);
}
});
const g = l.context[p].call(l, u);
return l.eof || l.error(), g;
}, {
SyntaxError: ar,
config: l.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, l = 43, c = 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 == l ? 62 : e == c ? 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, l, c;
do {
if (n >= i)
throw new Error("Expected more digits in base 64 VLQ value.");
if (c = bi.decode(t.charCodeAt(n++)), c === -1)
throw new Error("Invalid base64 digit: " + t.charAt(n - 1));
l = !!(c & wi), c &= ki, o = o + (c << s), s += In;
} while (l);
r.value = Cs(o), r.rest = n;
};
var Mt = {};
(function(e) {
function t(h, m, k) {
if (m in h)
return h[m];
if (arguments.length === 3)
return k;
throw new Error('"' + m + '" is a required argument.');
}
e.getArg = t;
var n = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/, r = /^data:.+\,.+$/;
function i(h) {
var m = h.match(n);
return m ? {
scheme: m[1],
auth: m[2],
host: m[3],
port: m[4],
path: m[5]
} : null;
}
e.urlParse = i;
function o(h) {
var m = "";
return h.scheme && (m += h.scheme + ":"), m += "//", h.auth && (m += h.auth + "@"), h.host && (m += h.host), h.port && (m += ":" + h.port), h.path && (m += h.path), m;
}
e.urlGenerate = o;
var s = 32;
function l(h) {
var m = [];
return function(k) {
for (var f = 0; f < m.length; f++)
if (m[f].input === k) {
var ge = m[0];
return m[0] = m[f], m[f] = ge, m[0].result;
}
var ae = h(k);
return m.unshift({
input: k,
result: ae
}), m.length > s && m.pop(), ae;
};
}
var c = l(function(m) {
var k = m, f = i(m);
if (f) {
if (!f.path)
return m;
k = f.path;
}
for (var ge = e.isAbsolute(k), ae = [], rt = 0, Q = 0; ; )
if (rt = Q, Q = k.indexOf("/", rt), Q === -1) {
ae.push(k.slice(rt));
break;
} else
for (ae.push(k.slice(rt, Q)); Q < k.length && k[Q] === "/"; )
Q++;
for (var it, Re = 0, Q = ae.length - 1; Q >= 0; Q--)
it = ae[Q], it === "." ? ae.splice(Q, 1) : it === ".." ? Re++ : Re > 0 && (it === "" ? (ae.splice(Q + 1, Re), Re = 0) : (ae.splice(Q, 2), Re--));
return k = ae.join("/"), k === "" && (k = ge ? "/" : "."), f ? (f.path = k, o(f)) : k;
});
e.normalize = c;
function a(h, m) {
h === "" && (h = "."), m === "" && (m = ".");
var k = i(m), f = i(h);
if (f && (h = f.path || "/"), k && !k.scheme)
return f && (k.scheme = f.scheme), o(k);
if (k || m.match(r))
return m;
if (f && !f.host && !f.path)
return f.host = m, o(f);
var ge = m.charAt(0) === "/" ? m : c(h.replace(/\/+$/, "") + "/" + m);
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, m) {
h === "" && (h = "."), h = h.replace(/\/$/, "");
for (var k = 0; m.indexOf(h + "/") !== 0; ) {
var f = h.lastIndexOf("/");
if (f < 0 || (h = h.slice(0, f), h.match(/^([^\/]+:\/)?\/*$/)))
return m;
++k;
}
return Array(k + 1).join("../") + m.substr(h.length + 1);
}
e.relative = u;
var p = function() {
var h = /* @__PURE__ */ Object.create(null);
return !("__proto__" in h);
}();
function d(h) {
return h;
}
function g(h) {
return z(h) ? "$" + h : h;
}
e.toSetString = p ? d : g;
function w(h) {
return z(h) ? h.slice(1) : h;
}
e.fromSetString = p ? d : w;
function z(h) {
if (!h)
return !1;
var m = h.length;
if (m < 9 || h.charCodeAt(m - 1) !== 95 || h.charCodeAt(m - 2) !== 95 || h.charCodeAt(m - 3) !== 111 || h.charCodeAt(m - 4) !== 116 || h.charCodeAt(m - 5) !== 111 || h.charCodeAt(m - 6) !== 114 || h.charCodeAt(m - 7) !== 112 || h.charCodeAt(m - 8) !== 95 || h.charCodeAt(m - 9) !== 95)
return !1;
for (var k = m - 10; k >= 0; k--)
if (h.charCodeAt(k) !== 36)
return !1;
return !0;
}
function L(h, m, k) {
var f = E(h.source, m.source);
return f !== 0 || (f = h.originalLine - m.originalLine, f !== 0) || (f = h.originalColumn - m.originalColumn, f !== 0 || k) || (f = h.generatedColumn - m.generatedColumn, f !== 0) || (f = h.generatedLine - m.generatedLine, f !== 0) ? f : E(h.name, m.name);
}
e.compareByOriginalPositions = L;
function y(h, m, k) {
var f;
return f = h.originalLine - m.originalLine, f !== 0 || (f = h.originalColumn - m.originalColumn, f !== 0 || k) || (f = h.generatedColumn - m.generatedColumn, f !== 0) || (f = h.generatedLine - m.generatedLine, f !== 0) ? f : E(h.name, m.name);
}
e.compareByOriginalPositionsNoSource = y;
function C(h, m, k) {
var f = h.generatedLine - m.generatedLine;
return f !== 0 || (f = h.generatedColumn - m.generatedColumn, f !== 0 || k) || (f = E(h.source, m.source), f !== 0) || (f = h.originalLine - m.originalLine, f !== 0) || (f = h.originalColumn - m.originalColumn, f !== 0) ? f : E(h.name, m.name);
}
e.compareByGeneratedPositionsDeflated = C;
function D(h, m, k) {
var f = h.generatedColumn - m.generatedColumn;
return f !== 0 || k || (f = E(h.source, m.source), f !== 0) || (f = h.originalLine - m.originalLine, f !== 0) || (f = h.originalColumn - m.originalColumn, f !== 0) ? f : E(h.name, m.name);
}
e.compareByGeneratedPositionsDeflatedNoLine = D;
function E(h, m) {
return h === m ? 0 : h === null ? 1 : m === null ? -1 : h > m ? 1 : -1;
}
function Z(h, m) {
var k = h.generatedLine - m.generatedLine;
return k !== 0 || (k = h.generatedColumn - m.generatedColumn, k !== 0) || (k = E(h.source, m.source), k !== 0) || (k = h.originalLine - m.originalLine, k !== 0) || (k = h.originalColumn - m.originalColumn, k !== 0) ? k : E(h.name, m.name);
}
e.compareByGeneratedPositionsInflated = Z;
function se(h) {
return JSON.parse(h.replace(/^\)]}'[^\n]*\n/, ""));
}
e.parseSourceMapInput = se;
function R(h, m, k) {
if (m = m || "", h && (h[h.length - 1] !== "/" && m[0] !== "/" && (h += "/"), m = h + m), 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));
}
m = a(o(f), m);
}
return c(m);
}
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, j = Mt, St = xi.ArraySet, Ts = vi.MappingList;
function oe(e) {
e || (e = {}), this._file = j.getArg(e, "file", null), this._sourceRoot = j.getArg(e, "sourceRoot", null), this._skipValidation = j.getArg(e, "skipValidation", !1), this._ignoreInvalidMapping = j.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 = j.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 = j.relative(r, o)), i._sources.has(s) || i._sources.add(s);
var l = t.sourceContentFor(o);
l != null && i.setSourceContent(o, l);
}), i;
};
oe.prototype.addMapping = function(t) {
var n = j.getArg(t, "generated"), r = j.getArg(t, "original", null), i = j.getArg(t, "source", null), o = j.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 = j.relative(this._sourceRoot, r)), n != null ? (this._sourcesContents || (this._sourcesContents = /* @__PURE__ */ Object.create(null)), this._sourcesContents[j.toSetString(r)] = n) : this._sourcesContents && (delete this._sourcesContents[j.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 = j.relative(o, i));
var s = new St(), l = new St();
this._mappings.unsortedForEach(function(c) {
if (c.source === i && c.originalLine != null) {
var a = t.originalPositionFor({
line: c.originalLine,
column: c.originalColumn
});
a.source != null && (c.source = a.source, r != null && (c.source = j.join(r, c.source)), o != null && (c.source = j.relative(o, c.source)), c.originalLine = a.line, c.originalColumn = a.column, a.name != null && (c.name = a.name));
}
var u = c.source;
u != null && !s.has(u) && s.add(u);
var p = c.name;
p != null && !l.has(p) && l.add(p);
}, this), this._sources = s, this._names = l, t.sources.forEach(function(c) {
var a = t.sourceContentFor(c);
a != null && (r != null && (c = j.join(r, c)), o != null && (c = j.relative(o, c)), this.setSourceContent(c, 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, l = "", c, a, u, p, d = this._mappings.toArray(), g = 0, w = d.length; g < w; g++) {
if (a = d[g], c = "", a.generatedLine !== n)
for (t = 0; a.generatedLine !== n; )
c += ";", n++;
else if (g > 0) {
if (!j.compareByGeneratedPositionsInflated(a, d[g - 1]))
continue;
c += ",";
}
c += Be.encode(a.generatedColumn - t), t = a.generatedColumn, a.source != null && (p = this._sources.indexOf(a.source), c += Be.encode(p - s), s = p, c += Be.encode(a.originalLine - 1 - i), i = a.originalLine - 1, c += Be.encode(a.originalColumn - r), r = a.originalColumn, a.name != null && (u = this._names.indexOf(a.name), c += Be.encode(u - o), o = u)), l += c;
}
return l;
};
oe.prototype._generateSourcesContent = function(t, n) {
return t.map(function(r) {
if (!this._sourcesContents)
return null;
n != null && (r = j.relative(n, r));
var i = j.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, l = 0, c = !1;
const a = e.node;
e.node = function(d) {
if (d.loc && d.loc.start && pr.has(d.type)) {
const g = d.loc.start.line, w = d.loc.start.column - 1;
(r.line !== g || r.column !== w) && (r.line = g, r.column = w, n.line = s, n.column = l, c && (c = !1, (n.line !== i.line || n.column !== i.column) && t.addMapping(o)), c = !0, t.addMapping({
source: d.loc.source,
original: r,
generated: n
}));
}
a.call(this, d), c && pr.has(d.type) && (i.line = s, i.column = l);
};
const u = e.emit;
e.emit = function(d, g, w) {
for (let z = 0; z < d.length; z++)
d.charCodeAt(z) === 10 ? (s++, l = 0) : l++;
u(d, g, w);
};
const p = e.result;
return e.result = function() {
return c && 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, S],
[b, U],
[b, Y],
[b, "-"],
[b, v],
[b, M],
[b, T],
[b, X],
[b, $],
[F, b],
[F, S],
[F, U],
[F, Y],
[F, "-"],
[F, v],
[F, M],
[F, T],
[F, X],
[I, b],
[I, S],
[I, U],
[I, Y],
[I, "-"],
[I, v],
[I, M],
[I, T],
[I, X],
[T, b],
[T, S],
[T, U],
[T, Y],
[T, "-"],
[T, v],
[T, M],
[T, T],
[T, X],
["#", b],
["#", S],
["#", U],
["#", Y],
["#", "-"],
["#", v],
["#", M],
["#", T],
["#", X],
// https://github.com/w3c/csswg-drafts/pull/6874
["-", b],
["-", S],
["-", U],
["-", Y],
["-", "-"],
["-", v],
["-", M],
["-", T],
["-", X],
// https://github.com/w3c/csswg-drafts/pull/6874
[v, b],
[v, S],
[v, U],
[v, Y],
[v, v],
[v, M],
[v, T],
[v, "%"],
[v, X],
// https://github.com/w3c/csswg-drafts/pull/6874
["@", b],
["@", S],
["@", U],
["@", Y],
["@", "-"],
["@", X],
// https://github.com/w3c/csswg-drafts/pull/6874
[".", v],
[".", M],
[".", T],
["+", v],
["+", M],
["+", T],
["/", "*"]
], Ps = Ci.concat([
[b, I],
[T, I],
[I, I],
[F, $],
[F, he],
[F, G],
[M, M],
[M, T],
[M, S],
[M, "-"],
[x, b],
[x, S],
[x, M],
[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 !== S && r !== X || s === Os ? t.has(n << 16 | s << 8) : t.has(n << 16 | o)) && this.emit(" ", N, !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(c) {
if (t.has(c.type))
t.get(c.type).call(l, c);
else
throw new Error("Unknown node type: " + c.type);
},
tokenBefore: Ti,
token(c, a) {
o = this.tokenBefore(o, c, a), this.emit(a, c, !1), c === A && a.charCodeAt(0) === Is && this.emit(`
`, N, !0);
},
emit(c) {
i += c;
},
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 l = {
node: (c) => s.node(c),
children: zs,
token: (c, a) => s.token(c, 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 l of o)
l === null ? s.nullable = !0 : typeof l == "string" ? s.type = "node" : Array.isArray(l) && (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];
if (!r.structure)
throw new Error("Missed `structure` field in `" + n + "` node type definition");
t[n] = Fs(n, r);
}
return t;
}
function gr(e, t) {
const n = e.fields.slice(), r = e.context, i = typeof r == "string";