angel-manager
Version:
<p align="center"> <img src="angel-manager.webp" alt="Angel Manager" width="300"> </p>
1,813 lines (1,812 loc) • 88.2 kB
JavaScript
import pt from "path";
import { fileURLToPath as gt } from "url";
var mt = gt(import.meta.url), tn = pt.dirname(mt), rn = function(t) {
var e = Object.keys(t);
if (e.length > 0)
return t[e[0]];
}, ke = function() {
return ke = Object.assign || function(e) {
for (var r, s = 1, i = arguments.length; s < i; s++) {
r = arguments[s];
for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
}
return e;
}, ke.apply(this, arguments);
};
function sn(t, e, r, s) {
function i(n) {
return n instanceof r ? n : new r(function(o) {
o(n);
});
}
return new (r || (r = Promise))(function(n, o) {
function a(c) {
try {
l(s.next(c));
} catch (d) {
o(d);
}
}
function u(c) {
try {
l(s.throw(c));
} catch (d) {
o(d);
}
}
function l(c) {
c.done ? n(c.value) : i(c.value).then(a, u);
}
l((s = s.apply(t, e || [])).next());
});
}
function nn(t, e) {
var r = { label: 0, sent: function() {
if (n[0] & 1) throw n[1];
return n[1];
}, trys: [], ops: [] }, s, i, n, o = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
return o.next = a(0), o.throw = a(1), o.return = a(2), typeof Symbol == "function" && (o[Symbol.iterator] = function() {
return this;
}), o;
function a(l) {
return function(c) {
return u([l, c]);
};
}
function u(l) {
if (s) throw new TypeError("Generator is already executing.");
for (; o && (o = 0, l[0] && (r = 0)), r; ) try {
if (s = 1, i && (n = l[0] & 2 ? i.return : l[0] ? i.throw || ((n = i.return) && n.call(i), 0) : i.next) && !(n = n.call(i, l[1])).done) return n;
switch (i = 0, n && (l = [l[0] & 2, n.value]), l[0]) {
case 0:
case 1:
n = l;
break;
case 4:
return r.label++, { value: l[1], done: !1 };
case 5:
r.label++, i = l[1], l = [0];
continue;
case 7:
l = r.ops.pop(), r.trys.pop();
continue;
default:
if (n = r.trys, !(n = n.length > 0 && n[n.length - 1]) && (l[0] === 6 || l[0] === 2)) {
r = 0;
continue;
}
if (l[0] === 3 && (!n || l[1] > n[0] && l[1] < n[3])) {
r.label = l[1];
break;
}
if (l[0] === 6 && r.label < n[1]) {
r.label = n[1], n = l;
break;
}
if (n && r.label < n[2]) {
r.label = n[2], r.ops.push(l);
break;
}
n[2] && r.ops.pop(), r.trys.pop();
continue;
}
l = e.call(t, r);
} catch (c) {
l = [6, c], i = 0;
} finally {
s = n = 0;
}
if (l[0] & 5) throw l[1];
return { value: l[0] ? l[1] : void 0, done: !0 };
}
}
class S {
constructor(e, r, s, i, n) {
this.kind = e, this.input = r, this.begin = s, this.end = i, this.file = n;
}
getText() {
return this.input.slice(this.begin, this.end);
}
getPosition() {
let [e, r] = [1, 1];
for (let s = 0; s < this.begin; s++)
this.input[s] === `
` ? (e++, r = 1) : r++;
return [e, r];
}
size() {
return this.end - this.begin;
}
}
class V {
liquidMethodMissing(e) {
}
}
const yt = Object.prototype.toString, xe = String.prototype.toLowerCase, ce = Object.hasOwnProperty;
function _(t) {
return typeof t == "string";
}
function w(t) {
return typeof t == "function";
}
function wt(t) {
return t && w(t.then);
}
function X(t) {
return t && w(t.next) && w(t.throw) && w(t.return);
}
function Tt(t) {
return t.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
}
function h(t) {
return t = f(t), _(t) ? t : v(t) ? "" : b(t) ? t.map((e) => h(e)).join("") : String(t);
}
function he(t) {
return t = f(t), b(t) ? t : _(t) && t.length > 0 ? [t] : kt(t) ? Array.from(t) : te(t) ? Object.keys(t).map((e) => [e, t[e]]) : [];
}
function T(t) {
return t = f(t), v(t) ? [] : b(t) ? t : [t];
}
function f(t) {
return t instanceof V && w(t.valueOf) ? t.valueOf() : t;
}
function _e(t) {
return t = Number(t), isNaN(t) ? 0 : t;
}
function fe(t) {
return typeof t == "number";
}
function We(t) {
return t && w(t.toLiquid) ? We(t.toLiquid()) : t;
}
function v(t) {
return t == null;
}
function bt(t) {
return t === void 0;
}
function b(t) {
return yt.call(t) === "[object Array]";
}
function kt(t) {
return te(t) && Symbol.iterator in t;
}
function ve(t, e) {
t = t || {};
for (const r in t)
if (ce.call(t, r) && e(t[r], r, t) === !1)
break;
return t;
}
function Ye(t) {
return t[t.length - 1];
}
function te(t) {
const e = typeof t;
return t !== null && (e === "object" || e === "function");
}
function Je(t, e, r = 1) {
const s = [];
for (let i = t; i < e; i += r)
s.push(i);
return s;
}
function J(t, e, r = " ") {
return Qe(t, e, r, (s, i) => i + s);
}
function xt(t, e, r = " ") {
return Qe(t, e, r, (s, i) => s + i);
}
function Qe(t, e, r, s) {
t = String(t);
let i = e - t.length;
for (; i-- > 0; )
t = s(t, r);
return t;
}
function Ze(t) {
return t;
}
function _t(t) {
return [...t].some((r) => r >= "a" && r <= "z") ? t.toUpperCase() : t.toLowerCase();
}
function vt(t, e) {
return t.length > e ? t.slice(0, e - 3) + "..." : t;
}
function Le(t, e) {
return t == null && e == null ? 0 : t == null ? 1 : e == null || (t = xe.call(t), e = xe.call(e), t < e) ? -1 : t > e ? 1 : 0;
}
function x(t) {
return function(...e) {
return t.call(this, ...e.map(f));
};
}
function de(t) {
return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
}
const Se = "__liquidClass__";
class B extends Error {
constructor(e, r) {
super(typeof e == "string" ? e : e.message), this.context = "", typeof e != "string" && Object.defineProperty(this, "originalError", { value: e, enumerable: !1 }), Object.defineProperty(this, "token", { value: r, enumerable: !1 }), Object.defineProperty(this, Se, { value: "LiquidError", enumerable: !1 });
}
update() {
Object.defineProperty(this, "context", { value: zt(this.token), enumerable: !1 }), this.message = Nt(this.message, this.token), this.stack = this.message + `
` + this.context + `
` + this.stack, this.originalError && (this.stack += `
From ` + this.originalError.stack);
}
static is(e) {
return e?.[Se] === "LiquidError";
}
}
class Lt extends B {
constructor(e, r) {
super(e, r), this.name = "TokenizationError", super.update();
}
}
class St extends B {
constructor(e, r) {
super(e, r), this.name = "ParseError", this.message = e.message, super.update();
}
}
class Ft extends B {
constructor(e, r) {
super(e, r.token), this.name = "RenderError", this.message = e.message, super.update();
}
static is(e) {
return e.name === "RenderError";
}
}
class Ge extends B {
constructor(e) {
super(e[0], e[0].token), this.errors = e, this.name = "LiquidErrors";
const r = e.length > 1 ? "s" : "";
this.message = `${e.length} error${r} found`, super.update();
}
static is(e) {
return e.name === "LiquidErrors";
}
}
class Ot extends B {
constructor(e, r) {
super(e, r), this.name = "UndefinedVariableError", this.message = e.message, super.update();
}
}
class Rt extends Error {
constructor(e) {
super(`undefined variable: ${e}`), this.name = "InternalUndefinedVariableError", this.variableName = e;
}
}
class Et extends Error {
constructor(e) {
super(e), this.name = "AssertionError", this.message = e + "";
}
}
function zt(t) {
const [e, r] = t.getPosition(), s = t.input.split(`
`), i = Math.max(e - 2, 1), n = Math.min(e + 3, s.length);
return Je(i, n + 1).map((a) => {
const u = a === e ? ">> " : " ", l = J(String(a), String(n).length);
let c = `${u}${l}| `;
const d = a === e ? `
` + J("^", r + c.length) : "";
return c += s[a - 1], c += d, c;
}).join(`
`);
}
function Nt(t, e) {
e.file && (t += `, file:${e.file}`);
const [r, s] = e.getPosition();
return t += `, line:${r}, col:${s}`, t;
}
const p = [0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 4, 4, 4, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 8, 0, 0, 0, 0, 8, 0, 0, 0, 64, 0, 65, 0, 0, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 0, 0, 2, 2, 2, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0], Dt = 1, H = 4, Fe = 8, Xe = 16, qt = 32, Mt = 64, It = 128;
function Q(t) {
const e = t.charCodeAt(0);
return e >= 128 ? !p[e] : !!(p[e] & Dt);
}
p[160] = p[5760] = p[6158] = p[8192] = p[8193] = p[8194] = p[8195] = p[8196] = p[8197] = p[8198] = p[8199] = p[8200] = p[8201] = p[8202] = p[8232] = p[8233] = p[8239] = p[8287] = p[12288] = H;
p[8220] = p[8221] = It;
function k(t, e) {
if (!t) {
const r = typeof e == "function" ? e() : e || `expect ${t} to be true`;
throw new Et(r);
}
}
function K(t, e = `unexpected ${JSON.stringify(t)}`) {
k(!t, e);
}
class $t extends V {
equals(e) {
return v(f(e));
}
gt() {
return !1;
}
geq() {
return !1;
}
lt() {
return !1;
}
leq() {
return !1;
}
valueOf() {
return null;
}
}
class re extends V {
equals(e) {
return e instanceof re ? !1 : (e = f(e), _(e) || b(e) ? e.length === 0 : te(e) ? Object.keys(e).length === 0 : !1);
}
gt() {
return !1;
}
geq() {
return !1;
}
lt() {
return !1;
}
leq() {
return !1;
}
valueOf() {
return "";
}
}
class Pt extends re {
equals(e) {
return e === !1 || v(f(e)) ? !0 : _(e) ? /^\s*$/.test(e) : super.equals(e);
}
}
class pe extends V {
constructor(e, r, s) {
super(), this.i = 0, this.length = e, this.name = `${s}-${r}`;
}
next() {
this.i++;
}
index0() {
return this.i;
}
index() {
return this.i + 1;
}
first() {
return this.i === 0;
}
last() {
return this.i === this.length - 1;
}
rindex() {
return this.length - this.i;
}
rindex0() {
return this.length - this.i - 1;
}
valueOf() {
return JSON.stringify(this);
}
}
class Oe extends V {
constructor(e = () => "") {
super(), this.superBlockRender = e;
}
/**
* Provide parent access in child block by
* {{ block.super }}
*/
super() {
return this.superBlockRender();
}
}
function E(t) {
return t && w(t.equals) && w(t.gt) && w(t.geq) && w(t.lt) && w(t.leq);
}
const Re = new $t(), Ke = {
true: !0,
false: !1,
nil: Re,
null: Re,
empty: new re(),
blank: new Pt()
};
function Ee(t) {
const e = {};
for (const [r, s] of Object.entries(t)) {
let i = e;
for (let n = 0; n < r.length; n++) {
const o = r[n];
i[o] = i[o] || {}, n === r.length - 1 && Q(r[n]) && (i[o].needBoundary = !0), i = i[o];
}
i.data = s, i.end = !0;
}
return e;
}
var ee = function() {
return ee = Object.assign || function(e) {
for (var r, s = 1, i = arguments.length; s < i; s++) {
r = arguments[s];
for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
}
return e;
}, ee.apply(this, arguments);
};
function O(t, e, r, s) {
function i(n) {
return n instanceof r ? n : new r(function(o) {
o(n);
});
}
return new (r || (r = Promise))(function(n, o) {
function a(c) {
try {
l(s.next(c));
} catch (d) {
o(d);
}
}
function u(c) {
try {
l(s.throw(c));
} catch (d) {
o(d);
}
}
function l(c) {
c.done ? n(c.value) : i(c.value).then(a, u);
}
l((s = s.apply(t, [])).next());
});
}
function N(t) {
return O(this, void 0, void 0, function* () {
if (!X(t))
return t;
let e, r = !1, s = "next";
do {
const i = t[s](e);
r = i.done, e = i.value, s = "next";
try {
X(e) && (e = N(e)), wt(e) && (e = yield e);
} catch (n) {
s = "throw", e = n;
}
} while (!r);
return e;
});
}
function D(t) {
if (!X(t))
return t;
let e, r = !1, s = "next";
do {
const i = t[s](e);
if (r = i.done, e = i.value, s = "next", X(e))
try {
e = D(e);
} catch (n) {
s = "throw", e = n;
}
} while (!r);
return e;
}
const Ct = /%([-_0^#:]+)?(\d+)?([EO])?(.)/;
function At(t) {
return [31, Vt(t) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
}
function et(t) {
let e = 0;
for (let r = 0; r < t.getMonth(); ++r)
e += At(t)[r];
return e + t.getDate();
}
function ze(t, e) {
const r = et(t) + (e - t.getDay()), i = 7 - new Date(t.getFullYear(), 0, 1).getDay() + e;
return String(Math.floor((r - i) / 7) + 1);
}
function Vt(t) {
const e = t.getFullYear();
return !!(!(e & 3) && (e % 100 || e % 400 === 0 && e));
}
function Bt(t) {
const e = t.getDate();
if ([11, 12, 13].includes(e))
return "th";
switch (e % 10) {
case 1:
return "st";
case 2:
return "nd";
case 3:
return "rd";
default:
return "th";
}
}
function jt(t) {
return parseInt(t.getFullYear().toString().substring(0, 2), 10);
}
const Ut = {
d: 2,
e: 2,
H: 2,
I: 2,
j: 3,
k: 2,
l: 2,
L: 3,
m: 2,
M: 2,
S: 2,
U: 2,
W: 2
}, Ht = new Set("aAbBceklpP");
function Ne(t, e) {
const r = Math.abs(t.getTimezoneOffset()), s = Math.floor(r / 60), i = r % 60;
return (t.getTimezoneOffset() > 0 ? "-" : "+") + J(s, 2, "0") + (e.flags[":"] ? ":" : "") + J(i, 2, "0");
}
const le = {
a: (t) => t.getShortWeekdayName(),
A: (t) => t.getLongWeekdayName(),
b: (t) => t.getShortMonthName(),
B: (t) => t.getLongMonthName(),
c: (t) => t.toLocaleString(),
C: (t) => jt(t),
d: (t) => t.getDate(),
e: (t) => t.getDate(),
H: (t) => t.getHours(),
I: (t) => String(t.getHours() % 12 || 12),
j: (t) => et(t),
k: (t) => t.getHours(),
l: (t) => String(t.getHours() % 12 || 12),
L: (t) => t.getMilliseconds(),
m: (t) => t.getMonth() + 1,
M: (t) => t.getMinutes(),
N: (t, e) => {
const r = Number(e.width) || 9, s = String(t.getMilliseconds()).slice(0, r);
return xt(s, r, "0");
},
p: (t) => t.getHours() < 12 ? "AM" : "PM",
P: (t) => t.getHours() < 12 ? "am" : "pm",
q: (t) => Bt(t),
s: (t) => Math.round(t.getTime() / 1e3),
S: (t) => t.getSeconds(),
u: (t) => t.getDay() || 7,
U: (t) => ze(t, 0),
w: (t) => t.getDay(),
W: (t) => ze(t, 1),
x: (t) => t.toLocaleDateString(),
X: (t) => t.toLocaleTimeString(),
y: (t) => t.getFullYear().toString().slice(2, 4),
Y: (t) => t.getFullYear(),
z: Ne,
Z: (t, e) => t.getTimeZoneName() || Ne(t, e),
t: () => " ",
n: () => `
`,
"%": () => "%"
};
le.h = le.b;
function Z(t, e) {
let r = "", s = e, i;
for (; i = Ct.exec(s); )
r += s.slice(0, i.index), s = s.slice(i.index + i[0].length), r += Wt(t, i);
return r + s;
}
function Wt(t, e) {
const [r, s = "", i, n, o] = e, a = le[o];
if (!a)
return r;
const u = {};
for (const F of s)
u[F] = !0;
let l = String(a(t, { flags: u, width: i, modifier: n })), c = Ht.has(o) ? " " : "0", d = i || Ut[o] || 0;
return u["^"] ? l = l.toUpperCase() : u["#"] && (l = _t(l)), u._ ? c = " " : u[0] && (c = "0"), u["-"] && (d = 0), J(l, d, c);
}
function tt() {
return typeof Intl < "u" ? Intl.DateTimeFormat : void 0;
}
const Yt = 6e4, Jt = /([zZ]|([+-])(\d{2}):(\d{2}))$/, rt = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
], Qt = rt.map((t) => t.slice(0, 3)), st = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
], Zt = st.map((t) => t.slice(0, 3));
class R {
constructor(e, r, s) {
this.locale = r, this.DateTimeFormat = tt(), this.date = new Date(e), this.timezoneFixed = s !== void 0, s === void 0 && (s = this.date.getTimezoneOffset()), this.timezoneOffset = _(s) ? R.getTimezoneOffset(s, this.date) : s, this.timezoneName = _(s) ? s : "";
const i = (this.date.getTimezoneOffset() - this.timezoneOffset) * Yt, n = this.date.getTime() + i;
this.displayDate = new Date(n);
}
getTime() {
return this.displayDate.getTime();
}
getMilliseconds() {
return this.displayDate.getMilliseconds();
}
getSeconds() {
return this.displayDate.getSeconds();
}
getMinutes() {
return this.displayDate.getMinutes();
}
getHours() {
return this.displayDate.getHours();
}
getDay() {
return this.displayDate.getDay();
}
getDate() {
return this.displayDate.getDate();
}
getMonth() {
return this.displayDate.getMonth();
}
getFullYear() {
return this.displayDate.getFullYear();
}
toLocaleString(e, r) {
return r?.timeZone ? this.date.toLocaleString(e, r) : this.displayDate.toLocaleString(e, r);
}
toLocaleTimeString(e) {
return this.displayDate.toLocaleTimeString(e);
}
toLocaleDateString(e) {
return this.displayDate.toLocaleDateString(e);
}
getTimezoneOffset() {
return this.timezoneOffset;
}
getTimeZoneName() {
if (this.timezoneFixed)
return this.timezoneName;
if (this.DateTimeFormat)
return this.DateTimeFormat().resolvedOptions().timeZone;
}
getLongMonthName() {
var e;
return (e = this.format({ month: "long" })) !== null && e !== void 0 ? e : rt[this.getMonth()];
}
getShortMonthName() {
var e;
return (e = this.format({ month: "short" })) !== null && e !== void 0 ? e : Qt[this.getMonth()];
}
getLongWeekdayName() {
var e;
return (e = this.format({ weekday: "long" })) !== null && e !== void 0 ? e : st[this.displayDate.getDay()];
}
getShortWeekdayName() {
var e;
return (e = this.format({ weekday: "short" })) !== null && e !== void 0 ? e : Zt[this.displayDate.getDay()];
}
valid() {
return !isNaN(this.getTime());
}
format(e) {
return this.DateTimeFormat && this.DateTimeFormat(this.locale, e).format(this.displayDate);
}
/**
* Create a Date object fixed to it's declared Timezone. Both
* - 2021-08-06T02:29:00.000Z and
* - 2021-08-06T02:29:00.000+08:00
* will always be displayed as
* - 2021-08-06 02:29:00
* regardless timezoneOffset in JavaScript realm
*
* The implementation hack:
* Instead of calling `.getMonth()`/`.getUTCMonth()` respect to `preserveTimezones`,
* we create a different Date to trick strftime, it's both simpler and more performant.
* Given that a template is expected to be parsed fewer times than rendered.
*/
static createDateFixedToTimezone(e, r) {
const s = e.match(Jt);
if (s && s[1] === "Z")
return new R(+new Date(e), r, 0);
if (s && s[2] && s[3] && s[4]) {
const [, , i, n, o] = s, a = (i === "+" ? -1 : 1) * (parseInt(n, 10) * 60 + parseInt(o, 10));
return new R(+new Date(e), r, a);
}
return new R(e, r);
}
static getTimezoneOffset(e, r) {
const s = r.toLocaleString("en-US", { timeZone: e }), i = r.toLocaleString("en-US", { timeZone: "UTC" }), n = new Date(s);
return (+new Date(i) - +n) / (60 * 1e3);
}
}
class ue {
constructor(e, r) {
this.base = 0, this.message = `${e} limit exceeded`, this.limit = r;
}
use(e) {
e = _e(e), k(this.base + e <= this.limit, this.message), this.base += e;
}
check(e) {
e = _e(e), k(e <= this.limit, this.message);
}
}
class ge extends S {
constructor(e, [r, s], i, n, o, a, u, l) {
super(e, i, n, o, l), this.trimLeft = !1, this.trimRight = !1;
const c = i[r] === "-", d = i[s - 1] === "-";
let F = c ? r + 1 : r, Y = d ? s - 1 : s;
for (; F < Y && p[i.charCodeAt(F)] & H; )
F++;
for (; Y > F && p[i.charCodeAt(Y - 1)] & H; )
Y--;
this.contentRange = [F, Y], this.trimLeft = c || a, this.trimRight = d || u;
}
get content() {
return this.input.slice(this.contentRange[0], this.contentRange[1]);
}
}
class De extends ge {
constructor(e, r, s, i, n) {
const { trimTagLeft: o, trimTagRight: a, tagDelimiterLeft: u, tagDelimiterRight: l } = i, [c, d] = [r + u.length, s - l.length];
super(g.Tag, [c, d], e, r, s, o, a, n), this.tokenizer = new z(e, i.operators, n, this.contentRange), this.name = this.tokenizer.readTagName(), this.tokenizer.assert(this.name, "illegal tag syntax, tag name expected"), this.tokenizer.skipBlank();
}
get args() {
return this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1]);
}
}
class Gt extends ge {
constructor(e, r, s, i, n) {
const { trimOutputLeft: o, trimOutputRight: a, outputDelimiterLeft: u, outputDelimiterRight: l } = i, c = [r + u.length, s - l.length];
super(g.Output, c, e, r, s, o, a, n);
}
}
class qe extends S {
constructor(e, r, s, i) {
super(g.HTML, e, r, s, i), this.input = e, this.begin = r, this.end = s, this.file = i, this.trimLeft = 0, this.trimRight = 0;
}
getContent() {
return this.input.slice(this.begin + this.trimLeft, this.end - this.trimRight);
}
}
class Xt extends S {
constructor(e, r, s, i) {
super(g.Number, e, r, s, i), this.input = e, this.begin = r, this.end = s, this.file = i, this.content = Number(this.getText());
}
}
class ne extends S {
constructor(e, r, s, i) {
super(g.Word, e, r, s, i), this.input = e, this.begin = r, this.end = s, this.file = i, this.content = this.getText();
}
}
class Kt extends S {
constructor(e, r, s, i) {
super(g.Literal, e, r, s, i), this.input = e, this.begin = r, this.end = s, this.file = i, this.literal = this.getText(), this.content = Ke[this.literal];
}
}
const Me = {
"==": 2,
"!=": 2,
">": 2,
"<": 2,
">=": 2,
"<=": 2,
contains: 2,
not: 1,
and: 0,
or: 0
}, er = {
"==": 0,
"!=": 0,
">": 0,
"<": 0,
">=": 0,
"<=": 0,
contains: 0,
not: 1,
and: 0,
or: 0
/* OperatorType.Binary */
};
class tr extends S {
constructor(e, r, s, i) {
super(g.Operator, e, r, s, i), this.input = e, this.begin = r, this.end = s, this.file = i, this.operator = this.getText();
}
getPrecedence() {
const e = this.getText();
return e in Me ? Me[e] : 1;
}
}
class Ie extends S {
constructor(e, r, s, i, n, o) {
super(g.PropertyAccess, s, i, n, o), this.variable = e, this.props = r;
}
}
class rr extends S {
constructor(e, r, s, i, n, o) {
super(g.Filter, s, i, n, o), this.name = e, this.args = r;
}
}
class sr extends S {
constructor(e, r, s, i, n, o) {
super(g.Hash, e, r, s, o), this.input = e, this.begin = r, this.end = s, this.name = i, this.value = n, this.file = o;
}
}
const ir = /[\da-fA-F]/, $e = /[0-7]/, Pe = {
b: "\b",
f: "\f",
n: `
`,
r: "\r",
t: " ",
v: "\v"
};
function Ce(t) {
const e = t.charCodeAt(0);
return e >= 97 ? e - 87 : e >= 65 ? e - 55 : e - 48;
}
function nr(t) {
let e = "";
for (let r = 1; r < t.length - 1; r++) {
if (t[r] !== "\\") {
e += t[r];
continue;
}
if (Pe[t[r + 1]] !== void 0)
e += Pe[t[++r]];
else if (t[r + 1] === "u") {
let s = 0, i = r + 2;
for (; i <= r + 5 && ir.test(t[i]); )
s = s * 16 + Ce(t[i++]);
r = i - 1, e += String.fromCharCode(s);
} else if (!$e.test(t[r + 1]))
e += t[++r];
else {
let s = r + 1, i = 0;
for (; s <= r + 3 && $e.test(t[s]); )
i = i * 8 + Ce(t[s++]);
r = s - 1, e += String.fromCharCode(i);
}
}
return e;
}
class or extends S {
constructor(e, r, s, i) {
super(g.Quoted, e, r, s, i), this.input = e, this.begin = r, this.end = s, this.file = i, this.content = nr(this.getText());
}
}
class ar extends S {
constructor(e, r, s, i, n, o) {
super(g.Range, e, r, s, o), this.input = e, this.begin = r, this.end = s, this.lhs = i, this.rhs = n, this.file = o;
}
}
class lr extends ge {
constructor(e, r, s, i, n) {
super(g.Tag, [r, s], e, r, s, !1, !1, n), this.tokenizer = new z(e, i.operators, n, this.contentRange), this.name = this.tokenizer.readTagName(), this.tokenizer.assert(this.name, "illegal liquid tag syntax"), this.tokenizer.skipBlank(), this.args = this.tokenizer.remaining();
}
}
class ur extends S {
constructor(e, r, s, i, n, o) {
super(g.FilteredValue, s, i, n, o), this.initial = e, this.filters = r, this.input = s, this.begin = i, this.end = n, this.file = o;
}
}
const cr = {
now: () => Date.now()
};
function it() {
return typeof global == "object" && global.performance || typeof window == "object" && window.performance || cr;
}
class hr {
constructor() {
this.buffer = "";
}
write(e) {
this.buffer += h(e);
}
}
class fr {
constructor() {
throw this.buffer = "", this.stream = null, new Error("streaming not supported in browser");
}
}
class dr {
constructor() {
this.buffer = "";
}
write(e) {
e = f(e), typeof e != "string" && this.buffer === "" ? this.buffer = e : this.buffer = h(this.buffer) + h(e);
}
}
class pr {
renderTemplatesToNodeStream(e, r) {
const s = new fr();
return Promise.resolve().then(() => N(this.renderTemplates(e, r, s))).then(() => s.end(), (i) => s.error(i)), s.stream;
}
*renderTemplates(e, r, s) {
s || (s = r.opts.keepOutputType ? new dr() : new hr());
const i = [];
for (const n of e) {
r.renderLimit.check(it().now());
try {
const o = yield n.render(r, s);
if (o && s.write(o), s.break || s.continue)
break;
} catch (o) {
const a = B.is(o) ? o : new Ft(o, n);
if (r.opts.catchAllErrors)
i.push(a);
else
throw a;
}
}
if (i.length)
throw new Ge(i);
return s.buffer;
}
}
class gr {
constructor(e) {
this.postfix = [...wr(e)];
}
*evaluate(e, r) {
k(e, "unable to evaluate: context not defined");
const s = [];
for (const i of this.postfix)
if (ut(i)) {
const n = s.pop();
let o;
if (er[i.operator] === 1)
o = yield e.opts.operators[i.operator](n, e);
else {
const a = s.pop();
o = yield e.opts.operators[i.operator](a, n, e);
}
s.push(o);
} else
s.push(yield y(i, e, r));
return s[0];
}
valid() {
return !!this.postfix.length;
}
}
function* y(t, e, r = !1) {
if (t) {
if ("content" in t)
return t.content;
if (rs(t))
return yield mr(t, e, r);
if (ss(t))
return yield yr(t, e);
}
}
function* mr(t, e, r) {
const s = [];
for (const i of t.props)
s.push(yield y(i, e, !1));
try {
if (t.variable) {
const i = yield y(t.variable, e, r);
return yield e._getFromScope(i, s);
} else
return yield e._get(s);
} catch (i) {
if (r && i.name === "InternalUndefinedVariableError")
return null;
throw new Ot(i, t);
}
}
function nt(t) {
return t.content;
}
function* yr(t, e) {
const r = yield y(t.lhs, e), s = yield y(t.rhs, e);
return Je(+r, +s + 1);
}
function* wr(t) {
const e = [];
for (const r of t)
if (ut(r)) {
for (; e.length && e[e.length - 1].getPrecedence() > r.getPrecedence(); )
yield e.pop();
e.push(r);
} else
yield r;
for (; e.length; )
yield e.pop();
}
function $(t, e) {
return !se(t, e);
}
function se(t, e) {
return t = f(t), e.opts.jsTruthy ? !t : t === !1 || t === void 0 || t === null;
}
const Tr = {
"==": P,
"!=": (t, e) => !P(t, e),
">": (t, e) => E(t) ? t.gt(e) : E(e) ? e.lt(t) : f(t) > f(e),
"<": (t, e) => E(t) ? t.lt(e) : E(e) ? e.gt(t) : f(t) < f(e),
">=": (t, e) => E(t) ? t.geq(e) : E(e) ? e.leq(t) : f(t) >= f(e),
"<=": (t, e) => E(t) ? t.leq(e) : E(e) ? e.geq(t) : f(t) <= f(e),
contains: (t, e) => (t = f(t), b(t) ? t.some((r) => P(r, e)) : w(t?.indexOf) ? t.indexOf(f(e)) > -1 : !1),
not: (t, e) => se(f(t), e),
and: (t, e, r) => $(f(t), r) && $(f(e), r),
or: (t, e, r) => $(f(t), r) || $(f(e), r)
};
function P(t, e) {
return E(t) ? t.equals(e) : E(e) ? e.equals(t) : (t = f(t), e = f(e), b(t) ? b(e) && br(t, e) : t === e);
}
function br(t, e) {
return t.length !== e.length ? !1 : !t.some((r, s) => !P(r, e[s]));
}
class oe {
constructor(e, r, s, i) {
this.key = e, this.value = r, this.next = s, this.prev = i;
}
}
class Ae {
constructor(e, r = 0) {
this.limit = e, this.size = r, this.cache = {}, this.head = new oe("HEAD", null, null, null), this.tail = new oe("TAIL", null, null, null), this.head.next = this.tail, this.tail.prev = this.head;
}
write(e, r) {
if (this.cache[e])
this.cache[e].value = r;
else {
const s = new oe(e, r, this.head.next, this.head);
this.head.next.prev = s, this.head.next = s, this.cache[e] = s, this.size++, this.ensureLimit();
}
}
read(e) {
if (!this.cache[e])
return;
const { value: r } = this.cache[e];
return this.remove(e), this.write(e, r), r;
}
remove(e) {
const r = this.cache[e];
r.prev.next = r.next, r.next.prev = r.prev, delete this.cache[e], this.size--;
}
clear() {
this.head.next = this.tail, this.tail.prev = this.head, this.size = 0, this.cache = {};
}
ensureLimit() {
this.size > this.limit && this.remove(this.tail.prev.key);
}
}
function ot(t, e) {
const r = document.createElement("base");
r.href = t;
const s = document.getElementsByTagName("head")[0];
s.insertBefore(r, s.firstChild);
const i = document.createElement("a");
i.href = e;
const n = i.href;
return s.removeChild(r), n;
}
function kr(t, e, r) {
return t.length && Ye(t) !== "/" && (t += "/"), ot(t, e).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/, (i, n, o) => {
const a = o.split("/").pop();
return /\.\w+$/.test(a) ? i : n + o + r;
});
}
function xr(t) {
return O(this, void 0, void 0, function* () {
return new Promise((e, r) => {
const s = new XMLHttpRequest();
s.onload = () => {
s.status >= 200 && s.status < 300 ? e(s.responseText) : r(new Error(s.statusText));
}, s.onerror = () => {
r(new Error("An error occurred whilst receiving the response."));
}, s.open("GET", t), s.send();
});
});
}
function _r(t) {
const e = new XMLHttpRequest();
if (e.open("GET", t, !1), e.send(), e.status < 200 || e.status >= 300)
throw new Error(e.statusText);
return e.responseText;
}
function vr(t) {
return O(this, void 0, void 0, function* () {
return !0;
});
}
function Lr(t) {
return !0;
}
function Sr(t) {
return ot(t, ".");
}
const Fr = "/";
var Or = /* @__PURE__ */ Object.freeze({
__proto__: null,
resolve: kr,
readFile: xr,
readFileSync: _r,
exists: vr,
existsSync: Lr,
dirname: Sr,
sep: Fr
});
function Rr(t, e, ...r) {
return t = f(t), b(t) || _(t) ? t.length ? t : e : t === !1 && new Map(r).get("allow_false") ? !1 : se(t, this.context) ? e : t;
}
function Ve(t, e = 0) {
return JSON.stringify(t, null, e);
}
function Er(t, e = 0) {
const r = [];
return JSON.stringify(t, function(s, i) {
if (typeof i != "object" || i === null)
return i;
for (; r.length > 0 && r[r.length - 1] !== this; )
r.pop();
return r.includes(i) ? "[Circular]" : (r.push(i), i);
}, e);
}
function zr(t) {
return Number(t);
}
const Nr = {
raw: !0,
handler: Ze
};
var at = {
default: Rr,
raw: Nr,
jsonify: Ve,
to_integer: zr,
json: Ve,
inspect: Er
};
const Dr = {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'"
}, qr = {
"&": "&",
"<": "<",
">": ">",
""": '"',
"'": "'"
};
function ie(t) {
return t = h(t), this.context.memoryLimit.use(t.length), t.replace(/&|<|>|"|'/g, (e) => Dr[e]);
}
function Mr(t) {
return ie.call(this, t);
}
function Ir(t) {
return t = h(t), this.context.memoryLimit.use(t.length), t.replace(/&(amp|lt|gt|#34|#39);/g, (e) => qr[e]);
}
function $r(t) {
return ie.call(this, Ir.call(this, t));
}
function Pr(t) {
const e = h(t);
return this.context.memoryLimit.use(e.length), e.replace(/\r?\n/gm, `<br />
`);
}
function Cr(t) {
const e = h(t);
return this.context.memoryLimit.use(e.length), e.replace(/<script[\s\S]*?<\/script>|<style[\s\S]*?<\/style>|<.*?>|<!--[\s\S]*?-->/g, "");
}
var Ar = /* @__PURE__ */ Object.freeze({
__proto__: null,
escape: ie,
xml_escape: Mr,
escape_once: $r,
newline_to_br: Pr,
strip_html: Cr
});
class Vr {
constructor(e) {
this.mapping = e, this.sep = "/";
}
exists(e) {
return O(this, void 0, void 0, function* () {
return this.existsSync(e);
});
}
existsSync(e) {
return !v(this.mapping[e]);
}
readFile(e) {
return O(this, void 0, void 0, function* () {
return this.readFileSync(e);
});
}
readFileSync(e) {
const r = this.mapping[e];
if (v(r))
throw new Error(`ENOENT: ${e}`);
return r;
}
dirname(e) {
const r = e.split(this.sep);
return r.pop(), r.join(this.sep);
}
resolve(e, r, s) {
if (r += s, e === ".")
return r;
const i = e.split(/\/+/);
for (const n of r.split(this.sep))
n === "." || n === "" || (n === ".." ? (i.length > 1 || i[0] !== "") && i.pop() : i.push(n));
return i.join(this.sep);
}
}
const U = {
root: ["."],
layouts: ["."],
partials: ["."],
relativeReference: !0,
jekyllInclude: !1,
keyValueSeparator: ":",
cache: void 0,
extname: "",
fs: Or,
dynamicPartials: !0,
jsTruthy: !1,
dateFormat: "%A, %B %-e, %Y at %-l:%M %P %z",
locale: "",
trimTagRight: !1,
trimTagLeft: !1,
trimOutputRight: !1,
trimOutputLeft: !1,
greedy: !0,
tagDelimiterLeft: "{%",
tagDelimiterRight: "%}",
outputDelimiterLeft: "{{",
outputDelimiterRight: "}}",
preserveTimezones: !1,
strictFilters: !1,
strictVariables: !1,
ownPropertyOnly: !0,
lenientIf: !1,
globals: {},
keepOutputType: !1,
operators: Tr,
memoryLimit: 1 / 0,
parseLimit: 1 / 0,
renderLimit: 1 / 0
};
function Br(t) {
var e, r;
if (t.hasOwnProperty("root") && (t.hasOwnProperty("partials") || (t.partials = t.root), t.hasOwnProperty("layouts") || (t.layouts = t.root)), t.hasOwnProperty("cache")) {
let s;
typeof t.cache == "number" ? s = t.cache > 0 ? new Ae(t.cache) : void 0 : typeof t.cache == "object" ? s = t.cache : s = t.cache ? new Ae(1024) : void 0, t.cache = s;
}
return t = Object.assign(Object.assign(Object.assign({}, U), t.jekyllInclude ? { dynamicPartials: !1 } : {}), t), (!t.fs.dirname || !t.fs.sep) && t.relativeReference && (console.warn("[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning"), t.relativeReference = !1), t.root = G(t.root), t.partials = G(t.partials), t.layouts = G(t.layouts), t.outputEscape = t.outputEscape && jr(t.outputEscape), t.locale || (t.locale = (r = (e = tt()) === null || e === void 0 ? void 0 : e().resolvedOptions().locale) !== null && r !== void 0 ? r : "en-US"), t.templates && (t.fs = new Vr(t.templates), t.relativeReference = !0, t.root = t.partials = t.layouts = "."), t;
}
function jr(t) {
return t === "escape" ? ie : t === "json" ? at.json : (k(w(t), "`outputEscape` need to be of type string or function"), t);
}
function G(t) {
let e = [];
return b(t) && (e = t), _(t) && (e = [t]), e;
}
function Ur(t, e) {
let r = !1;
for (let s = 0; s < t.length; s++) {
const i = t[s];
Kr(i) && (!r && i.trimLeft && Hr(t[s - 1], e.greedy), j(i) && (i.name === "raw" ? r = !0 : i.name === "endraw" && (r = !1)), !r && i.trimRight && Wr(t[s + 1], e.greedy));
}
}
function Hr(t, e) {
if (!t || !ye(t))
return;
const r = e ? H : Xe;
for (; p[t.input.charCodeAt(t.end - 1 - t.trimRight)] & r; )
t.trimRight++;
}
function Wr(t, e) {
if (!t || !ye(t))
return;
const r = e ? H : Xe;
for (; p[t.input.charCodeAt(t.begin + t.trimLeft)] & r; )
t.trimLeft++;
t.input.charAt(t.begin + t.trimLeft) === `
` && t.trimLeft++;
}
class z {
constructor(e, r = U.operators, s, i) {
this.input = e, this.file = s, this.rawBeginAt = -1, this.p = i ? i[0] : 0, this.N = i ? i[1] : e.length, this.opTrie = Ee(r), this.literalTrie = Ee(Ke);
}
readExpression() {
return new gr(this.readExpressionTokens());
}
*readExpressionTokens() {
for (; this.p < this.N; ) {
const e = this.readOperator();
if (e) {
yield e;
continue;
}
const r = this.readValue();
if (r) {
yield r;
continue;
}
return;
}
}
readOperator() {
this.skipBlank();
const e = this.matchTrie(this.opTrie);
if (e !== -1)
return new tr(this.input, this.p, this.p = e, this.file);
}
matchTrie(e) {
let r = e, s = this.p, i;
for (; r[this.input[s]] && s < this.N; )
r = r[this.input[s++]], r.end && (i = r);
return !i || i.needBoundary && Q(this.peek(s - this.p)) ? -1 : s;
}
readFilteredValue() {
const e = this.p, r = this.readExpression();
this.assert(r.valid(), `invalid value expression: ${this.snapshot()}`);
const s = this.readFilters();
return new ur(r, s, this.input, e, this.p, this.file);
}
readFilters() {
const e = [];
for (; ; ) {
const r = this.readFilter();
if (!r)
return e;
e.push(r);
}
}
readFilter() {
if (this.skipBlank(), this.end())
return null;
this.assert(this.peek() === "|", 'expected "|" before filter'), this.p++;
const e = this.p, r = this.readIdentifier();
if (!r.size())
return this.assert(this.end(), "expected filter name"), null;
const s = [];
if (this.skipBlank(), this.peek() === ":")
do {
++this.p;
const i = this.readFilterArg();
i && s.push(i), this.skipBlank(), this.assert(this.end() || this.peek() === "," || this.peek() === "|", () => `unexpected character ${this.snapshot()}`);
} while (this.peek() === ",");
else if (!(this.peek() === "|" || this.end())) throw this.error('expected ":" after filter name');
return new rr(r.getText(), s, this.input, e, this.p, this.file);
}
readFilterArg() {
const e = this.readValue();
if (!e)
return;
if (this.skipBlank(), this.peek() !== ":")
return e;
++this.p;
const r = this.readValue();
return [e.getText(), r];
}
readTopLevelTokens(e = U) {
const r = [];
for (; this.p < this.N; ) {
const s = this.readTopLevelToken(e);
r.push(s);
}
return Ur(r, e), r;
}
readTopLevelToken(e) {
const { tagDelimiterLeft: r, outputDelimiterLeft: s } = e;
return this.rawBeginAt > -1 ? this.readEndrawOrRawContent(e) : this.match(r) ? this.readTagToken(e) : this.match(s) ? this.readOutputToken(e) : this.readHTMLToken([r, s]);
}
readHTMLToken(e) {
const r = this.p;
for (; this.p < this.N && !e.some((s) => this.match(s)); )
++this.p;
return new qe(this.input, r, this.p, this.file);
}
readTagToken(e) {
const { file: r, input: s } = this, i = this.p;
if (this.readToDelimiter(e.tagDelimiterRight) === -1)
throw this.error(`tag ${this.snapshot(i)} not closed`, i);
const n = new De(s, i, this.p, e, r);
return n.name === "raw" && (this.rawBeginAt = i), n;
}
readToDelimiter(e, r = !1) {
for (this.skipBlank(); this.p < this.N; ) {
if (r && this.peekType() & Fe) {
this.readQuoted();
continue;
}
if (++this.p, this.rmatch(e))
return this.p;
}
return -1;
}
readOutputToken(e = U) {
const { file: r, input: s } = this, { outputDelimiterRight: i } = e, n = this.p;
if (this.readToDelimiter(i, !0) === -1)
throw this.error(`output ${this.snapshot(n)} not closed`, n);
return new Gt(s, n, this.p, e, r);
}
readEndrawOrRawContent(e) {
const { tagDelimiterLeft: r, tagDelimiterRight: s } = e, i = this.p;
let n = this.readTo(r) - r.length;
for (; this.p < this.N; ) {
if (this.readIdentifier().getText() !== "endraw") {
n = this.readTo(r) - r.length;
continue;
}
for (; this.p <= this.N; ) {
if (this.rmatch(s)) {
const o = this.p;
return i === n ? (this.rawBeginAt = -1, new De(this.input, i, o, e, this.file)) : (this.p = n, new qe(this.input, i, n, this.file));
}
if (this.rmatch(r))
break;
this.p++;
}
}
throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`, i);
}
readLiquidTagTokens(e = U) {
const r = [];
for (; this.p < this.N; ) {
const s = this.readLiquidTagToken(e);
s && r.push(s);
}
return r;
}
readLiquidTagToken(e) {
if (this.skipBlank(), this.end())
return;
const r = this.p;
this.readToDelimiter(`
`);
const s = this.p;
return new lr(this.input, r, s, e, this.file);
}
error(e, r = this.p) {
return new Lt(e, new ne(this.input, r, this.N, this.file));
}
assert(e, r, s) {
if (!e)
throw this.error(typeof r == "function" ? r() : r, s);
}
snapshot(e = this.p) {
return JSON.stringify(vt(this.input.slice(e, this.N), 32));
}
/**
* @deprecated use #readIdentifier instead
*/
readWord() {
return this.readIdentifier();
}
readIdentifier() {
this.skipBlank();
const e = this.p;
for (; !this.end() && Q(this.peek()); )
++this.p;
return new ne(this.input, e, this.p, this.file);
}
readNonEmptyIdentifier() {
const e = this.readIdentifier();
return e.size() ? e : void 0;
}
readTagName() {
return this.skipBlank(), this.input[this.p] === "#" ? this.input.slice(this.p, ++this.p) : this.readIdentifier().getText();
}
readHashes(e) {
const r = [];
for (; ; ) {
const s = this.readHash(e);
if (!s)
return r;
r.push(s);
}
}
readHash(e) {
this.skipBlank(), this.peek() === "," && ++this.p;
const r = this.p, s = this.readNonEmptyIdentifier();
if (!s)
return;
let i;
this.skipBlank();
const n = _(e) ? e : e ? "=" : ":";
return this.peek() === n && (++this.p, i = this.readValue()), new sr(this.input, r, this.p, s, i, this.file);
}
remaining() {
return this.input.slice(this.p, this.N);
}
advance(e = 1) {
this.p += e;
}
end() {
return this.p >= this.N;
}
readTo(e) {
for (; this.p < this.N; )
if (++this.p, this.rmatch(e))
return this.p;
return -1;
}
readValue() {
this.skipBlank();
const e = this.p, r = this.readLiteral() || this.readQuoted() || this.readRange() || this.readNumber(), s = this.readProperties(!r);
return s.length ? new Ie(r, s, this.input, e, this.p) : r;
}
readScopeValue() {
this.skipBlank();
const e = this.p, r = this.readProperties();
if (r.length)
return new Ie(void 0, r, this.input, e, this.p);
}
readProperties(e = !0) {
const r = [];
for (; ; ) {
if (this.peek() === "[") {
this.p++;
const s = this.readValue() || new ne(this.input, this.p, this.p, this.file);
this.assert(this.readTo("]") !== -1, "[ not closed"), r.push(s);
continue;
}
if (e && !r.length) {
const s = this.readNonEmptyIdentifier();
if (s) {
r.push(s);
continue;
}
}
if (this.peek() === "." && this.peek(1) !== ".") {
this.p++;
const s = this.readNonEmptyIdentifier();
if (!s)
break;
r.push(s);
continue;
}
break;
}
return r;
}
readNumber() {
this.skipBlank();
let e = !1, r = !1, s = 0;
for (this.peekType() & Mt && s++; this.p + s <= this.N; )
if (this.peekType(s) & qt)
r = !0, s++;
else if (this.peek(s) === "." && this.peek(s + 1) !== ".") {
if (e || !r)
return;
e = !0, s++;
} else
break;
if (r && !Q(this.peek(s))) {
const i = new Xt(this.input, this.p, this.p + s, this.file);
return this.advance(s), i;
}
}
readLiteral() {
this.skipBlank();
const e = this.matchTrie(this.literalTrie);
if (e === -1)
return;
const r = new Kt(this.input, this.p, e, this.file);
return this.p = e, r;
}
readRange() {
this.skipBlank();
const e = this.p;
if (this.peek() !== "(")
return;
++this.p;
const r = this.readValueOrThrow();
this.p += 2;
const s = this.readValueOrThrow();
return ++this.p, new ar(this.input, e, this.p, r, s, this.file);
}
readValueOrThrow() {
const e = this.readValue();
return this.assert(e, () => `unexpected token ${this.snapshot()}, value expected`), e;
}
readQuoted() {
this.skipBlank();
const e = this.p;
if (!(this.peekType() & Fe))
return;
++this.p;
let r = !1;
for (; this.p < this.N && (++this.p, !(this.input[this.p - 1] === this.input[e] && !r)); )
r ? r = !1 : this.input[this.p - 1] === "\\" && (r = !0);
return new or(this.input, e, this.p, this.file);
}
*readFileNameTemplate(e) {
const { outputDelimiterLeft: r } = e, s = [",", " ", r], i = new Set(s);
for (; this.p < this.N && !i.has(this.peek()); )
yield this.match(r) ? this.readOutputToken(e) : this.readHTMLToken(s);
}
match(e) {
for (let r = 0; r < e.length; r++)
if (e[r] !== this.input[this.p + r])
return !1;
return !0;
}
rmatch(e) {
for (let r = 0; r < e.length; r++)
if (e[e.length - 1 - r] !== this.input[this.p - 1 - r])
return !1;
return !0;
}
peekType(e = 0) {
return this.p + e >= this.N ? 0 : p[this.input.charCodeAt(this.p + e)];
}
peek(e = 0) {
return this.p + e >= this.N ? "" : this.input[this.p + e];
}
skipBlank() {
for (; this.peekType() & H; )
++this.p;
}
}
class Yr {
constructor(e, r) {
this.handlers = {}, this.stopRequested = !1, this.tokens = e, this.parseToken = r;
}
on(e, r) {
return this.handlers[e] = r, this;
}
trigger(e, r) {
const s = this.handlers[e];
return s ? (s.call(this, r), !0) : !1;
}
start() {
this.trigger("start");
let e;
for (; !this.stopRequested && (e = this.tokens.shift()); ) {
if (this.trigger("token", e) || j(e) && this.trigger(`tag:${e.name}`, e))
continue;
const r = this.parseToken(e, this.tokens);
this.trigger("template", r);
}
return this.stopRequested || this.trigger("end"), this;
}
stop() {
return this.stopRequested = !0, this;
}
}
class me {
constructor(e) {
this.token = e;
}
}
class m extends me {
constructor(e, r, s) {
super(e), this.name = e.name, this.liquid = s, this.tokenizer = e.tokenizer;
}
}
class W {
constructor(e, r) {
this.hash = {};
const s = new z(e, {});
for (const i of s.readHashes(r))
this.hash[i.name.content] = i.value;
}
*render(e) {
const r = {};
for (const s of Object.keys(this.hash))
r[s] = this.hash[s] === void 0 ? !0 : yield y(this.hash[s], e);
return r;
}
}
function Jr(t) {
return class extends m {
constructor(e, r, s) {
super(e, r, s), w(t.parse) && t.parse.call(this, e, r);
}
*render(e, r) {
const s = yield new W(this.token.args, e.opts.keyValueSeparator).render(e);
return yield t.render.call(this, e, r, s);
}
};
}
function Qr(t) {
return b(t);
}
class lt {
constructor(e, r, s, i) {
this.name = e, this.handler = w(r) ? r : w(r?.handler) ? r.handler : Ze, this.raw = !w(r) && !!r?.raw, this.args = s, this.liquid = i;
}
*render(e, r) {
const s = [];
for (const i of this.args)
Qr(i) ? s.push([i[0], yield y(i[1], r)]) : s.push(yield y(i, r));
return yield this.handler.apply({ context: r, liquid: this.liquid }, [e, ...s]);
}
}
class L {
/**
* @param str the value to be valuated, eg.: "foobar" | truncate: 3
*/
constructor(e, r) {
this.filters = [];
const s = typeof e == "string" ? new z(e, r.options.operators).readFilteredValue() : e;
this.initial = s.initial, this.filters = s.filters.map(({ name: i, args: n }) => new lt(i, this.getFilter(r, i), n, r));
}
*value(e, r) {
r = r || e.opts.lenientIf && this.filters.length > 0 && this.filters[0].name === "default";
let s = yield this.initial.evaluate(e, r);
for (const i of this.filters)
s = yield i.render(s, e);
return s;
}
getFilter(e, r) {
const s = e.filters[r];
return k(s || !e.options.strictFilters, () => `undefined filter: ${r}`), s;
}
}
class Zr extends me {
constructor(e, r) {
var s;
super(e);
const i = new z(e.input, r.options.operators, e.file, e.contentRange);
this.value = new L(i.readFilteredValue(), r);
const n = this.value.filters, o = r.options.outputEscape;
!(!((s = n[n.length - 1]) === null || s === void 0) && s.raw) && o && n.push(new lt(toString.call(o), o, [], r));
}
*render(e, r) {
const s = yield this.value.value(e, !1);
r.write(s);
}
}
class Gr extends me {
constructor(e) {
super(e), this.str = e.getContent();
}
*render(e, r) {
r.write(this.str);
}
}
var A;
(function(t) {
t.Partials = "partials", t.Layouts = "layouts", t.Root = "root";
})(A || (A = {}));
class Xr {
constructor(e) {
if (this.options = e, e.relativeReference) {
const r = e.fs.sep;
k(r, "`fs.sep` is required for relative reference");
const s = new RegExp(["." + r, ".." + r, "./", "../"].map((i) => Tt(i)).join("|"));
this.shouldLoadRelative = (i) => s.test(i);
} else
this.shouldLoadRelative = (r) => !1;
this.contains = this.options.fs.contains || (() => !0);
}
*lookup(e, r, s, i) {
const { fs: n } = this.options, o = this.options[r];
for (const a of this.candidates(e, o, i, r !== A.Root))
if (s ? n.existsSync(a) : yield n.exists(a))
return a;
throw this.lookupError(e, o);
}
*candidates(e, r, s, i) {
const { fs: n, extname: o } = this.options;
if (this.shouldLoadRelative(e) && s) {
const a = n.resolve(this.dirname(s), e, o);
for (const u of r)
if (!i || this.contains(u, a)) {
yield a;
break;
}
}
for (const a of r) {