ranui
Version:
A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.
1,620 lines (1,619 loc) • 62 kB
JavaScript
import { n as w } from "./chunk-Y2CYZVJY-0JxdZxki.js";
import { p as ot } from "./src-DtRLxcYO.js";
import { H as Wt, K as Ht, U as Yt, a as Xt, b as _t, c as Zt, et as Jt, f as Qt, nt as $t, rt as te, tt as ee, v as ne, w as se, y as ie } from "./chunk-WYO6CB5R-DDHkKowO.js";
import { i as re } from "./chunk-ICXQ74PX-DR8rL-xF.js";
import { t as oe } from "./chunk-VAUOI2AC-izt0o4id.js";
import { t as ae } from "./rough.esm-BWe9E0Nz.js";
var Mt = (t, n) => $t(t, "a", -n), Tt = 1e-10;
function st(t, n) {
const s = ce(t), e = s.filter((c) => le(c, t));
let i = 0, r = 0;
const a = [];
if (e.length > 1) {
const c = zt(e);
for (let l = 0; l < e.length; ++l) {
const u = e[l];
u.angle = Math.atan2(u.x - c.x, u.y - c.y);
}
e.sort((l, u) => u.angle - l.angle);
let f = e[e.length - 1];
for (let l = 0; l < e.length; ++l) {
const u = e[l];
r += (f.x + u.x) * (u.y - f.y);
const d = {
x: (u.x + f.x) / 2,
y: (u.y + f.y) / 2
};
let h = null;
for (let b = 0; b < u.parentIndex.length; ++b) if (f.parentIndex.includes(u.parentIndex[b])) {
const y = t[u.parentIndex[b]], S = Math.atan2(u.x - y.x, u.y - y.y), T = Math.atan2(f.x - y.x, f.y - y.y);
let m = T - S;
m < 0 && (m += 2 * Math.PI);
const g = T - m / 2;
let v = U(d, {
x: y.x + y.radius * Math.sin(g),
y: y.y + y.radius * Math.cos(g)
});
v > y.radius * 2 && (v = y.radius * 2), (h == null || h.width > v) && (h = {
circle: y,
width: v,
p1: u,
p2: f,
large: v > y.radius,
sweep: !0
});
}
h != null && (a.push(h), i += ct(h.circle.radius, h.width), f = u);
}
} else {
let c = t[0];
for (let l = 1; l < t.length; ++l) t[l].radius < c.radius && (c = t[l]);
let f = !1;
for (let l = 0; l < t.length; ++l) if (U(t[l], c) > Math.abs(c.radius - t[l].radius)) {
f = !0;
break;
}
f ? i = r = 0 : (i = c.radius * c.radius * Math.PI, a.push({
circle: c,
p1: {
x: c.x,
y: c.y + c.radius
},
p2: {
x: c.x - Tt,
y: c.y + c.radius
},
width: c.radius * 2,
large: !0,
sweep: !0
}));
}
return r /= 2, n && (n.area = i + r, n.arcArea = i, n.polygonArea = r, n.arcs = a, n.innerPoints = e, n.intersectionPoints = s), i + r;
}
function le(t, n) {
return n.every((s) => U(t, s) < s.radius + Tt);
}
function ce(t) {
const n = [];
for (let s = 0; s < t.length; ++s) for (let e = s + 1; e < t.length; ++e) {
const i = Et(t[s], t[e]);
for (const r of i)
r.parentIndex = [s, e], n.push(r);
}
return n;
}
function ct(t, n) {
return t * t * Math.acos(1 - n / t) - (t - n) * Math.sqrt(n * (2 * t - n));
}
function U(t, n) {
return Math.sqrt((t.x - n.x) * (t.x - n.x) + (t.y - n.y) * (t.y - n.y));
}
function xt(t, n, s) {
if (s >= t + n) return 0;
if (s <= Math.abs(t - n)) return Math.PI * Math.min(t, n) * Math.min(t, n);
const e = t - (s * s - n * n + t * t) / (2 * s), i = n - (s * s - t * t + n * n) / (2 * s);
return ct(t, e) + ct(n, i);
}
function Et(t, n) {
const s = U(t, n), e = t.radius, i = n.radius;
if (s >= e + i || s <= Math.abs(e - i)) return [];
const r = (e * e - i * i + s * s) / (2 * s), a = Math.sqrt(e * e - r * r), c = t.x + r * (n.x - t.x) / s, f = t.y + r * (n.y - t.y) / s, l = -(n.y - t.y) * (a / s), u = -(n.x - t.x) * (a / s);
return [{
x: c + l,
y: f - u
}, {
x: c - l,
y: f + u
}];
}
function zt(t) {
const n = {
x: 0,
y: 0
};
for (const s of t)
n.x += s.x, n.y += s.y;
return n.x /= t.length, n.y /= t.length, n;
}
function ue(t, n, s, e) {
e = e || {};
const i = e.maxIterations || 100, r = e.tolerance || 1e-10, a = t(n), c = t(s);
let f = s - n;
if (a * c > 0) throw "Initial bisect points must have opposite signs";
if (a === 0) return n;
if (c === 0) return s;
for (let l = 0; l < i; ++l) {
f /= 2;
const u = n + f, d = t(u);
if (d * a >= 0 && (n = u), Math.abs(f) < r || d === 0) return u;
}
return n + f;
}
function ut(t) {
const n = new Array(t);
for (let s = 0; s < t; ++s) n[s] = 0;
return n;
}
function St(t, n) {
return ut(t).map(() => ut(n));
}
function $(t, n) {
let s = 0;
for (let e = 0; e < t.length; ++e) s += t[e] * n[e];
return s;
}
function ft(t) {
return Math.sqrt($(t, t));
}
function ht(t, n, s) {
for (let e = 0; e < n.length; ++e) t[e] = n[e] * s;
}
function X(t, n, s, e, i) {
for (let r = 0; r < t.length; ++r) t[r] = n * s[r] + e * i[r];
}
function At(t, n, s) {
s = s || {};
const e = s.maxIterations || n.length * 200, i = s.nonZeroDelta || 1.05, r = s.zeroDelta || 1e-3, a = s.minErrorDelta || 1e-6, c = s.minErrorDelta || 1e-5, f = s.rho !== void 0 ? s.rho : 1, l = s.chi !== void 0 ? s.chi : 2, u = s.psi !== void 0 ? s.psi : -0.5, d = s.sigma !== void 0 ? s.sigma : 0.5;
let h;
const b = n.length, y = new Array(b + 1);
y[0] = n, y[0].fx = t(n), y[0].id = 0;
for (let p = 0; p < b; ++p) {
const x = n.slice();
x[p] = x[p] ? x[p] * i : r, y[p + 1] = x, y[p + 1].fx = t(x), y[p + 1].id = p + 1;
}
function S(p) {
for (let x = 0; x < p.length; x++) y[b][x] = p[x];
y[b].fx = p.fx;
}
const T = (p, x) => p.fx - x.fx, m = n.slice(), g = n.slice(), v = n.slice(), k = n.slice();
for (let p = 0; p < e; ++p) {
if (y.sort(T), s.history) {
const o = y.map((_) => {
const I = _.slice();
return I.fx = _.fx, I.id = _.id, I;
});
o.sort((_, I) => _.id - I.id), s.history.push({
x: y[0].slice(),
fx: y[0].fx,
simplex: o
});
}
h = 0;
for (let o = 0; o < b; ++o) h = Math.max(h, Math.abs(y[0][o] - y[1][o]));
if (Math.abs(y[0].fx - y[b].fx) < a && h < c) break;
for (let o = 0; o < b; ++o) {
m[o] = 0;
for (let _ = 0; _ < b; ++_) m[o] += y[_][o];
m[o] /= b;
}
const x = y[b];
if (X(g, 1 + f, m, -f, x), g.fx = t(g), g.fx < y[0].fx)
X(k, 1 + l, m, -l, x), k.fx = t(k), k.fx < g.fx ? S(k) : S(g);
else if (g.fx >= y[b - 1].fx) {
let o = !1;
if (g.fx > x.fx ? (X(v, 1 + u, m, -u, x), v.fx = t(v), v.fx < x.fx ? S(v) : o = !0) : (X(v, 1 - u * f, m, u * f, x), v.fx = t(v), v.fx < g.fx ? S(v) : o = !0), o) {
if (d >= 1) break;
for (let _ = 1; _ < y.length; ++_)
X(y[_], 1 - d, y[0], d, y[_]), y[_].fx = t(y[_]);
}
} else S(g);
}
return y.sort(T), {
fx: y[0].fx,
x: y[0]
};
}
function fe(t, n, s, e, i, r, a) {
const c = s.fx, f = $(s.fxprime, n);
let l = c, u = c, d = f, h = 0;
i = i || 1, r = r || 1e-6, a = a || 0.1;
function b(y, S, T) {
for (let m = 0; m < 16; ++m)
if (i = (y + S) / 2, X(e.x, 1, s.x, i, n), l = e.fx = t(e.x, e.fxprime), d = $(e.fxprime, n), l > c + r * i * f || l >= T) S = i;
else {
if (Math.abs(d) <= -a * f) return i;
d * (S - y) >= 0 && (S = y), y = i, T = l;
}
return 0;
}
for (let y = 0; y < 10; ++y) {
if (X(e.x, 1, s.x, i, n), l = e.fx = t(e.x, e.fxprime), d = $(e.fxprime, n), l > c + r * i * f || y && l >= u) return b(h, i, u);
if (Math.abs(d) <= -a * f) return i;
if (d >= 0) return b(i, h, l);
u = l, h = i, i *= 2;
}
return i;
}
function he(t, n, s) {
let e = {
x: n.slice(),
fx: 0,
fxprime: n.slice()
}, i = {
x: n.slice(),
fx: 0,
fxprime: n.slice()
};
const r = n.slice();
let a, c, f = 1, l;
s = s || {}, l = s.maxIterations || n.length * 20, e.fx = t(e.x, e.fxprime), a = e.fxprime.slice(), ht(a, e.fxprime, -1);
for (let u = 0; u < l; ++u) {
if (f = fe(t, a, e, i, f), s.history && s.history.push({
x: e.x.slice(),
fx: e.fx,
fxprime: e.fxprime.slice(),
alpha: f
}), !f) ht(a, e.fxprime, -1);
else {
X(r, 1, i.fxprime, -1, e.fxprime);
const d = $(e.fxprime, e.fxprime), h = Math.max(0, $(r, i.fxprime) / d);
X(a, h, a, -1, i.fxprime), c = e, e = i, i = c;
}
if (ft(e.fxprime) <= 1e-5) break;
}
return s.history && s.history.push({
x: e.x.slice(),
fx: e.fx,
fxprime: e.fxprime.slice(),
alpha: f
}), e;
}
function Dt(t, n = {}) {
n.maxIterations = n.maxIterations || 500;
const s = n.initialLayout || xe, e = n.lossFunction || tt, i = de(t, n), r = s(i, n), a = Object.keys(r), c = [];
for (const l of a)
c.push(r[l].x), c.push(r[l].y);
const f = At((l) => {
const u = {};
for (let d = 0; d < a.length; ++d) {
const h = a[d];
u[h] = {
x: l[2 * d],
y: l[2 * d + 1],
radius: r[h].radius
};
}
return e(u, i);
}, c, n).x;
for (let l = 0; l < a.length; ++l) {
const u = a[l];
r[u].x = f[2 * l], r[u].y = f[2 * l + 1];
}
return r;
}
var Ct = 1e-10;
function dt(t, n, s) {
return Math.min(t, n) * Math.min(t, n) * Math.PI <= s + Ct ? Math.abs(t - n) : ue((e) => xt(t, n, e) - s, 0, t + n);
}
function de(t, n = {}) {
const s = n.distinct, e = t.map((c) => Object.assign({}, c));
function i(c) {
return c.join(";");
}
if (s) {
const c = /* @__PURE__ */ new Map();
for (const f of e) for (let l = 0; l < f.sets.length; l++) {
const u = String(f.sets[l]);
c.set(u, f.size + (c.get(u) || 0));
for (let d = l + 1; d < f.sets.length; d++) {
const h = String(f.sets[d]), b = `${u};${h}`, y = `${h};${u}`;
c.set(b, f.size + (c.get(b) || 0)), c.set(y, f.size + (c.get(y) || 0));
}
}
for (const f of e) f.sets.length < 3 && (f.size = c.get(i(f.sets)));
}
const r = [], a = /* @__PURE__ */ new Set();
for (const c of e) if (c.sets.length === 1) r.push(c.sets[0]);
else if (c.sets.length === 2) {
const f = c.sets[0], l = c.sets[1];
a.add(i(c.sets)), a.add(i([l, f]));
}
r.sort((c, f) => c === f ? 0 : c < f ? -1 : 1);
for (let c = 0; c < r.length; ++c) {
const f = r[c];
for (let l = c + 1; l < r.length; ++l) {
const u = r[l];
a.has(i([f, u])) || e.push({
sets: [f, u],
size: 0
});
}
}
return e;
}
function ge(t, n, s) {
const e = St(n.length, n.length), i = St(n.length, n.length);
return t.filter((r) => r.sets.length === 2).forEach((r) => {
const a = s[r.sets[0]], c = s[r.sets[1]], f = dt(Math.sqrt(n[a].size / Math.PI), Math.sqrt(n[c].size / Math.PI), r.size);
e[a][c] = e[c][a] = f;
let l = 0;
r.size + 1e-10 >= Math.min(n[a].size, n[c].size) ? l = 1 : r.size <= 1e-10 && (l = -1), i[a][c] = i[c][a] = l;
}), {
distances: e,
constraints: i
};
}
function ye(t, n, s, e) {
for (let r = 0; r < n.length; ++r) n[r] = 0;
let i = 0;
for (let r = 0; r < s.length; ++r) {
const a = t[2 * r], c = t[2 * r + 1];
for (let f = r + 1; f < s.length; ++f) {
const l = t[2 * f], u = t[2 * f + 1], d = s[r][f], h = e[r][f], b = (l - a) * (l - a) + (u - c) * (u - c), y = Math.sqrt(b), S = b - d * d;
h > 0 && y <= d || h < 0 && y >= d || (i += 2 * S * S, n[2 * r] += 4 * S * (a - l), n[2 * r + 1] += 4 * S * (c - u), n[2 * f] += 4 * S * (l - a), n[2 * f + 1] += 4 * S * (u - c));
}
}
return i;
}
function xe(t, n = {}) {
let s = me(t, n);
const e = n.lossFunction || tt;
if (t.length >= 8) {
const i = pe(t, n), r = e(i, t), a = e(s, t);
r + 1e-8 < a && (s = i);
}
return s;
}
function pe(t, n = {}) {
const s = n.restarts || 10, e = [], i = {};
for (const h of t) h.sets.length === 1 && (i[h.sets[0]] = e.length, e.push(h));
let { distances: r, constraints: a } = ge(t, e, i);
const c = ft(r.map(ft)) / r.length;
r = r.map((h) => h.map((b) => b / c));
const f = (h, b) => ye(h, b, r, a);
let l = null;
for (let h = 0; h < s; ++h) {
const b = he(f, ut(r.length * 2).map(Math.random), n);
(!l || b.fx < l.fx) && (l = b);
}
const u = l.x, d = {};
for (let h = 0; h < e.length; ++h) {
const b = e[h];
d[b.sets[0]] = {
x: u[2 * h] * c,
y: u[2 * h + 1] * c,
radius: Math.sqrt(b.size / Math.PI)
};
}
if (n.history) for (const h of n.history) ht(h.x, c);
return d;
}
function me(t, n) {
const s = n && n.lossFunction ? n.lossFunction : tt, e = {}, i = {};
for (const d of t) if (d.sets.length === 1) {
const h = d.sets[0];
e[h] = {
x: 1e10,
y: 1e10,
rowid: e.length,
size: d.size,
radius: Math.sqrt(d.size / Math.PI)
}, i[h] = [];
}
t = t.filter((d) => d.sets.length === 2);
for (const d of t) {
let h = d.weight != null ? d.weight : 1;
const b = d.sets[0], y = d.sets[1];
d.size + Ct >= Math.min(e[b].size, e[y].size) && (h = 0), i[b].push({
set: y,
size: d.size,
weight: h
}), i[y].push({
set: b,
size: d.size,
weight: h
});
}
const r = [];
Object.keys(i).forEach((d) => {
let h = 0;
for (let b = 0; b < i[d].length; ++b) h += i[d][b].size * i[d][b].weight;
r.push({
set: d,
size: h
});
});
function a(d, h) {
return h.size - d.size;
}
r.sort(a);
const c = {};
function f(d) {
return d.set in c;
}
function l(d, h) {
e[h].x = d.x, e[h].y = d.y, c[h] = !0;
}
l({
x: 0,
y: 0
}, r[0].set);
for (let d = 1; d < r.length; ++d) {
const h = r[d].set, b = i[h].filter(f), y = e[h];
if (b.sort(a), b.length === 0) throw "ERROR: missing pairwise overlap information";
const S = [];
for (var u = 0; u < b.length; ++u) {
const g = e[b[u].set], v = dt(y.radius, g.radius, b[u].size);
S.push({
x: g.x + v,
y: g.y
}), S.push({
x: g.x - v,
y: g.y
}), S.push({
y: g.y + v,
x: g.x
}), S.push({
y: g.y - v,
x: g.x
});
for (let k = u + 1; k < b.length; ++k) {
const p = e[b[k].set], x = dt(y.radius, p.radius, b[k].size), o = Et({
x: g.x,
y: g.y,
radius: v
}, {
x: p.x,
y: p.y,
radius: x
});
S.push(...o);
}
}
let T = 1e50, m = S[0];
for (const g of S) {
e[h].x = g.x, e[h].y = g.y;
const v = s(e, t);
v < T && (T = v, m = g);
}
l(m, h);
}
return e;
}
function tt(t, n) {
let s = 0;
for (const e of n) {
if (e.sets.length === 1) continue;
let i;
if (e.sets.length === 2) {
const a = t[e.sets[0]], c = t[e.sets[1]];
i = xt(a.radius, c.radius, U(a, c));
} else i = st(e.sets.map((a) => t[a]));
const r = e.weight != null ? e.weight : 1;
s += r * (i - e.size) * (i - e.size);
}
return s;
}
function Rt(t, n) {
let s = 0;
for (const e of n) {
if (e.sets.length === 1) continue;
let i;
if (e.sets.length === 2) {
const c = t[e.sets[0]], f = t[e.sets[1]];
i = xt(c.radius, f.radius, U(c, f));
} else i = st(e.sets.map((c) => t[c]));
const r = e.weight != null ? e.weight : 1, a = Math.log((i + 1) / (e.size + 1));
s += r * a * a;
}
return s;
}
function be(t, n, s) {
if (s == null ? t.sort((i, r) => r.radius - i.radius) : t.sort(s), t.length > 0) {
const i = t[0].x, r = t[0].y;
for (const a of t)
a.x -= i, a.y -= r;
}
if (t.length === 2 && U(t[0], t[1]) < Math.abs(t[1].radius - t[0].radius) && (t[1].x = t[0].x + t[0].radius - t[1].radius - 1e-10, t[1].y = t[0].y), t.length > 1) {
const i = Math.atan2(t[1].x, t[1].y) - n, r = Math.cos(i), a = Math.sin(i);
for (const c of t) {
const f = c.x, l = c.y;
c.x = r * f - a * l, c.y = a * f + r * l;
}
}
if (t.length > 2) {
let i = Math.atan2(t[2].x, t[2].y) - n;
for (; i < 0; ) i += 2 * Math.PI;
for (; i > 2 * Math.PI; ) i -= 2 * Math.PI;
if (i > Math.PI) {
const r = t[1].y / (1e-10 + t[1].x);
for (const a of t) {
var e = (a.x + r * a.y) / (1 + r * r);
a.x = 2 * e - a.x, a.y = 2 * e * r - a.y;
}
}
}
}
function ve(t) {
t.forEach((i) => {
i.parent = i;
});
function n(i) {
return i.parent !== i && (i.parent = n(i.parent)), i.parent;
}
function s(i, r) {
const a = n(i);
a.parent = n(r);
}
for (let i = 0; i < t.length; ++i) for (let r = i + 1; r < t.length; ++r) {
const a = t[i].radius + t[r].radius;
U(t[i], t[r]) + 1e-10 < a && s(t[r], t[i]);
}
const e = /* @__PURE__ */ new Map();
for (let i = 0; i < t.length; ++i) {
const r = n(t[i]).parent.setid;
e.has(r) || e.set(r, []), e.get(r).push(t[i]);
}
return t.forEach((i) => {
delete i.parent;
}), Array.from(e.values());
}
function gt(t) {
const n = (s) => ({
max: t.reduce((e, i) => Math.max(e, i[s] + i.radius), Number.NEGATIVE_INFINITY),
min: t.reduce((e, i) => Math.min(e, i[s] - i.radius), Number.POSITIVE_INFINITY)
});
return {
xRange: n("x"),
yRange: n("y")
};
}
function Ot(t, n, s) {
n == null && (n = Math.PI / 2);
let e = Ft(t).map((l) => Object.assign({}, l));
const i = ve(e);
for (const l of i) {
be(l, n, s);
const u = gt(l);
l.size = (u.xRange.max - u.xRange.min) * (u.yRange.max - u.yRange.min), l.bounds = u;
}
i.sort((l, u) => u.size - l.size), e = i[0];
let r = e.bounds;
const a = (r.xRange.max - r.xRange.min) / 50;
function c(l, u, d) {
if (!l) return;
const h = l.bounds;
let b, y;
if (u) b = r.xRange.max - h.xRange.min + a;
else {
b = r.xRange.max - h.xRange.max;
const S = (h.xRange.max - h.xRange.min) / 2 - (r.xRange.max - r.xRange.min) / 2;
S < 0 && (b += S);
}
if (d) y = r.yRange.max - h.yRange.min + a;
else {
y = r.yRange.max - h.yRange.max;
const S = (h.yRange.max - h.yRange.min) / 2 - (r.yRange.max - r.yRange.min) / 2;
S < 0 && (y += S);
}
for (const S of l)
S.x += b, S.y += y, e.push(S);
}
let f = 1;
for (; f < i.length; )
c(i[f], !0, !1), c(i[f + 1], !1, !0), c(i[f + 2], !0, !0), f += 3, r = gt(e);
return jt(e);
}
function Nt(t, n, s, e, i) {
const r = Ft(t);
n -= 2 * e, s -= 2 * e;
const { xRange: a, yRange: c } = gt(r);
if (a.max === a.min || c.max === c.min) return t;
let f, l;
if (i) {
const b = Math.sqrt(i / Math.PI) * 2;
f = n / b, l = s / b;
} else
f = n / (a.max - a.min), l = s / (c.max - c.min);
const u = Math.min(l, f), d = (n - (a.max - a.min) * u) / 2, h = (s - (c.max - c.min) * u) / 2;
return jt(r.map((b) => ({
radius: u * b.radius,
x: e + d + (b.x - a.min) * u,
y: e + h + (b.y - c.min) * u,
setid: b.setid
})));
}
function jt(t) {
const n = {};
for (const s of t) n[s.setid] = s;
return n;
}
function Ft(t) {
return Object.keys(t).map((n) => Object.assign(t[n], { setid: n }));
}
function ke(t = {}) {
let n = !1, s = 600, e = 350, i = 15, r = 1e3, a = Math.PI / 2, c = !0, f = null, l = !0, u = !0, d = null, h = null, b = !1, y = null, S = t && t.symmetricalTextCentre ? t.symmetricalTextCentre : !1, T = {}, m = t && t.colourScheme ? t.colourScheme : t && t.colorScheme ? t.colorScheme : [
"#1f77b4",
"#ff7f0e",
"#2ca02c",
"#d62728",
"#9467bd",
"#8c564b",
"#e377c2",
"#7f7f7f",
"#bcbd22",
"#17becf"
], g = 0, v = function(o) {
if (o in T) return T[o];
var _ = T[o] = m[g];
return g += 1, g >= m.length && (g = 0), _;
}, k = Dt, p = tt;
function x(o) {
let _ = o.datum();
const I = /* @__PURE__ */ new Set();
_.forEach((M) => {
M.size == 0 && M.sets.length == 1 && I.add(M.sets[0]);
}), _ = _.filter((M) => !M.sets.some((O) => I.has(O)));
let z = {}, N = {};
if (_.length > 0) {
let M = k(_, {
lossFunction: p,
distinct: b
});
c && (M = Ot(M, a, h)), z = Nt(M, s, e, i, f), N = Lt(z, _, S);
}
const K = {};
_.forEach((M) => {
M.label && (K[M.sets] = M.label);
});
function B(M) {
if (M.sets in K) return K[M.sets];
if (M.sets.length == 1) return "" + M.sets[0];
}
o.selectAll("svg").data([z]).enter().append("svg");
const A = o.select("svg");
n ? A.attr("viewBox", `0 0 ${s} ${e}`) : A.attr("width", s).attr("height", e);
const C = {};
let E = !1;
A.selectAll(".venn-area path").each(function(M) {
const O = this.getAttribute("d");
M.sets.length == 1 && O && !b && (E = !0, C[M.sets[0]] = Se(O));
});
function j(M) {
return (O) => wt(M.sets.map((Q) => {
let V = C[Q], Z = z[Q];
return V || (V = {
x: s / 2,
y: e / 2,
radius: 1
}), Z || (Z = {
x: s / 2,
y: e / 2,
radius: 1
}), {
x: V.x * (1 - O) + Z.x * O,
y: V.y * (1 - O) + Z.y * O,
radius: V.radius * (1 - O) + Z.radius * O
};
}), y);
}
const R = A.selectAll(".venn-area").data(_, (M) => M.sets), F = R.enter().append("g").attr("class", (M) => `venn-area venn-${M.sets.length == 1 ? "circle" : "intersection"}${M.colour || M.color ? " venn-coloured" : ""}`).attr("data-venn-sets", (M) => M.sets.join("_")), W = F.append("path"), H = F.append("text").attr("class", "label").text((M) => B(M)).attr("text-anchor", "middle").attr("dy", ".35em").attr("x", s / 2).attr("y", e / 2);
u && (W.style("fill-opacity", "0").filter((M) => M.sets.length == 1).style("fill", (M) => M.colour ? M.colour : M.color ? M.color : v(M.sets)).style("fill-opacity", ".25"), H.style("fill", (M) => M.colour || M.color ? "#FFF" : t.textFill ? t.textFill : M.sets.length == 1 ? v(M.sets) : "#444"));
function Y(M) {
return typeof M.transition == "function" ? M.transition("venn").duration(r) : M;
}
let D = o;
E && typeof D.transition == "function" ? (D = Y(o), D.selectAll("path").attrTween("d", j)) : D.selectAll("path").attr("d", (M) => wt(M.sets.map((O) => z[O])), y);
const q = D.selectAll("text").filter((M) => M.sets in N).text((M) => B(M)).attr("x", (M) => Math.floor(N[M.sets].x)).attr("y", (M) => Math.floor(N[M.sets].y));
l && (E ? "on" in q ? q.on("end", at(z, B)) : q.each("end", at(z, B)) : q.each(at(z, B)));
const L = Y(R.exit()).remove();
typeof R.transition == "function" && L.selectAll("path").attrTween("d", j);
const P = L.selectAll("text").attr("x", s / 2).attr("y", e / 2);
return d !== null && (H.style("font-size", "0px"), q.style("font-size", d), P.style("font-size", "0px")), {
circles: z,
textCentres: N,
nodes: R,
enter: F,
update: D,
exit: L
};
}
return x.wrap = function(o) {
return arguments.length ? (l = o, x) : l;
}, x.useViewBox = function() {
return n = !0, x;
}, x.width = function(o) {
return arguments.length ? (s = o, x) : s;
}, x.height = function(o) {
return arguments.length ? (e = o, x) : e;
}, x.padding = function(o) {
return arguments.length ? (i = o, x) : i;
}, x.distinct = function(o) {
return arguments.length ? (b = o, x) : b;
}, x.colours = function(o) {
return arguments.length ? (v = o, x) : v;
}, x.colors = function(o) {
return arguments.length ? (v = o, x) : v;
}, x.fontSize = function(o) {
return arguments.length ? (d = o, x) : d;
}, x.round = function(o) {
return arguments.length ? (y = o, x) : y;
}, x.duration = function(o) {
return arguments.length ? (r = o, x) : r;
}, x.layoutFunction = function(o) {
return arguments.length ? (k = o, x) : k;
}, x.normalize = function(o) {
return arguments.length ? (c = o, x) : c;
}, x.scaleToFit = function(o) {
return arguments.length ? (f = o, x) : f;
}, x.styled = function(o) {
return arguments.length ? (u = o, x) : u;
}, x.orientation = function(o) {
return arguments.length ? (a = o, x) : a;
}, x.orientationOrder = function(o) {
return arguments.length ? (h = o, x) : h;
}, x.lossFunction = function(o) {
return arguments.length ? (p = o === "default" ? tt : o === "logRatio" ? Rt : o, x) : p;
}, x;
}
function at(t, n) {
return function(s) {
const e = this, i = t[s.sets[0]].radius || 50, r = n(s) || "", a = r.split(/\s+/).reverse(), c = (r.length + a.length) / 3;
let f = a.pop(), l = [f], u = 0;
const d = 1.1;
e.textContent = null;
const h = [];
function b(g) {
const v = e.ownerDocument.createElementNS(e.namespaceURI, "tspan");
return v.textContent = g, h.push(v), e.append(v), v;
}
let y = b(f);
for (; f = a.pop(), !!f; ) {
l.push(f);
const g = l.join(" ");
y.textContent = g, g.length > c && y.getComputedTextLength() > i && (l.pop(), y.textContent = l.join(" "), l = [f], y = b(f), u++);
}
const S = 0.35 - u * d / 2, T = e.getAttribute("x"), m = e.getAttribute("y");
h.forEach((g, v) => {
g.setAttribute("x", T), g.setAttribute("y", m), g.setAttribute("dy", `${S + v * d}em`);
});
};
}
function lt(t, n, s) {
let e = n[0].radius - U(n[0], t);
for (let i = 1; i < n.length; ++i) {
const r = n[i].radius - U(n[i], t);
r <= e && (e = r);
}
for (let i = 0; i < s.length; ++i) {
const r = U(s[i], t) - s[i].radius;
r <= e && (e = r);
}
return e;
}
function Pt(t, n, s) {
const e = [];
for (const u of t)
e.push({
x: u.x,
y: u.y
}), e.push({
x: u.x + u.radius / 2,
y: u.y
}), e.push({
x: u.x - u.radius / 2,
y: u.y
}), e.push({
x: u.x,
y: u.y + u.radius / 2
}), e.push({
x: u.x,
y: u.y - u.radius / 2
});
let i = e[0], r = lt(e[0], t, n);
for (let u = 1; u < e.length; ++u) {
const d = lt(e[u], t, n);
d >= r && (i = e[u], r = d);
}
const a = At((u) => -1 * lt({
x: u[0],
y: u[1]
}, t, n), [i.x, i.y], {
maxIterations: 500,
minErrorDelta: 1e-10
}).x, c = {
x: s ? 0 : a[0],
y: a[1]
};
let f = !0;
for (const u of t) if (U(c, u) > u.radius) {
f = !1;
break;
}
for (const u of n) if (U(c, u) < u.radius) {
f = !1;
break;
}
if (f) return c;
if (t.length == 1) return {
x: t[0].x,
y: t[0].y
};
const l = {};
return st(t, l), l.arcs.length === 0 ? {
x: 0,
y: -1e3,
disjoint: !0
} : l.arcs.length == 1 ? {
x: l.arcs[0].circle.x,
y: l.arcs[0].circle.y
} : n.length ? Pt(t, []) : zt(l.arcs.map((u) => u.p1));
}
function Ie(t) {
const n = {}, s = Object.keys(t);
for (const e of s) n[e] = [];
for (let e = 0; e < s.length; e++) {
const i = s[e], r = t[i];
for (let a = e + 1; a < s.length; ++a) {
const c = s[a], f = t[c], l = U(r, f);
l + f.radius <= r.radius + 1e-10 ? n[c].push(i) : l + r.radius <= f.radius + 1e-10 && n[i].push(c);
}
}
return n;
}
function Lt(t, n, s) {
const e = {}, i = Ie(t);
for (let r = 0; r < n.length; ++r) {
const a = n[r].sets, c = {}, f = {};
for (let h = 0; h < a.length; ++h) {
c[a[h]] = !0;
const b = i[a[h]];
for (let y = 0; y < b.length; ++y) f[b[y]] = !0;
}
const l = [], u = [];
for (let h in t) h in c ? l.push(t[h]) : h in f || u.push(t[h]);
const d = Pt(l, u, s);
e[a] = d, d.disjoint && n[r].size > 0 && "" + a;
}
return e;
}
function Me(t, n, s) {
const e = [];
return e.push(`
M`, t, n), e.push(`
m`, -s, 0), e.push(`
a`, s, s, 0, 1, 0, s * 2, 0), e.push(`
a`, s, s, 0, 1, 0, -s * 2, 0), e.join(" ");
}
function Se(t) {
const n = t.split(" ");
return {
x: Number.parseFloat(n[1]),
y: Number.parseFloat(n[2]),
radius: -Number.parseFloat(n[4])
};
}
function Vt(t) {
if (t.length === 0) return [];
const n = {};
return st(t, n), n.arcs;
}
function Bt(t, n) {
if (t.length === 0) return "M 0 0";
const s = Math.pow(10, n || 0), e = n != null ? (r) => Math.round(r * s) / s : (r) => r;
if (t.length == 1) {
const r = t[0].circle;
return Me(e(r.x), e(r.y), e(r.radius));
}
const i = [
`
M`,
e(t[0].p2.x),
e(t[0].p2.y)
];
for (const r of t) {
const a = e(r.circle.radius);
i.push(`
A`, a, a, 0, r.large ? 1 : 0, r.sweep ? 1 : 0, e(r.p1.x), e(r.p1.y));
}
return i.join(" ");
}
function wt(t, n) {
return Bt(Vt(t), n);
}
function we(t, n = {}) {
const { lossFunction: s, layoutFunction: e = Dt, normalize: i = !0, orientation: r = Math.PI / 2, orientationOrder: a, width: c = 600, height: f = 350, padding: l = 15, scaleToFit: u = !1, symmetricalTextCentre: d = !1, distinct: h, round: b = 2 } = n;
let y = e(t, {
lossFunction: s === "default" || !s ? tt : s === "logRatio" ? Rt : s,
distinct: h
});
i && (y = Ot(y, r, a));
const S = Nt(y, c, f, l, u), T = Lt(S, t, d), m = new Map(Object.keys(S).map((k) => [k, {
set: k,
x: S[k].x,
y: S[k].y,
radius: S[k].radius
}])), g = t.map((k) => {
const p = k.sets.map((o) => m.get(o)), x = Vt(p);
return {
circles: p,
arcs: x,
path: Bt(x, b),
area: k,
has: new Set(k.sets)
};
});
function v(k) {
let p = "";
for (const x of g) x.has.size > k.length && k.every((o) => x.has.has(o)) && (p += " " + x.path);
return p;
}
return g.map(({ circles: k, arcs: p, path: x, area: o }) => ({
data: o,
text: T[o.sets],
circles: k,
arcs: p,
path: x,
distinctPath: x + v(o.sets)
}));
}
var yt = (function() {
var t = /* @__PURE__ */ w(function(m, g, v, k) {
for (v = v || {}, k = m.length; k--; v[m[k]] = g) ;
return v;
}, "o"), n = [5, 8], s = [
7,
8,
11,
12,
17,
19,
22,
24
], e = [1, 17], i = [1, 18], r = [
7,
8,
11,
12,
14,
15,
16,
17,
19,
20,
21,
22,
24,
27
], a = [1, 31], c = [1, 39], f = [
7,
8,
11,
12,
17,
19,
22,
24,
27
], l = [1, 57], u = [1, 56], d = [1, 58], h = [1, 59], b = [1, 60], y = [
7,
8,
11,
12,
16,
17,
19,
20,
22,
24,
27,
31,
32,
33
], S = {
trace: /* @__PURE__ */ w(function() {
}, "trace"),
yy: {},
symbols_: {
error: 2,
start: 3,
optNewlines: 4,
VENN: 5,
document: 6,
EOF: 7,
NEWLINE: 8,
line: 9,
statement: 10,
TITLE: 11,
SET: 12,
identifier: 13,
BRACKET_LABEL: 14,
COLON: 15,
NUMERIC: 16,
UNION: 17,
identifierList: 18,
TEXT: 19,
IDENTIFIER: 20,
STRING: 21,
INDENT_TEXT: 22,
indentedTextTail: 23,
STYLE: 24,
stylesOpt: 25,
styleField: 26,
COMMA: 27,
styleValue: 28,
valueTokens: 29,
valueToken: 30,
HEXCOLOR: 31,
RGBCOLOR: 32,
RGBACOLOR: 33,
$accept: 0,
$end: 1
},
terminals_: {
2: "error",
5: "VENN",
7: "EOF",
8: "NEWLINE",
11: "TITLE",
12: "SET",
14: "BRACKET_LABEL",
15: "COLON",
16: "NUMERIC",
17: "UNION",
19: "TEXT",
20: "IDENTIFIER",
21: "STRING",
22: "INDENT_TEXT",
24: "STYLE",
27: "COMMA",
31: "HEXCOLOR",
32: "RGBCOLOR",
33: "RGBACOLOR"
},
productions_: [
0,
[3, 4],
[4, 0],
[4, 2],
[6, 0],
[6, 2],
[9, 1],
[9, 1],
[10, 1],
[10, 2],
[10, 3],
[10, 4],
[10, 5],
[10, 2],
[10, 3],
[10, 4],
[10, 5],
[10, 3],
[10, 3],
[10, 3],
[10, 4],
[10, 4],
[10, 2],
[10, 3],
[23, 1],
[23, 1],
[23, 1],
[23, 2],
[23, 2],
[25, 1],
[25, 3],
[26, 3],
[28, 1],
[28, 1],
[29, 1],
[29, 2],
[30, 1],
[30, 1],
[30, 1],
[30, 1],
[30, 1],
[18, 1],
[18, 3],
[13, 1],
[13, 1]
],
performAction: /* @__PURE__ */ w(function(g, v, k, p, x, o, _) {
var I = o.length - 1;
switch (x) {
case 1:
return o[I - 1];
case 2:
case 3:
case 4:
this.$ = [];
break;
case 5:
o[I - 1].push(o[I]), this.$ = o[I - 1];
break;
case 6:
this.$ = [];
break;
case 7:
case 22:
case 32:
case 36:
case 37:
case 38:
case 39:
case 40:
this.$ = o[I];
break;
case 8:
p.setDiagramTitle(o[I].substr(6)), this.$ = o[I].substr(6);
break;
case 9:
p.addSubsetData([o[I]], void 0, void 0), p.setIndentMode && p.setIndentMode(!0);
break;
case 10:
p.addSubsetData([o[I - 1]], o[I], void 0), p.setIndentMode && p.setIndentMode(!0);
break;
case 11:
p.addSubsetData([o[I - 2]], void 0, parseFloat(o[I])), p.setIndentMode && p.setIndentMode(!0);
break;
case 12:
p.addSubsetData([o[I - 3]], o[I - 2], parseFloat(o[I])), p.setIndentMode && p.setIndentMode(!0);
break;
case 13:
if (o[I].length < 2) throw new Error("union requires multiple identifiers");
p.validateUnionIdentifiers && p.validateUnionIdentifiers(o[I]), p.addSubsetData(o[I], void 0, void 0), p.setIndentMode && p.setIndentMode(!0);
break;
case 14:
if (o[I - 1].length < 2) throw new Error("union requires multiple identifiers");
p.validateUnionIdentifiers && p.validateUnionIdentifiers(o[I - 1]), p.addSubsetData(o[I - 1], o[I], void 0), p.setIndentMode && p.setIndentMode(!0);
break;
case 15:
if (o[I - 2].length < 2) throw new Error("union requires multiple identifiers");
p.validateUnionIdentifiers && p.validateUnionIdentifiers(o[I - 2]), p.addSubsetData(o[I - 2], void 0, parseFloat(o[I])), p.setIndentMode && p.setIndentMode(!0);
break;
case 16:
if (o[I - 3].length < 2) throw new Error("union requires multiple identifiers");
p.validateUnionIdentifiers && p.validateUnionIdentifiers(o[I - 3]), p.addSubsetData(o[I - 3], o[I - 2], parseFloat(o[I])), p.setIndentMode && p.setIndentMode(!0);
break;
case 17:
case 18:
case 19:
p.addTextData(o[I - 1], o[I], void 0);
break;
case 20:
case 21:
p.addTextData(o[I - 2], o[I - 1], o[I]);
break;
case 23:
p.addStyleData(o[I - 1], o[I]);
break;
case 24:
case 25:
case 26:
var z = p.getCurrentSets();
if (!z) throw new Error("text requires set");
p.addTextData(z, o[I], void 0);
break;
case 27:
case 28:
var z = p.getCurrentSets();
if (!z) throw new Error("text requires set");
p.addTextData(z, o[I - 1], o[I]);
break;
case 29:
case 41:
this.$ = [o[I]];
break;
case 30:
case 42:
this.$ = [...o[I - 2], o[I]];
break;
case 31:
this.$ = [o[I - 2], o[I]];
break;
case 33:
this.$ = o[I].join(" ");
break;
case 34:
this.$ = [o[I]];
break;
case 35:
o[I - 1].push(o[I]), this.$ = o[I - 1];
break;
case 43:
case 44:
this.$ = o[I];
break;
}
}, "anonymous"),
table: [
t(n, [2, 2], {
3: 1,
4: 2
}),
{ 1: [3] },
{
5: [1, 3],
8: [1, 4]
},
t(s, [2, 4], { 6: 5 }),
t(n, [2, 3]),
{
7: [1, 6],
8: [1, 8],
9: 7,
10: 9,
11: [1, 10],
12: [1, 11],
17: [1, 12],
19: [1, 13],
22: [1, 14],
24: [1, 15]
},
{ 1: [2, 1] },
t(s, [2, 5]),
t(s, [2, 6]),
t(s, [2, 7]),
t(s, [2, 8]),
{
13: 16,
20: e,
21: i
},
{
13: 20,
18: 19,
20: e,
21: i
},
{
13: 20,
18: 21,
20: e,
21: i
},
{
16: [1, 25],
20: [1, 23],
21: [1, 24],
23: 22
},
{
13: 20,
18: 26,
20: e,
21: i
},
t(s, [2, 9], {
14: [1, 27],
15: [1, 28]
}),
t(r, [2, 43]),
t(r, [2, 44]),
t(s, [2, 13], {
14: [1, 29],
15: [1, 30],
27: a
}),
t(r, [2, 41]),
{
16: [1, 34],
20: [1, 32],
21: [1, 33],
27: a
},
t(s, [2, 22]),
t(s, [2, 24], { 14: [1, 35] }),
t(s, [2, 25], { 14: [1, 36] }),
t(s, [2, 26]),
{
20: c,
25: 37,
26: 38,
27: a
},
t(s, [2, 10], { 15: [1, 40] }),
{ 16: [1, 41] },
t(s, [2, 14], { 15: [1, 42] }),
{ 16: [1, 43] },
{
13: 44,
20: e,
21: i
},
t(s, [2, 17], { 14: [1, 45] }),
t(s, [2, 18], { 14: [1, 46] }),
t(s, [2, 19]),
t(s, [2, 27]),
t(s, [2, 28]),
t(s, [2, 23], { 27: [1, 47] }),
t(f, [2, 29]),
{ 15: [1, 48] },
{ 16: [1, 49] },
t(s, [2, 11]),
{ 16: [1, 50] },
t(s, [2, 15]),
t(r, [2, 42]),
t(s, [2, 20]),
t(s, [2, 21]),
{
20: c,
26: 51
},
{
16: l,
20: u,
21: [1, 53],
28: 52,
29: 54,
30: 55,
31: d,
32: h,
33: b
},
t(s, [2, 12]),
t(s, [2, 16]),
t(f, [2, 30]),
t(f, [2, 31]),
t(f, [2, 32]),
t(f, [2, 33], {
30: 61,
16: l,
20: u,
31: d,
32: h,
33: b
}),
t(y, [2, 34]),
t(y, [2, 36]),
t(y, [2, 37]),
t(y, [2, 38]),
t(y, [2, 39]),
t(y, [2, 40]),
t(y, [2, 35])
],
defaultActions: { 6: [2, 1] },
parseError: /* @__PURE__ */ w(function(g, v) {
if (v.recoverable) this.trace(g);
else {
var k = new Error(g);
throw k.hash = v, k;
}
}, "parseError"),
parse: /* @__PURE__ */ w(function(g) {
var v = this, k = [0], p = [], x = [null], o = [], _ = this.table, I = "", z = 0, N = 0, K = 0, B = 2, A = 1, C = o.slice.call(arguments, 1), E = Object.create(this.lexer), j = { yy: {} };
for (var R in this.yy) Object.prototype.hasOwnProperty.call(this.yy, R) && (j.yy[R] = this.yy[R]);
E.setInput(g, j.yy), j.yy.lexer = E, j.yy.parser = this, typeof E.yylloc > "u" && (E.yylloc = {});
var F = E.yylloc;
o.push(F);
var W = E.options && E.options.ranges;
typeof j.yy.parseError == "function" ? this.parseError = j.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
function H(G) {
k.length = k.length - 2 * G, x.length = x.length - G, o.length = o.length - G;
}
w(H, "popStack");
function Y() {
var G = p.pop() || E.lex() || A;
return typeof G != "number" && (G instanceof Array && (p = G, G = p.pop()), G = v.symbols_[G] || G), G;
}
w(Y, "lex");
for (var D, q, L, P, M, O = {}, Q, V, Z, nt; ; ) {
if (L = k[k.length - 1], this.defaultActions[L] ? P = this.defaultActions[L] : ((D === null || typeof D > "u") && (D = Y()), P = _[L] && _[L][D]), typeof P > "u" || !P.length || !P[0]) {
var rt = "";
nt = [];
for (Q in _[L]) this.terminals_[Q] && Q > B && nt.push("'" + this.terminals_[Q] + "'");
E.showPosition ? rt = "Parse error on line " + (z + 1) + `:
` + E.showPosition() + `
Expecting ` + nt.join(", ") + ", got '" + (this.terminals_[D] || D) + "'" : rt = "Parse error on line " + (z + 1) + ": Unexpected " + (D == A ? "end of input" : "'" + (this.terminals_[D] || D) + "'"), this.parseError(rt, {
text: E.match,
token: this.terminals_[D] || D,
line: E.yylineno,
loc: F,
expected: nt
});
}
if (P[0] instanceof Array && P.length > 1) throw new Error("Parse Error: multiple actions possible at state: " + L + ", token: " + D);
switch (P[0]) {
case 1:
k.push(D), x.push(E.yytext), o.push(E.yylloc), k.push(P[1]), D = null, q ? (D = q, q = null) : (N = E.yyleng, I = E.yytext, z = E.yylineno, F = E.yylloc, K > 0 && K--);
break;
case 2:
if (V = this.productions_[P[1]][1], O.$ = x[x.length - V], O._$ = {
first_line: o[o.length - (V || 1)].first_line,
last_line: o[o.length - 1].last_line,
first_column: o[o.length - (V || 1)].first_column,
last_column: o[o.length - 1].last_column
}, W && (O._$.range = [o[o.length - (V || 1)].range[0], o[o.length - 1].range[1]]), M = this.performAction.apply(O, [
I,
N,
z,
j.yy,
P[1],
x,
o
].concat(C)), typeof M < "u") return M;
V && (k = k.slice(0, -1 * V * 2), x = x.slice(0, -1 * V), o = o.slice(0, -1 * V)), k.push(this.productions_[P[1]][0]), x.push(O.$), o.push(O._$), Z = _[k[k.length - 2]][k[k.length - 1]], k.push(Z);
break;
case 3:
return !0;
}
}
return !0;
}, "parse")
};
S.lexer = /* @__PURE__ */ (function() {
return {
EOF: 1,
parseError: /* @__PURE__ */ w(function(g, v) {
if (this.yy.parser) this.yy.parser.parseError(g, v);
else throw new Error(g);
}, "parseError"),
setInput: /* @__PURE__ */ w(function(m, g) {
return this.yy = g || this.yy || {}, this._input = m, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
}, "setInput"),
input: /* @__PURE__ */ w(function() {
var m = this._input[0];
return this.yytext += m, this.yyleng++, this.offset++, this.match += m, this.matched += m, m.match(/(?:\r\n?|\n).*/g) ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), m;
}, "input"),
unput: /* @__PURE__ */ w(function(m) {
var g = m.length, v = m.split(/(?:\r\n?|\n)/g);
this._input = m + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - g), this.offset -= g;
var k = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), v.length - 1 && (this.yylineno -= v.length - 1);
var p = this.yylloc.range;
return this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: v ? (v.length === k.length ? this.yylloc.first_column : 0) + k[k.length - v.length].length - v[0].length : this.yylloc.first_column - g
}, this.options.ranges && (this.yylloc.range = [p[0], p[0] + this.yyleng - g]), this.yyleng = this.yytext.length, this;
}, "unput"),
more: /* @__PURE__ */ w(function() {
return this._more = !0, this;
}, "more"),
reject: /* @__PURE__ */ w(function() {
if (this.options.backtrack_lexer) this._backtrack = !0;
else return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
return this;
}, "reject"),
less: /* @__PURE__ */ w(function(m) {
this.unput(this.match.slice(m));
}, "less"),
pastInput: /* @__PURE__ */ w(function() {
var m = this.matched.substr(0, this.matched.length - this.match.length);
return (m.length > 20 ? "..." : "") + m.substr(-20).replace(/\n/g, "");
}, "pastInput"),
upcomingInput: /* @__PURE__ */ w(function() {
var m = this.match;
return m.length < 20 && (m += this._input.substr(0, 20 - m.length)), (m.substr(0, 20) + (m.length > 20 ? "..." : "")).replace(/\n/g, "");
}, "upcomingInput"),
showPosition: /* @__PURE__ */ w(function() {
var m = this.pastInput(), g = new Array(m.length + 1).join("-");
return m + this.upcomingInput() + `
` + g + "^";
}, "showPosition"),
test_match: /* @__PURE__ */ w(function(m, g) {
var v, k, p;
if (this.options.backtrack_lexer && (p = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
}, this.options.ranges && (p.yylloc.range = this.yylloc.range.slice(0))), k = m[0].match(/(?:\r\n?|\n).*/g), k && (this.yylineno += k.length), this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: k ? k[k.length - 1].length - k[k.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + m[0].length
}, this.yytext += m[0], this.match += m[0], this.matches = m, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(m[0].length), this.matched += m[0], v = this.performAction.call(this, this.yy, this, g, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), v) return v;
if (this._backtrack) {
for (var x in p) this[x] = p[x];
return !1;
}
return !1;
}, "test_match"),
next: /* @__PURE__ */ w(function() {
if (this.done) return this.EOF;
this._input || (this.done = !0);
var m, g, v, k;
this._more || (this.yytext = "", this.match = "");
for (var p = this._currentRules(), x = 0; x < p.length; x++)
if (v = this._input.match(this.rules[p[x]]), v && (!g || v[0].length > g[0].length)) {
if (g = v, k = x, this.options.backtrack_lexer) {
if (m = this.test_match(v, p[x]), m !== !1) return m;
if (this._backtrack) {
g = !1;
continue;
} else return !1;
} else if (!this.options.flex) break;
}
return g ? (m = this.test_match(g, p[k]), m !== !1 ? m : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}, "next"),
lex: /* @__PURE__ */ w(function() {
var g = this.next();
return g || this.lex();
}, "lex"),
begin: /* @__PURE__ */ w(function(g) {
this.conditionStack.push(g);
}, "begin"),
popState: /* @__PURE__ */ w(function() {
return this.conditionStack.length - 1 > 0 ? this.conditionStack.pop() : this.conditionStack[0];
}, "popState"),
_currentRules: /* @__PURE__ */ w(function() {
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
}, "_currentRules"),
topState: /* @__PURE__ */ w(function(g) {
return g = this.conditionStack.length - 1 - Math.abs(g || 0), g >= 0 ? this.conditionStack[g] : "INITIAL";
}, "topState"),
pushState: /* @__PURE__ */ w(function(g) {
this.begin(g);
}, "pushState"),
stateStackSize: /* @__PURE__ */ w(function() {
return this.conditionStack.length;
}, "stateStackSize"),
options: { "case-insensitive": !0 },
performAction: /* @__PURE__ */ w(function(g, v, k, p) {
switch (k) {
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
if (g.getIndentMode && g.getIndentMode())
return g.consumeIndentText = !0, this.begin("INITIAL"), 22;
break;
case 4:
break;
case 5:
g.setIndentMode && g.setIndentMode(!1), this.begin("INITIAL"), this.unput(v.yytext);
break;
case 6:
return this.begin("bol"), 8;
case 7:
break;
case 8:
break;
case 9:
return 7;
case 10:
return 11;
case 11:
return 5;
case 12:
return 12;
case 13:
return 17;
case 14:
if (g.consumeIndentText) g.consumeIndentText = !1;
else return 19;
break;
case 15:
return 24;
case 16:
return v.yytext = v.yytext.slice(2, -2), 14;
case 17:
return v.yytext = v.yytext.slice(1, -1).trim(), 14;
case 18:
return 16;
case 19:
return 31;