@divkitframework/divkit
Version:
DivKit for the web
1,289 lines • 699 kB
JavaScript
var sd = Object.defineProperty;
var ld = (e, r, t) => r in e ? sd(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
var br = (e, r, t) => ld(e, typeof r != "symbol" ? r + "" : r, t);
/*!
DivKit v32.6.0
https://github.com/divkit/divkit
@licence Apache-2.0
*/
function yl(e) {
return BigInt(e);
}
const Eo = yl("9223372036854775807"), Ao = yl("-9223372036854775808");
function _n(e) {
const r = yl(e);
if (r > Eo || r < Ao)
throw new Error("Integer overflow.");
return r;
}
const Wi = _n(0);
function xu(e) {
let r = e;
return r < 0 && (r = -r), r;
}
function $u(e) {
let r = 0;
return e > 0 ? r = 1 : e < 0 && (r = -1), _n(r);
}
function ad(e, r) {
return r && r[3] && r[7] ? { type: "ConditionalExpression", test: e, consequent: r[3], alternate: r[7] } : e;
}
function cd(e, r) {
return r && r[3] ? { type: "TryExpression", test: e, alternate: r[3] } : e;
}
function Do(e, r) {
return r.length ? r.reduce((t, n) => ({
type: "BinaryExpression",
operator: n[1],
left: t,
right: n[3]
}), e) : e;
}
function Ul(e, r) {
return r.length ? r.reduce((t, n) => ({
type: "LogicalExpression",
operator: n[1],
left: t,
right: n[3]
}), e) : e;
}
function ud(e, r) {
return r.length ? r.reduce((t, n) => {
if (!n[5])
throw new Error("Method expected after .");
return {
type: "MethodExpression",
object: t,
method: n[3],
arguments: n[5][2]
};
}, e) : e;
}
function fd(e) {
return e === "true" || e === "false" ? { type: "BooleanLiteral", value: e === "true" } : { type: "Variable", id: { type: "Identifier", name: e } };
}
function Gl(e) {
if (e.every((t) => typeof t == "string"))
return { type: "StringLiteral", value: e.join("") };
let r = e.reduce((t, n) => (typeof n == "string" && typeof t[t.length - 1] == "string" ? t[t.length - 1] += n : t.push(n), t), []).reduce((t, n) => (typeof n == "string" ? t.quasis.push({ type: "StringLiteral", value: n }) : (t.quasis.length === t.expressions.length && t.quasis.push({ type: "StringLiteral", value: "" }), t.expressions.push(n)), t), {
type: "TemplateLiteral",
quasis: [],
expressions: []
});
return r.quasis.length === r.expressions.length && r.quasis.push({ type: "StringLiteral", value: "" }), r;
}
function dd(e) {
try {
return _n(e);
} catch {
throw new Error(`Value ${e} can't be converted to Integer type.`);
}
}
function Yl(e) {
if (e === "'" || e === "\\")
return e;
throw new Error("Incorrect string escape");
}
function _d(e, r) {
function t() {
this.constructor = e;
}
t.prototype = r.prototype, e.prototype = new t();
}
function so(e, r, t, n) {
var i = Error.call(this, e);
return Object.setPrototypeOf && Object.setPrototypeOf(i, so.prototype), i.expected = r, i.found = t, i.location = n, i.name = "SyntaxError", i;
}
_d(so, Error);
function Os(e, r, t) {
return t = t || " ", e.length > r ? e : (r -= e.length, t += t.repeat(r), e + t.slice(0, r));
}
so.prototype.format = function(e) {
var r = "Error: " + this.message;
if (this.location) {
var t = null, n;
for (n = 0; n < e.length; n++)
if (e[n].source === this.location.source) {
t = e[n].text.split(/\r\n|\n|\r/g);
break;
}
var i = this.location.start, o = this.location.source && typeof this.location.source.offset == "function" ? this.location.source.offset(i) : i, s = this.location.source + ":" + o.line + ":" + o.column;
if (t) {
var a = this.location.end, l = Os("", o.line.toString().length, " "), c = t[i.line - 1], u = i.line === a.line ? a.column : c.length + 1, d = u - i.column || 1;
r += `
--> ` + s + `
` + l + ` |
` + o.line + " | " + c + `
` + l + " | " + Os("", i.column - 1, " ") + Os("", d, "^");
} else
r += `
at ` + s;
}
return r;
};
so.buildMessage = function(e, r) {
var t = {
literal: function(c) {
return '"' + i(c.text) + '"';
},
class: function(c) {
var u = c.parts.map(function(d) {
return Array.isArray(d) ? o(d[0]) + "-" + o(d[1]) : o(d);
});
return "[" + (c.inverted ? "^" : "") + u.join("") + "]";
},
any: function() {
return "any character";
},
end: function() {
return "end of input";
},
other: function(c) {
return c.description;
}
};
function n(c) {
return c.charCodeAt(0).toString(16).toUpperCase();
}
function i(c) {
return c.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(u) {
return "\\x0" + n(u);
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function(u) {
return "\\x" + n(u);
});
}
function o(c) {
return c.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(u) {
return "\\x0" + n(u);
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function(u) {
return "\\x" + n(u);
});
}
function s(c) {
return t[c.type](c);
}
function a(c) {
var u = c.map(s), d, _;
if (u.sort(), u.length > 0) {
for (d = 1, _ = 1; d < u.length; d++)
u[d - 1] !== u[d] && (u[_] = u[d], _++);
u.length = _;
}
switch (u.length) {
case 1:
return u[0];
case 2:
return u[0] + " or " + u[1];
default:
return u.slice(0, -1).join(", ") + ", or " + u[u.length - 1];
}
}
function l(c) {
return c ? '"' + i(c) + '"' : "end of input";
}
return "Expected " + a(e) + " but " + l(r) + " found.";
};
function ys(e, r) {
r = r !== void 0 ? r : {};
var t = {}, n = r.grammarSource, i = { start: v, JsonStringContents: A }, o = v, s = "@{", a = "}", l = "@{}", c = "\\", u = "?", d = ":", _ = "!:", m = "||", b = "&&", h = "==", w = "!=", k = ">=", ee = ">", Z = "<=", R = "<", he = "+", ce = "-", Y = "/", ne = "*", J = "%", T = "!", z = ".", O = "(", L = ")", Ae = ",", nt = "'", ue = "e", Re = "E", Ce = /^[^}]/, Ke = /^[^'}]/, qe = /^[0-9]/, Ct = /^[a-zA-Z_]/, ye = /^[a-zA-Z_0-9]/, Ne = /^[ \t\r\n]/, te = bt("@{", !1), Be = bt("}", !1), ve = bt("@{}", !1), je = bt("\\", !1), Me = mr(), be = Bt(["}"], !0, !1), Ft = bt("?", !1), se = bt(":", !1), dt = bt("!:", !1), Ve = bt("||", !1), K = bt("&&", !1), ot = bt("==", !1), pe = bt("!=", !1), ct = bt(">=", !1), et = bt(">", !1), st = bt("<=", !1), Xe = bt("<", !1), Vt = bt("+", !1), ut = bt("-", !1), jt = bt("/", !1), ie = bt("*", !1), De = bt("%", !1), _e = bt("!", !1), We = bt(".", !1), Ie = bt("(", !1), wt = bt(")", !1), St = bt(",", !1), at = Pr("string"), Ot = bt("'", !1), Le = Bt(["'", "}"], !0, !1), G = Pr("integer"), it = Bt([["0", "9"]], !1, !1), Ht = Pr("number"), Jt = bt("e", !1), P = bt("E", !1), ft = Bt([["a", "z"], ["A", "Z"], "_"], !1, !1), Se = Bt([["a", "z"], ["A", "Z"], "_", ["0", "9"]], !1, !1), de = Pr("whitespace"), Pt = Bt([" ", " ", "\r", `
`], !1, !1), Te = function(g) {
return g;
}, rr = function(g) {
return Gl(g);
}, Tt = function(g) {
return g;
}, _r = function() {
return "";
}, re = function() {
return Et();
}, Je = function() {
throw new Error("Error tokenizing '" + e + "'.");
}, tr = function() {
throw new Error("Error tokenizing '" + e + "'.");
}, _t = function(g) {
return g;
}, It = function(g) {
return Yl(g);
}, tt = function() {
throw new Error("Error tokenizing '" + e + "'.");
}, gt = function(g, C) {
return ad(g, C);
}, Rt = function(g, C) {
return cd(g, C);
}, lr = function(g, C) {
return Ul(g, C);
}, Wt = function(g, C) {
return Ul(g, C);
}, fr = function(g, C) {
return Do(g, C);
}, Xt = function(g, C) {
return Do(g, C);
}, $t = function(g, C) {
return Do(g, C);
}, nr = function(g, C) {
return Do(g, C);
}, Ut = function(g) {
return g;
}, dr = function(g) {
return g;
}, xt = function(g, C) {
return { type: "UnaryExpression", operator: g, argument: C };
}, vr = function() {
throw new Error("Incorrect unary operator");
}, yr = function(g, C) {
return ud(g, C);
}, Ge = function(g, C) {
return { type: "CallExpression", callee: g, arguments: C };
}, hr = function(g, C) {
return [g, ...C];
}, Lr = function(g) {
return g;
}, Ir = function(g) {
return g;
}, Zt = function(g) {
return Gl(g);
}, kr = function(g) {
return g;
}, an = function() {
return "";
}, Pe = function() {
return Et();
}, ke = function() {
throw new Error("Error tokenizing '" + e + "'.");
}, vt = function() {
throw new Error("Error tokenizing '" + e + "'.");
}, zt = function(g) {
return g;
}, gr = function(g) {
return Yl(g);
}, Mr = function() {
throw new Error("Error tokenizing '" + e + "'.");
}, D = function() {
return { type: "IntegerLiteral", value: dd(Et()) };
}, j = function() {
return { type: "NumberLiteral", value: parseFloat(Et()) };
}, F = function() {
return { type: "NumberLiteral", value: parseFloat(Et()) };
}, H = function() {
const g = Et();
if (/\.\./.test(g) || /\.$/.test(g))
throw new Error("Unexpected token: .");
return fd(g);
}, Ue = function() {
return { type: "Identifier", name: Et() };
}, f = 0, we = 0, rt = [{ line: 1, column: 1 }], Qe = 0, Gt = [], E = 0, kt;
if ("startRule" in r) {
if (!(r.startRule in i))
throw new Error(`Can't start parsing from rule "` + r.startRule + '".');
o = i[r.startRule];
}
function Et() {
return e.substring(we, f);
}
function bt(g, C) {
return { type: "literal", text: g, ignoreCase: C };
}
function Bt(g, C, B) {
return { type: "class", parts: g, inverted: C, ignoreCase: B };
}
function mr() {
return { type: "any" };
}
function Rr() {
return { type: "end" };
}
function Pr(g) {
return { type: "other", description: g };
}
function Zr(g) {
var C = rt[g], B;
if (C)
return C;
for (B = g - 1; !rt[B]; )
B--;
for (C = rt[B], C = {
line: C.line,
column: C.column
}; B < g; )
e.charCodeAt(B) === 10 ? (C.line++, C.column = 1) : C.column++, B++;
return rt[g] = C, C;
}
function wn(g, C, B) {
var S = Zr(g), le = Zr(C), oe = {
source: n,
start: {
offset: g,
line: S.line,
column: S.column
},
end: {
offset: C,
line: le.line,
column: le.column
}
};
return oe;
}
function fe(g) {
f < Qe || (f > Qe && (Qe = f, Gt = []), Gt.push(g));
}
function y(g, C, B) {
return new so(
so.buildMessage(g, C),
g,
C,
B
);
}
function v() {
var g, C;
return g = f, At(), C = I(), C !== t ? (At(), we = g, g = Te(C)) : (f = g, g = t), g;
}
function A() {
var g, C, B;
for (g = f, C = [], B = q(); B !== t; )
C.push(B), B = q();
return we = g, C = rr(C), g = C, g;
}
function q() {
var g, C, B, S, le;
if (g = f, e.substr(f, 2) === s ? (C = s, f += 2) : (C = t, E === 0 && fe(te)), C !== t ? (B = At(), S = I(), S !== t ? (At(), e.charCodeAt(f) === 125 ? (le = a, f++) : (le = t, E === 0 && fe(Be)), le !== t ? (we = g, g = Tt(S)) : (f = g, g = t)) : (f = g, g = t)) : (f = g, g = t), g === t && (g = f, e.substr(f, 3) === l ? (C = l, f += 3) : (C = t, E === 0 && fe(ve)), C !== t && (we = g, C = _r()), g = C, g === t && (g = f, C = f, E++, e.charCodeAt(f) === 92 ? (B = c, f++) : (B = t, E === 0 && fe(je)), B === t && (e.substr(f, 2) === s ? (B = s, f += 2) : (B = t, E === 0 && fe(te))), E--, B === t ? C = void 0 : (f = C, C = t), C !== t ? (e.length > f ? (B = e.charAt(f), f++) : (B = t, E === 0 && fe(Me)), B !== t ? (we = g, g = re()) : (f = g, g = t)) : (f = g, g = t), g === t))) {
if (g = f, e.substr(f, 2) === s ? (C = s, f += 2) : (C = t, E === 0 && fe(te)), C !== t) {
if (B = [], Ce.test(e.charAt(f)) ? (S = e.charAt(f), f++) : (S = t, E === 0 && fe(be)), S !== t)
for (; S !== t; )
B.push(S), Ce.test(e.charAt(f)) ? (S = e.charAt(f), f++) : (S = t, E === 0 && fe(be));
else
B = t;
B !== t ? (e.charCodeAt(f) === 125 ? (S = a, f++) : (S = t, E === 0 && fe(Be)), S !== t ? (we = g, g = Je()) : (f = g, g = t)) : (f = g, g = t);
} else
f = g, g = t;
g === t && (g = f, e.substr(f, 2) === s ? (C = s, f += 2) : (C = t, E === 0 && fe(te)), C !== t && (we = g, C = tr()), g = C, g === t && (g = f, e.charCodeAt(f) === 92 ? (C = c, f++) : (C = t, E === 0 && fe(je)), C !== t ? (e.substr(f, 2) === s ? (B = s, f += 2) : (B = t, E === 0 && fe(te)), B !== t ? (we = g, g = _t(B)) : (f = g, g = t)) : (f = g, g = t), g === t && (g = f, e.charCodeAt(f) === 92 ? (C = c, f++) : (C = t, E === 0 && fe(je)), C !== t ? (e.length > f ? (B = e.charAt(f), f++) : (B = t, E === 0 && fe(Me)), B !== t ? (we = g, g = It(B)) : (f = g, g = t)) : (f = g, g = t), g === t && (g = f, e.charCodeAt(f) === 92 ? (C = c, f++) : (C = t, E === 0 && fe(je)), C !== t && (we = g, C = tt()), g = C))));
}
return g;
}
function I() {
var g, C, B, S, le, oe, mt, ht, Br, Cr, Hr;
return g = f, C = Ye(), C !== t ? (B = f, S = At(), e.charCodeAt(f) === 63 ? (le = u, f++) : (le = t, E === 0 && fe(Ft)), le !== t ? (oe = At(), mt = I(), mt !== t ? (ht = At(), e.charCodeAt(f) === 58 ? (Br = d, f++) : (Br = t, E === 0 && fe(se)), Br !== t ? (Cr = At(), Hr = I(), Hr !== t ? (S = [S, le, oe, mt, ht, Br, Cr, Hr], B = S) : (f = B, B = t)) : (f = B, B = t)) : (f = B, B = t)) : (f = B, B = t), B === t && (B = null), we = g, g = gt(C, B)) : (f = g, g = t), g;
}
function Ye() {
var g, C, B, S, le, oe, mt;
return g = f, C = ge(), C !== t ? (B = f, S = At(), e.substr(f, 2) === _ ? (le = _, f += 2) : (le = t, E === 0 && fe(dt)), le !== t ? (oe = At(), mt = I(), mt !== t ? (S = [S, le, oe, mt], B = S) : (f = B, B = t)) : (f = B, B = t), B === t && (B = null), we = g, g = Rt(C, B)) : (f = g, g = t), g;
}
function ge() {
var g, C, B, S, le, oe, mt, ht;
if (g = f, C = xe(), C !== t) {
for (B = [], S = f, le = At(), e.substr(f, 2) === m ? (oe = m, f += 2) : (oe = t, E === 0 && fe(Ve)), oe !== t ? (mt = At(), ht = xe(), ht !== t ? (le = [le, oe, mt, ht], S = le) : (f = S, S = t)) : (f = S, S = t); S !== t; )
B.push(S), S = f, le = At(), e.substr(f, 2) === m ? (oe = m, f += 2) : (oe = t, E === 0 && fe(Ve)), oe !== t ? (mt = At(), ht = xe(), ht !== t ? (le = [le, oe, mt, ht], S = le) : (f = S, S = t)) : (f = S, S = t);
we = g, g = lr(C, B);
} else
f = g, g = t;
return g;
}
function xe() {
var g, C, B, S, le, oe, mt, ht;
if (g = f, C = pt(), C !== t) {
for (B = [], S = f, le = At(), e.substr(f, 2) === b ? (oe = b, f += 2) : (oe = t, E === 0 && fe(K)), oe !== t ? (mt = At(), ht = pt(), ht !== t ? (le = [le, oe, mt, ht], S = le) : (f = S, S = t)) : (f = S, S = t); S !== t; )
B.push(S), S = f, le = At(), e.substr(f, 2) === b ? (oe = b, f += 2) : (oe = t, E === 0 && fe(K)), oe !== t ? (mt = At(), ht = pt(), ht !== t ? (le = [le, oe, mt, ht], S = le) : (f = S, S = t)) : (f = S, S = t);
we = g, g = Wt(C, B);
} else
f = g, g = t;
return g;
}
function pt() {
var g, C, B, S, le, oe, mt, ht;
if (g = f, C = Ee(), C !== t) {
for (B = [], S = f, le = At(), e.substr(f, 2) === h ? (oe = h, f += 2) : (oe = t, E === 0 && fe(ot)), oe === t && (e.substr(f, 2) === w ? (oe = w, f += 2) : (oe = t, E === 0 && fe(pe))), oe !== t ? (mt = At(), ht = Ee(), ht !== t ? (le = [le, oe, mt, ht], S = le) : (f = S, S = t)) : (f = S, S = t); S !== t; )
B.push(S), S = f, le = At(), e.substr(f, 2) === h ? (oe = h, f += 2) : (oe = t, E === 0 && fe(ot)), oe === t && (e.substr(f, 2) === w ? (oe = w, f += 2) : (oe = t, E === 0 && fe(pe))), oe !== t ? (mt = At(), ht = Ee(), ht !== t ? (le = [le, oe, mt, ht], S = le) : (f = S, S = t)) : (f = S, S = t);
we = g, g = fr(C, B);
} else
f = g, g = t;
return g;
}
function Ee() {
var g, C, B, S, le, oe, mt, ht;
if (g = f, C = Lt(), C !== t) {
for (B = [], S = f, le = At(), e.substr(f, 2) === k ? (oe = k, f += 2) : (oe = t, E === 0 && fe(ct)), oe === t && (e.charCodeAt(f) === 62 ? (oe = ee, f++) : (oe = t, E === 0 && fe(et)), oe === t && (e.substr(f, 2) === Z ? (oe = Z, f += 2) : (oe = t, E === 0 && fe(st)), oe === t && (e.charCodeAt(f) === 60 ? (oe = R, f++) : (oe = t, E === 0 && fe(Xe))))), oe !== t ? (mt = At(), ht = Lt(), ht !== t ? (le = [le, oe, mt, ht], S = le) : (f = S, S = t)) : (f = S, S = t); S !== t; )
B.push(S), S = f, le = At(), e.substr(f, 2) === k ? (oe = k, f += 2) : (oe = t, E === 0 && fe(ct)), oe === t && (e.charCodeAt(f) === 62 ? (oe = ee, f++) : (oe = t, E === 0 && fe(et)), oe === t && (e.substr(f, 2) === Z ? (oe = Z, f += 2) : (oe = t, E === 0 && fe(st)), oe === t && (e.charCodeAt(f) === 60 ? (oe = R, f++) : (oe = t, E === 0 && fe(Xe))))), oe !== t ? (mt = At(), ht = Lt(), ht !== t ? (le = [le, oe, mt, ht], S = le) : (f = S, S = t)) : (f = S, S = t);
we = g, g = Xt(C, B);
} else
f = g, g = t;
return g;
}
function Lt() {
var g, C, B, S, le, oe, mt, ht;
if (g = f, C = $e(), C !== t) {
for (B = [], S = f, le = At(), e.charCodeAt(f) === 43 ? (oe = he, f++) : (oe = t, E === 0 && fe(Vt)), oe === t && (e.charCodeAt(f) === 45 ? (oe = ce, f++) : (oe = t, E === 0 && fe(ut))), oe !== t ? (mt = At(), ht = $e(), ht !== t ? (le = [le, oe, mt, ht], S = le) : (f = S, S = t)) : (f = S, S = t); S !== t; )
B.push(S), S = f, le = At(), e.charCodeAt(f) === 43 ? (oe = he, f++) : (oe = t, E === 0 && fe(Vt)), oe === t && (e.charCodeAt(f) === 45 ? (oe = ce, f++) : (oe = t, E === 0 && fe(ut))), oe !== t ? (mt = At(), ht = $e(), ht !== t ? (le = [le, oe, mt, ht], S = le) : (f = S, S = t)) : (f = S, S = t);
we = g, g = $t(C, B);
} else
f = g, g = t;
return g;
}
function $e() {
var g, C, B, S, le, oe, mt, ht;
if (g = f, C = Qt(), C !== t) {
for (B = [], S = f, le = At(), e.charCodeAt(f) === 47 ? (oe = Y, f++) : (oe = t, E === 0 && fe(jt)), oe === t && (e.charCodeAt(f) === 42 ? (oe = ne, f++) : (oe = t, E === 0 && fe(ie)), oe === t && (e.charCodeAt(f) === 37 ? (oe = J, f++) : (oe = t, E === 0 && fe(De)))), oe !== t ? (mt = At(), ht = Qt(), ht !== t ? (le = [le, oe, mt, ht], S = le) : (f = S, S = t)) : (f = S, S = t); S !== t; )
B.push(S), S = f, le = At(), e.charCodeAt(f) === 47 ? (oe = Y, f++) : (oe = t, E === 0 && fe(jt)), oe === t && (e.charCodeAt(f) === 42 ? (oe = ne, f++) : (oe = t, E === 0 && fe(ie)), oe === t && (e.charCodeAt(f) === 37 ? (oe = J, f++) : (oe = t, E === 0 && fe(De)))), oe !== t ? (mt = At(), ht = Qt(), ht !== t ? (le = [le, oe, mt, ht], S = le) : (f = S, S = t)) : (f = S, S = t);
we = g, g = nr(C, B);
} else
f = g, g = t;
return g;
}
function Qt() {
var g, C, B, S;
return g = f, C = f, E++, e.charCodeAt(f) === 45 ? (B = ce, f++) : (B = t, E === 0 && fe(ut)), E--, B !== t ? (f = C, C = void 0) : C = t, C !== t ? (B = ri(), B !== t ? (we = g, g = Ut(B)) : (f = g, g = t)) : (f = g, g = t), g === t && (g = f, C = f, E++, e.charCodeAt(f) === 45 ? (B = ce, f++) : (B = t, E === 0 && fe(ut)), E--, B !== t ? (f = C, C = void 0) : C = t, C !== t ? (B = Pn(), B !== t ? (we = g, g = dr(B)) : (f = g, g = t)) : (f = g, g = t), g === t && (g = f, e.charCodeAt(f) === 33 ? (C = T, f++) : (C = t, E === 0 && fe(_e)), C === t && (e.charCodeAt(f) === 43 ? (C = he, f++) : (C = t, E === 0 && fe(Vt)), C === t && (e.charCodeAt(f) === 45 ? (C = ce, f++) : (C = t, E === 0 && fe(ut)))), C !== t ? (B = At(), S = Nr(), S === t && (S = on()), S !== t ? (we = g, g = xt(C, S)) : (f = g, g = t)) : (f = g, g = t), g === t && (g = on()))), g;
}
function Nr() {
var g, C;
return g = f, e.charCodeAt(f) === 43 ? (C = he, f++) : (C = t, E === 0 && fe(Vt)), C === t && (e.charCodeAt(f) === 45 ? (C = ce, f++) : (C = t, E === 0 && fe(ut))), C !== t && (we = g, C = vr()), g = C, g;
}
function on() {
var g, C, B, S, le, oe, mt, ht, Br, Cr, Hr, Si, ii, V, lt;
if (g = f, C = Ar(), C !== t) {
for (B = [], S = f, le = At(), e.charCodeAt(f) === 46 ? (oe = z, f++) : (oe = t, E === 0 && fe(We)), oe !== t ? (mt = At(), ht = sn(), ht !== t ? (Br = At(), Cr = f, e.charCodeAt(f) === 40 ? (Hr = O, f++) : (Hr = t, E === 0 && fe(Ie)), Hr !== t ? (Si = At(), ii = Qr(), ii !== t ? (V = At(), e.charCodeAt(f) === 41 ? (lt = L, f++) : (lt = t, E === 0 && fe(wt)), lt !== t ? (Hr = [Hr, Si, ii, V, lt], Cr = Hr) : (f = Cr, Cr = t)) : (f = Cr, Cr = t)) : (f = Cr, Cr = t), Cr === t && (Cr = null), le = [le, oe, mt, ht, Br, Cr], S = le) : (f = S, S = t)) : (f = S, S = t); S !== t; )
B.push(S), S = f, le = At(), e.charCodeAt(f) === 46 ? (oe = z, f++) : (oe = t, E === 0 && fe(We)), oe !== t ? (mt = At(), ht = sn(), ht !== t ? (Br = At(), Cr = f, e.charCodeAt(f) === 40 ? (Hr = O, f++) : (Hr = t, E === 0 && fe(Ie)), Hr !== t ? (Si = At(), ii = Qr(), ii !== t ? (V = At(), e.charCodeAt(f) === 41 ? (lt = L, f++) : (lt = t, E === 0 && fe(wt)), lt !== t ? (Hr = [Hr, Si, ii, V, lt], Cr = Hr) : (f = Cr, Cr = t)) : (f = Cr, Cr = t)) : (f = Cr, Cr = t), Cr === t && (Cr = null), le = [le, oe, mt, ht, Br, Cr], S = le) : (f = S, S = t)) : (f = S, S = t);
we = g, g = yr(C, B);
} else
f = g, g = t;
return g;
}
function Ar() {
var g, C, B, S, le;
return g = f, C = sn(), C !== t ? (At(), e.charCodeAt(f) === 40 ? (B = O, f++) : (B = t, E === 0 && fe(Ie)), B !== t ? (At(), S = Qr(), S !== t ? (At(), e.charCodeAt(f) === 41 ? (le = L, f++) : (le = t, E === 0 && fe(wt)), le !== t ? (we = g, g = Ge(C, S)) : (f = g, g = t)) : (f = g, g = t)) : (f = g, g = t)) : (f = g, g = t), g === t && (g = xr()), g;
}
function Qr() {
var g, C, B, S, le, oe;
if (g = f, C = I(), C !== t) {
for (B = [], S = f, At(), e.charCodeAt(f) === 44 ? (le = Ae, f++) : (le = t, E === 0 && fe(St)), le !== t ? (At(), oe = I(), oe !== t ? S = oe : (f = S, S = t)) : (f = S, S = t); S !== t; )
B.push(S), S = f, At(), e.charCodeAt(f) === 44 ? (le = Ae, f++) : (le = t, E === 0 && fe(St)), le !== t ? (At(), oe = I(), oe !== t ? S = oe : (f = S, S = t)) : (f = S, S = t);
we = g, g = hr(C, B);
} else
f = g, g = t;
return g === t && (g = At()), g;
}
function xr() {
var g, C, B, S;
return g = ni(), g === t && (g = kn(), g === t && (g = ri(), g === t && (g = Pn(), g === t && (g = f, e.charCodeAt(f) === 40 ? (C = O, f++) : (C = t, E === 0 && fe(Ie)), C !== t ? (At(), B = I(), B !== t ? (At(), e.charCodeAt(f) === 41 ? (S = L, f++) : (S = t, E === 0 && fe(wt)), S !== t ? (we = g, g = Lr(B)) : (f = g, g = t)) : (f = g, g = t)) : (f = g, g = t))))), g;
}
function kn() {
var g, C, B, S;
return E++, g = f, e.charCodeAt(f) === 39 ? (C = nt, f++) : (C = t, E === 0 && fe(Ot)), C !== t ? (B = Bn(), e.charCodeAt(f) === 39 ? (S = nt, f++) : (S = t, E === 0 && fe(Ot)), S !== t ? (we = g, g = Ir(B)) : (f = g, g = t)) : (f = g, g = t), E--, g === t && (C = t, E === 0 && fe(at)), g;
}
function Bn() {
var g, C, B;
for (g = f, C = [], B = Tn(); B !== t; )
C.push(B), B = Tn();
return we = g, C = Zt(C), g = C, g;
}
function Tn() {
var g, C, B, S, le;
if (g = f, e.substr(f, 2) === s ? (C = s, f += 2) : (C = t, E === 0 && fe(te)), C !== t ? (B = At(), S = I(), S !== t ? (At(), e.charCodeAt(f) === 125 ? (le = a, f++) : (le = t, E === 0 && fe(Be)), le !== t ? (we = g, g = kr(S)) : (f = g, g = t)) : (f = g, g = t)) : (f = g, g = t), g === t && (g = f, e.substr(f, 3) === l ? (C = l, f += 3) : (C = t, E === 0 && fe(ve)), C !== t && (we = g, C = an()), g = C, g === t && (g = f, C = f, E++, e.charCodeAt(f) === 92 ? (B = c, f++) : (B = t, E === 0 && fe(je)), B === t && (e.charCodeAt(f) === 39 ? (B = nt, f++) : (B = t, E === 0 && fe(Ot)), B === t && (e.substr(f, 2) === s ? (B = s, f += 2) : (B = t, E === 0 && fe(te)))), E--, B === t ? C = void 0 : (f = C, C = t), C !== t ? (e.length > f ? (B = e.charAt(f), f++) : (B = t, E === 0 && fe(Me)), B !== t ? (we = g, g = Pe()) : (f = g, g = t)) : (f = g, g = t), g === t))) {
if (g = f, e.substr(f, 2) === s ? (C = s, f += 2) : (C = t, E === 0 && fe(te)), C !== t) {
if (B = [], Ke.test(e.charAt(f)) ? (S = e.charAt(f), f++) : (S = t, E === 0 && fe(Le)), S !== t)
for (; S !== t; )
B.push(S), Ke.test(e.charAt(f)) ? (S = e.charAt(f), f++) : (S = t, E === 0 && fe(Le));
else
B = t;
B !== t ? (e.charCodeAt(f) === 125 ? (S = a, f++) : (S = t, E === 0 && fe(Be)), S !== t ? (we = g, g = ke()) : (f = g, g = t)) : (f = g, g = t);
} else
f = g, g = t;
g === t && (g = f, e.substr(f, 2) === s ? (C = s, f += 2) : (C = t, E === 0 && fe(te)), C !== t && (we = g, C = vt()), g = C, g === t && (g = f, e.charCodeAt(f) === 92 ? (C = c, f++) : (C = t, E === 0 && fe(je)), C !== t ? (e.substr(f, 2) === s ? (B = s, f += 2) : (B = t, E === 0 && fe(te)), B !== t ? (we = g, g = zt(B)) : (f = g, g = t)) : (f = g, g = t), g === t && (g = f, e.charCodeAt(f) === 92 ? (C = c, f++) : (C = t, E === 0 && fe(je)), C !== t ? (e.length > f ? (B = e.charAt(f), f++) : (B = t, E === 0 && fe(Me)), B !== t ? (we = g, g = gr(B)) : (f = g, g = t)) : (f = g, g = t), g === t && (g = f, e.charCodeAt(f) === 92 ? (C = c, f++) : (C = t, E === 0 && fe(je)), C !== t && (we = g, C = Mr()), g = C))));
}
return g;
}
function Pn() {
var g, C, B;
if (E++, g = f, e.charCodeAt(f) === 45 ? f++ : E === 0 && fe(ut), C = [], qe.test(e.charAt(f)) ? (B = e.charAt(f), f++) : (B = t, E === 0 && fe(it)), B !== t)
for (; B !== t; )
C.push(B), qe.test(e.charAt(f)) ? (B = e.charAt(f), f++) : (B = t, E === 0 && fe(it));
else
C = t;
return C !== t ? (we = g, g = D()) : (f = g, g = t), E--, g === t && E === 0 && fe(G), g;
}
function ri() {
var g, C, B, S, le, oe, mt, ht, Br;
for (E++, g = f, e.charCodeAt(f) === 45 ? f++ : E === 0 && fe(ut), C = [], qe.test(e.charAt(f)) ? (B = e.charAt(f), f++) : (B = t, E === 0 && fe(it)); B !== t; )
C.push(B), qe.test(e.charAt(f)) ? (B = e.charAt(f), f++) : (B = t, E === 0 && fe(it));
if (e.charCodeAt(f) === 46 ? (B = z, f++) : (B = t, E === 0 && fe(We)), B !== t) {
if (S = [], qe.test(e.charAt(f)) ? (le = e.charAt(f), f++) : (le = t, E === 0 && fe(it)), le !== t)
for (; le !== t; )
S.push(le), qe.test(e.charAt(f)) ? (le = e.charAt(f), f++) : (le = t, E === 0 && fe(it));
else
S = t;
if (S !== t) {
if (le = f, e.charCodeAt(f) === 101 ? (oe = ue, f++) : (oe = t, E === 0 && fe(Jt)), oe === t && (e.charCodeAt(f) === 69 ? (oe = Re, f++) : (oe = t, E === 0 && fe(P))), oe !== t) {
if (e.charCodeAt(f) === 43 ? (mt = he, f++) : (mt = t, E === 0 && fe(Vt)), mt === t && (e.charCodeAt(f) === 45 ? (mt = ce, f++) : (mt = t, E === 0 && fe(ut))), mt === t && (mt = null), ht = [], qe.test(e.charAt(f)) ? (Br = e.charAt(f), f++) : (Br = t, E === 0 && fe(it)), Br !== t)
for (; Br !== t; )
ht.push(Br), qe.test(e.charAt(f)) ? (Br = e.charAt(f), f++) : (Br = t, E === 0 && fe(it));
else
ht = t;
ht !== t ? (oe = [oe, mt, ht], le = oe) : (f = le, le = t);
} else
f = le, le = t;
le === t && (le = null), we = g, g = j();
} else
f = g, g = t;
} else
f = g, g = t;
if (g === t) {
if (g = f, e.charCodeAt(f) === 45 ? f++ : E === 0 && fe(ut), C = [], qe.test(e.charAt(f)) ? (B = e.charAt(f), f++) : (B = t, E === 0 && fe(it)), B !== t)
for (; B !== t; )
C.push(B), qe.test(e.charAt(f)) ? (B = e.charAt(f), f++) : (B = t, E === 0 && fe(it));
else
C = t;
if (C !== t)
if (e.charCodeAt(f) === 101 ? (B = ue, f++) : (B = t, E === 0 && fe(Jt)), B === t && (e.charCodeAt(f) === 69 ? (B = Re, f++) : (B = t, E === 0 && fe(P))), B !== t) {
if (e.charCodeAt(f) === 43 ? (S = he, f++) : (S = t, E === 0 && fe(Vt)), S === t && (e.charCodeAt(f) === 45 ? (S = ce, f++) : (S = t, E === 0 && fe(ut))), S === t && (S = null), le = [], qe.test(e.charAt(f)) ? (oe = e.charAt(f), f++) : (oe = t, E === 0 && fe(it)), oe !== t)
for (; oe !== t; )
le.push(oe), qe.test(e.charAt(f)) ? (oe = e.charAt(f), f++) : (oe = t, E === 0 && fe(it));
else
le = t;
le !== t ? (we = g, g = F()) : (f = g, g = t);
} else
f = g, g = t;
else
f = g, g = t;
}
return E--, g === t && E === 0 && fe(Ht), g;
}
function ni() {
var g, C, B, S, le, oe, mt, ht, Br, Cr, Hr;
if (g = f, Ct.test(e.charAt(f)) ? (C = e.charAt(f), f++) : (C = t, E === 0 && fe(ft)), C !== t) {
if (B = [], S = [], ye.test(e.charAt(f)) ? (le = e.charAt(f), f++) : (le = t, E === 0 && fe(Se)), le !== t)
for (; le !== t; )
S.push(le), ye.test(e.charAt(f)) ? (le = e.charAt(f), f++) : (le = t, E === 0 && fe(Se));
else
S = t;
for (S === t && (S = f, e.charCodeAt(f) === 46 ? (le = z, f++) : (le = t, E === 0 && fe(We)), le !== t ? (oe = f, E++, mt = f, ht = At(), Br = sn(), Br !== t ? (Cr = At(), e.charCodeAt(f) === 40 ? (Hr = O, f++) : (Hr = t, E === 0 && fe(Ie)), Hr !== t ? (ht = [ht, Br, Cr, Hr], mt = ht) : (f = mt, mt = t)) : (f = mt, mt = t), E--, mt === t ? oe = void 0 : (f = oe, oe = t), oe !== t ? (le = [le, oe], S = le) : (f = S, S = t)) : (f = S, S = t)); S !== t; ) {
if (B.push(S), S = [], ye.test(e.charAt(f)) ? (le = e.charAt(f), f++) : (le = t, E === 0 && fe(Se)), le !== t)
for (; le !== t; )
S.push(le), ye.test(e.charAt(f)) ? (le = e.charAt(f), f++) : (le = t, E === 0 && fe(Se));
else
S = t;
S === t && (S = f, e.charCodeAt(f) === 46 ? (le = z, f++) : (le = t, E === 0 && fe(We)), le !== t ? (oe = f, E++, mt = f, ht = At(), Br = sn(), Br !== t ? (Cr = At(), e.charCodeAt(f) === 40 ? (Hr = O, f++) : (Hr = t, E === 0 && fe(Ie)), Hr !== t ? (ht = [ht, Br, Cr, Hr], mt = ht) : (f = mt, mt = t)) : (f = mt, mt = t), E--, mt === t ? oe = void 0 : (f = oe, oe = t), oe !== t ? (le = [le, oe], S = le) : (f = S, S = t)) : (f = S, S = t));
}
we = g, g = H();
} else
f = g, g = t;
return g;
}
function sn() {
var g, C, B, S;
if (g = f, Ct.test(e.charAt(f)) ? (C = e.charAt(f), f++) : (C = t, E === 0 && fe(ft)), C !== t) {
for (B = [], ye.test(e.charAt(f)) ? (S = e.charAt(f), f++) : (S = t, E === 0 && fe(Se)); S !== t; )
B.push(S), ye.test(e.charAt(f)) ? (S = e.charAt(f), f++) : (S = t, E === 0 && fe(Se));
we = g, g = Ue();
} else
f = g, g = t;
return g;
}
function At() {
var g, C;
for (E++, g = [], Ne.test(e.charAt(f)) ? (C = e.charAt(f), f++) : (C = t, E === 0 && fe(Pt)); C !== t; )
g.push(C), Ne.test(e.charAt(f)) ? (C = e.charAt(f), f++) : (C = t, E === 0 && fe(Pt));
return E--, C = t, E === 0 && fe(de), g;
}
if (kt = o(), kt !== t && f === e.length)
return kt;
throw kt !== t && f < e.length && fe(Rr()), y(
Gt,
Qe < e.length ? e.charAt(Qe) : null,
Qe < e.length ? wn(Qe, Qe + 1) : wn(Qe, Qe)
);
}
const hd = 2147483647, gd = -2147483648, pd = Number.MAX_VALUE, md = Number.MIN_VALUE, Fe = "string", me = "integer", Ze = "number", Wr = "boolean", ln = "color", Wn = "url", Er = "datetime", ir = "dict", or = "array";
function Hn(e, r) {
var t;
switch ((t = r[e.type]) == null || t.call(r, e), e.type) {
case "TemplateLiteral":
e.expressions.forEach((n) => {
Hn(n, r);
});
break;
case "BinaryExpression":
case "LogicalExpression":
Hn(e.left, r), Hn(e.right, r);
break;
case "UnaryExpression":
Hn(e.argument, r);
break;
case "ConditionalExpression":
Hn(e.test, r), Hn(e.consequent, r), Hn(e.alternate, r);
break;
case "TryExpression":
Hn(e.test, r), Hn(e.alternate, r);
break;
case "CallExpression":
e.arguments.forEach((n) => {
Hn(n, r);
});
break;
case "MethodExpression":
Hn(e.object, r), e.arguments.forEach((n) => {
Hn(n, r);
});
break;
}
}
function ef(e, r) {
for (; e.length < r; )
e = "0" + e;
return e;
}
function Sr(e, r = 1, t = "transparent") {
if (e = (typeof e == "string" && e || "").toLowerCase(), e.charAt(0) !== "#")
return t;
const n = fi(e);
return n ? (n.a *= r, wl(n)) : t;
}
function bd(e, r, t = "transparent") {
if (e = (typeof e == "string" && e || "").toLowerCase(), e.charAt(0) !== "#")
return t;
const n = fi(e);
return n ? (n.a = r, wl(n)) : t;
}
function wl(e) {
return e.a === 255 ? `#${[e.r, e.g, e.b].map((r) => ef(Math.round(r).toString(16), 2)).join("")}` : `rgba(${e.r},${e.g},${e.b},${(e.a / 255).toFixed(2)})`;
}
function fi(e) {
const r = (
// #AARRGGBB
e.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i) || // #ARGB
e.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])$/i) || // #RRGGBB
e.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i) || // #RGB
e.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i)
);
if (r) {
if (r.length === 5) {
const [c, u, d, _, m] = r, b = d.length === 2 ? d : d + d, h = _.length === 2 ? _ : _ + _, w = m.length === 2 ? m : m + m, k = u.length === 2 ? u : u + u;
return {
a: parseInt(k, 16),
r: parseInt(b, 16),
g: parseInt(h, 16),
b: parseInt(w, 16)
};
}
const [t, n, i, o] = r, s = n.length === 2 ? n : n + n, a = i.length === 2 ? i : i + i, l = o.length === 2 ? o : o + o;
return {
a: 255,
r: parseInt(s, 16),
g: parseInt(a, 16),
b: parseInt(l, 16)
};
}
return null;
}
function ss(e) {
return e.type === "url" || e.type === "color" ? {
type: "string",
value: e.value
} : e;
}
function tf(e) {
return e.toISOString().replace("T", " ").replace(/\.\d{3}Z$/, "");
}
function Ji(e, r) {
if (e.type === "string")
return e.value;
if (e.type === "integer")
return String(e.value);
if (e.type === "number") {
let t = String(e.value);
return t.includes(".") || (t.includes("e") ? t = t.replace("e", ".0e") : t += ".0"), t = t.replace(/e\+?/i, "E"), t;
} else {
if (e.type === "boolean")
return e.value ? "true" : "false";
if (e.type === "datetime")
return tf(e.value);
if (e.type === "color")
return Xi(ws(e.value));
if (e.type === "url")
return e.value;
if ((e.type === "dict" || e.type === "array") && r)
return JSON.stringify(e.value);
if (e.type === "dict")
return "<dict>";
if (e.type === "array")
return "<array>";
}
throw new Error(`Unexpected type ${e.type}`);
}
function tn(e) {
let r = Ji(e, !1);
return e.type === "string" && (r = "'" + r.replace(/\\/g, "\\\\").replace(/'/g, "\\'") + "'"), r;
}
function Ln(e) {
return e === "datetime" ? "DateTime" : e.charAt(0).toUpperCase() + e.substring(1);
}
function Ki(e, r) {
return _n(r);
}
function In(e, r) {
if (r < Ao || r > Eo)
throw new Error("Integer overflow.");
}
function di(e) {
if (typeof e != "string")
throw new Error("Incorrect url value.");
try {
new URL(e);
} catch {
throw new Error("Incorrect url value.");
}
}
function yd(e) {
const r = /* @__PURE__ */ new Set();
return Hn(e, {
Variable(t) {
r.add(t.id.name);
}
}), [...r];
}
function rn(e, r) {
throw new Error(`Failed to evaluate [${e}]. ${r}`);
}
function ws(e) {
const r = fi(e);
if (r)
return r;
throw new Error("Unable to convert value to Color, expected format #AARRGGBB.");
}
function Xi(e) {
return `#${[e.a, e.r, e.g, e.b].map((r) => {
if (r < 0 || r > 255)
throw new Error("Value out of range 0..1.");
return ef(Math.round(r).toString(16), 2);
}).join("").toUpperCase()}`;
}
function co(e) {
return Xi(ws(e));
}
function Zs(e) {
return {
type: Ze,
value: Number(e.value)
};
}
const wd = {
string: "string",
number: "number",
integer: "number",
boolean: "boolean",
color: "string",
url: "string",
array: "array",
dict: "object"
};
function rf(e, r, t) {
const n = wd[t];
let i = typeof r;
if (n === "array" && !Array.isArray(r) || n !== "array" && i !== n || i === "object" && r === null)
throw i === "object" && (Array.isArray(r) ? i = "array" : r === null ? i = "null" : i = "dict"), new Error(`Incorrect value type: expected ${Ln(t)}, got ${Ln(i)}.`);
if (n === "number" && t === "integer") {
In(e, r);
try {
r = _n(r);
} catch {
throw new Error("Cannot convert value to integer.");
}
}
return n === "string" && t === "color" && (r = co(r)), n === "string" && t === "url" && di(r), {
type: t,
value: r
};
}
const vo = /* @__PURE__ */ new Map(), Qs = /* @__PURE__ */ new Map(), Ho = /* @__PURE__ */ new Map(), xs = /* @__PURE__ */ new Map();
function N(e, r, t) {
const n = {
args: r,
cb: t
}, i = vo.get(e) || [];
vo.has(e) || vo.set(e, i), i.push(n);
const o = e + ":" + r.map((s) => typeof s == "object" ? s.type : s).join("#");
Qs.set(o, n);
}
function Xr(e, r, t) {
const n = {
args: r,
cb: t
}, i = Ho.get(e) || [];
Ho.has(e) || Ho.set(e, i), i.push(n);
const o = e + ":" + r.map((s) => typeof s == "object" ? s.type : s).join("#");
xs.set(o, n);
}
function vd(e, r, t) {
const n = e.args.length;
let i = e.args.length, o = 0;
const s = e.args[e.args.length - 1];
if (typeof s == "object" && s.isVararg && (i = 1 / 0), r.length < n)
return {
type: "few",
expected: n,
found: r.length,
def: e,
hasOverloads: t
};
if (r.length > i)
return {
type: "many",
expected: i,
found: r.length,
def: e,
hasOverloads: t
};
for (let a = 0; a < r.length; ++a) {
let l = a >= e.args.length ? e.args[e.args.length - 1] : e.args[a];
if (typeof l != "object" && (l = {
type: l
}), l.type === Ze && r[a].type === me) {
++o;
continue;
}
if (l.type !== r[a].type)
return {
type: "mismatch",
expected: l.type,
found: r[a].type,
def: e,
hasOverloads: t
};
}
return {
type: "match",
conversions: o
};
}
function $s(e, r, t) {
const n = e.get(r);
if (!n)
return {
type: "missing"
};
let i = null, o = null;
for (let s = 0; s < n.length; ++s) {
const a = vd(n[s], t, n.length > 1);
if (a.type === "match") {
(!o || o.conversions > a.conversions) && (o = {
func: n[s],
conversions: a.conversions
});
continue;
}
i || (i = a);
}
if (!o) {
if (i)
return i;
throw new Error("Missing function");
}
return o;
}
function nf(e, r) {
return r.map((t, n) => {
let i = n >= e.args.length ? e.args[e.args.length - 1] : e.args[n];
return typeof i != "object" && (i = {
type: i
}), i.type === Ze && t.type === me ? Zs(t) : t;
});
}
function ql(e, r) {
return e + ":" + r.args.map((t) => typeof t == "string" ? t : t.type).join("#");
}
function jn(e, r) {
return {
type: Fe,
value: Ji(r, !0)
};
}
function Jl(e, r) {
const t = Number(r.value);
if (Number.isNaN(t) || !Number.isFinite(t))
throw new Error("Unable to convert value to Number.");
if (r.value === "")
throw new Error("Unable to convert value to Number.");
return {
type: Ze,
value: t
};
}
function kd(e, r) {
if (r.value > Eo || r.value < Ao)
throw new Error("Unable to convert value to Integer.");
const t = r.value - r.value % 1;
return {
type: me,
value: _n(t)
};
}
function Ed(e, r) {
let t;
try {
t = _n(r.value);
} catch {
throw new Error("Unable to convert value to Integer.");
}
return {
type: me,
value: t
};
}
function Ad(e, r) {
return {
type: me,
value: _n(r.value ? 1 : 0)
};
}
function Cd(e, r) {
const t = Number(r.value);
if (t !== 1 && t !== 0)
throw new Error("Unable to convert value to Boolean.");
return {
type: Wr,
value: t
};
}
function jd(e, r) {
if (r.value !== "true" && r.value !== "false")
throw new Error("Unable to convert value to Boolean.");
return {
type: Wr,
value: r.value === "true" ? 1 : 0
};
}
function Sd(e, r) {
return {
type: ln,
value: co(r.value)
};
}
function Vd(e, r) {
return di(r.value), {
type: Wn,
value: r.value
};
}
function Id(e, r) {
try {
return {
type: Fe,
value: encodeURIComponent(r.value)
};
} catch {
throw new Error("Unable to encodeUri string.");
}
}
function Dd(e, r) {
try {
return {
type: Fe,
value: decodeURIComponent(r.value)
};
} catch {
throw new Error("Unable to decodeUri string.");
}
}
function vl(e, r, t, n) {
const i = e.variables.get(r.value);
let o;
return i && i.getType() === n ? (o = i.getValue(), e.storeUsedVars || (e.storeUsedVars = /* @__PURE__ */ new Set()), e.storeUsedVars.add(i)) : o = t.value, n === "color" ? o = co(o) : n === "url" && di(o), {
type: n,
// value is synced with type by params
value: o
};
}
function To(e, r, t) {
return vl(e, r, t, t.type);
}
function Kl(e, r, t) {
return vl(e, r, t, "color");
}
function Xl(e, r, t) {
return vl(e, r, t, "url");
}
function Td() {
N("toString", [me], jn), N("toString", [Ze], jn), N("toString", [Wr], jn), N("toString", [ln], jn), N("toString", [Wn], jn), N("toString", [Fe], jn), N("toString", [or], jn), N("toString", [ir], jn), N("toNumber", [me], Jl), N("toNumber", [Fe], Jl), N("toInteger", [Ze], kd), N("toInteger", [Fe], Ed), N("toInteger", [Wr], Ad), N("toBoolean", [me], Cd), N("toBoolean", [Fe], jd), N("toColor", [Fe], Sd), N("toUrl", [Fe], Vd), N("encodeUri", [Fe], Id), N("decodeUri", [Fe], Dd), N("getIntegerValue", [Fe, me], To), N("getNumberValue", [Fe, Ze], To), N("getBooleanValue", [Fe, Wr], To), N("getStringValue", [Fe, Fe], To), N("getColorValue", [Fe, ln], Kl), N("getColorValue", [Fe, Fe], Kl), N("getUrlValue", [Fe, Wn], Xl), N("getUrlValue", [Fe, Fe], Xl), Xr("toString", [me], jn), Xr("toString", [Ze], jn), Xr("toString", [Wr], jn), Xr("toString", [ln], jn), Xr("toString", [Wn], jn), Xr("toString", [Fe], jn), Xr("toString", [or], jn), Xr("toString", [ir], jn);
}
function Sn(e, r) {
return !e || !r ? e : e.padStart(r, "0");
}
const el = {
G(e, r) {
let t;
return e < 4 ? t = "short" : e === 5 ? t = "narrow" : t = "long", r({
era: t
}, "era");
},
d(e, r) {
return Sn(r({
day: "numeric"
}, "day"), e > 1 ? e : 0);
},
D(e, r) {
return Sn(r({}, "dayofyear"), e > 1 ? e : 0);
},
F(e, r) {
return Sn(r({}, "dayofweekinmonth"), e > 1 ? e : 0);
},
M(e, r) {
let t;
return e === 1 ? t = "numeric" : e === 2 ? t = "2-digit" : e === 3 ? t = "short" : e === 5 ? t = "narrow" : t = "long", r({
month: t,
// to get a genitive case of month
day: "numeric"
}, "month");
},
y(e, r) {
return Sn(r({
year: e === 2 ? "2-digit" : "numeric"
}, "year"), e > 2 ? e : void 0);
},
Y(e, r) {
return Sn(r({
year: e === 2 ? "2-digit" : "numeric"
}, "weekyear"), e > 2 ? e : void 0);
},
u(e, r) {
return Sn(r({
year: "numeric"
}, "extendedyear"), e > 1 ? e : void 0);
},
E(e, r) {
let t;
return e <= 3 ? t = "short" : e === 5 ? t = "narrow" : t = "long", r({
weekday: t
}, "weekday");
},
e(e, r) {
return e > 2 ? el.E(e, r) : Sn(r({}, "weekdaynumeric"), e > 1 ? e : void 0);
},
w(e, r) {
return Sn(r({}, "week"), e > 1 ? e : void 0);
},
W(e, r) {
return Sn(r({}, "weekofmonth"), e > 1 ? e : void 0);
},
H(e, r) {
const t = r({
hour: "numeric",
hour12: !1,
hourCycle: "h23"
}, "hour");
if (!t)
return;
const n = String(Number(t) % 24);
return Sn(n, e > 1 ? e : void 0);
},
h(e, r) {
return Sn(r({
hour: "numeric",
hour12: !0,
hourCycle: "h12"
}, "hour"), e > 1 ? e : void 0);
},
K(e, r) {
const t = r({
hour: "numeric",
hour12: !0,
hourCycle: "h11"
}, "hour");
if (!t)
return;
const n = String(Number(t) % 12);
return Sn(n, e > 1 ? e : void 0);
},
k(e, r) {
return Sn(r({
hour: "numeric",
hour12: !1,
hourCycle: "h24"
}, "hour"), e > 2 ? e : void 0);
},
a(e, r) {
return r({
hour: "numeric",
hour12: !0,
hourCycle: "h11",
dayPeriod: void 0
}, "dayPeriod");
},
m(e, r) {
return Sn(r({
minute: "numeric"
}, "minute"), e > 1 ? e : void 0);
},
s(e, r) {
return Sn(r({
second: "numeric"
}, "second"), e > 1 ? e : void 0);
},
S(e, r) {
const t = r({
fractionalSecondDigits: Math.min(3, e)
}, "fractionalSecond");
return t && e > 3 ? t.padEnd(e, "0") : t;
},
z(e, r) {
return r({
timeZoneName: e === 4 ? "long" : "short"
}, "timeZoneName");
},
Z(e, r) {
const t = -Number(r({}, "timezoneoffset")), n = Math.abs(t / 60), i = Math.floor(n) * 100 + (n - Math.floor(n)) * 60;
return (t >= 0 ? "+" : "-") + Sn(String(i), 4);
}
}, Fd = /(\w)\1*|''|'(''|[^'])+('|$)|./g, Md = /^'([^]*?)'?$/, Pd = /''/g, Nd = /[a-zA-Z]/, kl = 1e3 * 60 * 60 * 24;
function zd(e) {
const r = e.match(Md);
return r ? r[1].replace(Pd, "'") : e;
}
function tl(e, r, t) {
const n = e[r ? "getUTCDay" : "getDay"](), i = n < t ? t - n - 7 : t - n;
return new Date(e.getTime() + kl * i);
}
function Zl(e, r, t) {
const n = new Date(e);
return n[r ? "setUTCDate" : "setDate"](1), n[r ? "setUTCMonth" : "setMonth"](0), tl(n, r, t);
}
function Ql(e, r) {
return Math.round((e.getTime() - r.getTime()) / kl);
}
function xl(e, r, t) {
let n = 0;
const i = Zl(e, r || !1, t), o = new Date(e);
o[r ? "setUTCFullYear" : "setFullYear"](e[r ? "getUTCFullYear" : "getFullYear"]() + 1);
const s = Zl(o, r || !1, t), a = e.getTime() < i.getTime(), l = e.getTime() >= s.getTime();
let c = e[r ? "getUTCFullYear" : "getFullYear"]();
if (a) {
--c, i[r ? "setUTCFullYear" : "setFullYear"](i[r ? "getUTCFullYear" : "getFullYear"]() - 1);
const u = Ql(tl(e, r, t), i);
n = Math.round(u / 7) + 1;
} else if (l)
++c, n = 1;
else {
const u = Ql(tl(e, r, t), i);
n = Math.round(u / 7) + 1;
}
return {
week: n,
year: c
};
}
function Ld(e, r, {
locale: t,
isUTC: n,
weekStartDay: i = 0
} = {}) {
const o = (s, a) => {
if (a === "week") {
const { week: u } = xl(e, n || !1, i);
return String(u);
}
if (a === "weekofmonth") {
const u = e[n ? "getUTCDay" : "getDay"](), d = new Date(e);
d[n ? "setUTCDate" : "setDate"](1);
const _ = d[n ? "getUTCDay" : "getDay"](), m = e[n ? "getUTCDate" : "getDate"]();
return String(Math.ceil(m / 7) + (u < _ ? 1 : 0));
}
if (a === "dayofweekinmonth") {
const u = e[n ? "getUTCDate" : "getDate"]();
return String(Math.ceil(u / 7));
}
if (a === "weekdaynumeric") {
let u = e[n ? "getUTCDay" : "getDay"]();
return u < i && (u += 7), String(u - i + 1);
}
if (a === "dayofyear") {
const u = new Date(e);
u[n ? "setUTCMonth" : "setMonth"](0), u[n ? "setUTCDate" : "setDate"](1), u[n ? "setUTCHours" : "setHours"](1), u[n ? "setUTCMinutes" : "setMinutes"](1), u[n ? "setUTCSeconds" : "setSeconds"](1);
const d = Math.ceil((e.getTime() - u.getTime()) / kl);
return String(d);
}
if (a === "weekyear") {
let { year: u } = xl(e, n || !1, i);
return u < 1 && (u = 1 - u), s.year === "2-digit" ? String(u % 100) : String(u);
}
if (a === "extendedyear") {
const u = e[n ? "getUTCFullYear" : "getFullYear"]();
return s.year === "2-digit" ? String(u % 100) : String(u);
}
if (a === "timezoneoffset")
return n ? "0" : String(e.getTimezoneOffset());
n && (s.timeZone = "UTC");
const c = new Intl.DateTimeFormat(t, s).formatToParts(e);
for (let u = 0; u < c.length; ++u)
if (c[u].type === a)
return c[u].value;
};
return (r.match(Fd) || []).map((s) => {
if (s === "''")
return "'";
const a = s[0];
if (a === "'")
return zd(s);
if (el[a])
return el[a](s.length, o);
if (a.match(Nd))
throw new Error(
`Format string contains an unescaped latin alphabet character "${a}"`
);
return s;
}).join("");
}
function Od(e) {
const r = new Date(e);
return r.setUTCMonth(r.getUTCMonth() + 1), r.setUTCDate(0), r.getUTCDate();
}
function Rd(e, r) {
return {
type: Er,
value: new Date(Number(r.value) * 1e3)
};
}
function Bd(e, r) {
const t = new Date(Number(r.value) * 1e3), n = t.getTimezoneOffset();
return t.setMinutes(t.getMinutes() - n), {
type: Er,
value: t
};
}
function Hd() {
return {
type: Er,
value: /* @__PURE__ */ new Date()
};
}
function Wd(e, r, t) {
return {
type: Er,
value: new Date(r.value.getTime() + Number(t.value))
};
}
function Ud(e, r, t) {
const n = new Date(r.value);
return n.setUTCFullYear(Number(t.value)), {
type: Er,
value: n
};
}
function Gd(e, r, t) {
const n = Number(t.value);
if (n < 1 || n > 12)
throw new Error(`Expecting month in [1..12], instead got ${n}.`);
const i = new Date(r.value);
return i.setUTCMonth(n - 1), {
type: Er,
value: i
};
}
function Yd(e, r, t) {
const n = new Date(r.value), i = Number(t.value);
if (i <= 0 && i !== -1 || i > Od(n))
throw new Error(`Unable to set day ${i} for date ${Ji(r, !1)}.`);
return n.setUTCDate(i === -1 ? 0 : i), {
type: Er,
value: n
};
}
function qd(e, r, t) {
const n = Number(t.value);
if